/* ============================================================
   MOBILE KLINIK SYSTEM — PT ATI & ATI MEDIKA
   Enterprise Medical Dashboard Design System (v3.0)
   Designed for Maximum Clarity, Efficiency & High Contrast
   ============================================================ */

/* ===================== DESIGN TOKENS ===================== */
:root {
  --font-sans: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

  /* --- DARK THEME (DEFAULT) --- */
  --bg:             #0a0f1d;
  --bg-subtle:      #0f172a;
  --surface-1:      #131c31;
  --surface-2:      #1a2642;
  --surface-3:      #243356;
  --surface-hover:  #1d2b4a;

  --border-subtle:  #1e293b;
  --border-card:    #2e416a;
  --border-focus:   #38bdf8;

  /* Typography */
  --text-main:      #f8fafc;
  --text-muted:     #94a3b8;
  --text-faint:     #64748b;

  /* Brand / Medical Blue */
  --primary:        #0284c7;
  --primary-hover:  #0369a1;
  --primary-glow:   rgba(2, 132, 199, 0.25);
  --primary-light:  #38bdf8;
  --primary-surface:#0c2b45;

  /* Accent / Secondary Medical Teal */
  --accent:         #0d9488;
  --accent-light:   #2dd4bf;
  --accent-surface: #0a3330;

  /* Semantic Status Colors */
  --success:        #10b981;
  --success-light:  #34d399;
  --success-surface:#064e3b;
  
  --warning:        #f59e0b;
  --warning-light:  #fbbf24;
  --warning-surface:#451a03;

  --danger:         #ef4444;
  --danger-light:   #f87171;
  --danger-surface: #450a0a;

  --info:           #0ea5e9;
  --info-light:     #38bdf8;
  --info-surface:   #082f49;

  /* Shadows & Elevation */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.6);

  /* Radius */
  --r-xs: 6px;
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 20px;
  --r-pill: 9999px;

  /* Backward-compatibility aliases for existing HTML */
  --text-primary:   var(--text-main);
  --text-secondary: var(--text-muted);
  --text-tertiary:  var(--text-faint);
  --text-color:     var(--text-main);
  --panel-bg:       var(--surface-1);
  --glass-border:   var(--border-card);
  --border-color:   var(--border-card);
  --card-shadow:    var(--shadow-md);
}

/* --- LIGHT THEME (HIGH CONTRAST & CLEAN MEDICAL) --- */
[data-theme="light"] {
  --text-color:     #0f172a;
  --bg:             #f1f5f9;
  --bg-subtle:      #e2e8f0;
  --surface-1:      #ffffff;
  --surface-2:      #f8fafc;
  --surface-3:      #eef2f6;
  --surface-hover:  #f0f7ff;

  --border-subtle:  #e2e8f0;
  --border-card:    #cbd5e1;
  --border-focus:   #0284c7;

  /* Typography (Deep rich slate for ultra readability) */
  --text-main:      #0f172a;
  --text-muted:     #475569;
  --text-faint:     #64748b;

  /* Brand / Primary */
  --primary:        #0284c7;
  --primary-hover:  #0369a1;
  --primary-glow:   rgba(2, 132, 199, 0.18);
  --primary-light:  #0369a1;
  --primary-surface:#e0f2fe;

  /* Accent */
  --accent:         #0f766e;
  --accent-light:   #0d9488;
  --accent-surface: #ccfbf1;

  /* Semantic */
  --success:        #15803d;
  --success-light:  #16a34a;
  --success-surface:#dcfce7;

  --warning:        #b45309;
  --warning-light:  #d97706;
  --warning-surface:#fef3c7;

  --danger:         #b91c1c;
  --danger-light:   #dc2626;
  --danger-surface: #fee2e2;

  --info:           #0369a1;
  --info-light:     #0284c7;
  --info-surface:   #e0f2fe;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.07), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.06), 0 2px 4px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 12px 28px rgba(0, 0, 0, 0.08), 0 4px 8px rgba(0, 0, 0, 0.04);

  --text-primary:   var(--text-main);
  --text-secondary: var(--text-muted);
  --text-tertiary:  var(--text-faint);
  --panel-bg:       var(--surface-1);
  --glass-border:   var(--border-card);
  --border-color:   var(--border-card);
  --card-shadow:    var(--shadow-md);
}

/* ===================== BASE RESET ===================== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 15px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg);
  color: var(--text-main);
  line-height: 1.5;
  min-height: 100vh;
  overflow-x: hidden;
  transition: background-color 0.25s ease, color 0.25s ease;
  -webkit-font-smoothing: antialiased;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
  width: 7px;
  height: 7px;
}
::-webkit-scrollbar-track {
  background: var(--bg-subtle);
}
::-webkit-scrollbar-thumb {
  background: var(--border-card);
  border-radius: var(--r-pill);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-faint);
}

/* ===================== GATE LOGIN OVERLAY ===================== */
.gate-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  justify-content: center;
  align-items: center;
  background: #060b18;
  background-image:
    radial-gradient(ellipse 80% 50% at 50% -10%, rgba(2, 132, 199, 0.15), transparent),
    radial-gradient(ellipse 60% 40% at 80% 100%, rgba(13, 148, 136, 0.08), transparent);
  padding: 20px;
}

.gate-card {
  background: var(--surface-1);
  border: 1px solid var(--border-card);
  border-radius: var(--r-xl);
  padding: 40px 36px 32px;
  width: 100%;
  max-width: 420px;
  box-shadow:
    0 20px 60px rgba(0, 0, 0, 0.6),
    0 0 0 1px rgba(255, 255, 255, 0.04);
  animation: gateCardIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes gateCardIn {
  from { opacity: 0; transform: translateY(16px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.gate-header {
  text-align: center;
  margin-bottom: 28px;
}

.gate-shield {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), #0d9488);
  color: #ffffff;
  font-size: 1.6rem;
  margin-bottom: 16px;
  box-shadow: 0 8px 24px rgba(2, 132, 199, 0.35);
}

.gate-title {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.02em;
  margin-bottom: 4px;
}

.gate-sub {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-weight: 500;
}

.gate-tabs-wrap {
  display: flex;
  background: var(--surface-2);
  border-radius: var(--r-md);
  padding: 4px;
  margin-bottom: 20px;
  gap: 4px;
  border: 1px solid var(--border-card);
}

.gate-tab-btn {
  flex: 1;
  padding: 9px 12px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 0.82rem;
  font-weight: 700;
  border-radius: calc(var(--r-md) - 2px);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.gate-tab-btn.active {
  background: var(--primary);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(2, 132, 199, 0.4);
}

.gate-select {
  cursor: pointer;
  letter-spacing: normal;
  font-size: 0.92rem;
}

.navbar-user-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: rgba(56, 189, 248, 0.1);
  border: 1px solid rgba(56, 189, 248, 0.25);
  padding: 5px 12px;
  border-radius: var(--r-md);
  color: var(--text-main);
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.navbar-user-chip:hover {
  background: rgba(56, 189, 248, 0.18);
  border-color: var(--primary);
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.25);
  transform: translateY(-1px);
}

.navbar-user-chip:active {
  transform: scale(0.98);
}

[data-theme="light"] .navbar-user-chip {
  background: #f0f9ff;
  border: 1.5px solid #bae6fd;
  color: #0369a1;
}

[data-theme="light"] .navbar-user-chip:hover {
  background: #e0f2fe;
  border-color: #0284c7;
  box-shadow: 0 2px 8px rgba(2, 132, 199, 0.15);
}

.nav-user-role-badge {
  background: rgba(56, 189, 248, 0.2);
  color: #38bdf8;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
}

[data-theme="light"] .nav-user-role-badge {
  background: #0284c7;
  color: #ffffff;
}

@media (max-width: 768px) {
  .navbar-user-chip {
    display: inline-flex !important;
    padding: 4px 8px;
    gap: 5px;
  }
  .navbar-user-chip #nav-user-name {
    max-width: 80px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.8rem;
  }
  .navbar-user-chip .nav-user-role-badge {
    display: none;
  }
  .tindakan-form-grid, .user-form-grid {
    grid-template-columns: 1fr !important;
  }
}

.gate-input-group {
  margin-bottom: 16px;
}

.gate-label {
  display: block;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 8px;
}

.gate-input-wrap {
  position: relative;
}

.gate-input-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-faint);
  font-size: 0.9rem;
}

.gate-input {
  width: 100%;
  padding: 13px 14px 13px 42px;
  background: var(--surface-2);
  border: 1.5px solid var(--border-card);
  border-radius: var(--r-md);
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 2px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.gate-input::placeholder {
  color: var(--text-faint);
  letter-spacing: 0;
  font-weight: 400;
}

.gate-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-glow);
}

.btn-gate-submit {
  width: 100%;
  padding: 14px;
  background: linear-gradient(135deg, var(--primary), #0369a1);
  color: #ffffff;
  font-family: var(--font-sans);
  font-size: 0.92rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  border: none;
  border-radius: var(--r-md);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s ease;
  box-shadow: 0 4px 14px rgba(2, 132, 199, 0.4);
}

.btn-gate-submit:hover {
  background: linear-gradient(135deg, #0369a1, #075985);
  box-shadow: 0 6px 20px rgba(2, 132, 199, 0.5);
  transform: translateY(-1px);
}

.btn-gate-submit:active {
  transform: translateY(0) scale(0.99);
}

.gate-footer {
  text-align: center;
  margin-top: 20px;
  font-size: 0.76rem;
  color: var(--text-faint);
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

/* Light theme gate adjustments */
[data-theme="light"] .gate-overlay {
  background: #e2e8f0;
  background-image:
    radial-gradient(ellipse 80% 50% at 50% -10%, rgba(2, 132, 199, 0.08), transparent);
}

[data-theme="light"] .gate-card {
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.12), 0 0 0 1px rgba(0, 0, 0, 0.04);
}

[data-theme="light"] .gate-input {
  background: #ffffff;
  border-color: #cbd5e1;
}

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

/* ===================== NAVBAR ===================== */
.app-navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 20px;
  height: 60px;
  background: var(--surface-1);
  border-bottom: 1px solid var(--border-card);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
  gap: 14px;
}

.brand-section {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.brand-logo-img {
  height: 34px;
  width: auto;
  object-fit: contain;
}

.brand-title {
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-main);
  line-height: 1.15;
}

.brand-subtitle {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 600;
  letter-spacing: 0.01em;
}

/* Nav Tabs */
.app-navbar {
  overflow: visible !important;
}

.nav-links {
  display: flex;
  gap: 4px;
  align-items: center;
  overflow: visible !important;
  padding: 4px 0;
  flex: 1;
}

.nav-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  padding: 7px 13px;
  border-radius: var(--r-sm);
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  transition: all 0.18s ease;
  letter-spacing: 0.02em;
}

