/* ==========================================================================
   نظام إدارة شؤون العاملين — نظام التصميم الموحّد (Unified Design System)
   ثيم احترافي ثابت: فاتح افتراضي + داكن. متجاوب. RTL/LTR عبر الخصائص المنطقية.
   هذا هو الملف الوحيد للأنماط. لا تضِف <style> داخل الصفحات.
   ========================================================================== */

/* ----------------------------- 1. Design Tokens --------------------------- */
:root {
  /* Brand */
  --brand-50:  #eff6ff;
  --brand-100: #dbeafe;
  --brand-200: #bfdbfe;
  --brand-400: #60a5fa;
  --brand-500: #3b82f6;
  --brand-600: #2563eb;
  --brand-700: #1d4ed8;
  --brand-800: #1e40af;

  /* Light theme (default) */
  --bg:        #f1f5f9;
  --bg-soft:   #e9eef5;
  --surface:   #ffffff;
  --surface-2: #f8fafc;
  --surface-3: #f1f5f9;
  --text:      #0f172a;
  --text-soft: #475569;
  --muted:     #64748b;
  --border:    #e2e8f0;
  --border-strong: #cbd5e1;

  --primary:      var(--brand-600);
  --primary-700:  var(--brand-700);
  --primary-soft: var(--brand-50);
  --on-primary:   #ffffff;

  --success: #16a34a;
  --success-soft: #dcfce7;
  --warning: #d97706;
  --warning-soft: #fef3c7;
  --danger:  #dc2626;
  --danger-soft: #fee2e2;
  --info:    #0891b2;

  --ring: rgba(37, 99, 235, .35);

  /* Elevation */
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .06), 0 1px 3px rgba(15, 23, 42, .08);
  --shadow:    0 4px 12px rgba(15, 23, 42, .08), 0 2px 4px rgba(15, 23, 42, .05);
  --shadow-lg: 0 12px 32px rgba(15, 23, 42, .14), 0 4px 8px rgba(15, 23, 42, .06);

  /* Geometry */
  --r-sm: 8px;
  --r:    12px;
  --r-lg: 18px;
  --r-xl: 24px;

  /* Spacing scale */
  --s-1: 4px;  --s-2: 8px;  --s-3: 12px; --s-4: 16px;
  --s-5: 20px; --s-6: 24px; --s-8: 32px; --s-10: 40px; --s-12: 48px;

  --sidebar-w: 290px;
  --topbar-h:  68px;

  --font: "Cairo", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --speed: .18s;
}

[data-theme="dark"] {
  --bg:        #0b1120;
  --bg-soft:   #0e1626;
  --surface:   #131c2e;
  --surface-2: #1a2438;
  --surface-3: #202c44;
  --text:      #e8eef9;
  --text-soft: #aab6cc;
  --muted:     #7e8aa3;
  --border:    #243049;
  --border-strong: #324063;

  --primary:      var(--brand-500);
  --primary-700:  var(--brand-400);
  --primary-soft: rgba(59, 130, 246, .14);
  --on-primary:   #0b1120;

  --success-soft: rgba(34, 197, 94, .16);
  --warning-soft: rgba(217, 119, 6, .18);
  --danger-soft:  rgba(220, 38, 38, .18);

  --ring: rgba(96, 165, 250, .4);

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow:    0 6px 18px rgba(0, 0, 0, .45);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, .55);
}

/* ----------------------------- 2. Reset / Base ---------------------------- */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background var(--speed) ease, color var(--speed) ease;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-700); }

img { max-width: 100%; display: block; }

h1, h2, h3, h4 { margin: 0 0 var(--s-3); line-height: 1.3; font-weight: 800; color: var(--text); }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.1rem; }
p  { margin: 0 0 var(--s-3); color: var(--text-soft); }

:focus-visible { outline: 3px solid var(--ring); outline-offset: 2px; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 999px; }
::-webkit-scrollbar-track { background: transparent; }

/* ----------------------------- 3. App Shell ------------------------------- */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  position: sticky;
  top: 0;
  align-self: start;
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-inline-end: 1px solid var(--border);
  overflow-y: auto;
  z-index: 40;
}

