/* ---------- base (shared primitives; each tool sets its own tokens and components below) ---------- */
*,*::before,*::after{box-sizing:border-box}
html{-webkit-text-size-adjust:100%;text-size-adjust:100%}
body{margin:0;font-family:var(--font-body);font-size:1rem;line-height:1.55;color:var(--ink);background:var(--bg);overflow-wrap:break-word}
img,svg{max-width:100%;height:auto}
h1,h2,h3{line-height:1.2;margin:0 0 .5em;font-family:var(--font-head)}
p{margin:0 0 1em}
a{color:var(--link)}
a:hover{text-decoration-thickness:2px}
button,input,select,textarea{font:inherit;color:inherit}
:focus-visible{outline:3px solid var(--focus);outline-offset:2px;border-radius:2px}
input:focus-visible,select:focus-visible,textarea:focus-visible{outline-offset:0}
.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}
.skip{position:absolute;left:8px;top:-60px;z-index:100;background:var(--ink);color:var(--bg);padding:.6rem 1rem;border-radius:6px}
.skip:focus{top:8px}
.wrap{width:100%;max-width:var(--max,1120px);margin:0 auto;padding-inline:16px}
@media (min-width:720px){.wrap{padding-inline:24px}}
[hidden]{display:none!important}

/* header / footer */
.site-header .wrap{display:flex;align-items:center;justify-content:space-between;gap:12px;min-height:60px;flex-wrap:wrap}
.brand{display:inline-flex;align-items:center;gap:.55rem;font-weight:700;text-decoration:none;color:inherit;font-family:var(--font-head)}
.brand svg{width:28px;height:28px;flex:none}
.nav{display:flex;gap:.25rem;flex-wrap:wrap}
.nav a{padding:.45rem .7rem;border-radius:6px;text-decoration:none;color:inherit;font-weight:600}
.nav a:hover{background:var(--hover)}
.site-footer{margin-top:3rem;padding-block:2rem;font-size:.92rem}
.site-footer .wrap{display:flex;flex-wrap:wrap;gap:.5rem 1.5rem;justify-content:space-between;align-items:center}
.site-footer nav{display:flex;flex-wrap:wrap;gap:.25rem 1rem}
.site-footer a{color:inherit}

/* buttons & fields */
.btn{display:inline-flex;align-items:center;justify-content:center;gap:.45rem;min-height:44px;padding:.55rem 1rem;border-radius:var(--radius);border:1px solid var(--line-strong);background:var(--surface);color:var(--ink);font-weight:600;text-decoration:none;cursor:pointer;line-height:1.2}
.btn:hover{background:var(--hover)}
.btn-primary{background:var(--accent);border-color:var(--accent);color:var(--on-accent)}
.btn-primary:hover{background:var(--accent-hover);border-color:var(--accent-hover)}
.btn-ghost{background:transparent;border-color:transparent}
.btn:disabled{opacity:.55;cursor:not-allowed}
.btn-sm{min-height:36px;padding:.35rem .7rem;font-size:.9rem}
label{font-weight:600;font-size:.92rem}
.field{display:flex;flex-direction:column;gap:.3rem;min-width:0}
.field input,.field select,.field textarea,.input{width:100%;min-height:44px;padding:.5rem .65rem;border:1px solid var(--line-strong);border-radius:var(--radius-sm);background:var(--field);}
.field textarea{min-height:88px;resize:vertical}
.hint{font-size:.85rem;color:var(--muted);font-weight:400}
.check{display:flex;align-items:flex-start;gap:.5rem;font-weight:500}
.check input{width:20px;height:20px;margin-top:2px;accent-color:var(--accent);flex:none}
.pro-badge{display:inline-block;font-size:.68rem;font-weight:800;letter-spacing:.06em;text-transform:uppercase;padding:.12rem .4rem;border-radius:4px;background:var(--pro-bg);color:var(--pro-ink);vertical-align:middle}
.is-pro .pro-badge{display:none}

/* prose pages */
.prose{max-width:72ch}
.prose h2{margin-top:2rem}
.prose h3{margin-top:1.5rem}
.prose ul,.prose ol{padding-left:1.3rem;margin:0 0 1em}
.prose li{margin-bottom:.35em}
.page-head{padding-block:2rem 1rem}
.faq details{border-top:1px solid var(--line);padding:.9rem 0}
.faq details:last-child{border-bottom:1px solid var(--line)}
.faq summary{cursor:pointer;font-weight:700;list-style-position:outside}
.faq details p{margin:.6rem 0 0}

