/* ==== css/tokens.css ==== */
/* ============================================================
   Smoyz with HR — Design Tokens
   ------------------------------------------------------------
   ★ نقطة تغيير الهوية الوحيدة في المشروع.
   الألوان مأخوذة من لوجو Smoyz: نيون برتقالي ناري + سماوي
   + بنفسجي على خلفية داكنة، مع أخضر الثعبان كلون مساعد.
   ============================================================ */

:root {
  /* ---- Brand — Smoyz neon ----------------------------------- */
  --brand-black:      #0A0711;  /* أسود بنفسجي — خلفية اللوجو */
  --brand-flame:      #FF5B14;  /* برتقالي ناري — اللون الأساسي */
  --brand-flame-600:  #E44708;
  --brand-flame-300:  #FF8A4D;
  --brand-flame-glow: rgba(255, 91, 20, 0.35);
  --brand-cyan:       #2BB8FF;  /* سماوي نيون */
  --brand-cyan-600:   #1795D8;
  --brand-violet:     #A62BFF;  /* بنفسجي نيون */
  --brand-violet-600: #8A17E0;
  --brand-venom:      #45D95B;  /* أخضر الثعبان */
  --brand-gold:       #F2A93B;  /* ذهبي — سطر "LET THE GAME BEGIN" */

  /* ---- Semantic surfaces (Dark — الوضع الأساسي) -------------- */
  --bg:            #0A0711;
  --surface:       #130E1D;
  --surface-2:     #191225;
  --surface-3:     #221930;
  --border:        #2B2140;
  --border-strong: #3D2F58;

  /* ---- Text -------------------------------------------------- */
  --text:        #F0ECF7;
  --text-muted:  #A093B8;
  --text-subtle: #726389;
  --text-invert: #0A0711;

  /* ---- Status ------------------------------------------------ */
  --success:     #45D95B;
  --success-bg:  #102916;
  --warning:     #F2A93B;
  --warning-bg:  #2B2010;
  --danger:      #FF5B58;
  --danger-bg:   #2E1315;
  --info:        #2BB8FF;
  --info-bg:     #0D2233;

  /* ---- Typography -------------------------------------------- */
  --font-ar: "Dubai", "Cairo", "Segoe UI", "Tahoma", sans-serif;
  --font-en: "Inter", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --font: var(--font-en);
  --font-display: "Impact", "Haettenschweiler", "Arial Narrow", var(--font-en);
  --font-mono: "Cascadia Mono", "Consolas", ui-monospace, monospace;

  --fs-xs:  0.75rem;
  --fs-sm:  0.8125rem;
  --fs-md:  0.875rem;
  --fs-base:0.9375rem;
  --fs-lg:  1.0625rem;
  --fs-xl:  1.25rem;
  --fs-2xl: 1.5rem;
  --fs-3xl: 1.875rem;

  --fw-normal: 400;
  --fw-medium: 500;
  --fw-semi:   600;
  --fw-bold:   700;

  --lh-tight: 1.25;
  --lh-base:  1.6;

  /* ---- Spacing ----------------------------------------------- */
  --sp-1: 0.25rem;
  --sp-2: 0.5rem;
  --sp-3: 0.75rem;
  --sp-4: 1rem;
  --sp-5: 1.25rem;
  --sp-6: 1.5rem;
  --sp-8: 2rem;
  --sp-10: 2.5rem;
  --sp-12: 3rem;

  /* ---- Radius / Shadow / Motion ------------------------------ */
  --r-sm: 4px;
  --r-md: 8px;
  --r-lg: 12px;
  --r-xl: 16px;
  --r-full: 999px;

  --sh-sm: 0 1px 2px rgba(0, 0, 0, 0.45);
  --sh-md: 0 2px 10px rgba(0, 0, 0, 0.5);
  --sh-lg: 0 8px 28px rgba(0, 0, 0, 0.55);
  --sh-xl: 0 20px 50px rgba(0, 0, 0, 0.65);
  --glow:  0 0 18px var(--brand-flame-glow);

  --ease: cubic-bezier(0.2, 0, 0.15, 1);
  --dur: 160ms;

  /* ---- Layout ------------------------------------------------ */
  --sidebar-w: 248px;
  --topbar-h: 60px;
  --content-max: 1400px;
  --z-modal: 900;
  --z-toast: 1000;
}

/* ---- Light theme ---------------------------------------------
   نفس الهوية بنبرة نهارية — النيون بيتحوّل لألوان مشبعة على أبيض
   عشان الطباعة وقراءة الجداول الطويلة تفضل مريحة.               */
:root[data-theme="light"] {
  --bg:            #F4F2F7;
  --surface:       #FFFFFF;
  --surface-2:     #FAF9FC;
  --surface-3:     #EFECF4;
  --border:        #E0DBE9;
  --border-strong: #C7BFD6;

  --text:        #1A1226;
  --text-muted:  #5E5273;
  --text-subtle: #8B7FA1;
  --text-invert: #FFFFFF;

  --brand-flame-600: #C93F06;
  --brand-cyan:      #0C82C4;
  --brand-violet:    #7A18CC;

  --success:     #1E8A38;
  --success-bg:  #E6F6EA;
  --warning:     #A56C0A;
  --warning-bg:  #FCF2DD;
  --danger:      #C2352F;
  --danger-bg:   #FCE9E8;
  --info:        #0C6FA8;
  --info-bg:     #E4F2FA;

  --sh-sm: 0 1px 2px rgba(26, 18, 38, 0.06);
  --sh-md: 0 2px 8px rgba(26, 18, 38, 0.08);
  --sh-lg: 0 8px 28px rgba(26, 18, 38, 0.12);
  --sh-xl: 0 20px 50px rgba(26, 18, 38, 0.18);
  --glow:  0 0 0 rgba(0, 0, 0, 0);
}

/* ---- Arabic switches the type stack -------------------------- */
:root[lang="ar"] {
  --font: var(--font-ar);
}

/* ==== css/base.css ==== */
/* ============================================================
   Smoyz with HR — Base / Reset / Typography
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: var(--fs-base);
  line-height: var(--lh-base);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4, h5, h6, p, figure, blockquote, dl, dd { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }

h1 { font-size: var(--fs-2xl); font-weight: var(--fw-bold); line-height: var(--lh-tight); }
h2 { font-size: var(--fs-xl); font-weight: var(--fw-semi); line-height: var(--lh-tight); }
h3 { font-size: var(--fs-lg); font-weight: var(--fw-semi); line-height: var(--lh-tight); }
h4 { font-size: var(--fs-base); font-weight: var(--fw-semi); }

a { color: var(--brand-cyan); text-decoration: none; }
a:hover { text-decoration: underline; }

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

button, input, select, textarea {
  font: inherit;
  color: inherit;
}

button { cursor: pointer; background: none; border: none; padding: 0; }

:focus-visible {
  outline: 2px solid var(--brand-cyan);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}

/* الأرقام لاتينية دايمًا حتى في الوضع العربي — مطلوب في المستندات الرسمية */
:root[lang="ar"] { font-feature-settings: "lnum" 1; }
.num, table td, table th, input, .kpi-value {
  font-variant-numeric: lining-nums tabular-nums;
  direction: ltr;
  unicode-bidi: plaintext;
}
/* td/th عليهم direction:ltr + plaintext (عشان الأرقام) — فـ"start" كان بيتحسب من محتوى الخانة:
   العنوان العربي يمين، والتاريخ/المبلغ/الـbadge شمال → الأعمدة مش متوازية. نثبّتها يمين صريح. */
