/* «إتمام» — نظام التصميم */
/* الألوان من لوحة هوية «إتمام» (إدارة أيام بدل الراحة بكفاءة واحتراف):
     #009FE3 أزرق فاتح · #006BB6 أزرق أساسي · #00427A أزرق داكن · #E6F2FB أزرق ناعم · #F5F7FA خلفية
   الأزرق الفاتح للمساحات والشرائط والأيقونات، والأساسي للأزرار والروابط (أبيض عليه ≥ 5.5:1)،
   والداكن للعناوين. القائمة الجانبية فاتحة تميل إلى الأبيض. */
:root {
  --brand: #006bb6;        /* الأزرق الأساسي — نص الشارات والروابط */
  --brand-2: #006bb6;      /* الأزرار والروابط */
  --brand-soft: #e6f2fb;   /* الأزرق الناعم */
  --brand-ink: #00427a;    /* الأزرق الداكن — العناوين */
  --brand-solid: #009fe3;  /* الأزرق الفاتح — الشريط العلوي والعناصر الكبيرة */
  /* القائمة الجانبية (فاتحة): نص #10233a على #fff = 15.9:1، العناوين الفرعية 5.8–6.2:1، العنصر النشط #006bb6 على #e6f2fb = 4.9:1 */
  --sidebar: #ffffff;
  --sidebar-2: #f5f7fa;
  --sidebar-text: #10233a;
  --sidebar-muted: #4f6378;
  --sidebar-border: #dbe4ee;
  --sidebar-hover: #eef6fc;
  --sidebar-active-bg: #e6f2fb;
  --sidebar-active-text: #006bb6;
  --sidebar-accent: #009fe3;
  --sidebar-tile: #0b8fd4;
  --sidebar-tile-active: #006bb6;
  --accent: #4b6179;
  --accent-soft: #eef3f8;
  --bg: #f5f7fa;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --text: #10233a;
  --muted: #4f6378;
  --border: #dbe4ee;
  --ok: #157a3a;
  --ok-soft: #e6f4ea;
  --warn: #9a5800;
  --warn-soft: #fdf1df;
  --err: #b42318;
  --err-soft: #fdecea;
  --focus: #0b8fd4;
  --radius: 10px;
  --shadow: 0 1px 1px rgba(16, 24, 40, .04), 0 2px 4px rgba(16, 24, 40, .04), 0 8px 18px -6px rgba(16, 24, 40, .1), inset 0 1px 0 rgba(255, 255, 255, .85);
  --shadow-hover: 0 2px 2px rgba(16, 24, 40, .04), 0 6px 10px rgba(16, 24, 40, .06), 0 18px 34px -10px rgba(0, 66, 122, .22), inset 0 1px 0 rgba(255, 255, 255, .9);
  --shadow-lg: 0 1px 1px rgba(16, 24, 40, .04), 0 4px 8px rgba(16, 24, 40, .05), 0 24px 48px -12px rgba(0, 66, 122, .22), inset 0 1px 0 rgba(255, 255, 255, .9);
  --ic-brand: #0b8fd4; --ic-accent: #006bb6; --ic-ok: #1c8a46; --ic-warn: #c27a12; --ic-err: #c43a2f; --ic-neutral: #4b6179;
  --hero-glow: 1;
  --font: "Cairo", Tahoma, "Segoe UI", "Noto Sans Arabic", sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --brand: #4db8f0; --brand-2: #4db8f0; --brand-soft: #0d2a45; --brand-ink: #e6f2fb;
    --brand-solid: #009fe3;
    --sidebar: #0e1d2d; --sidebar-2: #0b1828; --sidebar-text: #e6edf5; --sidebar-muted: #9fb4c9; --sidebar-border: #223a53;
    --sidebar-hover: #132a42; --sidebar-active-bg: #0f3150; --sidebar-active-text: #7fd0f7; --sidebar-accent: #3fb6ec;
    --sidebar-tile: #0a8fd0; --sidebar-tile-active: #1aa6e8;
    --accent: #9fb4c9; --accent-soft: #15283c;
    --bg: #08131f; --surface: #0e1d2d; --surface-2: #132539;
    --text: #e6edf5; --muted: #9fb4c9; --border: #223a53;
    --ok: #5fcf86; --ok-soft: #13301f; --warn: #f0b45a; --warn-soft: #33270f;
    --err: #ff8a80; --err-soft: #3a1714; --focus: #5cc8f5;
    --shadow: 0 1px 1px rgba(0, 0, 0, .3), 0 4px 10px rgba(0, 0, 0, .25), inset 0 1px 0 rgba(255, 255, 255, .05);
    --shadow-hover: 0 2px 2px rgba(0, 0, 0, .3), 0 14px 30px -8px rgba(0, 0, 0, .55), inset 0 1px 0 rgba(255, 255, 255, .07);
    --shadow-lg: 0 2px 4px rgba(0, 0, 0, .3), 0 24px 48px -12px rgba(0, 0, 0, .6), inset 0 1px 0 rgba(255, 255, 255, .06);
    --ic-brand: #0a8fd0; --ic-accent: #2f78c0; --ic-neutral: #4a6884;
    --hero-glow: .14;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --brand: #4db8f0; --brand-2: #4db8f0; --brand-soft: #0d2a45; --brand-ink: #e6f2fb;
  --brand-solid: #009fe3;
    --sidebar: #0e1d2d; --sidebar-2: #0b1828; --sidebar-text: #e6edf5; --sidebar-muted: #9fb4c9; --sidebar-border: #223a53;
    --sidebar-hover: #132a42; --sidebar-active-bg: #0f3150; --sidebar-active-text: #7fd0f7; --sidebar-accent: #3fb6ec;
    --sidebar-tile: #0a8fd0; --sidebar-tile-active: #1aa6e8;
  --accent: #9fb4c9; --accent-soft: #15283c;
  --bg: #08131f; --surface: #0e1d2d; --surface-2: #132539;
  --text: #e6edf5; --muted: #9fb4c9; --border: #223a53;
  --ok: #5fcf86; --ok-soft: #13301f; --warn: #f0b45a; --warn-soft: #33270f;
  --err: #ff8a80; --err-soft: #3a1714; --focus: #5cc8f5;
  --shadow: 0 1px 1px rgba(0, 0, 0, .3), 0 4px 10px rgba(0, 0, 0, .25), inset 0 1px 0 rgba(255, 255, 255, .05);
  --shadow-hover: 0 2px 2px rgba(0, 0, 0, .3), 0 14px 30px -8px rgba(0, 0, 0, .55), inset 0 1px 0 rgba(255, 255, 255, .07);
  --shadow-lg: 0 2px 4px rgba(0, 0, 0, .3), 0 24px 48px -12px rgba(0, 0, 0, .6), inset 0 1px 0 rgba(255, 255, 255, .06);
  --ic-brand: #0a8fd0; --ic-accent: #2f78c0; --ic-neutral: #4a6884;
  --hero-glow: .14;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { font-size: clamp(14px, 13.2px + .2vw, 16px); }
body {
  margin: 0; overflow-x: hidden; font-family: var(--font); background: var(--bg); color: var(--text);
  line-height: 1.6; -webkit-font-smoothing: antialiased;
}
a { color: var(--brand-2); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
.skip { position: absolute; inset-inline-start: 1rem; top: -999px; background: var(--surface); padding: .5rem 1rem; z-index: 99; }
.skip:focus { top: .5rem; }
.num, td.n, .kpi .v { font-variant-numeric: tabular-nums; }

/* ---------- التخطيط */
.layout { display: grid; grid-template-columns: 250px 1fr; min-height: 100vh; }
.sidebar {
  background: var(--sidebar); color: var(--sidebar-text); padding: 1.25rem .9rem; position: sticky; top: 0; height: 100vh; overflow-y: auto;
  border-inline-end: 1px solid var(--sidebar-border);
}
a.brand, a.t-logo { text-decoration: none; color: inherit; border-radius: 12px; }
a.brand:hover .wordmark, a.t-logo:hover b { opacity: .85; }
a.brand:focus-visible, a.t-logo:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
.brand { display: flex; gap: .7rem; align-items: center; margin: 0 .25rem 1rem; padding-bottom: 1rem; border-bottom: 1px solid var(--sidebar-border); }
.brand .mark {
  width: 42px; height: 42px; flex: none; border-radius: 10px;
  display: grid; place-items: center; font-weight: 700; font-size: 1.1rem; color: var(--sidebar-active-text);
}
.brand .mark svg { width: 24px; height: 24px; }
.brand b { display: block; font-size: .93rem; line-height: 1.4; }
.brand small { display: block; color: var(--sidebar-muted); font-size: .76rem; margin-top: .1rem; }
.nav { list-style: none; margin: 0; padding: 0; }
.nav li a {
  display: flex; gap: .6rem; align-items: center; color: var(--sidebar-text); text-decoration: none;
  padding: .52rem .75rem; border-radius: 8px; margin-bottom: 2px; font-size: .92rem;
  border-inline-start: 3px solid transparent;
}
.nav li a:hover { background: var(--sidebar-hover); color: var(--sidebar-text); }
.nav li a[aria-current="page"] { background: var(--sidebar-active-bg); color: var(--sidebar-active-text); font-weight: 700; border-inline-start-color: var(--sidebar-accent); }
.nav li a:focus-visible { outline-color: var(--focus); outline-offset: -2px; }
.nav .sep { font-size: .72rem; color: var(--sidebar-muted); margin: 1.1rem .75rem .35rem; letter-spacing: .02em; font-weight: 600; }
.nav .badge { margin-inline-start: auto; }
.nav .badge.count { background: var(--sidebar-active-text); color: var(--sidebar); border: 0; font-weight: 700; }
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; gap: 1rem; padding: .8rem 1.5rem; background: var(--surface);
  border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 5;
  box-shadow: inset 0 3px 0 var(--brand-solid);
}
.topbar .title { font-weight: 700; color: var(--brand-ink); }
.topbar .spacer { flex: 1; }
.topbar .who { font-size: .9rem; color: var(--muted); }
.menu-btn { display: none; }
.content { padding: 1.5rem; max-width: 1280px; width: 100%; }
.footer { margin-top: auto; padding: 1rem 1.5rem; color: var(--muted); font-size: .8rem; border-top: 1px solid var(--border); background: var(--surface); }
.footer a { color: var(--brand-2); }

/* ---------- العناوين */
.page-head { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; justify-content: space-between; margin-bottom: 1.25rem; }
.page-head h1 { margin: 0; font-size: 1.45rem; color: var(--brand-ink); }
.page-head p { margin: .2rem 0 0; color: var(--muted); }
h1, h2, h3 { font-weight: 700; } /* خط Cairo: Bold للعناوين وRegular للنصوص (هوية «إتمام») */
h2 { font-size: 1.1rem; margin: 0 0 .75rem; }

/* ---------- البطاقات */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.1rem 1.25rem; margin-bottom: 1.25rem; }
.card.flush { padding: 0; overflow: hidden; }
.card.flush > h2 { padding: 1rem 1.25rem 0; }
.grid { display: grid; gap: 1rem; }
.grid.kpis { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); margin-bottom: 1.25rem; }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem 1.1rem; box-shadow: var(--shadow); }
.kpi .l { color: var(--muted); font-size: .85rem; }
.kpi .v { font-size: 1.9rem; font-weight: 700; line-height: 1.2; margin-top: .2rem; }
.kpi .s { color: var(--muted); font-size: .8rem; }
.kpi.brand { border-top: 3px solid var(--brand-2); }
.kpi.accent { border-top: 3px solid var(--accent); }
.kpi.ok { border-top: 3px solid var(--ok); }
.kpi.warn { border-top: 3px solid var(--warn); }
.kpi.err { border-top: 3px solid var(--err); }

