/* Nexaris GPS - road-sign typography (Barlow), petrol-teal brand, status colours borrowed from signage */
@font-face { font-family: 'Barlow'; font-weight: 400; src: url(fonts/barlow-latin-400-normal.woff2) format('woff2'); font-display: swap; }
@font-face { font-family: 'Barlow'; font-weight: 500; src: url(fonts/barlow-latin-500-normal.woff2) format('woff2'); font-display: swap; }
@font-face { font-family: 'Barlow'; font-weight: 600; src: url(fonts/barlow-latin-600-normal.woff2) format('woff2'); font-display: swap; }
@font-face { font-family: 'Barlow'; font-weight: 700; src: url(fonts/barlow-latin-700-normal.woff2) format('woff2'); font-display: swap; }
@font-face { font-family: 'Barlow Semi Condensed'; font-weight: 500; src: url(fonts/barlow-semi-condensed-latin-500-normal.woff2) format('woff2'); font-display: swap; }
@font-face { font-family: 'Barlow Semi Condensed'; font-weight: 600; src: url(fonts/barlow-semi-condensed-latin-600-normal.woff2) format('woff2'); font-display: swap; }
@font-face { font-family: 'Barlow Semi Condensed'; font-weight: 700; src: url(fonts/barlow-semi-condensed-latin-700-normal.woff2) format('woff2'); font-display: swap; }

