/* Vynora web: the scooter dash's night palette, so the website feels like the same product.
   One dark look on purpose (like the dash at night). Numbers in Chakra Petch, text in Saira. */
:root {
  --abyss: #030817;
  --deep: #071533;
  --panel: #0b1b3d;
  --panel-2: #0e2149;
  --edge: #1d4fa8;
  --line: #16306a;
  --cyan: #2ee6ff;
  --violet: #9d5cff;
  --green: #3be88e;
  --amber: #ffb547;
  --red: #ff5d6c;
  --text: #eaf3ff;
  --dim: #9bb1d6;
  --faint: #5d76a3;
  --num: "Chakra Petch", "Rajdhani", "Arial Narrow", system-ui, sans-serif;
  --label: "Saira", "Segoe UI", system-ui, -apple-system, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { background: var(--abyss); }
body {
  margin: 0;
  background: radial-gradient(1100px 600px at 20% -10%, var(--deep), var(--abyss) 70%) var(--abyss);
  color: var(--text);
  font: 15px/1.5 var(--label);
  min-height: 100vh;
}
.area-admin { background: radial-gradient(1100px 600px at 80% -10%, #15123a, var(--abyss) 70%) var(--abyss); }
a { color: var(--cyan); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: #8ff3ff; }
h1, h2, h3 { font-family: var(--num); font-weight: 700; line-height: 1.15; margin: 0 0 12px; text-wrap: balance; }
h1 { font-size: 28px; }
h2 { font-size: 19px; }
h3 { font-size: 16px; }
.sub { color: var(--dim); font-size: 13.5px; margin: 4px 0 0; }
.mono { font-family: var(--mono); font-size: 0.95em; letter-spacing: 0.02em; }
.nowrap { white-space: nowrap; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }

/* Top bar */
.top { border-bottom: 1px solid var(--line); background: rgba(3, 8, 23, 0.8); backdrop-filter: blur(6px); position: sticky; top: 0; z-index: 1000; }
.top-in { max-width: 1180px; margin: 0 auto; padding: 10px max(16px, env(safe-area-inset-left)); display: flex; flex-wrap: wrap; align-items: center; gap: 8px 22px; }
.brand { display: flex; align-items: center; gap: 9px; color: var(--text); text-decoration: none; font: 700 19px var(--num); letter-spacing: 0.04em; }
.brand em { font: 600 11px var(--label); letter-spacing: 0.14em; text-transform: uppercase; color: var(--violet); border: 1px solid rgba(157, 92, 255, 0.5); border-radius: 999px; padding: 1px 8px; font-style: normal; }
.top nav { display: flex; flex-wrap: wrap; gap: 2px; flex: 1; }
.top nav a { color: var(--dim); text-decoration: none; padding: 6px 11px; border-radius: 8px; font-weight: 500; }
.top nav a:hover { color: var(--text); background: var(--panel); }
.top nav a[aria-current="page"] { color: var(--text); background: var(--panel-2); box-shadow: inset 0 -2px 0 var(--cyan); }
.who { display: flex; align-items: center; gap: 10px; color: var(--dim); font-size: 13.5px; margin-left: auto; }

.page { max-width: 1180px; margin: 0 auto; padding: 26px max(16px, env(safe-area-inset-left)) 60px; display: grid; gap: 22px; }
.page > section, .page > article { min-width: 0; }

/* Cards and stats */
.card { background: linear-gradient(180deg, rgba(14, 33, 73, 0.9), rgba(7, 21, 51, 0.9)); border: 1px solid var(--line); border-radius: 14px; padding: 18px; min-width: 0; }
.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 14px; }
.row { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 18px; }
.section-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px 16px; margin-bottom: 10px; }
.section-head h1, .section-head h2 { margin: 0; }
.scooter { border-color: rgba(46, 230, 255, 0.35); }
.gauge-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; }
.big, .stat { display: grid; gap: 2px; }
.label { font-size: 11.5px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--faint); }
.big .value { font: 700 44px/1 var(--num); font-variant-numeric: tabular-nums; }
.stat .value { font: 700 26px/1.1 var(--num); font-variant-numeric: tabular-nums; }
.value small { font-size: 0.45em; font-weight: 600; color: var(--dim); margin-left: 4px; font-family: var(--label); }
.value.good { color: var(--green); } .value.warn { color: var(--amber); } .value.bad { color: var(--red); }
.bar { display: block; height: 7px; border-radius: 99px; background: rgba(29, 79, 168, 0.3); overflow: hidden; margin-top: 6px; }
.bar i { display: block; height: 100%; border-radius: 99px; background: var(--cyan); }
.bar i.good { background: var(--green); } .bar i.warn { background: var(--amber); } .bar i.bad { background: var(--red); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 14px 18px; }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px 18px; margin: 16px 0 0; }
.facts div { display: grid; gap: 1px; min-width: 0; }
.facts dt { font-size: 12px; color: var(--faint); }
.facts dd { margin: 0; font-weight: 500; overflow-wrap: anywhere; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; }
.tile { display: grid; gap: 4px; padding: 16px; border-radius: 14px; border: 1px solid var(--line); background: var(--panel); text-decoration: none; color: var(--text); }
.tile:hover { border-color: var(--edge); color: var(--text); }
.tile .value { font: 700 34px/1 var(--num); font-variant-numeric: tabular-nums; }
.tile .hint { color: var(--dim); font-size: 12.5px; }

