/* hangar dashboard: black and white, Geist + Geist Mono (fonts/OFL.txt). */

@font-face {
  font-family: "Geist";
  src: url("fonts/geist.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}
@font-face {
  font-family: "Geist Mono";
  src: url("fonts/geist-mono.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

/* Dark is the default; [data-theme="light"] switches (js/app.js keeps the choice). */
:root {
  --bg: #000000;
  --panel: #0c0c0c;
  --panel-2: #151515;
  --raised: #1a1a1a;
  --fg: #fafafa;
  --muted: #a3a3a3;
  --faint: #737373;
  --card: #000000;
  --line: rgb(255 255 255 / 0.08);
  --line-strong: rgb(255 255 255 / 0.16);
  --line-hover: rgb(255 255 255 / 0.28);
  --head-bg: rgb(255 255 255 / 0.025);
  /* Brand green as on instacloud.com: emerald-300 with black text on dark,
     emerald-600 with white text on light. */
  --accent: #6ee7b7;
  --accent-hover: #8ff0c8;
  --accent-fg: #000000;
  --focus: #6ee7b7;
  --row-hover: rgb(255 255 255 / 0.035);
  --item-hover: rgb(255 255 255 / 0.08); /* a menu's highlighted row */
  --row-selected: rgb(110 231 183 / 0.07);
  --ok: #34d399;
  --idle: #737373;
  --busy: #fbbf24;
  --warn: #fbbf24;
  --bad: #f87171;
  --info: #a5b4fc;
  --danger: #f87171;
  --danger-solid: #dc2626;
  --danger-line: rgb(248 113 113 / 0.38);
  --danger-bg: rgb(248 113 113 / 0.08);
  --danger-fg: #fecaca;
  --float-bg: rgb(26 26 26 / 0.95);
  --shadow: 0 16px 40px rgb(0 0 0 / 0.65);
  --shadow-lg: 0 24px 64px rgb(0 0 0 / 0.8);
  --backdrop: rgb(0 0 0 / 0.6);
  --mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --sans: "Geist", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  /* Square corners everywhere, as on instacloud.com; circles (avatars, dots) stay round. */
  --radius: 0px;
  font-size: 15px;
  color-scheme: dark;
}

:root[data-theme="light"] {
  --bg: #f7f7f7;
  --card: #ffffff;
  --panel: #ffffff;
  --panel-2: #efefef;
  --raised: #ffffff;
  --fg: #000000;
  --muted: #525252;
  --faint: #8a8a8a;
  --line: rgb(0 0 0 / 0.08);
  --line-strong: rgb(0 0 0 / 0.14);
  --line-hover: rgb(0 0 0 / 0.24);
  --head-bg: rgb(0 0 0 / 0.025);
  --accent: #059669;
  --accent-hover: #047857;
  --accent-fg: #ffffff;
  --focus: #059669;
  --row-hover: rgb(0 0 0 / 0.025);
  --item-hover: rgb(0 0 0 / 0.05);
  --row-selected: rgb(5 150 105 / 0.06);
  --ok: #059669;
  --idle: #a3a3a3;
  --busy: #d97706;
  --warn: #d97706;
  --bad: #dc2626;
  --info: #6366f1;
  --danger: #dc2626;
  --danger-solid: #dc2626;
  --danger-line: rgb(220 38 38 / 0.3);
  --danger-bg: rgb(220 38 38 / 0.05);
  --danger-fg: #991b1b;
  --float-bg: rgb(255 255 255 / 0.96);
  --shadow: 0 12px 32px rgb(0 0 0 / 0.12);
  --shadow-lg: 0 24px 56px rgb(0 0 0 / 0.16);
  --backdrop: rgb(0 0 0 / 0.28);
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
[hidden] { display: none !important; }
body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  line-height: 1.45;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--fg); text-underline-offset: 3px; }
code { font-family: var(--mono); font-size: 0.88em; word-break: break-all; color: var(--muted); }
h1 { font-size: 2.3rem; font-weight: 500; letter-spacing: -0.02em; margin: 0; line-height: 1.15; }
h2 { font-size: 1.05rem; font-weight: 500; margin: 0 0 0.75rem; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 0; background: var(--panel); padding: 0.5rem; z-index: 50; }
.skip:focus { left: 0.5rem; }
.muted { color: var(--muted); }
.small { font-size: 0.9rem; }
.mono { font-family: var(--mono); }
.label {
  font-family: var(--mono); font-size: 0.78rem; font-weight: 400; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--muted);
}
.empty { color: var(--muted); padding: 2.5rem 1rem; text-align: center; }

/* ---------- shell: sidebar + main ---------- */
.shell { display: grid; grid-template-columns: 252px minmax(0, 1fr); min-height: 100vh; transition: grid-template-columns 0.18s ease; }
.side-collapsed .shell { grid-template-columns: 68px minmax(0, 1fr); }
.signed-out .shell { grid-template-columns: minmax(0, 1fr); }
.signed-out .side { display: none; }
.side {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column;
  border-right: 1px solid var(--line); background: var(--bg); min-width: 0; overflow: hidden;
}
.side-head {
  display: flex; align-items: center; justify-content: space-between; gap: 0.5rem;
  height: 64px; padding: 0 0.75rem 0 1.1rem; border-bottom: 1px solid var(--line); flex: none;
}
.brand { display: inline-flex; align-items: center; gap: 0.6rem; color: var(--fg); text-decoration: none; font-size: 1.3rem; font-weight: 600; letter-spacing: -0.02em; }
.brand svg { flex: none; }
.side-toggle { color: var(--muted); }
.side-top { display: flex; flex-direction: column; gap: 0.5rem; padding: 0.9rem 0.6rem 0.4rem; }
.menu-anchor { display: contents; }
.side-search {
  all: unset; box-sizing: border-box; display: flex; align-items: center; gap: 0.65rem; width: 100%;
  padding: 0.5rem 0.65rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel);
  cursor: pointer; color: var(--fg); min-height: 40px;
}
.side-search:hover { border-color: var(--line-strong); background: var(--panel-2); }
.side-search:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.side-search { color: var(--muted); }
.side-search > span { flex: 1; }
.side-search svg { color: var(--muted); }
kbd {
  font-family: var(--mono); font-size: 0.72rem; color: var(--muted); background: var(--panel-2);
  border: 1px solid var(--line); border-radius: var(--radius); padding: 0.05rem 0.35rem; white-space: nowrap;
}
#nav { display: flex; flex-direction: column; flex: 1; overflow-y: auto; padding: 0.6rem 0.6rem 1rem; }
#nav ul { list-style: none; display: flex; flex-direction: column; gap: 2px; margin: 0; padding: 0; }
#nav a {
  display: flex; align-items: center; gap: 0.75rem; padding: 0.55rem 0.65rem; border-radius: var(--radius);
  color: var(--muted); text-decoration: none; font-size: 1rem; white-space: nowrap;
}
#nav a svg { width: 18px; height: 18px; flex: none; }
#nav a:hover { color: var(--fg); background: var(--row-hover); }
#nav a[aria-current="page"] { color: var(--fg); background: var(--panel-2); }
.side-sep { border: 0; border-top: 1px solid var(--line); margin: 0.75rem 0.4rem; }
.side-foot { padding: 0.9rem 1.2rem 1.1rem; color: var(--faint); font-size: 0.85rem; }
.menu-head { padding: 0.45rem 0.6rem 0.5rem; color: var(--muted); font-size: 0.85rem; border-bottom: 1px solid var(--line); margin-bottom: 0.3rem; }
.menu-head strong { color: var(--fg); font-weight: 500; }

/* collapsed: an icon rail */
.side-collapsed .side-label { display: none; }
.side-collapsed .side-head { flex-direction: column; justify-content: center; height: auto; padding: 0.9rem 0 0.6rem; gap: 0.6rem; }
.side-collapsed .side-top { padding: 0.75rem 0.55rem 0.3rem; }
.side-collapsed .side-search { justify-content: center; padding: 0.5rem 0; }
.side-collapsed #nav { padding: 0.5rem 0.55rem; }
.side-collapsed #nav a { justify-content: center; padding: 0.6rem 0; }
.side-collapsed .side-sep { margin: 0.6rem 0.2rem; }

.avatar {
  width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: var(--panel-2); border: 1px solid var(--line); font-size: 0.8rem; text-transform: uppercase;
}

