/* Layout: fixed sidebar + main column with a breadcrumb bar; three views (products, product, spawn) switched by hash. */
:root {
  --bg: #F8F8F9; --panel: #FFFFFF; --sub: #F2F2F4; --line: #DCDCE1; --line-strong: #C2C2CA;
  --fg: #0B0B0C; --muted: #5F5F68; --focus: rgba(11,11,12,.10); --shadow: rgba(0,0,0,.05);
  --side: #F2F2F4;
  --live: #16A34A; --live-ring: rgba(22,163,74,.15); --bad: #DC2626;
  --sans: 'Geist', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'Geist Mono', ui-monospace, 'SF Mono', Menlo, monospace;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --bg: #09090B; --panel: #111113; --sub: #1A1A1D; --line: #26262A; --line-strong: #3F3F46;
  --fg: #EDEDEF; --muted: #A1A1AA; --focus: rgba(237,237,239,.14); --shadow: rgba(0,0,0,.5);
  --side: #0E0E10;
  --live: #22C55E; --live-ring: rgba(34,197,94,.18); --bad: #F87171; color-scheme: dark;
} }
:root[data-theme="dark"] {
  --bg: #09090B; --panel: #111113; --sub: #1A1A1D; --line: #26262A; --line-strong: #3F3F46;
  --fg: #EDEDEF; --muted: #A1A1AA; --focus: rgba(237,237,239,.14); --shadow: rgba(0,0,0,.5);
  --side: #0E0E10;
  --live: #22C55E; --live-ring: rgba(34,197,94,.18); --bad: #F87171; color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { background: var(--bg); color: var(--fg); font: 14px/1.5 var(--sans); -webkit-font-smoothing: antialiased; }
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 10; background: var(--bg); }
h1, h2 { text-wrap: balance; margin: 0; }
a { color: inherit; }
button, input, textarea, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--fg); outline-offset: 2px; border-radius: 6px; }
.mono { font-family: var(--mono); font-size: 13px; }
.muted { color: var(--muted); }
.num { font-variant-numeric: tabular-nums; }

/* App shell */
.app { display: flex; min-height: 100vh; }
.sidebar { width: 232px; flex-shrink: 0; position: sticky; top: env(safe-area-inset-top, 0px); height: 100vh; align-self: flex-start;
  background: var(--side); border-right: 1px solid var(--line);
  padding-block: 0 16px; padding-left: max(14px, env(safe-area-inset-left, 0px)); padding-right: 14px;
  display: flex; flex-direction: column; gap: 20px; }