/* Pills and notices */
.pill { display: inline-block; font-size: 11.5px; font-weight: 600; padding: 1px 9px; border-radius: 99px; border: 1px solid; white-space: nowrap; vertical-align: 1px; }
.pill.ok { color: var(--green); border-color: rgba(59, 232, 142, 0.5); background: rgba(59, 232, 142, 0.1); }
.pill.warn { color: var(--amber); border-color: rgba(255, 181, 71, 0.5); background: rgba(255, 181, 71, 0.1); }
.pill.bad { color: var(--red); border-color: rgba(255, 93, 108, 0.5); background: rgba(255, 93, 108, 0.1); }
.pill.idle { color: var(--dim); border-color: var(--line); }
.tag.charging { color: var(--cyan); font-size: 12.5px; font-weight: 600; }
.notice { margin: 0; padding: 11px 14px; border-radius: 10px; border: 1px solid rgba(59, 232, 142, 0.45); background: rgba(59, 232, 142, 0.08); }
.error { margin: 0; padding: 11px 14px; border-radius: 10px; border: 1px solid rgba(255, 93, 108, 0.55); background: rgba(255, 93, 108, 0.1); color: #ffd3d8; }
.empty { color: var(--dim); margin: 6px 0; }
.crumb { margin: 0 0 -12px; font-size: 13.5px; }

/* Tables */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: 11.5px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--faint); font-weight: 600; background: rgba(7, 21, 51, 0.7); }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: rgba(29, 79, 168, 0.12); }
td.n, th.n { text-align: right; font-variant-numeric: tabular-nums; }
.more { font-size: 13px; }

/* Forms and buttons */
.stack { display: grid; gap: 12px; }
.narrow-form { max-width: 460px; }
.grid-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; align-items: end; }
label { display: grid; gap: 5px; font-size: 13.5px; color: var(--dim); }
label.check { display: inline-flex; align-items: center; gap: 6px; }
input, select, textarea {
  font: 15px var(--label); color: var(--text); background: var(--abyss); border: 1px solid var(--line);
  border-radius: 9px; padding: 9px 11px; width: 100%; min-width: 0;
}
input[type="checkbox"] { width: auto; }
input:focus, select:focus, textarea:focus { border-color: var(--cyan); outline: none; box-shadow: 0 0 0 3px rgba(46, 230, 255, 0.18); }
button, .button {
  font: 600 14px var(--label); color: var(--text); background: var(--panel-2); border: 1px solid var(--edge);
  border-radius: 9px; padding: 9px 16px; cursor: pointer; text-decoration: none; display: inline-block; white-space: nowrap;
}
button:hover, .button:hover { border-color: var(--cyan); color: var(--text); }
button.primary, .button.primary { background: var(--cyan); border-color: var(--cyan); color: #01202a; }
button.primary:hover, .button.primary:hover { background: #7cefff; color: #01202a; }
button.danger { border-color: rgba(255, 93, 108, 0.6); color: #ffc2c8; background: rgba(255, 93, 108, 0.08); }
button.danger:hover { border-color: var(--red); }
button.small { padding: 4px 10px; font-size: 12.5px; }
button.link { background: none; border: 0; padding: 0; color: var(--cyan); font-weight: 500; }
form.inline { display: inline; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.search { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.search input[type="search"] { max-width: 340px; }
.filters { display: flex; gap: 4px; flex-wrap: wrap; }
.filters a { padding: 4px 12px; border-radius: 99px; border: 1px solid var(--line); color: var(--dim); text-decoration: none; font-size: 13.5px; }
.filters a[aria-current] { color: var(--text); border-color: var(--edge); background: var(--panel-2); }

/* Login */
.auth { max-width: 420px; width: 100%; margin: 6vh auto 0; display: grid; gap: 14px; }
.auth h1 { font-size: 26px; margin: 0; }
.prose { max-width: 68ch; }
.prose li { margin: 4px 0; }

/* Maps, rides, logs */
.map { height: 380px; border-radius: 12px; border: 1px solid var(--line); margin: 14px 0; background: var(--deep); }
.map.small { height: 220px; }
.leaflet-container { font: 13px var(--label); }
.ride .stats { margin-bottom: 4px; grid-template-columns: repeat(4, minmax(0, 1fr)); }
/* Night map, like the dash: darken the tiles, keep the route and markers bright. */
.map .leaflet-tile-pane { filter: invert(0.9) hue-rotate(180deg) saturate(0.55) brightness(0.95) contrast(0.9); }
.modes { display: grid; gap: 8px; max-width: 620px; }
.mode { display: grid; grid-template-columns: 80px 1fr 90px; gap: 10px; align-items: center; }
.mode .bar { margin: 0; }
.mode b { font-family: var(--num); text-align: right; }
.m-eco .bar i { background: var(--green); } .m-normal .bar i { background: var(--cyan); } .m-sports .bar i { background: var(--amber); } .m-hyper .bar i { background: var(--violet); }
.alerts, .audit, .plain { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.alerts li, .audit li { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; }
.alerts time, .audit time, .audit em { color: var(--faint); font-size: 12.5px; font-style: normal; }
.handover { border-color: rgba(59, 232, 142, 0.5); }
.code { font: 700 40px/1.1 var(--num); letter-spacing: 0.18em; color: var(--cyan); margin: 10px 0 0; }
.keys { columns: 2 220px; margin: 0 0 12px; padding-left: 18px; }
code { font-family: var(--mono); background: var(--deep); padding: 1px 6px; border-radius: 5px; }

@media (max-width: 640px) {
  h1 { font-size: 23px; }
  .ride .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .top nav { order: 3; flex: 1 0 100%; flex-wrap: nowrap; overflow-x: auto; margin: 0 -4px; }
  .top nav a { white-space: nowrap; }
  .facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .gauge-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .gauge-row .big:first-child { grid-column: 1 / -1; }
  .table-wrap table { min-width: 620px; }
  .table-wrap td, .table-wrap th { white-space: nowrap; }
  .big .value { font-size: 36px; }
  .who span { display: none; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } }
