:root {
  --navy: #0b1020;
  --navy-2: #121a33;
  --red: #c0392b;
  --red-bright: #e74c3c;
  --text: #dbe2f0;
  --text-dim: #8a93ab;
  --border: #223052;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--navy);
  color: var(--text);
  font-family: "Courier New", ui-monospace, monospace;
}

.auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.auth-card {
  background: var(--navy-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 2.5rem 2rem;
  width: 320px;
  text-align: center;
}

.auth-mast {
  font-size: 1.8rem;
  letter-spacing: 0.15em;
  color: var(--red-bright);
  font-weight: bold;
}

.auth-sub {
  color: var(--text-dim);
  margin: 0.5rem 0 1.5rem;
  font-size: 0.9rem;
}

.auth-error {
  background: rgba(192, 57, 43, 0.15);
  border: 1px solid var(--red);
  color: #ffb3a7;
  padding: 0.5rem;
  border-radius: 4px;
  margin-bottom: 1rem;
  font-size: 0.85rem;
}

input[type="password"], input[type="text"] {
  width: 100%;
  background: var(--navy);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.6rem;
  border-radius: 4px;
  margin-bottom: 0.8rem;
  font-family: inherit;
  text-align: center;
  letter-spacing: 0.1em;
}

button {
  width: 100%;
  background: var(--red);
  color: white;
  border: none;
  padding: 0.6rem;
  border-radius: 4px;
  cursor: pointer;
  font-family: inherit;
  font-weight: bold;
  letter-spacing: 0.05em;
}
button:hover { background: var(--red-bright); }

.shell { min-height: 100vh; }

.topnav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 2rem;
  border-bottom: 1px solid var(--border);
  background: var(--navy-2);
}
.topnav .brand { color: var(--red-bright); font-weight: bold; letter-spacing: 0.1em; }
.topnav .links a {
  color: var(--text-dim);
  text-decoration: none;
  margin-left: 1.5rem;
  font-size: 0.85rem;
  letter-spacing: 0.05em;
}
.topnav .links a.active, .topnav .links a:hover { color: var(--red-bright); }

.content { padding: 2rem; max-width: 900px; margin: 0 auto; }
.content h1 { color: var(--red-bright); letter-spacing: 0.1em; font-size: 1.4rem; }
.content h2 { color: var(--text-dim); font-size: 0.95rem; letter-spacing: 0.08em; margin-top: 2rem; }

