/* ================= Étape 13 ter : thème clair, graphiques, filtres ================= */
:root{--chart:color-mix(in srgb,var(--accent) 60%,#fff)}
/* ---------- Thème clair ---------- */
html[data-theme=light]{
  --bg:#f4f6fb;--panel:#ffffff;--line:#dfe3ec;
  --text:#151a26;--muted:#5d6678;--ok:#0f9d63;--err:#c62828;--gold:#d99a00;
  color-scheme:light;
}
html[data-theme=light] body{--chart:var(--accent);
  background-image:radial-gradient(120% 55% at 50% -10%,color-mix(in srgb,var(--accent) 16%,transparent),transparent 70%)}
html[data-theme=light] input:not([type=checkbox]):not([type=color]),
html[data-theme=light] select,html[data-theme=light] textarea,
html[data-theme=light] input[type=color]{background:#fff}
/* liens bleus, SANS priorité : les boutons (.btn, .nav-btn…) gardent leur propre couleur */
:where(html[data-theme=light]) a,:where(html[data-theme=light]) .link{color:#2457c5}
html[data-theme=light] .error{background:#fdecec;border-color:#f3c4c4}
html[data-theme=light] .btn{box-shadow:0 4px 12px #0002,inset 0 1px 0 #ffffff26}
html[data-theme=light] .btn.ghost{box-shadow:none}
html[data-theme=light] .panel,html[data-theme=light] .kpi{box-shadow:0 1px 3px #0000000d}
/* menu : le survol ne touche plus l'élément actif */
html[data-theme=light] .nav-btn:not(.active):hover{background:#0000000a;color:var(--text)}
html[data-theme=light] .data th{background:#00000005}
html[data-theme=light] .data tbody tr:hover{background:#00000006}
html[data-theme=light] .chip b,html[data-theme=light] .tag,html[data-theme=light] .seg{background:#0000000b}
html[data-theme=light] .tag.risk{background:#d99a0022}
html[data-theme=light] .tag.lost{background:#c6282818}
html[data-theme=light] .tag.regular{background:#0f9d6318}
html[data-theme=light] .tag.new{background:#2457c518;color:#2457c5}
html[data-theme=light] .seg-new{color:#2457c5}
html[data-theme=light] .phone{background:#e8ecf4;box-shadow:0 12px 30px #0002}
html[data-theme=light] .toast{border:1px solid var(--line)}
html[data-theme=light] dialog.sheet{box-shadow:0 30px 80px #0004}
html[data-theme=light] dialog.sheet::backdrop{background:#0006}
html[data-theme=light] .stamp.gift.on{color:#1b1e26}
/* la carte de fidélité garde son look « carte » (fond foncé) */
html[data-theme=light] .loyalty-card{--text:#f3f4f7;--muted:#c9cfdb;color:#f3f4f7;box-shadow:0 14px 34px #0003}
/* ---------- Bouton thème ---------- */
.theme-btn{position:fixed;bottom:calc(16px + env(safe-area-inset-bottom));inset-inline-end:16px;z-index:60;
  width:44px;height:44px;border-radius:999px;border:1px solid var(--line);background:var(--panel);color:var(--text);
  display:grid;place-items:center;cursor:pointer;box-shadow:0 6px 18px #0004}
.theme-btn .i{margin:0}
.head-links .link{display:inline-flex;align-items:center}
/* ---------- Graphiques ---------- */
.chart .bar{background:var(--chart)}
.chart .bar.zero{background:var(--line)}
.chart.short{height:150px}
.svg-chart{display:block;width:100%;height:auto;margin-top:4px}
.svg-chart .grid{stroke:var(--line);stroke-width:1}
.svg-chart .ax{fill:var(--muted);font-size:11px;font-family:system-ui,-apple-system,"Segoe UI",Roboto,sans-serif}
.svg-chart .line{fill:none;stroke-width:2.5;stroke-linejoin:round;stroke-linecap:round}
.svg-chart .line.s1{stroke:var(--chart)}
.svg-chart .line.s2{stroke:var(--ok);stroke-dasharray:6 5}
.svg-chart .area{stroke:none;fill:var(--chart);opacity:.16}
.svg-chart .hit{fill:transparent}
.svg-chart .hit:hover{fill:color-mix(in srgb,var(--text) 7%,transparent)}
.legend{display:flex;gap:16px;flex-wrap:wrap;font-size:.85rem;color:var(--muted);margin:2px 0 4px}
.legend i{display:inline-block;width:14px;height:3px;border-radius:2px;margin-inline-end:6px;vertical-align:middle;background:var(--chart)}
.legend i.s2{background:var(--ok)}
/* anneau (segments) */
.donut-wrap{display:flex;gap:22px;align-items:center;flex-wrap:wrap}
.donut{width:170px;flex:none}
.donut svg{display:block;width:100%;height:auto}
.donut circle{fill:none;stroke-width:22}
.donut .bg{stroke:var(--line)}
.donut text{fill:var(--text);font-weight:700;font-size:26px}
.donut .t2{fill:var(--muted);font-size:11px;font-weight:400}
.donut-legend{list-style:none;margin:0;padding:0;display:grid;gap:8px;flex:1;min-width:180px}
.donut-legend li{display:flex;gap:8px;align-items:center;font-size:.9rem}
.donut-legend i{width:10px;height:10px;border-radius:3px;flex:none}
.c-new{stroke:#6ea8fe;background:#6ea8fe}
.c-regular{stroke:var(--ok);background:var(--ok)}
.c-active{stroke:var(--chart);background:var(--chart)}
.c-risk{stroke:var(--gold);background:var(--gold)}
.c-lost{stroke:var(--err);background:var(--err)}
/* barres horizontales (admin) */
.hbars{list-style:none;margin:0;padding:0;display:grid;gap:12px}
.hbars li{display:grid;grid-template-columns:minmax(80px,160px) 1fr auto;gap:10px;align-items:center;font-size:.9rem}
.hb-label{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.hb-track{height:10px;border-radius:999px;background:var(--line);overflow:hidden}
.hb-track i{display:block;height:100%;border-radius:999px;background:var(--chart)}
/* grilles du tableau de bord */
.dash-grid{display:grid;grid-template-columns:1fr 1fr;gap:18px}
.dash-grid.wide{grid-template-columns:2fr 1fr}
.pro .kpis.five{grid-template-columns:repeat(5,1fr)}
button.kpi{font:inherit;color:inherit;text-align:start;cursor:pointer;transition:border-color .15s}
button.kpi:hover{border-color:var(--accent)}
button.kpi span{color:var(--muted)}
/* ---------- Filtres + pagination ---------- */
.filters{display:grid;grid-template-columns:repeat(3,minmax(0,1fr)) minmax(0,1.4fr);gap:10px;margin:4px 0 12px}
.filters input:not([type=checkbox]),.filters select{padding:10px 12px;font-size:.92rem}
.pager{display:flex;justify-content:space-between;align-items:center;gap:10px;margin-top:12px}
.pager .btn.sm{min-width:120px}
/* ---------- Sous-onglets (Promos) ---------- */
.subtabs{display:inline-flex;flex-wrap:wrap;gap:4px;background:var(--panel);border:1px solid var(--line);padding:4px;border-radius:12px;margin-bottom:16px}
.subtab{display:inline-flex;align-items:center;background:none;border:0;color:var(--muted);padding:9px 14px;border-radius:9px;
  font:inherit;font-weight:600;cursor:pointer;transition:background .15s,color .15s}
.subtab .i{margin-inline-end:.4em}
.subtab.active{background:var(--accent);color:#fff}
.subview > .panel:first-child{margin-top:0}
@media (max-width:1100px){.pro .kpis.five{grid-template-columns:repeat(3,1fr)}}
@media (max-width:900px){
  .dash-grid,.dash-grid.wide{grid-template-columns:1fr}
  .pro .kpis.five{grid-template-columns:1fr 1fr}
  .filters{grid-template-columns:1fr 1fr}
  .pager .btn.sm{min-width:0}
}
@media print{.theme-btn{display:none!important}}
/* ---------- Correctifs thème clair : éléments sur fond couleur = texte blanc ---------- */
html[data-theme=light] .nav-btn.active,
html[data-theme=light] .nav-btn.active:hover,
html[data-theme=light] .side a.nav-btn.active{background:var(--accent);color:#fff}
html[data-theme=light] .btn:not(.ghost):not(.gold){color:#fff}
html[data-theme=light] .btn.ghost{color:var(--text)}
html[data-theme=light] .chip.active,
html[data-theme=light] .day-chip input:checked + span{color:#fff}
html[data-theme=light] .chip.active b{background:#ffffff33}
