/*
 * AgendaClínica Design System
 * Sistema de diseño unificado con identidad visual médica moderna
 * Inspirado en Doctolib, Zocdoc y Oscar Health
 */

/* ============================================
   CSS VARIABLES - DESIGN TOKENS
   ============================================ */

:root {
  /* ─────────────────────────────────────────
     COLORES PRIMARIOS - Emerald/Teal 2026
     ───────────────────────────────────────── */

  /* Teal/Emerald - Color principal de marca */
  --medical-primary: hsl(168, 76%, 36%);
  /* #0d9488 */
  --medical-primary-dark: hsl(168, 80%, 28%);
  /* #0f766e */
  --medical-primary-darker: hsl(168, 82%, 22%);
  /* #115e59 */
  --medical-primary-light: hsl(168, 70%, 45%);
  /* #14b8a6 */
  --medical-primary-lighter: hsl(168, 60%, 55%);
  /* #2dd4bf */
  --medical-primary-bg: hsl(168, 76%, 97%);
  /* #ccfbf1 */
  --medical-primary-bg-subtle: hsl(168, 30%, 94%);
  /* #e6f5f3 */

  /* Acento - Teal cálido */
  --medical-accent: hsl(174, 62%, 47%);
  /* #0d9488 */
  --medical-accent-dark: hsl(174, 65%, 38%);
  /* #0f766e */
  --medical-accent-light: hsl(174, 55%, 55%);
  /* #2dd4bf */
  --medical-accent-bg: hsl(174, 50%, 95%);
  /* #ccfbf1 */
  --medical-accent-bg-subtle: hsl(174, 40%, 97%);

  /* Secundario - Sage */
  --secondary: hsl(168, 30%, 94%);
  --secondary-foreground: hsl(168, 76%, 26%);

  /* ─────────────────────────────────────────
     COLORES SEMÁNTICOS - Estados
     ───────────────────────────────────────── */

  /* Estados de citas */
  --status-scheduled: #3b82f6;
  --status-scheduled-bg: #dbeafe;
  --status-confirmed: hsl(168, 76%, 36%);
  --status-confirmed-bg: hsl(168, 76%, 97%);
  --status-completed: #6366f1;
  --status-completed-bg: #e0e7ff;
  --status-cancelled: hsl(0, 72%, 51%);
  --status-cancelled-bg: #fee2e2;
  --status-pending: #f59e0b;
  --status-pending-bg: #fef3c7;
  --status-no-show: hsl(210, 15%, 45%);
  --status-no-show-bg: hsl(210, 20%, 96%);

  /* Estados de UI */
  --success: hsl(168, 76%, 36%);
  --success-bg: hsl(168, 76%, 97%);
  --warning: #f59e0b;
  --warning-bg: #fef3c7;
  --error: hsl(0, 72%, 51%);
  --error-bg: #fee2e2;
  --info: #3b82f6;
  --info-bg: #dbeafe;

  /* Ring / focus */
  --ring: hsl(168, 76%, 36%);

  /* ─────────────────────────────────────────
     COLORES NEUTRALES - Grises 2026
     ───────────────────────────────────────── */

  /* Grises */
  --gray-50: hsl(210, 40%, 98%);
  --gray-100: hsl(210, 40%, 96%);
  --gray-200: hsl(210, 30%, 91%);
  --gray-300: hsl(210, 20%, 82%);
  --gray-400: hsl(210, 15%, 65%);
  --gray-500: hsl(210, 15%, 45%);
  --gray-600: hsl(210, 20%, 35%);
  --gray-700: hsl(210, 25%, 25%);
  --gray-800: hsl(210, 30%, 15%);
  --gray-900: hsl(210, 40%, 10%);

  /* Backgrounds */
  --bg-primary: hsl(0, 0%, 100%);
  /* #ffffff */
  --bg-secondary: hsl(210, 20%, 98%);
  /* #f8fafc */
  --bg-tertiary: hsl(210, 20%, 96%);
  /* #f1f5f9 */
  --bg-medical: hsl(168, 76%, 97%);
  --bg-hover: hsl(210, 20%, 96%);
  --bg-active: hsl(210, 30%, 91%);

  /* Texto */
  --text-primary: hsl(210, 40%, 10%);
  /* #0f172a */
  --text-secondary: hsl(210, 20%, 35%);
  --text-tertiary: hsl(210, 15%, 45%);
  /* #64748b */
  --text-muted: hsl(210, 15%, 45%);
  /* #64748b */
  --text-inverse: hsl(0, 0%, 100%);
  /* #ffffff */

  /* Bordes */
  --border-light: hsl(210, 20%, 90%);
  --border-default: hsl(210, 20%, 82%);
  --border-dark: hsl(210, 15%, 65%);
  --border-focus: var(--medical-primary);

  /* ─────────────────────────────────────────
     GRADIENTES 2026
     ───────────────────────────────────────── */

  --gradient-medical: linear-gradient(135deg, hsl(168, 76%, 36%) 0%, hsl(174, 62%, 47%) 100%);
  --gradient-medical-subtle: linear-gradient(135deg, hsl(168, 76%, 97%) 0%, hsl(174, 50%, 95%) 50%, hsl(210, 20%, 98%) 100%);
  --gradient-accent: linear-gradient(135deg, hsl(168, 76%, 36%) 0%, hsl(174, 55%, 55%) 100%);
  --gradient-header: linear-gradient(135deg, hsl(168, 80%, 28%) 0%, hsl(168, 76%, 36%) 100%);
  --gradient-card: linear-gradient(145deg, hsl(0, 0%, 100%) 0%, hsl(210, 40%, 98%) 100%);

  /* ─────────────────────────────────────────
     COLORES DE PROFESIONALES (Calendario)
     ───────────────────────────────────────── */

  --professional-teal: hsl(168, 70%, 45%);
  --professional-teal-bg: hsl(168, 76%, 97%);
  --professional-rose: #f43f5e;
  --professional-rose-bg: #ffe4e6;
  --professional-blue: #3b82f6;
  --professional-blue-bg: #dbeafe;
  --professional-green: #22c55e;
  --professional-green-bg: #dcfce7;
  --professional-orange: #f97316;
  --professional-orange-bg: #ffedd5;
  --professional-purple: #a855f7;
  --professional-purple-bg: #f3e8ff;
  --professional-cyan: hsl(174, 62%, 47%);
  --professional-cyan-bg: hsl(174, 50%, 95%);

  /* ─────────────────────────────────────────
     TIPOGRAFÍA
     ───────────────────────────────────────── */

  /* Font families */
  --font-primary: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-display: 'Plus Jakarta Sans', var(--font-primary);
  --font-mono: 'SF Mono', 'Fira Code', 'Consolas', monospace;

  /* Font sizes */
  --text-xs: 0.75rem;
  /* 12px */
  --text-sm: 0.875rem;
  /* 14px */
  --text-base: 1rem;
  /* 16px */
  --text-lg: 1.125rem;
  /* 18px */
  --text-xl: 1.25rem;
  /* 20px */
  --text-2xl: 1.5rem;
  /* 24px */
  --text-3xl: 1.875rem;
  /* 30px */
  --text-4xl: 2.25rem;
  /* 36px */

  /* Font weights */
  --font-normal: 400;
  --font-medium: 500;
  --font-semibold: 600;
  --font-bold: 700;

  /* Line heights */
  --leading-tight: 1.25;
  --leading-normal: 1.5;
  --leading-relaxed: 1.625;

  /* ─────────────────────────────────────────
     ESPACIADO
     ───────────────────────────────────────── */

  --space-0: 0;
  --space-1: 0.25rem;
  /* 4px */
  --space-2: 0.5rem;
  /* 8px */
  --space-3: 0.75rem;
  /* 12px */
  --space-4: 1rem;
  /* 16px */
  --space-5: 1.25rem;
  /* 20px */
  --space-6: 1.5rem;
  /* 24px */
  --space-8: 2rem;
  /* 32px */
  --space-10: 2.5rem;
  /* 40px */
  --space-12: 3rem;
  /* 48px */
  --space-16: 4rem;
  /* 64px */

  /* ─────────────────────────────────────────
     BORDER RADIUS
     ───────────────────────────────────────── */

  --radius-sm: 0.25rem;
  /* 4px */
  --radius-md: 0.5rem;
  /* 8px */
  --radius-lg: 0.75rem;
  /* 12px */
  --radius-xl: 1rem;
  /* 16px */
  --radius-2xl: 1.5rem;
  /* 24px */
  --radius-full: 9999px;

  /* ─────────────────────────────────────────
     SOMBRAS
     ───────────────────────────────────────── */

  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
  --shadow-2xl: 0 25px 50px -12px rgb(0 0 0 / 0.25);
  --shadow-inner: inset 0 2px 4px 0 rgb(0 0 0 / 0.05);
  --shadow-focus: 0 0 0 3px hsla(168, 76%, 36%, 0.2);

  /* ─────────────────────────────────────────
     TRANSICIONES
     ───────────────────────────────────────── */

  --transition-fast: 150ms ease;
  --transition-base: 200ms ease;
  --transition-slow: 300ms ease;
  --transition-slower: 500ms ease;

  /* ─────────────────────────────────────────
     LAYOUT
     ───────────────────────────────────────── */

  --sidebar-width: 260px;
  --sidebar-collapsed-width: 72px;
  --header-height: 64px;
  --content-max-width: 1400px;

  /* Z-index scale */
  --z-dropdown: 100;
  --z-sticky: 200;
  --z-fixed: 300;
  --z-modal-backdrop: 400;
  --z-modal: 500;
  --z-popover: 600;
  --z-tooltip: 700;
  --z-toast: 800;
}

