/* Hatch design system — measured from the original site.
   Display: Instrument Serif (48 / 36 / 30px, line-height 1–1.1). UI: Inter 16px, -0.02em tracking, line-height 1.35.
   Blue #007AFF, surface #F7F7F7, white cards with a hairline border and a 5px surface ring, pill buttons. */


:root {
  color-scheme: light;
  --blue: #007aff;
  --blue-hover: #006ae0;
  --blue-soft: #e6f1ff;
  --ink: #000;
  --ink-2: rgba(0, 0, 0, .6);
  --ink-3: rgba(0, 0, 0, .45);
  --surface: #f7f7f7;
  --card: #fff;
  --line: rgba(0, 0, 0, .08);
  --line-2: rgba(34, 34, 34, .2);
  --green: #34c759;
  --green-soft: #e8f8ec;
  --orange: #ff9500;
  --orange-soft: #fff3e0;
  --red: #ff3b30;
  --red-soft: #ffebea;
  --scrim: rgba(0, 0, 0, .35);
  --display: "Instrument Serif", Georgia, "Times New Roman", serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Consolas, monospace;
  --r-card: 22px;
  --r-inner: 16px;
  --ring: 0 0 0 5px var(--surface);
  --ease: cubic-bezier(.44, 0, .56, 1);
  --glass: rgba(255, 255, 255, .6);
  --glass-inner: rgba(255, 255, 255, .55);
  --glass-edge: rgba(255, 255, 255, .65);
  /* aliases the shared renderers expect */
  --accent: var(--blue); --accent-hover: var(--blue-hover); --accent-soft: var(--blue-soft); --accent-ink: #0058c4; --on-accent: #fff;
  --text: var(--ink); --text-2: var(--ink-2); --text-3: var(--ink-3); --bg: var(--card); --surface-2: #efefef; --line-strong: var(--line-2);
  --good: #1f9d47; --good-soft: var(--green-soft); --warn: #b86e00; --warn-soft: var(--orange-soft); --danger: #d92d20; --danger-soft: var(--red-soft);
  --font: var(--sans); --serif: var(--display); --radius: var(--r-card); --radius-sm: 12px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--surface); color: var(--ink); font-family: var(--sans); font-size: 16px; line-height: 1.35; letter-spacing: -.02em; -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4, p, ul, ol, dl, dd, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
