/* ========== CSS Variables & Theming ========== */
:root {
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --sidebar-width: 260px;
  --transition-speed: 0.2s;
  --border-radius-sm: 6px;
  --border-radius: 8px;
  --border-radius-md: 10px;
  --border-radius-lg: 12px;

  /* Global "Clinical Calm" Color Palette (Default) */
  --bg-primary: #f8fafc; /* Breathable soft gray canvas (slate-50) */
  --bg-secondary: #ffffff;
  --bg-tertiary: #f1f5f9; /* Slate 100 */
  --bg-card: #ffffff; /* Elevated pure white cards */
  --bg-card-hover: #fcfdfe;
  --bg-input: #ffffff;
  --bg-hover: #f1f5f9;
  --bg-sidebar: #0f172a; /* Sleek dark panel bg-slate-900 */

  /* Viewport & Picture Frame Tokens (Clinical Light Mode) */
  --viewport-bg: #f8fafc; /* Clean matte neutral background for clinical photo frames */
  --viewport-border: #cbd5e1; /* Slate 300 crisp boundary */
  --viewport-shadow: inset 0 1px 3px rgba(15, 23, 42, 0.05);
  --border-color-strong: #cbd5e1;

  /* Typography Colors - High Contrast WCAG AAA/AA Compliant */
  --text-primary: #1e293b; /* Slate 800 - crisp, professional slate typography */
  --text-secondary: #334155; /* Slate 700 - clear secondary text */
  --text-muted: #64748b; /* Slate 500 - labels & badges */

  /* Clinical Teal Accent */
  --accent: #0d9488; /* Clinical Teal teal-600 */
  --accent-hover: #0f766e; /* teal-700 */
  --accent-soft: rgba(13, 148, 136, 0.08);
  --accent-ring: rgba(13, 148, 136, 0.25);
  --accent-primary: #0d9488;

  /* Semantic Alerts */
  --success: #10b981;
  --success-soft: rgba(16, 185, 129, 0.1);
  --warning: #f59e0b;
  --warning-soft: rgba(245, 158, 11, 0.1);
  --danger: #ef4444;
  --danger-soft: rgba(239, 68, 68, 0.1);

  /* Borders & Shadows */
  --border-color: #e2e8f0; /* Slate 200 light gray border */
  --shadow: 0 4px 6px -1px rgba(15, 23, 42, 0.07), 0 2px 4px -2px rgba(15, 23, 42, 0.05);
  --shadow-sm: 0 1px 3px 0 rgba(15, 23, 42, 0.06), 0 1px 2px -1px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 4px 12px -2px rgba(15, 23, 42, 0.08);
  --scrollbar-thumb: #cbd5e1;
  --scrollbar-track: #f8fafc;
}

[data-theme="light"] {
  --bg-primary: #f8fafc;
  --bg-secondary: #ffffff;
  --bg-tertiary: #f1f5f9;
  --bg-card: #ffffff;
  --bg-card-hover: #fcfdfe;
  --bg-input: #ffffff;
  --bg-hover: #f1f5f9;
  --bg-sidebar: #0f172a;

  --viewport-bg: #f8fafc;
  --viewport-border: #cbd5e1;
  --viewport-shadow: inset 0 1px 3px rgba(15, 23, 42, 0.05);
  --border-color-strong: #cbd5e1;

  --text-primary: #1e293b;
  --text-secondary: #334155;
  --text-muted: #64748b;

  --accent: #0d9488;
  --accent-hover: #0f766e;
  --accent-soft: rgba(13, 148, 136, 0.08);
  --accent-ring: rgba(13, 148, 136, 0.25);
  --accent-primary: #0d9488;

  --success: #10b981;
  --success-soft: rgba(16, 185, 129, 0.1);
  --warning: #f59e0b;
  --warning-soft: rgba(245, 158, 11, 0.1);
  --danger: #ef4444;
  --danger-soft: rgba(239, 68, 68, 0.1);

  --border-color: #e2e8f0;
  --shadow: 0 4px 6px -1px rgba(15, 23, 42, 0.07), 0 2px 4px -2px rgba(15, 23, 42, 0.05);
  --shadow-sm: 0 1px 3px 0 rgba(15, 23, 42, 0.06), 0 1px 2px -1px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 4px 12px -2px rgba(15, 23, 42, 0.08);
  --scrollbar-thumb: #cbd5e1;
  --scrollbar-track: #f8fafc;
}

[data-theme="dark"],
.dark {
  /* Obsidian Slate Canvas & Brushed Titanium Cards */
  --bg-primary: #0B0F17;              /* Deep obsidian slate canvas */
  --bg-secondary: #131B28;            /* Brushed titanium panel background */
  --bg-tertiary: #1A2436;             /* Inset control background */
  --bg-card: #131B28;                 /* Brushed titanium cards */
  --bg-card-hover: #192334;           /* Soft card hover */
  --bg-input: #0E141F;                /* High contrast input recessed well */
  --bg-hover: rgba(255, 255, 255, 0.04);
  --bg-sidebar: #070A0F;              /* Ultra-dense black-slate sidebar */

  /* Clinical Photo Viewport Framing */
  --viewport-bg: #070A10;             /* True neutral dark matte frame */
  --viewport-border: #1E2B3E;         /* Titanium frame border */
  --viewport-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.6);
  --border-color-strong: rgba(255, 255, 255, 0.16);

  /* High Contrast Typography */
  --text-primary: #F8FAFC;            /* Pure slate-50 text */
  --text-secondary: #CBD5E1;          /* Slate-300 secondary text */
  --text-muted: #94A3B8;              /* Slate-400 muted text */

  /* Clinical Accents: Teal & Gold */
  --accent: #0D9488;                  /* Clinical Teal */
  --accent-hover: #14B8A6;            /* Luminous Teal Hover */
  --accent-soft: rgba(20, 184, 166, 0.14);
  --accent-ring: rgba(20, 184, 166, 0.35);
  --accent-primary: #0D9488;
  
  --accent-gold: #F59E0B;             /* Clinical Gold / Amber */
  --accent-gold-hover: #FBBF24;
  --accent-gold-soft: rgba(245, 158, 11, 0.16);

  /* Semantic Alerts */
  --success: #10B981;
  --success-soft: rgba(16, 185, 129, 0.16);
  --warning: #F59E0B;
  --warning-soft: rgba(245, 158, 11, 0.16);
  --danger: #EF4444;
  --danger-soft: rgba(239, 68, 68, 0.16);

  /* Micro-Luminous Borders & Ambient Glow */
  --border-color: rgba(255, 255, 255, 0.08);
  --border-luminous: 1px solid rgba(255, 255, 255, 0.1);
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 12px 40px rgba(0, 0, 0, 0.55);
  --scrollbar-thumb: #233146;
  --scrollbar-track: #0B0F17;
}

/* Sidebar navigation styling override */
.sidebar {
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --bg-hover: rgba(255, 255, 255, 0.07);
  --border-color: rgba(255, 255, 255, 0.08);
}

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

html {
  font-size: 14px;
}

body {
  font-family: var(--font-family);
  background: var(--bg-primary);
  color: var(--text-primary);
  display: flex;
  height: 100vh;
  overflow: hidden;
  transition: background var(--transition-speed), color var(--transition-speed);
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--scrollbar-track);
}
::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--accent);
}

/* ========== Sidebar ========== */
.sidebar {
  width: var(--sidebar-width);
  background: #0f172a !important;
  display: flex;
  flex-direction: column;
  border-right: 1px solid #1e293b;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
  transition: background var(--transition-speed);
}

.sidebar-header {
  padding: 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  display: flex;
  align-items: center;
  justify-content: center;
}

.logo {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
}

.app-brand-lockup {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
}

.app-brand-mark {
  height: 34px;
  width: auto;
  flex: 0 0 auto;
  object-fit: contain;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.35));
}

.app-brand-type {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  min-width: 0;
}

.app-brand-wordmark {
  width: 172px;
  max-width: 100%;
  height: auto;
  display: block;
}

.app-brand-tagline {
  font-size: 8px;
  font-weight: 500;
  letter-spacing: 0.24em;
  color: #94a3b8;
  white-space: nowrap;
  padding-left: 1px;
}

.logo-icon {
  font-size: 26px;
}

.logo-text {
  font-size: 20px;
  font-weight: 700;
  color: #f8fafc;
  letter-spacing: -0.02em;
}

.nav-menu {
  list-style: none;
  padding: 20px 12px;
  flex: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--border-radius);
  cursor: pointer;
  color: #94a3b8;
  transition: all var(--transition-speed);
  margin-bottom: 6px;
  font-weight: 500;
  font-size: 13.5px;
  user-select: none;
  border-left: 3px solid transparent;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #f8fafc;
}

.nav-item.active {
  background: rgba(13, 148, 136, 0.16);
  color: #2dd4bf;
  border-left-color: var(--accent);
  font-weight: 600;
}

.nav-item.active .nav-icon {
  transform: translateY(-1px);
  color: #FFFFFF;
  border-color: color-mix(in srgb, var(--icon-accent, #2DD4BF) 62%, transparent);
  box-shadow:
    0 0 24px color-mix(in srgb, var(--icon-accent, #2DD4BF) 26%, transparent),
    inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.nav-icon {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  flex: none;
  border-radius: 9px;
  background:
    linear-gradient(
      145deg,
      color-mix(in srgb, var(--icon-accent, #2DD4BF) 16%, transparent),
      rgba(255, 255, 255, 0.015)
    );
  border: 1px solid color-mix(in srgb, var(--icon-accent, #2DD4BF) 25%, transparent);
  color: #D7E1EC;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
  transition:
    transform var(--transition-speed),
    background var(--transition-speed),
    border-color var(--transition-speed),
    box-shadow var(--transition-speed),
    color var(--transition-speed);
}

.nav-icon svg {
  width: 19px;
  height: 19px;
  overflow: visible;
}

.nav-icon .accent {
  stroke: var(--icon-accent, #2DD4BF);
}

.nav-item:hover .nav-icon {
  color: #FFFFFF;
  border-color: color-mix(in srgb, var(--icon-accent, #2DD4BF) 48%, transparent);
  box-shadow:
    0 0 18px color-mix(in srgb, var(--icon-accent, #2DD4BF) 18%, transparent),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.sidebar-footer {
  padding: 16px 12px;
  border-top: 1px solid rgba(255,255,255,0.08);
}

.theme-toggle {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  border-radius: var(--border-radius);
  cursor: pointer;
  color: var(--text-secondary);
  background: none;
  border: none;
  width: 100%;
  font-family: inherit;
  font-size: inherit;
  font-weight: 500;
  transition: all var(--transition-speed);
}

.theme-toggle:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.theme-icon {
  font-size: 18px;
  width: 24px;
  text-align: center;
}

/* ========== Main Content ========== */
.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  overflow-y: auto;
  padding: 32px 40px;
  height: 100vh;
  background: var(--bg-primary);
  transition: background var(--transition-speed);
}

/* ========== Pages ========== */
.page {
  display: none;
  animation: fadeIn 0.3s ease;
}

.page.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ========== Page Header ========== */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
  flex-wrap: wrap;
  gap: 16px;
}

.page-header h1 {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
}

.page-header .subtitle {
  color: var(--text-muted);
  margin-top: 4px;
  font-size: 14px;
}

.page-header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.page-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* ========== Executive Patient Header & Chairside KPI Dashboard ========== */
.patient-executive-header {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 18px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-lg, 12px);
  box-shadow: var(--shadow-sm);
  margin-bottom: 24px;
  position: relative;
}

.patient-master-id-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  width: 100%;
}

.patient-master-left {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.btn-chairside-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  padding: 7px 12px;
}

.patient-avatar-monogram {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--accent) 0%, #0f766e 100%);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 16px;
  letter-spacing: 0.5px;
  box-shadow: 0 4px 12px rgba(13, 148, 136, 0.3);
  flex-shrink: 0;
}

.patient-title-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.patient-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.patient-title-row h1 {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}

.patient-subtitle-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-muted);
}

.patient-subtitle-row strong {
  color: var(--text-secondary);
}

.meta-dot {
  opacity: 0.5;
}

.chairside-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.btn-chairside {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: var(--border-radius);
  transition: all 0.16s ease;
}

.patient-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-top: 4px;
  padding-top: 14px;
  border-top: 1px solid var(--border-color);
  width: 100%;
}

@media (max-width: 1024px) {
  .patient-kpi-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 640px) {
  .patient-kpi-grid {
    grid-template-columns: 1fr;
  }
}

.kpi-widget-card {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-md, 10px);
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  transition: all 0.16s ease;
}

.kpi-widget-card:hover {
  border-color: rgba(20, 184, 166, 0.3);
  transform: translateY(-1px);
}

.kpi-widget-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}

.kpi-widget-val {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.kpi-val-financial {
  color: var(--accent-gold, #f59e0b);
}

.kpi-val-appt {
  color: var(--accent, #0d9488);
}

.kpi-progress-track {
  width: 100%;
  height: 6px;
  background: rgba(0, 0, 0, 0.15);
  border-radius: 9999px;
  overflow: hidden;
  margin-top: 2px;
}

[data-theme="dark"] .kpi-progress-track,
.dark .kpi-progress-track {
  background: rgba(255, 255, 255, 0.1);
}

.kpi-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent) 0%, #14b8a6 100%);
  border-radius: 9999px;
  transition: width 0.4s ease;
}

.kpi-stage-meta {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.2px;
  min-height: 12px;
}

.kpi-wire-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.kpi-wire-icon {
  color: #f59e0b;
}

.kpi-financial-subtext,
.kpi-appt-subtext {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ========== Badge ========== */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px; /* px-2.5 py-0.5 */
  border-radius: 9999px; /* rounded-full */
  font-size: 12px; /* text-xs */
  font-weight: 500; /* font-medium */
  background: var(--accent-soft);
  color: var(--accent);
}

/* ========== Buttons ========== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--border-radius);
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  transition: all var(--transition-speed);
  white-space: nowrap;
}

.btn-primary {
  background: var(--accent);
  color: #ffffff;
  border: 1px solid var(--accent);
  box-shadow: 0 1px 2px 0 rgba(13, 148, 136, 0.2);
}
.btn-primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(13, 148, 136, 0.25);
}

.btn-outline {
  background: #ffffff;
  color: #334155;
  border: 1px solid #cbd5e1;
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}
.btn-outline:hover {
  background: #f8fafc;
  color: #1e293b;
  border-color: #94a3b8;
}

.btn-danger {
  background: #fee2e2;
  color: #dc2626;
  border: 1px solid #fca5a5;
}
.btn-danger:hover {
  background: #dc2626;
  color: #ffffff;
}

.btn-sm {
  padding: 6px 14px;
  font-size: 12px;
}

/* ========== Stats Grid ========== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 20px;
  margin-bottom: 32px;
}

.stat-card {
  background: var(--bg-card);
  border-radius: var(--border-radius-lg);
  padding: 24px;
  display: flex;
  align-items: center;
  gap: 20px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
  transition: all var(--transition-speed);
  min-width: 0;
}
.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.stat-card.accent {
  border: 1px solid var(--border-color);
}

.stat-icon {
  font-size: 36px;
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-tertiary);
  border-radius: var(--border-radius);
  flex-shrink: 0;
}

.stat-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.stat-value {
  font-size: 32px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.stat-label {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ========== Quick Actions ========== */
.quick-actions h2,
.recent-patients-section h2 {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 16px;
}

.actions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

.action-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-lg);
  padding: 24px;
  display: flex;
  align-items: center;
  gap: 14px;
  cursor: pointer;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  transition: all var(--transition-speed);
}
.action-card:hover {
  background: var(--bg-hover);
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.action-icon {
  font-size: 24px;
}

/* ========== Recent Patients ========== */
.recent-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.recent-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  cursor: pointer;
  transition: all var(--transition-speed);
}
.recent-item:hover {
  background: var(--bg-hover);
  border-color: var(--accent);
}

.recent-item-info {
  display: flex;
  align-items: center;
  gap: 16px;
}

.recent-item-name {
  font-weight: 600;
  color: var(--text-primary);
}

.recent-item-id {
  color: var(--text-muted);
  font-size: 12px;
}

.recent-item-date {
  color: var(--text-muted);
  font-size: 13px;
}

/* ========== Search Box ========== */
.search-box {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: 0 16px;
  min-width: 300px;
  transition: border-color var(--transition-speed);
}
.search-box:focus-within {
  border-color: var(--accent);
}
.search-box input {
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 13px;
  padding: 10px 0;
  width: 100%;
  outline: none;
}
.search-box input::placeholder {
  color: var(--text-muted);
}
.search-icon {
  font-size: 16px;
  color: var(--text-muted);
}

/* ========== Data Table (Glass Luxury Table Modernization) ========== */
.table-container {
  overflow-x: auto;
  overflow-y: auto;
  max-height: calc(100vh - 240px);
  contain: content;
  position: relative;
  background: rgba(19, 27, 40, 0.6);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-lg, 12px);
  box-shadow: var(--shadow-sm);
}

/* Virtual Table Spacer Rows */
.virtual-spacer {
  pointer-events: none;
  user-select: none;
  background: transparent !important;
}
.virtual-spacer td {
  padding: 0 !important;
  margin: 0 !important;
  border: none !important;
  background: transparent !important;
  line-height: 0 !important;
  font-size: 0 !important;
}

[data-theme="light"] .table-container {
  background: rgba(255, 255, 255, 0.7);
}

.data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin-top: 0;
}

.data-table thead th {
  padding: 14px 16px;
  text-align: left;
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-muted);
  background: var(--bg-tertiary);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 5;
}

