:root {
  color-scheme: light;
  --ink: #14171a;
  --muted: #5e6773;
  --paper: #f4f6f8;
  --panel: #ffffff;
  --line: #d9dee5;
  --line-strong: #aeb6c2;
  --blue: #0d65d9;
  --gold: #f0c33b;
  --green: #287b46;
  --red: #c93f32;
  --violet: #674aa4;
  --on-gold: #111111;
  --hero-wash: rgba(13, 101, 217, 0.07);
  --topbar-bg: rgba(255, 255, 255, 0.9);
  --nav-bg: #262a30;
  --nav-text: #f5f7fa;
  --nav-border: rgba(255, 255, 255, 0.18);
  --nav-border-hover: rgba(255, 255, 255, 0.5);
  --input-bg: #ffffff;
  --subtle-bg: #fbfcfe;
  --table-head-bg: #222831;
  --table-head-text: #ffffff;
  --table-row-bg: #ffffff;
  --table-row-alt: #fbfcfe;
  --table-row-hover: #f6f9ff;
  --bar-track: #e9edf2;
  --status-bg: #f7f8fa;
  --positive-ink: #185a2d;
  --positive-bg: #eaf7ef;
  --positive-border: #bee6ca;
  --negative-ink: #8e2118;
  --negative-bg: #fff0ee;
  --negative-border: #f3c0ba;
  --warning-ink: #7b5300;
  --warning-bg: #fff7dd;
  --warning-border: #f1d57d;
  --coverage-bg: #edf1f5;
  --coverage-data-ink: #123333;
  --coverage-data-bg: #dcecff;
  --button-bg: #ffffff;
  --button-active-bg: #262a30;
  --primary-button-ink: #ffffff;
  --danger-bg: #fff4f2;
  --danger-border: #f0b9b2;
  --field-shadow: 0 6px 18px rgba(31, 40, 51, 0.05);
  --metric-shadow: 0 10px 26px rgba(31, 40, 51, 0.06);
  --focus-ring: rgba(13, 101, 217, 0.14);
  --selected-ring: rgba(13, 101, 217, 0.12);
  --brand-border: rgba(20, 23, 26, 0.18);
  --brand-inset: rgba(255, 255, 255, 0.16);
  --swatch-border: rgba(0, 0, 0, 0.2);
  --shadow: 0 18px 42px rgba(31, 40, 51, 0.1);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --ink: #edf2f7;
  --muted: #aab5c4;
  --paper: #10151c;
  --panel: #171f29;
  --line: #303a47;
  --line-strong: #596678;
  --blue: #63a4ff;
  --gold: #f0c33b;
  --green: #56b77a;
  --red: #ff766c;
  --violet: #a88bea;
  --on-gold: #111111;
  --hero-wash: rgba(99, 164, 255, 0.1);
  --topbar-bg: rgba(17, 23, 31, 0.92);
  --nav-bg: #0b1017;
  --nav-text: #edf2f7;
  --nav-border: rgba(255, 255, 255, 0.16);
  --nav-border-hover: rgba(255, 255, 255, 0.5);
  --input-bg: #111821;
  --subtle-bg: #1d2631;
  --table-head-bg: #0d131a;
  --table-head-text: #f7f9fc;
  --table-row-bg: #151d26;
  --table-row-alt: #19232e;
  --table-row-hover: #223041;
  --bar-track: #2b3644;
  --status-bg: #202a35;
  --positive-ink: #9be4ad;
  --positive-bg: #143624;
  --positive-border: #2d6d45;
  --negative-ink: #ffaba4;
  --negative-bg: #431c1a;
  --negative-border: #8d3d36;
  --warning-ink: #f6d472;
  --warning-bg: #3c3113;
  --warning-border: #8a6c1c;
  --coverage-bg: #253140;
  --coverage-data-ink: #d7e9ff;
  --coverage-data-bg: #173a63;
  --button-bg: #111821;
  --button-active-bg: #edf2f7;
  --primary-button-ink: #08111f;
  --danger-bg: #3b1f1d;
  --danger-border: #86443d;
  --field-shadow: 0 6px 18px rgba(0, 0, 0, 0.18);
  --metric-shadow: 0 10px 28px rgba(0, 0, 0, 0.28);
  --focus-ring: rgba(99, 164, 255, 0.2);
  --selected-ring: rgba(99, 164, 255, 0.22);
  --brand-border: rgba(255, 255, 255, 0.18);
  --brand-inset: rgba(255, 255, 255, 0.12);
  --swatch-border: rgba(255, 255, 255, 0.24);
  --shadow: 0 18px 42px rgba(0, 0, 0, 0.38);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(180deg, var(--hero-wash), transparent 240px),
    var(--paper);
}

button,
input,
select {
  font: inherit;
}

.topbar {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  padding: 18px clamp(16px, 4vw, 44px);
  border-bottom: 1px solid var(--line);
  background: var(--topbar-bg);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 20;
}

.brand-mark {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  background:
    linear-gradient(135deg, var(--gold) 0 42%, transparent 42%),
    linear-gradient(315deg, var(--blue) 0 44%, transparent 44%),
    var(--ink);
  border: 1px solid var(--brand-border);
  box-shadow: inset 0 0 0 5px var(--brand-inset);
}

.brand-copy {
  min-width: 0;
}

.eyebrow {
  color: var(--blue);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  margin: 0 0 2px;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(26px, 4vw, 42px);
  line-height: 1;
  letter-spacing: 0;
}

h2 {
  font-size: 20px;
  line-height: 1.2;
  margin-bottom: 14px;
}

h3 {
  font-size: 14px;
  line-height: 1.25;
  margin-bottom: 10px;
}

.top-actions {
  justify-self: end;
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: flex-end;
  min-width: 0;
  flex-wrap: wrap;
}

.source-pill {
  flex: 1 1 auto;
  min-width: 0;
  max-width: min(360px, 38vw);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 12px;
  color: var(--muted);
  background: var(--panel);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 13px;
  font-weight: 700;
}

.top-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 8px 14px;
  border: 1px solid var(--gold);
  border-radius: 8px;
  background: var(--gold);
  color: var(--on-gold);
  text-decoration: none;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 900;
  box-shadow: 0 8px 22px rgba(240, 195, 59, 0.18);
}

.top-cta:hover,
.top-cta:focus-visible {
  filter: brightness(1.02);
  outline: 0;
  box-shadow:
    0 8px 22px rgba(240, 195, 59, 0.22),
    0 0 0 3px rgba(240, 195, 59, 0.2);
}

.theme-toggle {
  display: inline-grid;
  grid-template-columns: auto auto auto;
  align-items: center;
  gap: 8px;
  min-width: 142px;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  color: var(--ink);
  cursor: pointer;
  padding: 4px 8px 4px 10px;
  font-weight: 850;
  white-space: nowrap;
  flex: 0 0 auto;
}

.theme-toggle:hover,
.theme-toggle:focus-visible {
  border-color: var(--blue);
}

.theme-toggle:focus-visible {
  outline: 0;
  box-shadow: 0 0 0 3px var(--focus-ring);
}

.theme-toggle-track {
  width: 46px;
  height: 24px;
  border-radius: 999px;
  background: var(--bar-track);
  position: relative;
  border: 1px solid var(--line);
}

.theme-toggle-knob {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.28);
  transition: transform 160ms ease;
}

:root[data-theme="dark"] .theme-toggle-knob {
  transform: translateX(22px);
  background: var(--blue);
}

.theme-toggle-label,
.theme-toggle-value {
  font-size: 12px;
  line-height: 1;
}

.theme-toggle-label {
  color: var(--muted);
  text-transform: uppercase;
}

.theme-toggle-value {
  min-width: 30px;
  text-align: left;
}

.tabs {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 10px clamp(16px, 4vw, 44px);
  background: var(--nav-bg);
  scrollbar-width: thin;
}

.tab {
  color: var(--nav-text);
  background: transparent;
  border: 1px solid var(--nav-border);
  border-radius: 8px;
  padding: 10px 14px;
  cursor: pointer;
  white-space: nowrap;
  font-weight: 850;
}

.tab:hover,
.tab:focus-visible {
  border-color: var(--nav-border-hover);
}

.tab.is-active {
  color: var(--on-gold);
  background: var(--gold);
  border-color: var(--gold);
}

.search,
.select-shell,
.view-shell {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  min-height: 44px;
  padding: 0 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--field-shadow);
}

.search span,
.select-shell span,
.view-shell span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.search input,
.select-shell select,
.view-shell select {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
}

select option,
select optgroup {
  background: var(--input-bg);
  color: var(--ink);
}

:root[data-theme="dark"] select {
  color-scheme: dark;
}

:root[data-theme="dark"] select option,
:root[data-theme="dark"] select optgroup {
  background: #111821;
  color: #edf2f7;
}

.app-shell {
  padding: 18px clamp(16px, 4vw, 44px) 36px;
}

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

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  padding: 16px;
  border-bottom: 1px solid var(--line);
}

