/* ============================================================
   wiretaplitigation.com — chat surface
   civic-watchdog direction: bold type, high contrast, mobile-first
   ============================================================ */

:root {
  --bg:           #eef5fa;
  --surface:      #ffffff;
  --surface-alt:  #e5eff7;
  --ink:          #183554;
  --ink-soft:     #2a2e34;
  --muted:        #5b6470;
  --rule:         #e6e3d8;       /* warm hairline */
  --rule-soft:    #efece4;
  --accent:       #135574;
  --accent-hot:   #0c3f58;
  --accent-tint:  #e0f0f8;
  --link:         #1f4dbf;
  --ok:           #1a7f37;
  --warn:         #8a1f1f;
  --shadow-sm:    0 1px 2px rgba(14, 17, 22, 0.05);
  --shadow-md:    0 2px 8px rgba(14, 17, 22, 0.06);
  --radius-sm:    6px;
  --radius:       8px;
  --radius-lg:    12px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Arial, sans-serif;
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

@media (min-width: 720px) {
  html, body { font-size: 17px; }
}

.container {
  max-width: 760px;
  margin: 0 auto;
  padding: 0 1.1rem;
}

a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }

button {
  font-family: inherit;
  font-size: inherit;
}

.additional-examples { margin-top: 1rem; }
.additional-examples summary { cursor: pointer; color: var(--link); }

/* ------------------------------------------------------------
   Site head
   ------------------------------------------------------------ */

.site-head {
  background: var(--surface);
  border-bottom: 1px solid var(--rule);
  padding: 1.25rem 0 1.05rem;
}

@media (min-width: 720px) {
  .site-head { padding: 1.6rem 0 1.4rem; }
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.brand-mark {
  display: inline-block;
  width: 0.85rem;
  height: 0.85rem;
  background: var(--accent);
  border-radius: 2px;
}

.brand-name {
  font-weight: 800;
  letter-spacing: -0.01em;
  font-size: 1.45rem;
  color: var(--ink);
  text-transform: none;
}

@media (min-width: 720px) {
  .brand-name { font-size: 1.7rem; }
}

.tagline {
  margin: 0.7rem 0 0;
  color: var(--ink-soft);
  font-size: 1rem;
  max-width: 60ch;
}

@media (min-width: 720px) {
  .tagline { font-size: 1.05rem; }
}

/* ------------------------------------------------------------
   Stats strip
   ------------------------------------------------------------ */

.stats {
  background: var(--bg);
  border-bottom: 1px solid var(--rule);
  padding: 0.7rem 0;
}

.stats-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.55rem;
}

@media (min-width: 560px) {
  .stats-row { gap: 1rem; }
}

.stat {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
  padding: 0.25rem 0;
}

.stat-num {
  font-family: inherit;
  font-weight: 600;
  font-size: 1.3rem;
  color: var(--ink);
  line-height: 1.1;
}

@media (min-width: 720px) {
  .stats { padding: 1.1rem 0; }
  .stat { padding: 0.4rem 0; }
  .stat-num { font-size: 1rem; }
}

.stat-label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  font-weight: 500;
}

@media (min-width: 720px) {
  .stat-label { font-size: 0.78rem; letter-spacing: 0.08em; }
}

/* ------------------------------------------------------------
   Main / chat surface
   ------------------------------------------------------------ */

main#app {
  padding-top: 1.4rem;
  padding-bottom: 1.4rem;
}

#messages {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  margin-bottom: 1rem;
  min-height: 12vh;
}

#messages:empty { min-height: 0; }

/* Empty state — sample queries above the input */
.empty-state {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  padding: 1.1rem 1.1rem 1rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow-sm);
}

.empty-state.is-hidden { display: none; }

.empty-lead {
  margin: 0 0 0.7rem;
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--ink);
}

.empty-lead::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  background: var(--accent);
  margin-right: 0.5rem;
  vertical-align: middle;
  border-radius: 1px;
}

