/* LUCY layout and controls. The site theme overrides the app palette below. */
:root {
  color-scheme: light;
  --font: ui-rounded, "SF Pro Rounded", "Nunito", "Varela Round", "Segoe UI Variable Display", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --bg: #eef2f8;
  --bg-glow-1: rgba(90, 150, 255, 0.30);
  --bg-glow-2: rgba(255, 190, 140, 0.26);
  --bg-glow-3: rgba(140, 220, 200, 0.22);
  --pane: rgba(255, 255, 255, 0.66);
  --pane-strong: rgba(255, 255, 255, 0.86);
  --pane-border: rgba(255, 255, 255, 0.85);
  --hairline: rgba(20, 30, 50, 0.12);
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.06), 0 8px 28px rgba(16, 24, 40, 0.08);
  --text: #12161f;
  --text-2: #3d4452;
  --text-3: #4f5563;
  --accent: #0752b5;
  --accent-ink: #ffffff;
  --accent-soft: rgba(10, 102, 216, 0.12);
  --focus: #0752b5;
  --field: rgba(255, 255, 255, 0.92);
  --field-border: rgba(20, 30, 50, 0.22);
  --ok: #096b36;
  --warn: #7a4900;
  --warn-bg: rgba(237, 161, 0, 0.14);
  --bad: #a8221b;
  --bad-bg: rgba(227, 73, 72, 0.12);
  --help-bg: rgba(10, 102, 216, 0.08);
  /* chart roles (reference categorical palette, validated light) */
  --surface-1: #fcfcfb;
  --grid: rgba(20, 30, 50, 0.10);
  --series-1: #2a78d6; --series-2: #eb6834; --series-3: #1baf7a; --series-4: #eda100;
  --series-5: #e87ba4; --series-6: #008300; --series-7: #6250d6; --series-8: #e34948;
  --neutral-mark: #9aa1ad;
  --band: rgba(42, 120, 214, 0.18);
  --radius: 22px;
  --radius-s: 14px;
  --gutter: 16px;
}
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --bg: #0d1117;
    --bg-glow-1: rgba(57, 135, 229, 0.30);
    --bg-glow-2: rgba(217, 89, 38, 0.16);
    --bg-glow-3: rgba(25, 158, 112, 0.16);
    --pane: rgba(30, 34, 44, 0.62);
    --pane-strong: rgba(34, 38, 50, 0.90);
    --pane-border: rgba(255, 255, 255, 0.10);
    --hairline: rgba(255, 255, 255, 0.12);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 10px 30px rgba(0, 0, 0, 0.35);
    --text: #f0f2f6;
    --text-2: #c9ced8;
    --text-3: #a7aebb;
    --accent: #5aa6ff;
    --accent-ink: #06121f;
    --accent-soft: rgba(90, 166, 255, 0.16);
    --focus: #8cc2ff;
    --field: rgba(16, 20, 28, 0.78);
    --field-border: rgba(255, 255, 255, 0.24);
    --ok: #5fd38d;
    --warn: #f3c060;
    --warn-bg: rgba(201, 133, 0, 0.18);
    --bad: #ff8a80;
    --bad-bg: rgba(230, 103, 103, 0.16);
    --help-bg: rgba(90, 166, 255, 0.10);
    --surface-1: #1a1a19;
    --grid: rgba(255, 255, 255, 0.10);
    --series-1: #3987e5; --series-2: #d95926; --series-3: #199e70; --series-4: #c98500;
    --series-5: #d55181; --series-6: #0ca30c; --series-7: #9085e9; --series-8: #e66767;
    --neutral-mark: #7d8594;
    --band: rgba(57, 135, 229, 0.24);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0d1117;
  --bg-glow-1: rgba(57, 135, 229, 0.30);
  --bg-glow-2: rgba(217, 89, 38, 0.16);
  --bg-glow-3: rgba(25, 158, 112, 0.16);
  --pane: rgba(30, 34, 44, 0.62);
  --pane-strong: rgba(34, 38, 50, 0.90);
  --pane-border: rgba(255, 255, 255, 0.10);
  --hairline: rgba(255, 255, 255, 0.12);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 10px 30px rgba(0, 0, 0, 0.35);
  --text: #f0f2f6;
  --text-2: #c9ced8;
  --text-3: #a7aebb;
  --accent: #5aa6ff;
  --accent-ink: #06121f;
  --accent-soft: rgba(90, 166, 255, 0.16);
  --focus: #8cc2ff;
  --field: rgba(16, 20, 28, 0.78);
  --field-border: rgba(255, 255, 255, 0.24);
  --ok: #5fd38d;
  --warn: #f3c060;
  --warn-bg: rgba(201, 133, 0, 0.18);
  --bad: #ff8a80;
  --bad-bg: rgba(230, 103, 103, 0.16);
  --help-bg: rgba(90, 166, 255, 0.10);
  --surface-1: #1a1a19;
  --grid: rgba(255, 255, 255, 0.10);
  --series-1: #3987e5; --series-2: #d95926; --series-3: #199e70; --series-4: #c98500;
  --series-5: #d55181; --series-6: #0ca30c; --series-7: #9085e9; --series-8: #e66767;
  --neutral-mark: #7d8594;
  --band: rgba(57, 135, 229, 0.24);
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; font-family: var(--font); font-size: 17px; line-height: 1.55; color: var(--text);
  background-color: var(--bg);
  background-image:
    radial-gradient(60vmax 50vmax at 8% -10%, var(--bg-glow-1), transparent 60%),
    radial-gradient(50vmax 45vmax at 105% 15%, var(--bg-glow-2), transparent 60%),
    radial-gradient(60vmax 50vmax at 40% 115%, var(--bg-glow-3), transparent 60%);
  background-attachment: fixed;
  overflow-x: hidden;
}
img, svg { max-width: 100%; }
a { color: var(--accent); text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }
h1, h2, h3, h4 { line-height: 1.22; margin: 0 0 .5em; letter-spacing: -0.01em; }
h1 { font-size: clamp(1.7rem, 5.4vw, 2.5rem); font-weight: 750; }
h2 { font-size: clamp(1.3rem, 3.8vw, 1.7rem); font-weight: 700; }
h3 { font-size: 1.12rem; font-weight: 700; }
p { margin: 0 0 .8em; }
small, .small { font-size: .9rem; }
.muted { color: var(--text-2); }
.num { font-variant-numeric: tabular-nums; }
.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; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 8px; }
/* the file input is hidden; its label is the button the person sees, so the label shows the focus (WCAG 2.4.7) */
.file-input:focus-visible + label.btn, .file-input:focus + label.btn { outline: 3px solid var(--focus); outline-offset: 2px; }
#date-banner { margin-top: 10px; }
.todo { font-weight: 650; color: var(--bad); background: var(--bad-bg); border: 1px dashed var(--bad); border-radius: 6px; padding: 0 4px; -webkit-box-decoration-break: clone; box-decoration-break: clone; }
.draft-badge { font-size: .55em; vertical-align: middle; letter-spacing: .04em; }
#date-banner .row { margin-top: 8px; gap: 8px; flex-wrap: wrap; }
.skip { position: absolute; left: var(--gutter); top: -60px; z-index: 50; background: var(--accent); color: var(--accent-ink); padding: 10px 14px; border-radius: 12px; }
.skip:focus { top: 10px; }

