/* ── Design tokens ────────────────────────────────────────────────────────── */
:root {
  --bg:           #efe7d4;
  --bg-deep:      #e8dfc8;
  --paper:        #fbf6ea;
  --paper-soft:   #f7f1e1;
  --ink:          #1c2434;
  --ink-soft:     #3a4256;
  --muted:        #6b7184;
  --line:         rgba(28, 36, 52, 0.11);
  --line-soft:    rgba(28, 36, 52, 0.06);
  --brand:        #1e3a6d;
  --brand-deep:   #0e2345;
  --sage:         #4a7a5f;
  --sage-deep:    #2f5a42;
  --warn-bg:      rgba(200, 155, 40, 0.07);
  --warn-border:  rgba(200, 155, 40, 0.22);
  --warn-text:    #7a5a18;
  --shadow-xl:    0 40px 100px -30px rgba(28, 36, 52, 0.22), 0 16px 40px -16px rgba(28, 36, 52, 0.10);
  --shadow-lg:    0 20px 50px -18px rgba(28, 36, 52, 0.16), 0 6px 18px -8px rgba(28, 36, 52, 0.08);
  --shadow-sm:    0 4px 14px rgba(28, 36, 52, 0.05);
  --radius-lg:    4px;
  --radius-md:    3px;
  --radius-sm:    2px;
  --display:      "Fraunces", "Source Serif 4", Georgia, serif;
  --body:         "Inter", "Space Grotesk", -apple-system, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--body);
  color: var(--ink);
  font-feature-settings: "ss01", "cv11";
  background-color: var(--bg);
  background-image:
    radial-gradient(circle at 1px 1px, rgba(28, 36, 52, 0.07) 1px, transparent 0),
    radial-gradient(ellipse 60% 50% at 100% 0%,  rgba(74, 122, 95, 0.10), transparent 55%),
    radial-gradient(ellipse 50% 40% at 0% 100%, rgba(30, 58, 109, 0.08), transparent 60%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-deep) 100%);
  background-size: 22px 22px, auto, auto, auto;
  background-attachment: fixed;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* ── Page shell — wide editorial layout ──────────────────────────────────── */
.page-shell {
  width: min(1480px, calc(100% - 48px));
  margin: 0 auto;
  padding: 48px 0 120px;
  display: grid;
  gap: 56px;
}

/* Hero + query card treatment */
.hero,
.query-panel {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  position: relative;
}

/* ── Eyebrow / section label ─────────────────────────────────────────────── */
.eyebrow {
  display: inline-block;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: 0.22em;
  font-size: 0.68rem;
  font-weight: 600;
  margin: 0 0 10px;
}

/* ── Hero — dramatic editorial cover ─────────────────────────────────────── */
.hero {
  padding: 0;
  overflow: hidden;
  isolation: isolate;
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  background-image: url("./hero-title-art.jpg");
  background-size: cover;
  background-position: center center;
  opacity: 1.25;
  filter: saturate(1.02) contrast(1.02) brightness(0.98);
}

.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  background:
    linear-gradient(180deg, rgba(251, 246, 234, 0.78) 0%, rgba(251, 246, 234, 0.70) 20%, rgba(251, 246, 234, 0.56) 52%, rgba(251, 246, 234, 0.72) 100%),
    linear-gradient(90deg, rgba(251, 246, 234, 0.70) 0%, rgba(251, 246, 234, 0.34) 36%, rgba(251, 246, 234, 0.46) 68%, rgba(251, 246, 234, 0.76) 100%);
}

.hero-grid {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 1fr 220px;
  grid-template-rows: auto auto;
  grid-template-areas:
    "top     top"
    "main    sources";
  column-gap: 60px;
  row-gap: 0;
  padding: 44px 64px 52px;
}

/* ── Top strip: serial line + monogram ──────────────────────────────────── */
.hero-top {
  grid-area: top;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 32px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 42px;
}

.hero-meta {
  font-family: var(--body);
  font-size: 0.72rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.28em;
  color: var(--ink-soft);
}

.hero-monogram {
  font-family: var(--display);
  font-size: 1.05rem;
  font-weight: 500;
  font-style: italic;
  color: var(--ink);
  letter-spacing: 0.02em;
}

.hero-monogram span {
  color: var(--sage);
  font-style: normal;
  margin: 0 2px;
  font-weight: 400;
}

