/* stats.clients-prod.fr — habillage ADN PAPER : noir chaud, cuivre, empreinte. Sans compilation. */
@font-face { font-family: "Jost"; font-weight: 300 700; font-display: swap; src: url(fonts/jost-300-700-normal-latin.woff2) format("woff2"); }
@font-face { font-family: "Cormorant Garamond"; font-weight: 500; font-display: swap; src: url(fonts/cormorant-garamond-500-normal-latin.woff2) format("woff2"); }

:root {
	--bg: #100f0e; --panel: #1b1917; --panel-2: #23201d; --line: #2e2a27; --line-2: #3d3833;
	--ink: #f4efe8; --ink-2: #cfc7bd; --muted: #a39b91;
	--copper: #e0a061; --copper-2: #c8864a; --rose: #d8817b; --gold: #e29c43;
	--ok: #9fd08a; --ko: #f0997b;
	--serif: "Cormorant Garamond", Georgia, serif; --sans: "Jost", system-ui, -apple-system, "Segoe UI", sans-serif;
	--r: 14px;
	color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font: 400 15px/1.55 var(--sans); -webkit-font-smoothing: antialiased; }
a { color: var(--copper); }
button, input, select { font: inherit; color: inherit; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }

.app { max-width: 1280px; margin: 0 auto; padding: 20px clamp(14px, 3vw, 32px) 40px; }

/* En-tête */
.top { display: flex; justify-content: space-between; align-items: center; gap: 14px; flex-wrap: wrap; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 12px; }
.brand img { border-radius: 10px; }
.brand__name { font-family: var(--serif); font-size: 1.45rem; letter-spacing: .2em; line-height: 1; }
.brand__name b { font-weight: 500; color: var(--copper); }
.brand__sub { font-size: .7rem; letter-spacing: .18em; text-transform: uppercase; color: var(--muted); margin-top: 4px; }
.brand--big .brand__name { font-size: 2rem; }
.top__right { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.top__right form { margin: 0; }
.who { color: var(--ink-2); font-size: .9rem; }
.live { display: inline-flex; align-items: center; gap: 8px; font-size: .85rem; color: var(--ok); }
.live i { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 0 rgba(159, 208, 138, .6); animation: pulse 2s infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 8px rgba(159, 208, 138, 0); } 100% { box-shadow: 0 0 0 0 rgba(159, 208, 138, 0); } }
@media (prefers-reduced-motion: reduce) { .live i { animation: none; } }

.btn { border: 1px solid var(--line-2); background: transparent; border-radius: 10px; padding: 7px 14px; cursor: pointer; font-size: .88rem; }
.btn:hover { border-color: var(--copper); }
.btn--ghost { color: var(--muted); }
.btn--copper { background: var(--copper); color: #1a120a; border-color: var(--copper); font-weight: 500; padding: 11px 16px; }
.btn--copper:hover { background: var(--gold); }
:focus-visible { outline: 2px solid var(--copper); outline-offset: 2px; }

/* Filtres */
.controls { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 18px 0 16px; }
.select select { background: var(--panel); border: 1px solid var(--line-2); border-radius: 10px; height: 38px; padding: 0 34px 0 12px; min-width: 220px; appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 18px) 16px, calc(100% - 13px) 16px; background-size: 5px 5px; background-repeat: no-repeat; }
.seg { display: inline-flex; background: var(--panel); border: 1px solid var(--line-2); border-radius: 10px; padding: 3px; }
.seg button { border: 0; background: none; color: var(--muted); padding: 6px 14px; border-radius: 7px; cursor: pointer; font-size: .9rem; }
.seg button.on { background: var(--copper); color: #1a120a; }
.controls__title { color: var(--muted); font-size: .88rem; margin-left: auto; }

/* Chiffres clés */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 14px; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; }
.kpi__label { color: var(--muted); font-size: .8rem; letter-spacing: .02em; }
.kpi__value { font-family: var(--serif); font-size: 2.35rem; line-height: 1.05; margin: 6px 0 4px; font-variant-numeric: lining-nums tabular-nums; }
.kpi--hero .kpi__value { color: var(--copper); }
.delta { font-size: .78rem; }
.delta.up { color: var(--ok); } .delta.down { color: var(--ko); } .delta.flat { color: var(--muted); }

