:root {
  --bg: #f4f6f8;
  --surface: #ffffff;
  --text: #1c2430;
  --muted: #5b6775;
  --border: #d7dee7;
  --accent: #1f4e79;
  --accent-soft: #e8eef5;
  --ok: #1b6b3a;
  --warn: #8a5a00;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.45;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0.85rem 1.25rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.brand {
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.01em;
}

.site-header nav {
  display: flex;
  gap: 1rem;
  align-items: center;
  color: var(--muted);
  font-size: 0.95rem;
}

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.25rem;
}

h1 {
  margin: 0 0 0.35rem;
  font-size: 1.6rem;
}

.lede {
  color: var(--muted);
  margin: 0 0 1rem;
}

.disclaimer {
  background: var(--accent-soft);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.65rem 0.85rem;
  color: var(--muted);
  font-size: 0.92rem;
  margin-bottom: 1rem;
}

.quick-views,
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.chip {
  display: inline-block;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: 999px;
  padding: 0.3rem 0.75rem;
  font-size: 0.9rem;
}

.chip.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.filters form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.9rem;
  margin-bottom: 1rem;
}

.filters label {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.filters input,
.filters select,
.login-form input {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.45rem 0.55rem;
  font: inherit;
  color: var(--text);
  background: #fff;
}

.btn {
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
  border-radius: 6px;
  padding: 0.5rem 0.9rem;
  font: inherit;
  cursor: pointer;
}

.btn.secondary {
  background: var(--surface);
  color: var(--accent);
}

.card-list {
  display: grid;
  gap: 0.85rem;
}

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

.card-top {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
}

.card h2 {
  margin: 0;
  font-size: 1.1rem;
}

.meta {
  color: var(--muted);
  font-size: 0.92rem;
  margin-top: 0.2rem;
}

.scores {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.score-pill {
  min-width: 7.5rem;
  background: var(--accent-soft);
  border-radius: 6px;
  padding: 0.45rem 0.6rem;
  text-align: center;
}

.score-pill .label {
  display: block;
  font-size: 0.75rem;
  color: var(--muted);
}

.score-pill .value {
  font-weight: 700;
  font-size: 1.05rem;
}

.score-pill .level {
  font-size: 0.78rem;
  color: var(--ok);
}

.signals {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0.7rem 0;
}

.tag {
  background: #eef2f6;
  border-radius: 4px;
  padding: 0.15rem 0.45rem;
  font-size: 0.82rem;
}

.why {
  margin: 0.35rem 0 0;
}

.empty {
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: 8px;
  padding: 1.5rem;
  color: var(--muted);
}

.pagination {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  margin-top: 1rem;
}

.section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 1rem;
}

.section h2 {
  margin: 0 0 0.75rem;
  font-size: 1.15rem;
}

.kv {
  display: grid;
  grid-template-columns: 12rem 1fr;
  gap: 0.35rem 0.75rem;
  margin: 0;
}

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

.kv dd {
  margin: 0;
}

.list-plain {
  margin: 0;
  padding-left: 1.1rem;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

.table th,
.table td {
  border-bottom: 1px solid var(--border);
  text-align: left;
  padding: 0.45rem 0.35rem;
  vertical-align: top;
}

.login-box {
  max-width: 380px;
  margin: 3rem auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.25rem;
}

.login-form {
  display: grid;
  gap: 0.75rem;
}

.errorlist {
  color: #8a1f1f;
  margin: 0;
  padding-left: 1rem;
}

@media (max-width: 720px) {
  .card-top {
    flex-direction: column;
  }

  .kv {
    grid-template-columns: 1fr;
  }

  .site-header {
    flex-direction: column;
    align-items: flex-start;
  }
}

.disclaimer {
  color: var(--muted);
  font-size: 0.9rem;
  margin: 0.35rem 0 1rem;
}

.quick-views {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0 0 1rem;
}

.chip {
  display: inline-block;
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
  font-size: 0.85rem;
}

.chip.active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 600;
}

.layer {
  margin-top: 0.85rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}

.layer-title {
  margin: 0 0 0.45rem;
  font-size: 0.95rem;
}

.layer-qualification .layer-title {
  color: var(--accent);
}

.layer-trigger {
  opacity: 0.92;
}

.layer-trigger .layer-title {
  color: var(--muted);
  font-weight: 600;
}

.scores.compact .score-pill {
  min-width: 6.5rem;
}

.score-pill.primary {
  background: #dce8f5;
  border: 1px solid #b7cbe0;
}

.score-pill.muted {
  background: #f0f3f6;
}

.disposition-stack {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  align-items: flex-end;
}

.badge {
  display: inline-block;
  border-radius: 999px;
  padding: 0.25rem 0.7rem;
  font-size: 0.82rem;
  font-weight: 600;
  border: 1px solid var(--border);
  background: #eef2f6;
}

.badge.subtle {
  font-weight: 500;
  opacity: 0.9;
}

.badge-qualified {
  background: #e5f6ea;
  border-color: #9dceb0;
  color: var(--ok);
}

.badge-watchlist {
  background: #fff6e5;
  border-color: #e2c48a;
  color: var(--warn);
}

.badge-research_more {
  background: #e8eef8;
  border-color: #a9bdd8;
  color: var(--accent);
}

.badge-disqualified {
  background: #f8e8e8;
  border-color: #d7a0a0;
  color: #8a1f1f;
}

.badge-quarantined {
  background: #f3e8f8;
  border-color: #c5a6d6;
  color: #6b2f86;
}

.badge-muted,
.badge-ops {
  background: #eef2f6;
  color: var(--muted);
}

.badge-gate-reject {
  background: #f3e8e0;
  color: #6b3f1f;
  border: 1px solid #d9b89a;
}

.badge-qual-stale {
  background: #e8eef5;
  color: #2f4a6b;
  border: 1px solid #b8c7d9;
}

.callout {
  background: var(--accent-soft);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.65rem 0.8rem;
  margin: 0.5rem 0 0.75rem;
}

.callout.warn {
  background: #fff6e5;
  border-color: #e2c48a;
}

.qualification-section h3 {
  margin: 1rem 0 0.4rem;
  font-size: 1rem;
}

.negative-list strong {
  color: #8a1f1f;
}

.evidence-mini {
  margin-top: 0.25rem;
  color: var(--muted);
  font-size: 0.88rem;
}

/* Operations health (Phase 5E1) */
.health-overall {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1rem 1.1rem;
  margin-bottom: 1rem;
}

.health-overall.health-healthy {
  border-left: 4px solid var(--ok);
}

.health-overall.health-degraded {
  border-left: 4px solid var(--warn);
}

.health-overall.health-critical {
  border-left: 4px solid #8a1f1f;
}

.health-status-label {
  font-size: 0.85rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.health-status-value {
  font-size: 1.45rem;
  font-weight: 700;
  margin-top: 0.15rem;
}

.counts-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.count-chip {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.35rem 0.7rem;
  font-size: 0.9rem;
}

.alert-section {
  margin-bottom: 1.5rem;
}

.alert-section h2 {
  font-size: 1.1rem;
  margin: 0 0 0.6rem;
}

.alert-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.alert-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.85rem 1rem;
}

.alert-card.severity-critical {
  border-left: 4px solid #8a1f1f;
}

.alert-card.severity-warning {
  border-left: 4px solid var(--warn);
}

.alert-card.severity-info {
  border-left: 4px solid var(--accent);
}

.alert-card h3 {
  margin: 0.4rem 0 0.35rem;
  font-size: 1.05rem;
}

.alert-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
}

.ack-form {
  margin-top: 0.65rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: end;
}

.ack-form label {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.ack-form input[type="text"] {
  min-width: 220px;
  padding: 0.35rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 4px;
}

.messages {
  list-style: none;
  padding: 0;
  margin: 0 0 1rem;
}

.messages li {
  padding: 0.5rem 0.75rem;
  border-radius: 4px;
  margin-bottom: 0.35rem;
}

.messages .success {
  background: #e7f5ec;
  color: var(--ok);
}

.messages .error {
  background: #f8e8e8;
  color: #8a1f1f;
}

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

.small {
  font-size: 0.88rem;
}

.recover-link {
  margin-top: 0.5rem;
}

.recover-form {
  margin-top: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-width: 560px;
}

.recover-form textarea {
  width: 100%;
  padding: 0.5rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  font: inherit;
}

.recover-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
