/* =========================================================================
   Agent Trade — UI styles
   Aesthetic: Anthropic-ish. Warm cream background, clay-orange accent,
   serif headings, generous whitespace, restrained color, academic feel.
   ========================================================================= */

:root {
  /* Palette */
  --bg:               #F0EEE6;
  --bg-elev:          #FAF9F5;
  --bg-elev-2:        #FFFFFF;
  --ink:              #191919;
  --ink-2:            #3A3A37;
  --ink-3:            #6B6862;
  --ink-4:            #97938B;
  --rule:             #DDD7C7;
  --rule-strong:      #C9C2AE;

  /* Brand & semantic */
  --clay:             #CC785C;          /* primary accent (Anthropic-y) */
  --clay-deep:        #A0432F;          /* lies caught / strong negative */
  --clay-soft:        #E2A28E;          /* hover/secondary */
  --teal-deep:        #2F6E6E;          /* honest / fair-value reference */
  --teal:             #5A8A8A;          /* low premium / buyer surplus */
  --gold:             #B8893D;          /* inspection / revealed fact */
  --gold-soft:        #E0C283;
  --slate:            #4B5563;
  --olive:            #7A8B5A;          /* honest dealer */

  /* Premium scale (diverging — cool→warm) */
  --p-neg-2:          #2F6E6E;
  --p-neg-1:          #7BA9A9;
  --p-zero:           #E7E1D2;
  --p-pos-1:          #E0A98F;
  --p-pos-2:          #CC785C;
  --p-pos-3:          #A0432F;

  /* Fonts */
  --serif: "Source Serif 4", "Tiempos Headline", "Iowan Old Style", Palatino, Georgia, serif;
  --sans:  "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --mono:  "JetBrains Mono", "SF Mono", Menlo, Consolas, monospace;

  /* Spacing */
  --pad: 1.25rem;
  --gap: 1.5rem;
  --max-w: 1180px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: var(--clay-deep); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }

code, pre {
  font-family: var(--mono);
  font-size: 0.86em;
  background: var(--bg-elev);
  padding: 0.05em 0.35em;
  border-radius: 3px;
  border: 1px solid var(--rule);
}

em { font-style: italic; color: var(--ink-2); }
strong { font-weight: 600; color: var(--ink); }

/* =========================================================================
   Masthead
   ========================================================================= */

.masthead {
  background: var(--bg);
  border-bottom: 1px solid var(--rule);
  padding: 3rem 0 0;
}
.masthead-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 2rem;
}
.masthead-eyebrow {
  font-family: var(--sans);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 0.6rem;
  font-weight: 500;
}
.masthead-title {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 2.5rem;
  line-height: 1.15;
  letter-spacing: -0.01em;
  color: var(--ink);
  margin: 0 0 0.85rem;
}
.masthead-subtitle {
  font-family: var(--serif);
  font-size: 1.05rem;
  line-height: 1.55;
  color: var(--ink-2);
  max-width: 56ch;
  margin: 0 0 2rem;
}

.masthead-nav {
  display: flex;
  gap: 0;
  align-items: center;
  border-bottom: none;
  margin-top: 1.5rem;
}
.nav-link {
  font-family: var(--sans);
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--ink-3);
  padding: 0.85rem 1.1rem 0.85rem 0;
  margin-right: 1.5rem;
  border-bottom: 2px solid transparent;
  transition: color 0.15s ease, border-color 0.15s ease;
  text-decoration: none !important;
  position: relative;
  top: 1px;
}
.nav-link:hover { color: var(--ink); }
.nav-link.active {
  color: var(--clay);
  border-bottom-color: var(--clay);
}

/* =========================================================================
   Content
   ========================================================================= */

.content {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 2.5rem 2rem 4rem;
}

.view { display: none; }
.view.active { display: block; }

.section-title {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 1.55rem;
  letter-spacing: -0.005em;
  color: var(--ink);
  margin: 0 0 0.5rem;
}
.subsection-title {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 1.15rem;
  color: var(--ink);
  margin: 1.5rem 0 0.4rem;
}
.section-lede {
  font-family: var(--serif);
  font-size: 1rem;
  color: var(--ink-2);
  max-width: 68ch;
  margin: 0 0 1.6rem;
  line-height: 1.6;
}

