:root {
  --bg: #0a0f1e;
  --bg2: #0e1528;
  --card: #121a30;
  --border: #1e2a4a;
  --text: #e8edf7;
  --muted: #8b98b8;
  --accent: #22d3ee;
  --accent-dim: #0e7490;
  --green: #22c55e;
  --red: #ef4444;
  --yellow: #eab308;
  --blue: #3b82f6;
  --radius: 10px;
  --wrap: 1100px;
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  min-height: 100vh;
}

/* ---------- login ---------- */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 40px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(34, 211, 238, 0.05);
}

.logo {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.5px;
  margin-bottom: 8px;
}
.logo .dot { color: var(--accent); }

.login-card h1 { font-size: 20px; margin-bottom: 4px; }
.login-card p.sub { color: var(--muted); margin-bottom: 24px; font-size: 14px; }

.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; font-weight: 600; }
.field input {
  width: 100%;
  background: var(--bg);
  border: 1px solid #2b3c63;
  border-radius: 8px;
  color: var(--text);
  padding: 12px 14px;
  font-size: 15px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.field input::placeholder { color: #5b6a8c; }
.field input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.16);
}
.login-card .btn-block { padding: 12px 20px; margin-top: 4px; }

.btn {
  display: inline-block;
  background: var(--accent);
  color: #06202a;
  border: none;
  border-radius: 6px;
  padding: 10px 20px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}
.btn:hover { filter: brightness(1.1); }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn-ghost {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent-dim);
}
.btn-danger {
  background: transparent;
  color: var(--red);
  border: 1px solid var(--red);
  font-size: 13px;
  padding: 6px 12px;
}
.btn-small { font-size: 13px; padding: 7px 14px; }

.form-error {
  color: var(--red);
  font-size: 13px;
  margin-bottom: 12px;
  min-height: 18px;
}
.btn-block { width: 100%; }

/* ---------- layout ---------- */
.layout { display: flex; min-height: 100vh; }

.sidebar {
  width: 230px;
  background: var(--bg2);
  border-right: 1px solid var(--border);
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}
.sidebar .logo { font-size: 22px; margin-bottom: 28px; padding: 0 8px; }
.nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  text-decoration: none;
  padding: 10px 12px;
  border-radius: 6px;
  margin-bottom: 4px;
  font-size: 14px;
}
.nav a:hover { background: var(--card); color: var(--text); }
.nav a.active { background: var(--card); color: var(--accent); }
.nav-icon {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
  opacity: 0.8;
}
.nav a.active .nav-icon { opacity: 1; }
.sidebar-foot {
  margin-top: auto;
  padding: 12px 8px 0;
  border-top: 1px solid var(--border);
  font-size: 13px;
  color: var(--muted);
}
.sidebar-foot button {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
  padding: 0;
  margin-top: 6px;
}
.sidebar-foot button:hover { color: var(--red); }
.agent-status { font-size: 12px; margin-top: 10px; color: var(--muted); line-height: 1.6; }
.agent-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted);
  margin-right: 6px;
}
.agent-dot.on { background: var(--green); box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.2); }

.main { flex: 1; padding: 32px; max-width: var(--wrap); }
.page-head { margin-bottom: 24px; }
.page-head h1 { font-size: 24px; letter-spacing: -0.5px; }
.page-head p { color: var(--muted); font-size: 14px; margin-top: 4px; }

/* ---------- cards ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
}
.card h2 { font-size: 17px; margin-bottom: 12px; }
.card h2 a { color: var(--text); text-decoration: none; }
.card h2 a:hover { color: var(--accent); }

.app-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.env-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-top: 1px solid var(--border);
}
.env-row:first-of-type { border-top: none; }
.env-name { font-weight: 600; text-transform: capitalize; }
.env-meta { color: var(--muted); font-size: 13px; margin-left: 12px; }

/* ---------- verdict badges ---------- */
.badge {
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.5px;
  padding: 4px 10px;
  border-radius: 20px;
  text-transform: uppercase;
}
.badge-healthy { background: rgba(34, 197, 94, 0.15); color: var(--green); }
.badge-unhealthy { background: rgba(239, 68, 68, 0.15); color: var(--red); }
.badge-no_data { background: rgba(234, 179, 8, 0.15); color: var(--yellow); }
.badge-running { background: rgba(59, 130, 246, 0.15); color: var(--blue); }
.badge-none { background: rgba(139, 152, 184, 0.15); color: var(--muted); }

