:root {
  --bg: #0B0F14; --panel: #121821; --line: #1E2733; --text: #E8EDF3; --muted: #8A96A6;
  --accent: #FFB020; --accent-ink: #1A1200; --ok: #3DDC97; --bad: #FF5C6C;
  --radius: 16px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--text); font: 16px/1.5 Inter, system-ui, -apple-system, sans-serif; -webkit-font-smoothing: antialiased; }
button { font: inherit; cursor: pointer; }

/* ---------- landing ---------- */
.landing { overflow: hidden; }
#routes { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 0; }
.top, .hero, .card, .foot { position: relative; z-index: 1; }
.top { display: flex; justify-content: space-between; align-items: center; padding: 20px 24px; }
.brand { display: flex; gap: 10px; align-items: center; font-weight: 800; font-size: 20px; letter-spacing: .3px; }
.dial { width: 22px; height: 22px; border-radius: 50%; border: 3px solid var(--accent); position: relative; }
.dial::after { content: ""; position: absolute; left: 50%; top: 50%; width: 8px; height: 3px; background: var(--accent); border-radius: 2px; transform-origin: 0 50%; transform: rotate(-40deg); animation: needle 3s ease-in-out infinite; }
@keyframes needle { 50% { transform: rotate(10deg); } }
.lang { background: transparent; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px; font-size: 13px; }
.lang:hover { color: var(--text); }

.hero { min-height: calc(100vh - 140px); display: flex; flex-direction: column; justify-content: center; align-items: flex-start; max-width: 1100px; margin: 0 auto; padding: 0 24px; transition: opacity .4s, transform .4s; }
.hero h1 { font-size: clamp(38px, 7vw, 84px); line-height: 1.02; letter-spacing: -2px; margin: 0 0 20px; font-weight: 800; }
.hero .sub { color: var(--muted); font-size: clamp(16px, 2vw, 20px); max-width: 560px; margin: 0 0 32px; }
.cta { background: var(--accent); color: var(--accent-ink); border: 0; border-radius: 999px; padding: 14px 30px; font-weight: 600; font-size: 17px; box-shadow: 0 0 0 0 rgba(255,176,32,.5); animation: pulse 2.4s infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 16px rgba(255,176,32,0); } 100% { box-shadow: 0 0 0 0 rgba(255,176,32,0); } }
body.signin .hero { opacity: 0; transform: translateY(-20px); pointer-events: none; }

.card { position: fixed; z-index: 2; left: 50%; top: 50%; width: min(420px, calc(100% - 32px)); transform: translate(-50%, -46%); opacity: 0;
  background: rgba(18,24,33,.92); backdrop-filter: blur(14px); border: 1px solid var(--line); border-radius: var(--radius); padding: 28px; transition: opacity .35s, transform .35s; }
body.signin .card { opacity: 1; transform: translate(-50%, -50%); }
.card h2 { margin: 0 0 18px; font-size: 22px; }
.card label { display: block; margin: 0 0 14px; font-size: 13px; color: var(--muted); }
.card input { display: block; width: 100%; margin-top: 6px; padding: 12px 14px; border-radius: 10px; border: 1px solid var(--line); background: #0E141C; color: var(--text); font-size: 16px; }
.card input:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }
.card button[type=submit] { width: 100%; margin-top: 6px; padding: 13px; border: 0; border-radius: 10px; background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.card button[disabled] { opacity: .6; cursor: wait; }
.x { position: absolute; right: 12px; top: 8px; background: none; border: 0; color: var(--muted); font-size: 26px; }
.muted { color: var(--muted); font-size: 14px; margin: -8px 0 14px; }
.err { color: var(--bad); min-height: 1.2em; margin: 10px 0 0; font-size: 14px; }
.qr { background: #fff; padding: 12px; border-radius: 12px; width: max-content; margin: 0 auto 12px; }
details { margin: 0 0 14px; font-size: 13px; color: var(--muted); }
code { display: block; word-break: break-all; margin-top: 6px; color: var(--text); }
.foot { position: fixed; bottom: 14px; left: 24px; color: var(--muted); font-size: 12px; }

/* ---------- app ---------- */
.app { min-height: 100vh; }
.app .top { border-bottom: 1px solid var(--line); }
.app .right { display: flex; gap: 12px; align-items: center; color: var(--muted); font-size: 14px; }
.app .out { background: none; border: 1px solid var(--line); color: var(--text); border-radius: 999px; padding: 6px 14px; }
.wrap { max-width: 1200px; margin: 0 auto; padding: 28px 24px; }
.wrap h1 { font-size: 28px; margin: 0 0 6px; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin-top: 22px; }
.tile { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.tile .k { color: var(--muted); font-size: 13px; }
.tile .v { font-size: 30px; font-weight: 800; margin-top: 6px; }
.tile .n { color: var(--muted); font-size: 13px; margin-top: 4px; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.chip { border: 1px solid var(--line); border-radius: 999px; padding: 4px 12px; font-size: 13px; color: var(--muted); }

@media (prefers-reduced-motion: reduce) { .cta, .dial::after { animation: none; } }

/* ---------- fleet screen ---------- */
.bar { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; align-items: center; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.tabs button { background: var(--panel); border: 1px solid var(--line); color: var(--muted); border-radius: 999px; padding: 7px 14px; font-size: 14px; }
.tabs button.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin: 18px 0; }
.kpis .v { font-size: 26px; }
.split { display: grid; grid-template-columns: 2fr 1fr; gap: 12px; margin-bottom: 12px; }
@media (max-width: 900px) { .split { grid-template-columns: 1fr; } }
#map { height: 360px; border-radius: 12px; margin: 10px 0 6px; background: #0E141C; }
.leaflet-container { font-family: Inter, sans-serif; }
.leaflet-popup-content-wrapper, .leaflet-popup-tip { background: var(--panel); color: var(--text); }
.watch { list-style: none; margin: 10px 0 0; padding: 0; max-height: 380px; overflow: auto; }
.watch li { display: flex; justify-content: space-between; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.watch li b { white-space: nowrap; font-weight: 600; }
.watch li.bad b { color: var(--bad); } .watch li.warn b { color: var(--accent); } .watch li.ok { color: var(--ok); }
.scroll { overflow-x: auto; margin-top: 10px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 900px; }
th { text-align: left; color: var(--muted); font-weight: 500; padding: 8px 10px; border-bottom: 1px solid var(--line); cursor: pointer; white-space: nowrap; user-select: none; }
th.sorted { color: var(--accent); }
td { padding: 9px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
tr:hover td { background: rgba(255,255,255,.02); }
.r { text-align: right; }
td.good { color: var(--ok); } td.bad { color: var(--bad); } td.warn { color: var(--accent); }
.foot-note { margin-top: 12px; line-height: 1.5; }
.dark-tiles { filter: invert(1) hue-rotate(180deg) brightness(.85) contrast(.9) saturate(.4); }