/* ============================================
   BASE STYLES
   ============================================ */

/* Global Stealth Scrollbars (macOS Style) */
* {
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 0, 0, 0.2) transparent;
}

/* Chrome, Edge, and Safari */
*::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

*::-webkit-scrollbar-track {
  background: transparent;
}

*::-webkit-scrollbar-thumb {
  background-color: rgba(0, 0, 0, 0.1);
  border-radius: 20px;
  border: transparent;
}

*::-webkit-scrollbar-thumb:hover {
  background-color: rgba(0, 0, 0, 0.2);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  height: 100%;
}

body {
  font-family: var(--font-primary);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  color: var(--text-primary);
  background-color: var(--bg-secondary);
  min-height: 100%;
  margin: 0;
  padding: 0;
}

/* Dashboard-specific: prevent body scroll when dashboard handles it */
body.dashboard-body {
  height: 100%;
  overflow: hidden;
}

/* ============================================
   TYPOGRAPHY UTILITIES
   ============================================ */

.text-xs {
  font-size: var(--text-xs);
}

.text-sm {
  font-size: var(--text-sm);
}

.text-base {
  font-size: var(--text-base);
}

.text-lg {
  font-size: var(--text-lg);
}

.text-xl {
  font-size: var(--text-xl);
}

.text-2xl {
  font-size: var(--text-2xl);
}

.text-3xl {
  font-size: var(--text-3xl);
}

.font-normal {
  font-weight: var(--font-normal);
}

.font-medium {
  font-weight: var(--font-medium);
}

