/* Financeiro Nicolas 3.0.2 — hierarquia, proporções e acabamento premium */

/* Tokens de superfície e leitura */
body{
  --surface-3:#eef2f7;
  --line-strong:#d5dce8;
  --muted-strong:#556278;
  --elev-1:0 1px 2px rgba(15,23,42,.03),0 8px 24px rgba(15,23,42,.035);
  --elev-2:0 8px 30px rgba(15,23,42,.07);
}
body.ui-dark{
  --bg:#0d121c;
  --surface:#171e2b;
  --surface-2:#1d2635;
  --surface-3:#242f42;
  --surface-hover:#263247;
  --line:#2e3a4e;
  --line-strong:#3a485e;
  --ink:#f7f9fc;
  --muted:#aab5c8;
  --muted-strong:#c1cad8;
  --elev-1:0 1px 1px rgba(0,0,0,.18),0 12px 30px rgba(0,0,0,.16);
  --elev-2:0 16px 42px rgba(0,0,0,.22);
}
@media(prefers-color-scheme:dark){
  body.ui-system{
    --bg:#0d121c;
    --surface:#171e2b;
    --surface-2:#1d2635;
    --surface-3:#242f42;
    --surface-hover:#263247;
    --line:#2e3a4e;
    --line-strong:#3a485e;
    --ink:#f7f9fc;
    --muted:#aab5c8;
    --muted-strong:#c1cad8;
    --elev-1:0 1px 1px rgba(0,0,0,.18),0 12px 30px rgba(0,0,0,.16);
    --elev-2:0 16px 42px rgba(0,0,0,.22);
  }
}

/* Contraste reforçado: padrão novo, mas pode ser suavizado nos Ajustes */
body.contrast-high{--line:var(--line-strong)}
body.contrast-high .muted,
body.contrast-high .lead,
body.contrast-high .context-note,
body.contrast-high .panel-head small,
body.contrast-high .kpi small,
body.contrast-high .kpi>span,
body.contrast-high .app-footer,
body.contrast-high td small{color:var(--muted-strong)!important}
body.contrast-standard .muted,
body.contrast-standard .lead,
body.contrast-standard .context-note{color:var(--muted)!important}

/* Fundo menos chapado e mais sofisticado */
body.ui-dark,
body.ui-system{background:var(--bg)}
body.ui-dark:before,
body.ui-system:before{content:"";position:fixed;inset:0;pointer-events:none;z-index:-1;background:radial-gradient(900px 520px at 70% -20%,color-mix(in srgb,var(--primary) 8%,transparent),transparent 60%)}
@media(prefers-color-scheme:light){body.ui-system:before{display:none}}

/* Layout e respiro */
.main{padding-top:24px;padding-left:30px;padding-right:30px}
.topbar{min-height:72px;padding:13px 16px!important;margin-bottom:12px!important;box-shadow:var(--elev-1)!important}
.topbar-title{min-width:0}
.topbar h1{font-size:25px;line-height:1.05;margin-top:4px}
.topbar-actions{display:flex;align-items:center;gap:7px;flex-wrap:wrap;justify-content:flex-end}
.topbar-actions .btn{height:36px;padding:0 13px;gap:7px;font-size:11px}
.topbar-actions .quick-create{padding-inline:15px}
.privacy-toggle{min-width:86px!important}

/* Sidebar: menos bloco, mais navegação */
.sidebar{padding-top:20px;padding-bottom:18px;background:color-mix(in srgb,var(--surface) 97%,var(--bg));box-shadow:none}
.logo{padding-bottom:18px}
.logo strong{letter-spacing:-.025em}
.profile-switcher{padding:10px 11px!important;border-radius:11px!important;box-shadow:none!important}
.profile-switcher small{font-size:9px;letter-spacing:.07em;text-transform:uppercase;font-weight:750}
.profile-switcher strong{font-size:12px;margin-top:3px}
.profile-switcher>span:last-child{font-size:9px;margin-top:2px}
.nav-group{display:block;margin:16px 10px 5px;color:color-mix(in srgb,var(--muted) 88%,transparent);font-size:8.5px;font-weight:800;letter-spacing:.09em;text-transform:uppercase}
.sidebar nav{gap:2px}
.sidebar nav a{height:36px!important;padding:0 10px!important;border-radius:9px!important;font-size:11px!important;font-weight:620!important;gap:9px!important}
.sidebar nav a .nav-icon{opacity:.86}
.sidebar nav a:hover .nav-icon,.sidebar nav a.active .nav-icon{opacity:1}
.sidebar nav a.active{box-shadow:inset 2px 0 0 color-mix(in srgb,var(--primary) 78%,transparent)}
.user{padding-top:14px!important}

