/* Lucro do Corre: mesma paleta da landing C (verde lucro, claro por padrão, escuro pelo sistema ou nos ajustes). */
:root {
  --bg: #ffffff;
  --surface: #f6f7f4;
  --card: #ffffff;
  --line: #e7e5df;
  --field-line: #8f8c83;
  --text: #14140f;
  --muted: #5f5e57;
  --brand: #0f9f5f;
  --brand-text: #0b7f4b;
  --brand-soft: #e7f7ee;
  --btn: #0b7f4b;
  --btn-hover: #096b3f;
  --on-btn: #ffffff;
  --amber: #ffb020;
  --amber-soft: #fff4dc;
  --profit: #0f9f5f;
  --profit-text: #0b7f4b;
  --loss: #e5484d;
  --loss-text: #cc3439;
  --warn-text: #8a5a00;
  --c-gasolina: #ffb020;
  --c-manutencao: #ff7a59;
  --c-aluguel: #3e7bfa;
  --c-das: #8fb3ff;
  --c-outros: #a7a59c;
  --shadow: 0 1px 2px rgb(20 20 15 / .05), 0 12px 32px -18px rgb(20 20 15 / .22);
  --radius: 18px;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --safe-top: var(--safe-area-inset-top, env(safe-area-inset-top, 0px));
  --safe-bottom: var(--safe-area-inset-bottom, env(safe-area-inset-bottom, 0px));
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f110e; --surface: #181b17; --card: #20241f; --line: #2a2e28; --field-line: #6e7369; --text: #f2f3ee; --muted: #a9aba2;
    --brand: #2bc47f; --brand-text: #3dd68c; --brand-soft: #143222; --btn: #2bc47f; --btn-hover: #3dd68c; --on-btn: #04130b;
    --amber-soft: #33290f; --profit: #2bc47f; --profit-text: #3dd68c; --loss: #ff6b6b; --loss-text: #ff8a8a; --warn-text: #ffc554;
    --c-aluguel: #5b8fff; --c-das: #a9c4ff; --c-outros: #85837a;
    --shadow: 0 1px 2px rgb(0 0 0 / .4), 0 16px 36px -18px rgb(0 0 0 / .8);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f110e; --surface: #181b17; --card: #20241f; --line: #2a2e28; --field-line: #6e7369; --text: #f2f3ee; --muted: #a9aba2;
  --brand: #2bc47f; --brand-text: #3dd68c; --brand-soft: #143222; --btn: #2bc47f; --btn-hover: #3dd68c; --on-btn: #04130b;
  --amber-soft: #33290f; --profit: #2bc47f; --profit-text: #3dd68c; --loss: #ff6b6b; --loss-text: #ff8a8a; --warn-text: #ffc554;
  --c-aluguel: #5b8fff; --c-das: #a9c4ff; --c-outros: #85837a;
  --shadow: 0 1px 2px rgb(0 0 0 / .4), 0 16px 36px -18px rgb(0 0 0 / .8);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.5 var(--sans); -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; }
a { color: var(--brand-text); }
h1 { font-size: 1.6rem; line-height: 1.15; letter-spacing: -.025em; margin: 0; font-weight: 800; }
h1:focus { outline: none; }
h2 { font-size: 1.08rem; margin: 0 0 8px; letter-spacing: -.01em; font-weight: 750; }
p { margin: 0 0 8px; }
.wrap { width: min(560px, 100% - 32px); margin-inline: auto; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--btn); color: var(--on-btn); padding: 8px 12px; border-radius: 10px; z-index: 30; }
.skip:focus { left: 8px; }
:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; border-radius: 10px; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: .9rem; }
.center { text-align: center; }
.cap::first-letter { text-transform: uppercase; }
.pos { color: var(--profit-text); }
.neg { color: var(--loss-text); }
.warn-text { color: var(--warn-text); }

