/* Fijman.tech — конфигуратор. Дизайн: светлый чертёжный лист, справа тёмная смета.
   Разметка и JS не менялись по смыслу: все классы совпадают с прежними. */
:root {
  --paper: #f4f5f3; --card: #fff; --ink: #0f1a2b; --muted: #5c6675; --faint: #8a93a0;
  --line: rgba(15,26,43,.12); --line-2: rgba(15,26,43,.26); --accent: #4f7578; --tint: #e4eded;
  --danger: #c2412b; --ok: #1e8a5a;
  --display: "Inter", -apple-system, "Segoe UI", system-ui, sans-serif;
  --font: "Inter", -apple-system, "Segoe UI", system-ui, sans-serif;
  --r-card: 14px; --r-ctl: 8px;
  --ease: cubic-bezier(.2,.75,.2,1);
  --safe-b: env(safe-area-inset-bottom, 0px);
  /* токены шапки — те же имена, что на главной */
  --bg: var(--paper); --surface: var(--card); --surface-2: #eceeed; --text: var(--ink);
  --line-strong: rgba(15,26,43,.22); --blue: #4f7578; --blue-light: #6f9396; --tech: #4f7578;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --radius: 18px; --max-width: 1440px; --gutter: clamp(14px, 2.4vw, 32px);
  --topbar-top: 16px; --topbar-h: 58px; --safe-top: env(safe-area-inset-top, 0px);
  --nav-clear: calc(var(--topbar-top) + var(--safe-top) + var(--topbar-h) + 14px);
}
@media (max-width: 767.98px) { :root { --topbar-top: 8px; } }
*, *::before, *::after { box-sizing: border-box; }
html { background: var(--paper); -webkit-text-size-adjust: 100%; scroll-padding-top: 96px; }
body { margin: 0; color: var(--ink); font: 16px/1.55 var(--font); -webkit-font-smoothing: antialiased; overflow-x: clip; }
h1, h2, h3, p { margin: 0; overflow-wrap: break-word; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; padding: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.hp-field { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- шаги (степпер над формой) ---------- */
.stepper { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 28px; }
.progress { display: flex; align-items: center; }
.prog-line { width: 22px; height: 1px; background: var(--line-2); }
.prog-dot { width: 28px; height: 28px; border-radius: 50%; border: 1px solid var(--line-2); font: 500 13px var(--font); color: var(--muted); display: grid; place-items: center; transition: background .2s, color .2s; }
.prog-dot:disabled { cursor: default; opacity: .5; }
.prog-dot.done { background: var(--tint); border-color: var(--accent); color: var(--accent); }
.prog-dot.current { background: var(--ink); border-color: var(--ink); color: #fff; }
.step-label { font-size: 14px; color: var(--muted); }

/* ---------- раскладка ---------- */
.shell { max-width: 1360px; margin: 0 auto; padding: calc(var(--nav-clear) + 24px) 32px 72px; }
.layout { display: grid; grid-template-columns: minmax(0,1fr) 380px; gap: 48px; align-items: start; }
.layout.no-sidebar { grid-template-columns: minmax(0,1fr); }
.layout.no-sidebar #sidebar { display: none; }
#sidebar { position: sticky; top: calc(var(--nav-clear) + 8px); }
.step-panel { display: none; }
.step-panel.active { display: block; animation: panel-in .3s var(--ease) both; }
@keyframes panel-in { from { opacity: 0; transform: translateY(6px); } }
.step-panel .nav-row { display: none; }

.hero h1, .panel-head h2 { font: 650 clamp(32px, 4.2vw, 56px)/1 var(--display); letter-spacing: -.05em; max-width: 16ch; }
.panel-head h2 { font-size: clamp(28px, 3.4vw, 44px); max-width: 20ch; }
.panel-head p { margin-top: 14px; max-width: 56ch; color: var(--muted); }
.panel-head-row { margin-bottom: 14px; }
.pkg-chip { display: inline-block; padding: 4px 12px; border-radius: 999px; background: var(--tint); color: var(--accent); font-size: 14px; font-weight: 500; }
.step-body { margin-top: 32px; }

/* ---------- кнопки ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 10px; padding: 13px 22px; border-radius: var(--r-ctl); background: var(--ink); color: #fff; font-weight: 500; transition: background .2s, opacity .2s; }
.btn:hover:not(:disabled) { background: var(--accent); }
.btn:disabled { opacity: .35; cursor: not-allowed; }
.btn.secondary { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1px var(--line-2); }
.btn.secondary:hover:not(:disabled) { background: var(--card); }
.nav-row { display: flex; gap: 12px; margin-top: 28px; }
.spacer { flex: 1; }

/* ---------- шаг 1: пакеты ---------- */
.pkg-grid { display: grid; gap: 18px; grid-template-columns: repeat(2, minmax(0,1fr)); }
.layout.no-sidebar .pkg-grid { grid-template-columns: repeat(4, minmax(0,1fr)); }
.pkg { position: relative; display: flex; flex-direction: column; text-align: left; background: var(--card); border-radius: var(--r-card); box-shadow: inset 0 0 0 1px var(--line); overflow: hidden; transition: box-shadow .2s, transform .2s var(--ease); }
.pkg:hover { box-shadow: inset 0 0 0 1px var(--line-2); }
.pkg.selected { box-shadow: inset 0 0 0 2px var(--accent); }
.pkg-photo-frame { aspect-ratio: 16/10; background: var(--ink); overflow: hidden; }
.pkg-photo { width: 100%; height: 100%; object-fit: cover; display: block; }
.pkg-photo-gradient, .pkg-photo-spacer { display: none; }
.pkg-price-plaque { position: absolute; top: 12px; left: 12px; right: 12px; display: flex; justify-content: space-between; align-items: center; pointer-events: none; }
.pkg-price { background: #fff; padding: 5px 12px; border-radius: 999px; font: 500 15px var(--display); letter-spacing: -.01em; }
.pkg-check { width: 26px; height: 26px; border-radius: 50%; background: rgba(255,255,255,.85); position: relative; }
.pkg.selected .pkg-check { background: var(--accent); }
.pkg.selected .pkg-check::after { content: ""; position: absolute; left: 9px; top: 5px; width: 6px; height: 11px; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg); }
.pkg-body { padding: 20px 22px 24px; }
.pkg-heading { display: flex; align-items: baseline; gap: 10px; }
.pkg-code { font-size: 13px; color: var(--faint); }
.pkg-name { font: 500 22px var(--display); letter-spacing: -.02em; }
.pkg-pages { margin-top: 2px; color: var(--muted); font-size: 14px; }
.pkg-feat { margin-top: 16px; border-top: 1px solid var(--line); padding-top: 14px; display: grid; gap: 7px; font-size: 14.5px; }
.pkg-feat li { display: flex; gap: 10px; align-items: baseline; }
.pkg-feat li::before { content: ""; flex: none; width: 8px; height: 1px; background: var(--accent); transform: translateY(-4px); }

/* ---------- шаг 2: допуслуги (ведомость) ---------- */
.addon-group + .addon-group { margin-top: 36px; }
.addon-group-title { font: 500 20px var(--display); letter-spacing: -.02em; padding-bottom: 10px; border-bottom: 1px solid var(--ink); }
.addon { display: grid; grid-template-columns: 44px 1fr auto; gap: 16px; align-items: start; padding: 18px 8px; border-bottom: 1px solid var(--line); transition: background .2s; }
.addon:has(.addon-toggle.on) { background: var(--tint); }
.addon-toggle { position: relative; width: 44px; height: 26px; border-radius: 999px; background: var(--line-2); transition: background .2s; margin-top: 2px; }
.addon-toggle::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: transform .2s var(--ease); }
.addon-toggle.on { background: var(--accent); }
.addon-toggle.on::after { transform: translateX(18px); }
.addon-name { font-weight: 500; }
.addon-desc { margin-top: 2px; color: var(--muted); font-size: 14.5px; max-width: 52ch; }
.addon-price { font: 500 16px var(--display); white-space: nowrap; text-align: right; font-variant-numeric: tabular-nums; }
.tag-tbd { font: 400 14px var(--font); color: var(--muted); }
.addon-qty { display: inline-flex; align-items: center; margin-top: 12px; border-radius: var(--r-ctl); box-shadow: inset 0 0 0 1px var(--line-2); background: var(--card); }
.stepper-btn { width: 38px; height: 38px; font-size: 18px; }
.stepper-btn:hover { color: var(--accent); }
.stepper-val { min-width: 36px; text-align: center; font-weight: 500; }

/* ---------- шаг 3: стиль ---------- */
.card { background: var(--card); border-radius: var(--r-card); box-shadow: inset 0 0 0 1px var(--line); padding: 28px; }
.card-spaced { margin-top: 16px; }
.theme-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.theme-card { text-align: left; border-radius: 12px; padding: 8px 8px 12px; box-shadow: inset 0 0 0 1px var(--line); transition: box-shadow .2s; }
.theme-card.selected { box-shadow: inset 0 0 0 2px var(--accent); background: var(--tint); }
.swatch { aspect-ratio: 3/2; border-radius: 7px; box-shadow: inset 0 0 0 1px rgba(15,26,43,.15); }
.theme-label { margin-top: 10px; padding-left: 4px; font-weight: 500; font-size: 15px; }
.custom-color-row { display: none; gap: 20px; flex-wrap: wrap; margin-top: 22px; padding-top: 22px; border-top: 1px solid var(--line); }
.custom-color-row.show { display: flex; }
.custom-color-field { flex: 1 1 200px; }
.field-label-compact { display: block; margin-bottom: 8px; font-size: 14px; color: var(--muted); }
.color-input-pair { display: flex; gap: 10px; }
input[type=color] { width: 46px; height: 46px; padding: 3px; border-radius: var(--r-ctl); border: 1px solid var(--line-2); background: var(--card); cursor: pointer; }
.ref-section { margin-top: 44px; }
.ref-section-title { font: 500 22px var(--display); letter-spacing: -.02em; margin-bottom: 18px; }
.ref-grid { display: grid; gap: 16px; grid-template-columns: repeat(3, 1fr); }
.layout.no-sidebar .ref-grid { grid-template-columns: repeat(4, 1fr); }
.ref-card { position: relative; text-align: left; background: var(--card); border-radius: 12px; overflow: hidden; box-shadow: inset 0 0 0 1px var(--line); transition: box-shadow .2s; }
.ref-card.selected { box-shadow: inset 0 0 0 2px var(--accent); }
.ref-thumb { display: block; width: 100%; aspect-ratio: 4/3; }
.ref-meta { padding: 12px 14px 14px; }
.ref-title { font-weight: 500; font-size: 15px; line-height: 1.3; }
.ref-tags { margin-top: 3px; color: var(--muted); font-size: 13px; }
.ref-check { position: absolute; top: 10px; right: 10px; z-index: 1; width: 24px; height: 24px; border-radius: 50%; background: rgba(255,255,255,.9); box-shadow: inset 0 0 0 1px var(--line-2); }
.ref-card.selected .ref-check { background: var(--accent); box-shadow: none; }
.ref-card.selected .ref-check::after { content: ""; position: absolute; left: 8px; top: 4px; width: 5px; height: 10px; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg); }

/* ---------- формы ---------- */
.form-card-head { display: flex; gap: 16px; align-items: flex-start; margin-bottom: 26px; }
.form-card-icon { flex: none; width: 44px; height: 44px; border-radius: 12px; background: var(--tint); color: var(--accent); display: grid; place-items: center; font-size: 20px; }
.form-card-head h3 { font: 500 20px var(--display); letter-spacing: -.02em; }
.form-card-head p { color: var(--muted); font-size: 14.5px; margin-top: 2px; }
.field { margin-bottom: 22px; }
.field-no-margin { margin-bottom: 0; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-top: 22px; }
label { display: block; margin-bottom: 8px; font-weight: 500; font-size: 15px; }
.hint { margin-left: 8px; font-weight: 400; font-size: 13px; color: var(--faint); }
.hint-required { color: var(--accent); }
input[type=text], input[type=url], input[type=tel], input[type=email], textarea { width: 100%; padding: 13px 15px; border-radius: var(--r-ctl); border: 1px solid var(--line-2); background: var(--card); font: inherit; color: var(--ink); transition: border-color .2s, box-shadow .2s; }
input::placeholder, textarea::placeholder { color: var(--faint); }
input:focus, textarea:focus { outline: 0; border-color: var(--accent); box-shadow: 0 0 0 3px var(--tint); }
textarea { min-height: 200px; resize: vertical; line-height: 1.55; }
textarea[aria-invalid=true] { border-color: var(--danger); }
.brief-field-meta { display: flex; justify-content: space-between; gap: 16px; margin-top: 8px; font-size: 13.5px; color: var(--muted); }
.brief-count { white-space: nowrap; font-variant-numeric: tabular-nums; }
.brief-count.is-complete { color: var(--ok); }
.method-group { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.method-btn { display: inline-flex; align-items: center; gap: 8px; padding: 10px 16px; border-radius: 999px; box-shadow: inset 0 0 0 1px var(--line-2); font-weight: 500; font-size: 15px; transition: background .2s, color .2s; }
.method-btn:hover { background: var(--paper); }
.method-btn.selected { background: var(--ink); color: #fff; box-shadow: none; }
.contact-bridge { margin-top: 28px; padding-top: 22px; border-top: 1px solid var(--line); }
.contact-bridge-title { font: 500 16px var(--display); margin-bottom: 10px; }
.contact-bridge-list { display: grid; gap: 6px; color: var(--muted); font-size: 14.5px; }
.contact-bridge-list li::before { content: "– "; color: var(--accent); }
.missing-note { margin-top: 14px; font-size: 14px; color: var(--muted); }

/* ---------- сводка: тёмная смета ---------- */
.summary { background: var(--ink); color: #e8ecf2; border-radius: var(--r-card); overflow: hidden; }
.sum-head { display: flex; justify-content: space-between; align-items: flex-end; flex-wrap: wrap; gap: 6px 16px; padding: 24px 26px 18px; }
.sum-head > span:first-child { min-width: 0; }
.sum-label { font: 500 11px/1.3 var(--mono); letter-spacing: .14em; text-transform: uppercase; color: #8d99ab; }
.sum-package-name { display: inline-block; margin-top: 6px; font: 600 22px/1.15 var(--display); letter-spacing: -.02em; color: #fff; overflow-wrap: anywhere; }
.sum-total { font: 600 28px/1 var(--display); letter-spacing: -.03em; color: #fff; font-variant-numeric: tabular-nums; white-space: nowrap; }
.from { margin-right: .3em; font-size: .55em; font-weight: 500; letter-spacing: 0; color: #8d99ab; }
.sum-body { padding: 4px 26px 26px; border-top: 1px solid rgba(255,255,255,.12); }
.sum-empty { padding: 16px 0 4px; color: #8d99ab; font-size: 14.5px; }
.sum-line { display: flex; gap: 14px; justify-content: space-between; align-items: baseline; padding: 9px 0; font-size: 14.5px; }
.sum-line .n { flex: 1; min-width: 0; display: flex; gap: 10px; color: #c9d1dc; }
.sum-line .n::after { content: ""; flex: 1; min-width: 12px; border-bottom: 1px dotted rgba(255,255,255,.28); transform: translateY(-5px); align-self: flex-end; }
.sum-line .v { font-variant-numeric: tabular-nums; white-space: nowrap; color: #fff; }
.sum-footer { margin-top: 12px; padding-top: 16px; border-top: 1px solid rgba(255,255,255,.2); }
.sum-line-total { align-items: baseline; padding: 0; }
.sum-line-total .n { flex: none; color: #8d99ab; font: 500 11px/1.3 var(--mono); letter-spacing: .14em; text-transform: uppercase; }
.sum-line-total .n::after { display: none; }
.sum-line-total .v { font: 600 28px/1 var(--display); letter-spacing: -.03em; }
.sum-note { margin-top: 10px; font-size: 13px; line-height: 1.45; color: #8d99ab; }
.sum-actions { display: flex; gap: 10px; margin-top: 20px; }
.summary .btn { background: var(--accent); color: #fff; }
.summary .btn:hover:not(:disabled) { background: #6f9396; }
.summary .btn.secondary { background: transparent; box-shadow: inset 0 0 0 1px rgba(255,255,255,.28); }
.summary .btn.secondary:hover { background: rgba(255,255,255,.08); }
.sum-cta { flex: 1; white-space: nowrap; }

/* ---------- успех: окно как на главной (тёмное, в стиле macOS) ---------- */
.modal { --m-text: #0f1a2b; --m-muted: #5c6675; --m-faint: #8a93a0; --m-line: rgba(15,26,43,.12); --m-line-strong: rgba(15,26,43,.22); --m-accent: #4f7578;
  width: min(520px, calc(100% - 16px)); max-width: none; max-height: calc(100svh - 16px); margin: auto; padding: 0; border: 0; background: transparent; color: var(--m-text); overflow: visible; }
.modal::backdrop { background: rgba(15,26,43,.42); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.modal[open] { animation: modal-in .45s var(--ease); }
.modal[open]::backdrop { animation: fade-in .35s ease; }
.modal.is-closing { animation: modal-out .2s ease forwards; }
.modal.is-closing::backdrop { animation: fade-out .2s ease forwards; }
.modal-content { display: flex; flex-direction: column; max-height: calc(100svh - 16px); overflow: hidden; border: 1px solid var(--m-line-strong); border-radius: 22px; background: #fff; box-shadow: 0 30px 100px rgba(15,26,43,.28); }
.window-bar { flex: none; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 15px; border-bottom: 1px solid var(--m-line); background: #f4f5f3; }
.traffic-lights { display: flex; flex-shrink: 0; gap: 8px; }
.traffic-lights i, .tl-close { width: 11px; height: 11px; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(0,0,0,.18); }
.traffic-lights i:nth-child(1), .tl-close { background: #ff5f57; }
.traffic-lights i:nth-child(2) { background: #febc2e; }
.traffic-lights i:nth-child(3) { background: #28c840; }
.tl-close { position: relative; transition: filter .2s var(--ease); }
.tl-close::after { content: ""; position: absolute; inset: -8px; }
.tl-close:hover { filter: brightness(1.15); }
.window-label { display: flex; align-items: center; gap: 7px; color: var(--m-faint); font: 10px var(--mono); white-space: nowrap; }
.modal-esc { padding: 4px 8px; border: 1px solid var(--m-line); border-radius: 7px; color: var(--m-faint); font: 10px var(--mono); letter-spacing: .08em; transition: color .2s, border-color .2s, background .2s; }
.modal-esc:hover { color: var(--m-text); border-color: var(--m-line-strong); background: #fff; }
.modal-body { display: flex; flex-direction: column; gap: 16px; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: clamp(20px, 5vw, 32px); background: radial-gradient(circle at 88% 0%, rgba(79,117,120,.10), transparent 50%), #fff; }
.modal[open] .modal-body > * { animation: rise .6s var(--ease) both; animation-delay: .08s; }
.modal[open] .modal-body > :nth-child(2) { animation-delay: .14s; }
.modal[open] .modal-body > :nth-child(3) { animation-delay: .2s; }
.modal[open] .modal-body > :nth-child(4) { animation-delay: .26s; }
.modal[open] .modal-body > :nth-child(5) { animation-delay: .32s; }
.modal[open] .modal-body > :nth-child(6) { animation-delay: .38s; }
.modal-title { font-size: clamp(26px, 6vw, 36px); font-weight: 680; line-height: 1.05; letter-spacing: -.045em; color: var(--m-text); }
.modal-title .accent { color: var(--m-accent); }
.modal-lead { max-width: 420px; color: var(--m-muted); font-size: 14px; line-height: 1.55; }
.modal-label { display: block; margin-bottom: 10px; color: var(--m-faint); font: 500 10px/1.3 var(--mono); letter-spacing: .14em; text-transform: uppercase; }
.service-checklist { display: grid; gap: 10px; }
.service-checklist li { display: flex; align-items: flex-start; gap: 10px; color: var(--m-muted); font-size: 13.5px; line-height: 1.5; }
.service-checklist .bi { flex: none; margin-top: 3px; color: var(--m-accent); font-size: 13px; }
.service-modal-meta { display: flex; flex-wrap: wrap; gap: 10px; }
.service-modal-meta[hidden] { display: none; }
.service-modal-meta span { display: inline-flex; align-items: center; gap: 7px; padding: 8px 14px; border: 1px solid var(--m-line-strong); border-radius: 999px; background: #f4f5f3; color: var(--m-text); font: 12.5px var(--mono); overflow-wrap: anywhere; }
.service-modal-meta .bi { color: var(--m-accent); }
.success-badge { width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; background: var(--ok); color: #fff; font-size: 26px; }
.success-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.modal .cta { display: inline-flex; align-items: center; justify-content: center; gap: 12px; padding: 14px 18px; border: 1px solid var(--m-line-strong); border-radius: 10px; background: #fff; color: var(--m-text); font-weight: 500; transition: transform .3s var(--ease), background .3s var(--ease), filter .3s var(--ease); }
.modal .cta:active { transform: scale(.98); }
.modal .cta-primary { border-color: transparent; background: #0f1a2b; color: #fff; font-weight: 600; }
.modal .cta:not(.cta-primary):hover { background: #f4f5f3; }
.modal .cta-primary:hover { background: var(--m-accent); }
@media (hover: hover) { .modal .cta:hover { transform: translateY(-2px); } }
@media (max-width: 480px) { .success-actions .cta { flex: 1 1 100%; } .window-label { font-size: 9px; } }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes modal-in { from { opacity: 0; transform: translateY(18px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes modal-out { to { opacity: 0; transform: translateY(10px) scale(.98); } }
@keyframes fade-in { from { opacity: 0; } }
@keyframes fade-out { to { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .modal, .modal * { animation-duration: .01ms !important; } }

/* ---------- планшет и телефон ---------- */
@media (max-width: 960px) {
  .layout { display: block; }
  .shell { padding: calc(var(--nav-clear) + 16px) 24px calc(150px + var(--safe-b)); }
  .step-panel .nav-row { display: flex; }
  .pkg-grid, .layout.no-sidebar .pkg-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .ref-grid, .layout.no-sidebar .ref-grid { grid-template-columns: repeat(2, 1fr); }
  #sidebar { position: static; }
  .summary { position: fixed; z-index: 50; left: 0; right: 0; bottom: 0; border-radius: 20px 20px 0 0; padding-bottom: var(--safe-b); box-shadow: 0 -14px 40px rgba(15,26,43,.28); }
  .sum-head { position: relative; padding-top: 28px; cursor: pointer; }
  .sum-head::before { content: ""; position: absolute; top: 10px; left: 50%; width: 36px; height: 4px; margin-left: -18px; border-radius: 2px; background: rgba(255,255,255,.3); }
  .sum-total { font-size: 26px; }
  .sum-line-total { display: none; }
  .sum-footer { padding-top: 4px; border-top: 0; }
  .sum-body { max-height: 0; overflow: hidden; padding: 0 26px; border-top-color: transparent; transition: max-height .25s var(--ease), padding .25s var(--ease); }
  .summary.expanded .sum-body { max-height: 70svh; overflow-y: auto; padding: 4px 26px 22px; border-top-color: rgba(255,255,255,.12); }
}
@media (max-width: 640px) {
  .prog-line { width: 10px; }
  .step-label { display: none; }
  .shell { padding-left: 18px; padding-right: 18px; }
  .pkg-grid, .layout.no-sidebar .pkg-grid, .ref-grid, .layout.no-sidebar .ref-grid { grid-template-columns: 1fr; }
  .theme-grid { grid-template-columns: repeat(2, 1fr); }
  .card { padding: 20px; }
  .field-row { grid-template-columns: 1fr; }
  .addon { grid-template-columns: 44px 1fr; row-gap: 8px; padding-inline: 0; }
  .addon-price { grid-column: 2; text-align: left; }
}
@media (min-width: 961px) and (max-width: 1180px) {
  .layout.no-sidebar .pkg-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* ---------- шапка: копия с главной ---------- */
.status-dot {
  flex: none;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #9bbbd8;
  box-shadow: 0 0 12px rgba(155, 187, 216, 0.6);
  animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse { 50% { opacity: 0.35; } }
/* =========================================================
   ШАПКА — плавающая «стеклянная» плашка
   Края плашки совпадают с краями контента (--gutter).
   ========================================================= */

.topbar {
  position: fixed;
  z-index: 1030;
  top: calc(var(--topbar-top) + var(--safe-top));
  left: var(--gutter);
  right: var(--gutter);
  max-width: calc(var(--max-width) - 2 * var(--gutter));
  margin-inline: auto;
  padding: 0 10px 0 16px;

  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(24, 27, 32, 0.8);
  -webkit-backdrop-filter: blur(22px);
  backdrop-filter: blur(22px);
  box-shadow: 0 14px 50px rgba(0, 0, 0, 0.2);

  transition: background 0.3s var(--ease), border-color 0.3s var(--ease);
}

/* После прокрутки плашка плотнее (класс ставит JS) */
.topbar.scrolled {
  background: rgba(24, 27, 32, 0.92);
  border-color: var(--line-strong);
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: calc(var(--topbar-h) - 2px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.04em;
  white-space: nowrap;
}

.brand-mark {
  display: block;
  flex: none;
  border-radius: 7px;
}

.brand-dot { color: var(--blue-light); }

.navigation {
  display: none;
  gap: 3px;
  color: var(--muted);
  font-size: 13px;
}

.navigation a {
  padding: 8px 10px;
  border-radius: 10px;
  transition: background 0.25s var(--ease), color 0.25s var(--ease);
}

.navigation a:hover,
.navigation a.active {
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.topbar-status {
  display: none;
  align-items: center;
  gap: 8px;
  padding: 7px 13px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.topbar-actions .topbar-cta { display: none; } /* специфичнее .cta — не зависит от порядка правил в файле */

/* Компактная кнопка и бургер — только на телефоне */
.cta-icon,
.menu-toggle {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: transparent;
  font-size: 19px;
  transition: background 0.25s var(--ease), border-color 0.25s var(--ease);
}

.cta-icon {
  border-color: var(--line-strong);
  background: var(--surface);
  color: var(--text);
  font-size: 17px;
}

.menu-toggle .bi-x-lg,
.menu-toggle[aria-expanded="true"] .bi-list {
  display: none;
}

.menu-toggle[aria-expanded="true"] .bi-x-lg {
  display: block;
}

/* Выпадающее меню: высота анимируется через grid-template-rows */
.mobile-nav {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.35s var(--ease);
}

.mobile-nav.is-open {
  grid-template-rows: 1fr;
}

.mobile-nav-clip {
  min-height: 0;
  overflow: hidden;
}

.mobile-nav-inner {
  display: grid;
  gap: 2px;
  margin-top: 9px;
  padding: 8px 6px 12px 0;
  border-top: 1px solid var(--line);
  /* В ландшафте меню не должно выходить за экран */
  max-height: calc(var(--app-h) - var(--nav-clear) - 12px);
  overflow-y: auto;
}

.mobile-nav a:not(.cta) {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 10px;
  border-radius: 10px;
  color: var(--muted);
  font-size: 15px;
}

.mobile-nav a:not(.cta):active,
.mobile-nav a.active {
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
}

.mobile-nav .bi { color: var(--blue); }

.mobile-nav .cta {
  justify-content: center;
  margin-top: 6px;
}

.topbar:has(.mobile-nav.is-open) {
  background: rgba(24, 27, 32, 0.97);
}

/* Полоса прогресса чтения (значение задаёт JS) */
.topbar-progress {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 0;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--blue), var(--blue-light));
  transform: scaleX(var(--progress, 0));
  transform-origin: left;
  pointer-events: none;
}

/* =========================================================
   КНОПКИ
   ========================================================= */

.cta,
.cta-primary,
.cta-ghost {
  display: inline-flex;
  align-items: center;
  border-radius: 12px;
  transition:
    transform 0.3s var(--ease),
    background 0.3s var(--ease),
    border-color 0.3s var(--ease),
    color 0.25s var(--ease),
    filter 0.3s var(--ease);
}

.cta {
  gap: 14px;
  padding: 14px 18px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--text);
}

button.cta {
  appearance: none;
  -webkit-appearance: none;
}

.cta-sm {
  gap: 8px;
  padding: 9px 13px;
  border-radius: 11px;
  font-size: 13px;
  font-weight: 550;
}

.cta-primary {
  gap: 12px;
  padding: 15px 20px;
  border: 1px solid transparent;
  background: linear-gradient(135deg, var(--blue-light), var(--tech));
  color: #12161b;
  font-weight: 620;
}

.cta-ghost {
  gap: 10px;
  padding: 14px 19px;
  border: 1px solid var(--line);
  color: var(--muted);
}

.cta .bi,
.cta-primary .bi,
.cta-ghost .bi {
  transition: transform 0.3s var(--ease);
}

.cta:active,
.cta-primary:active,
.cta-ghost:active,
.social-link:active,
.chip:active {
  transform: scale(0.98);
}

@media (hover: hover) {
  .cta:hover {
    transform: translateY(-2px);
    background: var(--surface-2);
    border-color: rgba(168, 200, 231, 0.5);
  }

  .cta-primary:hover {
    transform: translateY(-2px);
    filter: brightness(1.08);
  }

  .cta-ghost:hover {
    color: var(--text);
    border-color: var(--line-strong);
    background: rgba(255, 255, 255, 0.04);
  }

  .cta:hover .bi-arrow-up-right,
  .cta-primary:hover .bi-arrow-up-right {
    transform: translate(2px, -2px);
  }

  .cta-ghost:hover .bi-arrow-down {
    transform: translateY(2px);
  }

  .cta-icon:hover,
  .menu-toggle:hover {
    border-color: var(--line-strong);
    background: var(--surface-2);
  }
}


/* светлая версия шапки (как theme-light.css на главной) */
.status-dot { background: var(--blue); box-shadow: 0 0 10px rgba(79,117,120,.4); }
.topbar { background: rgba(244,245,243,.82); box-shadow: 0 14px 50px rgba(15,26,43,.08); }
.topbar.scrolled { background: rgba(244,245,243,.94); }
.topbar:has(.mobile-nav.is-open) { background: rgba(244,245,243,.98); }
.navigation a:hover, .navigation a.active, .mobile-nav a:not(.cta):active, .mobile-nav a.active { background: rgba(15,26,43,.06); }
.cta:hover { border-color: rgba(79,117,120,.45); }
#topbarProgress { transform: scaleX(var(--wizard-progress, 0)); transition: transform .4s var(--ease); }

/* полоса прокрутки: тонкий ползунок без фона */
* { scrollbar-width: thin; scrollbar-color: rgba(15,26,43,.28) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(15,26,43,.26); background-clip: content-box; border: 3px solid transparent; border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: rgba(79,117,120,.8); background-clip: content-box; }
::-webkit-scrollbar-corner { background: transparent; }


/* =========================================================
   ШАПКА: иконка-конверт и бургер — только на телефоне
   (на десктопе в этой копии шапки не было правила, которое их прячет)
   ========================================================= */
@media (min-width: 768px) {
  .cta-icon,
  .menu-toggle { display: none; }
}

/* =========================================================
   ДЕСКТОП (≥961px): смета зафиксирована, шаги 4–5 — на один экран
   ---------------------------------------------------------
   Смета: зазор под шапкой = зазор до низа экрана (по 24px), высота
   равна экрану, при прокрутке страницы она не двигается; если услуг
   много — прокручивается только их список, «Итого» и кнопки на месте.
   Нулевой скролл: высота страницы = ровно 100svh, пока контент шага
   помещается.
   ========================================================= */
@media (min-width: 961px) {
  :root {
    --sb-top: calc(var(--topbar-top) + var(--safe-top) + var(--topbar-h) + 24px);
    --sb-gap: 24px;
    --stepper-h: 28px;
    --stepper-gap: 20px;
    --layout-top: calc(var(--sb-top) + var(--stepper-h) + var(--stepper-gap));
  }

  .shell { padding-top: var(--sb-top); }
  .shell:has(.layout:not(.no-sidebar)) { padding-bottom: var(--sb-gap); }

  .stepper { height: var(--stepper-h); margin-bottom: var(--stepper-gap); }
  /* подпись «Шаг N из 5» не заезжает под смету */
  .shell:has(.layout:not(.no-sidebar)) .stepper { max-width: calc(100% - 380px - 48px); }

  /* колонка сметы: sticky с тем же top, что и естественное место, —
     поэтому при прокрутке она не «уезжает» и не подпрыгивает */
  #sidebar {
    position: sticky;
    top: var(--sb-top);
    margin-top: calc(var(--sb-top) - var(--layout-top));
  }
  .summary { max-height: calc(100vh - var(--sb-top) - var(--sb-gap)); max-height: calc(100svh - var(--sb-top) - var(--sb-gap)); display: flex; flex-direction: column; }
  .sum-total { display: none; }
  .sum-head { flex: none; }
  .sum-body { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
  .sum-lines { flex: 0 1 auto; min-height: 0; overflow-y: auto; margin: 0 -14px 12px 0; padding-right: 14px; }
  .sum-footer { flex: none; }

  /* шаги 4 и 5: компактнее вертикальные отступы */
  #step-brief .panel-head p,
  #step-contact .panel-head p { margin-top: 10px; max-width: 80ch; }
  #step-brief .step-body,
  #step-contact .step-body { margin-top: 20px; }
  #step-brief .card,
  #step-contact .card { padding: 24px; }
  #step-brief .form-card-head,
  #step-contact .form-card-head { margin-bottom: 18px; }
  #step-brief .field,
  #step-contact .field { margin-bottom: 16px; }
  #step-brief .field-no-margin,
  #step-contact .field-no-margin { margin-bottom: 0; }
  #step-brief .field-row { margin-top: 16px; }
  #step-brief textarea { min-height: clamp(110px, 20vh, 200px); }
  #step-contact .contact-bridge { margin-top: 20px; padding-top: 16px; }
  #step-contact .missing-note { margin-top: 10px; }
}

/* шаг 5 на широком экране: имя и способ связи в две колонки, «После отправки» — в строку */
@media (min-width: 1180px) {
  #step-contact .card { display: grid; grid-template-columns: 1fr 1fr; column-gap: 24px; align-items: start; }
  #step-contact .form-card-head,
  #step-contact .contact-bridge { grid-column: 1 / -1; }
  #step-contact .card > .field { margin-bottom: 0; }
  #step-contact .contact-bridge-list { grid-template-columns: repeat(3, 1fr); gap: 16px; }
}
