/* ════════════════════════════════════════════════════════════════
   Akwaba — Design system commun (data-grade industrial)
   Palette : navy/papier/or/rouge brique/bleu acier
   Polices : Newsreader (titres) · Manrope (UI) · JetBrains Mono (data)
   ════════════════════════════════════════════════════════════════ */

:root {
  --bg: #0a0e1a;
  --bg-elev-1: #0f1422;
  --bg-elev-2: #141a2c;
  --bg-elev-3: #1c2438;
  --text: #f5f5f0;
  --text-2: #c5c8d1;
  --text-3: #8b92a3;
  --text-4: #5a6178;
  --line: #1f2937;
  --line-2: #2a3548;
  --danger: #d94a3a;
  --danger-soft: rgba(217, 74, 58, 0.12);
  --warn: #d18a2a;
  --warn-soft: rgba(209, 138, 42, 0.12);
  --confirm: #6b9a4f;
  --confirm-soft: rgba(107, 154, 79, 0.12);
  --info: #c89b3c;
  --info-soft: rgba(200, 155, 60, 0.12);
  --police: #5a8fc7;
  --police-soft: rgba(90, 143, 199, 0.12);
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;
  --font-display: 'Newsreader', Georgia, serif;
  --font-ui: 'Manrope', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  background: #050810; color: var(--text);
  font-family: var(--font-ui); font-size: 14px; line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
body { min-height: 100vh; padding: 20px 0; display: flex; justify-content: center; }

.viewport {
  width: 100%; max-width: 430px;
  background: var(--bg); border: 1px solid var(--line);
  border-radius: 32px; overflow: hidden;
  box-shadow: 0 40px 80px rgba(0,0,0,0.6);
}
.frame-bezel {
  border: 14px solid #050810;
  border-top-width: 50px; border-bottom-width: 38px;
  border-radius: 56px; position: relative;
}
.frame-bezel::before {
  content: ''; position: absolute;
  top: -36px; left: 50%; transform: translateX(-50%);
  width: 100px; height: 22px;
  background: #050810; border-radius: 0 0 16px 16px;
}

/* ─── App bar ─── */
.app-bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 18px 12px;
  border-bottom: 1px solid var(--line);
}
.app-bar .left { display: flex; align-items: center; gap: 10px; }
.app-bar h1 {
  font-family: var(--font-display);
  font-size: 20px; font-weight: 600; letter-spacing: -0.01em;
}

/* ─── Tags ─── */
.tag {
  display: inline-flex; align-items: center; padding: 3px 8px;
  border-radius: var(--r-sm);
  background: var(--bg-elev-2); border: 1px solid var(--line-2);
  font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.05em;
  color: var(--text-3);
}
.tag-info { color: var(--info); border-color: var(--info); background: var(--info-soft); }
.tag-danger { color: var(--danger); border-color: var(--danger); background: var(--danger-soft); }
.tag-confirm { color: var(--confirm); border-color: var(--confirm); background: var(--confirm-soft); }
.tag-warn { color: var(--warn); border-color: var(--warn); background: var(--warn-soft); }

.icon-btn {
  width: 36px; height: 36px;
  border-radius: var(--r-md);
  background: var(--bg-elev-2); border: 1px solid var(--line-2);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-2); cursor: pointer;
  font-family: var(--font-ui); font-size: 14px;
}
.icon-btn:hover { background: var(--bg-elev-3); }

/* ─── Page ─── */
.page { padding: 16px 18px 32px; }

.label {
  font-family: var(--font-mono);
  font-size: 10px; letter-spacing: 0.08em;
  color: var(--text-3); text-transform: uppercase;
}

.card {
  background: var(--bg-elev-1);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 14px;
}

.divider { height: 1px; background: var(--line); margin: 14px 0; border: 0; }
.serif { font-family: var(--font-display); }
.mono { font-family: var(--font-mono); }

