/* Osmanli Motors — feuille de style
   Direction : tableau de bord et carnet de route. Fond asphalte, courbes de
   niveau en filigrane, rouge ottoman pour l'accent, typographie condensée
   inspirée de la signalétique routière. */

:root {
  --asphalt:   #16181c;
  --asphalt-2: #1d2027;
  --asphalt-3: #24282f;
  --line:      #32383f;
  --sand:      #ece6da;
  --sand-dim:  #9aa2ad;
  --signal:    #d81e34;   /* rouge ottoman : l'identité du club */
  --go:        #3fb27f;
  --warn:      #e0a13a;
  --stop:      #d81e34;

  --font-display: "Saira Condensed", "Arial Narrow", sans-serif;
  --font-body: Karla, system-ui, sans-serif;
  --font-data: "IBM Plex Mono", ui-monospace, monospace;

  --r: 4px;
  --pad: clamp(14px, 2.4vw, 26px);
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  min-height: 100vh;
  background-color: var(--asphalt);
  /* Courbes de niveau : rappel du relief vosgien, très en retrait. */
  background-image:
    repeating-radial-gradient(circle at 82% -10%,
      transparent 0 38px, rgba(236,230,218,.028) 38px 39px),
    repeating-radial-gradient(circle at 8% 108%,
      transparent 0 52px, rgba(236,230,218,.022) 52px 53px);
  color: var(--sand);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.55;
  display: flex;
  flex-direction: column;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 800;
  letter-spacing: .01em;
  line-height: 1.05;
  margin: 0;
  text-transform: uppercase;
}
h1 { font-size: clamp(26px, 4.4vw, 40px); }
h2 { font-size: clamp(20px, 2.6vw, 26px); }
h3 { font-size: 17px; letter-spacing: .04em; }

a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }

/* Repère visible au clavier, sans exception. */
:focus-visible {
  outline: 2px solid var(--signal);
  outline-offset: 2px;
}

/* --- Barre supérieure -------------------------------------------------- */

.topbar {
  position: sticky; top: 0; z-index: 500;
  display: flex; align-items: center; gap: 18px;
  flex-wrap: wrap;
  padding: 10px var(--pad);
  background: rgba(22, 24, 28, .93);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 11px; text-decoration: none; }
.brand-mark { width: 40px; height: 40px; object-fit: contain; display: block; }
.brand-text { display: flex; flex-direction: column; line-height: 1; }
.brand-text strong {
  font-family: var(--font-display); font-weight: 800; font-size: 21px;
  letter-spacing: .07em; text-transform: uppercase;
}
.brand-text em {
  font-style: normal; font-size: 10px; letter-spacing: .22em;
  text-transform: uppercase; color: var(--sand-dim); margin-top: 3px;
}

