/* ============================================================
   ALUMIO STUDIO — 3D-konfigurator (testdesign)
   Komplett, fristående designsystem. Rör ej live-modulatorn.
   ============================================================ */

/* ---------- Tokens ---------- */
:root {
  --ink: #15171c;
  --ink-2: #2a2d35;
  --text: #1d1f24;
  --muted: #6b7079;
  --muted-2: #9aa0a8;
  --line: rgba(21, 23, 28, 0.10);
  --line-soft: rgba(21, 23, 28, 0.06);
  --paper: #f5f3ee;
  --paper-2: #eceae3;
  --white: #ffffff;
  --accent: #15171c;
  --accent-glow: rgba(21, 23, 28, 0.16);
  --good: #1a8e4a;
  --warn: #c2491d;
  --glass: rgba(255, 255, 255, 0.72);
  --glass-strong: rgba(255, 255, 255, 0.86);
  --glass-border: rgba(255, 255, 255, 0.7);
  --r-xl: 28px;
  --r-lg: 20px;
  --r-md: 14px;
  --r-sm: 10px;
  --shadow-sm: 0 2px 10px rgba(20, 22, 28, 0.06);
  --shadow-md: 0 14px 36px rgba(20, 22, 28, 0.10);
  --shadow-lg: 0 30px 70px rgba(20, 22, 28, 0.18);
  --shadow-dock: 0 40px 90px -30px rgba(20, 22, 28, 0.45);
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --topbar-h: 64px;
  --font: "Manrope", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --display: "Fraunces", Georgia, serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }
/* iOS Safari skalar annars om texten godtyckligt vid rotation */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
/* Snabba dubbeltryck på kontroller ska inte trigga iOS dubbeltryck-zoom */
button, [role="button"], input[type="range"], input[type="checkbox"], .rail-step, .stage-view, .hud-btn, .segment, .dim-preset { touch-action: manipulation; }

body.studio {
  font-family: var(--font);
  color: var(--text);
  background:
    radial-gradient(120% 80% at 70% -10%, #fbfaf7 0%, #eceae3 55%, #e3e1d9 100%);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow: hidden;
}

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}
.is-hidden { display: none !important; }
[hidden] { display: none !important; }

/* ---------- Cinematisk intro ---------- */
.studio-intro {
  position: fixed; inset: 0; z-index: 9000;
  display: grid; place-items: center;
  background: radial-gradient(120% 90% at 50% 35%, #1c1f26 0%, #101217 70%, #0b0c10 100%);
  transition: opacity 0.7s var(--ease), visibility 0.7s var(--ease);
}
.studio-intro.is-done { opacity: 0; visibility: hidden; pointer-events: none; }
.studio-intro-inner { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.studio-intro-mark {
  font-weight: 800; letter-spacing: 0.42em; font-size: 0.92rem;
  color: rgba(255,255,255,0.62); padding-left: 0.42em;
}
.studio-intro-word {
  font-family: var(--display); font-weight: 600; font-size: clamp(2.6rem, 7vw, 4.4rem);
  color: #fff; letter-spacing: 0.04em; line-height: 1;
}
.studio-intro-bar {
  width: 220px; height: 3px; border-radius: 999px; overflow: hidden;
  background: rgba(255,255,255,0.14); margin-top: 8px;
}
.studio-intro-bar i {
  display: block; height: 100%; width: 40%; border-radius: 999px;
  background: linear-gradient(90deg, transparent, #fff, transparent);
  animation: introSlide 1.1s var(--ease) infinite;
}
@keyframes introSlide { 0% { transform: translateX(-120%); } 100% { transform: translateX(360%); } }
.studio-intro-sub { font-size: 0.78rem; letter-spacing: 0.18em; text-transform: uppercase; color: rgba(255,255,255,0.5); }

/* ---------- Topbar ---------- */
.studio-topbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 200;
  height: calc(var(--topbar-h) + env(safe-area-inset-top, 0px));
  display: flex; align-items: center; gap: 20px;
  padding: env(safe-area-inset-top, 0px) max(clamp(16px, 3vw, 32px), env(safe-area-inset-right, 0px)) 0 max(clamp(16px, 3vw, 32px), env(safe-area-inset-left, 0px));
  background: rgba(245, 243, 238, 0.82);
  backdrop-filter: blur(20px) saturate(1.4);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
  border-bottom: 1px solid var(--line-soft);
}
.studio-topbar .brand { display: inline-flex; align-items: baseline; gap: 9px; text-decoration: none; color: var(--ink); }
.brand-word { font-weight: 800; letter-spacing: 0.22em; font-size: 1.06rem; }
.brand-studio { font-family: var(--display); font-style: italic; font-weight: 500; font-size: 1.04rem; color: var(--muted); }

.studio-progress { margin-left: auto; display: flex; align-items: center; gap: 12px; min-width: 0; }
.studio-progress-label { font-size: 0.74rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); white-space: nowrap; font-weight: 700; }
.studio-progress-label em { font-style: normal; color: var(--ink); }
.studio-progress-track { width: clamp(80px, 16vw, 220px); height: 4px; border-radius: 999px; background: rgba(21,23,28,0.10); overflow: hidden; }
.studio-progress-track i { display: block; height: 100%; width: 12.5%; border-radius: 999px; background: var(--ink); transition: width 0.5s var(--ease-out); }

.studio-topbar .nav-toggle { display: none; }
.studio-topbar .site-nav { display: none; }
.header-cta.studio-exit {
  margin-left: 18px; display: inline-flex; align-items: center;
  height: 40px; padding: 0 18px; border-radius: 999px;
  background: transparent; border: 1px solid var(--line);
  color: var(--text); font-weight: 700; font-size: 0.8rem; text-decoration: none;
  white-space: nowrap; transition: background 0.2s var(--ease), border-color 0.2s var(--ease), transform 0.2s var(--ease);
}
.header-cta.studio-exit:hover { background: var(--white); border-color: rgba(21,23,28,0.2); transform: translateY(-1px); }

/* ---------- Shell / layout ---------- */
.studio-shell {
  position: fixed; top: calc(var(--topbar-h) + env(safe-area-inset-top, 0px)); left: 0; right: 0; bottom: 0;
  display: grid;
  grid-template-columns: 1fr minmax(384px, 432px);
  gap: 0;
}

/* ---------- 3D-scen ---------- */
.studio-stage-wrap {
  position: relative;
  display: flex; flex-direction: column;
  min-width: 0; min-height: 0;
  padding: clamp(14px, 2vw, 26px);
  padding-right: 6px;
}
.viewer-stage {
  position: relative; flex: 1; min-height: 0;
  border-radius: var(--r-xl);
  overflow: hidden;
  background:
    radial-gradient(130% 110% at 50% 12%, #ffffff 0%, #eef0f2 48%, #dfe3e7 100%);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.9),
    0 30px 70px -40px rgba(20,22,28,0.5);
  border: 1px solid rgba(255,255,255,0.7);
}
#scene-canvas { display: block; width: 100%; height: 100%; cursor: grab; }
#scene-canvas:active { cursor: grabbing; }

.price-disclaimer {
  flex: 0 0 auto; margin: 12px 6px 4px 4px;
  font-size: 0.72rem; line-height: 1.5; color: var(--muted-2); max-width: 60ch;
}
/* Dock-kopian av prisvillkoren visas bara på mobil (se media query) */
.dock-disclaimer { display: none; }

/* Mätningsetiketter */
#measurement-overlay { position: absolute; inset: 0; pointer-events: none; z-index: 6; }
.measurement-label {
  position: absolute; transform: translate(-50%, -50%);
  background: var(--ink); color: #fff;
  font-size: 0.7rem; font-weight: 700; letter-spacing: 0.02em;
  padding: 4px 9px; border-radius: 999px; white-space: nowrap;
  box-shadow: 0 6px 16px rgba(20,22,28,0.3);
}

/* Stage-overlays — gemensamt glas */
.stage-status, .stage-views, .stage-hud, .stage-readout {
  position: absolute; z-index: 8;
}
.stage-status { top: 16px; left: 16px; display: flex; gap: 8px; }
.stage-chip {
  display: inline-flex; align-items: center; gap: 7px;
  height: 30px; padding: 0 13px; border-radius: 999px;
  background: var(--glass-strong); backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--glass-border);
  font-size: 0.74rem; font-weight: 700; color: var(--ink);
  box-shadow: var(--shadow-sm);
}
.stage-chip-live::before {
  content: ''; width: 7px; height: 7px; border-radius: 50%;
  background: var(--good); box-shadow: 0 0 0 4px rgba(26,142,74,0.18);
  animation: pulse 2s var(--ease) infinite;
}
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.4; } }
.stage-chip-area { color: var(--muted); }

