/* Painel do Bypass7 Project
   Mesma família do portão de entrada: tinta escura, âmbar como única cor de ação,
   Archivo no display, monoespaçada só para dado de máquina (id, chave, aparelho,
   carimbo de tempo) e canto de 3px. Sem duas sombras, sem gradiente decorativo. */

/* A fonte vem de casa, não do Google.

   Antes o painel buscava a Archivo em `fonts.googleapis.com` — num painel de
   admins isso é ruim duas vezes: cada visita do dono avisa um terceiro (com o IP
   dele) que ele abriu o painel, e o painel fica dependente de um CDN de fora para
   desenhar. O arquivo abaixo é o mesmo que o Google servia para os pesos 500, 600
   e 800 (é o mesmo binário nos três — conferido por md5), então o desenho não
   muda; só deixou de haver pedido para fora. Com isso o CSP fecha: nenhuma origem
   externa é permitida. */
@font-face {
  font-family: 'Archivo';
  font-style: normal;
  font-weight: 500 800;
  font-display: swap;
  src: url('/static/fonts/archivo.woff2') format('woff2');
}

:root {
  --ink: #0d0f12;
  --well: #0f1216;
  --panel: #16191e;
  --panel-2: #1c2027;
  --raise: #22272f;
  --line: #272c34;
  --line-soft: #1f242b;
  --amber: #f0a419;
  --amber-deep: #a86c07;
  --paper: #ece9e3;
  --muted: #939caa;
  --steel: #6b7380;
  --danger: #e0554a;
  --ok: #4fb477;
  --info: #5b9dd9;

  --display: 'Archivo', 'Roboto Condensed', system-ui, sans-serif;
  --body: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mono: ui-monospace, 'SF Mono', 'Cascadia Mono', 'JetBrains Mono', Menlo, monospace;

  --rail: 244px;
  --drawer: 440px;
  --r: 3px;
}

* { box-sizing: border-box; }

/* O atributo hidden precisa vencer o display: flex/grid das classes abaixo.
   Sem isto, o portão e a mesa apareciam ao mesmo tempo. */
[hidden] { display: none !important; }

html, body { height: 100%; }

body {
  margin: 0;
  background: radial-gradient(120% 60% at 50% -10%, #23272e 0%, var(--ink) 55%);
  color: var(--paper);
  font: 15px/1.5 var(--body);
  -webkit-text-size-adjust: 100%;
}

button, input, select, textarea { font: inherit; color: inherit; }

a { color: var(--paper); }

:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 2px;
  border-radius: 2px;
}

.mono { font-family: var(--mono); font-size: 12.5px; letter-spacing: -0.01em; }
.muted { color: var(--muted); }
.steel { color: var(--steel); }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1 1 200px; min-width: 0; }

/* ------------------------------------------------------------ portão */

.gate {
  min-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 18px;
}

