/* ==========================================================================
   SciFinance Lab — Design System v1.0
   Identidade "Laboratório técnico": papel de caderno, tinta azul-marinho,
   verde-reagente e cobre. Tipografia IBM Plex Sans + IBM Plex Mono.
   Todos os simuladores importam este arquivo. Documentação: /marca/
   ========================================================================== */

/* ---------- Fontes (auto-hospedadas, licença OFL) ---------- */
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 400; font-display: swap; src: url("../fonts/ibm-plex-sans-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 500; font-display: swap; src: url("../fonts/ibm-plex-sans-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 600; font-display: swap; src: url("../fonts/ibm-plex-sans-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 700; font-display: swap; src: url("../fonts/ibm-plex-sans-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-style: normal; font-weight: 400; font-display: swap; src: url("../fonts/ibm-plex-mono-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-style: normal; font-weight: 500; font-display: swap; src: url("../fonts/ibm-plex-mono-latin-500-normal.woff2") format("woff2"); }

/* ---------- Tokens ---------- */
:root {
  color-scheme: light;
  /* Tinta */
  --sfl-ink: #0D1B2A;
  --sfl-ink-2: #3B4A5A;
  --sfl-muted: #5F6B78;
  /* Papel e superfícies */
  --sfl-paper: #F6F5F0;
  --sfl-surface: #FFFFFF;
  --sfl-surface-2: #FAF9F5;
  --sfl-line: #E3E1D9;
  --sfl-line-strong: #CBC8BC;
  --sfl-grid: rgba(13, 27, 42, 0.05);
  /* Reagente (verde da marca) */
  --sfl-reagent: #13A06E;
  --sfl-reagent-ink: #0B7A53;
  --sfl-reagent-wash: #E4F4EC;
  --sfl-reagent-glow: #3DDC97;
  /* Cobre (contraponto / segunda série) */
  --sfl-copper: #E0672C;
  --sfl-copper-ink: #B04D1C;
  --sfl-copper-wash: #FBEDE5;
  /* Estados */
  --sfl-warn-ink: #8A5A00;
  --sfl-warn-wash: #FFF4D6;
  --sfl-warn-line: #F0D48A;
  --sfl-danger: #B42318;
  /* Séries de gráfico (ordem fixa) */
  --sfl-series-1: var(--sfl-reagent);
  --sfl-series-2: var(--sfl-copper);
  /* Botão primário */
  --sfl-btn-bg: var(--sfl-ink);
  --sfl-btn-fg: #F6F5F0;
  --sfl-btn-bg-hover: #1D3048;
  /* Logo */
  --sfl-logo-ink: var(--sfl-ink);
  --sfl-logo-accent: var(--sfl-reagent-ink);
  --sfl-logo-liquid: var(--sfl-reagent);
  --sfl-logo-coin: var(--sfl-copper);
  /* Forma */
  --sfl-radius: 14px;
  --sfl-radius-sm: 9px;
  --sfl-radius-xs: 6px;
  --sfl-shadow: 0 1px 2px rgba(13, 27, 42, 0.04), 0 6px 24px -8px rgba(13, 27, 42, 0.08);
  --sfl-focus: 0 0 0 3px rgba(19, 160, 110, 0.35);
  /* Tipografia */
  --sfl-font: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --sfl-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  /* Layout */
  --sfl-max: 1240px;
  --sfl-gutter: clamp(16px, 4vw, 32px);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --sfl-ink: #E8ECF0;
    --sfl-ink-2: #B7C2CD;
    --sfl-muted: #8D9AA8;
    --sfl-paper: #0B1622;
    --sfl-surface: #122131;
    --sfl-surface-2: #0F1C2A;
    --sfl-line: #22364B;
    --sfl-line-strong: #34506D;
    --sfl-grid: rgba(232, 236, 240, 0.045);
    --sfl-reagent: #17A673;
    --sfl-reagent-ink: #3DDC97;
    --sfl-reagent-wash: rgba(61, 220, 151, 0.12);
    --sfl-copper: #E36B30;
    --sfl-copper-ink: #F59A66;
    --sfl-copper-wash: rgba(227, 107, 48, 0.14);
    --sfl-warn-ink: #F3C969;
    --sfl-warn-wash: rgba(243, 201, 105, 0.1);
    --sfl-warn-line: rgba(243, 201, 105, 0.35);
    --sfl-danger: #FF8A80;
    --sfl-btn-bg: #3DDC97;
    --sfl-btn-fg: #0B1622;
    --sfl-btn-bg-hover: #6BE6B1;
    --sfl-logo-liquid: #3DDC97;
    --sfl-logo-coin: #E8763D;
    --sfl-shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px -8px rgba(0, 0, 0, 0.4);
    --sfl-focus: 0 0 0 3px rgba(61, 220, 151, 0.4);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --sfl-ink: #E8ECF0; --sfl-ink-2: #B7C2CD; --sfl-muted: #8D9AA8;
  --sfl-paper: #0B1622; --sfl-surface: #122131; --sfl-surface-2: #0F1C2A;
  --sfl-line: #22364B; --sfl-line-strong: #34506D; --sfl-grid: rgba(232, 236, 240, 0.045);
  --sfl-reagent: #17A673; --sfl-reagent-ink: #3DDC97; --sfl-reagent-wash: rgba(61, 220, 151, 0.12);
  --sfl-copper: #E36B30; --sfl-copper-ink: #F59A66; --sfl-copper-wash: rgba(227, 107, 48, 0.14);
  --sfl-warn-ink: #F3C969; --sfl-warn-wash: rgba(243, 201, 105, 0.1); --sfl-warn-line: rgba(243, 201, 105, 0.35);
  --sfl-danger: #FF8A80;
  --sfl-btn-bg: #3DDC97; --sfl-btn-fg: #0B1622; --sfl-btn-bg-hover: #6BE6B1;
  --sfl-logo-liquid: #3DDC97;
  --sfl-logo-coin: #E8763D;
  --sfl-shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px -8px rgba(0, 0, 0, 0.4);
  --sfl-focus: 0 0 0 3px rgba(61, 220, 151, 0.4);
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--sfl-font);
  font-size: 16px;
  line-height: 1.55;
  color: var(--sfl-ink);
  background: var(--sfl-paper);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
img, svg { display: block; max-width: 100%; }
a { color: var(--sfl-reagent-ink); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
h1, h2, h3, h4 { margin: 0; line-height: 1.15; letter-spacing: -0.02em; font-weight: 600; }
h1 { font-size: clamp(30px, 4.6vw, 48px); letter-spacing: -0.03em; }
h2 { font-size: clamp(22px, 2.6vw, 28px); }
h3 { font-size: 18px; letter-spacing: -0.01em; }
p { margin: 0; }
::selection { background: var(--sfl-reagent-wash); color: var(--sfl-ink); }
:focus-visible { outline: none; box-shadow: var(--sfl-focus); border-radius: var(--sfl-radius-xs); }

.sfl-wrap { width: 100%; max-width: var(--sfl-max); margin-inline: auto; padding-inline: var(--sfl-gutter); }
.sfl-visually-hidden { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.sfl-skip { position: absolute; left: 12px; top: -48px; z-index: 100; background: var(--sfl-btn-bg); color: var(--sfl-btn-fg); padding: 8px 14px; border-radius: var(--sfl-radius-sm); }
.sfl-skip:focus { top: 12px; }
.num, .sfl-mono { font-family: var(--sfl-mono); font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }

/* ---------- Logo inline ---------- */
.sfl-logo { height: 28px; width: auto; }
.sfl-logo__ink { fill: var(--sfl-logo-ink); }
.sfl-logo__accent { fill: var(--sfl-logo-accent); }
.sfl-logo__stroke { stroke: var(--sfl-logo-ink); fill: none; }
.sfl-logo__liquid { fill: var(--sfl-logo-liquid); }
.sfl-logo__coin { fill: var(--sfl-logo-coin); }
.sfl-logo__coin-mark { fill: #FFF8F0; }
.sfl-logo__coin-ring { stroke: #FFFFFF; opacity: .6; }
.sfl-logo__cifrao { stroke: var(--sfl-logo-coin); fill: none; }

/* ---------- Header ---------- */
.sfl-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--sfl-paper) 86%, transparent);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--sfl-line);
}
.sfl-header__inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; height: 64px; }
.sfl-header__brand { display: inline-flex; align-items: center; text-decoration: none; }
.sfl-nav { display: flex; align-items: center; gap: 4px; }
.sfl-nav a {
  color: var(--sfl-ink-2); text-decoration: none; font-size: 14px; font-weight: 500;
  padding: 8px 12px; border-radius: 999px;
}
.sfl-nav a:hover { color: var(--sfl-ink); background: var(--sfl-surface); }
.sfl-nav a[aria-current="page"] { color: var(--sfl-ink); background: var(--sfl-surface); box-shadow: inset 0 0 0 1px var(--sfl-line); }
@media (max-width: 560px) {
  .sfl-logo { height: 24px; }
  .sfl-nav a.sfl-nav__opt { display: none; }
}

/* ---------- Hero ---------- */
.sfl-hero { position: relative; padding: clamp(40px, 7vw, 88px) 0 clamp(28px, 4vw, 48px); isolation: isolate; }
.sfl-hero::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background-image:
    linear-gradient(var(--sfl-grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--sfl-grid) 1px, transparent 1px);
  background-size: 24px 24px;
  -webkit-mask-image: linear-gradient(to bottom, #000 30%, transparent);
  mask-image: linear-gradient(to bottom, #000 30%, transparent);
}
.sfl-hero__lead { margin-top: 16px; max-width: 62ch; font-size: clamp(16px, 1.6vw, 19px); color: var(--sfl-ink-2); }
.sfl-hero__actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }

/* ---------- Etiqueta de protocolo (ex.: SIM·01) ---------- */
.sfl-tag {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--sfl-mono); font-size: 12px; font-weight: 500; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--sfl-ink-2);
  padding: 5px 10px; border: 1px solid var(--sfl-line-strong); border-radius: 999px; background: var(--sfl-surface);
}
.sfl-tag::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--sfl-reagent); }
.sfl-tag--muted::before { background: var(--sfl-line-strong); }
.sfl-eyebrow { font-family: var(--sfl-mono); font-size: 12px; font-weight: 500; letter-spacing: 0.08em; text-transform: uppercase; color: var(--sfl-muted); }

