/* نوبة — دفتر النوبات
   ورق دافئ، حبر أخضر للنوبة الأولى وطوبي للثانية، مغرة للأعياد، أزرق رصاصي للإجازات.
   خطوط فاصلة رفيعة مثل سجل الدوام الورقي. */

:root {
  --paper: #F3EFE6; --paper-2: #EAE4D6; --card: #FBF9F4; --sunk: #EFEADF;
  --ink: #1A1F1C; --ink-2: #4A524D; --ink-3: #6B726C;
  --rule: #DFD7C6; --rule-2: #CBC1AC;
  --a: #1E5B4B; --a-soft: #D5E5DB; --a-ink: #123A30;
  --b: #A4462A; --b-soft: #F1DCD0; --b-ink: #6B2A16;
  --hol: #B07C12; --hol-soft: #F3E3BC;
  --lv: #2E5375; --lv-soft: #D8E2EC;
  --bad: #A8241A; --bad-soft: #F5D9D4; --warn: #7F5708; --ok: #1E5B4B;
  --shadow: 0 1px 0 rgba(26, 31, 28, .04), 0 8px 24px -14px rgba(26, 31, 28, .22);
  --f-display: 'Cairo', 'Segoe UI', Tahoma, sans-serif;
  --f-body: 'Cairo', system-ui, 'Segoe UI', Tahoma, sans-serif;
  --r: 6px; --r-s: 4px;
  --ease: cubic-bezier(.2, .7, .2, 1);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #151917; --paper-2: #1A1F1C; --card: #1E2420; --sunk: #191E1B;
    --ink: #ECE7DC; --ink-2: #BDB8AD; --ink-3: #959188;
    --rule: #2E3530; --rule-2: #3B433D;
    --a: #6DB59B; --a-soft: #20362D; --a-ink: #C2E5D6;
    --b: #E38B6B; --b-soft: #3D271F; --b-ink: #F6CDBB;
    --hol: #E2B451; --hol-soft: #3A3020;
    --lv: #8EB1D4; --lv-soft: #22303D;
    --bad: #F08B81; --bad-soft: #3D2220; --warn: #E2B451; --ok: #6DB59B;
    --shadow: 0 1px 0 rgba(0, 0, 0, .3), 0 10px 28px -16px rgba(0, 0, 0, .7);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #151917; --paper-2: #1A1F1C; --card: #1E2420; --sunk: #191E1B;
  --ink: #ECE7DC; --ink-2: #BDB8AD; --ink-3: #959188;
  --rule: #2E3530; --rule-2: #3B433D;
  --a: #6DB59B; --a-soft: #20362D; --a-ink: #C2E5D6;
  --b: #E38B6B; --b-soft: #3D271F; --b-ink: #F6CDBB;
  --hol: #E2B451; --hol-soft: #3A3020;
  --lv: #8EB1D4; --lv-soft: #22303D;
  --bad: #F08B81; --bad-soft: #3D2220; --warn: #E2B451; --ok: #6DB59B;
  --shadow: 0 1px 0 rgba(0, 0, 0, .3), 0 10px 28px -16px rgba(0, 0, 0, .7);
  color-scheme: dark;
}

.s-A { --s: var(--a); --s-soft: var(--a-soft); --s-ink: var(--a-ink); }
.s-B { --s: var(--b); --s-soft: var(--b-soft); --s-ink: var(--b-ink); }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 400 16px/1.6 var(--f-body);
  font-feature-settings: "tnum" 1;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { font-family: var(--f-display); font-weight: 700; margin: 0; line-height: 1.35; }
p { margin: 0; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
code, .mono { font-family: ui-monospace, 'Cascadia Mono', Consolas, monospace; font-size: .92em; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--ink-3); }
.small { font-size: 13px; }
.block { display: block; }
.num { font-variant-numeric: tabular-nums; }
.grow { flex: 1; min-width: 0; }
.bad { color: var(--bad); }
.warn { color: var(--warn); }
.ic { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: none; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; border-radius: 3px; }

.skip { position: fixed; top: 8px; inset-inline-start: 8px; z-index: 100; background: var(--ink); color: var(--paper); padding: 8px 14px; border-radius: var(--r-s); transform: translateY(-160%); transition: transform .15s; }
.skip:focus { transform: none; }

/* ───────── التحميل ───────── */
.boot { min-height: 100vh; display: grid; place-items: center; }
.mark { display: inline-flex; gap: 3px; align-items: flex-end; }
.mark i { display: block; width: 7px; height: 22px; border-radius: 1px; background: var(--s); }
.mark i + i { height: 15px; }
.boot .mark i { animation: pulse 1s var(--ease) infinite alternate; }
.boot .mark i + i { animation-delay: .25s; }
@keyframes pulse { to { opacity: .35; } }

/* ───────── الهيكل ───────── */
.app { display: grid; grid-template-columns: 252px minmax(0, 1fr); min-height: 100vh; }
.rail {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  background: var(--paper-2); border-inline-end: 1px solid var(--rule);
  display: flex; flex-direction: column; padding: 22px 16px 16px;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 0 6px; }
.brand .word, .topbar .word { font-family: var(--f-display); font-weight: 800; font-size: 26px; line-height: 1; }
.rail .rail-x { display: none; margin-inline-start: auto; }
.org { color: var(--ink-3); font-size: 13px; padding: 6px 6px 0; }
.now {
  margin: 18px 0 14px; padding: 12px 14px 13px; border-radius: var(--r);
  background: var(--card); border: 1px solid var(--rule);
  border-inline-start: 4px solid var(--s);
  display: grid; gap: 1px;
}
.now-k { font-size: 12px; color: var(--ink-3); }
.now strong { font-family: var(--f-display); font-size: 17px; color: var(--s-ink); }
.now-d { font-size: 12.5px; color: var(--ink-2); }
.now-bar { display: grid; grid-auto-flow: column; gap: 2px; margin-top: 7px; }
.now-bar i { height: 5px; border-radius: 1px; background: var(--rule); }
.now-bar i.f { background: var(--s); }

.nav { display: grid; gap: 2px; }
.nav hr { border: 0; border-top: 1px solid var(--rule); margin: 10px 6px; }
.nav-i {
  display: flex; align-items: center; gap: 11px; min-height: 42px; padding: 0 12px; border-radius: var(--r-s);
  text-decoration: none; color: var(--ink-2); font-size: 15px; position: relative;
  transition: background .15s, color .15s;
}
.nav-i:hover { background: var(--sunk); color: var(--ink); }
.nav-i.on { background: var(--card); color: var(--ink); font-weight: 500; box-shadow: inset -3px 0 0 var(--ink); }
.nav-i .badge { margin-inline-start: auto; }
.badge { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--b); color: #fff; font: 600 11.5px/20px var(--f-body); text-align: center; }