.gate-card {
  width: 100%;
  max-width: 430px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.brand { display: flex; align-items: baseline; gap: 8px; }
.brand strong { font-family: var(--display); font-weight: 800; font-size: 17px; letter-spacing: -0.02em; }
.brand span { font-size: 12px; color: var(--muted); }

.gate-step { display: flex; flex-direction: column; gap: 16px; }

.lead {
  margin: 0;
  font-family: var(--display);
  font-weight: 600;
  font-size: 21px;
  line-height: 1.25;
  letter-spacing: -0.025em;
}

.note { margin: 0; color: var(--muted); font-size: 13.5px; }

/* O canhoto do ingresso, o mesmo do portão de entrada: só onde há algo a preencher. */
.stub, .dispatch {
  position: relative;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 18px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.stub::before, .stub::after,
.dispatch::before, .dispatch::after {
  content: "";
  position: absolute;
  left: -9px; right: -9px;
  height: 9px;
  background-image: radial-gradient(circle at 50% 50%, var(--ink) 4.5px, transparent 5px);
  background-size: 14px 9px;
  background-repeat: repeat-x;
}

.stub::before, .dispatch::before { top: -1px; }
.stub::after, .dispatch::after { bottom: -1px; transform: rotate(180deg); }

.stub label, .field label {
  font-size: 11.5px;
  color: var(--muted);
}

.stub input {
  width: 100%;
  background: var(--well);
  border: 1px solid var(--line);
  border-radius: var(--r);
  color: var(--paper);
  font-family: var(--mono);
  font-size: 14px;
  padding: 12px;
}

.stub input::placeholder { color: #4d545e; }
.stub input:focus { outline: none; border-color: var(--amber-deep); box-shadow: 0 0 0 3px rgba(240,164,25,.13); }
.stub input[aria-invalid="true"] { border-color: var(--danger); }

.go {
  appearance: none;
  border: 0;
  border-radius: var(--r);
  width: 100%;
  min-height: 48px;
  padding: 13px 16px;
  font-family: var(--display);
  font-weight: 800;
  font-size: 15px;
  color: #1a1204;
  background: var(--amber);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.go:hover { background: #ffb93a; }
.go:active { background: var(--amber-deep); }
.go[disabled] { opacity: .5; cursor: default; }

.status { min-height: 18px; margin: 0; font-size: 13px; color: var(--muted); }
.status[data-tone="bad"] { color: #f08b82; }
.status[data-tone="good"] { color: var(--ok); }

.spinner {
  width: 14px; height: 14px; flex: none;
  border: 2px solid rgba(26,18,4,.35);
  border-top-color: #1a1204;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ------------------------------------------------------------ mesa */

.app {
  min-height: 100vh;
  display: grid;
  grid-template-columns: var(--rail) minmax(0, 1fr);
}

.rail {
  border-right: 1px solid var(--line);
  background: rgba(13,15,18,.6);
  padding: 18px 14px 14px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.operator {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--panel);
}

.operator .who {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--display);
  font-weight: 600;
  font-size: 14.5px;
  letter-spacing: -0.01em;
}

/* O único símbolo do painel: o escudo âmbar do dono. Marca a conta que manda. */
.operator .emblema { width: 15px; height: 15px; flex: none; color: var(--amber); }
tr .emblema { width: 13px; height: 13px; flex: none; margin-right: 6px; vertical-align: -2px; color: var(--amber); }
.operator .desc { font-size: 11.5px; color: var(--amber); }
.operator .id { font-family: var(--mono); font-size: 11.5px; color: var(--muted); }

.nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }

.nav .group {
  font-size: 11px;
  color: var(--steel);
  padding: 14px 10px 5px;
}

.nav button {
  appearance: none;
  background: none;
  border: 0;
  border-radius: var(--r);
  text-align: left;
  padding: 8px 10px 8px 26px;
  position: relative;
  font-family: var(--display);
  font-weight: 500;
  font-size: 13.5px;
  letter-spacing: -0.01em;
  color: var(--muted);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
}

/* Lâmpada de canal: o item ativo acende, como num mesa de som. */
.nav button::before {
  content: "";
  position: absolute;
  left: 10px; top: 50%;
  transform: translateY(-50%);
  width: 7px; height: 7px;
  border: 1px solid var(--line);
  background: transparent;
}

.nav button:hover { color: var(--paper); background: var(--panel); }
.nav button[aria-current="true"] { color: var(--paper); background: var(--panel-2); }
.nav button[aria-current="true"]::before { background: var(--amber); border-color: var(--amber); }
.nav .badge { font-family: var(--mono); font-size: 10.5px; color: var(--steel); }
.nav button[aria-current="true"] .badge { color: var(--amber); }

.linkstrip {
  border-top: 1px solid var(--line);
  padding-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 7px;
  font-size: 11.5px;
  color: var(--muted);
}

.linkstrip .line { display: flex; align-items: center; gap: 7px; }
.linkstrip .url { font-family: var(--mono); font-size: 10.5px; color: var(--steel); word-break: break-all; }

.lamp {
  width: 7px; height: 7px; flex: none;
  border: 1px solid var(--line);
  background: transparent;
}

.lamp.on { background: var(--ok); border-color: var(--ok); }
.lamp.off { background: var(--danger); border-color: var(--danger); }
.lamp.live { background: var(--amber); border-color: var(--amber); animation: pulse 2s ease-in-out infinite; }

@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .35; } }

.main { min-width: 0; display: flex; flex-direction: column; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 15px 22px;
  border-bottom: 1px solid var(--line);
  background: rgba(13,15,18,.92);
  backdrop-filter: blur(6px);
}

.topbar h1 {
  margin: 0;
  font-family: var(--display);
  font-weight: 600;
  font-size: 17px;
  letter-spacing: -0.02em;
}

.topbar .sub { margin: 2px 0 0; font-size: 12.5px; color: var(--muted); }
.topbar-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }

.view { padding: 20px 22px 60px; display: flex; flex-direction: column; gap: 22px; min-width: 0; }

.section {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}

.section > h2 {
  margin: 0;
  font-family: var(--display);
  font-weight: 600;
  font-size: 14px;
  letter-spacing: -0.01em;
}

.section > .hint { margin: -4px 0 0; font-size: 12.5px; color: var(--muted); max-width: 78ch; }

/* Painel de instrumentos: uma faixa só, dividida por fios. */
.readouts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--panel);
  overflow: hidden;
}

