/* ==========================================================================
   Hospital AI — Executive Hospital Admin Command Center & SaaS Design System
   Faithfully matching the reference healthcare SaaS dashboard design:
   - Clean light hospital SaaS theme by default
   - Sidebar navigation with active blue pill & promo feature card
   - Top header with search, notifications, admin profile with online indicator
   - 5 Top KPI Cards with soft-colored icon circles
   - Total Trends Bar Chart & Patients by Department Donut Chart
   - Doctor's Schedule & Operational Report Activity Feed
   - Interactive Calendar & Daily Schedule Timeline Panel
   - Appointments Table with status pills, avatars, and working actions
   - Patients Table with demographic columns and clickable detail rows
   - 4-Column Doctors Grid with large portrait photos and availability badges
   - Full English (LTR) & Arabic (RTL) Support
   ========================================================================== */

:root {
  /* ========================================================================
     OFFICIAL HOSPITAL AI DESIGN SYSTEM TOKENS (LIGHT MODE)
     ======================================================================== */
  --color-primary: #18B6F6;
  --color-primary-dark: #0B6DFF;
  --color-accent: #35D6FF;
  --color-background: #F7FAFC;
  --color-surface: #FFFFFF;
  --color-surface-soft: #EEF4F8;
  --color-text-primary: #0F172A;
  --color-text-secondary: #64748B;
  --color-border: #D9E5EE;
  --color-success: #22C55E;
  --color-warning: #F59E0B;
  --color-error: #EF4444;

  /* Priority Tokens */
  --priority-critical: #EF4444;
  --priority-very-urgent: #F97316;
  --priority-urgent: #F59E0B;
  --priority-normal: #18B6F6;
  --priority-non-urgent: #64748B;

  /* Chart Series */
  --chart-color-1: #18B6F6;
  --chart-color-2: #0B6DFF;
  --chart-color-3: #35D6FF;
  --chart-color-4: #22C55E;
  --chart-color-5: #F59E0B;
  --chart-color-6: #EF4444;

  /* Surfaces & Structural Layout */
  --surface: var(--color-surface);
  --surface-elevated: var(--color-surface-soft);
  --bg-app: var(--color-background);
  --bg-sidebar: var(--color-surface);
  --bg-header: var(--color-surface);
  --bg-card: var(--color-surface);
  --bg-card-hover: var(--color-surface-soft);
  --bg-input: var(--color-surface-soft);

  --border-light: var(--color-border);
  --border-subtle: #EEF4F8;
  --border-focus: var(--color-primary);

  --text-primary: var(--color-text-primary);
  --text-secondary: var(--color-text-secondary);
  --text-muted: #94A3B8;
  --text-dark: var(--color-text-primary);

  /* Primary Brand Actions */
  --primary: var(--color-primary);
  --primary-hover: var(--color-primary-dark);
  --primary-light: rgba(24, 182, 246, 0.12);
  --primary-subtle: rgba(24, 182, 246, 0.08);

  /* Status Badges */
  --status-confirmed-bg: rgba(34, 197, 94, 0.12);
  --status-confirmed-text: #15803D;
  --status-confirmed-border: rgba(34, 197, 94, 0.25);

  --status-pending-bg: rgba(245, 158, 11, 0.12);
  --status-pending-text: #B45309;
  --status-pending-border: rgba(245, 158, 11, 0.25);

  --status-cancelled-bg: var(--color-surface-soft);
  --status-cancelled-text: var(--color-text-secondary);
  --status-cancelled-border: var(--color-border);

  --status-active-bg: rgba(34, 197, 94, 0.12);
  --status-active-text: #15803D;

  --status-new-bg: rgba(24, 182, 246, 0.12);
  --status-new-text: var(--color-primary-dark);

  --status-inactive-bg: var(--color-surface-soft);
  --status-inactive-text: var(--color-text-secondary);

  --badge-available-bg: var(--color-success);
  --badge-available-text: #FFFFFF;

  --badge-unavailable-bg: var(--color-error);
  --badge-unavailable-text: #FFFFFF;

  /* Elevations */
  --shadow-card: 0 1px 3px rgba(15, 23, 42, 0.03), 0 4px 12px rgba(15, 23, 42, 0.04);
  --shadow-hover: 0 4px 16px rgba(11, 109, 255, 0.08);
  --shadow-dropdown: 0 10px 25px -5px rgba(15, 23, 42, 0.08), 0 8px 10px -6px rgba(15, 23, 42, 0.04);
  --shadow-modal: 0 20px 40px rgba(15, 23, 42, 0.15);

  /* Proportions & Radii */
  --sidebar-width: 250px;
  --header-height: 70px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-full: 9999px;

  --font-sans: 'Outfit', 'Cairo', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-arabic: 'Cairo', 'Outfit', sans-serif;
}

/* ==========================================================================
   OFFICIAL HOSPITAL AI DESIGN SYSTEM TOKENS (DARK MODE)
   ========================================================================== */
html.dark-theme,
body.dark-theme {
  --color-primary: #1CB5FF;
  --color-primary-dark: #0B6DFF;
  --color-accent: #35D6FF;
  --color-background: #020B2D;
  --color-surface: #0F1738;
  --color-surface-elevated: #16224A;
  --color-text-primary: #F8FAFC;
  --color-text-secondary: #A8B3CF;
  --color-border: #2A3A6B;
  --color-success: #22C55E;
  --color-warning: #F59E0B;
  --color-error: #EF4444;

  --priority-critical: #EF4444;
  --priority-very-urgent: #F97316;
  --priority-urgent: #F59E0B;
  --priority-normal: #1CB5FF;
  --priority-non-urgent: #A8B3CF;

  --chart-color-1: #1CB5FF;
  --chart-color-2: #0B6DFF;
  --chart-color-3: #35D6FF;
  --chart-color-4: #22C55E;
  --chart-color-5: #F59E0B;
  --chart-color-6: #EF4444;

  --surface: var(--color-surface);
  --surface-elevated: var(--color-surface-elevated);
  --bg-app: var(--color-background);
  --bg-sidebar: var(--color-surface);
  --bg-header: var(--color-surface);
  --bg-card: var(--color-surface);
  --bg-card-hover: var(--color-surface-elevated);
  --bg-input: var(--color-surface-elevated);

  --border-light: var(--color-border);
  --border-subtle: rgba(42, 58, 107, 0.6);
  --border-focus: var(--color-primary);

  --text-primary: var(--color-text-primary);
  --text-secondary: var(--color-text-secondary);
  --text-muted: #64748B;
  --text-dark: var(--color-text-primary);

  --primary: var(--color-primary);
  --primary-hover: var(--color-primary-dark);
  --primary-light: rgba(28, 181, 255, 0.15);
  --primary-subtle: rgba(28, 181, 255, 0.1);

  --status-confirmed-bg: rgba(34, 197, 94, 0.15);
  --status-confirmed-text: #4ADE80;
  --status-confirmed-border: rgba(34, 197, 94, 0.3);

  --status-pending-bg: rgba(245, 158, 11, 0.15);
  --status-pending-text: #FBBF24;
  --status-pending-border: rgba(245, 158, 11, 0.3);

  --status-cancelled-bg: rgba(168, 179, 207, 0.12);
  --status-cancelled-text: var(--color-text-secondary);
  --status-cancelled-border: var(--color-border);

  --status-active-bg: rgba(34, 197, 94, 0.15);
  --status-active-text: #4ADE80;

  --status-new-bg: rgba(28, 181, 255, 0.15);
  --status-new-text: var(--color-primary);

  --status-inactive-bg: var(--color-surface-elevated);
  --status-inactive-text: var(--color-text-secondary);

  --shadow-card: 0 4px 12px rgba(2, 11, 45, 0.4);
  --shadow-hover: 0 6px 20px rgba(2, 11, 45, 0.55);
}

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

html,
body {
  width: 100%;
  height: 100%;
  font-family: var(--font-sans);
  background-color: var(--bg-app);
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Arabic Typography Adaptation */
html[lang="ar"],
html[dir="rtl"] {
  font-family: var(--font-arabic);
}

/* App Shell Structure */
.app-container {
  display: flex;
  min-height: 100vh;
  width: 100%;
  background-color: var(--bg-app);
}

/* ==========================================================================
   1. LEFT SIDEBAR NAVIGATION
   ========================================================================== */
.sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-light);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 100;
  transition: all 0.3s ease;
  overflow-y: auto;
  scrollbar-width: none;
}

.sidebar::-webkit-scrollbar {
  display: none;
}

html[dir="rtl"] .sidebar {
  border-right: none;
  border-left: 1px solid var(--border-light);
}

/* Brand Area */
.sidebar-brand {
  height: var(--header-height);
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  border-bottom: 1px solid transparent;
}

.brand-logo-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  box-shadow: 0 4px 10px rgba(11, 109, 255, 0.25);
}

.brand-logo-icon .material-symbols-outlined {
  font-size: 22px;
}

.brand-text {
  display: flex;
  flex-direction: column;
}

.brand-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-dark);
  letter-spacing: -0.02em;
}

.brand-subtitle {
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text-muted);
}

/* Sidebar Nav Menu */
.sidebar-nav {
  padding: 1rem 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  flex: 1;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.7rem 1rem;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 500;
  transition: all 0.2s ease;
  cursor: pointer;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
}

html[dir="rtl"] .nav-link {
  text-align: right;
}

.nav-link .material-symbols-outlined {
  font-size: 20px;
  color: #94a3b8;
  transition: color 0.2s ease;
}

.nav-link:hover {
  background-color: var(--primary-light);
  color: var(--primary);
}

.nav-link:hover .material-symbols-outlined {
  color: var(--primary);
}

/* Active Nav Item - Matches Reference Exact Light Blue Pill */
.nav-link.active {
  background-color: var(--primary-light);
  color: var(--primary);
  font-weight: 600;
}

.nav-link.active .material-symbols-outlined {
  color: var(--primary);
}

.nav-badge {
  margin-left: auto;
  background-color: var(--primary);
  color: #ffffff;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: var(--radius-full);
}

html[dir="rtl"] .nav-badge {
  margin-left: 0;
  margin-right: auto;
}

/* Sidebar Bottom Promo Card */
.sidebar-footer {
  padding: 1rem 0.85rem 1.25rem;
}

.promo-card {
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
  border-radius: var(--radius-lg);
  padding: 1.15rem;
  color: #ffffff;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  box-shadow: 0 8px 20px rgba(11, 109, 255, 0.25);
  position: relative;
  overflow: hidden;
}

.promo-card::before {
  content: "";
  position: absolute;
  top: -20px;
  right: -20px;
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
}

.promo-icon-wrap {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
}

.promo-icon-wrap .material-symbols-outlined {
  font-size: 20px;
  color: #ffffff;
}

.promo-title {
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1.35;
}

.promo-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 0.25rem;
}

.promo-link {
  font-size: 0.72rem;
  color: rgba(255, 255, 255, 0.85);
  text-decoration: underline;
  cursor: pointer;
}

.promo-btn {
  background-color: #ffffff;
  color: var(--primary);
  border: none;
  font-size: 0.76rem;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: transform 0.15s ease;
}

.promo-btn:hover {
  transform: translateY(-1px);
}

/* ==========================================================================
   2. MAIN CONTENT WRAPPER & TOPBAR
   ========================================================================== */
.main-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow-x: hidden;
}

/* Top Header */
.topbar {
  height: var(--header-height);
  background: var(--bg-header);
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  position: sticky;
  top: 0;
  z-index: 90;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.mobile-menu-btn {
  display: none;
  background: transparent;
  border: none;
  font-size: 24px;
  color: var(--text-secondary);
  cursor: pointer;
}

.topbar-title {
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--text-dark);
  letter-spacing: -0.02em;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

/* Search Bar Pill */
.header-search {
  position: relative;
  display: flex;
  align-items: center;
}

.header-search .material-symbols-outlined {
  position: absolute;
  left: 12px;
  font-size: 20px;
  color: var(--text-muted);
  pointer-events: none;
}

html[dir="rtl"] .header-search .material-symbols-outlined {
  left: auto;
  right: 12px;
}

.header-search input {
  height: 40px;
  width: 230px;
  background-color: var(--bg-input);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-full);
  padding: 0 1rem 0 2.4rem;
  font-size: 0.88rem;
  color: var(--text-primary);
  outline: none;
  transition: all 0.2s ease;
}

html[dir="rtl"] .header-search input {
  padding: 0 2.4rem 0 1rem;
}

.header-search input:focus {
  border-color: var(--primary);
  background-color: #ffffff;
  width: 270px;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Action Icons */
.icon-circle-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--border-light);
  background: var(--bg-header);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  cursor: pointer;
  position: relative;
  transition: all 0.2s ease;
}

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

.icon-badge-dot {
  position: absolute;
  top: 9px;
  right: 10px;
  width: 8px;
  height: 8px;
  background-color: #ef4444;
  border-radius: 50%;
  border: 2px solid #ffffff;
}

