/* DocHelp clinic builder v3: app shell */
:root {
  --aubergine-deep: #1A0F2E;
  --aubergine: #2D1B4E;
  --royal: #5B2A8C;
  --orchid: #8B5FBF;
  --lilac: #B794D6;
  --lilac-wash: #F2ECF8;
  --cream: #F8F5F0;
  --cream-dim: #EFEAE2;
  --ink: #0A0A0F;
  --slate: #6B6862;
  --stone: #D4D2CD;
  --card: #FFFFFF;
  --line: rgba(10, 10, 15, 0.08);
  --line-strong: rgba(10, 10, 15, 0.14);
  --shadow-soft: 0 1px 2px rgba(26, 15, 46, 0.06), 0 8px 24px rgba(26, 15, 46, 0.08);
  --shadow-panel: -1px 0 0 rgba(10, 10, 15, 0.06), -18px 0 48px rgba(26, 15, 46, 0.07);
  --radius: 14px;
  --topbar: 64px;
  --panel-w: 360px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --font-ui: 'Manrope', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-display: 'Fraunces', Georgia, serif;
}

/* the options panel is wider on desktop screens (Jamal, 7 Oct 2026: "not wide enough so things cut off") */
@media (min-width: 1280px) { :root { --panel-w: 420px; } }

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--cream);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 14px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  overscroll-behavior: none;
}
button { font: inherit; color: inherit; }
[hidden] { display: none !important; }

.app { position: fixed; inset: 0; display: block; }

/* Top bar */
.topbar {
  position: absolute; left: 0; right: 0; top: 0; height: var(--topbar); z-index: 20;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 16px;
  padding: 0 20px;
  background: rgba(248, 245, 240, 0.92);
  backdrop-filter: saturate(1.4) blur(14px);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-mark { width: 32px; height: 32px; flex: none; }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-name { font-family: var(--font-display); font-weight: 600; font-size: 17px; letter-spacing: -0.01em; color: var(--aubergine); }
.brand-sub { font-size: 12px; color: var(--slate); font-weight: 500; }
.topbar-mid { display: flex; align-items: center; gap: 10px; }
.topbar-right { display: flex; align-items: center; justify-content: flex-end; gap: 14px; min-width: 0; }

/* Segmented control */
.seg {
  position: relative; display: inline-grid; grid-template-columns: 1fr 1fr;
  background: #ECE8E2; border-radius: 999px; padding: 4px;
  box-shadow: inset 0 0 0 1px var(--line);
}
.seg button {
  position: relative; z-index: 1; border: 0; background: none; cursor: pointer;
  min-width: 112px; height: 36px; padding: 0 18px; border-radius: 999px;
  font-weight: 600; font-size: 14px; color: var(--slate);
  transition: color 240ms var(--ease);
}
.seg button[aria-checked="true"] { color: var(--aubergine); }
.seg button:focus-visible { outline: 2px solid var(--orchid); outline-offset: 2px; }
.seg-ind {
  position: absolute; top: 4px; bottom: 4px; left: 4px; width: calc(50% - 4px);
  background: #fff; border-radius: 999px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08), 0 2px 8px rgba(26, 15, 46, 0.08);
  transition: transform 220ms var(--ease);
}
.seg[data-active="highend"] .seg-ind { transform: translateX(100%); }

.chip {
  display: inline-flex; align-items: center; gap: 8px; height: 44px; padding: 0 16px;
  border-radius: 999px; border: 1px solid var(--line-strong); background: var(--card);
  font-weight: 600; cursor: pointer; transition: background 200ms var(--ease), border-color 200ms var(--ease), color 200ms;
}
.chip svg { width: 18px; height: 18px; }
.chip:hover { border-color: var(--lilac); }
.chip[aria-pressed="true"] { background: var(--lilac-wash); border-color: var(--orchid); color: var(--aubergine); }
.chip:focus-visible, .btn-primary:focus-visible, .btn-ghost:focus-visible, .tool:focus-visible { outline: 2px solid var(--orchid); outline-offset: 2px; }

.price { display: grid; grid-template-columns: auto auto; grid-template-rows: auto auto; column-gap: 10px; align-items: baseline; text-align: right; }
.price-label { grid-column: 1; grid-row: 1; font-size: 12px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--slate); }
.price-value { grid-column: 1; grid-row: 2; font-weight: 700; font-size: 15px; color: var(--ink); font-variant-numeric: tabular-nums; white-space: nowrap; }
.price-note { grid-column: 2; grid-row: 1 / span 2; align-self: center; font-size: 12px; font-weight: 600; color: var(--royal); background: var(--lilac-wash); border-radius: 999px; padding: 4px 9px; white-space: nowrap; }
.btn-primary {
  height: 44px; padding: 0 20px; border-radius: 999px; border: 0; cursor: pointer;
  background: var(--aubergine); color: #fff; font-weight: 700; white-space: nowrap;
  box-shadow: 0 1px 2px rgba(26, 15, 46, 0.3), 0 6px 18px rgba(45, 27, 78, 0.22);
  transition: background 200ms var(--ease), transform 200ms var(--ease);
}
.btn-primary:hover { background: var(--royal); }
.btn-primary:active { transform: scale(0.98); }
.btn-ghost { height: 44px; padding: 0 20px; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--card); font-weight: 600; cursor: pointer; }