.verdict-banner {
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
  border: 1px solid var(--border);
}
.verdict-banner.healthy { border-left: 4px solid var(--green); }
.verdict-banner.unhealthy { border-left: 4px solid var(--red); }
.verdict-banner.no_data { border-left: 4px solid var(--yellow); }
.verdict-banner h2 { margin-bottom: 4px; }
.verdict-banner p { color: var(--muted); font-size: 14px; }

/* ---------- tables / lists ---------- */
.run-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-top: 1px solid var(--border);
  text-decoration: none;
  color: var(--text);
}
.run-row:first-of-type { border-top: none; }
a.run-row:hover .run-id { color: var(--accent); }
.run-id { font-family: monospace; font-size: 13px; }
.run-meta { color: var(--muted); font-size: 13px; }

.check-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 10px 0;
  border-top: 1px solid var(--border);
}
.check-row:first-of-type { border-top: none; }
.check-name { font-family: monospace; font-size: 14px; }
.check-detail { color: var(--muted); font-size: 13px; margin-top: 2px; }

.why-box {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 14px 16px;
  font-size: 14px;
  color: var(--muted);
  margin-top: 12px;
}
.why-box strong { color: var(--text); }

.empty {
  color: var(--muted);
  text-align: center;
  padding: 48px 20px;
  font-size: 14px;
}

.masked {
  font-family: monospace;
  font-size: 13px;
  color: var(--muted);
  background: var(--bg2);
  padding: 8px 12px;
  border-radius: 6px;
  display: inline-block;
  margin: 8px 0;
}

.row-actions { display: flex; gap: 8px; align-items: center; margin-top: 12px; }
.test-result { font-size: 13px; margin-left: 8px; }
.test-result.ok { color: var(--green); }
.test-result.fail { color: var(--red); }

.back-link {
  display: inline-block;
  color: var(--muted);
  text-decoration: none;
  font-size: 14px;
  margin-bottom: 16px;
}
.back-link:hover { color: var(--accent); }

/* ---------- overview (mirrors the prototype layout, our identity) ---------- */
.date-line {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1.5px;
  color: var(--accent);
  margin-bottom: 6px;
}
.greet { font-size: 30px; letter-spacing: -0.5px; }
.metrics {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin: 20px 0 16px;
}
.metric { margin-bottom: 0; }
.metric-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.metric-label { color: var(--muted); font-size: 13px; }
.metric-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--bg2);
  color: var(--muted);
}
.metric-icon svg { width: 16px; height: 16px; }
.metric-icon.tint-cyan { background: rgba(34, 211, 238, 0.12); color: var(--accent); }
.metric-icon.tint-green { background: rgba(34, 197, 94, 0.12); color: var(--green); }
.metric-icon.tint-blue { background: rgba(59, 130, 246, 0.12); color: var(--blue); }
.metric-icon.tint-amber { background: rgba(234, 179, 8, 0.14); color: var(--yellow); }
.metric-value { font-size: 28px; font-weight: 700; letter-spacing: -0.5px; }
.metric-sub { color: var(--muted); font-size: 12px; margin-top: 4px; }
.overview-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}
.overview-grid .card { margin-bottom: 16px; }
.ring-card { display: flex; align-items: center; gap: 18px; }
.ring { width: 110px; height: 110px; flex-shrink: 0; }
.ring-num { fill: var(--text); font-size: 26px; font-weight: 700; }
.ring-card .sub { color: var(--muted); font-size: 13px; margin-top: 4px; }
.timeline { display: flex; flex-direction: column; }
.t-item {
  display: flex;
  gap: 12px;
  padding: 10px 0;
  border-top: 1px solid var(--border);
}
.t-item:first-child { border-top: none; }
.t-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-top: 5px;
  flex-shrink: 0;
}
.t-ok { background: var(--green); box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.18); }
.t-warn { background: var(--yellow); box-shadow: 0 0 0 3px rgba(234, 179, 8, 0.18); }
.t-bad { background: var(--red); box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.18); }
.t-text { font-size: 14px; font-weight: 600; }
.t-detail { color: var(--muted); font-size: 12px; margin-top: 2px; }
@media (max-width: 1100px) {
  .metrics { grid-template-columns: repeat(2, 1fr); }
  .overview-grid { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  .layout { flex-direction: column; }
  .sidebar {
    width: 100%;
    height: auto;
    position: static;
    flex-direction: row;
    align-items: center;
    padding: 12px 16px;
  }
  .sidebar .logo { margin-bottom: 0; margin-right: 16px; }
  .nav { display: flex; gap: 4px; }
  .nav a span { display: none; }
  .nav a { padding: 10px; }
  .sidebar-foot { display: none; }
  .main { padding: 20px 16px; }
}
