/* ==========================================================================
   LUMINA DERMA-OS | Enterprise Dermatology & Medical Aesthetics Platform
   Modern CSS Architecture: Tiered Tokens, Fluid Clamp, Top-Layer Transitions
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Design Tokens & System Variables
   -------------------------------------------------------------------------- */
:root {
  /* Surface & Background Hierarchy */
  --bg-deep: #060911;
  --bg-surface: #0c1322;
  --bg-card: #121b2d;
  --bg-card-hover: #17233a;
  --bg-elevated: #1b2842;
  --bg-input: #0e1626;

  /* Border Tokens */
  --border-subtle: rgba(255, 255, 255, 0.06);
  --border-light: rgba(255, 255, 255, 0.12);
  --border-cyan: rgba(56, 189, 248, 0.28);
  --border-gold: rgba(245, 158, 11, 0.28);
  --border-rose: rgba(244, 63, 94, 0.28);
  --border-emerald: rgba(16, 185, 129, 0.28);

  /* Clinical Chroma & Color Palette */
  --color-cyan: #38bdf8;
  --color-cyan-glow: rgba(56, 189, 248, 0.2);
  --color-gold: #f59e0b;
  --color-gold-glow: rgba(245, 158, 11, 0.2);
  --color-rose: #f43f5e;
  --color-rose-glow: rgba(244, 63, 94, 0.2);
  --color-emerald: #10b981;
  --color-emerald-glow: rgba(16, 185, 129, 0.2);

  /* Typography Colors */
  --text-white: #f8fafc;
  --text-sub: #cbd5e1;
  --text-muted: #64748b;
  --text-dim: #475569;

  /* Typography Scales (Fluid clamp) */
  --font-sans: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --text-xs: clamp(0.72rem, 0.68rem + 0.2vw, 0.8rem);
  --text-sm: clamp(0.82rem, 0.78rem + 0.2vw, 0.92rem);
  --text-base: clamp(0.92rem, 0.88rem + 0.25vw, 1.05rem);
  --text-lg: clamp(1.1rem, 1.02rem + 0.4vw, 1.3rem);
  --text-xl: clamp(1.3rem, 1.15rem + 0.6vw, 1.65rem);
  --text-2xl: clamp(1.6rem, 1.35rem + 1vw, 2.2rem);

  /* Layout Constants */
  --sidebar-w: 280px;
  --topbar-h: 70px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-xl: 24px;
  --radius-full: 9999px;
  --transition-fast: 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  --transition-smooth: 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

/* --------------------------------------------------------------------------
   2. Base & Reset
   -------------------------------------------------------------------------- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-family: var(--font-sans);
  background-color: var(--bg-deep);
  color: var(--text-white);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

body {
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
  background: radial-gradient(circle at 10% 20%, rgba(14, 26, 48, 0.5) 0%, transparent 60%),
              radial-gradient(circle at 90% 80%, rgba(20, 15, 30, 0.4) 0%, transparent 60%),
              var(--bg-deep);
}

img {
  max-width: 100%;
  display: block;
}

button, input, select {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  outline: none;
  border: none;
  background: none;
}

button {
  cursor: pointer;
  transition: transform var(--transition-fast), background var(--transition-fast), border-color var(--transition-fast);
}

button:focus-visible, input:focus-visible, select:focus-visible {
  outline: 2px solid var(--color-cyan);
  outline-offset: 2px;
}

/* --------------------------------------------------------------------------
   3. Ambient Decorative Glows
   -------------------------------------------------------------------------- */
.ambient-glow {
  position: fixed;
  width: 500px;
  height: 500px;
  border-radius: 50%;
  pointer-events: none;
  filter: blur(140px);
  z-index: 0;
  opacity: 0.15;
}

.glow-cyan {
  top: -100px;
  left: 200px;
  background: var(--color-cyan);
}

.glow-rose {
  bottom: 0;
  right: 100px;
  background: var(--color-rose);
}

/* --------------------------------------------------------------------------
   4. Application Layout
   -------------------------------------------------------------------------- */
.app-layout {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
  position: relative;
  z-index: 1;
}

@media (max-width: 1024px) {
  .app-layout {
    grid-template-columns: 1fr;
  }
}

/* --------------------------------------------------------------------------
   5. Sidebar Navigation
   -------------------------------------------------------------------------- */
.app-sidebar {
  background: rgba(12, 19, 34, 0.85);
  backdrop-filter: blur(20px);
  border-right: 1px solid var(--border-subtle);
  padding: 1.5rem 1.25rem;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 20;
}

@media (max-width: 1024px) {
  .app-sidebar {
    position: relative;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--border-subtle);
  }
}

