/* ============================================================================
   HichCab Pro — Desktop Medical Practice Management Software
   Design System: Modern Clinical Precision (Doctolib Pro / Epic / Linear)
   ============================================================================ */

:root {
  /* Surface & Canvas Palette */
  --bg-canvas: #F8FAFC;
  --bg-card: #FFFFFF;
  --bg-subtle: #F1F5F9;
  --bg-hover: #E2E8F0;
  --bg-sidebar: #0F172A;
  --bg-sidebar-hover: #1E293B;
  --bg-sidebar-active: rgba(13, 148, 136, 0.18);
  --bg-pacs-dark: #090D16;
  --bg-pacs-panel: #111827;

  /* Typography Colors */
  --text-primary: #0F172A;
  --text-secondary: #334155;
  --text-muted: #64748B;
  --text-light: #94A3B8;
  --text-on-dark: #F8FAFC;

  /* Clinical Accent Palette */
  --primary: #0D9488;
  --primary-hover: #0F766E;
  --primary-active: #115E59;
  --primary-light: #CCFBF1;
  --primary-Soft: #F0FDFA;
  --primary-border: #99F6E4;

  --secondary: #0284C7;
  --secondary-hover: #0369A1;
  --secondary-light: #E0F2FE;
  --secondary-soft: #F0F9FF;
  --secondary-border: #BAE6FD;

  /* Semantic Clinical Alerts */
  --danger: #EF4444;
  --danger-dark: #B91C1C;
  --danger-light: #FEF2F2;
  --danger-border: #FECACA;

  --warning: #F59E0B;
  --warning-dark: #B45309;
  --warning-light: #FFFBEB;
  --warning-border: #FDE68A;

  --success: #10B981;
  --success-dark: #047857;
  --success-light: #ECFDF5;
  --success-border: #A7F3D0;

  --purple: #7C3AED;
  --purple-light: #F5F3FF;
  --purple-border: #DDD6FE;

  /* Borders & Shadows */
  --border-color: #E2E8F0;
  --border-strong: #CBD5E1;
  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 18px;
  --radius-full: 9999px;

  --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 4px 6px -1px rgba(15, 23, 42, 0.07), 0 2px 4px -2px rgba(15, 23, 42, 0.05);
  --shadow-lg: 0 10px 25px -3px rgba(15, 23, 42, 0.08), 0 4px 6px -4px rgba(15, 23, 42, 0.04);
  --shadow-xl: 0 20px 40px -10px rgba(15, 23, 42, 0.16);
  --shadow-focus: 0 0 0 3px rgba(13, 148, 136, 0.22);

  /* Layout Dimensions */
  --sidebar-width: 250px;
  --topbar-height: 60px;

  /* Font Stacks */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  --font-mono: 'JetBrains Mono', 'Cascadia Code', 'Fira Code', Consolas, monospace;
}

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

html, body {
  width: 100%;
  height: 100vh;
  overflow: hidden;
  background-color: var(--bg-canvas);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 13.5px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  user-select: none;
}

/* Allow text selection inside clinical notes, tables, and inputs */
input, textarea, select, code, pre,
.selectable, .clinical-text, .dossier-scroll-area, table td {
  user-select: text;
}

/* Tabular Numbers for all clinical values, dates, prices, timers, and IDs */
.tabular-nums,
.vital-value,
.stat-value,
.price-tag,
.timer-badge,
.dossier-num,
.lab-value,
#live-clock,
table td,
input[type="number"],
input[type="date"],
input[type="time"] {
  font-variant-numeric: tabular-nums;
}

/* Custom Sleek Scrollbars */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: #CBD5E1;
  border-radius: 999px;
}
::-webkit-scrollbar-thumb:hover {
  background: #94A3B8;
}

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  border: none;
  background: none;
}

a {
  color: var(--primary);
  text-decoration: none;
}

.hidden {
  display: none !important;
}

/* Keyboard Shortcut Pill */
kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 1px 5px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 600;
  line-height: 1.3;
  color: var(--text-muted);
  background: var(--bg-subtle);
  border: 1px solid var(--border-strong);
  border-bottom-width: 2px;
  border-radius: 4px;
}

/* ============================================================================
   2. Password Lock Overlay (#auth-screen)
   ============================================================================ */
.auth-overlay {
  position: fixed;
  inset: 0;
  z-index: 9000;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(circle at 18% 20%, rgba(13, 148, 136, 0.22), transparent 40%),
    radial-gradient(circle at 82% 80%, rgba(2, 132, 199, 0.20), transparent 42%),
    linear-gradient(135deg, #090D16 0%, #0F172A 50%, #131F33 100%);
  backdrop-filter: blur(16px);
  transition: opacity 0.28s ease, visibility 0.28s ease;
}

.auth-overlay.unlocked {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.auth-card {
  width: 100%;
  max-width: 430px;
  background: rgba(15, 23, 42, 0.82);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-xl);
  padding: 32px 30px 26px;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(13, 148, 136, 0.15);
  color: #F8FAFC;
  position: relative;
  overflow: hidden;
}

.auth-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--primary), var(--secondary), #10B981);
}

.auth-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 22px;
}

.auth-brand-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 11px;
  background: rgba(13, 148, 136, 0.16);
  border: 1px solid rgba(13, 148, 136, 0.35);
  border-radius: var(--radius-full);
  color: #5EEAD4;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.auth-db-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-full);
  font-size: 11px;
  color: #CBD5E1;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 8px var(--success);
}

.status-dot.cloud {
  background: #38BDF8;
  box-shadow: 0 0 8px #38BDF8;
}

.status-dot.warning {
  background: var(--warning);
  box-shadow: 0 0 8px var(--warning);
}

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

.auth-avatar {
  width: 68px;
  height: 68px;
  margin: 0 auto 12px;
  border-radius: 20px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: 700;
  color: #FFFFFF;
  box-shadow: 0 10px 25px rgba(13, 148, 136, 0.35);
  border: 2px solid rgba(255, 255, 255, 0.2);
}

.auth-cabinet-title {
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #FFFFFF;
  margin-bottom: 3px;
}

.auth-doctor-subtitle {
  font-size: 13px;
  color: #94A3B8;
}

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

.auth-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 600;
  color: #CBD5E1;
  margin-bottom: 7px;
}

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

