/* ============================================================
   TEP — Eminence Prestige — Feuille de style (mobile-first)
   Thème sobre : anthracite + accent doré.
   ============================================================ */
:root {
  --bg:        #0f1115;
  --surface:   #1a1d24;
  --surface-2: #232730;
  --line:      #313640;
  --text:      #f2f3f5;
  --muted:     #9aa1ad;
  --gold:      #c9a227;
  --gold-soft: #e6c869;
  --green:     #2ecc71;
  --red:       #e74c3c;
  --orange:    #e67e22;
  --radius:    14px;
  --shadow:    0 8px 24px rgba(0,0,0,.35);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.45;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

.app { max-width: 560px; margin: 0 auto; padding: 0 16px 96px; }

/* --- En-tête --- */
.header {
  display: flex; align-items: center; gap: 12px;
  padding: 18px 16px 14px; max-width: 560px; margin: 0 auto;
}
.header .logo {
  width: 38px; height: 38px; border-radius: 9px;
  background: linear-gradient(135deg, var(--gold), var(--gold-soft));
  color: #1a1d24; font-weight: 800; font-size: 18px;
  display: grid; place-items: center; letter-spacing: -1px;
}
.header h1 { font-size: 17px; margin: 0; font-weight: 700; }
.header .sub { font-size: 12px; color: var(--muted); margin: 0; }
.header .right { margin-left: auto; }

/* --- Cartes --- */
.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px; margin-bottom: 14px;
  box-shadow: var(--shadow);
}
.card h2 { font-size: 16px; margin: 0 0 12px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

/* --- Boutons --- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; padding: 15px 16px; border: none; border-radius: 12px;
  font-size: 16px; font-weight: 700; cursor: pointer; color: #14161b;
  background: linear-gradient(135deg, var(--gold), var(--gold-soft));
  transition: transform .05s ease, opacity .2s;
}
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.secondary { background: var(--surface-2); color: var(--text); border: 1px solid var(--line); }
.btn.danger { background: var(--red); color: #fff; }
.btn.ghost { background: transparent; color: var(--muted); border: 1px solid var(--line); }
.btn-row { display: flex; gap: 10px; }
.btn-row .btn { width: auto; flex: 1; }

/* --- Champs --- */
label { display: block; font-size: 13px; color: var(--muted); margin: 0 0 6px; }
input[type=text], input[type=number], input[type=password], textarea, select {
  width: 100%; padding: 13px 14px; border-radius: 11px;
  border: 1px solid var(--line); background: var(--surface-2);
  color: var(--text); font-size: 16px; outline: none;
}
input:focus, textarea:focus, select:focus { border-color: var(--gold); }
textarea { resize: vertical; min-height: 70px; }
.field { margin-bottom: 14px; }

/* --- Pavé PIN --- */
.pin-display {
  display: flex; justify-content: center; gap: 12px; margin: 8px 0 20px;
}
.pin-dot { width: 14px; height: 14px; border-radius: 50%; background: var(--surface-2); border: 1px solid var(--line); }
.pin-dot.filled { background: var(--gold); border-color: var(--gold); }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.key {
  padding: 18px 0; font-size: 22px; font-weight: 600; border-radius: 12px;
  background: var(--surface-2); border: 1px solid var(--line); color: var(--text);
  cursor: pointer; text-align: center;
}
.key:active { background: var(--surface); }
.key.fn { font-size: 15px; color: var(--muted); }

/* --- Liste sélectionnable (salariés, véhicules) --- */
.list-item {
  display: flex; align-items: center; gap: 12px; width: 100%;
  background: var(--surface); border: 1px solid var(--line); color: var(--text);
  border-radius: 12px; padding: 14px 16px; margin-bottom: 10px; cursor: pointer;
  text-align: left; font-size: 16px;
}
.list-item:active { border-color: var(--gold); }
.list-item .ico { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center;
  background: var(--surface-2); font-size: 20px; }
.list-item .meta { flex: 1; }
.list-item .meta .t { font-weight: 700; }
.list-item .meta .s { font-size: 13px; color: var(--muted); }
.badge { font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 999px; }
.badge.start { background: rgba(46,204,113,.15); color: var(--green); }
.badge.end { background: rgba(230,126,34,.15); color: var(--orange); }

/* --- Étapes photo --- */
.steps-progress { display: flex; gap: 6px; margin-bottom: 16px; }
.steps-progress .dot { flex: 1; height: 5px; border-radius: 3px; background: var(--surface-2); }
.steps-progress .dot.done { background: var(--green); }
.steps-progress .dot.current { background: var(--gold); }

.photo-frame {
  width: 100%; aspect-ratio: 4/3; border-radius: 14px; overflow: hidden;
  background: var(--surface-2); border: 2px dashed var(--line);
  display: grid; place-items: center; position: relative; margin-bottom: 14px;
}
.photo-frame img { width: 100%; height: 100%; object-fit: cover; }
.photo-frame .hint { color: var(--muted); text-align: center; padding: 20px; }
.photo-frame .hint .big { font-size: 46px; display: block; margin-bottom: 8px; }
.step-title { font-size: 19px; font-weight: 800; margin: 0 0 4px; }
.step-sub { color: var(--muted); margin: 0 0 16px; }

/* --- Galerie miniatures --- */
.thumbs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.thumbs .thumb { aspect-ratio: 1; border-radius: 10px; overflow: hidden; background: var(--surface-2); position: relative; }
.thumbs .thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumbs .thumb .lbl { position: absolute; bottom: 0; left: 0; right: 0; font-size: 10px;
  background: rgba(0,0,0,.55); padding: 2px 4px; text-align: center; }

/* --- Jauge essence (boutons 1/8) --- */
.fuel { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.fuel button { padding: 12px 0; border-radius: 10px; border: 1px solid var(--line);
  background: var(--surface-2); color: var(--text); font-weight: 700; cursor: pointer; }
.fuel button.active { background: var(--gold); color: #14161b; border-color: var(--gold); }

/* --- Bandeau bas fixe --- */
.bottom-bar {
  position: fixed; bottom: 0; left: 0; right: 0; background: rgba(15,17,21,.92);
  backdrop-filter: blur(8px); border-top: 1px solid var(--line); padding: 12px 16px;
  padding-bottom: calc(12px + env(safe-area-inset-bottom));
}
.bottom-bar .inner { max-width: 560px; margin: 0 auto; }

/* --- Alertes / toasts --- */
.alert { padding: 12px 14px; border-radius: 11px; font-size: 14px; margin-bottom: 12px; }
.alert.warn { background: rgba(230,126,34,.12); border: 1px solid var(--orange); color: var(--gold-soft); }
.alert.ok { background: rgba(46,204,113,.12); border: 1px solid var(--green); color: #a8e6c0; }
.alert.err { background: rgba(231,76,60,.12); border: 1px solid var(--red); color: #f3b0a8; }

.toast {
  position: fixed; bottom: 90px; left: 50%; transform: translateX(-50%);
  background: var(--surface-2); border: 1px solid var(--line); color: var(--text);
  padding: 12px 18px; border-radius: 12px; box-shadow: var(--shadow); z-index: 50;
  font-size: 14px; max-width: 90%; text-align: center;
}

.checkbox { display: flex; align-items: center; gap: 10px; padding: 12px 0; }
.checkbox input { width: 22px; height: 22px; accent-color: var(--gold); }
.checkbox label { margin: 0; color: var(--text); font-size: 15px; }

.center { text-align: center; }
.hidden { display: none !important; }
.spinner { border: 3px solid var(--line); border-top-color: var(--gold); border-radius: 50%;
  width: 26px; height: 26px; animation: spin .8s linear infinite; margin: 0 auto; }
@keyframes spin { to { transform: rotate(360deg); } }
