:root {
  --bg: #0b0f1a;
  --panel: #151b2b;
  --panel-raised: #1a2136;
  --border: #263050;
  --text: #e9ecf5;
  --muted: #8a92ab;
  --accent: #6c93ff;
  --good: #36d79a;
  --bad: #ff6b6b;
  --warn: #ffb648;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow-card: 0 1px 0 rgba(255, 255, 255, 0.03) inset, 0 10px 30px -14px rgba(0, 0, 0, 0.55);
  --shadow-panel: -32px 0 60px -10px rgba(0, 0, 0, 0.6);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html { -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(900px 500px at 15% -10%, rgba(108, 147, 255, 0.10), transparent 60%),
    radial-gradient(700px 500px at 100% 0%, rgba(54, 215, 154, 0.06), transparent 55%),
    var(--bg);
  color: var(--text);
  line-height: 1.5;
  padding: 28px 32px 80px;
}

::selection { background: rgba(108, 147, 255, 0.35); }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #232c44; border-radius: 6px; }
::-webkit-scrollbar-thumb:hover { background: #2c3650; }

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

header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 28px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

h1 {
  margin: 0;
  font-size: 23px;
  font-weight: 700;
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  gap: 10px;
}
h1::before {
  content: "";
  display: inline-block;
  width: 11px;
  height: 11px;
  border-radius: 3px;
  background: linear-gradient(135deg, var(--accent), var(--good));
  box-shadow: 0 0 14px rgba(108, 147, 255, 0.5);
}
.subtitle {
  color: var(--muted);
  font-weight: 500;
  font-size: 12px;
  margin-left: 2px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

header .pill { margin-left: auto; }

.card {
  background: linear-gradient(180deg, var(--panel-raised), var(--panel));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  padding: 22px 24px;
  margin-bottom: 20px;
}

h2 { margin: 0 0 16px; font-size: 14px; font-weight: 600; letter-spacing: 0.01em; color: var(--text); }
.hint { color: var(--muted); font-weight: 400; font-size: 12px; margin-left: 8px; }

.card-header-row { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 16px; }
.card-header-row h2 { margin: 0; }

.table-search {
  background: #0b0e17;
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 12px;
  min-width: 180px;
  transition: border-color 0.12s ease;
}
.panel-search { width: 100%; margin-bottom: 14px; }
mark { background: var(--warn); color: #1a1200; border-radius: 2px; padding: 0 1px; }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 14px;
  max-width: 720px;
}

.stat {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
}
.stat-flagged { border-color: var(--bad); background: rgba(255, 107, 107, 0.07); }

.stat-value { font-size: 26px; font-weight: 700; letter-spacing: -0.01em; }
#stat-ready { color: var(--good); }
.stat-flagged .stat-value { color: var(--bad); }
.stat-label { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; margin-top: 2px; }

.phase-breakdown {
  display: flex;
  gap: 8px;
  margin-top: 18px;
  flex-wrap: wrap;
}

.cluster-health-row { display: flex; align-items: center; gap: 12px; margin-top: 16px; }
.cluster-health-label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; flex-shrink: 0; }

.phase-chip {
  padding: 4px 11px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
}
.phase-chip.phase-good { color: var(--good); border-color: rgba(54, 215, 154, 0.35); }
.phase-chip.phase-warn { color: var(--warn); border-color: rgba(255, 182, 72, 0.35); }
.phase-chip.phase-bad { color: var(--bad); border-color: rgba(255, 107, 107, 0.35); }
.phase-chip.phase-accent { color: var(--accent); border-color: rgba(108, 147, 255, 0.35); }

.meta-row {
  margin-top: 16px;
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 12px;
}

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 11px 10px; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-weight: 500; font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; }
tbody tr:last-child td { border-bottom: none; }

#nodes-tbody tr { cursor: pointer; transition: background-color 0.12s ease; }
#nodes-tbody tr:hover { background: rgba(108, 147, 255, 0.07); }
#nodes-tbody tr.selected { background: rgba(108, 147, 255, 0.14); }

.status-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 7px; }
.status-dot.ready { background: var(--good); box-shadow: 0 0 6px rgba(54, 215, 154, 0.6); }
.status-dot.notready { background: var(--bad); box-shadow: 0 0 6px rgba(255, 107, 107, 0.6); }

/* Inline expandable detail rows for the Nodes/Pods tables -- a toggle
   button per row reveals a full-width row underneath with conditions,
   labels, taints, etc., instead of yet another sliding panel. */
