:root {
  color-scheme: light;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  background: #f6f8fb;
  color: #07111f;
}

* {
  box-sizing: border-box;
  letter-spacing: 0;
}

body {
  margin: 0;
  min-width: 320px;
  background:
    linear-gradient(180deg, rgba(15, 118, 110, 0.035), transparent 280px),
    #f6f8fb;
  color: #07111f;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible {
  outline: 2px solid rgba(15, 118, 110, 0.42);
  outline-offset: 2px;
}

img {
  display: block;
  max-width: 100%;
}

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  border-right: 1px solid #dbe3ed;
  background: rgba(255, 255, 255, 0.95);
  padding: 16px;
}

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

.brand img {
  width: 40px;
  height: 40px;
  border-radius: 8px;
}

.brand p,
.eyebrow,
.section-kicker {
  margin: 0;
  color: #0f766e;
  font-size: 12px;
  font-weight: 750;
  text-transform: uppercase;
}

.brand h1 {
  margin: 2px 0 0;
  font-size: 18px;
}

.side-nav {
  display: grid;
  gap: 4px;
  margin-top: 28px;
}

.nav-button {
  min-height: 40px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #334155;
  font-size: 14px;
  font-weight: 700;
  text-align: left;
  padding: 0 12px;
}

.nav-button:hover {
  background: #f1f5f9;
}

.nav-button.active {
  background: #07111f;
  color: white;
}

.sidebar-card {
  display: grid;
  gap: 6px;
  margin-top: 16px;
  border: 1px solid #dbe3ed;
  border-radius: 8px;
  background: #f8fafc;
  padding: 14px;
}

.sidebar-card strong {
  font-size: 14px;
}

.sidebar-card p {
  margin: 0;
  color: #64748b;
  font-size: 12px;
  line-height: 1.55;
}

.sidebar-card.is-accent {
  border-color: #99f6e4;
  background: #f0fdfa;
}

.sidebar-card.is-accent p {
  color: #134e4a;
}

.workspace {
  min-width: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #dbe3ed;
  background: rgba(255, 255, 255, 0.9);
  padding: 12px 28px;
  backdrop-filter: blur(14px);
}

.search-box {
  flex: 1;
  max-width: 520px;
  border: 1px solid #dbe3ed;
  border-radius: 8px;
  background: #f8fafc;
  color: #64748b;
  font-size: 14px;
  padding: 10px 12px;
}

.topbar-status {
  border: 1px solid #dbe3ed;
  border-radius: 8px;
  background: white;
  color: #64748b;
  font-size: 13px;
  font-weight: 650;
  padding: 9px 12px;
}

.content {
  display: grid;
  gap: 20px;
  padding: 24px 32px 36px;
}

.hero-grid,
.map-grid,
.source-grid,
.report-grid,
.connor-grid,
.czar-grid {
  display: grid;
  gap: 20px;
}

.hero-grid {
  grid-template-columns: minmax(0, 1fr) 420px;
}

.hero-card {
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(340px, 1.05fr);
  gap: 24px;
  border: 1px solid #dbe3ed;
  border-radius: 8px;
  background: white;
  box-shadow: 0 16px 48px rgba(7, 17, 31, 0.08);
  padding: 20px;
}

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

.hero-card h2,
.panel h2 {
  margin-top: 6px;
  max-width: 720px;
  font-size: clamp(26px, 3vw, 38px);
  line-height: 1.08;
}

.hero-card p,
.panel-header p {
  max-width: 720px;
  color: #64748b;
  font-size: 14px;
  line-height: 1.65;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 22px;
}

.metric,
.decision-row,
.report-section,
.mini-stat {
  border: 1px solid #dbe3ed;
  border-radius: 8px;
  background: #f8fafc;
  padding: 12px;
}

