/* Media Check: one stylesheet for the app, login and setup. */
:root {
  color-scheme: light;
  --bg: #f4f4f1;
  --surface: #ffffff;
  --surface-2: #f9f9f7;
  --surface-3: #f0efec;
  --border: #e6e5e0;
  --border-strong: #d3d2cc;
  --text: #0b0b0b;
  --text-2: #52514e;
  --text-3: #85847e;
  --accent: #2a78d6;
  --accent-ink: #1c5cab;
  --accent-soft: #e6f0fc;
  --series-1: #2a78d6;
  --series-1-soft: #b7d3f6;
  --good: #0ca30c;   --good-ink: #0a6f0a;   --good-soft: #e6f5e6;
  --warn: #fab219;   --warn-ink: #7f5300;   --warn-soft: #fff4d9;
  --serious: #ec835a; --serious-ink: #9b4019; --serious-soft: #fdece4;
  --crit: #d03b3b;   --crit-ink: #a92727;   --crit-soft: #fbe8e8;
  --shadow: 0 1px 2px rgba(15, 15, 10, .04), 0 1px 1px rgba(15, 15, 10, .03);
  --shadow-lg: 0 10px 30px rgba(15, 15, 10, .10), 0 2px 6px rgba(15, 15, 10, .06);
  --radius: 12px;
  --radius-sm: 8px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Segoe UI", system-ui, sans-serif;
  --mono: "SF Mono", ui-monospace, Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #111110; --surface: #1a1a19; --surface-2: #1f1f1d; --surface-3: #262624;
    --border: #2b2b29; --border-strong: #3a3a37;
    --text: #ffffff; --text-2: #c3c2b7; --text-3: #8b8a82;
    --accent: #3987e5; --accent-ink: #86b6ef; --accent-soft: #17283d;
    --series-1: #3987e5; --series-1-soft: #1c3a5e;
    --good-ink: #5fd35f; --good-soft: #13291a;
    --warn-ink: #f7c75a; --warn-soft: #2e2510;
    --serious-ink: #f2a586; --serious-soft: #331d14;
    --crit-ink: #f08a8a; --crit-soft: #351717;
    --shadow: 0 1px 0 rgba(255, 255, 255, .02);
    --shadow-lg: 0 12px 32px rgba(0, 0, 0, .5);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #111110; --surface: #1a1a19; --surface-2: #1f1f1d; --surface-3: #262624;
  --border: #2b2b29; --border-strong: #3a3a37;
  --text: #ffffff; --text-2: #c3c2b7; --text-3: #8b8a82;
  --accent: #3987e5; --accent-ink: #86b6ef; --accent-soft: #17283d;
  --series-1: #3987e5; --series-1-soft: #1c3a5e;
  --good-ink: #5fd35f; --good-soft: #13291a;
  --warn-ink: #f7c75a; --warn-soft: #2e2510;
  --serious-ink: #f2a586; --serious-soft: #331d14;
  --crit-ink: #f08a8a; --crit-soft: #351717;
  --shadow: 0 1px 0 rgba(255, 255, 255, .02);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, .5);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 14px/1.45 var(--font); font-feature-settings: "tnum" 1, "cv11" 1;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent-ink); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.muted { color: var(--text-2); }
