/* Пилот — интерфейс. Одна переменная — один смысл: кнопка не красится цветом ошибки и наоборот. */

:root {
  color-scheme: light dark;
  --bg: #f3f3f0;
  --surface: #ffffff;
  --surface-2: #f7f7f5;
  --surface-3: #efefeb;
  --line: rgba(17, 20, 24, 0.08);
  --line-strong: rgba(17, 20, 24, 0.16);
  --text: #121417;
  --text-2: #565c64;
  --text-3: #8a9097;

  --btn: #121417;
  --on-btn: #ffffff;
  --focus: #3b5bff;
  --link: #3350e0;
  --select: rgba(59, 91, 255, 0.1);

  --good: #0e8f4f;
  --good-soft: rgba(14, 143, 79, 0.1);
  --warn: #b86e00;
  --warn-soft: rgba(214, 138, 0, 0.13);
  --danger: #d9363e;
  --danger-soft: rgba(217, 54, 62, 0.09);
  --info: #3350e0;
  --info-soft: rgba(51, 80, 224, 0.09);
  --muted-soft: rgba(17, 20, 24, 0.06);

  --chart-spend: rgba(18, 20, 23, 0.14);
  --chart-spend-now: rgba(18, 20, 23, 0.32);
  --chart-leads: #3b5bff;

  --shadow: 0 1px 2px rgba(17, 20, 24, 0.04), 0 6px 20px rgba(17, 20, 24, 0.05);
  --shadow-lift: 0 12px 40px rgba(17, 20, 24, 0.16);
  --backdrop: rgba(12, 14, 17, 0.38);

  /* всплывающее пояснение «?»: тёмное на светлой теме */
  --tip-bg: #1b1e23;
  --tip-text: #c9ced5;
  --tip-strong: #ffffff;
  --tip-muted: #8b929b;
  --tip-link: #a9b8ff;
  --tip-edge: transparent;

  --r: 18px;
  --r-s: 12px;
  --tab-h: 62px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --gutter: 16px;
  --tap: 44px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0c0e11;
    --surface: #15181c;
    --surface-2: #1b1f24;
    --surface-3: #22272d;
    --line: rgba(255, 255, 255, 0.08);
    --line-strong: rgba(255, 255, 255, 0.16);
    --text: #eef0f2;
    --text-2: #a5abb3;
    --text-3: #737a83;

    --btn: #eef0f2;
    --on-btn: #0c0e11;
    --focus: #7d93ff;
    --link: #8ea2ff;
    --select: rgba(125, 147, 255, 0.14);

    --good: #3ccf86;
    --good-soft: rgba(60, 207, 134, 0.12);
    --warn: #f0aa3c;
    --warn-soft: rgba(240, 170, 60, 0.13);
    --danger: #ff6b6b;
    --danger-soft: rgba(255, 107, 107, 0.12);
    --info: #8ea2ff;
    --info-soft: rgba(142, 162, 255, 0.12);
    --muted-soft: rgba(255, 255, 255, 0.07);

    --chart-spend: rgba(255, 255, 255, 0.14);
    --chart-spend-now: rgba(255, 255, 255, 0.34);
    --chart-leads: #8ea2ff;

    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-lift: 0 16px 48px rgba(0, 0, 0, 0.5);
    --backdrop: rgba(0, 0, 0, 0.55);

    --tip-bg: #2a2f36;
    --tip-edge: rgba(255, 255, 255, 0.1);
  }
}

@media (pointer: coarse) {
  :root { --tap: 48px; }
}

*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}

body.locked { overflow: hidden; }

img, svg, video { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--link); text-decoration: none; }
p { margin: 0; }
h1, h2, h3, h4 { margin: 0; font-family: var(--font-display); letter-spacing: -0.01em; }
[hidden] { display: none !important; }

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  border-radius: 8px;
}

.num { font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }
.muted { color: var(--text-2); }
.faint { color: var(--text-3); }
.small { font-size: 13px; }
.tiny { font-size: 12px; }
.strong { font-weight: 600; }
.center { text-align: center; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.i {
  width: 20px;
  height: 20px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.i-s { width: 16px; height: 16px; }
.i-l { width: 28px; height: 28px; }

/* ---------- каркас ---------- */

.app {
  min-height: calc(var(--vh, 1vh) * 100);
}

.view {
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
  padding: calc(var(--safe-t) + 14px) var(--gutter) calc(var(--tab-h) + var(--safe-b) + 28px);
  outline: none;
}

.screen, .view > .stack {
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-width: 0;
}

.view.wide { max-width: 1080px; }
.view.bare { padding: 0; max-width: none; }

.tabs {
  position: fixed;
  inset: auto 0 0 0;
  z-index: 30;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  height: calc(var(--tab-h) + var(--safe-b));
  padding: 0 6px var(--safe-b);
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  -webkit-backdrop-filter: saturate(1.6) blur(18px);
  backdrop-filter: saturate(1.6) blur(18px);
  border-top: 1px solid var(--line);
}

.tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-width: 0;
  color: var(--text-3);
  font-size: 11px;
  font-weight: 500;
  position: relative;
}
.tab .i { width: 23px; height: 23px; }
.tab[aria-current="page"] { color: var(--text); }
.tab .dot {
  position: absolute;
  top: 8px;
  left: calc(50% + 8px);
  min-width: 17px;
  height: 17px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--danger);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 17px;
  text-align: center;
}

.tab-new .bubble {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: var(--btn);
  color: var(--on-btn);
  box-shadow: var(--shadow);
}
.tab-new .bubble .i { width: 22px; height: 22px; stroke-width: 2.2; }
.tab-new span:last-child { display: none; }

.brand {
  display: none;
  align-items: center;
  gap: 10px;
  padding: 6px 10px 22px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 19px;
  color: var(--text);
}
.brand .logo {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: var(--btn);
  color: var(--on-btn);
}
.brand .logo .i { width: 18px; height: 18px; stroke-width: 2.1; }

@media (min-width: 960px) {
  .tabs {
    inset: 0 auto 0 0;
    width: 232px;
    height: auto;
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 22px 12px;
    border-top: 0;
    border-right: 1px solid var(--line);
    background: var(--surface);
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }
  .brand { display: flex; order: -2; }
  .tab {
    flex-direction: row;
    justify-content: flex-start;
    gap: 12px;
    height: 42px;
    padding: 0 12px;
    border-radius: 11px;
    font-size: 14.5px;
    color: var(--text-2);
  }
  .tab .i { width: 20px; height: 20px; }
  .tab[aria-current="page"] { background: var(--surface-3); color: var(--text); font-weight: 600; }
  .tab .dot { position: static; margin-left: auto; }
  .tab-new { order: -1; margin-bottom: 14px; }
  .tab-new .bubble { width: auto; height: auto; background: none; color: inherit; box-shadow: none; border-radius: 0; }
  .tab-new .bubble .i { width: 20px; height: 20px; }
  .tab-new span:last-child { display: inline; }
  .tab-new {
    background: var(--btn);
    color: var(--on-btn) !important;
    font-weight: 600;
  }
  .tab-new[aria-current="page"] { background: var(--btn); color: var(--on-btn); }
  .view { padding: 34px 32px 60px; }
  .view.bare { padding: 0; }
  .app { padding-left: 232px; }
}