/* ---------- الجداول */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { padding: .6rem .75rem; text-align: start; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { background: var(--surface-2); color: var(--muted); font-weight: 600; font-size: .82rem; white-space: nowrap; }
tbody tr:hover { background: var(--surface-2); }
td.n, th.n { text-align: center; }
tr.muted td { color: var(--muted); }
.empty { padding: 2rem; text-align: center; color: var(--muted); }

@media (max-width: 640px) {
  table.responsive thead { display: none; }
  table.responsive, table.responsive tbody, table.responsive tr, table.responsive td { display: block; width: 100%; }
  table.responsive tr { border: 1px solid var(--border); border-radius: 8px; margin: .6rem; width: auto; padding: .3rem 0; }
  table.responsive td { border: 0; display: flex; justify-content: space-between; gap: 1rem; padding: .35rem .8rem; text-align: start; }
  table.responsive td::before { content: attr(data-label); color: var(--muted); font-size: .82rem; }
  table.responsive td.n { text-align: start; }
}

/* ---------- الشارات */
.badge { display: inline-flex; align-items: center; gap: .3rem; padding: .1rem .55rem; border-radius: 999px; font-size: .78rem; font-weight: 600; white-space: nowrap; background: var(--brand-soft); color: var(--brand-2); }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.err { background: var(--err-soft); color: var(--err); }
.badge.muted { background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); }
.badge.count { background: #fff; color: var(--brand); }

/* ---------- النماذج */
label { display: block; font-weight: 600; font-size: .88rem; margin-bottom: .3rem; }
.hint { color: var(--muted); font-size: .8rem; font-weight: 400; }
input:not([type]), input[type=text], input[type=password], input[type=date], input[type=number], input[type=email], input[type=search], select, textarea {
  width: 100%; font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; padding: .5rem .7rem; min-height: 42px;
}
textarea { min-height: 80px; }
input:focus, select:focus, textarea:focus { border-color: var(--focus); outline: 2px solid color-mix(in srgb, var(--focus) 30%, transparent); }
.field { margin-bottom: 1rem; }
.form-grid { display: grid; gap: 0 1rem; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.check { display: flex; gap: .5rem; align-items: flex-start; font-weight: 400; margin-bottom: .6rem; }
.check input { width: 18px; height: 18px; margin-top: .2rem; }
fieldset { border: 1px solid var(--border); border-radius: var(--radius); padding: .75rem 1rem; margin: 0 0 1rem; }
legend { font-weight: 600; padding: 0 .4rem; }
.filters { display: flex; flex-wrap: wrap; gap: .6rem; align-items: flex-end; }
.filters .field { margin: 0; min-width: 160px; flex: 1; }
.filters .field.grow { flex: 2; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem; font: inherit; font-weight: 600; font-size: .92rem;
  border-radius: 8px; padding: .5rem 1rem; min-height: 42px; border: 1px solid var(--border); background: var(--surface); color: var(--text);
  cursor: pointer; text-decoration: none; white-space: nowrap;
}
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--brand-2); border-color: var(--brand-2); color: #fff; }
.btn.primary:hover { filter: brightness(1.08); }
:root[data-theme="dark"] .btn.primary { color: #0f141b; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .btn.primary { color: #0f141b; } }
.btn.ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn.danger { color: var(--err); border-color: color-mix(in srgb, var(--err) 40%, var(--border)); }
.btn.sm { min-height: 34px; padding: .25rem .65rem; font-size: .84rem; }
.btn.ghost { background: transparent; border-color: transparent; color: inherit; }
.actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
form.inline { display: inline; }

/* ---------- التنبيهات */
.alert { border-radius: var(--radius); padding: .75rem 1rem; margin-bottom: 1rem; border: 1px solid; display: flex; gap: .6rem; align-items: flex-start; }
.alert.ok { background: var(--ok-soft); color: var(--ok); border-color: color-mix(in srgb, var(--ok) 30%, transparent); }
.alert.error { background: var(--err-soft); color: var(--err); border-color: color-mix(in srgb, var(--err) 30%, transparent); }
.alert.info { background: var(--brand-soft); color: var(--brand-2); border-color: color-mix(in srgb, var(--brand-2) 25%, transparent); }
.alert.warn { background: var(--warn-soft); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 30%, transparent); }

/* ---------- التقدم والرسوم */
.progress { height: 10px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--brand-solid); border-radius: inherit; }
.bars { display: grid; grid-template-columns: repeat(12, 1fr); gap: .4rem; align-items: end; height: 160px; padding-top: .5rem; }
.bars .bar { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: .25rem; }
.bars .bar span { display: block; width: 100%; max-width: 34px; background: var(--brand-2); border-radius: 4px 4px 0 0; min-height: 2px; }
.bars .bar small { color: var(--muted); font-size: .72rem; }
.bars .bar b { font-size: .75rem; font-weight: 600; }
.meter { display: flex; align-items: center; gap: .5rem; }
.meter .progress { flex: 1; min-width: 60px; }

/* ---------- صفحات عامة (عن النظام / الخطأ) */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 1rem; background: var(--bg); border-top: 4px solid var(--brand-solid); }
.auth .box { width: 100%; max-width: 520px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 2rem; box-shadow: var(--shadow-lg); }
.auth h1 { font-size: 1.3rem; margin: .5rem 0 .25rem; color: var(--brand-ink); }
.auth .org { color: var(--muted); margin: 0 0 1.5rem; font-size: .92rem; }
.auth .mark { width: 54px; height: 54px; border-radius: 12px; background: var(--brand-soft); color: var(--brand-2); display: grid; place-items: center; font-weight: 700; font-size: 1.4rem; }

/* ---------- بوابة الدخول */
.gate { min-height: 100vh; display: flex; flex-direction: column; background: var(--bg); }
.gate-strip { height: 4px; background: var(--brand-solid); flex: none; }
.gate-head { background: var(--surface); border-bottom: 1px solid var(--border); }
.gate-head-in, .gate-foot-in { max-width: 1140px; margin: 0 auto; padding: .85rem 1.5rem; display: flex; align-items: center; gap: 1rem; }
.gate-org { display: flex; gap: .75rem; align-items: center; color: var(--text); text-decoration: none; min-width: 0; }
.gate-org b { display: block; font-size: 1.02rem; color: var(--brand-ink); line-height: 1.35; }
.gate-org small { display: block; color: var(--muted); font-size: .82rem; }
.emblem { width: 46px; height: 46px; flex: none; border-radius: 10px; background: var(--brand-solid); color: #fff; display: grid; place-items: center; }
.emblem svg { width: 26px; height: 26px; }
.gate-sys { margin-inline-start: auto; color: var(--muted); font-size: .86rem; padding-inline-start: 1rem; border-inline-start: 1px solid var(--border); }
.gate-head .btn { margin-inline-start: auto; }
.gate-sys + .btn { margin-inline-start: 0; }
.gate-main { flex: 1; display: flex; align-items: center; padding: 3rem 1.5rem; }
.gate-main:focus { outline: none; }
.gate-grid {
  max-width: 1140px; width: 100%; margin: 0 auto; display: grid; gap: 3.5rem; align-items: center;
  grid-template-columns: minmax(0, 1fr) minmax(0, 440px); grid-template-areas: "intro card";
}
.gate-card {
  grid-area: card; background: var(--surface); border: 1px solid var(--border); border-top: 3px solid var(--brand-2);
  border-radius: 12px; box-shadow: var(--shadow-lg); padding: 2rem 2rem 1.5rem;
}
.gate-card h1 { font-size: 1.4rem; margin: 0; color: var(--brand-ink); }
.gate-card .sub { color: var(--muted); margin: .3rem 0 1.5rem; font-size: .92rem; }
.gate-card .field { margin-bottom: 1.15rem; }
.input-icon { position: relative; }
.input-icon svg { position: absolute; inset-inline-start: .8rem; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--muted); pointer-events: none; }
.input-icon input { padding-inline-start: 2.6rem; min-height: 48px; }
.input-icon .pw-toggle { position: absolute; inset-inline-end: .35rem; top: 50%; transform: translateY(-50%); width: 40px; height: 40px; display: grid; place-items: center; border: 0; background: transparent; color: var(--muted); border-radius: 8px; cursor: pointer; }
.input-icon .pw-toggle:hover { color: var(--brand-2); background: var(--surface-2); }
.input-icon .pw-toggle:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
.input-icon .pw-toggle svg { position: static; transform: none; inset: auto; width: 20px; height: 20px; color: inherit; }
.input-icon .pw-toggle .eye-off, .input-icon .pw-toggle[aria-pressed="true"] .eye-open { display: none; }
.input-icon .pw-toggle[aria-pressed="true"] .eye-off { display: inline; }
.input-icon:has(.pw-toggle) input { padding-inline-end: 3rem; }
.btn.block { width: 100%; }
.btn.lg { min-height: 48px; font-size: 1rem; }
.gate-help { display: flex; gap: .5rem; align-items: flex-start; margin: 1.25rem 0 0; padding-top: 1rem; border-top: 1px solid var(--border); color: var(--muted); font-size: .84rem; }
.gate-help svg { width: 18px; height: 18px; flex: none; margin-top: .15rem; color: var(--brand-2); }
.gate-help b { color: var(--text); font-weight: 600; }
.gate-intro { grid-area: intro; }
.eyebrow { display: inline-flex; align-items: center; gap: .4rem; font-size: .8rem; font-weight: 600; color: var(--accent); background: var(--accent-soft); padding: .2rem .75rem; border-radius: 999px; }
.gate-intro h2 { font-size: 2rem; line-height: 1.4; color: var(--brand-ink); margin: .9rem 0 .6rem; font-weight: 700; }
.gate-intro .lead { color: var(--muted); font-size: 1.05rem; margin: 0 0 2rem; max-width: 36em; }
.gate-features { list-style: none; margin: 0; padding: 0; display: grid; gap: 1.1rem; }
.gate-features li { display: flex; gap: .9rem; align-items: flex-start; }
.gate-features .ico { width: 42px; height: 42px; flex: none; border-radius: 10px; background: var(--brand-soft); color: var(--brand-2); display: grid; place-items: center; }
.gate-features .ico svg { width: 22px; height: 22px; }
.gate-features b { display: block; color: var(--text); font-size: .98rem; }
.gate-features span { color: var(--muted); font-size: .88rem; }
.gate-foot { background: var(--surface); border-top: 1px solid var(--border); color: var(--muted); font-size: .82rem; }
.gate-foot-in { flex-wrap: wrap; justify-content: space-between; gap: .5rem 1.5rem; padding-block: 1rem; }
.gate-foot nav { display: flex; flex-wrap: wrap; gap: .4rem 1.2rem; }
.gate-foot a { color: var(--brand-2); text-decoration: none; }
.gate-foot a:hover, .gate-foot summary:hover { text-decoration: underline; }
.gate-foot summary { cursor: pointer; color: var(--brand-2); list-style: none; }
.gate-foot summary::-webkit-details-marker { display: none; }
.gate-foot details[open] { flex-basis: 100%; }
.gate-foot details p { margin: .5rem 0 0; max-width: 46em; color: var(--text); }
@media (max-width: 900px) {
  .gate-grid { grid-template-columns: minmax(0, 1fr); grid-template-areas: "card" "intro"; gap: 2rem; max-width: 520px; }
  .gate-main { padding: 1.5rem 1rem 2rem; align-items: flex-start; }
  .gate-head-in, .gate-foot-in { padding-inline: 1rem; }
  .gate-intro h2 { font-size: 1.35rem; margin-top: .7rem; }
  .gate-intro .lead { font-size: .95rem; margin-bottom: 1.25rem; }
  .gate .hide-sm { display: none; }
  .gate-head .btn { margin-inline-start: auto; }
}
@media (max-width: 420px) {
  .gate-card { padding: 1.5rem 1.15rem 1.25rem; }
  .emblem { width: 40px; height: 40px; }
}

