/* Сводка. Style: "pastel consumer" (tasteskill app sheet, seed 2026314403), colours and manner after target-on.online:
   a pale blue-grey ground, white cards under one large radius, the indigo of the course as the one data hue,
   and its yellow on the single primary action and the "best" mark.
   Face: the answer pair (result and its price) sits on a solid indigo field, the way the course opens on one. */
:root {
  --ground: #eef3f8; --surface: #ffffff; --raised: #f2f5f9; --border: #e2e8ef; --rule: #edf1f5; --control: #cdd6e0;
  --text: #191919; --muted: #5b6472; --accent: #191919;
  --brand: #4b3ad5; --brand-ink: #2c2192; --brand-pale: #eceafd; --sun: #ffdc64; --sun-deep: #f5cd3d;
  --positive: #1f7a4d; --negative: #c4242a; --warning: #92400e;
  --chart-ink: #191919; --chart-grey: #9aa3b0; --chart-main: #4b3ad5;
  --pill-warning-bg: #fffbeb; --pill-warning-ink: #92400e; --pill-neutral-bg: #eceafd; --pill-neutral-ink: #2c2192;
  --radius-card: 20px; --radius-control: 12px; --radius-inner: 10px; --gap: 12px; --pad: 24px; --control-height: 40px;
  --fs-title: 28px; --fs-section: 18px; --fs-kpi: 30px; --fs-body: 14px; --fs-small: 13px;
  --font: Onest, Inter, system-ui, sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--ground); color: var(--text); font: 400 var(--fs-body)/1.5 var(--font); font-variant-numeric: tabular-nums; }
h1, h2, h3 { margin: 0; font-weight: 700; letter-spacing: -0.015em; }
h1 { font-size: var(--fs-title); line-height: 1.2; }
h2 { font-size: var(--fs-section); }
h3 { font-size: 16px; }
p { margin: 0; }
.muted { color: var(--muted); font-size: var(--fs-small); }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

/* shell: one bar and a canvas. Grid: canvas 1240 max, gutters 24, one 12px gap everywhere */
.top { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; padding: 12px 24px; min-height: 64px; background: var(--surface); }
.brand { display: flex; flex-wrap: wrap; align-items: baseline; gap: 12px; }
.brand { align-items: center; }
.brand b { display: inline-flex; align-items: center; gap: 8px; font-size: 20px; font-weight: 700; letter-spacing: -0.02em; }
/* the mark: a switch turned on, the product's own "ready" */
.brand .mark { position: relative; width: 30px; height: 18px; border-radius: 999px; background: var(--brand); }
.brand .mark::after { content: ""; position: absolute; right: 3px; top: 3px; width: 12px; height: 12px; border-radius: 50%; background: var(--sun); }
main { max-width: 1288px; margin: 0 auto; padding: 24px; }
.titlerow { display: grid; gap: 4px; margin-bottom: 16px; }
.titlerow p { font-size: var(--fs-body); color: var(--text); max-width: 80ch; }

.btn { display: inline-flex; align-items: center; justify-content: center; min-height: var(--control-height); padding: 0 12px; border-radius: var(--radius-control); border: 1px solid var(--control); background: var(--surface); color: var(--text); font: 600 var(--fs-body) var(--font); cursor: pointer; padding: 0 16px; transition: background .15s, transform .1s; }
.btn:active { transform: translateY(1px); }
.btn:hover { background: var(--raised); }
.btn.primary { background: var(--sun); border-color: var(--sun); color: var(--text); }
.btn.primary:hover { background: var(--sun-deep); border-color: var(--sun-deep); }
select, input[type=text], input[type=date] { max-width: 100%; min-height: var(--control-height); padding: 0 12px; border: 1px solid var(--control); border-radius: var(--radius-control); background: var(--surface); color: var(--text); font: 400 var(--fs-body) var(--font); }

.empty { display: grid; gap: 12px; justify-items: center; padding-top: 64px; }