:root[dir="rtl"] table td, :root[dir="rtl"] table th { text-align: right; }
:root[dir="ltr"] table td, :root[dir="ltr"] table th { text-align: left; }

/* Utilities ---------------------------------------------------- */
.hidden { display: none !important; }
.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.muted { color: var(--text-muted); }
.subtle { color: var(--text-subtle); }
.small { font-size: var(--fs-sm); }
.text-end { text-align: end; }
.text-center { text-align: center; }
.nowrap { white-space: nowrap; }
.mono { font-family: var(--font-mono); }

.row { display: flex; align-items: center; gap: var(--sp-3); }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); }
.col { display: flex; flex-direction: column; gap: var(--sp-3); }
.wrap { flex-wrap: wrap; }
.grow { flex: 1; }
.gap-1 { gap: var(--sp-1); } .gap-2 { gap: var(--sp-2); }
.gap-4 { gap: var(--sp-4); } .gap-6 { gap: var(--sp-6); }
.mt-2 { margin-top: var(--sp-2); } .mt-4 { margin-top: var(--sp-4); }
.mt-6 { margin-top: var(--sp-6); } .mb-4 { margin-bottom: var(--sp-4); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ==== css/components.css ==== */
/* ============================================================
   Smoyz with HR — Components
   ============================================================ */

/* ---- Card ---------------------------------------------------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-sm);
}
.card-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--sp-3);
  padding: var(--sp-4) var(--sp-5);
  border-bottom: 1px solid var(--border);
}
.card-head h3 { margin: 0; }
.card-body { padding: var(--sp-5); }
.card-body.flush { padding: 0; }
.card-foot {
  padding: var(--sp-3) var(--sp-5);
  border-top: 1px solid var(--border);
  background: var(--surface-2);
  border-radius: 0 0 var(--r-lg) var(--r-lg);
}

/* ---- Buttons ------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: var(--sp-2);
  padding: 0.5rem 0.9rem;
  border-radius: var(--r-md);
  border: 1px solid transparent;
  background: var(--surface-3);
  color: var(--text);
  font-size: var(--fs-md);
  font-weight: var(--fw-medium);
  white-space: nowrap;
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease), opacity var(--dur) var(--ease);
}
.btn:hover { background: var(--border); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn svg { width: 16px; height: 16px; flex: none; }

.btn-primary { background: var(--brand-flame); color: #fff; box-shadow: var(--glow); }
.btn-primary:hover { background: var(--brand-flame-600); }

.btn-accent { background: var(--brand-cyan); color: #06131C; }
.btn-accent:hover { background: var(--brand-cyan-600); }

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

.btn-quiet { background: transparent; color: var(--text-muted); }
.btn-quiet:hover { background: var(--surface-3); color: var(--text); }

.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { filter: brightness(0.92); }

.btn-sm { padding: 0.3rem 0.6rem; font-size: var(--fs-sm); }
.btn-icon { padding: 0.4rem; border-radius: var(--r-md); }
.btn-block { width: 100%; }

/* ---- Forms --------------------------------------------------- */
.field { display: flex; flex-direction: column; gap: var(--sp-2); }
.field > label {
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  color: var(--text-muted);
}
.field.required > label::after {
  content: " *";
  color: var(--danger);
}

.input, .select, .textarea {
  width: 100%;
  padding: 0.5rem 0.7rem;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  font-size: var(--fs-md);
  color: var(--text);
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--brand-cyan);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-cyan) 25%, transparent);
}
.input:disabled, .select:disabled, .textarea:disabled {
  background: var(--surface-3);
  color: var(--text-muted);
  cursor: not-allowed;
}
.textarea { min-height: 84px; resize: vertical; line-height: var(--lh-base); }
.select { appearance: none; padding-inline-end: 2rem; background-image: none; }

/* ---- خانة التاريخ يوم/شهر/سنة ---- */
.date-field { position: relative; display: block; }
.date-field .date-text { padding-inline-end: 2.4rem; direction: ltr; text-align: start; }
:root[dir="rtl"] .date-field .date-text { text-align: right; }
.date-field .date-native {
  position: absolute; inset-inline-end: 0.5rem; bottom: 0;
  width: 1px; height: 1px; opacity: 0; pointer-events: none; border: 0; padding: 0;
}
.date-field .date-btn {
  position: absolute; inset-inline-end: 0.4rem; top: 50%;
  transform: translateY(-50%);
  display: grid; place-items: center;
  width: 26px; height: 26px;
  border-radius: var(--r-sm);
  color: var(--text-muted);
}
.date-field .date-btn svg { width: 17px; height: 17px; }
.date-field .date-btn:hover { color: var(--brand-cyan); background: var(--surface-3); }

.field-error { color: var(--danger); font-size: var(--fs-xs); }
.input.invalid, .select.invalid { border-color: var(--danger); }

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--sp-4);
}
.form-grid .span-2 { grid-column: span 2; }
@media (max-width: 640px) { .form-grid .span-2 { grid-column: span 1; } }

.checkbox { display: flex; align-items: center; gap: var(--sp-2); font-size: var(--fs-md); cursor: pointer; }
.checkbox input { width: 16px; height: 16px; accent-color: var(--brand-flame); }

/* ---- Table --------------------------------------------------- */
.table-wrap { overflow-x: auto; }
table.tbl {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-md);
}
table.tbl th {
  text-align: start;
  padding: var(--sp-3) var(--sp-4);
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  font-weight: var(--fw-semi);
  font-size: var(--fs-sm);
  color: var(--text-muted);
  white-space: nowrap;
  position: sticky; top: 0; z-index: 1;
}
table.tbl td {
  padding: var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
table.tbl tbody tr:hover { background: var(--surface-2); }
/* صف اتسجل على أودو — شريط أخضر جانبي وخلفية خفيفة */
table.tbl tbody tr.odoo-logged { background: color-mix(in srgb, var(--success) 12%, transparent); }
table.tbl tbody tr.odoo-logged:hover { background: color-mix(in srgb, var(--success) 18%, transparent); }
table.tbl tbody tr.odoo-logged td:first-child { box-shadow: inset 3px 0 0 var(--success); }
:root[dir="rtl"] table.tbl tbody tr.odoo-logged td:first-child { box-shadow: inset -3px 0 0 var(--success); }
table.tbl tbody tr:last-child td { border-bottom: none; }
table.tbl .row-actions { display: flex; gap: var(--sp-1); justify-content: flex-end; }
table.tbl tr.clickable { cursor: pointer; }

.empty-state {
  padding: var(--sp-12) var(--sp-5);
  text-align: center;
  color: var(--text-muted);
}
.empty-state .empty-title { font-weight: var(--fw-semi); color: var(--text); margin-bottom: var(--sp-2); }

/* ---- Badge --------------------------------------------------- */
.badge {
  display: inline-flex; align-items: center; gap: var(--sp-1);
  padding: 0.15rem 0.55rem;
  border-radius: var(--r-full);
  font-size: var(--fs-xs);
  font-weight: var(--fw-medium);
  background: var(--surface-3);
  color: var(--text-muted);
  white-space: nowrap;
}
.badge-success { background: var(--success-bg); color: var(--success); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-danger  { background: var(--danger-bg);  color: var(--danger); }
.badge-info    { background: var(--info-bg);    color: var(--info); }
.badge-brand   { background: color-mix(in srgb, var(--brand-flame) 18%, transparent); color: var(--brand-flame-300); }
:root[data-theme="light"] .badge-brand { background: #FCE9E0; color: var(--brand-flame-600); }

/* ---- Avatar -------------------------------------------------- */
.avatar {
  width: 36px; height: 36px; flex: none;
  border-radius: var(--r-full);
  background: linear-gradient(135deg, var(--brand-violet), var(--brand-flame));
  color: #fff;
  display: grid; place-items: center;
  font-size: var(--fs-sm);
  font-weight: var(--fw-semi);
  overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-lg { width: 72px; height: 72px; font-size: var(--fs-xl); }

/* ---- Tabs ---------------------------------------------------- */
.tabs {
  display: flex; gap: var(--sp-1);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
}
.tabs button {
  padding: var(--sp-3) var(--sp-4);
  font-size: var(--fs-md);
  font-weight: var(--fw-medium);
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  transition: color var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.tabs button:hover { color: var(--text); }
.tabs button.active { color: var(--brand-flame); border-bottom-color: var(--brand-flame); }

/* ---- Modal --------------------------------------------------- */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(4, 2, 8, 0.66);
  backdrop-filter: blur(2px);
  display: grid; place-items: center;
  padding: var(--sp-4);
  z-index: var(--z-modal);
  animation: fade var(--dur) var(--ease);
}
.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-xl);
  width: min(720px, 100%);
  max-height: 90vh;
  display: flex; flex-direction: column;
  animation: pop var(--dur) var(--ease);
}
.modal.modal-lg { width: min(960px, 100%); }
.modal.modal-sm { width: min(440px, 100%); }
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--sp-3);
  padding: var(--sp-4) var(--sp-5);
  border-bottom: 1px solid var(--border);
}
.modal-body { padding: var(--sp-5); overflow-y: auto; }
.modal-foot {
  display: flex; justify-content: flex-end; gap: var(--sp-2);
  padding: var(--sp-4) var(--sp-5);
  border-top: 1px solid var(--border);
}