.data-table thead th:first-child {
  border-top-left-radius: var(--border-radius-lg, 12px);
}
.data-table thead th:last-child {
  border-top-right-radius: var(--border-radius-lg, 12px);
}

.data-table tbody tr {
  border-bottom: 1px solid var(--border-color);
  transition: background var(--transition-speed), transform 0.16s ease, box-shadow 0.16s ease;
  position: relative;
}

.data-table tbody tr:hover {
  background: var(--bg-hover);
  transform: translateX(2px);
}

[data-theme="dark"] .data-table tbody tr:hover,
.dark .data-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.04);
  box-shadow: inset 3px 0 0 0 var(--accent);
}

[data-theme="light"] .data-table tbody tr:hover {
  background: rgba(13, 148, 136, 0.04);
  box-shadow: inset 3px 0 0 0 var(--accent);
}

.data-table tbody tr.clickable {
  cursor: pointer;
}

.data-table tbody td {
  padding: 14px 16px;
  font-size: 13px;
  color: var(--text-secondary);
}

.data-table tbody td:first-child {
  font-weight: 600;
  color: var(--accent);
}

/* Skeleton Shimmering */
@keyframes glassShimmer {
  0% {
    background-position: -200% 0;
  }
  100% {
    background-position: 200% 0;
  }
}

.skeleton-shimmer {
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.03) 25%,
    rgba(255, 255, 255, 0.10) 37%,
    rgba(255, 255, 255, 0.03) 63%
  );
  background-size: 200% 100%;
  animation: glassShimmer 1.4s ease-in-out infinite;
  border-radius: 4px;
  display: inline-block;
  height: 16px;
  vertical-align: middle;
}

[data-theme="light"] .skeleton-shimmer {
  background: linear-gradient(
    90deg,
    rgba(15, 23, 42, 0.04) 25%,
    rgba(15, 23, 42, 0.09) 37%,
    rgba(15, 23, 42, 0.04) 63%
  );
  background-size: 200% 100%;
}

.skeleton-cell-id { width: 80px; }
.skeleton-cell-name { width: 140px; font-weight: 600; }
.skeleton-cell-sm { width: 45px; }
.skeleton-cell-badge { width: 75px; height: 22px; border-radius: 9999px; }
.skeleton-cell-phone { width: 110px; }
.skeleton-cell-date { width: 90px; }
.skeleton-cell-currency { width: 85px; }

/* ========== Empty State ========== */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted);
}
.empty-state p {
  font-size: 15px;
}

/* ========== Form Styles ========== */
.patient-form {
  max-width: 1100px;
}

.form-section {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-lg);
  padding: 32px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
}

.section-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.section-icon {
  font-size: 20px;
}

.subsection-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin: 20px 0 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-color);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 16px;
  align-items: start;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group.full-width {
  grid-column: 1 / -1;
}

.form-group label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.required {
  color: var(--accent);
}

.form-group input,
.form-group select,
.form-group textarea {
  padding: 10px 14px;
  border-radius: var(--border-radius);
  border: 1px solid var(--border-color);
  background: var(--bg-input);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 13.5px;
  transition: all var(--transition-speed);
  outline: none;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring);
}

.form-group input:disabled,
.form-group textarea:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.form-group select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

.form-group textarea {
  resize: vertical;
  min-height: 60px;
}

.readonly-input {
  background: var(--bg-tertiary) !important;
  color: var(--accent) !important;
  font-weight: 700;
  cursor: default;
}

.form-group input.invalid,
.form-group select.invalid {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px var(--danger-soft);
}

.form-actions-inline {
  flex-direction: row !important;
  align-items: flex-end !important;
  gap: 10px !important;
  padding-top: 20px;
}

/* ========== Extraction Pattern (Treatment Plan) ========== */
.extraction-pattern-block {
  margin-top: 18px;
  padding: 16px;
  border: 1px dashed var(--border-color);
  border-radius: var(--border-radius-lg);
  background: var(--bg-tertiary);
  transition: opacity var(--transition-speed);
}

.extraction-pattern-block.is-disabled {
  opacity: 0.45;
}

.extraction-pattern-header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px 12px;
  margin-bottom: 14px;
}

.extraction-pattern-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.extraction-pattern-hint {
  font-size: 11.5px;
  color: var(--text-muted);
}

.extraction-pattern-wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 22px;
}

.extraction-cross {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  width: 300px;
  max-width: 100%;
  aspect-ratio: 1 / 1;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  background: var(--bg-input);
  overflow: hidden;
}

.extraction-cross::before,
.extraction-cross::after {
  content: '';
  position: absolute;
  background: var(--text-muted);
  opacity: 0.35;
  pointer-events: none;
}

.extraction-cross::before {
  left: 50%;
  top: 6%;
  bottom: 6%;
  width: 2px;
  margin-left: -1px;
}

.extraction-cross::after {
  top: 50%;
  left: 6%;
  right: 6%;
  height: 2px;
  margin-top: -1px;
}

.extraction-quadrant {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px;
}

.extraction-quadrant-label {
  position: absolute;
  top: 8px;
  left: 12px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.6px;
  color: var(--text-muted);
  text-transform: uppercase;
}

.extraction-tooth-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.extraction-tooth-select {
  width: 74px;
  height: 56px;
  padding: 0 10px;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  background: var(--bg-card);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 26px;
  font-weight: 700;
  text-align: center;
  text-align-last: center;
  cursor: pointer;
  outline: none;
  transition: border-color var(--transition-speed), box-shadow var(--transition-speed);
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
}

.extraction-tooth-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring);
}

.extraction-tooth-select:disabled {
  cursor: not-allowed;
}

.anchorage-tag {
  position: absolute;
  top: -11px;
  right: -16px;
  padding: 1px 6px;
  border: 1px solid var(--accent);
  border-radius: 999px;
  background: var(--bg-card);
  color: var(--accent);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.2px;
  line-height: 1.35;
  white-space: nowrap;
  pointer-events: none;
}

.anchorage-tag:empty {
  display: none;
}

.anchorage-panel {
  flex: 1 1 240px;
  min-width: 220px;
}

.anchorage-panel-title {
  margin-bottom: 8px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.3px;
  color: var(--text-muted);
  text-transform: uppercase;
}

.anchorage-grid {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.anchorage-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.anchorage-quadrant {
  width: 24px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.4px;
  color: var(--text-muted);
}

.anchorage-options {
  display: inline-flex;
  overflow: hidden;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--bg-input);
}

.anchorage-btn {
  padding: 6px 10px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition-speed), color var(--transition-speed);
}

.anchorage-btn + .anchorage-btn {
  border-left: 1px solid var(--border-color);
}

.anchorage-btn:hover:not(:disabled):not(.active) {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.anchorage-btn.active {
  background: var(--accent);
  color: #ffffff;
}

.anchorage-btn:disabled {
  cursor: not-allowed;
}

.anchorage-hint {
  margin: 8px 0 0;
  font-size: 10.5px;
  color: var(--text-muted);
}

@media (max-width: 720px) {
  .extraction-cross {
    width: 100%;
  }
}

/* ========== Tabs (Anchored Pill Tab Navigation) ========== */
.tabs {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 24px;
  padding: 4px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-md, 10px);
  width: fit-content;
  max-width: 100%;
  overflow-x: auto;
}

.tab {
  padding: 8px 16px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  border-radius: var(--border-radius-sm, 6px);
  transition: all var(--transition-speed, 0.2s) ease;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.tab:hover {
  color: var(--text-primary);
  background: rgba(13, 148, 136, 0.08);
}

.tab.active {
  background: #f0fdfa; /* bg-teal-50 */
  color: #0f766e; /* text-teal-700 */
  border-radius: var(--border-radius-sm, 6px);
  box-shadow: 0 1px 2px rgba(13, 148, 136, 0.12);
  border: 1px solid rgba(13, 148, 136, 0.2);
}

[data-theme="dark"] .tab.active,
.dark .tab.active {
  background: rgba(13, 148, 136, 0.22);
  color: #2dd4bf; /* text-teal-400 */
  border-color: rgba(45, 212, 191, 0.35);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.tab-content {
  display: none;
}
.tab-content.active {
  display: block;
}

/* ========== Detail Card ========== */
.detail-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-lg);
  padding: 28px 32px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
}

.detail-card h3 {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-color);
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 20px;
}

.detail-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.detail-item.full-width {
  grid-column: 1 / -1;
}

.detail-label {
  font-size: 11px;
  font-weight: 500;
  color: #64748b; /* text-gray-500 */
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

[data-theme="dark"] .detail-label,
.dark .detail-label {
  color: #94a3b8;
}

.detail-value {
  font-size: 14px;
  color: #0f172a; /* text-gray-900 */
  font-weight: 600; /* font-semibold */
  white-space: pre-wrap;
  word-break: break-word;
}

[data-theme="dark"] .detail-value,
.dark .detail-value {
  color: #f8fafc;
}

/* ========== Visits Section ========== */
.visits-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.visits-header h3 {
  font-size: 18px;
  font-weight: 700;
}

.visit-form-container {
  margin-bottom: 24px;
}

/* ========== Finance Section ========== */
.finance-overview {
  margin-bottom: 24px;
}

.finance-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.finance-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: var(--shadow-sm);
}

.finance-card.highlight {
  border: 1px solid var(--border-color);
}

.finance-card.remaining {
  border: 1px solid var(--border-color);
}

.finance-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.finance-value {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
}

.finance-card.highlight .finance-value {
  color: var(--success);
}

.finance-card.remaining .finance-value {
  color: var(--warning);
}

/* ========== Progress Bar ========== */
.progress-section h3 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.progress-bar-container {
  width: 100%;
  height: 32px;
  background: var(--bg-tertiary);
  border-radius: 16px;
  overflow: hidden;
  position: relative;
}

.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--success), #3ad584);
  border-radius: 16px;
  width: 0%;
  transition: width 0.8s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
}

.progress-bar .progress-label {
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0,0,0,0.3);
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
}

/* ========== Toast ========== */
.toast-container {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  padding: 14px 24px;
  border-radius: var(--border-radius);
  font-size: 13px;
  font-weight: 600;
  animation: toastIn 0.3s ease, toastOut 0.3s ease 2.7s;
  box-shadow: var(--shadow);
  max-width: 400px;
}

.toast.success {
  background: var(--success);
  color: #fff;
}

.toast.error {
  background: var(--danger);
  color: #fff;
}

.toast.warning {
  background: var(--warning);
  color: #fff;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(40px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes toastOut {
  from { opacity: 1; transform: translateX(0); }
  to { opacity: 0; transform: translateX(40px); }
}

/* ========== Modal ========== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  overflow-y: auto;
  padding: 20px 10px;
}

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-lg);
  padding: 28px;
  max-width: 420px;
  width: 90%;
  box-shadow: var(--shadow);
}

.modal h3 {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 12px;
  color: var(--text-primary);
}

.modal p {
  color: var(--text-secondary);
  font-size: 14px;
  margin-bottom: 24px;
  line-height: 1.5;
}

.modal-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

/* Luxury Confirm Modal Guard */
#confirmModal {
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
}

#confirmModal .modal {
  max-width: 480px;
  border: 1px solid rgba(239, 68, 68, 0.35);
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.75), 0 0 25px rgba(239, 68, 68, 0.12);
}

