/* Layout concept: an archive reading-room — cool paper ground, deep ink-green for structure,
   ochre reserved for the chain of evidence (citations, sources, provenance). */
:root {
  --paper: #F4F6F9; --surface: #FFFFFF; --surface-2: #ECEFF4; --surface-3: #E1E6EE;
  --ink: #121A33; --ink-2: #464F69; --ink-3: #6B738C; --line: #D5DAE4; --line-2: #C1C8D6;
  --accent: #15297A; --accent-2: #0D1C4D; --on-accent: #FFFFFF; --accent-soft: #E1E7F6;
  --brand-navy: #0D1C4D; --brand-teal: #05AAAF; --teal-ink: #007E83; --teal-soft: #D9F2F2;
  --cite: #9A5F12; --cite-soft: #F5E8D2; --cite-line: #E4C99A;
  --good: #2C7A4B; --good-soft: #DCEFE2; --warn: #A15C00; --warn-soft: #FBEBD3; --bad: #B0281F; --bad-soft: #F8DEDB;
  --shadow: 0 1px 2px rgba(13, 28, 77, .06), 0 6px 20px rgba(13, 28, 77, .06);
  --f-ui: 'IBM Plex Sans', 'IBM Plex Sans Arabic', system-ui, -apple-system, 'Segoe UI', Tahoma, sans-serif;
  --f-ui-ar: 'IBM Plex Sans Arabic', 'IBM Plex Sans', Tahoma, system-ui, sans-serif;
  --f-display: 'Beiruti', 'IBM Plex Sans Arabic', system-ui, sans-serif;
  --f-doc: 'Literata', 'Noto Naskh Arabic', Georgia, 'Times New Roman', serif;
  --f-doc-ar: 'Noto Naskh Arabic', 'Literata', 'Times New Roman', serif;
  --f-mono: 'IBM Plex Mono', ui-monospace, Menlo, Consolas, monospace;
  --r: 8px; --r-sm: 5px; --gutter: max(16px, env(safe-area-inset-left, 0px));
  --fs: 15px; --topbar: 56px;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --paper: #0D1120; --surface: #141A2C; --surface-2: #1A2135; --surface-3: #222A41;
  --ink: #E6E9F2; --ink-2: #A9B0C5; --ink-3: #828AA2; --line: #283049; --line-2: #343D59;
  --accent: #3CC6C8; --accent-2: #6CD8D9; --on-accent: #04201F; --accent-soft: #12313A;
  --brand-navy: #E6E9F2; --brand-teal: #2CC6C9; --teal-ink: #5ED3D5; --teal-soft: #12313A;
  --cite: #E3AC55; --cite-soft: #3A2C17; --cite-line: #6B5226;
  --good: #6CC98E; --good-soft: #17301F; --warn: #E9A54A; --warn-soft: #3A2A12; --bad: #F08A80; --bad-soft: #3B1C19;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.25); color-scheme: dark; } }
:root[data-theme="dark"] {
  --paper: #0D1120; --surface: #141A2C; --surface-2: #1A2135; --surface-3: #222A41;
  --ink: #E6E9F2; --ink-2: #A9B0C5; --ink-3: #828AA2; --line: #283049; --line-2: #343D59;
  --accent: #3CC6C8; --accent-2: #6CD8D9; --on-accent: #04201F; --accent-soft: #12313A;
  --brand-navy: #E6E9F2; --brand-teal: #2CC6C9; --teal-ink: #5ED3D5; --teal-soft: #12313A;
  --cite: #E3AC55; --cite-soft: #3A2C17; --cite-line: #6B5226;
  --good: #6CC98E; --good-soft: #17301F; --warn: #E9A54A; --warn-soft: #3A2A12; --bad: #F08A80; --bad-soft: #3B1C19;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.25); color-scheme: dark; }

html, body { height: 100%; }
body { background: var(--paper); color: var(--ink); font-family: var(--f-ui); font-size: var(--fs); line-height: 1.55; -webkit-font-smoothing: antialiased; }
html[lang="ar"] body { font-family: var(--f-ui-ar); }
body.ts-small { --fs: 14px; } body.ts-large { --fs: 17px; }
body.spacing :lang(en) { letter-spacing: .02em; word-spacing: .08em; line-height: 1.75; }
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 50; background: var(--surface); }
* { box-sizing: border-box; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; text-wrap: balance; font-weight: 600; }
p { margin: 0; }
a { color: var(--accent); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 3px; }
.skip { position: absolute; inset-inline-start: 8px; top: -60px; background: var(--accent); color: var(--on-accent); padding: 8px 12px; border-radius: var(--r-sm); z-index: 100; }
.skip:focus { top: 8px; }
.num, .mono { font-family: var(--f-mono); font-variant-numeric: tabular-nums; unicode-bidi: isolate; direction: ltr; }
.osec .w, .wordtable td.n { direction: ltr; unicode-bidi: isolate; }
.tnum { font-variant-numeric: tabular-nums; }
.muted { color: var(--ink-2); } .faint { color: var(--ink-3); }
.small { font-size: .87em; } .tiny { font-size: .78em; }
.eyebrow { font-size: .75rem; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); font-weight: 600; }
html[lang="ar"] .eyebrow { letter-spacing: 0; text-transform: none; font-size: .82rem; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; } .row.top { align-items: flex-start; } .row.nowrap { flex-wrap: nowrap; }
.stack { display: grid; gap: 12px; } .stack.lg { gap: 20px; } .stack.sm { gap: 6px; }
.grow { flex: 1; min-width: 0; }
.hide { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- controls ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 36px; padding: 0 14px; border-radius: var(--r-sm); border: 1px solid var(--line-2); background: var(--surface); cursor: pointer; font-weight: 500; white-space: nowrap; text-decoration: none; color: var(--ink); transition: background .15s, border-color .15s; }
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.primary:hover { background: var(--accent-2); border-color: var(--accent-2); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.danger { color: var(--bad); }
.btn.sm { min-height: 30px; padding: 0 10px; font-size: .87em; }
.btn.icon { width: 34px; padding: 0; min-height: 34px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn svg { width: 16px; height: 16px; flex: none; }
label.field { display: grid; gap: 5px; font-weight: 500; font-size: .92em; }
label.field .hint { font-weight: 400; color: var(--ink-3); font-size: .9em; }
input[type=text], input[type=number], input[type=date], input[type=search], input:not([type]), select, textarea {
  width: 100%; min-height: 38px; padding: 7px 10px; border: 1px solid var(--line-2); border-radius: var(--r-sm); background: var(--surface); font-weight: 400; }
textarea { min-height: 96px; resize: vertical; line-height: 1.5; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: var(--accent); }
.check { display: inline-flex; gap: 8px; align-items: center; cursor: pointer; font-weight: 400; }
.check input { width: 17px; height: 17px; accent-color: var(--accent); }
.seg { display: inline-flex; border: 1px solid var(--line-2); border-radius: var(--r-sm); overflow: hidden; background: var(--surface); }
.seg button { border: 0; background: transparent; padding: 6px 12px; cursor: pointer; font-size: .88em; }
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: 999px; font-size: .78em; font-weight: 600; background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line); white-space: nowrap; }
.chip.good { background: var(--good-soft); color: var(--good); border-color: transparent; }
.chip.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.chip.bad { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.chip.cite { background: var(--cite-soft); color: var(--cite); border-color: transparent; }
.chip.accent { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; }
.card.flat { box-shadow: none; }
.panel-title { font-size: .8rem; font-weight: 700; color: var(--ink-2); letter-spacing: .06em; text-transform: uppercase; }
html[lang="ar"] .panel-title { letter-spacing: 0; text-transform: none; font-size: .9rem; }
hr.sep { border: 0; border-top: 1px solid var(--line); margin: 4px 0; width: 100%; }
.bar { height: 6px; background: var(--surface-3); border-radius: 99px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--accent); border-radius: 99px; }
.bar.over > i { background: var(--warn); }
.empty { padding: 28px; text-align: center; color: var(--ink-2); border: 1px dashed var(--line-2); border-radius: var(--r); display: grid; gap: 10px; justify-items: center; }
.notice { display: flex; gap: 10px; padding: 10px 12px; border-radius: var(--r-sm); background: var(--surface-2); border: 1px solid var(--line); font-size: .9em; color: var(--ink-2); align-items: flex-start; }
.notice.warn { background: var(--warn-soft); border-color: transparent; color: var(--ink); }
.notice.info { background: var(--accent-soft); border-color: transparent; color: var(--ink); }
.notice svg { flex: none; width: 18px; height: 18px; margin-top: 2px; }
.kbd { font-family: var(--f-mono); font-size: .8em; padding: 0 4px; border: 1px solid var(--line-2); border-radius: 3px; }

