:root {
  --canvas: #0a0613;
  --card: #170e30;
  --panel: #0d0820;
  --line: #2f204c;
  --ink: #f4eeff;
  --muted: #c9bee8;
  --dim: #6b5e8a;
  --gold: #f5b829;
  --gold-ink: #170e30;
  --magenta: #f0398b;
  --violet: #a855f7;
  --ok: #4ade80;
  /* chart series: validated for colorblind separation + contrast on --panel */
  --series-views: #a855f7;
  --series-clicks: #c08608;
  --display: 'Syne', 'Arial Black', sans-serif;
  --body: 'Hanken Grotesk', Arial, sans-serif;
}
* { box-sizing: border-box; margin: 0; }
html { color-scheme: dark; overflow-x: clip; }
body {
  background:
    radial-gradient(1100px 500px at 85% -10%, rgba(168,85,247,.14), transparent 60%),
    radial-gradient(900px 420px at -10% 110%, rgba(240,57,139,.10), transparent 55%),
    var(--canvas);
  color: var(--ink);
  font-family: var(--body);
  min-height: 100vh;
  font-size: 15px;
  line-height: 1.55;
}
a { color: var(--gold); }

/* ---------- top bar ---------- */
header {
  display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap;
  padding: clamp(18px, 3vw, 28px) clamp(18px, 4vw, 40px) 0;
}
.wordmark {
  font-family: var(--display); font-weight: 800;
  font-size: clamp(22px, 3vw, 30px); letter-spacing: -0.03em;
  background: none; border: 0; color: var(--ink); cursor: pointer; padding: 0;
}
.wordmark em { font-style: normal; color: var(--gold); }
.wordmark .mate { color: var(--violet); font-size: .62em; letter-spacing: .14em; margin-left: .35em; vertical-align: .18em; }
.tagline { color: var(--dim); font-size: 13px; letter-spacing: .04em; }
header .spacer { flex: 1; }
#whereami { color: var(--muted); font-size: 12.5px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }

/* ---------- layout ---------- */
main {
  display: grid; grid-template-columns: 300px 1fr;
  gap: clamp(16px, 2.5vw, 32px);
  padding: clamp(14px, 2.5vw, 26px) clamp(18px, 4vw, 40px) 60px;
  align-items: start;
}
@media (max-width: 860px) { main { grid-template-columns: minmax(0, 1fr); } }

/* ---------- left rail ---------- */
.rail { display: flex; flex-direction: column; gap: 6px; }
.rail h2 {
  font-family: var(--display); font-size: 12px; font-weight: 700;
  letter-spacing: .22em; text-transform: uppercase; color: var(--dim);
  margin: 22px 2px 10px;
}
.board-row {
  display: grid; grid-template-columns: 10px 1fr auto; gap: 10px; align-items: center;
  width: 100%; text-align: left;
  background: transparent; border: 1px solid transparent; border-radius: 10px;
  color: var(--ink); font: inherit; cursor: pointer;
  padding: 10px 12px;
  transition: background .15s ease-out, border-color .15s ease-out;
}
.board-row:hover { background: rgba(23,14,48,.7); }
.board-row:focus-visible { outline: 2px solid var(--gold); outline-offset: 1px; }
.board-row.sel { background: var(--card); border-color: var(--line); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); }
.dot.paused { background: var(--dim); }
.dot.dead { background: var(--magenta); }
.board-row .bname { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board-row .bslug { color: var(--dim); font-size: 12px; }
.board-row .bclicks { color: var(--muted); font-size: 12px; text-align: right; }
.board-row .sched-chip { color: var(--violet); font-size: 11px; display: block; }
.board-row .warn-chip { color: var(--magenta); font-size: 11px; display: block; }
.rail-add {
  margin-top: 10px; align-self: flex-start;
  background: var(--gold); color: var(--gold-ink); border: 0;
  font-family: var(--display); font-weight: 700; font-size: 13px; letter-spacing: .04em;
  padding: 10px 18px; border-radius: 8px; cursor: pointer;
  transition: transform .12s ease-out, opacity .12s ease-out;
}
.rail-add:hover { transform: translateY(-1px); }
.rail-add:active { transform: translateY(0); opacity: .85; }
.rail-add:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.rail-add.quiet { background: transparent; color: var(--gold); border: 1px solid var(--line); }
select.btn { background: var(--panel); }

/* ---------- detail ---------- */
.detail { min-width: 0; }
.detail-head { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; margin-bottom: 4px; }
.detail-head h1 {
  font-family: var(--display); font-weight: 700; letter-spacing: -0.02em;
  font-size: clamp(22px, 3.4vw, 34px);
}
.foreverlink { font-size: 13px; color: var(--muted); word-break: break-all; }
.foreverlink b { color: var(--gold); font-weight: 600; }
.cols { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr); gap: clamp(16px, 2.5vw, 30px); margin-top: 18px; }
@media (max-width: 1080px) { .cols { grid-template-columns: minmax(0, 1fr); } }