.rail-foot { margin-top: auto; padding-top: 14px; border-top: 1px solid var(--rule); display: flex; align-items: center; gap: 6px; }
.who { display: flex; gap: 10px; align-items: center; text-decoration: none; flex: 1; min-width: 0; padding: 6px; border-radius: var(--r-s); }
.who:hover, .who.on { background: var(--sunk); }
.who > span:last-child { min-width: 0; flex: 1; }
.who strong { display: block; font-size: 14px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.who small { display: block; font-size: 12px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.av { flex: none; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--s-soft, var(--sunk)); color: var(--s-ink, var(--ink)); font-family: var(--f-display); font-weight: 700; font-size: 14px; }
.rail-tools { display: flex; }
.only-dark { display: none; }
:root[data-theme="dark"] .only-dark { display: block; }
:root[data-theme="dark"] .only-light { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .only-dark { display: block; }
  :root:not([data-theme="light"]) .only-light { display: none; }
}

.main { min-width: 0; padding: 28px clamp(16px, 3vw, 40px) 64px; max-width: 1360px; width: 100%; }
.topbar { display: none; }
.scrim { display: none; }

.phead { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px 24px; flex-wrap: wrap; padding-bottom: 16px; margin-bottom: 22px; border-bottom: 3px double var(--rule-2); }
.phead h1 { font-size: clamp(24px, 2.6vw, 31px); font-weight: 800; }
.sub { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; color: var(--ink-3); font-size: 14px; margin-top: 2px; }
.sub .dot { width: 4px; height: 4px; border-radius: 50%; background: var(--rule-2); }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
#page:focus { outline: none; }
#page > * + * { margin-top: 18px; }

/* ───────── الأزرار ───────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 40px; padding: 0 16px; border-radius: var(--r-s); border: 1px solid transparent;
  font-size: 14.5px; font-weight: 500; cursor: pointer; white-space: nowrap; text-decoration: none;
  transition: transform .15s var(--ease), background .15s, border-color .15s, box-shadow .15s;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0) scale(.98); }
.btn:disabled { opacity: .55; cursor: progress; transform: none; }
.btn-p { background: var(--ink); color: var(--paper); }
.btn-p:hover { box-shadow: 0 6px 14px -8px rgba(26, 31, 28, .6); }
.btn-g { background: var(--card); border-color: var(--rule-2); color: var(--ink); }
.btn-g:hover { border-color: var(--ink-3); }
.btn-d { background: var(--bad); color: #fff; }
.btn-s { min-height: 32px; padding: 0 11px; font-size: 13.5px; gap: 5px; }
.btn-s .ic { width: 15px; height: 15px; }
.btn-l { min-height: 48px; font-size: 16px; width: 100%; }
.icon-btn { width: 36px; height: 36px; display: inline-grid; place-items: center; border: 0; border-radius: var(--r-s); background: transparent; color: var(--ink-2); cursor: pointer; transition: background .15s, color .15s; flex: none; }
.icon-btn:hover { background: var(--sunk); color: var(--ink); }
.link { font-size: 13.5px; color: var(--ink-2); text-decoration: none; background-image: linear-gradient(currentColor, currentColor); background-size: 0 1px; background-repeat: no-repeat; background-position: 100% 100%; transition: background-size .2s var(--ease); }
.link:hover { background-size: 100% 1px; color: var(--ink); }
.file-btn { cursor: pointer; }

/* ───────── اللوحات ───────── */
.panel { background: var(--card); border: 1px solid var(--rule); border-radius: var(--r); padding: 18px 20px; box-shadow: var(--shadow); min-width: 0; }
.panel.flush { padding: 0; overflow: hidden; }
.panel-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.panel.flush > .panel-h { padding: 16px 20px 0; }
.panel-h h2 { font-size: 16px; }
.count { min-width: 26px; height: 22px; padding: 0 7px; display: inline-grid; place-items: center; border-radius: 11px; background: var(--sunk); font-size: 12.5px; color: var(--ink-2); }
.grid { display: grid; gap: 18px; }
.g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.sub-h { font-size: 13.5px; color: var(--ink-3); font-family: var(--f-body); font-weight: 500; margin: 16px 0 8px; }
.empty { padding: 26px 16px; text-align: center; color: var(--ink-3); }
.empty p { font-size: 14.5px; color: var(--ink-2); }
.empty small { display: block; margin-top: 4px; font-size: 13px; }
.foot-note, .tab-note { font-size: 13px; color: var(--ink-3); }
.tab-note { padding: 14px 20px 0; }
.foot-note { padding: 0 4px; }
.kicker { display: block; font-size: 12.5px; color: var(--ink-3); margin-bottom: 4px; }

.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 10px 16px; flex-wrap: wrap; padding: 14px 20px; }
.panel:not(.flush) > .toolbar, #page > .toolbar { padding: 0; }
.panel.flush > .toolbar { border-bottom: 1px solid var(--rule); }
.month-nav { display: flex; align-items: center; gap: 4px; }
.month-nav strong { font-family: var(--f-display); font-size: 16px; min-width: 132px; text-align: center; }
.search, .year-in, .copy-row input { height: 38px; padding: 0 12px; border: 1px solid var(--rule-2); border-radius: var(--r-s); background: var(--paper); min-width: 0; }
.search { width: min(260px, 100%); }
.year-in { width: 92px; }
.inline { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; color: var(--ink-2); }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { min-height: 34px; padding: 0 13px; border-radius: 17px; border: 1px solid var(--rule-2); background: transparent; font-size: 13.5px; color: var(--ink-2); cursor: pointer; transition: background .15s, color .15s, border-color .15s; }
.chip:hover { border-color: var(--ink-3); color: var(--ink); }
.chip.on { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.chip b { font-weight: 600; opacity: .7; }

.tabs { display: flex; gap: 2px; overflow-x: auto; border-bottom: 1px solid var(--rule-2); scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { position: relative; min-height: 44px; padding: 0 14px; border: 0; background: none; cursor: pointer; color: var(--ink-3); font-size: 14.5px; white-space: nowrap; display: inline-flex; align-items: center; gap: 7px; text-decoration: none; }
.tab::after { content: ""; position: absolute; inset-inline: 10px; bottom: -1px; height: 2px; background: var(--ink); transform: scaleX(0); transition: transform .2s var(--ease); }
.tab:hover { color: var(--ink); }
.tab.on { color: var(--ink); font-weight: 500; }
.tab.on::after { transform: none; }
.tab b { min-width: 20px; height: 19px; padding: 0 6px; border-radius: 10px; background: var(--sunk); font: 600 11.5px/19px var(--f-body); color: var(--ink-2); }
#page > .tabs + * { margin-top: 14px; }

/* علامات صغيرة */
.stag { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: var(--r-s); background: var(--s-soft); color: var(--s-ink); font-size: 12.5px; font-weight: 500; white-space: nowrap; }
.stag.both { background: var(--sunk); color: var(--ink-2); }
.dot-s { display: inline-block; width: 8px; height: 8px; border-radius: 2px; background: var(--s, var(--ink-3)); margin-inline-end: 7px; vertical-align: 1px; }
.pill { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: var(--r-s); font-size: 12.5px; white-space: nowrap; background: var(--sunk); color: var(--ink-2); border: 1px solid transparent; }
.ls-approved, .ps-approved, .sw-approved { background: var(--a-soft); color: var(--a-ink); }
.ls-pending, .ps-pending, .sw-pending, .sw-peer { background: var(--hol-soft); color: var(--warn); }
.ls-suggested { background: transparent; border: 1px dashed var(--lv); color: var(--lv); }
.ls-rejected, .ps-rejected, .sw-rejected { background: var(--bad-soft); color: var(--bad); }
.ls-cancelled, .sw-cancelled { text-decoration: line-through; }
.ls-changed { background: transparent; border: 1px solid var(--b); color: var(--b); }
.ts-open { background: var(--sunk); }
.ts-follow { background: var(--hol-soft); color: var(--warn); }
.ts-waiting { background: var(--lv-soft); color: var(--lv); }
.ts-closed { background: transparent; color: var(--ink-3); border-color: var(--rule-2); }
.tp-urgent { background: var(--bad); color: #fff; }
.tp-high { background: transparent; border-color: var(--hol); color: var(--warn); }
.best-pill { background: var(--ink); color: var(--paper); }
.approx { font-size: 11.5px; color: var(--warn); border: 1px solid currentColor; border-radius: 3px; padding: 0 5px; font-weight: 500; }
.tag-permit { font-size: 11.5px; color: var(--lv); }
.lt { font-weight: 500; }
.lt-annual { color: var(--lv); } .lt-sick { color: var(--bad); } .lt-occasion { color: var(--warn); } .lt-comp { color: var(--a); }

.legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12.5px; color: var(--ink-3); }
.legend > span { display: inline-flex; align-items: center; gap: 6px; }
.lg { display: inline-grid; place-items: center; width: 14px; height: 14px; border-radius: 2px; font-style: normal; font-size: 9px; color: #fff; }
.lg.on-A { background: var(--a); } .lg.on-B { background: var(--b); }
.lg.hol { background: var(--hol); } .lg.today { background: transparent; box-shadow: inset 0 0 0 2px var(--ink); }
.lg.lv { background: var(--lv); }
.lg.pm { background: radial-gradient(circle at 50% 70%, var(--lv) 2.5px, transparent 3px), var(--sunk); }
.lg.swp { background: linear-gradient(225deg, var(--ink) 5px, transparent 5px), var(--sunk); }

/* ───────── الرئيسية ───────── */
.status {
  display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(220px, .8fr); gap: 18px 32px; align-items: end;
  padding: 26px 28px 22px; border-radius: var(--r); background: var(--card); border: 1px solid var(--rule);
  border-inline-start: 6px solid var(--s); box-shadow: var(--shadow); position: relative; overflow: hidden;
}
.status.tone-on { background: linear-gradient(to left, var(--s-soft), var(--card) 70%); }
.status.tone-leave { border-inline-start-color: var(--lv); }
.status.tone-hol { border-inline-start-color: var(--hol); }
.status h2 { font-size: clamp(26px, 3.2vw, 38px); font-weight: 800; line-height: 1.25; }
.status-line { color: var(--ink-2); margin-top: 6px; font-size: 15.5px; }
.status-next { display: flex; align-items: center; gap: 8px; margin-top: 14px; font-weight: 500; }
.status-block { display: grid; gap: 8px; justify-items: start; }
.sb-k { font-size: 12.5px; color: var(--ink-3); }
.sb-cells { display: grid; grid-auto-flow: column; gap: 3px; width: 100%; }
.sb-cells i { height: 28px; border-radius: 2px; background: var(--paper); border: 1px solid var(--rule); }
.sb-cells i.f { background: var(--s); border-color: var(--s); }
.tone-off .sb-cells i.f { background: var(--rule-2); border-color: var(--rule-2); }
.sb-cells i.t { box-shadow: 0 0 0 2px var(--card), 0 0 0 4px var(--ink); }
.sb-n { font-size: 14px; color: var(--ink-2); }
.sb-n b { font-family: var(--f-display); font-size: 22px; color: var(--ink); }
.status-quick { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 8px; padding-top: 16px; border-top: 1px dashed var(--rule-2); }

.strip { display: grid; gap: 6px; }
.strip-row, .strip-marks { display: grid; grid-template-columns: 112px minmax(0, 1fr); align-items: center; gap: 10px; }
.strip-name { font-size: 13px; color: var(--s-ink, var(--ink-3)); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.strip-cells { display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); gap: 2px; }
.strip-cells i { position: relative; height: 26px; border-radius: 2px; background: var(--sunk); }
.strip-cells i.on { background: var(--s); }
.strip-cells i.t { box-shadow: 0 0 0 2px var(--card), 0 0 0 3.5px var(--ink); z-index: 1; }
.strip-cells i.h::after { content: ""; position: absolute; top: -6px; left: 50%; width: 6px; height: 6px; margin-left: -3px; border-radius: 50%; background: var(--hol); }
.strip.compact .strip-cells i { height: 16px; }
.strip-axis { position: relative; height: 18px; }
.strip-mark { position: absolute; inset-inline-start: calc(var(--i) / var(--n) * 100%); font-size: 11.5px; color: var(--ink-3); white-space: nowrap; padding-inline-start: 4px; border-inline-start: 1px solid var(--rule-2); line-height: 18px; }

.duty-head { display: flex; align-items: center; gap: 20px; margin-bottom: 12px; }
.big-n { display: grid; }
.big-n b { font-family: var(--f-display); font-size: 40px; line-height: 1; font-weight: 800; }
.big-n span { font-size: 13px; color: var(--ink-3); }
.big-n.bad b { color: var(--bad); }
.duty-meta { display: grid; gap: 3px; font-size: 13.5px; color: var(--ink-2); }
.duty-meta span { display: inline-flex; align-items: center; gap: 6px; }
.duty-meta .ic { width: 15px; height: 15px; }
.names { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.names li { display: inline-flex; align-items: center; padding: 5px 10px; border-radius: var(--r-s); background: var(--paper); border: 1px solid var(--rule); font-size: 14px; }
.away { margin-top: 12px; font-size: 13.5px; color: var(--ink-2); }

.rows { list-style: none; margin: 0; padding: 0; }
.rows > li { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--rule); font-size: 14.5px; }
.rows > li:last-child { border-bottom: 0; }
.row-btn, .row-link { display: flex; align-items: center; gap: 10px; width: 100%; padding: 0; border: 0; background: none; text-align: start; cursor: pointer; text-decoration: none; }
.row-link:hover .grow, .row-btn:hover b { text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
.row-link .ic { color: var(--ink-3); }
.topics-mini li { border-inline-start: 3px solid transparent; padding-inline-start: 10px; }
.pr-urgent { border-inline-start-color: var(--bad) !important; }
.pr-high { border-inline-start-color: var(--hol) !important; }
.waiting { border-inline-start: 4px solid var(--b); }

.ev-list { list-style: none; margin: 0; padding: 0; }
.ev { display: flex; align-items: center; gap: 14px; padding: 10px 0; border-bottom: 1px solid var(--rule); }
.ev:last-child { border-bottom: 0; }
.ev-n { flex: none; width: 52px; height: 52px; border-radius: var(--r-s); display: grid; place-content: center; text-align: center; background: var(--hol-soft); color: var(--warn); line-height: 1.1; }
.ev-n b { font-family: var(--f-display); font-size: 19px; }
.ev-n small { font-size: 11px; }
.ev.t-occasion .ev-n { background: var(--lv-soft); color: var(--lv); }

.notice { display: flex; gap: 16px; align-items: flex-start; padding: 14px 0; border-bottom: 1px solid var(--rule); }
.notice:last-child { border-bottom: 0; }
.notice h3 { font-size: 15.5px; }
.notice p { color: var(--ink-2); font-size: 14.5px; margin: 4px 0; white-space: pre-line; }
.notice:not(.read) h3::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--b); margin-inline-end: 8px; vertical-align: 2px; }
.notice-a { display: flex; flex-direction: column; gap: 6px; align-items: flex-end; }
.read-mark { display: inline-flex; gap: 4px; align-items: center; font-size: 13px; white-space: nowrap; }
.notices { padding: 0 20px; }

/* ───────── الجداول ───────── */
.tbl-wrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.tbl th { text-align: start; font-weight: 500; font-size: 12.5px; color: var(--ink-3); padding: 10px 14px; border-bottom: 1px solid var(--rule-2); white-space: nowrap; background: var(--card); }
.tbl td, .tbl tbody th { padding: 11px 14px; border-bottom: 1px solid var(--rule); vertical-align: middle; text-align: start; }
.tbl tbody th { font-weight: 500; color: var(--ink); font-size: 14.5px; white-space: nowrap; }
.tbl tbody tr:last-child > * { border-bottom: 0; }
.tbl tbody tr { transition: background .12s; }
.tbl tbody tr:hover { background: var(--paper); }
.tbl tr.changed td:first-child { box-shadow: inset -3px 0 0 var(--b); }
.tbl tr.off { opacity: .55; }
.acts { white-space: nowrap; text-align: end !important; }
.acts > * + * { margin-inline-start: 4px; }
.th-group th { text-align: center; border-bottom: 1px solid var(--rule); color: var(--ink-2); }
.stats-tbl td.num, .stats-tbl th:not(:first-child) { text-align: center; }
.cell-bad { background: var(--bad-soft); color: var(--bad); font-weight: 600; }
.meter { display: inline-block; width: 54px; height: 6px; border-radius: 3px; background: var(--sunk); margin-inline-end: 8px; vertical-align: 2px; overflow: hidden; }
.meter i { display: block; height: 100%; width: var(--v); background: var(--lv); border-radius: 3px; }
.perm-list { display: flex; flex-wrap: wrap; gap: 4px; max-width: 360px; }
.perm { font-size: 11.5px; padding: 1px 6px; border-radius: 3px; background: var(--sunk); color: var(--ink-2); white-space: nowrap; }

/* ───────── الكشف ───────── */
.sheet-wrap { overflow: auto; max-height: calc(100vh - 230px); }
.sheet { border-collapse: separate; border-spacing: 0; font-size: 12.5px; min-width: 100%; }
.sheet th, .sheet td { border-bottom: 1px solid var(--rule); padding: 0; }
.sheet thead th { position: sticky; top: 0; z-index: 2; background: var(--card); border-bottom: 1px solid var(--rule-2); }
.sheet th.nm { position: sticky; inset-inline-start: 0; z-index: 1; background: var(--card); text-align: start; padding: 6px 14px; min-width: 168px; max-width: 200px; border-inline-end: 1px solid var(--rule-2); font-weight: 500; }
.sheet thead th.nm, .sheet th.corner { z-index: 3; color: var(--ink-3); font-size: 12px; }
.sheet th.nm span { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 13.5px; }
.sheet th.nm small { display: block; font-size: 11px; color: var(--ink-3); font-weight: 400; }
.sheet th.d { width: 32px; min-width: 32px; height: 46px; text-align: center; font-weight: 400; color: var(--ink-3); line-height: 1.2; }
.sheet th.d b { display: block; font-size: 13px; color: var(--ink); font-weight: 600; }
.sheet th.d i { font-style: normal; font-size: 10px; }
.sheet th.d.fri { background: var(--sunk); }
.sheet th.d.h { background: var(--hol-soft); }
.sheet th.d.h b { color: var(--warn); }
.sheet th.d.today { background: var(--ink); color: var(--paper); }
.sheet th.d.today b { color: var(--paper); }
.sheet th.d.sw { box-shadow: inset -2px 0 0 var(--ink-3); }
.sheet td.c { width: 32px; height: 34px; text-align: center; cursor: pointer; position: relative; font-weight: 600; font-size: 12px; transition: filter .12s; }
.sheet td.c:hover { filter: brightness(.94); box-shadow: inset 0 0 0 1.5px var(--ink); }
.sheet td.c-on { background: var(--s-soft); box-shadow: inset 0 -3px 0 var(--s); }
.sheet td.c-on:hover { box-shadow: inset 0 -3px 0 var(--s), inset 0 0 0 1.5px var(--ink); }
.sheet td.c-leave { background: var(--lv); color: #fff; }
.sheet td.c-holiday { background: var(--hol-soft); color: var(--warn); }
.sheet td.c-off.h { background: color-mix(in srgb, var(--hol-soft) 45%, transparent); }
.sheet td.lv-off { background: repeating-linear-gradient(135deg, var(--lv-soft) 0 3px, transparent 3px 7px); }
.sheet td.swp::before { content: ""; position: absolute; top: 0; inset-inline-end: 0; border: 5px solid transparent; border-top-color: var(--ink); border-inline-end-color: var(--ink); }
.sheet td.pm::after { content: ""; position: absolute; bottom: 6px; left: 50%; width: 5px; height: 5px; margin-left: -2.5px; border-radius: 50%; background: var(--lv); box-shadow: 0 0 0 1.5px var(--card); }
.sheet td.today { outline: 1.5px solid var(--ink); outline-offset: -1.5px; }
.sheet tr.me th.nm { box-shadow: inset -3px 0 0 var(--ink); }
.sheet tr.pr.me th.nm span { font-weight: 700; }
.sheet tr.grp th.nm { background: var(--s-soft); padding: 9px 14px; }
.sheet tr.grp th.nm span { font-family: var(--f-display); font-size: 14px; color: var(--s-ink); }
.sheet tr.grp td { background: var(--paper); border-bottom: 1px solid var(--rule-2); }
.sheet tr.grp td.gc.on { background: linear-gradient(var(--s), var(--s)) bottom / 100% 5px no-repeat, var(--paper); }
.sheet tr.cov th.nm span { font-size: 12px; color: var(--ink-3); font-weight: 400; }
.sheet tr.cov td { text-align: center; font-size: 11.5px; color: var(--ink-3); height: 28px; border-bottom: 1px solid var(--rule-2); }
.sheet tr.cov td.low { color: var(--bad); font-weight: 700; background: var(--bad-soft); }
.sheet-legend { padding: 12px 20px 14px; border-top: 1px solid var(--rule); }
.print-title { display: none; }

.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-top: 1px solid var(--rule); }
.cal-h { padding: 8px 10px; font-size: 12.5px; color: var(--ink-3); border-bottom: 1px solid var(--rule-2); background: var(--paper); }
.cal-h .short { display: none; }
.cal-d { min-height: 112px; padding: 8px 9px; display: flex; flex-direction: column; gap: 3px; align-items: stretch; text-align: start; border: 0; border-bottom: 1px solid var(--rule); border-inline-end: 1px solid var(--rule); background: var(--card); cursor: pointer; position: relative; box-shadow: inset 0 3px 0 var(--s, transparent); transition: background .12s; }
.cal-d:nth-child(7n) { border-inline-end: 0; }
.cal-d.pad { background: var(--paper); box-shadow: none; cursor: default; }
.cal-d:not(.pad):hover { background: var(--paper); }
.cal-d.h { background: color-mix(in srgb, var(--hol-soft) 55%, var(--card)); }
.cal-d.today { outline: 2px solid var(--ink); outline-offset: -2px; z-index: 1; }
.cal-d.sw::before { content: ""; position: absolute; inset-block: 0; inset-inline-start: 0; width: 2px; background: var(--ink-3); }
.cd-top { display: flex; align-items: baseline; justify-content: space-between; }
.cd-top b { font-family: var(--f-display); font-size: 17px; }
.cd-top small { font-size: 11px; color: var(--ink-3); }
.cd-shift { font-size: 11.5px; color: var(--s-ink); }
.cd-shift em { font-style: normal; background: var(--ink); color: var(--paper); padding: 0 4px; border-radius: 2px; font-size: 10.5px; }
.cd-ev { font-size: 11.5px; padding: 1px 5px; border-radius: 2px; background: var(--hol-soft); color: var(--warn); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cd-ev.t-occasion { background: var(--lv-soft); color: var(--lv); }
.cd-lv { font-size: 11px; color: var(--lv); margin-top: auto; }

/* ───────── الاستئذانات ───────── */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.kpis.inner { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.kpi { padding: 14px 16px; border-radius: var(--r); background: var(--card); border: 1px solid var(--rule); display: grid; gap: 2px; align-content: start; }
.kpis.inner .kpi { background: var(--paper); }
.kpi span { font-size: 12.5px; color: var(--ink-3); }
.kpi b { font-family: var(--f-display); font-size: 24px; font-weight: 800; line-height: 1.3; }
.kpi small { font-size: 12px; color: var(--ink-3); }
.kpi.bad b { color: var(--bad); }
.kpi.s-A, .kpi.s-B { border-inline-start: 4px solid var(--s); }
.permits-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; align-items: start; }
.bars { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.bars li { display: grid; grid-template-columns: minmax(80px, 140px) minmax(0, 1fr) auto; align-items: center; gap: 12px; font-size: 14px; }
.b-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.b-track { position: relative; height: 12px; background: var(--sunk); border-radius: 2px; }
.b-fill { position: absolute; inset-block: 0; inset-inline-start: 0; width: var(--v); background: var(--s, var(--lv)); border-radius: 2px; transition: width .4s var(--ease); }
.b-lim { position: absolute; inset-block: -4px; inset-inline-start: var(--l); width: 0; border-inline-start: 2px dashed var(--bad); z-index: 1; }
.bars li.over .b-name, .bars li.over .b-val b { color: var(--bad); font-weight: 600; }
.b-val { min-width: 60px; text-align: end; }
.b-val small { color: var(--ink-3); font-size: 12px; }

/* ───────── المواضيع ───────── */
.board { display: grid; gap: 0; }
.board.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.board.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.col { border-inline-end: 1px solid var(--rule); min-width: 0; display: flex; flex-direction: column; }
.col:last-child { border-inline-end: 0; }
.col-h { display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--rule); border-top: 4px solid var(--s, var(--ink-3)); background: var(--paper); }
.col.both .col-h { border-top-style: double; border-top-width: 5px; border-top-color: var(--ink-3); }
.col-h h2 { font-size: 14.5px; flex: 1; }
.col-b { padding: 12px; display: grid; gap: 10px; align-content: start; min-height: 220px; }
.col-empty { color: var(--ink-3); font-size: 13.5px; text-align: center; padding: 30px 0; }
.tcard { display: grid; gap: 6px; text-align: start; padding: 12px 14px; border-radius: var(--r-s); border: 1px solid var(--rule); border-inline-start: 3px solid var(--rule-2); background: var(--card); cursor: pointer; transition: transform .15s var(--ease), box-shadow .15s; width: 100%; }
.tcard:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.tcard.closed { opacity: .6; }
.tc-top { display: flex; gap: 5px; flex-wrap: wrap; }
.tc-title { font-size: 14.5px; font-weight: 600; line-height: 1.45; }
.tc-body { font-size: 13px; color: var(--ink-2); line-height: 1.55; }
.tc-meta { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: 12px; color: var(--ink-3); }
.topic-d h2 { font-size: 22px; margin-bottom: 10px; }
.meta-row { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; font-size: 13.5px; color: var(--ink-2); margin-bottom: 14px; }
.meta-row > span { display: inline-flex; align-items: center; gap: 5px; }
.meta-row .ic { width: 15px; height: 15px; }
.topic-body, .note-box { white-space: pre-line; background: var(--paper); border: 1px solid var(--rule); border-radius: var(--r-s); padding: 12px 14px; font-size: 14.5px; margin-bottom: 8px; }
.read-by { margin: 12px 0; font-size: 14px; }
.timeline { list-style: none; margin: 0 0 16px; padding: 0; border-inline-start: 2px solid var(--rule); }
.timeline li { position: relative; padding: 4px 18px 14px; }
.timeline li::before { content: ""; position: absolute; inset-inline-start: -6px; top: 10px; width: 10px; height: 10px; border-radius: 50%; background: var(--card); border: 2px solid var(--ink-3); }
.timeline p { white-space: pre-line; font-size: 14.5px; margin: 2px 0; }
.timeline small { font-size: 12px; }
.tl-status { font-size: 13px; display: inline-flex; gap: 6px; align-items: center; }
.update-form { display: grid; gap: 8px; padding-top: 12px; border-top: 1px solid var(--rule); }
.update-form textarea, .update-form select { width: 100%; border: 1px solid var(--rule-2); border-radius: var(--r-s); background: var(--paper); padding: 10px 12px; }
.update-form select { height: 40px; padding: 0 10px; }
.uf-row { display: flex; gap: 8px; }
.uf-row select { flex: 1; }
.handovers { padding: 0 20px 20px; display: grid; gap: 12px; }
.ho { border: 1px solid var(--rule); border-radius: var(--r); padding: 14px 16px; background: var(--paper); }
.ho-h { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin-bottom: 8px; }
.ho-route { display: inline-flex; align-items: center; gap: 6px; }
.ho-route .ic { width: 14px; height: 14px; color: var(--ink-3); }
.ho-sum { white-space: pre-line; font-size: 14.5px; }
.ho-eq { font-size: 13.5px; color: var(--ink-2); margin-top: 6px; white-space: pre-line; }
.ho details { margin-top: 8px; font-size: 14px; }
.ho summary { cursor: pointer; color: var(--ink-2); }
.ho-a { margin-top: 10px; }

/* ───────── الإجازات والمقترِح ───────── */
.planner h2 { font-size: 22px; margin-bottom: 6px; }
.planner > .muted { font-size: 14px; }
.planner-ctl { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; margin: 16px 0 10px; }
.planner-ctl label { display: grid; gap: 4px; font-size: 13px; color: var(--ink-2); }
.planner-ctl input, .planner-ctl select { height: 40px; border: 1px solid var(--rule-2); border-radius: var(--r-s); background: var(--paper); padding: 0 10px; }
.planner-ctl input { width: 96px; }
.bal-line { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 13.5px; color: var(--ink-2); padding: 10px 0; border-block: 1px solid var(--rule); margin-bottom: 12px; }
.sugg { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; counter-reset: s; }
.sugg li { counter-increment: s; border: 1px solid var(--rule); border-radius: var(--r); padding: 12px 14px; padding-inline-start: 44px; background: var(--card); display: grid; gap: 8px; position: relative; }
.sugg li::before { content: counter(s); position: absolute; inset-inline-start: 12px; top: 12px; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: var(--sunk); font-size: 12px; font-weight: 600; }
.sugg li.best { border-color: var(--ink); box-shadow: inset -4px 0 0 var(--ink); }
.sugg li.best::before { background: var(--ink); color: var(--paper); }
.sugg li.short { border-color: var(--bad); }
.sg-h { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.sg-d { font-family: var(--f-display); font-size: 16px; }
.sg-m { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 13.5px; color: var(--ink-2); }
.hol-t { color: var(--warn); }
.sg-a { display: flex; gap: 6px; flex-wrap: wrap; }
.pv { display: flex; flex-wrap: wrap; gap: 6px 16px; padding: 10px 12px; border-radius: var(--r-s); background: var(--paper); border: 1px dashed var(--rule-2); font-size: 13.5px; color: var(--ink-2); }
.pv b { color: var(--ink); }
.pv .bad, .pv .bad b { color: var(--bad); }

/* الأعياد */
.events-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 18px; align-items: start; }
.ev-month { padding: 0 20px; }
.ev-month + .ev-month { border-top: 1px solid var(--rule-2); }
.ev-mh { font-size: 14px; color: var(--ink-3); padding: 16px 0 4px; font-family: var(--f-display); }
.ev-rows { list-style: none; margin: 0; padding: 0; }
.ev-row { display: flex; gap: 16px; align-items: flex-start; padding: 12px 0; border-bottom: 1px solid var(--rule); }
.ev-row:last-child { border-bottom: 0; }
.ev-row.past { opacity: .55; }
.ev-date { flex: none; width: 66px; text-align: center; padding: 6px 0; border-radius: var(--r-s); background: var(--hol-soft); color: var(--warn); display: grid; line-height: 1.2; }
.ev-date b { font-family: var(--f-display); font-size: 20px; }
.ev-date b small { font-size: 13px; }
.ev-date > small { font-size: 11px; }
.ev-row.t-occasion .ev-date { background: var(--lv-soft); color: var(--lv); }
.ev-row.t-national .ev-date { background: color-mix(in srgb, var(--a-soft) 70%, var(--hol-soft)); color: var(--a); }
.on-shifts { margin-top: 5px; font-size: 12.5px; color: var(--ink-3); display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }

/* المخطط الشهري */
.chart { min-width: 0; }
.bchart { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 6px; height: 200px; align-items: end; padding-top: 18px; }
.bc-col { display: grid; grid-template-rows: 1fr auto; height: 100%; gap: 6px; min-width: 0; }
.bc-bars { display: flex; align-items: flex-end; justify-content: center; gap: 2px; height: 100%; }
.bc-bars i { position: relative; flex: 1; max-width: 16px; height: var(--v); min-height: 1px; border-radius: 2px 2px 0 0; background: var(--lv); }
.bc-bars i.on-A { background: var(--a); } .bc-bars i.on-B { background: var(--b); }
.bc-bars i em { position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%); font-style: normal; font-size: 10px; color: var(--ink-3); padding-bottom: 2px; }
.bc-l { font-size: 10.5px; color: var(--ink-3); text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* القيم */
.kv { margin: 0; display: grid; gap: 0; }
.kv > div { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--rule); font-size: 14.5px; }
.kv > div:last-child { border-bottom: 0; }
.kv dt { color: var(--ink-3); font-size: 13.5px; }
.kv dd { margin: 0; }
.kv.cols { grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 28px; margin-bottom: 16px; }
.kv.big dd { font-family: ui-monospace, Consolas, monospace; font-size: 22px; font-weight: 600; }
.creds h2 { margin-bottom: 12px; }
.msg { white-space: pre-wrap; background: var(--paper); border: 1px dashed var(--rule-2); border-radius: var(--r-s); padding: 12px 14px; font: 14px/1.7 var(--f-body); margin: 14px 0 0; }
.copy-row { display: flex; gap: 8px; margin: 12px 0 10px; }
.copy-row input { flex: 1; font-size: 13px; }
.audit { list-style: none; margin: 0; padding: 0; max-height: 420px; overflow: auto; font-size: 13.5px; }
.audit li { display: flex; flex-wrap: wrap; gap: 4px 12px; padding: 8px 0; border-bottom: 1px solid var(--rule); }
.audit li small { flex-basis: 100%; }

.runs { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.run { display: grid; grid-template-columns: minmax(150px, 230px) minmax(0, 1fr) auto; align-items: center; gap: 14px; font-size: 14px; }
.run-t { order: -1; }
.run-bar { height: 14px; width: calc(var(--n) * 12px); max-width: 100%; border-radius: 2px; background: var(--sunk); border: 1px solid var(--rule-2); }
.run.r-on .run-bar { background: var(--s); border-color: var(--s); }
.run.r-leave .run-bar { background: var(--lv); border-color: var(--lv); }
.run.r-holiday .run-bar { background: var(--hol); border-color: var(--hol); }

.cell-state { margin: 12px 0; padding: 12px 14px; border-radius: var(--r-s); background: var(--sunk); font-weight: 500; }
.cell-state.c-on { background: var(--s-soft); color: var(--s-ink); }
.cell-state.c-leave { background: var(--lv-soft); color: var(--lv); }
.cell-state.c-holiday { background: var(--hol-soft); color: var(--warn); }

/* ───────── النوافذ ───────── */
dialog { color: var(--ink); }
dialog::backdrop { background: rgba(18, 22, 20, .45); backdrop-filter: blur(1.5px); }
.modal { width: min(560px, calc(100vw - 24px)); max-height: calc(100vh - 32px); padding: 0; border: 1px solid var(--rule-2); border-radius: 8px; background: var(--card); box-shadow: 0 30px 60px -20px rgba(0, 0, 0, .4); }
.modal.wide { width: min(780px, calc(100vw - 24px)); }
.modal[open] { animation: rise .22s var(--ease); }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }
.modal form { display: flex; flex-direction: column; max-height: calc(100vh - 34px); }
.modal-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 18px 22px 10px; }
.modal-h h2 { font-size: 19px; }
.modal-intro { padding: 0 22px 8px; color: var(--ink-2); font-size: 14.5px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; padding: 10px 22px; overflow-y: auto; }
.field { display: grid; gap: 5px; align-content: start; min-width: 0; }
.field.full, .form-note { grid-column: 1 / -1; }
.field > label { font-size: 13.5px; color: var(--ink-2); font-weight: 500; }
.req { color: var(--b); margin-inline-start: 3px; font-weight: 400; }
.field input:not([type=checkbox]), .field select, .field textarea {
  width: 100%; min-height: 44px; padding: 9px 12px; border: 1px solid var(--rule-2); border-radius: var(--r-s);
  background: var(--paper); transition: border-color .15s, box-shadow .15s;
}
.field textarea { resize: vertical; line-height: 1.6; }
.field input:focus, .field select:focus, .field textarea:focus, .search:focus, .update-form textarea:focus, .planner-ctl input:focus, .planner-ctl select:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ink) 12%, transparent); }
.hint { font-size: 12.5px; color: var(--ink-3); }
.err { font-size: 12.5px; color: var(--bad); }
.form-note { font-size: 13px; color: var(--ink-2); background: var(--paper); border-radius: var(--r-s); padding: 8px 12px; }
.checks { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 14px; }
.check { display: inline-flex; align-items: center; gap: 9px; min-height: 36px; cursor: pointer; font-size: 14px; }
.check input { width: 18px; height: 18px; accent-color: var(--ink); flex: none; }
.preview:empty { display: none; }
.preview { padding: 4px 22px 0; }
.form-error { margin: 8px 22px 0; padding: 9px 12px; border-radius: var(--r-s); background: var(--bad-soft); color: var(--bad); font-size: 14px; }
.modal-f { display: flex; gap: 8px; padding: 16px 22px 20px; border-top: 1px solid var(--rule); margin-top: 12px; }

