:root {
  color-scheme: light;
  --bg: #f4f6f8;
  --panel: #ffffff;
  --panel-soft: #f8fafb;
  --text: #17202a;
  --muted: #5f6b7a;
  --line: #d8dee6;
  --line-strong: #c1cad6;
  --teal: #0f766e;
  --teal-dark: #115e59;
  --blue: #1d4ed8;
  --amber: #b45309;
  --red: #b42318;
  --green: #13795b;
  --purple: #6d28d9;
  --shadow: 0 10px 28px rgba(23, 32, 42, 0.08);
  --radius: 8px;
  --font: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.45;
}

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

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

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

a:hover {
  text-decoration: underline;
}

:focus-visible {
  outline: 3px solid rgba(29, 78, 216, 0.28);
  outline-offset: 2px;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
}

.sidebar {
  background: #111820;
  color: #f8fafb;
  padding: 22px 18px;
  display: flex;
  flex-direction: column;
  gap: 22px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.brand {
  display: grid;
  grid-template-columns: 46px 1fr;
  gap: 12px;
  align-items: center;
}

.brand-mark {
  height: 46px;
  width: 46px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: var(--radius);
  background: #20303e;
  color: #9ee7dc;
  font-weight: 800;
}

.brand h1,
.section-heading h2 {
  margin: 0;
}

.brand h1 {
  font-size: 18px;
}

.eyebrow {
  margin: 0 0 4px;
  color: #8fb0c8;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0;
  font-weight: 700;
}

.sidebar-section {
  display: grid;
  gap: 10px;
}

.field-label {
  font-size: 13px;
  font-weight: 700;
}

.input,
.search-input,
.select,
.textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--text);
  min-height: 42px;
}

.input,
.search-input,
.select {
  padding: 0 12px;
}

.textarea {
  min-height: 150px;
  padding: 12px;
  resize: vertical;
}

.sidebar .input {
  background: #172331;
  color: #fff;
  border-color: #314254;
}

.sidebar .input::placeholder {
  color: #90a4b7;
}

.case-list {
  display: grid;
  gap: 8px;
}

.case-card {
  width: 100%;
  text-align: left;
  border: 1px solid #2f4051;
  background: #182432;
  color: #f8fafb;
  border-radius: var(--radius);
  padding: 11px;
}

.case-card:hover,
.case-card.active {
  border-color: #75d9cf;
  background: #203142;
}

.case-card strong {
  display: block;
  font-size: 14px;
  margin-bottom: 3px;
}

.case-meta {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  color: #b8c7d4;
  font-size: 12px;
}

.empty-list {
  color: #b8c7d4;
  font-size: 13px;
  border: 1px dashed #3a4d61;
  padding: 12px;
  border-radius: var(--radius);
}

.section-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.section-heading h2 {
  font-size: 14px;
}

.icon-button {
  min-width: 34px;
  height: 34px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  font-weight: 700;
}

.sidebar .icon-button {
  background: #172331;
  border-color: #314254;
  color: #dbe7f2;
}

.source-list {
  display: grid;
  gap: 8px;
}

.source-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
  color: #cbd8e4;
  font-size: 13px;
}

.source-row span:first-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 99px;
  background: #8ca0b3;
}

.status-dot.ok {
  background: #35c48d;
}

.status-dot.error {
  background: #ff7a70;
}

.status-dot.skipped {
  background: #e7b85d;
}

.main {
  min-width: 0;
  display: grid;
  grid-template-rows: auto 1fr;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 2;
  display: grid;
  gap: 10px;
  padding: 18px 24px;
  background: rgba(244, 246, 248, 0.96);
  border-bottom: 1px solid var(--line);
}

.search-form {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto;
  gap: 10px;
  align-items: start;
}

.search-field {
  display: grid;
  gap: 5px;
}

.search-input {
  height: 48px;
  font-size: 18px;
  font-weight: 700;
  text-transform: uppercase;
}

.search-input[aria-invalid="true"] {
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(180, 35, 24, 0.12);
}

.field-hint,
.field-error {
  font-size: 12px;
  line-height: 1.35;
}

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

.field-error {
  color: var(--red);
  font-weight: 700;
}

