/* Keel cockpit (Syntiva). Oxblood: warm ink dark first, stone light. Oxblood accent for actions and focus. Albert Sans throughout. */
:root {
  --bg: #161210; --bg-rail: #110e0c; --panel: #201a17; --panel-2: #271f1b; --sunk: #130f0d; --line: #33291f; --line-2: #463a2e;
    --text: #efe9e1; --text-2: #c4b8ab; --muted: #9a8d81; --accent: #d0707c; --accent-hover: #de8b96; --accent-ink: #1a0d0f; --accent-soft: rgba(208, 112, 124, 0.15);
    --ok: #9cc58f; --warn: #e2a65f; --err: #f08a6c; --info: #8fb2dc; --idle: #6f6359;
    --ok-soft: rgba(156, 197, 143, 0.13); --warn-soft: rgba(226, 166, 95, 0.14); --err-soft: rgba(240, 138, 108, 0.15); --info-soft: rgba(143, 178, 220, 0.13);
    --shadow: 0 1px 0 rgba(255, 255, 255, 0.03) inset, 0 10px 30px -18px rgba(0, 0, 0, 0.7); --shadow-pop: 0 24px 60px -20px rgba(0, 0, 0, 0.75), 0 0 0 1px var(--line-2); --grid-line: rgba(208, 112, 124, 0.025); --keel: #d0707c;
  --display: 'Albert Sans', ui-sans-serif, -apple-system, 'Segoe UI', system-ui, sans-serif;
  --serif: var(--display);
  --sans: 'Albert Sans', ui-sans-serif, -apple-system, 'Segoe UI', system-ui, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --r-sm: 6px;
  --r: 10px;
  --r-lg: 14px;
  --rail-w: 224px;
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme='dark']) {
    --bg: #f4f1ec; --bg-rail: #ebe6de; --panel: #fffdf9; --panel-2: #f9f6f1; --sunk: #efebe4; --line: #e0d9ce; --line-2: #cbc2b4;
    --text: #1c1714; --text-2: #4f453e; --muted: #6f645b; --accent: #7a1f2b; --accent-hover: #641823; --accent-ink: #fffdf9; --accent-soft: rgba(122, 31, 43, 0.09);
    --ok: #3f6b3a; --warn: #a8641b; --err: #b8401f; --info: #3b5f8a; --idle: #8d8279;
    --ok-soft: rgba(63, 107, 58, 0.1); --warn-soft: rgba(168, 100, 27, 0.1); --err-soft: rgba(184, 64, 31, 0.09); --info-soft: rgba(59, 95, 138, 0.09);
    --shadow: 0 1px 2px rgba(28, 23, 20, 0.05), 0 8px 24px -16px rgba(28, 23, 20, 0.18); --shadow-pop: 0 24px 60px -18px rgba(28, 23, 20, 0.32), 0 0 0 1px var(--line); --grid-line: rgba(28, 23, 20, 0.022); --keel: #7a1f2b; color-scheme: light;
  }
}
:root[data-theme='light'] {
  --bg: #f4f1ec; --bg-rail: #ebe6de; --panel: #fffdf9; --panel-2: #f9f6f1; --sunk: #efebe4; --line: #e0d9ce; --line-2: #cbc2b4;
    --text: #1c1714; --text-2: #4f453e; --muted: #6f645b; --accent: #7a1f2b; --accent-hover: #641823; --accent-ink: #fffdf9; --accent-soft: rgba(122, 31, 43, 0.09);
    --ok: #3f6b3a; --warn: #a8641b; --err: #b8401f; --info: #3b5f8a; --idle: #8d8279;
    --ok-soft: rgba(63, 107, 58, 0.1); --warn-soft: rgba(168, 100, 27, 0.1); --err-soft: rgba(184, 64, 31, 0.09); --info-soft: rgba(59, 95, 138, 0.09);
    --shadow: 0 1px 2px rgba(28, 23, 20, 0.05), 0 8px 24px -16px rgba(28, 23, 20, 0.18); --shadow-pop: 0 24px 60px -18px rgba(28, 23, 20, 0.32), 0 0 0 1px var(--line); --grid-line: rgba(28, 23, 20, 0.022); --keel: #7a1f2b; color-scheme: light;
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font: 400 14px/1.5 var(--sans);
  color: var(--text);
  background-color: var(--bg);
  background-image: linear-gradient(var(--grid-line) 1px, transparent 1px), linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 32px 32px;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -0.01em; }
p { margin: 0; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
code, pre, .mono-sm { font-family: var(--mono); }
code { font-size: 0.88em; padding: 0.1em 0.35em; border-radius: 4px; background: var(--sunk); border: 1px solid var(--line); }
[hidden] { display: none !important; }
.ic { width: 18px; height: 18px; flex: none; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.muted { color: var(--muted); }
.strong { font-weight: 600; }
.mono-sm { font-size: 12px; }
.break { word-break: break-all; }
.nowrap { white-space: nowrap; }
.spacer { flex: 1; }
.err-text { color: var(--err); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.skip { position: absolute; left: -999px; top: 8px; z-index: 100; background: var(--accent); color: var(--accent-ink); padding: 8px 12px; border-radius: var(--r-sm); }
.skip:focus { left: 8px; }
::selection { background: var(--accent-soft); }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: var(--rail-w) minmax(0, 1fr); min-height: 100vh; }
.rail {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 6px;
  background: var(--bg-rail); border-right: 1px solid var(--line); padding: 18px 12px 14px;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; color: var(--text); text-decoration: none !important; }
.brand-mark { width: 30px; height: 30px; border-radius: 9px; background: var(--panel-2); border: 1px solid var(--line-2); position: relative; flex: none; }
.brand-mark::before { content: ''; position: absolute; inset: 7px; border-radius: 50%; border: 2px solid var(--accent); }
.brand-mark::after { content: ''; position: absolute; inset: 12px; border-radius: 50%; background: var(--accent); }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-name { font-family: var(--display); font-weight: 700; letter-spacing: -0.03em; font-size: 22px; }
.brand-sub { font-size: 12px; color: var(--muted); }
.nav { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.nav-link, .nav-btn {
  display: flex; align-items: center; gap: 11px; padding: 8px 10px; border-radius: var(--r-sm); color: var(--text-2);
  font: 500 14px var(--sans); text-decoration: none !important; border: 0; background: none; width: 100%; cursor: pointer; text-align: left;
}
.nav-link:hover, .nav-btn:hover { background: var(--panel); color: var(--text); }
.nav-link.active { background: var(--panel-2); color: var(--text); box-shadow: inset 2px 0 0 var(--accent); }
.nav-link.active .ic { color: var(--accent); }
.nav-count { margin-left: auto; min-width: 20px; padding: 0 6px; border-radius: 10px; background: var(--accent); color: var(--accent-ink); font-size: 12px; font-weight: 700; text-align: center; line-height: 20px; }
.rail-foot { margin-top: auto; display: flex; flex-direction: column; gap: 2px; padding-top: 10px; border-top: 1px solid var(--line); }
.version { font-size: 12px; color: var(--muted); padding: 6px 10px 0; }
.mock-flag { margin: 0 6px 6px; font-size: 12px; font-weight: 600; color: var(--warn); background: var(--warn-soft); border: 1px dashed var(--warn); border-radius: var(--r-sm); padding: 4px 8px; text-align: center; }
#view { min-width: 0; outline: none; }
.page { padding: 28px 36px 64px; max-width: 1480px; margin: 0 auto; }

/* ---------- page header ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 22px; flex-wrap: wrap; }
.page-title { font-family: var(--display); font-weight: 700; letter-spacing: -0.03em; font-size: 37px; line-height: 1; }
.page-sub { color: var(--text-2); margin-top: 8px; max-width: 70ch; }
.head-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.crumb { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); font-size: 13px; margin-bottom: 10px; }
.crumb .ic { width: 15px; height: 15px; }
.crumb:hover { color: var(--text); text-decoration: none; }
.lede { color: var(--text-2); margin-bottom: 14px; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 36px; padding: 0 14px;
  border-radius: var(--r-sm); border: 1px solid var(--line-2); background: var(--panel-2); color: var(--text);
  font: 500 14px var(--sans); cursor: pointer; text-decoration: none !important; white-space: nowrap; transition: background 0.12s, border-color 0.12s;
}
.btn:hover { border-color: var(--muted); background: var(--panel); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn .ic { width: 16px; height: 16px; }
.btn-sm { height: 30px; padding: 0 10px; font-size: 13px; }
.btn-block { width: 100%; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--panel-2); border-color: var(--line); color: var(--text); }
.btn-danger { background: var(--err); border-color: var(--err); color: #fff; font-weight: 600; }
.btn-danger:hover { filter: brightness(1.08); background: var(--err); }
.btn-danger-ghost { background: transparent; border-color: var(--line-2); color: var(--err); }
.btn-danger-ghost:hover { background: var(--err-soft); border-color: var(--err); }
.icon-btn {
  display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: var(--r-sm); border: 1px solid transparent;
  background: transparent; color: var(--text-2); cursor: pointer; text-decoration: none !important; flex: none;
}
.icon-btn:hover { background: var(--panel-2); border-color: var(--line); color: var(--text); }
.icon-btn.danger:hover { color: var(--err); border-color: var(--err); background: var(--err-soft); }
.icon-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.icon-btn .ic { width: 17px; height: 17px; }
.spin .ic { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.spinner { width: 14px; height: 14px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin 0.8s linear infinite; display: inline-block; flex: none; }

/* ---------- forms ---------- */
input, select, textarea {
  font: 400 14px/1.4 var(--sans); color: var(--text); background: var(--sunk); border: 1px solid var(--line-2);
  border-radius: var(--r-sm); padding: 8px 10px; width: 100%; min-width: 0; transition: border-color 0.12s, box-shadow 0.12s;
}
textarea { resize: vertical; line-height: 1.55; }
input:hover, select:hover, textarea:hover { border-color: var(--muted); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
input:disabled, textarea:disabled { opacity: 0.6; }
input.invalid { border-color: var(--err); }
select { appearance: none; padding-right: 30px; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 15px) 52%, calc(100% - 10px) 52%; background-size: 5px 5px; background-repeat: no-repeat; }
input[type='checkbox'], input[type='radio'] { width: auto; accent-color: var(--accent); }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .label { font-size: 13px; font-weight: 600; color: var(--text-2); }
.hint { color: var(--muted); font-size: 12.5px; line-height: 1.45; }
.hint-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 18px; }
.form-grid.one { grid-template-columns: 1fr; }
.span-2 { grid-column: 1 / -1; }
.form-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; }
.form-err { margin-top: 14px; color: var(--err); background: var(--err-soft); border: 1px solid var(--err); padding: 8px 12px; border-radius: var(--r-sm); }
.check { display: flex; align-items: center; gap: 9px; font-size: 14px; color: var(--text-2); cursor: pointer; }
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 8px; }
.check-card { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line-2); border-radius: var(--r-sm); background: var(--sunk); cursor: pointer; font-weight: 500; }
.check-card:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.check-card .ic { color: var(--muted); }
.check-card:has(input:checked) .ic { color: var(--accent); }
.switch { appearance: none; width: 34px !important; height: 20px; padding: 0; border-radius: 10px; background: var(--line-2); border: 0; position: relative; cursor: pointer; flex: none; transition: background 0.15s; }
.switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 14px; height: 14px; border-radius: 50%; background: var(--text); transition: transform 0.15s; }
.switch:checked { background: var(--accent); }
.switch:checked::after { transform: translateX(14px); background: var(--accent-ink); }
.switch:focus { box-shadow: 0 0 0 3px var(--accent-soft); }
.switch-label { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; font-weight: 500; }
.sel-inline { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.sel-inline select { width: auto; padding-top: 5px; padding-bottom: 5px; font-size: 13px; }
.time-range { display: flex; align-items: center; gap: 8px; }
.time-range input { width: auto; flex: 1; }
.fs { border: 0; padding: 0; margin: 0 0 22px; }
.fs legend { font-weight: 600; font-size: 15px; margin-bottom: 12px; padding: 0; }
.fs > .hint { margin: -6px 0 12px; }
.fs-adv { margin-bottom: 18px; border-top: 1px solid var(--line); padding-top: 14px; }
.fs-adv summary { cursor: pointer; font-weight: 600; color: var(--text-2); margin-bottom: 14px; }
.kv { display: flex; flex-direction: column; gap: 6px; margin: 8px 0; }
.kv-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr) 32px; gap: 6px; }
.kv-row input:first-child { font-family: var(--mono); font-size: 12.5px; }

