/* Connect4Sure runs a single dark, NOC-console visual identity — this is a
   monitoring product staff and wallboards live in for hours, not a document
   you read once, so it does not switch to light based on OS preference (the
   wallboard has always worked this way; the rest of the app now matches it
   intentionally rather than flipping to light for whoever happens to view
   it on a light-mode OS). */
:root {
  color-scheme: dark;
  --bg: #0a0e16;
  --bg-grid: rgba(59, 130, 246, 0.035);
  --card: #131a26;
  --card-2: #1a2231;
  --text: #eaeef4;
  --muted: #8b96a8;
  --border: #232e42;
  --accent: #3b82f6;
  --accent-2: #22d3ee;
  --accent-soft: rgba(59, 130, 246, 0.16);
  --up: #22c55e;
  --up-soft: rgba(34, 197, 94, 0.14);
  --down: #ef4444;
  --down-soft: rgba(239, 68, 68, 0.16);
  --unknown: #6b7280;
  --warn: #fbbf24;
  --warn-soft: rgba(245, 158, 11, 0.2);
  --orange: #fb923c;
  --orange-soft: rgba(251, 146, 60, 0.18);
  --yellow: #facc15;
  --yellow-soft: rgba(250, 204, 21, 0.16);
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 18px;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 1px 3px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 6px 16px rgba(0, 0, 0, 0.4), 0 2px 6px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 20px 48px rgba(0, 0, 0, 0.55), 0 4px 14px rgba(0, 0, 0, 0.4);
  --glow-accent: 0 0 0 1px rgba(59, 130, 246, 0.35), 0 0 20px rgba(59, 130, 246, 0.22);
  --glow-up: 0 0 10px rgba(34, 197, 94, 0.45);
  --glow-down: 0 0 10px rgba(239, 68, 68, 0.55);
  --inset-hairline: inset 0 1px 0 rgba(255, 255, 255, 0.035);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  /* Faint ops-console grid + a soft glow anchored top-left, sitting under
     everything. Purely decorative — kept low-contrast so it never competes
     with content, and simple enough to stay cheap on the 30s auto-refresh. */
  background-color: var(--bg);
  background-image:
    radial-gradient(circle at 12% 0%, var(--accent-soft), transparent 42%),
    linear-gradient(var(--bg-grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--bg-grid) 1px, transparent 1px);
  background-size: auto, 42px 42px, 42px 42px;
  background-attachment: fixed;
}

@keyframes pulse-glow-down {
  0%, 100% { box-shadow: var(--glow-down); }
  50% { box-shadow: 0 0 2px rgba(239, 68, 68, 0.15); }
}

::selection {
  background: var(--accent);
  color: white;
}

/* Themed scrollbars (WebKit) — subtle, matches card/border tokens instead
   of the OS default so tables and diagnostic output don't look jarring. */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 999px;
  border: 2px solid var(--card);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--muted);
}

.app-header {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow), var(--inset-hairline);
  position: relative;
}

.app-header::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -1px;
  height: 2px;
  background: linear-gradient(90deg, var(--accent-2), var(--accent), #6366f1);
  box-shadow: 0 0 12px rgba(59, 130, 246, 0.5);
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  padding: 0.75rem 1.5rem 0.4rem;
}

/* The logo asset's wordmark is a mid-grey drawn for light backgrounds, so it
   washes out on our dark cards — a small light plate behind it (rather than
   recolouring the brand asset itself) keeps it legible without touching the
   logo file. */
.brand-logo {
  height: 44px;
  width: auto;
  display: block;
  background: #f4f6fa;
  border-radius: var(--radius-sm);
  padding: 0.3rem 0.6rem;
  box-sizing: content-box;
}

.brand-tagline {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  border-left: 1px solid var(--border);
  padding-left: 0.9rem;
}

.topnav {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  padding: 0.5rem 1.5rem 0.75rem;
}

.topnav a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 500;
  position: relative;
  padding-bottom: 2px;
  transition: color 0.15s ease;
}

.topnav a::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -3px;
  height: 2px;
  background: var(--accent);
  transform: scaleX(0);
  transition: transform 0.15s ease;
}

