:root {
  --paper: #f5f2ea;
  --surface: #fffdf8;
  --ink: #171714;
  --muted: #6d6a61;
  --line: #d9d4c8;
  --accent: #a44a2a;
  --accent-soft: #f1ded5;
  --danger: #9e2f2f;
  --focus: #2863d7;
  --radius: 18px;
  --shadow: 0 20px 60px rgb(38 31 18 / 8%);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 0%, rgb(164 74 42 / 9%), transparent 30rem),
    var(--paper);
  font-family: "Vazirmatn", Tahoma, Arial, sans-serif;
  line-height: 1.8;
  overflow-x: hidden;
}
a { color: inherit; text-underline-offset: 4px; }
button, input, textarea, select { font: inherit; }
button, label, select { cursor: pointer; }

.shell { width: min(100% - 32px, 760px); margin-inline: auto; padding: 28px 0 72px; }
.site-header { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding-bottom: 42px; }
.wordmark { font-family: Georgia, serif; font-size: 1.12rem; font-weight: 700; text-decoration: none; letter-spacing: -.02em; }
.eyebrow, .kicker { color: var(--accent); font-size: .75rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.intro { padding-bottom: 32px; }
.intro h1 { max-width: 610px; margin: 8px 0 12px; font-size: clamp(2rem, 7vw, 3.6rem); line-height: 1.25; letter-spacing: -.045em; }
.intro > p:last-child { max-width: 610px; margin: 0; color: var(--muted); font-size: 1.02rem; }

.restore-notice, .error-summary { display: flex; justify-content: space-between; align-items: center; gap: 20px; margin-bottom: 24px; padding: 14px 18px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.error-summary { display: block; color: var(--danger); border-color: rgb(158 47 47 / 35%); background: #fff7f5; }
.error-summary p { margin: 0; }
.text-button { padding: 0; border: 0; color: var(--accent); background: none; font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }

.progress-wrap { margin-bottom: 18px; }
.progress-meta { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 9px; color: var(--muted); font-size: .82rem; }
.progress-track { height: 3px; overflow: hidden; background: var(--line); }
.progress-track span { display: block; width: 20%; height: 100%; background: var(--accent); transition: width .35s ease; }

#intake-form { padding: clamp(28px, 6vw, 52px); border: 1px solid rgb(217 212 200 / 80%); border-radius: var(--radius); background: rgb(255 253 248 / 94%); box-shadow: var(--shadow); }
.form-step { animation: step-in .4s cubic-bezier(.22, 1, .36, 1) both; }
@keyframes step-in { from { opacity: 0; transform: translateY(12px); } }
.step-heading { display: flex; align-items: flex-start; gap: 18px; margin-bottom: 34px; }
.step-heading > span { display: grid; place-items: center; flex: 0 0 43px; height: 43px; border: 1px solid var(--ink); border-radius: 50%; font-size: .76rem; }
.step-heading h2 { margin: -3px 0 1px; font-size: 1.45rem; line-height: 1.4; }
.step-heading p { margin: 0; color: var(--muted); font-size: .92rem; }

.field { margin-bottom: 34px; }
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
label, legend { font-size: .96rem; font-weight: 650; line-height: 1.65; }
legend { padding: 0; }
.optional { color: var(--muted); font-size: .75rem; font-weight: 400; }
.hint { margin: 6px 0 13px; color: var(--muted); font-size: .82rem; line-height: 1.7; }
input[type="text"], input[type="email"], input[type="tel"], input[type="url"], textarea, select {
  width: 100%; min-height: 52px; margin-top: 9px; padding: 13px 15px; border: 1px solid var(--line); border-radius: 11px; outline: none; color: var(--ink); background: #fff; transition: border-color .2s, box-shadow .2s, background .2s;
}
textarea { min-height: 112px; resize: vertical; }
input:hover, textarea:hover, select:hover { border-color: #989083; background: #fffefa; }
input:focus-visible, textarea:focus-visible, select:focus-visible, button:focus-visible, a:focus-visible { outline: 3px solid rgb(40 99 215 / 28%); outline-offset: 2px; border-color: var(--focus); }
[aria-invalid="true"] { border-color: var(--danger) !important; box-shadow: 0 0 0 3px rgb(158 47 47 / 10%) !important; }
.field-error { margin: 5px 0 0; color: var(--danger); font-size: .78rem; }

.choice-field, .asset-row { min-width: 0; padding: 0; border: 0; }
.choice-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 13px; }
.choice-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.choice { position: relative; }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice span { display: grid; place-items: center; min-height: 54px; padding: 11px 13px; border: 1px solid var(--line); border-radius: 12px; background: #fff; color: #393832; font-size: .91rem; font-weight: 550; text-align: center; transition: transform .18s, border-color .18s, background .18s, box-shadow .18s; }
.choice:hover span { transform: translateY(-2px); border-color: #aaa397; box-shadow: 0 7px 18px rgb(38 31 18 / 6%); }
.choice input:checked + span { border-color: var(--accent); background: var(--accent-soft); color: #692a16; box-shadow: inset 0 0 0 1px var(--accent); }
.choice input:focus-visible + span { outline: 3px solid rgb(40 99 215 / 28%); outline-offset: 2px; }

.conditional { overflow: hidden; animation: reveal .25s ease both; }
@keyframes reveal { from { opacity: 0; transform: translateY(-5px); } }
.detail-panel { margin: 26px 0 36px; padding: clamp(20px, 4vw, 28px); border: 1px solid var(--line); border-radius: 16px; background: #faf8f2; }
.detail-panel h3 { margin: 0 0 22px; font-size: 1.05rem; }
.detail-panel .field:last-child { margin-bottom: 0; }
.consent { display: flex; align-items: flex-start; gap: 10px; padding: 16px; border: 1px solid var(--line); border-radius: 10px; background: #faf8f2; font-size: .86rem; font-weight: 400; }
.consent input { flex: 0 0 auto; width: 18px; height: 18px; margin-top: 5px; accent-color: var(--accent); }

.asset-shortcut { margin: -8px 0 24px; }
.asset-table { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.asset-head, .asset-row { display: grid; grid-template-columns: minmax(150px, 1.7fr) repeat(4, minmax(76px, 1fr)); align-items: center; }
.asset-head { padding: 11px 14px; color: var(--muted); background: #f2efe7; font-size: .74rem; font-weight: 650; text-align: center; }
.asset-head span:first-child { text-align: right; }
.asset-row { margin: 0; padding: 15px 14px; border-bottom: 1px solid var(--line); transition: background .18s; }
.asset-row:hover { background: #fff; }
.asset-row:last-child { border-bottom: 0; }
.asset-row legend { display: contents; font-size: .83rem; }
.asset-row label { display: grid; min-height: 36px; place-items: center; }
.asset-row label span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.asset-row input { width: 18px; height: 18px; margin: 0; accent-color: var(--accent); }
.asset-followup { margin: 22px 0 0; padding: 14px 16px; border-right: 3px solid var(--accent); border-radius: 9px; color: var(--muted); background: #faf8f2; font-size: .86rem; line-height: 1.8; }
.section-intro { margin: -12px 0 25px; padding: 15px 17px; border-right: 3px solid var(--accent); border-radius: 9px; color: var(--muted); background: #faf8f2; font-size: .9rem; }
.reference-card { margin-bottom: 18px; padding: clamp(20px, 4vw, 26px); border: 1px solid var(--line); border-radius: 15px; background: #fff; animation: reveal .25s ease both; }
.reference-card .field:last-child { margin-bottom: 0; }
.reference-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 17px; }
.reference-number { display: inline-block; color: var(--accent); font-size: .82rem; font-weight: 700; }
.remove-reference { padding: 4px 8px; border: 0; color: var(--danger); background: none; font-size: .78rem; font-weight: 650; }
.add-reference { margin: 0 0 34px; }

.tag-field { position: relative; }
.tag-control { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; min-height: 54px; margin-top: 9px; padding: 7px 10px; border: 1px solid var(--line); border-radius: 11px; background: #fff; transition: border-color .2s, box-shadow .2s; }
.tag-control:focus-within { border-color: var(--focus); box-shadow: 0 0 0 3px rgb(40 99 215 / 14%); }
.tag-list { display: contents; }
.tag { display: inline-flex; align-items: center; gap: 7px; max-width: 100%; min-height: 34px; padding: 4px 10px; border: 1px solid rgb(164 74 42 / 35%); border-radius: 999px; color: #692a16; background: var(--accent-soft); font-size: .82rem; font-weight: 600; }
.tag span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tag button { display: grid; width: 22px; height: 22px; padding: 0; border: 0; border-radius: 50%; place-items: center; color: inherit; background: rgb(164 74 42 / 12%); font-size: 1rem; line-height: 1; }
.tag-query { flex: 1 1 160px; min-width: 110px; min-height: 36px !important; margin: 0 !important; padding: 4px !important; border: 0 !important; background: transparent !important; box-shadow: none !important; }
.suggestions { position: absolute; z-index: 10; top: calc(100% - 27px); right: 0; left: 0; max-height: 220px; margin: 0; padding: 6px; overflow-y: auto; border: 1px solid var(--line); border-radius: 11px; list-style: none; background: #fff; box-shadow: 0 16px 35px rgb(38 31 18 / 14%); }
.suggestions li { padding: 9px 11px; border-radius: 7px; cursor: pointer; font-size: .87rem; }
.suggestions li:hover, .suggestions li[aria-selected="true"] { color: #692a16; background: var(--accent-soft); }

.form-actions { display: flex; justify-content: space-between; gap: 12px; margin-top: 36px; padding-top: 26px; border-top: 1px solid var(--line); }
.primary-button, .secondary-button { display: inline-flex; align-items: center; justify-content: center; min-height: 47px; padding: 11px 22px; border-radius: 999px; font-weight: 700; text-decoration: none; transition: transform .16s, background .16s; }
.primary-button { border: 1px solid var(--ink); color: #fff; background: var(--ink); }
.primary-button:hover { transform: translateY(-1px); background: #30302b; }
.secondary-button { border: 1px solid var(--line); color: var(--ink); background: transparent; }
.secondary-button:hover { transform: translateY(-1px); background: #f2efe7; }
.submit-button { gap: 10px; }
.submit-button[aria-busy="true"] { pointer-events: none; opacity: .72; }
.spinner { display: none; width: 17px; height: 17px; border: 2px solid rgb(255 255 255 / 35%); border-top-color: white; border-radius: 50%; animation: spin .7s linear infinite; }
[aria-busy="true"] .spinner { display: block; }
@keyframes spin { to { transform: rotate(1turn); } }
.autosave-note { margin: 18px 0 -10px; color: var(--muted); font-size: .75rem; text-align: center; }
.status-dot { display: inline-block; width: 6px; height: 6px; margin-left: 6px; border-radius: 50%; background: #4d8752; }
.honeypot {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0 0 0 0) !important;
  clip-path: inset(50%) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.success { padding: clamp(34px, 7vw, 64px); border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); text-align: center; animation: step-in .4s ease both; }
.success-mark { display: grid; place-items: center; width: 58px; height: 58px; margin: 0 auto 22px; border-radius: 50%; color: white; background: var(--accent); font-size: 1.7rem; }
.success h2 { margin: 0 0 12px; font-size: 2rem; }
.success p { max-width: 570px; margin: 6px auto; color: var(--muted); }
.success-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 30px; }
.noscript { margin: 20px; padding: 16px; border: 1px solid var(--danger); text-align: center; }
[hidden] { display: none !important; }

@media (max-width: 640px) {
  .shell { width: min(100% - 20px, 760px); padding-top: 18px; }
  .site-header { padding-bottom: 28px; }
  #intake-form { padding: 27px 17px; }
  .field-grid, .choice-grid.three { grid-template-columns: 1fr; }
  .choice-grid { gap: 9px; }
  .asset-head { display: none; }
  .asset-table { display: grid; gap: 12px; border: 0; overflow: visible; }
  .asset-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; padding: 15px; border: 1px solid var(--line); border-radius: 13px; background: #fff; }
  .asset-row legend { display: block; grid-column: 1 / -1; width: 100%; margin-bottom: 3px; font-size: .9rem; font-weight: 700; }
  .asset-row label { display: flex; min-width: 0; min-height: 62px; padding: 7px 5px; flex-direction: column; gap: 6px; border: 1px solid var(--line); border-radius: 9px; font-size: .69rem; font-weight: 500; text-align: center; }
  .asset-row label:has(input:checked) { border-color: var(--accent); color: #692a16; background: var(--accent-soft); }
  .asset-row label span { position: static; width: auto; height: auto; overflow: visible; clip: auto; }
  .form-actions { align-items: stretch; }
  .form-actions button { flex: 1; padding-inline: 14px; }
}

@media (max-width: 420px) {
  .shell { width: min(100% - 14px, 760px); }
  .site-header { gap: 12px; }
  .eyebrow { font-size: .65rem; }
  .intro h1 { font-size: 2rem; }
  .choice-grid { grid-template-columns: 1fr; }
  .asset-row { grid-template-columns: 1fr; }
  .asset-row label { min-height: 48px; flex-direction: row; justify-content: flex-start; padding-inline: 12px; text-align: right; }
  .reference-card { padding-inline: 15px; }
}

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