.brand-crest {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.2), rgba(56, 189, 248, 0.05));
  border: 1px solid var(--border-cyan);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-cyan);
}

.crest-icon {
  width: 22px;
  height: 22px;
}

.brand-name {
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  display: block;
}

.brand-sub {
  font-size: 0.65rem;
  color: var(--text-muted);
  letter-spacing: 0.12em;
  font-weight: 600;
  display: block;
}

.clinic-status-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.75rem 0.85rem;
  margin-top: 1.25rem;
}

.status-live-pill {
  font-size: 0.65rem;
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--color-cyan);
  background: rgba(56, 189, 248, 0.1);
  padding: 2px 6px;
  border-radius: var(--radius-full);
}

.pulse-cyan, .pulse-emerald {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  animation: pulse-dot 1.8s infinite;
}

.pulse-cyan { background: var(--color-cyan); box-shadow: 0 0 6px var(--color-cyan); }
.pulse-emerald { background: var(--color-emerald); box-shadow: 0 0 6px var(--color-emerald); }

@keyframes pulse-dot {
  0% { transform: scale(0.9); opacity: 0.6; }
  50% { transform: scale(1.3); opacity: 1; }
  100% { transform: scale(0.9); opacity: 0.6; }
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-top: 1.25rem;
  flex: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.75rem 0.95rem;
  border-radius: var(--radius-md);
  color: var(--text-sub);
  font-size: var(--text-sm);
  font-weight: 500;
  text-align: left;
  width: 100%;
  transition: all var(--transition-fast);
  border: 1px solid transparent;
}

.nav-item:hover {
  color: var(--text-white);
  background: rgba(255, 255, 255, 0.03);
}

.nav-item.active {
  color: var(--text-white);
  background: linear-gradient(90deg, rgba(56, 189, 248, 0.12), rgba(56, 189, 248, 0.02));
  border-color: var(--border-cyan);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

.nav-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  color: var(--text-muted);
  transition: color var(--transition-fast);
}

.nav-item.active .nav-icon {
  color: var(--color-cyan);
}

.nav-badge {
  margin-left: auto;
  font-size: 0.68rem;
  font-family: var(--font-mono);
  padding: 2px 7px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.05);
}

.badge-urgent {
  background: rgba(244, 63, 94, 0.15);
  color: var(--color-rose);
  border: 1px solid var(--border-rose);
}

.sidebar-footer {
  margin-top: auto;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-subtle);
}

/* --------------------------------------------------------------------------
   6. Main Content Viewport & Topbar
   -------------------------------------------------------------------------- */
.app-main-viewport {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.app-topbar {
  height: var(--topbar-h);
  border-bottom: 1px solid var(--border-subtle);
  background: rgba(8, 12, 22, 0.7);
  backdrop-filter: blur(16px);
  padding: 0 2rem;
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar-search-wrap {
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  padding: 0.5rem 1rem;
  width: 100%;
  max-width: 440px;
  transition: border-color var(--transition-fast);
}

.topbar-search-wrap:focus-within {
  border-color: var(--border-cyan);
  box-shadow: 0 0 12px var(--color-cyan-glow);
}

.topbar-search-input {
  width: 100%;
  font-size: var(--text-xs);
  color: var(--text-white);
}

.topbar-search-input::placeholder {
  color: var(--text-muted);
}

.profile-avatar, .patient-thumb, .dossier-avatar {
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--border-light);
}

.profile-avatar {
  width: 38px;
  height: 38px;
}

.patient-thumb {
  width: 44px;
  height: 44px;
}

.dossier-avatar {
  width: 56px;
  height: 56px;
  border-color: var(--border-cyan);
}

/* --------------------------------------------------------------------------
   7. Tab Navigation & Content Transitions
   -------------------------------------------------------------------------- */
.tab-content {
  display: none;
  padding: 2rem;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity var(--transition-smooth), transform var(--transition-smooth);
}

.tab-content.active {
  display: block;
  opacity: 1;
  transform: translateY(0);
}

.section-tag {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-cyan);
  margin-bottom: 0.35rem;
}

