/* ============================================
   RTC Referral System - High-End Design System
   Ant Design-inspired + FontAwesome Pro
   Perimeter Healthcare
   ============================================ */

/* Design Tokens */
:root {
  /* Primary - Perimeter brand */
  --primary: #0066CC;
  --primary-hover: #0052A3;
  --primary-active: #003D7A;
  --primary-light: #E6F2FF;
  --primary-bg: #F0F7FF;
  
  /* Secondary */
  --secondary: #003366;
  --secondary-light: #F0F2F5;
  
  /* Status Colors */
  --status-green: #28A745;
  --status-green-bg: #E6F4EA;
  --status-green-border: #B7E1CD;
  
  --status-yellow: #F59E0B; /* More amber/modern */
  --status-yellow-bg: #FEF3C7;
  --status-yellow-border: #FCD34D;
  
  --status-red: #DC2626;
  --status-red-bg: #FEE2E2;
  --status-red-border: #FECACA;

  --status-blue: #2563EB;
  --status-blue-bg: #DBEAFE;
  
  /* Domain colors */
  --domain-medical: #3B82F6;
  --domain-behavioral: #8B5CF6;
  --domain-functional: #10B981;
  
  /* Neutrals */
  --white: #FFFFFF;
  --gray-50: #F9FAFB;
  --gray-100: #F3F4F6;
  --gray-200: #E5E7EB;
  --gray-300: #D1D5DB;
  --gray-400: #9CA3AF;
  --gray-500: #6B7280;
  --gray-600: #4B5563;
  --gray-700: #374151;
  --gray-800: #1F2937;
  --gray-900: #111827;
  
  /* Spacing (8px base) */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-xxl: 48px;
  
  /* Typography */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-size-xs: 12px;
  --font-size-sm: 14px;
  --font-size-md: 16px;
  --font-size-lg: 18px;
  --font-size-xl: 20px;
  --font-size-2xl: 24px;
  --font-size-3xl: 30px;
  
  /* Layout */
  --sidebar-width: 260px;
  --sidebar-collapsed: 80px;
  --header-height: 64px;
  --border-radius: 8px;
  --border-radius-sm: 6px;
  --border-radius-lg: 12px;

  /* Page spacing / content width */
  --page-padding: var(--space-lg);
  --content-max: none;
  
  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);

  /* Motion */
  --ease-standard: cubic-bezier(0.2, 0, 0, 1);
  --dur-fast: 120ms;
  --dur-med: 200ms;
  --dur-slow: 320ms;
}

/* Base Reset */
* { box-sizing: border-box; }
body { 
  margin: 0; 
  font-family: var(--font-sans); 
  font-size: var(--font-size-sm); 
  color: var(--gray-800); 
  line-height: 1.5; 
  background: var(--gray-50); 
  -webkit-font-smoothing: antialiased;
}

/* Layout Structure */
.app-layout { display: flex; min-height: 100vh; }
.app-sidebar { 
  width: var(--sidebar-width); 
  background: var(--secondary); 
  color: var(--white); 
  flex-shrink: 0; 
  display: flex; 
  flex-direction: column;
  transition: width 0.3s ease;
}
.app-main { flex: 1; display: flex; flex-direction: column; min-width: 0; background: var(--gray-50); }
.app-header { 
  height: var(--header-height); 
  background: var(--white); 
  border-bottom: 1px solid var(--gray-200); 
  display: flex; 
  align-items: center; 
  justify-content: space-between; 
  padding: 0 var(--space-lg); 
  box-shadow: var(--shadow-sm);
  z-index: 10;
}
.app-content { 
  flex: 1; 
  padding: var(--page-padding);
  max-width: var(--content-max);
  width: 100%;
  margin: 0;
  overflow-y: auto; 
}

/* Sidebar Styling */
.sidebar-brand { 
  height: var(--header-height);
  padding: 0 var(--space-lg); 
  font-weight: 700; 
  font-size: var(--font-size-lg); 
  display: flex; 
  align-items: center; 
  gap: var(--space-sm); 
  background: rgba(0,0,0,0.1);
  letter-spacing: -0.025em;
}
.sidebar-nav { padding: var(--space-md) var(--space-sm); flex: 1; overflow-y: auto; }
.nav-section { 
  padding: var(--space-md) var(--space-md) var(--space-xs); 
  font-size: 11px; 
  text-transform: uppercase; 
  letter-spacing: 0.05em;
  color: rgba(255,255,255,0.4); 
  font-weight: 600;
}
.nav-item { 
  display: flex; 
  align-items: center; 
  gap: var(--space-md); 
  padding: 10px 16px; 
  color: rgba(255,255,255,0.75); 
  text-decoration: none; 
  border-radius: var(--border-radius-sm);
  transition: all 0.2s; 
  margin-bottom: 2px;
  font-weight: 500;
}
.nav-item:hover { background: rgba(255,255,255,0.1); color: var(--white); }
.nav-item.active { background: var(--primary); color: var(--white); box-shadow: 0 1px 3px rgba(0,0,0,0.2); }
.nav-item i { width: 20px; text-align: center; font-size: 16px; }

/* Buttons */
.btn { 
  display: inline-flex; 
  align-items: center; 
  justify-content: center; 
  gap: var(--space-sm); 
  padding: 8px 16px; 
  font-size: var(--font-size-sm); 
  font-weight: 500; 
  border-radius: var(--border-radius-sm); 
  border: 1px solid transparent; 
  cursor: pointer; 
  transition: all 0.2s; 
  text-decoration: none; 
  line-height: 1.25;
}
.btn:focus { outline: 2px solid var(--primary-light); outline-offset: 2px; }
.btn-primary { background: var(--primary); color: var(--white); border-color: var(--primary); box-shadow: 0 1px 2px rgba(0,0,0,0.05); }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-default { background: var(--white); color: var(--gray-700); border-color: var(--gray-300); box-shadow: 0 1px 2px rgba(0,0,0,0.05); }
.btn-default:hover { border-color: var(--gray-400); background: var(--gray-50); color: var(--gray-900); }
.btn-danger { background: var(--status-red); color: var(--white); border-color: var(--status-red); }
.btn-danger:hover { background: #B91C1C; }
.btn-success { background: var(--status-green); color: var(--white); border-color: var(--status-green); }
.btn-success:hover { background: #15803D; }
.btn-sm { padding: 6px 12px; font-size: var(--font-size-xs); }
.btn-lg { padding: 12px 24px; font-size: var(--font-size-md); }
.btn-icon { padding: 8px; width: 36px; height: 36px; border-radius: 50%; color: var(--gray-500); background: transparent; border: none; }
.btn-icon:hover { background: var(--gray-100); color: var(--primary); }

/* Cards */
.card { 
  background: var(--white); 
  border-radius: var(--border-radius); 
  border: 1px solid var(--gray-200); 
  box-shadow: var(--shadow-sm); 
  overflow: hidden; 
  display: flex;
  flex-direction: column;
}
.card-header { 
  padding: var(--space-md) var(--space-lg); 
  border-bottom: 1px solid var(--gray-200); 
  font-weight: 600; 
  font-size: var(--font-size-md); 
  display: flex; 
  align-items: center; 
  justify-content: flex-start;
  gap: 10px;
  background: var(--white);
  color: var(--gray-900);
}
.card-header > :not(:first-child):last-child {
  margin-left: auto;
}
.card-header > i {
  color: var(--gray-400);
}
.card-header > span {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.card-header > span i {
  color: var(--gray-400);
}
.card-body { padding: var(--space-lg); flex: 1; }
.card-footer { 
  padding: var(--space-md) var(--space-lg); 
  border-top: 1px solid var(--gray-200); 
  background: var(--gray-50); 
  font-size: var(--font-size-xs);
  color: var(--gray-500);
}

/* Tables */
.table-wrap { overflow-x: auto; width: 100%; }
.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: var(--font-size-sm); }
.table th { 
  padding: 12px var(--space-md); 
  text-align: left; 
  border-bottom: 1px solid var(--gray-200); 
  background: var(--gray-50); 
  font-weight: 600; 
  color: var(--gray-500); 
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.05em;
}
.table td { 
  padding: 16px var(--space-md); 
  text-align: left; 
  border-bottom: 1px solid var(--gray-200); 
  vertical-align: middle;
  color: var(--gray-700);
}
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: var(--gray-50); }
.table tbody tr.row-ready td:first-child { border-left: 3px solid var(--status-green); }
.table tbody tr.row-review td:first-child { border-left: 3px solid var(--status-yellow); }
.table tbody tr.row-exclusion td:first-child { border-left: 3px solid var(--status-red); }

/* ============================================
   INTAKE QUEUE — CARD CONTROL CENTER
   ============================================ */

.queue-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: var(--space-lg);
  align-items: start;
}