/* ── Main title ─────────────────────────────────────────────────────────── */
.hero-main {
  grid-area: main;
  position: relative;
  padding: 22px 6px 8px 0;
  min-height: 320px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.hero-title-wrap {
  position: relative;
  display: inline-block;
  isolation: isolate;
  width: min(100%, 620px);
  padding: 0;
  margin-bottom: 14px;
  z-index: 1;
}

.hero-title-art {
  display: none;
}

.hero-title-art::after {
  display: none;
}

.hero-title {
  position: relative;
  z-index: 1;
  font-family: var(--display);
  font-size: clamp(3rem, 5.5vw, 5.5rem);
  font-weight: 500;
  line-height: 0.95;
  margin: 0;
  color: var(--ink);
  letter-spacing: -0.03em;
  font-variation-settings: "opsz" 144;
  max-width: 7ch;
  text-wrap: balance;
}

.hero-title-line {
  display: block;
}

.hero-title-accent {
  font-size: 0.52em;
  font-style: normal;
  font-weight: 600;
  color: var(--brand);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-top: 16px;
  padding-left: 0.06em;
}

.hero-kicker {
  display: inline-block;
  position: relative;
  z-index: 1;
  font-family: var(--body);
  font-size: 0.76rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  color: var(--brand-deep);
  margin-top: auto;
  align-self: flex-start;
  background: rgba(251, 246, 234, 0.86);
  border: 1px solid rgba(28, 36, 52, 0.08);
  border-radius: 999px;
  padding: 11px 18px;
  backdrop-filter: blur(4px);
}

/* ── Sources column (right rail, minimal list) ──────────────────────────── */
.hero-sources {
  grid-area: sources;
  padding-top: 0;
  align-self: start;
  border-left: 1px solid var(--line);
  padding-left: 32px;
  min-height: 100%;
  position: relative;
  z-index: 1;
}

.hero-sources-label {
  font-family: var(--body);
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.24em;
  color: var(--ink-soft);
  margin: 0 0 18px;
}

.source-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.source-list li {
  font-family: var(--display);
  font-size: 1.02rem;
  font-weight: 400;
  color: var(--ink);
  padding: 12px 0;
  border-bottom: 1px solid var(--line-soft);
  line-height: 1.3;
  position: relative;
  transition: color 0.2s, padding-left 0.25s;
  cursor: default;
}

.source-list li:first-child { padding-top: 0; }
.source-list li:last-child  { border-bottom: 0; padding-bottom: 0; }

.source-list li::before {
  content: '';
  position: absolute;
  left: -14px;
  top: 50%;
  width: 4px;
  height: 4px;
  background: var(--sage);
  border-radius: 50%;
  transform: translateY(-50%);
  opacity: 0;
  transition: opacity 0.25s;
}

.source-list li:hover {
  color: var(--brand);
  padding-left: 6px;
}

.source-list li:hover::before {
  opacity: 1;
  left: -10px;
}

/* ── Query panel ─────────────────────────────────────────────────────────── */
.query-panel {
  padding: 48px 56px;
  overflow: hidden;
}

.query-panel form {
  display: grid;
  gap: 22px;
}

.query-label {
  font-family: var(--display);
  font-size: clamp(1.4rem, 1.8vw, 1.75rem);
  font-weight: 400;
  font-style: italic;
  color: var(--ink);
  margin: 0 0 4px;
  letter-spacing: -0.01em;
}

.query-panel textarea {
  width: 100%;
  min-height: 130px;
  padding: 22px 24px;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: var(--paper-soft);
  font: inherit;
  font-family: var(--body);
  font-size: 1rem;
  color: var(--ink);
  resize: vertical;
  line-height: 1.7;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}

.query-panel textarea::placeholder {
  color: var(--muted);
  opacity: 0.7;
}

.query-panel textarea:focus {
  outline: none;
  border-color: var(--brand);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(30, 58, 109, 0.08);
}

/* Priority chips row */
.priority-chips {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding-top: 4px;
}

.priority-label {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: 0.22em;
  align-self: center;
  flex-shrink: 0;
  margin-right: 6px;
}

.priority-chip {
  display: inline-block;
  padding: 8px 18px;
  border-radius: 999px;
  font-family: var(--body);
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--ink);
  background: transparent;
  border: 1px solid var(--line);
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
  user-select: none;
}

