/* Modo claro, por decisão de projeto: a calculadora tem um visual só. */
:root {
  color-scheme: light;
  --surface-0: #f4f4f1;
  --surface-1: #fcfcfb;
  --surface-2: #eceae4;
  --border: #dedcd4;
  --border-strong: #c6c3b8;
  --text-primary: #0b0b0b;
  --text-secondary: #52514e;
  --text-muted: #77756e;
  --accent: #1c5cab;
  --accent-soft: #e8f0fb;
  --good: #0a7a4f;
  --good-soft: #e7f4ee;
  --alert: #c2410c;
  --alert-soft: #fdf1e8;
  --free: #b9b6ac;
  --series-1: #2a78d6;
  --series-2: #eb6834;
  --series-3: #1baf7a;
  --series-4: #eda100;
  --series-5: #e87ba4;
  --grid: #e4e2db;
  --shadow: 0 1px 2px rgba(11, 11, 11, .06), 0 1px 1px rgba(11, 11, 11, .04);
  --shadow-lift: 0 2px 10px rgba(11, 11, 11, .07);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--surface-0);
  color: var(--text-primary);
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { margin: 0; font-weight: 650; letter-spacing: -0.015em; }
h1 { font-size: 19px; }
h2 { font-size: 22px; }
h3 { font-size: 15px; }
a { color: var(--accent); }
code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .92em; }