.tabs { display: flex; gap: 2px; margin-left: auto; flex-wrap: wrap; }
.tabs a {
  font-family: var(--font-display); font-weight: 600; font-size: 14px;
  letter-spacing: .1em; text-transform: uppercase; text-decoration: none;
  padding: 8px 13px; color: var(--sand-dim);
  border-bottom: 2px solid transparent;
}
.tabs a:hover { color: var(--sand); }
.tabs a.active { color: var(--sand); border-bottom-color: var(--signal); }
.tab-admin { color: #6d757f !important; }
.tabs a.tab-admin.active { color: var(--sand) !important; }

/* --- Grille générale --------------------------------------------------- */

main { flex: 1; padding: var(--pad); max-width: 1440px; width: 100%; margin: 0 auto; }

.split { display: grid; grid-template-columns: 380px 1fr; gap: 20px; align-items: start; }
@media (max-width: 900px) { .split { grid-template-columns: 1fr; } }

.panel {
  background: var(--asphalt-2);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 18px;
}
.panel + .panel { margin-top: 16px; }

/* Un carnet de route a une marge rouge : c'est le repère du panneau de saisie. */
.panel--book { border-left: 3px solid var(--signal); }

.eyebrow {
  font-family: var(--font-display); font-size: 11px; letter-spacing: .24em;
  text-transform: uppercase; color: var(--sand-dim); margin-bottom: 10px;
}
.muted { color: var(--sand-dim); }
.small { font-size: 13px; }
.data { font-family: var(--font-data); font-variant-numeric: tabular-nums; }

/* --- Formulaires ------------------------------------------------------- */

label { display: block; font-size: 12px; letter-spacing: .1em;
        text-transform: uppercase; color: var(--sand-dim);
        font-family: var(--font-display); font-weight: 600; margin: 14px 0 5px; }
label:first-of-type { margin-top: 0; }

input[type=text], input[type=password], input[type=datetime-local],
input[type=number], input[type=search], select, textarea {
  width: 100%; padding: 9px 11px;
  background: var(--asphalt); border: 1px solid var(--line);
  border-radius: var(--r);
}
input:focus, select:focus, textarea:focus { border-color: var(--signal); outline: none; }
textarea { resize: vertical; min-height: 80px; }

.seg { display: flex; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.seg button {
  flex: 1; padding: 9px 6px; background: transparent; border: 0; cursor: pointer;
  font-family: var(--font-display); font-weight: 600; font-size: 13px;
  letter-spacing: .09em; text-transform: uppercase; color: var(--sand-dim);
}
.seg button[aria-pressed=true] { background: var(--signal); color: #fff; }

.check { display: flex; align-items: center; gap: 9px; margin: 9px 0;
         font-size: 14px; color: var(--sand); text-transform: none;
         letter-spacing: 0; font-family: var(--font-body); font-weight: 400; }
.check input { width: 17px; height: 17px; accent-color: var(--signal); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 18px; cursor: pointer;
  background: var(--signal); color: #fff; border: 1px solid var(--signal);
  border-radius: var(--r);
  font-family: var(--font-display); font-weight: 600; font-size: 15px;
  letter-spacing: .1em; text-transform: uppercase;
  text-decoration: none;
}
.btn:hover:not(:disabled) { filter: brightness(1.13); }
.btn:disabled { opacity: .5; cursor: progress; }
.btn--ghost { background: transparent; color: var(--sand); border-color: var(--line); }
.btn--ghost:hover { border-color: var(--sand-dim); filter: none; }
.btn--wide { width: 100%; }
.btn--sm { padding: 7px 12px; font-size: 13px; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }

.field-hint { font-size: 12px; color: var(--sand-dim); margin-top: 5px; }

.suggest { position: relative; }
.suggest-list {
  position: absolute; z-index: 600; inset-inline: 0; top: calc(100% + 3px);
  background: var(--asphalt-3); border: 1px solid var(--line);
  border-radius: var(--r); max-height: 240px; overflow-y: auto;
}
.suggest-list button {
  display: block; width: 100%; text-align: left; padding: 8px 11px;
  background: none; border: 0; cursor: pointer; font-size: 13px;
  border-bottom: 1px solid var(--line);
}
.suggest-list button:hover { background: var(--signal); color: #fff; }

/* --- Carte ------------------------------------------------------------- */

#map, .map {
  height: clamp(320px, 52vh, 560px);
  border: 1px solid var(--line); border-radius: var(--r);
  background: var(--asphalt-2); z-index: 1;
}
.leaflet-container { background: #101215; font-family: var(--font-body); }
/* Les tuiles OSM sont claires : on les assombrit pour rester dans la palette. */
.leaflet-tile-pane { filter: brightness(.74) saturate(.72) contrast(1.06); }
.leaflet-bar, .leaflet-popup-content-wrapper, .leaflet-popup-tip {
  background: var(--asphalt-3); color: var(--sand);
  border: 1px solid var(--line); box-shadow: none;
}
.leaflet-bar a { background: var(--asphalt-3); color: var(--sand);
                 border-bottom-color: var(--line); }
.leaflet-control-attribution { background: rgba(22,24,28,.82) !important;
                               color: var(--sand-dim) !important; font-size: 10px; }
.leaflet-control-attribution a { color: var(--sand-dim) !important; }

.poi-dot { display: block; border-radius: 50%; border: 2px solid var(--asphalt);
           width: 12px; height: 12px; }
.poi-pass { background: var(--warn); }
.poi-viewpoint { background: #56a8d8; }
.poi-fuel { background: var(--sand-dim); }

/* --- Jauge : l'élément signature --------------------------------------- */

.gauge { display: block; width: 100%; max-width: 230px; height: auto; margin: 0 auto; }
.gauge-track { stroke: var(--asphalt-3); }
.gauge-zone-stop { stroke: rgba(216,30,52,.30); }
.gauge-zone-warn { stroke: rgba(224,161,58,.30); }
.gauge-zone-go   { stroke: rgba(63,178,127,.28); }
.gauge-value     { transition: stroke-dashoffset .7s cubic-bezier(.2,.8,.25,1); }
.gauge-needle    { stroke: var(--sand); stroke-width: 2.5; stroke-linecap: round;
                   transform-origin: 110px 112px;
                   transition: transform .8s cubic-bezier(.34,1.3,.5,1); }
.gauge-num  { font-family: var(--font-display); font-weight: 800; font-size: 46px;
              fill: var(--sand); text-anchor: middle; }
.gauge-den  { font-family: var(--font-data); font-size: 12px;
              fill: var(--sand-dim); text-anchor: middle; }
.gauge-tick { stroke: var(--line); stroke-width: 1.5; }
.gauge-tick-label { font-family: var(--font-data); font-size: 9px;
                    fill: #6d757f; text-anchor: middle; }

@media (prefers-reduced-motion: reduce) {
  .gauge-value, .gauge-needle { transition: none; }
}

.subgauges { display: flex; gap: 10px; margin-top: 8px; }
.subgauge { flex: 1; }
.subgauge-label { display: flex; justify-content: space-between;
                  font-size: 11px; letter-spacing: .1em; text-transform: uppercase;
                  font-family: var(--font-display); color: var(--sand-dim); }
.bar { height: 5px; background: var(--asphalt-3); border-radius: 3px;
       overflow: hidden; margin-top: 4px; }
.bar > i { display: block; height: 100%; background: var(--sand-dim); }
.bar > i.is-go { background: var(--go); }
.bar > i.is-warn { background: var(--warn); }
.bar > i.is-stop { background: var(--stop); }

/* --- Verdict et alertes ------------------------------------------------ */

.verdict { display: flex; align-items: flex-start; gap: 11px;
           padding: 11px 13px; border-radius: var(--r); margin-top: 14px;
           border: 1px solid; }
.verdict-vert   { border-color: rgba(63,178,127,.45);  background: rgba(63,178,127,.10); }
.verdict-orange { border-color: rgba(224,161,58,.45);  background: rgba(224,161,58,.10); }
.verdict-rouge  { border-color: rgba(216,30,52,.5);    background: rgba(216,30,52,.11); }
.verdict-light { width: 12px; height: 12px; border-radius: 50%; flex: none; margin-top: 5px; }
.verdict-vert   .verdict-light { background: var(--go); }
.verdict-orange .verdict-light { background: var(--warn); }
.verdict-rouge  .verdict-light { background: var(--stop); }
.verdict strong { font-family: var(--font-display); letter-spacing: .05em;
                  text-transform: uppercase; display: block; font-size: 16px; }

.alerts { list-style: none; padding: 0; margin: 12px 0 0; }
.alerts li { position: relative; padding-left: 18px; font-size: 13.5px;
             margin-bottom: 5px; color: var(--sand-dim); }
.alerts li::before { content: ""; position: absolute; left: 3px; top: 8px;
                     width: 6px; height: 6px; background: var(--warn);
                     border-radius: 50%; }
.alerts li.is-veto { color: var(--sand); }
.alerts li.is-veto::before { background: var(--stop); }

/* --- Métriques --------------------------------------------------------- */

.metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(88px, 1fr));
           gap: 1px; background: var(--line); border: 1px solid var(--line);
           border-radius: var(--r); overflow: hidden; margin-top: 14px; }
.metric { background: var(--asphalt-2); padding: 9px 11px; }
.metric b { display: block; font-family: var(--font-data); font-size: 18px;
            font-weight: 600; line-height: 1.2; }
.metric span { font-size: 10px; letter-spacing: .12em; text-transform: uppercase;
               color: var(--sand-dim); font-family: var(--font-display);
               font-weight: 600; }

.crit { list-style: none; padding: 0; margin: 14px 0 0; }
.crit li { display: grid; grid-template-columns: 1fr 42px; gap: 10px;
           align-items: center; margin-bottom: 7px; }
.crit-name { font-size: 13px; }
.crit-name .bar { margin-top: 3px; }
.crit-val { font-family: var(--font-data); font-size: 12px; text-align: right;
            color: var(--sand-dim); }

/* --- Météo ------------------------------------------------------------- */

.wx-strip { display: flex; gap: 1px; margin-top: 14px; background: var(--line);
            border: 1px solid var(--line); border-radius: var(--r); overflow-x: auto; }
.wx-cell { flex: 1 0 84px; background: var(--asphalt-2); padding: 9px 7px;
           text-align: center; }
.wx-cell time { display: block; font-family: var(--font-data); font-size: 11px;
                color: var(--sand-dim); }
.wx-cell .wx-temp { font-family: var(--font-data); font-size: 17px; font-weight: 600; }
.wx-cell .wx-meta { font-size: 10px; color: var(--sand-dim); line-height: 1.45; }
.wx-ico { width: 26px; height: 26px; margin: 3px auto; display: block; }

/* --- Listes de cartes -------------------------------------------------- */

.cards { display: grid; gap: 14px;
         grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.card { background: var(--asphalt-2); border: 1px solid var(--line);
        border-radius: var(--r); padding: 16px; display: flex;
        flex-direction: column; gap: 9px; }
.card--link { cursor: pointer; text-align: left; }
.card--link:hover { border-color: var(--sand-dim); }
.card--selected { border-color: var(--signal); }
.card h3 { line-height: 1.2; }
.card-top { display: flex; justify-content: space-between; gap: 12px;
            align-items: flex-start; }

.score-chip { font-family: var(--font-display); font-weight: 800; font-size: 24px;
              line-height: 1; padding: 6px 9px; border-radius: var(--r);
              border: 1px solid; flex: none; }
.score-chip small { font-family: var(--font-data); font-size: 10px; font-weight: 400;
                    display: block; text-align: center; margin-top: 2px; }
.chip-vert   { color: var(--go);   border-color: rgba(63,178,127,.4);  background: rgba(63,178,127,.09); }
.chip-orange { color: var(--warn); border-color: rgba(224,161,58,.4);  background: rgba(224,161,58,.09); }
.chip-rouge  { color: var(--stop); border-color: rgba(216,30,52,.4);   background: rgba(216,30,52,.09); }

.tag-row { display: flex; gap: 6px; flex-wrap: wrap; }
.tag { font-family: var(--font-display); font-weight: 600; font-size: 11px;
       letter-spacing: .1em; text-transform: uppercase; padding: 3px 8px;
       border: 1px solid var(--line); border-radius: 2px; color: var(--sand-dim); }
.tag--signal { border-color: var(--signal); color: var(--signal); }

.inline-stats { display: flex; gap: 14px; flex-wrap: wrap;
                font-family: var(--font-data); font-size: 13px; color: var(--sand-dim); }
.inline-stats b { color: var(--sand); font-weight: 600; }

/* --- Créneaux météo ---------------------------------------------------- */

.slots { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.slot { text-align: left; background: var(--asphalt); border: 1px solid var(--line);
        border-radius: var(--r); padding: 10px; cursor: pointer; }
.slot:hover { border-color: var(--signal); }
.slot-day { font-family: var(--font-display); font-weight: 600; font-size: 14px;
            letter-spacing: .06em; text-transform: uppercase; }
.slot-score { font-family: var(--font-data); font-size: 20px; font-weight: 600; }

/* --- Galerie ----------------------------------------------------------- */

.gallery { display: grid; gap: 8px;
           grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); margin-top: 12px; }
.gallery figure { margin: 0; position: relative; background: var(--asphalt); }
.gallery img, .gallery video { width: 100%; aspect-ratio: 4/3; object-fit: cover;
                               display: block; border-radius: var(--r); }
.gallery figcaption { font-size: 11px; color: var(--sand-dim); padding: 4px 2px; }

.review { border-top: 1px solid var(--line); padding: 11px 0; }
.review-head { display: flex; justify-content: space-between; gap: 10px;
               align-items: baseline; }
.review-author { font-family: var(--font-display); font-weight: 600;
                 letter-spacing: .05em; text-transform: uppercase; }
.stars { color: var(--warn); font-size: 14px; letter-spacing: 2px; }

.people { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.person { font-size: 13px; padding: 3px 9px; border-radius: 20px;
          border: 1px solid var(--line); }
.person.is-maybe { color: var(--warn); border-color: rgba(224,161,58,.35); }
.person.is-no { color: #6d757f; text-decoration: line-through; }

/* --- États ------------------------------------------------------------- */

.empty { border: 1px dashed var(--line); border-radius: var(--r);
         padding: 30px 22px; text-align: center; color: var(--sand-dim); }
.empty h3 { color: var(--sand); margin-bottom: 8px; }

.spinner { display: inline-block; width: 15px; height: 15px; flex: none;
           border: 2px solid rgba(255,255,255,.35); border-top-color: #fff;
           border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 2s; } }

.loading-note { display: flex; align-items: center; gap: 10px; color: var(--sand-dim); }

.toast-stack { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%);
               z-index: 900; display: flex; flex-direction: column; gap: 8px;
               width: min(440px, calc(100vw - 28px)); }
.toast { background: var(--asphalt-3); border: 1px solid var(--line);
         border-left: 3px solid var(--sand-dim); border-radius: var(--r);
         padding: 11px 14px; font-size: 14px; }
.toast.is-ok { border-left-color: var(--go); }
.toast.is-err { border-left-color: var(--stop); }

.foot { display: flex; justify-content: space-between; gap: 14px; flex-wrap: wrap;
        padding: 14px var(--pad); border-top: 1px solid var(--line);
        color: #6d757f; font-size: 11.5px; }

hr.sep { border: 0; border-top: 1px solid var(--line); margin: 18px 0; }

/* --- Impression : la feuille de route ---------------------------------- */

@media print {
  .topbar, .foot, .tabs, .btn, .toast-stack, #map, .map { display: none !important; }
  body { background: #fff; color: #000; }
  .panel, .card { border-color: #999; background: #fff; }
  .metric, .wx-cell { background: #fff; }
}
