:root {
  --bg: #0f1115;
  --panel: #171a21;
  --panel-2: #1e222b;
  --text: #e6e8ec;
  --muted: #9aa3b2;
  --accent: #4f8cff;
  --border: #2a2f3a;
  --ok: #2ea043;
  --warn: #d29922;
  --err: #f85149;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

.topbar {
  display: flex; align-items: center; gap: 1.5rem;
  padding: 0.75rem 1.25rem;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
}
.brand { font-weight: 700; color: var(--text); text-decoration: none; font-size: 1.05rem; }
.topbar nav { display: flex; align-items: center; gap: 1rem; flex: 1; }
.topbar nav a { color: var(--muted); text-decoration: none; font-size: 0.9rem; }
.topbar nav a:hover { color: var(--text); }
.topbar .spacer { flex: 1; }
.topbar .who { color: var(--muted); font-size: 0.85rem; }
.topbar .logout { color: var(--accent); }

main { max-width: 960px; margin: 2rem auto; padding: 0 1.25rem; }
h1 { font-size: 1.5rem; margin-top: 0; }
h2 { font-size: 1.15rem; }
.muted { color: var(--muted); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.85em; }

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.25rem;
  margin: 1rem 0;
}
.card.narrow { max-width: 420px; margin: 3rem auto; }
a.card.tool { display: block; text-decoration: none; color: var(--text); transition: border-color .15s; }
a.card.tool:hover { border-color: var(--accent); }

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

form label { display: block; margin: 0.75rem 0; color: var(--muted); font-size: 0.85rem; }
form input, form select {
  display: block; width: 100%; margin-top: 0.3rem;
  padding: 0.55rem 0.65rem;
  background: var(--panel-2); color: var(--text);
  border: 1px solid var(--border); border-radius: 6px;
  font-size: 0.95rem;
}
form .check { display: flex; align-items: center; gap: 0.5rem; }
form .check input { width: auto; margin: 0; }

button, .btn {
  display: inline-block; cursor: pointer; text-decoration: none;
  background: var(--accent); color: #fff; border: none;
  padding: 0.6rem 1.1rem; border-radius: 6px; font-size: 0.95rem; font-weight: 600;
  margin-top: 0.5rem;
}
.btn { background: var(--panel-2); border: 1px solid var(--border); color: var(--text); margin-right: 0.5rem; }
button:hover { filter: brightness(1.1); }

.rowform { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 1rem; }
.rowform label { margin: 0; flex: 1 1 120px; }
.rowform button { margin: 0; }

.error { color: var(--err); }
.secret { background: var(--panel-2); padding: 0.4rem 0.6rem; border-radius: 6px; letter-spacing: 2px; }
.qr { text-align: center; margin: 1rem 0; }
.qr img { background: #fff; padding: 8px; border-radius: 8px; }

table { width: 100%; border-collapse: collapse; margin: 0.75rem 0; font-size: 0.9rem; }
th, td { text-align: left; padding: 0.45rem 0.6rem; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-weight: 600; }

.badge { padding: 0.1rem 0.5rem; border-radius: 999px; font-size: 0.78rem; font-weight: 600; }
.badge.done { background: rgba(46,160,67,.18); color: #5fd87a; }
.badge.running, .badge.queued { background: rgba(210,153,34,.18); color: #e3b341; }
.badge.error { background: rgba(248,81,73,.18); color: #ff7b72; }

.spinner::before {
  content: ""; display: inline-block; width: 14px; height: 14px;
  margin-right: 8px; vertical-align: -2px;
  border: 2px solid var(--muted); border-top-color: var(--accent);
  border-radius: 50%; animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.errbox { background: #1a0e0e; color: #ff9b94; padding: 1rem; border-radius: 6px; overflow-x: auto; white-space: pre-wrap; font-size: 0.82rem; }

/* Rendered Markdown report */
.report { background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 1.5rem 1.75rem; }
.report h1 { font-size: 1.4rem; }
.report h2 { font-size: 1.1rem; border-bottom: 1px solid var(--border); padding-bottom: 0.3rem; margin-top: 1.75rem; }
.report h3 { font-size: 0.98rem; color: var(--muted); }
.report code { background: var(--panel-2); padding: 0.1rem 0.35rem; border-radius: 4px; font-size: 0.85em; }
.report table { font-size: 0.82rem; }
.report table code { background: transparent; padding: 0; }
.report th { background: var(--panel-2); }
.report pre { background: var(--panel-2); padding: 1rem; border-radius: 6px; overflow-x: auto; }
/* readable links inside the rendered report */
.report a { color: #6db3ff; text-decoration: underline; }
.report a:hover { color: #9ecbff; }
/* Grafana deep-links rendered as a high-contrast pill */
.report a[href*="grafana"] {
  display: inline-block; text-decoration: none; font-weight: 700;
  color: #07101f; background: #4cc2ff;
  padding: 0.06rem 0.55rem; border-radius: 999px; font-size: 0.82em;
  line-height: 1.5; white-space: nowrap;
}
.report a[href*="grafana"]:hover { background: #7ad1ff; color: #07101f; }
.report em a[href*="grafana"] { font-style: normal; }

/* status banner extras */
.status-banner .thr { color: var(--muted); font-size: 0.85em; }
.summary-para {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 8px; padding: 0.8rem 1rem; margin: 0.5rem 0 1rem;
  font-size: 0.92rem;
}

/* Incident status banner */
.status-banner {
  display: flex; gap: 1.25rem; align-items: flex-start;
  border: 1px solid var(--border); border-left-width: 6px;
  border-radius: 10px; padding: 1rem 1.25rem; margin: 1rem 0;
  background: var(--panel);
}
.status-banner .status-label { font-size: 1.15rem; font-weight: 800; white-space: nowrap; padding-top: 0.1rem; }
.status-banner .status-detail { font-size: 0.9rem; }
.status-banner .status-detail ul { margin: 0.25rem 0 0.6rem 1rem; padding: 0; }
.status-banner .status-read { color: var(--muted); margin-top: 0.4rem; }
.status-banner.critical { border-left-color: var(--err); background: rgba(248,81,73,.08); }
.status-banner.critical .status-label { color: #ff7b72; }
.status-banner.degraded { border-left-color: var(--warn); background: rgba(210,153,34,.08); }
.status-banner.degraded .status-label { color: #e3b341; }
.status-banner.nominal { border-left-color: var(--ok); background: rgba(46,160,67,.08); }
.status-banner.nominal .status-label { color: #5fd87a; }

.foot { text-align: center; color: var(--muted); font-size: 0.8rem; padding: 2rem 0; }
