/* SEO Scout 2 design system: tokens, layout, components. Logical properties keep RTL and LTR identical. */
@font-face { font-family: "Vazirmatn"; src: url("../fonts/Vazirmatn-Variable.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }

:root {
  --font: "Vazirmatn", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Tahoma, sans-serif;
  --mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --radius: 12px; --radius-sm: 8px; --radius-lg: 16px;
  --space: 16px;
  --bg: #f5f7fb; --surface: #ffffff; --surface-2: #f0f3f9; --surface-3: #e6ebf4;
  --border: #dde3ee; --border-strong: #c3cde0;
  /* every colour that also sets text reaches 4.5:1 (WCAG 2.2 AA) on the surfaces and the soft tint it sits on */
  --text: #121a2b; --text-2: #3b4760; --muted: #5a6580;
  --primary: #2150d8; --primary-2: #1a40ae; --primary-soft: #e8eefd; --on-primary: #fff;
  --ok: #0a7550; --ok-soft: #e3f5ec; --warn: #995a00; --warn-soft: #fff3de; --bad: #c62839; --bad-soft: #fde8ea; --info: #3a6ea5; --info-soft: #e7f0fa;
  --p0: #c62839; --p1: #b4530a; --p2: #7a5e00; --p3: #5a6580;
  --s2: #0e7f52; --s3: #2563c4; --s4: #b4530a; --s5: #c62839; --sb: #7a48c4; --sn: #646e84;
  --shadow: 0 1px 2px rgba(16,24,40,.06), 0 1px 3px rgba(16,24,40,.08);
  --shadow-lg: 0 12px 32px rgba(16,24,40,.16);
  --focus: 0 0 0 3px rgba(33,80,216,.35);
  color-scheme: light;
}
[data-theme="dark"] {
  --bg: #0d1220; --surface: #151c2e; --surface-2: #1b2438; --surface-3: #232e47;
  --border: #2a3552; --border-strong: #3a4769;
  --text: #e8ecf6; --text-2: #c2cbe0; --muted: #8b96b2;
  --primary: #6d8ff5; --primary-2: #8aa6ff; --primary-soft: #1e2a4d; --on-primary: #0d1220;
  --ok: #3fcf95; --ok-soft: #12322a; --warn: #f0b04a; --warn-soft: #3a2c12; --bad: #ff6b7b; --bad-soft: #3b1920; --info: #7fb2f0; --info-soft: #172a42;
  --p0: #ff6b7b; --p1: #ff9d57; --p2: #e8c54a; --p3: #8b96b2;
  --s2: #3fcf95; --s3: #7fb2f0; --s4: #ff9d57; --s5: #ff6b7b; --sb: #b591f0; --sn: #9aa5c0;
  --shadow: 0 1px 2px rgba(0,0,0,.4); --shadow-lg: 0 16px 40px rgba(0,0,0,.55);
  --focus: 0 0 0 3px rgba(109,143,245,.45);
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body { font-family: var(--font); font-size: 14.5px; line-height: 1.6; color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; }
[dir="rtl"] body, [dir="rtl"] { font-feature-settings: "ss01"; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0 0 .4em; line-height: 1.3; font-weight: 700; }
h1 { font-size: 1.55rem; } h2 { font-size: 1.2rem; } h3 { font-size: 1.02rem; } h4 { font-size: .92rem; color: var(--text-2); }
p { margin: 0 0 .7em; }
code, .mono { font-family: var(--mono); font-size: .88em; }
.ltr { direction: ltr; unicode-bidi: isolate; text-align: start; }
/* Persian digits (ss01) are for prose only: URLs, hosts, file names and code keep Latin digits */
.ltr, .latin, [dir="ltr"], code, .mono, .url, .status, .pcard .domain, .log, .ai-stream, .ips, input[type="url"], input[type="email"] { font-feature-settings: normal; }
.muted { color: var(--muted); } .small { font-size: .85rem; } .tiny { font-size: .76rem; }
.nowrap { white-space: nowrap; } .grow { flex: 1; } .right { margin-inline-start: auto; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } .g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); } .g5 { grid-template-columns: repeat(5, minmax(0, 1fr)); } .g12 { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); }
@media (max-width: 1100px) { .g12 { grid-template-columns: 1fr; } .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g5 { grid-template-columns: repeat(3, minmax(0, 1fr)); } .g3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 720px) { .g2, .g3, .g4, .g5 { grid-template-columns: 1fr; } }
/* phones: rows of KPI tiles stay two abreast, one tile per row pushed the findings below the fold */
@media (max-width: 720px) { .grid:is(.g3, .g4, .g5):has(> .kpi) { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; } }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 6px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.sr-only .table-wrap { overflow: visible; }
::selection { background: var(--primary-soft); }