:root {
  --bg: #EDF1F0; --surface: #FFFFFF; --surface-2: #F4F7F6; --ink: #14222A; --muted: #55656D; --line: #D6DDDE;
  --brand: #0E5E6F; --brand-ink: #FFFFFF; --brand-soft: #DCEBEE;
  --moving: #1B8F4E; --idle: #C98A00; --stopped: #4F6D8A; --offline: #838E94;
  --danger: #C0332C; --warning: #C98A00; --info: #4F6D8A;
  --font: 'Barlow', system-ui, 'Segoe UI', sans-serif; --font-display: 'Barlow Semi Condensed', 'Barlow', system-ui, sans-serif;
  --rail: 232px; --top: 56px;
  --focus: 0 0 0 3px color-mix(in srgb, var(--brand) 35%, transparent);
}
:root[data-theme='dark'] {
  --bg: #0D171B; --surface: #13222A; --surface-2: #1A2C35; --ink: #E3ECEE; --muted: #8DA1A9; --line: #263A42;
  --brand: #55B8CC; --brand-ink: #062229; --brand-soft: #16363F;
  --moving: #3FCB7E; --idle: #F0B429; --stopped: #80A5C9; --offline: #6C7B82;
  --danger: #F2706A; --warning: #F0B429; --info: #80A5C9;
}
* { box-sizing: border-box; }
html, body, #app { height: 100%; margin: 0; }
body { font-family: var(--font); font-size: 15px; line-height: 1.45; color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; }
h1, h2, h3 { font-family: var(--font-display); font-weight: 600; margin: 0; letter-spacing: .005em; }
h1 { font-size: 22px; } h2 { font-size: 18px; } h3 { font-size: 15px; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--brand); }
.num, td.num, .kpi-value { font-variant-numeric: tabular-nums; }
:focus-visible { outline: none; box-shadow: var(--focus); }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
svg.i { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ---------- controls ---------- */
.btn { display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 14px; border: 1px solid var(--line); background: var(--surface); border-radius: 6px; cursor: pointer; font-weight: 500; white-space: nowrap; }
.btn:hover { border-color: var(--brand); }
.btn.primary { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--danger); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.sm { height: 30px; padding: 0 10px; font-size: 13px; }
.btn.icon { width: 36px; padding: 0; justify-content: center; }
.btn.sm.icon { width: 30px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field > label { font-size: 13px; font-weight: 500; color: var(--muted); }
.field .help { font-size: 12px; color: var(--muted); }
input[type=text], input[type=password], input[type=number], input[type=date], input[type=search], select, textarea {
  height: 36px; width: 100%; padding: 0 10px; background: var(--surface); border: 1px solid var(--line); border-radius: 6px; min-width: 0;
}
textarea { height: auto; padding: 8px 10px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: var(--focus); }
input[type=color] { width: 44px; height: 36px; padding: 2px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; background: var(--surface); }
.seg button { border: 0; background: transparent; padding: 0 12px; height: 34px; cursor: pointer; font-weight: 500; color: var(--muted); }
.seg button + button { border-left: 1px solid var(--line); }
.seg button[aria-pressed=true] { background: var(--brand); color: var(--brand-ink); }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; }
.muted { color: var(--muted); }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: var(--rail) 1fr; grid-template-rows: var(--top) minmax(0, 1fr); height: 100%; }
.rail { grid-row: 1 / 3; background: var(--surface); border-right: 1px solid var(--line); display: flex; flex-direction: column; z-index: 1200; }
.brand { height: var(--top); display: flex; align-items: center; gap: 10px; padding: 0 18px; border-bottom: 1px solid var(--line); }
.brand-mark { width: 26px; height: 26px; flex: none; }
.brand-name { font-family: var(--font-display); font-weight: 700; font-size: 20px; letter-spacing: .01em; line-height: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav { padding: 10px 10px; display: flex; flex-direction: column; gap: 2px; overflow-y: auto; }
.nav a { display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 6px; color: var(--muted); text-decoration: none; font-weight: 500; position: relative; }
.nav a:hover { background: var(--surface-2); color: var(--ink); }
.nav a[aria-current=page] { background: var(--brand-soft); color: var(--brand); }
.nav a[aria-current=page]::before { content: ''; position: absolute; left: -10px; top: 8px; bottom: 8px; width: 3px; background: var(--brand); border-radius: 0 3px 3px 0; }
.nav .badge { margin-left: auto; background: var(--danger); color: #fff; border-radius: 99px; font-size: 11px; min-width: 20px; height: 20px; display: grid; place-items: center; padding: 0 6px; font-weight: 600; }
.rail-foot { margin-top: auto; padding: 12px 18px; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--muted); }
.rail-foot .live-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--offline); margin-right: 6px; }
.rail-foot .live-dot.on { background: var(--moving); }
.top { grid-column: 2; display: flex; align-items: center; gap: 12px; padding: 0 20px; background: var(--surface); border-bottom: 1px solid var(--line); }
.top h1 { margin-right: auto; font-size: 20px; }
.burger { display: none; }
.user-menu { position: relative; }
.user-btn { display: flex; align-items: center; gap: 10px; border: 1px solid var(--line); background: var(--surface); border-radius: 6px; height: 36px; padding: 0 10px; cursor: pointer; }
.avatar { width: 24px; height: 24px; border-radius: 50%; background: var(--brand); color: var(--brand-ink); display: grid; place-items: center; font-size: 12px; font-weight: 700; }
.menu { position: absolute; right: 0; top: 42px; min-width: 210px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 6px; z-index: 1500; box-shadow: 0 8px 24px rgba(0, 0, 0, .18); }
.menu .who { padding: 8px 10px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.menu .who small { color: var(--muted); display: block; }
.menu button { display: flex; width: 100%; gap: 10px; align-items: center; border: 0; background: transparent; padding: 8px 10px; border-radius: 6px; cursor: pointer; text-align: left; }
.menu button:hover { background: var(--surface-2); }
main { grid-column: 2; overflow: auto; position: relative; }
.page { padding: 20px; max-width: 1500px; margin: 0 auto; }
.page.full { max-width: none; padding: 0; height: 100%; }

/* ---------- panels ---------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; }
.panel-h { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.panel-h h2 { font-size: 16px; margin-right: auto; }
.panel-b { padding: 16px; }
.grid { display: grid; gap: 16px; }
.grid.dash { grid-template-columns: repeat(12, 1fr); }
.span-4 { grid-column: span 4; } .span-5 { grid-column: span 5; } .span-6 { grid-column: span 6; } .span-7 { grid-column: span 7; } .span-8 { grid-column: span 8; } .span-12 { grid-column: span 12; }

/* fleet pulse: the status bar doubles as a road with a centre line */
.pulse { padding: 18px 20px 14px; }
.pulse-top { display: flex; align-items: flex-end; gap: 28px; flex-wrap: wrap; }
.pulse-total { font-family: var(--font-display); font-weight: 700; font-size: 56px; line-height: .9; }
.pulse-total small { display: block; font-size: 13px; font-weight: 500; color: var(--muted); font-family: var(--font); margin-top: 6px; }
.pulse-bar { flex: 1 1 360px; min-width: 260px; }
.road { position: relative; display: flex; height: 22px; border-radius: 4px; overflow: hidden; background: var(--line); }
.road span { height: 100%; transition: flex-basis .6s ease; min-width: 0; }
.road::after { content: ''; position: absolute; left: 0; right: 0; top: 50%; height: 2px; margin-top: -1px; background: repeating-linear-gradient(90deg, rgba(255, 255, 255, .7) 0 9px, transparent 9px 18px); pointer-events: none; }
.legend { display: flex; gap: 22px; flex-wrap: wrap; margin-top: 12px; }
.legend button { display: flex; align-items: center; gap: 8px; border: 0; background: none; cursor: pointer; padding: 0; font-size: 14px; }
.legend b { font-family: var(--font-display); font-size: 18px; font-variant-numeric: tabular-nums; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex: none; }
.s-moving { background: var(--moving); } .s-idle { background: var(--idle); } .s-stopped { background: var(--stopped); } .s-offline { background: var(--offline); }
.kpis { display: contents; }
.kpi { padding: 14px 16px; }
.kpi-label { font-size: 13px; color: var(--muted); font-weight: 500; }
.kpi-value { font-family: var(--font-display); font-size: 32px; font-weight: 600; line-height: 1.15; margin-top: 2px; }
.kpi-value small { font-size: 14px; font-weight: 500; color: var(--muted); margin-left: 4px; font-family: var(--font); }
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; align-items: center; gap: 12px; padding: 10px 16px; border-bottom: 1px solid var(--line); }
.list li:last-child { border-bottom: 0; }
.list .title { font-weight: 500; }
.list .sub { font-size: 12.5px; color: var(--muted); }
.sev { width: 4px; align-self: stretch; border-radius: 2px; flex: none; }
.sev.warning { background: var(--warning); } .sev.critical { background: var(--danger); } .sev.info { background: var(--info); }
.empty { padding: 28px 16px; text-align: center; color: var(--muted); }
.map-panel { display: flex; flex-direction: column; }
.mini-map { flex: 1; min-height: 340px; border-radius: 0 0 8px 8px; }
.chart-box { position: relative; height: 240px; }

