/* Cubby dashboard. Two deliberate palettes: crisp light (white surfaces, near-black text, neutral greys) and
   near-black dark. The orange accent is only for primary actions, links and focus. The system preference decides
   unless the theme toggle saved a choice (html[data-theme], set before this file paints by index.html). */
:root {
  --bg: #fafafa; --side: #ffffff; --card: #ffffff; --fg: #0a0a0a; --muted: #6b6b6b; --faint: #8f8f8f;
  --line: #e5e5e5; --line2: #f0f0f0; --code: #f5f5f5; --hover: #f5f5f5;
  --accent: #c2410c; --accent-fg: #ffffff; --danger: #c92a2a; --ok: #2f7d3a; --warn: #b45309;
  --r: 8px; --rl: 12px;
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme=light]) {
    --bg: #0a0a0a; --side: #0a0a0a; --card: #111111; --fg: #ededed; --muted: #a1a1a1; --faint: #6b6b6b;
    --line: #262626; --line2: #1c1c1c; --code: #1a1a1a; --hover: #1a1a1a;
    --accent: #ff8a4c; --accent-fg: #0a0a0a; --danger: #ff6b6b; --ok: #4ade80; --warn: #fbbf24;
    color-scheme: dark;
  }
}
:root[data-theme=dark] {
  --bg: #0a0a0a; --side: #0a0a0a; --card: #111111; --fg: #ededed; --muted: #a1a1a1; --faint: #6b6b6b;
  --line: #262626; --line2: #1c1c1c; --code: #1a1a1a; --hover: #1a1a1a;
  --accent: #ff8a4c; --accent-fg: #0a0a0a; --danger: #ff6b6b; --ok: #4ade80; --warn: #fbbf24;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--fg); font: 13px/1.5 var(--sans); -webkit-font-smoothing: antialiased; overflow-x: hidden; }
a { color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
h1, h2, h3 { margin: 0; letter-spacing: -0.01em; }
h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); margin: 28px 0 8px; font-weight: 600; }
p { margin: 0 0 8px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
code, pre, .mono { font-family: var(--mono); font-size: 12.5px; }
pre { background: var(--code); border-radius: var(--r); padding: 10px 12px; margin: 8px 0; white-space: pre-wrap; word-break: break-all; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--rl); padding: 16px; }
.stack > * + * { margin-top: 10px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.spread { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
input[type=email], input[type=password], input[type=text], input[type=number] {
  width: 100%; padding: 8px 10px; border-radius: var(--r); border: 1px solid var(--line); background: var(--card); color: var(--fg); font: inherit;
}
button {
  font: inherit; font-size: 13px; border-radius: var(--r); border: 1px solid var(--line); background: var(--card); color: var(--fg);
  padding: 5px 10px; cursor: pointer; white-space: nowrap;
}
button:hover { border-color: var(--faint); }
button.primary { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); font-weight: 600; padding: 8px 14px; }
button.primary:hover { filter: brightness(1.06); }
button.danger { color: var(--danger); }
button.link { border: 0; background: none; padding: 0; color: var(--muted); text-decoration: underline; }
button.icon { display: inline-grid; place-items: center; width: 30px; height: 30px; padding: 0; color: var(--muted); }
button.icon:hover { color: var(--fg); }
svg.i { width: 16px; height: 16px; flex: none; }
.error { color: var(--danger); font-size: 13px; min-height: 1em; }
.banner { background: var(--card); border: 1px solid var(--line); border-left: 3px solid var(--warn); border-radius: var(--r); padding: 8px 12px; font-size: 13px; margin-bottom: 16px; }
.banner b { color: var(--warn); }
.badge { font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; padding: 1px 7px; border-radius: 99px; border: 1px solid var(--line); color: var(--muted); }
.badge.accent { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }
.badge.ok { color: var(--ok); }
.badge.danger { color: var(--danger); }
label.check { display: flex; gap: 8px; align-items: center; cursor: pointer; }
input[type=checkbox], input[type=radio] { accent-color: var(--fg); }
.empty { text-align: center; padding: 28px; color: var(--muted); border: 1px dashed var(--line); border-radius: var(--rl); background: var(--card); }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--fg); color: var(--bg); padding: 6px 12px; border-radius: var(--r); font-size: 13px; opacity: 0; transition: opacity .2s; pointer-events: none; z-index: 70; }
.toast.show { opacity: 1; }

