:root {
  color-scheme: light;
  --bg: #eef2f4;
  --ink: #172026;
  --muted: #5d6b73;
  --panel: #ffffff;
  --line: #d9e0e4;
  --strong: #0f4c5c;
  --accent: #b43d2d;
  --accent-2: #1f7a5d;
  --warn: #a56615;
  --shadow: 0 18px 45px rgba(23, 32, 38, 0.11);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background:
    linear-gradient(180deg, rgba(15, 76, 92, 0.08), rgba(238, 242, 244, 0) 360px),
    var(--bg);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

.app-shell {
  padding: 32px 18px 48px;
}

.workspace {
  width: min(1220px, 100%);
  margin: 0 auto;
}

.masthead {
  display: block;
  margin-bottom: 20px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--strong);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  max-width: 780px;
  font-size: clamp(2.2rem, 5vw, 4.9rem);
  line-height: 0.95;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 4px;
  font-size: 1.05rem;
  letter-spacing: 0;
}

h3 {
  margin-bottom: 10px;
  font-size: 0.9rem;
}

.panel,
.decision-card,
.metric {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
}

.decision-card {
  display: grid;
  gap: 8px;
  padding: 18px;
  min-height: 150px;
}

.decision-label,
.metric span,
.source-type {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.decision-card strong {
  font-size: 1.45rem;
  line-height: 1.1;
}

.decision-card span:last-child {
  color: var(--muted);
  line-height: 1.45;
}

.panel {
  padding: 18px;
}

.panel-heading {
  display: flex;
  gap: 16px;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 16px;
}

.panel-heading p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.lookup-form label,
.field {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 750;
}

.lookup-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  margin-top: 7px;
}

.lookup-row textarea {
  min-height: 96px;
  padding: 12px;
}

.internal-state {
  display: none;
}

.keyed-option {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 9px;
  align-items: start;
  margin-top: 12px;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.35;
}

.keyed-option input {
  width: 18px;
  min-height: 18px;
  margin: 1px 0 0;
  accent-color: var(--strong);
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid #c6d0d5;
  border-radius: 7px;
  color: var(--ink);
  background: #fbfcfc;
}

input,
select {
  min-height: 44px;
  padding: 0 12px;
}

input:focus,
select:focus,
textarea:focus {
  outline: 3px solid rgba(31, 122, 93, 0.2);
  border-color: var(--accent-2);
}

button,
.source-actions a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  border: 0;
  border-radius: 7px;
  padding: 0 16px;
  color: #ffffff;
  background: var(--strong);
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
}

.ghost-button {
  border: 1px solid #c6d0d5;
  color: var(--ink);
  background: #f8fafb;
}

button:hover,
.source-actions a:hover {
  filter: brightness(0.96);
}

button:disabled,
.source-actions a[aria-disabled="true"] {
  opacity: 0.48;
  pointer-events: none;
}

.validation-message {
  min-height: 22px;
  margin: 10px 0 0;
  color: var(--accent);
  font-weight: 750;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 12px 0;
}

.metric {
  display: grid;
  gap: 8px;
  padding: 15px;
  box-shadow: none;
}

.metric strong {
  min-height: 32px;
  font-size: 1.55rem;
  line-height: 1.1;
  overflow-wrap: anywhere;
}

.grid-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.network-panel {
  margin-bottom: 12px;
}

.network-grid {
  display: grid;
  grid-template-columns: 1.1fr 1fr 1.15fr;
  gap: 12px;
}

.network-item {
  display: grid;
  gap: 7px;
  min-height: 112px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfc;
}

.network-item span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.network-item strong {
  font-size: 1.35rem;
  line-height: 1.12;
  overflow-wrap: anywhere;
}

.network-item small {
  color: var(--muted);
  line-height: 1.35;
}

.country-item strong {
  font-size: 1.5rem;
}

.auto-panel {
  margin-bottom: 12px;
}

.hash-panel {
  margin-bottom: 12px;
}

.results-panel {
  margin: 12px 0;
}

.pattern-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 14px;
}

.pattern-summary p {
  margin: 0;
  color: var(--muted);
  line-height: 1.4;
}

.pattern-chip {
  border: 1px solid #c6d0d5;
  border-radius: 999px;
  padding: 7px 10px;
  color: var(--ink);
  background: #f8fafb;
  font-size: 0.82rem;
  font-weight: 800;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.cve-details { padding: 16px 20px; }
.cve-details h3 { font-size: 1rem; margin: 18px 0 8px; letter-spacing: 0; }
.cve-details h3:first-child { margin-top: 0; }
.cve-details p, .cve-details li { max-width: 100ch; line-height: 1.6; }
.cve-details li { margin-bottom: 12px; }
.cve-description { white-space: pre-wrap; }

table {
  width: 100%;
  min-width: 1080px;
  border-collapse: collapse;
  background: #fbfcfc;
}

th,
td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  font-size: 0.86rem;
  line-height: 1.35;
}

th {
  color: var(--muted);
  background: #f3f6f7;
  font-size: 0.74rem;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
}

