:root {
  --bg: #0b0d10;
  --bg2: #12151a;
  --panel: #161a21;
  --panel2: #1c222c;
  --border: #2a3140;
  --text: #e8edf5;
  --muted: #8b95a8;
  --primary: #3e8ef7;
  --primary2: #62a6ff;
  --ok: #34c759;
  --warn: #ff9f0a;
  --danger: #ff453a;
  --charge: #ff9f0a;
  --trip: #3e8ef7;
  --stop: #6b7280;
  --radius: 16px;
  --shadow: 0 10px 40px rgba(0,0,0,.35);
  --sidebar: 260px;
  --font: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  background: radial-gradient(1200px 600px at 10% -10%, #1a2740 0%, transparent 50%),
              radial-gradient(900px 500px at 100% 0%, #1a1520 0%, transparent 45%),
              var(--bg);
  color: var(--text);
}

a { color: var(--primary2); text-decoration: none; }
a:hover { text-decoration: underline; }

.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar);
  background: rgba(18,21,26,.92);
  border-right: 1px solid var(--border);
  padding: 1.25rem 1rem;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  backdrop-filter: blur(10px);
}
.brand { display: flex; gap: .85rem; align-items: center; margin-bottom: 1.5rem; padding: .25rem .5rem; }
.brand-mark {
  width: 42px; height: 42px; border-radius: 12px;
  display: grid; place-items: center; font-weight: 800;
  background: linear-gradient(135deg, #e82127, #ff5a5f);
  box-shadow: 0 8px 24px rgba(232,33,39,.35);
}
.brand-title { font-weight: 700; letter-spacing: .02em; }
.brand-sub { color: var(--muted); font-size: .8rem; }
.nav { display: flex; flex-direction: column; gap: .25rem; flex: 1; }
.nav a {
  color: var(--muted);
  padding: .7rem .9rem;
  border-radius: 12px;
  text-decoration: none;
  font-weight: 500;
}
.nav a:hover { background: var(--panel2); color: var(--text); text-decoration: none; }
.nav a.active {
  background: linear-gradient(90deg, rgba(62,142,247,.2), rgba(62,142,247,.05));
  color: #fff;
  border: 1px solid rgba(62,142,247,.35);
}
.sidebar-foot { border-top: 1px solid var(--border); padding-top: 1rem; display: grid; gap: .5rem; }
.version-link {
  display: block;
  text-align: center;
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .04em;
  color: var(--muted);
  text-decoration: none;
  opacity: .75;
  padding: .15rem 0 .1rem;
  font-variant-numeric: tabular-nums;
}
.version-link:hover,
.version-link.active {
  color: var(--primary2);
  opacity: 1;
  text-decoration: underline;
}

/* Changelog / notes de version */
.changelog-card { max-width: 900px; }
.changelog-body { line-height: 1.55; font-size: .95rem; }
.changelog-body .changelog-h1 {
  font-size: 1.35rem;
  margin: 0 0 1rem;
}
.changelog-body .changelog-h2 {
  font-size: 1.15rem;
  margin: 1.75rem 0 .65rem;
  padding-bottom: .35rem;
  border-bottom: 1px solid var(--border);
  color: var(--primary2);
}
.changelog-body .changelog-h3 {
  font-size: 1rem;
  margin: 1.1rem 0 .4rem;
  color: var(--text);
}
.changelog-body p { margin: .45rem 0; color: var(--text); }
.changelog-body .changelog-list {
  margin: .35rem 0 .75rem 1.1rem;
  padding: 0;
}
.changelog-body .changelog-list li { margin: .28rem 0; }
.changelog-body .changelog-hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 1.5rem 0;
}
.changelog-body code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: .85em;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: .1rem .35rem;
}
.changelog-body strong { font-weight: 700; }
.changelog-table { margin: .75rem 0 1rem; }
.changelog-table .table { min-width: 0; }

