/* SAPOK annoncetal. Same visual language as the old monitor page: calm single column, serif numbers,
   panel cards, verdict colours (Skalér = ok, Hold = neutral, Reducér = warn, Sluk = bad). Light and dark. */
:root {
  color-scheme: light dark;
  --bg: #faf9f5; --panel: #ffffff; --fg: #1f1e1d; --muted: #6b6a65; --line: #e3e0d6;
  --ok: #2b7a4b; --warn: #a85e12; --bad: #b0332a; --focus: #1f1e1d;
  --radius: 10px; --gap: 12px; --gap-lg: 20px;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --serif: Georgia, "Iowan Old Style", "Times New Roman", serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1f1e1d; --panel: #2a2927; --fg: #f0eee6; --muted: #a8a59a; --line: #3d3b37;
    --ok: #62c18a; --warn: #e3a255; --bad: #f08072; --focus: #f0eee6;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 15px/1.5 var(--sans); }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.skip { position: absolute; left: -999px; top: 0; background: var(--fg); color: var(--bg); padding: 8px 12px; z-index: 20; }
.skip:focus { left: 8px; top: 8px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.boot { padding: 40px 16px; text-align: center; color: var(--muted); }

.wrap { max-width: 1240px; margin: 0 auto; padding: 16px 16px 48px; display: flex; flex-direction: column; gap: 28px; }
.main { display: flex; flex-direction: column; gap: 28px; min-width: 0; }
.is-ok { color: var(--ok); } .is-warn { color: var(--warn); } .is-bad { color: var(--bad); }
.muted { color: var(--muted); }
.num { font-variant-numeric: tabular-nums; }

/* ---------- login ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-card { width: 100%; max-width: 26rem; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 28px 24px; display: flex; flex-direction: column; gap: 14px; }
.login-card h1 { font: 400 1.7rem/1.15 var(--serif); margin: 0; }
.login-card p { margin: 0; color: var(--muted); }
.field { display: flex; flex-direction: column; gap: 4px; }
.field label { font-size: 13px; color: var(--muted); }
.field input { padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); min-width: 0; }
.btn { border: 1px solid var(--line); background: var(--panel); border-radius: 8px; padding: 8px 14px; }
.btn:hover { border-color: var(--muted); }
.btn[disabled] { opacity: .55; cursor: default; }
.btn-primary { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.msg { font-size: 14px; margin: 0; }

/* ---------- header ---------- */
.head { display: flex; flex-direction: column; gap: 10px; }
.head-top { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: flex-start; justify-content: space-between; }
.eyebrow { font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin: 0; }
.title { font: 400 2rem/1.1 var(--serif); margin: 2px 0 0; }
.head-tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.meta-line { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 13px; color: var(--muted); align-items: center; }
.pill { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 999px; padding: 1px 10px; font-size: 12.5px; background: var(--panel); }
.pill i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; display: inline-block; }
.pill.peak { color: var(--warn); border-color: currentColor; }
.banner { border: 1px dashed var(--warn); color: var(--warn); border-radius: var(--radius); padding: 8px 12px; font-size: 14px; }
.banner-bad { border-color: var(--bad); color: var(--bad); }
.nav { position: sticky; top: 0; z-index: 5; display: flex; flex-wrap: wrap; gap: 6px; padding: 8px 0; background: var(--bg); border-bottom: 1px solid var(--line); }
.nav a { font-size: 13px; color: var(--muted); text-decoration: none; padding: 4px 12px; border: 1px solid var(--line); border-radius: 999px; }
.nav a:hover { color: var(--fg); border-color: var(--muted); }

/* ---------- cards and KPI ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: var(--gap); }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.card.lead { border-color: var(--muted); }
.label { font-size: 12px; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); margin: 0; font-weight: 400; }
.big { font: 400 2.2rem/1.05 var(--serif); font-variant-numeric: tabular-nums; }
.mid { font: 400 1.5rem/1.1 var(--serif); font-variant-numeric: tabular-nums; }
.sub { font-size: 13px; color: var(--muted); margin: 0; font-variant-numeric: tabular-nums; }
.sub b { color: var(--fg); font-weight: 600; }
.gauge { position: relative; height: 8px; border-radius: 999px; background: color-mix(in srgb, var(--fg) 9%, transparent); margin: 8px 0 2px; }
.gauge i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 999px; background: currentColor; }
.gauge b { position: absolute; top: -4px; bottom: -4px; width: 2px; background: var(--muted); }
.brandline { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: var(--gap); margin-top: -4px; }
.brandline .card { padding: 10px 14px; }
.brandline .row { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; font-variant-numeric: tabular-nums; }

/* ---------- sections ---------- */
.sec { display: flex; flex-direction: column; gap: var(--gap); min-width: 0; scroll-margin-top: 56px; }
.sec h2 { font-size: 1.15rem; font-weight: 600; margin: 0; }
.sec h3 { font-size: 1rem; font-weight: 600; margin: 8px 0 0; }
.intro { margin: 0; color: var(--muted); max-width: 80ch; }
.bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; }
.seg { display: inline-flex; flex-wrap: wrap; border: 1px solid var(--line); border-radius: 999px; padding: 2px; background: var(--panel); }
.seg button { border: 0; background: transparent; color: var(--muted); padding: 5px 12px; border-radius: 999px; font-size: 13px; }
.seg button[aria-pressed="true"] { background: var(--fg); color: var(--bg); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 8px 16px; margin: 0; }
.stats div { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.stats dt { font-size: 12px; color: var(--muted); }
.stats dd { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; }

/* verdict chips */
.v { display: inline-flex; align-items: center; gap: 5px; padding: 1px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.v::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.v-skal { color: var(--ok); background: color-mix(in srgb, var(--ok) 14%, transparent); }
.v-hold { color: var(--muted); background: color-mix(in srgb, var(--fg) 7%, transparent); }
.v-red { color: var(--warn); background: color-mix(in srgb, var(--warn) 16%, transparent); }
.v-sluk { color: var(--bad); background: color-mix(in srgb, var(--bad) 14%, transparent); }
.v-wait { color: var(--fg); border: 1px solid var(--muted); }
.v-wait::before { background: transparent; border: 2px solid currentColor; width: 5px; height: 5px; }
.v-learn { color: var(--fg); border: 1px dashed var(--muted); }

/* actions */
.acts { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 380px), 1fr)); gap: var(--gap); }
.act { background: var(--panel); border: 1px solid var(--line); border-left-width: 4px; border-radius: var(--radius); padding: 12px 14px; display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.act.a-skal { border-left-color: var(--ok); } .act.a-red { border-left-color: var(--warn); } .act.a-sluk { border-left-color: var(--bad); }
.act-top { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; justify-content: space-between; font-size: 13px; }
.where { display: inline-flex; gap: 8px; align-items: center; color: var(--muted); min-width: 0; }
.plat { display: inline-flex; align-items: center; gap: 5px; font-weight: 600; color: var(--fg); }
.plat i { display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 4px; font-style: normal; font-size: 11px; font-weight: 700; color: #fff; }
.plat.meta i { background: #3b6fd4; } .plat.google i { background: #c0453a; }
.act-name { font-weight: 600; overflow-wrap: anywhere; }
.act-budget { font-variant-numeric: tabular-nums; }
.act-budget .d { font-weight: 600; }
.act-stats { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.act-why { margin: 0; font-size: 13px; line-height: 1.45; }
.note { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px; display: flex; gap: 10px; }
.note .star { color: var(--warn); font-size: 1.1rem; line-height: 1.3; }
.note p { margin: 2px 0 0; font-size: 14px; }
.compact { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }
.compact li { padding: 8px 14px; display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: baseline; justify-content: space-between; border-top: 1px solid var(--line); font-size: 14px; }
.compact li:first-child { border-top: 0; }
.compact .nm { font-weight: 600; overflow-wrap: anywhere; flex: 1 1 220px; }
.compact .sm { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.prog { height: 5px; border-radius: 999px; background: color-mix(in srgb, var(--fg) 9%, transparent); flex: 1 1 100%; overflow: hidden; }
.prog i { display: block; height: 100%; background: var(--muted); }
.more { align-self: flex-start; }
.empty { color: var(--muted); margin: 0; padding: 4px 0; }

/* tables */
.tw { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }
table { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; font-size: 14px; }
th, td { padding: 7px 12px; text-align: right; white-space: nowrap; border-top: 1px solid var(--line); }
th:first-child, td:first-child { text-align: left; position: sticky; left: 0; background: var(--panel); }
thead th { font-size: 12px; font-weight: 600; color: var(--muted); border-top: 0; vertical-align: bottom; }
tr.brand td { font-weight: 600; background: color-mix(in srgb, var(--fg) 5%, var(--panel)); }
tr.brand td:first-child { background: color-mix(in srgb, var(--fg) 5%, var(--panel)); }
td.l, th.l { text-align: left; }

/* plan */
.cards3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: var(--gap); }

/* learnings */
.learn { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); gap: var(--gap); list-style: none; margin: 0; padding: 0; }
.learn li { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; display: flex; flex-direction: column; gap: 4px; }
.learn b { font-weight: 600; }
.learn p { margin: 0; font-size: 14px; }

.foot { border-top: 1px solid var(--line); padding-top: 14px; font-size: 13px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px 16px; justify-content: space-between; }

/* ---------- AI summary ---------- */
.sumcard { border-color: var(--muted); gap: 6px; }
.sum-head { margin: 2px 0 0; font: 600 1.05rem/1.35 var(--sans); }
.sum-p { margin: 0; font-size: 14.5px; max-width: 90ch; }
.sumcard .sub { margin-top: 4px; }

/* ---------- Kampagner (drill-down) ---------- */
.segs { display: flex; flex-wrap: wrap; gap: 8px; }
.tree-wrap { max-width: 100%; }
.tree th:first-child, .tree td:first-child { position: static; }
.tree th.l { text-align: left; }
.tree thead th { white-space: normal; min-width: 70px; }
.tree td.nmcell { text-align: left; white-space: normal; min-width: 260px; max-width: 560px; vertical-align: top; }
.tree td { vertical-align: top; }
.nmw { display: flex; gap: 6px; align-items: flex-start; }
.nmb { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.nmt { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; }
.nm { overflow-wrap: anywhere; }
.tr.market .nm, .tr.camp .nm { font-weight: 600; }
.tr.market td { background: color-mix(in srgb, var(--fg) 5%, var(--panel)); }
.tr.lv1 .nmw { padding-left: 18px; } .tr.lv2 .nmw { padding-left: 36px; } .tr.lv3 .nmw { padding-left: 54px; }
.tr.leaf td { color: var(--fg); }
.tr.leaf .nm { font-weight: 400; }
.tr.is-nosale td { background: color-mix(in srgb, var(--bad) 7%, var(--panel)); }
.tr.note-row .rowsub { font-style: italic; }
.tog { flex: none; width: 24px; height: 24px; display: inline-grid; place-items: center; border: 1px solid var(--line); background: var(--panel); border-radius: 6px; padding: 0; line-height: 1; font-size: 13px; color: var(--fg); }
.tog:hover { border-color: var(--muted); }
.tog-sp { flex: none; width: 24px; }
.rowsub { font-size: 12.5px; color: var(--muted); line-height: 1.4; white-space: normal; }
.rowsub.is-learn { color: var(--fg); }
.st { font-size: 12px; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 0 8px; white-space: nowrap; }
.only-sm { display: none; }
@media (max-width: 700px) {
  .hide-sm { display: none; }
  .only-sm { display: block; }
  .tree td.nmcell { min-width: 0; max-width: none; }
  .tr.lv1 .nmw { padding-left: 10px; } .tr.lv2 .nmw { padding-left: 20px; } .tr.lv3 .nmw { padding-left: 30px; }
  .tree th, .tree td { padding: 6px 7px; }
  .tree thead th { min-width: 0; }
  .tog { width: 28px; height: 28px; }
  .tog-sp { width: 28px; }
}

@media (max-width: 560px) {
  .title { font-size: 1.6rem; }
  .big { font-size: 1.9rem; }
  th, td { padding: 6px 9px; }
}