/* ─── Boutons ─── */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 12px 16px; border: 1px solid var(--line-2);
  border-radius: var(--r-md);
  font-family: var(--font-ui); font-size: 14px; font-weight: 600;
  background: var(--bg-elev-2); color: var(--text); cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease;
}
.btn:hover { background: var(--bg-elev-3); }
.btn-block { width: 100%; }
.btn-confirm { background: var(--confirm); color: #fff; border-color: var(--confirm); }
.btn-confirm:hover { background: #5a8a40; }
.btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-info { background: var(--info); color: var(--bg); border-color: var(--info); font-weight: 700; }
.btn-info:hover { background: #b88a2e; }
.btn-ghost { background: transparent; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ─── Chips ─── */
.chip {
  display: inline-flex; align-items: center;
  padding: 8px 14px; border-radius: 999px;
  background: var(--bg-elev-2); border: 1px solid var(--line-2);
  font-size: 13px; color: var(--text-2); cursor: pointer;
  white-space: nowrap;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.chip:hover { border-color: var(--text-3); }
.chip.active { background: var(--text); color: var(--bg); border-color: var(--text); }
.scroll-x { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; }
.scroll-x::-webkit-scrollbar { display: none; }

/* ─── Inputs ─── */
.input-row {
  padding: 14px;
  display: flex; gap: 12px; align-items: center;
}
.input-row .dot {
  width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
}
.input-row input {
  flex: 1;
  background: transparent; border: 0;
  color: var(--text); font-size: 14px; font-weight: 600; font-family: var(--font-ui);
  outline: none;
}
.input-row .role {
  font-family: var(--font-mono); font-size: 11px; color: var(--text-3);
  letter-spacing: 0.05em;
}

/* ─── Itinéraire card ─── */
.route {
  background: var(--bg-elev-1);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 14px;
  margin-top: 10px;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.route:hover { border-color: var(--line-2); }
.route.selected {
  border-color: var(--info);
  background: linear-gradient(180deg, var(--info-soft), transparent);
}
.route .head {
  display: flex; align-items: center; gap: 12px;
}
.route .head .badge {
  width: 36px; height: 36px;
  border-radius: var(--r-md);
  background: var(--bg-elev-3);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-weight: 700; font-size: 18px;
  color: var(--info);
  flex-shrink: 0;
}
.route.selected .head .badge { background: var(--info); color: var(--bg); }
.route .head .title {
  font-family: var(--font-display);
  font-size: 17px; font-weight: 600;
  flex: 1;
  line-height: 1.2;
}
.route .head .subtitle {
  font-size: 11px; color: var(--text-3);
  margin-top: 2px;
}
.route .grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.route .grid div .label { font-size: 9px; }
.route .grid div .num {
  font-family: var(--font-display);
  font-size: 18px; font-weight: 600; letter-spacing: -0.01em;
  margin-top: 2px;
}
.route .grid div .num.peage-yes { color: var(--warn); }
.route .grid div .num.peage-no { color: var(--confirm); }

/* ─── Toast ─── */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--bg-elev-3); color: var(--text);
  padding: 12px 18px; border-radius: var(--r-md);
  border: 1px solid var(--line-2);
  font-size: 13px;
  z-index: 1000;
  opacity: 0; transition: opacity 0.2s;
  pointer-events: none;
  max-width: 90%;
}
.toast.show { opacity: 1; }
.toast.danger { border-color: var(--danger); color: var(--danger); }
.toast.confirm { border-color: var(--confirm); color: var(--confirm); }
.toast.info { border-color: var(--info); color: var(--info); }

/* ─── Loading ─── */
.spinner {
  width: 22px; height: 22px;
  border: 2.5px solid var(--line-2);
  border-top-color: var(--info);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

.loading-row {
  display: flex; gap: 10px; align-items: center;
  padding: 14px;
  font-family: var(--font-mono); font-size: 11px;
  color: var(--text-3); letter-spacing: 0.05em;
}

/* ─── Carte placeholder/SVG ─── */
.map-wrap {
  position: relative;
  height: 220px;
  background: var(--bg-elev-1);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  overflow: hidden;
  margin-top: 14px;
}
.map-wrap.empty {
  display: flex; align-items: center; justify-content: center;
  background: repeating-linear-gradient(45deg, #0f1422 0, #0f1422 12px, #141a2c 12px, #141a2c 24px);
  font-family: var(--font-mono); font-size: 11px; color: var(--text-3);
  letter-spacing: 0.05em;
}
.map-wrap > div#gmap, .map-wrap > svg { width: 100%; height: 100%; }

/* ─── Footer ─── */
.brand-foot {
  font-family: var(--font-mono); font-size: 10px;
  color: var(--text-4); text-align: center;
  margin-top: 18px; letter-spacing: 0.05em;
}

/* Responsive */
@media (max-width: 380px) {
  body { padding: 0; }
  .viewport, .frame-bezel { border-radius: 0; border: 0; }
  .frame-bezel::before { display: none; }
}
