@font-face { font-family: "Inter"; font-weight: 400; font-display: swap; src: url(/fonts/inter-latin-400-normal.woff2) format("woff2"); }
@font-face { font-family: "Inter"; font-weight: 500; font-display: swap; src: url(/fonts/inter-latin-500-normal.woff2) format("woff2"); }
@font-face { font-family: "Inter"; font-weight: 600; font-display: swap; src: url(/fonts/inter-latin-600-normal.woff2) format("woff2"); }
@font-face { font-family: "Inter"; font-weight: 700; font-display: swap; src: url(/fonts/inter-latin-700-normal.woff2) format("woff2"); }
@font-face { font-family: "Space Grotesk"; font-weight: 500; font-display: swap; src: url(/fonts/space-grotesk-latin-500-normal.woff2) format("woff2"); }
@font-face { font-family: "Space Grotesk"; font-weight: 600; font-display: swap; src: url(/fonts/space-grotesk-latin-600-normal.woff2) format("woff2"); }
@font-face { font-family: "Space Grotesk"; font-weight: 700; font-display: swap; src: url(/fonts/space-grotesk-latin-700-normal.woff2) format("woff2"); }

:root {
  --black: #0B0B0D;
  --carbon: #161619;
  --carbon-2: #1C1C20;
  --graphite: #292B30;
  --line: #222328;
  --grey: #A7A9AF;
  --grey-2: #7C7F86;
  --white: #FFFFFF;
  --lime: #C6FF00;
  --cyan: #00D9F5;
  --gradient: linear-gradient(135deg, #C6FF00 0%, #00D9F5 100%);
  /* Séries par plateforme (validées : contraste, daltonisme, sur #161619) */
  --p-android: #7FA300;
  --p-ios: #009DB5;
  --p-web: #B07EF2;
  --p-unknown: #4A4C52;
  --warn: #FFB020;
  --bad: #FF5C5C;
  --radius: 14px;
  --font: "Inter", system-ui, -apple-system, Arial, sans-serif;
  --font-h: "Space Grotesk", "Inter", Arial, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--black); color: var(--white); font: 400 14px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; color: inherit; }
h1, h2, h3 { font-family: var(--font-h); font-weight: 600; margin: 0; letter-spacing: -0.01em; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--grey); }
.dim { color: var(--grey-2); }

/* ---------- Connexion ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px;
  background: radial-gradient(900px 500px at 50% -10%, rgba(198,255,0,0.07), transparent 60%), var(--black); }
.login__card { width: 100%; max-width: 380px; text-align: center; }
.login__mark { width: 64px; height: 52px; margin: 0 auto 22px; display: block; }
.login__word { font-family: var(--font-h); font-weight: 500; letter-spacing: 0.55em; font-size: 15px; margin-right: -0.55em; }
.login__rule { width: 36px; height: 2px; background: var(--lime); margin: 14px auto 28px; border-radius: 2px; }
.login__sub { color: var(--grey); margin: 0 0 28px; }
.login form { display: grid; gap: 12px; text-align: left; }
.field { display: grid; gap: 6px; }
.field span { font-size: 12px; color: var(--grey); }
.input { width: 100%; background: var(--carbon); border: 1px solid var(--graphite); border-radius: 10px; padding: 12px 14px; outline: none; transition: border-color .15s; }
.input:focus { border-color: var(--lime); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: 10px; padding: 12px 18px; font-weight: 600; cursor: pointer; transition: transform .1s, opacity .15s; }
.btn:active { transform: scale(0.98); }
.btn--primary { background: var(--lime); color: var(--black); }
.btn--ghost { background: transparent; border: 1px solid #3A3B40; color: var(--white); }
.btn--ghost:hover { border-color: var(--lime); }
.btn[disabled] { opacity: .5; cursor: default; }
.error { color: var(--bad); font-size: 13px; min-height: 18px; margin: 0; }

/* ---------- Structure ---------- */
.shell { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; border-right: 1px solid var(--line); padding: 24px 16px; display: flex; flex-direction: column; gap: 28px; background: var(--black); }
.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px; }
.brand svg { width: 26px; height: 22px; }
.brand__word { font-family: var(--font-h); font-weight: 500; letter-spacing: 0.32em; font-size: 13px; }
.brand__tag { font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--black); background: var(--lime); padding: 2px 6px; border-radius: 4px; font-weight: 700; }
.nav { display: grid; gap: 2px; }
.nav a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; color: var(--grey); font-weight: 500; position: relative; }
.nav a:hover { color: var(--white); background: var(--carbon); }
.nav a.is-active { color: var(--white); background: var(--carbon); }
.nav a.is-active::before { content: ""; position: absolute; left: -16px; top: 10px; bottom: 10px; width: 2px; background: var(--lime); border-radius: 2px; }
.nav svg { width: 18px; height: 18px; flex: none; }
.side__foot { margin-top: auto; display: grid; gap: 10px; padding: 0 8px; }
.who { font-size: 12px; color: var(--grey); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who strong { display: block; color: var(--white); font-weight: 600; font-size: 13px; }
.linkbtn { background: none; border: 0; padding: 0; color: var(--grey); cursor: pointer; font-size: 12px; text-align: left; }
.linkbtn:hover { color: var(--white); }

.main { min-width: 0; padding: 32px 40px 64px; max-width: 1280px; }
.head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 28px; flex-wrap: wrap; }
.head h1 { font-size: 28px; }
.head p { margin: 4px 0 0; color: var(--grey); }
.head__tools { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

.switch { display: inline-flex; align-items: center; gap: 8px; color: var(--grey); font-size: 13px; cursor: pointer; user-select: none; }
.switch input { appearance: none; width: 32px; height: 18px; border-radius: 9px; background: var(--graphite); position: relative; cursor: pointer; transition: background .15s; margin: 0; }
.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 12px; height: 12px; border-radius: 50%; background: var(--white); transition: transform .15s; }
.switch input:checked { background: var(--lime); }
.switch input:checked::after { transform: translateX(14px); background: var(--black); }