@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(0.985); } }

/* ---- Toast --------------------------------------------------- */
#toasts {
  position: fixed;
  inset-block-end: var(--sp-5);
  inset-inline-end: var(--sp-5);
  display: flex; flex-direction: column; gap: var(--sp-2);
  z-index: var(--z-toast);
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  background: var(--surface);
  border: 1px solid var(--border);
  border-inline-start: 3px solid var(--text-muted);
  border-radius: var(--r-md);
  box-shadow: var(--sh-lg);
  font-size: var(--fs-md);
  max-width: 380px;
  animation: pop var(--dur) var(--ease);
}
.toast.success { border-inline-start-color: var(--success); }
.toast.error   { border-inline-start-color: var(--danger); }
.toast.warning { border-inline-start-color: var(--warning); }

/* ---- KPI ----------------------------------------------------- */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--sp-4);
}
.kpi {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--sp-4) var(--sp-5);
  display: flex; flex-direction: column; gap: var(--sp-1);
  box-shadow: var(--sh-sm);
}
.kpi-label { font-size: var(--fs-sm); color: var(--text-muted); }
.kpi-value { font-size: var(--fs-3xl); font-weight: var(--fw-bold); line-height: 1.1; }
.kpi-note { font-size: var(--fs-xs); color: var(--text-subtle); }

/* ---- Alert list (dashboard) ---------------------------------- */
.alert-item {
  display: flex; align-items: flex-start; gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-5);
  border-bottom: 1px solid var(--border);
}
.alert-item:last-child { border-bottom: none; }
.alert-dot { width: 8px; height: 8px; border-radius: var(--r-full); margin-top: 0.5rem; flex: none; }
.alert-dot.danger { background: var(--danger); }
.alert-dot.warning { background: var(--warning); }
.alert-dot.info { background: var(--info); }
.alert-dot.birthday { background: var(--brand-flame); box-shadow: 0 0 8px var(--brand-flame-glow); }
.alert-text { flex: 1; font-size: var(--fs-md); }
.alert-meta { font-size: var(--fs-xs); color: var(--text-subtle); }

/* ---- Definition list (profile) ------------------------------- */
.dl {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--sp-4) var(--sp-5);
}
.dl > div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.dl dt { font-size: var(--fs-xs); color: var(--text-subtle); }
.dl dd { font-size: var(--fs-md); margin: 0; overflow-wrap: anywhere; }

/* ---- Progress ------------------------------------------------ */
.bar {
  height: 6px; width: 100%;
  background: var(--surface-3);
  border-radius: var(--r-full);
  overflow: hidden;
}
.bar > span {
  display: block; height: 100%;
  background: linear-gradient(90deg, var(--brand-violet), var(--brand-cyan));
  border-radius: var(--r-full);
}
.bar.warn > span { background: var(--warning); }
.bar.danger > span { background: var(--danger); }

/* ---- Toolbar ------------------------------------------------- */
.toolbar {
  display: flex; align-items: center; gap: var(--sp-3);
  flex-wrap: wrap;
  margin-bottom: var(--sp-4);
}
.toolbar .search { min-width: 220px; flex: 1; max-width: 340px; }

/* ---- View-only mode ------------------------------------------
   لما المستخدم عنده صلاحية "عرض" بس على الموديول الحالي،
   الراوتر بيحط class على body وده بيخفي كل أدوات التعديل.
   (الحماية الحقيقية في RLS — ده تحسين تجربة بس)                 */
body.view-only .view .btn-primary,
body.view-only .view .btn-accent,
body.view-only .view .btn-danger,
body.view-only .view .row-actions,
body.view-only .view [data-doc-check],
body.view-only .view [data-doc-toggle],
body.view-only .view [data-reg-check],
body.view-only .view [data-odoo-check],
body.view-only .view #medRegChk,
body.view-only .view #socRegChk,
body.view-only .view #editEmpBtn,
body.view-only .view #editContractBtn,
body.view-only .view #delContractBtn,
body.view-only .view #editMedBtn,
body.view-only .view #delMedBtn,
body.view-only .view #editSocBtn,
body.view-only .view #delSocBtn,
body.view-only .view #editTermBtn,
body.view-only .view #delTermBtn,
body.view-only .view #addTermBtn {
  display: none !important;
}

/* ---- إخفاء المبالغ (العهدة) -----------------------------------
   زرار "عين" بيقلب class على حاوية الصفحة — كل رقم مالي بعلامة
   .money-amt بيتغطى بضبابية وميتقراش، ويرجع واضح بضغطة تانية.   */
.money-amt, .priv-hide { transition: filter 150ms ease; }
.amounts-hidden .money-amt,
.amounts-hidden .priv-hide {
  filter: blur(7px);
  user-select: none;
}
#toggleAmountsBtn svg { width: 16px; height: 16px; }

