/* Yellow Fox Garage — charte Yellow Fox (référence : Pilot) : anthracite, jaune, Poppins, pastilles.
   États : turquoise (ça va), orange (bientôt), violet (en retard). Jamais de rouge ni de vert. */
@font-face { font-family: "Poppins"; src: url("fonts/poppins_regular.ttf") format("truetype"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Poppins"; src: url("fonts/poppins_semibold.ttf") format("truetype"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Poppins"; src: url("fonts/poppins_bold.ttf") format("truetype"); font-weight: 700; font-display: swap; }

:root {
  --bg: #22262F; --card: #2F343F; --card2: #383E4B; --line: #444B59;
  --yellow: #E8D62E; --cream: #F7F3E3; --text: #FFFFFF; --soft: #BDB497;
  --teal: #1FA098; --orange: #F28C28; --violet: #7B5EA7;
}
* { box-sizing: border-box; }
html { color-scheme: dark; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-family: "Poppins", system-ui, sans-serif; font-size: 16px; line-height: 1.45; }
body { min-height: 100vh; border-top: 4px solid var(--yellow); -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; color: inherit; }
[hidden] { display: none !important; }

.frame { max-width: 640px; margin: 0 auto; padding: 0 16px calc(32px + env(safe-area-inset-bottom)); }
.top { display: flex; align-items: center; justify-content: space-between; padding: 14px 0 10px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.15rem; }
.brand img { width: 38px; height: 38px; }
.yf { color: var(--yellow); }
.icon-btn { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 999px; background: var(--card); font-size: 1.2rem; border: 0; cursor: pointer; }

.label { color: var(--yellow); text-transform: uppercase; letter-spacing: .14em; font-size: .75rem; font-weight: 600; margin: 22px 4px 10px; }
.label .count { color: var(--soft); letter-spacing: 0; text-transform: none; font-weight: 400; margin-left: 6px; }

/* La voiture */
.car { background: var(--card); border-radius: 18px; padding: 14px 16px; display: flex; align-items: center; gap: 14px; cursor: pointer; border: 0; width: 100%; text-align: left; }
.car-ico { font-size: 1.8rem; width: 52px; height: 52px; border-radius: 16px; background: var(--card2); display: grid; place-items: center; flex: none; }
.car-name { font-weight: 700; font-size: 1.05rem; }
.car-plate { display: inline-block; margin-left: 8px; padding: 0 8px; border-radius: 6px; background: var(--cream); color: #22262F; font-size: .8rem; font-weight: 600; letter-spacing: .04em; vertical-align: 2px; }
.car-km { color: var(--soft); font-size: .9rem; }
.car-km b { color: var(--text); font-weight: 600; }

/* Cartes d'échéance */
.items { display: grid; gap: 10px; }
.item { background: var(--card); border-radius: 18px; padding: 14px 14px 14px 16px; display: flex; align-items: center; gap: 12px; border-left: 6px solid var(--line); }
.item.ok { border-left-color: var(--teal); }
.item.soon { border-left-color: var(--orange); }
.item.late { border-left-color: var(--violet); }
.item-main { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; cursor: pointer; background: none; border: 0; padding: 0; text-align: left; }
.item-ico { font-size: 1.5rem; width: 46px; height: 46px; border-radius: 14px; background: var(--card2); display: grid; place-items: center; flex: none; }
.item-txt { min-width: 0; }
.item-name { font-weight: 600; font-size: 1.02rem; }
.item-date { color: var(--soft); font-size: .86rem; }

.chip { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: .78rem; font-weight: 600; margin-top: 4px; }
.chip.ok { background: rgba(31,160,152,.18); color: #5FD3CB; }
.chip.soon { background: rgba(242,140,40,.18); color: #FFB066; }
.chip.late { background: rgba(123,94,167,.3); color: #C9B2F0; }
.chip.none { border: 1px dashed var(--soft); color: var(--soft); }

.pill { border-radius: 999px; padding: 10px 18px; border: 2px solid var(--yellow); background: transparent; font-weight: 600; cursor: pointer; white-space: nowrap; }
.pill.primary { background: var(--yellow); color: #22262F; }
.pill.small { padding: 7px 14px; font-size: .9rem; }
.pill.quiet { border-color: var(--line); color: var(--soft); }
.pill.warn { border-color: var(--orange); color: var(--orange); }
.pill:disabled { opacity: .5; cursor: default; }
.add { width: 100%; margin-top: 14px; padding: 13px; }

/* Fiche */
.back { display: inline-flex; align-items: center; gap: 6px; color: var(--soft); padding: 6px 0; font-size: .95rem; }
.head { display: flex; align-items: center; gap: 14px; margin: 8px 0 6px; }
.head .item-ico { width: 64px; height: 64px; font-size: 2.1rem; border-radius: 18px; }
.head h1 { margin: 0; font-size: 1.45rem; line-height: 1.2; }
.card { background: var(--card); border-radius: 18px; padding: 16px; }
.big-date { font-size: 1.15rem; font-weight: 600; }
.sub { color: var(--soft); font-size: .9rem; }
.row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.notes { white-space: pre-wrap; }
.empty { color: var(--soft); font-style: italic; }
.hist { display: grid; gap: 8px; }
.hist-row { background: var(--card); border-radius: 14px; padding: 10px 12px 10px 16px; display: flex; gap: 10px; align-items: flex-start; }
.hist-row .what { flex: 1; min-width: 0; }
.hist-row .when { font-weight: 600; }
.hist-row .meta { color: var(--soft); font-size: .88rem; }
.hist-row .note { font-size: .92rem; margin-top: 2px; white-space: pre-wrap; }
.x { border: 0; background: none; color: var(--soft); font-size: 1.1rem; cursor: pointer; padding: 4px 6px; border-radius: 8px; }
.total { color: var(--soft); font-size: .88rem; margin: 8px 4px 0; text-align: right; }

/* Formulaires */
.field { display: grid; gap: 4px; margin-bottom: 12px; }
.field label, .field .lbl { font-size: .85rem; color: var(--soft); }
.field input, .field textarea, .field select { background: var(--bg); border: 2px solid var(--line); border-radius: 12px; padding: 10px 12px; width: 100%; }
.field input:focus, .field textarea:focus { outline: none; border-color: var(--yellow); }
.field textarea { min-height: 90px; resize: vertical; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.icons { display: flex; flex-wrap: wrap; gap: 6px; }
.icons button { width: 42px; height: 42px; border-radius: 12px; border: 2px solid transparent; background: var(--card2); font-size: 1.25rem; cursor: pointer; }
.icons button[aria-pressed="true"] { border-color: var(--yellow); }
.hint { color: var(--soft); font-size: .82rem; margin: 2px 0 0; }
.inline { display: flex; gap: 8px; align-items: center; }
.inline input { flex: 1; }

dialog { background: var(--card); color: var(--text); border: 0; border-radius: 22px; padding: 0; width: min(520px, calc(100vw - 24px)); max-height: calc(100vh - 24px); }
dialog::backdrop { background: rgba(10,12,16,.7); }
dialog form { padding: 18px 18px 16px; }
dialog h2 { margin: 0 0 14px; font-size: 1.2rem; }
.dlg-actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; margin-top: 6px; }
.dlg-actions .left { margin-right: auto; }
.err { color: var(--orange); font-size: .9rem; min-height: 1.2em; margin: 0 0 6px; }

/* Jeton */
.token { background: var(--bg); border: 2px dashed var(--yellow); border-radius: 12px; padding: 10px 12px; font-family: ui-monospace, Consolas, monospace; font-size: .85rem; word-break: break-all; margin: 10px 0; }
.copyline { display: flex; gap: 8px; align-items: center; margin-top: 8px; }
.copyline code { flex: 1; min-width: 0; background: var(--bg); border-radius: 10px; padding: 8px 10px; font-size: .85rem; overflow-wrap: anywhere; }

/* Verrou */
.lock { text-align: center; padding: 8vh 8px; }
.lock-logo { width: 110px; height: 110px; }
.lock h1 { font-size: 1.5rem; margin: 10px 0 24px; }
.lock form { display: grid; gap: 10px; max-width: 300px; margin: 0 auto; text-align: left; }
.lock label { color: var(--soft); font-size: .9rem; }
.lock input { background: var(--card); border: 2px solid var(--line); border-radius: 12px; padding: 12px; font-size: 1.1rem; }
.lock-err { color: var(--orange); min-height: 1.2em; margin: 0; }

.toast { position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--cream); color: #22262F; padding: 10px 18px; border-radius: 999px; font-weight: 600; box-shadow: 0 6px 20px rgba(0,0,0,.35); max-width: calc(100vw - 32px); z-index: 10; }
.offline { color: var(--orange); font-size: .85rem; text-align: center; margin-top: 6px; }

@media (max-width: 420px) {
  .item { padding-left: 12px; gap: 8px; }
  .item-ico { width: 40px; height: 40px; font-size: 1.3rem; }
  .pill.small { padding: 7px 11px; }
}