.paper-section {
  border-top: 1px solid var(--rule);
  padding-top: 2.25rem;
  margin-top: 2.25rem;
}
.paper-section:first-of-type {
  border-top: none;
  padding-top: 0;
  margin-top: 0;
}
.paper-section.narrow { max-width: 64ch; }
.paper-section.narrow p {
  font-family: var(--serif);
  font-size: 1.02rem;
  color: var(--ink-2);
  margin: 0.8rem 0;
}

/* =========================================================================
   Stat cards
   ========================================================================= */

.grid-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
  border: 1px solid var(--rule);
  background: var(--bg-elev);
  border-radius: 4px;
  margin-bottom: 2.5rem;
}
.stat-card {
  padding: 1.25rem 1.35rem;
  border-right: 1px solid var(--rule);
}
.stat-card:last-child { border-right: none; }
.stat-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-3);
  margin-bottom: 0.5rem;
  font-weight: 500;
}
.stat-value {
  font-family: var(--serif);
  font-size: 1.95rem;
  font-weight: 500;
  color: var(--ink);
  line-height: 1.1;
}
.stat-foot {
  font-size: 0.78rem;
  color: var(--ink-3);
  margin-top: 0.4rem;
}

@media (max-width: 820px) {
  .grid-stats { grid-template-columns: repeat(2, 1fr); }
  .stat-card:nth-child(2) { border-right: none; }
  .stat-card:nth-child(1), .stat-card:nth-child(2) { border-bottom: 1px solid var(--rule); }
}

/* =========================================================================
   Charts (D3 host divs)
   ========================================================================= */

.chart {
  background: var(--bg-elev);
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: 1.25rem;
}
.chart svg { display: block; width: 100%; height: auto; }

.chart .axis text {
  font-family: var(--sans);
  font-size: 11px;
  fill: var(--ink-3);
}
.chart .axis line, .chart .axis path {
  stroke: var(--rule-strong);
  shape-rendering: crispEdges;
}
.chart .axis-label {
  font-family: var(--sans);
  font-size: 11px;
  fill: var(--ink-2);
  font-weight: 500;
}
.chart .grid line {
  stroke: var(--rule);
  stroke-dasharray: 2 3;
}
.chart .ref-line {
  stroke: var(--ink-3);
  stroke-dasharray: 3 3;
  stroke-width: 1;
}
.chart .ref-label {
  font-family: var(--sans);
  font-size: 10px;
  fill: var(--ink-3);
  font-weight: 500;
}

.legend-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
  padding: 0.85rem 1.25rem;
  margin-top: -1px;
  background: var(--bg-elev);
  border: 1px solid var(--rule);
  border-top: none;
  border-radius: 0 0 4px 4px;
  font-size: 0.82rem;
  color: var(--ink-2);
  align-items: center;
}
.legend-swatch {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  margin-right: 0.4rem;
  vertical-align: -1px;
}

/* Tooltip */
.tooltip {
  position: absolute;
  pointer-events: none;
  background: var(--ink);
  color: var(--bg-elev);
  font-family: var(--sans);
  font-size: 11px;
  line-height: 1.45;
  padding: 0.5rem 0.65rem;
  border-radius: 3px;
  max-width: 260px;
  opacity: 0;
  transition: opacity 0.1s ease;
  z-index: 100;
  box-shadow: 0 2px 6px rgba(0,0,0,0.12);
}
.tooltip strong { color: var(--clay-soft); font-weight: 600; }
.tooltip .tt-row { display: flex; justify-content: space-between; gap: 1rem; }
.tooltip .tt-row span:last-child { font-variant-numeric: tabular-nums; }

/* =========================================================================
   Filter bar (susceptibility view)
   ========================================================================= */

.filter-bar {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
  padding: 1rem 1.25rem;
  background: var(--bg-elev);
  border: 1px solid var(--rule);
  border-radius: 4px;
  margin-bottom: 2rem;
  align-items: center;
}
.filter-bar label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-3);
  font-weight: 500;
}
.filter-bar select,
.replay-controls select {
  font-family: var(--sans);
  font-size: 0.88rem;
  background: var(--bg-elev-2);
  border: 1px solid var(--rule-strong);
  color: var(--ink);
  padding: 0.4rem 0.6rem;
  border-radius: 3px;
  text-transform: none;
  letter-spacing: 0;
  font-weight: 400;
  min-width: 180px;
  cursor: pointer;
}
.filter-bar select:focus,
.replay-controls select:focus {
  outline: 2px solid var(--clay-soft);
  outline-offset: 1px;
}

