:root {
  color-scheme: dark;
  --bg: #0c1118;
  --panel: #131c27;
  --border: #293749;
  --text: #e9eef5;
  --muted: #98a9bd;
  --accent: #65d5be;
  --red: #ff867b;
  --purple: #bba0ff;
  font-family: Inter, ui-sans-serif, system-ui, sans-serif;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
}
header,
footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  padding: 25px 32px;
  border-bottom: 1px solid var(--border);
}
.eyebrow {
  margin: 0 0 8px;
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.18em;
  color: var(--accent);
}
h1 {
  margin: 0;
  font-size: 26px;
  letter-spacing: 0.1em;
}
h1 span {
  color: var(--border);
}
h1 small {
  font-size: 14px;
  letter-spacing: 0.01em;
  font-weight: 400;
  color: var(--muted);
}
h2 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
}
h3 {
  font-size: 16px;
  margin: 0 0 8px;
}
p {
  line-height: 1.5;
}
main {
  padding: 24px 32px;
  max-width: 1600px;
  margin: auto;
}
.status {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 12px;
}
.muted {
  color: var(--muted);
  font-size: 12px;
}
select {
  max-width: 250px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 7px;
  color: var(--text);
  padding: 8px;
  font-size: 11px;
}
.metrics {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}
.metrics article {
  padding: 18px 20px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
}
.metrics span {
  display: block;
  font-size: 11px;
  color: var(--muted);
}
.metrics strong {
  display: block;
  margin-top: 10px;
  font-size: 27px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}
.columns {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 20px;
}
.panel {
  border: 1px solid var(--border);
  background: var(--panel);
  border-radius: 11px;
  overflow: hidden;
}
.panel-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
}
.badge {
  font-size: 10px;
  padding: 5px 9px;
  border: 1px solid var(--accent);
  border-radius: 5px;
  color: var(--accent);
}
#map {
  width: 100%;
  background: radial-gradient(ellipse at 35% 30%, #213549 0%, #131c27 65%);
}
#map text {
  font-family: inherit;
  fill: var(--text);
  font-size: 13px;
  letter-spacing: 0.05em;
}
#map .location-label {
  font-size: 8px;
  fill: var(--muted);
  letter-spacing: 0;
}
.legend {
  display: flex;
  gap: 18px;
  padding: 0 20px;
  font-size: 10px;
  color: var(--muted);
}
.legend span::before {
  content: " ";
  display: inline-block;
  width: 15px;
  height: 2px;
  margin-right: 7px;
  vertical-align: middle;
  background: var(--accent);
}
.legend .closed::before {
  background: var(--red);
}
.legend .planned::before {
  background: var(--purple);
}
.route-plan {
  margin: 18px 20px 0;
  font-size: 13px;
  color: var(--purple);
}
.scope {
  margin: 12px 20px 20px;
  font-size: 11px;
  color: var(--muted);
}
.timeline {
  max-height: 820px;
}
.event-filters { padding: 12px 20px; border-bottom: 1px solid var(--border); display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 11px; }
.event-filters label { display: flex; align-items: center; gap: 6px; }
.event-filters details { flex-basis: 100%; }
.event-filters summary { cursor: pointer; }
#event-types { display: flex; flex-wrap: wrap; gap: 8px 14px; padding-top: 10px; max-height: 130px; overflow: auto; }
#event-scope { flex-basis: 100%; margin: 0; }
.event-filters button { background: var(--panel); color: var(--text); border: 1px solid var(--border); border-radius: 6px; padding: 8px; cursor: pointer; font: inherit; }
#events {
  list-style: none;
  padding: 0;
  margin: 0;
  max-height: 540px;
  overflow: auto;
}
#events li {
  padding: 13px 20px;
  border-bottom: 1px solid var(--border);
}
.event-meta {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 10px;
  color: var(--muted);
  margin-bottom: 6px;
}
.event-title {
  font-size: 12px;
  font-weight: 600;
}
.event-body {
  font-size: 11px;
  margin: 5px 0 0;
  color: var(--muted);
  overflow-wrap: anywhere;
}
.event-rejected {
  color: var(--red);
}
.agents-panel {
  margin-top: 20px;
}
.agent-columns {
  display: grid;
  grid-template-columns: 1.25fr 1fr;
  min-height: 280px;
}
#agents {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
  max-height: 340px;
  overflow: auto;
  padding: 16px;
  border-right: 1px solid var(--border);
}
.agent-button {
  cursor: pointer;
  text-align: left;
  border: 1px solid var(--border);
  background: #172232;
  color: var(--text);
  padding: 10px;
  border-radius: 6px;
  font-size: 10px;
  overflow-wrap: anywhere;
}
.agent-button:hover,
.agent-button.selected {
  border-color: var(--accent);
}
.agent-button span {
  display: block;
  color: var(--muted);
  margin-top: 5px;
  font-size: 9px;
}
.agent-button:focus-visible,
select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
#profile {
  padding: 20px;
  max-height: 340px;
  overflow: auto;
  font-size: 12px;
}
#profile ul {
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.7;
}
.traits {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  color: var(--muted);
  font-size: 11px;
}
.traits progress {
  display: block;
  width: 100%;
  height: 6px;
  margin: 5px 0 8px;
  accent-color: var(--accent);
}
#message {
  color: var(--red);
  font-size: 12px;
}
footer {
  border-top: 1px solid var(--border);
  border-bottom: 0;
  font-size: 10px;
  color: var(--muted);
}
@media (max-width: 950px) {
  header {
    align-items: flex-start;
    flex-direction: column;
  }
  main,
  header,
  footer {
    padding: 20px;
  }
  .columns {
    grid-template-columns: 1fr;
  }
  .metrics {
    grid-template-columns: repeat(3, 1fr);
  }
  .agent-columns {
    grid-template-columns: 1fr;
  }
  #agents {
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }
  footer {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }
}
@media (max-width: 560px) {
  h1 small {
    display: block;
    margin-top: 8px;
  }
  h1 span {
    display: none;
  }
  .metrics {
    grid-template-columns: 1fr 1fr;
  }
  .metrics strong {
    font-size: 22px;
  }
  #agents {
    grid-template-columns: 1fr 1fr;
  }
  .panel-heading {
    align-items: flex-start;
    flex-direction: column;
  }
  .legend {
    gap: 10px;
    font-size: 9px;
  }
}