.page-title {
  font-size: var(--text-2xl);
  font-weight: 800;
  letter-spacing: -0.02em;
}

.section-subtitle {
  font-size: var(--text-sm);
  color: var(--text-muted);
  max-width: 650px;
}

/* Filter Chips */
.filter-chip {
  font-size: var(--text-xs);
  padding: 0.45rem 0.95rem;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-sub);
  border: 1px solid var(--border-subtle);
  transition: all var(--transition-fast);
}

.filter-chip:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-white);
}

.filter-chip.active {
  background: var(--color-cyan);
  color: var(--bg-deep);
  font-weight: 700;
  border-color: var(--color-cyan);
  box-shadow: 0 2px 10px var(--color-cyan-glow);
}

/* --------------------------------------------------------------------------
   8. KPI Metrics & Financial Trajectory
   -------------------------------------------------------------------------- */
.kpi-metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 1.25rem;
}

.kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.35rem;
  position: relative;
  overflow: hidden;
  transition: transform var(--transition-smooth), border-color var(--transition-smooth), box-shadow var(--transition-smooth);
}

.kpi-card:hover {
  transform: translateY(-4px);
  border-color: var(--border-cyan);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
}

.kpi-label {
  font-size: var(--text-xs);
  color: var(--text-muted);
  font-weight: 500;
}

.kpi-icon-box {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.04);
  display: flex;
  align-items: center;
  justify-content: center;
}

.kpi-value {
  font-size: var(--text-2xl);
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 0.35rem;
}

.kpi-delta {
  font-size: 0.72rem;
  font-weight: 600;
}

/* Chart Card */
.chart-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
}

.chart-title {
  font-size: var(--text-lg);
  font-weight: 700;
}

.chart-sub {
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.dot-cyan { background: var(--color-cyan); }
.dot-gold { background: var(--color-gold); }
.dot-rose { background: var(--color-rose); }
.dot-emerald { background: var(--color-emerald); }

.svg-chart-container {
  width: 100%;
  height: 260px;
  margin-top: 1rem;
}

.analytics-svg {
  width: 100%;
  height: 100%;
  overflow: visible;
}

/* Suites Quick Grid */
.suites-quick-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.25rem;
}

.suite-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  transition: transform var(--transition-fast), border-color var(--transition-fast);
}

.suite-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-cyan);
}

.badge-busy {
  font-size: 0.65rem;
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--color-emerald);
  background: rgba(16, 185, 129, 0.1);
  padding: 2px 8px;
  border-radius: var(--radius-full);
}

.badge-standby {
  font-size: 0.65rem;
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.05);
  padding: 2px 8px;
  border-radius: var(--radius-full);
}

.progress-track {
  height: 5px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--color-cyan), var(--color-emerald));
  border-radius: var(--radius-full);
  transition: width 0.5s ease;
}

/* --------------------------------------------------------------------------
   9. Patient Management & EMR Cards
   -------------------------------------------------------------------------- */
.patient-filter-bar {
  flex-wrap: wrap;
  gap: 1rem;
}

.patients-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.25rem;
}

.patient-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.35rem;
  display: flex;
  flex-direction: column;
  transition: transform var(--transition-smooth), border-color var(--transition-smooth), box-shadow var(--transition-smooth);
}

.patient-card:hover {
  transform: translateY(-4px);
  border-color: var(--border-cyan);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.patient-card-name {
  font-size: var(--text-base);
  font-weight: 700;
}

.badge-fitzpatrick {
  font-size: 0.68rem;
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--color-gold);
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid var(--border-gold);
  padding: 2px 7px;
  border-radius: var(--radius-sm);
}

.patient-tags-strip {
  flex-wrap: wrap;
}

.tag-pill {
  font-size: 0.68rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--radius-full);
}