#confirmModal #confirmTitle {
  font-size: 1.15rem;
  font-weight: 700;
  color: #f87171;
  display: flex;
  align-items: center;
  gap: 8px;
}

#confirmModal #confirmMessage {
  font-size: 0.92rem;
  line-height: 1.6;
  color: var(--text-primary);
  margin-bottom: 24px;
}

/* ========== Autocomplete ========== */
.autocomplete-wrapper {
  position: relative;
}

/* ========== Utility ========== */
.text-accent { color: var(--accent); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-danger { color: var(--danger); }
.fw-700 { font-weight: 700; }

/* ========== Responsive (large screens) ========== */
@media (min-width: 1920px) {
  html {
    font-size: 15px;
  }
  .main-content {
    padding: 40px 60px;
  }
}

/* ========================================================
   PHASE 2: 8-PHOTO ORTHODONTIC STUDIO & PROGRESS TRACKER
   ======================================================== */

/* Studio Header & Controls */
.studio-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 16px;
  padding: 16px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-lg);
}

.studio-controls-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.studio-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
}

.studio-select {
  padding: 8px 14px;
  border-radius: var(--border-radius);
  border: 1px solid var(--border-color);
  background: var(--bg-input);
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 600;
  outline: none;
  cursor: pointer;
  min-width: 220px;
}

.studio-controls-right {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.studio-tip-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 18px;
  margin-bottom: 20px;
  background: rgba(56, 189, 248, 0.08);
  border: 1px solid rgba(56, 189, 248, 0.25);
  border-radius: var(--border-radius);
  color: var(--text-primary);
  font-size: 13px;
  line-height: 1.5;
}

.studio-tip-banner .tip-icon {
  font-size: 18px;
  flex-shrink: 0;
}

/* Decoupled Studio Upload Progress Bar (Optimized Sub-Component) */
.studio-upload-progress {
  margin-bottom: 16px;
  padding: 12px 18px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-lg);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.studio-upload-progress-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.studio-upload-progress-percent {
  color: var(--primary-color, #2563eb);
  font-variant-numeric: tabular-nums;
}

.studio-upload-progress-track {
  width: 100%;
  height: 8px;
  background: var(--bg-hover, #e2e8f0);
  border-radius: 4px;
  overflow: hidden;
}

.studio-upload-progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #3b82f6, #06b6d4);
  border-radius: 4px;
  transition: width 0.15s ease-out;
}

/* 8-Photo Composite Mount Layout */
.ortho-composite-mount {
  display: flex;
  flex-direction: column;
  gap: 28px;
  margin-bottom: 30px;
}

.mount-row-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 18px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-sm);
  margin-bottom: -10px;
}

.mount-row-header .row-num {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.5px;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 3px 8px;
  border-radius: 4px;
}

.mount-row-header .row-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
}

.mount-row-header .row-desc {
  font-size: 12px;
  color: var(--text-muted);
  margin-left: auto;
}

.mount-grid {
  display: grid;
  gap: 20px;
}

.row-1-grid, .row-2-grid {
  grid-template-columns: repeat(3, 1fr);
}

.row-3-grid {
  grid-template-columns: repeat(2, 1fr);
  max-width: 800px;
  margin: 0 auto;
  width: 100%;
}

.row-4-grid {
  grid-template-columns: repeat(2, 1fr);
  max-width: 800px;
  margin: 0 auto;
  width: 100%;
}

.extra-mount-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  width: 100%;
}

@media (max-width: 900px) {
  .extra-mount-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Individual Photo Slot */
.photo-slot {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-lg);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: relative;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: border-color var(--transition-speed), box-shadow var(--transition-speed), transform 0.15s;
}

.photo-slot:hover {
  border-color: var(--accent);
  box-shadow: 0 4px 14px rgba(13, 148, 136, 0.12);
}

.photo-slot.is-dragging {
  opacity: 0.45;
  border: 2px dashed var(--accent);
}

.photo-slot.drag-target-hover {
  border: 2px solid var(--accent);
  box-shadow: 0 0 16px rgba(13, 148, 136, 0.35);
  transform: scale(1.015);
}

.slot-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 2px 4px;
  min-height: 24px;
  user-select: none;
}

.slot-header-left {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  flex: 1;
}

.slot-drag-handle {
  cursor: grab;
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1;
  padding: 2px 4px;
  border-radius: 4px;
  transition: all 0.15s ease;
  user-select: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.slot-drag-handle:hover {
  color: var(--accent);
  background: var(--accent-soft);
}

.slot-drag-handle:active {
  cursor: grabbing;
}

.slot-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.slot-badge {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--bg-tertiary);
  color: var(--text-muted);
  border: 1px solid var(--border-color);
}

/* Viewport inside Slot */
.slot-viewport {
  position: relative;
  aspect-ratio: 4 / 3;
  width: 100%;
  min-height: 200px;
  background: var(--viewport-bg);
  border-radius: 8px;
  border: 1px solid var(--viewport-border);
  box-shadow: var(--viewport-shadow);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
  contain: paint;
}

/* Empty Slot Dropzone UI */
.slot-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  height: 100%;
  padding: 16px;
  background: var(--bg-card);
  border: 2px dashed var(--border-color-strong);
  border-radius: 6px;
  cursor: pointer;
  color: var(--text-secondary);
  transition: all var(--transition-speed);
}

.slot-empty:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}

.slot-empty-icon {
  font-size: 28px;
  opacity: 0.85;
  color: var(--accent);
}

.slot-empty-text {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-primary);
  text-align: center;
}

.slot-empty-hint {
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
}

/* Populated Slot */
.slot-image-wrapper {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 200px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: grab;
  user-select: none;
  touch-action: none;
}

.slot-image-wrapper:active {
  cursor: grabbing;
}

.slot-img {
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  transform-origin: center center;
  transition: transform 0.05s linear;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
  display: block;
  will-change: transform;
  transform: translateZ(0);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

/* Active Photo Viewport GPU Layer Promotion & Panning Transition Suppressor */
.editor-photo-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  transform-origin: center center;
  pointer-events: none;
  will-change: transform;
  transform: translateZ(0);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

.slot-viewport,
.slot-image-wrapper,
.editor-viewport,
.crop-stage-container {
  contain: layout paint;
  transform: translateZ(0);
}

.slot-img.is-panning,
.editor-photo-img.is-panning,
.is-panning .slot-img,
.is-panning .editor-photo-img,
.is-panning img,
#editorImagePreview.is-panning {
  transition: none !important;
}

/* Floating Frosted-Glass HUD Pill Toolbar */
.slot-quick-actions {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%) translateY(12px) scale(0.96);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 4px 8px;
  background: rgba(19, 27, 40, 0.88);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 9999px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.05);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s cubic-bezier(0.16, 1, 0.3, 1), transform 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 30;
  white-space: nowrap;
}

[data-theme="light"] .slot-quick-actions {
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(15, 23, 42, 0.12);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
}

.slot-viewport:hover .slot-quick-actions,
.slot-viewport:focus-within .slot-quick-actions,
.photo-slot:hover .slot-quick-actions {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0) scale(1);
}

.hud-separator {
  width: 1px;
  height: 16px;
  background: rgba(255, 255, 255, 0.15);
  margin: 0 2px;
  flex-shrink: 0;
}

[data-theme="light"] .hud-separator {
  background: rgba(15, 23, 42, 0.12);
}

.btn-qa {
  width: 28px;
  height: 28px;
  padding: 0;
  border-radius: 9999px;
  background: transparent;
  border: 1px solid transparent;
  color: #94a3b8;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.16s ease;
  line-height: 1;
  flex-shrink: 0;
}

.btn-qa .hud-icon {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  display: block;
}

.btn-qa:hover {
  background: rgba(255, 255, 255, 0.14);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.2);
  transform: scale(1.08);
}

[data-theme="light"] .btn-qa {
  color: #64748b;
}

[data-theme="light"] .btn-qa:hover {
  background: rgba(13, 148, 136, 0.12);
  color: #0d9488;
  border-color: rgba(13, 148, 136, 0.25);
  transform: scale(1.08);
}

.btn-qa.active {
  background: rgba(20, 184, 166, 0.2);
  border-color: #14b8a6;
  color: #14b8a6;
}

.btn-qa.btn-qa-danger:hover {
  background: rgba(239, 68, 68, 0.2);
  border-color: #ef4444;
  color: #f87171;
}

/* Slot Transform Status Badges (Top-left of viewport to keep HUD clear) */
.slot-transform-badges {
  position: absolute;
  top: 8px;
  left: 8px;
  display: flex;
  gap: 4px;
  z-index: 15;
  pointer-events: none;
}

.slot-transform-badge {
  background: rgba(15, 23, 42, 0.85);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.35);
  font-size: 9px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  letter-spacing: 0.3px;
  backdrop-filter: blur(4px);
}

/* 1-Click Move-to-Slot Dropdown Footer on Each Photo Card */
.slot-card-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  background: var(--bg-tertiary);
  border-top: 1px solid var(--border-color);
  border-radius: 0 0 8px 8px;
  font-size: 11px;
  z-index: 10;
}

.slot-footer-label {
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.slot-move-select {
  flex: 1;
  background: var(--bg-input);
  color: var(--text-primary);
  border: 1px solid var(--border-color-strong);
  border-radius: 5px;
  padding: 3px 6px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  outline: none;
  transition: border-color 0.15s;
}

.slot-move-select:hover, .slot-move-select:focus {
  border-color: var(--accent);
}


/* ========================================================
   TRACK PROGRESS / COMPARE VISITS TAB
   ======================================================== */
.progress-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  padding: 16px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-lg);
  margin-bottom: 20px;
}

.progress-controls-left {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}

.progress-select-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.progress-select-group .progress-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}

.progress-controls-right .view-mode-toggle {
  display: flex;
  gap: 8px;
}

.view-mode-toggle .btn.active {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
}

/* Split Curtain Slider Area */
.comparison-display-area {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 24px;
}

.slider-labels {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 4px;
}

.slider-instruction {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}

.badge-before {
  background: var(--accent);
  color: #ffffff;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 4px;
}

.badge-after {
  background: #10b981;
  color: #ffffff;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 4px;
}

.comparison-slider-container {
  position: relative;
  width: 100%;
  max-width: 860px;
  margin: 0 auto;
  aspect-ratio: 4 / 3;
  background: var(--viewport-bg);
  border: 1px solid var(--viewport-border);
  border-radius: var(--border-radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  user-select: none;
}

.slider-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.slider-layer img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
}

.layer-before {
  z-index: 2;
  clip-path: polygon(0 0, 50% 0, 50% 100%, 0 100%);
}

.layer-after {
  z-index: 1;
}

.slider-handle {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 3px;
  background: #ffffff;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.7);
  z-index: 10;
  cursor: ew-resize;
  transform: translateX(-50%);
  pointer-events: none;
}

.slider-handle-button {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 42px;
  height: 42px;
  background: #ffffff;
  border: 3px solid var(--accent);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  font-size: 10px;
  font-weight: 800;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

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

/* Side-by-Side Area */
.side-by-side-area {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 24px;
}

.sbs-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-lg);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.sbs-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sbs-date {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 600;
}

.sbs-viewport {
  aspect-ratio: 4 / 3;
  width: 100%;
  background: #080d1a;
  border-radius: 6px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sbs-viewport img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* Composite Comparison Area (Dual 8-Photo Mounts) */
.composite-comparison-area {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 24px;
}

.dual-mount-column {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-lg);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.dual-mount-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.mini-composite-mount {
  display: grid;
  grid-template-rows: auto auto auto;
  gap: 8px;
}

.mini-composite-row {
  display: grid;
  gap: 8px;
}

.mini-composite-row.row-3 {
  grid-template-columns: repeat(2, 1fr);
  max-width: 66%;
  margin: 0 auto;
  width: 100%;
}

.mini-composite-row.row-1, .mini-composite-row.row-2 {
  grid-template-columns: repeat(3, 1fr);
}

.mini-slot {
  background: var(--viewport-bg);
  border-radius: 6px;
  border: 1px solid var(--viewport-border);
  aspect-ratio: 4 / 3;
  overflow: hidden;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mini-slot img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.mini-slot-label {
  position: absolute;
  bottom: 2px;
  left: 2px;
  background: rgba(0, 0, 0, 0.7);
  color: #94a3b8;
  font-size: 8px;
  font-weight: 600;
  padding: 1px 4px;
  border-radius: 2px;
}

/* Clinical Milestone Card */
.milestone-card {
  margin-top: 10px;
}

.milestone-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin-top: 12px;
}

.milestone-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.milestone-item.full-width {
  grid-column: 1 / -1;
}

.milestone-label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 600;
}

.milestone-value {
  font-size: 14px;
  color: var(--text-primary);
  font-weight: 500;
}

/* ========================================================
   CLINICAL PHOTO EDITOR MODAL
   ======================================================== */
.photo-editor-modal {
  max-width: 900px;
  width: 95%;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-header-titles {
  display: flex;
  align-items: center;
  gap: 12px;
}

.btn-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 18px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  transition: color var(--transition-speed);
}

.btn-close:hover {
  color: var(--danger);
}

.photo-editor-body {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 20px;
  margin-bottom: 20px;
}

@media (max-width: 800px) {
  .photo-editor-body {
    grid-template-columns: 1fr;
  }
}

.editor-viewport-wrapper {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.editor-viewport {
  position: relative;
  aspect-ratio: 4 / 3;
  width: 100%;
  background: var(--viewport-bg);
  border: 1px solid var(--viewport-border);
  box-shadow: var(--viewport-shadow);
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: grab;
  user-select: none;
}

.editor-viewport:active {
  cursor: grabbing;
}

.editor-viewport img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  transform-origin: center center;
  pointer-events: none;
}

.editor-canvas-hint {
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
}

/* Grid & Reference lines in editor */
.editor-grid {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 10;
}

.grid-line {
  position: absolute;
  background: #38bdf8;
  opacity: 0.8;
}

.grid-line.horizontal {
  top: 50%;
  left: 0;
  right: 0;
  height: 1.5px;
}

.grid-line.vertical {
  left: 50%;
  top: 0;
  bottom: 0;
  width: 1.5px;
}

.grid-thirds-h1 {
  position: absolute;
  top: 33.33%;
  left: 0;
  right: 0;
  height: 1px;
  background: rgba(255, 255, 255, 0.25);
  border-top: 1px dashed rgba(255, 255, 255, 0.4);
}