section { margin-bottom: 30px; }
section > h3 {
  font-family: var(--display); font-size: 11px; font-weight: 700;
  letter-spacing: .22em; text-transform: uppercase; color: var(--dim);
  margin-bottom: 12px;
}
.helper { color: var(--dim); font-size: 12px; margin-top: 8px; }

.creative-frame {
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  padding: 18px; display: grid; place-items: center; min-height: 130px;
}
.creative-frame img { max-width: 100%; height: auto; border-radius: 6px; }
.creative-frame .none { color: var(--dim); font-size: 13px; }
.creative-actions { display: flex; gap: 10px; margin-top: 10px; align-items: center; flex-wrap: wrap; }

label { display: block; font-size: 12px; color: var(--muted); margin: 12px 0 4px; letter-spacing: .03em; }
input[type=text], input[type=url], input[type=datetime-local], input[type=password], input[type=number], textarea {
  width: 100%; background: var(--panel); border: 1px solid var(--line); border-radius: 8px;
  color: var(--ink); font: inherit; padding: 9px 12px;
  transition: border-color .15s ease-out;
}
input:focus-visible, textarea:focus-visible { outline: none; border-color: var(--gold); }
input[type=color] { width: 44px; height: 36px; padding: 2px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; }
.btn {
  background: transparent; border: 1px solid var(--line); color: var(--ink);
  font: inherit; font-weight: 600; font-size: 13px;
  padding: 8px 14px; border-radius: 8px; cursor: pointer;
  transition: border-color .15s ease-out, background .15s ease-out;
}
.btn:hover { border-color: var(--gold); }
.btn:focus-visible { outline: 2px solid var(--gold); outline-offset: 1px; }
.btn.primary { background: var(--gold); border-color: var(--gold); color: var(--gold-ink); font-weight: 700; }
.btn.primary:hover { opacity: .9; }
.btn.danger:hover { border-color: var(--magenta); color: var(--magenta); }
.btn[disabled] { opacity: .45; cursor: default; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* snippets */
.snippet { margin-bottom: 14px; }
.snippet .snip-head { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.snippet .snip-head span { font-size: 12px; color: var(--muted); letter-spacing: .04em; }
.snippet pre {
  background: var(--panel); border: 1px solid var(--line); border-radius: 8px;
  padding: 10px 12px; font-size: 11.5px; line-height: 1.5; color: var(--muted);
  overflow-x: auto; white-space: pre-wrap; word-break: break-all;
}
.copybtn {
  background: transparent; border: 0; color: var(--gold); font: inherit; font-size: 12px;
  font-weight: 700; cursor: pointer; padding: 2px 6px; border-radius: 6px;
}
.copybtn:hover { text-decoration: underline; }
.copybtn:focus-visible { outline: 2px solid var(--gold); }

/* stats */
.stat-line { display: flex; gap: 26px; align-items: baseline; flex-wrap: wrap; margin-bottom: 14px; }
.stat-line .big { font-family: var(--display); font-size: 30px; font-weight: 800; color: var(--ink); }
.stat-line .mid { font-family: var(--display); font-size: 20px; font-weight: 700; color: var(--ink); }
.stat-line .lbl { color: var(--dim); font-size: 12px; }

/* small-multiple day charts: one measure per chart, shared date axis, never a dual axis */
.mini-chart { margin-top: 14px; position: relative; }
.mini-chart .mc-title { font-size: 12px; color: var(--muted); margin-bottom: 6px; display: flex; gap: 8px; align-items: center; }
.mini-chart .mc-key { width: 10px; height: 10px; border-radius: 2px; flex: none; }
.mini-chart .mc-bars {
  display: flex; gap: 2px; align-items: flex-end; height: 52px;
  border-bottom: 1px solid var(--line);
}
.mini-chart .mc-bars i {
  flex: 1; min-width: 0; border-radius: 3px 3px 0 0; min-height: 0;
  position: relative;
}
.mini-chart .mc-bars i::before { content: ''; position: absolute; inset: -60px 0 0 0; }
.mini-chart .mc-bars i:hover { filter: brightness(1.35); }
.mini-chart .mc-axis { display: flex; justify-content: space-between; color: var(--dim); font-size: 11px; margin-top: 4px; }
.chart-tip {
  position: fixed; z-index: 70; pointer-events: none;
  background: var(--card); border: 1px solid var(--line); color: var(--ink);
  font-size: 12px; padding: 6px 10px; border-radius: 8px;
  opacity: 0; transition: opacity .1s ease-out; white-space: nowrap;
}
.chart-tip.show { opacity: 1; }

table.data { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data th {
  text-align: left; font-weight: 600; color: var(--dim); font-size: 11px;
  letter-spacing: .08em; text-transform: uppercase; padding: 6px 8px 6px 0;
  border-bottom: 1px solid var(--line);
}
table.data td { padding: 7px 8px 7px 0; color: var(--muted); border-bottom: 1px solid rgba(47,32,76,.5); vertical-align: top; }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.data td.strong { color: var(--ink); font-weight: 600; }
table.data .page { word-break: break-all; }
details.tableview { margin-top: 10px; }
details.tableview summary { cursor: pointer; color: var(--dim); font-size: 12px; }

/* notices: status is never color alone, always icon + words */
.notice {
  display: flex; gap: 10px; align-items: flex-start;
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px;
  font-size: 13px; color: var(--muted); margin: 12px 0 0;
}
.notice .ico { flex: none; font-weight: 800; }
.notice.serious { border-color: var(--magenta); }
.notice.serious .ico { color: var(--magenta); }
.notice.live { border-color: var(--gold); }
.notice.live .ico { color: var(--gold); }
.notice b { color: var(--ink); }

.pill {
  display: inline-block; font-size: 10.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
  border-radius: 99px; padding: 2px 9px; border: 1px solid var(--line); color: var(--muted);
}
.pill.live { border-color: var(--gold); color: var(--gold); }
.pill.scheduled { border-color: var(--violet); color: var(--violet); }

/* creative library */
.lib { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.lib-item { position: relative; }
.lib-item img {
  width: 100%; height: auto; display: block; border-radius: 8px;
  border: 1px solid var(--line); cursor: pointer;
  transition: border-color .15s ease-out, transform .12s ease-out;
}
.lib-item img:hover { border-color: var(--gold); transform: translateY(-1px); }
.lib-item.live img { border-color: var(--gold); }
.lib-badge {
  position: absolute; top: 6px; left: 6px;
  background: var(--gold); color: var(--gold-ink);
  font-family: var(--display); font-weight: 700; font-size: 10px; letter-spacing: .12em;
  padding: 2px 8px; border-radius: 99px;
}
.lib-meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 5px; font-size: 11.5px; color: var(--dim); }

/* schedules + slot rows */
.sched-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.sched-item {
  display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap;
  font-size: 13px; color: var(--muted);
  border-left: 2px solid var(--violet); padding-left: 10px;
}
.sched-item .when { color: var(--violet); font-weight: 600; }
.sched-item .fired { color: var(--dim); }
details.adder { margin-top: 6px; }
details.adder summary { cursor: pointer; color: var(--gold); font-size: 13px; font-weight: 600; list-style: none; }
details.adder summary::before { content: '+ '; }
details.adder[open] summary::before { content: '\2212  '; }

/* checklist */
.checklist { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.checklist li { display: flex; gap: 10px; align-items: baseline; font-size: 13.5px; color: var(--muted); }
.checklist .tick { flex: none; width: 18px; font-weight: 800; color: var(--dim); }
.checklist li.done .tick { color: var(--ok); }
.checklist li.done { color: var(--dim); }
.checklist li.next { color: var(--ink); }
.checklist li.next .tick { color: var(--gold); }

/* checkbox list */
.picklist { display: flex; flex-direction: column; gap: 6px; max-height: 220px; overflow-y: auto; }
.picklist label { display: flex; gap: 8px; align-items: center; margin: 0; font-size: 13px; color: var(--muted); cursor: pointer; }

/* QR */
.qr-box { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.qr-box .qr { background: #fff; padding: 8px; border-radius: 8px; line-height: 0; }
.qr-box .qr svg { width: 120px; height: 120px; display: block; }

/* hints (hover/tap explainers) */
.hint {
  display: inline-flex; width: 15px; height: 15px; border-radius: 50%;
  border: 1px solid var(--dim); color: var(--dim);
  font-family: var(--body); font-size: 10px; font-weight: 700; letter-spacing: 0;
  align-items: center; justify-content: center;
  cursor: help; position: relative; margin-left: 7px; vertical-align: middle;
  text-transform: none; flex: none;
}
.hint:hover { border-color: var(--gold); color: var(--gold); }
.hint::after {
  content: attr(data-tip);
  position: absolute; bottom: calc(100% + 9px); left: 50%; transform: translateX(-50%);
  background: var(--card); border: 1px solid var(--line); color: var(--muted);
  font-size: 12.5px; font-weight: 400; line-height: 1.55; text-align: left;
  word-break: normal; overflow-wrap: break-word; white-space: normal;
  padding: 10px 13px; border-radius: 9px; width: 250px;
  /* display, not opacity: an invisible 250px box hanging off the edge still widens the page */
  display: none; pointer-events: none; z-index: 40;
}
.hint:hover::after, .hint.open::after { display: block; }
.hint.edge::after { left: auto; right: -6px; transform: none; }
/* on a phone a tooltip beside the "?" would run off-screen, so it becomes a bottom card */
@media (max-width: 860px) {
  .hint::after, .hint.edge::after {
    position: fixed; left: 14px; right: 14px; bottom: 14px; top: auto;
    width: auto; transform: none; font-size: 13.5px; padding: 14px 16px;
    box-shadow: 0 -10px 40px rgba(0,0,0,.55);
  }
}

/* slide-over panels (help + banner maker) */
#helpBtn {
  background: transparent; border: 1px solid var(--line); color: var(--gold);
  font: inherit; font-size: 12.5px; font-weight: 700;
  padding: 7px 14px; border-radius: 99px; cursor: pointer; margin-left: 6px;
  transition: border-color .15s ease-out;
}
#helpBtn:hover { border-color: var(--gold); }
#helpBtn:focus-visible { outline: 2px solid var(--gold); outline-offset: 1px; }
.slideover {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(430px, 92vw);
  background: var(--panel); border-left: 1px solid var(--line);
  padding: 26px 26px 40px; overflow-y: auto; z-index: 60;
  transform: translateX(105%);
  /* closed panels are hidden outright: parked off-screen they widen the page on phones
     and stay reachable by keyboard; the delay lets the slide-out finish first */
  visibility: hidden;
  transition: transform .25s cubic-bezier(.16,1,.3,1), visibility 0s linear .25s;
  box-shadow: -20px 0 60px rgba(0,0,0,.5);
}
.slideover.wide { width: min(720px, 96vw); }
.slideover.show { transform: translateX(0); visibility: visible; transition: transform .25s cubic-bezier(.16,1,.3,1), visibility 0s; }
.slideover h2 { font-family: var(--display); font-size: 19px; font-weight: 800; margin-bottom: 4px; }
.slideover h4 {
  font-family: var(--display); font-size: 11px; font-weight: 700;
  letter-spacing: .2em; text-transform: uppercase; color: var(--gold);
  margin: 22px 0 8px;
}
.slideover p, .slideover li { font-size: 13.5px; color: var(--muted); line-height: 1.65; }
.slideover ol { padding-left: 20px; }
.slideover li { margin-bottom: 6px; }
.slideover b { color: var(--ink); }
.slideover .gold { color: var(--gold); }
.slide-close {
  position: absolute; top: 16px; right: 16px;
  background: transparent; border: 0; color: var(--dim); font-size: 22px;
  cursor: pointer; line-height: 1; padding: 6px;
}
.slide-close:hover { color: var(--ink); }

/* banner maker */
.bm-preview { background: var(--canvas); border: 1px solid var(--line); border-radius: 10px; padding: 12px; margin: 14px 0; text-align: center; }
.bm-preview canvas { max-width: 100%; height: auto; border-radius: 4px; }
.bm-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
@media (max-width: 560px) { .bm-grid { grid-template-columns: 1fr; } }
.bm-templates { display: flex; gap: 8px; flex-wrap: wrap; }
.bm-templates .btn.on { border-color: var(--gold); color: var(--gold); }

/* login + toast + empty */
#login { max-width: 380px; margin: 18vh auto 0; padding: 0 20px; text-align: left; }
#login .wordmark { font-size: 34px; cursor: default; }
#login p { color: var(--muted); margin: 10px 0 22px; }
#toast {
  position: fixed; bottom: 22px; left: 50%; transform: translate(-50%, 80px);
  background: var(--card); border: 1px solid var(--line); color: var(--ink);
  padding: 10px 18px; border-radius: 10px; font-size: 13px;
  transition: transform .25s cubic-bezier(.16,1,.3,1); pointer-events: none; z-index: 80;
}
#toast.show { transform: translate(-50%, 0); }
.empty { color: var(--dim); max-width: 460px; }
.empty b { color: var(--muted); }
.hidden { display: none !important; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* Plan usage meter */
.meter { height: 8px; border-radius: 99px; background: var(--panel); border: 1px solid var(--line); overflow: hidden; margin: 6px 0 12px; }
.meter > span { display: block; height: 100%; border-radius: 99px; background: var(--violet); transform-origin: left center; }
.meter.over > span { background: var(--magenta); }

/* Customers console */
.key-once { background: var(--panel); border: 1px solid var(--gold); border-radius: 12px; padding: 14px 16px; margin-top: 14px; }
.key-once code { display: block; font-size: 15px; letter-spacing: .04em; color: var(--gold); word-break: break-all; margin: 8px 0; }
table.data td .btnrow { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
table.data input.cell { width: 96px; padding: 6px 8px; font-size: 12.5px; }