/* ---------- tables ---------- */
.table-wrap { overflow: auto; max-height: calc(100vh - 260px); border-top: 1px solid var(--line); }
table.data { border-collapse: separate; border-spacing: 0; width: 100%; font-size: 14px; }
table.data th { position: sticky; top: 0; background: var(--surface-2); text-align: left; font-weight: 600; font-size: 13px; color: var(--muted); padding: 9px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; z-index: 1; }
table.data td { padding: 9px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; max-width: 320px; overflow: hidden; text-overflow: ellipsis; }
table.data tr:hover td { background: color-mix(in srgb, var(--brand-soft) 45%, transparent); }
table.data td.r, table.data th.r { text-align: right; }
table.data tfoot td { font-weight: 700; background: var(--surface-2); position: sticky; bottom: 0; border-top: 1px solid var(--line); }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px 2px 8px; border-radius: 99px; font-size: 12.5px; font-weight: 500; background: var(--surface-2); border: 1px solid var(--line); }
.chip .dot { width: 8px; height: 8px; }
.chip.warning { border-color: var(--warning); } .chip.critical { border-color: var(--danger); color: var(--danger); }
.toolbar { display: flex; gap: 10px; align-items: center; padding: 12px 16px; flex-wrap: wrap; }
.toolbar .search { width: 260px; max-width: 100%; }