.tag-laser { background: rgba(56, 189, 248, 0.12); color: var(--color-cyan); }
.tag-botox { background: rgba(245, 158, 11, 0.12); color: var(--color-gold); }
.tag-lips { background: rgba(244, 63, 94, 0.12); color: var(--color-rose); }
.tag-rosacea { background: rgba(16, 185, 129, 0.12); color: var(--color-emerald); }
.tag-vip { background: rgba(255, 255, 255, 0.1); color: var(--text-white); }

.patient-notes {
  line-height: 1.5;
  flex: 1;
}

/* --------------------------------------------------------------------------
   10. Interactive Facial Mapping & Dosing Engine
   -------------------------------------------------------------------------- */
.facemap-board-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 1.5rem;
  align-items: start;
}

@media (max-width: 900px) {
  .facemap-board-grid {
    grid-template-columns: 1fr;
  }
}

.facemap-canvas-card, .facemap-summary-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
}

.svg-face-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 1rem 0;
}

.face-svg {
  width: 100%;
  max-width: 420px;
  height: auto;
  user-select: none;
}

.face-zone-group {
  cursor: pointer;
  transition: transform var(--transition-fast), opacity var(--transition-fast);
}

.face-zone-group:hover {
  filter: brightness(1.25);
  transform: scale(1.02);
}

.face-zone-group:not(.active) {
  opacity: 0.35;
}

.face-zone-group:not(.active) rect,
.face-zone-group:not(.active) circle,
.face-zone-group:not(.active) ellipse {
  fill: rgba(255, 255, 255, 0.05) !important;
  stroke: #475569 !important;
}

.summary-title {
  font-size: var(--text-lg);
  font-weight: 700;
}

.dosing-breakdown-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.dose-item {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
  transition: all var(--transition-fast);
}

.dose-item.inactive {
  opacity: 0.4;
  text-decoration: line-through;
}

.dose-item:hover {
  background: rgba(255, 255, 255, 0.04);
}

/* --------------------------------------------------------------------------
   11. Laser Suites & Hardware Telemetry
   -------------------------------------------------------------------------- */
.laser-hardware-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
}

.hardware-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: transform var(--transition-smooth), border-color var(--transition-smooth);
}

.hardware-card:hover {
  transform: translateY(-4px);
  border-color: var(--border-cyan);
}

.hardware-media {
  height: 180px;
  overflow: hidden;
  position: relative;
}

.hw-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.hardware-card:hover .hw-img {
  transform: scale(1.05);
}

.hardware-body {
  padding: 1.25rem;
}

.badge-tag-online {
  font-size: 0.68rem;
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--color-cyan);
  background: rgba(56, 189, 248, 0.1);
  padding: 2px 7px;
  border-radius: var(--radius-full);
}

/* --------------------------------------------------------------------------
   12. Triage & Support Chat
   -------------------------------------------------------------------------- */
.triage-chat-board {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 1.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
  min-height: 480px;
}

@media (max-width: 860px) {
  .triage-chat-board {
    grid-template-columns: 1fr;
  }
}

.triage-thread-list {
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
}

.triage-item {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border-subtle);
  cursor: pointer;
  transition: background var(--transition-fast);
}

.triage-item:hover {
  background: rgba(255, 255, 255, 0.03);
}

.triage-item.active {
  background: rgba(56, 189, 248, 0.06);
  border-left: 3px solid var(--color-cyan);
}

.badge-priority-urgent {
  font-size: 0.65rem;
  color: var(--color-rose);
  font-weight: 600;
}

.badge-priority-normal {
  font-size: 0.65rem;
  color: var(--color-emerald);
  font-weight: 600;
}

.triage-pane {
  display: flex;
  flex-direction: column;
  padding: 1.5rem;
}

