:root {
  --bg: #08080b;
  --bg-2: #101015;
  --panel: #14141b;
  --panel-2: #1b1b24;
  --line: #262632;
  --line-2: #33333f;
  --text: #ececf1;
  --muted: #9a9aab;
  --faint: #6b6b7b;
  --accent: #7cffb2;
  --accent-ink: #062414;
  --ok: #7cffb2;
  --warn: #ffcc66;
  --err: #ff6b7a;
  --info: #8ab4ff;
  --mono: ui-monospace, 'SF Mono', 'JetBrains Mono', Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', Roboto, sans-serif;
  --radius: 10px;
  --p-tutorial: #8ab4ff;
  --p-dj: #c792ff;
  --p-discovery: #ffcc66;
  --p-own_music: #7cffb2;
  --p-perspective: #ff9f6b;
  --p-stories: #5fe0e6;
  --p-experimental: #ff6bd5;
  --p-none: #6b6b7b;
}
@media (prefers-color-scheme: light) {
  :root {
    --bg: #f5f5f7;
    --bg-2: #ececf0;
    --panel: #ffffff;
    --panel-2: #f4f4f7;
    --line: #dedee5;
    --line-2: #cfcfd8;
    --text: #15151b;
    --muted: #5d5d6c;
    --faint: #8a8a99;
    --accent: #0f9d58;
    --accent-ink: #ffffff;
    --ok: #0f9d58;
    --warn: #b7791f;
    --err: #d93848;
    --info: #2f6fdb;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text); font-family: var(--sans); font-size: 14px; line-height: 1.45; }
body { min-height: 100vh; }
a { color: var(--accent); }
h1, h2, h3, h4 { margin: 0 0 0.5em; line-height: 1.25; }
h1 { font-size: 20px; }
h2 { font-size: 16px; }
h3 { font-size: 14px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; font-weight: 600; }
p { margin: 0 0 0.6em; }
.boot { padding: 40px; color: var(--muted); }
.mono, .num { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 12px; }
.err-text { color: var(--err); }
.warn-text { color: var(--warn); }
.ok-text { color: var(--ok); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* layout */
.shell { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }
.nav { background: var(--bg-2); border-right: 1px solid var(--line); padding: 16px 10px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { font-weight: 700; letter-spacing: 0.04em; padding: 4px 10px 16px; font-size: 15px; }
.brand span { color: var(--accent); }
.nav a { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 8px; color: var(--muted); text-decoration: none; }
.nav a:hover { background: var(--panel); color: var(--text); }
.nav a.active { background: var(--panel-2); color: var(--text); box-shadow: inset 3px 0 0 var(--accent); }
.nav .count { margin-left: auto; font-family: var(--mono); font-size: 11px; background: var(--err); color: #fff; border-radius: 999px; padding: 0 6px; }
.main { min-width: 0; display: flex; flex-direction: column; }
.content { padding: 20px 24px 60px; max-width: 1400px; width: 100%; }
.topbar { display: none; }
.statusbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 10px 24px; border-bottom: 1px solid var(--line); background: var(--bg-2); position: sticky; top: 0; z-index: 5; }
.statusbar .spacer { flex: 1; }
.paused-banner { background: var(--err); color: #fff; font-weight: 700; padding: 8px 24px; letter-spacing: 0.05em; }
.dev-banner { background: color-mix(in srgb, var(--warn) 18%, transparent); color: var(--warn); padding: 6px 24px; font-size: 12px; border-bottom: 1px solid var(--line); }
.page-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 16px; }
.page-head h1 { margin: 0; }
.page-head .spacer { flex: 1; }

@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .nav { position: fixed; inset: 0 30% 0 0; z-index: 30; transform: translateX(-105%); transition: transform 0.2s; height: 100vh; }
  .nav.open { transform: none; box-shadow: 0 0 0 100vmax rgba(0,0,0,0.5); }
  .topbar { display: flex; align-items: center; gap: 10px; padding: 10px 16px; border-bottom: 1px solid var(--line); background: var(--bg-2); }
  .statusbar { padding: 8px 16px; top: 0; }
  .content { padding: 16px 16px 60px; }
  .paused-banner, .dev-banner { padding-left: 16px; padding-right: 16px; }
}

/* grid / cards */
.grid { display: grid; gap: 14px; }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1100px) { .grid.cols-3, .grid.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 680px) { .grid.cols-2, .grid.cols-3, .grid.cols-4 { grid-template-columns: 1fr; } }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; min-width: 0; }
.card-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.card-head h2, .card-head h3 { margin: 0; }
.card-head .spacer { flex: 1; }
.card.danger { border-color: var(--err); }
.card.warn { border-color: var(--warn); }
.stat { font-family: var(--mono); font-size: 26px; font-weight: 600; }
.stat-label { color: var(--muted); font-size: 12px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: 8px; }
.list { list-style: none; margin: 0; padding: 0; }
.list li { padding: 8px 0; border-bottom: 1px solid var(--line); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.list li:last-child { border-bottom: none; }
.list li .grow { flex: 1; min-width: 0; }
.clickable { cursor: pointer; }
.clickable:hover { background: var(--panel-2); }
.note { background: var(--panel-2); border: 1px dashed var(--line-2); border-radius: 8px; padding: 10px 12px; color: var(--muted); font-size: 13px; }
.banner { border-radius: 8px; padding: 10px 12px; margin-bottom: 12px; border: 1px solid; }
.banner.error { border-color: var(--err); background: color-mix(in srgb, var(--err) 12%, transparent); }
.banner.warn { border-color: var(--warn); background: color-mix(in srgb, var(--warn) 10%, transparent); }
.banner.info { border-color: var(--info); background: color-mix(in srgb, var(--info) 10%, transparent); }
.banner ul { margin: 4px 0 0; padding-left: 18px; }

/* badges */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; border: 1px solid var(--line-2); color: var(--muted); white-space: nowrap; }
.badge.ok { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 50%, transparent); }
.badge.warn { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 50%, transparent); }
.badge.err { color: var(--err); border-color: color-mix(in srgb, var(--err) 60%, transparent); background: color-mix(in srgb, var(--err) 10%, transparent); }
.badge.info { color: var(--info); border-color: color-mix(in srgb, var(--info) 50%, transparent); }
.badge.accent { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.badge.demo { background: var(--warn); color: #000; border-color: var(--warn); }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; background: var(--faint); flex: none; }
.dot.ok { background: var(--ok); box-shadow: 0 0 6px var(--ok); }
.dot.warn { background: var(--warn); }
.dot.err { background: var(--err); }
.pillar { display: inline-block; width: 4px; align-self: stretch; border-radius: 2px; }

/* forms */
button, .btn { font: inherit; border: 1px solid var(--line-2); background: var(--panel-2); color: var(--text); border-radius: 8px; padding: 6px 12px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; text-decoration: none; }
button:hover:not(:disabled) { border-color: var(--accent); }
button:disabled { opacity: 0.45; cursor: not-allowed; }
button.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
button.danger { border-color: var(--err); color: var(--err); }
button.danger.solid { background: var(--err); color: #fff; }
button.ghost { background: transparent; border-color: transparent; color: var(--muted); }
button.small { padding: 3px 8px; font-size: 12px; }
button.big { padding: 12px 18px; font-size: 15px; font-weight: 700; }
input, select, textarea { font: inherit; background: var(--bg-2); color: var(--text); border: 1px solid var(--line-2); border-radius: 8px; padding: 6px 9px; width: 100%; min-width: 0; }
textarea { font-family: var(--mono); font-size: 12.5px; resize: vertical; }
textarea.prose { font-family: var(--sans); font-size: 14px; }
input[type='checkbox'], input[type='radio'] { width: auto; accent-color: var(--accent); }
input.invalid, textarea.invalid { border-color: var(--err); }
label.field { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
label.field > span.hint { color: var(--faint); font-size: 11px; }
label.check { display: inline-flex; gap: 6px; align-items: center; font-size: 13px; color: var(--text); cursor: pointer; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 14px; }
.form-grid .full { grid-column: 1 / -1; }
@media (max-width: 680px) { .form-grid { grid-template-columns: 1fr; } }
.switch { position: relative; width: 38px; height: 22px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch span { position: absolute; inset: 0; background: var(--line-2); border-radius: 999px; transition: 0.15s; cursor: pointer; }
.switch span::before { content: ''; position: absolute; width: 16px; height: 16px; left: 3px; top: 3px; background: var(--text); border-radius: 50%; transition: 0.15s; }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::before { transform: translateX(16px); background: var(--accent-ink); }
.switch input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 14px; flex-wrap: wrap; }
.tabs button { border: none; background: none; border-bottom: 2px solid transparent; border-radius: 0; color: var(--muted); padding: 8px 12px; }
.tabs button.active { color: var(--text); border-bottom-color: var(--accent); }
.seg { display: inline-flex; border: 1px solid var(--line-2); border-radius: 8px; overflow: hidden; }
.seg button { border: none; border-radius: 0; background: transparent; }
.seg button.active { background: var(--panel-2); color: var(--accent); }

/* tables */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); }
table { border-collapse: collapse; width: 100%; font-size: 13px; }
th, td { text-align: left; padding: 7px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: 12px; background: var(--bg-2); position: sticky; top: 0; white-space: nowrap; }
tr:last-child td { border-bottom: none; }
td.num, th.num { text-align: right; font-family: var(--mono); }
tr.clickable:hover td { background: var(--panel-2); }
tr.stale td { opacity: 0.55; }

/* modal & drawer */
.modal-back { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.6); z-index: 40; display: flex; align-items: flex-start; justify-content: center; padding: 40px 16px; overflow-y: auto; }
.modal { background: var(--panel); border: 1px solid var(--line-2); border-radius: 14px; width: min(980px, 100%); padding: 18px 20px; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5); }
.modal.narrow { width: min(520px, 100%); }
.modal-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.modal-head h2 { margin: 0; flex: 1; }
.modal-foot { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; flex-wrap: wrap; }
.drawer-back { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.5); z-index: 40; display: flex; justify-content: flex-end; }
.drawer { background: var(--panel); border-left: 1px solid var(--line-2); width: min(560px, 100%); height: 100%; overflow-y: auto; padding: 18px 20px; }
@media (max-width: 680px) { .modal-back { padding: 0; } .modal { border-radius: 0; min-height: 100vh; } }