.model-combo { display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); gap: 6px; }
.model-combo input { font-family: var(--mono); font-size: 12.5px; }

/* segmented controls */
.seg { display: inline-flex; padding: 3px; gap: 2px; background: var(--sunk); border: 1px solid var(--line); border-radius: 8px; }
.seg-btn { display: inline-flex; align-items: center; gap: 6px; border: 0; background: none; color: var(--text-2); font: 500 13px var(--sans); padding: 5px 10px; border-radius: 6px; cursor: pointer; }
.seg-btn .ic { width: 15px; height: 15px; }
.seg-btn[aria-pressed='true'] { background: var(--panel-2); color: var(--text); box-shadow: 0 0 0 1px var(--line-2); }
.seg-wide { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); width: 100%; }
.seg-opt { position: relative; cursor: pointer; }
.seg-opt input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.seg-opt > span { display: flex; flex-direction: column; gap: 2px; padding: 9px 12px; border-radius: 6px; color: var(--text-2); }
.seg-opt > span .ic { margin-bottom: 4px; color: var(--muted); }
.seg-opt small { color: var(--muted); font-size: 12px; }
.seg-opt input:checked + span { background: var(--panel-2); color: var(--text); box-shadow: 0 0 0 1px var(--accent); }
.seg-opt input:checked + span .ic { color: var(--accent); }
.seg-opt input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 1px; }
.seg-opt-sm > span { padding: 5px 12px; font-size: 13px; font-weight: 500; }

/* search */
.search { position: relative; display: inline-flex; align-items: center; flex: 1; max-width: 420px; min-width: 180px; }
.search .ic { position: absolute; left: 10px; width: 16px; height: 16px; color: var(--muted); pointer-events: none; }
.search input { padding-left: 34px; }
.search-sm { max-width: 220px; min-width: 140px; }
.search-sm input { padding-top: 5px; padding-bottom: 5px; font-size: 13px; }
.search-block { display: flex; max-width: none; margin-bottom: 10px; }
.toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.count { font-size: 13px; }

/* ---------- panels ---------- */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 20px 22px; box-shadow: var(--shadow); margin-bottom: 18px; min-width: 0; }
.panel-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
.panel-title { font-size: 17px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.panel-sub { color: var(--muted); font-size: 13px; margin-top: 4px; max-width: 75ch; }
.panel-foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }
.two-col { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(300px, 1fr); gap: 18px; align-items: start; }
.two-col > .panel { margin-bottom: 0; }
.notice { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: var(--r-sm); background: var(--warn-soft); color: var(--text); border: 1px solid color-mix(in srgb, var(--warn) 50%, transparent); }
.notice .ic { color: var(--warn); }
.explainer { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; margin-bottom: 18px; border-radius: var(--r); background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent); color: var(--text-2); max-width: 110ch; }
.explainer b { color: var(--text); }
.explainer .ic { color: var(--accent); margin-top: 2px; }
.explainer-ok { background: var(--ok-soft); border-color: color-mix(in srgb, var(--ok) 40%, transparent); }
.explainer-ok .ic { color: var(--ok); }

/* ---------- status ---------- */
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--idle); flex: none; }
.dot-ok { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }
.dot-warn { background: var(--warn); box-shadow: 0 0 0 3px var(--warn-soft); }
.dot-err { background: var(--err); box-shadow: 0 0 0 3px var(--err-soft); }
.dot-idle { background: var(--idle); }
.dot-pulse { animation: pulse 2.2s ease-in-out infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 6px transparent; } }
.status-pill { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border-radius: 99px; font-size: 12px; font-weight: 600; white-space: nowrap; border: 1px solid transparent; }
.status-pill .ic { width: 13px; height: 13px; }
.tone-ok.status-pill { color: var(--ok); background: var(--ok-soft); }
.tone-warn.status-pill { color: var(--warn); background: var(--warn-soft); }
.tone-err.status-pill { color: var(--err); background: var(--err-soft); }
.tone-idle.status-pill { color: var(--muted); background: var(--sunk); border-color: var(--line); }
.kind, .ctx-tag, .sys-tag, .chan-tag, .file-tag, .cap {
  display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 500; padding: 1px 8px; border-radius: 99px;
  background: var(--sunk); border: 1px solid var(--line); color: var(--text-2); white-space: nowrap;
}
.ctx-tag { border-style: dashed; }
.sys-tag { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 40%, transparent); background: var(--accent-soft); }
.file-tag { font-family: var(--mono); font-size: 11.5px; font-weight: 400; }
.chan-tag .ic { width: 12px; height: 12px; }

/* channel indicators */
.chan-row { display: inline-flex; gap: 3px; }
.chan { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 6px; border: 1px solid var(--line); color: var(--idle); background: transparent; }
.chan .ic { width: 14px; height: 14px; }
.chan-off { opacity: 0.45; border-style: dashed; }
.chan-on { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 45%, transparent); background: var(--ok-soft); }
.chan-err { color: var(--err); border-color: color-mix(in srgb, var(--err) 55%, transparent); background: var(--err-soft); }
.chan-primary { box-shadow: 0 0 0 1px var(--accent); }
.voice-tag { display: inline-grid; place-items: center; margin-left: 6px; color: var(--accent); vertical-align: middle; }
.voice-tag .ic { width: 15px; height: 15px; }

/* ---------- tables ---------- */
.tbl-wrap { overflow-x: auto; margin: 0 -4px; padding: 0 4px; }
.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th { text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: middle; white-space: nowrap; }
.tbl td.wrap { white-space: normal; min-width: 200px; }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover td { background: color-mix(in srgb, var(--panel-2) 60%, transparent); }
.tbl .num { text-align: right; }
.cell-sub { display: block; color: var(--muted); font-size: 12px; margin-top: 1px; }
.actions-cell { text-align: right; width: 1%; }
.row-actions { display: inline-flex; gap: 4px; align-items: center; }
.row-dim td { opacity: 0.6; }

/* ---------- fleet ---------- */
.poll { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); margin-right: 6px; }
.poll-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); animation: pulse 2.4s infinite; box-shadow: 0 0 0 3px var(--ok-soft); }
.poll-err .poll-dot { background: var(--err); box-shadow: 0 0 0 3px var(--err-soft); }
.totals {
  display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); margin-bottom: 22px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow); overflow: hidden;
}
.tot { padding: 16px 20px 15px; border-right: 1px solid var(--line); display: flex; flex-direction: column; gap: 2px; color: var(--text); text-decoration: none !important; position: relative; min-width: 0; }
.tot:last-child { border-right: 0; }
.tot-v { font-family: var(--display); font-weight: 700; letter-spacing: -0.03em; font-size: 29px; line-height: 1.05; }
.tot-v small { font-family: var(--sans); font-size: 14px; color: var(--muted); }
.tot-l { font-size: 12.5px; color: var(--muted); font-weight: 500; }
.tot-link:hover { background: var(--panel-2); }
.tot-flag { position: absolute; top: 12px; right: 14px; font-size: 11.5px; font-weight: 600; color: var(--accent); }
.tot-meter { display: block; height: 3px; border-radius: 2px; background: var(--line); margin-top: 8px; overflow: hidden; }
.tot-meter span { display: block; height: 100%; background: var(--ok); border-radius: 2px; }
.totals-sm .tot-v { font-size: 28px; }
.totals .loading { grid-column: 1 / -1; }

