/* EasyTarget design system: tokens → base elements → layout → components. No framework, no build step.
   Light and dark themes come from the same tokens. Rules for copy live in docs/UX.md. */

/* ---------- tokens ---------- */
:root {
  color-scheme: light;
  --bg: #f5f6f8; --surface: #fff; --surface-2: #f1f3f6; --border: #e7e9ee;
  --text: #0f172a; --muted: #667085; --faint: #98a2b3;
  --accent: #2563eb; --accent-hover: #1d4ed8; --accent-soft: #eaf1ff; --on-accent: #fff;
  --ok: #15803d; --ok-soft: #e7f6ec; --warn: #b45309; --warn-soft: #fff3dc;
  --bad: #c81e1e; --bad-soft: #fdecec; --idle: #475467; --idle-soft: #eef0f3;
  --serp-link: #1a0dab; --serp-url: #15803d;
  --radius: 16px; --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 6px 20px rgba(16, 24, 40, .06);
  --side-w: 248px; --pad: 28px;
  --font: "Onest", system-ui, -apple-system, "Segoe UI", sans-serif;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b0f17; --surface: #121826; --surface-2: #192132; --border: #243049;
  --text: #e6eaf2; --muted: #98a3b8; --faint: #6b778d;
  --accent: #5b8cff; --accent-hover: #7aa2ff; --accent-soft: rgba(91, 140, 255, .15); --on-accent: #fff;
  --ok: #4ade80; --ok-soft: rgba(74, 222, 128, .12); --warn: #fbbf24; --warn-soft: rgba(251, 191, 36, .12);
  --bad: #f87171; --bad-soft: rgba(248, 113, 113, .12); --idle: #a7b0c0; --idle-soft: rgba(167, 176, 192, .12);
  --serp-link: #8ab4f8; --serp-url: #4ade80;
  --shadow: 0 0 0 1px rgba(255, 255, 255, .02);
}

/* ---------- base elements ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 14.5px/1.55 var(--font);
  -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
h1, h2, h3, h4 { margin: 0 0 .5rem; line-height: 1.25; font-weight: 650; letter-spacing: -.01em; }
h1 { font-size: 28px; font-weight: 700; letter-spacing: -.02em; }
h2 { font-size: 18px; }
h3 { font-size: 16px; }
h4 { font-size: 14.5px; margin-top: 1rem; }
p { margin: 0 0 .75rem; }
ul, ol { margin: 0 0 .75rem; padding-left: 1.25rem; }
small { font-size: 12.5px; }
hr { border: 0; border-top: 1px solid var(--border); margin: 1.5rem 0; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.num { font-variant-numeric: tabular-nums; }
.lead { font-size: 15.5px; color: var(--muted); max-width: 70ch; margin-bottom: 1.5rem; }
.hint { font-size: 13px; color: var(--muted); margin: -.1rem 0 .75rem; }
[hidden] { display: none !important; }  /* the form rules below must not show a hidden field */
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* forms */
label { display: block; font-weight: 550; margin-bottom: 1rem; }

input:not([type="checkbox"], [type="radio"], [type="hidden"]), select, textarea {
  display: block; width: 100%; font: inherit; color: var(--text); background: var(--surface);
  border: 1.5px solid var(--border); border-radius: var(--radius-sm); padding: 9px 12px; margin-bottom: .6rem;
  transition: border-color .15s, box-shadow .15s; }
/* a field inside its label: regular weight, not the label's bold */
label > input:not([type="checkbox"], [type="radio"]), label > select, label > textarea { margin-top: .4rem; font-weight: 400; }
input:not([type="checkbox"], [type="radio"]):focus, select:focus, textarea:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
input[readonly], textarea[readonly] { background: var(--surface-2); }
textarea { resize: vertical; min-height: 64px; }
select { appearance: none; padding-right: 36px; background-repeat: no-repeat; background-position: right 12px center;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%23667085' stroke-width='2' stroke-linecap='round' viewBox='0 0 24 24'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); }
input[type="checkbox"], input[type="radio"] { width: 18px; height: 18px; accent-color: var(--accent); margin: 0 8px 0 0;
  vertical-align: -3px; }
label:has(> input[type="checkbox"]), label:has(> input[type="radio"]) { font-weight: 400; margin-bottom: .6rem; }
input:disabled, button:disabled { opacity: .55; cursor: not-allowed; }
fieldset { border: 0; padding: 0; margin: 0 0 2rem; min-width: 0; }
legend { font-weight: 650; font-size: 16px; padding: 0; margin-bottom: .5rem; display: flex; align-items: center; gap: 8px; }
.lg-ic { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; flex: none;
  background: var(--accent-soft); color: var(--accent); }
.lg-ic .i { width: 16px; height: 16px; }
.tip { position: relative; display: inline-grid; place-items: center; color: var(--faint, var(--muted)); cursor: help; border-radius: 50%; }
.tip > .i { width: 16px; height: 16px; }
.tip:hover, .tip:focus { color: var(--accent); outline: none; }
.tip-body { position: absolute; left: 50%; top: calc(100% + 8px); transform: translateX(-50%); width: min(320px, 80vw); z-index: 30;
  padding: 10px 12px; border-radius: var(--radius-sm); background: var(--text); color: var(--bg); font-size: 13px; font-weight: 400;
  line-height: 1.45; box-shadow: 0 8px 24px rgba(0, 0, 0, .18); opacity: 0; visibility: hidden; transition: opacity .15s; pointer-events: none; }
.tip:hover .tip-body, .tip:focus .tip-body { opacity: 1; visibility: visible; }
/* expert wizard: each block is a card; money stands out */
.blocks fieldset { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; margin-bottom: 14px; }
.blocks fieldset > legend { float: left; width: 100%; margin-bottom: 10px; }
.blocks fieldset > legend + * { clear: both; }
.blocks fieldset.money { border-color: color-mix(in srgb, var(--accent) 40%, var(--border));
  background: linear-gradient(180deg, var(--accent-soft), var(--surface) 70%); }
.blocks fieldset.money .lg-ic { background: var(--accent); color: var(--on-accent); }
.step-intro { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; margin: 4px 0 22px; border-radius: var(--radius-sm);
  overflow: hidden; border: 1px solid var(--border); background: var(--border); font-size: 13.5px; }
.step-intro > div { background: var(--surface); padding: 10px 14px; }
.step-intro .k { display: block; font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; margin-bottom: 2px; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 0 14px; align-items: start; }

/* buttons: <button>, role=button links; .secondary/.outline = quiet, .ghost = text only */
button, [role="button"], .btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 16px;
  font: 600 14px/1 var(--font); border-radius: var(--radius-sm); border: 1px solid var(--accent);
  background: var(--accent); color: var(--on-accent); cursor: pointer; white-space: nowrap; text-decoration: none;
  transition: background .15s, border-color .15s; }
button:hover:not(:disabled), [role="button"]:hover, .btn:hover { background: var(--accent-hover);
  border-color: var(--accent-hover); text-decoration: none; }
button.secondary, button.outline, [role="button"].secondary, [role="button"].outline, .btn.secondary {
  background: var(--surface); color: var(--text); border-color: var(--border); }
button.secondary:hover:not(:disabled), button.outline:hover:not(:disabled), [role="button"].secondary:hover,
[role="button"].outline:hover, .btn.secondary:hover { background: var(--surface-2); border-color: var(--border); }
.btn.ghost, button.ghost { background: none; border-color: transparent; color: var(--muted); }
.btn.ghost:hover, button.ghost:hover:not(:disabled) { background: var(--surface-2); border-color: transparent; color: var(--text); }
.btn.sm, button.sm { height: 32px; padding: 0 12px; font-size: 13px; }
.btn.lg, button.lg { height: 48px; padding: 0 22px; font-size: 15px; }
form { margin: 0; }
.actions { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.actions form { display: inline; }

/* cards: <article> is a card everywhere */
article, .card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 20px 22px; margin: 0 0 20px; }
article > header, .card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-bottom: 12px; }
article > :last-child, .card > :last-child { margin-bottom: 0; }
[role="alert"] { background: var(--accent-soft); border-color: transparent; box-shadow: none; padding: 14px 18px; }
article.rejected, [role="alert"].rejected { background: var(--warn-soft); border-color: transparent; box-shadow: none; }
article.danger { background: var(--bad-soft); border-color: transparent; box-shadow: none; }

/* disclosure: every spoiler is the same card — surface, border, a clear chevron; menus (details.menu) are not spoilers */
details:not(.menu, .ms, .steps-more) { margin: 0 0 12px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 0 16px; }
details:not(.menu, .ms, .steps-more) > summary { cursor: pointer; list-style: none; display: flex; align-items: center; gap: 10px; padding: 12px 0;
  min-height: 46px; font-weight: 550; }
/* a summary with a chip or stats may wrap; a plain one keeps its text next to the arrow */
details:not(.menu, .ms, .steps-more) > summary:has(.chip, .g-stat) { flex-wrap: wrap; }
details:not(.menu, .ms, .steps-more) > summary > .sum-t { flex: 1 1 180px; min-width: 0; }
details:not(.menu, .ms, .steps-more) > summary::-webkit-details-marker { display: none; }
details:not(.menu, .ms, .steps-more) > summary::before { content: ""; width: 8px; height: 8px; border-right: 2px solid var(--accent);
  border-bottom: 2px solid var(--accent); transform: rotate(-45deg); transition: transform .15s; flex: none; margin: 0 4px 0 2px; }
details:not(.menu, .ms, .steps-more)[open] > summary::before { transform: rotate(45deg); }
details:not(.menu, .ms, .steps-more) > summary:hover { color: var(--accent); }
details:not(.menu, .ms, .steps-more) > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
details:not(.menu, .ms, .steps-more)[open] { padding-bottom: 14px; }
details:not(.menu, .ms, .steps-more)[open] > summary { border-bottom: 1px solid var(--border); margin-bottom: 12px; }
details:not(.menu, .ms, .steps-more) > summary small { display: block; font-weight: 400; font-size: 12.5px; }
details:not(.menu) details:not(.menu) { background: var(--surface-2); }
details.spoiler > fieldset, details.spoiler .blocks fieldset { background: none; border: 0; padding: 0; margin: 0 0 18px; }
/* a top-level spoiler matches the cards around it; blocks inside a spoiler are flat sections, not cards in a card */
.blocks > details:not(.menu), main > details:not(.menu) { border-radius: var(--radius); padding: 0 20px; }
.blocks > details:not(.menu)[open] { padding-bottom: 18px; }
.blocks details:not(.menu) > fieldset { background: none; border: 0; border-radius: 0; padding: 0; margin: 0 0 18px; }
.blocks details:not(.menu) > fieldset + fieldset { padding-top: 16px; border-top: 1px dashed var(--border); }
.blocks details:not(.menu) > fieldset:last-child { margin-bottom: 0; }

/* tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { font-size: 12px; font-weight: 600; color: var(--muted); text-align: left; padding: 10px 16px;
  border-bottom: 1px solid var(--border); white-space: nowrap; }
td { padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
th.r, td.r { text-align: right; }

/* loading: aria-busy anywhere gets a spinner */
[aria-busy="true"]::before { content: ""; display: inline-block; width: 14px; height: 14px; margin-right: 8px;
  vertical-align: -2px; border-radius: 50%; border: 2px solid var(--accent-soft); border-top-color: var(--accent);
  animation: spin .8s linear infinite; }
.spin { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--accent-soft);
  border-top-color: var(--accent); animation: spin .8s linear infinite; display: inline-block; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }
.shim { height: 10px; border-radius: 5px; background: linear-gradient(90deg, var(--surface-2) 25%, var(--border) 50%,
  var(--surface-2) 75%); background-size: 200% 100%; animation: shim 1.4s infinite linear; }
@keyframes shim { to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { *, *::before { animation: none !important; transition: none !important; } }

/* icons (inline SVG sprite, Lucide-style) */
svg.i { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round;
  stroke-linejoin: round; flex: none; }

/* ---------- layout: sidebar + top bar + content ---------- */
.app { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); min-height: 100vh; }
.app.bare { grid-template-columns: 1fr; }
.side { background: var(--surface); border-right: 1px solid var(--border); padding: 20px 14px; display: flex;
  flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.logo { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 17px; color: var(--text);
  padding: 2px 8px 18px; }
.logo:hover { text-decoration: none; }
.logo .mark { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; color: #fff;
  background: linear-gradient(135deg, var(--accent), #7c9dff); flex: none; }
.side .sec { font-size: 11px; letter-spacing: .08em; color: var(--faint); padding: 14px 10px 4px; font-weight: 600; }
.nav { display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: var(--radius-sm);
  color: var(--muted); font-weight: 500; }
.nav:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav.on { background: var(--accent-soft); color: var(--accent); }
.nav .cnt { margin-left: auto; font-size: 12px; background: var(--surface-2); color: var(--muted); border-radius: 99px;
  padding: 0 8px; }
.side .note { margin-top: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px;
  background: var(--surface-2); font-size: 13px; color: var(--muted); }
.side .note b { display: block; color: var(--text); margin-bottom: 2px; }
.who { display: flex; align-items: center; gap: 10px; padding: 12px 6px 0; }
.who .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 550; }
.ava { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-weight: 600; font-size: 13px;
  color: #fff; background: linear-gradient(135deg, #f59e0b, #ef4444); flex: none; text-transform: uppercase; }

.top { height: 64px; display: flex; align-items: center; gap: 12px; padding: 0 var(--pad); position: sticky; top: 0;
  z-index: 10; border-bottom: 1px solid var(--border); background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(8px); }
.top .logo { display: none; padding: 0; }
.search { display: flex; align-items: center; gap: 8px; flex: 0 1 380px; height: 38px; padding: 0 10px 0 12px; margin: 0;
  border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); color: var(--faint);
  font-weight: 400; }
.search input { border: 0 !important; box-shadow: none !important; padding: 0 !important; margin: 0 !important;
  background: none !important; height: 36px; min-width: 0; }
.search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
kbd { font: 500 11px var(--font); border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 5px;
  padding: 1px 5px; color: var(--muted); background: var(--surface-2); }
.top .sp { flex: 1; }
.ib { width: 38px; height: 38px; padding: 0; border-radius: var(--radius-sm); border: 1px solid transparent;
  background: none; color: var(--muted); }
.ib:hover:not(:disabled) { background: var(--surface-2); border-color: transparent; color: var(--text); }
main { padding: var(--pad); max-width: 1240px; width: 100%; }
main.narrow { max-width: 880px; }
.banner { margin: 16px var(--pad) 0; }

/* page head */
.crumbs { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; margin-bottom: 10px; }
.crumbs a { color: var(--muted); }
.head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 24px;
  flex-wrap: wrap; }
.head h1 { margin: 0; }
.head p { margin: 4px 0 0; }
.title-line { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

/* ---------- components ---------- */
/* status chip; .assumption/.ok kept for older markup */
.chip { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border-radius: 99px;
  font-size: 12.5px; font-weight: 600; white-space: nowrap; background: var(--idle-soft); color: var(--idle);
  vertical-align: middle; margin: 0; }
.chip.dot::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.chip.ok { background: var(--ok-soft); color: var(--ok); }
.chip.warn, .chip.assumption { background: var(--warn-soft); color: var(--warn); }
.chip.bad { background: var(--bad-soft); color: var(--bad); }
.chip.run { background: var(--accent-soft); color: var(--accent); }
.chip.run::before { animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { opacity: .25; } }

/* progress bar */
.bar { height: 8px; border-radius: 99px; background: var(--surface-2); overflow: hidden; margin-top: 12px; }
.bar > i { display: block; height: 100%; border-radius: inherit; background: var(--accent); }
.bar.warn > i { background: var(--warn); }
.bar.bad > i { background: var(--bad); }
.bar.sm { height: 6px; margin-top: 6px; }
.bar.lg { height: 12px; }

/* KPI tiles */
.kpis { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 16px; margin-bottom: 20px; }
.kpis.even { grid-template-columns: repeat(4, 1fr); }
.kpi { margin: 0; padding: 18px 20px; }
.kpi .l { color: var(--muted); font-size: 13px; display: flex; align-items: center; gap: 6px; }
.kpi .v { font-size: 28px; font-weight: 700; letter-spacing: -.02em; margin-top: 6px; line-height: 1.2; }
.kpi .v small { font-size: 15px; color: var(--muted); font-weight: 500; letter-spacing: 0; }
.kpi .d { font-size: 12.5px; margin-top: 4px; color: var(--muted); }

/* the one most urgent thing */
.hero { display: flex; gap: 24px; align-items: center; padding: 26px 28px;
  background: linear-gradient(135deg, var(--accent-soft), var(--surface) 70%); }
.hero.bad { background: linear-gradient(135deg, var(--bad-soft), var(--surface) 70%); }
.hero.warn { background: linear-gradient(135deg, var(--warn-soft), var(--surface) 70%); }
.hero h2 { font-size: 21px; margin: 10px 0 6px; }
.hero p { margin: 0; color: var(--muted); }
.hero > div { flex: 1; }

/* to-do list */
.todo { padding: 0; }
.todo > header { padding: 18px 20px 10px; margin: 0; }
.todo .it { display: flex; align-items: center; gap: 14px; padding: 14px 20px; border-top: 1px solid var(--border); }
.todo .t { flex: 1; min-width: 0; }
.todo .t b { display: block; font-weight: 600; }
.todo .t span { color: var(--muted); font-size: 13.5px; }
.ic { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; flex: none;
  background: var(--accent-soft); color: var(--accent); }
.ic.bad { background: var(--bad-soft); color: var(--bad); }
.ic.warn { background: var(--warn-soft); color: var(--warn); }

/* campaigns table */
.list { padding: 0; overflow: hidden; }
.toolbar { display: flex; align-items: center; gap: 8px; padding: 14px 20px; border-bottom: 1px solid var(--border);
  flex-wrap: wrap; }
.seg { display: inline-flex; background: var(--surface-2); border-radius: 99px; padding: 3px; flex-wrap: wrap; }
.seg a { padding: 5px 12px; border-radius: 99px; color: var(--muted); font-weight: 500; font-size: 13px; }
.seg a:hover { text-decoration: none; color: var(--text); }
.seg a.on { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(0, 0, 0, .08); }
.list td { height: 60px; padding-top: 8px; padding-bottom: 8px; }
.list tbody tr:hover { background: var(--surface-2); }
.camp { display: flex; align-items: center; gap: 12px; min-width: 0; color: var(--text); }
.camp:hover { text-decoration: none; }
.camp b { display: block; font-weight: 600; }
.camp small { color: var(--muted); }
.fav { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; font-weight: 700; font-size: 13px;
  color: #fff; flex: none; text-transform: uppercase; }
.mini { min-width: 150px; }
.mini .x { display: flex; justify-content: space-between; gap: 8px; font-size: 12.5px; color: var(--muted); }
.steps-mini { display: flex; gap: 3px; margin-top: 6px; }
.steps-mini i { height: 4px; width: 20px; border-radius: 2px; background: var(--border); }
.steps-mini i.f { background: var(--accent); }

/* first visit */
.empty { max-width: 640px; margin: 32px auto; text-align: center; }
.empty h1 { font-size: 34px; }
.empty .lead { margin: 10px auto 0; font-size: 16px; }
.empty .logo { justify-content: center; padding: 0 0 20px; }
.empty .logo .mark { width: 48px; height: 48px; border-radius: 14px; }
.site-form { display: flex; gap: 10px; margin: 28px auto 10px; max-width: 520px; text-align: left; }
.site-form input { height: 52px; font-size: 17px; margin: 0 !important; }
.site-form button { height: 52px; padding: 0 24px; }
.start-form { max-width: 560px; margin: 0 auto; text-align: left; }
.start-form .site-form { max-width: none; margin-bottom: 0; }
.start-btn { width: 100%; margin-top: 18px; height: 50px; }
.mode-switch { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 14px; }
.mode-switch label, .tiles label { display: flex; flex-direction: column; gap: 2px; margin: 0; padding: 10px 14px; cursor: pointer;
  border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); transition: border-color .15s, box-shadow .15s; }
.mode-switch input, .tiles input { position: absolute; opacity: 0; pointer-events: none; }
.mode-switch small, .tiles small { color: var(--muted); font-size: 12.5px; line-height: 1.35; }
.mode-switch label:has(input:checked), .tiles label:has(input:checked) { border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft); }
.mode-switch label:has(input:focus-visible), .tiles label:has(input:focus-visible) { outline: 2px solid var(--accent); }
.quick { margin-top: 18px; padding-top: 16px; border-top: 1px dashed var(--border); }
.quick-row { display: grid; grid-template-columns: 1.3fr 1fr; gap: 12px; }
.quick-row label { margin: 0; font-size: 13.5px; font-weight: 500; }
.quick-row input { margin: 4px 0 2px !important; }
.tiles-label { font-size: 13.5px; font-weight: 500; margin: 14px 0 6px; }
.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.why { display: flex; gap: 8px; margin: 2px 0 12px 30px; padding: 6px 10px; border-left: 2px solid var(--accent);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0; background: var(--surface-2); font-size: 13px; color: var(--muted);
  line-height: 1.45; }
.why.is-changed { border-left-color: var(--warn); }
.why [hidden] { display: none; }
.why-reset { all: unset; cursor: pointer; color: var(--accent); white-space: nowrap; }
.why-reset:hover { text-decoration: underline; }
fieldset > .combo + .why, fieldset > select + .why { margin-left: 0; margin-top: 8px; }
.why b { color: var(--text); font-weight: 600; }
.why > .i { width: 15px; height: 15px; flex: none; margin-top: 2px; color: var(--accent); }
.confirm { border: 0; border-radius: var(--radius); padding: 22px 24px; max-width: 460px; width: calc(100% - 32px);
  background: var(--surface); color: var(--text); box-shadow: 0 20px 60px rgba(0, 0, 0, .3); }
.confirm::backdrop { background: rgba(15, 23, 42, .45); }
.confirm h3 { margin: 0 0 8px; }
.confirm p { color: var(--muted); margin: 0 0 18px; line-height: 1.5; }
.toast { display: flex; gap: 12px; align-items: flex-start; padding: 12px 16px; margin-bottom: 16px; border-radius: var(--radius-sm);
  background: var(--surface); border: 1px solid var(--border); font-size: 14px; }
.toast > .i { width: 18px; height: 18px; flex: none; margin-top: 2px; }
.toast > div { flex: 1; display: grid; gap: 2px; }
.toast.run { border-color: color-mix(in srgb, var(--accent) 40%, var(--border)); background: var(--accent-soft); }
.toast.ok { border-color: color-mix(in srgb, var(--ok) 40%, var(--border)); background: var(--ok-soft); }
.toast.ok > .i { color: var(--ok); }
.toast.bad { border-color: color-mix(in srgb, var(--bad) 40%, var(--border)); background: var(--bad-soft); }
.toast.bad > .i { color: var(--bad); }
.toast .ib { margin: -4px -6px 0 0; font-size: 18px; }
.sum-card header { display: flex; justify-content: space-between; align-items: baseline; }
.sum-card header h3 { margin: 0; }
.sum-card .more { display: inline-flex; align-items: center; gap: 2px; font-size: 13.5px; }
.sum-card .more .i { width: 14px; height: 14px; }
.mini-ad { padding: 10px 0; border-bottom: 1px dashed var(--border); }
.mini-ad .serp-title { font-size: 15px; }
.mini-ad p { margin: 2px 0 6px; font-size: 13.5px; }
.ad-previews { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 12px 0; }
.ad-previews .k { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.net-card { position: relative; display: grid; grid-template-columns: 110px minmax(0, 1fr); border: 1px solid var(--border); border-radius: var(--radius-sm);
  overflow: hidden; background: var(--surface); max-width: 420px; }
.net-img img { width: 100%; height: 100%; min-height: 110px; object-fit: cover; display: block; }
.net-body { padding: 10px 12px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 4px; align-content: start; }
.net-body b { font-size: 14.5px; line-height: 1.3; }
.net-body p { margin: 0; font-size: 13px; color: var(--muted); line-height: 1.35; }
.net-foot { display: flex; flex-wrap: wrap; gap: 6px; justify-content: space-between; align-items: center; font-size: 12px; color: var(--muted); margin-top: 4px; }
.net-btn { background: var(--accent); color: var(--on-accent); border-radius: 6px; padding: 3px 10px; font-weight: 500; }
.net-label { position: absolute; top: 6px; left: 6px; font-size: 10.5px; background: rgba(0, 0, 0, .55); color: #fff; padding: 1px 6px; border-radius: 4px; }
.journal-filter { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.journal-filter .search { flex: 1; min-width: 220px; }
.narrow-col { max-width: 760px; }
/* negative words: chips by reason */
.neg-add { display: flex; gap: 8px; }
.neg-editor [data-neg-text], .neg-group[hidden] { display: none; }
.neg-add input { margin: 0 !important; }
.neg-group { margin-bottom: 12px; --nc: #6b7280; }
.neg-head { display: flex; align-items: center; gap: 8px; font-size: 13.5px; margin-bottom: 6px; }
.neg-dot { width: 10px; height: 10px; border-radius: 3px; background: var(--nc); flex: none; }
.neg-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.neg-chip { display: inline-flex; align-items: center; gap: 2px; padding: 3px 4px 3px 10px; border-radius: 8px; font-size: 13.5px;
  background: color-mix(in srgb, var(--nc) 12%, var(--surface)); border: 1px solid color-mix(in srgb, var(--nc) 35%, var(--border));
  color: var(--text); cursor: default; }
.neg-chip.is-new { animation: neg-in .25s ease; }
@keyframes neg-in { from { transform: scale(.85); opacity: 0; } }
.neg-chip button { all: unset; cursor: pointer; width: 18px; height: 18px; display: grid; place-items: center; border-radius: 5px;
  color: var(--muted); font-size: 15px; line-height: 1; }
.neg-chip button:hover, .neg-chip button:focus-visible { background: color-mix(in srgb, var(--nc) 25%, transparent); color: var(--text); }
.c-info { --nc: #2563eb; } .c-diy { --nc: #0891b2; } .c-job { --nc: #7c3aed; } .c-goods { --nc: #c2410c; }
.c-meaning { --nc: #64748b; } .c-absent { --nc: #d97706; } .c-geo { --nc: #059669; } .c-brand { --nc: #db2777; }
.c-adult { --nc: #dc2626; } .c-free { --nc: #65a30d; } .c-other { --nc: #6b7280; } .c-user { --nc: var(--accent); }
.unsaved { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 60; display: flex; align-items: center;
  gap: 12px; padding: 10px 12px 10px 16px; border-radius: 12px; background: var(--text); color: var(--bg); font-size: 14px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, .25); max-width: calc(100% - 32px); }
.unsaved[hidden] { display: none; }
body.has-unsaved main { padding-bottom: 96px; }
.unsaved .i { width: 16px; height: 16px; flex: none; }
.unsaved .ghost { color: var(--bg); border-color: transparent; }
.unsaved button:not(.ghost) { background: var(--accent); color: var(--on-accent); }
form.is-dirty .blocks-hint, form.is-dirty [type=submit] { box-shadow: 0 0 0 3px var(--accent-soft); }
@media (max-width: 600px) { .unsaved { left: 16px; right: 16px; transform: none; flex-wrap: wrap; } }
.combo { position: relative; }
.combo-input { margin: 0 !important; }
.combo-list { position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 40; max-height: 300px; overflow: auto;
  background: var(--surface); border-radius: var(--radius-sm); box-shadow: 0 10px 30px rgba(0, 0, 0, .14); }
.combo-list:not(:empty) { border: 1px solid var(--border); padding: 4px; }
.combo-list:empty { display: none; } /* the filters' dropdown rule below adds a border even to an empty list */
.combo-opt { display: block; width: 100%; text-align: left; background: none; color: var(--text); border: 0; height: auto;
  padding: 8px 10px; border-radius: 8px; font-weight: 400; font-size: 14px; }
.combo-opt:hover, .combo-opt:focus { background: var(--accent-soft); color: var(--text); }
.combo-empty { padding: 8px 10px; color: var(--muted); font-size: 13.5px; }
.note-warn { display: flex; gap: 10px; margin-top: 14px; padding: 12px 14px; border-radius: var(--radius-sm); background: var(--warn-soft);
  font-size: 13.5px; }
.note-warn > .i { color: var(--warn); flex: none; width: 18px; height: 18px; margin-top: 1px; }
.quick-row.three { grid-template-columns: 1.2fr 1fr 1fr; }
.quick-box .why { margin-left: 0; }
.quick-box header { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 10px; }
.how { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-top: 40px; text-align: left; }
.how .card { padding: 18px; margin: 0; }
.how .n { width: 28px; height: 28px; border-radius: 50%; background: var(--accent-soft); color: var(--accent);
  display: grid; place-items: center; font-weight: 700; margin-bottom: 10px; }
.how b { display: block; }
.how span { color: var(--muted); font-size: 13px; }

/* wizard stepper */
.stepper { display: flex; align-items: center; list-style: none; padding: 0; margin: 0 0 28px; }
.stepper li { display: flex; align-items: center; gap: 10px; font-weight: 500; color: var(--muted); white-space: nowrap;
  list-style: none; }
.stepper li:not(:last-child)::after { content: ""; flex: 1; height: 2px; background: var(--border); margin: 0 14px;
  min-width: 24px; }
.stepper li:not(:last-child) { flex: 1; }
.stepper li.done:not(:last-child)::after { background: var(--accent); }
.stepper .n { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; flex: none;
  border: 1.5px solid var(--border); background: var(--surface); font-size: 13px; font-weight: 600; }
.stepper li.done .n { background: var(--accent); border-color: var(--accent); color: #fff; }
.stepper li.current { color: var(--text); }
.stepper li.current .n { border-color: var(--accent); color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.stepper a { color: inherit; }
.stepper-m { display: none; margin-bottom: 24px; font-size: 13px; color: var(--muted); }

/* wizard layout: form + sticky summary */
.wz { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 24px; align-items: start; }
.wz .aside { position: sticky; top: 88px; }
.sum-row { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-top: 1px solid var(--border); }
.sum-row:first-of-type { border-top: 0; }
.formbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap;
  padding-top: 20px; border-top: 1px solid var(--border); margin-top: 8px; }

/* step progress list (waiting screens) */
.progress-list { list-style: none; padding: 0; margin: 0; }
.progress-list li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 0;
  border-bottom: 1px solid var(--border); }
.progress-list li:last-child { border-bottom: 0; }

/* editable rows: one fact, service or text per line; the bin shows on hover (always on touch screens) */
.row-item { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: .6rem; align-items: center; margin-bottom: .4rem; }
.row-item.service { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) auto auto; }
.row-item.plain { grid-template-columns: minmax(0, 1fr) auto; align-items: start; }
.row-item .chip { justify-self: start; }
.row-item input, .row-item textarea { margin: 0 !important; }
.row-item.is-assumption input[type="text"] { border-color: var(--warn); }
.row-del { width: 34px; height: 34px; padding: 0; background: none; border: 1px solid transparent; color: var(--muted); border-radius: 10px; }
.row-del:hover:not(:disabled), .row-del:focus-visible { background: var(--bad-soft); border-color: var(--bad-soft); color: var(--bad); }
.row-del .i { width: 16px; height: 16px; }
@media (hover: hover) and (min-width: 901px) {
  .row-item .row-del { opacity: 0; transition: opacity .12s; }
  .row-item:hover .row-del, .row-item:focus-within .row-del { opacity: 1; }
}
.add-row { height: 34px; padding: 0 12px; margin-top: 4px; background: none; color: var(--accent); border: 1px dashed var(--accent);
  font-weight: 500; font-size: 13.5px; }
.add-row:hover:not(:disabled) { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }
.add-row .i { width: 15px; height: 15px; }
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; padding: 0; border: 0; }
.tools-row { margin-bottom: 14px; }
.tools-row > .muted { flex: 1 1 260px; font-size: 13.5px; }

/* campaign screen */
.tabs { display: flex; gap: 24px; border-bottom: 1px solid var(--border); margin: 4px 0 24px; overflow-x: auto; }
.tabs a { padding: 10px 0 12px; color: var(--muted); font-weight: 500; border-bottom: 2px solid transparent;
  margin-bottom: -1px; white-space: nowrap; }
.tabs a:hover { color: var(--text); text-decoration: none; }
.tabs a.on { color: var(--text); border-color: var(--accent); }
.tabs .cnt { font-size: 11.5px; background: var(--bad-soft); color: var(--bad); border-radius: 99px; padding: 1px 7px;
  margin-left: 4px; }
.cols { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.big { font-size: 32px; font-weight: 700; letter-spacing: -.02em; }
.guard { display: flex; gap: 10px; align-items: flex-start; margin-top: 16px; padding: 12px 14px;
  border-radius: var(--radius-sm); background: var(--ok-soft); font-size: 13px; }
.guard svg { color: var(--ok); margin-top: 1px; }
.facts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-top: 18px; }
.facts div { padding: 12px; border-radius: var(--radius-sm); background: var(--surface-2); }
.facts b { display: block; font-size: 18px; }
.facts span { font-size: 12px; color: var(--muted); }
.feed { list-style: none; padding: 0; margin: 0; }
.feed li { display: flex; gap: 12px; padding: 10px 0; border-top: 1px dashed var(--border); }
.feed li:first-child { border-top: 0; }
.feed small { display: block; color: var(--faint); }
.feed .ic { width: 28px; height: 28px; border-radius: 8px; background: var(--surface-2); color: var(--muted); }
.inline-form { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-start; }
.inline-form input { width: auto; flex: 1 1 140px; margin: 0; }

/* daily chart (CSS bars) */
.chart { display: flex; align-items: flex-end; gap: 4px; height: 140px; padding-top: 8px; }
.chart > div { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%;
  min-width: 6px; }
.chart i { display: block; width: 100%; max-width: 28px; border-radius: 4px 4px 0 0; background: var(--accent);
  opacity: .85; min-height: 2px; }
.chart i.req { background: var(--ok); }
.chart-axis { display: flex; justify-content: space-between; font-size: 11px; color: var(--faint); margin-top: 6px; }

/* preview: ad as it looks in Yandex search */
.summary { margin-bottom: 1rem; }
.ad-group { margin-bottom: 2rem; }
.serp { padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface);
  margin-bottom: .75rem; font-family: Arial, sans-serif; }
.serp-label { font-size: 12px; color: var(--muted); }
.serp-title { display: block; font-size: 17px; color: var(--serp-link); margin: 2px 0; }
.serp-url { font-size: 13px; color: var(--serp-url); }
.serp-text { margin: 4px 0; font-size: 14px; }
.serp-links { display: flex; gap: 14px; flex-wrap: wrap; font-size: 13.5px; }
.serp-links a { color: var(--serp-link); }
.serp-callouts { font-size: 13px; color: var(--muted); margin-top: 4px; }
.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: .75rem; }
.photo { position: relative; margin: 0; }
.photo input { position: absolute; top: .5rem; left: .5rem; z-index: 1; margin: 0; }
.photo img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: var(--radius-sm); display: block; }

/* login */
.auth { max-width: 520px; margin: 10vh auto; padding: 0 16px; }
.auth article { padding: 32px; }

/* ---------- small screens ---------- */
@media (max-width: 1100px) {
  .wz, .cols { grid-template-columns: minmax(0, 1fr); }
  .wz .aside { position: static; }
}
@media (max-width: 900px) {
  .ad-previews { grid-template-columns: minmax(0, 1fr); }
  :root { --pad: 16px; }
  .app { grid-template-columns: minmax(0, 1fr); }
  .side { display: none; }
  .side.open { display: flex; position: fixed; inset: 0 auto 0 0; width: 280px; z-index: 30; box-shadow: 0 0 0 100vmax rgba(15, 23, 42, .45); }
  .top .logo { display: flex; }
  .search { flex: 0 0 38px; padding: 0; justify-content: center; }
  .search input, .search kbd { display: none; }
  .kpis, .kpis.even { grid-template-columns: 1fr 1fr; }
  .kpis .kpi:first-child:not(.even .kpi) { grid-column: 1 / -1; }
  .hero { flex-direction: column; align-items: flex-start; }
  .how { grid-template-columns: 1fr; }
  .site-form { flex-direction: column; }
  .mode-switch, .quick-row, .quick-row.three, .tiles, .step-intro { grid-template-columns: minmax(0, 1fr); }
  .facts { grid-template-columns: 1fr 1fr; }
  .hide-m { display: none; }
  .pill .bal-m { display: inline; }
  .stepper { display: none; }
  .stepper-m { display: block; }
  h1 { font-size: 24px; }
  .row-item, .row-item.service { grid-template-columns: minmax(0, 1fr) auto; row-gap: .3rem; }
  .row-item.service { margin-bottom: 1rem; }
  .row-item .chip:not(.assumption), .row-item > span:empty { display: none; }
  .row-item.service input[name$="-price"], .row-item .chip.assumption { grid-column: 1; }
  .todo .it { flex-wrap: wrap; }
  .todo .it .btn, .todo .it > [role="button"] { margin-left: 50px; }
}
@media (min-width: 901px) { .menu-btn { display: none; } }

/* ---------- dropdown menus (top bar) ---------- */
.menu { position: relative; margin: 0; }
.menu > summary { list-style: none; cursor: pointer; padding: 0; }
.menu > summary::before { display: none; }
.menu > summary::-webkit-details-marker { display: none; }
.menu[open] > summary { margin: 0; }
.pill { display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 12px !important; border-radius: 99px;
  border: 1px solid var(--border); background: var(--surface); font-weight: 500; white-space: nowrap; }
.bal-m { display: none; font-size: 13px; font-weight: 600; white-space: nowrap; }
.pill:hover { background: var(--surface-2); }
summary.ava { display: grid; }
.menu-list { position: absolute; right: 0; top: calc(100% + 8px); min-width: 240px; z-index: 40; padding: 6px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
  box-shadow: 0 12px 32px rgba(16, 24, 40, .14); }
.menu-list a, .menu-btn-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; height: auto;
  border-radius: 8px; color: var(--text); font: 500 14px var(--font); background: none; border: 0; justify-content: flex-start; }
.menu-list a:hover, .menu-btn-item:hover:not(:disabled) { background: var(--surface-2); text-decoration: none; }
.menu-list a.on { color: var(--accent); background: var(--accent-soft); }
.menu-list svg { color: var(--muted); }
.menu-list hr { margin: 6px 0; }
.menu-label { font-size: 12px; color: var(--faint); padding: 6px 10px 4px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; }

/* ---------- step progress ---------- */
.steps-progress li { display: grid; grid-template-columns: 28px 1fr auto; gap: 4px 12px; align-items: center; }
.steps-progress .st-ic { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center;
  background: var(--surface-2); color: var(--faint); font-size: 12px; font-weight: 600; grid-row: span 2; }
.steps-progress .done .st-ic { background: var(--ok-soft); color: var(--ok); }
.steps-progress .running .st-ic { background: var(--accent-soft); color: var(--accent); }
.steps-progress .failed .st-ic { background: var(--bad-soft); color: var(--bad); }
.steps-progress .bar { grid-column: 2 / 4; margin: 0; height: 6px; }
.steps-progress .done .bar > i { background: var(--ok); }
.steps-progress .running .bar > i { background: linear-gradient(90deg, var(--accent) 0%, #7c9dff 50%, var(--accent) 100%);
  background-size: 200% 100%; animation: shim 1.6s linear infinite; transition: width .8s ease; }
.steps-progress .pct { font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.overall { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.overall .bar { flex: 1; margin: 0; height: 10px; }
.overall .bar > i { transition: width .8s ease; }
/* waiting screen: future ads fill in as the pipeline learns more */
.ad-cards { margin-top: 24px; display: grid; gap: 12px; }
.ad-cards-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.ad-cards-head h3 { margin: 0; font-size: 15px; }
.ad-card { padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface);
  transition: border-color .6s ease; }
.ad-card[data-state="ready"] { border-color: color-mix(in srgb, var(--ok) 35%, var(--border)); }
.ad-card .grp { display: flex; gap: 6px; align-items: center; font-size: 12.5px; color: var(--muted); margin-bottom: 4px; }
.ad-card .grp .serp-label { margin-left: auto; }
.ad-card .sk { display: block; height: 11px; border-radius: 6px; margin: 9px 0; background: var(--surface-2);
  animation: sk 1.6s ease-in-out infinite; }
.ad-card .sk.t { height: 16px; width: 72%; background: color-mix(in srgb, var(--serp-link) 14%, var(--surface-2)); }
.ad-card .sk.u { width: 34%; height: 9px; }
.ad-card .sk.x1 { width: 96%; }
.ad-card .sk.x2 { width: 58%; }
.ad-card .body { transition: opacity .7s ease, transform .7s ease; }
.ad-card[data-state="named"] .body, .ad-card[data-state="blank"] .body { opacity: 0; transform: translateY(6px); }
@keyframes sk { 50% { opacity: .5; } }
.overall b { font-size: 20px; font-variant-numeric: tabular-nums; min-width: 52px; text-align: right; }

/* stepper: whole step is a link */
.stepper a.step-link { display: flex; align-items: center; gap: 10px; color: inherit; border-radius: 99px; padding: 2px 8px 2px 2px;
  margin: -2px -8px -2px -2px; }
.stepper a.step-link:hover { background: var(--surface-2); text-decoration: none; }
.stepper a.step-link:hover .n { border-color: var(--accent); }

.points { margin-top: 1rem; }
.points label { display: block; }
p.warn { color: var(--warn); background: var(--warn-soft); padding: .6rem .8rem; border-radius: 8px; }
/* mode switch: a segmented control, not a second primary button */
.mode-toggle { display: inline-flex; gap: 2px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 99px;
  padding: 3px; margin: 0 0 18px; }
.mode-toggle button { height: 30px; padding: 0 14px; border: 0; border-radius: 99px; background: none; color: var(--muted);
  font-weight: 500; font-size: 13.5px; }
.mode-toggle button:hover:not(:disabled) { background: var(--surface); border-color: transparent; color: var(--text); }
.mode-toggle button.on, .mode-toggle button.on:hover:not(:disabled) { background: var(--surface); color: var(--accent); font-weight: 600;
  box-shadow: 0 1px 2px rgba(16, 24, 40, .12); }
.glide { transition: width 1.9s linear; }
.stepper li.can-go .step-link { text-decoration: underline dotted 1px; text-underline-offset: 4px; color: inherit; border-radius: 8px; padding: 4px 6px; margin: -4px -6px; }
.stepper li.can-go .step-link:hover { background: var(--surface-2); text-decoration: none; }
.stepper li:not(.can-go):not(.current) { cursor: not-allowed; }
img.mark { display: inline-block; border-radius: 9px; }
/* block header: title left, its tools right; tools are quiet outlined buttons, never a second primary */
.block-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.block-head h3, .block-head legend { margin: 0; }
button.tool { display: inline-flex; align-items: center; gap: 6px; width: auto; margin: 0; padding: 6px 12px; font-size: .875rem;
  font-weight: 500; background: transparent; color: var(--accent); border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--border));
  border-radius: 99px; }
button.tool:hover:not(:disabled) { background: var(--accent-soft); }
button.tool:disabled { color: var(--muted); border-color: var(--border); cursor: not-allowed; }
button.tool .i { width: 15px; height: 15px; }
button.tool .count { font-size: .75rem; min-width: 1.4em; padding: 0 6px; border-radius: 99px; background: var(--surface-2); color: var(--muted); }
/* a block being rewritten: greyed out with a spinner, survives a page reload (the state is on the server) */
.busy-host { position: relative; }
.busy-host.is-busy > *:not(.busy-veil):not(.block-head) { opacity: .35; pointer-events: none; }
.busy-veil { position: absolute; inset: 48px 0 0; display: flex; align-items: center; justify-content: center; gap: 10px;
  font-weight: 500; z-index: 2; }
.icon-btn { display: inline-grid; place-items: center; width: 34px; height: 34px; padding: 0; margin: 0 0 0 6px;
  background: transparent; border: 1px solid transparent; border-radius: 10px; color: var(--muted); }
.icon-btn:hover { background: var(--surface-2); }
.icon-btn.danger:hover { color: var(--bad); border-color: var(--bad-soft); background: var(--bad-soft); }
.icon-btn .i { width: 17px; height: 17px; }
form.inline { display: inline; margin: 0; }
.nowrap { white-space: nowrap; }
.more-box, .settings-panel { margin: 16px 0; }
dl.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 12px 0; }
dl.kv dt { color: var(--muted); font-weight: 500; }
dl.kv dd { margin: 0; }
@media (max-width: 600px) { dl.kv { grid-template-columns: 1fr; } dl.kv dd { margin-bottom: 6px; } }
.photo-lib { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px; }
.photo-card { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px; background: var(--surface); display: flex; flex-direction: column; gap: 6px; }
.photo-card img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 8px; background: var(--surface-2); }
.photo-card.off img { opacity: .35; filter: grayscale(1); }
.photo-card label, .photo-card label:has(> input) { margin: 0; font-size: .9rem; }
.chips-check { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.chips-check > small { flex-basis: 100%; font-size: 12px; }
.chips-check label { display: inline-flex; align-items: center; gap: 4px; font-size: .78rem; padding: 2px 8px; border-radius: 99px;
  background: var(--surface-2); margin: 0; }
.chips-check input { width: 14px; height: 14px; margin: 0; }
.chips-check label:has(> input) { margin: 0; font-weight: 400; font-size: .78rem; }
label.tool.upload { cursor: pointer; display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; font-size: .875rem;
  color: var(--accent); border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--border)); border-radius: 99px; margin: 0; }