.brand { height: 56px; display: flex; align-items: center; gap: 10px; padding: 0 6px; font-weight: 600; letter-spacing: -.01em; text-decoration: none; }
.mark { width: 22px; height: 22px; border-radius: 6px; background: var(--fg); display: grid; place-items: center; }
.mark svg { fill: var(--side); }
.side-label { font-size: 12px; color: var(--muted); padding: 0 10px 6px; letter-spacing: .02em; }
.side-nav { display: flex; flex-direction: column; gap: 2px; }
.side-nav a { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 7px; text-decoration: none; color: var(--muted); }
.side-nav a:hover { color: var(--fg); background: var(--sub); }
.side-nav a[aria-current="page"] { color: var(--fg); background: var(--panel); box-shadow: 0 0 0 1px var(--line); font-weight: 500; }
.side-nav .count { margin-left: auto; font-family: var(--mono); font-size: 12px; color: var(--muted); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.top { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5; background: var(--bg); border-bottom: 1px solid var(--line); }
.top-inner, .content { max-width: 1320px; width: 100%; margin: 0 auto; padding-left: 32px; padding-right: max(32px, env(safe-area-inset-right, 0px)); }
.top-inner { height: 56px; display: flex; align-items: center; gap: 12px; }
.crumbs { display: flex; align-items: center; gap: 8px; min-width: 0; flex: 1; }
.crumbs ol { list-style: none; margin: 0; padding: 0; display: flex; align-items: center; gap: 8px; min-width: 0; }
.crumbs li { display: flex; align-items: center; gap: 8px; white-space: nowrap; min-width: 0; }
.crumbs li + li::before { content: "/"; color: var(--line-strong); }
.crumbs a { color: var(--muted); text-decoration: none; padding: 4px 6px; margin: 0 -6px; border-radius: 6px; }
.crumbs a:hover { color: var(--fg); background: var(--sub); }
.crumbs [aria-current="page"] { font-weight: 500; overflow: hidden; text-overflow: ellipsis; }
.content { padding-block: 32px 80px; }

.btn { display: inline-flex; align-items: center; gap: 8px; height: 34px; padding: 0 14px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel); font-weight: 500; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { border-color: var(--line-strong); }
.btn.primary { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.btn.primary:hover { opacity: .88; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { color: var(--fg); }
/* Account menu */
.account { margin-top: auto; position: relative; }
.account-btn { width: 100%; display: flex; align-items: center; gap: 10px; padding: 8px; border: 1px solid transparent; border-radius: 9px; background: transparent; cursor: pointer; text-align: left; }
.account-btn:hover, .account-btn[aria-expanded="true"] { background: var(--panel); border-color: var(--line); }
.account-btn .avatar { width: 28px; height: 28px; font-size: 11px; }
.account-name { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.account-name span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-name span:first-child { font-weight: 500; }
.account-name .muted { font-size: 12px; }
.account-chev { color: var(--muted); flex-shrink: 0; }
.menu { position: absolute; left: 0; right: 0; bottom: calc(100% + 6px); z-index: 20; border: 1px solid var(--line); border-radius: 11px; background: var(--panel); box-shadow: 0 12px 32px rgba(0,0,0,.14); padding: 6px; display: flex; flex-direction: column; }
.menu-head { display: flex; flex-direction: column; padding: 8px 10px 10px; border-bottom: 1px solid var(--line); margin-bottom: 4px; line-height: 1.35; }
.menu-head span:first-child { font-weight: 500; }
.menu-head .muted { font-size: 12px; overflow-wrap: anywhere; }
.menu-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 10px; }
.menu-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 0; border-radius: 7px; background: transparent; cursor: pointer; text-align: left; color: var(--fg); }
.menu-item:hover { background: var(--sub); }
.menu-item svg { color: var(--muted); }
.seg.seg-sm { padding: 2px; border-radius: 8px; }
.seg.seg-sm button { padding: 4px 8px; display: grid; place-items: center; }

/* Spawn progress */
.run { max-width: 720px; display: flex; flex-direction: column; gap: 16px; }
.run-idea { display: flex; flex-direction: column; gap: 4px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); }
.run-idea .muted { font-size: 12px; }
.run-idea p { margin: 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.run-panel { border: 1px solid var(--line); border-radius: 12px; background: var(--panel); }
.run-head { display: flex; justify-content: space-between; align-items: baseline; padding: 14px 18px 10px; font-weight: 500; }
.segments { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 4px; padding: 0 18px 6px; }
.segments span { height: 4px; border-radius: 99px; background: var(--sub); box-shadow: inset 0 0 0 1px var(--line); }
.segments .seg-done { background: var(--fg); box-shadow: none; }
.segments .seg-active { background: var(--muted); box-shadow: none; }
.segments .seg-failed { background: var(--bad); box-shadow: none; }
@media (prefers-reduced-motion: no-preference) { .segments .seg-active { animation: blink 1.2s ease-in-out infinite; } }
@keyframes blink { 50% { opacity: .35; } }
.run-steps { list-style: none; margin: 0; padding: 4px 0 6px; }
.run-steps li { display: flex; align-items: flex-start; gap: 12px; padding: 11px 18px; }
.run-steps li + li { border-top: 1px solid var(--line); }
.step-icon { width: 20px; height: 20px; flex-shrink: 0; border-radius: 99px; display: grid; place-items: center; margin-top: 1px; border: 1.5px solid var(--line-strong); }
.step-done .step-icon { background: var(--fg); border-color: var(--fg); color: var(--bg); }
.step-active .step-icon { border-color: transparent; }
.step-failed .step-icon { background: var(--bad); border-color: var(--bad); color: #FFFFFF; }
.step-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.step-pending .step-label { color: var(--muted); }
.step-active .step-label, .step-failed .step-label { font-weight: 500; }
.step-sub { font-family: var(--mono); font-size: 12px; color: var(--muted); overflow-wrap: anywhere; }
.step-error { font-size: 13px; color: var(--bad); margin-top: 2px; }
.btn.retry { height: 30px; padding: 0 12px; }
.spinner { width: 16px; height: 16px; border-radius: 99px; border: 2px solid var(--line-strong); border-top-color: var(--fg); }
@media (prefers-reduced-motion: no-preference) { .spinner { animation: spin .8s linear infinite; } }
@keyframes spin { to { transform: rotate(360deg); } }
.run-done { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border: 1px solid var(--line-strong); border-radius: 12px; background: var(--panel); flex-wrap: wrap; }
.run-done > svg { flex-shrink: 0; color: var(--live); }
.run-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

.view { display: flex; flex-direction: column; gap: 24px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.page-head h1 { font-size: 26px; font-weight: 600; letter-spacing: -.025em; }
.page-head p { margin: 4px 0 0; color: var(--muted); }

/* Summary cards */
.cards { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 1100px) { .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 420px) { .cards { grid-template-columns: minmax(0, 1fr); } }
.card { border: 1px solid var(--line); border-radius: 12px; background: var(--panel); padding: 18px 20px; display: flex; flex-direction: column; gap: 6px; }
.card-label { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }
.card-label svg { color: var(--muted); }
.card-value { font-size: 28px; font-weight: 500; letter-spacing: -.03em; line-height: 1.2; }
.card-sub { color: var(--muted); font-size: 13px; }

/* Products table */
.table-box { border: 1px solid var(--line); border-radius: 12px; background: var(--panel); overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 860px; }
th, td { text-align: left; padding: 13px 10px; white-space: nowrap; }
th:first-child, td:first-child { padding-left: 18px; }
th:last-child, td:last-child { padding-right: 18px; }
th { font-weight: 400; font-size: 12px; color: var(--muted); border-bottom: 1px solid var(--line); }
td { border-top: 1px solid var(--line); }
tbody tr:first-child td { border-top: 0; }
tbody tr { cursor: pointer; }
tbody tr:hover td { background: var(--sub); }
th.r, td.r { text-align: right; }
th { padding-block: 8px; }
.sort { display: inline-flex; align-items: center; gap: 4px; padding: 4px 6px; margin: 0 -6px; border: 0; background: transparent; border-radius: 6px; color: var(--muted); font-size: 12px; cursor: pointer; }
.sort svg { opacity: .45; }
.sort:hover { color: var(--fg); background: var(--sub); }
.sort.on { color: var(--fg); font-weight: 500; }
.sort.on svg { opacity: 1; }
td.name { font-weight: 500; }
.avatar { width: 24px; height: 24px; border-radius: 99px; display: inline-grid; place-items: center; color: #FFFFFF; font-size: 10px; font-weight: 600; letter-spacing: .02em; vertical-align: middle; box-shadow: 0 0 0 1px var(--line); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.cap { color: var(--muted); }

/* Product view */
.meta { display: flex; gap: 6px 18px; flex-wrap: wrap; color: var(--muted); font-size: 13px; margin-top: 6px; }
.meta b { font-weight: 400; color: var(--fg); }
.meta a { text-decoration: none; color: var(--fg); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); border: 1px solid var(--line); border-radius: 12px; background: var(--panel); }
.stat { padding: 16px 20px; display: flex; flex-direction: column; gap: 4px; }
.stat + .stat { border-left: 1px solid var(--line); }
.stat span:first-child { font-size: 13px; color: var(--muted); }
.stat strong { font-size: 22px; font-weight: 500; letter-spacing: -.02em; }

.session { min-width: 0; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); overflow: hidden; }
.panel-head { display: flex; align-items: center; gap: 10px; padding: 12px 18px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.live-dot { width: 7px; height: 7px; border-radius: 99px; background: var(--live); box-shadow: 0 0 0 4px var(--live-ring); }
@media (prefers-reduced-motion: no-preference) { .live-dot { animation: pulse 2s ease-in-out infinite; } }
@keyframes pulse { 50% { box-shadow: 0 0 0 7px transparent; } }
.feed { display: flex; flex-direction: column; padding: 10px 0; }
.entry { display: grid; grid-template-columns: 52px minmax(0, 1fr); gap: 14px; padding: 9px 18px; }
.entry time { font-family: var(--mono); font-size: 12px; color: var(--muted); padding-top: 2px; }
.entry p { margin: 0; line-height: 1.6; max-width: 76ch; }
.tool { border: 1px solid var(--line); border-radius: 9px; background: var(--bg); overflow: hidden; }
.tool-line { display: flex; align-items: center; gap: 10px; padding: 7px 12px; font-family: var(--mono); font-size: 12.5px; min-width: 0; }
.tool-line .cmd { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.tag { padding: 0 7px; border-radius: 5px; border: 1px solid var(--line); background: var(--panel); font-size: 11px; font-weight: 500; }
.tool-out { padding: 7px 12px; border-top: 1px solid var(--line); font-family: var(--mono); font-size: 12px; color: var(--muted); white-space: pre-wrap; }
.typing { color: var(--muted); }
.composer { padding: 12px; border-top: 1px solid var(--line); }
.composer label { display: flex; align-items: center; gap: 10px; padding: 5px 5px 5px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); }
.composer input { all: unset; flex: 1; min-width: 0; color: var(--fg); }
.send { width: 30px; height: 30px; border-radius: 7px; border: 0; background: var(--fg); color: var(--bg); display: grid; place-items: center; cursor: pointer; }

/* Details dialog */
dialog { border: 1px solid var(--line); border-radius: 14px; background: var(--panel); color: var(--fg); padding: 0; width: min(440px, calc(100vw - 32px)); box-shadow: 0 20px 50px rgba(0,0,0,.18); }
dialog::backdrop { background: rgba(9,9,11,.45); }
.dlg-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.dlg-head h2 { font-size: 15px; font-weight: 500; }
.dlg-body { padding: 4px 18px 8px; }
.kv { display: flex; justify-content: space-between; gap: 16px; padding: 11px 0; font-size: 13px; }
.kv + .kv { border-top: 1px solid var(--line); }
.kv span:last-child { text-align: right; overflow-wrap: anywhere; }
.x { width: 28px; height: 28px; border: 0; background: transparent; color: var(--muted); border-radius: 6px; cursor: pointer; display: inline-grid; place-items: center; }
.x:hover { background: var(--sub); color: var(--fg); }

/* Spawn view */
.form { max-width: 720px; display: flex; flex-direction: column; gap: 28px; }
.field { display: flex; flex-direction: column; gap: 10px; }
.label { font-weight: 500; }
.hint { color: var(--muted); font-size: 13px; margin: 0; }
.seg { display: inline-flex; padding: 3px; gap: 2px; border-radius: 9px; background: var(--sub); border: 1px solid var(--line); align-self: flex-start; }
.seg button { border: 0; background: transparent; padding: 6px 14px; border-radius: 6px; color: var(--muted); cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--panel); color: var(--fg); font-weight: 500; box-shadow: 0 1px 2px var(--shadow); }
.input, textarea.input, select.input { width: 100%; border: 1px solid var(--line); border-radius: 9px; background: var(--panel); padding: 9px 12px; }
.input:focus { outline: none; border-color: var(--fg); box-shadow: 0 0 0 3px var(--focus); }
textarea.input { resize: vertical; min-height: 120px; line-height: 1.55; }
textarea.prompt { font-family: var(--mono); font-size: 12.5px; min-height: 300px; }
.inline { display: flex; gap: 12px; flex-wrap: wrap; }
.inline > * { flex: 1 1 180px; }

.settings { border: 1px solid var(--line); border-radius: 12px; background: var(--panel); }
details + details { border-top: 1px solid var(--line); }
summary { list-style: none; display: flex; align-items: center; gap: 10px; padding: 14px 18px; cursor: pointer; font-weight: 500; }
summary::-webkit-details-marker { display: none; }
summary .chev { transition: transform .15s; color: var(--muted); flex-shrink: 0; }
details[open] summary .chev { transform: rotate(90deg); }
summary .state { margin-left: auto; color: var(--muted); font-size: 13px; font-weight: 400; text-align: right; }
summary .state.changed { color: var(--fg); }
.sec { padding: 0 18px 20px 42px; display: flex; flex-direction: column; gap: 14px; }

.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 10px 0; }
.switch-row + .switch-row { border-top: 1px solid var(--line); }
.switch-row small { display: block; color: var(--muted); font-size: 13px; }
.switch { position: relative; width: 36px; height: 20px; flex-shrink: 0; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.switch span { position: absolute; inset: 0; border-radius: 99px; background: var(--line-strong); transition: background .15s; pointer-events: none; }
.switch span::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 99px; background: var(--panel); transition: transform .15s; }
.switch input:checked + span { background: var(--fg); }
.switch input:checked + span::after { transform: translateX(16px); background: var(--bg); }
.switch input:focus-visible + span { outline: 2px solid var(--fg); outline-offset: 2px; }

.env-box { border: 1px solid var(--line); border-radius: 9px; overflow-x: auto; }
.env { width: 100%; min-width: 520px; border-collapse: collapse; }
.env td { padding: 7px 12px; border-top: 1px solid var(--line); font-size: 13px; white-space: nowrap; }
.env tr:first-child td { border-top: 0; }
.env td:first-child { font-family: var(--mono); font-size: 12.5px; }
.env td:last-child { width: 36px; text-align: right; }
.env input { width: 100%; border: 0; background: transparent; padding: 2px 0; font-family: var(--mono); font-size: 12.5px; }
.env input:focus { outline: none; box-shadow: 0 1px 0 var(--fg); }
.pill { display: inline-block; font-size: 11px; padding: 0 7px; border-radius: 99px; border: 1px solid var(--line); color: var(--muted); }
.submit-row { display: flex; align-items: center; justify-content: flex-end; gap: 12px; flex-wrap: wrap; }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.form.locked .field, .form.locked .settings { opacity: .5; pointer-events: none; }

/* Spawn gate */
.notice { max-width: 720px; display: flex; align-items: center; gap: 14px; padding: 14px 16px; border: 1px solid var(--line-strong); border-radius: 12px; background: var(--panel); flex-wrap: wrap; }
.notice > svg { flex-shrink: 0; color: var(--muted); }
.notice-text { flex: 1 1 280px; display: flex; flex-direction: column; gap: 2px; }
.notice-text span { color: var(--muted); font-size: 13px; }

/* Connections */
.conn { max-width: 720px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); }
.conn-head { display: flex; align-items: center; gap: 14px; padding: 16px 18px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.conn-logo { width: 36px; height: 36px; border-radius: 9px; border: 1px solid var(--line); background: var(--sub); display: grid; place-items: center; }
.conn-title { flex: 1 1 200px; display: flex; flex-direction: column; }
.conn-title h2 { font-size: 15px; font-weight: 500; }
.conn-title .muted { font-size: 13px; }
.status { display: inline-flex; align-items: center; gap: 7px; height: 24px; padding: 0 10px; border-radius: 99px; border: 1px solid var(--line); font-size: 12px; font-weight: 500; color: var(--muted); }
.status-dot, .conn-dot { width: 6px; height: 6px; border-radius: 99px; background: var(--line-strong); }
.status.on { color: var(--fg); }
.status.on .status-dot, .conn-dot.on { background: var(--live); box-shadow: 0 0 0 3px var(--live-ring); }
.side-nav .conn-dot { margin-left: auto; }
.conn-body { padding: 6px 18px 18px; }
.steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.steps li { display: flex; gap: 14px; padding: 14px 0; }
.steps li + li { border-top: 1px solid var(--line); }
.step-n { width: 22px; height: 22px; flex-shrink: 0; border-radius: 99px; border: 1px solid var(--line-strong); display: grid; place-items: center; font-size: 12px; font-family: var(--mono); color: var(--muted); }
.step-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.cmd-box { display: flex; align-items: center; gap: 10px; padding: 6px 6px 6px 14px; border: 1px solid var(--line); border-radius: 9px; background: var(--bg); }
.cmd-box code { flex: 1; font-family: var(--mono); font-size: 13px; }
.btn.copy { height: 28px; padding: 0 10px; font-size: 13px; }
.token-row { display: flex; gap: 8px; flex-wrap: wrap; }
.token-row .input { flex: 1 1 260px; }
.conn-actions { display: flex; gap: 8px; padding-top: 14px; }

/* Phone: sidebar becomes a top strip, still always visible. */
@media (max-width: 760px) {
  .app { flex-direction: column; }
  .sidebar { width: auto; height: auto; position: static; flex-direction: row; align-items: center; gap: 12px; border-right: 0; border-bottom: 1px solid var(--line);
    padding-block: 0; padding-right: max(16px, env(safe-area-inset-right, 0px)); padding-left: max(16px, env(safe-area-inset-left, 0px)); }
  .brand { padding: 0; }
  .side-label { display: none; }
  .side-nav { flex-direction: row; margin-left: auto; }
  .account { margin-top: 0; }
  .account-name, .account-chev { display: none; }
  .account-btn { padding: 4px; }
  .menu { left: auto; right: 0; width: 240px; bottom: auto; top: calc(100% + 6px); }
  .top-inner, .content { padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
  .stat + .stat { border-left: 0; border-top: 1px solid var(--line); }
  .sec { padding-left: 18px; }
}

/* App additions (beyond the mockup) */
html, body { margin: 0; }
.gate { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.gate-card { width: min(360px, 100%); border: 1px solid var(--line); border-radius: 14px; background: var(--panel); padding: 28px; display: flex; flex-direction: column; align-items: flex-start; gap: 12px; }
.gate-card h1 { font-size: 20px; font-weight: 600; letter-spacing: -.02em; }
.gate-card p { margin: 0; color: var(--muted); }
.gate-card .mark svg { fill: var(--bg); }
.empty { margin: 0; padding: 28px 18px; text-align: center; color: var(--muted); }
.form-error { margin: 0; color: var(--bad); font-size: 13px; }
.composer .form-error { padding: 8px 4px 0; }
.live-dot.off { background: var(--line-strong); box-shadow: none; animation: none; }
.entry.user p { padding: 8px 12px; border-radius: 9px; background: var(--sub); }
.entry .tool-out.err { color: var(--bad); }
.feed-note { padding: 18px; color: var(--muted); }
.feed { max-height: 70vh; overflow-y: auto; }
.avatar.none { background: var(--sub); color: var(--muted); box-shadow: 0 0 0 1px var(--line); }
td.name .unnamed { font-weight: 400; color: var(--muted); }
td.domain { max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
.spinner.sm { width: 14px; height: 14px; flex-shrink: 0; border-color: color-mix(in srgb, currentColor 28%, transparent); border-top-color: currentColor; }
.btn[aria-busy="true"], .send[aria-busy="true"], .menu-item[aria-busy="true"] { cursor: progress; }
.btn[aria-busy="true"]:disabled { opacity: .75; }
.send:disabled { cursor: not-allowed; opacity: .75; }
.loading { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 28px 18px; color: var(--muted); }
.gate-card .loading { justify-content: flex-start; padding: 0; }
.muted-title { color: var(--muted); font-weight: 500; }
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; }
td.actions { width: 1%; padding-top: 0; padding-bottom: 0; }
/* The ⋯ column stays at the table's right edge while the rest scrolls sideways. */
#sort-head th:last-child, td.actions { position: sticky; right: 0; background: var(--panel); box-shadow: -1px 0 0 var(--line); }
tbody tr:hover td.actions { background: var(--sub); }
.row-menu-btn { width: 30px; height: 30px; display: grid; place-items: center; border: 0; border-radius: 7px; background: transparent; color: var(--muted); cursor: pointer; }
.row-menu-btn:hover, .row-menu-btn[aria-expanded="true"] { background: var(--sub); color: var(--fg); }
.menu.row-menu { position: fixed; left: auto; right: auto; bottom: auto; width: 160px; }
.menu-item.danger, .menu-item.danger svg { color: var(--bad); }
.btn.danger { background: var(--bad); border-color: var(--bad); color: #FFFFFF; }
.btn.danger:hover { opacity: .9; }
.confirm-body { padding: 14px 18px 4px; display: flex; flex-direction: column; gap: 10px; }
.confirm-body p { margin: 0; }
.confirm-body ul { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 4px; }
.dlg-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 18px; }
