/* NimbusCloud Ops — Deploy Dashboard
   Internal tool. Nobody spent a design sprint on this. */

:root {
  --bg: #0f1115;
  --bg-raised: #171a21;
  --bg-card: #1b1f28;
  --border: #262b35;
  --text: #e4e7ec;
  --muted: #9aa2b1;
  --accent: #2f6fed;
  --ok: #4ade80;
  --ok-bg: #16321f;
  --warn: #f0c419;
  --warn-bg: #3a2f0f;
  --bad: #f87171;
  --bad-bg: #3a1414;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
}

code, .mono { font-family: var(--mono); font-size: 0.85em; }

a { color: #7aa2f7; }
a:hover { color: #a9c1fa; }

/* ---- top internal-use banner ------------------------------------------ */

.internal-banner {
  background: #3a1414;
  color: #ffb4b4;
  text-align: center;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 0.4rem 1rem;
  border-bottom: 1px solid #5a1f1f;
  position: sticky;
  top: 0;
  z-index: 20;
}

/* ---- shell: sidebar + main -------------------------------------------- */

.app-shell {
  display: flex;
  min-height: calc(100vh - 2rem);
  align-items: stretch;
}

.sidebar {
  width: 220px;
  flex-shrink: 0;
  background: var(--bg-raised);
  border-right: 1px solid var(--border);
  padding: 1.25rem 1rem;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 2rem;
  height: calc(100vh - 2rem);
}

.sidebar-brand {
  font-weight: 700;
  font-size: 1rem;
  margin-bottom: 1.25rem;
  letter-spacing: -0.01em;
}
.sidebar-brand span { color: var(--accent); }
.sidebar-brand small {
  display: block;
  font-weight: 500;
  color: var(--muted);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-top: 0.15rem;
}

.side-nav {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  margin-bottom: 1.5rem;
}

.nav-link {
  display: block;
  padding: 0.45rem 0.6rem;
  border-radius: 5px;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.85rem;
  border-left: 2px solid transparent;
}
.nav-link:hover { background: #1e222b; color: var(--text); }
.nav-link.active {
  background: #1e2a44;
  color: #cfe0ff;
  border-left: 2px solid var(--accent);
}

.sidebar-section { margin-bottom: 1.5rem; }
.sidebar-section-title {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #616b7d;
  margin-bottom: 0.5rem;
}
.side-link {
  display: block;
  font-size: 0.82rem;
  padding: 0.3rem 0.6rem;
  text-decoration: none;
  color: #9db4e0;
}
.side-link:hover { color: #cfe0ff; }

.sidebar-footer {
  margin-top: auto;
  font-size: 0.72rem;
  color: #616b7d;
  line-height: 1.5;
  border-top: 1px solid var(--border);
  padding-top: 0.75rem;
}

.main-wrap {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

/* ---- top bar ------------------------------------------------------------ */

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.85rem 2rem;
  background: var(--bg-raised);
  border-bottom: 1px solid var(--border);
}

.topbar-title { font-weight: 600; font-size: 0.95rem; }
.crumb-root { color: var(--muted); font-weight: 500; }
.crumb-sep { color: #3a4150; margin: 0 0.35rem; }

.user-chip {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  cursor: default;
}

.avatar, .oncall-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: #33406b;
  color: #cfe0ff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  flex-shrink: 0;
}

.user-meta {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
}
.user-name { font-size: 0.85rem; font-weight: 600; }
.user-role { font-size: 0.72rem; color: var(--muted); }

/* ---- main content -------------------------------------------------------- */

main { padding: 1.75rem 2rem; max-width: 920px; }

.panel { margin-bottom: 2.5rem; scroll-margin-top: 1rem; }
.panel h1 { margin: 0 0 0.35rem; font-size: 1.35rem; }
.panel h2 {
  margin: 0 0 0.35rem;
  font-size: 1.05rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.5rem;
}

.muted { color: var(--muted); }

/* ---- stat cards ------------------------------------------------------- */

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

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.85rem 1rem;
}
.stat-value { font-size: 1.3rem; font-weight: 700; }
.stat-label { font-size: 0.72rem; color: var(--muted); margin-top: 0.2rem; }

/* ---- service status grid ---------------------------------------------- */

.status-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.6rem;
  margin-top: 0.85rem;
}

.status-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.7rem 0.9rem;
}

.status-card-top {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.status-name { font-family: var(--mono); font-size: 0.85rem; flex: 1; }

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
}
.status-dot-operational { background: var(--ok); box-shadow: 0 0 0 3px rgba(74, 222, 128, 0.15); }
.status-dot-degraded { background: var(--warn); box-shadow: 0 0 0 3px rgba(240, 196, 25, 0.15); }
.status-dot-down { background: var(--bad); box-shadow: 0 0 0 3px rgba(248, 113, 113, 0.15); }

.status-card-meta { font-size: 0.75rem; margin-top: 0.4rem; }

/* ---- tables ------------------------------------------------------------- */

table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 0.85rem;
  font-size: 0.85rem;
}

th {
  text-align: left;
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
}

td {
  text-align: left;
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--border);
}

tbody tr:hover { background: #171b24; }

/* ---- status pills -------------------------------------------------------- */

.pill {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  white-space: nowrap;
}
.pill-ok { background: var(--ok-bg); color: var(--ok); }
.pill-warn { background: var(--warn-bg); color: var(--warn); }
.pill-bad { background: var(--bad-bg); color: var(--bad); }
.pill-muted { background: #262b35; color: var(--muted); }

/* legacy single-line status indicator, kept for anything still using it */
.status-ok { color: var(--ok); font-weight: 600; }

/* ---- buttons -------------------------------------------------------------- */

button {
  background: var(--accent);
  color: white;
  border: none;
  padding: 0.55rem 1.1rem;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  margin-top: 0.5rem;
}
button:hover { background: #4b82f0; }
button:disabled { background: #3a4150; cursor: progress; }

#backup-result {
  margin-top: 0.6rem;
  font-size: 0.8rem;
  color: var(--muted);
  min-height: 1.2em;
}

/* ---- on-call widget --------------------------------------------------- */

.oncall-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem 1.1rem;
  margin-top: 0.85rem;
}

.oncall-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0;
}
.oncall-row + .oncall-row { border-top: 1px solid var(--border); }

.oncall-name { font-weight: 600; font-size: 0.9rem; }
.oncall-name .pill { margin-left: 0.5rem; vertical-align: middle; }

.oncall-meta {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
  font-size: 0.8rem;
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}

/* ---- footer ------------------------------------------------------------- */

.page-footer {
  padding: 1.25rem 2rem 2rem;
  font-size: 0.72rem;
  border-top: 1px solid var(--border);
  margin-top: auto;
}

/* ---- small screens -------------------------------------------------------- */

@media (max-width: 800px) {
  .app-shell { flex-direction: column; }
  .sidebar {
    width: auto;
    position: static;
    height: auto;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
  }
  .sidebar-brand, .side-nav, .sidebar-section, .sidebar-footer { width: 100%; }
  .side-nav { flex-direction: row; flex-wrap: wrap; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .status-grid { grid-template-columns: 1fr; }
}