.grid-thirds-h2 {
  position: absolute;
  top: 66.66%;
  left: 0;
  right: 0;
  height: 1px;
  background: rgba(255, 255, 255, 0.25);
  border-top: 1px dashed rgba(255, 255, 255, 0.4);
}

.grid-thirds-v1 {
  position: absolute;
  left: 33.33%;
  top: 0;
  bottom: 0;
  width: 1px;
  background: rgba(255, 255, 255, 0.25);
  border-left: 1px dashed rgba(255, 255, 255, 0.4);
}

.grid-thirds-v2 {
  position: absolute;
  left: 66.66%;
  top: 0;
  bottom: 0;
  width: 1px;
  background: rgba(255, 255, 255, 0.25);
  border-left: 1px dashed rgba(255, 255, 255, 0.4);
}

/* Editor Controls Panel */
.editor-controls-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.editor-control-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.editor-control-group:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.control-group-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
}

.btn-group-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.slider-header-inline {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.slider-readout {
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 2px 6px;
  border-radius: 4px;
}

.slider-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.fine-slider {
  flex: 1;
  accent-color: var(--accent);
  cursor: pointer;
}

.pan-sliders-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.pan-slider-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pan-axis-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
}

/* AI Settings Modal */
.ai-settings-modal {
  max-width: 680px;
  width: 94%;
  max-height: 85vh;
  max-height: calc(100vh - 80px);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  padding: 0;
  position: relative;
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.45);
}

.ai-settings-modal .modal-header {
  position: sticky;
  top: 0;
  z-index: 30;
  background: var(--bg-card);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px 14px;
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
}

.ai-settings-modal .modal-header h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
}

.ai-settings-modal .modal-body {
  padding: 20px 24px;
  overflow-y: auto;
  flex: 1 1 auto;
}

.ai-settings-modal .modal-actions {
  position: sticky;
  bottom: 0;
  z-index: 30;
  background: var(--bg-card);
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  padding: 14px 24px 18px;
  border-top: 1px solid var(--border-color);
  flex-shrink: 0;
}

.settings-desc {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.form-hint {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}

.ai-status-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: rgba(46, 213, 115, 0.08);
  border: 1px solid rgba(46, 213, 115, 0.25);
  border-radius: var(--border-radius);
  margin-top: 16px;
}

.ai-status-icon {
  font-size: 24px;
}

.ai-status-info strong {
  display: block;
  font-size: 13px;
  color: var(--success);
}

.ai-status-info span {
  font-size: 12px;
  color: var(--text-secondary);
}

/* Slot Delete Corner 'X' Button & Header Actions */
.slot-header-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-slot-delete-x {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.35);
  border-radius: 4px;
  width: 22px;
  height: 22px;
  font-size: 12px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  line-height: 1;
  padding: 0;
  transition: all 0.15s ease;
}

.btn-slot-delete-x:hover {
  background: #ef4444;
  color: #ffffff;
  border-color: #ef4444;
  transform: scale(1.15);
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.5);
}

/* In-App Two-Click Clear Mount Button */
.btn-danger-confirm {
  background: #dc2626 !important;
  border-color: #ef4444 !important;
  color: #ffffff !important;
  animation: pulse-danger 1s infinite alternate ease-in-out;
  font-weight: 700 !important;
}

@keyframes pulse-danger {
  0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.6); }
  100% { transform: scale(1.03); box-shadow: 0 0 10px 2px rgba(220, 38, 38, 0.7); }
}

/* Extra Visit Photos Section */
.extra-photos-section {
  margin-top: 28px;
  padding: 20px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-lg);
}

.extra-photos-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 12px;
}

.extra-photos-title-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.extra-photos-icon {
  font-size: 26px;
}

.extra-photos-title {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: var(--text-main);
}

.extra-photos-subtitle {
  margin: 2px 0 0 0;
  font-size: 12px;
  color: var(--text-muted, #94a3b8);
}

.extra-photos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.extra-photo-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.extra-photo-card:hover {
  border-color: var(--accent);
  box-shadow: 0 4px 14px rgba(13, 148, 136, 0.12);
}

.extra-photo-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: var(--bg-tertiary);
  border-bottom: 1px solid var(--border-color);
}

.extra-photo-badge {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 4px;
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid rgba(13, 148, 136, 0.25);
}

.extra-photo-viewport {
  position: relative;
  width: 100%;
  height: 200px;
  background: var(--viewport-bg);
  border: 1px solid var(--viewport-border);
  box-shadow: var(--viewport-shadow);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.extra-photo-viewport img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  transform-origin: center center;
  transition: transform 0.05s linear;
}

.extra-photo-toolbar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 10px;
  background: var(--bg-tertiary);
  border-top: 1px solid var(--border-color);
}

.extra-btn-tool {
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border-color-strong);
  border-radius: 4px;
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.extra-btn-tool:hover {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
}

.extra-btn-tool.active {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
}

.extra-photo-caption-box {
  padding: 8px 12px;
  background: var(--bg-tertiary);
  border-top: 1px solid var(--border-color);
}

.extra-photo-caption-input {
  width: 100%;
  box-sizing: border-box;
  background: var(--bg-input);
  color: var(--text-primary);
  border: 1px solid var(--border-color-strong);
  border-radius: 5px;
  padding: 6px 10px;
  font-size: 11px;
  outline: none;
  transition: border-color 0.15s ease;
}

.extra-photo-caption-input:focus {
  border-color: var(--accent);
  background: var(--bg-card);
}

.extra-photos-empty {
  grid-column: 1 / -1;
  padding: 28px 20px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
  border: 1px dashed var(--border-color-strong);
  border-radius: var(--border-radius);
  background: var(--bg-card);
}

/* Inlined Extra Photo Slots inside ortho-composite-mount */
.extra-slot-caption-footer {
  display: flex;
  align-items: center;
  padding: 6px 10px;
  background: var(--bg-tertiary);
  border-top: 1px solid var(--border-color);
  border-radius: 0 0 8px 8px;
}

.extra-slot-caption-input {
  width: 100%;
  box-sizing: border-box;
  background: var(--bg-input);
  color: var(--text-primary);
  border: 1px solid var(--border-color-strong);
  border-radius: 5px;
  padding: 5px 8px;
  font-size: 11px;
  font-weight: 500;
  outline: none;
  transition: border-color 0.15s ease;
}

.extra-slot-caption-input:focus {
  border-color: var(--accent);
  background: var(--bg-card);
}

.extra-slot-add-placeholder {
  cursor: pointer;
  border-style: dashed;
}

.extra-slot-add-placeholder:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

/* ==========================================================================
   Status Badges & Clinic Badges (Standardized: px-2.5 py-0.5 rounded-full text-xs font-medium)
   ========================================================================== */
.badge-status,
.badge-clinic {
  display: inline-flex;
  align-items: center;
  font-weight: 500; /* font-medium */
  font-size: 12px; /* text-xs */
  line-height: 1.25rem;
  padding: 2px 10px; /* px-2.5 py-0.5 */
  border-radius: 9999px; /* rounded-full */
  text-transform: capitalize;
  letter-spacing: 0.02em;
}

.badge-status-active {
  background: #dcfce7;
  color: #166534;
  border: 1px solid #bbf7d0;
}

[data-theme="dark"] .badge-status-active,
.dark .badge-status-active {
  background: rgba(34, 197, 94, 0.2);
  color: #86efac;
  border-color: rgba(34, 197, 94, 0.35);
}

.badge-status-finished {
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #e2e8f0;
}

[data-theme="dark"] .badge-status-finished,
.dark .badge-status-finished {
  background: rgba(148, 163, 184, 0.2);
  color: #cbd5e1;
  border-color: rgba(148, 163, 184, 0.35);
}

.badge-status-paused {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fde68a;
}

[data-theme="dark"] .badge-status-paused,
.dark .badge-status-paused {
  background: rgba(245, 158, 11, 0.2);
  color: #fde68a;
  border-color: rgba(245, 158, 11, 0.35);
}

.badge-status-missed {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

[data-theme="dark"] .badge-status-missed,
.dark .badge-status-missed {
  background: rgba(239, 68, 68, 0.2);
  color: #fca5a5;
  border-color: rgba(239, 68, 68, 0.35);
}

.badge-clinic {
  background: #f0fdfa;
  color: #0f766e;
  border: 1px solid #ccfbf1;
}

[data-theme="dark"] .badge-clinic,
.dark .badge-clinic {
  background: rgba(20, 184, 166, 0.2);
  color: #5eead4;
  border-color: rgba(20, 184, 166, 0.35);
}

/* ==========================================================================
   Clinical Photo Watermark Overlay
   ========================================================================== */
.clinical-watermark {
  position: absolute;
  bottom: 0.5rem; /* bottom-2 */
  right: 0.5rem;  /* right-2 */
  width: 4rem;    /* w-16 */
  height: auto;   /* h-auto */
  max-height: 48px;
  object-fit: contain;
  opacity: 0.7;   /* opacity-70 */
  pointer-events: none;
  z-index: 10;    /* z-10 */
  filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.45));
  transition: opacity 0.2s ease;
  user-select: none;
}

.slot-image-wrapper:hover .clinical-watermark,
.timeline-slot-viewport:hover .clinical-watermark {
  opacity: 0.9;
}

/* Patient List Filter Bar */
.patient-filter-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  padding: 12px 18px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow-sm);
  margin-bottom: 20px;
}

.filter-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

.filter-item label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
}

.filter-select {
  padding: 6px 10px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  color: var(--text-primary);
  font-size: 12px;
  outline: none;
  cursor: pointer;
  min-width: 140px;
}

.filter-select:focus {
  border-color: var(--accent);
}

/* ==========================================================================
   Cephalometric Analysis Tab
   ========================================================================== */
.ceph-container {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.ceph-header-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-lg);
  padding: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
}

.ceph-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}

.ceph-icon {
  font-size: 24px;
}

.ceph-title-row h2 {
  font-size: 18px;
  font-weight: 700;
  margin: 0;
  color: var(--text-primary);
}

.ceph-standard-tag {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  background: rgba(56, 189, 248, 0.15);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.3);
  border-radius: 9999px;
}

.ceph-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin: 0;
  line-height: 1.45;
}

.ceph-header-actions {
  display: flex;
  gap: 10px;
  flex-shrink: 0;
}

.ceph-grid-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.ceph-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.ceph-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 12px;
}

.ceph-card-header h3 {
  font-size: 15px;
  font-weight: 700;
  margin: 0;
  color: var(--text-primary);
}

.ceph-badge {
  font-size: 11px;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.05);
  padding: 2px 8px;
  border-radius: 9999px;
}

.ceph-group-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent);
  margin-bottom: 10px;
}

.ceph-fields-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.ceph-field label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 4px;
  display: block;
}

.ceph-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.ceph-input {
  width: 100%;
  box-sizing: border-box;
  padding: 8px 30px 8px 10px;
  background: var(--bg-input, #0f172a);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 600;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.ceph-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

.ceph-unit {
  position: absolute;
  right: 10px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  pointer-events: none;
}

.ceph-norm-hint {
  font-size: 10.5px;
  color: var(--text-muted);
  margin-top: 3px;
  display: block;
}

.highlight-field {
  background: rgba(99, 102, 241, 0.06);
  border: 1px solid rgba(99, 102, 241, 0.25);
  border-radius: var(--border-radius-sm);
  padding: 8px 10px;
}

.ceph-anb-pattern {
  font-size: 11px;
  font-weight: 600;
  color: #818cf8;
  margin-top: 4px;
}

.ceph-textarea {
  width: 100%;
  box-sizing: border-box;
  padding: 10px;
  background: var(--bg-input, #0f172a);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  color: var(--text-primary);
  font-size: 13px;
  resize: vertical;
  outline: none;
}

.ceph-textarea:focus {
  border-color: var(--accent);
}

/* Ceph Norms Table */
.ceph-norms-table-wrap {
  overflow-x: auto;
}

.ceph-norms-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.ceph-norms-table th,
.ceph-norms-table td {
  padding: 10px 8px;
  text-align: left;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.ceph-norms-table th {
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 10.5px;
  letter-spacing: 0.04em;
}

.ceph-eval-norm {
  color: #10b981;
  font-weight: 600;
}

.ceph-eval-high {
  color: #f59e0b;
  font-weight: 600;
}

.ceph-eval-low {
  color: #38bdf8;
  font-weight: 600;
}

.ceph-clinical-summary-box {
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: 14px;
  margin-top: 6px;
}

.ceph-summary-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 4px;
}

.ceph-summary-content {
  font-size: 13px;
  color: var(--text-primary);
  line-height: 1.4;
}

/* ==========================================================================
   Crop Photo Modal
   ========================================================================== */
.crop-modal {
  max-width: 820px;
  width: 95vw;
}

.crop-modal-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.crop-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  padding: 8px 12px;
  background: rgba(15, 23, 42, 0.7);
  border-radius: var(--border-radius-sm);
  border: 1px solid var(--border-color);
}

.crop-aspect-buttons {
  display: flex;
  align-items: center;
  gap: 6px;
}

.crop-toolbar-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
}

.btn-crop-aspect.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.crop-size-indicator {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}

.crop-stage-container {
  width: 100%;
  height: 480px;
  background: #080d1a;
  border-radius: var(--border-radius);
  border: 1px solid var(--border-color);
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
}

.crop-stage-inner {
  position: relative;
  display: inline-block;
  max-width: 100%;
  max-height: 100%;
}

.crop-target-image {
  max-width: 100%;
  max-height: 480px;
  display: block;
  object-fit: contain;
  user-select: none;
  pointer-events: none;
}

.crop-box {
  position: absolute;
  border: 2px solid #38bdf8;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.55);
  cursor: move;
  box-sizing: border-box;
}

.crop-grid-lines {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.crop-grid-line {
  position: absolute;
  background: rgba(255, 255, 255, 0.35);
}

.crop-grid-line.v1 { top: 0; bottom: 0; left: 33.33%; width: 1px; }
.crop-grid-line.v2 { top: 0; bottom: 0; left: 66.66%; width: 1px; }
.crop-grid-line.h1 { left: 0; right: 0; top: 33.33%; height: 1px; }
.crop-grid-line.h2 { left: 0; right: 0; top: 66.66%; height: 1px; }

/* Handles */
.crop-handle {
  position: absolute;
  width: 10px;
  height: 10px;
  background: #fff;
  border: 2px solid #38bdf8;
  border-radius: 2px;
  box-sizing: border-box;
}

.handle-nw { top: -5px; left: -5px; cursor: nwse-resize; }
.handle-ne { top: -5px; right: -5px; cursor: nesw-resize; }
.handle-se { bottom: -5px; right: -5px; cursor: nwse-resize; }
.handle-sw { bottom: -5px; left: -5px; cursor: nesw-resize; }
.handle-n  { top: -5px; left: calc(50% - 5px); cursor: ns-resize; }
.handle-s  { bottom: -5px; left: calc(50% - 5px); cursor: ns-resize; }
.handle-e  { right: -5px; top: calc(50% - 5px); cursor: ew-resize; }
.handle-w  { left: -5px; top: calc(50% - 5px); cursor: ew-resize; }

/* ==========================================================================
   Clinic Manager Modal
   ========================================================================== */
.clinic-modal {
  max-width: 520px;
}

.clinic-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 240px;
  overflow-y: auto;
}

.clinic-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: #f1f5f9; /* Light Mode: bg-slate-100 / bg-gray-50 */
  border: 1px solid var(--border-color, #e2e8f0);
  border-radius: var(--border-radius-sm, 6px);
  color: #0f172a; /* Light Mode: text-gray-900 */
  transition: all var(--transition-speed, 0.2s) ease;
}

.clinic-item:hover {
  background: #e2e8f0;
}

.clinic-item-name {
  font-size: 13px;
  font-weight: 600;
  color: #0f172a; /* Light Mode: text-gray-900 */
  display: flex;
  align-items: center;
  gap: 8px;
}

.clinic-item-tag {
  font-size: 11px;
  font-weight: 600;
  color: #0f766e; /* Teal-700 in Light Mode for high contrast */
  background: rgba(13, 148, 136, 0.12);
  border: 1px solid rgba(13, 148, 136, 0.25);
  padding: 3px 8px;
  border-radius: 9999px;
  letter-spacing: 0.2px;
}

/* Dark Mode Overrides for Clinic List */
[data-theme="dark"] .clinic-item,
.dark .clinic-item {
  background: #334155; /* Dark Mode: dark:bg-slate-700 */
  border-color: #475569;
  color: #ffffff; /* Dark Mode: dark:text-white */
}

[data-theme="dark"] .clinic-item:hover,
.dark .clinic-item:hover {
  background: #3f526b;
}

[data-theme="dark"] .clinic-item-name,
.dark .clinic-item-name {
  color: #ffffff; /* Dark Mode: dark:text-white */
}

[data-theme="dark"] .clinic-item-tag,
.dark .clinic-item-tag {
  color: #2dd4bf; /* Teal-400 in Dark Mode for high contrast */
  background: rgba(45, 212, 191, 0.18);
  border-color: rgba(45, 212, 191, 0.35);
}

/* Tailwind utility mappings for theme compatibility */
.bg-slate-100 {
  background-color: #f1f5f9;
}
.bg-gray-50 {
  background-color: #f8fafc;
}
.text-gray-900 {
  color: #0f172a;
}

[data-theme="dark"] .dark\:bg-slate-700,
.dark .dark\:bg-slate-700 {
  background-color: #334155;
}

[data-theme="dark"] .dark\:text-white,
.dark .dark\:text-white {
  color: #ffffff;
}

/* ==========================================================================
   Clinic Finances & Global Expenses Dashboard
   ========================================================================== */
.finance-stats-grid {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

/* Large currency totals must shrink to fit the card instead of spilling out. */
.finance-stats-grid .stat-value {
  font-size: clamp(20px, 1.6vw, 28px);
}

.finance-chart-card,
.finance-ledger-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow-sm);
}