.nav-btn i {
  font-size: 0.85rem;
}

.nav-btn:hover {
  color: var(--text-main);
  background: var(--surface-2);
  border-color: var(--border-subtle);
}

.nav-btn.active {
  color: #ffffff;
  background: var(--primary);
  border-color: var(--primary-hover);
  box-shadow: 0 2px 6px var(--primary-glow);
}

/* Nav Dropdown (Menu Lainnya) */
.nav-dropdown {
  position: relative;
  display: inline-block;
}

.nav-dropdown-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.nav-dropdown-content {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 185px;
  background: var(--surface-1);
  border: 1px solid var(--border-card);
  border-radius: var(--r-sm);
  box-shadow: var(--shadow-lg);
  padding: 6px;
  z-index: 99999;
  animation: navFadeIn 0.15s ease;
}

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

[data-theme="light"] .nav-dropdown-content {
  background: #ffffff;
  border-color: #cbd5e1;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
}

.nav-dropdown.active .nav-dropdown-content {
  display: block;
}

.nav-dropdown-item {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 8px 12px;
  border: none;
  background: transparent;
  color: var(--text-main);
  font-size: 0.82rem;
  font-weight: 700;
  text-align: left;
  border-radius: var(--r-xs);
  cursor: pointer;
  transition: all 0.15s ease;
  letter-spacing: 0.02em;
}

.nav-dropdown-item i {
  font-size: 0.9rem;
  width: 16px;
  text-align: center;
}

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

[data-theme="light"] .nav-dropdown-item:hover {
  background: #f1f5f9;
  color: #0284c7;
}

.nav-dropdown-item.active {
  background: var(--primary-surface);
  color: var(--primary-light);
}

[data-theme="light"] .nav-dropdown-item.active {
  background: #e0f2fe;
  color: #0284c7;
}

/* Nav Actions (Theme & Logout) */
.theme-toggle-btn {
  background: var(--surface-2);
  border: 1px solid var(--border-card);
  color: var(--text-main);
  width: 36px;
  height: 36px;
  border-radius: var(--r-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  flex-shrink: 0;
  transition: all 0.15s ease;
}

.theme-toggle-btn:hover {
  background: var(--surface-hover);
  border-color: var(--border-focus);
}

/* ===================== CONTAINER & LAYOUT ===================== */
.app-container {
  padding: 18px 22px;
  max-width: 1680px;
  margin: 0 auto;
}

.page-view {
  display: none;
  animation: viewFadeIn 0.2s ease-out;
}
.page-view.active {
  display: block;
}

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

/* ===================== CARDS ===================== */
.glass-card {
  background: var(--surface-1);
  border: 1.5px solid var(--border-card);
  border-radius: var(--r-lg);
  padding: 20px;
  box-shadow: var(--shadow-md);
  transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

.glass-card:hover {
  border-color: rgba(56, 189, 248, 0.35);
  box-shadow: var(--shadow-lg);
}

/* ===================== SOAP 2-PANEL LAYOUT ===================== */
.soap-split-layout {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 18px;
  align-items: start;
}

.soap-panel {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 96px);
  min-height: 520px;
}

.soap-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 12px;
  flex-shrink: 0;
}

.soap-panel-title {
  font-size: 1.05rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-main);
  letter-spacing: -0.01em;
}

.soap-scrollable-body {
  overflow-y: auto;
  padding-right: 6px;
  flex: 1;
}

/* ===================== PATIENT SEARCH & BANNER ===================== */
.patient-select-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}

.patient-info-banner {
  background: var(--primary-surface);
  border: 1px solid var(--primary);
  border-radius: var(--r-md);
  padding: 14px 16px;
  margin-bottom: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.banner-name {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 8px;
}

.banner-sub {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-weight: 600;
  margin-top: 3px;
}

/* ===================== FORM CONTROLS ===================== */
.form-group {
  margin-bottom: 14px;
}

.form-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 6px;
  letter-spacing: 0.01em;
}

/* Section Labels (S, O, A, P Headers) */
.marunda-section-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--text-main);
  background: var(--surface-2);
  border: 1px solid var(--border-card);
  border-left: 4px solid var(--primary);
  padding: 7px 12px;
  border-radius: var(--r-xs);
  margin-top: 14px;
  margin-bottom: 10px;
}

.soap-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 4px;
  font-weight: 900;
  font-size: 0.75rem;
  color: #fff;
  background: var(--primary);
}

.soap-chip-s { background: #0284c7; }
.soap-chip-o { background: #0d9488; }
.soap-chip-a { background: #8b5cf6; }
.soap-chip-p { background: #f59e0b; color: #000; }

.form-control {
  width: 100%;
  max-width: 100%;
  padding: 9px 13px;
  background: var(--surface-2);
  border: 1px solid var(--border-card);
  border-radius: var(--r-sm);
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 0.9rem;
  font-weight: 500;
  line-height: 1.5;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

[data-theme="light"] .form-control {
  background: #ffffff;
  border-color: #cbd5e1;
  color: #0f172a;
}

.form-control::placeholder {
  color: var(--text-faint);
  font-weight: 400;
}

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

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

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

/* ===================== VITALS GRID ===================== */
.vitals-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  margin-bottom: 10px;
}

.vital-item {
  background: var(--surface-2);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-sm);
  padding: 8px;
}

.vital-item label {
  display: block;
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 4px;
}

.vital-item .form-control {
  padding: 7px 8px;
  font-weight: 700;
  font-size: 0.95rem;
}

/* ===================== RESEP TABLE ===================== */
.resep-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 8px;
}

.resep-table th {
  font-size: 0.74rem;
  font-weight: 800;
  text-align: left;
  padding: 8px 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border-card);
}

.resep-table th:first-child { border-radius: var(--r-xs) 0 0 var(--r-xs); }
.resep-table th:last-child  { border-radius: 0 var(--r-xs) var(--r-xs) 0; }

.resep-table td {
  padding: 6px 6px;
  vertical-align: middle;
}

.stock-badge-info {
  display: block;
  margin-top: 4px;
  font-size: 0.75rem;
  font-weight: 700;
}

.stock-badge-green { color: var(--success); }
.stock-badge-yellow { color: var(--warning); }
.stock-badge-red { color: var(--danger); }

/* ===================== PANTAUAN HIGH-RISK CARD ===================== */
.pantauan-banner {
  background: var(--danger-surface);
  border: 1.5px dashed var(--danger);
  border-radius: var(--r-md);
  padding: 12px 16px;
  margin: 14px 0;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
}

.pantauan-banner label {
  cursor: pointer;
  font-weight: 800;
  color: var(--danger);
  font-size: 0.92rem;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ===================== TIMELINE ENCOUNTER CARDS ===================== */
.timeline-item {
  background: var(--surface-1);
  border: 1.5px solid var(--border-card);
  border-left: 4px solid var(--primary);
  border-radius: var(--r-md);
  padding: 14px 16px;
  margin-bottom: 14px;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.timeline-item:hover {
  background: var(--surface-hover);
  border-color: rgba(56, 189, 248, 0.5);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
  transform: translateY(-2px);
}

.timeline-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 8px;
  margin-bottom: 10px;
}

.timeline-date {
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.timeline-section-row {
  margin-bottom: 8px;
  font-size: 0.88rem;
  line-height: 1.45;
}

.timeline-label-chip {
  font-size: 0.72rem;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 4px;
  margin-right: 6px;
  display: inline-block;
  letter-spacing: 0.02em;
}

.chip-s { background: var(--primary-surface); color: var(--primary); border: 1px solid var(--primary); }
.chip-o { background: var(--accent-surface);  color: var(--accent);  border: 1px solid var(--accent); }
.chip-a { background: #f3e8ff; color: #7e22ce; border: 1px solid #c084fc; }
.chip-p { background: var(--warning-surface); color: var(--warning); border: 1px solid var(--warning); }

[data-theme="dark"] .chip-a { background: #3b0764; color: #d8b4fe; border-color: #9333ea; }

.timeline-medicines-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 4px;
  padding-left: 8px;
  border-left: 2px solid var(--warning);
}

.med-pill-item {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-main);
  line-height: 1.35;
}

.timeline-total-cost-row {
  margin-top: 6px;
  padding: 5px 10px;
  background: rgba(56, 189, 248, 0.08);
  border: 1px solid rgba(56, 189, 248, 0.25);
  border-radius: var(--r-sm);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.78rem;
  font-weight: 700;
}

[data-theme="light"] .timeline-total-cost-row {
  background: #f0f9ff;
  border-color: #bae6fd;
}

/* TIMELINE RESEP 3-KOLOM (LIGHT & DARK ADAPTIVE) */
.timeline-resep-box {
  margin-top: 4px;
  background: var(--surface-2);
  border: 1px solid var(--border-card);
  border-radius: var(--r-sm);
  padding: 8px 12px;
  width: 100%;
}

[data-theme="light"] .timeline-resep-box {
  background: #f8fafc;
  border-color: #e2e8f0;
}

.timeline-resep-title {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 5px;
}

[data-theme="dark"] .timeline-resep-title {
  color: var(--primary-light);
}

.timeline-resep-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.84rem;
}

.timeline-resep-table tr {
  border-bottom: 1px dashed var(--border-subtle);
}

.timeline-resep-table tr:last-child {
  border-bottom: none;
}

.resep-col-name {
  padding: 6px 6px 6px 0;
  color: var(--text-main);
  font-weight: 600;
  text-align: left;
  vertical-align: middle;
}

.resep-bullet {
  color: var(--primary);
  margin-right: 4px;
  font-weight: bold;
}

[data-theme="dark"] .resep-bullet {
  color: var(--primary-light);
}

.resep-col-qty {
  padding: 6px 8px;
  text-align: center;
  width: 75px;
  white-space: nowrap;
  vertical-align: middle;
}

.resep-badge-qty {
  background: var(--surface-3);
  color: var(--text-main);
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 0.78rem;
  font-weight: 700;
  border: 1px solid var(--border-card);
  display: inline-block;
}

[data-theme="light"] .resep-badge-qty {
  background: #f1f5f9;
  border-color: #cbd5e1;
  color: #334155;
}

.resep-col-price {
  padding: 6px 0 6px 8px;
  text-align: right;
  font-weight: 700;
  color: var(--primary);
  width: 115px;
  white-space: nowrap;
  font-size: 0.82rem;
  vertical-align: middle;
}

[data-theme="dark"] .resep-col-price {
  color: var(--primary-light);
}

.timeline-resep-total {
  margin-top: 8px;
  padding-top: 6px;
  border-top: 1px solid var(--border-card);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.83rem;
}

.timeline-resep-total-label {
  color: var(--text-muted);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 5px;
}

.timeline-resep-total-val {
  color: var(--primary);
  font-weight: 800;
  font-size: 0.88rem;
}

[data-theme="dark"] .timeline-resep-total-val {
  color: var(--primary-light);
}

.timeline-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid var(--border-subtle);
  padding-top: 8px;
  margin-top: 10px;
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* ===================== BUTTONS ===================== */
.btn {
  padding: 8px 16px;
  border-radius: var(--r-sm);
  font-size: 0.84rem;
  font-weight: 700;
  border: 1px solid transparent;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.15s ease;
  letter-spacing: 0.01em;
  text-decoration: none;
  white-space: nowrap;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary-hover);
  box-shadow: 0 2px 4px var(--primary-glow);
}
.btn-primary:hover {
  background: var(--primary-hover);
  box-shadow: 0 4px 10px var(--primary-glow);
}

.btn-secondary {
  background: var(--surface-2);
  color: var(--text-main);
  border-color: var(--border-card);
}
.btn-secondary:hover {
  background: var(--surface-hover);
  border-color: var(--text-muted);
}

.btn-danger {
  background: var(--danger);
  color: #ffffff;
}
.btn-danger:hover {
  background: #dc2626;
}

.btn-warning {
  background: var(--warning);
  color: #000000;
}
.btn-warning:hover {
  background: #d97706;
}

.btn-success {
  background: var(--success);
  color: #ffffff;
}
.btn-success:hover {
  background: #15803d;
}

.btn-sm {
  padding: 5px 10px;
  font-size: 0.78rem;
  border-radius: var(--r-xs);
}

.btn-block {
  width: 100%;
}

/* ===================== DATA TABLES ===================== */
.table-responsive {
  overflow-x: auto;
}

.custom-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.custom-table th {
  padding: 10px 14px;
  text-align: left;
  font-weight: 800;
  font-size: 0.74rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: var(--surface-2);
  border-bottom: 2px solid var(--border-card);
  white-space: nowrap;
}

.custom-table td {
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-main);
  vertical-align: middle;
}

