/* Campaign Report Generator - styled to match the KOL Storyline Generator
   (popstar-storyline-generator.pages.dev). Tokens are lifted from
   Projects/storyline-dist/index.html so the two tools read as one product:
   white surfaces on a lilac canvas, violet as the primary accent, the shared
   magenta-violet-cyan gradient on the headline and the primary button, soft
   shadows instead of heavy borders, and pill-shaped chips.

   Light only, as the reference is. Status colours are the reference's own
   success/warn/danger, extended with the amber the renderer paints into the
   deck so a row here and a box in PowerPoint match. */

:root {
  --brand: #7c4dff;
  --brand-light: #f1ebff;
  --brand-dark: #6b3fd4;
  --accent: #7c4dff;
  --accent-2: #d6189f;
  --accent-light: #f1ebff;
  --accent-deep: #6b3fd4;

  --canvas: #f6f4fa;
  --surface: #ffffff;
  --surface-2: #f5f2fb;

  --fg: #1b1530;
  /* The reference uses .58 / .38 here. This tool carries far more small print
     than a storyline generator does -- table headers, stat labels, check
     detail -- and at 10-12px those land at 4.2:1 and 2.4:1, under AA. Same
     hue, more opacity. */
  --fg-muted: rgba(27, 21, 48, .68);
  --fg-subtle: rgba(27, 21, 48, .58);

  --border: #e7e3f0;
  --border-focus: #7c4dff;
  --input-bg: #ffffff;

  --success: #10b981;
  --success-bg: #e9f7ef;
  --success-fg: #0a6b3a;
  --warn: #f59e0b;
  --warn-bg: #fff8e8;
  --warn-fg: #8a5a00;
  --danger: #ef4444;
  --danger-bg: #fdecec;
  --danger-fg: #a32020;
  /* the deck's own highlight, so the two are recognisably the same thing */
  --gap-bg: #fff6e0;
  --gap-line: #f3d98a;
  --gap-fg: #7d5c00;

  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;
  --radius-pill: 999px;

  --shadow-sm: 0 1px 3px rgba(27, 21, 48, .07);
  --shadow: 0 4px 14px rgba(27, 21, 48, .09);
  --shadow-lg: 0 12px 32px rgba(27, 21, 48, .14);

  --grad: linear-gradient(90deg, #d6189f, #7c4dff, #0891b2);
  --sans: "Segoe UI Variable Display", "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--canvas);
  color: var(--fg);
  font: 15px/1.55 var(--sans);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

.wrap { max-width: 1180px; margin: 0 auto; padding: 0 32px; }

/* ---- top bar ----------------------------------------------------------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  padding: 14px 0;
  margin-bottom: 26px;
}
.topbar .bar { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.topbar .eyebrow {
  font-size: 10px; font-weight: 800; letter-spacing: .14em;
  color: var(--fg-muted); text-transform: uppercase;
}
.topbar h1 {
  margin: 3px 0 0; font-size: 19px; font-weight: 900; letter-spacing: -.03em;
  background: var(--grad);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.topbar .sub { margin: 4px 0 0; color: var(--fg-muted); font-size: 12.5px; }

/* ---- steps ------------------------------------------------------------- */
.step {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 22px 24px;
  margin-bottom: 14px;
}
.step.locked { opacity: 0.5; pointer-events: none; }
.step-head { display: flex; align-items: center; gap: 11px; margin-bottom: 16px; }
.step-head h2 {
  margin: 0; font-size: 16px; font-weight: 800; letter-spacing: -.01em;
  color: var(--fg);
}
.num {
  width: 24px; height: 24px; border-radius: 50%;
  background: var(--grad); color: #fff;
  display: grid; place-items: center;
  font-size: 12px; font-weight: 800; flex: 0 0 auto;
}

/* ---- drop zones -------------------------------------------------------- */
.drop {
  border: 1.5px dashed var(--border);
  border-radius: var(--radius);
  padding: 34px 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color .12s, background .12s;
  background: var(--surface-2);
}
.drop:hover, .drop.over { border-color: var(--brand); background: var(--brand-light); }
.drop.small-drop { padding: 20px; }
.drop-inner strong { display: block; font-size: 14px; font-weight: 700; }
.drop-inner span { display: block; margin-top: 4px; font-size: 12.5px; color: var(--fg-muted); }

/* ---- feedback ---------------------------------------------------------- */
.detected {
  margin-top: 16px; padding: 13px 16px;
  background: var(--success-bg); border: 1px solid #bfe6d0;
  border-radius: var(--radius); font-size: 13px; color: var(--success-fg);
}
.detected ul { margin: 0; padding-left: 18px; }
.detected li { margin: 2px 0; }
.detected li.skip { color: var(--warn-fg); }

.errbox {
  margin-top: 16px; padding: 13px 16px;
  background: var(--danger-bg); border: 1px solid #f5c2c2;
  border-radius: var(--radius); font-size: 13px; color: var(--danger-fg);
}

/* ---- templates --------------------------------------------------------- */
.tmpl-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.card {
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; background: var(--surface-2);
}
.card h3 { margin: 0 0 6px; font-size: 14px; font-weight: 800; }
.tmpl-opt {
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 12px; margin-bottom: 9px; cursor: pointer; background: var(--surface);
  transition: border-color .12s, background .12s, box-shadow .12s;
}
.tmpl-opt:hover { border-color: var(--brand); box-shadow: var(--shadow-sm); }
.tmpl-opt.sel { border-color: var(--brand); background: var(--brand-light); }
.tmpl-opt strong { display: block; font-size: 14px; font-weight: 700; }

/* ---- options ----------------------------------------------------------- */
.opts {
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 16px; margin-bottom: 18px; background: var(--surface-2);
}
.opts summary { cursor: pointer; font-weight: 800; font-size: 13.5px; }
.opt-grid {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 12px; margin: 14px 0;
}
.opt-grid label {
  display: flex; flex-direction: column; gap: 4px;
  font-size: 12px; font-weight: 600; color: var(--fg-muted);
}
/* A field the chosen template has nowhere to put is hidden by setting the
   `hidden` attribute from JS. The rule above would beat the UA stylesheet's
   [hidden] { display: none }, so the field stayed on screen -- PopStar was
   still asking for Buzzer count and KOL interest, which it cannot print. */
.opt-grid label[hidden] { display: none !important; }
/* Name and hint share one line, so a hint never pushes the input out of
   alignment with the rest of the row. */
.opt-grid .lrow {
  display: flex; align-items: baseline; gap: 6px;
  min-height: 1.35em; white-space: nowrap;
}
.opt-grid .hint { font-weight: 400; font-size: 11px; color: var(--fg-subtle); white-space: nowrap; }
.opt-grid input, .opt-grid select {
  padding: 8px 10px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); font-size: 13px; font-family: inherit;
  background: var(--input-bg); color: var(--fg); font-weight: 400;
}
.opt-grid input:focus, .opt-grid select:focus {
  outline: none; border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--brand-light);
}
.chk { display: block; margin: 8px 0; font-size: 12.5px; }
.chk input { margin-right: 6px; accent-color: var(--brand); }
code {
  font-family: Consolas, "SF Mono", monospace; font-size: 0.86em;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 4px; padding: 1px 5px;
}