/* Topo e abas */
header.top { position: sticky; top: 0; z-index: 10; background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: saturate(1.4) blur(10px); -webkit-backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--line); padding-top: var(--safe-top); }
.top .wrap { display: flex; align-items: center; justify-content: space-between; height: 58px; gap: 10px; }
.logo { display: flex; align-items: center; gap: 10px; font-weight: 800; letter-spacing: -.015em; text-decoration: none; color: var(--text); font-size: 17px; }
.logo img { border-radius: 9px; }
.chip { display: inline-flex; align-items: center; font-size: 13px; font-weight: 750; min-height: 30px; padding: 0 12px; border-radius: 999px; background: var(--brand-soft); color: var(--brand-text); white-space: nowrap; text-decoration: none; vertical-align: middle; }
.chip-muted { background: var(--surface); color: var(--muted); }
main { padding: 18px 0 calc(104px + var(--safe-bottom)); min-height: 60vh; }
main:focus { outline: none; }
.tabs { position: fixed; inset: auto 0 0 0; z-index: 10; display: grid; grid-template-columns: repeat(5, 1fr); background: var(--bg); border-top: 1px solid var(--line); padding: 6px 4px calc(8px + var(--safe-bottom)); }
.tabs a { display: flex; flex-direction: column; align-items: center; gap: 3px; min-height: 56px; justify-content: center; text-decoration: none; color: var(--muted); font-size: 12px; font-weight: 700; border-radius: 14px; }
.tabs svg { width: 52px; height: 32px; padding: 4px 14px; border-radius: 999px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.tabs a[aria-current="page"] { color: var(--brand-text); }
.tabs a[aria-current="page"] svg { background: var(--brand-soft); stroke-width: 2.3; }
.tabs .tab-main svg, .tabs .tab-main[aria-current="page"] svg { background: var(--btn); color: var(--on-btn); width: 56px; height: 32px; padding: 4px 16px; stroke-width: 2.8; box-shadow: 0 6px 14px -6px color-mix(in srgb, var(--btn) 70%, transparent); }
.tabs .tab-main { color: var(--text); }
.tabs .tab-main[aria-current="page"] { color: var(--brand-text); }

/* Blocos */
.view { display: grid; gap: 14px; }
.page-head { display: flex; align-items: flex-start; gap: 10px; margin: 2px 0 4px; }
.page-head p { margin: 4px 0 0; }
.back { display: inline-flex; align-items: center; justify-content: center; min-width: 48px; height: 48px; margin: -8px 0 0 -12px; font-size: 34px; line-height: 1; text-decoration: none; color: var(--text); border-radius: 14px; }
.card { background: var(--surface); border-radius: var(--radius); padding: 18px; }
.card.result { background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow); }
.card.inset { background: var(--card); border: 1px dashed var(--field-line); }
.stack { display: grid; gap: 14px; }
.stack > * { margin: 0; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.wrap-gap { flex-wrap: wrap; }
.row-actions { display: flex; gap: 10px; margin-top: 16px; }
.row-actions > * { flex: 1; }
.empty { text-align: center; display: grid; gap: 12px; padding: 24px 18px; }
.empty h2 { font-size: 1.35rem; margin: 0; }
.empty p { margin: 0; }
.link-card { display: flex; align-items: center; justify-content: space-between; gap: 10px; text-decoration: none; color: var(--text); }
.link-card p { margin: 0; }
.link-card h2 { margin: 0 0 2px; }
.ic { width: 22px; height: 22px; flex: none; color: var(--muted); }
.ic-lg { width: 52px; height: 52px; color: var(--brand-text); background: var(--brand-soft); border-radius: 999px; padding: 13px; }
.banner { display: block; background: var(--brand-soft); color: var(--text); border-radius: 16px; padding: 14px 16px; font-size: .95rem; font-weight: 600; text-decoration: none; margin: 0; }
.banner.warn { background: var(--amber-soft); }
.disclaimer { font-size: .84rem; color: var(--muted); border-left: 3px solid var(--line); padding-left: 12px; }

/* Resultado */
.big-label { font-size: .95rem; font-weight: 700; color: var(--muted); margin: 0; letter-spacing: 0; }
.big { font-size: clamp(2.6rem, 13vw, 3.5rem); font-weight: 850; letter-spacing: -.04em; line-height: 1.02; margin: 6px 0 6px; font-variant-numeric: tabular-nums; }
.big.pos, .mid.pos { color: var(--profit); }
.big.neg, .mid.neg { color: var(--loss); }
.mid { font-size: 1.75rem; font-weight: 850; letter-spacing: -.03em; margin: 2px 0; font-variant-numeric: tabular-nums; line-height: 1.15; }
.mid small { font-size: .9rem; font-weight: 600; color: var(--muted); letter-spacing: 0; }
.rates { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; margin: 16px 0; }
.rates div { background: var(--surface); border-radius: 14px; padding: 11px 10px; min-width: 0; }
.card:not(.result) .rates div { background: var(--card); }
.rates b { display: block; font-size: clamp(.95rem, 4vw, 1.15rem); font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rates span { font-size: .82rem; color: var(--muted); }
.bar { display: flex; height: 14px; border-radius: 999px; overflow: hidden; background: var(--surface); margin: 4px 0 14px; gap: 2px; }
.bar i { display: block; height: 100%; border-radius: 3px; }
.bar i:first-child { border-radius: 999px 3px 3px 999px; }
.bar i:last-child { border-radius: 3px 999px 999px 3px; }
.legend { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; font-size: .95rem; }
.legend li { display: flex; justify-content: space-between; gap: 10px; }
.legend li > span:first-child { color: var(--muted); }
.legend li span:last-child { font-variant-numeric: tabular-nums; }
.legend .tot { border-top: 1px solid var(--line); padding-top: 10px; margin-top: 2px; font-weight: 800; }
.legend .tot > span:first-child { color: var(--text); }
.legend + p { margin: 14px 0 0; }
.sw { display: inline-block; width: 12px; height: 12px; border-radius: 4px; margin-right: 10px; vertical-align: -1px; }

/* Formulários */
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; display: grid; gap: 10px; }
legend { font-weight: 800; font-size: 1.05rem; margin-bottom: 10px; padding: 0; letter-spacing: -.01em; }
.fields { display: grid; gap: 12px; }
.fields.two { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.fields.three { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr); }
.f { display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; font-size: .9rem; font-weight: 650; min-width: 0; }
.f.full { grid-column: 1 / -1; }
.fields > .f { align-content: end; }
.f small { font-weight: 450; color: var(--muted); font-size: .8rem; }
.f.inline { display: flex; align-items: center; gap: 10px; }
.f.inline .input, .f.inline input { width: auto; }
.input { position: relative; display: flex; align-items: center; }
.input .pre, .input .suf { position: absolute; font-size: .95rem; font-weight: 600; color: var(--muted); pointer-events: none; }
.input .pre { left: 14px; }
.input .suf { right: 14px; }
input, select, textarea { font: inherit; color: var(--text); }
.input input, .input select, .input textarea, .f.inline > input { width: 100%; min-height: 54px; border-radius: 14px; border: 1px solid var(--field-line); background: var(--card); font-size: 18px; font-weight: 700; padding: 0 14px; font-variant-numeric: tabular-nums; }
.input input::placeholder, .input textarea::placeholder { color: color-mix(in srgb, var(--muted) 70%, transparent); font-weight: 600; }
.input textarea { font-size: 14px; font-weight: 500; padding: 12px 14px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; word-break: break-all; resize: vertical; }
.input select { appearance: none; padding-right: 36px; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 20px) 24px, calc(100% - 15px) 24px; background-size: 5px 5px; background-repeat: no-repeat; }
.input input.has-pre { padding-left: 42px; }
.input input.has-suf { padding-right: 54px; }
input[type="date"], input[type="time"], input[type="month"] { min-width: 0; min-height: 54px; border-radius: 14px; border: 1px solid var(--field-line); background: var(--card); font-size: 17px; font-weight: 700; padding: 0 12px; }
.input input:focus, .input select:focus, .input textarea:focus, input[type="date"]:focus, input[type="time"]:focus, input[type="month"]:focus { border-color: var(--brand); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 28%, transparent); }
.plats { display: grid; gap: 10px; }
.plat { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); align-items: center; gap: 12px; font-weight: 600; }
.plat > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
details.more summary { cursor: pointer; font-weight: 700; color: var(--brand-text); list-style: none; padding: 4px 0; min-height: 48px; display: flex; align-items: center; gap: 10px; }
details.more summary::before { content: "+"; display: grid; place-items: center; width: 24px; height: 24px; border-radius: 999px; background: var(--brand-soft); font-weight: 800; flex: none; }
details.more[open] summary::before { content: "−"; }
details.more summary::-webkit-details-marker { display: none; }
.check { display: flex; gap: 12px; align-items: flex-start; font-weight: 600; min-height: 48px; padding-top: 12px; }
.check input { width: 22px; height: 22px; accent-color: var(--btn); flex: none; margin: 0; }
.pills { display: flex; flex-wrap: wrap; gap: 8px; }
.pill input, .chip-check input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.pill span, .chip-check span { display: inline-flex; align-items: center; justify-content: center; min-height: 48px; padding: 0 20px; border-radius: 14px; border: 1px solid var(--line); background: var(--card); font-weight: 750; cursor: pointer; }
.pill input:checked + span, .chip-check input:checked + span { background: var(--btn); color: var(--on-btn); border-color: var(--btn); }
.pill input:focus-visible + span, .chip-check input:focus-visible + span { outline: 3px solid var(--brand); outline-offset: 2px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-check span { min-height: 44px; padding: 0 16px; border-radius: 999px; font-weight: 700; }
.add-row { display: flex; gap: 10px; align-items: flex-end; }
.add-row .f { flex: 1; }
.add-row .btn { min-height: 54px; }
.form-err { color: var(--loss-text); font-size: .92rem; min-height: 1.3em; font-weight: 650; }
.form-err:empty { min-height: 0; }
.preview { background: var(--brand-soft); color: var(--text); border-radius: 14px; padding: 14px; font-size: 1rem; font-weight: 600; text-align: center; font-variant-numeric: tabular-nums; }
.preview b { font-size: 1.2rem; font-weight: 850; }
.preview.muted { background: var(--card); color: var(--muted); font-weight: 500; font-size: .92rem; }
.preview:empty { display: none; }
.file-btn { position: relative; overflow: hidden; }
.file-btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

/* Botões */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 54px; padding: 0 20px; border-radius: 16px; font: inherit; font-weight: 750; font-size: 17px; text-decoration: none; border: 1px solid transparent; cursor: pointer; text-align: center; line-height: 1.2; }
.btn .ic { color: currentColor; }
.btn-primary { background: var(--btn); color: var(--on-btn); }
.btn-primary:hover { background: var(--btn-hover); }
.btn-ghost { background: var(--card); color: var(--text); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--brand); }
.btn-danger { background: transparent; color: var(--loss-text); border-color: color-mix(in srgb, var(--loss) 45%, var(--line)); }
.btn-block { width: 100%; }
.btn-small { min-height: 48px; padding: 0 16px; font-size: 15px; border-radius: 14px; background: var(--card); color: var(--text); border-color: var(--line); }
.btn:disabled { opacity: .6; cursor: default; }
.link { background: none; border: 0; padding: 8px 0; color: var(--brand-text); font: inherit; font-weight: 700; cursor: pointer; text-decoration: none; text-align: left; min-height: 48px; display: inline-flex; align-items: center; }
.link.small { font-size: .92rem; }
.icon-btn { min-width: 48px; min-height: 48px; border-radius: 14px; border: 1px solid var(--line); background: var(--card); color: var(--text); font: inherit; font-size: 20px; font-weight: 800; cursor: pointer; }
.icon-btn:disabled { opacity: .35; cursor: default; }
.btns { display: flex; gap: 6px; }

