/* Стиль сайта VinCarGroup (05.09): холодный бетон, чёрная шапка, синий акцент,
   шрифты Spectral (заголовки) + Onest (текст). Палитра одна при любой теме.
   Панель дизайна (design.js) может крутить эти переменные. */
@import url('https://fonts.googleapis.com/css2?family=Spectral:wght@400;500;600&family=Onest:wght@400;500;600;700&display=swap');
:root {
  --paper: #e0e3e5; --paper-raised: #eaedef; --surface: rgba(255,255,255,.6);
  --ink: #0d1116; --ink-soft: #54616b; --ink-faint: #8a95a1;
  --blue: #116bc6; --blue-bright: #2789e5;
  --bg: #e0e3e5;
  --panel: rgba(255,255,255,.62);
  --panel-2: rgba(255,255,255,.78);
  --line: rgba(13,17,22,.16);
  --line-strong: rgba(13,17,22,.4);
  --text: var(--ink);
  --muted: var(--ink-soft);
  --accent: #116bc6;
  --accent-dim: rgba(39,137,229,.14);
  --danger: #a8462b;
  --warn: #96702c;
  --th-bg: #0b0e12;
  --th-fg: #ffffff;
  --zebra: rgba(255,255,255,.42);
  --radius: 12px;
  --shadow: 0 1px 2px rgba(13,17,22,.06);
  --serif: "Spectral", Georgia, "Times New Roman", serif;
  --sans: "Onest", "Helvetica Neue", Arial, sans-serif;
}
@media (prefers-color-scheme: dark) { :root { color-scheme: light; } }

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: #e0e3e5 url("/beton-b5.png") top center / cover fixed; color: var(--text);
  font: 15px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
  padding-bottom: env(safe-area-inset-bottom);
}
.loading { padding: 60px; text-align: center; color: var(--muted); }

/* ── Вход ───────────────────────────────────────────────────────────────── */
.auth-wrap { min-height: 100dvh; display: grid; place-items: center; padding: 24px; }
.auth {
  width: 100%; max-width: 380px; background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 28px; box-shadow: var(--shadow);
}
.auth h1 { margin: 0 0 4px; font-size: 22px; }
.auth p.sub { margin: 0 0 20px; color: var(--muted); font-size: 14px; }

/* ── Каркас ─────────────────────────────────────────────────────────────── */
header.top {
  position: sticky; top: 0; z-index: 20; background: rgba(0,0,0,.9);
  backdrop-filter: blur(12px); border-bottom: 1px solid rgba(255,255,255,.08);
}
.top-inner { max-width: 1600px; margin: 0 auto; padding: 12px 16px; display: flex; align-items: center; gap: 12px; }
.brand { font-weight: 600; letter-spacing: .02em; margin-right: auto; display: flex; align-items: center; gap: 10px; color: #fff; }
.brand::before { content: ""; width: 40px; height: 34px; background: url("/vcg-logo.png") left center / contain no-repeat; filter: brightness(0) invert(.9); }
.brand small { color: rgba(255,255,255,.6); font-weight: 400; }
nav.tabs { display: flex; align-items: center; gap: 4px; overflow-x: auto; max-width: 1600px; margin: 0 auto;
  padding: 10px 12px; scrollbar-width: none; background: rgba(0,0,0,.9); }
nav.tabs::-webkit-scrollbar { display: none; }
.tabs-spacer { margin-left: auto; }
nav.tabs button {
  border: 1px solid transparent; background: transparent; color: rgba(255,255,255,.72);
  padding: 7px 13px; border-radius: 999px; cursor: pointer; font: inherit; white-space: nowrap;
}
nav.tabs button:hover { color: #fff; }
nav.tabs button.on { background: rgba(255,255,255,.1); border-color: rgba(39,137,229,.5); color: #fff; font-weight: 600; }

main { max-width: 1600px; margin: 0 auto; padding: 18px 16px 80px; }
section { display: none; }
section.on { display: block; animation: fade .18s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(3px); } }

h2 { font-family: var(--serif); font-weight: 500; font-size: 22px; margin: 26px 0 12px; letter-spacing: -.01em; }
h2:first-child { margin-top: 4px; }
.kpi .value { font-family: var(--serif); }

/* ── Карточки-числа ─────────────────────────────────────────────────────── */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; }
.kpi {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 18px; box-shadow: var(--shadow);
}
.kpi .label { color: var(--muted); font-size: 12.5px; text-transform: uppercase; letter-spacing: .04em; }
.kpi .value { font-size: 27px; font-weight: 640; margin-top: 6px; letter-spacing: -.5px; font-variant-numeric: tabular-nums; }
.kpi .hint { color: var(--muted); font-size: 12.5px; margin-top: 4px; }
.pos { color: var(--accent); } .neg { color: var(--danger); } .warn { color: var(--warn); }

/* ── Панели и таблицы ───────────────────────────────────────────────────── */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden; }
.panel .head { padding: 14px 18px; border-bottom: 1px solid var(--line); display: flex;
  align-items: center; gap: 10px; flex-wrap: wrap; }