.font-semibold {
  font-weight: var(--font-semibold);
}

.font-bold {
  font-weight: var(--font-bold);
}

.text-primary {
  color: var(--text-primary);
}

.text-secondary {
  color: var(--text-secondary);
}

.text-muted {
  color: var(--text-muted);
}

.text-medical {
  color: var(--medical-primary);
}

.text-accent {
  color: var(--medical-accent);
}

/* ============================================
   BUTTON COMPONENTS
   ============================================ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  font-family: var(--font-primary);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  line-height: var(--leading-normal);
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition-base);
  text-decoration: none;
  white-space: nowrap;
}

.btn:focus-visible {
  outline: none;
  box-shadow: var(--shadow-focus);
}

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

/* Primary Button - Medical Cyan */
.btn-primary {
  background: var(--medical-primary);
  color: var(--text-inverse);
  border-color: var(--medical-primary);
}

.btn-primary:hover:not(:disabled) {
  background: var(--medical-primary-dark);
  border-color: var(--medical-primary-dark);
}

.btn-primary:active:not(:disabled) {
  background: var(--medical-primary-darker);
}

/* Secondary Button */
.btn-secondary {
  background: var(--bg-primary);
  color: var(--text-primary);
  border-color: var(--border-default);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--bg-hover);
  border-color: var(--border-dark);
}

/* Accent Button - Green */
.btn-accent {
  background: var(--medical-accent);
  color: var(--text-inverse);
  border-color: var(--medical-accent);
}

.btn-accent:hover:not(:disabled) {
  background: var(--medical-accent-dark);
  border-color: var(--medical-accent-dark);
}

/* Danger Button */
.btn-danger {
  background: var(--error);
  color: var(--text-inverse);
  border-color: var(--error);
}

.btn-danger:hover:not(:disabled) {
  background: #dc2626;
  border-color: #dc2626;
}

/* Ghost Button */
.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: transparent;
}

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

/* Button Sizes */
.btn-sm {
  padding: var(--space-1) var(--space-3);
  font-size: var(--text-xs);
}

.btn-lg {
  padding: var(--space-3) var(--space-6);
  font-size: var(--text-base);
}

/* ============================================
   FORM COMPONENTS
   ============================================ */

.form-group {
  margin-bottom: var(--space-4);
}

.form-label {
  display: block;
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--text-primary);
  margin-bottom: var(--space-2);
}

.form-label .required {
  color: var(--error);
  margin-left: var(--space-1);
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: var(--space-2) var(--space-3);
  font-family: var(--font-primary);
  font-size: var(--text-sm);
  line-height: var(--leading-normal);
  color: var(--text-primary);
  background-color: var(--bg-primary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  transition: border-color var(--transition-base), box-shadow var(--transition-base);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--medical-primary);
  box-shadow: var(--shadow-focus);
}

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

.form-input:disabled {
  background-color: var(--bg-tertiary);
  cursor: not-allowed;
}

.form-hint {
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-top: var(--space-1);
}

.form-error {
  font-size: var(--text-xs);
  color: var(--error);
  margin-top: var(--space-1);
}

/* ============================================
   CARD COMPONENTS
   ============================================ */

.card {
  background: var(--bg-primary);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-sm);
}

.card-header {
  padding: var(--space-4) var(--space-6);
  border-bottom: 1px solid var(--border-light);
}

.card-title {
  font-size: var(--text-lg);
  font-weight: var(--font-semibold);
  color: var(--text-primary);
  margin: 0;
}

.card-body {
  padding: var(--space-6);
}

.card-footer {
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid var(--border-light);
  background: var(--bg-secondary);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* Medical Card Variant */
.card-medical {
  border-left: 4px solid var(--medical-primary);
}

.card-medical .card-header {
  background: var(--medical-primary-bg);
}

/* ============================================
   STATUS BADGES
   ============================================ */

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-3);
  font-size: var(--text-xs);
  font-weight: var(--font-medium);
  border-radius: var(--radius-full);
  white-space: nowrap;
}

.status-badge-dot {
  width: 6px;
  height: 6px;
  border-radius: var(--radius-full);
}

.status-scheduled {
  background: var(--status-scheduled-bg);
  color: var(--status-scheduled);
}

.status-scheduled .status-badge-dot {
  background: var(--status-scheduled);
}

.status-confirmed {
  background: var(--status-confirmed-bg);
  color: var(--status-confirmed);
}

.status-confirmed .status-badge-dot {
  background: var(--status-confirmed);
}

.status-completed {
  background: var(--status-completed-bg);
  color: var(--status-completed);
}

.status-completed .status-badge-dot {
  background: var(--status-completed);
}

.status-cancelled {
  background: var(--status-cancelled-bg);
  color: var(--status-cancelled);
}

.status-cancelled .status-badge-dot {
  background: var(--status-cancelled);
}

.status-pending {
  background: var(--status-pending-bg);
  color: var(--status-pending);
}

.status-pending .status-badge-dot {
  background: var(--status-pending);
}

.status-no-show {
  background: var(--status-no-show-bg);
  color: var(--status-no-show);
}

.status-no-show .status-badge-dot {
  background: var(--status-no-show);
}

/* ============================================
   METRIC CARDS
   ============================================ */

.metric-card {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-5);
  background: var(--bg-primary);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition-base);
}

.metric-card:hover {
  box-shadow: var(--shadow-md);
}

.metric-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: var(--radius-lg);
  flex-shrink: 0;
}

.metric-icon svg {
  width: 24px;
  height: 24px;
}

.metric-icon--primary {
  background: var(--medical-primary-bg);
  color: var(--medical-primary);
}

.metric-icon--accent {
  background: var(--medical-accent-bg);
  color: var(--medical-accent);
}