.stat-row { display: flex; gap: 1rem; flex-wrap: wrap; margin: 1rem 0; }
.stat {
  background: var(--navy-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1rem 1.5rem;
  text-align: center;
  flex: 1;
  min-width: 120px;
}
.stat-n { display: block; font-size: 1.8rem; color: var(--red-bright); font-weight: bold; }
.stat-label { font-size: 0.75rem; color: var(--text-dim); letter-spacing: 0.05em; }

.brief {
  background: var(--navy-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1rem;
  white-space: pre-wrap;
  font-size: 0.85rem;
  overflow-x: auto;
}

table.runs { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
table.runs th, table.runs td {
  border-bottom: 1px solid var(--border);
  padding: 0.5rem;
  text-align: left;
}
table.runs th { color: var(--text-dim); font-weight: normal; }
table.runs tr.bad td { color: var(--red-bright); }

.section-note { color: var(--text-dim); font-size: 0.85rem; margin-top: -0.5rem; }
.empty-note { color: var(--text-dim); font-size: 0.9rem; }
code { background: var(--navy-2); border: 1px solid var(--border); border-radius: 3px; padding: 0.1rem 0.3rem; }

.findings { display: flex; flex-direction: column; gap: 1rem; margin: 1rem 0 2rem; }
.finding {
  background: var(--navy-2);
  border: 1px solid var(--border);
  border-left: 4px solid var(--border);
  border-radius: 6px;
  padding: 1rem 1.25rem;
  font-size: 0.9rem;
}
.finding-critical { border-left-color: #e74c3c; }
.finding-high { border-left-color: #e67e22; }
.finding-medium { border-left-color: #f1c40f; }
.finding-low { border-left-color: #7f8c8d; }

.finding-head { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; margin-bottom: 0.4rem; }
.badge {
  font-size: 0.7rem; font-weight: bold; letter-spacing: 0.05em;
  padding: 0.15rem 0.5rem; border-radius: 3px; color: #0b1020;
}
.badge-critical { background: #e74c3c; color: white; }
.badge-high { background: #e67e22; color: #0b1020; }
.badge-medium { background: #f1c40f; color: #0b1020; }
.badge-low { background: #7f8c8d; color: white; }

.finding-cve { font-weight: bold; color: var(--text); }
.finding-asset { color: var(--text-dim); }
.finding-cvss { color: var(--text-dim); font-size: 0.8rem; }
.finding-kev { color: var(--red-bright); font-size: 0.75rem; font-weight: bold; }
.finding-title { font-weight: bold; margin-bottom: 0.3rem; }
.finding-desc { color: var(--text-dim); margin-bottom: 0.5rem; }
.finding-action { background: rgba(192,57,43,0.1); border: 1px solid var(--red); border-radius: 4px; padding: 0.5rem; margin-bottom: 0.5rem; font-size: 0.85rem; }
.finding-refs { font-size: 0.8rem; margin-bottom: 0.3rem; }
.finding-refs a, .finding-nvd-link { color: var(--red-bright); text-decoration: none; }
.finding-refs a:hover, .finding-nvd-link:hover { text-decoration: underline; }
.finding-nvd-link { display: inline-block; font-size: 0.8rem; margin-bottom: 0.6rem; }

.mitigation { margin-top: 0.6rem; border-top: 1px solid var(--border); padding-top: 0.6rem; }
.mitigate-btn {
  width: auto; background: var(--navy); border: 1px solid var(--red); color: var(--red-bright);
  padding: 0.4rem 0.9rem; font-size: 0.8rem; border-radius: 4px; cursor: pointer;
}
.mitigate-btn:hover { background: var(--red); color: white; }
.mitigation-label { font-size: 0.7rem; letter-spacing: 0.05em; color: var(--text-dim); margin-bottom: 0.3rem; margin-top: 0.5rem; }
.mitigation-text { white-space: pre-wrap; font-size: 0.85rem; background: var(--navy); border: 1px solid var(--border); border-radius: 4px; padding: 0.75rem; }
.hidden { display: none; }

.chart-row { display: flex; gap: 1rem; flex-wrap: wrap; margin: 1rem 0 2rem; }
.chart-box { background: var(--navy-2); border: 1px solid var(--border); border-radius: 6px; padding: 1rem; flex: 1; min-width: 280px; height: 260px; }

.back-link { color: var(--text-dim); text-decoration: none; font-size: 0.85rem; display: inline-block; margin-bottom: 1rem; }
.back-link:hover { color: var(--red-bright); }

.checklist { font-size: 0.9rem; line-height: 1.6; padding-left: 1.3rem; }
.checklist li { margin-bottom: 0.4rem; }

.articles { display: flex; flex-direction: column; gap: 0.75rem; margin: 1rem 0 2rem; }
.article {
  background: var(--navy-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.75rem 1rem;
}
.article-title { color: var(--red-bright); text-decoration: none; font-weight: bold; font-size: 0.9rem; }
.article-title:hover { text-decoration: underline; }
.article-meta { color: var(--text-dim); font-size: 0.75rem; margin-top: 0.2rem; }
.article-summary { color: var(--text-dim); font-size: 0.85rem; margin-top: 0.4rem; }

.finding-cve a, .finding-title a { color: inherit; text-decoration: none; }
.finding-cve a:hover, .finding-title a:hover { color: var(--red-bright); text-decoration: underline; }

.content-wide { max-width: 1200px; }

.brief-panel {
  background: linear-gradient(135deg, var(--navy-2), #16204a);
  border: 1px solid var(--red);
  box-shadow: 0 0 20px rgba(192,57,43,0.12);
  border-radius: 8px;
  padding: 1.25rem 1.5rem;
  margin: 1rem 0 1.5rem;
}
.brief-panel-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.6rem; }
.brief-panel-title { color: var(--red-bright); font-weight: bold; letter-spacing: 0.08em; font-size: 0.9rem; }
.brief-panel-actions { display: flex; gap: 0.5rem; }
.brief-panel-text { font-size: 0.95rem; line-height: 1.6; white-space: pre-wrap; }
.brief-panel-meta { color: var(--text-dim); font-size: 0.75rem; margin-top: 0.6rem; }

.chip-btn {
  width: auto; background: var(--navy); border: 1px solid var(--border); color: var(--text-dim);
  padding: 0.35rem 0.8rem; font-size: 0.78rem; border-radius: 999px; cursor: pointer;
  font-family: inherit; letter-spacing: 0.03em;
}
.chip-btn:hover { border-color: var(--red); color: var(--text); }
.chip-btn.chip-active { background: var(--red); border-color: var(--red); color: white; }
.filter-chips { display: flex; gap: 0.5rem; flex-wrap: wrap; margin: 0.75rem 0; }

table.queue { width: 100%; border-collapse: collapse; font-size: 0.85rem; margin: 0.5rem 0 1.5rem; }
table.queue th {
  text-align: left; color: var(--text-dim); font-weight: normal; font-size: 0.75rem;
  letter-spacing: 0.05em; padding: 0.4rem 0.6rem; border-bottom: 1px solid var(--border);
}
table.queue td { padding: 0.55rem 0.6rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
.queue-row { cursor: pointer; }
.queue-row:hover { background: rgba(192,57,43,0.08); }
.queue-row .badge { font-size: 0.9rem; padding: 0.1rem 0.35rem; background: transparent; }
.q-cve { font-weight: bold; white-space: nowrap; }
.q-asset { color: var(--text-dim); white-space: nowrap; }
.q-score { color: var(--text-dim); white-space: nowrap; }
.q-title { color: var(--text); }
.q-arrow { color: var(--text-dim); text-align: right; }
.zd-tag { font-size: 0.8rem; }

.panel-row { display: flex; gap: 2rem; flex-wrap: wrap; margin-top: 1rem; }
.panel-col { flex: 1; min-width: 300px; }
.articles-compact { gap: 0.5rem; margin: 0.5rem 0; }
.article-compact { padding: 0.5rem 0.75rem; }

.raw-brief-details { margin: 2rem 0 1rem; }
.raw-brief-details summary { color: var(--text-dim); cursor: pointer; font-size: 0.85rem; margin-bottom: 0.5rem; }
.raw-brief-details summary:hover { color: var(--red-bright); }

.chat-content { display: flex; flex-direction: column; height: calc(100vh - 80px); }
.chat-log {
  flex: 1;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1rem;
  margin-bottom: 1rem;
  background: var(--navy-2);
}
.msg { padding: 0.5rem 0.75rem; border-radius: 4px; margin-bottom: 0.6rem; max-width: 80%; white-space: pre-wrap; font-size: 0.9rem; }
.msg.user { background: var(--navy); margin-left: auto; border: 1px solid var(--border); }
.msg.dave { background: rgba(192, 57, 43, 0.12); border: 1px solid var(--red); }
.msg.dave.pending { color: var(--text-dim); font-style: italic; }
.msg.dave.error { color: var(--red-bright); }

.chat-form { display: flex; gap: 0.5rem; }
.chat-form input { flex: 1; margin-bottom: 0; text-align: left; }
.chat-form button { width: auto; padding: 0.6rem 1.5rem; }
