:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-alt: #eef2f6;
  --text: #17202a;
  --muted: #5f6b7a;
  --border: #d7dde5;
  --accent: #1f6feb;
  --accent-soft: #e8f1ff;
  --danger: #b42318;
  --danger-soft: #fff0ed;
  --warning: #b54708;
  --warning-soft: #fff4e5;
  --success: #157a4b;
  --success-soft: #e7f6ee;
  --radius: 8px;
  --shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

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

button,
input,
select {
  font: inherit;
}

.skip-link {
  position: absolute;
  left: 12px;
  top: -48px;
  z-index: 100;
  padding: 8px 12px;
  background: var(--text);
  color: #fff;
  border-radius: 4px;
}

.skip-link:focus {
  top: 12px;
}

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

.sidebar {
  background: #101820;
  color: #f8fafc;
  padding: 20px 16px;
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 24px;
}

.brand-mark {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #f59e0b;
  color: #111827;
  font-weight: 700;
}

.brand span:last-child {
  display: block;
  color: #b6c2cf;
  font-size: 13px;
}

.nav-list {
  display: grid;
  gap: 6px;
}

.nav-item {
  min-height: 44px;
  border: 0;
  border-radius: 8px;
  padding: 0 12px;
  background: transparent;
  color: #dbe4ee;
  text-align: left;
  cursor: pointer;
}

.nav-item:hover,
.nav-item:focus-visible,
.nav-item.is-active {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

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

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

.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 13px;
}

h1,
h2,
h3 {
  margin: 0;
  line-height: 1.25;
}

h1 {
  font-size: 26px;
}

.status-strip {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.view-root {
  display: grid;
  gap: 16px;
}

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

.card,
.metric-card,
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.metric-card,
.panel {
  padding: 16px;
}

.metric-label,
.muted {
  color: var(--muted);
}

.metric-value {
  margin-top: 6px;
  font-size: 24px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

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

.audit-module {
  display: grid;
  gap: 12px;
}

.audit-module-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.audit-module-header h3 {
  margin-bottom: 4px;
}

.module-summary {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.module-toggle {
  min-height: 28px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  padding: 0 10px;
  font-weight: 700;
  cursor: pointer;
}

.module-toggle:hover,
.module-toggle:focus-visible {
  border-color: var(--accent);
  color: var(--accent);
  outline: none;
}

.control {
  min-height: 40px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  padding: 0 10px;
}

.table-wrap {
  overflow-x: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

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

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

th {
  background: var(--surface-alt);
  font-weight: 700;
  white-space: nowrap;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 0 8px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.tag-danger { background: var(--danger-soft); color: var(--danger); }
.tag-warning { background: var(--warning-soft); color: var(--warning); }
.tag-success { background: var(--success-soft); color: var(--success); }
.tag-info { background: var(--accent-soft); color: var(--accent); }
.tag-neutral { background: var(--surface-alt); color: var(--muted); }

.detail-drawer {
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.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: 840px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
  }

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

  .topbar {
    display: grid;
  }

  .status-strip {
    justify-content: flex-start;
  }

  .main-content {
    padding: 16px;
  }
}

@media (max-width: 640px) {
  body {
    font-size: 14px;
  }

  .metric-value {
    font-size: 21px;
  }

  .nav-list {
    grid-template-columns: 1fr;
  }

  .toolbar {
    display: grid;
  }

  .audit-module-header,
  .module-summary {
    display: grid;
    justify-content: stretch;
  }

  .control {
    width: 100%;
  }
}