.custom-table tbody tr:hover {
  background: var(--surface-hover);
}

/* ===================== BADGES ===================== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: var(--r-pill);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.02em;
}

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

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

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

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

.badge-secondary {
  background: var(--surface-2);
  color: var(--text-muted);
  border: 1px solid var(--border-subtle);
}

/* ===================== STAT CARDS & HSE OVERVIEW ===================== */
.hse-stat-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 12px;
  margin-bottom: 18px;
}

.stat-card {
  background: var(--surface-1);
  border: 1.5px solid var(--border-card);
  border-radius: var(--r-lg);
  padding: 14px 16px;
  box-shadow: var(--shadow-sm);
  transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 118px;
  box-sizing: border-box;
  overflow: hidden;
  position: relative;
}

.stat-card.clickable {
  cursor: pointer;
}

.stat-card:hover,
.stat-card.clickable:hover {
  background: var(--surface-hover);
  border-color: var(--border-focus);
  box-shadow: 0 8px 24px rgba(2, 132, 199, 0.22), 0 2px 6px rgba(0, 0, 0, 0.25);
  transform: translateY(-3px);
}

.stat-card:active,
.stat-card.clickable:active {
  transform: translateY(0) scale(0.98);
}

.stat-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  min-height: 24px;
}

.stat-card-header .stat-label {
  margin-bottom: 0;
  flex: 1;
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  line-height: 1.2;
  white-space: normal;
  word-break: break-word;
}

.stat-pill-badge {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
  flex-shrink: 0;
  line-height: 1;
}

.stat-pill-badge.badge-cyan {
  color: #00cbd5;
  background: rgba(0, 203, 213, 0.12);
  border: 1px solid rgba(0, 203, 213, 0.25);
}

.stat-pill-badge.badge-green {
  color: #84cc16;
  background: rgba(132, 204, 22, 0.12);
  border: 1px solid rgba(132, 204, 22, 0.25);
}

.stat-pill-badge.badge-amber {
  color: #f59e0b;
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.25);
}

.stat-pill-badge.badge-danger {
  color: #f87171;
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.25);
}

.stat-pill-badge.badge-warning {
  color: #fbbf24;
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.25);
}

.stat-pill-badge.badge-purple {
  color: #a855f7;
  background: rgba(168, 85, 247, 0.12);
  border: 1px solid rgba(168, 85, 247, 0.25);
}

.stat-body {
  display: flex;
  flex-direction: column;
  justify-content: center;
  flex: 1;
}

.stat-value {
  font-size: 1.8rem;
  font-weight: 900;
  letter-spacing: -0.03em;
  line-height: 1.1;
  margin-bottom: 2px;
}

.stat-sub {
  font-size: 0.74rem;
  color: var(--text-muted);
  font-weight: 600;
  line-height: 1.2;
}

/* Stat Card Mini Lists (Dept & Patient) */
.stat-mini-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 2px;
}

.stat-mini-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.78rem;
  padding: 3px 0;
  border-bottom: 1px dashed var(--border-subtle);
}

.stat-mini-item:last-child {
  border-bottom: none;
}

.stat-mini-name {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 105px;
  color: var(--text-main);
  font-size: 0.78rem;
  display: block;
}

.stat-mini-count {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--primary-light);
  border: 1px solid var(--border-card);
  flex-shrink: 0;
}

/* HSE Dual Comparison Chart Pair Grid */
.hse-chart-pair-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

/* ===================== MODALS ===================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 1000;
  display: none;
  justify-content: center;
  align-items: center;
  padding: 20px;
}

.modal-overlay[style*="flex"] {
  display: flex !important;
}

.modal-card {
  background: var(--surface-1);
  border: 1.5px solid var(--border-card);
  border-radius: var(--r-xl);
  padding: 26px;
  width: 100%;
  max-width: 640px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: modalPopIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-subtle);
}

.modal-title {
  font-size: 1.1rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 8px;
}

.close-btn {
  background: var(--surface-2);
  border: 1px solid var(--border-card);
  color: var(--text-muted);
  width: 32px;
  height: 32px;
  border-radius: var(--r-xs);
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}
.close-btn:hover {
  background: var(--danger);
  color: #fff;
  border-color: var(--danger);
}

/* ===================== TOAST NOTIFICATIONS ===================== */
.toast-container {
  position: fixed;
  bottom: 22px;
  right: 22px;
  z-index: 3000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  background: var(--surface-1);
  border: 1px solid var(--border-card);
  border-radius: var(--r-md);
  padding: 12px 18px;
  color: var(--text-main);
  font-size: 0.88rem;
  font-weight: 700;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 10px;
  animation: toastPop 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: all;
  max-width: 360px;
}

.toast-success { border-left: 5px solid var(--success); }
.toast-error   { border-left: 5px solid var(--danger); }
.toast-info    { border-left: 5px solid var(--primary); }
.toast-warning { border-left: 5px solid var(--warning); }

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

/* ===================== INFO BANNERS ===================== */
.info-banner {
  border-radius: var(--r-md);
  padding: 14px 16px;
  font-size: 0.88rem;
  line-height: 1.5;
  font-weight: 600;
}

.info-banner-blue {
  background: var(--info-surface);
  border: 1px solid var(--info);
  color: var(--info);
}

.info-banner-yellow {
  background: var(--warning-surface);
  border: 1px solid var(--warning);
  color: var(--warning);
}

.info-banner-red {
  background: var(--danger-surface);
  border: 1px solid var(--danger);
  color: var(--danger);
}

.info-banner-green {
  background: var(--success-surface);
  border: 1px solid var(--success);
  color: var(--success);
}

/* Code Block */
.code-block {
  background: #090d16;
  border: 1px solid var(--border-card);
  border-radius: var(--r-md);
  padding: 14px;
  font-family: 'Consolas', 'Fira Code', monospace;
  font-size: 0.75rem;
  max-height: 240px;
  overflow-y: auto;
  color: #34d399;
  line-height: 1.6;
}

/* ===================== APOTEK & PENGIRIMAN OBAT ===================== */
.pengiriman-grid {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 18px;
  margin-bottom: 20px;
  align-items: start;
  width: 100%;
  box-sizing: border-box;
}

.pengiriman-name-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 14px;
}

.pengiriman-stok-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
  margin-bottom: 14px;
}

.gudang-subtabs {
  display: flex;
  gap: 8px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
  width: 100%;
  box-sizing: border-box;
}

/* ===================== RESPONSIVE BREAKPOINTS ===================== */

/* Tablet: SOAP panels go single column */
@media (max-width: 1100px) {
  .soap-split-layout {
    grid-template-columns: 1fr;
  }
  .soap-panel {
    height: auto;
    min-height: auto;
  }
  .hse-stat-grid {
    grid-template-columns: repeat(3, 1fr) !important;
  }
  .hse-chart-pair-grid {
    grid-template-columns: 1fr !important;
  }
}

/* ================================================
   MOBILE / SMARTPHONE — Portrait (≤768px)
   Best practice EMR mobile: single column, bottom
   nav, card views, bottom sheet modals, 44px touch.
   ================================================ */
