/* Simulador da Reforma Tributária — estilos isolados do site institucional */
:root {
  color-scheme: light;
  --rt-navy: #082744;
  --rt-ink: #0f1f33;
  --rt-muted: #5a6b7d;
  --rt-line: #dbe3eb;
  --rt-bg: #f3f6f9;
  --rt-panel: #ffffff;
  --rt-soft: #eef3f7;
  --rt-gold: #c99636;
  --rt-link: #1f63ad;
  --rt-alert-bg: #fff7e6;
  --rt-alert-line: #f0c36d;
  /* Séries do gráfico (paleta categórica validada, slots 1 e 2) */
  --rt-new: #2a78d6;
  --rt-old: #eb6834;
  --rt-grid: #e1e0d9;
  --rt-axis: #c3c2b7;
  --rt-tick: #6b6a65;
  --rt-radius: 12px;
}
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --rt-ink: #e8edf3;
    --rt-muted: #a3b1c0;
    --rt-line: #2a3644;
    --rt-bg: #0d141c;
    --rt-panel: #151e28;
    --rt-soft: #1c2733;
    --rt-link: #7fb3ee;
    --rt-alert-bg: #2b2414;
    --rt-alert-line: #8a6a2a;
    --rt-new: #3987e5;
    --rt-old: #d95926;
    --rt-grid: #2c2c2a;
    --rt-axis: #4a4a46;
    --rt-tick: #a3a29b;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--rt-bg);
  color: var(--rt-ink);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
a { color: var(--rt-link); }
:focus-visible { outline: 3px solid var(--rt-gold); outline-offset: 2px; }
h1, h2, h3, p { margin: 0; }
[hidden] { display: none !important; }

/* ── Cabeçalho ─────────────────────────────────────── */
.rt-top { background: var(--rt-navy); color: #fff; }
.rt-top__row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 20px;
  max-width: 1320px;
  margin: 0 auto;
  padding: 12px 16px;
}
.rt-marca { flex: 1 1 auto; min-width: 0; }
.rt-title { font-size: clamp(21px, 3vw, 28px); line-height: 1.1; font-weight: 900; }
.rt-kicker { margin-top: 4px; font-size: 13px; color: rgba(255,255,255,.78); }
.rt-assina { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; }
.rt-assina img { background: #fff; border-radius: 6px; padding: 3px 6px; height: auto; }
.rt-assina p { display: flex; flex-direction: column; font-size: 11px; line-height: 1.3; }
.rt-assina span { font-weight: 800; }
.rt-assina em { color: rgba(255,255,255,.75); }

/* ── Layout ────────────────────────────────────────── */
.rt-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
  max-width: 1320px;
  margin: 0 auto;
  padding: 16px;
}
@media (min-width: 980px) {
  .rt-main { grid-template-columns: 340px minmax(0, 1fr); align-items: start; }
  .rt-form { position: sticky; top: 16px; max-height: calc(100vh - 32px); overflow-y: auto; }
}

.rt-h2 { font-size: 17px; font-weight: 800; }
.rt-h3 { font-size: 15px; font-weight: 800; }
.rt-sub { margin-top: 4px; color: var(--rt-muted); font-size: 13px; }

/* ── Formulário ────────────────────────────────────── */
.rt-form {
  background: var(--rt-panel);
  border: 1px solid var(--rt-line);
  border-radius: var(--rt-radius);
  padding: 16px;
}
.rt-field { margin: 14px 0 0; padding: 0; border: 0; min-width: 0; }
.rt-field > label, .rt-field > legend { display: block; margin-bottom: 5px; font-size: 13px; font-weight: 700; padding: 0; }
.rt-field small, .rt-adv > small { display: block; margin-top: 4px; color: var(--rt-muted); font-size: 12px; }
.rt-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.rt-pair .rt-field > label { min-height: 2.6em; display: flex; align-items: flex-end; }

select, .rt-money, .rt-pct {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--rt-line);
  border-radius: 8px;
  background: var(--rt-soft);
  color: var(--rt-ink);
  font: inherit;
}
select { padding: 8px 10px; }
.rt-money, .rt-pct { display: flex; align-items: center; padding: 0 10px; gap: 6px; }
.rt-money:focus-within, .rt-pct:focus-within, select:focus-visible { outline: 3px solid var(--rt-gold); outline-offset: 1px; }
.rt-money span, .rt-pct span { color: var(--rt-muted); font-weight: 700; font-size: 13px; }
.rt-money input, .rt-pct input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  padding: 9px 0;
  outline: none;
}
.rt-pct input { text-align: right; }

