/* Cockpit photographe : lisible en plein soleil, une main, gros boutons, état actif impossible à rater. */
:root {
  --bg: #0a0a0b; --panel: #151619; --panel-2: #1c1e22; --line: #2a2c31; --line-2: #3a3d44;
  --text: #f3f1ec; --muted: #a0a1a8; --dim: #6c6e75;
  --accent: #ff4d2e; --ok: #2bd576; --ok-bg: #0d2a1a; --warn: #ffb020; --warn-bg: #2e2208; --err: #ff5a5a; --err-bg: #2d0f0f;
  --display: "Barlow Condensed", "Arial Narrow", system-ui, sans-serif;
  --body: "Barlow", system-ui, -apple-system, "Segoe UI", sans-serif;
  --g: 16px;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--body); font-size: 16px; line-height: 1.45;
  -webkit-font-smoothing: antialiased; min-height: 100dvh; padding-bottom: env(safe-area-inset-bottom); }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }

.bar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between;
  padding: 10px var(--g); padding-top: max(10px, env(safe-area-inset-top)); background: rgba(10,10,11,.94);
  backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.logo { display: flex; gap: 10px; align-items: center; text-decoration: none; }
.logo b { display: block; font-family: var(--display); font-weight: 800; font-style: italic; letter-spacing: .05em; font-size: 18px; line-height: 1; }
.logo small { display: block; font-family: var(--display); font-weight: 600; letter-spacing: .2em; font-size: 10px; color: var(--muted); text-transform: uppercase; margin-top: 2px; }
.mark { width: 22px; height: 13px; background: var(--accent); transform: skewX(-24deg); border-radius: 2px; }
.conn { width: 10px; height: 10px; border-radius: 50%; background: var(--dim); }
.conn.on { background: var(--ok); box-shadow: 0 0 10px var(--ok); }
.conn.off { background: var(--err); }

main { max-width: 760px; margin: 0 auto; padding: var(--g); }
h2.sec { font-family: var(--display); font-weight: 800; font-style: italic; text-transform: uppercase; letter-spacing: .08em;
  font-size: 15px; color: var(--muted); margin: 28px 0 10px; }

/* ---------------------------------------------------------------- ÉVÉNEMENT ACTIF : énorme, vert */
.active { border-radius: 18px; padding: 20px 18px 18px; background: var(--ok-bg); border: 2px solid var(--ok);
  box-shadow: 0 0 0 6px rgba(43,213,118,.08), 0 24px 60px -30px rgba(43,213,118,.6); position: relative; overflow: hidden; }
.active::before { content: ""; position: absolute; inset: 0; background: repeating-linear-gradient(-55deg, transparent 0 22px, rgba(43,213,118,.04) 22px 44px); pointer-events: none; }
.active .lbl { display: flex; align-items: center; gap: 10px; font-family: var(--display); font-weight: 800; letter-spacing: .16em;
  font-size: 15px; color: var(--ok); text-transform: uppercase; }
.dot { width: 14px; height: 14px; border-radius: 50%; background: var(--ok); animation: pulse 1.6s infinite; flex: none; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(43,213,118,.6); } 70% { box-shadow: 0 0 0 14px rgba(43,213,118,0); } 100% { box-shadow: 0 0 0 0 rgba(43,213,118,0); } }
.active .name { margin: 8px 0 4px; font-family: var(--display); font-weight: 800; font-style: italic; text-transform: uppercase;
  font-size: clamp(36px, 11vw, 60px); line-height: .92; overflow-wrap: anywhere; }