/* Painel */
.seg { display: grid; grid-template-columns: repeat(3, 1fr); background: var(--surface); border-radius: 16px; padding: 4px; gap: 4px; }
.seg button { min-height: 46px; border: 0; border-radius: 12px; background: transparent; color: var(--muted); font: inherit; font-weight: 750; cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--card); color: var(--text); box-shadow: 0 1px 3px rgb(20 20 15 / .12); }
.period-nav { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.period-nav b { font-size: 1.05rem; text-align: center; }
.period-nav b::first-letter { text-transform: uppercase; }
.period-nav .icon-btn { border: 0; background: var(--surface); }
.hbars { list-style: none; padding: 0; margin: 0; display: grid; gap: 14px; }
.hbars p { margin: 4px 0 0; }
.hbars b { font-variant-numeric: tabular-nums; }
.hbar { height: 10px; border-radius: 999px; background: var(--card); overflow: hidden; margin-top: 8px; }
.hbar i { display: block; height: 100%; background: var(--brand); border-radius: 999px; }
.hbar.best i { background: var(--amber); }
.list { list-style: none; padding: 0; margin: 0; }
.list li + li { border-top: 1px solid var(--line); }
.list.compact li { padding: 12px 0; }
.list.compact li > span:first-child { display: grid; min-width: 0; }
.row-link { display: flex; width: 100%; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; min-height: 60px; text-decoration: none; color: var(--text); background: none; border: 0; font: inherit; text-align: left; cursor: pointer; }
.row-link > span { display: grid; min-width: 0; }
.row-link small { font-size: .85rem; }
.row-link > b { font-variant-numeric: tabular-nums; white-space: nowrap; font-size: 1.05rem; }

/* Metas e progresso */
.meta + .meta { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); }
.meta-top { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.meta-top span { color: var(--muted); font-size: .9rem; font-variant-numeric: tabular-nums; }
.meta p { margin: 8px 0 0; }
.progress { height: 12px; border-radius: 999px; background: var(--card); overflow: hidden; margin-top: 10px; }
.card.result .progress { background: var(--surface); }
.progress.lg { height: 16px; margin: 12px 0 0; }
.progress i { display: block; height: 100%; background: var(--amber); border-radius: 999px; }
.progress.done i, .progress.ok i { background: var(--brand); }
.progress.atencao i { background: var(--amber); }
.progress.acima i, .progress.acima20 i { background: var(--loss); }

/* Vale a pena */
.verdict { display: flex; align-items: center; gap: 14px; border-radius: 16px; padding: 16px; border: 2px solid var(--line); }
.verdict.none { color: var(--muted); border-style: dashed; border-color: var(--field-line); justify-content: center; margin: 0; background: var(--card); }
.verdict .vi { display: inline-flex; align-items: center; justify-content: center; width: 48px; height: 48px; border-radius: 999px; font-size: 24px; font-weight: 900; flex: none; }
.verdict b { display: block; font-size: 1.4rem; letter-spacing: -.02em; }
.verdict span { font-variant-numeric: tabular-nums; }
.verdict.verde { border-color: var(--brand); background: var(--brand-soft); }
.verdict.verde .vi { background: var(--brand); color: #ffffff; }
.verdict.amarelo { border-color: var(--amber); background: var(--amber-soft); }
.verdict.amarelo .vi { background: var(--amber); color: #14140f; }
.verdict.vermelho { border-color: var(--loss); background: color-mix(in srgb, var(--loss) 12%, var(--card)); }
.verdict.vermelho .vi { background: var(--loss); color: #ffffff; }

/* Pro */
.locked { text-align: center; display: grid; gap: 12px; justify-items: center; }
.checks { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; text-align: left; }
.checks li { padding-left: 32px; position: relative; min-height: 22px; }
.checks li::before { content: ""; position: absolute; left: 0; top: 1px; width: 22px; height: 22px; border-radius: 999px; background: var(--brand-soft) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%230f9f5f' stroke-width='3.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 12.5l4 4 8-9'/%3E%3C/svg%3E") center / 14px no-repeat; }
.price-line { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; margin: 0; }
.price-line b { font-size: 1.9rem; font-weight: 850; letter-spacing: -.035em; font-variant-numeric: tabular-nums; }
.price-tag { display: inline-flex; align-items: center; font-size: 12.5px; font-weight: 800; padding: 4px 10px; border-radius: 999px; background: var(--amber); color: #14140f; }

.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(92px + var(--safe-bottom)); z-index: 20; background: var(--text); color: var(--bg); padding: 13px 18px; border-radius: 14px; font-weight: 700; font-size: .95rem; width: max-content; max-width: calc(100% - 32px); box-shadow: 0 10px 30px rgb(0 0 0 / .3); }

@media (max-width: 380px) {
  .fields.three { grid-template-columns: 1fr 1fr; }
}
@media (prefers-reduced-motion: no-preference) {
  .toast { animation: up .18s ease-out; }
  @keyframes up { from { opacity: 0; transform: translate(-50%, 8px); } }
}