/* ---- مرجع قانون العمل ---------------------------------------- */
.law-notice {
  display: flex; align-items: center; gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-4);
  margin-bottom: var(--sp-4);
  background: var(--info-bg);
  color: var(--info);
  border-radius: var(--r-md);
  font-size: var(--fs-sm);
  border-inline-start: 3px solid var(--info);
}
.law-chips {
  display: flex; flex-wrap: wrap; gap: var(--sp-2);
  margin-bottom: var(--sp-6);
}
.law-chip {
  display: inline-flex; align-items: center; gap: var(--sp-2);
  padding: 0.5rem 0.9rem;
  border-radius: var(--r-full);
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: var(--fs-md);
  font-weight: var(--fw-medium);
  transition: all var(--dur) var(--ease);
}
.law-chip:hover { border-color: var(--brand-cyan); color: var(--text); }
.law-chip.active {
  background: var(--brand-flame);
  border-color: var(--brand-flame);
  color: #fff;
  box-shadow: var(--glow);
}
.law-chip.active .badge { background: rgba(255,255,255,0.22); color: #fff; }
.law-chip-icon { font-size: 1.05rem; }

.law-group { margin-bottom: var(--sp-8); }
.law-group-title {
  display: flex; align-items: center; gap: var(--sp-2);
  font-size: var(--fs-xl);
  margin-bottom: var(--sp-4);
  padding-bottom: var(--sp-2);
  border-bottom: 2px solid var(--brand-flame);
}
.law-item { margin-bottom: var(--sp-3); }
.law-item-title { font-size: var(--fs-lg); color: var(--brand-flame-300); }
:root[data-theme="light"] .law-item-title { color: var(--brand-flame-600); }
.law-item-body { margin-top: var(--sp-3); line-height: 1.8; }
.law-item-body p { margin: 0 0 var(--sp-2); }
.law-item-body p:last-child { margin-bottom: 0; }
.law-list { list-style: none; padding: 0; margin: 0 0 var(--sp-2); }
.law-list li {
  position: relative;
  padding-inline-start: 1.4rem;
  margin-bottom: 0.35rem;
}
.law-list li::before {
  content: '';
  position: absolute; inset-inline-start: 0.3rem; top: 0.7rem;
  width: 6px; height: 6px; border-radius: var(--r-full);
  background: var(--brand-cyan);
}
.law-item-source {
  margin-top: var(--sp-3);
  padding-top: var(--sp-2);
  border-top: 1px dashed var(--border);
  font-size: var(--fs-xs);
  color: var(--text-subtle);
}

/* ---- مهام الأسبوع --------------------------------------------- */
.task-week-label { display: flex; flex-direction: column; align-items: center; min-width: 170px; line-height: 1.3; }
.task-progress { display: flex; flex-direction: column; gap: 6px; min-width: 180px; }
.task-bar { height: 8px; border-radius: var(--r-full); background: var(--surface-3); overflow: hidden; }
.task-bar span {
  display: block; height: 100%; border-radius: inherit;
  background: linear-gradient(90deg, var(--brand-cyan), var(--brand-venom));
  transition: width 300ms ease;
}
.task-quick { display: flex; gap: var(--sp-2); margin-top: var(--sp-4); }
.task-quick .input { flex: 1; }

.task-row {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-5);
  border-bottom: 1px solid var(--border);
}
.task-row:last-child { border-bottom: 0; }
.task-row:hover { background: var(--surface-2); }
.task-row.is-remind { box-shadow: inset 3px 0 0 var(--brand-gold); }
:root[dir="rtl"] .task-row.is-remind { box-shadow: inset -3px 0 0 var(--brand-gold); }

.task-check { position: relative; flex: none; width: 24px; height: 24px; cursor: pointer; }
.task-check input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.task-check span {
  position: absolute; inset: 0; border-radius: 7px;
  border: 2px solid var(--border-strong); background: var(--surface);
  transition: background 150ms, border-color 150ms;
}
.task-check input:checked + span { background: var(--brand-venom); border-color: var(--brand-venom); }
.task-check input:checked + span::after {
  content: ''; position: absolute; left: 7px; top: 3px; width: 6px; height: 11px;
  border: solid #0A0711; border-width: 0 2.5px 2.5px 0; transform: rotate(45deg);
}
.task-check input:focus-visible + span { outline: 2px solid var(--brand-cyan); outline-offset: 2px; }

.task-main { flex: 1; min-width: 0; }
.task-title { font-weight: var(--fw-semi); overflow-wrap: anywhere; }
.task-row.is-done .task-title { text-decoration: line-through; color: var(--text-subtle); font-weight: normal; }
.task-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 4px; font-size: var(--fs-xs); color: var(--text-muted); }
.task-chip { padding: 1px 8px; border-radius: var(--r-full); background: var(--surface-3); white-space: nowrap; }
.task-chip-late { background: var(--warning-bg); color: var(--warning); }
.task-notes { overflow-wrap: anywhere; }

.task-actions { display: flex; align-items: center; gap: 4px; flex: none; }
.task-bell {
  width: 34px; height: 34px; border-radius: var(--r-full);
  border: 1px solid var(--border); background: transparent;
  font-size: 16px; line-height: 1; cursor: pointer; filter: grayscale(1); opacity: 0.6;
  transition: opacity 150ms, filter 150ms, background 150ms;
}
.task-bell:hover { opacity: 1; }
.task-bell.on {
  filter: none; opacity: 1; border-color: var(--brand-gold);
  background: color-mix(in srgb, var(--brand-gold) 16%, transparent);
}
.task-sep {
  padding: var(--sp-2) var(--sp-5); font-size: var(--fs-xs); color: var(--text-subtle);
  background: var(--surface-2); border-bottom: 1px solid var(--border);
}
/* رأس كارت بيفتح ويقفل (قسم الواتساب في المهام) */
.collapse-head {
  width: 100%; background: transparent; border: 0; color: inherit; font: inherit;
  cursor: pointer; text-align: start;
}
.collapse-head:hover { background: var(--surface-2); }
.collapse-head:focus-visible { outline: 2px solid var(--brand-cyan); outline-offset: -2px; }
.collapse-arrow {
  display: grid; place-items: center; flex: none;
  width: 32px; height: 32px; border-radius: var(--r-full);
  border: 1px solid var(--border); color: var(--text-muted);
  transition: transform 200ms ease, background 150ms;
}
.collapse-arrow svg { width: 18px; height: 18px; }
.collapse-head[aria-expanded="true"] .collapse-arrow { transform: rotate(180deg); }
.collapse-head:hover .collapse-arrow { color: var(--text); background: var(--surface-3); }
.collapse-head { border-radius: var(--r-lg) var(--r-lg) 0 0; }
.card.is-collapsed .collapse-head { border-bottom: 0; border-radius: var(--r-lg); }
.card-body[hidden] { display: none !important; }

