/* نظام التصميم — «إدارة الأطباء فنيًا وإداريًا»
   Layout: قائمة جانبية يمنى على الحاسوب + شريط سفلي على الجوال؛ محتوى بأعمدة مرنة وجداول قابلة للتمرير الأفقي داخل حاوياتها. */
:root {
  --bg: #ffffff;
  --surface: #ffffff;
  --surface-2: #f4f8f8;
  --surface-3: #e9f1f1;
  --line: #dbe6e6;
  --line-strong: #c3d4d4;
  --fg: #12302f;
  --fg-2: #3f5a59;
  --fg-3: #6b8382;
  --teal-900: #063f3d;
  --teal-700: #0b6e69;
  --teal-600: #0e8079;
  --teal-500: #14958c;
  --teal-100: #d5efec;
  --teal-50: #ecf7f6;
  --gold: #a67c1f;
  --gold-soft: #f6eedb;
  --ok: #1d7a46; --ok-bg: #e5f4ea;
  --warn: #9a6200; --warn-bg: #fdf1d8;
  --bad: #b3261e; --bad-bg: #fce8e6;
  --info: #1f5fbf; --info-bg: #e7effb;
  --muted: #5f7271; --muted-bg: #eef2f2;
  --focus: #14958c;
  --shadow: 0 1px 2px rgba(6, 63, 61, .06), 0 4px 16px rgba(6, 63, 61, .06);
  --shadow-lg: 0 10px 40px rgba(6, 63, 61, .18);
  --radius: 10px; --radius-sm: 7px;
  --font-body: "IBM Plex Sans Arabic", "Segoe UI", Tahoma, "Noto Sans Arabic", system-ui, sans-serif;
  --font-display: "Noto Kufi Arabic", "IBM Plex Sans Arabic", "Segoe UI", Tahoma, sans-serif;
  --fs-xs: .75rem; --fs-sm: .8125rem; --fs-md: .9375rem; --fs-lg: 1.0625rem; --fs-xl: 1.3rem; --fs-2xl: 1.65rem;
  --side-w: 268px;
  --tap: 44px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0c1716; --surface: #112120; --surface-2: #15292827; --surface-2: #162a29; --surface-3: #1c3433; --line: #24403e; --line-strong: #2f5250;
    --fg: #e4f1f0; --fg-2: #b4cbca; --fg-3: #85a09f; --teal-900: #b9ebe6; --teal-700: #5cc9bf; --teal-600: #48bdb2; --teal-500: #3fb0a5; --teal-100: #1a3f3c; --teal-50: #142e2c;
    --gold: #d9b45e; --gold-soft: #3a3020; --ok: #6fd39a; --ok-bg: #173526; --warn: #f0c060; --warn-bg: #3a2e14; --bad: #ff8f86; --bad-bg: #3d1a18; --info: #8ab8ff; --info-bg: #182a45; --muted: #a2b5b4; --muted-bg: #1d2f2e;
    --shadow: 0 1px 2px rgba(0,0,0,.3); --shadow-lg: 0 10px 40px rgba(0,0,0,.5); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0c1716; --surface: #112120; --surface-2: #162a29; --surface-3: #1c3433; --line: #24403e; --line-strong: #2f5250;
  --fg: #e4f1f0; --fg-2: #b4cbca; --fg-3: #85a09f; --teal-900: #b9ebe6; --teal-700: #5cc9bf; --teal-600: #48bdb2; --teal-500: #3fb0a5; --teal-100: #1a3f3c; --teal-50: #142e2c;
  --gold: #d9b45e; --gold-soft: #3a3020; --ok: #6fd39a; --ok-bg: #173526; --warn: #f0c060; --warn-bg: #3a2e14; --bad: #ff8f86; --bad-bg: #3d1a18; --info: #8ab8ff; --info-bg: #182a45; --muted: #a2b5b4; --muted-bg: #1d2f2e;
  --shadow: 0 1px 2px rgba(0,0,0,.3); --shadow-lg: 0 10px 40px rgba(0,0,0,.5); color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { background: var(--bg); color: var(--fg); font-family: var(--font-body); font-size: var(--fs-md); line-height: 1.6; margin: 0; -webkit-font-smoothing: antialiased; }
#root { min-height: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--teal-700); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
h1, h2, h3, h4 { font-family: var(--font-display); text-wrap: balance; margin: 0; color: var(--teal-900); font-weight: 600; }
h1 { font-size: var(--fs-2xl); line-height: 1.3; }
h2 { font-size: var(--fs-xl); line-height: 1.35; }
h3 { font-size: var(--fs-lg); }
h4 { font-size: var(--fs-md); }
p { margin: 0; }
.num, .tabnum, td { font-variant-numeric: tabular-nums; }
.ltr { direction: ltr; unicode-bidi: isolate; display: inline-block; }
.muted { color: var(--fg-3); }
.small { font-size: var(--fs-sm); }
.xs { font-size: var(--fs-xs); }
.eyebrow { font-size: var(--fs-xs); letter-spacing: .02em; color: var(--fg-3); font-weight: 500; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ===== الهيكل ===== */
.shell { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); min-height: 100vh; }
.side { position: sticky; top: env(safe-area-inset-top, 0px); height: 100vh; overflow-y: auto; border-inline-start: 1px solid var(--line); background: var(--surface-2); padding-block: 14px 24px; display: flex; flex-direction: column; gap: 4px; }
.brand { display: flex; gap: 10px; align-items: center; padding: 6px 16px 14px; border-bottom: 1px solid var(--line); margin-bottom: 8px; }
.logo-slot { width: 44px; height: 44px; border-radius: 10px; border: 1.5px dashed var(--gold); display: grid; place-items: center; color: var(--gold); font-size: 10px; text-align: center; line-height: 1.1; flex: none; background: var(--gold-soft); }
.brand-t { font-family: var(--font-display); font-weight: 700; color: var(--teal-900); font-size: .95rem; line-height: 1.35; }
.brand-s { font-size: var(--fs-xs); color: var(--fg-3); line-height: 1.3; }
.nav-group { padding: 10px 16px 2px; font-size: var(--fs-xs); color: var(--fg-3); font-weight: 600; }
.nav-item { display: flex; align-items: center; gap: 10px; margin-inline: 8px; padding: 8px 10px; min-height: 38px; border-radius: 8px; border: 0; background: transparent; cursor: pointer; text-align: start; color: var(--fg-2); font-size: var(--fs-sm); position: relative; }
.nav-item:hover { background: var(--surface-3); color: var(--fg); }
.nav-item.active { background: var(--teal-50); color: var(--teal-700); font-weight: 600; }
.nav-item.active::before { content: ""; position: absolute; inset-inline-start: -8px; top: 8px; bottom: 8px; width: 3px; border-radius: 3px; background: var(--gold); }
.nav-item .count { margin-inline-start: auto; font-size: var(--fs-xs); background: var(--bad-bg); color: var(--bad); border-radius: 999px; padding: 0 7px; font-weight: 600; }
.nav-item .stage { margin-inline-start: auto; font-size: 10px; color: var(--fg-3); border: 1px solid var(--line); border-radius: 4px; padding: 0 4px; }
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20; background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 10px; padding: 10px 24px; min-height: 60px; flex-wrap: wrap; }
.topbar .grow { flex: 1; min-width: 0; }
.crumbs { display: flex; gap: 6px; align-items: center; font-size: var(--fs-sm); color: var(--fg-3); min-width: 0; flex-wrap: wrap; }
.crumbs button { background: none; border: 0; padding: 0; cursor: pointer; color: var(--teal-700); }
.content { padding: 20px 24px 40px; max-width: 1360px; width: 100%; margin-inline: auto; display: flex; flex-direction: column; gap: 18px; }
.page-head { display: flex; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.page-head .grow { flex: 1 1 260px; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }

.mob-top, .bottom-nav { display: none; }
@media (max-width: 1023px) {
  .shell { display: block; }
  .side { display: none; }
  .topbar { display: none; }
  .mob-top { display: flex; position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20; background: var(--bg); border-bottom: 1px solid var(--line); padding: 8px 16px; gap: 10px; align-items: center; min-height: 56px; }
  .mob-top .t { font-family: var(--font-display); font-weight: 600; color: var(--teal-900); font-size: 1rem; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .content { padding: 14px 16px calc(88px + env(safe-area-inset-bottom, 0px)); gap: 14px; }
  .bottom-nav { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; bottom: 0; inset-inline: 0; z-index: 30; background: var(--surface); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom, 0px); box-shadow: 0 -4px 20px rgba(6, 63, 61, .06); }
  .bottom-nav button { background: none; border: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 60px; font-size: 11px; color: var(--fg-3); cursor: pointer; position: relative; }
  .bottom-nav button.active { color: var(--teal-700); font-weight: 600; }
  .bottom-nav button.active::after { content: ""; position: absolute; top: 0; width: 28px; height: 3px; border-radius: 0 0 3px 3px; background: var(--gold); }
  .bottom-nav .dot { position: absolute; top: 8px; inset-inline-end: calc(50% - 18px); min-width: 16px; height: 16px; border-radius: 8px; background: var(--bad); color: #fff; font-size: 10px; display: grid; place-items: center; padding: 0 4px; }
  h1 { font-size: 1.35rem; }
}

/* ===== المكونات ===== */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: var(--tap); padding: 0 16px; border-radius: 9px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--fg); cursor: pointer; font-weight: 500; font-size: var(--fs-sm); white-space: nowrap; transition: background .15s, border-color .15s; }
.btn:hover:not(:disabled) { background: var(--surface-2); border-color: var(--teal-500); }
.btn.primary { background: var(--teal-700); border-color: var(--teal-700); color: #fff; }
.btn.primary:hover:not(:disabled) { background: var(--teal-600); }
.btn.gold { background: var(--gold-soft); border-color: var(--gold); color: var(--gold); }
.btn.danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 40%, var(--line)); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--teal-700); }
.btn.ghost:hover:not(:disabled) { background: var(--teal-50); }
.btn.sm { min-height: 34px; padding: 0 10px; font-size: var(--fs-xs); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-reason { font-size: var(--fs-xs); color: var(--fg-3); display: flex; gap: 4px; align-items: center; }
.icon-btn { width: var(--tap); height: var(--tap); display: grid; place-items: center; border-radius: 9px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; color: var(--fg-2); flex: none; }
.icon-btn:hover { border-color: var(--teal-500); color: var(--teal-700); }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.card.pad { padding: 16px; }
.card.raised { box-shadow: var(--shadow); }
.section { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.section-h { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.section-h .grow { flex: 1; min-width: 0; }
.grid { display: grid; gap: 14px; }
.g2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr)); }
.g3 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); }
.g4 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 190px), 1fr)); }
.split { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 16px; align-items: start; }
@media (max-width: 1100px) { .split { grid-template-columns: minmax(0, 1fr); } }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; min-width: 0; }
.row.between { justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.stack.lg { gap: 14px; }
.divider { height: 1px; background: var(--line); margin-block: 4px; }

.status { display: inline-flex; align-items: center; gap: 5px; font-size: var(--fs-xs); font-weight: 600; padding: 2px 9px 2px 8px; border-radius: 999px; white-space: nowrap; line-height: 1.6; border: 1px solid transparent; }
.status svg { flex: none; }
.t-ok { color: var(--ok); background: var(--ok-bg); }
.t-warn { color: var(--warn); background: var(--warn-bg); }
.t-bad { color: var(--bad); background: var(--bad-bg); }
.t-info { color: var(--info); background: var(--info-bg); }
.t-muted { color: var(--muted); background: var(--muted-bg); }
.t-gold { color: var(--gold); background: var(--gold-soft); }
.chip { display: inline-flex; align-items: center; gap: 4px; font-size: var(--fs-xs); padding: 1px 8px; border-radius: 6px; background: var(--surface-3); color: var(--fg-2); white-space: nowrap; }
.tag-syn { font-size: 10px; font-weight: 700; color: var(--gold); border: 1px solid var(--gold); border-radius: 4px; padding: 0 5px; white-space: nowrap; }

.kpi { padding: 14px 16px; display: flex; flex-direction: column; gap: 4px; position: relative; min-width: 0; }
.kpi .v { font-family: var(--font-display); font-size: 1.75rem; font-weight: 700; color: var(--teal-900); line-height: 1.2; font-variant-numeric: tabular-nums; }
.kpi .l { font-size: var(--fs-sm); color: var(--fg-2); }
.kpi .s { font-size: var(--fs-xs); color: var(--fg-3); }
.kpi.button { cursor: pointer; text-align: start; border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius); font: inherit; color: inherit; }
.kpi.button:hover { border-color: var(--teal-500); }
.kpi .stripe { position: absolute; inset-inline-start: 0; top: 12px; bottom: 12px; width: 3px; border-radius: 3px; }