.rt-seg { display: grid; grid-template-columns: repeat(3, 1fr); padding: 3px; border-radius: 10px; background: var(--rt-soft); border: 1px solid var(--rt-line); }
.rt-seg label { position: relative; }
.rt-seg input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.rt-seg label { display: flex; }
.rt-seg span {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 44px;
  padding: 4px;
  border-radius: 7px;
  text-align: center;
  font-weight: 700;
  font-size: 13px;
  line-height: 1.15;
  color: var(--rt-muted);
}
.rt-seg input:checked + span { background: var(--rt-navy); color: #fff; }
.rt-seg input:focus-visible + span { outline: 3px solid var(--rt-gold); }

.rt-group {
  margin: 20px 0 0;
  padding-top: 14px;
  border-top: 1px solid var(--rt-line);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--rt-muted);
}
.rt-check { display: flex; gap: 8px; align-items: flex-start; margin-top: 12px; font-size: 13px; cursor: pointer; }
.rt-check input { margin-top: 2px; width: 16px; height: 16px; flex: none; accent-color: var(--rt-navy); }

.rt-aviso {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--rt-alert-line);
  background: var(--rt-alert-bg);
  font-size: 13px;
}
.rt-aviso a { display: inline-block; margin-top: 6px; font-weight: 800; }

.rt-adv { margin-top: 16px; border-top: 1px solid var(--rt-line); padding-top: 12px; }
.rt-adv summary { cursor: pointer; font-weight: 700; font-size: 13px; color: var(--rt-link); }

/* ── Resultado ─────────────────────────────────────── */
.rt-result { display: grid; gap: 16px; min-width: 0; }
.rt-alert {
  padding: 12px 14px;
  border-radius: var(--rt-radius);
  background: var(--rt-alert-bg);
  border: 1px solid var(--rt-alert-line);
  font-weight: 600;
}
.rt-kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (min-width: 1180px) { .rt-kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.rt-kpi { background: var(--rt-panel); border: 1px solid var(--rt-line); border-radius: var(--rt-radius); padding: 14px; min-width: 0; }
.rt-kpi__label { font-size: 12px; font-weight: 700; color: var(--rt-muted); }
.rt-kpi__value { margin-top: 4px; font-size: clamp(20px, 2.4vw, 26px); font-weight: 900; line-height: 1.15; overflow-wrap: anywhere; }
.rt-kpi__sub { margin-top: 4px; font-size: 12px; color: var(--rt-muted); }

.rt-card { background: var(--rt-panel); border: 1px solid var(--rt-line); border-radius: var(--rt-radius); padding: 16px; min-width: 0; }
.rt-card__head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 16px; margin-bottom: 8px; }

.rt-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 0; padding: 0; list-style: none; font-size: 12px; color: var(--rt-muted); align-self: flex-end; }
.rt-legend li { display: flex; align-items: center; gap: 6px; }
.rt-sw { display: inline-block; width: 10px; height: 10px; border-radius: 3px; flex: none; }
.rt-sw--old { background: var(--rt-old); }
.rt-sw--new { background: var(--rt-new); }

.rt-chart { position: relative; width: 100%; }
.rt-chart svg { display: block; max-width: 100%; height: auto; }
.rt-grid { stroke: var(--rt-grid); stroke-width: 1; }
.rt-base { stroke: var(--rt-axis); }
.rt-tick { fill: var(--rt-tick); font-size: 11px; font-variant-numeric: tabular-nums; }
.rt-bar--old { fill: var(--rt-old); }
.rt-bar--new { fill: var(--rt-new); }
.rt-hit { fill: transparent; cursor: default; }
.rt-hit.is-on { fill: var(--rt-ink); fill-opacity: .05; }
.rt-tip {
  position: absolute;
  pointer-events: none;
  display: grid;
  gap: 3px;
  min-width: 190px;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--rt-panel);
  border: 1px solid var(--rt-line);
  box-shadow: 0 6px 18px rgba(8, 39, 68, .16);
  font-size: 12px;
}
.rt-tip span { display: flex; align-items: center; gap: 6px; }
.rt-tip b { margin-left: auto; font-variant-numeric: tabular-nums; }
.rt-tip__total { border-top: 1px solid var(--rt-line); padding-top: 3px; }