.sidebar__brand {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-5) var(--s-5) var(--s-4);
  border-bottom: 1px solid var(--border);
}
.sidebar__brand .logo {
  width: 46px; height: 46px; flex: none;
  border-radius: var(--r);
  background: var(--surface-2);
  border: 1px solid var(--border);
  object-fit: contain; padding: 5px;
}
.sidebar__brand .brand-text { min-width: 0; }
.sidebar__brand .brand-ar { font-weight: 800; font-size: .9rem; line-height: 1.35; }
.sidebar__brand .brand-en { font-size: .68rem; color: var(--muted); margin-top: 2px; }

.sidebar__section {
  padding: var(--s-4) var(--s-4) var(--s-2);
  font-size: .7rem; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; color: var(--muted);
}

.nav { display: flex; flex-direction: column; gap: 2px; padding: 0 var(--s-3) var(--s-3); }
.nav__link {
  display: flex; align-items: center; gap: var(--s-3);
  padding: 10px 12px;
  border-radius: var(--r);
  color: var(--text-soft);
  font-weight: 600;
  border: 1px solid transparent;
  transition: background var(--speed), color var(--speed);
}
.nav__link .ic { width: 18px; height: 18px; flex: none; opacity: .85; }
.nav__link:hover { background: var(--surface-2); color: var(--text); }
.nav__link.active {
  background: var(--primary-soft);
  color: var(--primary-700);
  border-color: color-mix(in srgb, var(--primary) 22%, transparent);
}
.nav__link .count {
  margin-inline-start: auto;
  font-size: .68rem; font-weight: 700;
  background: var(--surface-3); color: var(--muted);
  padding: 1px 8px; border-radius: 999px;
}

.sidebar__footer {
  margin-top: auto;
  padding: var(--s-4);
  border-top: 1px solid var(--border);
  font-size: .72rem; color: var(--muted);
}
.sidebar__footer .team-title { font-weight: 700; color: var(--text-soft); margin-bottom: var(--s-2); }
.sidebar__footer ul { list-style: none; margin: 0; padding: 0; }
.sidebar__footer li { padding: 3px 0; }

/* Main column */
.main { min-width: 0; display: flex; flex-direction: column; }

/* Topbar */
.topbar {
  position: sticky; top: 0; z-index: 30;
  height: var(--topbar-h);
  display: flex; align-items: center; gap: var(--s-3);
  padding: 0 var(--s-6);
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(180%) blur(8px);
  border-bottom: 1px solid var(--border);
}
.topbar__title { font-weight: 800; font-size: 1.05rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar__spacer { flex: 1; }
.topbar__actions { display: flex; align-items: center; gap: var(--s-2); }

/* زر القائمة يظهر على الموبايل فقط — رفع الأولوية ليتغلّب على .icon-btn */
.icon-btn.menu-toggle { display: none; }

.content { padding: var(--s-6); max-width: 1400px; width: 100%; min-width: 0; }

/* ----------------------------- 4. Buttons --------------------------------- */
.btn {
  --_bg: var(--surface);
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2);
  padding: 9px 16px;
  font-family: inherit; font-size: .9rem; font-weight: 700;
  color: var(--text);
  background: var(--_bg);
  border: 1px solid var(--border-strong);
  border-radius: var(--r);
  cursor: pointer;
  white-space: nowrap;
  transition: transform var(--speed), filter var(--speed), background var(--speed), border-color var(--speed);
  user-select: none;
}
.btn:hover { filter: brightness(.98); border-color: var(--muted); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }

.btn.primary, .btn-primary, .btnPrimary {
  background: var(--primary); color: var(--on-primary);
  border-color: transparent;
}
.btn.primary:hover, .btn-primary:hover, .btnPrimary:hover { background: var(--primary-700); filter: none; }

.btn.danger, .btn-danger { background: var(--danger); color: #fff; border-color: transparent; }
.btn.danger:hover, .btn-danger:hover { filter: brightness(1.05); }

.btn.ghost { background: transparent; border-color: var(--border); }
.btn.ghost:hover { background: var(--surface-2); }

.btn.sm, .btn-sm { padding: 6px 11px; font-size: .8rem; border-radius: var(--r-sm); }
.btn.block { width: 100%; }

/* Icon-only button (theme/lang toggles) */
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 40px; min-width: 40px; padding: 0 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r);
  color: var(--text-soft);
  font-weight: 700; font-size: .82rem; cursor: pointer;
  transition: background var(--speed), color var(--speed);
}
.icon-btn:hover { background: var(--surface-3); color: var(--text); }
.icon-btn .ic { width: 18px; height: 18px; }

