:root {
  --bg: #FAF8F4;
  --bg-panel: #FFFFFF;
  --bg-sunken: #F3EFE7;
  --ink: #1A1A1A;
  --ink-soft: #4A4A4A;
  --ink-muted: #8A8578;
  --rule: #E5DFD2;
  --rule-strong: #CFC7B4;
  --accent: #B8472D;
  --accent-hover: #9E3D27;
  --accent-soft: #F4E4DC;
  --ok: #3A6B47;
  --ok-soft: #E4EDE2;
  --warn: #9A7B1F;
  --warn-soft: #F4ECD4;
  --err: #9A3A2A;
  --err-soft: #F4E0DA;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  font-family: 'Inter Tight', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-weight: 400;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.55;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.wrap { max-width: 1180px; margin: 0 auto; padding: 0 24px; }
@media (min-width: 768px) { .wrap { padding: 0 48px; } }

.narrow { max-width: 680px; margin: 0 auto; padding: 0 24px; }

/* Masthead */
header.masthead {
  border-bottom: 1px solid var(--rule-strong);
  padding: 48px 0 40px;
  background: var(--bg);
}
.masthead-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 40px;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-muted);
  flex-wrap: wrap;
  gap: 16px;
}
.masthead-top .doc-id { display: flex; gap: 24px; flex-wrap: wrap; }
.masthead h1 {
  font-family: 'Fraunces', Georgia, serif;
  font-weight: 400;
  font-size: clamp(40px, 6vw, 72px);
  line-height: 1.02;
  letter-spacing: -0.02em;
  margin-bottom: 20px;
}
.masthead h1 em { font-style: italic; color: var(--accent); }
.masthead .kicker {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin-bottom: 28px;
}
.masthead .deck {
  font-family: 'Fraunces', Georgia, serif;
  font-weight: 300;
  font-size: 20px;
  line-height: 1.45;
  color: var(--ink-soft);
  max-width: 620px;
  margin-top: 24px;
}
@media (min-width: 768px) { .masthead .deck { font-size: 22px; } }

/* Pill */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border: 1px solid var(--rule-strong);
  border-radius: 999px;
  background: var(--bg-panel);
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.pill .dot {
  width: 6px; height: 6px; border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

/* Button */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 28px;
  font-family: 'Inter Tight', sans-serif;
  font-weight: 600;
  font-size: 16px;
  border-radius: 10px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
  text-decoration: none;
  line-height: 1;
}
.btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover { background: var(--accent-hover); text-decoration: none; }
.btn-primary:disabled { background: var(--rule-strong); cursor: not-allowed; }
.btn-outline {
  background: var(--bg-panel);
  color: var(--ink);
  border-color: var(--rule-strong);
}
.btn-outline:hover { border-color: var(--ink); text-decoration: none; }
.btn-lg { padding: 16px 36px; font-size: 17px; }

/* Sections */
section { padding: 56px 0; border-top: 1px solid var(--rule); }
@media (min-width: 768px) { section { padding: 72px 0; } }
section.sunken { background: var(--bg-sunken); }
section h2 {
  font-family: 'Fraunces', Georgia, serif;
  font-weight: 400;
  font-size: clamp(28px, 4vw, 40px);
  line-height: 1.1;
  letter-spacing: -0.015em;
  text-align: center;
  margin-bottom: 12px;
}
section h2 em { font-style: italic; color: var(--accent); }
section .section-sub {
  text-align: center;
  color: var(--ink-soft);
  max-width: 560px;
  margin: 0 auto 40px;
}

/* Card */
.card {
  background: var(--bg-panel);
  border: 1px solid var(--rule);
  border-radius: 14px;
  padding: 20px;
}
.card.lg { padding: 32px; }
@media (min-width: 768px) { .card.lg { padding: 40px; } }