@media (hover: hover) {
  .tab:hover { color: var(--text); }
  @media (min-width: 960px) {
    .tab:not(.tab-new):hover { background: var(--surface-2); }
  }
}

.no-tabs .tabs { display: none; }
.no-tabs .app { padding-left: 0; }

/* ---------- шапка экрана ---------- */

.head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.head h1 { font-size: 30px; line-height: 1.1; font-weight: 750; }
.head .sub { margin-top: 4px; color: var(--text-2); font-size: 14px; }
.head .tools { display: flex; gap: 8px; align-items: center; }
/* узкий телефон: у второстепенной кнопки в шапке остаётся значок, заголовок не переносится */
@media (max-width: 380px) { .head .tools .lbl { display: none; } }
/* значок + текст в одну строку (svg в сбросе — блочный) */
.note { display: flex; gap: 8px; align-items: flex-start; }
.note > .i { margin-top: 1px; }

.section { display: flex; flex-direction: column; gap: 10px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; padding: 0 2px; }
.section-head h2 { font-size: 19px; font-weight: 700; }
.section-head .count { color: var(--text-3); font-weight: 600; margin-left: 6px; }

.stack { display: flex; flex-direction: column; gap: 10px; }
.stack.tight { gap: 4px; }
.row { display: flex; align-items: center; gap: 10px; min-width: 0; }
.row.wrap { flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.grow { flex: 1 1 auto; min-width: 0; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- карточки ---------- */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}
.card.flat { box-shadow: none; }
.card.tight { gap: 8px; }
.card.pad-l { padding: 20px; }
.card.soft { background: var(--surface-2); box-shadow: none; }

.card-link { cursor: pointer; transition: transform 0.15s ease, box-shadow 0.15s ease; }
@media (hover: hover) {
  .card-link:hover { box-shadow: var(--shadow-lift); }
}
.card-link:active { transform: scale(0.992); }

.divider { height: 1px; background: var(--line); margin: 2px 0; }

/* ---------- кнопки ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: var(--tap);
  padding: 0 18px;
  border-radius: var(--r-s);
  border: 1px solid transparent;
  background: var(--surface-3);
  color: var(--text);
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  white-space: nowrap;
  transition: background-color 0.15s ease, opacity 0.15s ease, transform 0.1s ease;
  touch-action: manipulation;
}
.btn:active { transform: scale(0.98); }
.btn[disabled], .btn.busy { opacity: 0.5; pointer-events: none; }
.btn.busy { position: relative; color: transparent !important; opacity: 0.8; }
.btn.busy::after {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid var(--text-3);
  border-top-color: transparent;
  animation: spin 0.7s linear infinite;
}
.btn-primary { background: var(--btn); color: var(--on-btn); }
.btn-primary.busy::after { border-color: var(--on-btn); border-top-color: transparent; }
.btn-ghost { background: transparent; border-color: var(--line-strong); }
.btn-quiet { background: transparent; color: var(--text-2); padding: 0 12px; }
.btn-danger { background: var(--danger-soft); color: var(--danger); }
.btn-sm { min-height: 36px; padding: 0 12px; font-size: 14px; border-radius: 10px; }
.btn-block { width: 100%; }
.btn-icon { width: var(--tap); padding: 0; }
.btn-icon.btn-sm { width: 36px; }

@media (hover: hover) {
  .btn:hover { background: color-mix(in srgb, var(--surface-3) 70%, var(--text) 8%); }
  .btn-primary:hover { background: color-mix(in srgb, var(--btn) 93%, var(--bg)); }
  .btn-ghost:hover, .btn-quiet:hover { background: var(--surface-2); }
  .btn-danger:hover { background: color-mix(in srgb, var(--danger-soft) 70%, var(--danger) 12%); }
}

.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.actions .btn { flex: 1 1 auto; }
.actions.end { justify-content: flex-end; }
.actions.end .btn { flex: 0 0 auto; }

@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- метки ---------- */

.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 24px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
  background: var(--muted-soft);
  color: var(--text-2);
}
.pill .i { width: 13px; height: 13px; stroke-width: 2.3; }
.pill::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.9;
}
.pill.bare::before { display: none; }
.t-good { background: var(--good-soft); color: var(--good); }
.t-warn { background: var(--warn-soft); color: var(--warn); }
.t-danger { background: var(--danger-soft); color: var(--danger); }
.t-info { background: var(--info-soft); color: var(--info); }
.t-muted, .t-neutral { background: var(--muted-soft); color: var(--text-2); }

.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 22px;
  padding: 0 8px;
  border-radius: 7px;
  background: var(--surface-3);
  color: var(--text-2);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

/* ---------- фильтры ---------- */

.chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  margin: 0 calc(-1 * var(--gutter));
  padding: 2px var(--gutter);
}
.chips::-webkit-scrollbar { display: none; }
@media (min-width: 960px) {
  .chips { margin: 0; padding: 2px 0; flex-wrap: wrap; }
}

.chip {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--text-2);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  touch-action: manipulation;
}
.chip[aria-pressed="true"] { background: var(--btn); color: var(--on-btn); border-color: var(--btn); }
.chip .x { margin-right: -4px; opacity: 0.7; }
@media (pointer: coarse) { .chip { height: 40px; } }

.seg {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  gap: 2px;
  padding: 3px;
  border-radius: 12px;
  background: var(--surface-3);
}
.seg button {
  min-height: 36px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--text-2);
  font-weight: 600;
  font-size: 14px;
  padding: 0 8px;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  touch-action: manipulation;
}
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
@media (pointer: coarse) { .seg button { min-height: 40px; } }
/* подписи разной длины: колонка не уже своего текста, остаток делится поровну */
.seg.fit { grid-auto-columns: minmax(min-content, 1fr); }

/* ---------- поля ---------- */

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > span, .label { font-size: 13px; font-weight: 600; color: var(--text-2); }
.field .hint { font-size: 12.5px; color: var(--text-3); }

.input, .select, .textarea {
  width: 100%;
  min-height: var(--tap);
  padding: 10px 14px;
  border-radius: var(--r-s);
  border: 1px solid var(--line-strong);
  background: var(--surface);
  font-size: 16px; /* меньше 16 — айфон приближает страницу при фокусе */
  line-height: 1.35;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.input:focus, .select:focus, .textarea:focus { border-color: var(--focus); box-shadow: 0 0 0 3px var(--select); }
.input.bad, .textarea.bad { border-color: var(--danger); }
.textarea { resize: vertical; min-height: 110px; }
.select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 36px;
  background-image: linear-gradient(45deg, transparent 50%, var(--text-3) 50%), linear-gradient(135deg, var(--text-3) 50%, transparent 50%);
  background-position: calc(100% - 19px) 55%, calc(100% - 14px) 55%;
  background-size: 5px 5px;
  background-repeat: no-repeat;
}

.money-input { position: relative; }
.money-input .input { padding-right: 58px; font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.money-input .cur { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); color: var(--text-3); font-weight: 600; pointer-events: none; }
/* значок валюты — переключатель «$ ⇄ сом», когда курс известен */
.money-input.with-toggle .input { padding-right: 96px; }
.money-input .cur-toggle {
  right: 4px;
  height: 40px;
  min-width: 64px;
  padding: 0 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 15px;
  cursor: pointer;
  pointer-events: auto;
  touch-action: manipulation;
}
.money-input .cur-toggle .i { width: 15px; height: 15px; opacity: 0.7; }
@media (pointer: coarse) { .money-input .cur-toggle { height: var(--tap); right: 3px; } }