/* ---------------------------------------------------------------- app shell */
.app { display: grid; grid-template-columns: 248px minmax(0, 1fr); grid-template-rows: 58px minmax(0, 1fr); min-height: 100vh; }
.topbar { grid-column: 1 / -1; display: flex; align-items: center; gap: 12px; padding-inline: 16px; background: var(--surface); border-block-end: 1px solid var(--border); position: sticky; top: 0; z-index: 30; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.05rem; min-width: 200px; color: var(--text); }
.brand .logo { width: 30px; height: 30px; border-radius: 9px; background: linear-gradient(135deg, var(--primary), #6b3fd8); display: grid; place-items: center; color: #fff; }
.brand .logo svg { width: 18px; height: 18px; }
.switchers { display: flex; gap: 8px; align-items: center; min-width: 0; flex: 1; }
.switchers select { max-width: 280px; }
.top-actions { display: flex; gap: 6px; align-items: center; }
.icon-btn { width: 36px; height: 36px; display: inline-grid; place-items: center; border-radius: 10px; border: 1px solid transparent; background: transparent; color: var(--text-2); cursor: pointer; }
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn svg { width: 18px; height: 18px; }
.activity { display: inline-flex; gap: 6px; align-items: center; padding: 4px 10px; border-radius: 999px; background: var(--primary-soft); color: var(--primary); font-size: .82rem; font-weight: 600; cursor: pointer; border: 0; }
.activity .dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; animation: pulse 1.4s infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .3; } }

.sidenav { background: var(--surface); border-inline-end: 1px solid var(--border); padding: 14px 10px; overflow-y: auto; position: sticky; top: 58px; height: calc(100vh - 58px); }
.nav-group { margin-block-end: 14px; }
.nav-title { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 6px 10px; font-weight: 700; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 9px; color: var(--text-2); font-weight: 500; cursor: pointer; border: 0; background: none; width: 100%; text-align: start; font: inherit; }
.nav-item svg { width: 17px; height: 17px; flex: none; opacity: .85; }
.nav-item:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav-item.on { background: var(--primary-soft); color: var(--primary); font-weight: 650; }
.nav-item .count { margin-inline-start: auto; font-size: .72rem; background: var(--surface-3); color: var(--text-2); padding: 0 7px; border-radius: 999px; }
.nav-item[aria-disabled="true"] { opacity: .45; pointer-events: none; }
.main { min-width: 0; padding: 22px 26px 60px; }
.page { max-width: 1440px; margin-inline: auto; }
.page-head { display: flex; align-items: flex-start; gap: 16px; margin-block-end: 18px; flex-wrap: wrap; }
.page-head .titles { flex: 1; min-width: 240px; }
.page-head .sub { color: var(--muted); font-size: .9rem; }
.crumbs { font-size: .82rem; color: var(--muted); margin-block-end: 4px; }
.crumbs a { text-decoration: underline; text-underline-offset: 2px; }
.menu-toggle { display: none; }
@media (max-width: 900px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidenav { position: fixed; inset-block: 58px 0; inset-inline-start: 0; width: min(270px, 86vw); height: auto; z-index: 40; transform: translateX(-110%); visibility: hidden; transition: transform .2s, visibility .2s; box-shadow: var(--shadow-lg); }
  [dir="rtl"] .sidenav { transform: translateX(110%); }
  .app.nav-open .sidenav { transform: none; visibility: visible; }
  .menu-toggle { display: inline-grid; }
  .topbar { gap: 8px; padding-inline: 10px; min-width: 0; }
  .brand { min-width: 0; } .brand .name { display: none; }
  .main { padding: 16px 14px 60px; }
  .switchers { min-width: 0; gap: 6px; }
  .switchers select { flex: 1 1 0; min-width: 0; width: 0; max-width: none; }
  .top-actions { gap: 2px; }
  .page-head .titles { min-width: 0; }
}
@media (max-width: 480px) { .top-actions .hide-sm { display: none; } }

/* ---------------------------------------------------------------- controls */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 36px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); font: inherit; font-weight: 600; font-size: .9rem; cursor: pointer; white-space: nowrap; transition: background .12s, border-color .12s; }
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn svg { width: 16px; height: 16px; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.btn.primary:hover { background: var(--primary-2); }
.btn.danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 45%, var(--border)); }
.btn.danger:hover { background: var(--bad-soft); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.sm { min-height: 30px; padding: 0 10px; font-size: .82rem; border-radius: 8px; }
.btn.lg { min-height: 44px; padding: 0 20px; font-size: 1rem; }
.btn[disabled], .btn.busy { opacity: .55; cursor: not-allowed; }
.btn.busy::after { content: ""; width: 14px; height: 14px; border-radius: 50%; border: 2px solid currentColor; border-inline-end-color: transparent; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
input, select, textarea { font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border-strong); border-radius: 10px; padding: 7px 11px; min-height: 36px; width: 100%; }
textarea { min-height: 90px; resize: vertical; line-height: 1.5; }
input[type="checkbox"], input[type="radio"] { width: auto; min-height: 0; accent-color: var(--primary); }
select { width: auto; padding-inline-end: 28px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: var(--focus); }
.field { display: flex; flex-direction: column; gap: 5px; }
.field > label, .label { font-weight: 600; font-size: .86rem; color: var(--text-2); }
.field .help { font-size: .78rem; color: var(--muted); }
.check { display: flex; gap: 8px; align-items: flex-start; font-size: .9rem; cursor: pointer; }
.check input { margin-top: 5px; }
.seg { display: inline-flex; background: var(--surface-2); border-radius: 10px; padding: 3px; gap: 3px; border: 1px solid var(--border); }
.seg button { border: 0; background: none; padding: 6px 12px; border-radius: 8px; font: inherit; font-size: .86rem; font-weight: 600; color: var(--text-2); cursor: pointer; }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.search { position: relative; }
.search input { padding-inline-start: 34px; }
.search svg { position: absolute; inset-inline-start: 10px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--muted); }
.formerr { color: var(--bad); font-size: .86rem; min-height: 1.2em; }

