:root {
  color-scheme: light;
  --ink: #202b25;
  --ink-soft: #56635b;
  --muted: #5f6b62;
  --line: #e8ebe6;
  --paper: #fff;
  --canvas: #f5f6f2;
  --green: #2f4739;
  --green-soft: #e9f2ea;
  --lime: #d7ed88;
  --blue: #a7c7f5;
  --orange: #f4c18b;
  --lavender: #d5c6ef;
  --shadow: 0 8px 26px rgba(34, 47, 39, .035);
  font-family: "DM Sans", Arial, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 24px; }
#live, #history, #vehicle { scroll-margin-top: 86px; }
body { margin: 0; min-width: 0; background: var(--canvas); color: var(--ink); font-size: 15px; line-height: 1.5; }
button, input, textarea { font: inherit; }
button { color: inherit; }
svg { fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.app-shell { min-height: 100vh; }
.page-view[hidden] { display: none !important; }
.dashboard-history-grid { grid-template-columns: minmax(0, 1fr); }
.vehicles-view .vehicle-panel { width: min(100%, 760px); }

.sidebar {
  position: fixed; inset: 0 auto 0 0; z-index: 4; display: flex; width: 248px; flex-direction: column;
  padding: 27px 19px 18px; border-right: 1px solid #e8ebe5; background: #fbfcf9;
}
.brand { display: inline-flex; align-items: center; gap: 10px; width: fit-content; margin: 0 0 58px 6px; color: var(--ink); text-decoration: none; font: 800 18px/1.15 "Manrope", Arial, sans-serif; letter-spacing: -.5px; }
.brand-mark { display: grid; width: 34px; height: 34px; place-items: center; border-radius: 11px; background: var(--green); color: #e8f4c4; }
.brand-mark svg { width: 25px; height: 25px; stroke-width: 1.8; }
.brand-period, .title-period { color: #93aa53; }
.side-label, .panel-kicker { color: #58665c; font-size: 12px; font-weight: 700; letter-spacing: .8px; }
.side-label { margin: 0 0 12px 12px; }
.side-nav { display: grid; gap: 5px; }
.nav-link { position: relative; display: flex; min-height: 45px; align-items: center; gap: 12px; padding: 0 12px; border-radius: 9px; color: #59665d; font-size: 14px; font-weight: 500; text-decoration: none; transition: background .2s, color .2s; }
.nav-link:hover { background: #f1f3ee; color: var(--ink); }
.nav-link.active { background: #edf2eb; color: var(--green); font-weight: 700; }
.nav-link.active::before { position: absolute; top: 12px; bottom: 12px; left: 0; width: 3px; border-radius: 0 4px 4px 0; background: #8ca65f; content: ""; }
.nav-link svg { width: 18px; height: 18px; }
.nav-count { display: grid; width: 21px; height: 21px; place-items: center; margin-left: auto; border-radius: 7px; background: #fff; color: #526055; font-size: 12px; }
.main-content { display: flex; min-width: 0; min-height: 100vh; flex-direction: column; margin-left: 248px; }
.topbar { position: sticky; top: 0; z-index: 3; display: flex; height: 68px; align-items: center; justify-content: space-between; padding: 0 42px; border-bottom: 1px solid #e9ece7; background: rgba(250, 251, 248, .92); backdrop-filter: blur(12px); }
.breadcrumb { display: flex; align-items: center; gap: 11px; color: #536057; font-size: 14px; }
.breadcrumb strong { color: #4e5b52; font-weight: 600; }
.crumb-slash { color: #c3c9c4; }
.topbar-actions { display: flex; align-items: center; gap: 17px; }
.connection-pill { display: inline-flex; align-items: center; gap: 7px; color: #4e5b52; font-size: 13px; font-weight: 600; }
.connection-dot, .vehicle-status-dot, .table-live span, .stat-foot-dot { width: 7px; height: 7px; border-radius: 50%; background: #b7c1b8; }
.connection-pill.is-live .connection-dot { background: #6ca76f; box-shadow: 0 0 0 3px rgba(108, 167, 111, .14); }
.connection-pill.is-error .connection-dot { background: #cf755e; }
.button { display: inline-flex; min-height: 40px; align-items: center; justify-content: center; gap: 8px; padding: 0 13px; border: 1px solid transparent; border-radius: 8px; font-size: 13px; font-weight: 600; cursor: pointer; transition: transform .18s, background .18s, border-color .18s; }
.button:hover { transform: translateY(-1px); }
.button:focus-visible, .nav-link:focus-visible, .vehicle-link:focus-visible, .range-tab:focus-visible { outline: 3px solid #b8cf91; outline-offset: 2px; }
.button svg { width: 15px; height: 15px; }
.button-dark { background: var(--green); color: #fff; }
.button-dark:hover { background: #243a2c; }
.button-light { border-color: #e7ebe5; background: #fff; color: #58645c; }
.button-light:hover { border-color: #cfd7ce; background: #fbfcfa; }
.reconnect-button { min-height: 38px; border-radius: 7px; font-size: 13px; }
.page-content { width: 100%; max-width: 1440px; flex: 1 0 auto; margin: 0 auto; padding: 38px 42px 28px; }
.app-footer { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 5px; padding: 15px 42px 18px; border-top: 1px solid #e8ebe6; color: #536057; font-size: 13px; }
.app-footer strong { color: #344439; font-weight: 700; letter-spacing: .04em; }
.page-heading { display: flex; align-items: end; justify-content: space-between; margin-bottom: 26px; }
h1, h2, p { margin: 0; }
h1 { font: 700 32px/1.2 "Manrope", Arial, sans-serif; letter-spacing: -1px; }
.page-subtitle { margin-top: 7px; color: #58665c; font-size: 16px; }
.heading-date { display: flex; align-items: center; gap: 9px; margin-bottom: 5px; color: #536057; font-size: 14px; }
.date-icon { display: grid; width: 31px; height: 31px; place-items: center; border: 1px solid #e7ebe5; border-radius: 9px; background: #fff; color: #72816f; }
.date-icon svg { width: 16px; height: 16px; }

.stat-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-bottom: 17px; }
.stat-card { position: relative; min-height: 139px; overflow: hidden; padding: 17px 18px 15px; border: 1px solid #eaede8; border-radius: 12px; background: var(--paper); box-shadow: var(--shadow); }
.stat-card-primary { border-color: #344c3c; background: #2f4739; color: #fff; }
.stat-top { display: flex; align-items: center; justify-content: space-between; }
.stat-label { color: #536057; font-size: 14px; font-weight: 600; }
.stat-card-primary .stat-label { color: #c7d2c7; }
.stat-icon { display: grid; width: 29px; height: 29px; place-items: center; border-radius: 9px; }
.stat-icon svg { width: 16px; height: 16px; }
.icon-lime { background: #e8f1d0; color: #627744; }
.icon-blue { background: #eaf1fa; color: #6b8ebd; }
.icon-orange { background: #fbf0e5; color: #bd8750; }
.stat-value { display: flex; align-items: baseline; gap: 5px; margin-top: 13px; font: 700 34px/1 "Manrope", Arial, sans-serif; letter-spacing: -1.25px; }
.stat-unit { color: #58665c; font: 500 14px "DM Sans", Arial, sans-serif; letter-spacing: 0; }
.stat-card-primary .stat-unit { color: #d0dccf; }
.stat-foot { display: flex; align-items: center; gap: 7px; margin-top: 11px; color: #59665d; font-size: 12px; }
.stat-card-primary .stat-foot { color: #c5d0c5; }
.stat-foot-dot { width: 5px; height: 5px; background: #9cb772; }
.blue-dot { background: #88addd; }
.orange-dot { background: #dcaa73; }
.stat-card-primary .stat-foot-dot { background: #c2df80; }
.card-sparkline { position: absolute; right: 12px; bottom: 10px; width: 70px; height: 23px; border-top: 1.5px solid rgba(215, 237, 136, .4); transform: skewY(-15deg); opacity: .8; }

.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.75fr) minmax(290px, .92fr); gap: 16px; margin-bottom: 17px; }
.panel { border: 1px solid #eaede8; border-radius: 12px; background: var(--paper); box-shadow: var(--shadow); }
.chart-panel { min-width: 0; padding: 21px 22px 15px; }
.panel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.panel-heading h2 { margin-top: 6px; font: 700 21px/1.25 "Manrope", Arial, sans-serif; letter-spacing: -.4px; }
.panel-subtitle { margin-top: 5px; color: #59665d; font-size: 14px; }
.live-page-heading { align-items: center; }
.live-refresh-pill { display: inline-flex; align-items: center; gap: 9px; padding: 10px 13px; border: 1px solid #dfe6dc; border-radius: 9px; background: #fff; color: #405344; font-size: 13px; font-weight: 600; }
.live-pulse-dot { width: 9px; height: 9px; border-radius: 50%; background: #6ca76f; box-shadow: 0 0 0 4px rgba(108, 167, 111, .14); }
.live-console { position: relative; overflow: hidden; padding: 30px; border: 1px solid #304c39; border-radius: 16px; background: radial-gradient(circle at 90% 5%, rgba(147, 177, 108, .22), transparent 32%), #243b2e; color: #f5f8f2; box-shadow: 0 16px 38px rgba(35, 57, 43, .14); }
.live-console-top { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-bottom: 22px; border-bottom: 1px solid rgba(235, 243, 231, .16); }
.live-vehicle-name { display: grid; gap: 5px; }
.live-vehicle-name span { color: #c3d2c2; font-size: 12px; font-weight: 700; letter-spacing: 1px; }
.live-vehicle-name strong { font: 700 22px/1.2 "Manrope", Arial, sans-serif; }
.live-updated-at { color: #d0dbcf; font-size: 13px; text-align: right; }
.live-values { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-top: 22px; }
.live-value-card { min-height: 205px; padding: 24px; border: 1px solid rgba(240, 246, 237, .17); border-radius: 12px; background: rgba(255, 255, 255, .075); }
.live-value-heading { display: flex; align-items: center; justify-content: space-between; color: #dbe5d8; font-size: 15px; font-weight: 600; }
.live-value-heading span:last-child { color: #cfeb9a; font-size: 11px; font-weight: 700; letter-spacing: 1px; }
.live-value-number { display: flex; align-items: baseline; gap: 9px; margin-top: 25px; }
.live-value-number strong { font: 700 clamp(42px, 6vw, 64px)/1 "Manrope", Arial, sans-serif; letter-spacing: -2px; }
.live-value-number span { color: #d6e0d3; font-size: 17px; }
.live-value-note { margin-top: 12px; color: #d1ddcf; font-size: 13px; }
.live-console-footer { display: flex; justify-content: space-between; gap: 12px; margin-top: 24px; padding-top: 16px; border-top: 1px solid rgba(235, 243, 231, .16); color: #d0dbcf; font-size: 13px; }
.live-console-footer code { color: #e4eddd; font: 600 13px "DM Sans", Arial, sans-serif; }
.range-tabs { display: flex; gap: 2px; padding: 3px; border: 1px solid #edf0eb; border-radius: 7px; background: #fafbf9; }
.range-tab { min-width: 40px; height: 32px; padding: 0 7px; border: 0; border-radius: 5px; background: transparent; color: #56635b; font-size: 12px; font-weight: 700; cursor: pointer; }
.range-tab:hover { color: #435147; }
.range-tab.selected { background: #e9efe6; color: #3c5742; }
.chart-summary { display: flex; align-items: center; gap: 7px; margin-top: 20px; color: #56635b; font-size: 13px; }
.chart-summary strong { color: #3e4c42; font: 700 20px "Manrope", Arial, sans-serif; letter-spacing: -.4px; }
.chart-summary-separator { width: 3px; height: 3px; margin: 0 2px; border-radius: 50%; background: #bdc5bd; }
.chart-wrap { position: relative; height: 175px; margin: 5px 0 0; }
.history-chart { display: block; width: 100%; height: 100%; overflow: visible; }
.chart-grid-line { stroke: #edf0ec; stroke-width: 1; }
.chart-area { fill: url(#chartFill); }
.chart-line { fill: none; stroke: #778f5a; stroke-width: 2.3; vector-effect: non-scaling-stroke; }
.chart-point { fill: #fff; stroke: #718b52; stroke-width: 2; vector-effect: non-scaling-stroke; }
.chart-tooltip { position: absolute; z-index: 1; display: none; min-width: 112px; padding: 8px 10px; border-radius: 7px; background: #293d30; color: #fff; font-size: 12px; line-height: 1.5; pointer-events: none; box-shadow: 0 5px 15px #1c2a2033; }
.chart-tooltip strong { display: block; font-size: 13px; }
.chart-x-labels { display: flex; justify-content: space-between; margin: 1px 5px 0; color: #58665c; font-size: 12px; }
.vehicle-panel { min-width: 0; padding: 21px 20px 16px; }
.vehicle-heading { align-items: center; }
.vehicle-status { display: inline-flex; align-items: center; gap: 7px; padding: 7px 10px; border-radius: 20px; background: #f1f6ee; color: #49613f; font-size: 13px; font-weight: 700; }
.vehicle-status-dot { width: 5px; height: 5px; background: #7ca16d; }
.vehicle-status.is-online { background: #edf5e9; color: #557646; }
.vehicle-status.is-online .vehicle-status-dot { background: #6ca76f; box-shadow: 0 0 0 3px rgba(108, 167, 111, .14); }
.vehicle-status.is-offline { background: #fff0ed; color: #a35142; }
.vehicle-status.is-offline .vehicle-status-dot { background: #cf755e; }
.vehicle-status.is-unknown { background: #f3f5f2; color: #536057; }
.vehicle-status.is-unknown .vehicle-status-dot { background: #aab3ab; }
.vehicle-illustration { position: relative; display: flex; height: 152px; align-items: end; justify-content: center; margin: 4px -6px 2px; overflow: hidden; }
.vehicle-glow { position: absolute; right: 5%; bottom: 13px; left: 5%; height: 68px; border-radius: 50%; background: radial-gradient(ellipse, #edf2e8 0, #f8faf6 64%, transparent 72%); }
.car-art { position: relative; width: min(100%, 330px); height: 136px; overflow: visible; }
.vehicle-details { padding-top: 12px; border-top: 1px solid #edf0ec; }
.vehicle-name { display: flex; align-items: center; gap: 9px; padding-bottom: 13px; }
.vehicle-name div { display: grid; gap: 4px; }
.vehicle-name strong { font-size: 16px; }
.vehicle-name small { color: #536057; font-size: 13px; }
.vehicle-reading { display: flex; justify-content: space-between; gap: 8px; padding: 9px 0; border-top: 1px solid #f0f2ef; color: #536057; font-size: 13px; }
.vehicle-reading strong { color: #37453b; font-size: 13px; font-weight: 700; text-align: right; }
.vehicle-reading strong small { color: #536057; font-size: 12px; font-weight: 500; }
.vehicle-updated { font-size: 12px !important; }
.vehicle-link { display: flex; justify-content: space-between; margin-top: 8px; padding-top: 12px; border-top: 1px solid #edf0ec; color: #4c6938; font-size: 13px; font-weight: 600; text-decoration: none; }
.vehicle-link:hover { color: #344c3c; }

.history-panel { overflow: hidden; }
.history-heading { align-items: center; padding: 18px 21px 15px; }
.history-actions { display: flex; align-items: center; gap: 9px; }
.search-box { display: flex; width: 190px; height: 38px; align-items: center; gap: 7px; padding: 0 10px; border: 1px solid #dfe5dd; border-radius: 7px; background: #fff; color: #536057; }
.search-box svg { width: 14px; height: 14px; flex: 0 0 auto; }
.search-box input { width: 100%; min-width: 0; border: 0; outline: 0; color: var(--ink); font-size: 13px; }
.search-box input::placeholder { color: #59665d; }
.export-button { min-height: 40px; padding: 0 12px; font-size: 13px; }
.export-button svg { width: 13px; height: 13px; }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; }
thead { background: #fafbf9; }
th { padding: 11px 16px; color: #536057; font-size: 12px; font-weight: 700; letter-spacing: .45px; white-space: nowrap; }
th:first-child, td:first-child { padding-left: 21px; }
td { padding: 13px 16px; border-top: 1px solid #f0f2ef; color: #435047; font-size: 13px; white-space: nowrap; }
td:first-child { color: #536057; font-weight: 600; }
.activity-badge { display: inline-flex; align-items: center; gap: 6px; padding: 6px 9px; border-radius: 15px; background: #f3f5f1; color: #4f5c52; font-size: 12px; }
.activity-badge::before { width: 5px; height: 5px; border-radius: 50%; background: #aeb8ac; content: ""; }
.activity-badge.moving { background: #f0f5e8; color: #71844d; }
.activity-badge.moving::before { background: #91aa64; }
.table-loading, .table-empty { padding: 28px 16px; color: #536057; font-size: 13px; text-align: center; }
.table-footer { display: flex; justify-content: space-between; gap: 10px; padding: 12px 21px; border-top: 1px solid #f0f2ef; color: #536057; font-size: 12px; }
.table-live { display: inline-flex; align-items: center; gap: 6px; }
.table-live span { width: 5px; height: 5px; background: #8ba970; }
.toast { position: fixed; right: 24px; bottom: 22px; z-index: 6; max-width: min(360px, calc(100% - 32px)); padding: 12px 15px; border: 1px solid #dfe5dc; border-radius: 9px; background: #fff; color: #35433a; font-size: 14px; opacity: 0; pointer-events: none; transform: translateY(8px); transition: opacity .2s, transform .2s; box-shadow: 0 8px 26px #273a2c1a; }
.toast.visible { opacity: 1; transform: translateY(0); }
.toast.error { border-color: #efdbd5; color: #9b5142; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; clip-path: inset(50%); }
@keyframes spin { to { transform: rotate(360deg); } }

@media (min-width: 1500px) { .page-content { padding-right: 52px; padding-left: 52px; } }
@media (max-width: 1160px) {
  .sidebar { width: 210px; padding-right: 15px; padding-left: 15px; }
  .main-content { margin-left: 210px; }
  .topbar { padding-right: 28px; padding-left: 28px; }
  .page-content { padding-right: 28px; padding-left: 28px; }
  .dashboard-grid { grid-template-columns: minmax(0, 1.5fr) minmax(260px, .9fr); }
  .dashboard-grid.dashboard-history-grid { grid-template-columns: minmax(0, 1fr); }
  .stat-card { padding-right: 14px; padding-left: 14px; }
}
@media (max-width: 900px) {
  .sidebar { width: 70px; align-items: center; padding: 22px 9px 15px; }
  .brand { margin: 0 0 47px; }
  .brand > span:last-child, .side-label, .nav-link span:not(.nav-count), .nav-count { display: none; }
  .nav-link { width: 46px; justify-content: center; padding: 0; }
  .main-content { margin-left: 70px; }
}
@media (max-width: 700px) {
  .topbar { height: 59px; padding: 0 18px; }
  .breadcrumb { font-size: 12px; }
  .topbar-actions { gap: 8px; }
  .connection-pill { font-size: 13px; }
  .connection-dot { width: 8px; height: 8px; }
  .reconnect-button { min-width: 0; padding: 0 9px; }
  .reconnect-button svg { width: 17px; height: 17px; }
  .page-content { padding: 28px 18px 22px; }
  .app-footer { padding: 14px 18px 18px; }
  .page-heading { align-items: flex-start; }
  h1 { font-size: 28px; }
  .page-subtitle { max-width: 220px; font-size: 15px; }
  .heading-date { max-width: 130px; align-items: flex-start; margin-top: 5px; font-size: 13px; line-height: 1.4; }
  .date-icon { width: 29px; height: 29px; flex: 0 0 auto; }
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard-grid { grid-template-columns: 1fr; }
  .live-console { padding: 24px; }
  .live-value-card { min-height: 185px; padding: 21px; }
  .vehicle-panel { display: grid; grid-template-columns: 1fr 1.1fr; align-items: center; column-gap: 13px; }
  .vehicle-heading { grid-column: 1 / -1; }
  .vehicle-illustration { grid-row: 2; height: 130px; margin: 4px 0; }
  .car-art { height: 110px; }
  .vehicle-details { grid-row: 2; padding-top: 8px; }
  .vehicle-link { grid-column: 1 / -1; }
}
@media (max-width: 480px) {
  .sidebar { width: 55px; padding-right: 5px; padding-left: 5px; }
  .brand-mark { width: 32px; height: 32px; }
  .nav-link { width: 41px; min-height: 42px; }
  .main-content { margin-left: 55px; }
  .topbar { padding-right: 12px; padding-left: 13px; }
  .breadcrumb { gap: 6px; font-size: 12px; }
  .topbar-actions { gap: 8px; }
  .page-content { padding-right: 12px; padding-left: 12px; }
  .page-heading { gap: 8px; }
  h1 { font-size: 24px; }
  .page-subtitle { max-width: 190px; font-size: 14px; }
  .heading-date { max-width: 96px; gap: 5px; font-size: 12px; }
  .date-icon { width: 26px; height: 26px; }
  .stat-grid { gap: 8px; margin-bottom: 10px; }
  .stat-card { min-height: 122px; padding: 13px 10px 11px; border-radius: 10px; }
  .stat-label { font-size: 12px; }
  .stat-icon { width: 25px; height: 25px; }
  .stat-icon svg { width: 14px; height: 14px; }
  .stat-value { margin-top: 11px; font-size: 24px; }
  .stat-foot { gap: 5px; font-size: 12px; }
  .dashboard-grid { gap: 10px; margin-bottom: 10px; }
  .live-page-heading { align-items: flex-start; flex-direction: column; }
  .live-console { padding: 18px; border-radius: 12px; }
  .live-console-top { align-items: flex-start; flex-direction: column; gap: 12px; }
  .live-updated-at { text-align: left; }
  .live-values { grid-template-columns: 1fr; gap: 10px; margin-top: 16px; }
  .live-value-card { min-height: 150px; padding: 18px; }
  .live-value-number { margin-top: 18px; }
  .live-console-footer { font-size: 12px; }
  .live-console-footer code { font-size: 12px; }
  .chart-panel, .vehicle-panel { padding: 16px 13px 13px; }
  .chart-panel { overflow: hidden; }
  .chart-panel .panel-heading { flex-direction: column; }
  .range-tabs { align-self: flex-start; }
  .vehicle-heading { align-items: flex-start; flex-direction: column; gap: 7px; }
  .panel-heading h2 { font-size: 18px; }
  .panel-subtitle { font-size: 12px; }
  .range-tab { min-width: 36px; height: 29px; padding: 0 5px; font-size: 12px; }
  .chart-wrap { height: 150px; }
  .vehicle-panel { grid-template-columns: .9fr 1.1fr; column-gap: 8px; }
  .vehicle-illustration { height: 105px; }
  .car-art { height: 88px; }
  .vehicle-reading { font-size: 12px; }
  .vehicle-reading strong { font-size: 12px; }
  .vehicle-name small { font-size: 12px; }
  .history-heading { align-items: flex-start; padding: 15px 12px 13px; }
  .history-actions { flex-direction: column-reverse; align-items: flex-end; gap: 6px; }
  .search-box { width: 100%; max-width: 145px; height: 36px; }
  .export-button { min-height: 36px; }
  th { padding: 10px 11px; font-size: 12px; }
  td { padding: 11px 11px; font-size: 12px; }
  th:first-child, td:first-child { padding-left: 12px; }
  .table-footer { padding: 11px 12px; font-size: 12px; }
}
@media (max-width: 360px) {
  .breadcrumb { display: none; }
  .page-heading { display: block; }
  .heading-date { max-width: none; margin-top: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
