/* Painel Rudá: tema escuro no estilo do modelo (menu lateral, cartões arredondados, azul de destaque). */
:root {
  color-scheme: dark;
  --fundo: #0b0c0e;
  --app: #111214;
  --lateral: #0f1012;
  --card: #18191c;
  --card2: #1f2024;
  --card3: #26282d;
  --linha: #2a2c31;
  --linha2: #34363c;
  --texto: #f3f4f6;
  --texto2: #c9cbd1;
  --mudo: #8b8e97;
  --azul: #2f8cf0;
  --azul-forte: #1f74e0;
  --azul-claro: #8cc4ff;
  --azul-fundo: #14283f;
  --verde: #34d17e;
  --verde-fundo: #12321f;
  --amarelo: #f2c04f;
  --amarelo-fundo: #3a2f14;
  --vermelho: #f26b6b;
  --vermelho-fundo: #3a1a1c;
  --raio: 16px;
  --raio-p: 10px;
  --sombra: 0 1px 0 rgba(255, 255, 255, .03) inset, 0 8px 24px rgba(0, 0, 0, .25);
  --gradiente: linear-gradient(180deg, #3d9bff 0%, #1f74e0 100%);
  --lateral-w: 248px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--fundo); color: var(--texto); font-size: 14px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
a { color: var(--azul-claro); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { letter-spacing: -.015em; }
h1 { font-size: 1.75rem; line-height: 1.2; margin: 0; font-weight: 700; }
h2 { font-size: 1.05rem; margin: 1.6rem 0 .7rem; font-weight: 600; }
h3 { font-size: .95rem; margin: 1.1rem 0 .4rem; font-weight: 600; color: var(--texto2); }
p { margin: .5rem 0; }
hr { border: 0; border-top: 1px solid var(--linha); margin: 1rem 0; }
code, kbd { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: .85em; background: var(--card3); border-radius: 6px; padding: .1em .35em; }
.ico { width: 18px; height: 18px; flex: none; }
.so-celular { display: none !important; }

/* ------------------------------------------------------------------ estrutura */
.app { display: grid; grid-template-columns: var(--lateral-w) minmax(0, 1fr); min-height: 100vh; background: var(--app); }
.sidebar { position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; gap: 2px;
  background: var(--lateral); border-right: 1px solid #1c1d21; padding: 20px 14px 16px; scrollbar-width: thin; }
.brand { display: flex; align-items: center; justify-content: space-between; padding: 2px 6px 18px; }
.brand.centro { justify-content: center; padding-bottom: 8px; }
.brand-link, .brand.centro { display: flex; align-items: center; gap: 10px; color: var(--texto); text-decoration: none !important; }
.brand-nome { font-size: 1.3rem; font-weight: 700; letter-spacing: -.02em; }
.brand-mark { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; background: var(--gradiente); color: #fff;
  box-shadow: 0 6px 18px rgba(47, 140, 240, .35), inset 0 1px 0 rgba(255, 255, 255, .25); }
.brand-mark .ico { width: 19px; height: 19px; }
.brand-mark.pequeno { width: 28px; height: 28px; border-radius: 8px; }
.brand-mark.pequeno .ico { width: 15px; height: 15px; }
.nav-label { margin: 14px 10px 6px; color: #6f727b; font-size: .68rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; }
.nav { display: grid; gap: 2px; }
.nav a, .nav-sair { position: relative; display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 10px; color: #b4b7bf;
  text-decoration: none !important; font-size: .9rem; border: 1px solid transparent; background: none; font: inherit; width: 100%; cursor: pointer; text-align: left; }
.nav a:hover, .nav-sair:hover { background: #1a1b1f; color: #fff; }
.nav a.ativo { background: linear-gradient(180deg, #202125, #1a1b1e); border-color: #2c2e33; color: #fff; box-shadow: 0 1px 0 rgba(255,255,255,.04) inset; }
.nav a.ativo::after { content: ""; position: absolute; right: -15px; top: 8px; bottom: 8px; width: 3px; border-radius: 3px 0 0 3px; background: var(--azul); }
.nav a .ico { color: #9a9ea8; }
.nav a.ativo .ico { color: #fff; }
.badge { margin-left: auto; min-width: 22px; padding: 1px 7px; border-radius: 999px; background: var(--card3); color: #fff; font-size: .72rem; font-weight: 600; text-align: center; }
.nav a.ativo .badge { background: var(--azul); }
.side-fim { margin-top: auto; padding-top: 18px; display: grid; gap: 8px; }
.side-card { border-radius: 14px; padding: 16px; text-align: center; background: linear-gradient(180deg, #24262b, #1a1b1f); border: 1px solid #303238;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.05); }
.side-card strong { display: block; font-size: .98rem; }
.side-card p { margin: 4px 0 12px; color: var(--mudo); font-size: .78rem; line-height: 1.4; }
.side-card.teste { background: linear-gradient(180deg, #3a3017, #261f10); border-color: #5a4a20; }
.side-card.teste strong { color: #ffd77a; }
.side-card.teste p { margin-bottom: 0; color: #d6c18c; }
.side-card.pausado { background: linear-gradient(180deg, #3b1d20, #261315); border-color: #5c2a2e; }
.side-card.pausado strong { color: #ffb1b1; }
.side-card form { margin: 0; }
.conteudo { min-width: 0; display: flex; flex-direction: column; }
.main { width: 100%; max-width: 1440px; padding: 8px 32px 56px; }

/* barra do topo */
.topbar { display: flex; align-items: center; gap: 12px; padding: 18px 32px 14px; position: sticky; top: 0; z-index: 20;
  background: linear-gradient(180deg, var(--app) 70%, rgba(17,18,20,0)); }
.search { display: flex; align-items: center; gap: 8px; width: min(380px, 100%); background: #18191c; border: 1px solid var(--linha);
  border-radius: 12px; padding: 0 10px 0 12px; color: var(--mudo); margin: 0; }
.search:focus-within { border-color: #3b6fa8; box-shadow: 0 0 0 3px rgba(47,140,240,.18); }
.search input { flex: 1; min-width: 0; background: none; border: 0; outline: none; padding: 9px 0; color: var(--texto); box-shadow: none !important; }
.search kbd { color: var(--mudo); }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.icon-btn { position: relative; display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: #18191c;
  border: 1px solid var(--linha); color: #d4d6dc; cursor: pointer; text-decoration: none !important; padding: 0; }
.icon-btn:hover { background: #202125; color: #fff; }
.icon-btn.pequeno { width: 30px; height: 30px; border-radius: 9px; }
.icon-btn.pequeno .ico { width: 15px; height: 15px; }
.icon-btn .ponto { position: absolute; top: 8px; right: 9px; width: 8px; height: 8px; border-radius: 50%; background: var(--azul); box-shadow: 0 0 0 2px #18191c; }
.avatar { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; font-weight: 700; font-size: .85rem;
  background: linear-gradient(135deg, #3a3d44, #24262b); border: 1px solid #3a3c42; color: #fff; }

/* faixa de modo teste e mensagens */
.faixa-teste, .flash { display: flex; align-items: flex-start; gap: 10px; padding: 11px 14px; border-radius: 12px; margin: 0 0 16px; border: 1px solid; font-size: .88rem; }
.faixa-teste .ico, .flash .ico { margin-top: 1px; }
.faixa-teste { background: #2a2414; border-color: #4f4220; color: #f1d58f; }
.flash.ok { background: var(--verde-fundo); border-color: #1f5636; color: #9ff0c2; }
.flash.erro { background: var(--vermelho-fundo); border-color: #5e2a2d; color: #ffc0c0; }
.flash.aviso { background: var(--amarelo-fundo); border-color: #5a4a20; color: #f5d98f; }
p.flash { display: block; }

/* cabeçalho de página */
.pagehead { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin: 4px 0 22px; }
.pagehead h1 { font-size: 1.9rem; }
.pagehead p { margin: 6px 0 0; color: var(--mudo); font-size: .9rem; }
.pagehead-acoes { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.eyebrow { color: var(--azul-claro); font-size: .72rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; margin-bottom: 6px; }
.eyebrow a { color: inherit; }
.data-pill { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 12px; background: #1d1e22; border: 1px solid var(--linha2);
  color: var(--texto); font-size: .88rem; white-space: nowrap; }

/* ------------------------------------------------------------------ cartões */
.card { display: block; background: var(--card); border: 1px solid var(--linha); border-radius: var(--raio); padding: 18px 20px; margin-bottom: 16px; min-width: 0;
  box-shadow: var(--sombra); color: inherit; }
.card > h2:first-child, .card > h3:first-child { margin-top: 0; }
.card-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.card-head h2 { margin: 0; font-size: 1.05rem; font-weight: 600; }
.card-extra { margin-left: auto; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.icon-box { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 11px; background: #222328; border: 1px solid #303238; color: #e3e5ea; flex: none; }
.link-card { text-decoration: none !important; transition: border-color .15s, transform .15s; }
.link-card:hover { border-color: #3a3d44; transform: translateY(-1px); }
.kpi { margin-bottom: 0; }
.kpi .card-head { margin-bottom: 10px; }
.kpi-valor { font-size: 2.1rem; font-weight: 700; letter-spacing: -.03em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.kpi-valor small { font-size: .95rem; font-weight: 500; color: var(--mudo); letter-spacing: 0; }
.kpi-valor.tom-ok { color: var(--verde); } .kpi-valor.tom-erro { color: var(--vermelho); } .kpi-valor.tom-aviso { color: var(--amarelo); }
.kpi-var { margin-top: 10px; color: var(--mudo); font-size: .82rem; }
.kpi-detalhe { margin-top: 8px; color: var(--mudo); font-size: .82rem; }
.delta { display: inline-block; padding: 2px 8px; border-radius: 7px; font-size: .74rem; font-weight: 600; }
.delta-ok { background: var(--verde-fundo); color: var(--verde); }
.delta-erro { background: var(--vermelho-fundo); color: var(--vermelho); }
.delta-neutro { background: var(--card3); color: var(--texto2); }
.tile { background: var(--card2); border: 1px solid #2c2e33; border-radius: 13px; padding: 13px 14px; min-width: 0; }
.tile .rotulo, .rotulo-p { color: var(--mudo); font-size: .78rem; }
.tile .valor { font-size: 1.25rem; font-weight: 700; margin-top: 2px; }

/* grades */
.grid { display: grid; gap: 16px; margin-bottom: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-painel { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); align-items: start; }
.grid > .card { margin-bottom: 0; }
.pilha { display: grid; gap: 16px; align-content: start; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; }
.grid2 > .card { margin-bottom: 0; }
.grid2 + *, .grid + .card { margin-top: 0; }

/* cartões de número antigos */
.cartoes { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; margin-bottom: 18px; }
.cartao-num { background: var(--card); border: 1px solid var(--linha); border-radius: 14px; padding: 15px 16px; box-shadow: var(--sombra); }
.card .cartao-num { background: var(--card2); box-shadow: none; }
.cartao-num .rotulo { color: var(--mudo); font-size: .8rem; }
.cartao-num .valor { font-size: 1.7rem; font-weight: 700; letter-spacing: -.02em; margin-top: 2px; font-variant-numeric: tabular-nums; }
.cartao-num .detalhe { color: var(--mudo); font-size: .78rem; margin-top: 2px; }

/* gráfico de barras */
.grafico { position: relative; height: calc(var(--altura, 190px) + 26px); padding-left: 44px; }
.eixo { position: absolute; inset: 0 0 26px 0; display: flex; flex-direction: column; justify-content: space-between; pointer-events: none; }
.eixo-linha { position: relative; border-top: 1px dashed #2a2c31; height: 0; }
.eixo-linha span { position: absolute; left: 0; top: -9px; width: 38px; color: var(--mudo); font-size: .72rem; text-align: right; transform: translateX(-4px); }
.eixo-linha:last-child { border-top-style: solid; }
.colunas { position: relative; display: flex; align-items: flex-end; gap: clamp(4px, 1.4%, 14px); height: 100%; padding-bottom: 26px; }
.coluna { position: relative; flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; min-width: 0; }
.barra-v { position: relative; width: 100%; max-width: 46px; border-radius: 8px 8px 4px 4px; background: linear-gradient(180deg, #2b2d32, #232428); }
.coluna.destaque .barra-v { background: linear-gradient(180deg, #3d9bff 0%, #1f74e0 70%, rgba(31,116,224,.25) 100%); box-shadow: 0 0 24px rgba(47,140,240,.35); }
.coluna.destaque .barra-v::before { content: ""; position: absolute; top: -7px; left: 50%; width: 14px; height: 14px; margin-left: -7px; border-radius: 50%;
  background: #6d8dff; border: 3px solid #e8ecff; box-shadow: 0 0 0 4px rgba(109,141,255,.25); }
.coluna-rotulo { position: absolute; bottom: 0; color: var(--mudo); font-size: .75rem; white-space: nowrap; }
.coluna.destaque .coluna-rotulo { color: #fff; font-weight: 600; }
.tooltip { position: absolute; left: calc(50% + 16px); top: -16px; display: grid; padding: 7px 12px; border-radius: 10px; white-space: nowrap; z-index: 2;
  background: #2a2c31; border: 1px solid #3c3f46; box-shadow: 0 8px 20px rgba(0,0,0,.4); }
.tooltip small { color: var(--mudo); font-size: .7rem; }
.tooltip b { font-size: 1rem; }
.legenda { display: inline-flex; align-items: center; gap: 8px; color: var(--texto2); font-size: .85rem; }
.legenda::before { content: ""; width: 4px; height: 14px; border-radius: 3px; background: var(--azul); }

/* progresso */
.progresso, .barra { height: 8px; background: #2a2c31; border-radius: 999px; overflow: hidden; margin: 8px 0; }
.progresso > span, .barra > span { display: block; height: 100%; border-radius: 999px; background: var(--gradiente); }
.progresso-ok > span { background: linear-gradient(90deg, #22b56a, #34d17e); }
.progresso-aviso > span { background: linear-gradient(90deg, #d8a12f, #f2c04f); }
.progresso-erro > span { background: linear-gradient(90deg, #d44d4d, #f26b6b); }

/* listas */
.lista { display: grid; }
.lista-item { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--linha); min-width: 0; }
.lista-item:last-child { border-bottom: 0; padding-bottom: 0; }
.lista-item:first-child { padding-top: 0; }
.lista-item .item-main { flex: 1; min-width: 0; }
.lista-item .item-main strong { display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lista-item .item-main small { display: block; color: var(--mudo); font-size: .8rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avatar-sm { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: var(--azul-fundo); color: var(--azul-claro); font-weight: 700; font-size: .8rem; flex: none; }
.avatar-sm .ico { width: 16px; height: 16px; }
.avatar-sm.verde { background: var(--verde-fundo); color: var(--verde); }
.avatar-sm.amarelo { background: var(--amarelo-fundo); color: var(--amarelo); }
.avatar-sm.vermelho { background: var(--vermelho-fundo); color: var(--vermelho); }

/* ------------------------------------------------------------------ tabelas */
.tabela-wrap { overflow-x: auto; background: var(--card); border: 1px solid var(--linha); border-radius: 14px; margin-bottom: 16px; }
.card .tabela-wrap { background: transparent; border-color: #2a2c31; }
table { width: 100%; border-collapse: collapse; font-size: .875rem; }
th, td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--linha); vertical-align: middle; }
th { background: #1d1e22; color: var(--mudo); font-weight: 500; font-size: .8rem; white-space: nowrap; }
td { color: var(--texto2); }
td strong, td a { color: var(--texto); }
td a { font-weight: 500; }
tbody tr:hover td { background: rgba(255,255,255,.015); }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.vazio { color: var(--mudo); padding: 18px; text-align: center; border: 1px dashed var(--linha2); border-radius: 12px; margin: 8px 0; }

/* selos (pílulas) */
.selo { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: .75rem; font-weight: 600; white-space: nowrap; line-height: 1.5; }
.selo::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.selo-ok { background: var(--verde-fundo); color: var(--verde); }
.selo-aviso { background: var(--amarelo-fundo); color: var(--amarelo); }
.selo-erro { background: var(--vermelho-fundo); color: var(--vermelho); }
.selo-info { background: var(--azul-fundo); color: var(--azul-claro); }
.selo-neutro { background: var(--card3); color: var(--texto2); }

/* ------------------------------------------------------------------ formulários */
form { margin: 0; }
form.form { display: grid; gap: 14px; max-width: 680px; }
form.form.card { max-width: none; }
form.inline { display: inline; }
.filtros { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; margin-bottom: 16px; }
.filtros label { font-size: .78rem; }
label { display: grid; gap: 6px; font-weight: 500; font-size: .86rem; color: var(--texto2); }
label.check { display: flex; align-items: center; gap: 10px; font-weight: 500; color: var(--texto); }
input, select, textarea { font: inherit; font-size: .9rem; padding: 9px 12px; border: 1px solid var(--linha2); border-radius: var(--raio-p); background: #141518; color: var(--texto); min-width: 0; }
input::placeholder, textarea::placeholder { color: #6b6e77; }
input[type=checkbox], input[type=radio] { width: 18px; height: 18px; padding: 0; accent-color: var(--azul); }
input[type=file] { padding: 8px; background: var(--card2); }
input[type=file]::file-selector-button { font: inherit; margin-right: 10px; border: 1px solid var(--linha2); border-radius: 8px; padding: 6px 12px; background: var(--card3); color: var(--texto); cursor: pointer; }
select { appearance: none; padding-right: 34px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238b8e97' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; }
textarea { min-height: 120px; resize: vertical; line-height: 1.5; }
input:focus, select:focus, textarea:focus { outline: none; border-color: #3f7fc4; box-shadow: 0 0 0 3px rgba(47,140,240,.2); }
button:focus-visible, a:focus-visible, .btn:focus-visible { outline: 2px solid var(--azul-claro); outline-offset: 2px; }
.ajuda { color: var(--mudo); font-weight: 400; font-size: .8rem; }
fieldset { border: 1px solid var(--linha); border-radius: 12px; padding: 12px 14px; margin: 0; }
legend { padding: 0 6px; color: var(--texto2); font-weight: 600; }

/* ------------------------------------------------------------------ botões */
button, .botao, .btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; font: inherit; font-size: .88rem; font-weight: 600; cursor: pointer;
  border: 1px solid #2f86ec; border-radius: 11px; padding: 9px 16px; background: var(--gradiente); color: #fff; text-decoration: none !important; line-height: 1.3;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.2), 0 4px 14px rgba(31,116,224,.25); transition: filter .15s, background .15s; white-space: nowrap; }
button:hover, .botao:hover, .btn:hover { filter: brightness(1.08); }
button .ico, .btn .ico, .botao .ico { width: 16px; height: 16px; }
button.sec, .botao.sec, .btn-sec { background: #1d1e22; border-color: var(--linha2); color: var(--texto); box-shadow: none; }
button.sec:hover, .botao.sec:hover, .btn-sec:hover { background: #25272b; filter: none; }
.btn-claro { background: #f3f4f6; border-color: #f3f4f6; color: #111214; box-shadow: none; }
.btn-claro:hover { background: #fff; }
button.perigo, .botao.perigo, .btn-perigo { background: linear-gradient(180deg, #e25555, #c13c3c); border-color: #d64848; box-shadow: none; }
button.ok, .botao.ok, .btn-ok { background: linear-gradient(180deg, #2fc274, #1f9e5a); border-color: #2bb46b; box-shadow: none; }
button.link, .btn-link { background: none; border: 0; box-shadow: none; color: var(--azul-claro); padding: 4px 6px; font-weight: 500; }
button.pequeno, .botao.pequeno, .btn.pequeno { padding: 5px 11px; font-size: .8rem; border-radius: 9px; }
.btn-bloco { width: 100%; padding: 11px 16px; }
button:disabled { opacity: .5; cursor: not-allowed; filter: none; }
.acoes { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 12px 0; }

/* ------------------------------------------------------------------ outros */
.paginacao { display: flex; gap: 12px; align-items: center; justify-content: center; margin: 16px 0; color: var(--mudo); font-size: .85rem; }
.contador { font-size: .78rem; font-weight: 600; margin-top: 4px; }
.contador.verde { color: var(--verde); } .contador.amarelo { color: var(--amarelo); } .contador.vermelho { color: var(--vermelho); }
.preview { white-space: pre-wrap; background: #103325; color: #e3f6ea; border-radius: 12px 12px 12px 4px; padding: 11px 14px; margin: 6px 0; font-size: .9rem;
  border: 1px solid #1c4a35; max-width: 560px; }
.preview.email { background: var(--card2); color: var(--texto); border-color: var(--linha2); border-radius: 12px; }
.mudo { color: var(--mudo); }
.pequeno { font-size: .82rem; }
.pre { white-space: pre-wrap; }
details { border: 1px solid var(--linha); border-radius: 12px; padding: 10px 14px; background: var(--card2); margin: 10px 0; }
details summary { cursor: pointer; font-weight: 600; color: var(--texto); }
details[open] summary { margin-bottom: 8px; }
ul, ol { padding-left: 1.3rem; }
li { margin: 3px 0; }
.ficha dt { color: var(--mudo); font-size: .8rem; }
.ficha dd { margin: 0 0 10px; color: var(--texto); }

/* login e páginas simples */
body.simples { display: grid; place-items: center; min-height: 100vh; padding: 20px;
  background: radial-gradient(1000px 500px at 50% -10%, #17263a 0%, var(--fundo) 60%); }
.caixa-central { background: var(--card); border: 1px solid var(--linha); border-radius: 20px; padding: 30px 28px; width: min(420px, 100%); box-shadow: 0 20px 60px rgba(0,0,0,.45); }
.caixa-central h1 { font-size: 1.35rem; text-align: center; margin: 6px 0 4px; }
.caixa-central > .mudo { text-align: center; margin-bottom: 18px; }

/* ------------------------------------------------------------------ telas médias */
@media (max-width: 1200px) {
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g-painel { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 1024px) {
  :root { --lateral-w: 220px; }
  .main { padding: 6px 22px 48px; }
  .topbar { padding: 16px 22px 12px; }
  .g3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ------------------------------------------------------------------ celular (iPhone) */
@media (max-width: 820px) {
  .so-celular { display: revert !important; }
  .so-pc { display: none !important; }
  body { font-size: 15px; }
  .app { display: block; }
  .sidebar { position: fixed; z-index: 60; left: 0; top: 0; bottom: 0; width: min(300px, 84vw); height: auto; transform: translateX(-102%);
    transition: transform .22s ease; padding-top: calc(16px + env(safe-area-inset-top)); padding-bottom: calc(16px + env(safe-area-inset-bottom)); box-shadow: 20px 0 50px rgba(0,0,0,.5); }
  .nav a.ativo::after { display: none; }
  body.menu-aberto .sidebar { transform: none; }
  .veu { position: fixed; inset: 0; z-index: 55; background: rgba(0,0,0,.55); opacity: 0; pointer-events: none; transition: opacity .2s; display: block !important; }
  body.menu-aberto .veu { opacity: 1; pointer-events: auto; }
  body.menu-aberto { overflow: hidden; }
  .topbar { padding: calc(10px + env(safe-area-inset-top)) 14px 10px; gap: 10px; background: rgba(17,18,20,.92); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid #1d1e22; }
  .topbar .search { display: none; }
  .brand-topo { display: inline-flex !important; align-items: center; gap: 8px; font-weight: 700; font-size: 1.05rem; color: var(--texto); }
  .top-actions { gap: 8px; }
  .icon-btn, .avatar { width: 38px; height: 38px; }
  .main { padding: 14px 14px calc(92px + env(safe-area-inset-bottom)); }
  .pagehead { margin-bottom: 16px; align-items: flex-start; }
  .pagehead h1 { font-size: 1.5rem; }
  .pagehead-acoes { width: 100%; }
  .pagehead-acoes > * { flex: 1 1 auto; }
  .g2, .g3 { grid-template-columns: minmax(0, 1fr); }
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .grid2 { grid-template-columns: minmax(0, 1fr); }
  .card { padding: 15px; border-radius: 14px; }
  .kpi-valor { font-size: 1.6rem; }
  .icon-box { width: 34px; height: 34px; border-radius: 10px; }
  .cartoes { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .cartao-num .valor { font-size: 1.35rem; }
  input, select, textarea { font-size: 16px; } /* evita o zoom automático do iPhone */
  .filtros > * { flex: 1 1 140px; }
  .acoes > button, .acoes > .btn, .acoes > .botao { flex: 1 1 auto; }
  .grafico { padding-left: 34px; }
  .eixo-linha span { width: 30px; font-size: .65rem; }
  .coluna-rotulo { font-size: .65rem; }
  .tooltip { left: 50%; transform: translateX(-50%); top: -54px; }
  /* tabelas viram cartões no celular */
  .tabela-wrap { background: none; border: 0; overflow: visible; }
  .tabela-wrap table, .tabela-wrap tbody, .tabela-wrap tr, .tabela-wrap td { display: block; width: 100%; }
  .tabela-wrap thead { display: none; }
  .tabela-wrap tr { background: var(--card); border: 1px solid var(--linha); border-radius: 14px; padding: 8px 14px; margin-bottom: 10px; }
  .card .tabela-wrap tr { background: var(--card2); }
  .tabela-wrap td { border: 0; padding: 6px 0; display: flex; gap: 12px; justify-content: space-between; align-items: baseline; text-align: right; }
  .tabela-wrap td::before { content: attr(data-rotulo); color: var(--mudo); font-size: .78rem; text-align: left; flex: none; max-width: 45%; }
  .tabela-wrap td[data-rotulo=""]::before { display: none; }
  .tabela-wrap td[data-rotulo=""] { justify-content: flex-end; }
  tbody tr:hover td { background: none; }
  /* barra de baixo */
  .tabbar { position: fixed; z-index: 50; left: 0; right: 0; bottom: 0; display: grid !important; grid-template-columns: repeat(5, 1fr);
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); background: rgba(15,16,18,.94); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); border-top: 1px solid #1f2024; }
  .tabbar a, .tabbar button { position: relative; display: grid; justify-items: center; gap: 2px; padding: 6px 2px; border: 0; border-radius: 10px; background: none; box-shadow: none;
    color: #8f929b; font-size: .68rem; font-weight: 500; text-decoration: none !important; }
  .tabbar .ico { width: 22px; height: 22px; }
  .tabbar a.ativo { color: #fff; }
  .tabbar a.ativo .ico { color: var(--azul-claro); }
  .tabbar .badge { position: absolute; top: 0; left: 52%; margin: 0; min-width: 18px; padding: 0 5px; font-size: .62rem; background: var(--azul); }
}
@media (max-width: 820px) {
  .kpi { padding: 13px; }
  .kpi .card-head { gap: 8px; margin-bottom: 8px; }
  .kpi .card-head h2 { font-size: .82rem; font-weight: 500; color: var(--texto2); line-height: 1.25; }
  .kpi .card-extra { display: none; }
  .kpi .icon-box { width: 28px; height: 28px; border-radius: 8px; }
  .kpi .icon-box .ico { width: 15px; height: 15px; }
  .kpi-valor { font-size: 1.45rem; }
  .kpi-var, .kpi-detalhe { font-size: .74rem; margin-top: 6px; }
}
@media (max-width: 820px) {
  /* grades só de números: 2 por linha no celular */
  :is(div, section):has(> .kpi + .kpi):not(:has(> :not(.kpi, style, script))) { display: grid !important; grid-template-columns: repeat(2, minmax(0, 1fr)) !important; gap: 12px !important; }
}
@media (max-width: 340px) {
  :is(div, section):has(> .kpi + .kpi) { grid-template-columns: minmax(0, 1fr) !important; }
  .g4, .cartoes { grid-template-columns: minmax(0, 1fr); }
}
/* tooltip das últimas barras abre para a esquerda (não sai do cartão) */
.coluna:nth-last-child(-n+3) .tooltip { left: auto; right: calc(50% + 16px); }
@media (max-width: 820px) { .coluna:nth-last-child(-n+3) .tooltip { right: 0; left: auto; transform: none; } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
