/* hub/public/tema.css
 *
 * O sistema visual das páginas do hub — a folha "Tema" do canvas de design
 * (docs/design/Tema.dc.html; docs/UI-UX.md, seções 2.3 e 6), na identidade do
 * Lean AI Summit 2026: violeta-preto, magenta só como ação primária, Montserrat
 * para títulos e DM Sans para o texto.
 *
 * UMA FOLHA PARA AS SETE PÁGINAS. Cada uma tinha o próprio bloco `:root` com
 * cores parecidas e não iguais; a partir daqui só as variáveis semânticas são
 * usadas, e o que for específico de uma página fica no <style> dela.
 *
 * ESCURO POR PADRÃO. App, telão, OBS e monitor são telas de sala e de parede,
 * e ficam sempre escuras. Painel, administração e início seguem o sistema e
 * têm um botão de alternar, lembrado por dispositivo (`data-tema` no <html>).
 * O magenta do evento é o destaque de AÇÃO, nunca um estado — por isso o
 * crítico é vermelho-laranja, para não se confundir com um botão.
 *
 * O telão não usa esta folha: ele tem os próprios temas (preto, violeta e
 * claro) em telao.html, porque o preto puro ali é uma decisão de projeção.
 */

@import url('./fontes.css');

/* ---- paleta semântica: escuro é o padrão ------------------------------- */
:root {
  color-scheme: dark;
  --bg: #0d0320;            /* fundo */
  --surface: #160a33;       /* superfície: cartões, cabeçalhos */
  --surface-hi: #1f1145;    /* superfície alta: hover, campos */
  --line: #2f1f5c;          /* linha */
  /* O canvas usa #5c4d82 aqui; 2,5:1 sobre a superfície. Um passo mais claro
     chega aos 3:1 que um componente de interface precisa (WCAG 1.4.11). */
  --line-strong: #6b5c94;   /* borda de botão secundário */
  --fg: #f7f4ff;            /* texto */
  --fg-soft: #c9bde6;       /* texto secundário forte (monitor) */
  --muted: #9b8abf;         /* apagado */
  --accent: #f20587;        /* destaque — só ação primária */
  --accent-soft: #ff5fb0;   /* destaque sobre fundo muito escuro (rótulos) */
  /* Branco sobre #f20587 dá 4,1:1 — abaixo dos 4,5:1 que o UI-UX.md exige.
     Como FUNDO de botão, o magenta desce um passo (#dc0479, 4,8:1 com o
     branco) e continua o mesmo magenta aos olhos. Como texto e borda sobre o
     escuro, o #f20587 original fica (4,9:1). */
  --accent-fill: #dc0479;
  --on-accent: #ffffff;
  --ok: #2fd08a;            /* discreto */
  --warn: #f5b301;
  --crit: #ff4d3d;          /* o único que pulsa */
  --on-crit: #0d0320;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
  /* Texto decorativo do canvas (metadados, horas): abaixo de 4,5:1 de propósito
     e nunca o único portador de uma informação. */
  --faint: #5c4d82;
  --tab-active: #2a1160;
  --fundo-passo: #1a0d3d;

  --font-title: Montserrat, 'DM Sans', 'Segoe UI', system-ui, sans-serif;
  --font-text: 'DM Sans', 'Segoe UI', system-ui, Roboto, Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, Consolas, 'Cascadia Mono', monospace;
}

/*
 * Tema claro: derivado da paleta do canvas para o telão claro
 * (docs/design/TelaoClaro.dc.html — fundo #f7f4ff, texto #0d0320, magenta
 * escurecido #c0046a para manter contraste sobre o claro). O canvas só
 * desenhou o escuro para as páginas de operação; estes valores são a
 * transposição, conferidos a 4,5:1 sobre o fundo e sobre a superfície.
 */
:root[data-tema="claro"] {
  color-scheme: light;
  --bg: #f7f4ff;
  --surface: #ffffff;
  --surface-hi: #efe9ff;
  --line: #ddd4f2;
  --line-strong: #9b8abf;
  --fg: #0d0320;
  --fg-soft: #2f1f5c;
  --muted: #5c4d82;
  --accent: #c0046a;
  --accent-soft: #c0046a;
  --accent-fill: #c0046a;
  --on-accent: #ffffff;
  --ok: #157a4d;
  --warn: #8a6300;
  --crit: #c8281b;
  --on-crit: #ffffff;
  --shadow: 0 10px 30px rgba(13, 3, 32, .10);
  --faint: #8478a8;
  --tab-active: #e6dcff;
  --fundo-passo: #f0e9ff;
}