.content { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20; height: 64px; flex: none; display: flex; align-items: center;
  justify-content: space-between; gap: 1rem; padding: 0 1.5rem 0 2.25rem; border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(8px);
}
.signed-out .topbar { display: none; }
.crumbs { display: flex; align-items: center; gap: 0.5rem; color: var(--muted); font-size: 0.92rem; min-width: 0; }
.crumbs strong { color: var(--fg); font-weight: 500; }
.crumbs .slash { color: var(--faint); }
.top-actions { display: flex; align-items: center; gap: 0.35rem; }
.account-btn {
  all: unset; box-sizing: border-box; display: inline-flex; align-items: center; gap: 0.55rem; cursor: pointer;
  padding: 0.3rem 0.5rem 0.3rem 0.3rem; border-radius: var(--radius); border: 1px solid var(--line); color: var(--fg);
}
.account-btn:hover { background: var(--row-hover); border-color: var(--line-strong); }
.account-btn:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.account-btn .avatar { width: 26px; height: 26px; background: var(--accent); color: var(--accent-fg); border: 0; font-weight: 600; font-size: 0.75rem; }
.account-btn svg { color: var(--muted); }
main { padding: 2rem 2.25rem 8rem; min-width: 0; flex: 1; display: flex; flex-direction: column; }
/* Pages with a footer fill the window; the footer stays at the bottom. */
main:has(> .page-fill) { padding-bottom: 0; }
.page-fill { flex: 1; display: flex; flex-direction: column; }
.page-fill > .table-wrap { margin-bottom: 1.5rem; }
.page-foot {
  margin: auto -2.25rem 0; padding: 0.9rem 2.25rem; position: sticky; bottom: 0; z-index: 5;
  border-top: 1px solid var(--line); background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(8px);
}
body:has(.page-foot) .toasts, body:has(.page-foot) .ops { bottom: 5.25rem; }
main:focus { outline: none; }

/* page header and toolbars */
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.75rem; }
.page-head p { margin: 0.55rem 0 0; color: var(--muted); }
.toolbar { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; margin-bottom: 1rem; }
.toolbar .spacer { flex: 1; }
.filters { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; margin-bottom: 1rem; color: var(--muted); }
.search { position: relative; width: min(24rem, 100%); }
.search svg { position: absolute; left: 0.7rem; top: 50%; transform: translateY(-50%); color: var(--faint); pointer-events: none; }
.search input { width: 100%; padding-left: 2.2rem; }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem 1.25rem; margin: 0 0 1.25rem; }
.panel > h2 { font-family: var(--mono); font-size: 0.78rem; font-weight: 400; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }

/* ---------- buttons and inputs ---------- */
.btn {
  font: inherit; font-size: 0.92rem; line-height: 1.2; padding: 0.5rem 0.85rem; border-radius: var(--radius);
  border: 1px solid var(--line-strong); background: transparent; color: var(--fg); cursor: pointer;
  text-decoration: none; display: inline-flex; align-items: center; gap: 0.45rem; white-space: nowrap;
}
.btn:hover:not(:disabled) { background: var(--row-hover); border-color: var(--line-hover); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn svg { width: 16px; height: 16px; flex: none; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); font-weight: 500; }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-danger { color: var(--danger); }
.btn-danger.btn-primary, .dlg .btn-danger[type="submit"] { background: var(--danger-solid); border-color: var(--danger-solid); color: #fff; }
.btn-ghost { border-color: transparent; }
.btn-small { padding: 0.3rem 0.6rem; font-size: 0.85rem; }
.btn-lg { padding: 0.7rem 1.3rem; font-size: 1rem; }
.btn-icon { padding: 0; width: 32px; height: 32px; justify-content: center; border-color: transparent; color: var(--muted); }
.btn-icon:hover:not(:disabled) { color: var(--fg); background: var(--panel-2); border-color: transparent; }
.btn-icon.btn-outline { border-color: var(--line-strong); width: 36px; height: 36px; }
.icon-slot { display: inline-block; width: 32px; height: 32px; }

input, textarea {
  font: inherit; color: var(--fg); background: var(--panel); border: 1px solid var(--line-strong);
  border-radius: var(--radius); padding: 0.5rem 0.7rem; max-width: 100%;
}
input::placeholder, textarea::placeholder { color: var(--faint); }
input:focus-visible, textarea:focus-visible { outline: 2px solid var(--focus); outline-offset: 0; }
input[type="number"] { width: 8rem; }

/* dropdowns (ui.js dropdown): drawn like the inputs, the chevron at the right edge */
.dropdown {
  all: unset; box-sizing: border-box; display: inline-flex; align-items: center; justify-content: space-between; gap: 0.75rem;
  min-width: 9.5rem; max-width: 100%; padding: 0.5rem 0.6rem 0.5rem 0.75rem; background: var(--panel); color: var(--fg);
  border: 1px solid var(--line-strong); border-radius: var(--radius); cursor: pointer; white-space: nowrap; line-height: inherit;
}
.dropdown:hover, .dropdown[aria-expanded="true"] { border-color: var(--line-hover); }
.dropdown:focus-visible { outline: 2px solid var(--focus); outline-offset: 0; }
.dropdown-label { overflow: hidden; text-overflow: ellipsis; }
.dropdown-chev { display: inline-flex; color: var(--muted); flex: none; }
.dropdown-chev svg { width: 15px; height: 15px; }
.field .dropdown { width: 100%; }
.dropdown-list { padding: 0.3rem; max-height: 20rem; overflow-y: auto; }
.menu.dropdown-list button { gap: 0.45rem; padding: 0.45rem 0.9rem 0.45rem 0.45rem; white-space: nowrap; }
.menu.dropdown-list button:focus { background: var(--item-hover); }
.dropdown-check { display: inline-flex; justify-content: center; width: 16px; flex: none; }
.menu .dropdown-check svg { color: var(--fg); }

/* checkboxes */
input[type="checkbox"] {
  appearance: none; width: 16px; height: 16px; margin: 0; padding: 0; border-radius: var(--radius);
  border: 1px solid var(--line-strong); background: var(--panel); display: inline-grid; place-content: center;
  cursor: pointer; vertical-align: middle;
}
input[type="checkbox"]::before {
  content: ""; width: 9px; height: 9px; transform: scale(0); background: var(--accent-fg);
  clip-path: polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0%, 43% 62%);
}
input[type="checkbox"]:checked, input[type="checkbox"]:indeterminate { background: var(--accent); border-color: var(--accent); }
input[type="checkbox"]:checked::before { transform: scale(1); }
input[type="checkbox"]:indeterminate::before { transform: scale(1); clip-path: none; height: 2px; }
input[type="checkbox"]:disabled { opacity: 0.3; cursor: not-allowed; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
table.grid { border-collapse: collapse; width: 100%; font-size: 0.93rem; }
.grid th, .grid td { text-align: left; padding: 0.7rem 0.9rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
.grid thead th {
  background: var(--head-bg); font-family: var(--mono); font-weight: 400; color: var(--muted);
  font-size: 0.76rem; text-transform: uppercase; letter-spacing: 0.08em; white-space: nowrap; height: 44px;
}
.grid tbody tr { transition: background 0.1s; }
.grid tbody tr:hover { background: var(--row-hover); }
.grid tbody tr.selected { background: var(--row-selected); }
.grid tbody tr.clickable { cursor: pointer; }
.grid tbody tr:last-child td { border-bottom: 0; }
.grid td code { font-size: 0.82rem; }
.row-bad td:first-child { box-shadow: inset 2px 0 var(--bad); }
.row-warn td:first-child { box-shadow: inset 2px 0 var(--warn); }
.col-check { width: 44px; padding-right: 0 !important; }
.col-actions { white-space: nowrap; }
.grid .col-sticky { border-left: 1px solid var(--line); width: 1%; }
.sort { all: unset; cursor: pointer; display: inline-flex; align-items: center; gap: 0.35rem; }
.sort:hover { color: var(--fg); }
.sort svg { width: 13px; height: 13px; opacity: 0.55; }
.sort[aria-sort="ascending"] svg, .sort[aria-sort="descending"] svg { opacity: 1; }
.name-cell { display: flex; flex-direction: column; min-width: 0; }
.name-cell .name { font-weight: 500; color: var(--fg); background: none; border: 0; padding: 0; font: inherit; font-weight: 500; cursor: pointer; text-align: left; }
.name-cell .name:hover { text-decoration: underline; text-underline-offset: 3px; }
.spec { display: flex; gap: 0.7rem; font-size: 0.9rem; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.spec strong { color: var(--fg); font-weight: 600; }
.spec span + span { padding-left: 0.7rem; border-left: 1px solid var(--line-strong); }
.snap-name { font-weight: 500; }
.actions { display: flex; flex-wrap: nowrap; gap: 0.15rem; align-items: center; justify-content: flex-end; }
.pills { display: flex; flex-wrap: wrap; gap: 0.35rem 0.75rem; }
details summary { cursor: pointer; color: var(--muted); }

.table-foot { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.table-foot:not(.page-foot) { margin-top: 1rem; }
.table-foot .pager { display: flex; align-items: center; gap: 0.5rem; }

/* ---------- state pills: a dot and a label ---------- */
.pill { display: inline-flex; align-items: center; gap: 0.45rem; font-size: 0.9rem; white-space: nowrap; color: var(--fg); }
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--dot, var(--idle)); flex: none; }
.pill-ok { --dot: var(--ok); }
.pill-idle { --dot: var(--idle); color: var(--muted); }
.pill-busy { --dot: var(--busy); color: var(--muted); }
.pill-busy::before { animation: pulse 1.2s ease-in-out infinite; }
.pill-warn { --dot: var(--warn); }
.pill-bad { --dot: var(--bad); }
.pill-info { --dot: var(--info); }
@keyframes pulse { 50% { opacity: 0.35; } }
@media (prefers-reduced-motion: reduce) { .pill-busy::before { animation: none; } }

.tag { display: inline-block; font-family: var(--mono); font-size: 0.75rem; border: 1px solid var(--line-strong); border-radius: var(--radius); padding: 0.05rem 0.4rem; color: var(--muted); }

/* InstaVM (official) snapshots: a quiet grey tag, like a system label. */
.badge-official { display: inline-flex; align-items: center; font-size: 0.75rem; font-weight: 500; line-height: 1.55; white-space: nowrap;
  padding: 0.05rem 0.55rem; border-radius: var(--radius); color: var(--fg); background: var(--panel-2); border: 1px solid var(--line);
  vertical-align: middle; }
.with-badge { display: inline-flex; align-items: center; gap: 0.4rem; flex-wrap: wrap; }

/* ---------- key/value lists and meters ---------- */
.kv { display: grid; grid-template-columns: minmax(9rem, max-content) 1fr; margin: 0; }
.kv dt, .kv dd { padding: 0.6rem 0; border-bottom: 1px solid var(--line); margin: 0; }
.kv dt { color: var(--muted); padding-right: 1.5rem; }
.kv dd { min-width: 0; overflow-wrap: anywhere; }
.kv dt:nth-last-of-type(1), .kv dd:last-of-type { border-bottom: 0; }
.meter-row { margin-bottom: 1rem; max-width: 34rem; }
.meter-label { display: flex; justify-content: space-between; margin-bottom: 0.4rem; }
.bar { height: 6px; border-radius: var(--radius); background: var(--panel-2); overflow: hidden; }
.bar-fill { height: 100%; background: var(--accent); border-radius: inherit; }
.bar-fill.high { background: var(--warn); }
.bar-fill.full { background: var(--bad); }

/* ---------- errors, toasts, operations tray ---------- */
.errbox { border: 1px solid var(--danger-line); background: var(--danger-bg); color: var(--danger-fg); border-radius: var(--radius); padding: 0.8rem 1rem; margin: 0.5rem 0; }
.toasts { position: fixed; right: 1.25rem; bottom: 1.25rem; display: flex; flex-direction: column; gap: 0.5rem; z-index: 40; max-width: min(26rem, calc(100vw - 32px)); }
.toast {
  background: var(--raised); border: 1px solid var(--line-strong); border-radius: var(--radius);
  padding: 0.7rem 2.2rem 0.7rem 0.9rem; position: relative; box-shadow: var(--shadow);
  display: flex; gap: 0.6rem; align-items: baseline;
}
.toast::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--fg); flex: none; transform: translateY(-1px); }
.toast-ok::before { background: var(--ok); }
.toast-bad::before { background: var(--bad); }
.toast .x { position: absolute; right: 0.4rem; top: 0.3rem; background: none; border: 0; color: var(--muted); font-size: 1.1rem; cursor: pointer; }
.ops { position: fixed; left: calc(252px + 1.25rem); bottom: 1.25rem; z-index: 35; max-width: calc(100vw - 32px); }
.signed-out .ops { left: 1.25rem; }
.side-collapsed .ops { left: calc(68px + 1.25rem); }
.ops ul { list-style: none; margin: 0; padding: 0.55rem 0.8rem; background: var(--raised); border: 1px solid var(--line-strong); border-radius: var(--radius); box-shadow: var(--shadow); }
.ops li { display: flex; align-items: center; gap: 0.6rem; padding: 0.2rem 0; flex-wrap: wrap; }
.op-label { font-family: var(--mono); font-size: 0.85rem; }
.spinner { width: 0.85rem; height: 0.85rem; border: 2px solid var(--line-strong); border-top-color: var(--fg); border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation: none; } }