/* Stage */
.stage { position: absolute; inset: 0; overflow: hidden; background: var(--cream); }
#view { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; outline: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.view-tools { position: absolute; left: 20px; top: calc(var(--topbar) + 16px); display: flex; gap: 8px; z-index: 5; }
.tool {
  display: inline-flex; align-items: center; gap: 8px; height: 44px; padding: 0 16px 0 13px; border-radius: 999px;
  border: 1px solid var(--line); background: rgba(255, 255, 255, 0.86); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  font-weight: 600; cursor: pointer; box-shadow: var(--shadow-soft); transition: background 200ms;
}
.tool:hover { background: #fff; }
.tool svg { width: 18px; height: 18px; }
.mark {
  position: absolute; left: 20px; bottom: 18px; z-index: 4; display: flex; align-items: center; gap: 7px;
  color: var(--aubergine); opacity: 0.3; pointer-events: none; -webkit-user-select: none; user-select: none;
  font-family: var(--font-display); font-weight: 600; font-size: 15px;
}
.mark svg { width: 22px; height: 22px; }

.loader { position: absolute; left: calc((100% - var(--panel-w)) / 2); top: calc(50% + var(--topbar) / 2); width: 180px; transform: translate(-50%, -50%); z-index: 6; transition: opacity 400ms var(--ease); }
.loader.done { opacity: 0; pointer-events: none; }
.loader-bar { display: block; height: 3px; border-radius: 3px; background: rgba(45, 27, 78, 0.1); overflow: hidden; }
.loader-bar i { display: block; height: 100%; width: 0; background: var(--aubergine); border-radius: 3px; transition: width 300ms var(--ease); }

/* Compare */
.compare { position: absolute; inset: var(--topbar) 0 0 0; z-index: 3; pointer-events: none; }
.cmp-line { position: absolute; top: 0; bottom: 0; left: 50%; width: 2px; margin-left: -1px; background: rgba(255, 255, 255, 0.95); box-shadow: 0 0 0 1px rgba(26, 15, 46, 0.12), 0 0 18px rgba(26, 15, 46, 0.18); }
.cmp-handle {
  position: absolute; top: 50%; left: 50%; width: 44px; height: 44px; margin: -22px 0 0 -22px; border-radius: 50%;
  border: 0; background: #fff; color: var(--aubergine); cursor: ew-resize; pointer-events: auto; touch-action: none;
  box-shadow: 0 2px 6px rgba(26, 15, 46, 0.18), 0 10px 26px rgba(26, 15, 46, 0.16); display: grid; place-items: center;
}
.cmp-handle svg { width: 22px; height: 22px; }
.cmp-label {
  position: absolute; top: 18px; padding: 6px 12px; border-radius: 999px; font-weight: 700; font-size: 13px; white-space: nowrap;
  background: rgba(255, 255, 255, 0.9); color: var(--aubergine); box-shadow: var(--shadow-soft);
}
.cmp-left { right: 14px; top: 18px; }
.cmp-right { left: 14px; top: 18px; }

/* Photo mode */
.photo { position: absolute; left: 50%; bottom: 22px; transform: translateX(-50%); margin-left: calc(var(--panel-w) / -2); z-index: 5; display: flex; align-items: center; gap: 10px; padding: 7px 14px; border-radius: 999px; background: rgba(255, 255, 255, 0.86); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); box-shadow: var(--shadow-soft); pointer-events: none; }
.photo-label { font-size: 12px; font-weight: 700; color: var(--aubergine); }
.photo-bar { display: block; width: 90px; height: 2px; border-radius: 2px; background: rgba(45, 27, 78, 0.12); overflow: hidden; }
.photo-bar i { display: block; height: 100%; width: 0; background: var(--royal); }

