/* NBCH brand palette — exact colors from bedford_logo.svg (gnbchc.org) */
:root {
  --nbch-blue: #2859a5;
  --nbch-blue-dark: #1f4688;
  --nbch-blue-light: #d6e3f5;
  --nbch-green: #b9cc1e;
  --nbch-green-dark: #8fa015;
  --nbch-green-light: #edf2c8;
  --nbch-orange: #f88014;
  --nbch-orange-light: #fde5cc;
  --nbch-text: #1e3a6e;
  --nbch-muted: #5a6f8a;

  --bs-primary: var(--nbch-blue);
  --bs-primary-rgb: 40, 89, 165;
  --bs-secondary: var(--nbch-blue-dark);
  --bs-secondary-rgb: 31, 70, 136;
  --bs-success: var(--nbch-green-dark);
  --bs-success-rgb: 143, 160, 21;
  --bs-warning: var(--nbch-orange);
  --bs-warning-rgb: 248, 128, 20;
  --bs-info: var(--nbch-blue);
  --bs-info-rgb: 40, 89, 165;
  --bs-danger: #c0392b;
  --bs-danger-rgb: 192, 57, 43;
  --bs-link-color: var(--nbch-blue);
  --bs-link-hover-color: var(--nbch-blue-dark);
  --bs-body-color: var(--nbch-text);
  --bs-border-color: #c5d4e8;
  --bs-light: #f4f8fc;
  --bs-light-rgb: 244, 248, 252;
}

body {
  font-family: system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  background-color: #f8fafc;
}

/* Landing page (/) */
body.landing-page {
  min-height: 100vh;
  background:
    radial-gradient(circle at top right, var(--nbch-green-light), transparent 42%),
    linear-gradient(160deg, #f4f8fc 0%, #eef3fa 55%, #f8fafc 100%);
}

.landing-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
}

.landing-card {
  width: min(100%, 560px);
  background: #fff;
  border: 1px solid var(--bs-border-color);
  border-radius: 1rem;
  padding: 0;
  overflow: hidden;
}

.landing-page-has-photo .landing-card {
  width: min(100%, 640px);
}

.landing-photo-section {
  margin: 0;
  background: var(--nbch-blue-light);
  border-bottom: 1px solid var(--bs-border-color);
}

.landing-photo {
  display: block;
  width: 100%;
  max-height: 280px;
  object-fit: cover;
}

.landing-photo-caption {
  margin: 0;
  padding: 0.65rem 1rem;
  text-align: center;
  font-size: 0.88rem;
  color: var(--nbch-muted);
  background: #fff;
}

.landing-card-inner {
  padding: 2.25rem 2rem 1.75rem;
}

.landing-eyebrow {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--nbch-green-dark);
}

.landing-title {
  font-size: clamp(1.35rem, 4vw, 1.85rem);
  line-height: 1.25;
  color: var(--nbch-blue-dark);
  margin-bottom: 0.75rem;
}

.landing-subtitle {
  color: var(--nbch-muted);
  font-size: 1rem;
}

.landing-start-btn {
  min-width: 220px;
  font-weight: 600;
  padding: 0.7rem 1.5rem;
  border-radius: 0.6rem;
  box-shadow: 0 8px 20px rgba(40, 89, 165, 0.22);
}

.landing-start-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(40, 89, 165, 0.28);
}

.landing-features {
  list-style: none;
  margin: 1.75rem 0 0;
  padding: 1rem 0 0;
  border-top: 1px solid var(--bs-border-color);
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.55rem 1rem;
}

.landing-features li {
  position: relative;
  padding-left: 1.1rem;
  font-size: 0.92rem;
  color: var(--nbch-text);
}

.landing-features li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.55rem;
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 50%;
  background: var(--nbch-green);
}

.landing-footer {
  margin-top: 1.25rem;
}

.landing-footer-link {
  color: var(--nbch-blue);
  text-decoration: none;
  font-weight: 600;
}

.landing-footer-link:hover {
  color: var(--nbch-blue-dark);
  text-decoration: underline;
}

/* About Us page */
.about-page .about-card {
  width: min(100%, 900px);
}

.about-bio {
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--bs-border-color);
}

.about-bio-text {
  white-space: pre-wrap;
  line-height: 1.65;
  color: var(--nbch-text);
  font-size: 1.02rem;
}

.about-team-heading {
  margin: 2rem 0 1rem;
  font-size: 1.15rem;
  color: var(--nbch-blue-dark);
  text-align: center;
}

.about-officer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1.25rem;
}