/* Páginas que SEGUEM o sistema quando ninguém escolheu (painel, admin, início). */
@media (prefers-color-scheme: light) {
  :root[data-tema="auto"] {
    color-scheme: light;
    --bg: #f7f4ff;
    --surface: #ffffff;
    --surface-hi: #efe9ff;
    --line: #ddd4f2;
    --line-strong: #9b8abf;
    --fg: #0d0320;
    --fg-soft: #2f1f5c;
    --muted: #5c4d82;
    --accent: #c0046a;
    --accent-soft: #c0046a;
    --accent-fill: #c0046a;
    --on-accent: #ffffff;
    --ok: #157a4d;
    --warn: #8a6300;
    --crit: #c8281b;
    --on-crit: #ffffff;
    --shadow: 0 10px 30px rgba(13, 3, 32, .10);
    --faint: #8478a8;
    --tab-active: #e6dcff;
    --fundo-passo: #f0e9ff;
  }
}

/* ---- base ---------------------------------------------------------------- */
* { box-sizing: border-box; }
/* `display` de componente nao pode vencer o atributo hidden. */
[hidden] { display: none !important; }
html, body { background: var(--bg); color: var(--fg); }
body {
  margin: 0;
  font-family: var(--font-text);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, .titulo {
  font-family: var(--font-title);
  font-weight: 800;
  letter-spacing: -0.01em;
  margin: 0;
}
h1 { font-size: 26px; }
h2 { font-size: 20px; }
h3 { font-size: 17px; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code, pre, .mono { font-family: var(--font-mono); }

/* Rótulo de seção: pequeno, apagado, espaçado — como no canvas. */
.rotulo {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ---- botões: uma ação primária por contexto ------------------------------ */
button, .btn {
  font: inherit;
  font-weight: 600;
  font-size: 14px;
  color: var(--fg);
  background: transparent;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  padding: 9px 14px;
  cursor: pointer;
  white-space: nowrap;
  transition: background .12s, border-color .12s, color .12s, opacity .12s;
}
button:hover, .btn:hover { background: var(--surface-hi); }
button:focus-visible, .btn:focus-visible, input:focus-visible, select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
button.primary, .btn.primary {
  background: var(--accent-fill);
  border-color: var(--accent-fill);
  color: var(--on-accent);
  font-weight: 700;
}
button.primary:hover, .btn.primary:hover { filter: brightness(1.08); background: var(--accent-fill); }
button.danger, .btn.danger { border-color: var(--crit); color: var(--crit); }
button.danger:hover, .btn.danger:hover { background: color-mix(in srgb, var(--crit) 12%, transparent); }
button.danger.primary, .btn.danger.primary { background: var(--crit); color: var(--on-crit); }
button[disabled], .btn[disabled] {
  border-color: var(--line);
  color: var(--line-strong);
  background: transparent;
  cursor: not-allowed;
  filter: none;
}
/* Ocupado: o botão continua no lugar, com o texto do que está fazendo. */
button.ocupado, .btn.ocupado { opacity: .7; cursor: progress; }

/* Botão só de ícone / discreto (fechar, legenda). */
button.discreto { border-color: transparent; color: var(--muted); padding: 6px 10px; }
button.discreto:hover { color: var(--fg); }

/* ---- campos ---------------------------------------------------------------- */
input:not([type]), input[type=text], input[type=password], input[type=number], input[type=search], select, textarea {
  font: inherit;
  font-size: 14px;
  color: var(--fg);
  background: var(--surface-hi);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 12px;
}
input::placeholder { color: var(--muted); opacity: .8; }
select { padding-right: 28px; }
input[type=checkbox] { accent-color: var(--accent); width: 16px; height: 16px; }

/* ---- superfícies ------------------------------------------------------------ */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px 18px;
}
.card .sub, .sub { color: var(--muted); font-size: 13px; font-weight: 500; }
hr, .separador { border: 0; border-top: 1px solid var(--line); margin: 0; }

/* ---- estado: texto + cor + forma ------------------------------------------ */
/* A forma acompanha a cor porque cor sozinha não é acessível (UI-UX 2.4). */
.estado {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
  font-size: 12.5px;
  letter-spacing: .02em;
}
.estado::before {
  content: '';
  display: inline-block;
  width: 9px;
  height: 9px;
  flex: none;
  background: currentColor;
}
.estado.ok { color: var(--ok); }
.estado.ok::before { border-radius: 50%; }                      /* círculo */
.estado.warn { color: var(--warn); }
.estado.warn::before {                                            /* triângulo */
  width: 0; height: 0; background: transparent;
  border-left: 5px solid transparent; border-right: 5px solid transparent;
  border-bottom: 9px solid currentColor;
}
.estado.crit { color: var(--crit); }
.estado.crit::before { border-radius: 2px; }                     /* quadrado */
.estado.neutro { color: var(--muted); }
.estado.neutro::before {                                          /* anel */
  background: transparent; border: 2px solid currentColor; border-radius: 50%;
  width: 7px; height: 7px;
}

/* Chip: informação curta, arredondada. */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--line);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
}
.chip.ok { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 30%, transparent); background: color-mix(in srgb, var(--ok) 12%, transparent); }
.chip.err, .chip.crit { color: var(--crit); border-color: color-mix(in srgb, var(--crit) 30%, transparent); background: color-mix(in srgb, var(--crit) 12%, transparent); }
.chip.reconnecting, .chip.warn { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 30%, transparent); background: color-mix(in srgb, var(--warn) 12%, transparent); }