/* =========================================================================
   Replay view
   ========================================================================= */

.replay-controls {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
  padding: 0.85rem 1.25rem;
  background: var(--bg-elev);
  border: 1px solid var(--rule);
  border-radius: 4px;
  margin-bottom: 1.25rem;
  align-items: center;
}
.replay-controls label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-3);
  font-weight: 500;
}
.replay-controls > label > select { min-width: 320px; }
.replay-controls .speed-label > select { min-width: 80px; }
.replay-play-controls {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  align-self: flex-end;
}
.replay-meta {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--ink-3);
  align-self: flex-end;
  padding-bottom: 0.3rem;
}

.ctrl-btn {
  font-family: var(--sans);
  font-size: 0.86rem;
  background: var(--bg-elev-2);
  border: 1px solid var(--rule-strong);
  color: var(--ink-2);
  padding: 0.45rem 0.8rem;
  border-radius: 3px;
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
  font-weight: 500;
  min-width: 36px;
}
.ctrl-btn:hover {
  border-color: var(--clay);
  color: var(--clay-deep);
}
.ctrl-btn-primary {
  background: var(--clay);
  border-color: var(--clay);
  color: var(--bg-elev-2);
}
.ctrl-btn-primary:hover {
  background: var(--clay-deep);
  border-color: var(--clay-deep);
  color: var(--bg-elev-2);
}

.replay-layout {
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  gap: 1.25rem;
}
@media (max-width: 1000px) {
  .replay-layout { grid-template-columns: 1fr; }
}

.pane-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 0.85rem 1.1rem;
  background: var(--bg-elev);
  border: 1px solid var(--rule);
  border-bottom: none;
  border-radius: 4px 4px 0 0;
}
.pane-title {
  font-family: var(--serif);
  font-size: 1rem;
  font-weight: 500;
  color: var(--ink);
}
.pane-meta {
  font-family: var(--sans);
  font-size: 0.74rem;
  color: var(--ink-3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* Transcript */
.transcript {
  background: var(--bg-elev);
  border: 1px solid var(--rule);
  border-top: none;
  border-radius: 0 0 4px 4px;
  padding: 0.5rem 0;
  max-height: 640px;
  overflow-y: auto;
}
.turn {
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: 0.6rem;
  padding: 0.55rem 1.1rem;
  border-left: 3px solid transparent;
  opacity: 0.32;
  transition: opacity 0.25s ease, background 0.15s ease, border-left-color 0.15s ease;
  cursor: pointer;
  position: relative;
}
.turn:hover { background: rgba(204, 120, 92, 0.06); }
.turn.active {
  opacity: 1;
  background: rgba(204, 120, 92, 0.07);
  border-left-color: var(--clay);
}
.turn.visible { opacity: 1; }
.turn.future { opacity: 0.32; }

.turn-meta {
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--ink-4);
  padding-top: 0.18rem;
  text-align: right;
  line-height: 1.4;
}
.turn-meta .speaker { font-weight: 500; }
.turn-meta .seller-tag { color: var(--clay); }
.turn-meta .buyer-tag  { color: var(--teal-deep); }

.turn-body { font-size: 0.92rem; line-height: 1.5; color: var(--ink-2); }
.turn-tool {
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--ink-3);
  background: var(--bg);
  border: 1px solid var(--rule);
  padding: 0.05rem 0.4rem;
  border-radius: 2px;
  margin-right: 0.4rem;
  display: inline-block;
  vertical-align: 1px;
}
.turn-text { color: var(--ink); }

