/* Estilos compartilhados: site, painel e cardápio digital. Tema claro e escuro por variáveis. */
:root {
  --primaria: #6d4aff;
  --primaria-escura: #5233e0;
  --primaria-clara: #efeaff;
  --texto: #1d1b26;
  --texto-suave: #6b6880;
  --fundo: #f6f5fa;
  --superficie: #ffffff;
  --superficie-2: #f0eef6;
  --borda: #e3e0ec;
  --verde: #1f9d55;
  --verde-claro: #e3f6eb;
  --amarelo: #c27c00;
  --amarelo-claro: #fff4d6;
  --vermelho: #d93838;
  --vermelho-claro: #fde8e8;
  --azul: #2367d1;
  --azul-claro: #e4eeff;
  --sombra: 0 1px 2px rgb(20 16 40 / 6%), 0 4px 16px rgb(20 16 40 / 6%);
  --raio: 12px;
  --fonte: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-tema="claro"]) {
    --primaria: #8b70ff;
    --primaria-escura: #a18bff;
    --primaria-clara: #2a2346;
    --texto: #ecebf2;
    --texto-suave: #a19fb2;
    --fundo: #121119;
    --superficie: #1b1a24;
    --superficie-2: #24222f;
    --borda: #2f2d3c;
    --verde-claro: #12301f;
    --amarelo-claro: #352a0c;
    --vermelho-claro: #3a1717;
    --azul-claro: #14264a;
    --sombra: 0 1px 2px rgb(0 0 0 / 30%), 0 4px 16px rgb(0 0 0 / 25%);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--fonte); color: var(--texto); background: var(--fundo); font-size: 15px; line-height: 1.5; }
body.sem-rolagem { overflow: hidden; }
a { color: var(--primaria); }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; }
img { max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--primaria); outline-offset: 2px; }

/* Botões */
.botao { display: inline-flex; align-items: center; justify-content: center; gap: .4em; padding: .55em 1em; border-radius: 10px; border: 1px solid var(--borda);
  background: var(--superficie); cursor: pointer; font-weight: 600; text-decoration: none; color: var(--texto); white-space: nowrap; transition: background .15s, border-color .15s; }
.botao:hover { border-color: var(--primaria); }
.botao:disabled { opacity: .55; cursor: not-allowed; }
.botao-primario { background: var(--primaria); border-color: var(--primaria); color: #fff; }
.botao-primario:hover { background: var(--primaria-escura); }
.botao-verde { background: var(--verde); border-color: var(--verde); color: #fff; }
.botao-perigo { color: var(--vermelho); }
.botao-perigo:hover { border-color: var(--vermelho); }
.botao-pequeno { padding: .3em .65em; font-size: .87em; border-radius: 8px; }
.botao-grande { padding: .8em 1.5em; font-size: 1.05em; border-radius: 12px; }
.botao-bloco { width: 100%; }
.botao-icone { border: 0; background: transparent; cursor: pointer; font-size: 1.1em; padding: .3em .5em; border-radius: 8px; color: var(--texto-suave); }
.botao-icone:hover { background: var(--superficie-2); }

/* Formulários */
.campo { display: flex; flex-direction: column; gap: .3em; margin-bottom: .9em; }
.campo > span { font-size: .87em; font-weight: 600; color: var(--texto-suave); }
.campo small { color: var(--texto-suave); font-size: .8em; }
input[type=text], input[type=email], input[type=password], input[type=tel], input[type=number], input[type=date], input[type=time],
input[type=datetime-local], input[type=search], input[type=color], input:not([type]), select, textarea {
  width: 100%; padding: .6em .75em; border: 1px solid var(--borda); border-radius: 10px; background: var(--superficie); min-height: 42px; }
input[type=color] { padding: 4px; }
textarea { min-height: 90px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primaria); box-shadow: 0 0 0 3px var(--primaria-clara); }
.marcador { display: flex; align-items: center; gap: .55em; cursor: pointer; margin-bottom: .6em; }
.marcador input { width: 18px; height: 18px; accent-color: var(--primaria); }
.grade-campos { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 0 1em; }
.acoes { display: flex; gap: .6em; justify-content: flex-end; flex-wrap: wrap; margin-top: 1em; }

/* Interruptor */
.chave { position: relative; display: inline-flex; align-items: center; gap: .6em; cursor: pointer; }
.chave input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.chave i { width: 40px; height: 22px; border-radius: 22px; background: var(--borda); position: relative; transition: background .15s; flex-shrink: 0; }
.chave i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s; }
.chave input:checked + i { background: var(--verde); }
.chave input:checked + i::after { transform: translateX(18px); }
.chave input:focus-visible + i { outline: 2px solid var(--primaria); outline-offset: 2px; }

