:root {
  --ink: #14212a;
  --muted: #60707b;
  --sage: #52796f;
  --sage-dark: #315b53;
  --warm: #fbf7f0;
  --panel: rgba(255, 252, 246, 0.46);
  --solid: rgba(255, 250, 242, 0.46);
  --card: rgba(255, 255, 255, 0.34);
  --card-strong: rgba(255, 255, 255, 0.48);
  --glass-border: rgba(255, 255, 255, 0.42);
  --line: rgba(20, 33, 42, 0.14);
  --amber: #b86b25;
  --shadow: 0 24px 70px rgba(10, 20, 20, 0.18);
  font-family: Inter, system-ui, sans-serif;
  color: var(--ink);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: #0f1719;
  min-width: 320px;
}
body.canvas-ready #scrollCanvas { opacity: 1; }

#scrollCanvas {
  position: fixed;
  inset: 0;
  z-index: -3;
  width: 100%;
  height: 100%;
  opacity: 0;
  transition: opacity 420ms ease;
}

.backdrop-overlay {
  position: fixed;
  inset: 0;
  z-index: -2;
  background: linear-gradient(to bottom, rgba(20,20,20,0.42), rgba(20,20,20,0.68));
  pointer-events: none;
}

a { color: inherit; }
button, input, select, textarea { font: inherit; }
button, a.button { cursor: pointer; }
:focus-visible { outline: 3px solid #f2b36d; outline-offset: 3px; }

.site-shell {
  min-height: 100vh;
  isolation: isolate;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 8;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 14px clamp(18px, 4vw, 64px);
  color: #fffdf7;
  background: rgba(12, 20, 22, 0.62);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid rgba(255,255,255,0.16);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}
.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: #f2eadb;
  color: var(--sage-dark);
  font-family: "Playfair Display", serif;
  font-weight: 700;
}
.brand small { display: block; opacity: 0.78; margin-top: 2px; }
nav { display: flex; gap: 18px; flex-wrap: wrap; justify-content: flex-end; }
nav a { color: #fffdf7; text-decoration: none; font-size: 0.92rem; opacity: 0.88; }

.section-pad, .content-section, .site-footer {
  width: min(1160px, calc(100% - 36px));
  margin-inline: auto;
}

.hero {
  min-height: 86vh;
  display: grid;
  align-content: center;
  gap: 28px;
  padding-block: 84px 44px;
  color: #fffdf7;
}
.hero-copy { max-width: 760px; }
.eyebrow {
  margin: 0 0 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 800;
  font-size: 0.78rem;
  color: #d4e5dd;
}
h1, h2 {
  font-family: "Playfair Display", Georgia, serif;
  letter-spacing: 0;
  margin: 0;
}
h1 { font-size: clamp(3rem, 7vw, 6.7rem); line-height: 0.96; max-width: 920px; }
h2 { font-size: clamp(2rem, 4vw, 3.5rem); line-height: 1.05; }
h3 { margin: 0; font-size: 1.1rem; }
p { line-height: 1.65; }
.hero-text { max-width: 660px; font-size: 1.14rem; color: rgba(255,253,247,0.88); }

.hero-actions, .form-actions, .helper-actions { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.button, .helper-actions button, .helper-actions a {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 12px 18px;
  text-decoration: none;
  font-weight: 800;
  background: rgba(255, 250, 242, 0.7);
  backdrop-filter: blur(14px);
  color: var(--ink);
}
.button.primary { background: var(--sage); color: white; border-color: transparent; }
.button.ghost { background: rgba(255,255,255,0.14); color: inherit; border-color: rgba(255,255,255,0.35); }
.button.urgent { background: var(--amber); color: white; border-color: transparent; }
.button.disabled, button:disabled { opacity: 0.5; cursor: not-allowed; }

.trust-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.trust-strip span, .badges span, .trust-badge {
  border-radius: 999px;
  padding: 9px 13px;
  background: rgba(255,255,255,0.16);
  color: #fffdf7;
  border: 1px solid rgba(255,255,255,0.18);
}

.content-section {
  margin-block: 28px;
  padding: clamp(24px, 4vw, 46px);
  border-radius: 8px;
  border: 1px solid var(--glass-border);
  box-shadow: 0 24px 70px rgba(10, 20, 20, 0.16);
}
.glass-section, .solid-section { background: var(--panel); backdrop-filter: blur(12px) saturate(1.12); }
.section-heading { max-width: 740px; margin-bottom: 26px; }
.section-heading p:not(.eyebrow) { color: var(--muted); margin-bottom: 0; }
.glass-section .eyebrow, .solid-section .eyebrow { color: var(--sage-dark); }

.profile-grid, .booking-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(280px, 0.9fr);
  gap: 22px;
}
.info-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}
.mini-card {
  min-height: 132px;
  display: grid;
  align-content: start;
  gap: 9px;
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  padding: 17px;
  background: rgba(255, 255, 255, 0.3);
  backdrop-filter: blur(10px) saturate(1.12);
}
.mini-card strong { font-size: 1rem; }
.mini-card span { color: var(--muted); line-height: 1.55; }
.video-panel video {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 8px;
  background: #111;
}
.profile-card {
  padding: 22px;
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  background: var(--card);
  backdrop-filter: blur(10px) saturate(1.12);
}
blockquote { margin: 0 0 18px; font-family: "Playfair Display", serif; font-size: 1.45rem; line-height: 1.3; }
.badges, .checklist { display: flex; gap: 10px; flex-wrap: wrap; }
.badges span { color: var(--ink); background: rgba(234, 241, 232, 0.64); border-color: rgba(82, 121, 111, 0.16); }

