:root {
  --bg: #f6f4ef; --panel: #fffdf9; --ink: #13202d; --muted: #5d6673; --line: #e4ddd0;
  --accent: #14304a; --accent-ink: #fffdf9; --gold: #9a7a43;
  --ok: #2f7d4f; --warn: #9a6a12; --bad: #a33a2b;
  --series: #1f5c99; --grid: #e8e3d8;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1620; --panel: #15202d; --ink: #e9edf1; --muted: #9ba7b5; --line: #263445;
    --accent: #c9a462; --accent-ink: #0e1620; --gold: #d2b072;
    --ok: #5fc28a; --warn: #e2b04a; --bad: #ef7b6a;
    --series: #5b9be0; --grid: #223042;
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif; }
a { color: inherit; }
.top { display: flex; gap: 12px; align-items: center; justify-content: space-between; padding: 14px 16px; background: var(--panel); border-bottom: 1px solid var(--line); }
.brandline { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.product { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--gold); }
.demo { letter-spacing: .06em; color: var(--muted); }
.brandline strong { font-size: 18px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who { font-size: 13px; color: var(--muted); text-align: right; }
.banner { padding: 8px 16px; background: var(--accent); color: var(--accent-ink); font-size: 14px; }
.nav { display: flex; gap: 4px; padding: 0 12px; overflow-x: auto; background: var(--panel); border-bottom: 1px solid var(--line); scrollbar-width: none; }
.nav a { padding: 10px 10px; text-decoration: none; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; font-size: 14px; }
.nav a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--gold); }
main { max-width: 1100px; margin: 0 auto; padding: 16px; display: grid; gap: 16px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 16px; min-width: 0; }
.card h2 { margin: 0 0 6px; font-size: 17px; }
.card h3 { margin: 14px 0 4px; font-size: 14px; color: var(--muted); font-weight: 600; }
.head { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; justify-content: space-between; }
.head h1 { margin: 0; font-size: 22px; font-weight: 600; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.muted { color: var(--muted); }
.hint { color: var(--muted); font-size: 13px; margin: 8px 0 0; }
.hint b { color: var(--ink); font-weight: 600; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.tile { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.tile .label { font-size: 13px; color: var(--muted); }
.tile .value { display: block; font-size: 24px; font-weight: 600; margin-top: 2px; }
.tile .sub { font-size: 12px; color: var(--muted); }
.pill { padding: 2px 10px; border-radius: 999px; font-size: 13px; border: 1px solid var(--line); }
.pill.ok { color: var(--ok); border-color: currentColor; } .pill.warn { color: var(--warn); border-color: currentColor; }
button { font: inherit; padding: 7px 14px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); cursor: pointer; }
button.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
button:disabled { opacity: .5; cursor: default; }
input, select, textarea { font: inherit; padding: 6px 8px; border-radius: 6px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); max-width: 100%; }
textarea { width: 100%; min-height: 64px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 7px 8px; border-top: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 500; }
.scroll { overflow-x: auto; }
dialog { border: 1px solid var(--line); border-radius: 12px; background: var(--panel); color: var(--ink); max-width: min(560px, 92vw); }
dialog::backdrop { background: rgb(0 0 0 / .35); }
dialog:has(.mail-preview) { max-width: min(680px, 96vw); width: 100%; }
.mail-preview { width: 100%; height: min(70vh, 640px); border: 1px solid var(--line); border-radius: 8px; background: #f6f4ef; }
.codes { font-family: ui-monospace, monospace; display: grid; grid-template-columns: repeat(2, 1fr); gap: 4px 16px; }
.link { font-family: ui-monospace, monospace; font-size: 13px; word-break: break-all; padding: 8px; border: 1px dashed var(--line); border-radius: 8px; }
.error { color: var(--bad); }
.done { color: var(--ok); }
.center { max-width: 440px; margin: 8vh auto; text-align: center; }
.charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 12px; margin-top: 8px; }
.chart { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; min-width: 0; }
.chart .title { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; color: var(--muted); }
.chart .title b { color: var(--ink); font-weight: 600; text-align: right; }
.chart svg { width: 100%; display: block; }
.chart svg.bars { height: 120px; }
.chart svg.heatmap { height: auto; aspect-ratio: 16 / 9; }
.chart .frame { fill: none; stroke: var(--grid); stroke-width: 1; vector-effect: non-scaling-stroke; }
.chart .grid { stroke: var(--grid); stroke-width: 1; vector-effect: non-scaling-stroke; }
.mark { fill: var(--series); }
.chart .hit { fill: transparent; }
.chart .hit:hover + .mark, .chart .mark.on { opacity: .75; }
.chart .axis { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); }
.bar-row { display: grid; grid-template-columns: minmax(80px, 34%) 1fr auto; gap: 8px; align-items: center; font-size: 13px; margin: 4px 0; }
.bar-row svg { width: 100%; height: 10px; display: block; }
.bar-row .value { text-align: right; white-space: nowrap; }
.tag { font-size: 11px; padding: 1px 6px; border-radius: 6px; border: 1px solid var(--warn); color: var(--warn); margin-left: 4px; white-space: nowrap; }
.actor-staff { font-size: 11px; padding: 1px 6px; border-radius: 6px; background: var(--accent); color: var(--accent-ink); margin-left: 4px; }
button.info { padding: 0; width: 20px; height: 20px; margin-left: 6px; border-radius: 50%; font-size: 12px; line-height: 18px; vertical-align: 1px; color: var(--muted); }
button.info[aria-expanded="true"] { color: var(--accent-ink); background: var(--accent); border-color: var(--accent); }
.info-text { display: block; margin-top: 6px; font-size: 13px; font-weight: 400; color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; }
.info-text[hidden] { display: none; }
.card h2 .info-text { font-size: 13px; }
.help-link { font-size: 13px; color: var(--muted); }
.intro { margin: -6px 0 0; color: var(--muted); max-width: 72ch; }
th .info-text, h3 .info-text { font-weight: 400; color: var(--ink); text-transform: none; }
.empty-state { border-style: dashed; }
.offer { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.nav .dot { display: inline-block; width: 7px; height: 7px; margin-left: 5px; border-radius: 50%; background: var(--gold); vertical-align: 2px; }
code { font-family: ui-monospace, monospace; font-size: 13px; background: var(--bg); border: 1px solid var(--line); border-radius: 4px; padding: 0 4px; }
@media (max-width: 560px) {
  .tile .value { font-size: 20px; }
  .bar-row { grid-template-columns: minmax(70px, 40%) 1fr auto; }
}
