/* ============================================================
   PARKFITR — Feuille de styles principale
   Design : Chaleureux / Organique
   ============================================================ */

/* --- Variables & Reset --- */
:root {
  --bg: #F5F0E8;
  --surface: #FDFAF5;
  --surface2: #EDE8DF;
  --green: #7A9E7E;
  --green-dark: #5C7F60;
  --green-light: #A8C5AC;
  --terra: #C1714F;
  --terra-dark: #9E5538;
  --terra-light: #DFA08A;
  --brown: #2C1810;
  --brown-mid: #6B4A3A;
  --brown-light: #A07060;
  --white: #FDFAF5;
  --shadow: rgba(44, 24, 16, 0.12);
  --shadow-strong: rgba(44, 24, 16, 0.22);
  --radius: 18px;
  --radius-sm: 10px;
  --radius-lg: 28px;
  --font-title: 'Poppins', 'Trebuchet MS', sans-serif;
  --font-body: 'Nunito', 'Segoe UI', sans-serif;
  --transition: 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  --nav-h: 68px;
  --header-h: 58px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; -webkit-tap-highlight-color: transparent; }

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--brown);
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* --- Scrollbar --- */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--green-light); border-radius: 4px; }

/* ============================================================
   LAYOUT PRINCIPAL
   ============================================================ */

#app {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  position: relative;
}

/* Header */
.app-header {
  height: var(--header-h);
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  border-bottom: 1.5px solid var(--surface2);
  position: sticky;
  top: 0;
  z-index: 100;
  flex-shrink: 0;
}

.app-header .logo {
  font-family: var(--font-title);
  font-weight: 800;
  font-size: 1.5rem;
  letter-spacing: -0.5px;
  color: var(--brown);
  display: flex;
  align-items: center;
  gap: 8px;
}

.app-header .logo .logo-p {
  color: var(--terra);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: var(--surface2);
  color: var(--brown-mid);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 1.1rem;
}
.btn-icon:hover { background: var(--green-light); color: var(--white); }
.btn-icon:active { transform: scale(0.92); }

/* Contenu principal */
.app-content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding-bottom: var(--nav-h);
  position: relative;
}

/* Navigation bottom */
.app-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--nav-h);
  background: var(--surface);
  border-top: 1.5px solid var(--surface2);
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding: 0 8px;
  z-index: 200;
  padding-bottom: env(safe-area-inset-bottom);
}

.nav-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 8px 16px;
  border: none;
  background: transparent;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: all 0.2s;
  color: var(--brown-light);
  min-width: 56px;
}

.nav-btn .nav-icon {
  font-size: 1.4rem;
  line-height: 1;
  transition: transform var(--transition);
}

.nav-btn .nav-label {
  font-family: var(--font-body);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.3px;
}

.nav-btn.active {
  color: var(--terra);
}

.nav-btn.active .nav-icon {
  transform: scale(1.15) translateY(-2px);
}

.nav-btn:active .nav-icon {
  transform: scale(0.9);
}

/* Sections */
.section {
  display: none;
  padding: 20px 16px;
  animation: fadeUp 0.3s ease;
}
.section.active { display: block; }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   COMPOSANTS RÉUTILISABLES
   ============================================================ */

/* Cards */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: 0 2px 12px var(--shadow);
  margin-bottom: 16px;
}

