@charset "UTF-8";
/* Mizan design system — tokens and components. Documented in docs/design-system.md.
   Light only (no dark mode shipped: parity not tested). Logical properties throughout
   so Arabic (RTL) and English (LTR) share one stylesheet. */

@font-face { font-family: "Plex Arabic"; font-weight: 400; font-display: swap; src: url(fonts/plex-arabic-arabic-400.woff2) format("woff2"); unicode-range: U+0600-06FF, U+0750-077F, U+0870-08FF, U+FB50-FDFF, U+FE70-FEFF; }
@font-face { font-family: "Plex Arabic"; font-weight: 500; font-display: swap; src: url(fonts/plex-arabic-arabic-500.woff2) format("woff2"); unicode-range: U+0600-06FF, U+0750-077F, U+0870-08FF, U+FB50-FDFF, U+FE70-FEFF; }
@font-face { font-family: "Plex Arabic"; font-weight: 600; font-display: swap; src: url(fonts/plex-arabic-arabic-600.woff2) format("woff2"); unicode-range: U+0600-06FF, U+0750-077F, U+0870-08FF, U+FB50-FDFF, U+FE70-FEFF; }
@font-face { font-family: "Plex Arabic"; font-weight: 700; font-display: swap; src: url(fonts/plex-arabic-arabic-700.woff2) format("woff2"); unicode-range: U+0600-06FF, U+0750-077F, U+0870-08FF, U+FB50-FDFF, U+FE70-FEFF; }
@font-face { font-family: "Plex Arabic"; font-weight: 400; font-display: swap; src: url(fonts/plex-arabic-latin-400.woff2) format("woff2"); unicode-range: U+0000-00FF, U+2000-206F, U+20AC, U+2122, U+2190-2199; }
@font-face { font-family: "Plex Arabic"; font-weight: 500; font-display: swap; src: url(fonts/plex-arabic-latin-500.woff2) format("woff2"); unicode-range: U+0000-00FF, U+2000-206F, U+20AC, U+2122, U+2190-2199; }
@font-face { font-family: "Plex Arabic"; font-weight: 600; font-display: swap; src: url(fonts/plex-arabic-latin-600.woff2) format("woff2"); unicode-range: U+0000-00FF, U+2000-206F, U+20AC, U+2122, U+2190-2199; }
@font-face { font-family: "Plex Arabic"; font-weight: 700; font-display: swap; src: url(fonts/plex-arabic-latin-700.woff2) format("woff2"); unicode-range: U+0000-00FF, U+2000-206F, U+20AC, U+2122, U+2190-2199; }