.turn.lie .turn-text { color: var(--clay-deep); }
.turn.lie::before {
  content: "LIE";
  position: absolute;
  right: 0.85rem;
  top: 0.55rem;
  font-family: var(--mono);
  font-size: 0.62rem;
  color: var(--clay-deep);
  letter-spacing: 0.1em;
  font-weight: 600;
  background: rgba(160, 67, 47, 0.08);
  border: 1px solid var(--clay-deep);
  padding: 0.1rem 0.35rem;
  border-radius: 2px;
}
.turn.lie-truth {
  margin-top: -0.3rem;
  padding-top: 0;
  font-size: 0.82rem;
  color: var(--clay-deep);
  font-style: italic;
  background: rgba(160, 67, 47, 0.04);
  border-left-color: var(--clay-deep);
  cursor: default;
}
.turn.tactic::after {
  content: attr(data-tactic);
  position: absolute;
  right: 0.85rem;
  top: 0.55rem;
  font-family: var(--mono);
  font-size: 0.62rem;
  color: var(--gold);
  background: rgba(184, 137, 61, 0.1);
  border: 1px solid var(--gold);
  padding: 0.1rem 0.35rem;
  border-radius: 2px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.turn.inspection::before {
  content: "INSPECTION";
  position: absolute;
  right: 0.85rem;
  top: 0.55rem;
  font-family: var(--mono);
  font-size: 0.62rem;
  color: var(--gold);
  background: rgba(184, 137, 61, 0.1);
  border: 1px solid var(--gold);
  padding: 0.1rem 0.35rem;
  border-radius: 2px;
  letter-spacing: 0.08em;
  font-weight: 600;
}
.turn.lie-caught::before {
  content: "CAUGHT";
  position: absolute;
  right: 0.85rem;
  top: 0.55rem;
  font-family: var(--mono);
  font-size: 0.62rem;
  color: var(--clay-deep);
  background: rgba(160, 67, 47, 0.12);
  border: 1px solid var(--clay-deep);
  padding: 0.1rem 0.35rem;
  border-radius: 2px;
  letter-spacing: 0.08em;
  font-weight: 600;
}

/* Iceberg */
.iceberg {
  background: var(--bg-elev);
  border: 1px solid var(--rule);
  border-top: none;
  border-radius: 0 0 4px 4px;
  padding: 1.25rem 1.25rem 0.75rem;
}
.iceberg-listing {
  background: var(--bg-elev-2);
  border: 1px solid var(--rule);
  border-radius: 3px;
  padding: 1rem 1.1rem;
  margin-bottom: 0;
}
.listing-make {
  font-family: var(--serif);
  font-size: 1.2rem;
  font-weight: 500;
  color: var(--ink);
  margin: 0 0 0.15rem;
}
.listing-trim {
  font-family: var(--sans);
  font-size: 0.82rem;
  color: var(--ink-3);
  margin-bottom: 0.65rem;
}
.listing-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  margin: 0.5rem 0 0.6rem;
}
.listing-stat-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--ink-3);
}
.listing-stat-value {
  font-family: var(--mono);
  font-size: 0.85rem;
  color: var(--ink);
  font-weight: 500;
}
.listing-pitch {
  font-family: var(--serif);
  font-size: 0.86rem;
  color: var(--ink-2);
  font-style: italic;
  line-height: 1.5;
  margin: 0;
  padding-top: 0.6rem;
  border-top: 1px dashed var(--rule);
}

.waterline-wrap {
  position: relative;
  height: 38px;
  margin: 0.4rem 0 0;
}
.waterline {
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--clay);
  background: repeating-linear-gradient(
    90deg,
    var(--clay) 0px,
    var(--clay) 6px,
    transparent 6px,
    transparent 11px
  );
}
.waterline-label-left,
.waterline-label-right {
  position: absolute;
  top: 50%;
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ink-3);
  background: var(--bg-elev);
  padding: 0 0.4rem;
  transform: translateY(-50%);
}
.waterline-label-left { left: 0.7rem; color: var(--ink-3); }
.waterline-label-right { right: 0.7rem; color: var(--clay); }

.private-facts {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding-top: 0.25rem;
}
.fact {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.65rem;
  align-items: center;
  background: var(--bg);
  border: 1px solid var(--rule);
  padding: 0.55rem 0.8rem;
  border-radius: 3px;
  opacity: 0.35;
  transition: opacity 0.5s ease, transform 0.5s ease,
              background 0.4s ease, border-color 0.4s ease;
  transform: translateY(6px);
}
.fact.revealed {
  opacity: 1;
  transform: translateY(0);
}
.fact.revealed-inspection {
  border-color: var(--gold);
  background: rgba(184, 137, 61, 0.06);
}
.fact.revealed-lie {
  border-color: var(--clay-deep);
  background: rgba(160, 67, 47, 0.05);
}
.fact.revealed-volunteer {
  border-color: var(--olive);
  background: rgba(122, 139, 90, 0.05);
}
.fact-area {
  font-family: var(--mono);
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-3);
  background: var(--bg-elev);
  padding: 0.15rem 0.45rem;
  border-radius: 2px;
  border: 1px solid var(--rule);
}
.fact.revealed-inspection .fact-area { color: var(--gold); border-color: var(--gold); }
.fact.revealed-lie .fact-area        { color: var(--clay-deep); border-color: var(--clay-deep); }
.fact.revealed-volunteer .fact-area  { color: var(--olive); border-color: var(--olive); }