/* ---------- Cartes / tuiles ---------- */
.grid { display: grid; gap: 16px; }
.tiles { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); margin-bottom: 16px; }
.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cols-3 { grid-template-columns: 2fr 1fr; }
.card { background: var(--carbon); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; min-width: 0; }
.card + .card, .grid + .card, .card + .grid, .grid + .grid { margin-top: 16px; }
.grid > .card, .grid > .tile { margin-top: 0; }
.cols-3 { align-items: start; }
.card h2 { font-size: 15px; font-weight: 600; }
.card__head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.card__head p { margin: 2px 0 0; color: var(--grey); font-size: 12px; }
.tile { background: var(--carbon); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; position: relative; overflow: hidden; }
.tile__label { font-size: 12px; color: var(--grey); }
.tile__value { font-family: var(--font-h); font-size: 30px; font-weight: 600; line-height: 1.15; margin-top: 6px; font-variant-numeric: tabular-nums; }
.tile__value small { font-size: 15px; color: var(--grey); font-weight: 500; margin-left: 2px; }
.tile__note { font-size: 12px; color: var(--grey-2); margin-top: 4px; }
.tile--accent::after { content: ""; position: absolute; left: 20px; right: 20px; bottom: 0; height: 2px; background: var(--gradient); border-radius: 2px; }
.dot-live { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--lime); margin-right: 8px; vertical-align: middle; box-shadow: 0 0 0 4px rgba(198,255,0,.12); }

/* ---------- Légende ---------- */
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12px; color: var(--grey); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.sw { width: 10px; height: 10px; border-radius: 3px; display: inline-block; flex: none; }

