:root {
  --fundo: #0d0c14; --sup: #16151f; --sup2: #1f1d2b; --sup3: #2a2839; --borda: #2c2a3c;
  --texto: #eeedf5; --suave: #a3a1b8; --fraco: #6f6d85;
  --roxo: #8b5cf6; --roxo2: #a78bfa; --roxo-f: rgba(139, 92, 246, .15);
  --verde: #22c55e; --verde-f: rgba(34, 197, 94, .14); --verm: #f43f5e; --verm-f: rgba(244, 63, 94, .14);
  --amar: #f59e0b; --amar-f: rgba(245, 158, 11, .15); --azul: #38bdf8; --azul-f: rgba(56, 189, 248, .14);
  --raio: 16px; --raio-p: 10px;
  --seg-b: env(safe-area-inset-bottom, 0px); --seg-t: env(safe-area-inset-top, 0px);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--fundo); color: var(--texto); min-height: 100vh;
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; overflow-x: hidden;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--roxo2); }
h1, h2, h3 { margin: 0; line-height: 1.2; }
h1 { font-size: 22px; } h2 { font-size: 17px; } h3 { font-size: 15px; }
[hidden] { display: none !important; }
.num { font-variant-numeric: tabular-nums; }
.suave { color: var(--suave); } .fraco { color: var(--fraco); } .peq { font-size: 13px; } .mini { font-size: 12px; }
.verde { color: var(--verde); } .verm { color: var(--verm); } .amar { color: var(--amar); } .roxo { color: var(--roxo2); }
.negrito { font-weight: 650; }
.linha { display: flex; align-items: center; gap: 10px; }
.entre { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.quebra { flex-wrap: wrap; }
.cresce { flex: 1; min-width: 0; }
.trunca { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pilha > * + * { margin-top: 12px; }
.pilha-g > * + * { margin-top: 18px; }

/* ---------- Estrutura ---------- */
.layout { display: flex; min-height: 100vh; }
.lateral { display: none; }
.principal { flex: 1; min-width: 0; padding: calc(64px + var(--seg-t)) 16px calc(92px + var(--seg-b)); max-width: 1180px; margin: 0 auto; }
.topo {
  position: fixed; top: 0; left: 0; right: 0; z-index: 20; padding: calc(8px + var(--seg-t)) 12px 8px;
  background: rgba(13, 12, 20, .9); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--borda); display: flex; align-items: center; gap: 8px; min-height: 56px;
}
.topo .titulo { font-weight: 700; font-size: 17px; flex: 1; min-width: 0; }
.seletor-mes { display: flex; align-items: center; background: var(--sup2); border-radius: 999px; padding: 2px; }
.seletor-mes button { background: none; border: 0; width: 34px; height: 34px; border-radius: 999px; cursor: pointer; font-size: 18px; color: var(--suave); }
.seletor-mes button:hover { background: var(--sup3); color: var(--texto); }
.seletor-mes .rot { min-width: 64px; text-align: center; font-weight: 650; font-size: 14px; cursor: pointer; }
.btn-icone { background: var(--sup2); border: 0; width: 38px; height: 38px; border-radius: 999px; cursor: pointer; font-size: 17px; display: grid; place-items: center; flex: none; }
.btn-icone:hover { background: var(--sup3); }

.nav-baixo {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 20; display: grid; grid-template-columns: repeat(5, 1fr);
  background: rgba(22, 21, 31, .96); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--borda); padding: 6px 4px calc(6px + var(--seg-b));
}
.nav-baixo a { display: flex; flex-direction: column; align-items: center; gap: 2px; text-decoration: none; color: var(--fraco); font-size: 11px; padding: 4px 0; border-radius: 12px; }
.nav-baixo a .ic { font-size: 20px; line-height: 1.1; filter: grayscale(1) opacity(.8); }
.nav-baixo a.ativo { color: var(--texto); }
.nav-baixo a.ativo .ic { filter: none; }
.fab {
  position: fixed; right: 16px; bottom: calc(76px + var(--seg-b)); z-index: 21; width: 56px; height: 56px; border-radius: 18px; border: 0;
  background: linear-gradient(135deg, var(--roxo), #6366f1); color: #fff; font-size: 30px; line-height: 1; cursor: pointer;
  box-shadow: 0 10px 30px rgba(124, 58, 237, .45); display: grid; place-items: center; text-decoration: none;
}

@media (min-width: 900px) {
  .lateral {
    display: flex; flex-direction: column; gap: 4px; width: 236px; flex: none; position: sticky; top: 0; height: 100vh;
    padding: 18px 12px; border-right: 1px solid var(--borda); background: var(--sup);
  }
  .lateral .marca { display: flex; align-items: center; gap: 10px; padding: 4px 10px 18px; font-weight: 750; font-size: 17px; }
  .lateral .marca img { width: 30px; height: 30px; border-radius: 8px; }
  .lateral a { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; text-decoration: none; color: var(--suave); }
  .lateral a:hover { background: var(--sup2); color: var(--texto); }
  .lateral a.ativo { background: var(--roxo-f); color: var(--texto); font-weight: 600; }
  .lateral .rodape { margin-top: auto; padding: 10px 12px; font-size: 13px; color: var(--fraco); }
  .lateral .btn { margin: 0 0 12px; }
  .topo { left: 236px; padding-left: 24px; padding-right: 24px; }
  .principal { padding: 84px 28px 40px; }
  .nav-baixo, .fab { display: none; }
}

/* ---------- Componentes ---------- */
.cartao-ui { background: var(--sup); border: 1px solid var(--borda); border-radius: var(--raio); padding: 16px; }
.cartao-ui.plano { background: transparent; }
.cartao-ui h2 { margin-bottom: 12px; }
.grade { display: grid; gap: 12px; }
.grade.k2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 640px) { .grade.k4 { grid-template-columns: repeat(4, minmax(0, 1fr)); } .grade.k3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 900px) { .grade.d2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grade.d3 { grid-template-columns: 2fr 1fr; } }
@media (max-width: 639px) { .grade.k4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.destaque {
  border-radius: 22px; padding: 20px; border: 1px solid rgba(167, 139, 250, .25);
  background: radial-gradient(120% 140% at 0% 0%, rgba(139, 92, 246, .35), transparent 55%), linear-gradient(160deg, #1d1838, #14121f);
}
.destaque .rot { color: var(--suave); font-size: 13px; }
.destaque .valor { font-size: 34px; font-weight: 760; letter-spacing: -.5px; margin: 2px 0 10px; }
.kpi { background: var(--sup); border: 1px solid var(--borda); border-radius: 14px; padding: 12px 14px; min-width: 0; }
.kpi .rot { font-size: 12px; color: var(--suave); }
.kpi .val { font-size: 19px; font-weight: 700; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi .det { font-size: 12px; color: var(--fraco); margin-top: 2px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: 12px; cursor: pointer;
  background: var(--sup3); color: var(--texto); padding: 0 16px; min-height: 44px; font-weight: 600; text-decoration: none; white-space: nowrap;
}
.btn:hover { filter: brightness(1.12); }
.btn:disabled { opacity: .5; cursor: default; filter: none; }
.btn.prim { background: linear-gradient(135deg, var(--roxo), #6366f1); color: #fff; }
.btn.verde { background: var(--verde); color: #04260f; }
.btn.zap { background: #25d366; color: #052e15; }
.btn.perigo { background: var(--verm-f); color: var(--verm); }
.btn.fantasma { background: transparent; border: 1px solid var(--borda); }
.btn.peq { min-height: 34px; padding: 0 12px; font-size: 13px; border-radius: 10px; }
.btn.bloco { width: 100%; }
.btns { display: flex; gap: 8px; flex-wrap: wrap; }

.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; border: 1px solid var(--borda); background: var(--sup); border-radius: 999px; padding: 7px 14px; cursor: pointer;
  font-size: 14px; color: var(--suave); display: inline-flex; align-items: center; gap: 6px;
}
.chip.ativo { background: var(--texto); color: #111; border-color: var(--texto); font-weight: 600; }
.ponto { width: 10px; height: 10px; border-radius: 50%; background: var(--cor, var(--roxo)); flex: none; display: inline-block; }

.selo { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.selo.pago { background: var(--verde-f); color: var(--verde); }
.selo.pendente { background: var(--sup3); color: var(--suave); }
.selo.informado { background: var(--azul-f); color: var(--azul); }
.selo.atraso { background: var(--verm-f); color: var(--verm); }
.selo.roxo { background: var(--roxo-f); color: var(--roxo2); }
.selo.amar { background: var(--amar-f); color: var(--amar); }

.lista { display: flex; flex-direction: column; }
.item { display: flex; gap: 12px; align-items: center; padding: 12px 0; border-top: 1px solid var(--borda); min-width: 0; }
.item:first-child { border-top: 0; }
.item .ico {
  width: 40px; height: 40px; border-radius: 12px; flex: none; display: grid; place-items: center; font-size: 18px;
  background: color-mix(in srgb, var(--cor, var(--roxo)) 22%, var(--sup2));
}
.item .nome { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .sub { font-size: 13px; color: var(--suave); overflow-wrap: anywhere; }
.item .dir { text-align: right; flex: none; }
.item .dir .v { font-weight: 650; }
.item.clicavel { cursor: pointer; }
.item .acoes-item { margin-top: 6px; gap: 8px; }
.item { align-items: flex-start; }
.item .ico { margin-top: 2px; }
.item.clicavel:hover .nome { color: var(--roxo2); }

.barra { height: 8px; background: var(--sup3); border-radius: 999px; overflow: hidden; }
.barra > i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--roxo), var(--verde)); border-radius: 999px; transition: width .4s; }
.barra.fina { height: 5px; }

.alerta { border-radius: 14px; padding: 12px 14px; display: flex; gap: 10px; align-items: flex-start; }
.alerta.verm { background: var(--verm-f); color: #fecdd3; border: 1px solid rgba(244, 63, 94, .3); }
.alerta.amar { background: var(--amar-f); color: #fde68a; border: 1px solid rgba(245, 158, 11, .3); }
.alerta.azul { background: var(--azul-f); color: #bae6fd; border: 1px solid rgba(56, 189, 248, .3); }
.alerta.verde { background: var(--verde-f); color: #bbf7d0; border: 1px solid rgba(34, 197, 94, .3); }

.vazio { text-align: center; padding: 32px 16px; color: var(--suave); }
.vazio .ic { font-size: 36px; margin-bottom: 6px; }

/* ---------- Formulários ---------- */
.campo { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.campo > span { font-size: 13px; color: var(--suave); font-weight: 500; }
.campo small { color: var(--fraco); font-size: 12px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=month], input[type=tel], input[type=search], select, textarea {
  width: 100%; min-height: 46px; background: var(--sup2); border: 1px solid var(--borda); border-radius: 12px; padding: 10px 12px;
  font-size: 16px; outline: none; min-width: 0;
}
textarea { min-height: 70px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--roxo); box-shadow: 0 0 0 3px var(--roxo-f); }
input[type=color] { width: 46px; height: 46px; border: 1px solid var(--borda); border-radius: 12px; background: var(--sup2); padding: 4px; }
.duas { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tres { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
.senha-box { position: relative; }
.senha-box input { padding-right: 52px; }
.senha-box button { position: absolute; right: 4px; top: 4px; height: 38px; width: 44px; border: 0; background: none; cursor: pointer; font-size: 17px; }
.segmentado { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: var(--sup2); border-radius: 12px; padding: 3px; gap: 3px; }
.segmentado button { border: 0; background: none; border-radius: 9px; min-height: 38px; cursor: pointer; color: var(--suave); font-weight: 600; font-size: 14px; }
.segmentado button.ativo { background: var(--sup3); color: var(--texto); }
.check { display: flex; gap: 10px; align-items: center; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--roxo); }
.previa { background: var(--sup2); border-radius: 12px; padding: 12px; font-size: 14px; }
.erro-form { color: var(--verm); font-size: 14px; min-height: 0; }

/* ---------- Login ---------- */
.entrada { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.entrada .caixa { width: 100%; max-width: 400px; }
.entrada .logo { display: flex; flex-direction: column; align-items: center; gap: 10px; margin-bottom: 22px; text-align: center; }
.entrada .logo img { width: 64px; height: 64px; border-radius: 18px; }

/* ---------- Sheet (janela que sobe de baixo) ---------- */
.sheet-fundo { position: fixed; inset: 0; background: rgba(0, 0, 0, .6); z-index: 40; animation: aparece .2s; }
.sheet {
  position: fixed; z-index: 41; left: 0; right: 0; bottom: 0; max-height: 92vh; overflow-y: auto; overscroll-behavior: contain;
  background: var(--sup); border-radius: 22px 22px 0 0; border: 1px solid var(--borda); border-bottom: 0;
  padding: 8px 16px calc(20px + var(--seg-b)); animation: sobe .25s cubic-bezier(.2, .8, .2, 1);
}
.sheet .alca { width: 40px; height: 5px; border-radius: 9px; background: var(--sup3); margin: 4px auto 12px; }
.sheet .cab { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
@media (min-width: 700px) {
  .sheet { left: 50%; top: 50%; bottom: auto; transform: translate(-50%, -50%); width: min(620px, 94vw); max-height: 88vh; border-radius: 22px; border-bottom: 1px solid var(--borda); padding-bottom: 20px; animation: aparece .2s; }
  .sheet .alca { display: none; }
}
@keyframes sobe { from { transform: translateY(40px); opacity: 0; } }
@keyframes aparece { from { opacity: 0; } }

.toasts { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(150px + var(--seg-b)); z-index: 60; display: flex; flex-direction: column; gap: 8px; width: min(92vw, 420px); pointer-events: none; }
@media (min-width: 900px) { .toasts { bottom: 24px; } }
.toast { background: #2d2b40; border: 1px solid var(--borda); padding: 12px 14px; border-radius: 12px; box-shadow: 0 10px 30px rgba(0, 0, 0, .4); pointer-events: auto; display: flex; gap: 10px; align-items: center; animation: sobe .2s; }
.toast.erro { background: #3b1520; border-color: rgba(244, 63, 94, .4); }
.toast.ok { background: #10301d; border-color: rgba(34, 197, 94, .4); }
.toast button { margin-left: auto; }

.faixa-offline { position: fixed; top: 0; left: 0; right: 0; z-index: 50; background: var(--amar); color: #2a1a00; text-align: center; font-size: 13px; padding: calc(4px + var(--seg-t)) 8px 4px; font-weight: 600; }

/* ---------- Carregando ---------- */
.carregando-inicial { min-height: 100vh; display: grid; place-items: center; }
.spinner { width: 34px; height: 34px; border: 3px solid var(--sup3); border-top-color: var(--roxo); border-radius: 50%; animation: gira .8s linear infinite; }
@keyframes gira { to { transform: rotate(360deg); } }
.spinner.mini-spin { width: 18px; height: 18px; border-width: 2px; }
.esqueleto { background: linear-gradient(90deg, var(--sup) 0%, var(--sup2) 50%, var(--sup) 100%); background-size: 200% 100%; animation: brilho 1.2s infinite; border-radius: var(--raio); }
@keyframes brilho { to { background-position: -200% 0; } }

/* ---------- Gráficos e tabelas ---------- */
.grafico svg { width: 100%; height: auto; display: block; }
.grafico text { fill: var(--fraco); font-size: 11px; }
.tabela-rol { overflow-x: auto; margin: 0 -16px; padding: 0 16px; }
table.t { width: 100%; border-collapse: collapse; font-size: 14px; }
table.t th { text-align: left; color: var(--suave); font-weight: 500; font-size: 12px; padding: 8px 10px; border-bottom: 1px solid var(--borda); white-space: nowrap; }
table.t td { padding: 9px 10px; border-bottom: 1px solid var(--borda); white-space: nowrap; }
table.t td.n, table.t th.n { text-align: right; }
table.t tr.atual td { background: var(--roxo-f); }
table.t tfoot td { font-weight: 700; border-bottom: 0; }

.cal-venc { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; text-align: center; font-size: 12px; }
.cal-venc .dsem { color: var(--fraco); padding: 2px 0; }
.cal-venc .dia { aspect-ratio: 1; border-radius: 10px; display: grid; place-items: center; color: var(--suave); position: relative; }
.cal-venc .dia.tem { background: var(--roxo-f); color: var(--texto); font-weight: 700; }
.cal-venc .dia.tem.pago { background: var(--verde-f); }
.cal-venc .dia.hoje { outline: 2px solid var(--roxo); }
.cal-venc .dia i { position: absolute; bottom: 4px; width: 4px; height: 4px; border-radius: 50%; background: var(--roxo2); }

.cat-linha { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; align-items: center; }
.cat-linha .barra { grid-column: 1 / -1; }

.secao-tit { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 6px 2px 10px; }
.secao-tit h2 { font-size: 16px; }
.mais-grade { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.mais-grade a { display: flex; flex-direction: column; gap: 6px; padding: 16px; border-radius: 14px; background: var(--sup2); text-decoration: none; color: var(--texto); font-weight: 600; }
.mais-grade a span { font-size: 24px; }
.img-extrato { width: 100%; border-radius: 14px; border: 1px solid var(--borda); display: block; }
.codigo { font-family: ui-monospace, Consolas, monospace; letter-spacing: 1px; background: var(--sup3); padding: 2px 8px; border-radius: 6px; font-size: 14px; }
.codigo.grande { font-size: 26px; letter-spacing: 4px; padding: 10px 16px; display: inline-block; }
hr.sep { border: 0; border-top: 1px solid var(--borda); margin: 16px 0; }
.tabela-import .item { align-items: flex-start; }
.tabela-import select { min-height: 40px; font-size: 15px; padding: 6px 10px; }
.tabela-import input[type=text] { min-height: 40px; font-size: 15px; padding: 6px 10px; }
