/* Étincelle Micros: dark, high contrast, readable from a sound desk. */
:root {
  --bg: #0d0f12;
  --panel: #171a1f;
  --panel-2: #20242b;
  --line: #2e333b;
  --text: #f4f5f7;
  --muted: #a3a9b3;
  --ok: #2fbf71;
  --ok-bg: #0f2a1c;
  --warn: #f2b233;
  --warn-bg: #2e2410;
  --plan: #8b929c;
  --danger: #ff5a5a;
  --accent: #d9b46f;
  --radius: 14px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body { min-height: 100vh; -webkit-tap-highlight-color: transparent; }
button { font: inherit; color: inherit; cursor: pointer; }
.hidden { display: none !important; }

/* ---------- header ---------- */
.top {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 12px 16px; background: rgba(13, 15, 18, .94); border-bottom: 1px solid var(--line);
  backdrop-filter: blur(8px);
}
.brand { font-weight: 800; letter-spacing: .02em; font-size: 18px; }
.brand span { color: var(--accent); }
.date { color: var(--muted); font-size: 15px; }
.sync { margin-left: auto; display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--muted); }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--ok); }
.sync.stale .dot { background: var(--danger); }
.summary { width: 100%; display: flex; gap: 14px; font-size: 14px; color: var(--muted); }
.summary b { color: var(--text); }

.offline {
  position: sticky; top: 0; z-index: 6;
  background: var(--danger); color: #160000; font-weight: 800; text-align: center;
  padding: 12px 16px; font-size: 17px;
}

/* ---------- cards ---------- */
main { padding: 12px 16px 120px; max-width: 1600px; margin: 0 auto; }
.cards { display: grid; gap: 10px; grid-template-columns: 1fr; }

.card {
  display: grid; grid-template-columns: 76px 52px 1fr; grid-template-areas:
    "ch av name" "ch av meta";
  align-items: center; column-gap: 14px; row-gap: 2px;
  background: var(--panel); border: 3px solid var(--line); border-radius: var(--radius);
  padding: 12px 14px; text-align: left; width: 100%;
}
.card.verifie { border-color: var(--ok); }
.card.prevu { border-style: dashed; border-color: var(--plan); }
.card.incertain { border-color: var(--warn); background: linear-gradient(0deg, var(--warn-bg), var(--panel)); }
.card.flash { animation: flash 1.2s ease-out; }
@keyframes flash { from { box-shadow: 0 0 0 6px var(--accent); } to { box-shadow: 0 0 0 0 transparent; } }
@media (prefers-reduced-motion: reduce) { .card.flash { animation: none; } }

.ch {
  grid-area: ch; display: flex; flex-direction: column; align-items: center; justify-content: center;
  height: 76px; border-radius: 12px; background: #fff; color: #000; line-height: 1;
}
.ch small { font-size: 11px; font-weight: 700; letter-spacing: .08em; opacity: .7; }
.ch b { font-size: 42px; font-weight: 900; font-variant-numeric: tabular-nums; }

.avatar {
  grid-area: av; width: 52px; height: 52px; border-radius: 50%; object-fit: cover;
  display: flex; align-items: center; justify-content: center;
  background: var(--panel-2); font-size: 20px; font-weight: 800; color: var(--muted);
}
.name { grid-area: name; font-size: 22px; font-weight: 800; line-height: 1.15; overflow-wrap: anywhere; }
.meta { grid-area: meta; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }

.mic {
  display: inline-flex; align-items: center; padding: 4px 12px;
  border-radius: 999px; font-weight: 700; font-size: 15px; border: 2px solid rgba(255,255,255,.25);
}

.status { font-weight: 800; font-size: 14px; letter-spacing: .04em; text-transform: uppercase; padding: 4px 8px; border-radius: 8px; }
.status.verifie { color: var(--ok); background: var(--ok-bg); }
.status.prevu { color: var(--plan); border: 1px dashed var(--plan); }
.status.incertain { color: var(--warn); background: var(--warn-bg); }