.metric-icon--warning {
  background: var(--warning-bg);
  color: var(--warning);
}

.metric-icon--info {
  background: var(--info-bg);
  color: var(--info);
}

.metric-content {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.metric-value {
  font-size: var(--text-2xl);
  font-weight: var(--font-bold);
  color: var(--text-primary);
  line-height: 1;
}

.metric-label {
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

.metric-trend {
  font-size: var(--text-xs);
  font-weight: var(--font-medium);
}

.metric-trend--up {
  color: var(--medical-accent);
}

.metric-trend--down {
  color: var(--error);
}

/* ============================================
   PROFESSIONAL BADGE
   ============================================ */

.professional-badge {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.professional-avatar {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  color: var(--text-inverse);
  flex-shrink: 0;
}

.professional-avatar--gradient {
  background: var(--gradient-medical);
}

.professional-avatar--teal {
  background: var(--professional-teal);
}

.professional-avatar--rose {
  background: var(--professional-rose);
}

.professional-avatar--blue {
  background: var(--professional-blue);
}

.professional-avatar--green {
  background: var(--professional-green);
}

.professional-avatar--orange {
  background: var(--professional-orange);
}

.professional-avatar--purple {
  background: var(--professional-purple);
}

.professional-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.professional-name {
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.professional-specialty {
  font-size: var(--text-xs);
  color: var(--text-muted);
}

/* ============================================
   EMPTY STATE
   ============================================ */

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-12) var(--space-6);
  text-align: center;
}

.empty-state-icon {
  width: 64px;
  height: 64px;
  margin-bottom: var(--space-4);
  color: var(--text-muted);
}

.empty-state-title {
  font-size: var(--text-lg);
  font-weight: var(--font-semibold);
  color: var(--text-primary);
  margin-bottom: var(--space-2);
}

.empty-state-description {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  max-width: 400px;
  margin-bottom: var(--space-6);
}

/* ============================================
   UTILITY CLASSES
   ============================================ */

.hidden {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Spacing utilities */
.mt-0 {
  margin-top: var(--space-0);
}

.mt-2 {
  margin-top: var(--space-2);
}

.mt-4 {
  margin-top: var(--space-4);
}

.mt-6 {
  margin-top: var(--space-6);
}

.mb-0 {
  margin-bottom: var(--space-0);
}

.mb-2 {
  margin-bottom: var(--space-2);
}

.mb-4 {
  margin-bottom: var(--space-4);
}

.mb-6 {
  margin-bottom: var(--space-6);
}

.p-4 {
  padding: var(--space-4);
}

.p-6 {
  padding: var(--space-6);
}

.px-4 {
  padding-left: var(--space-4);
  padding-right: var(--space-4);
}

.py-2 {
  padding-top: var(--space-2);
  padding-bottom: var(--space-2);
}

/* Flex utilities */
.flex {
  display: flex;
}

.flex-col {
  flex-direction: column;
}

.items-center {
  align-items: center;
}

.justify-between {
  justify-content: space-between;
}

.gap-2 {
  gap: var(--space-2);
}

.gap-4 {
  gap: var(--space-4);
}

.gap-6 {
  gap: var(--space-6);
}

/* Grid utilities */
.grid {
  display: grid;
}

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

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

.grid-cols-4 {
  grid-template-columns: repeat(4, 1fr);
}

@media (max-width: 768px) {

  .grid-cols-2,
  .grid-cols-3,
  .grid-cols-4 {
    grid-template-columns: 1fr;
  }
}

/* ============================================
   MEDICAL BRANDING ELEMENTS
   ============================================ */

.medical-header {
  background: var(--gradient-medical);
  color: var(--text-inverse);
  padding: var(--space-6);
  border-radius: var(--radius-lg);
}

.medical-accent-bar {
  height: 4px;
  background: var(--gradient-medical);
  border-radius: var(--radius-full);
}

.medical-highlight {
  background: var(--medical-primary-bg);
  border-left: 3px solid var(--medical-primary);
  padding: var(--space-3) var(--space-4);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
}

/* ============================================
   GLASSMORPHISM 2026
   ============================================ */

/* Glass Variables */
:root {
  --glass-bg: rgba(255, 255, 255, 0.7);
  --glass-bg-strong: rgba(255, 255, 255, 0.85);
  --glass-border: rgba(255, 255, 255, 0.5);
  --glass-blur: 12px;
  --glass-blur-strong: 20px;
  --shadow-glass: 0 8px 32px hsla(168, 76%, 36%, 0.08);
  --shadow-glass-hover: 0 12px 40px hsla(168, 76%, 36%, 0.12);
  --shadow-colored: 0 4px 24px hsla(168, 76%, 36%, 0.15);
  --shadow-colored-accent: 0 4px 24px hsla(174, 62%, 47%, 0.15);
}

/* Glass Card Component */
.glass-card {
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-glass);
  transition: all var(--transition-base);
}

.glass-card:hover {
  box-shadow: var(--shadow-glass-hover);
  transform: translateY(-2px);
}

.glass-card-strong {
  background: var(--glass-bg-strong);
  backdrop-filter: blur(var(--glass-blur-strong));
  -webkit-backdrop-filter: blur(var(--glass-blur-strong));
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-glass);
}

/* ============================================
   COMPACT METRICS 2026
   ============================================ */

.metrics-compact {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-3);
  margin-bottom: var(--space-6);
}

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

@media (max-width: 480px) {
  .metrics-compact {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-2);
  }
}

.metric-compact {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4);
  background: var(--bg-primary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  transition: all var(--transition-base);
}