.card-title {
  font-family: var(--font-title);
  font-weight: 700;
  font-size: 1rem;
  color: var(--brown);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-title .icon { font-size: 1.2rem; }

/* Boutons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 24px;
  border-radius: var(--radius);
  border: none;
  font-family: var(--font-body);
  font-weight: 800;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all var(--transition);
  letter-spacing: 0.2px;
}

.btn-primary {
  background: var(--green);
  color: var(--white);
  box-shadow: 0 4px 16px rgba(122, 158, 126, 0.35);
}
.btn-primary:hover { background: var(--green-dark); transform: translateY(-1px); }
.btn-primary:active { transform: scale(0.97); }

.btn-danger {
  background: var(--terra);
  color: var(--white);
  box-shadow: 0 4px 16px rgba(193, 113, 79, 0.35);
}
.btn-danger:hover { background: var(--terra-dark); }
.btn-danger:active { transform: scale(0.97); }

.btn-outline {
  background: transparent;
  border: 2px solid var(--green);
  color: var(--green);
}
.btn-outline:hover { background: var(--green); color: var(--white); }

.btn-full { width: 100%; }

.btn-lg {
  padding: 18px 32px;
  font-size: 1.05rem;
  border-radius: var(--radius-lg);
}

/* Badges compatibilité */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 700;
}
.badge-ok { background: #E8F5E9; color: #2E7D32; }
.badge-warn { background: #FFF8E1; color: #F57F17; }
.badge-ko { background: #FFEBEE; color: #C62828; }

/* Tags */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  background: var(--surface2);
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--brown-mid);
}

/* Inputs */
.input-group {
  margin-bottom: 16px;
}

.input-group label {
  display: block;
  font-family: var(--font-title);
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--brown-mid);
  margin-bottom: 6px;
  letter-spacing: 0.2px;
}

.input-group input,
.input-group select {
  width: 100%;
  padding: 13px 16px;
  border: 2px solid var(--surface2);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--brown);
  font-family: var(--font-body);
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.2s;
  appearance: none;
}

.input-group input:focus,
.input-group select:focus {
  border-color: var(--green);
}

.input-group .input-unit {
  position: relative;
}
.input-group .input-unit input { padding-right: 50px; }
.input-group .input-unit span {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.82rem;
  color: var(--brown-light);
  font-weight: 600;
}

/* ============================================================
   SECTION ACCUEIL
   ============================================================ */

.section-home {
  padding-top: 24px;
}

.home-greeting {
  font-family: var(--font-title);
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--brown);
  margin-bottom: 4px;
  line-height: 1.2;
}

.home-greeting span { color: var(--terra); }

.home-sub {
  color: var(--brown-light);
  font-size: 0.9rem;
  margin-bottom: 24px;
}

/* Card stationnement actif */
.card-parked {
  background: linear-gradient(135deg, var(--green) 0%, var(--green-dark) 100%);
  color: var(--white);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: 0 6px 24px rgba(122, 158, 126, 0.4);
  margin-bottom: 20px;
  position: relative;
  overflow: hidden;
}

.card-parked::before {
  content: '🅿';
  position: absolute;
  right: -10px;
  top: -10px;
  font-size: 5rem;
  opacity: 0.12;
}

.card-parked .parked-label {
  font-size: 0.8rem;
  font-weight: 700;
  opacity: 0.8;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 6px;
}

.card-parked .parked-name {
  font-family: var(--font-title);
  font-size: 1.3rem;
  font-weight: 800;
  margin-bottom: 4px;
}

.card-parked .parked-time {
  font-size: 2.2rem;
  font-weight: 800;
  font-family: var(--font-title);
  letter-spacing: -1px;
  margin-bottom: 4px;
}

.card-parked .parked-cost {
  font-size: 0.9rem;
  opacity: 0.85;
  margin-bottom: 12px;
}

.card-parked .parked-distance {
  background: rgba(255,255,255,0.12);
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  margin-bottom: 12px;
}

.card-parked .parked-dist-row {
  display: flex;
  justify-content: space-around;
  font-size: 0.9rem;
}

/* Nav app chooser */
.nav-app-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
}

.nav-app-btn {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  border: 2px solid rgba(44,24,16,0.1);
  border-radius: 14px;
  background: rgba(255,255,255,0.1);
  font-size: 1rem;
  font-family: var(--font-body);
  color: var(--brown);
  cursor: pointer;
  transition: all 0.2s;
}

.nav-app-btn:active {
  background: rgba(122,158,126,0.15);
  border-color: var(--sage);
}

.nav-app-icon { font-size: 1.5rem; }
.nav-app-name { font-weight: 600; }

.nav-app-remember {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--brown-light);
  cursor: pointer;
  margin-bottom: 8px;
}

/* Settings modal */
.settings-section {
  padding: 14px 0;
  border-bottom: 1px solid var(--surface2);
}
.settings-section:last-of-type { border-bottom: none; }
.settings-label {
  font-weight: 700;
  font-family: var(--font-title);
  font-size: 0.9rem;
  margin-bottom: 6px;
}
.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 0.88rem;
  color: var(--brown-mid);
}
.btn-sm {
  font-size: 0.78rem !important;
  padding: 6px 12px !important;
}