/* dialog */
dialog{border:1px solid var(--line-strong);border-radius:var(--radius);padding:1.4rem;max-width:min(92vw,440px);background:var(--surface);color:var(--ink)}
dialog::backdrop{background:rgba(10,12,16,.55)}
dialog h2{font-size:1.25rem}
.dialog-actions{display:flex;gap:.5rem;flex-wrap:wrap;margin-top:1rem}

/* pro page */
.price-card{border:1px solid var(--line-strong);border-radius:var(--radius);background:var(--surface);padding:1.5rem;max-width:520px}
.price{font-size:2.6rem;font-weight:800;line-height:1;font-family:var(--font-head)}
.price small{font-size:1rem;font-weight:600;color:var(--muted)}
.compare{width:100%;border-collapse:collapse;margin:1rem 0;font-size:.95rem}
.compare th,.compare td{text-align:left;padding:.6rem .5rem;border-bottom:1px solid var(--line);vertical-align:top}
.compare td:nth-child(n+2),.compare th:nth-child(n+2){text-align:center;white-space:nowrap}
.table-scroll{overflow-x:auto;-webkit-overflow-scrolling:touch;max-width:100%}
.notice{padding:.8rem 1rem;border-radius:var(--radius-sm);background:var(--notice-bg);border:1px solid var(--line);font-size:.93rem}
.status{min-height:1.5em;font-weight:600}

