/* Le Centurion — panel web. Charte du site La FactorY (yayafactory.pages.dev). */

@font-face { font-family: 'Barlow Condensed'; font-weight: 700; font-display: swap; src: url(fonts/barlow-condensed-700.woff2) format('woff2'); }
@font-face { font-family: 'Barlow Condensed'; font-weight: 800; font-display: swap; src: url(fonts/barlow-condensed-800.woff2) format('woff2'); }
@font-face { font-family: 'Inter'; font-weight: 400 700; font-display: swap; src: url(fonts/inter-variable.woff2) format('woff2'); }

:root {
    --bg: #0a0a0b;
    --surface: #131315;
    --surface-2: #1b1b1f;
    --line: rgba(255, 255, 255, 0.09);
    --line-strong: rgba(255, 255, 255, 0.18);
    --text: #f4f4f5;
    --muted: #a1a1aa;
    --red: #e11d24;
    --red-deep: #a3121a;
    --red-tint: rgba(225, 29, 36, 0.14);
    --orange: #f59e0b;
    --orange-tint: rgba(245, 158, 11, 0.14);
    --green: #22c55e;
    --green-tint: rgba(34, 197, 94, 0.14);
    --radius: 14px;
    --display: 'Barlow Condensed', 'Arial Narrow', Impact, sans-serif;
    --body: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    --wrap: 1280px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--body); font-size: 16px; line-height: 1.6; -webkit-font-smoothing: antialiased; }
h1, h2, h3 { font-family: var(--display); font-weight: 800; text-transform: uppercase; line-height: 1.02; letter-spacing: 0.01em; margin: 0; }
h1 { font-size: clamp(36px, 5vw, 56px); }
h2 { font-size: clamp(26px, 3vw, 34px); }
h3 { font-size: 22px; }
a { color: inherit; }
button, input, select { font: inherit; color: inherit; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 16px; }

/* --- En-tete ----------------------------------------------------------- */
.site-header { position: sticky; top: 0; z-index: 20; background: rgba(10, 10, 11, 0.86); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.header-in { display: flex; align-items: center; gap: 24px; min-height: 68px; }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; flex-shrink: 0; }
.brand img { width: 38px; height: 38px; border-radius: 50%; }
.brand span { font-family: var(--display); font-size: 26px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.02em; }
.nav { display: flex; gap: 4px; flex: 1; overflow-x: auto; scrollbar-width: none; }
.nav a { text-decoration: none; color: var(--muted); font-size: 14px; font-weight: 600; padding: 8px 12px; border-radius: 8px; white-space: nowrap; transition: color 0.15s, background 0.15s; }
.nav a:hover { color: var(--text); background: var(--surface-2); }
.nav a[aria-current] { color: var(--text); box-shadow: inset 0 -2px 0 var(--red); border-radius: 0; }
.me { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.avatar { width: 32px; height: 32px; border-radius: 50%; }
.me-txt { display: flex; flex-direction: column; line-height: 1.2; }
.me-txt strong { font-size: 14px; }
.me-txt span { font-size: 12px; color: var(--muted); }

@media (max-width: 900px) {
    .header-in { flex-wrap: wrap; gap: 10px; padding-top: 10px; }
    .nav { order: 3; flex-basis: 100%; }
    .me { margin-left: auto; }
    .me-txt { display: none; }
    .brand span { font-size: 22px; }
}

.main { padding-top: 36px; padding-bottom: 80px; }

/* --- Composants de la charte ------------------------------------------- */
.eyebrow { display: inline-flex; align-items: center; gap: 10px; font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.14em; color: var(--muted); margin: 0 0 14px; }
.eyebrow::before { content: ''; width: 28px; height: 3px; background: var(--red); }
.section { margin-top: 44px; }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 20px; flex-wrap: wrap; }
.section-head p { color: var(--muted); margin: 8px 0 0; max-width: 620px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 12px 20px; border: 1px solid transparent; border-radius: 10px; font-weight: 700; font-size: 15px; text-decoration: none; cursor: pointer; transition: background 0.15s, border-color 0.15s; }
.btn-red { background: var(--red); color: #fff; }
.btn-red:hover { background: var(--red-deep); }
.btn-ghost { background: rgba(255, 255, 255, 0.04); border-color: var(--line-strong); color: var(--text); }
.btn-ghost:hover { background: rgba(255, 255, 255, 0.09); }
.btn-sm { padding: 8px 14px; font-size: 14px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.5; cursor: default; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; }
.card-click { cursor: pointer; transition: border-color 0.2s, transform 0.2s; }
.card-click:hover { border-color: var(--line-strong); transform: translateY(-3px); }
.grid { display: grid; gap: 16px; }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 1000px) { .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 760px) { .grid-2 { grid-template-columns: 1fr; } }
@media (max-width: 480px) { .grid-4 { grid-template-columns: 1fr; } }