.active .since { color: #bfe9cf; font-size: 17px; }
.active .kpis { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin: 16px 0; }
.kpi { background: rgba(0,0,0,.28); border-radius: 12px; padding: 10px 12px; }
.kpi b { display: block; font-family: var(--display); font-weight: 800; font-size: 30px; line-height: 1; }
.kpi span { font-size: 13px; color: var(--muted); }
.active .actions { display: flex; gap: 10px; flex-wrap: wrap; }
.active.none { background: var(--warn-bg); border-color: var(--warn); box-shadow: 0 0 0 6px rgba(255,176,32,.1); }
.active.none .lbl { color: var(--warn); }
.active.none .dot { background: var(--warn); animation: none; }
.datewarn { margin-top: 12px; padding: 10px 12px; border-radius: 10px; background: var(--warn-bg); color: var(--warn); font-weight: 600; font-size: 15px; }

/* ---------------------------------------------------------------- boutons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 52px; padding: 0 20px;
  border-radius: 12px; border: 1px solid var(--line-2); background: var(--panel-2); cursor: pointer; text-decoration: none;
  font-family: var(--display); font-weight: 800; font-style: italic; letter-spacing: .06em; font-size: 18px; text-transform: uppercase; }
.btn:active { transform: scale(.98); }
.btn-ok { background: var(--ok); color: #03130a; border-color: var(--ok); }
.btn-accent { background: var(--accent); color: #140400; border-color: var(--accent); }
.btn-warn { background: var(--warn); color: #1c1200; border-color: var(--warn); }
.btn-danger { background: transparent; color: var(--err); border-color: var(--err); }
.btn-block { width: 100%; }
.btn-sm { min-height: 42px; font-size: 15px; padding: 0 14px; }
.btn[disabled] { opacity: .5; pointer-events: none; }

/* ---------------------------------------------------------------- liste d'événements */
.events { display: grid; gap: 8px; }
.ev { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 64px; padding: 12px 14px; border-radius: 14px;
  background: var(--panel); border: 1px solid var(--line); text-align: left; cursor: pointer; }
.ev:hover { border-color: var(--line-2); }
.ev .t { flex: 1; min-width: 0; }
.ev .t b { display: block; font-family: var(--display); font-weight: 800; font-style: italic; text-transform: uppercase; font-size: 21px;
  line-height: 1.05; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ev .t small { color: var(--muted); font-size: 14px; }
.ev .badge { font-family: var(--display); font-weight: 800; letter-spacing: .1em; font-size: 14px; color: var(--ok); white-space: nowrap; }
.ev.on { border-color: var(--ok); background: var(--ok-bg); cursor: default; }
.ev .go { font-family: var(--display); font-weight: 800; color: var(--muted); font-size: 15px; letter-spacing: .08em; }
.ev .more { width: 44px; height: 44px; border-radius: 10px; border: 1px solid var(--line); background: transparent; flex: none; cursor: pointer; font-size: 22px; line-height: 1; display: grid; place-items: center; text-decoration: none; color: var(--muted); }

/* ---------------------------------------------------------------- alertes / bannière */
.alert { display: flex; align-items: center; gap: 12px; justify-content: space-between; flex-wrap: wrap; margin-top: 14px; padding: 14px;
  border-radius: 14px; background: var(--warn-bg); border: 1px solid var(--warn); color: var(--warn); font-weight: 700; }
.alert.err { background: var(--err-bg); border-color: var(--err); color: var(--err); }
.banner { position: sticky; top: 58px; z-index: 9; margin: 0 auto; max-width: 760px; padding: 14px var(--g);
  background: var(--ok); color: #03130a; font-weight: 700; animation: slide .4s ease; }
.banner b { display: block; font-family: var(--display); font-weight: 800; font-style: italic; text-transform: uppercase; font-size: 22px; line-height: 1.05; }
@keyframes slide { from { transform: translateY(-20px); opacity: 0; } }

/* ---------------------------------------------------------------- monitoring */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 10px; }
.stat b { display: block; font-family: var(--display); font-weight: 800; font-size: 26px; line-height: 1.05; }
.stat span { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.stat.bad b { color: var(--err); }
.workers { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.pill { font-size: 13px; padding: 4px 10px; border-radius: 999px; background: var(--panel-2); border: 1px solid var(--line); color: var(--muted); }
.pill.on { color: var(--ok); border-color: rgba(43,213,118,.4); }
.pill.off { color: var(--err); border-color: rgba(255,90,90,.4); }
.timeline { margin: 0; padding: 0; list-style: none; font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 13.5px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px; max-height: 360px; overflow: auto; }
.timeline li { display: flex; gap: 10px; padding: 8px 12px; border-bottom: 1px solid var(--line); }
.timeline li:last-child { border-bottom: 0; }
.timeline time { color: var(--dim); flex: none; }
.timeline .ok { color: var(--ok); } .timeline .warn { color: var(--warn); } .timeline .error { color: var(--err); }
.timeline li.fresh { animation: fresh 2s ease; }
@keyframes fresh { from { background: rgba(255,77,46,.18); } }

/* ---------------------------------------------------------------- formulaires */
form.card, .card { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 16px; }
label.f { display: block; margin: 14px 0 6px; font-weight: 600; color: var(--muted); font-size: 14px; text-transform: uppercase; letter-spacing: .06em; }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=number], textarea, select {
  width: 100%; min-height: 52px; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line-2); background: #0f1012; font-size: 17px; }
textarea { min-height: 90px; resize: vertical; }
.toggle { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px; margin-top: 8px;
  border-radius: 12px; background: #0f1012; border: 1px solid var(--line-2); cursor: pointer; }
.toggle input { width: 26px; height: 26px; accent-color: var(--ok); }
.toggle small { display: block; color: var(--muted); font-size: 13px; }
.form-actions { display: grid; gap: 10px; margin-top: 20px; }
.err { color: var(--err); font-weight: 600; min-height: 1.4em; margin: 10px 0 0; }
.hint { color: var(--muted); font-size: 14px; }

/* ---------------------------------------------------------------- modal */
.modal { border: 1px solid var(--line-2); border-radius: 18px; background: var(--panel); color: var(--text); padding: 20px;
  width: min(92vw, 460px); }
.modal::backdrop { background: rgba(0,0,0,.72); backdrop-filter: blur(3px); }
.modal h3 { margin: 0 0 6px; font-family: var(--display); font-weight: 800; font-style: italic; text-transform: uppercase; font-size: 26px; line-height: 1.05; }
.modal p { color: var(--muted); margin: 0 0 18px; }
.modal .row { display: grid; grid-template-columns: 1fr 1.4fr; gap: 10px; }

/* ---------------------------------------------------------------- QR / galerie */
.qr { background: #fff; border-radius: 14px; padding: 14px; display: grid; place-items: center; }
.qr img { width: min(100%, 320px); height: auto; image-rendering: pixelated; }
.url { font-family: ui-monospace, Menlo, monospace; font-size: 14px; word-break: break-all; color: var(--muted); }
.btnrow { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 6px; }
.thumbs label, .thumbs a { position: relative; display: block; aspect-ratio: 1; border-radius: 8px; overflow: hidden; background: var(--panel-2); cursor: pointer; }
.thumbs img { width: 100%; height: 100%; object-fit: cover; }
.thumbs input { position: absolute; top: 6px; left: 6px; width: 24px; height: 24px; accent-color: var(--accent); }
.thumbs .tag { position: absolute; bottom: 4px; right: 4px; font-size: 11px; padding: 2px 6px; border-radius: 6px; background: rgba(0,0,0,.7); }

/* ---------------------------------------------------------------- login */
.login { min-height: 100dvh; display: grid; place-items: center; padding: var(--g); }
.login .card { width: min(100%, 400px); }
.login h1 { font-family: var(--display); font-weight: 800; font-style: italic; text-transform: uppercase; font-size: 36px; line-height: .95; margin: 0; }
.login h1 small { display: block; font-size: 13px; letter-spacing: .22em; color: var(--accent); font-style: normal; margin-bottom: 8px; }

/* ---------------------------------------------------------------- impression QR */
.print-sheet { background: #fff; color: #000; min-height: 100dvh; display: grid; place-items: center; text-align: center; padding: 24px; }
.print-sheet h1 { font-family: var(--display); font-weight: 800; font-style: italic; text-transform: uppercase; font-size: 54px; line-height: .95; margin: 0 0 6px; }
.print-sheet .b { font-family: var(--display); font-weight: 700; letter-spacing: .3em; color: #d12d10; }
.print-sheet img { width: min(80vw, 520px); margin: 20px auto; image-rendering: pixelated; }
.print-sheet p { font-size: 20px; margin: 0; }
.print-sheet .noprint { margin-top: 24px; }
@media print {
  .bar, .banner, .noprint { display: none !important; }
  body, .print-sheet { background: #fff; }
  main { max-width: none; padding: 0; }
}
.evtitle { margin: 0; font-family: var(--display); font-weight: 800; font-style: italic; text-transform: uppercase; font-size: 34px; line-height: 1; overflow-wrap: anywhere; }
.print-url { font-family: ui-monospace, Menlo, monospace; font-size: 16px !important; margin-top: 6px !important; }
.btnrow.center { justify-content: center; }