.auth-input {
  width: 100%;
  padding: 11px 40px 11px 38px;
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: var(--radius-md);
  color: #FFFFFF;
  font-size: 14px;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.auth-input:focus {
  outline: none;
  border-color: #2DD4BF;
  box-shadow: 0 0 0 3px rgba(45, 212, 191, 0.2);
}

.auth-input-icon {
  position: absolute;
  left: 12px;
  color: #64748B;
  pointer-events: none;
}

.auth-toggle-pass {
  position: absolute;
  right: 10px;
  color: #94A3B8;
  padding: 4px;
  border-radius: 4px;
}
.auth-toggle-pass:hover {
  color: #FFFFFF;
}

.auth-error {
  padding: 9px 12px;
  background: rgba(239, 68, 68, 0.16);
  border: 1px solid rgba(239, 68, 68, 0.4);
  border-radius: var(--radius-sm);
  color: #FCA5A5;
  font-size: 12px;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-auth-submit {
  width: 100%;
  padding: 12px 16px;
  background: linear-gradient(135deg, var(--primary) 0%, #0284C7 100%);
  color: #FFFFFF;
  font-weight: 600;
  font-size: 14px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 8px 20px rgba(13, 148, 136, 0.35);
  transition: transform 0.12s ease, filter 0.12s ease;
}

.btn-auth-submit:hover {
  filter: brightness(1.06);
  transform: translateY(-1px);
}

.auth-demo-hint {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: #94A3B8;
}

.btn-demo-fill {
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #5EEAD4;
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 600;
  transition: background 0.15s;
}
.btn-demo-fill:hover {
  background: rgba(13, 148, 136, 0.25);
}

/* ============================================================================
   3. Desktop App Shell Layout (Sidebar 250px + Main Workspace)
   ============================================================================ */
.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}

/* Left Navigation Sidebar */
.sidebar {
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--bg-sidebar);
  color: var(--text-on-dark);
  display: flex;
  flex-direction: column;
  border-right: 1px solid #1E293B;
  z-index: 100;
}

.sidebar-brand {
  height: var(--topbar-height);
  padding: 0 16px;
  display: flex;
  align-items: center;
  gap: 11px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.brand-logo {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #FFFFFF;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(13, 148, 136, 0.35);
}

.brand-text h1 {
  font-size: 15.5px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #FFFFFF;
  display: flex;
  align-items: center;
  gap: 6px;
}

.pro-pill {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  padding: 1px 6px;
  border-radius: 4px;
  background: rgba(13, 148, 136, 0.25);
  color: #5EEAD4;
  border: 1px solid rgba(94, 234, 212, 0.3);
}

.brand-text p {
  font-size: 11.5px;
  color: #94A3B8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 165px;
}

.sidebar-cta {
  padding: 14px 14px 8px;
}

.btn-sidebar-new-patient {
  width: 100%;
  padding: 9.5px 12px;
  background: var(--primary);
  color: #FFFFFF;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 4px 12px rgba(13, 148, 136, 0.28);
  transition: background 0.15s, transform 0.12s;
}

.btn-sidebar-new-patient:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
}

.btn-sidebar-new-patient kbd {
  background: rgba(0, 0, 0, 0.22);
  border-color: rgba(255, 255, 255, 0.2);
  color: #E2E8F0;
}

.sidebar-nav {
  flex: 1;
  padding: 8px 10px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.nav-section-label {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #64748B;
  padding: 10px 10px 4px;
}

.nav-link {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 11px;
  border-radius: var(--radius-md);
  color: #CBD5E1;
  font-size: 13px;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
  text-align: left;
}

.nav-link-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.nav-link svg {
  width: 18px;
  height: 18px;
  color: #94A3B8;
  flex-shrink: 0;
  transition: color 0.15s;
}

.nav-link:hover {
  background: var(--bg-sidebar-hover);
  color: #FFFFFF;
}

.nav-link:hover svg {
  color: #E2E8F0;
}

.nav-link.active {
  background: var(--bg-sidebar-active);
  color: #5EEAD4;
  font-weight: 600;
  box-shadow: inset 3px 0 0 #2DD4BF;
}

.nav-link.active svg {
  color: #2DD4BF;
}

.nav-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.1);
  color: #E2E8F0;
  font-variant-numeric: tabular-nums;
}

.nav-badge.amber {
  background: rgba(245, 158, 11, 0.22);
  color: #FCD34D;
  border: 1px solid rgba(245, 158, 11, 0.35);
}

.nav-badge.teal {
  background: rgba(13, 148, 136, 0.25);
  color: #5EEAD4;
}

.sidebar-footer {
  padding: 12px 12px 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: rgba(9, 13, 22, 0.45);
}

.sidebar-db-widget {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  cursor: pointer;
  transition: background 0.15s;
}

.sidebar-db-widget:hover {
  background: rgba(255, 255, 255, 0.08);
}

.db-widget-left {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11.5px;
  font-weight: 500;
  color: #CBD5E1;
}

.btn-lock-app {
  width: 100%;
  padding: 7.5px 10px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.09);
  color: #94A3B8;
  font-size: 12px;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: all 0.15s;
}

.btn-lock-app:hover {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.35);
  color: #FCA5A5;
}

.btn-lock-app kbd {
  background: rgba(0, 0, 0, 0.3);
  border-color: rgba(255, 255, 255, 0.12);
  color: #94A3B8;
}

/* ============================================================================
   4. Top Header Bar (.topbar) & Global Spotlight Search
   ============================================================================ */
.workspace-column {
  display: flex;
  flex-direction: column;
  height: 100vh;
  min-width: 0;
  overflow: hidden;
  background: var(--bg-canvas);
}

.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(11, 18, 32, 0.52);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  z-index: 1040;
}

.sidebar-backdrop.open {
  display: block;
}

.btn-mobile-sidebar {
  display: none;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: var(--bg-subtle);
  color: var(--text-primary);
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s, border-color 0.15s;
}

.btn-mobile-sidebar:hover {
  background: var(--bg-hover);
  border-color: var(--border-strong);
}

.btn-close-sidebar {
  display: none;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  margin-left: auto;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.06);
  color: #CBD5E1;
  cursor: pointer;
  flex-shrink: 0;
}

.btn-close-sidebar:hover {
  background: rgba(255, 255, 255, 0.14);
  color: #FFFFFF;
}

