/* ==========================================================================
   compras: visual de rascunho feito à mão
   Papel quadriculado, traço de grafite com linha dupla, tons pastel de lápis de cor.
   As linhas "tortas" são pseudo-elementos com border-radius assimétrico e rotação leve,
   assim o texto continua nítido. Filtros SVG (feTurbulence) foram descartados: congelavam
   a renderização do Chrome mesmo em poucos elementos.
   ========================================================================== */

@font-face { font-family: "Shantell Sans"; src: url("../fonts/shantell-sans-500.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Shantell Sans"; src: url("../fonts/shantell-sans-700.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Nunito"; src: url("../fonts/nunito-400.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Nunito"; src: url("../fonts/nunito-600.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Nunito"; src: url("../fonts/nunito-700.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Nunito"; src: url("../fonts/nunito-800.woff2") format("woff2"); font-weight: 800; font-display: swap; }

:root {
    color-scheme: light;

    /* papel e grafite */
    --paper: #f7f7f2;
    --sheet: #fffefa;
    --grid: rgba(45, 49, 66, .05);
    --ink: #2d3142;
    --ink-soft: #5c6070;
    --line: rgba(45, 49, 66, .22);

    /* lápis de cor */
    --mint: #d5efe0;
    --peach: #fadbc9;
    --lavender: #e2dbf7;
    --butter: #fbebb0;
    --sky: #d3e8f5;
    --rose: #f8d7e1;

    /* ação e estados */
    --accent: #2f6b52;
    --accent-fill: #bfe3cf;
    --accent-hatch: #a6d6bb;
    --danger: #b3261e;
    --danger-soft: #fbe0dc;
    --strike: #e0868a;

    --hand: "Shantell Sans", "Comic Neue", "Segoe Print", cursive;
    --body: "Nunito", system-ui, -apple-system, "Segoe UI", sans-serif;

    /* bordas tortas: cantos com raios diferentes nos dois eixos */
    --wobble-a: 22px 8px 26px 6px / 8px 24px 7px 20px;
    --wobble-b: 8px 26px 7px 22px / 24px 8px 20px 7px;
    --wobble-sm: 12px 5px 10px 4px / 5px 11px 4px 12px;
    --blob: 46% 54% 42% 58% / 55% 45% 55% 45%;
}

/* ---------- contrato de tokens: os componentes só usam estes nomes ----------
   Declarado também em [data-theme] para que tokens compostos (ex.: --bar-fill usa --accent-fill)
   sejam recalculados dentro de cada tema, inclusive nos cartões da home que têm tema próprio. */
:root, [data-theme] {
    --display: var(--hand);
    --display-weight: 700;
    --display-leading: 1.15;
    --display-tracking: -.01em;
    --display-case: none;
    --brand-font: var(--hand);

    --page-bg: linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px);
    --page-bg-size: 28px 28px;

    --card-radius: var(--wobble-a);
    --card-radius-2: var(--wobble-b);
    --ctl-radius: var(--wobble-sm);
    --tile-radius: var(--blob);
    --check-radius: 7px 4px 8px 5px / 5px 8px 4px 7px;
    --card-shadow: none;

    --frame-w: 2px;
    --frame-color: var(--ink);
    --tilt: .12deg;
    --double-inset: -5px -3px -3px -6px;
    --double-w: 1.5px;
    --double-style: solid;
    --double-color: var(--ink);
    --double-opacity: .5;
    --tilt-2: -.45deg;
    --double-bg: none;
    --rule-2-opacity: .25;
    --sway: 1;

    --tile-border-style: solid;
    --tile-ring: none;

    --pop: 3px 3px 0 var(--ink);
    --pop-hover: 4px 4px 0 var(--ink);
    --pop-sm: 2px 2px 0 var(--ink);
    --pop-press: 1px 1px 0 var(--ink);
    --bar-fill: repeating-linear-gradient(-45deg, var(--accent-fill) 0 5px, var(--accent-hatch) 5px 9px);
    --items-double-inset: -5px 2px -4px -5px;

    --ui-font: var(--display);
    --btn-ink: var(--ink);
    --ctl-border: 2px solid var(--ink);
    --ctl-border-thin: 1.75px solid var(--ink);
    --ctl-radius-alt: 5px 12px 4px 10px / 11px 5px 12px 4px;
    --pill-radius: 99px 80px 99px 70px / 70px 99px 80px 99px;
    --tag-radius: 10px 4px 9px 3px / 4px 9px 3px 10px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0; color: var(--ink);
    font: 400 1rem/1.6 var(--body);
    background-color: var(--paper);
    background-image: var(--page-bg);
    background-size: var(--page-bg-size);
    -webkit-tap-highlight-color: rgba(47, 107, 82, .15);
}
button, a, input, select, label { touch-action: manipulation; }
a { color: var(--accent); text-underline-offset: 3px; text-decoration-thickness: 1.5px; }
a:hover { text-decoration-style: wavy; }
h1, h2, h3 { font-family: var(--display); font-weight: var(--display-weight); line-height: var(--display-leading); margin: 0 0 .4em; text-wrap: balance; letter-spacing: var(--display-tracking); text-transform: var(--display-case); }
h1 { font-size: clamp(2rem, 5vw, 3rem); }
h2 { font-size: 1.35rem; }
p { text-wrap: pretty; }
.wrap { max-width: 880px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--ink-soft); }
.nowrap { white-space: nowrap; }

:focus-visible { outline: 2.5px dashed var(--ink); outline-offset: 3px; }

.skip { position: absolute; left: 16px; top: -60px; z-index: 50; background: var(--butter); color: var(--ink); padding: 8px 14px; border: 2px solid var(--ink); border-radius: var(--ctl-radius); font-weight: 700; }
.skip:focus { top: 12px; }

/* ícones (sprite Tabler) */
.ico { width: 1.25em; height: 1.25em; flex-shrink: 0; stroke-width: 1.8; vertical-align: -.22em; }

/* ---------- traço de lápis: cartão com linha dupla ---------- */
.sketch { position: relative; background: var(--sheet); border-radius: var(--card-radius); isolation: isolate; box-shadow: var(--card-shadow); }
.sketch::before,
.sketch::after { content: ""; position: absolute; pointer-events: none; z-index: -1; }
.sketch::after { inset: 0; border: var(--frame-w) solid var(--frame-color); border-radius: var(--card-radius); transform: rotate(var(--tilt)); }
/* Segunda linha: traço repassado (base), filete interno (amor), costura (ninho), trena (obra), correio aéreo (postal). */
.sketch::before {
    inset: var(--double-inset); border: var(--double-w) var(--double-style) var(--double-color); border-radius: var(--card-radius-2);
    opacity: var(--double-opacity); transform: rotate(var(--tilt-2)); background: var(--double-bg);
}


/* bolinha de lápis de cor com o ícone */
.blob {
    display: inline-grid; place-items: center; flex-shrink: 0;
    width: 48px; height: 48px; border-radius: var(--tile-radius);
    background: var(--tone, var(--mint)); border: 1.75px var(--tile-border-style) var(--frame-color); box-shadow: var(--tile-ring);
    color: var(--ink);
}
.blob .ico { width: 58%; height: 58%; stroke-width: 1.6; }
.blob--sm { width: 34px; height: 34px; border-width: 1.5px; }
.blob--lg { width: 64px; height: 64px; border-width: 2px; }
.tone-0 { --tone: var(--mint); }
.tone-1 { --tone: var(--peach); }
.tone-2 { --tone: var(--lavender); }
.tone-3 { --tone: var(--butter); }
.tone-4 { --tone: var(--sky); }
.tone-5 { --tone: var(--rose); }

/* ---------- topo ---------- */
.topbar { position: relative; background: var(--sheet); border-bottom: var(--frame-w) solid var(--frame-color); }
.topbar::after { content: ""; position: absolute; left: 0; right: 0; bottom: -6px; border-bottom: 1.5px solid var(--ink); opacity: var(--rule-2-opacity); transform: rotate(-.08deg); }
.topbar__inner { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 64px; }
.brand { display: inline-flex; align-items: center; gap: 10px; font: 700 1.45rem/1 var(--brand-font); color: var(--ink); text-decoration: none; }
.brand:hover { text-decoration: none; }
.brand__mark { display: inline-grid; place-items: center; width: 36px; height: 36px; background: var(--butter); border: 1.75px solid var(--ink); border-radius: var(--tile-radius); transform: rotate(-6deg); }
.brand__mark .ico { width: 21px; height: 21px; }
.brand__dot { color: var(--accent); }
.nav { display: flex; gap: 16px; align-items: center; font-weight: 600; }
.nav a:not(.btn) { color: var(--ink); text-decoration: none; }
.nav a:not(.btn):hover { text-decoration: underline wavy var(--accent); }
.nav form { margin: 0; }
.linklike { display: inline-flex; align-items: center; gap: 4px; background: none; border: 0; color: var(--accent); font: inherit; font-weight: 700; cursor: pointer; padding: 0; }
.linklike:hover { text-decoration: underline wavy; }

/* ---------- botões ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    background: var(--accent-fill); color: var(--btn-ink); border: var(--ctl-border); border-radius: var(--ctl-radius);
    padding: 11px 20px; font: 700 1.02rem/1.1 var(--ui-font); cursor: pointer; text-decoration: none;
    box-shadow: var(--pop);
    transition: transform .12s ease, box-shadow .12s ease, background-color .12s ease;
}
.btn:hover { transform: translate(-1px, -1px); box-shadow: var(--pop-hover); background: var(--accent-hatch); text-decoration: none; }
.btn:active { transform: translate(2px, 2px); box-shadow: var(--pop-press); }
.btn:disabled { opacity: .6; cursor: progress; }
.btn--small { padding: 7px 14px; font-size: .92rem; box-shadow: var(--pop-sm); }
.btn--ghost { background: var(--sheet); }
.btn--ghost:hover { background: var(--butter); }

/* ---------- página inicial ---------- */
.hero { padding: 48px 0 20px; max-width: 680px; }
.hero h1 { font-size: clamp(2.2rem, 6vw, 3.4rem); }
.hero__lead { font-size: 1.15rem; color: var(--ink-soft); max-width: 600px; margin: 0; }
.section-title { font-size: 1.45rem; margin: 28px 0 16px; }

.scenarios { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 26px 24px; padding: 6px 4px 12px; }
.scenario {
    display: grid; grid-template-rows: auto 1fr auto; gap: 12px; padding: 22px 20px 18px;
    color: var(--ink); text-decoration: none;
    background: color-mix(in srgb, var(--tone) 38%, var(--sheet));
    transform: rotate(calc(-.7deg * var(--sway)));
    transition: transform .18s ease;
}
.scenario:nth-child(even) { transform: rotate(calc(.6deg * var(--sway))); }
.scenario:nth-child(3n) { transform: rotate(calc(-.3deg * var(--sway))); }
.scenario:hover { transform: rotate(0) translateY(-3px); text-decoration: none; }
.scenario .blob { background: var(--sheet); }
.scenario__text { display: grid; gap: 4px; }
.scenario__name { font: var(--display-weight) 1.35rem/1.15 var(--display); text-transform: var(--display-case); letter-spacing: var(--display-tracking); }
.scenario__tagline { color: var(--ink-soft); font-size: .97rem; }
.scenario__cta { justify-self: start; font: 700 .98rem/1 var(--ui-font); color: var(--accent); border-bottom: 2px solid currentColor; padding-bottom: 3px; }
.scenario:hover .scenario__cta { border-bottom-style: dashed; }
.scenario__meta { font-size: .85rem; color: var(--ink-soft); }
.scenario--list .bar { margin: 0; }

.steps { margin: 20px 0 8px; }
.steps ol { list-style: none; counter-reset: step; padding: 0; margin: 0; display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.steps li { counter-increment: step; position: relative; padding-left: 52px; color: var(--ink-soft); }
.steps li strong { display: block; color: var(--ink); font: 700 1.08rem/1.25 var(--display); margin-bottom: 2px; }
.steps li::before {
    content: counter(step); position: absolute; left: 0; top: -2px;
    width: 38px; height: 38px; display: grid; place-items: center;
    font: 700 1.1rem/1 var(--display); background: var(--butter); border: 1.75px solid var(--ink); border-radius: var(--tile-radius);
}

/* ---------- blocos gerais ---------- */
.intro { padding: 28px 0 8px; }
.intro__head { display: flex; gap: 18px; align-items: flex-start; }
.intro__head .blob { margin-top: 4px; }
.intro__head p { margin: 0; max-width: 620px; }
.back { display: inline-flex; align-items: center; gap: 6px; margin-bottom: 14px; font-weight: 700; text-decoration: none; }
.panel { padding: 26px; margin: 22px 0; }
.narrow { max-width: 460px; margin: 40px auto; }

.bar {
    height: 12px; margin-top: 8px; overflow: hidden;
    background: var(--sheet); border: var(--ctl-border-thin); border-radius: var(--ctl-radius);
}
.bar span {
    display: block; height: 100%;
    background: var(--bar-fill);
    border-right: 1.75px solid var(--ink);
    transition: width .3s ease;
}
.bar span[style="width: 0%"] { border-right: 0; }
.bar--big { height: 16px; min-width: 220px; }

/* ---------- formulários ---------- */
.form { display: grid; gap: 16px; margin: 18px 0; }
.form label { display: grid; gap: 6px; font-weight: 700; font-size: .95rem; }
.form label.check { display: flex; align-items: center; gap: 10px; font-weight: 600; }
input[type=text], input[type=email], input[type=password], input[type=number], select {
    width: 100%; padding: 11px 14px; font: inherit; color: var(--ink);
    background-color: var(--sheet); border: var(--ctl-border); border-radius: var(--ctl-radius);
}
input:focus-visible, select:focus-visible { outline: 2.5px dashed var(--accent); outline-offset: 2px; }
.error { color: var(--danger); margin: 6px 0 0; font-weight: 600; font-size: .95rem; }

/* caixas de seleção desenhadas */
input[type=checkbox] {
    appearance: none; -webkit-appearance: none; margin: 0; flex-shrink: 0;
    width: 26px; height: 26px; cursor: pointer;
    background: var(--sheet) center / 20px no-repeat;
    border: var(--ctl-border); border-radius: var(--check-radius);
    transition: background-color .12s ease, transform .12s ease;
}
input[type=checkbox]:hover { background-color: var(--mint); }
input[type=checkbox]:checked {
    background-color: var(--accent-fill);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M4 12.5c2 1.6 3.6 3.5 5.2 6C11.8 12 15.6 7.4 20.5 4' fill='none' stroke='%232d3142' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    transform: rotate(-3deg);
}
input[type=checkbox]:disabled { cursor: default; opacity: .7; }

/* ---------- questionário ---------- */
.quiz { max-width: 640px; }
.quiz__progress { font-size: .9rem; color: var(--ink-soft); margin-bottom: 22px; font-weight: 600; }
.quiz__question { font-size: clamp(1.4rem, 3.5vw, 1.75rem); }
.choices { display: grid; gap: 12px; margin: 20px 0; }
.choices--row { grid-template-columns: 1fr 1fr; }
.choice {
    display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
    padding: 14px 16px; font: inherit; font-weight: 600; color: var(--ink); cursor: pointer;
    background: var(--sheet); border: var(--ctl-border); border-radius: var(--ctl-radius);
    transition: background-color .12s ease, transform .12s ease, box-shadow .12s ease;
}
.choice:nth-child(odd) { border-radius: var(--ctl-radius-alt); }
.choice:hover { background: var(--butter); }
.choice.is-active, .choice--check:has(input:checked) { background: var(--mint); box-shadow: var(--pop); transform: translate(-1px, -1px); }
.number input { max-width: 170px; font-size: 1.35rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.number--money { display: flex; align-items: center; gap: 10px; }
.number--money span { font: 700 1.35rem/1 var(--display); color: var(--ink-soft); }
.number--money input { max-width: 230px; }
.quiz__nav { display: flex; justify-content: space-between; margin-top: 26px; gap: 12px; }

/* ---------- lista: resumo ---------- */
.summary { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: end; gap: 16px; margin: 14px 0 18px; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; }
.pill {
    font: 700 .92rem/1 var(--ui-font); color: var(--ink); cursor: pointer;
    padding: 8px 14px; background: var(--sheet); border: var(--ctl-border-thin); border-radius: var(--pill-radius);
}
.pill:hover { background: var(--butter); }
.pill.is-active { background: var(--butter); box-shadow: var(--pop-sm); }
.notice { background: var(--sky); border: 1.5px solid var(--ink); border-radius: var(--ctl-radius); padding: 10px 14px; margin: 14px 0; font-size: .97rem; }
.notice--cta { background: var(--butter); }
.notice--cta a { color: inherit; font-weight: 800; }

.cost { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 24px; padding: 18px 20px; margin: 14px 0 18px; }
.cost__main, .cost__side { display: grid; gap: 2px; }
.cost__side { text-align: right; align-content: end; }
.cost__label { font-size: .85rem; font-weight: 700; color: var(--ink-soft); }
.cost__value { font: 700 2.1rem/1.05 var(--display); font-variant-numeric: tabular-nums; }
.cost__side strong { font: 700 1.25rem/1.2 var(--display); font-variant-numeric: tabular-nums; }
.cost__range { color: var(--ink-soft); font-size: .95rem; }
.cost__loading { color: var(--ink-soft); font-style: italic; padding: 4px 0; }
.cost__note { flex-basis: 100%; margin: 0; color: var(--ink-soft); font-size: .82rem; }
.cost__ok { color: var(--accent); font-weight: 700; font-size: .9rem; }
.cost__over { color: var(--danger); font-weight: 700; font-size: .9rem; }

.prefs { padding: 14px 18px; margin: 14px 0 22px; }
.prefs summary { cursor: pointer; display: flex; justify-content: space-between; gap: 12px; list-style: none; font-size: .97rem; }
.prefs summary::-webkit-details-marker { display: none; }
.prefs__edit { color: var(--accent); font: 700 .95rem/1.4 var(--display); white-space: nowrap; text-decoration: underline wavy; text-underline-offset: 4px; }
.prefs__grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-top: 14px; }
.prefs__grid label { display: grid; gap: 4px; font-size: .82rem; font-weight: 700; color: var(--ink-soft); }
.prefs__grid select, .prefs__grid input { padding: 9px 10px; font-size: .95rem; }
.prefs__hint { margin: 12px 0 0; font-size: .92rem; color: var(--ink-soft); }

/* ---------- lista: grupos e itens ---------- */
.group { margin: 34px 0; }
.group__title { display: flex; align-items: center; gap: 12px; font-size: 1.4rem; margin-bottom: 14px; }
.group__count {
    font: 700 .8rem/1 var(--body); color: var(--ink-soft);
    padding: 4px 8px; border: 1.5px solid var(--line); border-radius: 99px;
}
.group--optional .group__title { color: var(--ink-soft); }
.group__note { margin: -6px 0 12px; font-size: .92rem; }

.items { list-style: none; margin: 0; padding: 4px 0; }
/* Em cartões altos a rotação da linha dupla cresce com a altura; aqui ela vira só deslocamento. */
.items::before, .items::after { transform: none; }
.items::before { inset: var(--items-double-inset); }
.item {
    display: grid; grid-template-columns: auto auto minmax(0, 1fr) auto; gap: 14px;
    padding: 14px 18px; align-items: start;
    border-top: 1.5px dashed var(--line);
}
.item:first-child { border-top: 0; }
.item__check { padding-top: 11px; }
.item__icon { width: 48px; height: 48px; }
.item__body { min-width: 0; padding-top: 2px; }
.item__title { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
.item__name { font-weight: 800; font-size: 1.03rem; overflow-wrap: anywhere; }
.item.is-done .item__name { color: var(--ink-soft); text-decoration: line-through; text-decoration-color: var(--strike); text-decoration-thickness: 2.5px; }
.item.is-done .item__icon { opacity: .5; }
.item__reason { margin: 4px 0 0; color: var(--ink-soft); font-size: .93rem; }
.item__price { margin: 4px 0 0; font-size: .92rem; font-variant-numeric: tabular-nums; }
.item__price strong { color: var(--accent); }
.item__price span { color: var(--ink-soft); }
.item__price--pending { color: var(--ink-soft); font-style: italic; }
.item__offers { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }

.offer {
    display: inline-flex; gap: 6px; align-items: center; font-size: .86rem; font-weight: 600;
    padding: 5px 11px; color: var(--ink); text-decoration: none;
    background: var(--sheet); border: 1.5px solid var(--line); border-radius: var(--ctl-radius);
    transition: border-color .12s ease, background-color .12s ease;
}
.offer:hover { border-color: var(--ink); background: var(--butter); text-decoration: none; }
.offer strong { color: var(--accent); }
.offer--search { color: var(--ink-soft); }
.offer--best { color: var(--ink); background: var(--mint); border-color: var(--ink); }
.offer small { font-size: .74rem; color: var(--accent); font-weight: 800; }

.tag {
    font-size: .74rem; font-weight: 800; padding: 2px 9px;
    border: 1.5px solid var(--frame-color); border-radius: var(--tag-radius);
}
.tag--essential { background: var(--mint); }
.tag--forgotten { background: var(--butter); transform: rotate(-1.5deg); }
.tag--ai { background: var(--lavender); }

.item__side { display: grid; justify-items: end; gap: 8px; padding-top: 6px; }
.qty { display: inline-flex; align-items: center; background: var(--sheet); border: var(--ctl-border-thin); border-radius: var(--ctl-radius); overflow: hidden; }
.qty button { display: grid; place-items: center; background: none; border: 0; width: 36px; height: 36px; color: var(--ink); cursor: pointer; }
.qty button:hover { background: var(--butter); }
.qty .ico { width: 18px; height: 18px; stroke-width: 2.2; }
.qty span { min-width: 30px; text-align: center; font: 700 1.05rem/1 var(--display); font-variant-numeric: tabular-nums; }
.qty__static { color: var(--ink-soft); font-size: .9rem; white-space: nowrap; font-weight: 700; }
.remove { background: none; border: 0; color: var(--ink-soft); font: inherit; font-size: .82rem; font-weight: 600; cursor: pointer; padding: 4px 0; }
.remove:hover { color: var(--danger); text-decoration: underline wavy; }

.removed { margin: 18px 0; color: var(--ink-soft); }
.removed summary { cursor: pointer; font-weight: 700; }
.removed ul { list-style: none; padding: 0; margin: 10px 0 0; display: grid; gap: 8px; }
.removed li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 9px 14px; background: var(--sheet); border: 1.5px dashed var(--line); border-radius: var(--ctl-radius); }

.add h2 { margin-bottom: 14px; }
.add__form { display: grid; grid-template-columns: 1fr 210px auto; gap: 10px; align-items: center; }

/* ---------- barra fixa de custo ---------- */
.has-costbar { padding-bottom: 96px; }
.costbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; background: var(--sheet); border-top: var(--frame-w) solid var(--frame-color); padding-bottom: env(safe-area-inset-bottom); }
.costbar::before { content: ""; position: absolute; left: 0; right: 0; top: -7px; border-top: 1.5px solid var(--ink); opacity: var(--rule-2-opacity); transform: rotate(.08deg); }
.costbar__inner { position: relative; display: flex; flex-wrap: wrap; gap: 6px 30px; align-items: center; min-height: 68px; padding-top: 12px; padding-bottom: 10px; }
.costbar__block { display: grid; line-height: 1.2; }
.costbar__block strong { font: 700 1.2rem/1.2 var(--display); font-variant-numeric: tabular-nums; }
.costbar__label { font-size: .78rem; font-weight: 700; color: var(--ink-soft); }
.costbar__budget.is-ok strong { color: var(--accent); }
.costbar__budget.is-over strong { color: var(--danger); }
.costbar__progress {
    position: absolute; left: 16px; right: 16px; top: 0; height: 5px;
    background: linear-gradient(90deg, transparent var(--p), var(--sheet) var(--p)),
                var(--bar-fill);
}

/* ---------- rodapé ---------- */
.footer { padding: 36px 16px 52px; color: var(--ink-soft); font-size: .86rem; }

/* ---------- telas pequenas ---------- */
@media (max-width: 700px) {
    .prefs__grid { grid-template-columns: 1fr 1fr; }
    .costbar__inner { gap: 4px 18px; }
    .costbar__block strong { font-size: 1.02rem; }
}
@media (max-width: 600px) {
    .item { grid-template-columns: auto auto minmax(0, 1fr); gap: 12px; padding: 14px 12px; }
    .item__icon { width: 40px; height: 40px; }
    .item__side { grid-column: 3; justify-items: start; grid-auto-flow: column; align-items: center; gap: 16px; padding-top: 0; }
    .add__form { grid-template-columns: 1fr; }
    .panel { padding: 20px; }
    .cost__side { text-align: left; }
    .intro__head { align-items: flex-start; }
    .intro__head .blob--lg { width: 52px; height: 52px; }
    .scenarios { grid-template-columns: 1fr; }
}

/* ---------- movimento reduzido ---------- */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition: none !important; animation: none !important; }
    .scenario, .scenario:nth-child(even), .scenario:nth-child(3n), .scenario:hover { transform: none; }
    .btn:hover, .btn:active, .choice.is-active { transform: none; }
}

.form__aside { margin: -8px 0 0; font-size: .92rem; text-align: right; }

/* ---------- ofertas: "melhor para você" e comparação ---------- */
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.deal { margin-top: 10px; padding: 10px 12px; background: var(--sheet); border: 1.5px solid var(--line); border-radius: var(--ctl-radius); }
.deal--lead { border-color: var(--ink); }
.deal--best { background: color-mix(in srgb, var(--mint) 55%, var(--sheet)); border: 2px solid var(--ink); box-shadow: var(--pop); }
.deal__badge { display: flex; flex-wrap: wrap; align-items: center; gap: 0; margin: 0 0 6px; font: 700 .9rem/1.3 var(--ui-font); }
.deal__badge span { font: 600 .86rem/1.3 var(--body); color: var(--ink-soft); }
.deal__badge .ico { color: var(--accent); fill: var(--butter); margin-right: 6px; }
.deal__body { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 6px 16px; align-items: center; }
.deal__info { display: grid; gap: 1px; min-width: 0; }
.deal__store { font-size: .78rem; font-weight: 800; color: var(--accent); }
.deal__title { font-weight: 700; font-size: .95rem; overflow-wrap: anywhere; }
.deal__cond { font-size: .84rem; color: var(--ink-soft); }
.deal__price { display: grid; justify-items: end; line-height: 1.15; }
.deal__price strong { font: 700 1.2rem/1.1 var(--display); font-variant-numeric: tabular-nums; white-space: nowrap; }
.deal__price small { font-size: .76rem; color: var(--ink-soft); }
.deals-more { margin-top: 8px; }
.deals-more summary { cursor: pointer; font-weight: 700; font-size: .9rem; color: var(--accent); width: fit-content; }
.deals-more summary:hover { text-decoration: underline wavy; }
.item__offers-label { font-size: .82rem; color: var(--ink-soft); font-weight: 600; align-self: center; }
@media (max-width: 600px) {
    /* No celular o título ocupa a linha toda; preço e botão vão para a linha de baixo. */
    .deal__body { grid-template-columns: auto auto; justify-content: space-between; }
    .deal__info { grid-column: 1 / -1; }
    .deal__price { justify-items: start; }
}
.deal__specs { font-size: .82rem; font-weight: 700; color: var(--ink); }

/* ==========================================================================
   TEMAS POR CENÁRIO
   Cada tema sobrescreve só tokens do contrato (início do arquivo) e acrescenta poucos detalhes
   de assinatura. O tema vem do cenário (campo "theme") e é aplicado em <body data-theme>;
   na home, cada cartão de cenário carrega o tema do próprio cenário.
   ========================================================================== */

@font-face { font-family: "Big Shoulders Display"; src: url("../fonts/big-shoulders-display-700.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Big Shoulders Display"; src: url("../fonts/big-shoulders-display-800.woff2") format("woff2"); font-weight: 800; font-display: swap; }
@font-face { font-family: "Cormorant Garamond"; src: url("../fonts/cormorant-garamond-600.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Cormorant Garamond"; src: url("../fonts/cormorant-garamond-700.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Cormorant Garamond"; src: url("../fonts/cormorant-garamond-600-italic.woff2") format("woff2"); font-weight: 600; font-style: italic; font-display: swap; }
@font-face { font-family: "Fredoka"; src: url("../fonts/fredoka-500.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Fredoka"; src: url("../fonts/fredoka-600.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Bricolage Grotesque"; src: url("../fonts/bricolage-grotesque-700.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Bricolage Grotesque"; src: url("../fonts/bricolage-grotesque-800.woff2") format("woff2"); font-weight: 800; font-display: swap; }

/* ---------- base: institucional, leve (home, conta, minhas listas) ----------
   Linha única e reta, papel liso. A personalidade fica com os cartões de cada cenário. */
[data-theme="base"] {
    --paper: #f8f8f5;
    --sheet: #ffffff;
    --page-bg: none;
    --accent: #2f6b52;
    --accent-fill: #2f6b52;
    --accent-hatch: #275a45;
    --btn-ink: #ffffff;
    --display: var(--body);
    --display-weight: 800;
    --display-tracking: -.025em;
    --ui-font: var(--body);
    --card-radius: 18px;
    --card-radius-2: 18px;
    --ctl-radius: 12px;
    --ctl-radius-alt: 12px;
    --pill-radius: 999px;
    --tag-radius: 999px;
    --tile-radius: 14px;
    --check-radius: 7px;
    --frame-w: 1.5px;
    --frame-color: rgba(45, 49, 66, .14);
    --ctl-border: 1.5px solid rgba(45, 49, 66, .28);
    --ctl-border-thin: 1.5px solid rgba(45, 49, 66, .22);
    --tilt: 0deg;
    --double-opacity: 0;
    --rule-2-opacity: 0;
    --sway: 0;
    --card-shadow: 0 1px 2px rgba(45, 49, 66, .05), 0 12px 28px -18px rgba(45, 49, 66, .35);
    --pop: 0 1px 2px rgba(45, 49, 66, .18);
    --pop-hover: 0 4px 12px -4px rgba(45, 49, 66, .35);
    --pop-sm: 0 1px 2px rgba(45, 49, 66, .15);
    --pop-press: none;
}
[data-theme="base"] .btn--ghost { color: var(--ink); }
[data-theme="base"] .hero h1 { font-size: clamp(2.3rem, 6vw, 3.5rem); }

/* ---------- obra: casa nova, construção e trena ----------
   Papel kraft com grade de planta baixa, títulos de placa de obra, trena no topo dos cartões,
   progresso em faixa zebrada. */
[data-theme="obra"] {
    --paper: #efe6d6;
    --sheet: #fbf7ef;
    --grid: rgba(31, 78, 140, .09);
    --ink: #262b33;
    --ink-soft: #5d5a55;
    --line: rgba(38, 43, 51, .25);
    --mint: #dfe7cf;
    --peach: #f3cfb4;
    --lavender: #dcdcd4;
    --butter: #f8dc74;
    --sky: #cfdff0;
    --rose: #efc2a9;
    --accent: #1f4e8c;
    --accent-fill: #f6c744;
    --accent-hatch: #ecb52a;
    --tape: #f6c744;
    --display: "Big Shoulders Display", "Arial Narrow", sans-serif;
    --display-weight: 800;
    --display-case: uppercase;
    --display-tracking: .02em;
    --display-leading: 1;
    --page-bg:
        linear-gradient(var(--grid) 1px, transparent 1px),
        linear-gradient(90deg, var(--grid) 1px, transparent 1px),
        linear-gradient(rgba(31, 78, 140, .13) 1px, transparent 1px),
        linear-gradient(90deg, rgba(31, 78, 140, .13) 1px, transparent 1px);
    --page-bg-size: 24px 24px, 24px 24px, 120px 120px, 120px 120px;
    --card-radius: 3px;
    --card-radius-2: 2px;
    --ctl-radius: 3px;
    --ctl-radius-alt: 3px;
    --pill-radius: 3px;
    --tag-radius: 2px;
    --tile-radius: 6px;
    --check-radius: 2px;
    --tilt: 0deg;
    --tilt-2: 0deg;
    --sway: 0;
    /* a "segunda linha" vira uma trena presa no topo do cartão */
    --double-inset: -9px 18px calc(100% - 5px) 18px;
    --items-double-inset: -9px 18px calc(100% - 5px) 18px;
    --double-w: 1.5px;
    --double-color: var(--ink);
    --double-opacity: 1;
    --double-bg:
        repeating-linear-gradient(90deg, var(--ink) 0 1.5px, transparent 1.5px 40px) left bottom / 100% 8px no-repeat,
        repeating-linear-gradient(90deg, var(--ink) 0 1px, transparent 1px 8px) left bottom / 100% 4px no-repeat,
        var(--tape);
    --rule-2-opacity: 0;
    --pop: 4px 4px 0 var(--ink);
    --pop-hover: 5px 5px 0 var(--ink);
    --bar-fill: repeating-linear-gradient(-45deg, #f6c744 0 8px, #262b33 8px 16px);
}
[data-theme="obra"] .topbar::after { opacity: 1; border: 0; bottom: -10px; height: 8px; background: repeating-linear-gradient(-45deg, #f6c744 0 10px, #262b33 10px 20px); transform: none; }
[data-theme="obra"] .tag { background-color: color-mix(in srgb, var(--tone, var(--butter)) 70%, transparent); transform: rotate(-1deg); }
[data-theme="obra"] .tag--essential { background: #f8dc74; }
[data-theme="obra"] .cost__value, [data-theme="obra"] .costbar__block strong { letter-spacing: .02em; }

/* ---------- amor: casamento, papelaria de convite ----------
   Serifa elegante, filete duplo fino, rosa e ameixa, ornamento ❦. */
[data-theme="amor"] {
    --paper: #fbf3f1;
    --sheet: #fffdfb;
    --grid: rgba(168, 64, 95, .10);
    --ink: #3f2a37;
    --ink-soft: #7a6270;
    --line: rgba(63, 42, 55, .16);
    --mint: #e3ead9;
    --peach: #f8e1d5;
    --lavender: #ebe1f0;
    --butter: #f3e7cb;
    --sky: #dee7ef;
    --rose: #f7dce2;
    --accent: #a8405f;
    --accent-fill: #f3cad3;
    --accent-hatch: #ecb5c2;
    --strike: #a8405f;
    --display: "Cormorant Garamond", Georgia, serif;
    --display-weight: 700;
    --display-tracking: 0;
    --display-leading: 1.05;
    --ui-font: var(--body);
    --page-bg: radial-gradient(circle, var(--grid) 1px, transparent 1.6px);
    --page-bg-size: 22px 22px;
    --card-radius: 16px;
    --card-radius-2: 11px;
    --ctl-radius: 12px;
    --ctl-radius-alt: 12px;
    --pill-radius: 999px;
    --tag-radius: 999px;
    --tile-radius: 50%;
    --tile-ring: 0 0 0 3px var(--sheet), 0 0 0 4.5px var(--accent-fill);
    --check-radius: 50%;
    --frame-w: 1px;
    --frame-color: rgba(63, 42, 55, .45);
    --ctl-border: 1.5px solid rgba(63, 42, 55, .4);
    --ctl-border-thin: 1px solid rgba(63, 42, 55, .4);
    --tilt: 0deg;
    --tilt-2: 0deg;
    --sway: 0;
    /* filete interno, como nos convites */
    --double-inset: 5px;
    --items-double-inset: 5px;
    --double-w: 1px;
    --double-color: var(--accent);
    --double-opacity: .4;
    --rule-2-opacity: .3;
    --card-shadow: 0 14px 34px -22px rgba(168, 64, 95, .55);
    --pop: 0 6px 16px -8px rgba(168, 64, 95, .55);
    --pop-hover: 0 10px 22px -10px rgba(168, 64, 95, .6);
    --pop-sm: 0 3px 8px -4px rgba(168, 64, 95, .5);
    --pop-press: 0 1px 3px rgba(168, 64, 95, .4);
    --bar-fill: linear-gradient(90deg, #f3cad3, #a8405f);
}
[data-theme="amor"] h1 { font-size: clamp(2.4rem, 6vw, 3.6rem); }
/* ornamento de convite: fio, coração, fio (SVG, para não depender de fonte de emoji) */
[data-theme="amor"] .intro h1::after {
    content: ""; display: block; width: 132px; height: 16px; margin-top: 10px;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 132 16'%3E%3Cpath d='M0 8h52M80 8h52' stroke='%23a8405f' stroke-width='1' opacity='.6'/%3E%3Cpath d='M66 13.5c-4.5-3-7.5-5.4-7.5-8.2 0-1.9 1.4-3.3 3.2-3.3 1.8 0 3.1 1.2 4.3 2.7 1.2-1.5 2.5-2.7 4.3-2.7 1.8 0 3.2 1.4 3.2 3.3 0 2.8-3 5.2-7.5 8.2z' fill='none' stroke='%23a8405f' stroke-width='1.2'/%3E%3C/svg%3E") no-repeat;
}
[data-theme="amor"] .group__title { font-style: italic; font-weight: 600; font-size: 1.6rem; }
[data-theme="amor"] .scenario__name { font-size: 1.6rem; }
[data-theme="amor"] .cost__value, [data-theme="amor"] .costbar__block strong, [data-theme="amor"] .qty span,
[data-theme="amor"] .deal__price strong { font-family: var(--body); font-weight: 800; }

/* ---------- ninho: enxoval do bebê, quarto de bebê ----------
   Fonte arredondada, costura tracejada dentro dos cartões, azul-bebê e poás. */
[data-theme="ninho"] {
    --paper: #f4f8fc;
    --sheet: #ffffff;
    --grid: rgba(62, 124, 177, .12);
    --ink: #34405a;
    --ink-soft: #66708a;
    --line: rgba(52, 64, 90, .16);
    --mint: #d4f0e4;
    --peach: #fde0d2;
    --lavender: #e6e0f8;
    --butter: #fdf0c2;
    --sky: #d6e9f8;
    --rose: #fbdbe6;
    --accent: #2f6fa8;
    --accent-fill: #cfe5f7;
    --accent-hatch: #b9d9f2;
    --display: "Fredoka", var(--body);
    --display-weight: 600;
    --display-tracking: 0;
    --page-bg:
        radial-gradient(circle, var(--grid) 2px, transparent 2.6px),
        radial-gradient(circle, var(--grid) 2px, transparent 2.6px);
    --page-bg-size: 28px 28px;
    --card-radius: 28px;
    --card-radius-2: 21px;
    --ctl-radius: 16px;
    --ctl-radius-alt: 16px;
    --pill-radius: 999px;
    --tag-radius: 999px;
    --tile-radius: 50% 50% 46% 54% / 58% 58% 42% 42%;
    --check-radius: 50%;
    --frame-w: 2px;
    --frame-color: #a9c6e2;
    --ctl-border: 2px solid #a9c6e2;
    --ctl-border-thin: 2px solid #c3d8ec;
    --tilt: 0deg;
    --tilt-2: 0deg;
    --sway: .5;
    /* costura: pesponto tracejado por dentro */
    --double-inset: 7px;
    --items-double-inset: 7px;
    --double-w: 2px;
    --double-style: dashed;
    --double-color: #9dbcdc;
    --double-opacity: .9;
    --rule-2-opacity: 0;
    --card-shadow: 0 6px 0 #dbe8f4;
    --pop: 0 4px 0 #a9c6e2;
    --pop-hover: 0 6px 0 #a9c6e2;
    --pop-sm: 0 3px 0 #a9c6e2;
    --pop-press: 0 1px 0 #a9c6e2;
    --bar-fill: repeating-linear-gradient(90deg, #cfe5f7 0 14px, #fde0d2 14px 28px, #d4f0e4 28px 42px, #fdf0c2 42px 56px);
}
[data-theme="ninho"] { background-position: 0 0, 14px 14px; }
[data-theme="ninho"] input[type=checkbox]:checked { background-color: #d4f0e4; }

/* ---------- postal: imóvel para temporada, viagem ----------
   Borda de envelope de correio aéreo, selos, etiquetas de bagagem, areia e mar. */
[data-theme="postal"] {
    --paper: #f4ecdd;
    --sheet: #fffaf1;
    --grid: rgba(15, 111, 124, .08);
    --ink: #1f3a44;
    --ink-soft: #4b6670;
    --line: rgba(31, 58, 68, .2);
    --mint: #d6e8cf;
    --peach: #fbd3c4;
    --lavender: #d4e6f6;
    --butter: #fbe2b4;
    --sky: #cfe9ea;
    --rose: #f3e3c3;
    --accent: #0f6f7c;
    --accent-fill: #ffd2bf;
    --accent-hatch: #ffbea5;
    --airmail-red: #d9533a;
    --airmail-blue: #2a6f97;
    --display: "Bricolage Grotesque", var(--body);
    --display-weight: 800;
    --display-tracking: -.02em;
    --display-leading: 1.05;
    --page-bg: radial-gradient(circle at 50% 100%, transparent 8px, var(--grid) 9px, var(--grid) 10px, transparent 11px);
    --page-bg-size: 26px 13px;
    --card-radius: 6px;
    --card-radius-2: 10px;
    --ctl-radius: 8px;
    --ctl-radius-alt: 8px;
    --pill-radius: 6px;
    --tag-radius: 3px 10px 10px 3px;
    --tile-radius: 5px;
    --tile-border-style: dashed;
    --check-radius: 5px;
    --frame-w: 1.5px;
    --tilt: 0deg;
    --tilt-2: 0deg;
    --sway: 1.2;
    /* moldura listrada de envelope de correio aéreo, por trás do cartão */
    --double-inset: -7px;
    --items-double-inset: -7px;
    --double-w: 0px;
    --double-opacity: 1;
    --double-bg: repeating-linear-gradient(-45deg, var(--airmail-red) 0 11px, var(--sheet) 11px 22px, var(--airmail-blue) 22px 33px, var(--sheet) 33px 44px);
    --rule-2-opacity: 0;
    --bar-fill: repeating-linear-gradient(-45deg, #d9533a 0 8px, #fffaf1 8px 16px, #2a6f97 16px 24px, #fffaf1 24px 32px);
}
[data-theme="postal"] .tag { position: relative; padding-left: 15px; }
[data-theme="postal"] .tag::before { content: ""; position: absolute; left: 5px; top: 50%; width: 5px; height: 5px; margin-top: -2.5px; border-radius: 50%; background: var(--sheet); border: 1px solid var(--frame-color); }
[data-theme="postal"] .topbar { border-bottom: 0; box-shadow: 0 5px 0 -1px var(--sheet), 0 6px 0 0 var(--ink); }
[data-theme="postal"] .topbar::after { opacity: 1; border: 0; bottom: -9px; height: 5px; background: repeating-linear-gradient(-45deg, #d9533a 0 8px, transparent 8px 16px, #2a6f97 16px 24px, transparent 24px 32px); transform: none; }
/* Só a borda listrada aparece: a máscara recorta o miolo da moldura, que senão cobriria o fundo do cartão. */
[data-theme="postal"] .sketch::before {
    padding: 8px;
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
    mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
}