:root {
  color-scheme: light;
  /* Theme A · Ink & Mineral (default): muted cool ground, no pure white, ink-dark navigation, calm navy accent */
  --canvas: #E3E6EA; --surface: #EEF0F3; --surface-2: #E7EAEE; --sunken: #DCE0E5; --line: #D2D7DE; --ink: #1D2530; --ink-2: #55606D;
  --accent: #2A4868; --accent-strong: #2A4868; --accent-hover: #213B57; --accent-wash: #D9E0E9; --on-accent: #F2F4F7; --control-line: #8C95A1; --gold: #7E6A40;
  --side: #1C2631; --side-ink: #C5CED8; --side-muted: #8592A0; --side-on: #2A3644; --side-gold: #B59B66;
  /* semantic, never brand-coloured; always paired with text or an icon */
  --ok: #3D6B55; --ok-wash: #D8E4DC; --warn: #8A6519; --warn-wash: #ECE3CF; --bad: #954840; --bad-wash: #EFDEDB; --info: #2A4868; --info-wash: #D9E0E9;
  --focus: #2A4868;
  /* space 4·8·12·16·24·32·48 */
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px;
  --r-sm: 8px; --r: 10px; --r-lg: 16px;
  --shadow: none;
  --shadow-pop: 0 16px 40px -16px rgba(18, 24, 32, .35);
  --font: "IBM Plex Sans Arabic", "Plex Arabic", "Segoe UI", Tahoma, "Geeza Pro", system-ui, sans-serif;
  --font-head: "Noto Naskh Arabic", "IBM Plex Sans Arabic", "Plex Arabic", serif;
  --t-body: 15px; --t-small: 14px; --t-tiny: 13px; --t-h3: 20px; --t-h2: 24px; --t-h1: 32px; --t-display: 40px;
  --nav-w: 264px;
}
/* Theme B · Night: calm charcoal with a quiet gold accent (chosen per user in Settings) */
:root[data-theme="b"] {
  color-scheme: dark;
  --canvas: #12161B; --surface: #1A1F26; --surface-2: #20262E; --sunken: #262D36; --line: #2C333C; --ink: #DCE1E7; --ink-2: #8F99A5;
  --accent: #C8A86B; --accent-strong: #C8A86B; --accent-hover: #B8975A; --accent-wash: #2B271F; --on-accent: #15120C; --control-line: #5B6672; --gold: #C8A86B;
  --side: #0D1014; --side-ink: #C9D0D8; --side-muted: #77818D; --side-on: #1C2229; --side-gold: #C8A86B;
  --ok: #86B9A0; --ok-wash: #1E2B25; --warn: #D5B26E; --warn-wash: #2E2819; --bad: #D9958C; --bad-wash: #2F201F; --info: #9DBEDC; --info-wash: #23303D; --focus: #C8A86B;
  --font: "Readex Pro", "IBM Plex Sans Arabic", "Plex Arabic", "Segoe UI", Tahoma, system-ui, sans-serif;
  --font-head: "Readex Pro", "IBM Plex Sans Arabic", "Plex Arabic", sans-serif;
}


* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--canvas); color: var(--ink); font-family: var(--font); font-size: var(--t-body); line-height: 1.7; -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4 { margin: 0; line-height: 1.35; font-weight: 700; }
h1, h2 { font-family: var(--font-head); }
h1 { font-size: var(--t-h2); }
h2 { font-size: var(--t-h3); }
h3 { font-size: 17px; }
p { margin: 0 0 var(--s3); }
a { color: var(--accent-strong); text-underline-offset: 3px; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
[hidden] { display: none !important; }
.num, td.num, .tnum { font-variant-numeric: tabular-nums; }
bdi.ltr, .ltr { direction: ltr; unicode-bidi: isolate; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; inset-inline-start: var(--s3); top: -60px; background: var(--ink); color: var(--canvas); padding: var(--s2) var(--s4); border-radius: var(--r-sm); z-index: 50; }
.skip:focus { top: var(--s3); }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; } }

