/* Сервисная книжка Avensis: тёмная тема в духе приборов T25 —
   оранжевая подсветка, серебристые линии, шрифт Exo 2. */

@font-face { font-family: 'Exo 2'; font-weight: 300; font-display: swap; src: url(fonts/exo2-300.woff2) format('woff2'); }
@font-face { font-family: 'Exo 2'; font-weight: 400; font-display: swap; src: url(fonts/exo2-400.woff2) format('woff2'); }
@font-face { font-family: 'Exo 2'; font-weight: 500; font-display: swap; src: url(fonts/exo2-500.woff2) format('woff2'); }
@font-face { font-family: 'Exo 2'; font-weight: 600; font-display: swap; src: url(fonts/exo2-600.woff2) format('woff2'); }
/* Знак белорусского рубля (U+20C5, в системных шрифтах его ещё нет) — только для этого символа */
@font-face { font-family: 'BYN Sign'; font-weight: 100 900; font-display: block; src: url(fonts/byn.woff2) format('woff2'); unicode-range: U+20C5; }

:root {
  color-scheme: dark;
  --bg: #0a0a0b;
  --surface: #141416;
  --surface-2: #1b1b1f;
  --surface-3: #232328;
  --line: #26272b;
  --line-strong: #3a3d42;
  --text: #f3e9dd;
  --text-2: #c3b9ad;
  --muted: #8f867c;
  --amber: #ff8a2a;
  --amber-hot: #ffb46a;
  --amber-dim: #a65a1c;
  --amber-wash: rgba(255, 138, 42, 0.12);
  --red: #ff3a22;
  --silver: #9a9fa6;
  --silver-hi: #e4e7ea;
  /* статусы — всегда вместе со значком и словом */
  --good: #0ca30c;
  --warning: #fab219;
  --serious: #ec835a;
  --critical: #d03b3b;
  /* категории расходов (проверены валидатором палитры на --surface) */
  --s-service: #3987e5;
  --s-fuel: #e0702c;
  --s-docs: #199e70;
  --s-other: #c98500;
  --radius: 16px;
  --tabbar: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  font-family: 'BYN Sign', 'Exo 2', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  background-image: radial-gradient(120% 60% at 50% 0%, #17171b 0%, var(--bg) 60%);
  background-attachment: fixed;
  color: var(--text);
  font-size: 16px;
  line-height: 1.4;
  -webkit-tap-highlight-color: transparent;
}
body.sheet-open { overflow: hidden; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--amber); }
h1, h2, h3, h4 { margin: 0; font-weight: 600; }
.muted { color: var(--muted); margin: 0; }
.note { color: var(--muted); font-size: 13px; margin: 10px 0 0; }
.note.center { text-align: center; margin: 24px 8px; }
.pad { padding: 12px 16px; }
.mono { font-family: ui-monospace, 'SF Mono', Menlo, monospace; letter-spacing: 0.04em; }
.caps {
  font-size: 12px; font-weight: 600; letter-spacing: 0.18em; text-transform: uppercase; color: var(--amber-dim);
}

.icon { flex: none; display: block; }

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

.shell { min-height: 100vh; padding-bottom: calc(var(--tabbar) + var(--safe-b) + 16px); }
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 4px;
  padding: calc(var(--safe-t) + 8px) 8px 8px 12px;
  background: rgba(10, 10, 11, 0.86);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid transparent;
  border-image: linear-gradient(90deg, transparent, var(--line-strong), #5a5e64, var(--line-strong), transparent) 1;
}
.topbar-spacer { flex: 1; }
.topbar-title { font-size: 18px; }
.car-switch {
  display: flex; align-items: baseline; gap: 8px; min-width: 0;
  background: none; border: 0; padding: 8px 4px; text-align: left;
}
.car-name { font-size: 18px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 52vw; }
.car-plate {
  font-size: 12px; font-weight: 600; letter-spacing: 0.06em; color: var(--text-2);
  border: 1px solid var(--line-strong); border-radius: 4px; padding: 1px 5px;
}
.car-switch .icon { align-self: center; color: var(--muted); }

.content { max-width: 720px; margin: 0 auto; }
.page { padding: 12px 16px 24px; display: flex; flex-direction: column; gap: 14px; }
.page-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: flex; justify-content: space-around;
  height: calc(var(--tabbar) + var(--safe-b)); padding-bottom: var(--safe-b);
  background: rgba(12, 12, 14, 0.94);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
}
.tab {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--muted); text-decoration: none; font-size: 11px; font-weight: 500; letter-spacing: 0.02em;
}
.tab-on { color: var(--amber); }
.tab-on .icon { filter: drop-shadow(0 0 6px rgba(255, 122, 16, 0.55)); }