/* layout */
.wrap { width: 100%; max-width: 920px; margin: 0 auto; padding: 0 var(--gutter); }
.topbar { position: sticky; top: 0; z-index: 20; padding: 10px 0; }
.topbar .wrap { display: flex; align-items: center; gap: 12px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); font-weight: 750; min-width: 0; }
.brand img { width: 38px; height: 38px; border-radius: 50%; border: 2px solid var(--pane-border); box-shadow: var(--shadow); flex: none; }
.brand span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand small { display: block; font-weight: 500; color: var(--text-2); font-size: .8rem; }
.topnav { margin-left: auto; display: flex; gap: 6px; align-items: center; }
.topnav a { text-decoration: none; color: var(--text); padding: 8px 12px; border-radius: 999px; font-weight: 600; font-size: .95rem; }
.topnav a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); }
.glass {
  background: var(--pane); border: 1px solid var(--pane-border); border-radius: var(--radius); box-shadow: var(--shadow);
  -webkit-backdrop-filter: blur(22px) saturate(170%); backdrop-filter: blur(22px) saturate(170%);
}
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) { .glass { background: var(--pane-strong); } }
.bar { padding: 8px 10px; border-radius: 999px; }
.pane { padding: 20px; margin: 0 0 16px; }
.pane > :last-child { margin-bottom: 0; }
main { padding-bottom: 32px; }
section[hidden] { display: none !important; }
.grid2 { display: grid; gap: 16px; grid-template-columns: 1fr; }
@media (min-width: 860px) { .grid2 { grid-template-columns: 1fr 1fr; } .pane { padding: 26px; } }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.stack > * + * { margin-top: 12px; }