/* ------------------------------------------------------------------ shell */
.shell { display: grid; grid-template-columns: var(--nav-w) minmax(0, 1fr); min-height: 100vh; }
.nav { background: var(--surface); border-inline-end: 1px solid var(--line); position: sticky; top: 0; height: 100vh; overflow-y: auto; padding: var(--s4) var(--s3) var(--s5); display: flex; flex-direction: column; gap: var(--s4); }
.brand { display: flex; align-items: center; gap: var(--s3); padding: 0 var(--s2) var(--s3); border-bottom: 1px solid var(--line); }
.brand-mark { width: 36px; height: 36px; flex: none; }
.brand-name { font-weight: 700; font-size: 20px; letter-spacing: 0; }
.brand-sub { font-size: var(--t-tiny); color: var(--ink-2); line-height: 1.3; }
.nav-group > h2 { font-size: var(--t-tiny); font-weight: 600; color: var(--ink-2); padding: 0 var(--s2); margin-bottom: var(--s1); }
.nav-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.nav-list a { display: flex; align-items: center; gap: var(--s2); padding: 7px var(--s2); border-radius: var(--r-sm); color: var(--ink); text-decoration: none; font-size: 15px; line-height: 1.4; }
.nav-list a:hover { background: var(--sunken); }
.nav-list a[aria-current="page"] { background: var(--accent-wash); color: var(--accent-strong); font-weight: 600; box-shadow: inset 3px 0 0 var(--accent); }
[dir="rtl"] .nav-list a[aria-current="page"] { box-shadow: inset -3px 0 0 var(--accent); }
.nav-code { font-size: 12px; font-weight: 600; color: var(--ink-2); min-width: 30px; font-variant-numeric: tabular-nums; }
.nav-sub { list-style: none; margin: 2px 0 var(--s2); padding-inline-start: 38px; display: grid; gap: 0; }
.nav-sub a { font-size: 14px; padding: 4px var(--s2); color: var(--ink-2); }
.nav-foot { margin-top: auto; font-size: var(--t-tiny); color: var(--ink-2); padding: var(--s3) var(--s2) 0; border-top: 1px solid var(--line); }
.main { min-width: 0; display: flex; flex-direction: column; }
.ctxbar { position: sticky; top: 0; z-index: 10; background: var(--surface); border-bottom: 1px solid var(--line); display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2) var(--s4); padding: var(--s2) var(--s5); }
.ctx { display: flex; flex-direction: column; gap: 0; min-width: 0; }
.ctx label { font-size: 12px; color: var(--ink-2); line-height: 1.2; }
.ctx select { border: 1px solid var(--control-line); background: var(--surface); border-radius: var(--r-sm); padding: 3px var(--s2); font-size: 14px; max-width: 220px; min-height: 32px; }
.ctx-spacer { flex: 1; }
.ctxbar .icon-btn { min-height: 36px; }
.demo-flag { background: var(--warn-wash); color: var(--warn); border: 1px solid #E2CD9C; border-radius: 999px; padding: 2px var(--s3); font-size: var(--t-tiny); font-weight: 600; }
.banner { display: flex; gap: var(--s3); align-items: flex-start; padding: var(--s3) var(--s4); border-radius: var(--r); border: 1px solid; margin-bottom: var(--s4); font-size: 15px; }
.banner.warn { background: var(--warn-wash); border-color: #E2CD9C; color: #5C3D00; }
.banner.info { background: var(--info-wash); border-color: #BCD0E4; color: #1E4266; }
.banner.bad { background: var(--bad-wash); border-color: #E3B8B3; color: #6E231C; }
.banner.ok { background: var(--ok-wash); border-color: #B7D3C3; color: #1F4A36; }
:root[data-theme="b"] .banner.warn { color: var(--warn); border-color: #5A4A28; }
:root[data-theme="b"] .banner.info { color: var(--info); border-color: #3A4D61; }
:root[data-theme="b"] .banner.bad { color: var(--bad); border-color: #5E3632; }
:root[data-theme="b"] .banner.ok { color: var(--ok); border-color: #345244; }
.page { padding: var(--s5) var(--s5) var(--s7); max-width: 1440px; width: 100%; }
.crumbs { font-size: var(--t-tiny); color: var(--ink-2); margin-bottom: var(--s2); display: flex; flex-wrap: wrap; gap: var(--s1) var(--s2); }
.crumbs a { color: var(--ink-2); }
.page-head { display: flex; flex-wrap: wrap; gap: var(--s3) var(--s5); align-items: flex-start; justify-content: space-between; margin-bottom: var(--s5); }
.page-head h1 { font-size: var(--t-h1); }
.page-head .purpose { color: var(--ink-2); margin: var(--s1) 0 0; max-width: 72ch; }
.page-actions { display: flex; flex-wrap: wrap; gap: var(--s2); align-items: center; }

/* ---------------------------------------------------------- journey rail */
.journey { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 0; margin-bottom: var(--s5); position: relative; }
.journey::before { content: ""; position: absolute; inset-inline: 6%; top: 15px; height: 2px; background: var(--line); }
.journey a { position: relative; display: flex; flex-direction: column; align-items: center; text-align: center; gap: var(--s1); text-decoration: none; color: var(--ink-2); font-size: 13px; line-height: 1.35; padding: 0 var(--s1); }
.journey .dot { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--surface); border: 2px solid var(--line); font-weight: 700; font-size: 13px; color: var(--ink-2); z-index: 1; }
.journey a[data-status="in_progress"] .dot, .journey a[data-status="in_review"] .dot { border-color: var(--accent); color: var(--accent-strong); }
.journey a[data-status="approved"] .dot { background: var(--accent-strong); border-color: var(--accent-strong); color: var(--on-accent); }
.journey a[aria-current="page"] { color: var(--ink); font-weight: 600; }
.journey a[aria-current="page"] .dot { box-shadow: 0 0 0 4px var(--accent-wash); }

/* --------------------------------------------------------------- blocks */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: var(--s5); box-shadow: var(--shadow); }
.panel + .panel { margin-top: var(--s4); }
.grid > .panel + .panel { margin-top: 0; }
.panel-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: var(--s2) var(--s4); margin-bottom: var(--s4); }
.panel-head p { margin: 0; color: var(--ink-2); font-size: var(--t-small); }
.grid { display: grid; gap: var(--s4); }
.grid > * { min-width: 0; }   /* wide tables scroll inside their own wrapper instead of widening the page */
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.side { grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr); }
.metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: var(--s3); margin-bottom: var(--s4); }
.metric { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: var(--s3) var(--s4); }
.metric .label { font-size: var(--t-tiny); color: var(--ink-2); }
.metric .value { font-size: 28px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.25; }
.metric .note { font-size: 12.5px; color: var(--ink-2); }
.stack > * + * { margin-top: var(--s4); }
.row { display: flex; flex-wrap: wrap; gap: var(--s2); align-items: center; }
.muted { color: var(--ink-2); }
.small { font-size: var(--t-small); }
.tabs { display: flex; gap: var(--s1); border-bottom: 1px solid var(--line); margin-bottom: var(--s4); overflow-x: auto; }
.tabs [role="tab"] { all: unset; cursor: pointer; padding: var(--s2) var(--s3); font-size: 15px; color: var(--ink-2); border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs [role="tab"][aria-selected="true"] { color: var(--ink); font-weight: 600; border-bottom-color: var(--accent); }
.tabs [role="tab"]:focus-visible { outline: 3px solid var(--focus); }
.phase { font-size: var(--t-tiny); color: var(--ink-2); font-weight: 600; margin: 0 0 var(--s2); }

/* --------------------------------------------------------------- controls */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--s2); min-height: 40px; padding: 0 var(--s4); border-radius: var(--r-sm); border: 1px solid var(--control-line); background: var(--surface); color: var(--ink); cursor: pointer; font-weight: 600; font-size: 15px; text-decoration: none; white-space: nowrap; }
.btn:hover { background: var(--sunken); }
.btn.primary { background: var(--accent-strong); border-color: var(--accent-strong); color: var(--on-accent); }
.btn.primary:hover { background: var(--accent-hover); }
.btn.danger { color: var(--bad); border-color: #C98A84; }
.btn.quiet { border-color: transparent; background: transparent; }
.btn.quiet:hover { background: var(--sunken); }
.btn.sm { min-height: 32px; padding: 0 var(--s3); font-size: 14px; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .55; cursor: not-allowed; }
.icon-btn { all: unset; cursor: pointer; display: inline-grid; place-items: center; min-width: 36px; min-height: 36px; border-radius: var(--r-sm); color: var(--ink-2); }
.icon-btn:hover { background: var(--sunken); color: var(--ink); }
.field { display: grid; gap: var(--s1); }
.field > label, .field > .label { font-size: 14px; font-weight: 600; }
.field .hint { font-size: 13px; color: var(--ink-2); }
.field .err { font-size: 13px; color: var(--bad); font-weight: 600; }
.input, .field input, .field select, .field textarea { width: 100%; border: 1px solid var(--control-line); background: var(--surface); border-radius: var(--r-sm); padding: 8px var(--s3); min-height: 40px; font-size: 15px; }
.field textarea { min-height: 96px; resize: vertical; line-height: 1.6; }
.field [aria-invalid="true"] { border-color: var(--bad); box-shadow: 0 0 0 1px var(--bad); }
.check { display: flex; gap: var(--s2); align-items: center; font-size: 15px; }
.check input { width: 18px; height: 18px; accent-color: var(--accent-strong); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s4); }
.form-grid .wide { grid-column: 1 / -1; }

/* ------------------------------------------------------------------ chips */
.chip { display: inline-flex; align-items: center; gap: 6px; border-radius: 999px; padding: 1px 10px; font-size: 13px; font-weight: 600; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); white-space: nowrap; }
.chip::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; opacity: .85; }
.chip.ok { color: var(--ok); background: var(--ok-wash); border-color: #B7D3C3; }
.chip.warn { color: var(--warn); background: var(--warn-wash); border-color: #E2CD9C; }
.chip.bad { color: var(--bad); background: var(--bad-wash); border-color: #E3B8B3; }
.chip.info { color: var(--info); background: var(--info-wash); border-color: #BCD0E4; }
.chip.accent { color: var(--accent-strong); background: var(--accent-wash); border-color: #C3D0E2; }
.chip.plain::before { display: none; }
.source { display: inline-flex; gap: 4px; align-items: center; font-size: 12.5px; color: var(--ink-2); border: 1px dashed var(--control-line); border-radius: var(--r-sm); padding: 0 6px; }

/* ------------------------------------------------------------------ table */
.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); max-height: 70vh; }
table.data { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 14.5px; }
table.data th { position: sticky; top: 0; background: var(--surface-2); text-align: start; font-weight: 600; font-size: 13.5px; color: var(--ink-2); padding: var(--s2) var(--s3); border-bottom: 1px solid var(--line); white-space: nowrap; z-index: 1; }
table.data td { padding: var(--s2) var(--s3); border-bottom: 1px solid var(--line); vertical-align: top; }
table.data tr:last-child td { border-bottom: 0; }
table.data tbody tr:hover td { background: var(--sunken); }
table.data td.num, table.data th.num { text-align: end; font-variant-numeric: tabular-nums; }
table.data tr.clickable { cursor: pointer; }
table.data .sel { width: 36px; }
.table-foot { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: var(--s2); padding: var(--s2) 0; font-size: 14px; color: var(--ink-2); }
.filterbar { display: flex; flex-wrap: wrap; gap: var(--s2); align-items: end; margin-bottom: var(--s3); }
.filterbar .input { width: auto; min-width: 200px; }

/* ----------------------------------------------------------------- drawer */
.drawer-backdrop { position: fixed; inset: 0; background: rgba(26, 34, 48, .32); z-index: 40; }
.drawer { position: fixed; inset-block: 0; inset-inline-end: 0; width: min(640px, 100vw); background: var(--surface); z-index: 41; display: flex; flex-direction: column; box-shadow: var(--shadow-pop); }
.drawer header { padding: var(--s4) var(--s5); border-bottom: 1px solid var(--line); display: flex; gap: var(--s3); align-items: flex-start; justify-content: space-between; }
.drawer header p { margin: 2px 0 0; color: var(--ink-2); font-size: 14px; }
.drawer .body { padding: var(--s4) var(--s5); overflow-y: auto; flex: 1; }
.drawer footer { padding: var(--s3) var(--s5); border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: var(--s2); align-items: center; }
.drawer footer .status { margin-inline-start: auto; font-size: 13px; color: var(--ink-2); }
.dialog::backdrop { background: rgba(26, 34, 48, .32); }
.dialog { border: 1px solid var(--line); border-radius: var(--r-lg); padding: var(--s5); max-width: 520px; width: calc(100vw - 32px); box-shadow: var(--shadow-pop); }

/* ----------------------------------------------------- domain components */
.empty { border: 1px dashed var(--control-line); border-radius: var(--r); padding: var(--s5); text-align: center; color: var(--ink-2); background: var(--surface-2); }
.empty h3 { color: var(--ink); margin-bottom: var(--s1); }
.trace { border: 1px solid var(--line); border-radius: var(--r); background: var(--surface-2); padding: var(--s3) var(--s4); font-size: 14px; }
.trace .formula { direction: ltr; unicode-bidi: isolate; font-variant-numeric: tabular-nums; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-sm); padding: var(--s2) var(--s3); display: block; margin: var(--s2) 0; white-space: pre-wrap; }
.timeline { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s3); }
.timeline li { position: relative; padding-inline-start: var(--s5); }
.timeline li::before { content: ""; position: absolute; inset-inline-start: 6px; top: 8px; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); }
.timeline li::after { content: ""; position: absolute; inset-inline-start: 10px; top: 20px; bottom: -14px; width: 2px; background: var(--line); }
.timeline li:last-child::after { display: none; }
.matrix { display: grid; grid-template-columns: auto repeat(5, minmax(44px, 1fr)); gap: 3px; font-size: 13px; }
.matrix .cell { min-height: 44px; border-radius: 4px; display: grid; place-items: center; font-weight: 700; font-variant-numeric: tabular-nums; border: 1px solid transparent; }
.matrix .low { background: var(--ok-wash); color: var(--ok); }
.matrix .medium { background: var(--warn-wash); color: var(--warn); }
.matrix .high { background: #F3DCC8; color: #7A3E10; }
.matrix .critical { background: var(--bad-wash); color: var(--bad); }
.matrix .axis { color: var(--ink-2); display: grid; place-items: center; }
.org { overflow: auto; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface-2); padding: var(--s4); min-height: 240px; }
.org ul.tree, .org ul.tree ul { list-style: none; margin: 0; padding-inline-start: var(--s5); position: relative; }
.org ul.tree { padding-inline-start: 0; }
.org ul.tree ul::before { content: ""; position: absolute; inset-inline-start: 10px; top: 0; bottom: 14px; width: 1px; background: var(--control-line); }
.org li { position: relative; margin: var(--s2) 0; }
.org ul ul > li::before { content: ""; position: absolute; inset-inline-start: -14px; top: 22px; width: 14px; height: 1px; background: var(--control-line); }
.node { display: inline-flex; flex-wrap: wrap; align-items: center; gap: var(--s2); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 6px var(--s3); min-width: 220px; cursor: pointer; }
.node[aria-selected="true"] { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-wash); }
.node.dragover { border-color: var(--info); box-shadow: 0 0 0 3px var(--info-wash); }
.node .meta { font-size: 12.5px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.node .toggle { all: unset; cursor: pointer; width: 22px; height: 22px; display: grid; place-items: center; border-radius: 4px; color: var(--ink-2); }
.node .toggle:focus-visible { outline: 3px solid var(--focus); }
.diff-added .node { border-color: var(--ok); }
.diff-moved .node { border-style: dashed; border-color: var(--info); }
.bar { height: 10px; background: var(--sunken); border-radius: 999px; overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--accent); }
.kv { display: grid; grid-template-columns: fit-content(45%) 1fr; gap: var(--s1) var(--s4); font-size: 15px; margin: 0; }
.kv dt { color: var(--ink-2); }
.kv dd { margin: 0; }
.proposal { border: 1px solid var(--line); border-radius: var(--r); padding: var(--s3) var(--s4); display: grid; grid-template-columns: auto 1fr; gap: var(--s3); }
.proposal + .proposal { margin-top: var(--s2); }
.toast-host { position: fixed; inset-block-end: var(--s5); inset-inline-start: 50%; transform: translateX(-50%); display: grid; gap: var(--s2); z-index: 60; }
[dir="rtl"] .toast-host { transform: translateX(50%); }
.toast { background: var(--ink); color: var(--canvas); padding: var(--s2) var(--s4); border-radius: var(--r); font-size: 15px; box-shadow: var(--shadow-pop); max-width: min(560px, 90vw); }
.toast.bad { background: var(--bad); }
.signin { max-width: 440px; margin: 12vh auto; }
.signin .panel { padding: var(--s6); }
.persona-list { display: grid; gap: var(--s2); }
.persona { all: unset; cursor: pointer; display: grid; gap: 2px; border: 1px solid var(--line); border-radius: var(--r); padding: var(--s3) var(--s4); background: var(--surface); }
.persona:hover { border-color: var(--accent); }
.persona:focus-visible { outline: 3px solid var(--focus); }
.persona b { font-weight: 700; }
.persona span { font-size: 14px; color: var(--ink-2); }
.spinner { width: 18px; height: 18px; border: 2px solid var(--line); border-top-color: var(--accent-strong); border-radius: 50%; animation: spin .8s linear infinite; display: inline-block; vertical-align: middle; }
@keyframes spin { to { transform: rotate(360deg); } }
.weights { display: flex; height: 14px; border-radius: 999px; overflow: hidden; background: var(--sunken); margin: var(--s2) 0; }
.weights span { display: block; height: 100%; border-inline-end: 2px solid var(--surface); }
.bridge { display: grid; gap: var(--s2); }
.bridge .bar-row { display: grid; grid-template-columns: minmax(150px, 220px) 1fr minmax(90px, max-content); gap: var(--s3); align-items: center; font-size: 14.5px; }
.bridge .bar-row .track { height: 16px; background: var(--sunken); border-radius: 4px; position: relative; overflow: hidden; }
.bridge .bar-row .track span { position: absolute; inset-block: 0; background: var(--accent); border-radius: 4px; }
.bridge .bar-row.neg .track span { background: var(--info); }
/* program flow guide: one quiet line (step n of 8, previous / next) and a folded "how it works" */
.flow { margin: calc(-1 * var(--s3)) 0 var(--s5); display: grid; gap: var(--s2); font-size: 14px; color: var(--ink-2); }
.flow-line { display: flex; flex-wrap: wrap; gap: var(--s2) var(--s4); align-items: baseline; }
.flow-line a { color: var(--ink-2); }
.flow-now summary { cursor: pointer; color: var(--accent-strong); width: fit-content; }
.flow-now p { margin: var(--s1) 0 0; }
.flow-now b { color: var(--ink); }
.stage-io { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s3); margin-bottom: var(--s5); }
.stage-io > div { border-top: 3px solid var(--line); padding-top: var(--s2); font-size: 14px; color: var(--ink-2); }
.stage-io > div b { display: block; color: var(--ink); font-size: 15px; }
.stage-io > div.on { border-top-color: var(--accent); }