/* ---------- top bar ---------- */
.topbar { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 40; height: var(--topbar); background: var(--surface); border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 12px; padding-left: var(--gutter); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.brand { display: flex; align-items: center; gap: 8px; font-family: var(--f-display); font-weight: 700; font-size: 1.2rem; color: var(--ink); text-decoration: none; background: none; border: 0; cursor: pointer; padding: 0; }
.brand .ar { font-size: 1.25rem; }
.brand .sep { color: var(--line-2); font-weight: 400; }
.topnav { display: flex; gap: 2px; margin-inline-start: 12px; }
.topnav button, .topnav a { text-decoration: none; border: 0; background: none; padding: 8px 10px; border-radius: var(--r-sm); cursor: pointer; color: var(--ink-2); font-weight: 500; }
.topnav button[aria-current="page"], .topnav a[aria-current="page"] { color: var(--ink); background: var(--surface-2); }
.topnav button:hover, .topnav a:hover { color: var(--ink); }
.topbar .spacer { flex: 1; }
.bell { position: relative; }
.bell .dot { position: absolute; top: 5px; inset-inline-end: 5px; width: 8px; height: 8px; border-radius: 50%; background: var(--cite); }
.menu { position: absolute; inset-inline-end: 0; top: calc(100% + 6px); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); min-width: 220px; padding: 6px; z-index: 60; display: grid; }
.menu button { text-align: start; border: 0; background: none; padding: 8px 10px; border-radius: var(--r-sm); cursor: pointer; }
.menu button:hover { background: var(--surface-2); }
.rel { position: relative; }
@media (max-width: 760px) { .topnav { display: none; } .brand .en-name, .brand .sep { display: none; } }
.mobnav { display: none; }
@media (max-width: 760px) {
  .mobnav { display: flex; position: fixed; bottom: 0; inset-inline: 0; z-index: 45; background: var(--surface); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom, 0px); padding-left: max(0px, env(safe-area-inset-left, 0px)); padding-right: max(0px, env(safe-area-inset-right, 0px)); }
  .mobnav button, .mobnav a { text-decoration: none; flex: 1; border: 0; background: none; padding: 8px 4px 10px; font-size: .75rem; color: var(--ink-2); display: grid; justify-items: center; gap: 2px; cursor: pointer; }
  .mobnav button[aria-current="page"], .mobnav a[aria-current="page"] { color: var(--accent); }
  .mobnav svg { width: 20px; height: 20px; }
  .page { padding-bottom: 80px !important; }
}

/* ---------- pages ---------- */
main { min-height: calc(100% - var(--topbar)); }
.page { max-width: 1180px; margin: 0 auto; padding-block: 28px 56px; padding-left: var(--gutter); padding-right: max(16px, env(safe-area-inset-right, 0px)); display: grid; gap: 24px; }
.page.narrow { max-width: 820px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.page-head h1 { font-size: 1.65rem; font-family: var(--f-display); font-weight: 600; }
.grid-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 14px; }
.cols-2 { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 20px; align-items: start; }
@media (max-width: 900px) { .cols-2 { grid-template-columns: minmax(0, 1fr); } }

/* project cards */
.pcard { display: grid; gap: 12px; text-align: start; cursor: pointer; transition: border-color .15s, box-shadow .15s; }
.pcard:hover { border-color: var(--line-2); box-shadow: var(--shadow); }
.pcard h3 { font-size: 1.05rem; }
.pcard .meta { display: flex; flex-wrap: wrap; gap: 6px; }
.pcard .stats { display: flex; gap: 16px; font-size: .85em; color: var(--ink-2); }