.share-list {
  margin-top: var(--sp-2); max-height: 46vh; overflow-y: auto;
  border: 1px solid var(--border); border-radius: var(--r-md, 10px);
}
.share-item { padding: 10px 12px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.share-item:last-child { border-bottom: 0; }
.share-item:hover { background: var(--surface-2); }
.share-title { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.share-title.is-done { text-decoration: line-through; color: var(--text-subtle); }
.share-all { font-weight: var(--fw-semi); }
.modal-foot { flex-wrap: wrap; }
.wa-steps summary { cursor: pointer; font-weight: var(--fw-semi); color: var(--brand-cyan); }
.wa-steps ol { margin: var(--sp-3) 0 0; padding-inline-start: 1.4rem; line-height: 2; }
.wa-steps code {
  display: inline-block; padding: 2px 8px; border-radius: 6px;
  background: var(--surface-3); user-select: all; font-size: var(--fs-sm);
}
@media (max-width: 640px) {
  .task-row { flex-wrap: wrap; padding: var(--sp-3); }
  .task-actions { width: 100%; justify-content: flex-end; }
  .task-week-label { min-width: 0; }
  .task-progress { width: 100%; }
}

/* ---- Spinner ------------------------------------------------- */
.spinner {
  width: 20px; height: 20px;
  border: 2px solid var(--border-strong);
  border-top-color: var(--brand-flame);
  border-radius: var(--r-full);
  animation: spin 700ms linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading { display: grid; place-items: center; padding: var(--sp-12); }

/* ---- مرجع القانون: العنوان بيفتح اللائحة على صفحة البند ---- */
a.law-item-link { color: inherit; text-decoration: none; font: inherit; margin: 0; }
a.law-item-link:hover { color: var(--brand-cyan); text-decoration: none; }
.law-page-badge {
  display: inline-block; vertical-align: middle; margin-inline-start: 6px;
  padding: 1px 8px; border-radius: var(--r-full); font-size: var(--fs-xs); font-weight: normal;
  background: color-mix(in srgb, var(--brand-cyan) 14%, transparent); color: var(--brand-cyan);
  white-space: nowrap;
}
.law-item-source a { color: var(--brand-cyan); }
.law-page-badge-reg { background: color-mix(in srgb, var(--brand-gold) 16%, transparent); color: var(--brand-gold); }

/* ---- إعلانات التوظيف --------------------------------------------- */
.modal.modal-xl { width: min(1240px, 100%); }
.jd-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: var(--sp-4); }
.jd-card { cursor: pointer; transition: border-color 150ms, transform 150ms; }
.jd-card:hover { border-color: var(--brand-cyan); transform: translateY(-1px); }
.jd-card-title { margin: 0; font-size: var(--fs-lg); }
.jd-card-sum { margin-top: var(--sp-2); color: var(--text-muted); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.jd-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: var(--sp-4); align-items: start; }
@media (max-width: 900px) { .jd-layout { grid-template-columns: 1fr; } }
.jd-doc h3 { margin: var(--sp-5) 0 var(--sp-2); font-size: var(--fs-md); color: var(--brand-cyan); }
.jd-doc h3:first-child { margin-top: 0; }
.jd-summary { font-size: var(--fs-md); line-height: 1.8; }
.jd-list { margin: 0; padding-inline-start: 1.3rem; line-height: 1.9; }
.jd-facts { display: flex; flex-direction: column; gap: var(--sp-3); }
.jd-fact { display: flex; flex-direction: column; gap: 2px; overflow-wrap: anywhere; }
.jd-pf-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); padding: var(--sp-3) var(--sp-4); border-bottom: 1px solid var(--border); }
.jd-pf-row:last-child { border-bottom: 0; }
.jd-pf-row.is-on { background: color-mix(in srgb, var(--success) 8%, transparent); }
.jd-pf-row .input-sm { flex: 1 1 100%; padding: 0.3rem 0.5rem; font-size: var(--fs-sm); }
.jd-pf-row .btn { margin-inline-start: auto; }
.jd-share-tabs { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.jd-share-text { min-height: 320px; direction: rtl; font-family: inherit; line-height: 1.7; }
/* محرر الوظيفة: الفورم + المساعد جنبه */
.jd-editor { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: var(--sp-5); align-items: start; }
@media (max-width: 980px) { .jd-editor { grid-template-columns: 1fr; } }
.jd-ai { position: sticky; top: 0; border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--surface-2); padding: var(--sp-4); display: flex; flex-direction: column; gap: var(--sp-3); max-height: 70vh; }
.jd-ai-head { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--sp-2); }
.jd-ai-lang { display: flex; gap: 4px; }
.jd-ai-actions { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.jd-ai-field { display: flex; flex-direction: column; gap: var(--sp-2); padding-top: var(--sp-3); border-top: 1px dashed var(--border); }
.jd-ai-out { overflow-y: auto; display: flex; flex-direction: column; gap: var(--sp-3); min-height: 80px; }
.jd-sug { border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface); padding: var(--sp-3); font-size: var(--fs-sm); }
.jd-sug.is-used { opacity: 0.55; }
.jd-sug p { margin: var(--sp-2) 0; white-space: pre-wrap; }
.jd-sug .jd-list { font-size: var(--fs-sm); }
.jd-flash { box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-venom) 45%, transparent) !important; transition: box-shadow 300ms; }
body.view-only .view [data-pf-check], body.view-only .view [data-pf-url], body.view-only .view #jobEdit { display: none !important; }

/* ---- المرشحين + لينك المدير -------------------------------------- */
.cand-row { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--sp-3); padding: var(--sp-3) 0; border-bottom: 1px solid var(--border); }
.cand-row:last-child { border-bottom: 0; }
.cand-main { flex: 1; min-width: 0; }
.cand-approved { box-shadow: inset 3px 0 0 var(--success); padding-inline-start: var(--sp-3); }
.cand-rejected { box-shadow: inset 3px 0 0 var(--danger); padding-inline-start: var(--sp-3); opacity: 0.85; }
:root[dir="rtl"] .cand-approved { box-shadow: inset -3px 0 0 var(--success); }
:root[dir="rtl"] .cand-rejected { box-shadow: inset -3px 0 0 var(--danger); }
.cand-decision { padding: var(--sp-2) var(--sp-3); border-radius: var(--r-md); background: var(--surface-2); }
.cand-decision .jd-list { margin-top: 4px; font-size: var(--fs-sm); }
.cand-link-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--sp-2); padding: 6px 0; font-size: var(--fs-sm); border-top: 1px dashed var(--border); }
.cand-link-row:first-of-type { border-top: 0; }
input[type="file"].input { padding: 0.35rem 0.5rem; }
@media (max-width: 640px) { .cand-row { flex-wrap: wrap; } .cand-row .row-actions { width: 100%; justify-content: flex-end; } }
.cand-option { display: inline-block; padding: 1px 9px; border-radius: var(--r-full); background: var(--brand-flame); color: #fff; font-size: var(--fs-xs); font-weight: var(--fw-bold); white-space: nowrap; }

/* ---- العهدة: الصفحة بعرض الشاشة كله، وجدول الحركات واخد المساحة الأكبر
   عشان أزرار التعديل والحذف تبان من غير سكرول ---- */
.view:has(.custody-grid) { max-width: none; }
.section-grid.custody-grid { grid-template-columns: minmax(0, 2.4fr) minmax(300px, 1fr); align-items: start; }
@media (max-width: 1200px) { .section-grid.custody-grid { grid-template-columns: 1fr; } }

/* كارت رصيد البنك: الضغط عليه بيفتح "سحب كاش من البنك" */
.kpi-action { cursor: pointer; transition: border-color var(--dur) var(--ease), transform var(--dur) var(--ease); }
.kpi-action:hover, .kpi-action:focus-visible { border-color: var(--brand-flame); transform: translateY(-1px); outline: none; }
.kpi-action .kpi-link { color: var(--brand-flame); font-weight: var(--fw-bold); }
body.view-only .view .kpi-action { pointer-events: none; }
body.view-only .view #withdrawBtn, body.view-only .view #depositBtn { display: none; }
body.view-only .view .kpi-action .kpi-link { display: none; }

/* خانة مخفية جوه فورم (زي "الجزء من البنك" لما الاختيار بنك) */
.field[hidden] { display: none !important; }

/* العهدة: العمود الجانبي = كارت حركات العهدة (إضافة/سحب/إيداع) وتحته السلف */
.custody-side { display: flex; flex-direction: column; gap: var(--sp-4); min-width: 0; }
.custody-moves .card-body { display: grid; gap: var(--sp-2); }
.custody-moves .card-body .btn { justify-content: center; width: 100%; }
.custody-moves-bal { text-align: center; margin-top: var(--sp-1); }
body.view-only .view .custody-moves { display: none; }
/* السلف في العمود الجانبي الأضيق: أزرار الصف تنزل تحت بعض بدل ما الجدول يعمل سكرول */
.custody-side table.tbl .row-actions { flex-wrap: wrap; justify-content: flex-start; }
.custody-side table.tbl td, .custody-side table.tbl th { padding-inline: var(--sp-2); }

/* ملفات المرشح الإضافية (Portfolio …) */
.cand-files-list { display: flex; flex-direction: column; gap: var(--sp-1); margin-bottom: var(--sp-2); }
.cand-files-add { display: grid; grid-template-columns: minmax(120px, 180px) 1fr; gap: var(--sp-2); }
@media (max-width: 640px) { .cand-files-add { grid-template-columns: 1fr; } }

/* مستلزمات البوفيه والنظافة — طلبية الشهر (كروت + ألوان هادية مخصوص للصفحة دي) */
.sup-page {
  --sup-accent: #7FA9C4;                 /* أزرق رمادي هادي بدل النيون */
  --sup-accent-bg: rgba(127, 169, 196, 0.12);
  --sup-warn: #DDA35E;                   /* علامة الناقص — كهرماني هادي */
  --sup-warn-bg: rgba(221, 163, 94, 0.12);
  --sup-ok: #8FBF9C;
  --sup-ok-bg: rgba(143, 191, 156, 0.10);
  --sup-card: var(--surface);
  --sup-line: var(--border);
}
:root[data-theme="light"] .sup-page {
  --sup-accent: #3E7499;
  --sup-accent-bg: #EAF2F8;
  --sup-warn: #A0640F;
  --sup-warn-bg: #FBF2E4;
  --sup-ok: #2F7A47;
  --sup-ok-bg: #EBF5EE;
}
.sup-page .page-head .select-wrap { min-width: 240px; }

/* الخطوات */
.sup-steps { display: flex; align-items: center; gap: var(--sp-2); margin-bottom: var(--sp-5); }
.sup-step {
  flex: 1 1 0; display: flex; align-items: center; gap: var(--sp-3);
  padding: 0.7rem 0.9rem; border-radius: var(--r-lg);
  background: var(--sup-card); border: 1px solid var(--sup-line); color: var(--text-muted);
  text-align: start; transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease);
}
.sup-step:hover { border-color: var(--sup-accent); color: var(--text); }
.sup-step-n {
  flex: none; width: 30px; height: 30px; border-radius: 50%;
  display: grid; place-items: center; font-weight: var(--fw-bold);
  background: var(--surface-3); color: var(--text-muted);
}
.sup-step-txt { display: flex; flex-direction: column; line-height: 1.3; min-width: 0; }
.sup-step-txt b { font-size: var(--fs-base); color: var(--text); font-weight: var(--fw-semi); }
.sup-step-txt small { font-size: var(--fs-xs); color: var(--text-subtle); }
.sup-step.active { background: var(--sup-accent-bg); border-color: var(--sup-accent); }
.sup-step.active .sup-step-n { background: var(--sup-accent); color: var(--text-invert); }
.sup-step-line { flex: 0 0 18px; height: 1px; background: var(--sup-line); }