.topnav a:hover { color: var(--accent); }
.topnav a:hover::after { transform: scaleX(1); }
.topnav a.active { color: var(--accent); }
.topnav a.active::after { transform: scaleX(1); }

.nav-dropdown {
  position: relative;
}

.nav-dropdown-toggle {
  background: none;
  border: none;
  color: var(--muted);
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 500;
  padding: 0.2rem 0;
  cursor: pointer;
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.3rem;
  transition: color 0.15s ease;
}

.nav-dropdown-toggle::after {
  content: "";
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid currentColor;
  opacity: 0.6;
  margin-top: 2px;
}

.nav-dropdown-toggle:hover,
.nav-dropdown-toggle.active {
  color: var(--accent);
}

.nav-dropdown-menu {
  display: none;
  flex-direction: column;
  position: absolute;
  top: calc(100% + 12px);
  left: 0;
  min-width: 180px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 0.45rem;
  z-index: 60;
  animation: nav-dropdown-in 0.12s ease;
}

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

.nav-dropdown.open .nav-dropdown-menu {
  display: flex;
}

.nav-dropdown-menu a {
  padding: 0.55rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  white-space: nowrap;
  border-left: 2px solid transparent;
  transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}

.nav-dropdown-menu a::after {
  display: none;
}

.nav-dropdown-menu a:hover {
  background: var(--accent-soft);
  border-left-color: var(--accent);
  color: var(--accent);
}

html {
  overflow-x: hidden;
}

body {
  overflow-x: hidden;
}

main {
  max-width: 1400px;
  width: 100%;
  margin: 2rem auto;
  padding: 0 2rem;
  box-sizing: border-box;
}

@media (max-width: 900px) {
  main { padding: 0 1rem; margin: 1.25rem auto; }
}

h1 {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0 0 0.3rem;
}

h2 {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.005em;
  margin-top: 2.25rem;
  margin-bottom: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

h2:first-child { margin-top: 0; }

.muted { color: var(--muted); font-size: 0.9rem; line-height: 1.55; }

a { color: var(--accent); }

.status-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: block;
  overflow-x: auto;
  overflow-y: hidden;
  box-shadow: var(--shadow), var(--inset-hairline);
  -webkit-overflow-scrolling: touch;
}

.status-table th, .status-table td {
  text-align: left;
  padding: 0.7rem 0.9rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.92rem;
}

.status-table thead th {
  color: var(--muted);
  font-weight: 700;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: var(--card-2);
  white-space: nowrap;
}

/* Add alongside .status-table to bound a long list to a fixed height
   instead of letting the whole page scroll past it — header stays pinned
   while rows scroll underneath (class="status-table table-scroll"). */
.status-table.table-scroll {
  max-height: 560px;
  overflow-y: auto;
}

.status-table.table-scroll thead th {
  position: sticky;
  top: 0;
  z-index: 1;
}

.status-table tbody tr {
  transition: background 0.1s ease;
}

.status-table tbody tr:nth-child(even) {
  background: var(--card-2);
}

.status-table tbody tr:hover {
  background: var(--accent-soft);
}

.status-table.sortable th[data-sort-index] {
  cursor: pointer;
  user-select: none;
}

.status-table.sortable th[data-sort-index]:hover { color: var(--accent); }

.status-table.sortable th.sort-asc::after { content: " \25B2"; font-size: 0.7em; }
.status-table.sortable th.sort-desc::after { content: " \25BC"; font-size: 0.7em; }
.status-table tr:last-child td { border-bottom: none; }

.dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  margin-right: 6px;
}

.dot-up { background: var(--up); box-shadow: var(--glow-up); }
.dot-down { background: var(--down); box-shadow: var(--glow-down); }
.dot-unknown { background: var(--unknown); }