/* ---------- floating bulk bar ---------- */
.bulkbar {
  position: fixed; left: calc(50% + 126px); bottom: 5.5rem; transform: translateX(-50%); z-index: 30;
  display: flex; align-items: center; gap: 0.15rem; padding: 0.35rem 0.4rem 0.35rem 1rem;
  background: var(--float-bg); border: 1px solid var(--line-strong); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); backdrop-filter: blur(8px); animation: rise 0.18s ease-out;
}
.bulkbar .count { font-family: var(--mono); font-size: 0.8rem; color: var(--muted); padding-right: 0.6rem; white-space: nowrap; }
.bulkbar .sep { width: 1px; height: 20px; background: var(--line-strong); margin: 0 0.25rem; }
@keyframes rise { from { opacity: 0; transform: translate(-50%, 8px); } }
.side-collapsed .bulkbar { left: calc(50% + 34px); }

/* ---------- menus (popover) ---------- */
.menu {
  margin: 0; padding: 0.3rem; min-width: 11rem; background: var(--raised); color: var(--fg);
  border: 1px solid var(--line-strong); border-radius: var(--radius); box-shadow: var(--shadow);
  inset: auto; position: fixed;
}
.menu button {
  all: unset; display: flex; align-items: center; gap: 0.55rem; width: 100%; box-sizing: border-box;
  padding: 0.45rem 0.6rem; border-radius: var(--radius); cursor: pointer; font-size: 0.92rem;
}
.menu button:hover:not(:disabled), .menu button:focus-visible { background: var(--item-hover); }
.menu button:disabled { opacity: 0.4; cursor: not-allowed; }
.menu button.danger { color: var(--danger); }
.menu svg { width: 15px; height: 15px; color: var(--muted); }
.menu button.danger svg { color: var(--danger); }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 0.3rem 0; }

/* ---------- dialogs ---------- */
.dlg {
  border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--panel); color: var(--fg);
  padding: 1.4rem 1.5rem; width: min(32rem, calc(100vw - 32px)); box-shadow: var(--shadow-lg);
}
.dlg::backdrop, .sheet::backdrop { background: var(--backdrop); backdrop-filter: blur(3px); }
.dlg h2 { font-size: 1.15rem; margin-bottom: 0.4rem; }
.dlg > form > p.muted { margin-top: 0; }
.field { display: flex; flex-direction: column; gap: 0.35rem; margin-bottom: 0.9rem; }
.field label { font-weight: 500; font-size: 0.92rem; }
.field label code { color: var(--fg); word-break: normal; }
.field-check { flex-direction: row; align-items: center; gap: 0.55rem; }
.help { color: var(--muted); font-size: 0.9rem; }
.dlg-err { color: var(--bad); min-height: 1.2rem; margin-bottom: 0.4rem; }
.dlg-actions { display: flex; justify-content: flex-end; gap: 0.5rem; padding-top: 0.5rem; }
.names { font-family: var(--mono); font-size: 0.82rem; color: var(--muted); margin: 0 0 0.75rem; }