/* stepper */
.stepper { list-style: none; margin: 8px 0 16px; padding: 6px; display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; }
.stepper a { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 2px; border-radius: 14px; text-decoration: none; color: var(--text-2); font-size: .78rem; font-weight: 600; text-align: center; line-height: 1.2; }
.stepper a b { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--hairline); font-size: .9rem; color: var(--text); }
.stepper a[aria-current="step"] { color: var(--accent); background: var(--accent-soft); }
.stepper a[aria-current="step"] b { border-color: var(--accent); background: var(--accent); color: var(--accent-ink); }
.stepper a.done b { border-color: var(--accent); }
@media (min-width: 600px) { .stepper a { flex-direction: row; justify-content: center; font-size: .9rem; gap: 8px; } }

/* buttons and fields */
button, .btn { font: inherit; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 10px 18px;
  border-radius: 999px; border: 1px solid var(--field-border); background: var(--pane-strong); color: var(--text);
  font-weight: 650; cursor: pointer; text-decoration: none; line-height: 1.2; text-align: center;
}
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.btn.primary:hover { filter: brightness(1.06); }
.btn.quiet { background: transparent; border-color: transparent; color: var(--accent); padding-left: 10px; padding-right: 10px; }
.btn.danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 45%, transparent); }
.btn.small { min-height: 38px; padding: 6px 14px; font-size: .92rem; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .55; cursor: not-allowed; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.actions.end { justify-content: space-between; }

.field { display: block; margin: 0 0 14px; }
.field > span, .field > legend, .label { display: block; font-weight: 650; margin-bottom: 6px; }
.field .hint, .hint { display: block; font-size: .9rem; color: var(--text-2); margin-top: 4px; }
input[type="text"], input[type="number"], input[type="date"], input[type="search"], select, textarea {
  font: inherit; width: 100%; min-height: 48px; padding: 10px 14px; border-radius: var(--radius-s);
  border: 1px solid var(--field-border); background: var(--field); color: var(--text);
}
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid var(--focus); outline-offset: 1px; }
input[aria-invalid="true"], select[aria-invalid="true"] { border-color: var(--bad); box-shadow: 0 0 0 1px var(--bad); }
.err { display: block; color: var(--bad); font-weight: 600; font-size: .92rem; margin-top: 4px; }
.err:empty { display: none; }
.money { position: relative; }
.money::before { content: "R$"; position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--text-2); font-weight: 600; pointer-events: none; }
.money input { padding-left: 44px; }
.suffix { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; }
.two { display: grid; gap: 0 12px; grid-template-columns: 1fr; }
@media (min-width: 560px) { .two { grid-template-columns: 1fr 1fr; } }
fieldset { border: 0; padding: 0; margin: 0 0 14px; min-width: 0; }
.check { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: var(--radius-s); border: 1px solid var(--hairline); background: var(--field); cursor: pointer; }
.check input { width: 22px; height: 22px; margin: 2px 0 0; flex: none; accent-color: var(--accent); }
.check.strong { border-color: var(--accent); background: var(--accent-soft); }
.choices { display: grid; gap: 8px; grid-template-columns: 1fr; }
@media (min-width: 640px) { .choices.cols { grid-template-columns: 1fr 1fr; } }
.choice { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: var(--radius-s); border: 1px solid var(--hairline); background: var(--field); cursor: pointer; }
.choice input { width: 20px; height: 20px; margin: 3px 0 0; flex: none; accent-color: var(--accent); }
.choice:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.choice b { display: block; }
.choice span { color: var(--text-2); font-size: .92rem; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; min-height: 40px; border-radius: 999px; border: 1px solid var(--field-border); background: var(--field); cursor: pointer; font-size: .92rem; }
.chip input { accent-color: var(--accent); width: 18px; height: 18px; margin: 0; }
.chip:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); color: var(--text); }
details.more { margin: 6px 0 14px; }
details > summary { cursor: pointer; font-weight: 650; color: var(--accent); padding: 8px 0; list-style-position: outside; }
details[open] > summary { margin-bottom: 8px; }