@media print{
  .site-header,.site-footer,.skip,.no-print{display:none!important}
  body{background:#fff;color:#000}
}
.eyebrow{font-size:.8rem;font-weight:800;letter-spacing:.08em;text-transform:uppercase;color:var(--accent-text);margin-bottom:.4rem}
.lead{font-size:1.1rem;color:var(--muted);max-width:62ch}
.btn-lg{min-height:52px;padding:.7rem 1.4rem;font-size:1.05rem;width:100%}
.pro-grid{display:grid;gap:1.5rem;align-items:start;margin-bottom:2rem}
@media (min-width:860px){.pro-grid{grid-template-columns:minmax(0,420px) minmax(0,1fr)}}
.feature-list{list-style:none;padding:0;margin:0;display:grid;gap:.8rem}
.feature-list li{padding-left:1.1rem;border-left:3px solid var(--accent)}
.feature-list strong{display:block}
.license-form{display:flex;flex-wrap:wrap;gap:.6rem;align-items:flex-end;max-width:560px}
.license-form .field{flex:1 1 240px}
code{font-family:var(--font-mono);font-size:.9em;background:var(--hover);padding:.05em .3em;border-radius:3px}
fieldset{min-width:0;min-inline-size:0}
.wrap.prose{max-width:var(--max,1120px)}
.wrap.prose > *{max-width:72ch}
.wrap.prose > .table-scroll{max-width:100%}
@media (max-width:560px){.nav{margin-left:-.7rem}}

/* ---------- Contractor Estimate Maker: workshop paper, slate and amber ---------- */
:root{
  --font-body:system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;
  --font-head:"Avenir Next Condensed","Roboto Condensed","Arial Narrow",system-ui,-apple-system,"Segoe UI",sans-serif;
  --font-mono:ui-monospace,"SFMono-Regular",Menlo,Consolas,monospace;
  --bg:#F3F0E8; --surface:#FFFFFF; --field:#FFFFFF; --ink:#1C2430; --muted:#4F5866;
  --line:#DDD6C8; --line-strong:#8C8577; --hover:#ECE6D9; --notice-bg:#FFF7E6;
  --accent:#F59E0B; --accent-hover:#FBBF24; --on-accent:#1C2430; --accent-text:#8A4B00;
  --link:#8A4B00; --focus:#1D4ED8; --pro-bg:#1C2430; --pro-ink:#FDE68A;
  --radius:6px; --radius-sm:4px; --max:1240px;
}
.site-header{background:#1C2430;color:#F8F5EE}
.site-header .nav a:hover{background:rgba(255,255,255,.12)}
.site-header :focus-visible{outline-color:#FBBF24}
.site-footer{background:#1C2430;color:#E7E2D6}
.site-footer :focus-visible{outline-color:#FBBF24}
.btn-primary{font-weight:800;border-color:#B87400}
.danger{color:#A11B1B}

.hero{border-bottom:1px solid var(--line);background:repeating-linear-gradient(135deg,#F3F0E8 0 22px,#EFEBE1 22px 44px)}
.hero .wrap{padding-block:2rem 1.6rem}
.hero h1{font-size:clamp(2rem,6vw,3.2rem);font-weight:800;letter-spacing:-.01em;text-transform:uppercase}
.hero .lead{color:#3D4652;margin:0}

.tool{display:grid;gap:1.25rem;padding-block:1.5rem;align-items:start;grid-template-columns:minmax(0,1fr)}
.editor,.preview-col{min-width:0}
@media (min-width:1080px){.tool{grid-template-columns:minmax(0,1fr) minmax(0,1fr)}.preview-col{position:sticky;top:12px;max-height:calc(100vh - 24px);display:flex;flex-direction:column}.paper-scroll{overflow:auto;flex:1 1 auto}}

.panel{border:1px solid var(--line);border-top:4px solid var(--ink);background:var(--surface);border-radius:var(--radius);padding:1rem;margin:0 0 1rem;min-width:0}
.panel legend{font-family:var(--font-head);font-weight:800;text-transform:uppercase;letter-spacing:.04em;font-size:1rem;padding:0 .4rem;background:var(--surface)}
.grid-2,.grid-3,.grid-4{display:grid;gap:.8rem;grid-template-columns:1fr}
@media (min-width:560px){.grid-2{grid-template-columns:1fr 1fr}.grid-3{grid-template-columns:1fr 1fr}.grid-4{grid-template-columns:1fr 1fr}.span-2{grid-column:span 2}}
@media (min-width:900px){.grid-3{grid-template-columns:repeat(3,1fr)}.grid-4{grid-template-columns:repeat(4,1fr)}}
.logo-row,.row-actions{display:flex;flex-wrap:wrap;gap:.5rem;margin-top:.9rem}
.panel .check{margin-top:.8rem}
.items-hint{margin-top:0}

.items{display:grid;gap:.7rem}
.item{display:grid;gap:.5rem;grid-template-columns:1fr 1fr;padding:.75rem;border:1px solid var(--line);border-left:5px solid #6B7280;border-radius:var(--radius-sm);background:#FCFBF8}
.item-labor{border-left-color:#1D4ED8}
.item-material{border-left-color:#B45309}
.item-other{border-left-color:#6B7280}
.item .f-desc{grid-column:1 / -1}
.item label{font-size:.8rem}
.f-amount{display:flex;flex-direction:column;justify-content:flex-end;gap:.2rem}
.f-amount output{font-weight:800;font-variant-numeric:tabular-nums;min-height:44px;display:flex;align-items:center}
.f-tools{grid-column:1 / -1;display:flex;justify-content:flex-end;gap:.25rem;flex-wrap:wrap}
@media (min-width:640px){
  .item{grid-template-columns:minmax(0,1.2fr) .8fr .6fr .8fr .9fr}
  .item .f-desc{grid-column:1 / -1}
  .f-amount{grid-column:5}
  .f-type{grid-column:1}
  .f-tools{grid-column:1 / -1}
}

.actions{display:flex;flex-wrap:wrap;gap:.5rem;margin-bottom:.75rem}
.actions .btn-primary{flex:1 1 100%}
@media (min-width:560px){.actions .btn-primary{flex:0 0 auto}}
.totals-strip{display:flex;justify-content:space-between;align-items:baseline;background:var(--ink);color:#F8F5EE;padding:.6rem .9rem;border-radius:var(--radius);margin:0 0 .75rem}
.totals-strip strong{font-size:1.35rem;font-variant-numeric:tabular-nums;color:#FDE68A}

.paper-scroll{max-width:100%;overflow-x:auto;border-radius:var(--radius)}
.doc{background:#fff;color:#111;border:1px solid var(--line);box-shadow:0 1px 0 var(--line),0 12px 28px -18px rgba(28,36,48,.45);padding:clamp(1rem,4vw,2.2rem);font-size:.86rem;line-height:1.45;min-width:0}
.doc p{margin:0}
.doc-head{display:flex;flex-wrap:wrap;justify-content:space-between;gap:1rem;padding-bottom:1rem;border-bottom:3px solid #1C2430}
.doc-from{min-width:0;flex:1 1 220px}
.doc-logo{max-height:64px;max-width:200px;width:auto;margin-bottom:.4rem;display:block}
.doc-biz{font-family:var(--font-head);font-size:1.3rem;font-weight:800}
.doc-meta{color:#374151;margin-top:.2rem}
.doc-title-block{text-align:right;flex:0 1 auto;margin-left:auto}
.doc-title{font-family:var(--font-head);font-size:1.9rem;font-weight:800;text-transform:uppercase;letter-spacing:.06em;color:#1C2430;line-height:1}
.doc-dl{display:grid;grid-template-columns:auto auto;gap:.1rem .8rem;margin:.6rem 0 0;justify-content:end}
.doc-dl dt{color:#4B5563}
.doc-dl dd{margin:0;font-weight:700}
.doc-parties{display:flex;flex-wrap:wrap;gap:1rem 2.5rem;padding:1rem 0 .6rem}
.doc-label{font-size:.72rem;font-weight:800;text-transform:uppercase;letter-spacing:.08em;color:#6B4200;margin-bottom:.15rem!important}
.doc-job{font-weight:700;font-size:1rem;margin:.2rem 0 .6rem!important}
.doc-table-wrap{overflow-x:auto}
.doc-table{width:100%;border-collapse:collapse;font-variant-numeric:tabular-nums}
.doc-table th,.doc-table td{padding:.42rem .35rem;border-bottom:1px solid #E5E7EB;text-align:left;vertical-align:top}
.doc-table thead th{font-size:.72rem;text-transform:uppercase;letter-spacing:.06em;background:#1C2430;color:#fff;border:0}
.doc-table .num{text-align:right;white-space:nowrap}
.doc-table .unit{white-space:nowrap}
.doc-table .desc{width:46%}
.doc-table tr.group th,.doc-table tr.group td{background:#F3F0E8;font-size:.78rem;text-transform:uppercase;letter-spacing:.06em;color:#1C2430}
.doc-table tr.subtotal td{font-weight:700;border-bottom:2px solid #D1D5DB}
.doc-table tr.subtotal td:first-child{text-align:right}
.doc-table .empty{color:#6B7280;text-align:center;padding:1.2rem}
.doc-totals{display:grid;grid-template-columns:1fr auto;gap:.25rem 1.2rem;margin:1rem 0 0 auto;max-width:360px;font-variant-numeric:tabular-nums}
.doc-totals dt{text-align:right;color:#374151}
.doc-totals dd{margin:0;text-align:right;font-weight:600;white-space:nowrap}
.doc-totals .grand{font-size:1.1rem;font-weight:800;color:#111;border-top:2px solid #1C2430;padding-top:.3rem}
.doc-notes{margin-top:1.4rem;padding-top:.8rem;border-top:1px solid #E5E7EB}
.doc-sign{margin-top:1.4rem}
.doc-accept{font-weight:600}
.sign-lines{display:grid;grid-template-columns:2fr 1fr;gap:1.6rem 1.2rem;margin-top:2rem}
.sign-line{border-top:1px solid #111;padding-top:.2rem;font-size:.75rem;color:#4B5563}
.doc-credit{margin-top:1.6rem!important;font-size:.7rem;color:#6B7280;text-align:center}
.is-invoice .doc-title{color:#8A4B00}
.u-inline{display:none}
@media screen and (max-width:540px){.doc{padding:.8rem}.doc-table{font-size:.76rem}.doc-table th,.doc-table td{padding:.35rem .18rem}.doc-table .unit{display:none}.u-inline{display:inline}.doc-table thead th{letter-spacing:.02em;font-size:.68rem}.doc-table .desc{width:auto}.doc-title{font-size:1.5rem}}

.pick-list{list-style:none;padding:0;margin:0;display:grid;gap:.4rem;max-height:50vh;overflow:auto}
.pick-list li{display:flex;gap:.4rem;align-items:center}
.pick-list .pick{flex:1 1 auto;justify-content:flex-start;text-align:left}

.guide{background:var(--surface);border-top:1px solid var(--line);margin-top:1.5rem;padding-block:2.5rem}
.guide h2{font-family:var(--font-head);text-transform:uppercase;letter-spacing:.02em;font-size:1.6rem}
.guide h3{font-size:1.15rem}
.page-legal .prose h2,.page-pro h2{font-family:var(--font-head);text-transform:uppercase;letter-spacing:.02em}
.page-pro h1{font-size:clamp(1.8rem,5vw,2.6rem)}

@media print{
  @page{margin:12mm}
  .hero,.editor,.guide,.actions,.totals-strip,.status,dialog{display:none!important}
  .tool{display:block;padding:0;max-width:none}
  .preview-col{position:static;max-height:none;display:block}
  .paper-scroll{overflow:visible}
  .doc{border:0;box-shadow:none;padding:0;font-size:10pt}
  .doc-table thead th{-webkit-print-color-adjust:exact;print-color-adjust:exact}
  .doc-table tr{break-inside:avoid}
  .doc-sign{break-inside:avoid}
  .doc-notes{break-inside:avoid}
  .doc-label{break-after:avoid}
  .doc-table th,.doc-table td{padding:.28rem .3rem}
  .doc-parties{padding:.7rem 0 .4rem}
  .doc-totals{margin-top:.6rem}
  .doc-notes,.doc-sign{margin-top:1rem}
  .sign-lines{margin-top:1.6rem;gap:1.3rem 1.2rem}
}
.jump{margin:0 0 .75rem;font-weight:600}
@media (min-width:1080px){.jump{display:none}}
.preview-col:focus{outline:none}