.fact-text { font-size: 0.86rem; color: var(--ink-2); line-height: 1.4; }
.fact-impact {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--clay-deep);
  font-weight: 500;
  white-space: nowrap;
}
.fact-severity {
  display: inline-flex;
  gap: 1px;
  margin-left: 0.4rem;
}
.fact-severity .sev-dot {
  width: 5px;
  height: 5px;
  background: var(--ink-3);
  border-radius: 50%;
  display: inline-block;
}
.fact-severity .sev-dot.off { opacity: 0.18; }

/* Price track */
.price-track {
  margin: 0.9rem 0 1.1rem;
  padding: 0;
}
.price-track-inner {
  background: var(--bg-elev);
  padding: 0.4rem 0 0.5rem;
}
.price-track-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-3);
  margin-bottom: 0.5rem;
  font-weight: 500;
}

/* =========================================================================
   Heatmap
   ========================================================================= */

.heatmap-cell {
  stroke: var(--bg-elev);
  stroke-width: 2;
  cursor: pointer;
  transition: stroke 0.12s ease, stroke-width 0.12s ease;
}
.heatmap-cell:hover {
  stroke: var(--ink);
  stroke-width: 2;
}
.heatmap-cell-empty {
  fill: var(--bg);
  stroke: var(--rule);
}
.heatmap-cell-label {
  font-family: var(--mono);
  font-size: 10px;
  fill: var(--ink);
  pointer-events: none;
  font-weight: 500;
}
.heatmap-axis-label {
  font-family: var(--sans);
  font-size: 11px;
  fill: var(--ink-2);
}
.heatmap-axis-label-strong {
  font-weight: 600;
  fill: var(--ink);
}

/* =========================================================================
   Footer
   ========================================================================= */

.footer {
  border-top: 1px solid var(--rule);
  background: var(--bg);
  margin-top: 2rem;
}
.footer-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 1.5rem 2rem;
  font-size: 0.78rem;
  color: var(--ink-3);
  display: flex;
  gap: 0.5rem;
  align-items: center;
}
.footer-sep { color: var(--ink-4); }

