/* ===== Tokens ===== */
:root {
  --fundo: #eef3f7; --papel: #ffffff; --papel-2: #f5f8fb; --tinta: #0f1d2b; --suave: #566879; --linha: #dbe4ec;
  --acento: #087f82; --acento-escuro: #066568; --acento-texto: #ffffff; --acento-suave: #def3f1;
  --ok: #17794b; --aviso: #8a5200; --aviso-fundo: #fcefd6; --erro: #b3261e; --erro-fundo: #fbe3e0; --ok-fundo: #dcf3e6;
  --heroi: linear-gradient(135deg, #0b2540 0%, #0d5470 58%, #0a8a8d 100%);
  --sombra: 0 1px 2px rgba(15, 29, 43, .06), 0 6px 18px rgba(15, 29, 43, .06);
  --raio: 16px; --barra-h: 3.5rem; --abas-h: 4.25rem; --lateral-w: 16rem;
  --fonte: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}
:root[data-tema="escuro"] {
  --fundo: #07121d; --papel: #0e2033; --papel-2: #12283e; --tinta: #e7f0f7; --suave: #9db1c3; --linha: #1c3550;
  --acento: #2dd4bf; --acento-escuro: #5eead4; --acento-texto: #04211e; --acento-suave: #0f3a3d;
  --ok: #5ddb95; --aviso: #fbbf24; --aviso-fundo: #3a2a07; --erro: #ff8a80; --erro-fundo: #3d1512; --ok-fundo: #0f3a26;
  --heroi: linear-gradient(135deg, #0a1c30 0%, #0c4560 58%, #0b7d80 100%);
  --sombra: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .25);
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-tema="claro"]) {
    --fundo: #07121d; --papel: #0e2033; --papel-2: #12283e; --tinta: #e7f0f7; --suave: #9db1c3; --linha: #1c3550;
    --acento: #2dd4bf; --acento-escuro: #5eead4; --acento-texto: #04211e; --acento-suave: #0f3a3d;
    --ok: #5ddb95; --aviso: #fbbf24; --aviso-fundo: #3a2a07; --erro: #ff8a80; --erro-fundo: #3d1512; --ok-fundo: #0f3a26;
    --heroi: linear-gradient(135deg, #0a1c30 0%, #0c4560 58%, #0b7d80 100%);
    --sombra: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .25);
    color-scheme: dark;
  }
}