/* Departure countdown */
.parked-departure {
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  margin-bottom: 12px;
  font-size: 0.9rem;
  font-weight: 600;
  text-align: center;
}

.parked-departure.departure-ok {
  background: rgba(122,158,126,0.25);
  border-left: 4px solid var(--sage);
}

.parked-departure.departure-warn {
  background: rgba(255,165,0,0.2);
  border-left: 4px solid #e6a200;
  color: #b37800;
}

.parked-departure.departure-danger {
  background: rgba(220,53,69,0.2);
  border-left: 4px solid #dc3545;
  color: #c62828;
  animation: pulse-departure 1.5s infinite;
}

@keyframes pulse-departure {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

.card-parked .parked-budget {
  background: rgba(255,255,255,0.15);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 0.85rem;
  margin-bottom: 16px;
}

.budget-bar {
  height: 6px;
  background: rgba(255,255,255,0.3);
  border-radius: 3px;
  margin-top: 8px;
  overflow: hidden;
}

.budget-fill {
  height: 100%;
  background: var(--white);
  border-radius: 3px;
  transition: width 1s linear;
}

.budget-fill.warn { background: #FFD54F; }
.budget-fill.danger { background: #FF5252; }

.card-parked .parked-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.card-parked .btn-return {
  background: var(--white);
  color: var(--green-dark);
  border: none;
  padding: 14px;
  border-radius: var(--radius);
  font-weight: 800;
  font-size: 0.88rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.2s;
}
.card-parked .btn-return:active { transform: scale(0.97); }

.card-parked .btn-end-session {
  background: rgba(255,255,255,0.2);
  color: var(--white);
  border: 2px solid rgba(255,255,255,0.5);
  padding: 14px;
  border-radius: var(--radius);
  font-weight: 800;
  font-size: 0.88rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.2s;
}
.card-parked .btn-end-session:hover { background: rgba(255,82,82,0.8); border-color: transparent; }
.card-parked .btn-end-session:active { transform: scale(0.97); }

/* Card pas garé */
.card-not-parked {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 32px 24px;
  text-align: center;
  box-shadow: 0 2px 12px var(--shadow);
  margin-bottom: 20px;
}

.card-not-parked .nop-icon {
  font-size: 3.5rem;
  margin-bottom: 12px;
}

.card-not-parked h3 {
  font-family: var(--font-title);
  font-weight: 700;
  font-size: 1.1rem;
  margin-bottom: 8px;
  color: var(--brown);
}

.card-not-parked p {
  color: var(--brown-light);
  font-size: 0.88rem;
  margin-bottom: 20px;
  line-height: 1.5;
}

/* Quickstats */
.quickstats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 20px;
}

.stat-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
  box-shadow: 0 2px 8px var(--shadow);
}

.stat-card .stat-icon { font-size: 1.5rem; margin-bottom: 6px; }
.stat-card .stat-value {
  font-family: var(--font-title);
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--brown);
}
.stat-card .stat-label {
  font-size: 0.75rem;
  color: var(--brown-light);
  font-weight: 600;
  margin-top: 2px;
}

/* ============================================================
   SECTION CARTE
   ============================================================ */

.section-map {
  padding: 0;
  height: calc(100dvh - var(--header-h) - var(--nav-h));
  position: relative;
}

#map {
  width: 100%;
  height: 100%;
}