/* cards, lists */
.card { padding: 16px; border-radius: var(--radius-s); border: 1px solid var(--hairline); background: var(--pane-strong); margin-bottom: 10px; }
.card h3 { margin-bottom: 4px; }
.card .meta { color: var(--text-2); font-size: .93rem; }
.card .row { margin-top: 8px; }
.empty { padding: 18px; border: 2px dashed var(--hairline); border-radius: var(--radius-s); color: var(--text-2); text-align: center; }
.tag { display: inline-flex; align-items: center; gap: 6px; font-size: .8rem; font-weight: 700; padding: 3px 10px; border-radius: 999px; border: 1px solid var(--hairline); background: var(--field); color: var(--text-2); white-space: nowrap; }
.tag.exact::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--text); }
.tag.estimate::before { content: ""; width: 9px; height: 9px; border-radius: 50%; border: 2px solid var(--text); background: linear-gradient(90deg, var(--text) 50%, transparent 50%); }
.tag.level-urgente { color: var(--bad); border-color: currentColor; }
.tag.level-atencao { color: var(--warn); border-color: currentColor; }
.tag.level-info { color: var(--accent); border-color: currentColor; }
.note { padding: 14px 16px; border-radius: var(--radius-s); background: var(--help-bg); border: 1px solid var(--hairline); }
.note.warn { background: var(--warn-bg); }
.note.bad { background: var(--bad-bg); }
.disclaimer { font-size: 1rem; color: var(--text); padding: 14px 16px; border-radius: var(--radius-s); border: 1px solid var(--hairline); background: var(--pane-strong); }
.lucy-says { display: grid; grid-template-columns: 52px 1fr; gap: 12px; align-items: start; }
.lucy-says img { width: 52px; height: 52px; border-radius: 50%; border: 2px solid var(--pane-border); }
.lucy-says p:last-child { margin-bottom: 0; }

/* the person's help and the distress box: always first, never decorative */
.helpfirst { border: 2px solid var(--accent); }
.helpfirst h2 { margin-bottom: 8px; }
.helpfirst ol { padding-left: 1.3em; margin: 0; }
.helpfirst li { margin-bottom: 8px; }
/* shown above everything, wherever the person is on the page (s.17.2): fixed at the top of the screen, not in the flow */
.distress { position: fixed; top: max(10px, env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); width: min(888px, calc(100vw - 2 * var(--gutter)));
  max-height: calc(100vh - 20px); max-height: calc(100dvh - 20px); overflow-y: auto; z-index: 65; margin: 0; border: 2px solid var(--accent); background: var(--pane-strong); box-shadow: var(--shadow); }
.distress[hidden] { display: none; }
.distress.small { position: static; transform: none; width: auto; max-height: none; box-shadow: none; z-index: auto; font-size: .95rem; }
.distress p { font-size: 1.08rem; font-weight: 650; }

/* result */
.hero { display: grid; gap: 16px; }
.hero .big { font-size: clamp(1.7rem, 6vw, 2.4rem); font-weight: 800; line-height: 1.1; letter-spacing: -0.02em; }
.stat { padding: 14px 16px; border-radius: var(--radius-s); background: var(--pane-strong); border: 1px solid var(--hairline); }
.stat .label { font-weight: 650; color: var(--text-2); font-size: .92rem; margin-bottom: 4px; }
.stat .value { font-size: 1.35rem; font-weight: 780; font-variant-numeric: tabular-nums; }
.stat .sub { color: var(--text-2); font-size: .92rem; }
.stats { display: grid; gap: 10px; grid-template-columns: 1fr; }
@media (min-width: 560px) { .stats { grid-template-columns: 1fr 1fr; } }
.week { counter-reset: w; list-style: none; padding: 0; margin: 0; }
.week > li { counter-increment: w; position: relative; padding: 10px 0 10px 44px; border-bottom: 1px solid var(--hairline); }
.week > li:last-child { border-bottom: 0; }
.week .note-line { display: block; margin-top: 6px; color: var(--text-2); }
.week > li::before { content: counter(w); position: absolute; left: 0; top: 9px; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); font-weight: 800; }
.jump { display: flex; gap: 6px; overflow-x: auto; padding: 6px; margin: 0 0 16px; scrollbar-width: none; }
.jump a { flex: none; text-decoration: none; padding: 7px 12px; border-radius: 999px; color: var(--text); font-weight: 600; font-size: .9rem; }
.jump a:hover { background: var(--accent-soft); }
.scroll-x { overflow-x: auto; -webkit-overflow-scrolling: touch; max-width: 100%; border-radius: var(--radius-s); border: 1px solid var(--hairline); }
table { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; font-size: .93rem; }
th, td { padding: 8px 10px; text-align: right; border-bottom: 1px solid var(--hairline); white-space: nowrap; }
th:first-child, td:first-child { text-align: left; }
thead th { position: sticky; top: 0; background: var(--pane-strong); font-weight: 700; }
tbody tr:nth-child(even) td, tbody tr:nth-child(even) th { background: color-mix(in srgb, var(--text) 3%, transparent); }
td.bad { color: var(--bad); font-weight: 700; }
caption { text-align: left; padding: 8px 10px; color: var(--text-2); font-size: .9rem; }
.letter { white-space: pre-wrap; font-family: var(--font); background: var(--field); border: 1px solid var(--hairline); border-radius: var(--radius-s); padding: 16px; font-size: .98rem; }
.progress { height: 10px; border-radius: 999px; background: var(--hairline); overflow: hidden; }
.progress > i { display: block; height: 100%; width: 0; background: var(--accent); border-radius: 999px; transition: width .2s; }
.sources { margin: 6px 0 0; padding-left: 1.1em; font-size: .9rem; color: var(--text-2); }
.finding { padding: 14px 0; border-bottom: 1px solid var(--hairline); }
.finding:last-child { border-bottom: 0; }

