/* ══════════════════════════════════════════════════════════════════════════
   OpsMaster — طبقة التوحيد البصري (٢٧ أكتوبر ٢٠٢٦)
   ══════════════════════════════════════════════════════════════════════════

   ⚠️⚠️ هذه الطبقة **توحّد الشكل ولا تغيّر السلوك**: كل قاعدة هنا تعمل داخل `<main>` فقط
   (فلا تمسّ الشريط الجانبي ولا الترويسة ولا الطباعة) وبرموز `--ops-*` فتتبع الوضع الليلي وحدها.

   ما توحّده:
     ١ · رأس الجدول: خلفية وخطّ ولون واحد في كل جداول البرنامج (كانت كل شاشة تكتب رأسها بنفسها).
     ٢ · خلايا الجدول: حشوة وفاصل وتوسيط رأسي موحَّدة.
     ٣ · البطاقات: نصف قطر وحدّ واحد بدل `rounded-xl` هنا و`rounded-2xl` هناك.
     ٤ · الحقول والأزرار: ارتفاع أدنى واحد (لمس مريح على الجوال).
     ٥ · الحالات الفارغة والقوائم الطويلة والتمرير الأفقي للجداول.

   ⚠️ للإيقاف في جدولٍ بعينه: أضف إليه `data-polish="off"`. ولإيقاف الملف كله: احذف سطره من
   `layouts/_head-close.blade.php` — لا شيء غيره يعتمد عليه.
   ══════════════════════════════════════════════════════════════════════════ */

/* ── ١ · رأس الجدول ───────────────────────────────────────────────────── */
main table:not([data-polish="off"]) > thead > tr > th,
main table:not([data-polish="off"]) > thead > tr > td {
  background-color: var(--ops-surface-2) !important;
  color: var(--ops-muted) !important;
  font-size: 12px !important;
  font-weight: 600 !important;
  letter-spacing: 0 !important;
  text-transform: none !important;
  text-align: start;
  white-space: nowrap;
  padding-block: 10px !important;
  padding-inline: 14px !important;
  border-bottom: 1px solid var(--ops-line) !important;
}
/* رأس بلا نص (عمود إجراءات/اختيار): لا خلفية شاذّة */
main table:not([data-polish="off"]) > thead > tr > th:empty { padding-inline: 8px !important; }

/* ── ٢ · خلايا الجدول ─────────────────────────────────────────────────── */
main table:not([data-polish="off"]) > tbody > tr > td,
main table:not([data-polish="off"]) > tbody > tr > th {
  padding-block: 11px;
  padding-inline: 14px;
  vertical-align: middle;
  border-bottom: 1px solid var(--ops-hairline);
}
main table:not([data-polish="off"]) > tbody > tr:last-child > td { border-bottom-width: 0; }
/* الأرقام والتواريخ: محاذاة أرقام ثابتة العرض فتتراصّ الأعمدة */
main table:not([data-polish="off"]) td { font-variant-numeric: tabular-nums; }
/* لا يطول الصفّ بنصٍّ كثير: يُقصّ بنقاط ويظهر كاملًا في `title` إن وُجد */
main table:not([data-polish="off"]) td.truncate,
main table:not([data-polish="off"]) td .truncate { overflow: hidden; text-overflow: ellipsis; }

/* التمرير الأفقي في الشاشات الضيّقة بدل تكسير الصفحة */
main .overflow-x-auto { -webkit-overflow-scrolling: touch; }
@media (max-width: 760px) {
  main table:not([data-polish="off"]) { font-size: 12.5px; }
  main table:not([data-polish="off"]) > tbody > tr > td { padding-block: 9px; padding-inline: 10px; }
  main table:not([data-polish="off"]) > thead > tr > th { padding-inline: 10px !important; }
}

/* ── ٣ · البطاقات: شكلٌ واحد ───────────────────────────────────────────── */
main :is(.bg-white, .ops-card, .dx-panel).rounded-xl,
main :is(.bg-white, .ops-card, .dx-panel).rounded-2xl {
  border-radius: var(--ops-r-xl);
}
main .bg-white.rounded-xl.border,
main .bg-white.rounded-2xl.border {
  border-color: var(--ops-hairline);
}
/* رأس البطاقة وصفوفها: فاصل واحد خافت */
main .bg-white.rounded-xl > .border-b,
main .bg-white.rounded-2xl > .border-b { border-color: var(--ops-hairline); }

/* ── ٤ · الحقول والأزرار ──────────────────────────────────────────────── */
main :is(input:not([type="checkbox"], [type="radio"], [type="file"], [type="range"], [type="color"], [type="hidden"]), select) {
  min-height: 38px;
}
main :is(button, a)[class*="rounded-lg"][class*="px-"],
main :is(button, a).ops-btn {
  min-height: 36px;
}
@media (pointer: coarse) {
  main :is(input:not([type="checkbox"], [type="radio"], [type="file"], [type="range"], [type="color"], [type="hidden"]), select) { min-height: 44px; }
  main :is(button, a)[class*="rounded-lg"][class*="px-"] { min-height: 44px; }
}
/* صفّ فلاتر واحد المسافات في كل الشاشات */
main form.bg-white.rounded-xl .flex.flex-wrap { row-gap: 10px; }

/* ── ٥ · حالات فارغة وقوائم طويلة ─────────────────────────────────────── */
main .dx-empty, main .empty-state { padding-block: 32px; color: var(--ops-muted); }
/* قائمة روابط/صفوف طويلة داخل بطاقة: تمرير داخلي بدل صفحة تطول بلا نهاية */
main [data-list-cap] { max-height: var(--list-cap, 420px); overflow-y: auto; overscroll-behavior: contain; }

/* ── ٦ · تفاصيل صغيرة تُحسّ ولا تُلاحَظ ────────────────────────────────── */
main a:not([class*="btn"]):hover { text-decoration-thickness: 1px; }
main :is(h1, h2, h3) { text-wrap: balance; }
@media (prefers-reduced-motion: reduce) {
  main *, main *::before, main *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
@media print { main table > thead > tr > th { background: #f1f5f9 !important; color: #334155 !important; } }
