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

:root {
  --bg: #0d1117;
  --surface: #161b22;
  --border: #30363d;
  --text: #e6edf3;
  --text-muted: #8b949e;
  --green: #2ea043;
  --yellow: #d29922;
  --amber: #db6d28;
  --red: #f85149;
  --blue: #58a6ff;
  --green-bg: #0d2818;
  --yellow-bg: #2d2200;
  --amber-bg: #2d1a00;
  --red-bg: #3d0e0e;
}

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

/* State banner */
#state-banner {
  padding: 2rem;
  text-align: center;
  transition: background 0.3s;
}
#state-banner.green  { background: var(--green-bg); border-bottom: 3px solid var(--green); }
#state-banner.yellow { background: var(--yellow-bg); border-bottom: 3px solid var(--yellow); }
#state-banner.amber  { background: var(--amber-bg); border-bottom: 3px solid var(--amber); }
#state-banner.red    { background: var(--red-bg); border-bottom: 3px solid var(--red); }

#action-label {
  font-size: 2.5rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.green  #action-label { color: var(--green); }
.yellow #action-label { color: var(--yellow); }
.amber  #action-label { color: var(--amber); }
.red    #action-label { color: var(--red); }

#convergence-count {
  margin-top: 0.5rem;
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0.02em;
}

#state-detail {
  margin-top: 0.3rem;
  color: var(--text-muted);
  font-size: 0.9rem;
}

#action-guidance {
  margin-top: 0.6rem;
  padding: 0.5rem 1rem;
  background: rgba(255,255,255,0.06);
  border-radius: 6px;
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 500;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

#degraded-badge {
  display: inline-block;
  margin-top: 0.75rem;
  padding: 0.3rem 0.8rem;
  background: #6e400080;
  border: 1px solid var(--amber);
  border-radius: 4px;
  color: var(--amber);
  font-size: 0.8rem;
  font-weight: 600;
}

/* Meta bar */
#meta-bar {
  display: flex;
  justify-content: center;
  gap: 2rem;
  padding: 0.75rem 1rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  font-size: 0.8rem;
  color: var(--text-muted);
}

.threshold-control {
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

#threshold-value {
  width: 3rem;
  padding: 0.15rem 0.3rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 3px;
  color: var(--text);
  font-size: 0.8rem;
  text-align: center;
}

/* Main content */
main {
  max-width: 1000px;
  margin: 1.5rem auto;
  padding: 0 1rem;
}

h2 {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
  padding-bottom: 0.3rem;
  border-bottom: 1px solid var(--border);
}

.indicator-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 0.75rem;
  margin-bottom: 2rem;
}

/* Indicator cards */
.indicator-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
  border-left: 4px solid var(--border);
  transition: border-color 0.3s;
}

.indicator-card.active   { border-left-color: var(--red); background: #1a1215; }
.indicator-card.inactive { border-left-color: var(--green); }
.indicator-card.no-data  { border-left-color: var(--text-muted); opacity: 0.6; }

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.4rem;
}

.card-name {
  font-weight: 600;
  font-size: 0.95rem;
}

.card-id {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.card-status {
  font-size: 0.7rem;
  padding: 0.15rem 0.5rem;
  border-radius: 3px;
  font-weight: 600;
  text-transform: uppercase;
}
.card-status.active   { background: var(--red); color: #fff; }
.card-status.inactive { background: #1a3a1a; color: var(--green); }
.card-status.no-data  { background: #2a2a2a; color: var(--text-muted); }

.card-summary {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 0.3rem;
  line-height: 1.4;
}

.card-meta {
  display: flex;
  justify-content: space-between;
  margin-top: 0.5rem;
  font-size: 0.7rem;
  color: var(--text-muted);
}

.confidence-badge {
  padding: 0.1rem 0.35rem;
  border-radius: 2px;
  font-size: 0.65rem;
  text-transform: uppercase;
}
.confidence-badge.high   { background: #1a3a1a; color: var(--green); }
.confidence-badge.medium { background: #2d2200; color: var(--yellow); }
.confidence-badge.low    { background: #2d1a00; color: var(--amber); }
.confidence-badge.na     { background: #1a1a1a; color: var(--text-muted); }

/* Key section — same card style as indicator cards */
#legend {
  max-width: 1000px;
  margin: 0 auto 2rem;
  padding: 0 1rem;
}

.key-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.25rem;
}

.key-group {
  margin-bottom: 1.25rem;
}
.key-group:last-child { margin-bottom: 0; }

.key-group-title {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 0.6rem;
  padding-bottom: 0.3rem;
  border-bottom: 1px solid var(--border);
}

.key-row {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  padding: 0.3rem 0;
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.key-label {
  flex-shrink: 0;
  min-width: 110px;
  font-weight: 600;
  color: var(--text);
}

.key-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  vertical-align: middle;
  margin-right: 4px;
}

/* Footer */
footer {
  text-align: center;
  padding: 1.5rem;
  color: var(--text-muted);
  font-size: 0.75rem;
  border-top: 1px solid var(--border);
}

.hidden { display: none !important; }

/* Responsive */
@media (max-width: 600px) {
  #action-label { font-size: 1.8rem; }
  .indicator-grid { grid-template-columns: 1fr; }
  #meta-bar { flex-direction: column; align-items: center; gap: 0.3rem; }
  .key-row { flex-direction: column; gap: 0.2rem; }
  .key-label { min-width: unset; }
}