/* Cartões, etiquetas, tabelas */
.cartao { background: var(--superficie); border: 1px solid var(--borda); border-radius: var(--raio); padding: 1.1em 1.2em; box-shadow: var(--sombra); }
.cartao + .cartao { margin-top: 1em; }
.cartao h3 { font-size: 1.02em; }
.etiqueta { display: inline-flex; align-items: center; gap: .3em; padding: .12em .55em; border-radius: 99px; font-size: .78em; font-weight: 600; background: var(--superficie-2); color: var(--texto-suave); white-space: nowrap; }
.etiqueta-verde { background: var(--verde-claro); color: var(--verde); }
.etiqueta-amarela { background: var(--amarelo-claro); color: var(--amarelo); }
.etiqueta-vermelha { background: var(--vermelho-claro); color: var(--vermelho); }
.etiqueta-azul { background: var(--azul-claro); color: var(--azul); }
.etiqueta-roxa { background: var(--primaria-clara); color: var(--primaria); }
.tabela-rolagem { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: .6em .7em; border-bottom: 1px solid var(--borda); vertical-align: middle; }
th { font-size: .8em; text-transform: uppercase; letter-spacing: .03em; color: var(--texto-suave); font-weight: 600; }
td.numero, th.numero { text-align: right; font-variant-numeric: tabular-nums; }
tr.clicavel { cursor: pointer; }
tr.clicavel:hover td { background: var(--superficie-2); }
.vazio { color: var(--texto-suave); text-align: center; padding: 2em 1em; }
.suave { color: var(--texto-suave); }
.pequeno { font-size: .85em; }
.linha { display: flex; align-items: center; gap: .6em; flex-wrap: wrap; }
.entre { justify-content: space-between; }
.cresce { flex: 1; min-width: 0; }

/* Indicadores */
.indicadores { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 1em; margin-bottom: 1em; }
.indicador { background: var(--superficie); border: 1px solid var(--borda); border-radius: var(--raio); padding: 1em 1.1em; }
.indicador span { display: block; font-size: .82em; color: var(--texto-suave); font-weight: 600; }
.indicador strong { display: block; font-size: 1.55em; font-variant-numeric: tabular-nums; margin-top: .15em; }
.indicador small { font-weight: 600; }
.sobe { color: var(--verde); }
.desce { color: var(--vermelho); }

.grafico text { font-size: 10px; fill: var(--texto-suave); }
.barra-horizontal { height: 8px; border-radius: 8px; background: var(--superficie-2); overflow: hidden; }
.barra-horizontal > i { display: block; height: 100%; background: var(--primaria); border-radius: 8px; }

/* Janelas e avisos */
.janela-fundo { position: fixed; inset: 0; background: rgb(10 8 20 / 55%); display: flex; align-items: flex-start; justify-content: center; padding: 5vh 16px; z-index: 50; overflow-y: auto; }
.janela { background: var(--superficie); border-radius: 16px; width: 100%; box-shadow: 0 20px 60px rgb(0 0 0 / 30%); }
.janela-topo { display: flex; align-items: center; justify-content: space-between; padding: 1em 1.2em; border-bottom: 1px solid var(--borda); position: sticky; top: 0; background: var(--superficie); border-radius: 16px 16px 0 0; z-index: 1; }
.janela-topo h2 { margin: 0; font-size: 1.12em; }
.janela-corpo { padding: 1.2em; }
.avisos { position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: .5em; z-index: 60; width: min(420px, calc(100% - 32px)); }
.aviso { padding: .8em 1em; border-radius: 10px; background: var(--texto); color: var(--superficie); box-shadow: var(--sombra); font-weight: 500; animation: entrar .2s ease-out; }
.aviso-erro { background: var(--vermelho); color: #fff; }
@keyframes entrar { from { transform: translateY(8px); opacity: 0; } }

/* Abas */
.abas { display: flex; gap: .3em; border-bottom: 1px solid var(--borda); margin-bottom: 1.2em; overflow-x: auto; scrollbar-width: none; }
.abas a { padding: .65em 1em; text-decoration: none; color: var(--texto-suave); font-weight: 600; border-bottom: 2px solid transparent; white-space: nowrap; }
.abas a.ativa { color: var(--primaria); border-color: var(--primaria); }

@media (max-width: 640px) {
  body { font-size: 14.5px; }
  .janela-fundo { padding: 0; align-items: flex-end; }
  .janela { border-radius: 16px 16px 0 0; max-height: 92vh; overflow-y: auto; }
}