.primary-button,
.secondary-button,
.ghost-button,
.danger-button,
.upload-button {
  border-radius: var(--radius);
  min-height: 40px;
  padding: 0 14px;
  font-weight: 700;
  border: 1px solid transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.primary-button {
  background: var(--teal);
  color: #fff;
}

.primary-button:hover {
  background: var(--teal-dark);
}

.secondary-button {
  background: var(--panel);
  color: var(--text);
  border-color: var(--line-strong);
}

.upload-button {
  background: #203142;
  color: #f8fafb;
  border-color: #3a4d61;
}

.upload-button:hover {
  background: #26394c;
  text-decoration: none;
}

.ghost-button {
  background: transparent;
  color: var(--muted);
  border-color: var(--line);
}

.danger-button {
  background: #fff5f3;
  color: var(--red);
  border-color: #f3b8b2;
}

.sidebar .danger-button {
  width: 100%;
  background: #2b1b1b;
  color: #ffd6d1;
  border-color: #70403b;
}

.sidebar .danger-button:hover {
  background: #3a2221;
}

.quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.content {
  padding: 24px;
  min-width: 0;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  max-width: 420px;
  padding: 12px 14px;
  border-radius: var(--radius);
  background: #172331;
  color: #fff;
  box-shadow: var(--shadow);
  z-index: 5;
}

.empty-state {
  min-height: calc(100vh - 130px);
  display: grid;
  place-items: center;
}

.empty-panel {
  width: min(760px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 36px;
  box-shadow: var(--shadow);
}

.empty-panel h2 {
  margin: 0 0 10px;
  font-size: 32px;
  line-height: 1.12;
}

.empty-panel p:last-child {
  color: var(--muted);
  margin-bottom: 0;
}

.empty-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 20px;
}

.empty-actions .primary-button {
  color: #fff;
  text-decoration: none;
}

.loading {
  display: grid;
  gap: 14px;
}

.skeleton {
  height: 110px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: linear-gradient(90deg, #eef2f6 0%, #f8fafb 40%, #eef2f6 80%);
  background-size: 220% 100%;
  animation: shimmer 1.2s linear infinite;
}

@keyframes shimmer {
  from {
    background-position: 0 0;
  }
  to {
    background-position: -220% 0;
  }
}

.investigation {
  display: grid;
  gap: 18px;
  min-width: 0;
}

.brief-header {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px;
  align-items: start;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  min-width: 0;
}

.stale-banner {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  background: #fff8eb;
  border: 1px solid #f0cf95;
  border-radius: var(--radius);
  padding: 14px 16px;
  color: #5c3b03;
}

.stale-banner p {
  margin: 3px 0 0;
  color: #74521a;
}

.sbom-search-match {
  border-color: #c7d1dd;
}

.sbom-search-match.found {
  border-color: #91d3c7;
  background: #f2fbf8;
}

.brief-title,
.header-actions,
.metric-grid,
.metric-card,
.panel,
.tab-panel {
  min-width: 0;
}

.brief-title h2 {
  margin: 4px 0 8px;
  font-size: 28px;
  line-height: 1.16;
  overflow-wrap: anywhere;
}

.brief-title p {
  margin: 0;
  color: var(--muted);
  max-width: 92ch;
  overflow-wrap: anywhere;
}

.header-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.badge-row,
.metric-grid,
.tabs,
.toolbar,
.card-grid,
.link-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.badge,
.risk-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  padding: 5px 9px;
  font-size: 12px;
  font-weight: 800;
  border: 1px solid var(--line);
  background: var(--panel-soft);
}

.risk-badge {
  min-width: 108px;
  justify-content: center;
}

.risk-Critical {
  background: #fff1f0;
  color: var(--red);
  border-color: #f0aaa3;
}

.risk-High {
  background: #fff4e5;
  color: var(--amber);
  border-color: #e8c080;
}

.risk-Elevated {
  background: #eff6ff;
  color: var(--blue);
  border-color: #b7cdf7;
}

.risk-Watch {
  background: #ecfdf5;
  color: var(--green);
  border-color: #a9dbc8;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.metric-card,
.panel,
.evidence-card,
.timeline-item,
.table-wrap {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.metric-card {
  padding: 14px;
  min-height: 104px;
}

.metric-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0;
}

.metric-value {
  margin-top: 8px;
  font-size: 25px;
  font-weight: 850;
  overflow-wrap: anywhere;
}

.metric-value.compact {
  font-size: 18px;
  line-height: 1.18;
}

.metric-detail {
  color: var(--muted);
  margin-top: 3px;
  font-size: 13px;
  overflow-wrap: anywhere;
}

.tabs {
  border-bottom: 1px solid var(--line);
}

.tab-button {
  border: 0;
  border-bottom: 3px solid transparent;
  background: transparent;
  color: var(--muted);
  padding: 12px 10px;
  font-weight: 800;
}

.tab-button.active {
  color: var(--teal-dark);
  border-bottom-color: var(--teal);
}

.tab-panel {
  display: grid;
  gap: 16px;
}

.panel {
  padding: 18px;
}

.panel h3 {
  margin: 0 0 10px;
  font-size: 18px;
}

.panel p {
  margin-top: 0;
}

.panel-title-row {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 14px;
  margin-bottom: 12px;
}

.panel-title-row p {
  margin: 0;
  color: var(--muted);
}

.copy-panel .primary-button {
  flex: 0 0 auto;
}

.table-button {
  min-height: 34px;
  white-space: nowrap;
}

.link-button {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--blue);
  padding: 0;
  font-weight: 800;
  text-align: left;
}

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

.selected-row td {
  background: #eefaf7;
}

.table-note {
  color: var(--muted);
  margin: 10px 0 0;
  font-size: 13px;
}

.muted-cell {
  color: var(--muted);
  font-size: 12px;
}

.remediation-text {
  min-height: 360px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 13px;
  line-height: 1.55;
  white-space: pre-wrap;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.action-item {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 13px;
  background: var(--panel-soft);
}

.action-item strong {
  display: block;
  margin-bottom: 4px;
}

.action-item p {
  color: var(--muted);
  margin: 0;
}

.action-item p + p {
  margin-top: 8px;
}

.real-world-panel {
  display: grid;
  gap: 14px;
}

.real-world-header {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px;
  align-items: start;
}

.real-world-score {
  min-width: 190px;
  display: grid;
  gap: 6px;
  justify-items: end;
  text-align: right;
}

.real-world-score strong {
  font-size: 26px;
}

.real-world-score span:last-child {
  color: var(--muted);
  font-size: 13px;
}

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

.signal-grid > div {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-soft);
  padding: 12px;
  display: grid;
  gap: 4px;
}

.signal-grid strong {
  line-height: 1.2;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 680px;
}

th,
td {
  text-align: left;
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0;
  background: var(--panel-soft);
}

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

.toolbar {
  justify-content: space-between;
  align-items: center;
}

.trust-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(90px, 1fr)) minmax(220px, 2fr);
  gap: 8px;
  align-items: stretch;
  margin-bottom: 12px;
}

