/* Sulmix Dashboard Contabil */
:root {
  --azul: #283667;
  --azul-escuro: #1F3353;
  --azul-2: #4A5A95;
  --azul-3: #8A97C4;
  --laranja: #FA7E04;
  --laranja-2: #FFA54D;
  --laranja-escuro: #D96B00;
  --branco: #FFFFFF;
  --fundo: #F4F6FA;
  --borda: #E1E5EE;
  --grade: #E6E9F0;
  --texto: #1F3353;
  --texto-2: #4B5875;
  --texto-3: #7A849B;
  --positivo: #1E8E5A;
  --negativo: #C63B3B;
  --aviso: #B26A00;
  --raio: 10px;
  --sombra: 0 1px 2px rgba(31, 51, 83, .06), 0 2px 8px rgba(31, 51, 83, .05);
  --sidebar: 236px;
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { background: var(--fundo); color: var(--texto); font-size: 14px; line-height: 1.45; }
a { color: var(--azul-2); }
h1, h2, h3 { color: var(--azul-escuro); margin: 0; }
h1 { font-size: 22px; font-weight: 650; }
h2 { font-size: 16px; font-weight: 650; }
h3 { font-size: 14px; font-weight: 650; }
.num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.pos { color: var(--positivo); }
.neg { color: var(--negativo); }
.muted { color: var(--texto-3); }
.oculto { display: none !important; }

/* ---------- layout ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar); background: var(--azul); color: #DCE2F2; flex-shrink: 0;
  display: flex; flex-direction: column; position: fixed; top: 0; bottom: 0; left: 0; z-index: 30;
}
.sidebar .marca { padding: 22px 20px 18px; border-bottom: 1px solid rgba(255,255,255,.08); }
.sidebar .marca img { width: 150px; height: auto; display: block; }
.sidebar .marca span { display: block; font-size: 11.5px; letter-spacing: .4px; margin-top: 8px; color: #AEB8D6; }
.sidebar nav { flex: 1; padding: 12px 10px; overflow-y: auto; }
.sidebar nav .secao { font-size: 11px; text-transform: uppercase; letter-spacing: .8px; color: #8E99BD; margin: 16px 12px 6px; }
.sidebar nav a {
  display: flex; align-items: center; gap: 10px; color: #DCE2F2; text-decoration: none;
  padding: 9px 12px; border-radius: 8px; font-weight: 500; margin-bottom: 2px;
}
.sidebar nav a:hover { background: rgba(255,255,255,.07); color: #fff; }
.sidebar nav a.ativo { background: rgba(250,126,4,.16); color: #fff; box-shadow: inset 3px 0 0 var(--laranja); }
.sidebar nav svg { width: 18px; height: 18px; flex-shrink: 0; opacity: .9; }
.sidebar .usuario { padding: 14px 18px; border-top: 1px solid rgba(255,255,255,.08); font-size: 13px; }
.sidebar .usuario b { color: #fff; display: block; }
.sidebar .usuario form { margin-top: 8px; }
.sidebar .usuario button { background: none; border: 1px solid rgba(255,255,255,.25); color: #DCE2F2; border-radius: 6px;
  padding: 5px 10px; cursor: pointer; font-size: 12.5px; }
.sidebar .usuario button:hover { border-color: var(--laranja); color: #fff; }
.conteudo { margin-left: var(--sidebar); flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topo { background: var(--branco); border-bottom: 1px solid var(--borda); padding: 16px 28px; display: flex; align-items: center; gap: 16px; }
.topo .subtitulo { color: var(--texto-3); font-size: 13px; margin-top: 2px; }
.menu-btn { display: none; background: none; border: 0; cursor: pointer; padding: 4px; color: var(--azul); }
main { padding: 22px 28px 28px; flex: 1; min-width: 0; }

.rodape { padding: 18px 28px 22px; color: var(--texto-3); font-size: 12.5px; border-top: 1px solid var(--borda); background: var(--branco); }
.rodape .suporte { margin-bottom: 8px; color: var(--texto-2); }
.rodape .suporte a { color: var(--texto-2); text-decoration: none; }
.rodape .suporte a:hover { color: var(--laranja-escuro); }

/* ---------- componentes ---------- */
.card { background: var(--branco); border: 1px solid var(--borda); border-radius: var(--raio); box-shadow: var(--sombra); }
.card > .card-cab { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px 0; }
.card > .card-corpo { padding: 14px 18px 18px; }
.card .card-sub { color: var(--texto-3); font-size: 12.5px; }
.grade { display: grid; gap: 16px; }
.grade-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grade-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.mt { margin-top: 16px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; border-radius: 8px; border: 1px solid var(--borda);
  background: var(--branco); color: var(--azul-escuro); padding: 8px 14px; font-weight: 600; font-size: 13.5px; cursor: pointer;
  text-decoration: none; line-height: 1.2; font-family: inherit;
}
.btn:hover { border-color: var(--azul-3); }
.btn-primario { background: var(--laranja); border-color: var(--laranja); color: #fff; }
.btn-primario:hover { background: var(--laranja-escuro); border-color: var(--laranja-escuro); }
.btn-azul { background: var(--azul); border-color: var(--azul); color: #fff; }
.btn-azul:hover { background: var(--azul-escuro); }
.btn-perigo { color: var(--negativo); }
.btn-perigo:hover { border-color: var(--negativo); }
.btn-sm { padding: 5px 10px; font-size: 12.5px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

label { font-size: 12.5px; color: var(--texto-2); font-weight: 600; display: block; margin-bottom: 4px; }
input[type=text], input[type=password], input[type=number], input[type=date], input[type=search], select, textarea {
  width: 100%; border: 1px solid #CDD3E1; border-radius: 8px; padding: 8px 10px; font-size: 14px; font-family: inherit;
  color: var(--texto); background: #fff;
}
input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible {
  outline: 2px solid var(--laranja); outline-offset: 1px;
}
.campo { margin-bottom: 14px; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 500; color: var(--texto-2); font-size: 13.5px; }

.filtros { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; margin-bottom: 18px; }
.filtros .f { min-width: 130px; }
.filtros .f-largo { min-width: 220px; }
.filtros select, .filtros input { padding: 7px 9px; }
.filtros .acoes { margin-left: auto; display: flex; gap: 8px; }

.alerta { border-radius: 8px; padding: 10px 14px; margin-bottom: 14px; border: 1px solid; font-size: 13.5px; }
.alerta-erro { background: #FCEDED; border-color: #F1C4C4; color: #8E2525; }
.alerta-ok { background: #E9F6EF; border-color: #BFE3CF; color: #17663F; }
.alerta-aviso { background: #FFF5E6; border-color: #F5D7A6; color: #7A4A00; }
.alerta-info { background: #EEF1F9; border-color: #D2D9EE; color: var(--azul-escuro); }

.tag { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 650; }
.tag-ativo { background: #E9F6EF; color: #17663F; }
.tag-pendente { background: #FFF5E6; color: #7A4A00; }
.tag-substituido { background: #EEF1F9; color: var(--azul-2); }
.tag-invalido, .tag-bloqueado { background: #FCEDED; color: #8E2525; }
.tag-descartado { background: #F0F0F0; color: #666; }
.tag-admin { background: rgba(250,126,4,.14); color: var(--laranja-escuro); }
.tag-usuario { background: #EEF1F9; color: var(--azul-2); }

table.tabela { width: 100%; border-collapse: collapse; font-size: 13px; }
.tabela th { text-align: left; color: var(--texto-2); font-weight: 650; font-size: 12px; padding: 9px 10px; border-bottom: 1px solid var(--borda);
  background: #F8F9FC; white-space: nowrap; }
.tabela td { padding: 8px 10px; border-bottom: 1px solid #EEF0F5; vertical-align: middle; }
.tabela tr:hover td { background: #FAFBFD; }
.tabela-rolagem { overflow: auto; max-width: 100%; }
.vazio { padding: 40px 20px; text-align: center; color: var(--texto-3); }

/* ---------- KPIs ---------- */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 16px; }
.kpi { padding: 14px 16px; }
.kpi .rot { font-size: 12.5px; color: var(--texto-2); font-weight: 600; }
.kpi .val { font-size: 22px; font-weight: 650; margin-top: 6px; color: var(--azul-escuro); font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi .var { font-size: 12.5px; margin-top: 4px; color: var(--texto-3); display: flex; gap: 6px; align-items: center; }
.kpi .var b { font-weight: 650; }
.kpi .var .seta { font-size: 11px; }
.kpi.destaque { border-top: 3px solid var(--laranja); }

/* ---------- graficos ---------- */
.grafico { position: relative; height: 290px; }
.grafico-alto { height: 340px; }
.legenda { display: flex; flex-wrap: wrap; gap: 14px; font-size: 12.5px; color: var(--texto-2); }
.legenda span { display: inline-flex; align-items: center; gap: 6px; }
.legenda i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; }
.legenda i.linha { height: 3px; border-radius: 2px; width: 16px; }
.carregando { opacity: .55; transition: opacity .15s; }

/* ---------- demonstrativos ---------- */
.demo-wrap { overflow: auto; max-height: calc(100vh - 230px); border-radius: var(--raio); }
table.demo { border-collapse: separate; border-spacing: 0; font-size: 12.8px; min-width: 100%; }
.demo th, .demo td { padding: 6px 10px; border-bottom: 1px solid #EEF0F5; background: #fff; }
.demo thead th { position: sticky; top: 0; z-index: 3; background: var(--azul); color: #fff; font-weight: 600; font-size: 12px; text-align: right; white-space: nowrap; }
.demo thead th.desc { text-align: left; }
.demo thead th.mes-pct, .demo thead th.mes-aj { background: var(--azul-2); }
.demo .desc { position: sticky; left: 0; z-index: 2; min-width: 340px; max-width: 420px; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.demo thead th.desc { z-index: 4; }
.demo td.desc .seta { display: inline-block; width: 16px; color: var(--texto-3); cursor: pointer; user-select: none; }
.demo td.desc .cls { color: var(--texto-3); font-size: 11.5px; margin-right: 6px; font-variant-numeric: tabular-nums; }
.demo tr.l-grupo td { font-weight: 600; }
.demo tr.l-nivel0 td { background: #F3F5FA; font-weight: 650; }
.demo tr.l-total td { background: #FFF4E8; font-weight: 700; color: var(--azul-escuro); }
.demo tr.l-total td.desc { box-shadow: inset 3px 0 0 var(--laranja); }
.demo tr.l-conta td { color: var(--texto-2); }
.demo td.pct { color: var(--texto-3); font-size: 11.5px; }
.demo td.aj { color: var(--texto-3); min-width: 90px; }
.demo td.aj.tem { color: var(--laranja-escuro); font-weight: 650; }
.demo td.aj.edit { cursor: pointer; }
.demo td.aj.edit:hover { background: #FFF4E8; outline: 1px dashed var(--laranja); outline-offset: -2px; }
.demo td.acum { background: #F8F9FC; font-weight: 600; }
.demo tr:hover td { background: #FAFBFD; }
.demo tr.l-total:hover td { background: #FFEEDC; }

/* popover de ajuste */
.pop { position: fixed; z-index: 60; width: 320px; background: #fff; border: 1px solid var(--borda); border-radius: 10px;
  box-shadow: 0 8px 30px rgba(31,51,83,.18); padding: 14px; }
.pop h3 { margin-bottom: 8px; }
.pop .linha-btn { display: flex; gap: 8px; justify-content: flex-end; margin-top: 10px; }
.pop .hist { max-height: 140px; overflow: auto; font-size: 12px; margin-top: 10px; border-top: 1px solid var(--borda); padding-top: 8px; }
.pop .hist div { padding: 3px 0; color: var(--texto-2); }

/* ---------- login ---------- */
.login-pagina { min-height: 100vh; display: flex; flex-direction: column; background: var(--azul); }
.login-centro { flex: 1; display: flex; align-items: center; justify-content: center; padding: 30px 16px; }
.login-caixa { width: 100%; max-width: 400px; background: #fff; border-radius: 14px; padding: 30px 30px 24px; box-shadow: 0 20px 50px rgba(0,0,0,.25); }
.login-caixa .logo { text-align: center; margin-bottom: 10px; }
.login-caixa .logo img { width: 190px; height: auto; }
.login-caixa h1 { text-align: center; font-size: 18px; margin-bottom: 4px; }
.login-caixa .sub { text-align: center; color: var(--texto-3); font-size: 13px; margin-bottom: 20px; }
.login-caixa .btn { width: 100%; padding: 10px; font-size: 14.5px; }
.login-caixa .qr { text-align: center; margin: 10px 0; }
.login-caixa .qr img { width: 200px; height: 200px; image-rendering: pixelated; }
.login-caixa code { background: #F3F5FA; padding: 3px 6px; border-radius: 5px; font-size: 12.5px; word-break: break-all; }
.login-pagina .rodape { background: transparent; border-top: 1px solid rgba(255,255,255,.1); color: #AEB8D6; text-align: center; }
.login-pagina .rodape .suporte, .login-pagina .rodape .suporte a { color: #DCE2F2; }
.input-codigo { font-size: 22px !important; letter-spacing: 6px; text-align: center; }

.senha-gerada { font-family: Consolas, "Courier New", monospace; font-size: 22px; background: #FFF4E8; border: 1px dashed var(--laranja);
  padding: 12px 18px; border-radius: 8px; display: inline-block; letter-spacing: 1px; user-select: all; }

.secao-log h3 { margin: 16px 0 8px; }
.msg-log { font-size: 13px; padding: 5px 0; border-bottom: 1px solid #F0F2F6; display: flex; gap: 10px; }
.msg-log .n { flex-shrink: 0; width: 56px; font-weight: 700; font-size: 11.5px; text-transform: uppercase; }
.msg-log .n.erro { color: var(--negativo); }
.msg-log .n.aviso { color: var(--aviso); }
.msg-log .n.info { color: var(--texto-3); }
details summary { cursor: pointer; font-weight: 600; color: var(--azul-escuro); margin: 8px 0; }

/* ---------- responsivo ---------- */
@media (max-width: 1200px) {
  .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 980px) {
  .grade-2, .grade-3 { grid-template-columns: minmax(0, 1fr); }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sidebar { transform: translateX(-100%); transition: transform .2s; }
  .sidebar.aberta { transform: none; box-shadow: 0 0 40px rgba(0,0,0,.3); }
  .conteudo { margin-left: 0; }
  .menu-btn { display: block; }
  main, .topo, .rodape { padding-left: 16px; padding-right: 16px; }
  .demo .desc { min-width: 220px; max-width: 240px; }
  .filtros .acoes { margin-left: 0; }
}
@media (max-width: 520px) {
  .kpis { grid-template-columns: minmax(0, 1fr); }
}
@media print {
  .sidebar, .filtros, .menu-btn, .rodape .suporte { display: none !important; }
  .conteudo { margin-left: 0; }
}
