/* Beyhas — Laboratory Intelligence Platform · prototype styles
   Layout: fixed navy sidebar + sticky header; content is a 12-col grid of cards.
   Deliberately light-only (brief: avoid heavy dark dashboards). */
:root {
  color-scheme: light;
  --navy: #0d1f3c;
  --navy-2: #16305a;
  --navy-3: #2a4675;
  --ink: #13213a;
  --ink-2: #44546c;
  --muted: #74839a;
  --bg: #f3f6f9;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --line: #e1e7ef;
  --line-2: #eef2f6;
  --teal: #0b8f8a;
  --teal-2: #0e9a94;
  --teal-soft: #e2f3f2;
  --teal-ink: #07605d;
  --s1: #2b5aa8;  /* series: Main / primary */
  --s2: #0e9a94;  /* series: Al-Baraka / forecast */
  --s3: #be7a12;  /* series: Hawari */
  --good: #1d7f52; --good-soft: #e3f3ea;
  --warn: #a8670d; --warn-soft: #fbf0dc;
  --bad: #b8382f;  --bad-soft: #fbe6e4;
  --font: "IBM Plex Sans", "IBM Plex Sans Arabic", "Segoe UI", Tahoma, sans-serif;
  --font-ar: "IBM Plex Sans Arabic", "IBM Plex Sans", "Segoe UI", Tahoma, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Consolas, monospace;
  --r: 10px;
  --r-sm: 6px;
  --shadow: 0 1px 2px rgba(13, 31, 60, .05), 0 2px 8px rgba(13, 31, 60, .04);
  --side: 248px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--ink);
  font: 14px/1.5 var(--font);
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}
html[lang="ar"] body { font-family: var(--font-ar); }
a { color: inherit; }
button, select, input { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; border-radius: 4px; }
h1, h2, h3 { margin: 0; text-wrap: balance; }
.num { font-variant-numeric: tabular-nums; }
.ltr { direction: ltr; unicode-bidi: isolate; }