label.tool.upload:hover { background: var(--accent-soft); }
label.tool.upload:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
label.tool.upload > span:empty { display: none; }
label.tool.upload .i { width: 15px; height: 15px; }

/* wizard bottom bar: always in view; the main button is the only filled one */
.wizbar { position: sticky; bottom: 0; z-index: 20; margin: 28px calc(-1 * var(--pad)) calc(-1 * var(--pad)); padding: 12px var(--pad); }
/* the bar's background spans the whole content column, also to the right of a narrow page */
.wizbar::before { content: ""; position: absolute; inset: 0 -100vw 0 0; z-index: -1; pointer-events: none;
  background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: blur(8px); border-top: 1px solid var(--border);
  box-shadow: 0 -6px 20px rgba(16, 24, 40, .06); }
.app > div { min-width: 0; overflow-x: clip; }
.wizbar-in { display: flex; align-items: center; gap: 10px; max-width: 100%; }
.wizbar-gap { flex: 1; }
.wizbar .i { width: 16px; height: 16px; }
body:has(.wizbar) .unsaved { bottom: 88px; }
@media (max-width: 600px) {
  .wizbar-in { flex-wrap: wrap; }
  .wizbar .next { order: -1; flex: 1 1 100%; height: 44px; }
  .wizbar-gap { display: none; }
  .wizbar .back { padding: 0 14px; }
  .wizbar-in > button.secondary { flex: 1; }
  body:has(.wizbar) .unsaved { bottom: 130px; }
}
/* «data changed» notice */
.stale-note { display: flex; align-items: center; gap: 12px; background: var(--warn-soft); border-color: transparent; box-shadow: none; padding: 14px 18px; }
.stale-note > .i { color: var(--warn); flex: none; width: 20px; height: 20px; }
.stale-note > div { flex: 1; min-width: 0; }
.stale-note form { flex: none; }
@media (max-width: 600px) { .stale-note { flex-wrap: wrap; } .stale-note form { width: 100%; } .stale-note button { width: 100%; } }
/* history: a panel sliding in from the right */
dialog.drawer { margin: 0 0 0 auto; height: 100vh; max-height: 100vh; width: min(420px, 100vw); padding: 20px; border: 0; border-left: 1px solid var(--border);
  background: var(--surface); color: var(--text); overflow-y: auto; box-shadow: -12px 0 32px rgba(0, 0, 0, .2); }
