/* Веб-панель «Эко-драйв». Цвета — как в Android-приложении. */
:root {
  --bg: #0e1318;
  --side: #12181e;
  --surface: #161d24;
  --surface2: #1d2630;
  --line: #2b3742;
  --ink: #eaf0f5;
  --muted: #9aa8b5;
  --accent: #34d399;
  --accent-ink: #062a1c;
  --accent-bg: #12261f;
  --accent-soft: #a7d9c3;
  --red: #f87171;
  --amber: #fbbf24;
}
* { box-sizing: border-box; min-width: 0; }
html { color-scheme: dark; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.5 Onest, system-ui, -apple-system, "Segoe UI", sans-serif; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: clamp(28px, 4vw, 38px); line-height: 1.1; letter-spacing: -0.02em; margin: 0 0 6px; text-wrap: balance; }
h2 { font-size: 20px; margin: 0 0 14px; }
.muted { color: var(--muted); }
.small { font-size: 14px; }

/* Шапка */
.top { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 24px; padding: 14px max(4vw, 16px); background: var(--side); border-bottom: 1px solid #222c36; }
.brand { font-weight: 700; font-size: 18px; color: var(--ink); display: flex; align-items: center; gap: 10px; }
.brand svg { flex: none; }
.nav { display: flex; flex-wrap: wrap; gap: 4px; flex: 1; }
.nav a { color: var(--muted); padding: 8px 12px; border-radius: 10px; font-weight: 500; }
.nav a:hover { color: var(--ink); background: var(--surface); text-decoration: none; }
.nav a.on { color: var(--ink); background: var(--accent-bg); }
.top .out { color: var(--muted); font-size: 14px; }
/* На телефоне меню — одна прокручиваемая строка под логотипом */
@media (max-width: 700px) {
  .top .out { margin-left: auto; }
  .nav { order: 3; flex: 1 1 100%; flex-wrap: nowrap; overflow-x: auto; margin: 0 -4px; }
  .nav a { flex: none; }
}

main { max-width: 1240px; margin: 0 auto; padding: 28px max(4vw, 16px) 64px; }
section { margin-top: 32px; }

/* Карточки с цифрами */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(9.5em, 1fr)); gap: 12px; margin-top: 20px; }
.card { background: var(--surface); border-radius: 14px; padding: 14px 16px; }
.card .k { font-size: 14px; color: var(--muted); }
.card .v { font-size: 28px; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.card .v small { font-size: 14px; color: var(--muted); font-weight: 500; margin-left: 4px; }
.card.hero { background: var(--accent-bg); border: 1px solid #1f4a3a; }
.card.hero .v { color: var(--accent); }
.card.hero .k, .card.hero small { color: var(--accent-soft); }

/* Таблицы */
.scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: 14px; }
table { width: 100%; border-collapse: collapse; font-size: 15px; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid #222c36; white-space: nowrap; }
th { color: var(--muted); font-weight: 500; font-size: 13px; background: var(--side); position: sticky; top: 0; }
td.n, th.n { text-align: right; font-variant-numeric: tabular-nums; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--surface); }
td a { font-weight: 500; }

/* Полосы «расход по машинам» */
.bars { display: grid; gap: 10px; }
.bar { display: grid; grid-template-columns: minmax(8em, 16em) 1fr max-content; gap: 14px; align-items: center; }
.bar .track { height: 12px; background: var(--surface2); border-radius: 6px; overflow: hidden; }
.bar .fill { height: 100%; background: var(--accent); border-radius: 6px; }
.bar .val { font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
@media (max-width: 600px) { .bar { grid-template-columns: 1fr max-content; } .bar .track { grid-column: 1 / -1; order: 3; } }

/* Формы и кнопки */
form.filters { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; margin-top: 18px; }
label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); font-weight: 500; }
input, select { height: 44px; padding: 0 12px; background: var(--bg); color: var(--ink); border: 1px solid var(--line); border-radius: 10px; font: inherit; font-size: 16px; }
input:focus, select:focus, .btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.btn { display: inline-flex; align-items: center; justify-content: center; height: 44px; padding: 0 18px; border-radius: 12px; border: 1px solid var(--line); background: transparent; color: var(--ink); font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--surface); text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: #6ee7b7; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; }

/* Метки */
.tag { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 13px; font-weight: 500; background: var(--surface2); color: var(--muted); white-space: nowrap; }
.tag.auto { background: var(--accent-bg); color: var(--accent-soft); }

/* Страница поездки */
.head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 16px; align-items: end; }
.charts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.panel { background: var(--surface); border-radius: 16px; padding: 16px; }
.panel h2 { font-size: 16px; margin-bottom: 8px; }
.chart { position: relative; height: 260px; }
#map { height: 420px; border-radius: 16px; background: var(--surface); }
@media (max-width: 900px) { .charts { grid-template-columns: 1fr; } }
dl.facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px; margin: 0; font-size: 15px; }
dl.facts dt { color: var(--muted); }
dl.facts dd { margin: 0; overflow-wrap: anywhere; }
details { margin-top: 24px; background: var(--surface); border-radius: 14px; padding: 14px 16px; }
summary { cursor: pointer; font-weight: 600; }

/* Пусто / вход */
.empty { background: var(--surface); border-radius: 16px; padding: 28px; margin-top: 24px; }
.empty code, code { background: var(--surface2); padding: 2px 6px; border-radius: 6px; font-size: 14px; }
.login { max-width: 380px; margin: 12vh auto; padding: 32px; background: var(--surface); border-radius: 18px; display: grid; gap: 16px; }
.error { color: var(--red); }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