.booking-layout { grid-template-columns: 1.05fr 1fr 300px; align-items: start; }
.calendar-panel, .slot-panel, .summary-panel, .intake-panel, .dashboard-card, .ops-panel {
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  background: var(--card);
  backdrop-filter: blur(10px) saturate(1.12);
  padding: 18px;
}
.summary-panel { position: sticky; top: 92px; }
.summary-list {
  padding-left: 18px;
  margin: 10px 0 16px;
  color: var(--muted);
  line-height: 1.6;
}
.status-note {
  min-height: 22px;
  margin: 12px 0 0;
  color: var(--sage-dark);
  font-weight: 800;
}
.calendar-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.icon-button {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.68);
  backdrop-filter: blur(14px);
  color: var(--ink);
  font-size: 1.45rem;
}
.calendar-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.weekday-row { color: var(--muted); font-size: 0.76rem; font-weight: 800; margin-bottom: 8px; text-align: center; }
.day, .slot, .concern-card {
  min-height: 44px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.62);
  backdrop-filter: blur(12px);
  color: var(--ink);
  font-weight: 700;
}
.day.selected, .slot.selected, .concern-card.selected { background: var(--sage); color: white; border-color: var(--sage); }
.day.disabled, .slot.booked, .slot.buffer, .slot.closed { opacity: 0.55; background: rgba(236, 231, 221, 0.58); }
.slot-grid, .concern-grid, .field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.slot-grid { margin-block: 14px 18px; }
label { display: grid; gap: 7px; color: var(--ink); font-weight: 800; }
input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 13px;
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(12px);
  color: var(--ink);
}
textarea { resize: vertical; }