@media (max-width: 768px) {

  /* --- Base font scale down for light, compact mobile view --- */
  html { font-size: 13px; }

  /* --- Navbar: hide top nav links, keep brand bar compact --- */
  .app-navbar {
    flex-direction: row;
    justify-content: space-between;
    height: 46px;
    padding: 0 10px;
    gap: 6px;
  }
  .brand-section { gap: 6px; }
  .brand-logo-img { height: 22px; }
  .brand-title { font-size: 0.82rem; }
  .brand-subtitle { display: none; }

  /* Hide desktop nav links entirely — replaced by bottom nav */
  .nav-links { display: none !important; }

  /* --- Main container: ultra-compact padding for 360px mobile --- */
  .app-container {
    padding: 4px 4px 70px !important;
  }

  /* Compact typography on mobile */
  h2 { font-size: 1.05rem !important; }
  h3 { font-size: 0.92rem !important; }
  h4 { font-size: 0.84rem !important; }
  p { font-size: 0.78rem !important; }

  /* --- SOAP layout: always single column --- */
  .soap-split-layout {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .soap-panel {
    height: auto;
    min-height: auto;
  }

  /* --- Vitals grid: 2 columns compact --- */
  .vitals-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 4px !important;
  }

  /* --- Form grids: collapse to single column --- */
  [style*="grid-template-columns: 1fr 1fr"] {
    grid-template-columns: 1fr !important;
  }
  [style*="grid-template-columns: 1fr 1fr 1fr"] {
    grid-template-columns: 1fr !important;
  }
  [style*="grid-template-columns: 1fr 1.5fr"] {
    grid-template-columns: 1fr !important;
  }
  [style*="grid-template-columns: 1.15fr 0.85fr"] {
    grid-template-columns: 1fr !important;
  }

  /* --- Buttons: compact & lightweight --- */
  .btn {
    min-height: 36px;
    padding: 6px 10px;
    font-size: 0.8rem;
    border-radius: 6px;
  }
  .btn-sm {
    min-height: 28px;
    padding: 4px 8px;
    font-size: 0.72rem;
    border-radius: 4px;
  }
  .btn-block { width: 100%; }

  /* --- Form controls: compact height --- */
  .form-control {
    min-height: 36px;
    font-size: 14px;
    padding: 6px 8px;
    border-radius: 6px;
  }
  select.form-control { font-size: 14px; }
  textarea.form-control { min-height: 65px; font-size: 14px; }

  /* --- Patient search bar: stack vertically --- */
  .patient-select-bar {
    flex-direction: column;
    gap: 6px;
  }
  .patient-select-bar .btn {
    width: 100%;
  }

  /* --- Patient info banner: stack --- */
  .patient-info-banner {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }

  /* --- Glass cards: tight padding & compact border on mobile --- */
  .glass-card {
    padding: 8px 6px !important;
    border-radius: 6px !important;
    border: 1px solid #243356 !important;
    margin-bottom: 8px !important;
  }

  /* --- POLI RESEP TABLE TO MOBILE CARD TRANSFORMATION --- */
  .resep-table {
    display: block !important;
    width: 100% !important;
    border: none !important;
  }

  .resep-table thead {
    display: none !important;
  }

  .resep-table tbody {
    display: flex !important;
    flex-direction: column !important;
    gap: 12px !important;
    width: 100% !important;
  }

  #poli-resep-body tr {
    display: flex !important;
    flex-wrap: wrap !important;
    background: var(--surface-2) !important;
    border: 1.5px solid var(--border-card) !important;
    border-radius: var(--r-md) !important;
    padding: 12px 10px !important;
    box-shadow: var(--shadow-sm) !important;
    position: relative !important;
    gap: 8px !important;
    align-items: center !important;
    box-sizing: border-box !important;
    width: 100% !important;
  }

  #poli-resep-body tr:hover {
    border-color: rgba(56, 189, 248, 0.5) !important;
  }

  /* Cell 1: Searchable Medicine Input (Full Width - delete button width) */
  #poli-resep-body tr td:nth-child(1) {
    display: block !important;
    flex: 1 1 calc(100% - 48px) !important;
    width: calc(100% - 48px) !important;
    padding: 0 !important;
    border: none !important;
    order: 1 !important;
  }

  /* Cell 4: Delete Trash Button (Top Right) */
  #poli-resep-body tr td:nth-child(4) {
    display: flex !important;
    flex: 0 0 40px !important;
    width: 40px !important;
    padding: 0 !important;
    justify-content: flex-end !important;
    align-items: center !important;
    border: none !important;
    order: 2 !important;
  }

  #poli-resep-body tr td:nth-child(4) .btn {
    width: 40px !important;
    height: 40px !important;
    font-size: 0.95rem !important;
  }

  /* Cell 2: Jumlah / Qty */
  #poli-resep-body tr td:nth-child(2) {
    display: block !important;
    flex: 1 1 calc(38% - 4px) !important;
    width: calc(38% - 4px) !important;
    padding: 0 !important;
    border: none !important;
    order: 3 !important;
  }

  /* Cell 3: Total Harga Badge */
  #poli-resep-body tr td:nth-child(3) {
    display: block !important;
    flex: 1 1 calc(62% - 4px) !important;
    width: calc(62% - 4px) !important;
    padding: 0 !important;
    border: none !important;
    text-align: right !important;
    order: 4 !important;
  }

  #poli-resep-body tr td:nth-child(3) .med-subtotal-badge {
    width: 100% !important;
    height: 44px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: flex-end !important;
    font-size: 0.95rem !important;
    font-weight: 800 !important;
    border-radius: var(--r-sm) !important;
    box-sizing: border-box !important;
    text-align: center !important;
  }

  /* Searchable dropdown menu full width and spacious on mobile */
  .med-searchable-wrap .searchable-dropdown-menu {
    width: 100% !important;
    min-width: 270px !important;
    max-width: 100vw !important;
    left: 0 !important;
    right: 0 !important;
    z-index: 1000 !important;
    max-height: 230px !important;
  }

  .med-searchable-wrap .searchable-option-item {
    padding: 11px 12px !important;
  }

  .med-searchable-wrap .searchable-option-item strong {
    font-size: 0.92rem !important;
  }

  .med-searchable-wrap .searchable-option-item .option-sub {
    font-size: 0.76rem !important;
  }

  /* Diagnosis ICD-10 Row on Mobile */
  .poli-icd10-row {
    display: flex !important;
    gap: 8px !important;
    width: 100% !important;
    margin-bottom: 8px !important;
    align-items: center !important;
  }

  .poli-icd10-row .custom-searchable-wrap {
    flex: 1 1 auto !important;
    width: calc(100% - 48px) !important;
  }

  .poli-icd10-row .btn-danger {
    width: 40px !important;
    height: 40px !important;
    flex-shrink: 0 !important;
  }

  /* Total Biaya Card on Mobile */
  .resep-total-summary-card {
    padding: 12px 14px !important;
    margin: 10px 0 14px 0 !important;
  }

  .resep-total-amount {
    font-size: 1.4rem !important;
  }

  /* --- DESKTOP TABLE: hide specifically for Karyawan on mobile, show mobile cards --- */
  #view-karyawan .table-responsive { display: none !important; }
  .mobile-card-list  { display: flex !important; }

  /* --- Karyawan section header: stack search + button --- */
  #view-karyawan > .glass-card > div[style*="justify-content: space-between"] {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 10px !important;
  }
  #view-karyawan input[type="text"] { width: 100%; }

  /* --- MODAL → BOTTOM SHEET --- */
  .modal-overlay {
    align-items: flex-end !important;
    padding: 0 !important;
  }
  .modal-card {
    border-radius: 20px 20px 0 0 !important;
    max-height: 92vh !important;
    width: 100% !important;
    max-width: 100% !important;
    padding: 20px 16px 30px !important;
    animation: mobileSheetUp 0.3s cubic-bezier(0.16, 1, 0.3, 1) !important;
  }
  @keyframes mobileSheetUp {
    from { transform: translateY(100%); opacity: 0.6; }
    to   { transform: translateY(0);    opacity: 1; }
  }

  /* Modal drag handle */
  .modal-card::before {
    content: '';
    display: block;
    width: 36px;
    height: 4px;
    background: var(--border-card);
    border-radius: 2px;
    margin: 0 auto 16px;
  }

  /* --- Toast: push above bottom nav --- */
  .toast-container {
    bottom: 76px;
    right: 12px;
    left: 12px;
  }
  .toast {
    max-width: 100%;
    font-size: 0.84rem;
  }

  /* --- Timeline: smaller cards --- */
  .timeline-item { padding: 12px 12px; }
  .timeline-header { flex-direction: column; align-items: flex-start; gap: 6px; }

  /* --- Resep table: scrollable on mobile --- */
  .resep-table { font-size: 0.78rem; }
  .resep-table th, .resep-table td { padding: 6px 6px; }

  /* --- Searchable dropdown: full viewport height aware --- */
  .searchable-dropdown-menu { max-height: 200px; }

  /* --- Code block --- */
  .code-block { font-size: 0.68rem; max-height: 160px; }

  /* --- Stat grids that use inline style --- */
  [style*="repeat(4, 1fr)"],
  [style*="repeat(3, 1fr)"] {
    grid-template-columns: repeat(2, 1fr) !important;
  }

  /* --- Gudang sub-tabs: stack vertically on mobile (Atas-Bawah) --- */
  .gudang-subtabs {
    display: flex !important;
    flex-direction: column !important;
    flex-wrap: nowrap !important;
    gap: 8px !important;
    width: 100% !important;
    overflow-x: visible !important;
  }
  .gudang-subtabs .btn {
    width: 100% !important;
    flex: 1 1 100% !important;
    font-size: 0.86rem !important;
    padding: 11px 14px !important;
    text-align: center !important;
    justify-content: center !important;
    white-space: normal !important;
  }

  /* --- Gudang header actions: stack on mobile --- */
  .gudang-header-actions {
    flex-direction: column !important;
    width: 100%;
  }
  .gudang-header-actions .btn {
    width: 100%;
  }

  /* ============================================================
     UNIVERSAL TABLE-TO-CARD MOBILE TRANSFORMATION (360px OPTIMIZED)
     Transforms wide tables (Gudang, HSE, Billing, Opname, WA) into crisp cards
     ============================================================ */
  .table-responsive .custom-table {
    display: block !important;
    width: 100% !important;
    border: none !important;
  }
  .table-responsive .custom-table thead {
    display: none !important;
  }
  .table-responsive .custom-table tbody {
    display: flex !important;
    flex-direction: column !important;
    gap: 6px !important;
    width: 100% !important;
  }
  .table-responsive .custom-table tbody tr {
    display: flex !important;
    flex-direction: column !important;
    background: #101728 !important;
    border: 1px solid #2e4a7a !important;
    border-radius: 6px !important;
    padding: 6px 8px !important;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25) !important;
    gap: 2px !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }
  .table-responsive .custom-table tbody tr:hover,
  .table-responsive .custom-table tbody tr:active {
    border-color: #38bdf8 !important;
  }
  .table-responsive .custom-table tbody tr td {
    display: flex !important;
    flex-direction: row !important;
    justify-content: flex-start !important;
    align-items: flex-start !important;
    padding: 2px 0 !important;
    border: none !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05) !important;
    font-size: 0.78rem !important;
    line-height: 1.3 !important;
    width: 100% !important;
    box-sizing: border-box !important;
    white-space: normal !important;
    word-break: break-word !important;
    text-align: left !important;
    gap: 4px !important;
  }
  .table-responsive .custom-table tbody tr td:last-child {
    border-bottom: none !important;
    padding-top: 4px !important;
    justify-content: flex-start !important;
    gap: 6px !important;
  }
  .table-responsive .custom-table tbody tr td[data-label]::before {
    content: attr(data-label) ":";
    font-weight: 700;
    color: #38bdf8 !important;
    font-size: 0.7rem;
    min-width: 78px !important;
    max-width: 90px !important;
    flex-shrink: 0 !important;
    text-transform: uppercase;
    text-align: left !important;
  }

  /* --- Pengiriman Obat grid: single column on mobile --- */
  .pengiriman-grid {
    grid-template-columns: 1fr !important;
    gap: 14px !important;
    width: 100% !important;
    max-width: 100% !important;
  }
  .pengiriman-grid > div {
    min-width: 0 !important;
    max-width: 100% !important;
  }

  .pengiriman-name-grid {
    grid-template-columns: 1fr !important;
    gap: 10px !important;
  }

  /* --- Pengiriman stok grid: keep 3 columns but compact --- */
  .pengiriman-stok-grid {
    grid-template-columns: 1fr 1fr 1fr !important;
    gap: 6px !important;
  }
  .pengiriman-stok-grid .form-control {
    font-size: 0.85rem !important;
    padding: 8px 4px !important;
    text-align: center !important;
  }
  .pengiriman-stok-grid .form-label {
    font-size: 0.7rem !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }

  /* --- Obat Req add buttons: stack vertically --- */
  .obat-req-actions {
    flex-direction: column !important;
  }
  .obat-req-actions .btn {
    width: 100%;
    font-size: 0.78rem;
  }

  /* --- HSE filter row: full-width inputs --- */
  .hse-filter-row {
    flex-direction: column !important;
    gap: 8px !important;
  }
  .hse-filter-row input[type="text"],
  .hse-filter-row input[type="date"] {
    width: 100% !important;
  }
  .hse-filter-row .btn {
    width: 100%;
  }

  /* --- HSE sub-tab & print buttons: stack --- */
  .hse-subtab-actions {
    flex-direction: column !important;
    gap: 8px !important;
  }
  .hse-subtab-actions > div {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
  }
  .hse-subtab-actions .btn {
    width: 100%;
    justify-content: center;
  }

  /* ============================================================
     STRICT PORTRAIT MOBILE OVERFLOW ENFORCER & STACKING RULES
     All cards and forms stack vertically (Atas-Bawah) without side-scrolling
     ============================================================ */
  html, body {
    overflow-x: hidden !important;
    width: 100% !important;
    max-width: 100vw !important;
  }

  .app-container,
  .page-view,
  .glass-card,
  .modal-card {
    max-width: 100% !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  /* Force ALL inline & class multi-column grids to stack vertically (1 column) on mobile */
  [style*="grid-template-columns: 1fr 1fr"],
  [style*="grid-template-columns:1fr 1fr"],
  [style*="grid-template-columns: 1fr 1.5fr"],
  [style*="grid-template-columns: 1fr 1fr 1fr"],
  [style*="grid-template-columns: 1fr 1.2fr 1fr"],
  [style*="grid-template-columns: 1.15fr 0.85fr"],
  [style*="grid-template-columns: 1.2fr 1fr 1.2fr 120px"],
  .wa-contact-form-grid {
    grid-template-columns: 1fr !important;
    gap: 10px !important;
  }

  /* Management, Billing, & WA Contact form stacking */
  .manajemen-nav-row,
  .billing-filter-row,
  .whacenter-row {
    flex-direction: column !important;
    align-items: stretch !important;
    width: 100% !important;
    gap: 10px !important;
  }

  .billing-filter-row input,
  .billing-filter-row button,
  .whacenter-row input,
  .whacenter-row button {
    width: 100% !important;
    max-width: 100% !important;
  }

  /* Form groups inside grid cells stack nicely */
  .form-group[style*="display: grid"] {
    grid-template-columns: 1fr !important;
  }

  /* Stat cards grid on mobile: 2-column or 1-column */
  .vitals-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 8px !important;
  }

  .stats-grid {
    grid-template-columns: 1fr 1fr !important;
    gap: 8px !important;
  }

  /* General elements bounding box protection */
  div, section, form, input, select, textarea, button, table {
    max-width: 100% !important;
    box-sizing: border-box !important;
  }

  /* --- HSE stat cards: 2 columns on mobile --- */
  .hse-stat-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 10px !important;
  }
  .hse-stat-grid .stat-card {
    padding: 12px 10px 10px !important;
    min-height: 105px !important;
    border-width: 1.5px !important;
  }
  .hse-stat-grid .stat-card .stat-label {
    font-size: 0.68rem !important;
  }
  .hse-stat-grid .stat-value {
    font-size: 1.5rem !important;
  }
  .hse-stat-grid .stat-sub {
    font-size: 0.7rem !important;
  }
  .hse-stat-grid .stat-pill-badge {
    font-size: 0.62rem !important;
    padding: 2px 5px !important;
  }
  .hse-chart-pair-grid {
    grid-template-columns: 1fr !important;
  }

  /* --- Manajemen nav row: stack --- */
  .manajemen-nav-row {
    flex-direction: column !important;
    gap: 8px !important;
  }
  .manajemen-nav-row > div {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
  }
  .manajemen-nav-row .btn {
    width: 100%;
  }

  /* --- Billing filter row: full-width --- */
  .billing-filter-row {
    flex-direction: column !important;
    gap: 8px !important;
  }
  .billing-filter-row input[type="date"] {
    width: 100% !important;
  }
  .billing-filter-row .btn {
    width: 100%;
  }

  /* --- WhaCenter device ID row: stack --- */
  .whacenter-row {
    flex-direction: column !important;
    max-width: 100% !important;
  }
  .whacenter-row .btn {
    width: 100%;
  }

  /* --- WA Contact form grid: stack --- */
  .wa-contact-form-grid {
    grid-template-columns: 1fr !important;
    gap: 10px !important;
  }

  /* --- Mobile card max-width boundaries & safety (Standard Mobile Portrait) --- */
  .table-responsive {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: hidden !important;
    margin: 0 !important;
    padding: 0 !important;
  }
  .table-responsive .custom-table {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
  }

  /* --- Karyawan search input full-width --- */
  #search-karyawan-input {
    width: 100% !important;
  }

  /* --- More menu grid: 5 columns for 5 items --- */
  .mobile-more-grid {
    grid-template-columns: repeat(5, 1fr) !important;
    gap: 2px !important;
  }
  .mobile-more-item {
    font-size: 0.58rem;
    padding: 8px 2px;
  }
  .mobile-more-item i {
    font-size: 1.1rem;
  }

  /* --- Resep total summary card --- */
  .resep-total-summary-card { flex-direction: column; align-items: flex-start; gap: 6px; }

  /* --- Header action rows --- */
  .soap-panel-header { flex-wrap: wrap; gap: 8px; }

  /* --- HSE Pantauan Mobile Card Flow --- */
  #modal-hse-pantauan thead { display: none !important; }
  #table-hse-pantauan-body tr {
    display: flex !important;
    flex-direction: column !important;
    background: var(--surface-2) !important;
    border: 1px solid var(--border-card) !important;
    border-radius: var(--r-md) !important;
    margin-bottom: 12px !important;
    padding: 12px !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15) !important;
    gap: 6px !important;
  }
  #table-hse-pantauan-body td {
    display: flex !important;
    justify-content: space-between !important;
    align-items: flex-start !important;
    padding: 4px 0 !important;
    border: none !important;
    border-bottom: 1px dashed rgba(255,255,255,0.06) !important;
    font-size: 0.85rem !important;
  }
  [data-theme="light"] #table-hse-pantauan-body td {
    border-bottom: 1px dashed rgba(0,0,0,0.08) !important;
  }
  #table-hse-pantauan-body td:last-child {
    border-bottom: none !important;
    padding-top: 8px !important;
    justify-content: flex-end !important;
  }
  #table-hse-pantauan-body td::before {
    content: attr(data-label);
    font-weight: 700;
    font-size: 0.76rem;
    color: var(--text-faint);
    text-transform: uppercase;
    margin-right: 8px;
    flex-shrink: 0;
  }
}