/* ============ Who's in the lot view (cards + bars) ============ */
#view-lot .lot-row-label {
  font-size: 0.78em;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #8a7e6f;
  margin: 22px 0 10px;
}
#view-lot .lot-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}
@media (max-width: 1100px) {
  #view-lot .lot-row { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  #view-lot .lot-row { grid-template-columns: 1fr; }
}
#view-lot .lot-card {
  background: #f5efe4;
  border: 1px solid #e0d8c8;
  border-radius: 6px;
  padding: 18px 18px 16px;
}
#view-lot .lot-card-eyebrow {
  font-size: 0.7em;
  letter-spacing: 0.1em;
  color: #9c8f7e;
  text-transform: uppercase;
  margin-bottom: 8px;
}
#view-lot .lot-card-name {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
}
#view-lot .lot-name-text {
  font-family: 'Tiempos Headline', 'Source Serif 4', Georgia, serif;
  font-weight: 500;
  font-size: 1.2em;
  color: #2a241c;
  line-height: 1.1;
}
#view-lot .lot-dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
}
#view-lot .lot-square {
  display: inline-block;
  width: 9px;
  height: 9px;
  flex-shrink: 0;
}
#view-lot .lot-card-bars {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
#view-lot .lot-bar {
  display: grid;
  grid-template-columns: 90px 1fr 38px;
  align-items: center;
  gap: 10px;
  font-size: 0.82em;
}
#view-lot .lot-bar-label {
  color: #8a7e6f;
}
#view-lot .lot-bar-track {
  height: 3px;
  background: #ebe2d1;
  border-radius: 2px;
  overflow: hidden;
}
#view-lot .lot-bar-fill {
  display: block;
  height: 100%;
  background: #d56a3e;
}
#view-lot .lot-bar-val {
  text-align: right;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.85em;
  color: #6a5e4f;
}
/* ============ E3 Delegation view ============ */
.e3-aggregate {
  background: #fafafa;
  border: 1px solid #e8e8e8;
  border-radius: 6px;
  padding: 16px;
}
.e3-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95em;
}
.e3-table th, .e3-table td {
  text-align: left;
  padding: 8px 12px;
  border-bottom: 1px solid #eee;
}
.e3-table thead th {
  font-weight: 600;
  color: #333;
  border-bottom: 2px solid #ddd;
}
.e3-table td:first-child {
  color: #888;
}
.e3-table td:not(:first-child) {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.92em;
  color: #222;
}
.e3-delta-positive {
  color: #c33;
  font-weight: 600;
}
.e3-callout {
  margin-top: 12px;
  font-size: 0.88em;
  color: #666;
  font-style: italic;
}
.e3-featured {
  list-style: none;
  padding: 0;
}
.e3-featured li {
  margin-bottom: 12px;
  padding: 10px 12px;
  background: #fafafa;
  border-left: 3px solid #557;
  border-radius: 4px;
}
.e3-featured code {
  font-size: 0.78em;
  color: #557;
}
.e3-featured-label {
  font-size: 0.85em;
  color: #555;
}
/* =========================================================================
   Primer view — the audience-priming first page
   ========================================================================= */

.primer-hero { border-top: none; padding-top: 0; margin-top: 0; }

.market-shell {
  display: grid;
  grid-template-columns: 1fr 260px;
  gap: 1.25rem;
  margin-top: 0.4rem;
  background: var(--bg-elev);
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: 1.25rem;
}
@media (max-width: 900px) {
  .market-shell { grid-template-columns: 1fr; }
}

.market-canvas {
  background: var(--bg-elev-2);
  border: 1px solid var(--rule);
  border-radius: 3px;
  min-height: 420px;
  position: relative;
  overflow: hidden;
}
.market-canvas svg { display: block; width: 100%; height: 100%; }

.market-side { display: flex; flex-direction: column; gap: 0.85rem; }

.market-stat {
  background: var(--bg-elev-2);
  border: 1px solid var(--rule);
  border-radius: 3px;
  padding: 0.75rem 0.9rem;
}
.market-stat-label {
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-3);
  font-weight: 500;
}
.market-stat-value {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 1.6rem;
  line-height: 1.2;
  color: var(--ink);
  margin-top: 0.15rem;
  font-variant-numeric: tabular-nums;
}
.market-stat-foot {
  font-size: 0.7rem;
  color: var(--ink-3);
  margin-top: 0.25rem;
}

.market-legend {
  background: var(--bg-elev-2);
  border: 1px solid var(--rule);
  border-radius: 3px;
  padding: 0.7rem 0.9rem;
  font-size: 0.78rem;
}
.market-legend-title {
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-3);
  font-weight: 500;
  margin-bottom: 0.3rem;
}
.market-legend-row {
  display: flex; align-items: center; gap: 0.4rem;
  color: var(--ink-2);
  padding: 0.08rem 0;
}
.market-legend-row .dot {
  width: 9px; height: 9px; border-radius: 50%; display: inline-block;
}
.market-legend-row .dot-square { border-radius: 2px; }

.market-caption {
  margin-top: 0.6rem;
  font-size: 0.82rem;
  font-style: italic;
  color: var(--ink-3);
  max-width: 70ch;
}

/* Iceberg explainer */

.primer-iceberg-shell {
  background: var(--bg-elev);
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: 1.25rem;
  margin-top: 0.4rem;
}
.primer-listing {
  background: var(--bg-elev-2);
  border: 1px solid var(--rule);
  border-radius: 3px;
  padding: 1rem 1.1rem;
  position: relative;
}
.primer-listing-make {
  font-family: var(--serif);
  font-size: 1.15rem;
  font-weight: 500;
  color: var(--ink);
}
.primer-listing-trim {
  font-size: 0.82rem;
  color: var(--ink-3);
  margin-bottom: 0.55rem;
}
.primer-listing-pitch {
  font-family: var(--serif);
  font-size: 0.92rem;
  font-style: italic;
  color: var(--ink-2);
  margin: 0;
  padding-top: 0.5rem;
  border-top: 1px dashed var(--rule);
}
.primer-tag {
  position: absolute;
  bottom: -10px;
  right: 0.9rem;
  background: var(--bg-elev);
  padding: 0 0.4rem;
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 500;
}
.primer-tag-public  { color: var(--ink-3); }
.primer-tag-private { color: var(--clay); }

