/* Atlas — the one stylesheet. Spec: docs/superpowers/specs/2026-09-03-atlas-redesign-design.md
   Sections: 1 tokens · 2 base · 3 shell · 4 controls · 5 cards+tables · 6 pills+flags
   Later tasks append: 7 login · 8 catalog · 9 form detail · 10 form data/view · 11 chat
   · 12 freshness · 13 settings · 14 sync control. Logical properties only. */

/* ---------- 1. tokens (§5.1) ---------- */
:root {
  --paper: #f7f5f0;
  --card: #ffffff;
  --line: #e7e2d9;
  --line-soft: #f0ece5;
  --well: #ece8df;
  --ink: #1c1917;
  --ink-2: #57534e;
  --ink-3: #6b655c;
  --ink-4: #9c958a;
  --accent: #0369a1;
  --accent-deep: #0c4a6e;
  --accent-soft: #e0f2fe;
  --accent-tint: #bae6fd;
  --accent-glow: #7dd3fc;
  --border-input: #d6d0c4;
  --muted-line: #c7c0b3;

  --st-ok-bg: #dcfce7;      --st-ok-fg: #15803d;
  --st-warn-bg: #fef3c7;    --st-warn-fg: #b45309;
  --st-info-bg: #e0f2fe;    --st-info-fg: #0c4a6e;
  --st-danger-bg: #fee2e2;  --st-danger-fg: #b91c1c;
  --st-neutral-bg: #f0ece5; --st-neutral-fg: #57534e;

  --font-display: 'DM Serif Display', 'Frank Ruhl Libre', serif;
  --font-body: 'DM Sans', 'IBM Plex Sans Hebrew', system-ui, sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, Menlo, monospace;

  --r-card: 14px;
  --r-ctl: 9px;
  --r-nav: 8px;
}

/* ---------- 2. base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--paper); }
body {
  font-family: var(--font-body); font-size: 13.5px; line-height: 1.45;
  color: var(--ink); -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-deep); text-decoration: underline; }
input, textarea, button, select { font-family: inherit; font-size: inherit; color: inherit; }
input:focus-visible, textarea:focus-visible, select:focus-visible, button:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 1px;
}
h1, h2, h3 { margin: 0; }
pre { margin: 0; }
.mono { font-family: var(--font-mono); font-feature-settings: "zero"; }
.muted { color: var(--ink-3); }
.dim { color: var(--ink-4); }
.hidden { display: none !important; }
.he-text { unicode-bidi: plaintext; }
.grow { flex: 1; }
@keyframes pulseDot {
  0% { box-shadow: 0 0 0 0 rgba(21,128,61,.45); }
  70% { box-shadow: 0 0 0 7px rgba(21,128,61,0); }
  100% { box-shadow: 0 0 0 0 rgba(21,128,61,0); }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; } }

/* ---------- 3. shell (§7) ---------- */
.shell { display: grid; grid-template-columns: var(--sidebar-w, 236px) 1fr; min-height: 100vh; }
.sidebar {
  background: var(--card); border-inline-end: 1px solid var(--line);
  padding: 18px 12px; display: flex; flex-direction: column; gap: 6px;
  position: sticky; top: 0; height: 100vh; overflow: auto;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 2px 8px 16px; }
.brand-logo {
  width: 28px; height: 28px; border-radius: 8px; background: var(--accent-deep); color: #fff;
  display: grid; place-items: center; font-family: var(--font-display); font-size: 17px; flex: none;
}
.brand-name { font-weight: 600; }
.nav-section {
  font-size: 10.5px; font-weight: 700; letter-spacing: .12em; color: var(--ink-4);
  padding: 14px 8px 4px; text-transform: uppercase;
}
.nav-section:first-of-type { padding-top: 6px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 0;
  border-radius: var(--r-nav); cursor: pointer; text-align: start; font-size: 13px;
  font-weight: 500; background: transparent; color: var(--ink-2); width: 100%;
}
.nav-item:hover { background: var(--paper); }
.nav-item.active { background: var(--accent-soft); color: var(--accent-deep); }
.nav-item .swatch { width: 10px; height: 10px; border-radius: 3px; flex: none; background: var(--ink); }
.nav-item .ico { width: 14px; height: 14px; flex: none; display: inline-flex; }
.nav-item .ico svg { width: 14px; height: 14px; }
.nav-item .label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-item .badge { font-family: var(--font-mono); font-size: 11px; color: var(--ink-4); background: none; padding: 0; margin: 0; }
.sidebar-foot { margin-top: auto; padding-top: 12px; }

/* ---------- 3b. menu tree (spec 2026-09-07) ---------- */
.mt-tree { display: flex; flex-direction: column; gap: 1px; }
.mt-note { font-size: 12px; color: var(--ink-3); padding: 6px 10px; }
.mt-row {
  display: flex; align-items: center; gap: 6px; padding: 4px 8px; border-radius: var(--r-nav);
  font-size: 13px; color: var(--ink-2); min-width: 0; cursor: default;
}
.mt-row.link, .mt-row.menu, .mt-row.mt-group { cursor: pointer; }
.mt-row.link:hover, .mt-row.menu:hover, .mt-row.mt-group:hover { background: var(--paper); }
.mt-row.active { background: var(--accent-soft); color: var(--accent-deep); }
.mt-row.mt-grey { color: var(--ink-4); }
.mt-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: left; }
[dir="rtl"] .mt-label { text-align: right; }
/* Neither is a <button>, so the global focus ring above does not reach them.
   Inset, because the rows sit 1px apart and an outward ring would overlap. */
.mt-label:focus-visible, .mt-group:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.mt-count, .mt-badge { font-family: var(--font-mono); font-size: 11px; color: var(--ink-4); flex: none; }
.mt-badge { border: 1px solid var(--line); border-radius: 3px; padding: 0 4px; }
.mt-chev {
  flex: none; width: 16px; height: 16px; border: 0; background: none; padding: 0; color: var(--ink-4);
  font-size: 14px; line-height: 16px; cursor: pointer; transition: transform .12s;
}
.mt-chev.open { transform: rotate(90deg); }
[dir="rtl"] .mt-chev.open { transform: rotate(-90deg); }
.mt-chev.none { visibility: hidden; }
.mt-ask { border: 0; background: none; color: var(--accent-deep); font-size: 11px; cursor: pointer; padding: 0; flex: none; }
.mt-filter { margin: 2px 0 6px; font-size: 12px; }   /* `.input` is width:100%; side margins would overflow the sidebar */
.mt-resizer {
  position: fixed; top: 0; bottom: 0; inset-inline-start: calc(var(--sidebar-w, 236px) - 3px);
  width: 6px; cursor: col-resize; z-index: 6;   /* above .topbar (5): at 2 the top ~56px of the strip was unreachable */
}
.mt-resizer:focus-visible { background: var(--accent); }

/* ---------- 3c. users, login, dialog (spec 2026-09-07) ---------- */
.login-alt { align-self: flex-start; font-size: 12.5px; }
.usr-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 10px; }
.usr-form .set-input { flex: 1 1 160px; }

