:root {
  --bg: #0f1115;
  --panel: #171a21;
  --panel-2: #1f232c;
  --line: #2a2f3a;
  --text: #e8eaf0;
  --muted: #9aa1b2;
  --accent: #4f8cff;
  --ok: #2fbf71;
  --warn: #f0a33a;
  --bad: #e5484d;
  --radius: 10px;
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font-size: 15px; line-height: 1.45; }
h1 { font-size: 1.25rem; margin: 0; font-weight: 600; }
h2 { font-size: 0.8rem; margin: 0 0 0.6rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 0.82rem; }

header.top {
  display: flex; align-items: center; gap: 1rem; justify-content: space-between;
  padding: 0.8rem 1.2rem; border-bottom: 1px solid var(--line); background: var(--panel);
}

button, input, textarea, select {
  font: inherit; color: inherit;
}
button {
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px;
  padding: 0.5rem 0.9rem; cursor: pointer;
}
button:hover:not(:disabled) { border-color: var(--muted); }
button:disabled { opacity: 0.45; cursor: not-allowed; }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.danger { background: var(--bad); border-color: var(--bad); color: #fff; }
button.ok { background: var(--ok); border-color: var(--ok); color: #06130c; }
button.tiny { padding: 0.2rem 0.55rem; font-size: 0.8rem; }

input[type=text], input[type=password], textarea {
  width: 100%; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 0.55rem 0.7rem;
}
textarea { resize: vertical; min-height: 4.5rem; }
input:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; }

.pill { display: inline-flex; align-items: center; gap: 0.4rem; padding: 0.2rem 0.65rem; border-radius: 999px; font-size: 0.8rem; background: var(--panel-2); border: 1px solid var(--line); }
.pill .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.pill.live .dot { background: var(--bad); box-shadow: 0 0 0 3px rgba(229, 72, 77, 0.25); }
.pill.ok .dot { background: var(--ok); }
.pill.warn .dot { background: var(--warn); }

/* Vídeo */
.stage {
  position: relative; background: #000; border-radius: var(--radius); overflow: hidden; aspect-ratio: 16 / 9; width: 100%;
}
.stage video { width: 100%; height: 100%; object-fit: contain; display: block; }
.stage .placeholder {
  position: absolute; inset: 0; display: grid; place-items: center; text-align: center; padding: 1rem; color: var(--muted);
}

.center-box { max-width: 420px; margin: 12vh auto; padding: 0 1rem; }
.center-box form { display: grid; gap: 0.8rem; }
.error { color: var(--bad); font-size: 0.9rem; min-height: 1.2em; }
.notice { color: var(--ok); font-size: 0.9rem; min-height: 1.2em; }

/* Asistente */
.viewer-layout { max-width: 1100px; margin: 0 auto; padding: 1rem; display: grid; gap: 1rem; }
.current-q { border-left: 3px solid var(--accent); }
.current-q .who { color: var(--muted); font-size: 0.85rem; }
.ask-row { display: grid; gap: 0.5rem; }
.ask-row .actions { display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; }

/* Presentador */
.presenter-layout {
  display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(320px, 1fr); gap: 1rem; padding: 1rem;
  align-items: start;
}
@media (max-width: 900px) { .presenter-layout { grid-template-columns: 1fr; } }
.col { display: grid; gap: 1rem; }
.row { display: flex; gap: 0.6rem; align-items: center; flex-wrap: wrap; }
.row.spread { justify-content: space-between; }

.meter { position: relative; height: 14px; background: var(--bg); border: 1px solid var(--line); border-radius: 7px; overflow: hidden; }
.meter .fill { position: absolute; inset: 0 auto 0 0; width: 0; background: var(--ok); transition: width 60ms linear; }
.meter .fill.speaking { background: var(--accent); }
.meter .threshold { position: absolute; top: -2px; bottom: -2px; width: 2px; background: var(--warn); }

.mic-btn { font-size: 1rem; padding: 0.8rem 1.2rem; min-width: 11rem; }
.mic-btn.on { background: var(--ok); border-color: var(--ok); color: #06130c; }
.speaking-flag { font-weight: 600; color: var(--accent); }

label.field { display: grid; gap: 0.3rem; font-size: 0.85rem; color: var(--muted); }
input[type=range] { width: 100%; accent-color: var(--accent); }

.qlist { display: grid; gap: 0.5rem; max-height: 55vh; overflow: auto; padding-right: 0.2rem; }
.q { background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 0.6rem 0.7rem; display: grid; gap: 0.4rem; }
.q.answering { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.q.answered, .q.dismissed { opacity: 0.5; }
.q .meta { font-size: 0.78rem; color: var(--muted); display: flex; justify-content: space-between; }
.q .btns { display: flex; gap: 0.35rem; flex-wrap: wrap; }

.log { font-family: ui-monospace, Consolas, monospace; font-size: 0.78rem; max-height: 160px; overflow: auto; color: var(--muted); white-space: pre-wrap; }
.tabs { display: flex; gap: 0.3rem; }
.tabs button.active { border-color: var(--accent); color: var(--accent); }
kbd { background: var(--panel-2); border: 1px solid var(--line); border-radius: 4px; padding: 0 0.35rem; font-size: 0.8rem; }
