:root {
  --bg: #0a0a0a;
  --panel: #141416;
  --panel-alt: #1c1c20;
  --border: #2a2a30;
  --text: #f5f5f5;
  --muted: #9a9aa3;
  --accent: #60a5fa;

  --sev-critical: #dc2626;
  --sev-high: #f97316;
  --sev-medium: #eab308;
  --sev-low: #3b82f6;
  --sev-info: #6b7280;

  --state-fresh: #10b981;
  --state-empty: #6b7280;
  --state-stale: #eab308;
  --state-failed: #dc2626;
}

* { box-sizing: border-box; }

/* HTML `hidden` attribute is authoritative. Author rules like
 * `.login-screen { display: flex; }` otherwise beat the UA
 * `[hidden] { display: none }` baseline because they share
 * specificity (0,0,1,0) but come later in the cascade — which is
 * exactly the bug CCP flagged against the first deploy of this
 * console, where the login overlay stayed visible over a fully-
 * authenticated dashboard. `!important` here re-asserts the HTML
 * spec semantics against any future author rule that forgets about
 * the attribute. */
[hidden] { display: none !important; }

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

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 2rem;
  border-bottom: 1px solid var(--border);
  background: var(--panel);
}

.title-group {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

h1 { font-size: 1.25rem; margin: 0; }
h2 { font-size: 1rem; margin: 0 0 0.75rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
h3 { font-size: 0.85rem; margin: 1rem 0 0.5rem; color: var(--muted); }

.badge-isolated {
  font-size: 0.75rem;
  padding: 0.125rem 0.5rem;
  background: #2e5a9c;
  color: white;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.header-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.user-email {
  color: var(--muted);
  font-size: 0.85rem;
  margin-right: 0.5rem;
}

.btn {
  background: var(--panel-alt);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 0.4rem 0.9rem;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.85rem;
  font-family: inherit;
}
.btn:hover:not(:disabled) { background: var(--border); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: black; border-color: var(--accent); }
.btn-primary:hover:not(:disabled) { background: #3b82f6; }
.btn-secondary { background: transparent; }

main { padding: 1.5rem 2rem; max-width: 1200px; margin: 0 auto; }

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.5rem;
}

.source-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.5rem;
}

.source-card {
  background: var(--panel-alt);
  border: 1px solid var(--border);
  border-left: 3px solid var(--state-fresh);
  padding: 0.75rem 1rem;
  border-radius: 4px;
}
.source-card .source-name { font-weight: 600; text-transform: capitalize; }
.source-card .source-state { font-size: 0.85rem; color: var(--muted); }
.source-card .source-checked { font-size: 0.75rem; color: var(--muted); margin-top: 0.25rem; }
.source-card.fresh { border-left-color: var(--state-fresh); }
.source-card.empty { border-left-color: var(--state-empty); }
.source-card.stale { border-left-color: var(--state-stale); }
.source-card.failed { border-left-color: var(--state-failed); background: rgba(220, 38, 38, 0.1); }

.severity-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.5rem;
}

.severity-tile {
  background: var(--panel-alt);
  border: 1px solid var(--border);
  padding: 0.75rem;
  border-radius: 4px;
  text-align: center;
  border-top: 3px solid var(--sev-info);
}
.severity-tile.critical { border-top-color: var(--sev-critical); }
.severity-tile.high { border-top-color: var(--sev-high); }
.severity-tile.medium { border-top-color: var(--sev-medium); }
.severity-tile.low { border-top-color: var(--sev-low); }
.severity-tile.info { border-top-color: var(--sev-info); }
.severity-tile .severity-label {
  font-size: 0.7rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.severity-tile .severity-count { font-size: 1.75rem; font-weight: 600; margin-top: 0.25rem; }

.subgroup { margin-top: 1.25rem; }

.account-list, .standards-list, .findings-list, .events-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.account-list li, .findings-list li, .events-list li {
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-family: ui-monospace, monospace;
  font-size: 0.85rem;
}
.account-list li:last-child, .findings-list li:last-child, .events-list li:last-child {
  border-bottom: none;
}

.standards-list li { padding: 0.25rem 0; color: var(--muted); font-size: 0.9rem; }

.severity-pill {
  display: inline-block;
  padding: 0.125rem 0.5rem;
  border-radius: 3px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  min-width: 4.5rem;
  text-align: center;
  background: var(--sev-info);
  color: white;
}
.severity-pill.critical { background: var(--sev-critical); }
.severity-pill.high { background: var(--sev-high); }
.severity-pill.medium { background: var(--sev-medium); color: black; }
.severity-pill.low { background: var(--sev-low); }
.severity-pill.info { background: var(--sev-info); }

.login-screen {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
}
.login-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 2.5rem 3rem;
  max-width: 400px;
  text-align: center;
}
.login-card h2 { color: var(--text); text-transform: none; letter-spacing: normal; font-size: 1.2rem; }

.footer-note {
  color: var(--muted);
  font-size: 0.8rem;
  padding: 1rem 0;
  text-align: center;
}
.policy-note { margin-top: 0.5rem; font-family: ui-monospace, monospace; }

.error-banner {
  position: fixed;
  bottom: 1rem;
  left: 1rem;
  right: 1rem;
  background: var(--sev-critical);
  color: white;
  padding: 0.75rem 1rem;
  border-radius: 4px;
  max-width: 700px;
  margin: 0 auto;
}

.empty-state { color: var(--muted); font-style: italic; padding: 0.5rem 0; }