/* ---------- الكشف */
.stmt-head { display: flex; flex-wrap: wrap; gap: 1rem; justify-content: space-between; align-items: flex-start; }
.stmt-head dl { display: grid; grid-template-columns: auto 1fr; gap: .2rem 1rem; margin: 0; }
.stmt-head dt { color: var(--muted); font-size: .88rem; }
.stmt-head dd { margin: 0; font-weight: 600; }
.summary-line { background: var(--accent-soft); color: var(--text); border-radius: 8px; padding: .7rem 1rem; margin-top: 1rem; }

/* ---------- إدخال الساعات */
.entry-grid td { padding: .35rem; vertical-align: top; }
.entry-grid input, .entry-grid select { min-height: 38px; padding: .35rem .5rem; }
.entry-grid .err { color: var(--err); font-size: .8rem; display: block; margin-top: .2rem; }
.entry-grid tr.has-err { background: var(--err-soft); }
.chk { font-size: .82rem; white-space: nowrap; }
.chk.ok { color: var(--ok); }
.chk.bad { color: var(--err); }

details.disclose summary { cursor: pointer; color: var(--brand-2); font-weight: 600; }
.mt { margin-top: 1rem; }
.muted { color: var(--muted); }
.right { margin-inline-start: auto; }
.nowrap { white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- الملف الشخصي */
.profile-grid { align-items: start; }
.profile-grid > div { display: grid; gap: 1rem; align-content: start; }
.kv { display: grid; margin: 0; }
.kv > div { display: flex; justify-content: space-between; gap: 1rem; padding: .5rem 0; border-bottom: 1px dashed var(--border); }
.kv > div:last-child { border-bottom: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 600; }
input[readonly] { background: var(--surface-2); color: var(--muted); cursor: default; }
.contact-line { font-size: .9rem; }
.contact-line a { color: inherit; }

.account-strip { display: flex; align-items: center; gap: .9rem; flex-wrap: wrap; padding: .8rem 1rem; }
.account-strip > div:first-of-type { flex: 1; min-width: 220px; }
/* ---------- صفحة الدخول: الإشعار الرسمي وروابط الوثائق */
.gate-notice { display: flex; gap: .5rem; align-items: flex-start; margin: clamp(.55rem, 1.4vh, .85rem) 0 0; padding: .5rem .7rem; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); color: var(--muted); font-size: .76rem; line-height: 1.65; }
@media (max-height: 820px) and (min-width: 900px) { .gate-card .gate-help { margin-top: .6rem; padding-top: .55rem; } .gate-card .card-foot { margin-top: .55rem; padding-top: .5rem; } }
.gate-notice svg { width: 18px; height: 18px; flex: none; margin-top: .2rem; color: var(--brand-2); }
.inline-link { background: none; border: 0; padding: 0; font: inherit; color: var(--brand-2); font-weight: 600; text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
.foot-links { display: flex; flex-wrap: wrap; gap: .15rem .9rem; }
.doc-meta { display: inline-block; margin: 0 0 .7rem !important; padding: .15rem .6rem; border-radius: 999px; background: var(--brand-soft); color: var(--brand-2); font-size: .76rem; font-weight: 600; }
.policy-doc h3 { margin-top: 1.25rem; }

pre.code { direction: ltr; text-align: left; background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: .7rem .9rem; font-size: .85rem; overflow-x: auto; margin: .5rem 0; }
.btn:disabled, .btn[disabled] { opacity: .5; cursor: not-allowed; box-shadow: none; transform: none; filter: grayscale(.4); }
.crumbs { display: flex; align-items: center; gap: .4rem; min-width: 0; }
.crumbs .crumb { color: var(--muted); font-weight: 500; white-space: nowrap; }
.crumbs .crumb-sep { color: var(--muted); font-size: .9em; }
.crumbs > span[aria-current] { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 640px) { .crumbs .crumb, .crumbs .crumb-sep { display: none; } }
/* منتقي الملفات العربي */
.file-pick { position: relative; display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; min-height: 46px; padding: .4rem .5rem; border: 1.5px dashed var(--border); border-radius: 10px; background: var(--surface-2); cursor: pointer; }
.file-pick:hover { border-color: var(--brand-2); }
.file-pick:focus-within { outline: 2px solid var(--brand); outline-offset: 2px; }
.file-pick.has-file { border-style: solid; border-color: color-mix(in srgb, var(--ok) 45%, var(--border)); }
.file-pick .file-input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.file-pick .file-btn { pointer-events: none; }
.file-pick .file-name { color: var(--muted); font-size: .88rem; overflow-wrap: anywhere; }
.file-pick.has-file .file-name { color: var(--text); font-weight: 600; }
/* تبويبات الإعدادات على الجوال: تمرير أفقي بدل التكسّر */

.role-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: .7rem; margin: 0; }
.role-list > div { padding: .75rem .9rem; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); }
.role-list dt { font-weight: 700; color: var(--brand-ink); margin-bottom: .2rem; }
.role-list dd { margin: 0; color: var(--muted); font-size: .9rem; }
/* زر الوضع: قمر في الفاتح، وشمس في الداكن */
svg.i3d.theme-sun { display: none !important; }
:root[data-theme="dark"] svg.i3d.theme-sun { display: inline-block !important; } :root[data-theme="dark"] svg.i3d.theme-moon { display: none !important; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) svg.i3d.theme-sun { display: inline-block !important; } :root:not([data-theme="light"]) svg.i3d.theme-moon { display: none !important; } }
.btn .sm-ico { width: 22px; height: 22px; margin: 0; flex: none; }
.btn { gap: .4rem; }
/* لوحة المؤشرات: تنبيهات تحتاج إجراء */
.alerts-panel h2 { display: flex; align-items: center; gap: .5rem; }
.alert-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .5rem; }
.alert-list li { display: flex; align-items: center; gap: .7rem; padding: .55rem .75rem; border-radius: 10px; border: 1px solid var(--border); border-inline-start: 4px solid var(--border); background: var(--surface-2); }
.alert-list li .i3d { width: 30px; height: 30px; flex: none; }
.alert-list li .txt { flex: 1; min-width: 0; font-size: .92rem; }
.alert-list li .btn { flex: none; }
.alert-list li.lvl-err { border-inline-start-color: var(--err); background: var(--err-soft); }
.alert-list li.lvl-err .i3d { color: var(--err); }
.alert-list li.lvl-warn { border-inline-start-color: var(--warn); background: var(--warn-soft); }
.alert-list li.lvl-warn .i3d { color: var(--warn); }
.alert-list li.lvl-info { border-inline-start-color: var(--brand-2); }
@media (max-width: 640px) { .alert-list li { flex-wrap: wrap; } .alert-list li .btn { margin-inline-start: auto; } }
.empty-start { display: flex; gap: 1rem; align-items: flex-start; }
.empty-start ol { margin: .4rem 0 1rem; padding-inline-start: 1.2rem; line-height: 2; }
.age-col { white-space: nowrap; }
.nightly { padding: .5rem .7rem; border-radius: 8px; font-size: .88rem; border: 1px solid var(--border); background: var(--surface-2); }
.nightly.ok { border-color: color-mix(in srgb, var(--ok) 40%, var(--border)); }
.nightly.warn { border-color: color-mix(in srgb, var(--warn) 45%, var(--border)); }
/* ---------- الطباعة */
.print-only { display: none; }
@media print {
  @page { size: A4; margin: 14mm; }
  :root { --bg: #fff; --surface: #fff; --surface-2: #f3f4f6; --text: #000; --muted: #444; --border: #bbb; }
  body { background: #fff; font-size: 11pt; }
  .sidebar, .topbar, .footer, .gate-head, .gate-foot, .gate-strip, .no-print, .btn, .filters, form { display: none !important; }
  .layout { display: block; }
  .content { padding: 0; max-width: none; }
  .card, .kpi { box-shadow: none; break-inside: avoid; }
  .print-only { display: block; }
  a { color: #000; text-decoration: none; }
  table.responsive thead { display: table-header-group; }
}
.official { max-width: 800px; margin: 0 auto; background: #fff; color: #000; padding: 2rem; }
.official header { display: flex; justify-content: space-between; align-items: flex-start; border-bottom: 2px solid #009fe3; padding-bottom: .75rem; margin-bottom: 1rem; }
.official h1 { font-size: 1.25rem; margin: 0; color: #00427a; }
.official table th { background: #e6f2fb; color: #00427a; }
.official table, .official th, .official td { border: 1px solid #c3d0dd; }
.official .sign { display: flex; justify-content: space-around; gap: 2rem; margin-top: 3rem; text-align: center; break-inside: avoid; }
.official .sign div { flex: 0 1 240px; border-top: 1px solid #555; padding-top: .4rem; font-size: .9rem; }
/* نموذج الطلب: أقسام وبطاقات حقول */
.official .f-status { display: inline-block; margin: 0 0 .9rem; padding: .3rem .9rem; border-radius: 999px; border: 1px solid #c3d0dd; background: #f5f7fa; font-size: .9rem; }
.official .f-status.st-approved { background: #e8f6ee; border-color: #9fd3b4; color: #14633a; }
.official .f-status.st-pending { background: #fff6e5; border-color: #f0cf8f; color: #8a5a00; }
.official .f-status.st-rejected, .official .f-status.st-cancelled { background: #fdecec; border-color: #eeb4b4; color: #9b1c1c; }
.official .f-sec { border: 1px solid #c3d0dd; border-radius: 8px; margin: 0 0 .85rem; break-inside: avoid; overflow: hidden; }
.official .f-sec h3 { margin: 0; padding: .45rem .85rem; background: #e6f2fb; color: #00427a; font-size: .95rem; border-bottom: 1px solid #c3d0dd; }
.official .f-sec.void h3 { background: #fdecec; color: #9b1c1c; }
.official .f-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0; margin: 0; }
.official .f-grid.three { grid-template-columns: repeat(3, 1fr); }
.official .f-grid > div { padding: .5rem .85rem; border-bottom: 1px dashed #dde5ee; }
.official .f-grid > .wide { grid-column: 1 / -1; }
.official .f-grid dt { font-size: .78rem; color: #55657a; margin-bottom: .15rem; }
.official .f-grid dd { margin: 0; font-size: .98rem; }
@media (max-width: 560px) { .official .f-grid, .official .f-grid.three { grid-template-columns: 1fr; } .official .sign { flex-direction: column; align-items: center; } .official .sign div { width: 70%; } }
.official .sign .sign-name { display: inline-block; margin-top: .35rem; font-weight: 600; font-size: .95rem; }
.official .meta { font-size: .82rem; color: #333; text-align: end; }
body.print-page { background: #e9eef4; }
@media print { body.print-page { background: #fff; } .official { padding: 0; } }

/* =====================================================================
   العمق ثلاثي الأبعاد + الاستجابة (جوال ≤480 · ≤768 · تابلت ≤1024 · كمبيوتر ≥1280)
   ===================================================================== */

/* ---------- أيقونات 3D (sprite: icons.svg — البلاطة تأخذ currentColor) */
/* الـ sprite مضمّن في الصفحة (لا display:none حتى تعمل التدرجات اللونية في Safari/iOS) */
.svg-sprite { position: absolute; width: 0; height: 0; overflow: hidden; pointer-events: none; }
.i3d { width: 28px; height: 28px; flex: none; display: inline-block; vertical-align: middle; color: var(--ic-brand); overflow: visible; }
.i3d.sm { width: 22px; height: 22px; }
.i3d.lg { width: 46px; height: 46px; }
.i3d.xl { width: 52px; height: 52px; }

/* ---------- الشريط الجانبي */
.sidebar {
  background:
    radial-gradient(130% 28% at 100% 0%, color-mix(in srgb, var(--sidebar-accent) 9%, transparent), transparent 70%),
    linear-gradient(180deg, var(--sidebar) 0%, var(--sidebar) 45%, var(--sidebar-2) 100%);
  box-shadow: 6px 0 24px -16px rgba(0, 66, 122, .22);
  scrollbar-width: thin; scrollbar-color: color-mix(in srgb, var(--sidebar-muted) 35%, transparent) transparent;
}
[dir="rtl"] .sidebar { box-shadow: -6px 0 24px -16px rgba(0, 66, 122, .22); }
.brand .mark { width: 48px; height: 48px; background: transparent; border: 0; border-radius: 13px; box-shadow: none; }
.brand .mark .i3d, .brand .mark .logo-img { width: 44px; height: 44px; display: block; filter: drop-shadow(0 3px 5px rgba(0, 66, 122, .18)); }
.brand b.wordmark { font-size: 1.55rem; font-weight: 800; line-height: 1.15; letter-spacing: 0; color: var(--sidebar-active-text); }
.nav li a { position: relative; min-height: 44px; padding: .35rem .6rem; gap: .65rem; border-radius: 10px; transition: background .15s, transform .15s; }
.nav li a .i3d { width: 30px; height: 30px; color: var(--sidebar-tile); transition: transform .2s; }
.nav li a:hover .i3d { transform: translateY(-1px) scale(1.04); }
.nav li a[aria-current="page"] { background: var(--sidebar-active-bg); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--sidebar-accent) 18%, transparent); }
.nav li a[aria-current="page"] .i3d { color: var(--sidebar-tile-active); }
.nav .lbl { flex: 1; min-width: 0; }
:root[data-theme="dark"] .brand .mark { background: #fff; box-shadow: 0 6px 14px -6px rgba(0, 0, 0, .5); }
:root[data-theme="dark"] .brand .mark .logo-img { width: 40px; height: 40px; filter: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .brand .mark { background: #fff; box-shadow: 0 6px 14px -6px rgba(0, 0, 0, .5); }
  :root:not([data-theme="light"]) .brand .mark .logo-img { width: 40px; height: 40px; filter: none; }
}
.sidebar-close { display: none; }

/* ---------- الشريط العلوي */
.topbar {
  gap: .6rem; min-height: 60px; padding-block: .45rem;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  -webkit-backdrop-filter: saturate(1.4) blur(10px); backdrop-filter: saturate(1.4) blur(10px);
  box-shadow: inset 0 3px 0 var(--brand-solid), 0 1px 0 var(--border), 0 8px 20px -14px rgba(16, 24, 40, .25);
  border-bottom: 0;
}
.topbar .t-logo { display: none; align-items: center; gap: .4rem; flex: none; padding-inline-end: .75rem; border-inline-end: 1px solid var(--border); }
.topbar .t-logo img { width: 30px; height: 30px; display: block; }
.topbar .t-logo b { font-size: 1.15rem; font-weight: 800; color: var(--brand-2); line-height: 1; }
.topbar .title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 1.02rem; }
.icon-btn { width: 42px; min-width: 42px; padding: 0; }
.icon-btn .i3d { width: 30px; height: 30px; }
.topbar .menu-btn { display: none; font-size: 1.3rem; }
.acct { position: relative; }
.acct > summary { list-style: none; cursor: pointer; gap: .5rem; padding-inline: .35rem .7rem; }
.acct > summary::-webkit-details-marker { display: none; }
.acct > summary::after { content: ""; width: 7px; height: 7px; border: solid currentColor; border-width: 0 2px 2px 0; transform: rotate(45deg) translateY(-2px); opacity: .55; }
.avatar {
  width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: .9rem; color: #fff; flex: none;
  background: radial-gradient(circle at 35% 30%, #4fc3f3, #009fe3 50%, #00427a);
  box-shadow: inset 0 1px 1px rgba(255,255,255,.45), inset 0 -2px 3px rgba(0,0,0,.25), 0 2px 5px rgba(0,67,94,.3);
}
.acct-name { font-size: .88rem; color: var(--text); font-weight: 600; max-width: 14em; overflow: hidden; text-overflow: ellipsis; }
.acct-menu {
  position: absolute; inset-inline-end: 0; top: calc(100% + 8px); z-index: 40; min-width: 240px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: .4rem; box-shadow: var(--shadow-lg);
}
.acct-menu .who-full { padding: .6rem .75rem .7rem; border-bottom: 1px solid var(--border); margin-bottom: .3rem; }
.acct-menu .who-full b { display: block; font-size: .92rem; }
.acct-menu .who-full small { color: var(--muted); font-size: .8rem; }
.acct-menu .btn, .acct-menu form { display: flex; width: 100%; }
.acct-menu .btn { justify-content: flex-start; border-color: transparent; background: transparent; box-shadow: none; gap: .6rem; min-height: 44px; }
.acct-menu .btn:hover { background: var(--surface-2); }
.acct-menu .btn .i3d { width: 28px; height: 28px; }
.acct-menu .btn.logout { color: var(--err); }

/* ---------- المحتوى */
.content { padding: clamp(1rem, .6rem + 1.4vw, 2rem); max-width: 1440px; margin-inline: auto; }
.page-head h1 { font-size: clamp(1.2rem, 1rem + .9vw, 1.6rem); }

/* ---------- البطاقات بطبقات ظل */
.card { border-radius: 14px; border-color: color-mix(in srgb, var(--border) 80%, transparent); }
.card > h2 { color: var(--brand-ink); }

/* ---------- KPI */
.grid.kpis { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: clamp(.65rem, .4rem + .8vw, 1.1rem); }
.kpi {
  --tone: var(--ic-neutral); position: relative; overflow: hidden; isolation: isolate; border-radius: 14px; border-top-width: 1px !important; border-top-color: var(--border) !important;
  padding: 1rem 1.1rem 1.15rem; background: linear-gradient(180deg, var(--surface), color-mix(in srgb, var(--surface) 94%, var(--tone)));
  transition: transform .2s ease, box-shadow .2s ease;
}
.kpi::before { content: ""; position: absolute; z-index: -1; width: 150px; height: 150px; inset-inline-end: -55px; top: -60px; border-radius: 50%; background: radial-gradient(circle, color-mix(in srgb, var(--tone) 16%, transparent), transparent 68%); }
.kpi::after { content: ""; position: absolute; inset-inline: 0; bottom: 0; height: 4px; background: linear-gradient(90deg, var(--tone), color-mix(in srgb, var(--tone) 25%, transparent)); }
:root:not([data-theme="dark"]) .kpi::after { opacity: .9; }
.kpi:hover { transform: translateY(-3px); box-shadow: var(--shadow-hover); }
.kpi .i3d { position: absolute; top: .8rem; inset-inline-end: .8rem; width: 46px; height: 46px; color: var(--tone); }
.kpi:has(.i3d) .l { padding-inline-end: 52px; min-height: 2.6em; }
.kpi .l { font-weight: 600; }
.kpi .v { font-size: clamp(1.6rem, 1.25rem + 1vw, 2.15rem); font-weight: 800; color: var(--brand-ink); letter-spacing: -.01em; }
.kpi.brand { --tone: var(--ic-brand); display: block; margin: 0; padding-bottom: 1.15rem; border-bottom: 1px solid var(--border); gap: 0; }
.kpi.accent { --tone: var(--ic-accent); }
.kpi.ok { --tone: var(--ic-ok); }
.kpi.warn { --tone: var(--ic-warn); }
.kpi.err { --tone: var(--ic-err); }
.kpi.err .v { color: var(--err); }

/* ---------- الأزرار بعمق */
.btn {
  border-radius: 10px; transition: transform .12s ease, box-shadow .15s ease, background-color .15s, filter .15s;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.7), 0 1px 2px rgba(16,24,40,.08), 0 2px 4px -2px rgba(16,24,40,.08);
}
.btn:hover { box-shadow: inset 0 1px 0 rgba(255,255,255,.7), 0 2px 4px rgba(16,24,40,.1), 0 6px 12px -6px rgba(16,24,40,.18); }
.btn:active { transform: translateY(1px); box-shadow: inset 0 2px 4px rgba(16,24,40,.16); }
.btn.primary, .btn.ok {
  background: linear-gradient(180deg, color-mix(in srgb, var(--b) 84%, #fff) 0%, var(--b) 55%, color-mix(in srgb, var(--b) 90%, #000) 100%);
  border-color: color-mix(in srgb, var(--b) 85%, #000);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.28), 0 1px 0 color-mix(in srgb, var(--b) 60%, #000), 0 6px 14px -6px color-mix(in srgb, var(--b) 70%, transparent);
}
.btn.primary { --b: var(--brand-2); }
.btn.ok { --b: var(--ok); }
.btn.primary:hover, .btn.ok:hover { filter: brightness(1.06); box-shadow: inset 0 1px 0 rgba(255,255,255,.3), 0 1px 0 color-mix(in srgb, var(--b) 60%, #000), 0 10px 20px -8px color-mix(in srgb, var(--b) 75%, transparent); }
.btn.primary:active, .btn.ok:active { box-shadow: inset 0 2px 5px rgba(0,0,0,.25); filter: brightness(.97); }
:root[data-theme="dark"] .btn:not(.primary):not(.ok):not(.ghost) { box-shadow: inset 0 1px 0 rgba(255,255,255,.05), 0 1px 2px rgba(0,0,0,.3); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .btn:not(.primary):not(.ok):not(.ghost) { box-shadow: inset 0 1px 0 rgba(255,255,255,.05), 0 1px 2px rgba(0,0,0,.3); } }
:root[data-theme="dark"] .btn.ok { color: #0f141b; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .btn.ok { color: #0f141b; } }
.btn.ghost, .btn.ghost:hover { box-shadow: none; }
.btn.ghost:hover { background: color-mix(in srgb, var(--brand-2) 8%, transparent); }
input:not([type=checkbox]):not([type=radio]):not([type=file]), select, textarea { border-radius: 10px; box-shadow: inset 0 1px 2px rgba(16,24,40,.06); transition: border-color .15s, box-shadow .15s; }
input:not([type=checkbox]):not([type=radio]):not([type=file]):focus, select:focus, textarea:focus { box-shadow: inset 0 1px 2px rgba(16,24,40,.06), 0 0 0 4px color-mix(in srgb, var(--focus) 16%, transparent); }
.progress { height: 12px; box-shadow: inset 0 1px 2px rgba(16,24,40,.12); }
.progress > span { background: linear-gradient(180deg, color-mix(in srgb, var(--brand-solid) 70%, #fff), var(--brand-solid)); box-shadow: inset 0 1px 0 rgba(255,255,255,.35); }
.bars .bar span { background: linear-gradient(180deg, color-mix(in srgb, var(--brand-2) 70%, #fff), var(--brand-2)); box-shadow: inset 0 1px 0 rgba(255,255,255,.35), 0 3px 6px -3px rgba(0,67,94,.4); border-radius: 6px 6px 2px 2px; }

/* ---------- بوابة الدخول */
.gate-head { background: color-mix(in srgb, var(--surface) 90%, transparent); box-shadow: 0 6px 18px -14px rgba(16,24,40,.3); position: relative; z-index: 2; }
.emblem { background: #fff; width: 52px; height: 52px; border-radius: 14px; border: 1px solid var(--border); box-shadow: 0 6px 16px -8px rgba(0, 66, 122, .35); }
.emblem .i3d, .emblem .logo-img { width: 42px; height: 42px; display: block; }
.gate-org b.wordmark { font-size: 1.6rem; font-weight: 800; line-height: 1.15; color: var(--brand-2); }
.gate-main { position: relative; isolation: isolate; overflow: hidden; }
.gate-main::before {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background-image: radial-gradient(color-mix(in srgb, var(--brand-2) 22%, transparent) 1.1px, transparent 1.5px);
  background-size: 22px 22px;
  -webkit-mask-image: radial-gradient(ellipse 70% 70% at 30% 35%, #000 20%, transparent 75%); mask-image: radial-gradient(ellipse 70% 70% at 30% 35%, #000 20%, transparent 75%);
}
.gate-main::after {
  content: ""; position: absolute; inset: 0; z-index: -2; pointer-events: none;
  background:
    radial-gradient(140% 70% at 105% 118%, color-mix(in srgb, var(--brand-2) 9%, transparent) 0 44%, transparent 44.2%),
    radial-gradient(120% 60% at 110% 128%, color-mix(in srgb, var(--brand-2) 8%, transparent) 0 48%, transparent 48.2%),
    radial-gradient(90% 55% at -8% 118%, color-mix(in srgb, var(--accent) 8%, transparent) 0 46%, transparent 46.2%),
    radial-gradient(60% 50% at 80% 0%, color-mix(in srgb, var(--brand-2) 7%, transparent), transparent 70%);
}
.gate-card { border-radius: 18px; border-top: 1px solid var(--border); position: relative; overflow: hidden; }
.gate-card::before { content: ""; position: absolute; inset-inline: 0; top: 0; height: 4px; background: var(--brand-solid); }
.gate-card .card-mark { display: flex; align-items: center; gap: .75rem; margin-bottom: 1.1rem; }
.gate-card .card-mark .i3d { width: 54px; height: 54px; }
.gate-card .card-theme { position: absolute; top: .85rem; inset-inline-end: .85rem; z-index: 1; }
.gate-card .card-brand { display: flex; flex-direction: column; align-items: center; text-align: center; gap: .55rem; margin: .35rem 0 1.25rem; padding-bottom: 1.15rem; border-bottom: 1px solid var(--border); }
.gate-card .card-brand .logo-img { width: 76px; height: 76px; display: block; filter: drop-shadow(0 8px 14px rgba(0, 66, 122, .2)); }
.gate-card .card-brand .wordmark { display: block; font-size: 2.1rem; font-weight: 800; color: var(--brand-2); line-height: 1.1; }
.gate-card .card-brand small { display: block; color: var(--muted); font-size: .92rem; margin-top: .2rem; }
.gate-card .login-h { font-size: 1.3rem; margin: 0 0 .2rem; color: var(--brand-ink); }
:root[data-theme="dark"] .gate-card .card-brand .logo-img { background: #fff; border-radius: 18px; padding: 6px; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .gate-card .card-brand .logo-img { background: #fff; border-radius: 18px; padding: 6px; } }
.gate-intro h2 { font-size: clamp(1.35rem, 1rem + 1.4vw, 2.05rem); }
.gate-hero { display: block; width: 100%; max-width: 470px; height: auto; aspect-ratio: 520 / 420; max-height: 34vh; margin: -.4rem auto .6rem; overflow: visible; }
.gate-features { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .85rem; perspective: 900px; }
.gate-features li {
  flex-direction: column; gap: .55rem; padding: 1rem .95rem 1.05rem; border-radius: 14px; background: color-mix(in srgb, var(--surface) 88%, transparent);
  border: 1px solid color-mix(in srgb, var(--border) 80%, transparent); box-shadow: var(--shadow);
  transform-style: preserve-3d; transition: transform .35s cubic-bezier(.2,.7,.2,1), box-shadow .35s;
}
.gate-features li:hover { transform: translateY(-4px) rotateX(3deg) rotateY(-3deg); box-shadow: var(--shadow-hover); }
.gate-features .ico { width: auto; height: auto; background: none; border-radius: 0; }
.gate-features .ico .i3d { width: 46px; height: 46px; }
.gate-features b { font-size: .95rem; }
.gate-features span { font-size: .84rem; line-height: 1.55; display: block; }
.gate-foot { background: color-mix(in srgb, var(--surface) 90%, transparent); position: relative; z-index: 1; }

/* ---------- الجداول */
.card.flush .table-wrap { border-radius: 0 0 14px 14px; }
th { background: linear-gradient(180deg, var(--surface-2), color-mix(in srgb, var(--surface-2) 92%, var(--border))); }

/* ---------- كمبيوتر واسع */
@media (min-width: 1280px) {
  .layout { grid-template-columns: 268px 1fr; }
}
@media (min-width: 1600px) {
  .grid.kpis { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
}

/* ---------- تابلت أفقي/صغير: شريط أيقونات مطوي (769–1024) */
@media (max-width: 1024px) {
  .topbar .menu-btn { display: inline-flex; }
  .topbar .t-logo { display: inline-flex; }
}
/* تابلت (769–1024): قائمة جانبية بأسماء ظاهرة (لا شريط أيقونات فقط) لأن التلميحات لا تعمل باللمس */
@media (min-width: 769px) and (max-width: 1024px) {
  .layout { grid-template-columns: 226px 1fr; }
  .grid.kpis { grid-template-columns: repeat(auto-fit, minmax(158px, 1fr)); }
  .sidebar { padding-inline: .55rem; }
  .sidebar .brand small { display: none; }
  .nav li a { font-size: .9rem; gap: .55rem; }
  .topbar .t-logo, .topbar .menu-btn { display: none; }
}

@media (min-width: 1101px) {
  #entry select { min-width: 185px; }
  #entry input[name=desc] { min-width: 190px; }
  #entry input[name=date] { min-width: 140px; }
  #entry input[name=hours] { min-width: 72px; }
  #entry input[type=file] { max-width: 165px; font-size: .78rem; }
  #entry td:first-child { width: 28px; }
  #entry .chk { white-space: normal; }
}
/* ---------- شبكة إدخال الساعات: كل صف بطاقة (≤1100) */
@media (max-width: 1100px) {
  /* شبكة إدخال الساعات: كل صف بطاقة عمودية */
  #entry thead { display: none; }
  #entry, #entry tbody { display: block; }
  #entry tr { display: grid; grid-auto-flow: row dense; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: .55rem .7rem; padding: 2.3rem .9rem .9rem; margin-bottom: .9rem; border: 1px solid var(--border); border-radius: 14px; background: var(--surface-2); position: relative; box-shadow: var(--shadow); }
  #entry td { display: block; padding: 0; border: 0; width: auto !important; }
  #entry td::before { content: attr(data-label); display: block; font-size: .78rem; font-weight: 600; color: var(--muted); margin-bottom: .2rem; }
  #entry td.idx { position: absolute; top: .55rem; inset-inline-start: .9rem; font-weight: 700; color: var(--brand-ink); }
  #entry td.idx::before { display: inline; margin-inline-end: .3rem; }
  #entry td:nth-child(2), #entry td:nth-child(4), #entry td:nth-child(6), #entry td:nth-child(7), #entry td:nth-child(8) { grid-column: 1 / -1; }
  #entry td:last-child::before { content: none; }
  #entry input, #entry select { min-height: 44px; }
  #entry input[type=file] { width: 100%; font-size: .85rem; }
  .card:has(#entry) { padding: .9rem; }
  .card:has(#entry) .table-wrap { overflow: visible; }
}
@media (min-width: 769px) and (max-width: 1100px) {
  #entry tr { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  #entry td:nth-child(n) { grid-column: span 1; }
  #entry td:nth-child(2), #entry td:nth-child(4), #entry td:nth-child(6), #entry td:nth-child(7) { grid-column: span 2; }
  #entry td:nth-child(8) { grid-column: 1 / -1; }
}

/* ---------- جوال وتابلت عمودي: درج منزلق (≤768) */
@media (max-width: 768px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: fixed; inset-block: 0; inset-inline-start: 0; width: min(300px, 86vw); height: auto; z-index: 30;
    visibility: hidden; transform: translateX(105%); transition: transform .28s cubic-bezier(.2,.7,.2,1), visibility .28s, box-shadow .28s;
  }
  [dir="ltr"] .sidebar { transform: translateX(-105%); }
  .sidebar.open { visibility: visible; transform: none; box-shadow: 0 0 0 100vmax rgba(0, 32, 60, .38), 0 0 40px rgba(0, 32, 60, .25); }
  .topbar { flex-wrap: nowrap; gap: .35rem; padding: .4rem .6rem; min-height: 56px; }
  .topbar .who, .topbar .hide-sm, .topbar .theme-top, .acct-name { display: none; }
  .topbar .title { flex: 1; font-size: .98rem; }
  .topbar .spacer { display: none; }
  .topbar .badge.muted { font-size: .72rem; padding: .05rem .45rem; }
  .acct > summary { padding-inline: .3rem .55rem; }
  .content { padding: .9rem; }
  .footer { padding: .9rem; text-align: center; }
  .page-head { align-items: stretch; }
  .page-head > div:first-child { flex: 1 1 100%; }
  .page-head .actions { width: 100%; }
  .page-head .actions .btn, .page-head .actions form, .page-head > .btn, .page-head > a.btn { flex: 1 1 auto; }
  .page-head .filters { width: 100%; }
  .grid.kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.kpis > .kpi:last-child:nth-child(odd) { grid-column: 1 / -1; }
  .grid.two { grid-template-columns: minmax(0, 1fr); }
  .kpi { padding: .85rem .85rem 1rem; }
  .kpi .i3d { width: 36px; height: 36px; top: .65rem; inset-inline-end: .65rem; }
  .kpi:has(.i3d) .l { padding-inline-end: 40px; font-size: .8rem; }
  .btn, .btn.sm { min-height: 44px; }
  .btn.sm { padding-inline: .8rem; }
  .filters { flex-direction: column; align-items: stretch; }
  .filters .field { min-width: 0; width: 100%; }
  .filters .btn { width: 100%; }
  .actions > .btn.primary, .actions > button[type=submit] { flex: 1 1 100%; }
  .actions .right { display: none; }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .stmt-head > div { min-width: 0 !important; width: 100%; }
  /* الجداول تتحول لبطاقات */
  table.responsive thead { display: none; }
  table.responsive, table.responsive tbody, table.responsive tr, table.responsive td { display: block; width: 100%; }
  table.responsive tr { border: 1px solid var(--border); border-radius: 12px; margin: .7rem; width: auto; padding: .45rem 0; background: var(--surface); box-shadow: var(--shadow); }
  table.responsive tbody tr:hover { background: var(--surface); }
  table.responsive td { border: 0; display: flex; justify-content: flex-start; align-items: center; flex-wrap: wrap; gap: .25rem .45rem; padding: .4rem .9rem; text-align: start; min-height: 40px; }
  table.responsive td + td { border-top: 1px dashed color-mix(in srgb, var(--border) 70%, transparent); }
  table.responsive td::before { content: attr(data-label); color: var(--muted); font-size: .8rem; font-weight: 600; margin-inline-end: auto; padding-inline-end: .75rem; }
  table.responsive td > :last-child { text-align: end; }
  table.responsive td.n { text-align: start; }
  table.responsive td.empty { display: block; text-align: center; }
  table.responsive td.empty::before { content: none; }
  table.responsive td.nowrap { white-space: normal; justify-content: flex-start; }
  table.responsive td.nowrap::before { flex: 1 1 100%; }
  table.responsive td.nowrap .btn { flex: 1; }
  table.responsive td.nowrap form { display: flex; flex: 1; }
  .acct-menu { position: fixed; inset-inline: .6rem; top: 62px; min-width: 0; }
  /* الدخول */
  .gate-grid { grid-template-columns: minmax(0, 1fr); grid-template-areas: "card" "intro"; gap: 1.75rem; max-width: 560px; }
  .gate-main { padding: 1.25rem .9rem 2rem; align-items: flex-start; }
  .gate-head-in, .gate-foot-in { padding-inline: .9rem; }
  .gate .hide-sm { display: none; }
  .gate-head .btn { margin-inline-start: auto; }
  .gate-hero { max-width: 300px; max-height: none; margin-block: .2rem .8rem; }
  .gate-features { grid-template-columns: minmax(0, 1fr); }
  .gate-features li { flex-direction: row; align-items: center; }
  .gate-features .ico .i3d { width: 42px; height: 42px; }
}
@media (min-width: 769px) and (max-width: 1024px) {
  .gate-grid { gap: 2rem; grid-template-columns: minmax(0, 1fr) minmax(0, 400px); grid-template-areas: "intro card"; max-width: 1140px; }
  .gate-main { align-items: center; padding-block: 2rem; }
  .gate-features { grid-template-columns: minmax(0, 1fr); }
  .gate-features li { flex-direction: row; align-items: center; }
  .gate-main { padding-inline: 1.25rem; }
}
@media (min-width: 600px) and (max-width: 768px) {
  .grid.kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .grid.kpis > .kpi:last-child:nth-child(odd) { grid-column: auto; }
  .filters { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6rem .9rem; }
  .filters .field.grow, .filters .btn { grid-column: 1 / -1; }
  .actions > .btn.primary, .actions > button[type=submit] { flex: 1 1 auto; }
  table.responsive tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 0; }
  table.responsive td + td { border-top: 0; }
  table.responsive td:nth-child(n+3) { border-top: 1px dashed color-mix(in srgb, var(--border) 70%, transparent); }
  table.responsive td:nth-child(even) { border-inline-start: 1px dashed color-mix(in srgb, var(--border) 70%, transparent); }
  table.responsive td.nowrap, table.responsive td.empty { grid-column: 1 / -1; border-inline-start: 0; }
}
@media (max-width: 480px) {
  .gate-hero { display: none; }
  .bars { gap: .2rem; }
  .bars .bar small { font-size: .6rem; letter-spacing: -.02em; }
  .gate-card { padding: 1.4rem 1.1rem 1.2rem; border-radius: 16px; }
  .gate-card .card-mark .i3d { width: 46px; height: 46px; }
  .content { padding: .75rem; }
  table.responsive tr { margin: .55rem; }
  .topbar .t-logo b { display: none; }
  .topbar .t-logo { padding-inline-end: .5rem; }
}
@media (max-width: 360px) {
  .grid.kpis { grid-template-columns: minmax(0, 1fr); }
  .topbar .badge.muted { display: none; }
  #entry tr { grid-template-columns: minmax(0, 1fr); }
}

/* ---------- ملاءمة صفحة الدخول للشاشة: كل شيء ظاهر دون تمرير، والتذييل ثابت أسفل الشاشة */
.gate { min-height: 100vh; min-height: 100dvh; }
.gate-foot { position: sticky; bottom: 0; z-index: 3; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.gate-foot-in { padding-block: .6rem; }
.gate-main { padding-block: clamp(.9rem, 3vh, 2.25rem); }
.gate-card { padding-block: clamp(1rem, 2.6vh, 1.6rem); }
.gate-card .card-brand { gap: .35rem; margin: 0 0 clamp(.6rem, 1.8vh, 1rem); padding-bottom: clamp(.6rem, 1.8vh, 1rem); }
.gate-card .card-brand .logo-img { width: clamp(50px, 7vh, 64px); height: clamp(50px, 7vh, 64px); }
.gate-card .card-brand .wordmark { font-size: clamp(1.5rem, 1.1rem + 1.6vh, 1.85rem); }
.gate-card .card-brand small { font-size: .86rem; margin-top: 0; }
.gate-card .login-h { font-size: 1.15rem; }
.gate-card .sub { margin: .15rem 0 clamp(.7rem, 2vh, 1.15rem); font-size: .88rem; }
.gate-card .field { margin-bottom: clamp(.65rem, 1.8vh, 1rem); }
.gate-help { margin-top: clamp(.7rem, 2vh, 1.1rem); padding-top: clamp(.6rem, 1.6vh, .9rem); }
@media (min-width: 769px) and (max-height: 860px) {
  .gate-hero { max-height: 26vh; margin-block: 0 .4rem; }
  .gate-intro h2 { margin-block: .5rem .35rem; }
  .gate-intro .lead { margin-bottom: 1rem; font-size: .95rem; }
  .gate-features span { display: none; }
}
@media (min-width: 769px) and (max-height: 700px) { .gate-hero { display: none; } }
@media (min-width: 769px) and (max-height: 860px) {
  .gate-card .card-brand { flex-direction: row; justify-content: center; text-align: start; gap: .7rem; }
  .gate-card .card-brand .logo-img { width: 50px; height: 50px; }
  .gate-card .sub { display: none; }
  .gate-card .login-h { margin-bottom: .6rem; }
}
@media (max-width: 768px) {
  .gate-intro { display: none; }
  .gate-main { align-items: flex-start; padding: .75rem .75rem 1rem; }
  .gate-foot-in { justify-content: center; text-align: center; gap: .2rem 1rem; padding-block: .5rem; font-size: .78rem; }
  .gate-card .card-brand { flex-direction: row; justify-content: center; text-align: start; gap: .65rem; }
  .gate-card .card-brand .logo-img { width: 48px; height: 48px; }
  .gate-card .card-brand .wordmark { font-size: 1.55rem; }
  .gate-card .card-brand small { font-size: .8rem; }
  .gate-card .sub { display: none; }
  .gate-card .login-h { margin-bottom: .6rem; }
  .gate-help { font-size: .8rem; }
}

/* ---------- تذييل مربع الدخول ونافذة «عن النظام» */
.gate-card .card-foot { display: flex; align-items: center; justify-content: space-between; gap: .5rem 1rem; flex-wrap: wrap; margin-top: clamp(.8rem, 2vh, 1.15rem); padding-top: clamp(.65rem, 1.6vh, .9rem); border-top: 1px solid var(--border); }
.about-link { display: inline-flex; align-items: center; gap: .35rem; background: none; border: 0; padding: .25rem .1rem; font: inherit; font-size: .86rem; font-weight: 600; color: var(--brand-2); cursor: pointer; border-radius: 6px; }
.about-link svg { width: 17px; height: 17px; }
.about-link:hover { text-decoration: underline; }
.card-credit { margin: 0; display: flex; flex-direction: column; align-items: flex-end; text-align: end; font-size: .76rem; line-height: 1.55; color: var(--muted); }
.card-credit span:last-child:not(:first-child) { color: var(--text); font-weight: 600; }
.about-dlg { width: min(720px, calc(100vw - 2rem)); max-height: min(86vh, 860px); padding: 0; border: 1px solid var(--border); border-radius: 16px; background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg); overflow: hidden; }
.about-dlg[open] { display: flex; flex-direction: column; }
.about-dlg::backdrop { background: rgba(0, 32, 60, .45); backdrop-filter: blur(3px); }
.about-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin: 0; padding: 1rem 1.4rem; border-bottom: 1px solid var(--border); box-shadow: inset 0 3px 0 var(--brand-solid); }
.about-head h2 { margin: 0; font-size: 1.15rem; color: var(--brand-ink); }
.about-head .btn { font-size: 1.4rem; line-height: 1; }
.about-dlg .about-doc { padding: 1.1rem 1.4rem 1.4rem; overflow-y: auto; }
.about-doc { font-size: .93rem; line-height: 1.85; }
.about-doc .about-lead { margin: 0 0 .8rem; font-size: .98rem; }
.about-doc h3 { font-size: .98rem; color: var(--brand-ink); margin: 1.1rem 0 .35rem; padding-inline-start: .6rem; border-inline-start: 3px solid var(--brand-solid); }
.about-doc ul { margin: 0; padding-inline-start: 1.25rem; }
.about-doc li { margin-bottom: .2rem; }
.about-doc p { margin: 0 0 .5rem; }
.about-doc .about-credit { margin-top: 1.25rem; padding-top: .8rem; border-top: 1px solid var(--border); color: var(--muted); font-size: .84rem; text-align: center; }
@media (max-width: 480px) {
  .about-head, .about-dlg .about-doc { padding-inline: 1rem; }
  .about-doc { font-size: .9rem; }
}

/* ---------- مؤشر رصيد الموظف (حلقة + بطاقات) */
.board { display: grid; grid-template-columns: auto 1fr; gap: 1.25rem; align-items: center; background: var(--surface); border: 1px solid var(--border); border-radius: 18px; box-shadow: var(--shadow); padding: 1.25rem 1.4rem; margin-bottom: 1.25rem; position: relative; overflow: hidden; }
.board::before { content: ""; position: absolute; inset: 0 0 auto; height: 4px; background: linear-gradient(90deg, var(--brand-solid), var(--brand-2)); }
.gauge { --p: 0; --size: 168px; width: var(--size); height: var(--size); border-radius: 50%; display: grid; place-items: center; flex: none;
  background: radial-gradient(closest-side, var(--surface) 76%, transparent 77% 100%), conic-gradient(var(--brand-solid) 0, var(--brand-2) calc(var(--p) * 1%), var(--brand-soft) 0);
  box-shadow: inset 0 0 0 1px var(--border), 0 10px 26px -14px rgba(0, 66, 122, .45); }
.board.big .gauge { --size: 190px; }
.gauge-in { text-align: center; display: flex; flex-direction: column; align-items: center; line-height: 1.15; }
.gauge-in b { font-size: 2.6rem; font-weight: 800; color: var(--brand-ink); }
.board.big .gauge-in b { font-size: 3rem; }
.gauge-in span { color: var(--muted); font-size: .85rem; font-weight: 600; }
.gauge-in small { color: var(--brand-2); font-size: .8rem; margin-top: .15rem; font-weight: 600; }
.board-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: .8rem; }
.bcard { display: flex; gap: .75rem; align-items: flex-start; background: var(--surface-2); border: 1px solid var(--border); border-radius: 14px; padding: .85rem .95rem; }
.bcard .i3d { width: 44px; height: 44px; flex: none; color: var(--ic-brand); }
.bcard.hours .i3d { color: var(--ic-accent); }
.bcard.cap .i3d { color: var(--ic-neutral); }
.bcard > div { min-width: 0; flex: 1; }
.bcard .l { display: block; color: var(--muted); font-size: .82rem; font-weight: 600; }
.bcard .v { display: block; font-size: 1.7rem; font-weight: 800; color: var(--text); line-height: 1.25; }
.bcard .s { display: block; color: var(--muted); font-size: .76rem; line-height: 1.5; }
.bcard .progress { margin-top: .4rem; }
.bcard .v .of { font-size: .8rem; font-weight: 600; color: var(--muted); }
@media (max-width: 640px) { .board { grid-template-columns: 1fr; justify-items: center; padding: 1rem; } .board-cards { width: 100%; } }

/* ---------- بلاطات الإجراءات */
.action-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: .85rem; margin-bottom: 1.25rem; }
.tile { position: relative; display: flex; align-items: center; gap: .85rem; padding: .95rem 1.05rem; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow); color: var(--text); text-decoration: none; transition: transform .18s, box-shadow .18s, border-color .18s; }
.tile:hover { transform: translateY(-3px); box-shadow: var(--shadow-hover); border-color: color-mix(in srgb, var(--brand-solid) 45%, var(--border)); }
.tile .i3d { width: 50px; height: 50px; flex: none; color: var(--ic-brand); }
.tile.hours .i3d { color: var(--ic-accent); }
.tile.appr .i3d { color: var(--ic-ok); }
.tile.msg .i3d { color: var(--ic-neutral); }
.tile b { display: block; font-size: .98rem; color: var(--brand-ink); }
.tile small { display: block; color: var(--muted); font-size: .8rem; margin-top: .1rem; }
.tile > .badge { position: absolute; top: .55rem; inset-inline-end: .6rem; }

/* ---------- عناصر مساعدة */
.badge.info { background: var(--brand-soft); color: var(--brand); }
.badge.accent { background: color-mix(in srgb, var(--ic-accent) 14%, var(--surface)); color: var(--brand-ink); }
.muted-row td { opacity: .6; }
.d-block { display: block; }
.pad { padding: .8rem 1.25rem; margin: 0; }
.mb { margin-bottom: 1rem; }
.form-narrow { max-width: 760px; }
.h-ico { width: 40px; height: 40px; vertical-align: middle; color: var(--ic-brand); margin-inline-end: .25rem; }
.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; padding: 3px; gap: 3px; }
.seg a { padding: .4rem 1rem; border-radius: 9px; text-decoration: none; color: var(--muted); font-weight: 600; font-size: .9rem; }
.seg a.on { background: var(--surface); color: var(--brand-2); box-shadow: 0 1px 2px rgba(16, 24, 40, .1); }
.unit-pick { border: 0; padding: 0; margin: 0 0 1rem; display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: .7rem; }
.unit-pick legend { font-weight: 600; margin-bottom: .45rem; padding: 0; }
.radio-card { display: flex; align-items: center; gap: .6rem; padding: .7rem .85rem; border: 1.5px solid var(--border); border-radius: 12px; cursor: pointer; background: var(--surface); }
.radio-card .i3d { width: 36px; height: 36px; color: var(--ic-brand); }
.radio-card b { display: block; font-size: .92rem; }
.radio-card small { color: var(--muted); font-size: .8rem; }
.radio-card:has(input:checked) { border-color: var(--brand-solid); background: var(--brand-soft); }
.msg-list { list-style: none; margin: 0; padding: 0; }
.msg-list li { border-bottom: 1px solid var(--border); }
.msg-list li:last-child { border-bottom: 0; }
.msg-list a { display: grid; grid-template-columns: minmax(120px, 200px) 1fr auto; grid-template-areas: "who subj time" "who snip time"; gap: .1rem 1rem; padding: .8rem 1.25rem; text-decoration: none; color: var(--text); }
.msg-list a:hover { background: var(--surface-2); }
.msg-list .who { grid-area: who; color: var(--muted); font-size: .88rem; }
.msg-list .subj { grid-area: subj; font-weight: 600; }
.msg-list .snip { grid-area: snip; color: var(--muted); font-size: .84rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg-list time { grid-area: time; color: var(--muted); font-size: .8rem; }
.msg-list li.unread .subj, .msg-list li.unread .who { color: var(--brand-ink); font-weight: 700; }
.msg-list li.unread a { box-shadow: inset 3px 0 0 var(--brand-solid); }
.msg-list .empty { padding: 1.5rem; text-align: center; color: var(--muted); }
@media (max-width: 640px) { .msg-list a { grid-template-columns: 1fr auto; grid-template-areas: "who time" "subj subj" "snip snip"; } }
.msg-body { white-space: pre-wrap; line-height: 1.9; }
.official .letter-title { text-align: center; margin: 1rem 0; }
.official .letter-body { white-space: pre-wrap; line-height: 2; margin: 1rem 0; }
.official .letter-foot { margin-top: 2rem; padding-top: .6rem; border-top: 1px solid #c3d0dd; font-size: .78rem; color: #555; text-align: center; }
.official .stamp-void { color: #b42318; border: 2px solid #b42318; display: inline-block; padding: .2rem .8rem; font-weight: 700; transform: rotate(-3deg); }

/* ---------- النسخ الاحتياطي والحذف */
.sm-ico { width: 30px; height: 30px; vertical-align: middle; color: var(--ic-brand); margin-inline-end: .2rem; }
.danger-zone { border-color: color-mix(in srgb, var(--err) 45%, var(--border)); background: color-mix(in srgb, var(--err-soft) 55%, var(--surface)); }
.danger-zone h2 { color: var(--err); }

/* ---------- إسناد الموظفين للإداري ونموذج الاستيراد */
.assign-wrap { flex-basis: 100%; }
.assign-wrap > summary { cursor: pointer; color: var(--brand-2); font-weight: 600; font-size: .88rem; padding: .2rem 0; }
.assign-box { flex-basis: 100%; border: 1px solid var(--border); background: var(--surface-2); border-radius: 12px; padding: .75rem .85rem; margin: .5rem 0 .75rem; }
.assign-head { display: flex; justify-content: space-between; gap: .5rem; flex-wrap: wrap; margin-bottom: .45rem; }
.assign-filter { width: 100%; margin-bottom: .45rem; }
.assign-actions { display: flex; gap: .4rem; margin-bottom: .45rem; }
.check-list { max-height: 260px; overflow-y: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: .15rem .9rem; padding: .25rem; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; }
.check-list .check { margin: 0; padding: .35rem .3rem; border-radius: 8px; align-items: flex-start; }
.check-list .check:hover { background: var(--brand-soft); }
.check-list .check small { display: block; font-size: .76rem; }
.steps { margin: 0 0 1rem; padding-inline-start: 1.2rem; line-height: 1.9; }
.steps li { margin-bottom: .35rem; }
.mt-sm { margin-top: .35rem; }

/* ---------- البحث داخل قوائم الموظفين */
.opt-search { display: flex; align-items: center; gap: .5rem; margin-bottom: .35rem; }
.opt-search input { flex: 1; min-width: 0; padding-block: .4rem; font-size: .88rem; background: var(--surface-2); }
.opt-search small { white-space: nowrap; }

/* ---------- مجموعات القائمة القابلة للطيّ وتبويبات الإعدادات */
.sidebar { overscroll-behavior: contain; }
.nav-group { list-style: none; }
.nav-toggle { display: flex; align-items: center; gap: .35rem; width: 100%; min-height: 38px; margin: 1rem 0 .2rem; padding: .35rem .75rem; background: none; border: 0; border-radius: 8px; cursor: pointer;
  font: inherit; font-size: .8rem; font-weight: 700; letter-spacing: .01em; color: var(--sidebar-text); text-align: start; }
.nav-toggle:hover { background: var(--sidebar-hover, rgba(0,0,0,.04)); color: var(--sidebar-text); }
.nav-toggle .badge { font-size: .66rem; padding: 0 .4rem; }
.nav-toggle .chev { margin-inline-start: .35rem; width: .45rem; height: .5rem; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg); transition: transform .2s; } /* ∨ مفتوح، ‹ مطوي */
.nav-toggle[aria-expanded="false"] .chev { transform: rotate(135deg); }
.nav-sub { list-style: none; margin: 0; padding: 0; }
.nav-sub[hidden] { display: none; }
@media (prefers-reduced-motion: reduce) { .nav-toggle .chev { transition: none; } }

body.nav-open { overflow: hidden; }
@media (min-width: 1025px) { body.nav-open { overflow-x: hidden; overflow-y: auto; } }
.tabs { display: flex; flex-wrap: wrap; gap: .3rem; margin: 0 0 1.1rem; padding: .3rem; background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; width: fit-content; max-width: 100%; }
.tabs a { padding: .45rem 1rem; border-radius: 9px; text-decoration: none; color: var(--muted); font-weight: 600; font-size: .9rem; }
.tabs a:hover { color: var(--brand-2); }
.tabs a.on { background: var(--surface); color: var(--brand-2); box-shadow: 0 1px 2px rgba(16, 24, 40, .12); }
html.js form[data-autofilter] .btn-apply { display: none; }
.filters .clear-link { align-self: center; font-size: .86rem; white-space: nowrap; }

/* ---------- الرسم الدائري (لوحة المؤشرات) — ألوان مُتحقَّق منها لعمى الألوان في الوضعين */
:root { --pie-used: #1d5fa8; --pie-pending: #d9932b; --pie-avail: #4db6e8; --pie-track: #e6edf5; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --pie-used: #3d6cc4; --pie-pending: #b37b25; --pie-avail: #14a3b8; --pie-track: #1b2d42; } }
:root[data-theme="dark"] { --pie-used: #3d6cc4; --pie-pending: #b37b25; --pie-avail: #14a3b8; --pie-track: #1b2d42; }
/* حالات الطلبات (مُتحقق منها بأداة فحص عمى الألوان، فاتح وداكن) */
:root { --st-approved: #1f8a4c; --st-pending: #d9932b; --st-cancelled: #3a6fd0; --st-rejected: #c8433a; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --st-approved: #1e9e78; --st-pending: #b37b25; --st-cancelled: #4f86ea; --st-rejected: #e0605a; } }
:root[data-theme="dark"] { --st-approved: #1e9e78; --st-pending: #b37b25; --st-cancelled: #4f86ea; --st-rejected: #e0605a; }
.chart-sub { margin: -.45rem 0 .6rem; }
.donut-wrap { display: grid; grid-template-columns: minmax(150px, 210px) 1fr; gap: 1.25rem; align-items: center; }
.donut { width: 100%; height: auto; transform: scaleX(-1); } /* اتجاه عقارب الساعة يبدأ من الأعلى ويسير يميناً */
.donut text { transform: scaleX(-1); transform-origin: 21px 21px; text-anchor: middle; font-family: var(--font); }
.donut-track { stroke: var(--pie-track); }
.donut .seg { transition: stroke-width .15s; cursor: default; }
.donut .seg:hover { stroke-width: 6.4; }
.seg-used { stroke: var(--pie-used); } .seg-pending { stroke: var(--pie-pending); } .seg-avail { stroke: var(--pie-avail); }
.seg-approved { stroke: var(--st-approved); } .seg-rejected { stroke: var(--st-rejected); } .seg-cancelled { stroke: var(--st-cancelled); }
.donut-num { font-size: 7px; font-weight: 800; fill: var(--brand-ink); }
.donut-cap { font-size: 2.9px; fill: var(--muted); }
.donut-legend { list-style: none; margin: 0; padding: 0; display: grid; gap: .55rem; }
.donut-legend li { display: grid; grid-template-columns: 14px 1fr auto 3.2rem; align-items: center; gap: .55rem; padding: .45rem .6rem; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); }
.donut-legend .sw { width: 14px; height: 14px; border-radius: 4px; }
.sw-used { background: var(--pie-used); } .sw-pending { background: var(--pie-pending); } .sw-avail { background: var(--pie-avail); }
.sw-approved { background: var(--st-approved); } .sw-rejected { background: var(--st-rejected); } .sw-cancelled { background: var(--st-cancelled); }
.donut-legend .lbl { color: var(--text); font-size: .9rem; }
.donut-legend b { font-size: 1.05rem; color: var(--text); }
.donut-legend .pct { color: var(--muted); font-size: .85rem; text-align: end; }
@media (max-width: 520px) { .donut-wrap { grid-template-columns: 1fr; justify-items: center; } .donut { max-width: 200px; } .donut-legend { width: 100%; } }

.bcard .s.book { color: var(--brand-2); margin-top: .15rem; }
.bcard .s.book b { color: var(--brand-2); }
.balance-alert { margin-bottom: .75rem; }

/* ---------- نافذة السبب */
.reason-dlg { width: min(520px, calc(100vw - 2rem)); }
.reason-dlg textarea { width: 100%; margin: .5rem 0; }
.chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.chip { border: 1px solid var(--border); background: var(--surface-2); color: var(--text); border-radius: 999px; padding: .3rem .8rem; font: inherit; font-size: .85rem; cursor: pointer; }
.chip:hover { border-color: var(--brand-solid); background: var(--brand-soft); color: var(--brand-2); }
.confirm-impact { margin: .5rem 0 .8rem; padding: .55rem .7rem; border: 1px dashed var(--warn); border-radius: 10px; background: var(--warn-soft); color: var(--warn); }
.plain { list-style: none; padding: 0; margin: .4rem 0 0; line-height: 1.9; }

/* ---------- رؤوس جدولي الرصيد: ما أُضيف (+) وما استُخدم (−) */
.card.flush > .ledger-head { display: flex; gap: .7rem; align-items: flex-start; padding: 1rem 1.25rem .7rem; }
.ledger-head h2 { margin: 0; }
.ledger-head .hint { margin: .15rem 0 0; }
.ledger-sign { flex: none; width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; font-weight: 800; font-size: 1.2rem; line-height: 1; }
.ledger-sign.plus { background: var(--ok-soft); color: var(--ok); }
.ledger-sign.minus { background: var(--warn-soft); color: var(--warn); }

/* ---------- بطاقات الدخول (للطباعة: بطاقتان في الصف) */
.login-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12mm 10mm; max-width: 190mm; margin: 0 auto 2rem; padding: 0 1rem; }
.login-card { background: #fff; color: #10233a; border: 1.5px dashed #9fb4c9; border-radius: 14px; padding: 5mm 6mm; break-inside: avoid; page-break-inside: avoid; position: relative; overflow: hidden; }
.login-card::before { content: ""; position: absolute; inset: 0 0 auto; height: 4px; background: linear-gradient(90deg, #009fe3, #006bb6); }
.login-card header { display: flex; align-items: center; gap: .5rem; border-bottom: 1px solid #dbe4ee; padding-bottom: .4rem; margin-bottom: .45rem; }
.login-card header b { display: block; color: #006bb6; font-size: 1.05rem; line-height: 1.2; }
.login-card header small { display: block; color: #4f6378; font-size: .68rem; }
.login-card .lc-tag { margin-inline-start: auto; font-size: .7rem; font-weight: 700; color: #00427a; background: #e6f2fb; border-radius: 999px; padding: .1rem .55rem; }
.login-card h3 { margin: .2rem 0 0; font-size: 1.05rem; color: #00427a; }
.login-card .lc-meta { margin: 0 0 .4rem; color: #4f6378; font-size: .78rem; }
.login-card dl { display: grid; grid-template-columns: auto 1fr; gap: .25rem .6rem; margin: 0 0 .45rem; padding: .45rem .6rem; background: #f5f7fa; border-radius: 10px; }
.login-card dt { color: #4f6378; font-size: .78rem; align-self: center; }
.login-card dd { margin: 0; font-size: 1.05rem; font-weight: 800; letter-spacing: .04em; direction: ltr; text-align: end; font-family: ui-monospace, Consolas, monospace; }
.login-card .lc-url { margin: 0; font-size: .74rem; color: #10233a; }
.login-card .lc-url span { direction: ltr; unicode-bidi: isolate; }
.login-card .lc-note { margin: .25rem 0 0; font-size: .72rem; color: #9a5800; }
.login-card footer { margin-top: .3rem; font-size: .66rem; color: #8090a0; }
@media (max-width: 640px) { .login-cards { grid-template-columns: 1fr; } }
@media print { .login-cards { padding: 0; gap: 8mm; } .login-card { box-shadow: none; } }

/* ---------- تقليل الحركة */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; }
  .kpi:hover, .gate-features li:hover, .btn:active, .nav li a:hover .i3d { transform: none !important; }
}

/* ---------- الطباعة: لا زخارف ولا أيقونات */
@media print {
  .i3d, .gate-hero, .acct, .kpi::before, .kpi::after, .gate-main::before, .gate-main::after { display: none !important; }
  .kpi, .card { background: #fff !important; border: 1px solid #bbb !important; }
  .kpi:has(.i3d) .l { padding: 0; min-height: 0; }
  .kpi .v { color: #000; }
  .grid.kpis { grid-template-columns: repeat(3, 1fr); }
}
/* تبويبات الإعدادات على الجوال: تمرير أفقي بدل التكسّر (في آخر الملف ليغلب القاعدة الأساسية) */
@media (max-width: 640px) { nav.tabs { flex-wrap: nowrap; overflow-x: auto; scroll-snap-type: x proximity; width: 100%; -webkit-overflow-scrolling: touch; scrollbar-width: thin; } nav.tabs a { white-space: nowrap; scroll-snap-align: start; flex: none; } }

/* ---------- المرحلة 4: الفرق والتفويض والتقارير */
form.stack { display: grid; gap: .8rem; align-content: start; }
form.stack .field select { width: 100%; }
tr.dim td { opacity: .62; }
.mbars { display: flex; align-items: stretch; gap: .35rem; height: 240px; padding: 1.5rem .2rem 0; border-bottom: 1px solid var(--border); overflow-x: auto; }
.mcol { flex: 1 0 44px; display: flex; flex-direction: column; align-items: center; gap: .35rem; min-width: 44px; }
.mpair { flex: 1; width: 100%; display: flex; align-items: flex-end; justify-content: center; gap: 3px; }
.mb { position: relative; width: 40%; max-width: 20px; min-height: 0; border-radius: 5px 5px 0 0; }
.mb.g { background: var(--pie-avail); } .mb.u { background: var(--pie-used); }
.mb em { position: absolute; bottom: 100%; inset-inline-start: 50%; transform: translateX(50%); font-style: normal; font-size: .68rem; color: var(--muted); white-space: nowrap; padding-bottom: 2px; }
.mcol small { color: var(--muted); font-size: .75rem; padding-bottom: .3rem; }
.mlegend { display: flex; gap: 1.2rem; margin-top: .7rem; color: var(--muted); font-size: .88rem; }
.mlegend span { display: inline-flex; align-items: center; gap: .4rem; }
.mlegend .sw { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.mlegend .sw.g { background: var(--pie-avail); } .mlegend .sw.u { background: var(--pie-used); }
.ubar { display: inline-block; width: 70px; height: 7px; border-radius: 4px; background: var(--pie-track); vertical-align: middle; overflow: hidden; }
.ubar i { display: block; height: 100%; background: var(--pie-used); border-radius: 4px; }
details.danger-zone > summary { cursor: pointer; display: flex; align-items: center; gap: .5rem; color: var(--err); }
details.danger-zone[open] > summary { margin-bottom: .8rem; }

/* ---------- شريط الترحيب (هوية إتمام: أزرق مؤسسي مع نقش خفيف) */
.welcome { position: relative; overflow: hidden; color: #fff; border-radius: 18px; padding: 1.4rem 1.6rem 1.1rem; margin: 0 0 1.2rem;
  background: radial-gradient(120% 140% at 100% 0%, #0a7fd0 0%, #00589c 45%, #003a6b 100%); box-shadow: 0 10px 28px -14px rgba(0, 58, 107, .55); }
.welcome::before { content: ""; position: absolute; inset: 0; opacity: .13; pointer-events: none;
  background-image: radial-gradient(circle at 1px 1px, #fff 1.2px, transparent 1.4px); background-size: 22px 22px;
  -webkit-mask-image: linear-gradient(to left, transparent 15%, #000 85%); mask-image: linear-gradient(to left, transparent 15%, #000 85%); }
.welcome::after { content: ""; position: absolute; inset-inline-end: -60px; top: -80px; width: 260px; height: 260px; border-radius: 50%;
  border: 38px solid rgba(255, 255, 255, .06); pointer-events: none; }
.welcome > * { position: relative; }
.w-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; }
.w-hi { margin: 0; font-size: clamp(1.45rem, 1.1rem + 1.4vw, 2.1rem); font-weight: 800; color: #fff; line-height: 1.3; }
.w-quote { margin: .65rem 0 0; padding-inline-start: .8rem; border-inline-start: 3px solid #7fd3ff; color: rgba(255, 255, 255, .9); font-size: .98rem; max-width: 60ch; }
.w-date { margin: .3rem 0 0; display: flex; flex-wrap: wrap; gap: .25rem .6rem; color: rgba(255, 255, 255, .85); font-weight: 600; font-size: .92rem; }
.w-date .w-hijri::before { content: "·"; margin-inline-end: .6rem; opacity: .7; }
.w-week { list-style: none; margin: 1.3rem 0 0; padding: 0; display: grid; grid-template-columns: repeat(5, 1fr); position: relative; }
.w-week::before { content: ""; position: absolute; inset-inline: 10%; bottom: 7px; height: 2px; background: rgba(255, 255, 255, .28); border-radius: 2px; }
.w-week li { display: flex; flex-direction: column; align-items: center; gap: .55rem; font-size: .9rem; color: rgba(255, 255, 255, .78); }
.w-week li i { width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 0 0 3px rgba(255, 255, 255, .18); z-index: 1; }
.w-week li.next i { background: rgba(255, 255, 255, .35); box-shadow: none; }
.w-week li.next span { color: rgba(255, 255, 255, .6); }
.w-week li.today span { color: #9fe0ff; font-weight: 800; }
.w-week li.today i { background: #7fd3ff; width: 20px; height: 20px; margin-bottom: -2px; box-shadow: 0 0 0 5px rgba(127, 211, 255, .3), 0 0 14px rgba(127, 211, 255, .8); }
.w-off { margin: .8rem 0 0; text-align: center; color: rgba(255, 255, 255, .85); font-size: .9rem; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .welcome { background: radial-gradient(120% 140% at 100% 0%, #0b5c9a 0%, #0a3d68 50%, #072a49 100%); } }
:root[data-theme="dark"] .welcome { background: radial-gradient(120% 140% at 100% 0%, #0b5c9a 0%, #0a3d68 50%, #072a49 100%); }
@media (max-width: 560px) { .welcome { padding: 1.1rem 1rem .9rem; } .w-week li { font-size: .78rem; } .w-date { font-size: .82rem; } }
@media print { .welcome { display: none; } }

/* ---------- الأسئلة الشائعة */
.faq-doc h3 { margin: 1.2rem 0 .5rem; color: var(--brand-2); font-size: 1.02rem; }
.faq-item { border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); margin: 0 0 .45rem; }
.faq-item > summary { cursor: pointer; list-style: none; padding: .7rem .9rem; font-weight: 700; color: var(--text); display: flex; align-items: center; gap: .6rem; }
.faq-item > summary::-webkit-details-marker { display: none; }
.faq-item > summary::before { content: "+"; flex: none; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand-2); font-weight: 800; line-height: 1; }
.faq-item[open] > summary::before { content: "−"; }
.faq-item[open] { background: var(--surface); }
.faq-item > p { margin: 0; padding: 0 .9rem .85rem 2.4rem; padding-inline-start: 2.5rem; padding-inline-end: .9rem; color: var(--muted); line-height: 1.9; }
.faq-item > summary:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 10px; }
