/* Styles de l'application (mobile-first, thème sombre). */

:root {
  /* Palette */
  --bg:        #0d0f14;
  --bg-2:      #141821;
  --surface:   #1b2130;
  --surface-2: #232b3d;
  --line:      #2c3547;
  --line-soft: #222a3a;

  --text:      #f2f5fb;
  --text-dim:  #aab3c5;
  --text-mut:  #6b768c;

  --accent:    #ff6a1a;   /* orange enduro */
  --accent-2:  #ff9146;
  --accent-ink:#1a0f06;

  /* Statuts */
  --ok:    #34d17a;
  --ok-bg: #0f2a1d;
  --warn:  #ffb020;
  --warn-bg:#2c220a;
  --late:  #ff5468;
  --late-bg:#2e1015;
  --off:   #55607a;

  --radius:   18px;
  --radius-sm:12px;
  --radius-pill: 999px;

  --shadow:   0 10px 30px rgba(0,0,0,.45);
  --shadow-sm:0 4px 14px rgba(0,0,0,.35);

  --maxw: 720px;
  --header-h: 60px;
  --nav-h: 66px;

  --font-head: 'Barlow Condensed', system-ui, sans-serif;
  --font-body: 'Inter', system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font-body);
  background:
    radial-gradient(1200px 600px at 100% -10%, #1a2130 0%, transparent 55%),
    radial-gradient(900px 500px at -10% 0%, #191322 0%, transparent 45%),
    var(--bg);
  color: var(--text);
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}

button { font-family: inherit; }
a { color: inherit; }

/* ---------- Layout global ---------- */
.app {
  max-width: var(--maxw);
  margin: 0 auto;
  min-height: 100dvh;
  padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 12px);
  position: relative;
}

.screen { padding: 16px; animation: fade .25s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------- En-tête ---------- */
.appbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 12px;
  height: calc(var(--header-h) + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) 16px 0;
  background: linear-gradient(180deg, rgba(13,15,20,.92), rgba(13,15,20,.72));
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line-soft);
}
.appbar .back {
  width: 40px; height: 40px;
  display: grid; place-items: center;
  border-radius: var(--radius-pill);
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--text);
  cursor: pointer;
  flex: 0 0 auto;
  transition: background .15s;
}
.appbar .back:active { background: var(--surface-2); }
.appbar .titles { min-width: 0; flex: 1; }
.appbar .titles h1 {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 22px;
  letter-spacing: .5px;
  margin: 0;
  line-height: 1.05;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.appbar .titles .sub { font-size: 12px; color: var(--text-mut); margin-top: 1px; }
.appbar .bar-action {
  flex: 0 0 auto;
  height: 40px; padding: 0 14px;
  border-radius: var(--radius-pill);
  background: var(--surface); border: 1px solid var(--line);
  color: var(--text); font-weight: 600; font-size: 14px;
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
}
.appbar .bar-action:active { background: var(--surface-2); }

/* Logo lockup */
.brand {
  display: flex; align-items: center; gap: 10px;
}
.brand .logo {
  width: 38px; height: 38px; flex: 0 0 auto;
}
.brand .name {
  font-family: var(--font-head);
  font-weight: 700; font-size: 26px; letter-spacing: 1.5px;
}
.brand .name b { color: var(--accent); }

/* ---------- Titres de section ---------- */
.section-title {
  font-family: var(--font-head);
  text-transform: uppercase;
  letter-spacing: 1.4px;
  font-size: 14px;
  color: var(--text-mut);
  margin: 22px 4px 10px;
  display: flex; align-items: center; justify-content: space-between;
}

.hero-title {
  font-family: var(--font-head);
  font-size: 30px; font-weight: 700; letter-spacing: .5px;
  margin: 6px 4px 2px;
}
.hero-sub { color: var(--text-dim); margin: 0 4px 18px; font-size: 14px; }

/* ---------- Cartes ---------- */
.card {
  background: linear-gradient(180deg, var(--surface), var(--bg-2));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow-sm);
}

