:root {
  --sidebar-bg: #111827;
  --sidebar-fg: #d1d5db;
  --line: #e5e7eb;
  --accent: #2563eb;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: #f3f4f6;
  color: #111827;
  font-size: 14px;
}

.layout { display: flex; min-height: 100vh; }

.sidebar {
  width: 220px;
  flex: 0 0 220px;
  background: var(--sidebar-bg);
  color: var(--sidebar-fg);
  padding: 16px 12px;
}

.sidebar h1 { font-size: 15px; color: #fff; margin: 0 8px 16px; font-weight: 600; }

.sidebar nav a {
  display: block;
  padding: 8px 12px;
  border-radius: 6px;
  color: var(--sidebar-fg);
  text-decoration: none;
  margin-bottom: 2px;
}

.sidebar nav a:hover { background: #1f2937; color: #fff; }
.sidebar nav a.active { background: #374151; color: #fff; }
.sidebar .bottom { margin-top: 24px; border-top: 1px solid #1f2937; padding-top: 12px; font-size: 13px; }
.sidebar .bottom a { color: #93c5fd; }

.main { flex: 1; padding: 24px 28px; min-width: 0; }
.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; gap: 12px; flex-wrap: wrap; }
.page-head h2 { margin: 0; font-size: 20px; }
.page-head .sub { color: #6b7280; font-size: 13px; margin-top: 4px; }

.card { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 16px; margin-bottom: 16px; }
.card h3 { margin: 0 0 12px; font-size: 15px; }

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

.btn {
  display: inline-block;
  padding: 7px 14px;
  border-radius: 6px;
  border: 1px solid #d1d5db;
  background: #fff;
  color: #111827;
  cursor: pointer;
  text-decoration: none;
  font-size: 13px;
}
.btn:hover { background: #f9fafb; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: #1d4ed8; }
.btn.danger { background: #dc2626; border-color: #dc2626; color: #fff; }
.btn.danger:hover { background: #b91c1c; }
.btn.small { padding: 4px 9px; font-size: 12px; }

input[type="text"], input[type="password"], input[type="number"], select, textarea {
  width: 100%;
  padding: 7px 9px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
  background: #fff;
}
textarea { resize: vertical; }
input.readonly, input:disabled { background: #f3f4f6; color: #6b7280; }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; }
.form-grid .full { grid-column: 1 / -1; }
.form-grid label { display: block; font-size: 13px; color: #374151; margin-bottom: 4px; }
.form-grid .hint { font-size: 12px; color: #9ca3af; margin-top: 4px; }

table.grid { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.grid th, table.grid td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.grid th { color: #6b7280; font-weight: 600; font-size: 12px; letter-spacing: .03em; }
table.grid tr:last-child td { border-bottom: none; }
table.grid td.actions-cell { white-space: nowrap; }

.empty { color: #6b7280; padding: 24px; text-align: center; }
.muted { color: #6b7280; }
.small { font-size: 12px; }

.yellow-bar {
  background: #fef3c7;
  border: 1px solid #f59e0b;
  color: #92400e;
  padding: 10px 12px;
  border-radius: 6px;
  margin-bottom: 12px;
}

pre.fragment {
  background: #0f172a;
  color: #e2e8f0;
  padding: 14px;
  border-radius: 8px;
  overflow: auto;
  font-size: 12.5px;
  line-height: 1.5;
  margin: 0;
  max-height: 480px;
}

.findings { margin-top: 12px; }
.findings .finding { padding: 10px 12px; border-radius: 6px; margin-bottom: 8px; border: 1px solid; }
.findings .finding.error { background: #fef2f2; border-color: #ef4444; color: #991b1b; }
.findings .finding.warning { background: #fffbeb; border-color: #f59e0b; color: #92400e; }

.login-wrap { max-width: 360px; margin: 12vh auto; }
.login-wrap .card { padding: 24px; }
.login-wrap h2 { margin: 0 0 16px; font-size: 18px; }

.tag { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12px; border: 1px solid #d1d5db; color: #374151; background: #f9fafb; }
.tag.detail { border-color: #93c5fd; color: #1d4ed8; background: #eff6ff; }
.tag.summary { border-color: #c4b5fd; color: #6d28d9; background: #f5f3ff; }

.row-list { display: flex; flex-direction: column; gap: 8px; }
.subtable { border: 1px dashed #d1d5db; border-radius: 8px; padding: 10px; margin-bottom: 10px; }
.subtable .subtable-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