.sample-queries {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.sample {
  text-align: left;
  background: var(--surface-alt);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 0.6rem 0.85rem;
  cursor: pointer;
  font-size: 0.95rem;
  color: var(--ink-soft);
  width: 100%;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}

.sample:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.sample-primary {
  background: #fff7f6;
  border-color: #e8b6b2;
  border-left: 3px solid var(--accent);
  font-weight: 600;
  padding-left: 0.72rem;
}

/* ------------------------------------------------------------
   Messages
   ------------------------------------------------------------ */

.msg {
  padding: 0.85rem 1rem;
  border-radius: var(--radius);
  max-width: 92%;
  word-wrap: break-word;
  overflow-wrap: anywhere;
}

.msg.user {
  align-self: flex-end;
  background: var(--ink);
  color: #fff;
  font-weight: 500;
  white-space: pre-wrap;
}

.msg.assistant {
  align-self: stretch;
  background: var(--surface);
  border: 1px solid var(--rule);
  max-width: 100%;
  box-shadow: var(--shadow-sm);
}

.msg.assistant > *:first-child { margin-top: 0; }
.msg.assistant > *:last-child  { margin-bottom: 0; }
.msg.assistant p              { margin: 0.55rem 0; }
.msg.assistant ul,
.msg.assistant ol             { margin: 0.4rem 0 0.4rem 1.4rem; padding: 0; }
.msg.assistant li             { margin: 0.2rem 0; }
.msg.assistant h1,
.msg.assistant h2,
.msg.assistant h3             { margin: 1rem 0 0.5rem; line-height: 1.25; font-weight: 700; }
.msg.assistant h2             { font-size: 1.15rem; }
.msg.assistant h3             { font-size: 1.0rem; }

.msg.assistant code {
  background: var(--surface-alt);
  padding: 0.1rem 0.32rem;
  border-radius: 4px;
  font-size: 0.88em;
  font-family: inherit;
}
.msg.assistant pre {
  background: var(--surface-alt);
  padding: 0.7rem 0.9rem;
  border-radius: var(--radius-sm);
  overflow-x: auto;
  margin: 0.5rem 0;
  -webkit-overflow-scrolling: touch;
}
.msg.assistant pre code { background: transparent; padding: 0; }
.msg.assistant blockquote {
  border-left: 3px solid var(--rule);
  padding-left: 0.9rem;
  color: var(--muted);
  margin: 0.5rem 0;
}

/* Tables — horizontal scroll on narrow screens */
.msg.assistant table {
  display: block;
  overflow-x: auto;
  white-space: nowrap;
  border-collapse: collapse;
  margin: 0.7rem 0;
  font-size: 0.92rem;
  width: 100%;
  -webkit-overflow-scrolling: touch;
}
.msg.assistant table tbody { white-space: normal; }
.msg.assistant th,
.msg.assistant td {
  border: 1px solid var(--rule);
  padding: 0.45rem 0.65rem;
  text-align: left;
  vertical-align: top;
}
.msg.assistant th {
  background: var(--surface-alt);
  font-weight: 600;
  font-size: 0.84rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
}
.msg.assistant tr:nth-child(even) td { background: var(--surface-alt); }
.msg.assistant a { color: var(--link); }

/* When a chip inside a table is expanded, we inject a full-width row
   below the chip's row containing the entity-card. The card escapes the
   narrow column it would have otherwise been wedged into. */
.msg.assistant table tr.entity-card-row,
.msg.assistant table tr.entity-card-row:nth-child(even) td {
  background: transparent;
}
.msg.assistant table tr.entity-card-row td {
  padding: 0;
  border-top: 0;
  border-bottom: 0;
}
.msg.assistant table tr.entity-card-row .entity-card {
  margin: 0.35rem 0 0.6rem;
}

.msg.error {
  align-self: stretch;
  background: #fff5f5;
  border: 1px solid #f4b4b4;
  color: var(--warn);
}

/* Tool-call ribbon during streaming */
.tools-block {
  align-self: stretch;
  background: var(--surface-alt);
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm);
  padding: 0.45rem 0.75rem;
  font-size: 0.82rem;
  font-family: inherit;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  max-width: 100%;
}
.tools-block:empty { display: none; }
.tool-line { display: flex; align-items: center; gap: 0.4rem; }
.tool-line-running { color: var(--accent); }
.tool-line-running::before { content: "▸ "; color: var(--accent); }
.tool-line-running::after  { content: "…"; color: var(--accent); }
.tool-line-done { color: var(--ok); }
.tool-line-done::before { content: "✓ "; color: var(--ok); }