/* --------------------------------------------------------------- responsive */
.nav-toggle { display: none; }
@media (max-width: 1180px) {
  .shell { grid-template-columns: 1fr; }
  .nav { position: fixed; inset-block: 0; inset-inline-start: 0; width: min(320px, 88vw); z-index: 45; transform: translateX(-105%); transition: transform .2s; box-shadow: var(--shadow-pop); }
  [dir="rtl"] .nav { transform: translateX(105%); }
  .nav.open { transform: none !important; }
  .nav-toggle { display: inline-grid; }
  .grid.side { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .page { padding: var(--s4) var(--s4) var(--s7); }
  .ctxbar { padding: var(--s2) var(--s4); }
  .ctx select { max-width: 150px; }
  .page-head h1 { font-size: var(--t-h2); }
  .grid.two, .grid.three, .form-grid, .stage-io { grid-template-columns: 1fr; }
  .journey { grid-template-columns: repeat(4, minmax(0, 1fr)); row-gap: var(--s3); }
  .journey::before { display: none; }
  .panel { padding: var(--s4); }
  .bridge .bar-row { grid-template-columns: 1fr minmax(80px, max-content); }
  .bridge .bar-row .track { grid-column: 1 / -1; }
  .kv { grid-template-columns: 1fr; }
}
@media print { .nav, .ctxbar, .page-actions, .toast-host { display: none !important; } .shell { display: block; } .panel { box-shadow: none; break-inside: avoid; } }

/* ------------------------------------------------------------ visual org chart */
.oc-wrap { overflow: auto; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--sunken); padding: var(--s4); max-height: 70vh; }
.oc-canvas { transform-origin: top center; width: max-content; min-width: 100%; transition: transform .15s; }
.oc, .oc ul { display: flex; justify-content: center; margin: 0; padding: 0; list-style: none; }
.oc ul { padding-top: 20px; position: relative; }
.oc li { position: relative; padding: 20px 6px 0; display: flex; flex-direction: column; align-items: center; }
.oc > li { padding-top: 0; }
.oc li::before, .oc li::after { content: ""; position: absolute; top: 0; inset-inline-end: 50%; width: 50%; height: 20px; border-top: 1px solid var(--control-line); }
.oc li::after { inset-inline-end: auto; inset-inline-start: 50%; border-inline-start: 1px solid var(--control-line); }
.oc li:only-child::before, .oc li:only-child::after { display: none; }
.oc li:only-child { padding-top: 0; }
.oc li:first-child::before, .oc li:last-child::after { border: 0 none; }
.oc li:last-child::before { border-inline-end: 1px solid var(--control-line); border-start-end-radius: 6px; }
.oc li:first-child::after { border-start-start-radius: 6px; }
.oc ul::before { content: ""; position: absolute; top: 0; inset-inline-start: 50%; height: 20px; border-inline-start: 1px solid var(--control-line); }
.oc > li::before, .oc > li::after { display: none; }
.oc-node { position: relative; min-width: 150px; max-width: 220px; background: var(--surface); border: 1px solid var(--line); border-block-start: 3px solid var(--accent); border-radius: var(--r); padding: 8px 10px 14px; text-align: center; cursor: pointer; box-shadow: var(--shadow); font-size: 14px; line-height: 1.4; }
.oc-node:hover { border-color: var(--accent-strong); }
.oc-node.has-issues { border-block-start-color: var(--bad); }
.oc-node.dim { opacity: .45; }
.oc-node.added { outline: 2px solid var(--ok); } .oc-node.moved { outline: 2px dashed var(--info); }
.oc-node.dragover { outline: 3px solid var(--focus); }
.oc-type { font-size: 12px; color: var(--ink-2); }
.oc-meta { font-size: 12px; color: var(--ink-2); margin-top: 2px; }
.oc-flag { display: inline-block; margin-top: 4px; font-size: 12px; color: var(--bad); background: var(--bad-wash); border-radius: 999px; padding: 0 8px; }
.oc-toggle { position: absolute; inset-block-end: -11px; inset-inline-start: calc(50% - 16px); min-width: 32px; height: 22px; border-radius: 11px; border: 1px solid var(--control-line); background: var(--surface); font-size: 12px; cursor: pointer; }
@media print { .oc-wrap { max-height: none; overflow: visible; } }

.oc-acts { margin-top: 6px; max-width: 220px; text-align: center; }
.oc-acts-toggle { font-size: 12px; border: 1px dashed var(--control-line); background: var(--surface); border-radius: 999px; padding: 1px 10px; cursor: pointer; color: var(--ink-2); }
.oc-acts ul { list-style: none; margin: 6px 0 0; padding: 0; display: grid; gap: 4px; }
.oc-acts ul::before, .oc-acts li::before, .oc-acts li::after { display: none; }
.oc-acts li { padding: 0; }
.oc-act { width: 100%; font-size: 12px; text-align: start; background: var(--accent-wash); border: 1px solid var(--line); border-radius: 6px; padding: 3px 8px; cursor: grab; color: var(--ink); }
.oc-act.moved { border-color: var(--info); background: var(--info-wash); }

/* Tabs between screens that share one sidebar entry */
.merge-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 16px; }
.merge-tab { font-size: 13.5px; text-decoration: none; padding: 6px 14px; border-radius: 999px; border: 1px solid var(--line); color: var(--ink-2); background: var(--surface); }
.merge-tab:hover { color: var(--ink); }
.merge-tab[aria-current="page"] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.merge-tab:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