.metric span,
.decision-row span,
.report-section span,
.mini-stat span {
  color: #94a3b8;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.metric strong {
  display: block;
  margin-top: 6px;
  overflow: hidden;
  color: #07111f;
  font-size: 18px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.metric p,
.decision-row p,
.report-section p {
  margin: 6px 0 0;
  color: #64748b;
  font-size: 12px;
  line-height: 1.55;
}

.hero-media {
  position: relative;
  min-height: 292px;
  overflow: hidden;
  border: 1px solid #dbe3ed;
  border-radius: 8px;
  background: #0f172a;
  margin: 0;
}

.hero-media img {
  width: 100%;
  height: 100%;
  min-height: 292px;
  object-fit: cover;
  opacity: 0.72;
}

.hero-media::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent, rgba(7, 17, 31, 0.82));
}

.hero-media figcaption {
  position: absolute;
  z-index: 1;
  left: 16px;
  right: 16px;
  bottom: 16px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.12);
  color: white;
  padding: 14px;
  backdrop-filter: blur(10px);
}

.hero-media span {
  color: #a7f3d0;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.hero-media strong {
  display: block;
  margin-top: 4px;
  font-size: 22px;
}

.hero-media p {
  margin: 8px 0 0;
  color: #e2e8f0;
}

.panel {
  border: 1px solid #dbe3ed;
  border-radius: 8px;
  background: white;
  box-shadow: 0 16px 48px rgba(7, 17, 31, 0.08);
  padding: 20px;
}

.panel-header,
.decision-head,
.report-title {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  justify-content: space-between;
}

.sliders {
  display: grid;
  gap: 18px;
  margin-top: 20px;
}

.slider {
  display: grid;
  gap: 8px;
}

.slider span {
  display: flex;
  justify-content: space-between;
  color: #475569;
  font-size: 12px;
}

.slider em {
  font-style: normal;
}

.slider input {
  width: 100%;
  accent-color: #0f766e;
}

.map-grid {
  grid-template-columns: minmax(0, 1fr) 420px;
}

.premium-map-panel {
  overflow: hidden;
}

.layer-row,
.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  min-height: 34px;
  border: 1px solid #dbe3ed;
  border-radius: 8px;
  background: white;
  color: #64748b;
  font-size: 12px;
  font-weight: 750;
  padding: 0 10px;
}

.chip.active {
  border-color: #99f6e4;
  background: #f0fdfa;
  color: #0f766e;
}

.map-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  gap: 16px;
  margin-top: 16px;
}

.premium-map-layout {
  grid-template-columns: minmax(0, 1fr);
  align-items: stretch;
}

.map-stage {
  position: relative;
  min-height: 540px;
  overflow: hidden;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(15, 118, 110, 0.12), rgba(99, 102, 241, 0.08)),
    #dbeafe;
}

.territory-map,
.map-fallback {
  position: absolute;
  inset: 0;
}

.territory-map {
  z-index: 1;
}

.map-fallback {
  z-index: 0;
}

.map-fallback img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: saturate(0.92) contrast(0.96);
  opacity: 0.86;
}

.map-ready .map-fallback {
  display: none;
}

.map-unavailable .territory-map {
  opacity: 0;
  pointer-events: none;
}

.map-toolbar,
.map-overlay-card,
.map-legend {
  position: absolute;
  z-index: 2;
  border: 1px solid rgba(203, 213, 225, 0.9);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 16px 48px rgba(7, 17, 31, 0.12);
  backdrop-filter: blur(14px);
}

.map-toolbar {
  top: 14px;
  left: 14px;
  right: 14px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
}

.map-toolbar div {
  background: rgba(248, 250, 252, 0.72);
  padding: 10px 12px;
}