.metric-compact:hover {
  border-color: var(--medical-primary);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.metric-compact-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.metric-compact-icon--primary {
  background: var(--gradient-medical);
  color: var(--text-inverse);
}

.metric-compact-icon--accent {
  background: var(--gradient-accent);
  color: var(--text-inverse);
}

.metric-compact-icon--warning {
  background: linear-gradient(135deg, #f59e0b 0%, #fbbf24 100%);
  color: var(--text-inverse);
}

.metric-compact-icon--info {
  background: linear-gradient(135deg, #3b82f6 0%, #60a5fa 100%);
  color: var(--text-inverse);
}

.metric-compact-content {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.metric-compact-value {
  font-size: var(--text-2xl);
  font-weight: var(--font-bold);
  color: var(--text-primary);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.metric-compact-label {
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Compact donut for rate */
.metric-compact-rate {
  position: relative;
  width: 40px;
  height: 40px;
  flex-shrink: 0;
}

.metric-compact-donut {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.metric-compact-donut .donut-bg {
  fill: none;
  stroke: var(--bg-tertiary);
  stroke-width: 4;
}

.metric-compact-donut .donut-progress {
  fill: none;
  stroke: var(--medical-accent);
  stroke-width: 4;
  stroke-linecap: round;
  transition: stroke-dasharray 0.5s ease;
}

.metric-compact-rate-value {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 9px;
  font-weight: var(--font-bold);
  color: var(--text-primary);
}

@media (max-width: 480px) {
  .metric-compact {
    padding: var(--space-3);
    gap: var(--space-2);
  }

  .metric-compact-icon,
  .metric-compact-rate {
    width: 36px;
    height: 36px;
  }

  .metric-compact-icon svg {
    width: 18px;
    height: 18px;
  }

  .metric-compact-value {
    font-size: var(--text-xl);
  }

  .metric-compact-rate-value {
    font-size: 8px;
  }
}

/* ============================================
   METRIC CARDS 2026
   ============================================ */

.metric-2026 {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  height: 100%;
}

.metric-2026-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}

.metric-2026-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.metric-2026-icon::before {
  content: '';
  position: absolute;
  inset: 0;
  background: inherit;
  filter: blur(8px);
  opacity: 0.5;
  z-index: -1;
}

.metric-2026-icon--primary {
  background: var(--gradient-medical);
  color: var(--text-inverse);
  box-shadow: var(--shadow-colored);
}

.metric-2026-icon--accent {
  background: var(--gradient-accent);
  color: var(--text-inverse);
  box-shadow: var(--shadow-colored-accent);
}

.metric-2026-icon--warning {
  background: linear-gradient(135deg, #f59e0b 0%, #fbbf24 100%);
  color: var(--text-inverse);
  box-shadow: 0 4px 24px rgba(245, 158, 11, 0.25);
}

.metric-2026-icon--info {
  background: linear-gradient(135deg, #3b82f6 0%, #60a5fa 100%);
  color: var(--text-inverse);
  box-shadow: 0 4px 24px rgba(59, 130, 246, 0.25);
}

.metric-2026-trend {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  font-size: var(--text-xs);
  font-weight: var(--font-medium);
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-full);
}

.metric-2026-trend--up {
  background: var(--medical-accent-bg);
  color: var(--medical-accent);
}

.metric-2026-trend--down {
  background: var(--error-bg);
  color: var(--error);
}

.metric-2026-trend--neutral {
  background: var(--bg-tertiary);
  color: var(--text-muted);
}

.metric-2026-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.metric-2026-value {
  font-size: var(--text-4xl);
  font-weight: var(--font-bold);
  color: var(--text-primary);
  line-height: 1;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

.metric-2026-label {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin-top: var(--space-1);
}

.metric-2026-sublabel {
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-top: var(--space-1);
}

/* Sparkline container */
.metric-sparkline {
  height: 40px;
  margin-top: var(--space-3);
  display: flex;
  align-items: flex-end;
  gap: 2px;
}

.sparkline-bar {
  flex: 1;
  background: var(--medical-primary);
  border-radius: 2px 2px 0 0;
  opacity: 0.3;
  transition: opacity var(--transition-base);
}

.sparkline-bar:last-child {
  opacity: 1;
}

.sparkline-bar:hover {
  opacity: 1;
}

/* Donut Chart */
.donut-chart {
  width: 100%;
  aspect-ratio: 1;
  max-width: 120px;
  margin: 0 auto;
  position: relative;
}

.donut-chart-svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.donut-chart-bg {
  fill: none;
  stroke: var(--bg-tertiary);
  stroke-width: 8;
}

.donut-chart-progress {
  fill: none;
  stroke: var(--medical-accent);
  stroke-width: 8;
  stroke-linecap: round;
  transition: stroke-dasharray 1s ease-out;
}

.donut-chart-center {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
}

.donut-chart-value {
  font-size: var(--text-2xl);
  font-weight: var(--font-bold);
  color: var(--text-primary);
  line-height: 1;
}

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

/* ============================================
   TIMELINE 2026
   ============================================ */

.timeline {
  display: flex;
  flex-direction: column;
  gap: 0;
  position: relative;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 11px;
  top: 24px;
  bottom: 24px;
  width: 2px;
  background: linear-gradient(to bottom, var(--medical-primary), var(--medical-primary-light));
  border-radius: var(--radius-full);
}

.timeline-item {
  display: flex;
  align-items: flex-start;
  gap: var(--space-4);
  padding: var(--space-3) 0;
  position: relative;
  transition: all var(--transition-base);
}

.timeline-item:hover {
  background: var(--bg-hover);
  margin-left: calc(-1 * var(--space-3));
  margin-right: calc(-1 * var(--space-3));
  padding-left: var(--space-3);
  padding-right: var(--space-3);
  border-radius: var(--radius-md);
}

.timeline-dot {
  width: 24px;
  height: 24px;
  border-radius: var(--radius-full);
  background: var(--bg-primary);
  border: 3px solid var(--medical-primary);
  flex-shrink: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-base);
}

.timeline-item:hover .timeline-dot {
  background: var(--medical-primary);
  transform: scale(1.1);
}

.timeline-dot-inner {
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  background: var(--medical-primary);
  opacity: 0;
  transition: opacity var(--transition-base);
}

.timeline-item:hover .timeline-dot-inner {
  opacity: 1;
  background: var(--text-inverse);
}

.timeline-content {
  flex: 1;
  min-width: 0;
}

.timeline-time {
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  color: var(--medical-primary);
  margin-bottom: var(--space-1);
  font-variant-numeric: tabular-nums;
}

.timeline-title {
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--text-primary);
  margin-bottom: 2px;
}

.timeline-subtitle {
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.timeline-badge {
  margin-left: auto;
  flex-shrink: 0;
}

/* ============================================
   MICRO-ANIMATIONS 2026
   ============================================ */

/* Count-up animation base */
.count-up {
  display: inline-block;
}

/* Shimmer loading effect */
.shimmer {
  position: relative;
  overflow: hidden;
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
}

.shimmer::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(90deg,
      transparent,
      rgba(255, 255, 255, 0.5),
      transparent);
  animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
  0% {
    transform: translateX(-100%);
  }

  100% {
    transform: translateX(100%);
  }
}

/* Pulse animation */
.pulse {
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.5;
  }
}

/* Float animation */
.float {
  animation: float 3s ease-in-out infinite;
}

@keyframes float {

  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-4px);
  }
}

/* Fade in up animation */
.fade-in-up {
  animation: fadeInUp 0.5s ease-out forwards;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Stagger animations for lists */
.stagger-item {
  opacity: 0;
  animation: fadeInUp 0.4s ease-out forwards;
}

.stagger-item:nth-child(1) {
  animation-delay: 0.05s;
}

.stagger-item:nth-child(2) {
  animation-delay: 0.1s;
}

.stagger-item:nth-child(3) {
  animation-delay: 0.15s;
}

.stagger-item:nth-child(4) {
  animation-delay: 0.2s;
}

.stagger-item:nth-child(5) {
  animation-delay: 0.25s;
}

.stagger-item:nth-child(6) {
  animation-delay: 0.3s;
}

/* Scale on hover */
.hover-scale {
  transition: transform var(--transition-base);
}

.hover-scale:hover {
  transform: scale(1.02);
}

/* Lift on hover */
.hover-lift {
  transition: transform var(--transition-base), box-shadow var(--transition-base);
}

.hover-lift:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

/* ============================================
   QUICK ACTION PILLS 2026
   ============================================ */

.action-pills {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
}

.action-pill {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-5);
  background: var(--bg-primary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-full);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--text-primary);
  text-decoration: none;
  transition: all var(--transition-base);
  cursor: pointer;
}

.action-pill:hover {
  border-color: var(--medical-primary);
  background: var(--medical-primary-bg);
  color: var(--medical-primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.action-pill--primary {
  background: var(--gradient-medical);
  border-color: transparent;
  color: var(--text-inverse);
}

.action-pill--primary:hover {
  background: var(--gradient-header);
  box-shadow: var(--shadow-colored);
  transform: translateY(-2px);
}

.action-pill-icon {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ============================================
   WELCOME SECTION 2026
   ============================================ */

.welcome-2026 {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}

.welcome-avatar {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-full);
  background: var(--gradient-medical);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-inverse);
  font-size: var(--text-xl);
  font-weight: var(--font-bold);
  box-shadow: var(--shadow-colored);
  flex-shrink: 0;
}

.welcome-content {
  flex: 1;
  min-width: 0;
}

.welcome-greeting {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-1);
}

.welcome-greeting-icon {
  font-size: var(--text-xl);
}

.welcome-title {
  font-size: var(--text-2xl);
  font-weight: var(--font-bold);
  color: var(--text-primary);
  margin: 0;
}

.welcome-subtitle {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin: 0;
}

.welcome-insight {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  margin-top: var(--space-2);
  padding: var(--space-2) var(--space-3);
  background: var(--warning-bg);
  color: var(--warning);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: var(--font-medium);
}

.welcome-insight--success {
  background: var(--medical-accent-bg);
  color: var(--medical-accent);
}

/* ============================================
   FLOATING ACTION BUTTON 2026
   ============================================ */

.fab {
  position: fixed;
  bottom: var(--space-6);
  right: var(--space-6);
  width: 56px;
  height: 56px;
  border-radius: var(--radius-full);
  background: var(--gradient-medical);
  color: var(--text-inverse);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-lg), var(--shadow-colored);
  transition: all var(--transition-base);
  z-index: var(--z-fixed);
}

.fab:hover {
  transform: scale(1.1);
  box-shadow: var(--shadow-xl), 0 8px 32px hsla(168, 76%, 36%, 0.3);
}

.fab:active {
  transform: scale(0.95);
}

@media (min-width: 1024px) {
  .fab {
    display: none;
  }
}

/* ============================================
   DATA TABLES (Moved from Promotions)
   ============================================ */

.table-container {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th,
.data-table td {
  padding: var(--space-3) var(--space-4);
  text-align: left;
  font-size: var(--text-sm);
}

.data-table th {
  font-weight: var(--font-semibold);
  color: var(--text-secondary);
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-light);
}

.data-table td {
  color: var(--text-primary);
  border-bottom: 1px solid var(--border-light);
  vertical-align: middle;
}

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

.data-table tbody tr:last-child td {
  border-bottom: none;
}

.cell-main {
  font-weight: var(--font-medium);
  color: var(--text-primary);
}

.cell-sub {
  font-size: var(--text-xs);
  color: var(--text-secondary);
  margin-top: 2px;
}

.cell-with-icon {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.cell-with-icon svg {
  color: var(--text-muted);
  flex-shrink: 0;
}

.text-right {
  text-align: right;
}

.table-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-2);
}