.faint { color: var(--text-3); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: saturate(1.4) blur(12px); -webkit-backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--border);
}
.topbar-inner { max-width: 1320px; margin: 0 auto; padding: 0 24px; display: flex; align-items: center; gap: 20px; height: 56px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 650; letter-spacing: -.01em; white-space: nowrap; }
.brand-mark { width: 26px; height: 26px; border-radius: 7px; background: var(--text); color: var(--bg); display: grid; place-items: center; font-size: 13px; font-weight: 750; }
.nav { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; flex: 1; min-width: 0; }
.nav::-webkit-scrollbar { display: none; }
.nav a {
  padding: 7px 11px; border-radius: 8px; color: var(--text-2); font-weight: 520; white-space: nowrap; text-decoration: none;
  display: inline-flex; align-items: center; gap: 6px;
}
.nav a:hover { background: var(--surface-3); color: var(--text); }
.nav a[aria-current="page"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow), 0 0 0 1px var(--border); }
.nav .count { font-size: 11px; font-weight: 650; padding: 0 6px; border-radius: 99px; background: var(--crit-soft); color: var(--crit-ink); }
.top-actions { display: flex; align-items: center; gap: 8px; }
.updated { color: var(--text-3); font-size: 12.5px; white-space: nowrap; }
.updated.stale { color: var(--warn-ink); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 34px; padding: 0 13px; border-radius: 9px; border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text); font-weight: 560; cursor: pointer; white-space: nowrap;
  box-shadow: var(--shadow); transition: background .12s, border-color .12s;
}
.btn:hover { background: var(--surface-2); border-color: var(--text-3); }
.btn:disabled { opacity: .6; cursor: default; }
.btn-primary { background: var(--text); color: var(--bg); border-color: var(--text); }
.btn-primary:hover { background: var(--text-2); border-color: var(--text-2); }
.btn-ghost { background: transparent; border-color: transparent; box-shadow: none; padding: 0 9px; }
.btn-ghost:hover { background: var(--surface-3); border-color: transparent; }
.btn svg { width: 16px; height: 16px; flex: none; }
.spin svg { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- toolbar ---------- */
.toolbar { max-width: 1320px; margin: 0 auto; padding: 18px 24px 4px; display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.seg { display: inline-flex; padding: 3px; gap: 2px; background: var(--surface-3); border-radius: 10px; border: 1px solid var(--border); }
.seg button {
  border: 0; background: transparent; padding: 5px 11px; border-radius: 7px; cursor: pointer; color: var(--text-2);
  font-weight: 540; font-size: 13px; white-space: nowrap;
}
.seg button:hover { color: var(--text); }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow), 0 0 0 1px var(--border); }
.toolbar .range { color: var(--text-3); font-size: 12.5px; }
.toolbar .grow { flex: 1; }

/* ---------- layout ---------- */
main { max-width: 1320px; margin: 0 auto; padding: 14px 24px 64px; }
.stack { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
.stack > *, .grid-2 > *, .grid-3 > *, .hero > * { min-width: 0; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 18px 20px; }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 16px 20px 0; }
.card-head h2, .card-head h3 { margin: 0; font-size: 14.5px; font-weight: 650; letter-spacing: -.005em; }
.card-head .sub { color: var(--text-3); font-size: 12.5px; }
.card-head a { font-size: 13px; font-weight: 550; white-space: nowrap; }
.section-title { font-size: 13px; font-weight: 650; color: var(--text-2); text-transform: none; margin: 8px 2px -4px; }

.banner { display: flex; gap: 10px; align-items: flex-start; padding: 11px 14px; border-radius: 10px; font-size: 13.5px; border: 1px solid; }
.banner.info { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 30%, transparent); color: var(--text); }
.banner.warn { background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 45%, transparent); }
.banner.crit { background: var(--crit-soft); border-color: color-mix(in srgb, var(--crit) 35%, transparent); }
.banner svg { width: 16px; height: 16px; flex: none; margin-top: 2px; }

/* ---------- verdict hero ---------- */
.hero { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(280px, 1fr); }
.hero-main { padding: 22px 24px; }
.hero-side { padding: 22px 24px; border-left: 1px solid var(--border); display: grid; gap: 14px; align-content: start; }
.pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px 3px 8px; border-radius: 99px;
  font-size: 12.5px; font-weight: 650; white-space: nowrap;
}
.pill svg { width: 14px; height: 14px; }
.tone-good { background: var(--good-soft); color: var(--good-ink); }
.tone-warning { background: var(--warn-soft); color: var(--warn-ink); }
.tone-serious { background: var(--serious-soft); color: var(--serious-ink); }
.tone-critical { background: var(--crit-soft); color: var(--crit-ink); }
.tone-neutral { background: var(--surface-3); color: var(--text-2); }
.tone-off { background: transparent; color: var(--text-3); border: 1px solid var(--border); }
.hero h1 { font-size: 24px; line-height: 1.25; letter-spacing: -.02em; margin: 12px 0 10px; font-weight: 680; }
.hero h1 .pos { color: var(--good-ink); }
.hero h1 .neg { color: var(--crit-ink); }
.hero-points { margin: 0; padding: 0; list-style: none; display: grid; gap: 7px; color: var(--text-2); }
.hero-points li { display: flex; gap: 9px; }
.hero-points li::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: var(--text-3); margin-top: 8px; flex: none; }
.hero-points b { color: var(--text); font-weight: 600; }
.hero-note { margin: 10px 0 0 14px; font-size: 12.5px; }