.detail-toggle {
  background: none;
  border: 1px solid var(--border);
  color: var(--muted);
  border-radius: 6px;
  width: 26px;
  height: 26px;
  cursor: pointer;
  font-size: 11px;
  transition: background-color 0.12s ease, color 0.12s ease;
}
.detail-toggle:hover { color: var(--text); background: rgba(255, 255, 255, 0.06); }
.detail-toggle.open { color: var(--accent); border-color: var(--accent); }

tr.detail-row { cursor: default; }
tr.detail-row:hover { background: none !important; }
tr.detail-row td { padding: 18px 10px; background: rgba(255, 255, 255, 0.015); }

.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
}
.detail-section h4 {
  margin: 0 0 10px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.kv-list { display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; margin: 0; font-size: 12px; }
.kv-list dt { color: var(--muted); }
.kv-list dd { margin: 0; color: var(--text); word-break: break-word; }

.chip-list { display: flex; flex-wrap: wrap; gap: 6px; }
.kv-chip {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px 9px;
  font-size: 11px;
  color: var(--text);
}

.detail-table { width: 100%; font-size: 12px; }
.detail-table th, .detail-table td { padding: 5px 6px; border-bottom: 1px solid var(--border); }
.detail-table tbody tr:last-child td { border-bottom: none; }
.unschedulable-flag { color: var(--warn); font-weight: 600; }

/* Capacity view, modeled on githubstatus.com's layout: a bold full-width
   "All Systems Operational"-style banner, then one row per node
   ("component") with plain colored status text (no boxed pill, matching
   their minimal look) and a thin per-sample history bar per resource
   underneath -- each segment is one past snapshot, colored by that
   snapshot's status, the same idea as their 90-day uptime bars just at
   "refresh" granularity instead of "day" granularity since this operator
   doesn't persist history across restarts. */
.status-card { padding-top: 0; }
.status-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 24px;
  margin: 0 -24px 20px;
  border-radius: calc(var(--radius) - 1px) calc(var(--radius) - 1px) 0 0;
  font-size: 16px;
  font-weight: 600;
  color: #fff;
}
.status-banner.nominal,
.status-banner.operational { background: var(--good); color: #05140c; }
.status-banner.elevated,
.status-banner.degraded { background: var(--warn); color: #211400; }
.status-banner.critical,
.status-banner.outage { background: var(--bad); color: #1c0303; }
#status-banner-icon { flex-shrink: 0; }

.progress-track {
  position: relative;
  height: 10px;
  border-radius: 999px;
  background: var(--border);
  /* Deliberately no overflow:hidden here -- it's the fill's own
     border-radius that keeps it looking rounded (it matches the
     track's radius), and clipping here would also clip the
     ::after tooltip this element gets via .has-tooltip. */
}
.progress-track.nodata { background: rgba(255, 255, 255, 0.09); }
.progress-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.3s ease, background-color 0.3s ease;
}
.progress-fill.nominal, .progress-fill.operational { background: var(--good); }
.progress-fill.elevated, .progress-fill.degraded { background: var(--warn); }
.progress-fill.critical, .progress-fill.outage { background: var(--bad); }

/* Compact capacity bar used directly inside a Nodes table cell (CPU /
   Memory columns) -- folded in from what used to be a separate per-node
   "Capacity" list, so there's one place per node instead of two. The
   exact percentage is a hover tooltip, not printed text, to keep the
   table quiet at a glance. */
.table-bar { display: flex; align-items: center; }
.table-bar .table-track { width: 110px; cursor: default; }

/* Pod health history: one tick per past check (polled every few seconds
   while the pods panel is open), colored by that check's status --
   githubstatus.com's actual day-tile model, which fits here (a genuine
   discrete sample over time) unlike the single current percentage the
   capacity bars show. */
.history-bar { display: flex; gap: 2px; width: 150px; height: 16px; }
.history-segment { flex: 1 1 0; height: 100%; border-radius: 2px; background: var(--border); cursor: default; }
.history-segment.operational { background: var(--good); }
.history-segment.degraded { background: var(--warn); }
.history-segment.outage { background: var(--bad); }
.history-segment.nodata { background: rgba(255, 255, 255, 0.09); }

/* A custom tooltip instead of the native title="" attribute: shows
   instantly on hover/focus, styled to match the theme, instead of
   whatever delay/styling the browser feels like giving a native one. */
.has-tooltip { position: relative; }
.has-tooltip::after {
  content: attr(data-tooltip);
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: #0b0e17;
  color: var(--text);
  border: 1px solid var(--border);
  padding: 5px 9px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.45);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.1s ease;
  z-index: 30;
}
.has-tooltip:hover::after,
.has-tooltip:focus-visible::after {
  opacity: 1;
  visibility: visible;
}

.status-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: 16px;
  color: var(--muted);
  font-size: 11px;
}
.status-legend span { display: flex; align-items: center; gap: 6px; }
.legend-swatch { display: inline-block; width: 11px; height: 11px; border-radius: 2px; }
.legend-swatch.operational { background: var(--good); }
.legend-swatch.degraded { background: var(--warn); }
.legend-swatch.outage { background: var(--bad); }
.legend-swatch.nodata { background: rgba(255, 255, 255, 0.09); }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.02);
}
.pill::before { content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill-ok { color: var(--good); border-color: rgba(54, 215, 154, 0.35); }
.pill-ok::before { animation: pulse-dot 1.8s ease-in-out infinite; }
.pill-bad { color: var(--bad); border-color: rgba(255, 107, 107, 0.35); }
.pill-unknown { color: var(--muted); }

@keyframes pulse-dot {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(54, 215, 154, 0.5); }
  50% { opacity: 0.6; box-shadow: 0 0 0 4px rgba(54, 215, 154, 0); }
}

