:root {
  color-scheme: light;
  --page: #f7f8f3; --panel: #fff; --ink: #142720; --muted: #435b51;
  --line: #d8e3d9; --green: #155739; --accent: #bef083;
  --hero: #15362a; --hero-ink: #f5fbef; --soft: #e8f4df;
  --shadow: 0 22px 65px #123c2620;
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", sans-serif;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #111f19; --panel: #192b22; --ink: #edf7ec; --muted: #bbd0c4;
  --line: #385044; --green: #bded9a; --soft: #2a4535;
  --hero: #102c21; --shadow: 0 22px 65px #0005;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--page); color: var(--ink); }
.wrap { width: min(1120px, calc(100% - 64px)); margin-inline: auto; }
a { color: var(--green); text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
button, input { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .55; }
:focus-visible { outline: 3px solid #4d9c65; outline-offset: 4px; }
.skip { position: absolute; top: -100px; z-index: 2; background: var(--panel); padding: 10px; }
.skip:focus { top: 5px; }
.top { background: var(--panel); border-bottom: 1px solid var(--line); }
.header { display: flex; align-items: center; gap: 28px; min-height: 72px; }
.brand { display: inline-flex; align-items: center; color: var(--ink); text-decoration: none; font-weight: 820; font-size: 1.5rem; letter-spacing: -.075em; white-space: nowrap; }
.brand-dot { color: var(--green); }
.mark { display: grid; place-items: center; width: 32px; height: 32px; margin-right: 10px; border-radius: 9px; background: #bbef92; color: #183629; font-size: 1.15rem; letter-spacing: 0; }
.header nav { display: flex; flex-wrap: wrap; gap: 10px 28px; margin-left: auto; }
.header nav a, footer nav a { color: var(--muted); text-decoration: none; font-weight: 650; }
.theme { min-width: 44px; min-height: 44px; background: var(--page); color: var(--ink); border: 1px solid var(--line); border-radius: 100%; font-size: 20px; }
.hero { color: var(--hero-ink); background: radial-gradient(ellipse at 86% 25%,#295840,transparent 56%),var(--hero); overflow: hidden; }
.hero-grid { display: grid; grid-template-columns: minmax(0,1.35fr) minmax(0,1fr); align-items: center; gap: 6%; padding-block: clamp(50px,8vw,106px); }
.eyebrow { margin: 0; color: #c5e2cc; font-size: .73rem; font-weight: 780; letter-spacing: .14em; }
.eyebrow span { display: inline-block; width: 8px; height: 8px; margin-right: 8px; border-radius: 50%; background: var(--accent); }
h1,h2,h3,p { overflow-wrap: anywhere; }
.hero h1 { margin: .18em 0 .22em; font: 500 clamp(3.4rem,7.1vw,6.2rem)/.98 Georgia,serif; letter-spacing: -.064em; }
.hero h1 em { color: var(--accent); font-weight: inherit; }
.hero .intro { color: #d7e8dd; max-width: 34ch; font-size: clamp(1.05rem,2vw,1.23rem); margin: 0 0 1.8rem; }
.button,.primary,.outline { display: inline-flex; align-items: center; justify-content: center; gap: .6rem; min-height: 46px; border-radius: 10px; padding: .65rem 1rem; font-weight: 730; text-decoration: none; }
.primary { color: #132b1a; background: #bef083; border: 1px solid #a6d972; }
.primary:hover { background: #aded68; }
.outline { color: var(--green); background: var(--panel); border: 1px solid var(--line); }
.hero-link { display: inline-block; margin: .9rem 0 .9rem 1rem; color: #e0f2dc; font-weight: 650; }
.hero-demo { position: relative; padding: clamp(20px,4vw,34px); border: 1px solid #ffffff3b; border-radius: 24px; background: #f6faf0; color: #163428; box-shadow: var(--shadow); }
.demo-head,.demo-detail { display: flex; align-items: center; gap: 12px; }
.demo-head small { display: block; color: #486456; }
.demo-amount { margin: 1.25rem 0 .8rem; font-size: clamp(2.5rem,5vw,4.2rem); font-weight: 750; letter-spacing: -.07em; line-height: 1; }
.demo-amount span { font-size: .32em; letter-spacing: 0; color: #506b5c; }
.meter { height: 9px; background: #dce7d8; border-radius: 20px; }
.meter span { display: block; width: 20%; height: 100%; background: #528958; border-radius: inherit; }
.demo-detail { justify-content: space-between; margin: .7rem 0 1.45rem; color: #486456; font-size: .9rem; }
.hero-demo a { color: #14583a; font-weight: 690; }
.home-content { padding-block: 45px 68px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
h2 { font-size: clamp(1.4rem,3vw,2rem); letter-spacing: -.045em; margin: 0 0 .75em; line-height: 1.15; }
.section-head > span { color: var(--muted); }
.cards { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 14px; }
.card-shell { display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: start; min-width: 0; background: var(--panel); border: 1px solid var(--line); border-radius: 17px; }
.card-shell:focus-within,.card-shell:hover { border-color: var(--green); }
.card { display: flex; gap: 13px; min-width: 0; padding: 16px 4px 16px 14px; color: var(--muted); text-decoration: none; }
.card-copy { display: grid; gap: 4px; min-width: 0; overflow-wrap: anywhere; }
.card-star { margin: 6px 6px 0 0; width: 44px; height: 44px; padding: 0; color: var(--green); background: transparent; border: 1px solid transparent; border-radius: 10px; font-size: 1.35rem; }
.card-star:hover,.card-star[aria-pressed="true"] { background: var(--soft); border-color: var(--line); }
.glyph { display: inline-grid; place-items: center; width: 40px; height: 40px; flex: 0 0 40px; border-radius: 10px; font-size: 1.28rem; font-weight: 680; background: #d9efd6; color: #265c3a; }
.glyph.housing { background: #fae9c9; color: #784e15; }
.glyph.automotive { background: #dcebf9; color: #2a5071; }
.glyph.business { background: #eadff6; color: #644b82; }
.glyph.everyday { background: #f9e1d9; color: #8a4539; }
.card-title { font-weight: 770; font-size: 1.1rem; color: var(--ink); line-height: 1.22; }
.arrow { font-size: 1.22rem; color: var(--green); }
.popular { margin: 28px 0 38px; }
.popular .cards { grid-template-columns: repeat(2,minmax(0,1fr)); }
.chips { display: flex; flex-wrap: wrap; }
.search { display: block; margin-bottom: 5px; font-weight: 680; }
.search-controls { display: flex; gap: 8px; max-width: 38rem; }
.search-controls button { flex: 0 0 auto; }
.quick-tools { display: flex; flex-wrap: wrap; column-gap: 15px; margin-top: 8px; }
.quick-tools a { min-height: 44px; align-content: center; color: #e0f2dc; font-weight: 650; }
input { width: 100%; min-width: 0; min-height: 46px; padding: .65rem .8rem; border: 1px solid var(--line); border-radius: 9px; color: var(--ink); background: var(--panel); }
.chips { gap: 8px; margin: 12px 0 22px; }
.chips button { min-height: 44px; padding: .38rem .9rem; border: 1px solid var(--line); border-radius: 99px; background: var(--panel); color: var(--ink); }
.chips button[aria-pressed="true"] { background: var(--soft); border-color: var(--green); color: var(--green); font-weight: 700; }
.inner { padding-block: 42px 65px; }
.inner h1 { font-size: clamp(2rem,6vw,3.9rem); line-height: 1.08; letter-spacing: -.06em; margin: .22em 0; }
.crumb { color: var(--muted); font-size: .9rem; }
.tool-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 22px; }
.tool-heading p,.inner > p,.prose p { color: var(--muted); }
.calculator-grid,.guide-grid { display: grid; grid-template-columns: minmax(0,1.12fr) minmax(0,1fr); gap: 18px; }
.calculator-grid > *, .guide-grid > *, .inner > section { border: 1px solid var(--line); border-radius: 16px; background: var(--panel); padding: clamp(16px,3vw,28px); }
.calculator-grid label { display: grid; gap: 4px; margin-top: 12px; font-weight: 650; }
.calculator-grid label span { font-weight: 400; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 17px; }
.result-panel { background: var(--soft); }
.result-panel output { display: block; color: var(--green); font-size: clamp(1.3rem,4vw,2.55rem); font-weight: 790; line-height: 1.15; overflow-wrap: anywhere; }
.result-panel button { margin-top: 12px; }
.result-panel [role="status"] { min-height: 1.55em; }
.guide-grid { margin-top: 18px; }
.guide-grid ul { padding-left: 1.25em; }
.guide-grid li { padding-block: 3px; }
.inner > section { margin-top: 15px; }
.workspace-nav,.backup-actions { display: flex; flex-wrap: wrap; align-items: end; gap: 8px 16px; }
.workspace-nav a { min-height: 44px; align-content: center; font-weight: 650; }
.backup-actions label { max-width: 100%; }
.backup-actions input { margin-top: 5px; }
.saved-row { display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: center; gap: 4px 10px; padding: 10px 0; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.saved-row small { grid-row: 2; color: var(--muted); }
.saved-row button { grid-column: 2; grid-row: 1 / span 2; }
#favorites a,#recents a { display: inline-block; margin: 5px 18px 5px 0; padding-block: 5px; }
.prose p { max-width: 68ch; }
footer { border-top: 1px solid var(--line); background: var(--panel); }
.footer-content { display: flex; gap: 12px 28px; align-items: center; flex-wrap: wrap; padding-block: 20px; color: var(--muted); }
.footer-content p { margin: 0; }
.footer-content nav { display: flex; gap: 18px; margin-left: auto; }
@media (max-width: 750px) { .wrap { width: calc(100% - 36px); } .cards { grid-template-columns: repeat(2,minmax(0,1fr)); } .hero-grid { gap: 25px; } }
@media (max-width: 560px) {
  .header { gap: 9px 12px; flex-wrap: wrap; padding-block: 10px; }
  .header nav { order: 3; width: 100%; margin: 0; gap: 18px; }
  .header nav a { min-height: 44px; align-content: center; }
  .theme { margin-left: auto; }
  .hero-grid,.calculator-grid,.guide-grid { grid-template-columns: 1fr; }
  .hero h1 { font-size: clamp(2.45rem,11.8vw,4rem); }
  .hero .intro { margin-bottom: .95rem; }
  .hero-grid { padding-block: 28px; gap: 17px; }
  .hero-demo { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 8px; padding: 13px 15px; border-radius: 16px; }
  .hero-demo .glyph { display: none; }
  .hero-demo .demo-amount { margin: 0; font-size: 2rem; align-self: center; }
  .hero-demo .meter,.hero-demo .demo-detail { display: none; }
  .hero-demo > a { grid-column: 1 / -1; }
  .cards,.popular .cards { grid-template-columns: 1fr; gap: 9px; }
  .card-shell { min-height: 120px; align-items: stretch; }
  .card { gap: 9px; padding: 10px 2px 10px 10px; align-items: center; }
  .card .glyph { width: 32px; height: 32px; flex-basis: 32px; font-size: 1rem; }
  .card-title { font-size: 1rem; }
  .card-description { font-size: .875rem; line-height: 1.36; }
  .card-star { margin: 3px 3px 0 0; }
  .home-content { padding-block: 26px 45px; }
  .popular { margin-block: 22px 27px; }
  .tool-heading { align-items: flex-start; flex-direction: column; }
  .footer-content nav { margin-left: 0; }
}

.worksheet-filters:not([hidden]) { display:grid; gap:1rem; grid-template-columns:2fr 1fr; max-width:42rem; }
.worksheet-filters label { display:grid; gap:.3rem; min-width:0; font-weight:600; }
.worksheet-filters input, .worksheet-filters select { min-height:44px; width:100%; }
.worksheet-filters select { font:inherit; color:var(--ink); background:var(--panel); border:1px solid var(--line); border-radius:10px; padding:.55rem .75rem; }
.worksheet-grid { display:grid; gap:1.25rem; grid-template-columns:repeat(auto-fit,minmax(min(100%,17rem),1fr)); }
.worksheet-card { background:var(--panel); border:1px solid var(--line); border-radius:1rem; overflow:hidden; }
.worksheet-thumb { display:block; position:relative; flex:none; aspect-ratio:16 / 9; background:#f2f4f0; border-bottom:1px solid var(--line); }
.worksheet-thumb img { position:absolute; inset:0; width:100%; height:100%; padding:.45rem; object-fit:contain; }
.worksheet-card:not([hidden]), .worksheet-card-info { display:flex; flex-direction:column; }
.worksheet-card-info { flex:1; align-items:flex-start; padding:1.2rem; }
.worksheet-card-info h2 { margin:.25rem 0; font-size:1.25rem; }
.worksheet-card-info .worksheet-download { margin-top:auto; }
.worksheet-meta { color:var(--muted); font-weight:600; margin:0; }
.worksheet-download { display:inline-flex; align-items:center; min-height:44px; text-decoration:none; }
.worksheet-gallery { display:grid; gap:1rem; grid-template-columns:repeat(2,minmax(0,1fr)); }
.worksheet-gallery figure { margin:0; min-width:0; border:1px solid var(--line); border-radius:.8rem; overflow:hidden; background:var(--panel); }
.worksheet-gallery figure:first-child { grid-column:1 / -1; }
.worksheet-gallery figure > a { display:grid; place-items:center; background:#f2f4f0; padding:.65rem; }
.worksheet-gallery img { display:block; width:100%; max-height:34rem; object-fit:contain; }
.worksheet-gallery figcaption { padding:.65rem 1rem; }
.worksheet-details { margin-top:2rem; }
@media (max-width:42rem) {
  .worksheet-filters:not([hidden]), .worksheet-gallery { grid-template-columns:minmax(0,1fr); }
}