/* ---------- landing ---------- */
.land { display: grid; gap: 0; }
.land section { padding-block: 56px; padding-left: var(--gutter); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.land .wrap { max-width: 1120px; margin: 0 auto; display: grid; gap: 28px; }
.hero { background: var(--surface); border-bottom: 1px solid var(--line); }
.hero .wrap { grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); align-items: center; gap: 40px; }
@media (max-width: 920px) { .hero .wrap { grid-template-columns: minmax(0, 1fr); } }
.hero h1 { font-family: var(--f-display); font-size: clamp(2.2rem, 4.8vw, 3.5rem); font-weight: 800; line-height: 1.1; letter-spacing: -.01em; }
html[lang="ar"] .hero h1 { line-height: 1.3; letter-spacing: 0; font-size: clamp(2.4rem, 5.2vw, 3.8rem); }
.hero p.lead { font-size: 1.12rem; color: var(--ink-2); max-width: 54ch; }
.chain { display: flex; flex-wrap: wrap; gap: 0; align-items: center; }
.chain span { font-size: .84rem; padding: 6px 12px; border: 1px solid var(--line-2); border-radius: 999px; background: var(--surface); margin: 4px 0; white-space: nowrap; }
.chain i { width: 14px; height: 1px; background: var(--cite-line); display: inline-block; }
.chain span.hot { background: var(--cite-soft); border-color: var(--cite-line); color: var(--cite); font-weight: 600; }
.features { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.features > div { background: var(--surface); padding: 22px; display: grid; gap: 8px; align-content: start; }
.features h3 { font-size: 1.05rem; }
.features svg { width: 22px; height: 22px; color: var(--accent); }
@media (max-width: 860px) { .features { grid-template-columns: minmax(0, 1fr); } }
.principle { font-family: var(--f-display); font-weight: 500; font-size: clamp(1.45rem, 2.8vw, 2rem); line-height: 1.4; max-width: 36ch; }
.faq details { border-bottom: 1px solid var(--line); padding: 14px 0; }
.faq summary { cursor: pointer; font-weight: 600; }
.faq details p { margin-top: 8px; color: var(--ink-2); max-width: 70ch; }
.foot { background: var(--surface-2); font-size: .9em; color: var(--ink-2); }

/* product preview (built from real UI pieces) */
.preview { border: 1px solid var(--line-2); border-radius: 10px; background: var(--paper); box-shadow: var(--shadow); overflow: hidden; font-size: 12.5px; }
.preview .pv-bar { display: flex; gap: 6px; padding: 8px 10px; border-bottom: 1px solid var(--line); background: var(--surface); }
.preview .pv-bar i { width: 8px; height: 8px; border-radius: 50%; background: var(--line-2); }
.preview .pv-body { display: grid; grid-template-columns: 1.05fr 1.5fr 1fr; min-height: 300px; }
.preview .pv-col { padding: 12px; border-inline-end: 1px solid var(--line); display: grid; gap: 8px; align-content: start; min-width: 0; }
.preview .pv-col:last-child { border: 0; background: var(--surface); }
.preview .pv-doc { background: var(--surface); font-family: var(--f-doc); font-size: 13px; line-height: 1.6; }
html[lang="ar"] .preview .pv-doc { font-family: var(--f-doc-ar); }
.pv-sec { display: grid; gap: 0; padding: 4px 6px; border-radius: 4px; min-width: 0; }
.pv-sec span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pv-sec .mono { font-size: 10.5px; }
.pv-sec.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
@media (max-width: 560px) { .preview .pv-body { grid-template-columns: 1fr; } .preview .pv-col:first-child, .preview .pv-col:last-child { display: none; } }

/* ---------- wizard ---------- */
.wizard { max-width: 760px; }
.steps { display: flex; gap: 6px; }
.steps i { flex: 1; height: 4px; border-radius: 4px; background: var(--surface-3); }
.steps i.on { background: var(--accent); }
.choice-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 210px), 1fr)); gap: 8px; }
.choice { text-align: start; border: 1px solid var(--line-2); background: var(--surface); border-radius: var(--r-sm); padding: 10px 12px; cursor: pointer; font-size: .92em; }
.choice[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); color: var(--ink); box-shadow: inset 0 0 0 1px var(--accent); }
.choice small { display: block; color: var(--ink-3); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
@media (max-width: 640px) { .form-grid { grid-template-columns: minmax(0, 1fr); } }
.form-grid .full { grid-column: 1 / -1; }
.req-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; padding: 10px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); }
.req-row.conflict { border-color: var(--warn); background: var(--warn-soft); }