/* Aviso persistente: fundo tingido, barra à esquerda. */
.aviso {
  background: color-mix(in srgb, var(--warn) 14%, transparent);
  border-left: 4px solid var(--warn);
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13.5px;
  margin: 10px 0;
}
.aviso.crit { background: color-mix(in srgb, var(--crit) 14%, transparent); border-left-color: var(--crit); }
.aviso.info { background: color-mix(in srgb, var(--accent) 10%, transparent); border-left-color: var(--accent); }

/* Toast */
.toast {
  position: fixed;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%);
  background: var(--fg);
  color: var(--bg);
  padding: 10px 16px;
  border-radius: 10px;
  font-size: 13.5px;
  font-weight: 600;
  max-width: 90vw;
  opacity: 0;
  transition: opacity .2s;
  pointer-events: none;
  box-shadow: var(--shadow);
  z-index: 40;
}
.toast.show { opacity: 1; }

/* Diálogo */
dialog {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  color: var(--fg);
  padding: 0;
  box-shadow: var(--shadow);
}
dialog::backdrop { background: rgba(13, 3, 32, .65); }

/* Tabela leve */
table.leve { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.leve th { text-align: left; font-weight: 700; color: var(--muted); font-size: 12px; letter-spacing: .06em; text-transform: uppercase; padding: 4px 8px 8px 0; }
table.leve td { padding: 8px 8px 8px 0; border-top: 1px solid var(--line); vertical-align: middle; }

/* Medidor de nível */
.meter { display: grid; grid-template-columns: 5.5em 1fr 4.5em; gap: 8px; align-items: center; font-size: 12.5px; color: var(--muted); }
.meter .bar { height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; }
.meter .bar i { display: block; height: 100%; background: var(--ok); transition: width .3s; }
.meter .bar.quiet i { background: var(--warn); }

/* Alternância de tema (painel, admin, início). */
.tema-toggle { font-size: 12.5px; }

/* Movimento: só o crítico pulsa, e quem pediu menos movimento não vê nada pulsar. */
@keyframes pulso { 0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--crit) 45%, transparent); } 50% { box-shadow: 0 0 0 6px color-mix(in srgb, var(--crit) 0%, transparent); } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ---- componentes do canvas (docs/design/Main, Inicio, Admin, Monitor) ------ */
.topbar { height: 60px; display: flex; align-items: center; gap: 14px; padding: 0 32px; border-bottom: 1px solid var(--line); background: var(--bg); flex: 0 0 auto; }
.topbar .logo { font-family: var(--font-title); font-weight: 800; font-size: 19px; letter-spacing: -0.01em; color: var(--fg); text-decoration: none; }
.topbar .evento { font-size: 13px; color: var(--muted); font-weight: 500; }
.topbar .direita { margin-left: auto; display: flex; align-items: center; gap: 16px; font-size: 13px; color: var(--muted); }
.topbar .direita a { color: var(--muted); font-weight: 500; }
.topbar .direita .ao-vivo { display: flex; align-items: center; gap: 8px; }
.topbar .versao { font-size: 12px; color: var(--faint); font-weight: 500; }
.miolo { width: min(1180px, 100%); margin: 0 auto; padding: 28px 32px 40px; box-sizing: border-box; display: flex; flex-direction: column; gap: 20px; }
.ponto { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); display: inline-block; flex: none; }
.ponto.warn { background: var(--warn); } .ponto.crit { background: var(--crit); } .ponto.neutro { background: var(--muted); }
.num { font-variant-numeric: tabular-nums; }
.faint { color: var(--faint); }

/* Abas em pílula: a ativa ganha um fundo, as outras só a cor apagada. */
.tabs-pill { display: flex; gap: 4px; }
.tabs-pill button { border: 0; padding: 8px 14px; border-radius: 8px; color: var(--muted); font-weight: 500; font-size: 14px; background: transparent; }
.tabs-pill button.active { background: var(--tab-active); color: var(--fg); font-weight: 600; }
.tabs-pill button:hover { background: var(--surface-hi); }