/* Very small screens (≤380px — older iPhones, compact Androids) */
@media (max-width: 380px) {
  html { font-size: 12.5px; }
  .app-container { padding: 4px 4px 70px !important; }
  .glass-card { padding: 6px 4px !important; }
  [style*="grid-template-columns: 1fr 1fr 1fr"] {
    grid-template-columns: 1fr !important;
  }
  .mobile-patient-card .card-actions {
    flex-direction: row;
    flex-wrap: nowrap;
  }
  .hse-stat-grid {
    grid-template-columns: 1fr !important;
  }
  .pengiriman-stok-grid {
    grid-template-columns: 1fr !important;
  }
  .mobile-more-grid {
    grid-template-columns: repeat(3, 1fr) !important;
  }
}

/* ==========================================
   MOBILE BOTTOM NAVIGATION BAR
   Fixed at bottom, always visible, 5 main tabs
   ========================================== */
.mobile-bottom-nav {
  display: none; /* hidden on desktop */
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 64px;
  background: var(--surface-1);
  border-top: 1px solid var(--border-card);
  z-index: 200;
  box-shadow: 0 -4px 16px rgba(0,0,0,0.25);
  padding-bottom: env(safe-area-inset-bottom); /* iPhone notch-safe */
}

.mobile-bottom-nav-inner {
  display: flex;
  height: 100%;
  align-items: stretch;
}

.mobile-nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease;
  padding: 6px 4px;
  -webkit-tap-highlight-color: transparent;
  position: relative;
}

.mobile-nav-item i {
  font-size: 1.15rem;
  transition: transform 0.15s ease;
}

.mobile-nav-item:active {
  background: var(--surface-2);
}

.mobile-nav-item.active {
  color: var(--primary);
}

.mobile-nav-item.active i {
  transform: translateY(-1px);
}

/* Active indicator dot */
.mobile-nav-item.active::after {
  content: '';
  position: absolute;
  top: 6px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--primary);
}

/* More menu overlay */
.mobile-more-menu {
  display: none;
  position: fixed;
  bottom: 64px;
  left: 0;
  right: 0;
  background: var(--surface-1);
  border-top: 1px solid var(--border-card);
  z-index: 199;
  padding: 12px 0 8px;
  box-shadow: 0 -8px 24px rgba(0,0,0,0.3);
  animation: moreMenuUp 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
.mobile-more-menu.open { display: block; }

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

.mobile-more-title {
  font-size: 0.7rem;
  font-weight: 800;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0 16px 8px;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 4px;
}

.mobile-more-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  padding: 8px 12px;
}

.mobile-more-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 10px 4px;
  border-radius: var(--r-md);
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.64rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: all 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}

.mobile-more-item i {
  font-size: 1.2rem;
  color: var(--primary);
}

.mobile-more-item:active,
.mobile-more-item.active {
  background: var(--surface-2);
  color: var(--primary);
}

/* More menu backdrop */
.mobile-more-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 198;
  background: transparent;
}
.mobile-more-backdrop.open { display: block; }

@media (max-width: 768px) {
  .mobile-bottom-nav { display: block; }
}

/* ==========================================
   MOBILE PATIENT CARD LIST
   Replaces the wide table on mobile screens
   ========================================== */
