/* Inter (variable, self-hosted: CSP allows fonts from 'self' only). Unicode ranges from Fontsource. */
@font-face {
  font-family: "Inter"; font-style: normal; font-display: swap; font-weight: 100 900;
  src: url(/fonts/inter-vietnamese.woff2) format("woff2");
  unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}
@font-face {
  font-family: "Inter"; font-style: normal; font-display: swap; font-weight: 100 900;
  src: url(/fonts/inter-latin-ext.woff2) format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Inter"; font-style: normal; font-display: swap; font-weight: 100 900;
  src: url(/fonts/inter-latin.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --brand: #5465f0;
  --brand-strong: #4553e0;
  --on-brand: #ffffff;
  --brand-soft: #eef0fe;
  --brand-tint: #f6f7ff;
  --page: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #f5f6f8;
  --sidebar-bg: #fbfbfc;
  --nav-active: #eff0f3;
  --line: #eceef2;
  --line-strong: #e0e3e9;
  --text: #17181c;
  --text-2: #4b5060;
  --muted: #7d8290;
  --ink: #17181c;
  --on-ink: #ffffff;
  --ok: #15803d;
  --ok-soft: #effaf3;
  --warn: #b45309;
  --warn-soft: #fff8eb;
  --bad: #c0392b;
  --bad-soft: #fef3f2;
  --radius-xl: 16px;
  --radius-lg: 12px;
  --radius: 10px;
  --shadow-card: 0 1px 2px rgba(16, 24, 40, .04);
  --art: #e6e8ef;
  --art-line: #c9cdd8;
  /* A/B: A teal, B purple like the AdMob A/B screen (chart + variant headers). Validated with dataviz/validate_palette.js 2026-10-07 (light + dark) */
  --series-a: #0a95a5;
  --series-b: #8a3ffc;
  --on-series: #ffffff;
  /* variant header bars: white text ≥ 4.5:1 (A a shade darker than the chart color) */
  --variant-a-head: #0a7f8c;
  --variant-b-head: #8a3ffc;
  color-scheme: light;
}

/* Theme: light by default; dark when chosen, or "auto" + system dark (choice kept per browser) */
@media (prefers-color-scheme: dark) {
  :root[data-theme="auto"] {
    --brand: #7c8bff;
    --brand-strong: #97a3ff;
    --on-brand: #0e1230;
    --brand-soft: #23264a;
    --brand-tint: #1c1e33;
    --page: #17181c;
    --surface: #1e1f24;
    --surface-2: #26282e;
    --sidebar-bg: #1a1b1f;
    --nav-active: #2a2c33;
    --line: #2e3037;
    --line-strong: #3a3d45;
    --text: #ececef;
    --text-2: #c4c7cf;
    --muted: #9196a1;
    --ink: #ececef;
    --on-ink: #1e1f24;
    --ok: #4ade80;
    --ok-soft: #13261b;
    --warn: #fbbf24;
    --warn-soft: #2b2210;
    --bad: #f87171;
    --bad-soft: #2e1717;
    --shadow-card: none;
    --art: #2a2d36;
    --art-line: #3a3e4a;
    --series-a: #22a6b3;
    --series-b: #a56eff;
    --on-series: #101114;
    --variant-a-head: #22a6b3;
    --variant-b-head: #a56eff;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --brand: #7c8bff;
  --brand-strong: #97a3ff;
  --on-brand: #0e1230;
  --brand-soft: #23264a;
  --brand-tint: #1c1e33;
  --page: #17181c;
  --surface: #1e1f24;
  --surface-2: #26282e;
  --sidebar-bg: #1a1b1f;
  --nav-active: #2a2c33;
  --line: #2e3037;
  --line-strong: #3a3d45;
  --text: #ececef;
  --text-2: #c4c7cf;
  --muted: #9196a1;
  --ink: #ececef;
  --on-ink: #1e1f24;
  --ok: #4ade80;
  --ok-soft: #13261b;
  --warn: #fbbf24;
  --warn-soft: #2b2210;
  --bad: #f87171;
  --bad-soft: #2e1717;
  --shadow-card: none;
  --art: #2a2d36;
  --art-line: #3a3e4a;
  --series-a: #22a6b3;
  --series-b: #a56eff;
  --on-series: #101114;
  --variant-a-head: #22a6b3;
  --variant-b-head: #a56eff;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--page);
  color: var(--text);
  font: 14px/1.5 "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
svg.icon { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
.hidden { display: none !important; }
.boot { padding: 48px; color: var(--muted); display: flex; align-items: center; gap: 10px; }

/* ---------- buttons, inputs ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid var(--line-strong); background: var(--surface); border-radius: var(--radius);
  padding: 7px 14px; cursor: pointer; white-space: nowrap; font-weight: 500; text-decoration: none; color: var(--text);
  transition: background .15s, border-color .15s;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn.primary { background: var(--ink); border-color: var(--ink); color: var(--on-ink); }
.btn.primary:hover { background: var(--ink); opacity: .88; }
.btn.danger { color: var(--bad); }
.btn.small { padding: 4px 10px; font-size: 13px; border-radius: 8px; gap: 6px; }
.btn.small svg { width: 15px; height: 15px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=search], select {
  border: 1px solid var(--line-strong); background: var(--surface); border-radius: 10px; padding: 7px 12px; width: 100%;
}
input:focus-visible, select:focus-visible, .btn:focus-visible, a:focus-visible, .tile:focus-within {
  outline: 2px solid var(--brand); outline-offset: 2px;
}
label.field { display: grid; gap: 6px; }
/* Two fields side by side (name + format), stacked on narrow screens */
.field-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(160px, 220px); gap: 12px; align-items: end; }
@media (max-width: 520px) { .field-row { grid-template-columns: 1fr; } }
label.field span { font-size: 12.5px; color: var(--muted); }

/* ---------- layout ---------- */
.frame { display: grid; grid-template-columns: 216px 1fr; min-height: 100vh; }
.sidebar {
  background: var(--sidebar-bg);
  border-right: 1px solid var(--line);
  padding: 20px 12px 16px; display: flex; flex-direction: column; gap: 20px;
  position: sticky; top: 0; height: 100vh;
}
.logo { display: flex; align-items: center; gap: 10px; padding: 0 8px; color: var(--text); text-decoration: none; }
.logo:hover { text-decoration: none; }
.logo svg { width: 28px; height: 28px; flex: none; }
.logo b { font-size: 15px; font-weight: 650; letter-spacing: -.01em; }
.nav { display: grid; gap: 2px; }
.nav a {
  display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 8px;
  color: var(--text-2); font-weight: 450; text-decoration: none;
}
.nav a svg { width: 18px; height: 18px; color: var(--muted); }
.nav a:hover { background: var(--nav-active); color: var(--text); }
.nav a[aria-current=page] { background: var(--nav-active); color: var(--text); font-weight: 600; }
.nav a[aria-current=page] svg { color: var(--text); }
.ui-switch { display: grid; gap: 6px; padding: 0 8px; }
.ui-switch .seg { margin: 0; justify-self: start; }
.ui-mini { font-size: 11px; font-weight: 600; color: var(--text-2); }
.ui-mini.on { background: var(--brand-soft); color: var(--brand); }
.account { margin-top: auto; display: flex; align-items: center; gap: 6px; padding: 10px 4px 0 8px; border-top: 1px solid var(--line); }
.whoami { flex: 1; display: grid; font-size: 12.5px; line-height: 1.35; min-width: 0; }
.whoami b { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.whoami span { color: var(--muted); font-size: 12px; }
.icon-btn { border: 0; background: none; padding: 6px; border-radius: 8px; cursor: pointer; color: var(--muted); display: grid; place-items: center; }
.icon-btn:hover { background: var(--nav-active); color: var(--text); }
.icon-btn:focus-visible { outline: 2px solid var(--brand); }
.icon-btn svg { width: 18px; height: 18px; }

.main { padding: 20px 24px 40px; min-width: 0; }
.back { display: inline-flex; align-items: center; gap: 6px; font-weight: 500; font-size: 13px; margin-bottom: 8px; }
.back svg { width: 16px; height: 16px; }
.page-title { font-size: 22px; line-height: 1.25; font-weight: 600; letter-spacing: -.015em; margin: 0 0 2px; overflow-wrap: anywhere; }
.page-sub { color: var(--muted); font-size: 13px; margin: 0 0 18px; }
.stack { display: grid; gap: 16px; }
.banner { margin-bottom: 16px; padding: 10px 14px; font-size: 13px; border-radius: var(--radius-lg); background: var(--warn-soft); color: var(--warn); }

/* ---------- cards & sections ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-xl); padding: 20px 22px; box-shadow: var(--shadow-card); min-width: 0; }
.card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.card-head h2 { margin: 0; font-size: 16px; font-weight: 600; letter-spacing: -.01em; }
.spacer { flex: 1; }
.section { border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 16px; min-width: 0; }
.section + .section { margin-top: 12px; }
.card .section { border: 0; border-top: 1px solid var(--line); border-radius: 0; padding: 16px 0 0; margin-top: 16px; }
.card-head + .section { border-top: 0; padding-top: 0; margin-top: 0; }
.section-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.section-head h3 { margin: 0; font-size: 14px; font-weight: 600; }
.hint { color: var(--muted); font-size: 12.5px; margin: 10px 0 0; }
.spaced { margin-top: 12px; }

/* ---------- rows (like the "Category name" list) ---------- */
.rows { border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; }
.row {
  display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-top: 1px solid var(--line);
  color: var(--text); text-decoration: none; background: var(--surface);
}
.row:first-child { border-top: 0; }
a.row:hover { background: var(--surface-2); text-decoration: none; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--brand); flex: none; }
.dot.grey { background: var(--line-strong); }
.row .grow { flex: 1; min-width: 0; display: grid; gap: 2px; }
.row .title { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .meta { color: var(--muted); font-size: 12px; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.row .end { display: flex; gap: 6px; align-items: center; color: var(--muted); font-size: 12.5px; flex-wrap: wrap; justify-content: flex-end; }
.filters { display: flex; gap: 10px; margin-bottom: 10px; align-items: center; }
.filters .search { flex: 1; margin: 0; }
.filters select.platform { width: auto; min-width: 140px; }
.seg { display: inline-flex; flex-wrap: wrap; gap: 2px; padding: 3px; background: var(--surface-2); border-radius: 9px; margin-bottom: 12px; }
.seg button { border: 0; background: none; padding: 4px 10px; border-radius: 7px; font-size: 13px; cursor: pointer; color: var(--text-2); font-weight: 500; display: inline-flex; gap: 8px; align-items: center; }
.seg button:hover { color: var(--text); }
.seg button[aria-pressed=true] { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(17, 24, 39, .08), 0 0 0 1px var(--line); }
.seg button:focus-visible { outline: 2px solid var(--brand); }
.seg a { padding: 4px 12px; border-radius: 7px; font-size: 13px; color: var(--text-2); font-weight: 500; display: inline-flex; gap: 8px; align-items: center; text-decoration: none; }
.seg a:hover { color: var(--text); text-decoration: none; }
.seg a[aria-current=page] { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(16, 24, 40, .08), 0 0 0 1px var(--line); }
.page-tabs { margin-bottom: 14px; }
.seg .n { font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.search { margin-bottom: 12px; position: relative; }
.search svg { position: absolute; left: 11px; width: 16px; height: 16px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search input { padding-left: 34px; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 999px; font-size: 12px; background: var(--surface-2); border: 1px solid transparent; color: var(--text-2); font-weight: 500; white-space: nowrap; }
.chip.ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.chip.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.chip.bad { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.chip.brand { background: var(--brand-soft); color: var(--brand); border-color: transparent; }
.chip.off { text-decoration: line-through; }

.kv { display: grid; grid-template-columns: 110px 1fr; gap: 6px 16px; margin: 0; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 7px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 12px; color: var(--muted); font-weight: 500; letter-spacing: .02em; background: var(--surface-2); border-bottom: 0; }
th:first-child { border-radius: 8px 0 0 8px; }
th:last-child { border-radius: 0 8px 8px 0; }
td { font-size: 13px; }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
details summary { cursor: pointer; color: var(--muted); margin-top: 12px; font-size: 13px; }

/* ---------- ad unit tables ---------- */
.table-wrap { overflow-x: auto; }
table.units td { vertical-align: middle; }
table.units .cell-title { font-weight: 500; white-space: nowrap; }
table.units td.mono { font-size: 12px; color: var(--text-2); white-space: nowrap; }
table.units .chips { gap: 4px; }
table.units a.chip { text-decoration: none; }
table.units a.chip:hover { border-color: var(--line-strong); color: var(--text); }

table.setup th, table.setup td { white-space: nowrap; vertical-align: middle; }
table.setup tr.pending td { background: var(--brand-tint); }
table.setup th.removing .unit-name { text-decoration: line-through; color: var(--muted); }
table.setup tr.off td { color: var(--muted); }
.inline-check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.suggest { margin-bottom: 12px; padding: 10px 12px; background: var(--brand-tint); border-radius: var(--radius); }
.suggest .card-head { margin-bottom: 6px; }
.chip.check { cursor: pointer; padding: 3px 10px 3px 6px; border-color: var(--line-strong); background: var(--surface); }
.chip.check.brand { background: var(--brand-soft); border-color: transparent; }
.chip.check input { margin: 0; }
select.compact { width: auto; padding: 4px 8px; font-size: 13px; border-radius: 8px; max-width: 280px; }

/* ---------- editor ---------- */
.tiers { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.tier { display: inline-flex; align-items: center; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--surface); }
.tier .cur { padding-left: 10px; color: var(--muted); }
.tier input { width: 72px; border: 0; padding: 6px 4px 6px 2px; background: transparent; font-variant-numeric: tabular-nums; }
.tier input:focus { outline: none; }
.tier:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.tier button { border: 0; background: none; color: var(--muted); padding: 0 10px; cursor: pointer; font-size: 18px; line-height: 1; }
.tier button:hover { color: var(--bad); }
.gen { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; margin-top: 12px; padding: 12px; background: var(--surface-2); border-radius: var(--radius); }
.gen label.field { width: 130px; }

/* mode tiles, like the "Layout style" selector */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; }
.tile {
  position: relative; display: grid; gap: 4px; padding: 12px 14px; border: 1.5px solid var(--line); border-radius: var(--radius-lg);
  cursor: pointer; background: var(--surface); transition: border-color .15s; align-content: start;
}
.tile:hover { border-color: var(--line-strong); }
.tile:has(input:checked) { border-color: var(--ink); }
.tile input { position: absolute; opacity: 0; pointer-events: none; }
.tile .check { position: absolute; top: 10px; right: 10px; width: 20px; height: 20px; border-radius: 50%; background: var(--ink); color: var(--surface); display: none; place-items: center; }
.tile:has(input:checked) .check { display: grid; }
.tile .check svg { width: 14px; height: 14px; stroke-width: 2.6; }
.tile .art { height: 40px; border-radius: 8px; background: var(--brand-tint); display: flex; align-items: center; gap: 5px; margin-bottom: 6px; padding: 0 10px; }
.tile .art i { display: block; height: 18px; flex: 1; border-radius: 6px; background: var(--art); }
.tile .art i.new { background: var(--brand); opacity: .8; }
.tile .art i.gone { background: transparent; border: 1.5px dashed var(--art-line); }
.tile .art em { font-style: normal; font-size: 11px; color: var(--muted); }
.tile b { font-weight: 500; padding-right: 28px; }
.tile span { color: var(--muted); font-size: 12.5px; }
.ab-label { min-width: 64px; }
.seg.small { margin: 0; padding: 3px; }
.seg.small button { padding: 3px 10px; font-size: 12.5px; }
.ab-viz { display: grid; gap: 10px; }
.viz-legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12.5px; color: var(--text-2); }
.viz-legend i, #viz-tip i.key { display: inline-block; vertical-align: middle; margin-right: 8px; }
.viz-legend i { width: 12px; height: 12px; border-radius: 3px; }
.viz-legend i.A { background: var(--series-a); }
.viz-legend i.B { background: var(--series-b); }
.viz-tabs { display: inline-flex; gap: 2px; padding: 3px; background: var(--surface-2); border-radius: 9px; overflow-x: auto; justify-self: start; max-width: 100%; }
.viz-tabs button { border: 0; background: none; padding: 4px 12px; font-size: 13px; border-radius: 7px; cursor: pointer; color: var(--text-2); font-weight: 500; white-space: nowrap; }
.viz-tabs button:hover { color: var(--text); }
.viz-tabs button[aria-selected=true] { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(16, 24, 40, .08), 0 0 0 1px var(--line); }
.viz-tabs button:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; }
.viz-frame { width: 100%; overflow-x: auto; }
.viz-svg { display: block; width: 100%; max-width: 1040px; min-width: 560px; height: auto; font-family: inherit; }
.viz-svg .grid { stroke: var(--line); stroke-width: 1; }
.viz-svg .grid.ref { stroke: var(--line-strong); }
.viz-svg .axis { stroke: var(--line-strong); stroke-width: 1; }
.viz-svg .tick { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.viz-svg .xlabel { fill: var(--text-2); font-size: 12px; }
.viz-svg .cap { fill: var(--text); font-size: 11.5px; font-weight: 600; font-variant-numeric: tabular-nums; }
.viz-svg .bar.A { fill: var(--series-a); }
.viz-svg .bar.B { fill: var(--series-b); }
.viz-svg .hit { fill: transparent; }
.viz-svg .col { outline: none; cursor: default; }
.viz-svg .col:hover .bar, .viz-svg .col:focus-visible .bar { filter: brightness(1.15); }
.viz-svg .col:focus-visible .hit { stroke: var(--text-2); stroke-width: 1.5; }
#viz-tip { position: fixed; z-index: 20; pointer-events: none; opacity: 0; transition: opacity .1s; background: var(--surface); color: var(--text);
  border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; box-shadow: 0 8px 24px rgba(16, 24, 40, .10); display: grid; gap: 2px; font-size: 13px; }
#viz-tip.show { opacity: 1; }
#viz-tip b { font-size: 15px; font-weight: 600; }
#viz-tip span { color: var(--text-2); }
#viz-tip i.key { width: 12px; height: 2px; border-radius: 1px; }
#viz-tip i.key.A { background: var(--series-a); }
#viz-tip i.key.B { background: var(--series-b); }
@media (forced-colors: active) { .viz-svg .bar { forced-color-adjust: none; stroke: CanvasText; stroke-width: 1; } }
.ab-daily summary { margin-top: 14px; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

.msgs { display: grid; gap: 6px; }
.msg { padding: 8px 12px; border-radius: 8px; font-size: 13px; }
.msg ul { margin: 4px 0 0; padding-left: 18px; }
.msg.bad { background: var(--bad-soft); color: var(--bad); }
.msg.warn { background: var(--warn-soft); color: var(--warn); }
.msg.ok { background: var(--ok-soft); color: var(--ok); }
.empty { padding: 28px; text-align: center; color: var(--muted); }

/* ---------- login ---------- */
.login {
  min-height: 100vh; display: grid; place-items: center; padding: 16px;
  background: radial-gradient(60% 50% at 50% 0%, var(--brand-soft) 0%, transparent 70%), var(--page);
}
.login .card { max-width: 420px; width: 100%; padding: 44px 40px; display: grid; gap: 10px; justify-items: center; text-align: center; }
.login .logo-mark { width: 56px; height: 56px; }
.login h1 { margin: 6px 0 0; font-size: 26px; font-weight: 600; letter-spacing: -.02em; }
.login .btn { width: 100%; margin-top: 18px; padding: 12px; }
.login-about { text-align: left; margin: 14px 0 0; padding-left: 18px; display: grid; gap: 4px; }
.login .card > p { margin: 4px 0 0; }
.login-links { display: flex; gap: 8px; justify-content: center; margin-top: 6px; }

/* ---------- sign-in (loginView): brand side + sign-in panel ---------- */
.auth { min-height: 100vh; min-height: 100dvh; display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(380px, 1fr); background: var(--page); }
.auth-brand {
  position: relative; overflow: hidden; color: #e8eaff; padding: 44px 56px; display: flex; flex-direction: column; gap: 36px;
  background:
    radial-gradient(55% 45% at 85% 8%, rgba(84, 101, 240, .55) 0%, transparent 70%),
    radial-gradient(45% 40% at 0% 100%, rgba(56, 189, 248, .22) 0%, transparent 70%),
    linear-gradient(160deg, #11142a 0%, #0b0d1c 100%);
}
.auth-brand::before { /* faint grid */
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .5;
  background-image: linear-gradient(rgba(255,255,255,.035) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.035) 1px, transparent 1px);
  background-size: 44px 44px; mask-image: radial-gradient(80% 70% at 60% 40%, #000 30%, transparent 80%);
}
.auth-brand > * { position: relative; }
.auth-logo { display: flex; align-items: center; gap: 12px; font-weight: 650; font-size: 17px; letter-spacing: -.01em; color: #fff; }
.auth-logo .logo-mark { width: 36px; height: 36px; filter: drop-shadow(0 6px 18px rgba(84, 101, 240, .55)); }
.auth-pitch h1 { margin: 0; font-size: clamp(30px, 3.4vw, 46px); line-height: 1.08; letter-spacing: -.035em; font-weight: 700; color: #fff; }
.auth-pitch p { margin: 16px 0 0; max-width: 520px; font-size: 15.5px; line-height: 1.6; color: rgba(232, 234, 255, .72); }
.auth-tools { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 14px 22px; max-width: 640px; }
.auth-tool { display: flex; gap: 12px; align-items: flex-start; }
.auth-tool-icon { width: 34px; height: 34px; flex: none; border-radius: 10px; display: grid; place-items: center; background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.09); color: #aeb6ff; }
.auth-tool-icon svg, .auth-tool-icon .icon { width: 18px; height: 18px; margin: 0; flex: none; color: #aeb6ff; stroke: currentColor; }
.auth-tool b { display: block; font-size: 14px; font-weight: 600; color: #fff; }
.auth-tool > div > span { display: block; margin-top: 2px; font-size: 12.5px; line-height: 1.5; color: rgba(232, 234, 255, .6); }
.auth-art { margin-top: auto; max-width: 460px; padding: 16px 18px 18px; border-radius: 16px; background: rgba(255,255,255,.045); border: 1px solid rgba(255,255,255,.09); backdrop-filter: blur(8px); box-shadow: 0 24px 60px rgba(0,0,0,.35); display: grid; gap: 9px; }
.auth-art-head { display: flex; justify-content: space-between; align-items: center; font-size: 12px; color: rgba(232,234,255,.65); margin-bottom: 4px; }
.auth-art-live { display: inline-flex; align-items: center; gap: 6px; color: #7ee2b8; }
.auth-art-live::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; box-shadow: 0 0 0 3px rgba(126,226,184,.18); }
.auth-tier { display: grid; grid-template-columns: 18px 1fr 56px; align-items: center; gap: 10px; font-size: 12px; font-variant-numeric: tabular-nums; }
.auth-tier-n { color: rgba(232,234,255,.4); text-align: right; }
.auth-tier-bar { height: 10px; border-radius: 6px; background: rgba(255,255,255,.06); position: relative; overflow: hidden; }
.auth-tier-bar::after { content: ""; position: absolute; inset: 0 auto 0 0; width: var(--w); border-radius: 6px; background: linear-gradient(90deg, #5465f0, #38bdf8); animation: auth-grow .9s cubic-bezier(.2,.8,.2,1) var(--d) both; }
.auth-tier-price { text-align: right; color: #fff; font-weight: 600; }
@keyframes auth-grow { from { width: 0; } }
@media (prefers-reduced-motion: reduce) { .auth-tier-bar::after { animation: none; } }

.auth-panel { display: flex; flex-direction: column; justify-content: center; align-items: center; padding: 40px 32px 28px; gap: 28px;
  background: radial-gradient(60% 40% at 50% 0%, var(--brand-tint, transparent) 0%, transparent 70%), var(--page); }
.auth-card { width: 100%; max-width: 380px; display: grid; gap: 12px; margin-top: auto; }
.auth-card-logo { display: none; }
.auth-card h2 { margin: 0; font-size: 28px; font-weight: 700; letter-spacing: -.025em; }
.auth-card > p { margin: 0 0 14px; font-size: 14.5px; line-height: 1.55; }
.auth-google { display: flex; align-items: center; justify-content: center; gap: 12px; height: 50px; border-radius: 12px; text-decoration: none;
  background: var(--surface); color: var(--text); border: 1px solid var(--line-strong); font-weight: 600; font-size: 15px;
  box-shadow: 0 1px 2px rgba(16,24,40,.05); transition: box-shadow .15s, border-color .15s, transform .15s; }
.auth-google:hover { text-decoration: none; border-color: var(--brand); box-shadow: 0 6px 20px rgba(84,101,240,.18); transform: translateY(-1px); }
.auth-google:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.auth-g svg { width: 20px; height: 20px; display: block; }
.auth-trust { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 8px; font-size: 13px; color: var(--text-2); }
.auth-trust li { display: flex; gap: 9px; align-items: center; }
.auth-trust li::before { content: ""; width: 16px; height: 16px; flex: none; border-radius: 50%; background: var(--ok-soft) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4.5 8.3l2.2 2.2 4.8-5' fill='none' stroke='%2316a34a' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 14px no-repeat; }
.auth-foot { margin-top: auto; max-width: 380px; width: 100%; text-align: center; font-size: 12px; color: var(--muted); }
.auth-foot p { margin: 0 0 6px; line-height: 1.5; }
.auth-foot .login-links { margin: 0; }

@media (max-width: 960px) {
  .auth { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .auth-brand { padding: 28px 22px 30px; gap: 22px; }
  .auth-art { display: none; }
  .auth-panel { padding: 32px 20px 24px; }
  .auth-card { margin-top: 0; }
}
@media (max-width: 560px) {
  /* phone: a short brand header, so the sign-in button is on the first screen */
  .auth-brand { padding: 24px 20px 26px; gap: 16px; }
  .auth-logo { font-size: 16px; }
  .auth-logo .logo-mark { width: 32px; height: 32px; }
  .auth-pitch h1 { font-size: 27px; }
  .auth-pitch p { margin-top: 10px; font-size: 14px; }
  .auth-tools { display: flex; flex-wrap: wrap; gap: 8px; }
  .auth-tool { align-items: center; gap: 8px; padding: 6px 10px 6px 6px; border-radius: 999px; background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.08); }
  .auth-tool-icon { width: 24px; height: 24px; border-radius: 50%; border: 0; background: rgba(255,255,255,.08); }
  .auth-tool-icon svg, .auth-tool-icon .icon { width: 14px; height: 14px; }
  .auth-tool b { font-size: 13px; font-weight: 500; }
  .auth-tool > div > span { display: none; }
  .auth-panel { padding: 28px 20px 22px; gap: 24px; }
  .auth-card h2 { font-size: 24px; }
}

/* ---------- dialog / toast ---------- */
dialog { border: 0; border-radius: var(--radius-xl); padding: 0; background: var(--surface); color: var(--text); width: min(560px, calc(100vw - 32px)); box-shadow: 0 24px 64px rgba(16, 24, 40, .18); }
dialog.wide { width: min(860px, calc(100vw - 32px)); }
dialog h4 { margin: 8px 0 0; font-size: 14px; font-weight: 600; }
dialog table td.mono { font-size: 12px; overflow-wrap: anywhere; }
button.link { all: unset; cursor: pointer; color: var(--text); font-weight: 500; border-bottom: 1px dashed var(--line-strong); }
button.link:hover { color: var(--brand); border-bottom-color: var(--brand); }
button.link:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 3px; }
dialog::backdrop { background: rgba(16, 24, 40, .35); }
dialog form { display: grid; gap: 18px; padding: 28px; max-height: 84vh; overflow: auto; }
dialog h3 { margin: 0; font-size: 20px; font-weight: 600; }
dialog .actions { justify-content: flex-end; }
.checklist { max-height: 280px; overflow: auto; border: 1px solid var(--line); border-radius: var(--radius); padding: 6px; display: grid; gap: 2px; }
.checklist label { display: flex; gap: 10px; align-items: center; padding: 7px 8px; border-radius: 8px; cursor: pointer; }
.checklist label:hover { background: var(--surface-2); }
#toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--ink); color: var(--surface); padding: 10px 18px; border-radius: 999px; opacity: 0; transition: opacity .2s; pointer-events: none; max-width: calc(100vw - 32px); z-index: 10; }
#toast.show { opacity: 1; }

/* ---------- small screens ---------- */
@media (max-width: 960px) {
  .frame { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .sidebar { position: static; height: auto; padding: 10px 16px; gap: 12px; flex-direction: row; flex-wrap: wrap; align-items: center; border-right: 0; border-bottom: 1px solid var(--line); }
  .logo { padding: 0; }
  .logo svg { width: 26px; height: 26px; }
  .nav { display: flex; gap: 4px; flex-wrap: wrap; flex: 1; }
  .nav a { padding: 6px 10px; }
  .whoami { display: none; }
  .account { margin: 0; padding: 0; border: 0; }
  .main { padding: 18px 16px 40px; }
  .card { padding: 16px; border-radius: var(--radius-lg); }
  .section { padding: 12px; }
  .page-title { font-size: 20px; }
  .kv { grid-template-columns: 1fr; gap: 2px 0; }
  .kv dd { margin-bottom: 10px; }
  table { display: block; overflow-x: auto; }
  .row { flex-wrap: wrap; }
  .filters { flex-direction: column; align-items: stretch; }
  .filters select.platform { width: 100%; }
}

/* ---------- loading ---------- */
/* Top bar while any request is in flight (indeterminate: a segment sliding across) */
#progress { position: fixed; top: 0; left: 0; right: 0; height: 2px; z-index: 20; overflow: hidden; opacity: 0; transition: opacity .2s; pointer-events: none; }
#progress.on { opacity: 1; }
#progress::before { content: ""; position: absolute; top: 0; bottom: 0; width: 35%; background: var(--brand); border-radius: 2px; animation: progress-slide 1.1s ease-in-out infinite; }
@keyframes progress-slide { from { left: -35%; } to { left: 100%; } }

.spinner { display: inline-block; width: 14px; height: 14px; flex: none; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; opacity: .75; animation: spin .7s linear infinite; vertical-align: -2px; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading { display: flex; align-items: center; gap: 10px; color: var(--muted); padding: 4px 0; }
.loading .spinner { color: var(--brand); opacity: 1; }
.btn .spinner { width: 13px; height: 13px; }
.btn.working, .btn:disabled:has(.spinner) { opacity: .85; cursor: progress; }

/* Skeleton rows: same shape as .rows, soft pulse */
.rows.skeleton { margin-top: 12px; }
.rows.skeleton .row { padding: 12px 14px; }
.rows.skeleton .grow { display: grid; gap: 7px; flex: 1; }
.bone { display: block; height: 10px; border-radius: 6px; background: var(--line-strong); animation: pulse 1.4s ease-in-out infinite; }
.bone.dot { width: 8px; height: 8px; border-radius: 50%; }
.bone.sm { width: 22%; height: 8px; }
.bone.w0 { width: 46%; } .bone.w1 { width: 58%; } .bone.w2 { width: 38%; } .bone.w3 { width: 52%; }
.bone.title { width: 220px; height: 22px; display: inline-block; vertical-align: middle; }
@keyframes pulse { 50% { opacity: .45; } }

/* Status pill for writes to AdMob: stays until done, with elapsed seconds */
#busy { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(8px); display: flex; align-items: center; gap: 10px; background: var(--surface); color: var(--text); border: 1px solid var(--line-strong); box-shadow: 0 12px 32px rgba(16, 24, 40, .14); padding: 9px 16px; border-radius: 999px; opacity: 0; transition: opacity .2s, transform .2s; pointer-events: none; max-width: calc(100vw - 32px); z-index: 11; }
#busy.show { opacity: 1; transform: translateX(-50%); }
#busy .spinner { color: var(--brand); opacity: 1; }
#busy .secs { color: var(--muted); font-variant-numeric: tabular-nums; font-size: 12.5px; }

/* Dialog while submitting: inputs locked, Esc blocked in JS */
dialog.busy form { pointer-events: none; }
dialog.busy form > :not(.actions) { opacity: .6; transition: opacity .2s; }
dialog.busy .actions .btn:not(.working) { opacity: .5; }

@media (prefers-reduced-motion: reduce) {
  .spinner { animation-duration: 1.6s; }
  .bone { animation: none; }
  #progress::before { animation-duration: 2.4s; }
}
table.bid-pick { table-layout: fixed; }
table.bid-pick th:first-child { width: 32%; }
table.bid-pick select { width: 100%; max-width: 100%; text-overflow: ellipsis; }

/* ---------- collapsible sidebar (state kept per browser) ---------- */
.frame { transition: grid-template-columns .18s ease; }
.frame.collapsed { grid-template-columns: 60px 1fr; }
.logo-row { display: flex; align-items: center; gap: 4px; }
.logo-row .logo { flex: 1; min-width: 0; }
.frame.collapsed .sidebar { padding: 16px 8px; align-items: center; }
.frame.collapsed .logo-row { flex-direction: column; gap: 10px; }
.frame.collapsed .logo { padding: 0; }
.frame.collapsed .label, .frame.collapsed .whoami { display: none; }
.frame.collapsed .nav a { justify-content: center; padding: 8px; }
.frame.collapsed .account { flex-direction: column; padding: 10px 0 0; }
.frame.collapsed .collapse-btn svg { transform: scaleX(-1); }

/* ---------- app page: list | detail ---------- */
/* Pinned while the page scrolls; the list pane sticks just below it (--head-h is measured in render()) */
.app-head {
  display: flex; align-items: center; gap: 10px 14px; flex-wrap: wrap;
  position: sticky; top: 0; z-index: 5; background: var(--page);
  margin: -20px -24px 14px; padding: 14px 24px 12px; border-bottom: 1px solid var(--line);
}
.app-head .back { margin: 0; padding: 6px; border-radius: 8px; color: var(--muted); }
.app-head .back:hover { background: var(--nav-active); color: var(--text); text-decoration: none; }
.app-title { display: grid; min-width: 0; }
.app-title .page-title { font-size: 19px; margin: 0; }
.app-head .page-tabs { margin: 0 0 0 auto; }
.split { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 16px; align-items: start; }
.list-pane {
  position: sticky; top: calc(var(--head-h, 0px) + 12px); max-height: calc(100vh - var(--head-h, 0px) - 24px); display: flex; flex-direction: column; gap: 8px; min-width: 0;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-xl); padding: 10px; box-shadow: var(--shadow-card);
}
.list-head { display: flex; align-items: center; gap: 2px; }
.list-head .search { flex: 1; margin: 0; }
.list-head .search input { padding-top: 6px; padding-bottom: 6px; font-size: 13px; }
.items { display: grid; gap: 1px; overflow-y: auto; min-height: 0; margin: 0 -4px; padding: 0 4px; align-content: start; }
.item {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 8px; align-items: center;
  padding: 7px 10px; border-radius: 8px; color: var(--text); text-decoration: none;
}
.item:hover { background: var(--surface-2); text-decoration: none; }
.item[aria-current=page] { background: var(--brand-soft); }
.item[aria-current=page] .item-title { color: var(--brand); }
.item-title { font-size: 13.5px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; grid-column: 1; }
.item-meta { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; grid-column: 1; }
.item-end { grid-column: 2; grid-row: 1 / span 2; display: flex; gap: 4px; }
.item-end .chip { font-size: 11px; padding: 1px 7px; }
.list-loading .rows.skeleton { margin-top: 8px; }
.list-foot { border-top: 1px solid var(--line); padding-top: 6px; font-size: 12.5px; }
.list-group { margin: 10px 10px 4px; font-size: 11.5px; font-weight: 600; letter-spacing: .03em; text-transform: uppercase; color: var(--muted); }
.list-group:first-child { margin-top: 2px; }
.detail-pane { min-width: 0; display: grid; gap: 12px; }
.detail-title { display: grid; min-width: 0; }
.detail-title h2 { margin: 0; font-size: 17px; font-weight: 600; letter-spacing: -.01em; overflow-wrap: anywhere; }
.pick-hint { display: grid; justify-items: center; gap: 10px; padding: 48px 24px; text-align: center; }
.pick-hint p { margin: 0; }
.only-narrow { display: none; }

@media (max-width: 960px) {
  .frame.collapsed { grid-template-columns: 1fr; }
  .collapse-btn { display: none; }
  .frame.collapsed .sidebar { padding: 10px 16px; flex-direction: row; }
  .frame.collapsed .logo-row { flex-direction: row; }
  .frame.collapsed .label { display: inline; }
  .frame.collapsed .account { flex-direction: row; padding: 0; }
  .split { grid-template-columns: 1fr; }
  .split.has-item .list-pane, .split:not(.has-item) .detail-pane { display: none; }
  .list-pane { position: static; max-height: none; }
  .only-narrow { display: inline-flex; }
  .app-head .page-tabs { margin-left: 0; }
}

/* ---------- app icons ---------- */
.app-icon { width: 36px; height: 36px; border-radius: 9px; flex: none; object-fit: cover; background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line); }
.app-icon.letter { display: grid; place-items: center; font-weight: 600; font-size: 15px; color: var(--text-2); }
.app-icon.gone { opacity: .55; filter: grayscale(1); }
.app-icon.big { width: 40px; height: 40px; border-radius: 10px; }

/* Mapping tab: adapter fields typed right in the list */
table.map-inline td { vertical-align: middle; }
.inline-fields { display: flex; flex-wrap: wrap; gap: 6px; }
.inline-fields input { flex: 1 1 180px; min-width: 0; padding: 5px 10px; font-size: 13px; border-radius: 8px; }
table.map-inline select.compact { margin-bottom: 6px; }
.cell-new { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; min-width: 200px; }
.cell-new input { flex: 1 1 140px; min-width: 0; padding: 4px 8px; font-size: 12.5px; border-radius: 7px; }

/* ---------- A | B side by side, like the AdMob A/B screen ---------- */
.sides { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; align-items: start; }
.variant { display: grid; gap: 10px; min-width: 0; }
.variant-head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; padding: 12px 16px; border-radius: var(--radius-lg); background: var(--variant-a-head); color: var(--on-series); }
.variant.b .variant-head { background: var(--variant-b-head); }
.variant-head b { font-size: 19px; font-weight: 600; letter-spacing: -.01em; }
.variant-head span { font-size: 13px; opacity: .9; }
.vpanel { border: 1px solid var(--line); border-left: 3px solid var(--series-a); border-radius: var(--radius-lg); background: var(--surface); padding: 12px 14px; min-width: 0; }
.variant.b .vpanel { border-left-color: var(--series-b); }
.vpanel h4 { margin: 0 0 8px; font-size: 15px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.vpanel h4 .n { font-size: 12px; font-weight: 500; color: var(--muted); }
.vpanel table { width: 100%; }
.vpanel td, .vpanel th { padding: 7px 8px; }
.vpanel .st { width: 28px; }
.vpanel .st svg { width: 17px; height: 17px; color: var(--ok); }
.vpanel tr.off .st svg { color: var(--muted); }
.vpanel tr.added td { background: var(--ok-soft); }
.vpanel tr.dropped td { color: var(--muted); text-decoration: line-through; }
.vpanel .empty-row { color: var(--muted); font-size: 13px; padding: 8px; }
.vpanel .gen { background: var(--surface-2); }
/* Same row height and column widths on both sides, so A and B line up row by row (the % chip on B
   must not make its rows taller) */
table.side-metrics { table-layout: fixed; width: 100%; }
table.side-metrics td { height: 34px; padding: 0 8px; border-bottom: 1px solid var(--line); font-size: 13px; vertical-align: middle; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
table.side-metrics td:nth-child(2) { width: 34%; }
table.side-metrics td:nth-child(3) { width: 88px; }
table.side-metrics .chip { padding: 0 8px; line-height: 20px; font-size: 12px; }
table.side-metrics tr:last-child td { border-bottom: 0; }
.compact-tiles .tile { padding: 10px 12px; }
@media (max-width: 960px) { .sides { grid-template-columns: 1fr; } }
.editor-tiers { display: grid; gap: 8px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); }
.vpanel .tiers { margin: 0; }
@media (max-width: 960px) { .app-head { margin: -18px -16px 14px; padding: 12px 16px 10px; } }

/* A | B columns share rows: each block (head, results, bidding, waterfall) starts at the same height on both sides */
@supports (grid-template-rows: subgrid) {
  .sides { align-items: stretch; }
  .sides > .variant { grid-template-rows: subgrid; align-content: stretch; }
  .sides > .variant.rows-2 { grid-row: span 2; }
  .sides > .variant.rows-3 { grid-row: span 3; }
  .sides > .variant.rows-4 { grid-row: span 4; }
  .sides > .variant.rows-5 { grid-row: span 5; }
  @media (max-width: 960px) { .sides > .variant { grid-row: auto; grid-template-rows: none; } }
}
.single .vpanel { border-left-color: var(--line); }
.traffic-split { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.traffic-split .seg { margin: 0; }
.traffic-split input.pct { width: 72px; padding: 4px 8px; }
.vpanel th.act, .vpanel td.act { width: 76px; text-align: right; white-space: nowrap; }
.icon-x { border: 0; background: none; color: var(--muted); font-size: 17px; line-height: 1; padding: 2px 6px; border-radius: 6px; cursor: pointer; }
.icon-x:hover { background: var(--bad-soft); color: var(--bad); }
.b-maps { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 6px 10px; margin-top: 6px; }
.b-maps label { display: grid; gap: 2px; min-width: 0; }
.b-maps label.changed select { border-color: var(--series-b); box-shadow: 0 0 0 2px color-mix(in srgb, var(--series-b) 20%, transparent); }
.b-maps select { width: 100%; }
.b-add { margin-top: 8px; }

/* Experiment log */
label.check { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-2); cursor: pointer; white-space: nowrap; }
.card h3 { margin: 0 0 6px; font-size: 14px; font-weight: 600; }
table.exps td { vertical-align: top; }
table.exps tr.selected td { background: var(--brand-tint); }
table.exps td.num { white-space: nowrap; }
@media (max-width: 720px) { .filters { flex-wrap: wrap; } }
.msg.brand-box { background: var(--brand-tint); color: var(--text); display: grid; gap: 4px; }
.msg.brand-box ul { margin: 2px 0; padding-left: 18px; }
.nav-badge { margin-left: auto; padding: 0 7px; font-size: 11px; }
.frame.collapsed .nav-badge { display: none; }
.row.rec { align-items: flex-start; }
.rec-why { margin: 4px 0 6px; padding-left: 18px; color: var(--text-2); }
.row.rec .title { white-space: normal; overflow: visible; }
@media (max-width: 720px) { .row.rec { flex-wrap: wrap; } .row.rec .end { width: 100%; justify-content: flex-start; } }
/* Ad unit performance */
.unit-stat { display: grid; gap: 1px; font-size: 12px; font-weight: 400; line-height: 1.35; color: var(--text-2); white-space: nowrap; }
.unit-stat b { font-weight: 600; color: var(--text); }
table.setup tr.stats th { vertical-align: top; background: var(--surface-2); border-bottom: 1px solid var(--line); }
.stat-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; }
.stat-tile { display: grid; gap: 2px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius); }
.stat-tile b { font-size: 18px; font-variant-numeric: tabular-nums; }
/* Create mediation group (right-hand pane) */
.net-card { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.net-card .card-head { margin-bottom: 0; }
.net-card select.compact { max-width: 100%; }
.net-card .seg { margin: 0; }
.net-card td select.compact { width: 100%; min-width: 180px; }
.net-form { display: grid; gap: 12px; margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); max-width: 640px; }
.net-form .field-row { grid-template-columns: minmax(160px, 220px) minmax(0, 1fr); }
/* Who may create on a network account: ticks over the signed-in users */
.email-field { display: grid; gap: 6px; min-width: 0; }
.email-picks { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 2px 12px; max-height: 280px; overflow: auto;
  border: 1px solid var(--line-strong); border-radius: 10px; padding: 6px 10px; }
.email-pick { display: flex; align-items: center; gap: 8px; min-width: 0; padding: 4px 0; font-size: 13px; cursor: pointer; }
.email-pick.locked { cursor: default; }
.email-pick .email { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.email-pick .chip { flex: none; }
ol.steps { margin: 0 0 4px; padding-left: 20px; display: grid; gap: 6px; }
.new-group { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; }
.new-group > *, .new-group .step > * { min-width: 0; }
.step { grid-template-columns: minmax(0, 1fr); }
@media (max-width: 720px) { .form-foot { margin: 4px -16px -16px; padding: 10px 16px; } }
.new-group .card-head { margin-bottom: 0; }
/* Create-group steps */
.step { display: grid; gap: 10px; padding-top: 16px; border-top: 1px solid var(--line); }
.step-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.step-head h3 { margin: 0; font-size: 15px; }
.step-head .seg { margin: 0; }
.step-n { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--ink); color: var(--on-ink); font-size: 12px; font-weight: 600; flex: none; }
.geo-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.geo-tools .combo { flex: 1 1 260px; }
.geo-tools .combo input { width: 100%; padding: 5px 10px 5px 30px; font-size: 13px; border-radius: 8px; }
table.pick-geo tr.low td { color: var(--muted); }
.th-sort { border: 0; background: none; padding: 0; font: inherit; color: inherit; cursor: pointer; display: inline-flex; gap: 4px; align-items: center; white-space: nowrap; }
.th-sort:hover, .th-sort.on { color: var(--text); }
.th-arrow { font-size: 11px; opacity: .45; }
.th-sort.on .th-arrow { opacity: 1; }
table.pick-geo .geo-code { display: inline-block; min-width: 24px; }
.per-geo { justify-self: start; }
.tier-row { display: grid; gap: 6px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius); }
.tier-meta { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.tier-line { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.tier-label { width: 44px; flex: none; font-size: 12px; color: var(--muted); }
.chip.tier { background: var(--surface-2); color: var(--text); font-variant-numeric: tabular-nums; }
.chip.tier.below { background: var(--warn-soft); color: var(--warn); }
input.tier-input { width: 72px; padding: 3px 8px; font-size: 12px; border-radius: 999px; }
details.fold { border-top: 1px solid var(--line); padding-top: 12px; }
details.fold > summary { cursor: pointer; display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; list-style-position: inside; }
details.fold[open] > summary { margin-bottom: 8px; }
.form-foot { position: sticky; bottom: 0; z-index: 5; display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin: 4px -22px -20px; padding: 12px 22px; background: var(--surface); border-top: 1px solid var(--line); border-radius: 0 0 var(--radius-xl) var(--radius-xl); }
.form-foot .seg { margin: 0; }
table.pick-units tbody tr { cursor: pointer; }
table.pick-units tr.selected td { background: var(--brand-tint); }
table.pick-units td.num { white-space: nowrap; }
.geo { display: grid; gap: 8px; }
.chip .chip-stat { font-weight: 400; color: var(--text-2); }
.chip .chip-stat.low { color: var(--muted); }
.geo .chip.brand { white-space: normal; }
.geo .inline-fields input { flex: 1; }
/* Country combobox: search field with a dropdown list under it */
.combo { position: relative; flex: 1 1 220px; min-width: 0; display: flex; }
.combo .combo-icon { position: absolute; left: 9px; top: 50%; transform: translateY(-50%); color: var(--muted); display: grid; pointer-events: none; }
.combo .combo-icon svg.icon { width: 15px; height: 15px; }
.geo .inline-fields .combo input { flex: 1; padding-left: 30px; }
.combo-list { position: absolute; z-index: 30; top: calc(100% + 4px); left: 0; right: 0; max-height: 300px; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius); padding: 4px;
  box-shadow: 0 8px 24px rgba(16, 24, 40, .12); }
.combo-head, .combo-empty { padding: 6px 8px; }
.combo-item { display: grid; grid-template-columns: 16px 28px minmax(0, 1fr) auto; align-items: center; gap: 8px;
  padding: 6px 8px; border-radius: 8px; cursor: pointer; font-size: 13px; }
.combo-item.active { background: var(--nav-active); }
.combo-item[aria-selected=true] .combo-code { color: var(--brand); }
.combo-check { display: grid; place-items: center; width: 16px; height: 16px; border: 1.5px solid var(--line-strong); border-radius: 4px; background: var(--surface); }
.combo-check.on { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.combo-check svg.icon { width: 12px; height: 12px; stroke-width: 2.6; }
.combo-list { padding-bottom: 0; }
.combo-foot { position: sticky; bottom: 0; display: flex; align-items: center; gap: 10px; padding: 8px; margin: 4px -4px 0;
  background: var(--surface); border-top: 1px solid var(--line); }
.combo-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.combo-rev { white-space: nowrap; font-variant-numeric: tabular-nums; color: var(--text-2); }
.combo-rev.low { color: var(--muted); }
@media (max-width: 520px) {
  .combo-name .muted { display: none; }
  .combo-item { grid-template-columns: 16px 28px minmax(0, 1fr); }
  .combo-rev { grid-column: 3; white-space: normal; }
}

/* ---------- phone: compact top bar (logo · group switch · account), then the menu as one row scrolling sideways ---------- */
@media (max-width: 640px) {
  .frame .sidebar { display: grid; grid-template-columns: auto 1fr auto; grid-template-areas: "logo sw acct" "nav nav nav"; gap: 8px 10px; padding: 8px 12px 6px; align-items: center; }
  .frame .sidebar .logo-row { grid-area: logo; }
  .frame .sidebar .logo .label { display: none; }
  .frame .sidebar .ui-switch { grid-area: sw; padding: 0; justify-self: start; }
  .frame .sidebar .ui-switch > .label { display: none; }
  .frame .sidebar .account { grid-area: acct; }
  .frame .sidebar .nav { grid-area: nav; display: flex; flex-wrap: nowrap; overflow-x: auto; gap: 2px; margin: 0 -12px; padding: 0 12px 2px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  .frame .sidebar .nav::-webkit-scrollbar { display: none; }
  .frame .sidebar .nav a { flex: none; white-space: nowrap; padding: 6px 10px; gap: 6px; }
  .frame .sidebar .nav .label { display: inline; }
  .frame .sidebar .nav-badge { margin-left: 2px; }
}