td {
  overflow-wrap: anywhere;
}

.result-row td:first-child {
  min-width: 190px;
}

.row-toggle {
  min-width: 30px;
  min-height: 30px;
  margin-right: 8px;
  padding: 0;
  color: var(--ink);
  background: #eef3f4;
  border: 1px solid #c6d0d5;
  font-size: 1rem;
  line-height: 1;
  vertical-align: middle;
}

.result-detail-row[hidden] {
  display: none;
}

.result-detail-row td {
  padding: 0;
  background: #f7fafb;
}

.result-details {
  display: grid;
  grid-template-columns: minmax(220px, 0.85fr) minmax(0, 1.2fr) minmax(220px, 0.8fr) minmax(260px, 0.9fr);
  gap: 14px;
  padding: 16px;
  border-top: 1px solid var(--line);
}

.detail-block {
  display: grid;
  gap: 8px;
  align-content: start;
}

.detail-block h3 {
  margin: 0;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.detail-block ul {
  display: grid;
  gap: 7px;
  margin: 0;
  padding-left: 18px;
}

.pivot-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pivot-links a {
  min-height: 32px;
  border: 1px solid #c6d0d5;
  border-radius: 7px;
  padding: 7px 10px;
  color: var(--strong);
  background: #ffffff;
  font-size: 0.82rem;
  font-weight: 850;
  text-decoration: none;
}

.pivot-links a:hover {
  border-color: var(--strong);
  text-decoration: none;
}

tbody tr:last-child td {
  border-bottom: 0;
}

td a {
  color: var(--strong);
  font-weight: 850;
  text-decoration: none;
}

td a:hover {
  text-decoration: underline;
}

.hash-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 22px;
  color: var(--ink);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 0.86rem;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.hash-list:empty {
  display: none;
}

.auto-results {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.auto-empty {
  grid-column: 1 / -1;
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.auto-card {
  display: grid;
  gap: 9px;
  min-height: 132px;
  padding: 13px;
  border: 1px solid var(--line);
  border-left: 5px solid #8a969c;
  border-radius: 8px;
  background: #fbfcfc;
}

.auto-card p {
  margin: 0;
  color: var(--ink);
  line-height: 1.35;
}

.auto-card small {
  color: var(--muted);
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.auto-link {
  align-self: end;
  color: var(--strong);
  font-weight: 850;
  text-decoration: none;
}

.auto-link:hover {
  text-decoration: underline;
}

.auto-topline {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  justify-content: space-between;
}

.auto-topline strong {
  overflow-wrap: anywhere;
}

.auto-badge {
  border-radius: 999px;
  padding: 4px 8px;
  color: #ffffff;
  background: #6c777d;
  font-size: 0.72rem;
  font-weight: 850;
  white-space: nowrap;
}

.auto-bad {
  border-left-color: var(--accent);
}

.auto-bad .auto-badge {
  background: var(--accent);
}

.auto-watch {
  border-left-color: var(--warn);
}

.auto-watch .auto-badge {
  background: var(--warn);
}

.auto-clean {
  border-left-color: var(--accent-2);
}

.auto-clean .auto-badge {
  background: var(--accent-2);
}

.auto-info {
  border-left-color: var(--strong);
}

.auto-info .auto-badge {
  background: var(--strong);
}

.auto-manual {
  border-left-color: #5f6470;
  background: #f7f8f9;
}

.auto-manual .auto-badge {
  background: #5f6470;
}

.auto-skipped {
  border-left-color: #8a969c;
  background: #f5f7f8;
}

.evidence-panel {
  align-self: start;
  width: 100%;
}

.field {
  margin-bottom: 13px;
}

.toggle-stack {
  display: grid;
  gap: 10px;
  margin: 16px 0;
}

.toggle-stack label {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 9px;
  color: var(--ink);
  line-height: 1.35;
}

.toggle-stack input {
  width: 18px;
  min-height: 18px;
  margin: 2px 0 0;
  accent-color: var(--accent-2);
}

.decision-notes {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.decision-notes ul {
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.4;
}

.ticket-panel {
  margin-top: 12px;
}

.button-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

textarea {
  display: block;
  min-height: 260px;
  padding: 14px;
  resize: vertical;
  color: #1f2930;
  line-height: 1.5;
}

.risk-high {
  color: var(--accent);
}

.risk-medium {
  color: var(--warn);
}

.risk-low {
  color: var(--accent-2);
}

.decision-card,
.keyed-option,
.internal-state {
  display: none !important;
}

@media (max-width: 980px) {
  .masthead,
  .grid-layout {
    grid-template-columns: 1fr;
  }

  .metrics,
  .network-grid,
  .auto-results {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .app-shell {
    padding: 18px 10px 30px;
  }

  .panel,
  .decision-card {
    padding: 14px;
  }

  .lookup-row,
  .metrics,
  .network-grid,
  .auto-results {
    grid-template-columns: 1fr;
  }

  .panel-heading {
    align-items: stretch;
    flex-direction: column;
  }
}