/* ---------- details sheet ---------- */
.sheet {
  margin: 0 0 0 auto; height: 100vh; max-height: 100vh; width: min(780px, 100vw); max-width: none;
  padding: 0; border: 0; border-left: 1px solid var(--line-strong); background: var(--panel); color: var(--fg);
  box-shadow: var(--shadow-lg);
}
.sheet[open] { animation: slide 0.22s ease-out; display: flex; flex-direction: column; }
@keyframes slide { from { transform: translateX(32px); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .sheet[open] { animation: none; } }
.sheet-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; padding: 1.5rem 1.75rem 1.25rem; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.sheet-title { display: flex; align-items: center; gap: 0.9rem; flex-wrap: wrap; }
.sheet-title h2 { font-size: 1.7rem; letter-spacing: -0.01em; margin: 0; }
.sheet-sub { font-family: var(--mono); font-size: 0.8rem; color: var(--muted); margin-top: 0.35rem; }
.sheet-actions { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.sheet-body { overflow-y: auto; padding: 1.5rem 1.75rem 3rem; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2.25rem; align-content: start; flex: 1; }
.sheet-body > div { display: flex; flex-direction: column; gap: 2.25rem; min-width: 0; }
.sheet-body section h3 { margin: 0 0 0.6rem; }
.sheet-head.tabbed { border-bottom: 0; padding-bottom: 0.75rem; }
/* The title block gives way to the actions: a long subtitle is cut short. */
.sheet-head > div:first-child { flex: 1 1 16rem; min-width: 0; }
.sheet-head .sheet-sub { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sheet-tabs { display: flex; gap: 1.5rem; padding: 0 1.75rem; border-bottom: 1px solid var(--line); overflow-x: auto; flex: none; }
.sheet-tab { all: unset; cursor: pointer; padding: 0.7rem 0.1rem; margin-bottom: -1px; color: var(--muted); font-size: 0.93rem; white-space: nowrap; border-bottom: 2px solid transparent; }
.sheet-tab:hover { color: var(--fg); }
.sheet-tab[aria-selected="true"] { color: var(--fg); font-weight: 500; border-bottom-color: var(--fg); }
.sheet-tab:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
.sheet-body.one { grid-template-columns: minmax(0, 1fr); }
/* A tab of sections, ruled off edge to edge; properties sit label left, value right. */
.sheet-body.parts { padding-top: 0.25rem; }
.sheet-body.parts > div { gap: 0; }
.part { margin: 0 -1.75rem; padding: 1.35rem 1.75rem; border-bottom: 1px solid var(--line); }
.part:last-child { border-bottom: 0; }
.sheet-body .part > h3.label { margin: 0 0 0.9rem; }
.part > p { margin: 0.75rem 0; }
.part > .btn-row { margin-top: 1rem; }
.props { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 0.85rem 2rem; align-items: center; margin: 0; }
.props dt { color: var(--muted); }
.props dd { margin: 0; min-width: 0; display: flex; justify-content: flex-end; text-align: right; }
.props .copyable { margin-right: -0.35rem; }
.props .meta-chips { justify-content: flex-end; margin-top: 0; }
.props .timeout-note { margin-top: 0; }
.danger-zone { border: 1px solid var(--danger-line); border-radius: var(--radius); padding: 1rem 1.1rem; display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.danger-zone p { margin: 0.2rem 0 0; color: var(--muted); }
.copy-row { display: flex; align-items: center; gap: 0.35rem; min-width: 0; }
.copy-row code { flex: 1; min-width: 0; color: var(--fg); background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); padding: 0.45rem 0.6rem; overflow-x: auto; white-space: nowrap; word-break: normal; }
.btn-row { display: flex; gap: 0.5rem; flex-wrap: wrap; }

/* ---------- docs ---------- */
.docs { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 2.75rem; align-items: start; }
.doc-nav { position: sticky; top: calc(64px + 1.5rem); display: flex; flex-direction: column; gap: 1px; max-height: calc(100vh - 64px - 3rem); overflow-y: auto; }
.doc-nav .label { margin: 1.1rem 0.6rem 0.4rem; }
.doc-nav .label:first-child { margin-top: 0; }
.doc-nav button {
  all: unset; box-sizing: border-box; display: flex; justify-content: space-between; align-items: center; gap: 0.5rem;
  padding: 0.42rem 0.6rem; color: var(--muted); cursor: pointer; font-size: 0.93rem;
}
.doc-nav button:hover { color: var(--fg); background: var(--row-hover); }
.doc-nav button:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
.doc-nav button:disabled { color: var(--muted); opacity: 0.45; cursor: default; background: none; }
.doc-nav .count { font-family: var(--mono); font-size: 0.74rem; color: var(--faint); }
.doc-content { min-width: 0; max-width: 1000px; }
.doc-section { scroll-margin-top: calc(64px + 1rem); padding-bottom: 2.5rem; margin-bottom: 2.5rem; border-bottom: 1px solid var(--line); }
.doc-section:last-child { border-bottom: 0; }
.doc-section h2 { font-size: 1.55rem; font-weight: 500; letter-spacing: -0.01em; margin: 0 0 1rem; }
.doc-content p, .doc-list { line-height: 1.65; max-width: 76ch; }
.doc-content p code, .doc-list code, .doc-table td > p code { color: var(--fg); background: var(--panel-2); padding: 0.05rem 0.3rem; word-break: break-word; }
.doc-list { padding-left: 1.3rem; }
.doc-list li { margin: 0.25rem 0; }
.doc-h { font-size: 1.05rem; font-weight: 500; margin: 1.6rem 0 0.6rem; }
h4.doc-h, h5.doc-h { font-size: 0.95rem; }
.doc-code { background: var(--panel); border: 1px solid var(--line); padding: 0.85rem 1rem; margin: 0.6rem 0 1rem; overflow-x: auto; font-family: var(--mono); font-size: 0.82rem; line-height: 1.65; }
.doc-code code { color: var(--fg); word-break: normal; }
.doc-search { margin: 1.25rem 0; width: min(28rem, 100%); }
.endpoint { border: 1px solid var(--line); background: var(--card); margin-bottom: 0.5rem; scroll-margin-top: calc(64px + 1rem); }
.endpoint > summary { list-style: none; display: flex; align-items: center; gap: 0.8rem; padding: 0.65rem 0.85rem; cursor: pointer; color: var(--fg); }
.endpoint > summary::-webkit-details-marker { display: none; }
.endpoint > summary:hover { background: var(--row-hover); }
.endpoint[open] > summary { border-bottom: 1px solid var(--line); }
.method {
  --m: var(--muted); font-family: var(--mono); font-size: 0.72rem; font-weight: 600; width: 4.3rem; flex: none; text-align: center;
  padding: 0.15rem 0; color: var(--m); border: 1px solid color-mix(in srgb, var(--m) 45%, transparent);
  background: color-mix(in srgb, var(--m) 10%, transparent);
}
.method-get { --m: var(--ok); }
.method-post { --m: var(--info); }
.method-put, .method-patch { --m: var(--warn); }
.method-delete { --m: var(--bad); }
.ep-path { font-family: var(--mono); font-size: 0.86rem; color: var(--fg); word-break: break-all; }
.ep-sum { color: var(--muted); font-size: 0.9rem; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ep-body { padding: 1rem 1.15rem 1.2rem; }
.ep-body > h4.label { margin: 1.2rem 0 0.5rem; }
.doc-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.doc-table th { text-align: left; font-family: var(--mono); font-weight: 400; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); padding: 0.45rem 0.6rem; border-bottom: 1px solid var(--line); }
.doc-table td { padding: 0.55rem 0.6rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.doc-table tr:last-child td { border-bottom: 0; }
.doc-table td > p { margin: 0; }
.doc-table td > p + p { margin-top: 0.4rem; }
.doc-type { font-family: var(--mono); font-size: 0.8rem; color: var(--muted); min-width: 9rem; }
.doc-req { margin-left: 0.45rem; font-family: var(--mono); font-size: 0.7rem; color: var(--warn); }
.doc-ref { all: unset; cursor: pointer; font-family: var(--mono); color: var(--accent); text-decoration: underline dotted; text-underline-offset: 3px; }
.doc-ref:focus-visible { outline: 2px solid var(--focus); }
:root[data-theme="light"] .doc-ref { color: var(--accent); }
.doc-responses { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.45rem; }
.doc-responses li { display: flex; gap: 0.65rem; align-items: baseline; flex-wrap: wrap; }
.status { font-family: var(--mono); font-size: 0.78rem; padding: 0 0.35rem; border: 1px solid var(--line-strong); color: var(--muted); }
.status-2 { color: var(--ok); }
.status-4 { color: var(--warn); }
.status-5 { color: var(--bad); }

/* ---------- command palette ---------- */
.palette {
  margin: 12vh auto auto; padding: 0; width: min(38rem, calc(100vw - 32px)); max-height: 70vh;
  border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--panel); color: var(--fg);
  box-shadow: var(--shadow-lg); overflow: hidden;
}
.palette[open] { display: flex; flex-direction: column; }
.palette::backdrop { background: var(--backdrop); backdrop-filter: blur(3px); }
.palette-search { display: flex; align-items: center; gap: 0.6rem; padding: 0.85rem 1rem; border-bottom: 1px solid var(--line); color: var(--muted); }
.palette-search input { flex: 1; border: 0; background: none; padding: 0.15rem 0; font-size: 1.05rem; outline: none; }
.palette-list { overflow-y: auto; padding: 0.4rem; }
.palette-group .label { padding: 0.6rem 0.65rem 0.3rem; }
.palette-item { display: flex; align-items: center; gap: 0.7rem; padding: 0.55rem 0.65rem; border-radius: var(--radius); cursor: pointer; }
.palette-item svg { width: 16px; height: 16px; color: var(--muted); flex: none; }
.palette-item.active { background: var(--panel-2); }
.palette-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.palette-item code { font-size: 0.75rem; color: var(--faint); }
.palette-empty { padding: 1.25rem; text-align: center; color: var(--muted); }
.palette-foot { display: flex; gap: 1rem; padding: 0.55rem 1rem; border-top: 1px solid var(--line); color: var(--faint); font-size: 0.8rem; }
.palette-foot kbd { margin-right: 0.15rem; }

/* ---------- sign-in and notice pages ---------- */
.login, .notice {
  max-width: 26rem; margin: 14vh auto; text-align: center; background: var(--panel);
  border: 1px solid var(--line); border-radius: var(--radius); padding: 2.25rem 1.75rem;
}
.login h1 { font-family: var(--mono); font-size: 1rem; font-weight: 500; letter-spacing: 0.24em; margin-bottom: 0.9rem; }
.login > p { color: var(--muted); }
.invite-form { margin-top: 1.4rem; text-align: left; display: grid; gap: 1rem; }
.invite-form input { width: 100%; }
.invite-form .btn { justify-content: center; }
.code-once { display: flex; gap: 0.5rem; align-items: center; }
.code-once input { flex: 1; font-family: var(--mono); }

/* ---------- narrow screens: sidebar on top, tables become cards ---------- */
@media (max-width: 900px) {
  .shell, .side-collapsed .shell { grid-template-columns: minmax(0, 1fr); }
  .side { position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  .side-collapsed .side-label { display: revert; }
  .side-head, .side-collapsed .side-head { flex-direction: row; height: 56px; padding: 0 16px; }
  .side-toggle { display: none; }
  .side-top { flex-direction: row; padding: 0.75rem 16px 0; }
  #nav, .side-collapsed #nav { flex-direction: row; flex-wrap: wrap; padding: 0.5rem 12px 0.75rem; gap: 0.25rem; }
  #nav ul { flex-direction: row; flex-wrap: wrap; }
  #nav a, .side-collapsed #nav a { padding: 0.4rem 0.6rem; justify-content: flex-start; }
  .side-sep { display: none; }
  .side-foot { display: none; }
  main { padding: 1.25rem 16px 8rem; }
  .topbar { padding: 0 12px 0 16px; height: 56px; position: static; }
  h1 { font-size: 1.8rem; }
  .ops, .side-collapsed .ops { left: 1rem; }
  .bulkbar, .side-collapsed .bulkbar { left: 50%; bottom: 1rem; flex-wrap: wrap; max-width: calc(100vw - 32px); }
  .page-foot { margin: auto -16px 0; padding: 0.75rem 16px; }
  .docs { grid-template-columns: minmax(0, 1fr); gap: 1.5rem; }
  .doc-nav { position: static; flex-direction: row; flex-wrap: wrap; max-height: none; }
  .doc-nav .label { width: 100%; margin: 0.5rem 0.3rem 0.2rem; }
  .ep-sum { white-space: normal; }
  .sheet { width: 100vw; }
  .sheet-body { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 760px) {
  .table-wrap { background: none; border: 0; overflow: visible; }
  table.grid, .grid tbody, .grid tr, .grid td { display: block; width: 100%; }
  .grid thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .grid tr { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 0.6rem; padding: 0.35rem 0; }
  .grid td { border: 0; display: grid; grid-template-columns: 6.5rem minmax(0, 1fr); gap: 0.5rem; padding: 0.3rem 0.85rem; }
  .grid td > * { justify-self: start; max-width: 100%; min-width: 0; }
  .grid td::before { content: attr(data-label); color: var(--muted); font-family: var(--mono); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; }
  .grid .col-sticky { border-left: 0; width: auto; }
  .actions { justify-content: flex-start; }
  .row-bad td:first-child, .row-warn td:first-child { box-shadow: none; }
}
@media (forced-colors: active) { .pill::before { forced-color-adjust: none; } }

/* ---------- snapshot sheet: details and files ---------- */
.copyable { display: inline-flex; align-items: center; gap: 0.2rem; max-width: 100%; margin: -0.35rem 0; }
.copyable .mono { font-size: 0.84rem; word-break: break-all; min-width: 0; }
.copyable .btn-icon { width: 28px; height: 28px; flex: none; }
.res-chips { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.chip.res { gap: 0.3rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.chip.res strong { color: var(--fg); font-weight: 600; }
.chip.res svg { width: 14px; height: 14px; margin-right: 0.1rem; }

.fb { border: 1px solid var(--line); background: var(--card); min-width: 0; margin-bottom: 0.75rem; }
.fb.loading > :not(.fb-bar) { opacity: 0.45; transition: opacity 0.15s 0.1s; }
.fb-bar { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; padding: 0.3rem 0.35rem 0.3rem 0.75rem; border-bottom: 1px solid var(--line); background: var(--head-bg); }
.fb-tools { display: inline-flex; align-items: center; gap: 0.1rem; flex: none; }
.fb-off { display: flex; flex-direction: column; align-items: center; gap: 0.9rem; padding: 2.5rem 1rem; text-align: center; border: 1px dashed var(--line-strong); }
.fb-off p { margin: 0; color: var(--muted); }
.fb-crumbs { display: flex; align-items: center; flex-wrap: wrap; gap: 0.1rem; min-width: 0; font-family: var(--mono); font-size: 0.84rem; }
.crumb { all: unset; color: var(--muted); padding: 0.15rem 0.2rem; overflow-wrap: anywhere; }
button.crumb { cursor: pointer; }
button.crumb:hover { color: var(--fg); text-decoration: underline; text-underline-offset: 3px; }
button.crumb:focus-visible, .fb-name:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
.crumb[aria-current] { color: var(--fg); font-weight: 500; }
.crumb.root { display: inline-flex; align-items: center; gap: 0.4rem; color: var(--fg); font-weight: 500; }
.crumb.root svg { width: 14px; height: 14px; color: var(--muted); }
.crumb-sep { color: var(--faint); padding: 0 0.05rem; }
.fb-table { width: 100%; border-collapse: collapse; table-layout: fixed; font-size: 0.9rem; }
.fb-table th { font-family: var(--mono); font-weight: 400; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); text-align: left; padding: 0.45rem 0.75rem; border-bottom: 1px solid var(--line); }
.fb-table th:nth-child(2) { width: 6.5rem; }
.fb-table th:nth-child(3) { width: 8.5rem; }
.fb-table td { padding: 0.42rem 0.75rem; border-bottom: 1px solid var(--line); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fb-table tbody tr:last-child td { border-bottom: 0; }
.fb-table tbody tr.clickable { cursor: pointer; }
.fb-table tbody tr:hover { background: var(--row-hover); }
.fb-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.fb-name { all: unset; display: inline-flex; align-items: center; gap: 0.55rem; max-width: 100%; color: var(--fg); cursor: pointer; }
.fb-name:hover .fb-label { text-decoration: underline; text-underline-offset: 3px; }
.fb-name:disabled { cursor: default; color: var(--muted); }
.fb-name svg { width: 16px; height: 16px; flex: none; color: var(--muted); }
.fb-name.dir svg { color: var(--fg); fill: currentColor; fill-opacity: 0.14; }
.fb-label { overflow: hidden; text-overflow: ellipsis; }
.fb-target { color: var(--muted); font-size: 0.84rem; overflow: hidden; text-overflow: ellipsis; }
.fb-empty { padding: 2.25rem 1rem; margin: 0; text-align: center; color: var(--muted); }
.fb-state { display: flex; flex-direction: column; align-items: center; gap: 0.75rem; padding: 2.25rem 1rem; }
.fb-state.muted { flex-direction: row; justify-content: center; }
.fb-state .errbox { align-self: stretch; margin: 0; }
.fb-note { margin: 0; padding: 0.5rem 0.75rem; border-top: 1px solid var(--line); }
.fb-filehead { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; min-height: 40px; padding: 0.2rem 0.35rem 0.2rem 0.75rem; border-bottom: 1px solid var(--line); }
.fb-code { overflow-x: auto; padding: 0.45rem 0; font-family: var(--mono); font-size: 0.8rem; line-height: 1.6; }
.fb-code table { border-collapse: collapse; }
.fb-code td { padding: 0 1rem 0 0; vertical-align: top; }
.fb-code .ln { width: 1%; min-width: 2.5rem; padding: 0 1rem 0 0.75rem; text-align: right; color: var(--faint); user-select: none; }
.fb-code .ln::before { content: attr(data-n); }
.fb-code .lc { white-space: pre; }
.fb-code tr:hover { background: var(--row-hover); }

/* ---------- Create Sandbox dialog ---------- */
.create-dlg { padding: 0; width: min(36rem, calc(100vw - 32px)); max-height: min(52rem, calc(100vh - 32px)); display: none; flex-direction: column; }
.create-dlg[open] { display: flex; }
.create-top { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1.1rem 1.4rem; border-bottom: 1px solid var(--line); }
.create-top h2 { margin: 0; font-size: 1.3rem; font-weight: 500; }
.create-body { padding: 1.3rem 1.4rem 0.6rem; overflow-y: auto; flex: 1; min-height: 0; }
.create-body .field { margin-bottom: 1.35rem; }
.create-body .field > input[type="text"] { width: 100%; font-family: var(--mono); }
.field-label { font-weight: 500; font-size: 0.92rem; }
.field-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; }
/* segmented choice (one of a few), e.g. API key permissions */
.seg { display: flex; padding: 3px; gap: 3px; background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius); }
.seg-btn { all: unset; box-sizing: border-box; flex: 1; text-align: center; padding: 0.5rem 0.75rem; cursor: pointer; color: var(--muted); border-radius: var(--radius); }
.seg-btn:hover { color: var(--fg); }
.seg-btn:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
.seg-btn.on { background: var(--bg); color: var(--fg); box-shadow: 0 0 0 1px var(--line-strong); }
.info-box { display: flex; gap: 0.7rem; margin-top: 0.75rem; padding: 0.85rem 1rem; border: 1px solid color-mix(in srgb, var(--info) 45%, transparent);
  background: color-mix(in srgb, var(--info) 9%, transparent); border-radius: var(--radius); }
.info-box > svg { flex: none; color: var(--info); width: 18px; height: 18px; margin-top: 0.1rem; }
.info-box strong { color: var(--info); font-weight: 500; }
.info-box p { margin: 0.25rem 0 0; color: var(--muted); font-size: 0.9rem; }
.perm-rows { margin-top: 0.75rem; display: flex; flex-direction: column; gap: 0.55rem; }
.perm-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.perm-group { display: inline-flex; border: 1px solid var(--line-strong); border-radius: var(--radius); }
.perm-btn { all: unset; box-sizing: border-box; min-width: 4.5rem; text-align: center; padding: 0.4rem 0.7rem; cursor: pointer; color: var(--muted); font-size: 0.88rem; }
.perm-btn + .perm-btn { border-left: 1px solid var(--line-strong); }
.perm-btn:hover:not(:disabled) { color: var(--fg); background: var(--row-hover); }
.perm-btn:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
.perm-btn.on { background: color-mix(in srgb, var(--fg) 15%, transparent); color: var(--fg); }
.perm-btn.fixed { background: color-mix(in srgb, var(--fg) 6%, transparent); color: var(--muted); cursor: default; }
/* API key permissions: a pill (Full Access or Restricted) that opens them */
.perm-pill {
  all: unset; box-sizing: border-box; cursor: pointer; display: inline-flex; align-items: center; padding: 0.2rem 0.65rem;
  font-size: 0.85rem; white-space: nowrap; color: var(--fg); border: 1px solid var(--line-strong); border-radius: var(--radius);
}
.perm-pill:hover { border-color: var(--line-hover); }
.perm-pill:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.perm-pill.full { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 40%, transparent); background: color-mix(in srgb, var(--warn) 10%, transparent); }
.perm-pill.full:hover { border-color: color-mix(in srgb, var(--warn) 70%, transparent); }
.menu.perm-pop { padding: 0; min-width: 21rem; max-width: calc(100vw - 16px); }
.pp-head { padding: 0.65rem 1rem; color: var(--muted); font-size: 0.85rem; border-bottom: 1px solid var(--line); }
.pp-row { display: flex; align-items: center; justify-content: space-between; gap: 1.5rem; padding: 0.6rem 1rem; border-bottom: 1px solid var(--line); }
.pp-chips { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 0.4rem; }
.pp-chip { padding: 0.15rem 0.65rem; font-size: 0.85rem; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--panel); }
.pp-foot { margin: 0; padding: 0.75rem 1rem; max-width: 21rem; color: var(--muted); font-size: 0.82rem; line-height: 1.5; }
/* date picker: a button and a month calendar in a popover */
.date-trigger {
  all: unset; box-sizing: border-box; width: 100%; display: flex; align-items: center; gap: 0.6rem; cursor: pointer;
  padding: 0.5rem 0.7rem; background: var(--panel); border: 1px solid var(--line-strong); border-radius: var(--radius);
}
.date-trigger:hover { border-color: var(--line-hover); }
.date-trigger:focus-visible { outline: 2px solid var(--focus); outline-offset: 0; }
.date-trigger svg { color: var(--muted); flex: none; }
.date-label.placeholder { color: var(--faint); }
.cal-pop {
  position: fixed; inset: auto; margin: 0; padding: 0.85rem; width: 19rem; color: var(--fg);
  background: var(--raised); border: 1px solid var(--line-strong); border-radius: var(--radius); box-shadow: var(--shadow);
}
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.5rem; }
.cal-title { font-weight: 500; }
.cal-nav { all: unset; cursor: pointer; display: grid; place-items: center; width: 2rem; height: 2rem; border-radius: var(--radius); }
.cal-nav:hover:not(:disabled) { background: var(--panel-2); }
.cal-nav:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
.cal-nav:disabled { color: var(--faint); cursor: default; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 0.15rem; }
.cal-week span { padding: 0.35rem 0; text-align: center; font-size: 0.78rem; color: var(--muted); }
.cal-day {
  all: unset; box-sizing: border-box; height: 2.3rem; display: grid; place-items: center; cursor: pointer;
  border-radius: var(--radius); font-size: 0.9rem; font-variant-numeric: tabular-nums;
}
.cal-day:hover:not(:disabled) { background: var(--panel-2); }
.cal-day:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
.cal-day:disabled { color: var(--faint); cursor: default; }
.cal-day.out { opacity: 0.45; }
.cal-day.today { box-shadow: inset 0 0 0 1px var(--line-hover); }
.cal-day.sel { background: color-mix(in srgb, var(--fg) 18%, transparent); font-weight: 600; }
.cal-foot { display: flex; justify-content: flex-end; margin-top: 0.5rem; padding-top: 0.5rem; border-top: 1px solid var(--line); }
.cal-clear { all: unset; cursor: pointer; padding: 0.3rem 0.5rem; font-size: 0.85rem; color: var(--muted); border-radius: var(--radius); }
.cal-clear:hover:not(:disabled) { color: var(--fg); background: var(--panel-2); }
.cal-clear:disabled { opacity: 0.5; cursor: default; }
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--bg); }
.stat { padding: 0.75rem 1rem; }
.stat + .stat { border-left: 1px solid var(--line); }
.stat-value { font-family: var(--mono); font-size: 1.35rem; line-height: 1.2; color: var(--fg); }
.stat-unit { font-size: 0.8rem; color: var(--muted); margin-left: 0.3rem; }
.stat-label { margin-top: 0.2rem; font-size: 0.78rem; color: var(--muted); font-family: var(--mono); text-transform: uppercase; letter-spacing: 0.06em; }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.switch-row .help { margin-top: 0.2rem; }
.switch {
  all: unset; box-sizing: border-box; flex: none; cursor: pointer; position: relative; width: 2.6rem; height: 1.45rem;
  background: var(--panel-2); border: 1px solid var(--line-strong); border-radius: var(--radius); transition: background 0.15s, border-color 0.15s;
}
.switch-knob { position: absolute; top: 2px; left: 2px; width: calc(1.45rem - 6px); height: calc(1.45rem - 6px); border-radius: var(--radius); background: var(--muted); transition: transform 0.15s, background 0.15s; }
.switch.on { background: var(--accent); border-color: var(--accent); }
.switch.on .switch-knob { transform: translateX(1.15rem); background: var(--accent-fg); }
.switch:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.pause-row { display: flex; align-items: center; gap: 0.6rem; margin-top: 0.6rem; }
.pause-row label { font-size: 0.92rem; }
.pause-row input { width: 6.5rem; font-family: var(--mono); }
@media (prefers-reduced-motion: reduce) { .switch, .switch-knob { transition: none; } }
.create-foot { display: flex; align-items: center; gap: 0.5rem; padding: 0.9rem 1.4rem; border-top: 1px solid var(--line); }
.create-foot .spacer { flex: 1; }
.quota-full { color: var(--bad); }
.picker {
  all: unset; box-sizing: border-box; width: 100%; display: flex; align-items: center; gap: 0.6rem; cursor: pointer;
  padding: 0.45rem 0.7rem; background: var(--panel); border: 1px solid var(--line-strong); border-radius: var(--radius); min-height: 2.6rem;
}
.picker:hover { border-color: var(--line-hover); }
.picker:focus-visible { outline: 2px solid var(--focus); outline-offset: 0; }
.picker-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.picker-note { color: var(--faint); font-size: 0.82rem; white-space: nowrap; }
.picker-chev { margin-left: auto; color: var(--muted); display: inline-flex; }
.picker-list { overflow-y: auto; padding: 0.3rem; }
.picker-list .picker-opt { gap: 0.6rem; padding: 0.45rem 0.55rem; }
.picker-check { margin-left: auto; display: inline-flex; color: var(--accent); }
.picker-list .picker-check svg { color: var(--accent); }
.picker-opt[aria-selected="true"] { background: var(--panel-2); }
.picker-group { padding: 0.5rem 0.55rem 0.25rem; font-family: var(--mono); font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--faint); }
.opt-icon {
  width: 24px; height: 24px; flex: none; display: grid; place-items: center; overflow: hidden; color: var(--muted);
  background: var(--panel-2); border-radius: var(--radius);
}
.opt-icon img { width: 100%; height: 100%; object-fit: contain; display: block; }
.picker-list .opt-icon svg, .picker .opt-icon svg { width: 14px; height: 14px; }
.installed { display: flex; flex-direction: column; gap: 0.35rem; margin-top: 0.2rem; }
.installed-list { display: flex; flex-wrap: wrap; gap: 0.3rem; }
.chip { display: inline-flex; align-items: center; gap: 0.4rem; padding: 0.15rem 0.5rem; font-size: 0.8rem; background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); }
.chip .mono { color: var(--muted); font-size: 0.74rem; }
.meta-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 0.3rem; margin-top: 0.25rem; }
.meta-chips .chip { font-size: 0.74rem; padding: 0.05rem 0.4rem; max-width: 16rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.timeout-note { display: inline-flex; align-items: center; gap: 0.3rem; color: var(--muted); margin-top: 0.2rem; }
.adv-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.7rem; margin-top: 0.65rem; }