img, svg { display: block; }
a { color: var(--ink); }
a:hover { color: var(--blue); }
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 12px; top: -60px; background: var(--ink); color: #fff; padding: 10px 14px; border-radius: 999px; z-index: 100; }
.skip:focus { top: 12px; }
.muted { color: var(--ink-3); }
.num { font-variant-numeric: tabular-nums; }
.brand-word { display: block; font-family: var(--display); font-size: 25px; line-height: 1; letter-spacing: 0; white-space: nowrap; }
.serif, .display { font-family: var(--display); font-weight: 400; letter-spacing: 0; }
.eyebrow { font-size: 13px; font-weight: 600; color: var(--ink-3); letter-spacing: -.01em; }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 44px; padding: 0 20px; border-radius: 999px; border: 0; background: var(--card); color: var(--ink); font-weight: 600; font-size: 15px; text-decoration: none; cursor: pointer; white-space: nowrap; box-shadow: inset 0 0 0 1px var(--line), 0 1px 2px rgba(0,0,0,.04); transition: background .25s var(--ease), color .25s var(--ease), transform .2s var(--ease); }
.btn:hover { background: #fafafa; color: var(--ink); }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--blue); color: #fff; box-shadow: none; }
.btn-primary:hover { background: var(--blue-hover); color: #fff; }
.btn-ghost { background: transparent; box-shadow: none; }
.btn-ghost:hover { background: rgba(0,0,0,.05); }
.btn-danger { color: var(--red); }
.btn-sm { height: 36px; padding: 0 14px; font-size: 14px; }
.btn-block { width: 100%; }
.btn svg { width: 18px; height: 18px; flex: none; }
.icon-btn { width: 36px; height: 36px; border-radius: 50%; border: 0; background: transparent; display: inline-grid; place-items: center; cursor: pointer; color: var(--ink-2); }
.icon-btn:hover { background: rgba(0,0,0,.06); color: var(--ink); }
.icon-btn svg { width: 18px; height: 18px; }
.round-btn { width: 48px; height: 48px; border-radius: 50%; border: 0; background: rgba(0,0,0,.06); display: inline-grid; place-items: center; cursor: pointer; flex: none; font-weight: 700; letter-spacing: 1px; }
.round-btn:hover { background: rgba(0,0,0,.1); }

/* ---------- Forms ---------- */
.field { display: grid; gap: 6px; }
.field > span, .label { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.field small { color: var(--ink-3); font-size: 12px; }
.input, .select, .textarea { width: 100%; min-height: 44px; padding: 10px 14px; border-radius: 12px; border: 0; background: var(--card); box-shadow: inset 0 0 0 1px var(--line-2); color: var(--ink); }
.textarea { min-height: 88px; resize: vertical; line-height: 1.4; }
.input:focus, .select:focus, .textarea:focus { outline: none; box-shadow: inset 0 0 0 1.5px var(--blue), 0 0 0 4px var(--blue-soft); }
.check { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; font-size: 14px; }
.check input { width: 18px; height: 18px; margin: 1px 0 0; accent-color: var(--blue); flex: none; }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border-radius: 999px; font-size: 13px; font-weight: 600; background: rgba(0,0,0,.05); color: var(--ink-2); white-space: nowrap; }
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge.plain::before { display: none; }
.badge.accent { background: var(--blue-soft); color: var(--blue); }
.badge.good { background: var(--green-soft); color: #1f9d47; }
.badge.good::before { background: var(--green); }
.badge.warn { background: var(--orange-soft); color: #b86e00; }
.badge.warn::before { background: var(--orange); }
.badge.danger { background: var(--red-soft); color: var(--red); }
.demo-flag { display: inline-flex; align-items: center; height: 26px; padding: 0 10px; border-radius: 999px; font-size: 12px; font-weight: 600; color: #b86e00; background: var(--orange-soft); }

/* ---------- Card ---------- */
.card, .box, .tile, .panel { background: var(--card); border-radius: var(--r-card); box-shadow: inset 0 0 0 1px var(--line); }

/* ---------- Sheet (dialog) ---------- */
.sheet { border: 0; border-radius: 28px; padding: 0; width: min(520px, calc(100% - 24px)); max-height: calc(100dvh - 40px); background: rgba(255, 255, 255, .78); backdrop-filter: blur(30px) saturate(1.6); -webkit-backdrop-filter: blur(30px) saturate(1.6); color: var(--ink); box-shadow: 0 30px 80px rgba(0,0,0,.25), var(--ring); }
.sheet::backdrop { background: var(--scrim); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 24px 24px 8px; }
.sheet-head h2 { font-family: var(--display); font-weight: 400; font-size: 30px; line-height: 1.1; letter-spacing: 0; }
.sheet-body { padding: 12px 24px 20px; display: grid; gap: 14px; }
.sheet-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 0 24px 24px; flex-wrap: wrap; }

/* ---------- Toast ---------- */
.toast-wrap { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); display: grid; gap: 8px; z-index: 90; width: min(420px, calc(100% - 32px)); }
.toast { display: flex; align-items: center; gap: 12px; background: rgba(255, 255, 255, .8); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); color: var(--ink); padding: 12px 16px; border-radius: 18px; font-size: 14px; font-weight: 500; box-shadow: 0 10px 30px rgba(0,0,0,.12), inset 0 0 0 1px var(--line); animation: toast-in .35s var(--ease); }
.toast::before { content: ""; width: 28px; height: 28px; flex: none; border-radius: 8px; background: var(--blue) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12l5 5L20 7'/%3E%3C/svg%3E") center/14px no-repeat; }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px) scale(.98); } }

/* ---------- Proposal blocks (shared by builder preview and client page) ---------- */
.proposal { background: var(--card); border-radius: var(--r-card); box-shadow: inset 0 0 0 1px var(--line); }
.pp-block { padding: 28px; border-bottom: 1px solid var(--line); display: grid; gap: 14px; }
.pp-block:last-child { border-bottom: 0; }
.pp-block h2 { font-family: var(--display); font-weight: 400; font-size: 30px; line-height: 1.1; letter-spacing: 0; }
.pp-block h3 { font-size: 16px; font-weight: 600; margin-top: 4px; }
.pp-title { font-family: var(--display); font-size: 36px; line-height: 1.05; font-weight: 400; letter-spacing: 0; }
.pp-intro { color: var(--ink-2); }
.pp-facts { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.pp-facts > div { padding: 12px 14px; border-radius: var(--r-inner); box-shadow: inset 0 0 0 1px var(--line); }
.pp-facts dt { font-size: 12px; color: var(--ink-3); order: 2; }
.pp-facts dd { font-weight: 600; font-size: 14px; }
.pp-facts > div { display: flex; flex-direction: column-reverse; gap: 1px; }
.ticks { display: grid; gap: 8px; color: var(--ink-2); }
.ticks li { padding-left: 26px; position: relative; }
.ticks li::before { content: ""; position: absolute; left: 0; top: 1px; width: 18px; height: 18px; border-radius: 50%; background: var(--brand, var(--blue)) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 12l4 4 8-8'/%3E%3C/svg%3E") center/11px no-repeat; }
.timeline li { display: grid; grid-template-columns: 28px 1fr auto; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 15px; }
.timeline li:last-child { border-bottom: 0; }
.tl-n { width: 24px; height: 24px; border-radius: 50%; background: var(--surface); display: grid; place-items: center; font-size: 12px; font-weight: 600; }
.tiers { display: grid; gap: 10px; }
.tier { position: relative; padding: 16px 18px; border-radius: var(--r-inner); box-shadow: inset 0 0 0 1px var(--line); display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; cursor: pointer; background: var(--card); transition: box-shadow .2s var(--ease); }
.tier input { position: absolute; opacity: 0; pointer-events: none; }
.tier.on { box-shadow: inset 0 0 0 2px var(--brand, var(--blue)); }
.tier:has(input:focus-visible) { outline: 2px solid var(--brand, var(--blue)); outline-offset: 2px; }
.tier-name { font-weight: 600; }
.tier-price { font-weight: 600; grid-row: 1; grid-column: 2; text-align: right; }
.tier-blurb { font-size: 14px; color: var(--ink-3); grid-column: 1 / -1; }
.tier ul { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.tier ul li { font-size: 12px; font-weight: 500; padding: 3px 9px; border-radius: 999px; background: var(--surface); color: var(--ink-2); }
.tier.on::after { content: ""; position: absolute; right: -6px; top: -6px; width: 22px; height: 22px; border-radius: 50%; background: var(--brand, var(--blue)) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 12l4 4 8-8'/%3E%3C/svg%3E") center/12px no-repeat; box-shadow: 0 0 0 3px #fff; }
.addons { display: grid; gap: 8px; }
.addon { display: grid; grid-template-columns: 20px 1fr auto; gap: 10px; align-items: center; padding: 12px 14px; border-radius: var(--r-inner); box-shadow: inset 0 0 0 1px var(--line); cursor: pointer; font-size: 15px; }
.addon input { width: 18px; height: 18px; margin: 0; accent-color: var(--brand, var(--blue)); }
.pp-total { display: flex; justify-content: space-between; align-items: baseline; padding-top: 4px; }
.pp-total span { font-weight: 600; }
.pp-total strong { font-family: var(--display); font-weight: 400; font-size: 36px; letter-spacing: 0; }
.pp-tax { font-size: 13px; margin-top: -10px; text-align: right; }
.schedule { border-radius: var(--r-inner); box-shadow: inset 0 0 0 1px var(--line); }
.schedule li { display: flex; justify-content: space-between; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); font-size: 14px; }
.schedule li:last-child { border-bottom: 0; }
.schedule em { font-style: normal; color: var(--ink-3); font-size: 12px; margin-left: 6px; }
.clauses { display: grid; gap: 8px; }
.clauses details { border-radius: var(--r-inner); box-shadow: inset 0 0 0 1px var(--line); padding: 14px 16px; }
.clauses summary { cursor: pointer; display: grid; gap: 3px; list-style: none; font-size: 15px; }
.clauses summary::-webkit-details-marker { display: none; }
.clauses summary span { color: var(--ink-2); font-size: 14px; }
.clauses summary::after { content: "Show contract wording"; font-size: 12px; color: var(--brand, var(--blue)); font-weight: 600; margin-top: 4px; }
.clauses details[open] summary::after { content: "Hide contract wording"; }
.legal { margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--line-2); font-size: 13px; color: var(--ink-3); font-family: var(--mono); letter-spacing: 0; line-height: 1.5; }

/* ---------- Invoice ---------- */
.invoice { display: grid; gap: 18px; font-size: 14px; }
.inv-head { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.inv-studio { font-family: var(--display); font-size: 24px; letter-spacing: 0; }
.inv-num { font-weight: 600; font-family: var(--mono); letter-spacing: 0; }
.inv-meta { text-align: right; }
.inv-to { padding: 14px 16px; border-radius: var(--r-inner); background: var(--surface); }
.inv-lines { border-radius: var(--r-inner); box-shadow: inset 0 0 0 1px var(--line); padding: 4px 16px; }
.inv-row { display: flex; justify-content: space-between; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.inv-row:last-child { border-bottom: 0; }
.inv-row.sub { color: var(--ink-2); }
.inv-row.tot { font-size: 16px; }
.inv-row.credit { color: var(--red); }
.inv-note { font-size: 12px; color: var(--ink-3); }
.inv-status { font-weight: 600; }

/* ---------- Review canvas and comments ---------- */
.r-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.r-tab { height: 32px; padding: 0 12px; border: 0; border-radius: 999px; background: rgba(0,0,0,.05); font-size: 13px; font-weight: 500; cursor: pointer; }
.r-tab[aria-selected="true"] { background: var(--ink); color: #fff; }
.canvas { position: relative; border-radius: var(--r-inner); overflow: hidden; box-shadow: inset 0 0 0 1px var(--line), var(--ring); cursor: crosshair; user-select: none; }
.canvas svg { width: 100%; height: auto; }
.canvas.readonly { cursor: default; }
.wm { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; }
.wm span { font-family: var(--display); font-size: 40px; color: rgba(255,255,255,.55); transform: rotate(-12deg); text-shadow: 0 1px 2px rgba(0,0,0,.15); }
.pin { position: absolute; width: 26px; height: 26px; margin: -13px 0 0 -13px; border-radius: 50% 50% 50% 4px; background: var(--brand, var(--blue)); color: #fff; font-size: 12px; font-weight: 700; display: grid; place-items: center; box-shadow: 0 0 0 2.5px #fff, 0 4px 10px rgba(0,0,0,.2); cursor: pointer; border: 0; padding: 0; }
.pin.res { background: #8e8e93; }
.pin.draft { background: var(--ink); }
.comments { display: grid; gap: 8px; margin-top: 12px; }
.cmt { display: grid; grid-template-columns: 24px 1fr auto; gap: 10px; padding: 12px 14px; border-radius: var(--r-inner); box-shadow: inset 0 0 0 1px var(--line); align-items: start; background: var(--card); }
.cmt.res { opacity: .55; }
.cmt.hl { box-shadow: inset 0 0 0 2px var(--brand, var(--blue)); }
.cmt .n { width: 22px; height: 22px; border-radius: 50%; background: var(--surface); display: grid; place-items: center; font-size: 11px; font-weight: 700; }
.cmt p { font-size: 14px; }
.cmt small { color: var(--ink-3); font-size: 12px; }
.comment-form { display: grid; gap: 8px; margin-top: 10px; padding: 14px; border-radius: var(--r-inner); background: var(--surface); }
.rounds { display: inline-flex; gap: 4px; align-items: center; font-size: 13px; color: var(--ink-2); font-weight: 500; }
.rounds i { width: 16px; height: 6px; border-radius: 3px; background: rgba(0,0,0,.1); display: inline-block; }
.rounds i.used { background: var(--brand, var(--blue)); }

/* ---------- Files ---------- */
.files { display: grid; gap: 8px; }
.file { display: grid; grid-template-columns: 44px 1fr auto; gap: 12px; align-items: center; padding: 10px 12px 10px 10px; border-radius: var(--r-inner); box-shadow: inset 0 0 0 1px var(--line); background: var(--card); }
.file strong { font-weight: 600; font-size: 14px; }
.file-ic { width: 44px; height: 44px; border-radius: 12px; background: var(--blue); color: #fff; display: grid; place-items: center; font-size: 10px; font-weight: 700; letter-spacing: .02em; }
.file small { color: var(--ink-3); font-size: 12px; }
.lock { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink-3); }

/* ---------- Activity and ledger ---------- */
.activity { display: grid; gap: 12px; font-size: 14px; }
.activity li { display: grid; grid-template-columns: 1fr auto; gap: 8px; color: var(--ink-2); }
.activity time { color: var(--ink-3); white-space: nowrap; font-size: 13px; }
.ledger { display: grid; }
.ledger-row { display: flex; justify-content: space-between; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 14px; align-items: center; }
.ledger-row:last-child { border-bottom: 0; }
.ledger-row button { background: none; border: 0; padding: 0; color: var(--brand, var(--blue)); cursor: pointer; font-weight: 600; font-family: var(--mono); letter-spacing: 0; font-size: 13px; }

/* ---------- Payment methods ---------- */
.methods { display: grid; gap: 8px; }
.method { display: grid; grid-template-columns: 20px 1fr auto; gap: 12px; align-items: center; padding: 14px 16px; border-radius: var(--r-inner); box-shadow: inset 0 0 0 1px var(--line); cursor: pointer; }
.method:has(input:checked) { box-shadow: inset 0 0 0 2px var(--brand, var(--blue)); }
.method input { margin: 0; accent-color: var(--brand, var(--blue)); }
.method strong { font-weight: 600; font-size: 15px; }
.method small { display: block; color: var(--ink-3); font-size: 12px; }
.method .pm { width: 34px; height: 24px; border-radius: 6px; display: grid; place-items: center; font-size: 10px; font-weight: 800; color: #fff; }
.pay-total { display: flex; justify-content: space-between; align-items: baseline; }
.pay-total .display { font-size: 36px; }

@media print {
  .topbar, .app-foot, .sheet-foot, .sheet-head .icon-btn, .toast-wrap, .room-top, .side-actions { display: none !important; }
  body { background: #fff; }
}