.tbl-fleet td { padding-top: 12px; padding-bottom: 12px; }
.tbl-fleet td:nth-child(2), .tbl-fleet td:nth-child(3), .tbl-fleet td:nth-child(4) { white-space: normal; min-width: 120px; }
@media (max-width: 1560px) { .tbl-fleet .hide-sm { display: none; } }
.callsign { display: inline-flex; align-items: center; gap: 12px; color: var(--text); text-decoration: none !important; }
.callsign-text { display: flex; flex-direction: column; line-height: 1.2; }
.callsign-name { font-family: var(--display); font-weight: 700; letter-spacing: -0.03em; font-size: 23px; line-height: 1; }
.callsign:hover .callsign-name { color: var(--accent); }
.model-name { font-weight: 500; }
.host-chip { display: inline-flex; align-items: center; gap: 6px; font-weight: 500; }
.host-chip .ic { width: 15px; height: 15px; color: var(--muted); }
.panel-wrap-fleet { padding: 6px 12px; }
#roster > .tbl-wrap { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow); padding: 4px 12px; margin: 0; }

.agent-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(310px, 1fr)); gap: 14px; }
.agent-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 18px; display: flex; flex-direction: column; gap: 14px; box-shadow: var(--shadow); position: relative; overflow: hidden; }
.agent-card::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--idle); }
.agent-card.tone-ok::before { background: var(--ok); }
.agent-card.tone-warn::before { background: var(--warn); }
.agent-card.tone-err::before { background: var(--err); }
.agent-card header { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.card-facts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; margin: 0; }
.card-facts dt, .agent-facts dt, .facts-inline dt, .kv-dl dt, .review dt, .task-times dt { font-size: 12px; color: var(--muted); font-weight: 500; }
.card-facts dd, .agent-facts dd, .facts-inline dd, .kv-dl dd, .review dd, .task-times dd { margin: 2px 0 0; min-width: 0; }
.card-metrics { display: flex; gap: 16px; font-size: 13px; color: var(--muted); padding-top: 12px; border-top: 1px solid var(--line); }
.card-metrics b { color: var(--text); font-size: 15px; font-weight: 600; margin-right: 3px; }
.agent-card footer { display: flex; justify-content: flex-end; }

/* ---------- empty / loading ---------- */
.empty { text-align: center; padding: 38px 20px; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.empty h3 { font-family: var(--display); font-weight: 700; letter-spacing: -0.03em; font-size: 20px; }
.empty p { color: var(--muted); max-width: 52ch; }
.empty .btn { margin-top: 8px; }
.empty-mark { width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; border: 1px dashed var(--line-2); color: var(--muted); margin-bottom: 4px; }
.empty-err .empty-mark { color: var(--err); border-color: var(--err); }
.loading { display: flex; align-items: center; gap: 10px; color: var(--muted); padding: 22px 4px; }

/* ---------- agent header ---------- */
.agent-head { margin-bottom: 18px; }
.agent-id { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.agent-id .head-actions { margin-left: auto; }
.halo { width: 54px; height: 54px; border-radius: 50%; display: grid; place-items: center; position: relative; flex: none; border: 1px solid var(--line-2); background: var(--panel); }
.halo::before { content: ''; position: absolute; inset: 5px; border-radius: 50%; border: 2px solid var(--idle); }
.halo span { width: 12px; height: 12px; border-radius: 50%; background: var(--idle); }
.halo-ok::before { border-color: var(--ok); animation: halo 3s ease-in-out infinite; }
.halo-ok span { background: var(--ok); }
.halo-warn::before { border-color: var(--warn); border-style: dashed; animation: spin 6s linear infinite; }
.halo-warn span { background: var(--warn); }
.halo-err::before { border-color: var(--err); }
.halo-err span { background: var(--err); }
@keyframes halo { 50% { inset: 2px; opacity: 0.55; } }
.agent-name { font-family: var(--display); font-weight: 700; letter-spacing: -0.03em; font-size: 45px; line-height: 0.95; }
.agent-for { color: var(--text-2); margin-top: 6px; }
.agent-for b { color: var(--text); font-weight: 600; }
.agent-facts { display: flex; gap: 0; margin: 18px 0 0; padding: 12px 0 0; border-top: 1px solid var(--line); flex-wrap: wrap; }
.agent-facts > div { padding: 0 22px; border-left: 1px solid var(--line); min-width: 0; }
.agent-facts > div:first-child { padding-left: 0; border-left: 0; }
.agent-facts dd { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 240px; }
.offline-banner { display: flex; align-items: center; gap: 14px; padding: 12px 16px; margin-bottom: 16px; border-radius: var(--r); background: var(--err-soft); border: 1px solid color-mix(in srgb, var(--err) 50%, transparent); }
.offline-banner > .ic { color: var(--err); width: 22px; height: 22px; }
.offline-banner div { flex: 1; display: flex; flex-direction: column; }
.offline-banner span { color: var(--text-2); font-size: 13px; }

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 20px; overflow-x: auto; scrollbar-width: thin; position: sticky; top: 0; z-index: 5; background: var(--bg); padding-top: 6px; }
.tabs [role='tab'] { display: inline-flex; align-items: center; gap: 6px; padding: 9px 10px 11px; color: var(--text-2); font-weight: 500; white-space: nowrap; border-bottom: 2px solid transparent; margin-bottom: -1px; text-decoration: none !important; border-radius: 6px 6px 0 0; }
.tabs [role='tab'] .ic { width: 16px; height: 16px; color: var(--muted); }
.tabs [role='tab']:hover { color: var(--text); background: var(--panel); }
.tabs [role='tab'][aria-selected='true'] { color: var(--text); border-bottom-color: var(--accent); }
.tabs [role='tab'][aria-selected='true'] .ic { color: var(--accent); }
.tab-badge { min-width: 18px; padding: 0 5px; border-radius: 9px; background: var(--accent); color: var(--accent-ink); font-size: 11px; font-weight: 700; line-height: 18px; text-align: center; }
.tabpanel:focus-visible { outline: none; }

/* ---------- overview ---------- */
.ov-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.ov-grid > .panel { margin: 0; }
.count-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.count-tile { background: var(--panel); padding: 14px 16px; display: flex; flex-direction: column; gap: 2px; color: var(--text); text-decoration: none !important; }
.count-tile:hover { background: var(--panel-2); }
.count-v { font-family: var(--display); font-weight: 700; letter-spacing: -0.03em; font-size: 25px; line-height: 1.05; }
.count-l { font-size: 12.5px; color: var(--muted); }
.count-tile.warn .count-v { color: var(--accent); }
.chan-list, .inbox, .prov-rows, .env-list, .acc-list, .mem-list, .sk-list, .task-list, .file-grid { list-style: none; margin: 0; padding: 0; }
.chan-list li { display: flex; align-items: center; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.chan-list li:last-child { border-bottom: 0; }
.chan-list .chan { width: 30px; height: 30px; }
.chan-list .chan .ic { width: 16px; height: 16px; }
.chan-list b { margin-right: 6px; }
.chan-list li.off b { color: var(--muted); font-weight: 500; }
.inbox li { padding: 10px 0; border-bottom: 1px solid var(--line); display: grid; grid-template-columns: 70px 1fr; gap: 12px; }
.inbox li:last-child { border-bottom: 0; }
.inbox time { font-size: 12px; color: var(--muted); padding-top: 2px; }
.kv-dl { display: flex; flex-direction: column; gap: 12px; margin: 0; }
.kv-dl dd { font-size: 13.5px; }
.pair-inline { font-size: 15px; letter-spacing: 0.06em; color: var(--accent); }
.env-keys { display: flex; flex-wrap: wrap; gap: 4px; }

/* ---------- chat ---------- */
.chat { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 18px; height: calc(100vh - 318px); min-height: 500px; }
.chat-main { display: flex; flex-direction: column; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow); min-height: 0; overflow: hidden; }
.chat-bar { display: flex; justify-content: space-between; align-items: center; padding: 8px 12px 8px 18px; border-bottom: 1px solid var(--line); font-size: 13px; }
.msgs { flex: 1; overflow-y: auto; padding: 20px 22px; display: flex; flex-direction: column; gap: 14px; scroll-behavior: smooth; }
.msg { max-width: min(680px, 86%); display: flex; flex-direction: column; gap: 4px; }
.msg-user { align-self: flex-end; align-items: flex-end; }
.msg-agent, .msg-system { align-self: flex-start; }
.msg-meta { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); padding: 0 4px; }
.msg-meta .who { font-weight: 600; color: var(--text-2); }
.msg-agent .who { font-family: var(--display); font-weight: 700; letter-spacing: -0.03em; font-size: 16px; color: var(--text); }
.msg-body { padding: 10px 14px; border-radius: 14px; line-height: 1.55; overflow-wrap: anywhere; }
.msg-user .msg-body { background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent); border-bottom-right-radius: 4px; }
.msg-agent .msg-body { background: var(--panel-2); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.msg-system .msg-body { background: transparent; border: 1px dashed var(--line-2); color: var(--text-2); font-size: 13px; }
.msg-error .msg-body { border-color: var(--err); color: var(--text); display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.msg-cost { font-size: 11.5px; color: var(--muted); padding: 0 6px; font-family: var(--mono); }
.msg .play { margin-top: 8px; }
.msg-pending .msg-body { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; min-width: 260px; }
.thinking { display: inline-flex; gap: 4px; }
.thinking span { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); animation: think 1.2s ease-in-out infinite; }
.thinking span:nth-child(2) { animation-delay: 0.15s; }
.thinking span:nth-child(3) { animation-delay: 0.3s; }
@keyframes think { 0%, 80%, 100% { opacity: 0.25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }
.think-label { color: var(--text-2); font-size: 13px; }
.elapsed { color: var(--muted); margin-left: 4px; }
.think-tool { display: inline-flex; align-items: center; gap: 5px; font-family: var(--mono); font-size: 12px; color: var(--accent); flex-basis: 100%; }
.think-tool:empty { display: none; }
.think-tool .ic { width: 13px; height: 13px; }
.day-sep { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 12px; margin: 6px 0; }
.day-sep::before, .day-sep::after { content: ''; height: 1px; background: var(--line); flex: 1; }
.chat-empty { margin: auto; }
.md .msg-files, .msg-files { list-style: none; padding: 0; margin: 8px 0 0; display: flex; flex-wrap: wrap; gap: 6px; }
.file-chip { display: inline-flex; align-items: center; gap: 7px; padding: 5px 10px; border-radius: 8px; border: 1px solid var(--line-2); background: var(--sunk); color: var(--text); font: 500 13px var(--sans); cursor: pointer; max-width: 100%; }
.file-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-chip small { color: var(--muted); }
.file-chip .ic { width: 15px; height: 15px; color: var(--muted); }
button.file-chip:hover { border-color: var(--accent); }
button.file-chip:hover .ic:last-child { color: var(--accent); }
.file-chip.local { cursor: default; }
.chip-x { border: 0; background: none; color: var(--muted); cursor: pointer; display: grid; place-items: center; padding: 0; }
.composer { border-top: 1px solid var(--line); padding: 12px; background: var(--panel); }
.attach-row { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.composer-row { display: flex; align-items: flex-end; gap: 8px; }
.composer textarea { min-height: 42px; max-height: 220px; resize: none; padding: 10px 12px; }
.composer .icon-btn { width: 42px; height: 42px; border-color: var(--line-2); }
.mic { width: 42px; height: 42px; flex: none; border-radius: 50%; border: 1px solid var(--line-2); background: var(--panel-2); color: var(--text-2); cursor: pointer; display: grid; place-items: center; touch-action: none; user-select: none; transition: background 0.12s, color 0.12s, transform 0.12s; }
.mic:hover { color: var(--accent); border-color: var(--accent); }
.mic.rec { background: var(--err); border-color: var(--err); color: #fff; transform: scale(1.08); box-shadow: 0 0 0 6px var(--err-soft); }
.send { height: 42px; width: 46px; padding: 0; }
.rec-bar { display: flex; align-items: center; gap: 10px; margin-top: 8px; font-size: 13px; }
.rec-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--err); animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0.2; } }
.activity { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg); display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.activity header { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.activity h3 { font-size: 14px; }
.live-state { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; color: var(--muted); }
.act-list { list-style: none; margin: 0; padding: 6px 0; overflow-y: auto; flex: 1; }
.act { display: grid; grid-template-columns: 26px 1fr; gap: 8px; padding: 8px 14px; animation: actIn 0.3s ease-out; }
@keyframes actIn { from { background: var(--accent-soft); } }
.act-ic { width: 24px; height: 24px; border-radius: 6px; display: grid; place-items: center; background: var(--sunk); color: var(--muted); border: 1px solid var(--line); }
.act-ic .ic { width: 13px; height: 13px; }
.act-agent-tools .act-ic { color: var(--accent); }
.act-feed-urgent .act-ic, .act-approval-requested .act-ic { color: var(--warn); }
.act-skill-saved .act-ic { color: var(--ok); }
.act-head { display: flex; justify-content: space-between; gap: 6px; font-size: 12.5px; }
.act-head time { color: var(--muted); font-size: 11.5px; }
.act p { font-size: 12.5px; color: var(--text-2); overflow-wrap: anywhere; font-family: var(--mono); font-size: 11.5px; line-height: 1.45; }
.act-empty { color: var(--muted); font-size: 13px; padding: 14px 16px; }

/* markdown */
.md p { margin: 0; }
.md p + p { margin-top: 0.45em; }
.md ul, .md ol { margin: 0.35em 0; padding-left: 1.3em; }
.md li + li { margin-top: 0.15em; }
.md h2, .md h3, .md h4, .md h5 { font-size: 1em; margin: 0.8em 0 0.3em; }
.md h2 { font-family: var(--display); font-weight: 700; letter-spacing: -0.03em; font-size: 1.3em; }
.md h3 { font-size: 1.05em; }
.md-gap { height: 0.5em; }
.md pre.code, pre.code { background: var(--sunk); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 10px 12px; overflow-x: auto; font-size: 12.5px; margin: 6px 0; white-space: pre-wrap; }
.md pre.code code { background: none; border: 0; padding: 0; }

/* ---------- memory ---------- */
.docs-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; margin-bottom: 18px; }
.docs-grid .panel { margin: 0; display: flex; flex-direction: column; }
.doc-edit { min-height: 260px; flex: 1; font-family: var(--mono); font-size: 12.5px; line-height: 1.65; background: var(--sunk); }
.save-state { font-size: 12px; color: var(--warn); font-weight: 600; }
.mem-list { display: flex; flex-direction: column; }
.mem { display: grid; grid-template-columns: 32px 1fr auto; gap: 10px; padding: 12px 4px; border-bottom: 1px solid var(--line); align-items: start; }
.mem:last-child { border-bottom: 0; }
.mem.pinned { background: linear-gradient(90deg, var(--accent-soft), transparent 40%); border-radius: var(--r-sm); }
.pin-btn { width: 30px; height: 30px; border-radius: 6px; border: 1px solid transparent; background: none; color: var(--idle); cursor: pointer; display: grid; place-items: center; }
.pin-btn:hover { border-color: var(--line-2); color: var(--text); }
.pin-btn[aria-pressed='true'] { color: var(--accent); }
.pin-btn[aria-pressed='true'] .ic { fill: var(--accent-soft); }
.mem-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; margin-bottom: 3px; }
.mem-meta time { color: var(--muted); font-size: 12px; margin-left: auto; }
.mem-content { color: var(--text); max-width: 95ch; }
.mem-actions { display: flex; gap: 2px; opacity: 0.6; }
.mem:hover .mem-actions, .mem:focus-within .mem-actions { opacity: 1; }
.kind-preference { color: var(--info); }
.kind-person { color: var(--ok); }
.kind-instruction { color: var(--accent); }
.kind-decision { color: var(--warn); }