.panel-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  align-items: center;
}

.table-view-shell {
  min-width: min(330px, 48vw);
  min-height: 40px;
  box-shadow: none;
  background: var(--input-bg);
}

.table-view-shell span {
  color: var(--blue);
}

.panel-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.overview-hero {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(300px, 0.66fr) minmax(320px, 0.72fr);
  gap: 20px;
  align-items: center;
  margin-bottom: 12px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(135deg, var(--hero-wash), transparent 46%),
    linear-gradient(180deg, var(--panel), var(--subtle-bg));
  box-shadow: var(--shadow);
  overflow: hidden;
}

.section-kicker {
  display: block;
  color: var(--blue);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.overview-identity {
  display: flex;
  min-width: 0;
  flex-direction: column;
  justify-content: center;
}

.overview-identity h2 {
  margin: 6px 0 8px;
  font-size: clamp(52px, 9vw, 86px);
  line-height: 0.92;
}

.overview-identity p {
  max-width: 620px;
  margin: 0;
  color: var(--muted);
  font-weight: 750;
  line-height: 1.45;
}

.overview-facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 14px;
  align-content: start;
}

.overview-hero .overview-facts {
  align-content: center;
}

.overview-fact {
  min-width: 0;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}

.overview-fact span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.overview-fact strong {
  display: block;
  margin-top: 4px;
  font-size: 16px;
  line-height: 1.18;
  overflow-wrap: anywhere;
}

.community-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px 16px;
  align-items: end;
  min-width: 0;
  padding: 18px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background:
    linear-gradient(135deg, rgba(240, 195, 59, 0.12), transparent 42%),
    var(--input-bg);
}

.community-card .section-kicker,
.community-card h2,
.community-card p {
  grid-column: 1 / -1;
}

.community-card h2 {
  max-width: 620px;
  margin: 6px 0 0;
  font-size: clamp(18px, 2.2vw, 24px);
  line-height: 1.08;
}

.community-card p {
  max-width: 620px;
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.4;
}

.community-card-link {
  grid-column: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 8px 14px;
  border: 1px solid var(--gold);
  border-radius: 8px;
  background: var(--gold);
  color: var(--on-gold);
  text-decoration: none;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 900;
}

.community-card-link:hover,
.community-card-link:focus-visible {
  outline: 0;
  box-shadow: 0 0 0 3px rgba(240, 195, 59, 0.22);
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

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

.metric {
  min-height: 112px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, var(--panel), var(--subtle-bg));
  box-shadow: var(--metric-shadow);
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.metric strong {
  display: block;
  margin: 8px 0 5px;
  font-size: clamp(24px, 3vw, 32px);
  line-height: 1;
}

.metric small {
  color: var(--muted);
  font-weight: 700;
}

.split {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(320px, 0.85fr);
  gap: 14px;
}

.overview-panels {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.95fr);
  gap: 14px;
  margin-top: 14px;
}

.leaderboard-list {
  display: grid;
  gap: 8px;
  padding: 14px 16px 16px;
}

.leaderboard-row {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) max-content;
  gap: 10px;
  align-items: center;
  min-height: 42px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--table-row-bg);
  box-shadow: inset 3px 0 0 var(--nation-color);
}

.leaderboard-row:nth-child(even) {
  background: var(--table-row-alt);
}

.leaderboard-rank {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--subtle-bg);
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

.leaderboard-name {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  font-weight: 800;
}

.leaderboard-label {
  min-width: 0;
  overflow-wrap: anywhere;
  line-height: 1.18;
}

.swatch {
  width: 14px;
  height: 14px;
  border-radius: 4px;
  border: 1px solid var(--swatch-border);
  flex: 0 0 auto;
}

.leaderboard-value {
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  font-weight: 900;
  white-space: nowrap;
  text-align: right;
}

.table-wrap {
  overflow: auto;
  scrollbar-width: thin;
}

.trade-map-shell {
  min-width: 0;
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--nation-color, var(--blue)) 18%, transparent), transparent 38%),
    color-mix(in srgb, var(--panel) 68%, var(--paper));
}

.trade-map-command {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  align-items: center;
  justify-content: space-between;
  min-height: 64px;
  padding: 9px clamp(12px, 2vw, 18px);
  border-bottom: 1px solid var(--line);
}

.trade-network-selector {
  flex: 1 1 210px;
  max-width: 320px;
}

.trade-network-filter-band {
  display: flex;
  flex: 1 1 280px;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  min-width: min(100%, 260px);
}

.trade-network-filter {
  grid-template-columns: auto minmax(74px, 1fr);
  flex: 1 1 130px;
  min-height: 38px;
  padding: 0 10px;
  background: color-mix(in srgb, var(--input-bg) 70%, transparent);
}

.trade-network-filter span {
  font-size: 10px;
}

.trade-network-filter select {
  font-size: 13px;
  font-weight: 850;
}

.trade-map-modebar {
  display: flex;
  gap: 3px;
  align-items: center;
  justify-content: flex-end;
  flex: 0 1 auto;
  flex-wrap: nowrap;
  min-width: 0;
  max-width: 100%;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: color-mix(in srgb, var(--input-bg) 62%, transparent);
}

.trade-map-modebar::-webkit-scrollbar {
  display: none;
}

.trade-map-scale {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 30px;
  padding: 0 11px 0 9px;
  border-right: 1px solid var(--line);
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
  white-space: nowrap;
}

.trade-map-scale strong {
  color: var(--ink);
  font-size: 13px;
  font-weight: 950;
  text-transform: none;
}

.trade-map-mode {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  padding: 6px 11px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--ink);
  font-size: 12px;
  font-weight: 900;
  font-family: inherit;
  white-space: nowrap;
  cursor: pointer;
}

.trade-map-mode:hover,
.trade-map-mode:focus-visible {
  background: color-mix(in srgb, var(--blue) 16%, transparent);
  outline: 0;
}

.trade-map-mode.is-active {
  border-color: var(--gold);
  background: var(--gold);
  color: var(--on-gold);
}

.trade-map-mode.admin {
  border-color: color-mix(in srgb, var(--blue) 56%, var(--line));
  color: var(--blue);
}

.trade-map-layout {
  min-width: 0;
  overflow: hidden;
}

