:root {
  color-scheme: dark;
  --bg: #101510;
  --bg-soft: #151c17;
  --panel: rgba(25, 34, 28, .94);
  --panel-solid: #19221c;
  --line: rgba(220, 237, 221, .1);
  --text: #f0f3ea;
  --muted: #929e92;
  --lime: #c0f35b;
  --lime-deep: #a6dd43;
  --orange: #e8a66e;
  --danger: #ef8175;
  --topbar-height: 72px;
  --nav-width: 76px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
}

button, input { font: inherit; }
button { color: inherit; }
.icon-library { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon { width: 20px; height: 20px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.app-shell {
  height: var(--app-height, 100vh);
  height: var(--app-height, 100dvh);
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  grid-template-columns: var(--nav-width) minmax(0, 1fr);
  grid-template-rows: var(--topbar-height) minmax(0, 1fr);
  background: radial-gradient(ellipse at 90% 0, rgba(180, 236, 84, .045), transparent 28%), var(--bg);
}

.topbar {
  z-index: 20;
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 30px 0 25px;
  border-bottom: 1px solid var(--line);
  background: rgba(16, 21, 16, .94);
  backdrop-filter: blur(18px);
}

.brand { display: inline-flex; align-items: center; gap: 11px; color: var(--text); text-decoration: none; }
.brand img { display: block; border-radius: 13px; }
.brand-copy { display: grid; gap: 1px; }
.brand-copy strong { font-size: 19px; line-height: 1; letter-spacing: -.8px; }
.brand-copy strong span { color: var(--lime); }
.brand-copy small { color: #788579; font-size: 8px; font-weight: 750; letter-spacing: 1.9px; }
.topbar-right { display: flex; align-items: center; gap: 22px; }
.gps-pill { display: flex; align-items: center; gap: 9px; padding: 9px 13px; border: 1px solid var(--line); border-radius: 99px; color: #c7d0c5; font-size: 11px; }
.connection-pill { display: flex; align-items: center; gap: 7px; padding: 8px 11px; border: 1px solid rgba(232,166,110,.25); border-radius: 99px; background: rgba(232,166,110,.09); color: #f0bf91; font-size: 9px; font-weight: 800; letter-spacing: .6px; }
.connection-pill .status-dot { background: #e8a66e; }
.status-dot, .live-indicator { display: inline-block; width: 7px; height: 7px; flex: 0 0 auto; border-radius: 50%; background: #788178; }
.gps-pill.is-live .status-dot, .ride-state.is-live .status-dot { background: var(--lime); box-shadow: 0 0 12px rgba(192, 243, 91, .7); }
.topbar-date { color: var(--muted); font-size: 11px; }

.side-nav { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 25px 9px 16px; border-right: 1px solid var(--line); background: rgba(16, 21, 16, .65); }
.nav-caption { margin: 0 0 10px; color: #657165; font-size: 8px; font-weight: 800; letter-spacing: 1.6px; }
.nav-link { position: relative; display: flex; width: 58px; min-height: 58px; flex-direction: column; align-items: center; justify-content: center; gap: 5px; border: 1px solid transparent; border-radius: 16px; background: transparent; color: #879287; cursor: pointer; transition: background .18s ease, color .18s ease; }
.nav-link .icon { width: 19px; height: 19px; }
.nav-link span:not(.nav-count) { font-size: 9px; font-weight: 650; }
.nav-link:hover { background: rgba(255,255,255,.04); color: var(--text); }
.nav-link.active { border-color: rgba(192, 243, 91, .15); background: rgba(192, 243, 91, .09); color: var(--lime); }
.nav-count { position: absolute; top: 5px; right: 4px; display: grid; min-width: 15px; height: 15px; place-items: center; padding: 0 3px; border-radius: 99px; background: var(--lime); color: #172010; font-size: 8px; font-weight: 800; }
.side-nav-bottom { display: flex; align-items: center; gap: 7px; margin-top: auto; writing-mode: vertical-rl; color: #6d786c; font-size: 9px; }
.side-nav-bottom .live-indicator { width: 6px; height: 6px; background: var(--lime); }

.workspace { min-width: 0; min-height: 0; overflow: hidden; }
.page-view { width: 100%; height: 100%; min-width: 0; min-height: 0; }
.page-view[hidden] { display: none !important; }
.ride-layout { display: grid; width: 100%; height: 100%; min-height: 0; grid-template-columns: minmax(0, 1fr) 350px; }
.map-frame { position: relative; min-width: 0; min-height: 0; overflow: hidden; background: #dce5d8; }
#map { position: absolute; inset: 0; z-index: 0; background: #dce5d8; }
.map-frame.is-offline #map { background-color: #e1e9dd; background-image: linear-gradient(rgba(111,137,102,.08) 1px, transparent 1px), linear-gradient(90deg, rgba(111,137,102,.08) 1px, transparent 1px); background-size: 48px 48px; }
.maplibregl-map { width: 100%; height: 100%; background: #e1e9dd; font: inherit; }
.maplibregl-canvas { outline: none; }
.maplibregl-ctrl-bottom-right { z-index: 410 !important; }
.maplibregl-ctrl-attrib { padding: 3px 7px !important; border-radius: 8px 0 0 0; background: rgba(18, 24, 19, .78) !important; color: #d4dfd1 !important; font-size: 9px !important; backdrop-filter: blur(8px); }
.maplibregl-ctrl-attrib a { color: var(--lime) !important; }
.map-topline { position: absolute; z-index: 450; top: 18px; right: 18px; left: 18px; display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; pointer-events: none; }
.map-location-chip, .map-float-button { border: 1px solid rgba(255,255,255,.17); background: rgba(19, 26, 20, .84); color: var(--text); box-shadow: 0 8px 26px rgba(10, 15, 11, .16); backdrop-filter: blur(16px); }
.map-location-chip { display: inline-flex; max-width: min(60%, 285px); min-height: 42px; align-items: center; gap: 9px; padding: 0 13px; border-radius: 14px; font-size: 11px; font-weight: 650; }
.map-location-chip .icon { width: 16px; height: 16px; color: var(--lime); }
.map-location-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.map-zoom-controls { display: grid; gap: 8px; pointer-events: auto; }
.map-float-button { display: grid; width: 43px; height: 43px; place-items: center; border-radius: 13px; cursor: pointer; transition: background .16s ease, color .16s ease, transform .16s ease; }
.map-float-button:hover { transform: translateY(-1px); background: #27322a; color: var(--lime); }
.map-float-button .icon { width: 18px; height: 18px; }
.locate-button { margin-top: 5px; color: var(--lime); }
.map-loading { position: absolute; z-index: 400; top: 50%; left: 50%; display: flex; align-items: center; gap: 10px; padding: 12px 16px; transform: translate(-50%, -50%); border: 1px solid rgba(255,255,255,.2); border-radius: 14px; background: rgba(17, 24, 18, .83); color: var(--text); font-size: 12px; backdrop-filter: blur(12px); pointer-events: none; transition: opacity .25s ease; }
.map-loading.is-hidden { opacity: 0; }
.offline-map-hint { position: absolute; z-index: 450; bottom: 23px; left: 50%; max-width: calc(100% - 32px); padding: 9px 12px; transform: translateX(-50%); border: 1px solid rgba(255,255,255,.17); border-radius: 11px; background: rgba(19,26,20,.86); color: #e4ecdf; font-size: 10px; text-align: center; backdrop-filter: blur(12px); pointer-events: none; }
.loading-spinner { width: 15px; height: 15px; border: 2px solid rgba(255,255,255,.24); border-top-color: var(--lime); border-radius: 50%; animation: spin .75s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.maplibregl-ctrl-logo { display: none !important; }
.gowesin-location-marker { display: grid; width: 36px; height: 36px; place-items: center; }
.gowesin-marker-dot { position: relative; width: 20px; height: 20px; border: 4px solid #fff; border-radius: 50%; background: #a8dd45; box-shadow: 0 1px 10px rgba(30,54,23,.5); }
.gowesin-marker-dot::after { position: absolute; inset: -10px; border: 1px solid rgba(168,221,69,.65); border-radius: 50%; background: rgba(168,221,69,.15); content: ""; }
.gowesin-marker-direction { display: grid; width: 34px; height: 34px; place-items: center; filter: drop-shadow(0 2px 4px rgba(18,30,16,.55)); }
.gowesin-marker-direction svg { width: 30px; height: 30px; overflow: visible; fill: #a8dd45; stroke: #fff; stroke-linejoin: round; stroke-width: 2.5px; transition: transform .18s ease-out; }
.map-popup { color: #172018; font-size: 12px; }

.ride-panel { display: flex; min-height: 0; flex-direction: column; gap: 18px; overflow-y: auto; padding: 25px 22px 18px; border-left: 1px solid var(--line); background: linear-gradient(160deg, rgba(27,36,29,.97), rgba(20,27,22,.98)); }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.eyebrow { margin: 0 0 7px; color: #849182; font-size: 9px; font-weight: 800; letter-spacing: 1.45px; }
h1, h2, p { margin-top: 0; }
.panel-heading h1 { margin: 0; font-size: 21px; letter-spacing: -.65px; }
.ride-state { display: inline-flex; flex: 0 0 auto; align-items: center; gap: 7px; padding: 7px 9px; border: 1px solid var(--line); border-radius: 99px; color: #a8b2a7; font-size: 8px; font-weight: 800; letter-spacing: .9px; }
.ride-state.is-live { border-color: rgba(192,243,91,.2); color: var(--lime); }
.ride-state .status-dot { width: 6px; height: 6px; }
.metric-card { padding: 17px 17px 15px; border: 1px solid var(--line); border-radius: 19px; background: linear-gradient(145deg, rgba(39,51,40,.8), rgba(28,38,31,.85)); box-shadow: inset 0 1px rgba(255,255,255,.03); }
.primary-metric { display: flex; align-items: flex-end; justify-content: space-between; padding-bottom: 15px; border-bottom: 1px solid var(--line); }
.metric-label { display: block; margin-bottom: 7px; color: #899487; font-size: 8px; font-weight: 800; letter-spacing: 1.1px; }
.primary-metric > div { display: flex; align-items: baseline; gap: 7px; }
.primary-metric strong { font-size: 54px; font-weight: 650; line-height: .92; letter-spacing: -2.5px; font-variant-numeric: tabular-nums; }
.primary-metric > div > span { color: var(--lime); font-size: 13px; font-weight: 700; }
.metric-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px; padding-top: 14px; }
.metric-grid > div { min-width: 0; }
.metric-grid strong { display: flex; min-height: 20px; align-items: baseline; color: #e9eee5; font-size: 13px; font-weight: 680; white-space: nowrap; }
.metric-grid strong small { color: var(--muted); font-size: 9px; font-weight: 500; }
.ride-actions { display: grid; grid-template-columns: minmax(0, 1fr) 100px; gap: 9px; }
.primary-button, .secondary-button, .upload-button { display: inline-flex; min-height: 46px; align-items: center; justify-content: center; gap: 9px; padding: 0 14px; border-radius: 13px; cursor: pointer; font-size: 11px; font-weight: 760; transition: background .16s ease, border-color .16s ease, transform .16s ease, opacity .16s ease; }
.primary-button { border: 1px solid transparent; background: var(--lime); color: #172010; }
.primary-button:hover:not(:disabled) { transform: translateY(-1px); background: #d0ff72; }
.primary-button.is-cancel { background: rgba(239, 129, 117, .17); color: #ffc0b8; }
.primary-button.is-cancel:hover:not(:disabled) { background: rgba(239, 129, 117, .26); }
.primary-button .icon { width: 17px; height: 17px; }
.secondary-button { border: 1px solid var(--line); background: rgba(255,255,255,.035); color: #d2dbce; }
.secondary-button:hover:not(:disabled) { border-color: rgba(192,243,91,.3); background: rgba(192,243,91,.07); }
button:disabled { cursor: not-allowed; opacity: .43; }
.panel-section { display: grid; gap: 11px; }
.section-title { display: flex; align-items: center; justify-content: space-between; color: #9aa597; font-size: 9px; font-weight: 800; letter-spacing: 1.2px; }
.section-hint { color: #748072; font-size: 8px; }
.route-card { display: flex; min-width: 0; align-items: center; gap: 11px; padding: 11px; border: 1px solid var(--line); border-radius: 14px; background: rgba(255,255,255,.025); }
.route-icon { display: grid; width: 37px; height: 37px; flex: 0 0 auto; place-items: center; border-radius: 11px; background: rgba(192,243,91,.1); color: var(--lime); }
.route-icon .icon { width: 18px; height: 18px; }
.route-copy { display: grid; min-width: 0; flex: 1; gap: 4px; }
.route-copy strong { overflow: hidden; color: #e0e7dc; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.route-copy span { overflow: hidden; color: var(--muted); font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.icon-button { display: grid; width: 32px; height: 32px; flex: 0 0 auto; place-items: center; border: 1px solid var(--line); border-radius: 9px; background: transparent; color: #9ba799; cursor: pointer; }
.icon-button:hover { color: var(--danger); }
.icon-button .icon { width: 15px; height: 15px; }
.upload-button { min-height: 39px; justify-content: flex-start; border: 1px dashed rgba(216,236,205,.2); background: rgba(255,255,255,.018); color: #c5d0c2; font-size: 10px; }
.upload-button:hover { border-color: rgba(192,243,91,.42); color: var(--lime); }
.upload-button .icon { width: 16px; height: 16px; }
.upload-button input { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; clip-path: inset(50%); }
.panel-footer { display: grid; gap: 13px; margin-top: auto; padding-top: 13px; border-top: 1px solid var(--line); }
.wake-toggle { position: relative; display: flex; align-items: center; gap: 10px; cursor: pointer; }
.toggle-icon { display: grid; width: 34px; height: 34px; flex: 0 0 auto; place-items: center; border-radius: 10px; background: rgba(255,255,255,.045); color: var(--orange); }
.toggle-icon .icon { width: 17px; height: 17px; }
.wake-toggle > span:nth-child(2) { display: grid; flex: 1; gap: 3px; }
.wake-toggle strong { color: #dbe3d7; font-size: 10px; font-weight: 650; }
.wake-toggle small { color: var(--muted); font-size: 9px; }
.wake-toggle input { position: absolute; right: 0; width: 40px; height: 23px; margin: 0; opacity: 0; cursor: pointer; }
.toggle-track { position: relative; width: 36px; height: 21px; flex: 0 0 auto; border: 1px solid rgba(255,255,255,.14); border-radius: 99px; background: #364037; transition: background .2s ease; }
.toggle-track::after { position: absolute; top: 3px; left: 3px; width: 13px; height: 13px; border-radius: 50%; background: #a8b0a5; content: ""; transition: transform .2s ease, background .2s ease; }
.wake-toggle input:checked + .toggle-track { border-color: rgba(192,243,91,.35); background: rgba(192,243,91,.27); }
.wake-toggle input:checked + .toggle-track::after { transform: translateX(15px); background: var(--lime); }
.wake-toggle input:focus-visible + .toggle-track, button:focus-visible, a:focus-visible, input:focus-visible { outline: 2px solid var(--lime); outline-offset: 3px; }
.browser-note { display: flex; align-items: flex-start; gap: 7px; margin: 0; color: #839080; font-size: 9px; line-height: 1.5; }
.browser-note .icon { width: 14px; height: 14px; color: #a3ad9e; }

.content-page { overflow: auto; padding: clamp(24px, 4vw, 48px); }
.content-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; max-width: 1060px; margin: 0 auto 28px; }
.content-heading h1 { margin: 0; font-size: clamp(29px, 4vw, 40px); letter-spacing: -1.5px; }
.page-subtitle { margin: 8px 0 0; color: var(--muted); font-size: 13px; }
.activity-total { display: grid; gap: 3px; justify-items: end; padding: 12px 16px; border: 1px solid var(--line); border-radius: 14px; background: rgba(255,255,255,.025); }
.activity-total strong { color: var(--lime); font-size: 19px; }
.activity-total span { color: var(--muted); font-size: 10px; }
.activity-list { display: grid; max-width: 1060px; gap: 12px; margin: 0 auto; }
.activity-card { display: grid; grid-template-columns: 52px minmax(0, 1fr) auto; align-items: center; gap: 15px; padding: 17px 18px; border: 1px solid var(--line); border-radius: 17px; background: linear-gradient(130deg, rgba(31,42,33,.88), rgba(24,32,26,.88)); }
.activity-icon { display: grid; width: 48px; height: 48px; place-items: center; border-radius: 14px; background: rgba(192,243,91,.09); color: var(--lime); }
.activity-info { min-width: 0; }
.activity-info h2 { overflow: hidden; margin: 0 0 5px; font-size: 14px; text-overflow: ellipsis; white-space: nowrap; }
.activity-info p { margin: 0; color: var(--muted); font-size: 10px; }
.activity-stats { display: flex; align-items: center; gap: clamp(10px, 3vw, 30px); }
.activity-stat { display: grid; gap: 4px; }
.activity-stat span { color: #829080; font-size: 8px; font-weight: 750; letter-spacing: .8px; }
.activity-stat strong { font-size: 12px; font-weight: 650; }
.export-button { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 11px; border: 1px solid var(--line); border-radius: 10px; background: transparent; color: #d4ded0; cursor: pointer; font-size: 9px; font-weight: 700; }
.export-button:hover { border-color: rgba(192,243,91,.35); color: var(--lime); }
.export-button .icon { width: 15px; height: 15px; }
.empty-state { display: grid; max-width: 420px; justify-items: center; margin: clamp(38px, 12vh, 110px) auto 0; text-align: center; }
.empty-icon { display: grid; width: 65px; height: 65px; margin-bottom: 17px; place-items: center; border: 1px solid rgba(192,243,91,.15); border-radius: 22px; background: rgba(192,243,91,.07); color: var(--lime); }
.empty-icon .icon { width: 28px; height: 28px; }
.empty-state h2 { margin: 0 0 8px; font-size: 17px; }
.empty-state p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.65; }
.text-button { margin-top: 16px; border: 0; background: transparent; color: var(--lime); cursor: pointer; font-size: 11px; font-weight: 700; }
.text-button span { margin-left: 5px; }

.device-grid { display: grid; max-width: 1060px; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin: 0 auto; }
.device-card { display: flex; min-width: 0; flex-direction: column; align-items: flex-start; padding: 21px; border: 1px solid var(--line); border-radius: 18px; background: linear-gradient(145deg, rgba(31,42,33,.88), rgba(24,32,26,.9)); }
.device-icon { display: grid; width: 42px; height: 42px; margin-bottom: 17px; place-items: center; border-radius: 13px; }
.gps-icon { background: rgba(192,243,91,.11); color: var(--lime); }
.watch-icon { background: rgba(133,174,238,.12); color: #9bbdf0; }
.bike-icon { background: rgba(232,166,110,.12); color: var(--orange); }
.permission-icon { background: rgba(155,191,148,.11); color: #b7d5af; }
.device-tag { margin-bottom: 6px; color: #849182; font-size: 8px; font-weight: 800; letter-spacing: 1.2px; }
.device-card h2 { margin: 0 0 8px; font-size: 17px; letter-spacing: -.35px; }
.device-card > p:not(.calibration-message) { margin: 0 0 17px; color: #a2ada0; font-size: 11px; line-height: 1.65; }
.calibration-result { display: grid; width: 100%; grid-template-columns: 1fr 1fr; gap: 10px; margin: auto 0 13px; padding: 13px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.calibration-result > div { display: grid; gap: 6px; }
.calibration-result span { color: #829080; font-size: 8px; font-weight: 800; letter-spacing: .8px; }
.calibration-result strong { color: var(--text); font-size: 17px; }
.calibration-result strong small { color: var(--muted); font-size: 10px; font-weight: 500; }
.calibration-progress { width: 100%; height: 4px; margin: 0 0 11px; overflow: hidden; border-radius: 9px; background: rgba(255,255,255,.08); }
.calibration-progress span { display: block; width: 0; height: 100%; border-radius: inherit; background: var(--lime); transition: width .3s ease; }
.calibration-message { min-height: 17px; margin: 0 0 12px; color: #a6b0a3; font-size: 10px; }
.device-card > .primary-button, .device-card > .secondary-button { width: 100%; margin-top: auto; }
.device-footnote { display: flex; align-items: flex-start; gap: 8px; margin-top: auto; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: rgba(255,255,255,.025); color: #98a394; font-size: 9px; line-height: 1.55; }
.device-footnote .icon { width: 14px; height: 14px; flex: 0 0 auto; }
.offline-map-card { grid-column: 1 / -1; }
.offline-map-status { width: 100%; min-height: 18px; margin: 0 0 10px; color: #b7c3b2; font-size: 10px; line-height: 1.55; }
.offline-map-progress { width: 100%; height: 7px; margin: 0 0 14px; accent-color: var(--lime); }
.offline-map-actions { display: grid; width: 100%; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; margin: 0 0 12px; }
.offline-map-actions .primary-button, .offline-map-actions .secondary-button { width: 100%; margin: 0; }
.offline-map-file { text-decoration: none; }
.offline-map-actions .text-button { grid-column: 1 / -1; justify-self: start; padding: 4px 0; color: #c1ccbc; }
.offline-map-card .device-footnote { margin-top: 0; }
.manual-fields { display: grid; width: 100%; grid-template-columns: 1fr 1fr; gap: 10px; margin: auto 0 13px; }
.manual-fields label { display: grid; gap: 7px; color: #a5b0a2; font-size: 9px; font-weight: 700; }
.input-with-unit { display: flex; align-items: center; gap: 6px; padding: 0 10px; border: 1px solid var(--line); border-radius: 10px; background: rgba(0,0,0,.14); }
.input-with-unit input { width: 100%; min-width: 0; height: 39px; border: 0; outline: 0; background: transparent; color: var(--text); font-size: 12px; }
.input-with-unit input:focus-visible { outline: 0; }
.input-with-unit span { color: var(--muted); font-size: 9px; }
.save-manual { margin-top: 0 !important; }
.device-card > .calibration-message + .primary-button { margin-top: 0; }

.mobile-nav { display: none; }
.toast { position: fixed; z-index: 1000; right: 20px; bottom: 20px; max-width: min(390px, calc(100vw - 32px)); padding: 12px 16px; transform: translateY(14px); border: 1px solid rgba(192,243,91,.25); border-radius: 13px; background: rgba(26,35,28,.96); color: #eaf1e4; box-shadow: 0 12px 36px rgba(0,0,0,.32); font-size: 11px; line-height: 1.5; opacity: 0; pointer-events: none; transition: opacity .2s ease, transform .2s ease; }
.toast.is-visible { transform: translateY(0); opacity: 1; }

@media (max-width: 1100px) {
  .ride-layout { grid-template-columns: minmax(0, 1fr) 320px; }
  .ride-panel { gap: 14px; padding-right: 17px; padding-left: 17px; }
  .metric-grid { gap: 5px; }
  .primary-metric strong { font-size: 48px; }
}

@media (max-width: 760px) {
  :root { --topbar-height: 62px; --nav-width: 0px; }
  body { min-height: 100vh; min-height: 100dvh; }
  .app-shell { grid-template-columns: minmax(0, 1fr); grid-template-rows: var(--topbar-height) minmax(0, 1fr) calc(62px + env(safe-area-inset-bottom, 0px)); }
  .topbar { grid-column: 1; padding: 0 16px; }
  .brand { gap: 9px; }
  .brand img { width: 36px; height: 36px; border-radius: 11px; }
  .brand-copy strong { font-size: 17px; }
  .topbar-right { gap: 0; }
  .connection-pill { margin-right: 7px; padding: 7px 8px; font-size: 8px; }
  .topbar-date, .side-nav { display: none; }
  .gps-pill { min-height: 34px; gap: 7px; padding: 7px 10px; font-size: 9px; }
  .gps-pill .status-dot { width: 6px; height: 6px; }
  .workspace { grid-row: 2; overflow: auto; overscroll-behavior: contain; }
  .workspace { scrollbar-width: none; }
  .workspace::-webkit-scrollbar { display: none; }
  .page-view { height: auto; min-height: 100%; }
  .ride-layout { display: flex; height: auto; min-height: 100%; flex-direction: column; }
  .map-frame { height: clamp(270px, 43svh, 440px); min-height: 270px; flex: 0 0 auto; }
  .map-topline { top: 12px; right: 12px; left: 12px; }
  .offline-map-hint { bottom: 16px; font-size: 9px; }
  .map-location-chip { min-height: 38px; max-width: calc(100% - 58px); gap: 7px; padding: 0 10px; border-radius: 12px; font-size: 10px; }
  .map-float-button { width: 38px; height: 38px; border-radius: 12px; }
  .map-zoom-controls { gap: 6px; }
  .ride-panel { gap: 13px; overflow: visible; padding: 17px 15px 20px; border-top: 1px solid var(--line); border-left: 0; }
  .panel-heading h1 { font-size: 19px; }
  .metric-card { padding: 13px 14px; border-radius: 16px; }
  .primary-metric { padding-bottom: 12px; }
  .primary-metric strong { font-size: 44px; }
  .metric-grid { padding-top: 11px; }
  .metric-grid strong { font-size: 12px; }
  .ride-actions { grid-template-columns: minmax(0, 1fr) 92px; }
  .primary-button, .secondary-button { min-height: 44px; padding: 0 11px; font-size: 10px; }
  .panel-footer { margin-top: 0; }
  .content-page { min-height: 100%; padding: 25px 16px 30px; }
  .content-heading { align-items: flex-start; margin-bottom: 20px; }
  .content-heading h1 { font-size: 31px; }
  .page-subtitle { max-width: 255px; font-size: 11px; line-height: 1.5; }
  .activity-total { padding: 9px 12px; }
  .activity-card { grid-template-columns: 42px minmax(0, 1fr); gap: 11px; padding: 13px; }
  .activity-icon { width: 42px; height: 42px; border-radius: 12px; }
  .activity-info h2 { font-size: 12px; }
  .activity-info p { font-size: 9px; }
  .activity-stats { grid-column: 2; grid-row: 2; flex-wrap: wrap; gap: 13px; }
  .activity-stat { gap: 3px; }
  .activity-stat strong { font-size: 10px; }
  .export-button { grid-column: 1 / -1; justify-self: stretch; justify-content: center; }
  .device-grid { grid-template-columns: minmax(0, 1fr); gap: 11px; }
  .device-card { padding: 17px; }
  .device-icon { width: 38px; height: 38px; margin-bottom: 13px; border-radius: 11px; }
  .device-card > p:not(.calibration-message) { margin-bottom: 13px; }
  .device-footnote { margin-top: 0; }
  .calibration-result, .manual-fields { margin-top: 4px; }
  .mobile-nav { z-index: 30; grid-row: 3; display: grid; grid-template-columns: repeat(3, 1fr); align-items: stretch; padding: 5px 13px calc(5px + env(safe-area-inset-bottom, 0px)); border-top: 1px solid var(--line); background: rgba(17,22,18,.96); backdrop-filter: blur(18px); }
  .mobile-nav-link { display: flex; min-width: 0; flex-direction: column; align-items: center; justify-content: center; gap: 4px; border: 0; border-radius: 12px; background: transparent; color: #839081; cursor: pointer; }
  .mobile-nav-link .icon { width: 19px; height: 19px; }
  .mobile-nav-link span { font-size: 9px; font-weight: 650; }
  .mobile-nav-link.active { color: var(--lime); }
  .toast { right: 12px; bottom: calc(74px + env(safe-area-inset-bottom, 0px)); left: 12px; max-width: none; }
}

@media (max-width: 390px) {
  .topbar { padding-right: 11px; padding-left: 11px; }
  .brand-copy small { letter-spacing: 1.4px; }
  .gps-pill { padding-right: 8px; padding-left: 8px; font-size: 8px; }
  .ride-panel { padding-right: 12px; padding-left: 12px; }
  .metric-grid { gap: 3px; }
  .metric-label { font-size: 7px; letter-spacing: .7px; }
  .ride-actions { grid-template-columns: minmax(0, 1fr) 82px; gap: 7px; }
  .content-page { padding-right: 12px; padding-left: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