.priority-chip:hover {
  background: var(--brand);
  border-color: var(--brand);
  color: #fdf9ec;
}

.query-footer {
  display: flex;
  align-items: center;
  gap: 28px;
  flex-wrap: wrap;
  margin-top: 6px;
  padding-top: 24px;
  border-top: 1px solid var(--line-soft);
}

.run-btn {
  flex-shrink: 0;
  border: 0;
  border-radius: 2px;
  padding: 16px 36px;
  font: inherit;
  font-family: var(--body);
  font-weight: 600;
  font-size: 0.88rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  background: var(--ink);
  color: #fbf6ea;
  cursor: pointer;
  transition: background 0.25s, transform 0.1s, box-shadow 0.25s;
  box-shadow: 0 6px 20px -8px rgba(28, 36, 52, 0.35);
}

.run-btn:hover {
  background: var(--brand);
  box-shadow: 0 10px 28px -10px rgba(30, 58, 109, 0.45);
}
.run-btn:active  { transform: translateY(1px); }
.run-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  background: var(--ink-soft);
  box-shadow: none;
}

.query-hint {
  margin: 0;
  font-family: var(--display);
  font-size: 0.92rem;
  font-style: italic;
  color: var(--muted);
  line-height: 1.65;
  max-width: 56ch;
}

.error-box {
  margin-top: 16px;
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  background: rgba(160, 50, 38, 0.08);
  color: #7a271f;
  border: 1px solid rgba(160, 50, 38, 0.16);
  font-size: 0.92rem;
}

/* ── Loading panel ────────────────────────────────────────────────────────── */
.loading-panel {
  display: flex;
  justify-content: center;
}

.loading-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  padding: 44px 52px 40px;
  width: 100%;
  max-width: 620px;
}

.loading-card > .eyebrow {
  text-align: center;
  display: block;
  margin-bottom: 24px;
  font-family: var(--display);
  font-style: italic;
  font-size: 1.1rem;
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  color: var(--ink);
}

.pipeline-steps {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ps-item {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 16px 18px;
  border-radius: var(--radius-md);
  border-bottom: 1px solid var(--line-soft);
  transition: background 0.25s;
}

.ps-item:last-child { border-bottom: 0; }

.ps-dot {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  transition: background 0.2s, border 0.2s;
}

.ps-text {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.ps-text strong {
  font-family: var(--display);
  font-size: 1.02rem;
  font-weight: 400;
  letter-spacing: -0.005em;
}

.ps-msg {
  font-size: 0.76rem;
  color: var(--muted);
  font-family: var(--body);
}

/* Pending */
.ps-pending {
  background: transparent;
}
.ps-pending .ps-dot { background: rgba(28, 36, 52, 0.14); }
.ps-pending .ps-text strong { color: var(--muted); }

/* Active — spinning dot */
.ps-active {
  background: var(--paper-soft);
}
.ps-active .ps-dot {
  border: 3px solid rgba(30, 58, 109, 0.22);
  border-top-color: var(--brand);
  background: transparent;
  animation: spin 0.75s linear infinite;
}
.ps-active .ps-text strong { color: var(--ink); }
.ps-active .ps-msg { color: var(--brand); opacity: 0.8; }

/* Done */
.ps-done {
  background: transparent;
}
.ps-done .ps-dot {
  background: var(--sage);
  position: relative;
}
.ps-done .ps-dot::after {
  content: '';
  position: absolute;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg viewBox='0 0 10 10' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M2 5l2.5 2.5L8 3' stroke='%23fff' stroke-width='1.6' fill='none' stroke-linecap='round'/%3E%3C/svg%3E") center/10px no-repeat;
}
.ps-done .ps-text strong { color: #1d5c3a; }

.loading-note {
  margin: 22px 0 0;
  font-size: 0.8rem;
  color: var(--muted);
  text-align: center;
  line-height: 1.6;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── Results shell — open editorial flow ─────────────────────────────────── */
.results-shell {
  display: grid;
  gap: 72px;
  counter-reset: section;
}

/* ── Result summary strip ────────────────────────────────────────────────── */
.result-header {
  padding: 32px 48px;
  background: var(--paper-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.result-meta-grid {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 40px;
  align-items: start;
}

.meta-block {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.meta-block-narrow { min-width: 120px; }

.period-label {
  font-size: 1.6rem;
  font-family: var(--display);
  font-weight: 400;
  color: var(--ink);
  letter-spacing: -0.01em;
}

/* Chips */
.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  display: inline-block;
  padding: 7px 14px;
  border-radius: 2px;
  font-family: var(--body);
  font-size: 0.78rem;
  font-weight: 500;
  line-height: 1;
  letter-spacing: 0.01em;
}

.chip-country {
  background: var(--ink);
  color: #fbf6ea;
  border: 1px solid var(--ink);
}

.chip-tool {
  background: transparent;
  color: var(--sage-deep);
  border: 1px solid rgba(74, 122, 95, 0.35);
}

.query-focus-text {
  margin: 22px 0 0;
  padding: 16px 20px;
  border-radius: var(--radius-sm);
  background: #fff;
  border-left: 2px solid var(--brand);
  font-family: var(--display);
  font-style: italic;
  font-size: 1rem;
  color: var(--ink-soft);
  line-height: 1.65;
}


/* ── Open editorial section — Signals / Charts / Evidence ───────────────── */
.eda-section {
  padding: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
  counter-increment: section;
}

.section-heading {
  display: grid;
  grid-template-columns: auto 1fr;
  column-gap: 32px;
  align-items: start;
  margin-bottom: 36px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--line);
}

.section-heading::before {
  content: counter(section, decimal-leading-zero);
  font-family: var(--display);
  font-size: clamp(2.4rem, 4vw, 3.6rem);
  font-weight: 300;
  font-style: italic;
  color: var(--sage);
  line-height: 0.9;
  letter-spacing: -0.02em;
  font-variation-settings: "opsz" 144;
  grid-row: 1 / 3;
  align-self: center;
}

.section-heading .eyebrow {
  grid-column: 2;
  margin-bottom: 6px;
}

.section-heading h2 {
  grid-column: 2;
  font-family: var(--display);
  margin: 0;
  font-size: clamp(1.7rem, 2.4vw, 2.4rem);
  font-weight: 400;
  color: var(--ink);
  line-height: 1.15;
  letter-spacing: -0.018em;
}

.section-heading .section-desc {
  grid-column: 2;
}

.section-desc {
  margin: 14px 0 0;
  font-family: var(--display);
  font-size: 1rem;
  font-style: italic;
  color: var(--muted);
  max-width: 64ch;
  line-height: 1.68;
}

.eda-findings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  margin-top: 4px;
}

.eda-finding-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 32px 32px 28px;
  border-radius: var(--radius-md);
  background: var(--paper);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.3s ease, border-color 0.3s ease, transform 0.3s ease;
  position: relative;
  overflow: hidden;
}

.eda-finding-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 3px;
  height: 100%;
  background: var(--ink);
  opacity: 0.12;
  transition: opacity 0.3s, background 0.3s;
}

.eda-finding-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-3px);
  border-color: rgba(30, 58, 109, 0.18);
}

.eda-finding-card:hover::before {
  opacity: 1;
}

/* Left rail color per finding type */
.eda-growth::before      { background: var(--sage-deep); }
.eda-anomaly::before     { background: var(--brand); }
.eda-correlation::before { background: #5a67cc; }
.eda-volatility::before  { background: var(--sage); }
.eda-default::before     { background: var(--brand-deep); }

.eda-card-icon { display: none; }

.eda-card-tag {
  display: inline-block;
  font-family: var(--body);
  font-size: 0.64rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  padding: 0;
  border-radius: 0;
  background: transparent !important;
  margin-bottom: 2px;
}
.eda-growth      .eda-card-tag { color: var(--sage-deep); }
.eda-anomaly     .eda-card-tag { color: var(--brand); }
.eda-correlation .eda-card-tag { color: #4a57b0; }
.eda-volatility  .eda-card-tag { color: var(--sage); }
.eda-default     .eda-card-tag { color: var(--brand-deep); }

.eda-card-body h3 {
  margin: 2px 0 8px;
  font-family: var(--display);
  font-size: 1.15rem;
  font-weight: 400;
  line-height: 1.32;
  color: var(--ink);
  letter-spacing: -0.01em;
}

.eda-card-value {
  margin: 0 0 14px;
  font-size: clamp(1.6rem, 2.2vw, 2rem);
  font-weight: 400;
  font-family: var(--display);
  color: var(--ink);
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.eda-card-detail {
  margin: 0;
  font-family: var(--display);
  font-size: 0.92rem;
  font-style: italic;
  color: var(--muted);
  line-height: 1.62;
  border-top: 1px solid var(--line-soft);
  padding-top: 14px;
}

.eda-charts-wrap { margin-top: 36px; }

/* ── Comparison Charts section ───────────────────────────────────────────── */
.charts-section {
  padding: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
  counter-increment: section;
}

.charts-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  margin-top: 8px;
}

.chart-card {
  padding: 28px 30px 32px;
  min-height: 480px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.3s ease, transform 0.3s ease, border-color 0.3s ease;
}

.chart-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-3px);
  border-color: rgba(30, 58, 109, 0.18);
}

