/* ERider Admin — the ERider app's look (android ui/theme/Palette.kt light + dark, V2Shapes radii). No external fonts. */
:root {
  --bg: #F5F7FB; --surface: #FFFFFF; --surface-muted: #F1F4F9; --border: #E2E8F0;
  --text: #0F1B2D; --muted: #5B6B80;
  --primary: #1D6FE5; --primary-text: #1A5FCB; --halo: #DCE8FB;
  --danger: #DC2F2F; --danger-text: #C62828; --danger-soft: #FDE8E8;
  --amber: #C77700; --warn-text: #9A5B00; --warn-soft: #FDF1DE;
  --success-text: #17803F; --success-soft: #E6F4EC; --success: #2E9E5B;
  --navy: #0F2540; --teal: #2C9AA8; --green: #2E9E5B; --purple: #7B5CE0; --orange: #D46D2A;
  --side-bg: #0F2540; --side-text: #C9D4E3; --side-muted: #7F93AE; --side-on: rgba(255, 255, 255, .10);
  --shadow: 0 1px 2px rgba(15, 27, 45, .06), 0 6px 18px rgba(15, 27, 45, .06);
  --r-card: 18px; --r-tile: 20px; --r-btn: 14px; --r-row: 12px;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0B1017; --surface: #141B24; --surface-muted: #1B2430; --border: #2A3644;
  --text: #F3F6FA; --muted: #A3B1C2;
  --primary: #2F6FE0; --primary-text: #7FB0FF; --halo: #1A2B4A;
  --danger: #D93A40; --danger-text: #FF6B6B; --danger-soft: #3A1517;
  --amber: #B86E00; --warn-text: #F2A23A; --warn-soft: #33240C;
  --success-text: #3DD47E; --success-soft: #123323; --success: #2B8A50;
  --navy: #2F4A70; --teal: #25848F; --green: #2B8A50; --purple: #6F55E8; --orange: #B85A1C;
  --side-bg: #0E141C; --side-text: #C9D4E3; --side-muted: #6E7F95; --side-on: rgba(127, 176, 255, .12);
  --shadow: 0 1px 2px rgba(0, 0, 0, .4);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; -webkit-font-smoothing: antialiased; }
a { color: var(--primary-text); }
.hidden { display: none !important; }
.grow { flex: 1; }