/* charts */
figure.chart { margin: 0; }
figure.chart figcaption { margin-bottom: 8px; }
.plot { position: relative; background: var(--surface-1); border-radius: var(--radius-s); border: 1px solid var(--hairline); padding: 8px 4px 4px; touch-action: pan-y; }
.plot:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.plot svg { display: block; width: 100%; height: auto; overflow: visible; }
.axis text, .lbl { fill: var(--text-2); font-size: 11px; font-family: var(--font); }
.axis line, .gridline { stroke: var(--grid); stroke-width: 1; }
.baseline { stroke: var(--text-3); stroke-width: 1; }
.cross { stroke: var(--text); stroke-width: 1; stroke-dasharray: 3 3; }
.s1 { fill: var(--series-1); stroke: var(--series-1); } .s2 { fill: var(--series-2); stroke: var(--series-2); }
.s3 { fill: var(--series-3); stroke: var(--series-3); } .s4 { fill: var(--series-4); stroke: var(--series-4); }
.s5 { fill: var(--series-5); stroke: var(--series-5); } .s6 { fill: var(--series-6); stroke: var(--series-6); }
.s7 { fill: var(--series-7); stroke: var(--series-7); } .s8 { fill: var(--series-8); stroke: var(--series-8); }
.s0 { fill: var(--neutral-mark); stroke: var(--neutral-mark); }
.area { stroke: var(--surface-1); stroke-width: 1.5; }
.line { fill: none; stroke-width: 2.25; stroke-linejoin: round; stroke-linecap: round; }
.line.dash { stroke-dasharray: 6 5; }
.ink { fill: none; stroke: var(--text); }
.inkfill { fill: var(--text); }
.band { fill: var(--band); stroke: none; }
.barmark { stroke: var(--surface-1); stroke-width: 2; }
.dot { stroke: var(--surface-1); stroke-width: 2; }
.dot.faint { opacity: .45; }
.hit { fill: transparent; stroke: none; cursor: crosshair; }
.tip { position: absolute; pointer-events: none; z-index: 5; min-width: 150px; max-width: min(280px, 80vw); padding: 10px 12px; border-radius: 12px; background: var(--pane-strong); border: 1px solid var(--hairline); box-shadow: var(--shadow); font-size: .86rem; line-height: 1.35; color: var(--text); }
.tip[hidden] { display: none; }
.tip b { display: block; margin-bottom: 4px; }
.tip .r { display: flex; justify-content: space-between; gap: 12px; font-variant-numeric: tabular-nums; }
.tip .sw, .legend .sw { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 8px 2px 4px; padding: 0; list-style: none; font-size: .88rem; color: var(--text-2); }
.legend .sw.dashline { width: 18px; height: 0; border-top: 2px dashed var(--text); border-radius: 0; vertical-align: 3px; }
.legend .sw.bandsw { background: var(--band); }
.legend .sw.ln { height: 3px; width: 18px; vertical-align: 3px; }
.sw.c1 { background: var(--series-1); } .sw.c2 { background: var(--series-2); } .sw.c3 { background: var(--series-3); } .sw.c4 { background: var(--series-4); }
.sw.c5 { background: var(--series-5); } .sw.c6 { background: var(--series-6); } .sw.c7 { background: var(--series-7); } .sw.c8 { background: var(--series-8); }
.sw.c0 { background: var(--neutral-mark); } .sw.ink { background: var(--text); }
.chart-controls { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 8px; }
.seg { display: inline-flex; padding: 3px; border-radius: 999px; background: var(--field); border: 1px solid var(--hairline); }
.seg button { font: inherit; font-size: .9rem; font-weight: 650; border: 0; background: transparent; color: var(--text-2); padding: 6px 12px; border-radius: 999px; cursor: pointer; min-height: 36px; }
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }
input[type="range"] { width: 100%; accent-color: var(--accent); min-height: 32px; }