.mobile-card-list {
  display: none; /* shown only on mobile via media query */
  flex-direction: column;
  gap: 10px;
  padding-top: 4px;
}

.mobile-patient-card {
  background: #101728;
  border: 1px solid #2e4a7a;
  border-radius: 6px;
  padding: 8px 10px 8px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  margin-bottom: 6px;
}

.mobile-patient-card:hover {
  background: var(--surface-hover);
  border-color: var(--primary-light);
}

.mobile-patient-card:active {
  transform: scale(0.99);
}

.patient-card-row {
  display: flex;
  flex-direction: row;
  justify-content: flex-start;
  align-items: flex-start;
  padding: 3px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 0.8rem;
  line-height: 1.3;
  gap: 6px;
  width: 100%;
  box-sizing: border-box;
}

.patient-card-lbl {
  color: #38bdf8;
  font-weight: 700;
  font-size: 0.72rem;
  min-width: 82px;
  max-width: 95px;
  flex-shrink: 0;
  text-transform: uppercase;
  text-align: left;
}

.patient-card-val {
  color: var(--text-main);
  text-align: left;
  word-break: break-word;
  flex: 1;
}

.card-top-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 4px;
}

.card-npk {
  font-size: 0.68rem;
  font-weight: 800;
  color: var(--primary-light);
  background: var(--primary-surface);
  border: 1px solid rgba(56,189,248,0.2);
  padding: 2px 6px;
  border-radius: var(--r-pill);
}

.card-no {
  font-size: 0.68rem;
  color: var(--text-faint);
  font-weight: 700;
}

.card-name {
  font-size: 0.86rem;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 3px;
  line-height: 1.2;
}

.card-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
  margin-bottom: 10px;
}

.card-meta-chip {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
}

.card-meta-chip i {
  font-size: 0.68rem;
  color: var(--text-faint);
}

.card-meta-divider {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--text-faint);
}

.card-gol-badge {
  font-size: 0.7rem;
  font-weight: 900;
  padding: 2px 7px;
  border-radius: 5px;
  letter-spacing: 0.03em;
}
.card-gol-badge.ab { background: rgba(239,68,68,0.18); color: #f87171; border: 1px solid rgba(239,68,68,0.3); }
.card-gol-badge.a  { background: rgba(2,132,199,0.18); color: #38bdf8; border: 1px solid rgba(2,132,199,0.3); }
.card-gol-badge.b  { background: rgba(245,158,11,0.18); color: #fbbf24; border: 1px solid rgba(245,158,11,0.3); }
.card-gol-badge.o  { background: rgba(16,185,129,0.18); color: #34d399; border: 1px solid rgba(16,185,129,0.3); }
.card-gol-badge.na { background: var(--surface-2); color: var(--text-faint); border: 1px solid var(--border-subtle); }

.card-usia-badge {
  font-size: 0.72rem;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 5px;
  background: rgba(139,92,246,0.15);
  color: #c084fc;
  border: 1px solid rgba(139,92,246,0.25);
}

.card-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  padding-top: 10px;
  border-top: 1px solid var(--border-subtle);
}

.card-actions .btn {
  flex: 1;
  min-height: 40px;
  font-size: 0.78rem;
}

.card-wa-btn {
  min-height: 40px !important;
  width: 40px !important;
  flex: 0 0 40px !important;
  padding: 0 !important;
  border-radius: var(--r-sm) !important;
  background: rgba(16,185,129,0.15) !important;
  border: 1px solid rgba(16,185,129,0.3) !important;
  color: #34d399 !important;
  font-size: 1rem !important;
}

/* ===================== FILTER ACTION BAR (RESPONSIVE) ===================== */
.filter-action-bar {
  display: flex;
  gap: 12px;
  margin-top: 14px;
  align-items: center;
}
@media (max-width: 768px) {
  .filter-action-bar {
    flex-direction: column;
    align-items: stretch;
  }
  .filter-action-bar .form-control {
    width: 100% !important;
  }
}

/* ===================== SEARCHABLE DROPDOWN COMPONENT ===================== */
.custom-searchable-wrap {
  position: relative;
  width: 100%;
}

.searchable-input-box {
  position: relative;
  display: flex;
  align-items: center;
}

.searchable-input-box input {
  padding-right: 32px;
  cursor: text;
  width: 100%;
}

.searchable-dropdown-arrow {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
  font-size: 0.75rem;
  transition: transform 0.2s ease;
}

.custom-searchable-wrap.active .searchable-dropdown-arrow {
  transform: translateY(-50%) rotate(180deg);
  color: var(--primary);
}

/* Dropdown Menu - Dynamic Theme Compatible */
.searchable-dropdown-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  max-height: 250px;
  overflow-y: auto;
  background: var(--surface-1);
  border: 1.5px solid var(--border-focus);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-lg);
  z-index: 9999;
  display: none;
}

[data-theme="dark"] .searchable-dropdown-menu {
  background: #0f172a;
  border-color: #38bdf8;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.8), 0 4px 10px rgba(0, 0, 0, 0.6);
}

[data-theme="light"] .searchable-dropdown-menu {
  background: #ffffff;
  border-color: #0284c7;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.15), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
}

.custom-searchable-wrap.active .searchable-dropdown-menu {
  display: block;
}

.searchable-option-item {
  padding: 9px 12px;
  font-size: 0.84rem;
  color: var(--text-main);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-card);
  transition: background 0.15s ease, color 0.15s ease;
}

.searchable-option-item:last-child {
  border-bottom: none;
}

.searchable-option-item strong {
  color: var(--text-main);
  font-weight: 700;
}

.searchable-option-item .option-sub {
  font-size: 0.72rem;
  color: var(--text-muted);
}

/* Dark Mode Hover / Selection */
[data-theme="dark"] .searchable-option-item {
  color: #f1f5f9;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

[data-theme="dark"] .searchable-option-item:hover, 
[data-theme="dark"] .searchable-option-item.highlighted {
  background: #1e293b;
  color: #38bdf8;
}

[data-theme="dark"] .searchable-option-item.selected {
  background: rgba(14, 165, 233, 0.2);
  color: #38bdf8;
  font-weight: 700;
}

/* Light Mode Hover / Selection - 100% High Contrast */
[data-theme="light"] .searchable-option-item {
  color: #0f172a;
  border-bottom: 1px solid #e2e8f0;
}

[data-theme="light"] .searchable-option-item:hover, 
[data-theme="light"] .searchable-option-item.highlighted {
  background: #f0f9ff;
  color: #0284c7;
}

[data-theme="light"] .searchable-option-item.selected {
  background: #e0f2fe;
  color: #0369a1;
  font-weight: 700;
}

[data-theme="light"] .searchable-option-item strong {
  color: #0f172a;
}

[data-theme="light"] .searchable-option-item .option-sub {
  color: #64748b;
}

/* Tags & Badges */
.freq-tag {
  font-size: 0.7rem;
  padding: 2px 7px;
  border-radius: 4px;
  background: rgba(245, 158, 11, 0.2);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.3);
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  white-space: nowrap;
}

[data-theme="light"] .freq-tag {
  background: #fef3c7;
  color: #b45309;
  border-color: #fde68a;
}

.price-tag {
  font-size: 0.74rem;
  padding: 2px 7px;
  border-radius: 4px;
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.25);
  font-weight: 700;
  white-space: nowrap;
}

[data-theme="light"] .price-tag {
  background: #dcfce7;
  color: #15803d;
  border-color: #bbf7d0;
}

/* ===================== RESEP SUMMARY CARD ===================== */
.resep-total-summary-card {
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.95), rgba(30, 41, 59, 0.85));
  border: 1.5px solid rgba(14, 165, 233, 0.35);
  border-radius: var(--r-md);
  padding: 10px 14px;
  margin-top: 8px;
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

[data-theme="light"] .resep-total-summary-card {
  background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
  border: 1.5px solid #7dd3fc;
  box-shadow: 0 4px 12px rgba(2, 132, 199, 0.1);
}

.resep-total-info {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--text-main);
}

[data-theme="light"] .resep-total-info {
  color: #0f172a;
}

.resep-total-amount {
  font-size: 1.15rem;
  font-weight: 800;
  color: #38bdf8;
  letter-spacing: 0.02em;
}

[data-theme="light"] .resep-total-amount {
  color: #0284c7;
}

.med-subtotal-badge {
  font-size: 0.85rem;
  font-weight: 800;
  color: #34d399;
  background: rgba(16, 185, 129, 0.12);
  padding: 7px 8px;
  border-radius: var(--r-xs);
  text-align: right;
  border: 1px solid rgba(16, 185, 129, 0.25);
  white-space: nowrap;
}

[data-theme="light"] .med-subtotal-badge {
  background: #ecfdf5;
  color: #047857;
  border-color: #6ee7b7;
}

/* Nakes Quick Chips */
.popular-chips-container {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.nakes-chip {
  background: var(--surface-2);
  border: 1px solid var(--border-card);
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

[data-theme="light"] .nakes-chip {
  background: #f1f5f9;
  border-color: #cbd5e1;
  color: #334155;
}

.nakes-chip:hover {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
}

[data-theme="light"] .nakes-chip:hover {
  background: #0284c7;
  color: #ffffff;
  border-color: #0284c7;
}

/* --- RESPONSIVE OVERRIDES FOR OBAT REQ CATALOG ON MOBILE --- */
@media (max-width: 768px) {
  #req-catalog-body {
    display: flex !important;
    flex-direction: column !important;
    gap: 8px !important;
    width: 100% !important;
  }
  
  #req-catalog-body tr {
    display: flex !important;
    flex-direction: row !important;
    justify-content: space-between !important;
    align-items: center !important;
    padding: 10px 12px !important;
    background: var(--surface-2) !important;
    border: 1px solid var(--border-card) !important;
    border-radius: var(--r-md) !important;
    gap: 8px !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }
  
  #req-catalog-body tr td {
    display: flex !important;
    flex-direction: row !important;
    border: none !important;
    border-bottom: none !important;
    padding: 0 !important;
    width: auto !important;
    box-sizing: border-box !important;
    align-items: center !important;
    justify-content: flex-start !important;
    background: transparent !important;
    box-shadow: none !important;
  }
  
  #req-catalog-body tr td.catalog-med-name {
    flex: 1 1 auto !important;
    font-size: 0.95rem !important;
    color: var(--text-primary) !important;
    font-weight: 700 !important;
    white-space: normal !important;
    word-break: break-word !important;
  }
  
  #req-catalog-body tr td:nth-child(2) {
    flex: 0 0 auto !important;
    justify-content: center !important;
  }
  
  #req-catalog-body tr td:nth-child(3) {
    flex: 0 0 auto !important;
    justify-content: flex-end !important;
  }

  /* Compact Catalog Qty Inputs on Mobile */
  #req-catalog-body tr td:nth-child(3) .btn {
    width: 32px !important;
    height: 32px !important;
  }

  #req-catalog-body tr td:nth-child(3) .catalog-qty-input {
    width: 45px !important;
    height: 32px !important;
    font-size: 0.9rem !important;
    padding: 4px !important;
  }
}