.fab {
  position: fixed; right: 18px; bottom: calc(var(--tabbar) + var(--safe-b) + 16px); z-index: 21;
  width: 58px; height: 58px; border-radius: 50%; border: 0;
  display: grid; place-items: center;
  color: #1a0d03; background: radial-gradient(circle at 35% 30%, var(--amber-hot), var(--amber) 60%);
  box-shadow: 0 6px 20px rgba(255, 122, 16, 0.35), 0 0 0 1px rgba(255, 180, 106, 0.4) inset;
}
.fab:active { transform: scale(0.96); }

.icon-btn {
  position: relative; display: grid; place-items: center;
  width: 44px; height: 44px; border: 0; border-radius: 12px; background: none; color: var(--text-2);
}
.icon-btn:active { background: var(--surface-2); }
.icon-btn.warn { color: var(--warning); }
.icon-btn.spin .icon { animation: spin 1.2s linear infinite; color: var(--amber); }
@keyframes spin { to { transform: rotate(360deg); } }
.badge {
  position: absolute; top: 6px; right: 4px; min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: 8px; background: var(--amber); color: #1a0d03; font-size: 11px; font-weight: 600;
  display: grid; place-items: center;
}

.boot { min-height: 70vh; display: grid; place-items: center; }
.boot .logo { width: 72px; opacity: 0.7; }

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

.card {
  background: linear-gradient(180deg, #17171a, var(--surface) 40%);
  border: 1px solid var(--line);
  border-top-color: #34363b;
  border-radius: var(--radius);
  padding: 14px 16px;
}
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; min-height: 24px; }
.card-head h3 {
  font-size: 12px; font-weight: 600; letter-spacing: 0.18em; text-transform: uppercase; color: var(--amber-dim);
}
.list-card { padding: 4px 0; }
.card.list-card > .card-head { padding: 10px 16px 0; }
.link-btn { background: none; border: 0; color: var(--amber); font-size: 14px; font-weight: 500; padding: 6px 0; }

