/* VMS — tema claro.
   Névoa fria de fundo, folhas brancas, tinta escura. A cor só aparece para
   dizer algo: vermelho = ao vivo/gravando, petróleo = foco e item ativo.
   O white-label por cliente troca --accent e --tl-needle. */
[hidden] { display: none !important; } /* regras de display não podem reexibir elementos ocultos */

:root {
  --bg: #eef1f0;
  --surface: #ffffff;
  --sunk: #f4f6f5;
  --ink: #182124;
  --muted: #5f6c70;
  --faint: #94a0a3;
  --line: #dce2e1;
  --accent: #22575e;
  --live: #cf3d33;
  --ok: #2e7d5b;
  --warn: #b7791f;
  --off: #b4423a;
  --stage: #0f1416;

  --tl-bg: #ffffff;
  --tl-track: #f1f4f3;
  --tl-rec: #9fc3b8;
  --tl-motion: #d49a3a;
  --tl-object: #c2553f;
  --tl-text: #182124;
  --tl-muted: #7d898c;
  --tl-grid: #e6ebea;
  --tl-needle: #182124;
  --tl-future: rgba(24, 33, 36, 0.045);
  --tl-window: rgba(34, 87, 94, 0.1);
  --tl-mask: rgba(238, 241, 240, 0.7);

  --font: "Segoe UI Variable Text", "Segoe UI", "SF Pro Text", -apple-system, "Noto Sans", Cantarell, system-ui, sans-serif;
  --radius: 8px;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.45 var(--font);
  font-variant-numeric: tabular-nums;
}
h1, h2, h3 { font-weight: 600; letter-spacing: -0.01em; margin: 0; }
h2 { font-size: 20px; }
h3 { font-size: 15px; }
a { color: var(--accent); }
code { font-size: 13px; }
.muted { color: var(--muted); }
.spacer { flex: 1; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ---- controles ---- */
button, select, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { opacity: 0.4; cursor: default; }

/* Botão padrão: texto, sem caixa. A ação principal de cada tela é escura. */
button, .text-btn {
  display: inline-flex; align-items: center; gap: 6px;
  background: none; border: 0; border-radius: var(--radius);
  padding: 7px 10px; color: var(--ink);
}
button:hover:not(:disabled), .text-btn:hover { background: var(--sunk); }
.btn-primary, button.primary-solid {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--ink); color: #fff; border: 0; border-radius: var(--radius);
  padding: 8px 14px; font-weight: 600; text-decoration: none; cursor: pointer;
}
.btn-primary:hover, button.primary-solid:hover:not(:disabled) { background: #2a3539; }
a.btn-primary.disabled { opacity: 0.35; pointer-events: none; }
button.danger { color: var(--off); }
button.danger.armed { background: var(--off); color: #fff; }

button.icon { padding: 6px; }
button svg, .text-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

input, select, textarea {
  background: var(--sunk); border: 1px solid transparent; border-radius: var(--radius);
  padding: 7px 10px; min-width: 0;
}
input:hover, select:hover { border-color: var(--line); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); background: var(--surface); }
input[type="checkbox"] { accent-color: var(--ink); width: 16px; height: 16px; padding: 0; }

/* ---- cabeçalho ---- */
.bar {
  display: flex; align-items: center; gap: 20px;
  height: 52px; padding: 0 24px;
  background: var(--surface); border-bottom: 1px solid var(--line);
}
.brand { font-size: 15px; font-weight: 600; letter-spacing: -0.01em; display: inline-flex; align-items: center; gap: 8px; }

main { max-width: 1360px; margin: 0 auto; padding: 20px 24px 40px; }

/* ---- visualizador ---- */
.vw { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 20px; align-items: start; }
.vw.single { grid-template-columns: minmax(0, 1fr); }
.vw-cams { display: flex; flex-direction: column; gap: 2px; position: sticky; top: 20px; max-height: calc(100vh - 120px); overflow: auto; }
.vw-cams button { flex-direction: column; align-items: flex-start; gap: 1px; padding: 8px 12px; text-align: left; border-radius: var(--radius); }
.vw-cams button[aria-current="true"] { background: var(--surface); box-shadow: inset 2px 0 0 var(--accent); }
.cam-name { font-weight: 500; }
.cam-sub { font-size: 12px; color: var(--muted); }

.stage { position: relative; background: var(--stage); border-radius: 12px; overflow: hidden; aspect-ratio: 16 / 9; }
.stage video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; display: block; }
.stage-top {
  position: absolute; inset: 0 0 auto 0; display: flex; justify-content: space-between; align-items: flex-start;
  padding: 14px 16px 28px; color: #fff; pointer-events: none;
  background: linear-gradient(rgba(0, 0, 0, 0.45), transparent);
}
.stage-name { font-weight: 600; margin-right: 12px; }
.stage-state { font-size: 13px; opacity: 0.85; }
.stage-state.live { opacity: 1; }
.stage-state.live::before {
  content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  background: var(--live); margin-right: 6px; vertical-align: 1px;
}
.stage-clock { font-size: 15px; font-weight: 500; letter-spacing: 0.01em; }
.notice {
  position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%);
  background: rgba(255, 255, 255, 0.95); color: var(--ink);
  padding: 7px 14px; border-radius: var(--radius); font-size: 13px;
}

.toolbar { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; padding: 10px 0 8px; }
.tb-group { display: inline-flex; align-items: center; gap: 2px; margin-left: 8px; }
.go-live { font-weight: 600; padding: 7px 12px; }
.go-live::before { content: ""; width: 8px; height: 8px; border-radius: 50%; border: 1.5px solid var(--live); margin-right: 2px; }
.go-live.on { color: var(--live); }
.go-live.on::before { background: var(--live); }
.speed select {
  appearance: none; -webkit-appearance: none; background: none; padding: 6px 10px;
  font-weight: 500; text-align: center; cursor: pointer;
}
.speed select:hover { background: var(--sunk); }
.scale { min-width: 50px; text-align: center; color: var(--muted); font-size: 13px; }

.export-box { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 2px 0 10px; padding: 12px 14px; background: var(--surface); border-radius: var(--radius); }
.export-box label { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); }

.timeline { width: 100%; user-select: none; border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.timeline-canvas { display: block; cursor: crosshair; touch-action: none; outline: none; }

.live-only .pb-only { display: none !important; }
.no-export .export-only { display: none !important; }

@media (max-width: 900px) {
  .vw { grid-template-columns: minmax(0, 1fr); }
  .vw-cams { position: static; flex-direction: row; overflow-x: auto; max-height: none; }
  .vw-cams button { flex: 0 0 auto; }
  main { padding: 12px; }
  .bar { padding: 0 12px; gap: 12px; }
}

/* ---- interruptor (checkbox role=switch) ---- */
input.switch {
  appearance: none; -webkit-appearance: none; flex: none;
  position: relative; width: 36px; height: 20px; margin: 0; padding: 0;
  border: 0; border-radius: 10px; background: #c9d1d0; cursor: pointer;
  transition: background-color 0.15s;
}
input.switch::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px;
  border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(24, 33, 36, 0.25);
  transition: transform 0.15s;
}
input.switch:hover { background: #b8c2c1; }
input.switch:checked { background: var(--accent); }
input.switch:checked::after { transform: translateX(16px); }
input.switch:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