.map-filters {
  position: absolute;
  top: 12px;
  left: 12px;
  right: 12px;
  z-index: 500;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.map-filters::-webkit-scrollbar { display: none; }

/* Mode toggle (Compatibilité / Coût) */
.mode-toggle {
  display: flex;
  gap: 0;
  background: var(--surface);
  border-radius: 24px;
  box-shadow: 0 2px 8px var(--shadow);
  overflow: hidden;
}

.mode-btn {
  padding: 8px 16px;
  background: transparent;
  border: none;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  font-family: var(--font-body);
  color: var(--brown-mid);
  transition: all 0.2s;
}
.mode-btn.active { background: var(--green); color: var(--white); }
.mode-btn:active { transform: scale(0.95); }

/* Barre durée (mode coût) */
.cost-bar {
  position: absolute;
  top: 56px;
  left: 12px;
  right: 12px;
  z-index: 500;
  display: flex;
  flex-direction: column;
  gap: 6px;
  animation: fadeUp 0.3s ease;
}

.cost-bar-durations {
  display: flex;
  gap: 6px;
  overflow-x: auto;
}
.cost-bar-durations::-webkit-scrollbar { display: none; }

.duration-chip {
  flex-shrink: 0;
  padding: 7px 14px;
  background: var(--surface);
  border: 2px solid transparent;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 2px 8px var(--shadow);
  white-space: nowrap;
  transition: all 0.2s;
  font-family: var(--font-body);
  color: var(--brown-mid);
}
.duration-chip.active { background: var(--terra); color: var(--white); border-color: var(--terra); }
.duration-chip:active { transform: scale(0.95); }

/* Créneau personnalisé */
.cost-bar-custom {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border-radius: 20px;
  padding: 6px 12px;
  box-shadow: 0 2px 8px var(--shadow);
}

.cost-bar-custom input[type="time"] {
  border: 2px solid var(--surface2);
  border-radius: 8px;
  padding: 6px 8px;
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--brown);
  background: var(--bg);
  width: 100px;
}
.cost-bar-custom input[type="time"]:focus { border-color: var(--green); outline: none; }

.cost-bar-custom span {
  font-weight: 700;
  color: var(--brown-light);
}

.btn-apply-time {
  background: var(--green);
  color: var(--white);
  border: none;
  border-radius: 14px;
  padding: 6px 14px;
  font-weight: 700;
  font-size: 0.82rem;
  cursor: pointer;
  font-family: var(--font-body);
  transition: all 0.2s;
}
.btn-apply-time:active { transform: scale(0.95); }

/* Checkbox masquer inconnus */
.cost-bar-hide {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--surface);
  border-radius: 20px;
  padding: 6px 14px;
  box-shadow: 0 2px 8px var(--shadow);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--brown-mid);
  cursor: pointer;
  align-self: flex-start;
}
.cost-bar-hide input[type="checkbox"] {
  accent-color: var(--green);
  width: 16px;
  height: 16px;
}

.map-fab {
  position: absolute;
  bottom: 20px;
  right: 16px;
  z-index: 500;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.fab {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  box-shadow: 0 4px 16px var(--shadow-strong);
  transition: all var(--transition);
}
.fab-primary { background: var(--terra); color: var(--white); }
.fab-secondary { background: var(--surface); color: var(--brown); }
.fab:active { transform: scale(0.9); }

/* Loader carte */
.map-loader {
  position: absolute;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 500;
  background: var(--surface);
  padding: 10px 20px;
  border-radius: 20px;
  box-shadow: 0 4px 16px var(--shadow-strong);
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--brown-mid);
  animation: fadeUp 0.3s ease;
}