.plot-surface {
  flex: 1 1 auto;
  width: 100%;
  min-height: 430px;
  max-width: 100%;
  overflow: hidden;
}

.plot-surface .js-plotly-plot,
.plot-surface .plot-container,
.plot-surface .svg-container {
  width: 100% !important;
  max-width: 100% !important;
}

/* EDA charts — same grid as comparison charts */
#eda-charts-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  margin-top: 14px;
}

/* ── What The Evidence Suggests section ─────────────────────────────────── */
.hypothesis-section {
  padding: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
  counter-increment: section;
}

.hypothesis-list {
  display: flex;
  flex-direction: column;
  gap: 28px;
  margin-top: 4px;
}

/* ── Evidence card ─────────────────────────────────────────────────────────── */
.hyp-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 40px 44px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.3s ease, transform 0.3s ease, border-color 0.3s ease;
}

.hyp-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-3px);
  border-color: rgba(30, 58, 109, 0.18);
}

.hyp-header {
  display: flex;
  gap: 20px;
  align-items: flex-start;
}

.hyp-num {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border-radius: 0;
  background: transparent;
  color: var(--sage);
  font-family: var(--display);
  font-weight: 300;
  font-style: italic;
  font-size: 1.8rem;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  margin-top: -2px;
  line-height: 1;
  font-variation-settings: "opsz" 144;
}

.hyp-header-right { flex: 1; min-width: 0; }

.hyp-headline {
  margin: 0 0 12px;
  font-size: clamp(1.2rem, 1.6vw, 1.45rem);
  font-family: var(--display);
  font-weight: 400;
  line-height: 1.3;
  color: var(--ink);
  letter-spacing: -0.012em;
}

.hyp-meta-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.hyp-source-badge {
  display: inline-block;
  font-family: var(--body);
  font-size: 0.66rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--sage-deep);
  padding: 4px 12px;
  border-radius: 2px;
  background: transparent;
  border: 1px solid rgba(74, 122, 95, 0.28);
}

/* Key finding call-out */
.hyp-metric-box {
  display: flex;
  align-items: baseline;
  gap: 14px;
  padding: 18px 22px;
  background: var(--paper-soft);
  border: 0;
  border-left: 2px solid var(--brand);
  border-radius: 0;
  margin-top: 4px;
}

.hyp-metric-label {
  font-family: var(--body);
  font-size: 0.64rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.20em;
  color: var(--ink-soft);
  white-space: nowrap;
  flex-shrink: 0;
}

.hyp-metric-value {
  font-size: clamp(1.15rem, 1.4vw, 1.4rem);
  font-family: var(--display);
  font-weight: 400;
  color: var(--ink);
  line-height: 1.25;
  letter-spacing: -0.005em;
}

.hyp-summary {
  margin: 4px 0 0;
  font-family: var(--display);
  font-size: 1.02rem;
  font-weight: 400;
  color: var(--ink-soft);
  line-height: 1.68;
  letter-spacing: -0.003em;
}

/* Supporting / caveats two-column */
.hyp-evidence-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-top: 4px;
  padding-top: 20px;
  border-top: 1px solid var(--line-soft);
}

.hyp-evidence-col {
  padding: 0;
  border: 0;
  background: transparent;
}

.hyp-col-label {
  margin: 0 0 12px;
  font-family: var(--body);
  font-size: 0.64rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.22em;
}