/* ---------------------------------------------------------------- cards & data */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); min-width: 0; }
.card.flat { box-shadow: none; }
.card-head { display: flex; align-items: center; gap: 10px; margin-block-end: 12px; }
.card-head h2, .card-head h3 { margin: 0; font-size: 1.02rem; }
.card-head .muted { font-size: .8rem; }
.card.tight { padding: 12px 14px; }
.kpi { display: flex; flex-direction: column; gap: 2px; }
.kpi .v { font-size: 1.7rem; font-weight: 800; letter-spacing: -.01em; line-height: 1.2; }
.kpi .l { font-size: .8rem; color: var(--muted); font-weight: 600; }
.kpi .d { font-size: .78rem; }
.kpi.accent { border-inline-start: 4px solid var(--primary); }
.up { color: var(--bad); } .down { color: var(--ok); }
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: 999px; font-size: .74rem; font-weight: 700; background: var(--surface-3); color: var(--text-2); white-space: nowrap; }
.badge.p0 { background: var(--bad-soft); color: var(--p0); } .badge.p1 { background: var(--warn-soft); color: var(--p1); }
.badge.p2 { background: color-mix(in srgb, var(--p2) 16%, transparent); color: var(--p2); } .badge.p3 { background: var(--surface-3); color: var(--p3); }
.badge.ok { background: var(--ok-soft); color: var(--ok); } .badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.bad { background: var(--bad-soft); color: var(--bad); } .badge.info { background: var(--info-soft); color: var(--info); }
.badge.outline { background: transparent; border: 1px solid var(--border-strong); }
.status { font-weight: 700; font-family: var(--mono); font-size: .85rem; }
.status.s2 { color: var(--s2); } .status.s3 { color: var(--s3); } .status.s4 { color: var(--s4); } .status.s5 { color: var(--s5); } .status.sx { color: var(--sn); }
.pill-state { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; font-size: .8rem; }
.pill-state::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.pill-state.running::before, .pill-state.queued::before { background: var(--primary); animation: pulse 1.4s infinite; }
.pill-state.done::before, .pill-state.completed::before { background: var(--ok); }
.pill-state.stopped::before, .pill-state.paused::before, .pill-state.completed_partial::before { background: var(--warn); }
.pill-state.pausing::before { background: var(--warn); animation: pulse 1.4s infinite; }
.pill-state.error::before, .pill-state.failed_terminal::before, .pill-state.interrupted::before { background: var(--bad); }
.progress { height: 8px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.progress > span { display: block; height: 100%; background: linear-gradient(90deg, var(--primary), #6b3fd8); border-radius: inherit; transition: width .4s; }
.progress.indeterminate > span { width: 30% !important; animation: slide 1.3s infinite ease-in-out; }
@keyframes slide { 0% { margin-inline-start: -30%; } 100% { margin-inline-start: 100%; } }
.meter { display: flex; flex-direction: column; gap: 4px; }
.meter .row { justify-content: space-between; font-size: .82rem; }
.divider { height: 1px; background: var(--border); margin-block: 14px; border: 0; }
.kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 6px 16px; font-size: .9rem; }
.kv dt { color: var(--muted); font-weight: 600; } .kv dd { margin: 0; overflow-wrap: anywhere; }
.list-plain { list-style: none; margin: 0; padding: 0; }
.list-plain li { padding: 8px 0; border-block-end: 1px solid var(--border); }
.list-plain li:last-child { border: 0; }
.callout { border-radius: var(--radius-sm); padding: 10px 14px; background: var(--info-soft); color: var(--text); border-inline-start: 4px solid var(--info); font-size: .9rem; }
.callout a:not(.btn), p a:not(.btn) { text-decoration: underline; text-underline-offset: 2px; }
.callout.warn { background: var(--warn-soft); border-color: var(--warn); } .callout.bad { background: var(--bad-soft); border-color: var(--bad); } .callout.ok { background: var(--ok-soft); border-color: var(--ok); }

/* tables */
.table-wrap { overflow: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
table.data { border-collapse: separate; border-spacing: 0; width: 100%; font-size: .87rem; }
table.data th { position: sticky; top: 0; background: var(--surface-2); color: var(--text-2); font-weight: 700; font-size: .78rem; text-align: start; padding: 9px 12px; border-block-end: 1px solid var(--border); white-space: nowrap; z-index: 1; }
table.data th.sortable { user-select: none; }
.th-sort { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; display: inline-flex; gap: 4px; align-items: center; text-align: inherit; }
.th-sort:hover { color: var(--text); }
.th-sort:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 4px; }
table.data th .arrow { opacity: .6; font-size: .7rem; margin-inline-start: 3px; }
table.data td { padding: 8px 12px; border-block-end: 1px solid var(--border); vertical-align: top; }
table.data tr:last-child td { border-block-end: 0; }
table.data tbody tr.clickable { cursor: pointer; }
table.data tbody tr.clickable:hover td { background: var(--surface-2); }
table.data.model-chain { table-layout: fixed; min-width: 30rem; }
table.data.model-chain th, table.data.model-chain td { padding: 7px 8px; vertical-align: middle; }
table.data.model-chain tr.chain-preset td { padding-block-end: 0; border-block-end: 0; }
@media (max-width: 640px) {             /* phones: each preset's model and fallbacks stack, labelled */
  table.data.model-chain { min-width: 0; }
  table.data.model-chain thead { display: none; }
  table.data.model-chain tr, table.data.model-chain td { display: block; }
  table.data.model-chain td[data-label] { border-block-end: 0; padding-block: 3px; }
  table.data.model-chain td[data-label]::before { content: attr(data-label); display: block; font-size: .76rem; color: var(--text-2); }
  table.data.model-chain tbody tr:last-child td:last-child { padding-block-end: 10px; }
}
table.data.model-chain select { width: 100%; font-size: .84rem; text-overflow: ellipsis; }
table.data td.num, table.data th.num { text-align: end; font-variant-numeric: tabular-nums; }
td.url { max-width: 460px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; direction: ltr; text-align: start; unicode-bidi: plaintext; }
table.data td.shrink { width: 1%; white-space: nowrap; padding-inline-end: 0; }
.pager { display: flex; gap: 8px; align-items: center; justify-content: flex-end; padding: 10px 2px; font-size: .85rem; color: var(--muted); }
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-block-end: 12px; }
.toolbar .search { min-width: 220px; flex: 1; max-width: 420px; }

/* tabs */
.tabs { display: flex; gap: 2px; border-block-end: 1px solid var(--border); margin-block-end: 18px; overflow-x: auto; scrollbar-width: none; }
.tabs button { border: 0; background: none; font: inherit; font-weight: 600; color: var(--muted); padding: 10px 14px; border-block-end: 2px solid transparent; cursor: pointer; white-space: nowrap; display: inline-flex; gap: 6px; align-items: center; }
.tabs button:hover { color: var(--text); }
.tabs button.on { color: var(--primary); border-block-end-color: var(--primary); }

/* project cards */
.projects { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.pcard { display: flex; flex-direction: column; gap: 12px; cursor: pointer; transition: transform .12s, box-shadow .12s, border-color .12s; }
.pcard:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); border-color: var(--border-strong); }
.pcard .domain { font-weight: 800; font-size: 1.08rem; direction: ltr; unicode-bidi: isolate; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pcard .fav { width: 38px; height: 38px; border-radius: 10px; background: var(--primary-soft); color: var(--primary); display: grid; place-items: center; font-weight: 800; text-transform: uppercase; flex: none; }
.prio-bar { display: flex; height: 8px; border-radius: 999px; overflow: hidden; background: var(--surface-3); }
.prio-bar span { display: block; }
.newcard { border: 2px dashed var(--border-strong); background: transparent; box-shadow: none; display: grid; place-items: center; min-height: 190px; color: var(--muted); font-weight: 700; }
.newcard:hover { border-color: var(--primary); color: var(--primary); }

/* action cards (decision view) */
.action { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; align-items: start; padding: 14px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.action .rank { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; font-weight: 800; background: var(--surface-2); }
.action h3 { color: var(--text); margin: 0 0 4px; font-size: .96rem; }
.action .meta { display: flex; gap: 8px; flex-wrap: wrap; font-size: .8rem; color: var(--muted); }
.buckets { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 1000px) { .buckets { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.bucket { background: var(--surface-2); border-radius: var(--radius); padding: 12px; min-height: 120px; }
.bucket h3, .kcol h3 { font-size: .92rem; color: var(--text-2); }
.bucket h3 { display: flex; justify-content: space-between; }
.bucket .item { background: var(--surface); border: 1px solid var(--border); border-radius: 9px; padding: 8px 10px; margin-block-start: 8px; font-size: .84rem; cursor: pointer; }
.bucket .item:hover { border-color: var(--primary); }

/* kanban */
.kanban { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(250px, 1fr); gap: 12px; overflow-x: auto; padding-block-end: 8px; }
.kcol { background: var(--surface-2); border-radius: var(--radius); padding: 10px; min-height: 200px; }
.kcol h3 { display: flex; justify-content: space-between; align-items: center; }
.kcard { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 10px; margin-block-start: 8px; cursor: pointer; font-size: .86rem; box-shadow: var(--shadow); }
.kcard:hover { border-color: var(--primary); }

/* drawer, dialog, toast, menu */
.scrim { position: fixed; inset: 0; background: rgba(8, 12, 24, .45); z-index: 60; animation: fade .15s; }
@keyframes fade { from { opacity: 0; } }
.drawer { position: fixed; inset-block: 0; inset-inline-end: 0; width: min(760px, 96vw); background: var(--surface); z-index: 61; display: flex; flex-direction: column; box-shadow: var(--shadow-lg); animation: slidein .18s ease-out; }
@keyframes slidein { from { transform: translateX(30px); opacity: 0; } }
[dir="rtl"] .drawer { animation-name: slidein-rtl; }
@keyframes slidein-rtl { from { transform: translateX(-30px); opacity: 0; } }
.drawer-head { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-block-end: 1px solid var(--border); }
.drawer-head h2 { margin: 0; flex: 1; font-size: 1.05rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.drawer-body { padding: 18px; overflow-y: auto; flex: 1; }
.dialog { position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); width: min(620px, 94vw); max-height: 90vh; overflow: auto; background: var(--surface); border-radius: var(--radius-lg); z-index: 61; box-shadow: var(--shadow-lg); padding: 22px; animation: pop .16s ease-out; }
.dialog.wide { width: min(900px, 96vw); }
@keyframes pop { from { transform: translate(-50%, -48%) scale(.98); opacity: 0; } }
.dialog .actions { display: flex; gap: 8px; justify-content: flex-end; margin-block-start: 18px; }
.toasts { position: fixed; inset-block-end: 18px; inset-inline-end: 18px; z-index: 80; display: flex; flex-direction: column; gap: 8px; max-width: min(420px, 92vw); }
.toast { background: var(--text); color: var(--bg); padding: 10px 14px; border-radius: 10px; box-shadow: var(--shadow-lg); font-size: .9rem; animation: pop2 .16s ease-out; display: flex; gap: 10px; align-items: flex-start; }
.toast.bad { background: var(--bad); color: #fff; } .toast.ok { background: var(--ok); color: #fff; }
@keyframes pop2 { from { transform: translateY(8px); opacity: 0; } }
.menu { position: absolute; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-lg); padding: 6px; min-width: 210px; z-index: 70; }
.menu button, .menu a { display: flex; width: 100%; gap: 8px; align-items: center; padding: 8px 10px; border-radius: 8px; border: 0; background: none; font: inherit; color: var(--text); cursor: pointer; text-align: start; }
.menu button:hover, .menu a:hover { background: var(--surface-2); text-decoration: none; }
.menu .sep { height: 1px; background: var(--border); margin: 4px 0; }

/* states */
.empty { text-align: center; padding: 48px 20px; color: var(--muted); }
.empty .art { width: 64px; height: 64px; margin: 0 auto 12px; border-radius: 18px; background: var(--primary-soft); color: var(--primary); display: grid; place-items: center; }
.empty .art svg { width: 30px; height: 30px; }
.empty h3 { color: var(--text); }
.skeleton { background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 37%, var(--surface-2) 63%); background-size: 400% 100%; animation: shimmer 1.3s ease infinite; border-radius: 8px; min-height: 14px; }
@keyframes shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }
.loading-page { display: grid; gap: 14px; }
.error-box { padding: 14px; border-radius: var(--radius); background: var(--bad-soft); color: var(--bad); }

/* charts */
.chart { width: 100%; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .btn svg { display: inline-block; width: 16px; height: 16px; }
.chart text { fill: var(--text-2); font-family: var(--font); font-size: 11px; }
.chart .axis line, .chart .grid line { stroke: var(--border); }
.chart .bar:hover, .chart .slice:hover { opacity: .8; cursor: pointer; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: .8rem; margin-block-start: 8px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.chart-note { font-size: .74rem; color: var(--muted); margin-block-start: 6px; }
.donut-wrap { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 16px; align-items: center; }
.donut-center { font-size: 1.25rem; font-weight: 800; fill: var(--text) !important; }
.heat td { text-align: center; font-variant-numeric: tabular-nums; font-size: .8rem; }
.heat .chart-pick { color: var(--text); font-weight: 700; }

/* live crawl */
.live-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(128px, 1fr)); gap: 10px; }
.log { background: #0b1020; color: #cfd8ee; border-radius: var(--radius); padding: 12px 14px; font-family: var(--mono); font-size: .8rem; height: 320px; overflow: auto; direction: ltr; text-align: left; white-space: pre-wrap; }
.log .warn { color: #f0b04a; } .log .error { color: #ff6b7b; }
.tape { width: 100%; height: 64px; display: block; border-radius: 10px; background: var(--surface-2); }

/* AI */
.ai-stream { background: var(--surface-2); border-radius: var(--radius); padding: 12px; font-family: var(--mono); font-size: .8rem; max-height: 260px; overflow: auto; white-space: pre-wrap; direction: ltr; text-align: left; }
.rec { border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; background: var(--surface); }
.rec + .rec { margin-block-start: 10px; }
.cost-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.cost-grid .cell { background: var(--surface-2); border-radius: 10px; padding: 10px; }
.cost-grid .cell b { display: block; font-size: 1.05rem; }

/* auth */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: radial-gradient(1200px 600px at 20% -10%, var(--primary-soft), transparent), var(--bg); }
.auth-card { width: min(420px, 100%); }
.auth-card .brand { justify-content: center; margin-block-end: 16px; font-size: 1.25rem; }

/* location selector */
.locs { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; }
.loc { border: 2px solid var(--border); border-radius: var(--radius); padding: 12px; cursor: pointer; background: var(--surface); }
.loc.on { border-color: var(--primary); background: var(--primary-soft); }
.loc[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }
.loc .flag { font-size: 1.4rem; }
.ips { font-family: var(--mono); font-size: .78rem; direction: ltr; }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
@media print { .topbar, .sidenav, .toasts { display: none; } .app { display: block; } }

/* ---------------------------------------------------------------- sign-in and sign-up (split layout) */
.auth-split { min-height: 100vh; display: grid; grid-template-columns: minmax(340px, 44%) minmax(0, 1fr); background: var(--surface); }
.auth-hero { position: relative; display: flex; flex-direction: column; justify-content: space-between; gap: 28px; padding: 40px 48px; color: #fff; overflow: hidden;
  background: radial-gradient(900px 520px at 0% 0%, rgba(255,255,255,.16), transparent 60%), linear-gradient(150deg, #173a9e 0%, #2150d8 48%, #6d3fd8 100%); }
.auth-hero::after { content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .12;
  background-image: linear-gradient(rgba(255,255,255,.6) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.6) 1px, transparent 1px); background-size: 36px 36px;
  mask-image: radial-gradient(600px 400px at 90% 100%, #000, transparent); -webkit-mask-image: radial-gradient(600px 400px at 90% 100%, #000, transparent); }
.auth-hero > * { position: relative; z-index: 1; }
.auth-hero .brand, .auth-hero a { color: #fff; }
.auth-hero .brand .logo { background: rgba(255,255,255,.18); color: #fff; }
.hero-copy h1 { font-size: clamp(1.6rem, 2.5vw, 2.3rem); line-height: 1.25; letter-spacing: -.01em; margin-block-end: 12px; }
.hero-copy p { opacity: .92; font-size: 1.02rem; max-width: 48ch; }
.hero-points { list-style: none; padding: 0; margin: 26px 0 0; display: grid; gap: 14px; }
.hero-points li { display: flex; gap: 12px; align-items: center; font-weight: 600; }
.hp-ico { width: 36px; height: 36px; border-radius: 10px; background: rgba(255,255,255,.16); display: grid; place-items: center; flex: none; }
.hp-ico svg { width: 18px; height: 18px; }
.hero-foot { font-size: .88rem; opacity: .9; }
.hero-foot a { text-decoration: underline; }
.auth-main { display: flex; flex-direction: column; min-width: 0; padding: 18px 28px; }
.auth-top { display: flex; align-items: center; gap: 8px; }
.auth-panel { width: min(440px, 100%); margin: auto; padding-block: 28px; }
.auth-panel.wide { width: min(660px, 100%); }
.auth-panel > h2 { font-size: 1.65rem; margin-block-end: 4px; letter-spacing: -.01em; }
.auth-panel > p.muted { margin-block-end: 18px; }
.auth-foot { margin-block-start: 18px; display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; font-size: .9rem; }
.only-sm { display: none !important; }
@media (max-width: 900px) { .auth-split { grid-template-columns: 1fr; } .auth-hero { display: none; } .only-sm { display: inline-flex !important; } .auth-main { padding: 14px 16px; } }
.btn.block { width: 100%; }
.pw-wrap { position: relative; display: flex; }
.pw-wrap input { flex: 1; padding-inline-end: 44px; }
.pw-eye { position: absolute; inset-inline-end: 4px; top: 50%; transform: translateY(-50%); }
.pw-eye.on { color: var(--primary); }
.pw-meter { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; margin-block-start: 6px; }
.pw-meter span { height: 4px; border-radius: 4px; background: var(--surface-3); transition: background .2s; }
.pw-meter[data-score="1"] span:nth-child(1) { background: var(--bad); }
.pw-meter[data-score="2"] span:nth-child(-n+2) { background: var(--warn); }
.pw-meter[data-score="3"] span:nth-child(-n+3) { background: var(--ok); }
.pw-meter[data-score="4"] span { background: var(--ok); }
.form-status:empty { display: none; }
.reg-more { border: 1px solid var(--border); border-radius: var(--radius); padding: 8px 14px 12px; }
.reg-more summary { cursor: pointer; font-weight: 700; padding-block: 4px; }
.reg-more[open] summary { margin-block-end: 8px; }
.mail-art { display: grid; place-items: center; width: 64px; height: 64px; border-radius: 18px; background: var(--primary-soft); color: var(--primary); margin-inline: auto; }
.mail-art svg { width: 30px; height: 30px; }

/* ---------------------------------------------------------------- pricing */
.pricing { max-width: 1180px; margin: 0 auto; padding-block-end: 40px; }
.pricing.standalone { padding-inline: 20px; background: radial-gradient(1000px 500px at 50% -10%, var(--primary-soft), transparent); min-height: 100vh; max-width: none; }
.pricing.standalone > * { max-width: 1180px; margin-inline: auto; }
.pricing-top { display: flex; align-items: center; gap: 8px; padding-block: 16px; }
.pricing-hero { text-align: center; padding: 26px 12px 10px; }
.pricing-hero h1 { font-size: clamp(1.7rem, 3.2vw, 2.5rem); letter-spacing: -.02em; }
.pricing-hero p { max-width: 64ch; margin-inline: auto; }
.row.center { justify-content: center; } .center { text-align: center; }
.plan-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 18px; align-items: stretch; margin-block-start: 22px; }
.plan-grid.compact { margin-block-start: 6px; }
.plan-card { position: relative; display: flex; flex-direction: column; gap: 12px; padding: 24px 22px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--shadow); transition: transform .15s, box-shadow .15s; }
.plan-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.plan-card.featured { border: 2px solid var(--primary); box-shadow: 0 12px 32px color-mix(in srgb, var(--primary) 22%, transparent); }
.plan-card.current { border-color: var(--ok); }
.plan-card h3 { font-size: 1.2rem; margin: 0; }
.plan-card .tagline { min-height: 1.4em; margin: 0; }
.plan-card > .badge { align-self: flex-start; }
.ribbon { position: absolute; top: -12px; inset-inline-start: 22px; background: var(--primary); color: var(--on-primary); font-size: .72rem; font-weight: 800; padding: 3px 12px; border-radius: 999px; white-space: nowrap; box-shadow: var(--shadow); }
.price { display: flex; align-items: baseline; gap: 4px; flex-wrap: wrap; }
.price .amount { font-size: 2.15rem; font-weight: 800; letter-spacing: -.02em; line-height: 1.1; }
.price .per { color: var(--muted); font-weight: 600; }
.price .tiny { flex-basis: 100%; }
.features { list-style: none; margin: 4px 0 0; padding: 0; display: grid; gap: 8px; font-size: .9rem; }
.features li { display: flex; gap: 8px; align-items: flex-start; }
.features svg { width: 16px; height: 16px; color: var(--ok); flex: none; margin-block-start: 3px; }
.badge.block-badge { justify-content: center; padding: 8px; font-size: .85rem; border-radius: 10px; }
.badge.block-badge svg { width: 14px; height: 14px; }
.addon-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.pricing-section { margin-block-start: 44px; }
.pricing-section > h2, .pricing-section > p { text-align: center; }
.trust { margin-block-start: 24px; gap: 24px; }
.trust svg { width: 16px; height: 16px; color: var(--ok); }
.faq { max-width: 780px; margin-inline: auto; }
.faq details { border-block-end: 1px solid var(--border); padding: 14px 4px; }
.faq summary { cursor: pointer; font-weight: 700; }
.faq details p { margin: 8px 0 0; color: var(--text-2); }
.pricing footer { margin-block-start: 40px; }
.pricing > p.center { margin-block-start: 14px; }

/* ---------------------------------------------------------------- billing */
.plan-hero { display: flex; gap: 18px; align-items: flex-start; flex-wrap: wrap; }
.upper { text-transform: uppercase; letter-spacing: .06em; font-weight: 700; }
.pay-methods { display: grid; gap: 8px; }
.pay-method { display: flex; gap: 12px; align-items: center; text-align: start; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); font: inherit; color: inherit; cursor: pointer; }
.pay-method > span { display: flex; flex-direction: column; }
.pay-method svg { width: 22px; height: 22px; color: var(--muted); flex: none; }
.pay-method.on { border-color: var(--primary); box-shadow: var(--focus); }
.pay-method.on svg { color: var(--primary); }
.pay-summary { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 14px; background: var(--surface-2); border-radius: var(--radius); }
.pay-summary b { font-size: 1.3rem; }
pre.instructions { white-space: pre-wrap; background: var(--surface-2); padding: 12px; border-radius: var(--radius-sm); font-family: var(--font); margin: 0; }
table.quote tfoot th { font-size: 1.05rem; border-block-start: 2px solid var(--border-strong); }
.ok-text { color: var(--ok); } .bad-text { color: var(--bad); } .warn-text { color: var(--warn); }
.tiny svg, p.tiny > svg { width: 12px; height: 12px; vertical-align: -2px; }

/* ---------------------------------------------------------------- notifications */
.bell { position: relative; }
.dot-count { position: absolute; top: 2px; inset-inline-end: 2px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 999px; background: var(--bad); color: #fff; font-size: 10px; font-weight: 800; display: grid; place-items: center; line-height: 1; }
.notif-list { display: flex; flex-direction: column; gap: 8px; }
.notif { display: block; padding: 10px 12px; border-radius: var(--radius-sm); border: 1px solid var(--border); color: inherit; }
.notif:hover { text-decoration: none; background: var(--surface-2); }
.notif.unread { background: var(--primary-soft); border-color: transparent; }
.notif.lvl-warn { border-inline-start: 3px solid var(--warn); } .notif.lvl-bad { border-inline-start: 3px solid var(--bad); } .notif.lvl-ok { border-inline-start: 3px solid var(--ok); }

/* ---------------------------------------------------------------- administration: clients, security */
.client-head { display: flex; gap: 14px; align-items: center; }
.avatar { width: 46px; height: 46px; border-radius: 50%; background: var(--primary-soft); color: var(--primary); display: grid; place-items: center; font-weight: 800; font-size: 1.2rem; flex: none; }
.note { padding: 8px 10px; border-radius: var(--radius-sm); background: var(--surface-2); }
.note.pinned { background: var(--warn-soft); }
.note .icon-btn { width: 24px; height: 24px; }
.pre-wrap { white-space: pre-wrap; overflow-wrap: anywhere; }
.timeline { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; font-size: .86rem; }
.timeline li { padding-inline-start: 12px; border-inline-start: 2px solid var(--border); }
.timeline li.tl-order { border-color: var(--ok); } .timeline li.tl-security { border-color: var(--warn); } .timeline li.tl-admin { border-color: var(--info); }
.filters > select, .filters > input { min-width: 140px; width: auto; }
.filters > input[type="search"] { flex: 1; min-width: 200px; }
table.matrix th, table.matrix td { text-align: center; } table.matrix td:first-child, table.matrix th:first-child { text-align: start; }
table.matrix svg { width: 16px; height: 16px; }

/* ---------------------------------------------------------------- priority x effort matrix, release changes, task evidence */
.pe-matrix { width: 100%; border-collapse: collapse; table-layout: fixed; font-size: .8rem; }
.pe-matrix th, .pe-matrix td { border: 1px solid var(--border); padding: 4px; vertical-align: top; text-align: start; }
.pe-matrix thead th, .pe-matrix tbody th { background: var(--surface-2); font-weight: 650; }
.pe-chip { display: block; width: 100%; margin-block: 2px; padding: 2px 6px; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--border);
  cursor: pointer; overflow-wrap: anywhere; text-align: start; font: inherit; color: inherit; }
.pe-chip small { display: block; color: var(--muted); }
.pe-chip:hover, .pe-chip:focus-visible { border-color: var(--primary); }
.levels { display: flex; flex-wrap: wrap; gap: 6px; }
.kv-list { display: grid; grid-template-columns: max-content 1fr; gap: 4px 12px; font-size: .86rem; margin: 0; }
.kv-list dt { color: var(--muted); } .kv-list dd { margin: 0; overflow-wrap: anywhere; }

/* ---------------------------------------------------------------- chart tables and drill-down, status bar, neighbourhood graph */
.chart-foot { margin-block-start: 6px; gap: 6px; }
.chart-meta { font-size: .74rem; color: var(--muted); min-width: 0; overflow-wrap: anywhere; }
.chart-table { margin-block-start: 8px; font-size: .82rem; }
.chart-pick, .linkish { font: inherit; color: var(--primary); background: none; border: 0; padding: 0; cursor: pointer; text-decoration: underline dotted; }
.chart-pick:focus-visible, .linkish:focus-visible, .legend-pick:focus-visible, .nbhd .node:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.legend-pick { display: inline-flex; align-items: center; gap: 6px; font: inherit; color: inherit; background: none; border: 0; border-radius: 6px; padding: 1px 4px; cursor: pointer; text-align: start; }
.legend-pick:hover { background: var(--surface-2); }
.seg-pick { cursor: pointer; } .seg-pick:hover { opacity: .8; }
.statusbar { max-width: 1440px; margin: 0 auto 14px; display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: center; font-size: .8rem; color: var(--text-2);
  padding: 6px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); min-width: 0; }
.statusbar:empty { display: none; }
.sb-item { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; min-width: 0; overflow-wrap: anywhere; }
.sb-item svg { width: 14px; height: 14px; }
.sb-item .btn.sm { min-height: 26px; padding: 0 8px; }
.sb-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); flex: none; }
.sb-dot.ok { background: var(--ok); } .sb-dot.warn { background: var(--warn); } .sb-dot.bad { background: var(--bad); }
.nbhd .nb-graph svg { display: block; width: 100%; max-width: 440px; height: auto; margin-inline: auto; }
.nbhd .node { cursor: pointer; } .nbhd .node:focus { outline: none; }
.nbhd .node:focus-visible > * { stroke: var(--primary); stroke-width: 3; }
.brief h4, .search-data h4, .schema-compare h4 { margin: 4px 0 6px; }
@media print {
  .chart-table.sr-only { position: static; width: auto; height: auto; overflow: visible; clip: auto; white-space: normal; }
  .chart-table-toggle, .statusbar { display: none; }
}

/* why unavailable (plan 23.6): the fixes a refusal offers, and tools a plan leaves out */
.remedies { display: flex; flex-wrap: wrap; gap: 6px; margin-block-start: 6px; }
.toast .remedies .btn { background: rgba(255, 255, 255, .92); color: var(--bad); border-color: transparent; }
.remedy-note { font-size: .82rem; padding: 4px 8px; border-radius: var(--radius-sm); background: var(--surface-2); color: var(--text); }
.pcard.unavailable { cursor: default; opacity: .78; }
.pcard.unavailable:hover { transform: none; box-shadow: none; }
.plan-terms { margin-block-start: 8px; border-block-start: 1px solid var(--border); padding-block-start: 8px; }