/* Language Toggle Pill */
.lang-btn {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  height: 38px;
  padding: 0 0.85rem;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-light);
  background-color: var(--bg-card);
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.lang-btn:hover {
  color: var(--primary);
  border-color: var(--primary);
  background-color: var(--primary-light);
}

/* Admin Profile Chip */
.admin-profile {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.35rem 0.6rem;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: background 0.2s ease;
  position: relative;
}

.admin-profile:hover {
  background-color: var(--bg-input);
}

.admin-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid #ffffff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.admin-meta {
  display: flex;
  flex-direction: column;
}

.admin-name {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-dark);
  line-height: 1.2;
}

.admin-status {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.74rem;
  color: var(--color-success);
  font-weight: 500;
}

.status-dot-green {
  width: 6px;
  height: 6px;
  background-color: var(--color-success);
  border-radius: 50%;
  display: inline-block;
}

.admin-dropdown-arrow {
  color: var(--text-muted);
  font-size: 18px;
}

/* Profile Dropdown Menu */
.profile-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 0.5rem;
  width: 220px;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-dropdown);
  display: none;
  flex-direction: column;
  padding: 0.5rem 0;
  z-index: 1000;
}

html[dir="rtl"] .profile-dropdown {
  right: auto;
  left: 0;
}

.profile-dropdown.open {
  display: flex;
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 1.25rem;
  color: var(--text-primary);
  font-size: 0.88rem;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s ease;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
}

html[dir="rtl"] .dropdown-item {
  text-align: right;
}

.dropdown-item:hover {
  background-color: var(--primary-light);
  color: var(--primary);
}

.dropdown-item .material-symbols-outlined {
  font-size: 18px;
  color: var(--text-muted);
}

.dropdown-item:hover .material-symbols-outlined {
  color: var(--primary);
}

.dropdown-divider {
  height: 1px;
  background-color: var(--border-light);
  margin: 0.4rem 0;
}

/* ==========================================================================
   3. MAIN CONTENT BODY & SUBVIEWS
   ========================================================================== */
.content-body {
  padding: 1.75rem 2rem;
  flex: 1;
}

.admin-sub-view {
  display: none !important;
  animation: fadeIn 0.25s ease-in-out;
}

.admin-sub-view.active {
  display: block !important;
}

.admin-sub-view.em-dashboard-section.active {
  display: flex !important;
  flex-direction: column;
  gap: 1rem;
  min-height: calc(100vh - 120px);
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(4px);
  }

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

/* Generic White Card Style Matching References */
.hospital-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  box-shadow: var(--shadow-card);
  position: relative;
}

.card-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.15rem;
}

.card-title-text {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-dark);
}

.card-action-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.card-action-btn:hover {
  background-color: var(--bg-input);
  color: var(--text-primary);
}

/* ==========================================================================
   4. DASHBOARD OVERVIEW (REFERENCE IMAGE 1)
   ========================================================================== */

/* 8 KPI Cards Grid (2 rows of 4 cards) */
.kpi-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.25rem;
  margin-bottom: 1.75rem;
}

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

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

.kpi-metric-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 1.15rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  box-shadow: var(--shadow-card);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

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

.kpi-icon-circle {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background-color: var(--primary-light);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.kpi-icon-circle .material-symbols-outlined {
  font-size: 22px;
}

.kpi-metric-info {
  display: flex;
  flex-direction: column;
}

.kpi-metric-num {
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--text-dark);
  line-height: 1.15;
}

.kpi-metric-label {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* Dashboard 2-Column Split: Main Grid + Right Calendar Panel */
.dashboard-main-layout {
  display: grid;
  grid-template-columns: 1fr 310px;
  gap: 1.5rem;
  align-items: start;
}

.dashboard-left-column {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.dashboard-2-cards-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

/* Mini Select Dropdowns */
.select-sm {
  background: var(--bg-input);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 4px 10px;
  font-size: 0.8rem;
  color: var(--text-secondary);
  font-weight: 500;
  outline: none;
  cursor: pointer;
}

/* Chart Canvas Wrappers */
.chart-box {
  width: 100%;
  height: 230px;
  position: relative;
}

/* Circular Chart Legend on Right */
.donut-chart-layout {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  height: 230px;
}

.donut-canvas-wrap {
  width: 170px;
  height: 170px;
  position: relative;
  flex-shrink: 0;
}

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

.donut-center-num {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--text-dark);
  line-height: 1;
}

.donut-center-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 500;
}

.donut-legend-list {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  flex: 1;
}

.donut-legend-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.legend-color-box {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  flex-shrink: 0;
}

/* Doctor's Schedule Widget */
.doc-schedule-list {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.doc-schedule-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--border-subtle);
}

.doc-schedule-row:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.doc-info-wrap {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.doc-thumb {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
}

.doc-name-group {
  display: flex;
  flex-direction: column;
}

.doc-name {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-dark);
}

.doc-dept {
  font-size: 0.76rem;
  color: var(--text-muted);
}

.doc-schedule-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}

html[dir="rtl"] .doc-schedule-meta {
  align-items: flex-start;
}

.doc-time-str {
  font-size: 0.78rem;
  color: var(--text-secondary);
  font-weight: 500;
}

/* Report Operational Activity Feed */
.report-feed-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.report-feed-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.65rem 0.75rem;
  background-color: var(--bg-input);
  border-radius: var(--radius-md);
  transition: background 0.15s ease;
}

.report-feed-item:hover {
  background-color: #f1f5f9;
}

.report-main-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.report-icon-wrap {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background-color: var(--primary);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.report-icon-wrap .material-symbols-outlined {
  font-size: 18px;
}

.report-text-col {
  display: flex;
  flex-direction: column;
}

.report-title {
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text-dark);
}

.report-time {
  font-size: 0.74rem;
  color: var(--text-muted);
}

.report-arrow {
  color: var(--primary);
  font-size: 18px;
}

/* ==========================================================================
   5. RIGHT PANEL: CALENDAR & DAILY TIMELINE
   ========================================================================== */
.calendar-panel {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

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

.cal-month-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--primary);
}

.cal-nav-buttons {
  display: flex;
  gap: 0.25rem;
}

.cal-nav-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
}

.cal-nav-btn:hover {
  color: var(--primary);
  background: var(--primary-light);
}

.cal-weekdays-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-top: 0.75rem;
}

.cal-days-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  text-align: center;
  margin-top: 0.5rem;
}

.cal-day-cell {
  width: 32px;
  height: 32px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-primary);
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.15s ease;
}

.cal-day-cell:hover {
  background-color: var(--primary-light);
  color: var(--primary);
}

.cal-day-cell.other-month {
  color: #cbd5e1;
}

.cal-day-cell.active-day {
  background-color: var(--primary);
  color: #ffffff;
  font-weight: 700;
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.35);
}

/* Daily Schedule Timeline */
.daily-schedule-section {
  border-top: 1px solid var(--border-light);
  padding-top: 1.25rem;
}

.daily-schedule-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.daily-schedule-date {
  font-size: 0.94rem;
  font-weight: 700;
  color: var(--text-dark);
}

.daily-add-event-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background-color: var(--primary);
  color: #ffffff;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.15s ease;
}

.daily-add-event-btn:hover {
  transform: scale(1.08);
}

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

.timeline-entry {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
}

.timeline-time-label {
  width: 45px;
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
  padding-top: 4px;
}

.timeline-event-card {
  flex: 1;
  background-color: var(--primary);
  color: #ffffff;
  border-radius: var(--radius-md);
  padding: 0.65rem 0.85rem;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.2);
}

.timeline-event-card.event-light {
  background-color: var(--bg-input);
  color: var(--text-secondary);
  box-shadow: none;
  border: 1px dashed var(--border-light);
}

.timeline-event-title {
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1.2;
}

.timeline-event-sub {
  font-size: 0.72rem;
  opacity: 0.85;
  margin-top: 2px;
}

/* ==========================================================================
   6. TABLES & DATA PAGES (APPOINTMENTS & PATIENTS)
   ========================================================================== */

/* Filter Toolbar */
.table-filter-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  gap: 1rem;
  flex-wrap: wrap;
}

.filter-controls-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.filter-select {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 0.55rem 1.15rem;
  font-size: 0.86rem;
  color: var(--text-primary);
  font-weight: 500;
  outline: none;
  cursor: pointer;
  transition: border-color 0.2s ease;
}

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

.filter-search-box {
  position: relative;
  display: flex;
  align-items: center;
}

.filter-search-box input {
  height: 38px;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 0 1rem 0 2.2rem;
  font-size: 0.86rem;
  outline: none;
}

html[dir="rtl"] .filter-search-box input {
  padding: 0 2.2rem 0 1rem;
}

.filter-search-box .material-symbols-outlined {
  position: absolute;
  left: 10px;
  font-size: 18px;
  color: var(--text-muted);
}

html[dir="rtl"] .filter-search-box .material-symbols-outlined {
  left: auto;
  right: 10px;
}

.btn-primary-action {
  background-color: var(--primary);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-md);
  padding: 0.6rem 1.25rem;
  font-size: 0.88rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.2);
}

.btn-primary-action:hover {
  background-color: var(--primary-hover);
  transform: translateY(-1px);
}

/* Reference Table Style */
.reference-table-wrap {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  overflow-x: auto;
  box-shadow: var(--shadow-card);
}

.reference-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

html[dir="rtl"] .reference-table {
  text-align: right;
}

.reference-table th {
  padding: 1rem 1.25rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-light);
  background-color: var(--bg-card);
  white-space: nowrap;
}

.reference-table td {
  padding: 0.95rem 1.25rem;
  font-size: 0.86rem;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: middle;
  white-space: nowrap;
}

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

.reference-table tbody tr {
  transition: background-color 0.15s ease;
}

.reference-table tbody tr:hover {
  background-color: var(--bg-card-hover);
}

/* Checkbox Column */
.table-checkbox {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
  cursor: pointer;
}

/* Cell with Avatar & Name */
.user-cell {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.user-cell-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.user-cell-name {
  font-weight: 600;
  color: var(--text-dark);
}

/* Status Chips Matching Reference Exact Colors */
.status-pill {
  display: inline-block;
  padding: 3px 12px;
  border-radius: var(--radius-full);
  font-size: 0.76rem;
  font-weight: 600;
  text-align: center;
}

.status-pill.confirmed,
.status-pill.active {
  background-color: var(--status-confirmed-bg);
  color: var(--status-confirmed-text);
  border: 1px solid var(--status-confirmed-border);
}

.status-pill.pending,
.status-pill.new-patient {
  background-color: var(--status-pending-bg);
  color: var(--status-pending-text);
  border: 1px solid var(--status-pending-border);
}

.status-pill.cancelled,
.status-pill.inactive {
  background-color: var(--status-cancelled-bg);
  color: var(--status-cancelled-text);
  border: 1px solid var(--status-cancelled-border);
}

/* Action Controls (Reschedule + Cancel Cross) */
.action-buttons-cell {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  justify-content: flex-end;
}

html[dir="rtl"] .action-buttons-cell {
  justify-content: flex-start;
}

.btn-table-reschedule {
  background: transparent;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-full);
  padding: 3px 12px;
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-table-reschedule:hover {
  background-color: var(--primary-light);
  color: var(--primary);
  border-color: var(--primary);
}

.btn-table-cancel {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s ease;
}

.btn-table-cancel:hover {
  color: #ef4444;
}

/* ==========================================================================
   7. DOCTORS PAGE (REFERENCE IMAGE 4: 4-COLUMN CARD GRID)
   ========================================================================== */
.doctors-card-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.5rem;
}

.doctor-profile-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  cursor: pointer;
  display: flex;
  flex-direction: column;
}

.doctor-profile-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-hover);
}

.doctor-card-media {
  width: 100%;
  height: 200px;
  position: relative;
  background-color: #e2e8f0;
  overflow: hidden;
}

.doctor-card-photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.doctor-profile-card:hover .doctor-card-photo {
  transform: scale(1.03);
}

.doctor-status-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  font-weight: 600;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

html[dir="rtl"] .doctor-status-badge {
  right: auto;
  left: 10px;
}

.doctor-status-badge.available {
  background-color: var(--badge-available-bg);
  color: var(--badge-available-text);
}

.doctor-status-badge.in-consultation {
  background-color: #fef3c7;
  color: #b45309;
}

.doctor-status-badge.on-leave,
.doctor-status-badge.off-duty {
  background-color: #f1f5f9;
  color: #475569;
}

.doctor-status-badge.unavailable {
  background-color: var(--badge-unavailable-bg);
  color: var(--badge-unavailable-text);
}

.doctor-card-body {
  padding: 1rem 1.15rem;
  text-align: center;
  background: var(--bg-card);
}