.panel .head h3 { margin: 0; font-size: 15px; }
.panel .head .sp { margin-left: auto; }
.scroll-x { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums;
  border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em;
  color: var(--th-fg); background: var(--th-bg); font-weight: 700; padding: 9px 14px;
  border-bottom: 1px solid var(--th-bg); white-space: nowrap; }
td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
tbody tr:nth-child(even) { background: var(--zebra); }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; white-space: nowrap; }
tbody tr:hover { background: color-mix(in oklab, var(--accent) 8%, var(--surface)); }
.note { color: var(--muted); font-size: 13px; max-width: 460px; }
.empty { padding: 28px; text-align: center; color: var(--muted); }

/* ── Формы ──────────────────────────────────────────────────────────────── */
label { display: block; font-size: 12.5px; color: var(--muted); margin: 12px 0 5px; }
input, select, textarea {
  width: 100%; background: var(--panel-2); color: var(--text); border: 1px solid var(--line);
  border-radius: 10px; padding: 10px 12px; font: inherit; outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
textarea { min-height: 64px; resize: vertical; }
.row { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
button.btn {
  background: var(--accent); color: #10203a; border: 0; border-radius: 10px; padding: 11px 18px;
  font: inherit; font-weight: 640; cursor: pointer; margin-top: 16px;
}
button.btn:hover { filter: brightness(1.06); }
button.btn.ghost { background: transparent; color: var(--text); border: 1px solid var(--line); }
button.btn.sm { padding: 7px 12px; margin-top: 0; font-size: 13.5px; font-weight: 550; }
button.btn.danger { background: transparent; color: var(--danger); border: 1px solid var(--line); }
button.link { background: none; border: 0; color: var(--muted); cursor: pointer; font: inherit;
  text-decoration: underline; padding: 0; }
.err { color: var(--danger); font-size: 13.5px; margin-top: 12px; min-height: 18px; }
.ok { color: var(--accent); font-size: 13.5px; margin-top: 12px; }

/* ── График ─────────────────────────────────────────────────────────────── */
.chart { padding: 18px; }
.chart svg { width: 100%; height: 220px; display: block; overflow: visible; }
.legend { display: flex; gap: 16px; flex-wrap: wrap; color: var(--muted); font-size: 12.5px; padding: 0 18px 16px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; }

.badge { display: inline-block; font-size: 11.5px; padding: 2px 8px; border-radius: 999px;
  border: 1px solid var(--line); color: var(--muted); }
.badge.red { color: var(--danger); border-color: color-mix(in oklab, var(--danger) 40%, var(--line)); }
.badge.green { color: var(--accent); border-color: var(--accent-dim); }

dialog {
  border: 1px solid var(--line); background: var(--panel); color: var(--text);
  border-radius: var(--radius); padding: 22px; max-width: 460px; width: calc(100vw - 32px);
  box-shadow: var(--shadow);
}
dialog::backdrop { background: rgba(0,0,0,.55); backdrop-filter: blur(2px); }
dialog h3 { margin: 0 0 6px; font-size: 17px; }
.copy-box { background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 12px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px;
  word-break: break-all; margin-top: 10px; }

/* ── Главный экран: работа против пассива ───────────────────────────────── */
.duel { display: grid; grid-template-columns: 1fr auto 1fr; gap: 12px; align-items: stretch; }
.duel .side {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px; box-shadow: var(--shadow); position: relative;
}
.duel .side.win { border-color: color-mix(in oklab, var(--accent) 45%, var(--line)); }
.duel .side.win::after {
  content: ""; position: absolute; inset: -1px; border-radius: var(--radius);
  box-shadow: 0 0 0 1px var(--accent) inset; pointer-events: none; opacity: .55;
}
.side-label { color: var(--muted); font-size: 12.5px; text-transform: uppercase; letter-spacing: .04em; }
.side-value { font-size: 44px; font-weight: 660; letter-spacing: -1.5px; margin: 6px 0 2px;
  font-variant-numeric: tabular-nums; line-height: 1.05; }
.side-hint { color: var(--muted); font-size: 13px; min-height: 34px; }
.side-rows { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 10px; }
.side-rows div { display: flex; justify-content: space-between; gap: 10px; padding: 4px 0;
  font-size: 13.5px; font-variant-numeric: tabular-nums; }
.side-rows span { color: var(--muted); }
.versus { align-self: center; color: var(--muted); font-size: 12.5px; text-transform: uppercase;
  letter-spacing: .06em; writing-mode: vertical-rl; transform: rotate(180deg); padding: 8px 0; }

.verdict-line {
  margin: 12px 0 4px; padding: 12px 18px; border-radius: var(--radius);
  background: var(--panel-2); border: 1px solid var(--line); font-size: 14.5px; font-weight: 550;
}
.verdict-line.good { border-color: var(--accent-dim); color: var(--accent); }
.verdict-line.bad { border-color: color-mix(in oklab, var(--danger) 35%, var(--line)); color: var(--danger); }

/* Вывод, ради которого раздел и существует — выделен, но не кричит. */
.insight {
  margin: 0 18px 4px; margin-top: 16px; padding: 14px 16px; border-radius: 12px;
  background: color-mix(in oklab, var(--warn) 10%, var(--panel-2));
  border: 1px solid color-mix(in oklab, var(--warn) 30%, var(--line));
  font-size: 14px; line-height: 1.55;
}
.insight b { color: var(--text); }

/* ── Строка диктовки ────────────────────────────────────────────────────── */
.dictate { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.dictate input { flex: 1; min-width: 200px; background: var(--panel); }
.dictate button { margin-top: 0; }
.dictate-echo { flex-basis: 100%; font-size: 13px; color: var(--muted); min-height: 18px; }
.dictate-echo.ok { color: var(--accent); }
.dictate-echo.err { color: var(--danger); }

/* ── Вопрос дня ─────────────────────────────────────────────────────────── */
.ask {
  background: var(--panel); border: 1px solid var(--accent-dim); border-radius: var(--radius);
  padding: 14px 16px; margin-bottom: 16px; box-shadow: var(--shadow);
}
.ask-title { font-size: 14.5px; font-weight: 600; margin-bottom: 10px; }
.ask-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.ask-row input { flex: 1; min-width: 120px; }
.ask-row button { margin-top: 0; }

/* ── «Для подумать» ─────────────────────────────────────────────────────── */
.lib-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; }
.lib-grid.dim { opacity: .55; }
.lib-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 18px; box-shadow: var(--shadow); display: flex; flex-direction: column;
}
.lib-head { display: flex; gap: 12px; align-items: flex-start; justify-content: space-between; }
.lib-title { font-weight: 620; font-size: 15px; line-height: 1.35; }
.lib-title a { color: var(--text); text-decoration: none; }
.lib-title a:hover { color: var(--accent); }
.lib-meta { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-top: 8px; }
.lib-pct { font-size: 24px; font-weight: 650; text-align: right; white-space: nowrap;
  font-variant-numeric: tabular-nums; line-height: 1.1; }
.lib-pct span { display: block; font-size: 11px; font-weight: 400; color: var(--muted); }
.lib-summary { margin-top: 12px; font-size: 14px; line-height: 1.5; color: var(--text); }
.lib-compare { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line);
  display: flex; gap: 16px; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.lib-actions { margin-top: auto; padding-top: 12px; display: flex; gap: 8px; }
/* Дело, где есть люди, помечено сразу — по правилу оно не рассматривается. */
.lib-card.lib-out { border-color: color-mix(in oklab, var(--danger) 25%, var(--line)); }

/* ── «Куда уйти» ────────────────────────────────────────────────────────── */
/* Номер места слева: список читается сверху вниз, порядок и есть главный смысл. */
.dir-card { display: grid; grid-template-columns: 44px 1fr; column-gap: 14px; row-gap: 12px; }
.dir-place { font-size: 26px; font-weight: 650; color: var(--muted);
  font-variant-numeric: tabular-nums; line-height: 1.1; }
.dir-body { min-width: 0; }
.dir-actions { grid-column: 2; display: flex; gap: 8px; margin-top: auto; }

/* ── Точка свободы ──────────────────────────────────────────────────────── */
.freedom-bar { height: 12px; background: var(--panel-2); border: 1px solid var(--line);
  border-radius: 999px; overflow: hidden; }
.freedom-fill { height: 100%; background: linear-gradient(90deg, var(--accent-dim), var(--accent)); }
.freedom-legend { display: flex; gap: 18px; flex-wrap: wrap; margin-top: 10px;
  font-size: 13.5px; color: var(--muted); }
.freedom-legend b { color: var(--text); }

@media (max-width: 720px) {
  .duel { grid-template-columns: 1fr; }
  .versus { writing-mode: horizontal-tb; transform: none; text-align: center; padding: 2px 0; }
  .side-value { font-size: 36px; }
}

@media (max-width: 640px) {
  .kpi .value { font-size: 23px; }
  main { padding: 14px 12px 60px; }
  td, th { padding: 9px 11px; }
}

/* Красный список «не сделал» на «Главном» — горит первым делом. */
.reminders {
  margin: 0 0 16px;
  padding: 12px 16px;
  border-radius: var(--radius);
  background: color-mix(in oklab, var(--danger) 12%, var(--surface));
  border: 1px solid color-mix(in oklab, var(--danger) 45%, var(--line));
}
.reminders-title {
  font-weight: 700;
  color: var(--danger);
  margin-bottom: 6px;
  letter-spacing: .02em;
}
.reminders ul { margin: 0; padding-left: 18px; }
.reminders li { color: var(--ink); margin: 3px 0; }

/* Таблица «Из чего капитал» — построчный расклад. */
table.brk { width: 100%; border-collapse: collapse; }
table.brk td { padding: 8px 6px; border-bottom: 1px solid var(--line); }
table.brk td.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.brk .note { color: var(--ink-faint); font-weight: 400; font-size: 13px; }
table.brk tr.brk-total td { border-top: 2px solid var(--line-strong); border-bottom: none; font-weight: 700; font-size: 18px; padding-top: 12px; }
.brk-form { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; margin-top: 14px; }
.brk-form label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
.brk-form input { padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink); min-width: 200px; }