.panel {
  position: fixed;
  top: 12px;
  right: 12px;
  bottom: 12px;
  width: min(640px, 92vw);
  background: linear-gradient(180deg, var(--panel-raised), var(--panel));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  overflow-y: auto;
  z-index: 10;
  box-shadow: var(--shadow-panel);
  transition: transform 0.2s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.2s ease;
}
.panel.hidden { transform: translateX(16px); opacity: 0; visibility: hidden; }

/* The pods table grew a Containers column and a 150px-wide Health
   history column, so it needs more room than the default panel width
   to avoid feeling cramped. */
.panel.panel-wide { width: min(920px, 95vw); }

.panel-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; padding-bottom: 14px; border-bottom: 1px solid var(--border); }
.panel-header button {
  display: flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; border-radius: 50%;
  background: none; border: none; color: var(--muted); font-size: 20px; cursor: pointer; line-height: 1;
  transition: background-color 0.12s ease, color 0.12s ease;
}
.panel-header button:hover { color: var(--text); background: rgba(255, 255, 255, 0.06); }

/* A near-black page background means a plain alpha overlay is barely
   visible, so this leans on a blur (and a darker alpha) rather than
   darkening alone to make it obvious the base page is inert. */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(2px);
  z-index: 5;
}
.overlay.hidden { display: none; }

.container-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; width: 100%; }
.container-row { display: flex; align-items: baseline; white-space: nowrap; }
.container-name { overflow: hidden; text-overflow: ellipsis; max-width: 220px; }

/* The container name itself opens its logs (instead of a separate "logs"
   link next to a plain-text name), styled like a hyperlink so it's
   obvious it's clickable. */
.container-name-link {
  color: var(--accent);
  cursor: pointer;
  text-decoration: underline;
  text-decoration-color: rgba(108, 147, 255, 0.4);
  transition: opacity 0.12s ease;
}
.container-name-link:hover { opacity: 0.75; text-decoration-color: var(--accent); }

.logs-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
  font-size: 12px;
  color: var(--muted);
}
.logs-toolbar label { display: flex; align-items: center; gap: 4px; }
.logs-toolbar select,
.logs-toolbar input[type="search"] {
  background: #0b0e17;
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 6px;
  padding: 5px 8px;
  font-size: 12px;
  transition: border-color 0.12s ease;
}
.logs-toolbar input[type="search"] { flex: 1; min-width: 100px; }
.logs-check { cursor: pointer; }

.logs-actions { display: flex; gap: 8px; margin-bottom: 10px; }
.logs-actions button {
  background: var(--panel-raised);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 6px;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.12s ease, border-color 0.12s ease;
}
.logs-actions button:hover { background: #28335a; border-color: var(--accent); }

.logs-error {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  background: rgba(255, 107, 107, 0.12);
  border: 1px solid var(--bad);
  color: var(--bad);
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 12px;
  margin-bottom: 10px;
}
.logs-error.hidden { display: none; }
.logs-error-dismiss {
  margin-left: auto;
  background: none;
  border: none;
  color: var(--bad);
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  flex-shrink: 0;
}

#logs-content {
  background: #0b0e17;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 12px;
  font-size: 12px;
  white-space: pre;
  word-break: normal;
  max-height: calc(100vh - 230px);
  overflow: auto;
}
#logs-content.wrap { white-space: pre-wrap; word-break: break-all; }

.small-muted { color: var(--muted); font-size: 11px; }

/* Consistent focus ring across every interactive element, instead of each
   browser's default (or a missing one). */
a:focus-visible,
button:focus-visible,
select:focus-visible,
input:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}