.drawer { position: fixed; inset-block: 0; inset-inline-end: 0; inset-inline-start: auto; margin: 0; height: 100%; max-height: 100%; width: min(500px, 100vw); max-width: 100vw; padding: 0; border: 0; border-inline-start: 1px solid var(--rule-2); background: var(--card); box-shadow: 0 0 60px -10px rgba(0, 0, 0, .35); }
.drawer.wide { width: min(680px, 100vw); }
.drawer[open] { animation: slide .26s var(--ease); }
@keyframes slide { from { transform: translateX(-24px); opacity: 0; } }
.drawer-in { height: 100%; overflow-y: auto; padding: 26px 26px 40px; position: relative; }
.drawer-in h2 { padding-inline-end: 40px; }
.drawer-x { position: absolute; top: 18px; inset-inline-end: 16px; z-index: 1; }
.drawer-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }

/* تهيئة أول مرة */
.setup { border-inline-start: 4px solid var(--a); }
.setup-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.setup-steps li { display: flex; align-items: center; gap: 14px; padding: 12px 0; border-top: 1px solid var(--rule); }
.setup-steps li:first-child { border-top: 0; }
.setup-steps li.done b { color: var(--ink-3); text-decoration: line-through; text-decoration-color: var(--rule); }
.setup-n { flex: none; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; background: var(--sunk); color: var(--ink); }
.setup-steps li.done .setup-n { background: var(--a); color: #fff; }
.setup-n .ic { width: 16px; height: 16px; }
.setup-hide { margin-top: 10px; font-size: 13.5px; background: none; border: 0; padding: 4px 0; cursor: pointer; color: var(--ink-3); }
.login-org { font-weight: 600; margin: -4px 0 6px; }

/* الشريط السفلي في الجوال */
.tabbar { display: none; }
.badge.dot { min-width: 9px; width: 9px; height: 9px; padding: 0; }

#toasts { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 1000; display: grid; gap: 8px; justify-items: center; pointer-events: none; }
.toast { background: var(--ink); color: var(--paper); padding: 10px 18px; border-radius: var(--r-s); font-size: 14.5px; box-shadow: 0 10px 30px -10px rgba(0, 0, 0, .5); animation: rise .2s var(--ease); transition: opacity .3s, transform .3s; max-width: min(520px, calc(100vw - 32px)); }
.toast.err { background: var(--bad); color: #fff; }
.toast.out { opacity: 0; transform: translateY(6px); }

/* ───────── الدخول ───────── */
.login { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(360px, .9fr); }
.login-art { background: #183F35; color: #F3EFE6; padding: clamp(28px, 6vw, 72px); display: flex; flex-direction: column; justify-content: center; gap: 22px; position: relative; overflow: hidden; }
.login-word { font-family: var(--f-display); font-weight: 800; font-size: clamp(40px, calc(13vw * 6 / max(6, var(--len, 4))), 176px); line-height: 1.05; overflow-wrap: anywhere; }
.login-line { font-size: clamp(16px, 1.5vw, 19px); max-width: 30ch; color: #CFE0D7; }
.login-strip { display: grid; grid-template-columns: repeat(56, minmax(0, 1fr)); gap: 3px; margin-top: 18px; max-width: 640px; }
.login-strip i { height: 54px; border-radius: 1px; }
.login-strip i.s-A { background: #6DB59B; }
.login-strip i.s-B { background: #E38B6B; }
.login-strip i.t { box-shadow: 0 0 0 2px #183F35, 0 0 0 4px #F3EFE6; }
.login-legend { display: flex; gap: 18px; font-size: 13.5px; color: #CFE0D7; }
.login-legend span { display: inline-flex; gap: 7px; align-items: center; }
.login-legend i { width: 12px; height: 12px; border-radius: 2px; }
.login-legend .s-A { background: #6DB59B; } .login-legend .s-B { background: #E38B6B; }
.login-form { display: grid; place-items: center; padding: 32px 20px; background: var(--paper); }
.login-form form { width: min(360px, 100%); display: grid; gap: 16px; }
.login-form h1 { font-size: 26px; }
.login-form .field input { min-height: 48px; font-size: 16px; }
.login-form .form-error { margin: 0; }

/* ───────── الوضع الداكن: نصوص النوبات بلون النوبة نفسه ───────── */
:root[data-theme="dark"] :is(.now strong, .stag, .strip-name, .cd-shift, .cell-state.c-on, .now-mini, .sheet tr.grp th.nm span, .ls-approved, .ps-approved, .sw-approved) { color: var(--s, var(--a)); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) :is(.now strong, .stag, .strip-name, .cd-shift, .cell-state.c-on, .now-mini, .sheet tr.grp th.nm span, .ls-approved, .ps-approved, .sw-approved) { color: var(--s, var(--a)); }
}
:root[data-theme="dark"] .stag.both { color: var(--ink-2); }

/* ───────── الشاشات الأصغر ───────── */
@media (max-width: 1180px) {
  .events-layout { grid-template-columns: 1fr; }
  .board.cols-3 { grid-template-columns: 1fr; }
  .col { border-inline-end: 0; border-bottom: 1px solid var(--rule); }
  .col-b { min-height: 0; }
  .permits-grid { grid-template-columns: 1fr; }
}
@media (max-width: 1000px) {
  .app { grid-template-columns: 1fr; }
  .rail { position: fixed; inset-block: 0; inset-inline-start: 0; z-index: 50; width: min(300px, 86vw); transform: translateX(110%); transition: transform .25s var(--ease); box-shadow: 0 0 40px rgba(0, 0, 0, .25); }
  .menu-open .rail { transform: none; }
  .menu-open .scrim { display: block; position: fixed; inset: 0; z-index: 40; background: rgba(18, 22, 20, .4); }
  .rail .rail-x { display: inline-grid; }
  .topbar { display: flex; align-items: center; gap: 10px; position: sticky; top: 0; z-index: 20; background: var(--paper); margin: -28px calc(-1 * clamp(16px, 3vw, 40px)) 18px; padding: 10px clamp(16px, 3vw, 40px); border-bottom: 1px solid var(--rule); }
  .topbar .icon-btn { width: 44px; height: 44px; }
  .topbar .word { font-size: 22px; }
  .now-mini { margin-inline-start: auto; font-size: 12.5px; padding: 4px 10px; border-radius: 12px; background: var(--s-soft); color: var(--s-ink); white-space: nowrap; }
  .g-2 { grid-template-columns: 1fr; }
  .status { grid-template-columns: 1fr; }
  .tabbar { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; inset-inline: 0; bottom: 0; z-index: 30; background: var(--card); border-top: 1px solid var(--rule); padding: 4px 4px calc(4px + env(safe-area-inset-bottom)); box-shadow: 0 -8px 24px -18px rgba(0, 0, 0, .35); }
  .tab-i { position: relative; display: grid; justify-items: center; gap: 2px; min-height: 54px; padding: 7px 2px 5px; border: 0; background: none; color: var(--ink-3); font: 500 12px/1.2 var(--f-body); text-decoration: none; border-radius: var(--r-s); cursor: pointer; }
  .tab-i .ic { width: 22px; height: 22px; }
  .tab-i.on { color: var(--ink); font-weight: 700; }
  .tab-i.on .ic { color: var(--a); }
  .tab-i .badge { position: absolute; top: 3px; inset-inline-start: calc(50% + 6px); height: 18px; min-width: 18px; line-height: 18px; font-size: 11px; padding: 0 5px; }
  .tab-i .badge.dot { height: 9px; min-width: 9px; top: 7px; }
  .main { padding-bottom: calc(88px + env(safe-area-inset-bottom)); }
  #toasts { bottom: calc(80px + env(safe-area-inset-bottom)); }
}
@media (max-width: 720px) {
  .phead { align-items: flex-start; }
  .actions { width: 100%; }
  .actions .btn { flex: 1 1 auto; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .panel { padding: 16px; }
  .panel.flush > .panel-h, .toolbar { padding-inline: 16px; }
  .status { padding: 20px 18px 18px; }
  .status-quick .btn { flex: 1 1 140px; }
  .strip-row, .strip-marks { grid-template-columns: 1fr; gap: 4px; }
  .strip-marks .strip-name { display: none; }
  .strip-cells i { height: 20px; }
  .tbl.stack thead { display: none; }
  .tbl.stack tr { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 12px; padding: 14px 16px; border-bottom: 1px solid var(--rule); }
  .tbl.stack tbody tr:last-child { border-bottom: 0; }
  .tbl.stack td, .tbl.stack tbody th { display: block; padding: 0; border: 0; font-size: 14px; white-space: normal; }
  .tbl.stack td[data-label]::before { content: attr(data-label); display: block; font-size: 11.5px; color: var(--ink-3); }
  .tbl.stack td:first-child, .tbl.stack tbody th:first-child { grid-column: 1 / -1; font-size: 15px; }
  .tbl.stack td:first-child::before { display: none; }
  .tbl.stack td.acts { grid-column: 1 / -1; text-align: start !important; display: flex; flex-wrap: wrap; gap: 6px; padding-top: 4px; }
  .tbl.stack td.acts > * + * { margin: 0; }
  .tbl.stack .icon-btn { border: 1px solid var(--rule); }
  .icon-btn { width: 44px; height: 44px; }
  .chip { min-height: 40px; }
  .btn-s { min-height: 40px; }
  .form-grid { grid-template-columns: 1fr; padding: 10px 18px; }
  .checks { grid-template-columns: 1fr; }
  .modal-h, .modal-intro, .modal-f, .preview { padding-inline: 18px; }
  .form-error { margin-inline: 18px; }
  .modal-f .btn { flex: 1; }
  .modal, .modal.wide { width: 100vw; max-width: 100vw; max-height: 92dvh; margin: auto 0 0; border-radius: 12px 12px 0 0; }
  .modal form { max-height: 92dvh; }
  .drawer-in { padding: 20px 18px 40px; }
  .cal-h { padding: 6px 4px; text-align: center; }
  .cal-h .long { display: none; } .cal-h .short { display: inline; }
  .cal-d { min-height: 64px; padding: 5px; }
  .cd-ev, .cd-lv, .cd-shift { display: none; }
  .cal-d.h .cd-top b { color: var(--warn); }
  .cd-top { flex-direction: column; align-items: flex-start; gap: 0; }
  .kv > div { grid-template-columns: 1fr; gap: 2px; }
  .kv.cols { grid-template-columns: 1fr; }
  .bars li { grid-template-columns: 1fr auto; }
  .bars li .b-track { grid-column: 1 / -1; grid-row: 2; }
  .run { grid-template-columns: 1fr auto; }
  .run .run-bar { grid-column: 1 / -1; }
  .login { grid-template-columns: 1fr; }
  .login-art { padding: 36px 20px 30px; gap: 12px; }
  .login-strip i { height: 30px; }
  .sheet-wrap { max-height: 70vh; }
  .sheet th.nm { min-width: 104px; max-width: 120px; padding: 5px 8px; }
  .sheet th.nm span { font-size: 12.5px; }
  .sheet tr.grp th.nm { padding: 7px 8px; }
  .sheet tr.grp th.nm small { display: none; }
  .notice { flex-direction: column; }
  .notice-a { flex-direction: row; align-items: center; }
  .month-nav strong { min-width: 110px; }
  .uf-row { flex-direction: column; }
  .bchart { gap: 3px; }
  .ev-month { padding: 0 16px; }
}
@media (max-width: 380px) {
  .kpis.inner { grid-template-columns: 1fr 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}

/* ───────── الطباعة ───────── */
@media print {
  @page { size: A4 landscape; margin: 10mm; }
  body { background: #fff; color: #000; font-size: 11px; }
  .rail, .topbar, .tabbar, .scrim, .actions, .tabs, .no-print, .phead, #toasts, .skip, .toolbar { display: none !important; }
  .app { display: block; }
  .main { padding: 0; max-width: none; }
  .panel { box-shadow: none; border: 0; padding: 0; }
  .print-title { display: block; font-family: var(--f-display); font-size: 16px; margin-bottom: 8px; }
  .sheet-wrap { overflow: visible; max-height: none; }
  .sheet { font-size: 9px; width: 100%; }
  .sheet th.d, .sheet td.c { width: auto; min-width: 0; height: 20px; }
  .sheet th.nm { position: static; min-width: 110px; }
  .sheet thead th { position: static; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .tbl-wrap { overflow: visible; }
  .bchart, .chart { break-inside: avoid; }
}
.topbar .word { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brand .word { overflow-wrap: anywhere; }
@media (max-width: 720px) {
  .setup-steps li { flex-wrap: wrap; }
  .setup-steps li .grow { flex: 1 1 calc(100% - 50px); }
  .setup-steps li > .btn, .setup-steps li > span.muted:last-child { margin-inline-start: 44px; }
}
