:root {
  --bg: #f8f9fb;
  --surface: #ffffff;
  --surface-muted: #f1f3f5;
  --border: #e2e5e9;
  --text: #1a1d21;
  --text-muted: #6b7280;
  --accent: #4f6ce5;
  --accent-hover: #3b54c4;
  --accent-soft: #eef1fc;
  --danger-soft: #fde8e8;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.02);
}

html {
  color-scheme: light only;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  min-height: 100vh;
  color: var(--text);
  font-family: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  font-size: 0.9375rem;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
}

.shell {
  width: min(1120px, calc(100% - 2rem));
  margin: 0 auto;
}

.site-header {
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.site-header .shell {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 0;
}

.brand {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  font-size: 1rem;
  white-space: nowrap;
}

.brand a {
  text-decoration: none;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.brand-tag {
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.125rem;
}

.site-nav a {
  text-decoration: none;
  padding: 0.3rem 0.6rem;
  border-radius: 6px;
  background: transparent;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
}

.site-nav a:hover {
  background: var(--surface-muted);
  color: var(--text);
}

.page-content {
  padding: 2rem 0 3rem;
}

.flash {
  margin-bottom: 1rem;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  font-size: 0.875rem;
}

.flash-success {
  background: var(--accent-soft);
  color: var(--accent);
}

.flash-error {
  background: var(--danger-soft);
  color: #b91c1c;
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.page-header.with-form {
  align-items: start;
}

.eyebrow {
  margin: 0 0 0.25rem;
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1, h2 {
  margin: 0;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.page-subtitle {
  margin: 0.35rem 0 0;
  max-width: 40rem;
  color: var(--text-muted);
  font-size: 0.875rem;
}

.metric-grid,
.metric-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.875rem;
  margin-bottom: 1.5rem;
}

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

.metric-card {
  padding: 1rem 1.1rem;
}

.metric-label {
  display: block;
  margin-bottom: 0.25rem;
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 500;
}

.metric-value {
  font-size: 1.75rem;
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.02em;
}

.content-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 0.875rem;
  margin-bottom: 1.5rem;
}

.panel {
  padding: 1rem 1.1rem;
}

.action-stack,
.action-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.action-group form {
  margin: 0;
}

.status-list {
  list-style: none;
  margin: 1rem 0 0;
  padding: 0;
  display: grid;
  gap: 0.5rem;
}

.status-list li {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

.status-list li:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.filter-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: end;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow);
  padding: 0.875rem;
}

.filter-form label {
  display: grid;
  gap: 0.25rem;
  min-width: 180px;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-muted);
}

.checkbox-field {
  grid-template-columns: auto 1fr;
  align-items: center;
  min-width: 160px;
}

.checkbox-field input {
  width: 1rem;
  height: 1rem;
  margin: 0;
}

.filter-form input,
.filter-form select,
.filter-form button {
  font: inherit;
  border-radius: 6px;
  border: 1px solid var(--border);
  padding: 0.5rem 0.65rem;
  background: var(--surface);
  color: var(--text);
  transition: border-color 0.15s;
}

.filter-form input:focus,
.filter-form select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.filter-form button {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s;
}

.filter-form button:hover {
  background: var(--accent-hover);
}

.button-muted {
  background: var(--surface-muted);
  color: var(--text);
  border-color: var(--border);
}

.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 0.85rem;
  border-radius: 6px;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 500;
  transition: background 0.15s;
}

.button-link:hover {
  background: var(--accent-hover);
}

.button-inline {
  margin-top: 0.35rem;
  font: inherit;
  border-radius: 6px;
  border: 1px solid var(--border);
  padding: 0.4rem 0.65rem;
  background: var(--surface);
  color: var(--text);
  font-size: 0.85rem;
  cursor: pointer;
  transition: background 0.15s;
}

.button-inline:hover {
  background: var(--surface-muted);
}

.top-gap {
  margin-top: 1rem;
}

.table-wrapper {
  overflow-x: auto;
}

table,
.data-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
  background: var(--surface);
  color: var(--text);
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

th,
td {
  text-align: left;
  padding: 0.65rem 0.6rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  color: var(--text);
}

th {
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: var(--surface-muted);
}

.status-pill {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 600;
}

.status-pill-highlight {
  background: #fef3c7;
  color: #92400e;
}

.badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-success {
  background: var(--accent-soft);
  color: var(--accent);
}

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

.table-link {
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
}

.table-link:hover {
  text-decoration: underline;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.9rem 1rem;
  margin: 0;
}

.detail-grid.compact {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.detail-grid div {
  padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--border);
}

.detail-grid dt {
  margin-bottom: 0.15rem;
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.detail-grid dd {
  margin: 0;
}

.long-text {
  margin-top: 1rem;
  color: var(--text-muted);
  line-height: 1.6;
}

.inline-list,
.contribution-list,
.linked-list,
.response-list,
.audit-list {
  list-style: none;
  padding: 0;
  margin: 1rem 0 0;
  display: grid;
  gap: 0.6rem;
}

.inline-list li,
.contribution-list li,
.linked-list li,
.response-list li,
.audit-list li {
  padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--border);
}

.contribution-list li,
.response-list li,
.audit-list li {
  display: grid;
  gap: 0.2rem;
}

.linked-list li {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
}

.message-body {
  white-space: pre-wrap;
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.875rem;
  font-family: "JetBrains Mono", "Fira Code", "Consolas", monospace;
  font-size: 0.85rem;
  line-height: 1.55;
}

.map-canvas {
  min-height: 520px;
  border-radius: 10px;
  overflow: hidden;
}

.empty-state {
  color: var(--text-muted);
  text-align: center;
  padding: 1.25rem;
}

@media (max-width: 720px) {
  .site-header .shell,
  .page-header {
    flex-direction: column;
    align-items: start;
  }

  .filter-form {
    width: 100%;
  }

  .filter-form label,
  .filter-form button {
    width: 100%;
  }
}
