:root {
  color-scheme: light dark;
  --page: #f2f4ee;
  --surface: #fafbf7;
  --surface-strong: #e6e9df;
  --ink: #182019;
  --muted: #5d685f;
  --line: #ccd2c8;
  --accent: #166447;
  --accent-ink: #f4fff9;
  --danger: #a13939;
  --shadow: 0 22px 70px rgba(33, 49, 38, .12);
  --radius: 14px;
  --font: "Aptos", "Segoe UI Variable", "Segoe UI", sans-serif;
  --mono: "Cascadia Mono", "SFMono-Regular", Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --page: #151916;
    --surface: #1c211d;
    --surface-strong: #272e28;
    --ink: #eef3ec;
    --muted: #acb7ad;
    --line: #3b463d;
    --accent: #65bd91;
    --accent-ink: #102218;
    --danger: #ff9d9d;
    --shadow: 0 22px 70px rgba(0, 0, 0, .32);
  }
}

:root[data-theme="dark"] {
  --page: #151916;
  --surface: #1c211d;
  --surface-strong: #272e28;
  --ink: #eef3ec;
  --muted: #acb7ad;
  --line: #3b463d;
  --accent: #65bd91;
  --accent-ink: #102218;
  --danger: #ff9d9d;
  --shadow: 0 22px 70px rgba(0, 0, 0, .32);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; overflow-x: hidden; color: var(--ink); background: var(--page); font-family: var(--font); line-height: 1.5; }
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }

.skip-link { position: fixed; left: 16px; top: -60px; z-index: 20; padding: 10px 14px; background: var(--ink); color: var(--page); border-radius: 8px; }
.skip-link:focus { top: 16px; }
.site-header { min-height: 68px; width: min(1400px, calc(100% - 40px)); margin: 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 24px; border-bottom: 1px solid var(--line); }
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 750; text-decoration: none; letter-spacing: -.02em; }
.brand-mark { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; background: var(--accent); color: var(--accent-ink); font: 700 12px var(--mono); }
nav { display: flex; align-items: center; gap: 24px; white-space: nowrap; }
nav a { font-size: 14px; text-decoration: none; color: var(--muted); }
nav a:hover { color: var(--ink); }
.icon-button { width: 38px; height: 38px; border: 1px solid var(--line); border-radius: 10px; color: var(--ink); background: transparent; cursor: pointer; }

.hero { width: min(1400px, calc(100% - 40px)); min-height: calc(100dvh - 68px); margin: 0 auto; padding: 72px 0; display: grid; grid-template-columns: minmax(0, .95fr) minmax(420px, 1.05fr); align-items: center; gap: clamp(40px, 6vw, 96px); }
.eyebrow { margin: 0 0 18px; color: var(--accent); font: 700 12px var(--mono); letter-spacing: .12em; text-transform: uppercase; }
h1 { max-width: 760px; margin: 0; font-size: clamp(52px, 5.8vw, 88px); line-height: .94; letter-spacing: -.065em; font-weight: 750; }
.hero-subtitle { max-width: 480px; margin: 26px 0 0; color: var(--muted); font-size: clamp(17px, 1.5vw, 21px); }
.hero-actions { margin-top: 32px; display: flex; flex-wrap: wrap; gap: 10px; }
.button { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid transparent; border-radius: 10px; padding: 0 18px; font-weight: 700; font-size: 14px; text-decoration: none; white-space: nowrap; cursor: pointer; transition: transform .18s ease, background .18s ease, border-color .18s ease; }
.button:active { transform: translateY(1px); }
.button-primary { background: var(--accent); color: var(--accent-ink); }
.button-primary:hover { filter: brightness(.94); }
.button-secondary { background: transparent; color: var(--ink); border-color: var(--line); }
.button-secondary:hover, .button-quiet:hover { background: var(--surface-strong); }
.button-quiet { min-height: 38px; padding: 0 12px; color: var(--muted); background: transparent; border-color: transparent; }
.button-quiet.danger { color: var(--danger); }