.trade-map-stage {
  position: relative;
  width: 100%;
  min-width: 0;
  min-height: 0;
  aspect-ratio: 8800 / 5806;
  overflow: hidden;
  background:
    radial-gradient(circle at 24% 62%, color-mix(in srgb, var(--nation-color, var(--blue)) 18%, transparent), transparent 24%),
    linear-gradient(135deg, #23313a 0%, #152332 42%, #243641 100%);
}

:root[data-theme="light"] .trade-map-stage {
  background:
    radial-gradient(circle at 24% 62%, color-mix(in srgb, var(--nation-color, var(--blue)) 18%, transparent), transparent 24%),
    linear-gradient(135deg, #c9d3d3 0%, #98a8aa 42%, #b9c2ba 100%);
}

.trade-map-inspector {
  position: absolute;
  top: clamp(12px, 1.4vw, 18px);
  right: clamp(12px, 1.4vw, 18px);
  z-index: 4;
  display: grid;
  align-content: start;
  gap: 0;
  width: min(380px, calc(100% - 24px));
  max-height: calc(100% - clamp(24px, 2.8vw, 36px));
  min-width: 0;
  padding: clamp(14px, 1.6vw, 18px);
  overflow: auto;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  background: color-mix(in srgb, #101923 88%, transparent);
  color: #edf2f7;
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.34);
  overscroll-behavior: contain;
  scrollbar-width: thin;
}

:root[data-theme="light"] .trade-map-inspector {
  border-color: rgba(20, 23, 26, 0.16);
  background: color-mix(in srgb, #f6f8fb 90%, transparent);
  color: var(--ink);
  box-shadow: 0 18px 40px rgba(20, 23, 26, 0.16);
}

.trade-map-inspector.is-dragging {
  user-select: none;
}

.trade-map-drag-head {
  cursor: grab;
  touch-action: none;
  user-select: none;
}

.trade-map-inspector.is-dragging .trade-map-drag-head {
  cursor: grabbing;
}

.trade-map-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.trade-map-basemap {
  opacity: 0.96;
}

.trade-map-grid line {
  stroke: rgba(255, 255, 255, 0.08);
  stroke-width: 0.08;
}

.trade-map-svg.has-real-map .trade-map-grid {
  opacity: 0.38;
}

:root[data-theme="light"] .trade-map-grid line {
  stroke: rgba(20, 23, 26, 0.08);
}

.trade-map-route {
  fill: none;
  stroke: #67a9ff;
  stroke-linecap: round;
  opacity: 0.62;
  filter: url("#tradeMapGlow");
  pointer-events: none;
}

.trade-map-route.export {
  stroke: #f0c33b;
}

.trade-map-route.import {
  stroke: #68d391;
}

.trade-map-zone-overlay {
  opacity: 1;
}

.trade-map-territory {
  stroke: rgba(4, 8, 13, 0.82);
  stroke-width: 0.22;
  cursor: pointer;
  opacity: 0.86;
  transition: opacity 140ms ease, stroke-width 140ms ease, filter 140ms ease;
}

.trade-map-svg.has-real-map .trade-map-territory {
  fill: transparent;
  stroke: transparent;
  stroke-width: 0.12;
  opacity: 0.01;
  pointer-events: all;
}

.trade-map-territory:hover,
.trade-map-territory:focus-visible {
  opacity: 1;
  outline: 0;
  stroke: #ffffff;
  stroke-width: 0.42;
  filter: drop-shadow(0 0 6px rgba(255, 255, 255, 0.45));
}

.trade-map-svg.has-real-map .trade-map-territory:hover,
.trade-map-svg.has-real-map .trade-map-territory:focus-visible {
  fill: color-mix(in srgb, var(--territory-color, #67a9ff) 28%, transparent);
  stroke-width: 0.28;
}

.trade-map-territory.is-selected {
  opacity: 1;
  stroke: #ffffff;
  stroke-width: 0.52;
  filter: drop-shadow(0 0 10px color-mix(in srgb, var(--nation-color, var(--blue)) 72%, transparent));
}

.trade-map-svg.has-real-map .trade-map-territory.is-selected {
  fill: color-mix(in srgb, var(--territory-color, #67a9ff) 24%, transparent);
  stroke-width: 0.34;
}

.trade-map-labels text {
  fill: #f7fbff;
  paint-order: stroke;
  stroke: rgba(8, 12, 18, 0.86);
  stroke-width: 0.42;
  font-size: 2.2px;
  font-weight: 950;
  letter-spacing: 0;
  text-anchor: middle;
}

.trade-map-selected,
.trade-map-route-list,
.trade-map-asset-note {
  position: relative;
  z-index: 1;
  border: 0;
  background: transparent;
  color: inherit;
  box-shadow: none;
  backdrop-filter: none;
}

.trade-map-selected {
  width: auto;
  min-width: 0;
  padding: 0;
  border-radius: 0;
  pointer-events: auto;
}

.trade-map-selected h2 {
  margin: 4px 0 7px;
  color: #ffffff;
  font-size: clamp(25px, 2.25vw, 36px);
  line-height: 0.98;
  overflow-wrap: anywhere;
}

:root[data-theme="light"] .trade-map-selected h2,
:root[data-theme="light"] .trade-map-geography strong,
:root[data-theme="light"] .trade-map-statline strong,
:root[data-theme="light"] .trade-map-route-list button,
:root[data-theme="light"] .trade-map-route-list button strong,
:root[data-theme="light"] .trade-map-asset-note strong {
  color: var(--ink);
}

.trade-map-selected p {
  margin-bottom: 12px;
  color: #c7d4e4;
  font-weight: 750;
}

:root[data-theme="light"] .trade-map-selected p,
:root[data-theme="light"] .trade-map-route-list p,
:root[data-theme="light"] .trade-map-asset-note {
  color: var(--muted);
}

.trade-map-geography {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px 12px;
  margin-bottom: 12px;
  padding: 8px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.14);
  border-bottom: 1px solid rgba(255, 255, 255, 0.14);
}

:root[data-theme="light"] .trade-map-geography,
:root[data-theme="light"] .trade-map-route-list {
  border-color: rgba(20, 23, 26, 0.16);
}

.trade-map-geography div {
  min-width: 0;
}

.trade-map-geography span {
  display: block;
  color: #93a9c4;
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
}

:root[data-theme="light"] .trade-map-geography span,
:root[data-theme="light"] .trade-map-statline span {
  color: color-mix(in srgb, var(--muted) 86%, var(--ink));
}

.trade-map-geography strong {
  display: block;
  color: #ffffff;
  font-size: 13px;
  font-weight: 900;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.trade-map-statline {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-top: 1px solid rgba(255, 255, 255, 0.16);
  border-left: 1px solid rgba(255, 255, 255, 0.16);
}

:root[data-theme="light"] .trade-map-statline {
  border-top-color: rgba(20, 23, 26, 0.16);
  border-left-color: rgba(20, 23, 26, 0.16);
}

.trade-map-statline div {
  min-width: 0;
  padding: 7px 8px;
  border-right: 1px solid rgba(255, 255, 255, 0.16);
  border-bottom: 1px solid rgba(255, 255, 255, 0.16);
}

:root[data-theme="light"] .trade-map-statline div {
  border-right-color: rgba(20, 23, 26, 0.16);
  border-bottom-color: rgba(20, 23, 26, 0.16);
}

.trade-map-statline span {
  display: block;
  color: #9fb4cc;
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
}

.trade-map-statline strong {
  display: block;
  min-width: 0;
  color: #ffffff;
  font-size: 15px;
  font-weight: 950;
  overflow-wrap: anywhere;
}

.trade-map-route-list {
  width: auto;
  min-width: 0;
  display: grid;
  gap: 0;
  margin-top: 12px;
  padding: 12px 0 0;
  border-top: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 0;
  pointer-events: auto;
}

.trade-map-route-list button {
  display: grid;
  grid-template-columns: minmax(0, 1fr) max-content;
  gap: 14px;
  align-items: center;
  min-height: 36px;
  border: 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 0;
  padding: 8px 0;
  background: transparent;
  color: #edf2f7;
  cursor: pointer;
  pointer-events: auto;
}

:root[data-theme="light"] .trade-map-route-list button {
  border-bottom-color: rgba(20, 23, 26, 0.14);
}

.trade-map-route-list button:hover,
.trade-map-route-list button:focus-visible {
  outline: 0;
  border-bottom-color: rgba(255, 255, 255, 0.42);
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.1), transparent);
}

:root[data-theme="light"] .trade-map-route-list button:hover,
:root[data-theme="light"] .trade-map-route-list button:focus-visible {
  border-bottom-color: rgba(20, 23, 26, 0.36);
  background: linear-gradient(90deg, rgba(20, 42, 68, 0.08), transparent);
}

.trade-map-route-list button span {
  min-width: 0;
}

.trade-map-partner-copy {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.trade-map-partner-copy span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: left;
  font-weight: 900;
}

.trade-map-partner-meta {
  min-width: 0;
  color: #9fb4cc;
  font-size: 10px;
  font-style: normal;
  font-weight: 850;
  line-height: 1.1;
  overflow: hidden;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

:root[data-theme="light"] .trade-map-partner-meta {
  color: var(--muted);
}

.trade-map-route-list button strong {
  justify-self: end;
  min-width: 76px;
  color: #ffffff;
  font-weight: 950;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.trade-map-route-list p {
  margin: 0;
  color: #c7d4e4;
  font-weight: 750;
}

.trade-map-asset-note {
  left: clamp(14px, 2.3vw, 30px);
  right: clamp(14px, 2.3vw, 30px);
  bottom: 14px;
  padding: 9px 12px;
  border-radius: 6px;
  color: #c7d4e4;
  font-size: 12px;
  font-weight: 800;
}

.trade-map-asset-note strong {
  color: #ffffff;
}

.trade-network-workspace {
  min-width: 0;
  border-block: 1px solid var(--line);
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--nation-color, var(--blue)) 18%, transparent), transparent 36%),
    var(--subtle-bg);
}

.trade-network-header {
  display: grid;
  grid-template-columns: minmax(340px, 0.82fr) minmax(0, 1.18fr);
  gap: 24px;
  align-items: stretch;
  padding: 16px;
  border-bottom: 1px solid var(--line);
}

.trade-network-identity {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.trade-network-selector {
  flex: 1 1 280px;
  min-height: 44px;
  width: auto;
  max-width: min(420px, 100%);
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: color-mix(in srgb, var(--input-bg) 86%, transparent);
  box-shadow: none;
}

.trade-network-selector select {
  font-weight: 900;
}

.trade-network-header h2 {
  margin: -2px 0 0;
  font-size: clamp(34px, 4vw, 52px);
  letter-spacing: 0;
  line-height: 0.95;
}

.trade-network-title {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: end;
  padding: 18px 16px 14px;
  border-bottom: 1px solid var(--line);
}

.trade-network-title h2 {
  margin: 4px 0 0;
  font-size: clamp(28px, 4vw, 48px);
  letter-spacing: 0;
}

.trade-network-metadata {
  align-self: end;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(86px, 1fr));
  min-width: 0;
  border-block: 1px solid var(--line);
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--input-bg) 42%, transparent));
}

.trade-network-metric {
  display: grid;
  align-content: center;
  gap: 3px;
  min-width: 0;
  min-height: 54px;
  padding: 8px 12px;
  border-left: 1px solid var(--line);
}

.trade-network-metric:first-child {
  border-left: 0;
}

.trade-network-metric span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0;
  line-height: 1;
  text-transform: uppercase;
}

.trade-network-metric strong {
  min-width: 0;
  color: var(--ink);
  font-size: 16px;
  font-weight: 900;
  line-height: 1.1;
  overflow-wrap: anywhere;
}