.doctor-card-name {
  font-size: 0.96rem;
  font-weight: 700;
  color: var(--text-dark);
  margin-bottom: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.doctor-card-specialty {
  font-size: 0.82rem;
  color: var(--text-secondary);
  display: flex;
  flex-direction: column;
  gap: 2px;
  align-items: center;
}

.doctor-card-specialty .doc-primary-spec {
  font-weight: 600;
  color: var(--primary-color, #173ea5);
}

.doctor-card-specialty .doc-sub-spec {
  font-size: 0.74rem;
  color: var(--text-muted, #64748b);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

/* ==========================================================================
   8. MODALS & FORMS
   ========================================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(15, 23, 42, 0.62);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 2000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
}

.modal-overlay.open {
  display: flex;
}

.modal-box {
  position: relative;
  z-index: 2001;
  isolation: isolate;
  background-color: var(--surface, #ffffff);
  color: var(--text-primary);
  opacity: 1 !important;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-modal);
  width: 100%;
  max-width: 640px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: modalScale 0.16s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-box>form {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  background-color: var(--surface, #ffffff);
}

@keyframes modalScale {
  from {
    transform: translateY(6px) scale(0.985);
  }

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

.modal-header-bar {
  padding: 1.15rem 1.5rem;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  background-color: var(--surface, #ffffff);
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 5;
}

.modal-header-text {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
}

.modal-header-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-dark);
  line-height: 1.3;
}

.modal-header-subtitle {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin: 0;
  line-height: 1.35;
}

.modal-close-icon {
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  line-height: 1;
  color: var(--text-muted);
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.15s ease;
}

.modal-close-icon:hover {
  color: var(--text-primary);
  background-color: var(--bg-input);
}

.modal-close-icon:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.modal-body-content {
  padding: 1.25rem 1.5rem;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
  background-color: var(--surface, #ffffff);
}

.form-grid-2col {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  width: 100%;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 0.38rem;
  margin-bottom: 0.9rem;
  min-width: 0;
}

.form-grid-2col>.form-field {
  margin-bottom: 0.65rem;
}

.form-field label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
  line-height: 1.3;
}

.form-field input,
.form-field select,
.form-field textarea {
  width: 100%;
  box-sizing: border-box;
  background-color: var(--bg-input);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 0.62rem 0.88rem;
  font-size: 0.88rem;
  color: var(--text-primary);
  outline: none;
  font-family: inherit;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus {
  border-color: var(--primary);
  background-color: var(--surface, #ffffff);
  box-shadow: 0 0 0 3px var(--primary-light);
}

.form-field input.input-invalid,
.form-field select.input-invalid {
  border-color: var(--color-error);
  background-color: rgba(239, 68, 68, 0.04);
}

.form-field input.input-invalid:focus,
.form-field select.input-invalid:focus {
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.16);
}

/* Doctor Photo Upload Area */
.upload-dropzone {
  border: 2px dashed #cbd5e1;
  background-color: var(--bg-input);
  border-radius: var(--radius-md);
  padding: 1.25rem 1rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.upload-dropzone:hover,
.upload-dropzone.dragover {
  border-color: var(--primary);
  background-color: #eff6ff;
}

.upload-icon {
  font-size: 34px !important;
  color: var(--primary);
  margin-bottom: 0.35rem;
}

.dropzone-text {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-dark);
  margin: 0 0 0.2rem 0;
}

.dropzone-or {
  font-size: 0.76rem;
  color: var(--text-muted);
  display: block;
  margin-bottom: 0.35rem;
}

.btn-choose-file {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  color: var(--primary);
  border-radius: var(--radius-full);
  padding: 0.32rem 0.95rem;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
}

.btn-choose-file:hover {
  background-color: var(--primary-light);
  border-color: var(--primary);
}

.dropzone-hint {
  font-size: 0.73rem;
  color: var(--text-muted);
  display: block;
  margin-top: 0.45rem;
}

/* Photo Preview Card */
.photo-preview-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  background-color: var(--bg-input);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 0.85rem 1rem;
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }

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

.photo-preview-avatar-wrap {
  width: 64px;
  height: 64px;
  flex-shrink: 0;
  border-radius: 50%;
  overflow: hidden;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
  border: 2px solid var(--primary);
  background-color: #e2e8f0;
}

.photo-preview-avatar {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
}

.photo-preview-info {
  flex: 1;
  min-width: 0;
}

.photo-preview-filename {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-dark);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.photo-preview-filesize {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 2px;
  margin-bottom: 0.4rem;
}

.photo-preview-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.btn-photo-action {
  background: #ffffff;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 0.25rem 0.6rem;
  font-size: 0.74rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: inherit;
}

.btn-photo-action.change {
  color: var(--primary);
}

.btn-photo-action.change:hover {
  background-color: var(--primary-light);
  border-color: var(--primary);
}

.btn-photo-action.remove {
  color: #ef4444;
}

.btn-photo-action.remove:hover {
  background-color: #fef2f2;
  border-color: #fca5a5;
}

.photo-upload-error {
  margin-top: 0.5rem;
  padding: 0.5rem 0.75rem;
  background-color: #fef2f2;
  border: 1px solid #fecaca;
  color: #b91c1c;
  font-size: 0.8rem;
  border-radius: var(--radius-sm);
  line-height: 1.35;
}

.modal-actions-bar {
  padding: 0.95rem 1.5rem;
  border-top: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  background-color: var(--bg-input);
  flex-shrink: 0;
  position: sticky;
  bottom: 0;
  z-index: 5;
}

.btn-secondary {
  background-color: var(--surface, #ffffff);
  border: 1px solid var(--border-light);
  color: var(--text-secondary);
  border-radius: var(--radius-md);
  padding: 0.55rem 1.25rem;
  font-size: 0.86rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s ease;
}

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

.btn-secondary:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.btn-submit {
  background-color: var(--primary);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-md);
  padding: 0.55rem 1.35rem;
  font-size: 0.86rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  transition: background-color 0.2s ease, transform 0.1s ease, box-shadow 0.2s ease;
  box-shadow: 0 2px 8px rgba(24, 182, 246, 0.28);
}

.btn-submit:hover:not(:disabled) {
  background-color: var(--primary-hover);
  box-shadow: 0 4px 12px rgba(11, 109, 255, 0.35);
}

.btn-submit:focus-visible {
  outline: 2px solid var(--primary-hover);
  outline-offset: 2px;
}

.btn-submit:disabled {
  background-color: var(--border-light);
  color: var(--text-muted);
  cursor: not-allowed;
  box-shadow: none;
}

/* ==========================================================================
   8B. DOCTOR SCHEDULE MODAL & SCHEDULE TABLE / WEEKLY GRID STYLES
   ========================================================================== */
.modal-schedule-box {
  max-width: 640px;
}

.form-section {
  padding-bottom: 1rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--border-subtle);
}

.form-section.form-section-last {
  padding-bottom: 0.25rem;
  margin-bottom: 0;
  border-bottom: none;
}

.form-section-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
}

.form-section-title {
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--primary);
  margin: 0 0 0.75rem 0;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.form-section-header-row .form-section-title {
  margin-bottom: 0;
}

/* Searchable Physician Select Group */
.physician-select-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

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

.physician-search-input-wrap .material-symbols-outlined {
  position: absolute;
  inset-inline-start: 0.65rem;
  font-size: 16px;
  color: var(--text-muted);
  pointer-events: none;
}

.physician-search-input-wrap input {
  padding: 0.42rem 0.75rem;
  padding-inline-start: 2rem;
  font-size: 0.8rem;
  border-radius: var(--radius-sm);
  background-color: var(--surface, #ffffff);
  border: 1px dashed var(--border-light);
}

/* Day Presets & Multi-Day Chips */
.day-presets-bar {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.btn-day-preset {
  background-color: var(--bg-input);
  border: 1px solid var(--border-light);
  color: var(--text-secondary);
  font-size: 0.73rem;
  font-weight: 600;
  padding: 0.22rem 0.55rem;
  border-radius: var(--radius-full);
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s ease;
}

.btn-day-preset:hover {
  border-color: var(--primary);
  color: var(--primary);
  background-color: var(--primary-subtle);
}

.day-chips-group {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 0.45rem;
  width: 100%;
}

.day-chip {
  background-color: var(--bg-input);
  border: 1px solid var(--border-light);
  color: var(--text-secondary);
  border-radius: var(--radius-md);
  padding: 0.52rem 0.25rem;
  font-size: 0.82rem;
  font-weight: 600;
  text-align: center;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s ease;
  user-select: none;
}

.day-chip:hover:not(:disabled) {
  border-color: var(--primary);
  color: var(--text-primary);
  background-color: var(--primary-subtle);
}

.day-chip.selected {
  background-color: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(24, 182, 246, 0.3);
}

.day-chip:focus-visible {
  outline: 2px solid var(--primary-hover);
  outline-offset: 2px;
}

.day-chip:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* 24-Hour Time Input */
.time-24h-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.time-24h-wrap .time-input-24h {
  padding-inline-end: 2.25rem;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.03em;
  font-weight: 600;
}

.time-24h-icon {
  position: absolute;
  inset-inline-end: 0.75rem;
  font-size: 18px !important;
  color: var(--text-muted);
  pointer-events: none;
}

/* Collapsible Break Section */
.break-collapsible-wrap {
  margin-top: 0.2rem;
}

.btn-toggle-break {
  background: transparent;
  border: 1px dashed var(--border-light);
  color: var(--primary);
  border-radius: var(--radius-md);
  padding: 0.45rem 0.85rem;
  font-size: 0.82rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.38rem;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s ease;
}

.btn-toggle-break:hover {
  background-color: var(--primary-subtle);
  border-color: var(--primary);
}

.btn-toggle-break .material-symbols-outlined {
  font-size: 18px;
}

.sched-break-fields {
  margin-top: 0.75rem;
  padding: 0.85rem;
  background-color: var(--bg-app);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
}

/* Computed Capacity Card */
.capacity-computed-card {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background-color: var(--primary-subtle);
  border: 1px solid rgba(24, 182, 246, 0.28);
  border-radius: var(--radius-md);
  padding: 0.58rem 0.85rem;
  min-height: 42px;
}

.capacity-computed-card.warning {
  background-color: var(--status-pending-bg);
  border-color: var(--status-pending-border);
}

.capacity-card-icon {
  font-size: 22px !important;
  color: var(--primary);
  flex-shrink: 0;
}

.capacity-computed-card.warning .capacity-card-icon {
  color: var(--color-warning);
}

.capacity-card-body {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.capacity-card-main {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-dark);
  line-height: 1.25;
}

.capacity-card-sub {
  font-size: 0.74rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* Status Toggle Switch Card */
.status-toggle-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 1rem;
  background-color: var(--bg-input);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
}

.status-toggle-info {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
}

.status-toggle-title-row {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.status-toggle-label {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-dark);
  cursor: pointer;
}

.status-toggle-desc {
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin: 0;
}

.toggle-switch {
  position: relative;
  width: 46px;
  height: 26px;
  border-radius: var(--radius-full);
  background-color: var(--text-muted);
  border: none;
  padding: 3px;
  cursor: pointer;
  flex-shrink: 0;
  transition: background-color 0.2s ease;
  display: inline-flex;
  align-items: center;
}

.toggle-switch.active {
  background-color: var(--color-success);
}

.toggle-switch-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background-color: #ffffff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  transform: translateX(0);
}

.toggle-switch.active .toggle-switch-thumb {
  transform: translateX(20px);
}

html[dir="rtl"] .toggle-switch.active .toggle-switch-thumb {
  transform: translateX(-20px);
}

.toggle-switch:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* Inline Helpers, Warnings, Errors, and Conflict Banner */
.field-helper {
  font-size: 0.74rem;
  color: var(--text-muted);
  line-height: 1.3;
}

.field-error {
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--color-error);
  line-height: 1.35;
  display: none;
}

.field-error.visible {
  display: block;
}

.field-warning {
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--status-pending-text);
  background-color: var(--status-pending-bg);
  border: 1px solid var(--status-pending-border);
  border-radius: var(--radius-sm);
  padding: 0.35rem 0.55rem;
  line-height: 1.35;
  display: none;
}

.field-warning.visible {
  display: block;
}

.sched-conflict-banner {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  padding: 0.8rem 1rem;
  margin-bottom: 1rem;
  border-radius: var(--radius-md);
  background-color: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: var(--color-error);
  font-size: 0.83rem;
  font-weight: 600;
  line-height: 1.4;
}

.sched-conflict-icon {
  font-size: 20px !important;
  flex-shrink: 0;
  margin-top: 1px;
}

/* Modal Footer Layout & Delete / Spinner */
.modal-schedule-footer {
  justify-content: space-between;
}