.readout {
  padding: 13px 15px;
  border-right: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.readout .n {
  font-family: var(--display);
  font-weight: 800;
  font-size: 24px;
  line-height: 1;
  letter-spacing: -0.03em;
}

.readout .n.warn { color: var(--amber); }
.readout .n.bad { color: var(--danger); }
.readout .n.good { color: var(--ok); }
.readout .k { font-size: 11.5px; color: var(--muted); }
.readout .m { font-family: var(--mono); font-size: 10.5px; color: var(--steel); }

/* Tabelas: densas, com fio, sem cartão por linha. */
.tablewrap { border: 1px solid var(--line); border-radius: var(--r); background: var(--panel); overflow-x: auto; }

table.grid { width: 100%; border-collapse: collapse; min-width: 620px; }

table.grid th {
  text-align: left;
  font-weight: 400;
  font-size: 11.5px;
  color: var(--muted);
  padding: 9px 12px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

table.grid td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--line-soft);
  font-size: 13.5px;
  vertical-align: middle;
}

table.grid tbody tr:last-child td { border-bottom: 0; }
table.grid tbody tr:hover { background: var(--panel-2); }
table.grid td.mach { font-family: var(--mono); font-size: 12.5px; color: #d7d3cb; }
table.grid td .sub2 { display: block; font-size: 11px; color: var(--steel); }

/* Uma coluna — a de texto (nome, motivo, apelido) — é quem absorve a sobra da
   largura. Sem isso o navegador divide o espaço sobrando entre TODAS as colunas
   e a tabela fica cheia de buracos no meio. Os números e botões ficam do tamanho
   do que têm dentro, sem quebrar em duas linhas. */
table.grid td[data-sobra] { width: 100%; }
/* Valor curto não quebra em duas linhas.

   `.nowrap` vai marcado nas células de valor curto que não são `.mach`/`.mono`
   — carimbo de tempo ("há 17 min"), data com prazo ("24/10/26 (em 12 d)"),
   medida ("169 ms"), situação por extenso ("Pausar acesso"). Sem isto a coluna
   encolhia até a palavra seguinte não caber e o painel ficava cheio de "83" em
   cima de "ms". A tabela é larga por natureza: quem não couber rola dentro do
   `.tablewrap`, que é o comportamento certo. */
table.grid td.mach, table.grid td.mono, table.grid td .pill,
table.grid td.nowrap { white-space: nowrap; }
/* A linha de apoio (id, login, plano…) pode quebrar, mas só entre palavras.

   Com `overflow-wrap: anywhere` a coluna podia encolher abaixo de uma palavra e
   o id do jogo saía fatiado letra por letra — "640220 / 918 / · / aparel / ho".
   Com `break-word` a coluna nunca fica menor que o pedaço mais largo, então o
   id aparece inteiro numa linha por mais apertada que ela esteja. */
table.grid td .sub2 { white-space: normal; overflow-wrap: break-word; }

/* Coluna de ações não se aperta: os botões ficam na linha em que nasceram. Fica
   ANTES da regra de `td.acoes` logo abaixo, que devolve a quebra de linha só para
   a tabela da partida — ali são nove comandos por jogador, e sim, eles quebram. */
table.grid td.right { white-space: nowrap; }

/* Conta que ainda espera os dados: listrada e mais apagada, para não se
   confundir com uma conta que já está de pé. */
table.grid tr.reservada td { background: rgba(22,25,30,.55); }
table.grid tr.reservada td:first-child { box-shadow: inset 2px 0 0 var(--amber-deep); }

/* A coluna de ações quebra linha em vez de esticar a tabela; o resto da linha
   não se mexe.

   Os botões ficam num bloco de largura máxima (`.flow`): sem ele, a célula pedia
   a largura de todos os botões numa linha só (9 comandos = 983px) e a tabela da
   partida esticava para 1463px, escondendo "Banir na hora" atrás da rolagem. Com
   o teto, eles quebram em duas linhas e a tabela cabe na tela. */
td.acoes { white-space: normal; }
td.acoes .flow {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  justify-content: flex-end;
  max-width: 620px;
  margin-left: auto;
}

.empty { padding: 22px; color: var(--muted); font-size: 13.5px; }

/* Etiquetas de estado */
.pill {
  display: inline-block;
  padding: 2px 8px;
  border: 1px solid var(--line);
  border-radius: 2px;
  font-size: 11.5px;
  font-family: var(--display);
  font-weight: 500;
  white-space: nowrap;
}

.pill.ok      { color: var(--ok);     border-color: rgba(79,180,119,.45);  background: rgba(79,180,119,.08); }
.pill.warn    { color: var(--amber);  border-color: rgba(240,164,25,.45);  background: rgba(240,164,25,.08); }
.pill.bad     { color: var(--danger); border-color: rgba(224,85,74,.45);   background: rgba(224,85,74,.08); }
.pill.info    { color: var(--info);   border-color: rgba(91,157,217,.45);  background: rgba(91,157,217,.08); }
.pill.quiet   { color: var(--muted); }

/* Botões */
.btn {
  appearance: none;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: var(--r);
  color: var(--paper);
  font-family: var(--display);
  font-weight: 500;
  font-size: 13px;
  padding: 8px 13px;
  cursor: pointer;
  white-space: nowrap;
}

.btn:hover { border-color: var(--steel); background: var(--panel-2); }
.btn.primary { background: var(--amber); border-color: var(--amber); color: #1a1204; font-weight: 600; }
.btn.primary:hover { background: #ffb93a; border-color: #ffb93a; }
.btn.danger { color: var(--danger); border-color: rgba(224,85,74,.5); }
.btn.danger:hover { background: rgba(224,85,74,.1); border-color: var(--danger); }
.btn.quiet { border-color: transparent; color: var(--muted); }
.btn.quiet:hover { color: var(--paper); border-color: var(--line); }
.btn.tiny { padding: 4px 9px; font-size: 12px; }
.btn[disabled] { opacity: .45; cursor: default; }

/* Coluna de ações da tabela da partida (aba Ao vivo): os comandos quebram em
   linhas dentro da célula em vez de esticar a tabela para fora da tela — era
   isso que cortava "Silenciar chat" e "Banir na hora" à direita. */
td.acoes { white-space: normal; }
td.acoes .btn { margin: 2px 0 2px 5px; }

/* Campos */
.field { display: flex; flex-direction: column; gap: 5px; }

.field input, .field select, .field textarea {
  background: var(--well);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 9px 11px;
  font-size: 13.5px;
  min-width: 0;
}

.field input.mach, .field textarea.mach { font-family: var(--mono); font-size: 12.5px; }
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none;
  border-color: var(--amber-deep);
  box-shadow: 0 0 0 3px rgba(240,164,25,.12);
}

.field input[aria-invalid="true"] { border-color: var(--danger); }
.field textarea { resize: vertical; min-height: 72px; font-family: var(--body); }

/* Filtros: a busca tem teto (antes ela esticava até a borda e empurrava os
   seletores e os botões para o canto, com um vão no meio), e o espaçador `.push`
   é quem come a sobra — assim o botão da direita fica na direita em qualquer
   largura, sem esticar o campo de texto. */
.filters {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  flex-wrap: wrap;
}

.filters .field { min-width: 150px; }
.filters .field.grow { flex: 1 1 240px; max-width: 430px; }
.push { flex: 1 1 0; min-width: 0; }

/* Interruptor */
.switch { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; font-size: 13px; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch .track {
  width: 34px; height: 19px; flex: none;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--well);
  position: relative;
  transition: background .15s ease, border-color .15s ease;
}
.switch .track::after {
  content: "";
  position: absolute;
  top: 2px; left: 2px;
  width: 13px; height: 13px;
  border-radius: 50%;
  background: var(--steel);
  transition: transform .15s ease, background .15s ease;
}
.switch input:checked + .track { background: rgba(240,164,25,.22); border-color: var(--amber-deep); }
.switch input:checked + .track::after { transform: translateX(15px); background: var(--amber); }
.switch input:focus-visible + .track { outline: 2px solid var(--amber); outline-offset: 2px; }

/* Alertas */
.alert { display: flex; gap: 11px; padding: 11px 13px; border: 1px solid var(--line); border-left-width: 2px; border-radius: var(--r); background: var(--panel); }
.alert .txt { font-size: 13.5px; }
.alert .det { font-size: 12px; color: var(--muted); margin-top: 2px; }
.alert.ok { border-left-color: var(--ok); }
.alert.info { border-left-color: var(--info); }
.alert.aviso { border-left-color: var(--amber); }
.alert.erro { border-left-color: var(--danger); }
.stack { display: flex; flex-direction: column; gap: 8px; }

/* Livro-caixa (histórico) */
.ledger { border: 1px solid var(--line); border-radius: var(--r); background: var(--panel); }
.ledger .linha {
  display: grid;
  grid-template-columns: 148px minmax(0, 1fr);
  gap: 14px;
  padding: 10px 13px;
  border-bottom: 1px solid var(--line-soft);
  font-size: 13px;
}
.ledger .linha:last-child { border-bottom: 0; }
.ledger .quando { font-family: var(--mono); font-size: 11.5px; color: var(--steel); }
.ledger .oquefez { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.ledger .alvo { font-family: var(--mono); font-size: 12px; }

/* Barra de vida.
   inline-block NÃO é enfeite: esta barra nasce dentro de um texto (o <span> da
   célula) e, como elemento inline, largura e altura são ignoradas — foi assim
   que a coluna "vida" aparecia como um risco de 1px no lugar da barra. */
.hp {
  display: inline-block;
  vertical-align: middle;
  flex: none;
  width: 76px;
  height: 6px;
  background: var(--well);
  border: 1px solid var(--line);
  position: relative;
}
.hp i { display: block; height: 100%; background: var(--ok); }
.hp.mid i { background: var(--amber); }
.hp.low i { background: var(--danger); }
.hp.dead i { background: var(--steel); width: 100% !important; opacity: .35; }

/* Gaveta de detalhes */
.drawer {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: min(var(--drawer), 94vw);
  background: var(--panel);
  border-left: 1px solid var(--line);
  padding: 16px 18px 40px;
  overflow-y: auto;
  z-index: 20;
  animation: slide .18s ease-out both;
}

@keyframes slide { from { transform: translateX(16px); opacity: .4; } to { transform: none; opacity: 1; } }

.drawer-close {
  appearance: none;
  background: none;
  border: 1px solid var(--line);
  border-radius: var(--r);
  color: var(--muted);
  font-family: var(--display);
  font-size: 12px;
  padding: 5px 10px;
  cursor: pointer;
  margin-bottom: 14px;
}

.drawer-close:hover { color: var(--paper); border-color: var(--steel); }
.drawer h2 { font-family: var(--display); font-weight: 600; font-size: 16px; margin: 0 0 2px; letter-spacing: -0.02em; }
.drawer .kv { display: grid; grid-template-columns: 128px minmax(0,1fr); gap: 6px 12px; font-size: 13px; margin: 14px 0 18px; }
.drawer .kv dt { color: var(--muted); font-size: 12px; }
.drawer .kv dd { margin: 0; font-family: var(--mono); font-size: 12.5px; word-break: break-all; }
.drawer .kv dd.body { font-family: var(--body); font-size: 13px; }
.drawer .kv dd .sub2 { display: block; font-size: 11px; color: var(--steel); }

/* Avisos rápidos */
.toasts { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 40; max-width: min(420px, 92vw); }
.toast {
  border: 1px solid var(--line);
  border-left-width: 2px;
  border-radius: var(--r);
  background: var(--panel-2);
  padding: 11px 13px;
  font-size: 13px;
  animation: slide .16s ease-out both;
}
.toast.good { border-left-color: var(--ok); }
.toast.bad { border-left-color: var(--danger); }
.toast.info { border-left-color: var(--info); }
.toast .why { display: block; color: var(--muted); font-size: 12px; margin-top: 3px; }

/* Confirmação */
.modal { position: fixed; inset: 0; background: rgba(5,6,8,.72); display: flex; align-items: center; justify-content: center; padding: 18px; z-index: 50; }
.modal-card {
  width: 100%;
  max-width: 460px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 20px 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-height: 92vh;
  overflow-y: auto;
}
.modal-card h2 { margin: 0; font-family: var(--display); font-weight: 600; font-size: 17px; letter-spacing: -0.02em; }
.modal-card .go { min-height: 44px; }
.modal-card .go.danger { background: var(--danger); color: #200b09; }
.modal-actions { display: flex; gap: 8px; }
.modal-actions > * { flex: 1; }

/* Texto de apoio com o que vai acontecer */
.effects { margin: 0; padding: 0 0 0 16px; color: var(--muted); font-size: 12.5px; }
.effects li { margin: 2px 0; }

/* Blocos de ajuste (Configurações) */
.stackgap { display: flex; flex-direction: column; gap: 22px; }
.dispatch .title { font-family: var(--display); font-weight: 600; font-size: 13.5px; }
.dispatch .hint { font-size: 12.5px; color: var(--muted); }

.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 20px; }

/* Formulário de campos parelhos: três colunas no desktop e uma no celular.

   Sem teto de largura de propósito: com o teto de 980px os campos paravam antes
   da borda do cartão e a fileira de botões logo abaixo — que ocupa o cartão
   inteiro — ficava desalinhada do último campo, com uma faixa vazia à direita.
   Agora os campos vão até a mesma borda dos botões. */
.formgrid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px 14px;
}

.listline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 12px;
  border: 1px solid var(--line-soft);
  border-radius: var(--r);
  background: var(--panel-2);
  font-size: 13px;
}

.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 5px 9px;
  font-size: 12.5px;
  background: var(--panel);
}
.chip code { font-family: var(--mono); font-size: 11.5px; color: var(--steel); }
.chip button { appearance: none; background: none; border: 0; color: var(--muted); cursor: pointer; font-size: 13px; padding: 0 2px; }
.chip button:hover { color: var(--danger); }