/* ---------- numbered steps (Get started) ---------- */
.guide { list-style: none; margin: 0; padding: 0; max-width: 860px; }
.guide-step { position: relative; display: grid; grid-template-columns: 1.75rem minmax(0, 1fr); gap: 1rem; padding-bottom: 1.4rem; }
.guide-step::before { content: ""; position: absolute; left: calc(0.875rem - 0.5px); top: 2.05rem; bottom: 0.3rem; width: 1px; background: var(--line-strong); }
.guide-step:last-child::before { display: none; }
.guide-num {
  width: 1.75rem; height: 1.75rem; display: grid; place-items: center; font-size: 0.85rem;
  color: var(--muted); background: var(--bg); border: 1px solid var(--line-strong); border-radius: var(--radius);
}
.guide-body h3 { margin: 0.2rem 0 0.35rem; font-size: 1.05rem; font-weight: 500; }
.guide-body p { margin: 0 0 0.7rem; color: var(--muted); }

/* ---------- Get started (js/start.js): pick a way, then its steps ---------- */
.st { max-width: 1040px; }

.st-paths { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.75rem; margin: 0 0 2rem; }
.st-path { all: unset; box-sizing: border-box; cursor: pointer; display: flex; flex-direction: column; gap: 0.45rem; padding: 1rem 1.1rem 1.1rem;
  background: var(--panel); border: 1px solid var(--line-strong); transition: border-color 0.15s, box-shadow 0.15s; }
