*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --navy: #0D1B4B;
  --navy2: #152260;
  --gold: #C9A84C;
  --gold-light: #f0d080;
  --white: #ffffff;
  --bg: #F2F4F9;
  --surface: #ffffff;
  --border: #E2E6EF;
  --text: #0D1B2E;
  --muted: #6B7592;
  --green: #146B3A;
  --green-bg: #E8F5EE;
  --red: #8B1E1E;
  --red-bg: #FBE9E9;
  --sidebar-w: 260px;
  --radius: 14px;
  --radius-sm: 8px;
}

html, body { height: 100%; font-family: 'DM Sans', sans-serif; background: var(--bg); color: var(--text); }

/* ── APP SHELL ── */
.app { display: flex; min-height: 100vh; }

/* ── SIDEBAR ── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--navy);
  display: flex;
  flex-direction: column;
  padding: 1.5rem 1.25rem;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  overflow-y: auto;
}

.brand {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  margin-bottom: 1.5rem;
}
.brand-img {
  width: 100%;
  max-width: 160px;
  height: auto;
  display: block;
  /* logo tem fundo preto — mantemos com leve brilho */
  filter: brightness(1.05);
}
.brand-sub { font-size: 11px; color: rgba(255,255,255,0.4); margin-top: 2px; letter-spacing: .04em; }

.nav { display: flex; flex-direction: column; gap: 4px; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  color: rgba(255,255,255,0.55);
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  cursor: pointer;
  text-align: left;
  transition: background .15s, color .15s;
  width: 100%;
}
.nav-item:hover { background: rgba(255,255,255,0.08); color: #fff; }
.nav-item.active { background: var(--gold); color: var(--navy); font-weight: 500; }
.nav-item.active svg { stroke: var(--navy); }

.sidebar-premissas {
  margin-top: auto;
  padding-top: 1.5rem;
  border-top: 1px solid rgba(255,255,255,0.1);
}
.premissas-title { font-size: 10px; text-transform: uppercase; letter-spacing: .12em; color: rgba(255,255,255,0.35); margin-bottom: 10px; }
.premissa-row { display: flex; justify-content: space-between; align-items: center; padding: 6px 0; border-bottom: 1px solid rgba(255,255,255,0.06); font-size: 12px; color: rgba(255,255,255,0.6); }
.premissa-row:last-child { border-bottom: none; }
.premissa-row select { background: rgba(255,255,255,0.1); border: 1px solid rgba(255,255,255,0.15); color: #fff; font-size: 11px; padding: 3px 6px; border-radius: 5px; cursor: pointer; }
.pval { color: var(--gold); font-weight: 500; }

/* ── MAIN ── */
.main {
  margin-left: var(--sidebar-w);
  flex: 1;
  padding: 2rem 2.5rem;
  max-width: calc(100vw - var(--sidebar-w));
  min-height: 100vh;
}

/* ── TABS ── */
.tab-section { display: none; }
.tab-section.active { display: block; animation: fadeIn .25s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

/* ── PAGE HEADER ── */
.page-header { margin-bottom: 1.75rem; }
.page-header h1 { font-family: 'Syne', sans-serif; font-weight: 700; font-size: 26px; color: var(--navy); }
.page-header p { font-size: 14px; color: var(--muted); margin-top: 4px; }

/* ── CARD ── */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 1.5rem;
}
.card-title { font-family: 'Syne', sans-serif; font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--navy); margin-bottom: 1.25rem; }

/* ── KPI GRID ── */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 1.5rem; }
.kpi {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem;
  position: relative;
  overflow: hidden;
}
.kpi::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px; background: var(--gold); }
.kpi.green::before { background: var(--green); }
.kpi.blue::before { background: var(--navy); }
.kpi-label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 6px; }
.kpi-value { font-family: 'Syne', sans-serif; font-size: 22px; font-weight: 700; color: var(--navy); }
.kpi-value.green { color: var(--green); }

/* ── SIMULADOR GRID ── */
.sim-grid { display: grid; grid-template-columns: 320px 1fr; gap: 1.25rem; align-items: start; }
@media (max-width: 900px) { .sim-grid { grid-template-columns: 1fr; } }

/* ── FIELDS ── */
.field { margin-bottom: 1.1rem; }
.field label { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); margin-bottom: 6px; font-weight: 500; }
.field select, .field input[type=text] {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  color: var(--text);
  background: var(--bg);
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236B7592' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  cursor: pointer;
}
.field select:focus { outline: 2px solid var(--gold); outline-offset: 2px; }

input[type=range] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 5px;
  border-radius: 99px;
  background: var(--border);
  cursor: pointer;
}
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--navy);
  border: 3px solid #fff;
  box-shadow: 0 0 0 1px var(--navy);
}
input[type=range]:focus { outline: none; }

.badge {
  background: var(--navy);
  color: var(--gold);
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 99px;
  font-family: 'Syne', sans-serif;
}

/* ── PLANO INFO ── */
.plano-info {
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.7;
  border: 1px solid var(--border);
}
.plano-info strong { color: var(--navy); }

/* ── BREAKDOWN TABLE ── */
.breakdown-card { margin-top: 0; }
.breakdown-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.breakdown-table th { text-align: left; padding: 8px 10px; color: var(--muted); font-weight: 500; border-bottom: 1px solid var(--border); font-size: 12px; }
.breakdown-table th:not(:first-child) { text-align: right; }
.breakdown-table td { padding: 9px 10px; border-bottom: 1px solid var(--border); color: var(--text); }
.breakdown-table td:not(:first-child) { text-align: right; font-variant-numeric: tabular-nums; }
.breakdown-table tr:last-child td { border-bottom: none; font-weight: 600; background: var(--bg); }
.breakdown-table .pos { color: var(--green); }
.breakdown-table .neg { color: var(--red); }
.breakdown-table .total td { font-weight: 600; }

/* ── PLANS TABLE ── */
.table-wrap { overflow-x: auto; }
.plans-table { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 680px; }
.plans-table th { text-align: right; padding: 10px 12px; color: var(--muted); font-size: 11px; font-weight: 500; text-transform: uppercase; letter-spacing: .05em; border-bottom: 2px solid var(--border); white-space: nowrap; }
.plans-table th:first-child { text-align: left; }
.plans-table td { padding: 10px 12px; border-bottom: 1px solid var(--border); text-align: right; }
.plans-table td:first-child { text-align: left; }
.plans-table tr:hover td { background: var(--bg); }
.plans-table .tag { font-size: 10px; color: var(--muted); display: block; margin-top: 2px; }
.plans-table .rec-liq { color: var(--green); font-weight: 600; }
.plans-table .neg-val { color: var(--red); }

/* ── PROJEÇÃO SLIDERS ── */
.proj-sliders { display: grid; grid-template-columns: 1fr 1fr; gap: 0 2rem; }
@media (max-width: 700px) { .proj-sliders { grid-template-columns: 1fr; } }

/* ── CHART ── */
.chart-wrap { position: relative; height: 280px; }

/* ── RESPONSIVE ── */
@media (max-width: 768px) {
  .sidebar { width: 100%; position: relative; flex-direction: row; flex-wrap: wrap; padding: 1rem; }
  .main { margin-left: 0; padding: 1rem; max-width: 100%; }
  .kpi-grid { grid-template-columns: 1fr 1fr; }
}

/* ── SCROLLBAR ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 99px; }