.badge {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.badge-DOWN { background: var(--down-soft); color: var(--down); }
.badge-UP { background: var(--up-soft); color: var(--up); }
.badge-EMAIL_FAILED { background: rgba(139, 150, 168, 0.16); color: var(--muted); }
.badge-ZOHO_FAILED { background: rgba(139, 150, 168, 0.16); color: var(--muted); }
.badge-WEBHOOK_FAILED { background: rgba(139, 150, 168, 0.16); color: var(--muted); }
.badge-CRITICAL { background: var(--warn-soft); color: var(--warn); }

.weather-red { background: var(--down-soft); color: var(--down); }
.weather-orange { background: var(--orange-soft); color: var(--orange); }
.weather-yellow { background: var(--yellow-soft); color: var(--yellow); }
.weather-green { background: var(--up-soft); color: var(--up); }
.weather-unknown { background: rgba(139, 150, 168, 0.16); color: var(--muted); }

.role-super_admin { background: var(--accent-soft); color: var(--accent); }
.role-admin { background: var(--up-soft); color: var(--up); }
.role-readonly { background: rgba(139, 150, 168, 0.16); color: var(--muted); }

.inline-form, .stacked-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.9rem;
  align-items: end;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  margin-top: 0.75rem;
  box-shadow: var(--shadow), var(--inset-hairline);
}

.stacked-form { flex-direction: column; align-items: stretch; max-width: 480px; }

label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.checkbox-label {
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
  color: var(--text);
}

input[type="text"], input[type="password"], input[type="number"],
input[type="email"], input[type="date"], input[type="datetime-local"],
select, textarea {
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  font-size: 0.9rem;
  min-width: 220px;
  font-family: inherit;
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}

textarea { min-width: 100%; resize: vertical; }

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

button {
  padding: 0.6rem 1.15rem;
  border: none;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--accent-2), var(--accent) 60%, #4338ca);
  color: white;
  font-weight: 600;
  cursor: pointer;
  font-size: 0.9rem;
  box-shadow: 0 1px 2px rgba(59, 130, 246, 0.3);
  transition: transform 0.12s ease, box-shadow 0.12s ease, filter 0.12s ease;
}

button:hover { filter: brightness(1.08); box-shadow: var(--glow-accent), var(--shadow-md); transform: translateY(-1px); }
button:active { transform: translateY(1px); }
button:disabled { opacity: 0.55; cursor: not-allowed; filter: none; transform: none; box-shadow: none; }

button.secondary {
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--border);
  box-shadow: var(--shadow), var(--inset-hairline);
}

button.secondary:hover { border-color: var(--accent); color: var(--accent); filter: none; }

button.link-button {
  background: none;
  color: var(--down);
  padding: 0;
  font-weight: 500;
  text-decoration: underline;
  font-size: 0.85rem;
  box-shadow: none;
}

button.link-button:hover { filter: none; transform: none; opacity: 0.75; box-shadow: none; }

.flash {
  padding: 0.7rem 1rem;
  border-radius: var(--radius-sm);
  border-left: 3px solid transparent;
  margin-bottom: 1rem;
  font-size: 0.9rem;
  font-weight: 500;
  word-break: break-all;
}

.flash.success { background: var(--up-soft); color: var(--up); border-left-color: var(--up); }
.flash.error { background: var(--down-soft); color: var(--down); border-left-color: var(--down); }

.weather-watch-panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-left: 4px solid var(--warn);
  border-radius: var(--radius-sm);
  padding: 0.85rem 1rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow), var(--inset-hairline);
}

.weather-watch-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
  font-weight: 600;
  font-size: 0.92rem;
  margin-bottom: 0.6rem;
}

.weather-watch-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.nav-spacer { flex: 1; }

.nav-user {
  color: var(--muted);
  font-size: 0.85rem;
  text-decoration: none;
}

.nav-user:hover { color: var(--accent); }

.nav-logout button {
  background: none;
  color: var(--muted);
  padding: 0;
  font-weight: 500;
  text-decoration: underline;
  font-size: 0.85rem;
}

.stat-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 200px));
  justify-content: start;
  gap: 0.75rem;
  margin: 1rem 0 1.5rem;
}

.stat-card {
  position: relative;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  text-align: center;
  box-shadow: var(--shadow), var(--inset-hairline);
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
  overflow: hidden;
}

.stat-card::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--border);
  transition: background 0.15s ease;
}

.stat-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: var(--accent);
}

