/* Стиль «Чистый лист» (дизайн-система сети, утверждён Деном 05.11.2026): белый лист, один акцент, тонкие линии, системный
   sans и воздух. Акцент сайта подставляет novyj-sajt.py (--cvet), производные от него считает color-mix. Светлая тема -
   :root, тёмная стоит ДВАЖДЫ и должна совпадать (настройка системы и ручной выбор data-theme="dark"). Ниже переменных -
   правила поверх скелета; характер самого инструмента (форма результата) сайт дописывает в конец этого файла.
   Тёмные значения только для экрана (screen): печать всегда светлая, даже из тёмной темы. */
:root {
  color-scheme: light dark;
  --bg: #ffffff;
  --surface: #ffffff;
  --surface-2: #f5f7fa;
  --ink: #0f172a;
  --muted: #5b6576;
  --line: #e5e8ee;
  --line-strong: #cdd3dd;
  --accent: #1b6e3a;
  --accent-ink: #ffffff;
  --accent-soft: color-mix(in srgb, #1b6e3a 12%, #ffffff);
  --link: #1b6e3a;
  --ok: #16a34a;
  --bad: #b3261e;
  --radius: 10px;
  --radius-s: 8px;
  --shadow: none;
  --font-display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI Variable Display", "Segoe UI", system-ui, sans-serif;
  --font-body: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI Variable Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
}
@media screen and (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1b1e23;
    --surface: #22262c;
    --surface-2: #282d34;
    --ink: #e9ecf1;
    --muted: #9ba4b3;
    --line: #333944;
    --line-strong: #474f5c;
    --accent: color-mix(in srgb, #1b6e3a 72%, #ffffff);
    --accent-ink: #0d1424;
    --accent-soft: color-mix(in srgb, #1b6e3a 22%, #22262c);
    --link: color-mix(in srgb, #1b6e3a 60%, #ffffff);
    --ok: #4ade80;
    --bad: #ff7b72;
    --shadow: none;
  }
}
@media screen {
:root[data-theme="dark"] {
  --bg: #1b1e23;
  --surface: #22262c;
  --surface-2: #282d34;
  --ink: #e9ecf1;
  --muted: #9ba4b3;
  --line: #333944;
  --line-strong: #474f5c;
  --accent: color-mix(in srgb, #1b6e3a 72%, #ffffff);
  --accent-ink: #0d1424;
  --accent-soft: color-mix(in srgb, #1b6e3a 22%, #22262c);
  --link: color-mix(in srgb, #1b6e3a 60%, #ffffff);
  --ok: #4ade80;
  --bad: #ff7b72;
  --shadow: none;
}
}

/* характер: шапка и заголовки */
.top { background: var(--bg); padding: 12px 0; }
.brand { font-weight: 650; font-size: 19px; letter-spacing: -.01em; }
.brand svg { width: 24px; height: 24px; }
.top nav a { color: var(--muted); }
.top nav a:hover { color: var(--ink); }
h1, h2, h3 { font-weight: 650; letter-spacing: -.022em; }
h1 { font-size: clamp(30px, 4.2vw, 44px); max-width: 20em; }
.hero { padding: 30px 0 14px; }
.lede { font-size: clamp(16px, 1.7vw, 18px); line-height: 1.5; }
.badge { background: none; padding: 0; margin-top: 10px; color: var(--muted); font-size: 14px; }

/* форма: спокойная, тонкие линии */
.panel { border-color: var(--line); }
.form .field label { font-weight: 600; font-size: 14px; }
.field textarea { background: var(--surface); border-color: var(--line-strong); line-height: 1.6; }
.btn { border-radius: 8px; font-weight: 600; }
.btn.secondary { border-color: var(--line-strong); }
.btn.secondary:hover { background: var(--surface-2); filter: none; }

/* результат: четыре карточки с крупными числами */
.out { background: var(--surface-2); border-color: var(--line); }
.out .status { margin-top: 0; font-size: 14px; color: var(--muted); }
.out .status.is-error { color: var(--bad); }
.out .result { margin-top: 12px; }
.out .mini { border: 0; background: none; padding: 4px 0; min-height: 30px; color: var(--accent); font-weight: 600; }
.out .mini:hover { text-decoration: underline; text-underline-offset: 3px; }

/* ниже инструмента */
.steps li { border-color: var(--line); background: var(--surface); }
.steps li::before { background: var(--accent-soft); color: var(--accent); }

/* четыре кнопки формы в одну строку на компьютере */
.form .row { gap: 8px; }
.form .row .btn { padding-left: 14px; padding-right: 14px; }

/* ---- IFTA Calculator: форма «штат - мили - галлоны» слева, чек с заправки справа (одна разметка в обоих стилях) ---- */
.ifta-top { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0 12px; }
.ifta .field select, .ifta .field input { width: 100%; min-height: 44px; }
.legs { border: 0; margin: 0; padding: 0; min-width: 0; }
.legs legend { padding: 0; margin: 0 0 8px; font-weight: 600; font-size: 14px; }
.legs-head { display: none; }
.leg { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px 10px; margin: 0 0 8px; padding: 10px 12px 12px; border: 1px solid var(--line); border-radius: var(--radius-s); background: var(--surface); }
.leg .field, .form .leg .field:last-of-type { margin: 0; gap: 4px; }
.leg .st { grid-column: 1 / -1; padding-right: 48px; }
.leg .field label { font-size: 12px; font-weight: 500; color: var(--muted); }
.leg input { text-align: right; font-variant-numeric: tabular-nums; }
.leg .del { position: absolute; top: 6px; right: 6px; width: 40px; min-height: 40px; padding: 0; font-size: 20px; line-height: 1; color: var(--muted); }
.legs-total { display: flex; justify-content: space-between; gap: 12px; margin: 2px 0 0; padding: 6px 12px 0; font-weight: 700; font-variant-numeric: tabular-nums; }
.legs-act { margin: 12px 0 14px; gap: 8px; }
.legs-act .hint { flex: 1 1 100%; }
.file-btn { cursor: pointer; }
.file-btn:focus-within { outline: 3px solid var(--link); outline-offset: 2px; }
@media (min-width: 641px) {
  .legs-head, .leg, .legs-total { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr) minmax(0, 1fr) 40px; gap: 8px; }
  .legs-head { display: grid; padding: 0 0 4px; font-size: 12px; font-weight: 600; color: var(--muted); }
  .legs-head span:nth-child(n+2) { text-align: right; padding-right: 12px; }
  .leg { align-items: center; margin: 0 0 6px; padding: 0; border: 0; background: none; }
  .leg .st { grid-column: auto; padding-right: 0; }
  .leg .field label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .leg .del { position: static; }
  .legs-total { display: grid; margin-top: 4px; padding: 8px 0 0; border-top: 1px solid var(--line-strong); }
  .legs-total span:nth-child(n+2) { text-align: right; padding-right: 12px; }
  .legs-act .hint { flex: 1 1 160px; }
}

/* чек с заправки: моноширинный, пунктирные разделители, зубчатый низ */
.receipt { padding: 18px 18px 30px; background: var(--paper); color: var(--paper-ink); font: 13px/1.5 var(--font-mono); font-variant-numeric: tabular-nums;
  -webkit-mask: conic-gradient(from -45deg at bottom, #0000, #000 1deg 89deg, #0000 90deg) 50% / 14px 100%;
          mask: conic-gradient(from -45deg at bottom, #0000, #000 1deg 89deg, #0000 90deg) 50% / 14px 100%; }
.r-head { margin: 0 0 10px; text-align: center; text-transform: uppercase; letter-spacing: .06em; }
.r-head strong { display: block; font-size: 15px; letter-spacing: .14em; }
.r-head span { display: block; font-size: 12px; color: var(--paper-muted); }
.r-sum { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 0; padding: 10px 0; border-top: 1px dashed var(--paper-line); text-align: center; }
.r-sum dt { font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--paper-muted); }
.r-sum dd { margin: 2px 0 0; font-size: 18px; font-weight: 700; }
.r-sum .mpg dd { font-size: 24px; line-height: 1.1; color: var(--r-hot); }
.r-tab { width: 100%; border-collapse: collapse; border-top: 1px dashed var(--paper-line); }
.r-tab th, .r-tab td { padding: 3px 0 3px 8px; text-align: right; font-weight: 400; }
.r-tab thead th { padding-top: 10px; vertical-align: bottom; font-size: 11px; line-height: 1.3; letter-spacing: .04em; text-transform: uppercase; color: var(--paper-muted); }
.r-tab tr > :first-child { padding-left: 0; text-align: left; }
.r-tab tbody th { font-weight: 700; white-space: nowrap; }
.r-tab .sur th { font-weight: 400; padding-left: 12px; }
.r-tab .cr td:last-child { color: var(--r-ok); font-weight: 700; }
.r-total { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin: 10px 0 0; padding: 10px 0 0; border-top: 1px dashed var(--paper-line); }
.r-total span { font-weight: 700; text-transform: uppercase; letter-spacing: .08em; }
.r-total strong { font-size: 26px; line-height: 1.1; }
.r-foot { margin: 10px 0 0; text-align: center; font-size: 11px; color: var(--paper-muted); }
.out-act { margin-top: 14px; gap: 8px; }
.out-act .btn { flex: 1 1 140px; }
.r-note { margin: 10px 0 0; }
@media (max-width: 640px) {
  .receipt { padding: 16px 12px 28px; font-size: 12px; }
  .r-sum dd { font-size: 16px; }
  .r-sum .mpg dd { font-size: 21px; }
  .r-total strong { font-size: 23px; }
}
@media print {
  .tool-grid > .form, .out-act, .r-note, .out .status { display: none !important; }
  .receipt { -webkit-mask: none; mask: none; }
}

/* «Чистый лист»: чек - белая полоска бумаги с тонкой рамкой на сером поле панели, итог акцентом */
:root { --r-ok: #13733d; }
@media screen and (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --r-ok: #6fd39a; } }
@media screen { :root[data-theme="dark"] { --r-ok: #6fd39a; } }
.receipt { --paper: var(--surface); --paper-ink: var(--ink); --paper-muted: var(--muted); --paper-line: var(--line-strong); --r-hot: var(--accent); border: 1px solid var(--line); border-bottom: 0; }
.r-total { border-top: 3px double var(--paper-line); }
.r-total strong { color: var(--accent); }
.legs .leg select, .legs .leg input { border-color: var(--line-strong); }

/* ---- настоящий инструмент: база, строка ставок, освобождённые мили, одометр, предупреждения ---- */
.ifta-top .base { grid-column: 1 / -1; }
.ifta-top .opt { font-weight: 400; color: var(--muted); }
.rates-line { margin: 0 0 12px; font-size: 13px; color: var(--muted); }
.rates-line strong { color: var(--ink); font-weight: 600; }
.legs .ex { display: none; }
.legs.with-ex .ex { display: block; }
.legs.with-ex .leg { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.leg.is-bad { border-color: var(--bad); }
.leg.is-bad select, .leg.is-bad input.is-bad { border-color: var(--bad); }
.extras { display: grid; gap: 8px; margin: 0 0 14px; }
.check { display: flex; align-items: center; gap: 8px; min-height: 44px; font-size: 14px; cursor: pointer; }
.check input { width: 20px; height: 20px; margin: 0; accent-color: var(--accent); }
.odo summary { min-height: 44px; display: flex; align-items: center; font-size: 14px; cursor: pointer; color: var(--link); }
.odo-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0 12px; }
.odo-grid input { text-align: right; font-variant-numeric: tabular-nums; }
.saved-note { margin: 10px 0 0; font-size: 13px; }
.r-tab .rate { display: none; }
.r-warn { margin: 10px 0 0; padding: 8px 10px; border-left: 3px solid var(--bad); background: var(--surface-2); font-size: 13px; }
.r-notes { margin: 10px 0 0; padding: 0 0 0 18px; font-size: 12px; color: var(--paper-muted); font-family: var(--font-body); }
@media (min-width: 641px) {
  .legs.with-ex .legs-head, .legs.with-ex .leg, .legs.with-ex .legs-total { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr) 40px; }
  .r-tab .rate { display: table-cell; }
}
@media print {
  .r-notes { color: #444; }
}