.map-loader-spinner {
  width: 18px;
  height: 18px;
  border: 3px solid var(--surface2);
  border-top-color: var(--green);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Bouton "Rechercher dans cette zone" */
.btn-search-here {
  position: absolute;
  top: 56px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 500;
  background: var(--surface);
  color: var(--brown);
  border: none;
  padding: 10px 20px;
  border-radius: 24px;
  box-shadow: 0 4px 16px var(--shadow-strong);
  font-family: var(--font-body);
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  animation: fadeUp 0.3s ease;
  transition: all var(--transition);
}
.btn-search-here:active {
  transform: translateX(-50%) scale(0.95);
  background: var(--green);
  color: var(--white);
}

/* Popup carte custom */
.leaflet-popup-content-wrapper {
  border-radius: var(--radius) !important;
  box-shadow: 0 4px 20px var(--shadow-strong) !important;
  padding: 0 !important;
}
.leaflet-popup-content { margin: 0 !important; }
.leaflet-popup-tip-container { display: none; }

.map-popup {
  padding: 16px;
  min-width: 200px;
}
.map-popup h4 {
  font-family: var(--font-title);
  font-weight: 700;
  font-size: 0.95rem;
  margin-bottom: 6px;
}
.map-popup .popup-compat { margin-bottom: 8px; }
.map-popup .popup-info {
  font-size: 0.82rem;
  color: var(--brown-mid);
  margin-bottom: 10px;
  line-height: 1.6;
}
.map-popup .btn-popup {
  background: var(--green);
  color: var(--white);
  border: none;
  padding: 10px;
  border-radius: var(--radius-sm);
  width: 100%;
  font-weight: 700;
  font-size: 0.88rem;
  cursor: pointer;
}

/* ============================================================
   SECTION FICHE PARKING
   ============================================================ */

.parking-hero {
  background: var(--surface);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 16px;
  box-shadow: 0 2px 12px var(--shadow);
}

.parking-hero-img {
  height: 160px;
  background: linear-gradient(135deg, var(--green-light), var(--green));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 4rem;
  color: rgba(255,255,255,0.6);
}

.parking-hero-body { padding: 20px; }

.parking-name {
  font-family: var(--font-title);
  font-size: 1.3rem;
  font-weight: 800;
  margin-bottom: 6px;
}

.parking-address {
  font-size: 0.88rem;
  color: var(--brown-light);
  margin-bottom: 12px;
}

.parking-tags { display: flex; gap: 6px; flex-wrap: wrap; }

/* Dimensions */
.dimensions-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.dim-item {
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 12px;
  text-align: center;
}

.dim-item .dim-value {
  font-family: var(--font-title);
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--brown);
}
.dim-item .dim-label {
  font-size: 0.75rem;
  color: var(--brown-light);
  font-weight: 600;
  margin-top: 2px;
}
.dim-item.compat-ok .dim-value { color: var(--green); }
.dim-item.compat-warn .dim-value { color: #F57F17; }
.dim-item.compat-ko .dim-value { color: var(--terra); }

/* Tarifs */
.tarif-list { display: flex; flex-direction: column; gap: 8px; }

.tarif-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  background: var(--bg);
  border-radius: var(--radius-sm);
}

.tarif-row .tarif-label {
  font-weight: 600;
  font-size: 0.9rem;
}

.tarif-row .tarif-price {
  font-family: var(--font-title);
  font-weight: 800;
  color: var(--terra);
  font-size: 1rem;
}

/* Grille tarifaire open data */
.tarif-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(70px, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}

.tarif-cell {
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 10px 6px;
  text-align: center;
}

.tarif-cell-price {
  font-family: var(--font-title);
  font-weight: 800;
  color: var(--terra);
  font-size: 1rem;
}

.tarif-cell-label {
  font-size: 0.75rem;
  color: var(--brown-light);
  margin-top: 2px;
}

.tarif-subscriptions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 8px;
}

.tarif-source {
  font-size: 0.72rem;
  color: var(--brown-light);
  margin-top: 8px;
  font-style: italic;
}

/* Apps de paiement */
.payment-apps {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.payment-app {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: var(--bg);
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: var(--brown);
  font-weight: 700;
  font-size: 0.85rem;
  transition: all 0.2s;
}
.payment-app:hover { background: var(--green-light); color: var(--white); }
.payment-app .app-icon { font-size: 1.3rem; }

/* Signalements */
.report-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid rgba(44, 24, 16, 0.08);
  font-size: 0.88rem;
}
.report-item:last-child { border-bottom: none; }
.report-type { font-weight: 700; }
.report-comment { color: var(--brown-light); flex: 1; }
.report-date { color: var(--brown-light); font-size: 0.75rem; white-space: nowrap; }

/* Actions parking */
.parking-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.parking-actions .btn { font-size: 0.82rem; padding: 10px 6px; }

/* ============================================================
   SECTION VÉHICULE
   ============================================================ */

.vehicle-card-active {
  background: linear-gradient(135deg, var(--terra) 0%, var(--terra-dark) 100%);
  color: var(--white);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: 0 6px 24px rgba(193, 113, 79, 0.4);
  margin-bottom: 20px;
  position: relative;
  overflow: hidden;
}

.vehicle-card-active::before {
  content: '🚗';
  position: absolute;
  right: -8px;
  bottom: -10px;
  font-size: 5rem;
  opacity: 0.2;
}