/* ---------- Botões ---------- */
.sfl-btn {
  --_bg: var(--sfl-surface); --_fg: var(--sfl-ink); --_bd: var(--sfl-line-strong);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 18px; border-radius: 999px;
  font: 500 15px/1 var(--sfl-font); letter-spacing: -0.005em; text-decoration: none; cursor: pointer;
  color: var(--_fg); background: var(--_bg); border: 1px solid var(--_bd);
  transition: background-color .15s ease, border-color .15s ease, transform .05s ease;
}
.sfl-btn:hover { border-color: var(--sfl-ink-2); }
.sfl-btn:active { transform: translateY(1px); }
.sfl-btn svg { width: 16px; height: 16px; flex: none; }
.sfl-btn--primary { --_bg: var(--sfl-btn-bg); --_fg: var(--sfl-btn-fg); --_bd: var(--sfl-btn-bg); }
.sfl-btn--primary:hover { --_bg: var(--sfl-btn-bg-hover); border-color: var(--sfl-btn-bg-hover); }
.sfl-btn--sm { min-height: 36px; padding: 0 14px; font-size: 14px; }
.sfl-btn--ghost { --_bg: transparent; --_bd: transparent; color: var(--sfl-ink-2); }
.sfl-btn--ghost:hover { --_bg: var(--sfl-surface); border-color: var(--sfl-line); }