.st-path:hover { border-color: var(--line-hover); }
.st-path:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.st-path[aria-checked="true"] { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, var(--panel)); }
.st-path-head { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; margin-bottom: 0.15rem; }
.st-path-title { font-weight: 500; font-size: 1.05rem; }
.st-tag { font-family: var(--mono); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.st-tag.rec { color: var(--accent); }
.st-radio { flex: none; width: 16px; height: 16px; box-sizing: border-box; border-radius: 50%; border: 1.5px solid var(--line-strong); display: grid; place-items: center; }
.st-path[aria-checked="true"] .st-radio { border-color: var(--accent); }
.st-path[aria-checked="true"] .st-radio::after { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.st-path-text { color: var(--muted); line-height: 1.5; }

.st-setup { border-top: 1px solid var(--line); padding-top: 1.5rem; }
.st-setup-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.5rem; }
.st-setup-head h2 { margin: 0; font-size: 1.15rem; font-weight: 500; }
.st .guide { max-width: none; }
.st .guide-body .btn-row { margin-bottom: 0.7rem; }
.guide-num svg { width: 15px; height: 15px; }
.guide-step.done .guide-num { border-color: var(--accent); color: var(--accent); }

/* A command block as a terminal window: where it runs, tabs, copy. */
.st-shell { margin: 0 0 0.7rem; background: var(--bg); border: 1px solid var(--line); }
.st-shell-head { display: flex; align-items: center; gap: 0.5rem; min-height: 2.5rem; padding: 0.3rem 0.4rem 0.3rem 0.85rem; box-sizing: border-box;
  color: var(--muted); font-size: 0.9rem; background: var(--panel); border-bottom: 1px solid var(--line); }
.st-shell-head > svg { width: 15px; height: 15px; flex: none; }
.st-shell-head .spacer { flex: 1; }
.st-shell .st-k { color: var(--accent); }
.st-shell .st-c { color: var(--faint); }
.st-shell pre { margin: 0; padding: 0.9rem 1rem; font-family: var(--mono); font-size: 0.86rem; line-height: 1.7; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--fg); }
/* Tabs of equal width, whatever their labels; the chosen one filled. */
.st-tabs { display: inline-grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 2px; }
.st-tab { all: unset; cursor: pointer; padding: 0.3rem 0.8rem; font-size: 0.88rem; text-align: center; color: var(--muted); }
.st-tab:hover { color: var(--fg); }
.st-tab[aria-selected="true"] { background: var(--item-hover); color: var(--fg); }
.st-tab:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }

