/* Charte FlipDream : navy #150001, bleu #01a2e9, rouge #ea1d25, jaune #f8ce0d */
:root {
  --navy: #150001;
  --panneau: #241418;
  --panneau-2: #2e1c20;
  --bord: #43292e;
  --texte: #f4ede8;
  --texte-2: #b9a8a4;
  --bleu: #01a2e9;
  --jaune: #f8ce0d;
  --rouge: #ea1d25;
  --vert: #35c06f;
  --orange: #f09b2e;
}
* { box-sizing: border-box; }
/* L'attribut hidden doit toujours gagner, meme sur les blocs en display:flex */
[hidden] { display: none !important; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--navy);
  color: var(--texte);
  font: 16px/1.45 -apple-system, "Segoe UI", Roboto, sans-serif;
  padding-bottom: env(safe-area-inset-bottom);
}
h1, h2, h3 { line-height: 1.2; }

/* ----- Connexion ----- */
.login { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.login-box { text-align: center; max-width: 340px; width: 100%; }
.login-box img { border-radius: 18px; }
.login-box h1 { font-family: Georgia, "Times New Roman", serif; letter-spacing: .08em; margin: 12px 0 4px; }
.login-box h1 span { color: var(--bleu); }
.login-box p { color: var(--texte-2); font-size: 14px; }
.login-box input {
  width: 100%; padding: 12px 14px; margin: 10px 0; border-radius: 10px;
  border: 1px solid var(--bord); background: var(--panneau); color: var(--texte); font-size: 16px;
}
.login-box button {
  width: 100%; padding: 12px; border: 0; border-radius: 10px;
  background: var(--bleu); color: #fff; font-size: 16px; font-weight: 600; cursor: pointer;
}

/* ----- Entête + navigation ----- */
header {
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  position: sticky; top: 0; background: var(--navy); z-index: 5;
  border-bottom: 1px solid var(--bord);
}
.marque { font-family: Georgia, "Times New Roman", serif; font-size: 20px; letter-spacing: .08em; }
.marque span { color: var(--bleu); }
.header-actions { display: flex; align-items: center; gap: 8px; }
.maj { color: var(--texte-2); font-size: 12px; }
header button {
  background: var(--panneau); color: var(--texte); border: 1px solid var(--bord);
  border-radius: 8px; width: 36px; height: 36px; font-size: 17px; cursor: pointer;
}
nav {
  display: flex; gap: 6px; padding: 8px 12px; overflow-x: auto;
  position: sticky; top: calc(57px + env(safe-area-inset-top)); background: var(--navy); z-index: 5;
}
nav button {
  flex: 0 0 auto; padding: 8px 14px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--bord); background: var(--panneau); color: var(--texte-2); font-size: 14px;
}
nav button.actif { background: var(--bleu); border-color: var(--bleu); color: #fff; font-weight: 600; }
main { padding: 12px 16px 32px; max-width: 860px; margin: 0 auto; }

/* ----- Cartes / listes ----- */
.cartes { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.carte {
  background: var(--panneau); border: 1px solid var(--bord); border-radius: 12px; padding: 12px 14px;
}
.carte .titre { color: var(--texte-2); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.carte .valeur { font-size: 22px; font-weight: 700; margin-top: 4px; }
.carte .detail { color: var(--texte-2); font-size: 12px; margin-top: 2px; }
h2.section { font-size: 14px; color: var(--texte-2); text-transform: uppercase; letter-spacing: .05em; margin: 20px 0 8px; }

.ligne {
  background: var(--panneau); border: 1px solid var(--bord); border-radius: 12px;
  padding: 10px 14px; margin-bottom: 8px; cursor: pointer;
}
.ligne:active { background: var(--panneau-2); }
.ligne .haut { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.ligne .nom { font-weight: 600; }
.ligne .sous { color: var(--texte-2); font-size: 13px; margin-top: 2px; }

.badge {
  display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 600;
  background: var(--panneau-2); color: var(--texte-2); border: 1px solid var(--bord); white-space: nowrap;
}
.badge.vert   { background: rgba(53,192,111,.14); color: var(--vert);   border-color: rgba(53,192,111,.4); }
.badge.orange { background: rgba(240,155,46,.14); color: var(--orange); border-color: rgba(240,155,46,.4); }
.badge.rouge  { background: rgba(234,29,37,.14);  color: #ff6b71;       border-color: rgba(234,29,37,.4); }
.badge.jaune  { background: rgba(248,206,13,.12); color: var(--jaune);  border-color: rgba(248,206,13,.4); }
.badge.bleu   { background: rgba(1,162,233,.14);  color: var(--bleu);   border-color: rgba(1,162,233,.4); }
.badge.gris   { opacity: .7; }

/* ----- Outils ----- */
.barre-outils { display: flex; gap: 10px; align-items: center; margin-bottom: 12px; }
.barre-outils input[type="search"] {
  flex: 1; padding: 10px 12px; border-radius: 10px; font-size: 15px;
  border: 1px solid var(--bord); background: var(--panneau); color: var(--texte);
}
.case { color: var(--texte-2); font-size: 13px; white-space: nowrap; display: flex; gap: 5px; align-items: center; }

.info { color: var(--texte-2); }
.erreur { color: #ff6b71; }
.vide { color: var(--texte-2); padding: 18px 4px; }

/* ----- Fiche machine ----- */
.fiche-fond {
  position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 20;
  display: flex; align-items: flex-end; justify-content: center;
}
.fiche {
  background: var(--panneau); border: 1px solid var(--bord); border-radius: 16px 16px 0 0;
  width: 100%; max-width: 640px; max-height: 85vh; overflow-y: auto; padding: 18px 18px 28px;
}
@media (min-width: 700px) {
  .fiche-fond { align-items: center; }
  .fiche { border-radius: 16px; }
}
.fiche h3 { margin: 0 0 2px; }
.fiche .fermer { float: right; background: none; border: 0; color: var(--texte-2); font-size: 22px; cursor: pointer; }
.fiche dl { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; margin: 14px 0; font-size: 14px; }
.fiche dt { color: var(--texte-2); }
.fiche dd { margin: 0; overflow-wrap: anywhere; }
.fiche table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.fiche th, .fiche td { text-align: left; padding: 5px 6px; border-bottom: 1px solid var(--bord); }
.fiche th { color: var(--texte-2); font-weight: 500; }
.fiche td.montant, .fiche th.montant { text-align: right; white-space: nowrap; }
.total-net { font-weight: 700; color: var(--jaune); }