.rt-table-wrap { margin-top: 10px; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.rt-table { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
.rt-table th, .rt-table td { padding: 7px 8px; border-bottom: 1px solid var(--rt-line); white-space: nowrap; }
.rt-table thead th { text-align: right; font-size: 12px; color: var(--rt-muted); }
.rt-table thead th small { display: block; font-weight: 600; }
.rt-table tbody th { text-align: left; font-weight: 600; position: sticky; left: 0; background: var(--rt-panel); }
.rt-table td { text-align: right; }
.rt-table .rt-sec th { padding-top: 14px; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--rt-muted); position: static; }
.rt-table .rt-strong th, .rt-table .rt-strong td { font-weight: 800; }

.rt-das { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; margin: 12px 0 0; }
.rt-das div { background: var(--rt-soft); border: 1px solid var(--rt-line); border-radius: 10px; padding: 9px 11px; min-width: 0; }
.rt-das dt { font-size: 12px; color: var(--rt-muted); font-weight: 700; }
.rt-das dd { margin: 3px 0 0; font-size: 16px; font-weight: 800; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.rt-das dd small { display: block; font-size: 12px; font-weight: 600; color: var(--rt-muted); }
.rt-table--das { max-width: 720px; }

.rt-opts { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; margin-top: 12px; }
.rt-opt { border: 1px solid var(--rt-line); border-radius: 10px; padding: 12px; background: var(--rt-soft); }
.rt-opt dl { margin: 8px 0 0; display: grid; gap: 6px; }
.rt-opt dl div { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; }
.rt-opt dt { color: var(--rt-muted); }
.rt-opt dd { margin: 0; font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; }
.rt-verdict { margin: 12px 0 0; padding-left: 18px; display: grid; gap: 6px; font-size: 14px; }

.rt-notes ul { margin: 10px 0 14px; padding-left: 18px; display: grid; gap: 6px; font-size: 14px; }
.rt-notes p { margin-top: 6px; font-size: 14px; color: var(--rt-muted); }

.rt-cta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 20px;
  padding: 18px;
  border-radius: var(--rt-radius);
  background: var(--rt-navy);
  color: #fff;
}
.rt-cta h2 { font-size: 18px; }
.rt-cta p { margin-top: 4px; color: rgba(255,255,255,.8); font-size: 14px; }
.rt-btn {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 18px;
  border-radius: 10px;
  background: var(--rt-gold);
  color: #1b1405;
  font-weight: 800;
  text-decoration: none;
}

.rt-simular {
  position: sticky;
  bottom: -16px;
  margin: 16px -16px -16px;
  padding: 12px 16px 16px;
  background: var(--rt-panel);
  border-top: 1px solid var(--rt-line);
  border-radius: 0 0 var(--rt-radius) var(--rt-radius);
}
.rt-simular .rt-btn { width: 100%; justify-content: center; font-size: 16px; }
.rt-erro { margin-bottom: 8px; color: #b42318; font-size: 13px; font-weight: 700; }
.rt-money.is-erro { border-color: #b42318; outline: 2px solid rgba(180, 35, 24, .25); }
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) .rt-erro { color: #f97066; }
}

.rt-vazio { display: grid; gap: 8px; font-size: 15px; }
.rt-desatualizado {
  padding: 10px 14px;
  border-radius: var(--rt-radius);
  background: var(--rt-alert-bg);
  border: 1px solid var(--rt-alert-line);
  font-size: 14px;
}
.rt-result.is-desatualizado [data-resultado]:not(.rt-acoes),
.rt-result.is-desatualizado #rt-das,
.rt-result.is-desatualizado #rt-simples { opacity: .55; }

.rt-acoes { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; }
.rt-acoes .rt-sub { margin: 0; }
.rt-btn { border: 0; font: inherit; font-weight: 800; cursor: pointer; }
.rt-btn--sec { background: var(--rt-navy); color: #fff; }
.rt-btn[disabled] { opacity: .6; cursor: progress; }

.rt-foot { max-width: 1320px; margin: 0 auto; padding: 4px 16px 24px; font-size: 12px; color: var(--rt-muted); }