dialog.drawer[open] { animation: drawer-in .18s ease-out; }
dialog.drawer::backdrop { background: rgba(15, 23, 42, .4); }
@keyframes drawer-in { from { transform: translateX(40px); opacity: 0; } }
.drawer-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.drawer-head h3 { margin: 0; }
.hist-item { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 14px; margin-bottom: 10px; display: grid; gap: 6px; }
.hist-item.current { border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); background: var(--accent-soft); }
.hist-meta { display: flex; gap: 8px; align-items: center; font-size: 12.5px; color: var(--muted); }
.hist-item ul { margin: 0; padding-left: 18px; font-size: 13px; color: var(--muted); }
/* sidebar: the Direct account with its balance, always visible */
.side-foot { margin-top: auto; display: grid; gap: 10px; }
.side-foot .note { margin-top: 0; }
.side-account { margin: 0; background: none; border: 0; padding: 0; }
.side-account > summary { display: grid; gap: 2px; padding: 10px 12px !important; min-height: 0; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); font-weight: 500; }
.side-account > summary:hover { background: var(--surface-2); color: inherit; }
.side-account .k { font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--faint); font-weight: 600; }
.acc-line { display: flex; align-items: center; gap: 8px; min-width: 0; }
.acc-line > .i:first-child { color: var(--accent); flex: none; }
.acc-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acc-balance { font-weight: 650; white-space: nowrap; }
.acc-chev { width: 14px; height: 14px; transform: rotate(-90deg); color: var(--muted); flex: none; }
.menu.up .menu-list { top: auto; bottom: calc(100% + 8px); left: 0; right: auto; width: 100%; min-width: 220px; }
/* campaigns table: fits 1280 px without a horizontal scroll */
.list th, .list td { padding-left: 12px; padding-right: 12px; }
.list th:first-child, .list td:first-child { padding-left: 20px; }
.list th:last-child, .list td:last-child { padding-right: 16px; }
.list .camp b { max-width: 220px; }
.note-cell { display: block; max-width: 150px; font-size: 13px; line-height: 1.4; }
.list th { white-space: normal; line-height: 1.3; }
.list .mini { min-width: 120px; }
@media (max-width: 600px) {
  /* to-do: text takes the full row, the button goes under it */
  .todo .t { flex: 1 1 calc(100% - 50px); }
  /* campaigns table becomes a list of cards: name, then status and the action in one line */
  .list thead { display: none; }
  .list table, .list tbody { display: block; }
  .list tr { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; padding: 14px 16px; border-bottom: 1px solid var(--border); }
  .list tbody tr:last-child { border-bottom: 0; }
  .list td { display: block; height: auto; padding: 0 !important; border: 0; }
  .list td.hide-m { display: none; }
  .list td:first-child { flex: 1 1 100%; }
  .list td:last-child { margin-left: auto; }
  .list td .chip { white-space: normal; height: auto; min-height: 26px; padding: 3px 10px; }
}
/* a service group line: name, chip, then its money and clicks in regular weight */
.g-stat { font-weight: 400; font-size: 13.5px; }
.g-stat::before { content: "· "; }
@media (max-width: 600px) { .g-stat { flex-basis: 100%; padding-left: 52px; margin-top: -4px; } .g-stat::before { content: none; } }
@media (max-width: 600px) {
  article, .card { padding: 16px; }
  .blocks fieldset { padding: 16px; }
}
@media (max-width: 600px) {
  /* long chips («Указано: ИП …») wrap instead of running off the screen */
  .chip { max-width: 100%; white-space: normal; height: auto; min-height: 26px; padding: 3px 10px; line-height: 1.35; }
}

