/* Pupitre opérateur — PC & tablette (responsive, cibles tactiles ≥ 56 px) */
:root {
  --vert-900: #073a1f; --vert-800: #0b4a28; --vert-700: #0d5a31; --vert-600: #136b3b; --vert-500: #1b7d47;
  --vert-50: #eaf4ee;
  --rouge: #c62828; --rouge-50: #fdecea;
  --ambre: #f59f00; --ambre-700: #b36b00;
  --fond: #f2f5f3; --carte: #ffffff; --texte: #142219; --doux: #5c6f63; --ligne: #dbe5de;
  --rayon: 16px;
  --ombre: 0 1px 2px rgba(10,40,20,.06), 0 6px 18px rgba(10,40,20,.06);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh;
  background: var(--fond); color: var(--texte);
  font-family: "Montserrat", "Segoe UI", Roboto, Arial, sans-serif; font-weight: 600;
  -webkit-tap-highlight-color: transparent;
}
button, input, textarea { font: inherit; color: inherit; }

/* ---------- Barre supérieure ---------- */
.bar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 12px max(20px, env(safe-area-inset-left));
  background: linear-gradient(180deg, var(--vert-800), var(--vert-900)); color: #fff;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand img { width: 42px; height: 42px; border-radius: 50%; background: #fff; }
.brand strong { display: block; font-size: 18px; font-weight: 800; }
.brand span { font-size: 13px; opacity: .8; }
.status { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: 999px; font-size: 13px;
  background: rgba(255,255,255,.12);
}
.pill::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; opacity: .9; }
.pill.ok { color: #9be7b0; } .pill.ko { color: #ff9b94; } .pill.wait { color: #ffd27a; }

/* ---------- Grille ---------- */
.layout {
  display: grid; gap: 18px;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  grid-template-areas: "now ticker" "actions ticker" "actions danger" "kbd kbd";
  max-width: 1280px; margin: 0 auto; padding: 20px;
}
.now { grid-area: now; } .actions { grid-area: actions; } .ticker { grid-area: ticker; }
.danger { grid-area: danger; } .kbd { grid-area: kbd; }
@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; grid-template-areas: "now" "actions" "ticker" "danger"; padding: 14px; gap: 14px; }
  .kbd { display: none; }
}

.panel { background: var(--carte); border: 1px solid var(--ligne); border-radius: var(--rayon); padding: 20px; box-shadow: var(--ombre); }
.eyebrow { font-size: 12px; letter-spacing: 1.2px; text-transform: uppercase; color: var(--doux); font-weight: 700; }

/* ---------- Numéro à l'écran ---------- */
.now { display: flex; flex-direction: column; gap: 6px; }
.now-head { display: flex; justify-content: space-between; align-items: center; }
.speaking { font-size: 13px; color: var(--ambre-700); font-weight: 700; }
.cur {
  font-size: clamp(88px, 13vw, 150px); line-height: 1; font-weight: 800;
  color: var(--vert-700); letter-spacing: -3px; font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}
.cur.idle { color: #b7c7bc; }
.cur.bump { animation: bump .35s ease-out; }
@keyframes bump { from { transform: scale(.94); opacity: .4; } to { transform: none; opacity: 1; } }
.recent-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; min-height: 34px; }
.recent { display: flex; gap: 8px; margin: 0; padding: 0; list-style: none; flex-wrap: wrap; }
.recent li {
  padding: 4px 12px; border-radius: 10px; background: var(--vert-50); color: var(--vert-700);
  font-weight: 800; font-variant-numeric: tabular-nums;
}
.recent:empty::after { content: "—"; color: var(--doux); }