.trade-generator-band {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: end;
  padding: 12px 16px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--blue) 9%, transparent), transparent 48%),
    color-mix(in srgb, var(--panel) 84%, transparent);
}

.trade-generator-title,
.trade-generator-field,
.trade-generator-share {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.trade-generator-title {
  flex: 1 1 150px;
}

.trade-generator-pair {
  display: grid;
  grid-template-columns: minmax(150px, 1fr) 72px;
  gap: 8px;
  flex: 1 1 260px;
  min-width: min(100%, 240px);
}

.trade-generator-title strong {
  color: var(--ink);
  font-size: 15px;
  font-weight: 950;
  line-height: 1.1;
}

.trade-generator-field {
  flex: 0 1 170px;
}

.trade-generator-share {
  min-width: 0;
}

.trade-generator-field span,
.trade-generator-share span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0;
  line-height: 1;
  text-transform: uppercase;
}

.trade-generator-field select,
.trade-generator-share input {
  min-width: 0;
  width: 100%;
  min-height: 34px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  padding: 6px 8px;
  background: var(--input-bg);
  color: var(--ink);
  font: inherit;
  font-weight: 850;
}

.trade-generator-actions {
  display: flex;
  flex: 0 0 auto;
  gap: 7px;
  justify-content: flex-end;
  align-items: center;
  margin-left: auto;
  min-width: max-content;
}

.trade-generator-preview {
  display: grid;
  grid-template-columns: minmax(160px, 0.16fr) minmax(0, 1fr);
  gap: 0;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--input-bg) 42%, transparent);
}

.trade-generator-preview-head {
  display: grid;
  align-content: center;
  gap: 4px;
  padding: 10px 16px;
  border-right: 1px solid var(--line);
}

.trade-generator-preview-head span,
.trade-generator-preview-row span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
}

.trade-generator-preview-head strong {
  color: var(--ink);
  font-size: 16px;
  font-weight: 950;
}

.trade-generator-preview-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  align-items: stretch;
}

.trade-generator-preview-row {
  display: grid;
  gap: 3px;
  min-width: 0;
  padding: 10px 12px;
  border-right: 1px solid var(--line);
}

.trade-generator-preview-row strong {
  color: var(--ink);
  font-weight: 950;
  line-height: 1.1;
  overflow-wrap: anywhere;
}

.trade-generator-preview-row em {
  color: var(--positive-ink);
  font-style: normal;
  font-weight: 950;
}

.trade-network-table-wrap {
  min-height: clamp(640px, 78vh, 980px);
  overflow-x: auto;
  overflow-y: visible;
  border-top: 1px solid var(--line);
  scrollbar-width: thin;
}

.trade-network-table {
  min-width: 1700px;
}

.trade-network-table th:first-child,
.trade-network-table td:first-child {
  position: sticky;
  left: 0;
  z-index: 2;
  min-width: 270px;
  max-width: 270px;
}

.trade-network-table th:first-child {
  z-index: 4;
  background: var(--table-head-bg);
}

.trade-network-table td:first-child {
  background: var(--table-row-bg);
}

.trade-network-table tbody tr:nth-child(even) td:first-child {
  background: var(--table-row-alt);
}

.trade-network-table tbody tr:hover td:first-child {
  background: var(--table-row-hover);
}

.trade-network-table tbody tr.has-targeted-tariff td {
  background: color-mix(in srgb, var(--blue) 10%, var(--panel));
}

.trade-network-table tbody tr.has-targeted-tariff td:first-child {
  background: color-mix(in srgb, var(--blue) 10%, var(--panel));
}

.trade-network-rate {
  font-weight: 900;
}

.relationship-control {
  display: grid;
  gap: 5px;
  min-width: 220px;
}

.relationship-control > span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
}

.tariff-inline-control,
.anchor-inline-control {
  display: grid;
  grid-template-columns: minmax(74px, 0.7fr) auto auto;
  gap: 6px;
  align-items: center;
}

.tariff-inline-control input,
.anchor-inline-control input,
.policy-inline-control {
  min-width: 0;
  width: 100%;
  min-height: 34px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  padding: 6px 8px;
  background: var(--input-bg);
  color: var(--ink);
  font: inherit;
  font-weight: 800;
}

.policy-inline-control {
  min-width: 132px;
}

.route-inline-facts {
  display: grid;
  gap: 3px;
  min-width: 140px;
}

.route-inline-facts strong {
  color: var(--ink);
  font-size: 13px;
  font-weight: 950;
  white-space: nowrap;
}

.route-inline-facts span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
  white-space: nowrap;
}

.muted-text {
  color: var(--muted);
  font-weight: 850;
}

.positive {
  color: var(--positive-ink);
}

.negative {
  color: var(--negative-ink);
}

.attention {
  color: var(--warning-ink);
}

@media (max-width: 1180px) {
  .trade-map-stage {
    min-height: 320px;
  }

  .trade-map-inspector {
    width: min(360px, calc(100% - 24px));
  }
}

@media (max-width: 860px) {
  .trade-map-command {
    flex-wrap: wrap;
    align-items: stretch;
  }

  .trade-map-modebar {
    flex: 1 1 100%;
    justify-content: flex-start;
  }

  .trade-network-selector {
    flex-basis: 100%;
    max-width: none;
  }

  .trade-map-inspector {
    padding: 14px;
  }

  .trade-map-svg {
    position: absolute;
    display: block;
    height: 100%;
  }

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

  .trade-network-header {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .trade-network-metadata {
    align-self: stretch;
  }

  .trade-generator-band,
  .trade-generator-preview {
    grid-template-columns: 1fr;
  }

  .trade-generator-preview-head {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
}

.status-table-panel {
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 178px);
}

.status-table-panel .panel-head {
  flex: 0 0 auto;
}

.status-table-wrap {
  max-height: clamp(360px, calc(100vh - 310px), 680px);
  overscroll-behavior: contain;
  border-bottom: 1px solid var(--line);
}

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  min-width: 860px;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 10px 12px;
  text-align: left;
  vertical-align: middle;
  font-size: 14px;
  line-height: 1.3;
}

th {
  position: sticky;
  top: 0;
  z-index: 2;
  color: var(--table-head-text);
  background: var(--table-head-bg);
  font-size: 12px;
  text-transform: uppercase;
  cursor: pointer;
  letter-spacing: 0;
  white-space: nowrap;
  box-shadow: inset 0 -1px 0 var(--line-strong);
}

th:first-child,
td:first-child {
  position: sticky;
  left: 0;
  z-index: 1;
  background: inherit;
}

th:first-child {
  z-index: 3;
  background: var(--table-head-bg);
}

.status-table-wrap th:first-child,
.status-table-wrap td:first-child {
  box-shadow:
    1px 0 0 var(--line-strong),
    14px 0 18px -18px rgba(0, 0, 0, 0.5);
}

.status-table-wrap tbody tr td:first-child {
  background: var(--table-row-bg);
}

.status-table-wrap tbody tr:nth-child(even) td:first-child {
  background: var(--table-row-alt);
}

.status-table-wrap tbody tr:hover td:first-child {
  background: var(--table-row-hover);
}

td.numeric,
th.numeric {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

tbody tr {
  background: var(--table-row-bg);
}

tbody tr:nth-child(even) {
  background: var(--table-row-alt);
}

tbody tr:hover {
  background: var(--table-row-hover);
}

tbody td {
  transition: background-color 140ms ease;
}

.nation-cell {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 190px;
  font-weight: 900;
}

.status {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 3px 9px;
  border: 1px solid var(--line);
  background: var(--status-bg);
  font-size: 12px;
  font-weight: 900;
}

.status.positive {
  color: var(--positive-ink);
  background: var(--positive-bg);
  border-color: var(--positive-border);
}

.status.negative {
  color: var(--negative-ink);
  background: var(--negative-bg);
  border-color: var(--negative-border);
}

.status.warning {
  color: var(--warning-ink);
  background: var(--warning-bg);
  border-color: var(--warning-border);
}

.nation-layout {
  display: grid;
  grid-template-columns: minmax(280px, 330px) minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}

.nation-roster {
  position: sticky;
  top: 154px;
}

.nation-list {
  display: grid;
  gap: 6px;
  max-height: calc(100vh - 250px);
  overflow: auto;
  padding: 8px;
}

.nation-roster-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  padding: 14px;
  border-bottom: 1px solid var(--line);
}

.nation-roster-head h2 {
  margin-bottom: 3px;
}

.nation-roster-head p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}

.nation-button {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  width: 100%;
  min-height: 56px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--table-row-bg);
  color: var(--ink);
  cursor: pointer;
  text-align: left;
}

.nation-button:hover,
.nation-button:focus-visible {
  border-color: var(--blue);
  outline: 0;
}