/* ---------- 3c-2. table permissions (spec 2026-09-07) ----------
   Master-detail: the rail navigates, the pane edits one group. The card is
   `.set-section.wide`, i.e. full page width, so the rail costs nothing the
   detail pane wanted. Below 900px the grid collapses to one column and the
   rail simply stacks above the pane. */
.perm-layout { display: grid; grid-template-columns: minmax(240px, 300px) 1fr; gap: 20px; align-items: start; margin-block-start: 4px; }
.perm-rail { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.perm-rail-label { font-size: 11.5px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-3); }
.perm-field { display: grid; gap: 4px; min-width: 0; }
/* Same trap as `.dlg .set-input` below: the 240px flex-basis is horizontal in a
   settings ROW and becomes 240px of HEIGHT inside these column flexes. */
.perm-field .set-input, .perm-new .set-input, .perm-foot-col .set-input { flex: 0 0 auto; width: 100%; }
.perm-groups { display: flex; flex-direction: column; gap: 4px; max-height: 320px; overflow: auto; }
.perm-group {
  display: grid; gap: 5px; width: 100%; text-align: start; cursor: pointer;
  padding: 9px 11px; border: 1px solid transparent; border-radius: var(--r-nav);
  background: var(--paper); color: var(--ink); font: inherit;
}
.perm-group:hover { border-color: var(--line); }
.perm-group.on { background: var(--accent-soft); border-color: var(--accent-tint); }
/* `dir="auto"` gives each name its own bidi order, but alone it also right-aligns
   a Hebrew-only name in an English list -- the `.mt-label` finding again. Order
   follows the string; alignment follows the PAGE. */
.perm-group-name { font-weight: 600; font-size: 13px; overflow-wrap: anywhere; text-align: left; }
[dir="rtl"] .perm-group-name, [dir="rtl"] .perm-eff-name { text-align: right; }
.perm-group-meta { display: flex; flex-wrap: wrap; gap: 5px; }
.perm-group.on .perm-group-meta .st-neutral { background: var(--card); }
.perm-new { display: flex; flex-direction: column; gap: 6px; padding-block-start: 14px; border-block-start: 1px solid var(--line); }
.perm-new .set-input { flex: 1 1 auto; width: 100%; }
.perm-new .btn { align-self: start; }

