:root {
  --bg: #f5f7fb;
  --panel: #ffffff;
  --text: #172033;
  --muted: #647087;
  --line: #dfe5ef;
  --accent: #2563eb;
  --accent-dark: #1d4ed8;
  --danger: #dc2626;
  --ok: #15803d;
  --warn: #b45309;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Arial, "Microsoft YaHei", sans-serif;
  font-size: 14px;
}

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

.app {
  min-height: 100vh;
}

.topbar {
  height: 56px;
  background: #111827;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
}

.brand {
  font-weight: 700;
  letter-spacing: 0;
}

.nav {
  display: flex;
  gap: 6px;
  align-items: center;
}

.nav a,
.nav button {
  color: #dbeafe;
  background: transparent;
  border: 0;
  padding: 8px 10px;
  border-radius: 6px;
  cursor: pointer;
  font: inherit;
}

.nav a.active,
.nav a:hover,
.nav button:hover {
  background: #1f2937;
  color: #fff;
}

.container {
  max-width: 1240px;
  margin: 0 auto;
  padding: 24px;
}

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

.page-title h1 {
  margin: 0;
  font-size: 24px;
}

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

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

.two-col {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 0.8fr);
  gap: 16px;
  align-items: start;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 16px;
}

.panel h2,
.panel h3 {
  margin: 0 0 12px;
  font-size: 17px;
}

.stat {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
}

.stat strong {
  display: block;
  font-size: 28px;
  margin-bottom: 4px;
}

label {
  display: block;
  font-weight: 600;
  margin: 10px 0 5px;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 9px 10px;
  font: inherit;
  background: #fff;
  color: var(--text);
}

textarea {
  min-height: 110px;
  resize: vertical;
  line-height: 1.5;
}

.textarea-xl {
  min-height: 460px;
  font-family: Consolas, "Courier New", monospace;
}

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

.actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 12px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
  padding: 9px 12px;
  border-radius: 6px;
  cursor: pointer;
  font: inherit;
  min-height: 38px;
}

.btn:hover {
  background: var(--accent-dark);
  color: #fff;
}

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

.btn.danger {
  border-color: var(--danger);
  background: var(--danger);
}

.table {
  width: 100%;
  border-collapse: collapse;
}

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

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

.badge {
  display: inline-block;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 8px;
  color: var(--muted);
  background: #fff;
  font-size: 12px;
}

.severity-严重,
.severity-高危 {
  color: #b91c1c;
  border-color: #fecaca;
  background: #fef2f2;
}

.severity-中危 {
  color: var(--warn);
  border-color: #fed7aa;
  background: #fff7ed;
}

.severity-低危,
.severity-信息 {
  color: var(--ok);
  border-color: #bbf7d0;
  background: #f0fdf4;
}

.flash {
  border-radius: 6px;
  padding: 10px 12px;
  margin-bottom: 16px;
}

.flash.error {
  background: #fef2f2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

.flash.success {
  background: #f0fdf4;
  color: #166534;
  border: 1px solid #bbf7d0;
}

.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-box {
  width: min(420px, 100%);
}

.code-view {
  white-space: pre-wrap;
  background: #0f172a;
  color: #dbeafe;
  border-radius: 8px;
  padding: 14px;
  line-height: 1.55;
  overflow: auto;
}

.checkbox-grid {
  display: grid;
  gap: 8px;
}

.checkbox {
  display: flex;
  gap: 8px;
  align-items: center;
  font-weight: 400;
  margin: 0;
}

.checkbox input {
  width: auto;
}

.workspace-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 520px;
  gap: 18px;
  align-items: start;
}

.workspace-main,
.workspace-side {
  min-width: 0;
}

.workspace-side {
  position: sticky;
  top: 16px;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.section-head h2 {
  margin: 0;
}

.vuln-list {
  display: grid;
  gap: 12px;
}

.vuln-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fff;
}

.vuln-card-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
}

.vuln-card h3 {
  margin: 0 0 5px;
  font-size: 16px;
  line-height: 1.35;
}

.vuln-card p {
  margin: 0;
}

.vuln-meta {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
  padding: 10px;
  background: #f8fafc;
  border-radius: 6px;
}

.vuln-meta > div {
  min-width: 0;
}

.meta-label {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 3px;
}

.vuln-meta strong {
  display: block;
  overflow-wrap: anywhere;
}

.tag-row,
.posture-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.detail-list {
  margin: 12px 0 0;
  border-top: 1px solid var(--line);
}

.detail-list div {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}

.detail-list dt {
  color: var(--muted);
  font-weight: 600;
}

.detail-list dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.compact-table td,
.compact-table th {
  padding: 8px;
}

.form-panel fieldset {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  margin: 0 0 14px;
}

.form-panel legend {
  padding: 0 6px;
  color: var(--muted);
  font-weight: 700;
}

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

.asset-check-list {
  display: grid;
  gap: 7px;
  max-height: 260px;
  overflow: auto;
  padding-right: 4px;
}

.asset-check-list small {
  display: block;
  color: var(--muted);
  margin-top: 2px;
  overflow-wrap: anywhere;
}

.report-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 18px;
  align-items: start;
}

.report-main,
.report-side {
  min-width: 0;
}

.report-side {
  position: sticky;
  top: 16px;
}

.markdown-preview {
  line-height: 1.75;
  overflow-wrap: anywhere;
}

.markdown-preview h1 {
  font-size: 24px;
  margin: 0 0 14px;
}

.markdown-preview h2 {
  font-size: 19px;
  margin: 22px 0 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--line);
}

.markdown-preview h3 {
  font-size: 16px;
  margin: 18px 0 8px;
}

.markdown-preview code {
  background: #eef2ff;
  border: 1px solid #dbe4ff;
  border-radius: 4px;
  padding: 1px 4px;
}

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

.evidence-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #fff;
  overflow-wrap: anywhere;
}

.evidence-item p {
  margin: 6px 0 0;
}

@media (max-width: 900px) {
  .grid,
  .two-col,
  .row,
  .workspace-layout,
  .report-layout,
  .vuln-meta,
  .switch-grid {
    grid-template-columns: 1fr;
  }

  .workspace-side,
  .report-side {
    position: static;
  }

  .topbar {
    height: auto;
    align-items: flex-start;
    flex-direction: column;
    padding: 14px;
  }

  .nav {
    flex-wrap: wrap;
  }
}