.st-status { display: flex; align-items: center; gap: 0.5rem; margin: 0 0 0.7rem; color: var(--muted); }
.st-status-text { min-width: 0; }
.st-status .pill { margin-left: 0.3rem; }
.st-status.done { color: var(--fg); }
.st-status.done > svg { width: 16px; height: 16px; color: var(--accent); flex: none; }
.st-status > .spinner { flex: none; }
.st-prompt { margin: 0.2rem 0 0.7rem; max-height: 22rem; overflow: auto; padding: 0.9rem 1rem; background: var(--bg); border: 1px solid var(--line);
  font-family: var(--mono); font-size: 0.82rem; line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--fg); }
.st-prompt:focus-visible { outline: 2px solid var(--focus); outline-offset: 0; }
.st-single { max-width: 46rem; }
.st-foot { display: flex; gap: 1.5rem; margin-top: 1.25rem; padding-top: 1.1rem; border-top: 1px solid var(--line); }
.st-foot a { display: inline-flex; align-items: center; gap: 0.4rem; color: var(--muted); font-size: 0.93rem; text-decoration: none; }
.st-foot a:hover { color: var(--fg); }
.st-foot svg { width: 15px; height: 15px; }
.st-single p { margin: 0 0 1rem; color: var(--muted); line-height: 1.6; }
@media (prefers-reduced-motion: reduce) { .st-path { transition: none; } }
@media (max-width: 900px) { .st-paths { grid-template-columns: minmax(0, 1fr); } }

/* ---------- Sandboxes with none yet: faded sample rows behind the call to create one ---------- */
.empty-wrap { position: relative; overflow: hidden; }
.ghost-table { pointer-events: none; }
.ghost-table tbody { opacity: 0.16; }
.ghost-table tbody tr { height: 84px; }
.empty-wrap::after {
  content: ""; position: absolute; inset: 52px 0 0 0; pointer-events: none;
  background: radial-gradient(ellipse 50% 60% at 50% 50%, var(--bg) 25%, color-mix(in srgb, var(--bg) 70%, transparent) 65%, transparent 100%),
    linear-gradient(180deg, transparent 55%, var(--bg) 100%);
}
.empty-hero {
  position: absolute; z-index: 1; top: 52px; left: 0; right: 0; bottom: 0; margin: 0 auto; width: min(560px, 100%); box-sizing: border-box;
  display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; padding: 2rem 1.5rem;
}
.empty-hero .btn-row { justify-content: center; }
.empty-hero .or, .empty-hero .snippet-bar { align-self: stretch; text-align: left; }
.empty-hero h2 { margin: 0 0 0.5rem; font-size: 1.6rem; font-weight: 500; }
.empty-hero > p { margin: 0 0 1.4rem; color: var(--muted); }
.or { display: flex; align-items: center; gap: 0.9rem; margin: 1.4rem 0; color: var(--muted); font-size: 0.85rem; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line-strong); }
.snippet-bar { display: flex; align-items: center; gap: 0.4rem; padding: 0.35rem; background: var(--panel); border: 1px solid var(--line-strong); border-radius: var(--radius); }
.snippet-bar code { flex: 1; min-width: 0; font-size: 0.82rem; color: var(--fg); white-space: nowrap; overflow-x: auto; padding: 0 0.3rem; }
.snippet-bar .sep { width: 1px; align-self: stretch; background: var(--line-strong); margin: 0 0.15rem; }
.snippet-tab { all: unset; cursor: pointer; display: grid; place-items: center; width: 2.1rem; height: 2.1rem; color: var(--fg); background: var(--panel-2); border-radius: var(--radius); }
.snippet-tab:hover { color: var(--accent); }
.snippet-tab:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
@media (max-width: 900px) {
  .guide-step { grid-template-columns: 2rem minmax(0, 1fr); gap: 0.8rem; }
  .guide-num { width: 2rem; height: 2rem; }
  .guide-step::before { left: calc(1rem - 1px); top: 2.1rem; }
  .empty-hero { position: relative; top: 0; padding: 1.5rem 1rem; max-width: none; }
  .empty-wrap .ghost-table, .empty-wrap::after { display: none; }
  .adv-grid { grid-template-columns: minmax(0, 1fr); }
}
.sheet p code { word-break: normal; overflow-wrap: anywhere; }

