/* ============================================================
   EMS Refer Dashboard — Professional Medical EMS Theme (Comfortable & High-Legibility)
   Operate by Referal Center MedCMU
   ============================================================ */

:root {
  /* Comfortable, soft-bright medical palette */
  --bg-page: #e9eef5;           /* Soft soothing medical slate-gray (สบายตา ไม่มืดและไม่จ้าเกินไป) */
  --bg-surface: #ffffff;        /* Crisp card surface */
  --bg-card: #ffffff;
  --bg-subtle: #f1f5f9;

  --primary-navy: #0f2b48;      /* Deep EMS Medical Navy */
  --primary-blue: #1d4ed8;
  --accent-cyan: #0284c7;
  
  --text-dark: #0f172a;         /* High contrast deep slate */
  --text-body: #1e293b;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  
  --danger-red: #ef4444;
  --warning-yellow: #f59e0b;
  --success-green: #10b981;
  --info-blue: #2563eb;

  /* 5 Triage Border Colors */
  --triage-blue: #2563eb;
  --triage-red: #dc2626;
  --triage-yellow: #d97706;
  --triage-green: #059669;
  --triage-white: #94a3b8;

  --font-main: 'Sarabun', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: var(--font-main);
  background-color: var(--bg-page);
  color: var(--text-dark);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
}

