/* ==========================================================================
   Arya Bastan Hotel — application.hr.aryabastan.com
   Same "night sea & copper" language as aryabastan.com, tuned for long forms.
   Persian (RTL) only: Vazirmatn = text/UI, Yekan Bakh = headings (headings and the accent line).
   ========================================================================== */

@font-face { font-family: "Vazirmatn"; src: url("/assets/fonts/vazirmatn-arabic-wght.woff2") format("woff2"); font-weight: 100 900; font-display: swap; unicode-range: U+0600-06FF, U+0750-077F, U+200C-200F, U+FB50-FDFF, U+FE70-FEFF; }
@font-face { font-family: "Vazirmatn"; src: url("/assets/fonts/vazirmatn-latin-wght.woff2") format("woff2"); font-weight: 100 900; font-display: swap; unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Yekan Bakh"; src: url("/assets/fonts/YekanBakh-Bold.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Yekan Bakh"; src: url("/assets/fonts/YekanBakh-ExtraBold.woff2") format("woff2"); font-weight: 800; font-display: swap; }
@font-face { font-family: "Jost"; src: url("/assets/fonts/jost-400.woff2") format("woff2"); font-weight: 400; font-display: swap; }

:root {
  --deep: #081113;
  --night: #0c1618;
  --night-2: #112022;
  --gold: #c9975f;
  --gold-l: #e6c9a2;
  --gold-d: #9a5a2e;
  --copper: #ad6433;
  --ivory: #f6f1e9;
  --sand: #ede4d6;
  --paper: #fffdf9;
  --ink: #18211f;
  --muted: #5f6662;
  --line: rgba(24, 33, 31, 0.14);
  --line-2: rgba(24, 33, 31, 0.24);
  --bad: #b23b3b;
  --ok: #2f7d4f;
  --r: 12px;
  --ease: cubic-bezier(0.2, 0.7, 0.1, 1);
  --f-text: "Vazirmatn", Tahoma, sans-serif;
  --f-display: "Yekan Bakh", "Vazirmatn", Tahoma, sans-serif;
  --f-latin: "Jost", "Vazirmatn", "Segoe UI", sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 90px; }
html.dp-open { overflow: hidden; }
@media (min-width: 641px) { html.dp-open { overflow: auto; } }
body {
  margin: 0; font-family: var(--f-text); font-size: 1rem; line-height: 1.9; font-weight: 400;
  color: var(--ink); background: var(--ivory); -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4, p { margin: 0; }
a { color: var(--gold-d); }
img { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
::selection { background: var(--copper); color: #fff; }
:focus-visible { outline: 2px solid var(--copper); outline-offset: 2px; }
[dir="ltr"] { font-family: var(--f-latin); }
input[dir="ltr"] { text-align: right; font-family: var(--f-text); } /* typed digits are Persian; keep RTL alignment */
.skip { position: absolute; inset-inline-start: 12px; top: -60px; background: var(--copper); color: #fff; padding: 8px 14px; border-radius: 8px; z-index: 50; }
.skip:focus { top: 12px; }
.hp { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }

/* ---------- Hero ---------- */
.hero {
  position: relative; color: var(--ivory); overflow: hidden;
  background:
    radial-gradient(120% 90% at 85% -10%, rgba(201, 151, 95, 0.22), transparent 55%),
    radial-gradient(90% 70% at 0% 110%, rgba(173, 100, 51, 0.18), transparent 60%),
    linear-gradient(180deg, var(--deep), var(--night-2));
  padding: clamp(28px, 6vw, 64px) 20px clamp(80px, 11vw, 120px);
}
.hero::after { /* dotted arc from the logo */
  content: ""; position: absolute; inset-inline-start: -120px; bottom: -260px; width: 520px; height: 520px; border-radius: 50%;
  border: 2px dotted rgba(230, 201, 162, 0.28); pointer-events: none;
}
.hero-in { position: relative; max-width: 920px; margin: 0 auto; }
.brand { display: inline-flex; align-items: center; gap: 12px; color: var(--ivory); text-decoration: none; margin-bottom: clamp(22px, 4vw, 40px); }
.brand img { width: 56px; height: 56px; border-radius: 50%; background: var(--ivory); padding: 4px; }
.brand span { display: flex; flex-direction: column; line-height: 1.5; }
.brand b { font-family: var(--f-display); font-weight: 800; font-size: 1.1rem; }
.brand small { color: var(--gold-l); font-size: 0.82rem; }
.eyebrow { color: var(--gold); font-weight: 600; font-size: 0.9rem; letter-spacing: 0.02em; display: flex; align-items: center; gap: 10px; }
.eyebrow::before { content: ""; width: 34px; height: 1px; background: var(--gold); }
.hero h1 { font-family: var(--f-display); font-weight: 800; font-size: clamp(2rem, 6.4vw, 3.4rem); line-height: 1.35; margin-top: 6px; }
.accent { font-family: var(--f-display); font-weight: 700; color: var(--gold-l); font-size: clamp(1.25rem, 3.4vw, 1.7rem); margin-top: 2px; }
.lead { color: rgba(246, 241, 233, 0.78); max-width: 620px; margin-top: 14px; }
.facts { list-style: none; padding: 0; margin: 22px 0 0; display: flex; flex-wrap: wrap; gap: 10px; }
.facts li { display: flex; align-items: center; gap: 8px; padding: 6px 14px 6px 12px; border: 1px solid rgba(230, 201, 162, 0.28); border-radius: 99px; font-size: 0.88rem; color: var(--gold-l); background: rgba(255, 255, 255, 0.03); }
.facts svg { width: 18px; height: 18px; fill: none; stroke: var(--gold); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.hero.small { padding-bottom: clamp(70px, 9vw, 96px); }
.hero.small h1 { font-size: clamp(1.7rem, 5vw, 2.6rem); }

/* ---------- Layout ---------- */
.app { max-width: 980px; margin: clamp(-64px, -8vw, -48px) auto 0; padding: 0 14px 40px; position: relative; }
.card {
  background: var(--paper); border-radius: 18px; border: 1px solid var(--line);
  box-shadow: 0 30px 60px -30px rgba(8, 17, 19, 0.35), 0 2px 6px rgba(8, 17, 19, 0.05);
  padding: clamp(20px, 4.5vw, 44px);
}
.card:focus { outline: none; }

/* ---------- Stepper ---------- */
.stepper {
  position: sticky; top: 0; z-index: 20; margin: 0 -14px 14px; padding: 10px 14px 8px;
  background: rgba(246, 241, 233, 0.92); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
@media (min-width: 761px) { .stepper { position: static; background: none; backdrop-filter: none; border: 0; margin: 0 0 14px; padding: 0; } }
.stepper ol { list-style: none; margin: 0; padding: 0; display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; }
.stepper ol::-webkit-scrollbar { display: none; }
.stepper li { flex: 1 0 auto; }
@media (min-width: 761px) { .stepper ol { flex-wrap: wrap; overflow: visible; } }
.stepper button {
  width: 100%; display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); background: var(--paper);
  border-radius: 99px; padding: 5px 6px 5px 14px; font-size: 0.86rem; color: var(--muted); white-space: nowrap; transition: 0.2s var(--ease);
}
@media (min-width: 761px) { .stepper button { background: rgba(255, 253, 249, 0.1); border-color: rgba(230, 201, 162, 0.25); color: var(--gold-l); } }
.stepper .n { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--sand); color: var(--ink); font-weight: 700; font-size: 0.82rem; flex: none; }
.stepper li.is-done .n { background: var(--gold); color: #fff; }
.stepper li.is-cur button { background: var(--copper); border-color: var(--copper); color: #fff; }
.stepper li.is-cur .n { background: #fff; color: var(--copper); }
.stepper button:disabled { cursor: default; opacity: 0.55; }
@media (max-width: 760px) { .stepper li:not(.is-cur) .t { display: none; } .stepper li:not(.is-cur) { flex: 0 0 auto; } .stepper li:not(.is-cur) button { padding: 3px; } }
.progress { height: 3px; background: var(--line); border-radius: 3px; margin-bottom: 8px; overflow: hidden; }
@media (min-width: 761px) { .progress { background: rgba(230, 201, 162, 0.2); } }
.progress i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--gold), var(--copper)); transition: width 0.4s var(--ease); }

/* ---------- Steps & fieldsets ---------- */
.step { display: none; }
.step.is-active { display: block; animation: rise 0.45s var(--ease); }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }
.step-h { font-family: var(--f-display); font-weight: 800; font-size: clamp(1.4rem, 3.6vw, 1.85rem); line-height: 1.5; display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.step-h .num { width: 40px; height: 40px; border-radius: 50%; border: 1.5px solid var(--gold); color: var(--copper); display: grid; place-items: center; font-size: 1.05rem; flex: none; }
.step-h .num:empty { display: none; }
fieldset { border: 0; margin: 0; padding: 22px 0 6px; border-top: 1px solid var(--line); min-width: 0; }
.step-h + fieldset { border-top: 0; padding-top: 10px; }
legend { font-family: var(--f-display); font-weight: 700; font-size: 1.08rem; color: var(--gold-d); padding: 0; margin-bottom: 12px; float: right; width: 100%; }
legend + * { clear: both; }
legend small { font-family: var(--f-text); font-weight: 400; color: var(--muted); font-size: 0.85rem; }
.sub { font-family: var(--f-display); font-weight: 700; font-size: 1rem; margin: 18px 0 10px; color: var(--ink); }
.note { color: var(--muted); font-size: 0.9rem; margin: -4px 0 12px; }

/* ---------- Grid ---------- */
.grid { display: grid; gap: 14px 18px; grid-template-columns: 1fr; }
@media (min-width: 560px) { .g2, .g3, .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 820px) { .g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } .g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (min-width: 560px) { .span2 { grid-column: span 2; } }

/* ---------- Fields ---------- */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; margin: 0 0 14px; }
.grid > .field { margin: 0; }
.grid + .field, .grid + .check { margin-top: 14px; }
.lbl { font-size: 0.92rem; font-weight: 600; color: var(--ink); line-height: 1.7; }
.lbl i, .check i { color: var(--copper); font-style: normal; }
.lbl small { font-weight: 400; color: var(--muted); }
input:not([type=radio]):not([type=checkbox]):not([type=file]), select, textarea {
  width: 100%; min-height: 48px; padding: 10px 14px; border: 1px solid var(--line-2); border-radius: var(--r);
  background: #fff; transition: border-color 0.2s, box-shadow 0.2s; font-size: 1rem; line-height: 1.6;
}
textarea { resize: vertical; min-height: 84px; }
select {
  appearance: none; -webkit-appearance: none; padding-inline-end: 40px; cursor: pointer;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M6 9l6 6 6-6' fill='none' stroke='%23ad6433' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat left 12px center / 18px;
}
input:hover, select:hover, textarea:hover { border-color: rgba(173, 100, 51, 0.5); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--copper); box-shadow: 0 0 0 4px rgba(173, 100, 51, 0.14); }
::placeholder { color: #9a9f9b; opacity: 1; }
.help { color: var(--gold-d); font-size: 0.84rem; min-height: 1em; }
.affix { position: relative; display: block; }
.affix em { position: absolute; inset-inline-end: 14px; top: 50%; transform: translateY(-50%); font-style: normal; color: var(--muted); font-size: 0.88rem; pointer-events: none; }
.affix input { padding-inline-end: 54px; }
.invalid input:not([type=radio]):not([type=checkbox]), .invalid select, .invalid textarea { border-color: var(--bad); box-shadow: 0 0 0 3px rgba(178, 59, 59, 0.1); }
.err { color: var(--bad); font-size: 0.84rem; display: flex; gap: 6px; align-items: center; }
.err::before { content: "!"; width: 16px; height: 16px; border-radius: 50%; background: var(--bad); color: #fff; font-size: 0.7rem; display: grid; place-items: center; font-weight: 700; flex: none; }

/* chips (radio / checkbox pills) */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { position: relative; }
.chip input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.chip span {
  display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 8px 16px; border-radius: 99px;
  border: 1px solid var(--line-2); background: #fff; font-size: 0.94rem; transition: 0.18s var(--ease); user-select: none;
}
.chip:hover span { border-color: var(--copper); }
.chip input:checked + span { background: var(--copper); border-color: var(--copper); color: #fff; box-shadow: 0 6px 14px -8px rgba(173, 100, 51, 0.9); }
.chip input[type=checkbox]:checked + span::before { content: "✓"; font-weight: 700; }
.chip input:focus-visible + span { outline: 2px solid var(--copper); outline-offset: 2px; }
.invalid .chip span { border-color: rgba(178, 59, 59, 0.6); }
.chips.seg { gap: 0; flex-wrap: nowrap; display: inline-flex; border: 1px solid var(--line-2); border-radius: 99px; padding: 3px; background: #fff; width: max-content; max-width: 100%; }
.chips.seg .chip span { border: 0; min-height: 38px; padding: 6px 14px; background: transparent; box-shadow: none; }
.chips.seg .chip input:checked + span { background: var(--copper); color: #fff; }
.chips.seg .chip input[type=checkbox]:checked + span::before { content: none; }

/* checkbox line */
.check { display: flex; gap: 12px; align-items: flex-start; cursor: pointer; padding: 10px 0; line-height: 1.8; }
.check input { appearance: none; -webkit-appearance: none; width: 22px; height: 22px; flex: none; margin: 3px 0 0; border: 1.5px solid var(--line-2); border-radius: 6px; background: #fff; display: grid; place-items: center; cursor: pointer; transition: 0.15s; }
.check input:checked { background: var(--copper); border-color: var(--copper); }
.check input:checked::after { content: ""; width: 6px; height: 11px; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg) translate(-1px, -1px); }
.check.invalid input { border-color: var(--bad); }
.check.inline { align-self: end; padding-bottom: 12px; }
.check.invalid { flex-wrap: wrap; } .check .err { flex-basis: 100%; }

/* number stepper */
.stepper-in { display: flex; align-items: stretch; border: 1px solid var(--line-2); border-radius: var(--r); background: #fff; overflow: hidden; }
.stepper-in input { border: 0 !important; box-shadow: none !important; text-align: center; min-width: 0; border-radius: 0 !important; }
.st-b { width: 48px; flex: none; border: 0; background: var(--ivory); font-size: 1.25rem; color: var(--copper); transition: background 0.15s; }
.st-b:hover { background: var(--sand); }
.stepper-in:focus-within { border-color: var(--copper); box-shadow: 0 0 0 4px rgba(173, 100, 51, 0.14); }

/* date input */
.date-wrap { position: relative; display: block; }
.date-wrap input { cursor: pointer; padding-inline-start: 44px !important; padding-inline-end: 40px !important; caret-color: transparent; }
.d-ico { position: absolute; inset-inline-start: 13px; top: 24px; transform: translateY(-50%); width: 20px; height: 20px; pointer-events: none; }
.d-ico svg { width: 100%; height: 100%; fill: none; stroke: var(--copper); stroke-width: 1.6; stroke-linecap: round; }
.d-clear { position: absolute; inset-inline-end: 6px; top: 24px; transform: translateY(-50%); width: 34px; height: 34px; border: 0; background: none; color: var(--muted); font-size: 1.3rem; border-radius: 50%; display: none; }
.d-clear:hover { background: var(--ivory); color: var(--bad); }
.date-wrap.has-value .d-clear { display: block; }
.dhint { display: block; color: var(--gold-d); font-size: 0.8rem; min-height: 0; margin-top: 4px; }
.dhint:empty { display: none; }

/* ---------- Date picker ---------- */
.dp-backdrop { position: fixed; inset: 0; z-index: 90; background: rgba(8, 17, 19, 0.45); opacity: 0; pointer-events: none; transition: opacity 0.2s; }
@media (min-width: 641px) { .dp-backdrop { background: transparent; } }
.dp-backdrop.is-open { opacity: 1; pointer-events: auto; }
.dp {
  position: fixed; z-index: 100; width: 316px; background: var(--paper); border: 1px solid var(--line); border-radius: 16px;
  box-shadow: 0 24px 50px -18px rgba(8, 17, 19, 0.45); padding: 12px; direction: rtl;
  opacity: 0; visibility: hidden; transform: translateY(6px); transition: opacity 0.18s, transform 0.18s var(--ease), visibility 0s 0.18s;
}
.dp.is-open { opacity: 1; visibility: visible; transform: none; transition: opacity 0.18s, transform 0.18s var(--ease); }
.dp.sheet { left: 0 !important; right: 0; bottom: 0; top: auto !important; width: auto; border-radius: 22px 22px 0 0; padding: 16px 16px calc(16px + env(safe-area-inset-bottom)); transform: translateY(100%); }
.dp.sheet.is-open { transform: none; }
.dp.sheet::before { content: ""; display: block; width: 44px; height: 4px; border-radius: 4px; background: var(--line-2); margin: -4px auto 10px; }
.dp-head { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-bottom: 8px; }
.dp-title { flex: 1; border: 0; background: none; font-family: var(--f-display); font-weight: 800; font-size: 1.05rem; padding: 6px 10px; border-radius: 10px; }
.dp-title:not(:disabled):hover { background: var(--ivory); color: var(--copper); }
.dp-title:disabled { cursor: default; color: var(--ink); opacity: 1; }
.dp-nav { width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--line); background: #fff; display: grid; place-items: center; }
.dp-nav:hover { border-color: var(--copper); }
.dp-nav svg { width: 18px; height: 18px; fill: none; stroke: var(--copper); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.dp-body { display: grid; gap: 4px; }
.dp-body.v-day { grid-template-columns: repeat(7, 1fr); }
.dp-body.v-month { grid-template-columns: repeat(3, 1fr); gap: 8px; }
.dp-body.v-year { grid-template-columns: repeat(4, 1fr); gap: 8px; }
.dp-wd { text-align: center; font-size: 0.78rem; color: var(--muted); font-weight: 600; padding: 2px 0 4px; }
.dp-wd.fri, .dp-day.fri { color: #b4532a; }
.dp-day, .dp-cell { border: 0; background: none; border-radius: 10px; font-size: 0.95rem; transition: background 0.12s; }
.dp-day { aspect-ratio: 1; display: grid; place-items: center; min-height: 36px; }
.dp-cell { padding: 12px 4px; border: 1px solid var(--line); background: #fff; }
.dp-day:hover:not(:disabled), .dp-cell:hover:not(:disabled) { background: var(--sand); }
.dp-day.today, .dp-cell.today { box-shadow: inset 0 0 0 1.5px var(--gold); }
.dp-day.sel, .dp-cell.sel { background: var(--copper) !important; color: #fff !important; font-weight: 700; }
.dp-day:disabled, .dp-cell:disabled { opacity: 0.28; cursor: not-allowed; }
.dp-day:focus-visible, .dp-cell:focus-visible { outline: 2px solid var(--copper); outline-offset: 1px; }
.dp-time { display: flex; align-items: center; gap: 8px; justify-content: center; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); direction: rtl; }
.dp-time > span { color: var(--muted); font-size: 0.9rem; margin-inline-end: 4px; }
.dp-time select { width: 76px; min-height: 40px; padding: 4px 10px; text-align: center; background-position: left 6px center; padding-inline-end: 26px; }
.dp-foot { display: flex; gap: 8px; margin-top: 10px; }
.dp-foot button { flex: 1; min-height: 40px; border-radius: 10px; border: 1px solid var(--line); background: #fff; font-size: 0.9rem; }
.dp-foot button:hover { border-color: var(--copper); color: var(--copper); }
.dp-foot .dp-ok { background: var(--copper); border-color: var(--copper); color: #fff; }
.dp-foot .dp-ok:hover { color: #fff; filter: brightness(1.08); }

/* ---------- Repeatable rows ---------- */
.rrows { display: grid; gap: 14px; }
.rrow { border: 1px solid var(--line); border-radius: 14px; padding: 12px 16px 16px; background: linear-gradient(180deg, #fff, var(--paper)); animation: rise 0.35s var(--ease); }
.rrow-h { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.rrow-h b { font-family: var(--f-display); font-weight: 700; color: var(--gold-d); }
.rrow-del { border: 0; background: none; color: var(--muted); font-size: 0.86rem; padding: 4px 10px; border-radius: 8px; }
.rrow-del:hover { color: var(--bad); background: rgba(178, 59, 59, 0.07); }
.rrow > .field { margin-top: 14px; margin-bottom: 0; }
.add-row { margin-top: 12px; width: 100%; min-height: 50px; border: 1.5px dashed rgba(173, 100, 51, 0.45); border-radius: 14px; background: transparent; color: var(--copper); font-weight: 600; transition: 0.2s; }
.add-row:hover { background: rgba(173, 100, 51, 0.06); border-style: solid; }
.add-row span { font-size: 1.2rem; margin-inline-end: 4px; }
.lang { display: grid; gap: 12px 18px; grid-template-columns: 1fr; }
@media (min-width: 560px) { .lang { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 900px) { .lang { grid-template-columns: 1fr 1fr 1fr; } }
.lang .field { margin: 0; }

/* family rows, Q&A rows, toggles, refs */
.fam { display: grid; gap: 12px; }
.fam-row { display: grid; gap: 12px 18px; grid-template-columns: 1fr; padding: 14px 16px; border: 1px solid var(--line); border-radius: 14px; background: #fff; }
.fam-row > b, .ref > b { font-family: var(--f-display); font-weight: 700; color: var(--gold-d); }
.fam-row .field { margin: 0; }
@media (min-width: 760px) { .fam-row { grid-template-columns: 70px 1.3fr 1fr 1fr; align-items: end; } .fam-row > b { align-self: center; } }
.qa { display: grid; gap: 10px 18px; grid-template-columns: 1fr; padding: 12px 0; border-bottom: 1px dashed var(--line); }
.qa:last-child { border-bottom: 0; }
.qa .field { margin: 0; }
@media (min-width: 760px) { .qa { grid-template-columns: 1.3fr 1fr 1fr; align-items: end; } }
.toggles { display: grid; gap: 10px; grid-template-columns: 1fr; }
@media (min-width: 640px) { .toggles { grid-template-columns: 1fr 1fr; } }
.tg { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 8px 8px 8px 16px; border: 1px solid var(--line); border-radius: 14px; background: #fff; }
.tg.invalid { flex-wrap: wrap; }
.refs { display: grid; gap: 14px; }
.ref { padding: 14px 16px; border: 1px solid var(--line); border-radius: 14px; background: #fff; }
.ref > b { display: block; margin-bottom: 8px; }

/* ---------- Files ---------- */
.drop { position: relative; border: 1.5px dashed var(--line-2); border-radius: 14px; background: #fff; transition: 0.2s; min-height: 120px; }
.drop.over { border-color: var(--copper); background: rgba(173, 100, 51, 0.05); }
.drop input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; z-index: 1; }
.drop.has-files input[type=file] { height: 0; }
.drop-in { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 6px; padding: 22px 14px; color: var(--muted); font-size: 0.92rem; min-height: 120px; }
.drop.has-files .drop-in { position: relative; min-height: 0; padding: 10px; border-top: 1px dashed var(--line); }
.drop.has-files .drop-in svg { display: none; }
.drop.has-files .drop-in input { display: none; }
.drop-in svg { width: 32px; height: 32px; fill: none; stroke: var(--copper); stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.drop-in u { color: var(--copper); text-decoration: none; font-weight: 600; }
.flist { list-style: none; margin: 0; padding: 6px; display: grid; gap: 6px; }
.flist:empty { display: none; }
.flist li { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 10px; background: var(--ivory); position: relative; z-index: 2; }
.flist img { width: 40px; height: 40px; object-fit: cover; border-radius: 8px; }
.fx { width: 40px; height: 40px; border-radius: 8px; background: var(--copper); color: #fff; font-size: 0.68rem; display: grid; place-items: center; font-weight: 600; flex: none; }
.flist bdi { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.9rem; font-family: var(--f-latin); text-align: right; }
.flist small { color: var(--muted); font-size: 0.8rem; white-space: nowrap; }
.flist button { width: 32px; height: 32px; border-radius: 50%; border: 0; background: #fff; color: var(--muted); font-size: 1.2rem; flex: none; }
.flist button:hover { color: var(--bad); }

/* ---------- Tests status (form step 8) ---------- */
.tests-status { display: grid; gap: 10px; }
.ts { display: flex; align-items: center; gap: 14px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 14px; background: #fff; flex-wrap: wrap; }
.ts.is-done { border-color: rgba(47, 125, 79, 0.35); background: linear-gradient(90deg, rgba(47, 125, 79, 0.05), #fff); }
.ts-code { font-family: var(--f-latin); font-size: 0.82rem; letter-spacing: 0.04em; color: var(--copper); border: 1px solid rgba(173, 100, 51, 0.35); border-radius: 8px; padding: 2px 8px; flex: none; }
.ts.is-done .ts-code { color: var(--ok); border-color: rgba(47, 125, 79, 0.4); }
.ts-t { flex: 1 1 200px; display: flex; flex-direction: column; line-height: 1.7; }
.ts-t small { color: var(--muted); }

/* ---------- Pledge & signature ---------- */
.pledge { background: var(--ivory); border-inline-start: 3px solid var(--gold); padding: 14px 18px; border-radius: 10px; line-height: 2.1; margin-bottom: 8px; }
.pledge b { color: var(--copper); }
.sig { position: relative; border: 1.5px dashed var(--line-2); border-radius: 14px; background: #fff; max-width: 520px; touch-action: none; }
.sig canvas { display: block; width: 100%; height: auto; aspect-ratio: 3 / 1; cursor: crosshair; touch-action: none; }
.sig-ph { position: absolute; inset: 0; display: grid; place-items: center; color: #b3b6b3; pointer-events: none; font-size: 1rem; }
.sig.has-sig .sig-ph { display: none; }
.sig-clear { position: absolute; top: 8px; inset-inline-end: 8px; border: 1px solid var(--line); background: #fff; border-radius: 8px; font-size: 0.8rem; padding: 2px 10px; color: var(--muted); }
.sig-field { margin-top: 10px; }

/* ---------- Review ---------- */
.review { margin-top: 22px; border: 1px solid var(--line); border-radius: 14px; background: #fff; }
.review summary { cursor: pointer; padding: 14px 18px; font-weight: 700; color: var(--gold-d); list-style: none; display: flex; justify-content: space-between; align-items: center; }
.review summary::-webkit-details-marker { display: none; }
.review summary::after { content: "+"; font-size: 1.3rem; color: var(--copper); }
.review[open] summary::after { content: "−"; }
.review-body { padding: 0 18px 16px; }
.review h4 { font-family: var(--f-display); font-size: 0.98rem; color: var(--copper); margin: 14px 0 6px; }
.review dl { margin: 0; display: grid; grid-template-columns: 1fr; gap: 0 24px; }
@media (min-width: 640px) { .review dl { grid-template-columns: 1fr 1fr; } }
.review dl div { display: flex; justify-content: space-between; gap: 10px; border-bottom: 1px dashed var(--line); padding: 5px 0; font-size: 0.9rem; }
.review dt { color: var(--muted); }
.review dd { margin: 0; font-weight: 600; text-align: left; }
.tbl { overflow-x: auto; margin: 8px 0; }
.tbl table { border-collapse: collapse; width: 100%; font-size: 0.85rem; }
.tbl th, .tbl td { border: 1px solid var(--line); padding: 5px 8px; text-align: right; white-space: nowrap; }
.tbl th { background: var(--ivory); }

/* ---------- Buttons & actions ---------- */
.actions { display: flex; align-items: center; gap: 12px; margin-top: 26px; padding-top: 20px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.actions .saved, .actions > span { flex: 1; color: var(--muted); font-size: 0.82rem; text-align: center; min-width: 0; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 50px; padding: 10px 28px;
  border-radius: 99px; border: 1px solid var(--copper); background: var(--copper); color: #fff; font-weight: 700;
  text-decoration: none; transition: 0.2s var(--ease); box-shadow: 0 10px 22px -12px rgba(173, 100, 51, 0.9);
}
.btn:hover { filter: brightness(1.07); transform: translateY(-1px); }
.btn:disabled { opacity: 0.7; cursor: progress; transform: none; }
.btn.ghost { background: transparent; color: var(--copper); box-shadow: none; }
.btn.ghost:hover { background: rgba(173, 100, 51, 0.07); }
.btn.sm { min-height: 40px; padding: 6px 18px; font-size: 0.9rem; }
.btn.send { background: linear-gradient(135deg, var(--copper), var(--gold-d)); min-width: 200px; }
@media (max-width: 560px) {
  .actions { position: sticky; bottom: 0; z-index: 15; background: var(--paper); margin: 20px -20px -20px; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); border-radius: 0 0 18px 18px; box-shadow: 0 -10px 24px -16px rgba(8, 17, 19, 0.3); }
  .actions .btn { flex: 1; padding: 10px 16px; }
  .actions .saved { order: 3; flex-basis: 100%; }
  .btn.send { min-width: 0; }
  .actions > span:empty { display: none; }
  .actions .btn { white-space: nowrap; }
}
.linklike { border: 0; background: none; color: var(--muted); text-decoration: underline; text-underline-offset: 4px; font-size: 0.86rem; }
.linklike:hover { color: var(--bad); }
.reset-line { text-align: center; margin-top: 18px; }

/* ---------- Done ---------- */
.done { text-align: center; }
.done-ico { width: 76px; height: 76px; margin: 0 auto 10px; fill: none; stroke: var(--ok); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.done-ico circle { stroke: rgba(47, 125, 79, 0.25); }
.done-ico path { stroke-dasharray: 40; stroke-dashoffset: 40; animation: draw 0.6s 0.2s var(--ease) forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
.done h2 { font-family: var(--f-display); font-weight: 800; font-size: 1.6rem; margin-bottom: 10px; }
.done p { color: var(--muted); max-width: 560px; margin: 0 auto 12px; }
.done .ref { color: var(--ink); font-size: 1.05rem; margin-top: 18px; }
.done .ref b { font-family: var(--f-latin); font-size: 1.3rem; letter-spacing: 0.06em; color: var(--copper); background: var(--ivory); padding: 4px 14px; border-radius: 10px; }
.copy { border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 2px 12px; font-size: 0.85rem; margin-inline-start: 6px; }
.small { font-size: 0.85rem; color: var(--muted); }
.done .btn { margin-top: 10px; }

/* ---------- Toast & footer ---------- */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 30px); z-index: 200; max-width: min(92vw, 520px);
  background: var(--night); color: var(--ivory); padding: 12px 20px; border-radius: 14px; font-size: 0.92rem; line-height: 1.8;
  box-shadow: 0 18px 40px -14px rgba(0, 0, 0, 0.5); opacity: 0; pointer-events: none; transition: 0.3s var(--ease); text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
@media (max-width: 560px) { .toast { bottom: 96px; } }
.foot { text-align: center; padding: 26px 16px 40px; color: var(--muted); font-size: 0.85rem; }
.foot a { color: var(--gold-d); text-decoration: none; }

/* ==========================================================================
   Tests page
   ========================================================================== */
.lead-d { color: var(--muted); margin-bottom: 18px; }
.eyebrow-d { font-family: var(--f-latin); color: var(--copper); letter-spacing: 0.08em; font-size: 0.85rem; }
.center { text-align: center; }
.pad { padding: 30px 0; }
.tcards { display: grid; gap: 14px; grid-template-columns: 1fr; margin-bottom: 22px; }
@media (min-width: 760px) { .tcards { grid-template-columns: repeat(3, 1fr); } }
.tcard {
  display: flex; flex-direction: column; gap: 6px; padding: 20px; border: 1px solid var(--line); border-radius: 16px; background: #fff;
  color: var(--ink); text-decoration: none; transition: 0.25s var(--ease); position: relative; overflow: hidden;
}
.tcard::after { content: ""; position: absolute; inset-inline-end: -40px; top: -40px; width: 110px; height: 110px; border-radius: 50%; border: 1.5px dotted rgba(173, 100, 51, 0.3); }
.tcard:hover { border-color: var(--copper); transform: translateY(-3px); box-shadow: 0 18px 30px -20px rgba(173, 100, 51, 0.8); }
.tcard .ts-code { align-self: flex-start; }
.tcard b { font-family: var(--f-display); font-weight: 800; font-size: 1.12rem; line-height: 1.6; margin-top: 6px; }
.tcard small { color: var(--muted); }
.tmeta { display: flex; gap: 8px; margin-top: 6px; }
.tmeta span { font-size: 0.8rem; background: var(--ivory); padding: 2px 10px; border-radius: 99px; }
.tgo { margin-top: auto; padding-top: 12px; color: var(--copper); font-weight: 700; }
.tgo::after { content: " ←"; }
.tcard.is-done { border-color: rgba(47, 125, 79, 0.4); }
.tcard.is-done .tgo { color: var(--ok); }
.rules { margin: 0 0 6px; padding: 16px 20px 16px 16px; padding-inline-start: 36px; background: var(--ivory); border-radius: 14px; line-height: 2.1; }
.rules b { color: var(--copper); }

.runbar {
  position: sticky; top: 0; z-index: 10; margin: calc(-1 * clamp(20px, 4.5vw, 44px)) calc(-1 * clamp(20px, 4.5vw, 44px)) 18px;
  padding: 12px clamp(16px, 4vw, 40px) 10px; background: rgba(12, 22, 24, 0.96); color: var(--ivory); border-radius: 18px 18px 0 0;
  display: grid; grid-template-columns: 1fr auto; gap: 6px 14px; align-items: center; backdrop-filter: blur(8px);
}
.rb-t { font-size: 0.9rem; color: var(--gold-l); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rb-t b { font-family: var(--f-latin); color: var(--gold); margin-inline-end: 6px; }
.rb-clock { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; font-size: 1.15rem; font-variant-numeric: tabular-nums; padding: 2px 12px; border-radius: 99px; background: rgba(255, 255, 255, 0.08); }
.rb-clock svg { width: 18px; height: 18px; fill: none; stroke: var(--gold); stroke-width: 1.8; stroke-linecap: round; }
.rb-clock.low { background: #b23b3b; animation: pulse 1s infinite; }
.rb-clock.low svg { stroke: #fff; }
@keyframes pulse { 50% { opacity: 0.75; } }
.rb-prog { grid-column: 1 / -1; height: 4px; background: rgba(255, 255, 255, 0.12); border-radius: 4px; overflow: hidden; }
.rb-prog i { display: block; height: 100%; background: linear-gradient(90deg, var(--gold), var(--copper)); transition: width 0.3s; }
.rb-n { grid-column: 1 / -1; color: rgba(246, 241, 233, 0.6); font-size: 0.78rem; }

.qs { display: grid; gap: 14px; }
.q { border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px; background: #fff; transition: border-color 0.2s; }
.q.missing { border-color: var(--bad); box-shadow: 0 0 0 3px rgba(178, 59, 59, 0.08); }
.q legend { float: right; width: 100%; font-family: var(--f-text); font-weight: 600; color: var(--ink); font-size: 1.02rem; line-height: 1.9; margin-bottom: 12px; display: block; }
.q legend small { display: block; color: var(--copper); font-size: 0.82rem; font-weight: 600; }
.qn { display: inline-grid; place-items: center; min-width: 28px; height: 28px; border-radius: 50%; background: var(--ivory); color: var(--copper); font-size: 0.82rem; margin-inline-end: 10px; padding: 0 4px; vertical-align: 2px; }
.q.sjt legend small, .q.cbi legend small { margin-bottom: 4px; }
.q legend + * { clear: both; }
.likert { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.likert label { position: relative; }
.likert input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.likert span { display: grid; place-items: center; text-align: center; min-height: 52px; padding: 6px 4px; border: 1px solid var(--line-2); border-radius: 12px; font-size: 0.82rem; line-height: 1.5; transition: 0.15s; background: #fff; }
.likert label:nth-child(1) span, .likert label:nth-child(5) span { font-weight: 600; }
.likert label:hover span { border-color: var(--copper); }
.likert input:checked + span { background: var(--copper); border-color: var(--copper); color: #fff; }
.likert input:focus-visible + span { outline: 2px solid var(--copper); outline-offset: 2px; }
@media (max-width: 520px) { .likert { gap: 4px; } .likert span { font-size: 0.72rem; min-height: 56px; padding: 4px 2px; } }
.hint { color: var(--muted); font-size: 0.86rem; margin: -6px 0 10px; }
.opts { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.opts li { display: grid; grid-template-columns: auto 1fr; gap: 6px 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; align-items: start; }
.ol { width: 26px; height: 26px; border-radius: 50%; background: var(--ivory); display: grid; place-items: center; font-size: 0.82rem; color: var(--copper); font-weight: 700; margin-top: 2px; }
.ot { line-height: 1.9; }
.pick { grid-column: 1 / -1; display: flex; gap: 8px; justify-content: flex-end; }
.pick label { position: relative; }
.pick input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.pick span { display: inline-flex; align-items: center; gap: 4px; padding: 4px 14px; min-height: 36px; border-radius: 99px; border: 1px solid var(--line-2); font-size: 0.84rem; background: #fff; transition: 0.15s; }
.pick .best input:checked + span { background: var(--ok); border-color: var(--ok); color: #fff; }
.pick .worst input:checked + span { background: var(--bad); border-color: var(--bad); color: #fff; }
.pick .best span::before { content: "▲"; font-size: 0.6rem; }
.pick .worst span::before { content: "▼"; font-size: 0.6rem; }
.pick input:focus-visible + span { outline: 2px solid var(--copper); outline-offset: 2px; }
@media (min-width: 700px) { .opts li { grid-template-columns: auto 1fr auto; align-items: center; } .pick { grid-column: auto; } }
.star { display: grid; gap: 12px; }
@media (min-width: 760px) { .star { grid-template-columns: 1fr 1fr; } }
.star .field { margin: 0; }
.star .lbl b { font-family: var(--f-latin); color: var(--copper); margin-inline-end: 4px; }

.bars { display: grid; gap: 16px; margin: 6px 0 16px; }
.bar-h { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 6px; }
.bar-h span { color: var(--copper); font-weight: 600; white-space: nowrap; }
.bar-t { height: 10px; background: var(--sand); border-radius: 10px; overflow: hidden; }
.bar-t i { display: block; height: 100%; background: linear-gradient(90deg, var(--gold), var(--copper)); border-radius: 10px; }
.bar small { color: var(--muted); display: block; margin-top: 4px; }
.big-score { display: flex; align-items: baseline; justify-content: center; gap: 10px; margin: 10px 0; }
.big-score b { font-family: var(--f-display); font-size: 3.6rem; color: var(--copper); line-height: 1.2; }
.big-score span { color: var(--muted); }
.note-box { margin-top: 18px; padding: 12px 16px; border-radius: 12px; background: rgba(47, 125, 79, 0.07); border: 1px solid rgba(47, 125, 79, 0.25); color: var(--ok); font-size: 0.92rem; }
.warn { color: var(--bad); font-style: normal; font-weight: 700; }
.spinner { width: 42px; height: 42px; border-radius: 50%; border: 3px solid var(--sand); border-top-color: var(--copper); margin: 0 auto 14px; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