.hyp-for   .hyp-col-label { color: var(--sage-deep); }
.hyp-against .hyp-col-label { color: #8a4436; }

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

.ev-chip {
  display: inline-block;
  font-family: var(--body);
  font-size: 0.78rem;
  font-weight: 500;
  padding: 5px 11px;
  border-radius: 2px;
  line-height: 1.35;
}

.ev-chip-for {
  background: rgba(74, 122, 95, 0.08);
  color: var(--sage-deep);
  border: 1px solid rgba(74, 122, 95, 0.22);
}

.ev-chip-against {
  background: rgba(160, 70, 55, 0.06);
  color: #7a3228;
  border: 1px solid rgba(160, 70, 55, 0.20);
}

/* Alternative explanation row */
.hyp-competing-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px;
  padding: 14px 18px;
  background: var(--paper-soft);
  border: 0;
  border-left: 2px solid var(--muted);
  border-radius: 0;
  font-family: var(--display);
  font-size: 0.95rem;
  font-style: italic;
}

.hyp-competing-label {
  font-family: var(--body);
  font-weight: 600;
  color: var(--ink-soft);
  font-size: 0.64rem;
  text-transform: uppercase;
  letter-spacing: 0.20em;
  flex-shrink: 0;
  font-style: normal;
}

.hyp-competing-text { color: var(--ink); }
.hyp-verdict-sep    { color: var(--muted); font-weight: 700; font-style: normal; }
.hyp-verdict-text   { color: var(--muted); }

/* ── Confidence badge ─────────────────────────────────────────────────────── */
.conf-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 3px 10px 3px 6px;
  border-radius: 999px;
  border: 1px solid transparent;
}

.conf-bar-wrap {
  width: 34px;
  height: 5px;
  background: rgba(0,0,0,0.07);
  border-radius: 999px;
  overflow: hidden;
  flex-shrink: 0;
}

.conf-bar {
  display: block;
  height: 100%;
  border-radius: 999px;
  transition: width 0.4s ease;
}