/* ---------- layout ---------- */
.app { display: flex; min-height: 100vh; }
.side { width: 248px; flex: 0 0 248px; background: var(--side-bg); color: var(--side-text); display: flex; flex-direction: column; padding: 18px 12px; position: sticky; top: 0; height: 100vh; }
.brandrow { display: flex; align-items: center; gap: 10px; padding: 4px 10px 18px; }
.logo { width: 38px; height: 38px; border-radius: 12px; background: var(--primary); display: grid; place-items: center; color: #fff; font-weight: 900; font-size: 18px; letter-spacing: -1px; flex: 0 0 auto; }
.brandrow b { display: block; color: #fff; font-size: 16px; line-height: 1.2; }
.brandrow small { color: var(--side-muted); font-size: 12px; }
.nav { display: flex; flex-direction: column; gap: 2px; overflow-y: auto; flex: 1; }
.nav a { display: flex; align-items: center; gap: 12px; min-height: 42px; padding: 0 12px; border-radius: var(--r-row); color: var(--side-text); text-decoration: none; font-weight: 600; font-size: 14px; }
.nav a svg { width: 20px; height: 20px; flex: 0 0 auto; opacity: .85; }
.nav a:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.nav a.on { background: var(--side-on); color: #fff; box-shadow: inset 3px 0 0 var(--primary); }
.navhead { padding: 14px 12px 4px; font-size: 11px; font-weight: 800; letter-spacing: 2px; color: var(--side-muted); }
.sidefoot { border-top: 1px solid rgba(255, 255, 255, .08); padding: 12px 4px 0; display: flex; align-items: center; gap: 10px; }
.sidefoot .who { min-width: 0; flex: 1; }
.sidefoot .who b { display: block; color: #fff; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidefoot .who span { font-size: 12px; color: var(--side-muted); text-transform: capitalize; }
.iconbtn { width: 36px; height: 36px; min-height: 0; padding: 0; display: grid; place-items: center; border-radius: 10px; background: transparent; color: var(--side-text); border: 1px solid rgba(255, 255, 255, .12); }
.iconbtn:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.iconbtn svg { width: 18px; height: 18px; }

.content { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { display: none; }
.main { padding: 28px 32px 48px; display: flex; flex-direction: column; gap: 18px; max-width: 1360px; width: 100%; }
.main:focus { outline: none; }

/* ---------- signed-out (sign-in, 2FA, forced password) ---------- */
.app.out .side { display: none; }
.app.out .content { background: linear-gradient(140deg, #0F2540 0%, #16365E 55%, #1D6FE5 140%); align-items: center; justify-content: center; }
.app.out .main { max-width: 460px; padding: 32px 18px; }
.authbrand { display: flex; align-items: center; gap: 12px; color: #fff; margin-bottom: 4px; }
.authbrand b { font-size: 20px; }
.authbrand small { display: block; color: #AFC2DC; font-size: 13px; }
.app.out .card { padding: 28px; box-shadow: 0 20px 50px rgba(0, 0, 0, .25); border: 0; }

/* ---------- page head ---------- */
.head { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.head .titles { flex: 1; min-width: 220px; }
.crumb { font-size: 13px; color: var(--muted); text-decoration: none; display: inline-flex; gap: 4px; align-items: center; margin-bottom: 6px; }
.crumb:hover { color: var(--primary-text); }
h1 { margin: 0; font-size: 28px; line-height: 1.2; letter-spacing: -.3px; }
h2 { margin: 0 0 10px; font-size: 17px; }
.sub { margin: 4px 0 0; color: var(--muted); font-size: 14px; }
.micro { font-size: 11px; font-weight: 800; letter-spacing: 2px; text-transform: uppercase; color: var(--muted); margin: 6px 0 -6px; }

/* ---------- cards & tiles ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-card); padding: 20px; box-shadow: var(--shadow); }
.card.flush { padding: 0; overflow: hidden; }
.card.flush > h2, .card.flush > .cardhead { padding: 18px 20px 0; }
.cardhead { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.cardhead h2 { margin: 0; flex: 1; }
.narrow { max-width: 460px; }
.cols { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.stack { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-tile); padding: 16px; display: flex; gap: 14px; align-items: center; box-shadow: var(--shadow); text-decoration: none; color: inherit; }
a.tile:hover { border-color: var(--primary); }
.tile .ic { width: 46px; height: 46px; border-radius: 16px; display: grid; place-items: center; color: #fff; flex: 0 0 auto; }
.tile .ic svg { width: 22px; height: 22px; }
.tile b { display: block; font-size: 24px; line-height: 1.15; letter-spacing: .3px; }
.tile span { color: var(--muted); font-size: 13px; }
.bg-navy { background: var(--navy); } .bg-teal { background: var(--teal); } .bg-green { background: var(--green); }
.bg-purple { background: var(--purple); } .bg-orange { background: var(--orange); } .bg-blue { background: var(--primary); }
.bg-red { background: var(--danger); } .bg-amber { background: var(--amber); }

/* ---------- forms & buttons ---------- */
label { display: block; font-size: 13px; font-weight: 700; color: var(--muted); margin: 12px 0 6px; }
input, select { width: 100%; height: 44px; padding: 0 14px; border: 1px solid var(--border); border-radius: var(--r-row); font: inherit; color: var(--text); background: var(--surface-muted); }
input:focus, select:focus { outline: 2px solid var(--primary); outline-offset: 0; border-color: transparent; background: var(--surface); }
input:disabled, select:disabled { opacity: .6; }
button, a.button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; padding: 0 18px; border: 0; border-radius: var(--r-btn); background: var(--primary); color: #fff; font: inherit; font-weight: 700; cursor: pointer; text-decoration: none; white-space: nowrap; }
button:hover, a.button:hover { filter: brightness(1.08); }
button svg, a.button svg { width: 18px; height: 18px; }
button.light, a.button.light { background: var(--halo); color: var(--primary-text); }
button.ghost { background: transparent; border: 1px solid var(--border); color: var(--text); }
button.danger { background: var(--danger); }
button.wide { width: 100%; }
.center { text-align: center; }
.check { display: inline-flex; align-items: center; gap: 8px; margin: 4px 18px 4px 0; font-weight: 500; color: var(--text); font-size: 14px; }
.check input { width: 18px; height: 18px; padding: 0; margin: 0; flex: 0 0 auto; accent-color: var(--primary); }
.checks { display: flex; flex-wrap: wrap; margin: 8px 0 14px; }
textarea { width: 100%; min-height: 96px; padding: 10px 14px; border: 1px solid var(--border); border-radius: var(--r-row); font: inherit; color: var(--text); background: var(--surface-muted); resize: vertical; }
textarea:focus { outline: 2px solid var(--primary); outline-offset: 0; border-color: transparent; background: var(--surface); }
.switches { display: flex; flex-direction: column; gap: 10px; margin: 4px 0 6px; }
.switches .note { margin-left: 26px; }
td select { min-width: 96px; height: 38px; }
td input { min-width: 170px; height: 38px; }
.row { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; }
.row > * { flex: 1 1 170px; }
.row > button, .row > a.button { flex: 0 0 auto; }
.search { position: relative; }
.search svg { position: absolute; left: 14px; bottom: 13px; width: 18px; height: 18px; color: var(--muted); pointer-events: none; }
.search input { padding-left: 42px; }
.otp { font: 800 30px/1.2 ui-monospace, Consolas, monospace; letter-spacing: 3px; user-select: all; margin: 6px 0; }
.secret { font-family: ui-monospace, Consolas, monospace; font-size: 16px; word-break: break-all; background: var(--warn-soft); color: var(--text); padding: 12px; border-radius: var(--r-row); }

/* ---------- tables ---------- */
.tablewrap { overflow-x: auto; }
table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 14px; }
th { position: sticky; top: 0; text-align: left; background: var(--surface-muted); color: var(--muted); font-size: 11px; font-weight: 800; letter-spacing: 1.4px; text-transform: uppercase; padding: 11px 14px; border-bottom: 1px solid var(--border); white-space: nowrap; }
td { border-bottom: 1px solid var(--border); padding: 12px 14px; vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tr.click { cursor: pointer; }
tr.click:hover td { background: var(--halo); }
.person { display: flex; align-items: center; gap: 12px; min-width: 180px; }
.person b { display: block; }
.person small { color: var(--muted); }
.avatar { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: 14px; color: #fff; flex: 0 0 auto; letter-spacing: .5px; }
.avatar.lg { width: 64px; height: 64px; font-size: 22px; }
.mono { font-family: ui-monospace, Consolas, monospace; font-size: 13px; }
.dim { color: var(--muted); }
.pager { display: flex; gap: 10px; align-items: center; padding: 12px 14px; border-top: 1px solid var(--border); }

/* ---------- pills, notes, messages ---------- */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 800; letter-spacing: .3px; white-space: nowrap; vertical-align: middle; }
.pill.dot::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.ok { background: var(--success-soft); color: var(--success-text); }
.bad { background: var(--danger-soft); color: var(--danger-text); }
.warn { background: var(--warn-soft); color: var(--warn-text); }
.info { background: var(--halo); color: var(--primary-text); }
.mutedpill { background: var(--surface-muted); color: var(--muted); }
.note { color: var(--muted); font-size: 13px; margin: 0; }
.banner { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: var(--r-card); background: var(--surface); border: 1px solid var(--border); font-size: 14px; }
.banner svg { width: 20px; height: 20px; flex: 0 0 auto; margin-top: 1px; }
.banner.warn { background: var(--warn-soft); border-color: transparent; color: var(--text); }
.banner.warn svg { color: var(--warn-text); }
.banner.info { background: var(--halo); border-color: transparent; color: var(--text); }
.banner.info svg { color: var(--primary-text); }
.msg { padding: 11px 14px; border-radius: var(--r-row); font-size: 14px; margin: 6px 0; }
.msg.err { background: var(--danger-soft); color: var(--danger-text); }
.msg.good { background: var(--success-soft); color: var(--success-text); }
.empty { text-align: center; padding: 34px 16px; color: var(--muted); }
.empty svg { width: 34px; height: 34px; opacity: .6; }
dl { display: grid; grid-template-columns: max-content 1fr; gap: 10px 20px; margin: 0; font-size: 14px; }
dt { color: var(--muted); }
dd { margin: 0; font-weight: 600; word-break: break-word; }
ul.list { list-style: none; margin: 0; padding: 0; }
ul.list li { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
ul.list li:last-child { border-bottom: 0; }

/* ---------- complaints (ADM2) ---------- */
.pre { white-space: pre-wrap; word-break: break-word; margin: 0; }
ul.timeline { list-style: none; margin: 0; padding: 0; }
ul.timeline li { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); }
ul.timeline li:last-child { border-bottom: 0; }
.tlicon { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; flex: 0 0 auto; background: var(--halo); color: var(--primary-text); }
.tlicon.status { background: var(--surface-muted); color: var(--muted); }
.tlicon.severity { background: var(--warn-soft); color: var(--warn-text); }
.tlicon.close { background: var(--success-soft); color: var(--success-text); }
.tlhead { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.tlhead b { color: var(--text); }
tr.total td { font-weight: 800; background: var(--surface-muted); }

/* ---------- chart ---------- */
.cardhead.wrap { flex-wrap: wrap; align-items: flex-start; }
.seg { display: inline-flex; background: var(--surface-muted); border: 1px solid var(--border); border-radius: 12px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg button { background: transparent; color: var(--muted); border: 0; border-radius: 9px; padding: 6px 12px; font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; box-shadow: none; min-height: 0; }
.seg button:hover { color: var(--text); filter: none; }
.seg button[aria-pressed="true"] { background: var(--primary); color: #fff; box-shadow: 0 1px 3px rgba(15, 27, 45, .18); }
.big { font-size: 22px; color: var(--text); font-weight: 800; margin-right: 2px; }
.chartwrap { padding: 6px 4px 0; }
.chart { display: grid; grid-template-columns: 30px minmax(0, 1fr); height: 190px; padding: 14px 0 6px; }
.yax { position: relative; }
.yax span { position: absolute; right: 10px; transform: translateY(-50%); font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.plot { position: relative; }
.plot svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.plot .grid { stroke: var(--border); stroke-width: 1; stroke-dasharray: 3 5; }
.plot .grid.base { stroke-dasharray: none; }
.plot .stop-a { stop-color: var(--primary); stop-opacity: .38; }
.plot .stop-b { stop-color: var(--primary); stop-opacity: 0; }
.plot .line { stroke: var(--primary); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.plot .pt { position: absolute; width: 8px; height: 8px; margin: -4px 0 0 -4px; border-radius: 50%; background: var(--surface); border: 2px solid var(--primary); pointer-events: none; }
.plot .pt.on { width: 14px; height: 14px; margin: -7px 0 0 -7px; background: var(--primary); border: 3px solid var(--surface); box-shadow: 0 0 0 4px var(--halo); z-index: 2; }
.plot .guide { position: absolute; top: 0; bottom: 0; width: 0; border-left: 1px dashed var(--muted); opacity: .5; pointer-events: none; }
.plot .tip { position: absolute; transform: translate(-50%, calc(-100% - 14px)); background: var(--navy); color: #fff; padding: 6px 10px; border-radius: 10px; font-size: 13px; white-space: nowrap; pointer-events: none; z-index: 3; box-shadow: var(--shadow); }
.plot .tip small { display: block; color: #C9D4E3; font-size: 11px; }
.plot .hits { position: absolute; inset: -14px 0 0; display: flex; }
.plot .hits span { flex: 1; cursor: crosshair; }
.axis { display: flex; justify-content: space-between; color: var(--muted); font-size: 12px; margin: 6px 0 0 30px; }

/* ---------- rider hero ---------- */
.hero { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
.hero .titles { flex: 1; min-width: 220px; }
.hero h1 { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* ---------- map ---------- */
.mapwrap { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 0; min-height: 560px; }
.map { height: 560px; width: 100%; background: var(--surface-muted); z-index: 0; }
.map.small { height: 280px; border-radius: var(--r-row); }
.map.small + dl { margin-top: 16px; }
.maplist { border-left: 1px solid var(--border); overflow-y: auto; max-height: 560px; }
.maplist .item { display: flex; gap: 12px; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--border); cursor: pointer; }
.maplist .item:hover, .maplist .item.on { background: var(--halo); }
.maplist .item .meta { flex: 1; min-width: 0; }
.maplist .item b { display: block; font-size: 14px; }
.maplist .item small { color: var(--muted); font-size: 12px; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; align-items: center; font-size: 13px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.swatch { width: 12px; height: 12px; border-radius: 50%; display: inline-block; }
.swatch.live { background: var(--green); } .swatch.last { background: var(--amber); }
.pin { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 12px; border: 3px solid #fff; box-shadow: 0 2px 8px rgba(0, 0, 0, .35); position: relative; }
.pin.live { background: var(--green); }
.pin.last { background: var(--amber); }
.pin.live::after { content: ""; position: absolute; inset: -9px; border-radius: 50%; border: 3px solid var(--green); opacity: 0; animation: ping 1.8s ease-out infinite; }
@keyframes ping { 0% { transform: scale(.6); opacity: .7; } 100% { transform: scale(1.3); opacity: 0; } }
.leaflet-container { font: inherit; }
.leaflet-popup-content-wrapper { border-radius: 14px; }
.leaflet-popup-content { margin: 12px 14px; }
.pop b { display: block; font-size: 14px; }
.pop small { color: #5B6B80; }
.pop p { margin: 6px 0; font-size: 13px; }
:root[data-theme="dark"] .leaflet-tile-pane { filter: invert(1) hue-rotate(180deg) brightness(.85) contrast(.9); }
:root[data-theme="dark"] .leaflet-control-attribution { background: rgba(20, 27, 36, .8); color: #A3B1C2; }
:root[data-theme="dark"] .leaflet-control-attribution a { color: #7FB0FF; }

/* ---------- small screens ---------- */
@media (max-width: 1080px) {
  .cols { grid-template-columns: 1fr; }
  .mapwrap { grid-template-columns: 1fr; }
  .maplist { border-left: 0; border-top: 1px solid var(--border); max-height: 320px; }
}
@media (max-width: 820px) {
  .app { flex-direction: column; }
  .seg { display: flex; width: 100%; flex-wrap: nowrap; }
  .seg button { flex: 1 1 auto; padding: 6px 4px; font-size: 12px; }
  .side { position: fixed; z-index: 1000; left: 0; top: 0; bottom: 0; transform: translateX(-100%); transition: transform .2s; box-shadow: 0 0 40px rgba(0, 0, 0, .4); }
  .app.menu .side { transform: none; }
  .topbar { display: flex; align-items: center; gap: 10px; padding: 10px 16px; background: var(--side-bg); color: #fff; position: sticky; top: 0; z-index: 900; }
  .topbar b { flex: 1; }
  .main { padding: 18px 16px 40px; }
  .map { height: 420px; }
  h1 { font-size: 24px; }
}