/* شريط الأقسام */
.sup-toolbar { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); flex-wrap: wrap; margin-bottom: var(--sp-3); }
.sup-cats { display: inline-flex; padding: 3px; gap: 3px; border-radius: var(--r-full); background: var(--surface-2); border: 1px solid var(--sup-line); }
.sup-cat {
  display: inline-flex; align-items: center; gap: var(--sp-2);
  padding: 0.4rem 1rem; border-radius: var(--r-full);
  color: var(--text-muted); font-size: var(--fs-md); font-weight: var(--fw-medium);
}
.sup-cat:hover { color: var(--text); }
.sup-cat.active { background: var(--surface-3); color: var(--text); box-shadow: var(--sh-sm); }
.sup-dot {
  min-width: 20px; height: 20px; padding: 0 6px; border-radius: var(--r-full);
  display: inline-grid; place-items: center; font-size: var(--fs-xs); font-weight: var(--fw-bold);
  background: var(--sup-warn-bg); color: var(--sup-warn);
}
.sup-hint { font-size: var(--fs-sm); color: var(--text-subtle); margin: 0 0 var(--sp-3); }
.sup-warnline { font-size: var(--fs-sm); color: var(--sup-warn); margin: 0 0 var(--sp-3); }
.sup-empty { padding: var(--sp-10) var(--sp-4); text-align: center; color: var(--text-subtle); background: var(--sup-card); border: 1px dashed var(--sup-line); border-radius: var(--r-lg); }

/* الكروت */
.sup-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: var(--sp-3); }
.sup-card {
  position: relative; display: flex; flex-direction: column; gap: var(--sp-3);
  padding: var(--sp-4); border-radius: var(--r-lg);
  background: var(--sup-card); border: 1px solid var(--sup-line);
  transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease);
}
/* علامة الناقص: شريط جانبي + خلفية خفيفة + شارة */
.sup-card.is-short { border-color: color-mix(in srgb, var(--sup-warn) 45%, var(--sup-line)); background: linear-gradient(var(--sup-warn-bg), var(--sup-warn-bg)), var(--sup-card); }
.sup-card.is-short::before {
  content: ""; position: absolute; inset-block: 10px; inset-inline-start: -1px;
  width: 4px; border-radius: 4px; background: var(--sup-warn);
}
.sup-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--sp-2); }
.sup-name { font-weight: var(--fw-semi); color: var(--text); line-height: 1.35; }
.sup-name small { display: block; font-weight: var(--fw-normal); font-size: var(--fs-xs); color: var(--text-subtle); margin-top: 2px; }
.sup-tag { font-size: 0.68rem; font-weight: var(--fw-medium); padding: 1px 6px; border-radius: var(--r-full); background: var(--sup-accent-bg); color: var(--sup-accent); vertical-align: middle; }
.sup-edit { flex: none; width: 28px; height: 28px; border-radius: var(--r-md); color: var(--text-subtle); opacity: .6; }
.sup-card:hover .sup-edit, .sup-edit:focus-visible { opacity: 1; }
.sup-edit:hover { background: var(--surface-3); color: var(--text); }
.sup-card-row { display: flex; align-items: center; gap: var(--sp-3); flex-wrap: wrap; }
.sup-lbl { font-size: var(--fs-xs); color: var(--text-subtle); min-width: 44px; }
.sup-card-row [data-part="chip"] { margin-inline-start: auto; }

.sup-stepper { direction: ltr; display: inline-flex; align-items: stretch; border: 1px solid var(--border); border-radius: var(--r-md); overflow: hidden; background: var(--surface-2); }
.sup-stepper button { width: 34px; font-size: 1.1rem; color: var(--text-muted); background: transparent; }
.sup-stepper button:hover { background: var(--surface-3); color: var(--text); }
.sup-stepper input {
  width: 64px; border: 0; border-inline: 1px solid var(--border); background: var(--sup-card);
  color: var(--text); text-align: center; font-size: var(--fs-lg); font-weight: var(--fw-semi); padding: 0.35rem 0.2rem;
  -moz-appearance: textfield; appearance: textfield;
}
.sup-stepper input::-webkit-outer-spin-button, .sup-stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.sup-stepper input:focus { outline: 2px solid var(--sup-accent); outline-offset: -2px; }
.sup-stepper input::placeholder { color: var(--text-subtle); font-weight: var(--fw-normal); }

