:root {
  --primary: #c8102e;
  --accent: #111;
  --text: #1b1b1b;
  --on-primary: #fff;
  --muted: #5d6470;
  --line: #e2e5ea;
  --bg: #f4f5f7;
  --card: #fff;
  --ok: #1a7f37;
  --bad: #b42318;
  --radius: 14px;
  --outline: #ffe600;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--text);
  -webkit-text-size-adjust: 100%;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); line-height: 1.45; }
body.embed { background: transparent; }
body.embed .site-header, body.embed .site-footer { display: none; }
[hidden] { display: none !important; }

.site-header {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 16px; background: #fff; border-bottom: 1px solid var(--line);
}
.brand img { height: 40px; width: auto; display: block; }
.site-footer { text-align: center; color: var(--muted); font-size: 13px; padding: 16px 16px 28px; }
.site-footer a { color: inherit; }

.panel {
  max-width: 560px; margin: 16px auto; background: var(--card); border-radius: var(--radius);
  box-shadow: 0 1px 2px rgba(0,0,0,.06), 0 8px 24px rgba(0,0,0,.06); padding: 20px 16px 24px;
}
body.embed .panel { margin: 0 auto; box-shadow: none; border: 1px solid var(--line); }
@media (max-width: 600px) { .panel { margin: 0; border-radius: 0; box-shadow: none; } }