/* Streaming cursor — slow, soft pulse rather than a fast blink */
.msg.assistant.streaming::after {
  content: "▌";
  display: inline-block;
  margin-left: 2px;
  color: var(--accent);
  animation: pulse 1.6s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 0.15; }
  50%      { opacity: 0.75; }
}

/* ------------------------------------------------------------
   Entity chips
   ------------------------------------------------------------ */

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.05rem 0.55rem;
  margin: 0 0.1rem;
  font-family: inherit;
  font-size: 0.92em;
  font-weight: 500;
  background: var(--surface-alt);
  color: var(--ink);
  border: 1px solid var(--rule);
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.1s, border-color 0.1s, color 0.1s;
  vertical-align: baseline;
  line-height: 1.4;
}
.chip:hover { background: var(--accent); border-color: var(--accent); color: #fff; }
.chip-case        { background: #ecf0fb; color: #1f4dbf; border-color: #cfdcff; }
.chip-defendant   { background: #f1ecff; color: #5b3bbf; border-color: #d8c8ff; }
.chip-legislator  { background: #ecfbf3; color: #1a7f37; border-color: #b6efce; }
.chip-case:hover       { background: #1f4dbf; border-color: #1f4dbf; color: #fff; }
.chip-defendant:hover  { background: #5b3bbf; border-color: #5b3bbf; color: #fff; }
.chip-legislator:hover { background: #1a7f37; border-color: #1a7f37; color: #fff; }
.chip-case.chip-open       { background: #1f4dbf; color: #fff; border-color: #1f4dbf; }
.chip-defendant.chip-open  { background: #5b3bbf; color: #fff; border-color: #5b3bbf; }
.chip-legislator.chip-open { background: #1a7f37; color: #fff; border-color: #1a7f37; }
.chip-loading::after {
  content: " ⟳";
  animation: spin 0.9s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Expandable entity card */
.entity-card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm);
  padding: 0.85rem 1.05rem;
  margin: 0.6rem 0;
  font-size: 0.93rem;
  box-shadow: var(--shadow-sm);
}
.entity-card.entity-card-error {
  border-left-color: var(--warn);
  color: var(--warn);
}
.entity-card .card-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.45rem;
  flex-wrap: wrap;
}
.entity-card h3 {
  margin: 0;
  font-size: 1.0rem;
  font-weight: 700;
}
.entity-card h4 {
  margin: 0.7rem 0 0.3rem;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}
.entity-card .card-type {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
  background: var(--surface-alt);
  padding: 0.12rem 0.55rem;
  border-radius: 999px;
}
.entity-card .card-grid {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.18rem 0.7rem;
  margin: 0;
  font-size: 0.9rem;
}
.entity-card dt { color: var(--muted); }
.entity-card dd { margin: 0; }
.entity-card .card-table {
  display: block;
  overflow-x: auto;
  white-space: nowrap;
  width: 100%;
  border-collapse: collapse;
  font-size: 0.86rem;
  margin: 0.25rem 0 0.45rem;
  -webkit-overflow-scrolling: touch;
}
.entity-card .card-table th,
.entity-card .card-table td {
  border-bottom: 1px solid var(--rule-soft);
  padding: 0.32rem 0.5rem;
  text-align: left;
  vertical-align: top;
}
.entity-card .card-table th {
  background: var(--surface-alt);
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  font-weight: 600;
}
.entity-card .card-summary {
  margin: 0.35rem 0 0;
  color: var(--ink);
  white-space: pre-wrap;
}
.entity-card .chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin: 0.35rem 0;
}

/* ------------------------------------------------------------
   Inline charts and maps
   ------------------------------------------------------------ */

.chart-block,
.map-block {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 0.85rem 1rem 1rem;
  margin: 0.7rem 0;
  box-shadow: var(--shadow-sm);
}
.chart-title,
.map-title {
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  color: var(--ink);
}
.chart-canvas-wrap {
  position: relative;
  width: 100%;
  height: 320px;
}
@media (max-width: 560px) {
  .chart-canvas-wrap { height: 240px; }
}
.map-canvas {
  width: 100%;
  height: 360px;
  border-radius: var(--radius-sm);
  overflow: hidden;
}
@media (max-width: 560px) {
  .map-canvas { height: 280px; }
}
.chart-error {
  color: var(--warn);
  font-family: inherit;
  font-size: 0.85rem;
}
.leaflet-popup-content button.chip { margin-top: 0.3rem; }

/* ------------------------------------------------------------
   Follow-ups
   ------------------------------------------------------------ */

.followups {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0.85rem 0 0.2rem;
  align-items: center;
}
.followups-label {
  font-size: 0.74rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-right: 0.2rem;
  font-weight: 500;
}
.followup {
  border: 1px solid var(--rule);
  background: var(--surface);
  color: var(--ink-soft);
  padding: 0.35rem 0.75rem;
  font-size: 0.88rem;
  border-radius: 999px;
  cursor: pointer;
  text-align: left;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}
.followup:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* ------------------------------------------------------------
   Cache tag, status
   ------------------------------------------------------------ */



/* Entrance bot-check card — visible managed Turnstile widget. Sits
   above the empty-state until the user passes it; then it disappears
   for the remainder of the session (cookie-backed, ~30 min). */
.gate {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  padding: 0.9rem 1rem 0.85rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}
.gate.is-hidden { display: none; }
.gate-lead {
  margin: 0;
  font-size: 0.92rem;
  color: var(--ink-soft);
  font-weight: 500;
}
#turnstile-host { min-height: 65px; }

#status {
  margin-top: 0.6rem;
  font-size: 0.85rem;
  color: var(--muted);
  min-height: 1.2em;
}

/* ------------------------------------------------------------
   Chat input form
   ------------------------------------------------------------ */

#chatform {
  display: flex;
  gap: 0.5rem;
  align-items: stretch;
}

#chatform input {
  flex: 1;
  min-width: 0;
  padding: 0.85rem 1rem;
  font-size: 1rem;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  -webkit-appearance: none;
  appearance: none;
}

#chatform input:focus {
  outline: 2px solid var(--accent-tint);
  border-color: var(--accent);
}

#chatform button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  min-width: 56px;
  min-height: 44px;
  padding: 0 1.2rem;
  background: var(--accent);
  color: #fff;
  border: 0;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  transition: background 0.12s;
}

#chatform button:hover:not(:disabled) { background: var(--accent-hot); }
#chatform button:disabled { opacity: 0.5; cursor: not-allowed; }

.send-arrow { display: none; }

@media (max-width: 480px) {
  .send-label { display: none; }
  .send-arrow { display: inline-block; }
  #chatform button { padding: 0; min-width: 50px; }
}

/* ------------------------------------------------------------
   Footer
   ------------------------------------------------------------ */

.site-foot {
  border-top: 1px solid var(--rule);
  background: var(--bg);
  padding: 1.3rem 0 1.6rem;
  margin-top: 1.5rem;
  font-size: 0.82rem;
  color: var(--muted);
}
.site-foot p { margin: 0; max-width: 60ch; }
.site-foot strong { color: var(--ink); font-weight: 600; }

/* ============================================================
   Mobile (<= 640px) — table-as-cards + condensed chrome
   ============================================================ */

@media (max-width: 640px) {

  /* Sticky chat input once the conversation is active. The user
     shouldn't have to scroll back up to ask another question after a
     long reply. Stays in the document flow on the empty state so the
     hero doesn't feel chopped. */
  body.has-messages #chatform {
    position: sticky;
    bottom: 0;
    z-index: 10;
    margin: 0 -1.1rem;
    padding: 0.75rem 1.1rem 0.7rem;
    background: rgba(250, 250, 247, 0.94);
    backdrop-filter: saturate(180%) blur(6px);
    -webkit-backdrop-filter: saturate(180%) blur(6px);
    border-top: 1px solid var(--rule);
  }
  body.has-messages main#app { padding-bottom: 0.5rem; }

  /* Tool-call ribbon on mobile: collapse to just the latest activity
     line; tap to expand the full history. Saves vertical space and
     reduces visual noise during a long tool chain. */
  .tools-block {
    cursor: pointer;
    position: relative;
    padding-right: 1.6rem;
  }
  .tools-block::after {
    content: "▾";
    position: absolute;
    right: 0.6rem;
    top: 0.5rem;
    color: var(--muted);
    font-size: 0.75rem;
    line-height: 1;
  }
  .tools-block .tool-line { display: none; }
  .tools-block .tool-line:last-child { display: flex; }
  .tools-block.expanded .tool-line { display: flex; }
  .tools-block.expanded::after { content: "▴"; }

  /* Once the conversation is active, collapse the tagline to reclaim
     vertical space. The brand+stats stay so the user always knows
     where they are. */
  body.has-messages .tagline { display: none; }
  body.has-messages .site-head { padding: 1rem 0 0.9rem; }
  body.has-messages .stats { padding: 0.75rem 0; }
  body.has-messages .stat-num { font-size: 1.25rem; }
  body.has-messages .stats-row { grid-template-columns: repeat(3, 1fr); gap: 0.6rem; }
  body.has-messages .stat { padding: 0.1rem 0; }
  body.has-messages .stat-label { font-size: 0.7rem; letter-spacing: 0.06em; }

  /* Tighter overall message column on mobile */
  .msg.assistant { padding: 0.85rem 0.85rem; }

  /* The headline change: tables become stacked label-value cards. */
  .msg.assistant table {
    display: block;
    overflow: visible;
    white-space: normal;
    border: 0;
    margin: 0.65rem -0.35rem;
    width: calc(100% + 0.7rem);
    font-size: 0.9rem;
  }
  .msg.assistant table thead { display: none; }
  .msg.assistant table tbody { display: block; }
  .msg.assistant table tr {
    display: block;
    background: var(--surface);
    border: 1px solid var(--rule);
    border-radius: var(--radius-sm);
    margin: 0 0 0.5rem;
    padding: 0.7rem 0.85rem;
    box-shadow: var(--shadow-sm);
  }
  .msg.assistant table tr:nth-child(even) td { background: transparent; }

  /* Each <td> is a label/value row. The first cell (usually the entity
     chip / row title) gets emphasis treatment with no label. */
  .msg.assistant table td {
    display: grid;
    grid-template-columns: 88px 1fr;
    column-gap: 0.7rem;
    align-items: baseline;
    padding: 0.3rem 0;
    border: 0;
    border-bottom: 1px dashed var(--rule-soft);
    background: transparent;
    text-align: left;
    white-space: normal;
    /* `break-word` only breaks long words that genuinely can't fit; it does
       NOT split short multi-word values like "San Francisco, CA" letter-by-
       letter. The previous `anywhere` was breaking every value to a new
       line per character on narrow viewports. */
    overflow-wrap: break-word;
    word-break: normal;
  }
  .msg.assistant table td:last-child { border-bottom: 0; padding-bottom: 0; }

  /* Mobile: the entity-card-row tr loses its block-card chrome and lays
     out the entity-card flush at full width. */
  .msg.assistant table tr.entity-card-row {
    display: block;
    background: transparent;
    border: 0;
    padding: 0;
    margin: 0 0 0.5rem;
    box-shadow: none;
  }
  .msg.assistant table tr.entity-card-row td {
    display: block;
    grid-template-columns: none;
    padding: 0;
    border: 0;
  }
  .msg.assistant table tr.entity-card-row td::before { content: none; }

  .msg.assistant table td::before {
    content: attr(data-label);
    font-size: 0.66rem;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--muted);
    font-weight: 600;
    line-height: 1.4;
  }

  /* First cell = row title. Suppress label, full-width, bold. */
  .msg.assistant table tr > td:first-child {
    display: block;
    margin: -0.1rem 0 0.5rem;
    padding: 0 0 0.55rem;
    border-bottom: 1px solid var(--rule);
    font-weight: 600;
    font-size: 0.98rem;
  }
  .msg.assistant table tr > td:first-child::before { display: none; }

  /* Chips inside cards: full breathing room, no mid-word wrapping */
  .msg.assistant table td .chip {
    max-width: 100%;
    white-space: normal;
    line-height: 1.35;
    padding: 0.15rem 0.65rem;
  }

  /* Plain text cells with very long values still respect column width */
  .msg.assistant table td:not(:first-child) > * { min-width: 0; }
}

