/* Chabnet Digital — tableau de bord. Charte sobre : bleu nuit pour la structure, orange en accent seul. */
@font-face { font-family: 'Sora'; src: url('/polices/sora.woff2') format('woff2'); font-weight: 100 900; font-display: swap; }
@font-face { font-family: 'Inter'; src: url('/polices/inter.woff2') format('woff2'); font-weight: 100 900; font-display: swap; }

:root {
  --nuit: #0F1B2D;
  --or: #FF7A2F;
  --or-texte: #C2410C;
  --encre: #16212E;
  --gris: #5E6E80;
  --filet: #DDE4EC;
  --fond: #F3F7FB;
  --blanc: #FFFFFF;
  --vert: #1F7A4D;   --vert-fond: #E4F4EB;
  --rouge: #B42318;  --rouge-fond: #FDECEA;
  --ambre: #8A5A00;  --ambre-fond: #FFF4DB;
  --rayon: 12px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--fond); color: var(--encre);
  font: 16px/1.5 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
}
h1, h2, legend, .marque span { font-family: 'Sora', 'Inter', system-ui, sans-serif; color: var(--nuit); }
h1 { font-size: 1.5rem; margin: 0 0 12px; line-height: 1.25; }
h2 { font-size: 1.1rem; margin: 0 0 12px; }
a { color: var(--nuit); }
small { color: var(--gris); font-weight: 400; }
code { font-size: 0.95em; background: var(--fond); padding: 2px 6px; border-radius: 6px; word-break: break-all; }

/* ── Barre du haut ── */
.barre {
  background: var(--nuit); color: var(--blanc);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 16px; position: sticky; top: 0; z-index: 10;
}
.marque { display: flex; align-items: center; gap: 10px; color: var(--blanc); text-decoration: none; }
.marque img { border-radius: 8px; }
.marque span { color: var(--blanc); font-weight: 700; letter-spacing: 0.5px; }
.marque em { color: var(--or); font-style: normal; font-weight: 600; }
.barre nav { display: flex; align-items: center; gap: 16px; }
.barre nav a, .barre .lien { color: var(--blanc); text-decoration: none; font: inherit; font-size: 0.95rem; }
.barre form { margin: 0; }
.lien { background: none; border: 0; padding: 0; cursor: pointer; }

main { max-width: 960px; margin: 0 auto; padding: 20px 16px 48px; }
.retour { display: inline-block; margin-bottom: 12px; color: var(--gris); text-decoration: none; }