.badge { display: inline-block; font-size: 11px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; padding: 4px 9px; border-radius: 6px; white-space: nowrap; }
.badge-red { background: var(--red); color: #fff; }
.badge-white { background: #fff; color: #0a0a0b; }
.badge-orange { background: var(--orange-tint); color: var(--orange); }
.badge-green { background: var(--green-tint); color: var(--green); }
.badge-grey { background: rgba(255, 255, 255, 0.08); color: var(--muted); }

.notice { border-radius: 10px; padding: 12px 16px; font-size: 14px; margin: 0 0 16px; border: 1px solid var(--line); }
.notice-red { background: var(--red-tint); border-color: rgba(225, 29, 36, 0.35); }
.notice-orange { background: var(--orange-tint); border-color: rgba(245, 158, 11, 0.35); }

/* --- Etat global (le feu) ----------------------------------------------- */
.status { display: flex; align-items: center; gap: 22px; padding: 28px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); }
.status-light { width: 64px; height: 64px; border-radius: 50%; flex-shrink: 0; }
.status-vert .status-light { background: var(--green); box-shadow: 0 0 0 10px var(--green-tint), 0 0 40px rgba(34, 197, 94, 0.45); }
.status-orange .status-light { background: var(--orange); box-shadow: 0 0 0 10px var(--orange-tint), 0 0 40px rgba(245, 158, 11, 0.45); }
.status-rouge .status-light { background: var(--red); box-shadow: 0 0 0 10px var(--red-tint), 0 0 40px rgba(225, 29, 36, 0.5); }
.status-rouge { border-color: rgba(225, 29, 36, 0.45); }
.status h1 { font-size: clamp(32px, 4.5vw, 48px); }
.status p { margin: 6px 0 0; color: var(--muted); }

.kpi-label { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted); }
.kpi-value { font-family: var(--display); font-size: 52px; font-weight: 800; line-height: 1; margin-top: 10px; }
.kpi-value small { font-size: 24px; color: var(--muted); }
.kpi-help { font-size: 13px; color: var(--muted); margin-top: 8px; }