.about-officer-card {
  background: #f8fafc;
  border: 1px solid var(--bs-border-color);
  border-radius: 0.75rem;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.about-officer-photo {
  width: 100%;
  height: 220px;
  object-fit: cover;
  background: var(--nbch-blue-light);
}

.about-officer-body {
  padding: 1rem;
}

.about-officer-name {
  font-size: 1.05rem;
  margin: 0 0 0.25rem;
  color: var(--nbch-blue-dark);
}

.about-officer-bio {
  color: var(--nbch-text);
  line-height: 1.5;
}

.about-cert-badge {
  font-size: 0.72rem;
  font-weight: 500;
}

html.dark-ready .about-officer-card,
html.dark .about-officer-card {
  background: #0f172a;
  border-color: #334155;
}

html.dark-ready .about-bio-text,
html.dark-ready .about-officer-bio,
html.dark .about-bio-text,
html.dark .about-officer-bio {
  color: #cbd5e1;
}

html.dark-ready body.landing-page,
html.dark body.landing-page {
  background: #0f172a;
}

html.dark-ready .landing-card,
html.dark .landing-card {
  background: #1e293b;
  border-color: #334155;
}

html.dark-ready .landing-title,
html.dark .landing-title {
  color: #e2e8f0;
}

html.dark-ready .landing-subtitle,
html.dark-ready .landing-features li,
html.dark .landing-subtitle,
html.dark .landing-features li {
  color: #94a3b8;
}

.assign-unit-row.cert-match {
  background: var(--nbch-green-light);
  border-radius: 4px;
  padding: 0.2rem 0.35rem;
  margin-left: -0.35rem;
  margin-right: -0.35rem;
}

/* Header / navigation */
.cad-header {
  background: var(--nbch-blue);
  color: #fff;
}

.cad-header .navbar-brand,
.cad-header .navbar-text {
  color: #fff;
}

.cad-header .navbar-brand img,
.cad-header .navbar-brand .brand-logo {
  background: #fff;
  border-radius: 4px;
  padding: 3px 8px;
  height: 32px;
  width: auto;
}

.nav-active {
  font-weight: 600;
  border-bottom: 3px solid var(--nbch-green);
}

/* Cards */
.card {
  border-color: var(--bs-border-color);
}

.card-header {
  background-color: #fff;
  border-bottom-color: var(--bs-border-color);
  color: var(--nbch-blue);
  font-weight: 600;
}

.card-header.cad-header {
  background: var(--nbch-blue);
  color: #fff;
  border-bottom: none;
}

/* Login — white header so full-color SVG logo reads clearly */
.login-card .card-header.cad-header {
  background: #fff;
  color: var(--nbch-blue);
  border-bottom: 3px solid var(--nbch-green);
}

.login-card .card-header .brand-logo {
  background: transparent;
  padding: 0;
  height: 56px;
}

.login-card .card-header small {
  color: var(--nbch-muted);
}

/* Buttons */
.btn-primary {
  --bs-btn-bg: var(--nbch-blue);
  --bs-btn-border-color: var(--nbch-blue);
  --bs-btn-hover-bg: var(--nbch-blue-dark);
  --bs-btn-hover-border-color: var(--nbch-blue-dark);
  --bs-btn-active-bg: var(--nbch-blue-dark);
  --bs-btn-active-border-color: var(--nbch-blue-dark);
}

.btn-success {
  --bs-btn-bg: var(--nbch-green-dark);
  --bs-btn-border-color: var(--nbch-green-dark);
  --bs-btn-hover-bg: #7a8f12;
  --bs-btn-hover-border-color: #7a8f12;
}

.btn-outline-primary {
  --bs-btn-color: var(--nbch-blue);
  --bs-btn-border-color: var(--nbch-blue);
  --bs-btn-hover-bg: var(--nbch-blue);
  --bs-btn-hover-border-color: var(--nbch-blue);
}

.btn-outline-success {
  --bs-btn-color: var(--nbch-green-dark);
  --bs-btn-border-color: var(--nbch-green);
  --bs-btn-hover-bg: var(--nbch-green-dark);
  --bs-btn-hover-border-color: var(--nbch-green-dark);
}

.btn-outline-warning {
  --bs-btn-color: var(--nbch-orange);
  --bs-btn-border-color: var(--nbch-orange);
}

/* Tables */
.table-light {
  --bs-table-bg: var(--nbch-blue-light);
  --bs-table-color: var(--nbch-blue);
}

/* Badges */
.badge.bg-success,
.bg-success {
  background-color: var(--nbch-green-dark) !important;
}

.text-success {
  color: var(--nbch-green-dark) !important;
}

.text-primary {
  color: var(--nbch-blue) !important;
}

/* Dispatch priority row highlights */
.priority-1 { background-color: #fce4e4 !important; }
.priority-2 { background-color: var(--nbch-orange-light) !important; }
.priority-3 { background-color: var(--nbch-green-light) !important; }
.priority-4 { background-color: #eef4fb !important; }

/* Campus status banner */
.campus-status-banner {
  border-radius: 6px;
  padding: 0.55rem 1rem;
  font-size: 0.9rem;
  border: 2px solid transparent;
}
.campus-status-banner.campus-normal {
  background: var(--nbch-green-light);
  border-color: var(--nbch-green);
  color: var(--nbch-text);
}
.campus-status-banner.campus-elevated {
  background: #fff3cd;
  border-color: var(--nbch-orange);
  color: #664d03;
}
.campus-status-banner.campus-lockdown {
  background: #f8d7da;
  border-color: #c0392b;
  color: #842029;
  font-weight: 600;
}
.campus-status-banner.campus-weather {
  background: #cff4fc;
  border-color: #0dcaf0;
  color: #055160;
}

/* Heat map dashboard */
.heatmap-table {
  font-size: 0.72rem;
  table-layout: fixed;
}
.heatmap-table .heat-day-col {
  width: 2.5rem;
  background: var(--nbch-blue-light);
  color: var(--nbch-blue);
}
.heatmap-table .heat-hour-col {
  min-width: 1.6rem;
  font-weight: 600;
  color: var(--nbch-muted);
}
.heat-cell {
  min-width: 1.6rem;
  height: 1.75rem;
  vertical-align: middle;
  font-weight: 600;
  padding: 0.1rem !important;
}
.heat-cell.level-0 { background: #f4f8fc; color: var(--nbch-muted); }
.heat-cell.level-1 { background: #e3ecf8; color: var(--nbch-text); }
.heat-cell.level-2 { background: #c5d8f0; color: var(--nbch-text); }
.heat-cell.level-3 { background: #8fafe0; color: #fff; }
.heat-cell.level-4 { background: #4a7ec4; color: #fff; }
.heat-cell.level-5 { background: var(--nbch-blue); color: #fff; }

.heat-legend-swatch {
  display: inline-block;
  width: 1.1rem;
  height: 0.85rem;
  border-radius: 2px;
  border: 1px solid rgba(0,0,0,0.08);
}
.heat-legend-swatch.level-0 { background: #f4f8fc; }
.heat-legend-swatch.level-1 { background: #e3ecf8; }
.heat-legend-swatch.level-2 { background: #c5d8f0; }
.heat-legend-swatch.level-3 { background: #8fafe0; }
.heat-legend-swatch.level-4 { background: #4a7ec4; }
.heat-legend-swatch.level-5 { background: var(--nbch-blue); }

.heat-bars { max-height: 420px; overflow-y: auto; }
.heat-bar-row {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin-bottom: 0.2rem;
}
.heat-bar-label {
  width: 1.5rem;
  text-align: right;
  color: var(--nbch-muted);
  font-variant-numeric: tabular-nums;
}
.heat-bar-track {
  flex: 1;
  height: 0.65rem;
  background: #eef4fb;
  border-radius: 3px;
  overflow: hidden;
}
.heat-bar-fill {
  height: 100%;
  border-radius: 3px;
  min-width: 2px;
}
.heat-bar-fill.level-0 { background: #d0d8e4; }
.heat-bar-fill.level-1 { background: #c5d8f0; }
.heat-bar-fill.level-2 { background: #8fafe0; }
.heat-bar-fill.level-3 { background: #5a8fc8; }
.heat-bar-fill.level-4 { background: #3d6fad; }
.heat-bar-fill.level-5 { background: var(--nbch-blue); }
.heat-bar-count {
  width: 1.5rem;
  text-align: left;
  font-variant-numeric: tabular-nums;
}

body.dark-mode .heat-cell.level-0 { background: #1a2433; color: var(--dm-muted); }
body.dark-mode .heat-bar-track { background: #1a2433; }

/* SLA breach highlights */
.sla-breach {
  box-shadow: inset 3px 0 0 #c0392b;
}
.sla-badge {
  display: inline-block;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  background: #c0392b;
  color: #fff;
  border-radius: 3px;
  padding: 1px 5px;
  margin-left: 3px;
  vertical-align: middle;
}

/* Stale active calls (open 15+ minutes) */
.stale-call {
  background: linear-gradient(90deg, #fff3cd 0%, #ffe8a1 100%) !important;
  box-shadow: inset 4px 0 0 #dc3545;
  animation: stale-pulse 2.5s ease-in-out infinite;
}

.stale-badge {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #fff;
  background: #dc3545;
  border-radius: 3px;
  padding: 1px 5px;
  vertical-align: middle;
}

@keyframes stale-pulse {
  0%, 100% { box-shadow: inset 4px 0 0 #dc3545; }
  50% { box-shadow: inset 4px 0 0 #dc3545, 0 0 0 2px rgba(220, 53, 69, 0.25); }
}

#live-badge.text-success::before {
  content: '● ';
}

#live-badge.text-warning::before {
  content: '◌ ';
}

.unit-quick-btns .btn {
  font-size: 0.7rem;
  padding: 0.15rem 0.4rem;
}

/* Unit status */
.status-Available { color: var(--nbch-green-dark); font-weight: 600; }
.status-Dispatched,
.status-En\ Route,
.status-On\ Scene { color: var(--nbch-orange); font-weight: 600; }
.status-Cleared { color: var(--nbch-muted); }
.status-Out\ of\ Service { color: #6c757d; font-weight: 600; font-style: italic; }
.status-Transporting { color: var(--nbch-orange); font-weight: 600; }

/* Metrics & misc */
.metric {
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 1;
}

.small-muted {
  font-size: 0.8rem;
  color: var(--nbch-muted);
}

.text-muted {
  color: var(--nbch-muted) !important;
}

/* Timeline */
.timeline {
  border-left: 3px solid var(--nbch-blue-light);
  padding-left: 1rem;
}

.timeline-item {
  margin-bottom: 0.75rem;
  position: relative;
}

.timeline-item::before {
  content: '';
  position: absolute;
  left: -1.35rem;
  top: 0.3rem;
  width: 0.65rem;
  height: 0.65rem;
  background: var(--nbch-green);
  border-radius: 50%;
}

/* Alerts */
.alert-success {
  --bs-alert-color: var(--nbch-green-dark);
  --bs-alert-bg: var(--nbch-green-light);
  --bs-alert-border-color: var(--nbch-green);
}

.alert-info {
  --bs-alert-color: var(--nbch-blue);
  --bs-alert-bg: #e8f0fa;
  --bs-alert-border-color: var(--nbch-blue-light);
}

/* Form focus */
.form-control:focus,
.form-select:focus {
  border-color: var(--nbch-blue);
  box-shadow: 0 0 0 0.2rem var(--nbch-blue-focus, rgba(40, 89, 165, 0.2));
}

/* Call queue badge */
.queue-badge {
  font-size: 0.95rem;
  letter-spacing: 0.02em;
}

.queue-badge.queue-active {
  animation: queue-pulse 2s ease-in-out infinite;
}

@keyframes queue-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.85; }
}

/* Dark mode (all users — toggled via navbar, stored in localStorage) */
body.dark-mode {
  --dm-bg: #0f1419;
  --dm-surface: #1a2332;
  --dm-surface-2: #243044;
  --dm-border: #334155;
  --dm-text: #e8eef7;
  --dm-muted: #94a3b8;
  background-color: var(--dm-bg) !important;
  color: var(--dm-text);
}

body.dark-mode .card {
  background-color: var(--dm-surface);
  border-color: var(--dm-border);
  color: var(--dm-text);
}

body.dark-mode .card-header {
  background-color: var(--dm-surface-2);
  border-bottom-color: var(--dm-border);
  color: var(--dm-text);
}

body.dark-mode .card-header.cad-header {
  background: var(--nbch-blue-dark);
  color: #fff;
}

body.dark-mode .table {
  --bs-table-bg: var(--dm-surface);
  --bs-table-color: var(--dm-text);
  --bs-table-border-color: var(--dm-border);
}

body.dark-mode .table-light {
  --bs-table-bg: var(--dm-surface-2);
  --bs-table-color: var(--dm-text);
}

body.dark-mode .list-group-item {
  background-color: var(--dm-surface);
  border-color: var(--dm-border);
  color: var(--dm-text);
}

body.dark-mode .form-control,
body.dark-mode .form-select {
  background-color: var(--dm-surface-2);
  border-color: var(--dm-border);
  color: var(--dm-text);
}

body.dark-mode .form-control::placeholder {
  color: var(--dm-muted);
}

body.dark-mode .text-muted,
body.dark-mode .small-muted {
  color: var(--dm-muted) !important;
}

body.dark-mode .border,
body.dark-mode .border rounded {
  border-color: var(--dm-border) !important;
}

body.dark-mode .bg-light {
  background-color: var(--dm-surface-2) !important;
  color: var(--dm-text) !important;
}

body.dark-mode .priority-1 { background-color: #3d2020 !important; }
body.dark-mode .priority-2 { background-color: #3d3020 !important; }
body.dark-mode .priority-3 { background-color: #2a3320 !important; }
body.dark-mode .priority-4 { background-color: #1e2a3a !important; }

body.dark-mode .stale-call {
  background: linear-gradient(90deg, #4a3a10 0%, #5c4510 100%) !important;
}

body.dark-mode .timeline {
  border-left-color: var(--dm-border);
}

body.dark-mode .badge.bg-light.text-dark {
  background-color: var(--dm-surface-2) !important;
  color: var(--dm-text) !important;
}

body.dark-mode .btn-outline-secondary {
  --bs-btn-color: var(--dm-muted);
  --bs-btn-border-color: var(--dm-border);
}

body.dark-mode .login-card .card-header.cad-header {
  background: var(--dm-surface);
  color: var(--dm-text);
}