/* Right panel */
.panel {
  position: absolute; top: var(--topbar); right: 0; bottom: 0; width: var(--panel-w); z-index: 10;
  display: flex; flex-direction: column; background: #fff; box-shadow: var(--shadow-panel);
}
.sheet-grip { display: none; }
.panel-head { padding: 22px 24px 12px; border-bottom: 1px solid var(--line); }
.panel-title { margin: 0; font-family: var(--font-display); font-weight: 600; font-size: 22px; letter-spacing: -0.01em; color: var(--aubergine-deep); }
.panel-sub { margin: 2px 0 0; color: var(--slate); font-weight: 600; font-size: 13px; }
.panel-body { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 8px 24px 32px; scrollbar-width: thin; scrollbar-color: var(--stone) transparent; }
.sec { padding: 18px 0 6px; border-bottom: 1px solid var(--line); }
.sec:last-child { border-bottom: 0; }
.sec-title { margin: 0 0 12px; font-size: 13px; font-weight: 700; letter-spacing: 0.02em; color: var(--ink); }
.cards { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }
.cards.three { grid-template-columns: 1fr 1fr 1fr; }
.cards.three .card-sub { display: none; }
.cards.three .card-vis { height: 72px; }
.cards.door { grid-template-columns: 1fr 1fr 1fr; }
.cards.door .card-vis { height: 64px; }
.cards.door .card-text { text-align: center; padding: 8px 6px 9px; }
.card {
  position: relative; display: flex; flex-direction: column; align-items: stretch; text-align: left; padding: 0; overflow: hidden;
  border-radius: 12px; border: 1px solid var(--line-strong); background: var(--card); cursor: pointer; min-height: 44px;
  transition: border-color 200ms var(--ease), box-shadow 200ms var(--ease), transform 200ms var(--ease);
}
.card:hover { border-color: var(--lilac); box-shadow: 0 4px 14px rgba(45, 27, 78, 0.08); }
.card:active { transform: scale(0.985); }
.card:focus-visible { outline: 2px solid var(--orchid); outline-offset: 2px; }
.card[aria-checked="true"] { border-color: var(--aubergine); box-shadow: 0 0 0 1px var(--aubergine), 0 6px 18px rgba(45, 27, 78, 0.12); }
.card-vis { display: block; height: 92px; background: var(--cream-dim); background-size: cover; background-position: center; position: relative; }
.card-vis canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.card-text { display: block; padding: 9px 11px 10px; }
.card-label { display: block; font-weight: 700; font-size: 13px; line-height: 1.25; }
.card-sub { display: block; margin-top: 2px; font-size: 12px; color: var(--slate); line-height: 1.3; }
.card-tick { position: absolute; top: 8px; right: 8px; width: 22px; height: 22px; border-radius: 50%; background: var(--aubergine); color: #fff; display: grid; place-items: center; opacity: 0; transform: scale(0.6); transition: opacity 200ms var(--ease), transform 200ms var(--ease); }
.card-tick svg { width: 13px; height: 13px; }
.card[aria-checked="true"] .card-tick { opacity: 1; transform: scale(1); }
.cards.compact .card-vis { height: 64px; }
.card-label { font-size: 14px; line-height: 1.3; }

/* Popup */
.pop { position: absolute; inset: 0; z-index: 40; display: grid; place-items: center; background: rgba(26, 15, 46, 0.28); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); }
.pop-card { width: min(380px, calc(100% - 32px)); background: #fff; border-radius: 18px; padding: 26px 26px 22px; box-shadow: 0 24px 60px rgba(26, 15, 46, 0.25); }
.pop-card h2 { margin: 0 0 8px; font-family: var(--font-display); font-weight: 600; font-size: 22px; color: var(--aubergine-deep); }
.pop-card p { margin: 0 0 10px; color: var(--slate); font-size: 15px; }
.pop-card .pop-phone { color: var(--ink); font-weight: 700; margin-bottom: 18px; }

/* Phone and narrow screens */
@media (max-width: 820px) {
  :root { --topbar: 56px; --panel-w: 0px; }
  .topbar { grid-template-columns: auto 1fr auto; padding: 0 12px; gap: 8px; }
  .brand-text { display: none; }
  .brand-mark { width: 30px; height: 30px; }
  .topbar-mid { justify-content: center; gap: 6px; }
  .seg button { min-width: 0; height: 44px; padding: 0 12px; font-size: 13px; }
  .seg { padding: 2px; }
  .seg-ind { top: 2px; bottom: 2px; left: 2px; width: calc(50% - 2px); }
  .chip { width: 44px; padding: 0; justify-content: center; }
  .chip span { display: none; }
  .topbar-right .price { display: none; }
  .btn-primary { height: 40px; padding: 0 12px; font-size: 13px; }
  .btn-primary { display: none; }
  .stage { bottom: 42vh; }
  .view-tools { left: 12px; top: calc(var(--topbar) + 10px); }
  .tool { height: 44px; width: 44px; padding: 0; justify-content: center; }
  .tool span { display: none; }
  .panel-sub { display: none; }
  .mark { left: 12px; bottom: 10px; font-size: 13px; }
  .mark svg { width: 18px; height: 18px; }
  .panel { top: auto; left: 0; right: 0; width: auto; height: 42vh; border-radius: 18px 18px 0 0; box-shadow: 0 -10px 40px rgba(26, 15, 46, 0.12); }
  .sheet-grip { display: block; width: 40px; height: 4px; border-radius: 4px; background: var(--stone); margin: 8px auto 0; }
  .panel-head { padding: 8px 16px 10px; display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
  .panel-title { font-size: 18px; }
  .panel-body { padding: 0 16px 24px; }
  .cards { grid-template-columns: 1fr 1fr; }
  .cards.three { grid-template-columns: 1fr 1fr 1fr; }
  .cards.door { grid-template-columns: 1fr 1fr 1fr; }
  .card-vis { height: 76px; }
  .cmp-left, .cmp-right { top: 12px; }
  .photo { margin-left: 0; }
  .m-price { display: flex; }
}
.m-price { display: none; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 0 4px; }
.m-price .mp-text { display: flex; flex-direction: column; }
.m-price .mp-label { font-size: 11px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--slate); }
.m-price .mp-value { font-weight: 700; font-size: 15px; }
.m-price .mp-note { font-size: 11px; font-weight: 600; color: var(--royal); background: var(--lilac-wash); border-radius: 999px; padding: 4px 9px; }
.m-audit { display: none; }
@media (max-width: 820px) {
  .m-audit { display: block; width: 100%; margin: 14px 0 4px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0ms !important; animation-duration: 0ms !important; }
}
@media print {
  .app { display: none !important; }
}
.card-vis svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
/* an option picture still drawing: a soft light sweep over the card's cream, shaped like the picture (FIXC 5 Oct 2026) */
.card-vis:has(canvas.thumb-wait) { overflow: hidden; }
.card-vis:has(canvas.thumb-wait)::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(100deg, rgba(255, 255, 255, 0) 20%, rgba(255, 255, 255, 0.6) 50%, rgba(255, 255, 255, 0) 80%);
  transform: translateX(-100%); animation: thumb-sweep 1.2s linear infinite;
}
@keyframes thumb-sweep { to { transform: translateX(100%); } }
@media (prefers-reduced-motion: reduce) { .card-vis:has(canvas.thumb-wait)::after { animation: none; transform: none; opacity: 0.5; } }
.card-vis.vis-plan { background: var(--cream); }
.card-vis.vis-plan svg { inset: 8px 12px; width: calc(100% - 24px); height: calc(100% - 16px); }
#view { cursor: grab; }
#view.dragging { cursor: grabbing; }
@media (max-width: 820px) {
  .m-price { display: flex; border-bottom: 1px solid var(--line); padding: 4px 0 12px; }
}