.follow { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 4px 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); cursor: pointer; text-align: start; font: inherit; color: inherit; width: 100%; position: relative; overflow: hidden; }
.follow:hover { border-color: var(--teal-500); box-shadow: var(--shadow); }
.follow .sev { grid-row: span 3; width: 4px; border-radius: 4px; align-self: stretch; }
.follow .sev.bad { background: var(--bad); } .follow .sev.warn { background: var(--warn); } .follow .sev.info { background: var(--info); }
.follow .ttl { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-weight: 600; color: var(--fg); }
.follow .meta { display: flex; gap: 6px 14px; flex-wrap: wrap; font-size: var(--fs-xs); color: var(--fg-3); }
.follow .meta b { color: var(--fg-2); font-weight: 600; }
.follow .act { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: var(--fs-sm); color: var(--teal-700); font-weight: 600; flex-wrap: wrap; }

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { background: none; border: 0; padding: 10px 14px; min-height: var(--tap); cursor: pointer; color: var(--fg-3); font-size: var(--fs-sm); border-bottom: 2.5px solid transparent; white-space: nowrap; font-weight: 500; }
.tab:hover { color: var(--fg); }
.tab.active { color: var(--teal-700); border-bottom-color: var(--teal-700); font-weight: 600; }
.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 9px; overflow: hidden; }
.seg button { border: 0; background: var(--surface); padding: 0 12px; min-height: 36px; cursor: pointer; font-size: var(--fs-sm); color: var(--fg-2); }
.seg button + button { border-inline-start: 1px solid var(--line); }
.seg button.on { background: var(--teal-700); color: #fff; }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
table.t { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
table.t th { position: sticky; top: 0; background: var(--surface-2); text-align: start; font-weight: 600; color: var(--fg-2); padding: 9px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; font-size: var(--fs-xs); }
table.t td { padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.t tr:last-child td { border-bottom: 0; }
table.t tbody tr.click { cursor: pointer; }
table.t tbody tr.click:hover { background: var(--teal-50); }
table.t td.nowrap { white-space: nowrap; }
.cards-list { display: flex; flex-direction: column; gap: 8px; }
.only-desk { display: block; } .only-mob { display: none; }
@media (max-width: 1023px) { .only-desk { display: none !important; } .only-mob { display: block; } }

.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field label { font-size: var(--fs-xs); font-weight: 600; color: var(--fg-2); }
.field .hint { font-size: var(--fs-xs); color: var(--fg-3); }
.input, .select, textarea.input { min-height: var(--tap); border: 1px solid var(--line-strong); border-radius: 9px; padding: 0 12px; background: var(--surface); width: 100%; min-width: 0; }
textarea.input { padding: 10px 12px; min-height: 84px; resize: vertical; }
.input:focus, .select:focus { outline: 2px solid var(--focus); outline-offset: -1px; border-color: transparent; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.filters .select { width: auto; min-width: 130px; max-width: 220px; min-height: 38px; font-size: var(--fs-sm); }
.search { position: relative; flex: 1 1 240px; min-width: 0; }
.search .input { padding-inline-start: 38px; }
.search svg { position: absolute; inset-inline-start: 12px; top: 50%; transform: translateY(-50%); color: var(--fg-3); }

.kv { display: grid; grid-template-columns: minmax(120px, 38%) minmax(0, 1fr); gap: 0; font-size: var(--fs-sm); }
.kv > div { padding: 8px 0; border-bottom: 1px dashed var(--line); min-width: 0; overflow-wrap: anywhere; }
.kv > .k { color: var(--fg-3); padding-inline-end: 10px; }
.kv > .v { color: var(--fg); }
.compare { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr)); gap: 10px; }
.compare .cell { border: 1px solid var(--line); border-radius: 9px; padding: 10px 12px; background: var(--surface-2); display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.compare .cell .h { font-size: var(--fs-xs); color: var(--fg-3); }
.compare .cell .x { font-weight: 600; color: var(--fg); overflow-wrap: anywhere; }

.prov { display: inline-flex; gap: 6px; align-items: center; flex-wrap: wrap; font-size: 11px; color: var(--fg-3); }
.prov .src { border-bottom: 1px dotted var(--fg-3); cursor: help; }

.empty, .state { text-align: center; padding: 34px 16px; display: flex; flex-direction: column; align-items: center; gap: 8px; color: var(--fg-2); }
.state .ico { width: 54px; height: 54px; border-radius: 16px; display: grid; place-items: center; background: var(--surface-3); color: var(--fg-3); }
.state.bad .ico { background: var(--bad-bg); color: var(--bad); }
.state.lock .ico { background: var(--gold-soft); color: var(--gold); }
.state.ok .ico { background: var(--ok-bg); color: var(--ok); }
.state h3 { color: var(--fg); }
.state p { max-width: 52ch; font-size: var(--fs-sm); color: var(--fg-3); }
.skel { background: linear-gradient(90deg, var(--surface-3), var(--surface-2), var(--surface-3)); background-size: 200% 100%; animation: sk 1.2s infinite linear; border-radius: 8px; }
@keyframes sk { to { background-position: -200% 0; } }

.banner { display: flex; gap: 10px; align-items: flex-start; padding: 10px 14px; border-radius: var(--radius); font-size: var(--fs-sm); border: 1px solid transparent; }
.banner .grow { flex: 1; min-width: 0; }
.banner.info { background: var(--info-bg); color: var(--info); }
.banner.warn { background: var(--warn-bg); color: var(--warn); }
.banner.bad { background: var(--bad-bg); color: var(--bad); }
.banner.ok { background: var(--ok-bg); color: var(--ok); }
.banner.gold { background: var(--gold-soft); color: var(--fg); border-color: color-mix(in srgb, var(--gold) 40%, transparent); }
.banner b { font-weight: 700; }
.offline { position: sticky; top: 0; z-index: 40; background: var(--warn-bg); color: var(--warn); font-size: var(--fs-sm); padding: 6px 16px; display: flex; gap: 8px; align-items: center; justify-content: center; flex-wrap: wrap; }

.overlay { position: fixed; inset: 0; background: rgba(6, 30, 29, .45); z-index: 60; display: flex; align-items: center; justify-content: center; padding: 16px; animation: fade .15s; }
.modal { background: var(--surface); border-radius: 14px; width: min(640px, 100%); max-height: min(88vh, 900px); display: flex; flex-direction: column; box-shadow: var(--shadow-lg); }
.modal.wide { width: min(980px, 100%); }
.modal-h { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.modal-h h3 { flex: 1; min-width: 0; }
.modal-b { padding: 16px 18px; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; }
.modal-f { padding: 12px 18px; border-top: 1px solid var(--line); display: flex; gap: 8px; justify-content: flex-start; flex-wrap: wrap; }
@media (max-width: 720px) {
  .overlay { align-items: flex-end; padding: 0; }
  .modal, .modal.wide { width: 100%; max-height: 92vh; border-radius: 16px 16px 0 0; padding-bottom: env(safe-area-inset-bottom, 0px); animation: up .2s; }
}
@keyframes fade { from { opacity: 0; } }
@keyframes up { from { transform: translateY(30px); } }
.toast-wrap { position: fixed; z-index: 80; inset-inline: 0; bottom: 20px; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; padding: 0 16px; }
@media (max-width: 1023px) { .toast-wrap { bottom: calc(76px + env(safe-area-inset-bottom, 0px)); } }
.toast { pointer-events: auto; background: var(--teal-900); color: var(--bg); padding: 10px 16px; border-radius: 10px; box-shadow: var(--shadow-lg); font-size: var(--fs-sm); display: flex; gap: 8px; align-items: center; max-width: 560px; }
.toast.bad { background: var(--bad); color: #fff; }

.steps { display: flex; flex-direction: column; gap: 0; }
.step { display: grid; grid-template-columns: 30px minmax(0, 1fr); gap: 10px; position: relative; padding-bottom: 14px; }
.step:not(:last-child)::before { content: ""; position: absolute; inset-inline-start: 14px; top: 28px; bottom: 0; width: 2px; background: var(--line); }
.step.done:not(:last-child)::before { background: var(--teal-500); }
.step .b { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; border: 2px solid var(--line-strong); background: var(--surface); color: var(--fg-3); font-size: var(--fs-xs); font-weight: 700; z-index: 1; }
.step.done .b { background: var(--teal-700); border-color: var(--teal-700); color: #fff; }
.step.cur .b { border-color: var(--gold); color: var(--gold); background: var(--gold-soft); }
.step .c { padding-top: 3px; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.step .c .n { font-weight: 600; font-size: var(--fs-sm); }
.timeline { display: flex; flex-direction: column; gap: 10px; }
.tl { display: grid; grid-template-columns: 10px minmax(0, 1fr); gap: 10px; font-size: var(--fs-sm); }
.tl .d { width: 8px; height: 8px; border-radius: 50%; background: var(--teal-500); margin-top: 7px; }

.avatar { width: 40px; height: 40px; border-radius: 12px; background: var(--teal-100); color: var(--teal-700); display: grid; place-items: center; font-weight: 700; font-family: var(--font-display); flex: none; font-size: .95rem; }
.avatar.lg { width: 64px; height: 64px; border-radius: 18px; font-size: 1.4rem; }
.doc-card { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 10px 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); cursor: pointer; text-align: start; font: inherit; color: inherit; width: 100%; }
.doc-card:hover { border-color: var(--teal-500); }
.doc-card .n { font-weight: 600; color: var(--fg); }
.doc-card .m { font-size: var(--fs-xs); color: var(--fg-3); display: flex; gap: 4px 10px; flex-wrap: wrap; }

.bar { height: 8px; background: var(--surface-3); border-radius: 6px; overflow: hidden; display: flex; }
.bar > i { display: block; height: 100%; background: var(--teal-600); }
.bar > i.warn { background: var(--warn); } .bar > i.bad { background: var(--bad); } .bar > i.ok { background: var(--ok); } .bar > i.muted { background: var(--line-strong); }
.hbars { display: flex; flex-direction: column; gap: 8px; }
.hbar { display: grid; grid-template-columns: minmax(90px, 30%) minmax(0, 1fr) auto; gap: 10px; align-items: center; font-size: var(--fs-sm); }
.hbar .lbl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--fg-2); }
.hbar .val { font-variant-numeric: tabular-nums; color: var(--fg); font-weight: 600; min-width: 3ch; text-align: end; }

/* شبكة الجدول الأسبوعي */
.week { display: grid; grid-template-columns: 76px repeat(7, minmax(118px, 1fr)); gap: 4px; min-width: 900px; }
.week .hd { font-size: var(--fs-xs); color: var(--fg-3); padding: 6px; text-align: center; font-weight: 600; }
.week .hd.today { color: var(--teal-700); }
.week .lane { font-size: var(--fs-xs); color: var(--fg-2); padding: 8px 4px; display: flex; flex-direction: column; justify-content: center; font-weight: 600; }
.shift { border: 1px solid var(--line); border-radius: 8px; padding: 6px 7px; background: var(--surface); cursor: pointer; text-align: start; font: inherit; color: inherit; display: flex; flex-direction: column; gap: 4px; min-height: 84px; font-size: var(--fs-xs); position: relative; }
.shift:hover { border-color: var(--teal-500); box-shadow: var(--shadow); }
.shift.safe { border-inline-start: 3px solid var(--ok); }
.shift.countOnly { border-inline-start: 3px solid var(--warn); background: color-mix(in srgb, var(--warn-bg) 45%, var(--surface)); }
.shift.short { border-inline-start: 3px solid var(--bad); background: color-mix(in srgb, var(--bad-bg) 45%, var(--surface)); }
.shift .names { display: flex; flex-direction: column; gap: 1px; color: var(--fg-2); }
.shift .names span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lv { display: inline-block; font-size: 9.5px; font-weight: 700; border-radius: 4px; padding: 0 4px; margin-inline-end: 3px; }
.lv-consultant { background: var(--teal-700); color: #fff; } .lv-senior { background: var(--teal-100); color: var(--teal-700); } .lv-junior { background: var(--info-bg); color: var(--info); } .lv-gp { background: var(--muted-bg); color: var(--muted); }
.month { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.month .d { border: 1px solid var(--line); border-radius: 8px; min-height: 64px; padding: 4px 6px; font-size: 11px; display: flex; flex-direction: column; gap: 2px; background: var(--surface); }
.month .d.out { opacity: .4; }
.month .d .dots { display: flex; gap: 3px; flex-wrap: wrap; }
.month .d .dots i { width: 8px; height: 8px; border-radius: 2px; display: block; }

.matrix td.c { text-align: center; font-size: 11px; white-space: nowrap; }
.mx { display: inline-flex; gap: 2px; }
.mx span { min-width: 18px; padding: 0 3px; border-radius: 4px; font-weight: 700; font-size: 10px; background: var(--teal-50); color: var(--teal-700); }
.scope-chip { font-size: var(--fs-xs); background: var(--gold-soft); color: var(--gold); border-radius: 6px; padding: 2px 8px; font-weight: 600; }
.role-pill { display: inline-flex; align-items: center; gap: 8px; padding: 4px 6px 4px 12px; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--surface); cursor: pointer; min-height: 40px; max-width: 100%; }
.role-pill .rn { font-size: var(--fs-sm); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 200px; }
.role-pill .rr { font-size: 11px; color: var(--fg-3); white-space: nowrap; }
.drop { border: 2px dashed var(--line-strong); border-radius: 14px; padding: 26px 16px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 10px; background: var(--surface-2); }
.drop.on { border-color: var(--teal-500); background: var(--teal-50); }
.code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; background: var(--surface-3); padding: 1px 5px; border-radius: 4px; direction: ltr; unicode-bidi: isolate; }
.prose { max-width: 75ch; display: flex; flex-direction: column; gap: 10px; font-size: var(--fs-sm); color: var(--fg-2); }
.prose ul { margin: 0; padding-inline-start: 20px; display: flex; flex-direction: column; gap: 4px; }
details.acc { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
details.acc > summary { cursor: pointer; padding: 12px 14px; font-weight: 600; list-style: none; display: flex; gap: 8px; align-items: center; }
details.acc > summary::-webkit-details-marker { display: none; }
details.acc[open] > summary { border-bottom: 1px solid var(--line); }
details.acc > .b { padding: 12px 14px; }
/* حماية من التمدد الأفقي على الشاشات الضيقة */
.page-head .actions { min-width: 0; max-width: 100%; }
.page-head .actions > * { max-width: 100%; }
select.select { max-width: 100%; text-overflow: ellipsis; }
.page-head .actions .select { width: auto; }
.main { overflow-x: clip; }
.kv > .v .prov { display: inline-flex; }
@media (max-width: 720px) {
  .g4 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr)); gap: 10px; }
  .kpi { padding: 12px; }
  .kpi .v { font-size: 1.4rem; }
  .page-head .actions .btn { min-height: 40px; padding: 0 12px; }
}
.filters-extra { display: contents; }
@media (max-width: 1023px) {
  .filters-extra { display: none; width: 100%; gap: 8px; flex-wrap: wrap; }
  .filters-extra.open { display: flex; }
  .filters-extra .select { flex: 1 1 140px; max-width: none; }
}
.compare:has(> .cell:nth-child(6)) { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.compare:has(> .cell:nth-child(4)):not(:has(> .cell:nth-child(5))) { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 720px) { .compare:has(> .cell:nth-child(4)) { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.seg button { white-space: nowrap; }