/* Barra de filtros: compacta, mas claramente interativa */
.filter-strip,.report-filterbar{min-height:48px;padding:7px 10px!important;margin-bottom:11px!important;box-shadow:none!important}
.filter-strip .muted{font-size:10px}
.period-form label{font-size:10px;font-weight:650;gap:8px}
.period-form select{height:34px!important;min-width:165px!important;background:var(--surface-2)!important}

/* KPIs: sem massa roxa chapada; destaque sofisticado */
.kpi-grid{gap:10px;margin-bottom:11px}
.kpi{min-height:106px;padding:15px 16px!important;box-shadow:var(--elev-1)!important;border-color:var(--line)!important;display:flex;flex-direction:column;justify-content:center}
.kpi:before{height:1px!important;background:color-mix(in srgb,var(--primary) 28%,transparent)!important}
.kpi>span{font-size:10px!important;font-weight:620}
.kpi strong{font-size:23px!important;line-height:1.05;margin:8px 0 6px!important;font-variant-numeric:tabular-nums}
.kpi small{font-size:9.5px!important;line-height:1.35}
.kpi.accent{
  background:linear-gradient(145deg,color-mix(in srgb,var(--primary) 13%,var(--surface)),color-mix(in srgb,var(--primary) 5%,var(--surface)))!important;
  color:var(--ink)!important;
  border-color:color-mix(in srgb,var(--primary) 40%,var(--line))!important;
  box-shadow:var(--elev-1)!important;
}
.kpi.accent:before{height:3px!important;background:var(--primary)!important}
.kpi.accent strong{color:color-mix(in srgb,var(--primary) 82%,var(--ink))!important}
.kpi.accent>span,.kpi.accent small{color:var(--muted-strong)!important}
body.ui-dark .kpi.accent strong{color:#fff!important}
@media(prefers-color-scheme:dark){body.ui-system .kpi.accent strong{color:#fff!important}}

/* Contexto do perfil deixa de parecer texto perdido */
.context-note{margin:2px 2px 12px;padding-left:10px;border-left:2px solid color-mix(in srgb,var(--primary) 35%,var(--line));font-size:10px;line-height:1.5}
.context-note strong{color:var(--ink)}

/* Painéis e áreas vazias */
.grid-2{gap:10px;margin-bottom:10px}
.panel{padding:17px!important;margin-bottom:10px!important;box-shadow:var(--elev-1)!important}
.panel-head{margin-bottom:12px!important;min-height:30px}
.panel-head h2{font-size:15px!important;letter-spacing:-.025em}
.panel-head>a{font-size:10px!important}
.eyebrow{font-size:8.5px!important;letter-spacing:.095em!important}
.empty{min-height:118px!important;padding:24px!important;color:var(--muted-strong)!important;font-size:11px;line-height:1.55}
.dashboard-analysis>.panel{min-height:246px}
.dashboard-analysis .empty{min-height:165px!important}

/* Gráficos: linhas e legendas mais legíveis */
.bar-chart{height:190px;padding-top:7px;border-color:var(--line-strong)!important}
.bars i{min-width:5px}
.legend{color:var(--muted-strong)!important;font-weight:600}
.category-list{gap:12px}
.category-list>div{font-size:11px}
.category-list b{height:4px!important;background:var(--surface-3)!important}
.category-list b i{background:linear-gradient(90deg,var(--primary),color-mix(in srgb,var(--primary) 68%,#9b8cff))!important}

/* Botões com hierarquia clara */
.btn{height:37px!important;padding:0 14px!important;font-size:11px;border-color:var(--line)!important;font-weight:680!important}
.btn.primary{box-shadow:0 6px 16px color-mix(in srgb,var(--primary) 18%,transparent)!important}
.btn:not(.primary):not(.danger){background:var(--surface-2)!important}
.btn:not(.primary):not(.danger):hover{background:var(--surface-3)!important;border-color:color-mix(in srgb,var(--primary) 34%,var(--line-strong))!important}
.btn.compact{height:32px!important;padding-inline:11px!important;font-size:10px!important}
.link-button{font-size:10px!important}

/* Inputs: borda real, fundo diferente do card */
input,select,textarea{background:var(--surface-2)!important;border-color:var(--line)!important;min-height:38px;font-size:11px}
input:hover,select:hover,textarea:hover{border-color:var(--line-strong)!important}
input:focus,select:focus,textarea:focus{background:var(--surface)!important}
label{line-height:1.35}

/* Tabelas: leitura financeira e separação sem excesso de linhas */
.table-wrap{border-top:1px solid var(--line)!important}
th{height:34px;padding:8px 12px!important;font-size:8.5px!important;letter-spacing:.07em!important;color:var(--muted-strong)!important;background:color-mix(in srgb,var(--surface-2) 84%,var(--surface))!important}
td{height:44px!important;padding:9px 12px!important;font-size:11px;border-bottom-color:color-mix(in srgb,var(--line) 72%,transparent)!important}
td strong{font-size:11px}
td small{font-size:9px}
tbody tr:hover{background:color-mix(in srgb,var(--primary) 4%,var(--surface))!important}
.amount{font-variant-numeric:tabular-nums;letter-spacing:-.01em}
.tag{padding:3px 7px!important;font-size:9px!important;background:var(--surface-3)!important;color:var(--muted-strong)!important}

/* Cards de contas/patrimônio */
.account-grid{gap:10px;margin-bottom:10px}
.account-card{padding:17px!important;box-shadow:var(--elev-1)!important}
.account-card:after{opacity:.65}
.account-card h2{margin-bottom:16px!important;font-size:14px!important}
.account-card strong{font-size:20px!important}
.details div{padding:9px 0!important}
.details dt{color:var(--muted-strong)!important;font-size:10px}
.details dd{font-size:11px;font-variant-numeric:tabular-nums}

/* Configurações: menos formulário gigante e melhor agrupamento */
.settings-tabs{box-shadow:var(--elev-1)!important;border-color:var(--line)!important}
.settings-tabs a{font-size:10px!important}
.settings-hero{padding:17px!important;box-shadow:var(--elev-1)!important}
.settings-hero h2{font-size:18px!important}
.feature-setting{border-color:var(--line)!important;background:var(--surface-2)!important;box-shadow:none!important}
.feature-setting:hover{border-color:color-mix(in srgb,var(--primary) 30%,var(--line-strong))!important;background:var(--surface-3)!important}
.feature-copy strong{font-size:11px!important}
.feature-copy small{font-size:9.5px!important}
.system-info-grid>div{border-color:var(--line)!important;background:var(--surface-2)!important}

/* Feedback e foco de acessibilidade */
a:focus-visible,button:focus-visible,input:focus-visible,select:focus-visible,textarea:focus-visible,summary:focus-visible{outline:2px solid color-mix(in srgb,var(--primary) 80%,#fff);outline-offset:2px}

/* Rodapé discreto */
.app-footer{font-size:9px!important;padding-top:18px;opacity:.85}
.app-footer span{float:right}

/* Densidade compacta continua realmente compacta */
body.density-compact .kpi{min-height:90px;padding:12px 14px!important}
body.density-compact .panel{padding:14px!important}
body.density-compact .dashboard-analysis>.panel{min-height:220px}
body.density-compact .sidebar nav a{height:32px!important}

/* Mobile */
@media(max-width:1100px){
  .main{padding-left:24px;padding-right:24px}
  .dashboard-analysis>.panel{min-height:220px}
}
@media(max-width:780px){
  .main{padding:18px 14px 42px}
  .topbar{min-height:62px;border-radius:12px!important;margin:0 0 10px!important;padding:10px 12px!important}
  .topbar-actions .privacy-label{display:none}.privacy-toggle{min-width:38px!important;width:38px!important;padding:0!important}
  .kpi-grid{gap:8px}.kpi{min-height:96px}
  .dashboard-analysis>.panel{min-height:0}
  .app-footer span{float:none;display:block;margin-top:4px}
}
@media(max-width:520px){
  .topbar-actions .btn:not(.quick-create):not(.privacy-toggle){display:none}
  .topbar-actions .quick-create{width:36px!important;padding:0!important;font-size:0!important}
  .topbar-actions .quick-create .ui-icon{margin:0!important}
  .filter-strip{align-items:stretch!important;gap:6px}.filter-strip .muted{text-align:right}
  .period-form label{display:grid;grid-template-columns:auto 1fr}.period-form select{min-width:0!important;width:100%}
  .kpi strong{font-size:21px!important}
}