.stat-value {
  font-size: 1.7rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.stat-label {
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 0.25rem;
}

.stat-up .stat-value { color: var(--up); }
.stat-up::before { background: var(--up); }

.stat-down .stat-value { color: var(--down); }
.stat-down::before { background: var(--down); }

.mini-bar {
  display: inline-flex;
  overflow: hidden;
  border-radius: 999px;
}

.mini-bar span {
  display: block;
  height: 100%;
}

.range-tabs {
  display: flex;
  gap: 0.5rem;
  margin: 0.75rem 0 1.25rem;
}

.range-tab {
  padding: 0.35rem 0.8rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--muted);
  text-decoration: none;
  font-size: 0.85rem;
}

.range-tab.active {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

.chart-wrap {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.75rem;
  margin-bottom: 0.5rem;
}

.chart-svg {
  width: 100%;
  height: auto;
  display: block;
  cursor: crosshair;
}

.chart-interactive {
  position: relative;
}

.chart-hover-line {
  stroke: var(--muted);
  stroke-width: 1;
  stroke-dasharray: 3 3;
  pointer-events: none;
}

.chart-hover-dot {
  stroke: var(--card);
  stroke-width: 1.5;
  pointer-events: none;
}

.chart-tooltip {
  position: absolute;
  top: 0;
  left: 0;
  opacity: 0;
  pointer-events: none;
  background: var(--text);
  color: var(--bg);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.3rem 0.55rem;
  border-radius: 6px;
  white-space: nowrap;
  transition: opacity 0.08s ease;
  z-index: 5;
}

.chart-grid {
  stroke: var(--border);
  stroke-width: 1;
}

.chart-axis-label {
  fill: var(--muted);
  font-size: 10px;
}

.chart-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 0.85rem;
}

.ranked-bars { cursor: default; }
.ranked-bar-rect { transition: opacity 0.12s ease; }
.ranked-bar-label { font-weight: 600; fill: var(--text); font-size: 11px; }
.ranked-bar-link { cursor: pointer; }
.ranked-bar-link:hover .ranked-bar-rect { opacity: 0.78; }
.ranked-bar-link:hover .ranked-bar-label { fill: var(--accent); }

.export-buttons {
  display: flex;
  gap: 0.5rem;
}

.export-button {
  padding: 0.45rem 0.9rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  color: var(--text);
  text-decoration: none;
  font-size: 0.85rem;
  background: var(--card);
}

.export-button:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.map-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  align-items: center;
  justify-content: center;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1rem;
  margin-bottom: 1.5rem;
}

.map-svg-holder {
  flex: 1 1 320px;
  max-width: 480px;
}

.india-map-svg {
  width: 100%;
  height: auto;
  display: block;
}

.donut-holder {
  flex: 0 0 auto;
  width: 180px;
}

.donut-svg {
  width: 100%;
  height: auto;
  display: block;
}

.donut-total {
  font-size: 28px;
  font-weight: 700;
  fill: var(--text);
}

.donut-total-label {
  font-size: 11px;
  fill: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.india-map-state {
  cursor: pointer;
  transition: opacity 0.15s;
}

.india-map-state:hover {
  opacity: 0.72;
}

.map-legend {
  flex: 1 1 200px;
  max-width: 300px;
  font-size: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  justify-content: center;
}

.map-swatch {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 3px;
  margin-right: 0.4rem;
  vertical-align: middle;
}

.assign-form select {
  min-width: 140px;
  padding: 0.3rem 0.4rem;
  font-size: 0.82rem;
}

.location-form {
  display: flex;
  gap: 0.35rem;
  align-items: center;
}

.location-form select,
.location-form input {
  min-width: 110px;
  padding: 0.3rem 0.4rem;
  font-size: 0.82rem;
}

.location-form button {
  padding: 0.3rem 0.6rem;
  font-size: 0.8rem;
}

.bh-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  padding: 0.6rem 0;
}

.bh-form label {
  gap: 0.25rem;
}

.bh-form input[type="time"] {
  min-width: 110px;
  padding: 0.3rem 0.4rem;
  font-size: 0.82rem;
}

.bh-form button {
  padding: 0.35rem 0.7rem;
  font-size: 0.82rem;
}

.day-toggle-group {
  display: flex;
  gap: 0.3rem;
}

.day-toggle {
  flex-direction: row;
  align-items: center;
  gap: 0.2rem;
  padding: 0.2rem 0.4rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 0.75rem;
  color: var(--muted);
  cursor: pointer;
}

.day-toggle:has(input:checked) {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}