/* ---------- skills ---------- */
.split { display: grid; grid-template-columns: minmax(280px, 380px) minmax(0, 1fr); gap: 18px; align-items: start; }
.split > .panel { margin: 0; }
.split-list { position: sticky; top: 64px; max-height: calc(100vh - 90px); overflow-y: auto; }
.sk-list { display: flex; flex-direction: column; gap: 2px; }
.sk-item { width: 100%; text-align: left; border: 1px solid transparent; background: none; color: var(--text); padding: 10px 12px; border-radius: var(--r-sm); cursor: pointer; display: flex; flex-direction: column; gap: 3px; font: inherit; }
.sk-item:hover { background: var(--panel-2); }
.sk-item.sel { background: var(--panel-2); border-color: var(--accent); }
.sk-name { font-weight: 600; }
.sk-desc { font-size: 13px; color: var(--text-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.sk-meta { display: flex; gap: 12px; font-size: 12px; color: var(--muted); }
.facts-inline { display: flex; flex-wrap: wrap; gap: 8px 26px; margin: 0 0 16px; padding: 12px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.skill-body { max-width: 80ch; line-height: 1.65; }
.code-edit { font-family: var(--mono); font-size: 12.5px; line-height: 1.6; }

/* ---------- knowledge ---------- */
.dropzone { display: flex; align-items: center; gap: 14px; padding: 16px; border: 1.5px dashed var(--line-2); border-radius: var(--r); margin-bottom: 16px; background: var(--sunk); flex-wrap: wrap; transition: border-color 0.12s, background 0.12s; }
.dropzone.drag { border-color: var(--accent); background: var(--accent-soft); }
.dz-label { display: flex; align-items: center; gap: 12px; flex: 1; cursor: pointer; min-width: 240px; flex-wrap: wrap; }
.dz-label .ic { width: 26px; height: 26px; color: var(--accent); }
.dz-label small { color: var(--muted); flex-basis: 100%; padding-left: 38px; margin-top: -10px; overflow: hidden; text-overflow: ellipsis; }
.dropzone:focus-within { border-color: var(--accent); }
.doc-title { display: inline-flex; align-items: center; gap: 7px; font-weight: 500; }
.doc-title .ic { width: 15px; height: 15px; color: var(--muted); }
.file-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 8px; }
.file-card { width: 100%; display: grid; grid-template-columns: 22px 1fr 18px; grid-template-rows: auto auto; column-gap: 10px; align-items: center; text-align: left; padding: 10px 12px; border-radius: var(--r-sm); border: 1px solid var(--line); background: var(--sunk); color: var(--text); cursor: pointer; font: inherit; }
.file-card:hover { border-color: var(--accent); }
.file-card > .ic:first-child { grid-row: span 2; color: var(--muted); }
.fc-name { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fc-meta { font-size: 12px; color: var(--muted); grid-column: 2; }
.fc-dl { grid-row: 1 / span 2; grid-column: 3; color: var(--muted); }
.file-card:hover .fc-dl { color: var(--accent); }

/* ---------- tasks ---------- */
.task-list { display: flex; flex-direction: column; }
.task { display: grid; grid-template-columns: minmax(0, 1fr) 130px 200px; gap: 18px; padding: 16px 4px; border-bottom: 1px solid var(--line); align-items: start; }
.task:last-child { border-bottom: 0; }
.task.disabled .task-main { opacity: 0.55; }
.task-title { display: flex; align-items: center; gap: 8px; font-size: 15px; }
.task-prompt { color: var(--text-2); margin: 4px 0 10px; max-width: 90ch; }
.task-sched { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.cron-edit { display: inline-flex; align-items: center; gap: 6px; }
.cron-edit .ic { width: 15px; height: 15px; color: var(--muted); }
.cron-edit input { width: 150px; font-family: var(--mono); font-size: 12.5px; padding: 5px 8px; }
.cron-desc { font-size: 13px; color: var(--muted); }
.sched-once { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-2); }
.sched-once .ic { width: 15px; height: 15px; }
.task-times { margin: 0; display: flex; flex-direction: column; gap: 8px; font-size: 13px; }
.task-actions { display: flex; align-items: center; gap: 10px; justify-content: flex-start; }
.last-result { margin-top: 10px; font-size: 13px; }
.last-result summary { cursor: pointer; color: var(--muted); }
.last-result .md { margin-top: 6px; padding: 10px 12px; background: var(--sunk); border-radius: var(--r-sm); border-left: 2px solid var(--accent); color: var(--text-2); max-width: 90ch; }

/* ---------- approvals ---------- */
.appr-list { display: flex; flex-direction: column; gap: 10px; }
.appr { display: grid; grid-template-columns: 38px minmax(0, 1fr) auto; gap: 14px; padding: 16px; border: 1px solid var(--line); border-radius: var(--r); background: var(--panel-2); transition: opacity 0.2s, transform 0.2s; }
.appr.leaving { opacity: 0; transform: translateX(16px); }
.appr-pending { border-left: 3px solid var(--accent); }
.appr-ic { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.appr:not(.appr-pending) .appr-ic { background: var(--sunk); color: var(--muted); }
.appr header { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.appr header time { color: var(--muted); font-size: 12px; }
.appr-summary { margin: 4px 0 8px; font-size: 15px; max-width: 90ch; }
.appr-details summary { cursor: pointer; color: var(--muted); font-size: 13px; }
.appr-actions { display: flex; flex-direction: column; gap: 6px; align-self: center; }
.appr-result { font-size: 13px; margin-top: 6px; }
.pl { margin-top: 10px; padding: 12px 14px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-sm); max-width: 90ch; }
.pl dl { margin: 0; display: grid; grid-template-columns: 80px 1fr; gap: 4px 12px; font-size: 13px; }
.pl dl > div { display: contents; }
.pl dt { color: var(--muted); }
.pl dd { margin: 0; overflow-wrap: anywhere; }
.pl-body { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); font-size: 13.5px; }
.appr-group { margin-bottom: 26px; }
.group-title { display: flex; align-items: baseline; gap: 12px; margin-bottom: 10px; font-weight: 400; font-size: 14px; }
.group-title a { color: var(--text); }
.group-title .callsign-name { font-size: 28px; }

/* ---------- accounts ---------- */
.connect-row { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.connect-btns { display: flex; gap: 10px; flex-wrap: wrap; flex: 1; }
.connect-btn { display: flex; align-items: center; gap: 12px; padding: 10px 16px 10px 10px; border-radius: var(--r); border: 1px solid var(--line-2); background: var(--panel-2); color: var(--text); cursor: pointer; text-align: left; font: inherit; min-width: 230px; }
.connect-btn:hover:not(:disabled) { border-color: var(--accent); }
.connect-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.connect-btn span:last-child { display: flex; flex-direction: column; }
.connect-btn small { color: var(--muted); font-size: 12px; }
.prov-mono { width: 36px; height: 36px; border-radius: 9px; display: grid; place-items: center; font-family: var(--display); font-weight: 700; letter-spacing: -0.03em; font-size: 21px; flex: none; color: #fff; background: var(--idle); }
.prov-google { background: #3f73d9; }
.prov-microsoft { background: #c2502b; }
.prov-slack { background: #5b2c5f; }
.acc { display: grid; grid-template-columns: 36px 1fr auto; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--line); align-items: start; }
.acc:last-child { border-bottom: 0; }
.acc-title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.caps { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 6px; }
.scopes { margin-top: 6px; font-size: 12.5px; color: var(--muted); }
.scopes summary { cursor: pointer; }
.scopes ul { margin: 4px 0 0; padding-left: 18px; font-family: var(--mono); font-size: 11.5px; }

/* ---------- feed ---------- */
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: 7px; padding: 4px 10px; border-radius: 99px; border: 1px solid var(--line-2); background: transparent; color: var(--muted); font: 500 13px var(--sans); cursor: pointer; }
.chip[aria-pressed='true'] { color: var(--text); background: var(--panel-2); }
.chip-n { font-size: 12px; color: var(--muted); }
.imp { display: inline-flex; align-items: center; gap: 7px; font-weight: 600; font-size: 12.5px; }
.imp-urgent .dot { background: var(--err); box-shadow: 0 0 0 3px var(--err-soft); }
.imp-important .dot { background: var(--warn); box-shadow: 0 0 0 3px var(--warn-soft); }
.imp-normal .dot { background: var(--info); }
.imp-noise .dot { background: var(--idle); }
.imp.imp-urgent { color: var(--err); }
.imp.imp-important { color: var(--warn); }
.imp.imp-normal { color: var(--text-2); }
.imp.imp-noise { color: var(--muted); font-weight: 500; }
.feed-item { min-width: 320px !important; }
.feed-title { display: flex; align-items: center; gap: 7px; font-weight: 500; }
.feed-title .ic { width: 15px; height: 15px; color: var(--muted); }
.feed-title a { color: var(--text); }
.feed-snip { color: var(--muted); font-size: 13px; margin-top: 2px; display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
.triage { display: flex; align-items: flex-start; gap: 6px; font-size: 12.5px; color: var(--accent); margin-top: 4px; }
.triage .ic { width: 13px; height: 13px; margin-top: 2px; }
.tbl-feed td { vertical-align: top; }

/* ---------- usage ---------- */
.chart-wrap { position: relative; }
.bars { max-width: 100%; display: block; overflow: visible; }
.bars .grid { stroke: var(--line); stroke-width: 1; }
.bars .ax { fill: var(--muted); font: 11px var(--sans); }
.bars .bar { fill: var(--accent); opacity: 0.85; }
.bars .bar-g.hover .bar { opacity: 1; fill: var(--accent-hover); }
.bars .bar-g.hover .hit { fill: var(--accent-soft); }
.tip { position: absolute; pointer-events: none; background: var(--panel); border: 1px solid var(--line-2); box-shadow: var(--shadow-pop); border-radius: var(--r-sm); padding: 8px 10px; display: flex; flex-direction: column; gap: 1px; min-width: 180px; font-size: 13px; z-index: 3; }
.tip span { font-family: var(--display); font-weight: 700; letter-spacing: -0.03em; font-size: 22px; }
.tip small { color: var(--muted); }
.tbl-purpose .bar-col { width: 40%; }
.hbar { display: block; height: 8px; background: var(--sunk); border-radius: 4px; overflow: hidden; }
.hbar span { display: block; height: 100%; background: var(--accent); border-radius: 4px; }

/* ---------- settings ---------- */
.settings .panel { max-width: 1060px; }
.env-list li { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.env-list code { min-width: 260px; }
.env-list input { max-width: 340px; }
.env-list li.removing code { text-decoration: line-through; color: var(--err); }
.env-list li.changing code { border-color: var(--accent); }
.life-btns { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.danger-zone { border-color: color-mix(in srgb, var(--err) 30%, var(--line)); }
.prov-rows li { display: grid; grid-template-columns: 14px 160px 1fr; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.prov-rows li:last-child { border-bottom: 0; }
.prov-list { display: flex; flex-wrap: wrap; gap: 6px 14px; padding-top: 6px; }
.prov { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; color: var(--muted); }
.prov-ok { color: var(--text); }

/* ---------- logs ---------- */
.logs { margin: 0; height: 440px; overflow: auto; background: var(--sunk); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 12px 14px; font: 12px/1.6 var(--mono); color: var(--text-2); white-space: pre-wrap; word-break: break-word; }
.ll-err { color: var(--err); }
.ll-warn { color: var(--warn); }
.tbl-audit td { vertical-align: top; }
.tbl-audit details summary { cursor: pointer; color: var(--text-2); list-style: none; }
.tbl-audit details summary::-webkit-details-marker { display: none; }
.tbl-audit details[open] summary { color: var(--muted); }

/* ---------- wizard ---------- */
.wizard { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 22px; align-items: start; max-width: 1100px; }
.steps { list-style: none; margin: 0; padding: 0; position: sticky; top: 20px; display: flex; flex-direction: column; gap: 2px; counter-reset: s; }
.steps button { display: flex; align-items: center; gap: 12px; width: 100%; background: none; border: 0; padding: 9px 10px; border-radius: var(--r-sm); color: var(--muted); font: 500 14px var(--sans); cursor: pointer; text-align: left; }
.steps button:disabled { cursor: default; }
.steps li.cur button { color: var(--text); background: var(--panel); }
.steps li.done button { color: var(--text-2); }
.steps li.done button:hover { background: var(--panel); }
.step-n { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; border: 1px solid var(--line-2); font-size: 12.5px; font-weight: 600; flex: none; }
.steps li.cur .step-n { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.steps li.done .step-n { background: var(--ok-soft); border-color: transparent; color: var(--ok); }
.step-n .ic { width: 14px; height: 14px; }
.wiz-panel { padding: 26px 28px; margin: 0; }
.wiz-panel .panel-title { font-family: var(--display); font-weight: 700; letter-spacing: -0.03em; font-size: 25px; margin-bottom: 20px; }
.wiz-foot { display: flex; justify-content: space-between; margin-top: 26px; padding-top: 18px; border-top: 1px solid var(--line); }
.inline-combo { display: flex; gap: 8px; }
.inline-combo select { flex: 1; }
.inline-create { display: grid; grid-template-columns: 1.4fr 1fr auto; gap: 8px; margin-top: 8px; padding: 10px; border: 1px dashed var(--line-2); border-radius: var(--r-sm); }
.host-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 8px; }
.host-opt { position: relative; cursor: pointer; }
.host-opt input { position: absolute; opacity: 0; }
.host-opt-body { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--line-2); border-radius: var(--r-sm); background: var(--sunk); }
.host-opt-body > .ic { width: 22px; height: 22px; color: var(--muted); }
.host-opt-body span { display: flex; flex-direction: column; }
.host-opt-body small { color: var(--muted); font-size: 12px; }
.host-opt input:checked + .host-opt-body { border-color: var(--accent); background: var(--accent-soft); }
.host-opt input:checked + .host-opt-body > .ic { color: var(--accent); }
.host-opt input:focus-visible + .host-opt-body { outline: 2px solid var(--accent); outline-offset: 2px; }
.chan-block { border: 1px solid var(--line); border-radius: var(--r); padding: 0; margin: 0 0 10px; background: var(--sunk); }
.chan-block legend { float: left; width: 100%; padding: 12px 14px; }
.chan-block legend .ic { color: var(--muted); }
.chan-block.open { border-color: var(--line-2); background: transparent; }
.chan-block.open legend .ic { color: var(--accent); }
.chan-fields { clear: both; padding: 0 14px 16px; }
.chan-fields > .hint { margin-bottom: 12px; }
.review { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 24px; margin: 0; }
.review dd { font-weight: 500; overflow-wrap: anywhere; }
.done-panel { max-width: 760px; padding: 28px 30px; }
.done-head { display: flex; gap: 16px; align-items: flex-start; margin-bottom: 24px; }
.done-head .dot { margin-top: 14px; width: 12px; height: 12px; }
.done-title { font-family: var(--display); font-weight: 700; letter-spacing: -0.03em; font-size: 30px; line-height: 1.05; }
.pairing { border: 1px solid var(--line-2); border-radius: var(--r); padding: 20px; background: var(--sunk); margin-bottom: 22px; }
.pair-code { display: flex; align-items: center; gap: 16px; margin: 8px 0 16px; flex-wrap: wrap; }
.pair-code code { font-size: 38px; letter-spacing: 0.14em; padding: 8px 16px; color: var(--accent); background: var(--panel); border-color: var(--line-2); }
.pair-steps { margin: 0; padding-left: 20px; color: var(--text-2); display: flex; flex-direction: column; gap: 4px; }
.done-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- modal ---------- */
.modal { border: 0; padding: 0; border-radius: var(--r-lg); background: var(--panel); color: var(--text); box-shadow: var(--shadow-pop); width: min(520px, calc(100vw - 32px)); max-height: calc(100vh - 48px); }
.modal-wide { width: min(720px, calc(100vw - 32px)); }
.modal::backdrop { background: rgba(5, 10, 16, 0.6); backdrop-filter: blur(3px); }
.modal[open] { animation: pop 0.16s ease-out; }
@keyframes pop { from { opacity: 0; transform: translateY(6px) scale(0.985); } }
.modal-form { display: flex; flex-direction: column; max-height: calc(100vh - 48px); }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 18px 20px 6px; }
.modal-head h2 { font-family: var(--display); font-weight: 700; letter-spacing: -0.03em; font-size: 22px; }
.modal-body { padding: 10px 20px 18px; overflow-y: auto; }
.modal-msg { color: var(--text-2); margin-bottom: 12px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--line); background: var(--panel-2); border-radius: 0 0 var(--r-lg) var(--r-lg); }

/* ---------- toasts ---------- */
.toasts { position: fixed; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 200; max-width: min(420px, calc(100vw - 36px)); }
.toast { display: flex; align-items: flex-start; gap: 10px; padding: 11px 12px 11px 14px; border-radius: var(--r); background: var(--panel-2); border: 1px solid var(--line-2); box-shadow: var(--shadow-pop); animation: toastIn 0.2s ease-out; font-size: 13.5px; }
.toast > .ic { margin-top: 1px; color: var(--info); }
.toast span { flex: 1; }
.toast-success > .ic { color: var(--ok); }
.toast-error { border-color: color-mix(in srgb, var(--err) 60%, transparent); }
.toast-error > .ic { color: var(--err); }
.toast-x { border: 0; background: none; color: var(--muted); cursor: pointer; padding: 0; display: grid; }
.toast-x .ic { width: 15px; height: 15px; }
.toast.out { opacity: 0; transform: translateY(6px); transition: 0.25s; }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } }

/* ---------- login ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login-card { width: min(380px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 32px 28px; box-shadow: var(--shadow-pop); display: flex; flex-direction: column; gap: 16px; }
.login-mark { width: 46px; height: 46px; border-radius: 13px; border: 1px solid var(--line-2); position: relative; background: var(--panel-2); }
.login-mark::before { content: ''; position: absolute; inset: 11px; border-radius: 50%; border: 2.5px solid var(--accent); }
.login-mark::after { content: ''; position: absolute; inset: 19px; border-radius: 50%; background: var(--accent); }
.login-card h1 { font-family: var(--display); font-weight: 700; letter-spacing: -0.03em; font-size: 34px; line-height: 1; }
.login-err { color: var(--err); font-size: 13px; }

/* ---------- responsive ---------- */
@media (max-width: 1280px) {
  .totals { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .tot:nth-child(3) { border-right: 0; }
  .tot:nth-child(-n + 3) { border-bottom: 1px solid var(--line); }
  .chat { grid-template-columns: minmax(0, 1fr) 260px; }
  .count-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1100px) {
  :root { --rail-w: 64px; }
  .rail { padding: 14px 8px; align-items: center; }
  .brand { padding: 4px 0 14px; }
  .brand-text, .nav-link span:not(.nav-count), .nav-btn span, .version, .mock-flag { display: none; }
  .mock-flag { display: none !important; }
  .nav-link, .nav-btn { justify-content: center; padding: 10px; position: relative; }
  .nav-count { position: absolute; top: 2px; right: 0; min-width: 16px; line-height: 16px; font-size: 10px; padding: 0 4px; }
  .page { padding: 22px 22px 56px; }
  .ov-grid, .docs-grid, .two-col { grid-template-columns: minmax(0, 1fr); }
  .split { grid-template-columns: minmax(0, 1fr); }
  .split-list { position: static; max-height: 360px; }
  .wizard { grid-template-columns: minmax(0, 1fr); }
  .steps { position: static; flex-direction: row; overflow-x: auto; }
  .steps button span:last-child { display: none; }
  .steps li.cur button span:last-child { display: inline; }
  .tbl-fleet th:nth-child(2), .tbl-fleet td:nth-child(2) { display: none; }
}
@media (max-width: 860px) {
  .chat { grid-template-columns: minmax(0, 1fr); height: auto; }
  .chat-main { height: calc(100vh - 230px); min-height: 480px; }
  .activity { max-height: 280px; }
  .totals { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tot { border-right: 1px solid var(--line) !important; border-bottom: 1px solid var(--line); }
  .tot:nth-child(2n) { border-right: 0 !important; }
  .form-grid, .review { grid-template-columns: minmax(0, 1fr); }
  .task { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .task-times { flex-direction: row; gap: 24px; }
  .agent-name { font-size: 42px; }
  .page-title { font-size: 36px; }
  .agent-facts > div { padding: 0 14px; }
  .hide-sm { display: none; }
  .model-combo { grid-template-columns: minmax(0, 1fr); }
  .tbl-fleet th:nth-child(4), .tbl-fleet td:nth-child(4) { display: none; }
  .appr { grid-template-columns: 38px minmax(0, 1fr); }
  .appr-actions { grid-column: 2; flex-direction: row; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; scroll-behavior: auto !important; }
}

li::marker { font-variant-numeric: normal; font-feature-settings: normal; }

/* ---------- v0.2: integrations, customer access, shared accounts component ---------- */
.copy-field { display: flex; gap: 8px; align-items: center; min-width: 0; }
.copy-field input { flex: 1; min-width: 0; font-family: var(--mono); font-size: 12.5px; }
.src-badge { display: inline-flex; align-items: center; height: 20px; padding: 0 8px; border-radius: 99px; font-size: 11.5px; font-weight: 600; white-space: nowrap; border: 1px solid transparent; }
.src-cockpit { color: var(--accent); background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 35%, transparent); }
.src-env { color: var(--info); background: var(--info-soft); }
.src-none { color: var(--muted); background: var(--sunk); border-color: var(--line); }
.int-section { margin-bottom: 30px; scroll-margin-top: 16px; }
.int-section-head { margin-bottom: 14px; }
.int-section-head .group-title { font-family: var(--display); font-weight: 700; letter-spacing: -0.03em; font-size: 25px; line-height: 1.1; margin: 0; }
.int-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; align-items: start; }
.int-grid > .panel { margin-bottom: 0; }
.int-card { display: flex; flex-direction: column; gap: 16px; }
.int-head { display: flex; align-items: flex-start; gap: 12px; }
.int-head-text { flex: 1; min-width: 0; }
.int-head .panel-sub { margin-top: 2px; }
.int-setup { background: var(--sunk); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; }
.int-steps-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; }
.int-console { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; font-weight: 500; }
.int-console .ic { width: 14px; height: 14px; }
.int-steps { margin: 0; padding-left: 20px; color: var(--text-2); font-size: 13px; line-height: 1.5; display: flex; flex-direction: column; gap: 3px; }
.int-scopes { margin-top: 10px; }
.int-scopes ul { list-style: none; padding: 6px 0 0; margin: 0; display: flex; flex-wrap: wrap; gap: 4px; }
.int-scopes code { font-size: 11.5px; }
.int-form { display: flex; flex-direction: column; gap: 14px; }
.int-fields { display: flex; flex-direction: column; gap: 14px; }
.int-label { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.int-input { display: flex; gap: 8px; align-items: center; }
.int-input input { flex: 1; min-width: 0; }
.int-warn { display: flex; gap: 10px; align-items: flex-start; color: var(--text-2); font-size: 13px; background: var(--warn-soft); border: 1px solid color-mix(in srgb, var(--warn) 35%, transparent); border-radius: var(--r-sm); padding: 10px 12px; margin: 0; }
.int-warn .ic { color: var(--warn); margin-top: 1px; }
.int-model { display: flex; flex-direction: column; gap: 6px; }
.int-model-src { display: flex; align-items: center; gap: 8px; }
.int-image { margin-top: 4px; }
.user-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.user-row { display: flex; align-items: center; gap: 14px; padding: 12px 4px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.user-row:first-child { border-top: 0; }
.user-av { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); font-family: var(--display); font-weight: 700; letter-spacing: -0.03em; font-size: 19px; flex: none; }
.user-main { flex: 1; min-width: 220px; display: flex; flex-direction: column; gap: 2px; }
.user-name { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.user-meta { display: flex; gap: 4px 14px; flex-wrap: wrap; color: var(--muted); font-size: 13px; }
.role-tag { font-size: 11.5px; font-weight: 600; color: var(--text-2); border: 1px solid var(--line-2); border-radius: 99px; padding: 0 8px; line-height: 18px; }
.role-tenant_admin { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 40%, transparent); }
.invite-out { display: flex; flex-direction: column; gap: 8px; }
.tenant-people { margin-top: 18px; }
.tenant-block { padding: 14px 0 6px; border-top: 1px solid var(--line); }
.tenant-block:first-child { border-top: 0; padding-top: 0; }
.tenant-block-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 4px; }
.tenant-block-head h3 { font-size: 15px; }
.tenant-block-head .btn { margin-left: auto; }
.tenant-none { padding: 6px 0 10px; }
.rail-foot a.nav-btn { text-decoration: none; }
/* The shared accounts component inside the cockpit's tab panel */
.tab-accounts .ac { max-width: 1100px; }
.tab-accounts .ac-acc, .tab-accounts .ac-card, .tab-accounts .ac-panel { box-shadow: var(--shadow); }
@media (max-width: 1280px) { .int-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 860px) { .int-grid { grid-template-columns: 1fr; } }
.int-title-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }

/* ---------- v0.3: messaging integrations, apply keys, channels tab ---------- */
.int-section-head-row { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.int-msg-logo { color: var(--text); }
.apply-list { list-style: none; margin: 14px 0 0; padding: 0; display: flex; flex-direction: column; }
.apply-list li { display: flex; gap: 12px; align-items: flex-start; padding: 10px 0; }
.apply-list li + li { border-top: 1px solid var(--line); }
.apply-list li > div { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.apply-list li span:not(.apply-ic) { color: var(--text-2); font-size: 13px; display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.apply-ic { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--sunk); color: var(--muted); flex: none; }
.apply-ic .ic { width: 14px; height: 14px; }
.apply-list li.is-chg .apply-ic { background: var(--ok-soft); color: var(--ok); }
.apply-list li.is-err .apply-ic { background: var(--err-soft); color: var(--err); }
.apply-list .apply-err { color: var(--err) !important; }
.ch-panel .ch-key { background: var(--panel-2); }
.ch-panel .ch-row { background: var(--panel-2); }
.invite-emailed { display: flex; gap: 10px; align-items: flex-start; }

/* ---------- v0.4: tenant tiers, moving agents, cockpit security ---------- */
.spinner-sm { width: 12px; height: 12px; border-width: 1.6px; }
.link-btn { border: 0; background: none; padding: 0; color: var(--accent); font: 500 13px var(--sans); cursor: pointer; text-align: left; }
.link-btn:hover { text-decoration: underline; text-underline-offset: 3px; }
.link-btn:focus-visible, .menu [role=menuitem]:focus-visible, .set-nav a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

/* login: second step */
.login-code { animation: rise 0.22s ease-out; }
.login-code input { font: 500 22px/1 var(--mono); letter-spacing: 0.32em; text-align: center; padding: 10px; }
.login-code .link-btn { align-self: flex-start; margin-top: 2px; }
@keyframes rise { from { opacity: 0; transform: translateY(-4px); } }

/* tiers */
.tier-pick { border: 0; padding: 0; margin: 0; min-width: 0; }
.tier-pick legend { font-size: 13px; font-weight: 600; color: var(--text-2); padding: 0; margin-bottom: 8px; }
#tierOpts { display: flex; flex-direction: column; gap: 8px; }
.tier-opt { position: relative; display: grid; grid-template-columns: 46px minmax(0, 1fr); gap: 12px; align-items: start; padding: 12px 14px; border: 1px solid var(--line-2); border-radius: var(--r); background: var(--sunk); cursor: pointer; transition: border-color 0.12s, background 0.12s; }
.tier-opt input { position: absolute; opacity: 0; inset: 0; cursor: pointer; margin: 0; }
.tier-opt:hover { border-color: var(--muted); }
.tier-opt:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.tier-opt:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.tier-opt.is-off { opacity: 0.55; cursor: not-allowed; }
.tier-art svg { width: 46px; height: 32px; display: block; }
.ta-box { fill: none; stroke: var(--muted); stroke-width: 1.6; }
.ta-dash { stroke-dasharray: 3 2.4; }
.ta-dot { fill: var(--muted); }
.ta-dim { fill: none; stroke: var(--muted); stroke-width: 1.4; opacity: 0.7; }
.ta-house { fill: none; stroke: var(--muted); stroke-width: 1.6; stroke-linejoin: round; }
.tier-opt:has(input:checked) .ta-box, .tier-opt:has(input:checked) .ta-house { stroke: var(--accent); }
.tier-opt:has(input:checked) .ta-dot { fill: var(--accent); }
.tier-text { display: flex; flex-direction: column; gap: 2px; font-size: 13px; color: var(--text-2); line-height: 1.45; }
.tier-name { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 14px; color: var(--text); }
.tier-text small { color: var(--muted); font-size: 12px; margin-top: 2px; overflow-wrap: anywhere; }
.tier-rec { font-size: 11.5px; font-weight: 600; color: var(--accent); border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent); border-radius: 99px; padding: 0 8px; line-height: 18px; }
.tier { display: inline-flex; align-items: center; height: 20px; padding: 0 8px; border-radius: 5px; font-size: 11.5px; font-weight: 700; letter-spacing: 0.01em; border: 1px solid; }
.tier-business { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 55%, transparent); background: var(--accent-soft); }
.tier-standard { color: var(--text-2); border-color: var(--line-2); background: var(--sunk); }
.tier-private { color: var(--info); border-color: color-mix(in srgb, var(--info) 45%, transparent); border-style: dashed; background: var(--info-soft); }

/* tenant list */
.ten-list { list-style: none; margin: 0; padding: 0; }
.ten-row { display: flex; gap: 16px; align-items: flex-start; padding: 16px 2px; border-top: 1px solid var(--line); }
.ten-row:first-child { border-top: 0; padding-top: 2px; }
.ten-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.ten-name { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ten-name h3 { font-size: 16px; }
.ten-host { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; color: var(--text-2); min-width: 0; }
.ten-host .ic { width: 15px; height: 15px; color: var(--muted); }
.ten-host b { color: var(--text); font-weight: 500; overflow-wrap: anywhere; }
.ten-host.is-warn, .ten-host.is-warn .ic { color: var(--warn); }
.ten-meta { display: flex; flex-wrap: wrap; gap: 2px 14px; font-size: 12.5px; color: var(--muted); }
.ten-meta span:empty { display: none; }
.ten-notes { font-size: 13px; color: var(--muted); max-width: 70ch; }
.ten-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.ten-progress { border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent); background: var(--accent-soft); border-radius: var(--r); padding: 12px 14px; display: flex; flex-direction: column; gap: 10px; }
.ten-prog-bar { height: 3px; border-radius: 3px; background: var(--line); overflow: hidden; position: relative; }
.ten-prog-bar span { position: absolute; inset: 0 auto 0 0; width: 34%; background: var(--accent); border-radius: 3px; animation: sweep 1.3s ease-in-out infinite; }
@keyframes sweep { 0% { left: -34%; } 100% { left: 100%; } }
.ten-prog-steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }
.ten-prog-steps li { display: flex; align-items: center; gap: 9px; }
.ten-prog-steps li > :first-child { width: 14px; display: grid; place-items: center; flex: none; }
.ten-prog-steps .ic { width: 14px; height: 14px; color: var(--ok); }
.ten-prog-steps .is-cur { color: var(--text); font-weight: 500; }
.ten-prog-steps .is-cur .spinner { color: var(--accent); }
.ten-prog-steps .is-done { color: var(--text-2); }
.ten-prog-dot { width: 6px !important; height: 6px; border-radius: 50%; background: var(--line-2); }
.del-proj { margin-bottom: 10px; align-items: flex-start; }
.del-proj input { margin-top: 3px; }
.host-opt.is-off { opacity: 0.5; cursor: not-allowed; }

/* agent header menu */
.menu-wrap { position: relative; }
.menu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; min-width: 260px; background: var(--panel); border-radius: var(--r); box-shadow: var(--shadow-pop); padding: 6px; display: flex; flex-direction: column; animation: pop 0.12s ease-out; }
.menu [role=menuitem] { display: flex; align-items: flex-start; gap: 11px; padding: 9px 10px; border: 0; background: none; color: var(--text); border-radius: var(--r-sm); cursor: pointer; text-align: left; font: inherit; }
.menu [role=menuitem]:hover:not(:disabled) { background: var(--panel-2); }
.menu [role=menuitem]:disabled { opacity: 0.45; cursor: not-allowed; }
.menu [role=menuitem] .ic { margin-top: 1px; color: var(--accent); }
.menu [role=menuitem] span { display: flex; flex-direction: column; }
.menu [role=menuitem] small { color: var(--muted); font-size: 12px; }

/* move: banners */
.mv-banner { display: flex; align-items: center; gap: 14px; padding: 12px 16px; margin-bottom: 16px; border-radius: var(--r); background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent); }
.mv-banner > .ic { width: 24px; height: 24px; color: var(--accent); }
.mv-banner > .spinner { color: var(--accent); width: 18px; height: 18px; }
.mv-banner div { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.mv-banner span { color: var(--text-2); font-size: 13px; }
.mv-banner .btn { flex: none; }
.life-move { display: flex; gap: 16px; align-items: center; justify-content: space-between; flex-wrap: wrap; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.life-move-text { flex: 1; min-width: 240px; }
.life-move-text h3 { font-size: 14px; margin-bottom: 3px; }
.life-move-text p { color: var(--muted); font-size: 13px; max-width: 72ch; }

/* move: picker */
.mv-downtime { display: flex; gap: 9px; align-items: flex-start; font-size: 13px; color: var(--text-2); background: var(--sunk); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 9px 12px; margin-bottom: 14px; }
.mv-downtime .ic { width: 16px; height: 16px; color: var(--warn); margin-top: 1px; }
.mv-pick { border: 0; padding: 0; margin: 0 0 14px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.mv-pick legend { font-size: 13px; font-weight: 600; color: var(--text-2); padding: 0; margin-bottom: 8px; }
.mv-host { position: relative; display: flex; align-items: center; gap: 12px; padding: 11px 14px; border: 1px solid var(--line-2); border-radius: var(--r-sm); background: var(--sunk); cursor: pointer; }
.mv-host input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.mv-host:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.mv-host:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.mv-host.is-off { opacity: 0.5; cursor: not-allowed; }
.mv-host.is-off input { cursor: not-allowed; }
.mv-host-ic .ic { width: 22px; height: 22px; color: var(--muted); }
.mv-host:has(input:checked) .mv-host-ic .ic { color: var(--accent); }
.mv-host-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.mv-host-text small { color: var(--muted); font-size: 12.5px; }
.mv-tag { font-size: 11.5px; font-weight: 600; color: var(--muted); border: 1px solid var(--line-2); border-radius: 99px; padding: 0 8px; line-height: 18px; white-space: nowrap; }
.mv-tag-own { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 45%, transparent); }
.mv-del { align-items: flex-start; }
.mv-del input { margin-top: 3px; }
.mv-del-hint { margin: 4px 0 0 25px; }

/* move: progress (the route) */
.modal-move .modal-body { padding-top: 4px; }
.mv { --track: var(--accent); }
.mv-done { --track: var(--ok); }
.mv-failed { --track: var(--err); }
.mv-route { display: grid; grid-template-columns: minmax(0, 1fr) minmax(120px, 2.2fr) minmax(0, 1fr); align-items: center; gap: 14px; padding: 18px 16px; border-radius: var(--r); background: var(--sunk); border: 1px solid var(--line); }
.mv-end { display: flex; flex-direction: column; min-width: 0; }
.mv-end small { color: var(--muted); font-size: 12px; }
.mv-end b { font-weight: 600; font-size: 13.5px; line-height: 1.3; overflow-wrap: anywhere; }
.mv-to { text-align: right; }
.mv-track { position: relative; height: 18px; }
.mv-rail { position: absolute; left: 0; right: 0; top: 50%; border-top: 2px dashed var(--line-2); transform: translateY(-1px); }
.mv-fill { position: absolute; left: 0; top: 50%; height: 2px; transform: translateY(-1px); width: calc(var(--p) * 100%); background: var(--track); transition: width 0.9s cubic-bezier(0.3, 0.7, 0.2, 1), background 0.3s; }
.mv-tick { position: absolute; top: 50%; left: calc(var(--i) * 100%); width: 6px; height: 6px; margin: -3px 0 0 -3px; border-radius: 50%; background: var(--panel); border: 1.5px solid var(--line-2); }
.mv-dot { position: absolute; top: 50%; left: calc(var(--p) * 100%); width: 14px; height: 14px; margin: -7px 0 0 -7px; border-radius: 50%; background: var(--track); box-shadow: 0 0 0 4px color-mix(in srgb, var(--track) 22%, transparent); transition: left 0.9s cubic-bezier(0.3, 0.7, 0.2, 1), background 0.3s; }
.mv-running .mv-dot { animation: beacon 1.8s ease-in-out infinite; }
@keyframes beacon { 50% { box-shadow: 0 0 0 8px color-mix(in srgb, var(--track) 8%, transparent); } }
.mv-failed .mv-from.is-back b { color: var(--ok); }
.mv-failed:has(.mv-from.is-back) .mv-dot { background: var(--ok); box-shadow: 0 0 0 4px var(--ok-soft); }
.mv-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 18px 0 8px; }
.mv-head h3 { font-family: var(--display); font-weight: 700; letter-spacing: -0.03em; font-size: 22px; line-height: 1.1; }
.mv-clock { font: 500 14px var(--mono); color: var(--muted); font-variant-numeric: tabular-nums; }
.mv-result { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: var(--r-sm); font-size: 13.5px; margin-bottom: 10px; color: var(--text-2); line-height: 1.5; }
.mv-result .ic { margin-top: 2px; }
.mv-ok { background: var(--ok-soft); border: 1px solid color-mix(in srgb, var(--ok) 40%, transparent); }
.mv-ok .ic { color: var(--ok); }
.mv-err { background: var(--err-soft); border: 1px solid color-mix(in srgb, var(--err) 40%, transparent); }
.mv-err .ic { color: var(--err); }
.mv-err b { color: var(--text); font-weight: 600; }
.mv-steps { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-direction: column; }
.mv-steps li { display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; gap: 10px; align-items: start; padding: 5px 0; position: relative; font-size: 13.5px; color: var(--text-2); }
.mv-steps li:not(:last-child)::before { content: ''; position: absolute; left: 10.5px; top: 25px; bottom: -5px; width: 1px; background: var(--line-2); }
.mv-step-ic { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: var(--panel-2); border: 1px solid var(--line-2); color: var(--muted); position: relative; z-index: 1; }
.mv-step-ic .ic { width: 12px; height: 12px; }
.mv-steps .is-done .mv-step-ic { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 40%, transparent); background: var(--ok-soft); }
.mv-steps .is-cur { color: var(--text); font-weight: 500; }
.mv-steps .is-cur .mv-step-ic { color: var(--accent); border-color: var(--accent); }
.mv-steps .is-err { color: var(--err); font-weight: 500; }
.mv-steps .is-err .mv-step-ic { color: var(--err); border-color: var(--err); background: var(--err-soft); }
.mv-steps .is-back .mv-step-ic { color: var(--ok); border-color: var(--ok); }
.mv-step-msg { padding-top: 2px; overflow-wrap: anywhere; }
.mv-steps time { font: 400 12px var(--mono); color: var(--muted); padding-top: 4px; font-variant-numeric: tabular-nums; }

/* settings section nav */
.set-nav { display: flex; gap: 4px; flex-wrap: wrap; margin: -6px 0 22px; padding: 4px; background: var(--sunk); border: 1px solid var(--line); border-radius: var(--r); width: fit-content; max-width: 100%; }
.set-nav a { display: inline-flex; align-items: center; gap: 7px; padding: 6px 12px; border-radius: var(--r-sm); color: var(--text-2); font-weight: 500; font-size: 13.5px; text-decoration: none; }
.set-nav a .ic { width: 15px; height: 15px; color: var(--muted); }
.set-nav a:hover { background: var(--panel); color: var(--text); }
.set-nav a.active { background: var(--panel-2); color: var(--text); box-shadow: 0 0 0 1px var(--line-2); }
.set-nav a.active .ic { color: var(--accent); }
#security, #browser, #integrations, #messaging, #keys { scroll-margin-top: 20px; }

/* security */
.sec-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; align-items: start; }
.sec-grid > .panel { margin-bottom: 0; }
.sec-card { display: flex; flex-direction: column; gap: 16px; }
.sec-card-head { display: flex; gap: 14px; align-items: flex-start; }
.sec-glyph { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; flex: none; background: var(--sunk); border: 1px solid var(--line-2); color: var(--muted); }
.sec-2fa.is-on .sec-glyph { color: var(--ok); background: var(--ok-soft); border-color: color-mix(in srgb, var(--ok) 40%, transparent); }
.sec-state { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 13.5px; }
.sec-low { color: var(--warn); }
.sec-card .form-actions { justify-content: flex-start; }
.sec-ip-form { display: flex; flex-direction: column; gap: 12px; }
.sec-ip-label { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.sec-ip-label label { font-size: 13px; font-weight: 600; color: var(--text-2); }
.sec-you { font-size: 13px; color: var(--muted); display: inline-flex; gap: 8px; align-items: baseline; }
.sec-you b { color: var(--text); }
.sec-ip-status { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-2); }
.sec-ip-status .ic { width: 15px; height: 15px; color: var(--muted); }
.sec-activity { grid-column: 1 / -1; }
.sec-act-grid { display: grid; grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr); gap: 24px; }
.sec-tbl-title { font-size: 13px; font-weight: 600; color: var(--text-2); margin-bottom: 6px; }
.sec-tbl td { padding-top: 8px; padding-bottom: 8px; }
.sec-path { max-width: 200px; overflow: hidden; text-overflow: ellipsis; }
.sec-none { padding: 8px 0; }
.http-m { font: 600 11px var(--mono); padding: 1px 6px; border-radius: 4px; background: var(--sunk); border: 1px solid var(--line-2); color: var(--text-2); }
.http-post { color: var(--info); }
.http-delete { color: var(--err); }
.http-patch, .http-put { color: var(--accent); }
.http-s { font: 500 12px var(--mono); }
.http-s.is-ok { color: var(--ok); }
.http-s.is-err { color: var(--err); }