.meter { display: grid; gap: 6px; }
.meter-label { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--text-2); }
.meter-label b { color: var(--text); font-size: 15px; }
.meter-track { position: relative; height: 10px; border-radius: 99px; background: var(--surface-3); overflow: visible; }
.meter-zone { position: absolute; top: 0; bottom: 0; }
.meter-fill { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 99px; }
.meter-tick { position: absolute; top: -4px; bottom: -4px; width: 2px; background: var(--text); border-radius: 2px; }
.meter-tick span { position: absolute; top: 18px; left: 50%; transform: translateX(-50%); font-size: 11px; color: var(--text-3); white-space: nowrap; }
.meter-scale { display: flex; justify-content: space-between; font-size: 11px; color: var(--text-3); margin-top: 10px; }

/* ---------- actions ---------- */
.actions-tabs { display: flex; gap: 6px; padding: 14px 20px 0; flex-wrap: wrap; }
.chip-btn {
  display: inline-flex; align-items: center; gap: 7px; padding: 6px 11px; border-radius: 99px; border: 1px solid var(--border);
  background: var(--surface); cursor: pointer; font-weight: 560; font-size: 13px; color: var(--text-2);
}
.chip-btn:hover { border-color: var(--border-strong); color: var(--text); }
.chip-btn[aria-pressed="true"] { border-color: var(--text); color: var(--text); background: var(--surface-2); }
.chip-btn .n { font-weight: 700; color: var(--text); }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }
.dot.critical { background: var(--crit); } .dot.serious { background: var(--serious); } .dot.warning { background: var(--warn); }
.dot.good { background: var(--good); } .dot.neutral { background: var(--text-3); } .dot.off { background: var(--border-strong); }