.primer-waterline {
  position: relative;
  height: 26px;
  margin: 0.3rem 0;
  background: repeating-linear-gradient(
    90deg, var(--clay) 0 6px, transparent 6px 11px
  );
  background-position: 0 50%;
  background-size: 100% 1px;
  background-repeat: repeat-x;
}
.primer-waterline span {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  background: var(--bg-elev);
  padding: 0 0.5rem;
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--clay);
  font-weight: 500;
}

.primer-private {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}
.primer-fact {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.75rem;
  align-items: center;
  background: rgba(160, 67, 47, 0.04);
  border: 1px solid var(--clay-deep);
  border-radius: 3px;
  padding: 0.55rem 0.85rem;
}
.primer-fact-area {
  font-family: var(--mono);
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--clay-deep);
  background: var(--bg-elev-2);
  padding: 0.15rem 0.45rem;
  border-radius: 2px;
  border: 1px solid var(--clay-deep);
}
.primer-fact-text {
  font-size: 0.85rem;
  color: var(--ink-2);
}
.primer-fact-impact {
  font-family: var(--mono);
  font-size: 0.82rem;
  color: var(--clay-deep);
  font-weight: 600;
  white-space: nowrap;
}
.primer-true-value {
  margin-top: 0.4rem;
  padding: 0.55rem 0.85rem;
  background: var(--bg-elev-2);
  border: 1px solid var(--rule);
  border-radius: 3px;
  font-family: var(--mono);
  font-size: 0.84rem;
  color: var(--ink-2);
  text-align: right;
}
.primer-true-value strong { color: var(--clay-deep); }

.primer-takeaway {
  font-family: var(--serif);
  font-size: 1rem;
  color: var(--ink-2);
  max-width: 70ch;
  margin: 1.2rem 0 0;
  line-height: 1.5;
}

/* Persona cards */

.primer-persona-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
  margin: 0.5rem 0 0.5rem;
}
@media (min-width: 1000px) {
  .primer-persona-grid { grid-template-columns: repeat(4, 1fr); }
}
.persona-card {
  background: var(--bg-elev);
  border: 1px solid var(--rule);
  border-radius: 3px;
  padding: 0.85rem 1rem;
}
.persona-card-side {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-3);
  font-weight: 500;
  margin-bottom: 0.25rem;
}
.persona-card-name {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 1.05rem;
  color: var(--ink);
}
.persona-card-tag {
  display: inline-block;
  margin-left: 0.35rem;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  vertical-align: 0;
}
.persona-card-tag-square { border-radius: 2px; }
.persona-card-stats {
  margin-top: 0.55rem;
  display: flex; flex-direction: column; gap: 0.28rem;
}
.persona-stat-row {
  display: grid;
  grid-template-columns: 70px 1fr 36px;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.74rem;
}
.persona-stat-label { color: var(--ink-3); }
.persona-stat-value { font-family: var(--mono); color: var(--ink-2); text-align: right; }
.persona-stat-bar {
  height: 4px;
  background: var(--bg);
  border: 1px solid var(--rule);
  border-radius: 2px;
  position: relative;
  overflow: hidden;
}
.persona-stat-bar-fill {
  position: absolute; left: 0; top: 0; bottom: 0;
  background: var(--clay);
}

.primer-cta {
  margin-top: 1.5rem;
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
}
.primer-cta-link {
  font-family: var(--sans);
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--clay-deep);
  border-bottom: 1px solid var(--clay);
  padding-bottom: 1px;
}
.primer-cta-link:hover { color: var(--clay); text-decoration: none; }
.primer-cta-link-secondary { color: var(--ink-3); border-bottom-color: var(--ink-4); }
.primer-cta-link-secondary:hover { color: var(--ink-2); }