/* ---------- Cartões ---------- */
.sfl-card {
  background: var(--sfl-surface);
  border: 1px solid var(--sfl-line);
  border-radius: var(--sfl-radius);
  box-shadow: var(--sfl-shadow);
}
.sfl-card__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 18px 20px 0; }
.sfl-card__body { padding: 20px; }
.sfl-card__title { font-size: 16px; font-weight: 600; letter-spacing: -0.01em; }
.sfl-card__sub { font-size: 13px; color: var(--sfl-muted); margin-top: 2px; }

/* ---------- Formulários ---------- */
.sfl-field { display: grid; gap: 6px; }
.sfl-field + .sfl-field { margin-top: 14px; }
.sfl-label { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; font-size: 13px; font-weight: 500; color: var(--sfl-ink-2); }
.sfl-label small { font-weight: 400; color: var(--sfl-muted); font-family: var(--sfl-mono); font-size: 11.5px; }
.sfl-input {
  display: flex; align-items: center;
  background: var(--sfl-surface-2);
  border: 1px solid var(--sfl-line-strong);
  border-radius: var(--sfl-radius-sm);
  transition: border-color .15s ease, box-shadow .15s ease, background-color .15s ease;
  min-height: 44px;
}
.sfl-input:hover { border-color: var(--sfl-ink-2); }
.sfl-input:focus-within { border-color: var(--sfl-reagent); box-shadow: var(--sfl-focus); background: var(--sfl-surface); }
.sfl-input input, .sfl-input select {
  flex: 1; min-width: 0; width: 100%;
  border: 0; outline: 0; background: transparent; color: var(--sfl-ink);
  font: 500 15px/1.2 var(--sfl-mono); font-variant-numeric: tabular-nums;
  padding: 11px 12px;
}
.sfl-input select { font-family: var(--sfl-font); font-weight: 500; font-size: 14px; cursor: pointer; 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 12 12'%3E%3Cpath d='M3 4.5l3 3 3-3' fill='none' stroke='%235F6B78' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; padding-right: 30px; }
.sfl-input select option { color: #0D1B2A; background: #fff; }
.sfl-input__affix { font: 500 13px/1 var(--sfl-mono); color: var(--sfl-muted); padding: 0 12px; white-space: nowrap; }
.sfl-input__affix:first-child { padding-right: 0; }
.sfl-input__affix:last-child { padding-left: 0; }
.sfl-input--split { display: grid; grid-template-columns: minmax(0, 1fr) auto; }
.sfl-input--split select { border-left: 1px solid var(--sfl-line); max-width: 150px; }
.sfl-help { font-size: 12.5px; color: var(--sfl-muted); line-height: 1.45; }
.sfl-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.sfl-row > .sfl-field + .sfl-field { margin-top: 0; }

/* Controle segmentado */
.sfl-seg { display: inline-flex; padding: 3px; gap: 2px; background: var(--sfl-surface-2); border: 1px solid var(--sfl-line); border-radius: 999px; }
.sfl-seg button {
  border: 0; background: transparent; color: var(--sfl-ink-2); cursor: pointer;
  font: 500 13px/1 var(--sfl-font); padding: 8px 14px; border-radius: 999px; min-height: 32px;
}
.sfl-seg button:hover { color: var(--sfl-ink); }
.sfl-seg button[aria-pressed="true"], .sfl-seg button[aria-selected="true"] { background: var(--sfl-surface); color: var(--sfl-ink); box-shadow: 0 0 0 1px var(--sfl-line-strong), 0 1px 2px rgba(13,27,42,.06); }
.sfl-seg--full { display: flex; width: 100%; }
.sfl-seg--full button { flex: 1; }

/* Chips de atalho */
.sfl-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.sfl-chip {
  border: 1px solid var(--sfl-line); background: transparent; color: var(--sfl-ink-2); cursor: pointer;
  font: 500 12px/1 var(--sfl-mono); padding: 7px 10px; border-radius: 999px;
}
.sfl-chip:hover { border-color: var(--sfl-ink-2); color: var(--sfl-ink); }
.sfl-chip[aria-pressed="true"] { background: var(--sfl-reagent-wash); border-color: var(--sfl-reagent); color: var(--sfl-reagent-ink); }

/* Seções recolhíveis do painel */
.sfl-fold { border-top: 1px solid var(--sfl-line); }
.sfl-fold > summary {
  list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 16px 20px; font-weight: 600; font-size: 14px;
}
.sfl-fold > summary::-webkit-details-marker { display: none; }
.sfl-fold > summary .sfl-fold__n { font-family: var(--sfl-mono); font-size: 11.5px; color: var(--sfl-muted); font-weight: 500; margin-right: 8px; }
.sfl-fold > summary::after {
  content: ""; width: 10px; height: 10px; flex: none;
  border-right: 1.5px solid var(--sfl-muted); border-bottom: 1.5px solid var(--sfl-muted);
  transform: rotate(45deg) translate(-2px, -2px); transition: transform .2s ease;
}
.sfl-fold[open] > summary::after { transform: rotate(-135deg) translate(-2px, -2px); }
.sfl-fold__body { padding: 0 20px 20px; }

/* ---------- Indicadores (stat tiles) ---------- */
.sfl-stat { display: grid; gap: 4px; }
.sfl-stat__label { font-size: 12.5px; color: var(--sfl-muted); font-weight: 500; }
.sfl-stat__value { font-size: 22px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.15; }
.sfl-stat__value--hero { font-size: clamp(30px, 3.4vw, 40px); letter-spacing: -0.03em; }
.sfl-stat__sub { font-size: 12.5px; color: var(--sfl-muted); }

/* ---------- Avisos ---------- */
.sfl-note {
  display: flex; gap: 10px; align-items: flex-start;
  font-size: 13.5px; line-height: 1.5; color: var(--sfl-ink-2);
  background: var(--sfl-surface-2); border: 1px solid var(--sfl-line); border-radius: var(--sfl-radius-sm); padding: 12px 14px;
}
.sfl-note--warn { background: var(--sfl-warn-wash); border-color: var(--sfl-warn-line); color: var(--sfl-ink); }
.sfl-note__icon { flex: none; width: 18px; height: 18px; margin-top: 1px; color: var(--sfl-warn-ink); }

/* ---------- Tabela ---------- */
.sfl-table-wrap { overflow: auto; max-height: 560px; border-top: 1px solid var(--sfl-line); -webkit-overflow-scrolling: touch; }
.sfl-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
.sfl-table th, .sfl-table td { padding: 9px 14px; text-align: right; white-space: nowrap; border-bottom: 1px solid var(--sfl-line); }
.sfl-table th:first-child, .sfl-table td:first-child { text-align: left; position: sticky; left: 0; background: var(--sfl-surface); }
.sfl-table thead th {
  position: sticky; top: 0; z-index: 2; background: var(--sfl-surface);
  font: 500 11.5px/1.2 var(--sfl-font); color: var(--sfl-muted); text-transform: uppercase; letter-spacing: .05em;
  box-shadow: inset 0 -1px 0 var(--sfl-line-strong);
}
.sfl-table thead th:first-child { z-index: 3; }
.sfl-table td { font-family: var(--sfl-mono); font-variant-numeric: tabular-nums; color: var(--sfl-ink); }
.sfl-table td.is-muted { color: var(--sfl-muted); }
.sfl-table tbody tr:hover td { background: var(--sfl-surface-2); }
.sfl-table tfoot td { font-weight: 500; background: var(--sfl-surface-2); position: sticky; bottom: 0; border-top: 1px solid var(--sfl-line-strong); }

/* ---------- Gráficos (SFLChart) ---------- */
.sfl-chart { position: relative; width: 100%; height: 300px; touch-action: pan-y; }
.sfl-chart svg { overflow: visible; }
.sfl-chart .grid line { stroke: var(--sfl-line); stroke-width: 1; shape-rendering: crispEdges; }
.sfl-chart .axis text { fill: var(--sfl-muted); font: 400 11px var(--sfl-mono); font-variant-numeric: tabular-nums; }
.sfl-chart .baseline { stroke: var(--sfl-line-strong); stroke-width: 1; shape-rendering: crispEdges; }
.sfl-chart .series path.line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.sfl-chart .series path.area { stroke: none; opacity: .1; }
.sfl-chart .crosshair { stroke: var(--sfl-ink-2); stroke-width: 1; opacity: .5; shape-rendering: crispEdges; }
.sfl-chart .dot { stroke: var(--sfl-surface); stroke-width: 2; }
.sfl-chart .end-label { fill: var(--sfl-ink-2); font: 500 11.5px var(--sfl-mono); }
.sfl-tooltip {
  position: absolute; pointer-events: none; z-index: 5; min-width: 180px;
  background: var(--sfl-surface); color: var(--sfl-ink);
  border: 1px solid var(--sfl-line-strong); border-radius: var(--sfl-radius-sm);
  box-shadow: 0 8px 28px -6px rgba(13,27,42,.22);
  padding: 10px 12px; font-size: 12.5px; opacity: 0; transform: translateY(4px); transition: opacity .12s ease, transform .12s ease;
}
.sfl-tooltip.is-on { opacity: 1; transform: none; }
.sfl-tooltip__title { font: 500 11.5px var(--sfl-mono); color: var(--sfl-muted); margin-bottom: 6px; text-transform: uppercase; letter-spacing: .04em; }
.sfl-tooltip__row { display: grid; grid-template-columns: 14px 1fr auto; align-items: center; gap: 8px; padding: 2px 0; }
.sfl-tooltip__key { width: 14px; height: 2px; border-radius: 2px; }
.sfl-tooltip__name { color: var(--sfl-ink-2); }
.sfl-tooltip__val { font: 600 13px var(--sfl-mono); font-variant-numeric: tabular-nums; }
.sfl-legend { display: flex; flex-wrap: wrap; gap: 16px; font-size: 13px; color: var(--sfl-ink-2); }
.sfl-legend__item { display: inline-flex; align-items: center; gap: 8px; }
.sfl-legend__key { width: 16px; height: 2px; border-radius: 2px; }

/* ---------- Seções e prosa ---------- */
.sfl-section { padding: clamp(40px, 6vw, 72px) 0; }
.sfl-section__head { display: grid; gap: 8px; margin-bottom: 24px; }
.sfl-prose { max-width: 72ch; min-width: 0; color: var(--sfl-ink-2); }
.sfl-prose p + p, .sfl-prose p + ul, .sfl-prose ul + p { margin-top: 12px; }
.sfl-prose h3 { color: var(--sfl-ink); margin: 24px 0 8px; }
.sfl-prose code, .sfl-formula {
  font-family: var(--sfl-mono); font-size: .92em; background: var(--sfl-surface-2);
  border: 1px solid var(--sfl-line); border-radius: 6px; padding: 1px 6px; color: var(--sfl-ink);
}
.sfl-formula { display: block; padding: 10px 14px; margin: 10px 0; overflow-x: auto; white-space: nowrap; }
.sfl-faq details { border-bottom: 1px solid var(--sfl-line); }
.sfl-faq summary { cursor: pointer; padding: 16px 0; font-weight: 600; list-style: none; display: flex; justify-content: space-between; gap: 16px; }
.sfl-faq summary::-webkit-details-marker { display: none; }
.sfl-faq summary::after { content: "+"; font: 400 20px/1 var(--sfl-mono); color: var(--sfl-muted); }
.sfl-faq details[open] summary::after { content: "–"; }
.sfl-faq details > div { padding: 0 0 18px; color: var(--sfl-ink-2); max-width: 72ch; }

/* ---------- Rodapé ---------- */
.sfl-footer { border-top: 1px solid var(--sfl-line); padding: 36px 0 44px; margin-top: 40px; font-size: 13.5px; color: var(--sfl-muted); }
.sfl-footer__grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 24px; align-items: start; }
.sfl-footer .sfl-logo { height: 22px; margin-bottom: 12px; }
.sfl-footer__links { display: flex; flex-wrap: wrap; gap: 6px 18px; justify-content: flex-end; }
.sfl-footer__links a { color: var(--sfl-ink-2); text-decoration: none; }
.sfl-footer__links a:hover { color: var(--sfl-ink); text-decoration: underline; }
.sfl-footer__legal { margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--sfl-line); font-size: 12.5px; line-height: 1.55; }
@media (max-width: 720px) {
  .sfl-footer__grid { grid-template-columns: 1fr; }
  .sfl-footer__links { justify-content: flex-start; }
}