#nations {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 1px;
  background: var(--border);
}
.nation-card {
  background: var(--panel);
  padding: 18px;
  font-size: 11px;
}
.nation-card p {
  margin: 7px 0;
  color: var(--muted);
}
.nation-card strong {
  color: var(--accent);
  font-size: 18px;
}
.nation-card .government-name {
  color: var(--purple);
  min-height: 32px;
}
.nation-card svg {
  width: 100%;
  height: 40px;
  margin-top: 12px;
}
.nation-card .policy {
  color: var(--purple);
}
.world-ledgers {
  margin-top: 20px;
}
.ledger {
  padding: 4px 20px;
  max-height: 250px;
  overflow: auto;
  font-size: 11px;
}
.ledger p {
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}
.agent-filters {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
}
input,
.agent-filters button {
  background: #172232;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px;
  font: inherit;
  font-size: 11px;
}
.agent-filters button {
  cursor: pointer;
}
.agent-filters button:disabled {
  opacity: 0.35;
  cursor: default;
}
#profile pre {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 10px;
  color: var(--muted);
}
#profile details {
  margin-top: 12px;
}
@media (max-width: 1100px) {
  #nations {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
@media (max-width: 650px) {
  #nations {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.notes-panel {
  margin: 20px 0;
}
.notes-panel a {
  color: var(--accent);
  font-size: 12px;
}
#run-notes {
  padding: 0 24px 0 40px;
  font-size: 12px;
  line-height: 1.6;
  max-height: 350px;
  overflow: auto;
}
#run-notes li {
  margin-bottom: 12px;
}
#run-notes span {
  display: block;
  overflow-wrap: anywhere;
  font-size: 10px;
}

.analytics-panel {
  margin: 20px 0;
  padding-bottom: 20px;
}
.analytics-panel > p,
#analytics-summary,
#analytics-countries {
  margin-left: 24px;
  margin-right: 24px;
}
.analytics-panel a {
  color: var(--accent);
  font-size: 12px;
}
#analytics-summary,
#analytics-checks,
#analytics-countries {
  font-size: 12px;
  line-height: 1.6;
}
#analytics-checks {
  padding-left: 40px;
  padding-right: 24px;
}
.analytics-panel pre {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  max-height: 260px;
  overflow: auto;
}
.analytics-panel summary {
  cursor: pointer;
}
.event-raw summary {
  font-size: 10px;
  color: var(--muted);
  cursor: pointer;
  margin-top: 4px;
}
.event-raw pre {
  font-size: 10px;
  max-height: 200px;
  overflow: auto;
}

#data-explorer-link { color: var(--accent); text-underline-offset: 3px; }
