/* ==========================================================================
   FleetWiz-replica skin — self-contained stylesheet.
   Replicates the fleetwiz.online console: 78px navy icon rail with flyout
   submenus, royal-blue topbar, light-gray content, white widgets, colored
   alert cards, and the floating tracking console. Same class vocabulary as
   the classic pages (.card/.pill/table/button) so they render unchanged.
   ========================================================================== */
:root {
    --rail: #151d47;          /* dark navy icon rail */
    --rail-2: #1d2757;        /* rail hover / active block */
    --fly: #2740a8;           /* flyout submenu blue */
    --fly-2: #203791;
    --blue: #2a3f9d;          /* royal-blue topbar / primary */
    --blue-2: #24368a;
    --link: #2f5fd0;          /* vehicle-name link blue */
    --bg: #f0f0f1;
    --surface: #ffffff;
    --text: #43425d;
    --heading: #333333;
    --muted: #8a8ba3;
    --accent: #2a3f9d;
    --accent-weak: rgba(42, 63, 157, .10);
    --border: #e5e5ea;
    --border-soft: #efeff4;
    --edge: #e5e5ea;
    --edge-soft: #efeff4;
    --ok: #3dba6f;
    --warn: #f4c430;
    --danger: #e5484d;
    --idle: #f4c430;
    --run-c: #3dba6f;         /* status palette (donut, strips, dots) */
    --idle-c: #f4c430;
    --stop-c: #f4581c;
    --inactive-c: #2196f3;
    --nodata-c: #9e9e9e;
    --shadow: 0 1px 3px rgba(21,29,71,.10), 0 1px 2px rgba(21,29,71,.06);
    --radius: 5px;
}
:root[data-theme="dark"] {
    --bg: #0d1220;
    --surface: #161c30;
    --text: #c6cbe0;
    --heading: #eef1ff;
    --muted: #7d84a3;
    --border: #29304d;
    --border-soft: #1e2440;
    --edge: #29304d;
    --edge-soft: #1e2440;
    --accent-weak: rgba(90, 115, 220, .16);
    --link: #7d9dff;
    --shadow: 0 1px 2px rgba(0,0,0,.35), 0 6px 20px rgba(0,0,0,.35);
}
:root[data-theme="dark"] tbody tr:hover td,
:root[data-theme="dark"] table tr:hover td { background: rgba(255,255,255,.03); }
:root[data-theme="dark"] input, :root[data-theme="dark"] select, :root[data-theme="dark"] textarea { background: #10162a; }
:root[data-theme="dark"] th { background: #131931; }
:root[data-theme="dark"] .leaflet-container { background: #0d1220; }

* { box-sizing: border-box; }
html { background: var(--bg); }
body {
    margin: 0; background: var(--bg); color: var(--text);
    font: 13px/1.5 "Mukta", system-ui, "Segoe UI", sans-serif;
    -webkit-font-smoothing: antialiased;
}
body.fullbleed, body.fullbleed #layout, body.fullbleed #content { height: 100vh; }
a { color: var(--link); text-decoration: none; }
h1, h2, h3 { color: var(--heading); }

/* ---------- layout ---------- */
#layout { display: flex; min-height: 100vh; }
#content { flex: 1; min-width: 0; display: flex; flex-direction: column; }

/* ---------- icon rail (the FleetWiz signature) ---------- */
#rail {
    width: 78px; min-width: 78px; background: var(--rail);
    display: flex; flex-direction: column; align-items: stretch;
    position: sticky; top: 0; height: 100vh; z-index: 100;
}
.rail-logo {
    width: 54px; height: 54px; margin: 12px auto 6px; border-radius: 50%;
    background: radial-gradient(circle at 32% 30%, #2b3a86, #10163a 70%);
    color: #ffd54a; display: grid; place-items: center; font-size: 24px;
    border: 1px solid rgba(255,255,255,.12);
}
.rail-top { display: flex; justify-content: center; gap: 14px; padding: 6px 0 10px; border-bottom: 1px solid rgba(255,255,255,.08); }
.rail-mini { position: relative; color: #cfd4ee; font-size: 17px; }
.rail-mini:hover { color: #fff; }
.rail-badge {
    position: absolute; top: -7px; right: -10px; background: #f4c430; color: #14204d;
    font-size: 9px; font-weight: 800; padding: 0 4px; border-radius: 3px; line-height: 14px;
}
.rail-nav { flex: 1; padding-top: 6px; }
.rail-item { position: relative; }
.rail-btn {
    display: flex; flex-direction: column; align-items: center; gap: 3px; width: 100%;
    padding: 11px 2px 10px; background: none; border: none; cursor: pointer;
    color: #e8eaf6; font: 600 10.5px/1 "Mukta", sans-serif;
}
.rail-btn i { font-size: 19px; }
.rail-item:hover > .rail-btn, .rail-item.open > .rail-btn { background: var(--rail-2); color: #fff; }
.rail-item.on > .rail-btn { background: var(--rail-2); color: #fff; box-shadow: inset 3px 0 0 #ffd54a; }
.rail-foot { display: flex; justify-content: center; gap: 14px; padding: 12px 0 14px; border-top: 1px solid rgba(255,255,255,.08); }

/* flyout submenu */
.rail-fly {
    display: none; position: absolute; left: 78px; top: 0; min-width: 178px;
    background: var(--fly); box-shadow: 4px 6px 18px rgba(10,15,40,.35); z-index: 200;
}
.rail-item.has-fly:hover .rail-fly, .rail-item.open .rail-fly { display: block; }
.fly-title { color: rgba(255,255,255,.55); font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .6px; padding: 9px 14px 5px; }
.fly-link {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 9px 14px; color: #fff; font-size: 12.5px; font-weight: 500;
    border-top: 1px solid rgba(0,0,0,.12);
}
.fly-link i { font-size: 10px; opacity: .7; }
.fly-link:hover { background: var(--fly-2); }
.fly-link.on { background: var(--fly-2); box-shadow: inset 3px 0 0 #ffd54a; }

/* ---------- topbar (royal blue) ---------- */
#topbar {
    height: 42px; background: var(--blue); color: #fff;
    display: flex; align-items: center; gap: 14px; padding: 0 16px;
    position: sticky; top: 0; z-index: 90;
}
.tb-title { font-size: 15px; font-weight: 600; letter-spacing: .2px; }
.tb-right { margin-left: auto; display: flex; align-items: center; gap: 15px; }
.tb-clock { font-size: 12px; opacity: .85; font-variant-numeric: tabular-nums; white-space: pre; }
.tb-icon { position: relative; color: #fff; opacity: .85; font-size: 16px; background: none; border: none; cursor: pointer; padding: 0; }
.tb-icon:hover { opacity: 1; }
.tb-icon .dot { position: absolute; top: -6px; right: -9px; background: #f4c430; color: #14204d; font-size: 9px; font-weight: 800; padding: 0 4px; border-radius: 3px; line-height: 14px; }
.tb-user { display: flex; align-items: center; gap: 8px; }
.tb-user .av { width: 26px; height: 26px; border-radius: 50%; background: rgba(255,255,255,.2); display: grid; place-items: center; font-weight: 700; font-size: 12px; }
.tb-user .nm { font-size: 12px; font-weight: 600; }

/* ---------- main / content ---------- */
main.page { padding: 14px 16px 50px; width: 100%; }
main.bleed { flex: 1; min-height: 0; display: flex; position: relative; }
h1 { font-size: 18px; margin: 0 0 4px; }
h2 { font-size: 14px; margin: 22px 0 10px; }
.sub { color: var(--muted); margin-bottom: 14px; font-size: 12px; }

/* ==========================================================================
   Dashboard widgets
   ========================================================================== */
.fw-grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 12px; }
.fw-widget {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    box-shadow: var(--shadow); display: flex; flex-direction: column; min-width: 0; overflow: hidden;
}
.fw-whead {
    display: flex; align-items: center; gap: 8px; padding: 10px 12px 6px;
    font-size: 13px; font-weight: 700; color: var(--heading);
}
.fw-whead .spacer { flex: 1; }
.fw-whead select { width: auto; padding: 2px 6px; font-size: 11px; border-radius: 3px; }
.fw-whead .drag { color: #c5c6d4; font-size: 13px; cursor: default; }
.fw-wbody { padding: 4px 12px 12px; flex: 1; }

/* colored alert widgets */
.fw-color { position: relative; border: none; color: #fff; min-height: 148px; }
.fw-color .fw-whead { color: #fff; }
.fw-color .fw-whead select { background: #fff; color: #333; border: none; }
.fw-color .fw-whead .drag { color: rgba(255,255,255,.7); }
.fw-color .big { position: absolute; right: 14px; bottom: 42px; font-size: 30px; font-weight: 800; line-height: 1; }
.fw-color .lbl { position: absolute; right: 14px; bottom: 26px; font-size: 12px; font-weight: 600; opacity: .95; }
.fw-color .chip {
    position: absolute; right: 14px; bottom: 6px; background: rgba(40,40,60,.35);
    font-size: 10px; font-weight: 700; padding: 2px 8px; border-radius: 3px;
}
.fw-color .wm { position: absolute; left: 10px; bottom: 8px; font-size: 52px; opacity: .35; line-height: 1; }
.fw-color .note { position: absolute; left: 14px; top: 40px; right: 90px; font-size: 11px; font-weight: 600; line-height: 1.35; }
.fw-amber { background: #f2bf3a; }
.fw-red { background: #f47f7f; }
.fw-green { background: #a2c968; }
.fw-cyan { background: #45c5e5; }
.fw-purple { background: #c3aede; }
.fw-peri { background: #93a3e6; }

/* reminder widgets (Due / Overdue) */
.fw-rem { display: flex; align-items: center; justify-content: space-around; padding: 12px 6px 16px; flex: 1; }
.fw-rem .half { text-align: center; flex: 1; }
.fw-rem .half + .half { border-left: 1px solid var(--border-soft); }
.fw-rem .ic { font-size: 26px; }
.fw-rem .ic.due { color: #2196f3; }
.fw-rem .ic.over { color: #e5484d; }
.fw-rem .t { font-size: 11.5px; color: var(--muted); font-weight: 600; margin-top: 2px; }
.fw-rem .v { font-size: 24px; font-weight: 800; line-height: 1.1; }
.fw-rem .v.due { color: #2196f3; }
.fw-rem .v.over { color: #e5484d; }

/* donut + legend (Fleet Status) */
.fw-donutwrap { display: flex; align-items: center; gap: 14px; padding: 6px 12px 14px; flex: 1; }
.fw-donut { position: relative; flex: none; }
.fw-donut svg { display: block; }
.fw-donut .center { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; }
.fw-donut .center .n { font-size: 26px; font-weight: 800; color: var(--heading); line-height: 1; }
.fw-donut .center .l { font-size: 11px; color: var(--muted); font-weight: 600; }
.fw-legend { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.fw-leg {
    display: flex; align-items: center; gap: 7px; padding: 6px 10px; border-radius: 4px;
    font-size: 11.5px; font-weight: 600; cursor: pointer; white-space: nowrap;
}
.fw-leg b { font-weight: 800; }
.fw-leg .d { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.fw-leg.run { background: rgba(61,186,111,.12); } .fw-leg.run .d { background: var(--run-c); }
.fw-leg.idl { background: rgba(244,196,48,.16); } .fw-leg.idl .d { background: var(--idle-c); }
.fw-leg.stp { background: rgba(244,88,28,.12); }  .fw-leg.stp .d { background: var(--stop-c); }
.fw-leg.ina { background: rgba(33,150,243,.12); } .fw-leg.ina .d { background: var(--inactive-c); }
.fw-leg.nod { background: rgba(158,158,158,.14); } .fw-leg.nod .d { background: var(--nodata-c); }

/* fleet idle / alerts widgets */
.fw-idle { display: flex; align-items: stretch; padding: 8px 4px 4px; }
.fw-idle .half { flex: 1; text-align: center; padding: 4px 8px; }
.fw-idle .half + .half { border-left: 1px solid var(--border-soft); }
.fw-idle .t { font-size: 11.5px; color: var(--muted); font-weight: 600; line-height: 1.3; }
.fw-idle .vrow { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 6px; }
.fw-idle .vrow i { font-size: 26px; }
.fw-idle .v { font-size: 24px; font-weight: 800; }
.fw-idle .v small { font-size: 12px; font-weight: 700; }
.fw-note { padding: 8px 12px; color: var(--muted); font-size: 10.5px; line-height: 1.45; border-top: 1px dashed var(--border-soft); }
.fw-alerts { display: flex; align-items: center; justify-content: space-between; padding: 14px 20px 20px; flex: 1; }
.fw-alerts .ic { font-size: 46px; color: #e5484d; }
.fw-alerts .right { text-align: right; }
.fw-alerts .v { font-size: 30px; font-weight: 800; color: #e5484d; line-height: 1; }
.fw-alerts .chip { display: inline-block; margin-top: 6px; background: #12b3a8; color: #fff; font-size: 10px; font-weight: 700; padding: 2px 9px; border-radius: 3px; }

/* fleet usage chart */
.fw-usage-kpis { text-align: right; font-size: 11.5px; font-weight: 600; color: var(--muted); padding: 0 12px; }
.fw-usage-kpis b { color: #2196f3; font-weight: 800; }
.fw-chart { padding: 4px 8px 10px; }
.fw-chart svg { width: 100%; height: auto; display: block; }

/* driver status */
.fw-dslegend { display: flex; justify-content: center; gap: 16px; padding: 0 8px 14px; font-size: 11.5px; font-weight: 600; flex-wrap: wrap; }
.fw-dslegend .d { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: middle; }

/* ==========================================================================
   Tracking console (tracking.php)
   ========================================================================== */
#map { flex: 1; z-index: 1; }

#objpanel {
    position: absolute; left: 10px; top: 10px; z-index: 500; width: 560px; max-width: calc(100vw - 96px);
    background: var(--surface); border-radius: 6px; overflow: hidden;
    box-shadow: 0 4px 18px rgba(15,20,50,.28); display: flex; flex-direction: column;
    max-height: calc(100% - 20px);
}
.op-head { background: var(--rail); display: flex; align-items: flex-end; padding: 5px 8px 0; gap: 6px; }
.op-tab {
    background: var(--surface); color: var(--blue); font-weight: 700; font-size: 12px;
    padding: 5px 14px; border-radius: 5px 5px 0 0; display: flex; align-items: center; gap: 6px;
}
.op-head .sp { flex: 1; }
.op-head .hbtn { background: none; border: none; color: #cfd4ee; font-size: 14px; cursor: pointer; padding: 4px 6px; }
.op-head .hbtn:hover { color: #fff; }

.op-strip { display: flex; }
.op-seg { flex: 1; text-align: center; padding: 4px 2px 3px; cursor: pointer; border-bottom: 2px solid transparent; }
.op-seg .n { font-size: 12.5px; font-weight: 800; line-height: 1.2; }
.op-seg .l { font-size: 8.5px; font-weight: 700; text-transform: capitalize; opacity: .8; }
.op-seg.run { background: #d9f2df; color: #1c7c46; }
.op-seg.idl { background: #fdf3cf; color: #8f6c00; }
.op-seg.stp { background: #fbdada; color: #b3261e; }
.op-seg.ina { background: #dedbf7; color: #4636b3; }
.op-seg.nod { background: #ececec; color: #666; }
.op-seg.tot { background: #dfe3ea; color: #333; }
.op-seg.on { border-bottom-color: currentColor; filter: saturate(1.3); }

.op-search { display: flex; align-items: center; gap: 6px; padding: 7px 10px; border-bottom: 1px solid var(--border-soft); }
.op-search input[type=checkbox] { width: 14px; height: 14px; margin: 0; }
.op-search input[type=text] {
    flex: 1; border: 1px solid var(--border); border-radius: 3px; padding: 5px 9px; font-size: 11.5px;
}
.op-search .sbtn { background: none; border: none; color: #6c7390; font-size: 14px; cursor: pointer; padding: 2px 3px; }
.op-search .sbtn:hover { color: var(--blue); }

.op-list { flex: 1; overflow-y: auto; min-height: 60px; }
.op-group {
    display: flex; align-items: center; gap: 7px; padding: 5px 10px;
    background: #f2f2f6; border-bottom: 1px solid var(--border-soft);
    font-size: 11.5px; font-weight: 700; color: #4a4a68; cursor: pointer;
}
:root[data-theme="dark"] .op-group { background: #1b2140; color: #aeb4d6; }
.op-group .cnt { margin-left: auto; color: var(--muted); font-weight: 700; }
.op-group input[type=checkbox], .op-row input[type=checkbox] { width: 14px; height: 14px; margin: 0; flex: none; }
.op-row {
    display: flex; align-items: center; gap: 6px; padding: 6px 10px;
    border-bottom: 1px solid var(--border-soft); cursor: pointer; min-height: 46px;
}
.op-row:hover { background: #f5f8ff; }
:root[data-theme="dark"] .op-row:hover { background: rgba(255,255,255,.04); }
.op-row.sel { background: #e8f0fe; }
:root[data-theme="dark"] .op-row.sel { background: rgba(125,157,255,.12); }
.op-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.op-dot.moving { background: var(--run-c); }
.op-dot.idle { background: var(--idle-c); }
.op-dot.parking { background: var(--stop-c); }
.op-dot.inactive { background: var(--inactive-c); }
.op-dot.nodata { background: var(--nodata-c); }
.op-id { width: 148px; flex: none; min-width: 0; }
.op-id .nm { display: block; color: var(--link); font-weight: 700; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.op-id .dt { display: block; color: var(--muted); font-size: 10px; white-space: nowrap; }
.op-spd { width: 24px; text-align: right; font-weight: 700; font-size: 11.5px; flex: none; }
.op-ico { width: 18px; text-align: center; font-size: 13px; flex: none; }
.op-ico.g { color: #3dba6f; } .op-ico.r { color: #e5484d; } .op-ico.y { color: #f4c430; } .op-ico.m { color: #b9bccd; }
.op-volt { font-size: 10.5px; font-weight: 800; color: #2e9e4f; width: 40px; flex: none; }
.op-addr { flex: 1; font-size: 10.5px; color: #6c7390; line-height: 1.3; min-width: 0;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* ---- right detail panel ---- */
#detail {
    position: absolute; right: 10px; top: 10px; bottom: 10px; z-index: 500; width: 252px;
    background: var(--surface); border-radius: 6px; box-shadow: 0 4px 18px rgba(15,20,50,.28);
    display: flex; flex-direction: column; overflow: hidden;
}
#detail[hidden] { display: none; }
.dt-head { background: var(--rail); color: #fff; display: flex; align-items: center; gap: 8px; padding: 7px 10px; }
.dt-head .nm { font-size: 12px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; }
.dt-head .x { background: none; border: none; color: #cfd4ee; cursor: pointer; font-size: 13px; padding: 0; }
.dt-head .x:hover { color: #fff; }
.dt-body { flex: 1; overflow-y: auto; }
.dt-sec { padding: 9px 11px; border-bottom: 1px solid var(--border-soft); }
.dt-car { text-align: center; padding: 6px 0 2px; font-size: 44px; color: var(--blue); line-height: 1; }
.dt-staterow { display: flex; align-items: center; justify-content: space-between; margin-top: 5px; }
.dt-state { color: #fff; font-size: 10.5px; font-weight: 700; padding: 2px 9px; border-radius: 3px; }
.dt-state.moving { background: var(--run-c); } .dt-state.idle { background: #d9a800; }
.dt-state.parking { background: var(--stop-c); } .dt-state.inactive { background: var(--inactive-c); }
.dt-state.nodata { background: var(--nodata-c); }
.dt-timer { font-size: 11px; font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; }
.dt-kv { display: flex; justify-content: space-between; align-items: center; font-size: 11.5px; padding: 2.5px 0; }
.dt-kv .k { color: var(--muted); font-weight: 600; }
.dt-kv .v { font-weight: 700; color: var(--heading); text-align: right; }
.dt-odo { display: flex; gap: 2px; justify-content: center; margin: 5px 0 2px; }
.dt-odo span {
    background: #22262e; color: #fff; font: 700 12px/1 "Mukta", monospace;
    padding: 4px 4.5px; border-radius: 2px; letter-spacing: .5px;
}
.dt-loc { background: #eaf2fd; border-radius: 4px; padding: 8px 9px; font-size: 11px; line-height: 1.45; }
:root[data-theme="dark"] .dt-loc { background: #1a2340; }
.dt-loc .t { font-weight: 800; color: var(--heading); display: flex; align-items: center; gap: 5px; margin-bottom: 3px; }
.dt-loc .coords { color: var(--muted); font-size: 10px; margin-top: 3px; }
.dt-act-title { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 800; color: var(--heading); margin-bottom: 5px; }
.dt-km { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 800; color: var(--heading); padding: 2px 0 6px; }
.dt-km .bar { flex: 1; height: 3px; background: linear-gradient(90deg, var(--run-c), #cfd4ee); border-radius: 2px; }
.dt-hours .dt-kv .v.run { color: var(--run-c); } .dt-hours .dt-kv .v.idl { color: #d9a800; }
.dt-hours .dt-kv .v.stp { color: var(--stop-c); } .dt-hours .dt-kv .v.ina { color: var(--inactive-c); }
.dt-btn {
    display: block; width: 100%; text-align: center; background: var(--blue); color: #fff;
    border: none; border-radius: 4px; font: 700 11.5px "Mukta", sans-serif; padding: 7px; cursor: pointer; margin-top: 7px;
}
.dt-btn:hover { background: var(--blue-2); }
.dt-btn.warnbtn { background: #e5484d; }
.dt-btn.warnbtn:hover { background: #c73a3f; }
.dt-btn.okbtn { background: var(--run-c); }
.dt-btn.okbtn:hover { background: #2f9e5b; }
.dt-btn.ghost { background: var(--surface); color: var(--text); border: 1px solid var(--border); }

/* map label chips + playback */
.veh-chip {
    background: var(--rail); color: #fff; font: 700 10px/1.5 "Mukta", sans-serif;
    padding: 1px 7px; border-radius: 3px; white-space: nowrap; box-shadow: 0 2px 6px rgba(10,15,40,.4);
    border: none;
}
.veh-chip.sel { background: #e02020; }
.veh-chip::before { content: ""; position: absolute; top: -4px; left: 50%; margin-left: -4px;
    border: 4px solid transparent; border-bottom-color: inherit; display: none; }
#playbackBtn {
    position: absolute; top: 10px; left: 50%; transform: translateX(-50%); z-index: 500;
    background: var(--blue); color: #fff; border: none; border-radius: 4px;
    font: 700 12px "Mukta", sans-serif; padding: 7px 18px; cursor: pointer;
    box-shadow: 0 3px 10px rgba(15,20,50,.3); display: flex; align-items: center; gap: 7px;
}
#playbackBtn:hover { background: var(--blue-2); }
#playbackBtn[hidden] { display: none; }
#trailInfo {
    position: absolute; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 500;
    background: rgba(21,29,71,.92); color: #fff; font-size: 11.5px; font-weight: 600;
    padding: 5px 14px; border-radius: 999px; display: none;
}
#trailInfo.show { display: block; }

/* collapse handle for the object panel */
#opToggle {
    position: absolute; left: 10px; top: 10px; z-index: 499; background: var(--rail); color: #fff;
    border: none; border-radius: 5px; width: 34px; height: 34px; font-size: 15px; cursor: pointer;
    box-shadow: 0 3px 10px rgba(15,20,50,.3);
}

/* ==========================================================================
   Legacy page vocabulary (all 13 feature pages render with these)
   ========================================================================== */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; margin-bottom: 14px; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 9px 11px; border-bottom: 1px solid var(--border-soft); }
th { color: var(--muted); font-size: 10.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .4px; background: #f7f7fa; }
tbody tr:hover td, table tr:hover td { background: #f6f8fd; }
tr:last-child td { border-bottom: none; }
td.num { text-align: right; font-variant-numeric: tabular-nums; }

label { display: block; color: var(--muted); font-size: 11.5px; font-weight: 700; margin: 11px 0 4px; }
input, select, textarea {
    width: 100%; padding: 8px 10px; color: var(--text); font: inherit; background: var(--surface);
    border: 1px solid var(--border); border-radius: 4px; transition: .13s;
}
input::placeholder { color: #a6a8bd; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px var(--accent-weak); }

button, .btn {
    padding: 8px 15px; border: none; border-radius: 4px; font: inherit; font-weight: 700; cursor: pointer;
    background: var(--blue); color: #fff; transition: .13s;
}
button:hover { filter: brightness(1.08); }
button.secondary { background: var(--surface); color: var(--text); border: 1px solid var(--border); }
button.secondary:hover { background: #f1f2f7; filter: none; }
button.danger { background: #fff; color: var(--danger); border: 1px solid #f6c6c6; }
button.danger:hover { background: #fef2f2; filter: none; }
button:disabled { opacity: .5; cursor: not-allowed; filter: none; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.row > * { flex: 1; min-width: 150px; }
.row label { margin-top: 0; }

.pill { display: inline-block; padding: 2px 9px; border-radius: 3px; font-size: 10.5px; font-weight: 700; white-space: nowrap; }
.pill.moving   { background: rgba(61,186,111,.15); color: #1c7c46; }
.pill.idle     { background: rgba(244,196,48,.2); color: #8f6c00; }
.pill.parking  { background: rgba(244,88,28,.13); color: #c2410c; }
.pill.inactive { background: rgba(33,150,243,.13); color: #1565c0; }
.pill.nodata   { background: #ececef; color: #666; }
.pill.expired  { background: rgba(229,72,77,.14); color: #dc2626; }
.pill.expiring { background: rgba(244,196,48,.2); color: #8f6c00; }
.pill.on       { background: rgba(61,186,111,.15); color: #1c7c46; }
.pill.off      { background: #ececef; color: #666; }
:root[data-theme="dark"] .pill.nodata, :root[data-theme="dark"] .pill.off { background: #252b49; color: var(--muted); }
.badge { background: var(--danger); color: #fff; border-radius: 3px; padding: 1px 6px; font-size: 10px; font-weight: 800; margin-left: 6px; }

.tiles { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.tile { background: var(--surface); border: 1px solid var(--border); border-left: 3px solid var(--blue); border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px 16px; min-width: 110px; flex: 1; cursor: pointer; }
.tile .n { font-size: 22px; font-weight: 800; color: var(--heading); line-height: 1.15; }
.tile .l { font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; font-weight: 700; margin-top: 1px; }
.tile.on { background: var(--accent-weak); }

.msg { background: rgba(61,186,111,.1); color: #1c7c46; border: 1px solid rgba(61,186,111,.3); border-radius: 4px; padding: 9px 12px; margin-bottom: 12px; }
.err { background: rgba(229,72,77,.08); color: #b91c1c; border: 1px solid rgba(229,72,77,.28); border-radius: 4px; padding: 9px 12px; margin-bottom: 12px; }
.muted { color: var(--muted); }
.empty { color: var(--muted); padding: 24px; text-align: center; }

.modal { position: fixed; inset: 0; z-index: 2000; display: flex; align-items: center; justify-content: center; background: rgba(15,20,50,.45); }
.modal[hidden] { display: none; }
.modal .card { width: min(400px, 92vw); max-height: 90vh; overflow-y: auto; margin: 0; box-shadow: 0 24px 60px rgba(15,20,50,.3); }

.leaflet-container { background: #dfe3ea; }
.leaflet-control-layers, .leaflet-bar, .leaflet-popup-content-wrapper {
    background: var(--surface) !important; border: 1px solid var(--border) !important;
    border-radius: 5px !important; box-shadow: var(--shadow) !important; color: var(--text) !important;
}
.leaflet-bar a { background: var(--surface) !important; color: var(--text) !important; }
.leaflet-popup-tip { background: var(--surface) !important; }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
    #objpanel { width: 420px; }
    .op-addr { display: none; }
}
@media (max-width: 900px) {
    #rail { position: fixed; left: 0; top: 0; bottom: 0; }
    #content { margin-left: 78px; }
    .tb-clock, .tb-user .nm { display: none; }
    main.page { padding: 12px 10px 50px; }
    #objpanel { width: calc(100vw - 96px); max-height: 46%; }
    #detail { width: calc(100vw - 96px); top: auto; bottom: 10px; max-height: 46%; }
    .fw-grid { grid-template-columns: repeat(6, 1fr) !important; }
    .fw-grid > * { grid-column: span 6 !important; }
}