/* ---------- Barres de répartition ---------- */
.split { display: grid; gap: 14px; }
.split__row { display: grid; grid-template-columns: 110px 1fr 44px; gap: 12px; align-items: center; font-size: 13px; }
.split__name { display: flex; align-items: center; gap: 8px; color: var(--white); }
.split__track { height: 10px; background: var(--black); border-radius: 0 4px 4px 0; overflow: hidden; }
.split__bar { height: 100%; border-radius: 0 4px 4px 0; min-width: 2px; }
.split__val { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- Graphiques ---------- */
.chart { width: 100%; display: block; overflow: visible; }
.chart text { fill: var(--grey-2); font: 11px var(--font); font-variant-numeric: tabular-nums; }
.chart .grid-l { stroke: var(--line); stroke-width: 1; }
.chart .hit { fill: transparent; cursor: default; }
.chart .hit:hover + .hl, .chart .col.is-hover { opacity: 1; }
.chart .hover-band { fill: rgba(255,255,255,0.04); }
.empty { display: grid; place-items: center; text-align: center; color: var(--grey); padding: 36px 16px; font-size: 13px; border: 1px dashed var(--graphite); border-radius: 10px; }
.empty strong { display: block; color: var(--white); font-weight: 600; margin-bottom: 4px; }
.tip { position: fixed; z-index: 50; pointer-events: none; background: #0F0F12; border: 1px solid var(--graphite); border-radius: 8px; padding: 8px 10px; font-size: 12px; box-shadow: 0 8px 24px rgba(0,0,0,.5); min-width: 120px; }
.tip b { display: block; font-weight: 600; margin-bottom: 4px; }
.tip div { display: flex; align-items: center; gap: 6px; justify-content: space-between; }
.tip div span:first-child { display: inline-flex; align-items: center; gap: 6px; color: var(--grey); }
.toggle-table { background: none; border: 0; color: var(--grey); font-size: 12px; cursor: pointer; padding: 0; }
.toggle-table:hover { color: var(--white); }

/* ---------- Tableau clients ---------- */
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.search { position: relative; flex: 1 1 260px; max-width: 360px; }
.search svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--grey-2); }
.search .input { padding-left: 38px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { border: 1px solid var(--graphite); background: transparent; border-radius: 999px; padding: 7px 14px; font-size: 13px; color: var(--grey); cursor: pointer; }
.chip:hover { color: var(--white); }
.chip.is-on { background: var(--white); color: var(--black); border-color: var(--white); font-weight: 600; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; font-weight: 500; color: var(--grey-2); font-size: 12px; padding: 0 12px 10px; white-space: nowrap; border-bottom: 1px solid var(--line); }
td { padding: 12px; border-bottom: 1px solid var(--line); white-space: nowrap; vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
td.r, th.r { text-align: right; }
tbody tr.row-link { cursor: pointer; transition: background .1s; }
tbody tr.row-link:hover { background: var(--carbon-2); }
.person { display: flex; align-items: center; gap: 12px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--graphite); display: grid; place-items: center; font-family: var(--font-h); font-weight: 600; font-size: 13px; flex: none; color: var(--white); }
.avatar--lg { width: 56px; height: 56px; font-size: 20px; }
.person__name { font-weight: 600; }
.person__sub { font-size: 12px; color: var(--grey-2); max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 8px; border-radius: 6px; font-size: 12px; background: var(--black); border: 1px solid var(--graphite); color: var(--white); white-space: nowrap; }
.badge--premium { border-color: rgba(198,255,0,.4); color: var(--lime); }
.badge--warn { border-color: rgba(255,176,32,.45); color: var(--warn); }
.badge--off { color: var(--grey); }
.badges { display: flex; gap: 6px; flex-wrap: wrap; }
.platform { display: inline-flex; align-items: center; gap: 6px; color: var(--white); }
.recent { color: var(--lime); }

/* ---------- Fiche client ---------- */
.back { display: inline-flex; align-items: center; gap: 6px; color: var(--grey); font-size: 13px; margin-bottom: 18px; }
.back:hover { color: var(--white); }
.back svg { width: 16px; height: 16px; }
.profile { display: flex; gap: 18px; align-items: center; margin-bottom: 24px; flex-wrap: wrap; }
.profile h1 { font-size: 26px; }
.profile p { margin: 4px 0 8px; color: var(--grey); }
.facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 20px; margin: 0; }
.facts div { min-width: 0; }
.facts dt { font-size: 12px; color: var(--grey-2); }
.facts dd { margin: 2px 0 0; font-weight: 500; }
.week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; }
.day { background: var(--black); border: 1px solid var(--line); border-radius: 10px; padding: 10px; min-height: 92px; display: flex; flex-direction: column; gap: 4px; }
.day__d { font-size: 11px; color: var(--grey-2); text-transform: uppercase; letter-spacing: .08em; }
.day__t { font-weight: 600; font-size: 13px; line-height: 1.3; }
.day__m { font-size: 11px; color: var(--grey); margin-top: auto; }
.day--rest .day__t { color: var(--grey); font-weight: 500; }
.list { display: grid; gap: 0; }
.list__item { display: flex; justify-content: space-between; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.list__item:last-child { border-bottom: 0; }
.list__item .dim { white-space: nowrap; }
.sev { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; }
.heat { display: grid; grid-template-columns: repeat(30, minmax(0, 1fr)); gap: 3px; }
.heat i { aspect-ratio: 1; border-radius: 3px; background: var(--black); border: 1px solid var(--line); display: block; }
.note { font-size: 12px; color: var(--grey-2); margin: 12px 0 0; }

/* ---------- Divers ---------- */
.loading { display: grid; place-items: center; min-height: 50vh; color: var(--grey); }
.spinner { width: 22px; height: 22px; border: 2px solid var(--graphite); border-top-color: var(--lime); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.banner { background: var(--carbon); border: 1px solid var(--line); border-left: 2px solid var(--cyan); border-radius: 10px; padding: 12px 14px; color: var(--grey); font-size: 13px; margin-bottom: 16px; }
.banner strong { color: var(--white); font-weight: 600; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- Mobile ---------- */
@media (max-width: 960px) {
  .cols-2, .cols-3 { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; bottom: 0; top: auto; left: 0; right: 0; height: auto; z-index: 20; flex-direction: row; padding: 8px 8px calc(8px + env(safe-area-inset-bottom)); border-right: 0; border-top: 1px solid var(--line); background: rgba(11,11,13,.94); backdrop-filter: blur(12px); }
  .side .brand, .side__foot { display: none; }
  .nav { grid-auto-flow: column; grid-auto-columns: 1fr; width: 100%; }
  .nav a { flex-direction: column; gap: 3px; font-size: 11px; padding: 6px; }
  .nav a.is-active::before { display: none; }
  .nav a.is-active { color: var(--lime); background: none; }
  .main { padding: 20px 16px 110px; }
  .mobile-top { display: flex !important; }
  .head h1 { font-size: 24px; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .tile { padding: 14px; }
  .tile__value { font-size: 24px; }
  .week { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hide-sm { display: none; }
  .split__row { grid-template-columns: 90px 1fr 36px; }
}
.mobile-top { display: none; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.mobile-top .brand { padding: 0; }