/* ── Cartes ── */
.carte {
  background: var(--blanc); border: 1px solid var(--filet); border-radius: var(--rayon);
  padding: 20px; margin-bottom: 16px;
}
.etroite { max-width: 440px; margin: 40px auto; }
.vide { text-align: center; }
.entete-section { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.entete-section h1 { margin: 0; }
.discret { color: var(--gris); font-size: 0.9rem; }

/* ── Liste des clients ── */
.liste { display: grid; gap: 12px; }
.client {
  display: block; background: var(--blanc); border: 1px solid var(--filet); border-radius: var(--rayon);
  padding: 16px; text-decoration: none; color: inherit;
}
.client:hover, .client:focus-visible { border-color: var(--or); }
.client-haut { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.client-haut strong { font-size: 1.05rem; color: var(--nuit); }
.client-bas { display: flex; flex-wrap: wrap; gap: 4px 16px; margin-top: 8px; color: var(--gris); font-size: 0.88rem; }

/* ── Pastilles ── */
.pastille { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 0.8rem; font-weight: 600; white-space: nowrap; vertical-align: middle; }
.pastille.vert { background: var(--vert-fond); color: var(--vert); }
.pastille.rouge { background: var(--rouge-fond); color: var(--rouge); }
.pastille.ambre { background: var(--ambre-fond); color: var(--ambre); }
.pastille.gris { background: var(--fond); color: var(--gris); border: 1px solid var(--filet); }

/* ── Messages ── */
.note { border-radius: var(--rayon); padding: 12px 14px; margin: 0 0 16px; border: 1px solid; }
.note-ok { background: var(--vert-fond); border-color: #BfE3CF; color: #14532D; }
.note-erreur { background: var(--rouge-fond); border-color: #F5C2BC; color: #7A1A12; }
.note-attention { background: var(--ambre-fond); border-color: #F0D9A3; color: #5C3D00; }
.note a { color: inherit; font-weight: 600; }

/* ── Boutons ── */
.bouton {
  display: inline-block; font: inherit; font-weight: 600; font-size: 0.95rem;
  padding: 11px 18px; border-radius: 10px; cursor: pointer; text-decoration: none; text-align: center;
  background: var(--blanc); color: var(--nuit); border: 1px solid var(--nuit); min-height: 44px;
}
.bouton.principal { background: var(--nuit); color: var(--blanc); }
.bouton.principal:hover { background: #163C66; }
.bouton.danger { border-color: var(--rouge); color: var(--rouge); background: var(--blanc); }
.actions { display: flex; flex-wrap: wrap; gap: 10px; }
.actions form { margin: 0; }

/* ── Formulaires ── */
.formulaire { display: grid; gap: 6px; }
.formulaire .bouton { margin-top: 12px; justify-self: start; }
fieldset { border: 0; border-top: 1px solid var(--filet); margin: 8px 0 0; padding: 16px 0 4px; display: grid; gap: 6px; }
fieldset:first-of-type { border-top: 0; padding-top: 0; }
legend { font-weight: 700; font-size: 1rem; padding: 0; margin-bottom: 4px; }
label { font-weight: 600; font-size: 0.93rem; margin-top: 8px; }
label.choix { font-weight: 400; display: flex; align-items: center; gap: 10px; margin-top: 4px; }
label.petit { font-size: 0.85rem; color: var(--gris); margin-top: 0; }
input[type=radio], input[type=checkbox] { width: 20px; height: 20px; accent-color: var(--nuit); }
input:not([type=radio]):not([type=checkbox]), select, textarea {
  width: 100%; font: inherit; color: var(--encre); background: var(--blanc);
  border: 1px solid #C5D0DC; border-radius: 10px; padding: 10px 12px; min-height: 44px;
}
textarea { resize: vertical; line-height: 1.45; }
input:focus, select:focus, textarea:focus, .bouton:focus-visible, a:focus-visible { outline: 3px solid rgba(255, 122, 47, 0.45); outline-offset: 1px; border-color: var(--or); }
.aide { color: var(--gris); font-size: 0.88rem; margin: 0; }
.deux { display: grid; gap: 0 12px; grid-template-columns: 1fr; }

/* ── QR code ── */
.qr { display: grid; gap: 12px; justify-items: center; text-align: left; }
.qr img { background: var(--blanc); border: 1px solid var(--filet); border-radius: var(--rayon); width: 280px; height: 280px; max-width: 100%; }
.qr ol { margin: 0; padding-left: 20px; max-width: 420px; }

/* ── Chiffres du mois ── */
.chiffres { display: grid; grid-template-columns: 1fr; gap: 12px; margin: 0; }
.chiffres div { border: 1px solid var(--filet); border-radius: 10px; padding: 12px; }
.chiffres dt { color: var(--gris); font-size: 0.85rem; }
.chiffres dd { margin: 4px 0 0; font-family: 'Sora', sans-serif; font-size: 1.3rem; font-weight: 700; color: var(--nuit); }

/* ── Conversations et journal ── */
.conversations, .journal { list-style: none; margin: 0; padding: 0; }
.conversations li { border-top: 1px solid var(--filet); }
.conversations li:first-child { border-top: 0; }
.conversations a { display: block; padding: 10px 0; text-decoration: none; color: inherit; }
.conversations .apercu { display: block; color: var(--gris); font-size: 0.9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.journal li { padding: 6px 0; border-top: 1px solid var(--filet); font-size: 0.92rem; }
.journal li:first-child { border-top: 0; }
.journal .ev-panne strong, .journal .ev-deconnexion strong { color: var(--rouge); }
.journal .ev-connexion strong { color: var(--vert); }
.journal .ev-demande strong { color: var(--or-texte); }

.fil { display: flex; flex-direction: column; gap: 8px; }
.bulle { max-width: 85%; padding: 9px 12px; border-radius: 12px; font-size: 0.95rem; overflow-wrap: anywhere; }
.bulle.client { align-self: flex-start; background: var(--blanc); border: 1px solid var(--filet); }
.bulle.assistant { align-self: flex-end; background: #E7F0FA; }
.bulle.action { align-self: center; background: var(--ambre-fond); color: var(--ambre); font-size: 0.82rem; font-weight: 600; }

.zone-danger { border-color: #F5C2BC; }
.zone-danger h2 { color: var(--rouge); }

@media (min-width: 640px) {
  h1 { font-size: 1.75rem; }
  .deux { grid-template-columns: 1fr 1fr; }
  .chiffres { grid-template-columns: repeat(3, 1fr); }
  .liste { grid-template-columns: 1fr 1fr; }
  .carte { padding: 24px; }
}

.bouton[disabled] { cursor: default; opacity: 1; }
.bouton.principal[disabled] { background: var(--nuit); }

/* ── La fiche : sections repliables ── */
.fiche { gap: 12px; }
details.section { background: var(--blanc); border: 1px solid var(--filet); border-radius: var(--rayon); }
details.section > summary {
  list-style: none; cursor: pointer; padding: 14px 16px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  font-family: 'Sora', 'Inter', sans-serif; font-weight: 700; color: var(--nuit); min-height: 52px;
}
details.section > summary::-webkit-details-marker { display: none; }
details.section > summary::after { content: '▾'; margin-left: auto; color: var(--gris); transition: transform .15s; }
details.section[open] > summary::after { transform: rotate(180deg); }
details.section[open] > summary { border-bottom: 1px solid var(--filet); }
.num { display: inline-grid; place-items: center; min-width: 30px; height: 30px; border-radius: 8px; background: var(--nuit); color: var(--or); font-size: .85rem; }
.section-corps { padding: 4px 16px 18px; display: grid; gap: 6px; }
.sous-titre { font-weight: 600; font-size: .93rem; margin: 12px 0 2px; }
.cases { display: flex; flex-wrap: wrap; gap: 4px 18px; }
.cases .choix { margin-top: 4px; }

/* Lignes répétées : FAQ, catalogue, promotions */
.lignes { display: grid; gap: 10px; }
.ligne { display: grid; gap: 6px; padding-bottom: 10px; border-bottom: 1px dashed var(--filet); }
.ligne-produit { grid-template-columns: 1fr; }
.ligne-promo { grid-template-columns: 1fr; }
.ligne.terminee input { color: var(--gris); text-decoration: line-through; }
.bouton.petit { padding: 7px 12px; min-height: 36px; font-size: .88rem; justify-self: start; }
.formulaire .bouton.petit { margin-top: 4px; }

/* Options */
.option { border: 1px solid var(--filet); border-radius: 10px; padding: 12px; display: grid; gap: 6px; }
.interrupteur { font-size: 1rem; }
.option-corps { display: grid; gap: 6px; }
.option-corps[hidden] { display: none; }
.planning { display: grid; gap: 6px; }
.jour { display: grid; grid-template-columns: 1fr auto auto auto; align-items: center; gap: 8px; }
.jour .choix { margin: 0; }
.jour input[type=time] { width: auto; min-width: 104px; }

/* Bouton d'enregistrement toujours à portée de pouce */
.barre-enregistrer { position: sticky; bottom: 0; background: linear-gradient(transparent, var(--fond) 30%); padding: 16px 0 8px; }
.barre-enregistrer .bouton { width: 100%; margin: 0; }

/* Jauge de la fiche */
progress.jauge { width: 100%; height: 10px; border: 0; border-radius: 999px; background: var(--filet); overflow: hidden; appearance: none; }
progress.jauge::-webkit-progress-bar { background: var(--filet); border-radius: 999px; }
progress.jauge::-webkit-progress-value { background: var(--or); border-radius: 999px; }
progress.jauge::-moz-progress-bar { background: var(--or); border-radius: 999px; }

h3 { font-family: 'Sora', 'Inter', sans-serif; color: var(--nuit); font-size: 1rem; margin: 16px 0 6px; }
.catalogue { list-style: none; margin: 0; padding: 0; }
.catalogue li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--filet); }
.catalogue li:first-child { border-top: 0; }
.catalogue form { margin: 0; }
.catalogue .en-rupture strong { color: var(--gris); text-decoration: line-through; }

@media (min-width: 640px) {
  .ligne-produit { grid-template-columns: 2fr 3fr 1fr auto; align-items: center; }
  .ligne-promo { grid-template-columns: 3fr 1fr auto; align-items: center; }
  .barre-enregistrer .bouton { width: auto; }
}

/* Un bouton bloqué doit en avoir l'air (sauf le mode actif, qui est simplement « enfoncé »). */
.bouton[disabled]:not([aria-pressed="true"]) { opacity: .4; cursor: not-allowed; border-style: dashed; }

.bulle.bilan { align-self: stretch; max-width: 100%; line-height: 1.6; padding: 14px 16px; }
.note-confidentiel { background: #EEF3F9; border-color: #C9D6E6; color: var(--nuit); }