.rows { list-style: none; margin: 0; padding: 8px 8px 10px; }
.row {
  display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; gap: 12px; align-items: center;
  padding: 9px 12px; border-radius: 10px;
}
.row:hover { background: var(--surface-2); }
.row .title { min-width: 0; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .reason { color: var(--text-2); font-size: 13px; }
.row .meta { color: var(--text-3); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .right { display: flex; align-items: center; gap: 10px; }
.empty-state { padding: 22px 20px 24px; color: var(--text-3); text-align: center; }
.more { display: block; width: calc(100% - 16px); margin: 0 8px 10px; padding: 8px; border: 0; background: transparent; color: var(--accent-ink); font-weight: 560; cursor: pointer; border-radius: 8px; }
.more:hover { background: var(--surface-2); }

/* thumbnails */
.thumb {
  width: 40px; height: 56px; border-radius: 7px; background: var(--surface-3); overflow: hidden; flex: none;
  display: grid; place-items: center; color: var(--text-3); font-size: 10px; font-weight: 700; letter-spacing: .02em;
  border: 1px solid var(--border); position: relative;
}
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb.sq { height: 40px; }
.thumb .kind { position: absolute; right: 2px; bottom: 2px; width: 14px; height: 14px; border-radius: 4px; background: rgba(0,0,0,.55); color: #fff; display: grid; place-items: center; }
.thumb .kind svg { width: 9px; height: 9px; }

/* ---------- KPI ---------- */
.kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 1px; background: var(--border); border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border); box-shadow: var(--shadow); }
.kpi { background: var(--surface); padding: 15px 18px 14px; display: grid; gap: 4px; min-width: 0; }
.kpi .label { color: var(--text-2); font-size: 12.5px; font-weight: 540; display: flex; align-items: center; gap: 5px; }
.kpi .label .sub { color: var(--text-3); font-weight: 500; font-size: 11.5px; }
.kpi .value { font-size: 23px; font-weight: 680; letter-spacing: -.02em; line-height: 1.15; }
.kpi .value small { font-size: 13px; color: var(--text-3); font-weight: 560; letter-spacing: 0; }
.kpi .foot { font-size: 12px; color: var(--text-3); display: flex; gap: 6px; align-items: center; flex-wrap: wrap; min-height: 18px; }
.delta { font-weight: 650; font-size: 12px; display: inline-flex; align-items: center; gap: 2px; }
.delta.up { color: var(--good-ink); } .delta.down { color: var(--crit-ink); } .delta.flat { color: var(--text-3); }
.i-tip { display: inline-grid; place-items: center; width: 15px; height: 15px; border-radius: 50%; border: 1px solid var(--border-strong); color: var(--text-3); font-size: 10px; font-weight: 700; cursor: help; }

/* ---------- charts ---------- */
.chart { position: relative; padding: 6px 12px 12px; }
.chart svg { display: block; width: 100%; overflow: visible; }
.chart .axis text { fill: var(--text-3); font-size: 11px; }
.chart .grid line { stroke: var(--border); }
.chart .ref line { stroke: var(--crit); stroke-dasharray: 4 4; stroke-width: 1.5; }
.chart .ref text { fill: var(--crit-ink); font-size: 11px; font-weight: 600; }
.chart .bar { fill: var(--series-1); }
.chart .bar.partial { fill: var(--series-1-soft); }
.chart .bar.pos { fill: var(--good); }
.chart .bar.neg { fill: var(--crit); }
.chart .bar.pos.partial { fill: color-mix(in srgb, var(--good) 40%, var(--surface)); }
.chart .bar.neg.partial { fill: color-mix(in srgb, var(--crit) 40%, var(--surface)); }
.chart .grid .zero { stroke: var(--text-3); }
.chart .line { fill: none; stroke: var(--series-1); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .pt { fill: var(--series-1); stroke: var(--surface); stroke-width: 2; }
.chart .cross { stroke: var(--text-3); stroke-width: 1; }
.tip {
  position: absolute; pointer-events: none; z-index: 5; background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: 9px; padding: 8px 10px; font-size: 12.5px; box-shadow: var(--shadow-lg); white-space: nowrap; transform: translate(-50%, -100%);
}
.tip b { font-weight: 650; }
.tip .t { color: var(--text-3); font-size: 11.5px; margin-bottom: 2px; }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--text-2); padding: 10px 20px 0; flex-wrap: wrap; }
.legend span { display: inline-flex; gap: 6px; align-items: center; }
.legend i { width: 12px; height: 3px; border-radius: 2px; display: inline-block; }
.spark { display: block; }
.spark path { fill: none; stroke: var(--series-1); stroke-width: 1.5; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
table.t th {
  text-align: right; font-weight: 560; color: var(--text-3); font-size: 12px; padding: 9px 10px; border-bottom: 1px solid var(--border);
  white-space: nowrap; position: sticky; top: 0; background: var(--surface); cursor: pointer; user-select: none;
}
table.t th:first-child, table.t td:first-child { text-align: left; padding-left: 20px; }
table.t th:last-child, table.t td:last-child { padding-right: 20px; }
table.t th.l, table.t td.l { text-align: left; }
table.t th[aria-sort] { color: var(--text); }
table.t th[aria-sort="descending"]::after { content: " ↓"; }
table.t th[aria-sort="ascending"]::after { content: " ↑"; }
table.t td { padding: 9px 10px; border-bottom: 1px solid var(--border); text-align: right; vertical-align: middle; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.t tbody tr:last-child td { border-bottom: 0; }
table.t tbody tr.click { cursor: pointer; }
table.t tbody tr.click:hover td { background: var(--surface-2); }
table.t tr.sub td { background: var(--surface-2); font-size: 12.5px; }
table.t tr.sub td:first-child { padding-left: 72px; }
table.t tr.open td { background: var(--surface-2); }
.cell-main { display: flex; align-items: center; gap: 12px; min-width: 260px; max-width: 420px; }
.cell-main .txt { min-width: 0; }
.cell-main .name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cell-main .tags { display: flex; gap: 4px; margin-top: 3px; flex-wrap: wrap; }
.tag { font-size: 11px; font-weight: 600; padding: 1px 6px; border-radius: 5px; background: var(--surface-3); color: var(--text-2); white-space: nowrap; }
.tag.live { background: var(--good-soft); color: var(--good-ink); }
.tag.acc { background: transparent; border: 1px solid var(--border); }
.good-txt { color: var(--good-ink); font-weight: 600; }
.bad-txt { color: var(--crit-ink); font-weight: 600; }
.warn-txt { color: var(--warn-ink); font-weight: 600; }
.roas-bar { display: inline-flex; align-items: center; gap: 8px; }
.roas-bar .b { width: 46px; height: 5px; border-radius: 99px; background: var(--surface-3); position: relative; overflow: hidden; }
.roas-bar .b i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 99px; }

/* filters */
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; padding: 14px 20px; border-bottom: 1px solid var(--border); }
.search { position: relative; flex: 1 1 220px; max-width: 320px; }
.search input {
  width: 100%; height: 34px; border-radius: 9px; border: 1px solid var(--border-strong); background: var(--surface-2);
  padding: 0 12px 0 32px; color: var(--text); font: inherit;
}
.search svg { position: absolute; left: 10px; top: 9px; width: 16px; height: 16px; color: var(--text-3); }
select.sel { height: 34px; border-radius: 9px; border: 1px solid var(--border-strong); background: var(--surface-2); color: var(--text); padding: 0 28px 0 10px; font: inherit; }