/* ----------------------------- 5. Pills / Badges -------------------------- */
.pill, .chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 11px;
  font-size: .78rem; font-weight: 700;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-soft);
}
.pill--ghost { background: transparent; }

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: 999px;
  font-size: .74rem; font-weight: 700;
}
.badge--success { background: var(--success-soft); color: var(--success); }
.badge--warning { background: var(--warning-soft); color: var(--warning); }
.badge--danger  { background: var(--danger-soft);  color: var(--danger); }
.badge--info    { background: var(--primary-soft); color: var(--primary-700); }
.badge--muted   { background: var(--surface-3);    color: var(--muted); }

/* ----------------------------- 6. Cards ----------------------------------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
}
.card__head {
  display: flex; align-items: center; gap: var(--s-3);
  padding: var(--s-4) var(--s-5);
  border-bottom: 1px solid var(--border);
}
.card__title { font-weight: 800; font-size: 1rem; margin: 0; }
.card__body { padding: var(--s-5); }
.card__foot { padding: var(--s-4) var(--s-5); border-top: 1px solid var(--border); }

/* Stat tiles */
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: var(--s-4); }
.stat {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--s-5);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.stat::before {
  content: ""; position: absolute; inset-block: 0; inset-inline-start: 0;
  width: 4px; background: var(--primary);
}
.stat__label { font-size: .82rem; color: var(--muted); font-weight: 600; }
.stat__value { font-size: 2rem; font-weight: 800; margin-top: var(--s-1); letter-spacing: -.02em; }
.stat__icon {
  position: absolute; inset-block-start: var(--s-4); inset-inline-end: var(--s-4);
  width: 38px; height: 38px; display: grid; place-items: center;
  border-radius: var(--r); background: var(--primary-soft); color: var(--primary-700);
}

/* ----------------------------- 7. Grid helpers ---------------------------- */
.grid { display: grid; gap: var(--s-4); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-auto { grid-template-columns: repeat(auto-fill, minmax(min(240px, 100%), 1fr)); }
/* امنع عناصر الشبكة/الإحصاء من تجاوز عرض الحاوية (سبب الـscroll الأفقي للصفحة) */
.grid > *, .stats > * { min-width: 0; }

/* تخطيط «عمود جانبي + محتوى» يطوي تلقائياً على الشاشات الصغيرة */
.split-aside { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: var(--s-4); align-items: start; }
.split-aside > * { min-width: 0; }
.row { display: flex; gap: var(--s-3); flex-wrap: wrap; align-items: center; }
.between { justify-content: space-between; }
.page-head { display: flex; align-items: center; gap: var(--s-4); flex-wrap: wrap; margin-bottom: var(--s-5); }
.page-head h1 { margin: 0; }
.spacer { flex: 1; }

/* ----------------------------- 8. Forms ----------------------------------- */
/* منتقي التاريخ والعناصر الأصلية تتبع الثيم (فاتح/داكن) */
:root { color-scheme: light; }
[data-theme="dark"] { color-scheme: dark; }

.field { margin-bottom: var(--s-4); }
.field > label, .label {
  display: block; margin-bottom: 7px;
  font-size: .82rem; font-weight: 700; color: var(--text-soft);
}
.field .req { color: var(--danger); margin-inline-start: 3px; }
.field .hint { display: block; margin-top: 5px; font-size: .74rem; color: var(--muted); }

/* جميع الحقول بنفس الستايل والحجم الثابت (الارتفاع 44px) */
.input,
input:not([type]),
input[type="text"], input[type="email"], input[type="password"],
input[type="number"], input[type="date"], input[type="datetime-local"],
input[type="time"], input[type="month"], input[type="search"],
input[type="tel"], input[type="url"], input[type="file"],
select, textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px 14px;
  font-family: inherit; font-size: .92rem; line-height: 1.4;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--r);
  transition: border-color var(--speed), box-shadow var(--speed), background var(--speed);
  appearance: none;
}
textarea { min-height: 104px; resize: vertical; padding-top: 11px; }

/* hover */
.input:hover, input:hover, select:hover, textarea:hover {
  border-color: var(--muted);
}
/* focus / selection */
.input:focus, input:focus, select:focus, textarea:focus,
.input:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--ring);
  background: var(--surface);
}
/* حالة الخطأ في التحقق (HTML5) — تظهر بعد محاولة الإرسال */
.input:user-invalid, input:user-invalid, select:user-invalid, textarea:user-invalid {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px var(--danger-soft);
}
input:disabled, select:disabled, textarea:disabled {
  background: var(--surface-3); color: var(--muted); cursor: not-allowed;
}
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 1; }