/* ===== Base ===== */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--fundo); color: var(--tinta); font: 16px/1.5 var(--fonte); -webkit-tap-highlight-color: transparent; }
a { color: var(--acento); }
h1, h2 { line-height: 1.2; letter-spacing: -.01em; }
h1 { font-size: 1.65rem; margin: 0 0 1rem; }
h2 { font-size: 1.1rem; margin: 1.75rem 0 .75rem; }
p { margin: 0 0 1rem; }
.suave { color: var(--suave); }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.i { width: 1.4rem; height: 1.4rem; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
:focus-visible { outline: 3px solid var(--acento); outline-offset: 2px; border-radius: 6px; }
.pular { position: absolute; left: -999px; top: 0; background: var(--acento); color: var(--acento-texto); padding: .5rem 1rem; z-index: 100; }
.pular:focus { left: .5rem; top: .5rem; }

/* ===== Estrutura ===== */
.app { min-height: 100vh; min-height: 100dvh; }
.lateral { display: none; }
.coluna { min-width: 0; }
.barra { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  height: calc(var(--barra-h) + env(safe-area-inset-top, 0px)); padding: env(safe-area-inset-top, 0px) 1rem 0;
  background: color-mix(in srgb, var(--papel) 88%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-bottom: 1px solid var(--linha); }
.marca { display: flex; align-items: center; gap: .6rem; font-weight: 700; min-width: 0; }
.marca span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.marca-i { color: var(--acento); width: 1.7rem; height: 1.7rem; }
.barra-acoes { display: flex; align-items: center; gap: .25rem; }
.barra-acoes form { margin: 0; }
.icone-botao { width: 2.75rem; height: 2.75rem; display: grid; place-items: center; border: 0; background: transparent; color: var(--tinta); border-radius: 12px; cursor: pointer; }
.icone-botao:hover { background: var(--papel-2); }
.tema-sol { display: none; }
:root[data-tema="escuro"] .tema-sol { display: block; } :root[data-tema="escuro"] .tema-lua { display: none; }
@media (prefers-color-scheme: dark) { :root:not([data-tema="claro"]) .tema-sol { display: block; } :root:not([data-tema="claro"]) .tema-lua { display: none; } }
.conteudo { padding: 1.25rem 1rem calc(var(--abas-h) + 2rem + env(safe-area-inset-bottom, 0px)); max-width: 76rem; margin: 0 auto; }
.solo { min-height: 100dvh; display: grid; place-items: center; padding: 1.5rem 1rem; }
.titulo-pagina { margin-top: .25rem; }

/* Abas inferiores (celular) */
.abas { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: grid; grid-template-columns: repeat(5, 1fr);
  padding: .35rem .25rem calc(.35rem + env(safe-area-inset-bottom, 0px)); background: color-mix(in srgb, var(--papel) 92%, transparent);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-top: 1px solid var(--linha); }
.abas a { display: grid; justify-items: center; gap: .15rem; padding: .35rem .1rem; color: var(--suave); text-decoration: none; font-size: .72rem; font-weight: 600; border-radius: 12px; position: relative; transition: color .2s; }
.abas a[aria-current="page"] { color: var(--acento); }
.abas a[aria-current="page"]::before { content: ""; position: absolute; top: -.35rem; width: 1.8rem; height: 3px; border-radius: 0 0 3px 3px; background: var(--acento); animation: abrir .3s ease-out; }
.abas a:active { background: var(--papel-2); }

/* Desktop */
@media (min-width: 900px) {
  .app { display: grid; grid-template-columns: var(--lateral-w) 1fr; }
  .lateral { display: flex; flex-direction: column; gap: 1.5rem; position: sticky; top: 0; height: 100vh; padding: 1.25rem 1rem; background: #0a1c30; color: #dbe7f1; }
  .lateral .marca { font-size: 1.1rem; color: #fff; padding: 0 .5rem; } .lateral .marca-i { color: #5eead4; }
  .lateral nav { display: grid; gap: .25rem; }
  .lateral nav a { display: flex; align-items: center; gap: .75rem; padding: .65rem .75rem; border-radius: 12px; color: #c4d4e2; text-decoration: none; font-weight: 600; transition: background .2s, color .2s; }
  .lateral nav a:hover { background: rgba(255, 255, 255, .08); color: #fff; }
  .lateral nav a[aria-current="page"] { background: rgba(94, 234, 212, .16); color: #5eead4; }
  .lateral-rodape { margin-top: auto; padding: .75rem; border-top: 1px solid rgba(255, 255, 255, .12); font-size: .9rem; }
  .lateral-rodape p { margin: 0; } .empresa-nome { color: #fff; font-weight: 600; } .usuario-nome { color: #9db6cb; }
  .barra { justify-content: flex-end; } .marca-barra { display: none; }
  .abas { display: none; }
  .conteudo { padding: 1.75rem 2rem 3rem; }
  h1 { font-size: 1.9rem; }
}

/* ===== Avisos ===== */
.avisos { max-width: 76rem; margin: 1rem auto 0; padding: 0 1rem; display: grid; gap: .5rem; }
.aviso { margin: 0; padding: .7rem 1rem; border-radius: 12px; border-left: 4px solid; background: var(--papel); box-shadow: var(--sombra); animation: subir .4s both; }
.aviso.ok { border-color: var(--ok); background: var(--ok-fundo); } .aviso.erro { border-color: var(--erro); background: var(--erro-fundo); } .aviso.aviso { border-color: var(--aviso); background: var(--aviso-fundo); }
@media (min-width: 900px) { .avisos { padding: 0 2rem; } }

/* ===== Cartões, KPIs ===== */
.cartao { background: var(--papel); border: 1px solid var(--linha); border-radius: var(--raio); padding: 1rem 1.1rem; box-shadow: var(--sombra); margin-bottom: 1rem; }
.cartao h2 { margin-top: 0; }
.hero { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1.4rem 1.25rem; border-radius: 22px; color: #fff; background: var(--heroi); box-shadow: 0 10px 30px rgba(8, 63, 86, .28); margin-bottom: 1rem; position: relative; overflow: hidden; }
.hero::after { content: ""; position: absolute; right: -3rem; top: -3rem; width: 11rem; height: 11rem; border-radius: 50%; background: radial-gradient(circle, rgba(255, 255, 255, .16), transparent 70%); pointer-events: none; }
.hero .rotulo { margin: 0; font-size: .85rem; text-transform: uppercase; letter-spacing: .08em; opacity: .85; }
.hero-num { margin: .1rem 0; font-size: clamp(2.6rem, 11vw, 3.8rem); font-weight: 750; line-height: 1; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.hero-sub { margin: 0; opacity: .92; } .hero-sub strong { font-variant-numeric: tabular-nums; }
.anel-caixa { position: relative; width: 6.5rem; height: 6.5rem; flex: none; }
.anel { width: 100%; height: 100%; transform: rotate(-90deg); }
.anel circle { fill: none; stroke-width: 9; }
.anel-fundo { stroke: rgba(255, 255, 255, .2); }
.anel-valor { stroke: #7cf0dc; stroke-linecap: round; stroke-dasharray: 263.9; stroke-dashoffset: 263.9; transition: stroke-dashoffset 1.1s cubic-bezier(.2, .8, .2, 1); }
.anel-pct { position: absolute; inset: 0; display: grid; place-items: center; font-weight: 700; font-size: 1.15rem; font-variant-numeric: tabular-nums; }
.kpis { display: grid; grid-template-columns: repeat(2, 1fr); gap: .75rem; margin-bottom: 1rem; }
.kpi { background: var(--papel); border: 1px solid var(--linha); border-radius: var(--raio); padding: .9rem 1rem; box-shadow: var(--sombra); display: grid; gap: .25rem; align-content: start; }
.kpi-rotulo { color: var(--suave); font-size: .85rem; }
.kpi-num { font-size: 1.8rem; line-height: 1.1; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.kpi-txt { font-size: 1.05rem; line-height: 1.5; }
@media (min-width: 700px) { .kpis { grid-template-columns: repeat(4, 1fr); } .hero { padding: 1.75rem 2rem; } .anel-caixa { width: 8rem; height: 8rem; } }
.duas { display: grid; gap: 1rem; } @media (min-width: 900px) { .duas { grid-template-columns: 1.2fr 1fr; } }
.aviso-pendentes a { font-weight: 700; }

/* Gráfico de barras */
.grafico { display: flex; align-items: flex-end; gap: .3rem; height: 10rem; padding-top: .5rem; }
.col { flex: 1; min-width: 0; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: .3rem; background: none; border: 0; padding: 0; color: var(--suave); font: inherit; cursor: pointer; }
.col-barra { width: 100%; max-width: 2.2rem; height: calc(var(--h, 0) * 1%); min-height: 3px; border-radius: 8px 8px 3px 3px; background: linear-gradient(180deg, var(--acento), color-mix(in srgb, var(--acento) 55%, transparent)); transform-origin: bottom; animation: crescer .7s cubic-bezier(.2, .8, .2, 1) both; animation-delay: calc(var(--i, 0) * 40ms); transition: filter .2s, transform .2s; }
.col:hover .col-barra, .col[aria-pressed="true"] .col-barra { filter: brightness(1.15) saturate(1.2); }
.col[aria-pressed="true"] { color: var(--tinta); font-weight: 700; }
.col-rotulo { font-size: .66rem; white-space: nowrap; height: 1rem; }
@media (max-width: 520px) { .col:nth-child(even) .col-rotulo { visibility: hidden; } }
.grafico-detalhe { margin: .6rem 0 0; color: var(--suave); font-size: .92rem; min-height: 1.4rem; }
.grafico-vazio { align-self: center; margin: auto; color: var(--suave); }

/* Listas */
.lista { list-style: none; margin: 0 0 .5rem; padding: 0; display: grid; }
.lista li { display: flex; align-items: center; gap: .75rem; padding: .6rem 0; border-bottom: 1px solid var(--linha); animation: subir .4s both; animation-delay: calc(var(--i, 0) * 50ms); }
.lista li:last-child { border-bottom: 0; }
.lista .vazio { color: var(--suave); }
.avatar { width: 2.4rem; height: 2.4rem; border-radius: 50%; display: grid; place-items: center; flex: none; font-weight: 700; font-size: .85rem; color: #fff; background: hsl(var(--matiz, 190) 55% 38%); }
.lista .texto { min-width: 0; flex: 1; } .lista .texto strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lista .texto small { color: var(--suave); }
.lista .lado { text-align: right; font-variant-numeric: tabular-nums; color: var(--suave); font-size: .9rem; white-space: nowrap; }

/* ===== Tabelas (viram cartões no celular) ===== */
.tabela { background: var(--papel); border: 1px solid var(--linha); border-radius: var(--raio); box-shadow: var(--sombra); overflow-x: auto; margin-bottom: 1rem; }
table { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; }
th, td { text-align: left; padding: .6rem .85rem; border-bottom: 1px solid var(--linha); vertical-align: top; }
th { background: var(--papel-2); font-size: .85rem; color: var(--suave); white-space: nowrap; }
td.num, th.num { text-align: right; }
tbody tr { transition: background .15s; } tbody tr:hover { background: var(--papel-2); }
tr:last-child td { border-bottom: 0; }
@media (max-width: 700px) {
  .cartoes thead { position: absolute; left: -9999px; }
  .cartoes tr { display: block; padding: .6rem .9rem; border-bottom: 1px solid var(--linha); }
  .cartoes td { display: flex; justify-content: space-between; gap: 1rem; border: 0; padding: .2rem 0; text-align: right; }
  .cartoes td::before { content: attr(data-label); color: var(--suave); font-size: .85rem; text-align: left; flex: none; }
  .cartoes td.num { text-align: right; }
}
.etiqueta { display: inline-block; padding: .05rem .55rem; border-radius: 999px; background: var(--papel-2); border: 1px solid var(--linha); font-size: .8rem; }
.etiqueta.aviso { background: var(--aviso-fundo); color: var(--aviso); border-color: transparent; box-shadow: none; animation: none; border-left-width: 1px; }
.paginacao { display: flex; gap: .75rem; margin: 1rem 0; }

/* ===== Formulários ===== */
.formulario { display: grid; gap: 1rem; }
.formulario.em-linha { grid-template-columns: 1fr; align-items: end; }
@media (min-width: 700px) { .formulario.em-linha { grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr)); } }
label { display: grid; gap: .3rem; font-size: .9rem; color: var(--suave); font-weight: 600; }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=search] {
  font: inherit; color: var(--tinta); background: var(--papel); border: 1px solid color-mix(in srgb, var(--suave) 55%, var(--linha)); border-radius: 12px; padding: .65rem .8rem; min-height: 2.9rem; width: 100%; transition: border-color .2s, box-shadow .2s; }
input:focus { border-color: var(--acento); box-shadow: 0 0 0 3px color-mix(in srgb, var(--acento) 25%, transparent); outline: none; }
.botao { font: inherit; font-weight: 650; display: inline-flex; align-items: center; justify-content: center; gap: .5rem; min-height: 2.9rem; padding: .6rem 1.25rem; border: 0; border-radius: 12px; background: var(--acento); color: var(--acento-texto); cursor: pointer; text-decoration: none; transition: transform .15s, filter .2s, box-shadow .2s; }
.botao:hover { filter: brightness(1.08); box-shadow: 0 6px 16px color-mix(in srgb, var(--acento) 35%, transparent); }
.botao:active { transform: translateY(1px) scale(.99); }
.botao.claro { background: var(--papel-2); color: var(--tinta); border: 1px solid var(--linha); box-shadow: none; }
.botao.grande { width: 100%; min-height: 3.2rem; font-size: 1.05rem; }
.botao[disabled] { opacity: .65; cursor: progress; }
form.embutido { display: flex; gap: .5rem; margin: 0; flex-wrap: wrap; } form.embutido input { flex: 1; min-width: 9rem; }
.entrar { width: min(100%, 24rem); background: var(--papel); border: 1px solid var(--linha); border-radius: 22px; padding: 1.75rem 1.5rem; box-shadow: var(--sombra); }
.entrar h1 { margin-bottom: .25rem; } .entrar-marca { width: 3.4rem; height: 3.4rem; display: grid; place-items: center; border-radius: 16px; background: var(--acento-suave); margin-bottom: 1rem; }
.entrar-marca .marca-i { width: 2rem; height: 2rem; }

/* Importar */
.zona { display: grid; gap: 1rem; max-width: 38rem; }
.soltar { display: grid; justify-items: center; gap: .35rem; text-align: center; padding: 2rem 1rem; border: 2px dashed color-mix(in srgb, var(--acento) 55%, var(--linha)); border-radius: var(--raio); background: var(--acento-suave); color: var(--tinta); cursor: pointer; transition: transform .2s, background .2s, border-color .2s; position: relative; }
.soltar:hover, .soltar.sobre { transform: translateY(-2px); border-color: var(--acento); }
.soltar input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }
.soltar-titulo { font-weight: 700; font-size: 1.05rem; word-break: break-all; } .soltar-dica { color: var(--suave); font-weight: 400; }
.grande-i { width: 2.4rem; height: 2.4rem; color: var(--acento); }
.soltar.cheio { border-style: solid; }

/* ===== Animações ===== */
@keyframes subir { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes crescer { from { transform: scaleY(0); } to { transform: scaleY(1); } }
@keyframes abrir { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes brilho { from { background-position: -30rem 0; } to { background-position: 30rem 0; } }
.reveal { animation: subir .55s cubic-bezier(.2, .8, .2, 1) both; animation-delay: calc(var(--i, 0) * 60ms); }
.carregando .hero-num, .carregando .hero-sub strong { color: transparent; border-radius: 8px; background: linear-gradient(90deg, rgba(255, 255, 255, .12) 0, rgba(255, 255, 255, .3) 8rem, rgba(255, 255, 255, .12) 16rem) 0 0 / 30rem 100%; animation: brilho 1.2s linear infinite; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-delay: 0ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* Nome da empresa como atalho para os dados da empresa */
.empresa-nome a, .marca-barra a { color: inherit; text-decoration: none; }
.empresa-nome a:hover, .marca-barra a:hover { text-decoration: underline; }

/* Barra de abas com mais de 5 itens: rola para o lado */
.abas { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: minmax(4.4rem, 1fr); overflow-x: auto; scrollbar-width: none; }
.abas::-webkit-scrollbar { display: none; }