/* «Сохранить» in the bottom bar: green, so it is not lost next to the main action */
button.save { background: var(--ok); border-color: var(--ok); color: #fff; }
button.save:hover { filter: brightness(1.08); }
:root[data-theme="dark"] button.save { color: #052e16; }

/* the spend page: filters, pager */
.filters { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: end; margin: 0; }
.filters label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); margin: 0; min-width: 150px; }
.filters label.grow { flex: 1 1 220px; }
.filters select, .filters input { margin: 0; }
.filters .actions { display: flex; gap: 8px; }
.pager { display: flex; flex-wrap: wrap; gap: 8px 20px; justify-content: space-between; align-items: center; margin-top: 12px; font-size: 14px; }
.pager a, .pager b { padding: 2px 6px; }

/* one progress for the whole stage: the current step in words, every step on demand */
.now-step { display: flex; align-items: center; gap: 8px; margin: 10px 0 4px; font-weight: 500; }
.steps-more > summary { cursor: pointer; color: var(--muted); font-size: 14px; margin: 4px 0; }
.steps-more[open] > summary { margin-bottom: 8px; }

/* ad cards on the preview: a head with what the ad is for, then the previews */
.ad-box { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 0 20px 16px; margin-bottom: 20px; }
.ad-head { display: flex; gap: 16px; align-items: center; justify-content: space-between; margin: 0 -20px 16px;
  padding: 14px 20px; background: var(--surface-2); border-bottom: 1px solid var(--border); border-radius: var(--radius) var(--radius) 0 0; }