.nation-button-copy {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.nation-button strong {
  overflow-wrap: anywhere;
  line-height: 1.12;
}

.nation-button small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nation-button.is-selected {
  border-color: var(--blue);
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--blue) 16%, transparent), transparent 70%),
    var(--table-row-bg);
  box-shadow: 0 0 0 3px var(--selected-ring);
}

.nation-dossier {
  --nation-color: var(--blue);
}

.nation-dossier-hero {
  display: flex;
  gap: 16px;
  justify-content: space-between;
  align-items: flex-start;
  padding: 18px;
  border-bottom: 1px solid var(--line);
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--nation-color) 18%, transparent), transparent 48%),
    linear-gradient(180deg, var(--panel), var(--subtle-bg));
}

.nation-dossier-title {
  display: flex;
  gap: 12px;
  min-width: 0;
  align-items: flex-start;
}

.nation-dossier-title h2 {
  margin: 0 0 6px;
  font-size: clamp(26px, 3vw, 38px);
  line-height: 1;
  overflow-wrap: anywhere;
}

.nation-dossier-title p {
  margin: 0;
  color: var(--muted);
  font-weight: 750;
}

.nation-dossier-status {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  max-width: 320px;
}

.nation-stat-strip {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  border-bottom: 1px solid var(--line);
}

.dossier-metric {
  min-width: 0;
  padding: 13px 14px;
}

.dossier-metric + .dossier-metric {
  border-left: 1px solid var(--line);
}

.dossier-metric span,
.dossier-row span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.dossier-metric strong {
  display: block;
  margin: 5px 0 3px;
  font-size: 22px;
  line-height: 1;
}

.dossier-metric small {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nation-dossier-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  padding: 12px;
}

.dossier-section {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--subtle-bg);
  overflow: hidden;
}

.dossier-section h3 {
  margin: 0;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}

.dossier-rows {
  display: grid;
}

.dossier-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  min-height: 38px;
  padding: 8px 12px;
}

.dossier-row + .dossier-row {
  border-top: 1px solid var(--line);
}

.dossier-row strong {
  color: var(--ink);
  text-align: right;
  font-size: 14px;
  overflow-wrap: anywhere;
}

.dossier-row strong.positive {
  color: var(--positive-ink);
}

.dossier-row strong.negative {
  color: var(--negative-ink);
}

.dossier-section-wide {
  grid-column: span 2;
  padding-bottom: 12px;
}

.dossier-section-wide .coverage {
  padding: 12px;
}

.coverage {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.coverage span {
  border-radius: 999px;
  padding: 3px 7px;
  background: var(--coverage-bg);
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
}

.coverage span.has-data {
  color: var(--coverage-data-ink);
  background: var(--coverage-data-bg);
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  padding: 16px;
}

.detail-item {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  min-height: 78px;
}

.detail-item span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.detail-item strong {
  display: block;
  margin-top: 7px;
  font-size: 20px;
  overflow-wrap: anywhere;
}

.control-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  padding: 16px;
}

.editor-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 340px);
  gap: 12px;
  align-items: start;
  padding: 12px;
}

.editor-sections {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 10px;
  align-items: start;
  min-width: 0;
}

.editor-rail {
  display: grid;
  gap: 12px;
  align-content: start;
  min-width: 0;
}

.editor-rail {
  position: sticky;
  top: 178px;
}

.editor-summary {
  display: grid;
  grid-template-columns: repeat(6, minmax(96px, 1fr));
  gap: 10px;
  align-items: stretch;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  background:
    linear-gradient(135deg, var(--hero-wash), transparent 42%),
    var(--subtle-bg);
}

.editor-summary .overview-fact {
  padding: 3px 0;
  border-top: 0;
  border-left: 0;
}

.editor-summary .overview-fact + .overview-fact {
  padding-left: 12px;
  border-left: 1px solid var(--line);
}

.editor-summary .overview-fact strong {
  font-size: 15px;
}

.app-shell > .panel + .panel {
  margin-top: 12px;
}

.roster-manager {
  box-shadow: var(--metric-shadow);
}

.roster-tools-grid {
  display: grid;
  grid-template-columns: minmax(520px, 1fr) minmax(250px, 0.34fr) minmax(250px, 0.34fr);
  gap: 12px;
  padding: 12px;
  background:
    linear-gradient(135deg, var(--hero-wash), transparent 46%),
    var(--subtle-bg);
}

.roster-create-card,
.roster-archive-card,
.roster-restore-card {
  display: grid;
  gap: 10px;
  align-items: end;
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.roster-create-card {
  grid-template-columns: minmax(150px, 1fr) 66px minmax(160px, 0.85fr) auto;
  align-items: end;
}

.roster-archive-card,
.roster-restore-card {
  grid-template-columns: minmax(0, 1fr);
}

.roster-archive-card .command,
.roster-restore-card .command {
  width: 100%;
}

.roster-create-command {
  align-self: end;
  min-width: 124px;
}

.editor-panel-head {
  align-items: center;
}

.editor-head-controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
  align-items: center;
  min-width: min(100%, 460px);
}

.editor-nation-picker {
  min-width: min(380px, 100%);
  box-shadow: none;
}

.color-field {
  justify-items: start;
}

.control-field input[type="color"] {
  width: 46px;
  height: 40px;
  min-height: 40px;
  padding: 3px;
  border-color: var(--line-strong);
  cursor: pointer;
}

.control-field {
  display: grid;
  gap: 7px;
  align-content: start;
}

.control-field span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.control-field input,
.control-field select,
.control-field textarea {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--input-bg);
  color: var(--ink);
  padding: 8px 10px;
  outline: 0;
  font: inherit;
}

.control-field input:focus,
.control-field select:focus,
.control-field textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

.control-field textarea {
  min-height: 120px;
  resize: vertical;
  line-height: 1.45;
}

.command-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 0 16px 16px;
}

.command {
  min-height: 40px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--button-bg);
  color: var(--ink);
  padding: 8px 12px;
  cursor: pointer;
  font-weight: 900;
}

.command.compact {
  min-height: 30px;
  padding: 5px 10px;
  font-size: 12px;
}

.command:hover,
.command:focus-visible {
  border-color: var(--blue);
}

.command.primary {
  color: var(--primary-button-ink);
  background: var(--blue);
  border-color: var(--blue);
}

.command.accent {
  color: var(--on-gold);
  background: var(--gold);
  border-color: var(--gold);
}

.command.danger {
  color: var(--negative-ink);
  border-color: var(--danger-border);
  background: var(--danger-bg);
}

.command.positive {
  color: var(--positive-ink);
  border-color: var(--positive-border);
  background: var(--positive-bg);
}

.command:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.command.is-active {
  color: var(--paper);
  background: var(--button-active-bg);
  border-color: var(--button-active-bg);
}

.table-note {
  padding: 10px 16px;
  color: var(--muted);
  background: var(--subtle-bg);
  border-top: 1px solid var(--line);
  font-size: 13px;
  font-weight: 700;
}

.change-history-panel {
  margin-top: 14px;
}

.snapshot-recovery-panel {
  margin-top: 0;
}

.snapshot-recovery-controls {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) auto auto auto;
  gap: 10px;
  align-items: end;
  padding: 12px 16px 16px;
  border-top: 1px solid var(--line);
  background: var(--subtle-bg);
}

.snapshot-summary-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}

.snapshot-summary-strip .overview-fact {
  padding: 12px 16px;
}

.snapshot-summary-strip .overview-fact + .overview-fact {
  border-left: 1px solid var(--line);
}

.snapshot-table {
  min-width: 960px;
}

.change-impact,
.history-impact {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
}

.change-impact .status,
.history-impact .status {
  min-height: 26px;
  border-radius: 7px;
  font-size: 11px;
}

.history-list {
  display: grid;
  border-top: 1px solid var(--line);
}

.history-list-head,
.history-list-row {
  display: grid;
  grid-template-columns: 132px minmax(180px, 0.9fr) 130px 190px minmax(220px, 1.1fr);
  gap: 12px;
  align-items: center;
}