/* Ensure button_to form wrappers don't break flex layout */
.table-actions form {
  display: inline;
  margin: 0;
  padding: 0;
}

.btn-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: all var(--transition-base);
}

.btn-icon:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.btn-icon-danger:hover {
  background: var(--error-bg);
  color: var(--error);
}

/* ============================================
   PAGE HEADER SECTION (Advanced)
   ============================================ */

.page-header-section {
  margin-bottom: var(--space-6);
}

.page-header-content {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
  flex-wrap: wrap;
}

.page-header-info {
  flex: 1;
}

.page-title {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-size: var(--text-2xl);
  font-weight: var(--font-bold);
  color: var(--text-primary);
  margin: 0 0 var(--space-2) 0;
}

.page-title-icon {
  color: var(--medical-primary);
}

.page-subtitle {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin: 0;
}

/* ============================================
   EMPTY STATE CARD
   ============================================ */

.empty-state-card {
  text-align: center;
  padding: var(--space-12) var(--space-6);
  background: var(--bg-primary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
}

/* ============================================
   SEARCH FORM INLINE
   ============================================ */

.search-form-inline {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}

.search-input {
  max-width: 280px;
}

.card-header-title {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  color: var(--text-primary);
}

.card-header-title svg {
  color: var(--medical-primary);
}

/* ============================================
   PHONE INPUT WITH COUNTRY SELECTOR
   Modern phone input component with flags
   ============================================ */

.phone-input-wrapper {
  position: relative;
  display: flex;
  align-items: stretch;
  width: 100%;
}

.phone-input-country-selector {
  position: relative;
  flex-shrink: 0;
}

.phone-input-country-button {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  height: 100%;
  min-height: 2.75rem;
  background-color: var(--bg-primary);
  border: 1px solid var(--border-light);
  border-right: none;
  border-radius: var(--radius-md) 0 0 var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-base);
  font-family: var(--font-primary);
  font-size: var(--text-sm);
  color: var(--text-primary);
}