/* Botão quadrado de ícone (tema, ajuda). */
button.icone { width: 36px; height: 36px; padding: 0; display: grid; place-items: center; border-color: var(--line); color: var(--muted); }
button.icone:hover { color: var(--fg); }
/* Ação em texto, sem caixa: "recriar…", "desmarcar", "fechar". */
button.texto { border: 0; padding: 4px 6px; font-size: 13px; color: var(--faint); font-weight: 500; background: transparent; }
button.texto:hover { color: var(--fg); background: transparent; }

/* Interruptor. */
.switch { position: relative; width: 46px; height: 28px; border-radius: 999px; background: var(--line); border: 0; padding: 0; cursor: pointer; flex: 0 0 auto; }
.switch::after { content: ''; position: absolute; left: 3px; top: 3px; width: 22px; height: 22px; border-radius: 50%; background: var(--muted); transition: left .15s, background .15s; }
.switch[aria-checked="true"] { background: var(--accent-fill); }
.switch[aria-checked="true"]::after { left: 21px; background: #fff; }
.switch.pequeno { width: 34px; height: 20px; }
.switch.pequeno::after { width: 16px; height: 16px; left: 2px; top: 2px; }
.switch.pequeno[aria-checked="true"]::after { left: 16px; }
label.com-switch { display: flex; align-items: center; gap: 8px; cursor: pointer; }

/* Controle segmentado. */
.seg { display: flex; gap: 2px; padding: 3px; border-radius: 10px; background: var(--bg); border: 1px solid var(--line); }
.seg button { border: 0; padding: 8px 14px; border-radius: 7px; color: var(--muted); font-weight: 500; font-size: 13px; background: transparent; }
.seg button.on { background: var(--accent-fill); color: #fff; font-weight: 700; }

/* Marcadores de passo: concluído, atual, futuro. */
.check { width: 24px; height: 24px; border-radius: 50%; background: var(--ok); color: var(--bg); display: grid; place-items: center; flex: 0 0 auto; }
.check svg { width: 13px; height: 13px; }
.check.p { width: 16px; height: 16px; } .check.p svg { width: 10px; height: 10px; }
.anel { width: 24px; height: 24px; border-radius: 50%; border: 2.5px solid var(--accent); box-sizing: border-box; display: grid; place-items: center; flex: 0 0 auto; }
.anel::after { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.futuro { width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--line-strong); box-sizing: border-box; flex: 0 0 auto; }

/* Pílula de estado com o check dentro ("Interpretando", "Inglês"). */
.pill-ok { display: inline-flex; align-items: center; gap: 8px; padding: 6px 10px 6px 8px; border-radius: 999px; background: color-mix(in srgb, var(--ok) 12%, transparent); color: var(--ok); font-size: 13px; font-weight: 700; }
.pill-lang { display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); font-size: 13px; font-weight: 600; color: var(--fg); }

/* Cartão-link da página inicial. */
.link-card { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 10px; background: var(--surface-hi); border: 1px solid var(--line); color: var(--fg); text-decoration: none; }
.link-card:hover { border-color: var(--line-strong); text-decoration: none; }
.link-card svg { flex: none; }
.link-card b { display: block; font-weight: 600; font-size: 14px; }
.link-card span { display: block; font-size: 12px; color: var(--muted); }

/* Faixa de resultado da última ação, persistente. */
.banner-ok { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: 10px; background: color-mix(in srgb, var(--ok) 8%, transparent); border: 1px solid color-mix(in srgb, var(--ok) 25%, transparent); font-size: 14px; }
.banner-ok.falhou { background: color-mix(in srgb, var(--crit) 8%, transparent); border-color: color-mix(in srgb, var(--crit) 30%, transparent); }
.banner-ok .icone-ok { color: var(--ok); display: grid; place-items: center; }
.banner-ok.falhou .icone-ok { color: var(--crit); }

/* Etiqueta pequena ("padrão do deploy", "definido aqui"). */
.tag { display: inline-block; padding: 3px 8px; border-radius: 5px; background: var(--surface-hi); color: var(--faint); font-size: 11px; font-weight: 600; letter-spacing: .02em; white-space: nowrap; }
.tag.admin { background: color-mix(in srgb, var(--muted) 14%, transparent); color: var(--muted); }
.tag.warn { background: color-mix(in srgb, var(--warn) 14%, transparent); color: var(--warn); }

@media (max-width: 720px) {
  .topbar { height: auto; flex-wrap: wrap; padding: 12px 16px; gap: 10px; }
  .topbar .direita { width: 100%; margin-left: 0; }
  .miolo { padding: 16px 16px 32px; }
}