.history-list-head {
  padding: 10px 16px;
  color: var(--table-head-text);
  background: var(--table-head-bg);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.history-list-row {
  min-height: 44px;
  padding: 8px 16px;
  border-top: 1px solid var(--line);
  background: var(--table-row-bg);
  font-size: 14px;
}

.history-list-row:nth-child(odd) {
  background: var(--table-row-alt);
}

.history-time,
.history-edit {
  color: var(--muted);
  font-weight: 800;
}

.history-time,
.history-value {
  white-space: nowrap;
}

.history-value {
  display: inline-flex;
  align-items: center;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  font-weight: 800;
}

.history-impact.is-empty {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.history-list-row .nation-cell {
  min-width: 0;
}

.editor-section {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0 16px;
  align-content: start;
  padding: 12px 14px 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--subtle-bg);
}

.editor-section-national,
.editor-section-military {
  grid-column: span 7;
}

.editor-section-trade,
.editor-section-intelligence {
  grid-column: span 5;
}

.editor-section-population,
.editor-section-industrial {
  grid-column: span 6;
}

.editor-section-civic {
  grid-column: 1 / -1;
  grid-template-columns: repeat(3, minmax(230px, 1fr));
}

.editor-section h3 {
  grid-column: 1 / -1;
  margin-bottom: 4px;
  color: var(--ink);
  font-size: 16px;
  padding-bottom: 7px;
  border-bottom: 1px solid var(--line);
}

.editor-section .control-field {
  min-height: 46px;
  padding: 8px 0;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
}

.editor-section .control-field:focus-within {
  border-color: var(--blue);
  box-shadow: none;
}

.editor-section .control-field input,
.editor-section .control-field select {
  min-height: 26px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  padding: 2px 4px;
  font-weight: 850;
}

.editor-section .control-field:hover input,
.editor-section .control-field:hover select {
  border-color: var(--line);
  background: var(--input-bg);
}

.editor-section .control-field input:focus,
.editor-section .control-field select:focus {
  border-color: var(--blue);
  background: var(--input-bg);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

.editor-section-civic .control-field {
  min-width: 0;
}

.editor-rail-panel {
  display: grid;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--subtle-bg);
}

.editor-rail-head {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  justify-content: space-between;
}

.editor-rail-head h3 {
  margin: 4px 0 0;
  font-size: 22px;
}

.editor-rail-head.compact h3 {
  margin: 0;
  font-size: 18px;
}

.rail-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.rail-detail-grid .detail-item {
  min-height: 66px;
  padding: 9px;
}

.rail-detail-grid .detail-item strong {
  font-size: 18px;
}

.rail-change-list {
  display: grid;
  gap: 8px;
}

.rail-change-row {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--input-bg);
}

.rail-change-row strong {
  font-size: 13px;
}

.rail-change-row .change-impact {
  min-width: 0;
}

.rail-change-row .change-impact .status {
  max-width: 100%;
  justify-content: flex-start;
  white-space: normal;
  text-align: left;
  line-height: 1.25;
}

.derived-preview {
  background:
    linear-gradient(135deg, var(--hero-wash), transparent 48%),
    var(--subtle-bg);
}

.derived-preview .detail-item {
  background: var(--panel);
}

.simulation-cockpit,
.simulation-pipeline,
.simulation-log-panel {
  margin-bottom: 14px;
}

.simulation-hero {
  display: flex;
  gap: 16px;
  justify-content: space-between;
  align-items: flex-start;
  padding: 18px;
  border-bottom: 1px solid var(--line);
  background:
    linear-gradient(135deg, var(--hero-wash), transparent 48%),
    linear-gradient(180deg, var(--panel), var(--subtle-bg));
}

.simulation-hero h2 {
  margin: 4px 0 8px;
  font-size: clamp(34px, 6vw, 74px);
  line-height: 0.95;
}

.simulation-hero h2 .sim-year-separator {
  color: var(--muted);
  font-size: 0.36em;
  text-transform: uppercase;
  vertical-align: middle;
}

.simulation-hero p {
  margin: 0;
  color: var(--muted);
  font-weight: 800;
}

.simulation-grid {
  display: grid;
  grid-template-columns: minmax(460px, 0.86fr) minmax(0, 1.14fr);
  gap: 0;
}

.simulation-snapshot {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: repeat(2, minmax(150px, 1fr));
  align-content: stretch;
  border-right: 1px solid var(--line);
}

.simulation-snapshot .dossier-metric {
  min-height: 150px;
  padding: 18px 20px;
}

.simulation-snapshot .dossier-metric:nth-child(odd) {
  border-left: 0;
}

.simulation-snapshot .dossier-metric:nth-child(n + 3) {
  border-top: 1px solid var(--line);
}

.simulation-control-surface {
  display: grid;
  gap: 14px;
  align-content: start;
  padding: 16px;
}

.simulation-control-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.simulation-control-head h3 {
  margin: 0;
  font-size: 18px;
}

.simulation-control-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.simulation-control-grid .control-field {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--input-bg);
}

.simulation-actions {
  display: grid;
  gap: 12px;
}

.simulation-action-group {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.simulation-action-run .command {
  flex: 1 1 180px;
}

.simulation-action-maintenance .command,
.simulation-action-export .command {
  flex: 0 1 190px;
}

.simulation-actions .command {
  min-height: 42px;
}

.metric-positive {
  color: var(--positive-ink);
}

.metric-negative {
  color: var(--negative-ink);
}

.metric-warning {
  color: var(--warning-ink);
}

.tax-burden-watchlist-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  padding: 14px 18px 10px;
}

.tax-burden-watchlist-head > div {
  display: grid;
  gap: 4px;
}

.tax-burden-watchlist-head strong {
  font-size: 18px;
}

.tax-burden-watchlist-head span:not(.status) {
  color: var(--muted);
  font-weight: 750;
  line-height: 1.4;
}

.tax-burden-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
  align-items: center;
}

.tax-burden-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  padding: 0 18px 16px;
}

.tax-burden-card {
  display: grid;
  gap: 10px;
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--subtle-bg);
}

.tax-burden-title {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.tax-burden-title strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tax-burden-card dl {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  margin: 0;
}

.tax-burden-card dl div {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.tax-burden-card dt,
.tax-burden-card p {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.tax-burden-card dd {
  margin: 0;
  font-size: 18px;
  font-weight: 950;
  font-variant-numeric: tabular-nums;
}

.tax-burden-card p {
  margin: 0;
  line-height: 1.35;
}

.tax-burden-card-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 2px;
}

.compact-empty {
  padding-block: 18px;
}

.command:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.compact-head {
  padding-block: 14px;
}

.pipeline-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  padding: 12px;
}

.pipeline-step {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--subtle-bg);
}

.pipeline-step > span {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 6px;
  background: var(--blue);
  color: var(--primary-button-ink);
  font-size: 12px;
  font-weight: 950;
}

.pipeline-step h3 {
  margin: 0 0 5px;
  font-size: 14px;
}

.pipeline-step p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
  font-weight: 750;
}

.simulation-log-table {
  min-width: 760px;
}

.naval-grid,
.equipment-grid,
.audit-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.fleet {
  padding: 16px;
}

.fleet + .fleet {
  border-top: 1px solid var(--line);
}

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

.fleet-total {
  font-size: 28px;
  font-weight: 950;
}

.ship-category {
  display: grid;
  grid-template-columns: 140px minmax(0, 1fr);
  gap: 10px;
  padding: 9px 0;
  border-top: 1px solid var(--line);
}

.ship-category h3 {
  margin: 0;
  color: var(--blue);
}

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

.ship-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}

.ship-row span:first-child {
  overflow-wrap: anywhere;
}

.ship-row span:last-child {
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

.records-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: center;
  padding: 16px 18px;
  margin-bottom: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.records-hero h2 {
  margin: 4px 0 4px;
  font-size: clamp(26px, 3vw, 42px);
  line-height: 0.95;
}

.records-hero p {
  margin: 0;
  max-width: 780px;
  color: var(--muted);
  line-height: 1.45;
}

.records-hero-controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
  align-items: center;
}

.records-nation-picker {
  min-width: min(360px, 48vw);
  background: var(--input-bg);
  box-shadow: none;
}

.records-local-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
}

.record-tab {
  min-height: 38px;
  padding: 8px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--button-bg);
  color: var(--ink);
  font-weight: 900;
  cursor: pointer;
}

.record-tab:hover,
.record-tab:focus-visible {
  border-color: var(--blue);
}

.record-tab.is-active {
  border-color: var(--gold);
  background: var(--gold);
  color: var(--on-gold);
}

.records-summary-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: var(--panel);
}

.records-fact {
  min-width: 0;
  padding: 13px 16px;
}

.records-fact + .records-fact {
  border-left: 1px solid var(--line);
}

.records-fact span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.records-fact strong {
  display: block;
  margin-top: 4px;
  overflow-wrap: anywhere;
  font-size: 20px;
  line-height: 1.1;
}

.records-fact small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-weight: 750;
}

.records-workspace-grid {
  display: grid;
  grid-template-columns: minmax(280px, 0.8fr) minmax(420px, 1.35fr) minmax(260px, 0.72fr);
  gap: 14px;
  align-items: start;
  margin-bottom: 14px;
}

.equipment-library-layout {
  display: grid;
  grid-template-columns: minmax(760px, 1fr) minmax(420px, 560px);
  gap: 14px;
  align-items: start;
  margin-bottom: 14px;
}

.equipment-browser-panel {
  min-width: 0;
}

.equipment-dossier-panel {
  min-width: 0;
  position: sticky;
  top: 12px;
  max-height: calc(100vh - 24px);
  overflow: auto;
}

.equipment-action-bar {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.equipment-filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--subtle-bg);
}

.equipment-filter-chip {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--button-bg);
  color: var(--ink);
  padding: 7px 11px;
  font-weight: 900;
  cursor: pointer;
}

.equipment-filter-chip:hover,
.equipment-filter-chip:focus-visible {
  border-color: var(--blue);
}

