/* Negahban panel — the approved 6-menu design (docs/04-panel-design.md, docs/design/artboards/).
   RTL, calm, one job per page. Dark by default; the choice lives in localStorage `ngb-theme` (static/theme.js).
   The CSP forbids inline styles, so every visual rule lives here. */
@font-face {
  font-family: "Vazirmatn";
  src: url("fonts/Vazirmatn-Regular.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Vazirmatn";
  src: url("fonts/Vazirmatn-Bold.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}

:root {
  --bg: #0B0F14; --surface: #121820; --hover: #18202A; --line: #1F2833;
  --text: #E6EBF1; --muted: #9AA6B4; --faint: #7C8896;
  --accent: #5B9BFF; --on-accent: #06101E;
  --ok: #34C77B; --warn: #E9A93B; --bad: #F05A67;
  --add: rgba(52, 199, 123, .12); --del: rgba(240, 90, 103, .12);
  --mono: "JetBrains Mono", ui-monospace, "Cascadia Mono", "SFMono-Regular", Consolas, monospace;
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #F5F6F8; --surface: #FFFFFF; --hover: #F0F2F5; --line: #E3E7EC;
  --text: #111827; --muted: #4B5563; --faint: #5F6B7A;
  --accent: #1F5FD1; --on-accent: #FFFFFF;
  --ok: #0E7A47; --warn: #8A5A00; --bad: #C0263A;
  --add: rgba(14, 122, 71, .10); --del: rgba(192, 38, 58, .10);
  color-scheme: light;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: "Vazirmatn", system-ui, sans-serif;
  font-size: 14px; line-height: 1.6; }
a { color: var(--accent); }
h1, h2, h3, p { margin: 0; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* text helpers */
.mono, code, kbd { font-family: var(--mono); direction: ltr; unicode-bidi: isolate; }
.code { font-family: var(--mono); font-size: .9em; padding: 1px 6px; margin: 0 2px; border-radius: 5px;
  background: var(--hover); }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.c-ok { color: var(--ok); } .c-warn { color: var(--warn); } .c-bad { color: var(--bad); }
.c-faint { color: var(--faint); } .c-accent { color: var(--accent); }
.strong { font-weight: 700; }

/* status dots — always next to a text label */
.dot { flex: none; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--faint); }
.dot.lg { width: 9px; height: 9px; }
.dot.xl { width: 12px; height: 12px; }
.dot.ok { background: var(--ok); } .dot.warn { background: var(--warn); } .dot.bad { background: var(--bad); }
.dot.faint { background: var(--faint); } .dot.accent { background: var(--accent); }

/* ---- layout ---------------------------------------------------------------------------------------------------- */
.shell { display: flex; flex-wrap: wrap; min-height: 100vh; }
.side { flex: 0 0 172px; width: 172px; height: 100vh; position: sticky; top: 0; padding: 20px 10px;
  border-inline-end: 1px solid var(--line); display: flex; flex-direction: column; gap: 28px; }
.side-brand { display: flex; align-items: center; gap: 10px; padding: 0 8px; color: var(--text); text-decoration: none; }
.side-brand span { font-size: 19px; font-weight: 800; }
.nav { display: flex; flex-direction: column; gap: 4px; }
.nav a { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 0 12px; border-radius: 10px;
  text-decoration: none; font-size: 14px; color: var(--muted); }
.nav a:hover { background: var(--hover); color: var(--text); }
.nav a[aria-current="page"] { color: var(--text); background: var(--hover); font-weight: 700; }
.nav a[aria-current="page"] svg { stroke: var(--accent); }
.nav svg { flex: none; }
.nav-badge { margin-inline-start: auto; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px;
  background: var(--bad); color: #fff; font-size: 11.5px; font-weight: 700; display: flex; align-items: center;
  justify-content: center; }
.side-alert { margin: 0 4px; padding: 8px 10px; border-radius: 10px; background: var(--del); color: var(--bad);
  font-size: 12.5px; font-weight: 700; line-height: 1.6; text-decoration: none; }
.side-foot { margin-top: auto; display: flex; align-items: center; gap: 6px; padding: 0 8px; }
.side-user { flex: 1; min-width: 0; display: flex; flex-direction: column; font-size: 13px; color: var(--muted);
  overflow: hidden; }
.side-user small { font-size: 11.5px; color: var(--faint); }
.side-foot form { display: contents; }
.icon-btn { flex: none; width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--line);
  background: transparent; color: var(--muted); cursor: pointer; display: inline-flex; align-items: center;
  justify-content: center; padding: 0; }
.icon-btn:hover { color: var(--text); background: var(--hover); }
.theme-light-icon { display: none; }
:root[data-theme="light"] .theme-light-icon { display: inline; }
:root[data-theme="light"] .theme-dark-icon { display: none; }

.page { flex: 1 1 560px; min-width: 0; max-width: 1240px; padding: 40px 48px; display: flex; flex-direction: column;
  gap: 28px; }
.page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px;
  min-height: 64px; }
.head-text { display: flex; flex-direction: column; gap: 6px; }
.page-head h1 { font-size: 26px; font-weight: 800; line-height: 1.4; }
.page-sub { font-size: 13.5px; color: var(--faint); }
.head-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.back { font-size: 13.5px; text-decoration: none; align-self: flex-start; }

.split { display: flex; flex-wrap: wrap; gap: 24px; align-items: flex-start; }
.split-main { flex: 999 1 480px; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.split-side { flex: 1 1 300px; min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.split-half { flex: 1 1 380px; min-width: 0; }
.section-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; }
.section-head h2 { font-size: 17px; font-weight: 700; }
.section-head a { font-size: 13px; text-decoration: none; }

/* ---- cards ------------------------------------------------------------------------------------------------------ */
.card { background: var(--surface); border-radius: 16px; padding: 24px; display: flex; flex-direction: column;
  gap: 16px; }
.card.tight { padding: 20px; gap: 12px; }
.card h2 { font-size: 16px; font-weight: 700; }
.card-title-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.card.attn { border-inline-start: 4px solid var(--warn); }
.card.attn-accent { border-inline-start: 4px solid var(--accent); }
.attn-label { font-size: 13px; font-weight: 700; color: var(--warn); }
.card-rows { background: var(--surface); border-radius: 16px; padding: 8px 24px 24px; display: flex;
  flex-direction: column; gap: 4px; }
.srow { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 64px;
  border-bottom: 1px solid var(--line); flex-wrap: wrap; padding: 10px 0; }
.srow.col { flex-direction: column; align-items: stretch; justify-content: center; gap: 10px; padding: 16px 0; }
.srow-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.srow-title { font-weight: 700; }
.srow-sub { font-size: 12.5px; color: var(--muted); line-height: 1.8; }
.card-note { font-size: 13px; color: var(--faint); margin-bottom: 8px; line-height: 1.8; }
.lead { font-size: 14px; line-height: 2; color: var(--muted); }
.body-text { font-size: 14px; line-height: 1.8; }
.empty { color: var(--faint); font-size: 14px; line-height: 1.9; padding: 12px 0; }

/* ---- controls -------------------------------------------------------------------------------------------------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px;
  border-radius: 10px; border: 1px solid var(--line); background: transparent; color: var(--text); font: inherit;
  font-size: 14px; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { background: var(--hover); }
.btn-primary { border-color: transparent; background: var(--accent); color: var(--on-accent); font-weight: 700; }
.btn-primary:hover { background: var(--accent); filter: brightness(1.08); }
.btn-danger { border-color: var(--bad); color: var(--bad); font-weight: 700; }
.btn-sm { min-height: 40px; padding: 0 16px; font-size: 13.5px; }
.btn-xs { min-height: 36px; padding: 0 12px; font-size: 12.5px; border-radius: 8px; }
.btn-block { width: 100%; min-height: 48px; font-size: 15px; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .45; cursor: not-allowed; filter: none; }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.link-btn { border: 0; background: transparent; color: var(--accent); font: inherit; font-size: 13px; cursor: pointer;
  padding: 0; min-height: 40px; }

.field { display: flex; flex-direction: column; gap: 8px; font-size: 13px; color: var(--muted); }
.field .hint { color: var(--faint); }
.input, .select, .textarea { width: 100%; min-height: 44px; padding: 0 12px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--bg); color: var(--text); font: inherit; font-size: 14px; }
.textarea { padding: 10px 12px; line-height: 1.8; resize: vertical; min-height: 96px; }
.input.ltr, .textarea.ltr { direction: ltr; text-align: left; font-family: var(--mono); font-size: 13.5px; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--accent); }
.code-input { width: 140px; font-family: var(--mono); font-size: 16px; letter-spacing: 4px; text-align: center;
  direction: ltr; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.span-all { grid-column: 1 / -1; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.check { display: flex; align-items: flex-start; gap: 12px; padding: 14px; border-radius: 12px; background: var(--bg); }
.check input { width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--accent); flex: none; }
.check-text { display: flex; flex-direction: column; gap: 4px; }
.check-title { font-size: 14px; font-weight: 700; }
.check-sub { font-size: 12.5px; color: var(--muted); line-height: 1.8; }

.pills { display: flex; gap: 8px; flex-wrap: wrap; }
.pill { min-height: 38px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted);
  font-size: 13.5px; text-decoration: none; display: inline-flex; align-items: center; }
.pill:hover { color: var(--text); }
.pill[aria-current="page"] { border-color: var(--text); background: var(--text); color: var(--bg); font-weight: 700; }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; border-bottom: 1px solid var(--line); }
.tab { min-height: 44px; padding: 0 16px; margin-bottom: -1px; border-bottom: 2px solid transparent; color: var(--faint);
  font-size: 14px; text-decoration: none; display: inline-flex; align-items: center; }
.tab:hover { color: var(--text); }
.tab[aria-current="page"] { border-bottom-color: var(--accent); color: var(--text); font-weight: 700; }
.seg { display: flex; gap: 4px; }
.seg a { min-height: 36px; padding: 0 14px; border-radius: 8px; font-size: 13px; color: var(--faint);
  text-decoration: none; display: inline-flex; align-items: center; }
.seg a[aria-current="page"] { background: var(--hover); color: var(--text); font-weight: 700; }
.search { display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 14px; border-radius: 10px;
  background: var(--surface); color: var(--faint); min-width: 240px; }
.search input { border: 0; outline: 0; background: transparent; color: var(--text); font: inherit; font-size: 14px;
  width: 100%; min-height: 42px; }

details.disclosure > summary { list-style: none; display: inline-flex; }
details.disclosure > summary::-webkit-details-marker { display: none; }
details.disclosure[open] > summary { margin-bottom: 14px; }
.disclosure-body { display: flex; flex-direction: column; gap: 14px; padding: 16px; border-radius: 12px;
  background: var(--bg); }

.flash { border-radius: 12px; padding: 12px 16px; font-size: 14px; line-height: 1.8; }
.flash-ok { background: var(--add); color: var(--ok); }
.flash-err { background: var(--del); color: var(--bad); }

/* commands with a copy button */
.cmd { display: block; margin: 0; font-family: var(--mono); font-size: 13px; line-height: 1.8; padding: 14px;
  border-radius: 10px; background: var(--bg); overflow-wrap: anywhere; white-space: pre-wrap; direction: ltr;
  text-align: left; }
.cmd.dashed { background: transparent; border: 1px dashed var(--line); color: var(--faint); font-size: 12px;
  padding: 10px 14px; }
.cmd-row { display: flex; align-items: center; gap: 8px; padding: 6px 6px 6px 14px; border-radius: 10px;
  background: var(--bg); }
.cmd-row code { flex: 1; min-width: 0; font-size: 13px; line-height: 1.7; overflow-wrap: anywhere; text-align: left; }
.cmd-row .btn { background: var(--surface); }

/* tables */
.table-wrap { overflow-x: auto; background: var(--surface); border-radius: 16px; padding: 20px 10px 6px; }
.table { border-collapse: collapse; width: 100%; min-width: 820px; }
.table th { font-size: 12.5px; font-weight: 500; color: var(--faint); text-align: start; padding: 0 14px 12px;
  border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { font-size: 14px; padding: 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table.compact { min-width: 640px; }
.table.compact td { padding: 10px 14px; font-size: 13px; }
.servers-table { min-width: 1000px; }
.move-col { width: 1%; padding-inline: 4px 0 !important; }
.move { display: flex; flex-direction: column; gap: 2px; }
.move-btn { width: 28px; height: 22px; border: 1px solid var(--line); border-radius: 6px; background: transparent;
  color: var(--muted); font-size: 10px; line-height: 1; cursor: pointer; padding: 0; }
.move-btn:hover:not(:disabled) { background: var(--hover); color: var(--text); }
.move-btn:disabled { opacity: .3; cursor: default; }
.reach { display: inline-flex; align-items: center; gap: 7px; font-size: 13.5px; cursor: default; }
.reach-list { display: flex; flex-direction: column; gap: 2px; margin-top: 4px; font-size: 12.5px; color: var(--muted); }
.name-cell { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--text); }
.name-cell:hover .name-main { color: var(--accent); }
.name-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.name-main { font-weight: 700; }
.name-sub { font-size: 12.5px; color: var(--faint); line-height: 1.7; }
.badge-probe { font-size: 11.5px; font-weight: 500; color: var(--accent); margin-inline-start: 8px; }

/* ---- dashboard ------------------------------------------------------------------------------------------------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.stat { text-decoration: none; color: var(--text); background: var(--surface); border-radius: 16px; padding: 24px;
  display: flex; flex-direction: column; gap: 12px; }
.stat:hover { background: var(--hover); }
.stat-label { font-size: 14px; color: var(--muted); }
.stat-num { font-size: 40px; font-weight: 800; line-height: 1; }
.stat-of { font-size: 18px; font-weight: 500; color: var(--faint); }
.stat-line { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 8px; line-height: 1.7; }
.feed-row { display: flex; align-items: center; gap: 14px; min-height: 52px; border-bottom: 1px solid var(--line);
  padding: 6px 0; }
.feed-time { font-family: var(--mono); font-size: 12.5px; color: var(--faint); width: 44px; flex: none; direction: ltr;
  text-align: right; }
.feed-text { font-size: 14px; flex: 1; min-width: 0; line-height: 1.8; }
.feed-src { font-size: 12.5px; color: var(--faint); flex: none; }
.ai-head { display: flex; justify-content: space-between; align-items: center; }
.ai-state { font-size: 12.5px; display: flex; align-items: center; gap: 6px; }

/* ---- server detail -------------------------------------------------------------------------------------------- */
.server-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; }
.server-title { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.server-title h1 { font-size: 28px; font-weight: 800; }
.live { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; }
.live a { display: flex; flex-direction: column; gap: 6px; padding: 20px; border-radius: 16px; background: var(--surface);
  border: 1px solid transparent; color: var(--text); text-decoration: none; }
.live a:hover { background: var(--hover); }
.live a[aria-current="page"] { border-color: var(--accent); }
.live-label { font-size: 13px; color: var(--muted); }
.live-value { font-size: 26px; font-weight: 800; }
.live-note { font-size: 12px; color: var(--faint); }
.chart { width: 100%; height: 180px; display: block; }
.chart-grid { stroke: var(--line); stroke-width: 1; }
.chart-line { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; }
.chart-dot { fill: var(--accent); }
.kv { margin: 0; display: grid; grid-template-columns: 110px 1fr; gap: 14px; font-size: 14px; }
.kv dt { color: var(--faint); }
.kv dd { margin: 0; line-height: 1.8; min-width: 0; overflow-wrap: anywhere; }
.problem { display: flex; gap: 12px; align-items: flex-start; }
.problem .dot { margin-top: 9px; }
.problem-text { font-size: 14px; line-height: 1.8; min-width: 0; }
.problem-sub { display: block; font-size: 12.5px; color: var(--faint); }
.subhead { font-size: 13px; color: var(--faint); }
.divided { border-top: 1px solid var(--line); padding-top: 14px; display: flex; flex-direction: column; gap: 10px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { font-family: var(--mono); font-size: 12.5px; padding: 4px 10px; border-radius: 8px; background: var(--hover);
  color: var(--muted); direction: ltr; unicode-bidi: isolate; }
.tag { font-size: 12.5px; padding: 3px 10px; border-radius: 8px; background: var(--hover); color: var(--muted); }
.tech > summary { cursor: pointer; color: var(--muted); font-size: 14px; min-height: 44px; display: flex;
  align-items: center; }
.tech-body { display: flex; flex-direction: column; gap: 20px; margin-top: 8px; }

/* ---- events ------------------------------------------------------------------------------------------------------ */
.events { display: flex; flex-direction: column; gap: 10px; }
.event { background: var(--surface); border-radius: 14px; overflow: hidden; }
.event > summary { list-style: none; display: flex; align-items: center; gap: 14px; min-height: 64px; padding: 10px 20px;
  cursor: pointer; }
.event > summary::-webkit-details-marker { display: none; }
.event > summary:hover { background: var(--hover); }
.event-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.event-title { font-size: 15px; font-weight: 700; line-height: 1.7; }
.event-meta { font-size: 12.5px; color: var(--faint); }
.event-state { font-size: 12.5px; font-weight: 700; flex: none; }
.event-body { padding: 4px 20px 22px; display: flex; flex-direction: column; gap: 16px; border-top: 1px solid var(--line); }
.event-block { display: flex; flex-direction: column; gap: 6px; padding-top: 12px; }
.event-label { font-size: 12.5px; font-weight: 700; color: var(--faint); }
.event-label.ai { color: var(--accent); }
.event-ai { font-size: 14.5px; line-height: 2.1; }
.step-row { display: flex; gap: 12px; font-size: 13.5px; }
.step-time { font-family: var(--mono); font-size: 12.5px; color: var(--faint); width: 44px; flex: none; direction: ltr;
  text-align: right; }
.step-text { color: var(--muted); line-height: 1.9; min-width: 0; overflow-wrap: anywhere; }
.approval-title { font-size: 16px; font-weight: 700; line-height: 1.8; }
.approval-body { font-size: 14px; color: var(--muted); line-height: 2; }
.approval-meta { font-size: 12.5px; color: var(--faint); }
.pager { display: flex; justify-content: center; gap: 10px; }

/* ---- topology (knowledge folder) ----------------------------------------------------------------------------- */
.kb { display: flex; flex-wrap: wrap; gap: 20px; align-items: flex-start; }
.kb-nav { flex: 1 1 220px; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.kb-item { display: flex; flex-direction: column; gap: 3px; align-items: flex-start; min-height: 56px; padding: 10px 14px;
  border-radius: 12px; color: var(--text); text-decoration: none; }
.kb-item:hover { background: var(--hover); }
.kb-item[aria-current="page"] { background: var(--surface); }
.kb-name { font-family: var(--mono); font-size: 13.5px; font-weight: 700; direction: ltr; unicode-bidi: isolate; }
.kb-what { font-size: 12px; color: var(--faint); }
.doc { flex: 999 1 520px; min-width: 0; background: var(--surface); border-radius: 16px; overflow: hidden; }
.doc-bar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px;
  padding: 14px 20px; border-bottom: 1px solid var(--line); }
.doc-name { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.doc-meta { font-size: 12px; color: var(--faint); }
.doc-note { font-size: 12.5px; color: var(--accent); }
.doc-body { padding: 20px 24px; font-family: var(--mono); font-size: 13px; line-height: 1.85; text-align: left;
  direction: ltr; overflow-x: auto; }
.doc-line { white-space: pre-wrap; padding: 0 6px; border-radius: 4px; min-height: 1.85em; overflow-wrap: anywhere; }
.doc-head { font-weight: 700; }
.doc-dim { color: var(--faint); }
.doc-add { background: var(--add); color: var(--ok); }
.doc-del { background: var(--del); color: var(--bad); }
.doc-files { display: flex; flex-direction: column; gap: 2px; }
.doc-files a { font-family: var(--mono); text-decoration: none; padding: 4px 6px; border-radius: 6px; }
.doc-files a:hover { background: var(--hover); }

/* ---- settings ------------------------------------------------------------------------------------------------ */
.avatar { width: 34px; height: 34px; border-radius: 10px; background: var(--hover); display: flex; align-items: center;
  justify-content: center; font-weight: 700; flex: none; }
.user-row { display: flex; align-items: center; gap: 14px; min-height: 60px; border-bottom: 1px solid var(--line);
  flex-wrap: wrap; padding: 8px 0; }
.user-main { flex: 1; min-width: 120px; display: flex; flex-direction: column; gap: 2px; }
.inline-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.inline-form .select { width: auto; min-height: 40px; }
.engine { display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 8px 14px; border-radius: 10px;
  background: var(--bg); color: var(--text); text-decoration: none; }
.engine:hover { background: var(--hover); }
.engine-order { font-size: 13px; color: var(--faint); width: 18px; flex: none; }
.engine-text { flex: 1; display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.engine-name { font-size: 14px; font-weight: 700; }
.engine-how { font-size: 12px; color: var(--faint); }
.engine-go { font-size: 12.5px; color: var(--accent); flex: none; }
.opt { display: flex; align-items: center; gap: 12px; min-height: 60px; padding: 8px 14px; border-radius: 10px;
  background: var(--bg); border: 1px solid transparent; cursor: pointer; }
.opt:has(input:checked) { border-color: var(--accent); }
.opt input { width: 18px; height: 18px; accent-color: var(--accent); flex: none; margin: 0; }
.opt-text { display: flex; flex-direction: column; gap: 2px; }
.opt-title { font-size: 14px; font-weight: 700; }
.opt-sub { font-size: 12.5px; color: var(--muted); line-height: 1.8; }
.audit-row { display: flex; align-items: center; gap: 14px; min-height: 52px; border-bottom: 1px solid var(--line);
  font-size: 14px; padding: 6px 0; }
.audit-time { font-family: var(--mono); font-size: 12.5px; color: var(--faint); flex: none; direction: ltr;
  text-align: right; }
.audit-who { width: 90px; color: var(--muted); flex: none; overflow: hidden; text-overflow: ellipsis; }
.audit-text { flex: 1; min-width: 0; line-height: 1.8; }
.qr { width: 180px; height: 180px; background: #fff; border-radius: 12px; padding: 8px; flex: none; }
.codes { list-style: none; margin: 0; padding: 14px; border-radius: 10px; background: var(--bg); display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; font-family: var(--mono); font-size: 14px;
  direction: ltr; text-align: center; }
.setup-row { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
.secret { font-family: var(--mono); font-size: 13px; overflow-wrap: anywhere; direction: ltr; text-align: left;
  padding: 10px 12px; border-radius: 10px; background: var(--bg); }

/* dialog (engine setup) — opened by URL, closed by a link back */
.overlay { position: fixed; inset: 0; background: rgba(0, 0, 0, .55); display: flex; align-items: flex-start;
  justify-content: center; padding: 40px 16px; overflow-y: auto; z-index: 10; }
.dialog { width: 100%; max-width: 720px; background: var(--surface); border-radius: 18px; padding: 28px; display: flex;
  flex-direction: column; gap: 22px; }
.dialog-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.dialog-head h2 { font-size: 20px; font-weight: 800; }
.steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 18px; }
.step { display: flex; gap: 14px; }
.step-n { flex: none; width: 28px; height: 28px; border-radius: 50%; background: var(--hover); color: var(--accent);
  font-size: 13px; font-weight: 800; display: flex; align-items: center; justify-content: center; }
.step-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.step-title { font-size: 14.5px; font-weight: 700; }
.step-note { font-size: 13px; color: var(--muted); line-height: 1.8; }
.dialog-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding-top: 18px;
  border-top: 1px solid var(--line); }

/* ---- login ------------------------------------------------------------------------------------------------------- */
.auth { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 48px 16px; }
.auth-box { width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 28px; }
.auth-box.wide { max-width: 600px; }
.auth-brand { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.auth-brand span { font-size: 24px; font-weight: 800; }
.auth-card { background: var(--surface); border-radius: 18px; padding: 28px; display: flex; flex-direction: column;
  gap: 18px; }
.auth-card h1 { font-size: 18px; font-weight: 800; }
.auth-card .input { min-height: 46px; font-size: 15px; padding: 0 14px; }
.auth-card .input.ltr { font-family: inherit; }
.otp { min-height: 56px !important; font-family: var(--mono) !important; font-size: 26px !important;
  letter-spacing: 12px; text-align: center; direction: ltr; border-color: var(--accent) !important; }
.auth-foot { display: flex; justify-content: space-between; align-items: center; font-size: 13px; }
.auth-foot a { text-decoration: none; }
.auth-hint { font-size: 14px; color: var(--muted); line-height: 1.8; text-align: center; }
.theme-text { align-self: center; min-height: 40px; padding: 0 14px; border-radius: 10px; border: 0;
  background: transparent; color: var(--faint); font: inherit; font-size: 13px; cursor: pointer; }
.theme-text:hover { color: var(--text); }
.theme-text .when-light { display: none; }
:root[data-theme="light"] .theme-text .when-light { display: inline; }
:root[data-theme="light"] .theme-text .when-dark { display: none; }

/* ---- phone width --------------------------------------------------------------------------------------------- */
@media (max-width: 760px) {
  .side { flex-basis: 100%; width: auto; height: auto; position: static; padding: 12px 12px 8px; gap: 10px;
    border-inline-end: 0; border-bottom: 1px solid var(--line); display: grid; grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "brand foot" "nav nav" "alert alert"; align-items: center; }
  .side-brand { grid-area: brand; }
  .side-foot { grid-area: foot; margin-top: 0; padding: 0; }
  .side-user { display: none; }
  .side-alert { grid-area: alert; margin: 0; }
  .nav { grid-area: nav; flex-direction: row; overflow-x: auto; gap: 2px; padding-bottom: 4px; min-width: 0; }
  .nav a { flex: none; gap: 8px; padding: 0 10px; }
  .page { padding: 24px 16px; gap: 22px; }
  .page-head h1 { font-size: 23px; }
  .search { min-width: 0; flex: 1 1 200px; }
  .head-actions { width: 100%; }
  .kv { grid-template-columns: 90px 1fr; }
  .stat-num { font-size: 34px; }
  .dialog { padding: 20px; }
}

/* late additions */
.page-stack { display: flex; flex-direction: column; gap: 28px; }
.btn-wide { width: 100%; }
.align-start { align-self: flex-start; }
.kv dd.mono { text-align: right; }
.plain-list { margin: 0; padding-inline-start: 20px; display: flex; flex-direction: column; gap: 6px; font-size: 14px;
  line-height: 1.9; color: var(--muted); }
.doc-empty { padding: 20px 24px; }
.field.small { font-size: 12.5px; gap: 6px; }
.code { white-space: nowrap; }
.step-text .code, .problem-sub .code { white-space: normal; overflow-wrap: anywhere; }
@media (max-width: 760px) {
  .live { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .live a { padding: 16px; }
  .live-value { font-size: 22px; }
}
a.icon-btn { text-decoration: none; font-size: 20px; line-height: 1; color: var(--text); }
.new-chip { display: inline-block; margin-inline-end: 8px; padding: 0 8px; border-radius: 6px; background: var(--bad);
  color: #fff; font-size: 11.5px; font-weight: 700; line-height: 1.8; vertical-align: 2px; }