/* ---------- Grille de motos ---------- */
.bike-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}
@media (min-width: 540px) {
  .bike-grid { grid-template-columns: 1fr 1fr; }
}

.bike-card {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--surface);
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: transform .12s ease, border-color .15s ease;
  text-align: left;
  padding: 0;
  color: var(--text);
  display: flex; flex-direction: column;
}
.bike-card:active { transform: scale(.985); }
.bike-card:hover { border-color: #3a465e; }
.bike-card .photo {
  height: 130px;
  background-size: cover; background-position: center;
  background-color: var(--surface-2);
  position: relative;
}
.bike-card .photo.placeholder {
  display: grid; place-items: center;
  background:
    repeating-linear-gradient(135deg, #1d2433 0 14px, #1a2130 14px 28px);
  color: var(--text-mut);
}
.bike-card .photo .badge-2t {
  position: absolute; top: 10px; left: 10px;
  font-family: var(--font-head); font-weight: 700; font-size: 12px;
  letter-spacing: .8px;
  background: rgba(13,15,20,.72); color: var(--accent-2);
  padding: 3px 9px; border-radius: var(--radius-pill);
  border: 1px solid var(--line); backdrop-filter: blur(6px);
}
.bike-card .photo .status-dot {
  position: absolute; top: 10px; right: 10px;
  width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid rgba(0,0,0,.4);
  box-shadow: 0 0 0 3px rgba(13,15,20,.5);
}
.bike-card .body { padding: 12px 14px 14px; }
.bike-card .body .name {
  font-family: var(--font-head); font-weight: 700; font-size: 20px;
  letter-spacing: .4px; line-height: 1.05;
}
.bike-card .body .meta { color: var(--text-mut); font-size: 12.5px; margin-top: 2px; }
.bike-card .body .hours {
  margin-top: 10px;
  display: inline-flex; align-items: baseline; gap: 5px;
}
.bike-card .body .hours .n {
  font-family: var(--font-head); font-weight: 700; font-size: 26px; color: var(--accent-2);
}
.bike-card .body .hours .u { font-size: 12px; color: var(--text-mut); }
.bike-card .body .alert-line {
  margin-top: 10px; font-size: 12.5px; font-weight: 600;
  display: flex; align-items: center; gap: 6px;
}

/* Carte "ajouter moto" */
.add-bike {
  border: 1.5px dashed var(--line);
  border-radius: var(--radius);
  background: transparent;
  color: var(--text-dim);
  min-height: 130px;
  display: grid; place-items: center;
  cursor: pointer;
  font-weight: 600;
  transition: border-color .15s, color .15s;
}
.add-bike:hover { border-color: var(--accent); color: var(--accent-2); }
.add-bike .plus { font-size: 30px; line-height: 1; }

/* ---------- Compteur d'heures (dashboard) ---------- */
.hours-hero {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px;
}
.hours-hero .big {
  font-family: var(--font-head);
  font-weight: 700; font-size: 54px; line-height: .9;
  color: var(--text);
}
.hours-hero .big small { font-size: 20px; color: var(--text-mut); font-weight: 600; margin-left: 4px; }
.hours-hero .label { color: var(--text-mut); font-size: 12px; text-transform: uppercase; letter-spacing: 1px; }
.hours-hero .bike-thumb {
  width: 74px; height: 74px; border-radius: var(--radius-sm);
  background-size: cover; background-position: center;
  border: 1px solid var(--line); flex: 0 0 auto;
  background-color: var(--surface-2);
}

/* ---------- Prochaine échéance ---------- */
.next-due {
  margin-top: 14px;
  border-radius: var(--radius);
  padding: 14px 16px;
  border: 1px solid var(--line);
  display: flex; align-items: center; gap: 12px;
}
.next-due .ic { font-size: 22px; }
.next-due .txt strong { display: block; font-size: 15px; }
.next-due .txt span { font-size: 13px; color: var(--text-dim); }
.next-due.ok   { background: var(--ok-bg);   border-color: #1c5238; }
.next-due.warn { background: var(--warn-bg); border-color: #5a4712; }
.next-due.late { background: var(--late-bg); border-color: #5e222b; }

.alerts { display: flex; flex-direction: column; gap: 10px; }
.alerts .next-due { margin-top: 0; }

/* ---------- Boutons d'action rapide ---------- */
.quick-actions {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
  margin-top: 16px;
}
.qa {
  border: none; cursor: pointer;
  border-radius: var(--radius);
  padding: 18px 14px;
  font-family: var(--font-head); font-weight: 700; font-size: 19px; letter-spacing: .5px;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  transition: transform .1s;
}
.qa:active { transform: scale(.97); }
.qa .ic { font-size: 24px; }
.qa.primary { background: linear-gradient(180deg, var(--accent-2), var(--accent)); color: var(--accent-ink); box-shadow: 0 8px 20px rgba(255,106,26,.28); }
.qa.ghost   { background: var(--surface); color: var(--text); border: 1px solid var(--line); }

/* ---------- Liste des entretiens (jauges) ---------- */
.maint-list { display: flex; flex-direction: column; gap: 10px; }
.maint-row {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px; align-items: center;
}
.maint-row .status-pill {
  width: 12px; height: 44px; border-radius: 6px; flex: 0 0 auto;
}
.maint-row.ok   .status-pill { background: var(--ok); }
.maint-row.warn .status-pill { background: var(--warn); }
.maint-row.late .status-pill { background: var(--late); }
.maint-row.off  .status-pill { background: var(--off); }
.maint-row .info { min-width: 0; }
.maint-row .info .name { font-weight: 600; font-size: 15px; }
.maint-row .info .detail { font-size: 12.5px; color: var(--text-dim); margin-top: 3px; }
.maint-row .bar {
  height: 6px; border-radius: 4px; background: var(--line); margin-top: 8px; overflow: hidden;
}
.maint-row .bar > span { display: block; height: 100%; border-radius: 4px; }
.maint-row.ok   .bar > span { background: var(--ok); }
.maint-row.warn .bar > span { background: var(--warn); }
.maint-row.late .bar > span { background: var(--late); }
.maint-row .right {
  text-align: right; flex: 0 0 auto;
}
.maint-row .right .rem {
  font-family: var(--font-head); font-weight: 700; font-size: 19px;
}
.maint-row.ok   .right .rem { color: var(--ok); }
.maint-row.warn .right .rem { color: var(--warn); }
.maint-row.late .right .rem { color: var(--late); }
.maint-row .right .rem-u { font-size: 11px; color: var(--text-mut); }
.maint-row.off .info .name { color: var(--text-mut); }

.status-tag {
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .6px;
  padding: 2px 8px; border-radius: var(--radius-pill); display: inline-block;
}
.status-tag.ok   { background: var(--ok-bg);   color: var(--ok); }
.status-tag.warn { background: var(--warn-bg); color: var(--warn); }
.status-tag.late { background: var(--late-bg); color: var(--late); }
.status-tag.off  { background: var(--surface-2); color: var(--text-mut); }

/* ---------- Historique ---------- */
.timeline { display: flex; flex-direction: column; gap: 10px; }
.tl-item {
  display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: start;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 12px 14px;
}
.tl-item .ic {
  width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center;
  font-size: 18px; flex: 0 0 auto;
}
.tl-item.ride .ic { background: #12233a; }
.tl-item.maint .ic { background: #2a1c10; }
.tl-item .main .t { font-weight: 600; font-size: 14.5px; }
.tl-item .main .d { font-size: 12.5px; color: var(--text-dim); margin-top: 2px; }
.tl-item .main .chips { margin-top: 6px; display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  font-size: 11.5px; padding: 3px 8px; border-radius: var(--radius-pill);
  background: var(--surface-2); color: var(--text-dim); border: 1px solid var(--line);
}
.tl-item .aside { text-align: right; color: var(--text-mut); font-size: 12px; white-space: nowrap; }
.tl-item .aside .h { font-family: var(--font-head); font-weight: 700; font-size: 16px; color: var(--text); }

.filters { display: flex; gap: 8px; margin-bottom: 12px; }
.filter-btn {
  flex: 1; padding: 9px; border-radius: var(--radius-pill);
  background: var(--surface); border: 1px solid var(--line); color: var(--text-dim);
  font-weight: 600; font-size: 13px; cursor: pointer;
}
.filter-btn.active { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

/* ---------- Formulaires ---------- */
.field { margin-bottom: 16px; }
.field > label {
  display: block; font-size: 13px; font-weight: 600; color: var(--text-dim);
  margin-bottom: 7px; letter-spacing: .2px;
}
.field .hint { font-size: 12px; color: var(--text-mut); margin-top: 6px; }

.input, textarea.input, select.input {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 14px;
  font-size: 16px; /* >=16px pour éviter le zoom iOS */
  font-family: inherit;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.input:focus, textarea.input:focus, select.input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(255,106,26,.18);
}
textarea.input { resize: vertical; min-height: 76px; }
select.input {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23aab3c5' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center;
  padding-right: 40px;
}

.field-row { display: flex; gap: 12px; }
.field-row > * { flex: 1; }

/* Steppers numériques */
.stepper {
  display: flex; align-items: stretch; gap: 0;
  border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden;
  background: var(--surface);
}
.stepper button {
  width: 54px; border: none; background: var(--surface-2); color: var(--text);
  font-size: 26px; font-weight: 600; cursor: pointer; line-height: 1;
}
.stepper button:active { background: var(--line); }
.stepper input {
  flex: 1; text-align: center; border: none; background: transparent; color: var(--text);
  font-family: var(--font-head); font-weight: 700; font-size: 26px; outline: none; min-width: 0;
}

/* Segmented control */
.segmented {
  display: flex; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-pill); padding: 4px; gap: 4px;
}
.segmented button {
  flex: 1; border: none; background: transparent; color: var(--text-dim);
  padding: 10px; border-radius: var(--radius-pill); font-weight: 600; font-size: 14px; cursor: pointer;
  transition: background .15s, color .15s;
}
.segmented button.active { background: var(--accent); color: var(--accent-ink); }

/* Quick chips (terrain) */
.chip-select { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-select button {
  padding: 10px 14px; border-radius: var(--radius-pill);
  background: var(--surface); border: 1px solid var(--line); color: var(--text-dim);
  font-weight: 600; font-size: 14px; cursor: pointer;
}
.chip-select button.active { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

/* En-tête de catégorie (checklist, réglages, entretiens initiaux) */
.check-cat {
  font-family: var(--font-head);
  text-transform: uppercase; letter-spacing: 1.2px; font-size: 12.5px;
  color: var(--accent-2);
  margin: 14px 2px 2px; padding-bottom: 4px;
  border-bottom: 1px solid var(--line-soft);
}
.check-cat:first-child { margin-top: 2px; }

/* Checklist entretien */
.check-list { display: flex; flex-direction: column; gap: 10px; }
.check-item {
  display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 14px;
  transition: border-color .15s, background .15s;
  user-select: none;
}
.check-item .check-head {
  display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center;
  cursor: pointer;
}
.check-item.checked { border-color: var(--accent); background: #221812; }
.check-item .box {
  width: 26px; height: 26px; border-radius: 8px; border: 2px solid var(--line);
  display: grid; place-items: center; flex: 0 0 auto; transition: all .15s;
}
.check-item.checked .box { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.check-item .box svg { opacity: 0; transition: opacity .15s; }
.check-item.checked .box svg { opacity: 1; }
.check-item .lbl .n { font-weight: 600; font-size: 15px; }
.check-item .lbl .s { font-size: 12px; color: var(--text-mut); margin-top: 2px; }
.check-item .tag { flex: 0 0 auto; }
.check-item .cost-reveal {
  display: none; align-items: center; gap: 10px;
  margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--line);
}
.check-item.checked .cost-reveal { display: flex; }
.cost-hint { font-size: 12px; color: var(--text-mut); }

/* Champ monétaire */
.money-input { display: inline-flex; align-items: center; gap: 0; position: relative; }
.money-input .cur {
  position: absolute; left: 13px; font-weight: 700; color: var(--accent-2); pointer-events: none; font-size: 16px;
}
.money-input .input { padding-left: 30px; max-width: 140px; }

/* ---------- Boutons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border-radius: var(--radius-sm); padding: 15px 18px; font-size: 16px; font-weight: 700;
  border: 1px solid transparent; cursor: pointer; width: 100%;
  font-family: inherit; letter-spacing: .2px; transition: transform .1s, background .15s;
}
.btn:active { transform: scale(.98); }
.btn.primary { background: linear-gradient(180deg, var(--accent-2), var(--accent)); color: var(--accent-ink); box-shadow: 0 8px 20px rgba(255,106,26,.28); }
.btn.ghost   { background: var(--surface); color: var(--text); border-color: var(--line); }
.btn.danger  { background: var(--late-bg); color: var(--late); border-color: #5e222b; }
.btn.sm { padding: 10px 14px; font-size: 14px; width: auto; }

.btn-stack { display: flex; flex-direction: column; gap: 10px; margin-top: 8px; }

.sticky-cta {
  position: sticky;
  bottom: calc(env(safe-area-inset-bottom) + 10px);
  margin-top: 24px;
  z-index: 25;
}
/* Écrans "tâche" (sortie / entretien) : pas de barre d'onglets */
.app.form-mode { padding-bottom: calc(env(safe-area-inset-bottom) + 16px); }

/* ---------- Barre de navigation basse ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  max-width: var(--maxw); margin: 0 auto;
  height: calc(var(--nav-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  display: grid; grid-template-columns: repeat(4, 1fr);
  background: linear-gradient(180deg, rgba(20,24,33,.9), rgba(13,15,20,.98));
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--line-soft);
}
.tabbar button {
  border: none; background: transparent; color: var(--text-mut);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  font-size: 11px; font-weight: 600; cursor: pointer; padding-top: 8px;
}
.tabbar button svg { width: 23px; height: 23px; }
.tabbar button.active { color: var(--accent-2); }

/* ---------- Modale ---------- */
.modal-overlay {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(6,8,12,.66); backdrop-filter: blur(3px);
  display: flex; align-items: flex-end; justify-content: center;
  animation: fade .18s ease;
}
@media (min-width: 560px) { .modal-overlay { align-items: center; } }
.modal {
  width: 100%; max-width: var(--maxw);
  background: var(--bg-2); border: 1px solid var(--line);
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 20px 18px calc(20px + env(safe-area-inset-bottom));
  box-shadow: var(--shadow);
  animation: slideup .24s cubic-bezier(.2,.9,.3,1);
  max-height: 92dvh; overflow-y: auto;
}
@media (min-width: 560px) { .modal { border-radius: var(--radius); margin: 16px; } }
@keyframes slideup { from { transform: translateY(30px); opacity: .6; } to { transform: none; opacity: 1; } }
.modal .grab { width: 44px; height: 5px; border-radius: 3px; background: var(--line); margin: -6px auto 14px; }
.modal h2 { font-family: var(--font-head); font-size: 24px; margin: 0 0 4px; letter-spacing: .4px; }
.modal .modal-sub { color: var(--text-dim); font-size: 13.5px; margin: 0 0 18px; }

/* ---------- Toasts ---------- */
.toast-root {
  position: fixed; left: 0; right: 0; bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 12px);
  z-index: 60; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none;
}
.toast {
  background: var(--surface-2); color: var(--text); border: 1px solid var(--line);
  padding: 12px 18px; border-radius: var(--radius-pill); font-size: 14px; font-weight: 600;
  box-shadow: var(--shadow); animation: toastin .25s ease;
  display: flex; align-items: center; gap: 9px; max-width: 90%;
}
.toast.ok  { border-color: #1c5238; }
.toast.ok .dot  { color: var(--ok); }
.toast.err { border-color: #5e222b; }
@keyframes toastin { from { transform: translateY(12px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- États vides ---------- */
.empty {
  text-align: center; padding: 50px 20px; color: var(--text-mut);
}
.empty .ic { font-size: 46px; opacity: .5; margin-bottom: 10px; }
.empty p { margin: 4px 0; }

/* ---------- Divers ---------- */
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.muted { color: var(--text-mut); }
.dim { color: var(--text-dim); }
.mt-8 { margin-top: 8px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; }
.center { text-align: center; }
.danger-text { color: var(--late); }
.pill-toggle {
  display: inline-flex; align-items: center; gap: 8px; cursor: pointer;
  font-size: 14px; font-weight: 600; color: var(--text-dim);
}
.switch {
  width: 46px; height: 27px; border-radius: 999px; background: var(--line);
  position: relative; transition: background .18s; flex: 0 0 auto;
}
.switch::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 21px; height: 21px;
  border-radius: 50%; background: #fff; transition: transform .18s;
}
.switch.on { background: var(--accent); }
.switch.on::after { transform: translateX(19px); }

.divider { height: 1px; background: var(--line-soft); margin: 18px 0; }

.settings-list { display: flex; flex-direction: column; gap: 10px; }
.seuil-row {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 14px;
}
.seuil-row .top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.seuil-row .top .name { font-weight: 600; font-size: 15px; }
.seuil-row .grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.seuil-row.disabled { opacity: .55; }
.mini-label { font-size: 11px; color: var(--text-mut); margin-bottom: 5px; text-transform: uppercase; letter-spacing: .5px; }

.install-banner {
  margin: 0 16px 4px; padding: 12px 14px; border-radius: var(--radius-sm);
  background: linear-gradient(180deg, #201a12, #17140f);
  border: 1px solid #3a2c17; display: flex; align-items: center; gap: 12px;
}
.install-banner .ic { font-size: 22px; }
.install-banner .txt { flex: 1; font-size: 13px; }
.install-banner .txt b { display: block; font-size: 14px; }
.install-banner button { flex: 0 0 auto; }

/* ---------- Statistiques ---------- */
.kpi-grid {
  display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px;
}
@media (max-width: 380px) { .kpi-grid { grid-template-columns: 1fr 1fr; } }
.kpi {
  background: linear-gradient(180deg, var(--surface), var(--bg-2));
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 12px 10px; text-align: center;
}
.kpi-ic { font-size: 18px; margin-bottom: 4px; }
.kpi-val { font-family: var(--font-head); font-weight: 700; font-size: 20px; color: var(--text); line-height: 1; }
.kpi-lbl { font-size: 11px; color: var(--text-mut); margin-top: 5px; }

.chart-card { padding: 14px 10px 8px; }
.chart-scroll { width: 100%; overflow-x: auto; }
.chart-scroll svg { display: block; min-width: 300px; }

/* Barres horizontales (répartitions) */
.hbar { padding: 9px 0; }
.hbar + .hbar { border-top: 1px solid var(--line-soft); }
.hbar-top { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.hbar-name { font-weight: 600; font-size: 14px; }
.hbar-val { font-family: var(--font-head); font-weight: 700; font-size: 15px; color: var(--text); white-space: nowrap; }
.hbar-track { height: 8px; border-radius: 5px; background: var(--line); margin-top: 7px; overflow: hidden; }
.hbar-track > span { display: block; height: 100%; border-radius: 5px; transition: width .3s; }
.hbar-sub { font-size: 11.5px; color: var(--text-mut); margin-top: 4px; }

.chip.cost { background: #14251c; color: var(--ok); border-color: #1c5238; }

/* ---------- Entretiens déjà faits (création) ---------- */
.init-maint-panel {
  margin-top: 10px; padding: 12px 14px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm);
}
.init-maint-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 8px 0; border-bottom: 1px solid var(--line-soft);
}
.init-maint-row:last-child { border-bottom: none; }
.imr-name { font-size: 14px; font-weight: 500; }
.imr-input { display: flex; align-items: center; gap: 6px; flex: 0 0 auto; }
.imr-input .input { width: 92px; padding: 9px 10px; text-align: right; font-size: 15px; }
.imr-u { color: var(--text-mut); font-size: 13px; }

/* ---------- Catalogue enduro ---------- */
.catalog-list { max-height: 58vh; overflow-y: auto; margin: 0 -4px; padding: 0 4px; }
.catalog-brand {
  position: sticky; top: 0; z-index: 1;
  font-family: var(--font-head); text-transform: uppercase; letter-spacing: 1px;
  font-size: 13px; color: var(--accent-2);
  background: var(--bg-2); padding: 10px 4px 6px; border-bottom: 1px solid var(--line-soft);
}
.catalog-item {
  width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: transparent; border: none; border-bottom: 1px solid var(--line-soft);
  padding: 12px 4px; cursor: pointer; color: var(--text); text-align: left;
}
.catalog-item:active { background: var(--surface); }
.catalog-item .ci-name { font-weight: 600; font-size: 15px; }
.catalog-item .ci-meta { font-size: 12px; color: var(--text-mut); margin-top: 2px; }
.ci-badge {
  flex: 0 0 auto; font-family: var(--font-head); font-weight: 700; font-size: 13px;
  padding: 4px 10px; border-radius: var(--radius-pill); letter-spacing: .5px;
}
.ci-badge.t2 { background: #2a1c10; color: var(--accent-2); border: 1px solid #3a2c17; }
.ci-badge.t4 { background: #10202a; color: #4ea1ff; border: 1px solid #17303a; }

/* ---------- Connexion ---------- */
.login-screen { min-height: 100dvh; display: grid; place-items: center; padding: 24px; }
.login-card {
  width: 100%; max-width: 360px; text-align: center;
  background: linear-gradient(180deg, var(--surface), var(--bg-2));
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 30px 22px; box-shadow: var(--shadow);
}
.login-logo .name { font-family: var(--font-head); font-weight: 700; font-size: 34px; letter-spacing: 1.5px; }
.login-logo .name b { color: var(--accent); }
.login-sub { color: var(--text-dim); font-size: 14px; margin: 10px 0 20px; }
.login-err { color: var(--late); font-size: 13px; min-height: 18px; margin: 4px 0 12px; }
.login-card .field { margin-bottom: 6px; }

/* ---------- Indicateur de synchronisation ---------- */
.sync-status {
  font-size: 11.5px; font-weight: 600; color: var(--text-mut);
  display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
}
.appbar .sync-status { margin-left: auto; }
.sync-status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; flex: 0 0 auto; }
.sync-status.synced  { color: var(--ok); }
.sync-status.syncing { color: var(--accent-2); }
.sync-status.syncing::before { animation: sync-pulse 1s infinite; }
.sync-status.pending { color: var(--warn); }
.sync-status.offline { color: var(--text-mut); }
.sync-status.auth, .sync-status.idle { display: none; }
@keyframes sync-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .3; } }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
