/* Plateforme PDV Care — thème inspiré du modèle de design fourni */
:root {
  --navy-900: #071B3F;
  --navy-800: #0B2A5B;
  --navy-700: #123A7A;
  --bleu: #1E6FD9;
  --bleu-clair: #E8F1FD;
  --vert: #22B07D;
  --vert-clair: #E6F7F0;
  --orange: #F5A524;
  --orange-clair: #FEF4E3;
  --violet: #8B5CF6;
  --violet-clair: #F1ECFE;
  --rouge: #EF4444;
  --rouge-clair: #FDECEC;
  --gris: #64748B;
  --gris-clair: #F1F4F9;
  --fond: #F4F7FC;
  --texte: #0F1E3A;
  --texte-doux: #5B6B86;
  --bord: #E6EBF3;
  --rayon: 14px;
  --ombre: 0 1px 2px rgba(16, 38, 84, .04), 0 4px 16px rgba(16, 38, 84, .05);
  --sidebar: 240px;
}

* { box-sizing: border-box; }
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;
}
a { color: var(--bleu); text-decoration: none; }
a:hover { color: var(--navy-700); }
h1, h2, h3, h4, h5 { font-family: "Poppins", "Inter", sans-serif; color: var(--navy-800); }

/* ---------- Barre latérale ---------- */
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar); z-index: 1040;
  background: linear-gradient(180deg, var(--navy-800) 0%, var(--navy-900) 100%);
  color: #fff; display: flex; flex-direction: column; padding: 18px 14px;
  transition: transform .25s ease;
}
.sidebar .marque { display: flex; align-items: center; gap: 10px; padding: 4px 8px 22px; color: #fff; }
.sidebar .marque .logo {
  width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center;
  background: linear-gradient(135deg, #2F80ED, #1E6FD9); font-size: 22px; box-shadow: 0 6px 14px rgba(30, 111, 217, .35);
}
.sidebar .marque .nom { font-family: "Poppins", sans-serif; font-weight: 700; font-size: 19px; line-height: 1.1; }
.sidebar .marque .nom span { color: #6FB1FF; }
.sidebar .marque small { display: block; color: #A9BCDD; font-size: 11px; font-weight: 400; margin-top: 3px; font-family: "Inter", sans-serif; line-height: 1.35; letter-spacing: 0; }
.sidebar nav { flex: 1; overflow-y: auto; }
.sidebar .section { color: #7F95BE; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; padding: 14px 12px 6px; }
.sidebar .lien {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; margin-bottom: 3px;
  color: #DCE6F7; border-radius: 10px; font-weight: 500; transition: background .15s, color .15s;
}
.sidebar .lien i { font-size: 17px; width: 20px; text-align: center; }
.sidebar .lien:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.sidebar .lien.actif { background: #fff; color: var(--navy-800); box-shadow: 0 4px 14px rgba(0, 0, 0, .15); }
.sidebar .lien.actif i { color: var(--bleu); }
.sidebar .lien .pastille { margin-left: auto; background: var(--orange); color: #fff; font-size: 11px; border-radius: 20px; padding: 1px 8px; font-weight: 600; }
.sidebar .citation {
  margin-top: 14px; padding: 16px; border-radius: 14px; background: rgba(255, 255, 255, .06);
  border: 1px solid rgba(255, 255, 255, .08); font-size: 12.5px; color: #DCE6F7; line-height: 1.5;
}
.sidebar .citation i { color: #6FB1FF; font-size: 20px; }
.sidebar .citation strong { color: #fff; }

/* ---------- Zone principale ---------- */
.principal { margin-left: var(--sidebar); min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 1030; background: rgba(255, 255, 255, .92); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--bord); padding: 12px 28px; display: flex; align-items: center; gap: 18px;
}
.topbar .recherche { flex: 1; max-width: 520px; position: relative; }
.topbar .recherche input {
  width: 100%; border: 1px solid var(--bord); background: var(--gris-clair); border-radius: 10px;
  padding: 9px 14px 9px 38px; font-size: 13.5px; outline: none;
}
.topbar .recherche input:focus { border-color: var(--bleu); background: #fff; }
.topbar .recherche i { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--texte-doux); }
.topbar .actions { margin-left: auto; display: flex; align-items: center; gap: 18px; }
.cloche { position: relative; font-size: 20px; color: var(--navy-800); }
.cloche .compteur {
  position: absolute; top: -6px; right: -8px; background: var(--rouge); color: #fff; font-size: 10px;
  min-width: 18px; height: 18px; border-radius: 9px; display: grid; place-items: center; font-weight: 700; border: 2px solid #fff;
}
.profil { display: flex; align-items: center; gap: 10px; color: var(--texte); }
.avatar {
  width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; color: #fff;
  background: linear-gradient(135deg, var(--bleu), var(--violet)); font-size: 13px;
}
.profil .nom { font-weight: 600; font-size: 13.5px; line-height: 1.2; }
.profil .role { font-size: 12px; color: var(--texte-doux); }
.organisation { display: flex; align-items: center; gap: 8px; padding-left: 18px; border-left: 1px solid var(--bord); }
.organisation i { font-size: 22px; color: var(--navy-800); }
.organisation div { font-size: 12px; line-height: 1.25; font-weight: 600; color: var(--navy-800); }
.organisation small { display: block; font-weight: 400; color: var(--texte-doux); }
.contenu { padding: 24px 28px 12px; flex: 1; }
.pied { padding: 14px 28px; font-size: 12px; color: var(--texte-doux); display: flex; justify-content: space-between; border-top: 1px solid var(--bord); background: #fff; }
.bouton-menu { display: none; border: 0; background: none; font-size: 24px; color: var(--navy-800); }

/* ---------- Cartes ---------- */
.carte { background: #fff; border-radius: var(--rayon); box-shadow: var(--ombre); border: 1px solid var(--bord); padding: 20px; height: 100%; }
.carte-titre { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; gap: 10px; }
.carte-titre h3 { font-size: 15px; font-weight: 600; margin: 0; display: flex; align-items: center; gap: 8px; }
.carte-titre h3 i { color: var(--bleu); }
.carte-titre a, .lien-discret { font-size: 12.5px; font-weight: 500; }

.bandeau {
  border-radius: var(--rayon); padding: 26px 30px; position: relative; overflow: hidden; height: 100%;
  background: linear-gradient(110deg, #EAF3FF 0%, #F5F9FF 55%, #E3EEFF 100%); border: 1px solid #DCE8FB;
}
.bandeau h1 { font-size: 26px; font-weight: 700; margin-bottom: 6px; }
.bandeau p { color: var(--texte-doux); margin-bottom: 16px; max-width: 460px; }
.bandeau .pilule {
  display: inline-flex; align-items: center; gap: 8px; background: #fff; border-radius: 30px; padding: 8px 16px;
  font-size: 12.5px; color: var(--navy-700); font-style: italic; box-shadow: var(--ombre);
}
.bandeau .illustration { position: absolute; right: 12px; bottom: 0; height: 100%; max-height: 170px; opacity: .98; }

.info-carte { display: flex; align-items: center; gap: 14px; }
.info-carte .icone { width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; font-size: 20px; }
.info-carte .libelle { font-size: 12.5px; color: var(--texte-doux); }
.info-carte .valeur { font-weight: 700; color: var(--navy-800); font-size: 15px; }

.kpi { display: flex; flex-direction: column; gap: 10px; }
.kpi .tete { display: flex; align-items: center; gap: 12px; }
.kpi .icone { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; font-size: 19px; color: #fff; flex-shrink: 0; }
.kpi .titre { font-size: 13px; color: var(--texte-doux); font-weight: 500; }
.kpi .valeur { font-size: 28px; font-weight: 700; color: var(--navy-800); font-family: "Poppins", sans-serif; line-height: 1; }
.kpi .variation { font-size: 12px; font-weight: 600; margin-left: 8px; }
.kpi .legende { font-size: 12px; color: var(--texte-doux); }

.bleu .icone, .icone.bleu { background: var(--bleu); }
.vert .icone, .icone.vert { background: var(--vert); }
.orange .icone, .icone.orange { background: var(--orange); }
.violet .icone, .icone.violet { background: var(--violet); }
.rouge .icone, .icone.rouge { background: var(--rouge); }
.gris .icone, .icone.gris { background: var(--gris); }
.kpi.bleu { background: linear-gradient(180deg, #fff 60%, var(--bleu-clair)); }
.kpi.vert { background: linear-gradient(180deg, #fff 60%, var(--vert-clair)); }
.kpi.orange { background: linear-gradient(180deg, #fff 60%, var(--orange-clair)); }
.kpi.violet { background: linear-gradient(180deg, #fff 60%, var(--violet-clair)); }
.kpi.rouge { background: linear-gradient(180deg, #fff 60%, var(--rouge-clair)); }
.icone-douce { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; font-size: 18px; flex-shrink: 0; }
.icone-douce.bleu { background: var(--bleu-clair); color: var(--bleu); }
.icone-douce.vert { background: var(--vert-clair); color: var(--vert); }
.icone-douce.orange { background: var(--orange-clair); color: #C77F06; }
.icone-douce.violet { background: var(--violet-clair); color: var(--violet); }
.icone-douce.rouge { background: var(--rouge-clair); color: var(--rouge); }
.icone-douce.gris { background: var(--gris-clair); color: var(--gris); }

/* Activités */
.activite { display: flex; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--bord); }
.activite:last-child { border-bottom: 0; }
.activite .quoi { font-weight: 600; font-size: 13px; color: var(--navy-800); }
.activite .detail { font-size: 12px; color: var(--texte-doux); }
.activite .quand { margin-left: auto; font-size: 11px; color: var(--texte-doux); white-space: nowrap; flex-shrink: 0; padding-left: 6px; }
.min-w-0 { min-width: 0; }

/* Donut légende */
.legende-donut .item { display: flex; align-items: center; gap: 8px; font-size: 12.5px; padding: 4px 0; }
.legende-donut .puce { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.legende-donut .n { margin-left: auto; font-weight: 600; color: var(--navy-800); }
.legende-donut .pct { width: 40px; text-align: right; color: var(--texte-doux); white-space: nowrap; flex-shrink: 0; }
.legende-donut .item > span:nth-child(2) { min-width: 0; }
.donut-centre { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; text-align: center; }
.donut-centre strong { font-size: 26px; font-family: "Poppins", sans-serif; color: var(--navy-800); display: block; line-height: 1; }
.donut-centre span { font-size: 12px; color: var(--texte-doux); }

/* Tableaux */
.table-pdv { margin: 0; font-size: 13px; }
.table-pdv thead th {
  font-size: 11.5px; text-transform: uppercase; letter-spacing: .03em; color: var(--texte-doux); font-weight: 600;
  background: var(--gris-clair); border-bottom: 0; padding: 10px 12px; white-space: nowrap;
}
.table-pdv thead th:first-child { border-radius: 8px 0 0 8px; }
.table-pdv thead th:last-child { border-radius: 0 8px 8px 0; }
.table-pdv td { padding: 11px 12px; vertical-align: middle; border-color: var(--bord); }
.table-pdv tbody tr:hover { background: #FAFCFF; }
.table-pdv .ref { font-weight: 600; color: var(--navy-800); white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.table-pdv tr.retourne td { color: var(--texte-doux); background: #FFFBF2; }
.table-pdv tfoot td { font-weight: 700; background: var(--bleu-clair); border: 0; }

/* Badges */
.etiquette { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 600; padding: 4px 10px; border-radius: 20px; white-space: nowrap; }
.etiquette.info { background: var(--bleu-clair); color: var(--bleu); }
.etiquette.warning { background: var(--orange-clair); color: #B06F00; }
.etiquette.success { background: var(--vert-clair); color: #15855D; }
.etiquette.danger { background: var(--rouge-clair); color: #C62828; }
.etiquette.primary { background: var(--violet-clair); color: #6D3FE0; }
.etiquette.secondary { background: var(--gris-clair); color: var(--gris); }
.etiquette.light { background: transparent; color: var(--texte-doux); }

/* Onglets */
.onglets { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.onglets a {
  padding: 8px 16px; border-radius: 10px; font-weight: 500; color: var(--texte-doux); background: #fff; border: 1px solid var(--bord);
}
.onglets a.actif { background: var(--navy-800); color: #fff; border-color: var(--navy-800); }
.onglets a .n { font-size: 11px; margin-left: 6px; opacity: .8; }

/* Formulaires */
.form-label { font-weight: 500; font-size: 13px; color: var(--navy-800); margin-bottom: 5px; }
.form-control, .form-select { border-radius: 10px; border-color: var(--bord); font-size: 13.5px; padding: 8px 12px; }
.form-control:focus, .form-select:focus { border-color: var(--bleu); box-shadow: 0 0 0 3px rgba(30, 111, 217, .12); }
.form-text { font-size: 12px; }
.btn { border-radius: 10px; font-weight: 500; font-size: 13.5px; padding: 8px 16px; }
.btn-primary { background: var(--bleu); border-color: var(--bleu); }
.btn-primary:hover { background: var(--navy-700); border-color: var(--navy-700); }
.btn-navy { background: var(--navy-800); color: #fff; }
.btn-navy:hover { background: var(--navy-900); color: #fff; }
.btn-light { background: #fff; border: 1px solid var(--bord); }
.filtres { background: #fff; border: 1px solid var(--bord); border-radius: var(--rayon); padding: 16px; margin-bottom: 16px; box-shadow: var(--ombre); }
.filtres .form-control, .filtres .form-select { font-size: 13px; padding: 7px 10px; }
.errorlist { list-style: none; padding: 0; margin: 4px 0 0; color: var(--rouge); font-size: 12px; }
.case-notifier {
  display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: 12px;
  background: #F0FBF5; border: 1px solid #C9EEDB;
}
.case-notifier i { color: #25D366; font-size: 22px; }
.case-notifier .form-check-input { width: 1.2em; height: 1.2em; }

/* En-tête de page */
.entete-page { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.entete-page h1 { font-size: 22px; font-weight: 700; margin: 0; }
.entete-page .sous-titre { color: var(--texte-doux); font-size: 13px; margin-top: 2px; }
.fil { font-size: 12.5px; color: var(--texte-doux); margin-bottom: 4px; }

/* Chronologie */
.chrono { position: relative; padding-left: 22px; }
.chrono::before { content: ""; position: absolute; left: 7px; top: 4px; bottom: 4px; width: 2px; background: var(--bord); }
.chrono .point { position: relative; padding-bottom: 14px; }
.chrono .point::before {
  content: ""; position: absolute; left: -19px; top: 4px; width: 10px; height: 10px; border-radius: 50%;
  background: #fff; border: 2px solid var(--bleu);
}
.chrono .point .quoi { font-weight: 600; font-size: 13px; }
.chrono .point .meta { font-size: 12px; color: var(--texte-doux); }

/* Carte promotionnelle */
.promo {
  border-radius: var(--rayon); padding: 22px; color: #fff; position: relative; overflow: hidden; height: 100%;
  background: radial-gradient(circle at 85% 20%, rgba(111, 177, 255, .35), transparent 45%), linear-gradient(135deg, var(--navy-800), var(--navy-900));
}
.promo h3 { color: #fff; font-size: 18px; font-weight: 700; line-height: 1.3; }
.promo p { color: #C6D4EC; font-size: 12.5px; }
.promo .grand { font-size: 30px; font-weight: 700; font-family: "Poppins", sans-serif; }

.messages-flash { position: fixed; top: 76px; right: 24px; z-index: 1080; width: min(440px, calc(100vw - 32px)); }
.messages-flash .alert { border-radius: 12px; box-shadow: 0 10px 30px rgba(16, 38, 84, .14); border: 0; font-size: 13.5px; }

.ligne-pdv { background: var(--gris-clair); border-radius: 12px; padding: 12px; margin-bottom: 10px; position: relative; }
.ligne-pdv .retirer { position: absolute; top: 8px; right: 10px; }
.vide { text-align: center; padding: 40px 10px; color: var(--texte-doux); }
.vide i { font-size: 34px; display: block; margin-bottom: 8px; color: #B6C3D9; }

/* Connexion */
.page-connexion { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.page-connexion .gauche {
  background: radial-gradient(circle at 20% 20%, rgba(111, 177, 255, .25), transparent 40%), linear-gradient(160deg, var(--navy-800), var(--navy-900));
  color: #fff; padding: 48px; display: flex; flex-direction: column; justify-content: space-between;
}
.page-connexion .gauche h2 { color: #fff; font-size: 34px; font-weight: 700; line-height: 1.2; }
.page-connexion .gauche p { color: #C6D4EC; max-width: 440px; }
.page-connexion .droite { display: grid; place-items: center; padding: 32px; }
.page-connexion .boite { width: 100%; max-width: 400px; }

@media (max-width: 1199px) {
  .organisation { display: none; }
}
@media (max-width: 991px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.ouverte { transform: none; box-shadow: 0 0 40px rgba(0, 0, 0, .3); }
  .principal { margin-left: 0; }
  .bouton-menu { display: block; }
  .topbar { padding: 10px 16px; }
  .contenu { padding: 16px; }
  .profil .texte { display: none; }
  .bandeau .illustration { display: none; }
  .page-connexion { grid-template-columns: 1fr; }
  .page-connexion .gauche { display: none; }
}

/* Licence (v3.0) */
.sidebar .lien .badge-menu { margin-left: auto; font-size: 10.5px; font-weight: 700; padding: 2px 7px; border-radius: 999px; background: rgba(255, 255, 255, .14); color: #fff; }
.sidebar .lien.actif .badge-menu { background: var(--bleu-clair); color: var(--navy-800); }
.bandeau-licence { margin: 16px 28px 0; padding: 10px 14px; border-radius: 12px; background: var(--orange-clair); color: #7a4a00; font-size: 13.5px; }
.bandeau-licence a { margin-left: 8px; font-weight: 600; }
.code-licence { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; word-break: break-all; }

/* Ruptures (v3.0) */
.rp { display: inline-block; min-width: 64px; padding: 4px 8px; border-radius: 8px; font-size: 12px; font-weight: 600; text-align: center; }
.rp-rupture { background: #FBE3E4; color: #B42318; }
.rp-alerte { background: #FEF0C7; color: #93370D; }
.rp-normal { background: #DCF5E7; color: #146C43; }
.rp-inconnu { background: #EEF1F5; color: #5B6B86; }
.rp-vide { color: #B6C0D0; }
.rp-inactif { background: #EDE7F6; color: #53389E; }
/* Inactivités (v3.0) */
.ia { display: inline-block; min-width: 76px; padding: 3px 8px; border-radius: 8px; font-size: 12px; font-weight: 600; text-align: center; white-space: nowrap; }
.ia-actif { background: #DCF5E7; color: #146C43; }
.ia-surveillance { background: #FEF0C7; color: #93370D; }
.ia-inactif { background: #FBE3E4; color: #B42318; }
.ia-inconnu { background: #EEF1F5; color: #5B6B86; }
.ia small { font-weight: 500; opacity: .8; }
.matrice-rp th.heure { text-align: center; white-space: nowrap; }
.matrice-rp td.cel { text-align: center; padding: 6px 4px; }
.matrice-rp tfoot td { font-size: 12px; text-align: center; color: var(--texte-doux); }
.legende-rp { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: 12.5px; }
.taux-gros { font-size: 30px; font-weight: 700; font-family: "Poppins", sans-serif; color: var(--navy-800); line-height: 1; }
.matrice-rp tr.groupe-rp td { background: var(--navy-800, #0B2A5B); color: #fff; font-size: 13px; padding: 8px 12px; }
.matrice-rp tr.sous-total-rp td { background: var(--bleu-clair); }

/* Tableau croisé des ruptures */
.croise-rp table { font-size: 12.5px; border-collapse: collapse; }
.croise-rp th, .croise-rp td { border: 1px solid #C9CED8; padding: 4px 6px; }
.croise-rp thead th { background: #111; color: #fff; font-size: 11px; text-transform: uppercase; vertical-align: middle; }
.croise-rp thead th.grp { font-size: 12px; }
.croise-rp .col-lib { min-width: 220px; white-space: nowrap; }
.croise-rp td.total, .croise-rp th.total { border-left: 2px solid #444; font-weight: 700; }
.croise-rp tr.r-entete td { background: #E3E3E3; }
.croise-rp tr.r-entete.p1 td { background: #EFEFEF; }
.croise-rp tr.r-entete.p2 td { background: #F6F6F6; }
.croise-rp tr.p1 td.col-lib { padding-left: 24px; }
.croise-rp tr.p2 td.col-lib { padding-left: 44px; }
.croise-rp tr.p3 td.col-lib { padding-left: 64px; }
.croise-rp tr.r-sous_total td { background: #DCE6F1; font-style: italic; }
.croise-rp tr.r-total td { background: #DCE6F1; font-weight: 700; border-top: 2px solid #444; }
.croise-rp .pli { border: 0; background: none; padding: 0 2px; font-size: 14px; line-height: 1; cursor: pointer; }
.croise-rp .tx { display: inline-block; min-width: 58px; padding: 1px 6px; border-radius: 4px; font-weight: 700; }
.tx { display: inline-block; padding: 1px 6px; border-radius: 4px; font-weight: 700; }
.attr-rp { white-space: nowrap; color: var(--texte-doux); }
.croise-rp .tx-ok { background: #C6EFCE; color: #146C2E; }
.croise-rp .tx-ko { background: #FFC7CE; color: #9C0006; }
.croise-rp .tx-al { background: #FFEB9C; color: #9C5700; }
/* Systèmes de rupture (v3.0) */
.onglets-systemes { display: flex; flex-wrap: wrap; gap: 8px; }
.onglet-sys { display: flex; flex-direction: column; padding: 8px 16px; border-radius: 10px; background: #fff; border: 1px solid #DDE3EC; color: var(--navy-800); font-weight: 600; text-decoration: none; line-height: 1.2; }
.onglet-sys small { font-weight: 500; color: var(--texte-doux); font-size: 11.5px; }
.onglet-sys:hover { border-color: var(--bleu); }
.onglet-sys.actif { background: var(--navy-800); border-color: var(--navy-800); color: #fff; }
.onglet-sys.actif small { color: #C9D4E5; }
.onglet-sys.ajout { justify-content: center; border-style: dashed; color: var(--bleu); font-weight: 500; }
.mention-activite { min-width: 250px; font-size: 12px; padding: 6px 8px; border-radius: 8px; line-height: 1.6; }
.mention-activite.ok { background: #ECFDF3; color: #146C43; }
.mention-activite.ko { background: #F4EFFC; color: #53389E; }
.mention-activite .ia { min-width: 0; padding: 1px 6px; font-size: 11px; }