.conf-high {
  background: rgba(45, 106, 79, 0.09);
  border-color: rgba(45, 106, 79, 0.20);
  color: #1d5c3a;
}
.conf-high .conf-bar { background: #2d6a4f; }

.conf-med {
  background: rgba(26, 79, 138, 0.09);
  border-color: rgba(26, 79, 138, 0.20);
  color: #0f3361;
}
.conf-med .conf-bar { background: var(--brand); }

.conf-low {
  background: rgba(180, 120, 20, 0.08);
  border-color: rgba(180, 120, 20, 0.18);
  color: #7a5010;
}
.conf-low .conf-bar { background: #c98a20; }

/* ── Out-of-scope panel ───────────────────────────────────────────────────── */
.oos-panel {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 40px 48px;
  display: flex;
  gap: 24px;
  align-items: flex-start;
}

.oos-icon {
  font-size: 2rem;
  line-height: 1;
  flex-shrink: 0;
  margin-top: 4px;
}

.oos-title {
  margin: 0 0 10px;
  font-family: var(--display);
  font-size: 1.5rem;
  font-weight: 400;
  color: var(--ink);
  letter-spacing: -0.01em;
}

.oos-reason {
  margin: 0 0 10px;
  font-size: 0.95rem;
  color: var(--text);
  line-height: 1.65;
}

.oos-hint {
  margin: 0;
  font-size: 0.87rem;
  color: var(--muted);
  line-height: 1.65;
}

.oos-hint em {
  color: var(--brand-deep);
  font-style: normal;
  font-weight: 600;
}

/* ── Proxy note ───────────────────────────────────────────────────────────── */
.proxy-note {
  margin: 18px 0 0;
  padding: 14px 18px;
  border-radius: 0;
  background: var(--paper-soft);
  border: 0;
  border-left: 2px solid #5a67cc;
  font-family: var(--display);
  font-size: 0.95rem;
  font-style: italic;
  color: var(--ink-soft);
  line-height: 1.65;
}

.proxy-note strong { color: #4a57b0; font-style: normal; }

/* ── Coverage warnings ────────────────────────────────────────────────────── */
.coverage-warnings {
  margin-top: 18px;
  padding: 16px 20px;
  border-radius: 0;
  background: var(--warn-bg);
  border: 0;
  border-left: 2px solid rgba(200, 155, 40, 0.5);
}

.coverage-intro {
  font-family: var(--display);
  font-size: 0.95rem;
  font-style: italic;
  color: var(--warn-text);
  margin: 0 0 10px;
  font-weight: 500;
}

.coverage-chips-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 4px;
}

.coverage-note {
  font-size: 0.78rem;
  color: var(--warn-text);
  margin: 8px 0 0;
  opacity: 0.85;
}

.chip-warn {
  background: rgba(200, 155, 40, 0.11);
  color: var(--warn-text);
  border: 1px solid rgba(200, 155, 40, 0.28);
  font-size: 0.78rem;
  padding: 4px 11px;
  border-radius: 999px;
  cursor: default;
}

.chip-warn-detail {
  color: #9a7028;
  font-size: 0.73rem;
  margin-left: 4px;
  opacity: 0.88;
}

/* ── Utility ──────────────────────────────────────────────────────────────── */
.hidden { display: none !important; }

/* ── Responsive ───────────────────────────────────────────────────────────── */
@media (max-width: 1100px) {
  .hero-grid {
    padding: 38px 48px 46px;
    column-gap: 44px;
    grid-template-columns: 1fr 200px;
  }

  .query-panel { padding: 40px 44px; }
}

@media (max-width: 860px) {
  .page-shell {
    width: calc(100% - 32px);
    gap: 44px;
  }

  /* Stack hero vertically */
  .hero-grid {
    grid-template-columns: 1fr;
    grid-template-areas:
      "top"
      "main"
      "sources";
    padding: 36px 36px 44px;
    row-gap: 0;
  }

  .hero-top { margin-bottom: 32px; padding-bottom: 28px; }
  .hero-main {
    margin-bottom: 28px;
    padding: 14px 0 0;
    min-height: 270px;
  }
  .hero-title-wrap {
    display: block;
    width: min(100%, 560px);
  }

  .hero-sources {
    border-left: 0;
    padding-left: 0;
    padding-top: 28px;
    border-top: 1px solid var(--line);
  }

  .source-list {
    display: grid;
    grid-template-columns: 1fr 1fr;
    column-gap: 32px;
  }

  .source-list li {
    padding: 10px 0;
  }

  .source-list li:first-child { padding-top: 10px; }

  .result-meta-grid {
    grid-template-columns: 1fr 1fr;
  }

  .meta-block-narrow {
    grid-column: 1 / -1;
  }

  .charts-grid,
  #eda-charts-grid {
    grid-template-columns: 1fr;
  }

  .chart-card { min-height: 420px; }
  .plot-surface { min-height: 380px; }

  .section-heading {
    column-gap: 20px;
  }
}

@media (max-width: 640px) {
  .page-shell {
    width: calc(100% - 20px);
    padding: 24px 0 72px;
    gap: 40px;
  }

  .hero-grid { padding: 28px 24px 36px; }
  .hero-monogram { font-size: 0.95rem; }
  .hero-title {
    font-size: clamp(2.4rem, 13vw, 3.5rem);
    max-width: none;
  }
  .hero-title-wrap {
    width: 100%;
    padding: 0;
  }
  .hero-title-accent {
    margin-top: 12px;
  }
  .hero-main {
    padding: 10px 0 0;
    min-height: 230px;
  }
  .hero-kicker {
    font-size: 0.66rem;
    letter-spacing: 0.18em;
    padding: 9px 14px;
  }
  .query-panel { padding: 32px 24px; }
  .result-header { padding: 24px 24px; }

  .result-meta-grid { grid-template-columns: 1fr; gap: 24px; }
  .hyp-evidence-grid { grid-template-columns: 1fr; gap: 20px; }
  .hyp-card { padding: 28px 24px; }
  .eda-findings-grid { grid-template-columns: 1fr; }
  .eda-finding-card { padding: 28px 26px 24px; }

  .chart-card { min-height: 360px; padding: 22px 20px 26px; }
  .plot-surface { min-height: 320px; }

  .source-list { grid-template-columns: 1fr; }

  .section-heading {
    grid-template-columns: 1fr;
    column-gap: 0;
    row-gap: 4px;
  }

  .section-heading::before {
    grid-row: auto;
    margin-bottom: 4px;
  }

  .section-heading .eyebrow,
  .section-heading h2,
  .section-heading .section-desc {
    grid-column: 1;
  }
}
