/* Visual do painel: mesma marca e mesmas cores do console (azul-marinho do logo da RDT e um azul de ação). */

/* O atributo hidden vale mesmo em elemento com display próprio, como o menu. */
[hidden] { display: none !important; }

:root {
  --fundo: #f4f6fa;
  --papel: #ffffff;
  --texto: #101828;
  --suave: #5b6577;
  --linha: #dfe4ec;
  --linha-fraca: #eef1f6;
  --marinho: #0b1836;
  --marinho-ativo: #1d3266;
  --marinho-texto: #c3ccdd;
  --marinho-suave: #8e9bb5;
  --acento: #2f6bdb;
  --acento-escuro: #1f4fa8;
  --link: #2f6bdb;
  --info-fundo: #e8effc;
  --info-texto: #1f4fa8;
  --ok: #12723d;
  --ok-fundo: #e6f4ec;
  --perigo: #b42318;
  --perigo-linha: #f1b8b2;
  --neutro: #475467;
  --neutro-fundo: #eef1f6;
  --trilho: #e8edf5;
  --chave-desligada: #c9d1dd;
  --foco: #e0a800;
  /* barras de rolagem e ícones dos campos de data no tema do sistema (no escuro saíam brancos) */
  color-scheme: light;
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  font-size: 15px;
  color: var(--texto);
  background: var(--fundo);
}
@media (prefers-color-scheme: dark) {
  :root {
    --fundo: #0e1424;
    --papel: #161f33;
    --texto: #e6eaf2;
    --suave: #a3aec2;
    --linha: #2a3550;
    --linha-fraca: #1f2940;
    --marinho: #0a1122;
    --link: #8db2f5;
    --info-fundo: #1c2b4d;
    --info-texto: #afc6f7;
    --ok: #5cc98a;
    --ok-fundo: #123222;
    --perigo: #f07a6e;
    --perigo-linha: #6b2a25;
    --neutro: #b6c0d3;
    --neutro-fundo: #222c42;
    --trilho: #26324a;
    --chave-desligada: #3a4660;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; display: flex; background: var(--fundo); }
a { color: var(--link); }
.pular { position: absolute; left: -999px; }
.pular:focus { left: 8px; top: 8px; background: var(--papel); padding: 6px; z-index: 9; }

/* Símbolo do RDT Acesso Remoto: agente/marca/rdt-acesso-remoto/svg/icone.svg (logo nova de 05/11/2026) */
.simbolo {
  display: inline-block; flex: none; width: 36px; height: 36px; border-radius: 8px;
  background: #0b1836 center / cover no-repeat url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2064%2064'%3E%3Crect%20width='64'%20height='64'%20rx='14'%20fill='%230b1836'/%3E%3Cg%20transform='translate(32%2032.5)%20scale(0.74)%20translate(-28.625%20-30.875)'%3E%3Cpath%20d='M51%2032.63%20V16%20A7%207%200%200%200%2044%209%20H12%20A7%207%200%200%200%205%2016%20V38%20A7%207%200%200%200%2012%2045%20H29.00'%20fill='none'%20stroke='%23ffffff'%20stroke-width='6'/%3E%3Cpath%20d='M48.00%2031.63%20H54.00%20V37.79%20L48.00%2032.63%20Z'%20fill='%23ffffff'/%3E%3Cpath%20d='M33%2025%20L33%2052%20L40%2045.5%20L44.5%2055%20L50%2052.5%20L45.5%2043.5%20L54.5%2043.5%20Z'%20fill='%238db2f5'%20stroke='%238db2f5'%20stroke-width='1.5'%20stroke-linejoin='round'/%3E%3C/g%3E%3C/svg%3E");
}
.simbolo.grande { width: 44px; height: 44px; border-radius: 10px; }

/* Coluna lateral, igual à do console */
.lateral {
  flex: 0 0 244px; position: sticky; top: 0; height: 100vh; overflow-y: auto;
  display: flex; flex-direction: column; gap: 24px; padding: 20px 12px;
  background: var(--marinho); color: var(--marinho-texto);
}
.marca { display: flex; align-items: center; gap: 10px; padding: 0 8px; white-space: nowrap; }
.marca div { display: flex; flex-direction: column; }
.marca strong { color: #fff; font-size: 15px; font-weight: 600; }
.marca span { font-size: 12px; color: var(--marinho-suave); }
.menu { display: flex; flex-direction: column; gap: 2px; }
.menu a {
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  padding: 9px 10px; border-radius: 8px; color: var(--marinho-texto); text-decoration: none;
}
.menu a:hover { background: #15264d; color: #fff; }
.menu a[aria-current="page"] { background: var(--marinho-ativo); color: #fff; font-weight: 600; }
.menu kbd { font: inherit; font-size: 11px; font-weight: 400; color: #7f8ca8; }
.menu a[aria-current="page"] kbd { color: #afc0e6; }
.assinatura { margin: auto 0 0; padding: 0 8px; font-size: 12px; color: #7f8ca8; }

/* Área da direita */
.area { flex: 1; min-width: 0; display: flex; flex-direction: column; min-height: 100vh; }
.topo {
  display: flex; flex-wrap: wrap; gap: 16px; align-items: center; justify-content: space-between;
  padding: 16px 28px; background: var(--papel); border-bottom: 1px solid var(--linha);
}
.topo h1 { margin: 0; font-size: 22px; font-weight: 600; }
.usuario { display: flex; align-items: center; gap: 12px; margin-left: auto; }
.quem { font-size: 14px; color: var(--suave); }
main { flex: 1; padding: 28px 28px 48px; width: 100%; max-width: 1240px; }
main:focus { outline: none; }
h1 { font-size: 22px; font-weight: 600; margin: 0 0 16px; }
h2 { font-size: 17px; font-weight: 600; margin: 24px 0 10px; }
.teclas { padding: 8px 28px; font-size: 12px; color: var(--suave); background: var(--papel); border-top: 1px solid var(--linha); }

/* Fora do login: só o cartão de entrar, no meio */
body.fora .lateral, body.fora .topo, body.fora .teclas { display: none; }
body.fora main { display: flex; align-items: flex-start; justify-content: center; max-width: none; padding-top: 10vh; }
body.sem-menu .lateral, body.sem-menu .teclas { display: none; }

/* Cartões e números */
.cartao { background: var(--papel); border: 1px solid var(--linha); border-radius: 12px; padding: 20px; margin-bottom: 20px; }
.cartao > h2:first-child { margin-top: 0; }
.cabeca { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.cabeca h2 { margin: 0; }
.numeros { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 16px; margin-bottom: 24px; }
.numero { background: var(--papel); border: 1px solid var(--linha); border-radius: 12px; padding: 18px; display: flex; flex-direction: column; gap: 8px; }
.numero .rotulo { font-size: 13px; color: var(--suave); }
.numero b { font-size: 28px; font-weight: 600; }
.numero b small { font-size: 16px; font-weight: 400; color: var(--suave); }
.numero.cheio b { color: var(--perigo); }
progress { appearance: none; width: 100%; height: 6px; border: 0; border-radius: 3px; background: var(--trilho); }
progress::-webkit-progress-bar { background: var(--trilho); border-radius: 3px; }
progress::-webkit-progress-value { background: var(--acento); border-radius: 3px; }
progress::-moz-progress-bar { background: var(--acento); border-radius: 3px; }
.numero.cheio progress::-webkit-progress-value { background: var(--perigo); }
.numero.cheio progress::-moz-progress-bar { background: var(--perigo); }
.estado { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; }
.estado::before { content: ""; width: 8px; height: 8px; border-radius: 4px; background: currentColor; }
.estado.ok { color: var(--ok); }
.estado.alerta { color: var(--perigo); }

/* Tabelas */
.tabela { overflow-x: auto; background: var(--papel); border: 1px solid var(--linha); border-radius: 12px; margin-bottom: 20px; scrollbar-width: thin; scrollbar-color: var(--chave-desligada) transparent; }
.cartao .tabela { border: 0; border-radius: 0; margin: 0; }
table { width: 100%; border-collapse: collapse; background: var(--papel); font-size: 14px; }
th, td { text-align: left; padding: 12px; border-bottom: 1px solid var(--linha-fraca); vertical-align: middle; }
th { font-size: 12px; font-weight: 600; color: var(--suave); border-bottom-color: var(--linha); }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:focus-within { background: color-mix(in srgb, var(--foco) 12%, transparent); }
td { white-space: nowrap; }
td[colspan] { white-space: normal; }
.paginacao { display: flex; align-items: center; gap: 12px; margin: -8px 0 20px; }
td .suave { display: block; margin-top: 2px; }

/* Etiquetas e chaves */
.etiqueta { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 13px; white-space: nowrap; background: var(--neutro-fundo); color: var(--neutro); }
.etiqueta.sim { background: var(--ok-fundo); color: var(--ok); }
.etiqueta.info { background: var(--info-fundo); color: var(--info-texto); }
.sim { color: var(--ok); }
.nao { color: var(--perigo); }
button.chave {
  display: inline-flex; align-items: center; gap: 8px; padding: 4px 0; border: 0; background: none;
  color: var(--texto); font-size: 14px; white-space: nowrap;
}
button.chave .trilho {
  width: 36px; height: 20px; border-radius: 10px; padding: 2px; display: flex; justify-content: flex-start;
  background: var(--chave-desligada); transition: background 0.15s;
}
button.chave .trilho::after { content: ""; width: 16px; height: 16px; border-radius: 8px; background: #fff; }
button.chave[aria-pressed="true"] .trilho { background: var(--acento); justify-content: flex-end; }
button.chave[aria-pressed="false"] { color: var(--suave); }
.lado { display: inline-flex; align-items: center; gap: 10px; }

/* Formulários e botões */
form.linha { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; margin-bottom: 16px; }
label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--suave); }
input, select, textarea, button { font: inherit; font-size: 14px; padding: 8px 12px; border: 1px solid var(--linha); border-radius: 8px; background: var(--papel); color: var(--texto); }
input, select, textarea { border-color: color-mix(in srgb, var(--linha) 70%, var(--suave)); }
textarea { width: 100%; min-height: 80px; font-family: ui-monospace, Consolas, monospace; }
button { cursor: pointer; background: var(--acento); color: #fff; border-color: var(--acento); font-weight: 600; }
button:hover { background: var(--acento-escuro); border-color: var(--acento-escuro); }
button:disabled { opacity: 0.55; cursor: default; }
button.secundario { background: var(--papel); color: var(--texto); border-color: var(--linha); font-weight: 400; }
button.secundario:hover { background: var(--fundo); }
button.perigo { background: var(--papel); color: var(--perigo); border-color: var(--perigo-linha); font-weight: 400; }
button.perigo:hover { background: color-mix(in srgb, var(--perigo) 8%, var(--papel)); }
button.chave:hover { background: none; }
button.pequeno { padding: 5px 10px; font-size: 13px; }
:focus-visible { outline: 3px solid var(--foco); outline-offset: 1px; }

/* Recado no pé da tela */
.recado { position: fixed; bottom: 40px; left: 50%; transform: translateX(-50%); z-index: 5; }
.recado p { margin: 0; padding: 10px 16px; border-radius: 8px; background: #101828; color: #fff; }
.recado p.erro { background: #b42318; }

/* Entrar */
.entrar { width: 100%; max-width: 420px; padding: 28px; }
.entrar .marca { padding: 0; margin-bottom: 20px; }
.entrar .marca strong { color: var(--texto); font-size: 17px; }
.entrar .marca span { color: var(--suave); font-size: 13px; }
.entrar h1 { font-size: 18px; }
.entrar form { display: flex; flex-direction: column; gap: 14px; }
.entrar button[type="submit"] { padding: 11px 14px; font-size: 15px; }
.assinatura-entrar { margin: 16px 0 0; font-size: 12px; color: var(--suave); text-align: center; }
.qr { width: 220px; height: 220px; background: #fff; padding: 6px; border-radius: 8px; }
.segredo { font-family: ui-monospace, Consolas, monospace; word-break: break-all; }

.suave { color: var(--suave); font-size: 13px; }
dialog { border: 1px solid var(--linha); border-radius: 12px; background: var(--papel); color: var(--texto); max-width: 760px; width: 95%; padding: 24px; }
dialog::backdrop { background: rgb(11 24 54 / 0.55); }
.acoes { display: flex; gap: 8px; margin-top: 16px; }
.regras td { padding: 6px 8px; }
.regras td input { width: 100%; }

/* Tela estreita: o menu vira uma faixa no topo */
@media (max-width: 860px) {
  body { flex-direction: column; }
  .lateral { position: static; height: auto; flex: none; gap: 12px; padding: 14px; }
  .menu { flex-direction: row; flex-wrap: wrap; }
  .menu kbd, .assinatura { display: none; }
  .topo, main, .teclas { padding-left: 16px; padding-right: 16px; }
}