/* ---------- project shell ---------- */
.phead { background: var(--surface); border-bottom: 1px solid var(--line); padding-left: var(--gutter); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.phead .inner { max-width: 1400px; margin: 0 auto; display: grid; gap: 4px; padding-top: 12px; }
.phead h1 { font-size: 1.15rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tabs { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; margin-bottom: -1px; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { border: 0; background: none; padding: 10px 12px; cursor: pointer; color: var(--ink-2); border-bottom: 2px solid transparent; white-space: nowrap; font-weight: 500; }
.tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); }

/* ---------- studio ---------- */
.studio { display: grid; grid-template-columns: 270px minmax(0, 1fr) 360px; height: calc(100dvh - var(--topbar) - 92px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px)); min-height: 520px; }
.studio.focus { grid-template-columns: 0 minmax(0, 1fr) 0; }
.studio.focus .nav, .studio.focus .side { display: none; }
.studio > * { min-width: 0; min-height: 0; }
.nav { border-inline-end: 1px solid var(--line); background: var(--surface); overflow-y: auto; padding: 14px 10px 30px; display: grid; gap: 14px; align-content: start; }
.side { border-inline-start: 1px solid var(--line); background: var(--surface); display: flex; flex-direction: column; min-height: 0; }
.side .side-tabs { display: flex; border-bottom: 1px solid var(--line); }
.side .side-tabs button { flex: 1; border: 0; background: none; padding: 10px 4px; cursor: pointer; color: var(--ink-2); font-weight: 500; border-bottom: 2px solid transparent; }
.side .side-tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); }
.side .side-body { flex: 1; overflow-y: auto; padding: 14px; display: grid; gap: 14px; align-content: start; }
.studio-mob { display: none; }
@media (max-width: 1100px) { .studio { grid-template-columns: 230px minmax(0, 1fr) 320px; } }
@media (max-width: 900px) {
  .studio { display: block; height: auto; min-height: 0; }
  .studio .nav, .studio .side, .studio .center { display: none; }
  .studio[data-pane="nav"] .nav, .studio[data-pane="side"] .side, .studio[data-pane="center"] .center { display: flex; flex-direction: column; }
  .studio[data-pane="nav"] .nav { display: grid; border: 0; }
  .studio .side { border: 0; min-height: 70vh; }
  .studio-mob { display: flex; position: sticky; top: calc(var(--topbar) + env(safe-area-inset-top, 0px)); z-index: 30; background: var(--surface); border-bottom: 1px solid var(--line); }
  .studio-mob button { flex: 1; border: 0; background: none; padding: 10px; font-weight: 600; color: var(--ink-2); border-bottom: 2px solid transparent; cursor: pointer; }
  .studio-mob button[aria-selected="true"] { color: var(--accent); border-bottom-color: var(--accent); }
}
.outline { display: grid; gap: 2px; }
.osec { display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; padding: 7px 8px; border-radius: var(--r-sm); cursor: pointer; border: 1px solid transparent; text-align: start; background: none; width: 100%; }
.osec:hover { background: var(--surface-2); }
.osec[aria-current="true"] { background: var(--accent-soft); border-color: transparent; }
.osec .t { font-size: .9em; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.osec .w { font-family: var(--f-mono); font-size: .72em; color: var(--ink-3); align-self: center; }
.osec .bar { grid-column: 1 / -1; height: 3px; }
.osec .st { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-inline-end: 6px; background: var(--line-2); }
.osec .st.draft { background: var(--warn); } .osec .st.review { background: var(--cite); } .osec .st.done { background: var(--good); }
.osec.refs .t { color: var(--cite); }
.center { display: flex; flex-direction: column; background: var(--paper); min-height: 0; }
.toolbar { display: flex; gap: 2px; padding: 6px 10px; border-bottom: 1px solid var(--line); background: var(--surface); flex-wrap: nowrap; overflow-x: auto; scrollbar-width: thin; align-items: center; }
.toolbar > * { flex: none; }
.toolbar .btn { min-height: 32px; }
.toolbar .tsep { width: 1px; height: 20px; background: var(--line); margin: 0 4px; }
.toolbar select { width: auto; min-height: 32px; padding: 2px 6px; }
.docscroll { flex: 1; overflow-y: auto; padding: 28px var(--gutter) 80px; }
.sheet { max-width: 760px; margin: 0 auto; background: var(--surface); border: 1px solid var(--line); border-radius: 4px; padding: 44px clamp(18px, 6vw, 64px) 64px; min-height: 60vh; }
.sheet .sec-eyebrow { display: flex; justify-content: space-between; gap: 8px; align-items: center; margin-bottom: 8px; flex-wrap: wrap; }
.sheet h1.sec-title { font-family: var(--f-doc); font-size: 1.6rem; font-weight: 600; margin-bottom: 18px; outline: none; }
.sheet[dir="rtl"] h1.sec-title { font-family: var(--f-doc-ar); }
.editor { font-family: var(--f-doc); font-size: 1.06rem; line-height: 1.75; outline: none; min-height: 320px; color: var(--ink); overflow-wrap: anywhere; }
.editor:lang(ar), .sheet[dir="rtl"] .editor { font-family: var(--f-doc-ar); font-size: 1.12rem; line-height: 1.95; }
.editor:empty::before { content: attr(data-ph); color: var(--ink-3); }
.editor p { margin: 0 0 .9em; }
.editor h2 { font-size: 1.25rem; margin: 1.4em 0 .5em; }
.editor h3 { font-size: 1.08rem; margin: 1.2em 0 .4em; }
.editor blockquote { margin: 1em 0; padding-inline-start: 18px; border-inline-start: 3px solid var(--line-2); color: var(--ink-2); }
.editor ul, .editor ol { padding-inline-start: 1.4em; }
.editor table { border-collapse: collapse; width: 100%; margin: 1em 0; font-size: .92em; }
.editor td, .editor th { border: 1px solid var(--line-2); padding: 6px 8px; vertical-align: top; min-width: 40px; }
.editor th { background: var(--surface-2); }
.editor figure { margin: 1.2em 0; text-align: center; }
.editor figure img { max-width: 100%; border: 1px solid var(--line); }
.editor figcaption, .editor .tcap { font-size: .88em; font-style: italic; color: var(--ink-2); margin-top: 6px; }
.cite { background: var(--cite-soft); color: var(--cite); border-radius: 3px; padding: 0 3px; cursor: pointer; white-space: nowrap; font-family: var(--f-ui); font-size: .86em; font-weight: 500; border-bottom: 1px solid var(--cite-line); }
.cite.missing { background: var(--bad-soft); color: var(--bad); border-color: var(--bad); }
.cite sup { font-size: .8em; }
.fn { color: var(--accent); cursor: pointer; font-family: var(--f-ui); font-size: .72em; vertical-align: super; font-weight: 700; padding: 0 1px; }
mark.cmt { background: color-mix(in srgb, var(--warn) 25%, transparent); color: inherit; border-bottom: 2px solid var(--warn); cursor: help; }
.save-state { font-size: .8em; color: var(--ink-3); display: inline-flex; gap: 6px; align-items: center; }
.save-state i { width: 7px; height: 7px; border-radius: 50%; background: var(--good); }
.save-state.dirty i { background: var(--warn); } .save-state.err i { background: var(--bad); }
.wordbar { display: flex; gap: 14px; align-items: center; padding: 6px 14px; border-top: 1px solid var(--line); background: var(--surface); font-size: .82em; color: var(--ink-2); flex-wrap: wrap; }
.wordbar .bar { width: 120px; }
.refs-view .ref { padding-inline-start: 2em; text-indent: -2em; margin-bottom: .7em; font-family: var(--f-doc); font-size: 1rem; line-height: 1.6; overflow-wrap: anywhere; }
.refs-view .ref:lang(ar) { font-family: var(--f-doc-ar); }

/* guide + mentor */
.gblock { display: grid; gap: 6px; }
.gblock ul { margin: 0; padding-inline-start: 1.2em; display: grid; gap: 4px; font-size: .92em; }
.gblock p { font-size: .93em; }
.qlist li { color: var(--ink); }
.mentor-modes { display: flex; gap: 4px; flex-wrap: wrap; }
.mentor-modes button { border: 1px solid var(--line-2); background: var(--surface); border-radius: 999px; padding: 3px 10px; font-size: .8em; cursor: pointer; }
.mentor-modes button[aria-pressed="true"] { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.qa-list { display: flex; flex-wrap: wrap; gap: 6px; }
.qa-list button { border: 1px dashed var(--line-2); background: var(--surface); border-radius: var(--r-sm); padding: 5px 9px; font-size: .82em; cursor: pointer; text-align: start; }
.qa-list button:hover { border-style: solid; border-color: var(--accent); color: var(--accent); }
.msg { display: grid; gap: 6px; font-size: .92em; }
.msg.user { background: var(--surface-2); padding: 8px 10px; border-radius: var(--r-sm); }
.msg .md p { margin: 0 0 .5em; } .msg .md ul, .msg .md ol { margin: 0 0 .5em; padding-inline-start: 1.2em; }
.msg .md h4 { font-size: .95em; margin: .6em 0 .3em; }
.point { border: 1px solid var(--line); border-radius: var(--r-sm); padding: 10px; display: grid; gap: 6px; background: var(--surface); }
.point.dismissed { opacity: .45; }
.point blockquote { margin: 0; padding-inline-start: 8px; border-inline-start: 2px solid var(--cite-line); color: var(--ink-2); font-size: .9em; font-family: var(--f-doc); }
.diff { font-family: var(--f-doc); line-height: 1.7; padding: 10px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); }
.diff del { background: var(--bad-soft); color: var(--bad); text-decoration: line-through; }
.diff ins { background: var(--good-soft); color: var(--good); text-decoration: none; }

/* library */
.src { display: grid; gap: 6px; padding: 14px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); }
.src .t { font-weight: 600; line-height: 1.35; }
.src .by { font-size: .88em; color: var(--ink-2); }
.src .ref { font-family: var(--f-doc); font-size: .9em; color: var(--ink-2); overflow-wrap: anywhere; }
.src .ref:lang(ar) { font-family: var(--f-doc-ar); }
.prov { display: flex; flex-wrap: wrap; gap: 6px; }
.dblinks { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 170px), 1fr)); gap: 8px; }
.dblinks a { display: grid; gap: 2px; padding: 10px 12px; border: 1px solid var(--line-2); border-radius: var(--r-sm); text-decoration: none; color: var(--ink); background: var(--surface); }
.dblinks a:hover { border-color: var(--accent); }
.dblinks a small { color: var(--ink-3); }
.reader-text { font-family: var(--f-doc); line-height: 1.75; font-size: .98rem; white-space: pre-wrap; overflow-wrap: anywhere; }
.reader-text:lang(ar) { font-family: var(--f-doc-ar); }
.reader-text .pg { display: block; font-family: var(--f-mono); font-size: .72rem; color: var(--cite); margin: 1em 0 .3em; border-top: 1px dashed var(--cite-line); padding-top: 4px; }
.reader-text mark { background: var(--cite-soft); color: inherit; }
.excerpt { border-inline-start: 3px solid var(--cite-line); padding: 6px 10px; display: grid; gap: 4px; background: var(--surface-2); border-radius: 0 var(--r-sm) var(--r-sm) 0; }
html[dir="rtl"] .excerpt { border-radius: var(--r-sm) 0 0 var(--r-sm); }
.excerpt.quote .x { font-family: var(--f-doc); }
.excerpt.paraphrase { border-color: var(--accent); }
.excerpt.own { border-color: var(--ink-3); }