.expense-entry-form input[type="text"],
.expense-entry-form input[type="date"],
.expense-entry-form input[type="number"] {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  border-radius: var(--border-radius-sm);
  padding: 8px 12px;
  font-size: 13px;
}

.expense-entry-form input:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 2px rgba(14, 165, 233, 0.2);
}

.btn-delete-expense {
  background: transparent;
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #ef4444;
  padding: 4px 8px;
  border-radius: var(--border-radius-sm);
  cursor: pointer;
  font-size: 12px;
  transition: all 0.15s ease;
}

.btn-delete-expense:hover {
  background: rgba(239, 68, 68, 0.15);
  border-color: #ef4444;
}

/* ==========================================================================
   Clinic Locations Delete Button
   ========================================================================== */
.btn-delete-clinic {
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.22);
  cursor: pointer;
  font-size: 14px;
  padding: 4px 8px;
  border-radius: var(--border-radius-sm);
  color: #dc2626; /* High contrast red in Light Mode */
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.btn-delete-clinic:hover {
  background: rgba(239, 68, 68, 0.2);
  border-color: rgba(239, 68, 68, 0.45);
  color: #b91c1c;
  transform: scale(1.08);
}

[data-theme="dark"] .btn-delete-clinic,
.dark .btn-delete-clinic {
  background: rgba(239, 68, 68, 0.18);
  border-color: rgba(239, 68, 68, 0.35);
  color: #fca5a5; /* Bright red in Dark Mode for high contrast against dark slate */
}

[data-theme="dark"] .btn-delete-clinic:hover,
.dark .btn-delete-clinic:hover {
  background: rgba(239, 68, 68, 0.35);
  border-color: rgba(239, 68, 68, 0.6);
  color: #ffffff;
  transform: scale(1.08);
}

/* ==========================================================================
   Appointment Scheduler & Direct Calendar Sync
   ========================================================================== */
.appointment-scheduler-container {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.appointment-form-card,
.appointment-list-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-lg);
  padding: 20px;
}

.patient-appts-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.appointment-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  padding: 16px;
  background: var(--bg-card-hover, rgba(255, 255, 255, 0.03));
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-md);
  transition: all 0.2s ease;
}

.appointment-card:hover {
  border-color: var(--accent);
  box-shadow: 0 4px 6px -1px rgba(13, 148, 136, 0.1);
}

.appt-card-left {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  min-width: 250px;
}

.appt-datetime {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--text-primary);
}

.appt-date-icon {
  font-size: 16px;
}

.appt-duration {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}

.appt-procedure {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.appt-proc-badge {
  font-size: 12px;
  font-weight: 600;
  padding: 3px 10px;
  background: rgba(13, 148, 136, 0.12);
  color: var(--accent);
  border-radius: 9999px;
  border: 1px solid rgba(13, 148, 136, 0.25);
}

.appt-notes {
  font-size: 12px;
  color: var(--text-secondary);
  font-style: italic;
}

.appt-card-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.btn-google-sync,
.btn-google-cal {
  background: rgba(66, 133, 244, 0.15);
  border: 1px solid rgba(66, 133, 244, 0.4);
  color: #3b82f6;
  font-size: 12px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: var(--border-radius-sm);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-google-sync:hover,
.btn-google-cal:hover {
  background: rgba(66, 133, 244, 0.25);
  border-color: #3b82f6;
  color: #60a5fa;
  transform: translateY(-1px);
}

.btn-download-ics {
  background: rgba(16, 185, 129, 0.1);
  border-color: rgba(16, 185, 129, 0.4);
  color: #10b981;
  font-size: 12px;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: var(--border-radius-sm);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-download-ics:hover {
  background: rgba(16, 185, 129, 0.2);
  border-color: #10b981;
  color: #34d399;
}

.btn-whatsapp {
  background: rgba(37, 211, 102, 0.15);
  border: 1px solid rgba(37, 211, 102, 0.45);
  color: #15803d;
  font-size: 12px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: var(--border-radius-sm);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
}

[data-theme="dark"] .btn-whatsapp {
  background: rgba(37, 211, 102, 0.2);
  border-color: rgba(37, 211, 102, 0.6);
  color: #4ade80;
}

.btn-whatsapp:hover {
  background: #25D366;
  border-color: #20ba5a;
  color: #ffffff !important;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(37, 211, 102, 0.35);
}

.btn-delete-appt {
  padding: 6px 10px;
  font-size: 12px;
}

/* Toggle Switch Controls */
.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  margin: 0;
  vertical-align: middle;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.switch-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--border-color, #475569);
  transition: all 0.25s ease;
  border-radius: 24px;
}

.switch-slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: #ffffff;
  transition: all 0.25s ease;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}

.switch input:checked + .switch-slider {
  background-color: #10b981;
}

.switch input:checked + .switch-slider:before {
  transform: translateX(20px);
}

/* ==========================================================================
   Dashboard Upcoming Appointments Widget
   ========================================================================== */
.upcoming-appointments-section {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-lg);
  padding: 20px;
}

.upcoming-appts-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.upcoming-appt-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: var(--bg-card-hover, rgba(255, 255, 255, 0.02));
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-md);
  gap: 12px;
  transition: all 0.15s ease;
}

.upcoming-appt-card:hover {
  border-color: var(--accent);
  background: rgba(13, 148, 136, 0.05);
}

.upcoming-appt-left {
  display: flex;
  align-items: center;
  gap: 14px;
  flex: 1;
}

.upcoming-appt-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.upcoming-appt-badge.today {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.upcoming-appt-badge.tomorrow {
  background: rgba(245, 158, 11, 0.15);
  color: #f59e0b;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.upcoming-appt-badge.future {
  background: rgba(13, 148, 136, 0.12);
  color: var(--accent);
  border: 1px solid rgba(13, 148, 136, 0.25);
}

.upcoming-appt-details {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.upcoming-appt-patient {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.upcoming-appt-meta {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.upcoming-appt-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ========== Clinical Auth Lock Screen ========== */
.auth-screen-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: var(--bg-primary, #f8fafc);
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  overflow-y: auto;
}

.auth-card {
  width: 100%;
  max-width: 440px;
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 10px 25px -5px rgba(15, 23, 42, 0.08), 0 8px 10px -6px rgba(15, 23, 42, 0.06);
  border: 1px solid #e2e8f0;
  padding: 36px 32px;
  animation: fadeIn 0.3s ease;
}

.auth-header {
  text-align: center;
  margin-bottom: 24px;
}

.auth-logo {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 7px;
  margin-bottom: 14px;
}

.auth-brand-logo {
  height: 88px;
  width: auto;
  max-width: 260px;
  object-fit: contain;
  display: block;
}

.auth-brand-tagline {
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.3em;
  color: #64748b;
  white-space: nowrap;
}

.auth-logo-icon {
  font-size: 28px;
}

.auth-logo-text {
  font-size: 24px;
  font-weight: 800;
  color: #1e293b;
  letter-spacing: -0.02em;
}

.auth-title {
  font-size: 18px;
  font-weight: 700;
  color: #1e293b;
  margin-bottom: 6px;
}

.auth-subtitle {
  font-size: 13px;
  color: #64748b;
  line-height: 1.4;
}

.auth-hardware-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 12px;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-size: 11.5px;
  color: #475569;
  margin-bottom: 20px;
}

.auth-hardware-badge code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-weight: 700;
  color: #0d9488;
}

.auth-alert {
  padding: 12px 14px;
  border-radius: 8px;
  margin-bottom: 18px;
  font-size: 12.5px;
  line-height: 1.4;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.auth-alert-error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #991b1b;
}

.auth-alert-success {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  color: #166534;
}

.auth-form .form-group {
  margin-bottom: 16px;
}

.auth-form label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: #475569;
  margin-bottom: 6px;
}

.auth-form .form-input {
  width: 100%;
  padding: 11px 14px;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #1e293b;
  font-size: 13.5px;
  transition: all 0.2s;
  outline: none;
}

.auth-form .form-input:focus {
  border-color: #0d9488;
  box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.2);
}

.btn-auth-submit {
  width: 100%;
  padding: 12px;
  font-size: 14px;
  font-weight: 600;
  justify-content: center;
  margin-top: 8px;
  background: #0d9488;
  color: #ffffff;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 2px 4px rgba(13, 148, 136, 0.2);
}

.btn-auth-submit:hover:not(:disabled) {
  background: #0f766e;
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(13, 148, 136, 0.25);
}

.btn-auth-submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.auth-footer {
  margin-top: 24px;
  text-align: center;
  border-top: 1px solid #f1f5f9;
  padding-top: 16px;
}

.auth-footer-text {
  font-size: 11.5px;
  color: #94a3b8;
}

/* ==========================================================================
   Patient Timeline Tab (Chronological Intraoral Progression)
   ========================================================================== */
.timeline-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-lg);
  padding: 16px 20px;
  margin-bottom: 24px;
}

.timeline-title-area h2 {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 4px 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.timeline-subtitle {
  font-size: 12.5px;
  color: var(--text-muted);
  margin: 0;
}

.timeline-toggle-group {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.timeline-toggle-label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-secondary);
}

.timeline-segmented-btn-group {
  display: inline-flex;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 3px;
  gap: 4px;
}

.timeline-toggle-btn {
  background: transparent;
  border: none;
  border-radius: 6px;
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
}

.timeline-toggle-btn:hover {
  color: var(--text-primary);
}

.timeline-toggle-btn.active {
  background: var(--accent);
  color: #ffffff;
  box-shadow: 0 1px 3px rgba(13, 148, 136, 0.3);
}

.timeline-feed {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.timeline-visit-row {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-lg);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.2s ease;
}

.timeline-visit-row:hover {
  border-color: rgba(13, 148, 136, 0.35);
}

.timeline-visit-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-color);
}

.timeline-visit-title-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.timeline-visit-badge {
  font-size: 12px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 6px;
  background: rgba(13, 148, 136, 0.12);
  color: var(--accent);
  border: 1px solid rgba(13, 148, 136, 0.25);
  letter-spacing: 0.02em;
}

.timeline-visit-badge.t0 {
  background: rgba(59, 130, 246, 0.12);
  color: #2563eb;
  border-color: rgba(59, 130, 246, 0.25);
}

.timeline-visit-date {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.timeline-visit-archwire {
  font-size: 11.5px;
  padding: 3px 8px;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  color: var(--text-muted);
}

.timeline-visit-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.timeline-visit-procedures {
  max-width: 380px;
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
}

.timeline-collapse-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  flex: 0 0 auto;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--bg-primary);
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.timeline-collapse-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(13, 148, 136, 0.08);
}

.timeline-collapse-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.timeline-visit-row.is-collapsed .timeline-grid {
  display: none;
}

.timeline-visit-row.is-collapsed .timeline-visit-header {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom-color: transparent;
}

.timeline-grid {
  display: grid;
  gap: 14px;
  width: 100%;
}

.timeline-grid.views-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.timeline-grid.views-5 {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

@media (max-width: 960px) {
  .timeline-grid.views-5 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .timeline-grid.views-3,
  .timeline-grid.views-5 {
    grid-template-columns: 1fr;
  }
}

.timeline-slot-container {
  display: flex;
  flex-direction: column;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-md);
  overflow: hidden;
  transition: all 0.2s ease;
}

