:root {
  /* light (default) — for the emotionally dark */
  --bg: #f7f6f2;
  --panel: #ffffff;
  --panel-2: #f1f0eb;
  --hover: #e9e8e2;
  --line: #e3e1da;
  --line-strong: #cfccc3;
  --text: #1b1d22;
  --muted: #6b6f78;
  --accent: #c6f24e;       /* radioactive slime */
  --accent-hover: #b8e639;
  --accent-ink: #14161a;
  --link: #4d7c0f;
  --ok: #15803d;
  --warn: #b45309;
  --bad: #dc2626;
  --idle: #6b7280;
  --header-bg: #f7f6f2e6;
  --input-bg: #ffffff;
  --glow: #c6f24e40;
  --sel: #c6f24e2e;
  --shadow: 0 1px 2px #0000000a, 0 4px 14px #0000000a;
  --chart: #65a30d;
  --chart-hot: #3f6212;
  --grid: #ebe9e3;
  --orange: #f38020;       /* Cloudflare */
  --radius: 12px;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --sans: 'Space Grotesk', system-ui, -apple-system, Segoe UI, sans-serif;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #0e0f12;
  --panel: #16181d;
  --panel-2: #1d2027;
  --hover: #242832;
  --line: #2a2e37;
  --line-strong: #3b404b;
  --text: #e8e6e1;
  --muted: #8b8f99;
  --accent-hover: #d4f86e;
  --link: #c6f24e;
  --ok: #4ade80;
  --warn: #fbbf24;
  --bad: #f87171;
  --header-bg: #0e0f12e6;
  --input-bg: #0b0c0f;
  --glow: #c6f24e18;
  --sel: #c6f24e10;
  --shadow: none;
  --chart: #a3d63a;
  --chart-hot: #d4f86e;
  --grid: #23262e;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 var(--sans); }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
code, pre, .mono { font-family: var(--mono); font-size: 13px; }
button { font: inherit; }
.boot { display: grid; place-items: center; height: 100vh; font-size: 48px; opacity: .4; }

/* ---------- auth screens ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px;
  background: radial-gradient(ellipse at 50% -10%, var(--glow), transparent 60%), var(--bg); }
.auth-card { width: 100%; max-width: 420px; background: var(--panel); border: 1px solid var(--line);
  border-radius: 18px; padding: 36px 32px; text-align: center; box-shadow: var(--shadow); }
.auth-card .can { font-size: 56px; line-height: 1; }
.auth-card h1 { margin: 14px 0 6px; font-size: 26px; letter-spacing: -.02em; }
.auth-card p { color: var(--muted); margin: 0 0 24px; }
.auth-card .btn { width: 100%; justify-content: center; padding: 13px 16px; font-size: 16px; }
.auth-card .fine { margin: 18px 0 0; font-size: 13px; }

/* ---------- shell ---------- */
header.top { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 12px 24px; background: var(--header-bg); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 17px; letter-spacing: -.01em; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand img { width: 28px; height: 28px; }
.brand sup { font-size: 11px; color: var(--link); }
nav.links { display: flex; gap: 4px; margin-left: auto; flex-wrap: wrap; }
nav.links a { color: var(--muted); padding: 6px 10px; border-radius: 8px; }
nav.links a:hover, nav.links a.on { color: var(--text); background: var(--panel-2); text-decoration: none; }
.who { color: var(--muted); font-size: 13px; }
.who b { color: var(--link); font-family: var(--mono); }
main { max-width: 1180px; margin: 0 auto; padding: 28px 24px 80px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head h2 { margin: 0; font-size: 24px; letter-spacing: -.02em; }
.page-head .sub { color: var(--muted); font-size: 14px; }
.crumb { color: var(--muted); font-size: 13px; margin-bottom: 4px; }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 9px; cursor: pointer;
  border: 1px solid var(--line); background: var(--panel-2); color: var(--text); font-weight: 500; white-space: nowrap; }
.btn:hover:not(:disabled) { border-color: var(--line-strong); background: var(--hover); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 700; }
.btn.primary:hover:not(:disabled) { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.danger { color: var(--bad); }
.btn.danger:hover:not(:disabled) { border-color: #f8717166; background: #f8717114; }
.btn.sm { padding: 5px 10px; font-size: 13px; border-radius: 7px; }
.btn.ghost { background: transparent; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------- project grid ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 16px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px;
  display: flex; flex-direction: column; gap: 14px; box-shadow: var(--shadow); }
.card:hover { border-color: var(--line-strong); }
.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.card h3 { margin: 0; font-size: 18px; letter-spacing: -.01em; }
.card h3 a { color: var(--text); }
.card .repo { color: var(--muted); font-family: var(--mono); font-size: 12px; }
.meta { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; font-size: 13px; }
.meta dt { color: var(--muted); }
.meta dd { margin: 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card .row { margin-top: auto; }
.empty { border: 1px dashed var(--line); border-radius: var(--radius); padding: 40px; text-align: center; color: var(--muted); }

/* ---------- badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 999px; font-size: 12px;
  font-weight: 600; border: 1px solid currentColor; white-space: nowrap; }
.badge::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge.running, .badge.succeeded, .badge.ok { color: var(--ok); }
.badge.degraded, .badge.warn { color: var(--warn); }
.badge.stopped, .badge.not-deployed, .badge.idle { color: var(--idle); }
.badge.failed, .badge.bad { color: var(--bad); }
.badge.running-deploy { color: var(--link); }
.badge.running-deploy::before { animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .2; } }

/* ---------- tabs & panels ---------- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 20px; overflow-x: auto; }
.tabs a { padding: 10px 14px; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a:hover { color: var(--text); text-decoration: none; }
.tabs a.on { color: var(--text); border-bottom-color: var(--link); }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 16px; box-shadow: var(--shadow); }
.panel h4 { margin: 0 0 12px; font-size: 14px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 820px) { .two { grid-template-columns: 1fr; } }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; color: var(--muted); font-weight: 500; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; }
th, td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tr.click { cursor: pointer; }
tr.click:hover td { background: var(--panel-2); }
tr.sel td { background: var(--sel); }
.muted { color: var(--muted); }

/* ---------- terminal ---------- */
.term { background: #08090b; border: 1px solid var(--line); border-radius: 10px; padding: 14px; height: 480px; overflow: auto;
  font: 12.5px/1.55 var(--mono); white-space: pre-wrap; word-break: break-all; color: #cfd3da; }
.term .ts { color: #5c6370; }
.term-bar { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }

/* ---------- forms ---------- */
label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 4px; }
input, textarea, select { width: 100%; background: var(--input-bg); color: var(--text); border: 1px solid var(--line); border-radius: 8px;
  padding: 9px 11px; font: 14px var(--sans); }
input:focus, textarea:focus { outline: none; border-color: var(--link); box-shadow: 0 0 0 3px var(--glow); }
input.mono { font-family: var(--mono); font-size: 13px; }
.field { margin-bottom: 14px; }
.hint { font-size: 12px; color: var(--muted); margin-top: 4px; }
.env-row { display: grid; grid-template-columns: minmax(140px, 1fr) 2fr auto auto; gap: 8px; margin-bottom: 8px; align-items: center; }
@media (max-width: 600px) { .env-row { grid-template-columns: 1fr auto auto; } .env-row input:first-child { grid-column: 1 / -1; } }

/* ---------- modal ---------- */
.modal-bg { position: fixed; inset: 0; background: #0008; display: grid; place-items: center; padding: 16px; z-index: 50; }
.modal { width: 100%; max-width: 520px; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 24px;
  max-height: 90vh; overflow: auto; }
.modal h3 { margin: 0 0 18px; }
.modal .actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }

/* ---------- toasts ---------- */
#toasts { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 100; max-width: calc(100vw - 32px); }
.toast { background: var(--panel-2); border: 1px solid var(--line); border-left: 3px solid var(--accent); border-radius: 10px;
  padding: 10px 14px; font-size: 14px; max-width: 420px; box-shadow: var(--shadow); animation: slide .2s ease-out; white-space: pre-wrap; }
.toast.err { border-left-color: var(--bad); }
@keyframes slide { from { transform: translateY(8px); opacity: 0; } }

footer.foot { text-align: center; color: var(--muted); font-size: 12px; padding: 24px; }

/* ---------- theme switch ---------- */
.theme-switch { display: inline-flex; align-items: center; gap: 8px; background: none; border: 0; padding: 4px; cursor: pointer;
  color: var(--muted); font-size: 13px; }
.theme-switch .track { position: relative; width: 44px; height: 24px; border-radius: 999px; background: var(--panel-2);
  border: 1px solid var(--line-strong); transition: background .2s; flex: none; }
.theme-switch .knob { position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: var(--accent);
  display: grid; place-items: center; font-size: 11px; line-height: 1; transition: transform .2s; }
:root[data-theme="dark"] .theme-switch .knob { transform: translateX(20px); }
.theme-switch:hover { color: var(--text); }
.theme-switch:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; border-radius: 6px; }
.auth .theme-switch { position: fixed; top: 16px; right: 16px; }
.quip { max-width: 190px; text-align: left; line-height: 1.25; }
@media (max-width: 900px) { .quip { display: none; } }

@media (max-width: 600px) {
  header.top { padding: 10px 16px; }
  main { padding: 20px 16px 60px; }
  .grid { grid-template-columns: 1fr; }
}

/* ---------- shared bits ---------- */
.small { font-size: 12px; }
.wrap { white-space: normal; word-break: break-word; max-width: 420px; }
.nowrap { flex-wrap: nowrap; }
.top-gap { margin-top: 10px; }
.tag { display: inline-block; padding: 1px 7px; border-radius: 6px; background: var(--panel-2); border: 1px solid var(--line);
  font: 600 11px var(--mono); margin: 0 4px 2px 0; white-space: nowrap; }
.tag-edit { border-color: var(--warn); color: var(--warn); }
.chk { font-weight: 700; }
.chk.ok { color: var(--ok); }
.chk.no { color: var(--bad); opacity: .7; }
tr.grp td { background: var(--panel-2); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
select { appearance: auto; cursor: pointer; max-width: 240px; }
.check { display: flex; align-items: center; gap: 8px; color: var(--text); font-size: 14px; margin-bottom: 14px; }
.check input { width: auto; }
.form-sub { margin: 18px 0 10px; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.crumb.big { font-size: 14px; margin-bottom: 14px; }
input.filter { max-width: 320px; }

/* ---------- connections / Cloudflare shell ---------- */
.cf-logo { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; background: #f380201f; color: var(--orange); font-size: 20px; flex: none; }
.cf-layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 24px; align-items: start; }
.cf-side { position: sticky; top: 76px; display: flex; flex-direction: column; gap: 2px; max-height: calc(100vh - 96px); overflow: auto; padding-bottom: 12px; }
.cf-acct { display: flex; gap: 10px; align-items: center; padding: 6px 8px 14px; border-bottom: 1px solid var(--line); margin-bottom: 8px; font-size: 13px; }
.cf-side a { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-radius: 8px; color: var(--text); font-size: 14px; }
.cf-side a:hover { background: var(--panel-2); text-decoration: none; }
.cf-side a.on { background: var(--sel); font-weight: 600; box-shadow: inset 3px 0 0 var(--link); }
.cf-side a.locked { color: var(--muted); }
.cf-side .ico { width: 20px; text-align: center; flex: none; }
.cf-side .lock { margin-left: auto; font-size: 11px; opacity: .7; }
.cf-side-h { padding: 14px 10px 4px; font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 600; }
.cf-body { min-width: 0; }
@media (max-width: 860px) {
  .cf-layout { grid-template-columns: 1fr; }
  .cf-side { position: static; flex-direction: row; flex-wrap: wrap; max-height: none; }
  .cf-acct { width: 100%; }
  .cf-zones { display: contents; }
  .cf-side-h { width: 100%; }
}
.policy { display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; align-items: start; padding: 10px 0; border-top: 1px solid var(--line); }
.policy .small { grid-column: 2; }

/* settings rows */
.qa { display: flex; flex-direction: column; }
.qa-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.qa-row:last-child { border-bottom: 0; }
.qa-row > div:first-child { min-width: 0; }
.setting-val { font-size: 12px; color: var(--muted); max-width: 50%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* toggle switch */
.switch { position: relative; width: 40px; height: 22px; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--panel-2);
  cursor: pointer; flex: none; padding: 0; transition: background .15s; }
.switch .switch-knob { position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--muted); transition: transform .15s, background .15s; }
.switch.on { background: var(--orange); border-color: var(--orange); }
.switch.on .switch-knob { transform: translateX(18px); background: #fff; }
.switch:disabled { opacity: .5; cursor: not-allowed; }

/* rulesets */
.rs { border: 1px solid var(--line); border-radius: 10px; margin-bottom: 8px; overflow: hidden; }
.rs-head { width: 100%; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 10px 12px; background: var(--panel-2);
  border: 0; color: var(--text); cursor: pointer; text-align: left; }
.rs-head:hover { background: var(--hover); }
.rs-detail { padding: 10px 12px; }

/* ---------- stat tiles & chart ---------- */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; margin-bottom: 20px; }
.tile { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; background: var(--panel); }
.tile-l { font-size: 12px; color: var(--muted); }
.tile-v { font-size: 26px; font-weight: 700; letter-spacing: -.02em; line-height: 1.2; margin-top: 2px; }
.tile-s { font-size: 12px; color: var(--muted); }
.chart { margin: 0; }
.chart figcaption { font-size: 13px; font-weight: 600; margin-bottom: 10px; }
.chart-grid { display: grid; grid-template-columns: 44px 1fr; height: 200px; }
.y-axis { display: flex; flex-direction: column; justify-content: space-between; font: 11px var(--mono); color: var(--muted); text-align: right; padding-right: 8px; transform: translateY(-6px); height: calc(100% + 12px); }
.plot-wrap { position: relative; border-bottom: 1px solid var(--line-strong); }
.gridlines { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: space-between; pointer-events: none; }
.gridlines span { border-top: 1px solid var(--grid); }
.gridlines span:last-child { border-top: 0; }
.bars { position: absolute; inset: 0; display: flex; align-items: stretch; gap: 2px; }
.bar-col { flex: 1; display: flex; align-items: flex-end; min-width: 0; cursor: default; outline: none; }
.bar { width: 100%; background: var(--chart); border-radius: 4px 4px 0 0; transition: background .1s; }
.bar-col.hot .bar, .bar-col:focus-visible .bar { background: var(--chart-hot); }
.tip { position: absolute; top: -8px; transform: translate(-50%, -100%); background: var(--panel); border: 1px solid var(--line-strong);
  border-radius: 8px; padding: 8px 10px; font-size: 12px; white-space: nowrap; box-shadow: 0 6px 20px #0002; pointer-events: none; z-index: 2; }
.x-axis { display: flex; gap: 2px; margin-left: 44px; font: 11px var(--mono); color: var(--muted); padding-top: 6px; }
.x-axis span { flex: 1; min-width: 0; white-space: nowrap; overflow: visible; }

/* ---------- docs ---------- */
.docs-side a { font-size: 13.5px; }
.doc-list { display: flex; flex-direction: column; }
.doc-item { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); color: var(--text); }
.doc-item:last-child { border-bottom: 0; }
.md { line-height: 1.65; overflow-wrap: anywhere; }
.md > :first-child { margin-top: 0; }
.md h1 { font-size: 26px; letter-spacing: -.02em; margin: 0 0 12px; }
.md h2 { font-size: 20px; margin: 28px 0 10px; padding-bottom: 6px; border-bottom: 1px solid var(--line); }
.md h3 { font-size: 16px; margin: 22px 0 8px; }
.md code { background: var(--panel-2); border: 1px solid var(--line); border-radius: 5px; padding: 1px 5px; font-size: 12.5px; }
.md pre { background: #08090b; color: #cfd3da; border-radius: 10px; padding: 14px; overflow-x: auto; }
.md pre code { background: none; border: 0; padding: 0; color: inherit; }
.md table { margin: 12px 0; display: block; overflow-x: auto; }
.md th, .md td { border: 1px solid var(--line); padding: 6px 10px; }
.md blockquote { margin: 12px 0; padding: 4px 14px; border-left: 3px solid var(--link); color: var(--muted); background: var(--panel-2); border-radius: 0 8px 8px 0; }
.md ul, .md ol { padding-left: 22px; }
.md hr { border: 0; border-top: 1px solid var(--line); margin: 24px 0; }
.edit-meta { display: grid; grid-template-columns: 2fr 1fr auto; gap: 12px; align-items: end; }
@media (max-width: 700px) { .edit-meta { grid-template-columns: 1fr; } }
.editor { min-height: 480px; resize: vertical; line-height: 1.55; }
.preview { min-height: 480px; max-height: 72vh; overflow: auto; margin: 0; }
.timeline { list-style: none; margin: 0; padding: 0 0 0 18px; border-left: 2px solid var(--line); }
.timeline li { position: relative; padding: 0 0 18px 14px; }
.timeline li::before { content: ''; position: absolute; left: -25px; top: 6px; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); border: 2px solid var(--panel); box-shadow: 0 0 0 1px var(--line-strong); }
.tl-head { display: flex; flex-wrap: wrap; gap: 8px; align-items: baseline; margin-bottom: 4px; }
.timeline .md { font-size: 14px; color: var(--text); }
.tl-del { position: absolute; top: -4px; right: 0; opacity: 0; }
.timeline li:hover .tl-del { opacity: 1; }
.kv-val { height: auto; max-height: 420px; }
details.perms summary { cursor: pointer; color: var(--link); font-weight: 500; }
.perm-list { display: flex; flex-wrap: wrap; gap: 2px; max-height: 360px; overflow: auto; }

/* ---------- TrashDash™ ---------- */
.td-grid { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 16px; align-items: start; }
@media (max-width: 960px) { .td-grid { grid-template-columns: 1fr; } }
.sec-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.sec-head h4 { margin: 0; }
.count { background: var(--accent); color: var(--accent-ink); font-weight: 700; font-size: 12px; border-radius: 999px; padding: 1px 9px; }

.ccc { padding: 0; overflow: hidden; }
.ccc-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding: 14px 18px 10px; }
.ccc-title { display: flex; align-items: center; gap: 12px; }
.ccc-title h3 { margin: 0; font-size: 18px; }
.ccc-name { position: relative; border-bottom: 2px dotted var(--link); cursor: help; outline: none; }
.ccc-tip { position: absolute; left: 0; top: calc(100% + 10px); width: min(340px, 80vw); background: var(--panel); border: 1px solid var(--line-strong);
  border-radius: 12px; padding: 12px 14px; font-size: 13px; font-weight: 400; line-height: 1.5; box-shadow: 0 10px 30px #0003; z-index: 20;
  display: flex; flex-direction: column; gap: 4px; opacity: 0; visibility: hidden; transform: translateY(-4px); transition: opacity .15s, transform .15s; }
.ccc-tip b { font-size: 14px; color: var(--link); }
.ccc-name:hover .ccc-tip, .ccc-name:focus .ccc-tip { opacity: 1; visibility: visible; transform: none; }
.ccc-tabs { display: flex; gap: 2px; padding: 0 12px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.ccc-tab { display: inline-flex; align-items: center; gap: 7px; padding: 8px 12px; background: none; border: 0; border-bottom: 2px solid transparent;
  color: var(--muted); font: inherit; font-size: 14px; white-space: nowrap; cursor: pointer; margin-bottom: -1px; }
.ccc-tab.on { color: var(--text); border-bottom-color: var(--link); font-weight: 600; }
.ccc-tab.ghost { cursor: default; font-size: 13px; opacity: .7; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--idle); }
.dot.live { background: var(--ok); box-shadow: 0 0 0 3px #15803d22; }
.ccc-frame { height: 560px; background: #0e0f12; }
.ccc-iframe { width: 100%; height: 100%; border: 0; display: block; }
.ccc-empty { height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 8px; padding: 24px; color: #e8e6e1; }
.ccc-empty .can { font-size: 44px; }
.ccc-empty .muted { color: #8b8f99; max-width: 460px; }
.ccc.ccc-full { position: fixed; inset: 0; z-index: 40; margin: 0; border-radius: 0; display: flex; flex-direction: column; }
.ccc.ccc-full .ccc-frame { flex: 1; height: auto; }
.check.inline { margin: 0; font-size: 13px; color: var(--muted); }

.approval { border: 1px solid var(--line); border-left: 4px solid var(--link); border-radius: 10px; padding: 12px 14px; margin-bottom: 12px; background: var(--panel); }
.approval.prio-high { border-left-color: var(--bad); }
.approval.prio-low { border-left-color: var(--idle); }
.approval-head { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; flex-wrap: wrap; margin-bottom: 6px; }
.approval .md { font-size: 14px; }
.approval-opts { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 6px; }
.opt-desc { margin: 4px 0 8px; padding-left: 18px; font-size: 13px; color: var(--muted); }
.approval-foot { display: flex; flex-direction: column; gap: 6px; }
.approval-foot textarea { font-size: 13px; }
details.answered { margin-top: 8px; }
details.answered summary { cursor: pointer; color: var(--muted); font-size: 13px; }
.answered-row { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.answered-row > span:nth-child(2) { grid-column: 1; }
.answered-row > span:nth-child(3) { grid-column: 2; grid-row: 1 / span 2; align-self: center; }

.snippet { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin-bottom: 10px; }
.snippet.done { opacity: .6; }
.snippet-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.snippet-head .tag { margin-left: 8px; }
.snippet p { margin: 6px 0; }
.snippet-body { margin: 8px 0 0; background: #08090b; color: #cfd3da; border-radius: 8px; padding: 10px 12px; font: 12px/1.5 var(--mono);
  overflow-x: auto; max-height: 260px; white-space: pre; }
.offscreen { position: fixed; left: -9999px; top: 0; }

.live-list { display: flex; flex-direction: column; }
.live-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); color: var(--text); }
.live-row:last-child { border-bottom: 0; }
.live-row:hover { text-decoration: none; background: var(--panel-2); }

/* ---------- TrashDash™ shell: brand, user menu ---------- */
.brand img { width: 30px; height: 30px; border-radius: 8px; }
.brand-name sup { font-size: 11px; color: var(--link); }
.boot img { opacity: .5; animation: pulse 1.2s infinite; }
.user-wrap { position: relative; }
.user-btn { display: inline-flex; align-items: center; gap: 8px; padding: 4px 10px 4px 4px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--panel); color: var(--text); font: inherit; font-size: 14px; cursor: pointer; }
.user-btn:hover { border-color: var(--line-strong); }
.user-btn img { width: 26px; height: 26px; border-radius: 50%; }
.user-name { font-family: var(--mono); font-weight: 600; }
.caret { color: var(--muted); font-size: 11px; }
.menu { position: absolute; right: 0; top: calc(100% + 8px); min-width: 260px; background: var(--panel); border: 1px solid var(--line-strong);
  border-radius: 12px; padding: 6px; box-shadow: 0 12px 32px #0003; z-index: 60; }
.menu-head { padding: 8px 10px 10px; font-size: 13px; color: var(--muted); border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.menu-head b { color: var(--text); font-family: var(--mono); }
.menu-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border: 0; border-radius: 8px; background: none;
  color: var(--text); font: inherit; font-size: 14px; text-align: left; cursor: pointer; }
.menu-item:hover, .menu-item:focus-visible { background: var(--panel-2); outline: none; }
.mi-ico { width: 22px; text-align: center; flex: none; }
.menu-theme { padding: 6px 4px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); margin: 4px 0; }
.menu-theme .quip { display: inline; max-width: none; }

/* ---------- chat-first home ---------- */
main.main-ccc { max-width: none; padding: 16px 20px; }
.ccc-layout { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 16px; align-items: start; }
.ccc-layout > .ccc { position: sticky; top: 72px; margin: 0; height: calc(100vh - 104px); display: flex; flex-direction: column; }
.ccc-layout .ccc-frame { flex: 1; height: auto; min-height: 0; }
.ccc-side { display: flex; flex-direction: column; gap: 0; min-width: 0; }
.tiles-3 { grid-template-columns: repeat(3, 1fr); }
.tiles-3 .tile-v { font-size: 20px; }
.ccc-empty-ico { width: 72px; height: 72px; border-radius: 16px; }
@media (max-width: 1100px) {
  .ccc-layout { grid-template-columns: 1fr; }
  .ccc-layout > .ccc { position: static; height: 70vh; }
}

/* QR / companion modal */
.companion { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.companion .qr { width: 220px; height: 220px; image-rendering: pixelated; border-radius: 10px; background: #fff; padding: 6px; }
.companion .steps { align-self: stretch; padding-left: 20px; margin: 6px 0; line-height: 1.6; }

/* ---------- phone layout (iPhone / installed app) ---------- */
.phone body { overscroll-behavior: none; }
.phone header.top { padding: calc(env(safe-area-inset-top) + 8px) 14px 8px; gap: 10px; flex-wrap: nowrap; }
.phone .brand-name { display: none; }
.phone-title { font-weight: 700; font-size: 17px; flex: 1; }
.phone .user-name, .phone .caret { display: none; }
.phone .user-btn { padding: 3px; }
.phone .menu { position: fixed; right: 10px; left: 10px; top: calc(env(safe-area-inset-top) + 56px); }
.phone main { padding: 12px 12px calc(76px + env(safe-area-inset-bottom)); }
.phone main.main-ccc { padding: 0; }
.phone .ccc { border-radius: 0; border-left: 0; border-right: 0; margin: 0; height: calc(100dvh - 56px - 62px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
  display: flex; flex-direction: column; }
.phone .ccc .ccc-frame { flex: 1; height: auto; min-height: 0; }
.phone .ccc-head { padding: 8px 12px; }
.phone .ccc-tabs { display: none; }
.phone .ccc-tip { left: -8px; }
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: flex; justify-content: space-around;
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); background: var(--header-bg); backdrop-filter: blur(10px); border-top: 1px solid var(--line); }
.tab { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 4px 8px; min-width: 60px; color: var(--muted); font-size: 11px; }
.tab:hover { text-decoration: none; }
.tab.on { color: var(--text); font-weight: 600; }
.tab-ico { position: relative; font-size: 20px; line-height: 1.2; }
.tab.on .tab-ico { filter: drop-shadow(0 0 6px var(--glow)); }
.tab-badge { position: absolute; top: -4px; right: -12px; min-width: 18px; padding: 0 5px; border-radius: 999px; background: var(--bad); color: #fff;
  font-size: 11px; font-weight: 700; line-height: 18px; text-align: center; }
.more-list { padding: 4px 0; }
.more-row { display: flex; align-items: center; gap: 12px; padding: 14px 16px; color: var(--text); border-bottom: 1px solid var(--line); }
.more-row:last-child { border-bottom: 0; }
.more-row:hover { text-decoration: none; background: var(--panel-2); }
.more-row > span:nth-child(2) { flex: 1; display: flex; flex-direction: column; }
.phone .page-head h2 { font-size: 20px; }
.phone .grid { grid-template-columns: 1fr; }
.ccc-frame { position: relative; }
.ccc-latest { position: absolute; right: 14px; bottom: 14px; z-index: 2; box-shadow: 0 6px 18px #0006; }
.ccc-iframe { touch-action: none; }
.composer { border-top: 1px solid var(--line); background: var(--panel); padding: 6px 8px 8px; }
.keys { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 6px; }
.key { flex: none; min-width: 44px; padding: 6px 10px; border-radius: 8px; border: 1px solid var(--line-strong); background: var(--panel-2);
  color: var(--text); font: 600 13px var(--mono); cursor: pointer; }
.key:active { background: var(--hover); }
.composer-row { display: flex; gap: 8px; align-items: flex-end; }
.composer-input { flex: 1; resize: none; font-size: 16px; line-height: 1.35; max-height: 140px; }

/* ---------- Mobile Companion ---------- */
.link-panel h3 { margin: 0 0 12px; }
.link-row { display: flex; gap: 24px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.qr { background: #fff; padding: 8px; border-radius: 12px; image-rendering: pixelated; }
.qr-wrap { position: relative; }
.code-input { width: 140px; font: 700 28px var(--mono); letter-spacing: .3em; text-align: center; }
.progress { list-style: none; padding: 0; margin: 0 0 14px; line-height: 2; }
.progress li { color: var(--muted); }
.progress li.done { color: var(--ok); font-weight: 600; }
.phone-link { display: flex; flex-direction: column; gap: 12px; align-items: stretch; text-align: center; }
.phone-link h3 { margin: 4px 0 0; }
.btn.big { padding: 14px 18px; font-size: 17px; justify-content: center; }
.scan-box { position: relative; border-radius: 16px; overflow: hidden; background: #000; aspect-ratio: 1; }
.scan-video { width: 100%; height: 100%; object-fit: cover; display: block; }
.scan-frame { position: absolute; inset: 18%; border: 3px solid var(--accent); border-radius: 14px; box-shadow: 0 0 0 999px #0007; }
.big-code { display: flex; justify-content: center; gap: 10px; margin: 10px 0; }
.big-code span { width: 56px; height: 72px; display: grid; place-items: center; border-radius: 12px; background: var(--panel-2);
  border: 1px solid var(--line-strong); font: 700 40px var(--mono); }
.linked img { width: 96px; height: 96px; border-radius: 22px; }
.auth-logo { width: 88px; height: 88px; border-radius: 20px; }
.link-phone { width: 100%; justify-content: center; margin-top: 10px; }
.auth-link { width: 100%; max-width: 420px; }
.auth-link main { padding: 0; }
.servers-grid { margin-bottom: 16px; }
table.sessions td { vertical-align: top; }
table.sessions .notes { min-width: 160px; font-size: 13px; padding: 6px 8px; resize: vertical; }
table.sessions .role-sel { font-size: 13px; padding: 5px 6px; }
tr.untracked td { opacity: .5; }
tr.summary-row td { background: var(--panel-2); border-top: 0; }
.bw-list { display: flex; flex-direction: column; }
.bw-row { display: flex; align-items: center; gap: 12px; padding: 10px 4px; border-bottom: 1px solid var(--line); }
.bw-row:last-child { border-bottom: 0; }
.bw-ico { font-size: 20px; width: 28px; text-align: center; flex: none; }
.bw-main { flex: 1; min-width: 0; }
.bw-main > * { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.unlock-input { max-width: 320px; }
.phone .bw-row { flex-wrap: wrap; }
.phone .bw-row > .row { width: 100%; justify-content: flex-end; }
.uc-bar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; padding: 10px 14px; margin-bottom: 14px; border: 1px solid var(--line);
  border-radius: 10px; background: var(--panel); font-size: 14px; }
.vault-asks { border-color: var(--link); }
.bw-shown { margin-top: 6px; padding: 6px 10px; border-radius: 8px; background: var(--panel-2); border: 1px dashed var(--line-strong);
  font-size: 14px; white-space: pre-wrap; word-break: break-all; user-select: all; }
.btn.eye { padding: 8px 10px; }
/* ---------- Status ---------- */
.status-product .sec-head h3 { margin: 0; font-size: 18px; }
.feed { margin: 4px 0 14px; }
.comps { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.comp { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; border: 1px solid var(--line); font-size: 13px; }
.comp .dot { width: 8px; height: 8px; border-radius: 50%; }
.comp.ok .dot { background: var(--ok); }
.comp.bad .dot { background: var(--bad); }
.status-table td { vertical-align: middle; }
.ribbon { display: flex; gap: 1px; align-items: stretch; height: 26px; min-width: 260px; }
.ribbon .cell { flex: 1; min-width: 2px; border-radius: 2px; background: var(--line); }
.ribbon .cell.ok { background: var(--ok); opacity: .75; }
.ribbon .cell.warn { background: var(--warn); }
.ribbon .cell.bad { background: var(--bad); }
.ribbon .cell:hover { opacity: 1; outline: 2px solid var(--text); outline-offset: -1px; }
.comp-group { margin-top: 8px; }
.comp-group-h { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: 4px; }
.comp.warn .dot { background: var(--warn); }
.comp.maint .dot { background: var(--link); }
.comp.none .dot { background: var(--idle); }
.ind-ok { color: var(--ok); } .ind-warn { color: var(--warn); } .ind-bad { color: var(--bad); }
.feed-event { margin-top: 10px; padding: 8px 12px; border-left: 3px solid var(--warn); background: var(--panel-2); border-radius: 0 8px 8px 0; }
.feed-event.maintenance { border-left-color: var(--link); }
.ccc-state { font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); white-space: nowrap; }
.ccc-state:hover { text-decoration: none; }
.ccc-state.working { color: var(--ok); border-color: var(--ok); }
.ccc-state.working::first-letter { animation: pulse 1s infinite; }
.ccc-state.waiting { color: var(--accent-ink); background: var(--warn); border-color: var(--warn); }
.phone .ccc-state { font-size: 11px; padding: 2px 8px; }
/* ---------- Usage ---------- */
.tiles-2 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.meter .meter-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.meter .tile-v { font-size: 34px; }
.bar-track { height: 10px; border-radius: 999px; background: var(--panel-2); border: 1px solid var(--line); overflow: hidden; margin: 8px 0 6px; }
.bar-fill { height: 100%; border-radius: 999px; }
.bar-fill.ok { background: var(--ok); } .bar-fill.warn { background: var(--warn); } .bar-fill.bad { background: var(--bad); }
.advice { padding: 10px 14px; border-radius: 10px; background: var(--panel-2); border-left: 4px solid var(--ok); font-weight: 600; }
.advice.warn { border-left-color: var(--warn); } .advice.bad { border-left-color: var(--bad); }
.chart-wrap { position: relative; }
.usage-chart { width: 100%; height: auto; display: block; }
.usage-chart .gl { stroke: var(--grid); stroke-width: 1; }
.usage-chart .ax { fill: var(--muted); font: 11px var(--mono); }
.usage-chart .line-a { fill: none; stroke: var(--chart); stroke-width: 2; stroke-linejoin: round; }
.usage-chart .line-b { fill: none; stroke: var(--link); stroke-width: 2; stroke-dasharray: 6 4; opacity: .8; }
.usage-chart .cross { stroke: var(--line-strong); stroke-width: 1; }
.usage-chart .dot-a { fill: var(--chart); stroke: var(--panel); stroke-width: 2; }
.usage-chart .dot-b { fill: var(--link); stroke: var(--panel); stroke-width: 2; }
.legend { display: flex; gap: 16px; font-size: 13px; margin-bottom: 6px; }
.legend .key::before { content: ''; display: inline-block; width: 18px; height: 0; border-top: 2px solid var(--chart); vertical-align: middle; margin-right: 6px; }
.legend .key.b::before { border-top: 2px dashed var(--link); }
.ccc-state.plan { text-decoration: none; }