.sup-chip { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: var(--r-full); font-size: var(--fs-xs); font-weight: var(--fw-semi); background: var(--surface-3); color: var(--text-subtle); white-space: nowrap; }
.sup-chip.warn { background: var(--sup-warn-bg); color: var(--sup-warn); }
.sup-chip.ok { background: var(--sup-ok-bg); color: var(--sup-ok); }
.sup-note { display: flex; flex-wrap: wrap; align-items: center; gap: 4px var(--sp-3); font-size: var(--fs-xs); color: var(--text-subtle); border-top: 1px solid var(--sup-line); padding-top: var(--sp-2); }
.sup-note:empty { display: none; }
.sup-note b { color: var(--text-muted); }
.sup-src { color: var(--sup-accent); font-weight: var(--fw-medium); }
.sup-reset { font-size: var(--fs-xs); color: var(--sup-accent); text-decoration: underline; text-underline-offset: 2px; }

/* الشراء */
.sup-grid-buy .sup-card { flex-direction: row; align-items: flex-start; }
.sup-buy-check { flex: none; cursor: pointer; }
.sup-buy-check input { position: absolute; opacity: 0; pointer-events: none; }
.sup-buy-check span {
  display: grid; place-items: center; width: 30px; height: 30px; border-radius: var(--r-md);
  border: 2px solid var(--border-strong); color: transparent; font-weight: var(--fw-bold);
}
.sup-buy-check input:focus-visible + span { outline: 2px solid var(--sup-accent); outline-offset: 2px; }
.sup-buy-check input:checked + span { background: var(--sup-ok); border-color: var(--sup-ok); color: var(--text-invert); }
.sup-buy-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: var(--sp-3); }
.sup-buy-fields { display: flex; gap: var(--sp-3); flex-wrap: wrap; }
.sup-buy-fields > div { display: flex; flex-direction: column; gap: 4px; }
.sup-price { width: 120px; text-align: center; }
.sup-card.is-bought { opacity: .6; background: var(--sup-card); border-color: var(--sup-line); }
.sup-card.is-bought::before { display: none; }
.sup-card.is-bought .sup-name { text-decoration: line-through; text-decoration-color: var(--text-subtle); }

.sup-summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--sp-3); margin-bottom: var(--sp-4); }
.sup-summary > div { display: flex; flex-direction: column; gap: 2px; padding: var(--sp-3) var(--sp-4); border-radius: var(--r-lg); background: var(--sup-card); border: 1px solid var(--sup-line); }
.sup-summary span { font-size: var(--fs-xs); color: var(--text-subtle); }
.sup-summary b { font-size: var(--fs-2xl); font-weight: var(--fw-bold); color: var(--text); }
.sup-summary b small { font-size: var(--fs-sm); font-weight: var(--fw-normal); color: var(--text-subtle); }
.sup-summary > div > small { font-size: var(--fs-xs); color: var(--text-subtle); }

/* رسم المصروف (سلسلة واحدة — القسم المفتوح) */
.sup-chart-card { margin-top: var(--sp-5); padding: var(--sp-4) var(--sp-4) var(--sp-2); border-radius: var(--r-lg); background: var(--sup-card); border: 1px solid var(--sup-line); }
.sup-chart-title { font-size: var(--fs-sm); font-weight: var(--fw-semi); color: var(--text-muted); margin-bottom: var(--sp-3); }
.sup-chart { position: relative; display: flex; align-items: stretch; gap: var(--sp-2); height: 170px; }
.sup-bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; outline: none; }
.sup-bar-area { flex: 1; width: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; border-bottom: 1px solid var(--sup-line); }
.sup-bar { display: block; width: 26px; max-width: 70%; border-radius: 4px 4px 0 0; background: color-mix(in srgb, var(--sup-accent) 45%, transparent); transition: background var(--dur) var(--ease); }
.sup-bar.current { background: var(--sup-accent); }
.sup-bar-col:hover .sup-bar, .sup-bar-col:focus-visible .sup-bar { background: var(--sup-accent); }
.sup-bar-val { font-size: var(--fs-xs); color: var(--text-muted); margin-bottom: 4px; }
.sup-bar-lbl { font-size: var(--fs-xs); color: var(--text-subtle); padding-top: 6px; }
.sup-tip { position: absolute; top: -6px; padding: 4px 10px; border-radius: var(--r-md); background: var(--surface-3); border: 1px solid var(--border); color: var(--text); font-size: var(--fs-xs); white-space: nowrap; box-shadow: var(--sh-md); pointer-events: none; z-index: 2; }
.sup-chart-empty { font-size: var(--fs-sm); color: var(--text-subtle); padding: var(--sp-4) 0; }

.sup-list-text { font-size: var(--fs-md); line-height: 1.8; }
.sup-list-btn { background: var(--sup-accent-bg); color: var(--sup-accent); border: 1px solid var(--sup-accent); font-weight: var(--fw-semi); }
.sup-list-btn:hover { background: var(--sup-accent); color: var(--text-invert); }
@media (max-width: 720px) {
  .sup-steps { gap: 4px; }
  .sup-step { padding: 0.55rem; gap: var(--sp-2); }
  .sup-step-line { display: none; }
  .sup-step-txt small { display: none; }
  .sup-summary b { font-size: var(--fs-xl); }
}
body.view-only .view .sup-stepper, body.view-only .view .sup-price, body.view-only .view .sup-buy-check { pointer-events: none; opacity: .7; }
body.view-only .view .sup-edit, body.view-only .view .sup-reset, body.view-only .view #supAdd, body.view-only .view #supOneOff { display: none; }

/* ==== css/layout.css ==== */
/* ============================================================
   Smoyz with HR — App Shell Layout
   ============================================================ */

#app { min-height: 100vh; }

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