/* --- Graphique 7 jours --------------------------------------------------- */
.chart { display: flex; align-items: flex-end; gap: 10px; height: 180px; padding-top: 10px; }
.chart-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 8px; height: 100%; justify-content: flex-end; }
.chart-stack { width: 100%; max-width: 46px; display: flex; flex-direction: column-reverse; border-radius: 6px 6px 0 0; overflow: hidden; min-height: 2px; background: var(--surface-2); }
.chart-bar-ban { background: var(--red); }
.chart-bar-alerte { background: var(--orange); }
.chart-day { font-size: 12px; color: var(--muted); text-transform: capitalize; }
.chart-n { font-size: 12px; font-weight: 700; }
.legend { display: flex; gap: 16px; font-size: 13px; color: var(--muted); margin-top: 14px; flex-wrap: wrap; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.legend .l-ban { background: var(--red); }
.legend .l-alerte { background: var(--orange); }

.top-row { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; align-items: center; margin-bottom: 14px; }
.top-row span { font-weight: 600; font-size: 15px; }
.top-row b { font-family: var(--display); font-size: 22px; }
.top-bar { grid-column: 1 / -1; height: 6px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.top-bar i { display: block; height: 100%; background: var(--red); border-radius: 999px; }

/* --- Listes ------------------------------------------------------------- */
.list { display: flex; flex-direction: column; }
.row { display: flex; align-items: center; gap: 14px; padding: 14px 4px; border-bottom: 1px solid var(--line); }
.row:last-child { border-bottom: 0; }
.row-click { cursor: pointer; border-radius: 10px; padding-left: 10px; padding-right: 10px; transition: background 0.15s; }
.row-click:hover { background: var(--surface-2); }
.row-main { flex: 1; min-width: 0; }
.row-title { font-weight: 600; overflow-wrap: anywhere; }
.row-sub { font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
.row-side { text-align: right; font-size: 13px; color: var(--muted); flex-shrink: 0; }
.dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.dot-ban { background: var(--red); }
.dot-alerte { background: var(--orange); }
.dot-refus { background: #fff; }
.dot-levee { background: var(--green); }
.dot-info { background: var(--muted); }
.empty { text-align: center; color: var(--muted); padding: 34px 10px; }

.toolbar { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; align-items: center; }
.input { background: var(--surface-2); border: 1px solid var(--line-strong); border-radius: 10px; padding: 11px 14px; min-width: 0; }
.input:focus { outline: 2px solid var(--red); outline-offset: 1px; }
.toolbar .input { flex: 1; min-width: 200px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { background: transparent; border: 1px solid var(--line-strong); border-radius: 999px; padding: 7px 14px; font-size: 14px; font-weight: 600; color: var(--muted); cursor: pointer; }
.chip[aria-pressed="true"] { background: var(--text); color: var(--bg); border-color: var(--text); }

.ping-bon { color: var(--green); }
.ping-moyen { color: var(--orange); }
.ping-mauvais { color: var(--red); }

/* --- Reglages ----------------------------------------------------------- */
.switch-card { display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.det { display: grid; grid-template-columns: 1fr auto; gap: 8px 20px; align-items: center; padding: 16px 0; border-bottom: 1px solid var(--line); }
.det:last-child { border-bottom: 0; }
.det-title { font-weight: 700; }
.det-explain { font-size: 14px; color: var(--muted); }
@media (max-width: 760px) { .det { grid-template-columns: 1fr; } }
.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 3px; gap: 3px; flex-wrap: wrap; }
.seg button { background: transparent; border: 0; border-radius: 8px; padding: 7px 12px; font-size: 13px; font-weight: 700; color: var(--muted); cursor: pointer; }
.seg button[aria-pressed="true"][data-level="log"] { background: var(--orange-tint); color: var(--orange); }
.seg button[aria-pressed="true"][data-level="calibrage"],
.seg button[aria-pressed="true"][data-level="toujours"] { background: var(--red); color: #fff; }
.seg button:disabled { cursor: default; }

.toggle { position: relative; width: 56px; height: 30px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line-strong); cursor: pointer; flex-shrink: 0; }
.toggle::after { content: ''; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: var(--muted); transition: transform 0.15s, background 0.15s; }
.toggle[aria-checked="true"] { background: var(--orange-tint); border-color: var(--orange); }
.toggle[aria-checked="true"]::after { transform: translateX(26px); background: var(--orange); }

/* --- Fenetre ------------------------------------------------------------ */
.modal { position: fixed; inset: 0; z-index: 50; background: rgba(0, 0, 0, 0.75); display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px; overflow-y: auto; }
.modal-box { position: relative; width: 100%; max-width: 640px; background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius); padding: 28px; }
.modal-close { position: absolute; top: 12px; right: 14px; background: none; border: 0; font-size: 28px; color: var(--muted); cursor: pointer; line-height: 1; }
.modal-close:hover { color: var(--text); }
.facts { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; font-size: 14px; margin: 16px 0; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; overflow-wrap: anywhere; }
details.tech { margin-top: 16px; border-top: 1px solid var(--line); padding-top: 12px; }
details.tech summary { cursor: pointer; color: var(--muted); font-size: 14px; font-weight: 600; }
details.tech pre { white-space: pre-wrap; overflow-wrap: anywhere; font-family: ui-monospace, 'Cascadia Mono', Consolas, monospace; font-size: 12px; color: var(--muted); background: var(--bg); padding: 12px; border-radius: 8px; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 20px; }
.field { display: flex; flex-direction: column; gap: 6px; margin-top: 14px; }
.field label { font-size: 14px; font-weight: 600; }
.field .help { font-size: 13px; color: var(--muted); }

/* --- Connexion ---------------------------------------------------------- */
.login { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; background: radial-gradient(ellipse at top, rgba(225, 29, 36, 0.14), transparent 60%), var(--bg); }
.login-card { width: 100%; max-width: 420px; text-align: center; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 36px 28px; }
.login-logo { display: block; border-radius: 50%; margin: 0 auto 16px; }
.login-card .eyebrow { display: flex; justify-content: center; }
.login-card h1 { margin-bottom: 10px; }
.login-card .muted { margin: 0 0 24px; }
.link-dev { display: block; margin-top: 14px; font-size: 13px; color: var(--muted); }

/* --- Message ------------------------------------------------------------ */
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 60; background: var(--text); color: var(--bg); font-weight: 600; padding: 12px 20px; border-radius: 10px; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6); max-width: calc(100% - 32px); }
.toast.toast-error { background: var(--red); color: #fff; }
