/* === SECTION 1: SEMANTIC COLOUR TOKENS & BORDERLESS BASE (Lines 1-38) === */
:root {
  --canvas: #F6F4EE;
  --surface: #EAE6DC;
  --surface-pure: #FFFFFF;
  --ink: #172026;
  --ink-muted: #5A6570;
  --teal: #0D7A68;
  --cobalt: #1E5BB8;
  --coral: #D93829;
  --amber: #D47500;
  --sage: #3D6352;
  --slate: #1E2933;
  --stone: #D8D2C5;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; padding: 0; background: var(--canvas); color: var(--ink);
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  -webkit-font-smoothing: antialiased; overscroll-behavior-y: none;
}
.hidden { display: none !important; }
.shell { min-height: 100dvh; display: flex; flex-direction: column; max-width: 680px; margin: 0 auto; background: var(--canvas); }
.coral-banner { background: var(--coral); color: #FFF; padding: 10px 16px; font-size: 12px; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; }
.portal-bar { color: #FFF; padding: calc(14px + env(safe-area-inset-top, 0px)) 18px 14px; }
.bar-inner { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand-title { font-size: 19px; font-weight: 800; letter-spacing: -0.02em; cursor: pointer; }
.header-tag { font-size: 11px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; padding: 6px 10px; background: rgba(255,255,255,0.16); }
.toast-banner { padding: 13px 18px; color: #FFF; font-size: 14px; font-weight: 700; }
.stage { flex: 1; padding: 16px 16px 96px; display: flex; flex-direction: column; gap: 12px; }

/* === SECTION 2: SOLID COLOUR BLOCKS, FLAT CARDS & INPUTS (Lines 39-78) === */
.bg-teal { background: var(--teal); color: #FFF; }
.bg-cobalt { background: var(--cobalt); color: #FFF; }
.bg-coral { background: var(--coral); color: #FFF; }
.bg-amber { background: var(--amber); color: #FFF; }
.bg-sage { background: var(--sage); color: #FFF; }
.bg-slate { background: var(--slate); color: #FFF; }
.bg-stone { background: var(--stone); color: var(--ink); }

.flat-card { background: var(--surface-pure); padding: 18px; display: flex; flex-direction: column; gap: 10px; }
.flat-card.tinted { background: var(--surface); }
.card-kicker { font-size: 11px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-muted); }
.card-heading { margin: 0; font-size: 21px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.2; }
.card-copy { margin: 0; font-size: 14px; line-height: 1.5; color: var(--ink-muted); }

.btn-block {
  appearance: none; border: none; border-radius: 0; width: 100%; padding: 16px 18px;
  font-family: inherit; font-size: 14px; font-weight: 800; letter-spacing: 0.05em;
  text-transform: uppercase; cursor: pointer; text-align: left; display: flex;
  align-items: center; justify-content: space-between; transition: filter 0.15s ease;
}
.btn-block:active { filter: brightness(0.9); }
.btn-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; }
.chip-row { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-btn { border: none; padding: 10px 12px; font-family: inherit; font-size: 12px; font-weight: 700; cursor: pointer; background: var(--surface); color: var(--ink); text-align: left; }
.chip-btn.active { background: var(--teal); color: #FFF; }

.field-label { font-size: 11px; font-weight: 800; letter-spacing: 0.07em; text-transform: uppercase; color: var(--ink-muted); margin-top: 4px; }
.solid-input, .solid-textarea, .solid-select {
  width: 100%; border: none; border-bottom: 3px solid transparent; border-radius: 0;
  background: var(--surface); color: var(--ink); padding: 14px; font-family: inherit;
  font-size: 15px; font-weight: 600; outline: none;
}
.solid-input:focus, .solid-textarea:focus, .solid-select:focus { border-bottom-color: var(--teal); background: #EFECE4; }
.solid-textarea { min-height: 104px; resize: vertical; line-height: 1.45; }

/* === SECTION 3: COLOUR-STRIP SWIPE RIBBONS, FIXED SLIDE TRACK & NAV (Lines 79-118) === */
.swipe-wrap { position: relative; overflow: hidden; background: var(--slate); touch-action: pan-y; user-select: none; }
.swipe-under {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: space-between;
  padding: 0 20px; font-size: 12px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; color: #FFF;
}
.swipe-under.right-mode { background: var(--teal); justify-content: flex-start; }
.swipe-under.left-mode { background: var(--amber); justify-content: flex-end; }
.swipe-front {
  position: relative; background: var(--surface-pure); padding: 16px 18px;
  transition: transform 0.22s cubic-bezier(0.2, 0.8, 0.2, 1); cursor: grab;
}
.swipe-front.dragging { transition: none; }
.patient-strip-coral { background: var(--coral); color: #FFF; padding: 6px 12px; font-size: 11px; font-weight: 800; letter-spacing: 0.05em; margin: -16px -18px 12px; }

.slide-track { position: relative; height: 60px; background: var(--slate); overflow: hidden; user-select: none; touch-action: none; }
.slide-fill { position: absolute; left: 0; top: 0; bottom: 0; width: 64px; background: var(--teal); pointer-events: none; z-index: 1; }
.slide-label {
  position: absolute; inset: 0; padding: 0 14px 0 76px;
  display: flex; align-items: center; justify-content: center; text-align: center;
  color: #FFF; font-size: 12px; font-weight: 800; letter-spacing: 0.06em;
  text-transform: uppercase; pointer-events: none; z-index: 2; line-height: 1.15;
}
.slide-thumb {
  position: absolute; top: 0; bottom: 0; left: 0; width: 64px; background: #129B84;
  color: #FFF; display: flex; align-items: center; justify-content: center; font-size: 20px; font-weight: 800; cursor: ew-resize; z-index: 3;
}

.bottom-strip {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%); width: 100%; max-width: 680px;
  display: grid; grid-template-columns: repeat(4, 1fr); background: var(--slate);
  padding-bottom: env(safe-area-inset-bottom, 0px); z-index: 20;
}
.tab-block {
  border: none; background: var(--slate); color: rgba(255,255,255,0.68); padding: 15px 6px;
  font-family: inherit; font-size: 11px; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; cursor: pointer;
}
.tab-block.active { background: var(--teal); color: #FFF; }

/* === SECTION 4: GHOST CAMERA, SVG VECTOR LAYER, SLIDER & SAFE-VIEW (Lines 119-185) === */
.cam-stage { position: relative; width: 100%; aspect-ratio: 4 / 3; background: #0D1318; overflow: hidden; }
.cam-video, .cam-ghost { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.cam-ghost { pointer-events: none; opacity: 0.42; filter: contrast(1.12); }
.cam-crosshair {
  position: absolute; inset: 14%; border: 2px dashed rgba(255,255,255,0.28);
  pointer-events: none;
}

.vector-stage { position: relative; width: 100%; background: #11181F; line-height: 0; user-select: none; touch-action: none; }
.vector-stage img { width: 100%; height: auto; display: block; pointer-events: none; }
.vector-svg { position: absolute; inset: 0; width: 100%; height: 100%; cursor: crosshair; }

.curtain-box { position: relative; width: 100%; aspect-ratio: 4 / 3; background: #11181F; overflow: hidden; user-select: none; touch-action: none; }
.curtain-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; pointer-events: none; }
.curtain-line { position: absolute; top: 0; bottom: 0; width: 4px; background: #FFF; left: 50%; transform: translateX(-2px); pointer-events: none; z-index: 4; }
.curtain-knob {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: 48px; height: 48px; background: var(--cobalt); color: #FFF;
  display: flex; align-items: center; justify-content: center; font-size: 15px; font-weight: 800; pointer-events: none; z-index: 5;
}
.curtain-tag {
  position: absolute; top: 10px; padding: 6px 10px; font-size: 11px; font-weight: 800;
  letter-spacing: 0.06em; text-transform: uppercase; color: #FFF; z-index: 3; pointer-events: none;
}
.curtain-tag.before { left: 10px; background: var(--slate); }
.curtain-tag.after { right: 10px; background: var(--teal); }

.thumb-strip { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 6px; }
.thumb-tile { position: relative; background: #11181F; aspect-ratio: 4 / 3; overflow: hidden; cursor: pointer; }
.thumb-tile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb-caption { position: absolute; left: 0; right: 0; bottom: 0; background: rgba(23,32,38,0.86); color: #FFF; padding: 5px 7px; font-size: 10px; font-weight: 800; text-transform: uppercase; }

.safeview-overlay {
  position: fixed; inset: 0; background: var(--canvas); z-index: 100;
  display: flex; flex-direction: column; max-width: 680px; margin: 0 auto; overflow-y: auto;
}