/* Row cards */
.row-list { display: flex; flex-direction: column; gap: 12px; }
.row-card {
  display: flex;
  gap: 16px;
  padding: 20px;
  background: var(--bg-panel);
  border: 1px solid var(--rule);
  border-radius: 12px;
}
.row-card .icon {
  flex-shrink: 0;
  width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  background: var(--accent-soft);
  border-radius: 10px;
  color: var(--accent);
  font-size: 18px;
}
.row-card .icon.step {
  background: var(--accent);
  color: #fff;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 600;
  font-size: 14px;
  border-radius: 999px;
}
.row-card h3 {
  font-family: 'Fraunces', Georgia, serif;
  font-weight: 500;
  font-size: 18px;
  margin-bottom: 4px;
  color: var(--ink);
}
.row-card p { color: var(--ink-soft); font-size: 15px; }

/* Grid */
.grid-3 {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}
@media (min-width: 640px) { .grid-3 { grid-template-columns: repeat(3, 1fr); } }
.detail-card {
  background: var(--bg-panel);
  border: 1px solid var(--rule);
  border-radius: 12px;
  padding: 20px;
  text-align: center;
}
.detail-card .icon {
  margin: 0 auto 12px;
  width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: 10px;
  font-size: 18px;
}
.detail-card h3 {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 17px;
  font-weight: 500;
  margin-bottom: 4px;
}
.detail-card p { color: var(--ink-soft); font-size: 14px; }

/* Checklist */
.checklist { list-style: none; display: flex; flex-direction: column; gap: 12px; }
.checklist li {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  font-size: 16px;
  color: var(--ink-soft);
}
.checklist .check {
  flex-shrink: 0;
  margin-top: 2px;
  width: 22px; height: 22px;
  border-radius: 999px;
  background: var(--ok-soft);
  color: var(--ok);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px;
  font-weight: 700;
}
.checklist.negative .check {
  background: var(--err-soft);
  color: var(--err);
}
.checklist.negative li { color: var(--ink-muted); }

/* Hero */
.hero {
  min-height: 70vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 56px 24px;
}
.hero-inner { max-width: 640px; }
.hero h1 {
  font-family: 'Fraunces', Georgia, serif;
  font-weight: 400;
  font-size: clamp(36px, 5.5vw, 64px);
  line-height: 1.02;
  letter-spacing: -0.02em;
  margin: 20px 0 16px;
}
.hero h1 em { font-style: italic; color: var(--accent); }
.hero .sub {
  font-size: 18px;
  color: var(--ink-soft);
  margin-bottom: 8px;
}
.hero .pay {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink);
  margin-bottom: 32px;
}
.hero .fine-print { font-size: 14px; color: var(--ink-muted); margin-top: 12px; }

/* Form */
.field { margin-bottom: 18px; }
.field label {
  display: block;
  font-weight: 500;
  font-size: 15px;
  margin-bottom: 6px;
  color: var(--ink);
}
.field .hint { display: block; color: var(--ink-muted); font-size: 13px; margin-top: 4px; }
.field input[type="text"],
.field input[type="email"],
.field input[type="tel"],
.field input[type="number"],
.field input[type="url"],
.field input[type="date"],
.field select,
.field textarea {
  width: 100%;
  padding: 12px 14px;
  font-family: 'Inter Tight', sans-serif;
  font-size: 16px;
  border: 1px solid var(--rule-strong);
  border-radius: 10px;
  background: var(--bg-panel);
  color: var(--ink);
  transition: border-color 0.15s ease;
  -webkit-appearance: none;
  appearance: none;
}
/* Re-enable native calendar picker icon on date inputs (appearance:none hides it on WebKit) */
.field input[type="date"] {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%238A8578' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><rect x='3' y='4' width='18' height='18' rx='2' ry='2'/><line x1='16' y1='2' x2='16' y2='6'/><line x1='8' y1='2' x2='8' y2='6'/><line x1='3' y1='10' x2='21' y2='10'/></svg>");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 40px;
}
.field input[type="date"]::-webkit-calendar-picker-indicator {
  opacity: 0;
  position: absolute;
  right: 0;
  width: 40px;
  height: 100%;
  cursor: pointer;
}
/* Custom dropdown arrow for select (appearance:none strips native) */
.field select {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%238A8578' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 40px;
}
.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.field textarea { min-height: 120px; resize: vertical; font-family: inherit; }