.phone-input-country-button:hover {
  background-color: var(--bg-hover);
  border-color: var(--border-default);
}

.phone-input-country-button:focus {
  outline: none;
  border-color: var(--medical-primary);
  box-shadow: var(--shadow-focus);
  z-index: 1;
}

.phone-input-country-button .country-flag {
  font-size: 1.25rem;
  line-height: 1;
}

.phone-input-country-button .country-code {
  font-weight: var(--font-medium);
  color: var(--text-secondary);
}

.phone-input-country-button .dropdown-arrow {
  color: var(--text-muted);
  transition: transform var(--transition-base);
}

.phone-input-country-button[aria-expanded="true"] .dropdown-arrow {
  transform: rotate(180deg);
}

.phone-input-field {
  flex: 1;
  padding: var(--space-2) var(--space-3);
  min-height: 2.75rem;
  font-family: var(--font-primary);
  font-size: var(--text-sm);
  line-height: var(--leading-normal);
  color: var(--text-primary);
  background-color: var(--bg-primary);
  border: 1px solid var(--border-light);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  transition: border-color var(--transition-base), box-shadow var(--transition-base);
}

.phone-input-field:focus {
  outline: none;
  border-color: var(--medical-primary);
  box-shadow: var(--shadow-focus);
  z-index: 1;
}

.phone-input-field::placeholder {
  color: var(--text-muted);
}

/* Country Dropdown */
.phone-input-country-dropdown {
  position: absolute;
  top: calc(100% + var(--space-1));
  left: 0;
  z-index: var(--z-dropdown);
  min-width: 280px;
  max-width: 320px;
  background-color: var(--bg-primary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  overflow: hidden;
}

.phone-input-country-dropdown.hidden {
  display: none;
}

.phone-input-country-search {
  padding: var(--space-3);
  border-bottom: 1px solid var(--border-light);
}

.phone-input-country-search input {
  width: 100%;
  padding: var(--space-2) var(--space-3);
  font-family: var(--font-primary);
  font-size: var(--text-sm);
  color: var(--text-primary);
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  transition: border-color var(--transition-base);
}

.phone-input-country-search input:focus {
  outline: none;
  border-color: var(--medical-primary);
  background-color: var(--bg-primary);
}

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

.phone-input-country-list {
  max-height: 280px;
  overflow-y: auto;
  padding: var(--space-2) 0;
}

/* Custom scrollbar for dropdown */
.phone-input-country-list::-webkit-scrollbar {
  width: 6px;
}

.phone-input-country-list::-webkit-scrollbar-track {
  background: var(--bg-secondary);
}

.phone-input-country-list::-webkit-scrollbar-thumb {
  background: var(--border-default);
  border-radius: var(--radius-full);
}

.phone-input-country-list::-webkit-scrollbar-thumb:hover {
  background: var(--border-dark);
}

.country-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  width: 100%;
  padding: var(--space-2) var(--space-4);
  font-family: var(--font-primary);
  font-size: var(--text-sm);
  color: var(--text-primary);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: background-color var(--transition-base);
  text-align: left;
}

.country-item:hover {
  background-color: var(--bg-hover);
}