/* القوائم المنسدلة: سهم موحّد */
select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.5'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: left 14px center;
  padding-inline-end: 36px;
  cursor: pointer;
}
html[dir="ltr"] select { background-position: right 14px center; }

/* حقل رفع الملفات */
input[type="file"] { padding: 7px 12px; cursor: pointer; }
input[type="file"]::file-selector-button {
  font-family: inherit; font-weight: 700; font-size: .82rem;
  color: var(--text); background: var(--surface-2);
  border: 1px solid var(--border-strong); border-radius: var(--r-sm);
  padding: 7px 12px; margin-inline-end: 12px; cursor: pointer;
  transition: background var(--speed);
}
input[type="file"]::file-selector-button:hover { background: var(--surface-3); }

.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(240px, 100%), 1fr)); gap: var(--s-4); }
.form-grid .field { margin-bottom: 0; }
.form-grid .field.full { grid-column: 1 / -1; }

/* ----------------------------- 9. Tables ---------------------------------- */
.table-wrap, .tableWrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  overflow-x: auto;            /* تمرير الجدول العريض داخل البطاقة فقط */
  max-width: 100%;
  -webkit-overflow-scrolling: touch;
}
table.data-table, .table-wrap table, table.table {
  width: 100%; border-collapse: collapse; font-size: .88rem;
}
.data-table th, .table-wrap th, table.table th {
  position: sticky; top: 0;
  text-align: start; font-weight: 800; white-space: nowrap;
  padding: 12px 14px;
  background: var(--surface-2);
  color: var(--text-soft);
  border-bottom: 2px solid var(--border);
}
.data-table td, .table-wrap td, table.table td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.data-table tbody tr:hover td, .table-wrap tbody tr:hover td { background: var(--surface-2); }
.data-table tbody tr:last-child td { border-bottom: none; }
.table-actions { display: flex; gap: 6px; }

/* ----------------------------- 10. Alerts --------------------------------- */
.alert {
  display: flex; gap: var(--s-3); align-items: flex-start;
  padding: 12px 16px; border-radius: var(--r);
  border: 1px solid transparent; font-weight: 600; font-size: .9rem;
  margin-bottom: var(--s-4);
}
.alert--success { background: var(--success-soft); color: var(--success); border-color: color-mix(in srgb, var(--success) 30%, transparent); }
.alert--danger  { background: var(--danger-soft);  color: var(--danger);  border-color: color-mix(in srgb, var(--danger) 30%, transparent); }
.alert--warning { background: var(--warning-soft); color: var(--warning); border-color: color-mix(in srgb, var(--warning) 30%, transparent); }
.alert--info    { background: var(--primary-soft); color: var(--primary-700); border-color: color-mix(in srgb, var(--primary) 25%, transparent); }

/* ----------------------------- 11. Auth (login) shell --------------------- */
.auth {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  background: var(--bg);
}
.auth__aside {
  position: relative;
  display: flex; flex-direction: column; justify-content: center;
  gap: var(--s-5);
  padding: var(--s-12);
  color: #fff;
  background:
    radial-gradient(1200px 600px at 20% 10%, rgba(255,255,255,.12), transparent 60%),
    linear-gradient(160deg, var(--brand-700), var(--brand-800) 55%, #142a63);
  overflow: hidden;
}
.auth__aside::after {
  content: ""; position: absolute; inset: 0;
  background-image: radial-gradient(rgba(255,255,255,.07) 1px, transparent 1px);
  background-size: 22px 22px; opacity: .5;
}
.auth__brand { display: flex; align-items: center; gap: var(--s-4); position: relative; }
.auth__brand img { width: 64px; height: 64px; border-radius: var(--r); background: rgba(255,255,255,.14); padding: 8px; }
.auth__title { font-size: 1.7rem; font-weight: 800; line-height: 1.3; position: relative; max-width: 30ch; }
.auth__subtitle { color: rgba(255,255,255,.82); position: relative; max-width: 42ch; }
.auth__panel {
  display: flex; align-items: center; justify-content: center; padding: var(--s-8);
}
.auth__card {
  width: 100%; max-width: 400px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-lg);
  padding: var(--s-8);
}