/* ---------- Boutons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 56px; padding: 0 22px; border: 0; border-radius: 14px; cursor: pointer;
  font-weight: 800; letter-spacing: .4px;
  transition: transform .08s ease, filter .15s ease, opacity .15s;
  touch-action: manipulation;
}
.btn:active:not(:disabled) { transform: scale(.98); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn:focus-visible { outline: 3px solid #7cc8ff; outline-offset: 2px; }

.actions { display: grid; gap: 14px; }
.next {
  flex-direction: column; gap: 4px; min-height: 150px;
  background: linear-gradient(180deg, var(--vert-500), var(--vert-700)); color: #fff;
  box-shadow: 0 6px 0 var(--vert-900);
}
.next:active:not(:disabled) { transform: translateY(4px); box-shadow: 0 2px 0 var(--vert-900); }
.next .big { font-size: clamp(34px, 5vw, 48px); }
.next .sub { font-size: 16px; font-weight: 600; opacity: .9; }
.next .sub b { font-weight: 800; }
.recall { min-height: 72px; font-size: 22px; background: #fff4e0; color: var(--ambre-700); border: 2px solid #ffd591; }
.recall svg { width: 26px; height: 26px; fill: currentColor; }

.manual label, .ticker label { display: block; margin-bottom: 8px; font-weight: 800; }
.ticker label small { font-weight: 600; color: var(--doux); }
.row { display: flex; align-items: center; }
.row.gap { gap: 10px; } .row.end { justify-content: flex-end; } .row.between { justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.manual .row { gap: 10px; }
.manual input {
  flex: 1; min-width: 0; height: 56px; padding: 0 16px;
  border: 2px solid var(--ligne); border-radius: 14px; background: #fff;
  font-size: 24px; font-weight: 800; text-transform: uppercase; letter-spacing: 1px;
}
.manual input::placeholder { text-transform: none; font-weight: 600; letter-spacing: 0; color: #9aa9a0; }
.manual input:focus { outline: none; border-color: var(--vert-500); }
.manual input.invalid { border-color: var(--rouge); background: var(--rouge-50); }
.call { background: var(--vert-700); color: #fff; }
.hint { margin: 8px 0 0; font-size: 13px; color: var(--doux); }
.hint.err { color: var(--rouge); }
.hint b { color: var(--vert-700); }

.ticker { display: flex; flex-direction: column; gap: 12px; align-self: start; }
.ticker textarea {
  width: 100%; resize: vertical; min-height: 96px; padding: 12px 14px;
  border: 2px solid var(--ligne); border-radius: 14px; font-weight: 600; line-height: 1.4;
}
.ticker textarea:focus { outline: none; border-color: var(--vert-500); }
.preview { display: flex; height: 40px; border-radius: 10px; overflow: hidden; background: var(--vert-900); color: #fff; font-size: 14px; font-weight: 700; }
.preview .tag { display: flex; align-items: center; padding: 0 12px; background: #d32f2f; }
.preview .pv { position: relative; flex: 1; overflow: hidden; }
.preview .pv span { position: absolute; top: 50%; left: 0; white-space: nowrap; padding-left: 100%; transform: translateY(-50%); animation: pv 14s linear infinite; }
@keyframes pv { to { transform: translate(-100%, -50%); } }
.count { font-size: 13px; color: var(--doux); }
.secondary { background: var(--vert-700); color: #fff; }
.ghost { background: transparent; color: var(--doux); border: 2px solid var(--ligne); }

.danger { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; border-color: #f3c9c5; }
.danger p { margin: 4px 0 0; color: var(--doux); font-size: 14px; }
.danger-btn { background: #fff; color: var(--rouge); border: 2px solid var(--rouge); }
dialog .danger-btn { background: var(--rouge); color: #fff; }

.kbd { margin: 0; text-align: center; color: var(--doux); font-size: 13px; }
kbd { padding: 2px 7px; border: 1px solid var(--ligne); border-bottom-width: 2px; border-radius: 6px; background: #fff; font-family: inherit; }

/* ---------- Dialogues & toast ---------- */
dialog { width: min(440px, calc(100vw - 32px)); border: 0; border-radius: 18px; padding: 24px; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
dialog::backdrop { background: rgba(7,58,31,.45); }
dialog h2 { margin: 0 0 8px; font-size: 22px; }
dialog p { color: var(--doux); margin: 0 0 20px; line-height: 1.5; }
#pinInput { width: 100%; height: 56px; margin-bottom: 16px; padding: 0 16px; border: 2px solid var(--ligne); border-radius: 14px; font-size: 26px; letter-spacing: 6px; }

.toast {
  position: fixed; left: 50%; bottom: 24px; z-index: 20;
  max-width: calc(100vw - 32px); padding: 14px 20px; border-radius: 12px;
  background: #1d2b22; color: #fff; font-size: 15px;
  transform: translate(-50%, calc(100% + 40px)); visibility: hidden; transition: transform .25s ease, visibility .25s;
}
.toast.show { transform: translate(-50%, 0); visibility: visible; }
.toast.err { background: var(--rouge); }

@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
