/* ===================== L'Heure d'Or — Styles ===================== */
:root {
  --navy: #0F1B2D;
  --navy-2: #16263D;
  --navy-3: #22385A;
  --or: #C9A227;
  --or-clair: #F3D67A;
  --or-pale: #FBF4DE;
  --fond: #F5F3EE;
  --carte: #FFFFFF;
  --texte: #1B2433;
  --texte-2: #5B6678;
  --bord: #E6E2D8;
  --vert: #0E9F6E;
  --vert-pale: #E3F6EE;
  --rouge: #D93A3A;
  --rouge-pale: #FDECEC;
  --orange: #E08A00;
  --orange-pale: #FFF4E0;
  --bleu: #2F6FDE;
  --bleu-pale: #E8F0FD;
  --rayon: 14px;
  --ombre: 0 1px 2px rgba(15, 27, 45, .05), 0 4px 16px rgba(15, 27, 45, .06);
  --sidebar: 250px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  background: var(--fond); color: var(--texte); font-size: 14px; line-height: 1.5;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
.serif { font-family: 'Playfair Display', Georgia, serif; }

/* ---------- Mise en page ---------- */
.app { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar); background: var(--navy); color: #C8D0DC;
  position: fixed; inset: 0 auto 0 0; display: flex; flex-direction: column;
  z-index: 50; transition: transform .25s;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 22px 20px 18px; border-bottom: 1px solid rgba(255,255,255,.06); }