/* ---------- Shell ---------- */
.app { display: grid; grid-template-columns: var(--side) minmax(0, 1fr); min-height: 100vh; }
.side {
  background: var(--navy); color: #c9d4e6;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  display: flex; flex-direction: column; padding: 18px 12px;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 18px; text-decoration: none; color: #fff; }
.brand svg { flex: none; }
.brand b { display: block; font-size: 17px; letter-spacing: .02em; }
.brand small { display: block; font-size: 11px; color: #8fa3c2; letter-spacing: .04em; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-label { font-size: 10.5px; text-transform: uppercase; letter-spacing: .1em; color: #6f86aa; padding: 14px 12px 6px; }
html[lang="ar"] .nav-label { text-transform: none; letter-spacing: 0; font-size: 12px; }
.nav a {
  display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 8px;
  text-decoration: none; color: #c9d4e6; font-size: 13.5px;
}
.nav a svg { width: 18px; height: 18px; flex: none; opacity: .85; }
.nav a:hover { background: var(--navy-2); color: #fff; }
.nav a[aria-current="page"] { background: var(--navy-2); color: #fff; box-shadow: inset 3px 0 0 var(--teal-2); }
html[dir="rtl"] .nav a[aria-current="page"] { box-shadow: inset -3px 0 0 var(--teal-2); }
.nav a .ai-dot { margin-inline-start: auto; font-size: 10px; background: rgba(14,154,148,.25); color: #7fe0da; padding: 1px 6px; border-radius: 99px; }
.side-foot { margin-top: auto; padding-top: 12px; border-top: 1px solid var(--navy-2); }
.side-sync { font-size: 11.5px; color: #8fa3c2; padding: 10px 12px 0; display: flex; gap: 8px; align-items: center; }
.side-sync i { width: 7px; height: 7px; border-radius: 50%; background: #3ccf8e; display: inline-block; }

.main { min-width: 0; display: flex; flex-direction: column; }
.top {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20;
  background: rgba(255,255,255,.94); backdrop-filter: saturate(1.4) blur(6px);
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 10px; padding: 10px 24px; flex-wrap: wrap;
}
.top .lab { font-weight: 600; font-size: 14.5px; margin-inline-end: auto; display: flex; align-items: center; gap: 8px; min-width: 0; }
.top .lab small { color: var(--muted); font-weight: 400; font-size: 12px; }
.icon-btn.menu-btn, .icon-btn.filt-btn { display: none; }
.ctl {
  display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 10px;
  border: 1px solid var(--line); border-radius: 8px; background: var(--surface); font-size: 13px; color: var(--ink-2);
}
.ctl select { border: 0; background: transparent; height: 32px; padding: 0 2px; cursor: pointer; color: var(--ink); font-weight: 500; }
.ctl label { color: var(--muted); font-size: 12px; white-space: nowrap; }
.icon-btn {
  width: 34px; height: 34px; display: inline-grid; place-items: center; border-radius: 8px;
  border: 1px solid var(--line); background: var(--surface); cursor: pointer; position: relative;
}
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn .dot { position: absolute; top: 6px; inset-inline-end: 7px; width: 7px; height: 7px; background: var(--bad); border-radius: 50%; }
.lang { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; height: 34px; }
.lang button { border: 0; background: var(--surface); padding: 0 10px; cursor: pointer; font-size: 12.5px; color: var(--ink-2); }
.lang button[aria-pressed="true"] { background: var(--navy); color: #fff; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--teal-soft); color: var(--teal-ink); display: grid; place-items: center; font-weight: 600; font-size: 12.5px; border: 0; cursor: pointer; }

.popover {
  position: absolute; top: 52px; inset-inline-end: 24px; width: min(360px, calc(100vw - 32px));
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: 0 12px 32px rgba(13,31,60,.14); z-index: 40; padding: 8px;
}
.popover h4 { margin: 6px 8px 8px; font-size: 13px; }
.note-item { display: block; padding: 10px; border-radius: 8px; text-decoration: none; }
.note-item:hover { background: var(--surface-2); }
.note-item b { display: block; font-size: 13px; font-weight: 500; }
.note-item small { color: var(--muted); font-size: 11.5px; }

.content { padding: 22px 24px 48px; width: 100%; display: flex; flex-direction: column; gap: 18px; }
.page-head { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.page-head > div:first-child { flex: 1 1 320px; min-width: 0; }
.crumb { font-size: 12px; color: var(--muted); display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-bottom: 4px; }
.crumb a { text-decoration: none; color: var(--teal-ink); }
.page-head h1 { font-size: 24px; font-weight: 600; letter-spacing: -.01em; }
.page-head p { margin: 4px 0 0; color: var(--ink-2); max-width: 70ch; }
.context-pill { display: inline-flex; gap: 6px; align-items: center; font-size: 12px; color: var(--ink-2); background: var(--surface); border: 1px solid var(--line); padding: 4px 10px; border-radius: 99px; }
.context-pill b { color: var(--ink); font-weight: 600; }

/* ---------- Grid & cards ---------- */
.grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 16px; }
.c3 { grid-column: span 3; } .c4 { grid-column: span 4; } .c5 { grid-column: span 5; } .c6 { grid-column: span 6; }
.c7 { grid-column: span 7; } .c8 { grid-column: span 8; } .c12 { grid-column: span 12; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); padding: 16px 18px; min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.card.flat { box-shadow: none; }
.card-h { display: flex; align-items: flex-start; gap: 10px; }
.card-h h2 { font-size: 14.5px; font-weight: 600; }
.card-h .sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.card-h .act { margin-inline-start: auto; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.more { font-size: 12.5px; color: var(--teal-ink); text-decoration: none; font-weight: 500; white-space: nowrap; display: inline-flex; gap: 4px; align-items: center; }
.more:hover { text-decoration: underline; }
html[dir="rtl"] .more .arr { transform: scaleX(-1); display: inline-block; }
.card > .more, .card > .spread:last-child { margin-top: auto; }

/* KPI */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.kpi { text-decoration: none; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 6px; transition: border-color .15s, transform .15s; min-width: 0; }
a.kpi:hover { border-color: var(--teal-2); transform: translateY(-1px); }
.kpi .lbl { font-size: 12.5px; color: var(--ink-2); display: flex; align-items: center; gap: 6px; }
.kpi .val { font-size: 26px; font-weight: 600; letter-spacing: -.02em; line-height: 1.15; }
.kpi .val small { font-size: 13px; font-weight: 500; color: var(--ink-2); margin-inline-start: 3px; letter-spacing: 0; }
.kpi .foot { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.kpi svg.spark { width: 100%; height: 34px; display: block; }

.delta { display: inline-flex; align-items: center; gap: 3px; font-size: 12px; font-weight: 600; padding: 1px 7px; border-radius: 99px; direction: ltr; unicode-bidi: isolate; white-space: nowrap; }
.delta.up { color: var(--good); background: var(--good-soft); }
.delta.down { color: var(--bad); background: var(--bad-soft); }
.delta.flat { color: var(--ink-2); background: var(--line-2); }

.badge { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 500; padding: 2px 8px; border-radius: 99px; background: var(--line-2); color: var(--ink-2); white-space: nowrap; }
.badge.teal { background: var(--teal-soft); color: var(--teal-ink); }
.badge.good { background: var(--good-soft); color: var(--good); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.badge.navy { background: #e6ecf6; color: var(--navy-2); }
.badge.outline { background: transparent; border: 1px solid var(--line); }
.sem-tag { font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; font-weight: 600; padding: 2px 6px; border-radius: 4px; }
html[lang="ar"] .sem-tag { text-transform: none; letter-spacing: 0; font-size: 11.5px; }
.sem-actual { background: #e6ecf6; color: var(--navy-2); }
.sem-forecast { background: var(--teal-soft); color: var(--teal-ink); }
.sem-expected { background: #e8f0ff; color: #2b5aa8; }
.sem-estimated { background: var(--warn-soft); color: var(--warn); }

/* Buttons & controls */
.btn { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 14px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; font-size: 13px; font-weight: 500; text-decoration: none; color: var(--ink); white-space: nowrap; }
.btn:hover { border-color: var(--teal-2); }
.btn.primary { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn.primary:hover { background: var(--navy-2); }
.btn.teal { background: var(--teal); border-color: var(--teal); color: #fff; }
.btn svg { width: 16px; height: 16px; flex: none; }
.btn.sm { height: 28px; padding: 0 10px; font-size: 12px; }
.seg { display: inline-flex; background: var(--line-2); border-radius: 8px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg button { border: 0; background: transparent; padding: 4px 10px; border-radius: 6px; cursor: pointer; font-size: 12.5px; color: var(--ink-2); }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(13,31,60,.1); font-weight: 500; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tabs button { border: 0; background: transparent; padding: 8px 12px; cursor: pointer; font-size: 13px; color: var(--ink-2); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs button[aria-selected="true"] { color: var(--ink); border-color: var(--teal-2); font-weight: 500; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 10px 12px; }
.filters .ctl { height: 32px; }
.search { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 8px; height: 32px; padding: 0 10px; background: var(--surface); min-width: 0; }
.search input { border: 0; outline: 0; width: 160px; max-width: 40vw; background: transparent; font-size: 13px; }

/* Tables */
.tbl-wrap { overflow-x: auto; margin: 0 -18px; padding: 0 18px; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th { text-align: start; font-weight: 500; color: var(--muted); font-size: 12px; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; user-select: none; }
.tbl th.sortable { cursor: pointer; }
.tbl th.sortable:hover { color: var(--ink); }
.tbl th .sort { font-size: 10px; opacity: .7; }
.tbl td { padding: 9px 10px; border-bottom: 1px solid var(--line-2); white-space: nowrap; }
.tbl td.n, .tbl th.n { text-align: end; }
.tbl tbody tr.click { cursor: pointer; }
.tbl tbody tr.click:hover { background: var(--surface-2); }
.tbl tfoot td { font-weight: 600; border-top: 1px solid var(--line); border-bottom: 0; }
.tbl .strong { font-weight: 600; }
.tbl .bar-cell { min-width: 90px; }
.inbar { height: 6px; border-radius: 3px; background: var(--line-2); overflow: hidden; }
.inbar i { display: block; height: 100%; border-radius: 3px; background: var(--s1); }
.pager { display: flex; justify-content: space-between; align-items: center; font-size: 12px; color: var(--muted); gap: 8px; flex-wrap: wrap; }

/* Lists */
.list { display: flex; flex-direction: column; }
.li { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line-2); min-width: 0; }
.li:last-child { border-bottom: 0; }
.li .grow { flex: 1; min-width: 0; }
.li .t { font-weight: 500; }
.li .s { font-size: 12px; color: var(--muted); }
.rank { width: 22px; height: 22px; border-radius: 6px; background: var(--line-2); color: var(--ink-2); display: grid; place-items: center; font-size: 11.5px; font-weight: 600; flex: none; }
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 12px; }
.stat { padding: 10px 12px; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--line-2); min-width: 0; }
.stat .k { font-size: 11.5px; color: var(--muted); }
.stat .v { font-size: 18px; font-weight: 600; margin-top: 2px; }
.stat .v small { font-size: 12px; color: var(--ink-2); font-weight: 500; }

/* AI blocks */
.ai-card { border: 1px solid #cfe9e7; background: linear-gradient(180deg, #f2fbfa 0, #fff 60%); }
.ai-tag { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 600; color: var(--teal-ink); }
.ai-tag svg { width: 14px; height: 14px; }
.based { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.insight { display: grid; gap: 10px; }
.insight .chain { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.insight .step { background: var(--surface-2); border: 1px solid var(--line-2); border-radius: 8px; padding: 10px; min-width: 0; }
.insight .step .k { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 600; }
html[lang="ar"] .insight .step .k { text-transform: none; letter-spacing: 0; font-size: 12px; }
.insight .step p { margin: 4px 0 0; font-size: 13px; }
.insight .step.act { background: var(--teal-soft); border-color: #bfe3e0; }
.prio { width: 4px; align-self: stretch; border-radius: 2px; flex: none; }
.prio.high { background: var(--bad); } .prio.medium { background: var(--warn); } .prio.low { background: var(--s1); }

/* Formula / calc */
.formula { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 13px; }
.formula .term { background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; display: flex; flex-direction: column; min-width: 0; }
.formula .term b { font-size: 18px; }
.formula .term small { color: var(--muted); font-size: 11.5px; }
.formula .op { color: var(--muted); font-size: 18px; font-weight: 300; }
.formula .term.res { background: #e8f0ff; border-color: #c9d8f5; }
.formula .term.res b { color: #2b5aa8; }
.calc-lines { font-family: var(--mono); font-size: 13px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; overflow-x: auto; }
html[lang="ar"] .calc-lines { font-family: var(--font-ar); }
.calc-lines span:last-child { direction: ltr; unicode-bidi: isolate; }
.calc-lines div { display: flex; justify-content: space-between; gap: 24px; white-space: nowrap; }
.calc-lines .tot { border-top: 1px dashed var(--line); margin-top: 6px; padding-top: 6px; font-weight: 600; }
.calc-lines .res { color: #2b5aa8; font-weight: 600; }

.callout { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: 8px; background: var(--warn-soft); color: #6b4609; font-size: 13px; }
.callout.info { background: #e8f0ff; color: #1f427c; }
.callout svg { flex: none; width: 18px; height: 18px; margin-top: 1px; }

/* Charts */
.chart { position: relative; width: 100%; direction: ltr; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .axis text, .chart .lbl { fill: var(--muted); font-size: 11px; font-family: var(--font); }
.chart .grid-l { stroke: var(--line-2); stroke-width: 1; }
.chart .base-l { stroke: var(--line); stroke-width: 1; }
.chart .hit { fill: transparent; cursor: crosshair; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 12px; color: var(--ink-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.legend i.line { height: 3px; border-radius: 2px; width: 14px; }
.legend i.dash { height: 0; width: 14px; border-top: 2px dashed var(--teal-2); border-radius: 0; }
.tip {
  position: fixed; z-index: 60; pointer-events: none; background: var(--navy); color: #fff; font-size: 12px;
  padding: 8px 10px; border-radius: 8px; box-shadow: 0 6px 18px rgba(13,31,60,.25); min-width: 120px; max-width: 260px; line-height: 1.45;
}
.tip b { display: block; font-size: 12px; margin-bottom: 4px; color: #cfe0f7; font-weight: 500; }
.tip .r { display: flex; justify-content: space-between; gap: 12px; }
.tip .r i { width: 8px; height: 8px; border-radius: 2px; display: inline-block; margin-inline-end: 6px; }
.heat { display: grid; gap: 3px; direction: ltr; font-size: 11px; }
.heat .h { color: var(--muted); text-align: center; font-size: 10.5px; }
.heat .d { color: var(--ink-2); font-size: 11.5px; padding-inline-end: 6px; display: flex; align-items: center; }
.heat .cell { border-radius: 3px; outline-offset: 1px; aspect-ratio: 1.6 / 1; min-height: 14px; cursor: default; }
.scale { display: flex; align-items: center; gap: 8px; font-size: 11px; color: var(--muted); }
.scale .ramp { height: 8px; width: 120px; border-radius: 4px; background: linear-gradient(90deg, #e6f4f3, #0b8f8a, #0d1f3c); }
.donut-row { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.hbar { display: grid; grid-template-columns: minmax(90px, 160px) minmax(0, 1fr) auto; gap: 8px 10px; align-items: center; font-size: 13px; }
.hbar .bar { height: 10px; background: var(--line-2); border-radius: 3px; overflow: hidden; direction: ltr; }
html[dir="rtl"] .hbar .bar { direction: rtl; }
.hbar .bar i { display: block; height: 100%; border-radius: 3px; }
.hbar .v { text-align: end; font-weight: 500; }

/* Assistant */
.chat { display: flex; flex-direction: column; gap: 14px; min-height: 360px; height: calc(100vh - 290px); max-height: 760px; overflow-y: auto; padding: 2px 4px 2px 2px; overscroll-behavior: contain; }
.chat-card { position: sticky; top: 70px; }
.side-card { align-self: start; position: sticky; top: 70px; }
@media (max-width: 900px) { .chat { height: auto; max-height: 62vh; } .chat-card, .side-card { position: static; } }
.msg { max-width: min(720px, 92%); padding: 12px 14px; border-radius: 12px; font-size: 13.5px; }
.msg.user { align-self: flex-end; background: var(--navy); color: #fff; border-end-end-radius: 4px; }
.msg.ai { align-self: flex-start; background: var(--surface); border: 1px solid var(--line); border-end-start-radius: 4px; display: flex; flex-direction: column; gap: 10px; }
.msg.ai .tbl td, .msg.ai .tbl th { padding: 6px 8px; }
.composer { display: flex; gap: 8px; border: 1px solid var(--line); border-radius: 12px; padding: 6px; background: var(--surface); }
.composer input { flex: 1; border: 0; outline: 0; padding: 8px 10px; font-size: 14px; min-width: 0; background: transparent; }
.suggest { display: flex; flex-wrap: wrap; gap: 8px; }
.suggest button { border: 1px solid var(--line); background: var(--surface); border-radius: 99px; padding: 6px 12px; font-size: 12.5px; cursor: pointer; color: var(--ink-2); text-align: start; }
.suggest button:hover { border-color: var(--teal-2); color: var(--teal-ink); }
.typing { display: inline-flex; gap: 4px; }
.typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); animation: blink 1s infinite; }
.typing i:nth-child(2) { animation-delay: .15s; } .typing i:nth-child(3) { animation-delay: .3s; }
@keyframes blink { 0%, 100% { opacity: .25; } 50% { opacity: 1; } }

/* Modal / drawer */
.modal-bg { position: fixed; inset: 0; background: rgba(13,31,60,.38); z-index: 50; display: grid; place-items: center; padding: 16px; }
.modal { background: var(--surface); border-radius: 12px; width: min(760px, 100%); max-height: 90vh; overflow-y: auto; box-shadow: 0 24px 60px rgba(13,31,60,.3); display: flex; flex-direction: column; }
.modal-h { display: flex; align-items: center; gap: 10px; padding: 16px 20px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--surface); }
.modal-h h3 { font-size: 16px; font-weight: 600; }
.modal-h button { margin-inline-start: auto; }
.modal-b { padding: 16px 20px 20px; display: flex; flex-direction: column; gap: 14px; }
.scrim { display: none; }

/* States */
.state { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; padding: 26px 16px; border: 1px dashed var(--line); border-radius: var(--r); color: var(--ink-2); background: var(--surface-2); }
.state svg { width: 28px; height: 28px; color: var(--muted); }
.state b { color: var(--ink); }
.skel { background: linear-gradient(90deg, var(--line-2), #f7f9fb, var(--line-2)); background-size: 200% 100%; animation: sh 1.4s infinite; border-radius: 6px; height: 12px; }
@keyframes sh { to { background-position: -200% 0; } }

.muted { color: var(--muted); }
.small { font-size: 12px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spread { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.strike { text-decoration: line-through; color: var(--muted); }
hr.sep { border: 0; border-top: 1px solid var(--line-2); margin: 0; width: 100%; }
.toggle { position: relative; width: 44px; height: 28px; border-radius: 99px; background: var(--line); border: 0; cursor: pointer; flex: none; }
.toggle::after { content: ""; position: absolute; top: 3px; inset-inline-start: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; transition: inset-inline-start .15s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.toggle[aria-checked="true"] { background: var(--teal); }
.toggle[aria-checked="true"]::after { inset-inline-start: 19px; }
.journey { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 12px; }
.journey a, .journey span.cur { padding: 4px 10px; border-radius: 99px; border: 1px solid var(--line); text-decoration: none; background: var(--surface); }
.journey span.cur { background: var(--navy); color: #fff; border-color: var(--navy); }
.journey .sep { color: var(--muted); }
html[dir="rtl"] .journey .sep { transform: scaleX(-1); }

/* ---------- Responsive ---------- */
@media (max-width: 1600px) {
  .top .lab small { display: none; }
  .ctl label { display: none; }
}
@media (max-width: 1180px) {
  .c3 { grid-column: span 6; } .c4 { grid-column: span 6; } .c5, .c7, .c8 { grid-column: span 12; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .insight .chain { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .side { position: fixed; inset-block: 0; inset-inline-start: 0; width: 272px; z-index: 70; transform: translateX(-105%); transition: transform .2s; }
  html[dir="rtl"] .side { transform: translateX(105%); }
  body.nav-open .side { transform: none; }
  body.nav-open .scrim { display: block; position: fixed; inset: 0; background: rgba(13,31,60,.4); z-index: 65; }
  .icon-btn.menu-btn, .icon-btn.filt-btn { display: inline-grid; }
  .top .per-ctl { display: none; order: 10; flex: 1 1 100%; }
  body.filters-open .top .per-ctl { display: inline-flex; }
  .top .per-ctl select { flex: 1; }
  .seg button { min-height: 32px; }
  .tabs button { min-height: 36px; }
  .top { padding: 10px 16px; }
  .top .lab small { display: none; }
  .content { padding: 16px 16px 40px; }
  .c3, .c4, .c6 { grid-column: span 12; }
  .hide-sm { display: none !important; }
}
@media (max-width: 560px) {
  .avatar { display: none; }
  .top .lab { font-size: 13.5px; }
  .kpis { grid-template-columns: minmax(0, 1fr); }
  .insight .chain { grid-template-columns: minmax(0, 1fr); }
  .page-head h1 { font-size: 21px; }
  .ctl label { display: none; }
  .hbar { grid-template-columns: minmax(70px, 110px) minmax(0, 1fr) auto; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