.perm-detail { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.perm-head { display: flex; gap: 10px; align-items: flex-start; flex-wrap: wrap; padding-block-end: 16px; border-block-end: 1px solid var(--line); }
.perm-head-fields { display: flex; gap: 8px; flex-wrap: wrap; flex: 1 1 280px; min-width: 0; }
.perm-head-acts { display: flex; gap: 8px; align-items: center; }
.perm-block { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.perm-block-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.perm-block-head h4 { margin: 0; font-size: 13.5px; font-weight: 600; }
.perm-block-head .btn { margin-inline-start: auto; align-self: center; }
.perm-block-meta { font-size: 12px; color: var(--ink-3); }
.perm-checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 4px; max-height: 240px; overflow: auto; }
.perm-check {
  display: flex; align-items: baseline; gap: 7px; min-width: 0; cursor: pointer;
  padding: 6px 9px; border-radius: 7px; border: 1px solid transparent; font-size: 12.5px;
}
.perm-check:hover { background: var(--paper); }
.perm-check.on { background: var(--accent-soft); border-color: var(--accent-tint); }
.perm-check input { flex: none; align-self: center; }
.perm-check .mono { font-size: 11.5px; overflow-wrap: anywhere; }
.perm-all { align-self: start; }
.perm-finder { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; }
.perm-list { display: flex; flex-wrap: wrap; gap: 6px 14px; max-height: 220px; overflow: auto; padding: 8px 10px; background: var(--paper); border-radius: var(--r-ctl); }
.perm-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.perm-seed { padding-block-start: 16px; border-block-start: 1px solid var(--line); }
.perm-empty { gap: 6px; padding: 28px 20px; background: var(--paper); border-radius: var(--r-card); align-items: flex-start; }
.perm-empty-title { margin: 0; font-weight: 600; }
.perm-foot { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 20px 28px; padding-block-start: 18px; border-block-start: 1px solid var(--line); }
.perm-foot-col { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.perm-foot-col h4 { margin: 0; font-size: 13.5px; font-weight: 600; }
.perm-foot-col select.set-input { max-width: 280px; }
.perm-eff { display: flex; flex-direction: column; gap: 5px; }
.perm-eff-name { font-size: 12px; color: var(--ink-3); text-align: left; }
.perm-lock { margin-inline-start: 6px; font-size: 11px; }
.tbl .perm-ungranted td { color: var(--ink-3); }
/* Stacked, the rail's "new group" fields land straight above the pane's rename
   fields -- the four-identical-inputs confusion the two columns exist to end.
   The pane keeps its own edge so it still reads as a separate region. */
@media (max-width: 900px) {
  .perm-layout { grid-template-columns: 1fr; gap: 4px; }
  .perm-detail { padding-block-start: 20px; border-block-start: 1px solid var(--line); }
}
.dlg-backdrop { position: fixed; inset: 0; background: rgba(20, 18, 14, .35); display: flex; align-items: center; justify-content: center; z-index: 20; }
.dlg { width: min(420px, calc(100vw - 32px)); display: flex; flex-direction: column; gap: 8px; padding: 16px; }
/* .set-input's 240px flex-basis is horizontal in every settings row; in the
   dialog's column flex it became 240px of HEIGHT per input (measured: a
   959px dialog in an 860px viewport, its buttons unreachable). */
.dlg .set-input { flex: 0 0 auto; }
.login-row { display: flex; flex-direction: column; gap: 6px; }
.dlg-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 6px; }

.tenant-chip {
  display: flex; align-items: center; gap: 10px; padding: 10px; border: 1px solid var(--line);
  border-radius: 10px; background: var(--paper); width: 100%; text-align: start; cursor: default;
}
.tenant-chip.clickable { cursor: pointer; }
.tenant-chip.clickable:hover { border-color: var(--border-input); }
.tenant-chip .avatar {
  width: 30px; height: 30px; border-radius: 8px; background: var(--accent-soft); color: var(--accent-deep);
  display: grid; place-items: center; font-weight: 700; font-size: 12px; flex: none;
}
.tenant-chip .name { display: block; font-weight: 600; font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tenant-chip .role-line { display: block; font-size: 11px; color: var(--ink-4); }
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; gap: 14px; padding: 12px 28px; border-bottom: 1px solid var(--line);
  background: rgba(247,245,240,.9); position: sticky; top: 0; z-index: 5; backdrop-filter: blur(8px);
}
.crumbs { display: flex; align-items: center; gap: 8px; color: var(--ink-3); font-size: 13px; }
.crumbs .sep { color: var(--muted-line); }
.crumbs .now { color: var(--ink); font-weight: 600; }
.content { padding: 28px; display: flex; flex-direction: column; gap: 18px; flex: 1; }

/* ---------- 4. controls ---------- */
.seg { display: inline-flex; padding: 3px; background: var(--well); border-radius: var(--r-ctl); gap: 3px; }
.seg > button {
  padding: 6px 12px; border: 0; border-radius: 7px; font-size: 12.5px; font-weight: 600;
  cursor: pointer; background: transparent; color: var(--ink-3);
}
.seg > button.on { background: var(--card); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.seg.seg-sm > button { padding: 4px 10px; font-size: 12px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 14px;
  border: 1px solid var(--border-input); border-radius: var(--r-ctl); background: var(--card);
  color: var(--ink-2); font-size: 12.5px; font-weight: 500; cursor: pointer;
}
.btn:hover { background: var(--paper); }
.btn:disabled { color: var(--muted-line); cursor: default; background: var(--card); }
.btn-sm { padding: 5px 10px; font-size: 12px; border-radius: 7px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.btn.primary:hover { background: var(--accent-deep); border-color: var(--accent-deep); }
.btn.danger:hover { border-color: var(--st-danger-fg); color: var(--st-danger-fg); background: var(--card); }
.btn.link { border: 0; background: none; padding: 0; color: var(--accent); font-weight: 600; }
.btn.link:hover { color: var(--accent-deep); text-decoration: underline; }
.btn.link.on { color: var(--accent-deep); text-decoration: underline; }
.input, .select, .textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border-input); border-radius: var(--r-ctl);
  background: var(--card); color: var(--ink); font-size: 13px;
}
.input.mono, .textarea.mono { font-family: var(--font-mono); }
.textarea { resize: vertical; min-height: 44px; line-height: 1.4; }
.select { appearance: auto; }
.search {
  display: flex; align-items: center; gap: 8px; padding: 8px 12px; border: 1px solid var(--border-input);
  border-radius: var(--r-ctl); background: var(--card); width: 300px; max-width: 100%;
}
.search svg { width: 14px; height: 14px; color: var(--ink-4); flex: none; }
.search input { border: 0; outline: 0; flex: 1; min-width: 0; font-size: 13px; background: transparent; color: var(--ink); }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.tabs .tab {
  padding: 10px 14px; border: 0; border-bottom: 2px solid transparent; margin-bottom: -1px;
  background: none; cursor: pointer; font-size: 13px; font-weight: 600; color: var(--ink-3);
  display: inline-flex; gap: 8px; align-items: center; border-radius: 0;
}
.tabs .tab:hover { color: var(--ink); }
.tabs .tab.active { color: var(--accent-deep); background: none; border-color: transparent; border-bottom-color: var(--accent); }
.tab .badge {
  font-family: var(--font-mono); font-size: 11px; padding: 1px 6px; border-radius: 999px;
  background: var(--line-soft); color: var(--ink-4);
}
.tabs .tab.active .badge { background: var(--accent-soft); color: var(--accent-deep); }
/* `.tab` outside `.tabs` is the small action button every page already uses. */
.tab {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border: 1px solid var(--border-input);
  border-radius: 7px; background: var(--card); color: var(--ink-2); font-size: 12.5px; font-weight: 500; cursor: pointer;
}
.tab:hover { background: var(--paper); }
.tab:disabled { color: var(--muted-line); cursor: default; background: var(--card); }
.tab.active { background: var(--ink); border-color: var(--ink); color: #fff; }

/* ---------- 5. page head, cards, tables ---------- */
.page-head { display: flex; align-items: flex-end; gap: 14px; flex-wrap: wrap; }
.page-eyebrow { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 600; margin-bottom: 6px; }
.page-eyebrow .swatch { width: 10px; height: 10px; border-radius: 3px; background: currentColor; }
.page-title { font-family: var(--font-display); font-weight: 400; font-size: 34px; letter-spacing: -.01em; line-height: 1; }
.page-title .count { color: var(--ink-4); font-size: 22px; }
.page-sub { color: var(--ink-3); margin-top: 4px; }
.page-actions { display: flex; align-items: center; gap: 8px; margin-inline-start: auto; flex-wrap: wrap; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-card); overflow: hidden; }
.card-head { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); font-weight: 600; }
.card-body { padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.tbl-wrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl thead th {
  text-align: start; padding: 12px 16px; border-bottom: 1px solid var(--line); color: var(--ink-3);
  font-size: 11.5px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; white-space: nowrap;
}
.tbl thead th.num, .tbl tbody td.num { text-align: end; }
.tbl tbody td { padding: 11px 16px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl .mono { font-size: 12px; color: var(--ink-2); }
.tbl.tbl-clickable tbody tr, .tbl tr.row-clickable { cursor: pointer; }
.tbl.tbl-clickable tbody tr:hover, .tbl tr.row-clickable:hover { background: var(--paper); }
.tbl tr.row-dim td { opacity: .5; }
.tbl tr.row-warn td { background: var(--st-warn-bg); }
.pager { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 16px; border-top: 1px solid var(--line); color: var(--ink-4); font-size: 12px; }
.pager .page-info { font-family: var(--font-mono); direction: ltr; unicode-bidi: isolate; }
.pager .arrows { display: flex; gap: 6px; }
.pager button { padding: 5px 10px; border: 1px solid var(--border-input); border-radius: 7px; background: var(--card); color: var(--ink); cursor: pointer; }
.pager button:disabled { color: var(--muted-line); cursor: default; }
.error-pane { padding: 14px 16px; border-radius: 10px; background: var(--st-danger-bg); color: var(--st-danger-fg); font-size: 12.5px; }
.empty-tab-card { display: flex; align-items: flex-start; gap: 16px; padding: 22px; }
.empty-tab-icon { flex: none; width: 56px; height: 56px; border-radius: 50%; background: var(--line-soft); color: var(--ink-4); display: grid; place-items: center; }
.empty-tab-text h4 { margin: 0 0 6px; font-size: 14px; }
.empty-tab-text p { margin: 0 0 4px; color: var(--ink-3); max-width: 60ch; }
[dir="rtl"] .tbl td.mono, [dir="rtl"] .trig-name { direction: ltr; unicode-bidi: isolate; text-align: end; }

/* ---------- 6. pills, chips, flags ---------- */
.pill, .chip {
  display: inline-flex; align-items: center; gap: 6px; border-radius: 999px; font-weight: 600;
  background: var(--st-neutral-bg); color: var(--st-neutral-fg); white-space: nowrap;
}
.pill { padding: 5px 11px; font-size: 12px; }
.chip { padding: 3px 9px; font-size: 11.5px; }
.pill .dot, .chip .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill .dot.live { animation: pulseDot 1.8s infinite; }
.st-ok { background: var(--st-ok-bg); color: var(--st-ok-fg); }
.st-warn { background: var(--st-warn-bg); color: var(--st-warn-fg); }
.st-info { background: var(--st-info-bg); color: var(--st-info-fg); }
.st-danger { background: var(--st-danger-bg); color: var(--st-danger-fg); }
.st-neutral { background: var(--st-neutral-bg); color: var(--st-neutral-fg); }
.flags { display: inline-flex; gap: 5px; flex-wrap: wrap; }
.flag {
  padding: 2px 7px; border-radius: 5px; font-size: 10.5px; font-weight: 700; letter-spacing: .04em;
  background: var(--st-neutral-bg); color: var(--st-neutral-fg); text-transform: uppercase;
}
.flag.key { background: var(--accent-deep); color: #fff; }
.flag.trig { background: var(--st-warn-bg); color: var(--st-warn-fg); cursor: pointer; }
.trig-dot {
  display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 5px;
  font-size: 10.5px; font-weight: 700; margin-inline-end: 4px;
}
.trig-dot.f { background: var(--st-info-bg); color: var(--st-info-fg); }
.trig-dot.c { background: var(--st-warn-bg); color: var(--st-warn-fg); }

/* ---------- 7. login + tenant picker (§6) ---------- */
.login-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.login-hero {
  position: relative; overflow: hidden; background: var(--accent-deep); color: #fff; padding: 48px 56px;
  display: flex; flex-direction: column; justify-content: space-between; gap: 32px;
}
.login-hero .brand { padding: 0; }
.login-hero .brand-logo { width: 34px; height: 34px; border-radius: 9px; background: #fff; color: var(--accent-deep); font-size: 20px; }
.login-hero-copy { max-width: 560px; }
.login-hero-title { font-family: var(--font-display); font-weight: 400; font-size: 56px; line-height: 1.02; letter-spacing: -.015em; margin: 0 0 18px; }
.login-hero-sub { font-size: 16px; color: var(--accent-tint); max-width: 460px; text-wrap: pretty; margin: 0; }
.login-markers { display: flex; gap: 28px; font-size: 12.5px; color: var(--accent-glow); flex-wrap: wrap; }
.login-markers .dot, .login-foot .dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: #4ade80; margin-inline-end: 6px; vertical-align: middle; }
.login-glow {
  position: absolute; inset-inline-end: -120px; bottom: -140px; width: 420px; height: 420px; border-radius: 50%;
  background: radial-gradient(circle, #0284c7 0%, rgba(2,132,199,0) 70%); opacity: .6; pointer-events: none;
}
.login-pane { display: flex; align-items: center; justify-content: center; padding: 40px; }
.login-card { width: 100%; max-width: 420px; position: relative; }
.login-lang { position: absolute; top: -52px; inset-inline-end: 0; }
.login-title { font-family: var(--font-display); font-weight: 400; font-size: 32px; letter-spacing: -.01em; margin: 0 0 6px; }
.login-sub { color: var(--ink-3); margin: 0 0 22px; }
.login-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; margin-bottom: 22px; width: 100%; border-radius: 10px; }
.login-tabs > button { padding: 9px; font-size: 13px; }
.login-panel { display: flex; flex-direction: column; gap: 6px; }
.login-label { display: block; font-size: 12px; font-weight: 600; color: var(--ink-2); margin-top: 8px; }
.login-panel .input { padding: 11px 13px; font-size: 14px; }
.login-submit { width: 100%; margin-top: 14px; padding: 12px; font-size: 14px; }
.login-error { margin: 12px 0 0; color: var(--st-danger-fg); font-size: 12.5px; }
.login-error:empty { display: none; }
.login-foot { display: flex; gap: 16px; margin-top: 22px; font-size: 12px; color: var(--ink-4); flex-wrap: wrap; }
.login-card .pill { margin-bottom: 14px; }
.tenant-list { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 12px; background: var(--card); overflow: hidden; margin-bottom: 16px; }
.tenant-list > .dim { padding: 14px; margin: 0; }
.tenant-row {
  display: grid; grid-template-columns: 36px 1fr auto; gap: 12px; align-items: center; padding: 12px 14px;
  border: 0; border-bottom: 1px solid var(--line-soft); background: var(--card); cursor: pointer;
  text-align: start; color: var(--ink); width: 100%;
}
.tenant-row:last-child { border-bottom: 0; }
.tenant-row:hover { background: var(--paper); }
.tenant-row .avatar { width: 36px; height: 36px; border-radius: 9px; display: grid; place-items: center; font-weight: 700; font-size: 13px; }
.tenant-row .tenant-name { display: block; font-weight: 600; }
.tenant-row .tenant-meta { display: block; font-size: 12px; color: var(--ink-4); font-family: var(--font-mono); }
.tenant-row.inactive .tenant-name { color: var(--ink-4); }
@media (max-width: 900px) {
  .login-wrap { grid-template-columns: 1fr; }
  .login-hero { padding: 32px; }
  .login-hero-title { font-size: 40px; }
  .login-lang { position: static; margin-bottom: 12px; }
}
[dir="rtl"] .login-submit [aria-hidden="true"] { display: inline-block; transform: scaleX(-1); }

/* ---------- 8. catalog (§7.1) ---------- */
.trig-cell { display: inline-flex; gap: 4px; }

/* ---------- 9. form detail (§7.2) ---------- */
.form-head { display: flex; align-items: flex-start; gap: 16px; }
.form-head .swatch { width: 44px; height: 44px; border-radius: 11px; flex: none; }
.form-meta { font-family: var(--font-mono); font-size: 12px; color: var(--ink-3); margin-top: 4px; }
.form-meta strong { color: var(--ink); font-weight: 500; }
.alt-title { color: var(--ink-3); }
.triggers { display: flex; flex-direction: column; gap: 10px; }
.trig-group { font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-4); margin: 8px 0 0; }
.trig-block { background: var(--card); border: 1px solid var(--line); border-inline-start: 4px solid var(--accent); border-radius: 12px; overflow: hidden; }
.trig-block.custom { border-inline-start-color: var(--st-warn-fg); }
.trig-block.nested { margin: 8px 0; border-radius: 8px; }
.trig-head { display: flex; align-items: center; gap: 10px; padding: 10px 14px; cursor: pointer; flex-wrap: wrap; }
.trig-name { font-size: 12.5px; font-weight: 500; }
.trig-scope { font-size: 11.5px; color: var(--ink-4); }
.trig-sql {
  padding: 12px 14px; background: var(--paper); border-top: 1px solid var(--line-soft);
  font-family: var(--font-mono); font-size: 12px; line-height: 1.55; color: #44403c;
  white-space: pre-wrap; text-align: left; overflow-x: auto;
}
.inc-wrap { display: inline; }
.inc-chip { display: inline-block; padding: 0 6px; border-radius: 5px; background: var(--accent-soft); color: var(--accent-deep); cursor: pointer; font-weight: 500; }
.inc-chip.open { background: var(--accent-deep); color: #fff; }
.inc-chip.dead { background: var(--line-soft); color: var(--ink-4); cursor: default; }
.inc-chip.retry { background: var(--st-warn-bg); color: var(--st-warn-fg); }
.inc-body { display: block; margin: 6px 0; margin-inline-start: 16px; }

/* ---------- 10. form data + form view tabs (§7.2) ---------- */
.badge {
  display: inline-flex; align-items: center; padding: 1px 7px; border-radius: 999px; font-size: 11px;
  font-weight: 600; background: var(--line-soft); color: var(--ink-2); font-family: var(--font-mono);
  margin-inline-start: 6px;
}
.fd { display: flex; flex-direction: column; gap: 14px; }
.fd-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.fd-env { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--ink-3); }
.fd-env select { padding: 7px 10px; border: 1px solid var(--border-input); border-radius: var(--r-ctl); background: var(--card); font-family: var(--font-mono); font-size: 12px; color: var(--ink); }
.fd-head .tabs { border-bottom: 0; }
.fd-empty { padding: 16px 20px; color: var(--ink-3); display: flex; flex-direction: column; gap: 10px; }
.fd-run { padding: 16px 20px; }
.fd-note { color: var(--ink-4); font-size: 11.5px; padding: 10px 16px; border-top: 1px solid var(--line); }
.fd-src { color: var(--ink-4); font-size: 12px; margin-bottom: 12px; line-height: 1.5; }
.fd-filter { display: flex; gap: 6px; padding: 10px 12px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.fd-empty .fd-filter { padding: 0; border-bottom: 0; }
.fd-kv { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 4px 24px; }
.fd-kv-row { display: flex; justify-content: space-between; gap: 8px; padding: 4px 0; border-bottom: 1px solid var(--line-soft); }
.fd-k { color: var(--ink-4); font-size: 11.5px; }
.fd-v { font-size: 12px; }
.fd-warn { margin-top: 12px; padding: 10px 12px; border-radius: 10px; background: var(--st-warn-bg); color: var(--st-warn-fg); font-size: 12.5px; }
.fd-detail { margin-top: 10px; white-space: pre-wrap; font-family: var(--font-mono); font-size: 11.5px; color: var(--ink-3); padding: 10px 12px; background: var(--paper); border-radius: 8px; }
.fd-raw { margin-top: 0; }
.fd-raw-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 16px; border-bottom: 1px solid var(--line); }
.fd-raw-text { max-height: 420px; overflow: auto; white-space: pre; font-family: var(--font-mono); font-size: 11.5px; padding: 12px 16px; background: var(--paper); }
.fd-colname { color: var(--ink-4); font-size: 10px; font-weight: 400; text-transform: none; letter-spacing: 0; }
.fd-pager { display: flex; gap: 6px; padding: 10px 16px; border-top: 1px solid var(--line); }
.fd-empty .fd-pager { padding: 0; border-top: 0; }
.fv-tab { display: flex; flex-direction: column; gap: 12px; }
.fv-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.fv-note { color: var(--ink-4); font-size: 11.5px; }
.fv-title { color: var(--ink-3); font-weight: 400; margin-inline: 6px; text-transform: none; letter-spacing: 0; }
.fv-list { margin: 6px 0 0; padding-inline-start: 18px; font-size: 12.5px; display: flex; flex-direction: column; gap: 3px; }
.fv-dropped summary { cursor: pointer; padding: 12px 16px; font-weight: 600; }
.fv-dropped > p, .fv-dropped > ul { padding-inline: 16px; padding-bottom: 12px; margin: 0; }
.fv-envbar { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--ink-3); }
.fv-envbar select { padding: 7px 10px; border: 1px solid var(--border-input); border-radius: var(--r-ctl); background: var(--card); font-family: var(--font-mono); font-size: 12px; color: var(--ink); }
.fv-rows { display: flex; flex-direction: column; gap: 12px; }
.fv-pager { display: flex; align-items: center; gap: 6px; padding: 10px 16px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.fv-strip { display: flex; flex-direction: column; gap: 10px; }
.fv-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.fv-chip { display: inline-flex; gap: 6px; align-items: center; padding: 5px 11px; border-radius: 999px; border: 1px solid var(--line); background: var(--card); font-size: 12px; cursor: pointer; color: var(--ink-2); }
.fv-chip.active { border-color: var(--ink); background: var(--ink); color: #fff; }
.fv-group { padding: 10px 16px; border-bottom: 1px solid var(--line-soft); display: flex; flex-direction: column; gap: 6px; }
.fv-group:last-child { border-bottom: 0; }
.fv-enames { display: flex; gap: 4px; flex-wrap: wrap; padding: 10px 16px; }
.fv-search { width: calc(100% - 32px); margin: 12px 16px 0; padding: 8px 12px; border: 1px solid var(--border-input); border-radius: var(--r-ctl); background: var(--card); font-family: var(--font-mono); font-size: 12px; }
.fv-ok { color: var(--st-ok-fg); }
.fv-blocked { color: var(--ink-4); }
.fv-fanout { color: var(--st-warn-fg); }
.fv-error { color: var(--st-danger-fg); }
.badge.fv-empty { background: var(--st-warn-bg); color: var(--st-warn-fg); }
.tab .badge { margin: 0; }
.card > .fv-note { padding: 0 16px 10px; }
.card > .btn-sm { margin: 0 16px 12px; }
.fv-pad { padding: 16px 20px; display: flex; flex-direction: column; gap: 10px; }
.fv-pad p { margin: 0; }
.fv-sql > summary { padding: 12px 16px; cursor: pointer; font-weight: 600; }
.fv-sql > pre { margin: 0 16px 14px; }

/* ---------- 11. chat (§7.3; charts/history spec 2026-09-05 §7) ---------- */
/* 163px = .topbar 55 + .content padding 28 + .page-head 34 + gap 18 + bottom padding 28,
   measured at 1280x800 with the fonts loaded; 160 left a 3px page scrollbar. */
.chat-grid { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 18px; align-items: stretch; height: calc(100vh - 163px); min-height: 480px; }
.chat-grid.has-canvas { grid-template-columns: 240px minmax(0, 1fr) minmax(0, 1fr); }
/* rail */
.chat-rail { display: flex; flex-direction: column; gap: 4px; min-height: 0; overflow-y: auto; padding-inline-end: 4px; }
.chat-rail-new { margin-bottom: 8px; }
.chat-rail-label { padding: 6px 0 2px; }
.chat-rail-empty { color: var(--ink-4); font-size: 12px; padding: 6px 10px; }
.chat-conv { display: flex; align-items: center; gap: 6px; padding: 7px 10px; border-radius: 8px; cursor: pointer; font-size: 12.5px; color: var(--ink-2); }
.chat-conv:hover { background: var(--line-soft); }
.chat-conv.active { background: var(--accent-soft); color: var(--accent-deep); }
.chat-conv[aria-disabled="true"] { cursor: default; opacity: .6; }
.chat-conv-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-conv-time { font-size: 10.5px; color: var(--ink-4); direction: ltr; unicode-bidi: isolate; }
.chat-conv-del { visibility: hidden; border: 0; background: none; color: var(--ink-4); cursor: pointer; font-size: 14px; line-height: 1; padding: 0 2px; }
/* :focus-within, not just :hover -- the row itself is the tab stop
   (role="button" tabIndex={0}), and a visibility:hidden button is pulled
   out of tab order entirely, so a keyboard user could never reach it: they
   would tab past every row and never land on the delete control. Focusing
   the row reveals the button, and the NEXT Tab press lands on it, now that
   it is visible. */
.chat-conv:hover .chat-conv-del, .chat-conv:focus-within .chat-conv-del { visibility: visible; }
.chat-conv-del:hover { color: var(--st-danger-fg); }
.chat-rail-select { display: none; gap: 6px; }
.chat-rail-select select { flex: 1; min-width: 0; }
/* messages */
.chat-card { display: flex; flex-direction: column; min-height: 0; }
.chat-messages { flex: 1; min-height: 0; overflow-y: auto; padding: 22px; display: flex; flex-direction: column; gap: 20px; }
.chat-empty { margin: auto 0; display: flex; flex-direction: column; gap: 16px; align-items: center; text-align: center; }
.chat-empty-title { color: var(--ink-4); font-size: 15px; }
.chat-suggest-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; width: 100%; max-width: 720px; }
.chat-suggest {
  text-align: start; padding: 11px 13px; border: 1px solid var(--line); border-inline-start: 3px solid var(--accent);
  border-radius: 10px; background: var(--card); font-size: 12.5px; color: var(--ink); cursor: pointer; text-wrap: pretty;
}
.chat-suggest:hover { background: var(--paper); }
.chat-suggest:disabled { cursor: default; opacity: .6; }
.chat-note { max-width: 720px; padding: 12px 13px; border-radius: 10px; background: var(--accent-soft); color: var(--accent-deep); font-size: 12px; text-wrap: pretty; }
.chat-msg { display: flex; gap: 12px; }
.chat-av {
  width: 28px; height: 28px; border-radius: 8px; flex: none; display: grid; place-items: center;
  font-size: 11px; font-weight: 700; background: var(--line-soft); color: var(--ink-2);
}
.chat-av.assistant { background: var(--accent-deep); color: #fff; }
.chat-msg-body { min-width: 0; flex: 1; }
.chat-msg-role { font-size: 11.5px; font-weight: 600; color: var(--ink-4); margin-bottom: 4px; }
.chat-msg-text { margin: 0 0 8px; line-height: 1.55; text-wrap: pretty; }
.chat-msg-text:last-child { margin-bottom: 0; }
/* markdown */
.chat-h { font-weight: 600; margin: 12px 0 4px; line-height: 1.3; }
.chat-h1 { font-size: 16px; } .chat-h2 { font-size: 15px; } .chat-h3 { font-size: 14px; }
.chat-list { margin: 0 0 8px; padding-inline-start: 22px; line-height: 1.55; }
.chat-list p { margin: 0; }
.chat-code { margin: 8px 0; padding: 10px 12px; border-radius: 8px; background: var(--line-soft); font-size: 12px; overflow-x: auto; white-space: pre; }
.chat-codespan { font-size: .92em; padding: 1px 4px; border-radius: 4px; background: var(--line-soft); unicode-bidi: isolate; }
.chat-quote { margin: 8px 0; padding: 4px 12px; border-inline-start: 3px solid var(--line); color: var(--ink-3); }
.chat-hr { border: 0; border-top: 1px solid var(--line); margin: 12px 0; }
/* tables */
.chat-result { margin: 12px 0; border: 1px solid var(--line); border-radius: 10px; overflow: auto; max-height: 360px; }
.chat-result-tall { max-height: none; height: 100%; margin: 0; }
/* A fixed 40px (box-sizing is border-box, so it includes the 1px border) so the sticky th below
   can sit at exactly top: 40px; with padding-derived height the th sat 10px under the head. */
.chat-result-head { display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 10px; background: var(--paper); border-bottom: 1px solid var(--line); font-size: 11.5px; color: var(--ink-4); position: sticky; top: 0; z-index: 2; }
.chat-result-count { flex: 1; }
.chat-result .tbl { font-size: 12.5px; }
.chat-result .tbl thead th { background: var(--paper); text-transform: none; letter-spacing: 0; padding: 8px 12px; position: sticky; top: 40px; z-index: 1; }
.chat-result .tbl tbody td { padding: 8px 12px; }
.chat-result .tbl td.num, .chat-result .tbl th.num { font-variant-numeric: tabular-nums; direction: ltr; unicode-bidi: isolate; }
/* charts */
.chat-figure { margin: 12px 0; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.chat-figure-head { display: flex; align-items: center; gap: 8px; padding: 8px 12px; font-size: 12.5px; font-weight: 600; background: var(--paper); border-bottom: 1px solid var(--line); }
.chat-figure-head span { flex: 1; min-width: 0; }
.chat-figure-wait { padding: 14px; color: var(--ink-4); font-size: 12px; }
.chat-chart { position: relative; padding: 10px; }
.chat-figure-err { margin: 12px 0; padding: 10px 12px; border-radius: 10px; background: var(--st-danger-bg); color: var(--st-danger-fg); font-size: 12.5px; }
.chat-figure-err pre { margin: 6px 0 0; white-space: pre-wrap; font-size: 11px; }
/* tool traces, notices, composer (unchanged) */
.chat-tool { margin-top: 10px; border-radius: 8px; background: var(--line-soft); font-family: var(--font-mono); font-size: 11.5px; color: var(--ink-2); text-align: left; }
.chat-tool summary { padding: 6px 10px; cursor: pointer; }
.chat-tool-name { color: var(--accent); font-weight: 600; }
.chat-tool-err { background: var(--st-danger-bg); color: var(--st-danger-fg); }
.chat-tool-errmsg { color: var(--st-danger-fg); }
.chat-tool-args { padding: 8px 10px; border-top: 1px solid var(--line); white-space: pre-wrap; font-size: 11px; color: var(--ink-3); }
.chat-notice { margin: 8px 0; padding: 10px 12px; border-radius: 10px; background: var(--st-danger-bg); color: var(--st-danger-fg); font-size: 12.5px; }
.chat-nokey { margin: 8px 0; padding: 14px 16px; background: var(--st-warn-bg); border-color: var(--st-warn-bg); color: var(--st-warn-fg); }
.chat-nokey-title { font-weight: 600; margin-bottom: 4px; }
.chat-nokey-detail { color: var(--ink-2); margin-bottom: 8px; }
.chat-pending { color: var(--ink-4); font-size: 12px; }
.chat-composer { display: flex; gap: 10px; padding: 14px; border-top: 1px solid var(--line); align-items: flex-end; }
.chat-input { flex: 1; padding: 11px 13px; border-radius: 10px; font-size: 13.5px; max-height: 220px; }
.chat-banner { background: var(--card); color: var(--ink-3); font-weight: 500; border: 1px solid var(--line); }
/* canvas */
.chat-canvas { display: flex; flex-direction: column; min-height: 0; }
.chat-canvas-head { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-bottom: 1px solid var(--line); font-weight: 600; }
.chat-canvas-head span { flex: 1; min-width: 0; }
.chat-canvas-body { flex: 1; min-height: 0; overflow: auto; padding: 12px; }
.chat-canvas-body .chat-chart { height: 100%; }
@media (max-width: 1100px) {
  .chat-grid, .chat-grid.has-canvas { grid-template-columns: 1fr; height: auto; }
  .chat-rail { display: none; }
  .chat-rail-select { display: flex; }
  .chat-messages { max-height: 60vh; }
  .chat-canvas { min-height: 360px; }
  .chat-suggest-grid { grid-template-columns: 1fr; }
}

/* ---------- 12. mirror freshness (§7.4) ---------- */
.kpi-rail { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; }
.kpi { padding: 14px 16px; border-radius: 12px; }
.kpi .label { font-size: 11.5px; font-weight: 600; opacity: .8; }
.kpi .value { font-family: var(--font-display); font-size: 30px; line-height: 1.1; margin-top: 2px; }
.st-fresh { background: var(--st-ok-bg); color: var(--st-ok-fg); }
.st-due { background: var(--st-warn-bg); color: var(--st-warn-fg); }
.st-running { background: var(--st-info-bg); color: var(--accent); }
.st-failing { background: var(--st-danger-bg); color: var(--st-danger-fg); }
.st-parked { background: var(--st-neutral-bg); color: var(--st-neutral-fg); }
.st-blocked { background: var(--st-danger-bg); color: var(--st-danger-fg); }
.mf-pass { display: grid; grid-template-columns: auto 1fr auto; gap: 18px; align-items: center; padding: 16px 18px; }
.mf-pass-label { font-size: 11.5px; font-weight: 600; color: var(--ink-3); }
.mf-pass-n { font-size: 20px; font-weight: 600; }
.mf-pass-n .of { color: var(--ink-4); font-weight: 400; }
.mf-bar { height: 10px; border-radius: 5px; background: var(--line-soft); overflow: hidden; }
.mf-bar-fill { height: 100%; background: var(--accent); border-radius: 5px; }
.mf-pass-meta { display: flex; justify-content: space-between; gap: 12px; font-size: 11.5px; color: var(--ink-4); margin-top: 6px; flex-wrap: wrap; }
.pills { gap: 4px; padding: 10px 12px; flex-wrap: wrap; font-weight: 500; }
.pills .tab { border: 0; border-radius: 999px; padding: 6px 12px; font-weight: 600; background: transparent; }
.pills .tab.active { background: var(--ink); color: #fff; }
.mf-drift-row { display: flex; gap: 8px; flex-wrap: wrap; padding: 8px 0; border-top: 1px solid var(--line-soft); }
.mf-drift-row:first-child { border-top: 0; padding-top: 0; }
@media (max-width: 1100px) { .kpi-rail { grid-template-columns: repeat(3, 1fr); } .mf-pass { grid-template-columns: 1fr; } }

/* ---------- 13. settings (§7.5) ---------- */
/* Multi-column, not a 2-up grid: a grid row is as tall as its tallest
   card, and the agent-harness card is several times the height of the
   ones beside it -- which left ~800px of blank column under the short
   card next to it. Columns flow instead of aligning, so the cards pack.
   `break-inside: avoid` is what keeps a card from being split across the
   column boundary; without it this trades a gap for a torn card. */
.set-page { columns: 2; column-gap: 18px; }
.set-section { padding: 20px; display: flex; flex-direction: column; gap: 12px;
               break-inside: avoid; margin-bottom: 18px; }
.set-section.wide { column-span: all; }
.set-section h3 { font-size: 15px; font-weight: 600; }
.set-note { color: var(--ink-3); font-size: 12.5px; margin: 0; }
.set-note-warn { color: var(--st-warn-fg); }
.set-caveats { margin: 0; padding-inline-start: 18px; color: var(--ink-3); font-size: 12.5px; display: flex; flex-direction: column; gap: 4px; }
.set-caveat-warn { color: var(--st-warn-fg); font-weight: 600; }
.set-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.set-input {
  flex: 1 1 240px; padding: 10px 12px; border: 1px solid var(--border-input); border-radius: var(--r-ctl);
  background: var(--card); color: var(--ink); font-size: 13px; font-family: var(--font-mono);
}
.set-status { color: var(--ink-3); font-size: 12.5px; }
.set-radio { display: flex; align-items: center; gap: 6px; }
.set-field-label { display: block; font-size: 12px; font-weight: 600; color: var(--ink-2); }
.set-error { padding: 10px 12px; border-radius: 10px; background: var(--st-danger-bg); color: var(--st-danger-fg); font-size: 12.5px; }
.set-once { padding: 12px 14px; border-radius: 10px; background: var(--st-ok-bg); display: flex; flex-direction: column; gap: 6px; }
.set-once-warn, .set-once-note { color: var(--st-warn-fg); font-size: 12.5px; font-weight: 600; }
.set-once-label { font-size: 12px; color: var(--ink-2); }
.set-once-row { display: flex; gap: 8px; align-items: center; }
.set-once-val { flex: 1; font-family: var(--font-mono); font-size: 12px; background: var(--card); padding: 8px 10px; border-radius: 7px; border: 1px solid var(--line); word-break: break-all; user-select: all; }
.set-section .tbl-wrap { border: 1px solid var(--line); border-radius: 10px; }
@media (max-width: 1100px) { .set-page { columns: 1; } }

/* ---------- 14. sync control (§7.6) ---------- */
.sync-page { display: flex; flex-direction: column; gap: 18px; }
.sync-page .tab:disabled { opacity: .5; cursor: not-allowed; }
.sync-sections { display: flex; flex-direction: column; gap: 28px; }
.sync-section { display: flex; flex-direction: column; gap: 14px; }
.sync-panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-card); padding: 20px; display: flex; flex-direction: column; gap: 10px; }
.sync-panel h3 { font-size: 15px; font-weight: 600; }
.sync-panel > .muted { max-width: 72ch; }
.sync-header { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.sync-header .set-input { min-width: 170px; flex: 0 1 auto; }
.sync-field { display: grid; gap: 4px; }
.sync-field-label { font-size: 12px; font-weight: 600; color: var(--ink-2); line-height: 16px; }
.sync-field-hint { font-size: 11.5px; color: var(--ink-4); }
.sync-static { display: flex; align-items: baseline; gap: 6px; padding-bottom: 8px; }
.sync-static .mono { font-size: 12.5px; color: var(--ink); }
.sync-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.sync-sub { font-size: 12.5px; color: var(--ink-3); max-width: 72ch; }
.sync-sub2 { font-size: 11.5px; color: var(--ink-3); font-weight: 600; margin-block-start: 8px; padding-block-start: 10px; border-block-start: 1px solid var(--line-soft); }
.sync-sub-danger { color: var(--ink); }
.sync-sub-danger strong { font-weight: 600; }
.sync-fieldset { display: grid; gap: 4px; justify-items: start; }
.sync-fieldset > .sync-field-hint { justify-self: stretch; max-width: 72ch; }
.sync-fieldset .sync-row > .set-input { flex: 0 0 auto; align-self: stretch; }
.sync-hintline { font-size: 11.5px; color: var(--ink-4); }
.sync-formrow { align-items: flex-start; gap: 16px; }
.sync-formrow > .tab { margin-block-start: 20px; }
.sync-notice { padding: 10px 12px; border-radius: 10px; background: var(--st-ok-bg); color: var(--st-ok-fg); font-size: 12.5px; }
.sync-warn { padding: 8px 10px; border-radius: 8px; background: var(--st-warn-bg); color: var(--st-warn-fg); font-size: 12.5px; }
.sync-warn-inline { color: var(--st-warn-fg); font-size: 11.5px; white-space: nowrap; }
.sync-drift { color: var(--st-warn-fg); font-size: 11.5px; }
.sync-badge { font-size: 10.5px; text-transform: uppercase; letter-spacing: .04em; padding: 2px 8px; border-radius: 999px; background: var(--st-ok-bg); color: var(--st-ok-fg); font-weight: 700; }
.sync-plan-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; }
.sync-plan-row:hover { background: var(--paper); }
.sync-plan-row.sel { border-color: var(--accent); background: var(--accent-soft); }
.sync-plan-row.active { border-inline-start: 3px solid var(--st-ok-fg); }
.sync-plan-new > .set-input { flex: 0 1 280px; }
.sync-member { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border: 1px solid var(--line); border-radius: 10px; font-size: 12.5px; flex-wrap: wrap; }
.sync-member > span[dir="auto"]:not([class]) { flex: 1; }
.sync-member-hook { color: var(--ink-3); font-size: 11.5px; }
.sync-member-unrunnable { opacity: .6; }
.sync-adds { display: flex; flex-direction: column; gap: 16px; margin-block-start: 4px; padding-block-start: 12px; border-block-start: 1px solid var(--line-soft); }
.sync-script-row { padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; }
.sync-script-row.sel { border-color: var(--accent); background: var(--accent-soft); }
.sync-script-row > .sync-member { border: 0; padding: 0; }
.sync-script-name > .set-input { width: 280px; max-width: 100%; }
.sync-script-code { justify-items: stretch; }
.sync-attach { background: var(--paper); }
.sync-attach-line { font-size: 11.5px; color: var(--ink); }
.sync-attach-opt { display: grid; grid-template-columns: auto 1fr; gap: 2px 8px; align-items: center; padding: 6px 8px; border-radius: 8px; cursor: pointer; }
.sync-attach-opt.sel { background: var(--accent-soft); }
.sync-attach-opt .sync-field-hint { grid-column: 2; }
.sync-attach-opt .sync-warn-inline { grid-column: 2; white-space: normal; }
.sync-attach-name { color: var(--ink); }
.sync-attach-opt.sel .sync-attach-name { font-weight: 600; }
.sync-attach-opt.off .sync-attach-name { opacity: .5; }
.sync-editor-wrap { position: relative; min-height: 220px; border: 1px solid var(--border-input); border-radius: 10px; background: var(--paper); overflow: hidden; }
.sync-editor, .sync-editor-mirror {
  position: absolute; inset: 0; margin: 0; padding: 10px; border: 0; width: 100%; height: 100%;
  font-family: var(--font-mono); font-size: 12px; line-height: 1.5; white-space: pre; overflow: auto; background: transparent;
}
.sync-editor { z-index: 1; color: transparent; caret-color: var(--ink); resize: none; }
.sync-editor::selection { background: var(--accent-tint); }
.sync-editor-mirror { z-index: 0; color: var(--ink); pointer-events: none; }
.sql-delete { background: var(--st-danger-bg); color: var(--st-danger-fg); border-radius: 3px; }
.sync-code { overflow: auto; white-space: pre; background: var(--paper); padding: 12px; border-radius: 10px; border: 1px solid var(--line); font-family: var(--font-mono); font-size: 11.5px; max-height: 480px; }
.sync-ta { position: relative; display: flex; flex-direction: column; gap: 4px; min-width: 220px; }
.sync-ta-anchor { position: relative; }
.sync-ta-input { flex: 1 1 auto; min-width: 0; width: 100%; }
.sync-ta-anchor.picked .sync-ta-input { border-color: var(--st-ok-fg); padding-inline-end: 28px; }
.sync-ta-armed { position: absolute; inset-inline-end: 10px; top: 50%; transform: translateY(-50%); width: 12px; height: 12px; color: var(--st-ok-fg); pointer-events: none; }
.sync-ta-pop {
  position: absolute; top: calc(100% + 4px); inset-inline-start: 0; z-index: 20; min-width: 100%; width: max-content;
  max-width: min(90vw, 480px); display: flex; flex-direction: column; overflow: hidden; background: var(--card);
  border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 8px 24px rgba(28,25,23,.12);
}
.sync-ta-list { max-height: 264px; overflow-y: auto; overscroll-behavior: contain; }
.sync-ta-row { display: flex; gap: 8px; align-items: baseline; padding: 6px 10px; cursor: pointer; font-size: 12.5px; }
.sync-ta-row.cur { background: var(--accent-soft); }
.sync-ta-row.sync-ta-off .sync-ta-name { opacity: .5; }
.sync-ta-name { flex: 0 0 auto; min-width: 13ch; color: var(--ink); }
.sync-ta-hint { flex: 1 1 auto; min-width: 0; color: var(--ink-3); font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sync-ta-why { color: var(--st-warn-fg); font-size: 11.5px; margin-inline-start: auto; }
.sync-ta-empty { padding: 6px 10px; font-size: 11.5px; color: var(--ink-3); }
.sync-ta-more { border-block-start: 1px solid var(--line); }
.sync-strip { display: grid; grid-template-columns: 1fr auto; gap: 18px; align-items: stretch; }
.sync-strip-main { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-card); padding: 18px 20px; display: flex; flex-direction: column; gap: 8px; }
.sync-strip h3 { font-size: 15px; font-weight: 600; }
.sync-strip p { margin: 0; font-size: 13px; line-height: 1.55; max-width: 72ch; }
.sync-strip-v { font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }
.sync-strip p.sync-strip-meta { max-width: none; font-size: 11.5px; padding-block-start: 8px; border-block-start: 1px solid var(--line-soft); margin-top: auto; }
.sync-budget { background: var(--accent-deep); color: #fff; border-radius: var(--r-card); padding: 18px 20px; min-width: 240px; display: flex; flex-direction: column; gap: 4px; }
.sync-budget-label { font-size: 11.5px; font-weight: 600; color: var(--accent-glow); }
.sync-budget-n { font-family: var(--font-display); font-size: 36px; line-height: 1.1; }
.sync-budget-unit { font-size: 16px; color: var(--accent-glow); font-family: var(--font-body); }
.sync-budget-cost { font-size: 12px; color: var(--accent-tint); margin-top: 8px; }
@media (max-width: 1100px) { .sync-strip { grid-template-columns: 1fr; } }