.trust-strip div,
.trust-strip p {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-soft);
  margin: 0;
  padding: 10px;
}

.trust-strip span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.trust-strip strong {
  display: block;
  font-size: 22px;
}

.trust-strip p {
  color: var(--muted);
}

.toolbar-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.evidence-list {
  display: grid;
  gap: 10px;
}

.evidence-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 14px;
  padding: 14px;
}

.evidence-card h3 {
  margin: 0 0 5px;
  font-size: 16px;
}

.evidence-card p {
  margin: 0;
  color: var(--muted);
}

.evidence-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.timeline-list {
  display: grid;
  gap: 10px;
}

.timeline-item {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 12px;
  padding: 14px;
}

.timeline-date {
  color: var(--muted);
  font-weight: 700;
}

.workspace-grid {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 14px;
}

.form-grid {
  display: grid;
  gap: 12px;
}

.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.link-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.source-link {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-soft);
  min-width: 0;
}

.source-link span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.error-panel {
  background: #fff5f3;
  border: 1px solid #f3b8b2;
  color: #621b16;
  border-radius: var(--radius);
  padding: 16px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 1100px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: relative;
    height: auto;
  }

  .metric-grid,
  .card-grid,
  .workspace-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .topbar,
  .content {
    padding: 14px;
  }

  .search-form {
    grid-template-columns: 1fr;
  }

  .stale-banner {
    display: grid;
  }

  .trust-strip {
    grid-template-columns: 1fr 1fr;
  }

  .trust-strip p {
    grid-column: 1 / -1;
  }

  .brief-header,
  .evidence-card,
  .timeline-item,
  .two-col,
  .link-grid,
  .real-world-header,
  .signal-grid {
    grid-template-columns: 1fr;
  }

  .header-actions {
    justify-content: flex-start;
  }

  .header-actions > button {
    flex: 1 1 130px;
  }

  .real-world-score {
    justify-items: start;
    text-align: left;
  }

  .panel-title-row {
    display: grid;
  }

  .copy-panel .primary-button {
    width: 100%;
  }

  .empty-panel {
    padding: 22px;
  }

  .empty-panel h2 {
    font-size: 24px;
  }
}

.watch-card {
  display: grid;
  gap: 8px;
}

.watch-main {
  all: unset;
  cursor: pointer;
  display: grid;
  gap: 4px;
}

.watch-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.watch-actions button {
  min-height: 30px;
  border-radius: var(--radius);
  border: 1px solid #3a4d61;
  background: #111820;
  color: #dbe7f2;
  font-size: 12px;
  font-weight: 700;
}

.watch-change-list {
  margin-top: 12px;
}

.evidence-card .badge:first-child,
.action-item .badge:first-child {
  max-width: 100%;
}

.copy-panel + .copy-panel {
  margin-top: 0;
}
