:root {
  --bg: #0a0a0f;
  --panel: #15151f;
  --panel-2: #1d1d2b;
  --txt: #f2f2f7;
  --muted: #8a8a9a;
  --accent: #ff5a1f;
  --green: #30d158;
  --red: #ff453a;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

body {
  background: var(--bg);
  color: var(--txt);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro", system-ui, sans-serif;
  min-height: 100vh;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
}

.view { display: none; min-height: 100vh; flex-direction: column;
  padding: env(safe-area-inset-top) 16px env(safe-area-inset-bottom); }
.view.active { display: flex; }

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; padding: 12px 0; min-height: 44px;
}
.topbar .title { font-weight: 600; font-size: 17px; }
.link-btn { background: none; border: none; color: var(--accent);
  font-size: 16px; font-weight: 600; padding: 8px; cursor: pointer; }

.pill {
  font-size: 11px; font-weight: 700; letter-spacing: .04em;
  padding: 4px 9px; border-radius: 999px; border: 1px solid transparent;
}
.pill-off { background: #2a2a38; color: var(--muted); }
.pill-on  { background: rgba(48,209,88,.15); color: var(--green);
  border-color: rgba(48,209,88,.4); }

/* Compteur */
.speedo { flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center; }
.speed-value {
  font-size: 34vw; line-height: .9; font-weight: 800;
  font-variant-numeric: tabular-nums; letter-spacing: -.04em;
}
.speed-unit { font-size: 20px; color: var(--muted); font-weight: 600;
  margin-top: 8px; }

/* Métriques */
.metrics {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 10px; margin: 8px 0 4px;
}
.metric { background: var(--panel); border-radius: 14px; padding: 12px 10px;
  text-align: center; }
.metric-label { font-size: 11px; color: var(--muted); text-transform: uppercase;
  letter-spacing: .05em; margin-bottom: 4px; }
.metric-value { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.metric-value .u { font-size: 12px; color: var(--muted); font-weight: 600; margin-left: 2px; }

/* Bouton REC */
.controls { padding: 16px 0 8px; }
.rec-btn {
  width: 100%; padding: 20px; border: none; border-radius: 18px;
  background: var(--accent); color: #fff; font-size: 20px; font-weight: 800;
  letter-spacing: .04em; cursor: pointer; transition: background .15s, transform .1s;
}
.rec-btn:active { transform: scale(.98); }
.rec-btn.recording { background: var(--red); animation: pulse 1.4s infinite; }
@keyframes pulse { 0%,100%{ box-shadow: 0 0 0 0 rgba(255,69,58,.5);} 50%{ box-shadow: 0 0 0 14px rgba(255,69,58,0);} }

.sync-msg { text-align: center; color: var(--muted); font-size: 14px;
  min-height: 20px; padding: 6px 0 10px; }
.sync-msg.ok { color: var(--green); }
.sync-msg.err { color: var(--red); }

/* Liste trajets */
.trips-list { flex: 1; overflow-y: auto; padding: 4px 0 20px; }
.trip-card {
  background: var(--panel); border-radius: 14px; padding: 14px 16px; margin-bottom: 10px;
}
.trip-date { font-size: 15px; font-weight: 700; margin-bottom: 8px; }
.trip-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.trip-stat { text-align: center; }
.trip-stat .v { font-size: 16px; font-weight: 700; font-variant-numeric: tabular-nums; }
.trip-stat .l { font-size: 10px; color: var(--muted); text-transform: uppercase; }
.trip-actions { display: flex; gap: 8px; margin-top: 12px; }
.dl-btn {
  flex: 1; text-align: center; text-decoration: none;
  background: var(--panel-2); color: var(--accent); font-size: 13px; font-weight: 600;
  padding: 9px 6px; border-radius: 10px; border: 1px solid rgba(255,90,31,.25);
}
.dl-btn:active { background: rgba(255,90,31,.15); }
.trips-empty { text-align: center; color: var(--muted); padding: 40px 20px; }
.pending-badge { display: inline-block; font-size: 10px; font-weight: 700;
  background: rgba(255,90,31,.2); color: var(--accent); padding: 2px 7px;
  border-radius: 6px; margin-left: 8px; vertical-align: middle; }