/* quality */
.issue { display: grid; grid-template-columns: 6px 1fr; gap: 0 12px; padding: 12px 14px 12px 0; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); }
.issue::before { content: ""; grid-row: 1 / span 3; border-radius: 4px 0 0 4px; background: var(--line-2); }
html[dir="rtl"] .issue { padding: 12px 0 12px 14px; }
html[dir="rtl"] .issue::before { border-radius: 0 4px 4px 0; }
.issue.high::before { background: var(--bad); } .issue.med::before { background: var(--warn); } .issue.low::before { background: var(--ink-3); }
.issue .m { font-weight: 600; } .issue .f { color: var(--ink-2); font-size: .9em; }
.gauge { display: grid; gap: 4px; }
.gauge .n { font-family: var(--f-display); font-size: 2.6rem; font-weight: 600; line-height: 1; }

/* academy */
.course { display: grid; gap: 10px; cursor: pointer; text-align: start; }
.course .ix { font-family: var(--f-mono); color: var(--cite); font-size: .85em; }
.lesson-body { font-family: var(--f-doc); font-size: 1.05rem; line-height: 1.8; max-width: 68ch; display: grid; gap: 1em; }
html[lang="ar"] .lesson-body { font-family: var(--f-doc-ar); font-size: 1.1rem; line-height: 1.95; }
.example { border-inline-start: 3px solid var(--cite); padding: 10px 14px; background: var(--cite-soft); border-radius: 0 var(--r-sm) var(--r-sm) 0; font-family: var(--f-doc); }
html[dir="rtl"] .example { border-radius: var(--r-sm) 0 0 var(--r-sm); }
.video-ph { aspect-ratio: 16 / 7; max-width: 100%; border: 1px dashed var(--line-2); border-radius: var(--r); display: grid; place-content: center; text-align: center; gap: 6px; padding: 16px; background: repeating-linear-gradient(135deg, var(--surface) 0 12px, var(--surface-2) 12px 24px); color: var(--ink-2); }
.quiz-q { display: grid; gap: 6px; }
.quiz-q label { display: flex; gap: 8px; align-items: flex-start; padding: 6px 8px; border-radius: var(--r-sm); cursor: pointer; }
.quiz-q label.right { background: var(--good-soft); } .quiz-q label.wrong { background: var(--bad-soft); }

/* templates */
.ttable { overflow-x: auto; }
.ttable table { border-collapse: collapse; min-width: 640px; width: 100%; }
.ttable th, .ttable td { border: 1px solid var(--line); padding: 4px; vertical-align: top; text-align: start; }
.ttable th { background: var(--surface-2); font-size: .85em; padding: 8px; }
.ttable textarea { min-height: 60px; border: 0; padding: 4px; font-size: .9em; }
.ttable tr.sample td { color: var(--ink-3); font-style: italic; font-size: .85em; padding: 8px; }