.country-item.selected {
  background-color: var(--medical-primary-bg-subtle);
  color: var(--medical-primary);
  font-weight: var(--font-medium);
}

.country-item .country-flag {
  font-size: 1.25rem;
  line-height: 1;
  flex-shrink: 0;
}

.country-item .country-name {
  flex: 1;
  min-width: 0;
}

.country-item .country-dial-code {
  color: var(--text-muted);
  font-weight: var(--font-medium);
  flex-shrink: 0;
}

.country-item.selected .country-dial-code {
  color: var(--medical-primary);
}

.country-item-empty {
  padding: var(--space-4);
  text-align: center;
  font-size: var(--text-sm);
  color: var(--text-muted);
}

/* Responsive adjustments */
@media (max-width: 640px) {
  .phone-input-country-dropdown {
    min-width: 260px;
    max-width: 100%;
  }

  .phone-input-country-button {
    padding: var(--space-2);
  }

  .phone-input-country-button .country-code {
    display: none;
  }
}

/* Integration with existing form styles */
.form-group .phone-input-wrapper .phone-input-field,
.form-group .phone-input-wrapper .phone-input-country-button {
  height: 100%;
}

/* Focus state for the entire wrapper */
.phone-input-wrapper:focus-within .phone-input-country-button {
  border-color: var(--medical-primary);
}

.phone-input-wrapper:focus-within .phone-input-field {
  border-color: var(--medical-primary);
}

/* ============================================
   MOBILE RESPONSIVE FIXES (iPhone / <768px)
   ============================================ */

/* Hide columns on mobile */
@media (max-width: 767px) {
  .hide-mobile {
    display: none !important;
  }
}

/* Show only on mobile */
@media (min-width: 768px) {
  .show-mobile-only {
    display: none !important;
  }
}

@media (max-width: 767px) {
  /* ── Search input: full width on mobile ── */
  .search-input {
    max-width: 100%;
  }

  .search-form-inline {
    flex-direction: column;
    align-items: stretch;
  }

  /* ── Page header: stack vertically on mobile ── */
  .page-header-content {
    flex-direction: column;
    align-items: stretch;
    gap: var(--space-3);
  }

  .page-header-content .btn {
    width: 100%;
    justify-content: center;
  }

  .page-title {
    font-size: var(--text-lg);
    gap: var(--space-2);
  }

  .page-title svg,
  .page-title-icon {
    width: 22px;
    height: 22px;
  }

  /* ── Table: tighter padding on mobile ── */
  .data-table th,
  .data-table td {
    padding: var(--space-2) var(--space-3);
    font-size: var(--text-xs);
  }

  .cell-main {
    font-size: var(--text-sm);
  }

  .cell-sub {
    font-size: 11px;
  }

  .cell-with-icon {
    font-size: var(--text-xs);
  }

  .cell-with-icon svg {
    width: 12px;
    height: 12px;
  }

  /* Touch-friendly action buttons on mobile */
  .btn-icon {
    width: 36px;
    height: 36px;
  }

  .table-actions {
    gap: var(--space-1);
  }

  .card-header {
    padding: var(--space-3) var(--space-4);
  }

  /* ── Welcome section: compact on mobile ── */
  .welcome-2026 {
    gap: var(--space-3);
    margin-bottom: var(--space-4);
  }

  .welcome-avatar {
    width: 44px;
    height: 44px;
    font-size: var(--text-base);
  }

  .welcome-title {
    font-size: var(--text-lg);
  }

  .welcome-subtitle {
    font-size: var(--text-xs);
  }

  .welcome-insight {
    font-size: 11px;
    padding: var(--space-1) var(--space-2);
  }

  /* ── Metrics: compact on mobile ── */
  .metrics-compact {
    gap: var(--space-2);
    margin-bottom: var(--space-4);
  }

  .metric-compact {
    padding: var(--space-3);
    gap: var(--space-2);
  }

  .metric-compact-icon {
    width: 34px;
    height: 34px;
  }

  .metric-compact-icon svg {
    width: 16px;
    height: 16px;
  }

  .metric-compact-value {
    font-size: var(--text-lg);
  }

  .metric-compact-label {
    font-size: 11px;
  }

  .metric-compact-rate {
    width: 34px;
    height: 34px;
  }

  /* ── Cards: tighter spacing on mobile ── */
  .appointments-card-header,
  .activity-card-header {
    padding: var(--space-3) var(--space-4);
  }

  .appointments-card-body,
  .activity-card-body {
    padding: var(--space-3) var(--space-4);
  }

  .appointments-card-title,
  .activity-card-title {
    font-size: var(--text-sm);
  }

  /* ── Timeline: compact on mobile ── */
  .timeline-item {
    gap: var(--space-3);
    padding: var(--space-2) 0;
  }

  .timeline-dot {
    width: 20px;
    height: 20px;
  }

  .timeline::before {
    left: 9px;
  }

  /* ── Quick actions: wrap nicely on mobile ── */
  .action-pills {
    gap: var(--space-2);
  }

  .action-pill {
    padding: var(--space-2) var(--space-4);
    font-size: var(--text-xs);
  }

  /* ── Coming soon: compact on mobile ── */
  .coming-soon-section {
    padding: var(--space-4);
    margin-bottom: var(--space-4);
  }

  /* ── FAB positioning for safe area ── */
  .fab {
    bottom: calc(var(--space-4) + env(safe-area-inset-bottom, 0px));
    right: var(--space-4);
    width: 52px;
    height: 52px;
  }

  /* ── Empty state: less padding ── */
  .empty-state-card {
    padding: var(--space-8) var(--space-4);
  }

  .empty-state-icon svg {
    width: 40px;
    height: 40px;
  }
}