/* --- LIGHT THEME MOBILE PORTRAIT CONTRAST FIXES --- */
@media (max-width: 768px) {
  /* Karyawan Mobile Cards */
  [data-theme="light"] .mobile-patient-card {
    background: var(--surface-1) !important;
    border: 1px solid var(--border-card) !important;
    box-shadow: var(--shadow-sm) !important;
  }
  
  [data-theme="light"] .mobile-patient-card:hover {
    background: var(--surface-hover) !important;
    border-color: var(--primary) !important;
  }

  [data-theme="light"] .patient-card-lbl {
    color: var(--primary) !important; /* Higher contrast medical blue */
  }

  [data-theme="light"] .patient-card-val {
    color: var(--text-main) !important; /* Rich deep slate */
  }

  [data-theme="light"] .patient-card-row {
    border-bottom: 1px solid var(--border-subtle) !important;
  }

  /* Responsive Tables transformed to Cards (Poli, Edit Data, HSE, Manajemen) */
  [data-theme="light"] .table-responsive .custom-table tbody tr {
    background: var(--surface-1) !important;
    border: 1px solid var(--border-card) !important;
    box-shadow: var(--shadow-sm) !important;
  }

  [data-theme="light"] .table-responsive .custom-table tbody tr:hover,
  [data-theme="light"] .table-responsive .custom-table tbody tr:active {
    background: var(--surface-hover) !important;
    border-color: var(--primary) !important;
  }

  [data-theme="light"] .table-responsive .custom-table tbody tr td {
    color: var(--text-main) !important; /* Rich deep slate value text */
    border-bottom: 1px solid var(--border-subtle) !important;
  }

  [data-theme="light"] .table-responsive .custom-table tbody tr td[data-label]::before {
    color: var(--primary) !important; /* Higher contrast medical blue labels */
  }

  [data-theme="light"] .table-responsive .custom-table tbody tr td:last-child {
    border-bottom: none !important;
  }
}

/* --- LIGHT THEME CONTRAST & FORM READABILITY IMPROVEMENTS --- */
[data-theme="light"] .marunda-section-label {
  background: #f1f5f9 !important; /* Soft greyish blue background */
  color: #0f172a !important; /* Deep dark slate text for maximum legibility */
  border: 1px solid #cbd5e1 !important;
  border-left: 5px solid #0284c7 !important; /* Bold primary brand blue tag */
}

[data-theme="light"] .resep-table th,
[data-theme="light"] .custom-table th {
  background: #e2e8f0 !important; /* Soft light slate for table headers */
  color: #334155 !important;
  border-bottom: 2px solid #cbd5e1 !important;
}

[data-theme="light"] .form-control {
  background: #ffffff !important; /* Pure white */
  border-color: #cbd5e1 !important;
}

[data-theme="light"] .form-control:focus {
  background: #ffffff !important;
  border-color: #0284c7 !important;
  box-shadow: 0 0 0 4px rgba(2, 132, 199, 0.22) !important;
  color: #000000 !important;
}

/* --- DARK THEME CONTRAST & FORM READABILITY IMPROVEMENTS (REFOCUSED FOR MODERN UX) --- */
[data-theme="dark"] .marunda-section-label {
  background: #1e293b !important; /* Elegant dark slate card background */
  color: #f8fafc !important; /* High contrast clean white text */
  border: 1px solid #2e416a !important;
  border-left: 5px solid #0ea5e9 !important; /* Sharp cyan left tag */
}

[data-theme="dark"] .resep-table th,
[data-theme="dark"] .custom-table th {
  background: #1e293b !important;
  color: var(--text-muted) !important;
  border-bottom: 2px solid var(--border-card) !important;
}

[data-theme="dark"] .form-control {
  background: var(--surface-2) !important;
  border-color: var(--border-card) !important;
}

[data-theme="dark"] .form-control:focus {
  background: #1e2b4a !important; /* Slightly lighter navy surface for elevation contrast */
  color: #ffffff !important;
  border-color: #38bdf8 !important; /* Vibrant light blue/cyan border focus */
  box-shadow: 0 0 0 4px rgba(56, 189, 248, 0.25) !important; /* Soft cyan focus glow */
}

/* Hide spin buttons for catalog qty inputs */
.catalog-qty-input::-webkit-outer-spin-button,
.catalog-qty-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.catalog-qty-input[type=number] {
  -moz-appearance: textfield;
}

/* SSE Live Sync Pulse Animation */
@keyframes ssePulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.85); }
}

/* New Record Badge (baru diinput < 2 jam) */
.badge-new-record {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(52, 211, 153, 0.18);
  border: 1px solid rgba(52, 211, 153, 0.45);
  color: #34d399;
  font-size: 0.68rem;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  animation: ssePulse 2.5s infinite;
}

/* SSE Disconnected state */
#sse-live-indicator.sse-disconnected {
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.3);
  color: #f87171;
}
#sse-live-indicator.sse-disconnected #sse-dot {
  background: #f87171;
  box-shadow: 0 0 6px #f87171;
  animation: none;
}

/* Edit Data new-row highlight flash */
@keyframes rowFlashIn {
  0% { background: rgba(52, 211, 153, 0.18); }
  100% { background: transparent; }
}
.edit-data-row-new {
  animation: rowFlashIn 2.5s ease-out forwards;
}

/* ============================================================
   HSE PANTAUAN & SURKES HIGH-CONTRAST RESPONSIVE CARDS
   ============================================================ */
.hse-patient-card {
  background: var(--surface-1);
  border: 1.5px solid var(--border-card);
  border-radius: 12px;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2);
  width: 100%;
  box-sizing: border-box;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

.hse-patient-card:hover {
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.28);
  border-color: var(--primary-light);
  transform: translateY(-1px);
}

.hse-patient-card.pantauan-card {
  border-left: 6px solid #ef4444 !important;
}

.hse-patient-card.surkes-card {
  border-left: 6px solid #f59e0b !important;
}

.hse-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 10px;
}

.hse-card-patient-name {
  cursor: pointer;
  color: var(--primary-light);
  text-decoration: underline;
  font-weight: 800;
  font-size: 1.15rem;
  letter-spacing: 0.01em;
}

.hse-card-patient-name:hover {
  opacity: 0.85;
}

.hse-card-tags {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 6px;
  flex-wrap: wrap;
}

.hse-card-dept-badge {
  background: var(--surface-2);
  color: var(--text-main);
  border: 1px solid var(--border-card);
  font-size: 0.78rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.hse-card-meta {
  text-align: right;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 5px;
}

.hse-card-date {
  font-weight: 800;
  font-size: 0.9rem;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 6px;
}

.hse-card-soap-box {
  background: #0d1527;
  border: 1.5px solid #1e293b;
  padding: 12px 14px;
  border-radius: 8px;
  font-size: 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.hse-card-soap-row {
  display: flex;
  flex-direction: column;
  gap: 3px;
  line-height: 1.45;
}

.hse-card-lbl {
  color: #f8fafc;
  font-weight: 800;
  font-size: 0.88rem;
}

.hse-card-val {
  color: #e2e8f0;
  font-weight: 500;
}

.hse-card-val-block {
  margin-top: 2px;
}

.hse-card-pemeriksa {
  font-size: 0.84rem;
  color: var(--text-muted);
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 5px;
}

.hse-card-pemeriksa strong {
  color: var(--text-main);
  font-weight: 700;
}

.hse-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--border-subtle);
}

.hse-card-hint {
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 600;
}

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

.badge-status-surkes {
  font-weight: 800;
  font-size: 0.76rem;
  padding: 4px 10px;
  border-radius: 6px;
  background: rgba(245, 158, 11, 0.2);
  color: #fbbf24;
  border: 1.5px solid #f59e0b;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.badge-status-pantauan {
  font-weight: 800;
  font-size: 0.76rem;
  padding: 4px 10px;
  border-radius: 6px;
  background: rgba(239, 68, 68, 0.2);
  color: #f87171;
  border: 1.5px solid #ef4444;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

/* --- LIGHT THEME HIGH CONTRAST OVERRIDES --- */
[data-theme="light"] .hse-patient-card {
  background: #ffffff !important;
  border: 1.5px solid #94a3b8 !important;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.08), 0 1px 3px rgba(15, 23, 42, 0.05) !important;
}

[data-theme="light"] .hse-patient-card:hover {
  box-shadow: 0 6px 20px rgba(15, 23, 42, 0.14) !important;
  border-color: #0284c7 !important;
}

[data-theme="light"] .hse-patient-card.pantauan-card {
  border-left: 6px solid #dc2626 !important;
}

[data-theme="light"] .hse-patient-card.surkes-card {
  border-left: 6px solid #d97706 !important;
}

[data-theme="light"] .hse-card-patient-name {
  color: #0369a1 !important;
}

[data-theme="light"] .hse-card-dept-badge {
  background: #f1f5f9 !important;
  color: #0f172a !important;
  border-color: #cbd5e1 !important;
}

[data-theme="light"] .hse-card-date {
  color: #0f172a !important;
}

[data-theme="light"] .hse-card-soap-box {
  background: #f8fafc !important;
  border: 1.5px solid #cbd5e1 !important;
}

[data-theme="light"] .hse-card-lbl {
  color: #0f172a !important;
}

[data-theme="light"] .hse-card-val {
  color: #1e293b !important;
  font-weight: 600 !important;
}

[data-theme="light"] .hse-card-pemeriksa {
  color: #475569 !important;
}

[data-theme="light"] .hse-card-pemeriksa strong {
  color: #0f172a !important;
}

[data-theme="light"] .hse-card-footer {
  border-top-color: #e2e8f0 !important;
}

[data-theme="light"] .hse-card-hint {
  color: #64748b !important;
}

[data-theme="light"] .badge-status-surkes {
  background: #fef3c7 !important;
  color: #92400e !important;
  border-color: #d97706 !important;
}

[data-theme="light"] .badge-status-pantauan {
  background: #fee2e2 !important;
  color: #991b1b !important;
  border-color: #dc2626 !important;
}

/* ============================================================
   ACCOUNT SETTINGS & PROFILE SWITCHER MODAL STYLES
   ============================================================ */
.acc-tabs-nav {
  display: flex;
  gap: 8px;
  border-bottom: 2px solid var(--border-subtle);
  margin-bottom: 20px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.acc-tab-btn {
  background: transparent;
  border: none;
  padding: 10px 16px;
  border-radius: 8px 8px 0 0;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s ease;
  white-space: nowrap;
  border-bottom: 3px solid transparent;
  margin-bottom: -3px;
}

.acc-tab-btn:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.04);
}