/* Месячные цели на «Главном»: сколько зарабатывать в месяц. */
.month-targets { display: flex; gap: 12px; flex-wrap: wrap; padding: 0 16px 4px; }
.month-targets .mt-item {
  flex: 1; min-width: 200px; display: flex; flex-direction: column; gap: 2px;
  padding: 12px 16px; border-radius: 12px;
  background: color-mix(in oklab, var(--accent) 8%, var(--surface));
  border: 1px solid color-mix(in oklab, var(--accent) 25%, var(--line));
}
.month-targets .mt-main {
  background: color-mix(in oklab, var(--accent) 16%, var(--surface));
  border-color: color-mix(in oklab, var(--accent) 45%, var(--line));
}
.month-targets .mt-label { font-size: 13px; color: var(--muted); }
.month-targets .mt-value { font-size: 26px; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }

/* ══ Мова дизайну сайту VinCarGroup (05.09) — не тільки палітра ══ */
/* Шапка: логотип зліва + сжатие при прокрутці (як на сайті) */
header.top { display: flex; align-items: center; gap: 22px; padding: 0 clamp(14px,3vw,40px); min-height: 90px; transition: min-height .2s ease; }
header.top.compact { min-height: 54px; }
.brand { margin-right: 0; flex: 0 0 auto; text-decoration: none; align-items: center; }
.brand::before { width: 46px; height: 40px; transition: height .2s ease, width .2s ease; }
header.top.compact .brand::before { width: 34px; height: 28px; }
.brand-name { font: 600 15px var(--sans); letter-spacing: .09em; text-transform: uppercase; color: #fff; line-height: 1; }
.brand small { display: block; margin-top: 2px; font-size: 9.5px; letter-spacing: .12em; text-transform: uppercase; color: rgba(255,255,255,.5); }
header.top nav.tabs { flex: 1; background: transparent; padding: 0; margin: 0;
  flex-wrap: wrap; overflow: visible; row-gap: 2px; column-gap: 2px; align-content: center; }
header.top nav.tabs button { padding: 5px 11px; font-size: 13.5px; }
header.top button.link { color: rgba(255,255,255,.72); text-decoration: none; }
header.top button.link:hover { color: #fff; }
/* «Вийти» — в самий кінець рядка, окремо від вкладок */
header.top .tabs-spacer { flex: 1 1 auto; }
/* активна вкладка — синя лінія знизу (як меню сайту), без пігулки */
nav.tabs button.on { background: transparent; border-color: transparent; color: #fff; position: relative; }
nav.tabs button.on::after { content:""; position:absolute; left:11px; right:11px; bottom:-1px; height:2px; background: var(--blue-bright); border-radius:2px; }

/* Картки — заокруглення + hover-свічення як на сайті; serif-значення */
.kpi, .panel, .duel .side, .ask, .verdict-line, .insight, table { border-radius: 14px; }
.kpi, .panel, .duel .side { transition: box-shadow .16s ease, transform .16s ease; }
.kpi:hover, .panel:hover, .duel .side:hover { box-shadow: 0 0 0 1px rgba(39,137,229,.32), 0 0 22px -6px rgba(39,137,229,.4); }
.kpi .value, .side-value { font-family: var(--serif); font-weight: 500; letter-spacing: -.01em; }
.kpi .label, .side-label { font-size: 10px; letter-spacing: .14em; }
.duel .side.win { border-color: rgba(39,137,229,.5); }
.duel .side.win::after { box-shadow: 0 0 0 1px var(--blue) inset; }

/* Кнопки — язык сайту: темна + синє свічення на hover */
button.btn { background: var(--ink); color: #fff; border-radius: 10px; text-transform: uppercase; letter-spacing: .05em; font-weight: 600; font-size: 12px; box-shadow: none; }
button.btn:hover { filter: none; box-shadow: 0 0 0 1px rgba(39,137,229,.5), 0 0 18px -2px rgba(39,137,229,.5); }
button.btn.ghost { background: transparent; color: var(--text); border: 1px solid var(--line-strong); }
input:focus, select:focus, textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(39,137,229,.12); }

/* ══ Ліве бічне меню (як у кабінеті сайту) — замість верхньої шапки ══ */
.shell { display: flex; align-items: flex-start; min-height: 100vh; }
.sidebar { flex: 0 0 210px; align-self: stretch; background: #0f1113; color: #fff;
  display: flex; flex-direction: column; padding: 18px 12px; position: sticky; top: 0;
  height: 100vh; overflow-y: auto; z-index: 20; border-right: 1px solid rgba(255,255,255,.06); }
.sidebar::-webkit-scrollbar { width: 0; }
.side-brand { display: block; height: 36px; margin: 2px 8px 20px;
  background: url("/vcg-logo.png") left center / contain no-repeat; filter: brightness(0) invert(.92); }
.side-nav { display: flex; flex-direction: column; gap: 2px; }
.side-nav button { display: block; width: 100%; text-align: left; border: 0; background: transparent;
  color: rgba(255,255,255,.72); padding: 9px 13px; border-radius: 8px; cursor: pointer;
  font: inherit; font-size: 14px; white-space: nowrap; transition: background .12s, color .12s; }
.side-nav button:hover { background: rgba(255,255,255,.06); color: #fff; }
.side-nav button.on { background: rgba(39,137,229,.16); color: #fff; font-weight: 600;
  box-shadow: inset 3px 0 0 var(--blue-bright); }
.side-foot { margin-top: auto; padding-top: 16px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.side-foot .link { color: rgba(255,255,255,.7); background: none; border: 0; cursor: pointer;
  font: inherit; font-size: 13px; padding: 6px 8px; }
.side-foot .link:hover { color: #fff; }
.shell main { flex: 1 1 auto; min-width: 0; max-width: 1500px; margin: 0;
  padding: 22px clamp(16px,3vw,36px) 80px; }
.page-stamp { text-align: right; font-size: 11.5px; color: var(--muted); letter-spacing: .02em; margin: 0 2px 10px; }

@media (max-width: 820px) {
  .shell { flex-direction: column; }
  .sidebar { position: static; height: auto; width: 100%; flex-direction: row; align-items: center;
    flex-wrap: nowrap; overflow-x: auto; padding: 8px 10px; gap: 4px; }
  .side-brand { display: none; }
  .side-nav { flex-direction: row; gap: 4px; }
  .side-nav button { padding: 7px 11px; font-size: 13px; }
  .side-foot { margin: 0 0 0 auto; padding: 0; }
  .shell main { max-width: none; padding: 14px 12px 60px; }
}