/* ═══════════════ HEADER ═══════════════ */
.header {
  background: linear-gradient(135deg, #0f2b48 0%, #1e40af 100%);
  border-bottom: 3px solid #3b82f6;
  color: white;
  padding: 10px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 4px 20px rgba(15, 43, 72, 0.25);
  position: sticky;
  top: 0;
  z-index: 1000;
  gap: 16px;
}

.header-brand h1 {
  font-size: 1.4rem;
  font-weight: 900;
  letter-spacing: 0.5px;
  color: #ffffff;
  display: flex;
  align-items: center;
  gap: 8px;
}

.header-brand .subtitle {
  font-size: 0.76rem;
  color: #93c5fd;
  font-weight: 600;
}

.header-brand .operated-tag {
  font-size: 0.68rem;
  color: #fef08a;
  font-weight: 700;
  letter-spacing: 0.3px;
  margin-top: 2px;
}

.header-clock {
  text-align: center;
  flex-shrink: 0;
  background: rgba(0, 0, 0, 0.25);
  padding: 4px 18px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.clock {
  font-size: 2.1rem;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  color: #38bdf8;
  text-shadow: 0 0 16px rgba(56, 189, 248, 0.6);
  letter-spacing: 2px;
}

.clock-date {
  font-size: 0.72rem;
  color: #e2e8f0;
  margin-top: 2px;
  font-weight: 600;
}

.header-nav {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

/* User Session Badge */
.user-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.3);
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 0.82rem;
  color: #ffffff;
}
.user-badge .user-avatar { font-size: 1rem; }
.user-badge .user-name { font-weight: 700; max-width: 170px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-badge .btn-logout {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  color: #fca5a5;
  transition: transform 0.2s;
  padding: 0 2px;
}
.user-badge .btn-logout:hover { transform: scale(1.2); }

/* ═══════════════ BUTTONS ═══════════════ */
.btn {
  padding: 8px 16px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  font-family: var(--font-main);
  font-size: 0.88rem;
  font-weight: 700;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  white-space: nowrap;
}

.btn-primary   { background: #eab308; color: #0f172a; box-shadow: 0 2px 8px rgba(234, 179, 8, 0.3); }
.btn-primary:hover { background: #ca8a04; transform: translateY(-1px); }
.btn-secondary { background: rgba(255,255,255,0.18); color: #ffffff; border: 1px solid rgba(255,255,255,0.3); }
.btn-secondary:hover { background: rgba(255,255,255,0.3); }
.btn-danger  { background: #ef4444; color: white; }
.btn-danger:hover { background: #dc2626; }
.btn-success { background: #10b981; color: white; }
.btn-success:hover { background: #059669; }
.btn-info    { background: #2563eb; color: white; }
.btn-info:hover { background: #1d4ed8; }
.btn-warning { background: #f59e0b; color: #1e293b; }
.btn-warning:hover { background: #d97706; }

.btn-notify-doc { background: #0284c7; color: white; border: 1px solid #0369a1; }
.btn-notify-doc:hover { background: #0369a1; }
.btn-notify-doc.notified { background: #059669; color: #ffffff; border-color: #047857; }

.btn-delay-toggle { background: #fef3c7; color: #92400e; border: 2px solid #f59e0b; font-weight: 800; }
.btn-delay-toggle:hover { background: #fde68a; }
.btn-delay-toggle.active { background: #ef4444; color: white; border-color: #b91c1c; animation: btn-alert-pulse 1s infinite alternate; }

@keyframes btn-alert-pulse {
  from { box-shadow: 0 0 4px rgba(239, 68, 68, 0.4); }
  to { box-shadow: 0 0 14px rgba(239, 68, 68, 0.9); }
}

.btn-sm  { padding: 6px 12px; font-size: 0.78rem; border-radius: 6px; }
.btn-lg  { padding: 12px 28px; font-size: 1.05rem; border-radius: 10px; }

/* ═══════════════ ALARM ACKNOWLEDGE TOP BANNER ═══════════════ */
.alarm-acknowledge-banner {
  background: linear-gradient(90deg, #991b1b, #dc2626, #b91c1c);
  color: white;
  padding: 10px 20px;
  position: sticky;
  top: 60px;
  z-index: 999;
  box-shadow: 0 4px 16px rgba(220, 38, 38, 0.5);
  border-bottom: 2px solid #fef08a;
  animation: alarm-banner-pulse 1s infinite alternate;
}

@keyframes alarm-banner-pulse {
  from { background-color: #991b1b; }
  to   { background-color: #dc2626; box-shadow: 0 4px 24px rgba(239, 68, 68, 0.8); }
}

.alarm-banner-content {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.alarm-icon-pulsing {
  font-size: 1.4rem;
  animation: icon-bounce 0.6s infinite alternate;
}

@keyframes icon-bounce {
  from { transform: scale(1); }
  to   { transform: scale(1.3); }
}

.alarm-banner-text {
  font-weight: 900;
  font-size: 0.98rem;
  letter-spacing: 0.5px;
  flex: 1;
}

.btn-ack-alarm {
  background: #fef08a;
  color: #78350f;
  font-weight: 900;
  border: 2px solid #ffffff;
  padding: 8px 18px;
  font-size: 0.92rem;
  box-shadow: 0 2px 10px rgba(0,0,0,0.3);
  cursor: pointer;
}
.btn-ack-alarm:hover {
  background: #ffffff;
  color: #991b1b;
  transform: scale(1.03);
}

/* ═══════════════ STATS BAR ═══════════════ */
.stats-bar {
  display: flex;
  gap: 12px;
  margin-bottom: 18px;
  flex-wrap: wrap;
  align-items: center;
}

.stat-card {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  padding: 10px 18px;
  color: var(--text-dark);
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.06);
}

.stat-num { font-size: 2.1rem; font-weight: 900; line-height: 1; font-variant-numeric: tabular-nums; color: #1e40af; }
.stat-label { font-size: 0.78rem; color: #64748b; font-weight: 700; text-transform: uppercase; }
.stat-card.danger-stat { border-color: #fca5a5; background: #fff1f2; }
.stat-card.danger-stat .stat-num { color: #dc2626; }
.stat-card.warning-stat { border-color: #fde68a; background: #fefce8; }
.stat-card.warning-stat .stat-num { color: #d97706; }

/* ═══════════════ DASHBOARD MAIN ═══════════════ */
.dashboard-main {
  flex: 1;
  padding: 18px 24px 40px;
  max-width: 1800px;
  margin: 0 auto;
  width: 100%;
}

.section-title-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  border-bottom: 2px solid #cbd5e1;
  padding-bottom: 8px;
}

.section-title {
  color: #334155;
  font-size: 1rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ═══════════════ LARGE MONITOR CASE CARDS ═══════════════ */
.cases-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(460px, 1fr));
  gap: 20px;
}

.case-card {
  background: #ffffff;
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 6px 24px rgba(15, 23, 42, 0.1);
  display: flex;
  flex-direction: column;
  position: relative;
  transition: transform 0.2s, box-shadow 0.2s;
  border: 6px solid #cbd5e1; /* Base 6px border */
}

.case-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 36px rgba(15, 23, 42, 0.18);
}

/* 5 Triage Border Colors — Ultra High Visibility */
.case-card.border-red {
  border: 6px solid #dc2626 !important;
  box-shadow: 0 0 0 2px rgba(220, 38, 38, 0.35), 0 8px 30px rgba(220, 38, 38, 0.25) !important;
}
.case-card.border-yellow {
  border: 6px solid #d97706 !important;
  box-shadow: 0 0 0 2px rgba(217, 119, 6, 0.35), 0 8px 30px rgba(217, 119, 6, 0.25) !important;
}
.case-card.border-green {
  border: 6px solid #059669 !important;
  box-shadow: 0 0 0 2px rgba(5, 150, 105, 0.35), 0 8px 30px rgba(5, 150, 105, 0.25) !important;
}
.case-card.border-blue {
  border: 6px solid #2563eb !important;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.35), 0 8px 30px rgba(37, 99, 235, 0.25) !important;
}
.case-card.border-white {
  border: 6px solid #475569 !important;
  box-shadow: 0 0 0 2px rgba(71, 85, 105, 0.35), 0 8px 25px rgba(0, 0, 0, 0.12) !important;
}

/* Triage Top Banner Strip on Card */
.triage-top-strip {
  padding: 6px 16px;
  font-size: 0.82rem;
  font-weight: 900;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #ffffff;
}

.triage-strip-red    { background: linear-gradient(90deg, #991b1b, #dc2626); border-bottom: 2px solid #b91c1c; }
.triage-strip-yellow { background: linear-gradient(90deg, #b45309, #d97706); border-bottom: 2px solid #92400e; }
.triage-strip-green  { background: linear-gradient(90deg, #047857, #059669); border-bottom: 2px solid #065f46; }
.triage-strip-blue   { background: linear-gradient(90deg, #1d4ed8, #2563eb); border-bottom: 2px solid #1e40af; }
.triage-strip-white  { background: linear-gradient(90deg, #334155, #475569); border-bottom: 2px solid #1e293b; }

/* ═══════════════ CHECKPOINT FLASHING & SCROLLING ═══════════════ */
.case-card.checkpoint-active {
  animation: checkpoint-flash-pulse 0.9s infinite alternate;
}

@keyframes checkpoint-flash-pulse {
  0% {
    border-color: #ef4444;
    box-shadow: 0 0 25px #ef4444, inset 0 0 10px rgba(239, 68, 68, 0.15);
  }
  50% {
    border-color: #f59e0b;
    box-shadow: 0 0 35px #f59e0b, 0 0 12px #ffffff, inset 0 0 16px rgba(245, 158, 11, 0.25);
  }
  100% {
    border-color: #dc2626;
    box-shadow: 0 0 30px #dc2626, inset 0 0 10px rgba(220, 38, 38, 0.2);
  }
}

.checkpoint-ticker-bar {
  background: linear-gradient(90deg, #991b1b, #dc2626, #991b1b);
  color: #ffffff;
  padding: 6px 0;
  overflow: hidden;
  white-space: nowrap;
  font-weight: 900;
  font-size: 0.95rem;
  letter-spacing: 0.8px;
  border-bottom: 2px solid #fef08a;
  box-shadow: 0 2px 8px rgba(220, 38, 38, 0.4);
}

.checkpoint-ticker-inner {
  display: inline-block;
  white-space: nowrap;
  padding-left: 100%;
  animation: marquee-scroll 12s linear infinite;
}

@keyframes marquee-scroll {
  0%   { transform: translate(0, 0); }
  100% { transform: translate(-100%, 0); }
}

/* ═══════════════ DELAY BLINKING ALERT BANNER ═══════════════ */
.delay-blinking-banner {
  background: #fef3c7;
  color: #92400e;
  border-bottom: 2px solid #f59e0b;
  padding: 8px 14px;
  font-size: 0.95rem;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  animation: delay-banner-blink 0.8s infinite ease-in-out;
  text-transform: uppercase;
}

@keyframes delay-banner-blink {
  0%, 100% {
    background-color: #fef3c7;
    color: #92400e;
  }
  50% {
    background-color: #ef4444;
    color: #ffffff;
  }
}

/* ═══════════════ CARD INNER STRUCTURE ═══════════════ */
.card-top-bar {
  background: #0f2b48;
  color: white;
  padding: 12px 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.hospital-title {
  font-size: 1.8rem;
  font-weight: 900;
  color: #ffffff;
  line-height: 1.2;
  letter-spacing: 0.3px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-top-badges {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}

.specialty-tag {
  padding: 3px 12px;
  border-radius: 20px;
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.4px;
  text-transform: uppercase;
}

.created-time-tag {
  font-size: 0.72rem;
  color: #cbd5e1;
  font-weight: 600;
}

/* Prominent Bold Diagnosis */
.card-diagnosis-section {
  padding: 12px 18px;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
}

.diagnosis-label-mini {
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  color: #0369a1;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.diagnosis-large-text {
  font-size: 1.3rem;
  font-weight: 800;
  color: #0f172a;
  line-height: 1.35;
}

/* Clinical Parameters: GCS, Demographics, Airway */
.card-clinical-grid {
  padding: 10px 18px;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  border-bottom: 1px solid #e2e8f0;
  align-items: center;
  background: #ffffff;
}

.gcs-block {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #e0f2fe;
  padding: 5px 12px;
  border-radius: 8px;
  border: 1px solid #bae6fd;
}

.gcs-label-text {
  font-size: 0.8rem;
  font-weight: 800;
  color: #0369a1;
}

.gcs-breakdown {
  font-size: 0.88rem;
  font-weight: 700;
  color: #0f172a;
  font-variant-numeric: tabular-nums;
}

.gcs-score-huge {
  font-size: 1.35rem;
  font-weight: 900;
  color: #0284c7;
  margin-left: 4px;
}

.clinical-chips-wrap {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 16px;
  font-size: 0.78rem;
  font-weight: 700;
}

.chip.ett    { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
.chip.hf     { background: #ffedd5; color: #9a3412; border: 1px solid #fdba74; }
.chip.nc     { background: #d1fae5; color: #065f46; border: 1px solid #6ee7b7; }
.chip.ra     { background: #f1f5f9; color: #334155; border: 1px solid #cbd5e1; }
.chip.male   { background: #dbeafe; color: #1e40af; border: 1px solid #93c5fd; }
.chip.female { background: #fce7f3; color: #831843; border: 1px solid #f9a8d4; }
.chip.age    { background: #f1f5f9; color: #1e293b; border: 1px solid #cbd5e1; }

/* Doctor Row */
.doctor-row {
  padding: 10px 18px;
  background: #f8fafc;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #e2e8f0;
  font-size: 0.88rem;
  gap: 8px;
}

.doctor-info-text {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #1e293b;
  font-weight: 700;
}

.doctor-notified-badge {
  font-size: 0.78rem;
  padding: 3px 8px;
  border-radius: 6px;
  background: #d1fae5;
  color: #065f46;
  border: 1px solid #6ee7b7;
  font-weight: 700;
}

.doctor-not-notified {
  font-size: 0.78rem;
  padding: 3px 8px;
  border-radius: 6px;
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fca5a5;
}

/* Timestamps & Big ETA Grid */
.card-time-metrics {
  padding: 12px 18px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  background: #ffffff;
  border-bottom: 1px solid #e2e8f0;
}

.time-metric-box {
  text-align: center;
  background: #f8fafc;
  padding: 8px 4px;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
}

.metric-title {
  display: block;
  font-size: 0.68rem;
  font-weight: 800;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-bottom: 2px;
}

.metric-data {
  font-size: 1.15rem;
  font-weight: 900;
  color: #0f172a;
  font-variant-numeric: tabular-nums;
}

.time-metric-box.cp-box .metric-data { color: #dc2626; }

.time-metric-box.eta-box {
  background: #eff6ff;
  border-color: #bfdbfe;
}
.time-metric-box.eta-box .metric-data {
  color: #1d4ed8;
  font-size: 1.35rem;
}

/* Card Bottom Action Toolbar */
.card-footer-actions {
  padding: 10px 14px;
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  background: #f8fafc;
  flex-wrap: wrap;
  align-items: center;
}

/* ═══════════════ SPECIALTY BADGE COLORS ═══════════════ */
.spec-ortho    { background: #ede9fe; color: #5b21b6; border: 1px solid #c4b5fd; }
.spec-cardio   { background: #ffe4e6; color: #9f1239; border: 1px solid #fda4af; }
.spec-neuro    { background: #dbeafe; color: #1e40af; border: 1px solid #93c5fd; }
.spec-peds     { background: #d1fae5; color: #065f46; border: 1px solid #6ee7b7; }
.spec-medicine { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }
.spec-surgery  { background: #fae8ff; color: #86198f; border: 1px solid #f0abfc; }
.spec-icu      { background: #f1f5f9; color: #1e293b; border: 1px solid #cbd5e1; }
.spec-ob       { background: #fdf4ff; color: #701a75; border: 1px solid #f5d0fe; }
.spec-default  { background: #e0f2fe; color: #0369a1; border: 1px solid #bae6fd; }

/* ═══════════════ FORMS & CREATION ═══════════════ */
.form-page { background: var(--bg-page); min-height: 100vh; }
.form-container { max-width: 900px; margin: 0 auto; padding: 24px 20px 40px; }

.form-section {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 16px;
  padding: 24px;
  margin-bottom: 18px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.05);
}

.form-section-title {
  font-size: 1.1rem;
  font-weight: 800;
  color: #0f2b48;
  margin-bottom: 18px;
  padding-bottom: 10px;
  border-bottom: 2px solid #e2e8f0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
  margin-bottom: 14px;
}
.form-row.full { grid-template-columns: 1fr; }

.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group label {
  font-size: 0.82rem;
  font-weight: 800;
  color: #475569;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.form-group input, .form-group select, .form-group textarea {
  padding: 11px 14px;
  border: 2px solid #cbd5e1;
  border-radius: 10px;
  font-family: var(--font-main);
  font-size: 0.95rem;
  color: #0f172a;
  background: #f8fafc;
  transition: all 0.2s;
  width: 100%;
}

.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.15);
  background: #ffffff;
}

/* 5 Triage Border Color Selector — Ultra-Clear Active States */
.color-picker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 14px;
}

.color-option-card {
  position: relative;
  cursor: pointer;
}

.color-option-card input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.color-label-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 16px 12px;
  border-radius: 14px;
  border: 3px solid #cbd5e1;
  background: #ffffff;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  font-weight: 800;
  font-size: 0.9rem;
  text-align: center;
  gap: 8px;
  position: relative;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.color-label-box:hover {
  transform: translateY(-2px);
  border-color: #94a3b8;
}

.color-selected-badge {
  display: none;
  font-size: 0.72rem;
  font-weight: 900;
  padding: 2px 8px;
  border-radius: 12px;
  color: white;
  margin-top: 4px;
  letter-spacing: 0.3px;
}

.color-indicator-circle {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 3px solid #ffffff;
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

/* Individual vibrant selected states */
.color-option-card input[value="red"]:checked + .color-label-box {
  border-color: #dc2626 !important;
  background: #fef2f2 !important;
  box-shadow: 0 0 0 4px rgba(220, 38, 38, 0.3), 0 8px 24px rgba(220, 38, 38, 0.25) !important;
  transform: translateY(-4px) scale(1.02);
}
.color-option-card input[value="red"]:checked + .color-label-box .color-selected-badge {
  display: inline-block;
  background: #dc2626;
}

.color-option-card input[value="yellow"]:checked + .color-label-box {
  border-color: #d97706 !important;
  background: #fffbeb !important;
  box-shadow: 0 0 0 4px rgba(217, 119, 6, 0.3), 0 8px 24px rgba(217, 119, 6, 0.25) !important;
  transform: translateY(-4px) scale(1.02);
}
.color-option-card input[value="yellow"]:checked + .color-label-box .color-selected-badge {
  display: inline-block;
  background: #d97706;
}

.color-option-card input[value="green"]:checked + .color-label-box {
  border-color: #059669 !important;
  background: #ecfdf5 !important;
  box-shadow: 0 0 0 4px rgba(5, 150, 105, 0.3), 0 8px 24px rgba(5, 150, 105, 0.25) !important;
  transform: translateY(-4px) scale(1.02);
}
.color-option-card input[value="green"]:checked + .color-label-box .color-selected-badge {
  display: inline-block;
  background: #059669;
}

.color-option-card input[value="blue"]:checked + .color-label-box {
  border-color: #2563eb !important;
  background: #eff6ff !important;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.3), 0 8px 24px rgba(37, 99, 235, 0.25) !important;
  transform: translateY(-4px) scale(1.02);
}
.color-option-card input[value="blue"]:checked + .color-label-box .color-selected-badge {
  display: inline-block;
  background: #2563eb;
}

.color-option-card input[value="white"]:checked + .color-label-box {
  border-color: #334155 !important;
  background: #f8fafc !important;
  box-shadow: 0 0 0 4px rgba(51, 65, 85, 0.25), 0 8px 24px rgba(51, 65, 85, 0.2) !important;
  transform: translateY(-4px) scale(1.02);
}
.color-option-card input[value="white"]:checked + .color-label-box .color-selected-badge {
  display: inline-block;
  background: #334155;
}

/* GCS Condition / Sedation Buttons */
.gcs-condition-bar {
  display: flex;
  gap: 10px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.gcs-condition-item {
  position: relative;
}

.gcs-condition-item input[type="radio"] {
  position: absolute;
  opacity: 0;
}

.gcs-condition-item label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 8px;
  border: 2px solid #cbd5e1;
  background: #f8fafc;
  color: #334155;
  font-weight: 700;
  font-size: 0.88rem;
  cursor: pointer;
  transition: all 0.2s;
}

.gcs-condition-item input:checked + label {
  border-color: #0284c7;
  background: #e0f2fe;
  color: #0369a1;
  box-shadow: 0 2px 8px rgba(2, 132, 199, 0.2);
}

.gcs-condition-item input[value="sedate"]:checked + label {
  border-color: #d97706;
  background: #fef3c7;
  color: #92400e;
  box-shadow: 0 2px 8px rgba(217, 119, 6, 0.25);
}

/* GCS Input Row */
.gcs-group { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.gcs-item { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.gcs-item label { font-size: 0.78rem; font-weight: 800; color: #0284c7; }
.gcs-item input, .gcs-item select { width: 85px; text-align: center; font-size: 1.25rem; font-weight: 800; }
.gcs-separator { font-size: 1.4rem; color: #64748b; margin-top: 18px; }
.gcs-total-box {
  background: linear-gradient(135deg, #0f2b48, #1d4ed8);
  color: white;
  padding: 8px 18px;
  border-radius: 10px;
  text-align: center;
  margin-top: 14px;
  min-width: 85px;
}
.gcs-total-box .label { font-size: 0.68rem; opacity: 0.85; font-weight: 700; text-transform: uppercase; }
.gcs-total-box .num { font-size: 1.8rem; font-weight: 900; }

/* Airway Options */
.airway-group { display: flex; gap: 10px; flex-wrap: wrap; }
.airway-toggle { position: relative; }
.airway-toggle input[type="checkbox"] { position: absolute; opacity: 0; }
.airway-toggle label {
  display: inline-block;
  padding: 9px 18px;
  border: 2px solid #cbd5e1;
  border-radius: 24px;
  cursor: pointer;
  font-size: 0.88rem;
  font-weight: 700;
  color: #334155;
  background: #f8fafc;
  transition: all 0.2s;
}
.airway-toggle label:hover { border-color: #2563eb; color: #1d4ed8; }
.airway-toggle input:checked + label {
  background: #0284c7;
  color: white;
  border-color: #0284c7;
  box-shadow: 0 2px 10px rgba(2, 132, 199, 0.3);
}

/* ═══════════════ LOGIN PAGE ═══════════════ */
.login-page {
  background: var(--bg-page);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.login-container {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 30px 20px;
}

.login-card {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 20px;
  padding: 36px 32px;
  max-width: 460px;
  width: 100%;
  box-shadow: 0 12px 36px rgba(15, 43, 72, 0.15);
}

.login-header { text-align: center; margin-bottom: 24px; }
.login-header .login-icon { font-size: 3rem; margin-bottom: 8px; }
.login-header h2 { font-size: 1.5rem; font-weight: 900; color: #0f2b48; }
.login-header p { font-size: 0.85rem; color: #64748b; margin-top: 4px; }

.login-error-msg {
  background: #fee2e2;
  border: 1px solid #f87171;
  color: #991b1b;
  padding: 10px;
  border-radius: 8px;
  font-size: 0.85rem;
  margin-top: 10px;
  text-align: center;
}

.quick-login-divider {
  display: flex;
  align-items: center;
  text-align: center;
  margin: 20px 0 14px;
  color: #64748b;
  font-size: 0.78rem;
  font-weight: 700;
}
.quick-login-divider::before, .quick-login-divider::after {
  content: '';
  flex: 1;
  border-bottom: 1px solid #e2e8f0;
}
.quick-login-divider span { padding: 0 10px; }

.quick-login-grid { display: grid; grid-template-columns: 1fr; gap: 8px; }

.btn-quick-login {
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  color: #1e293b;
  padding: 9px 14px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-quick-login:hover {
  background: #eff6ff;
  border-color: #2563eb;
  color: #1d4ed8;
}

.login-footer-hint {
  margin-top: 20px;
  font-size: 0.78rem;
  color: #64748b;
  text-align: center;
  line-height: 1.5;
  background: #f1f5f9;
  padding: 8px;
  border-radius: 6px;
}

/* ═══════════════ DAILY ARCHIVE & DATABASE ═══════════════ */
.archive-page { background: var(--bg-page); min-height: 100vh; }

.archive-filter-bar {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 14px;
  padding: 16px 20px;
  margin-bottom: 20px;
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.filter-controls-group { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }

.archive-table-container {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0,0,0,0.06);
}

.archive-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; text-align: left; }
.archive-table th {
  background: #0f2b48;
  color: #ffffff;
  font-weight: 800;
  padding: 14px 16px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-size: 0.75rem;
}
.archive-table td { padding: 14px 16px; border-bottom: 1px solid #e2e8f0; color: #1e293b; }
.archive-table tr:hover td { background: #f8fafc; }

.date-group-header {
  background: #e2e8f0;
  color: #0f2b48;
  font-weight: 900;
  font-size: 0.95rem;
  padding: 10px 16px;
}

/* ═══════════════ LIVE MAP VIEW ═══════════════ */
.map-page { background: var(--bg-page); min-height: 100vh; display: flex; flex-direction: column; }
.map-body-wrapper { flex: 1; display: flex; gap: 16px; padding: 16px; height: calc(100vh - 110px); }
#fleet-map { flex: 1; border-radius: 16px; border: 2px solid #cbd5e1; min-height: 400px; box-shadow: 0 4px 16px rgba(0,0,0,0.08); }
.map-side-panel { width: 340px; flex-shrink: 0; display: flex; flex-direction: column; gap: 12px; overflow-y: auto; }

.panel-block {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  padding: 14px;
  color: #1e293b;
  box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}
.panel-block h4 {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: #64748b;
  margin-bottom: 8px;
  font-weight: 800;
}

.eta-big { font-size: 2.8rem; font-weight: 900; color: #1d4ed8; line-height: 1; font-variant-numeric: tabular-nums; }
.eta-unit { font-size: 0.9rem; color: #64748b; margin-left: 4px; font-weight: 700; }
.eta-dist { font-size: 0.82rem; color: #64748b; margin-top: 4px; font-weight: 600; }

.gps-status-row { display: flex; align-items: center; gap: 8px; font-size: 0.85rem; color: #1e293b; font-weight: 700; }
.gps-dot { width: 10px; height: 10px; border-radius: 50%; background: #94a3b8; flex-shrink: 0; }
.gps-dot.active { background: #10b981; box-shadow: 0 0 8px #10b981; }
.gps-dot.error  { background: #ef4444; }

.speed-row { font-size: 1.3rem; font-weight: 800; color: #6d28d9; }

/* ═══════════════ FOOTER & WATERMARK (MEDCMU CREDIT) ═══════════════ */
.app-footer {
  background: #0f2b48;
  color: #94a3b8;
  border-top: 2px solid #1e40af;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.82rem;
  gap: 12px;
  flex-wrap: wrap;
  flex-shrink: 0;
  margin-top: auto;
}

.footer-credit-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #ffffff;
  font-weight: 800;
}

.footer-credit-brand .cmu-badge {
  background: #d97706;
  color: white;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.5px;
}

.footer-copyright {
  color: #cbd5e1;
  font-weight: 600;
}

/* ═══════════════ TOAST & MODAL ═══════════════ */
#toast {
  position: fixed;
  bottom: 28px;
  right: 28px;
  background: #0f172a;
  color: white;
  padding: 14px 22px;
  border-radius: 12px;
  box-shadow: 0 10px 36px rgba(0,0,0,0.3);
  z-index: 999999;
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.34,1.56,0.64,1);
  font-size: 0.92rem;
  font-weight: 700;
  max-width: 380px;
}
#toast.show { transform: translateY(0); opacity: 1; }
#toast.success { border-left: 6px solid #10b981; }
#toast.error   { border-left: 6px solid #ef4444; }
#toast.info    { border-left: 6px solid #3b82f6; }

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  z-index: 9000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  backdrop-filter: blur(4px);
}
.modal {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  color: #0f172a;
  border-radius: 20px;
  padding: 28px;
  max-width: 540px;
  width: 100%;
  box-shadow: 0 20px 60px rgba(0,0,0,0.25);
  animation: modal-in 0.2s ease;
}
@keyframes modal-in { from { opacity: 0; transform: scale(0.95) translateY(10px); } to { opacity: 1; transform: scale(1) translateY(0); } }
.modal h3 { font-size: 1.3rem; font-weight: 900; color: #0f2b48; margin-bottom: 16px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }

/* ═══════════════ RESPONSIVE ═══════════════ */
@media (max-width: 900px) {
  .cases-grid { grid-template-columns: 1fr; }
  .map-body-wrapper { flex-direction: column; height: auto; }
  .map-side-panel { width: 100%; }
}