.equipment-filter-chip.is-active {
  border-color: var(--gold);
  background: var(--gold);
  color: var(--on-gold);
}

.equipment-table-wrap {
  max-height: min(690px, calc(100vh - 300px));
  min-height: 0;
  overflow: auto;
}

.equipment-list-wrap {
  display: grid;
  align-content: start;
  gap: 6px;
  padding: 10px;
}

.equipment-record-header,
.equipment-record-card {
  display: grid;
  grid-template-columns: minmax(220px, 1.25fr) minmax(170px, 0.85fr) minmax(130px, 0.7fr) minmax(96px, auto);
  gap: 12px;
  align-items: center;
}

.equipment-record-header {
  position: sticky;
  top: 0;
  z-index: 2;
  min-height: 34px;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel);
  color: var(--muted);
  font-size: 11px;
  font-weight: 950;
  text-transform: uppercase;
}

.equipment-table {
  width: 100%;
  min-width: 860px;
  border-collapse: separate;
  border-spacing: 0;
}

.equipment-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line-strong);
  background: var(--panel);
  color: var(--muted);
  text-align: left;
  font-size: 11px;
  font-weight: 950;
  text-transform: uppercase;
}

.equipment-table td {
  max-width: 280px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  font-size: 13px;
  vertical-align: middle;
}

.equipment-record-row {
  cursor: pointer;
}

.equipment-record-card {
  width: 100%;
  min-height: 50px;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--input-bg);
  color: var(--ink);
  text-align: left;
}

.equipment-record-card:hover,
.equipment-record-card:focus-visible,
.equipment-record-card.is-active {
  border-color: var(--blue);
  background: var(--selected-bg);
  box-shadow: 0 0 0 3px var(--selected-ring);
}

.equipment-record-meta {
  min-width: 0;
  color: var(--blue);
  font-size: 11px;
  font-weight: 900;
  overflow-wrap: anywhere;
}

.equipment-record-note {
  min-width: 0;
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
  overflow-wrap: anywhere;
}

.equipment-record-detail {
  display: flex;
  justify-content: flex-end;
}

.equipment-record-detail .status {
  min-height: 24px;
  padding: 3px 8px;
  font-size: 10px;
  white-space: nowrap;
}

.equipment-record-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.equipment-record-footer em {
  min-width: 0;
  font-style: normal;
  overflow-wrap: anywhere;
}

.equipment-record-row:hover td,
.equipment-record-row.is-active td {
  background: var(--selected-bg);
}

.equipment-record-row.is-active td:first-child {
  box-shadow: inset 3px 0 0 var(--blue);
}

.equipment-item-name {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  min-width: 0;
}

.equipment-item-name .swatch {
  width: 10px;
  height: 10px;
  border-radius: 3px;
}

.equipment-item-name strong {
  font-size: 14px;
  line-height: 1.15;
}

.equipment-item-name strong,
.equipment-table td {
  overflow-wrap: anywhere;
}

.equipment-table-limit {
  padding: 12px 16px;
  color: var(--muted);
  border-top: 1px solid var(--line);
  font-size: 13px;
  font-weight: 800;
}

.design-card-list,
.navy-glance-list {
  display: grid;
  gap: 10px;
  padding: 12px;
}

.design-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 4px 10px;
  width: 100%;
  min-height: 74px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--input-bg);
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.design-card:hover,
.design-card:focus-visible,
.design-card.is-active {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px var(--selected-ring);
}

.design-card .swatch {
  grid-row: 1 / span 3;
  margin-top: 3px;
}

.design-card strong,
.design-card small,
.design-card em {
  min-width: 0;
  overflow-wrap: anywhere;
}

.design-card strong {
  font-size: 16px;
  line-height: 1.15;
}

.design-card small {
  color: var(--blue);
  font-weight: 900;
}

.design-card em {
  color: var(--muted);
  font-style: normal;
  font-size: 13px;
  font-weight: 700;
}

.design-editor-panel {
  min-height: 420px;
}

.design-editor-form,
.design-readout {
  display: grid;
  gap: 14px;
  padding: 16px;
}

.design-editor-title {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.design-editor-title h3,
.design-readout h3 {
  margin: 3px 0 0;
  font-size: 28px;
  line-height: 1.05;
}

.design-readout p {
  color: var(--muted);
  line-height: 1.5;
}

.design-form-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.equipment-inspector-panel .design-form-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.equipment-inspector-panel .design-editor-title {
  align-items: flex-start;
}

.equipment-inspector-panel .design-editor-title h3 {
  font-size: 26px;
}

.equipment-dossier-panel > .design-editor-form,
.equipment-dossier-panel > .equipment-dossier-readout {
  gap: 0;
  padding: 0;
}

.design-editor-form .equipment-dossier-readout {
  padding: 0;
}

.equipment-dossier-heading {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
  padding: 16px;
}

.equipment-dossier-heading h3 {
  margin: 3px 0 8px;
  font-size: clamp(28px, 3.4vw, 46px);
  line-height: 0.95;
}

.equipment-dossier-panel .equipment-dossier-heading h3 {
  font-size: clamp(26px, 3vw, 34px);
}

.equipment-dossier-heading p {
  max-width: 980px;
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.equipment-dossier-meta {
  margin-top: 16px;
}

.equipment-core-editor {
  border-top: 1px solid var(--line);
  background: var(--subtle-bg);
}

.equipment-core-editor-head {
  padding: 14px 16px 10px;
}

.equipment-core-editor-head h4 {
  margin: 0 0 4px;
  font-size: 16px;
}

.equipment-core-editor-head p {
  max-width: 900px;
  margin: 0;
  color: var(--muted);
  line-height: 1.4;
  font-size: 13px;
}

.equipment-core-editor .design-form-grid,
.equipment-core-editor .design-actions {
  padding: 0 16px 16px;
}

.equipment-dossier-panel .design-form-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.equipment-dossier-panel .equipment-spec-grid {
  grid-template-columns: 1fr;
}

.design-notes-field {
  grid-column: 1 / -1;
}

.design-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.records-action-list {
  display: grid;
  gap: 10px;
  padding: 12px;
}

.design-detail-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.template-section-grid,
.equipment-spec-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.template-section-preview,
.equipment-spec-card {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--subtle-bg);
  padding: 12px;
}

.equipment-spec-grid {
  margin: 0;
  padding: 0 16px 16px;
}

.equipment-roster-note {
  display: grid;
  gap: 4px;
  margin: 0 16px 16px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--subtle-bg);
  color: var(--muted);
}

.equipment-roster-note strong {
  color: var(--ink);
  font-size: 15px;
}

.template-section-preview h4,
.equipment-spec-card h4 {
  margin: 0 0 10px;
  color: var(--ink);
  font-size: 14px;
}

.equipment-spec-subsection {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.equipment-spec-subsection h5 {
  margin: 0 0 6px;
  color: var(--blue);
  font-size: 12px;
  font-weight: 950;
  text-transform: uppercase;
}

.template-section-preview p,
.equipment-spec-card p {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin: 0;
  padding: 7px 0;
  border-top: 1px solid var(--line);
}

.template-section-preview p:first-of-type,
.equipment-spec-card p:first-of-type,
.equipment-spec-subsection p:first-of-type {
  border-top: 0;
}

.template-section-preview span,
.equipment-spec-card span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.template-section-preview strong,
.equipment-spec-card strong {
  min-width: 0;
  overflow-wrap: anywhere;
  text-align: right;
  white-space: pre-line;
}

.raw-template-details {
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--input-bg);
}

.raw-template-details summary {
  padding: 12px 14px;
  cursor: pointer;
  font-weight: 950;
}

.raw-template-details pre {
  max-height: 420px;
  margin: 0;
  padding: 14px;
  overflow: auto;
  border-top: 1px solid var(--line);
  color: var(--muted);
  white-space: pre-wrap;
}

.design-detail-grid .records-fact {
  border-left: 0;
  border-top: 1px solid var(--line);
}

.design-detail-grid .records-fact:nth-child(-n + 3) {
  border-top: 0;
}

.design-detail-grid .records-fact:not(:nth-child(3n + 1)) {
  border-left: 1px solid var(--line);
}

.navy-record-rail .command {
  margin: 0 12px 12px;
}

.record-reference-panel {
  margin-top: 14px;
}

.records-import-grid {
  display: grid;
  grid-template-columns: minmax(420px, 1.05fr) minmax(360px, 0.95fr);
  gap: 14px;
  align-items: start;
}

.import-paste-body {
  display: grid;
  gap: 12px;
  padding: 14px 16px 16px;
}

.import-paste-body textarea {
  min-height: 440px;
  resize: vertical;
  line-height: 1.45;
  font-family: "Aptos", "Segoe UI", Arial, sans-serif;
}

.import-preview-panel {
  min-height: 520px;
}

.import-preview-list {
  display: grid;
  max-height: 520px;
  overflow: auto;
  border-top: 1px solid var(--line);
}

