:root {
  --navy: #0d2b4a;
  --navy-deep: #081b30;
  --navy-soft: #1b4a75;
  --accent: #2fa86a;
  --accent-soft: #e6f6ee;
  --bg: #f3f5f8;
  --surface: #ffffff;
  --border: #e6e9ee;
  --text: #16202b;
  --text-muted: #6b7686;
  --text-faint: #97a1af;
  --ok: #1c7a44;
  --ok-bg: #e9f8ef;
  --critical: #c22b2b;
  --critical-bg: #fdedec;
  --unknown: #a8710a;
  --unknown-bg: #fdf3e0;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(16, 30, 50, 0.04), 0 4px 16px rgba(16, 30, 50, 0.05);
  --shadow-lift: 0 2px 4px rgba(16, 30, 50, 0.06), 0 12px 28px rgba(16, 30, 50, 0.09);
}
* { box-sizing: border-box; }
html { color-scheme: light; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--navy-soft); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ──────────────────────────── Topbar ──────────────────────────── */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(180deg, var(--navy) 0%, var(--navy-deep) 100%);
  color: #fff;
  padding: 0.7rem 1.75rem;
  box-shadow: 0 2px 10px rgba(6, 16, 28, 0.25);
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar-brand {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  font-weight: 700;
  font-size: 1.02rem;
  letter-spacing: 0.01em;
}
.brand-badge {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: radial-gradient(circle at 32% 28%, #4fd493, var(--accent) 55%, var(--navy) 130%);
  flex-shrink: 0;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.18);
}
.topbar nav {
  display: flex;
  gap: 0.35rem;
}
.topbar nav a {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  color: rgba(255, 255, 255, 0.68);
  text-decoration: none;
  font-size: 0.86rem;
  font-weight: 600;
  padding: 0.45rem 0.85rem;
  border-radius: 999px;
  transition: background 0.15s ease, color 0.15s ease;
}
.topbar nav a svg { width: 15px; height: 15px; opacity: 0.85; }
.topbar nav a.active,
.topbar nav a:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
  text-decoration: none;
}
.topbar-actions button {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.28);
  color: rgba(255, 255, 255, 0.9);
  padding: 0.4rem 1rem;
  border-radius: 999px;
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 600;
  transition: background 0.15s ease;
}
.topbar-actions button:hover { background: rgba(255, 255, 255, 0.12); }

.content { max-width: 1180px; margin: 0 auto; padding: 2rem 1.75rem 3rem; }

.page-header { margin-bottom: 1.5rem; }
.page-header h1 { margin: 0 0 0.2rem; font-size: 1.4rem; color: var(--navy); letter-spacing: -0.01em; }
.page-header p { margin: 0; color: var(--text-muted); font-size: 0.9rem; }

/* ──────────────────────────── Cards ──────────────────────────── */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.4rem 1.6rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow);
}
.card-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.1rem;
}
.card h2 {
  margin: 0;
  font-size: 0.95rem;
  color: var(--navy);
  font-weight: 700;
  letter-spacing: -0.005em;
}
.card-header .metric-now {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--navy);
}
.card-header .metric-now .unit { font-size: 0.85rem; color: var(--text-muted); font-weight: 500; margin-left: 0.15rem; }
.card-subtitle { color: var(--text-muted); font-size: 0.78rem; margin: -0.7rem 0 1rem; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
@media (max-width: 860px) { .grid-2 { grid-template-columns: 1fr; } }

/* ──────────────────────────── Status pills ──────────────────────────── */

.status-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.85rem;
}
.status-pill {
  border-radius: var(--radius-sm);
  padding: 1rem 1.1rem;
  display: flex;
  align-items: center;
  gap: 0.7rem;
}
.status-pill .dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.status-pill .text-block { display: flex; flex-direction: column; gap: 0.15rem; }
.status-pill .label { font-size: 0.74rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; font-weight: 600; }
.status-pill .value { font-size: 1rem; font-weight: 700; }
.status-ok { background: var(--ok-bg); }
.status-ok .value { color: var(--ok); }
.status-ok .dot { background: var(--ok); }
.status-critical { background: var(--critical-bg); }
.status-critical .value { color: var(--critical); }
.status-critical .dot { background: var(--critical); }
.status-unknown { background: var(--unknown-bg); }
.status-unknown .value { color: var(--unknown); }
.status-unknown .dot { background: var(--unknown); }