/* fix round (07:20) */
.chip:active, .tool:active, .seg button:active { transform: scale(0.97); }
.chip:hover, .tool:hover, .card:hover, .btn-primary:hover { transition-duration: 200ms; }
@media (hover: none) {
  .chip:hover { border-color: var(--line-strong); }
  .tool:hover { background: rgba(255, 255, 255, 0.86); }
  .card:hover { border-color: var(--line-strong); box-shadow: none; }
  .btn-primary:hover { background: var(--aubergine); }
}
.tool[aria-pressed="true"] { background: var(--lilac-wash); border-color: var(--orchid); color: var(--aubergine); }
.tool[aria-busy="true"] { color: var(--slate); }
.cmp-label b { font-weight: 600; color: var(--slate); margin-left: 4px; }
.app.comparing .price { visibility: hidden; }
.panel-foot { display: none; }
button.sheet-grip { border: 0; padding: 0; cursor: pointer; }
@media (max-width: 820px) {
  .m-price { display: none !important; }
  button.sheet-grip { display: block; width: 64px; height: 22px; margin: 0 auto; background: none; position: relative; }
  button.sheet-grip::before { content: ''; position: absolute; left: 12px; right: 12px; top: 9px; height: 4px; border-radius: 4px; background: var(--stone); }
  .panel { transition: height 300ms cubic-bezier(0.32, 0.72, 0, 1); }
  .panel.dragging { transition: none; }
  .panel-head, button.sheet-grip { touch-action: none; }
  .panel.expanded { height: 85vh; }
  .panel-foot { display: grid; grid-template-columns: 1fr auto; grid-template-rows: auto auto; gap: 4px 12px; align-items: center; padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: #fff; }
  .pf-price { display: flex; flex-direction: column; }
  .pf-label { font-size: 12px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--slate); }
  .pf-value { font-weight: 700; font-size: 15px; }
  .pf-note { grid-column: 1; grid-row: 2; justify-self: start; font-size: 12px; font-weight: 600; color: var(--royal); background: var(--lilac-wash); border-radius: 999px; padding: 3px 9px; }
  .pf-audit { grid-column: 2; grid-row: 1 / span 2; height: 44px; display: block !important; padding: 0 16px; }
  .cmp-label b { display: block; margin-left: 0; }
}

/* still of the clinic overview under the loader, fades to the live view (picture set in clinic.css) */
.poster { position: absolute; left: 0; top: var(--topbar); right: var(--panel-w); bottom: 0; z-index: 2; pointer-events: none;
  background: var(--cream); opacity: 1; transition: opacity 200ms cubic-bezier(0.22, 1, 0.36, 1); }
.poster.done { opacity: 0; }