.ad-name { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 2px; }
.ad-name h3 { margin: 0; font-size: 18px; line-height: 1.3; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.ad-head > button { flex: none; }

/* photos: own block, a drawing panel, compact cards */
.photos-block { margin-top: 24px; }
.draw-panel { border: 1px dashed var(--border); border-radius: var(--radius-sm); padding: 12px 14px; margin: 12px 0 16px; background: var(--surface-2); }
.draw-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.draw-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; }
.draw-row label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; margin: 0; min-width: 200px; }
.draw-row label.grow { flex: 1 1 260px; }
.draw-row select, .draw-row input, .draw-row button { margin: 0; }
.chip.wrap { white-space: normal; display: inline-block; line-height: 1.4; }
.photo-card .photo-src { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; min-height: 22px; }
.photo-card .photo-src .chip { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.photo-card .photo-src a { color: inherit; text-decoration: underline; text-decoration-color: var(--border); }
.ms { position: relative; margin-top: 4px; }
.ms > summary { list-style: none; cursor: pointer; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 6px 10px;
  font-size: 14px; display: flex; gap: 6px; align-items: baseline; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.ms > summary::-webkit-details-marker { display: none; }
.ms > summary::after { content: "▾"; margin-left: auto; color: var(--muted); }
.ms > summary span { overflow: hidden; text-overflow: ellipsis; }
.ms-list { position: absolute; z-index: 5; left: 0; right: 0; top: calc(100% + 4px); background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); box-shadow: 0 8px 24px rgba(0, 0, 0, .12); padding: 8px; display: flex; flex-direction: column; gap: 6px; max-height: 260px; overflow: auto; }
.ms-list label { display: flex; gap: 8px; align-items: flex-start; font-size: 14px; margin: 0; }
.ms-list label input { margin-top: 3px; flex: none; }
.draw-row label small { display: inline; }
.draw-row label { flex: 0 1 320px; }
.draw-row button { flex: none; height: 42px; }
.ms > summary { padding: 6px 10px; }
.ms-list { right: auto; width: max(100%, 300px); }
.ms-list label { overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; padding-left: 26px; position: relative; }
.ms-list label input { position: absolute; left: 0; top: 0; }
/* the current step «thinking»: a light sweeping over the words */
.thinking { background: linear-gradient(90deg, var(--text) 0%, var(--text) 40%, var(--muted) 50%, var(--text) 60%, var(--text) 100%);
  background-size: 250% 100%; -webkit-background-clip: text; background-clip: text; color: transparent; animation: think 2.4s linear infinite; }
@keyframes think { from { background-position: 100% 0; } to { background-position: -150% 0; } }
@media (prefers-reduced-motion: reduce) { .thinking { animation: none; color: var(--text); } }
.contacts-edit label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.contacts-edit textarea { font-size: 14px; margin: 0; }

.crumbs { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 14px; margin: 4px 0; color: var(--muted); }
.crumbs a { color: var(--accent); }
.spend-filters { padding: 14px 18px; }
.filters { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px 12px; align-items: end; }
.filters label, .filters .combo { min-width: 0; }
.filters .lbl { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.filters select, .filters input, .combo-btn { height: 40px; padding: 0 12px; font-size: 14px; width: 100%; }
.filters .actions { grid-column: -2 / -1; justify-content: flex-end; }
.filters .actions button, .filters .actions [role=button] { height: 40px; padding: 0 16px; margin: 0; }
.combo { position: relative; }
.combo-btn { text-align: left; background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: var(--radius-sm);
  overflow: hidden; white-space: nowrap; text-overflow: ellipsis; margin: 0; font-weight: 400; }
.combo-list { position: absolute; z-index: 20; top: calc(100% + 4px); left: 0; width: max(100%, 320px); max-height: 320px; overflow: auto;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); box-shadow: 0 8px 24px rgba(0, 0, 0, .12); padding: 6px; }
.combo-list input { margin: 0 0 6px; height: 36px; }
.combo-list a { display: block; padding: 7px 10px; border-radius: 8px; color: var(--text); font-size: 14px; }
.combo-list a:hover, .combo-list a.on { background: var(--surface-2); text-decoration: none; }
[x-cloak] { display: none !important; }
.pager { display: grid; grid-template-columns: 1fr auto 1fr; gap: 12px; align-items: center; margin-top: 16px; }
.pager-pages { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; }
.pg { min-width: 36px; height: 36px; display: inline-flex; align-items: center; justify-content: center; padding: 0 8px;
  border: 1px solid var(--border); border-radius: 10px; color: var(--text); font-size: 14px; background: var(--surface); }
.pg:hover { text-decoration: none; border-color: var(--accent); color: var(--accent); }
.pg.on { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.pg.off { opacity: .4; }
.pg.gap { border-color: transparent; background: none; }
.pager-per { justify-self: end; display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); margin: 0; }
.pager-per select { width: auto; height: 36px; margin: 0; padding: 0 28px 0 10px; }
@media (max-width: 720px) { .pager { grid-template-columns: 1fr; justify-items: center; } .pager-per { justify-self: center; } }

/* photos: add (upload | draw) side by side, the gallery scrolls inside its block */
.add-photos { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 12px; margin: 12px 0 16px; }
.add-photos > div { border: 1.5px dashed var(--border); border-radius: var(--radius-sm); padding: 14px 16px; background: var(--surface-2);
  display: flex; flex-direction: column; gap: 8px; }
.add-photos .hint { margin: 0; }
.add-photos label { display: flex; flex-direction: column; margin: 0; }
.add-photos .lbl { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.add-photos select, .add-photos input[type=text], .add-photos button { margin: 0; }
.drop.over { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, var(--surface)); }
.drop-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: auto; }
.photo-lib { max-height: min(70vh, 760px); overflow: auto; padding: 2px 4px 2px 0; }
.note { padding: 10px 14px; border-radius: var(--radius-sm); font-size: 14px; margin: 8px 0; }
.note.warn { background: var(--warn-soft); color: var(--warn); }
.note.bad { background: var(--bad-soft); color: var(--bad); }
.ms-val { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.photo-card { min-width: 0; }
.photo-card .ms { max-width: 100%; }
.combo-btn { display: flex; align-items: center; justify-content: flex-start; margin: 0 !important; }
.combo-btn::after { content: "▾"; margin-left: auto; color: var(--muted); padding-left: 8px; }
.combo-btn span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.filters .actions { display: flex; gap: 8px; flex-wrap: nowrap; }

/* where the ad leads */
.landing { display: flex; flex-direction: column; gap: 4px; margin: 12px 0 6px; }
.landing input { margin: 0; }
/* the network preview: flip through the photos Direct will rotate */
.net-slider { position: relative; }
.net-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 30px; height: 30px; padding: 0; border-radius: 50%;
  border: 0; background: rgba(255, 255, 255, .92); color: #111; font-size: 20px; line-height: 1; box-shadow: 0 1px 4px rgba(0, 0, 0, .25);
  opacity: 0; transition: opacity .15s; cursor: pointer; }
.net-nav.prev { left: 6px; }
.net-nav.next { left: 78px; }  /* inside the 110px photo column */
.net-nav { z-index: 2; }
.net-slider:hover .net-nav, .net-nav:focus-visible { opacity: 1; }
.net-count { position: absolute; left: 8px; bottom: 8px; font-size: 11px; background: rgba(0, 0, 0, .55); color: #fff; padding: 1px 6px;
  border-radius: 99px; opacity: 0; transition: opacity .15s; }
.net-slider:hover .net-count { opacity: 1; }
.net-nav { width: 26px; height: 26px; font-size: 18px; }
.net-nav.prev { left: 4px; }
.net-nav.next { left: 80px; }
.net-count { left: 36px; bottom: 6px; }
.groups-why .block-head { align-items: center; }
.groups-why .block-head h3 { margin: 0; }
.why-list { list-style: none; padding: 0; margin: 8px 0 0; display: flex; flex-direction: column; gap: 6px; }
.why-list li { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: baseline; font-size: 14px; }
.why-name { min-width: 0; }
.stopwatch { font-variant-numeric: tabular-nums; color: var(--muted); font-size: 13px; background: var(--surface-2);
  padding: 1px 8px; border-radius: 99px; flex: none; }
.stopwatch-note { margin: 0 0 6px 22px; font-size: 13px; color: var(--muted); }
.done-in { display: flex; align-items: center; gap: 10px; padding: 10px 14px; margin: 0 0 16px; border-radius: var(--radius-sm);
  background: var(--ok-soft); color: var(--ok); font-weight: 500; }
.done-in .done-ic { font-size: 18px; }
.done-in .icon-btn { margin-left: auto; background: none; border: 0; color: inherit; font-size: 20px; padding: 0 4px; cursor: pointer; }

/* waiting screen: cards in two columns, every other one as a network ad with a picture; the pulse keeps its phase
   across the 2-second redraws (base.html sets a negative delay), so it breathes instead of blinking */