/* totp setup + recovery codes */
.totp-setup { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 22px; align-items: start; }
.totp-qr { background: #fff; border-radius: var(--r); padding: 10px; border: 1px solid var(--line); }
.totp-qr svg { width: 100%; height: auto; display: block; }
.totp-steps { margin: 0; padding: 0; list-style: none; counter-reset: s; display: flex; flex-direction: column; gap: 14px; }
.totp-steps > li { counter-increment: s; display: flex; flex-direction: column; gap: 4px; padding-left: 32px; position: relative; font-size: 13.5px; color: var(--text-2); }
.totp-steps > li::before { content: counter(s); position: absolute; left: 0; top: -1px; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font: 600 12px var(--sans); color: var(--accent); border: 1px solid color-mix(in srgb, var(--accent) 50%, transparent); }
.totp-steps b { color: var(--text); }
.totp-secret { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
.totp-secret code { font-size: 12.5px; letter-spacing: 0.06em; word-break: break-all; padding: 4px 8px; }
.sec-code-field { margin-top: 6px; max-width: 220px; }
.sec-code { font: 500 20px/1 var(--mono); letter-spacing: 0.24em; text-align: center; }
.rc-grid { list-style: none; margin: 4px 0 14px; padding: 14px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 18px; background: var(--sunk); border: 1px dashed var(--line-2); border-radius: var(--r); }
.rc-grid code { background: none; border: 0; padding: 0; font-size: 15px; letter-spacing: 0.06em; color: var(--text); }
.rc-actions { display: flex; gap: 8px; flex-wrap: wrap; }

@media (max-width: 1100px) {
  .sec-grid, .sec-act-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 860px) {
  .ten-row { flex-direction: column; gap: 10px; }
  .ten-actions { justify-content: flex-start; }
  .mv-route { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); padding: 14px; }
  .mv-track { grid-column: 1 / -1; grid-row: 2; }
  .mv-banner { flex-wrap: wrap; align-items: flex-start; }
  .mv-banner div { min-width: calc(100% - 44px); }
  .mv-banner .btn { margin-left: 38px; }
  .totp-setup { grid-template-columns: minmax(0, 1fr); }
  .totp-qr { max-width: 200px; }
  .set-nav { width: auto; }
  .menu { right: auto; left: 0; }
  .env-list li { flex-wrap: wrap; }
  .env-list code { min-width: 0; overflow-wrap: anywhere; }
  .row-actions { flex-wrap: wrap; }
}
.tbl-wrap { position: relative; }

/* Keel brand mark (K-keel monogram): ink follows the theme text colour; the keel blade is brand teal */
.brand-mark { width: 30px; height: 30px; flex: none; display: grid; place-items: center; background: none; border: 0; border-radius: 0; color: currentColor; }
.brand-mark::before, .brand-mark::after { content: none; display: none; }
.keel-mark { width: 100%; height: 100%; display: block; overflow: visible; }
.keel-mark path { fill: none; stroke: currentColor; stroke-width: 8; stroke-linecap: round; }
.keel-mark .wl { stroke-width: 2.5; opacity: .4; }
.keel-mark .kb { stroke: var(--keel); }
.top-brand .brand-mark { width: 26px; height: 26px; }