.topbar {
  height: var(--topbar-height);
  min-height: var(--topbar-height);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  padding: 0 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-shrink: 0;
  min-width: 0;
  z-index: 80;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 1 220px;
  min-width: 0;
}

.topbar-view-title {
  font-size: 15.5px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.015em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

/* Global Spotlight Search */
.global-search-wrapper {
  position: relative;
  flex: 1 1 200px;
  min-width: 140px;
  max-width: 440px;
}

.global-search-box {
  display: flex;
  align-items: center;
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0 10px 0 11px;
  height: 36px;
  transition: all 0.15s ease;
}

.global-search-box:focus-within {
  background: var(--bg-card);
  border-color: var(--primary);
  box-shadow: var(--shadow-focus);
}

.global-search-box svg {
  width: 15px;
  height: 15px;
  color: var(--text-muted);
  margin-right: 8px;
  flex-shrink: 0;
}

.global-search-box input {
  flex: 1;
  min-width: 0;
  width: 100%;
  border: none;
  background: transparent;
  font-size: 13px;
  color: var(--text-primary);
  outline: none;
}

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

.global-search-box kbd {
  flex-shrink: 0;
  margin-left: 6px;
}

.global-search-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-xl);
  max-height: 380px;
  overflow-y: auto;
  z-index: 500;
  padding: 6px;
}

.search-result-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.12s;
}

.search-result-item:hover {
  background: var(--primary-Soft);
}

.search-result-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.search-result-avatar {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--primary-light);
  color: var(--primary-active);
  font-weight: 700;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  min-width: 0;
}

.topbar-right > * {
  flex-shrink: 0;
}

.topbar-right .btn-sm {
  height: 32px;
  padding: 0 10px;
  white-space: nowrap;
  flex-shrink: 0;
}

.topbar-presence-select {
  width: auto !important;
  height: 32px;
  padding: 0 8px !important;
  font-size: 12px !important;
  font-weight: 700 !important;
  white-space: nowrap;
  flex-shrink: 0;
}

.topbar-waiting-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 10px;
  background: var(--warning-light);
  border: 1px solid var(--warning-border);
  color: var(--warning-dark);
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
  cursor: pointer;
  transition: transform 0.12s, box-shadow 0.12s;
}

.topbar-waiting-pill:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-xs);
}

.session-mode-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 10px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: border-color 0.15s, background 0.15s;
}

.session-mode-pill:hover {
  background: var(--bg-hover);
  border-color: var(--border-strong);
}

.session-mode-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.session-mode-action {
  font-size: 11px;
  color: var(--primary);
  text-decoration: underline;
  margin-left: 2px;
}

.pulse-amber {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--warning);
  flex-shrink: 0;
  animation: pulse-ring 2s infinite;
}

@keyframes pulse-ring {
  0% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.55); }
  70% { box-shadow: 0 0 0 6px rgba(245, 158, 11, 0); }
  100% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0); }
}

.topbar-clock-box {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
  padding: 0 10px;
  border-left: 1px solid var(--border-color);
  border-right: 1px solid var(--border-color);
  white-space: nowrap;
  line-height: 1.15;
  flex-shrink: 0;
}

.topbar-clock-time {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  font-family: var(--font-mono);
}

.topbar-clock-date {
  font-size: 10.5px;
  color: var(--text-muted);
}

.topbar-doctor-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 3px 10px 3px 4px;
  border-radius: var(--radius-full);
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  cursor: pointer;
  max-width: 190px;
  flex-shrink: 0;
  overflow: hidden;
  transition: background 0.15s, border-color 0.15s;
}

.topbar-doctor-pill:hover {
  background: var(--bg-hover);
  border-color: var(--border-strong);
}

.doctor-mini-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: #FFFFFF;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.doctor-mini-info {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
  min-width: 0;
  overflow: hidden;
}

.doctor-mini-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.doctor-mini-spec {
  font-size: 10.5px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ============================================================================
   5. Reusable Clinical UI Components (Buttons, Badges, Cards, Forms, Tables)
   ============================================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.2;
  transition: all 0.14s ease;
  white-space: nowrap;
  border: 1px solid transparent;
}

.btn svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}

.btn-sm {
  padding: 5.5px 10px;
  font-size: 12px;
  border-radius: var(--radius-xs);
}

.btn-xs {
  padding: 3.5px 8px;
  font-size: 11px;
  border-radius: var(--radius-xs);
}

.btn-primary {
  background: var(--primary);
  color: #FFFFFF;
  box-shadow: var(--shadow-xs);
}
.btn-primary:hover {
  background: var(--primary-hover);
}

.btn-secondary {
  background: var(--secondary);
  color: #FFFFFF;
  box-shadow: var(--shadow-xs);
}
.btn-secondary:hover {
  background: var(--secondary-hover);
}

.btn-outline {
  background: var(--bg-card);
  border-color: var(--border-strong);
  color: var(--text-secondary);
}
.btn-outline:hover {
  background: var(--bg-subtle);
  color: var(--text-primary);
  border-color: #94A3B8;
}

.btn-soft-teal {
  background: var(--primary-Soft);
  border-color: var(--primary-border);
  color: var(--primary-active);
}
.btn-soft-teal:hover {
  background: var(--primary-light);
}

.btn-soft-blue {
  background: var(--secondary-soft);
  border-color: var(--secondary-border);
  color: var(--secondary-hover);
}
.btn-soft-blue:hover {
  background: var(--secondary-light);
}

.btn-danger {
  background: var(--danger);
  color: #FFFFFF;
}
.btn-danger:hover {
  background: var(--danger-dark);
}

.btn-soft-danger {
  background: var(--danger-light);
  border-color: var(--danger-border);
  color: var(--danger-dark);
}
.btn-soft-danger:hover {
  background: #FEE2E2;
}

/* Clinical Badges & Pills */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2.5px 8.5px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 600;
  line-height: 1.3;
  white-space: nowrap;
}

.badge-teal {
  background: var(--primary-Soft);
  color: var(--primary-active);
  border: 1px solid var(--primary-border);
}

.badge-blue {
  background: var(--secondary-soft);
  color: var(--secondary-hover);
  border: 1px solid var(--secondary-border);
}

.badge-green {
  background: var(--success-light);
  color: var(--success-dark);
  border: 1px solid var(--success-border);
}