.main { flex: 1; min-width: 0; padding: 1.25rem 1.5rem 2rem; }
.topbar {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 1rem; margin-bottom: 1.25rem; flex-wrap: wrap;
}
.page-title { margin: 0; font-size: 1.75rem; letter-spacing: -.02em; }
.page-sub { margin: .25rem 0 0; color: var(--muted); }
.topbar-right { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }

.content { max-width: 1600px; }

.card {
  background: linear-gradient(180deg, rgba(28,34,44,.95), rgba(18,21,26,.95));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.2rem;
  box-shadow: var(--shadow);
}
.skeleton { color: var(--muted); }

.vehicle-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1rem;
}
.vehicle-card {
  position: relative;
  overflow: hidden;
}
.vehicle-card::before {
  content: "";
  position: absolute; inset: 0 auto 0 0; width: 5px;
  background: var(--accent, var(--primary));
}
.vehicle-head {
  display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem;
}
.vehicle-name { font-size: 1.25rem; font-weight: 700; margin: 0; }
.vehicle-vin { color: var(--muted); font-size: .8rem; font-family: ui-monospace, monospace; }
.state-chip {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .35rem .75rem; border-radius: 999px; font-size: .8rem; font-weight: 700;
  letter-spacing: .02em;
  background: #222833; color: var(--muted); border: 1px solid var(--border);
}
/* Conduite : bleu bien visible */
.state-chip.driving {
  color: #ffffff;
  border-color: #3e8ef7;
  background: linear-gradient(135deg, #1a6fd4 0%, #3e8ef7 55%, #62a6ff 100%);
  box-shadow: 0 0 0 1px rgba(62,142,247,.35), 0 0 16px rgba(62,142,247,.45);
  text-shadow: 0 1px 1px rgba(0,0,0,.25);
}
/* Charge : jaune / orange bien visible */
.state-chip.charging {
  color: #1a1200;
  border-color: #ffb020;
  background: linear-gradient(135deg, #ff9f0a 0%, #ffcc33 55%, #ffe066 100%);
  box-shadow: 0 0 0 1px rgba(255,159,10,.4), 0 0 16px rgba(255,176,32,.5);
  text-shadow: 0 1px 0 rgba(255,255,255,.25);
}
.state-chip.parked { color: #b0b8c6; }
.state-chip.offline, .state-chip.asleep { color: #888; }

/* Carte véhicule teintée selon l'activité */
.vehicle-card.is-driving {
  border-color: rgba(62,142,247,.55);
  box-shadow: 0 0 0 1px rgba(62,142,247,.2), 0 10px 40px rgba(30,100,220,.18);
}
.vehicle-card.is-driving::before {
  background: linear-gradient(180deg, #3e8ef7, #62a6ff);
  width: 6px;
  box-shadow: 0 0 12px rgba(62,142,247,.7);
}
.vehicle-card.is-charging {
  border-color: rgba(255,176,32,.55);
  box-shadow: 0 0 0 1px rgba(255,159,10,.25), 0 10px 40px rgba(255,159,10,.16);
}
.vehicle-card.is-charging::before {
  background: linear-gradient(180deg, #ff9f0a, #ffd60a);
  width: 6px;
  box-shadow: 0 0 12px rgba(255,176,32,.7);
}

.metric-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: .75rem;
  margin: 1rem 0;
}
.metric { background: var(--bg2); border-radius: 12px; padding: .75rem; border: 1px solid var(--border); }
.metric .lbl { color: var(--muted); font-size: .75rem; }
.metric .val { font-size: 1.35rem; font-weight: 700; margin-top: .15rem; }
.soc-bar {
  height: 8px; border-radius: 999px; background: #222; overflow: hidden; margin-top: .55rem;
}
.soc-bar > span {
  display: block; height: 100%; border-radius: inherit;
  background: linear-gradient(90deg, #ff453a, #ff9f0a, #34c759);
}

.card-actions { display: flex; gap: .5rem; flex-wrap: wrap; }

.btn {
  border: 1px solid var(--border);
  background: var(--panel2);
  color: var(--text);
  border-radius: 12px;
  padding: .55rem .9rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex; align-items: center; gap: .4rem;
  text-decoration: none;
}
.btn:hover { filter: brightness(1.08); text-decoration: none; }
.btn-primary {
  background: linear-gradient(135deg, var(--primary), #2563eb);
  border-color: transparent;
}
.btn-ghost { background: transparent; }
.btn-sm { padding: .35rem .65rem; font-size: .85rem; border-radius: 10px; }

.input, .select {
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 12px;
  padding: .5rem .75rem;
  font: inherit;
}
.pill {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: .35rem .75rem;
  font-size: .8rem;
  color: var(--muted);
}
.badge {
  background: var(--danger);
  color: #fff;
  border-radius: 999px;
  min-width: 1.4rem;
  height: 1.4rem;
  display: grid; place-items: center;
  font-size: .75rem; font-weight: 700;
}
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }

.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: .75rem;
  margin-bottom: 1rem;
}
.stat {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: .9rem 1rem;
}
.stat .lbl { color: var(--muted); font-size: .8rem; }
.stat .val { font-size: 1.4rem; font-weight: 700; margin-top: .2rem; }

.table-wrap { overflow: auto; border: 1px solid var(--border); border-radius: var(--radius); }
.table {
  width: 100%; border-collapse: collapse; min-width: 720px; background: var(--panel);
}
.table th, .table td {
  padding: .75rem .9rem; border-bottom: 1px solid var(--border); text-align: left; white-space: nowrap;
}
.table th { color: var(--muted); font-size: .8rem; font-weight: 600; background: var(--bg2); position: sticky; top: 0; }
.table tr:hover td { background: rgba(255,255,255,.02); }

.map-full {
  height: calc(100vh - 140px);
  min-height: 480px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
}
.map-panel {
  height: 420px;
  border-radius: 12px;
  border: 1px solid var(--border);
  overflow: hidden;
}
.grid-2 {
  display: grid;
  grid-template-columns: 1.1fr .9fr;
  gap: 1rem;
}
@media (max-width: 1100px) {
  .grid-2 { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .main { padding: 1rem; }
}

.timeline { display: flex; flex-direction: column; gap: .75rem; }
.tl-item {
  display: grid;
  grid-template-columns: 90px 14px 1fr;
  gap: .9rem;
  align-items: start;
}
.tl-time { color: var(--muted); font-variant-numeric: tabular-nums; padding-top: .35rem; }
.tl-dot {
  width: 14px; height: 14px; border-radius: 50%; margin-top: .45rem;
  box-shadow: 0 0 0 4px rgba(255,255,255,.04);
}
.tl-dot.blue { background: var(--trip); }
.tl-dot.orange { background: var(--charge); }
.tl-dot.gray { background: var(--stop); }
.tl-body {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: .85rem 1rem;
}
.tl-body h4 { margin: 0 0 .35rem; font-size: 1rem; }
.tl-meta { color: var(--muted); font-size: .9rem; display: flex; flex-wrap: wrap; gap: .6rem 1rem; }

/* Vehicle card last update */
.vehicle-last-seen {
  margin-top: .65rem;
  font-size: .78rem;
  letter-spacing: .01em;
}
.metric-hint { margin-top: .25rem; }
.metric-hint a { color: var(--muted); text-decoration: none; }
.metric-hint a:hover { color: var(--primary2); text-decoration: underline; }

/* Agenda layout: list left / map right */
.agenda-layout {
  display: grid;
  grid-template-columns: minmax(340px, 1.05fr) minmax(320px, 0.95fr);
  gap: 1rem;
  align-items: start;
}
@media (max-width: 1100px) {
  .agenda-layout { grid-template-columns: 1fr; }
}
.agenda-list {
  display: flex;
  flex-direction: column;
  gap: .55rem;
  max-height: calc(100vh - 240px);
  overflow: auto;
  padding-right: .2rem;
}
.agenda-row {
  display: grid;
  grid-template-columns: 72px 1fr auto;
  gap: .75rem;
  align-items: center;
  border-radius: 14px;
  border: 1px solid var(--border);
  padding: .7rem .85rem;
  cursor: pointer;
  transition: transform .12s ease, border-color .12s ease, box-shadow .12s ease;
}
.agenda-row:hover {
  transform: translateY(-1px);
  border-color: rgba(255,255,255,.12);
}
.agenda-row.active {
  box-shadow: 0 0 0 1px rgba(62,142,247,.55), 0 8px 24px rgba(0,0,0,.25);
}
.agenda-row.agenda-trip {
  background: linear-gradient(90deg, rgba(62,142,247,.22), rgba(62,142,247,.08) 40%, rgba(18,21,26,.9));
  border-color: rgba(62,142,247,.35);
}
.agenda-row.agenda-charge {
  background: linear-gradient(90deg, rgba(255,159,10,.22), rgba(255,159,10,.08) 40%, rgba(18,21,26,.9));
  border-color: rgba(255,159,10,.35);
}
.agenda-row.agenda-stop {
  background: linear-gradient(90deg, rgba(107,114,128,.22), rgba(107,114,128,.08) 40%, rgba(18,21,26,.9));
  border-color: rgba(107,114,128,.35);
  opacity: .92;
}
.agenda-times {
  font-variant-numeric: tabular-nums;
  line-height: 1.25;
}
.agenda-start {
  font-weight: 700;
  font-size: 1rem;
}
.agenda-end {
  font-size: .82rem;
  margin-top: .1rem;
}
.agenda-main { min-width: 0; }
.agenda-title-row {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem .75rem;
  align-items: baseline;
  margin-bottom: .2rem;
}
.agenda-type-badge {
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  opacity: .9;
}
.agenda-route {
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  opacity: .9;
}
.agenda-arrow { color: var(--muted); padding: 0 .15rem; }
.agenda-duration {
  text-align: right;
  min-width: 4.5rem;
}
.agenda-duration-val {
  font-weight: 800;
  font-size: 1.05rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.agenda-map-panel { padding: 1rem; }
.agenda-map-header { margin-bottom: .65rem; }
.agenda-map {
  height: min(520px, 55vh);
  min-height: 360px;
  width: 100%;
}
.agenda-detail {
  margin-top: .85rem;
  padding-top: .85rem;
  border-top: 1px solid var(--border);
}
.agenda-detail-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: .75rem;
  margin-bottom: .55rem;
}
.agenda-detail-stats {
  margin-top: .45rem;
  color: var(--muted);
  font-size: .9rem;
}
.agenda-badge-trip { color: #9ec5ff; }
.agenda-badge-charge { color: #ffd08a; }
.agenda-badge-stop { color: #b0b8c6; }

/* Settings / configuration */
.settings-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 1rem;
  align-items: start;
}
@media (max-width: 900px) {
  .settings-layout { grid-template-columns: 1fr; }
}
.settings-nav {
  display: flex;
  flex-direction: column;
  gap: .35rem;
  padding: .85rem;
  position: sticky;
  top: 1rem;
}
.settings-nav-btn {
  text-align: left;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  border-radius: 12px;
  padding: .65rem .8rem;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}
.settings-nav-btn:hover {
  background: var(--panel2);
  color: var(--text);
}
.settings-nav-btn.active {
  background: linear-gradient(90deg, rgba(62,142,247,.2), rgba(62,142,247,.05));
  color: #fff;
  border-color: rgba(62,142,247,.35);
}
.settings-nav-link { display: block; }
.settings-main { min-width: 0; }
.settings-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .9rem 1rem;
  margin-top: 1rem;
}
@media (max-width: 800px) {
  .settings-fields { grid-template-columns: 1fr; }
}
.settings-field {
  display: grid;
  gap: .35rem;
  color: var(--muted);
  font-size: .9rem;
}
.settings-field .input,
.settings-textarea {
  width: 100%;
  font: inherit;
}
.settings-textarea {
  min-height: 96px;
  resize: vertical;
  font-family: ui-monospace, monospace;
  font-size: .85rem;
}
.settings-bool {
  grid-template-columns: 1fr auto;
  align-items: center;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: .75rem .9rem;
}
.settings-bool input[type=checkbox] {
  width: 1.15rem;
  height: 1.15rem;
  accent-color: var(--primary);
}
.settings-actions {
  margin-top: .25rem;
}
.mono { font-family: ui-monospace, monospace; }

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: .5rem;
}
.cal-cell {
  min-height: 128px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: .55rem .6rem .5rem;
  display: flex;
  flex-direction: column;
  gap: .35rem;
  transition: border-color .12s ease, transform .12s ease;
}
.cal-cell.cal-has-data:hover {
  border-color: rgba(62,142,247,.4);
  transform: translateY(-1px);
}
.cal-cell .d { color: var(--muted); font-size: .8rem; }
.cal-cell .km { font-weight: 700; margin-top: .35rem; }
.cal-cell .sub { font-size: .75rem; color: var(--muted); }
.cal-cell.empty { opacity: .35; min-height: 80px; }
.cal-empty-day { opacity: .55; }
.cal-empty-label { font-size: .8rem; margin-top: .25rem; }
.cal-day-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: .35rem;
}
.cal-day-num {
  font-size: .85rem;
  font-weight: 700;
  color: var(--muted);
}
.cal-km {
  font-weight: 800;
  font-size: .95rem;
  font-variant-numeric: tabular-nums;
}
.cal-lines {
  display: flex;
  flex-direction: column;
  gap: .15rem;
  flex: 1;
  font-size: .72rem;
  line-height: 1.25;
}
.cal-line {
  display: flex;
  justify-content: space-between;
  gap: .35rem;
}
.cal-k { color: var(--muted); }
.cal-v {
  font-weight: 600;
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.cal-bar-wrap { margin-top: .15rem; }
.cal-bar {
  display: flex;
  height: 7px;
  border-radius: 999px;
  overflow: hidden;
  background: #1a1f28;
  border: 1px solid var(--border);
}
.cal-seg { display: block; height: 100%; min-width: 0; }
.cal-seg.drive { background: #3e8ef7; }
.cal-seg.charge { background: #ff9f0a; }
.cal-seg.park { background: #6b7280; }
.cal-bar-pcts {
  display: flex;
  justify-content: flex-end;
  gap: .35rem;
  margin-top: .2rem;
  font-size: .65rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.pct-drive { color: #9ec5ff; }
.pct-charge { color: #ffd08a; }
.pct-park { color: #b0b8c6; }
@media (max-width: 1100px) {
  .cal-grid { grid-template-columns: repeat(2, 1fr); }
  .cal-cell { min-height: 110px; }
}


.login-body {
  min-height: 100vh; display: grid; place-items: center; padding: 1rem;
}
.login-card {
  width: min(420px, 100%);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 1.5rem;
  box-shadow: var(--shadow);
}
.login-brand { margin-bottom: 1.25rem; }
.stack { display: grid; gap: .85rem; }
label { display: grid; gap: .35rem; color: var(--muted); font-size: .9rem; }
input[type=text], input[type=password] {
  background: var(--bg2); border: 1px solid var(--border); border-radius: 12px;
  color: var(--text); padding: .7rem .85rem; font: inherit;
}
.alert { padding: .75rem .9rem; border-radius: 12px; margin-bottom: 1rem; }
.alert-error { background: rgba(255,69,58,.12); border: 1px solid rgba(255,69,58,.35); color: #ff8a82; }
.sev-alert { color: var(--warn); font-weight: 700; }
.sev-serious { color: var(--danger); font-weight: 800; }

/* Leaflet dark-ish */
.leaflet-container { background: #0f1318; font: inherit; }

/* Home page fleet map */
.home-map-section {
  margin-top: 1.5rem;
}
.home-map-header {
  margin-bottom: 0.75rem;
}
.home-map-header .section-title {
  margin: 0 0 0.2rem;
  font-size: 1.15rem;
  font-weight: 700;
}
.home-map {
  height: min(520px, 55vh);
  min-height: 360px;
  width: 100%;
}

/* Account / users */
.user-link {
  text-decoration: none;
  display: block;
}
.user-link:hover {
  color: var(--text);
  text-decoration: underline;
}
.account-layout {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 1rem;
  align-items: start;
}
.account-card .section-title { margin: 0 0 .35rem; font-size: 1.2rem; }
.section-title-sm { font-size: 1.05rem !important; margin-top: .25rem; }
.account-form { margin-top: 1rem; max-width: 420px; }
.account-form .input,
.account-form .select { width: 100%; }
.form-actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .85rem;
}
@media (max-width: 700px) {
  .form-grid-2 { grid-template-columns: 1fr; }
}
.divider {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 1.35rem 0;
}
.form-msg {
  padding: .65rem .8rem;
  border-radius: 12px;
  font-size: .9rem;
}
.form-msg-ok {
  background: rgba(52,199,89,.12);
  border: 1px solid rgba(52,199,89,.35);
  color: #7ddea0;
}
.form-msg-err {
  background: rgba(255,69,58,.12);
  border: 1px solid rgba(255,69,58,.35);
  color: #ff8a82;
}
.user-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem;
}
.account-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: .75rem;
}
.alert-ok {
  background: rgba(52,199,89,.12);
  border: 1px solid rgba(52,199,89,.35);
  color: #7ddea0;
}

/* ========== V.07 — Cartes (calques + plein écran) ========== */
.map-shell {
  position: relative;
  width: 100%;
  display: block;
  border-radius: inherit;
  overflow: hidden;
}
/* L’élément carte garde ses classes .map-panel / .map-full / .home-map */
.map-shell > .leaflet-container {
  width: 100%;
  border-radius: inherit;
  display: block;
}
.map-shell.is-fullscreen {
  position: fixed !important;
  inset: 0;
  z-index: 10000;
  width: 100vw !important;
  height: 100vh !important;
  border-radius: 0 !important;
  background: #0b0d10;
  overflow: hidden;
}
.map-shell.is-fullscreen > .leaflet-container {
  position: absolute !important;
  inset: 0 !important;
  width: 100% !important;
  height: 100% !important;
  min-height: 100% !important;
  border-radius: 0 !important;
}
body.map-fs-active {
  overflow: hidden;
}
.map-fs-btn {
  width: 34px;
  height: 34px;
  line-height: 30px;
  text-align: center;
  font-size: 16px;
  cursor: pointer;
  background: #fff;
  border: none;
  border-radius: 4px;
  color: #333;
  box-shadow: 0 1px 5px rgba(0,0,0,.35);
}
.map-fs-btn:hover {
  background: #f4f4f4;
}
.leaflet-control-layers {
  background: rgba(22, 26, 33, 0.95) !important;
  color: var(--text) !important;
  border: 1px solid var(--border) !important;
  border-radius: 10px !important;
}
.leaflet-control-layers-expanded {
  padding: 8px 10px !important;
  min-width: 120px;
}
.leaflet-control-layers label {
  color: var(--text) !important;
  font-weight: 500;
}
.leaflet-control-layers-separator {
  border-top-color: var(--border) !important;
}
.map-card-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: .75rem;
  margin-bottom: .5rem;
}
.map-card-head h3 { margin: 0; }
.chart-hint { margin: 0 0 .75rem; }
.map-hint { margin: 0 0 .75rem; }
.trip-hover-tooltip {
  background: rgba(18, 21, 26, 0.95) !important;
  color: #e8edf5 !important;
  border: 1px solid #3e8ef7 !important;
  border-radius: 8px !important;
  box-shadow: 0 6px 20px rgba(0,0,0,.4) !important;
  font-size: .8rem !important;
}
.trip-hover-tooltip::before {
  border-top-color: #3e8ef7 !important;
}
.small-val { font-size: 1rem !important; }

/* ========== V.07 — Analyse conduite ========== */
.toolbar-group {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  align-items: center;
}
.driving-ranking { margin-bottom: 1rem; }
.ranking-list {
  list-style: none;
  margin: .75rem 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: .55rem;
}
.ranking-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  grid-template-areas:
    "badge name score"
    "badge meta meta";
  gap: .15rem .85rem;
  align-items: center;
  padding: .7rem .9rem;
  border-radius: 12px;
  background: var(--panel2);
  border: 1px solid var(--border);
}
.rank-badge {
  grid-area: badge;
  width: 36px; height: 36px;
  border-radius: 10px;
  display: grid; place-items: center;
  font-weight: 800;
  background: rgba(62,142,247,.18);
  color: var(--primary2);
}
.rank-1 .rank-badge { background: rgba(255, 196, 0, .2); color: #ffd60a; }
.rank-2 .rank-badge { background: rgba(180, 190, 210, .18); color: #c5cddb; }
.rank-3 .rank-badge { background: rgba(205, 127, 50, .2); color: #e0a060; }
.rank-name { grid-area: name; font-weight: 700; font-size: 1.05rem; }
.rank-score {
  grid-area: score;
  font-size: 1.35rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--ok);
}
.rank-meta { grid-area: meta; }
.driving-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}
.driving-card {
  border-top: 3px solid var(--accent, var(--primary));
}
.driving-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: .75rem;
}
.softness-pill {
  text-align: center;
  min-width: 72px;
  padding: .45rem .55rem;
  border-radius: 12px;
  background: rgba(62,142,247,.12);
  border: 1px solid rgba(62,142,247,.3);
}
.softness-pill .softness-val {
  font-size: 1.4rem;
  font-weight: 800;
  line-height: 1.1;
}
.softness-pill .softness-lbl {
  font-size: .65rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--muted);
}
.softness-pill.score-good {
  background: rgba(52,199,89,.12);
  border-color: rgba(52,199,89,.35);
  color: #7ddea0;
}
.softness-pill.score-mid {
  background: rgba(255,159,10,.12);
  border-color: rgba(255,159,10,.35);
  color: #ffc46b;
}
.softness-pill.score-low {
  background: rgba(255,69,58,.12);
  border-color: rgba(255,69,58,.35);
  color: #ff8a82;
}
.driving-foot { margin-top: .75rem; line-height: 1.45; }
.driving-charts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}
.driving-notes {
  margin: 1rem 0 0;
  padding-left: 1.2rem;
  line-height: 1.5;
}
.hidden { display: none !important; }
.map-shell:has(> .map-full) {
  height: calc(100vh - 140px);
  min-height: 480px;
}
.map-shell:has(> .map-full) > .leaflet-container {
  height: 100% !important;
  min-height: 100%;
}
.map-shell:has(> .home-map) {
  height: min(520px, 55vh);
  min-height: 360px;
}
.map-shell:has(> .home-map) > .leaflet-container {
  height: 100% !important;
}
.map-shell:has(> .map-panel):not(:has(> .map-full)):not(:has(> .home-map)) {
  height: 420px;
}
.map-shell:has(> .map-panel):not(:has(> .map-full)):not(:has(> .home-map)) > .leaflet-container {
  height: 100% !important;
}
.map-shell:has(> .agenda-map) {
  height: 100%;
  min-height: 360px;
}

/* ========== V.08 — Date steppers + conduite stabilité ========== */
.date-stepper {
  display: inline-flex;
  align-items: center;
  gap: .25rem;
}
.date-stepper .input,
.date-stepper input[type="date"],
.date-stepper input[type="month"] {
  margin: 0;
}
.date-step-btn {
  min-width: 2rem;
  padding: .35rem .45rem !important;
  font-weight: 700;
  line-height: 1;
  user-select: none;
}
.profile-section {
  margin: 1rem 0;
}
.profile-controls {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem 1.25rem;
  align-items: flex-end;
  margin-bottom: .85rem;
}
.profile-controls label {
  display: flex;
  flex-direction: column;
  gap: .3rem;
}
.profile-controls select[multiple] {
  min-width: 160px;
  min-height: 5.5rem;
}