.modal-footer-start,
.modal-footer-end {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.btn-danger-outline {
  background-color: transparent;
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: var(--color-error);
  border-radius: var(--radius-md);
  padding: 0.5rem 0.95rem;
  font-size: 0.84rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s ease;
}

.btn-danger-outline:hover {
  background-color: rgba(239, 68, 68, 0.1);
  border-color: var(--color-error);
}

.btn-danger-outline .material-symbols-outlined {
  font-size: 18px;
}

.btn-spinner {
  width: 15px;
  height: 15px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: spinLoader 0.65s linear infinite;
}

@keyframes spinLoader {
  to {
    transform: rotate(360deg);
  }
}

/* ==========================================================================
   SCHEDULE TOOLBAR, TABLE ENHANCEMENTS & WEEKLY GRID VIEW
   ========================================================================== */
.schedules-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.85rem;
  flex-wrap: wrap;
}

.schedules-filters-wrap {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
  flex: 1;
}

.sched-search-box {
  position: relative;
  display: flex;
  align-items: center;
  min-width: 210px;
}

.sched-search-box .material-symbols-outlined {
  position: absolute;
  inset-inline-start: 0.75rem;
  font-size: 18px;
  color: var(--text-muted);
  pointer-events: none;
}

.sched-search-box input {
  width: 100%;
  background-color: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 0.5rem 0.85rem;
  padding-inline-start: 2.25rem;
  font-size: 0.84rem;
  color: var(--text-primary);
  font-family: inherit;
  outline: none;
}

.sched-search-box input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

.chip-clear-filters {
  background-color: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.28);
  color: var(--color-error);
  border-radius: var(--radius-full);
  padding: 0.38rem 0.75rem;
  font-size: 0.78rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s ease;
}

.chip-clear-filters:hover {
  background-color: rgba(239, 68, 68, 0.18);
}

.chip-clear-filters .material-symbols-outlined {
  font-size: 16px;
}

.sched-result-count {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  background-color: var(--bg-input);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-full);
  padding: 0.28rem 0.75rem;
  white-space: nowrap;
}

.schedules-toolbar-right {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
}

.view-toggle-group {
  display: inline-flex;
  background-color: var(--bg-input);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 3px;
  gap: 2px;
}

.view-toggle-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  padding: 0.38rem 0.75rem;
  font-size: 0.8rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s ease;
}

.view-toggle-btn .material-symbols-outlined {
  font-size: 17px;
}

.view-toggle-btn.active {
  background-color: var(--surface, #ffffff);
  color: var(--primary);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
}

/* Sticky Schedule Table & Group Rows */
.schedules-table-scroll {
  max-height: 68vh;
  overflow: auto;
  position: relative;
}

.schedules-table thead th {
  position: sticky;
  top: 0;
  z-index: 4;
  background-color: var(--bg-input);
  box-shadow: 0 1px 0 var(--border-light);
}

.sched-dept-group-row td {
  background-color: var(--bg-app) !important;
  padding: 0.55rem 1rem !important;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--primary);
  border-top: 1px solid var(--border-light);
  border-bottom: 1px solid var(--border-light);
}

.sched-doc-cell {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.sched-doc-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: cover;
  border: 1.5px solid var(--border-light);
  flex-shrink: 0;
  background-color: var(--primary-subtle);
}

.sched-doc-initials {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background-color: var(--primary-light);
  color: var(--primary-hover);
  font-size: 0.78rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border: 1px solid rgba(24, 182, 246, 0.25);
}

.sched-doc-meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.sched-doc-name {
  font-weight: 600;
  color: var(--text-dark);
  line-height: 1.25;
}

.sched-time-cell {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: var(--text-dark);
}

.sched-break-subline {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.73rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-top: 2px;
}

.sched-break-subline .material-symbols-outlined {
  font-size: 13px;
  color: var(--color-warning);
}

.sched-room-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.24rem 0.6rem;
  border-radius: var(--radius-sm);
  background-color: var(--bg-input);
  border: 1px solid var(--border-light);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}

.status-pill.sched-active {
  background-color: var(--status-active-bg);
  color: var(--status-active-text);
  border: 1px solid rgba(34, 197, 94, 0.28);
}

.status-pill.sched-inactive {
  background-color: var(--status-inactive-bg);
  color: var(--status-inactive-text);
  border: 1px solid var(--border-light);
}