.ad-cards { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.ad-cards > .ad-cards-head, .ad-cards > p { grid-column: 1 / -1; }
.ad-card.net { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 0 12px; align-items: start; }
.ad-card.net .grp { grid-column: 1 / -1; }
.ad-card.net .sk.img { grid-row: span 4; width: 96px; height: 96px; margin: 4px 0; border-radius: 10px; }
.ad-card.net .body { grid-column: 1 / -1; }
.ad-card .sk { animation-duration: 2.4s; }
@keyframes sk { 0%, 100% { opacity: 1; } 50% { opacity: .45; } }
.thinking { background: linear-gradient(90deg, var(--text) 0%, var(--text) 44%, color-mix(in srgb, var(--text) 35%, var(--surface)) 50%,
  var(--text) 56%, var(--text) 100%); background-size: 300% 100%; -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: think 2.8s linear infinite; font-weight: 500; }

/* results: budget pace */
.pace-head { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: baseline; justify-content: space-between; }
.pace-head h3 { margin: 0; }
.pace-bar { position: relative; height: 12px; border-radius: 99px; background: var(--surface-2); margin: 12px 0 8px; }
.pace-bar .spent { display: block; height: 100%; border-radius: 99px; background: var(--accent); }
.pace-bar .plan { position: absolute; top: -5px; width: 2px; height: 22px; background: var(--text); border-radius: 2px; transform: translateX(-1px); }

/* results: the daily chart — thin bars from the baseline, hover tooltip, a dot for days with requests */
.daychart { position: relative; }
.bars { position: relative; display: flex; align-items: flex-end; gap: 2px; height: 180px; margin-top: 14px;
  border-bottom: 1px solid var(--border); }
.bar-slot { position: relative; flex: 1; height: 100%; display: flex; align-items: flex-end; justify-content: center; cursor: default; outline: none; }
.bar-slot i { display: block; width: min(100%, 22px); border-radius: 4px 4px 0 0; background: var(--accent); opacity: .85; transition: opacity .1s; }
.bar-slot i.partial { opacity: .45; }
.bar-slot:hover i, .bar-slot:focus-visible i, .bar-slot i.on { opacity: 1; box-shadow: 0 0 0 2px var(--surface), 0 0 0 3px var(--accent); }
.req-dot { position: absolute; top: 2px; width: 7px; height: 7px; border-radius: 50%; background: var(--ok); }
.tip { position: absolute; top: 6px; z-index: 5; min-width: 190px; padding: 10px 12px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; box-shadow: 0 8px 24px rgba(0, 0, 0, .14); font-size: 13px; pointer-events: none; }
.tip b { display: block; margin-bottom: 4px; }
.tip div div { display: flex; justify-content: space-between; gap: 16px; color: var(--muted); }
.tip div div span:last-child { color: var(--text); font-variant-numeric: tabular-nums; }
.chart-axis .legend { display: inline-flex; gap: 6px; align-items: center; }
.sw { display: inline-block; width: 10px; height: 10px; border-radius: 3px; }
.sw.bar, .sw.sw-search { background: var(--accent); }
.sw.dot { border-radius: 50%; background: var(--ok); margin-left: 8px; }
.sw.sw-network { background: var(--series-2); }
.day-table { margin-top: 14px; }

/* results: funnel and the search / network split */
.funnel { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.fn-step { background: var(--surface-2); border-radius: 10px; padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; position: relative; }
.fn-step + .fn-step::before { content: "→"; position: absolute; left: -9px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 12px; }
.fn-name { font-size: 12.5px; color: var(--muted); }
.fn-step b { font-size: 22px; }
.fn-rate { font-size: 13px; }
.split { display: flex; gap: 2px; height: 14px; border-radius: 99px; overflow: hidden; margin: 10px 0; }
.split i { display: block; height: 100%; }
.split i.sw-search { background: var(--accent); }
.split i.sw-network { background: var(--series-2); }
.split-legend { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 4px; font-size: 14px; }
.split-legend li { display: flex; gap: 8px; align-items: center; }
.gbar { position: relative; min-width: 140px; height: 22px; display: flex; align-items: center; }
.gbar i { position: absolute; left: 0; top: 3px; bottom: 3px; border-radius: 0 4px 4px 0; background: var(--accent-soft); }
.gbar span { position: relative; padding-left: 6px; }
@media (max-width: 720px) { .funnel { grid-template-columns: 1fr 1fr; } .fn-step + .fn-step::before { display: none; } }
:root { --series-2: #eb6834; }
:root[data-theme="dark"] { --series-2: #d95926; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --series-2: #d95926; } }

.split-legend .sw { flex: none; width: 10px; height: 10px; }

/* results: small multiples — one metric per chart, each with its own axis */
.minis { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.mini { border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px 8px; }
.mini-head { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; min-height: 20px; }
.mini-plot { display: grid; grid-template-columns: auto 1fr; gap: 6px; margin-top: 6px; }
.yaxis { display: flex; flex-direction: column; justify-content: space-between; height: 120px; font-size: 11px; color: var(--muted);
  text-align: right; font-variant-numeric: tabular-nums; }
.yaxis span { line-height: 1; transform: translateY(-1px); }
.mini .bars { height: 120px; margin: 0; }
.grid-lines { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: space-between; pointer-events: none; }
.grid-lines i { border-top: 1px dashed color-mix(in srgb, var(--border) 70%, transparent); }
.grid-lines i:last-child { border-top: 0; }
.xaxis { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); padding-left: 34px; margin-top: 4px; }
.mini .tip { min-width: 170px; }
/* the funnel arrows: visible */
.funnel { gap: 18px; }
.fn-step + .fn-step::before { content: "›"; left: -15px; font-size: 22px; font-weight: 600; color: var(--accent); }
.cols > article:has(.minis) { grid-column: 1 / -1; }
.minis { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1100px) { .minis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .minis { grid-template-columns: 1fr; } }

/* simulator runs: one colour everywhere they appear */
.chip.sim { background: #7c3aed; color: #fff; border-color: #7c3aed; font-weight: 600; font-size: 11px;
  padding: 1px 7px; line-height: 16px; border-radius: 999px; vertical-align: middle; }
.hero-actions { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
button.link { background: none; border: 0; padding: 4px 0; color: var(--accent, #2563eb); cursor: pointer; width: auto; }
button.link.muted { color: var(--muted, #6b7280); }
.todo .it form.inline { margin: 0 0 0 8px; }
.sim-run { border-left: 4px solid #7c3aed; }
.sim-run .bar { height: 8px; background: var(--line, #e5e7eb); border-radius: 4px; overflow: hidden; margin: 8px 0; }
.sim-run .bar i { display: block; height: 100%; background: #7c3aed; }
.bar.sim i { background: #7c3aed; }
.sim-mini { margin-top: 4px; max-width: 160px; }
/* journal: stops red, optimisation green, money spent on junk orange */
li.feed-bad { border-left: 3px solid #dc2626; padding-left: 8px; }
li.feed-bad .ic { color: #dc2626; }
li.feed-good { border-left: 3px solid #16a34a; padding-left: 8px; }
li.feed-good .ic { color: #16a34a; }
li.feed-waste { border-left: 3px solid #ea580c; padding-left: 8px; }
li.feed-waste .ic { color: #ea580c; }
/* campaigns list: sortable headers, favicons, a warning by the name, why requests are not counted, pages */
.list th a.sort { color: inherit; }
.list th a.sort:hover { text-decoration: none; color: var(--text); }
.list th a.sort .arr { font-size: 11px; opacity: .35; margin-left: 3px; white-space: nowrap; }
.list th a.sort.on { color: var(--text); }
.list th a.sort.on .arr { opacity: 1; color: var(--accent); }
.fav { position: relative; overflow: hidden; }
.fav img { position: absolute; inset: 0; margin: auto; width: 20px; height: 20px; }
.fav.img { background: var(--surface-2) !important; color: transparent; box-shadow: inset 0 0 0 1px var(--border); }
.alert-ic { width: 15px; height: 15px; color: var(--warn); vertical-align: -2px; }
.alert-ic.bad { color: var(--bad); }
.chip.gap { height: 24px; padding: 0 8px; white-space: nowrap; font-size: 12px; font-family: inherit; }
.chip.gap:hover { text-decoration: none; filter: brightness(.97); }
.list .mini .x span { white-space: nowrap; }
.kpi .v.sm-v { font-size: 20px; color: var(--warn); }
.sort-m { display: none; width: auto; margin: 0; padding: 4px 28px 4px 10px; height: 32px; font-size: 13px; }
@media (max-width: 600px) { .sort-m { display: inline-block; } }
.pager { display: flex; gap: 4px; justify-content: center; padding: 12px 16px; border-top: 1px solid var(--border); flex-wrap: wrap; }
.pager a, .pager span { min-width: 32px; height: 32px; display: grid; place-items: center; border-radius: 8px; font-size: 13px; color: var(--muted); padding: 0 8px; }
.pager a:hover { background: var(--surface-2); text-decoration: none; color: var(--text); }
.pager a.on { background: var(--accent); color: #fff; }
/* new campaign form: compact flow, the period row */
.site-hint { font-size: 12.5px; margin: 6px 0 0; text-align: left; }
.period-field { display: block; margin: 14px 0 0; font-size: 13.5px; font-weight: 500; text-align: left; }
.period-row { display: flex; gap: 8px; margin-top: 4px; }
.period-row select { flex: 0 0 160px; margin: 0; }
.period-row .dates { flex: 1; display: flex; align-items: center; gap: 6px; }
.period-row .dates input { margin: 0; min-width: 0; }
.period-row .dates span { color: var(--muted); }
.period-field small { display: block; margin-top: 4px; font-weight: 400; }
.tiles-label small { font-weight: 400; }
.flow { list-style: none; counter-reset: f; padding: 0; margin: 4px auto 24px; max-width: 560px; display: grid;
  grid-template-columns: repeat(3, 1fr); gap: 8px; text-align: left; }
.flow li { counter-increment: f; margin: 0; padding: 10px 12px; border-radius: 12px; background: var(--surface); border: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 2px; font-size: 13px; line-height: 1.3; }
.flow li::before { content: counter(f); width: 20px; height: 20px; border-radius: 50%; background: var(--accent-soft);
  color: var(--accent); font-weight: 700; font-size: 11.5px; display: grid; place-items: center; margin-bottom: 4px; }
.flow span { color: var(--muted); font-size: 12px; }
@media (max-width: 600px) {
  .flow { grid-template-columns: 1fr; }
  .period-row { flex-wrap: wrap; } .period-row select { flex: 1 1 100%; }
}

/* step 3 «Проверка и запуск»: the check on the left, the campaign in short and marking pinned on the right */
.review-head { max-width: 880px; }
.review { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 24px; align-items: start; }
.review-side { position: sticky; top: 16px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; max-height: calc(100vh - 110px); overflow: auto; }
.side-card { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.side-card h3 { margin: 0 0 8px; }
.side-card .chip { white-space: normal; max-width: 100%; }
.side-card.need { border: 1px solid var(--warn, #f59e0b); }
.side-kv { display: grid; gap: 2px; margin: 0; font-size: 14px; }
.side-kv dt { color: var(--muted); font-size: 12.5px; margin-top: 8px; }
.side-kv dd { margin: 0; }
.side-list { margin: 2px 0 0; padding-left: 18px; }
.sm-link { font-size: 13px; }
.forecast .kpis.even { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
@media (max-width: 1000px) {  /* one column: every block in the place it had before */
  .review { display: flex; flex-direction: column; gap: 16px; }
  .review-main, .review-side { display: contents; }
  .o-tracking { order: 1; } .o-summary { order: 2; } .o-forecast { order: 3; }
  .o-settings { order: 4; } .o-marking { order: 5; } .o-sim { order: 6; }
}
/* step 2: ads for new services are being written */
.ads-step { margin-top: 8px; }
.note-run { display: flex; gap: 12px; align-items: flex-start; padding: 12px 16px; margin: 0 0 16px; border-radius: var(--radius-sm);
  background: var(--accent-soft); border-left: 4px solid var(--accent); }
.note-run .link { background: none; border: 0; padding: 0; height: auto; color: var(--accent); text-decoration: underline; font: inherit; }
.no-demand { margin: 12px 0 16px; padding: 12px 16px; border: 1px dashed var(--border); border-radius: var(--radius-sm); }
.no-demand ul { margin: 6px 0; padding-left: 18px; }
.no-demand .hint { margin: 0; }
.tracking-inline { margin-top: 14px; }
.tracking-inline article { margin: 12px 0 0; }
.tracking-inline button { margin-top: 4px; }
.sitelinks { margin: 4px 0 0; padding-left: 18px; font-size: 14px; }
.sitelinks li { margin: 2px 0; }
.photo-fit { display: grid; gap: 2px; margin: 4px 0; line-height: 1.3; }
.photo-fit .dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: 1px; background: var(--muted); }
.photo-fit .dot.ok { background: var(--ok, #16a34a); } .photo-fit .dot.warn { background: var(--warn, #f59e0b); } .photo-fit .dot.bad { background: var(--bad, #dc2626); }
/* photos: «upload» and «draw» are as tall as their content, not stretched to each other */
.add-photos { align-items: start; }
.add-photos > .drop { padding: 12px 14px; }
/* selects drawn like the search suggestions (base.html): the native one stays in the form, hidden */
.sel { position: relative; width: 100%; }
.sel .sel-native { position: absolute; inset: 0; opacity: 0; pointer-events: none; margin: 0; }
.sel-btn { display: block; line-height: 42px; width: 100%; height: 44px; margin: 0; padding: 0 36px 0 14px; text-align: left;
  background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-weight: 400; font-size: 15px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; position: relative; }
.sel-btn::after { content: ""; position: absolute; right: 14px; top: 50%; width: 8px; height: 8px; margin-top: -6px;
  border-right: 1.5px solid var(--muted); border-bottom: 1.5px solid var(--muted); transform: rotate(45deg); }
.sel-btn:hover { background: var(--surface); color: var(--text); border-color: var(--accent); }
.sel-btn:focus-visible, .sel-btn[aria-expanded="true"] { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); outline: none; }
.sel-list { position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 45; max-height: 340px; overflow: auto;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 4px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .14); min-width: 220px; }
.sel-opt { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; line-height: 1.35; width: 100%; height: auto; margin: 0;
  padding: 8px 10px; text-align: left; background: none; color: var(--text); border: 0; border-radius: 8px; font-weight: 400; font-size: 14px; }
.sel-opt small { color: var(--muted); font-size: 12.5px; }
.sel-opt:hover, .sel-opt:focus { background: var(--accent-soft); color: var(--text); outline: none; }
.sel-opt.on { font-weight: 600; }
.sel-group { padding: 8px 10px 4px; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.period-row .sel { flex: 0 0 160px; } @media (max-width: 600px) { .period-row .sel { flex: 1 1 100%; } }
.pager-per .sel { width: auto; } .pager-per .sel-btn { height: 36px; padding: 0 28px 0 10px; font-size: 14px; }
#extras .k { margin-top: 14px; }
.sitelinks { display: grid; gap: 8px; margin-top: 6px; }
.sitelink-row { display: grid; grid-template-columns: 1fr 1.3fr 1.3fr; gap: 8px; }
.sitelink-row input { margin: 0; }
@media (max-width: 700px) { .sitelink-row { grid-template-columns: 1fr; } }
/* hover inside the drawn select: soft, like the search suggestions, not the solid button colour */
.sel .sel-btn:hover:not(:disabled) { background: var(--surface); color: var(--text); border-color: var(--accent); }
.sel-list .sel-opt:hover:not(:disabled), .sel-list .sel-opt:focus { background: var(--accent-soft); color: var(--text); }
.sel-list .sel-opt:hover small, .sel-list .sel-opt:focus small { color: var(--muted); }
/* how a photo fits each service: ✓ / ! / ✕ with the service number; the full text on hover */
.photo-fit { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.fit { position: relative; display: inline-flex; align-items: center; gap: 2px; padding: 1px 6px 1px 2px; border-radius: 10px;
  font-size: 12px; font-weight: 600; line-height: 18px; cursor: default; }
.fit-i { width: 16px; height: 16px; border-radius: 50%; fill: none; stroke: #fff; stroke-width: 2; stroke-linecap: round; }
.fit.ok { background: var(--ok-soft); color: var(--ok); } .fit.ok .fit-i { background: var(--ok); }
.fit.warn { background: var(--warn-soft); color: #d97706; } .fit.warn .fit-i { background: #f59e0b; }
.fit.bad { background: var(--bad-soft); color: var(--bad); } .fit.bad .fit-i { background: var(--bad); }
.fit[data-tip]:hover::after, .fit[data-tip]:focus::after { content: attr(data-tip); position: absolute; left: 0; bottom: calc(100% + 6px); z-index: 30;
  width: max-content; max-width: 240px; padding: 6px 8px; border-radius: 8px; background: var(--text); color: var(--surface);
  font-weight: 400; font-size: 12.5px; line-height: 1.35; white-space: normal; }
.ms-list .fit { padding: 0; margin-right: 4px; background: none; }
/* photos: «upload» and «draw» are the same height; the upload side is a drop area that fills it */
.add-photos { align-items: stretch; }
.add-photos > .drop { padding: 14px 16px; }
.drop-zone { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; min-height: 120px;
  border: 1.5px dashed var(--border); border-radius: var(--radius-sm); background: var(--surface); text-align: center; padding: 16px; }
.drop-zone svg { width: 28px; height: 28px; color: var(--muted); }
/* step 3: the right column stays below the sticky top bar; notes keep their distance from the blocks around */
.review-side { top: 80px; max-height: calc(100vh - 170px); }
.review-main { display: grid; gap: 16px; } .review-main > * { margin: 0; }
.forecast .note-warn { margin: 12px 0; }
.side-card .chip { display: block; height: auto; line-height: 1.4; padding: 8px 12px; border-radius: 10px; margin: 0 0 10px; white-space: normal; }
/* square icon buttons in one line, the text on hover */
.row-actions { display: flex; align-items: center; gap: 6px; flex-wrap: nowrap; }
.row-actions form.inline { margin: 0; }
.ibtn { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; padding: 0; margin: 0;
  border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--accent); }
.ibtn .i { width: 16px; height: 16px; }
.ibtn:hover:not(:disabled) { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); text-decoration: none; }
.ibtn.primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.ibtn.primary:hover:not(:disabled) { background: var(--accent-hover); color: #fff; }
.ibtn[data-tip]:hover::after, .ibtn[data-tip]:focus-visible::after, .ms-list .fit[data-tip]:hover::after {
  content: attr(data-tip); position: absolute; right: 0; bottom: calc(100% + 6px); z-index: 30; width: max-content; max-width: 240px;
  padding: 6px 8px; border-radius: 8px; background: var(--text); color: var(--surface); font-weight: 400; font-size: 12.5px;
  line-height: 1.35; white-space: normal; text-align: left; }
.ms-list .fit { position: relative; }
.ms-list .fit[data-tip]:hover::after { left: 0; right: auto; }
/* waiting for a background job: spinner and text; the page reloads by itself */
.wait-note { display: flex; align-items: center; gap: 10px; padding: 10px 14px; margin: 10px 0; border-radius: var(--radius-sm);
  background: var(--accent-soft); color: var(--text); font-size: 14px; }
.note-ok { display: flex; align-items: center; gap: 8px; padding: 10px 14px; margin: 0 0 10px; border-radius: var(--radius-sm);
  background: var(--ok-soft); color: var(--ok); font-size: 14px; }
.note-ok .i { width: 16px; height: 16px; }
.review-main { grid-template-columns: minmax(0, 1fr); }
#simulation { margin-top: 24px; }
.cols + #simulation, .cols > div > a[role="button"] { margin-top: 16px; }
.search-log { margin-top: 16px; }
.no-demand + .search-log, .no-demand + details { margin-top: 16px; }
.search-log .log-item { margin: 10px 0; font-size: 14px; }
.search-log ul { margin: 4px 0 0; padding-left: 18px; }

/* region picker: several places as chips in one field */
.combo.multi .rchips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; min-height: 48px; padding: 6px 8px;
  border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); }
.combo.multi .rchips:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.combo.multi .combo-input { flex: 1 1 180px; min-width: 140px; border: 0 !important; box-shadow: none !important;
  height: 34px; padding: 0 6px; background: transparent; }
.rchip { display: inline-flex; align-items: center; gap: 4px; padding: 4px 4px 4px 10px; border-radius: 999px;
  background: var(--accent-soft); color: var(--text); font-size: 14px; line-height: 1.2; max-width: 100%; }
.rchip-x { border: 0; background: none; color: var(--muted); width: 22px; height: 22px; padding: 0; border-radius: 50%;
  font-size: 16px; line-height: 1; cursor: pointer; }
.rchip-x:hover:not(:disabled) { background: var(--surface); color: var(--text); }
.rchip-x:disabled { opacity: .35; cursor: default; }

/* service priority in the services list */
#groups summary .prio { display: inline-block; margin-left: auto; min-width: 128px; }
#groups summary .prio .sel-btn, #groups summary .prio select { height: 32px; font-size: 13.5px; padding: 0 10px; }
@media (max-width: 640px) { #groups summary .prio { margin-left: 0; } }
/* lists of options never take the global blue button hover; long option texts wrap inside the list */
.combo .combo-list .combo-opt:hover:not(:disabled), .combo .combo-list .combo-opt:focus { background: var(--accent-soft); color: var(--text); }
.sel-list .sel-opt:hover:not(:disabled), .sel-list .sel-opt:focus { background: var(--accent-soft); color: var(--text); }
.sel-opt { white-space: normal; overflow-wrap: anywhere; }
#groups summary .prio .sel-btn { line-height: 30px; }

/* forecast: no requests expected — the owner should change the campaign */
.kpi.kpi-bad { border-color: var(--bad, #d93025); background: color-mix(in srgb, var(--bad, #d93025) 6%, var(--surface)); }
.kpi.kpi-bad .v { color: var(--bad, #d93025); }
.note-bad { display: flex; gap: 10px; margin: 12px 0; padding: 12px 14px; border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--bad, #d93025) 9%, var(--surface)); border-left: 3px solid var(--bad, #d93025); }
.note-bad .i { color: var(--bad, #d93025); flex: none; margin-top: 2px; }
/* the spend page's pager (count · pages · per page) — the list page's pager rule below must not stack its numbers */
.pager:has(.pager-pages) { display: grid; grid-template-columns: 1fr auto 1fr; gap: 12px; align-items: center; border-top: 0; }
.pager .pager-pages { display: flex; flex-direction: row; gap: 6px; justify-content: center; flex-wrap: wrap; min-width: 0; height: auto; padding: 0; }
.pager .pager-count { display: inline; height: auto; min-width: 0; justify-self: start; }
@media (max-width: 720px) { .pager:has(.pager-pages) { grid-template-columns: 1fr; justify-items: center; } }
/* the region notice: two buttons side by side, the spinner while the forecast is recomputed */
.stale-note .stale-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.stale-note > .spin { flex: none; }
