/* ==========================================================
   مستشفى السعودي الألماني بمكة المكرمة — نظام مراقبة العدوى
   هوية بصرية مستوحاة من شعار المستشفى (أزرق #0091E0 / أخضر #06A71B)
   ========================================================== */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

:root {
  /* --- ألوان الشعار الرسمية --- */
  --sgh-blue: #0091E0;
  --sgh-blue-dark: #0077b9;
  --sgh-blue-light: #54bcef;
  --sgh-green: #06A71B;
  --sgh-green-dark: #048214;
  --sgh-green-light: #3ecb50;
  --sgh-gradient: linear-gradient(135deg, #0091E0 0%, #06A71B 100%);
  --sgh-gradient-soft: linear-gradient(135deg, rgba(0,145,224,.16) 0%, rgba(6,167,27,.16) 100%);

  --bg-primary: #04121c;
  --bg-secondary: #071a27;
  --bg-card: #0c2434;
  --bg-hover: #12354a;
  --border: #17415a;
  --text-primary: #eaf6fd;
  --text-secondary: #8fb3c7;
  --accent: #0091E0;
  --accent-hover: #0077b9;
  --success: #06A71B;
  --warning: #f59e0b;
  --danger: #ef4444;
  --info: #22a5e7;
}

[data-theme="light"] {
  --bg-primary: #f2f8fc;
  --bg-secondary: #ffffff;
  --bg-card: #ffffff;
  --bg-hover: #e7f4fb;
  --border: #cfe6f4;
  --text-primary: #062032;
  --text-secondary: #4b6f85;
  --accent: #0091E0;
  --accent-hover: #0077b9;
  --success: #06A71B;
}

body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: 'Tajawal', system-ui, sans-serif;
  transition: background-color 0.3s, color 0.3s;
}

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

/* Sidebar */
.sidebar {
  background: var(--bg-secondary);
  border-left: 1px solid var(--border);
  min-height: 100vh;
}
.sidebar-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 10px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s;
  font-weight: 500;
}
.sidebar-link:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}
.sidebar-link.active {
  background: linear-gradient(135deg, #0091E0, #0077b9);
  color: white;
  box-shadow: 0 4px 12px rgba(0, 145, 224, 0.3);
}
.sidebar-link i { width: 20px; text-align: center; }

/* Cards */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
  transition: all 0.3s;
}
.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.2);
}