h1 { font-size: 28px; line-height: 1.15; margin: 4px 0 6px; letter-spacing: -.01em; }
h2 { font-size: 22px; line-height: 1.2; margin: 4px 0 8px; }
.section-h { font-size: 16px; margin: 18px 0 8px; }
.sub { color: var(--muted); margin: 0 0 16px; }
.msg { margin: 0 0 10px; color: var(--muted); min-height: 1.45em; }
.msg.warn { color: var(--bad); font-weight: 600; }
.addr { color: var(--muted); margin: -4px 0 10px; font-size: 14px; }
.label { display: block; font-weight: 600; font-size: 14px; margin-bottom: 6px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 12px 18px; border-radius: 10px; border: 2px solid transparent;
  font: inherit; font-weight: 700; letter-spacing: .03em; font-size: 16px; cursor: pointer; text-decoration: none;
}
.btn-primary { background: var(--primary); color: var(--on-primary); }
.btn-primary:disabled { background: #c9ccd2; color: #fff; cursor: not-allowed; }
.btn-ghost { background: #fff; color: var(--accent); border-color: var(--line); }
.btn-ghost[aria-pressed="true"] { border-color: var(--primary); color: var(--primary); }
.btn-block { width: 100%; margin-top: 14px; }
.btn-row { display: flex; gap: 10px; margin-top: 16px; }
.btn-row .btn { flex: 1; }
.back, .link-btn {
  background: none; border: 0; color: var(--muted); font: inherit; font-size: 15px;
  padding: 10px 4px; min-height: 44px; cursor: pointer;
}
.back { margin: -8px 0 0 -4px; }
.link-btn { display: block; margin: 12px auto 0; text-decoration: underline; }
:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; }

/* Step 1 hero */
.panel.on-hero { padding: 0; background: transparent; box-shadow: none; max-width: 980px; }
.hero { position: relative; min-height: 520px; border-radius: 18px; display: flex; align-items: center; justify-content: center; padding: 28px 16px 44px; }
body.embed .hero { border-radius: 14px; }
.hero .map-slot-hero { position: absolute; inset: 0; border-radius: 18px; overflow: hidden; }
.hero-shade { position: absolute; inset: 0 0 26px; border-radius: 18px 18px 0 0; background: linear-gradient(180deg, rgba(0,0,0,.45), rgba(0,0,0,.2)); pointer-events: none; }
.hero-card { position: relative; z-index: 2; width: 100%; max-width: 520px; background: #fff; border-radius: 16px; padding: 24px 20px 18px; box-shadow: 0 20px 50px rgba(0,0,0,.3); }
.hero-card h1 { font-size: 30px; }
.addr-search { position: relative; }
.search-wrap { display: flex; align-items: center; gap: 8px; background: #fff; border: 2px solid #d5d8de; border-radius: 12px; padding: 4px 4px 4px 12px; transition: border-color .15s; }
.search-wrap:focus-within { border-color: var(--primary); box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 15%, transparent); }
.search-ico { width: 22px; height: 22px; flex: none; color: var(--primary); }
.search-wrap input { flex: 1; min-width: 0; border: 0; outline: 0; font: inherit; font-size: 17px; min-height: 48px; background: transparent; color: var(--text); }
.search-wrap .btn { min-height: 48px; padding: 0 20px; flex: none; }
.addr-list { position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 10; list-style: none; margin: 0; padding: 6px; background: #fff; border-radius: 12px; box-shadow: 0 12px 32px rgba(0,0,0,.18); border: 1px solid var(--line); }
.addr-list li { display: flex; gap: 10px; align-items: flex-start; padding: 10px; border-radius: 8px; cursor: pointer; min-height: 44px; }
.addr-list li[aria-selected="true"], .addr-list li:hover { background: #f1f2f4; }
.addr-list svg { width: 18px; height: 18px; flex: none; margin-top: 2px; color: var(--muted); }
.addr-list b { display: block; font-weight: 600; }
.addr-list span { color: var(--muted); font-size: 14px; }
.addr-companions { position: absolute; left: 0; top: 0; width: 1px; height: 1px; overflow: hidden; opacity: 0; pointer-events: none; }
.trust { list-style: none; display: flex; flex-wrap: wrap; gap: 6px 16px; padding: 0; margin: 14px 0 0; color: var(--muted); font-size: 13px; }
.trust li::before { content: "✓ "; color: var(--ok); font-weight: 700; }
@media (max-width: 600px) {
  .hero, .hero .map-slot-hero, .hero-shade { border-radius: 0; }
  .hero { min-height: calc(100dvh - 61px); padding-bottom: 80px; }
  .hero-card h1 { font-size: 26px; }
  .search-wrap { padding-left: 10px; gap: 6px; }
  .search-wrap .btn { padding: 0 14px; }
}
/* Steps 3–5: Roofle-style map on top, content below */
.panel.map-first { padding: 0; overflow: hidden; }
.map-first .step-body { padding: 16px 16px 24px; }
.map-first .map-slot-top { height: min(46vh, 360px); border-radius: 0; }
.map-first .map-slot-short { height: min(30vh, 220px); }
.center { text-align: center; }
#h3 { font-size: 21px; margin: 4px 0 14px; }

.roof-card { position: relative; max-width: 420px; margin: 0 auto; border: 1.5px solid color-mix(in srgb, var(--primary) 30%, #fff); border-radius: 14px; padding: 18px 14px 12px; text-align: center; }
.roof-card.confirmed { border-color: var(--ok); }
.rc-delete { position: absolute; top: 4px; right: 4px; }
.rc-icon svg { width: 72px; height: 60px; color: var(--accent); }
.roof-card .rc-head { justify-content: center; border-bottom: 1.5px solid var(--line); margin: 4px 8px 0; padding-bottom: 2px; }
.roof-card .rc-name { flex: 0 1 auto; font-size: 20px; }
.roof-card .rc-name input { text-align: center; }
.roof-card .slopes { margin-top: 14px; gap: 4px; }
.slope span { border: 1.5px solid transparent; border-radius: 10px; padding: 6px 2px; color: var(--muted); font-weight: 500; font-size: 14px; gap: 6px; }
.slope .slope-dot { width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; background: #fff; box-shadow: 0 2px 8px rgba(0,0,0,.12); font-style: normal; }
.slope .slope-dot svg { width: 30px; height: 26px; }
.slope input:checked + span { border-color: color-mix(in srgb, var(--primary) 45%, #fff); background: transparent; color: var(--accent); font-weight: 700; }
.slope input:checked + span .slope-dot { box-shadow: 0 0 0 2px var(--primary); }
.slope input:checked + span svg { color: var(--accent); }
.roof-card .rc-confirm { justify-content: center; }

/* Step 4 pop-up over the blurred quote */
.gate { position: fixed; inset: 0; z-index: 50; display: flex; padding: 16px; overflow-y: auto; background: rgba(12, 14, 18, .5); backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px); animation: gate-fade .25s ease-out; }
.gate-card { position: relative; width: 100%; max-width: 480px; margin: auto; background: #fff; border-radius: 18px; padding: 22px 20px 20px; box-shadow: 0 24px 60px rgba(0,0,0,.35); animation: gate-pop .3s cubic-bezier(.2,.9,.3,1.2); }
.gate-card .back { position: absolute; top: 12px; left: 14px; margin: 0; }
body.gated { overflow: hidden; }
body.gated #step-5 .price-box, body.gated #step-5 .details { filter: blur(7px); user-select: none; }
body.gated #talk-btn { visibility: hidden; }
@keyframes gate-fade { from { opacity: 0; } }
@keyframes gate-pop { from { opacity: 0; transform: translateY(16px) scale(.97); } }
.lead-body { max-width: 480px; margin: 0 auto; }
.gate .gate-card { margin: auto; }
.lead-ico { color: var(--primary); text-align: center; margin: -4px 0 4px; }
.lead-ico svg { width: 64px; height: 64px; }
.lead-body h2 { font-size: 28px; margin-bottom: 4px; }
.lead-sub { font-size: 18px; font-weight: 600; color: var(--text); margin-bottom: 16px; }
.stack .field { margin-bottom: 10px; }
.lead-body .field input::placeholder { color: #8a9099; }

.result-top { padding: 12px 16px 10px; text-align: center; }
.restart-line { margin: 0 0 8px; font-size: 14px; color: var(--muted); }
.link-inline { background: none; border: 0; padding: 0; font: inherit; color: var(--primary); text-decoration: underline; cursor: pointer; min-height: 32px; }
.addr-pill { display: flex; align-items: center; gap: 8px; text-align: left; border: 1.5px solid var(--line); border-radius: 10px; padding: 10px 12px; font-size: 15px; }
.addr-pill svg { width: 18px; height: 18px; flex: none; color: var(--muted); }
.detail.detail { justify-content: flex-start; align-items: center; gap: 14px; }
.detail > div { flex: 1; text-align: left; }
.detail-ico svg { width: 40px; height: 34px; color: var(--accent); display: block; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

.map-slot { position: relative; border-radius: 12px; overflow: hidden; background: #d7dbe0; }
.map-slot-intro { height: 220px; margin-top: 18px; }
.map-slot-work { height: min(58vh, 460px); }
.map-slot-result { height: 260px; }
.map-slot-mini { height: 200px; margin: 4px 0 14px; }
.map { width: 100%; height: 100%; }
.map-slot:empty::after { content: ""; display: block; }
.map.static .mapboxgl-ctrl-group { display: none; }

.toolbar { display: flex; gap: 10px; margin-top: 10px; }
.toolbar .btn { flex: 1; font-size: 15px; }
.roof-chips { list-style: none; padding: 0; margin: 10px 0 0; display: flex; flex-wrap: wrap; gap: 8px; }
.roof-chips li {
  display: flex; align-items: center; gap: 4px; padding: 4px 4px 4px 12px; border-radius: 999px;
  background: #f1f2f4; font-size: 14px; font-weight: 600;
}
.chip-x { border: 0; background: none; width: 36px; height: 36px; border-radius: 50%; cursor: pointer; font-size: 18px; color: var(--muted); }

.roof-cards { display: grid; gap: 12px; }
.roof-card { border: 1px solid var(--line); border-radius: 12px; padding: 12px; }
.roof-card.confirmed { border-color: var(--ok); }
.rc-head { display: flex; align-items: center; gap: 4px; }
.rc-name { font-weight: 700; font-size: 17px; flex: 1; min-width: 0; }
.rc-name input { font: inherit; font-size: 16px; width: 100%; padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; }
.icon-btn { width: 44px; height: 44px; border: 0; background: none; border-radius: 10px; cursor: pointer; color: var(--muted); display: grid; place-items: center; }
.icon-btn:hover { background: #f1f2f4; }
.slopes { border: 0; padding: 0; margin: 8px 0 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.slopes legend { font-size: 13px; color: var(--muted); margin-bottom: 6px; padding: 0; }
.slope { position: relative; }
.slope input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.slope span {
  display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 2px 6px;
  border: 2px solid var(--line); border-radius: 10px; font-size: 13px; font-weight: 600; text-align: center; min-height: 44px;
}
.slope small { font-weight: 500; color: var(--muted); font-size: 11px; }
.slope svg { width: 40px; height: 32px; color: var(--muted); }
.slope input:checked + span { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 8%, #fff); }
.slope input:checked + span svg { color: var(--primary); }
.slope input:focus-visible + span { outline: 3px solid var(--primary); outline-offset: 2px; }
.rc-confirm { display: flex; align-items: center; gap: 10px; margin-top: 10px; min-height: 44px; font-weight: 600; cursor: pointer; }
.rc-confirm input { width: 22px; height: 22px; accent-color: var(--ok); }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
@media (max-width: 380px) { .grid2 { grid-template-columns: 1fr; } }
.field { margin-bottom: 8px; }
.field label { display: block; font-weight: 600; font-size: 14px; margin-bottom: 4px; }
.field input {
  width: 100%; font: inherit; font-size: 17px; padding: 12px; min-height: 48px;
  border: 1.5px solid #c9ccd2; border-radius: 10px; background: #fff; color: var(--text);
}
.field input[aria-invalid="true"] { border-color: var(--bad); }
.err { color: var(--bad); font-size: 13px; margin: 4px 0 0; min-height: 0; }
.err:empty { display: none; }
.form-err { margin-top: 10px; font-size: 14px; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.consent { display: flex; gap: 10px; align-items: flex-start; font-size: 12px; color: var(--muted); margin: 10px 0; cursor: pointer; }
.consent input { width: 20px; height: 20px; flex: none; margin-top: 1px; }
.consent a { color: inherit; }

.details { display: grid; gap: 8px; }
.detail { display: flex; justify-content: space-between; gap: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; font-size: 15px; }
.detail b { display: block; }
.detail .dim { color: var(--muted); font-size: 13px; }
.detail .area { font-weight: 700; white-space: nowrap; align-self: center; }
.price-box { margin-top: 20px; padding: 20px 0 4px; border-top: 1px solid var(--line); }
.price-label { margin: 0; font-size: 15px; font-weight: 600; color: var(--text); }
.price { margin: 4px 0 2px; font-size: 44px; font-weight: 800; letter-spacing: -.03em; color: var(--text); line-height: 1.05; font-variant-numeric: tabular-nums; }
.price-range { margin: 0; font-size: 15px; color: var(--muted); }
.price-range span { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.price-incl { list-style: none; padding: 0; margin: 14px 0 0; font-size: 14px; color: var(--muted); display: grid; gap: 4px; }
.price-incl li::before { content: "✓"; color: var(--text); font-weight: 700; margin-right: 8px; }
.fine { margin: 8px 0 0; font-size: 13px; color: var(--muted); }
.cta-note { margin: 8px 0 0; text-align: center; font-size: 13px; color: var(--muted); }
body.gated .cta-note { visibility: hidden; }
.demo-note { margin: 12px 0 0; font-size: 12px; color: var(--muted); font-style: italic; }

dialog#booking-dialog { width: min(720px, 100vw); height: min(860px, 100dvh); max-width: 100vw; max-height: 100dvh; padding: 0; border: 0; border-radius: 12px; }
dialog#booking-dialog::backdrop { background: rgba(0,0,0,.5); }
.dialog-bar { display: flex; align-items: center; justify-content: space-between; padding: 6px 6px 6px 16px; border-bottom: 1px solid var(--line); }
.dialog-close { width: 44px; height: 44px; font-size: 26px; border: 0; background: none; cursor: pointer; }
#booking-frame { width: 100%; height: calc(100% - 57px); border: 0; }

.roof-label-marker { pointer-events: none; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; scroll-behavior: auto !important; } }

/* Headings get programmatic focus for screen readers; no visible ring needed. */
h1[tabindex="-1"]:focus, h2[tabindex="-1"]:focus { outline: none; }
