/* ResolarFinanceiro — tema SaaS Minimal com a marca RE Solar.
   Paleta oficial: laranja #f3922b (primária), verde #7ed957 (secundária),
   cinza #5a5358 (neutra), preto #191923 (texto). Tipografia: Montserrat
   (títulos) + Arimo (corpo). Ver "Empresa Resolar/Resolar - Identidade Visual.md". */

:root {
  --brand-hue: 60;                  /* tom quente p/ tintar os neutros (laranja) */

  --brand:        #f3922b;          /* laranja primário (CTA, gráficos, marca) */
  --brand-strong: #db7d18;          /* laranja hover */
  --brand-ink:    #9a5608;          /* laranja escuro p/ texto sobre claro (contraste AA) */
  --brand-soft:   #fdeede;          /* tinta laranja clara (nav ativo, fundos) */
  --on-brand:     #191923;          /* texto sobre botão laranja (preto da marca) */

  --brand-2:        #7ed957;        /* verde secundário (acentos, positivo) */
  --brand-2-strong: #5fc23a;

  --bg:      oklch(98.5% 0.006 var(--brand-hue));
  --surface: #ffffff;
  --surface-2: oklch(97% 0.008 var(--brand-hue));
  --border:  oklch(91% 0.01 var(--brand-hue));
  --text:    #191923;               /* preto da marca */
  --muted:   #5a5358;               /* cinza da marca */

  --ok:    #4ba62c;
  --warn:  oklch(72% 0.17 70);
  --danger:oklch(60% 0.20 25);

  --radius: 12px;
  --shadow: 0 1px 2px oklch(0% 0 0 / 0.04), 0 4px 16px oklch(0% 0 0 / 0.05);

  --font-ui: "Arimo", Arial, system-ui, -apple-system, sans-serif;
  --font-title: "Montserrat", "Arimo", sans-serif;
  --font-mono: "JetBrains Mono", "SFMono-Regular", Consolas, monospace;
}

[data-theme="dark"] {
  --bg:      oklch(16% 0.012 var(--brand-hue));
  --surface: oklch(20% 0.014 var(--brand-hue));
  --surface-2: oklch(24% 0.016 var(--brand-hue));
  --border:  oklch(30% 0.018 var(--brand-hue));
  --text:    oklch(96% 0.01 var(--brand-hue));
  --muted:   oklch(72% 0.02 var(--brand-hue));
  --brand-ink:  #f3922b;            /* no escuro o laranja já tem contraste */
  --brand-soft: oklch(30% 0.06 var(--brand-hue));
  --shadow: 0 1px 2px oklch(0% 0 0 / 0.3), 0 6px 20px oklch(0% 0 0 / 0.35);
}

* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: var(--font-ui); font-size: 14px; line-height: 1.55;
}
a { color: var(--brand-ink); text-decoration: none; }
h1, h2, h3 { font-family: var(--font-title); }

/* layout */
.app { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.sidebar {
  background: var(--surface); border-right: 1px solid var(--border);
  padding: 22px 14px; position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; align-items: center; padding: 4px 8px 2px; }
.brand-logo { width: 100%; max-width: 168px; height: auto; display: block; }
.brand-sub {
  font-family: var(--font-title); font-weight: 600; font-size: 11px;
  letter-spacing: .14em; text-transform: uppercase; color: var(--muted);
  padding: 0 10px 18px;
}

.nav a {
  display: flex; align-items: center; gap: 10px; padding: 9px 11px;
  border-radius: 9px; color: var(--text); font-weight: 500; margin-bottom: 2px;
}
.nav a:hover { background: var(--surface-2); }
.nav a.active { background: var(--brand-soft); color: var(--brand-ink); font-weight: 700; }
.nav .badge {
  margin-left: auto; background: var(--warn); color: #1a1200;
  border-radius: 99px; padding: 1px 8px; font-size: 11px; font-weight: 800;
}
.nav .sep { font-size: 11px; text-transform: uppercase; letter-spacing: .08em;
  color: var(--muted); padding: 16px 11px 6px; }

.main { padding: 26px 30px 60px; max-width: 1280px; }
.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 22px; gap: 16px; flex-wrap: wrap; }
.page-head h1 { font-size: 26px; font-weight: 800; letter-spacing: -0.03em; margin: 0; }
.page-head p { color: var(--muted); margin: 2px 0 0; }