.hero-banner {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.1rem 1.4rem;
  border-radius: var(--radius);
  margin-bottom: 1.5rem;
  font-weight: 700;
  font-size: 1rem;
}
.hero-banner svg { width: 26px; height: 26px; flex-shrink: 0; }
.hero-banner.hero-ok { background: var(--ok-bg); color: var(--ok); }
.hero-banner.hero-critical { background: var(--critical-bg); color: var(--critical); }
.hero-banner.hero-unknown { background: var(--unknown-bg); color: var(--unknown); }

/* ──────────────────────────── Tables ──────────────────────────── */

.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
th {
  text-align: left;
  color: var(--text-muted);
  font-size: 0.71rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 700;
  padding: 0.55rem 0.7rem;
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}
td { padding: 0.6rem 0.7rem; border-bottom: 1px solid #f0f2f5; vertical-align: middle; }
tbody tr:hover { background: #fafbfc; }
tbody tr:last-child td { border-bottom: none; }
.table-max { max-height: 340px; overflow-y: auto; }

.badge { display: inline-flex; align-items: center; gap: 0.3rem; padding: 0.2rem 0.65rem; border-radius: 999px; font-size: 0.72rem; font-weight: 700; }
.badge-ok { background: var(--ok-bg); color: var(--ok); }
.badge-critical { background: var(--critical-bg); color: var(--critical); }
.badge-unknown { background: var(--unknown-bg); color: var(--unknown); }

/* ──────────────────────────── Toolbar / controls ──────────────────────────── */

.toolbar { display: flex; gap: 0.75rem; align-items: center; flex-wrap: wrap; margin-bottom: 1rem; }
select, button.primary {
  padding: 0.55rem 1rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  font-size: 0.86rem;
  font-family: inherit;
}
select { background: var(--surface); color: var(--text); }
button.primary {
  background: var(--navy);
  color: #fff;
  border: none;
  cursor: pointer;
  font-weight: 700;
}
button.primary:hover { background: var(--navy-deep); }
button.primary:disabled { opacity: 0.55; cursor: default; }

.muted { color: var(--text-muted); font-size: 0.85rem; }
.empty-state { color: var(--text-faint); font-size: 0.85rem; padding: 1.2rem 0; text-align: center; }

/* ──────────────────────────── Login (index.html) ──────────────────────────── */
.login-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(circle at 20% 10%, rgba(47, 168, 106, 0.18), transparent 45%),
    radial-gradient(circle at 100% 100%, rgba(27, 74, 117, 0.35), transparent 55%),
    linear-gradient(160deg, var(--navy) 0%, var(--navy-deep) 100%);
  padding: 1.5rem;
}
.login-card {
  background: var(--surface);
  border-radius: 18px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
  padding: 3rem 2.6rem;
  width: 100%;
  max-width: 380px;
  text-align: center;
}
.login-card .brand-badge { width: 60px; height: 60px; margin: 0 auto 1.25rem; }
.login-card h1 { font-size: 1.3rem; margin: 0 0 0.4rem; color: var(--navy); letter-spacing: -0.01em; }
.login-card p { color: var(--text-muted); font-size: 0.88rem; margin: 0 0 1.75rem; }
.login-card button {
  width: 100%;
  padding: 0.8rem;
  border-radius: var(--radius-sm);
  border: none;
  background: var(--navy);
  color: #fff;
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  transition: background 0.15s ease;
}
.login-card button:hover { background: var(--navy-deep); }

/* ──────────────────────────── Callback (spinner) ──────────────────────────── */
.callback-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
}
.spinner {
  width: 34px;
  height: 34px;
  border: 3px solid #e2e6ea;
  border-top-color: var(--navy);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 1rem;
}
@keyframes spin { to { transform: rotate(360deg); } }