/* Action Icon Button Group */
.sched-action-group {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.btn-sched-icon {
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-light);
  background-color: var(--surface, #ffffff);
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-sched-icon .material-symbols-outlined {
  font-size: 17px;
}

.btn-sched-icon:hover {
  border-color: var(--primary);
  color: var(--primary);
  background-color: var(--primary-subtle);
}

.btn-sched-icon.danger:hover {
  border-color: var(--color-error);
  color: var(--color-error);
  background-color: rgba(239, 68, 68, 0.1);
}

/* Row Highlight Pulse after Add/Edit */
@keyframes rowHighlightPulse {
  0% {
    background-color: rgba(24, 182, 246, 0.26);
  }

  100% {
    background-color: transparent;
  }
}

tr.sched-row-highlight td {
  animation: rowHighlightPulse 2.6s ease-out;
}

/* Pagination Bar */
.schedules-pagination-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 1.15rem;
  background-color: var(--surface, #ffffff);
  border: 1px solid var(--border-light);
  border-top: none;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  flex-wrap: wrap;
}

.pagination-info {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.pagination-controls {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.pagination-btn {
  background-color: var(--bg-input);
  border: 1px solid var(--border-light);
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  min-width: 32px;
  height: 32px;
  padding: 0 0.55rem;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

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

.pagination-btn.active {
  background-color: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
}

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

/* Weekly Grid View */
.schedules-weekly-grid-wrap {
  background-color: var(--surface, #ffffff);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  overflow: auto;
  max-height: 72vh;
}

.weekly-grid-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  min-width: 920px;
}

.weekly-grid-table thead th {
  position: sticky;
  top: 0;
  z-index: 4;
  background-color: var(--bg-input);
  padding: 0.75rem 0.65rem;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-light);
  border-inline-end: 1px solid var(--border-subtle);
  text-align: center;
}

.weekly-grid-table thead th:first-child {
  text-align: start;
  min-width: 210px;
  position: sticky;
  inset-inline-start: 0;
  z-index: 5;
}

.weekly-grid-table tbody td {
  vertical-align: top;
  padding: 0.55rem;
  border-bottom: 1px solid var(--border-subtle);
  border-inline-end: 1px solid var(--border-subtle);
  min-width: 115px;
}

.weekly-grid-table tbody td.weekly-grid-doc-col {
  position: sticky;
  inset-inline-start: 0;
  z-index: 2;
  background-color: var(--surface, #ffffff);
  border-inline-end: 1px solid var(--border-light);
  padding: 0.65rem 0.85rem;
}

.weekly-cell-stack {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-height: 44px;
}

.weekly-shift-chip {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 0.38rem 0.5rem;
  border-radius: var(--radius-sm);
  background-color: var(--primary-subtle);
  border: 1px solid rgba(24, 182, 246, 0.3);
  color: var(--text-dark);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  text-align: start;
  transition: all 0.15s ease;
  font-variant-numeric: tabular-nums;
}

.weekly-shift-chip:hover {
  border-color: var(--primary);
  box-shadow: 0 2px 6px rgba(24, 182, 246, 0.2);
}

.weekly-shift-chip.inactive {
  background-color: var(--status-inactive-bg);
  border-color: var(--border-light);
  color: var(--text-muted);
  text-decoration: line-through;
}

.weekly-shift-chip.conflict {
  background-color: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.45);
  color: var(--color-error);
}

.weekly-chip-meta {
  font-size: 0.68rem;
  font-weight: 500;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.25rem;
}

.weekly-add-cell-btn {
  width: 100%;
  border: 1px dashed var(--border-light);
  background: transparent;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  padding: 0.2rem;
  font-size: 0.72rem;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.weekly-grid-table tbody td:hover .weekly-add-cell-btn,
.weekly-add-cell-btn:focus-visible {
  opacity: 1;
}

.weekly-add-cell-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
  background-color: var(--primary-subtle);
}

/* Empty State & Skeleton Loading */
.sched-empty-state {
  padding: 2.5rem 1.5rem;
  text-align: center;
  color: var(--text-secondary);
}

.sched-empty-state .material-symbols-outlined {
  font-size: 42px;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

@keyframes skeletonShimmer {
  0% {
    opacity: 0.45;
  }

  50% {
    opacity: 0.85;
  }

  100% {
    opacity: 0.45;
  }
}

.skeleton-bar {
  height: 14px;
  border-radius: 6px;
  background-color: var(--border-light);
  animation: skeletonShimmer 1.2s ease-in-out infinite;
}

/* ==========================================================================
   9. RESPONSIVE BREAKPOINTS
   ========================================================================== */

/* Large Tablets & Medium Desktops (<= 1200px) */
@media (max-width: 1200px) {
  .kpi-row {
    grid-template-columns: repeat(3, 1fr);
  }

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

  .dashboard-main-layout {
    grid-template-columns: 1fr;
  }
}

/* Tablets (<= 992px) */
@media (max-width: 992px) {
  .sidebar {
    position: fixed;
    left: -260px;
    box-shadow: var(--shadow-modal);
  }

  html[dir="rtl"] .sidebar {
    left: auto;
    right: -260px;
  }

  .sidebar.mobile-open {
    left: 0;
  }

  html[dir="rtl"] .sidebar.mobile-open {
    right: 0;
  }

  .mobile-menu-btn {
    display: block;
  }

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

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

  .dashboard-2-cards-row {
    grid-template-columns: 1fr;
  }

  .topbar {
    padding: 0 1.25rem;
  }

  .content-body {
    padding: 1.25rem;
  }
}

/* Mobile Phones (<= 640px) */
@media (max-width: 640px) {
  .kpi-row {
    grid-template-columns: 1fr;
  }

  .doctors-card-grid {
    grid-template-columns: 1fr;
  }

  .form-grid-2col {
    grid-template-columns: 1fr;
  }

  .header-search input {
    width: 150px;
  }

  .header-search input:focus {
    width: 180px;
  }

  .admin-meta {
    display: none;
  }

  .modal-overlay {
    padding: 0;
    align-items: stretch;
  }

  .modal-box,
  .modal-box.modal-schedule-box {
    max-width: 100%;
    width: 100%;
    height: 100dvh;
    max-height: 100dvh;
    border-radius: 0;
    border: none;
  }

  .modal-header-bar,
  .modal-body-content,
  .modal-actions-bar {
    padding-inline: 1rem;
  }

  .day-chips-group {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .schedules-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .schedules-filters-wrap,
  .schedules-toolbar-right {
    width: 100%;
    justify-content: space-between;
  }

  .sched-search-box {
    width: 100%;
    min-width: 0;
  }
}

/* Shared Hospital AI identity; existing layout and theme are preserved. */
.hospital-brand-mark {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.brand-logo-icon {
  flex-shrink: 0;
  background: transparent;
}

.brand-tagline {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin: 0 0 0.75rem;
}


/* =========================================================================
   EMERGENCY & ACUTE TRIAGE TRACKING BOARD (CLINICAL / ED REDESIGN)
   ========================================================================= */

:root {
  /* Manchester / ESI Triage Scale Tokens */
  --triage-critical-bg: #DC2626;
  --triage-critical-text: #FFFFFF;
  --triage-critical-border: #B91C1C;
  --triage-critical-soft: #FEF2F2;
  --triage-critical-soft-text: #B91C1C;

  --triage-very-urgent-bg: #FFF7ED;
  --triage-very-urgent-text: #C2410C;
  --triage-very-urgent-border: #FDBA74;
  --triage-very-urgent-dot: #EA580C;

  --triage-urgent-bg: #FEFCE8;
  --triage-urgent-text: #A16207;
  --triage-urgent-border: #FDE047;
  --triage-urgent-dot: #D97706;

  --triage-standard-bg: #F0FDF4;
  --triage-standard-text: #15803D;
  --triage-standard-border: #86EFAC;
  --triage-standard-dot: #16A34A;

  --triage-non-urgent-bg: #F0F9FF;
  --triage-non-urgent-text: #0369A1;
  --triage-non-urgent-border: #7DD3FC;
  --triage-non-urgent-dot: #0284C7;
}

[data-theme="dark"],
body.dark-mode,
body.dark-theme {
  --triage-critical-bg: #DC2626;
  --triage-critical-text: #FFFFFF;
  --triage-critical-border: #EF4444;
  --triage-critical-soft: rgba(239, 68, 68, 0.14);
  --triage-critical-soft-text: #FCA5A5;

  --triage-very-urgent-bg: rgba(249, 115, 22, 0.16);
  --triage-very-urgent-text: #FDBA74;
  --triage-very-urgent-border: rgba(251, 146, 60, 0.45);

  --triage-urgent-bg: rgba(245, 158, 11, 0.16);
  --triage-urgent-text: #FDE68A;
  --triage-urgent-border: rgba(251, 191, 36, 0.45);

  --triage-standard-bg: rgba(34, 197, 94, 0.16);
  --triage-standard-text: #86EFAC;
  --triage-standard-border: rgba(74, 222, 128, 0.4);

  --triage-non-urgent-bg: rgba(14, 165, 233, 0.16);
  --triage-non-urgent-text: #7DD3FC;
  --triage-non-urgent-border: rgba(56, 189, 248, 0.4);
}

/* Emergency Section Layout */
.em-dashboard-section {
  display: none;
}
.em-dashboard-section.active {
  display: flex !important;
  flex-direction: column;
  gap: 1rem;
  min-height: calc(100vh - 120px);
}

.em-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  background: var(--color-surface, #ffffff);
  border: 1px solid var(--border-light, #e2e8f0);
  border-radius: 14px;
  padding: 0.9rem 1.15rem;
  box-shadow: var(--shadow-xs, 0 1px 3px rgba(15, 23, 42, 0.04));
}

.em-header-title-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.em-section-title {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--color-text-primary, #0f172a);
}

.em-section-subtitle {
  margin: 0.2rem 0 0;
  font-size: 0.8rem;
  color: var(--color-text-secondary, #64748b);
}

.em-live-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.22rem 0.65rem;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 600;
  background: rgba(16, 185, 129, 0.1);
  color: #059669;
  border: 1px solid rgba(16, 185, 129, 0.28);
}

[data-theme="dark"] .em-live-pill {
  background: rgba(16, 185, 129, 0.16);
  color: #6ee7b7;
}

.em-live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.25);
  animation: emPulseDot 2s infinite;
}

.em-live-dot.paused {
  background: #94a3b8;
  box-shadow: none;
  animation: none;
}

@keyframes emPulseDot {

  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }

  50% {
    opacity: 0.45;
    transform: scale(0.88);
  }
}

.em-header-bar__actions {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex-wrap: wrap;
}

.em-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid var(--border-light, #e2e8f0);
  background: var(--color-surface, #ffffff);
  color: var(--color-text-secondary, #475569);
  cursor: pointer;
  transition: all 0.15s ease;
}

.em-icon-btn:hover {
  border-color: var(--color-primary, #18b6f6);
  color: var(--color-primary, #18b6f6);
  background: var(--color-surface-soft, #f8fafc);
}

.em-icon-btn.muted {
  color: #94a3b8;
  background: var(--color-surface-soft, #f1f5f9);
}

.em-view-toggle {
  display: inline-flex;
  background: var(--color-surface-soft, #f1f5f9);
  border: 1px solid var(--border-light, #e2e8f0);
  border-radius: 10px;
  padding: 2px;
}

.em-view-toggle__btn {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.35rem 0.7rem;
  border: none;
  background: transparent;
  color: var(--color-text-secondary, #64748b);
  font-size: 0.78rem;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.em-view-toggle__btn .material-symbols-outlined {
  font-size: 16px;
}

.em-view-toggle__btn.active {
  background: var(--color-surface, #ffffff);
  color: var(--color-primary, #0284c7);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
}

.em-new-case-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 0.95rem;
  border-radius: 10px;
  font-size: 0.83rem;
  font-weight: 700;
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: #ffffff;
  border: none;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(220, 38, 38, 0.25);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.em-new-case-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(220, 38, 38, 0.35);
}

/* 5 Interactive KPI Cards */
.em-kpi-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.85rem;
  margin-bottom: 0;
}

.em-kpi-card {
  text-align: start;
  cursor: pointer;
  border: 1px solid var(--border-light, #e2e8f0);
  background: var(--color-surface, #ffffff);
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
  position: relative;
  width: 100%;
  font-family: inherit;
}

.em-kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md, 0 4px 12px rgba(15, 23, 42, 0.08));
  border-color: var(--color-primary, #18b6f6);
}

.em-kpi-card.active-filter {
  border-color: var(--color-primary, #0284c7);
  box-shadow: 0 0 0 2px rgba(24, 182, 246, 0.28);
}

.em-kpi-card--critical.active-filter {
  border-color: #dc2626;
  box-shadow: 0 0 0 2px rgba(220, 38, 38, 0.28);
}

.em-kpi-card--unassigned.has-unassigned {
  border-color: #fca5a5;
  background: linear-gradient(180deg, rgba(254, 242, 242, 0.65) 0%, var(--color-surface, #ffffff) 100%);
}

[data-theme="dark"] .em-kpi-card--unassigned.has-unassigned {
  border-color: rgba(239, 68, 68, 0.5);
  background: linear-gradient(180deg, rgba(239, 68, 68, 0.12) 0%, var(--color-surface, #1e293b) 100%);
}

.em-kpi-card--unassigned.has-unassigned .kpi-metric-num {
  color: #dc2626;
}

[data-theme="dark"] .em-kpi-card--unassigned.has-unassigned .kpi-metric-num {
  color: #f87171;
}

.em-kpi-icon--critical {
  background: #fef2f2 !important;
  color: #dc2626 !important;
}

.em-kpi-icon--very-urgent {
  background: #fff7ed !important;
  color: #ea580c !important;
}

.em-kpi-icon--unassigned {
  background: #fef2f2 !important;
  color: #dc2626 !important;
}

.em-kpi-icon--wait {
  background: #f0f9ff !important;
  color: #0284c7 !important;
}

.em-kpi-icon--doctors {
  background: #ecfdf5 !important;
  color: #059669 !important;
}

[data-theme="dark"] .em-kpi-icon--critical,
[data-theme="dark"] .em-kpi-icon--unassigned {
  background: rgba(239, 68, 68, 0.18) !important;
  color: #f87171 !important;
}

[data-theme="dark"] .em-kpi-icon--very-urgent {
  background: rgba(249, 115, 22, 0.18) !important;
  color: #fb923c !important;
}

[data-theme="dark"] .em-kpi-icon--wait {
  background: rgba(14, 165, 233, 0.18) !important;
  color: #38bdf8 !important;
}

[data-theme="dark"] .em-kpi-icon--doctors {
  background: rgba(16, 185, 129, 0.18) !important;
  color: #34d399 !important;
}

.em-kpi-top-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
}

.em-kpi-help-icon {
  font-size: 15px;
  color: var(--color-text-muted, #94a3b8);
  opacity: 0.75;
}

.em-kpi-delta {
  display: block;
  margin-top: 0.2rem;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--color-text-muted, #64748b);
}

.em-kpi-delta--alert {
  color: #dc2626;
}

[data-theme="dark"] .em-kpi-delta--alert {
  color: #f87171;
}

/* Emergency Toolbar */
.em-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.65rem;
  background: var(--color-surface, #ffffff);
  border: 1px solid var(--border-light, #e2e8f0);
  border-radius: 12px;
  padding: 0.65rem 0.9rem;
}

.em-toolbar__search {
  position: relative;
  flex: 1 1 240px;
  min-width: 200px;
  max-width: 340px;
}

.em-toolbar__search-icon {
  position: absolute;
  inset-inline-start: 0.65rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 18px;
  color: var(--color-text-muted, #94a3b8);
  pointer-events: none;
}

.em-toolbar__search-input {
  width: 100%;
  padding-block: 0.45rem;
  padding-inline-start: 2.1rem;
  padding-inline-end: 0.75rem;
  border: 1px solid var(--border-light, #cbd5e1);
  border-radius: 8px;
  font-size: 0.82rem;
  background: var(--color-surface-soft, #f8fafc);
  color: var(--color-text-primary, #0f172a);
}

.em-toolbar__search-input:focus {
  outline: none;
  border-color: var(--color-primary, #18b6f6);
  background: var(--color-surface, #ffffff);
  box-shadow: 0 0 0 3px rgba(24, 182, 246, 0.15);
}

.em-toolbar__filters {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.em-toolbar__select {
  padding: 0.42rem 0.65rem;
  border: 1px solid var(--border-light, #cbd5e1);
  border-radius: 8px;
  font-size: 0.79rem;
  font-weight: 500;
  background: var(--color-surface, #ffffff);
  color: var(--color-text-primary, #1e293b);
  cursor: pointer;
}

.em-filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.4rem 0.7rem;
  border-radius: 999px;
  border: 1px solid var(--border-light, #cbd5e1);
  background: var(--color-surface-soft, #f8fafc);
  color: var(--color-text-secondary, #475569);
  font-size: 0.76rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.em-filter-chip .material-symbols-outlined {
  font-size: 15px;
}

.em-filter-chip.active {
  background: rgba(239, 68, 68, 0.12);
  border-color: #ef4444;
  color: #dc2626;
}

[data-theme="dark"] .em-filter-chip.active {
  background: rgba(239, 68, 68, 0.22);
  color: #fca5a5;
}

.em-filter-chip--clear {
  background: transparent;
  border-style: dashed;
  color: var(--color-text-muted, #64748b);
}

.em-result-count {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--color-text-secondary, #64748b);
  white-space: nowrap;
}

/* Global utility for hidden elements */
.hidden {
  display: none !important;
}

/* Emergency Table Container (Single Page Scroll & Sticky Header, No Horizontal Scroll at 1440px) */
.em-dashboard-section {
  scroll-margin-top: 84px;
  padding-top: 4px;
}

.em-kpi-grid {
  scroll-margin-top: 84px;
  padding-top: 2px;
}

.em-table-container {
  flex: 1 1 auto;
  overflow-x: hidden;
  overflow-y: visible;
  border-radius: 14px;
  border: 1px solid var(--border-light, #e2e8f0);
  background: var(--color-surface, #ffffff);
}

.em-table {
  width: 100%;
  table-layout: fixed;
  border-collapse: separate;
  border-spacing: 0;
}

.em-table th,
.em-table td {
  padding: 0.72rem 0.75rem;
  vertical-align: middle;
}

.em-table thead th:nth-child(1) {
  width: 24%;
}

/* Patient */
.em-table thead th:nth-child(2) {
  width: 11%;
}

/* Arrival & Wait */
.em-table thead th:nth-child(3) {
  width: 11%;
}

/* AI Suggested (compact) */
.em-table thead th:nth-child(4) {
  width: 13%;
}

/* Final Priority */
.em-table thead th:nth-child(5) {
  width: 13%;
}

/* Department */
.em-table thead th:nth-child(6) {
  width: 15%;
}

/* Assigned Doctor */
.em-table thead th:nth-child(7) {
  width: 10%;
}

/* Status */
.em-table thead th:nth-child(8) {
  width: 92px;
  text-align: end;
}

/* Actions */

.em-table thead th {
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--color-surface-soft, #f8fafc);
  border-bottom: 1px solid var(--border-light, #e2e8f0);
  white-space: nowrap;
  user-select: none;
  font-size: 0.75rem;
}

.em-sortable-th {
  cursor: pointer;
  transition: color 0.15s ease, background-color 0.15s ease;
}

.em-sortable-th:hover {
  color: var(--color-primary, #0284c7);
  background: rgba(24, 182, 246, 0.06);
}

.em-sortable-th--active {
  color: var(--color-primary, #0284c7);
}

.em-sort-icon {
  font-size: 15px;
  vertical-align: middle;
  margin-inline-start: 2px;
  opacity: 0.65;
}

.em-sortable-th--active .em-sort-icon {
  opacity: 1;
  color: var(--color-primary, #0284c7);
}

/* Table Rows & Critical Left Border Accent */
.em-table tbody tr.em-case-row {
  cursor: pointer;
  transition: background-color 0.14s ease;
}

.em-table tbody tr.em-case-row:hover {
  background-color: rgba(24, 182, 246, 0.05);
}

.em-table tbody tr.em-row--critical td:first-child {
  border-inline-start: 4px solid #dc2626;
}

.em-table tbody tr.em-row--very-urgent td:first-child {
  border-inline-start: 4px solid #ea580c;
}

.em-table tbody tr.em-row--urgent td:first-child {
  border-inline-start: 4px solid #d97706;
}

.em-table tbody tr.em-row--standard td:first-child {
  border-inline-start: 4px solid transparent;
}

.em-table tbody tr.em-row--critical {
  background-color: rgba(254, 242, 242, 0.38);
}

[data-theme="dark"] .em-table tbody tr.em-row--critical {
  background-color: rgba(239, 68, 68, 0.07);
}

.em-table tbody tr.em-row--flash {
  animation: emNewCriticalFlash 2.2s ease-out;
}

@keyframes emNewCriticalFlash {

  0%,
  30% {
    background-color: rgba(239, 68, 68, 0.26);
  }

  100% {
    background-color: transparent;
  }
}

/* Patient Cell (Avatar + Name + Muted Age/Sex/MRN) */
.em-patient-cell {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.em-avatar {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  font-weight: 700;
  flex-shrink: 0;
  background: rgba(24, 182, 246, 0.14);
  color: #0284c7;
  border: 1px solid rgba(24, 182, 246, 0.25);
}

.em-avatar--critical {
  background: rgba(220, 38, 38, 0.13);
  color: #dc2626;
  border-color: rgba(220, 38, 38, 0.3);
}

[data-theme="dark"] .em-avatar--critical {
  background: rgba(239, 68, 68, 0.22);
  color: #fca5a5;
}

.em-avatar--lg {
  width: 46px;
  height: 46px;
  font-size: 0.95rem;
  border-radius: 12px;
}

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

.em-patient-name {
  font-weight: 700;
  font-size: 0.88rem;
  color: var(--color-text-primary, #0f172a);
  line-height: 1.25;
}

.em-patient-meta {
  font-size: 0.74rem;
  color: var(--color-text-muted, #64748b);
  margin-top: 2px;
}

.em-patient-complaint-preview {
  font-size: 0.73rem;
  color: var(--color-text-secondary, #475569);
  margin-top: 2px;
  max-width: 240px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Arrival & Waiting Time Counter */
.em-arrival-cell {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.em-arrival-time {
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--color-text-primary, #0f172a);
  font-variant-numeric: tabular-nums;
}

.em-wait-counter {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 0.73rem;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 999px;
  width: fit-content;
  font-variant-numeric: tabular-nums;
}

.em-wait-counter .material-symbols-outlined {
  font-size: 13px;
}

.em-wait-counter--ok {
  background: var(--color-surface-soft, #f1f5f9);
  color: var(--color-text-secondary, #475569);
}

.em-wait-counter--warn {
  background: #fef3c7;
  color: #b45309;
  border: 1px solid #fde68a;
}

.em-wait-counter--breach {
  background: #fee2e2;
  color: #b91c1c;
  border: 1px solid #fecaca;
}

[data-theme="dark"] .em-wait-counter--warn {
  background: rgba(245, 158, 11, 0.2);
  color: #fde68a;
  border-color: rgba(245, 158, 11, 0.4);
}

[data-theme="dark"] .em-wait-counter--breach {
  background: rgba(239, 68, 68, 0.22);
  color: #fca5a5;
  border-color: rgba(239, 68, 68, 0.45);
}

/* Manchester / ESI Triage Priority Pills */
.triage-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.32rem;
  padding: 0.28rem 0.68rem;
  border-radius: 999px;
  font-size: 0.77rem;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
  border: 1px solid transparent;
}

.triage-pill__icon {
  font-size: 15px;
}

.triage-pill--sm {
  padding: 0.18rem 0.52rem;
  font-size: 0.71rem;
}

.triage-pill--sm .triage-pill__icon {
  font-size: 13px;
}

/* 1. Critical / Immediate -> Solid Red */
.triage-pill--critical {
  background: var(--triage-critical-bg);
  color: var(--triage-critical-text);
  border-color: var(--triage-critical-border);
  box-shadow: 0 1px 4px rgba(220, 38, 38, 0.3);
}

/* 2. Very urgent -> Orange */
.triage-pill--very-urgent {
  background: var(--triage-very-urgent-bg);
  color: var(--triage-very-urgent-text);
  border-color: var(--triage-very-urgent-border);
}

/* 3. Urgent -> Yellow / Amber */
.triage-pill--urgent {
  background: var(--triage-urgent-bg);
  color: var(--triage-urgent-text);
  border-color: var(--triage-urgent-border);
}

/* 4. Standard -> Green */
.triage-pill--standard {
  background: var(--triage-standard-bg);
  color: var(--triage-standard-text);
  border-color: var(--triage-standard-border);
}

/* 5. Non-urgent -> Blue */
.triage-pill--non-urgent {
  background: var(--triage-non-urgent-bg);
  color: var(--triage-non-urgent-text);
  border-color: var(--triage-non-urgent-border);
}

/* De-emphasized AI Priority badge when AI == Final Priority */
.triage-pill--muted {
  background: var(--color-surface-soft, #f1f5f9) !important;
  color: var(--color-text-muted, #64748b) !important;
  border-color: var(--border-light, #e2e8f0) !important;
  box-shadow: none !important;
  font-weight: 500;
  opacity: 0.82;
}

/* Overridden Indicator (Escalated / De-escalated) */
.em-final-priority-stack {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
}

.em-override-tag {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 0.69rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 6px;
  cursor: help;
}

.em-override-tag--escalated {
  background: rgba(220, 38, 38, 0.12);
  color: #b91c1c;
  border: 1px dashed rgba(220, 38, 38, 0.45);
}

.em-override-tag--de-escalated {
  background: rgba(2, 132, 199, 0.12);
  color: #0369a1;
  border: 1px dashed rgba(2, 132, 199, 0.45);
}

[data-theme="dark"] .em-override-tag--escalated {
  background: rgba(239, 68, 68, 0.2);
  color: #fca5a5;
}

[data-theme="dark"] .em-override-tag--de-escalated {
  background: rgba(56, 189, 248, 0.2);
  color: #7dd3fc;
}

/* Distinct Emergency Status Pills */
.em-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.25rem 0.62rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
  border: 1px solid transparent;
}

.em-status-pill__icon {
  font-size: 14px;
}

/* Waiting triage -> Gray */
.em-status-pill--waiting-triage {
  background: #f1f5f9;
  color: #475569;
  border-color: #cbd5e1;
}

/* Triaged -> Blue */
.em-status-pill--triaged {
  background: #eff6ff;
  color: #1d4ed8;
  border-color: #bfdbfe;
}

/* In treatment (IN_EMERGENCY) -> Purple / Teal */
.em-status-pill--in-treatment {
  background: #f3e8ff;
  color: #7e22ce;
  border-color: #d8b4fe;
}

/* Admitted -> Indigo */
.em-status-pill--admitted {
  background: #e0e7ff;
  color: #3730a3;
  border-color: #a5b4fc;
}

/* Discharged -> Green */
.em-status-pill--discharged {
  background: #dcfce7;
  color: #15803d;
  border-color: #86efac;
}

/* Transferred -> Slate */
.em-status-pill--transferred {
  background: #e2e8f0;
  color: #334155;
  border-color: #94a3b8;
}

[data-theme="dark"] .em-status-pill--waiting-triage {
  background: rgba(148, 163, 184, 0.16);
  color: #cbd5e1;
  border-color: rgba(148, 163, 184, 0.35);
}

[data-theme="dark"] .em-status-pill--triaged {
  background: rgba(59, 130, 246, 0.18);
  color: #93c5fd;
  border-color: rgba(59, 130, 246, 0.4);
}

[data-theme="dark"] .em-status-pill--in-treatment {
  background: rgba(168, 85, 247, 0.18);
  color: #d8b4fe;
  border-color: rgba(168, 85, 247, 0.4);
}

[data-theme="dark"] .em-status-pill--admitted {
  background: rgba(99, 102, 241, 0.2);
  color: #a5b4fc;
  border-color: rgba(99, 102, 241, 0.4);
}

[data-theme="dark"] .em-status-pill--discharged {
  background: rgba(34, 197, 94, 0.18);
  color: #86efac;
  border-color: rgba(34, 197, 94, 0.4);
}

[data-theme="dark"] .em-status-pill--transferred {
  background: rgba(100, 116, 139, 0.25);
  color: #cbd5e1;
  border-color: rgba(148, 163, 184, 0.35);
}

/* Merged Unassigned · Assign Button & Assigned Doctor Control */
.em-unassigned-assign-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.28rem 0.65rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  background: #fffbeb;
  color: #b45309;
  border: 1px solid #f59e0b;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.em-unassigned-assign-btn:hover {
  background: #fef3c7;
  border-color: #d97706;
  color: #92400e;
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(217, 119, 6, 0.18);
}

.em-unassigned-assign-btn .material-symbols-outlined {
  font-size: 14px;
}

.em-unassigned-assign-btn__cta {
  color: #0284c7;
  text-decoration: underline;
  text-underline-offset: 2px;
}

[data-theme="dark"] .em-unassigned-assign-btn,
body.dark-theme .em-unassigned-assign-btn {
  background: rgba(245, 158, 11, 0.16);
  color: #fcd34d;
  border-color: rgba(245, 158, 11, 0.45);
}

[data-theme="dark"] .em-unassigned-assign-btn__cta,
body.dark-theme .em-unassigned-assign-btn__cta {
  color: #38bdf8;
}

.em-assigned-doc-control {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  max-width: 100%;
}

.em-doc-mini-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: rgba(16, 185, 129, 0.14);
  color: #059669;
  border: 1px solid rgba(16, 185, 129, 0.3);
  font-size: 0.68rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.em-assigned-doc-meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.em-assigned-doc-name {
  font-size: 0.79rem;
  font-weight: 600;
  color: var(--color-text-primary, #0f172a);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.em-doc-change-link {
  border: none;
  background: transparent;
  padding: 0;
  font-size: 0.69rem;
  font-weight: 600;
  color: var(--color-primary, #0284c7);
  cursor: pointer;
  text-align: start;
  width: fit-content;
}

.em-doc-change-link:hover {
  text-decoration: underline;
}

/* Per-Row Actions (Hover Quick Buttons + ⋯ Menu) */
.em-row-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.3rem;
  position: relative;
}

.em-row-quick-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: 1px solid var(--border-light, #e2e8f0);
  background: var(--color-surface, #ffffff);
  color: var(--color-text-secondary, #475569);
  cursor: pointer;
  transition: all 0.15s ease;
}

.em-row-quick-btn:hover {
  border-color: var(--color-primary, #18b6f6);
  color: var(--color-primary, #0284c7);
  background: var(--color-surface-soft, #f8fafc);
}

.em-row-quick-btn .material-symbols-outlined {
  font-size: 16px;
}

.em-row-menu-dropdown {
  position: absolute;
  inset-inline-end: 0;
  top: calc(100% + 4px);
  min-width: 195px;
  background: var(--color-surface, #ffffff);
  border: 1px solid var(--border-light, #cbd5e1);
  border-radius: 10px;
  box-shadow: 0 10px 25px rgba(15, 23, 42, 0.15);
  padding: 0.35rem;
  z-index: 40;
  display: none;
  flex-direction: column;
  gap: 2px;
}

.em-row-menu-dropdown.open {
  display: flex;
}

.em-row-menu-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.45rem 0.65rem;
  border: none;
  background: transparent;
  color: var(--color-text-primary, #1e293b);
  font-size: 0.79rem;
  font-weight: 500;
  text-align: start;
  border-radius: 7px;
  cursor: pointer;
}

.em-row-menu-item:hover {
  background: var(--color-surface-soft, #f1f5f9);
}

.em-row-menu-item--danger {
  color: #dc2626;
}

.em-row-menu-item .material-symbols-outlined {
  font-size: 16px;
}

/* Kanban Board View */
.em-board-container {
  display: grid;
  grid-template-columns: repeat(4, minmax(240px, 1fr));
  gap: 0.85rem;
  overflow-x: auto;
  padding-bottom: 0.5rem;
}

.em-board-col {
  background: var(--color-surface-soft, #f8fafc);
  border: 1px solid var(--border-light, #e2e8f0);
  border-radius: 12px;
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  min-height: 380px;
}

.em-board-col__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 0.45rem;
  border-bottom: 1px solid var(--border-light, #e2e8f0);
}

.em-board-col__title {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--color-text-primary, #0f172a);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.em-board-col__count {
  font-size: 0.73rem;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--color-surface, #ffffff);
  border: 1px solid var(--border-light, #cbd5e1);
}

.em-board-card {
  background: var(--color-surface, #ffffff);
  border: 1px solid var(--border-light, #e2e8f0);
  border-radius: 10px;
  padding: 0.75rem;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  transition: transform 0.14s ease, box-shadow 0.14s ease;
}

.em-board-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 10px rgba(15, 23, 42, 0.09);
}

.em-board-card.em-row--critical {
  border-inline-start: 4px solid #dc2626;
}

.em-board-card.em-row--very-urgent {
  border-inline-start: 4px solid #ea580c;
}

.em-board-card.em-row--urgent {
  border-inline-start: 4px solid #d97706;
}

/* Case Details Side Drawer */
.em-drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(2px);
  z-index: 1200;
}

.em-drawer {
  position: fixed;
  top: 0;
  bottom: 0;
  inset-inline-end: 0;
  width: min(560px, 95vw);
  background: var(--color-surface, #ffffff);
  border-inline-start: 1px solid var(--border-light, #e2e8f0);
  box-shadow: -8px 0 30px rgba(15, 23, 42, 0.18);
  z-index: 1210;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.em-drawer.hidden,
.em-drawer-backdrop.hidden {
  display: none !important;
}

.em-drawer__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 1.1rem 1.25rem;
  border-bottom: 1px solid var(--border-light, #e2e8f0);
  background: var(--color-surface, #ffffff);
}

.em-drawer__patient-top {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
}

.em-drawer__name-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.em-drawer__name {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--color-text-primary, #0f172a);
}

.em-mrn-tag {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 6px;
  background: var(--color-surface-soft, #f1f5f9);
  color: var(--color-text-secondary, #475569);
  font-family: monospace;
}

.em-drawer__demographics {
  font-size: 0.79rem;
  color: var(--color-text-secondary, #64748b);
  margin-top: 2px;
}

.em-drawer__badges {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.5rem;
}

.em-drawer__close-btn {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: 1px solid var(--border-light, #e2e8f0);
  background: var(--color-surface-soft, #f8fafc);
  color: var(--color-text-secondary, #475569);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.em-drawer__action-bar {
  padding: 0.8rem 1.25rem;
  background: var(--color-surface-soft, #f8fafc);
  border-bottom: 1px solid var(--border-light, #e2e8f0);
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.em-drawer__action-label {
  display: block;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--color-text-secondary, #64748b);
  margin-bottom: 0.25rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.em-drawer__inline-control {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.em-drawer__select {
  flex: 1;
  padding: 0.42rem 0.65rem;
  border-radius: 8px;
  border: 1px solid var(--border-light, #cbd5e1);
  background: var(--color-surface, #ffffff);
  color: var(--color-text-primary, #0f172a);
  font-size: 0.81rem;
}

.em-drawer__action-buttons {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.em-action-pill-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
  padding: 0.34rem 0.65rem;
  border-radius: 8px;
  border: 1px solid var(--border-light, #cbd5e1);
  background: var(--color-surface, #ffffff);
  color: var(--color-text-primary, #1e293b);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.14s ease;
}

.em-action-pill-btn .material-symbols-outlined {
  font-size: 15px;
}

.em-action-pill-btn:hover {
  border-color: var(--color-primary, #18b6f6);
  color: var(--color-primary, #0284c7);
}

.em-action-pill-btn--discharge:hover {
  border-color: #16a34a;
  color: #15803d;
}

.em-drawer__body {
  flex: 1;
  overflow-y: auto;
  padding: 1.1rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.em-drawer-card {
  background: var(--color-surface, #ffffff);
  border: 1px solid var(--border-light, #e2e8f0);
  border-radius: 12px;
  padding: 0.9rem 1rem;
}

.em-drawer-card__title {
  margin: 0 0 0.65rem;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--color-text-secondary, #475569);
  display: flex;
  align-items: center;
  gap: 0.4rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.em-drawer-card__title .material-symbols-outlined {
  font-size: 17px;
  color: var(--color-primary, #18b6f6);
}

.em-vitals-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.55rem;
}

.em-vital-tile {
  background: var(--color-surface-soft, #f8fafc);
  border: 1px solid var(--border-light, #e2e8f0);
  border-radius: 9px;
  padding: 0.5rem 0.65rem;
}

.em-vital-tile__label {
  font-size: 0.7rem;
  color: var(--color-text-muted, #64748b);
  font-weight: 600;
}

.em-vital-tile__val {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--color-text-primary, #0f172a);
  margin-top: 2px;
}

/* Timeline inside Drawer */
.em-timeline {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  position: relative;
  padding-inline-start: 0.5rem;
}

.em-timeline-item {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
}

.em-timeline-dot {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 13px;
  background: #e2e8f0;
  color: #64748b;
  margin-top: 2px;
}

.em-timeline-item.completed .em-timeline-dot {
  background: rgba(16, 185, 129, 0.16);
  color: #059669;
}

.em-timeline-item.override .em-timeline-dot {
  background: rgba(220, 38, 38, 0.16);
  color: #dc2626;
}

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

.em-timeline-title {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--color-text-primary, #0f172a);
}

.em-timeline-detail {
  font-size: 0.76rem;
  color: var(--color-text-secondary, #475569);
  margin-top: 2px;
}

.em-timeline-meta {
  font-size: 0.7rem;
  color: var(--color-text-muted, #94a3b8);
  margin-top: 2px;
}

/* Intake Modal, Update Modal & Priority Picker */
.em-intake-modal-box {
  max-width: 880px !important;
  width: 95vw;
  border-radius: 16px !important;
  background: var(--color-surface, #ffffff) !important;
  box-shadow: 0 24px 60px -12px rgba(15, 23, 42, 0.38) !important;
}

.em-update-modal-box {
  max-width: 520px !important;
  width: 95vw;
  border-radius: 16px !important;
  background: var(--color-surface, #ffffff) !important;
  box-shadow: 0 24px 60px -12px rgba(15, 23, 42, 0.38) !important;
}

.em-intake-modal-box .modal-header-bar,
.em-update-modal-box .modal-header-bar {
  padding: 1.15rem 1.5rem;
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--color-surface, #ffffff);
}

.em-intake-modal-box .modal-actions-bar,
.em-update-modal-box .modal-actions-bar {
  padding: 1rem 1.5rem;
  position: sticky;
  bottom: 0;
  z-index: 5;
  background: var(--color-surface, #ffffff);
}

.em-modal-subtitle {
  margin: 2px 0 0;
  font-size: 0.78rem;
  color: var(--color-text-secondary, #64748b);
  font-weight: 400;
}

.em-intake-modal-body,
.em-update-modal-body {
  padding: 24px !important;
  overflow-y: auto;
  overflow-x: hidden;
  flex: 1 1 auto;
}

.em-form-section {
  background: var(--color-surface-soft, #f8fafc);
  border: 1px solid var(--border-light, #e2e8f0);
  border-radius: 12px;
  padding: 1rem 1.1rem;
  margin-bottom: 1rem;
}

[data-theme="dark"] .em-form-section {
  background: rgba(15, 23, 42, 0.55);
  border-color: rgba(148, 163, 184, 0.18);
}

.em-form-section:last-child {
  margin-bottom: 0;
}

.em-form-section__head {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--color-text-primary, #0f172a);
  margin-bottom: 0.8rem;
}

.em-form-section__head--between {
  justify-content: space-between;
  flex-wrap: wrap;
}

.em-form-section__head-left {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.em-form-section__head .material-symbols-outlined {
  font-size: 18px;
  color: var(--color-primary, #18b6f6);
}

.em-unknown-chip-btn {
  margin-inline-start: auto;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 1px solid rgba(2, 132, 199, 0.32);
  background: rgba(24, 182, 246, 0.1);
  color: #0284c7;
  font-size: 0.74rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.14s ease;
}

.em-unknown-chip-btn:hover {
  background: rgba(24, 182, 246, 0.18);
  border-color: #0284c7;
}

[data-theme="dark"] .em-unknown-chip-btn {
  background: rgba(56, 189, 248, 0.15);
  color: #38bdf8;
  border-color: rgba(56, 189, 248, 0.35);
}

/* 12-Column Responsive Grid for Intake Form */
.em-grid-12 {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 0.75rem;
  align-items: start;
}

.em-col-12 {
  grid-column: span 12;
}

.em-col-6 {
  grid-column: span 6;
}

.em-col-4 {
  grid-column: span 4;
}

.em-col-3 {
  grid-column: span 3;
}

.em-grid-12 .form-group {
  margin-bottom: 0;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.em-grid-12 .form-group label {
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--color-text-secondary, #475569);
}

.em-grid-12 .form-group input,
.em-grid-12 .form-group select,
.em-grid-12 .form-group textarea {
  width: 100%;
  box-sizing: border-box;
}

/* Input with Unit Suffix & Real-Time Vital Validation */
.em-input-with-unit {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.em-input-with-unit input {
  width: 100%;
  padding-inline-end: 3.1rem !important;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

.em-input-unit-suffix {
  position: absolute;
  inset-inline-end: 0.6rem;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--color-text-muted, #94a3b8);
  pointer-events: none;
  user-select: none;
}

.em-input-with-unit.vital-warn input {
  border-color: #f59e0b !important;
  background: rgba(245, 158, 11, 0.06) !important;
  box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.16) !important;
}

.em-input-with-unit.vital-warn .em-input-unit-suffix {
  color: #d97706;
}

.em-input-with-unit.vital-danger input {
  border-color: #dc2626 !important;
  background: rgba(220, 38, 38, 0.06) !important;
  box-shadow: 0 0 0 2px rgba(220, 38, 38, 0.18) !important;
}

.em-input-with-unit.vital-danger .em-input-unit-suffix {
  color: #dc2626;
}

.em-vital-hint {
  min-height: 1rem;
  font-size: 0.7rem;
  font-weight: 600;
  line-height: 1.25;
  color: var(--color-text-muted, #64748b);
}

.em-vital-hint.vital-warn {
  color: #d97706;
}

.em-vital-hint.vital-danger {
  color: #dc2626;
}

[data-theme="dark"] .em-vital-hint.vital-warn {
  color: #fbbf24;
}

[data-theme="dark"] .em-vital-hint.vital-danger {
  color: #f87171;
}

/* AI Triage Suggestion Preview Box */
.em-ai-preview-box {
  border-radius: 10px;
  border: 1px solid rgba(24, 182, 246, 0.35);
  background: rgba(24, 182, 246, 0.06);
  padding: 0.8rem 0.95rem;
}

.em-ai-preview-box__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.em-ai-preview-box__title {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--color-text-primary, #0f172a);
}

.em-ai-preview-box__badges {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.em-ai-confidence-pill {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.71rem;
  font-weight: 700;
  background: rgba(2, 132, 199, 0.12);
  color: #0369a1;
  border: 1px solid rgba(2, 132, 199, 0.25);
}

[data-theme="dark"] .em-ai-confidence-pill {
  background: rgba(56, 189, 248, 0.16);
  color: #7dd3fc;
  border-color: rgba(56, 189, 248, 0.3);
}

.em-apply-ai-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 7px;
  border: 1px solid #0284c7;
  background: #0284c7;
  color: #ffffff;
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.14s ease;
}

.em-apply-ai-btn:hover {
  background: #0369a1;
}

.em-ai-preview-box__reason {
  margin: 0.45rem 0 0;
  font-size: 0.77rem;
  color: var(--color-text-secondary, #475569);
}

.em-ai-reasons-list {
  margin: 0.4rem 0 0;
  padding-inline-start: 1.15rem;
  font-size: 0.75rem;
  color: var(--color-text-primary, #1e293b);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.em-ai-preview-box__flags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.45rem;
}

.em-red-flag-chip {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.71rem;
  font-weight: 600;
  background: #fee2e2;
  color: #b91c1c;
}

[data-theme="dark"] .em-red-flag-chip {
  background: rgba(239, 68, 68, 0.22);
  color: #fca5a5;
}

/* 5-Level Priority Picker Cards with Obvious Selected State + Check Icon */
.em-priority-picker {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.5rem;
}

.em-priority-option {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 0.65rem 0.4rem 0.55rem;
  border-radius: 10px;
  border: 2px solid var(--border-light, #cbd5e1);
  background: var(--color-surface, #ffffff);
  cursor: pointer;
  font-size: 0.74rem;
  font-weight: 700;
  text-align: center;
  transition: all 0.15s ease;
}

.em-priority-option:hover {
  border-color: #94a3b8;
  transform: translateY(-1px);
}

.em-priority-option__check {
  position: absolute;
  top: 5px;
  inset-inline-end: 5px;
  width: 17px;
  height: 17px;
  border-radius: 999px;
  background: #0284c7;
  color: #ffffff;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  box-shadow: 0 2px 5px rgba(2, 132, 199, 0.35);
}

.em-priority-option.selected {
  border-color: #0284c7;
  background: rgba(24, 182, 246, 0.08);
  box-shadow: 0 0 0 3px rgba(24, 182, 246, 0.22);
}

.em-priority-option.selected .em-priority-option__check {
  display: inline-flex;
}

.em-priority-option[data-priority="CRITICAL"].selected {
  border-color: #dc2626;
  background: rgba(220, 38, 38, 0.08);
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.22);
}

.em-priority-option[data-priority="CRITICAL"].selected .em-priority-option__check {
  background: #dc2626;
}

.em-priority-option[data-priority="VERY_URGENT"].selected {
  border-color: #ea580c;
  background: rgba(234, 88, 12, 0.08);
  box-shadow: 0 0 0 3px rgba(234, 88, 12, 0.22);
}

.em-priority-option[data-priority="VERY_URGENT"].selected .em-priority-option__check {
  background: #ea580c;
}

.em-priority-option[data-priority="URGENT"].selected {
  border-color: #d97706;
  background: rgba(217, 119, 6, 0.08);
  box-shadow: 0 0 0 3px rgba(217, 119, 6, 0.22);
}

.em-priority-option[data-priority="URGENT"].selected .em-priority-option__check {
  background: #d97706;
}

.em-priority-option[data-priority="STANDARD"].selected {
  border-color: #16a34a;
  background: rgba(22, 163, 74, 0.08);
  box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.22);
}

.em-priority-option[data-priority="STANDARD"].selected .em-priority-option__check {
  background: #16a34a;
}

.em-priority-option[data-priority="NON_URGENT"].selected {
  border-color: #2563eb;
  background: rgba(37, 99, 235, 0.08);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.22);
}

.em-priority-option[data-priority="NON_URGENT"].selected .em-priority-option__check {
  background: #2563eb;
}

.em-override-reason-box {
  margin-top: 0.75rem;
  padding: 0.7rem 0.8rem;
  border-radius: 9px;
  background: #fffbeb;
  border: 1px solid #fcd34d;
}

[data-theme="dark"] .em-override-reason-box {
  background: rgba(245, 158, 11, 0.14);
  border-color: rgba(245, 158, 11, 0.4);
}

.em-override-reason-box label {
  display: block;
  font-size: 0.75rem;
  font-weight: 700;
  color: #b45309;
  margin-bottom: 0.35rem;
}

[data-theme="dark"] .em-override-reason-box label {
  color: #fcd34d;
}

.em-override-reason-box input {
  width: 100%;
  padding: 0.45rem 0.65rem;
  border-radius: 7px;
  border: 1px solid #f59e0b;
  background: var(--color-surface, #ffffff);
  color: var(--color-text-primary, #0f172a);
  font-size: 0.8rem;
  box-sizing: border-box;
}

/* Update Emergency Case Dialog (#modal-emergency-action) */
.em-modal-patient-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 0.9rem;
  border-radius: 12px;
  background: var(--color-surface-soft, #f8fafc);
  border: 1px solid var(--border-light, #e2e8f0);
  margin-bottom: 0.9rem;
}

[data-theme="dark"] .em-modal-patient-banner {
  background: rgba(15, 23, 42, 0.65);
  border-color: rgba(148, 163, 184, 0.2);
}

.em-modal-patient-banner__left {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
}

.em-modal-patient-banner__meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.em-modal-patient-banner__name {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--color-text-primary, #0f172a);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.em-modal-patient-banner__sub {
  font-size: 0.74rem;
  color: var(--color-text-secondary, #64748b);
}

.em-modal-patient-banner__badges {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  flex-shrink: 0;
}

.em-modal-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  padding: 4px;
  border-radius: 10px;
  background: var(--color-surface-soft, #f1f5f9);
  border: 1px solid var(--border-light, #e2e8f0);
  margin-bottom: 0.95rem;
}

[data-theme="dark"] .em-modal-tabs {
  background: rgba(15, 23, 42, 0.7);
  border-color: rgba(148, 163, 184, 0.2);
}

.em-modal-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 0.42rem 0.5rem;
  border-radius: 7px;
  border: none;
  background: transparent;
  color: var(--color-text-secondary, #475569);
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.14s ease;
}

.em-modal-tab .material-symbols-outlined {
  font-size: 15px;
}

.em-modal-tab.active {
  background: var(--color-surface, #ffffff);
  color: #0284c7;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.1);
}

[data-theme="dark"] .em-modal-tab.active {
  background: #1e293b;
  color: #38bdf8;
}

.em-doc-search-wrap {
  position: relative;
  margin-bottom: 0.65rem;
}

.em-doc-search-wrap .material-symbols-outlined {
  position: absolute;
  inset-inline-start: 0.65rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 17px;
  color: var(--color-text-muted, #94a3b8);
  pointer-events: none;
}

.em-doc-search-input {
  width: 100%;
  padding: 0.48rem 0.75rem 0.48rem 2.1rem;
  border-radius: 8px;
  border: 1px solid var(--border-light, #cbd5e1);
  background: var(--color-surface, #ffffff);
  color: var(--color-text-primary, #0f172a);
  font-size: 0.8rem;
  box-sizing: border-box;
}

.em-doc-select-list {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  max-height: 240px;
  overflow-y: auto;
  padding-inline-end: 2px;
}

.em-doc-select-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  padding: 0.55rem 0.75rem;
  border-radius: 10px;
  border: 1.5px solid var(--border-light, #e2e8f0);
  background: var(--color-surface, #ffffff);
  cursor: pointer;
  text-align: start;
  transition: all 0.14s ease;
}

.em-doc-select-item:hover {
  border-color: #7dd3fc;
  background: rgba(24, 182, 246, 0.04);
}

.em-doc-select-item.selected {
  border-color: #0284c7;
  background: rgba(24, 182, 246, 0.08);
  box-shadow: 0 0 0 2px rgba(24, 182, 246, 0.18);
}

.em-doc-select-item__left {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  min-width: 0;
}

.em-doc-select-item__name {
  font-size: 0.81rem;
  font-weight: 700;
  color: var(--color-text-primary, #0f172a);
}

.em-doc-select-item__spec {
  font-size: 0.72rem;
  color: var(--color-text-secondary, #64748b);
}

.em-doc-select-item__load {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  background: #f1f5f9;
  color: #475569;
  flex-shrink: 0;
}

.em-doc-select-item__load.load-busy {
  background: #fef3c7;
  color: #b45309;
}

.em-status-select-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.em-status-select-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.45rem;
  padding: 0.55rem 0.7rem;
  border-radius: 9px;
  border: 1.5px solid var(--border-light, #e2e8f0);
  background: var(--color-surface, #ffffff);
  cursor: pointer;
  transition: all 0.14s ease;
}

.em-status-select-card:hover {
  border-color: #94a3b8;
}

.em-status-select-card.selected {
  border-color: #0284c7;
  background: rgba(24, 182, 246, 0.08);
  box-shadow: 0 0 0 2px rgba(24, 182, 246, 0.18);
}

/* Mobile Stacked Case Cards (< 640px) */
.em-mobile-cards {
  display: none;
  flex-direction: column;
  gap: 0.65rem;
  padding: 0.65rem;
}

.em-mobile-card {
  background: var(--color-surface, #ffffff);
  border: 1px solid var(--border-light, #e2e8f0);
  border-radius: 12px;
  padding: 0.8rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.em-mobile-card.em-row--critical {
  border-inline-start: 4px solid #dc2626;
}

.em-mobile-card__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
}

.em-mobile-card__bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.45rem;
  padding-top: 0.45rem;
  border-top: 1px solid var(--border-light, #f1f5f9);
}

/* Toast Undo Button */
.toast-undo-btn {
  margin-inline-start: 0.6rem;
  padding: 2px 8px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.5);
  background: rgba(255, 255, 255, 0.16);
  color: #ffffff;
  font-size: 0.74rem;
  font-weight: 700;
  cursor: pointer;
}

/* Responsive Breakpoints (< 1024px & < 640px) */
@media (max-width: 1180px) {
  .em-kpi-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 1024px) {
  .em-table-container {
    overflow-x: auto;
  }

  .em-table {
    min-width: 860px;
  }

  .em-col-hide-tablet {
    display: none !important;
  }

  .em-kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .em-board-container {
    grid-template-columns: repeat(2, minmax(240px, 1fr));
  }
}

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

  .em-table {
    display: none !important;
  }

  .em-mobile-cards {
    display: flex !important;
  }

  .em-col-6,
  .em-col-4 {
    grid-column: span 12;
  }

  .em-col-3.em-col-sm-6 {
    grid-column: span 6;
  }

  .em-priority-picker,
  .em-status-select-grid,
  .em-vitals-grid {
    grid-template-columns: 1fr;
  }

  .em-intake-modal-box,
  .em-update-modal-box {
    width: 100vw !important;
    max-width: 100vw !important;
    height: 100dvh !important;
    max-height: 100dvh !important;
    border-radius: 0 !important;
    margin: 0 !important;
  }

  .em-drawer {
    width: 100vw;
  }
}

/* ==========================================================================
   APP SHELL INITIAL SKELETON (Anti-FOUC & Smooth Page Loads)
   ========================================================================== */
.app-shell-skeleton {
  display: flex;
  min-height: 100vh;
  width: 100%;
  background-color: var(--bg-app, #f8fafc);
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 9999;
}

html.dark-theme .app-shell-skeleton {
  background-color: #020B2D;
}

.skeleton-sidebar {
  width: var(--sidebar-width, 260px);
  min-width: var(--sidebar-width, 260px);
  background: var(--bg-sidebar, #ffffff);
  border-right: 1px solid var(--border-light, #e2e8f0);
  padding: 1.5rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

html[dir="rtl"] .skeleton-sidebar {
  border-right: none;
  border-left: 1px solid var(--border-light, #e2e8f0);
}

html.dark-theme .skeleton-sidebar {
  background: #0F1738;
  border-color: #2A3A6B;
}

.skeleton-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.skeleton-topbar {
  height: var(--topbar-height, 70px);
  background: var(--bg-topbar, #ffffff);
  border-bottom: 1px solid var(--border-light, #e2e8f0);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
}

html.dark-theme .skeleton-topbar {
  background: #0F1738;
  border-color: #2A3A6B;
}

.skeleton-content {
  padding: 1.75rem 2rem;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.skeleton-shimmer {
  background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
  background-size: 200% 100%;
  animation: appShimmer 1.5s infinite;
  border-radius: 8px;
}

html.dark-theme .skeleton-shimmer {
  background: linear-gradient(90deg, #16224A 25%, #23346B 50%, #16224A 75%);
  background-size: 200% 100%;
}

@keyframes appShimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* 404 & 403 Routing Error Views */
.not-found-section,
.access-denied-section {
  display: none;
}

.not-found-section.active,
.access-denied-section.active {
  display: block !important;
}

.routing-error-box {
  text-align: center;
  padding: 4.5rem 2rem;
  background: var(--bg-card, #ffffff);
  border-radius: 16px;
  border: 1px solid var(--border-light, #e2e8f0);
  max-width: 560px;
  margin: 3rem auto;
  box-shadow: var(--shadow-card);
}

html.dark-theme .routing-error-box {
  background: #0F1738;
  border-color: #2A3A6B;
}

.routing-error-icon {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1.5rem;
}

.routing-error-icon.info {
  background: var(--primary-light, #eff6ff);
  color: var(--primary, #2563eb);
}

.routing-error-icon.danger {
  background: rgba(239, 68, 68, 0.12);
  color: #ef4444;
}

.routing-error-title {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text-dark, #0f172a);
  margin-bottom: 0.6rem;
}

html.dark-theme .routing-error-title {
  color: #F8FAFC;
}

.routing-error-desc {
  font-size: 0.95rem;
  color: var(--text-muted, #64748b);
  line-height: 1.6;
  margin-bottom: 1.75rem;
}

html.dark-theme .routing-error-desc {
  color: #94A3B8;
}

.routing-error-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

.em-remote-panel[hidden], .em-remote-nav-badge[hidden], .em-remote-sound-btn[hidden] { display: none; }
.em-remote-nav-badge { background: #b91c1c; color: #ffffff; margin-inline-start: 4px; }
.em-remote-nav-badge--new { animation: em-remote-pulse 1.2s ease-in-out infinite; }
.em-remote-panel { border: 1px solid #fca5a5; border-radius: 12px; background: #fef2f2; padding: 14px; margin-bottom: 16px; }
.em-remote-panel__header { display: flex; align-items: center; gap: 8px; color: #991b1b; margin-bottom: 10px; }
.em-remote-panel__header h4 { margin: 0; font-size: 0.95rem; flex: 1; }
.em-remote-sound-btn { border: 1px solid #991b1b; background: #ffffff; color: #991b1b; border-radius: 8px; padding: 4px 10px; font-size: 0.78rem; font-weight: 600; cursor: pointer; }
.em-remote-panel__list { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
.em-remote-card { background: #ffffff; color: #0f172a; border: 1px solid #fecaca; border-radius: 10px; padding: 12px; min-width: 0; }
.em-remote-card--new { border: 2px solid #dc2626; animation: em-remote-pulse 1.2s ease-in-out infinite; }
.em-remote-card p { margin: 6px 0; font-size: 0.84rem; overflow-wrap: anywhere; }
.em-remote-card__top { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 0.84rem; }
.em-remote-card__top time { margin-inline-start: auto; color: #64748b; font-size: 0.76rem; }
.em-remote-card__status, .em-remote-card__priority { border-radius: 999px; padding: 1px 8px; font-size: 0.72rem; font-weight: 700; }
.em-remote-card__status { background: #e2e8f0; color: #0f172a; }
.em-remote-card__priority { background: #dc2626; color: #ffffff; }
.em-remote-card__meta { display: flex; flex-wrap: wrap; gap: 10px; font-size: 0.78rem; color: #475569; }
.em-remote-card__phone { display: inline-flex; align-items: center; gap: 4px; font-weight: 600; direction: ltr; }
.em-remote-card__phone .material-symbols-outlined { font-size: 16px; }
.em-remote-card__notes { width: 100%; box-sizing: border-box; margin: 8px 0; padding: 6px 8px; border: 1px solid #cbd5e1; border-radius: 8px; font-size: 0.8rem; background: #ffffff; color: #0f172a; }
.em-remote-card__actions { display: flex; flex-wrap: wrap; gap: 6px; }
.em-remote-action { border: 1px solid #cbd5e1; background: #f8fafc; color: #0f172a; border-radius: 8px; padding: 4px 10px; font-size: 0.76rem; font-weight: 600; cursor: pointer; }
.em-remote-action:hover { background: #e2e8f0; }
@keyframes em-remote-pulse { 50% { box-shadow: 0 0 0 5px rgba(220, 38, 38, 0.3); } }
@media (prefers-reduced-motion: reduce) { .em-remote-card--new, .em-remote-nav-badge--new { animation: none; } }