.option-btn {
  width: 100%;
  text-align: left;
  padding: 14px 16px;
  background: var(--bg-panel);
  border: 2px solid var(--rule);
  border-radius: 12px;
  font-family: 'Inter Tight', sans-serif;
  font-size: 16px;
  color: var(--ink);
  cursor: pointer;
  transition: all 0.15s ease;
  margin-bottom: 10px;
  display: block;
}
.option-btn:hover { border-color: var(--accent); }
.option-btn.selected {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.option-btn .desc {
  display: block;
  font-size: 14px;
  color: var(--ink-muted);
  margin-top: 4px;
}

/* Progress bar */
.progress-wrap { margin-bottom: 28px; }
.progress-meta {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--ink-muted);
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  margin-bottom: 8px;
}
.progress-bar {
  height: 6px;
  background: var(--rule);
  border-radius: 999px;
  overflow: hidden;
}
.progress-bar .fill {
  height: 100%;
  background: var(--accent);
  border-radius: 999px;
  transition: width 0.3s ease;
}

/* Alerts */
.alert {
  padding: 14px 16px;
  border-radius: 10px;
  font-size: 14px;
  margin-bottom: 16px;
}
.alert-err {
  background: var(--err-soft);
  color: var(--err);
  border: 1px solid var(--err);
}
.alert-warn {
  background: var(--warn-soft);
  color: var(--warn);
  border: 2px solid var(--warn);
}
.alert-warn strong { color: var(--warn); }
.alert-warn ul { margin-top: 8px; padding-left: 20px; }
.alert-warn li { margin-bottom: 6px; }

/* Nav bottom */
.nav-actions {
  margin-top: 28px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

/* Center */
.center { text-align: center; }

/* Success state */
.success-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 64px; height: 64px;
  background: var(--ok-soft);
  color: var(--ok);
  border-radius: 999px;
  margin: 0 auto 20px;
  font-size: 32px;
}

.envelope-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 64px; height: 64px;
  background: var(--bg-sunken);
  color: var(--ink-soft);
  border-radius: 999px;
  margin: 0 auto 20px;
  font-size: 28px;
}

h1.page-title {
  font-family: 'Fraunces', Georgia, serif;
  font-weight: 400;
  font-size: clamp(30px, 4.5vw, 44px);
  line-height: 1.08;
  letter-spacing: -0.015em;
  margin-bottom: 12px;
}
.page-sub {
  color: var(--ink-soft);
  font-size: 17px;
  margin-bottom: 32px;
}

/* Tool chip */
.tool-chip {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  background: var(--bg-sunken);
  border: 1px solid var(--rule);
  border-radius: 6px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--ink-soft);
  margin-right: 6px;
}

/* Upload area */
.upload-box {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 28px 16px;
  border: 2px dashed var(--rule-strong);
  border-radius: 12px;
  background: var(--bg-sunken);
  color: var(--ink-muted);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}
.upload-box:hover { border-color: var(--accent); color: var(--ink); }
.upload-file {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--bg-sunken);
  border: 1px solid var(--rule);
  border-radius: 10px;
}
.upload-file button {
  margin-left: auto;
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--ink-muted);
  font-size: 18px;
}
.upload-file button:hover { color: var(--ink); }

.divider-or {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 14px 0;
  font-size: 12px;
  color: var(--ink-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.divider-or::before, .divider-or::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--rule);
}

/* Footer */
footer {
  padding: 40px 0;
  border-top: 1px solid var(--rule);
  background: var(--bg-sunken);
  margin-top: 0;
}
footer .wrap {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}
footer .brand {
  font-family: 'Fraunces', Georgia, serif;
  font-weight: 500;
  font-size: 18px;
  color: var(--ink);
}
footer .small {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--ink-muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