.hero {
  position: relative; text-align: center; padding: 22px 16px 18px;
  border-radius: 22px;
  background: radial-gradient(90% 120% at 50% 0%, #1d1d21, #0f0f11 70%);
  border: 1px solid var(--line);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.02) inset;
  overflow: hidden;
}
.hero::before {
  content: ''; position: absolute; inset: 0; border-radius: inherit; padding: 1.5px; pointer-events: none;
  background: conic-gradient(from 200deg, #9a9fa6, #3a3d42, #1a1b1e, #3a3d42, #9a9fa6, #e4e7ea, #9a9fa6);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude; opacity: 0.55;
}
.hero-value {
  font-size: 54px; font-weight: 300; line-height: 1.05; margin: 6px 0 4px;
  color: var(--amber-hot); text-shadow: 0 0 22px rgba(255, 122, 16, 0.55);
}
.hero-value small { font-size: 18px; font-weight: 500; color: var(--amber-dim); margin-left: 8px; text-shadow: none; }
.hero-sub { margin: 0 0 12px; color: var(--text-2); font-size: 14px; }
.hero-sub b { color: var(--amber); font-weight: 500; }

.quick { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.quick-btn {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 14px 4px 12px; border-radius: 14px;
  background: linear-gradient(180deg, #19191c, #0d0d0e); border: 1px solid var(--line); border-top-color: #3a3c41;
  color: var(--amber); font-size: 12px; font-weight: 500;
}
.quick-btn span { color: var(--text); }
.quick-btn:active { background: #24170c; border-color: var(--amber); }
.quick-btn .icon { filter: drop-shadow(0 0 6px rgba(255, 122, 16, 0.45)); }

.stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat {
  display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; border-radius: 14px;
  background: var(--surface); border: 1px solid var(--line);
}
.card .stat { background: var(--surface-2); }
.stat-label { font-size: 12px; color: var(--muted); }
.stat-value { font-size: 26px; font-weight: 500; line-height: 1.15; }
.stat-value small { font-size: 13px; color: var(--muted); font-weight: 400; margin-left: 4px; }
.stat-sub { font-size: 12px; color: var(--muted); }

/* ------------------------------------------------------------- строки */

.row {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 10px 0; background: none; border: 0; text-align: left; min-height: 56px;
  border-bottom: 1px solid var(--line);
}
.list-card .row { padding: 10px 16px; }
.row:last-child { border-bottom: 0; }
button.row:active { background: var(--surface-2); }
.row.static { cursor: default; }
.row-on .row-title { color: var(--amber); }
.row-icon {
  flex: none; width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center;
  background: var(--surface-3); color: var(--amber);
}
.row-icon.kind-fuel { color: var(--s-fuel); }
.row-icon.kind-service { color: var(--s-service); }
.row-icon.kind-document { color: var(--s-docs); }
.row-icon.kind-expense { color: var(--s-other); }
.row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.row-title { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-sub { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-value { flex: none; font-weight: 500; font-variant-numeric: tabular-nums; }
.row > .icon { color: var(--muted); }

.all-good { display: flex; align-items: center; gap: 10px; color: var(--text-2); padding: 6px 0 2px; }
.all-good .icon { color: var(--good); }

.status {
  flex: none; display: inline-flex; align-items: center; gap: 4px;
  font-size: 12px; font-weight: 600; padding: 3px 8px 3px 6px; border-radius: 999px;
  background: var(--surface-3);
}
.st-critical { color: #ff7a7a; background: rgba(208, 59, 59, 0.16); }
.st-warning { color: var(--warning); background: rgba(250, 178, 25, 0.12); }
.st-good { color: #4bd34b; background: rgba(12, 163, 12, 0.12); }
.st-muted { color: var(--muted); }

.month { display: flex; flex-direction: column; gap: 6px; }
.month-head { display: flex; justify-content: space-between; align-items: baseline; padding: 4px 4px 0; }
.month-head h3 { font-size: 15px; }
.month-head span { color: var(--muted); font-size: 14px; font-variant-numeric: tabular-nums; }

.sched {
  display: flex; flex-direction: column; gap: 8px; width: 100%; text-align: left;
  padding: 14px 16px; background: none; border: 0; border-bottom: 1px solid var(--line);
}
.sched:last-child { border-bottom: 0; }
.sched:active { background: var(--surface-2); }
.sched-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.sched-bottom { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; color: var(--muted); }
.sched-bottom span:first-child { color: var(--text-2); }

.meter { height: 6px; border-radius: 3px; background: #3a1d08; overflow: hidden; }
.meter span { display: block; height: 100%; border-radius: 3px; background: var(--amber); box-shadow: 0 0 8px rgba(255, 122, 16, 0.6); }
.meter-warning { background: #3d2c06; }
.meter-warning span { background: var(--warning); box-shadow: none; }
.meter-critical { background: #3a1414; }
.meter-critical span { background: var(--critical); box-shadow: none; }

.empty {
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px;
  padding: 48px 20px; color: var(--muted);
}
.empty .icon { color: var(--amber-dim); }
.empty strong { color: var(--text); font-size: 18px; font-weight: 500; }
.empty p { margin: 0 0 8px; max-width: 34ch; }

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

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 18px; border-radius: 12px; border: 1px solid transparent;
  font-weight: 600; font-size: 15px;
}
.btn-small { min-height: 40px; padding: 0 14px; font-size: 14px; }
.btn-block { width: 100%; }
.btn-primary { background: linear-gradient(180deg, var(--amber-hot), var(--amber)); color: #1a0d03; box-shadow: 0 4px 16px rgba(255, 122, 16, 0.25); }
.btn-ghost { background: var(--surface-2); border-color: var(--line-strong); color: var(--text); }
.btn-ghost .icon { color: var(--amber); }
.btn-danger { background: rgba(208, 59, 59, 0.12); border-color: rgba(208, 59, 59, 0.4); color: #ff8a8a; }
.btn:disabled { opacity: 0.45; }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }
.hero .btn, .card > .btn { margin-top: 8px; }

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field-wide { grid-column: 1 / -1; }
.field-label { font-size: 13px; color: var(--text-2); }
.field-hint { font-size: 12px; color: var(--muted); }
.input {
  width: 100%; min-height: 48px; padding: 0 14px; border-radius: 12px;
  background: #0e0e10; border: 1px solid var(--line-strong); color: var(--text); font-size: 16px;
  appearance: none; -webkit-appearance: none;
}
select.input {
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 20px) 21px, calc(100% - 15px) 21px; background-size: 5px 5px; background-repeat: no-repeat;
  padding-right: 34px;
}
.input:focus { outline: none; border-color: var(--amber); box-shadow: 0 0 0 3px var(--amber-wash); }
input[type='date'].input { min-height: 48px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 12px; }

/* Итог заправки: крупно, считается сам из литров и цены */
.fuel-total {
  display: grid; grid-template-columns: 1fr auto; align-items: baseline; gap: 2px 10px;
  margin: 0 0 14px; padding: 12px 16px 10px; border-radius: 14px;
  background: var(--surface-2); border: 1px solid var(--line);
}
.fuel-total .field-label, .fuel-total .field-hint { grid-column: 1 / -1; }
.fuel-total-input {
  min-width: 0; width: 100%; border: 0; background: none; padding: 2px 0;
  font-size: 34px; font-weight: 500; letter-spacing: 0.01em; font-variant-numeric: tabular-nums;
}
.fuel-total-input:focus { outline: none; }
.fuel-total-cur { font-size: 26px; color: var(--amber-dim); }
.fuel-total-auto .fuel-total-input { color: var(--amber); text-shadow: 0 0 12px rgba(255, 122, 16, 0.35); }
.fuel-total:focus-within { border-color: var(--amber); box-shadow: 0 0 0 3px var(--amber-wash); }
.sheet-body > .field { margin-bottom: 12px; }

.toggle-row {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 12px 0; border-bottom: 1px solid var(--line); cursor: pointer;
}
.toggle-text { display: flex; flex-direction: column; }
.toggle-text small { color: var(--muted); font-size: 13px; }
.toggle {
  flex: none; appearance: none; -webkit-appearance: none; width: 50px; height: 30px; border-radius: 15px;
  background: var(--surface-3); border: 1px solid var(--line-strong); position: relative; transition: background 0.2s;
}
.toggle::after {
  content: ''; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%;
  background: var(--silver); transition: transform 0.2s, background 0.2s;
}
.toggle:checked { background: rgba(255, 138, 42, 0.35); border-color: var(--amber-dim); }
.toggle:checked::after { transform: translateX(20px); background: var(--amber); box-shadow: 0 0 8px rgba(255, 122, 16, 0.7); }

.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding: 2px 0; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; min-height: 36px; padding: 0 14px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--line-strong); color: var(--text-2); font-size: 14px; font-weight: 500;
}
.chip-on { background: var(--amber-wash); border-color: var(--amber); color: var(--amber-hot); }
.card .chips { margin-bottom: 10px; }

.subsection { margin: 4px 0 14px; }
.subsection h4, .sheet-sub {
  font-size: 12px; font-weight: 600; letter-spacing: 0.16em; text-transform: uppercase; color: var(--amber-dim);
  margin: 16px 0 10px;
}
.checklist { display: flex; flex-wrap: wrap; gap: 8px; }
.check-chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; border-radius: 10px;
  background: var(--surface-2); border: 1px solid var(--line-strong); font-size: 14px; cursor: pointer;
}
.check-chip input { position: absolute; opacity: 0; pointer-events: none; }
.check-chip .icon { color: transparent; }
.check-chip.on { border-color: var(--amber); background: var(--amber-wash); }
.check-chip.on .icon { color: var(--amber); }
.part-row { display: grid; grid-template-columns: 1fr 56px 84px 40px; gap: 6px; margin-bottom: 8px; align-items: center; }
.part-row .input { padding: 0 10px; }
.inline-form { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.inline-form .input { flex: 1 1 160px; }
.inline-form select.input { flex: 0 1 130px; }
.settings-group { border: 0; padding: 0; margin: 0; }
.settings-group:disabled { opacity: 0.6; }
.details { border-top: 1px solid var(--line); padding: 10px 0; }
.details summary { cursor: pointer; color: var(--text-2); padding: 6px 0; }
.details[open] summary { margin-bottom: 10px; }
.card > .btn-danger { margin-top: 14px; }

.pair { text-align: center; padding: 16px 8px; margin: 8px 0; border-radius: 14px; background: #0e0e10; border: 1px solid var(--amber-dim); }
.pair-code {
  font-size: 44px; font-weight: 300; letter-spacing: 0.12em; color: var(--amber-hot);
  text-shadow: 0 0 18px rgba(255, 122, 16, 0.5); margin: 4px 0 8px; font-variant-numeric: tabular-nums;
}
.pair p { margin: 4px 0; font-size: 14px; color: var(--text-2); }

.release { padding: 4px 0 10px; border-bottom: 1px solid var(--line); }
.release-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.release-head b { font-weight: 600; color: var(--amber-hot); font-size: 17px; }
.release-head span { color: var(--muted); font-size: 13px; }
.release p { margin: 6px 0 0; color: var(--text-2); font-size: 14px; }
.ok-icon { color: var(--good); }
.release-actions { margin-top: 10px; }
.file-pick {
  display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 0 14px; margin-bottom: 12px;
  border: 1px dashed var(--line-strong); border-radius: 12px; color: var(--text-2); cursor: pointer;
}
.file-pick .icon { color: var(--amber); }
.file-pick input { position: absolute; opacity: 0; width: 1px; height: 1px; }

.dl { justify-content: flex-start; padding-top: 48px; }
.dl h1 { margin-top: 4px; }
.dl-card {
  width: 100%; text-align: left; margin: 14px 0 6px; padding: 16px; border-radius: var(--radius);
  background: linear-gradient(180deg, #17171a, var(--surface) 40%); border: 1px solid var(--line); border-top-color: #34363b;
}
.dl-notes { margin: 8px 0 0; color: var(--text-2); font-size: 14px; }
.dl-btn { margin-top: 16px; text-decoration: none; }
.dl-hash { margin: 10px 0 0; color: var(--muted); font-size: 12px; word-break: break-all; }
.dl-steps { text-align: left; margin: 14px 0 10px; padding-left: 22px; color: var(--text-2); font-size: 14px; line-height: 1.5; }
.dl-steps li { margin-bottom: 10px; }
.dl-steps b { color: var(--text); font-weight: 500; }
a.btn { text-decoration: none; }
.auth-foot { margin-top: 18px; display: flex; flex-direction: column; align-items: center; gap: 6px; }

.detail-status { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; color: var(--text-2); }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 16px 0; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }

.form-error { color: #ff8a8a; font-size: 14px; margin: 4px 0 8px; }

/* ------------------------------------------------------------- лист */

.sheet-backdrop {
  position: fixed; inset: 0; z-index: 40; background: rgba(0, 0, 0, 0.6);
  display: flex; align-items: flex-end; justify-content: center;
  animation: fade 0.18s ease-out;
}
.sheet {
  width: 100%; max-width: 640px; max-height: 92vh; display: flex; flex-direction: column;
  background: #111113; border: 1px solid var(--line-strong); border-bottom: 0;
  border-radius: 22px 22px 0 0; outline: none;
  animation: rise 0.22s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 14px 8px 6px 20px; }
.sheet-head h2 { font-size: 19px; }
.sheet-body { padding: 6px 20px 20px; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.sheet-foot {
  display: flex; gap: 10px; padding: 12px 20px calc(12px + var(--safe-b));
  border-top: 1px solid var(--line); background: #111113;
}
.sheet-foot .btn-block { flex: 1; }
@keyframes rise { from { transform: translateY(40px); opacity: 0; } }
@keyframes fade { from { opacity: 0; } }

.toast {
  position: fixed; left: 50%; bottom: calc(var(--tabbar) + var(--safe-b) + 86px); transform: translateX(-50%);
  z-index: 60; width: max-content; max-width: min(520px, calc(100% - 32px)); padding: 12px 16px; border-radius: 12px;
  background: #222226; border: 1px solid var(--line-strong); color: var(--text); font-size: 14px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5); animation: fade 0.2s;
}
.toast-error { border-color: rgba(208, 59, 59, 0.6); }

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

.auth {
  min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 10px; padding: 32px 20px calc(32px + var(--safe-b)); text-align: center; max-width: 420px; margin: 0 auto;
}
.auth h1 { font-size: 26px; font-weight: 500; }
.auth .logo { width: 84px; filter: drop-shadow(0 0 16px rgba(255, 122, 16, 0.35)); }
.auth-form { width: 100%; display: flex; flex-direction: column; gap: 12px; margin-top: 12px; text-align: left; }

/* ------------------------------------------------------------- графики */

.chart { position: relative; }
.chart-tools { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 6px; min-height: 30px; }
.chart-plot { position: relative; width: 100%; touch-action: pan-y; }
.chart-plot svg { display: block; overflow: visible; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .axis { stroke: var(--line-strong); stroke-width: 1; }
.chart .ref { stroke: var(--muted); stroke-width: 1; opacity: 0.7; }
.chart .crosshair { stroke: var(--text-2); stroke-width: 1; }
.chart .tick { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart .end-label { fill: var(--text); font-size: 12px; font-weight: 600; }
.chart .ref-label { paint-order: stroke; stroke: var(--surface); stroke-width: 4px; stroke-linejoin: round; }
.legend { list-style: none; display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 0; padding: 0; font-size: 12px; color: var(--text-2); }
.legend li { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.tooltip {
  position: absolute; top: 0; transform: translateX(-50%); pointer-events: none; z-index: 2;
  min-width: 120px; padding: 8px 10px; border-radius: 10px;
  background: rgba(30, 30, 34, 0.96); border: 1px solid var(--line-strong);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45); font-size: 12px;
}
.tt-title { color: var(--muted); margin-bottom: 4px; }
.tt-row { display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.tt-row b { font-size: 13px; color: var(--text); font-variant-numeric: tabular-nums; }
.tt-row span { color: var(--text-2); }
.tt-row i { width: 12px; height: 3px; border-radius: 2px; display: inline-block; }
.tt-total { margin-bottom: 2px; }
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
.data-table th { text-align: right; color: var(--muted); font-weight: 500; padding: 6px 4px; border-bottom: 1px solid var(--line-strong); }
.data-table td { text-align: right; padding: 6px 4px; border-bottom: 1px solid var(--line); }
.data-table th:first-child, .data-table td:first-child { text-align: left; }

.segbar-wrap { display: flex; flex-direction: column; gap: 10px; }
.segbar { position: relative; height: 28px; }
.seg {
  position: absolute; top: 0; height: 28px; border-radius: 4px; outline: none;
  color: #fff; font-size: 12px; font-weight: 600; padding-left: 8px; line-height: 28px; white-space: nowrap; overflow: visible;
}
.seg-on, .seg:focus-visible { box-shadow: 0 0 0 2px var(--surface), 0 0 0 3px var(--text-2); }
.segbar-readout { font-size: 13px; color: var(--text-2); }
.segbar-readout b { color: var(--text); }

@media (min-width: 720px) {
  .stats-grid { grid-template-columns: repeat(4, 1fr); }
  .page { padding-top: 20px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ------------------------------------------------------------- карта */

.map {
  position: relative; overflow: hidden; border-radius: 12px; margin: 4px 0 10px;
  background: #101114; touch-action: none; user-select: none; cursor: grab;
  border: 1px solid var(--line);
}
.map:active { cursor: grabbing; }
.map-tiles { position: absolute; inset: 0; filter: invert(1) hue-rotate(180deg) brightness(0.92) contrast(0.88) saturate(0.55); }
.map-tiles img { position: absolute; width: 256px; height: 256px; pointer-events: none; }
.map-overlay { position: absolute; inset: 0; pointer-events: none; overflow: visible; }
.map-track { fill: none; stroke: var(--amber); stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; }
.map-track-glow { fill: none; stroke: rgba(255, 122, 16, 0.35); stroke-width: 11; stroke-linecap: round; stroke-linejoin: round; }
.map-start { fill: #0e0e10; stroke: var(--silver-hi); stroke-width: 3; }
.map-end { fill: var(--amber); stroke: #0e0e10; stroke-width: 3; }
.map-car { fill: var(--amber); stroke: #0e0e10; stroke-width: 3; }
.map-car-core { fill: #fff; }
.map-car-pulse { fill: rgba(255, 138, 42, 0.18); stroke: rgba(255, 138, 42, 0.5); stroke-width: 1.5; animation: pulse 2.2s ease-out infinite; transform-box: fill-box; transform-origin: center; }
@keyframes pulse { 0% { transform: scale(0.5); opacity: 1; } 100% { transform: scale(1.6); opacity: 0; } }
.map-zoom { position: absolute; right: 8px; top: 8px; display: flex; flex-direction: column; gap: 6px; }
.map-zoom button {
  width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--line-strong);
  background: rgba(14, 14, 16, 0.88); color: var(--text); font-size: 20px; line-height: 1;
}
.map-attr { position: absolute; right: 6px; bottom: 4px; font-size: 10px; color: rgba(255, 255, 255, 0.55); background: rgba(0, 0, 0, 0.45); padding: 1px 5px; border-radius: 4px; }
.where-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 2px 0 8px; font-size: 14px; }

/* ------------------------------------------------------------- события календаря */

.event { display: flex; gap: 14px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.event:last-of-type { border-bottom: 0; }
.event-time { flex: none; width: 64px; display: flex; flex-direction: column; }
.event-time b { font-size: 18px; font-weight: 600; font-variant-numeric: tabular-nums; }
.event-time span { font-size: 12px; color: var(--muted); }
.event-big .event-time b { font-size: 26px; color: var(--amber-hot); text-shadow: 0 0 12px rgba(255, 122, 16, 0.35); }
.event-main { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.event-leave { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; color: var(--amber); margin-top: 2px; }
.event-leave.urgent { color: #ff7a7a; font-weight: 600; }

/* ------------------------------------------------------------- диагностика */

.card-alert { border-color: rgba(208, 59, 59, 0.45); }
.dtc { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.dtc-code {
  flex: none; min-width: 64px; text-align: center; font-weight: 600; letter-spacing: 0.04em;
  font-variant-numeric: tabular-nums; padding: 4px 8px; border-radius: 8px;
  background: var(--surface-3); color: var(--warning); border: 1px solid rgba(250, 178, 25, 0.3);
}
.dtc-code.on { color: #ff7a7a; border-color: rgba(208, 59, 59, 0.5); background: rgba(208, 59, 59, 0.12); }
.dtc-hist .dtc-code { color: var(--text-2); border-color: var(--line-strong); }
.dtc .row-title { white-space: normal; }
.readings { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.reading { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); }
.reading-name { font-size: 12px; color: var(--muted); line-height: 1.25; }
.reading-val { font-size: 20px; font-weight: 500; font-variant-numeric: tabular-nums; }
.reading-val small { font-size: 12px; color: var(--muted); margin-left: 4px; font-weight: 400; }
.reading-warn { border-color: rgba(250, 178, 25, 0.5); }
.reading-warn .reading-val { color: var(--warning); }
.reading-crit { border-color: rgba(208, 59, 59, 0.6); background: rgba(208, 59, 59, 0.1); }
.reading-crit .reading-val { color: #ff7a7a; }
.video { width: 100%; max-height: 60vh; border-radius: 12px; background: #000; }

/* ------------------------------------------------------------- калькулятор поездки */

.calc-km { display: grid; grid-template-columns: 1fr auto; align-items: end; gap: 12px; margin-bottom: 12px; }
.calc-km .toggle-row { border: 0; padding: 0 0 12px; }
.calc-people { display: flex; align-items: center; gap: 12px; margin: 4px 0 14px; }
.calc-result { margin-top: 6px; padding: 14px 16px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--line); }
.calc-total { font-size: 42px; font-weight: 500; line-height: 1.1; color: var(--amber-hot); text-shadow: 0 0 16px rgba(255, 122, 16, 0.35); font-variant-numeric: tabular-nums; }
.calc-total small { font-size: 24px; color: var(--amber-dim); margin-left: 6px; text-shadow: none; }
.calc-each { margin: 2px 0 0; color: var(--text-2); }
.calc-result .kv { margin: 12px 0 0; }

/* ------------------------------------------------------------- настройки: картинка приветствия, календари */

.intro-image { display: flex; gap: 14px; align-items: center; margin: 10px 0 14px; }
.intro-preview {
  flex: none; width: 128px; height: 72px; border-radius: 10px; overflow: hidden; display: grid; place-items: center;
  background: #000; border: 1px solid var(--line-strong); color: var(--muted); font-size: 11px; text-align: center; padding: 4px;
}
.intro-preview img { width: 100%; height: 100%; object-fit: contain; }
.intro-actions { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.btn.disabled { opacity: 0.5; pointer-events: none; }
.textarea { min-height: 84px; padding: 10px 14px; resize: vertical; font-family: inherit; line-height: 1.4; }

/* ------------------------------------------------------------- новая версия приложения */

.update-banner {
  position: fixed; left: 12px; right: 12px; z-index: 40;
  bottom: calc(var(--tabbar) + var(--safe-b) + 12px);
  max-width: 560px; margin: 0 auto;
  display: flex; align-items: center; gap: 10px;
  padding: 10px 10px 10px 14px; border-radius: 14px;
  background: #1d150d; border: 1px solid var(--amber); color: var(--text);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.6), 0 0 18px rgba(255, 122, 16, 0.18);
}
.update-banner .icon { color: var(--amber); }
.update-banner span { flex: 1; font-size: 14px; }