.stage-views { top: 16px; right: 16px; display: flex; gap: 6px; padding: 5px; border-radius: 999px;
  background: var(--glass-strong); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--glass-border); box-shadow: var(--shadow-sm); }
.stage-view {
  display: inline-flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  width: 54px; height: 46px; border: 0; background: transparent; border-radius: 999px;
  color: var(--muted); font-size: 0.62rem; font-weight: 700; letter-spacing: 0.04em;
  cursor: pointer; transition: background 0.2s var(--ease), color 0.2s var(--ease);
}
.stage-view svg { opacity: 0.85; }
.stage-view:hover { color: var(--ink); background: rgba(21,23,28,0.05); }
.stage-view.active { color: #fff; background: var(--ink); }

/* AR-knapp — markerad som ny/special */
.stage-view-ar { color: var(--ink); position: relative; }
.stage-view-ar::after {
  content: ''; position: absolute; top: 7px; right: 11px;
  width: 6px; height: 6px; border-radius: 50%; background: var(--good);
  box-shadow: 0 0 0 3px rgba(26,142,74,0.18);
}
.stage-view-ar:hover { background: rgba(26,142,74,0.10); color: var(--good); }

/* AR-vy (fullskärm) — ljus studio-estetik */
.ar-sheet {
  position: fixed; inset: 0; z-index: 1200; display: flex; flex-direction: column;
  background: radial-gradient(130% 100% at 50% 8%, #ffffff 0%, #eef0f3 52%, #e2e6ec 100%);
  overscroll-behavior: contain;
}
.ar-sheet[hidden] { display: none; }
/* Sidan bakom AR-arket får inte scrolla med */
body.ar-open { overflow: hidden; }
.ar-stage { flex: 1; min-height: 0; position: relative; }
.ar-stage model-viewer { width: 100%; height: 100%; background-color: transparent; --poster-color: transparent; }
.ar-sheet-close {
  position: absolute; top: calc(16px + env(safe-area-inset-top, 0px)); right: calc(16px + env(safe-area-inset-right, 0px)); z-index: 3;
  width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line);
  background: rgba(255,255,255,0.8); color: var(--ink); font-size: 1.5rem; line-height: 1; cursor: pointer;
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); box-shadow: var(--shadow-sm);
}
.ar-sheet-close:hover { background: var(--ink); color: #fff; }
.ar-bottom {
  flex: 0 0 auto; display: flex; flex-direction: column; align-items: center; gap: 14px;
  padding: 20px 20px calc(28px + env(safe-area-inset-bottom));
}
.ar-status { color: var(--muted); font-size: 0.86rem; font-weight: 500; text-align: center; max-width: 42ch; }
.ar-status.is-error { color: var(--warn); }
.ar-meta {
  display: inline-flex; align-items: center; height: 30px; padding: 0 14px;
  border-radius: 999px; background: var(--glass-strong); border: 1px solid var(--glass-border);
  font-size: 0.74rem; font-weight: 700; color: var(--ink); box-shadow: var(--shadow-sm);
}
.ar-meta[hidden] { display: none; }
.ar-tip { font-size: 0.74rem; color: var(--muted); max-width: 46ch; text-align: center; line-height: 1.5; }
.ar-tip[hidden] { display: none; }
.ar-launch { min-width: min(260px, calc(100vw - 48px)); }
.ar-launch[hidden] { display: none; }
/* QR-kod (desktop): skanna → exakt konfiguration i mobilen */
.ar-qr { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.ar-qr[hidden] { display: none; }
.ar-qr-code { width: 168px; height: 168px; padding: 10px; border-radius: 16px; background: #fff; border: 1px solid var(--line); box-shadow: var(--shadow-sm); }
.ar-qr-code svg { display: block; width: 100%; height: 100%; }
.ar-qr-copy { font-size: 0.78rem; color: var(--muted); max-width: 34ch; text-align: center; line-height: 1.5; }
.ar-qr-copy strong { color: var(--ink); }

.stage-hud {
  bottom: 16px; right: 16px;
  display: grid; grid-template-columns: repeat(2, 38px); gap: 6px;
  padding: 8px; border-radius: 18px;
  background: var(--glass); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--glass-border); box-shadow: var(--shadow-sm);
}
.hud-btn {
  width: 38px; height: 38px; border: 0; border-radius: 11px;
  background: rgba(255,255,255,0.7); color: var(--ink);
  font-size: 1rem; font-weight: 700; cursor: pointer;
  display: grid; place-items: center;
  transition: background 0.18s var(--ease), transform 0.18s var(--ease), color 0.18s var(--ease);
}
.hud-btn:hover { background: var(--ink); color: #fff; transform: translateY(-1px); }
.hud-btn-reset { grid-column: 1 / -1; width: auto; height: 30px; font-size: 0.66rem; letter-spacing: 0.1em; text-transform: uppercase; border-radius: 999px; }

.stage-readout {
  bottom: 16px; left: 16px; display: flex; flex-direction: column; gap: 2px;
  padding: 14px 18px; border-radius: 18px; min-width: 220px;
  background: var(--glass-strong); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  border: 1px solid var(--glass-border); box-shadow: var(--shadow-md);
}
.readout-line { display: flex; align-items: baseline; justify-content: space-between; gap: 14px; padding: 2px 0; }
.readout-kicker { font-size: 0.62rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.readout-line strong { font-size: 0.82rem; font-weight: 700; color: var(--ink); }
.readout-price { margin-top: 8px; padding-top: 10px; border-top: 1px solid var(--line-soft); display: flex; flex-direction: column; gap: 1px; }
.readout-price strong { font-family: var(--display); font-weight: 600; font-size: 1.5rem; color: var(--ink); letter-spacing: 0.01em; transition: color 0.2s var(--ease); }
.readout-price.is-bump strong { color: var(--good); }

.warning-stack { position: absolute; top: 56px; left: 16px; right: 16px; z-index: 9; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.warning-card {
  pointer-events: auto; padding: 11px 15px; border-radius: 12px;
  background: rgba(194,73,29,0.95); color: #fff; font-size: 0.78rem; font-weight: 600;
  box-shadow: var(--shadow-md); max-width: 440px;
}
.warning-card.is-soft { background: rgba(21,23,28,0.9); }

.stage-hint {
  position: absolute; bottom: 16px; left: 50%; transform: translateX(-50%); z-index: 7;
  padding: 7px 16px; border-radius: 999px; background: var(--glass);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--glass-border);
  font-size: 0.7rem; color: var(--muted); font-weight: 600;
  transition: opacity 0.5s var(--ease); pointer-events: none;
}
.stage-hint.is-faded { opacity: 0; }

/* ---------- Dock ---------- */
.studio-dock {
  position: relative; z-index: 100;
  display: flex; flex-direction: column;
  margin: clamp(14px, 2vw, 26px); margin-left: 8px;
  border-radius: var(--r-xl);
  background: var(--glass-strong);
  backdrop-filter: blur(26px) saturate(1.5);
  -webkit-backdrop-filter: blur(26px) saturate(1.5);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-dock);
  overflow: hidden;
  min-height: 0;
}
.panel-handle { display: none; }

/* Steg-rail */
.dock-rail {
  flex: 0 0 auto; display: flex; gap: 2px; padding: 12px 12px 10px;
  overflow-x: auto; scrollbar-width: none; border-bottom: 1px solid var(--line-soft);
}
.dock-rail::-webkit-scrollbar { display: none; }
.rail-step {
  display: inline-flex; align-items: center; gap: 7px;
  flex: 0 0 auto; height: 34px; padding: 0 12px 0 8px; border: 0; border-radius: 999px;
  background: transparent; color: var(--muted); cursor: pointer;
  font-size: 0.74rem; font-weight: 700; white-space: nowrap;
  transition: background 0.2s var(--ease), color 0.2s var(--ease);
}
.rail-step i {
  font-style: normal; width: 20px; height: 20px; border-radius: 50%;
  display: grid; place-items: center; font-size: 0.68rem; font-weight: 800;
  background: rgba(21,23,28,0.08); color: var(--muted);
  transition: background 0.2s var(--ease), color 0.2s var(--ease);
}
.rail-step:hover { color: var(--ink); background: rgba(21,23,28,0.04); }
.rail-step.active { color: #fff; background: var(--ink); }
.rail-step.active i { background: rgba(255,255,255,0.22); color: #fff; }
.rail-step.is-complete i { background: var(--good); color: #fff; }

/* Scroll-area */
.dock-scroll {
  flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain;
  padding: 6px clamp(16px, 1.6vw, 22px) 12px;
  scrollbar-width: thin; scrollbar-color: rgba(21,23,28,0.18) transparent;
}
.dock-scroll::-webkit-scrollbar { width: 8px; }
.dock-scroll::-webkit-scrollbar-thumb { background: rgba(21,23,28,0.16); border-radius: 999px; border: 2px solid transparent; background-clip: padding-box; }

/* Steg-sektioner */
.config-step {
  padding: 22px 2px 26px; border-bottom: 1px solid var(--line-soft);
  scroll-margin-top: 8px;
}
.config-step:last-of-type { border-bottom: 0; }
.config-step.is-active .step-title { color: var(--ink); }
.step-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.step-eyebrow { font-size: 0.68rem; letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted-2); font-weight: 800; margin-bottom: 4px; }
.step-title { font-family: var(--display); font-weight: 600; font-size: 1.5rem; line-height: 1.05; letter-spacing: 0.005em; color: var(--ink); }
.step-copy { margin: 8px 0 18px; font-size: 0.86rem; line-height: 1.5; color: var(--muted); max-width: 42ch; }

.info-button {
  flex: 0 0 auto; width: 28px; height: 28px; border-radius: 50%;
  border: 1px solid var(--line); background: var(--white); color: var(--muted);
  font-family: var(--display); font-style: italic; font-size: 0.9rem; font-weight: 600;
  cursor: pointer; transition: background 0.2s var(--ease), color 0.2s var(--ease), transform 0.2s var(--ease);
}
.info-button:hover { background: var(--ink); color: #fff; transform: translateY(-1px); }

/* ---------- Modellkort ---------- */
.model-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.model-card {
  position: relative; display: flex; flex-direction: column; gap: 10px;
  padding: 10px; border-radius: var(--r-lg); border: 1.5px solid var(--line);
  background: var(--white); cursor: pointer; text-align: left;
  transition: border-color 0.22s var(--ease), box-shadow 0.22s var(--ease), transform 0.22s var(--ease);
}
.model-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: rgba(21,23,28,0.16); }
.model-card-media {
  display: block; border-radius: 13px; overflow: hidden;
  /* Sval ton för PVC-duk-modellerna */
  background: linear-gradient(180deg, #edf0f3, #e2e7ed);
  aspect-ratio: 1.5 / 1;
  isolation: isolate; /* håller multiply-blandningen inom mediaboxen */
}
.model-card-media img {
  width: 100%; height: 100%; object-fit: contain; padding: 6px 8px; display: block;
  /* Den inbrända vita bakgrunden i PNG:n blandas in i tonen ovan → försvinner,
     medan pergolan blir kvar. Ingen bildredigering behövs. */
  mix-blend-mode: multiply;
}
.model-card-info { display: flex; flex-direction: column; gap: 3px; padding: 0 4px 2px; }
.model-card-info strong { font-size: 0.96rem; font-weight: 700; letter-spacing: -0.01em; color: var(--ink); }
.model-tags { display: flex; flex-direction: column; gap: 1px; font-size: 0.68rem; color: var(--muted); line-height: 1.45; }
.model-tags em { font-style: normal; color: var(--muted-2); font-weight: 600; }
.model-check {
  position: absolute; top: 14px; right: 14px; width: 22px; height: 22px; border-radius: 50%;
  border: 1.5px solid var(--line); background: var(--white);
  transition: background 0.2s var(--ease), border-color 0.2s var(--ease);
}
/* Varm beige ton för aluminium-tak-modellerna (Pergio / Pergio Retractable)
   — visuell skillnad mot PVC-duk-modellerna. */
.model-card.model-card-premium .model-card-media { background: linear-gradient(180deg, #f4ede0, #e9e0ce); }
.model-card.active { border-color: var(--ink); box-shadow: 0 0 0 3px var(--accent-glow), var(--shadow-md); }
.model-card.active .model-check { background: var(--ink); border-color: var(--ink); }
.model-card.active .model-check::after {
  content: ''; position: absolute; inset: 0; margin: auto; width: 9px; height: 5px;
  border-left: 2px solid #fff; border-bottom: 2px solid #fff; transform: translateY(-1px) rotate(-45deg);
}

/* ---------- Monteringskort ---------- */
.mount-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.mount-card {
  display: flex; flex-direction: column; align-items: center; gap: 9px;
  padding: 18px 10px 14px; border-radius: var(--r-md); border: 1.5px solid var(--line);
  background: var(--white); color: var(--muted); cursor: pointer;
  transition: border-color 0.2s var(--ease), color 0.2s var(--ease), box-shadow 0.2s var(--ease), transform 0.2s var(--ease);
}
.mount-card svg { color: var(--muted-2); transition: color 0.2s var(--ease); }
.mount-card strong { font-size: 0.82rem; font-weight: 700; color: var(--text); }
.mount-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-sm); border-color: rgba(21,23,28,0.16); }
.mount-card.active { border-color: var(--ink); box-shadow: 0 0 0 3px var(--accent-glow), var(--shadow-sm); }
.mount-card.active svg { color: var(--ink); }

/* ---------- Mått ---------- */
.dim-field { margin-bottom: 18px; }
.dim-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 10px; }
.dim-head span { font-size: 0.8rem; font-weight: 700; color: var(--text); }
.dim-head strong { font-family: var(--display); font-weight: 600; font-size: 1.15rem; color: var(--ink); }

input[type="range"] {
  -webkit-appearance: none; appearance: none; width: 100%; height: 6px; border-radius: 999px;
  background: linear-gradient(90deg, var(--ink) 0%, var(--ink) var(--fill, 35%), rgba(21,23,28,0.12) var(--fill, 35%));
  cursor: pointer; outline: none;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none; width: 22px; height: 22px; border-radius: 50%;
  background: #fff; border: 1.5px solid var(--ink); box-shadow: 0 4px 12px rgba(20,22,28,0.22);
  transition: transform 0.15s var(--ease);
}
input[type="range"]::-webkit-slider-thumb:hover { transform: scale(1.12); }
input[type="range"]::-moz-range-thumb { width: 22px; height: 22px; border-radius: 50%; background: #fff; border: 1.5px solid var(--ink); box-shadow: 0 4px 12px rgba(20,22,28,0.22); }
.dim-entry { display: flex; align-items: center; gap: 8px; margin-top: 12px; max-width: 180px; position: relative; }
.dim-entry input {
  width: 100%; height: 44px; padding: 0 44px 0 14px; border-radius: var(--r-sm);
  border: 1.5px solid var(--line); background: var(--white); font-family: var(--font);
  font-size: 0.95rem; font-weight: 700; color: var(--ink); -moz-appearance: textfield;
}
.dim-entry input::-webkit-outer-spin-button, .dim-entry input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.dim-entry input:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px var(--accent-glow); }
.dim-unit { position: absolute; right: 14px; font-size: 0.82rem; color: var(--muted-2); font-weight: 600; pointer-events: none; }
.dim-presets { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.dim-preset {
  height: 34px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--white); color: var(--text); font-size: 0.78rem; font-weight: 700; cursor: pointer;
  transition: background 0.18s var(--ease), color 0.18s var(--ease), border-color 0.18s var(--ease);
}
.dim-preset:hover { background: var(--ink); color: #fff; border-color: var(--ink); }

/* ---------- Kulör / swatches ---------- */
.color-block { margin-bottom: 20px; }
.color-block-label { display: block; font-size: 0.8rem; font-weight: 700; color: var(--text); margin-bottom: 12px; }
.color-block-label em { font-style: normal; color: var(--muted-2); font-weight: 500; }
.swatch-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; }
.swatch-pill {
  display: flex; flex-direction: column; align-items: center; gap: 7px;
  padding: 11px 6px 9px; border-radius: var(--r-md); border: 1.5px solid var(--line);
  background: var(--white); cursor: pointer; transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease), transform 0.2s var(--ease);
}
.swatch-pill:hover { transform: translateY(-2px); box-shadow: var(--shadow-sm); }
.swatch {
  width: 38px; height: 38px; border-radius: 50%;
  box-shadow: inset 0 2px 4px rgba(255,255,255,0.3), inset 0 -3px 6px rgba(0,0,0,0.22), 0 2px 6px rgba(20,22,28,0.18);
  border: 1px solid rgba(0,0,0,0.08);
}
.swatch-name { font-size: 0.68rem; font-weight: 700; color: var(--muted); letter-spacing: 0.01em; }
.swatch-pill.active { border-color: var(--ink); box-shadow: 0 0 0 3px var(--accent-glow), var(--shadow-sm); }
.swatch-pill.active .swatch-name { color: var(--ink); }
.swatch.ral7016 { background: radial-gradient(circle at 32% 28%, #434a4e, #2c3236 70%); }
.swatch.ral7043 { background: radial-gradient(circle at 32% 28%, #5e625e, #454945 70%); }
.swatch.ral8017 { background: radial-gradient(circle at 32% 28%, #573f37, #3a2a23 70%); }
.swatch.ral9005 { background: radial-gradient(circle at 32% 28%, #26262a, #0e0e10 70%); }
.swatch.ral9006 { background: radial-gradient(circle at 32% 28%, #babdbb, #9a9d9b 70%); }
.swatch.ral1013 { background: radial-gradient(circle at 32% 28%, #efe6d3, #ddd0b6 70%); }
.swatch.ral9016 { background: radial-gradient(circle at 32% 28%, #ffffff, #ebeae3 72%); }

/* ---------- Glas ---------- */
.glaze-list { display: flex; flex-direction: column; gap: 8px; }
.glaze-card {
  position: relative; display: flex; align-items: center; gap: 14px;
  padding: 12px 14px; border-radius: var(--r-md); border: 1.5px solid var(--line);
  background: var(--white); cursor: pointer; text-align: left;
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease), transform 0.2s var(--ease);
}
.glaze-card:hover { transform: translateX(2px); box-shadow: var(--shadow-sm); border-color: rgba(21,23,28,0.16); }
.glaze-badge {
  flex: 0 0 auto; width: 46px; height: 46px; border-radius: 13px;
  display: grid; place-items: center; font-size: 0.78rem; font-weight: 800; letter-spacing: 0.04em;
  background: linear-gradient(180deg, #f6f6f4, #e9eae7); color: var(--ink); border: 1px solid var(--line-soft);
  transition: background 0.2s var(--ease), color 0.2s var(--ease);
}
.glaze-info { display: flex; flex-direction: column; gap: 1px; flex: 1; min-width: 0; }
.glaze-info strong { font-size: 0.92rem; font-weight: 700; color: var(--ink); }
.glaze-info em { font-style: normal; font-size: 0.72rem; color: var(--muted); font-weight: 600; }
.glaze-check {
  flex: 0 0 auto; width: 20px; height: 20px; border-radius: 50%; position: relative;
  border: 1.5px solid var(--line); background: var(--white); transition: background 0.2s var(--ease), border-color 0.2s var(--ease);
}
.glaze-card.active { border-color: var(--ink); box-shadow: 0 0 0 3px var(--accent-glow), var(--shadow-sm); }
.glaze-card.active .glaze-badge { background: var(--ink); color: #fff; }
.glaze-card.active .glaze-check { background: var(--ink); border-color: var(--ink); }
.glaze-card.active .glaze-check::after { content: ''; position: absolute; inset: 0; margin: auto; width: 8px; height: 4px; border-left: 2px solid #fff; border-bottom: 2px solid #fff; transform: translateY(-1px) rotate(-45deg); }

/* ---------- Toggle / segmented / action ---------- */
.toggle-card {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 16px; border-radius: var(--r-md); border: 1px solid var(--line);
  background: var(--white); margin-bottom: 12px;
}
.toggle-card > div strong { display: block; font-size: 0.9rem; font-weight: 700; color: var(--ink); }
.toggle-card > div p { margin-top: 3px; font-size: 0.76rem; color: var(--muted); line-height: 1.4; max-width: 28ch; }
.segmented { display: inline-flex; flex: 0 0 auto; padding: 3px; border-radius: 999px; background: rgba(21,23,28,0.06); gap: 2px; }
.segment {
  border: 0; background: transparent; cursor: pointer; border-radius: 999px;
  height: 32px; padding: 0 13px; font-size: 0.76rem; font-weight: 700; color: var(--muted);
  transition: background 0.18s var(--ease), color 0.18s var(--ease), box-shadow 0.18s var(--ease);
}
.segment:hover { color: var(--ink); }
.segment.active { background: var(--white); color: var(--ink); box-shadow: var(--shadow-sm); }

.action-card {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  margin-top: 14px; padding: 15px 16px; border-radius: var(--r-md);
  background: linear-gradient(180deg, #1b1e25, #14161b); color: #fff;
}
.action-card strong { display: block; font-size: 0.88rem; font-weight: 700; }
.action-card p { margin-top: 3px; font-size: 0.74rem; color: rgba(255,255,255,0.62); line-height: 1.4; max-width: 26ch; }
.ghost-action {
  flex: 0 0 auto; height: 40px; padding: 0 18px; border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.3); background: rgba(255,255,255,0.08); color: #fff;
  font-size: 0.76rem; font-weight: 700; letter-spacing: 0.04em; cursor: pointer; white-space: nowrap;
  transition: background 0.18s var(--ease), transform 0.18s var(--ease);
}
.ghost-action:hover { background: rgba(255,255,255,0.18); transform: translateY(-1px); }
.roof-meta { margin-bottom: 12px; }
.roof-meta strong { font-size: 0.9rem; color: var(--ink); }
.roof-meta p { font-size: 0.78rem; color: var(--muted); margin-top: 3px; }

/* ---------- Summary ---------- */
.summary-lines { display: flex; flex-direction: column; gap: 1px; margin: 6px 0 16px; border-radius: var(--r-md); overflow: hidden; border: 1px solid var(--line-soft); }
.summary-line { display: flex; align-items: baseline; justify-content: space-between; gap: 14px; padding: 11px 14px; background: var(--white); }
.summary-line:nth-child(even) { background: rgba(21,23,28,0.02); }
.summary-line strong { font-size: 0.78rem; font-weight: 600; color: var(--muted); }
.summary-line span { font-size: 0.82rem; font-weight: 700; color: var(--ink); text-align: right; }
.summary-line-total { background: var(--ink) !important; }
.summary-line-total strong { color: rgba(255,255,255,0.7); }
.summary-line-total span { color: #fff; font-family: var(--display); font-size: 1.05rem; }
.summary-divider { border: 0; height: 1px; background: var(--line-soft); margin: 0; }
.panel-summary-meta { display: none; }

.share-row { display: flex; flex-direction: column; gap: 8px; }
.share-button {
  display: inline-flex; align-items: center; gap: 9px; align-self: flex-start;
  height: 42px; padding: 0 18px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--white); color: var(--ink); font-size: 0.82rem; font-weight: 700; cursor: pointer;
  transition: background 0.18s var(--ease), transform 0.18s var(--ease), border-color 0.18s var(--ease);
}
.share-button:hover { background: var(--paper); transform: translateY(-1px); border-color: rgba(21,23,28,0.2); }
.share-button.is-copied { background: var(--good); border-color: var(--good); color: #fff; }
.share-hint { font-size: 0.72rem; color: var(--muted); line-height: 1.45; }

/* ---------- Dock footer ---------- */
.dock-footer {
  flex: 0 0 auto; display: flex; align-items: center; gap: 14px;
  padding: 14px clamp(16px, 1.6vw, 22px);
  border-top: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255,255,255,0.5), rgba(255,255,255,0.9));
}
.dock-footer-price { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.dock-footer-kicker { font-size: 0.62rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.dock-footer-price strong { font-family: var(--display); font-weight: 600; font-size: 1.3rem; color: var(--ink); white-space: nowrap; }
.primary-cta {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  height: 52px; padding: 0 22px; border: 0; border-radius: 999px;
  background: var(--ink); color: #fff; font-size: 0.9rem; font-weight: 800; letter-spacing: 0.01em;
  cursor: pointer; white-space: nowrap;
  box-shadow: 0 12px 28px -8px rgba(20,22,28,0.6);
  transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease), background 0.2s var(--ease);
}
.primary-cta:hover { transform: translateY(-2px); box-shadow: 0 18px 36px -10px rgba(20,22,28,0.7); background: var(--ink-2); }
.primary-cta:active { transform: translateY(0); }
.dock-cta { flex: 1; }

/* ---------- Mobil sticky ---------- */
.mobile-sticky-bar { display: none; }

/* ---------- Info toast ---------- */
.info-toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%) translateY(10px);
  z-index: 500; max-width: min(440px, calc(100vw - 32px));
  padding: 14px 20px; border-radius: var(--r-md);
  background: var(--ink); color: #fff; font-size: 0.84rem; line-height: 1.45; font-weight: 500;
  box-shadow: var(--shadow-lg); opacity: 0; transition: opacity 0.3s var(--ease), transform 0.3s var(--ease);
}
.info-toast:not([hidden]) { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- Quote modal ---------- */
.quote-modal { position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center; padding: 20px; }
.quote-modal-backdrop { position: absolute; inset: 0; background: rgba(15,17,22,0.55); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); animation: fadeIn 0.3s var(--ease); }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.quote-modal-card {
  position: relative; z-index: 1; width: min(720px, 100%); max-height: 90vh; max-height: 90dvh; overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--white); border-radius: var(--r-xl); padding: 32px;
  box-shadow: var(--shadow-lg); animation: modalUp 0.4s var(--ease-out);
}
@keyframes modalUp { from { opacity: 0; transform: translateY(24px) scale(0.98); } to { opacity: 1; transform: none; } }
.quote-close {
  position: absolute; top: 18px; right: 18px; width: 38px; height: 38px; border-radius: 50%;
  border: 1px solid var(--line); background: var(--white); color: var(--muted);
  font-size: 1.3rem; line-height: 1; cursor: pointer; transition: background 0.2s var(--ease), color 0.2s var(--ease);
}
.quote-close:hover { background: var(--ink); color: #fff; }
.quote-modal-header { margin-bottom: 22px; max-width: 46ch; }
.quote-modal-header h2 { font-family: var(--display); font-weight: 600; font-size: 1.7rem; color: var(--ink); margin: 4px 0 8px; }
.quote-modal-header p { font-size: 0.86rem; color: var(--muted); line-height: 1.5; }
.quote-preview-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 24px; }
.quote-preview-card { padding: 16px; border-radius: var(--r-md); background: var(--paper); border: 1px solid var(--line-soft); }
.quote-preview-card > span { display: block; font-size: 0.68rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); font-weight: 800; margin-bottom: 10px; }
.snapshot-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.snapshot-grid img { width: 100%; border-radius: var(--r-sm); display: block; background: #eef0f2; aspect-ratio: 1; object-fit: cover; }
.locked-config-summary { display: flex; flex-direction: column; gap: 6px; font-size: 0.8rem; }
.locked-config-summary div { display: flex; justify-content: space-between; gap: 12px; }
.locked-config-summary strong { color: var(--muted); font-weight: 600; }

.quote-request-form { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.quote-request-form label { display: flex; flex-direction: column; gap: 6px; font-size: 0.74rem; font-weight: 700; color: var(--text); letter-spacing: 0.02em; }
.quote-request-form input, .quote-request-form textarea {
  height: 46px; padding: 0 14px; border-radius: var(--r-sm); border: 1.5px solid var(--line);
  background: var(--white); font-family: var(--font); font-size: 0.9rem; font-weight: 500; color: var(--ink); transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.quote-request-form textarea { height: auto; padding: 12px 14px; resize: vertical; font-weight: 500; }
.quote-request-form input:focus, .quote-request-form textarea:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px var(--accent-glow); }
.quote-request-form input.is-invalid, .quote-request-form textarea.is-invalid { border-color: var(--warn); box-shadow: 0 0 0 3px rgba(194,73,29,0.15); }
.form-span { grid-column: 1 / -1; }
.checkbox-row { flex-direction: row !important; align-items: flex-start; gap: 10px; font-weight: 500; font-size: 0.8rem; color: var(--muted); line-height: 1.5; }
.checkbox-row input { width: 20px; height: 20px; flex: 0 0 auto; margin-top: 1px; accent-color: var(--ink); }
.gdpr-copy { font-size: 0.74rem; color: var(--muted); line-height: 1.5; }
.gdpr-copy a, .checkbox-row a { color: var(--ink); }
.quote-form-actions { display: flex; justify-content: flex-end; gap: 12px; margin-top: 4px; }
.quote-form-actions .ghost-action { background: var(--paper); border-color: var(--line); color: var(--text); height: 52px; }
.quote-form-actions .ghost-action:hover { background: var(--paper-2); }
.quote-form-status { font-size: 0.84rem; font-weight: 600; }
.quote-form-status.is-error { color: var(--warn); }
.quote-form-status.is-success { color: var(--good); }
body.quote-open { overflow: hidden; }

/* ---------- Responsivt ----------
   Mobilstrategi: 3D-scenen är STICKY under topbaren (alltid synlig medan
   man konfigurerar), steg-railen klistrar direkt under scenen, och docken
   scrollar som ett ark under båda. Sticky prisbar längst ner. */
@media (max-width: 1100px) {
  :root {
    /* Höjd på den pinnade scenen — styr även railens sticky-offset */
    --m-stage-h: clamp(280px, 42vh, 440px);
    --m-stage-top: calc(var(--topbar-h) + env(safe-area-inset-top, 0px));
  }
  /* dvh = synlig viewport på iOS (URL-fältet inräknat) — när det stöds */
  @supports (height: 1dvh) {
    :root { --m-stage-h: clamp(280px, 42dvh, 440px); }
  }
  html {
    /* Programmatiska scroll (steg-klick) ska landa under scen + rail */
    scroll-padding-top: calc(var(--m-stage-top) + var(--m-stage-h) + 70px);
    scroll-padding-bottom: 130px;
  }
  body.studio { overflow: auto; overscroll-behavior-y: none; }
  .studio-progress { display: none; }
  .studio-shell {
    position: static; display: block;
    padding-top: var(--m-stage-top);
    min-height: calc(100vh - var(--topbar-h));
    min-height: calc(100dvh - var(--topbar-h));
  }

  /* — Pinnad 3D-scen — */
  .studio-stage-wrap {
    position: sticky; top: var(--m-stage-top); z-index: 90;
    height: var(--m-stage-h); min-height: 0;
    padding: 10px 10px 8px;
    background:
      radial-gradient(120% 80% at 70% -10%, #fbfaf7 0%, #eceae3 55%, #e3e1d9 100%);
  }
  .viewer-stage { border-radius: 18px; }
  .price-disclaimer { display: none; } /* visas i docken i stället (.dock-disclaimer) */
  .dock-disclaimer { display: block; margin: 16px 0 0; color: var(--muted); font-size: 0.74rem; }
  .stage-readout { display: none; }

  /* Scen-overlays: kompakta, krockfria */
  .stage-status { top: 10px; left: 10px; }
  .stage-chip { height: 28px; padding: 0 11px; font-size: 0.7rem; }
  /* Vy-pillen (3D/Front/AR): liten — får inte täcka simulatorn */
  .stage-views { top: 8px; right: 8px; padding: 3px; gap: 2px; }
  .stage-view { width: 38px; height: 32px; font-size: 0.48rem; gap: 1px; }
  .stage-view svg { width: 12px; height: 12px; }
  .stage-view-ar::after { top: 3px; right: 6px; width: 5px; height: 5px; }
  .warning-stack { top: 46px; left: 10px; right: 10px; }
  .measurement-label { font-size: 0.76rem; padding: 5px 10px; }
  .stage-hint { bottom: 52px; max-width: 58%; text-align: center; }
  /* Kamerakontrollen: liggande rad i nederkant — täcker minimalt av 3D-vyn */
  .stage-hud {
    bottom: 8px; right: 8px;
    display: flex; flex-direction: row; align-items: center; gap: 3px;
    padding: 3px; border-radius: 999px;
  }
  .hud-btn { width: 30px; height: 30px; font-size: 0.82rem; border-radius: 50%; }
  .hud-btn-reset { width: auto; height: 30px; padding: 0 11px; font-size: 0.56rem; }

  /* — Steg-rail: klistrar under scenen — */
  .dock-rail {
    position: sticky; top: calc(var(--m-stage-top) + var(--m-stage-h)); z-index: 80;
    background: var(--paper);
    gap: 6px; padding: 10px 12px;
    -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 32px), transparent);
    mask-image: linear-gradient(90deg, #000 calc(100% - 32px), transparent);
  }
  .rail-step { height: 42px; padding: 0 14px 0 9px; }

  /* — Dock som ark under scenen — */
  .studio-dock {
    margin: 0; z-index: 10; /* under den pinnade scenen (90) */
    border-radius: var(--r-xl) var(--r-xl) 0 0;
    backdrop-filter: none; -webkit-backdrop-filter: none; background: var(--paper);
    border: 0; box-shadow: 0 -18px 40px -28px rgba(20,22,28,0.4);
    overflow: visible; /* sticky-railen måste få sticka */
  }
  .dock-scroll {
    overflow: visible; /* body är scrollern på mobil — inga dubbla scrollbarer */
    padding: 6px 18px calc(118px + env(safe-area-inset-bottom));
  }
  .dock-footer { display: none; }

  /* — Sticky prisbar — */
  .mobile-sticky-bar {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 300;
    align-items: center; justify-content: space-between; gap: 14px;
    padding: 12px max(16px, env(safe-area-inset-right)) calc(12px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
    background: var(--glass-strong); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid var(--glass-border); box-shadow: 0 -10px 30px rgba(20,22,28,0.1);
    transition: transform 0.25s var(--ease);
  }
  /* Göm prisbaren medan mjuktangentbordet är öppet (enhance.js sätter klassen) */
  body.kb-open .mobile-sticky-bar { transform: translateY(120%); }
  .mobile-sticky-kicker { font-size: 0.66rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); font-weight: 700; display: block; }
  .mobile-sticky-price strong { font-family: var(--display); font-weight: 600; font-size: 1.25rem; color: var(--ink); }
  .mobile-sticky-cta { height: 48px; }

  /* Toast ovanför prisbaren — inte ovanpå CTA:n */
  .info-toast { bottom: calc(96px + env(safe-area-inset-bottom)); }

  /* Formulär: 1 kolumn + 16px font (annars autozoomar iOS vid fokus) */
  .quote-request-form { grid-template-columns: 1fr; }
  .quote-preview-grid { grid-template-columns: 1fr; }
  .dim-entry input, .quote-request-form input, .quote-request-form textarea { font-size: 16px; }
}

/* Smala mobiler (porträtt) */
@media (max-width: 560px) {
  :root { --topbar-h: 56px; }
  .swatch-grid { grid-template-columns: repeat(3, 1fr); gap: 7px; }
  .swatch { width: 34px; height: 34px; }
  .swatch-name { font-size: 0.64rem; }
  .mount-grid, .model-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .model-card { padding: 8px; gap: 8px; }
  .model-card-info strong { font-size: 0.86rem; }
  .model-tags { font-size: 0.66rem; }
  .mount-card { padding: 14px 8px 12px; }
  .mount-card svg { width: 76px; height: auto; }
  .stage-chip-area { display: none; } /* ytan står i dockens översikt */
  .header-cta.studio-exit { height: 34px; padding: 0 12px; font-size: 0.7rem; }
  .quote-modal { padding: 10px; align-items: end; }
  .quote-modal-card { padding: 22px 18px calc(22px + env(safe-area-inset-bottom)); max-height: 94dvh; border-radius: 22px 22px 0 0; }
  .toggle-card, .action-card { flex-wrap: wrap; }
  .toggle-card .segmented, .action-card .ghost-action { margin-left: auto; }
  .quote-form-actions { flex-wrap: wrap; }
  .quote-form-actions .primary-cta { flex: 1 1 auto; }
  .step-title { font-size: 1.3rem; }
  .share-hint, .gdpr-copy { font-size: 0.74rem; }
}

/* Liggande mobil: scen till vänster, dock som smal kolumn till höger */
@media (max-width: 1100px) and (orientation: landscape) and (max-height: 520px) {
  html { scroll-padding-top: calc(var(--m-stage-top) + 60px); }
  .studio-shell {
    display: grid; grid-template-columns: 1.3fr minmax(290px, 1fr);
    align-items: start;
  }
  .studio-stage-wrap {
    height: calc(100vh - var(--m-stage-top));
    height: calc(100dvh - var(--m-stage-top));
  }
  .dock-rail { top: var(--m-stage-top); }
  .studio-dock { border-radius: 0; box-shadow: none; }
  .mobile-sticky-bar {
    left: auto; max-width: 46vw; border-top-left-radius: 16px;
    padding: 8px max(14px, env(safe-area-inset-right)) calc(8px + env(safe-area-inset-bottom)) 14px;
  }
  .mobile-sticky-price strong { font-size: 1.05rem; }
  .mobile-sticky-cta { height: 42px; padding: 0 16px; font-size: 0.8rem; }
}

/* Mycket smala skärmar: statuschippen får inte trycka in i vy-pillerna */
@media (max-width: 400px) {
  .stage-status { display: none; }
  .studio-topbar { gap: 10px; }
  .header-cta.studio-exit { height: 32px; padding: 0 10px; font-size: 0.64rem; flex: 0 1 auto; min-width: 0; white-space: nowrap; }
  .studio-topbar .brand { flex: 0 0 auto; }
}

/* Pekskärm: alla mål ≥44px och inga "fastnade" hover-effekter */
@media (pointer: coarse) {
  .info-button { width: 40px; height: 40px; }
  .segment { height: 40px; padding: 0 15px; }
  .segmented { padding: 4px; gap: 4px; }
  .ghost-action { height: 46px; }
  .dim-preset { height: 44px; padding: 0 16px; }
  .share-button { height: 46px; }
  .quote-close { width: 44px; height: 44px; }
  .checkbox-row input { width: 24px; height: 24px; }
  input[type="range"] { height: 32px; background-clip: content-box; padding: 13px 0; }
  input[type="range"]::-webkit-slider-thumb { width: 26px; height: 26px; }
  input[type="range"]::-moz-range-thumb { width: 26px; height: 26px; }
}
@media (hover: none) {
  .model-card:hover, .mount-card:hover, .swatch-pill:hover, .glaze-card:hover,
  .share-button:hover, .primary-cta:hover, .ghost-action:hover, .info-button:hover,
  .hud-btn:hover { transform: none; box-shadow: none; }
  .info-button:hover { background: var(--white); color: var(--muted); }
  .hud-btn:hover { background: rgba(255,255,255,0.7); color: var(--ink); }
  .dim-preset:hover { background: var(--white); color: var(--text); border-color: var(--line); }
  .segment:hover { color: var(--muted); }
  .segment.active { color: var(--ink); }
  .stage-view:hover { color: var(--muted); background: transparent; }
  .stage-view.active { color: #fff; background: var(--ink); }
  .model-card:active, .mount-card:active, .swatch-pill:active, .glaze-card:active { transform: scale(0.98); }
  .dim-preset:active, .hud-btn:active, .segment:active, .rail-step:active { background: rgba(21,23,28,0.08); }
  .primary-cta:active, .share-button:active, .ghost-action:active { transform: scale(0.97); }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; transition-duration: 0.05ms !important; }
}
