:root {
  --border: #d9dce1;
  --muted: #5b616b;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  background: #f6f7f9;
  color: #1c1e21;
  font-size: 16px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.6rem 1rem;
  background: #111827;
  color: #fff;
}

.brand { font-weight: 700; }
.nav a { color: #fff; margin-left: 1rem; }

.container { max-width: 960px; margin: 1.5rem auto; padding: 0 1rem; }

.card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem 1.25rem;
  margin-bottom: 1rem;
}

.alert {
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  margin: 0.5rem 0;
}
.alert.error { background: #fdecea; color: #8b1a1a; border: 1px solid #f0b9b4; }
.alert.ok { background: #e8f5e9; color: #1b5e20; border: 1px solid #b9dfbc; }

.secret {
  font-size: 1.1rem;
  letter-spacing: 0.06em;
  word-break: break-all;
}

.stack > * { margin-bottom: 0.5rem; }
label { display: block; font-size: 0.9rem; color: var(--muted); }
input, select, button {
  padding: 0.4rem 0.55rem;
  margin-top: 0.2rem;
  border: 1px solid #c8ccd2;
  border-radius: 6px;
  font-size: 0.95rem;
}
input { width: 100%; }
button {
  background: #111827;
  color: #fff;
  border: 0;
  cursor: pointer;
}

table.users {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border: 1px solid var(--border);
}
table.users th, table.users td {
  border: 1px solid #e2e5e9;
  padding: 0.45rem 0.6rem;
  text-align: left;
  font-size: 0.9rem;
  vertical-align: middle;
}
table.users .actions { white-space: nowrap; }
table.users .actions form { display: inline-block; margin-right: 0.35rem; }
table.users .actions button {
  padding: 0.25rem 0.5rem;
  font-size: 0.8rem;
}

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

/* ---------------------------------------------------------------------------
 * B4: findings + dependency UI (appended; earlier rules stay untouched)
 * ------------------------------------------------------------------------- */

.identity { color: var(--muted); }
.inline-form { display: inline; margin-left: 0.5rem; }
.link-button {
  background: none;
  border: 0;
  color: #2563eb;
  padding: 0;
  font-size: 0.9rem;
  text-decoration: underline;
  cursor: pointer;
}

.count { color: var(--muted); font-weight: 400; font-size: 0.9rem; }
.muted { color: var(--muted); }

.stale-badge {
  display: inline-block;
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  background: #fdecea;
  color: #8b1a1a;
  border: 1px solid #f0b9b4;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.filter-row { display: flex; gap: 0.75rem; align-items: flex-end; flex-wrap: wrap; }
.filter-row label { display: block; }
.filter-row select, .filter-row input { margin-top: 0.2rem; }
.filter-row .q-label input { width: 14rem; }

table.data {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border: 1px solid var(--border);
  margin: 0.5rem 0;
}
table.data th, table.data td {
  border: 1px solid #e2e5e9;
  padding: 0.4rem 0.55rem;
  text-align: left;
  font-size: 0.88rem;
  vertical-align: top;
}
table.data thead th { background: #f0f2f5; }
.title-cell { max-width: 26rem; word-break: break-word; }
.summary-cell { max-width: 22rem; word-break: break-word; }

.pager { margin: 0.75rem 0; display: flex; gap: 1rem; align-items: center; }
.pager-info { color: var(--muted); font-size: 0.88rem; }

.status-chip {
  display: inline-block;
  padding: 0.12rem 0.5rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  border: 1px solid transparent;
}
.status-open { background: #fef3c7; color: #92400e; border-color: #fde68a; }
.status-in_progress { background: #dbeafe; color: #1e40af; border-color: #bfdbfe; }
.status-fixed,
.status-verified_fixed,
.status-fixed_upstream,
.status-fixed_in_sync { background: #dcfce7; color: #14532d; border-color: #bbf7d0; }
.status-intended,
.status-wontfix,
.status-duplicate,
.status-out_of_scope,
.status-withdrawn { background: #e5e7eb; color: #374151; border-color: #d1d5db; }
.status-pending { background: #fef3c7; color: #92400e; border-color: #fde68a; }
.status-claimed { background: #dbeafe; color: #1e40af; border-color: #bfdbfe; }
.status-succeeded { background: #dcfce7; color: #14532d; border-color: #bbf7d0; }
.status-failed, .status-canceled { background: #fdecea; color: #8b1a1a; border-color: #f0b9b4; }
.state-pending { background: #fef3c7; color: #92400e; border-color: #fde68a; }
.state-applied { background: #dcfce7; color: #14532d; border-color: #bbf7d0; }
.state-failed { background: #fdecea; color: #8b1a1a; border-color: #f0b9b4; }
.state-skipped { background: #e5e7eb; color: #374151; border-color: #d1d5db; }

.sev-chip {
  display: inline-block;
  padding: 0.12rem 0.5rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  border: 1px solid transparent;
}
.sev-critical { background: #991b1b; color: #fff; border-color: #7f1d1d; }
.sev-high { background: #fdecea; color: #8b1a1a; border-color: #f0b9b4; }
.sev-medium { background: #fef3c7; color: #92400e; border-color: #fde68a; }
.sev-low { background: #fef9c3; color: #854d0e; border-color: #fef08a; }
.sev-info { background: #dbeafe; color: #1e40af; border-color: #bfdbfe; }

.chip {
  display: inline-block;
  padding: 0.1rem 0.45rem;
  border-radius: 4px;
  font-size: 0.75rem;
  background: #e5e7eb;
  color: #374151;
}
.chip.encrypted { background: #ede9fe; color: #5b21b6; }

.dot { font-size: 0.95rem; }
.dot-on { color: #15803d; }
.dot-off { color: #c4c8cd; }

pre.code {
  background: #111827;
  color: #e5e7eb;
  padding: 0.75rem 0.9rem;
  border-radius: 6px;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 0.86rem;
  line-height: 1.45;
}

.shield-grid {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.35rem 1rem;
  margin: 0;
}
.shield-grid dt { color: var(--muted); font-size: 0.88rem; }
.shield-grid dd { margin: 0; }
.extra-fields { margin-top: 0.75rem; }
.history-bullets li { margin: 0.15rem 0; }
.fixed-in-item { margin-right: 0.75rem; }

.job-feed { list-style: none; padding-left: 0; margin: 0.5rem 0; }
.job-feed li { padding: 0.25rem 0; border-bottom: 1px solid #eceff2; }
.job-feed-meta { color: var(--muted); font-size: 0.82rem; margin: 0 0.5rem; }

.action-row { margin: 0.75rem 0; }
.action-form label { display: block; margin-bottom: 0.4rem; }
.action-form textarea { width: 24rem; max-width: 100%; }
.action-form button { margin-right: 0.5rem; }
.check-label { display: inline-block !important; margin-right: 1rem; }
.check-label input { width: auto; }
.dup-field input { max-width: 16rem; display: inline-block; }

.repo-group h3 { margin-bottom: 0.4rem; }
.repo-meta { color: var(--muted); font-weight: 400; font-size: 0.85rem; }
.lockfile-heading { background: #f0f2f5 !important; }
.toggle-link { font-size: 0.85rem; font-weight: 400; margin-left: 0.75rem; }
.locked-version { margin-right: 0.5rem; }

/* dark mode */
@media (prefers-color-scheme: dark) {
  :root { --border: #33383f; --muted: #9aa2ab; }
  body { background: #17191d; color: #e4e6e9; }
  .card, table.data, table.users { background: #1f2329; border-color: #33383f; }
  table.data th, table.data td, table.users th, table.users td { border-color: #2b3037; }
  table.data thead th { background: #262b32; }
  input, select, button { background: #262b32; color: #e4e6e9; border-color: #444b54; }
  .status-intended, .status-wontfix, .status-duplicate, .status-out_of_scope,
  .status-withdrawn, .state-skipped, .chip { background: #2f343b; color: #c3c9d1; }
  .job-feed li { border-color: #2b3037; }
}