/* cards / KPIs */
.grid { display: grid; gap: 16px; }
.kpis { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow);
}
.kpi .label { color: var(--muted); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.kpi .value { font-family: var(--font-mono); font-size: 27px; font-weight: 700; letter-spacing: -0.02em; margin-top: 6px; }
.kpi .sub { font-size: 12px; color: var(--muted); margin-top: 4px; }
.chip { display: inline-flex; align-items: center; gap: 5px; font-weight: 700; font-size: 12px; border-radius: 99px; padding: 2px 9px; }
.chip.up { background: oklch(94% 0.05 25); color: var(--danger); }
.chip.down { background: oklch(94% 0.06 150); color: var(--ok); }

.cols-2 { grid-template-columns: 1.5fr 1fr; }
.cols-2 > * { min-width: 0; }
@media (max-width: 960px) { .cols-2 { grid-template-columns: 1fr; } .app { grid-template-columns: 1fr; } .sidebar { position: static; height: auto; } }

h2.section { font-size: 15px; font-weight: 700; margin: 0 0 14px; }

/* tabelas */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); }
th { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; }
tbody tr:hover { background: var(--surface-2); }
td.num, th.num { text-align: right; font-family: var(--font-mono); }

.tag { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; }
.dot { width: 9px; height: 9px; border-radius: 99px; display: inline-block; }
.status { font-size: 11px; font-weight: 800; padding: 2px 9px; border-radius: 99px; text-transform: uppercase; letter-spacing: .03em; }
.status.aprovado { background: oklch(94% 0.06 150); color: var(--ok); }
.status.pendente { background: oklch(95% 0.07 80); color: oklch(50% 0.13 70); }
.status.rejeitado { background: oklch(94% 0.05 25); color: var(--danger); }

/* forms / botões */
input, select, textarea {
  font-family: var(--font-ui); font-size: 14px; color: var(--text);
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 9px; padding: 9px 11px; width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand); outline-offset: 0; border-color: var(--brand); }
label { font-size: 12px; font-weight: 600; color: var(--muted); display: block; margin-bottom: 5px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px,1fr)); gap: 14px; align-items: end; }
.btn {
  display: inline-flex; align-items: center; gap: 7px; cursor: pointer;
  background: var(--brand); color: var(--on-brand); border: none; border-radius: 9px;
  padding: 10px 16px; font-weight: 700; font-size: 14px; font-family: var(--font-title);
  transition: background .15s, transform .05s;
}
.btn:hover { background: var(--brand-strong); }
.btn:active { transform: translateY(1px); }
.btn.ghost { background: transparent; color: var(--text); border: 1px solid var(--border); }
.btn.ghost:hover { background: var(--surface-2); }
.btn.sm { padding: 5px 10px; font-size: 12px; }
.btn.danger { background: var(--danger); color: #fff; }

/* flash + alertas */
.flash { padding: 12px 16px; border-radius: 10px; margin-bottom: 14px; font-weight: 600; border: 1px solid transparent; }
.flash.ok { background: oklch(95% 0.05 150); color: var(--ok); border-color: oklch(85% 0.08 150); }
.flash.warn { background: oklch(96% 0.07 80); color: oklch(45% 0.13 60); border-color: oklch(85% 0.1 80); }

/* barra orçado x realizado */
.bar { height: 8px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 99px; }

.toolbar { display: flex; gap: 10px; align-items: end; flex-wrap: wrap; margin-bottom: 16px; }
.muted { color: var(--muted); }
.right { margin-left: auto; }
.empty { text-align: center; color: var(--muted); padding: 40px; }
