:root {
  color-scheme: light;
  --bg: #f4f6f5;
  --panel: #ffffff;
  --panel-subtle: #f8faf9;
  --text: #1e2524;
  --muted: #65706d;
  --line: #dbe3e0;
  --line-strong: #bccbc5;
  --accent: #1b7f6b;
  --accent-weak: #e2f2ee;
  --warn: #a05d00;
  --danger: #b33a3a;
  --ok: #24724f;
  --info: #315e96;
  --shadow: 0 10px 24px rgba(31, 45, 41, 0.08);
}

* {
  box-sizing: border-box;
}

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

button,
input,
select {
  font: inherit;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 16px 22px;
  border-bottom: 1px solid var(--line);
  background: rgba(250, 252, 251, 0.96);
  backdrop-filter: blur(10px);
}

.eyebrow {
  margin: 0 0 3px;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: 21px;
  line-height: 1.2;
}

h2 {
  font-size: 15px;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

button {
  min-height: 34px;
  padding: 0 13px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--panel);
  color: var(--text);
  cursor: pointer;
}

button:hover {
  border-color: var(--accent);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(260px, 300px) minmax(0, 1fr);
  gap: 18px;
  padding: 18px;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.main-panel {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 14px;
}

.panel,
.notice {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.panel {
  padding: 14px;
}

.notice {
  padding: 11px 13px;
  color: var(--muted);
}

.notice.ok {
  border-color: #b5d7ca;
  background: #eef8f4;
  color: #205d4c;
}

.notice.error {
  border-color: #e5c0c0;
  background: #fff3f3;
  color: var(--danger);
}

.policy-list {
  display: grid;
  gap: 8px;
  margin: 10px 0 0;
  padding-left: 18px;
  color: var(--muted);
}

label {
  display: grid;
  gap: 6px;
  margin-top: 12px;
  color: var(--muted);
}

input,
select {
  width: 100%;
  min-height: 36px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  padding: 0 10px;
}

input:focus,
select:focus {
  outline: 2px solid var(--accent-weak);
  border-color: var(--accent);
}

.metrics {
  display: grid;
  grid-template-columns: repeat(8, minmax(120px, 1fr));
  gap: 10px;
}

.metric {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 12px;
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.metric strong {
  display: block;
  margin-top: 4px;
  font-size: 22px;
  line-height: 1.1;
}

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

.count,
.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 0 9px;
  font-size: 12px;
  white-space: nowrap;
}

.count {
  background: var(--panel-subtle);
  color: var(--muted);
}

.badge {
  border: 1px solid var(--line);
  background: var(--panel-subtle);
}

.badge.ok {
  border-color: #acd2c3;
  background: #e8f6f0;
  color: var(--ok);
}

.badge.warn {
  border-color: #e0c393;
  background: #fff6e8;
  color: var(--warn);
}

.badge.danger {
  border-color: #e5b8b8;
  background: #fff0f0;
  color: var(--danger);
}

.badge.info {
  border-color: #b8c9df;
  background: #edf4fd;
  color: var(--info);
}

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

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

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

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

th {
  position: sticky;
  top: 0;
  background: var(--panel-subtle);
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

td {
  word-break: break-word;
}

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

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

.stack {
  display: grid;
  gap: 10px;
}

.item {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-subtle);
  padding: 10px;
}

.item-title {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
  font-weight: 650;
}

.item-meta,
.source-list {
  color: var(--muted);
  font-size: 12px;
}

.source-entry {
  display: grid;
  gap: 4px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
}

.source-entry:last-child {
  border-bottom: 0;
}

.mono {
  font-family: "Cascadia Mono", "Consolas", monospace;
}

.empty {
  color: var(--muted);
  padding: 10px;
}

@media (max-width: 1180px) {
  .metrics {
    grid-template-columns: repeat(4, minmax(130px, 1fr));
  }

  .grid-two {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 860px) {
  .topbar {
    position: static;
    align-items: flex-start;
    flex-direction: column;
  }

  .workspace {
    grid-template-columns: 1fr;
    padding: 12px;
  }

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