.timeline-slot-container:hover {
  border-color: var(--accent);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.timeline-slot-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 10px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
}

.timeline-slot-viewport {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: #0f172a;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.timeline-slot-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  transition: transform 0.2s ease, opacity 0.2s ease;
  user-select: none;
}

.timeline-slot-viewport:hover .timeline-slot-img {
  filter: brightness(1.06);
}

.timeline-slot-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: #64748b;
  text-align: center;
  padding: 12px;
  user-select: none;
}

.timeline-slot-placeholder-icon {
  font-size: 26px;
  opacity: 0.5;
}

.timeline-slot-placeholder-text {
  font-size: 11px;
  font-weight: 500;
  opacity: 0.7;
}

.timeline-zoom-hint {
  position: absolute;
  bottom: 6px;
  right: 6px;
  background: rgba(15, 23, 42, 0.75);
  color: #f8fafc;
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.timeline-slot-viewport:hover .timeline-zoom-hint {
  opacity: 1;
}

/* Lightbox Modal */
.lightbox-modal {
  max-width: 900px;
  width: 92vw;
  background: var(--bg-card);
}

.lightbox-modal-body {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
  background: #0b0f19;
  border-radius: 8px;
  min-height: 380px;
  max-height: 75vh;
  overflow: hidden;
}

.lightbox-image-wrap {
  position: relative;
  max-width: 100%;
  max-height: 70vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.lightbox-image-wrap img {
  max-width: 100%;
  max-height: 70vh;
  object-fit: contain;
  border-radius: 4px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}

/* ========================================================
   Multi-Currency Accounting & Clinic Finances Dashboard
   ======================================================== */
.multi-currency-summary-container {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin-bottom: 24px;
}

.currency-ledger-block {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-lg, 12px);
  padding: 20px 24px;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition-speed), box-shadow var(--transition-speed);
}

.currency-ledger-block:hover {
  box-shadow: var(--shadow);
}

.currency-ledger-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-color);
}

.currency-ledger-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.currency-tag-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(14, 165, 233, 0.15);
  color: #0284c7;
  border: 1px solid rgba(14, 165, 233, 0.3);
  padding: 4px 12px;
  border-radius: 20px;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.5px;
}

[data-theme="dark"] .currency-tag-pill {
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.15);
  border-color: rgba(56, 189, 248, 0.3);
}

.currency-ledger-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
}

.currency-net-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
}

.currency-net-badge.positive {
  background: rgba(16, 185, 129, 0.12);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.currency-net-badge.negative {
  background: rgba(239, 68, 68, 0.12);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.currency-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.curr-stat-box {
  background: var(--bg-tertiary, rgba(0, 0, 0, 0.03));
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius, 8px);
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  transition: all var(--transition-speed);
}

.curr-stat-box:hover {
  background: var(--bg-secondary);
}

.curr-stat-icon {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}

.curr-stat-details {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.curr-stat-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
  margin-bottom: 2px;
}

.curr-stat-value {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.curr-stat-sub {
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* Badge in table */
.badge-currency-cell {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  font-family: monospace;
  background: rgba(14, 165, 233, 0.12);
  color: #0284c7;
  border: 1px solid rgba(14, 165, 233, 0.25);
}

[data-theme="dark"] .badge-currency-cell {
  background: rgba(56, 189, 248, 0.15);
  color: #38bdf8;
  border-color: rgba(56, 189, 248, 0.3);
}

/* Chart Currency Filter Pills */
.chart-currency-pills {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.chart-currency-pill {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 5px 14px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-speed);
}

.chart-currency-pill:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border-color: var(--accent);
}

.chart-currency-pill.active {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
  box-shadow: 0 2px 6px rgba(13, 148, 136, 0.3);
}

/* ==========================================================================
   Aesthetic Utility Tokens
   ========================================================================== */
.px-2\.5 {
  padding-left: 10px !important;
  padding-right: 10px !important;
}
.py-0\.5 {
  padding-top: 2px !important;
  padding-bottom: 2px !important;
}
.rounded-full {
  border-radius: 9999px !important;
}
.rounded-md {
  border-radius: 6px !important;
}
.text-xs {
  font-size: 12px !important;
  line-height: 1.25rem !important;
}
.font-medium {
  font-weight: 500 !important;
}
.font-semibold {
  font-weight: 600 !important;
}
.bg-teal-50 {
  background-color: #f0fdfa !important;
}
.text-teal-700 {
  color: #0f766e !important;
}
.text-gray-500 {
  color: #64748b !important;
}
[data-theme="dark"] .text-gray-500,
.dark .text-gray-500 {
  color: #94a3b8 !important;
}
.text-gray-900 {
  color: #0f172a !important;
}
[data-theme="dark"] .text-gray-900,
.dark .text-gray-900 {
  color: #f8fafc !important;
}

/* Watermark & Photo Layout Utilities */
.relative { position: relative !important; }
.w-full { width: 100% !important; }
.h-full { height: 100% !important; }
.min-h-\[200px\] { min-height: 200px !important; }
.flex { display: flex !important; }
.items-center { align-items: center !important; }
.justify-center { justify-content: center !important; }
.object-contain { object-fit: contain !important; }
.absolute { position: absolute !important; }
.bottom-2 { bottom: 0.5rem !important; }
.right-2 { right: 0.5rem !important; }
.w-16 { width: 4rem !important; }
.h-auto { height: auto !important; }
.opacity-70 { opacity: 0.7 !important; }
.pointer-events-none { pointer-events: none !important; }
.z-10 { z-index: 10 !important; }

/* ========== Seamless Windows Titlebar Strip ========== */
.app-window-titlebar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 38px;
  background: #0B0F17;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  align-items: center;
  z-index: 99999;
  user-select: none;
  -webkit-app-region: drag;
  padding-right: 140px; /* Space reserved for native Windows control overlay */
}

.app-window-titlebar .no-drag,
.app-window-titlebar button,
.app-window-titlebar input {
  -webkit-app-region: no-drag;
}

.titlebar-drag-area {
  display: flex;
  align-items: center;
  padding-left: 16px;
  height: 100%;
  width: 100%;
}

.titlebar-brand-lockup {
  display: flex;
  align-items: center;
  gap: 8px;
}

.titlebar-mini-icon {
  width: 18px;
  height: 18px;
  object-fit: contain;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.45));
}

.titlebar-clinic-title {
  font-size: 12px;
  font-weight: 600;
  color: #94A3B8;
  letter-spacing: 0.02em;
}

.titlebar-clinic-tag {
  font-size: 10px;
  font-weight: 500;
  color: #0EA5E9;
  background: rgba(14, 165, 233, 0.12);
  border: 1px solid rgba(14, 165, 233, 0.25);
  padding: 1px 6px;
  border-radius: 4px;
  margin-left: 4px;
}

/* Electron Windows Layout Adjustments */
body.is-electron .sidebar {
  top: 38px !important;
  height: calc(100vh - 38px) !important;
}

body.is-electron .main-content {
  margin-top: 38px;
  height: calc(100vh - 38px);
}

body.is-electron #authScreen {
  top: 38px !important;
  height: calc(100vh - 38px) !important;
}

body:not(.is-electron) .app-window-titlebar {
  display: none;
}

/* ========== Dual Archwire (Upper & Lower) Clinical UI ========== */
.archwires-dual-container {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 16px;
}

.archwire-header-flex {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.archwire-main-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: 0.01em;
  margin: 0;
}

.btn-copy-archwire {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 500;
  color: #0EA5E9;
  background: rgba(14, 165, 233, 0.08);
  border: 1px solid rgba(14, 165, 233, 0.2);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-copy-archwire:hover {
  background: rgba(14, 165, 233, 0.16);
  border-color: rgba(14, 165, 233, 0.4);
  color: #38BDF8;
}

.archwire-grid-dual {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

@media (max-width: 640px) {
  .archwire-grid-dual {
    grid-template-columns: 1fr;
  }
}

.archwire-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.archwire-card-header {
  display: flex;
  align-items: center;
}

.archwire-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  letter-spacing: 0.02em;
}

.archwire-badge-u {
  color: #38BDF8;
  background: rgba(14, 165, 233, 0.1);
  border: 1px solid rgba(14, 165, 233, 0.25);
}

.archwire-badge-l {
  color: #FBBF24;
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.25);
}

/* Archwire display pills in table */
.arch-tag-group {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.arch-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 500;
}

.arch-pill-u {
  color: #38BDF8;
}

.arch-pill-l {
  color: #FBBF24;
}

.arch-pill-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 4px;
  border-radius: 3px;
  line-height: 1;
}

.arch-pill-badge-u {
  background: rgba(14, 165, 233, 0.2);
  color: #38BDF8;
}

.arch-pill-badge-l {
  background: rgba(245, 158, 11, 0.2);
  color: #FBBF24;
}

/* ==========================================================================
   App Update System & Admin Release Publisher (Zero-Lag Certified)
   ========================================================================== */

.sidebar-version-pill {
  border-radius: 6px;
  margin: 4px 8px 2px;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: transform, box-shadow;
}

.sidebar-version-pill:hover {
  color: #f1f5f9 !important;
  background: rgba(255, 255, 255, 0.06);
}

.sidebar-version-pill.has-update {
  background: rgba(16, 185, 129, 0.12) !important;
  border: 1px solid rgba(16, 185, 129, 0.4) !important;
  color: #34d399 !important;
  padding: 6px 8px !important;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 0 12px rgba(16, 185, 129, 0.2);
  animation: pulse-update-pill 3s infinite ease-in-out;
}

@keyframes pulse-update-pill {
  0%, 100% {
    box-shadow: 0 0 4px rgba(16, 185, 129, 0.2);
    border-color: rgba(16, 185, 129, 0.35);
  }
  50% {
    box-shadow: 0 0 14px rgba(16, 185, 129, 0.45);
    border-color: rgba(16, 185, 129, 0.75);
  }
}

.update-badge-glow {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: #34d399;
  font-weight: 700;
}

.update-badge-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: #10b981;
  display: inline-block;
  box-shadow: 0 0 6px #10b981;
}

.release-publisher-section input:focus,
.release-publisher-section textarea:focus {
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 2px rgba(14, 165, 233, 0.2) !important;
  outline: none;
}

/* ========================================================
   What's New in v1.0.5 Feature Announcement Modal
   ======================================================== */
.whats-new-modal {
  background: var(--bg-secondary) !important;
  color: var(--text-primary);
  border-radius: 14px;
  animation: whatsNewModalIn 0.28s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes whatsNewModalIn {
  from {
    opacity: 0;
    transform: scale(0.96) translateY(8px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.whats-new-card {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 16px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.whats-new-card:hover {
  transform: translateY(-2px);
  border-color: rgba(20, 184, 166, 0.45);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
}

.whats-new-card-icon {
  width: 40px;
  height: 40px;
  min-width: 40px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.whats-new-card-content {
  flex: 1;
  min-width: 0;
}

.whats-new-card-title {
  margin: 0 0 5px 0;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.whats-new-card-desc {
  margin: 0;
  font-size: 12px;
  line-height: 1.45;
  color: var(--text-secondary);
}

#sidebarAppVersion:hover {
  color: var(--accent) !important;
  background: rgba(20, 184, 166, 0.08);
  border-radius: 6px;
}

/* ========================================================
   Global In-App Update Notification Banner (Anti-Lag, Luxury)
   ======================================================== */
.app-update-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 20px;
  margin: 12px 16px 16px;
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.95) 0%, rgba(30, 41, 59, 0.95) 100%);
  border: 1px solid rgba(20, 184, 166, 0.45);
  border-radius: 10px;
  box-shadow: 0 8px 24px -4px rgba(0, 0, 0, 0.4), 0 0 16px rgba(20, 184, 166, 0.2);
  animation: bannerSlideDown 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  z-index: 100;
  flex-wrap: wrap;
}

@keyframes bannerSlideDown {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.update-banner-left {
  display: flex;
  align-items: center;
  gap: 14px;
  flex: 1;
  min-width: 260px;
}

.update-banner-icon-pulse {
  font-size: 24px;
  line-height: 1;
  animation: rocketBob 2.5s infinite ease-in-out;
}

@keyframes rocketBob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-3px) scale(1.08); }
}

.update-banner-text {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.update-banner-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  font-weight: 700;
  color: #f8fafc;
}

.update-banner-version-badge {
  background: rgba(20, 184, 166, 0.2);
  border: 1px solid rgba(20, 184, 166, 0.5);
  color: #2dd4bf;
  font-size: 11px;
  font-weight: 700;
  padding: 1px 8px;
  border-radius: 9999px;
  letter-spacing: 0.02em;
}

.update-banner-desc {
  font-size: 12px;
  color: #94a3b8;
  line-height: 1.4;
}

.update-banner-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.btn-banner-close {
  background: transparent;
  border: none;
  color: #64748b;
  font-size: 16px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: all 0.15s ease;
  line-height: 1;
}

.btn-banner-close:hover {
  color: #f1f5f9;
  background: rgba(255, 255, 255, 0.08);
}









/* ========== Toggle Switch (settings) ========== */
.toggle-switch input:checked + .toggle-slider {
  background: var(--accent);
  border-color: var(--accent);
}

.toggle-slider::before {
  content: "";
  position: absolute;
  height: 18px;
  width: 18px;
  left: 2px;
  bottom: 2px;
  background: #FFFFFF;
  border-radius: 50%;
  transition: transform .2s ease;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.25);
}

.toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(18px);
}

.toggle-switch input:focus-visible + .toggle-slider {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ========== Calendar Tab ========== */
.calendar-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 18px;
  align-items: start;
}

@media (max-width: 1180px) {
  .calendar-layout { grid-template-columns: minmax(0, 1fr); }
}

.calendar-shell {
  position: relative;
  padding: 18px;
  border-radius: 18px;
  border: 1px solid var(--border-color);
  background:
    radial-gradient(1200px 240px at 12% -10%, rgba(20, 184, 166, 0.10), transparent 70%),
    var(--bg-card);
  box-shadow: 0 18px 40px -28px rgba(15, 23, 42, 0.55);
  overflow: hidden;
}

.calendar-nav-group {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px;
  border-radius: 12px;
  border: 1px solid var(--border-color);
  background: var(--bg-secondary);
}