.badge-amber {
  background: var(--warning-light);
  color: var(--warning-dark);
  border: 1px solid var(--warning-border);
}

.badge-red {
  background: var(--danger-light);
  color: var(--danger-dark);
  border: 1px solid var(--danger-border);
}

.badge-purple {
  background: var(--purple-light);
  color: var(--purple);
  border: 1px solid var(--purple-border);
}

.badge-slate {
  background: var(--bg-subtle);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
}

/* Blood Group Crimson Pill */
.blood-group-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 3px 9px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, #DC2626 0%, #991B1B 100%);
  color: #FFFFFF;
  font-weight: 800;
  font-size: 12px;
  letter-spacing: 0.02em;
  box-shadow: 0 2px 6px rgba(220, 38, 38, 0.25);
  font-variant-numeric: tabular-nums;
}

/* Cards */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-xs);
}

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

.card-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-title svg {
  width: 17px;
  height: 17px;
  color: var(--primary);
}

.card-body {
  padding: 16px 18px;
}

/* Forms & Inputs */
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}

.form-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.form-grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

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

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

.form-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.form-control {
  width: 100%;
  padding: 8px 11px;
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 13px;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: var(--shadow-focus);
}

textarea.form-control {
  resize: vertical;
  min-height: 72px;
}

/* Clinical Data Tables */
.table-container {
  width: 100%;
  overflow-x: auto;
}

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

.clinical-table th {
  padding: 10px 14px;
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--border-color);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  white-space: nowrap;
}

.clinical-table td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border-color);
  font-size: 13px;
  color: var(--text-secondary);
  vertical-align: middle;
}

.clinical-table tbody tr {
  transition: background 0.12s;
}

.clinical-table tbody tr:hover {
  background: #F8FAFC;
}

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

.clinical-table tbody tr.clickable-row:hover {
  background: var(--primary-Soft);
}

.clinical-table tbody tr.row-abnormal {
  background: #FEF2F2;
}
.clinical-table tbody tr.row-abnormal:hover {
  background: #FEE2E2;
}

/* ============================================================================
   6. View Panels & Internal Scrolling Containers
   ============================================================================ */
.main-content {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  position: relative;
}

.view-panel {
  display: none;
  width: 100%;
  height: 100%;
  overflow-y: auto;
  padding: 20px 24px 32px;
}

.view-panel.active {
  display: block;
}

/* Special full-height split layout for Patients 360° view */
#view-patients.active {
  display: flex;
  padding: 0;
  overflow: hidden;
}

/* ============================================================================
   7. View 1: Tableau de Bord (#view-dashboard)
   ============================================================================ */
.dashboard-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
  padding: 16px 20px;
  background: linear-gradient(135deg, #0F172A 0%, #1E293B 100%);
  border-radius: var(--radius-lg);
  color: #FFFFFF;
  box-shadow: var(--shadow-md);
}

.dashboard-banner-left h2 {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 3px;
}

.dashboard-banner-left p {
  font-size: 12.5px;
  color: #94A3B8;
}

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

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}

.kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  box-shadow: var(--shadow-xs);
  transition: transform 0.15s, box-shadow 0.15s;
}

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

.kpi-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

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