.tabs { display: inline-flex; max-width: 100%; gap: 4px; padding: 4px; overflow-x: auto; scrollbar-width: none; background: var(--surface); border-radius: 999px; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { flex: none; min-height: 36px; padding: 0 16px; border: 0; border-radius: 999px; background: none; color: var(--muted); font: 600 var(--fs-body) var(--font); white-space: nowrap; cursor: pointer; transition: background .15s, color .15s; }
.tabs button:hover { color: var(--text); background: var(--raised); }
.tabs button[aria-selected="true"] { color: #fff; background: var(--text); }

.filters { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin: 16px 0; }
.filters label, .r-tools label { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; min-width: 0; max-width: 100%; font-weight: 500; }
.row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.row > select { flex: 0 1 320px; min-width: 0; }

.grid { display: grid; gap: var(--gap); }
#view, .grid > * { min-width: 0; }
.card { background: var(--surface); border: 0; border-radius: var(--radius-card); padding: var(--pad); min-width: 0; }
.section { margin-top: 40px; display: grid; gap: 16px; }

/* KPIs. The answer pair is a solid indigo field; what the client really got is its pale tint; the rest is one divided white card */
.kpis-main, .kpis { gap: 0; border-radius: var(--radius-card); overflow: hidden; }
.kpis-main { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-bottom: var(--gap); background: var(--brand); color: #fff; }
.kpis-main.real { background: var(--brand-pale); color: var(--brand-ink); }
.kpis { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); background: var(--surface); }
.kpi, .kpi.card { border: 0; border-radius: 0; background: none; padding: 16px 24px; border-right: 1px solid var(--rule); border-bottom: 1px solid var(--rule); margin: 0 -1px -1px 0; }
.kpi .label { color: var(--muted); font-size: var(--fs-small); }
.kpi .value { font-size: 24px; font-weight: 600; line-height: 1.3; letter-spacing: -0.01em; margin-top: 4px; overflow-wrap: anywhere; }
.kpi.main { padding: 28px 32px; border-color: rgba(255, 255, 255, .16); }
.kpis-main.real .kpi.main { border-color: rgba(44, 33, 146, .12); }
.kpi.main .label { font-size: var(--fs-body); color: inherit; opacity: .86; }
.kpi.main .value { font-size: 40px; font-weight: 700; line-height: 1.15; letter-spacing: -0.02em; margin: 4px 0 8px; }
.chip { display: block; font-size: var(--fs-small); color: var(--muted); margin-top: 4px; }
.chip.good { color: var(--positive); }
.chip.bad { color: var(--negative); }
.kpi.main .chip, .kpi.main .chip.good, .kpi.main .chip.bad { color: inherit; opacity: .86; font-size: 13px; }
.kpi.minor .chip, .kpi.minor .chip.good { color: var(--muted); }
.kpi.minor .chip.bad { color: var(--negative); }

.funnels { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.steps { display: grid; margin-top: 12px; }
.step { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; padding: 12px 0; border-top: 1px solid var(--rule); }
.step:first-child { border-top: 0; }
.step .n { font-size: 18px; font-weight: 600; text-align: right; }
.step .sub { grid-column: 1 / -1; color: var(--muted); font-size: var(--fs-small); }
.bar { grid-column: 1 / -1; height: 6px; border-radius: 999px; background: var(--raised); overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: 999px; background: var(--brand); }
.note { margin-top: 12px; padding: 12px; border-radius: var(--radius-inner); background: var(--ground); font-size: var(--fs-small); }

.scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: var(--fs-body); }
th, td { padding: 12px; text-align: right; border-top: 1px solid var(--rule); white-space: nowrap; }
th { color: var(--muted); font-size: var(--fs-small); font-weight: 500; border-top: 0; }
th:first-child, td:first-child { text-align: left; white-space: normal; min-width: 220px; padding-left: 0; }
th:last-child, td:last-child { padding-right: 0; }
tr.total td { font-weight: 700; border-top: 2px solid var(--text); }

.charts { grid-template-columns: repeat(auto-fit, minmax(360px, 1fr)); }
svg.chart { display: block; width: 100%; height: auto; overflow: visible; margin-top: 8px; }
svg.chart text { font: 12px var(--font); fill: var(--muted); }
svg.chart .hit { fill: transparent; }
svg.chart .hit:hover + .mark { opacity: .7; }
.tip { position: fixed; z-index: 10; pointer-events: none; padding: 8px 12px; border-radius: var(--radius-inner); background: var(--accent); color: #fff; font-size: var(--fs-small); max-width: 260px; }

.warnbox { margin-top: var(--gap); padding: 12px 16px; border: 1px solid #fde68a; border-radius: var(--radius-card); background: var(--pill-warning-bg); color: var(--pill-warning-ink); }

/* client report: a sheet of paper inside the app */
.r-tools { margin-bottom: var(--gap); display: grid; gap: 8px; }
.report { max-width: 820px; margin: 0 auto; background: var(--surface); border: 0; border-radius: var(--radius-card); padding: 40px; display: grid; gap: 32px; }
.report > * { min-width: 0; }
.report h2 { margin-bottom: 12px; }
.r-title { font-size: 30px; font-weight: 700; line-height: 1.2; letter-spacing: -0.02em; margin: 0; }
.r-head { display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between; align-items: flex-end; padding-bottom: 20px; border-bottom: 1px solid var(--border); }
.r-kicker { color: var(--muted); }
.r-period { font-weight: 500; white-space: nowrap; }
.r-hero { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--gap); }
.r-big { padding: 28px; border-radius: var(--radius-card); background: var(--brand); color: #fff; }
.r-big + .r-big { background: var(--brand-pale); color: var(--brand-ink); }
.r-label { opacity: .86; }
.r-num { display: inline-block; font-size: 44px; font-weight: 700; line-height: 1.15; letter-spacing: -0.02em; margin: 4px 0 12px; overflow-wrap: anywhere; }
.r-delta { font-size: var(--fs-body); font-weight: 500; }
.r-delta, .r-delta.good, .r-delta.bad, .r-delta.flat { color: inherit; opacity: .9; }
.r-delta.flat { font-weight: 400; }
.r-scope { grid-column: 1 / -1; margin: 0; color: var(--muted); font-size: var(--fs-small); }
.r-verdict { font-size: 20px; font-weight: 600; line-height: 1.4; letter-spacing: -0.01em; }
[contenteditable]:hover, [contenteditable]:focus { outline: 1px dashed var(--control); outline-offset: 4px; }
.r-total { font-size: 24px; font-weight: 700; }
.r-total span { font-size: var(--fs-body); font-weight: 400; color: var(--muted); }
.r-split { display: flex; gap: 2px; height: 24px; margin: 12px 0 8px; border-radius: 999px; overflow: hidden; }
.r-split i { display: block; min-width: 3px; }
.r-table th:first-child, .r-table td:first-child { min-width: 0; }
.r-sw { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 8px; }
.r-best { display: inline-block; margin-left: 8px; padding: 0 8px; border-radius: 999px; background: var(--sun); color: var(--text); font-size: var(--fs-small); font-weight: 600; letter-spacing: 0; white-space: nowrap; }
.r-bars { display: flex; gap: 2px; align-items: flex-end; }
.r-bar { flex: 1; display: grid; justify-items: center; gap: 4px; font-size: var(--fs-small); color: var(--muted); }
.r-bar b { color: var(--text); font-weight: 500; }
.r-bar i { display: block; width: 100%; max-width: 28px; border-radius: 6px 6px 0 0; background: var(--brand-pale); }
.r-bar.now i { background: var(--chart-main); }
.r-two { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 24px; }
.r-text { white-space: pre-line; }
.r-details summary { cursor: pointer; font-weight: 500; min-height: 32px; }
.r-foot { display: flex; flex-wrap: wrap; gap: 8px 24px; justify-content: space-between; padding-top: 16px; border-top: 1px solid var(--rule); color: var(--muted); font-size: var(--fs-small); }

@media (max-width: 720px) {
  .top { padding: 8px 16px; }
  .top { min-height: 56px; }
  .tabs { display: flex; }
  .tabs button { padding: 0 12px; }
  main { padding: 16px; }
  .filters label, .filters select { width: 100%; }
  .card { padding: 16px; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi, .kpi.card { padding: 12px 16px; }
  .kpi .value { font-size: 18px; }
  .kpi.main { padding: 16px; }
  .kpi.main .value { font-size: 28px; }
  .charts, .funnels { grid-template-columns: 1fr; }
  th, td { padding: 8px; }
  th:first-child, td:first-child { min-width: 150px; }
  .r-tools label, .r-tools select, .r-tools input, .r-tools .btn { width: 100%; }
  .report { padding: 20px 16px; gap: 24px; }
  .r-title { font-size: 22px; }
  .r-period { white-space: normal; }
  .r-hero { grid-template-columns: 1fr; }
  .r-big { padding: 16px; }
  .r-num { font-size: 36px; }
  .r-verdict { font-size: 16px; }
  .r-table th { white-space: normal; vertical-align: bottom; }
  .r-table td, .r-table th { padding: 8px 4px; font-size: var(--fs-small); }
  .r-table th:first-child, .r-table td:first-child { min-width: 84px; }
  .r-foot { flex-direction: column; }
}
@media print {
  @page { margin: 14mm; }
  body { background: #fff; }
  .top, .tabs, .filters, .r-tools, .tip, .titlerow { display: none !important; }
  main { padding: 0; max-width: none; }
  .report { padding: 0; border: 0; max-width: none; }
  .r-hero, .r-big, .r-two, .report .kpis, .report .funnels > .card, .report tr { break-inside: avoid; }
  .report h2, .report h3 { break-after: avoid; }   /* a heading never ends a page apart from what it names */
  .noprint { display: none !important; }
  .report .funnels { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .scroll { overflow: visible; }
  .r-details { display: none; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
.card > .kpi { border: 0; margin: 0; padding: 0; }
.meta { display: grid; gap: 12px; width: 100%; max-width: 560px; }
.meta label { display: flex; flex-direction: column; gap: 4px; font-weight: 500; flex: 1 1 200px; min-width: 0; }
.meta .btn { align-self: flex-end; }
a.btn { text-decoration: none; }
@media print { #home { display: none; } }
.meta #metaDates { flex: 1 1 100%; }
.meta #metaLogin { justify-self: start; }
.meta a:not(.btn) { color: var(--text); }

/* creatives and the hand-typed "really came" column */
.g-creos { margin-top: 16px; padding: 16px; border-radius: var(--radius-inner); background: var(--raised); display: grid; gap: 12px; }
.g-creos h4 { margin: 0; font-size: var(--fs-small); font-weight: 500; color: var(--muted); }
.g-creo { display: grid; grid-template-columns: 56px minmax(0, 1fr); gap: 12px; align-items: center; }
.g-creo img, .g-creo .noimg { width: 56px; height: 56px; border-radius: var(--radius-inner); object-fit: cover; background: var(--border); display: block; }
.g-main { display: grid; gap: 2px; min-width: 0; }
/* name on the left, result on the right; in a narrow card the result drops under the name instead of squeezing it */
.g-line { display: flex; flex-wrap: wrap; gap: 0 12px; justify-content: space-between; align-items: baseline; }
.g-line > span:first-child { flex: 1 1 150px; min-width: 0; }
.g-line b { font-weight: 600; overflow-wrap: break-word; }
.g-val { flex: none; white-space: nowrap; }
input.real { width: 92px; min-height: 36px; padding: 0 10px; border: 1px solid var(--control); border-radius: var(--radius-inner); background: var(--surface); color: var(--text); font: 400 var(--fs-body) var(--font); text-align: right; }
.r-real { margin: 0 0 16px; }
input.real:focus, select:focus, input:focus { outline: 2px solid var(--brand); outline-offset: 1px; border-color: var(--brand); }
.titlerow { margin: 8px 0 20px; }
.titlerow p { color: var(--muted); font-size: 15px; }
.filters { margin: 20px 0; }
.meta { border-radius: var(--radius-card); }
.meta h2 { font-size: 20px; }
.warnbox { border-radius: var(--radius-inner); }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
/* headline figures are read, not compared down a column: proportional digits sit tighter */
.kpi .value, .r-num, .r-total, .step .n { font-variant-numeric: normal; }
/* the campaign table has up to a dozen columns: headers may wrap so it fits the canvas before it has to scroll */
th { white-space: normal; vertical-align: bottom; line-height: 1.3; }
th, td { padding: 12px 10px; }
th:first-child, td:first-child { min-width: 180px; }
/* the minor strip never leaves an orphan cell: its column count follows the number of figures (4, 6, 8 or 10) */
.kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.kpis:has(> :nth-child(6):last-child) { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.kpis:has(> :nth-child(8):last-child) { grid-template-columns: repeat(8, minmax(0, 1fr)); }
.kpis:has(> :nth-child(10):last-child) { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.kpis .kpi { padding: 16px 20px; }
@media (max-width: 1100px) {
  .kpis:has(> :nth-child(6):last-child) { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .kpis:has(> :nth-child(8):last-child) { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
/* charts are drawn in a 560-unit box and scaled to the card: in a narrow card the labels are set larger so they stay readable */
.charts > .card { container-type: inline-size; }
@container (max-width: 470px) { svg.chart text { font-size: 19px; } }
@media (max-width: 720px) {
  .kpis, .kpis:has(> :nth-child(6):last-child), .kpis:has(> :nth-child(8):last-child), .kpis:has(> :nth-child(10):last-child) { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpis .kpi { padding: 12px 16px; }
  .kpis-main.real { grid-template-columns: 1fr; }
  /* the campaign name stays in view while the figures scroll sideways */
    /* the card's own 16px padding is part of the scrolling box, so the cell reaches back over it */
  .card.scroll th:first-child, .card.scroll td:first-child { position: sticky; left: -16px; z-index: 1; background: var(--surface); min-width: 156px; max-width: 156px; padding: 8px 8px 8px 16px; }
  .card.scroll table { margin-left: -16px; width: calc(100% + 16px); }
}
.warn { display: inline-block; padding: 2px 8px; border-radius: 999px; background: var(--pill-warning-bg); color: var(--pill-warning-ink); font-size: var(--fs-small); cursor: help; }
/* a creative opened large */
.thumb { padding: 0; border: 0; background: none; border-radius: var(--radius-inner); cursor: zoom-in; display: block; transition: transform .15s; }
.thumb:hover { transform: scale(1.06); }
/* only the picture, at its own size; it shrinks just enough to fit the window and never stretches */
.creoview { padding: 0; border: 0; background: none; overflow: visible; max-width: none; max-height: none; cursor: zoom-out; }
.creoview::backdrop { background: rgba(25, 25, 25, .82); }
.creoview img { display: block; width: auto; height: auto; max-width: calc(100vw - 32px); max-height: calc(100dvh - 32px); border-radius: var(--radius-inner); background: var(--raised); }
.creoview #creoClose { position: fixed; top: 16px; right: 16px; }
/* while the large picture is on its way, the small one is shown enlarged so the window never opens empty */
.creoview img.loading { width: min(480px, calc(100vw - 32px)); opacity: .7; }
@media print { .creoview { display: none; } }

/* a campaign's «Результат» names its goal under the number; the «Реально пришло» header can be renamed in place */
.cell-sub { color: var(--muted); font-size: 12px; font-weight: 400; line-height: 1.25; }
.th-edit { width: 100%; min-width: 9ch; max-width: 24ch; padding: 0 0 1px; border: 0; border-bottom: 1px dashed var(--control); border-radius: 0; background: none; color: inherit; font: inherit; text-align: right; field-sizing: content; cursor: text; }
.th-edit:hover { border-bottom-color: var(--muted); }
.th-edit:focus { outline: none; border-bottom: 1px solid var(--brand); color: var(--text); }
.g-creos .more { justify-self: start; min-height: 32px; font-size: var(--fs-small); }
.trend-range { gap: 8px 20px; }
.trend-range label { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; min-width: 0; font-weight: 500; }
.trend-range select { min-width: 0; max-width: 100%; }
.trend-total { margin-top: 16px; }
/* in the report the dashboard's cards are plain parts of one page */
.report .card:not(.kpi) { background: none; padding: 0; border-radius: 0; }
.report .funnels { gap: 28px 32px; }
.report .funnels > .card { padding-top: 16px; border-top: 1px solid var(--rule); }
.report .kpis { border: 1px solid var(--rule); }
@media (max-width: 720px) { .trend-range label, .trend-range select { width: 100%; } }
@media print { .g-creos .more { display: none; } }