/* ---------- live map ---------- */
.map-page { display: grid; grid-template-columns: 340px 1fr; height: 100%; }
.fleet-panel { background: var(--surface); border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.fleet-panel .head { padding: 12px; display: flex; flex-direction: column; gap: 10px; border-bottom: 1px solid var(--line); }
.filters { display: flex; gap: 6px; flex-wrap: wrap; }
.filters button { border: 1px solid var(--line); background: var(--surface); border-radius: 99px; padding: 2px 10px; font-size: 13px; cursor: pointer; display: inline-flex; gap: 6px; align-items: center; }
.filters button[aria-pressed=true] { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.vlist { overflow-y: auto; flex: 1; }
.vrow { display: flex; gap: 10px; align-items: center; padding: 9px 12px; border-bottom: 1px solid var(--line); cursor: pointer; }
.vrow:hover { background: var(--surface-2); }
.vrow[aria-selected=true] { background: var(--brand-soft); }
.vrow .nm { font-weight: 500; line-height: 1.2; }
.vrow .sb { font-size: 12.5px; color: var(--muted); }
.vrow .sp { margin-left: auto; text-align: right; font-variant-numeric: tabular-nums; font-size: 13px; }
.map-box { position: relative; min-height: 0; }
.map-box .leaflet-container { height: 100%; width: 100%; background: var(--surface-2); font-family: var(--font); }
:root[data-theme='dark'] .osm-tiles { filter: invert(1) hue-rotate(180deg) brightness(.92) contrast(.88) saturate(.7); }
.detail { position: absolute; top: 12px; right: 12px; width: 330px; max-width: calc(100% - 24px); max-height: calc(100% - 24px); overflow: auto; z-index: 800; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 8px 24px rgba(0, 0, 0, .18); }
.detail .dh { display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.detail .dh h2 { font-size: 18px; line-height: 1.2; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; padding: 12px 14px; font-size: 14px; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
.detail .sec { padding: 12px 14px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 10px; }
.replay { display: flex; align-items: center; gap: 8px; }
.replay input[type=range] { flex: 1; accent-color: var(--brand); }
.vm { display: grid; place-items: center; }
.vm svg { width: 22px; height: 22px; filter: drop-shadow(0 0 1.5px rgba(0, 0, 0, .55)); }
.vm.moving svg { fill: var(--moving); } .vm.idle svg { fill: var(--idle); } .vm.stopped svg { fill: var(--stopped); } .vm.offline svg { fill: var(--offline); }
.vm svg circle { stroke: #fff; stroke-width: 1.6; }
.vm.sel svg { width: 30px; height: 30px; }
.leaflet-tooltip.vt { font-family: var(--font); font-weight: 500; border-radius: 4px; padding: 2px 7px; }


/* ---------- route boxes, flags, immobilizer ---------- */
.tk-popup .leaflet-popup-content-wrapper { border-radius: 6px; padding: 0; box-shadow: 0 4px 18px rgba(0, 0, 0, .3); }
.tk-popup .leaflet-popup-content { margin: 0; font-family: var(--font); }
.tk-pop { padding: 8px 12px 10px; min-width: 210px; color: #14222A; }
.tk-pt { font-weight: 700; font-size: 14px; margin-bottom: 2px; }
.tk-pa { font-size: 12.5px; color: #55656D; margin-bottom: 2px; }
.tk-pc { font-size: 12px; color: #55656D; font-variant-numeric: tabular-nums; margin-bottom: 4px; border-bottom: 1px solid #D6DDDE; padding-bottom: 4px; }
.tk-pop table { border-collapse: collapse; width: 100%; font-size: 13px; }
.tk-pop td { padding: 1px 0; vertical-align: top; } .tk-pop td:first-child { color: #55656D; padding-right: 14px; } .tk-pop td:last-child { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.tk-flag { display: grid; place-items: center; border-radius: 6px; border: 2px solid #fff; box-shadow: 0 1px 5px rgba(0, 0, 0, .45); color: #fff; }
.tk-flag.start { background: #2F9E44; } .tk-flag.end { background: #C0332C; }
.tk-flag svg { width: 16px; height: 16px; fill: none; stroke: #fff; stroke-width: 2.2; }
.tk-lock { color: var(--danger); display: inline-flex; vertical-align: -3px; } .tk-lock svg { width: 15px; height: 15px; }
.tk-pill-lock { background: var(--danger); color: #fff; font-weight: 600; }
.tk-imm { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 6px; border: 1px solid var(--line); background: var(--surface-2); }
.tk-imm .dot { width: 10px; height: 10px; flex: none; }
.tk-imm.ok .dot { background: var(--moving); } .tk-imm.warn .dot { background: var(--idle); } .tk-imm.bad { border-color: var(--danger); } .tk-imm.bad .dot { background: var(--danger); } .tk-imm.bad b { color: var(--danger); }
.tk-ch { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.tk-ans { margin-top: 6px; font-size: 13px; padding: 6px 8px; background: var(--surface-2); border-radius: 6px; word-break: break-word; }
.vm.sel svg { filter: drop-shadow(0 0 3px var(--brand)) drop-shadow(0 0 1.5px #fff); }
.vm svg .b { stroke: #fff; stroke-width: 1.5; } .vm svg .w { stroke-width: 0; }

/* ---------- missions / places / distance tool ---------- */
.tabs-h { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 14px; }
.tabs-h button { border: 0; background: none; padding: 10px 16px; font-weight: 600; font-size: 14px; letter-spacing: .03em; text-transform: uppercase; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs-h button[aria-pressed=true] { color: var(--brand); border-bottom-color: var(--brand); }
tr.clk { cursor: pointer; }
.ms-av { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 13px; flex: none; }
.pt-badge { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 12px; flex: none; }
.pin { display: grid; place-items: center; }
.pin span { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg); border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0, 0, 0, .4); }
.pin span i { font-style: normal; transform: rotate(45deg); color: #fff; font-weight: 700; font-size: 13px; }
.ms-split { display: grid; grid-template-columns: 380px 1fr; height: calc(100vh - 150px); min-height: 420px; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--surface); }
.ms-side { overflow: auto; border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.ms-mapbox { position: relative; min-height: 0; } .ms-mapbox > div, .ms-map > div { height: 100%; width: 100%; background: var(--surface-2); }
.ms-r { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; } .ms-r span { display: block; font-size: 12px; color: var(--muted); } .ms-r b { font-family: var(--font-display); font-size: 20px; font-variant-numeric: tabular-nums; }
.modal.ms-detail { width: 1120px; } .ms-body { display: grid; grid-template-columns: 380px 1fr; min-height: 0; flex: 1; overflow: hidden; }
.ms-info { padding: 14px 18px; overflow: auto; border-right: 1px solid var(--line); max-height: 74vh; } .ms-map { min-height: 460px; }
.ms-pts { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; } .ms-pts li { display: flex; gap: 10px; align-items: flex-start; }
.modal.ms-form { width: 1180px; } .ms-fbody { display: grid; grid-template-columns: 1fr 1fr; flex: 1; min-height: 0; overflow: hidden; }
.ms-fleft { padding: 16px 18px; overflow: auto; display: flex; flex-direction: column; gap: 14px; max-height: 72vh; } .ms-fleft .two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.ms-fright { display: flex; flex-direction: column; border-left: 1px solid var(--line); } .ms-fright #fmap { flex: 1; min-height: 360px; background: var(--surface-2); } .ms-rinfo { padding: 12px 16px; border-top: 1px solid var(--line); min-height: 20px; }
.pt-card { border: 1px solid var(--line); border-radius: 8px; padding: 10px; margin-bottom: 10px; display: flex; flex-direction: column; gap: 8px; background: var(--surface-2); }
.pt-grid { display: grid; grid-template-columns: 1.6fr 1fr 1fr .8fr; gap: 6px; }
@media (max-width: 900px) { .ms-split, .ms-body, .ms-fbody { grid-template-columns: 1fr; } .ms-split { height: auto; } .ms-mapbox { height: 380px; } .ms-fleft .two { grid-template-columns: 1fr; } .pt-grid { grid-template-columns: 1fr 1fr; } }

/* ---------- fleet switcher ---------- */
.fleet-sw { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--surface); border-radius: 6px; height: 36px; padding: 0 4px 0 10px; color: var(--brand); }
.fleet-sw select { border: 0; background: transparent; height: 32px; width: auto; max-width: 190px; font-weight: 600; padding: 0 6px; color: var(--ink); }
.fleet-sw select:focus { box-shadow: none; }
input[type=color] { cursor: pointer; }

/* ---------- tracking page (objects list, detail / history panel) ---------- */
.tk { display: grid; grid-template-columns: 340px 1fr; height: 100%; }
.tk-objects { background: var(--surface); border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.tk-oh { display: flex; align-items: center; gap: 4px; padding: 10px 12px 4px 14px; }
.tk-oh h2 { font-size: 17px; }
.menu-wrap { position: relative; }
.menu-wrap .menu { right: 0; top: 36px; min-width: 200px; }
.tk-os { padding: 4px 12px 8px; }
.tk-all { display: flex; align-items: center; gap: 10px; padding: 8px 14px; border-bottom: 1px solid var(--line); border-top: 1px solid var(--line); font-size: 13.5px; cursor: pointer; }
.tk-list { overflow-y: auto; flex: 1; }
.tk-row { display: flex; gap: 10px; align-items: flex-start; padding: 9px 12px 9px 14px; border-bottom: 1px solid var(--line); cursor: pointer; }
.tk-row:hover { background: var(--surface-2); }
.tk-row[aria-selected=true] { background: var(--brand-soft); }
.tk-row .rc { margin-top: 3px; }
.tk-ico svg { width: 22px; height: 22px; }
.s-t-moving { color: var(--moving); } .s-t-idle { color: var(--idle); } .s-t-stopped { color: var(--stopped); } .s-t-offline { color: var(--offline); }
.tk-nm { min-width: 0; }
.tk-nm .n { font-weight: 600; line-height: 1.2; }
.tk-nm .m { font-size: 12.5px; color: var(--muted); display: flex; align-items: center; gap: 6px; margin-top: 2px; }
.tk-nm .m .dot { width: 8px; height: 8px; }
.tk-map { position: relative; min-height: 0; }
.tk-map .leaflet-container { height: 100%; width: 100%; background: var(--surface-2); font-family: var(--font); }
.leaflet-tooltip.vt-sel { font-weight: 700; background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.leaflet-tooltip.vt-sel::before { border-right-color: var(--brand); }
.tk-tools button { width: 34px; height: 34px; display: grid; place-items: center; background: var(--surface); color: var(--ink); border: 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.tk-tools button:last-child { border-bottom: 0; }
.tk-tools button[aria-pressed=true] { background: var(--brand); color: var(--brand-ink); }
.tk-panel { position: absolute; left: 12px; top: 12px; bottom: 12px; width: 390px; max-width: calc(100% - 24px); z-index: 800; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 8px 28px rgba(0, 0, 0, .22); }
.tk-hero { background: linear-gradient(135deg, #0E5E6F 0%, #123A47 100%); color: #fff; padding: 14px; flex: none; }
.tk-name { font-family: var(--font-display); font-size: 22px; font-weight: 700; line-height: 1.15; overflow: hidden; text-overflow: ellipsis; }
.tk-sub { opacity: .8; font-size: 13.5px; }
.tk-x { color: #fff; } .tk-x:hover { background: rgba(255, 255, 255, .16); }
.tk-hs { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.tk-pill { display: inline-flex; align-items: center; gap: 6px; background: rgba(255, 255, 255, .14); padding: 2px 10px; border-radius: 99px; font-size: 13px; }
.tk-pill svg { width: 15px; height: 15px; }
.tk-hb { background: rgba(255, 255, 255, .14); border-color: rgba(255, 255, 255, .28); color: #fff; text-decoration: none; }
.tk-hb[aria-pressed=true] { background: #fff; color: var(--brand); border-color: #fff; }
.tk-hb:hover { background: rgba(255, 255, 255, .26); border-color: #fff; }
.tk-secs { flex: 1; overflow: auto; min-height: 0; }
details.tk-sec { border-bottom: 1px solid var(--line); }
.tk-sec > summary { list-style: none; display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; cursor: pointer; font-weight: 600; }
.tk-sec > summary::-webkit-details-marker { display: none; }
.tk-sec > summary:hover { background: var(--surface-2); }
.tk-sec[open] > summary svg { transform: rotate(180deg); }
.tk-sb { padding: 0 16px 14px; }
.tk-kv { display: flex; justify-content: space-between; gap: 12px; padding: 4px 0; font-size: 14px; }
.tk-kv span { color: var(--muted); } .tk-kv b { font-weight: 500; text-align: right; font-variant-numeric: tabular-nums; }
.tk-raw summary { cursor: pointer; color: var(--brand); font-size: 13px; margin-top: 8px; }
.tk-rawg { display: grid; grid-template-columns: auto 1fr; gap: 2px 14px; font-size: 12.5px; margin-top: 6px; font-variant-numeric: tabular-nums; }
.tk-rawg span { color: var(--muted); }
.tk-ev { display: flex; gap: 10px; padding: 6px 0; font-size: 14px; }
.tk-ev.ev-click { cursor: pointer; padding: 8px 14px; border-bottom: 1px solid var(--line); } .tk-ev.ev-click:hover { background: var(--surface-2); }
.addr { word-break: break-word; }
.tk-hh { display: flex; align-items: center; gap: 8px; padding: 12px 12px 8px; flex: none; }
.tk-hh h2 { font-size: 18px; }
.tk-date { margin: 0 12px 8px; display: flex; align-items: center; gap: 8px; background: var(--brand-soft); color: var(--brand); border: 0; border-radius: 6px; padding: 8px 10px; cursor: pointer; font-weight: 500; font-size: 13.5px; text-align: left; flex: none; }
.tk-tabs { display: flex; border-bottom: 1px solid var(--line); flex: none; }
.tk-tabs button { flex: 1; border: 0; background: none; padding: 10px; font-weight: 600; font-size: 13px; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; }
.tk-tabs button[aria-pressed=true] { color: var(--brand); border-bottom-color: var(--brand); }
.tk-tb { display: flex; gap: 4px; padding: 4px 10px; border-bottom: 1px solid var(--line); flex: none; }
.tk-tb [aria-pressed=true] { background: var(--brand-soft); color: var(--brand); }
.tk-sum { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; background: var(--line); border-bottom: 1px solid var(--line); }
.tk-sum div { background: var(--surface); padding: 8px 12px; }
.tk-sum span { display: block; font-size: 12px; color: var(--muted); }
.tk-sum b { font-family: var(--font-display); font-size: 17px; font-variant-numeric: tabular-nums; }
.tk-day { padding: 6px 14px; background: var(--surface-2); font-weight: 600; font-size: 13px; color: var(--muted); border-bottom: 1px solid var(--line); }
.tk-it { display: flex; gap: 10px; padding: 10px 12px 10px 14px; border-bottom: 1px solid var(--line); cursor: pointer; align-items: flex-start; }
.tk-it:hover { background: var(--surface-2); }
.tk-bd { width: 30px; height: 30px; border-radius: 50%; flex: none; display: grid; place-items: center; color: #fff; background: var(--c, var(--brand)); font-weight: 700; font-size: 13px; }
.tk-bd svg { width: 16px; height: 16px; }
.tk-bd.park { background: var(--offline); }
.tk-ib { flex: 1; min-width: 0; }
.tk-t { font-weight: 600; font-size: 14px; font-variant-numeric: tabular-nums; }
.tk-a { font-size: 12.5px; color: var(--muted); margin-top: 2px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.tk-st { display: flex; gap: 12px; font-size: 12.5px; margin-top: 4px; font-weight: 500; flex-wrap: wrap; font-variant-numeric: tabular-nums; }
.tk-cb { margin-top: 4px; }
.tk-replay { position: absolute; right: 60px; bottom: 12px; z-index: 700; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; display: flex; align-items: center; gap: 8px; width: 380px; max-width: calc(100% - 84px); box-shadow: 0 6px 20px rgba(0, 0, 0, .18); }
.tk-replay input[type=range] { flex: 1; accent-color: var(--brand); min-width: 0; }
.tk-replay select { width: 64px; height: 30px; }
.modal.tk-picker { width: 860px; }
.tk-pb { display: grid; grid-template-columns: 160px 1fr; overflow: auto; }
.tk-presets { padding: 16px; border-right: 1px solid var(--line); display: flex; flex-direction: column; gap: 2px; }
.tk-presets b { margin-bottom: 6px; font-size: 13px; color: var(--muted); }
.tk-presets button { border: 0; background: none; text-align: left; padding: 7px 8px; border-radius: 6px; cursor: pointer; }
.tk-presets button:hover { background: var(--surface-2); }
.tk-pin { display: flex; gap: 8px; align-items: center; padding: 14px 16px; flex-wrap: wrap; }
.tk-pin input { width: auto; }
.tk-cals { display: grid; grid-template-columns: 34px 1fr 1fr 34px; gap: 8px; padding: 0 12px 16px; align-items: start; }
.cal-t { text-align: center; font-weight: 600; margin-bottom: 6px; text-transform: capitalize; }
.cal { display: grid; grid-template-columns: repeat(7, 1fr); text-align: center; gap: 2px 0; }
.cal i { font-style: normal; font-size: 12px; color: var(--muted); padding: 4px 0; }
.cal button { border: 0; background: none; height: 32px; cursor: pointer; font-size: 13px; color: var(--ink); }
.cal button:hover { background: var(--surface-2); }
.cal button.in { background: var(--brand-soft); }
.cal button.edge { background: var(--brand); color: var(--brand-ink); border-radius: 50%; }
.cal button.today { font-weight: 700; text-decoration: underline; }
@media (max-width: 900px) {
  .tk { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) minmax(0, 1fr); }
  .tk-map { order: -1; } .tk-objects { border-right: 0; border-top: 1px solid var(--line); }
  .tk-panel { left: 8px; right: 8px; width: auto; top: 8px; bottom: 8px; max-width: none; }
  .tk-pb { grid-template-columns: 1fr; } .tk-presets { flex-direction: row; flex-wrap: wrap; border-right: 0; border-bottom: 1px solid var(--line); }
  .tk-cals { grid-template-columns: 34px 1fr 34px; } .tk-cals .cal-m:nth-of-type(2) { display: none; }
  .tk-replay { right: 8px; left: 8px; width: auto; max-width: none; bottom: 8px; }
}

/* ---------- reports ---------- */
.reports { display: grid; grid-template-columns: 290px 1fr; gap: 16px; align-items: start; }
.rtypes { display: flex; flex-direction: column; }
.rtypes button { text-align: left; border: 0; border-bottom: 1px solid var(--line); background: transparent; padding: 11px 14px; cursor: pointer; border-left: 3px solid transparent; }
.rtypes button:last-child { border-bottom: 0; }
.rtypes button:hover { background: var(--surface-2); }
.rtypes button[aria-pressed=true] { background: var(--brand-soft); border-left-color: var(--brand); }
.rtypes b { display: block; font-weight: 600; } .rtypes span { font-size: 12.5px; color: var(--muted); line-height: 1.3; display: block; }
.filterbar { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; padding: 14px 16px; }
.vsel { position: relative; }
.vsel-panel { position: absolute; top: 40px; left: 0; width: 280px; max-height: 340px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; z-index: 600; display: flex; flex-direction: column; box-shadow: 0 8px 24px rgba(0, 0, 0, .18); }
.vsel-panel .opts { overflow: auto; padding: 4px 8px; }
.vsel-panel label { display: flex; gap: 8px; padding: 5px 4px; align-items: center; cursor: pointer; }
.vsel-panel .top { padding: 8px; display: block; border-bottom: 1px solid var(--line); background: none; }
.hint { padding: 42px 16px; text-align: center; color: var(--muted); }

/* ---------- report builder ---------- */
.modal.builder { width: 940px; }
.modal.builder .body { display: flex; flex-direction: column; gap: 20px; }
.builder h3 { font-size: 14px; margin: 0 0 8px; }
.builder .two, .builder .cols2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.builder footer { align-items: center; }
.collist { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: 6px; min-height: 64px; max-height: 250px; overflow: auto; }
.collist li { display: flex; align-items: center; gap: 4px; padding: 4px 8px; border-bottom: 1px solid var(--line); }
.collist li:last-child { border-bottom: 0; }
.avail { display: flex; flex-wrap: wrap; gap: 6px; align-content: flex-start; border: 1px solid var(--line); border-radius: 6px; padding: 8px; min-height: 64px; max-height: 250px; overflow: auto; }
.avail button { border: 1px solid var(--line); background: var(--surface-2); border-radius: 99px; padding: 2px 10px; cursor: pointer; font-size: 13px; }
.avail button:hover { border-color: var(--brand); color: var(--brand); }
.cond { display: grid; grid-template-columns: 1.2fr 1.1fr 1.2fr auto; gap: 8px; align-items: center; margin-bottom: 8px; }
.evts { display: flex; flex-wrap: wrap; gap: 6px 16px; }
.evts label { display: flex; gap: 6px; align-items: center; font-size: 14px; }
@media (max-width: 900px) { .builder .two, .builder .cols2 { grid-template-columns: 1fr; } .cond { grid-template-columns: 1fr 1fr; } }

/* ---------- modal / toast ---------- */
.overlay { position: fixed; inset: 0; background: rgba(8, 18, 22, .55); display: grid; grid-template-columns: minmax(0, 1fr); place-items: center; z-index: 3000; padding: 16px; }
.modal { background: var(--surface); border-radius: 10px; width: 560px; max-width: 100%; max-height: 92vh; display: flex; flex-direction: column; border: 1px solid var(--line); }
.modal header { padding: 14px 18px; border-bottom: 1px solid var(--line); display: flex; align-items: center; }
.modal header h2 { margin-right: auto; }
.modal .body { padding: 18px; overflow: auto; display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.modal .body .full { grid-column: 1 / -1; }
.modal footer { padding: 12px 18px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 10px; }
.form-error { color: var(--danger); font-size: 13.5px; grid-column: 1 / -1; }
.toasts { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 4000; }
.toast { background: var(--ink); color: var(--bg); padding: 10px 14px; border-radius: 6px; max-width: 360px; display: flex; gap: 10px; align-items: flex-start; font-size: 14px; border-left: 4px solid var(--brand); }
.toast.warning { border-left-color: var(--warning); } .toast.critical { border-left-color: var(--danger); } .toast.error { border-left-color: var(--danger); }

/* ---------- geofence editor ---------- */
.geo { display: grid; grid-template-columns: 360px 1fr; height: 100%; }
.geo-side { background: var(--surface); border-right: 1px solid var(--line); overflow: auto; display: flex; flex-direction: column; }
.geo-form { padding: 14px; display: flex; flex-direction: column; gap: 12px; border-bottom: 1px solid var(--line); background: var(--surface-2); }

/* ---------- login ---------- */
.login { min-height: 100%; display: grid; grid-template-columns: minmax(340px, 480px) 1fr; background: var(--bg); }
.login-card { background: var(--surface); padding: 56px 44px; display: flex; flex-direction: column; justify-content: center; gap: 18px; border-right: 1px solid var(--line); }
.login-card h1 { font-size: 40px; font-weight: 700; line-height: 1; }
.login-card p { margin: 0; color: var(--muted); }
.login-art { position: relative; overflow: hidden; background: var(--brand); }
.login-art svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.login .lang { position: absolute; top: 16px; right: 16px; }

@media (max-width: 1100px) {
  .grid.dash .span-4, .grid.dash .span-5, .grid.dash .span-6, .grid.dash .span-7, .grid.dash .span-8 { grid-column: span 12; }
  .reports { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .top { padding: 0 10px; gap: 8px; }
  .top h1 { font-size: 17px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .user-btn span:not(.avatar), .user-btn > svg { display: none; }
  .user-btn { padding: 0 6px; }
  .page { padding: 12px; }
  .rail { position: fixed; inset: 0 auto 0 0; width: 260px; transform: translateX(-100%); transition: transform .2s; }
  .rail.open { transform: none; box-shadow: 0 0 0 100vmax rgba(8, 18, 22, .5); }
  .top, main { grid-column: 1; }
  .burger { display: inline-flex; }
  .map-page, .geo { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) minmax(0, 1fr); }
  .map-page .map-box, .geo .map-box { order: -1; }
  .fleet-panel, .geo-side { border-right: 0; border-top: 1px solid var(--line); }
  .login { grid-template-columns: 1fr; } .login-art { display: none; }
  .modal .body { grid-template-columns: 1fr; }
  .pulse-total { font-size: 44px; }
  .detail { left: 8px; right: 8px; top: auto; bottom: 8px; width: auto; max-height: 60%; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* ---------- phones ---------- */
.menu-extra { display: none; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 4px 8px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.menu-extra button { width: auto; }
.r-mobile { display: none; }
body { overscroll-behavior-y: none; }
@media (max-width: 900px) {
  .tk { grid-template-rows: 42% minmax(0, 1fr); }
  /* the vehicle panel becomes a bottom sheet: the map stays visible above it */
  .tk-panel { position: fixed; left: 0; right: 0; bottom: 0; top: calc(var(--top) + (100vh - var(--top)) * .42); top: calc(var(--top) + (100dvh - var(--top)) * .42); width: auto; max-width: none; border-radius: 16px 16px 0 0; z-index: 900; box-shadow: 0 -6px 24px rgba(0, 0, 0, .25); padding-bottom: env(safe-area-inset-bottom, 0px); }
  .tk-hero { padding: 10px 14px; } .tk-name { font-size: 19px; }
  .leaflet-touch .leaflet-bar a { width: 36px; height: 36px; line-height: 36px; }
  /* forms and detail dialogs scroll as one page on phones */
  .ms-fbody, .ms-body { display: block; overflow: auto; }
  .ms-fleft, .ms-info { max-height: none; overflow: visible; }
  .ms-fright { border-left: 0; border-top: 1px solid var(--line); } .ms-fright #fmap { height: 300px; flex: none; min-height: 0; }
  .ms-map { height: 320px; min-height: 0; }
}
@media (max-width: 700px) {
  .top { padding: 0 8px; gap: 6px; }
  .top h1 { font-size: 17px; }
  .top #lang, .top #theme { display: none; }
  .menu-extra { display: flex; }
  .fleet-sw { padding: 0 2px 0 8px; height: 36px; }
  .fleet-sw select { max-width: 108px; font-size: 14px; }
  .user-btn { padding: 0 4px; }
  .page { padding: 10px; }
  .hm { display: none; }
  table.data th, table.data td { padding: 9px 9px; }
  .toolbar { padding: 10px 12px; } .toolbar .search { width: 100%; }
  .panel-h { flex-wrap: wrap; }
  .settings-grid { grid-template-columns: minmax(0, 1fr) !important; }
  .settings-grid .btn { white-space: normal; height: auto; min-height: 36px; padding: 6px 12px; text-align: left; }
  .modal { width: 100%; max-height: 94vh; }
  .modal.tk-picker, .modal.builder, .modal.ms-form, .modal.ms-detail { width: 100%; }
  .tk-pb { display: block; overflow: auto; }
  .tk-presets { flex-direction: row; flex-wrap: wrap; border-right: 0; border-bottom: 1px solid var(--line); padding: 10px 12px; }
  .tk-pin { padding: 10px 12px; } .tk-pin input[type=date] { flex: 1 1 140px; } .tk-pin input[type=time] { flex: 1 1 100px; } .tk-pin span { display: none; }
  .r-mobile { display: flex; gap: 8px; margin-bottom: 10px; } .r-mobile select { flex: 1; }
  .reports > section:first-child { display: none; }
  .filterbar { padding: 10px 12px; }
  .pulse-total { font-size: 40px; }
  .tabs-h { overflow-x: auto; } .tabs-h button { padding: 10px 12px; white-space: nowrap; }
  .legend { gap: 14px; }
  .seg button { padding: 0 9px; font-size: 13px; } .filterbar .seg { flex-wrap: wrap; }
}
