:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --sunken: #f3f4f6;
  --border: #e4e6eb;
  --border-strong: #d1d5db;
  --text: #111827;
  --muted: #667085;
  --dim: #98a2b3;
  --accent: #4f46e5;
  --accent-hover: #4338ca;
  --accent-soft: #eef2ff;
  --danger: #dc2626;
  --danger-soft: #fef2f2;
  --ok: #059669;
  --claude: #d97757;
  --radius: 8px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow-lg: 0 20px 48px -12px rgba(16, 24, 40, .25), 0 0 0 1px rgba(16, 24, 40, .05);
  --topbar: 56px;
  --sidebar: 248px;
  --assist: 380px;
  --run-bar: 60px;
  --font: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; font: 14px/1.5 var(--font); color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 22px; font-weight: 650; letter-spacing: -.015em; line-height: 1.25; }
h2 { font-size: 16px; font-weight: 600; }
h3 { font-size: 15px; font-weight: 600; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
code, .mono { font-family: var(--mono); font-size: 12.5px; }
code { background: var(--sunken); padding: 1px 6px; border-radius: 5px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.muted { color: var(--muted); }
.dim { color: var(--dim); }
.small { font-size: 12.5px; }
.center { text-align: center; }
.grow { flex: 1; }
.icon { display: inline-flex; flex: none; }
.row { display: flex; align-items: center; gap: 10px; }
.row.tight { gap: 6px; }
.mt { margin-top: 8px; }

/* ---- Shell ---- */
.shell { display: grid; height: 100vh; height: 100dvh; grid-template-columns: var(--sidebar) minmax(0, 1fr) 0; grid-template-rows: var(--topbar) minmax(0, 1fr); grid-template-areas: "top top top" "side main assist"; overflow: hidden; transition: grid-template-columns .22s ease; }
.shell.collapsed { grid-template-columns: 60px minmax(0, 1fr) 0; }
.shell.assist-open { grid-template-columns: var(--sidebar) minmax(0, 1fr) var(--assist); }
.shell.collapsed.assist-open { grid-template-columns: 60px minmax(0, 1fr) var(--assist); }

.topbar { grid-area: top; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 0 16px 0 12px; background: var(--surface); border-bottom: 1px solid var(--border); z-index: 20; }
.top-left, .top-right { display: flex; align-items: center; gap: 10px; flex: none; }
.brand { display: flex; align-items: center; gap: 9px; padding: 4px 6px; border-radius: 6px; }
.brand-mark { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; background: var(--accent); color: #fff; }
.brand-name { font-weight: 700; font-size: 16px; letter-spacing: -.02em; }
.env { font-size: 12px; color: var(--muted); border: 1px solid var(--border); border-radius: 999px; padding: 1px 9px; }
.ask { display: flex; align-items: center; gap: 9px; flex: 0 1 520px; min-width: 0; height: 36px; padding: 0 8px 0 12px; border: 1px solid var(--border); border-radius: 9px; background: var(--bg); color: var(--muted); cursor: pointer; text-align: left; transition: border-color .15s, background .15s; }
.ask:hover { border-color: var(--border-strong); background: var(--surface); }
.ask .icon { color: var(--accent); }
.ask span:nth-child(2) { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
kbd { font: 11px var(--font); color: var(--muted); border: 1px solid var(--border); background: var(--surface); border-radius: 5px; padding: 1px 6px; }
.avatar { border: 0; cursor: pointer; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: #1f2937; color: #fff; font-size: 11.5px; font-weight: 600; }
.account { position: relative; }
.menu { position: absolute; right: 0; top: 38px; z-index: 40; min-width: 220px; padding: 6px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow-lg); }
.menu-who { display: flex; flex-direction: column; padding: 8px 10px 10px; margin-bottom: 4px; border-bottom: 1px solid var(--border); font-size: 13px; }
.menu-item { display: flex; align-items: center; gap: 9px; width: 100%; height: 34px; padding: 0 10px; border: 0; border-radius: 7px; background: none; cursor: pointer; text-align: left; }
.menu-item:hover { background: var(--sunken); }
.menu-item kbd { margin-left: auto; }
.menu-item.danger { color: var(--danger); margin-top: 4px; border-top: 1px solid var(--border); border-radius: 0 0 7px 7px; }
.menu-item.danger:hover { background: var(--danger-soft); }
.assist-open .assist-toggle { background: var(--accent-soft); border-color: #c7d2fe; color: var(--accent); }

.sidebar { grid-area: side; display: flex; flex-direction: column; gap: 14px; padding: 12px 10px; background: var(--surface); border-right: 1px solid var(--border); overflow: hidden auto; }
.nav-group { display: flex; flex-direction: column; gap: 2px; }
.nav-heading { font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--dim); padding: 0 10px 4px; white-space: nowrap; }
.nav-item { display: flex; align-items: center; gap: 10px; height: 34px; padding: 0 10px; border: 0; border-radius: 7px; background: none; color: #374151; font-weight: 500; cursor: pointer; white-space: nowrap; text-align: left; width: 100%; }
.nav-item .icon { color: var(--muted); }
.nav-item:hover { background: var(--sunken); }
.nav-item.active { background: var(--accent-soft); color: var(--accent); }
.nav-item.active .icon { color: var(--accent); }
.nav-label { flex: 1; overflow: hidden; text-overflow: ellipsis; }
.nav-count { font-size: 11.5px; color: var(--muted); background: var(--sunken); border-radius: 999px; padding: 0 7px; line-height: 18px; }
.nav-item.active .nav-count { background: #e0e7ff; color: var(--accent); }
.nav-empty { font-size: 12.5px; color: var(--dim); padding: 4px 10px; }
.nav-item.collapse { color: var(--muted); font-weight: 400; }
.collapsed .nav-label, .collapsed .nav-count, .collapsed .nav-heading, .collapsed .nav-empty { display: none; }
.collapsed .nav-item { justify-content: center; padding: 0; }
.collapsed .nav-group + .nav-group { border-top: 1px solid var(--border); padding-top: 12px; }

#main { grid-area: main; overflow: auto; outline: none; }
.view { max-width: 1120px; margin: 0 auto; padding: 28px 32px 64px; animation: rise .18s ease; }
@keyframes rise { from { opacity: 0; transform: translateY(4px); } }

/* ---- Common pieces ---- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head p { margin-top: 4px; max-width: 640px; }
.crumbs { display: flex; align-items: center; gap: 4px; color: var(--muted); font-size: 13px; margin-bottom: 6px; }
.crumbs a:hover { color: var(--text); }
.title-with-icon { display: flex; align-items: center; gap: 14px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 36px; padding: 0 14px; border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--surface); font-weight: 550; cursor: pointer; white-space: nowrap; box-shadow: var(--shadow-sm); transition: background .12s, border-color .12s, transform .08s; }
.btn:hover { background: #f9fafb; }
.btn:active, .ghost-press.btn { transform: scale(.97); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-hover); }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.danger-ghost { border-color: transparent; box-shadow: none; background: none; color: var(--danger); }
.btn.danger-ghost:hover { background: var(--danger-soft); }
.btn.subtle { border-style: dashed; box-shadow: none; color: var(--muted); align-self: flex-start; }
.btn.small { height: 30px; padding: 0 10px; font-size: 13px; }
.btn.quiet { box-shadow: none; color: var(--muted); }
.btn:disabled, .btn[aria-disabled] { opacity: .5; pointer-events: none; }
.icon-btn { display: inline-grid; place-items: center; width: 32px; height: 32px; border: 0; border-radius: 7px; background: none; color: var(--muted); cursor: pointer; }
.icon-btn:hover { background: var(--sunken); color: var(--text); }
.icon-btn:disabled { opacity: .35; pointer-events: none; }
.ghost-press { box-shadow: 0 0 0 3px rgba(217, 119, 87, .35) !important; }
.ghost-set { animation: set .5s ease; }
@keyframes set { 30% { box-shadow: 0 0 0 3px rgba(217, 119, 87, .4); } }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 20px; box-shadow: var(--shadow-sm); }
.card.flush { padding: 0; overflow: hidden; }
.card-head { display: flex; align-items: center; gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--border); background: #fafbfc; }
.card-head .muted { margin-left: auto; font-size: 12.5px; }
form.card { display: flex; flex-direction: column; gap: 16px; }
.section-title { font-size: 12px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
.section-title.big { margin: 28px 0 12px; }
.form-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 16px; border-top: 1px solid var(--border); }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field-label { font-size: 13px; font-weight: 550; }
.field-hint { font-size: 12.5px; color: var(--muted); }
input:not([type=checkbox]), select, textarea { width: 100%; height: 36px; padding: 0 11px; border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--surface); transition: border-color .12s, box-shadow .12s; }
textarea { height: auto; padding: 8px 11px; resize: vertical; line-height: 1.45; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(79, 70, 229, .16); }
input::placeholder, textarea::placeholder { color: var(--dim); }
select:disabled { background: var(--sunken); color: var(--muted); }
input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--accent); margin: 0; flex: none; }
.check { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; color: var(--muted); white-space: nowrap; }
.input-group { display: flex; align-items: center; gap: 8px; }
.input-group .prefix { color: var(--muted); flex: none; }

.empty { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 56px 24px; text-align: center; background: var(--surface); border: 1px dashed var(--border-strong); border-radius: 12px; }
.empty > .icon { color: var(--dim); margin-bottom: 4px; }
.empty p { max-width: 440px; }
.empty .btn { margin-top: 8px; }

/* ---- Data grid ---- */
.scroll-x { overflow-x: auto; }
table.grid { width: 100%; border-collapse: collapse; }
.grid th { text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); padding: 10px 16px; background: #fafbfc; border-bottom: 1px solid var(--border); white-space: nowrap; }
.grid td { padding: 11px 16px; border-bottom: 1px solid #eef0f3; vertical-align: middle; max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.grid tr:last-child td { border-bottom: 0; }
.grid tbody tr:hover { background: #fafbfc; }
.grid.clickable tbody tr { cursor: pointer; }
.grid .num { text-align: right; font-variant-numeric: tabular-nums; }
.grid td.strong { font-weight: 550; }
.grid .actions { width: 1%; text-align: right; white-space: nowrap; padding: 4px 10px; }
.grid td.actions .icon-btn { opacity: .55; }
.grid tr:hover td.actions .icon-btn, .grid tr:focus td.actions .icon-btn, .grid td.actions .icon-btn:focus-visible { opacity: 1; }
/* The row picked with j / k. */
.grid tbody tr:focus { outline: none; background: var(--accent-soft); }
.grid tbody tr:focus td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
.grid th.sortable { padding: 0; }
.grid th.sortable button { all: unset; display: flex; gap: 5px; width: 100%; box-sizing: border-box; padding: 10px 16px; cursor: pointer; }
.grid th.sortable.num button { justify-content: flex-end; }
.grid th.sortable button:hover { color: var(--text); }
.grid th.sortable button:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.arrow { color: var(--accent); }
.grid-foot { padding: 10px 16px; border-top: 1px solid var(--border); font-size: 12.5px; }
.cell-title { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.cell-title .icon { color: var(--accent); }
.cell-title + .mono { margin-left: 24px; }
.chips { display: flex; flex-wrap: wrap; gap: 5px; }
.chip { font-size: 12px; background: var(--sunken); border-radius: 5px; padding: 1px 7px; color: #374151; }
.chip.more { color: var(--muted); }
.pill { display: inline-block; font-size: 12px; font-weight: 550; line-height: 20px; padding: 0 9px; border-radius: 999px; background: hsl(var(--hue, 220) 80% 95%); color: hsl(var(--hue, 220) 55% 32%); }
.pill.yes { background: #ecfdf5; color: #047857; }
.pill.no { background: var(--sunken); color: var(--muted); }
.pill.bad { background: var(--danger-soft); color: #b91c1c; }
.pill.custom { margin-left: 8px; background: #f5f3ff; color: #6d28d9; }
.check-row.plain { border: 1px solid var(--border); border-radius: 8px; margin-top: 12px; align-items: flex-start; }
.check-row.plain input { margin-top: 3px; }
.also-tables { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; padding: 8px 12px 0 36px; font-size: 13.5px; }
.button-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 8px; }
.button-row > input, .button-row > select { width: auto; flex: 1 1 150px; }
.check-inline { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
textarea.code { line-height: 1.5; tab-size: 2; white-space: pre; overflow-x: auto; }
.link { color: var(--accent); }
.link:hover { text-decoration: underline; }
.flash { animation: flash 1.8s ease; }
@keyframes flash { 0%, 35% { background: #fff4ee; box-shadow: inset 3px 0 0 var(--claude); } }

.toolbar { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; flex-wrap: wrap; }
.search { position: relative; width: 280px; max-width: 100%; }
.search .icon { position: absolute; left: 11px; top: 10px; color: var(--dim); pointer-events: none; }
.search input { padding-left: 34px; }
/* The list's view controls: group, quick filters, date range. */
.viewbar { display: flex; align-items: center; gap: 8px 18px; margin: -4px 0 14px; flex-wrap: wrap; }
.vb { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; color: var(--muted); white-space: nowrap; }
.vb select, .vb input { width: auto; height: 30px; padding: 0 8px; font-size: 13px; }
.vb select { max-width: 190px; }
.vb select.on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-hover); }
.grid tr.group-row td { padding: 0; background: #f6f7f9; border-bottom: 1px solid var(--border); max-width: none; }
.grid tbody tr.group-row:hover { background: none; }
.group-toggle { all: unset; display: flex; align-items: center; gap: 9px; width: 100%; box-sizing: border-box; padding: 8px 14px; cursor: pointer; font-weight: 600; }
.group-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.group-toggle > .icon { color: var(--muted); transform: rotate(90deg); transition: transform .12s; }
.group-row.shut .group-toggle > .icon { transform: none; }
.group-toggle .count { background: var(--surface); border: 1px solid var(--border); }
.group-sum { margin-left: 10px; font-size: 12.5px; font-weight: 400; color: var(--muted); }
.group-sum strong { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.grid tfoot td { padding: 10px 16px; border-top: 1px solid var(--border); background: #fafbfc; font-weight: 600; white-space: nowrap; }
.grid tfoot td:first-child { color: var(--muted); font-weight: 550; font-size: 12.5px; }
.pager { display: flex; align-items: center; gap: 8px; }
/* A collated page: a block per shared value, a section per table inside it. */
.cblock + .cblock { border-top: 1px solid var(--border); }
.cblock { position: relative; }
.cblock-actions { position: absolute; top: 7px; right: 12px; display: flex; gap: 6px; }
.cblock > .group-toggle { padding-right: 160px; }
td.actions .btn.small { margin-right: 4px; vertical-align: middle; }
.cblock > .group-toggle { background: #f6f7f9; padding: 10px 14px; }
.cblock:not(.shut) > .group-toggle { border-bottom: 1px solid var(--border); }
.cblock.shut .group-toggle > .icon { transform: none; }
.cblock .group-name .pill { vertical-align: 1px; }
.csection { display: grid; grid-template-columns: 170px minmax(0, 1fr); }
.csection + .csection { border-top: 1px solid #eef0f3; }
.csection-head { display: flex; align-items: flex-start; gap: 8px; padding: 10px 8px 10px 16px; font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); border-right: 1px solid #eef0f3; line-height: 20px; }
.csection-head .count { letter-spacing: 0; }
.csection-head .icon-btn { width: 22px; height: 22px; margin: -1px 0 0 auto; }
.csection-empty { padding: 10px 16px; color: var(--dim); font-size: 13px; line-height: 20px; }
.grid.sub th { background: none; padding: 8px 16px 2px; border-bottom: 0; font-size: 11.5px; font-weight: 550; color: var(--dim); }
.grid.sub td { padding: 7px 16px; }
.grid.sub { table-layout: fixed; }
.grid.sub td.strong { font-weight: inherit; }
.grid.sub .actions { width: 100px; }
.ctotals { display: flex; align-items: center; gap: 8px; background: #fafbfc; }
.rel-card { display: flex; flex-direction: column; gap: 12px; padding: 14px; border: 1px solid var(--border); border-radius: 10px; }
.rel-head { display: flex; align-items: center; gap: 10px; }
.rel-head select { flex: 1; }
.rel-match { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.chosen { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); min-height: 22px; }
.view-form { display: flex; flex-direction: column; gap: 16px; }
.sorts { display: flex; flex-direction: column; gap: 8px; }
.sorts .prefix { width: 34px; text-align: right; font-size: 13px; }
.sorts .input-group select:first-of-type { flex: 1; min-width: 0; }
.sorts .input-group select + select { width: auto; flex: none; }
.arrow sup { font-size: 9px; margin-left: 1px; }
.view-form .input-group select:first-child { flex: 1; min-width: 0; }
.view-form .input-group select + select { width: auto; flex: none; }
.row.wrap { flex-wrap: wrap; gap: 6px 18px; min-height: 36px; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 18px; }
.tab { display: flex; align-items: center; gap: 7px; padding: 9px 12px; border: 0; border-bottom: 2px solid transparent; margin-bottom: -1px; background: none; color: var(--muted); font-weight: 550; cursor: pointer; }
.tab:hover { color: var(--text); }
.tab.on { color: var(--accent); border-bottom-color: var(--accent); }
.count { font-size: 11.5px; background: var(--sunken); color: var(--muted); border-radius: 999px; padding: 0 7px; line-height: 18px; }

/* ---- Tables ---- */
.columns { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.col-row { display: grid; grid-template-columns: minmax(0, 1fr) 170px 110px 32px; gap: 12px; align-items: start; padding: 10px 12px; border-top: 1px solid var(--border); }
.col-row > .check, .col-row > .icon-btn { margin-top: 2px; height: 32px; }
.col-row.col-head { border-top: 0; background: #fafbfc; font-size: 12px; font-weight: 600; color: var(--muted); padding: 8px 12px; }

/* ---- APIs ---- */
.api-group { margin-bottom: 16px; }
.api-row { display: grid; grid-template-columns: 64px minmax(160px, 1.2fr) minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 9px 16px; border-top: 1px solid #eef0f3; }
.api-row:first-of-type { border-top: 0; }
.api-name { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.method { display: inline-block; min-width: 54px; text-align: center; font: 600 11px var(--mono); padding: 3px 6px; border-radius: 5px; letter-spacing: .02em; }
.method.get { background: #ecfdf5; color: #047857; }
.method.post { background: #eff6ff; color: #1d4ed8; }
.method.put { background: #fffbeb; color: #b45309; }
.method.delete { background: var(--danger-soft); color: #b91c1c; }
code.path { background: none; padding: 0; font-size: 13px; color: var(--text); }
.checklist { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.check-row { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-top: 1px solid var(--border); cursor: pointer; }
.check-row:first-child { border-top: 0; }
.check-row .muted { margin-left: auto; font-size: 12.5px; }
.checklist.cols { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); border: 0; gap: 8px; overflow: visible; }
.checklist.cols .check-row { border: 1px solid var(--border); border-radius: 8px; }
.try-line { display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: var(--sunken); border-radius: 8px; }
.response-head { display: flex; align-items: center; justify-content: space-between; }
pre.response { margin: 0; padding: 12px 14px; background: #0f172a; color: #e2e8f0; border-radius: 10px; font: 12.5px/1.55 var(--mono); max-height: 260px; overflow: auto; white-space: pre-wrap; word-break: break-word; }

/* ---- Pages ---- */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.tile { display: flex; flex-direction: column; gap: 12px; }
.tile.link { transition: border-color .12s, box-shadow .12s; }
.tile.link:hover { border-color: #c7d2fe; box-shadow: 0 4px 14px -4px rgba(79, 70, 229, .2); }
.tile-head { display: flex; align-items: center; gap: 12px; }
.tile-icon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; background: var(--accent-soft); color: var(--accent); flex: none; }
.tile-icon.big { width: 46px; height: 46px; border-radius: 12px; }
.tile-title { font-weight: 600; font-size: 15px; }
a.tile-title:hover { color: var(--accent); }
.tile-desc { flex: 1; font-size: 13.5px; }
.tile-foot { display: flex; align-items: center; gap: 8px; padding-top: 12px; border-top: 1px solid var(--border); }
.tile-foot .icon-btn { margin-left: auto; }
.icon-picker { display: flex; flex-wrap: wrap; gap: 6px; }
.icon-choice { display: grid; place-items: center; width: 38px; height: 38px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface); color: var(--muted); cursor: pointer; }
.icon-choice:hover { border-color: var(--border-strong); color: var(--text); }
.icon-choice.on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.notice { display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; background: #fffbeb; border: 1px solid #fde68a; border-radius: 10px; font-size: 13.5px; cursor: pointer; }
.notice input { margin-top: 3px; }

/* ---- Row form ---- */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-grid .span { grid-column: 1 / -1; }
.modal:not(.wide) .form-grid { grid-template-columns: 1fr; }
.switch { position: relative; display: inline-flex; align-items: center; gap: 9px; height: 36px; cursor: pointer; color: var(--muted); }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.track { position: relative; width: 36px; height: 20px; border-radius: 999px; background: var(--border-strong); transition: background .15s; }
.track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .2); transition: transform .15s; }
.switch input:checked + .track { background: var(--accent); }
.switch input:checked + .track::after { transform: translateX(16px); }
.switch input:focus-visible + .track { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---- Modal & toasts ---- */
.backdrop { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 24px; background: rgba(15, 23, 42, .4); animation: fade .15s ease; }
.assist-open ~ .backdrop, body:has(.assist-open) .backdrop { right: var(--assist); }
@keyframes fade { from { opacity: 0; } }
.modal { display: flex; flex-direction: column; width: 100%; max-width: 480px; max-height: calc(100vh - 48px); background: var(--surface); border-radius: 14px; box-shadow: var(--shadow-lg); animation: pop .18s cubic-bezier(.2, .9, .3, 1.1); }
.modal.wide { max-width: 680px; }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98); } }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 16px 14px 20px; border-bottom: 1px solid var(--border); }
.modal-body { display: flex; flex-direction: column; gap: 16px; padding: 20px; overflow: auto; }
.modal-body > form:not(.form-grid) { display: flex; flex-direction: column; gap: 16px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 20px; border-top: 1px solid var(--border); background: #fafbfc; border-radius: 0 0 14px 14px; }
.keys { display: grid; grid-template-columns: 132px minmax(0, 1fr); gap: 8px 18px; align-items: center; }
.keys-combo { display: flex; align-items: center; gap: 5px; font-size: 12px; }
.keys + .section-title { margin-top: 6px; }
#toasts { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 80; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; }
.toast { display: flex; align-items: center; gap: 9px; max-width: 520px; padding: 10px 14px; border-radius: 10px; background: #111827; color: #fff; box-shadow: var(--shadow-lg); animation: pop .2s ease; transition: opacity .25s, transform .25s; }
.toast .icon { color: #6ee7b7; }
.toast.error .icon { color: #fca5a5; }
.toast.out { opacity: 0; transform: translateY(6px); }

/* ---- Home ---- */
.hero { padding: 28px 0 8px; max-width: 720px; margin: 0 auto 28px; text-align: center; }
.hero h1 { font-size: 28px; }
.hero > p { margin: 8px auto 20px; max-width: 540px; }
.hero-box { display: flex; align-items: flex-end; gap: 10px; padding: 10px; background: var(--surface); border: 1px solid var(--border-strong); border-radius: 14px; box-shadow: 0 6px 20px -8px rgba(16, 24, 40, .15); text-align: left; }
.hero-box:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(79, 70, 229, .16); }
.hero-box textarea { border: 0; box-shadow: none !important; resize: none; font-size: 15px; padding: 6px 8px; }
.suggestions { display: flex; flex-direction: column; gap: 8px; }
.suggestions.inline { flex-direction: row; flex-wrap: wrap; justify-content: center; margin-top: 14px; }
.suggestion { padding: 7px 12px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); color: #374151; font-size: 13px; cursor: pointer; text-align: left; transition: border-color .12s, color .12s; }
.suggestion:hover { border-color: #c7d2fe; color: var(--accent); }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.stat { display: flex; align-items: center; gap: 14px; padding: 16px 18px; transition: border-color .12s; }
.stat:hover { border-color: #c7d2fe; }
.stat-icon { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 10px; background: var(--accent-soft); color: var(--accent); }
.stat-value { font-size: 22px; font-weight: 650; line-height: 1.1; }
.stat-label { color: var(--muted); font-size: 13px; }
.stat-hint { margin-left: auto; font-size: 12.5px; white-space: nowrap; }

/* ---- Assistant ---- */
aside.assistant { grid-area: assist; display: flex; flex-direction: column; min-width: 0; width: var(--assist); background: var(--surface); border-left: 1px solid var(--border); overflow: hidden; visibility: hidden; }
.assist-open aside.assistant { visibility: visible; }
.assist-head { display: flex; align-items: center; justify-content: space-between; height: 48px; padding: 0 10px 0 16px; border-bottom: 1px solid var(--border); flex: none; }
.assist-head > .row:first-child .icon { color: var(--claude); }
select.speed, select.pointer { width: auto; height: 28px; padding: 0 6px; font-size: 12.5px; color: var(--muted); border-color: var(--border); }
.assist-name { min-width: 0; flex: 1; margin-right: 8px; }
.assist-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.busy .when-idle { opacity: .35; pointer-events: none; }
.assist-threads { display: none; flex: 1; overflow: auto; padding: 12px; flex-direction: column; gap: 4px; }
.browsing .assist-threads { display: flex; }
.browsing .assist-log, .browsing .composer, .browsing .assist-foot { display: none; }
.threads-head { display: flex; align-items: center; justify-content: space-between; padding: 4px 4px 8px; }
.threads-empty { padding: 32px 12px; text-align: center; }
.thread { display: flex; align-items: center; gap: 4px; border-radius: 9px; padding-right: 4px; flex: none; }
.thread:hover { background: var(--sunken); }
.thread.current { background: var(--accent-soft); }
.thread-open { all: unset; box-sizing: border-box; flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; padding: 9px 10px; cursor: pointer; border-radius: 9px; }
.thread-open:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.thread-title { font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.thread-meta { font-size: 12px; color: var(--muted); }
.thread .icon-btn { opacity: 0; flex: none; }
.thread:hover .icon-btn, .thread .icon-btn:focus-visible { opacity: 1; }
@media (hover: none) { .thread .icon-btn { opacity: .6; } }
.assist-log { flex: 1; overflow: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
/* Bubbles keep their full height; the log scrolls instead of squeezing them. */
.assist-log > * { flex: none; }
.assist-intro { margin: auto 0; display: flex; flex-direction: column; gap: 8px; }
.assist-mark { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; background: #fdf1ec; color: var(--claude); margin-bottom: 6px; }
.assist-intro .suggestions { margin-top: 10px; }
.assist-intro .suggestion { border-radius: 10px; padding: 9px 12px; }
.msg { max-width: 92%; padding: 9px 13px; border-radius: 14px; white-space: pre-wrap; overflow-wrap: anywhere; animation: rise .18s ease; }
.msg.user { align-self: flex-end; background: var(--accent); color: #fff; border-bottom-right-radius: 4px; }
.msg.assistant { align-self: flex-start; background: var(--sunken); border-bottom-left-radius: 4px; }
.msg.error { background: var(--danger-soft); color: #991b1b; }
.msg.dim { color: var(--muted); }
.thinking { display: flex; align-items: center; gap: 9px; color: var(--muted); font-size: 13px; padding: 4px 2px; }
.dots { display: inline-flex; gap: 3px; }
.dots i { width: 5px; height: 5px; border-radius: 50%; background: var(--claude); animation: bounce 1.1s infinite ease-in-out; }
.dots i:nth-child(2) { animation-delay: .15s; }
.dots i:nth-child(3) { animation-delay: .3s; }
@keyframes bounce { 0%, 60%, 100% { transform: none; opacity: .4; } 30% { transform: translateY(-4px); opacity: 1; } }
.step { display: flex; gap: 10px; padding: 9px 11px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); animation: rise .18s ease; }
.step.doing { border-color: #f3c9b9; background: #fffaf7; }
.step-state { flex: none; width: 16px; height: 16px; margin-top: 2px; border-radius: 50%; border: 2px solid var(--border-strong); }
.step.doing .step-state { border-color: #f3c9b9; border-top-color: var(--claude); animation: spin .7s linear infinite; }
.step.done .step-state { border: 0; background: var(--ok) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E") center / 10px no-repeat; }
.step.failed .step-state { border: 0; background: var(--danger) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.5' stroke-linecap='round'%3E%3Cpath d='M18 6 6 18M6 6l12 12'/%3E%3C/svg%3E") center / 9px no-repeat; }
@keyframes spin { to { transform: rotate(360deg); } }
.step-title { font-weight: 550; font-size: 13.5px; }
.step-meta { font: 11.5px var(--mono); color: var(--dim); }
.step-error { margin-top: 4px; font-size: 12.5px; color: #b91c1c; }
.composer { display: flex; align-items: flex-end; gap: 8px; margin: 0 12px; padding: 8px; border: 1px solid var(--border-strong); border-radius: 12px; flex: none; }
.composer:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(79, 70, 229, .16); }
.composer textarea { border: 0; box-shadow: none !important; resize: none; padding: 5px 6px; min-height: 30px; }
.composer textarea:disabled { background: none; }
.send { display: grid; place-items: center; flex: none; width: 32px; height: 32px; border: 0; border-radius: 8px; background: var(--accent); color: #fff; cursor: pointer; }
.send:hover { background: var(--accent-hover); }
.send.stop { background: #111827; }
.assist-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 12px 12px; font-size: 11.5px; flex: none; }
.assist-foot label { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }

/* While Claude drives, the screens are its to use. */
.ai-running #main, .ai-running .sidebar, body:has(.ai-running) .backdrop { pointer-events: none; }
body:has(.ai-running) .backdrop.ask-user { pointer-events: auto; }
.ai-running #main { box-shadow: inset 0 2px 0 var(--claude); }

/* ---- Ghost cursor ---- */
.ghost { position: fixed; left: 0; top: 0; z-index: 100; pointer-events: none; animation: fade .2s ease; transition: opacity .25s; }
/* iPad-style touch point: a translucent dot centred on what it touches. */
.ghost-dot { position: relative; display: block; width: 26px; height: 26px; margin: -13px 0 0 -13px; border-radius: 50%; background: radial-gradient(circle at 50% 35%, rgba(255, 255, 255, .92), rgba(255, 255, 255, .62)); box-shadow: 0 0 0 1px rgba(17, 24, 39, .1), 0 3px 10px rgba(17, 24, 39, .22), 0 1px 2px rgba(17, 24, 39, .12); transition: transform .14s ease, box-shadow .14s ease; }
.ghost-dot::after { content: ""; position: absolute; inset: -1px; border-radius: 50%; border: 1.5px solid rgba(17, 24, 39, .28); opacity: 0; }
.ghost.pressed .ghost-dot { transform: scale(.78); box-shadow: 0 0 0 1px rgba(17, 24, 39, .16), 0 1px 4px rgba(17, 24, 39, .25); }
.ghost.pressed .ghost-dot::after { animation: ripple .4s ease-out; }
@keyframes ripple { from { opacity: .9; transform: scale(1); } to { opacity: 0; transform: scale(2.1); } }
.ghost.arrow { color: var(--claude); margin: -3px 0 0 -5px; filter: drop-shadow(0 2px 4px rgba(0, 0, 0, .25)); }
.ghost svg { display: block; transition: transform .1s; transform-origin: 5px 3px; }
.ghost.pressed svg { transform: scale(.82); }
.ghost-tag { position: absolute; left: 16px; top: 20px; background: var(--claude); color: #fff; font: 600 11px var(--font); padding: 2px 7px; border-radius: 4px 9px 9px 9px; white-space: nowrap; }
.ghost-ring { position: absolute; left: -9px; top: -11px; width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--claude); opacity: 0; }
.ghost.pressed .ghost-ring { animation: ring .35s ease-out; }
@keyframes ring { from { opacity: .8; transform: scale(.3); } to { opacity: 0; transform: scale(1.3); } }
.ghost.leaving { opacity: 0; }

/* ---- Files ---- */
.file-field { display: flex; flex-direction: column; gap: 6px; }
.file-field input[type=file] { height: auto; padding: 6px; font-size: 13px; }
.file-preview:empty { display: none; }
.file-preview img { max-width: 100%; max-height: 160px; border-radius: 8px; border: 1px solid var(--border); }
.grid td a.thumb img { display: block; height: 36px; width: 36px; object-fit: cover; border-radius: 6px; border: 1px solid var(--border); }
.file-link { display: inline-flex; align-items: center; gap: 5px; }

/* ---- Settings, platform ---- */
.two.stack { align-items: start; }
.usage { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.usage-row { display: flex; justify-content: space-between; gap: 12px; padding: 8px 12px; border-top: 1px solid var(--border); font-size: 13.5px; }
.usage-row:first-child { border-top: 0; }
.usage-row span { color: var(--muted); }
.card > h2 + p { margin-top: 6px; }
.danger-zone { border-color: #fecaca; }
.tpl-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; }
.tpl { display: flex; align-items: center; gap: 10px; padding: 10px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); cursor: pointer; text-align: left; }
.tpl:hover { border-color: var(--border-strong); }
.tpl.on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); background: var(--accent-soft); }
.tpl .tile-icon { width: 34px; height: 34px; border-radius: 8px; flex: none; }
.tpl > div:last-child { min-width: 0; }
.tpl .tile-title, .tpl .muted { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.plat { display: grid; height: 100vh; height: 100dvh; grid-template-rows: var(--topbar) minmax(0, 1fr); }
.plat .topbar { grid-area: auto; }
.plat #main { grid-area: auto; }
.plat[hidden] { display: none; }
.hook-row { grid-template-columns: 56px minmax(0, 1fr) 0 auto; }
.hook-row code.path.small { font-size: 12px; color: var(--muted); display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gate-card .btn + .btn { margin-top: -6px; }
.gate-card p.center { margin-top: -4px; }

/* ---- Sign-in ---- */
.shell[hidden] { display: none; }
.gate { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 24px; }
.gate-card { width: 100%; max-width: 380px; padding: 28px; }
.gate-card .brand { padding: 0; }
.gate-card .btn { height: 40px; }
.gate-error { color: #b91c1c; font-size: 13.5px; }
.gate-error:empty { display: none; }
input:disabled { background: var(--sunken); color: var(--muted); }

/* ---- Role permissions ---- */
.perms { display: flex; flex-direction: column; gap: 12px; }
.perms > .section-title:not(:first-child) { margin-top: 8px; }
.perm .card-head { flex-wrap: wrap; }
.perm.closed .card-head { border-bottom: 0; }
.perm-verbs { display: flex; flex-wrap: wrap; gap: 4px 18px; margin-left: auto; }
.perm-verbs .check { color: var(--text); cursor: pointer; }
.perm-body { display: flex; flex-direction: column; gap: 16px; padding: 16px; }
.perm-line { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 12px; align-items: start; }
.perm-line > .field-label { line-height: 36px; }
.perm-rows { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.perm-rows > select { max-width: 280px; }
.cond { display: grid; grid-template-columns: minmax(0, 200px) auto minmax(0, 1fr) 32px; gap: 8px; align-items: center; width: 100%; max-width: 560px; }
.perm-fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px 16px; }
.perm-field { display: grid; grid-template-columns: minmax(0, 1fr) 124px; gap: 8px; align-items: center; font-size: 13.5px; }
.perm-field span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.perm-field select { height: 32px; }
.notice.plain { background: var(--sunken); border-color: var(--border); }
.notice + .notice { margin-top: -6px; }

/* ---- Audit log ---- */
.audit-filters select { width: auto; max-width: 100%; }
.audit { display: flex; flex-direction: column; gap: 14px; }
.audit-card .card-head { flex-wrap: wrap; }
.audit-role { color: var(--muted); font-size: 12.5px; }
.audit-lines { display: grid; grid-template-columns: max-content minmax(0, 1fr) max-content; gap: 6px 14px; padding: 14px 16px; font-size: 13.5px; }
.audit-who { font-weight: 550; text-align: right; }
.audit-who.app, .audit-text.app { color: var(--muted); }
.audit-who.assistant { color: var(--claude); }
.audit-who.app, .audit-who.app + .audit-text, .audit-who.app + .audit-text + .audit-time, .audit-who.assistant, .audit-text.assistant { margin-bottom: 8px; }
.audit-who.app + .audit-text + .audit-time { visibility: hidden; }
.audit-text { overflow-wrap: anywhere; white-space: pre-wrap; }
.audit-step { display: block; }
.audit-tag { display: inline-block; margin-left: 8px; padding: 0 7px; border-radius: 5px; background: var(--sunken); color: var(--muted); font-size: 11.5px; line-height: 18px; white-space: nowrap; vertical-align: 1px; }
.audit-result { color: var(--muted); }
.audit-mark { color: var(--ok); font-weight: 700; }
.audit-result.bad, .audit-result.bad .audit-mark { color: #b91c1c; }
.audit-time { color: var(--dim); font-size: 12px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.audit-more { align-self: center; }

/* ---- Phones and small tablets: one column, the side panel is a drawer ---- */
@media (max-width: 900px) {
  /* The shell is main only; no icon rail. The side panel slides in over it from the left. */
  .shell, .shell.collapsed, .shell.assist-open, .shell.collapsed.assist-open { grid-template-columns: 0 minmax(0, 1fr) 0; }
  #main { overflow-x: hidden; }
  .sidebar { position: fixed; top: var(--topbar); bottom: 0; left: 0; width: min(280px, 85vw); z-index: 36; border-right: 1px solid var(--border); box-shadow: var(--shadow-lg); transform: translateX(-100%); transition: transform .2s ease; visibility: hidden; }
  .shell.nav-open .sidebar { transform: none; visibility: visible; }
  .nav-scrim { position: fixed; inset: var(--topbar) 0 0 0; z-index: 35; background: rgba(15, 23, 42, .4); animation: fade .15s ease; }
  /* The drawer always shows labels, whatever the desktop collapse setting. */
  .collapsed .nav-label, .collapsed .nav-count { display: inline; }
  .collapsed .nav-heading, .collapsed .nav-empty { display: block; }
  .collapsed .nav-item { justify-content: flex-start; padding: 0 10px; }
  .collapsed .nav-group + .nav-group { border-top: 0; padding-top: 0; }
  .nav-item.collapse { display: none; }

  /* Top bar: icon-only ask button, no workspace pill or assistant button. */
  .ask span:nth-child(2), .env, .assist-toggle { display: none; }
  .ask { flex: none; width: 36px; padding: 0; justify-content: center; }
  .ask kbd { display: none; }

  /* Every screen: title first, then its actions, wrapping as needed. */
  .view { padding: 20px 16px 48px; }
  .page-head { flex-direction: column; align-items: stretch; gap: 12px; }
  .page-head > .row { flex-wrap: wrap; }
  .toolbar { gap: 10px; }
  .search { width: 100%; }
  .two, .form-grid, .stats, .csection { grid-template-columns: 1fr; }
  .csection-head { border-right: 0; padding-bottom: 0; }
  .cblock > .group-toggle { padding-right: 96px; }
  .hook-row { grid-template-columns: 56px minmax(0, 1fr); }
  .hook-row > .api-name { display: none; }
  .tiles { grid-template-columns: 1fr; }

  /* Assistant: a sheet over the page. */
  .assist-open aside.assistant { position: fixed; inset: var(--topbar) 0 0 auto; width: min(var(--assist), 100vw); z-index: 30; box-shadow: var(--shadow-lg); }
  body:has(.assist-open) .backdrop { right: 0; }
  /* While the assistant works, its sheet shrinks to one line at the bottom: the latest step
     and Stop. The page scroller keeps that strip clear, so every control the cursor goes to
     scrolls above it and a tap never lands on the panel. Forms centre in the space above. */
  .shell.assist-open.ai-running aside.assistant { top: auto; bottom: 0; left: 0; width: 100vw; height: var(--run-bar); flex-direction: row; align-items: center; gap: 8px; padding: 0 10px 0 12px; border-left: 0; border-top: 1px solid var(--border); box-shadow: 0 -8px 24px -12px rgba(16, 24, 40, .25); }
  .ai-running aside.assistant .assist-head, .ai-running aside.assistant .assist-foot, .ai-running aside.assistant .composer textarea { display: none; }
  .ai-running aside.assistant .assist-log { padding: 0; gap: 0; height: 100%; justify-content: flex-end; overflow: hidden; }
  .ai-running aside.assistant .assist-log > :not(:last-child) { display: none; }
  .ai-running aside.assistant .step { border: 0; padding: 0; background: none; align-items: center; }
  .ai-running aside.assistant .msg { max-width: 100%; padding: 0; border-radius: 0; background: none; color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .ai-running aside.assistant .step-meta, .ai-running aside.assistant .step-error { display: none; }
  .ai-running aside.assistant .step-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .ai-running aside.assistant .composer { margin: 0; padding: 0; border: 0; box-shadow: none; flex: none; }
  .shell.ai-running #main { padding-bottom: var(--run-bar); scroll-padding-bottom: calc(var(--run-bar) + 16px); }
  body:has(.assist-open.ai-running) .backdrop { bottom: var(--run-bar); }
  body:has(.assist-open.ai-running) .modal { max-height: calc(100vh - var(--run-bar) - 24px); max-height: calc(100dvh - var(--run-bar) - 24px); }
  .backdrop { padding: 12px; }
  .modal { max-height: calc(100vh - 24px); max-height: calc(100dvh - 24px); }

  /* Editors and lists. */
  .perm-line { grid-template-columns: 1fr; gap: 4px; }
  .cond { grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) 32px; }
  .col-row { grid-template-columns: minmax(0, 1fr) 120px 32px; }
  .col-row > .check, .col-row.col-head span:nth-child(3) { display: none; }
  .api-row { grid-template-columns: 64px minmax(0, 1fr); gap: 6px 12px; }
  .api-row code.path { white-space: normal; overflow-wrap: anywhere; }
  .api-name { display: none; }
  .api-row > .row.tight { grid-column: 1 / -1; justify-content: flex-end; }
  .audit-lines { grid-template-columns: minmax(0, 1fr) max-content; }
  .audit-who { grid-column: 1 / -1; text-align: left; margin-bottom: -4px !important; }
  #toasts { left: 12px; right: 12px; transform: none; }
  .toast { max-width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  .view, .msg, .step, .modal, .backdrop { animation: none; }
  .shell { transition: none; }
}
