/* Polices hébergées sur le serveur (plus de requête vers Google : plus rapide et plus respectueux de la vie privée) */
@font-face {
  font-family: 'Bricolage Grotesque'; font-style: normal; font-weight: 500 800; font-stretch: 100%; font-display: swap;
  src: url(../assets/fonts/bricolage-grotesque-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Inter'; font-style: normal; font-weight: 400 700; font-display: swap;
  src: url(../assets/fonts/inter-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --yellow: #FFC629;
  --yellow-deep: #F4B41C;
  --yellow-soft: #FFEDB3;
  --yellow-tint: #FFF7DC;
  --ink: #121212;
  --ink-2: #3A3732;
  --muted: #8C877C;
  --bg: #F7F5F0;
  --card: #FFFFFF;
  --line: #EDEAE2;
  --orange: #FF8A1F;
  --green: #2E9E5B;
  --red: #E5484D;
  --blue: #4A9BF0;
  --purple: #8B6CF0;
  --shadow: 0 1px 2px rgba(18, 18, 18, .04), 0 10px 28px -14px rgba(18, 18, 18, .16);
  --display: 'Bricolage Grotesque', 'Inter', system-ui, sans-serif;
  --body: 'Inter', system-ui, -apple-system, sans-serif;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: var(--body); background: var(--bg); color: var(--ink); -webkit-font-smoothing: antialiased; }
[hidden] { display: none !important; }
a { color: inherit; text-decoration: none; }
h1, h2 { font-family: var(--display); letter-spacing: -0.02em; }
.muted { color: var(--muted); }
.small { font-size: 12px; }

.btn {
  height: 50px; border: 0; border-radius: 999px; background: var(--ink); color: #fff; font: 600 15px var(--body);
  padding: 0 22px; cursor: pointer; transition: transform .15s ease, opacity .15s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn:disabled { opacity: .55; cursor: progress; transform: none; }
.btn-light { height: 40px; background: #fff; color: var(--ink); box-shadow: var(--shadow); font-size: 14px; }
.pill { font-size: 12px; font-weight: 700; padding: 5px 10px; border-radius: 999px; background: var(--yellow-tint); color: #7A5600; white-space: nowrap; }
.pill-ok { background: #E3F5EA; color: var(--green); }
.pill-warn { background: #FFE6CC; color: #B4530A; }
.pill-bad { background: #FDECEC; color: var(--red); }

/* Connexion */
.login { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
.login-side { position: relative; overflow: hidden; background: var(--yellow); padding: 48px; display: flex; flex-direction: column; justify-content: space-between; }
.login-swirl { position: absolute; inset: 0; width: 100%; height: 100%; }
.login-logo, .login-pitch { position: relative; }
.login-logo { display: block; align-self: flex-start; width: 170px; transition: transform .2s ease; }
.login-logo:hover { transform: rotate(-3deg) scale(1.04); }
.login-logo img { display: block; width: 100%; height: auto; }
.login-pitch h1 { font-size: clamp(40px, 5vw, 64px); font-weight: 800; line-height: 1; }
.login-pitch p { font-size: 18px; max-width: 420px; margin-top: 14px; color: rgba(18, 18, 18, .75); }
.login-main { display: grid; place-items: center; padding: 32px 20px; }
.login-card { width: min(420px, 100%); display: flex; flex-direction: column; gap: 14px; }
.badge { align-self: flex-start; font-size: 12px; font-weight: 700; background: #fff; border-radius: 999px; padding: 6px 12px; box-shadow: var(--shadow); }
.login-card h2 { font-size: 38px; font-weight: 800; margin-top: 6px; }
.login-card label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.login-card input {
  height: 52px; border-radius: 16px; border: 1.5px solid var(--line); background: #fff; padding: 0 16px; font: 500 16px var(--body); color: var(--ink);
  outline: none; transition: border-color .15s ease, box-shadow .15s ease;
}
.login-card input:focus { border-color: var(--ink); box-shadow: 0 0 0 4px rgba(255, 198, 41, .45); }
.pw { position: relative; display: flex; }
.pw input { flex: 1; padding-right: 92px; }
.pw-toggle { position: absolute; right: 8px; top: 8px; height: 36px; border: 0; border-radius: 12px; background: var(--bg); padding: 0 12px; font: 600 13px var(--body); cursor: pointer; }
.error { background: #FDECEC; color: var(--red); border-radius: 14px; padding: 10px 14px; font-size: 14px; font-weight: 500; }
.login-card .btn { margin-top: 6px; }
.back { font-size: 14px; color: var(--muted); text-align: center; margin-top: 6px; }

/* Structure */
.app { display: grid; grid-template-columns: 250px 1fr; min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; background: #fff; border-right: 1px solid var(--line); padding: 22px 16px; display: flex; flex-direction: column; gap: 26px; }
.side-logo { display: flex; align-items: center; gap: 8px; padding: 0 8px; }
.side-logo img { height: 28px; width: auto; }
.side-logo span { font: 700 11px var(--body); text-transform: uppercase; letter-spacing: .08em; background: var(--ink); color: var(--yellow); padding: 3px 7px; border-radius: 6px; }
.side-nav { display: flex; flex-direction: column; gap: 2px; }
.side-nav a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; font-size: 14px; font-weight: 500; color: var(--ink-2); transition: background .15s ease; }
.side-nav a i { font-style: normal; width: 18px; text-align: center; color: var(--muted); }
.side-nav a:hover { background: var(--bg); }
.side-nav a.active { background: var(--yellow-tint); color: var(--ink); font-weight: 700; }
.side-nav a.active i { color: var(--ink); }
.side-user { margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 16px; background: var(--bg); }
.avatar { width: 38px; height: 38px; border-radius: 50%; background: var(--yellow); display: grid; place-items: center; font: 800 16px var(--display); flex: 0 0 auto; }
.who { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.who b { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.role { font-size: 12px; color: #7A5600; font-weight: 600; }
.icon-btn { width: 34px; height: 34px; border: 0; border-radius: 10px; background: #fff; cursor: pointer; font-size: 16px; }
.icon-btn:hover { background: #FDECEC; color: var(--red); }

.main { padding: 28px 32px 40px; display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.top { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.top h1 { font-size: 34px; font-weight: 800; }
.top-actions { display: flex; align-items: center; gap: 12px; }
.live { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 4px rgba(46, 158, 91, .18); animation: pulse 2s ease-in-out infinite; }
.dot.off { background: var(--red); box-shadow: 0 0 0 4px rgba(229, 72, 77, .18); }
@keyframes pulse { 50% { box-shadow: 0 0 0 7px rgba(46, 158, 91, 0); } }

/* Chiffres clés */
.kpis { display: grid; grid-template-columns: repeat(6, 1fr); gap: 14px; }
.kpi { background: var(--card); border-radius: 22px; padding: 16px 18px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.kpi.hero { background: var(--yellow); }
.kpi .label { font-size: 12px; font-weight: 600; color: var(--muted); }
.kpi.hero .label { color: rgba(18, 18, 18, .65); }
.kpi .value { font: 800 30px var(--display); letter-spacing: -0.03em; white-space: nowrap; }
.kpi .sub { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi.hero .sub { color: rgba(18, 18, 18, .65); }

/* Panneaux */
.grid-2 { display: grid; grid-template-columns: 2fr 1fr; gap: 18px; }
.grid-2:not(#activity) { grid-template-columns: 1fr 1fr; }
.panel { background: var(--card); border-radius: 24px; padding: 20px; box-shadow: var(--shadow); min-width: 0; scroll-margin-top: 20px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.panel h2 { font-size: 20px; font-weight: 800; }

.legend { display: flex; flex-wrap: wrap; gap: 12px; font-size: 12px; color: var(--ink-2); }
.legend span { display: flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.chart svg { width: 100%; height: 240px; display: block; overflow: visible; }
.chart .axis { font: 500 10px var(--body); fill: var(--muted); }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart rect.hit { fill: transparent; cursor: pointer; }
.chart rect.hit:hover { fill: rgba(255, 198, 41, .14); }

.donut-wrap { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.donut-wrap svg { width: 180px; height: 180px; }
.donut-center { font: 800 34px var(--display); }
.donut-list { width: 100%; display: flex; flex-direction: column; gap: 8px; }
.donut-list div { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.donut-list i { width: 10px; height: 10px; border-radius: 3px; }
.donut-list b { margin-left: auto; }

.model { padding: 12px 0; border-bottom: 1px solid var(--line); }
.model:last-child { border-bottom: 0; }
.model-top { display: flex; justify-content: space-between; gap: 10px; font-size: 14px; }
.model-top b { font-weight: 700; }
.bar { height: 10px; border-radius: 6px; background: var(--bg); overflow: hidden; margin-top: 8px; }
.bar span { display: block; height: 100%; border-radius: 6px; background: var(--ink); transition: width .6s ease; }
.bar span.warn { background: var(--orange); }
.bar span.bad { background: var(--red); }
.model-sub { font-size: 12px; color: var(--muted); margin-top: 6px; }

.mini-kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 14px; }
.mini { background: var(--bg); border-radius: 16px; padding: 12px; }
.mini b { display: block; font: 800 22px var(--display); letter-spacing: -0.02em; }
.mini span { font-size: 12px; color: var(--muted); }

.cat { display: grid; grid-template-columns: 110px 1fr 34px; align-items: center; gap: 10px; font-size: 13px; padding: 5px 0; }
.cat .bar { margin-top: 0; height: 8px; }
.cat .bar span { background: var(--yellow); }
.cat b { text-align: right; }

.checks { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.checks li { display: flex; align-items: center; gap: 10px; font-size: 14px; padding: 10px 12px; border-radius: 14px; background: var(--bg); }
.checks li .st { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 800; flex: 0 0 auto; }
.checks .ok .st { background: #E3F5EA; color: var(--green); }
.checks .todo .st { background: #FFE6CC; color: #B4530A; }

.meter-row { display: flex; flex-direction: column; gap: 12px; }
.meter-label { display: flex; justify-content: space-between; font-size: 13px; }

.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 11px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table tr:last-child td { border-bottom: 0; }
.type { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; }
.type i { width: 8px; height: 8px; border-radius: 50%; }
.empty { text-align: center; color: var(--muted); padding: 30px 0; }

.tooltip { position: fixed; z-index: 10; pointer-events: none; background: var(--ink); color: #fff; border-radius: 12px; padding: 10px 12px; font-size: 12px; line-height: 1.6; box-shadow: 0 12px 30px -10px rgba(0, 0, 0, .5); }
.tooltip b { font-family: var(--display); font-size: 14px; }
.foot { text-align: center; padding-top: 8px; }

/* Écrans moyens */
@media (max-width: 1200px) {
  .kpis { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 980px) {
  .grid-2, .grid-2:not(#activity) { grid-template-columns: 1fr; }
}
/* Téléphone */
@media (max-width: 760px) {
  .login { grid-template-columns: 1fr; }
  .login-side { min-height: 240px; padding: 28px; }
  .login-pitch h1 { font-size: 36px; }
  .app { grid-template-columns: 1fr; }
  .side { position: sticky; top: 0; z-index: 5; height: auto; flex-direction: row; align-items: center; gap: 12px; padding: 12px 16px; border-right: 0; border-bottom: 1px solid var(--line); overflow-x: auto; }
  .side-nav { flex-direction: row; gap: 4px; }
  .side-nav a { white-space: nowrap; padding: 8px 10px; }
  .side-nav a i { display: none; }
  .side-user { margin: 0; padding: 0; background: transparent; }
  .side-user .who { display: none; }
  .main { padding: 18px 16px 30px; }
  .top h1 { font-size: 28px; }
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .kpi .value { font-size: 26px; }
  .mini-kpis { grid-template-columns: repeat(2, 1fr); }
}

/* Bugs signalés */
.nav-badge { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--red); color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center; }
.nav-badge[hidden] { display: none; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { border: 0; cursor: pointer; font: inherit; font-size: 13px; font-weight: 600; padding: 7px 12px; border-radius: 999px; background: var(--bg); color: var(--ink-2); }
.chip b { margin-left: 4px; color: var(--muted); }
.chip.active { background: var(--ink); color: #fff; }
.chip.active b { color: var(--yellow); }
.bug-list { display: grid; gap: 10px; }
.bug { border: 1px solid var(--line); border-left: 4px solid var(--yellow); border-radius: 16px; padding: 14px 16px; background: #fff; }
.bug.is-new { border-left-color: var(--red); }
.bug.is-fixed { border-left-color: var(--green); opacity: .75; }
.bug-top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.bug-msg { margin: 10px 0 12px; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 15px; line-height: 1.5; }
.bug-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.bug-actions button { border: 1px solid var(--line); background: #fff; cursor: pointer; font: inherit; font-size: 13px; font-weight: 600; padding: 6px 12px; border-radius: 10px; }
.bug-actions button:hover { background: var(--bg); }
.bug-actions button:disabled { opacity: .5; cursor: progress; }