/* Panneaux */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 16px 18px; margin-bottom: 14px; min-width: 0; }
.panel__head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 10px; }
.panel h2 { font-family: var(--serif); font-weight: 500; font-size: 1.3rem; margin: 0; letter-spacing: .01em; }
.hint, .legend { color: var(--muted); font-size: .78rem; }
.legend i { display: inline-block; width: 16px; vertical-align: middle; margin: 0 4px 0 10px; border-top: 2px solid var(--copper); }
.legend i.l-prev { border-top: 2px dashed #6b635b; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr)); gap: 0 14px; }
#p-sites:not([hidden]) { grid-column: 1 / -1; }
.chart { height: 260px; }
.empty { color: var(--muted); font-size: .9rem; padding: 10px 0; }

/* Listes et barres */
.rows { display: grid; }
.row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: .92rem; align-items: center; }
.row:last-child { border-bottom: 0; }
.row__label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row__num { color: var(--ink-2); font-variant-numeric: tabular-nums; }
.row__bar { grid-column: 1 / -1; height: 5px; border-radius: 3px; background: var(--line); margin-top: -2px; }
.row__bar i { display: block; height: 100%; border-radius: 3px; background: linear-gradient(90deg, var(--rose), var(--gold)); }
.tag { font-size: .7rem; letter-spacing: .06em; text-transform: uppercase; color: var(--copper); border: 1px solid var(--line-2); border-radius: 6px; padding: 1px 6px; margin-right: 8px; }

/* Tableau des sites */
.tbl { width: 100%; border-collapse: collapse; font-size: .92rem; }
.tbl th { text-align: left; font-weight: 400; color: var(--muted); font-size: .76rem; letter-spacing: .04em; padding: 6px 8px; border-bottom: 1px solid var(--line); }
.tbl td { padding: 10px 8px; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.tbl tr[data-site] { cursor: pointer; }
.tbl tr[data-site]:hover td { background: var(--panel-2); }
.tbl .n { text-align: right; }
.twrap { overflow-x: auto; }

/* Appareils */
.devices { display: flex; height: 14px; border-radius: 7px; overflow: hidden; background: var(--line); margin: 6px 0 12px; }
.devices i:nth-child(1) { background: var(--copper); } .devices i:nth-child(2) { background: var(--rose); } .devices i:nth-child(3) { background: #8a7f73; }
.dev-legend { display: flex; flex-wrap: wrap; gap: 8px 18px; font-size: .9rem; }
.dev-legend span::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 7px; vertical-align: -1px; background: var(--c); }

/* Courbe (uPlot) */
.uplot, .u-wrap { font-family: var(--sans); }
.u-legend { display: none; }
.tip { position: absolute; pointer-events: none; background: #0b0a09; border: 1px solid var(--line-2); border-radius: 8px; padding: 6px 10px; font-size: .8rem; white-space: nowrap; z-index: 5; }

.foot { margin-top: 26px; padding-top: 16px; border-top: 1px solid var(--line); display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; color: var(--muted); font-size: .8rem; }
.foot p { margin: 0; }

/* Connexion */
.login { display: grid; place-items: center; min-height: 100vh; padding: 20px; }
.login__box { width: min(400px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 28px; display: grid; gap: 18px; }
.login__form { display: grid; gap: 14px; }
.login__form label { display: grid; gap: 6px; font-size: .85rem; color: var(--ink-2); }
.login__form input { background: var(--bg); border: 1px solid var(--line-2); border-radius: 10px; height: 42px; padding: 0 12px; }
.login__error { color: var(--ko); margin: 0; font-size: .9rem; }
.login__note { color: var(--muted); font-size: .82rem; margin: 0; }

@media (max-width: 640px) {
	.controls__title { margin-left: 0; width: 100%; }
	.select select { min-width: 0; width: 100%; }
	.select { flex: 1 1 100%; }
	.kpi__value { font-size: 2rem; }
	.chart { height: 210px; }
}