/* glossary */
.term { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: help; border-bottom: 2px dotted var(--accent); line-height: inherit; text-align: inherit; }
.term:hover { color: var(--accent); }
#term-pop { position: fixed; z-index: 60; max-width: 340px; padding: 14px 16px; border-radius: 16px; background: var(--pane-strong); border: 1px solid var(--hairline); box-shadow: var(--shadow); font-size: .95rem; }
#term-pop[hidden] { display: none; }
#term-pop b { display: block; margin-bottom: 4px; }
@media (max-width: 599px) { #term-pop { left: var(--gutter) !important; right: var(--gutter) !important; bottom: var(--gutter) !important; top: auto !important; max-width: none; } }

/* footer */
.foot { padding: 24px var(--gutter) 40px; font-size: .95rem; color: var(--text-2); }
.foot .disclaimer { margin-bottom: 12px; }
.foot p { margin-bottom: .5em; }

dialog { border: 1px solid var(--hairline); border-radius: var(--radius); background: var(--pane-strong); color: var(--text); padding: 22px; max-width: min(460px, calc(100vw - 32px)); box-shadow: var(--shadow); -webkit-backdrop-filter: blur(28px) saturate(1.2); backdrop-filter: blur(28px) saturate(1.2); }
dialog::backdrop { background: rgba(0, 0, 0, .35); }
.toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 70; padding: 12px 18px; border-radius: 18px; width: max-content; -webkit-backdrop-filter: blur(28px); backdrop-filter: blur(28px); background: var(--pane-strong); border: 1px solid var(--hairline); box-shadow: var(--shadow); max-width: calc(100vw - 32px); }
.toast[hidden] { display: none; }