.map-toolbar span,
.map-overlay-card span,
.map-legend span {
  display: block;
  color: #64748b;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.map-toolbar strong,
.map-overlay-card strong {
  display: block;
  margin-top: 4px;
  color: #07111f;
  font-size: 13px;
  line-height: 1.25;
}

.map-overlay-card {
  left: 14px;
  bottom: 14px;
  width: min(310px, calc(100% - 28px));
  padding: 14px;
}

.map-overlay-card strong {
  font-size: 22px;
}

.map-overlay-card p {
  margin: 8px 0 0;
  color: #475569;
  font-size: 13px;
  line-height: 1.5;
}

.map-legend {
  right: 14px;
  bottom: 14px;
  display: grid;
  gap: 8px;
  padding: 12px;
}

.map-legend span {
  display: flex;
  gap: 8px;
  align-items: center;
  color: #334155;
  text-transform: none;
}

.map-legend i {
  display: block;
  width: 11px;
  height: 11px;
  border-radius: 999px;
}

.legend-hot {
  background: #ef4444;
}

.legend-warm {
  background: #f59e0b;
}

.legend-cool {
  background: #6366f1;
}

.maplibregl-ctrl-bottom-left,
.maplibregl-ctrl-bottom-right {
  z-index: 3;
}

.maplibregl-ctrl-group {
  overflow: hidden;
  border: 1px solid rgba(203, 213, 225, 0.9);
  border-radius: 8px;
  box-shadow: 0 16px 48px rgba(7, 17, 31, 0.12);
}

.map-rank-list {
  align-content: start;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.map-canvas {
  position: relative;
  min-height: 430px;
  overflow: hidden;
  border: 1px solid #dbe3ed;
  border-radius: 8px;
  background: #e2e8f0;
}

.map-canvas > img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.map-frame {
  position: absolute;
  inset: 16px;
  border: 1px solid rgba(255, 255, 255, 0.76);
  border-radius: 8px;
  pointer-events: none;
}

.map-pin {
  position: absolute;
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  transform: translate(-50%, -50%);
  border: 2px solid white;
  border-radius: 50%;
  background: white;
  color: #07111f;
  font-size: 15px;
  font-weight: 800;
  box-shadow: 0 16px 48px rgba(7, 17, 31, 0.22);
}

.map-pin.active {
  background: #0f766e;
  color: white;
}

.rank-list,
.source-list,
.asset-list,
.wire-list,
.report-options,
.steps {
  display: grid;
  gap: 10px;
}

.rank-card {
  border: 1px solid #dbe3ed;
  border-radius: 8px;
  background: white;
  color: #07111f;
  text-align: left;
  padding: 12px;
}

.rank-card.active {
  border-color: #5eead4;
  background: #f0fdfa;
}

.rank-card span,
.rank-card strong {
  display: inline-block;
  font-size: 14px;
  font-weight: 800;
}

.rank-card strong {
  float: right;
}

.rank-card p {
  clear: both;
  margin: 8px 0 0;
  color: #64748b;
  font-size: 12px;
  line-height: 1.5;
}

.decision-head strong {
  border-radius: 8px;
  background: #07111f;
  color: white;
  padding: 8px 10px;
}

.decision-head h3 {
  margin-top: 4px;
  font-size: 28px;
}

.decision-image {
  width: 100%;
  height: 150px;
  object-fit: cover;
  border-radius: 8px;
  margin: 16px 0;
}

.decision-row + .decision-row,
.why-box,
.button-row {
  margin-top: 10px;
}

.why-box {
  border: 1px solid #dbe3ed;
  border-radius: 8px;
  background: #f8fafc;
  padding: 12px;
}

.why-box p {
  margin: 8px 0 0;
  color: #334155;
  font-size: 13px;
  line-height: 1.55;
}

.button {
  min-height: 40px;
  border: 1px solid #dbe3ed;
  border-radius: 8px;
  background: white;
  color: #334155;
  font-size: 14px;
  font-weight: 800;
  padding: 0 14px;
}

.button.primary {
  border-color: #07111f;
  background: #07111f;
  color: white;
}

.button.full {
  width: 100%;
  margin-top: 16px;
}

.table-wrap {
  margin-top: 18px;
  overflow-x: auto;
}

table {
  width: 100%;
  min-width: 880px;
  border-collapse: collapse;
  text-align: left;
}

th {
  border-bottom: 1px solid #dbe3ed;
  color: #94a3b8;
  font-size: 11px;
  font-weight: 800;
  padding: 10px;
  text-transform: uppercase;
}

td {
  border-bottom: 1px solid #eef2f7;
  color: #475569;
  font-size: 14px;
  padding: 12px 10px;
  vertical-align: middle;
}

tr.selected {
  background: #f0fdfa;
}

td button {
  border: 0;
  background: transparent;
  color: #07111f;
  text-align: left;
  padding: 0;
}

td span {
  display: block;
  margin-top: 3px;
  color: #64748b;
  font-size: 12px;
}

.progress {
  display: block;
  width: 100%;
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #e2e8f0;
}

.progress i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: #0f766e;
}

.source-grid {
  grid-template-columns: minmax(0, 1fr) 420px;
}

.source-card {
  display: grid;
  gap: 10px;
  border: 1px solid #dbe3ed;
  border-radius: 8px;
  background: #f8fafc;
  padding: 14px;
}

.source-card div {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
}

.source-card strong {
  font-size: 14px;
}

.source-card span,
.asset-card span {
  color: #64748b;
  font-size: 12px;
}

.source-card em {
  width: fit-content;
  border-radius: 8px;
  background: white;
  color: #64748b;
  font-size: 12px;
  font-style: normal;
  font-weight: 800;
  padding: 5px 8px;
}

.source-card p {
  margin: 0;
  color: #64748b;
  font-size: 12px;
  line-height: 1.55;
}

.source-side {
  display: grid;
  gap: 20px;
}

.asset-card {
  display: flex;
  gap: 10px;
  align-items: center;
  border: 1px solid #dbe3ed;
  border-radius: 8px;
  padding: 8px;
}

.asset-card img {
  width: 64px;
  height: 56px;
  flex: 0 0 auto;
  border-radius: 8px;
  object-fit: cover;
}

.asset-card strong,
.wire-card strong {
  display: block;
  font-size: 14px;
}

.wire-card {
  border: 1px solid #dbe3ed;
  border-radius: 8px;
  padding: 8px;
}

.wire-card img {
  width: 100%;
  height: 118px;
  border-radius: 8px;
  object-fit: cover;
  object-position: top;
}

.wire-card strong {
  margin-top: 8px;
}

.wire-card p {
  margin: 4px 0 0;
  color: #64748b;
  font-size: 12px;
  line-height: 1.5;
}

.report-grid {
  grid-template-columns: 420px minmax(0, 1fr);
}

.czar-grid {
  grid-template-columns: minmax(0, 1fr) 420px;
}

.czar-hero {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 20px;
  align-items: stretch;
  background:
    linear-gradient(135deg, rgba(15, 118, 110, 0.08), transparent 46%),
    white;
}

.czar-verdict {
  display: grid;
  align-content: center;
  border: 1px solid #99f6e4;
  border-radius: 8px;
  background: #f0fdfa;
  padding: 18px;
}

.czar-verdict span,
.risk-badge {
  color: #0f766e;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.czar-verdict strong {
  display: block;
  margin-top: 8px;
  color: #134e4a;
  font-size: 24px;
  line-height: 1.2;
}

.czar-verdict p {
  margin: 10px 0 0;
  color: #115e59;
  font-size: 13px;
  line-height: 1.6;
}

.law-list,
.gate-list {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.law-card {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 14px;
  border: 1px solid #dbe3ed;
  border-radius: 8px;
  background: #f8fafc;
  padding: 14px;
}

.law-card > strong {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: 8px;
  background: #07111f;
  color: white;
  font-size: 14px;
}

.law-card h3,
.gate-card h3 {
  color: #07111f;
  font-size: 17px;
}

.law-card p,
.gate-card p {
  margin: 8px 0 0;
  color: #475569;
  font-size: 13px;
  line-height: 1.6;
}

.law-card dl {
  display: grid;
  gap: 8px;
  margin: 12px 0 0;
}

.law-card dl div {
  border-left: 3px solid #99f6e4;
  padding-left: 10px;
}

.law-card dt {
  color: #0f766e;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.law-card dd {
  margin: 4px 0 0;
  color: #334155;
  font-size: 13px;
  line-height: 1.55;
}

.gate-card {
  border: 1px solid #dbe3ed;
  border-radius: 8px;
  background: #f8fafc;
  padding: 14px;
}

.gate-card > div {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.gate-card > div strong {
  border-radius: 8px;
  background: white;
  color: #334155;
  font-size: 12px;
  padding: 5px 8px;
}

.gate-card.high-risk {
  border-color: #fecaca;
  background: #fff7ed;
}

.gate-card.high-risk .risk-badge {
  color: #b91c1c;
}

.gate-card.medium-risk {
  border-color: #bfdbfe;
  background: #f8fafc;
}

.report-options {
  margin-top: 20px;
}

.report-options button {
  min-height: 44px;
  border: 1px solid #dbe3ed;
  border-radius: 8px;
  background: white;
  color: #334155;
  text-align: left;
  font-weight: 800;
  padding: 0 12px;
}

.report-options button.active {
  border-color: #5eead4;
  background: #f0fdfa;
  color: #134e4a;
}

.report-title {
  border-bottom: 1px solid #dbe3ed;
  padding-bottom: 16px;
}

.report-title em {
  border-radius: 8px;
  background: #ecfdf5;
  color: #047857;
  font-size: 13px;
  font-style: normal;
  font-weight: 800;
  padding: 6px 10px;
}

.report-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 20px;
  margin-top: 20px;
}

.report-body > div {
  display: grid;
  gap: 12px;
}

.report-body aside img {
  width: 100%;
  height: 180px;
  border-radius: 8px;
  object-fit: cover;
}

.mini-stat {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 10px;
}

.mini-stat strong {
  font-size: 14px;
}

.connor-grid {
  grid-template-columns: minmax(0, 1fr) 360px;
  margin-top: 18px;
}

.steps article {
  display: flex;
  gap: 12px;
  border: 1px solid #dbe3ed;
  border-radius: 8px;
  background: #f8fafc;
  padding: 14px;
}

.steps strong {
  display: grid;
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 8px;
  background: #07111f;
  color: white;
}

.steps p {
  margin: 0;
  color: #334155;
  font-size: 14px;
  line-height: 1.6;
}

.say-box {
  height: fit-content;
  border: 1px solid #99f6e4;
  border-radius: 8px;
  background: #f0fdfa;
  padding: 18px;
}

.say-box strong {
  display: block;
  margin-top: 10px;
  color: #134e4a;
  font-size: 20px;
  line-height: 1.35;
}

.say-box p {
  color: #115e59;
  font-size: 14px;
  line-height: 1.65;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 30;
  width: min(420px, calc(100vw - 40px));
  border: 1px solid #bbf7d0;
  border-radius: 8px;
  background: white;
  box-shadow: 0 24px 70px rgba(7, 17, 31, 0.16);
  color: #047857;
  font-size: 14px;
  font-weight: 800;
  padding: 14px 16px;
}

@media (max-width: 1180px) {
  .app-shell,
  .hero-grid,
  .hero-card,
  .map-grid,
  .source-grid,
  .report-grid,
  .connor-grid,
  .czar-grid,
  .czar-hero {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid #dbe3ed;
  }

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

@media (max-width: 1500px) {
  .hero-card {
    grid-template-columns: 1fr;
  }

  .hero-media img {
    max-height: 340px;
  }
}

@media (max-width: 760px) {
  .topbar,
  .panel-header,
  .decision-head,
  .report-title {
    align-items: stretch;
    flex-direction: column;
  }

  .content,
  .topbar {
    padding-left: 16px;
    padding-right: 16px;
  }

  .search-box,
  .topbar-status {
    width: 100%;
    max-width: none;
  }

  .side-nav,
  .metric-grid,
  .map-layout,
  .premium-map-layout,
  .report-body,
  .law-card {
    grid-template-columns: 1fr;
  }

  .map-stage {
    min-height: 520px;
  }

  .map-toolbar {
    grid-template-columns: 1fr;
  }

  .map-toolbar div {
    padding: 8px 10px;
  }

  .map-legend {
    left: 14px;
    right: auto;
    bottom: 118px;
  }

  .nav-button {
    text-align: center;
  }

  .law-card > strong {
    width: 30px;
    height: 30px;
  }
}