.kpi-value {
  font-size: 24px;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.kpi-sub {
  font-size: 11.5px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 5px;
}

.kpi-icon {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.kpi-icon.teal { background: var(--primary-Soft); color: var(--primary); }
.kpi-icon.amber { background: var(--warning-light); color: var(--warning-dark); }
.kpi-icon.blue { background: var(--secondary-soft); color: var(--secondary); }
.kpi-icon.green { background: var(--success-light); color: var(--success-dark); }
.kpi-icon.red { background: var(--danger-light); color: var(--danger); }

.dashboard-main-grid {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: 18px;
  margin-bottom: 18px;
}

.dashboard-bottom-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

/* Waiting Queue Item */
.waiting-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 14px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  background: var(--bg-card);
  transition: border-color 0.15s, background 0.15s;
}

.waiting-item:hover {
  border-color: var(--primary-border);
  background: #F8FAFC;
}

.waiting-item.in-consultation {
  background: var(--primary-Soft);
  border-color: var(--primary);
}

.waiting-rank {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  background: var(--warning-light);
  color: var(--warning-dark);
  font-weight: 700;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.waiting-item.in-consultation .waiting-rank {
  background: var(--primary);
  color: #FFFFFF;
}

/* Clinical Alert Item */
.alert-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  border-left: 4px solid var(--danger);
  background: var(--danger-light);
  margin-bottom: 8px;
  cursor: pointer;
  transition: transform 0.12s;
}

.alert-item:hover {
  transform: translateX(2px);
}

.alert-item.warning {
  border-left-color: var(--warning);
  background: var(--warning-light);
}

.alert-item.info {
  border-left-color: var(--secondary);
  background: var(--secondary-soft);
}

/* ============================================================================
   8. View 2: Dossiers Patients & Patient 360° Medical Dossier
   ============================================================================ */
.patients-master-pane {
  width: 370px;
  min-width: 340px;
  height: 100%;
  background: var(--bg-card);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  transition: width 0.2s ease;
}

.patients-master-pane.collapsed {
  display: none;
}

.patients-master-header {
  padding: 14px 14px 10px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.patients-master-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.patients-filter-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.patients-directory-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.patient-list-card {
  padding: 11px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  cursor: pointer;
  transition: all 0.14s ease;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.patient-list-card:hover {
  border-color: #94A3B8;
  background: var(--bg-canvas);
}

.patient-list-card.active {
  background: var(--primary-Soft);
  border-color: var(--primary);
  box-shadow: inset 3px 0 0 var(--primary);
}

.patient-card-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.patient-avatar {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--secondary-light);
  color: var(--secondary-hover);
  font-weight: 700;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.patient-avatar.female {
  background: #FCE7F3;
  color: #BE185D;
}

.patient-card-meta h4 {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.patient-card-meta p {
  font-size: 11.5px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Right Pane: Patient 360° Dossier Workspace */
.patient-dossier-workspace {
  flex: 1;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg-canvas);
}

.dossier-empty-state {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px;
  text-align: center;
  color: var(--text-muted);
}

.dossier-content-wrapper {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

/* Sticky Patient 360° Header Banner */
.dossier-sticky-header {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  padding: 14px 22px 0;
  flex-shrink: 0;
  box-shadow: var(--shadow-xs);
}

.dossier-top-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.dossier-identity {
  display: flex;
  align-items: center;
  gap: 14px;
}

.dossier-large-avatar {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  color: #FFFFFF;
  font-size: 18px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: var(--shadow-sm);
}

.dossier-title-block h2 {
  font-size: 19px;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
}

.dossier-meta-pills {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 4px;
  font-size: 12px;
  color: var(--text-secondary);
}

.dossier-meta-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.dossier-actions-toolbar {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
}

/* Prominent Red Allergies & Antécédents Alert Strip */
.dossier-allergy-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  background: linear-gradient(90deg, #FEF2F2 0%, #FFFBEB 100%);
  border: 1px solid var(--danger-border);
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.dossier-allergy-strip.safe {
  background: var(--success-light);
  border-color: var(--success-border);
}

.allergy-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 12px;
}

.allergy-label {
  font-weight: 700;
  color: var(--danger-dark);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.03em;
}

/* Sub-Tabs inside Patient Dossier */
.dossier-tabs {
  display: flex;
  align-items: center;
  gap: 6px;
  border-top: 1px solid var(--bg-subtle);
  padding-top: 4px;
  overflow-x: auto;
}

.dossier-tab {
  padding: 9px 14px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-muted);
  border-bottom: 2.5px solid transparent;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  transition: color 0.15s, border-color 0.15s;
  white-space: nowrap;
}

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

.dossier-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

/* Scrollable Dossier Tab Area */
.dossier-scroll-area {
  flex: 1;
  overflow-y: auto;
  padding: 18px 22px 32px;
}

.dossier-tab-pane {
  display: none;
}

.dossier-tab-pane.active {
  display: block;
}

/* Vitals Snapshot Strip in Synthèse 360° */
.vitals-snapshot-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 12px;
  margin-bottom: 18px;
}

.vital-mini-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  box-shadow: var(--shadow-xs);
}

.vital-mini-card.abnormal {
  border-color: var(--danger-border);
  background: #FFFBFB;
}

.vital-mini-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.vital-mini-value {
  font-size: 19px;
  font-weight: 800;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}

.vital-mini-unit {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
}

.synthese-grid {
  display: grid;
  grid-template-columns: 1fr 1.15fr;
  gap: 18px;
}

.antecedent-block {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--bg-subtle);
  border-left: 3px solid var(--primary);
  margin-bottom: 10px;
}

.antecedent-block.allergy {
  background: var(--danger-light);
  border-left-color: var(--danger);
}

.antecedent-block.chronic {
  background: var(--warning-light);
  border-left-color: var(--warning);
}

.antecedent-block h5 {
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.antecedent-block p {
  font-size: 13px;
  color: var(--text-primary);
  white-space: pre-line;
}

/* ============================================================================
   9. Radiology & Biology Files Cards, Drag & Drop & PACS Viewer
   ============================================================================ */
.dropzone-banner {
  border: 2px dashed var(--primary-border);
  background: linear-gradient(135deg, var(--primary-Soft) 0%, var(--secondary-soft) 100%);
  border-radius: var(--radius-md);
  padding: 18px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.12s;
}

.dropzone-banner:hover,
.dropzone-banner.dragover {
  border-color: var(--primary);
  transform: translateY(-1px);
}

.dropzone-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.dropzone-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--bg-card);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-sm);
}

.files-gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}

.medical-file-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-xs);
  transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
}

.medical-file-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: #CBD5E1;
}

.medical-file-card.abnormal {
  border-color: var(--danger-border);
}

.file-card-preview {
  height: 148px;
  background: #0F172A;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  cursor: pointer;
}

.file-card-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.25s ease;
}

.medical-file-card:hover .file-card-preview img {
  transform: scale(1.04);
}

.file-card-badges {
  position: absolute;
  top: 10px;
  left: 10px;
  right: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  pointer-events: none;
}

.file-card-body {
  padding: 13px 15px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.file-card-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
}