/* ----------------------------- 12. Utilities ------------------------------ */
.text-muted { color: var(--muted) !important; }
.text-center { text-align: center; }
.mt-0 { margin-top: 0; } .mt-2 { margin-top: var(--s-2); } .mt-4 { margin-top: var(--s-4); }
.mb-0 { margin-bottom: 0; } .mb-4 { margin-bottom: var(--s-4); }
.hidden { display: none !important; }
.divider { height: 1px; background: var(--border); margin: var(--s-4) 0; border: 0; }
.scrim { position: fixed; inset: 0; background: rgba(15,23,42,.5); z-index: 35; opacity: 0; pointer-events: none; transition: opacity var(--speed); }
.scrim.show { opacity: 1; pointer-events: auto; }

/* ----------------------------- 13. Responsive ----------------------------- */
@media (max-width: 1024px) {
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 860px) {
  :root { --sidebar-w: 270px; }
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; inset-block: 0; inset-inline-start: 0;
    width: var(--sidebar-w);
    transform: translateX(-100%);
    box-shadow: var(--shadow-lg);
    transition: transform var(--speed) ease;
  }
  html[dir="rtl"] .sidebar { transform: translateX(100%); }
  .sidebar.open,
  html[dir="rtl"] .sidebar.open { transform: translateX(0); }
  .icon-btn.menu-toggle { display: inline-flex; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .split-aside { grid-template-columns: 1fr; }
  .auth { grid-template-columns: 1fr; }
  .auth__aside { display: none; }
  .content { padding: var(--s-4); }
  .topbar { padding: 0 var(--s-4); }
}
@media (max-width: 560px) {
  .topbar .chip { display: none; }            /* declutter user chip on phones */
  .topbar__actions .btn.ghost span { display: none; } /* logout icon-only */
}
@media (max-width: 480px) {
  .topbar__title { font-size: .92rem; }
  .stat__value { font-size: 1.6rem; }
}

/* ----- الجداول تتحوّل إلى بطاقات عمودية على الجوال (بدل التمرير الأفقي) ----- */
@media (max-width: 720px) {
  .table-wrap, .tableWrap {
    border: 0; box-shadow: none; background: transparent; overflow: visible;
  }
  .table-wrap > table, .tableWrap > table, .table-wrap table, .tableWrap table { border: 0; width: 100%; }
  /* إخفاء رأس الجدول بصرياً (يبقى متاحاً للقارئات) */
  .table-wrap thead, .tableWrap thead {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
  }
  .table-wrap tbody, .tableWrap tbody,
  .table-wrap tr, .tableWrap tr,
  .table-wrap td, .tableWrap td { display: block; width: 100%; }
  .table-wrap tr, .tableWrap tr {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--r-lg); box-shadow: var(--shadow-sm);
    margin-bottom: var(--s-3); overflow: hidden;
  }
  .table-wrap tbody tr:hover td, .tableWrap tbody tr:hover td { background: transparent; }
  .table-wrap td, .tableWrap td {
    display: flex; align-items: center; justify-content: space-between; gap: var(--s-3);
    padding: 11px 14px; border: 0; border-bottom: 1px solid var(--border);
    text-align: end; white-space: normal; min-height: 0;
  }
  .table-wrap td:last-child, .tableWrap td:last-child { border-bottom: 0; }
  .table-wrap td::before, .tableWrap td::before {
    content: attr(data-label); font-weight: 700; color: var(--text-soft);
    text-align: start; flex: 0 0 38%; white-space: normal;
  }
  .table-wrap td[data-label=""]::before, .tableWrap td[data-label=""]::before { content: ""; flex: 0; }
  /* خلية العمليات: عرض كامل والأزرار تلتف */
  .table-wrap td.cell-actions, .tableWrap td.cell-actions { display: block; background: var(--surface-2); }
  .table-wrap td.cell-actions::before, .tableWrap td.cell-actions::before { content: ""; }
  .table-wrap td.cell-actions .table-actions { flex-wrap: wrap; }
  .table-wrap td.cell-actions .table-actions .btn,
  .table-wrap td.cell-actions .table-actions form { flex: 1 1 auto; }
  .table-wrap td.cell-actions .table-actions .btn { width: 100%; }
}

@media print {
  .sidebar, .topbar, .no-print { display: none !important; }
  .app { grid-template-columns: 1fr; }
  body { background: #fff; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
