:root {
  --escape-ivory: #f8f3e9;
  --escape-cream: #fffaf2;
  --escape-card: rgba(255, 252, 246, 0.94);
  --escape-rose: #cda8a2;
  --escape-mauve: #a9878e;
  --escape-taupe: #9b897d;
  --escape-brown: #745f54;
  --escape-green: #405d4c;
  --escape-muted: #6f6a64;
  --escape-border: rgba(137, 112, 99, 0.24);
  --escape-shadow: 0 22px 60px rgba(74, 60, 52, 0.12);
  --escape-floral-image: url("assets/escape-floral-background.png");
}

body.client-surface,
body.staff-surface {
  background-color: var(--escape-ivory);
  background-image:
    radial-gradient(circle at 10% 4%, rgba(205, 168, 162, 0.22), transparent 34rem),
    radial-gradient(circle at 92% 14%, rgba(169, 135, 142, 0.13), transparent 30rem),
    linear-gradient(145deg, #fbf7ef 0%, #f4ecdf 52%, #eee5da 100%);
  background-attachment: fixed;
}

body.client-surface::before,
body.staff-surface::before {
  content: "";
  position: fixed;
  z-index: 0;
  inset: 0;
  pointer-events: none;
  background-image: var(--escape-floral-image);
  background-repeat: no-repeat;
  background-position: left -310px top -44px;
  background-size: clamp(1080px, 96vw, 1450px) auto;
  opacity: 0.78;
  -webkit-mask-image: linear-gradient(to bottom, #000 0, rgba(0,0,0,.9) 42%, transparent 88%);
  mask-image: linear-gradient(to bottom, #000 0, rgba(0,0,0,.9) 42%, transparent 88%);
}

body.staff-surface::before {
  left: 230px;
  opacity: 0.4;
  background-position: left -245px top -50px;
  background-size: clamp(1000px, 82vw, 1280px) auto;
  -webkit-mask-image: linear-gradient(to bottom, #000 0, rgba(0,0,0,.72) 36%, transparent 78%);
  mask-image: linear-gradient(to bottom, #000 0, rgba(0,0,0,.72) 36%, transparent 78%);
}

body.client-surface::after,
body.staff-surface::after {
  content: "";
  position: fixed;
  z-index: 0;
  right: -145px;
  bottom: -82px;
  width: min(850px, 64vw);
  height: min(480px, 52vh);
  pointer-events: none;
  background-image: var(--escape-floral-image);
  background-repeat: no-repeat;
  background-position: left top;
  background-size: auto 100%;
  opacity: 0.29;
  transform: scaleX(-1);
  transform-origin: center;
  -webkit-mask-image: linear-gradient(135deg, transparent 7%, rgba(0,0,0,.48) 44%, #000 100%);
  mask-image: linear-gradient(135deg, transparent 7%, rgba(0,0,0,.48) 44%, #000 100%);
}

body.staff-surface::after {
  opacity: 0.2;
  width: min(770px, 58vw);
  height: min(435px, 48vh);
}

@media (max-width: 950px) {
  body.staff-surface::before {
    left: 0;
  }

  body.staff-surface::after {
    right: 0;
  }
}

body.client-surface > :not(script),
body.staff-surface > :not(script) {
  position: relative;
  z-index: 1;
}

body.client-surface {
  --ivory: var(--escape-ivory);
  --paper: var(--escape-cream);
  --sage-dark: var(--escape-green);
  --ink: #332f2c;
  --muted: var(--escape-muted);
  --line: var(--escape-border);
  --shadow: var(--escape-shadow);
}

body.client-surface .card {
  background: var(--escape-card);
  border-color: rgba(155, 137, 125, 0.28);
  box-shadow: var(--escape-shadow);
  -webkit-backdrop-filter: blur(12px) saturate(106%);
  backdrop-filter: blur(12px) saturate(106%);
}

body.client-surface .topbar,
body.client-surface .actions {
  background: rgba(255, 250, 242, 0.78);
}

body.client-surface .section-block,
body.client-surface .consent,
body.client-surface .summary-section,
body.client-surface .therapy-item {
  background-color: rgba(255, 253, 248, 0.84);
  border-color: var(--escape-border);
}

body.client-surface .brand-mark {
  text-shadow: 0 1px 18px rgba(255, 250, 242, 0.88);
}

body.staff-surface {
  --ivory: var(--escape-ivory);
  --paper: var(--escape-cream);
  --dark: var(--escape-green);
  --ink: #332f2c;
  --muted: var(--escape-muted);
  --line: var(--escape-border);
  --shadow: 0 16px 44px rgba(74, 60, 52, 0.1);
}

body.staff-surface .auth-shell,
body.staff-surface .main,
body.staff-surface .content {
  background: transparent;
}

body.staff-surface .auth-card,
body.staff-surface .appointment-card,
body.staff-surface .editor-card,
body.staff-surface .detail-card,
body.staff-surface .empty-state {
  background: rgba(255, 252, 246, 0.94);
  border-color: var(--escape-border);
  box-shadow: 0 12px 36px rgba(74, 60, 52, 0.08);
  -webkit-backdrop-filter: blur(9px);
  backdrop-filter: blur(9px);
}

body.staff-surface .topbar {
  background: rgba(255, 252, 246, 0.9);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}

body.staff-surface .future-actions {
  background: rgba(250, 246, 238, 0.88);
}

@media (max-width: 760px) {
  body.client-surface,
  body.staff-surface {
    background-attachment: scroll;
  }

  body.client-surface::before {
    background-position: left -285px top -16px;
    background-size: auto min(52vh, 510px);
    opacity: 0.55;
    -webkit-mask-image: linear-gradient(to bottom, #000 0, rgba(0,0,0,.72) 42%, transparent 86%);
    mask-image: linear-gradient(to bottom, #000 0, rgba(0,0,0,.72) 42%, transparent 86%);
  }

  body.staff-surface::before {
    left: 0;
    background-position: left -300px top -22px;
    background-size: auto min(50vh, 480px);
    opacity: 0.24;
    -webkit-mask-image: linear-gradient(to bottom, #000 0, rgba(0,0,0,.62) 36%, transparent 80%);
    mask-image: linear-gradient(to bottom, #000 0, rgba(0,0,0,.62) 36%, transparent 80%);
  }

  body.client-surface::after,
  body.staff-surface::after {
    right: -150px;
    bottom: -35px;
    width: min(480px, 82vw);
    height: min(260px, 28vh);
    opacity: 0.12;
  }

  body.staff-surface::after {
    right: 0;
    width: min(330px, 70vw);
  }
}

@media (max-width: 480px) {
  body.client-surface .card {
    background: rgba(255, 252, 246, 0.97);
  }
}

@media (prefers-reduced-transparency: reduce) {
  body.client-surface .card,
  body.staff-surface .auth-card,
  body.staff-surface .appointment-card,
  body.staff-surface .editor-card,
  body.staff-surface .detail-card {
    background: var(--escape-cream);
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }
}

@media print {
  body.client-surface,
  body.staff-surface {
    background: #fff !important;
  }

  body.client-surface::before,
  body.staff-surface::before,
  body.client-surface::after,
  body.staff-surface::after {
    display: none !important;
  }
}