.queue-sidebar {
  position: sticky;
  top: calc(var(--header-height) + var(--space-lg));
}

.queue-sidebar .card-body {
  padding: var(--space-md);
}

.queue-filter-group + .queue-filter-group {
  margin-top: var(--space-md);
  padding-top: var(--space-md);
  border-top: 1px solid var(--gray-200);
}

.queue-filter-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--gray-500);
  font-weight: 700;
  margin-bottom: var(--space-sm);
}

.queue-filter-btn {
  width: 100%;
  justify-content: space-between;
  padding: 10px 12px;
  border-radius: var(--border-radius);
  background: var(--white);
  border: 1px solid var(--gray-200);
  color: var(--gray-700);
  font-weight: 600;
}

.queue-filter-btn:hover {
  border-color: var(--gray-300);
  background: var(--gray-50);
}

.queue-filter-btn.active {
  background: var(--primary-bg);
  border-color: rgba(0, 102, 204, 0.25);
  color: var(--primary);
}

.queue-filter-left {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.queue-filter-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--gray-300);
}
.queue-filter-dot.ready { background: var(--status-green); }
.queue-filter-dot.review { background: var(--status-yellow); }
.queue-filter-dot.exclusion { background: var(--status-red); }

.queue-count-pill {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 9999px;
  background: var(--gray-100);
  color: var(--gray-700);
}
.queue-filter-btn.active .queue-count-pill {
  background: rgba(0, 102, 204, 0.12);
  color: var(--primary);
}

.queue-main-top {
  display: flex;
  gap: var(--space-md);
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  margin-bottom: var(--space-md);
}

.queue-search {
  flex: 1;
  min-width: 260px;
}

.queue-cards {
  display: grid;
  gap: var(--space-md);
}

.referral-card {
  position: relative;
  display: grid;
  grid-template-columns: 6px 1fr;
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--border-radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.referral-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: rgba(0, 102, 204, 0.2);
}

.referral-rail { background: var(--gray-300); }
.referral-card.status-ready .referral-rail { background: var(--status-green); }
.referral-card.status-review .referral-rail { background: var(--status-yellow); }
.referral-card.status-exclusion .referral-rail { background: var(--status-red); }

.referral-card-body {
  padding: var(--space-md) var(--space-lg);
  display: grid;
  gap: var(--space-md);
}

.referral-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-md);
}

.referral-title-row {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  flex-wrap: wrap;
}

.referral-name {
  font-size: var(--font-size-md);
  font-weight: 700;
  color: var(--gray-900);
  letter-spacing: -0.01em;
}

.referral-sub {
  margin-top: 2px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  color: var(--gray-500);
  font-size: 13px;
}

.referral-id {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 12px;
  color: var(--gray-500);
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: 9999px;
  padding: 2px 8px;
}

.referral-sub i { color: var(--gray-400); }

.referral-actions {
  display: flex;
  gap: 8px;
  opacity: 0;
  transform: translateY(2px);
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.referral-card:hover .referral-actions {
  opacity: 1;
  transform: translateY(0);
}

.referral-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-md);
}

.metric {
  padding: 10px 12px;
  border: 1px solid var(--gray-200);
  border-radius: var(--border-radius);
  background: linear-gradient(135deg, var(--white) 0%, var(--gray-50) 100%);
}

.metric-label {
  font-size: 11px;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 700;
  margin-bottom: 6px;
}

.metric-value {
  display: flex;
  align-items: baseline;
  gap: 6px;
  font-weight: 800;
  color: var(--gray-900);
  font-size: 18px;
  margin-bottom: 8px;
}
.metric-value small {
  font-size: 12px;
  font-weight: 600;
  color: var(--gray-500);
}