.vehicle-card-active .vc-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.vehicle-card-active .vc-remove {
  background: rgba(255,255,255,0.2);
  border: none;
  color: var(--white);
  width: 30px;
  height: 30px;
  border-radius: 50%;
  font-size: 0.9rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}
.vehicle-card-active .vc-remove:hover { background: rgba(255,255,255,0.35); }

.vehicle-card-active .vc-label {
  font-size: 0.78rem;
  font-weight: 700;
  opacity: 0.8;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 6px;
}

.vehicle-card-active .vc-name {
  font-family: var(--font-title);
  font-size: 1.5rem;
  font-weight: 800;
  margin-bottom: 18px;
}

.vehicle-specs {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1fr;
  gap: 8px;
}

.spec-item {
  background: rgba(255,255,255,0.15);
  border-radius: var(--radius-sm);
  padding: 8px;
  text-align: center;
}
.spec-item .spec-val {
  font-family: var(--font-title);
  font-weight: 800;
  font-size: 1.1rem;
}
.spec-item .spec-key {
  font-size: 0.68rem;
  opacity: 0.8;
  font-weight: 600;
  margin-top: 2px;
}

/* Recherche véhicule */
.vehicle-search {
  position: relative;
  margin-bottom: 16px;
}
.vehicle-search input {
  padding-left: 40px;
}
.vehicle-search .search-icon {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1rem;
  color: var(--brown-light);
  pointer-events: none;
}

.vehicle-results {
  max-height: 300px;
  overflow-y: auto;
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 4px 16px var(--shadow);
}

.vehicle-result-item {
  padding: 14px 16px;
  cursor: pointer;
  border-bottom: 1px solid var(--surface2);
  transition: background 0.15s;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.vehicle-result-item:last-child { border-bottom: none; }
.vehicle-result-item:hover { background: var(--bg); }
.vehicle-result-item .v-name { font-weight: 700; font-size: 0.92rem; }
.vehicle-result-item .v-specs { font-size: 0.78rem; color: var(--brown-light); margin-top: 2px; }
.vehicle-result-item .v-ground { font-size: 0.75rem; color: var(--green); font-weight: 700; }

/* ============================================================
   SECTION HISTORIQUE
   ============================================================ */

.stats-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
  margin-bottom: 20px;
}

.stat-mini {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 14px 10px;
  text-align: center;
  box-shadow: 0 2px 8px var(--shadow);
}
.stat-mini .sm-val {
  font-family: var(--font-title);
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--brown);
}
.stat-mini .sm-lbl {
  font-size: 0.7rem;
  color: var(--brown-light);
  font-weight: 600;
  margin-top: 3px;
}

.history-list { display: flex; flex-direction: column; gap: 10px; }

/* Month group headers */
.history-month-header {
  font-family: var(--font-title);
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--brown);
  padding: 8px 0 4px;
  border-bottom: 2px solid rgba(44,24,16,0.1);
  margin-bottom: 6px;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.history-month-header .month-subtotal {
  font-family: var(--font-body);
  font-weight: 400;
  font-size: 0.8rem;
  color: var(--brown-light);
}

/* Advanced stats row */
.history-advanced-stats {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
}

.history-advanced-stats .stat-mini { flex: 1; }

/* Export filter */
.export-filter {
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(44,24,16,0.15);
  background: var(--surface);
  font-family: var(--font-body);
  font-size: 0.85rem;
  color: var(--brown);
  min-width: 140px;
}

.history-item {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: 0 2px 8px var(--shadow);
  display: flex;
  gap: 14px;
  align-items: flex-start;
  cursor: pointer;
  transition: transform 0.15s;
}

.history-item:active {
  transform: scale(0.98);
}

.history-item .hi-icon {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
}

.history-item .hi-body { flex: 1; }
.history-item .hi-name { font-weight: 700; font-size: 0.92rem; margin-bottom: 3px; }
.history-item .hi-date { font-size: 0.78rem; color: var(--brown-light); margin-bottom: 6px; }
.history-item .hi-tags { display: flex; gap: 6px; }