.triage-messages-area {
  flex: 1;
  overflow-y: auto;
  max-height: 320px;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.message-bubble {
  max-width: 80%;
  padding: 0.85rem 1.1rem;
  border-radius: var(--radius-md);
  line-height: 1.5;
}

.patient-msg {
  background: rgba(255, 255, 255, 0.05);
  align-self: flex-start;
  border: 1px solid var(--border-subtle);
}

.clinic-msg {
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid var(--border-cyan);
  align-self: flex-end;
}

.triage-reply-box {
  margin-top: auto;
  padding-top: 1rem;
  border-top: 1px solid var(--border-subtle);
}

.triage-input {
  flex: 1;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  padding: 0.6rem 1rem;
  color: var(--text-white);
  font-size: var(--text-xs);
}

.triage-input:focus {
  border-color: var(--border-cyan);
}

/* --------------------------------------------------------------------------
   13. Top-Layer Dialogs & Slide-Over Drawers (Modern Web Standard)
   -------------------------------------------------------------------------- */
dialog {
  border: none;
  background: transparent;
  color: var(--text-white);
  max-width: 100vw;
  max-height: 100vh;
  margin: auto;
  padding: 0;
  transition: opacity 0.3s ease, transform 0.3s ease, overlay 0.3s ease allow-discrete, display 0.3s ease allow-discrete;
  opacity: 0;
  transform: scale(0.96);
}

dialog[open] {
  opacity: 1;
  transform: scale(1);
}

@starting-style {
  dialog[open] {
    opacity: 0;
    transform: scale(0.96);
  }
}

dialog::backdrop {
  background: rgba(4, 6, 12, 0.75);
  backdrop-filter: blur(8px);
  opacity: 0;
  transition: opacity 0.3s ease, overlay 0.3s ease allow-discrete, display 0.3s ease allow-discrete;
}

dialog[open]::backdrop {
  opacity: 1;
}

@starting-style {
  dialog[open]::backdrop {
    opacity: 0;
  }
}

/* Slide-over Patient Dossier Drawer */
.dossier-drawer-dialog {
  margin: 0 0 0 auto;
  height: 100vh;
  width: 100%;
  max-width: 580px;
  transform: translateX(100%);
}

dialog.dossier-drawer-dialog[open] {
  transform: translateX(0);
}

@starting-style {
  dialog.dossier-drawer-dialog[open] {
    transform: translateX(100%);
  }
}

.dossier-inner {
  height: 100%;
  background: var(--bg-surface);
  border-left: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  padding: 2rem;
  box-shadow: -10px 0 40px rgba(0, 0, 0, 0.6);
}

.dossier-scroll-area {
  flex: 1;
  overflow-y: auto;
  margin: 1.5rem 0;
  padding-right: 0.5rem;
}

.modal-close-btn {
  font-size: 1.5rem;
  color: var(--text-muted);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.05);
}

.modal-close-btn:hover {
  color: var(--text-white);
  background: rgba(255, 255, 255, 0.1);
}

/* Modal Dialog Center Card */
.modal-dialog {
  width: 100%;
  max-width: 540px;
}

.modal-inner {
  background: var(--bg-surface);
  border: 1px solid var(--border-cyan);
  border-radius: var(--radius-xl);
  padding: 2rem;
  position: relative;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.7);
}

.modal-inner .modal-close-btn {
  position: absolute;
  top: 1.5rem;
  right: 1.5rem;
}

/* Vitals & Photographic Containers */
.vitals-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
}

.vital-tile {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.75rem;
}

.before-after-container {
  height: 220px;
  border-radius: var(--radius-md);
  overflow: hidden;
  position: relative;
  border: 1px solid var(--border-subtle);
}

.ba-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.ba-overlay-badge {
  position: absolute;
  bottom: 12px;
  left: 12px;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  color: var(--color-cyan);
  font-size: 0.68rem;
  font-family: var(--font-mono);
  font-weight: 700;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-cyan);
}

.treatment-history-log {
  border-top: 1px solid var(--border-subtle);
  padding-top: 1rem;
}