/* Reading-note callout (interpretation panel on Susceptibility) */

.reading-note {
  margin-top: 1.5rem;
  padding: 1.25rem 1.5rem;
  background: var(--bg-elev);
  border: 1px solid var(--rule);
  border-left: 3px solid var(--clay);
  border-radius: 3px;
}
.reading-note-title {
  font-family: var(--sans);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--clay);
  font-weight: 600;
  margin-bottom: 0.65rem;
}
.reading-note p {
  font-family: var(--serif);
  font-size: 0.96rem;
  color: var(--ink-2);
  margin: 0 0 0.6rem;
  line-height: 1.55;
  max-width: 78ch;
}
.reading-note p:last-child { margin-bottom: 0; }
.reading-note p strong { color: var(--ink); }
.reading-note p em { color: var(--clay-deep); font-style: normal; }

/* =========================================================================
   Reputation view (e4 sweep)
   ========================================================================= */

.reputation-stats {
  margin-top: 0.4rem;
}

.filter-summary {
  font-family: var(--serif);
  font-size: 0.9rem;
  color: var(--ink-3);
  margin-left: auto;
  align-self: center;
  font-style: italic;
}
.rep-stats-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 0.7fr;
  background: var(--bg-elev);
  border: 1px solid var(--rule);
  border-radius: 4px;
  overflow: hidden;
}
.rep-stats-head {
  padding: 0.65rem 0.9rem;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-3);
  font-weight: 600;
  background: var(--bg);
  border-bottom: 1px solid var(--rule);
}
.rep-stats-head span {
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  color: var(--ink-4);
  font-size: 0.7rem;
}
.rep-stats-head-treatment { color: var(--teal-deep); }
.rep-stats-head-control   { color: var(--clay-deep); }

.rep-stats-label {
  padding: 0.85rem 0.95rem;
  font-family: var(--serif);
  font-size: 0.92rem;
  color: var(--ink-2);
  border-bottom: 1px solid var(--rule);
  cursor: help;
}
.rep-stats-info {
  font-size: 0.8rem;
  color: var(--ink-3, var(--ink-2));
  opacity: 0.55;
  margin-left: 0.25rem;
}
.rep-stats-grid > div:nth-last-child(-n+4) { border-bottom: none; }

.rep-stats-cell {
  padding: 0.85rem 0.95rem;
  font-family: var(--serif);
  font-size: 1.2rem;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  border-bottom: 1px solid var(--rule);
}
.rep-stats-cell-treatment { color: var(--teal-deep); background: rgba(47, 110, 110, 0.04); }
.rep-stats-cell-control   { color: var(--clay-deep); background: rgba(160, 67, 47, 0.05); }
.rep-stats-cell-delta {
  font-family: var(--mono);
  font-size: 0.95rem;
}
.rep-stats-cell.rep-good  { color: var(--teal-deep); }
.rep-stats-cell.rep-bad   { color: var(--clay-deep); }

/* Review feed */

.review-feed {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
  margin-top: 0.4rem;
}
@media (min-width: 900px) {
  .review-feed { grid-template-columns: 1fr 1fr; }
}
.review-card {
  background: var(--bg-elev);
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: 0.95rem 1.1rem;
}
.review-head {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  flex-wrap: wrap;
  margin-bottom: 0.5rem;
}
.review-stars {
  font-family: serif;
  font-size: 1rem;
  letter-spacing: 1px;
  color: var(--gold);
}
.review-meta {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--ink-3);
}
.rev-cond {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0.12rem 0.45rem;
  border-radius: 2px;
  font-weight: 600;
}
.rev-cond-treatment {
  color: var(--teal-deep);
  background: rgba(47, 110, 110, 0.08);
  border: 1px solid var(--teal-deep);
}
.rev-cond-control {
  color: var(--clay-deep);
  background: rgba(160, 67, 47, 0.08);
  border: 1px solid var(--clay-deep);
}
.review-text {
  font-family: var(--serif);
  font-size: 0.95rem;
  color: var(--ink);
  line-height: 1.5;
  font-style: italic;
  margin: 0 0 0.5rem;
}
.review-foot {
  font-size: 0.78rem;
  color: var(--ink-3);
  font-family: var(--mono);
  padding-top: 0.45rem;
  border-top: 1px dashed var(--rule);
}