/* ---------- terminal (js/terminal.js): dark in both themes ---------- */
.term { position: relative; height: max(20rem, calc(100vh - 15rem)); background: #050505; border: 1px solid var(--line-strong); }
.term-screen { position: absolute; inset: 0.5rem 0.25rem 0.5rem 0.6rem; }
.term-status { position: absolute; inset: 0; z-index: 10; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.9rem; padding: 1rem; background: rgb(5 5 5 / 0.82); color: #e5e5e5; text-align: center; }
.term-status p { margin: 0; color: #a3a3a3; }
.term-status .btn { color: #fafafa; border-color: rgb(255 255 255 / 0.28); background: transparent; }

/* ---------- Playground: configuration left, the live sandbox right ---------- */
/* The workspace fits the window: the configuration scrolls on its own,
   its Create bar stays in view. */
main:has(> .pgx) { flex: none; height: calc(100vh - 64px); box-sizing: border-box; padding-top: 1.25rem; padding-bottom: 1rem; overflow: hidden; }
/* The live side shows its sandbox's state: no operations tray over the
   configuration's Create button. */
body:has(.pgx) #ops { display: none; }
.pgx { flex: 1; display: flex; flex-direction: column; gap: 1rem; min-height: 0; }
.pgx-head p { margin: 0.45rem 0 0; }
.pgx-split { flex: 1; display: grid; grid-template-columns: minmax(20rem, 24rem) minmax(0, 1fr); min-height: 0; border: 1px solid var(--line); background: var(--card); }
/* scroll-padding keeps a focused field clear of the sticky Create bar. */
.pgx-config { display: flex; flex-direction: column; min-height: 0; overflow-y: auto; border-right: 1px solid var(--line); scroll-padding-bottom: 8rem; }
.pgx-sec { padding: 0.9rem 1.15rem 1rem; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 0.7rem; }
.pgx-sec > h3.label { margin: 0; }
.pgx-sec .picker { width: 100%; }
.pgx-note { margin: 0; }
.pgx-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.pgx-row input { width: 7rem; padding-top: 0.4rem; padding-bottom: 0.4rem; }
.pgx-field { display: flex; flex-direction: column; gap: 0.3rem; }
.pgx-inline { display: flex; align-items: center; gap: 0.5rem; }
.pgx-row .pgx-inline input { width: 4.5rem; }
.pgx-inline .switch { margin-left: 0.35rem; }
.pgx-foot { margin-top: auto; position: sticky; bottom: 0; padding: 1rem 1.15rem 1.15rem; display: flex; flex-direction: column; gap: 0.6rem; background: var(--card); border-top: 1px solid var(--line); }
.pgx-foot-btns { display: flex; gap: 0.5rem; }
.pgx-foot-btns:not(:has(.btn:not([hidden]))) { display: none; }
.pgx-foot .btn { flex: 1; justify-content: center; }
.pgx-config .field-label { font-weight: 500; }
.pgx-foot p { margin: 0; }

/* Type in the playground: sections, fields and their descriptions all at
   the base size (15px), with hierarchy from colour and weight rather than
   small or capitalised text. */
.pgx-head p { font-size: 1.07rem; }
.pgx-sec > h3.label { font-family: var(--sans); font-size: 1rem; font-weight: 500; text-transform: none; letter-spacing: 0; color: var(--muted); }
.pgx-config .slider-head span, .pgx-config .field-label, .pgx-config .pgx-row label { font-size: 1rem; color: var(--fg); }
.pgx-config .pgx-note, .pgx-config .help, .pgx-foot p { font-size: 1rem; line-height: 1.5; }
.pgx-saved, .pgx-status .small { font-size: 0.93rem; }

/* Sliders: the value in bold, the track filled up to the thumb. */
.slider { display: flex; flex-direction: column; gap: 0.45rem; }
.slider-head { display: flex; align-items: baseline; justify-content: space-between; gap: 0.75rem; color: var(--muted); }
.slider-head strong { color: var(--fg); font-weight: 600; font-variant-numeric: tabular-nums; }
.range { appearance: none; -webkit-appearance: none; width: 100%; height: 18px; margin: 0; padding: 0; background: transparent; border: 0; cursor: pointer; --fill: 50%; }
.range:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.range::-webkit-slider-runnable-track { height: 6px; background: linear-gradient(to right, var(--fg) var(--fill), var(--line-strong) var(--fill)); }
.range::-moz-range-track { height: 6px; background: var(--line-strong); }
.range::-moz-range-progress { height: 6px; background: var(--fg); }
.range::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; margin-top: -5px; background: var(--bg); border: 2px solid var(--fg); }
.range::-moz-range-thumb { width: 12px; height: 12px; background: var(--bg); border: 2px solid var(--fg); border-radius: 0; }

/* The live side: tabs, the sandbox's status and actions, then the stage. */
.pgx-live { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.pgx-bar { container-type: inline-size; display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; flex-wrap: wrap; padding: 0 0.75rem 0 1rem; border-bottom: 1px solid var(--line); min-height: 52px; }
.pgx-tabs { display: flex; gap: 1.4rem; align-self: stretch; }
.pgx-tab { all: unset; cursor: pointer; display: flex; align-items: center; padding: 0 0.1rem; margin-bottom: -1px; color: var(--muted); font-size: 1rem; border-bottom: 2px solid transparent; }
.pgx-tab:hover { color: var(--fg); }
.pgx-tab[aria-selected="true"] { color: var(--fg); font-weight: 500; border-bottom-color: var(--fg); }
.pgx-tab:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
.pgx-status { display: flex; align-items: center; gap: 0.5rem; padding: 0.4rem 0; flex-wrap: wrap; min-width: 0; }
/* A narrow bar keeps one line: its buttons show only their icons. */
@container (max-width: 48rem) {
  .pgx-status .btn-label { display: none; }
  .pgx-status .btn:has(.btn-label) { padding: 0; width: 34px; height: 34px; justify-content: center; }
}
.pgx-name { font-size: 0.82rem; color: var(--muted); }
.pgx-saved { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; padding: 0.5rem 0.75rem 0.5rem 1rem; border-bottom: 1px solid var(--line); }
.pgx-saved > svg { color: var(--ok); }
.pgx-saved > span { flex: 1; min-width: 12rem; }
.pgx-stage { flex: 1; min-height: 0; display: flex; flex-direction: column; padding: 1rem;
  background-image: radial-gradient(var(--line-strong) 1px, transparent 1.2px); background-size: 18px 18px; }
.pgx-stage.live { background-image: none; }
.pgx-stage .term { flex: 1; height: auto; min-height: 16rem; }
.pgx-files { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.pgx-files .fb { flex: 1; margin: 0; overflow: auto; }
.pgx-files .fb-bar { position: sticky; top: 0; z-index: 1; background: var(--card); }
.pgx-empty { margin: auto; display: flex; flex-direction: column; align-items: center; gap: 0.7rem; max-width: 28rem; padding: 2rem 2.25rem; text-align: center;
  background: var(--card); border: 1px solid var(--line-strong); }
.pgx-empty h2 { margin: 0.2rem 0 0; font-size: 1.2rem; font-weight: 500; }
.pgx-empty p { margin: 0; }
.pgx-empty > svg { width: 26px; height: 26px; color: var(--muted); }
.pgx-howto { max-width: 34rem; }
.pgx-howto ol { list-style: none; margin: 0.3rem 0 0; padding: 0; display: flex; flex-direction: column; gap: 0.8rem; text-align: left; counter-reset: step; }
.pgx-howto li { counter-increment: step; display: grid; grid-template-columns: 1.6rem minmax(0, 1fr); gap: 0.75rem; align-items: baseline; color: var(--muted); line-height: 1.5; }
.pgx-howto li::before { content: counter(step); display: grid; place-items: center; height: 1.6rem; font-family: var(--mono); font-size: 0.8rem; color: var(--fg); border: 1px solid var(--line-strong); }
.pgx-howto strong { color: var(--fg); font-weight: 500; }
.pgx-empty .spinner { width: 1.3rem; height: 1.3rem; }
@media (max-width: 900px) {
  main:has(> .pgx) { height: auto; overflow: visible; }
  .pgx-split { grid-template-columns: minmax(0, 1fr); }
  .pgx-config { border-right: 0; border-bottom: 1px solid var(--line); }
  .pgx-stage { min-height: 26rem; }
  .pgx-name { display: none; }
}
