:root {
  color-scheme: dark;
  --bg: #0d0d0d;
  --panel: #1b1b1b;
  --panel-2: #202020;
  --text: #ffffff;
  --muted: rgba(255,255,255,0.72);
  --muted-2: rgba(255,255,255,0.50);
  --accent: #ffc517;
  --accent-soft: rgba(255,197,23,0.15);
  --line: rgba(255,255,255,0.08);
  --green: #4ade80;
  --red: #fb7185;
  --yellow: #fbbf24;
  --radius: 12px;
  --radius-sm: 8px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { background: #080808; }
body {
  min-height: 100vh;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  padding: 12px;
  -webkit-font-smoothing: antialiased;
}

.shell { max-width: 720px; margin: 0 auto; }

/* ----- Hero ----- */
.hero {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 0 12px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 12px;
}
.hero-brand { display: flex; align-items: baseline; gap: 8px; }
.brand-mark {
  font-size: 22px; font-weight: 700;
  background: linear-gradient(135deg, var(--accent), #f59e0b);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}
.brand-sub { font-size: 13px; color: var(--muted-2); }
.hero-actions { display: flex; align-items: center; gap: 8px; }
.refresh-hint { font-size: 11px; color: var(--muted-2); }

/* ----- Buttons ----- */
.button {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 6px 14px; font-size: 13px; font-weight: 500;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  cursor: pointer;
  transition: background .15s;
}
.button:active { background: var(--panel-2); }
.button-ghost { border: none; background: transparent; color: var(--accent); }
.button-ghost:active { background: var(--accent-soft); }
.button:disabled { opacity: 0.5; pointer-events: none; }

/* ----- Status line ----- */
.status-line { padding: 0 0 8px; font-size: 13px; color: var(--muted); min-height: 20px; }

/* ----- Summary grid ----- */
.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 8px;
  margin-bottom: 16px;
}
.stat-card {
  background: var(--panel);
  border-radius: var(--radius);
  border: 1px solid var(--line);
  padding: 10px 12px;
  text-align: center;
}
.stat-value { font-size: 20px; font-weight: 700; line-height: 1.2; }
.stat-label { font-size: 11px; color: var(--muted-2); margin-top: 2px; }
.stat-ok { color: var(--green); }
.stat-warn { color: var(--yellow); }
.stat-error { color: var(--red); }
.stat-neutral { color: var(--text); }

/* ----- Section ----- */
.section { margin-bottom: 20px; }
.section-title {
  font-size: 13px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.05em; color: var(--muted-2);
  margin-bottom: 8px; padding: 0 4px;
}

/* ----- Cards ----- */
.card-list { display: flex; flex-direction: column; gap: 8px; }
.card {
  background: var(--panel);
  border-radius: var(--radius);
  border: 1px solid var(--line);
  padding: 12px 14px;
  transition: border-color .15s;
}
.card-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 8px; margin-bottom: 6px;
}
.card-title { font-size: 14px; font-weight: 600; }
.card-subtitle { font-size: 12px; color: var(--muted-2); margin-top: 1px; word-break: break-all; }
.card-body { font-size: 13px; color: var(--muted); line-height: 1.5; }
.card-meta { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: 12px; color: var(--muted-2); margin-top: 6px; }

/* lifecycle */
.lifecycle { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 500; }
.lifecycle-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.lifecycle-healthy .lifecycle-dot { background: var(--green); }
.lifecycle-degraded .lifecycle-dot { background: var(--yellow); }
.lifecycle-stale .lifecycle-dot { background: var(--muted-2); }
.lifecycle-quarantined .lifecycle-dot { background: var(--red); }
.lifecycle-revoked .lifecycle-dot { background: var(--muted-2); }
.lifecycle-disabled .lifecycle-dot { background: var(--muted-2); }
.lifecycle-unavailable .lifecycle-dot { background: var(--muted-2); }

/* ----- Modes ----- */
.modes { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.mode-tag {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px; padding: 2px 8px; border-radius: 4px;
  background: var(--panel-2); color: var(--muted-2);
}
.mode-tag-active { background: rgba(74,222,128,0.12); color: var(--green); }
.mode-tag-suppressed { background: rgba(251,113,133,0.12); color: var(--red); }
.mode-tag-unpublished { background: rgba(251,191,36,0.12); color: var(--yellow); }
.mode-tag-unavailable { background: var(--panel-2); color: var(--muted-2); }
.mode-tag-ineligible { background: var(--panel-2); color: var(--muted-2); }
.mode-tag-disabled { background: var(--panel-2); color: var(--muted-2); }

/* ----- System card ----- */
.system-card { font-size: 13px; color: var(--muted); line-height: 1.7; }
.system-row { display: flex; justify-content: space-between; gap: 8px; }
.system-row + .system-row { border-top: 1px solid var(--line); padding-top: 6px; margin-top: 6px; }
.system-label { color: var(--muted-2); }
.system-value { font-weight: 500; text-align: right; }
.system-ok { color: var(--green); }
.system-warn { color: var(--yellow); }
.system-error { color: var(--red); }

/* ----- Issues ----- */
.issues-card { font-size: 13px; line-height: 1.6; }
.issue-item { padding: 6px 0; display: flex; align-items: flex-start; gap: 8px; }
.issue-item + .issue-item { border-top: 1px solid var(--line); }
.issue-icon { flex-shrink: 0; width: 18px; text-align: center; }
.issue-error .issue-icon { color: var(--red); }
.issue-warning .issue-icon { color: var(--yellow); }
.issue-ok .issue-icon { color: var(--green); }

/* ----- Events ----- */
.events-card { font-size: 12px; color: var(--muted-2); line-height: 1.6; }
.event-item { padding: 4px 0; display: flex; gap: 8px; }
.event-item + .event-item { border-top: 1px solid var(--line); }
.event-time { flex-shrink: 0; color: var(--muted-2); min-width: 48px; }
.event-action { color: var(--accent); }
.event-target { color: var(--muted); word-break: break-all; }

/* ----- Footer ----- */
.footer { text-align: center; font-size: 11px; color: var(--muted-2); padding: 24px 0 12px; }

/* ----- Tags ----- */
.tag { display: inline-block; font-size: 11px; padding: 1px 6px; border-radius: 3px; }
.tag-ok { background: rgba(74,222,128,0.12); color: var(--green); }
.tag-error { background: rgba(251,113,133,0.12); color: var(--red); }
.tag-warn { background: rgba(251,191,36,0.12); color: var(--yellow); }
.tag-neutral { background: var(--panel-2); color: var(--muted-2); }

/* ----- Responsive ----- */
@media (max-width: 480px) {
  .summary-grid { grid-template-columns: repeat(3, 1fr); }
  body { padding: 8px; }
  .card { padding: 10px 12px; }
}