.hero-visual { position: relative; }
.hero-visual::before { content: ""; position: absolute; inset: 10% -4% -6% 10%; border-radius: var(--radius); background: var(--surface-strong); transform: rotate(3deg); }
.sample-quote { position: relative; width: min(100%, 650px); min-height: 570px; margin-left: auto; padding: clamp(28px, 5vw, 64px); border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); transform: rotate(-1.5deg); }
.sample-head { display: flex; align-items: center; gap: 14px; padding-bottom: 54px; }
.sample-logo { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 10px; background: var(--ink); color: var(--page); font: 700 12px var(--mono); }
.sample-head div { display: grid; }
.sample-head small { color: var(--muted); }
.sample-title { margin-bottom: 38px; font-size: clamp(28px, 4vw, 44px); font-weight: 750; letter-spacing: -.04em; }
.sample-row, .sample-total, .sample-deposit { display: flex; justify-content: space-between; gap: 20px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.sample-total { margin-top: 24px; font-size: 20px; }
.sample-deposit { color: var(--accent); border: 0; }

.proof-strip { width: min(1400px, calc(100% - 40px)); margin: 0 auto; padding: 18px 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); color: var(--muted); font: 600 12px var(--mono); text-align: center; text-transform: uppercase; letter-spacing: .06em; }
.how { width: min(1100px, calc(100% - 40px)); margin: 0 auto; padding: 120px 0; }
.section-heading { max-width: 680px; }
h2 { margin: 0; font-size: clamp(38px, 5vw, 68px); line-height: 1; letter-spacing: -.05em; }
.section-heading p, .builder-intro > p:last-child, .ownership p { max-width: 600px; color: var(--muted); font-size: 18px; }
.process-grid { margin-top: 64px; display: grid; grid-template-columns: 1.15fr .85fr; gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.process-grid article { min-height: 220px; padding: 36px; background: var(--surface); }
.process-grid article:first-child { grid-row: span 2; display: flex; flex-direction: column; justify-content: flex-end; background: var(--accent); color: var(--accent-ink); }
.process-grid article:first-child p { color: var(--accent-ink); opacity: .82; }
.process-grid strong { font-size: 28px; letter-spacing: -.03em; }
.process-grid p { max-width: 360px; color: var(--muted); }

.builder-section { width: min(1500px, calc(100% - 24px)); margin: 0 auto; padding: 96px 0 120px; }
.builder-intro { width: min(1200px, calc(100% - 32px)); margin: 0 auto 42px; }
.app-shell { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(440px, .95fr); min-height: 900px; border: 1px solid var(--line); border-radius: var(--radius); overflow: clip; background: var(--surface); box-shadow: var(--shadow); }
.workspace { padding: clamp(24px, 4vw, 52px); border-right: 1px solid var(--line); }
.workspace-toolbar { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; padding-bottom: 26px; border-bottom: 1px solid var(--line); }
.template-control { min-width: 220px; }
.toolbar-actions { display: flex; gap: 2px; }
form { display: grid; gap: 0; }
fieldset { min-width: 0; margin: 0; padding: 34px 0; border: 0; border-bottom: 1px solid var(--line); }
legend { margin-bottom: 18px; font-weight: 750; font-size: 17px; }
.pricing-fieldset { position: relative; }
.add-item-button { position: absolute; top: 34px; right: 0; }
.text-button { padding: 4px; border: 0; color: var(--accent); background: transparent; font-weight: 700; cursor: pointer; }
.field-grid { display: grid; gap: 18px; }
.field-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.field-grid.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
label { display: grid; gap: 7px; color: var(--muted); font-size: 12px; font-weight: 700; letter-spacing: .02em; }
input, select, textarea { width: 100%; min-height: 44px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 9px; outline: 0; color: var(--ink); background: var(--page); }
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible { border-color: var(--accent); outline: 3px solid color-mix(in srgb, var(--accent) 24%, transparent); outline-offset: 2px; }
.line-items { display: grid; gap: 12px; }
.line-item { display: grid; grid-template-columns: minmax(180px, 1fr) 90px 120px 110px 34px; align-items: end; gap: 10px; }
.line-amount { min-height: 44px; display: flex; align-items: center; justify-content: flex-end; font-family: var(--mono); font-size: 13px; }
.remove-item { width: 34px; height: 44px; border: 0; color: var(--muted); background: transparent; font-size: 22px; cursor: pointer; }
.remove-item:hover { color: var(--danger); }

.preview-pane { padding: clamp(20px, 3vw, 44px); background: var(--surface-strong); }
.preview-actions { display: flex; align-items: center; justify-content: flex-end; gap: 10px; margin-bottom: 20px; }
#saveStatus { margin-right: auto; color: var(--muted); font-size: 12px; }
.quote-document { min-height: 760px; padding: clamp(30px, 5vw, 62px); border-radius: var(--radius); color: #202720; background: #fbfcf8; box-shadow: 0 18px 50px rgba(29, 39, 31, .12); }
.quote-header { display: flex; justify-content: space-between; gap: 32px; padding-bottom: 46px; border-bottom: 2px solid #202720; }
.quote-kicker, .quote-client > span, .quote-notes > span { display: block; margin-bottom: 8px; color: #596359; font: 700 10px var(--mono); text-transform: uppercase; letter-spacing: .1em; }
.quote-header h3 { margin: 0; font-size: 21px; }
.quote-header p, .quote-client p { margin: 4px 0 0; color: #596359; }
.quote-meta { display: grid; align-content: start; gap: 4px; text-align: right; font: 12px var(--mono); }
.quote-client { padding: 36px 0 18px; }
.quote-client strong { font-size: 18px; }
.quote-document h4 { margin: 18px 0 28px; font-size: 36px; line-height: 1; letter-spacing: -.04em; }
.quote-lines { border-top: 1px solid #cbd1c8; }
.quote-lines > div { display: grid; grid-template-columns: 1fr auto; gap: 4px 16px; padding: 14px 0; border-bottom: 1px solid #cbd1c8; }
.quote-lines small { color: #667067; grid-column: 1; }
.quote-lines strong { grid-column: 2; grid-row: 1 / span 2; align-self: center; font-family: var(--mono); }
.quote-totals { width: min(100%, 360px); margin: 26px 0 44px auto; }
.quote-totals > div { display: flex; justify-content: space-between; gap: 20px; padding: 7px 0; }
.quote-totals strong { font-family: var(--mono); }
.quote-totals .grand-total { margin-top: 8px; padding-top: 14px; border-top: 2px solid #202720; font-size: 19px; }
.quote-totals .deposit-total { color: #166447; font-weight: 750; }
.quote-notes { padding-top: 22px; border-top: 1px solid #cbd1c8; }
.quote-notes p { white-space: pre-line; }
.quote-document footer { margin-top: 50px; color: #596359; font-size: 12px; }

.ownership { width: min(1100px, calc(100% - 40px)); margin: 0 auto 120px; padding: 54px; display: flex; align-items: center; justify-content: space-between; gap: 48px; border-radius: var(--radius); background: var(--ink); color: var(--page); }
.ownership h2 { max-width: 600px; font-size: clamp(36px, 4vw, 58px); }
.ownership p { color: var(--page); opacity: .72; }
.site-footer { width: min(1400px, calc(100% - 40px)); margin: 0 auto; padding: 28px 0 44px; display: flex; justify-content: space-between; gap: 20px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; }
.toast { position: fixed; right: 24px; bottom: 24px; z-index: 10; max-width: 360px; padding: 13px 16px; border-radius: 10px; color: var(--accent-ink); background: var(--accent); box-shadow: var(--shadow); font-weight: 700; }

@media (max-width: 1050px) {
  .hero { grid-template-columns: 1fr 1fr; gap: 44px; }
  .app-shell { grid-template-columns: 1fr; }
  .workspace { border-right: 0; border-bottom: 1px solid var(--line); }
  .field-grid.four { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 760px) {
  .site-header { width: calc(100% - 28px); }
  nav a { display: none; }
  .hero { width: calc(100% - 28px); min-height: auto; padding: 58px 0 86px; grid-template-columns: 1fr; gap: 56px; }
  h1 { font-size: clamp(52px, 16vw, 78px); }
  .sample-quote { min-height: 480px; padding: 28px; }
  .proof-strip { width: calc(100% - 28px); grid-template-columns: repeat(2, 1fr); }
  .how { width: calc(100% - 28px); padding: 84px 0; }
  .process-grid { grid-template-columns: 1fr; }
  .process-grid article:first-child { grid-row: auto; min-height: 280px; }
  .builder-section { width: 100%; padding: 76px 0; }
  .app-shell { border-left: 0; border-right: 0; border-radius: 0; }
  .workspace-toolbar { align-items: stretch; flex-direction: column; }
  .toolbar-actions { flex-wrap: wrap; }
  .field-grid.two, .field-grid.four { grid-template-columns: 1fr; }
  .add-item-button { top: 32px; }
  .line-item { grid-template-columns: 1fr 1fr 34px; padding: 18px; border: 1px solid var(--line); border-radius: 10px; }
  .description-field { grid-column: 1 / -1; }
  .line-amount { grid-column: 1 / span 2; justify-content: flex-start; }
  .remove-item { grid-column: 3; grid-row: 2; }
  .preview-actions { align-items: stretch; flex-wrap: wrap; }
  #saveStatus { width: 100%; }
  .preview-actions .button { flex: 1; }
  .quote-header { flex-direction: column; }
  .quote-meta { text-align: left; }
  .quote-document h4 { font-size: 30px; }
  .ownership { width: calc(100% - 28px); margin-bottom: 80px; padding: 34px 26px; align-items: flex-start; flex-direction: column; }
  .site-footer { width: calc(100% - 28px); flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: .01ms !important; }
}

@media print {
  @page { size: letter; margin: 0; }
  body { background: white; }
  .site-header, .hero, .proof-strip, .how, .builder-intro, .workspace, .preview-actions, .ownership, .site-footer, .toast { display: none !important; }
  .builder-section, .app-shell, .preview-pane { width: 100%; min-height: 0; margin: 0; padding: 0; border: 0; box-shadow: none; background: white; }
  .quote-document { min-height: 100vh; padding: .65in; border: 0; border-radius: 0; box-shadow: none; print-color-adjust: exact; -webkit-print-color-adjust: exact; }
}