.file-card-conclusion {
  font-size: 12px;
  color: var(--text-secondary);
  background: var(--bg-subtle);
  padding: 7px 10px;
  border-radius: var(--radius-xs);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.file-lab-mini-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.lab-mini-pill {
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 4px;
  background: var(--bg-subtle);
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
}

.lab-mini-pill.flag-high,
.lab-mini-pill.flag-low {
  background: var(--danger-light);
  color: var(--danger-dark);
  font-weight: 700;
  border: 1px solid var(--danger-border);
}

.file-card-footer {
  padding: 10px 15px;
  border-top: 1px solid var(--border-color);
  background: #FAFBFD;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Built-in PACS / Medical Document Viewer Modal (#file-viewer-modal) */
.pacs-viewer-dialog {
  width: 95vw;
  max-width: 1340px;
  height: 90vh;
  background: var(--bg-pacs-panel);
  color: #F8FAFC;
  border: 1px solid #334155;
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 25px 70px rgba(0, 0, 0, 0.75);
}

.pacs-header {
  padding: 12px 18px;
  background: #090D16;
  border-bottom: 1px solid #1E293B;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.pacs-toolbar {
  padding: 8px 18px;
  background: #111827;
  border-bottom: 1px solid #1E293B;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.pacs-tool-btn {
  padding: 6px 11px;
  border-radius: var(--radius-xs);
  background: #1E293B;
  border: 1px solid #334155;
  color: #E2E8F0;
  font-size: 12px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s;
}

.pacs-tool-btn:hover {
  background: #334155;
  color: #FFFFFF;
}

.pacs-tool-btn.active {
  background: var(--primary);
  border-color: #2DD4BF;
  color: #FFFFFF;
}

.pacs-body {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 410px;
  overflow: hidden;
}

.pacs-canvas-stage {
  background: var(--bg-pacs-dark);
  position: relative;
  overflow: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.pacs-media-target {
  max-width: 100%;
  max-height: 100%;
  transition: transform 0.2s ease, filter 0.2s ease;
  transform-origin: center center;
}

/* Radiology Negative & High-Contrast CSS Filters */
.xray-invert {
  filter: invert(1) hue-rotate(180deg) contrast(1.15) !important;
}

.xray-high-contrast {
  filter: contrast(1.45) brightness(1.06) !important;
}

.xray-invert.xray-high-contrast {
  filter: invert(1) hue-rotate(180deg) contrast(1.5) brightness(1.05) !important;
}

.pacs-sidebar {
  background: var(--bg-card);
  color: var(--text-primary);
  border-left: 1px solid var(--border-color);
  overflow-y: auto;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* ============================================================================
   10. Vitals Evolution SVG Chart & Consultations Timeline
   ============================================================================ */
.vitals-chart-box {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 18px;
}

.svg-chart-stage {
  width: 100%;
  height: 240px;
  background: linear-gradient(180deg, #F8FAFC 0%, #FFFFFF 100%);
  border-radius: var(--radius-sm);
  border: 1px solid var(--bg-subtle);
  position: relative;
  overflow: hidden;
}

.timeline-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
  position: relative;
  padding-left: 18px;
}

.timeline-list::before {
  content: "";
  position: absolute;
  top: 8px;
  bottom: 8px;
  left: 5px;
  width: 2px;
  background: var(--border-strong);
}

.timeline-card {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  box-shadow: var(--shadow-xs);
}

.timeline-card::before {
  content: "";
  position: absolute;
  left: -18px;
  top: 18px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--primary);
  border: 2px solid var(--bg-card);
  box-shadow: 0 0 0 2px var(--primary-border);
}

/* ============================================================================
   11. Modals & Toast Notifications
   ============================================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(15, 23, 42, 0.62);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

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

.modal-dialog {
  width: 100%;
  max-width: 720px;
  max-height: 90vh;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-xl);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: modal-pop 0.16s ease-out;
}

.modal-dialog.modal-lg {
  max-width: 880px;
}

@keyframes modal-pop {
  from { opacity: 0; transform: scale(0.97) translateY(6px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
  padding: 15px 20px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #FAFBFD;
}

.modal-title {
  font-size: 15.5px;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

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

.modal-footer {
  padding: 13px 20px;
  border-top: 1px solid var(--border-color);
  background: #FAFBFD;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  bottom: 20px;
  right: 22px;
  z-index: 9500;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  min-width: 290px;
  max-width: 420px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  background: #0F172A;
  color: #FFFFFF;
  box-shadow: var(--shadow-lg);
  border-left: 4px solid var(--primary);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
  font-weight: 500;
  animation: toast-slide 0.2s ease-out;
}

.toast.error { border-left-color: var(--danger); }
.toast.warning { border-left-color: var(--warning); }
.toast.success { border-left-color: var(--success); }

@keyframes toast-slide {
  from { opacity: 0; transform: translateX(24px); }
  to { opacity: 1; transform: translateX(0); }
}

/* ============================================================================
   12. Printable Ordonnance A4 (Modèle Dr. Hichem Ouadi) & Rapports A4 (#print-area)
   ============================================================================ */
.print-only-container {
  display: none;
}

@media print {
  @page {
    size: A4 portrait;
    margin: 12mm 14mm;
  }

  * {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  html, body {
    height: auto !important;
    overflow: visible !important;
    background: #FFFFFF !important;
    color: #000000 !important;
    font-size: 11pt;
  }

  .app-shell,
  .auth-overlay,
  .modal-overlay,
  .toast-container {
    display: none !important;
  }

  .print-only-container {
    display: block !important;
    width: 100%;
    position: relative;
    font-family: 'Segoe UI', 'Inter', Arial, sans-serif;
    color: #0F172A;
  }

  /* --- Modèle A4 Ordonnance Type (Dr. Hichem Ouadi) --- */
  .a4-ordonnance-page {
    width: 100%;
    min-height: 268mm;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    color: #0F172A;
  }

  .a4-ord-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10mm;
    padding: 0 4mm;
    margin-bottom: 5mm;
  }

  .a4-ord-header-fr {
    text-align: center;
    color: #1B639E;
    font-family: 'Segoe UI', 'Calibri', Arial, sans-serif;
    line-height: 1.28;
  }

  .a4-ord-doc-name {
    font-size: 16pt;
    font-weight: 700;
    letter-spacing: 0.01em;
    margin-bottom: 3px;
  }

  .a4-ord-doc-spec {
    font-size: 11pt;
    font-weight: 600;
    margin-bottom: 2px;
  }

  .a4-ord-doc-diploma {
    font-size: 10.5pt;
    font-weight: 500;
  }

  .a4-ord-header-ar {
    text-align: center;
    color: #1B639E;
    font-family: 'Traditional Arabic', 'Arabic Typesetting', 'Simplified Arabic', 'Segoe UI', serif;
    line-height: 1.15;
  }

  .a4-ord-doc-name-ar {
    font-size: 23pt;
    font-weight: 700;
    margin-bottom: 2px;
  }

  .a4-ord-doc-spec-ar {
    font-size: 14.5pt;
    font-weight: 600;
  }

  .a4-ord-doc-diploma-ar {
    font-size: 13.5pt;
    font-weight: 600;
  }

  .a4-ord-cnam-box-wrap {
    display: flex;
    justify-content: center;
    margin-bottom: 5mm;
  }

  .a4-ord-cnam-box {
    border: 1.5px solid #1B639E;
    padding: 5px 22px;
    text-align: center;
    color: #1B639E;
    font-family: 'Segoe UI', Arial, sans-serif;
    font-size: 10.5pt;
    font-weight: 700;
    line-height: 1.45;
  }

  .a4-ord-date-row {
    display: flex;
    justify-content: flex-end;
    align-items: baseline;
    gap: 6px;
    padding-right: 20mm;
    margin-bottom: 7mm;
    font-size: 11pt;
    color: #1B639E;
    font-family: 'Segoe UI', Arial, sans-serif;
  }

  .a4-ord-date-label {
    font-weight: 700;
  }

  .a4-ord-date-value {
    color: #0F172A;
    font-weight: 600;
    min-width: 32mm;
    text-align: center;
    border-bottom: 1px dotted #1B639E;
    padding-bottom: 2px;
  }

  .a4-ord-patient-line {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 5px 4px;
    margin-bottom: 6mm;
    border-bottom: 1px solid #CBD5E1;
    font-size: 11pt;
    color: #0F172A;
  }

  .a4-ord-doc-title {
    text-align: center;
    margin: 2mm 0 7mm;
  }

  .a4-ord-doc-title h2 {
    display: inline-block;
    font-size: 13pt;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #0F172A;
    padding-bottom: 3px;
    border-bottom: 1.5px solid #1B639E;
  }

  .a4-ord-rx-body {
    flex: 1 1 auto;
  }

  .a4-ord-rx-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 14px;
  }

  .a4-ord-rx-item {
    padding-bottom: 8px;
    border-bottom: 1px dashed #E2E8F0;
    break-inside: avoid;
  }

  .a4-ord-rx-med {
    font-size: 11.5pt;
    font-weight: 700;
    color: #0F172A;
    display: flex;
    justify-content: space-between;
    gap: 12px;
  }

  .a4-ord-rx-posology {
    font-size: 10.5pt;
    color: #334155;
    margin-top: 3px;
    padding-left: 16px;
    line-height: 1.45;
  }

  .a4-ord-rx-notes {
    margin-top: 12px;
    padding: 12px 14px;
    border-left: 3px solid #1B639E;
    background: #F8FAFC !important;
    white-space: pre-line;
    line-height: 1.55;
    font-size: 11pt;
    color: #0F172A;
  }

  .a4-ord-signature-row {
    display: flex;
    justify-content: flex-end;
    margin-top: 10mm;
    margin-bottom: 8mm;
    padding-right: 8mm;
  }

  .a4-ord-signature-label {
    width: 52mm;
    padding-top: 4px;
    border-top: 1px dashed #CBD5E1;
    text-align: center;
    font-size: 9pt;
    color: #64748B;
  }

  .a4-ordonnance-footer {
    margin-top: auto;
    padding-top: 4mm;
    text-align: center;
    color: #1B639E;
    font-family: 'Segoe UI', Arial, sans-serif;
    line-height: 1.4;
  }

  .a4-ord-footer-address {
    font-size: 10pt;
    font-weight: 600;
  }

  .a4-ord-addr-fr {
    font-style: italic;
  }

  .a4-ord-addr-ar {
    font-family: 'Traditional Arabic', 'Segoe UI', serif;
    font-size: 12.5pt;
    margin-left: 10px;
  }

  .a4-ord-footer-contact {
    font-size: 10pt;
    font-weight: 600;
  }

  /* --- Rapports A4 (#print-area .a4-report-page) --- */
  .a4-report-page {
    width: 100%;
    min-height: 265mm;
    position: relative;
  }

  .a4-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding-bottom: 14px;
    border-bottom: 2.5px solid #0D9488;
    margin-bottom: 18px;
  }

  .a4-doc-left h1 {
    font-size: 16pt;
    font-weight: 800;
    color: #0F172A;
    margin-bottom: 2px;
  }

  .a4-doc-left h2 {
    font-size: 11.5pt;
    font-weight: 600;
    color: #0D9488;
    margin-bottom: 4px;
  }

  .a4-doc-left p,
  .a4-doc-right p {
    font-size: 9.5pt;
    color: #334155;
    line-height: 1.4;
  }

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

  .a4-patient-banner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    background: #F8FAFC !important;
    border: 1px solid #CBD5E1;
    border-radius: 6px;
    margin-bottom: 22px;
    font-size: 10.5pt;
  }

  .a4-title-center {
    text-align: center;
    margin: 18px 0 24px;
  }

  .a4-title-center h2 {
    display: inline-block;
    font-size: 15pt;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding-bottom: 5px;
    border-bottom: 2px solid #0F172A;
  }

  .a4-rx-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 28px;
  }

  .a4-rx-item {
    padding-bottom: 10px;
    border-bottom: 1px dashed #CBD5E1;
  }

  .a4-rx-med {
    font-size: 12pt;
    font-weight: 700;
    color: #0F172A;
    display: flex;
    justify-content: space-between;
  }

  .a4-rx-posology {
    font-size: 10.5pt;
    color: #334155;
    margin-top: 3px;
    padding-left: 14px;
  }

  .a4-footer-signature {
    margin-top: 48px;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    padding-top: 14px;
    border-top: 1px solid #E2E8F0;
    font-size: 9.5pt;
  }

  .a4-stamp-box {
    width: 210px;
    height: 95px;
    border: 1px dashed #94A3B8;
    border-radius: 6px;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 8px;
    font-size: 9pt;
    color: #64748B;
  }
}

