:root {
  --navy: #0a1628;
  --navy-mid: #12233d;
  --ink: #142033;
  --muted: #5a6a80;
  --line: #c5d0dc;
  --page: #e8edf3;
  --card: #ffffff;
  --accent: #4f9de0;
  --gold: #c4a35a;
  --ok: #2f8f4e;
  --err: #9b2c2c;
  --radius: 8px;
  --font: "Liberation Sans", "Nimbus Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --mono: "Liberation Mono", "DejaVu Sans Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--page);
  min-height: 100vh;
}

.banner {
  background: var(--navy);
  color: #fff;
  border-bottom: 3px solid var(--gold);
}
.banner-inner {
  max-width: 1240px;
  margin: 0 auto;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
}
.mark { display: block; width: 56px; height: 56px; }
.banner-copy { flex: 1; min-width: 0; }
.line1 { margin: 0 0 4px; font-size: 1.15rem; font-weight: 700; letter-spacing: 0.01em; }
.line2 { margin: 0; font-size: 0.86rem; color: #d5e4f5; }
.banner-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  font-size: 0.78rem;
}
.banner-meta .product { font-weight: 700; color: #fff; }
.banner-meta a { color: #d5e4f5; text-decoration: none; }
.banner-meta a:hover { text-decoration: underline; }

.shell {
  max-width: 1480px;
  margin: 0 auto;
  padding: 20px;
  display: grid;
  grid-template-columns: minmax(260px, 320px) minmax(0, 1fr) minmax(260px, 320px);
  gap: 18px;
}

.card, .stage {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.card { padding: 18px 18px 16px; }
.card.quiet { background: #f7f9fc; }
.card h1 { margin: 0 0 8px; font-size: 1.25rem; }
.card h2 { margin: 0 0 8px; font-size: 0.95rem; }
.lede { margin: 0 0 16px; color: var(--muted); font-size: 0.92rem; line-height: 1.45; }
.muted { color: var(--muted); }
.privacy { font-size: 0.78rem; color: var(--muted); line-height: 1.4; }
code { font-family: var(--mono); font-size: 0.86em; }

.drop {
  display: block;
  border: 1.5px dashed #8aa0b8;
  border-radius: var(--radius);
  padding: 18px 12px;
  text-align: center;
  cursor: pointer;
  background: #f5f8fb;
  margin-bottom: 14px;
}
.drop.drag { border-color: var(--accent); background: #e8f3fc; }
.drop input { display: none; }
.drop strong { display: block; margin-bottom: 4px; }
.drop span { color: var(--muted); font-size: 0.82rem; }

.field { display: block; margin-bottom: 12px; }
.field span { display: block; font-size: 0.75rem; font-weight: 700; letter-spacing: 0.04em; color: var(--muted); margin-bottom: 4px; text-transform: uppercase; }
.field select, textarea {
  width: 100%;
  font: inherit;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
  background: #fff;
}
textarea { font-family: var(--mono); font-size: 0.78rem; resize: vertical; }
.advanced { margin-bottom: 14px; }
.advanced summary { cursor: pointer; color: var(--navy-mid); font-size: 0.85rem; margin-bottom: 8px; }

.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  border: 1px solid var(--navy);
  padding: 8px 14px;
  font: inherit;
  font-weight: 650;
  cursor: pointer;
  text-decoration: none;
}
.btn.primary { background: var(--navy); color: #fff; }
.btn.ghost { background: #fff; color: var(--navy); }
.btn:disabled { opacity: 0.55; cursor: wait; }
.btn:hover { filter: brightness(1.06); }

.stage { min-height: 560px; padding: 20px; }
.state { text-align: center; padding: 48px 16px; }
.state img { opacity: 0.95; }
.hidden { display: none !important; }
.results { text-align: left; padding: 4px 2px 8px; }

.result-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 14px;
}
.result-head h2 { margin: 0 0 4px; font-size: 1.15rem; }
.result-head p { margin: 0; font-size: 0.85rem; }
.downloads { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }

.chips {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}
.chip {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 6px 7px;
  text-align: center;
  background: #fff;
}
.chip b { display: block; font-size: 0.68rem; letter-spacing: 0.05em; color: var(--muted); }
.chip span { font-weight: 700; font-size: 0.98rem; }

.section-explorer {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 12px 8px;
  margin-bottom: 14px;
  background: #fff;
  min-width: 0;
  overflow: hidden;
}
.section-explorer-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 10px;
}
.section-explorer-head h3 {
  margin: 0 0 4px;
  font-size: 0.95rem;
}
.section-explorer-head p { margin: 0; font-size: 0.78rem; }
.section-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  flex-shrink: 0;
  justify-content: flex-end;
  max-width: 28rem;
}
.section-stats .chip {
  min-width: 92px;
  margin: 0;
}
.section-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.section-axes { display: flex; gap: 6px; }
.section-axes .btn[aria-pressed="true"] {
  background: var(--navy);
  color: #fff;
}
.section-slider-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 180px;
}
.section-slider-wrap span {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}
.section-slider-wrap input[type="range"] {
  flex: 1;
  accent-color: var(--ok);
  min-width: 0;
}
.section-slider-wrap output {
  font-family: var(--mono);
  font-size: 0.82rem;
  min-width: 3ch;
  text-align: right;
}
.section-explorer-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  min-width: 0;
}
.section-plot {
  height: 260px;
  min-height: 200px;
  min-width: 0;
  overflow: hidden;
}
.section-plot .js-plotly-plot,
.section-plot .plot-container { height: 100%; }
.section-map {
  touch-action: none;
}
.section-plot.section-profile {
  touch-action: none;
}
.map-hint {
  margin: 6px 2px 2px;
  font-size: 0.75rem;
  line-height: 1.35;
}

.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.panel {
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
  background: #fff;
  margin: 0;
}
.panel img { display: block; width: 100%; height: auto; }
.panel figcaption {
  margin: 0;
  padding: 7px 10px 0;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}
.panel-3d {
  width: 100%;
  height: 340px;
}
.panel-3d .js-plotly-plot,
.panel-3d .plot-container { height: 100%; }
.panel-fallback {
  padding: 0 0 8px;
}
.panel-fallback img { display: block; width: 100%; height: auto; }
.panel-fallback p {
  margin: 6px 10px 0;
  font-size: 0.78rem;
}
.notes { margin: 14px 0 0; padding-left: 18px; color: var(--muted); font-size: 0.82rem; }

.spinner {
  width: 36px;
  height: 36px;
  margin: 0 auto 12px;
  border-radius: 50%;
  border: 3px solid #d5deea;
  border-top-color: var(--navy);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.error h2 { color: var(--err); }

.chat {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 14px 12px;
  display: flex;
  flex-direction: column;
  min-height: 560px;
  max-height: calc(100vh - 140px);
  position: sticky;
  top: 12px;
}
.chat-head h2 { margin: 0 0 6px; font-size: 1.05rem; }
.chat-head p { margin: 0 0 10px; font-size: 0.78rem; line-height: 1.4; }
.chat-log {
  flex: 1;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 4px 2px 10px;
}
.bubble {
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 0.84rem;
  line-height: 1.4;
  white-space: pre-wrap;
}
.bubble.system { background: #f3f6fa; color: var(--muted); }
.bubble.user { background: var(--navy); color: #fff; align-self: flex-end; max-width: 95%; }
.bubble.agent { background: #eef4fb; color: var(--ink); border: 1px solid var(--line); }
.bubble.analysing { color: var(--muted); font-style: italic; }
.chat-form { display: flex; flex-direction: column; gap: 8px; }
.chat-form textarea { min-height: 58px; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.foot {
  max-width: 1480px;
  margin: 0 auto 24px;
  padding: 0 20px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 0.78rem;
}
.foot a { color: var(--navy-mid); }

@media (max-width: 1100px) {
  .shell { grid-template-columns: minmax(260px, 320px) 1fr; }
  .chat { position: static; max-height: none; min-height: 360px; grid-column: 1 / -1; }
}
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .grid { grid-template-columns: 1fr; }
  .section-explorer-grid { grid-template-columns: 1fr; }
  .section-explorer-head { flex-direction: column; }
  .banner-inner { flex-wrap: wrap; }
  .banner-meta { align-items: flex-start; }
  .result-head { flex-direction: column; }
  .downloads { justify-content: flex-start; }
}