/* overlays */
.overlay { position: fixed; inset: 0; background: rgba(10, 16, 14, .45); z-index: 80; display: grid; place-items: center; padding: 16px; padding-top: max(16px, env(safe-area-inset-top, 0px)); padding-bottom: max(16px, env(safe-area-inset-bottom, 0px)); }
.dialog { background: var(--surface); border-radius: 10px; box-shadow: var(--shadow); width: min(560px, 100%); max-height: 88dvh; overflow-y: auto; padding: 22px; display: grid; gap: 14px; border: 1px solid var(--line); }
.dialog.wide { width: min(880px, 100%); }
.dialog h2 { font-size: 1.15rem; }
.dialog .actions { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.toasts { position: fixed; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); inset-inline-start: 50%; transform: translateX(-50%); z-index: 90; display: grid; gap: 8px; justify-items: center; pointer-events: none; width: min(92vw, 520px); }
html[dir="rtl"] .toasts { transform: translateX(50%); }
.toast { background: var(--ink); color: var(--surface); padding: 9px 14px; border-radius: var(--r-sm); font-size: .9em; box-shadow: var(--shadow); pointer-events: auto; }
.toast.err { background: var(--bad); color: #fff; }
.popover { position: fixed; z-index: 85; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); padding: 12px; width: min(330px, calc(100vw - 32px)); display: grid; gap: 10px; }
.spin { width: 16px; height: 16px; border: 2px solid var(--line-2); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; display: inline-block; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition: none !important; } }
body.reduce-motion *, body.reduce-motion *::before { animation-duration: .01ms !important; transition: none !important; }
.wordtable { width: 100%; border-collapse: collapse; font-size: .9em; }
.wordtable td { padding: 7px 4px; border-bottom: 1px solid var(--line); }
.wordtable td.n { text-align: end; font-family: var(--f-mono); font-size: .9em; white-space: nowrap; }
.wordtable .bar { min-width: 60px; }
.table-wrap { overflow-x: auto; }
.bp-item { display: grid; gap: 8px; padding: 16px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); }
.bp-item .why { font-size: .86em; color: var(--ink-2); background: var(--surface-2); padding: 8px 10px; border-radius: var(--r-sm); }
.sugg { border: 1px dashed var(--accent); background: var(--accent-soft); border-radius: var(--r-sm); padding: 10px; display: grid; gap: 6px; }
.list-edit { display: grid; gap: 6px; }
.list-edit .li { display: flex; gap: 6px; align-items: center; }
.list-edit .li input { flex: 1; }
.task { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.task.done .tt { text-decoration: line-through; color: var(--ink-3); }
.ms { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px dashed var(--line); }
.ms .d { font-family: var(--f-mono); font-size: .82em; color: var(--ink-2); }
.pv-export { font-family: var(--f-doc); line-height: 1.7; }
.pv-export:lang(ar) { font-family: var(--f-doc-ar); }
.pdf-root { position: fixed; left: -10000px; top: 0; width: 794px; background: #fff; color: #111; padding: 72px; font-family: var(--f-doc); font-size: 12pt; line-height: 1.6; }
.pdf-root[dir="rtl"] { font-family: var(--f-doc-ar); }
.pdf-root h1 { font-size: 18pt; margin: 18pt 0 8pt; } .pdf-root h2 { font-size: 14pt; margin: 14pt 0 6pt; } .pdf-root h3 { font-size: 12pt; }
.pdf-root .cite { background: none; color: inherit; border: 0; font-family: inherit; font-size: inherit; padding: 0; }
.pdf-root .ref { padding-inline-start: 2em; text-indent: -2em; margin-bottom: 6pt; }
.pdf-root .tp { text-align: center; padding-top: 220px; min-height: 1000px; }
.pdf-root table { border-collapse: collapse; width: 100%; } .pdf-root td, .pdf-root th { border: 1px solid #999; padding: 4px; }

html[dir="rtl"] .flip svg { transform: scaleX(-1); }

.phead .row.between { min-width: 0; }
.phead .row.between > .row { flex: 1; min-width: 0; }
.phead h1 { min-width: 0; }
.save-state { flex: none; }
.center, .toolbar, .docscroll { min-width: 0; max-width: 100%; }
@media (max-width: 600px) { .save-state { font-size: 0; gap: 0; } .save-state i { font-size: initial; } }

/* headings in the display face (Beiruti) */
.page-head h1, .h2d, .land h2, .land h3, .features h3, .phead h1, .dialog h2, .card > h2 { font-family: var(--f-display); }
.page-head h1 { font-weight: 700; font-size: 1.85rem; }
.h2d, .land h2 { font-weight: 700; }
.brand { font-weight: 800; }
/* plans */
.plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 210px), 1fr)); gap: 14px; align-items: stretch; }
.plans.compact { grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); }
.plan { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 22px 18px; display: grid; gap: 6px; align-content: start; }
.plan.featured { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent), var(--shadow); }
.plan h3 { font-family: var(--f-display); font-size: 1.3rem; font-weight: 700; }
.plan-badge { position: absolute; top: -11px; inset-inline-start: 16px; background: var(--accent); color: var(--on-accent); font-size: .74rem; font-weight: 600; padding: 2px 10px; border-radius: 999px; }
.price { display: flex; align-items: baseline; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.price .amt { font-family: var(--f-display); font-size: 2.4rem; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; direction: ltr; unicode-bidi: isolate; }
.plan-feats { list-style: none; margin: 10px 0 0; padding: 12px 0 0; border-top: 1px solid var(--line); display: grid; gap: 7px; font-size: .88em; color: var(--ink-2); }
.plan-feats .v { color: var(--ink); font-weight: 600; font-family: var(--f-ui); }
table.cmp { width: 100%; border-collapse: collapse; font-size: .9em; min-width: 680px; }
table.cmp th, table.cmp td { padding: 9px 10px; border-bottom: 1px solid var(--line); text-align: start; vertical-align: top; }
table.cmp thead th { font-weight: 600; color: var(--ink-2); font-size: .85em; }
table.cmp tbody th { font-weight: 500; }
table.cmp .feat { background: var(--accent-soft); }
table.cmp .yes { color: var(--good); display: inline-flex; }
table.cmp tr.ours { background: var(--cite-soft); }

.wordmark { font-family: 'Beiruti', var(--f-ui); font-weight: 800; font-size: 1.32rem; letter-spacing: -.01em; color: var(--ink); }
.wordmark span { color: var(--accent); }

.vid { margin: 0; display: grid; gap: 6px; }
.vid video { width: 100%; max-width: 100%; aspect-ratio: 16 / 9; border-radius: var(--r); border: 1px solid var(--line); background: #0d1120; }

/* ---------- landing v2 ---------- */
.fwd svg { transform: scaleX(-1); }
html[dir="rtl"] .flip.fwd svg { transform: none; }
.land .sec-head h2 { font-family: var(--f-display); font-weight: 700; font-size: clamp(1.6rem, 3vw, 2.2rem); line-height: 1.2; }
.land .lead2 { max-width: 62ch; font-size: 1.05rem; }
.land section.band { background: var(--surface); border-block: 1px solid var(--line); }
.hero-shot { min-width: 0; }
.bframe { border: 1px solid var(--line-2); border-radius: 10px; overflow: hidden; background: var(--surface); box-shadow: 0 2px 4px rgba(13,28,77,.06), 0 18px 40px rgba(13,28,77,.12); }
.bframe-bar { display: flex; gap: 6px; align-items: center; padding: 8px 12px; border-bottom: 1px solid var(--line); background: var(--surface-2); direction: ltr; }
.bframe-bar i { width: 9px; height: 9px; border-radius: 50%; background: var(--line-2); flex: none; }
.bframe-url { margin-inline-start: 10px; font-family: var(--f-mono); font-size: .72rem; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bframe-body img { display: block; width: 100%; height: auto; aspect-ratio: 1440 / 900; object-fit: cover; object-position: top; background: var(--surface-2); }
.facts { padding-block: 22px !important; border-bottom: 1px solid var(--line); background: var(--paper); }
.factrow { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; margin: 0; }
.factrow > div { display: grid; gap: 2px; }
.factrow dt { font-family: 'Beiruti', var(--f-display); font-size: 2.1rem; font-weight: 800; color: var(--accent); line-height: 1; }
.factrow dd { margin: 0; color: var(--ink-2); font-size: .9rem; }
@media (max-width: 720px) { .factrow { grid-template-columns: repeat(3, minmax(0, 1fr)); row-gap: 16px; } }
.tour-sec { background: var(--surface-2); border-block: 1px solid var(--line); }
.tour-tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: thin; }
.tour-tabs button { flex: none; display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line-2); background: var(--surface); border-radius: 999px; padding: 7px 13px; cursor: pointer; font-weight: 500; color: var(--ink-2); }
.tour-tabs button[aria-selected="true"] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.tour-stage { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); gap: 32px; align-items: center; }
@media (max-width: 920px) { .tour-stage { grid-template-columns: minmax(0, 1fr); } }
.tour-copy h3 { font-family: var(--f-display); font-size: 1.7rem; font-weight: 700; }
.ticks { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.ticks li { display: flex; gap: 8px; align-items: flex-start; }
.ticks .ic { color: var(--good); margin-top: 3px; }
.steps4 { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; background: var(--line); }
.steps4 li { background: var(--surface); padding: 22px; display: grid; gap: 8px; align-content: start; margin: 0 0 0 1px; }
html[dir="rtl"] .steps4 li { margin: 0 1px 0 0; }
.steps4 li:first-child { margin: 0; }
.steps4 .n { font-family: 'Beiruti', var(--f-display); font-size: 2.4rem; font-weight: 800; color: var(--cite); line-height: 1; }
.steps4 h3 { font-family: var(--f-display); font-size: 1.2rem; font-weight: 700; }
@media (max-width: 860px) { .steps4 { grid-template-columns: minmax(0, 1fr); gap: 1px; } .steps4 li, html[dir="rtl"] .steps4 li { margin: 0; } }
.aud { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 24px; }
.aud > div { display: grid; gap: 8px; align-content: start; border-top: 2px solid var(--accent); padding-top: 14px; }
.aud h3 { font-family: var(--f-display); font-size: 1.2rem; font-weight: 700; }
.aud-n { font-family: var(--f-mono); color: var(--cite); font-size: .8rem; }
@media (max-width: 920px) { .aud { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 520px) { .aud { grid-template-columns: minmax(0, 1fr); } }
table.cmp.vs { min-width: 560px; font-size: .95em; }
table.cmp.vs td, table.cmp.vs th { padding: 12px 14px; }
.acad-row { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 28px; align-items: start; }
@media (max-width: 900px) { .acad-row { grid-template-columns: minmax(0, 1fr); } }
.course-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.course-list button { width: 100%; display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; text-align: start; border: 0; border-bottom: 1px solid var(--line); background: none; padding: 9px 4px; cursor: pointer; color: var(--ink); }
.course-list button:hover { background: var(--surface-2); }
.course-list .ix { font-family: var(--f-mono); color: var(--cite); font-size: .82rem; }
.cta-band { background: #0D1C4D; color: #fff; border-top: 4px solid #05AAAF; }
.cta-band h2 { font-family: var(--f-display); font-size: clamp(1.6rem, 3vw, 2.2rem); font-weight: 700; color: #fff; }
.cta-band .btn { border-color: #fff; }
.cta-band .btn.primary { background: #05AAAF; border-color: #05AAAF; color: #0D1C4D; }
.cta-band .btn:not(.primary) { background: transparent; color: #fff; }

.factrow dt.num { direction: inherit; unicode-bidi: normal; }
main:focus { outline: none; }
.bframe-url { font-family: var(--f-ui); }

/* ---------- collaboration ---------- */
.av { border-radius: 50%; object-fit: cover; border: 2px solid var(--line-2); flex: none; background: var(--surface-2); }
.av-i { display: inline-grid; place-items: center; color: #fff; font-weight: 700; border: 2px solid var(--surface); font-family: var(--f-ui); }
.av-stack { display: inline-flex; }
.av-stack > * { margin-inline-start: -6px; box-shadow: 0 0 0 2px var(--surface); }
.av-stack > *:first-child { margin-inline-start: 0; }
.av-wrap { position: relative; display: inline-flex; }
.av-wrap .online { position: absolute; bottom: 0; inset-inline-end: 0; width: 10px; height: 10px; border-radius: 50%; background: var(--good); box-shadow: 0 0 0 2px var(--surface); }
.member { display: flex; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.member:last-of-type { border-bottom: 0; }
.pdots { display: inline-flex; gap: 2px; margin-inline-start: 6px; vertical-align: middle; align-items: center; }
.lockico { color: var(--warn); display: inline-flex; }
.lockbar { display: flex; gap: 10px; align-items: center; padding: 8px 14px; font-size: .88em; background: var(--surface-2); border-bottom: 1px solid var(--line); color: var(--ink-2); flex-wrap: wrap; }
.lockbar.mine { background: var(--good-soft); color: var(--ink); }
.lockbar.busy { background: var(--warn-soft); color: var(--ink); }
.lockbar.ro { background: var(--accent-soft); color: var(--ink); }
.lockbar .grow { flex: 1; }
.toolbar.locked { opacity: .45; pointer-events: none; }
.editor.readonly { cursor: default; }
.codebox { display: flex; gap: 8px; align-items: center; background: var(--surface-2); border: 1px dashed var(--line-2); border-radius: var(--r-sm); padding: 8px 10px; }
.codebox code { flex: 1; min-width: 0; overflow-wrap: anywhere; font-family: var(--f-mono); font-size: .82em; }
.feed { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.feed li { display: flex; gap: 10px; align-items: flex-start; }
.cm-thread { border: 1px solid var(--line); border-radius: var(--r-sm); padding: 10px; display: grid; gap: 8px; background: var(--surface); }
.cm-thread.resolved { opacity: .65; }
.cm-item { display: grid; gap: 4px; }
.cm-item + .cm-item { border-top: 1px dashed var(--line); padding-top: 8px; margin-inline-start: 14px; }
.cm-quote { margin: 0; padding: 4px 8px; border-inline-start: 3px solid var(--warn); background: var(--warn-soft); font-family: var(--f-doc); font-size: .86em; color: var(--ink); cursor: pointer; border-radius: 0 4px 4px 0; }
::highlight(rf-comments) { background-color: rgba(233, 165, 74, .32); }
table.contrib { min-width: 620px; font-size: .86em; }
.gate-ico .ic svg { width: 40px; height: 40px; color: var(--accent); }
.role-note { margin-bottom: 4px; }

/* Brand (vector logo) */
.b-navy { fill: var(--brand-navy); } .b-teal { fill: var(--brand-teal); }
.brand-lock { display: inline-flex; align-items: center; gap: 10px; }
.brand-lock .b-mark { width: auto; height: 28px; }
.brand-lock .b-en { width: auto; height: 15px; }
.brand-lock .b-ar { width: auto; height: 27px; margin-top: 3px; }
.ic .b-mark { width: auto; height: 1.25em; }
.foot-lock { display: inline-flex; } .foot-lock svg { width: auto; height: 52px; }
@media (max-width: 420px) { .brand-lock .b-en { height: 12px; } .brand-lock .b-ar { height: 22px; } }

/* Research guides marketplace */
.mk-tabs { border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.mk-filters { gap: 8px; } .mk-filters input[type=search] { flex: 1 1 260px; min-width: 0; } .mk-filters select { width: auto; flex: 0 1 200px; }
.mk-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 14px; }
.mk-card { display: flex; flex-direction: column; gap: 10px; }
.mk-card .ticks { margin: 0; }
.mk-av { flex: none; width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; background: var(--brand-navy); color: var(--paper); font-weight: 700; font-size: .9rem; letter-spacing: .02em; box-shadow: inset 0 -3px 0 var(--brand-teal); }
.mk-av.lg { width: 76px; height: 76px; font-size: 1.5rem; box-shadow: inset 0 -5px 0 var(--brand-teal); }
.stars { color: #E3A008; letter-spacing: 1px; white-space: nowrap; } .stars .off { color: var(--line-2); }
.mk-hero { display: flex; gap: 20px; align-items: flex-start; flex-wrap: wrap; }
.mk-facts { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; margin: 0; }
.mk-facts dt { color: var(--ink-3); } .mk-facts dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.mk-cols { align-items: start; }
.mk-prices { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.mk-prices li { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 6px 0; border-bottom: 1px dashed var(--line); }
.mk-total { padding: 12px; border-radius: var(--r-sm); background: var(--surface-2); }
.mk-amt { font-size: 1.25rem; font-variant-numeric: tabular-nums; }
.mk-steps { list-style: none; padding: 0; margin: 0; display: flex; gap: 6px; flex-wrap: wrap; counter-reset: s; }
.mk-steps li { counter-increment: s; font-size: .78em; padding: 3px 10px 3px 6px; border-radius: 999px; background: var(--surface-2); color: var(--ink-3); display: inline-flex; gap: 6px; align-items: center; }
.mk-steps li::before { content: counter(s); width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; background: var(--line); color: var(--ink-2); font-size: .85em; }
.mk-steps li.done { color: var(--ink-2); } .mk-steps li.done::before { content: '✓'; background: var(--good); color: #fff; }
.mk-steps li.cur { background: var(--accent-soft); color: var(--accent); font-weight: 600; } .mk-steps li.cur::before { background: var(--accent); color: var(--on-accent); }
.mk-pay { padding: 14px; border: 1px solid var(--line-2); border-inline-start: 4px solid var(--brand-teal); border-radius: var(--r-sm); background: var(--surface); }
.mk-msg { margin: 0; padding: 8px 12px; border-inline-start: 3px solid var(--line-2); color: var(--ink-2); white-space: pre-wrap; font-size: .92em; }
.mk-review { padding: 8px 0; border-bottom: 1px solid var(--line); } .mk-review:last-child { border-bottom: 0; }
.mk-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 170px), 1fr)); gap: 12px; }
.mk-table { width: 100%; border-collapse: collapse; font-size: .9em; min-width: 760px; }
.mk-table th, .mk-table td { text-align: start; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.mk-table th { font-size: .8em; color: var(--ink-3); font-weight: 600; background: var(--surface-2); }
.mk-table td.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.mk-checks { display: flex; flex-wrap: wrap; gap: 6px 16px; }
.mk-svc.on { border-color: var(--accent); }
.mk-pledge { padding: 12px; border-radius: var(--r-sm); background: var(--warn-soft); align-items: flex-start; }
.mk-rate button { border: 0; background: none; font-size: 2rem; line-height: 1; color: var(--line-2); cursor: pointer; padding: 2px; } .mk-rate button.on { color: #E3A008; }
.mk-projs { border: 1px solid var(--line); border-radius: var(--r-sm); padding: 10px 12px; margin: 0; }
.member.ended { opacity: .55; }

.guides-sec { border-top: 1px solid var(--line); }
.guides-sec .gate-ico { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; background: var(--teal-soft); color: var(--teal-ink); }
.guides-sec .gate-ico .ic svg { width: 20px; height: 20px; color: inherit; }
@media (max-width: 640px) { .mk-filters select { flex: 1 1 100%; } .mk-hero { flex-direction: column; } }


/* Static fallback rendered into #app by scripts/build.mjs; the app replaces it on load. */
.prerender { max-width: 860px; margin: 0 auto; padding: 24px var(--gutter) 64px; line-height: 1.6; }
.prerender header { display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: center; padding-block: 8px 20px; border-bottom: 1px solid var(--line); margin-bottom: 24px; }
.prerender header a { color: var(--ink-2); text-decoration: none; }
.prerender header .brand { color: var(--ink); font-weight: 700; margin-inline-end: auto; }
.prerender .crumbs { color: var(--ink-3); font-size: .875rem; }
.prerender .crumbs a { color: inherit; }
.prerender h1 { margin: .4em 0; }
.prerender li { margin-block: .3em; }