/* ---------- Toast ---------- */
.sfl-toast {
  position: fixed; left: 50%; bottom: 24px; z-index: 90; transform: translate(-50%, 16px); opacity: 0; pointer-events: none;
  background: var(--sfl-btn-bg); color: var(--sfl-btn-fg); padding: 10px 16px; border-radius: 999px; font-size: 14px; font-weight: 500;
  transition: opacity .2s ease, transform .2s ease; box-shadow: 0 10px 30px -10px rgba(0,0,0,.4);
}
.sfl-toast.is-on { opacity: 1; transform: translate(-50%, 0); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
[id] { scroll-margin-top: 80px; }

/* ---------- Interruptor (checkbox) ---------- */
.sfl-switch { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; font-size: 13.5px; color: var(--sfl-ink-2); line-height: 1.4; }
.sfl-switch input {
  -webkit-appearance: none; appearance: none; flex: none; margin: 0; cursor: pointer;
  width: 36px; height: 20px; border-radius: 999px; background: var(--sfl-line-strong); position: relative; transition: background-color .15s ease;
}
.sfl-switch input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .25); transition: transform .15s ease; }
.sfl-switch input:checked { background: var(--sfl-reagent); }
.sfl-switch input:checked::after { transform: translateX(16px); }
.sfl-switch input:focus-visible { box-shadow: var(--sfl-focus); }
.sfl-field + .sfl-switch, .sfl-switch + .sfl-field, .sfl-switch + .sfl-switch { margin-top: 14px; }

/* ---------- Link para outro simulador ---------- */
.sfl-crosslink { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 20px; text-decoration: none; color: inherit; }
.sfl-crosslink:hover { border-color: var(--sfl-ink-2); }
.sfl-crosslink strong { display: block; font-size: 15px; color: var(--sfl-ink); margin-top: 4px; }
.sfl-crosslink span.sfl-crosslink__go { color: var(--sfl-reagent-ink); font-weight: 500; font-size: 14px; white-space: nowrap; }
.sfl-field + .sfl-row, .sfl-row + .sfl-field, .sfl-row + .sfl-row { margin-top: 14px; }