.import-preview-row {
  display: grid;
  grid-template-columns: minmax(120px, 0.8fr) minmax(120px, 0.8fr) minmax(0, 1.25fr) auto;
  gap: 12px;
  align-items: center;
  min-width: 0;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
}

.import-preview-row span,
.import-preview-row strong {
  min-width: 0;
  overflow-wrap: anywhere;
}

.import-preview-row span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.import-apply-actions {
  padding: 14px 16px 16px;
  border-top: 1px solid var(--line);
}

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

.template-card-body,
.template-explain-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border-top: 1px solid var(--line);
}

.template-card-body .records-fact,
.template-explain-list .records-fact {
  border-left: 0;
  border-top: 1px solid var(--line);
}

.template-card-body .records-fact:nth-child(-n + 2),
.template-explain-list .records-fact:nth-child(-n + 2) {
  border-top: 0;
}

.template-card-body .records-fact:nth-child(even),
.template-explain-list .records-fact:nth-child(even) {
  border-left: 1px solid var(--line);
}

.template-card-body .command {
  align-self: center;
  margin: 13px 16px;
}

.compact-table table {
  font-size: 13px;
}

.fleet-editor {
  padding: 4px 16px 14px;
}

.editable-ship-category {
  grid-template-columns: 160px minmax(0, 1fr);
}

.editable-ship-row {
  grid-template-columns: minmax(0, 1fr) minmax(82px, 110px) auto;
  align-items: center;
}

.ship-count-cell {
  display: flex;
  justify-content: flex-end;
}

.ship-count-input {
  width: 100%;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--input-bg);
  color: var(--ink);
  padding: 6px 8px;
  text-align: right;
  font: inherit;
  font-weight: 900;
}

.ship-count-input:focus {
  border-color: var(--blue);
  outline: 0;
  box-shadow: 0 0 0 3px var(--focus-ring);
}

.icon-command {
  min-height: 30px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--button-bg);
  color: var(--ink);
  padding: 5px 8px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 900;
}

.icon-command.danger {
  color: var(--negative-ink);
  border-color: var(--danger-border);
  background: var(--danger-bg);
}

.naval-add-row {
  display: grid;
  grid-template-columns: minmax(180px, 0.9fr) minmax(260px, 1.3fr) minmax(100px, 0.35fr) auto;
  gap: 10px;
  align-items: end;
  padding: 14px 16px 16px;
  border-top: 1px solid var(--line);
  background: var(--subtle-bg);
}

.note {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.footer {
  display: flex;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  padding: 18px clamp(16px, 4vw, 44px) 34px;
  color: var(--muted);
  font-size: 13px;
}

.footer-links {
  display: inline-flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.footer-link {
  color: var(--blue);
  text-decoration: none;
  font-weight: 800;
}

.footer-link:hover,
.footer-link:focus-visible {
  text-decoration: underline;
  outline: 0;
}

.empty {
  padding: 28px 16px;
  color: var(--muted);
  text-align: center;
}

.empty.compact {
  padding: 14px 0;
  font-size: 13px;
}

@media (max-width: 1240px) {
  .equipment-library-layout {
    grid-template-columns: 1fr;
  }

  .equipment-dossier-panel {
    position: static;
    max-height: none;
    overflow: visible;
  }
}

@media (max-width: 760px) {
  .equipment-record-header {
    display: none;
  }

  .equipment-record-card {
    grid-template-columns: 1fr;
    gap: 5px;
    min-height: 0;
  }

  .equipment-record-detail {
    justify-content: flex-start;
  }
}

@media (max-width: 980px) {
  .overview-hero,
  .records-hero,
  .overview-panels,
  .dashboard-grid,
  .split,
  .nation-layout,
  .simulation-grid,
  .records-workspace-grid,
  .equipment-library-layout,
  .records-import-grid,
  .template-library-grid,
  .naval-grid,
  .equipment-grid,
  .audit-grid {
    grid-template-columns: 1fr;
  }

  .community-card {
    grid-template-columns: 1fr;
  }

  .community-card-link {
    grid-column: 1;
    justify-self: start;
  }

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

  .nation-roster {
    position: static;
  }

  .nation-list {
    max-height: 360px;
  }

  .nation-stat-strip,
  .nation-dossier-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dossier-section-wide {
    grid-column: 1 / -1;
  }

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

  .simulation-snapshot {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

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

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

  .records-hero-controls {
    justify-content: stretch;
  }

  .records-nation-picker {
    min-width: 0;
  }

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

  .records-summary-strip .records-fact:nth-child(odd) {
    border-left: 0;
  }

  .records-summary-strip .records-fact:nth-child(n + 3) {
    border-top: 1px solid var(--line);
  }

  .equipment-action-bar {
    justify-content: flex-start;
  }

  .design-form-grid,
  .equipment-inspector-panel .design-form-grid,
  .design-detail-grid,
  .template-section-grid,
  .equipment-spec-grid,
  .template-card-body,
  .template-explain-list,
  .naval-add-row {
    grid-template-columns: 1fr;
  }

  .design-detail-grid .records-fact,
  .design-detail-grid .records-fact:not(:nth-child(3n + 1)),
  .template-card-body .records-fact,
  .template-card-body .records-fact:nth-child(even),
  .template-explain-list .records-fact,
  .template-explain-list .records-fact:nth-child(even) {
    border-left: 0;
    border-top: 1px solid var(--line);
  }

  .design-detail-grid .records-fact:first-child,
  .template-card-body .records-fact:first-child,
  .template-explain-list .records-fact:first-child {
    border-top: 0;
  }

  .import-preview-row {
    grid-template-columns: 1fr;
  }

  .history-list-head {
    display: none;
  }

  .history-list-row {
    grid-template-columns: 132px minmax(0, 1fr);
    gap: 6px 12px;
  }

  .history-list-row > div:nth-child(3),
  .history-list-row > div:nth-child(4),
  .history-list-row > div:nth-child(5) {
    grid-column: 2;
  }

  .editor-layout {
    grid-template-columns: 1fr;
  }

  .editor-rail {
    position: static;
  }

  .editor-summary {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .roster-tools-grid {
    grid-template-columns: 1fr;
  }

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

}

@media (max-width: 720px) {
  .topbar {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .top-actions {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    justify-self: start;
    width: 100%;
  }

  .top-cta {
    flex: 0 0 auto;
  }

  .source-pill {
    width: 100%;
    max-width: none;
  }

  .theme-toggle {
    grid-column: 1 / -1;
    justify-self: start;
  }

  .overview-hero {
    padding: 16px;
  }

  .overview-identity h2 {
    font-size: 52px;
  }

  .dashboard-grid,
  .overview-facts,
  .detail-grid,
  .control-grid,
  .roster-tools-grid,
  .roster-create-card,
  .roster-archive-card,
  .roster-restore-card,
  .snapshot-recovery-controls,
  .snapshot-summary-strip,
  .nation-stat-strip,
  .nation-dossier-grid,
  .simulation-snapshot,
  .simulation-control-grid,
  .pipeline-grid,
  .editor-layout,
  .editor-sections,
  .editor-section,
  .rail-detail-grid,
  .editor-summary {
    grid-template-columns: 1fr;
  }

  .nation-dossier-hero {
    display: grid;
  }

  .simulation-hero {
    display: grid;
  }

  .simulation-action-group {
    display: grid;
    grid-template-columns: 1fr;
  }

  .nation-dossier-status {
    justify-content: flex-start;
    max-width: none;
  }

  .dossier-metric + .dossier-metric {
    border-left: 0;
    border-top: 1px solid var(--line);
  }

  .snapshot-summary-strip .overview-fact + .overview-fact {
    border-left: 0;
    border-top: 1px solid var(--line);
  }

  .records-summary-strip {
    grid-template-columns: 1fr;
  }

  .records-summary-strip .records-fact + .records-fact,
  .records-summary-strip .records-fact:nth-child(n + 3) {
    border-left: 0;
    border-top: 1px solid var(--line);
  }

  .records-local-tabs {
    display: grid;
    grid-template-columns: 1fr;
  }

  .editable-ship-category,
  .editable-ship-row {
    grid-template-columns: 1fr;
  }

  .ship-count-cell {
    justify-content: stretch;
  }

  .editor-section-national,
  .editor-section-trade,
  .editor-section-military,
  .editor-section-intelligence,
  .editor-section-population,
  .editor-section-industrial,
  .editor-section-civic {
    grid-column: 1 / -1;
  }

  .editor-panel-head,
  .editor-head-controls {
    display: grid;
    justify-content: stretch;
  }

  .editor-nation-picker {
    min-width: 0;
  }

  .editor-summary .overview-fact {
    padding-left: 0;
    border-left: 0;
    border-top: 1px solid var(--line);
  }

  .leaderboard-row {
    grid-template-columns: 30px minmax(0, 1fr);
  }

  .leaderboard-value {
    grid-column: 2;
    text-align: left;
  }

  .ship-category {
    grid-template-columns: 1fr;
  }
}