@media (max-width: 480px) {
  /* Even tighter on phones: stack stat row labels under big numbers
     stays as 3 columns but slightly compressed. Single send-icon CTA
     was already handled in the base styles. */
  .stat-num { font-size: 1.4rem; }
  .container { padding: 0 0.85rem; }
  .empty-state { padding: 0.95rem; }
  .empty-lead { font-size: 1.0rem; }
  .sample { font-size: 0.92rem; padding: 0.55rem 0.75rem; }
  .msg.assistant { padding: 0.75rem 0.7rem; }
  .msg.assistant table { margin-left: -0.25rem; margin-right: -0.25rem; width: calc(100% + 0.5rem); }
  .msg.assistant table tr { padding: 0.6rem 0.75rem; }
  .msg.assistant table td { grid-template-columns: 76px 1fr; column-gap: 0.55rem; }
}

.research-nav { display:flex; gap:1rem; align-items:center; flex-wrap:wrap; margin-top:1rem; font-size:.85rem; }
.research-nav button { margin-left:auto; padding:.35rem .65rem; border:1px solid var(--accent); border-radius:4px; color:var(--accent); background:white; cursor:pointer; }
.research-nav button:disabled { opacity:.5; cursor:wait; }
.research-nav a:focus-visible, .research-nav button:focus-visible { outline:3px solid #e7a12f; outline-offset:4px; }
@media(max-width:480px) { .research-nav { gap:.6rem 1rem; } .research-nav button { margin-left:0; } }

/* Keep coverage with the figures and data use with the question field. */
.coverage-note{font-size:.78rem;line-height:1.5;color:var(--muted);margin-top:.85rem;margin-bottom:0}
.coverage-note a,.composer-note a{color:var(--accent);text-underline-offset:3px}
.composer-note{font-size:.76rem;line-height:1.5;color:var(--muted);margin:.65rem 0 .5rem;max-width:90ch}
.site-foot p+p{margin-top:.6rem}

/* Short explanations share the main site's quiet navy typography. */
.brand-name, .empty-lead, .msg h2, .msg h3 { font-family: "Avenir Next", "Trebuchet MS", Arial, sans-serif; }
.stats summary { color: var(--muted); font-size: .82rem; cursor: pointer; }
.stats .stats-row { padding-top: .6rem; }
.stat-num { font-size: 1rem; }
.answer-actions { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: 1rem; padding-top: .8rem; border-top: 1px solid var(--rule); }
.answer-actions button { border: 1px solid #a9c6d8; border-radius: 5px; padding: .45rem .65rem; background: #eef5fa; color: var(--ink); cursor: pointer; font-size: .78rem; }
.answer-actions button:focus-visible { outline: 3px solid #cb541f; outline-offset: 3px; }