.mini-progress {
  height: 6px;
  border-radius: 9999px;
  background: var(--gray-200);
  overflow: hidden;
}
.mini-fill {
  height: 100%;
  border-radius: 9999px;
  background: linear-gradient(90deg, #0077E6, var(--primary));
}
.mini-fill.success { background: linear-gradient(90deg, #34D399, var(--status-green)); }
.mini-fill.warning { background: linear-gradient(90deg, #FBBF24, var(--status-yellow)); }
.mini-fill.danger { background: linear-gradient(90deg, #F87171, var(--status-red)); }

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

@media (max-width: 768px) {
  .referral-actions { opacity: 1; transform: none; }
  .referral-metrics { grid-template-columns: 1fr; }
}

/* Badges & Pills */
.badge { 
  display: inline-flex; 
  align-items: center; 
  padding: 3px 10px; 
  font-size: 12px; 
  font-weight: 600; 
  border-radius: 9999px; 
  line-height: 1.35;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.5);
}
.badge-green { background: linear-gradient(135deg, #E6F4EA 0%, #D1FAE5 100%); color: #166534; border: 1px solid transparent; }
.badge-yellow { background: linear-gradient(135deg, #FEF3C7 0%, #FDE68A 100%); color: #92400E; border: 1px solid transparent; }
.badge-red { background: linear-gradient(135deg, #FEE2E2 0%, #FECACA 100%); color: #991B1B; border: 1px solid transparent; }
.badge-blue { background: linear-gradient(135deg, #DBEAFE 0%, #BFDBFE 100%); color: #1E40AF; border: 1px solid transparent; }
.badge-gray { background: var(--gray-100); color: var(--gray-600); border: 1px solid var(--gray-200); }

/* Form Controls */
.form-group { margin-bottom: var(--space-md); }
.form-label { display: block; margin-bottom: 6px; font-weight: 500; color: var(--gray-700); font-size: var(--font-size-sm); }
.form-label.required::after { content: '*'; color: var(--status-red); margin-left: 4px; }
.form-control { 
  width: 100%; 
  padding: 10px 12px; 
  font-size: var(--font-size-sm); 
  border: 1px solid var(--gray-300); 
  border-radius: var(--border-radius-sm); 
  transition: all 0.2s; 
  color: var(--gray-900);
  background: var(--white);
}
.form-control:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(0,102,204,0.1); }
.form-control::placeholder { color: var(--gray-400); }
textarea.form-control { min-height: 100px; resize: vertical; }

/* Tabs */
.tabs { display: flex; border-bottom: 1px solid var(--gray-200); gap: var(--space-lg); margin-bottom: var(--space-lg); background: var(--white); padding: 0 var(--space-lg); }
.tab { 
  padding: 16px 4px; 
  font-weight: 500; 
  color: var(--gray-500); 
  cursor: pointer; 
  border-bottom: 2px solid transparent; 
  margin-bottom: -1px; 
  transition: all 0.2s; 
  font-size: var(--font-size-sm);
}
.tab:hover { color: var(--gray-800); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab-panel { display: none; animation: fadeIn 0.3s ease; }
.tab-panel.active { display: block; }

/* Filter Pills */
.filter-pills { display: flex; flex-wrap: wrap; gap: var(--space-sm); margin-bottom: var(--space-md); }
.filter-pill { 
  display: inline-flex; 
  align-items: center; 
  gap: var(--space-sm); 
  padding: 6px 16px; 
  border-radius: 9999px; 
  border: 1px solid var(--gray-300); 
  background: var(--white); 
  cursor: pointer; 
  font-size: var(--font-size-sm); 
  transition: all 0.2s; 
  color: var(--gray-700);
}
.filter-pill:hover { border-color: var(--primary); color: var(--primary); background: var(--gray-50); }
.filter-pill.active { border-color: var(--primary); background: var(--primary-bg); color: var(--primary); font-weight: 600; }
.filter-pill .count { background: var(--gray-200); padding: 2px 8px; border-radius: 99px; font-size: 11px; font-weight: 600; color: var(--gray-700); }
.filter-pill.active .count { background: var(--primary-light); color: var(--primary); }

/* Progress Bar */
.progress { height: 8px; background: var(--gray-200); border-radius: 4px; overflow: hidden; }
.progress-bar { height: 100%; background: var(--status-green); border-radius: 4px; transition: width 0.3s; }
.progress-bar.warning { background: var(--status-yellow); }
.progress-bar.danger { background: var(--status-red); }

/* Segmented Progress Bar - Battery Style */
.segment-progress {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}
.segment-bars {
  display: flex;
  gap: 3px;
  align-items: flex-end;
}
.segment-bar {
  width: 6px;
  height: 20px;
  border-radius: 2px;
  background: var(--gray-200);
  transition: background 0.3s ease;
}
.segment-bar.filled { background: var(--primary); }
.segment-bar.filled.green { background: var(--status-green); }
.segment-bar.filled.yellow { background: var(--status-yellow); }
.segment-bar.filled.red { background: var(--status-red); }
.segment-bar.filled.medical { background: var(--domain-medical); }
.segment-bar.filled.behavioral { background: var(--domain-behavioral); }
.segment-bar.filled.functional { background: var(--domain-functional); }
.segment-value {
  font-size: 18px;
  font-weight: 700;
  color: var(--gray-900);
  min-width: 48px;
}
.segment-value span { font-size: 12px; font-weight: 400; color: var(--gray-400); }

/* Size variants */
.segment-progress.sm .segment-bar { width: 4px; height: 14px; }
.segment-progress.sm .segment-value { font-size: 14px; min-width: 36px; }
.segment-progress.sm .segment-value span { font-size: 10px; }

.segment-progress.lg .segment-bar { width: 8px; height: 28px; gap: 4px; }
.segment-progress.lg .segment-value { font-size: 24px; min-width: 64px; }
.segment-progress.lg .segment-value span { font-size: 14px; }

/* Compact inline variant */
.segment-progress.inline {
  gap: 8px;
}
.segment-progress.inline .segment-bars { gap: 2px; }
.segment-progress.inline .segment-bar { width: 5px; height: 16px; }
.segment-progress.inline .segment-value { font-size: 15px; min-width: auto; }

/* Stats Cards */
.stat-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: var(--space-lg); margin-bottom: var(--space-lg); }
.stat-card { 
  background: var(--white); 
  border-radius: var(--border-radius); 
  padding: var(--space-lg); 
  border: 1px solid var(--gray-200); 
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.stat-card .label { font-size: var(--font-size-xs); color: var(--gray-500); margin-bottom: var(--space-xs); font-weight: 500; text-transform: uppercase; letter-spacing: 0.05em; }
.stat-card .value { font-size: 28px; font-weight: 700; color: var(--gray-900); letter-spacing: -0.025em; }
.stat-card .trend { font-size: var(--font-size-xs); margin-top: var(--space-sm); display: flex; align-items: center; gap: 4px; font-weight: 500; }
.stat-card .trend.up { color: var(--status-green); }
.stat-card .trend.down { color: var(--status-red); }

/* Utilities */
.text-muted { color: var(--gray-500); }
.text-success { color: var(--status-green); }
.text-danger { color: var(--status-red); }
.text-warning { color: var(--status-yellow); }
.text-primary { color: var(--primary); }
.fw-bold { font-weight: 600; }
.mb-0 { margin-bottom: 0; }
.mt-1 { margin-top: var(--space-sm); }
.mt-2 { margin-top: var(--space-md); }
.mt-4 { margin-top: var(--space-lg); }
.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: var(--space-sm); }
.gap-2 { gap: var(--space-md); }
.gap-4 { gap: var(--space-lg); }
.w-full { width: 100%; }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--space-lg); }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-lg); }

/* Page Header */
.page-header { margin-bottom: var(--space-lg); display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: var(--space-md); }
.page-title { margin: 0; font-size: var(--font-size-2xl); font-weight: 700; color: var(--gray-900); letter-spacing: -0.025em; }

/* Animations */
@keyframes fadeIn { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }

/* Bed Cards - Specific */
.bed-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: var(--space-md); }
.bed-card { 
  border: 1px solid var(--gray-200); 
  border-radius: var(--border-radius); 
  padding: var(--space-lg); 
  background: var(--white); 
  transition: all 0.2s; 
  position: relative;
}
.bed-card:hover { box-shadow: var(--shadow-md); border-color: var(--primary-light); }
.bed-card.available { border-left: 4px solid var(--status-green); }
.bed-card.occupied { border-left: 4px solid var(--gray-400); }
.bed-card.waitlist { border-left: 4px solid var(--status-yellow); }

/* Chat UI */
.chat-container { display: flex; flex-direction: column; height: 500px; border: 1px solid var(--gray-200); border-radius: var(--border-radius); overflow: hidden; background: var(--white); }
.chat-messages { flex: 1; overflow-y: auto; padding: var(--space-lg); background: var(--gray-50); }
.chat-message { margin-bottom: var(--space-lg); padding: var(--space-md); border-radius: var(--border-radius); max-width: 85%; box-shadow: var(--shadow-sm); position: relative; }
.chat-message.user { background: var(--primary); color: var(--white); margin-left: auto; border-bottom-right-radius: 2px; }
.chat-message.assistant { background: var(--white); color: var(--gray-800); margin-right: auto; border: 1px solid var(--gray-200); border-bottom-left-radius: 2px; }
.chat-message .source { font-size: 11px; margin-top: 8px; opacity: 0.8; display: block; border-top: 1px solid rgba(0,0,0,0.1); padding-top: 4px; }
.chat-input-area { padding: var(--space-md); background: var(--white); border-top: 1px solid var(--gray-200); display: flex; gap: var(--space-sm); }

/* Login Specific */
.login-page { 
  min-height: 100vh; 
  display: flex; 
  align-items: center; 
  justify-content: center; 
  background: linear-gradient(135deg, #F0F4F8 0%, #D9E2EC 100%); 
  padding: var(--space-lg); 
}
.login-card { width: 100%; max-width: 400px; padding: 40px; box-shadow: var(--shadow-xl); border: none; }

/* Timeline / Activity Feed */
.timeline { position: relative; padding-left: 24px; }
.timeline::before { content: ''; position: absolute; left: 8px; top: 0; bottom: 0; width: 2px; background: var(--gray-200); }
.timeline-item { position: relative; margin-bottom: 24px; }
.timeline-item:last-child { margin-bottom: 0; }
.timeline-dot { width: 18px; height: 18px; border-radius: 50%; background: var(--white); border: 4px solid var(--primary); position: absolute; left: -25px; top: 2px; }
.timeline-dot.success { border-color: var(--status-green); }
.timeline-dot.warning { border-color: var(--status-yellow); }
.timeline-dot.info { border-color: var(--status-blue); }
.timeline-content { font-size: var(--font-size-sm); }
.timeline-time { font-size: var(--font-size-xs); color: var(--gray-500); margin-top: 2px; }

/* ============================================
   ENHANCED MODERN COMPONENTS
   ============================================ */

/* Search Bar */
.search-container { position: relative; }
.search-input { 
  width: 100%; 
  padding: 10px 16px 10px 44px; 
  font-size: var(--font-size-sm);
  border: 1px solid var(--gray-200); 
  border-radius: var(--border-radius); 
  background: var(--gray-50);
  transition: all 0.2s;
}
.search-input:focus { 
  outline: none; 
  border-color: var(--primary); 
  background: var(--white);
  box-shadow: 0 0 0 3px rgba(0,102,204,0.1); 
}
.search-icon { 
  position: absolute; 
  left: 14px; 
  top: 50%; 
  transform: translateY(-50%); 
  color: var(--gray-400);
  font-size: 16px;
}

/* Header Search */
.header-search { 
  width: 400px;
  position: relative;
}
.header-search .search-input {
  background: var(--gray-100);
  border: none;
  padding-right: 80px;
}
.header-search .shortcut {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 11px;
  color: var(--gray-400);
  background: var(--white);
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid var(--gray-200);
}

/* User Profile Dropdown */
.user-profile { 
  display: flex; 
  align-items: center; 
  gap: 12px; 
  cursor: pointer;
  padding: 6px 12px;
  border-radius: var(--border-radius);
  transition: all 0.2s;
  text-decoration: none;
  color: inherit;
}
.user-profile:hover { background: var(--gray-50); }
.user-profile * { text-decoration: none; }
.user-avatar { 
  width: 36px; 
  height: 36px; 
  border-radius: 50%; 
  background: var(--primary); 
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 14px;
}
.user-info { text-align: left; }
.user-name { font-weight: 600; font-size: var(--font-size-sm); color: var(--gray-800); }
.user-role { font-size: 11px; color: var(--gray-500); }

/* Notification Bell */
.notification-bell { position: relative; }
.notification-badge { 
  position: absolute; 
  top: -4px; 
  right: -4px; 
  min-width: 18px; 
  height: 18px;
  background: var(--status-red); 
  color: var(--white); 
  font-size: 11px; 
  font-weight: 600;
  border-radius: 9999px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
}

/* Domain Score Bars */
.domain-score { margin-bottom: 12px; }
.domain-label { 
  display: flex; 
  justify-content: space-between; 
  align-items: center; 
  margin-bottom: 6px;
  font-size: var(--font-size-xs);
}
.domain-name { color: var(--gray-600); font-weight: 500; }
.domain-value { font-weight: 700; color: var(--gray-800); }
.domain-bar { height: 8px; border-radius: 4px; background: var(--gray-200); overflow: hidden; }
.domain-bar-fill { height: 100%; border-radius: 4px; transition: width 0.3s ease; }
.domain-bar-fill.medical { background: linear-gradient(90deg, #3B82F6, #60A5FA); }
.domain-bar-fill.behavioral { background: linear-gradient(90deg, #8B5CF6, #A78BFA); }
.domain-bar-fill.functional { background: linear-gradient(90deg, #10B981, #34D399); }

/* Quick Actions Cards */
.quick-actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: var(--space-md); }
.quick-action-card { 
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-lg);
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--border-radius);
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  color: inherit;
}
.quick-action-card:hover { 
  border-color: var(--primary); 
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.quick-action-icon { 
  width: 48px; 
  height: 48px;
  border-radius: var(--border-radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}
.quick-action-icon.primary { background: var(--primary-bg); color: var(--primary); }
.quick-action-icon.success { background: var(--status-green-bg); color: var(--status-green); }
.quick-action-icon.warning { background: var(--status-yellow-bg); color: var(--status-yellow); }
.quick-action-icon.danger { background: var(--status-red-bg); color: var(--status-red); }
.quick-action-text h4 { margin: 0 0 4px 0; font-size: var(--font-size-sm); font-weight: 600; }
.quick-action-text p { margin: 0; font-size: var(--font-size-xs); color: var(--gray-500); }

/* Upload Zone */
.upload-zone { 
  border: 2px dashed var(--gray-300);
  border-radius: var(--border-radius);
  padding: var(--space-xl);
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  background: var(--gray-50);
}
.upload-zone:hover { border-color: var(--primary); background: var(--primary-bg); }
.upload-zone.dragging { border-color: var(--primary); background: var(--primary-bg); }
.upload-zone i { font-size: 48px; color: var(--gray-400); margin-bottom: var(--space-md); }
.upload-zone h4 { margin: 0 0 8px 0; color: var(--gray-700); }
.upload-zone p { margin: 0; color: var(--gray-500); font-size: var(--font-size-sm); }

/* Document List Item */
.doc-item { 
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md);
  border: 1px solid var(--gray-200);
  border-radius: var(--border-radius);
  margin-bottom: var(--space-sm);
  transition: all 0.2s;
}
.doc-item:hover { background: var(--gray-50); }
.doc-item.missing { background: var(--status-red-bg); border-color: var(--status-red-border); }
.doc-item.verified { border-left: 3px solid var(--status-green); }
.doc-item.processing { border-left: 3px solid var(--status-yellow); }
.doc-info { display: flex; align-items: center; gap: var(--space-md); }
.doc-icon { 
  width: 40px; 
  height: 40px;
  border-radius: var(--border-radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}
.doc-icon.pdf { background: #FEE2E2; color: #DC2626; }
.doc-icon.image { background: #DBEAFE; color: #2563EB; }
.doc-icon.doc { background: #DCFCE7; color: #16A34A; }
.doc-details h4 { margin: 0 0 4px 0; font-size: var(--font-size-sm); font-weight: 600; }
.doc-details p { margin: 0; font-size: var(--font-size-xs); color: var(--gray-500); }

/* Medication Table */
.med-table { width: 100%; }
.med-table th { 
  text-align: left; 
  padding: 8px 12px; 
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--gray-500);
  font-weight: 600;
  border-bottom: 1px solid var(--gray-200);
}
.med-table td { 
  padding: 12px; 
  border-bottom: 1px solid var(--gray-100);
  vertical-align: middle;
}
.med-table input { 
  border: 1px dashed transparent;
  background: transparent;
  padding: 6px 8px;
  border-radius: 4px;
  font-size: var(--font-size-sm);
  width: 100%;
}
.med-table input:hover { border-color: var(--gray-300); }
.med-table input:focus { 
  outline: none;
  border-color: var(--primary);
  border-style: solid;
  background: var(--white);
}
.med-warning { 
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--status-yellow);
  padding: 2px 8px;
  background: var(--status-yellow-bg);
  border-radius: 4px;
}

/* Tags/Pills */
.tag-list { display: flex; flex-wrap: wrap; gap: 8px; }
.tag { 
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--gray-100);
  color: var(--gray-700);
  border-radius: 9999px;
  font-size: var(--font-size-xs);
  font-weight: 500;
}
.tag-remove { 
  cursor: pointer;
  opacity: 0.6;
  transition: opacity 0.2s;
}
.tag-remove:hover { opacity: 1; }
.tag-add { 
  background: transparent;
  border: 1px dashed var(--gray-300);
  color: var(--gray-500);
  cursor: pointer;
}
.tag-add:hover { border-color: var(--primary); color: var(--primary); }

/* Facility Cards Grid */
.facility-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(350px, 1fr)); gap: var(--space-lg); }
.facility-card { 
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--border-radius-lg);
  overflow: hidden;
  transition: all 0.2s;
}
.facility-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); }
.facility-banner { 
  height: 120px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  display: flex;
  align-items: flex-end;
  padding: var(--space-md);
}
.facility-banner-text { color: var(--white); }
.facility-banner-text h3 { margin: 0 0 4px 0; font-size: var(--font-size-lg); font-weight: 600; }
.facility-banner-text p { margin: 0; font-size: var(--font-size-xs); opacity: 0.9; }
.facility-body { padding: var(--space-lg); }
.facility-meta { 
  display: flex; 
  gap: var(--space-sm); 
  flex-wrap: wrap;
  margin-bottom: var(--space-md);
}
.facility-tag { 
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 4px;
  font-weight: 500;
}
.facility-tag.rtc { background: var(--primary-bg); color: var(--primary); }
.facility-tag.acute { background: var(--status-red-bg); color: #991B1B; }
.facility-tag.stepdown { background: var(--status-yellow-bg); color: #92400E; }
.facility-stats { display: flex; gap: var(--space-lg); margin-top: var(--space-md); }
.facility-stat { text-align: center; flex: 1; }
.facility-stat-value { font-size: var(--font-size-xl); font-weight: 700; color: var(--gray-800); }
.facility-stat-label { font-size: 11px; color: var(--gray-500); text-transform: uppercase; letter-spacing: 0.05em; }
.facility-stat.success .facility-stat-value { color: var(--status-green); }
.facility-stat.warning .facility-stat-value { color: var(--status-yellow); }

/* Drawer */
.drawer-overlay { 
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.4);
  z-index: 100;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s;
}
.drawer-overlay.active { opacity: 1; visibility: visible; }
.drawer { 
  position: fixed;
  top: 0;
  right: -420px;
  width: 420px;
  height: 100%;
  background: var(--white);
  box-shadow: var(--shadow-xl);
  z-index: 101;
  transition: right 0.3s ease;
  display: flex;
  flex-direction: column;
}
.drawer.active { right: 0; }
.drawer-header { 
  padding: var(--space-lg);
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.drawer-header h3 { margin: 0; font-size: var(--font-size-lg); }
.drawer-body { flex: 1; padding: var(--space-lg); overflow-y: auto; }
.drawer-footer { 
  padding: var(--space-lg);
  border-top: 1px solid var(--gray-200);
  display: flex;
  gap: var(--space-sm);
  justify-content: flex-end;
}

/* Empty State */
.empty-state { 
  text-align: center;
  padding: var(--space-xxl);
  color: var(--gray-500);
}
.empty-state i { font-size: 64px; color: var(--gray-300); margin-bottom: var(--space-lg); }
.empty-state h3 { margin: 0 0 8px 0; color: var(--gray-700); font-size: var(--font-size-lg); }
.empty-state p { margin: 0 0 var(--space-lg) 0; }

/* Breadcrumb */
.breadcrumb { 
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: var(--font-size-sm);
  margin-bottom: var(--space-md);
}
.breadcrumb a { color: var(--gray-500); text-decoration: none; }
.breadcrumb a:hover { color: var(--primary); }
.breadcrumb span { color: var(--gray-400); }
.breadcrumb .current { color: var(--gray-800); font-weight: 500; }

/* Patient Header */
.patient-header { 
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-lg);
  background: var(--white);
  border-bottom: 1px solid var(--gray-200);
  margin: calc(-1 * var(--space-lg));
  margin-bottom: var(--space-lg);
}
.patient-info { display: flex; align-items: center; gap: var(--space-md); }
.patient-avatar { 
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--primary);
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 600;
}
.patient-name { font-size: var(--font-size-xl); font-weight: 700; color: var(--gray-900); margin: 0 0 4px 0; }
.patient-meta { display: flex; align-items: center; gap: var(--space-md); font-size: var(--font-size-sm); color: var(--gray-500); }
.patient-actions { display: flex; gap: var(--space-sm); }

/* Checkbox styled */
.checkbox-styled { 
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: var(--font-size-sm);
}
.checkbox-styled input { display: none; }
.checkbox-styled .check { 
  width: 18px;
  height: 18px;
  border: 2px solid var(--gray-300);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}
.checkbox-styled input:checked + .check { 
  background: var(--primary);
  border-color: var(--primary);
  color: var(--white);
}
.checkbox-styled .check i { font-size: 12px; opacity: 0; }
.checkbox-styled input:checked + .check i { opacity: 1; }

/* Toggle Switch */
.toggle-switch { 
  position: relative;
  width: 48px;
  height: 24px;
  display: inline-block;
}
.toggle-switch input { display: none; }
.toggle-slider { 
  position: absolute;
  inset: 0;
  background: var(--gray-300);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s;
}
.toggle-slider::before { 
  content: '';
  position: absolute;
  width: 20px;
  height: 20px;
  background: var(--white);
  border-radius: 50%;
  top: 2px;
  left: 2px;
  transition: all 0.3s;
  box-shadow: var(--shadow-sm);
}
.toggle-switch input:checked + .toggle-slider { background: var(--primary); }
.toggle-switch input:checked + .toggle-slider::before { left: 26px; }

/* Password Strength */
.password-strength { 
  display: flex;
  gap: 4px;
  margin-top: 8px;
}
.strength-bar { 
  flex: 1;
  height: 4px;
  background: var(--gray-200);
  border-radius: 2px;
}
.strength-bar.active.weak { background: var(--status-red); }
.strength-bar.active.medium { background: var(--status-yellow); }
.strength-bar.active.strong { background: var(--status-green); }

/* ============================================
   ANT DESIGN MODAL / DRAWER / FEEDBACK
   ============================================ */

/* Modal */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}
.modal-overlay.active { opacity: 1; visibility: visible; }

.modal {
  background: var(--white);
  border-radius: var(--border-radius-lg);
  box-shadow: 0 6px 16px 0 rgba(0, 0, 0, 0.08), 0 3px 6px -4px rgba(0, 0, 0, 0.12), 0 9px 28px 8px rgba(0, 0, 0, 0.05);
  width: 520px;
  max-width: calc(100vw - 32px);
  max-height: calc(100vh - 64px);
  display: flex;
  flex-direction: column;
  transform: scale(0.9);
  transition: transform 0.3s ease;
}
.modal-overlay.active .modal { transform: scale(1); }
.modal.modal-lg { width: 720px; }
.modal.modal-sm { width: 400px; }

.modal-header {
  padding: 16px 24px;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-title {
  margin: 0;
  font-size: var(--font-size-lg);
  font-weight: 600;
  color: var(--gray-900);
}
.modal-close {
  background: none;
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--gray-500);
  transition: all 0.2s;
}
.modal-close:hover { background: var(--gray-100); color: var(--gray-700); }

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

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--gray-200);
  display: flex;
  gap: var(--space-sm);
  justify-content: flex-end;
}

/* Popconfirm */
.popconfirm {
  position: absolute;
  background: var(--white);
  border-radius: var(--border-radius);
  box-shadow: 0 6px 16px 0 rgba(0, 0, 0, 0.08), 0 3px 6px -4px rgba(0, 0, 0, 0.12), 0 9px 28px 8px rgba(0, 0, 0, 0.05);
  padding: var(--space-md);
  z-index: 1050;
  width: 280px;
  display: none;
}
.popconfirm.active { display: block; }
.popconfirm-content {
  display: flex;
  gap: var(--space-sm);
  margin-bottom: var(--space-md);
}
.popconfirm-icon {
  color: var(--status-yellow);
  font-size: 16px;
  flex-shrink: 0;
  margin-top: 2px;
}
.popconfirm-icon.danger { color: var(--status-red); }
.popconfirm-message {
  font-size: var(--font-size-sm);
  color: var(--gray-700);
}
.popconfirm-title {
  font-weight: 600;
  margin-bottom: 4px;
}
.popconfirm-actions {
  display: flex;
  gap: var(--space-sm);
  justify-content: flex-end;
}
.popconfirm::before {
  content: '';
  position: absolute;
  top: -8px;
  right: 24px;
  border: 8px solid transparent;
  border-bottom-color: var(--white);
}

/* Message/Toast */
.message-container {
  position: fixed;
  top: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  pointer-events: none;
}
.message {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 10px 16px;
  background: var(--white);
  border-radius: var(--border-radius);
  box-shadow: 0 6px 16px 0 rgba(0, 0, 0, 0.08), 0 3px 6px -4px rgba(0, 0, 0, 0.12), 0 9px 28px 8px rgba(0, 0, 0, 0.05);
  font-size: var(--font-size-sm);
  animation: messageIn 0.3s ease;
  pointer-events: auto;
}
.message.message-out { animation: messageOut 0.3s ease forwards; }
.message-icon { font-size: 16px; }
.message-success .message-icon { color: var(--status-green); }
.message-error .message-icon { color: var(--status-red); }
.message-warning .message-icon { color: var(--status-yellow); }
.message-info .message-icon { color: var(--status-blue); }

@keyframes messageIn {
  from { opacity: 0; transform: translateY(-20px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes messageOut {
  from { opacity: 1; transform: translateY(0); }
  to { opacity: 0; transform: translateY(-20px); }
}

/* Notification */
.notification-container {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  pointer-events: none;
}
.notification {
  width: 384px;
  max-width: calc(100vw - 48px);
  background: var(--white);
  border-radius: var(--border-radius);
  box-shadow: 0 6px 16px 0 rgba(0, 0, 0, 0.08), 0 3px 6px -4px rgba(0, 0, 0, 0.12), 0 9px 28px 8px rgba(0, 0, 0, 0.05);
  padding: var(--space-lg);
  animation: notificationIn 0.3s ease;
  pointer-events: auto;
}
.notification.notification-out { animation: notificationOut 0.3s ease forwards; }
.notification-header {
  display: flex;
  align-items: flex-start;
  gap: var(--space-md);
  margin-bottom: var(--space-sm);
}
.notification-icon { font-size: 24px; flex-shrink: 0; }
.notification-success .notification-icon { color: var(--status-green); }
.notification-error .notification-icon { color: var(--status-red); }
.notification-warning .notification-icon { color: var(--status-yellow); }
.notification-info .notification-icon { color: var(--status-blue); }
.notification-title { font-weight: 600; font-size: var(--font-size-md); color: var(--gray-900); }
.notification-message { font-size: var(--font-size-sm); color: var(--gray-600); margin-left: 40px; }
.notification-close {
  position: absolute;
  top: 12px;
  right: 12px;
  background: none;
  border: none;
  color: var(--gray-400);
  cursor: pointer;
  padding: 4px;
}
.notification-close:hover { color: var(--gray-600); }

@keyframes notificationIn {
  from { opacity: 0; transform: translateX(100%); }
  to { opacity: 1; transform: translateX(0); }
}
@keyframes notificationOut {
  from { opacity: 1; transform: translateX(0); }
  to { opacity: 0; transform: translateX(100%); }
}

/* Skeleton Loading */
.skeleton {
  background: linear-gradient(90deg, var(--gray-200) 25%, var(--gray-100) 50%, var(--gray-200) 75%);
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s infinite;
  border-radius: 4px;
}
.skeleton-text { height: 16px; margin-bottom: 8px; }
.skeleton-text.short { width: 60%; }
.skeleton-title { height: 24px; width: 40%; margin-bottom: 16px; }
.skeleton-avatar { width: 40px; height: 40px; border-radius: 50%; }
.skeleton-button { width: 100px; height: 36px; }
@keyframes skeleton-loading {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Spin */
.spin-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
}
.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--gray-200);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
.spinner-sm { width: 16px; height: 16px; border-width: 2px; }
.spinner-lg { width: 48px; height: 48px; border-width: 4px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Alert */
.alert {
  padding: 12px 16px;
  border-radius: var(--border-radius);
  display: flex;
  align-items: flex-start;
  gap: var(--space-md);
  margin-bottom: var(--space-md);
  font-size: var(--font-size-sm);
}
.alert-icon { font-size: 16px; flex-shrink: 0; margin-top: 2px; }
.alert-content { flex: 1; }
.alert-title { font-weight: 600; margin-bottom: 4px; }
.alert-description { color: inherit; opacity: 0.85; }
.alert-close { background: none; border: none; cursor: pointer; opacity: 0.6; }
.alert-close:hover { opacity: 1; }

.alert-success { background: var(--status-green-bg); color: #166534; border: 1px solid var(--status-green-border); }
.alert-success .alert-icon { color: var(--status-green); }
.alert-error { background: var(--status-red-bg); color: #991B1B; border: 1px solid var(--status-red-border); }
.alert-error .alert-icon { color: var(--status-red); }
.alert-warning { background: var(--status-yellow-bg); color: #92400E; border: 1px solid var(--status-yellow-border); }
.alert-warning .alert-icon { color: var(--status-yellow); }
.alert-info { background: var(--status-blue-bg); color: #1E40AF; border: 1px solid #BFDBFE; }
.alert-info .alert-icon { color: var(--status-blue); }

/* Dropdown */
.dropdown { position: relative; display: inline-block; }
.dropdown-menu {
  position: absolute;
  top: 100%;
  right: 0;
  background: var(--white);
  border-radius: var(--border-radius);
  box-shadow: 0 6px 16px 0 rgba(0, 0, 0, 0.08), 0 3px 6px -4px rgba(0, 0, 0, 0.12);
  min-width: 160px;
  padding: 4px 0;
  z-index: 1000;
  display: none;
}
.dropdown.active .dropdown-menu { display: block; }
.dropdown-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 8px 16px;
  font-size: var(--font-size-sm);
  color: var(--gray-700);
  cursor: pointer;
  transition: all 0.2s;
}
.dropdown-item:hover { background: var(--gray-50); color: var(--gray-900); }
.dropdown-item.danger { color: var(--status-red); }
.dropdown-item.danger:hover { background: var(--status-red-bg); }
.dropdown-divider { height: 1px; background: var(--gray-200); margin: 4px 0; }

/* Tooltip */
.tooltip {
  position: relative;
  display: inline-block;
}
.tooltip-content {
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.85);
  color: var(--white);
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 12px;
  white-space: nowrap;
  margin-bottom: 8px;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s;
}
.tooltip-content::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: rgba(0, 0, 0, 0.85);
}
.tooltip:hover .tooltip-content { opacity: 1; visibility: visible; }

/* Avatar Group */
.avatar-group { display: flex; }
.avatar-group .user-avatar {
  border: 2px solid var(--white);
  margin-left: -8px;
}
.avatar-group .user-avatar:first-child { margin-left: 0; }
.avatar-group .avatar-more {
  background: var(--gray-200);
  color: var(--gray-600);
  font-size: 11px;
}

/* Steps */
.steps { display: flex; margin-bottom: var(--space-lg); }
.step {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
}
.step:not(:last-child)::after {
  content: '';
  position: absolute;
  top: 16px;
  left: 50%;
  width: 100%;
  height: 2px;
  background: var(--gray-200);
}
.step.completed::after { background: var(--primary); }
.step-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--gray-200);
  color: var(--gray-500);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 600;
  position: relative;
  z-index: 1;
  margin-bottom: 8px;
}
.step.active .step-icon { background: var(--primary); color: var(--white); }
.step.completed .step-icon { background: var(--primary); color: var(--white); }
.step-title { font-size: var(--font-size-sm); font-weight: 500; color: var(--gray-500); }
.step.active .step-title { color: var(--primary); }
.step.completed .step-title { color: var(--gray-700); }

/* Description List */
.descriptions { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: var(--space-md); }
.description-item { }
.description-label {
  font-size: var(--font-size-xs);
  color: var(--gray-500);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.description-value { font-size: var(--font-size-sm); color: var(--gray-900); font-weight: 500; }

/* Result */
.result {
  text-align: center;
  padding: var(--space-xxl);
}
.result-icon { font-size: 72px; margin-bottom: var(--space-lg); }
.result-success .result-icon { color: var(--status-green); }
.result-error .result-icon { color: var(--status-red); }
.result-warning .result-icon { color: var(--status-yellow); }
.result-info .result-icon { color: var(--status-blue); }
.result-title { font-size: var(--font-size-2xl); font-weight: 600; margin-bottom: var(--space-sm); color: var(--gray-900); }
.result-subtitle { font-size: var(--font-size-md); color: var(--gray-500); margin-bottom: var(--space-lg); }
.result-actions { display: flex; gap: var(--space-sm); justify-content: center; }

/* Select styled */
.select-wrapper { position: relative; }
.select-wrapper select {
  appearance: none;
  padding-right: 36px;
}
.select-wrapper::after {
  content: '\f078';
  font-family: var(--fa-style-family-classic, "Font Awesome 6 Pro");
  font-weight: 900;
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--gray-400);
  pointer-events: none;
  font-size: 12px;
}

/* Date Picker styled (basic) */
.date-picker {
  position: relative;
}
.date-picker input {
  padding-left: 40px;
}
.date-picker::before {
  content: '\f073';
  font-family: var(--fa-style-family-classic, "Font Awesome 6 Pro");
  font-weight: 900;
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--gray-400);
  pointer-events: none;
}

/* ============================================
   COMMAND BAR (Cmd/Ctrl + K)
   ============================================ */
.cmdk-overlay {
  position: fixed;
  inset: 0;
  z-index: 3000;
  display: none;
}
.cmdk-overlay.open { display: block; }
.cmdk-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.cmdk-dialog {
  position: absolute;
  left: 50%;
  top: 96px;
  transform: translateX(-50%);
  width: 680px;
  max-width: calc(100vw - 24px);
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: 16px;
  box-shadow: var(--shadow-xl);
  overflow: hidden;
}
.cmdk-top {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}
.cmdk-top i { color: var(--gray-400); }
.cmdk-input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-size: 15px;
  color: var(--gray-900);
}
.cmdk-input::placeholder { color: var(--gray-400); }
.cmdk-hint {
  font-size: 11px;
  font-weight: 700;
  color: var(--gray-500);
  background: rgba(0, 0, 0, 0.04);
  border: 1px solid rgba(0, 0, 0, 0.06);
  padding: 2px 8px;
  border-radius: 9999px;
}
.cmdk-list {
  max-height: 360px;
  overflow: auto;
  padding: 8px;
}
.cmdk-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  color: var(--gray-800);
  cursor: pointer;
  transition: background var(--dur-med) var(--ease-standard), color var(--dur-med) var(--ease-standard);
}
.cmdk-item i { width: 18px; text-align: center; color: var(--gray-500); }
.cmdk-item.active,
.cmdk-item:hover {
  background: rgba(0, 102, 204, 0.08);
  color: var(--gray-900);
}
.cmdk-item.active i,
.cmdk-item:hover i { color: var(--primary); }
.cmdk-empty {
  padding: 18px 12px;
  color: var(--gray-500);
  font-size: 14px;
}
.cmdk-footer {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  border-top: 1px solid rgba(0, 0, 0, 0.06);
  color: var(--gray-500);
  font-size: 12px;
}
.cmdk-footer kbd {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 6px;
  border: 1px solid rgba(0, 0, 0, 0.10);
  background: rgba(0, 0, 0, 0.04);
  margin-right: 6px;
}

/* ============================================
   TAB SUB-HEADER (per-tab title + search/actions)
   ============================================ */
.tab-subhead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
}
.tab-subhead-title {
  margin: 0;
  font-size: var(--font-size-lg);
  font-weight: 700;
  color: var(--gray-900);
  letter-spacing: -0.01em;
}
.tab-subhead-actions {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  flex-wrap: wrap;
}
.tab-subhead-search {
  min-width: 280px;
}
@media (max-width: 768px) {
  .tab-subhead { flex-direction: column; align-items: stretch; }
  .tab-subhead-actions { justify-content: space-between; }
  .tab-subhead-search { width: 100%; min-width: 0; }
}

/* Input Group */
.input-group {
  display: flex;
  align-items: stretch;
}
.input-group .form-control {
  border-radius: 0;
  flex: 1;
}
.input-group .form-control:first-child { border-radius: var(--border-radius-sm) 0 0 var(--border-radius-sm); }
.input-group .form-control:last-child { border-radius: 0 var(--border-radius-sm) var(--border-radius-sm) 0; }
.input-group-addon {
  display: flex;
  align-items: center;
  padding: 0 12px;
  background: var(--gray-50);
  border: 1px solid var(--gray-300);
  color: var(--gray-500);
  font-size: var(--font-size-sm);
}
.input-group-addon:first-child { border-right: none; border-radius: var(--border-radius-sm) 0 0 var(--border-radius-sm); }
.input-group-addon:last-child { border-left: none; border-radius: 0 var(--border-radius-sm) var(--border-radius-sm) 0; }

/* Form Row */
.form-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-md);
}
.form-row.three { grid-template-columns: repeat(3, 1fr); }

/* Radio Group */
.radio-group { display: flex; gap: var(--space-lg); }
.radio-item {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: var(--font-size-sm);
}
.radio-item input { display: none; }
.radio-dot {
  width: 18px;
  height: 18px;
  border: 2px solid var(--gray-300);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}
.radio-dot::after {
  content: '';
  width: 10px;
  height: 10px;
  background: var(--primary);
  border-radius: 50%;
  transform: scale(0);
  transition: transform 0.2s;
}
.radio-item input:checked + .radio-dot { border-color: var(--primary); }
.radio-item input:checked + .radio-dot::after { transform: scale(1); }

/* Action Buttons in Table */
.action-btns {
  display: flex;
  gap: 4px;
  opacity: 0.7;
  transition: opacity 0.2s;
}
tr:hover .action-btns { opacity: 1; }
.action-btn {
  width: 28px;
  height: 28px;
  border: none;
  background: transparent;
  border-radius: 4px;
  cursor: pointer;
  color: var(--gray-500);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}
.action-btn:hover { background: var(--gray-100); color: var(--gray-700); }
.action-btn.edit:hover { color: var(--primary); }
.action-btn.delete:hover { color: var(--status-red); background: var(--status-red-bg); }
.action-btn.view:hover { color: var(--status-green); }

/* Responsive */
@media (max-width: 1024px) {
  .app-sidebar { width: var(--sidebar-collapsed); }
  .sidebar-brand span, .nav-item span, .nav-section { display: none; }
  .nav-item { justify-content: center; padding: 12px; }
  .header-search { width: 250px; }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  .app-sidebar { 
    position: fixed;
    left: -260px;
    z-index: 100;
    width: var(--sidebar-width);
    transition: left 0.3s;
  }
  .app-sidebar.open { left: 0; }
  .sidebar-brand span, .nav-item span, .nav-section { display: block; }
  .nav-item { justify-content: flex-start; }
  .header-search { display: none; }
  .stat-cards { grid-template-columns: 1fr 1fr; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .facility-grid { grid-template-columns: 1fr; }
  .patient-header { flex-direction: column; gap: var(--space-md); text-align: center; }
  .patient-actions { width: 100%; }
  .patient-actions .btn { flex: 1; }
}

/* ============================================
   MODERN AESTHETICS ENHANCEMENTS v2.1.4
   ============================================ */

/* Enhanced Card Styling */
.card {
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
  box-shadow: 0 8px 25px -5px rgba(0, 0, 0, 0.08), 0 4px 10px -3px rgba(0, 0, 0, 0.04);
}

/* Glass Morphism Modal */
.modal-overlay {
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.modal {
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

/* Enhanced Buttons with Micro-interactions */
.btn {
  position: relative;
  overflow: hidden;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(180deg, rgba(255,255,255,0.1) 0%, rgba(255,255,255,0) 100%);
  opacity: 0;
  transition: opacity 0.2s;
}

.btn:hover::before {
  opacity: 1;
}

.btn-primary {
  background: linear-gradient(180deg, #0077E6 0%, var(--primary) 100%);
  box-shadow: 0 2px 4px rgba(0, 102, 204, 0.2), inset 0 1px 0 rgba(255,255,255,0.1);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 102, 204, 0.3), inset 0 1px 0 rgba(255,255,255,0.1);
}

.btn-primary:active {
  transform: translateY(0);
  box-shadow: 0 1px 2px rgba(0, 102, 204, 0.2);
}

.btn-success {
  background: linear-gradient(180deg, #34D058 0%, var(--status-green) 100%);
  box-shadow: 0 2px 4px rgba(40, 167, 69, 0.2);
}

.btn-success:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(40, 167, 69, 0.3);
}

.btn-danger {
  background: linear-gradient(180deg, #EF4444 0%, var(--status-red) 100%);
  box-shadow: 0 2px 4px rgba(220, 38, 38, 0.2);
}

.btn-danger:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(220, 38, 38, 0.3);
}

/* Enhanced Stat Cards */
.stat-card {
  background: linear-gradient(135deg, var(--white) 0%, var(--gray-50) 100%);
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 100px;
  height: 100px;
  background: radial-gradient(circle at top right, rgba(0, 102, 204, 0.05) 0%, transparent 70%);
  pointer-events: none;
}

.stat-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 30px -8px rgba(0, 0, 0, 0.12);
}

.stat-card .value {
  background: linear-gradient(135deg, var(--gray-900) 0%, var(--gray-700) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Enhanced Sidebar with Gradient */
.app-sidebar {
  background: linear-gradient(180deg, #002244 0%, var(--secondary) 100%);
}

.sidebar-brand {
  background: linear-gradient(180deg, rgba(0,0,0,0.2) 0%, rgba(0,0,0,0.1) 100%);
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.nav-item.active {
  background: linear-gradient(90deg, var(--primary) 0%, #0077E6 100%);
  box-shadow: 0 2px 8px rgba(0, 102, 204, 0.3);
}

/* Enhanced Header */
.app-header {
  background: linear-gradient(180deg, var(--white) 0%, var(--gray-50) 100%);
  border-bottom: 1px solid var(--gray-100);
}

/* Enhanced Form Inputs */
.form-control {
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(0, 102, 204, 0.08), 0 1px 2px rgba(0, 0, 0, 0.05);
}

/* Enhanced Search Input */
.search-input {
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.search-input:focus {
  background: var(--white);
  box-shadow: 0 0 0 4px rgba(0, 102, 204, 0.08), 0 4px 12px rgba(0, 0, 0, 0.08);
}

/* Enhanced Table Rows */
.table tbody tr {
  transition: all 0.15s ease;
}

.table tbody tr:hover {
  background: linear-gradient(90deg, var(--gray-50) 0%, transparent 100%);
}

/* Enhanced Filter Pills */
.filter-pill {
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.filter-pill:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.filter-pill.active {
  background: linear-gradient(135deg, var(--primary-bg) 0%, var(--primary-light) 100%);
  box-shadow: 0 2px 8px rgba(0, 102, 204, 0.15);
}

/* Enhanced Quick Action Cards */
.quick-action-card {
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.quick-action-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 24px -8px rgba(0, 0, 0, 0.12);
  border-color: var(--primary-light);
}

.quick-action-icon {
  transition: transform 0.2s ease;
}

.quick-action-card:hover .quick-action-icon {
  transform: scale(1.05);
}

/* Enhanced Facility Cards */
.facility-card {
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.facility-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 20px 40px -12px rgba(0, 0, 0, 0.15);
}

.facility-banner {
  position: relative;
  overflow: hidden;
}

.facility-banner::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(180deg, rgba(0,0,0,0) 0%, rgba(0,0,0,0.3) 100%);
}

/* Enhanced Bed Cards */
.bed-card {
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.bed-card:hover {
  transform: translateY(-2px);
}

.bed-card.available {
  background: linear-gradient(135deg, var(--white) 0%, #F0FDF4 100%);
}

.bed-card.available:hover {
  box-shadow: 0 8px 24px -4px rgba(34, 197, 94, 0.2);
}

/* Enhanced Progress Bars */
.segment-bar {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.segment-bar.filled.green {
  background: linear-gradient(180deg, #34D399 0%, var(--status-green) 100%);
}

.segment-bar.filled.yellow {
  background: linear-gradient(180deg, #FBBF24 0%, var(--status-yellow) 100%);
}

.segment-bar.filled.red {
  background: linear-gradient(180deg, #F87171 0%, var(--status-red) 100%);
}

/* Enhanced Domain Score Bars */
.domain-bar-fill {
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Enhanced Timeline */
.timeline-dot {
  box-shadow: 0 0 0 4px var(--white), 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Enhanced Notifications */
.notification {
  border: 1px solid rgba(0, 0, 0, 0.05);
}

/* Enhanced User Avatar */
.user-avatar {
  background: linear-gradient(135deg, var(--primary) 0%, #0077E6 100%);
  box-shadow: 0 2px 8px rgba(0, 102, 204, 0.3);
}

/* Page Load Animation */
.app-content {
  animation: pageLoad 0.4s ease-out;
}

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

/* Smooth Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--gray-100);
}

::-webkit-scrollbar-thumb {
  background: var(--gray-300);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--gray-400);
}

/* Focus Visible Enhancement */
:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* Selection Color */
::selection {
  background: var(--primary-light);
  color: var(--primary);
}

/* ============================================
   Rich Text Editor Styles
   ============================================ */

/* Editor Toolbar */
.editor-toolbar {
  display: flex;
  gap: 4px;
  padding: 8px;
  background: var(--gray-50);
  border: 1px solid var(--gray-300);
  border-bottom: none;
  border-radius: var(--border-radius-sm) var(--border-radius-sm) 0 0;
  flex-wrap: wrap;
}

.editor-toolbar button {
  width: 32px;
  height: 32px;
  border: none;
  background: var(--white);
  border-radius: var(--border-radius-sm);
  cursor: pointer;
  color: var(--gray-700);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  font-size: 14px;
}

.editor-toolbar button:hover {
  background: var(--gray-200);
  color: var(--gray-900);
}

.editor-toolbar button:active {
  background: var(--gray-300);
  transform: scale(0.95);
}

.editor-toolbar .separator {
  width: 1px;
  height: 24px;
  background: var(--gray-300);
  margin: 4px 4px;
}

/* Editor Content Area */
.editor-content {
  min-height: 300px;
  max-height: 500px;
  overflow-y: auto;
  padding: 16px;
  background: var(--white);
  border: 1px solid var(--gray-300);
  border-radius: 0 0 var(--border-radius-sm) var(--border-radius-sm);
  font-family: var(--font-sans);
  font-size: var(--font-size-sm);
  line-height: 1.6;
  color: var(--gray-800);
  outline: none;
}

.editor-content:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.1);
}

.editor-content:empty:before {
  content: 'Enter your email content here...';
  color: var(--gray-400);
  pointer-events: none;
}

/* Editor Content Styling */
.editor-content p {
  margin: 0 0 12px 0;
}

.editor-content p:last-child {
  margin-bottom: 0;
}

.editor-content h1, 
.editor-content h2, 
.editor-content h3, 
.editor-content h4 {
  margin: 16px 0 8px 0;
  font-weight: 600;
}

.editor-content h1 { font-size: 24px; }
.editor-content h2 { font-size: 20px; }
.editor-content h3 { font-size: 18px; }
.editor-content h4 { font-size: 16px; }

.editor-content ul,
.editor-content ol {
  margin: 12px 0;
  padding-left: 24px;
}

.editor-content li {
  margin: 4px 0;
}

.editor-content a {
  color: var(--primary);
  text-decoration: underline;
}

.editor-content a:hover {
  color: var(--primary-hover);
}

.editor-content strong {
  font-weight: 600;
}

.editor-content em {
  font-style: italic;
}

.editor-content u {
  text-decoration: underline;
}

.editor-content blockquote {
  border-left: 3px solid var(--primary);
  padding-left: 16px;
  margin: 16px 0;
  color: var(--gray-600);
  font-style: italic;
}

/* Variable Tags in Editor */
.editor-content .variable-tag,
.variable-tag {
  display: inline-block;
  padding: 2px 8px;
  background: var(--primary-bg);
  color: var(--primary);
  border-radius: 4px;
  font-family: ui-monospace, monospace;
  font-size: 12px;
  font-weight: 500;
  border: 1px solid var(--primary-light);
  cursor: pointer;
}

.variable-tag:hover {
  background: var(--primary-light);
}

/* Available Variables Section */
.available-variables {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.available-variables .tag {
  display: inline-block;
  padding: 4px 10px;
  background: var(--gray-100);
  color: var(--gray-700);
  border-radius: 4px;
  font-family: ui-monospace, monospace;
  font-size: 12px;
  font-weight: 500;
  border: 1px solid var(--gray-300);
  cursor: pointer;
  transition: all 0.2s;
}

.available-variables .tag:hover {
  background: var(--primary-bg);
  color: var(--primary);
  border-color: var(--primary);
  transform: translateY(-1px);
}

/* Radio Group Styling */
.radio-group {
  display: flex;
  gap: 24px;
  align-items: center;
}

.radio-item {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: var(--font-size-sm);
  color: var(--gray-700);
  font-weight: 500;
}

.radio-item input[type="radio"] {
  appearance: none;
  width: 18px;
  height: 18px;
  border: 2px solid var(--gray-300);
  border-radius: 50%;
  outline: none;
  cursor: pointer;
  position: relative;
  transition: all 0.2s;
}

.radio-item input[type="radio"]:checked {
  border-color: var(--primary);
  background: var(--primary);
}

.radio-item input[type="radio"]:checked::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 6px;
  height: 6px;
  background: white;
  border-radius: 50%;
}

.radio-item:hover input[type="radio"] {
  border-color: var(--primary);
}

/* Print Styles */
@media print {
  .app-sidebar,
  .app-header,
  .btn {
    display: none !important;
  }
  .app-main {
    margin: 0;
    padding: 20px;
  }
  .card {
    box-shadow: none;
    border: 1px solid #ddd;
  }
}