details summary {
  cursor: pointer;
  color: var(--accent);
  font-size: 0.85rem;
}

details .inline-form {
  margin-top: 0.5rem;
}

/* ---------- Auth pages (login / first-run setup) ---------- */

.auth-body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background:
    radial-gradient(circle at 15% 20%, rgba(34, 211, 238, 0.32), transparent 45%),
    radial-gradient(circle at 85% 80%, rgba(99, 102, 241, 0.32), transparent 45%),
    linear-gradient(rgba(59, 130, 246, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(59, 130, 246, 0.05) 1px, transparent 1px),
    linear-gradient(135deg, #060a12, #0c1526 45%, #060a12);
  background-size: auto, auto, 42px 42px, 42px 42px, auto;
  padding: 2rem 1rem;
}

.auth-shell {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  width: 100%;
}

.auth-card {
  position: relative;
  width: 100%;
  max-width: 420px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 2.25rem 2rem;
  overflow: hidden;
}

.auth-card::before, .status-card::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--accent-2), var(--accent), #6366f1);
  box-shadow: 0 0 14px rgba(59, 130, 246, 0.45);
}

.status-shell {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 1100px;
}

.status-stat-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
  margin: 1rem 0 1.5rem;
}

@media (max-width: 640px) {
  .status-stat-cards { grid-template-columns: repeat(2, 1fr); }
}

.maps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.maps-grid .map-wrap {
  margin-bottom: 0;
  flex-direction: column;
}

.maps-grid .map-svg-holder {
  max-width: 100%;
}

.status-weather-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.tabs-nav {
  display: flex;
  gap: 0.25rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

.tabs-tab {
  background: none;
  border: none;
  padding: 0.65rem 1rem;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.tabs-tab:hover { color: var(--text); }
.tabs-tab.active { color: var(--accent); border-bottom-color: var(--accent); }

.tabs-tab .tabs-tab-badge {
  display: inline-block;
  min-width: 1.2em;
  padding: 0 0.35em;
  margin-left: 0.35em;
  border-radius: 999px;
  background: var(--down-soft);
  color: var(--down);
  font-size: 0.75em;
  font-weight: 700;
}

.status-section-title {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin: 2rem 0 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

.status-sites-list {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow), var(--inset-hairline);
  overflow: hidden;
  max-width: 700px;
  margin: 0 auto;
}

.status-site-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem 1.15rem;
  border-bottom: 1px solid var(--border);
  transition: background 0.15s ease;
}

.status-site-row:last-child { border-bottom: none; }
.status-site-row:hover { background: var(--card-2); }

.status-site-info {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  min-width: 0;
}

.status-site-info .dot { margin-right: 0; flex-shrink: 0; width: 10px; height: 10px; }

.status-site-text {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
}

.status-site-name {
  font-weight: 700;
  font-size: 0.95rem;
}

.status-site-sub {
  color: var(--muted);
  font-size: 0.8rem;
}

.status-card {
  position: relative;
  width: 100%;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 2rem 2.25rem;
  overflow: hidden;
}

.status-banner {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 1rem 1.25rem;
  border-radius: 12px;
  font-weight: 600;
  margin-bottom: 1.5rem;
  border: 1px solid transparent;
}

.status-banner.status-ok { background: var(--up-soft); color: var(--up); border-color: rgba(34, 197, 94, 0.25); }
.status-banner.status-partial { background: var(--warn-soft); color: var(--warn); border-color: rgba(245, 158, 11, 0.3); }
.status-banner.status-major { background: var(--down-soft); color: var(--down); border-color: rgba(239, 68, 68, 0.3); }

.status-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  display: inline-block;
}
.status-dot.status-ok { background: var(--up); box-shadow: var(--glow-up); }
.status-dot.status-partial { background: var(--warn); box-shadow: 0 0 10px rgba(245, 158, 11, 0.5); }
.status-dot.status-major { background: var(--down); animation: pulse-glow-down 1.8s ease-in-out infinite; }

.auth-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 1.5rem;
}

.auth-logo {
  height: 64px;
  width: auto;
  background: #f4f6fa;
  border-radius: var(--radius);
  padding: 0.5rem 0.9rem;
  box-sizing: content-box;
  box-shadow: var(--shadow-md);
}