/* ============================================================================
   14. Full-Screen Medical Loading Overlay & Loading Indicators
   ============================================================================ */
.app-loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 999999;
  background: radial-gradient(circle at 50% 38%, #1e293b 0%, #0f172a 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 1;
  visibility: visible;
  transition: opacity 0.45s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.45s ease;
  backdrop-filter: blur(10px);
}

.app-loading-overlay.fade-out {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.app-loading-card {
  text-align: center;
  color: #f8fafc;
  max-width: 440px;
  width: 90%;
  padding: 42px 36px;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 24px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7), 0 0 50px rgba(13, 148, 136, 0.2);
}

.loading-icon-wrapper {
  position: relative;
  width: 90px;
  height: 90px;
  margin: 0 auto 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.loading-medical-badge {
  width: 68px;
  height: 68px;
  border-radius: 20px;
  background: linear-gradient(135deg, #0d9488 0%, #0284c7 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  box-shadow: 0 12px 28px -4px rgba(13, 148, 136, 0.6), 0 6px 12px -4px rgba(2, 132, 199, 0.4);
  position: relative;
  z-index: 2;
}

.loading-pulse-ring {
  position: absolute;
  inset: -6px;
  border-radius: 26px;
  border: 2px solid rgba(13, 148, 136, 0.6);
  animation: pulseRing 2.2s cubic-bezier(0.215, 0.61, 0.355, 1) infinite;
  pointer-events: none;
}

.loading-pulse-ring.delay {
  animation-delay: 1.1s;
  border-color: rgba(56, 189, 248, 0.5);
}

.loading-ecg-svg {
  animation: ecgBeat 1.5s ease-in-out infinite;
}

.loading-title {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: #f8fafc;
  margin: 0 0 6px 0;
}

.loading-subtitle {
  font-size: 13.5px;
  color: #94a3b8;
  margin: 0 0 24px 0;
  font-weight: 500;
}

.loading-bar-track {
  width: 100%;
  height: 5px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 9999px;
  overflow: hidden;
  margin-bottom: 18px;
  position: relative;
}

.loading-bar-fill {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 45%;
  background: linear-gradient(90deg, #0d9488, #38bdf8, #0d9488);
  border-radius: 9999px;
  animation: indeterminateBar 1.6s cubic-bezier(0.65, 0.815, 0.735, 0.395) infinite;
}

.loading-status-text {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 12.5px;
  color: #cbd5e1;
  min-height: 20px;
}

.loading-spinner-inline {
  animation: spin 0.85s linear infinite;
  flex-shrink: 0;
}

.topbar-loading-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 4px 11px;
  border-radius: 9999px;
  background: rgba(13, 148, 136, 0.12);
  border: 1px solid rgba(13, 148, 136, 0.3);
  color: #0d9488;
  font-size: 12px;
  font-weight: 600;
  animation: fadeIn 0.25s ease;
}

.topbar-loading-pill.hidden {
  display: none !important;
}

@keyframes pulseRing {
  0% {
    transform: scale(0.9);
    opacity: 0.8;
  }
  70% {
    transform: scale(1.35);
    opacity: 0;
  }
  100% {
    transform: scale(1.4);
    opacity: 0;
  }
}

@keyframes ecgBeat {
  0%, 100% {
    transform: scale(1);
  }
  15% {
    transform: scale(1.15);
  }
  25% {
    transform: scale(0.95);
  }
  35% {
    transform: scale(1.08);
  }
  45% {
    transform: scale(1);
  }
}

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

@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

/* ============================================================================
   16. Responsive & Small Screen Display Rules (1560px -> Mobile)
   ============================================================================ */

/* Large laptops (<= 1560px): compact secondary labels in topbar */
@media (max-width: 1560px) {
  .topbar {
    padding: 0 14px;
    gap: 10px;
  }

  .topbar-right {
    gap: 6px;
  }

  .session-mode-action {
    display: none;
  }
}

/* Standard 13"-14" laptops (<= 1440px): prevent topbar crowding */
@media (max-width: 1440px) {
  .topbar-left {
    flex: 0 1 190px;
  }

  .global-search-box kbd {
    display: none;
  }

  #btn-topbar-tour {
    padding: 0 8px;
  }

  #btn-topbar-tour .topbar-btn-label {
    display: none;
  }

  .topbar-waiting-label {
    display: none;
  }

  .topbar-clock-date {
    display: none;
  }

  .topbar-clock-box {
    padding: 0 8px;
  }

  .topbar-doctor-pill {
    max-width: 155px;
  }
}