/* ---- data preview ------------------------------------------------------ */
.chan { margin-bottom: 20px; }
.chan-head { display: flex; align-items: center; gap: 9px; margin-bottom: 10px; }
.chan-head h3 { margin: 0; font-size: 15px; font-weight: 800; }
.pill {
  display: inline-flex; align-items: center;
  font-size: 10px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  padding: 4px 10px; border-radius: var(--radius-pill);
  background: var(--brand-light); color: var(--accent-deep);
}
.pill.role { background: var(--surface-2); color: var(--fg-muted); }

.statrow { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.stat {
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 8px 12px; background: var(--surface); min-width: 96px;
}
.stat .k {
  display: block; font-size: 10px; font-weight: 800; letter-spacing: .08em;
  text-transform: uppercase; color: var(--fg-muted);
}
.stat .v {
  display: block; margin-top: 2px; font-size: 15px; font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.tblwrap {
  overflow-x: auto; border-radius: var(--radius); background: var(--surface);
}
table {
  border-collapse: collapse; width: 100%; font-size: 12.5px;
  border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden;
}
th, td { padding: 8px 12px; text-align: right; white-space: nowrap; border-bottom: 1px solid var(--border); }
th {
  background: var(--surface-2); color: var(--fg-muted);
  font-size: 10px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase;
}
th:nth-child(2), td:nth-child(2) { text-align: left; }
th:first-child, td:first-child { text-align: center; }
td { font-variant-numeric: tabular-nums; }
tr:last-child td { border-bottom: 0; }
tr.total td { font-weight: 800; background: var(--surface-2); border-top: 1px solid var(--border); }
td.na { color: var(--warn-fg); }
td.derived { color: var(--accent-deep); font-weight: 600; }

.bestnote {
  margin-top: 10px; font-size: 12.5px; padding: 10px 13px;
  background: var(--brand-light); border-radius: var(--radius-sm);
  color: var(--fg);
}

/* ---- channel tabs ------------------------------------------------------ */
.tabbar {
  display: flex; gap: 6px; margin: 16px 0 14px;
  overflow-x: auto; padding-bottom: 2px;
}
.tabbar .tab {
  border: 1px solid var(--border); background: var(--surface);
  padding: 8px 15px; font-family: inherit; font-size: 12px; font-weight: 600;
  color: var(--fg-muted); cursor: pointer; white-space: nowrap;
  border-radius: var(--radius-pill); transition: all .12s;
}
.tabbar .tab:hover { border-color: var(--brand); color: var(--fg); }
.tabbar .tab.on {
  background: var(--grad); border-color: transparent; color: #fff; font-weight: 700;
}
.tabbar .tab .tab-n { opacity: .7; margin-left: 5px; font-weight: 400; }
.tabbar .tab.needs::after {
  content: "\2022"; color: var(--warn); margin-left: 6px;
  font-size: 15px; line-height: 1;
}
.tabbar .tab.on.needs::after { color: #fff; }
.chan.pane { display: none; }
.chan.pane.on { display: block; }

/* ---- report check ------------------------------------------------------ */
.qc { margin: 18px 0 4px; }
.qc h3 { font-size: 16px; font-weight: 800; margin: 0 0 12px; letter-spacing: -.01em; }
.qc-counts { display: flex; gap: 7px; margin-bottom: 14px; flex-wrap: wrap; }
.badge {
  font-size: 10px; font-weight: 700; letter-spacing: .04em;
  padding: 5px 11px; border-radius: var(--radius-pill);
}
.badge.ok { background: var(--success-bg); color: var(--success-fg); }
.badge.warn { background: var(--warn-bg); color: var(--warn-fg); }
.badge.block { background: var(--danger-bg); color: var(--danger-fg); }
.badge.diff { background: var(--gap-bg); color: var(--gap-fg); }

.qc-h { font-size: 14px; font-weight: 800; margin: 16px 0 3px; }
.qc-sub { font-size: 12px; color: var(--fg-muted); margin: 0 0 10px; max-width: 78ch; }

.check {
  display: flex; gap: 9px; padding: 10px 13px; margin-bottom: 6px;
  border-radius: var(--radius-sm); font-size: 13px;
  border: 1px solid var(--border); background: var(--surface);
  align-items: flex-start;
}
.check.warn { background: var(--warn-bg); border-color: #f3ddab; }
.check.block { background: var(--danger-bg); border-color: #f5c2c2; }
/* Matches the amber the renderer paints into the deck. */
.check.gap { background: var(--gap-bg); border-color: var(--gap-line); }
.check .mark { flex: 0 0 auto; font-weight: 800; width: 15px; }
.check.pass .mark { color: var(--success-fg); }
.check.warn .mark { color: var(--warn-fg); }
.check.block .mark { color: var(--danger-fg); }
.check.gap .mark { color: var(--gap-fg); }
.check .lbl { font-weight: 700; }
.check .det { display: block; font-weight: 400; color: var(--fg-muted); margin-top: 3px; }

details.group > summary {
  cursor: pointer; font-size: 12.5px; font-weight: 700;
  color: var(--accent-deep); margin: 12px 0 8px;
}
details.group > summary:hover { color: var(--brand); }

/* ---- actions ----------------------------------------------------------- */
.actions { display: flex; gap: 9px; margin-top: 20px; flex-wrap: wrap; }
.btn {
  padding: 10px 18px; border-radius: var(--radius-pill);
  border: 1px solid var(--border); background: var(--input-bg); color: var(--fg);
  font-family: inherit; font-size: 12.5px; font-weight: 600;
  cursor: pointer; transition: all .12s;
}
.btn:hover { border-color: var(--brand); }
.btn.primary {
  background: var(--grad); border: none; color: #fff; font-weight: 700;
  box-shadow: var(--shadow-sm);
}
.btn.primary:hover { box-shadow: var(--shadow); color: #fff; }
.btn.ghost { background: transparent; }
.btn:disabled { opacity: .45; cursor: default; box-shadow: none; }
.btn.small { padding: 6px 13px; font-size: 11.5px; }

/* ---- progress ---------------------------------------------------------- */
.progress { list-style: none; margin: 0 0 18px; padding: 0; font-size: 13px; }
.progress li { padding: 4px 0; color: var(--fg-muted); }
.progress li.done { color: var(--success-fg); font-weight: 600; }
.progress li.done::before { content: "\2713  "; font-weight: 800; }
.progress li.busy { color: var(--fg); font-weight: 600; }
.progress li.busy::before { content: "\2026  "; }

/* ---- result ------------------------------------------------------------ */
.dlbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 18px 20px; margin-bottom: 18px;
  border-radius: var(--radius-lg); border: 1px solid var(--border);
  background: var(--surface); box-shadow: var(--shadow-sm);
  position: relative; overflow: hidden;
}
.dlbar::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0;
  width: 4px; background: var(--grad);
}
.dlbar strong { font-size: 15px; font-weight: 800; }
.dlbar a { text-decoration: none; }

.note {
  font-size: 12px; color: var(--warn-fg); background: var(--warn-bg);
  border: 1px solid #f3ddab; border-radius: var(--radius-sm);
  padding: 7px 10px; margin-top: 8px;
}
.src { font-size: 11px; color: var(--fg-muted); }

.muted { color: var(--fg-muted); }
.small { font-size: 12px; }
.foot { margin: 12px 0 48px; }
.foot p { max-width: 84ch; }

a { color: var(--accent-deep); }

@media (max-width: 860px) {
  .tmpl-grid, .opt-grid { grid-template-columns: 1fr; }
  .wrap { padding: 0 18px; }
}