.brand img { width: 42px; height: 42px; }
.brand-nom { font-family: 'Playfair Display', Georgia, serif; color: #fff; font-size: 19px; font-weight: 700; line-height: 1.1; }
.brand-slogan { font-size: 11px; color: var(--or); letter-spacing: .3px; }

.nav { padding: 14px 12px; flex: 1; overflow-y: auto; }
.nav-titre { font-size: 10.5px; text-transform: uppercase; letter-spacing: 1.2px; color: #6F7E95; padding: 14px 12px 6px; }
.nav a {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px;
  font-weight: 500; margin-bottom: 2px; transition: background .15s, color .15s;
}
.nav a svg { width: 18px; height: 18px; flex-shrink: 0; opacity: .85; }
.nav a:hover { background: var(--navy-2); color: #fff; }
.nav a.actif { background: linear-gradient(90deg, rgba(201,162,39,.22), rgba(201,162,39,.05)); color: var(--or-clair); box-shadow: inset 3px 0 0 var(--or); }
.nav .badge-nav { margin-left: auto; background: var(--rouge); color: #fff; font-size: 11px; border-radius: 20px; padding: 1px 7px; font-weight: 600; }
.sidebar-pied { padding: 14px 20px; font-size: 11.5px; color: #6F7E95; border-top: 1px solid rgba(255,255,255,.06); }

.principal { margin-left: var(--sidebar); flex: 1; min-width: 0; }
.topbar {
  height: 64px; background: rgba(255,255,255,.85); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--bord); display: flex; align-items: center; gap: 16px;
  padding: 0 28px; position: sticky; top: 0; z-index: 40;
}
.topbar h1 { font-family: 'Playfair Display', Georgia, serif; font-size: 22px; font-weight: 700; }
.topbar .date { color: var(--texte-2); font-size: 13px; }
.topbar .espace { flex: 1; }
.btn-menu { display: none; background: none; border: 0; padding: 6px; }
.contenu { padding: 26px 28px 60px; max-width: 1500px; }

/* ---------- Boutons & champs ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--bord); background: #fff;
  color: var(--texte); padding: 9px 15px; border-radius: 10px; font-weight: 600; font-size: 13.5px;
  transition: all .15s; white-space: nowrap;
}
.btn:hover { border-color: #CFC8B6; background: #FCFBF8; }
.btn svg { width: 16px; height: 16px; }
.btn-or { background: linear-gradient(135deg, #D4AF37, #B38E1C); color: #fff; border: 0; box-shadow: 0 2px 8px rgba(201,162,39,.35); }
.btn-or:hover { background: linear-gradient(135deg, #DDB944, #A8840F); }
.btn-navy { background: var(--navy); color: #fff; border: 0; }
.btn-navy:hover { background: var(--navy-3); }
.btn-danger { color: var(--rouge); }
.btn-sm { padding: 5px 10px; font-size: 12.5px; border-radius: 8px; }
.btn-lien { background: none; border: 0; color: var(--bleu); font-weight: 600; padding: 0; }

input, select, textarea {
  font-family: inherit; font-size: 14px; color: var(--texte); background: #fff;
  border: 1px solid var(--bord); border-radius: 10px; padding: 9px 12px; width: 100%;
  outline: none; transition: border .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus { border-color: var(--or); box-shadow: 0 0 0 3px rgba(201,162,39,.15); }
label { font-size: 12.5px; font-weight: 600; color: var(--texte-2); display: block; margin-bottom: 5px; }
.champ { margin-bottom: 14px; }
.grille-form { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.grille-form .plein { grid-column: 1 / -1; }
.cases { display: flex; flex-wrap: wrap; gap: 8px; }
.cases label { display: flex; align-items: center; gap: 6px; border: 1px solid var(--bord); padding: 6px 10px; border-radius: 8px; font-weight: 500; color: var(--texte); margin: 0; cursor: pointer; }
.cases input { width: auto; }

.barre-outils { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 18px; }
.barre-outils .recherche { position: relative; flex: 1; min-width: 200px; max-width: 340px; }
.barre-outils .recherche input { padding-left: 36px; }
.barre-outils .recherche svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 17px; color: var(--texte-2); }
.barre-outils select { width: auto; min-width: 160px; }
.barre-outils .espace { flex: 1; }

/* ---------- Cartes ---------- */
.carte { background: var(--carte); border: 1px solid var(--bord); border-radius: var(--rayon); box-shadow: var(--ombre); }
.carte-tete { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 16px 20px; border-bottom: 1px solid var(--bord); }
.carte-tete h3 { font-size: 15px; font-weight: 700; }
.carte-tete .sous { color: var(--texte-2); font-size: 12.5px; font-weight: 500; }
.carte-corps { padding: 18px 20px; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 16px; margin-bottom: 24px; }
.kpi { padding: 18px 20px; position: relative; overflow: hidden; }
.kpi .lib { color: var(--texte-2); font-size: 12.5px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.kpi .lib .ico { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; }
.kpi .lib .ico svg { width: 16px; height: 16px; }
.kpi .val { font-size: 26px; font-weight: 800; margin-top: 10px; letter-spacing: -.5px; }
.kpi .val small { font-size: 14px; font-weight: 600; color: var(--texte-2); }
.kpi .tendance { font-size: 12px; font-weight: 600; margin-top: 2px; }
.haut { color: var(--vert); } .bas { color: var(--rouge); }

/* ---------- Boutiques (tableau de bord) ---------- */
.section-titre { display: flex; align-items: baseline; justify-content: space-between; margin: 6px 0 14px; }
.section-titre h2 { font-family: 'Playfair Display', Georgia, serif; font-size: 20px; }
.section-titre .sous { color: var(--texte-2); font-size: 13px; }

.boutiques { display: grid; grid-template-columns: repeat(5, 1fr); gap: 16px; margin-bottom: 26px; }
.boutique {
  padding: 18px; cursor: pointer; transition: transform .15s, box-shadow .15s; position: relative; overflow: hidden;
  display: flex; flex-direction: column;
}
.boutique::before { content: ''; position: absolute; inset: 0 0 auto 0; height: 4px; background: var(--c); }
.boutique:hover { transform: translateY(-3px); box-shadow: 0 10px 28px rgba(15,27,45,.12); }
.boutique.centrale { background: linear-gradient(160deg, #13223A, #0F1B2D); color: #E8ECF2; border-color: var(--navy); }
.boutique .tete { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.boutique .nom { font-family: 'Playfair Display', Georgia, serif; font-size: 18px; font-weight: 700; }
.boutique .secteur { font-size: 11.5px; color: var(--texte-2); margin-top: 1px; }
.boutique.centrale .secteur { color: #8E9BB0; }
.boutique .grand { font-size: 38px; font-weight: 800; line-height: 1; margin-top: 16px; letter-spacing: -1px; }
.boutique .grand-lib { font-size: 12px; color: var(--texte-2); font-weight: 600; }
.boutique.centrale .grand { color: var(--or-clair); }
.boutique.centrale .grand-lib { color: #A9B4C5; }
.boutique .ligne { display: flex; justify-content: space-between; font-size: 12.5px; margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--bord); }
.boutique.centrale .ligne { border-color: rgba(255,255,255,.12); }
.boutique .ligne b { font-weight: 700; }
.boutique .autres { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 5px; }
.boutique .autres span { background: rgba(243,214,122,.14); color: var(--or-clair); font-size: 11px; padding: 3px 8px; border-radius: 20px; font-weight: 600; }
.boutique svg.spark { margin-top: auto; padding-top: 12px; width: 100%; height: 46px; }

.badge { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 20px; white-space: nowrap; }
.b-or { background: var(--or); color: #fff; }
.b-vert { background: var(--vert-pale); color: var(--vert); }
.b-rouge { background: var(--rouge-pale); color: var(--rouge); }
.b-orange { background: var(--orange-pale); color: var(--orange); }
.b-bleu { background: var(--bleu-pale); color: var(--bleu); }
.b-gris { background: #EEF0F3; color: var(--texte-2); }

.grille-2 { display: grid; grid-template-columns: 1.6fr 1fr; gap: 18px; margin-bottom: 18px; }
.grille-2e { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-bottom: 18px; }

/* ---------- Graphiques ---------- */
.graph-barres { width: 100%; height: 240px; }
.barres-h .ligne-h { display: grid; grid-template-columns: 110px 1fr 100px; align-items: center; gap: 10px; margin-bottom: 12px; font-size: 13px; }
.barres-h .piste { background: #F1EEE6; border-radius: 6px; height: 12px; overflow: hidden; }
.barres-h .rempli { height: 100%; border-radius: 6px; }
.barres-h .montant { text-align: right; font-weight: 700; }
.legende { display: flex; flex-wrap: wrap; gap: 12px; font-size: 12px; color: var(--texte-2); }
.legende span { display: inline-flex; align-items: center; gap: 6px; }
.legende i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

/* ---------- Tableaux ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .6px; color: var(--texte-2); font-weight: 700; padding: 11px 14px; background: #FAF8F3; border-bottom: 1px solid var(--bord); white-space: nowrap; }
td { padding: 11px 14px; border-bottom: 1px solid #F0EDE5; vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: #FCFBF7; }
tfoot td { background: var(--or-pale); font-weight: 800; border-top: 2px solid var(--or); }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.centre { text-align: center; }
.produit-cell { min-width: 230px; display: flex; align-items: center; gap: 10px; }
.produit-cell .vignette { width: 36px; height: 36px; border-radius: 9px; display: grid; place-items: center; flex-shrink: 0; font-size: 17px; }
.produit-cell .t { font-weight: 600; }
.produit-cell .s { font-size: 12px; color: var(--texte-2); }
.qte-pastille { display: inline-block; min-width: 34px; text-align: center; padding: 3px 8px; border-radius: 8px; font-weight: 700; font-size: 13px; }
.q-ok { background: var(--vert-pale); color: var(--vert); }
.q-bas { background: var(--orange-pale); color: var(--orange); }
.q-zero { background: var(--rouge-pale); color: var(--rouge); }
.q-na { color: #B8BFC9; }
.vide { text-align: center; padding: 40px; color: var(--texte-2); }
.actions-ligne { display: flex; gap: 6px; justify-content: flex-end; }

.liste-simple li { list-style: none; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 0; border-bottom: 1px solid #F0EDE5; }
.liste-simple li:last-child { border-bottom: 0; }

/* ---------- Promotions ---------- */
.promos { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 18px; }
.promo { padding: 20px; display: flex; flex-direction: column; gap: 12px; }
.promo .remise { font-size: 34px; font-weight: 800; color: var(--or); line-height: 1; }
.promo h3 { font-size: 16px; }
.promo .msg { background: #F7F5EF; border-radius: 10px; padding: 12px; font-size: 13px; border-left: 3px solid var(--or); }
.promo .meta { font-size: 12.5px; color: var(--texte-2); display: grid; gap: 4px; }
.promo .pied { display: flex; gap: 8px; margin-top: auto; flex-wrap: wrap; }

/* ---------- Onglets ---------- */
.onglets { display: inline-flex; background: #ECE8DE; border-radius: 10px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.onglets button { border: 0; background: none; padding: 7px 14px; border-radius: 8px; font-weight: 600; font-size: 13px; color: var(--texte-2); }
.onglets button.actif { background: #fff; color: var(--texte); box-shadow: 0 1px 3px rgba(0,0,0,.08); }

/* ---------- Modale ---------- */
.modale-fond { position: fixed; inset: 0; background: rgba(15,27,45,.5); backdrop-filter: blur(2px); display: grid; place-items: center; z-index: 100; padding: 20px; animation: apparait .15s; }
.modale { background: #fff; border-radius: 16px; width: 100%; max-width: 580px; max-height: 92vh; overflow-y: auto; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.modale-tete { padding: 18px 22px; border-bottom: 1px solid var(--bord); display: flex; justify-content: space-between; align-items: center; }
.modale-tete h3 { font-family: 'Playfair Display', Georgia, serif; font-size: 19px; }
.modale-corps { padding: 20px 22px; }
.modale-pied { padding: 14px 22px; border-top: 1px solid var(--bord); display: flex; justify-content: flex-end; gap: 10px; background: #FCFBF8; border-radius: 0 0 16px 16px; }
.fermer { background: none; border: 0; font-size: 24px; line-height: 1; color: var(--texte-2); }
.recap { background: var(--or-pale); border-radius: 10px; padding: 12px 14px; display: flex; justify-content: space-between; align-items: center; font-weight: 700; }
.recap .gros { font-size: 22px; }
.info { background: var(--bleu-pale); color: #1D4FA8; border-radius: 10px; padding: 10px 14px; font-size: 13px; margin-bottom: 14px; }

/* ---------- Toast ---------- */
.toasts { position: fixed; bottom: 22px; right: 22px; z-index: 200; display: grid; gap: 8px; }
.toast { background: var(--navy); color: #fff; padding: 12px 18px; border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.2); font-weight: 500; animation: monte .25s; border-left: 4px solid var(--or); }
.toast.erreur { border-left-color: var(--rouge); }

@keyframes apparait { from { opacity: 0; } to { opacity: 1; } }
@keyframes monte { from { transform: translateY(12px); opacity: 0; } to { transform: none; opacity: 1; } }

.retour { display: inline-flex; align-items: center; gap: 6px; color: var(--texte-2); font-weight: 600; margin-bottom: 14px; }
.retour:hover { color: var(--texte); }
.entete-boutique { padding: 22px 24px; display: flex; align-items: center; gap: 18px; margin-bottom: 20px; flex-wrap: wrap; }
.entete-boutique .pastille { width: 54px; height: 54px; border-radius: 14px; display: grid; place-items: center; color: #fff; font-family: 'Playfair Display', Georgia, serif; font-size: 22px; font-weight: 700; }

.voile { display: none; }

/* ---------- Responsive ---------- */
@media (max-width: 1350px) { .boutiques { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 1100px) { .grille-2, .grille-2e { grid-template-columns: 1fr; } }
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.ouvert { transform: none; }
  .voile.ouvert { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 45; }
  .principal { margin-left: 0; }
  .btn-menu { display: block; }
  .boutiques { grid-template-columns: repeat(2, 1fr); }
  .contenu { padding: 18px 14px 50px; }
  .topbar { padding: 0 14px; }
  .topbar .date { display: none; }
  .grille-form { grid-template-columns: 1fr; }
}
@media (max-width: 560px) { .boutiques { grid-template-columns: 1fr; } }

/* ---------- Connexion & utilisateur ---------- */
.connexion-fond { position: fixed; inset: 0; z-index: 150; display: grid; place-items: center; padding: 20px;
  background: radial-gradient(circle at 30% 20%, #22385A, #0F1B2D 60%); }
.connexion-carte { background: #fff; border-radius: 18px; padding: 34px 30px; width: 100%; max-width: 380px; text-align: center; box-shadow: 0 30px 80px rgba(0,0,0,.35); }
.connexion-carte h2 { font-size: 26px; margin-top: 10px; }
.connexion-carte .sous { color: var(--or); font-size: 13px; margin-bottom: 22px; }
.connexion-carte .champ { text-align: left; }
.erreur-connexion { color: var(--rouge); font-size: 13px; min-height: 18px; margin-bottom: 8px; font-weight: 600; }
.demo-identifiants { margin-top: 18px; font-size: 12px; color: var(--texte-2); background: #F7F5EF; border-radius: 10px; padding: 10px; line-height: 1.6; }
.user-chip { display: flex; align-items: center; gap: 8px; padding-left: 12px; border-left: 1px solid var(--bord); }
.user-chip .avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--navy); color: var(--or-clair); display: grid; place-items: center; font-weight: 700; }
.user-chip .user-info { display: flex; flex-direction: column; line-height: 1.2; font-size: 13px; }
.user-chip .user-info small { color: var(--texte-2); font-size: 11.5px; }
code { background: #F1EEE6; padding: 2px 6px; border-radius: 6px; font-size: 12.5px; }
@media (max-width: 900px) { .user-chip .user-info { display: none; } #actionsTop .btn { padding: 8px 10px; } }
.nouveau-client { background: var(--or-pale); border: 1px dashed var(--or); border-radius: 12px; padding: 14px 14px 12px; margin-bottom: 14px; }