/* Compact laptops & small desktops (<= 1280px) */
@media (max-width: 1280px) {
  :root {
    --sidebar-width: 220px;
  }

  .topbar-left {
    flex: 0 1 155px;
  }

  .topbar-view-title {
    font-size: 14.5px;
  }

  .topbar-clock-box {
    display: none;
  }

  .session-mode-text {
    display: none;
  }

  .session-mode-pill {
    padding: 0 9px;
  }

  #btn-quick-rx .topbar-btn-label {
    display: none;
  }

  #btn-quick-rx {
    padding: 0 9px;
  }

  .doctor-mini-info {
    display: none;
  }

  .topbar-doctor-pill {
    padding: 3px;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    justify-content: center;
  }

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

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

  .patients-master-pane {
    width: 290px;
    min-width: 250px;
  }

  .msgr-shell {
    grid-template-columns: 240px minmax(0, 1fr);
  }

  .msgr-shell > :nth-child(3) {
    display: none;
  }
}

/* Tablets & narrow desktop windows (<= 1024px): off-canvas sidebar drawer */
@media (max-width: 1024px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 260px;
    transform: translateX(-100%);
    transition: transform 0.22s ease;
    z-index: 1050;
    box-shadow: 0 18px 48px rgba(0, 0, 0, 0.35);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .btn-mobile-sidebar,
  .btn-close-sidebar {
    display: inline-flex;
  }

  .topbar-left {
    flex: 0 1 200px;
  }

  #btn-quick-consult .topbar-btn-label {
    display: none;
  }

  #btn-quick-consult {
    padding: 0 10px;
  }

  .dashboard-main-grid,
  .dashboard-bottom-grid,
  .synthese-grid,
  .soc-wall-grid {
    grid-template-columns: 1fr;
  }

  .pacs-body {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(260px, 1fr) auto;
  }

  .pacs-sidebar {
    border-left: none;
    border-top: 1px solid var(--border-color);
    max-height: 40vh;
  }

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

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

  .cal-grid-wrap {
    overflow-x: auto;
  }

  .cal-week-header,
  .cal-row.week {
    min-width: 660px;
  }
}

/* Small tablets & mobile screens (<= 768px) */
@media (max-width: 768px) {
  .topbar {
    height: auto;
    min-height: 54px;
    flex-wrap: wrap;
    padding: 8px 12px;
    gap: 8px;
  }

  .topbar-left {
    order: 1;
    flex: 1 1 auto;
    min-width: 0;
  }

  .topbar-right {
    order: 2;
    gap: 5px;
  }

  .global-search-wrapper {
    order: 3;
    flex: 1 0 100%;
    max-width: 100%;
    min-width: 0;
  }

  .topbar-presence-select,
  #btn-topbar-tour {
    display: none !important;
  }

  .view-panel {
    padding: 14px 12px 24px;
  }

  .dashboard-banner {
    flex-direction: column;
    align-items: flex-start;
    padding: 14px 16px;
  }

  .kpi-grid,
  .form-grid-2,
  .form-grid-3,
  .form-grid-4,
  .files-gallery-grid {
    grid-template-columns: 1fr;
  }

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

  #view-patients.active {
    flex-direction: column;
    overflow-y: auto;
  }

  .patients-master-pane {
    width: 100%;
    min-width: 0;
    height: auto;
    max-height: 42vh;
    border-right: none;
    border-bottom: 1px solid var(--border-color);
  }

  .msgr-shell {
    grid-template-columns: 1fr;
    height: auto;
    min-height: 460px;
  }

  .dct-banner {
    padding: 8px 12px;
    flex-wrap: wrap;
    gap: 8px;
  }

  .clinical-table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}

/* Extra small phones (<= 480px) */
@media (max-width: 480px) {
  .dct-license-pill {
    display: none;
  }

  .topbar-view-title {
    font-size: 13.5px;
  }

  .vitals-snapshot-grid {
    grid-template-columns: 1fr;
  }
}


