:root {
  --bg-body:    #f0f2f5;
  --bg-card:    #ffffff;
  --bg-surface: #f8f9fa;
  --border:     #dee2e6;
  --primary:    #0d6efd;
  --success:    #198754;
  --danger:     #dc3545;
  --warning:    #e6a800;
  --info:       #0986a8;
  --text:       #212529;
  --text-muted: #6c757d;
}

/* ----- Base ----- */
body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background-color: var(--bg-body);
  color: var(--text);
}

main { flex: 1; }

/* ----- Scrollbar ----- */
::-webkit-scrollbar       { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: #e9ecef; }
::-webkit-scrollbar-thumb { background: #adb5bd; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #6c757d; }

/* ----- Navbar ----- */
.navbar {
  background-color: #ffffff !important;
  border-bottom: 1px solid var(--border) !important;
  box-shadow: 0 1px 6px rgba(0,0,0,.06);
}

.navbar-brand .badge-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
}

.navbar-brand { color: #212529 !important; }

.nav-link {
  color: #495057 !important;
  border-radius: .375rem;
  transition: background .15s;
}
.nav-link:hover,
.nav-link.active { background: #e9ecef; color: #212529 !important; }

.navbar-toggler { border-color: #dee2e6; }

/* ----- Cards ----- */
.card {
  background-color: #ffffff;
  border-color: var(--border) !important;
  border-radius: .5rem;
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
  transition: box-shadow .2s ease, transform .15s ease;
}

.card:hover { box-shadow: 0 4px 16px rgba(0,0,0,.1); }

.card-header {
  background-color: #f8f9fa !important;
  border-bottom: 1px solid var(--border) !important;
  padding: .75rem 1rem;
  font-weight: 600;
  color: #343a40;
}

.card-footer {
  background-color: #f8f9fa !important;
  border-top: 1px solid var(--border) !important;
}

/* ----- Stat cards ----- */
.stat-card {
  border-radius: .5rem;
  overflow: hidden;
  border: 1px solid var(--border) !important;
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
}

.stat-card:hover {
  box-shadow: 0 6px 20px rgba(0,0,0,.1);
  transform: translateY(-2px);
}

.stat-icon {
  width: 52px;
  height: 52px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: .4rem;
}

/* 5-column grid */
@media (min-width: 992px) {
  .col-lg-2-4 { flex: 0 0 auto; width: 20%; }
}

/* ----- Tables ----- */
.table { border-color: #e9ecef; }
.table > thead > tr > th {
  background-color: #f8f9fa;
  color: #495057;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  border-bottom: 2px solid #dee2e6;
}
.table-hover > tbody > tr:hover > * { background-color: #f8f9fa; }
.table td { color: #212529; border-color: #f0f0f0; }

/* ----- Forms ----- */
.form-control,
.form-select {
  background-color: #ffffff;
  border-color: #ced4da;
  color: #212529;
}

.form-control:focus,
.form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(13,110,253,.12);
}

.form-control::placeholder { color: #adb5bd; }

.input-group-text {
  background-color: #f8f9fa;
  border-color: #ced4da;
  color: #6c757d;
}

/* ----- Badges ----- */
.badge { font-weight: 500; letter-spacing: .02em; }

/* ----- Pulse animation ----- */
.pulse-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: .5; transform: scale(1.3); }
}

/* ----- Buttons ----- */
.btn { font-weight: 500; }

/* ----- Code ----- */
code {
  color: #0550ae;
  background: #e7f0ff;
  padding: 1px 5px;
  border-radius: 3px;
  font-size: .85em;
}

/* ----- Accordion ----- */
.accordion-button:focus { box-shadow: none; }
.accordion-button:not(.collapsed) {
  background-color: #e7f1ff;
  color: var(--primary);
}

/* ----- Dropdown ----- */
.dropdown-menu {
  border-color: var(--border);
  box-shadow: 0 4px 16px rgba(0,0,0,.1);
  border-radius: .4rem;
}
.dropdown-item { color: #212529; }
.dropdown-item:hover { background-color: #f0f4ff; }
.dropdown-header { color: #adb5bd; }

/* ----- Alerts ----- */
.alert { border-radius: .4rem; border-width: 1px; }

/* ----- List groups ----- */
.list-group-item {
  background-color: #ffffff;
  border-color: #f0f0f0;
  color: #212529;
}
.list-group-item:first-child { border-top: none; }

/* ----- Leaflet map light override ----- */
.leaflet-container {
  background: #e8eaed;
  font-family: inherit;
}

.leaflet-popup-content-wrapper,
.leaflet-popup-tip {
  background: #ffffff;
  color: #212529;
  border: 1px solid #dee2e6;
  box-shadow: 0 4px 16px rgba(0,0,0,.12);
}

.leaflet-popup-content-wrapper { border-radius: .4rem; }
.leaflet-popup-content { margin: 10px 14px; font-size: .82rem; }

/* ----- Page transitions ----- */
main { animation: fadeIn .25s ease; }

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

/* ----- Pagination ----- */
.page-link { color: var(--primary); border-color: #dee2e6; }
.page-item.active .page-link {
  background-color: var(--primary);
  border-color: var(--primary);
}

/* ----- Footer ----- */
footer {
  background-color: #ffffff;
  border-top: 1px solid var(--border) !important;
  color: var(--text-muted);
}

/* ----- Sidebar-level horizontal rule ----- */
hr { border-color: #dee2e6; }

/* ----- Utility ----- */
.text-nowrap    { white-space: nowrap; }
.font-monospace { font-family: 'Cascadia Code', 'Fira Code', monospace; }

/* ----- Responsive ----- */
@media (max-width: 576px) {
  .stat-card .fs-2 { font-size: 1.6rem !important; }
  .display-5       { font-size: 2.5rem !important; }
}

/* ----- WG status badge ----- */
.wg-badge-online  { background:#d1fae5; color:#065f46; border:1px solid #6ee7b7; }
.wg-badge-offline { background:#fee2e2; color:#991b1b; border:1px solid #fca5a5; }
