:root {
  --bg: #f6f7f9; --panel: #ffffff; --text: #1b1f24; --muted: #5d6673; --line: #dde1e6;
  --accent: #3a3ad6; --accent-text: #ffffff; --amber: #a76200; --red: #c22727; --ok: #1f7a43;
  --soft: #eef0ff;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #14161a; --panel: #1c1f24; --text: #e8eaed; --muted: #9aa3ad; --line: #30353c;
    --accent: #8a8cff; --accent-text: #0e0f12; --amber: #f0a830; --red: #ff6b6b; --ok: #4fc27f;
    --soft: #23264a;
  }
}
:root[data-theme="dark"] {
  --bg: #14161a; --panel: #1c1f24; --text: #e8eaed; --muted: #9aa3ad; --line: #30353c;
  --accent: #8a8cff; --accent-text: #0e0f12; --amber: #f0a830; --red: #ff6b6b; --ok: #4fc27f;
  --soft: #23264a;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
code { font-size: 0.9em; background: var(--soft); padding: 1px 4px; border-radius: 4px; word-break: break-all; }
h1 { font-size: 1.6rem; margin: 0 0 0.5rem; }
h2 { font-size: 1.3rem; margin: 1.2rem 0 0.3rem; }
h3 { font-size: 1.05rem; margin: 1.2rem 0 0.3rem; }

.screen { max-width: 680px; margin: 48px auto; padding: 0 16px; }
button { font: inherit; cursor: pointer; border: 1px solid var(--line); background: var(--panel); color: var(--text);
  padding: 6px 14px; border-radius: 6px; }
button.primary { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
button.big { padding: 12px 22px; font-size: 1.05rem; }
button:disabled { opacity: 0.5; cursor: default; }

.bar { position: sticky; top: 0; z-index: 5; display: flex; justify-content: space-between; align-items: center;
  gap: 12px; padding: 10px 16px; background: var(--panel); border-bottom: 1px solid var(--line); }
.bar-title { font-weight: 600; }
.bar-right { display: flex; align-items: center; gap: 14px; }
.savenote { color: var(--muted); font-size: 0.85rem; }
.timer { font-variant-numeric: tabular-nums; font-weight: 700; font-size: 1.3rem; min-width: 4.5ch; text-align: right; }
.timer.amber { color: var(--amber); }
.timer.red { color: var(--red); }

.tabs { display: flex; flex-wrap: wrap; gap: 6px; padding: 10px 16px; border-bottom: 1px solid var(--line); background: var(--bg); }
.tab { font-size: 0.92rem; }
.tab.active { background: var(--soft); border-color: var(--accent); }
.count { color: var(--muted); font-size: 0.8rem; margin-left: 4px; }
.count.full { color: var(--ok); }

.content { max-width: 1100px; margin: 0 auto; padding: 8px 16px 80px; }
.hint { color: var(--muted); margin-top: 0; }
.prose table, .grid { border-collapse: collapse; margin: 8px 0 16px; background: var(--panel); }
.prose th, .prose td, .grid th, .grid td { border: 1px solid var(--line); padding: 6px 8px; text-align: left; vertical-align: top; font-size: 0.92rem; }
.prose th, .grid th { background: var(--soft); }
.tablewrap, .prose { overflow-x: auto; }
.grid select { font: inherit; font-size: 0.9rem; padding: 3px; background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 4px; }
.grid input[type=text] { width: 100%; min-width: 200px; font: inherit; font-size: 0.9rem; padding: 4px 6px;
  background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 4px; }

.q { border: 1px solid var(--line); background: var(--panel); border-radius: 8px; padding: 12px 14px; margin: 12px 0; }
fieldset.q legend { padding: 0 4px; }
.opt { display: block; padding: 4px 0; }
textarea { width: 100%; margin-top: 8px; font: inherit; padding: 8px; background: var(--bg); color: var(--text);
  border: 1px solid var(--line); border-radius: 6px; }
.words { color: var(--muted); font-size: 0.85rem; text-align: right; }
.words.over { color: var(--red); font-weight: 600; }

/* data deep-dive */
.dataset { margin: 12px 0 20px; }
.datawrap { max-height: 380px; overflow-y: auto; border: 1px solid var(--line); }
.datawrap .grid { margin: 0; }
.datawrap th { position: sticky; top: 0; }

/* creative review: mock ads use fixed colours, like real images */
.creative { display: flex; flex-wrap: wrap; gap: 20px; }
.creative-mock { flex: 0 0 auto; max-width: 420px; }
.creative-form { flex: 1 1 280px; display: flex; flex-direction: column; gap: 2px; }
.creative-form b { margin-top: 8px; }
.ad { width: 320px; background: #fff; color: #1c1e21; border: 1px solid #dadde1; border-radius: 8px; font-size: 14px; overflow: hidden; }
.ad-head { display: flex; gap: 8px; align-items: center; padding: 10px; }
.ad-logo { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 50%;
  background: #1d2a6b; color: #fff; font-weight: 700; flex: none; }
.ad-sub { color: #65676b; font-size: 12px; }
.ad-text { padding: 0 10px 10px; }
.ad-img { aspect-ratio: 1 / 1; background: linear-gradient(135deg, #1d2a6b, #3f7cc4); color: #fff; display: flex; flex-direction: column;
  justify-content: center; align-items: center; text-align: center; gap: 8px; padding: 18px; }
.ad-big { font-size: 26px; font-weight: 800; line-height: 1.1; }
.ad-small { font-size: 12px; opacity: 0.85; }
.ad-shout { font-size: 15px; font-weight: 800; color: #ffe14d; text-transform: uppercase; line-height: 1.2; }
.ad-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 10px; background: #f0f2f5; }
.ad-url { color: #65676b; font-size: 11px; }
.ad-btn { background: #e4e6eb; color: #1c1e21; border-radius: 6px; padding: 6px 12px; font-weight: 600; white-space: nowrap; display: inline-block; }
.ad-story { position: relative; width: 240px; aspect-ratio: 9 / 16; border-radius: 10px; overflow: hidden; color: #fff;
  background: linear-gradient(180deg, #2c4a6e, #1d2a6b 60%, #142050); font-size: 14px; }
.st-top { position: absolute; top: 6px; left: 8px; display: flex; gap: 6px; align-items: center; font-weight: 600; }
.st-mid { position: absolute; top: 38%; left: 0; right: 0; text-align: center; padding: 0 14px; }
.st-bottom { position: absolute; bottom: 6px; left: 0; right: 0; text-align: center; display: flex; flex-direction: column; gap: 6px; align-items: center; font-size: 13px; }
.frames { display: flex; gap: 8px; }
.frame { width: 130px; }
.ft { font-size: 12px; color: var(--muted); }
.fbox { aspect-ratio: 9 / 16; border-radius: 8px; padding: 10px; display: flex; flex-direction: column; justify-content: center;
  align-items: center; text-align: center; gap: 8px; font-size: 12.5px; border: 1px solid #dadde1; }

/* brand: the logo is navy on transparent, so it always sits on white */
:root { --brand-navy: #1e1c30; --brand-orange: #fbb862; }
.brand { background: #ffffff; border-bottom: 1px solid var(--line); padding: 18px 16px; text-align: center; }
.logo { width: 100%; max-width: 400px; height: auto; display: inline-block; vertical-align: middle; }
.logo-chip { background: #ffffff; border-radius: 6px; padding: 5px 8px; display: inline-flex; align-items: center; border: 1px solid var(--line); }
.logo-chip img { width: 180px; height: auto; display: block; }
.bar-title { display: flex; align-items: center; gap: 10px; }
.bar-name { color: var(--muted); font-weight: 500; }
.lead { font-size: 1.05rem; }
.facts { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 4px; }
.facts span { background: var(--soft); border-radius: 999px; padding: 4px 12px; font-size: 0.92rem; }
.startbox { text-align: center; margin: 22px 0 48px; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.play { font: inherit; font-size: 1.2rem; font-weight: 700; display: inline-flex; align-items: center; gap: 12px;
  background: var(--brand-orange); color: var(--brand-navy); border: 0; border-radius: 999px; padding: 14px 30px 14px 16px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15); cursor: pointer; }
.play:hover:not(:disabled) { filter: brightness(1.05); }
.play:disabled { opacity: 0.45; cursor: not-allowed; box-shadow: none; }
.play-icon { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 50%;
  background: var(--brand-navy); color: var(--brand-orange); font-size: 1rem; padding-left: 3px; }
@media (max-width: 640px) { .bar-name { display: none; } .logo-chip img { width: 130px; } }

/* monitoring */
.content { user-select: none; -webkit-user-select: none; }
.content input, .content textarea, .content select { user-select: text; -webkit-user-select: text; }
.fs-cover { position: fixed; inset: 0; z-index: 20; background: rgba(10, 12, 20, 0.92); display: flex;
  align-items: center; justify-content: center; padding: 16px; }
.fs-cover[hidden] { display: none; }
.fs-cover .card { max-width: 460px; text-align: center; }
.consent { margin-top: 10px; font-weight: 600; }
.preview-flag { background: var(--soft); border: 1px dashed var(--accent); border-radius: 6px; padding: 8px 12px; }
.flag { color: var(--red); font-weight: 600; }

/* admin */
.ok { color: var(--ok); } .bad { color: var(--red); } .muted { color: var(--muted); }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 14px 16px; margin: 12px 0; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
input.field { font: inherit; padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); color: var(--text); }
.correct { background: var(--soft); font-weight: 600; }

@media (max-width: 640px) {
  .ad { width: 100%; }
  .frames { flex-wrap: wrap; }
  .bar { flex-wrap: wrap; }
  .savenote { display: none; }
}
