:root {
  --bg: #0b1020;
  --bg-2: #131a2e;
  --card: rgba(255, 255, 255, 0.05);
  --card-2: rgba(255, 255, 255, 0.08);
  --line: rgba(255, 255, 255, 0.14);
  --txt: #f2f5fb;
  --muted: #aab3c7;
  --ok: #34d399;
  --warn: #fbbf24;
  --bad: #f87171;
  --radius: 22px;
  --focus: #fbbf24;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html { font-size: 100%; }

html.big-text { font-size: 118%; }

body {
  margin: 0;
  min-height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--txt);
  background:
    radial-gradient(1100px 600px at 15% -10%, #1b2545 0%, transparent 60%),
    radial-gradient(900px 500px at 100% 0%, #14233a 0%, transparent 55%),
    var(--bg);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
}

body.center {
  display: grid;
  place-items: center;
  padding: 24px;
}

/* ---------- accessibilité ---------- */
.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.skip {
  position: absolute;
  left: 12px;
  top: -60px;
  z-index: 10;
  padding: 12px 16px;
  border-radius: 12px;
  background: var(--focus);
  color: #201400;
  font-weight: 700;
  text-decoration: none;
  transition: top .15s ease;
}

.skip:focus { top: 12px; }

a:focus-visible,
button:focus-visible,
input:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
  border-radius: 10px;
}

.wrap {
  max-width: 620px;
  margin: 0 auto;
  padding: calc(20px + env(safe-area-inset-top)) 18px calc(28px + env(safe-area-inset-bottom));
}

header.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  letter-spacing: -0.02em;
  font-size: 18px;
}

.brand .bolt {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 11px;
  background: linear-gradient(160deg, #fbbf24, #f59e0b);
  color: #201400;
  font-size: 18px;
  box-shadow: 0 6px 18px -6px rgba(251, 191, 36, 0.7);
}

.actions { display: flex; gap: 8px; flex-wrap: wrap; }

.iconbtn {
  appearance: none;
  min-height: 44px;
  min-width: 44px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--txt);
  border-radius: 12px;
  padding: 8px 12px;
  font-size: 14px;
  font-weight: 650;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease;
}

.iconbtn:hover { background: var(--card-2); border-color: rgba(255,255,255,.28); }
.iconbtn[aria-pressed="true"] { background: rgba(251,191,36,.18); border-color: rgba(251,191,36,.6); }

/* ---------- statut ---------- */
.hero {
  position: relative;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 26px 22px;
  background: linear-gradient(180deg, var(--card-2), var(--card));
  overflow: hidden;
  transition: border-color .4s ease;
}

.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(420px 180px at 50% 0%, rgba(255,255,255,.07), transparent 70%);
  pointer-events: none;
}

.hero[data-state="on"] { border-color: rgba(52, 211, 153, 0.45); }
.hero[data-state="off"] { border-color: rgba(248, 113, 113, 0.5); }

.statusline {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  font-size: 15px;
  color: var(--txt);
  font-weight: 650;
}

.dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--muted);
  flex: none;
}

.hero[data-state="on"] .dot {
  background: var(--ok);
  animation: pulse-ok 2.6s infinite;
}

.hero[data-state="off"] .dot {
  background: var(--bad);
  animation: pulse-bad 1.6s infinite;
}

@keyframes pulse-ok {
  0% { box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.5); }
  70% { box-shadow: 0 0 0 12px rgba(52, 211, 153, 0); }
  100% { box-shadow: 0 0 0 0 rgba(52, 211, 153, 0); }
}

@keyframes pulse-bad {
  0% { box-shadow: 0 0 0 0 rgba(248, 113, 113, 0.55); }
  70% { box-shadow: 0 0 0 14px rgba(248, 113, 113, 0); }
  100% { box-shadow: 0 0 0 0 rgba(248, 113, 113, 0); }
}

.big {
  margin: 12px 0 2px;
  font-size: clamp(32px, 10vw, 46px);
  font-weight: 750;
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
}