.auth-tagline {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.auth-title {
  text-align: center;
  font-size: 1.35rem;
  margin: 0 0 0.4rem;
}

.auth-subtitle {
  text-align: center;
  color: var(--muted);
  font-size: 0.88rem;
  margin: 0 0 1.5rem;
  line-height: 1.5;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.auth-form label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.85rem;
  color: var(--muted);
  font-weight: 600;
}

.auth-form input {
  padding: 0.65rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  font-size: 0.95rem;
}

.auth-form input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.auth-submit {
  margin-top: 0.4rem;
  padding: 0.75rem 1rem;
  font-size: 0.95rem;
  border-radius: var(--radius-sm);
}

.auth-footer {
  color: var(--muted);
  font-size: 0.78rem;
  text-align: center;
  opacity: 0.8;
}

/* ---------- diagnostics (ping / traceroute / DNS) ---------- */

.diag-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin: 0.75rem 0;
}

.diag-buttons button {
  min-width: 130px;
}

.diag-output {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.85rem;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 420px;
  overflow-y: auto;
  box-shadow: var(--shadow), var(--inset-hairline);
}

.diag-output.diag-fail {
  border-color: var(--down);
  color: var(--down);
}

.diag-output.diag-loading {
  color: var(--muted);
  font-style: italic;
}

.diag-layout {
  display: flex;
  gap: 1.25rem;
  align-items: flex-start;
  flex-wrap: wrap;
}

.cli-terminal {
  background: #0b0d10;
  border: 1px solid #2c3036;
  border-radius: var(--radius);
  padding: 0.9rem 1rem;
  box-shadow: var(--shadow), var(--inset-hairline);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.85rem;
  flex: 1 1 560px;
  max-width: 780px;
}

.cli-reference {
  flex: 0 0 280px;
  background: #16191e;
  border: 1px solid #2c3036;
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  box-shadow: var(--shadow), var(--inset-hairline);
}

.cli-reference h3 {
  margin: 0 0 0.85rem;
  font-size: 0.72rem;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #9aa1ab;
  border-bottom: 1px solid #2c3036;
  padding-bottom: 0.6rem;
}

.cli-ref-row { margin-bottom: 0.95rem; }
.cli-ref-row:last-of-type { margin-bottom: 0; }

.cli-ref-row > code {
  display: inline-block;
  background: rgba(125, 211, 252, 0.12);
  color: #7dd3fc;
  padding: 0.18rem 0.45rem;
  border-radius: 5px;
  font-size: 0.78rem;
  margin-bottom: 0.35rem;
}

.cli-ref-row p {
  margin: 0.25rem 0 0;
  color: #d8dee6;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 0.78rem;
  line-height: 1.5;
}

.cli-ref-row p .muted { color: #767f8c; }

.cli-ref-row p code {
  background: none;
  padding: 0;
  color: #a5b4fc;
  font-size: 0.78rem;
  font-family: inherit;
}

.cli-ref-hint {
  margin: 1rem 0 0;
  padding-top: 0.85rem;
  border-top: 1px solid #2c3036;
  color: #767f8c;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 0.76rem;
}

.cli-output {
  min-height: 320px;
  max-height: 420px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-word;
  color: #d8dee6;
  padding-bottom: 0.5rem;
}

.cli-line-cmd { color: #7dd3fc; }
.cli-line-error { color: #f87171; }
.cli-line-hint { color: #9aa1ab; }
.cli-line-ok { color: #d8dee6; }

.cli-input-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  border-top: 1px solid #2c3036;
  padding-top: 0.6rem;
  margin-top: 0.3rem;
}

.cli-prompt {
  color: #4ade80;
  font-weight: 700;
  white-space: nowrap;
}

.cli-input-row input[type="text"] {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: #f0f1f3;
  font-family: inherit;
  font-size: inherit;
}

.cli-input-row input[type="text"]:disabled {
  color: #6b7280;
}

.row-warning td {
  background: var(--down-soft);
}

.bulk-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.6rem 0.9rem;
  margin-bottom: 0.75rem;
}

.bulk-toolbar select,
.bulk-toolbar input[type="text"] {
  padding: 0.4rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  font-size: 0.85rem;
}