/* channel cards */
.mini-kpis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; padding: 14px 20px 18px; }
.mini-kpis .k .l { color: var(--text-3); font-size: 12px; }
.mini-kpis .k .v { font-size: 19px; font-weight: 670; letter-spacing: -.01em; }
.note { color: var(--text-3); font-size: 12.5px; padding: 0 20px 16px; }

/* activity */
.feed { list-style: none; margin: 0; padding: 4px 0 8px; }
.feed li { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 12px; padding: 10px 20px; border-bottom: 1px solid var(--border); }
.feed li:last-child { border-bottom: 0; }
.feed .time { color: var(--text-3); font-size: 12.5px; }
.feed .what { font-weight: 560; overflow-wrap: anywhere; }
.feed .detail { color: var(--text-2); font-family: var(--mono); font-size: 12px; overflow-wrap: anywhere; }
.feed .day { grid-column: 1 / -1; font-size: 12px; font-weight: 650; color: var(--text-2); padding-top: 6px; border: 0; }

/* rules page */
.rules dl { display: grid; grid-template-columns: minmax(180px, 260px) minmax(0, 1fr); gap: 0; margin: 0; }
.rules dt, .rules dd { padding: 10px 20px; border-bottom: 1px solid var(--border); margin: 0; }
.rules dt { font-weight: 600; }
.rules dd { color: var(--text-2); }

/* blind spots */
.blind { list-style: none; margin: 0; padding: 6px 20px 16px; display: grid; gap: 8px; color: var(--text-2); font-size: 13px; }
.blind li { display: flex; gap: 10px; }
.blind li svg { width: 15px; height: 15px; color: var(--text-3); flex: none; margin-top: 2px; }

/* progress toast */
.toast {
  position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 50;
  background: var(--text); color: var(--bg); border-radius: 12px; padding: 11px 16px; font-size: 13px; box-shadow: var(--shadow-lg);
  display: flex; gap: 10px; align-items: center; max-width: calc(100vw - 32px);
}
.toast svg { width: 16px; height: 16px; animation: spin 1s linear infinite; flex: none; }