.log-entry {
  background: rgba(255, 255, 255, 0.02);
  border-left: 2px solid var(--color-cyan);
  padding: 0.6rem 0.85rem;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

/* --------------------------------------------------------------------------
   14. Forms & Controls
   -------------------------------------------------------------------------- */
.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

@media (max-width: 600px) {
  .form-grid-2 {
    grid-template-columns: 1fr;
  }
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.form-label {
  font-size: var(--text-xs);
  color: var(--text-sub);
  font-weight: 600;
}

.form-input {
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.65rem 0.9rem;
  color: var(--text-white);
  font-size: var(--text-xs);
  transition: border-color var(--transition-fast);
}

.form-input:focus {
  border-color: var(--border-cyan);
}

/* --------------------------------------------------------------------------
   15. Buttons & Badges Utility
   -------------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  padding: 0.65rem 1.25rem;
  font-size: var(--text-xs);
  transition: all var(--transition-fast);
}

.btn-sm {
  padding: 0.4rem 0.85rem;
  font-size: 0.75rem;
}

.btn-lg {
  padding: 0.85rem 1.5rem;
  font-size: var(--text-sm);
}

.btn-cyan {
  background: var(--color-cyan);
  color: var(--bg-deep);
  font-weight: 700;
}

.btn-cyan:hover {
  background: #7dd3fc;
  box-shadow: 0 4px 16px var(--color-cyan-glow);
  transform: translateY(-1px);
}

.btn-outline-cyan {
  border: 1px solid var(--border-cyan);
  color: var(--color-cyan);
}

.btn-outline-cyan:hover {
  background: rgba(56, 189, 248, 0.1);
  color: var(--text-white);
}

.btn-gold {
  background: var(--color-gold);
  color: var(--bg-deep);
  font-weight: 700;
}

.btn-gold:hover {
  background: #fbbf24;
  box-shadow: 0 4px 16px var(--color-gold-glow);
}

.full-width {
  width: 100%;
}

/* --------------------------------------------------------------------------
   16. Helper Utilities
   -------------------------------------------------------------------------- */
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-align { display: flex; align-items: center; }
.gap-1 { gap: 0.25rem; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }

.text-white { color: var(--text-white); }
.text-sub { color: var(--text-sub); }
.text-muted { color: var(--text-muted); }
.text-cyan { color: var(--color-cyan); }
.text-gold { color: var(--color-gold); }
.text-rose { color: var(--color-rose); }
.text-emerald { color: var(--color-emerald); }

.font-mono { font-family: var(--font-mono); }
.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }

.text-xs { font-size: var(--text-xs); }
.text-sm { font-size: var(--text-sm); }
.text-base { font-size: var(--text-base); }
.text-lg { font-size: var(--text-lg); }
.text-xl { font-size: var(--text-xl); }
.text-2xl { font-size: var(--text-2xl); }

.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 0.75rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 0.75rem; }
.pt-3 { padding-top: 0.75rem; }
.border-t { border-top: 1px solid var(--border-subtle); }
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.block { display: block; }
.inline { display: inline-block; }
.text-right { text-align: right; }

.icon-xs { width: 14px; height: 14px; }
.icon-sm { width: 18px; height: 18px; }

/* --------------------------------------------------------------------------
   17. WhatsApp Follow-Up Suite & Smartphone Simulator
   -------------------------------------------------------------------------- */
.whatsapp-workbench-grid {
  display: grid;
  grid-template-columns: 1.25fr 1fr;
  gap: 1.5rem;
  align-items: start;
}

@media (max-width: 960px) {
  .whatsapp-workbench-grid {
    grid-template-columns: 1fr;
  }
}

.wa-composer-card, .wa-mockup-card, .recall-table-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
}

.phone-mockup {
  width: 100%;
  max-width: 330px;
  margin: 0 auto;
  height: 480px;
  background: #0b141a;
  border: 4px solid #1e293b;
  border-radius: 28px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.5);
}

.phone-topbar {
  padding: 6px 14px;
  background: #1f2c34;
  color: #8696a0;
}

.wa-chat-header {
  background: #1f2c34;
  padding: 8px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.wa-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
}

.wa-bubbles-viewport {
  flex: 1;
  padding: 12px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background-color: #0b141a;
  background-image: radial-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 16px 16px;
}

.wa-bubble {
  max-width: 86%;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 0.72rem;
  line-height: 1.4;
  position: relative;
  word-break: break-word;
}