.history-item .hi-cost {
  font-family: var(--font-title);
  font-weight: 800;
  font-size: 1rem;
  color: var(--terra);
  white-space: nowrap;
}

/* Session detail modal */
.session-detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 12px;
}

.session-detail-item {
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 10px;
  text-align: center;
}

.session-detail-item .sd-label {
  font-size: 0.75rem;
  color: var(--brown-light);
  margin-bottom: 4px;
}

.session-detail-item .sd-value {
  font-weight: 700;
  font-size: 0.95rem;
}

/* Favorites */
.fav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(44,24,16,0.08);
  cursor: pointer;
}

.fav-item:last-child { border-bottom: none; }

.fav-item .fav-icon {
  font-size: 1.2rem;
}

.fav-item .fav-name {
  flex: 1;
  font-weight: 600;
  font-size: 0.9rem;
}

.fav-item .fav-action {
  font-size: 0.85rem;
  color: var(--sage);
}

.btn-fav {
  transition: all 0.2s;
}

.btn-fav.active {
  background: #ffd700;
  border-color: #e6c200;
  color: var(--brown);
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--brown-light);
}
.empty-state .es-icon { font-size: 3.5rem; margin-bottom: 12px; }
.empty-state h3 { font-family: var(--font-title); font-weight: 700; margin-bottom: 8px; color: var(--brown-mid); }
.empty-state p { font-size: 0.88rem; line-height: 1.6; }

/* ============================================================
   MODAL STATIONNEMENT
   ============================================================ */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(44, 24, 16, 0.5);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: flex-end;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: all;
}

.modal-sheet {
  width: 100%;
  background: var(--surface);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  padding: 24px;
  padding-bottom: calc(24px + env(safe-area-inset-bottom));
  transform: translateY(100%);
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-overlay.open .modal-sheet {
  transform: translateY(0);
}

.modal-handle {
  width: 36px;
  height: 4px;
  background: var(--surface2);
  border-radius: 2px;
  margin: 0 auto 20px;
}

.modal-title {
  font-family: var(--font-title);
  font-size: 1.2rem;
  font-weight: 800;
  margin-bottom: 20px;
  text-align: center;
}

/* ============================================================
   TOAST NOTIFICATIONS
   ============================================================ */

#toast-container {
  position: fixed;
  top: calc(var(--header-h) + 10px);
  left: 16px;
  right: 16px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  background: var(--brown);
  color: var(--white);
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 0.88rem;
  font-weight: 600;
  box-shadow: 0 4px 16px var(--shadow-strong);
  display: flex;
  align-items: center;
  gap: 10px;
  animation: toastIn 0.3s ease;
}

.toast.success { background: var(--green-dark); }
.toast.warning { background: #E65100; }
.toast.info { background: var(--brown-mid); }

@keyframes toastIn {
  from { opacity: 0; transform: translateY(-10px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ============================================================
   LOADING SKELETON
   ============================================================ */

.skeleton {
  background: linear-gradient(90deg, var(--surface2) 25%, var(--bg) 50%, var(--surface2) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}

@keyframes shimmer {
  from { background-position: 200% 0; }
  to { background-position: -200% 0; }
}

/* ============================================================
   CONTRIBUTIONS TARIFS
   ============================================================ */

.tarif-source-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 8px;
  flex-wrap: wrap;
}

.contrib-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: #E8F5E9;
  color: #2E7D32;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 700;
  margin-bottom: 10px;
}

.tarif-stale-warning {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: #FFF3E0;
  color: #E65100;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 600;
  margin-bottom: 10px;
}

.tarif-stale-warning.danger {
  background: #FFEBEE;
  color: #C62828;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */

@media (min-width: 480px) {
  .quickstats { grid-template-columns: repeat(4, 1fr); }
  .parking-actions { grid-template-columns: repeat(4, 1fr); }
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1C1612;
    --surface: #252018;
    --surface2: #30281E;
    --brown: #F0E8E0;
    --brown-mid: #C8A898;
    --brown-light: #9A7A6A;
    --shadow: rgba(0, 0, 0, 0.4);
    --shadow-strong: rgba(0, 0, 0, 0.6);
    --white: #F5F0E8;
  }
}
