:root { --accent:#427b58; --bar:#c9c4bd; }
.figure-box {
  border: 1px solid color-mix(in srgb, var(--fg4) 20%, var(--bg) 80%);
  border-radius: 0.3rem;
  padding: 1.1rem 1.1rem 0.9rem;
}
figure svg { display: block; width: 100%; height: auto; }
figure svg text { font-family: var(--font-sans); }
figure img { display: block; width: 100%; height: auto; }

/* Bar charts */
.chart { display: flex; flex-direction: column; gap: 0.55rem; }
.chart-group-label {
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--fg4);
  margin: 0.5rem 0 0.1rem;
}
.chart-group-label:first-child { margin-top: 0; }
.chart-row {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 0.8rem;
  align-items: center;
}
.chart-label {
  font-family: var(--font-sans);
  font-size: 12.5px;
  line-height: 1.3;
  color: var(--fg2);
  text-align: right;
}
.chart-track {
  position: relative;
  height: 20px;
  /* The value is positioned after the bar, so a full-width bar would push
     it outside the figure box. Reserve room for the widest label. */
  padding-right: 68px;
}
.chart-bar {
  height: 100%;
  width: var(--w);
  min-width: 2px;
  background: var(--bar);
  border-radius: 2px;
  position: relative;
}
.chart-bar.is-accent { background: var(--accent); }
.chart-value {
  position: absolute;
  left: calc(100% + 0.5rem);
  top: 50%;
  transform: translateY(-50%);
  font-family: var(--font-sans);
  font-size: 12px;
  color: var(--fg3);
  white-space: nowrap;
}

/* Dialogue figure */
.dialogue { display: flex; flex-direction: column; gap: 0.8rem; }
.dialogue p { margin: 0; font-size: 16px; line-height: 1.55; }
.dialogue .speaker {
  font-family: var(--font-sans);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--fg4);
  display: block;
  margin-bottom: 0.15rem;
}
.dialogue .assistant-turn { color: var(--fg2); padding-left: 1.1rem; border-left: 2px solid color-mix(in srgb, var(--accent) 45%, var(--bg) 55%); }
.dialogue .pause { color: var(--fg4); font-style: italic; }

/* Data table (scrolls rather than squeezing) */
.table-wrap {
  overflow-x: auto;
  /* Fade whichever edge can still be scrolled toward. Progressive
     enhancement: no fade where scroll-driven animations are unsupported. */
  --edge-fade: 2rem;
  animation: table-edge-fade linear both;
  animation-timeline: scroll(self inline);
}
@keyframes table-edge-fade {
  from { mask-image: linear-gradient(to right, #000 0%, #000 var(--edge-fade), #000 calc(100% - var(--edge-fade)), transparent 100%); }
  to   { mask-image: linear-gradient(to right, transparent 0%, #000 var(--edge-fade), #000 calc(100% - var(--edge-fade)), #000 100%); }
}
table.data {
  border-collapse: collapse;
  width: 100%;
  font-family: var(--font-sans);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}
table.data th, table.data td {
  border-bottom: 1px solid color-mix(in srgb, var(--fg4) 20%, var(--bg) 80%);
  padding: 0.55rem 0.8rem 0.55rem 0;
  text-align: left;
  vertical-align: top;
}
table.data th { font-weight: 600; color: var(--fg1); }
table.data td { color: var(--fg2); }
table.data td.num, table.data th.num { text-align: right; padding-right: 0; }


figure svg { display:block; width:100%; height:auto; }
figure svg text { font-family:var(--font-sans); }
[data-zoomable] { cursor:zoom-in; }
.figure-zoom { width:min(96vw,1200px); max-height:90dvh; border:1px solid var(--rule); padding:24px; background:var(--bg); }
.figure-zoom::backdrop { background:rgb(255 255 255 / .94); }
.figure-zoom button { display:block; margin:0 0 20px auto; padding:8px 12px; border:1px solid var(--rule); background:var(--bg); font:13px var(--font-sans); }
.figure-zoom svg { display:block; width:100%; height:auto; }
.figure-zoom svg text { font-family:var(--font-sans); }
@media(max-width:760px) {
 .chart-row { grid-template-columns:1fr; gap:.25rem; }
 .chart-label { text-align:left; }
 .chart-value { font-size:11px; }
}