/* Stat Card */
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
  position: relative;
  overflow: hidden;
}
.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--info));
}
.stat-card.danger::before { background: linear-gradient(90deg, #ef4444, #f97316); }
.stat-card.warning::before { background: linear-gradient(90deg, #f59e0b, #eab308); }
.stat-card.success::before { background: linear-gradient(90deg, #06A71B, #06A71B); }
.stat-card.info::before { background: linear-gradient(90deg, #0091E0, #0091E0); }

/* Inputs */
.input, .select, textarea {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 14px;
  color: var(--text-primary);
  width: 100%;
  font-family: inherit;
  font-size: 14px;
  transition: all 0.2s;
}
.input:focus, .select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0, 145, 224, 0.15);
}
[data-theme="light"] .input, [data-theme="light"] .select, [data-theme="light"] textarea {
  background: #fff;
}

label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text-secondary);
}

/* Buttons */
.btn {
  padding: 10px 18px;
  border-radius: 10px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-family: inherit;
}
.btn-primary {
  background: linear-gradient(135deg, #0091E0, #0077b9);
  color: white;
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(0,145,224,0.4); }
.btn-secondary {
  background: var(--bg-hover);
  color: var(--text-primary);
}
.btn-secondary:hover { opacity: 0.85; }
.btn-success { background: linear-gradient(135deg, #06A71B, #048214); color: white; }
.btn-success:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(6,167,27,0.4); }
.btn-danger { background: #ef4444; color: white; }
.btn-danger:hover { background: #dc2626; }
.btn-outline {
  background: transparent;
  color: var(--text-primary);
  border: 1px solid var(--border);
}
.btn-outline:hover { background: var(--bg-hover); }

/* Tables */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.data-table thead {
  background: var(--bg-secondary);
}
.data-table th {
  padding: 12px;
  text-align: right;
  font-weight: 700;
  color: var(--text-primary);
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.data-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  color: var(--text-primary);
}
.data-table tbody tr:hover { background: var(--bg-hover); }
.data-table .actions { white-space: nowrap; }

.table-wrap {
  overflow-x: auto;
  border-radius: 12px;
  border: 1px solid var(--border);
}

/* Badges */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
}
.badge-success { background: rgba(6,167,27,0.15); color: #06A71B; }
.badge-danger { background: rgba(239,68,68,0.15); color: #ef4444; }
.badge-warning { background: rgba(245,158,11,0.15); color: #f59e0b; }
.badge-info { background: rgba(0,145,224,0.15); color: #0091E0; }
.badge-secondary { background: rgba(148,163,184,0.15); color: var(--text-secondary); }

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: fadeIn 0.2s;
}
.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  width: 100%;
  max-width: 1000px;
  max-height: 90vh;
  overflow-y: auto;
  animation: slideUp 0.3s;
}
.modal-sm { max-width: 600px; }
.modal-header {
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  background: var(--bg-card);
  z-index: 10;
}
.modal-body { padding: 24px; }
.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 10px;
  justify-content: flex-start;
  position: sticky;
  bottom: 0;
  background: var(--bg-card);
}

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

/* Form grid */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}
.form-grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.form-grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 768px) {
  .form-grid, .form-grid.cols-3, .form-grid.cols-4 { grid-template-columns: 1fr; }
}

.section-title {
  font-size: 14px;
  font-weight: 700;
  margin: 16px 0 12px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--accent);
  color: var(--accent);
}

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 24px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.3);
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: slideUp 0.3s;
}
.toast.success { border-color: #06A71B; }
.toast.error { border-color: #ef4444; }

/* Loader */
.spinner {
  border: 3px solid rgba(255,255,255,0.1);
  border-top-color: var(--accent);
  border-radius: 50%;
  width: 32px;
  height: 32px;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Header */
.app-header {
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  padding: 12px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 30;
}
.logo {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 800;
  font-size: 18px;
}
.logo-icon {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, #0091E0, #0077b9);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 20px;
}

/* Theme toggle */
.theme-toggle {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-primary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}
.theme-toggle:hover { background: var(--bg-hover); }

/* Filters bar */
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: end;
  margin-bottom: 16px;
}
.filters > div { min-width: 160px; flex: 1; }

/* Layout */
.layout {
  display: grid;
  grid-template-columns: 250px 1fr;
  min-height: 100vh;
  width: 100%;
  max-width: 100vw;
  overflow-x: hidden;
}
@media (max-width: 1024px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { display: none; position: fixed; z-index: 40; width: 250px; right: 0; }
  .sidebar.show { display: block; }
}

.main-content {
  padding: 24px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}
.page-title {
  font-size: 24px;
  font-weight: 800;
  margin-bottom: 4px;
}
.page-subtitle {
  color: var(--text-secondary);
  margin-bottom: 24px;
  font-size: 14px;
}

/* Charts container */
.charts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

/* Chart container - CRITICAL: must have a fixed height so Chart.js with
   maintainAspectRatio:false doesn't grow infinitely and freeze the page */
.chart-container {
  position: relative;
  width: 100%;
  height: 300px;          /* fixed height */
  max-height: 300px;
  overflow: hidden;
}
.chart-container canvas {
  max-width: 100%;
  max-height: 100%;
  display: block;
}

/* Make sure cards inside charts-grid don't grow vertically beyond their content */
.charts-grid .card {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

/* Risk indicators */
.risk-icon {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-left: 6px;
}
.risk-icon.danger { background: #ef4444; box-shadow: 0 0 8px #ef4444; animation: pulse 2s infinite; }
.risk-icon.warning { background: #f59e0b; }
.risk-icon.safe { background: #06A71B; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.5; } }

/* Tabs */
.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
  overflow-x: auto;
}
.tab {
  padding: 10px 18px;
  cursor: pointer;
  color: var(--text-secondary);
  font-weight: 600;
  border-bottom: 3px solid transparent;
  white-space: nowrap;
  transition: all 0.2s;
}
.tab:hover { color: var(--text-primary); }
.tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* Empty state */
.empty {
  text-align: center;
  padding: 48px 16px;
  color: var(--text-secondary);
}
.empty i { font-size: 48px; margin-bottom: 12px; opacity: 0.5; }

/* Print */
@media print {
  .sidebar, .app-header, .btn, .filters { display: none !important; }
  .main-content { padding: 0; }
  .card { break-inside: avoid; }
}

/* Scrollbar */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg-secondary); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 5px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-secondary); }

/* =========================================================
   3D CONTROL CENTER
   ========================================================= */
.control-center-wrap {
  position: relative;
  width: 100%;
  height: calc(100vh - 180px);
  min-height: 560px;
  background: radial-gradient(ellipse at center, #0a1929 0%, #050a14 100%);
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid var(--border);
  margin-bottom: 24px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.4);
}
[data-theme="light"] .control-center-wrap {
  background: radial-gradient(ellipse at center, #e0f2fe 0%, #e6f5fd 100%);
}

#control-center-canvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: grab;
}
#control-center-canvas:active { cursor: grabbing; }

.cc-overlay-top {
  position: absolute;
  top: 16px;
  left: 16px;
  right: 16px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  z-index: 10;
  pointer-events: none;
}

.cc-title-box {
  background: rgba(2, 8, 23, 0.7);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(0, 145, 224, 0.3);
  padding: 12px 18px;
  border-radius: 12px;
  pointer-events: auto;
  color: #f1f5f9;
}
.cc-title-box .cc-title {
  font-size: 16px;
  font-weight: 800;
  margin-bottom: 4px;
  color: #54bcef;
}
.cc-title-box .cc-subtitle {
  font-size: 12px;
  color: #94a3b8;
}

.cc-legend {
  background: rgba(2, 8, 23, 0.7);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(0, 145, 224, 0.3);
  padding: 10px 14px;
  border-radius: 12px;
  pointer-events: auto;
  color: #f1f5f9;
  font-size: 12px;
  display: flex;
  gap: 14px;
  align-items: center;
}
.cc-legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
}
.cc-legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  animation: pulse-glow 2s ease-in-out infinite;
}
.cc-legend-dot.safe { background: #06A71B; box-shadow: 0 0 8px #06A71B; }
.cc-legend-dot.warning { background: #f59e0b; box-shadow: 0 0 8px #f59e0b; }
.cc-legend-dot.outbreak { 
  background: #ef4444; 
  box-shadow: 0 0 12px #ef4444;
  animation: pulse-danger 0.8s ease-in-out infinite;
}

/* ===== Filter box (region + search) ===== */
.cc-filter-box {
  background: rgba(2, 8, 23, 0.7);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(0, 145, 224, 0.3);
  padding: 8px 12px;
  border-radius: 12px;
  pointer-events: auto;
  display: flex;
  gap: 8px;
  align-items: center;
  flex: 1;
  max-width: 480px;
}
.cc-filter-select,
.cc-filter-input {
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(0, 145, 224, 0.4);
  color: #f1f5f9;
  padding: 7px 11px;
  border-radius: 8px;
  font-size: 13px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.cc-filter-select {
  min-width: 180px;
  cursor: pointer;
}
.cc-filter-input {
  flex: 1;
  min-width: 0;
}
.cc-filter-select:focus,
.cc-filter-input:focus {
  border-color: #54bcef;
  box-shadow: 0 0 0 2px rgba(96, 165, 250, 0.3);
}
.cc-filter-select option {
  background: #0f172a;
  color: #f1f5f9;
}

/* ===== Summary header counter ===== */
.cc-summary-header {
  margin: 16px 0 12px;
  padding: 10px 14px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  font-weight: 700;
  font-size: 14px;
  color: var(--text-primary);
}

/* Responsive: on small screens stack the overlay vertically */
@media (max-width: 900px) {
  .cc-overlay-top {
    flex-direction: column;
  }
  .cc-filter-box {
    max-width: 100%;
    width: 100%;
  }
}

@keyframes pulse-glow {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.6; transform: scale(1.2); }
}
@keyframes pulse-danger {
  0%, 100% { opacity: 1; transform: scale(1); box-shadow: 0 0 12px #ef4444; }
  50% { opacity: 0.7; transform: scale(1.3); box-shadow: 0 0 24px #ef4444, 0 0 40px #dc2626; }
}

.cc-overlay-bottom {
  position: absolute;
  bottom: 16px;
  left: 16px;
  right: 16px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  z-index: 10;
  pointer-events: none;
}

.cc-stats-row {
  display: flex;
  gap: 10px;
  pointer-events: auto;
  flex-wrap: wrap;
}
.cc-stat-pill {
  background: rgba(2, 8, 23, 0.7);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(0, 145, 224, 0.3);
  padding: 10px 16px;
  border-radius: 12px;
  color: #f1f5f9;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 130px;
}
.cc-stat-pill.outbreak { border-color: rgba(239, 68, 68, 0.6); background: rgba(127, 29, 29, 0.6); }
.cc-stat-pill.warning { border-color: rgba(245, 158, 11, 0.5); background: rgba(120, 53, 15, 0.5); }
.cc-stat-pill.safe { border-color: rgba(6, 167, 27, 0.5); background: rgba(6, 78, 59, 0.5); }

.cc-stat-pill .num {
  font-size: 22px;
  font-weight: 800;
}
.cc-stat-pill .lbl {
  font-size: 11px;
  color: #94a3b8;
}

.cc-controls {
  display: flex;
  gap: 8px;
  pointer-events: auto;
}
.cc-btn {
  background: rgba(2, 8, 23, 0.7);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(0, 145, 224, 0.3);
  color: #f1f5f9;
  padding: 8px 14px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 6px;
}
.cc-btn:hover {
  background: rgba(0, 145, 224, 0.3);
  border-color: rgba(0, 145, 224, 0.7);
}

/* Tooltip for hovering hospital tower */
.cc-tooltip {
  position: absolute;
  background: rgba(2, 8, 23, 0.95);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(0, 145, 224, 0.5);
  padding: 10px 14px;
  border-radius: 10px;
  color: #f1f5f9;
  font-size: 13px;
  pointer-events: none;
  z-index: 20;
  min-width: 180px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
  transition: opacity 0.15s;
  opacity: 0;
}
.cc-tooltip.visible { opacity: 1; }
.cc-tooltip .tt-name { font-weight: 800; font-size: 14px; margin-bottom: 4px; }
.cc-tooltip .tt-status { font-size: 11px; padding: 2px 8px; border-radius: 6px; display: inline-block; margin-bottom: 6px; }
.cc-tooltip .tt-status.safe { background: #064e3b; color: #7fdd8c; }
.cc-tooltip .tt-status.warning { background: #78350f; color: #fbbf24; }
.cc-tooltip .tt-status.outbreak { background: #7f1d1d; color: #fca5a5; }
.cc-tooltip .tt-stat { font-size: 11px; color: #94a3b8; display: flex; justify-content: space-between; }
.cc-tooltip .tt-stat span:last-child { color: #f1f5f9; font-weight: 700; }

/* =========================================================
   EMERGENCY MODE (Outbreak)
   ========================================================= */
[data-emergency="true"] {
  --bg-primary: #0a0000 !important;
  --bg-secondary: #150404 !important;
  --bg-card: #1a0a0a !important;
  --bg-hover: #2a0f0f !important;
  --border: rgba(239, 68, 68, 0.3) !important;
  --text-primary: #fef2f2 !important;
  --text-secondary: #fca5a5 !important;
  --accent: #ef4444 !important;
  --accent-hover: #dc2626 !important;
}
[data-emergency="true"] body {
  background: linear-gradient(135deg, #0a0000 0%, #1a0000 100%);
}
[data-emergency="true"] .app-header {
  background: linear-gradient(90deg, rgba(127, 29, 29, 0.8), rgba(0, 0, 0, 0.9));
  border-bottom: 2px solid #ef4444;
  box-shadow: 0 0 30px rgba(239, 68, 68, 0.5);
}
[data-emergency="true"] .logo-icon {
  background: linear-gradient(135deg, #ef4444, #f97316);
  animation: emergency-pulse 1s ease-in-out infinite;
}
@keyframes emergency-pulse {
  0%, 100% { box-shadow: 0 0 20px #ef4444; }
  50% { box-shadow: 0 0 40px #ef4444, 0 0 60px #f97316; }
}

[data-emergency="true"] .sidebar {
  background: linear-gradient(180deg, #0a0000, #1a0000);
  border-left: 1px solid rgba(239, 68, 68, 0.3);
}

[data-emergency="true"] .sidebar-link {
  color: #fca5a5;
}
[data-emergency="true"] .sidebar-link:hover,
[data-emergency="true"] .sidebar-link.active {
  background: rgba(239, 68, 68, 0.15);
  color: #fef2f2;
  border-right: 3px solid #ef4444;
}

/* Emergency banner */
.emergency-banner {
  background: linear-gradient(90deg, #7f1d1d, #b91c1c, #7f1d1d);
  background-size: 200% 100%;
  animation: emergency-banner-anim 3s linear infinite;
  color: #fff;
  padding: 14px 24px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  font-weight: 700;
  box-shadow: 0 0 30px rgba(239, 68, 68, 0.5);
  border: 2px solid #ef4444;
}
@keyframes emergency-banner-anim {
  0% { background-position: 0% 0%; }
  100% { background-position: 200% 0%; }
}
.emergency-banner i { font-size: 22px; animation: shake 0.5s ease-in-out infinite; }
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-3px); }
  75% { transform: translateX(3px); }
}

.emergency-banner-actions {
  display: flex;
  gap: 8px;
}
.emergency-banner button {
  background: rgba(0,0,0,0.4);
  border: 1px solid rgba(255,255,255,0.3);
  color: #fff;
  padding: 8px 14px;
  border-radius: 8px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
}
.emergency-banner button:hover { background: rgba(0,0,0,0.7); }

/* Emergency Focus Cards (only 3 key metrics during outbreak) */
.emergency-focus {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  margin-bottom: 24px;
}
.emergency-card {
  background: linear-gradient(135deg, rgba(127, 29, 29, 0.4), rgba(0, 0, 0, 0.8));
  border: 2px solid #ef4444;
  border-radius: 16px;
  padding: 24px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 0 30px rgba(239, 68, 68, 0.3);
}
.emergency-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, transparent, #ef4444, #f97316, #ef4444, transparent);
  background-size: 200% 100%;
  animation: emergency-banner-anim 2s linear infinite;
}
.emergency-card .ec-icon {
  font-size: 36px;
  color: #ef4444;
  margin-bottom: 12px;
  text-shadow: 0 0 20px #ef4444;
}
.emergency-card .ec-value {
  font-size: 48px;
  font-weight: 900;
  color: #fef2f2;
  text-shadow: 0 0 20px rgba(239, 68, 68, 0.7);
  line-height: 1;
}
.emergency-card .ec-label {
  font-size: 14px;
  color: #fca5a5;
  margin-top: 8px;
  font-weight: 600;
}
.emergency-card .ec-action {
  margin-top: 16px;
  width: 100%;
  padding: 12px;
  background: #ef4444;
  border: none;
  border-radius: 10px;
  color: #fff;
  font-weight: 800;
  font-size: 14px;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  transition: all 0.2s;
}
.emergency-card .ec-action:hover {
  background: #dc2626;
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(239, 68, 68, 0.5);
}
.emergency-card .ec-action.call {
  background: #f97316;
  animation: btn-pulse 1.5s ease-in-out infinite;
}
@keyframes btn-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(249, 115, 22, 0.7); }
  50% { box-shadow: 0 0 0 10px rgba(249, 115, 22, 0); }
}

/* Outbreak hospital list in emergency mode */
.outbreak-list {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 16px;
}
.outbreak-list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px;
  border-bottom: 1px solid rgba(239, 68, 68, 0.2);
}
.outbreak-list-item:last-child { border-bottom: none; }
.outbreak-list-item .ol-name { font-weight: 700; color: #fef2f2; }
.outbreak-list-item .ol-reason { font-size: 12px; color: #fca5a5; }
.outbreak-list-item .ol-badge {
  background: #ef4444;
  color: #fff;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
}

/* Hospital quick modal (from 3D click) */
.cc-quick-modal {
  position: fixed;
  inset: 0;
  background: rgba(2, 8, 23, 0.85);
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.cc-quick-modal-content {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  max-width: 600px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 30px 80px rgba(0,0,0,0.6);
}
.cc-qm-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.cc-qm-header.outbreak {
  background: linear-gradient(90deg, rgba(127, 29, 29, 0.3), transparent);
  border-bottom-color: #ef4444;
}
.cc-qm-header.warning {
  background: linear-gradient(90deg, rgba(120, 53, 15, 0.3), transparent);
  border-bottom-color: #f59e0b;
}
.cc-qm-header.safe {
  background: linear-gradient(90deg, rgba(6, 78, 59, 0.3), transparent);
  border-bottom-color: #06A71B;
}
.cc-qm-body { padding: 20px 24px; }
.cc-qm-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.cc-qm-stat {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  padding: 12px;
  border-radius: 10px;
  text-align: center;
}
.cc-qm-stat .num {
  font-size: 26px;
  font-weight: 800;
  color: var(--text-primary);
}
.cc-qm-stat .lbl {
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 4px;
}
.cc-qm-actions {
  display: flex;
  gap: 8px;
  margin-top: 16px;
  flex-wrap: wrap;
}

/* Test mode trigger button */
.test-outbreak-btn {
  position: fixed;
  bottom: 16px;
  left: 16px;
  z-index: 100;
  background: rgba(239, 68, 68, 0.8);
  border: 1px solid #ef4444;
  color: #fff;
  padding: 8px 14px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 6px;
  opacity: 0.7;
  transition: all 0.2s;
}
.test-outbreak-btn:hover { opacity: 1; }

/* ===========================================
   🧬 LAB INTEGRATION UI
   =========================================== */

.lab-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.lab-stat-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  transition: transform 0.2s, box-shadow 0.2s;
}
.lab-stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.15);
}
.lab-stat-card.highlight {
  background: linear-gradient(135deg, rgba(239,68,68,0.08), rgba(220,38,38,0.05));
  border-color: rgba(239,68,68,0.4);
  animation: lab-pulse 2.5s ease-in-out infinite;
}
@keyframes lab-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239,68,68,0.4); }
  50% { box-shadow: 0 0 0 8px rgba(239,68,68,0); }
}

.lab-stat-icon {
  font-size: 32px;
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,145,224,0.08);
  border-radius: 12px;
  flex-shrink: 0;
}

.lab-stat-body { flex: 1; min-width: 0; }
.lab-stat-value {
  font-size: 24px;
  font-weight: 800;
  line-height: 1.2;
}
.lab-stat-label {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.lab-toolbar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  padding: 12px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 10px;
}

.lab-filter-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
  user-select: none;
}
.lab-filter-toggle input { cursor: pointer; }

.lab-info-banner {
  background: linear-gradient(90deg, rgba(0,145,224,0.12), rgba(0,145,224,0.04));
  border: 1px solid rgba(0,145,224,0.3);
  color: #0091E0;
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
}

/* Highlight MDRO rows in table */
.data-table tr.row-mdro {
  background: rgba(239, 68, 68, 0.05);
  border-right: 3px solid #ef4444;
}
[data-theme="dark"] .data-table tr.row-mdro {
  background: rgba(239, 68, 68, 0.12);
}

/* Antibiogram input rows */
.ast-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 280px;
  overflow-y: auto;
  padding: 10px;
  background: var(--bg-tertiary, rgba(0,0,0,0.03));
  border: 1px dashed var(--border-color);
  border-radius: 8px;
}
.ast-row {
  display: grid;
  grid-template-columns: 1fr 140px 50px;
  gap: 8px;
  align-items: center;
}

/* MDRO Alert Modal */
.mdro-alert-modal {
  border: 2px solid #ef4444;
  box-shadow: 0 0 60px rgba(239,68,68,0.4);
}
.mdro-alert-header {
  background: linear-gradient(135deg, #dc2626, #ef4444);
  color: white;
  padding: 20px 24px;
  border-radius: 10px 10px 0 0;
  display: flex;
  align-items: center;
  gap: 16px;
}
.mdro-alert-header i {
  font-size: 40px;
  animation: shake 0.6s ease-in-out infinite alternate;
}
@keyframes shake {
  from { transform: rotate(-8deg); }
  to { transform: rotate(8deg); }
}
.mdro-alert-title {
  font-size: 22px;
  font-weight: 800;
}
.mdro-alert-subtitle {
  font-size: 14px;
  opacity: 0.95;
}

.mdro-info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 12px;
  background: var(--bg-secondary);
  border-radius: 8px;
  font-size: 14px;
}

.mdro-reasons {
  background: rgba(239,68,68,0.08);
  border-right: 3px solid #ef4444;
  padding: 12px 16px;
  border-radius: 6px;
  list-style: none;
}
.mdro-reasons li {
  padding: 6px 0;
  border-bottom: 1px dashed rgba(239,68,68,0.2);
}
.mdro-reasons li:last-child { border-bottom: none; }
.mdro-reasons li::before {
  content: '🔬';
  margin-left: 8px;
}

.mdro-alert-banner {
  background: linear-gradient(90deg, rgba(239,68,68,0.15), rgba(239,68,68,0.05));
  border: 1px solid #ef4444;
  color: #ef4444;
  padding: 12px 16px;
  border-radius: 8px;
  font-weight: 700;
  margin-bottom: 12px;
}

.lab-details-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 12px;
  background: var(--bg-secondary);
  border-radius: 8px;
  font-size: 14px;
}

/* Demo samples grid */
.demo-samples {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.demo-sample-btn {
  text-align: right;
  padding: 14px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
  color: var(--text-primary);
}
.demo-sample-btn:hover {
  border-color: #0091E0;
  background: rgba(0,145,224,0.05);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,145,224,0.15);
}

@media (max-width: 700px) {
  .lab-details-grid,
  .mdro-info-grid,
  .demo-samples {
    grid-template-columns: 1fr;
  }
  .ast-row {
    grid-template-columns: 1fr 110px 44px;
  }
}

/* Aliases for lab.js modal classes */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.7); z-index: 50;
  display: flex; align-items: center; justify-content: center;
  padding: 16px; animation: fadeIn 0.2s;
}
.modal-content {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  width: 100%; max-width: 1000px;
  max-height: 90vh; overflow-y: auto;
  animation: slideUp 0.3s;
}
.modal-close {
  background: transparent;
  border: none;
  font-size: 28px;
  cursor: pointer;
  color: var(--text-secondary);
  line-height: 1;
  padding: 0 8px;
  transition: color 0.2s;
}
.modal-close:hover { color: var(--text-primary); }

.lbl {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 4px;
  color: var(--text-secondary);
}

/* ============================================================ */
/* 🤖 AI Assistant & Prediction Page                          */
/* ============================================================ */

/* Header */
.ai-header {
  background: linear-gradient(135deg, rgba(0,145,224,0.15), rgba(34,165,231,0.15), rgba(236,72,153,0.1));
  border: 1px solid rgba(34,165,231,0.3);
  border-radius: 16px;
  padding: 24px;
  margin-bottom: 24px;
  position: relative;
  overflow: hidden;
}
.ai-header::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at top right, rgba(34,165,231,0.2), transparent 60%);
  pointer-events: none;
}
.ai-header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  position: relative;
}
.ai-title-wrap { display: flex; align-items: center; gap: 16px; }
.ai-icon-glow {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0091E0, #22a5e7, #0077b9);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  color: white;
  box-shadow: 0 0 30px rgba(34,165,231,0.6);
  animation: ai-pulse-glow 2.5s ease-in-out infinite;
}
@keyframes ai-pulse-glow {
  0%, 100% { box-shadow: 0 0 30px rgba(34,165,231,0.6); transform: scale(1); }
  50% { box-shadow: 0 0 50px rgba(34,165,231,0.9); transform: scale(1.05); }
}
.ai-title { font-size: 24px; font-weight: 800; color: #fff; margin: 0; }
.ai-subtitle { color: #8fd4f5; margin: 4px 0 0; font-size: 13px; }

.ai-badges { display: flex; gap: 10px; flex-wrap: wrap; }
.ai-badge {
  background: rgba(15,23,42,0.6);
  border: 1px solid rgba(34,165,231,0.4);
  color: #8fd4f5;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 6px;
}
.ai-badge-live { color: #06A71B; border-color: #06A71B; }
.ai-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: #06A71B;
  animation: blink 1.5s infinite;
}
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }

/* Tabs */
.ai-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 20px;
  border-bottom: 2px solid rgba(34,165,231,0.2);
  padding-bottom: 4px;
  flex-wrap: wrap;
}
.ai-tab {
  background: transparent;
  color: #94a3b8;
  border: none;
  padding: 12px 20px;
  cursor: pointer;
  font-weight: 700;
  font-size: 13px;
  border-radius: 8px 8px 0 0;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
}
.ai-tab:hover { color: #8fd4f5; background: rgba(34,165,231,0.08); }
.ai-tab.active {
  color: #fff;
  background: linear-gradient(135deg, rgba(0,145,224,0.25), rgba(34,165,231,0.25));
  border-bottom-color: #22a5e7;
}

.ai-tab-content { min-height: 400px; }
.ai-loading { padding: 40px; text-align: center; color: #94a3b8; font-size: 16px; }
.ai-error { padding: 24px; background: rgba(239,68,68,0.1); border: 1px solid rgba(239,68,68,0.4); border-radius: 8px; color: #fca5a5; }
.ai-empty {
  padding: 60px 20px;
  text-align: center;
  color: #94a3b8;
}
.ai-empty i { font-size: 48px; margin-bottom: 16px; }
.ai-empty h3 { color: #fff; margin: 12px 0; }

.ai-section-title {
  font-size: 18px;
  font-weight: 800;
  color: #fff;
  margin: 24px 0 16px;
  display: flex;
  align-items: center;
}

/* Chat */
.ai-chat-wrap {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 16px;
  min-height: 600px;
  max-height: calc(100vh - 280px);
}
.ai-suggestions-bar {
  background: rgba(15,23,42,0.5);
  border: 1px solid rgba(34,165,231,0.2);
  border-radius: 12px;
  padding: 12px;
  overflow-y: auto;
}
.ai-suggestions-title {
  font-size: 12px;
  font-weight: 800;
  color: #8fd4f5;
  margin-bottom: 10px;
  text-transform: uppercase;
}
.ai-sugg-cat {
  font-size: 10px;
  font-weight: 800;
  color: #0091E0;
  margin: 12px 0 4px;
  text-transform: uppercase;
  padding-right: 4px;
}
.ai-sugg-btn {
  display: block;
  width: 100%;
  text-align: right;
  background: rgba(0,145,224,0.08);
  border: 1px solid rgba(0,145,224,0.2);
  color: #cbd5e1;
  padding: 8px 10px;
  border-radius: 8px;
  margin-bottom: 6px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 8px;
}
.ai-sugg-btn:hover {
  background: rgba(0,145,224,0.2);
  border-color: #0091E0;
  color: #fff;
  transform: translateX(-2px);
}
.ai-sugg-icon { font-size: 16px; flex-shrink: 0; }

.ai-chat-main {
  background: rgba(15,23,42,0.5);
  border: 1px solid rgba(34,165,231,0.2);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.ai-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.ai-msg {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  max-width: 85%;
  animation: ai-msg-in 0.3s ease-out;
}
@keyframes ai-msg-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.ai-msg-user { align-self: flex-end; flex-direction: row; }
.ai-msg-assistant { align-self: flex-start; }
.ai-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0091E0, #22a5e7);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  flex-shrink: 0;
  font-size: 14px;
}
.ai-msg-user .ai-avatar { background: linear-gradient(135deg, #0091E0, #0091E0); }

.ai-bubble {
  background: rgba(0,145,224,0.15);
  border: 1px solid rgba(0,145,224,0.3);
  padding: 12px 16px;
  border-radius: 14px;
  color: #e2e8f0;
  font-size: 14px;
  line-height: 1.7;
  word-wrap: break-word;
}
.ai-msg-user .ai-bubble {
  background: linear-gradient(135deg, rgba(0,145,224,0.2), rgba(0,145,224,0.2));
  border-color: rgba(0,145,224,0.4);
}
.ai-bubble h1, .ai-bubble h2, .ai-bubble h3 { color: #8fd4f5; margin: 8px 0 4px; font-weight: 800; }
.ai-bubble h1 { font-size: 18px; }
.ai-bubble h2 { font-size: 16px; }
.ai-bubble h3 { font-size: 14px; }
.ai-bubble p { margin: 4px 0; }
.ai-bubble ul, .ai-bubble ol { margin: 6px 0; padding-right: 20px; }
.ai-bubble li { margin: 2px 0; }
.ai-bubble code {
  background: rgba(15,23,42,0.7);
  padding: 2px 6px;
  border-radius: 4px;
  color: #f59e0b;
  font-size: 13px;
}
.ai-bubble pre {
  background: rgba(15,23,42,0.8);
  padding: 10px;
  border-radius: 8px;
  overflow-x: auto;
  margin: 6px 0;
}
.ai-bubble strong { color: #fff; font-weight: 700; }
.ai-bubble em { color: #94a3b8; }
.ai-bubble a { color: #0091E0; text-decoration: underline; }

.ai-typing { display: flex; gap: 4px; align-items: center; padding: 12px 18px; }
.ai-dot-anim {
  width: 8px; height: 8px;
  background: #8fd4f5;
  border-radius: 50%;
  animation: ai-typing-bounce 1.4s infinite;
}
.ai-dot-anim:nth-child(2) { animation-delay: 0.2s; }
.ai-dot-anim:nth-child(3) { animation-delay: 0.4s; }
@keyframes ai-typing-bounce { 0%, 80%, 100% { transform: translateY(0); opacity: 0.5; } 40% { transform: translateY(-6px); opacity: 1; } }

.ai-input-area {
  padding: 12px;
  border-top: 1px solid rgba(34,165,231,0.2);
  background: rgba(15,23,42,0.7);
}
.ai-input-form { display: flex; gap: 8px; }
.ai-input {
  flex: 1;
  background: rgba(15,23,42,0.8);
  border: 1px solid rgba(34,165,231,0.3);
  color: #fff;
  padding: 12px 16px;
  border-radius: 24px;
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: all 0.2s;
}
.ai-input:focus { border-color: #22a5e7; box-shadow: 0 0 0 3px rgba(34,165,231,0.2); }
.ai-input:disabled { opacity: 0.5; }
.ai-send-btn, .ai-clear-btn {
  width: 44px; height: 44px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 14px;
  transition: all 0.2s;
}
.ai-send-btn { background: linear-gradient(135deg, #0091E0, #22a5e7); }
.ai-send-btn:hover { transform: scale(1.05); box-shadow: 0 0 16px rgba(34,165,231,0.5); }
.ai-clear-btn { background: rgba(239,68,68,0.2); color: #ef4444; border: 1px solid rgba(239,68,68,0.4); }
.ai-clear-btn:hover { background: rgba(239,68,68,0.4); color: #fff; }

/* Insights */
.ai-overview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}
.ai-ov-card {
  background: rgba(15,23,42,0.6);
  border: 1px solid rgba(34,165,231,0.2);
  border-radius: 10px;
  padding: 14px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.ai-ov-icon { font-size: 28px; }
.ai-ov-value { font-size: 22px; font-weight: 800; color: #fff; }
.ai-ov-label { font-size: 11px; color: #94a3b8; }

.ai-insights-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}
.ai-insight {
  background: rgba(15,23,42,0.6);
  border: 1px solid rgba(34,165,231,0.2);
  border-radius: 12px;
  padding: 16px;
  border-right: 4px solid #0091E0;
  transition: transform 0.2s, box-shadow 0.2s;
}
.ai-insight:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(0,0,0,0.3); }
.ai-insight-positive { border-right-color: #06A71B; background: rgba(6,167,27,0.05); }
.ai-insight-warning { border-right-color: #f59e0b; background: rgba(245,158,11,0.05); }
.ai-insight-critical { border-right-color: #ef4444; background: rgba(239,68,68,0.08); }
.ai-insight-info { border-right-color: #0091E0; background: rgba(0,145,224,0.05); }

.ai-insight-header { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.ai-insight-icon { font-size: 24px; }
.ai-insight-title { font-weight: 800; color: #fff; font-size: 15px; }
.ai-insight-desc { color: #cbd5e1; font-size: 13px; line-height: 1.6; margin-bottom: 8px; }
.ai-insight-action {
  background: rgba(34,165,231,0.1);
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 12px;
  color: #8fd4f5;
  font-weight: 600;
}

/* Risk Predictions */
.ai-risk-summary, .ai-anomaly-summary {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
  margin-bottom: 24px;
}
.ai-risk-summary-card, .ai-anom-summary-card {
  background: rgba(15,23,42,0.6);
  border: 2px solid;
  border-radius: 10px;
  padding: 14px;
  text-align: center;
}
.ai-rs-icon { font-size: 24px; margin-bottom: 4px; }
.ai-rs-value { font-size: 26px; font-weight: 800; line-height: 1; }
.ai-rs-label { font-size: 11px; color: #94a3b8; margin-top: 4px; }

.ai-risk-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 14px;
}
.ai-risk-card {
  background: rgba(15,23,42,0.6);
  border: 1px solid rgba(34,165,231,0.15);
  border-radius: 12px;
  padding: 16px;
  transition: transform 0.2s;
}
.ai-risk-card:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(0,0,0,0.3); }

.ai-risk-card-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 10px; }
.ai-risk-hospital { font-weight: 800; color: #fff; font-size: 14px; }
.ai-risk-region { font-size: 11px; color: #94a3b8; }
.ai-risk-score-wrap { text-align: center; min-width: 70px; }
.ai-risk-score { font-size: 32px; font-weight: 900; line-height: 1; }
.ai-risk-score-label { font-size: 10px; color: #94a3b8; }

.ai-risk-bar-wrap {
  height: 8px;
  background: rgba(15,23,42,0.8);
  border-radius: 4px;
  overflow: hidden;
  margin: 8px 0;
}
.ai-risk-bar-fill { height: 100%; border-radius: 4px; transition: width 0.6s ease-out; }

.ai-risk-meta { display: flex; gap: 6px; flex-wrap: wrap; margin: 10px 0; align-items: center; }
.ai-risk-badge { padding: 4px 10px; border-radius: 12px; font-size: 11px; font-weight: 800; }
.ai-risk-prob { font-size: 12px; color: #cbd5e1; }
.ai-risk-outbreak {
  background: rgba(220,38,38,0.2);
  color: #fca5a5;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 800;
  border: 1px solid rgba(220,38,38,0.4);
  animation: pulse 1.5s infinite;
}

.ai-risk-warnings {
  background: rgba(239,68,68,0.08);
  border: 1px solid rgba(239,68,68,0.25);
  border-radius: 8px;
  padding: 10px;
  margin: 10px 0;
}
.ai-risk-warn-title { font-size: 12px; font-weight: 700; color: #fca5a5; margin-bottom: 6px; }
.ai-risk-warn-item { font-size: 12px; color: #fecaca; padding: 3px 0; }

.ai-risk-factors {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
  margin: 10px 0;
}
.ai-factor {
  background: rgba(15,23,42,0.4);
  border-radius: 6px;
  padding: 6px 10px;
  display: flex;
  justify-content: space-between;
  font-size: 11px;
}
.ai-factor-name { color: #94a3b8; }
.ai-factor-value { font-weight: 700; }

.ai-risk-recs-btn {
  background: rgba(0,145,224,0.15);
  border: 1px solid rgba(0,145,224,0.3);
  color: #8fd4f5;
  padding: 8px 12px;
  border-radius: 8px;
  font-weight: 700;
  cursor: pointer;
  width: 100%;
  font-size: 12px;
  margin-top: 8px;
  transition: all 0.2s;
}
.ai-risk-recs-btn:hover { background: rgba(0,145,224,0.25); }
.ai-risk-recs {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease-out;
  margin-top: 4px;
}
.ai-risk-recs.open { max-height: 500px; padding: 8px 0; }
.ai-risk-rec-item {
  background: rgba(15,23,42,0.6);
  padding: 8px 12px;
  border-radius: 6px;
  margin: 4px 0;
  font-size: 12px;
  color: #cbd5e1;
  line-height: 1.5;
  border-right: 2px solid #22a5e7;
}

.ai-risk-actions { display: flex; gap: 8px; margin-top: 10px; }
.ai-btn {
  background: rgba(0,145,224,0.15);
  border: 1px solid rgba(0,145,224,0.3);
  color: #8fd4f5;
  padding: 8px 14px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  transition: all 0.2s;
}
.ai-btn:hover { background: rgba(0,145,224,0.3); color: #fff; }
.ai-btn-secondary { background: rgba(0,145,224,0.15); border-color: rgba(0,145,224,0.3); color: #8fd4f5; }
.ai-btn-secondary:hover { background: rgba(0,145,224,0.3); }

/* Anomalies */
.ai-anomaly-list { display: flex; flex-direction: column; gap: 12px; }
.ai-anomaly-card {
  background: rgba(15,23,42,0.6);
  border: 1px solid rgba(34,165,231,0.2);
  border-radius: 12px;
  padding: 14px;
}
.ai-anom-header { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.ai-anom-icon { font-size: 28px; }
.ai-anom-titles { flex: 1; }
.ai-anom-type { font-size: 11px; color: #94a3b8; text-transform: uppercase; font-weight: 700; }
.ai-anom-desc { font-size: 14px; color: #fff; font-weight: 700; margin-top: 2px; }
.ai-anom-severity { padding: 4px 10px; border-radius: 12px; font-size: 11px; font-weight: 800; }
.ai-anom-hospital { font-size: 12px; color: #cbd5e1; margin: 6px 0; }
.ai-anom-evidence {
  background: rgba(15,23,42,0.4);
  border-radius: 6px;
  padding: 8px 10px;
  margin: 8px 0;
}
.ai-anom-evidence-title { font-size: 11px; color: #94a3b8; font-weight: 700; margin-bottom: 4px; }
.ai-anom-evidence-item { font-size: 12px; color: #cbd5e1; padding: 2px 0; }
.ai-anom-action {
  background: rgba(245,158,11,0.1);
  border: 1px solid rgba(245,158,11,0.3);
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 12px;
  color: #fde68a;
  margin-top: 8px;
}

/* Forecast */
.ai-forecast-intro { color: #94a3b8; font-size: 13px; margin-bottom: 16px; }
.ai-forecast-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  gap: 16px;
}
.ai-forecast-card {
  background: rgba(15,23,42,0.6);
  border: 1px solid rgba(34,165,231,0.2);
  border-radius: 12px;
  padding: 16px;
}
.ai-fc-header { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.ai-fc-icon { font-size: 26px; }
.ai-fc-label { font-size: 16px; font-weight: 800; color: #fff; }

.ai-fc-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}
.ai-fc-stat {
  background: rgba(15,23,42,0.4);
  border-radius: 8px;
  padding: 8px;
  text-align: center;
}
.ai-fc-stat-val { font-size: 18px; font-weight: 800; line-height: 1; }
.ai-fc-stat-lbl { font-size: 10px; color: #94a3b8; margin-top: 4px; }

.ai-fc-meta { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; padding: 8px 0; }
.ai-fc-trend { font-weight: 700; font-size: 13px; }
.ai-fc-anomaly { color: #fca5a5; font-weight: 700; font-size: 12px; background: rgba(239,68,68,0.15); padding: 4px 8px; border-radius: 6px; }
.ai-fc-normal { color: #7fdd8c; font-weight: 700; font-size: 12px; background: rgba(6,167,27,0.15); padding: 4px 8px; border-radius: 6px; }

.ai-fc-confidence { margin: 10px 0; }
.ai-fc-conf-label { font-size: 11px; color: #94a3b8; margin-bottom: 4px; }
.ai-fc-conf-bar { height: 6px; background: rgba(15,23,42,0.8); border-radius: 3px; overflow: hidden; }
.ai-fc-conf-fill { height: 100%; transition: width 0.6s ease-out; }

.ai-fc-reasoning { margin: 10px 0; }
.ai-fc-reason-item {
  font-size: 12px;
  color: #cbd5e1;
  padding: 4px 0;
  border-right: 2px solid rgba(34,165,231,0.4);
  padding-right: 8px;
  margin: 4px 0;
}

.ai-fc-chart-wrap { height: 200px; margin-top: 12px; position: relative; }

/* Responsive */
@media (max-width: 900px) {
  .ai-chat-wrap { grid-template-columns: 1fr; }
  .ai-suggestions-bar { max-height: 200px; }
}
@media (max-width: 600px) {
  .ai-tabs { overflow-x: auto; flex-wrap: nowrap; }
  .ai-tab { flex-shrink: 0; }
  .ai-fc-stats { grid-template-columns: repeat(2, 1fr); }
  .ai-risk-factors { grid-template-columns: 1fr; }
}

/* ==========================================================
   Patient Timeline + Status Dashboard
   ========================================================== */
.patient-timeline {
  position: relative;
  padding-right: 35px;
}
.patient-timeline::before {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  right: 15px;
  width: 3px;
  background: linear-gradient(to bottom, #0091E0, #22a5e7, #0091E0, #06A71B);
  border-radius: 3px;
  opacity: 0.5;
}
.timeline-item {
  position: relative;
  margin-bottom: 14px;
  padding-right: 5px;
}
.timeline-dot {
  position: absolute;
  right: -30px;
  top: 6px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
  border: 2px solid var(--bg-primary, #0f172a);
  transition: transform 0.2s ease;
}
.timeline-dot:hover { transform: scale(1.15); }
.timeline-icon {
  font-size: 13px;
  filter: drop-shadow(0 0 2px rgba(0,0,0,0.6));
}
.timeline-content {
  background: var(--bg-tertiary, rgba(30,41,59,0.6));
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 0.875rem;
  transition: background 0.2s ease;
}
.timeline-content:hover {
  background: rgba(0,145,224,0.08);
}

/* Status Badge */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 999px;
  white-space: nowrap;
}

/* Status card hover */
.status-card {
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.status-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0,0,0,0.3);
}

/* Pulse for critical rows */
@keyframes pulse-row {
  0%, 100% { background-color: rgba(239,68,68,0.05); }
  50% { background-color: rgba(239,68,68,0.15); }
}

/* Pulse for critical alerts */
@keyframes alert-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239,68,68,0.6); }
  50% { box-shadow: 0 0 0 6px rgba(239,68,68,0); }
}
.alert-critical {
  animation: alert-pulse 1.5s ease-in-out infinite;
}

/* Mobile responsiveness for timeline */
@media (max-width: 640px) {
  .patient-timeline { padding-right: 28px; }
  .patient-timeline::before { right: 12px; }
  .timeline-dot { right: -24px; width: 24px; height: 24px; }
  .timeline-icon { font-size: 11px; }
}

/* =========================================================
   شاشة الدخول السينمائية — Cinematic Login
   ========================================================= */
.login-screen {
  position: fixed; inset: 0; z-index: 9000;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
  background:
    radial-gradient(1200px 700px at 78% 12%, rgba(0,145,224,.22), transparent 62%),
    radial-gradient(1000px 640px at 18% 84%, rgba(6,167,27,.20), transparent 62%),
    linear-gradient(160deg, #02090f 0%, #04121c 42%, #061a26 100%);
  opacity: 1; transition: opacity .7s ease;
}
.login-screen.is-hidden { display: none; }
.login-screen.is-leaving { opacity: 0; pointer-events: none; }

body.login-active { overflow: hidden; }
body.login-active #app { display: none; }

.login-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; opacity: .85; }

.login-vignette {
  position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(circle at 50% 45%, transparent 32%, rgba(0,0,0,.55) 78%, rgba(0,0,0,.85) 100%);
}
.login-grid {
  position: absolute; inset: -40% -10% -10%; pointer-events: none; opacity: .16;
  background-image:
    linear-gradient(rgba(0,145,224,.55) 1px, transparent 1px),
    linear-gradient(90deg, rgba(6,167,27,.35) 1px, transparent 1px);
  background-size: 64px 64px, 64px 64px;
  transform: perspective(560px) rotateX(66deg);
  animation: gridDrift 22s linear infinite;
  mask-image: linear-gradient(to top, #000 0%, transparent 72%);
  -webkit-mask-image: linear-gradient(to top, #000 0%, transparent 72%);
}
@keyframes gridDrift { from { background-position: 0 0, 0 0; } to { background-position: 0 64px, 64px 0; } }

.login-aurora {
  position: absolute; width: 62vw; height: 62vw; min-width: 480px; min-height: 480px;
  border-radius: 50%; filter: blur(110px); pointer-events: none; opacity: .48;
}
.aurora-blue  { background: radial-gradient(circle, rgba(0,145,224,.85), transparent 68%); top: -18%; right: -12%; animation: auroraA 16s ease-in-out infinite alternate; }
.aurora-green { background: radial-gradient(circle, rgba(6,167,27,.75), transparent 68%);  bottom: -22%; left: -14%; animation: auroraB 19s ease-in-out infinite alternate; }
@keyframes auroraA { from { transform: translate3d(0,0,0) scale(1); } to { transform: translate3d(-6%, 7%, 0) scale(1.14); } }
@keyframes auroraB { from { transform: translate3d(0,0,0) scale(1.08); } to { transform: translate3d(8%, -6%, 0) scale(.94); } }

/* الستارة السينمائية */
.login-curtain {
  position: absolute; inset: 0; background: #000; z-index: 40;
  animation: curtainOpen 1.35s cubic-bezier(.7,0,.2,1) forwards;
}
@keyframes curtainOpen { 0% { opacity: 1; } 60% { opacity: .55; } 100% { opacity: 0; visibility: hidden; } }

/* المسرح */
.login-stage {
  position: relative; z-index: 20;
  display: flex; flex-direction: column; align-items: center; gap: 30px;
  padding: 40px 24px; width: 100%; max-width: 560px;
  max-height: 100vh; overflow-y: auto;
}
.login-stage::-webkit-scrollbar { width: 6px; }
.login-stage::-webkit-scrollbar-thumb { background: rgba(0,145,224,.4); border-radius: 4px; }

/* الشعار */
.login-brand { text-align: center; }
.login-heart-wrap {
  position: relative; width: 168px; height: 168px; margin: 0 auto 18px;
  display: grid; place-items: center;
  animation: heartEnter 1.5s cubic-bezier(.16,1,.3,1) .35s both;
}
@keyframes heartEnter {
  0%   { opacity: 0; transform: scale(.45) translateY(38px) rotateZ(-12deg); filter: blur(14px); }
  55%  { opacity: 1; transform: scale(1.1) translateY(0) rotateZ(3deg); filter: blur(0); }
  100% { opacity: 1; transform: scale(1) translateY(0) rotateZ(0); }
}
.login-heart {
  position: relative; z-index: 3; width: 126px; height: auto;
  filter: drop-shadow(0 12px 30px rgba(0,145,224,.55)) drop-shadow(0 6px 22px rgba(6,167,27,.45));
  animation: heartBeat 2.6s ease-in-out 2s infinite;
}
@keyframes heartBeat {
  0%, 100% { transform: scale(1); }
  12% { transform: scale(1.075); }
  24% { transform: scale(1); }
  36% { transform: scale(1.05); }
  48% { transform: scale(1); }
}
.login-heart-glow {
  position: absolute; z-index: 1; width: 150px; height: 150px; border-radius: 50%;
  background: radial-gradient(circle, rgba(0,145,224,.55), rgba(6,167,27,.28) 55%, transparent 72%);
  filter: blur(22px); animation: glowPulse 3.4s ease-in-out infinite;
}
@keyframes glowPulse { 0%,100% { opacity: .6; transform: scale(1); } 50% { opacity: 1; transform: scale(1.16); } }
.login-heart-ring {
  position: absolute; z-index: 2; width: 150px; height: 150px; border-radius: 50%;
  border: 1px solid rgba(0,145,224,.5); animation: ringOut 3.6s ease-out infinite;
}
.login-heart-ring.ring-2 { border-color: rgba(6,167,27,.45); animation-delay: 1.8s; }
@keyframes ringOut {
  0%   { transform: scale(.75); opacity: .85; }
  100% { transform: scale(1.75); opacity: 0; }
}

.login-title {
  margin: 0; font-size: clamp(1.5rem, 4.6vw, 2.25rem); font-weight: 800;
  color: #fff; letter-spacing: -.5px; line-height: 1.35;
  display: flex; flex-wrap: wrap; justify-content: center; gap: 0 .42em;
  text-shadow: 0 4px 26px rgba(0,145,224,.4);
}
.lt-word { display: inline-block; animation: wordUp .85s cubic-bezier(.16,1,.3,1) both; }
.lt-word:nth-child(1) { animation-delay: .95s; }
.lt-word:nth-child(2) { animation-delay: 1.06s; }
.lt-word:nth-child(3) { animation-delay: 1.17s; }
.lt-word:nth-child(4) { animation-delay: 1.28s; }
.lt-word:nth-child(5) { animation-delay: 1.39s; }
.lt-green { background: linear-gradient(120deg, #3ecb50, #06A71B); -webkit-background-clip: text; background-clip: text; color: transparent; }
@keyframes wordUp { from { opacity: 0; transform: translateY(24px) scale(.94); filter: blur(6px); } to { opacity: 1; transform: none; filter: blur(0); } }

.login-subtitle {
  margin: 8px 0 0; font-size: .9rem; letter-spacing: 3.4px; text-transform: uppercase;
  color: var(--sgh-blue-light); font-weight: 500; direction: ltr;
  animation: fadeSoft 1s ease 1.6s both;
}
.login-divider {
  display: flex; align-items: center; justify-content: center; gap: 12px; margin: 16px auto 12px; max-width: 300px;
  animation: fadeSoft 1s ease 1.75s both;
}
.login-divider span { flex: 1; height: 1px; background: linear-gradient(90deg, transparent, rgba(0,145,224,.75), transparent); }
.login-divider i { color: var(--sgh-green-light); font-size: .95rem; }
.login-tagline { margin: 0; color: #bcd9ea; font-size: .95rem; font-weight: 500; animation: fadeSoft 1s ease 1.85s both; }
.login-motto { margin: 6px 0 0; color: #6f9bb4; font-size: .82rem; animation: fadeSoft 1s ease 1.95s both; }
.lt-sep { color: rgba(255,255,255,.28); margin: 0 4px; }
@keyframes fadeSoft { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

/* بطاقة الدخول */
.login-card {
  width: 100%; border-radius: 22px; padding: 26px 24px 20px;
  background: linear-gradient(165deg, rgba(9,32,46,.94), rgba(4,16,24,.96));
  border: 1px solid rgba(0,145,224,.24);
  box-shadow: 0 30px 70px -20px rgba(0,0,0,.85), 0 0 0 1px rgba(255,255,255,.04) inset,
              0 0 60px -30px rgba(0,145,224,.6);
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  position: relative; overflow: hidden;
  animation: cardRise 1s cubic-bezier(.16,1,.3,1) 2.05s both;
}
@keyframes cardRise { from { opacity: 0; transform: translateY(40px) scale(.96); filter: blur(8px); } to { opacity: 1; transform: none; filter: blur(0); } }
.login-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: var(--sgh-gradient); background-size: 200% 100%;
  animation: sheen 4s linear infinite;
}
@keyframes sheen { from { background-position: 0 0; } to { background-position: 200% 0; } }
.login-card.shake { animation: shakeX .5s ease; }
@keyframes shakeX { 0%,100% { transform: translateX(0); } 20% { transform: translateX(-9px); } 40% { transform: translateX(8px); } 60% { transform: translateX(-5px); } 80% { transform: translateX(4px); } }

.login-card-head {
  display: flex; align-items: center; gap: 9px; margin-bottom: 20px;
  font-weight: 700; font-size: 1.02rem; color: #eaf6fd;
}
.login-card-head i { color: var(--sgh-blue); }

.login-field { margin-bottom: 15px; }
.login-field label { display: block; font-size: .82rem; color: #93b8ce; margin-bottom: 7px; font-weight: 500; }
.login-input-wrap { position: relative; display: flex; align-items: center; }
.login-input-wrap > i:first-child {
  position: absolute; right: 14px; color: #5c869e; font-size: .9rem; pointer-events: none; transition: color .25s;
}
.login-input-wrap input {
  width: 100%; padding: 13px 42px 13px 44px; border-radius: 13px;
  background: rgba(3,14,21,.85); border: 1px solid rgba(0,145,224,.22);
  color: #eaf6fd; font-size: .98rem; font-family: inherit; outline: none;
  transition: border-color .25s, box-shadow .25s, background .25s;
}
.login-input-wrap input::placeholder { color: #476b80; }
.login-input-wrap input:focus {
  border-color: var(--sgh-blue); background: rgba(3,18,28,.95);
  box-shadow: 0 0 0 4px rgba(0,145,224,.16);
}
.login-input-wrap input:focus ~ i:first-child,
.login-input-wrap:focus-within > i:first-child { color: var(--sgh-blue); }
.login-eye {
  position: absolute; left: 10px; background: none; border: 0; color: #5c869e;
  cursor: pointer; padding: 7px; font-size: .9rem; border-radius: 8px; transition: color .2s, background .2s;
}
.login-eye:hover { color: var(--sgh-blue-light); background: rgba(0,145,224,.1); }

.login-error {
  margin: 0 0 14px; padding: 11px 13px; border-radius: 11px; font-size: .86rem; font-weight: 500;
  background: rgba(239,68,68,.13); border: 1px solid rgba(239,68,68,.4); color: #fca5a5;
  display: flex; align-items: center; gap: 8px;
  animation: fadeSoft .35s ease both;
}

.login-submit {
  position: relative; width: 100%; padding: 14px; border: 0; border-radius: 13px;
  background: var(--sgh-gradient); background-size: 180% 100%;
  color: #fff; font-family: inherit; font-size: 1rem; font-weight: 700; cursor: pointer;
  box-shadow: 0 12px 30px -10px rgba(0,145,224,.75);
  transition: transform .2s, box-shadow .3s, background-position .5s;
  overflow: hidden;
}
.login-submit:hover { background-position: 100% 0; transform: translateY(-2px); box-shadow: 0 18px 38px -12px rgba(6,167,27,.7); }
.login-submit:active { transform: translateY(0) scale(.99); }
.login-submit .ls-spinner { display: none; }
.login-submit.is-loading { pointer-events: none; opacity: .85; }
.login-submit.is-loading .ls-text { display: none; }
.login-submit.is-loading .ls-spinner { display: inline-flex; align-items: center; gap: 8px; }
.login-submit.is-ok { background: linear-gradient(135deg, #06A71B, #048214) !important; }

.login-demo { margin-top: 20px; padding-top: 16px; border-top: 1px dashed rgba(0,145,224,.2); }
.ld-label { display: block; font-size: .76rem; color: #6f9bb4; margin-bottom: 9px; }
.ld-label i { color: var(--sgh-blue); }
.ld-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.ld-chip {
  flex: 1 1 auto; padding: 8px 11px; border-radius: 10px; cursor: pointer;
  background: rgba(0,145,224,.08); border: 1px solid rgba(0,145,224,.24);
  color: #a8cade; font-family: inherit; font-size: .74rem; text-align: center;
  transition: background .2s, border-color .2s, transform .2s, color .2s;
}
.ld-chip b { display: block; color: #eaf6fd; font-size: .84rem; direction: ltr; font-weight: 700; }
.ld-chip:hover { background: rgba(6,167,27,.14); border-color: rgba(6,167,27,.5); transform: translateY(-2px); color: #d6f0dc; }

.login-foot {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 18px;
  font-size: .72rem; color: #557a90; animation: fadeSoft 1s ease 2.5s both;
}
.login-foot span { display: inline-flex; align-items: center; gap: 6px; }
.login-foot i { color: var(--sgh-blue); opacity: .8; }

@media (max-width: 480px) {
  .login-stage { gap: 20px; padding: 24px 16px; }
  .login-heart-wrap { width: 128px; height: 128px; }
  .login-heart { width: 96px; }
  .login-heart-glow, .login-heart-ring { width: 116px; height: 116px; }
  .login-card { padding: 22px 18px 18px; border-radius: 18px; }
}
@media (prefers-reduced-motion: reduce) {
  .login-screen *, .login-screen *::before { animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}

/* =========================================================
   الهوية البصرية في الشل — الشعار والمستخدم
   ========================================================= */
.brand-mark { height: 40px; width: auto; filter: drop-shadow(0 3px 10px rgba(0,145,224,.45)); }
.brand-name { font-weight: 800; font-size: 1.02rem; line-height: 1.3;
  background: linear-gradient(100deg, var(--sgh-blue-light), var(--sgh-green-light));
  -webkit-background-clip: text; background-clip: text; color: transparent; }
[data-theme="light"] .brand-name { background: linear-gradient(100deg, var(--sgh-blue-dark), var(--sgh-green-dark)); -webkit-background-clip: text; background-clip: text; }

.sidebar-brand { display: flex; align-items: center; gap: 10px; padding: 6px 8px 14px; margin-bottom: 10px; border-bottom: 1px solid var(--border); }
.sidebar-mark { height: 34px; width: auto; }
.sidebar-brand-txt { display: flex; flex-direction: column; line-height: 1.2; }
.sidebar-brand-txt strong { font-size: .92rem; color: var(--text-primary); }
.sidebar-brand-txt span { font-size: .72rem; color: var(--sgh-green-light); }

.user-chip { display: flex; align-items: center; gap: 9px; padding: 5px 10px 5px 6px; border-radius: 999px;
  background: var(--bg-card); border: 1px solid var(--border); }
.uc-avatar { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center;
  color: #fff; font-weight: 800; font-size: .95rem; flex: 0 0 auto; }
.uc-txt { display: flex; flex-direction: column; line-height: 1.25; }
.uc-txt strong { font-size: .82rem; color: var(--text-primary); }
.uc-txt span { font-size: .68rem; color: var(--text-secondary); }
.uc-out { background: none; border: 0; color: var(--text-secondary); cursor: pointer; padding: 7px;
  border-radius: 50%; transition: color .2s, background .2s; }
.uc-out:hover { color: var(--danger); background: rgba(239,68,68,.12); }
@media (max-width: 700px) { .uc-txt { display: none; } .brand-name { font-size: .82rem; } }

/* =========================================================
   الأقسام والطوابق
   ========================================================= */
.floor-header { display: flex; align-items: center; gap: 12px; margin: 26px 0 12px; }
.floor-badge { padding: 6px 16px; border-radius: 999px; font-weight: 800; font-size: .86rem; color: #fff;
  background: var(--sgh-gradient); box-shadow: 0 6px 18px -8px rgba(0,145,224,.8); }
.floor-meta { font-size: .8rem; color: var(--text-secondary); }
.floor-header::after { content: ''; flex: 1; height: 1px;
  background: linear-gradient(90deg, var(--border), transparent); }

.dept-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.dept-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: 16px; padding: 16px;
  position: relative; overflow: hidden; transition: transform .22s, box-shadow .22s, border-color .22s; }
.dept-card::before { content: ''; position: absolute; top: 0; right: 0; bottom: 0; width: 4px; background: var(--sgh-blue); }
.dept-card.risk-high::before { background: linear-gradient(180deg, #ef4444, #b91c1c); }
.dept-card.risk-medium::before { background: linear-gradient(180deg, var(--sgh-blue), var(--sgh-blue-dark)); }
.dept-card.risk-low::before { background: linear-gradient(180deg, var(--sgh-green), var(--sgh-green-dark)); }
.dept-card:hover { transform: translateY(-4px); border-color: rgba(0,145,224,.5);
  box-shadow: 0 18px 40px -18px rgba(0,145,224,.5); }

.dc-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; margin-bottom: 10px; }
.dc-name { font-weight: 800; font-size: 1.02rem; color: var(--text-primary); }
.dc-en { font-size: .7rem; color: var(--text-secondary); direction: ltr; }
.dc-code { padding: 3px 9px; border-radius: 8px; font-size: .68rem; font-weight: 700; direction: ltr;
  background: rgba(0,145,224,.14); color: var(--sgh-blue-light); border: 1px solid rgba(0,145,224,.3); flex: 0 0 auto; }
.dc-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.dc-tags .tag { font-size: .68rem; padding: 3px 8px; border-radius: 7px;
  background: var(--bg-hover); color: var(--text-secondary); }
.dc-tags .risk-tag.risk-high { background: rgba(239,68,68,.16); color: #fca5a5; }
.dc-tags .risk-tag.risk-medium { background: rgba(0,145,224,.14); color: var(--sgh-blue-light); }
.dc-tags .risk-tag.risk-low { background: rgba(6,167,27,.16); color: var(--sgh-green-light); }

.dc-stats { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; text-align: center; margin-bottom: 10px; }
.dc-stats > div { padding: 7px 2px; border-radius: 9px; background: var(--bg-secondary); }
.dc-stats b { display: block; font-size: 1.02rem; font-weight: 800; color: var(--text-primary); }
.dc-stats span { font-size: .6rem; color: var(--text-secondary); }
.dc-stats .is-occ b { color: var(--sgh-blue-light); }
.dc-stats .is-iso b { color: #fca5a5; }
.dc-stats .is-free b { color: var(--sgh-green-light); }

.dc-bar { height: 6px; border-radius: 99px; background: var(--bg-hover); overflow: hidden; }
.dc-bar span { display: block; height: 100%; border-radius: 99px; background: var(--sgh-gradient); transition: width .6s ease; }
.dc-bar-lbl { font-size: .66rem; color: var(--text-secondary); margin: 5px 0 10px; }
.dc-people { display: flex; flex-direction: column; gap: 4px; font-size: .74rem; color: var(--text-secondary); margin-bottom: 12px; }
.dc-people i { color: var(--sgh-blue); width: 14px; }
.dc-actions { display: flex; gap: 6px; }
.btn-xs { padding: 6px 10px !important; font-size: 12px !important; }

/* =========================================================
   الغرف
   ========================================================= */
.room-legend { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0 18px; }
.room-pill { padding: 4px 12px; border-radius: 999px; font-size: .72rem; font-weight: 700;
  border: 1px solid transparent; display: inline-block; }
.room-pill.s-available   { background: rgba(6,167,27,.14);  color: var(--sgh-green-light); border-color: rgba(6,167,27,.35); }
.room-pill.s-occupied    { background: rgba(0,145,224,.14);  color: var(--sgh-blue-light);  border-color: rgba(0,145,224,.35); }
.room-pill.s-isolation   { background: rgba(239,68,68,.15);  color: #fca5a5;                border-color: rgba(239,68,68,.4); }
.room-pill.s-cleaning    { background: rgba(245,158,11,.15); color: #fcd34d;                border-color: rgba(245,158,11,.4); }
.room-pill.s-maintenance { background: rgba(148,163,184,.15);color: #cbd5e1;                border-color: rgba(148,163,184,.4); }

.room-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); margin-bottom: 8px; }
.room-tile { background: var(--bg-card); border: 1px solid var(--border); border-radius: 12px; padding: 11px 10px;
  cursor: pointer; text-align: center; position: relative; overflow: hidden;
  transition: transform .18s, box-shadow .18s, border-color .18s; }
.room-tile::before { content: ''; position: absolute; top: 0; right: 0; left: 0; height: 3px; background: var(--border); }
.room-tile.s-available::before   { background: var(--sgh-green); }
.room-tile.s-occupied::before    { background: var(--sgh-blue); }
.room-tile.s-isolation::before   { background: #ef4444; }
.room-tile.s-cleaning::before    { background: #f59e0b; }
.room-tile.s-maintenance::before { background: #94a3b8; }
.room-tile:hover { transform: translateY(-3px) scale(1.03); border-color: rgba(0,145,224,.55);
  box-shadow: 0 14px 30px -14px rgba(0,145,224,.6); z-index: 2; }
.rt-num { font-weight: 800; font-size: 1.05rem; color: var(--text-primary); direction: ltr; }
.rt-dept { font-size: .62rem; color: var(--text-secondary); margin-top: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rt-mdro { font-size: .58rem; color: #fca5a5; margin-top: 4px; font-weight: 700; direction: ltr;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rt-meta { display: flex; justify-content: center; gap: 8px; margin-top: 6px; font-size: .66rem; color: var(--text-secondary); }
.rt-meta i { color: var(--sgh-blue); }
.rt-mrn { font-size: .58rem; color: var(--sgh-blue-light); margin-top: 4px; direction: ltr; }
.rt-bang i { color: #ef4444 !important; }
.room-tile.alert-critical { border-color: rgba(239,68,68,.65); animation: tilePulse 2.2s ease-in-out infinite; }
.room-tile.alert-warn { border-color: rgba(245,158,11,.55); }
@keyframes tilePulse {
  0%,100% { box-shadow: 0 0 0 0 rgba(239,68,68,.45); }
  50% { box-shadow: 0 0 0 7px rgba(239,68,68,0); }
}

/* بطاقات إحصائية بالهوية الجديدة */
.stat-card.info    { border-right-color: var(--sgh-blue) !important; }
.stat-card.success { border-right-color: var(--sgh-green) !important; }


/* ===== طبقة توحيد هوية السعودي الألماني على العناصر العامة ===== */
.card::before, .panel::before { background: var(--sgh-gradient); }
.btn-primary { background: var(--sgh-gradient) !important; border-color: transparent !important; color:#fff !important; }
.btn-primary:hover { filter: brightness(1.08); }
.badge-info { background: rgba(0,145,224,.16); color: var(--sgh-blue-light); border:1px solid rgba(0,145,224,.35); }
.badge-success { background: rgba(6,167,27,.16); color: var(--sgh-green-light); border:1px solid rgba(6,167,27,.35); }
.nav-item.active, .nav-item:hover { border-inline-start-color: var(--sgh-blue) !important; }
.input:focus, select.input:focus, textarea.input:focus {
  border-color: var(--sgh-blue) !important;
  box-shadow: 0 0 0 3px rgba(0,145,224,.18) !important;
}
.data-table thead th { border-bottom: 2px solid rgba(0,145,224,.35); }
.data-table tbody tr:hover { background: rgba(0,145,224,.06); }
::selection { background: rgba(0,145,224,.35); }
::-webkit-scrollbar-thumb { background: linear-gradient(180deg, var(--sgh-blue), var(--sgh-green)); border-radius: 8px; }
.section-title, .page-title { background: var(--sgh-gradient); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.stat-card { border-top: 3px solid transparent; border-image: var(--sgh-gradient) 1; }
.modal-header { border-bottom: 2px solid rgba(0,145,224,.28); }
.chip-active, .filter-chip.active { background: var(--sgh-gradient); color:#fff; }