.muted { color: var(--text-muted); }
.hint { font-weight: 400; color: var(--text-muted); text-transform: none; letter-spacing: 0; font-size: 12px; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- topo ---------- */
.topbar {
  display: flex; flex-wrap: wrap; gap: 14px 24px; align-items: flex-end; justify-content: space-between;
  padding: 14px 20px;
  background: var(--surface-1);
  border-bottom: 1px solid var(--border);
}
.topbar__meta { margin: 3px 0 0; font-size: 12.5px; color: var(--text-muted); }
.topbar__controls { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }

.modeswitch { display: flex; background: var(--surface-2); border-radius: 8px; padding: 3px; gap: 2px; }
.modeswitch__btn {
  font: inherit; font-size: 13px; font-weight: 600; color: var(--text-secondary);
  background: none; border: 0; border-radius: 6px; padding: 6px 12px; cursor: pointer;
}
.modeswitch__btn.is-active { background: var(--surface-1); color: var(--text-primary); box-shadow: var(--shadow); }

/* ---------- página ---------- */
.page { max-width: 880px; margin: 0 auto; padding: 20px 20px 8px; }
body.mode-avancado .page { max-width: 1180px; }

.panel {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}
.panel__title { font-size: 13px; text-transform: uppercase; letter-spacing: .07em; color: var(--text-muted); margin-bottom: 14px; }

/* ---------- trilha de passos ---------- */
.steps {
  display: flex; flex-wrap: wrap; gap: 6px;
  list-style: none; margin: 0 0 16px; padding: 0;
  counter-reset: step;
}
.steps li { flex: 1 1 150px; }
.steps__item {
  display: flex; align-items: center; gap: 8px; width: 100%;
  font: inherit; font-size: 13px; font-weight: 600; text-align: left;
  color: var(--text-muted); background: var(--surface-1);
  border: 1px solid var(--border); border-radius: 9px; padding: 9px 11px; cursor: pointer;
}
.steps__num {
  flex: none; width: 21px; height: 21px; border-radius: 50%;
  display: grid; place-items: center; font-size: 12px;
  background: var(--surface-2); color: var(--text-secondary);
}
.steps__item.is-done { color: var(--text-secondary); border-color: var(--border-strong); }
.steps__item.is-done .steps__num { background: var(--good-soft); color: var(--good); }
.steps__item.is-active { color: var(--text-primary); border-color: var(--accent); background: var(--accent-soft); }
.steps__item.is-active .steps__num { background: var(--accent); color: #fff; }

/* ---------- cartão de passo ---------- */
.step { display: none; }
.step.is-active { display: block; }
.step:not([data-step="4"]) {
  background: var(--surface-1); border: 1px solid var(--border);
  border-radius: 12px; padding: 22px; box-shadow: var(--shadow);
}
.step__lede { margin: 8px 0 18px; color: var(--text-secondary); max-width: 62ch; }
.step__nav { display: flex; justify-content: space-between; gap: 10px; margin-top: 22px; }

.btn {
  font: inherit; font-size: 14px; font-weight: 600;
  padding: 10px 18px; border-radius: 8px; cursor: pointer;
  color: var(--text-primary); background: var(--surface-1); border: 1px solid var(--border-strong);
}
.btn:hover { background: var(--surface-2); }
.btn--primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn--primary:hover { background: #164a8c; }

/* ---------- campos ---------- */
.inputs { display: grid; gap: 16px; }
.inputs--grid { grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }

.field { display: grid; gap: 5px; align-content: start; }
.field > span { font-size: 13px; font-weight: 600; color: var(--text-secondary); }
.field > span em { font-style: normal; font-weight: 400; color: var(--text-muted); }
.field small { font-size: 12px; color: var(--text-muted); line-height: 1.4; }
.field--inline { gap: 4px; min-width: 175px; }
.field--inline > span { font-size: 12px; }

.bigfields { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 20px; }
.field--big > span { font-size: 14px; color: var(--text-primary); }
.field--big input {
  font-size: 26px; font-weight: 650; letter-spacing: -0.02em;
  padding: 10px 12px; text-align: left;
}

input[type="text"], input[type="month"], select {
  width: 100%; padding: 8px 10px;
  font: inherit; font-variant-numeric: tabular-nums;
  color: var(--text-primary); background: var(--surface-1);
  border: 1px solid var(--border-strong); border-radius: 8px;
}
select { cursor: pointer; }
input:focus-visible, select:focus-visible, button:focus-visible, summary:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 1px;
}

.suffixed { position: relative; display: block; }
.suffixed i { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); font-style: normal; color: var(--text-muted); }
.suffixed input { padding-right: 26px; }

.field--slider > span { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.field--slider output {
  font-variant-numeric: tabular-nums; font-weight: 650; color: var(--text-primary);
  background: var(--surface-2); border-radius: 4px; padding: 0 5px;
}
input[type="range"] { width: 100%; accent-color: var(--accent); }

.callout {
  margin: 18px 0 0; padding: 12px 14px;
  background: var(--accent-soft); border-radius: 9px;
  font-size: 14px; color: var(--text-secondary);
}
.callout strong { color: var(--text-primary); }

.advanced { margin-top: 20px; border-top: 1px solid var(--border); padding-top: 14px; }
.advanced > summary, .table-toggle > summary, .footnotes > details > summary {
  cursor: pointer; font-size: 13px; font-weight: 600; color: var(--text-secondary);
  list-style: none; display: flex; align-items: center; gap: 7px;
}
.advanced > summary::before, .table-toggle > summary::before, .footnotes > details > summary::before {
  content: "▸"; font-size: 10px; transition: transform .12s;
}
.advanced[open] > summary::before, .table-toggle[open] > summary::before,
.footnotes > details[open] > summary::before { transform: rotate(90deg); }
summary::-webkit-details-marker { display: none; }
.advanced .inputs { margin-top: 16px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }

/* ---------- atalhos (presets) ---------- */
.presets { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 18px; }
.presets__label { font-size: 13px; color: var(--text-muted); }
.chip {
  font: inherit; font-size: 13px; font-weight: 600; color: var(--text-secondary);
  background: var(--surface-1); border: 1px solid var(--border-strong);
  border-radius: 999px; padding: 5px 13px; cursor: pointer;
}
.chip:hover { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }

/* ---------- distribuição das conversas ---------- */
.mix { display: grid; gap: 2px; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.mix__row {
  display: grid; grid-template-columns: 12px 1fr 92px; gap: 12px; align-items: center;
  padding: 13px 14px; background: var(--surface-1); cursor: text;
}
.mix__row + .mix__row { border-top: 1px solid var(--border); }
.mix__row:hover { background: var(--surface-2); }
.mix__dot { width: 10px; height: 10px; border-radius: 3px; }
.mix__text { display: grid; gap: 2px; }
.mix__text strong { font-size: 14px; font-weight: 600; }
.mix__text small { font-size: 12px; color: var(--text-muted); line-height: 1.4; }
.mix__input { position: relative; }
.mix__input input { text-align: right; padding-right: 26px; font-weight: 650; }
.mix__input i { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); font-style: normal; color: var(--text-muted); }

.mixbar { display: flex; height: 9px; border-radius: 5px; overflow: hidden; margin-top: 14px; background: var(--surface-2); gap: 2px; }
.mixbar span { display: block; }
.mixstatus { margin: 8px 0 0; font-size: 13px; color: var(--text-muted); }
.mixstatus.is-off { color: var(--alert); font-weight: 600; }

/* ---------- cartões de escolha ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 12px; }
.card {
  display: block; position: relative; cursor: pointer;
  border: 1px solid var(--border-strong); border-radius: 11px; padding: 15px 16px 15px 42px;
  background: var(--surface-1);
}
.card:hover { border-color: var(--accent); }
.card input { position: absolute; left: 15px; top: 17px; accent-color: var(--accent); width: 16px; height: 16px; }
.card:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); box-shadow: var(--shadow); }
.card__body { display: grid; gap: 4px; }
.card__body strong { font-size: 14.5px; }
.card__body small { font-size: 12.5px; color: var(--text-secondary); line-height: 1.45; }

/* ---------- resultado ---------- */
.scenarios { display: grid; grid-template-columns: repeat(auto-fit, minmax(215px, 1fr)); gap: 12px; }
.scenario { border: 1px solid var(--border); border-radius: 11px; padding: 14px 16px; background: var(--surface-1); }
.scenario--next { border-color: var(--alert); background: var(--alert-soft); }
.scenario--delta { background: var(--surface-2); }
.scenario h3 { font-size: 12.5px; color: var(--text-secondary); display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-weight: 600; }
.tag {
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
  background: var(--surface-2); color: var(--text-secondary); border-radius: 4px; padding: 2px 5px;
}
.tag--next { background: var(--alert); color: #fff; }
.scenario__value {
  margin: 8px 0 3px; font-size: 30px; font-weight: 700; line-height: 1.1;
  font-variant-numeric: tabular-nums; letter-spacing: -0.025em;
}
.scenario__value .sub { font-size: 14px; font-weight: 600; color: var(--text-secondary); letter-spacing: 0; }
.scenario__per { margin: 0; font-size: 12.5px; color: var(--text-muted); }

.verdict {
  margin: 16px 0 0; padding: 14px 16px;
  background: var(--alert-soft); border-left: 3px solid var(--alert); border-radius: 8px;
  font-size: 14.5px; color: var(--text-secondary);
}
.verdict strong { color: var(--text-primary); }
.verdict.is-calm { background: var(--good-soft); border-left-color: var(--good); }

.section-title { margin: 26px 0 9px; font-size: 12px; text-transform: uppercase; letter-spacing: .07em; color: var(--text-muted); }
.freeline { margin: 9px 0 0; font-size: 13px; color: var(--good); }

/* ---------- tabelas ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 10px; }
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th, .table td { padding: 8px 11px; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table thead th {
  font-size: 11px; text-transform: uppercase; letter-spacing: .04em;
  color: var(--text-muted); font-weight: 650; background: var(--surface-2);
}
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table tfoot td, .table tfoot th { font-weight: 700; background: var(--surface-2); border-bottom: none; }
.table .swatch { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 8px; }
.table .free { color: var(--good); }
.table .up { color: var(--alert); font-weight: 650; }
.table .zero { color: var(--text-muted); }
.table tr.is-transition td, .table tr.is-transition th { border-top: 2px solid var(--alert); }

.table-toggle { margin-top: 14px; }
.table-toggle .table-wrap { margin-top: 10px; }
.table-toggle .hint { display: block; margin-top: 8px; }

/* ---------- gráfico ---------- */
.chart-lede { margin: 0 0 12px; font-size: 13.5px; color: var(--text-secondary); }
.chart { margin: 0; }
.chart__plot { position: relative; }
#chart { width: 100%; height: 300px; display: block; overflow: visible; }

.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-bottom: 10px; }
.legend__item { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text-secondary); }
.legend__swatch { width: 10px; height: 10px; border-radius: 2px; }

.tooltip {
  position: absolute; pointer-events: none; z-index: 5;
  min-width: 200px; padding: 9px 11px;
  background: var(--surface-1); border: 1px solid var(--border-strong); border-radius: 8px;
  box-shadow: var(--shadow-lift); font-size: 12.5px; transform: translate(-50%, -100%);
}
.tooltip__title { font-weight: 700; margin-bottom: 6px; display: flex; justify-content: space-between; gap: 10px; }
.tooltip__row { display: flex; justify-content: space-between; gap: 14px; align-items: center; }
.tooltip__row span:first-child { display: flex; align-items: center; gap: 6px; color: var(--text-secondary); }
.tooltip__row b { font-variant-numeric: tabular-nums; font-weight: 650; }
.tooltip__total { margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--border); }
.tooltip__sw { width: 9px; height: 9px; border-radius: 2px; display: inline-block; }

/* ---------- rodapé ---------- */
.footnotes { max-width: 880px; margin: 0 auto; padding: 4px 20px 44px; font-size: 13px; color: var(--text-secondary); }
body.mode-avancado .footnotes { max-width: 1180px; }
.footnotes ul { margin: 12px 0 16px; padding-left: 19px; }
.footnotes li { margin-bottom: 7px; }
.footnotes p { margin: 0; line-height: 1.6; font-size: 12px; color: var(--text-muted); }

@media (max-width: 640px) {
  h2 { font-size: 19px; }
  .step:not([data-step="4"]), .panel { padding: 16px; }
  .mix__row { grid-template-columns: 10px 1fr 78px; gap: 9px; padding: 11px; }
  .scenario__value { font-size: 26px; }
  .steps li { flex: 1 1 100%; }
}