.group { margin: 18px 0 8px; font-size: 13px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
#cards > .group:first-child, .sheet .group:first-of-type { margin-top: 4px; }
.card.speak { grid-template-columns: 76px 1fr; grid-template-areas: "ch name" "list list"; cursor: default; }
.card.speak .moments { grid-area: list; list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 6px; font-size: 18px; }
.card.speak .moments li { display: flex; gap: 10px; }
.card.speak .moments time { font-weight: 800; min-width: 3.2em; font-variant-numeric: tabular-nums; color: var(--muted); }
.card .role { display: block; font-size: 15px; font-weight: 600; color: var(--muted); margin-top: 2px; }
.instruments { margin-top: 18px; color: var(--muted); font-size: 14px; display: flex; flex-wrap: wrap; gap: 6px 14px; }
.instruments b { color: var(--text); }
.instruments span { white-space: nowrap; }

.empty { text-align: center; color: var(--muted); padding: 48px 16px; font-size: 18px; }
.empty .actions { display: flex; flex-direction: column; gap: 10px; max-width: 360px; margin: 20px auto 0; }

/* wide screens: booth grid of big cards */
@media (min-width: 900px) {
  .cards { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
  .card {
    grid-template-columns: 1fr; grid-template-areas: "ch" "av" "name" "meta";
    justify-items: center; text-align: center; row-gap: 10px; padding: 16px;
  }
  .ch { width: 100%; height: 110px; }
  .ch b { font-size: 76px; }
  .avatar { width: 120px; height: 120px; font-size: 42px; }
  .name { font-size: 30px; }
  .meta { justify-content: center; }
  .card.speak { grid-template-columns: 1fr; grid-template-areas: "ch" "name" "list"; justify-items: stretch; text-align: left; }
  .card.speak .name { text-align: center; }
}

/* ---------- buttons, bars, sheets ---------- */
.btn {
  min-height: 52px; padding: 12px 18px; border-radius: 12px; border: 2px solid var(--line);
  background: var(--panel-2); font-weight: 700; font-size: 17px;
}
.btn.primary { background: var(--accent); border-color: var(--accent); color: #1a1200; }
.btn.ok { background: var(--ok); border-color: var(--ok); color: #03140a; }
.btn.warn { background: var(--warn-bg); border-color: var(--warn); color: var(--warn); }
.btn.danger { background: transparent; border-color: var(--danger); color: var(--danger); }
.btn.ghost { background: transparent; }
.btn:disabled { opacity: .45; }

.bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 5;
  display: flex; gap: 10px; align-items: center; padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: rgba(13, 15, 18, .96); border-top: 1px solid var(--line);
}
.bar .who { margin-left: auto; color: var(--muted); font-size: 14px; }

.backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 10; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 11; max-height: 88vh; overflow: auto;
  background: var(--panel); border-radius: 20px 20px 0 0; border-top: 1px solid var(--line);
  padding: 18px 16px calc(20px + env(safe-area-inset-bottom));
}
@media (min-width: 700px) {
  .sheet { left: 50%; right: auto; width: 640px; transform: translateX(-50%); bottom: 24px; border-radius: 20px; border: 1px solid var(--line); }
}
.sheet h2 { margin: 0 0 4px; font-size: 22px; }
.sheet p.sub { margin: 0 0 14px; color: var(--muted); }
.sheet .stack { display: flex; flex-direction: column; gap: 10px; }
.pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
.pick button {
  min-height: 72px; border-radius: 12px; border: 2px solid var(--line); background: var(--panel-2);
  padding: 10px; font-weight: 700; font-size: 17px; display: flex; flex-direction: column; align-items: center; gap: 6px;
}
.pick button .ini { width: 44px; height: 44px; border-radius: 50%; background: var(--bg); display: flex; align-items: center; justify-content: center; color: var(--muted); }
.pick button.taken { opacity: .75; border-style: dashed; }
.pick button small { font-weight: 500; color: var(--muted); font-size: 13px; }
.pick .chnum { font-size: 26px; font-weight: 900; }
.pick .swatch { width: 100%; height: 10px; border-radius: 5px; border: 1px solid rgba(255,255,255,.3); }
.sheet .close { position: absolute; right: 12px; top: 12px; min-height: 44px; min-width: 44px; border: none; background: none; font-size: 26px; color: var(--muted); }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.field label { color: var(--muted); font-size: 14px; }
.field input {
  min-height: 52px; font-size: 22px; padding: 10px 14px; border-radius: 12px;
  border: 2px solid var(--plan); background: var(--bg); color: var(--text);
}
.error { color: var(--danger); font-weight: 700; min-height: 1.4em; }

.toast {
  position: fixed; left: 50%; bottom: 92px; transform: translateX(-50%); z-index: 12;
  display: flex; gap: 14px; align-items: center; background: var(--text); color: var(--bg);
  padding: 10px 10px 10px 16px; border-radius: 12px; font-weight: 700; max-width: calc(100% - 32px);
}
.toast button { min-height: 44px; border: none; background: var(--bg); color: var(--text); border-radius: 8px; padding: 0 14px; font-weight: 800; }

.gate { max-width: 420px; margin: 12vh auto; padding: 0 16px; }
.gate h1 { font-size: 28px; }

.brand-back { min-height: 44px; display: inline-flex; align-items: center; padding: 0 12px; border-radius: 10px; border: 2px solid var(--line); color: var(--text); text-decoration: none; font-weight: 700; font-size: 15px; }

:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