/* toasts */
.toasts { position: fixed; bottom: 16px; right: 16px; z-index: 60; display: flex; flex-direction: column; gap: 8px; max-width: min(420px, calc(100vw - 32px)); }
.toast { background: var(--panel-2); border: 1px solid var(--line-2); border-left: 4px solid var(--info); border-radius: 8px; padding: 10px 12px; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4); }
.toast.error { border-left-color: var(--err); }
.toast.ok { border-left-color: var(--ok); }
.toast.warn { border-left-color: var(--warn); }

/* calendar */
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.cal-head { color: var(--muted); font-size: 12px; text-align: center; padding: 4px 0; }
.cal-day { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; min-height: 120px; padding: 6px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.cal.month .cal-day { min-height: 92px; }
.cal-day.today { border-color: var(--accent); }
.cal-day.other { opacity: 0.45; }
.cal-day.drop { background: color-mix(in srgb, var(--accent) 12%, var(--panel)); }
.cal-day .dnum { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.cal-item { border-radius: 6px; padding: 3px 6px; font-size: 12px; background: var(--panel-2); border-left: 3px solid var(--p-none); cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-item.draft { border-style: dashed; opacity: 0.8; }
.cal-item.published { opacity: 0.7; }
.cal-item.experiment { background: repeating-linear-gradient(135deg, var(--panel-2), var(--panel-2) 6px, color-mix(in srgb, var(--p-experimental) 14%, var(--panel-2)) 6px, color-mix(in srgb, var(--p-experimental) 14%, var(--panel-2)) 12px); }
.cal-item[draggable='true'] { cursor: grab; }
.cal-layout { display: grid; grid-template-columns: 1fr 240px; gap: 14px; }
@media (max-width: 1100px) { .cal-layout { grid-template-columns: 1fr; } }
@media (max-width: 680px) { .cal { grid-template-columns: 1fr; } .cal-head { display: none; } .cal-day { min-height: 0; } .cal.month .cal-day.other { display: none; } }

/* kanban */
.kanban { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(220px, 1fr); gap: 10px; overflow-x: auto; padding-bottom: 8px; }
.kcol { background: var(--bg-2); border: 1px solid var(--line); border-radius: 10px; padding: 8px; min-height: 200px; }
.kcol h3 { display: flex; justify-content: space-between; }
.kcard { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 8px; margin-bottom: 6px; cursor: pointer; display: flex; gap: 8px; }
.kcard:hover { border-color: var(--line-2); }
.kcard .t { font-weight: 600; font-size: 13px; }

/* checks */
.checks { list-style: none; margin: 0; padding: 0; }
.checks li { display: grid; grid-template-columns: 22px 1fr; gap: 6px; padding: 5px 0; border-bottom: 1px solid var(--line); }
.checks li .ico { font-weight: 700; text-align: center; }
.ico.pass { color: var(--ok); } .ico.warn { color: var(--warn); } .ico.block { color: var(--err); } .ico.skipped { color: var(--faint); }

/* trends */
.trend-card.stale { opacity: 0.55; filter: grayscale(0.7); }
.meter { height: 6px; background: var(--line); border-radius: 999px; overflow: hidden; }
.meter > i { display: block; height: 100%; background: var(--accent); }
.meter.warn > i { background: var(--warn); }
.meter.err > i { background: var(--err); }

/* charts */
svg.chart { width: 100%; height: auto; display: block; }
svg.chart text { fill: var(--muted); font-size: 11px; font-family: var(--mono); }
svg.chart .bar { fill: var(--accent); }
svg.chart .bar.low { fill: var(--faint); }
svg.chart .axis { stroke: var(--line-2); }
svg.chart .line { stroke: var(--accent); fill: none; stroke-width: 2; }
pre.json { background: var(--bg-2); border: 1px solid var(--line); border-radius: 8px; padding: 8px; font-size: 12px; overflow: auto; max-height: 260px; margin: 0; white-space: pre-wrap; word-break: break-word; }
details summary { cursor: pointer; color: var(--muted); }
.empty { color: var(--faint); padding: 14px; text-align: center; font-size: 13px; }
.preview video, .preview img, .preview audio { width: 100%; max-height: 320px; border-radius: 8px; background: #000; }
.lock { color: var(--warn); }
