:root {
    --paper: #eef0e6;
    --paper-card: #faf9f2;
    --ink: #1f2a1f;
    --ink-soft: #57614f;
    --ink-faint: #8b9481;
    --rule: #cad0bc;
    --rule-strong: #a8b096;
    --gold: #b8791f;
    --gold-ink: #7d5314;
    --green: #2f7a4f;
    --green-soft: #e3ecdf;
    --red: #ab4327;
    --red-soft: #f3e2da;
    --shadow: 0 1px 0 rgba(31,42,31,0.06);
  }

  @media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
      --paper: #161c15;
      --paper-card: #1e2620;
      --ink: #eceee2;
      --ink-soft: #b1baa5;
      --ink-faint: #7c8672;
      --rule: #333d2d;
      --rule-strong: #47523d;
      --gold: #d99a3a;
      --gold-ink: #f0b45c;
      --green: #6fb98a;
      --green-soft: #223327;
      --red: #d97c5f;
      --red-soft: #3a2621;
      --shadow: 0 1px 0 rgba(0,0,0,0.3);
    }
  }

  :root[data-theme="dark"] {
    --paper: #161c15;
    --paper-card: #1e2620;
    --ink: #eceee2;
    --ink-soft: #b1baa5;
    --ink-faint: #7c8672;
    --rule: #333d2d;
    --rule-strong: #47523d;
    --gold: #d99a3a;
    --gold-ink: #f0b45c;
    --green: #6fb98a;
    --green-soft: #223327;
    --red: #d97c5f;
    --red-soft: #3a2621;
    --shadow: 0 1px 0 rgba(0,0,0,0.3);
  }

  * { box-sizing: border-box; }

  body {
    margin: 0;
    background: var(--paper);
    color: var(--ink);
    font-family: "Public Sans", -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 16px;
    line-height: 1.62;
    -webkit-font-smoothing: antialiased;
  }

  ::selection { background: var(--gold); color: #fff; }

  h1, h2, h3 { font-family: "Fraunces", Georgia, serif; text-wrap: balance; margin: 0; color: var(--ink); }

  .wrap { max-width: 720px; margin: 0 auto; padding: 0 28px; }

  a { color: var(--gold-ink); }

  .mono, .figure { font-family: "IBM Plex Mono", ui-monospace, monospace; font-variant-numeric: tabular-nums; }

  /* ---------- Masthead ---------- */

  .masthead {
    border-bottom: 1px solid var(--rule);
    padding: 20px 0;
  }
  .masthead .wrap {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
  }
  .masthead .mark {
    font-family: "Fraunces", serif;
    font-weight: 600;
    font-size: 1.05rem;
  }
  .masthead .mark span { color: var(--gold-ink); }
  .masthead .tag {
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--ink-faint);
  }

  /* ---------- Hero ---------- */

  .hero { padding: 56px 0 40px; }
  .hero .eyebrow {
    font-size: 0.78rem;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: var(--gold-ink);
    font-weight: 600;
    margin-bottom: 14px;
  }
  .hero h1 {
    font-size: clamp(2rem, 5vw, 2.9rem);
    font-weight: 600;
    letter-spacing: -0.01em;
    margin-bottom: 18px;
  }
  .hero p.lede {
    max-width: 54ch;
    color: var(--ink-soft);
    font-size: 1.08rem;
    margin-bottom: 28px;
  }

  .chart-card {
    background: var(--paper-card);
    border: 1px solid var(--rule);
    border-radius: 4px;
    padding: 22px 22px 14px;
    box-shadow: var(--shadow);
    margin-bottom: 20px;
  }
  .chart-card .chart-caption {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 4px;
  }
  .chart-card .chart-title {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--ink-faint);
    font-weight: 600;
  }
  .chart-card .chart-src {
    font-size: 0.72rem;
    color: var(--ink-faint);
  }
  svg.thesis text {
    font-family: "IBM Plex Mono", monospace;
    font-size: 11px;
    fill: var(--ink-faint);
  }
  svg.thesis .zero-line { stroke: var(--rule-strong); stroke-width: 1; stroke-dasharray: 3 4; }
  svg.thesis .zone-neg { fill: var(--red-soft); opacity: 0.6; }
  svg.thesis .line-reactive { fill: none; stroke: var(--red); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
  svg.thesis .line-reactive.ghost { stroke-dasharray: 2 5; opacity: 0.55; }
  svg.thesis .line-planned { fill: none; stroke: var(--green); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
  svg.thesis circle.pt { fill: var(--paper-card); stroke-width: 2; }
  svg.thesis circle.pt.r { stroke: var(--red); }
  svg.thesis circle.pt.g { stroke: var(--green); }
  svg.thesis .label-reactive { fill: var(--red); font-weight: 600; }
  svg.thesis .label-planned { fill: var(--green); font-weight: 600; }

  .btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--ink);
    color: var(--paper);
    border: none;
    padding: 12px 22px;
    border-radius: 3px;
    font-family: "Public Sans", sans-serif;
    font-weight: 600;
    font-size: 0.92rem;
    text-decoration: none;
    cursor: pointer;
  }
  .btn.ghost {
    background: transparent;
    color: var(--ink);
    border: 1px solid var(--rule-strong);
  }

  /* ---------- Credibility strip ---------- */

  .credibility {
    padding: 8px 0 12px;
  }
  .credibility .box {
    border-top: 1px solid var(--rule);
    border-bottom: 1px solid var(--rule);
    padding: 18px 0;
    display: flex;
    gap: 18px;
    align-items: flex-start;
  }
  .credibility .box .mono {
    font-size: 0.72rem;
    color: var(--gold-ink);
    padding-top: 3px;
    white-space: nowrap;
  }
  .credibility .box p { margin: 0; color: var(--ink-soft); font-size: 0.94rem; }
  .credibility .box strong { color: var(--ink); }
  .credibility .disclaimer {
    font-size: 0.8rem;
    color: var(--ink-faint);
    font-style: italic;
    padding-top: 10px;
  }

  /* ---------- Ledger entries ---------- */

  .entry {
    padding: 44px 0;
    border-bottom: 1px solid var(--rule);
  }
  .entry .wrap {
    display: grid;
    grid-template-columns: 56px 1fr;
    gap: 4px 22px;
  }
  .entry .num {
    font-family: "IBM Plex Mono", monospace;
    font-size: 0.85rem;
    color: var(--ink-faint);
    padding-top: 6px;
  }
  .entry .body { min-width: 0; }
  .entry h2 { font-size: 1.5rem; font-weight: 600; margin-bottom: 14px; }
  .entry p { color: var(--ink-soft); margin: 0 0 14px; max-width: 62ch; }

  .callout {
    background: var(--paper-card);
    border-left: 3px solid var(--gold);
    border-radius: 0 3px 3px 0;
    padding: 14px 18px;
    margin: 16px 0;
  }
  .callout .k {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 700;
    color: var(--gold-ink);
    margin-bottom: 6px;
  }
  .callout p:last-child { margin-bottom: 0; }

  .check {
    background: var(--green-soft);
    border-radius: 3px;
    padding: 14px 18px;
    margin: 16px 0;
  }
  .check .k {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 700;
    color: var(--green);
    margin-bottom: 6px;
  }
  .check p:last-child { margin-bottom: 0; color: var(--ink-soft); }

  .entry.opinion { background: var(--red-soft); background: none; }
  .opinion-flag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--red-soft);
    color: var(--red);
    font-size: 0.76rem;
    font-weight: 700;
    padding: 5px 11px;
    border-radius: 3px;
    margin-bottom: 14px;
  }

  .note {
    font-size: 0.9rem;
    color: var(--ink-faint);
  }

  /* ---------- Simulator ----------
     Painel fixo (tipo "recibo"), com paleta própria que não muda com o
     tema claro/escuro do sistema — evita texto claro sobre fundo claro
     (ou escuro sobre escuro) quando os tokens globais invertem. */

  .simulator {
    --stmt-bg: #12160f;
    --stmt-panel: #1c2418;
    --stmt-panel-2: #202920;
    --stmt-line: #303a29;
    --stmt-border: #3a4632;
    --stmt-text: #eef0e6;
    --stmt-text-soft: #c3cabb;
    --stmt-text-faint: #8b9481;
    --stmt-gold: #d99a3a;
    --stmt-green: #8fd1a8;
    --stmt-red: #e69a80;
    background: var(--stmt-bg);
    color: var(--stmt-text);
    padding: 52px 0 60px;
    color-scheme: dark;
  }
  .simulator .wrap { max-width: 760px; }
  .simulator .eyebrow {
    font-size: 0.78rem;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: var(--stmt-gold);
    font-weight: 600;
    margin-bottom: 10px;
  }
  .simulator h2 { color: var(--stmt-text); font-size: 1.7rem; margin-bottom: 10px; }
  .simulator .sub { color: var(--stmt-text-soft); max-width: 56ch; margin-bottom: 30px; }

  .statement {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
  }
  @media (min-width: 720px) {
    .statement { grid-template-columns: 260px 1fr; }
  }

  .statement-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
  }
  .field {
    display: flex;
    flex-direction: column;
    gap: 6px;
  }
  .field label {
    font-size: 0.82rem;
    color: var(--stmt-text-soft);
    font-weight: 500;
  }
  .field label .opt { color: var(--stmt-text-faint); font-weight: 400; }
  .field input[type="number"] {
    font-family: "IBM Plex Mono", monospace;
    font-size: 0.98rem;
    background: var(--stmt-panel-2);
    border: 1px solid var(--stmt-border);
    color: var(--stmt-text);
    border-radius: 3px;
    padding: 10px 12px;
  }
  .field input[type="number"]:focus {
    outline: 2px solid var(--stmt-gold);
    outline-offset: 1px;
  }
  .field.checkline {
    flex-direction: row;
    align-items: center;
    gap: 10px;
  }
  .field.checkline input { width: 16px; height: 16px; }
  .field.checkline label { font-size: 0.88rem; color: var(--stmt-text); }

  .statement-lines {
    display: flex;
    flex-direction: column;
    gap: 1px;
    background: var(--stmt-line);
    border-radius: 4px;
    overflow: hidden;
  }
  .line {
    background: var(--stmt-panel);
    padding: 16px 20px;
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: baseline;
    gap: 6px;
  }
  .line .l-label {
    font-size: 0.82rem;
    color: var(--stmt-text-faint);
  }
  .line .l-tag {
    display: inline-block;
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--stmt-red);
    background: rgba(217,124,95,0.14);
    padding: 1px 6px;
    border-radius: 3px;
    margin-left: 6px;
  }
  .line .l-value {
    grid-column: 1 / -1;
    font-family: "IBM Plex Mono", monospace;
    font-size: 1.5rem;
    font-weight: 500;
    color: var(--stmt-text);
  }
  .line .l-detail {
    grid-column: 1 / -1;
    font-size: 0.8rem;
    color: var(--stmt-text-faint);
  }
  .line.status-ok .l-value { color: var(--stmt-green); }
  .line.status-warn .l-value { color: var(--stmt-gold); }
  .line.status-bad .l-value { color: var(--stmt-red); }

  /* ---------- Video ---------- */

  .video-section { padding: 56px 0 60px; }
  .video-section h2 { font-size: 1.5rem; margin-bottom: 10px; }
  .video-section p { color: var(--ink-soft); max-width: 60ch; }
  .video-frame {
    position: relative;
    display: block;
    width: 100%;
    padding-top: 56.25%;
    border-radius: 4px;
    overflow: hidden;
    margin: 22px 0;
    border: 1px solid var(--rule);
  }
  .video-frame iframe {
    position: absolute; inset: 0; width: 100%; height: 100%; border: 0;
  }

  /* ---------- Footer ---------- */

  footer {
    border-top: 1px solid var(--rule);
    padding: 26px 0 44px;
  }
  footer p {
    font-size: 0.8rem;
    color: var(--ink-faint);
    margin: 0;
    max-width: 62ch;
  }