.check {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: var(--tap);
  cursor: pointer;
}
.check input { width: 20px; height: 20px; accent-color: var(--btn); flex: none; margin: 0; }

.switch {
  position: relative;
  width: 46px;
  height: 28px;
  flex: none;
}
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; z-index: 1; }
.switch span {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: var(--line-strong);
  transition: background-color 0.2s ease;
}
.switch span::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
  transition: transform 0.2s ease;
}
.switch input:checked + span { background: var(--good); }
.switch input:checked + span::after { transform: translateX(18px); }
.switch input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: 2px; }

.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
@media (max-width: 420px) {
  .grid3.collapse { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ---------- цифры ---------- */

.kpis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; container-type: inline-size; }
.kpi { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.kpi .k { font-size: 12.5px; color: var(--text-3); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi .v { font-size: clamp(16px, 6.3cqi, 20px); font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi .d { font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.kpi .v.small-v { font-size: 17px; }
.up-good { color: var(--good); }
.up-bad { color: var(--danger); }

.meter { height: 6px; border-radius: 3px; background: var(--surface-3); overflow: hidden; }
.meter > i { display: block; height: 100%; width: 0; border-radius: 3px; background: var(--text-2); transition: width 0.4s ease; }
.meter.good > i { background: var(--good); }
.meter.warn > i { background: var(--warn); }
.meter.danger > i { background: var(--danger); }

.spark { width: 100%; height: 44px; }
.spark .bar { fill: var(--chart-spend); }
.spark .bar.now { fill: var(--chart-spend-now); }
.spark .line { fill: none; stroke: var(--chart-leads); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.spark .pt { fill: var(--chart-leads); }
.chart { width: 100%; height: 180px; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .axis { fill: var(--text-3); font-size: 10px; font-family: var(--font); }
.chart .target { stroke: var(--good); stroke-width: 1.5; stroke-dasharray: 4 4; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--text-2); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.legend .l-spend { background: var(--chart-spend-now); }
.legend .l-leads { background: var(--chart-leads); border-radius: 50%; }
.legend .l-target { background: none; border-top: 2px dashed var(--good); border-radius: 0; height: 0; vertical-align: 3px; }

/* ---------- советы ---------- */

.advice { gap: 14px; }
.advice .top { display: flex; gap: 12px; align-items: flex-start; }
.advice .ico {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  flex: none;
}
.advice h3 { font-size: 16.5px; line-height: 1.3; font-weight: 700; }
.advice .why { color: var(--text-2); }
.advice .expect {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--surface-2);
  font-size: 14px;
}
.advice .expect .i { margin-top: 1px; color: var(--text-3); }
.moves { display: flex; flex-direction: column; gap: 6px; }
.move {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  min-width: 0;
}
.move .name { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-2); }
.move .from { color: var(--text-3); text-decoration: line-through; }
.move .to { font-weight: 700; }
.advice.done { opacity: 0.6; }
.advice .err { color: var(--danger); font-size: 14px; }

/* ---------- списки ---------- */

.list { display: flex; flex-direction: column; }
.list > .item + .item { border-top: 1px solid var(--line); }
.item { display: flex; gap: 12px; align-items: center; padding: 12px 0; min-width: 0; }
.item:first-child { padding-top: 2px; }
.item:last-child { padding-bottom: 2px; }

.notice {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 12px 14px;
  border-radius: 14px;
  font-size: 14px;
}
.notice .i { margin-top: 1px; }
.notice .grow { display: flex; flex-direction: column; gap: 8px; }
.notice.t-danger, .notice.t-warn, .notice.t-info, .notice.t-good { color: var(--text); }
.notice.t-danger .i { color: var(--danger); }
.notice.t-warn .i { color: var(--warn); }
.notice.t-info .i { color: var(--info); }
.notice.t-good .i { color: var(--good); }

/* ---------- реклама ---------- */

.camp-card { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 14px; align-items: start; }
.thumb {
  width: 64px;
  height: 84px;
  border-radius: 12px;
  object-fit: cover;
  background: var(--surface-3);
  border: 1px solid var(--line);
}
.thumb.big { width: 88px; height: 116px; }
.camp-card .body { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.camp-card h3 { font-size: 16px; font-weight: 700; line-height: 1.25; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.camp-card .stats { font-size: 13.5px; color: var(--text-2); }
.camp-card .note { font-size: 13.5px; color: var(--text-2); }
.camp-card .spark { height: 34px; }

/* ---------- журнал ---------- */

.day-label { font-size: 13px; font-weight: 700; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.04em; padding: 6px 2px 0; }
.entry { display: grid; grid-template-columns: 36px minmax(0, 1fr); gap: 12px; }
.entry .ico { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; background: var(--surface-3); color: var(--text-2); }
.entry .ico .i { width: 18px; height: 18px; }
.entry .main { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.entry .what { font-weight: 600; }
.entry .change { font-variant-numeric: tabular-nums; }
.entry .meta { font-size: 12.5px; color: var(--text-3); display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.entry.failed .what { color: var(--danger); }
.effect { font-size: 13.5px; padding: 8px 10px; border-radius: 10px; background: var(--surface-2); }

/* ---------- окна ---------- */

.backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: var(--backdrop);
  opacity: 0;
  transition: opacity 0.22s ease;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.backdrop.open { opacity: 1; }

.sheet {
  position: relative;
  width: 100%;
  max-height: calc(var(--vh, 1vh) * 100 - var(--safe-t) - 12px);
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-radius: 22px 22px 0 0;
  box-shadow: var(--shadow-lift);
  transform: translateY(100%);
  transition: transform 0.32s cubic-bezier(0.2, 0.9, 0.25, 1);
  overscroll-behavior: contain;
}
.backdrop.open .sheet { transform: none; }
.sheet .grab { width: 38px; height: 5px; border-radius: 3px; background: var(--line-strong); margin: 8px auto 0; flex: none; }
.sheet-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px 6px 20px;
  flex: none;
}
.sheet-head h2 { flex: 1 1 auto; min-width: 0; font-size: 19px; font-weight: 700; }
.sheet-body {
  flex: 1 1 auto;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 8px 20px calc(20px + var(--safe-b));
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.sheet.full { height: calc(var(--vh, 1vh) * 100 - var(--safe-t) - 12px); }

@media (min-width: 720px) {
  .backdrop { align-items: center; padding: 24px; }
  .sheet {
    max-width: 560px;
    border-radius: 22px;
    max-height: min(860px, calc(var(--vh, 1vh) * 100 - 48px));
    transform: translateY(16px) scale(0.98);
    opacity: 0;
    transition: transform 0.22s ease, opacity 0.22s ease;
  }
  .sheet.wide { max-width: 760px; }
  .sheet.full { height: auto; }
  .backdrop.open .sheet { opacity: 1; }
  .sheet .grab { display: none; }
  .sheet-head { padding-top: 16px; }
  .sheet-body { padding-bottom: 22px; }
}

.dialog-text { color: var(--text-2); }
.dialog-sum { font-size: 30px; font-weight: 800; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.dialog-som { font-size: 16px; font-weight: 600; color: var(--text-2); font-variant-numeric: tabular-nums; }

/* ---------- всплывашки ---------- */

.toasts {
  position: fixed;
  left: 0;
  right: 0;
  bottom: calc(var(--tab-h) + var(--safe-b) + 12px);
  z-index: 80;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 0 var(--gutter);
  pointer-events: none;
}
.no-tabs .toasts { bottom: calc(var(--safe-b) + 16px); }
.toast {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  max-width: 480px;
  min-height: 48px;
  padding: 8px 8px 8px 16px;
  border-radius: 14px;
  background: var(--btn);
  color: var(--on-btn);
  box-shadow: var(--shadow-lift);
  font-size: 14.5px;
  font-weight: 500;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.toast.in { opacity: 1; transform: none; }
.toast .msg { flex: 1 1 auto; min-width: 0; }
.toast .i { flex: none; }
.toast.t-danger .i { color: #ff8a8a; }
.toast.t-good .i { color: #63e0a0; }
.toast button {
  flex: none;
  min-height: 36px;
  padding: 0 12px;
  border: 0;
  border-radius: 10px;
  background: color-mix(in srgb, var(--on-btn) 16%, transparent);
  color: var(--on-btn);
  font-weight: 700;
  cursor: pointer;
}
@media (min-width: 960px) {
  .toasts { left: 232px; bottom: 24px; }
  .no-tabs .toasts { left: 0; }
}

/* ---------- заглушки и пустые состояния ---------- */

.skel {
  border-radius: 10px;
  background: linear-gradient(90deg, var(--surface-3) 0%, var(--surface-2) 50%, var(--surface-3) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.2s ease-in-out infinite;
}
.skel.line { height: 14px; }
.skel.block { height: 120px; border-radius: var(--r); }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 10px;
  padding: 28px 16px;
}
.empty .art {
  width: 64px;
  height: 64px;
  border-radius: 20px;
  display: grid;
  place-items: center;
  background: var(--good-soft);
  color: var(--good);
}
.empty .art .i { width: 30px; height: 30px; }
.empty h3 { font-size: 17px; }
.empty p { color: var(--text-2); max-width: 360px; }

.callout {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 10px 14px;
  border-radius: 14px;
  background: var(--info-soft);
  color: var(--text);
  font-size: 13.5px;
}
.callout .i { color: var(--info); }

/* ---------- сводка кабинета ---------- */

.acc-head { display: flex; align-items: center; gap: 10px; min-width: 0; }
.avatar {
  width: 34px;
  height: 34px;
  border-radius: 11px;
  flex: none;
  display: grid;
  place-items: center;
  background: var(--surface-3);
  color: var(--text-2);
  font-weight: 700;
  font-size: 15px;
  overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.acc-head h3 { font-size: 16px; font-weight: 700; }
.cap-line { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--text-2); }

/* ---------- вход ---------- */

.login {
  min-height: calc(var(--vh, 1vh) * 100);
  display: grid;
  place-items: center;
  padding: 24px var(--gutter) calc(24px + var(--safe-b));
}
.login .card { width: 100%; max-width: 380px; padding: 28px 24px; gap: 18px; }
.login .logo-big {
  width: 56px;
  height: 56px;
  border-radius: 17px;
  display: grid;
  place-items: center;
  background: var(--btn);
  color: var(--on-btn);
}
.login .logo-big .i { width: 28px; height: 28px; }
.login h1 { font-size: 26px; }
.form-error { color: var(--danger); font-size: 14px; min-height: 20px; }

/* ---------- мастер ---------- */

.steps { display: flex; gap: 6px; }
.steps i { flex: 1 1 0; height: 4px; border-radius: 2px; background: var(--surface-3); }
.steps i.on { background: var(--btn); }
.wizard-foot {
  position: sticky;
  bottom: calc(var(--tab-h) + var(--safe-b) + 8px);
  z-index: 5;
  display: flex;
  gap: 8px;
  padding: 10px;
  margin: 0 -10px;
  border-radius: 18px;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
}
.wizard-foot .btn-primary { flex: 1 1 auto; }
@media (min-width: 960px) { .wizard-foot { bottom: 12px; } }

.goal-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.choice {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  padding: 14px;
  border-radius: 16px;
  border: 1.5px solid var(--line-strong);
  background: var(--surface);
  cursor: pointer;
  text-align: left;
  min-width: 0;
  touch-action: manipulation;
}
.choice .i { width: 24px; height: 24px; }
.choice b { font-size: 15px; }
.choice small { color: var(--text-2); font-size: 12.5px; line-height: 1.35; }
.choice[aria-pressed="true"] { border-color: var(--btn); box-shadow: 0 0 0 1px var(--btn); }
.choice[disabled] { opacity: 0.45; cursor: not-allowed; }
.acc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 210px), 1fr)); gap: 10px; }
.choice.acc-choice { flex-direction: row; align-items: center; gap: 12px; padding: 12px 14px; }
.acc-choice .grow { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.acc-choice .avatar { width: 40px; height: 40px; border-radius: 13px; }

.drop {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 190px;
  padding: 24px;
  border-radius: var(--r);
  border: 2px dashed var(--line-strong);
  background: var(--surface);
  text-align: center;
  cursor: pointer;
  position: relative;
}
.drop.over { border-color: var(--focus); background: var(--select); }
.drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.drop .i { width: 32px; height: 32px; color: var(--text-3); }

.progress { height: 8px; border-radius: 4px; background: var(--surface-3); overflow: hidden; }
.progress > i { display: block; height: 100%; width: 0; background: var(--btn); border-radius: 4px; transition: width 0.3s ease; }

.frames { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 6px; }
.frames.few { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.frame {
  position: relative;
  aspect-ratio: 9 / 16;
  border-radius: 10px;
  overflow: hidden;
  border: 2px solid transparent;
  background: var(--surface-3);
  padding: 0;
  cursor: pointer;
}
.frame img { width: 100%; height: 100%; object-fit: cover; }
.frame[aria-pressed="true"] { border-color: var(--btn); }
/* выбранный кадр: галочка в кружке — помещается даже в узкую миниатюру */
.frame[aria-pressed="true"]::after {
  content: "";
  position: absolute;
  right: 5px;
  bottom: 5px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--btn);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
}
.frame[aria-pressed="true"]::before {
  content: "";
  position: absolute;
  z-index: 1;
  right: 12.5px;
  bottom: 11px;
  width: 5px;
  height: 9px;
  border: solid var(--on-btn);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.frames.wide .frame { aspect-ratio: 16 / 9; }
.frames.square .frame { aspect-ratio: 1; }

.variant { gap: 10px; cursor: pointer; border-width: 1.5px; }
.variant[aria-pressed="true"] { border-color: var(--btn); box-shadow: 0 0 0 1px var(--btn); }
.variant .textarea { min-height: 150px; }

.suggest { position: relative; }
.suggest-list {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 20;
  max-height: 280px;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  box-shadow: var(--shadow-lift);
  padding: 6px;
}
.suggest-list button {
  width: 100%;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  min-height: var(--tap);
  border: 0;
  border-radius: 10px;
  background: transparent;
  text-align: left;
  cursor: pointer;
}
.suggest-list button small { color: var(--text-3); white-space: nowrap; }
@media (hover: hover) { .suggest-list button:hover { background: var(--surface-2); } }

.picked { display: flex; flex-wrap: wrap; gap: 8px; }
.picked .chip { cursor: default; background: var(--surface-2); color: var(--text); border-color: var(--line); }
.picked .chip button { border: 0; background: none; padding: 0; margin: 0 -6px 0 0; display: grid; place-items: center; width: 28px; height: 28px; cursor: pointer; color: var(--text-3); }
.picked .chip select { border: 0; background: transparent; font-weight: 600; color: var(--text-2); font-size: 14px; padding: 0 2px; }

/* превью объявления в стиле Instagram */
.phone {
  width: 100%;
  max-width: 300px;
  margin: 0 auto;
  border-radius: 28px;
  border: 8px solid #0b0c0e;
  background: #000;
  overflow: hidden;
  box-shadow: var(--shadow-lift);
  color: #fff;
}
.phone .scr { position: relative; aspect-ratio: 9 / 16; background: #111; }
.phone .scr img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.phone .scr .shade { position: absolute; inset: 0; background: linear-gradient(180deg, rgba(0, 0, 0, 0.35) 0%, transparent 22%, transparent 55%, rgba(0, 0, 0, 0.72) 100%); }
.phone .who { position: absolute; top: 14px; left: 12px; right: 12px; display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; }
.phone .who .av { width: 28px; height: 28px; border-radius: 50%; background: linear-gradient(135deg, #f58529, #dd2a7b, #8134af); border: 2px solid #fff; overflow: hidden; }
.phone .who .av img { position: static; width: 100%; height: 100%; object-fit: cover; }
.phone .who small { display: block; font-weight: 400; opacity: 0.85; font-size: 11px; }
.phone .cap { position: absolute; left: 12px; right: 12px; bottom: 60px; font-size: 12.5px; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4); }
.phone .cta {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 14px;
  height: 36px;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.95);
  color: #111;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  font-size: 13px;
  font-weight: 700;
}

.summary-list { display: flex; flex-direction: column; }
.summary-list > div { display: flex; justify-content: space-between; gap: 16px; padding: 10px 0; border-top: 1px solid var(--line); font-size: 14.5px; }
.summary-list > div:first-child { border-top: 0; }
.summary-list dt { color: var(--text-2); flex: none; }
.summary-list dd { margin: 0; text-align: right; font-weight: 600; min-width: 0; overflow-wrap: anywhere; }

.launch-steps { display: flex; flex-direction: column; gap: 10px; }
.launch-steps .st { display: flex; align-items: center; gap: 10px; color: var(--text-3); font-size: 14.5px; }
.launch-steps .st.done { color: var(--text); }
.launch-steps .st.now { color: var(--text); font-weight: 600; }
.launch-steps .st .mark { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; border: 2px solid var(--line-strong); flex: none; }
.launch-steps .st.done .mark { background: var(--good); border-color: var(--good); color: #fff; }
.launch-steps .st.now .mark { border-color: var(--btn); border-top-color: transparent; animation: spin 0.8s linear infinite; }
.launch-steps .st .mark .i { width: 13px; height: 13px; stroke-width: 3; }

.success-art {
  width: 72px;
  height: 72px;
  border-radius: 24px;
  display: grid;
  place-items: center;
  background: var(--good-soft);
  color: var(--good);
  margin: 0 auto;
}
.success-art .i { width: 34px; height: 34px; stroke-width: 2.4; }

.ideas { display: flex; flex-direction: column; gap: 10px; }
.idea ol { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 6px; color: var(--text-2); font-size: 14px; }
.idea ol b { color: var(--text); font-weight: 600; }

/* ---------- настройки ---------- */

.set-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 44px; }
.set-row .grow { display: flex; flex-direction: column; gap: 2px; }
.set-row .t { font-weight: 600; }
.set-row .d { font-size: 13px; color: var(--text-2); }
details.more { border-top: 1px solid var(--line); padding-top: 10px; }
details.more summary { cursor: pointer; color: var(--text-2); font-weight: 600; font-size: 14px; list-style: none; display: flex; align-items: center; gap: 6px; min-height: 36px; }
details.more summary::-webkit-details-marker { display: none; }
details.more[open] summary .i { transform: rotate(180deg); }
details.more .stack { padding-top: 10px; }
/* свёрнутый блок-карточка: строка по центру, без лишнего низа */
details.more.card { display: block; padding: 6px 16px; }
details.more.card[open] { padding-bottom: 16px; }

/* ---------- мелочи мастера ---------- */

.pre { white-space: pre-line; overflow-wrap: anywhere; }
.textarea.tall { min-height: 170px; }
.tips { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 4px; color: var(--text-2); font-size: 14px; }
.review { display: grid; gap: 18px; }
@media (min-width: 720px) { .review { grid-template-columns: 300px minmax(0, 1fr); align-items: start; } }
.link-btn { border: 0; background: none; padding: 0; color: var(--link); font: inherit; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.file-btn { position: relative; overflow: hidden; }
.file-btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; font-size: 0; }
.suggest-list .pad { padding: 10px 12px; }
.chips.wrap { flex-wrap: wrap; overflow: visible; margin: 0; padding: 2px 0; }
.idea h3 { font-size: 16px; }

.center-row { justify-content: center; }
.acc-row { display: flex; align-items: center; gap: 12px; min-height: 52px; }
.acc-open { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; min-width: 0; padding: 4px 0; border: 0; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.acc-open:disabled { cursor: default; }
.acc-open .t { font-weight: 600; max-width: 100%; }
.acc-open .d { font-size: 13px; color: var(--text-2); max-width: 100%; }
.acc-open .d.up-bad { color: var(--danger); white-space: normal; }
@media (max-width: 520px) { .grid2.collapse-phone { grid-template-columns: minmax(0, 1fr); } }
/* кнопки в две колонки: поуже поля, нечётная последняя — во всю ширину */
.grid2 > .btn { min-width: 0; padding-inline: 12px; }
.grid2 > :last-child:nth-child(odd) { grid-column: 1 / -1; }

/* ---------- меню: на телефоне журнал и настройки — в «Ещё» ---------- */

.tab-more .i { stroke-width: 3.4; }
@media (max-width: 959px) { .tab-side { display: none; } }
@media (min-width: 960px) { .tab-more { display: none; } }
.more-row { flex-direction: row; align-items: center; gap: 14px; color: inherit; }
.more-row .grow { display: flex; flex-direction: column; gap: 2px; }
.more-ic { flex: none; width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; background: var(--surface-3); }

/* ---------- аналитика ---------- */

.screen.is-loading .tiles, .screen.is-loading .card, .screen.is-loading .section { opacity: 0.55; transition: opacity 0.2s ease; }
.h-card { font-size: 16.5px; font-weight: 700; }
.h-sub { font-size: 14.5px; font-weight: 700; }
.pad-s { padding: 8px 2px 0; }
.t-text-good { color: var(--good); }
.t-text-warn { color: var(--warn); }
.t-text-danger { color: var(--danger); }
.t-text-info { color: var(--info); }
.chip-s { height: 32px; padding: 0 12px; font-size: 13.5px; }
@media (pointer: coarse) { .chip-s { height: 38px; } }
.select-s { width: auto; min-height: 36px; padding-block: 6px; }
@media (pointer: fine) { .select-s { font-size: 14px; } }

.an-controls { display: flex; flex-direction: column; gap: 10px; }
.an-scope { display: flex; gap: 8px; align-items: center; }
.an-scope .field { min-width: 0; }
/* цель кампаний: переписки, заявки, переходы — рядом сумма, которую на неё потратили */
.an-goals { display: flex; flex-direction: column; gap: 4px; }
.chip-n { opacity: 0.72; font-weight: 500; }

/* плитки сводки: 2 в ряд на телефоне, 4 на широком */
.tiles-head { min-height: 36px; }
.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
@media (min-width: 720px) { .tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; } }
.tile {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  min-width: 0;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow);
  color: var(--text);
  font: inherit;
  text-align: left;
}
button.tile { cursor: pointer; touch-action: manipulation; transition: box-shadow 0.15s ease; }
button.tile[aria-pressed="true"] { box-shadow: inset 0 0 0 1.5px var(--btn), var(--shadow); border-color: transparent; }
@media (hover: hover) { button.tile:hover { box-shadow: var(--shadow-lift); } }
.tile-label { max-width: 100%; font-size: 12.5px; font-weight: 600; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile-value { max-width: 100%; font-size: 22px; font-weight: 750; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 380px) { .tile-value { font-size: 19px; } }
.tile-foot { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; font-size: 12.5px; }
.tile-som { font-size: 12px; }
.tile-target { font-weight: 600; color: var(--text-3); }
.tile-target.good { color: var(--good); }
.tile-target.bad { color: var(--danger); }
.delta { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.delta.good { color: var(--good); }
.delta.bad { color: var(--danger); }
.delta.flat { color: var(--text-3); }

/* график по дням */
.dchart-host { position: relative; min-height: 210px; }
.dchart { display: block; width: 100%; height: auto; overflow: visible; touch-action: pan-y; user-select: none; -webkit-user-select: none; }
.dchart .grid { stroke: var(--line); stroke-width: 1; }
.dchart .grid.soft { stroke-dasharray: 2 4; }
.dchart .axis { fill: var(--text-3); font-size: 11px; font-family: var(--font); font-variant-numeric: tabular-nums; }
.dchart .bar { fill: var(--chart-spend-now); }
.dchart .bar.partial { fill: var(--chart-spend); }
.dchart .area { fill: var(--chart-leads); opacity: 0.09; }
.dchart .line { fill: none; stroke: var(--chart-leads); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.dchart .dot { fill: var(--surface); stroke: var(--chart-leads); stroke-width: 1.8; }
.dchart .prev { fill: none; stroke: var(--text-3); stroke-width: 1.6; stroke-dasharray: 4 4; stroke-linecap: round; stroke-linejoin: round; }
.dchart .target { stroke: var(--good); stroke-width: 1.5; stroke-dasharray: 6 5; }
.dchart .target-label { fill: var(--good); font-weight: 600; }
.dchart .mark { stroke: var(--surface); stroke-width: 1.5; }
.dchart .mark.journal { fill: var(--info); }
.dchart .mark.note { fill: var(--warn); }
.dchart .guide { stroke: var(--text-3); stroke-width: 1; stroke-dasharray: 2 3; }
.dtip {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 2;
  max-width: min(280px, 100%);
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  box-shadow: var(--shadow-lift);
  font-size: 12.5px;
  pointer-events: none;
}
.dtip[hidden] { display: none; }
.dtip .v { font-size: 16px; font-weight: 750; font-variant-numeric: tabular-nums; }
.dtip .p { color: var(--text-2); }
.dtip .m { display: flex; gap: 6px; align-items: baseline; color: var(--text-2); }
.dtip .m::before, .marks li::before { content: ""; flex: none; width: 7px; height: 7px; border-radius: 50%; background: var(--info); transform: translateY(-1px); }
.dtip .m.note::before, .marks li.note::before { background: var(--warn); }
.lg { display: inline-flex; align-items: center; gap: 6px; }
.lg::before { content: ""; width: 14px; border-top: 2.5px solid var(--chart-leads); border-radius: 2px; }
.lg.cur.bar::before { width: 10px; height: 10px; border: 0; border-radius: 3px; background: var(--chart-spend-now); }
.lg.prev::before { border-top: 2px dashed var(--text-3); }
.lg.s::before, .lg.r::before { width: 12px; height: 5px; border: 0; border-radius: 3px; background: var(--chart-spend-now); }
.lg.r::before { background: var(--chart-leads); }
.lg.target::before { border-top: 2px dashed var(--good); }
.lg.mk::before { width: 8px; height: 8px; border: 0; border-radius: 50%; background: var(--info); }
.marks summary { display: flex; align-items: center; gap: 8px; min-height: 36px; cursor: pointer; list-style: none; font-size: 14px; font-weight: 600; color: var(--text-2); }
.marks summary::-webkit-details-marker { display: none; }
.marks ul { list-style: none; margin: 4px 0 0; padding: 0; display: flex; flex-direction: column; }
.marks li { display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 4px 0; border-top: 1px solid var(--line); font-size: 14px; }

/* что видно в цифрах */
.finds { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.find { display: flex; gap: 10px; align-items: flex-start; font-size: 14.5px; line-height: 1.45; }
.find-ic { flex: none; width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; font-weight: 800; }
.find.good .find-ic { background: var(--good-soft); color: var(--good); }
.find.bad .find-ic { background: var(--danger-soft); color: var(--danger); }
.find .tag { height: 20px; font-size: 11.5px; vertical-align: 1px; }

/* воронка, ролики, план — три карточки, на телефоне друг под другом */
.an-trio { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); align-items: start; }
.f-step { display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
.f-bar { height: 10px; border-radius: 5px; }
.f-bar > i { background: var(--chart-leads); border-radius: 5px; }
.f-rate { margin: -6px 0 -4px 2px; }
.ret { display: flex; flex-direction: column; gap: 8px; }
.ret-row { display: grid; grid-template-columns: 96px minmax(0, 1fr) 34px; gap: 10px; align-items: center; }
.ret-row b { text-align: right; }
.ret .meter > i { background: var(--chart-leads); }
.plan-row { display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
.plan .meter { height: 8px; border-radius: 4px; }

/* кто и где: доли трат и результатов, цена против средней */
.segs { display: flex; flex-direction: column; }
.segs + .heat-wrap, .heat-wrap + .segs, .segs + .segs { margin-top: 18px; }
.segs .h-sub { margin-bottom: 6px; }
.segs-legend { display: flex; gap: 14px; margin-bottom: 6px; }
.segs-head, .seg-row { display: grid; grid-template-columns: minmax(0, 1fr) 64px 46px 66px; gap: 8px; align-items: center; }
.segs-head > :last-child, .seg-row > :last-child { display: none; }
@media (min-width: 560px) {
  .segs-head, .seg-row { grid-template-columns: minmax(0, 2fr) repeat(4, minmax(0, 1fr)); gap: 12px; }
  .segs-head > :last-child, .seg-row > :last-child { display: block; }
}
.segs-head { padding-bottom: 6px; border-bottom: 1px solid var(--line); }
.segs-head > :not(:first-child), .seg-row > .num { text-align: right; }
.seg-row { padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.seg-row:last-child { border-bottom: 0; }
.seg-name { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.seg-name > span { overflow-wrap: anywhere; white-space: normal; }
.share { height: 4px; border-radius: 2px; background: var(--surface-3); overflow: hidden; }
.share > i { display: block; height: 100%; border-radius: 2px; background: var(--chart-spend-now); }
.share > i.r { background: var(--chart-leads); }
.cpr.good { color: var(--good); font-weight: 700; }
.cpr.bad { color: var(--danger); font-weight: 700; }

/* тепловые карты: прозрачность клетки — из данных, через --a */
.heat-wrap { display: flex; flex-direction: column; gap: 10px; margin-top: 4px; }
.heat { width: calc(100% + 8px); margin: 0 -4px; border-collapse: separate; border-spacing: 4px; table-layout: fixed; font-size: 13px; }
.heat th { padding: 0 4px; font-size: 12.5px; font-weight: 600; color: var(--text-2); text-align: left; white-space: nowrap; }
.heat thead th { text-align: center; }
.heat tbody th { width: 76px; }
.heat td { position: relative; height: 50px; border-radius: 10px; background: var(--surface-2); text-align: center; isolation: isolate; cursor: default; }
.heat td::before { content: ""; position: absolute; inset: 0; z-index: -1; border-radius: inherit; background: var(--chart-leads); opacity: var(--a, 0); }
.heat td b { display: block; font-size: 15px; }
.heat td span { display: block; font-size: 11.5px; color: var(--text-2); }
.heat td.hot { color: var(--on-btn); }
.heat td.hot span { color: inherit; opacity: 0.85; }
.hw { display: grid; grid-template-columns: 24px repeat(24, minmax(0, 1fr)); gap: 2px; align-items: center; }
.hw-cell { position: relative; display: block; aspect-ratio: 1; border-radius: 3px; background: var(--surface-3); }
.hw-cell::before { content: ""; position: absolute; inset: 0; border-radius: inherit; background: var(--chart-leads); opacity: var(--a, 0); }
@media (min-width: 720px) { .hw-cell { aspect-ratio: auto; height: 24px; } }
.hw-day { font-size: 11px; }
.hw-h { font-size: 10px; font-variant-numeric: tabular-nums; }

/* креативы */
.cre-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.cre.off { opacity: 0.8; }
.cre-top { display: flex; gap: 12px; align-items: flex-start; }
.cre-thumb { flex: none; width: 64px; height: 64px; border-radius: 12px; object-fit: cover; background: var(--surface-3); }
.empty-thumb { display: grid; place-items: center; color: var(--text-3); }
.cre-sort { flex: none; }
.cre-name { font-size: 15px; font-weight: 700; line-height: 1.3; overflow-wrap: anywhere; }
.cre-tags { gap: 6px; margin-top: 6px; }
.cre-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px 8px; }
.cre-stats > div { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.cre-stats span { font-size: 12px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cre-stats b { font-size: 15px; white-space: nowrap; }
.cre-trend { display: flex; align-items: center; gap: 10px; min-height: 30px; }
.trend { flex: none; width: 120px; height: 30px; }
.trend path { fill: none; stroke: var(--chart-leads); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* таблица: первая колонка прилипает при прокрутке вбок */
.table-tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.table-tools .search { flex: 1 1 200px; }
.table-wrap { overflow-x: auto; margin: 0 -16px; padding: 0 16px; overscroll-behavior-x: contain; }
.grid-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 14px; }
.grid-table th, .grid-table td { padding: 10px; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.grid-table thead th { padding-top: 2px; padding-bottom: 6px; font-size: 12.5px; font-weight: 600; color: var(--text-3); }
.grid-table thead button { padding: 4px 0; border: 0; background: none; color: inherit; font: inherit; white-space: nowrap; cursor: pointer; }
.grid-table thead th:not([aria-sort="none"]) button { color: var(--text); }
.grid-table th:first-child { position: sticky; left: 0; z-index: 1; background: var(--surface); text-align: left; }
.grid-table tbody th { min-width: 150px; max-width: 260px; font-weight: 600; white-space: normal; }
@media (min-width: 720px) { .grid-table tbody th { min-width: 210px; } }
.t-row { display: flex; align-items: flex-start; gap: 8px; }
.t-name { display: flex; flex-direction: column; gap: 1px; min-width: 0; overflow-wrap: anywhere; }
.dot-s { flex: none; width: 7px; height: 7px; margin-top: calc(0.7em - 3.5px); border-radius: 50%; background: var(--line-strong); }
.dot-s.on { background: var(--good); }
.grid-table tr[data-drill] { cursor: pointer; }
@media (hover: hover) { .grid-table tr[data-drill]:hover > * { background: var(--surface-2); } }
.grid-table tfoot th, .grid-table tfoot td { border-top: 1px solid var(--line-strong); border-bottom: 0; font-weight: 700; }
.export-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.export-list .btn { justify-content: flex-start; min-width: 0; padding-inline: 12px; }
.check-list { display: flex; flex-direction: column; }
.check-list .check { padding: 6px 0; border-bottom: 1px solid var(--line); }
.check-list .check > span { display: flex; flex-direction: column; gap: 1px; }

/* ---------- подсказки «?» ---------- */

.qm {
  position: relative;
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 18px;
  height: 18px;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: var(--surface);
  color: var(--text-3);
  font: 700 11px/1 var(--font);
  letter-spacing: 0;
  vertical-align: middle;
  cursor: pointer;
  touch-action: manipulation;
  transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease;
}
/* палец попадает, даже если кружок маленький */
.qm::after { content: ""; position: absolute; inset: -8px; border-radius: 50%; }
@media (pointer: coarse) { .qm::after { inset: -12px; } }
.qm.on { background: var(--btn); border-color: var(--btn); color: var(--on-btn); }
/* наведение — только у мыши: после касания палец «висит» над кружком, и он оставался бы тёмным */
@media (hover: hover) { .qm:hover { background: var(--btn); border-color: var(--btn); color: var(--on-btn); } }
.qm:focus-visible { border-radius: 50%; }
.qm-s { width: 16px; height: 16px; font-size: 10px; }

/* плитка с кружком: кружок — сосед плитки-кнопки, а не её часть (кнопка в кнопке недопустима) */
.tile-box { position: relative; min-width: 0; display: grid; }
.tile-box > .tile { min-width: 0; }
.tile-box > .tile .tile-label { padding-right: 22px; }
.tile-q { position: absolute; top: 11px; right: 11px; }

/* переключатель с кружком справа */
.seg-line { display: flex; align-items: center; gap: 10px; min-width: 0; }
.seg-line > .seg { flex: 1; min-width: 0; }

/* заголовок с кружком: «?» сразу за словом, а не у правого края */
.qt { display: inline-flex; align-items: center; gap: 8px; min-width: 0; }
.qt > :first-child { min-width: 0; }
/* подпись показателя с кружком: текст режется многоточием, кружок остаётся */
.kpi .k.qk { display: flex; align-items: center; gap: 5px; overflow: visible; }
.qk > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* поле с кружком: подпись — отдельной строкой над полем, кружок — не внутри <label> */
.field-head { display: flex; align-items: center; gap: 6px; min-width: 0; }
.field-head > label { font-size: 13px; font-weight: 600; color: var(--text-2); }

.qpop {
  position: fixed;
  z-index: 90;
  width: min(340px, calc(100vw - 24px));
  max-height: calc(var(--vh, 1vh) * 100 - 24px);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 13px 42px 14px 15px;
  border-radius: 14px;
  background: var(--tip-bg);
  color: var(--tip-text);
  box-shadow: 0 0 0 1px var(--tip-edge), var(--shadow-lift);
  font-size: 13.5px;
  line-height: 1.5;
  animation: qpop-in 0.14s ease-out;
}
.qpop:focus { outline: none; }
.qpop-title { margin-bottom: 4px; font-weight: 700; color: var(--tip-strong); }
.qpop-text b { color: var(--tip-strong); font-weight: 650; }
.qpop-more { display: inline-block; margin-top: 8px; color: var(--tip-link); font-weight: 600; }
.qpop-x {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 9px;
  background: none;
  color: var(--tip-muted);
  cursor: pointer;
}
@media (hover: hover) { .qpop-x:hover { background: rgba(255, 255, 255, 0.1); color: var(--tip-strong); } }
/* телефон: пояснение снизу, как окно, над затемнением */
.qpop.dock {
  top: auto;
  left: 12px;
  right: 12px;
  bottom: calc(12px + var(--safe-b));
  width: auto;
  max-height: calc(var(--vh, 1vh) * 72);
  padding: 16px 48px 18px 18px;
  border-radius: 18px;
  font-size: 14.5px;
  animation: qpop-rise 0.18s ease-out;
}
.qpop.dock .qpop-x { top: 8px; right: 8px; width: 40px; height: 40px; }
.qback { position: fixed; inset: 0; z-index: 89; background: var(--backdrop); animation: qfade 0.14s ease-out; }
@keyframes qpop-in { from { opacity: 0; transform: translateY(-4px); } }
@keyframes qpop-rise { from { opacity: 0; transform: translateY(14px); } }
@keyframes qfade { from { opacity: 0; } }

/* справка по разделу и первое знакомство */
.help-lines, .help-steps { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 9px; line-height: 1.5; }
.help-lines li::marker { color: var(--text-3); }
.help-steps li::marker { font-weight: 700; color: var(--text-2); }

/* ---------- инструкция ---------- */

.guide-toc { display: flex; flex-wrap: wrap; gap: 8px; }
.guide-toc .chip .i { color: var(--text-3); }
.guide-sec { scroll-margin-top: 12px; }
.guide-sec:focus { outline: none; }
/* длинная заметка: значок у первой строки, а не посередине */
.callout.top { align-items: flex-start; line-height: 1.5; }
.callout.top > .i { flex: none; margin-top: 1px; }
.guide-sec h2 { display: flex; align-items: center; gap: 10px; font-size: 20px; line-height: 1.25; }
.guide-sec h2 .g-ic { display: grid; place-items: center; width: 34px; height: 34px; flex: none; border-radius: 10px; background: var(--surface-3); color: var(--text-2); }
.guide-sec h3 { margin-top: 4px; font-size: 16px; }
.guide-sec p, .guide-sec li { line-height: 1.55; }
.guide-sec b { font-weight: 650; }
.g-list { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 8px; }
.g-list li::marker { color: var(--text-3); }
.g-steps { margin: 0; padding: 0; list-style: none; counter-reset: g; display: flex; flex-direction: column; gap: 12px; }
.g-steps > li { counter-increment: g; position: relative; min-height: 26px; padding-left: 38px; }
.g-steps > li::before {
  content: counter(g);
  position: absolute;
  left: 0;
  top: -1px;
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--btn);
  color: var(--on-btn);
  font-size: 13px;
  font-weight: 700;
}
.g-faq { display: flex; flex-direction: column; }
.g-faq details { border-top: 1px solid var(--line); }
.g-faq details:first-child { border-top: 0; }
.g-faq summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: var(--tap); padding: 8px 0; font-weight: 600; cursor: pointer; list-style: none; }
.g-faq summary::-webkit-details-marker { display: none; }
.g-faq summary .i { flex: none; color: var(--text-3); transition: transform 0.15s ease; }
.g-faq details[open] summary .i { transform: rotate(180deg); }
.g-faq details p { padding: 0 0 14px; color: var(--text-2); }
.g-top { align-self: flex-start; }

/* «Подключить кабинеты»: крупные шаги 1–2–3, внутри — мелкие действия в Мете */
.cn { gap: 14px; }
.cn-step { display: flex; align-items: center; gap: 12px; }
.cn-step h2 { font-size: 18px; line-height: 1.3; }
.cn-num { display: grid; place-items: center; flex: none; width: 34px; height: 34px; border-radius: 50%; background: var(--btn); color: var(--on-btn); font-weight: 700; }
.cn .g-steps > li::before { background: var(--surface-3); color: var(--text); }
.cn-id { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 14px; background: var(--surface-2); }
.cn-id .grow { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.cn-code { font-size: 22px; letter-spacing: 0.03em; overflow-wrap: anywhere; user-select: all; -webkit-user-select: all; }
.cn-groups { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 4px; }
.cn-groups li { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2px 12px; }
.cn-clip { position: fixed; top: 0; left: 0; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.cn-block { gap: 10px; }
.cn-sub { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 12px; }
.cn-sub h3 { font-size: 15.5px; font-weight: 700; }
/* «Ваши портфолио»: имя и что подключено, отметка, «Открыть в Мете» */
.cn-pfs { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; border: 1px solid var(--line-strong); border-radius: 14px; }
.cn-pf { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 8px 12px; padding: 12px 14px; border-top: 1px solid var(--line); }
.cn-pf:first-child { border-top: 0; }
.cn-pf-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.cn-pf-main b { overflow-wrap: anywhere; }
.cn-pf-act { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
@media (min-width: 760px) {
  .cn-pf { grid-template-columns: minmax(0, 1fr) auto auto; }
  .cn-pf-act { grid-column: auto; }
}
/* под строкой тихая кнопка встаёт значком по краю названия, а не отступом внутрь */
@media (max-width: 759px) {
  .cn-pf-act .btn-quiet:first-child { margin-left: -12px; }
}
/* в Мету из списка идут с телефона — кнопки под палец */
@media (pointer: coarse) {
  .cn-pf .btn-sm { min-height: 44px; }
  .cn-pf .btn-icon.btn-sm { width: 44px; }
}
/* кнопки Меты в шагах — такими, какими их видно в самой Мете */
.m-btn, .m-item { padding: 2px 8px; border-radius: 6px; font-weight: 600; font-size: 0.94em; -webkit-box-decoration-break: clone; box-decoration-break: clone; }
.m-btn { background: #0866ff; color: #fff; white-space: nowrap; }
.m-item { background: var(--surface); border: 1px solid var(--line-strong); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06); }
.g-steps > li:has(.m-btn, .m-item) { line-height: 1.9; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