/* Models page */
.model { scroll-margin-top: 80px; }
.model .part { margin: 18px 0 0; }
.model .part > h3 { display: flex; align-items: center; gap: 8px; }
.model .part > h3::before { content: attr(data-n); display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-size: .85rem; flex: none; }
.controls { display: grid; gap: 8px 16px; grid-template-columns: 1fr; margin-bottom: 10px; }
@media (min-width: 640px) { .controls { grid-template-columns: 1fr 1fr; } }
.controls label { font-weight: 600; font-size: .95rem; }
.controls output { font-weight: 750; font-variant-numeric: tabular-nums; float: right; }
.toc { display: flex; flex-wrap: wrap; gap: 8px; }
.kbd { font-family: var(--mono); font-size: .85em; padding: 1px 6px; border-radius: 6px; border: 1px solid var(--hairline); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
@media (forced-colors: active) {
  .term { border-bottom-color: LinkText; }
  .glass { border: 1px solid CanvasText; }
}

/* print: the plan, the disclaimer and the letters on paper */
@media print {
  :root { color-scheme: light; --text: #000; --text-2: #222; --text-3: #333; --pane: #fff; --pane-strong: #fff; --field: #fff; --hairline: #999; --surface-1: #fff; --accent: #0a4fa8; --bg: #fff; }
  body { background: #fff !important; font-size: 11.5pt; }
  .topbar, .stepper, .jump, .actions, .no-print, .skip, #term-pop, .chart-controls, .toast, .tip, button.btn { display: none !important; }
  .glass { box-shadow: none; -webkit-backdrop-filter: none; backdrop-filter: none; border: 1px solid #bbb; background: #fff; }
  section[data-view]:not([data-view="plano"]) { display: none !important; }
  section[data-view="plano"] { display: block !important; }
  .pane { break-inside: avoid-page; }
  .letter-block { break-before: page; }
  .scroll-x { overflow: visible; border: 0; }
  thead th { position: static; }
  a { color: #000; }
  details > summary { display: none; }
  details > * { display: block; }
  .term { border-bottom: 0; }
}
#print-only { display: none; }
@media print {
  body.print-one > *:not(#print-only) { display: none !important; }
  body.print-one #print-only { display: block; }
  #print-only .letter { border: 0; padding: 0; font-size: 12pt; }
}
.sw.dashline { width: 18px; height: 0; border-top: 2px dashed var(--text); border-radius: 0; vertical-align: 3px; background: none; }
.sw.ln { height: 3px; width: 18px; vertical-align: 3px; }
.sw.bandsw { background: var(--band); }

/* ------------------------------------------------------------ rights, rule cards, glossary (23/11) */
@media (max-width: 599px) {
  .topbar .bar { padding: 6px 8px; flex: 1 1 auto; min-width: 0; flex-wrap: nowrap; }
  .brand { flex: none; }
  .brand span { display: none; }
  .topnav { min-width: 0; flex: 1 1 auto; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; justify-content: flex-start;
    scroll-padding-inline: 16px; padding-inline-end: 16px;
    /* a fade on the right edge says there is more to scroll (Modelos, Tema) */
    -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 24px), transparent); mask-image: linear-gradient(to right, #000 calc(100% - 24px), transparent); }
  .topnav:focus-within { -webkit-mask-image: none; mask-image: none; }
  .topnav::-webkit-scrollbar { display: none; }
  .topnav a, .topnav .btn { flex: none; }
  .topnav a { padding: 8px 10px; }
}
.rule-card { scroll-margin-top: 80px; }
.rule-card h3, .rule-card h4 { margin-top: 6px; }
.rule-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 4px; }
.rule-chips .tag { white-space: normal; }
.rule-mark-line { display: flex; flex-wrap: wrap; gap: 8px; align-items: baseline; padding: 8px 10px; border-radius: var(--radius-s); background: var(--warn-bg); }
.rule-mark { font-weight: 800; letter-spacing: .02em; }
.rule-list { margin: 0 0 .8em; padding-left: 1.2em; }
.rule-list li { margin-bottom: 4px; }
.rule-sub { margin: 0 0 4px; }
.rule-fix { margin: 0 0 .8em; }
.rule-fix p { margin: 4px 0 0; }
.rule-dates { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px; margin: 0 0 .8em; }
.rule-dates p { margin: 0; padding: 8px 12px; border-radius: var(--radius-s); border: 1px solid var(--hairline); background: var(--field); }
.rule-dates span, .rule-dates b { display: block; }
.rule-source { overflow-wrap: anywhere; }
.rule-old { color: var(--warn); font-weight: 650; }
details.rule-ref { margin: 4px 0; }
details.rule-ref > summary { font-weight: 600; font-size: .95rem; overflow-wrap: anywhere; }
details.rule-ref > summary .tag { vertical-align: 1px; }
.dir-controls { display: grid; gap: 4px 16px; grid-template-columns: 1fr; margin-top: 12px; }
@media (min-width: 720px) { .dir-controls { grid-template-columns: 1fr 1fr; } .dir-controls .field:first-child, .dir-controls fieldset { grid-column: 1 / -1; } }
#dir-filter .btn { margin-top: 6px; }
.glossary { margin: 0; }
.glossary dt { font-weight: 750; margin-top: 14px; }
.glossary dd { margin: 2px 0 0; color: var(--text-2); }
.age-q { padding: 12px 14px; border-radius: var(--radius-s); border: 1px solid var(--hairline); background: var(--field); }
.age-q .check { margin-top: 10px; }
.old-debt { margin: 8px 0 12px; }
.old-debt h4 { font-size: 1.05rem; margin: 0 0 6px; }
.old-debt .check { margin-top: 10px; background: var(--pane-strong); }
.week .old-line { color: var(--warn); font-weight: 650; }
.guide-list { margin: 0 0 12px; padding-left: 1.3em; }
.guide-list > li { margin-bottom: 10px; }
.guide-list.take { list-style: none; padding-left: 0; }
.guide-src { display: block; margin-top: 2px; }
.guide-refs { margin-top: 2px; }
.take-item { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; }
.take-item input { width: 20px; height: 20px; margin: 2px 0 0; flex: none; accent-color: var(--accent); }
.debt-rules h4 { margin: 12px 0 4px; font-size: 1rem; }
.step-guide { margin: 6px 0 0; }
.step-guide > summary { font-size: .92rem; padding: 4px 0; }
.step-guide .guide-list { padding-left: 1.1em; }
.track-line .row { margin-top: 4px; }
.track-line p:first-child { margin-bottom: 8px; }
.follow-date { font-size: 1.05rem; }
.follow-head { margin: 12px 0 18px; }
.follow-head .progress { margin: 6px 0 10px; }
.follow-month legend { padding: 0 4px; }
.follow-month .check { margin-top: 8px; }
.follow-answers { margin-top: 18px; }
.help-now { border: 2px solid color-mix(in srgb, var(--accent) 40%, transparent); }
.help-now h2 { font-size: 1.2rem; }
.help-now ol { padding-left: 1.3em; }
.help-now ol li { margin-bottom: 8px; }
#term-pop .term-all { display: inline-block; margin-top: 8px; font-weight: 650; font-size: .9rem; }
/* fix pass 23/11: the id of a cited rule after its question; the old-debt warning apart from the letter; the rule of a meaning */
.rule-ref summary .rule-id { font-weight: 400; white-space: nowrap; }
.letter-aviso { margin: 8px 0; }
#term-pop .term-rule { display: block; margin-top: 6px; }
/* pass 2, 23/11: Negociar, Reclamar, Programas abertos, Próximos prazos */
.aviso-dono { font-size: 1rem; font-weight: 650; color: var(--text); padding: 12px 14px; border-radius: var(--radius-s); border: 2px solid var(--warn); background: var(--warn-bg); margin: 10px 0 14px; }
.aviso-dono.small-gap { margin: 6px 0 10px; }
.neg-debt h4 { margin: 14px 0 6px; }
.neg-ladder-box { margin: 10px 0 12px; }
.neg-ladder { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; counter-reset: degrau; }
.neg-ladder li { counter-increment: degrau; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 12px; align-items: baseline; padding: 10px 14px; border-radius: var(--radius-s); background: var(--field); border: 1px solid var(--hairline); }
.neg-ladder li::before { content: counter(degrau) "."; font-weight: 800; color: var(--accent); margin-right: 4px; }
.neg-ladder li:last-child { border-color: var(--accent); }
.neg-step { flex: 1 1 auto; font-weight: 650; }
.neg-val { font-size: 1.2rem; font-variant-numeric: tabular-nums; }
.neg-stats { margin: 8px 0; }
.neg-corners { display: grid; gap: 10px; grid-template-columns: 1fr; margin-bottom: 6px; }
@media (min-width: 720px) { .neg-corners { grid-template-columns: 1fr 1fr 1fr; } .neg-stats { grid-template-columns: 1fr 1fr 1fr; } }
.neg-lines { padding-left: 1.2em; margin: 0 0 8px; }
.neg-lines li { margin-bottom: 6px; }
.neg-c2 { margin: 0; }
.neg-sup th, .neg-sup td { vertical-align: top; }
.neg-sup-in { min-width: 4.5em; }
.neg-how li { margin-bottom: 8px; }
.prazos h2 { font-size: 1.15rem; }
.prazos-lista { padding-left: 1.2em; margin: 0 0 8px; }
.prazos-lista li { margin-bottom: 6px; }
.prazos-lista li.urgente b, .prog-prazo.urgente b { color: var(--bad); }
.prog-card h4 { margin: 0 0 4px; font-size: 1.05rem; }
.prog-card .meta .tag { white-space: normal; }
.prog-balde { margin-top: 16px; }
.prog-set legend { font-weight: 650; margin-bottom: 6px; }
.prog-checks { display: flex; flex-wrap: wrap; gap: 8px; }
.prog-checks .check { padding: 8px 12px; }
.prog-golpes { margin-top: 18px; }
.prog-golpes li { margin-bottom: 6px; }
.rec-fatos { padding-left: 1.2em; }
.rec-fatos > li { margin-bottom: 10px; }
.rec-fato.rec-publico > span { font-weight: 700; }
.rec-rules { list-style: none; padding-left: 0; margin: 4px 0 0; color: var(--text-2); }
.rec-rules li { margin-bottom: 4px; overflow-wrap: anywhere; }
.rec-rules details { margin: 2px 0 0; }
.rec-steps { list-style: none; padding: 0; margin: 0; }
.rec-step h4 { margin: 0 0 2px; font-size: 1.08rem; }
.rec-letter .label .tag { margin-left: 8px; }
.rec-letter .letter { overflow-wrap: anywhere; }
.rec-sug { padding-left: 1.2em; }
.rec-sug li { margin-bottom: 8px; }
.rec-gaps .field input { width: 100%; }
.nw { white-space: nowrap; }