.wa-clinic-bubble {
  background: #005c4b;
  color: #e9edef;
  align-self: flex-end;
  border-top-right-radius: 2px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

.wa-patient-bubble {
  background: #202c33;
  color: #e9edef;
  align-self: flex-start;
  border-top-left-radius: 2px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

.wa-time {
  font-size: 0.6rem;
  color: rgba(233, 237, 239, 0.6);
  text-align: right;
  display: block;
  margin-top: 3px;
  font-family: var(--font-mono);
}

.wa-photo-attachment {
  border-radius: 6px;
  overflow: hidden;
  margin-bottom: 4px;
}

.wa-attach-img {
  width: 100%;
  height: 110px;
  object-fit: cover;
  display: block;
}

.wa-chat-input-bar {
  background: #1f2c34;
  padding: 8px 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.wa-mini-input {
  flex: 1;
  background: #2a3942;
  border-radius: var(--radius-full);
  padding: 6px 12px;
  color: #fff;
  font-size: 0.72rem;
}

.wa-mini-send {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #00a884;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* 90-Day Retention Table */
.clinic-table {
  width: 100%;
  border-collapse: collapse;
}

.clinic-table th {
  padding: 0.6rem 0.85rem;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-subtle);
  background: rgba(255, 255, 255, 0.02);
  text-align: left;
}

.clinic-table td {
  padding: 0.75rem 0.85rem;
  border-bottom: 1px solid var(--border-subtle);
}

.badge-recall-due {
  background: rgba(245, 158, 11, 0.15);
  color: var(--color-gold);
  border: 1px solid var(--border-gold);
  padding: 2px 6px;
  border-radius: var(--radius-xs);
}

.badge-recall-overdue {
  background: rgba(244, 63, 94, 0.15);
  color: var(--color-rose);
  border: 1px solid var(--border-rose);
  padding: 2px 6px;
  border-radius: var(--radius-xs);
}

.badge-recall-ok {
  background: rgba(16, 185, 129, 0.15);
  color: var(--color-emerald);
  border: 1px solid var(--border-emerald);
  padding: 2px 6px;
  border-radius: var(--radius-xs);
}

/* --------------------------------------------------------------------------
   18. Digital Consent Pad & Aesthetics Financing
   -------------------------------------------------------------------------- */
.sig-pad-wrapper {
  position: relative;
  height: 140px;
  background: var(--bg-input);
  border: 1px solid var(--border-cyan);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.sig-canvas {
  width: 100%;
  height: 100%;
  cursor: crosshair;
}

.sig-placeholder-hint {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: var(--text-dim);
  font-size: 0.76rem;
  pointer-events: none;
  font-family: var(--font-mono);
}

/* --------------------------------------------------------------------------
   19. Interactive Before & After Split Comparison Slider
   -------------------------------------------------------------------------- */
.split-slider-container {
  position: relative;
  height: 250px;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border-subtle);
  user-select: none;
}

.split-img-after {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.split-overlay-before {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 50%;
  overflow: hidden;
  z-index: 2;
}

.split-img-before {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  min-width: 540px; /* Ensures scale matches container */
}

.split-divider-handle {
  position: absolute;
  top: 0;
  left: 50%;
  width: 2px;
  height: 100%;
  background: var(--color-cyan);
  transform: translateX(-50%);
  pointer-events: none;
  z-index: 10;
  box-shadow: 0 0 10px var(--color-cyan);
}

.handle-pill {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--color-cyan);
  color: var(--bg-deep);
  font-size: 0.65rem;
  font-weight: 800;
  padding: 3px 7px;
  border-radius: var(--radius-full);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

.split-range-input {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: ew-resize;
  z-index: 20;
}

.split-badge {
  position: absolute;
  bottom: 10px;
  padding: 3px 8px;
  border-radius: var(--radius-xs);
  font-size: 0.65rem;
  font-family: var(--font-mono);
  font-weight: 700;
  z-index: 5;
}

.before-badge {
  left: 10px;
  background: rgba(244, 63, 94, 0.85);
  color: #fff;
}

.after-badge {
  right: 10px;
  background: rgba(16, 185, 129, 0.85);
  color: #fff;
}

@media (max-width: 768px) {
  .hide-mobile { display: none !important; }
  .app-topbar { padding: 0 1rem; }
  .tab-content { padding: 1.25rem 1rem; }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