.cal-nav-btn {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  border: none;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  color: var(--text-secondary);
  background: transparent;
  transition: background 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.cal-nav-btn:hover {
  background: var(--accent);
  color: #FFFFFF;
  transform: translateY(-1px);
}

.calendar-month-label {
  min-width: 132px;
  text-align: center;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.01em;
  color: var(--text-primary);
}

.calendar-summary {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.cal-stat {
  flex: 1 1 130px;
  min-width: 120px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border-color);
  background: var(--bg-secondary);
}

.cal-stat-value {
  font-size: 18px;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.1;
}

.cal-stat-label {
  margin-top: 2px;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  font-weight: 700;
}

.calendar-weekdays {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 8px;
}

.calendar-weekdays span {
  text-align: center;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
}

.cal-day {
  position: relative;
  min-height: 74px;
  padding: 8px;
  border-radius: 14px;
  border: 1px solid transparent;
  background: var(--bg-secondary);
  cursor: pointer;
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease, background 0.16s ease;
  display: flex;
  flex-direction: column;
  gap: 4px;
  text-align: left;
}

.cal-day:hover {
  transform: translateY(-2px);
  border-color: rgba(20, 184, 166, 0.45);
  box-shadow: 0 12px 22px -18px rgba(13, 148, 136, 0.75);
}

.cal-day.other-month { opacity: 0.4; }

.cal-day.today {
  border-color: rgba(20, 184, 166, 0.65);
  box-shadow: inset 0 0 0 1px rgba(20, 184, 166, 0.25);
}

.cal-day.selected {
  background: linear-gradient(150deg, #14B8A6 0%, #0D9488 55%, #0F766E 100%);
  border-color: transparent;
  box-shadow: 0 16px 30px -18px rgba(13, 148, 136, 0.9);
  transform: translateY(-2px);
}

.cal-day.selected .cal-day-number,
.cal-day.selected .cal-day-count { color: #FFFFFF; }

.cal-day.selected .cal-day-pill {
  background: rgba(255, 255, 255, 0.22);
  color: #FFFFFF;
}

.cal-day-number {
  font-size: 12.5px;
  font-weight: 800;
  color: var(--text-primary);
}

.cal-day-pill {
  font-size: 9.5px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(13, 148, 136, 0.14);
  color: var(--accent);
  align-self: flex-start;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cal-day-dots {
  display: flex;
  gap: 3px;
  margin-top: auto;
}

.cal-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
}

.cal-day.selected .cal-dot { background: #FFFFFF; }

.calendar-agenda {
  position: sticky;
  top: 16px;
  border: 1px solid var(--border-color);
  border-radius: 18px;
  background: var(--bg-card);
  box-shadow: 0 18px 40px -30px rgba(15, 23, 42, 0.6);
  overflow: hidden;
}

.agenda-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  padding: 16px;
  border-bottom: 1px solid var(--border-color);
  background:
    radial-gradient(600px 120px at 0% 0%, rgba(20, 184, 166, 0.12), transparent 70%),
    var(--bg-secondary);
}

.agenda-date {
  font-size: 14px;
  font-weight: 800;
  color: var(--text-primary);
}

.agenda-sub {
  margin-top: 2px;
  font-size: 11px;
  color: var(--text-muted);
}

.agenda-list {
  max-height: 520px;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.agenda-empty {
  padding: 22px 12px;
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
}

.agenda-item {
  display: flex;
  gap: 10px;
  padding: 10px;
  border-radius: 12px;
  border: 1px solid var(--border-color);
  background: var(--bg-secondary);
  transition: border-color 0.16s ease, transform 0.16s ease;
}

.agenda-item:hover {
  border-color: rgba(20, 184, 166, 0.45);
  transform: translateX(2px);
}

.agenda-time {
  flex-shrink: 0;
  padding: 3px 7px;
  height: fit-content;
  border-radius: 8px;
  font-size: 10.5px;
  font-weight: 800;
  color: var(--accent);
  background: rgba(13, 148, 136, 0.12);
}

.agenda-name {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-primary);
}

.agenda-proc {
  margin-top: 1px;
  font-size: 11px;
  color: var(--text-secondary);
}

.agenda-meta {
  margin-top: 3px;
  font-size: 10px;
  color: var(--text-muted);
}

/* ---- Schedule Visit modal ---- */
.calendar-modal { max-width: 560px; width: 94%; }

.calendar-modal .modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.calendar-modal .modal-title { margin: 0; font-size: 17px; }

.modal-subtitle {
  margin: 3px 0 0;
  font-size: 11.5px;
  color: var(--text-muted);
}

.calendar-modal-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 66vh;
  overflow-y: auto;
  padding-right: 2px;
}

.cal-field-row {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr;
  gap: 10px;
  margin-top: 6px;
}

.cal-field { display: flex; flex-direction: column; gap: 4px; }

.cal-field-label {
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-top: 6px;
}

.cal-required { color: #ef4444; }

.cal-selected-patient {
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid rgba(20, 184, 166, 0.45);
  background: rgba(13, 148, 136, 0.10);
  font-size: 12px;
  font-weight: 700;
  color: var(--text-primary);
}

.cal-patient-results {
  max-height: 168px;
  overflow-y: auto;
  border: 1px solid var(--border-color);
  border-radius: 10px;
  background: var(--bg-secondary);
}

.cal-patient-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  cursor: pointer;
  border-bottom: 1px solid var(--border-color);
  transition: background 0.15s ease;
}

.cal-patient-row:last-child { border-bottom: none; }

.cal-patient-row:hover { background: rgba(13, 148, 136, 0.10); }

.cal-patient-row .cp-name { font-size: 12px; font-weight: 700; color: var(--text-primary); }
.cal-patient-row .cp-code { font-size: 10.5px; color: var(--text-muted); }
.cal-patient-row .cp-clinic { font-size: 10.5px; color: var(--text-secondary); }

.cal-patient-empty {
  padding: 14px 10px;
  text-align: center;
  font-size: 11.5px;
  color: var(--text-muted);
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 14px;
  margin-top: 12px;
  border-top: 1px solid var(--border-color);
}

/* Calendar polish pass */
.calendar-shell::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(20, 184, 166, 0.85), rgba(13, 148, 136, 0.15), transparent);
  pointer-events: none;
}

.cal-day {
  min-height: 82px;
  background-image: linear-gradient(180deg, rgba(255, 255, 255, 0.55), rgba(255, 255, 255, 0));
}

[data-theme="dark"] .cal-day {
  background-image: linear-gradient(180deg, rgba(148, 163, 184, 0.07), rgba(148, 163, 184, 0));
}

.cal-day.selected {
  background-image: linear-gradient(150deg, #14B8A6 0%, #0D9488 55%, #0F766E 100%);
}

.cal-day-number {
  font-size: 13px;
  letter-spacing: -0.01em;
}

.calendar-weekdays span:nth-child(6),
.calendar-weekdays span:nth-child(7) {
  color: rgba(13, 148, 136, 0.75);
}

.agenda-item {
  border-left: 3px solid transparent;
}

.agenda-item:hover {
  border-left-color: var(--accent);
}

.agenda-date {
  line-height: 1.25;
}

.cal-day {
  font-family: inherit;
}

/* ========== Missed appointments ========== */
.appointment-card-missed {
  border-color: rgba(239, 68, 68, 0.45) !important;
  background: rgba(239, 68, 68, 0.05) !important;
}

.appt-missed-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #B91C1C;
  background: rgba(239, 68, 68, 0.14);
  border: 1px solid rgba(239, 68, 68, 0.35);
}

[data-theme="dark"] .appt-missed-badge {
  color: #FCA5A5;
  background: rgba(239, 68, 68, 0.2);
}

.agenda-item-missed {
  border-color: rgba(239, 68, 68, 0.4) !important;
  background: rgba(239, 68, 68, 0.06) !important;
}

.agenda-missed-tag {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  border-radius: 999px;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #B91C1C;
  background: rgba(239, 68, 68, 0.15);
}

[data-theme="dark"] .agenda-missed-tag {
  color: #FCA5A5;
}

.agenda-actions {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex-shrink: 0;
}

.agenda-btn {
  width: 26px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 7px;
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.agenda-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.agenda-btn-delete:hover {
  border-color: #ef4444;
  color: #ef4444;
  background: rgba(239, 68, 68, 0.08);
}

.agenda-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ========== Clinical alerts & oral hygiene ========== */
.patient-alert-row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
}

.patient-alert {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 0.03em;
  white-space: nowrap;
  border: 1px solid transparent;
}

.patient-alert-hygiene {
  color: #B45309;
  background: rgba(245, 158, 11, 0.14);
  border-color: rgba(245, 158, 11, 0.4);
}

.patient-alert-debond {
  color: #B91C1C;
  background: rgba(239, 68, 68, 0.13);
  border-color: rgba(239, 68, 68, 0.38);
}

.patient-alert-missed {
  color: #9F1239;
  background: rgba(244, 63, 94, 0.13);
  border-color: rgba(244, 63, 94, 0.42);
}