.sub { margin: 0; color: var(--muted); font-size: 15px; }

/* ---------- chiffres ---------- */
h2 {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  margin: 28px 0 10px;
  font-weight: 700;
}

dl.grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 12px 0 0;
}

dl.grid > div {
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: 16px;
  padding: 14px 10px;
  text-align: center;
  margin: 0;
}

dl.grid dt {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  font-weight: 650;
}

dl.grid dd {
  margin: 6px 0 0;
  font-size: 21px;
  font-weight: 700;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

dl.grid .n {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
  min-height: 16px;
}

/* ---------- tableau ---------- */
table.events {
  width: 100%;
  border-collapse: collapse;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--card);
  overflow: hidden;
  font-size: 15px;
}

table.events th,
table.events td {
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid var(--line);
}

table.events thead th {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  font-weight: 700;
}

table.events tbody tr:last-child td { border-bottom: 0; }

table.events td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

table.events th:last-child, table.events td:last-child { text-align: right; }

.empty {
  padding: 20px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
  border: 1px dashed var(--line);
  border-radius: 16px;
}

.warnbox {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(251, 191, 36, 0.45);
  background: rgba(251, 191, 36, 0.12);
  color: #fde68a;
  font-size: 14px;
}

footer.foot {
  margin-top: 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 13px;
  flex-wrap: wrap;
}

/* ---------- connexion ---------- */
.login-card {
  width: 100%;
  max-width: 380px;
  border: 1px solid var(--line);
  border-radius: 26px;
  padding: 32px 26px 28px;
  background: linear-gradient(180deg, var(--card-2), var(--card));
  box-shadow: 0 30px 60px -30px rgba(0, 0, 0, 0.8);
}

.login-card .logo {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  margin: 0 auto 16px;
  border-radius: 17px;
  background: linear-gradient(160deg, #fbbf24, #f59e0b);
  color: #201400;
  font-size: 28px;
  box-shadow: 0 14px 34px -14px rgba(251, 191, 36, 0.8);
}

.login-card h1 {
  margin: 0 0 6px;
  font-size: 24px;
  letter-spacing: -0.02em;
  text-align: center;
}

.login-card .lead {
  margin: 0 0 22px;
  font-size: 15px;
  color: var(--muted);
  text-align: center;
}

label.lbl {
  display: block;
  font-size: 14px;
  font-weight: 650;
  margin-bottom: 8px;
}

input[type="password"] {
  width: 100%;
  min-height: 48px;
  padding: 12px 16px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.3);
  color: var(--txt);
  font-size: 17px;
  outline: none;
  transition: border-color .18s ease, box-shadow .18s ease;
}

input[type="password"]:focus {
  border-color: rgba(251, 191, 36, 0.7);
  box-shadow: 0 0 0 4px rgba(251, 191, 36, 0.18);
}

input[aria-invalid="true"] { border-color: var(--bad); }

button.go {
  width: 100%;
  min-height: 50px;
  margin-top: 12px;
  padding: 14px;
  border: 0;
  border-radius: 14px;
  background: linear-gradient(160deg, #fbbf24, #f59e0b);
  color: #201400;
  font-size: 16px;
  font-weight: 750;
  cursor: pointer;
  transition: transform .12s ease, filter .15s ease;
}

button.go:active { transform: scale(0.985); }
button.go:disabled { filter: grayscale(.5) brightness(.85); cursor: default; }

.err {
  margin: 14px 0 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--bad);
}

.shake { animation: shake .35s; }
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-7px); }
  75% { transform: translateX(7px); }
}

.fade { animation: fade .4s ease both; }
@keyframes fade {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

@media (max-width: 380px) {
  dl.grid { grid-template-columns: 1fr 1fr; }
  dl.grid > div:last-child { grid-column: span 2; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}

@media (prefers-contrast: more) {
  :root { --line: rgba(255,255,255,.35); --muted: #c8d0e0; }
  .hero[data-state="on"] { border-width: 2px; }
  .hero[data-state="off"] { border-width: 2px; }
}