.acc-tab-btn.active {
  color: var(--primary-light);
  border-bottom-color: var(--primary-light);
  background: rgba(2, 132, 199, 0.08);
}

[data-theme="light"] .acc-tab-btn.active {
  color: #0284c7;
  border-bottom-color: #0284c7;
  background: #e0f2fe;
}

.acc-profile-card {
  background: var(--surface-2);
  border: 1.5px solid var(--border-card);
  border-radius: 12px;
  padding: 16px 18px;
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 18px;
}

[data-theme="light"] .acc-profile-card {
  background: #f8fafc;
  border-color: #cbd5e1;
}

.acc-profile-avatar {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0284c7, #0d9488);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1.5rem;
  font-weight: 800;
  box-shadow: 0 4px 12px rgba(2, 132, 199, 0.3);
  flex-shrink: 0;
}

.acc-profile-info {
  flex: 1;
  min-width: 0;
}

.acc-profile-name {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 4px;
}

.acc-profile-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.acc-form-card {
  background: var(--surface-2);
  border: 1.5px solid var(--border-card);
  border-radius: 12px;
  padding: 18px 20px;
}

[data-theme="light"] .acc-form-card {
  background: #ffffff;
  border-color: #cbd5e1;
}

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

.acc-pwd-input-wrap .form-control {
  padding-right: 44px;
}

.acc-pwd-peek-btn {
  position: absolute;
  right: 10px;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.acc-pwd-peek-btn:hover {
  color: var(--text-main);
}

/* Switch Account Cards */
.switch-account-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.switch-user-card {
  background: var(--surface-2);
  border: 1.5px solid var(--border-card);
  border-radius: 12px;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  transition: all 0.2s ease;
}

.switch-user-card:hover {
  border-color: var(--primary-light);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.switch-user-card.active-user-card {
  border-color: #10b981;
  background: rgba(16, 185, 129, 0.06);
}

[data-theme="light"] .switch-user-card {
  background: #ffffff;
  border-color: #cbd5e1;
}

[data-theme="light"] .switch-user-card.active-user-card {
  border-color: #10b981;
  background: #f0fdf4;
}

.switch-user-left {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.switch-user-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(56, 189, 248, 0.15);
  border: 1px solid rgba(56, 189, 248, 0.3);
  color: #38bdf8;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
}

[data-theme="light"] .switch-user-avatar {
  background: #e0f2fe;
  border-color: #7dd3fc;
  color: #0284c7;
}

.switch-user-card.active-user-card .switch-user-avatar {
  background: rgba(16, 185, 129, 0.15);
  border-color: rgba(16, 185, 129, 0.35);
  color: #10b981;
}

.switch-user-name {
  font-weight: 800;
  font-size: 0.98rem;
  color: var(--text-main);
  margin-bottom: 2px;
}

.switch-user-username {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* ========================================================= */
/* JADWAL KONTROL & WA WEB STYLES                            */
/* ========================================================= */
.btn-filter-kontrol {
  background: var(--surface-2);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  border-radius: 20px;
  padding: 5px 14px;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-filter-kontrol:hover {
  background: var(--surface-3);
  color: var(--text-main);
  border-color: var(--border-card);
}

.btn-filter-kontrol.active {
  background: #0284c7 !important;
  color: #ffffff !important;
  border-color: #38bdf8 !important;
  box-shadow: 0 2px 8px rgba(2, 132, 199, 0.4);
}

@media print {
  body * {
    visibility: hidden;
  }
  #modal-laporan-dhse,
  #modal-laporan-dhse * {
    visibility: visible;
  }
  #modal-laporan-dhse {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: auto;
    background: #ffffff !important;
    color: #000000 !important;
    display: block !important;
    z-index: 999999;
  }
  #modal-laporan-dhse .modal-card {
    border: none !important;
    box-shadow: none !important;
    width: 100% !important;
    max-width: 100% !important;
    background: #ffffff !important;
    color: #000000 !important;
    padding: 0 !important;
  }
  #modal-laporan-dhse button,
  #modal-laporan-dhse .close-btn,
  #modal-laporan-dhse .modal-overlay,
  #modal-laporan-dhse div[style*="background: var(--surface-2)"] {
    display: none !important;
  }
  #dhse-printable-area {
    overflow: visible !important;
  }
  #dhse-report-table {
    width: 100%;
    border-collapse: collapse;
    color: #000000 !important;
  }
  #dhse-report-table th, #dhse-report-table td {
    border: 1px solid #333333 !important;
    color: #000000 !important;
    padding: 6px 8px !important;
  }
}

/* ============================================================
   JADWAL KONTROL SUMMARY CARDS (HIGH-CONTRAST & INTERACTIVE)
   ============================================================ */
.kontrol-card-interactive {
  cursor: pointer;
  border-radius: var(--r-md);
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  user-select: none;
  position: relative;
  overflow: hidden;
}
.kontrol-card-interactive:hover {
  transform: translateY(-2px);
}
.kontrol-card-interactive:active {
  transform: translateY(0);
}

/* Card 1: Hari Ini (Red) */
.kontrol-card-red {
  background: linear-gradient(135deg, #fff5f5 0%, #fee2e2 100%);
  border: 1.5px solid #f87171;
  box-shadow: 0 4px 14px rgba(239, 68, 68, 0.12);
}
.kontrol-card-red .card-icon-wrap {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: #ef4444;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
  flex-shrink: 0;
  box-shadow: 0 2px 10px rgba(239, 68, 68, 0.35);
}
.kontrol-card-red .card-title-text {
  font-size: 0.76rem;
  font-weight: 800;
  color: #dc2626;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.kontrol-card-red .card-num-text {
  font-size: 1.6rem;
  font-weight: 900;
  color: #991b1b;
  line-height: 1.2;
  margin-top: 2px;
}

/* Card 2: Besok (Amber) */
.kontrol-card-amber {
  background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
  border: 1.5px solid #fbbf24;
  box-shadow: 0 4px 14px rgba(245, 158, 11, 0.12);
}
.kontrol-card-amber .card-icon-wrap {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: #f59e0b;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
  flex-shrink: 0;
  box-shadow: 0 2px 10px rgba(245, 158, 11, 0.35);
}
.kontrol-card-amber .card-title-text {
  font-size: 0.76rem;
  font-weight: 800;
  color: #d97706;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.kontrol-card-amber .card-num-text {
  font-size: 1.6rem;
  font-weight: 900;
  color: #b45309;
  line-height: 1.2;
  margin-top: 2px;
}

/* Card 3: Mendatang (Blue) */
.kontrol-card-blue {
  background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
  border: 1.5px solid #38bdf8;
  box-shadow: 0 4px 14px rgba(2, 132, 199, 0.12);
}
.kontrol-card-blue .card-icon-wrap {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: #0284c7;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
  flex-shrink: 0;
  box-shadow: 0 2px 10px rgba(2, 132, 199, 0.35);
}
.kontrol-card-blue .card-title-text {
  font-size: 0.76rem;
  font-weight: 800;
  color: #0284c7;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.kontrol-card-blue .card-num-text {
  font-size: 1.6rem;
  font-weight: 900;
  color: #0369a1;
  line-height: 1.2;
  margin-top: 2px;
}

/* Dark Theme Adjustments for Summary Cards */
[data-theme="dark"] .kontrol-card-red {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.18), rgba(24, 15, 20, 0.85));
  border-color: rgba(239, 68, 68, 0.5);
  box-shadow: 0 4px 14px rgba(239, 68, 68, 0.2);
}
[data-theme="dark"] .kontrol-card-red .card-title-text { color: #f87171; }
[data-theme="dark"] .kontrol-card-red .card-num-text { color: #ffffff; }

[data-theme="dark"] .kontrol-card-amber {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.18), rgba(26, 20, 15, 0.85));
  border-color: rgba(245, 158, 11, 0.5);
  box-shadow: 0 4px 14px rgba(245, 158, 11, 0.2);
}
[data-theme="dark"] .kontrol-card-amber .card-title-text { color: #fbbf24; }
[data-theme="dark"] .kontrol-card-amber .card-num-text { color: #ffffff; }

[data-theme="dark"] .kontrol-card-blue {
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.18), rgba(15, 23, 42, 0.85));
  border-color: rgba(56, 189, 248, 0.5);
  box-shadow: 0 4px 14px rgba(56, 189, 248, 0.2);
}
[data-theme="dark"] .kontrol-card-blue .card-title-text { color: #38bdf8; }
[data-theme="dark"] .kontrol-card-blue .card-num-text { color: #ffffff; }

/* ============================================================
   WHATSAPP WEB CHAT DASHBOARD THEME & CONTRAST
   ============================================================ */
#wa-messages-feed {
  background-color: #efeae2 !important;
  background-image: radial-gradient(rgba(0,0,0,0.06) 1px, transparent 0) !important;
  background-size: 20px 20px !important;
}

[data-theme="dark"] #wa-messages-feed {
  background-color: #0b141a !important;
  background-image: radial-gradient(rgba(255,255,255,0.05) 1px, transparent 0) !important;
  background-size: 20px 20px !important;
}

/* Chat bubble styling for staff (outgoing) & patient (incoming) */
.wa-bubble-staff {
  background: #d9fdd3 !important;
  color: #111b21 !important;
  border: 1px solid #bbf7d0 !important;
  box-shadow: 0 1px 2px rgba(0,0,0,0.1) !important;
}
.wa-bubble-staff .bubble-time {
  color: #54656f !important;
}
.wa-bubble-patient {
  background: #ffffff !important;
  color: #111b21 !important;
  border: 1px solid #e2e8f0 !important;
  box-shadow: 0 1px 2px rgba(0,0,0,0.1) !important;
}
.wa-bubble-patient .bubble-time {
  color: #64748b !important;
}

[data-theme="dark"] .wa-bubble-staff {
  background: #005c4b !important;
  color: #e9edef !important;
  border: 1px solid rgba(52,211,153,0.3) !important;
  box-shadow: 0 2px 6px rgba(0,0,0,0.3) !important;
}
[data-theme="dark"] .wa-bubble-staff .bubble-time {
  color: #8696a0 !important;
}
[data-theme="dark"] .wa-bubble-patient {
  background: #202c33 !important;
  color: #e9edef !important;
  border: 1px solid rgba(255,255,255,0.08) !important;
  box-shadow: 0 2px 6px rgba(0,0,0,0.3) !important;
}
[data-theme="dark"] .wa-bubble-patient .bubble-time {
  color: #8696a0 !important;
}



