:root {
  --bg: #0a0b2e;
  --card: #111347;
  --ink: #ffffff;
  --ink-2: #b4b9e6;
  --line: #2b2e6b;
  --accent: #7deb8a;
  --on-accent: #0a0b2e;
  --indigo: #4054c8;
  --lav: #ccd0f7;
  --body: "Golos Text", system-ui, -apple-system, "Segoe UI", sans-serif;
  --figure: "Golos Text", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Menlo, monospace;
  --col: 760px;
}
* { box-sizing: border-box; }
html { color-scheme: dark; }
body {
  margin: 0; background: var(--bg); color: var(--ink); font: 400 17px/1.55 var(--body);
  -webkit-font-smoothing: antialiased; padding-bottom: 112px;
}
.sr, .skip:not(:focus) { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip:focus { position: fixed; top: 8px; left: 8px; background: var(--accent); color: var(--on-accent); padding: 12px 16px; z-index: 50; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
button { font: inherit; cursor: pointer; }
a { color: var(--accent); }
.bar, main, .foot { width: min(var(--col), 100%); margin-inline: auto; padding-inline: 16px; }

/* шапка: знак, название, справка и язык */
.bar { display: flex; align-items: center; gap: 12px 20px; padding-block: 14px; max-width: 100%; width: 100%; border-bottom: 1px solid var(--line); padding-inline: max(16px, calc((100% - var(--col)) / 2)); }
.title { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; font-size: 20px; font-weight: 700; line-height: 1.1; text-decoration: none; color: var(--ink); margin-right: auto; }
.mark { width: 32px; height: 32px; flex: none; }
.topnav { display: none; gap: 4px 20px; }
.topnav a { display: inline-flex; align-items: center; min-height: 44px; color: var(--ink); text-decoration: none; }
.topnav a:hover { color: var(--accent); }
@media (min-width: 720px) { .topnav { display: flex; } }
.lang { display: inline-flex; border: 1.5px solid var(--accent); overflow: hidden; }
.lang button { min-height: 44px; min-width: 52px; background: transparent; border: 0; color: var(--accent); font: 600 16px var(--mono); }
.lang button + button { border-left: 1.5px solid var(--accent); }
.lang button[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); }

/* пустой экран */
.empty { padding: 28px 0 8px; }
.plates { margin: 0 0 22px; font-weight: 700; line-height: 1; font-size: clamp(44px, 13vw, 84px); letter-spacing: -0.02em; display: grid; justify-items: start; }
.plates .row { display: flex; }
.plates .row:nth-child(2) { margin-left: 8%; }
.plates .row:nth-child(3) { margin-left: 8%; }
.plate { padding: 0.08em 0.2em 0.12em; }
.plate.white { background: #fff; color: var(--bg); }
.plate.mint { background: var(--accent); color: var(--bg); }
.plate.indigo { background: var(--indigo); color: #fff; }
.plate.lav { background: var(--lav); color: var(--bg); }
.facts { display: flex; flex-wrap: wrap; gap: 14px 32px; margin: 0 0 24px; }
.facts dt { font: 500 16px/1.2 var(--mono); letter-spacing: .04em; text-transform: uppercase; color: var(--ink-2); margin: 0 0 4px; }
.facts dd { margin: 0; color: var(--accent); font: 500 17px var(--mono); }
.invite { font-size: 20px; line-height: 1.4; font-weight: 500; margin: 0 0 18px; max-width: 34ch; }
.examples { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.examples button {
  width: 100%; min-height: 48px; text-align: left; padding: 10px 14px; background: var(--card); color: var(--ink);
  border: 1px solid var(--line); border-radius: 0;
}
.examples button::after { content: " →"; color: var(--accent); }
.examples button:hover { border-color: var(--accent); }

/* диалог */
.stream { display: grid; grid-template-columns: minmax(0, 1fr); gap: 28px; padding-top: 8px; }
.turn { min-width: 0; }
.question { margin: 0 0 8px; color: var(--ink-2); font-size: 16px; overflow-wrap: anywhere; }
.card { background: var(--card); border: 1px solid var(--line); border-top: 3px solid var(--accent); border-radius: 0; padding: 22px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; min-width: 0; }
.figure { margin: 0; display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 12px; }
.num { font: 700 42px/1.1 var(--figure); color: var(--accent); overflow-wrap: anywhere; letter-spacing: -0.01em; }
.unit { font-size: 20px; font-weight: 500; }
.hint { margin: -10px 0 0; color: var(--ink-2); font-size: 16px; }
.sentence { margin: 0; font-size: 18px; line-height: 1.5; overflow-wrap: anywhere; }
.sentence.plain { font-size: 20px; }
.card .para { margin: 0; white-space: pre-line; }

.tools { display: flex; gap: 8px; flex-wrap: wrap; }
.data { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; min-width: 0; }
.btn {
  min-height: 44px; padding: 8px 14px; background: transparent; color: var(--ink); border: 1.5px solid var(--lav); border-radius: 0; font-size: 16px;
}
.btn:hover { background: var(--lav); color: var(--bg); }
.btn[aria-pressed="true"] { background: var(--lav); color: var(--bg); }

.tablewrap { overflow: auto; max-height: 420px; border: 1px solid var(--line); border-radius: 0; }
table { border-collapse: collapse; width: 100%; font-size: 16px; }
th { position: sticky; top: 0; background: #1a1d5c; color: var(--lav); text-align: left; font-weight: 600; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
td.num-col, th.num-col { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }

.chart svg { display: block; max-width: 100%; overflow: visible; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .axis text { fill: var(--ink-2); font: 400 16px var(--body); }
.chart .val { fill: var(--ink); font: 500 16px var(--body); }
.chart .lbl { fill: var(--ink); font: 400 16px var(--body); }
.legend { display: flex; gap: 16px; font-size: 16px; margin-bottom: 6px; }
.legend i { display: inline-block; width: 12px; height: 12px; margin-right: 6px; }
.tip {
  position: fixed; z-index: 30; background: #fff; color: var(--bg); padding: 8px 12px; border-radius: 0;
  font-size: 16px; line-height: 1.4; pointer-events: none; max-width: 280px;
}

/* «Как посчитано» */
.how { border-top: 1px solid var(--line); padding-top: 12px; }
.how summary { min-height: 44px; display: flex; align-items: center; cursor: pointer; font-weight: 600; list-style-position: inside; }
.how .inner { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; padding: 6px 0 4px; }
.how ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 6px; }
.how li { overflow-wrap: anywhere; }
.how h3 { margin: 0 0 6px; font-size: 16px; font-weight: 600; }
.how .ok::before { content: "✓ "; font-weight: 700; }
.how .bad { font-weight: 600; }
.how .bad::before { content: "✗ "; }
.how .meta { color: var(--ink-2); font-size: 16px; }
.how details.sqlbox { border: 1px solid var(--line); border-radius: 0; padding: 0 12px; }
.how details.sqlbox summary { font-weight: 500; }
pre.sql {
  margin: 0 0 12px; padding: 12px; background: #070820; color: var(--lav); border-radius: 0; font: 400 16px/1.55 var(--mono);
  white-space: pre-wrap; word-break: break-word; max-height: 300px; overflow: auto;
}

/* подсказки */
.next { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  min-height: 44px; padding: 8px 12px; background: transparent; color: var(--ink); border: 1px solid var(--lav); border-radius: 0;
  font-size: 16px; text-align: left;
}
.chip:hover { background: var(--lav); color: var(--bg); }

/* ожидание: одна строка */
.working { margin: 0; padding: 14px 0; font-size: 18px; color: var(--ink-2); }

/* ввод закреплён внизу */
.composer {
  position: fixed; left: 0; right: 0; bottom: 0; background: var(--bg); border-top: 1px solid var(--line);
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); display: grid; grid-template-columns: 1fr auto; gap: 8px;
  width: min(var(--col), 100%); margin-inline: auto;
}
.composer textarea {
  resize: none; font: inherit; font-size: 18px; line-height: 1.4; padding: 12px 14px; min-height: 56px; max-height: 140px;
  border: 1.5px solid var(--lav); border-radius: 0; background: var(--card); color: var(--ink);
}
.composer textarea::placeholder { color: #9aa0d6; }
.composer button {
  min-height: 56px; padding: 0 22px; border: 0; border-radius: 0; background: var(--accent); color: var(--on-accent);
  font-size: 18px; font-weight: 700;
}
.composer button:hover:not(:disabled) { background: #fff; }
.composer button:disabled { opacity: .6; cursor: progress; }
.composer[hidden] { display: none; }
@media (min-width: 800px) { .composer { left: 50%; transform: translateX(-50%); } }

/* подвал и служебные страницы: простой текст */
.foot { padding-block: 28px 16px; color: var(--ink-2); font-size: 16px; }
.foot nav { display: flex; gap: 24px; margin-bottom: 8px; }
.foot a { display: inline-flex; align-items: center; min-height: 44px; color: var(--accent); }
.foot p { margin: 0; }
.doc { padding-block: 8px 24px; }
.doc h1 { font-size: 28px; font-weight: 600; margin: 8px 0 12px; }
.doc h2 { font: 500 16px/1.3 var(--mono); letter-spacing: .04em; text-transform: uppercase; color: var(--accent); margin: 28px 0 8px; }
.doc p, .doc li { max-width: 62ch; }
.doc dt { font-weight: 600; margin-top: 14px; }
.doc dd { margin: 2px 0 0; max-width: 62ch; }
.doc .back { display: inline-flex; align-items: center; min-height: 44px; }
.doc .tablewrap { max-height: none; margin-top: 8px; }
body[data-route="quality"] main { width: min(1180px, 100%); }
body[data-route="quality"] .bar { padding-inline: max(16px, calc((100% - 1180px) / 2 + 16px)); }
body[data-route="quality"] .doc p, body[data-route="quality"] .doc li { max-width: 90ch; }
.note-col { min-width: 420px; width: 46%; }

@media (max-width: 520px) {
  .num { font-size: 36px; }
  .card { padding: 16px; }
  .invite { font-size: 22px; }
}
@media print { .composer, .foot, .lang, .topnav { display: none; } }