/* skeleton */
.skel { background: linear-gradient(90deg, var(--surface-3), var(--surface-2), var(--surface-3)); background-size: 200% 100%; animation: sk 1.2s ease-in-out infinite; border-radius: 8px; }
@keyframes sk { to { background-position: -200% 0; } }

/* ---------- auth pages ---------- */
.auth-page { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background: var(--bg); }
.auth-card { width: 100%; max-width: 420px; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow-lg); padding: 28px 26px; }
.auth-title { margin: 0 0 4px; font-size: 21px; letter-spacing: -.02em; display: flex; align-items: center; gap: 10px; }
.auth-title::before { content: "M"; width: 28px; height: 28px; border-radius: 8px; background: var(--text); color: var(--bg); display: grid; place-items: center; font-size: 14px; font-weight: 750; }
.auth-sub { margin: 0 0 20px; color: var(--text-2); }
.auth-card form { display: grid; gap: 14px; }
.field { display: grid; gap: 6px; }
.field > span { font-weight: 560; font-size: 13px; }
.field input {
  height: 40px; border-radius: 10px; border: 1px solid var(--border-strong); background: var(--surface-2); color: var(--text);
  padding: 0 12px; font: inherit;
}
.field input:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; }
.hint { color: var(--text-3); font-size: 12px; }
.form-error { margin: 0; color: var(--crit-ink); background: var(--crit-soft); padding: 9px 11px; border-radius: 9px; font-size: 13px; }
.form-ok { margin: 0; color: var(--good-ink); background: var(--good-soft); padding: 9px 11px; border-radius: 9px; font-size: 13px; }
.auth-card .btn { height: 40px; }

/* settings */
.settings form { display: grid; gap: 14px; padding: 6px 20px 20px; max-width: 520px; }
.conn { display: flex; gap: 8px; align-items: center; font-size: 13px; color: var(--text-2); }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .hero { grid-template-columns: minmax(0, 1fr); }
  .hero-side { border-left: 0; border-top: 1px solid var(--border); }
  .grid-3 { grid-template-columns: 1fr 1fr; }
  .grid-3.trend > :nth-child(3) { grid-column: 1 / -1; }   /* the profit chart takes the full row under spend + ROAS */
}
@media (max-width: 760px) {
  .topbar-inner { padding: 0 16px; gap: 10px; height: auto; min-height: 52px; flex-wrap: wrap; padding-top: 8px; padding-bottom: 6px; }
  .nav { order: 3; flex-basis: 100%; }
  .brand span:last-child { display: none; }
  .top-actions { margin-left: auto; }
  .updated { display: none; }
  .toolbar { padding: 12px 16px 2px; gap: 8px; }
  .toolbar .seg { max-width: 100%; overflow-x: auto; }
  main { padding: 10px 16px 48px; }
  .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi .value { font-size: 20px; }
  .hero-main, .hero-side { padding: 18px; }
  .hero h1 { font-size: 20px; }
  .row { grid-template-columns: 36px minmax(0, 1fr); }
  .row .right { grid-column: 2; justify-content: flex-start; flex-wrap: wrap; min-width: 0; row-gap: 6px; }
  .mini-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cell-main { min-width: 200px; }
  .rules dl { grid-template-columns: minmax(0, 1fr); }
  .rules dt { border-bottom: 0; padding-bottom: 0; }
  .card-head, .actions-tabs, .filters { padding-left: 16px; padding-right: 16px; }
  table.t th:first-child, table.t td:first-child { padding-left: 16px; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* inline link icons */
a svg { width: 13px; height: 13px; vertical-align: -2px; flex: none; }
.row .right a, td a { display: inline-flex; align-items: center; gap: 4px; font-size: 12.5px; font-weight: 560; white-space: nowrap; }
.card-head h3 svg { width: 15px; height: 15px; vertical-align: -2px; }
main:focus, main:focus-visible { outline: none; }