.form-step { display: none; }
.form-step.active { display: block; }
.stepper {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 18px;
}
.stepper span {
  min-height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.44);
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}
.stepper span.active {
  background: var(--sage);
  color: white;
  border-color: var(--sage);
}
.consent-stack { display: grid; gap: 12px; }
.check-row {
  grid-template-columns: 22px 1fr;
  align-items: start;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 13px;
  background: rgba(255, 255, 255, 0.44);
}
.check-row input { width: auto; margin-top: 3px; }
.trust-badge { display: inline-flex; color: var(--sage-dark); background: rgba(234, 241, 232, 0.68); margin-bottom: 18px; }
.form-error { color: #8c2626; font-weight: 800; min-height: 24px; }
.review-box { background: rgba(244, 239, 229, 0.62); backdrop-filter: blur(14px); border-radius: 8px; padding: 16px; line-height: 1.7; }
.privacy-note { color: var(--muted); }
.hidden { display: none !important; }

.dashboard-card {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  margin-bottom: 16px;
}
.checklist span {
  padding: 10px 12px;
  border-radius: 999px;
  background: rgba(255, 250, 242, 0.66);
  backdrop-filter: blur(12px);
  border: 1px solid var(--line);
}
.helper-actions { margin-top: 18px; }

.action-dialog {
  width: min(460px, calc(100vw - 32px));
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  padding: 22px;
  background: rgba(255, 250, 242, 0.9);
  color: var(--ink);
  box-shadow: var(--shadow);
}
.action-dialog::backdrop { background: rgba(7, 12, 14, 0.58); }
.action-dialog textarea { margin: 12px 0 16px; }

.site-footer {
  margin-block: 28px 0;
  padding: 36px clamp(24px, 4vw, 48px);
  color: #fffdf7;
  display: flex;
  justify-content: space-between;
  gap: 22px;
  align-items: center;
}

.crisis-button {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 12;
  min-height: 44px;
  border: 0;
  border-radius: 999px;
  padding: 12px 16px;
  background: var(--amber);
  color: white;
  font-weight: 800;
  box-shadow: var(--shadow);
}
.crisis-drawer {
  position: fixed;
  right: 18px;
  bottom: 78px;
  z-index: 13;
  width: min(360px, calc(100vw - 36px));
  padding: 20px;
  border-radius: 8px;
  background: rgba(255, 250, 242, 0.78);
  backdrop-filter: blur(20px);
  box-shadow: var(--shadow);
  transform: translateY(18px);
  opacity: 0;
  pointer-events: none;
  transition: 180ms ease;
}
.crisis-drawer.open { transform: translateY(0); opacity: 1; pointer-events: auto; }
.crisis-drawer .icon-button { float: right; }

.clinic-page {
  min-height: 100vh;
  background: #f7f3ea;
  padding: clamp(18px, 4vw, 42px);
}
.ops-shell { width: min(1240px, 100%); margin: auto; }
.ops-header {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
  margin-bottom: 18px;
}
.ops-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
.metric { background: rgba(255, 255, 255, 0.86); border: 1px solid var(--line); border-radius: 8px; padding: 14px; }
.metric strong { display: block; font-size: 1.45rem; margin-top: 4px; }
.ops-layout { display: grid; grid-template-columns: 1.25fr 0.75fr; gap: 16px; }
table { width: 100%; border-collapse: collapse; min-width: 760px; }
th, td { text-align: left; padding: 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 0.78rem; text-transform: uppercase; color: var(--muted); }
.table-wrap { overflow-x: auto; }
.stack { display: grid; gap: 16px; }
.capacity-bar { height: 12px; background: #e7e0d4; border-radius: 999px; overflow: hidden; }
.capacity-bar span { display: block; height: 100%; background: var(--sage); }
.ops-panel {
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: none;
}
.ops-toolbar {
  display: grid;
  grid-template-columns: 1fr 190px 170px;
  gap: 10px;
  margin-bottom: 14px;
}
.status-chip {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 0.78rem;
  font-weight: 800;
  background: #eaf1e8;
  color: var(--sage-dark);
}
.status-chip.risk { background: #fff0d9; color: #8c5217; }
.status-chip.cancelled, .status-chip.no-show { background: #f8dddd; color: #8c2626; }
.status-chip.completed { background: #dfeee7; color: #245344; }
.warning-box {
  border: 1px solid rgba(184, 107, 37, 0.32);
  border-radius: 8px;
  background: #fff3df;
  color: #74430f;
  padding: 12px;
  font-weight: 800;
}
.detail-button {
  min-height: 34px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  font-weight: 800;
  padding: 6px 10px;
}

.reveal { opacity: 0; transform: translateY(22px); transition: 600ms ease; }
.reveal.visible { opacity: 1; transform: translateY(0); }

@media (max-width: 980px) {
  .topbar { align-items: flex-start; flex-direction: column; }
  nav { justify-content: flex-start; }
  .profile-grid, .booking-layout, .ops-layout, .info-grid { grid-template-columns: 1fr; }
  .summary-panel { position: static; }
  .ops-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 640px) {
  .section-pad, .content-section, .site-footer { width: min(100% - 24px, 1160px); }
  .content-section { padding: 20px; }
  h1 { font-size: 3rem; }
  .field-grid, .slot-grid, .concern-grid { grid-template-columns: 1fr; }
  .stepper { grid-template-columns: 1fr; }
  .ops-toolbar { grid-template-columns: 1fr; }
  .calendar-grid { gap: 4px; }
  .day { font-size: 0.86rem; padding: 0; }
  .dashboard-card, .site-footer, .ops-header { flex-direction: column; align-items: stretch; }
  .ops-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal, .crisis-drawer { transition: none; }
}

@media print {
  #patientSite, #crisisButton, #crisisDrawer, #scrollCanvas, .backdrop-overlay, .ops-header .button, .ops-header button { display: none !important; }
  .clinic-page { display: block !important; background: #fff; padding: 0; }
  .ops-panel, .metric { box-shadow: none; background: #fff; }
  table { min-width: 0; font-size: 11px; }
}