[data-theme="dark"] .patient-alert-hygiene { color: #FCD34D; }
[data-theme="dark"] .patient-alert-debond { color: #FCA5A5; }
[data-theme="dark"] .patient-alert-missed { color: #FDA4AF; }

.hygiene-good { color: #15803D; font-weight: 700; }
.hygiene-fair { color: #B45309; font-weight: 700; }
.hygiene-bad  { color: #B91C1C; font-weight: 800; }

[data-theme="dark"] .hygiene-good { color: #4ADE80; }
[data-theme="dark"] .hygiene-fair { color: #FCD34D; }
[data-theme="dark"] .hygiene-bad  { color: #FCA5A5; }

.visit-hygiene {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  border-radius: 999px;
  font-size: 9px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: rgba(100, 116, 139, 0.14);
  color: var(--text-secondary);
}

.visit-hygiene.hygiene-good { background: rgba(34, 197, 94, 0.16); color: #15803D; }
.visit-hygiene.hygiene-fair { background: rgba(245, 158, 11, 0.18); color: #B45309; }
.visit-hygiene.hygiene-bad  { background: rgba(239, 68, 68, 0.16); color: #B91C1C; }

[data-theme="dark"] .visit-hygiene.hygiene-good { color: #4ADE80; }
[data-theme="dark"] .visit-hygiene.hygiene-fair { color: #FCD34D; }
[data-theme="dark"] .visit-hygiene.hygiene-bad  { color: #FCA5A5; }

/* ========== Login keyboard-language warning ========== */
.auth-keyboard-warning {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  margin-top: 8px;
  padding: 9px 11px;
  border-radius: 9px;
  border: 1px solid rgba(245, 158, 11, 0.5);
  background: rgba(245, 158, 11, 0.12);
  color: #92400E;
  font-size: 11.5px;
  line-height: 1.45;
}

.auth-keyboard-warning-icon { font-size: 14px; line-height: 1.1; }

.auth-keyboard-warning kbd {
  display: inline-block;
  padding: 0 4px;
  border-radius: 4px;
  border: 1px solid rgba(146, 64, 14, 0.35);
  background: rgba(255, 255, 255, 0.55);
  font-family: inherit;
  font-size: 10.5px;
  font-weight: 700;
}

.auth-keyboard-warning.is-ar {
  border-color: rgba(239, 68, 68, 0.55);
  background: rgba(239, 68, 68, 0.12);
  color: #991B1B;
}

[data-theme="dark"] .auth-keyboard-warning {
  color: #FCD34D;
  background: rgba(245, 158, 11, 0.16);
}

[data-theme="dark"] .auth-keyboard-warning kbd {
  background: rgba(0, 0, 0, 0.25);
  border-color: rgba(252, 211, 77, 0.35);
}

/* ========== Inline clinical hints ========== */
.clinical-hint {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  margin-top: 6px;
  font-size: 10.5px;
  line-height: 1.45;
  color: var(--text-muted);
  font-weight: 500;
}

.clinical-hint-icon {
  flex-shrink: 0;
  font-size: 11px;
  line-height: 1.35;
}

.clinical-hint strong {
  color: var(--text-secondary);
  font-weight: 700;
}

.odontogram-hint {
  margin: 0 0 14px;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px dashed var(--border-color);
  background: var(--bg-secondary);
}

.patient-alert-row { align-items: flex-start; }
.patient-alert { align-self: flex-start; }

/* Final visit marker */
.visit-final-badge {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #0F766E;
  background: rgba(13, 148, 136, 0.16);
  border: 1px solid rgba(13, 148, 136, 0.4);
}

[data-theme="dark"] .visit-final-badge { color: #5EEAD4; }

/* Treatment-stage marker on each visit row */
.visit-stage-badge {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: #475569;
  background: rgba(100, 116, 139, 0.16);
  border: 1px solid rgba(100, 116, 139, 0.32);
}

/* Keep the visit number, stage, hygiene and final badges on one line inside
   the virtualized 48 px row. */
#visitsTable th:first-child,
#visitsTable td:first-child { white-space: nowrap; }

.visit-stage-badge.visit-stage-t1 {
  color: #0F766E;
  background: rgba(13, 148, 136, 0.16);
  border-color: rgba(13, 148, 136, 0.4);
}

.visit-stage-badge.visit-stage-t2 {
  color: #B45309;
  background: rgba(245, 158, 11, 0.18);
  border-color: rgba(245, 158, 11, 0.4);
}

.visit-stage-badge.visit-stage-ret {
  color: #4338CA;
  background: rgba(99, 102, 241, 0.16);
  border-color: rgba(99, 102, 241, 0.4);
}

[data-theme="dark"] .visit-stage-badge { color: #CBD5E1; }
[data-theme="dark"] .visit-stage-badge.visit-stage-t1 { color: #5EEAD4; }
[data-theme="dark"] .visit-stage-badge.visit-stage-t2 { color: #FCD34D; }
[data-theme="dark"] .visit-stage-badge.visit-stage-ret { color: #A5B4FC; }

.btn-final-visit[data-visit-final="1"] {
  border-color: rgba(13, 148, 136, 0.5);
  color: #0F766E;
}

/* 3D tooth chart host (lazy iframe, created only while the tab is open) */
.chart3d-host { width: 100%; height: calc(100vh - 245px); min-height: 620px; }
.chart3d-host iframe { display: block; width: 100%; height: 100%; border: 0; border-radius: 16px; background: transparent; }


/* ==========================================================================
   Patient Care (Clinical Finance tab)
   ========================================================================== */
.pi-shell { display: flex; flex-direction: column; gap: 16px; }
.pi-hero {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
  padding: 22px 24px;
  border: 1px solid var(--border-color);
  border-radius: 16px;
  background:
    radial-gradient(circle at 0% 0%, rgba(13, 148, 136, 0.14), transparent 42%),
    var(--bg-card);
  box-shadow: var(--shadow-sm);
}
.pi-eyebrow {
  display: inline-block;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 6px;
}
.pi-hero h2 { margin: 0 0 6px; font-size: 22px; color: var(--text-primary); }
.pi-hero p { margin: 0; max-width: 660px; font-size: 13px; line-height: 1.6; color: var(--text-muted); }
.pi-patient-chip {
  flex: 0 0 auto;
  min-width: 190px;
  padding: 10px 14px;
  border: 1px solid var(--accent-ring);
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--text-primary);
  font-size: 12px;
  font-weight: 600;
  text-align: right;
}
.pi-chip-name { display: block; font-size: 13px; font-weight: 800; }
.pi-chip-id { display: block; margin-top: 2px; font-size: 10.5px; color: var(--text-muted); }

.pi-controls { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.pi-lang-wrap { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.pi-control-label { font-size: 10.5px; font-weight: 800; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-muted); }
.pi-lang {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--border-color);
  border-radius: 10px;
  background: var(--bg-tertiary);
}
.pi-lang button {
  border: 0;
  background: transparent;
  color: var(--text-muted);
  padding: 7px 12px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}
.pi-lang button.active { background: var(--bg-card); color: var(--accent); box-shadow: var(--shadow-sm); }

.pi-profile {
  border: 1px dashed var(--border-color);
  border-radius: 12px;
  padding: 12px 16px;
  background: var(--bg-tertiary);
}
.pi-profile summary { cursor: pointer; font-size: 12.5px; font-weight: 700; color: var(--text-secondary); }
.pi-profile-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-top: 12px; }
.pi-profile-grid label { display: flex; flex-direction: column; gap: 5px; font-size: 10.5px; font-weight: 700; color: var(--text-muted); }
.pi-profile-grid input {
  width: 100%;
  box-sizing: border-box;
  padding: 9px 11px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--bg-input);
  color: var(--text-primary);
  font-size: 12px;
  font-family: inherit;
}
.pi-hint { margin: 9px 0 0; font-size: 10.5px; line-height: 1.5; color: var(--text-muted); }

.pi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(255px, 1fr)); gap: 14px; }
.pi-group {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin: 6px 0 0;
  padding: 0 2px;
}
.pi-group:first-child { margin-top: 0; }
.pi-group-title { font-size: 12.5px; font-weight: 800; letter-spacing: 0.02em; color: var(--text-primary); }
.pi-group-count {
  min-width: 22px;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--accent-soft);
  border: 1px solid var(--accent-ring);
  color: var(--accent);
  font-size: 10.5px;
  font-weight: 800;
  text-align: center;
}
.pi-group-note { font-size: 11px; color: var(--text-muted); }
.pi-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 18px;
  border: 1px solid var(--border-color);
  border-radius: 14px;
  background: var(--bg-card);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}
.pi-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  background: linear-gradient(90deg, var(--pi-card-accent, #0d9488), transparent 85%);
}
.pi-card:hover { transform: translateY(-2px); border-color: var(--accent-ring); box-shadow: var(--shadow-md); }
.pi-card-top { display: flex; justify-content: space-between; align-items: center; }
.pi-card-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 11px;
  background: var(--pi-card-soft, var(--accent-soft));
  font-size: 20px;
  line-height: 1;
}
.pi-card-badge {
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--pi-card-accent, var(--accent));
  background: var(--pi-card-soft, var(--accent-soft));
  border: 1px solid var(--pi-card-accent, var(--accent-ring));
  border-radius: 999px;
  padding: 3px 8px;
}
.pi-card h3 { margin: 2px 0 0; font-size: 15px; line-height: 1.35; color: var(--text-primary); }
.pi-card-ar { font-size: 13px; font-weight: 600; color: var(--text-secondary); }
.pi-card p { flex: 1; margin: 0; font-size: 12px; line-height: 1.55; color: var(--text-muted); }
.pi-card-meta { font-size: 10px; font-weight: 600; letter-spacing: 0.02em; color: var(--text-muted); opacity: 0.85; }
.pi-card-actions { display: flex; gap: 8px; margin-top: 6px; }
.pi-card-actions .btn { flex: 1; justify-content: center; }
.pi-footnote {
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid var(--border-color);
  background: var(--bg-tertiary);
  font-size: 11px;
  line-height: 1.6;
  color: var(--text-muted);
}
.pi-empty { padding: 24px; text-align: center; color: var(--text-muted); }

/* PDF preview modal */
#piPreviewModal { padding: 12px; }
.pi-preview-modal {
  display: flex;
  flex-direction: column;
  width: min(1100px, 96vw);
  max-width: 1100px;
  max-height: 94vh;
  padding: 0;
  overflow: hidden;
}
#piPreviewModal .modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding: 16px 22px;
  border-bottom: 1px solid var(--border-color);
}
#piPreviewModal .modal-header h3 { margin: 0; }
#piPreviewModal .modal-header .badge {
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid var(--accent-ring);
}
.pi-preview-body { flex: 1; min-height: 0; overflow: auto; padding: 12px 14px; background: var(--bg-tertiary); }
.pi-preview-body iframe { display: block; width: 100%; height: 68vh; min-height: 420px; border: 0; border-radius: 8px; background: #ffffff; }
#piPreviewModal .modal-actions { padding: 14px 22px 18px; border-top: 1px solid var(--border-color); }

/* Referral report modal */
#referralModal { padding: 12px; }
.referral-modal {
  display: flex;
  flex-direction: column;
  width: min(900px, 96vw);
  max-width: 900px;
  max-height: 94vh;
  padding: 0;
  overflow: hidden;
}
#referralModal .modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding: 16px 22px;
  border-bottom: 1px solid var(--border-color);
}
#referralModal .modal-header h3 { margin: 0; }
#referralModal .modal-header .badge {
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid var(--accent-ring);
  max-width: 360px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.referral-body { flex: 1; min-height: 0; overflow-y: auto; padding: 18px 22px; }
.referral-intro { margin: 0 0 14px; font-size: 12.5px; line-height: 1.6; color: var(--text-muted); }
.referral-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; }
.referral-grid label, .referral-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.referral-grid input, .referral-grid select, .referral-field textarea {
  width: 100%;
  box-sizing: border-box;
  padding: 9px 11px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--bg-input);
  color: var(--text-primary);
  font-size: 12.5px;
  font-family: inherit;
  text-transform: none;
  letter-spacing: 0;
  font-weight: 500;
}
.referral-field { margin-top: 12px; }
.referral-field textarea { resize: vertical; min-height: 72px; line-height: 1.5; }
.referral-teeth-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; margin-top: 16px; }
.referral-section-title { font-size: 13px; font-weight: 800; color: var(--text-primary); }
.referral-hint { margin: 3px 0 0; font-size: 10.5px; line-height: 1.5; color: var(--text-muted); }
.referral-teeth-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.referral-teeth { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 10px; }
.referral-arch-title { font-size: 10px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-muted); margin-bottom: 5px; }
.referral-arch-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 5px; }
.referral-tooth {
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
  padding: 5px 6px;
  border: 1px solid var(--border-color);
  border-radius: 7px;
  background: var(--bg-tertiary);
  cursor: pointer;
  user-select: none;
}
.referral-tooth input { position: absolute; opacity: 0; pointer-events: none; }
.referral-tooth.is-selected { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent-ring); }
.rt-dot { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 auto; border: 1px solid rgba(15, 23, 42, 0.18); }
.rt-num { font-size: 11.5px; font-weight: 800; color: var(--text-primary); flex: 0 0 auto; }
.rt-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 9.5px; color: var(--text-muted); }
.referral-options { display: flex; gap: 18px; flex-wrap: wrap; margin-top: 12px; font-size: 12px; color: var(--text-secondary); }
.referral-options label { display: flex; align-items: center; gap: 7px; cursor: pointer; }
#referralModal .modal-actions { padding: 14px 22px 18px; border-top: 1px solid var(--border-color); }

@media (max-width: 900px) {
  .pi-profile-grid { grid-template-columns: 1fr; }
  .referral-grid { grid-template-columns: 1fr; }
  .referral-teeth { grid-template-columns: 1fr; }
  .pi-hero { flex-direction: column; }
  .pi-patient-chip { width: 100%; box-sizing: border-box; text-align: left; }
}
#referralExportBtn:disabled,
#piExportAll:disabled,
.pi-card-actions .btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  filter: saturate(0.6);
}
.pi-card-ar { text-align: right; }
.pi-page-actions { align-items: flex-start; flex-wrap: wrap; }
.pi-page-actions > .btn { margin-top: 18px; }
.pi-patient-select-wrap {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.pi-patient-select-wrap select {
  min-width: 300px;
  max-width: 460px;
  padding: 9px 12px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--bg-input);
  color: var(--text-primary);
  font-size: 12.5px;
  font-family: inherit;
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0;
}
.pi-clinic-select-wrap select { min-width: 190px; max-width: 260px; }
.pi-select-hint {
  min-height: 14px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
  color: var(--text-muted);
  opacity: 0.85;
}
@media (max-width: 900px) {
  .pi-patient-select-wrap select { min-width: 0; width: 100%; max-width: 100%; }
  .pi-page-actions { width: 100%; }
}

/* ===== Multi-Analysis Cephalometric Selector & Panels ===== */
.ceph-analysis-selector {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 8px;
  margin: 4px 0 14px;
}

.ceph-tab-analysis-selector .ceph-analysis-pill,
.ceph-analysis-selector.ceph-tab-analysis-selector .ceph-analysis-pill {
  margin: 0;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  border-radius: 999px;
  background: var(--bg-input);
  border-color: var(--border-color);
  color: var(--text-secondary);
}

.ceph-analysis-selector.ceph-tab-analysis-selector {
  gap: 8px;
  padding: 0;
  margin: 4px 0 14px;
}

/* The tab-side selector must NOT inherit the tracer HUD card box:
   ceph-tracer.css loads later and re-cards .ceph-analysis-selector, so pin
   the tab variant explicitly (two-class specificity wins regardless of order). */
.ceph-analysis-selector.ceph-tab-analysis-selector {
  background: transparent;
  border: none;
  padding: 0;
  border-radius: 0;
}

.ceph-analysis-selector.ceph-tab-analysis-selector .ceph-analysis-pill:hover {
  border-color: var(--accent);
  color: var(--text-primary);
}

.ceph-analysis-selector.ceph-tab-analysis-selector .ceph-analysis-pill.active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 700;
  box-shadow: 0 0 0 1px var(--accent);
}

.ceph-analysis-pill {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  line-height: 1.2;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.ceph-analysis-pill:hover {
  border-color: var(--accent);
  color: var(--text-primary);
}

.ceph-analysis-pill.active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 700;
  box-shadow: 0 0 0 1px var(--accent);
}

.ceph-analysis-context-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-muted);
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  padding: 6px 10px;
  margin-bottom: 10px;
}

.ceph-analysis-context-bar label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: var(--text-secondary);
}

.ceph-analysis-context-bar select {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  color: var(--text-primary);
  padding: 3px 6px;
  font-size: 12px;
  font-family: inherit;
}

.ceph-analysis-context-bar input {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  color: var(--text-primary);
  padding: 3px 6px;
  font-size: 12px;
  font-family: inherit;
}

.ceph-analysis-context-bar input:focus {
  border-color: var(--accent);
  outline: none;
}

.ceph-analysis-context-bar .ceph-analysis-hint {
  font-size: 11px;
  color: var(--text-muted);
}

.ceph-analysis-context-bar .ceph-analysis-hint.warn {
  color: var(--warning, #f59e0b);
}

.ceph-analysis-panel {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.ceph-analysis-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.ceph-analysis-panel-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
}

.ceph-analysis-citation {
  font-size: 11.5px;
  font-style: italic;
  color: var(--text-muted);
}

.ceph-analysis-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.ceph-analysis-chip {
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  background: var(--bg-input);
}

.ceph-analysis-chip.placed {
  border-color: rgba(16, 185, 129, 0.45);
  color: #10b981;
  background: rgba(16, 185, 129, 0.08);
}

.ceph-analysis-chip.pending {
  color: var(--text-muted);
  border-style: dashed;
}

.ceph-analysis-controls {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px;
}

.ceph-analysis-controls label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: var(--text-secondary);
}

.ceph-analysis-controls select {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  color: var(--text-primary);
  padding: 3px 6px;
  font-size: 12px;
  font-family: inherit;
}

.ceph-analysis-actions {
  display: flex;
  flex-direction: row;
  gap: 10px;
}

.ceph-analysis-launch {
  background: var(--accent);
  color: #fff;
  border: 1px solid transparent;
  border-radius: var(--border-radius-sm);
  padding: 9px 16px;
  font-size: 13px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.ceph-analysis-launch:hover {
  background: var(--accent-hover, var(--accent));
}

.ceph-analysis-summary-box {
  background: var(--bg-tertiary);
  border-left: 3px solid var(--accent);
  border-radius: var(--border-radius-sm);
  padding: 12px 14px;
}

.ceph-analysis-summary-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.ceph-analysis-summary-content {
  font-size: 13px;
  color: var(--text-primary);
  line-height: 1.5;
}

.ceph-analysis-empty {
  padding: 26px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
}

.ceph-analysis-panel .ceph-norms-table-wrap {
  overflow-x: auto;
}

/* ===== v1.5.1: Sticky patient-form save bar =====
   The Add/Edit Patient header pins beneath the sticky topbar (z-index 60) and
   above the tab rail (z-index 35), keeping Save/Cancel reachable mid-form.
   --bg-primary is a fully opaque canvas token in every direction
   (Porcelain #F3F1EB, Atrium #05080D, Noir #070708), so form fields can never
   bleed through the bar while scrolling; the backdrop blur only softens the
   bottom border edge. Direction tints are in ui-refresh.css, next to the
   Atrium/Noir token blocks. Do not raise this above the topbar (60) or below
   the tab rail (35). */
#page-add-patient > .page-header {
  position: sticky;
  top: var(--ui-topbar-h, 0px);
  z-index: 45;
  background: var(--bg-primary);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--ui-border, var(--border-color));
  box-shadow: 0 10px 28px -22px rgba(0, 0, 0, 0.45);
  padding: 12px 0;
}

/* Leave breathing room under the last form card. */
#page-add-patient {
  padding-bottom: 48px;
}