/* ---- Sidebar ------------------------------------------------- */
.sidebar {
  background: var(--brand-black);
  background-image:
    radial-gradient(circle at 50% -10%, rgba(166, 43, 255, 0.28), transparent 55%),
    radial-gradient(circle at 20% 110%, rgba(255, 91, 20, 0.22), transparent 55%);
  color: #fff;
  display: flex; flex-direction: column;
  position: sticky; top: 0;
  height: 100vh;
  overflow-y: auto;
  border-inline-end: 1px solid rgba(255, 255, 255, 0.07);
}
.sidebar-brand {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-4) var(--sp-5);
  height: var(--topbar-h);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  flex: none;
}
.sidebar-brand img { height: 26px; width: auto; }
.sidebar-brand .brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.sidebar-brand .brand-name {
  font-weight: var(--fw-bold);
  font-size: var(--fs-lg);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #fff;
  text-shadow: 0 0 12px var(--brand-flame-glow);
}
.sidebar-brand .brand-sub {
  font-size: 0.625rem;
  color: var(--brand-gold);
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

/* ---- محوّل الشركة (أول عنصر في القائمة) ---------------------- */
.company-switch {
  display: flex; align-items: center; gap: var(--sp-3);
  margin: var(--sp-3) var(--sp-3) 0;
  padding: var(--sp-3);
  border-radius: var(--r-md);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.09);
  color: #fff;
  text-align: start;
  width: calc(100% - 2 * var(--sp-3));
  transition: background var(--dur) var(--ease);
}
.company-switch:hover { background: rgba(255, 255, 255, 0.1); }
.company-switch .avatar { width: 30px; height: 30px; font-size: var(--fs-xs); flex: none; }
.company-switch .company-meta { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.company-switch .company-label {
  font-size: 0.6rem; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--brand-gold);
}
.company-switch .company-name {
  font-size: var(--fs-sm); font-weight: var(--fw-semi);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.company-switch .company-arrow { color: var(--brand-cyan); font-size: var(--fs-base); flex: none; }

.nav { padding: var(--sp-3) var(--sp-3); display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav-section {
  padding: var(--sp-4) var(--sp-3) var(--sp-2);
  font-size: 0.625rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.35);
}
.nav a {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: 0.55rem var(--sp-3);
  border-radius: var(--r-md);
  color: rgba(255, 255, 255, 0.7);
  font-size: var(--fs-md);
  font-weight: var(--fw-medium);
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.nav a:hover { background: rgba(255, 255, 255, 0.06); color: #fff; text-decoration: none; }
.nav a.active {
  background: linear-gradient(90deg, color-mix(in srgb, var(--brand-flame) 88%, transparent), color-mix(in srgb, var(--brand-violet) 55%, transparent));
  color: #fff;
  box-shadow: var(--glow);
}
:root[dir="rtl"] .nav a.active {
  background: linear-gradient(270deg, color-mix(in srgb, var(--brand-flame) 88%, transparent), color-mix(in srgb, var(--brand-violet) 55%, transparent));
}
.nav a svg { width: 18px; height: 18px; flex: none; opacity: 0.85; }
.nav a .nav-count {
  margin-inline-start: auto;
  background: var(--brand-cyan);
  color: #06131C;
  font-size: var(--fs-xs);
  font-weight: var(--fw-semi);
  padding: 0 0.4rem;
  border-radius: var(--r-full);
  min-width: 20px;
  text-align: center;
}

.sidebar-foot {
  padding: var(--sp-4);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  font-size: var(--fs-xs);
  color: rgba(255, 255, 255, 0.4);
  flex: none;
}

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

.topbar {
  height: var(--topbar-h);
  display: flex; align-items: center; gap: var(--sp-3);
  padding: 0 var(--sp-6);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 20;
}
.topbar .page-title { font-size: var(--fs-lg); font-weight: var(--fw-semi); }
.topbar .spacer { flex: 1; }
.topbar .user-chip {
  display: flex; align-items: center; gap: var(--sp-2);
  padding: 0.25rem 0.25rem 0.25rem 0.6rem;
  border-radius: var(--r-full);
  background: var(--surface-3);
  font-size: var(--fs-sm);
}
:root[dir="rtl"] .topbar .user-chip { padding: 0.25rem 0.6rem 0.25rem 0.25rem; }
.topbar .user-chip .avatar { width: 26px; height: 26px; font-size: var(--fs-xs); }

.menu-toggle { display: none; }

.view {
  flex: 1;
  padding: var(--sp-6);
  max-width: var(--content-max);
  width: 100%;
  margin-inline: auto;
}

.page-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: var(--sp-4); flex-wrap: wrap;
  margin-bottom: var(--sp-5);
}
.page-head .page-sub { color: var(--text-muted); font-size: var(--fs-md); margin-top: 2px; }

.section-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: var(--sp-4);
}

/* ---- Auth screen --------------------------------------------- */
.auth-screen {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
}
.auth-aside {
  background: var(--brand-black);
  color: #fff;
  padding: var(--sp-12);
  display: flex; flex-direction: column; justify-content: space-between;
  position: relative;
  overflow: hidden;
  background-image:
    radial-gradient(circle at 78% 18%, rgba(166, 43, 255, 0.42), transparent 52%),
    radial-gradient(circle at 20% 88%, rgba(255, 91, 20, 0.42), transparent 55%),
    radial-gradient(circle at 55% 55%, rgba(43, 184, 255, 0.16), transparent 60%);
}
.auth-aside h1 {
  font-size: var(--fs-3xl);
  margin-bottom: var(--sp-3);
  text-shadow: 0 0 22px rgba(255, 91, 20, 0.28);
}
.auth-aside p { color: rgba(255, 255, 255, 0.68); max-width: 42ch; }
.auth-aside .auth-logo { display: flex; align-items: center; gap: var(--sp-3); }
.auth-aside .auth-logo img { height: 44px; width: auto; }
.auth-aside .auth-logo .brand-name {
  font-size: var(--fs-xl);
  font-weight: var(--fw-bold);
  letter-spacing: 0.2em;
  text-transform: uppercase;
}
.auth-aside .auth-tag {
  color: var(--brand-gold);
  font-size: var(--fs-sm);
  letter-spacing: 0.22em;
  text-transform: uppercase;
}
.auth-panel {
  display: grid; place-items: center;
  padding: var(--sp-8);
  background: var(--bg);
}
.auth-form { width: min(380px, 100%); display: flex; flex-direction: column; gap: var(--sp-4); }

/* ---- Responsive ---------------------------------------------- */
@media (max-width: 1024px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    inset-block: 0;
    inset-inline-start: 0;
    width: var(--sidebar-w);
    z-index: 60;
    transform: translateX(-100%);
    transition: transform var(--dur) var(--ease);
  }
  :root[dir="rtl"] .sidebar { transform: translateX(100%); }
  /* لازم الاتنين — قاعدة [dir="rtl"] أقوى من .open لوحدها فكانت بتمنع الفتح */
  .sidebar.open,
  :root[dir="rtl"] .sidebar.open { transform: none; }
  .menu-toggle { display: inline-flex; }
  .sidebar-scrim {
    position: fixed; inset: 0;
    background: rgba(4, 2, 8, 0.6);
    z-index: 50;
  }
  .view { padding: var(--sp-4); }
  .topbar { padding: 0 var(--sp-4); }
}

@media (max-width: 860px) {
  .auth-screen { grid-template-columns: 1fr; }
  .auth-aside { display: none; }
}

@media print {
  .sidebar, .topbar, .toolbar, .row-actions, .btn { display: none !important; }
  .view { padding: 0; }
  .card { box-shadow: none; border-color: #ccc; }
}

/* ==== css/rtl.css ==== */
/* ============================================================
   Smoyz with HR — RTL adjustments
   ------------------------------------------------------------
   معظم التخطيط مبني بخصائص منطقية (inline-start/end) فبيشتغل
   في الاتجاهين تلقائيًا. الملف ده للحالات اللي مالهاش مقابل منطقي.
   ============================================================ */

:root[dir="rtl"] {
  letter-spacing: 0;
}

/* الأيقونات الاتجاهية تنعكس، الأيقونات المحايدة لأ */
:root[dir="rtl"] .icon-flip { transform: scaleX(-1); }

/* الحقول اللي محتواها لاتيني دايمًا (إيميل، أرقام، تواريخ) تفضل LTR */
:root[dir="rtl"] input[type="email"],
:root[dir="rtl"] input[type="tel"],
:root[dir="rtl"] input[type="url"],
:root[dir="rtl"] input[type="number"],
:root[dir="rtl"] input[type="date"],
:root[dir="rtl"] input[type="password"],
:root[dir="rtl"] .force-ltr {
  direction: ltr;
  text-align: right;
}

/* السهم المخصص للـ select */
.select-wrap { position: relative; display: block; }
.select-wrap::after {
  content: "";
  position: absolute;
  inset-inline-end: 0.7rem;
  top: 50%;
  width: 8px; height: 8px;
  margin-top: -6px;
  border-inline-end: 1.5px solid var(--text-muted);
  border-block-end: 1.5px solid var(--text-muted);
  transform: rotate(45deg);
  pointer-events: none;
}

/* شريط التقدم يملأ من جهة البداية في الاتجاهين */
:root[dir="rtl"] .bar > span { float: right; }

/* أزرار الأكشن في الجداول */
:root[dir="rtl"] table.tbl .row-actions { justify-content: flex-start; }

/* التوستات تظهر جهة البداية في RTL — inset-inline بيتكفّل بده تلقائيًا */