/* ---------- Shell: sidebar, bottom bar on phones ---------- */
.shell { display: grid; grid-template-columns: 220px minmax(0, 1fr); min-height: 100vh; }
.side-col { background: var(--side); border-right: 1px solid var(--line); min-width: 0; }
.side { position: sticky; top: 0; height: 100vh; padding: 14px 10px; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.brand { display: flex; align-items: center; gap: 9px; padding: 0 6px; min-width: 0; }
.brand .mark { width: 24px; height: 24px; flex: none; }
.brand > div { min-width: 0; }
.brand h1 { font-size: 14px; font-weight: 650; line-height: 1.25; overflow-wrap: anywhere; }
.brand .credit { font-size: 11.5px; }
.nav { display: flex; flex-direction: column; gap: 1px; }
.nav a { display: flex; align-items: center; gap: 9px; padding: 6px 8px; border-radius: var(--r); color: var(--muted); text-decoration: none; }
.nav a:hover { background: var(--hover); color: var(--fg); }
.nav a[aria-current=page] { background: var(--hover); color: var(--fg); font-weight: 600; }
.foot { margin-top: auto; border-top: 1px solid var(--line); padding: 10px 6px 0; display: flex; flex-direction: column; gap: 8px; min-width: 0; font-size: 12.5px; }
.who { display: flex; align-items: center; gap: 8px; min-width: 0; color: var(--muted); }
.who .email { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.av { width: 22px; height: 22px; border-radius: 50%; border: 1px solid var(--line); background: var(--code); color: var(--fg); display: grid; place-items: center; font-size: 11px; font-weight: 700; flex: none; text-transform: uppercase; }
.foot .row { gap: 6px; flex-wrap: nowrap; }
main { min-width: 0; width: 100%; max-width: 1080px; padding: 22px 28px 64px; }
.page-h { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.page-h h2 { font-size: 18px; font-weight: 650; min-width: 0; overflow-wrap: anywhere; }

/* ---------- Command palette (⌘K) ---------- */
kbd { font-family: var(--sans); font-size: 11px; color: var(--muted); border: 1px solid var(--line); border-radius: 4px; padding: 0 5px; line-height: 17px; background: var(--card); }
button.palette-hint { display: flex; align-items: center; gap: 8px; width: 100%; padding: 5px 8px; color: var(--muted); background: var(--card); text-align: left; }
button.palette-hint:hover { color: var(--fg); }
button.palette-hint .label { flex: 1; }
.palette-backdrop { position: fixed; inset: 0; z-index: 60; background: rgb(10 10 10 / .28); display: flex; justify-content: center; align-items: flex-start; padding: 12vh 16px 16px; }
:root[data-theme=dark] .palette-backdrop { background: rgb(0 0 0 / .6); }
@media (prefers-color-scheme: dark) { :root:not([data-theme=light]) .palette-backdrop { background: rgb(0 0 0 / .6); } }
.palette { width: min(560px, 100%); background: var(--card); border: 1px solid var(--line); border-radius: var(--rl); box-shadow: 0 16px 48px rgb(0 0 0 / .18); overflow: hidden; font-size: 13px; }
.palette-search { display: flex; align-items: center; gap: 8px; padding: 0 12px; border-bottom: 1px solid var(--line); color: var(--muted); }
.palette-search input[type=text] { border: 0; padding: 12px 0; background: none; font-size: 14px; outline: none; }
.palette-list { max-height: min(360px, 60vh); overflow-y: auto; padding: 6px; }
.palette .group-h { font-size: 11px; font-weight: 600; color: var(--muted); padding: 8px 8px 4px; }
.palette .opt { display: flex; align-items: center; gap: 9px; padding: 6px 8px; border-radius: var(--r); cursor: pointer; color: var(--fg); }
.palette .opt svg.i { color: var(--muted); }
.palette .opt[aria-selected=true] { background: var(--hover); }
.palette .opt[aria-selected=true] svg.i { color: var(--accent); }
.palette .opt .label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.palette .opt .hint { color: var(--muted); font-size: 11.5px; }
.palette-empty { padding: 20px 8px; text-align: center; color: var(--muted); }

@media (max-width: 640px) {
  /* Rows take their content's height: on a short page the spare height must not stretch the top bar. */
  .shell { grid-template-columns: minmax(0, 1fr); align-content: start; }
  .side-col { border-right: 0; border-bottom: 1px solid var(--line); }
  .side { position: static; height: auto; flex-direction: row; align-items: center; padding: 8px 12px 8px 10px; gap: 8px; }
  .brand { flex: 1; padding: 0; }
  .brand .credit { display: none; }
  .nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; flex-direction: row; background: var(--side); border-top: 1px solid var(--line); padding: 4px 4px calc(4px + env(safe-area-inset-bottom)); }
  .nav a { flex: 1; flex-direction: column; gap: 2px; font-size: 11px; padding: 6px 0; justify-content: center; }
  .nav a[aria-current=page] { background: none; color: var(--accent); }
  .foot { margin: 0; border: 0; padding: 0; flex-direction: row; align-items: center; }
  .who { display: none; }
  button.palette-hint { width: 30px; height: 30px; padding: 0; justify-content: center; flex: none; }
  button.palette-hint .label, button.palette-hint kbd { display: none; }
  main { padding: 16px 16px 88px; }
  .toast { bottom: 80px; }
}

/* ---------- Signed out and the approval page ---------- */
.hero { display: grid; grid-template-columns: 1.1fr 1fr; gap: 40px; align-items: center; min-height: 86vh; max-width: 960px; margin: 0 auto; padding: 32px 16px; }
.hero h1 { font-size: 40px; line-height: 1.1; letter-spacing: -0.02em; margin: 0 0 12px; overflow-wrap: anywhere; }
.hero h1 span { color: var(--accent); }
.hero h2 { overflow-wrap: anywhere; }
.hero .lead { font-size: 17px; }
.hero.single { grid-template-columns: minmax(0, 480px); justify-content: center; }
.hero.single .card { text-align: center; padding: 24px; }
.hero.single .row { justify-content: center; }
@media (max-width: 760px) { .hero { grid-template-columns: minmax(0, 1fr); gap: 24px; min-height: 0; } .hero h1 { font-size: 30px; } }
.hero-banner { max-width: 960px; margin: 16px auto 0; padding: 0 16px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; }
.tabs button { border: 0; border-bottom: 2px solid transparent; border-radius: 0; background: none; padding: 8px 10px; color: var(--muted); font-size: 14px; }
.tabs button[aria-selected=true] { color: var(--fg); border-bottom-color: var(--accent); font-weight: 600; }
.form .stack > * + *, form.stack > * + * { margin-top: 10px; }
form.stack button.primary { width: 100%; }

/* ---------- Connect card ---------- */
.connect { padding: 24px 24px 16px; }
.connect .headline { font-size: 36px; line-height: 1.22; letter-spacing: -0.02em; font-weight: 650; margin: 0 0 10px; overflow-wrap: anywhere; }
.connect .chip { display: inline-block; background: var(--code); border: 1px solid var(--line); border-radius: var(--r); padding: 0 10px; transition: opacity .25s, transform .25s; }
.connect .chip.out { opacity: 0; transform: translateY(-0.25em); }
@media (prefers-reduced-motion: reduce) { .connect .chip { transition: none; } .connect .chip.out { transform: none; } }
.connect .lede { color: var(--muted); max-width: 560px; margin-bottom: 18px; }
button.pill { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); border-radius: 999px; padding: 11px 20px;
  font-size: 15px; font-weight: 600; display: inline-flex; align-items: center; gap: 12px; }
button.pill:hover { filter: brightness(1.06); border-color: var(--accent); }
.agents-label { font-size: 11.5px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin: 24px 0 8px; }
.agents { display: flex; flex-wrap: wrap; gap: 6px; }
.agents span { border: 1px solid var(--line); border-radius: 999px; padding: 3px 11px; font-size: 13px; }
details summary { cursor: pointer; }
@media (max-width: 760px) { .connect { padding: 18px; } .connect .headline { font-size: 28px; } }

/* ---------- Apps, tables, admin ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.app h2 { font-size: 15px; font-weight: 650; word-break: break-all; }
.app h2 a { color: inherit; text-decoration: none; }
.app h2 a:hover { text-decoration: underline; }
.app .meta { font-size: 12.5px; color: var(--muted); }
.app details { border-top: 1px solid var(--line); padding-top: 10px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; font-weight: 500; color: var(--muted); font-size: 11.5px; white-space: nowrap; }
th, td { padding: 7px 10px; border-bottom: 1px solid var(--line2); vertical-align: middle; }
thead th { border-bottom-color: var(--line); }
tbody tr:last-child td { border-bottom: 0; }
.table-wrap { overflow-x: auto; position: relative; }
.card.table-wrap { padding: 4px 6px; }
td a { color: var(--fg); text-decoration: none; }
.sec-h { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin: 28px 0 8px; }
.sec-h h3 { margin: 0; }
.sec-h a { font-size: 13px; text-decoration: none; }
td a:hover { text-decoration: underline; }
.dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--faint); margin-right: 6px; vertical-align: middle; }
.dot.live { background: var(--ok); }
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: var(--rl); background: var(--card); }
.stats > div { padding: 10px 14px; border-left: 1px solid var(--line); min-width: 0; }
.stats > div:first-child { border-left: 0; }
.stats b { display: block; font-size: 20px; font-weight: 650; font-variant-numeric: tabular-nums; }
@media (max-width: 760px) { .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } .stats > div:nth-child(3) { border-left: 0; } .stats > div:nth-child(n+3) { border-top: 1px solid var(--line); } }
.back { display: inline-block; font-size: 13px; color: var(--muted); text-decoration: none; margin-bottom: 10px; }
.back:hover { color: var(--fg); }
.placeholder { padding: 40px 16px; text-align: center; color: var(--muted); border: 1px dashed var(--line); border-radius: var(--rl); background: var(--card); }

/* ---------- Shared bits for Home, Agents and the app page ---------- */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nowrap { flex-wrap: nowrap; }
.num, .big { font-variant-numeric: tabular-nums; }
.big { font-size: 20px; font-weight: 650; color: var(--fg); }
button.sm, a.btn { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; padding: 3px 9px; }
a.btn { border: 1px solid var(--line); border-radius: var(--r); background: var(--card); color: var(--fg); text-decoration: none; padding: 5px 10px; font-size: 13px; }
a.btn:hover { border-color: var(--faint); }
button.primary { display: inline-flex; align-items: center; gap: 6px; }
button:disabled { opacity: .55; cursor: default; }
button.sm svg.i, a.btn svg.i { width: 14px; height: 14px; }
.page-actions { margin-left: auto; }
.mono-badge { display: inline-grid; place-items: center; flex: none; width: 24px; height: 20px; border: 1px solid var(--line); border-radius: 5px; background: var(--card);
  font: 600 10px/1 var(--mono); letter-spacing: .02em; color: var(--fg); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
button.chip-copy { display: inline-flex; align-items: flex-start; gap: 8px; max-width: 100%; text-align: left; white-space: normal; background: var(--code); border-color: var(--line); padding: 4px 9px; border-radius: var(--r); }
button.chip-copy .mono { font-size: 12px; overflow-wrap: anywhere; }
button.chip-copy svg.i { width: 13px; height: 13px; margin-top: 2px; color: var(--muted); }
button.chip-copy:hover svg.i { color: var(--accent); }
.ask { display: flex; flex-direction: column; align-items: center; gap: 6px; margin-top: 10px; }
.ask-h { font-size: 12px; font-weight: 600; color: var(--muted); }
.empty .ask { margin-top: 12px; }

/* ---------- Home ---------- */
.home { display: grid; grid-template-columns: minmax(0, 1fr) 280px; grid-template-areas: "main side"; gap: 20px; align-items: start; }
.home-main { grid-area: main; min-width: 0; display: flex; flex-direction: column; gap: 14px; }
.home-side { grid-area: side; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
@media (max-width: 900px) { .home { grid-template-columns: minmax(0, 1fr); grid-template-areas: "side" "main"; } }
.side-card { padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; }
.side-card-h { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.side-card h3 { margin: 0; }
.side-card-h a { text-decoration: none; }
.side-list { list-style: none; margin: 0; padding: 0; }
.side-list li { display: flex; align-items: center; gap: 8px; padding: 5px 0; border-top: 1px solid var(--line2); }
.side-list li:first-child { border-top: 0; }
.side-list a { color: var(--fg); text-decoration: none; }
.side-list a:hover { text-decoration: underline; }
.side-card button.sm { align-self: flex-start; }
svg.spark { display: block; width: 100%; overflow: visible; }
.spark-line { fill: none; stroke: var(--accent); stroke-width: 1.5; stroke-linejoin: round; }
.spark-area { fill: var(--accent); opacity: .1; }
.next { padding: 12px 14px; }
.next h3 { display: flex; align-items: center; gap: 6px; margin: 0 0 8px; text-transform: none; letter-spacing: 0; font-size: 13px; color: var(--fg); }
.next h3 svg.i { color: var(--accent); }
.attention { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; background: var(--card); border: 1px solid var(--line); border-left: 3px solid var(--danger); border-radius: var(--r); padding: 7px 10px; }
.attention > span:first-child { color: var(--danger); }
.attention a { color: var(--fg); font-weight: 600; }
.attention .grow { white-space: normal; }
.steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.step { display: grid; grid-template-columns: 26px minmax(0, 1fr); gap: 12px; }
.step-n { width: 26px; height: 26px; border-radius: 7px; border: 1px solid var(--line); display: grid; place-items: center; font-size: 12px; font-weight: 600; color: var(--muted); background: var(--card); }
.step.now .step-n { border-color: var(--accent); color: var(--accent); }
.step:not(.now) .step-body { border: 1px dashed var(--line); border-radius: var(--rl); padding: 10px 14px; color: var(--muted); }
.step:not(.now) .step-body b { color: var(--fg); opacity: .75; }
.step .chips { margin-top: 8px; }

/* ---------- The activity timeline ---------- */
.feed { display: flex; flex-direction: column; gap: 12px; }
.feed-day h4 { margin: 0 0 4px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); }
.feed ol { list-style: none; margin: 0; padding: 0; background: var(--card); border: 1px solid var(--line); border-radius: var(--rl); }
.ev { display: flex; align-items: center; gap: 10px; padding: 7px 12px; border-top: 1px solid var(--line2); min-width: 0; }
.ev:first-child { border-top: 0; }
.ev.failed { box-shadow: inset 3px 0 0 var(--danger); }
.ev-body { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; }
.ev-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ev-text .ev-who { color: var(--fg); font-weight: 600; text-decoration: none; }
.ev-text a { color: var(--fg); font-weight: 600; text-decoration: none; }
.ev-text a:hover { text-decoration: underline; }
.ev-actions { display: flex; gap: 6px; flex: none; }
.ev time { flex: none; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
@media (max-width: 640px) {
  .ev { align-items: flex-start; }
  .ev-body { flex-direction: column; align-items: flex-start; gap: 6px; }
  .ev-text { white-space: normal; overflow-wrap: anywhere; }
}

/* ---------- Agents ---------- */
.name-cell { min-width: 0; }
.name-cell a { font-weight: 600; }
form.rename input[type=text] { width: 180px; padding: 3px 7px; }
td.actions { text-align: right; width: 1%; }
@media (max-width: 640px) {
  .hide-sm { display: none; }
  /* Row actions stack instead of running past the card's edge. */
  td.actions .row.stack-sm { flex-direction: column; align-items: flex-end; gap: 4px; }
}

/* ---------- Apps list and the app page ---------- */
.r, th.r { text-align: right; }
.tiny { font-size: 11px; }
.clip { max-width: 340px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.apps-table .app-name { font-weight: 600; }
.views-cell { white-space: nowrap; }
.views-cell .num { display: inline-block; min-width: 44px; }
.views-cell svg.spark { display: inline-block; vertical-align: middle; width: 96px; margin-left: 6px; }
.live-n { white-space: nowrap; }
.app-h { align-items: center; }
.app-meta { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; margin: -8px 0 12px; min-width: 0; overflow-wrap: anywhere; }
.app-meta a { color: var(--fg); min-width: 0; }
.app-h h2 .dot { margin-right: 8px; }
button.tiny-btn { width: 24px; height: 24px; border: 0; }
.app-tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 14px; overflow-x: auto; scrollbar-width: none; }
.app-tabs::-webkit-scrollbar { display: none; }
.app-tabs a { flex: none; padding: 7px 10px; color: var(--muted); text-decoration: none; border-bottom: 2px solid transparent; white-space: nowrap; }
.app-tabs a:hover { color: var(--fg); }
.app-tabs a[aria-current=page] { color: var(--fg); font-weight: 600; border-bottom-color: var(--accent); }
.app-tabs .count { margin-left: 5px; font-size: 11px; color: var(--muted); font-weight: 400; }
.tab-body > * + * { margin-top: 12px; }
.tab-body h3 { margin-top: 22px; }
.overview-h p { margin: 0; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; background: var(--card); }
.seg a { padding: 3px 10px; font-size: 12.5px; color: var(--muted); text-decoration: none; border-left: 1px solid var(--line); }
.seg a:first-child { border-left: 0; }
.seg a[aria-current=true] { background: var(--hover); color: var(--fg); font-weight: 600; }
.kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: var(--rl); background: var(--card); }
.kpis > div { padding: 9px 12px; border-left: 1px solid var(--line); min-width: 0; display: flex; flex-direction: column; }
.kpis > div:first-child { border-left: 0; }
.kpis b { font-size: 18px; font-weight: 650; }
.kpis .alert b { color: var(--danger); }
@media (max-width: 760px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpis > div:nth-child(odd) { border-left: 0; }
  .kpis > div:nth-child(n+3) { border-top: 1px solid var(--line); }
}
.charts { display: flex; flex-direction: column; gap: 10px; }
.chart { background: var(--card); border: 1px solid var(--line); border-radius: var(--rl); padding: 10px 14px 8px; }
.chart-h { display: flex; align-items: baseline; gap: 8px; margin-bottom: 6px; }
.chart-h h4 { margin: 0; font-size: 13px; }
.chart-h b { margin-left: auto; font-size: 15px; }
.chart.note p { margin: 0; }
.plot { position: relative; height: 96px; margin-top: 14px; }
.plot-svg { display: block; width: 100%; height: 100%; overflow: visible; }
.plot-svg .grid { stroke: var(--line2); stroke-width: 1; }
.plot-svg .base { stroke: var(--line); stroke-width: 1; }
.plot-svg .line { fill: none; stroke: var(--accent); stroke-width: 1.75; stroke-linejoin: round; }
.plot-svg .area { fill: var(--accent); opacity: .09; }
.plot-svg .bar { fill: var(--danger); opacity: .85; }
.plot-svg .deploy { stroke: var(--faint); stroke-width: 1; stroke-dasharray: 3 3; }
.ymax { position: absolute; top: -2px; left: 0; font-size: 10.5px; color: var(--muted); background: var(--card); padding-right: 4px; font-variant-numeric: tabular-nums; }
.dmark { position: absolute; top: -15px; transform: translateX(-50%); font: 600 10px/1 var(--mono); color: var(--muted); background: var(--card); border: 1px solid var(--line); border-radius: 4px; padding: 1px 3px; white-space: nowrap; }
.dmark.live { color: var(--fg); border-color: var(--faint); }
.ticks { position: relative; height: 16px; margin-top: 3px; font-size: 10.5px; color: var(--muted); }
.ticks span { position: absolute; top: 0; white-space: nowrap; }
.ticks span:not(:first-child) { transform: translateX(-50%); }
@media (max-width: 640px) { .ticks span:nth-child(even) { display: none; } }
.chart-table { margin-top: 2px; }
.chart-table summary { font-size: 12px; }
.chart-table table { max-width: 360px; }
/* The path takes what the Views column leaves; a long one ends in an ellipsis (its title has it in full). */
td.path-cell { width: 100%; max-width: 0; }
.path-bar { position: relative; padding: 1px 6px; border-radius: 4px; overflow: hidden; }
.path-bar::before { content: ""; position: absolute; inset: 0 auto 0 0; width: var(--share); background: var(--accent); opacity: .1; }
.path-bar span { position: relative; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.env-form { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; gap: 8px; align-items: end; }
.env-form label { display: flex; flex-direction: column; gap: 3px; }
@media (max-width: 640px) { .env-form { grid-template-columns: minmax(0, 1fr); } }
.danger-zone { border-color: var(--danger); }
.danger-zone input[type=text] { width: 220px; max-width: 100%; }
/* ---------- Admin: overview, storage ---------- */
.kpis.n6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
@media (max-width: 760px) { .kpis.n6 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.two-col { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; }
@media (max-width: 900px) { .two-col { grid-template-columns: minmax(0, 1fr); } }
.two-col .sec-h { margin-top: 6px; }
/* The disk bar: one colour per category (never the accent, which is for actions), grey for what isn't Cubby's. */
:root { --s-db: #3b5bdb; --s-up: #0c8599; --s-cur: #2f9e44; --s-old: #f08c00; --s-bak: #7048e8; --s-snap: #c2255c; --s-oth: #868e96; --s-sys: #d4d4d4; }
@media (prefers-color-scheme: dark) { :root:not([data-theme=light]) { --s-db: #748ffc; --s-up: #3bc9db; --s-cur: #69db7c; --s-old: #ffc078; --s-bak: #9775fa; --s-snap: #f06595; --s-oth: #adb5bd; --s-sys: #404040; } }
:root[data-theme=dark] { --s-db: #748ffc; --s-up: #3bc9db; --s-cur: #69db7c; --s-old: #ffc078; --s-bak: #9775fa; --s-snap: #f06595; --s-oth: #adb5bd; --s-sys: #404040; }
.disk-bar { display: flex; height: 14px; border-radius: 4px; overflow: hidden; border: 1px solid var(--line); background: var(--card); }
.disk-bar span { display: block; height: 100%; min-width: 0; }
.disk-bar span + span { box-shadow: inset 1px 0 0 var(--card); }
.seg-database { background: var(--s-db); } .seg-uploads { background: var(--s-up); } .seg-current { background: var(--s-cur); }
.seg-older { background: var(--s-old); } .seg-backups { background: var(--s-bak); } .seg-snapshots { background: var(--s-snap); }
.seg-other { background: var(--s-oth); } .seg-system { background: var(--s-sys); } .seg-free { background: transparent; }
.legend { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 12.5px; color: var(--muted); }
.legend li { display: inline-flex; align-items: center; gap: 6px; }
.legend b { color: var(--fg); font-weight: 600; }
.legend .sw { width: 10px; height: 10px; border-radius: 2px; border: 1px solid var(--line); }
tr.detail > td { background: var(--hover); }
tr.detail table td { border-bottom-color: var(--line); }
a.btn.sm { padding: 3px 9px; font-size: 12.5px; }
.show-sm { display: none; }
@media (max-width: 640px) { .show-sm { display: block; } }
td .chip-copy { padding: 2px 7px; }
.warn { color: var(--warn); }

/* ---------- App data: clear, preview, restore ---------- */
.banner.notice { display: flex; gap: 12px; align-items: flex-start; flex-wrap: wrap; border-left-color: var(--danger); margin: 0 0 12px; }
.banner.notice b { color: var(--fg); }
.banner.notice p { margin: 2px 0 0; color: var(--muted); }
.grow-wrap { flex: 1; min-width: 200px; }
.check-cell { width: 1%; }
.dim { opacity: .5; }
.modes { border: 0; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.mode { display: flex; gap: 8px; align-items: baseline; cursor: pointer; }
.field { display: flex; flex-direction: column; gap: 3px; }
select, textarea, input[type=date] { font: inherit; padding: 7px 10px; border-radius: var(--r); border: 1px solid var(--line); background: var(--card); color: var(--fg); max-width: 100%; }
textarea { width: 100%; resize: vertical; }
.filter-box .chip-copy { padding: 2px 7px; }
.preview.stale { opacity: .55; }
.preview.stale::before { content: "The form changed since this preview: preview again."; display: block; font-size: 12px; color: var(--warn); margin-bottom: 4px; }
ul.plain { margin: 0; padding-left: 18px; }
caption.cap { text-align: left; padding: 4px 10px; }
.clip-wide { max-width: 520px; overflow-wrap: anywhere; }
button.danger.solid:not(:disabled) { background: var(--danger); border-color: var(--danger); color: var(--bg); font-weight: 600; }
.data-form h3 { margin-top: 18px; }
.result { border-left: 3px solid var(--ok); }
.result p { margin: 0 0 6px; }

@media (prefers-reduced-motion: no-preference) { .tab-body { animation: fade-in .15s ease-out; } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