.copyarea {
  width: 100%;
  min-height: 96px;
  background: var(--well);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 11px;
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--paper);
}

@media (max-width: 980px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .rail {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    padding: 14px;
    gap: 12px;
  }
  .nav { flex-direction: row; overflow-x: auto; gap: 4px; }
  .nav .group { display: none; }
  .nav button { padding: 7px 10px 7px 24px; white-space: nowrap; }
  .operator, .linkstrip { display: none; }
  .view { padding: 16px 14px 60px; }
  .topbar { padding: 13px 14px; }
  .ledger .linha { grid-template-columns: minmax(0, 1fr); gap: 4px; }
}

@media (max-width: 700px) {
  /* Celular: é por aqui que o painel público é aberto no telefone. Duas coisas
     quebravam — as colunas de fora da tabela (620px de largura mínima) ficavam
     cortadas fora da tela, e as abas saíam cortadas para a direita. Agora a aba
     quebra linha e cada linha de tabela vira um cartão, com o nome da coluna
     (data-rotulo, escrito pelo app.js) antes do valor. */
  .nav { flex-direction: row; flex-wrap: wrap; overflow-x: visible; gap: 4px; }
  .nav button { padding: 7px 10px 7px 24px; white-space: nowrap; font-size: 12.5px; }

  .tablewrap { overflow-x: visible; }
  table.grid { min-width: 0; }
  table.grid thead { display: none; }
  table.grid tbody { display: block; }
  table.grid tr {
    display: block;
    padding: 8px 0 10px;
    border-bottom: 1px solid var(--line);
  }
  table.grid tbody tr:last-child { border-bottom: 0; }
  table.grid tbody tr:hover { background: none; }
  table.grid td {
    display: block;
    padding: 3px 11px;
    border-bottom: 0;
    overflow-wrap: anywhere;
  }
  table.grid td::before {
    content: attr(data-rotulo);
    display: inline-block;
    min-width: 86px;
    margin-right: 8px;
    color: var(--muted);
    font-size: 11.5px;
    vertical-align: baseline;
  }
  table.grid td[data-rotulo=""]::before { content: none; min-width: 0; margin: 0; }
  table.grid td.right { text-align: left; }
  table.grid td.right::before { content: none; }
}

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