/* ===========================================================
   Marketing AI · workspace
   Light, warm, marketing-friendly. Mobile-first responsive.
   =========================================================== */

:root {
  /* Surfaces — warm off-white paper, not stark white */
  --bg:        #fbf7ed;
  --bg2:       #ffffff;
  --bg3:       #f5efe0;
  --bg4:       #fdfaf2;
  --line:      #e8e0cd;
  --line-2:    #d6cbb1;
  --line-3:    #b8ab8c;
  --text:      #211f1a;
  --mute:      #6e695f;
  --faint:     #98927f;
  --ghost:     #b8b09a;

  /* Per-agent accents — soft, marketing-friendly */
  --c-clm:        #b85a3a;
  --c-clm-soft:   #f3d9c5;
  --c-paid:       #2a5b85;
  --c-paid-soft:  #c9dbe9;
  --c-ecomm:      #7a5418;
  --c-ecomm-soft: #e8dcb9;
  --c-analysis:   #2f6a4a;
  --c-analysis-soft: #cee2d4;

  --c-ok:   #2f6a4a;
  --c-warn: #b78420;
  --c-err:  #b54a44;

  --shadow-sm: 0 1px 2px rgba(31, 25, 12, 0.04);
  --shadow:    0 1px 3px rgba(31, 25, 12, 0.06), 0 4px 12px rgba(31, 25, 12, 0.04);
  --shadow-lg: 0 4px 20px rgba(31, 25, 12, 0.08);

  --radius:    8px;
  --radius-sm: 5px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 'Geist', system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}

.mono {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 12.5px;
  font-feature-settings: 'tnum' 1;
}

button { font: inherit; cursor: pointer; }

.shell {
  max-width: 1320px;
  margin: 0 auto;
  padding: 22px 24px 80px;
}

/* ===========================================================
   Topbar
   =========================================================== */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 0 18px;
  border-bottom: 1px solid var(--line);
  gap: 16px;
  flex-wrap: wrap;
}
.topbar__brand { display: flex; align-items: center; gap: 12px; }
.topbar__brand-mark { display: inline-flex; width: 26px; height: 26px; color: var(--text); }
.topbar__brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.topbar__brand-line1 {
  font-family: 'Inter Tight', 'Geist', system-ui, sans-serif;
  font-weight: 900;
  font-size: 28px;
  letter-spacing: -0.005em;
  line-height: 0.95;
}
.topbar__brand-line2 {
  font-family: 'Inter Tight', 'Geist', system-ui, sans-serif;
  font-weight: 500;
  font-size: 11.5px;
  color: var(--mute);
  margin-top: 4px;
  letter-spacing: 0.08em;
  text-transform: lowercase;
}

.topbar__meta {
  display: flex; gap: 14px; align-items: baseline; flex-wrap: wrap;
  font-size: 12px;
  color: var(--mute);
}
.topbar__meta .k { color: var(--faint); margin-right: 5px; }
.topbar__meta .v { color: var(--text); font-weight: 500; }
.topbar__meta .dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--c-ok); margin-right: 6px; vertical-align: 1px; }
.topbar__meta .dot.off { background: var(--c-err); }

/* ===========================================================
   Tabs — scrollable on mobile
   =========================================================== */

.tabs {
  display: flex;
  gap: 8px;
  padding: 18px 0 0;
  margin-bottom: 22px;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.tabs::-webkit-scrollbar { display: none; }

.tab {
  background: var(--bg2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 18px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  align-items: center;
  text-align: left;
  color: var(--text);
  flex: 1 1 auto;
  min-width: 180px;
  transition: all 0.16s ease;
  box-shadow: var(--shadow-sm);
}
.tab:hover {
  border-color: var(--line-2);
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}
.tab.is-active {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: var(--shadow);
}

.tab__num {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  color: var(--faint);
  width: 24px;
  text-align: center;
  letter-spacing: 0.04em;
}
.tab.is-active .tab__num { color: var(--accent); }

.tab__title { min-width: 0; }
.tab__title-main {
  font-size: 14.5px;
  font-weight: 600;
  letter-spacing: -0.005em;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tab__title-dek {
  font-size: 11.5px;
  color: var(--mute);
  margin-top: 1px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tab__status {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--faint);
  font-weight: 500;
}
.tab__status-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--faint);
  flex-shrink: 0;
}
.tab.is-live .tab__status-dot {
  background: var(--accent);
  box-shadow: 0 0 0 0 var(--accent);
  animation: pulse 2.4s ease-in-out infinite;
}
.tab.is-preview .tab__status-dot {
  background: transparent;
  border: 1px solid var(--ghost);
  width: 6px; height: 6px;
}
.tab.is-live .tab__status { color: var(--accent); }

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(0,0,0,0); }
  50%      { box-shadow: 0 0 0 5px rgba(184, 90, 58, 0.12); }
}

/* Per-agent accent vars */
.tab[data-agent="clm"]      { --accent: var(--c-clm);      --accent-soft: var(--c-clm-soft); }
.tab[data-agent="paid"]     { --accent: var(--c-paid);     --accent-soft: var(--c-paid-soft); }
.tab[data-agent="ecomm"]    { --accent: var(--c-ecomm);    --accent-soft: var(--c-ecomm-soft); }
.tab[data-agent="analysis"] { --accent: var(--c-analysis); --accent-soft: var(--c-analysis-soft); }

.workspace[data-agent="clm"]      { --accent: var(--c-clm);      --accent-soft: var(--c-clm-soft); }
.workspace[data-agent="paid"]     { --accent: var(--c-paid);     --accent-soft: var(--c-paid-soft); }
.workspace[data-agent="ecomm"]    { --accent: var(--c-ecomm);    --accent-soft: var(--c-ecomm-soft); }
.workspace[data-agent="analysis"] { --accent: var(--c-analysis); --accent-soft: var(--c-analysis-soft); }

/* ===========================================================
   Workspace layout
   =========================================================== */

.workspace {
  display: grid;
  grid-template-columns: 1.45fr 1fr;
  gap: 22px;
  align-items: start;
}
.col { display: flex; flex-direction: column; gap: 18px; min-width: 0; }

.panel {
  background: var(--bg2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.panel__head {
  padding: 12px 18px;
  border-bottom: 1px solid var(--line);
  background: var(--bg4);
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
}
.panel__title {
  font-size: 12px;
  color: var(--mute);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 600;
}
.panel__hint {
  font-size: 11.5px;
  color: var(--faint);
}

/* ===========================================================
   Agent head card
   =========================================================== */

.agent-head {
  padding: 22px 24px 20px;
  background: var(--bg2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: flex; flex-wrap: wrap; gap: 16px;
  align-items: flex-start; justify-content: space-between;
  box-shadow: var(--shadow-sm);
  border-left: 4px solid var(--accent);
}
.agent-head__text { flex: 1 1 320px; min-width: 0; }
.agent-head__title {
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -0.015em;
  line-height: 1.15;
  margin: 0 0 6px;
}
.agent-head__title em { font-style: normal; color: var(--accent); font-weight: 600; }
.agent-head__deck {
  font-size: 14px;
  line-height: 1.5;
  color: var(--mute);
  margin: 0;
  max-width: 640px;
}
.agent-head__badge {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 12px 6px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg4);
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 600;
  color: var(--mute);
  white-space: nowrap;
  flex-shrink: 0;
}
.agent-head__badge.is-live {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-soft);
}
.agent-head__badge .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--faint);
}
.agent-head__badge.is-live .dot {
  background: var(--accent);
  animation: pulse 2.4s ease-in-out infinite;
}

/* ===========================================================
   Prompt input — bigger, more inviting
   =========================================================== */

.prompt-area { padding: 18px 18px 14px; }

.prompt-area textarea {
  width: 100%;
  min-height: 92px;
  resize: vertical;
  background: var(--bg4);
  color: var(--text);
  font: 16px/1.5 'Geist', system-ui, sans-serif;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  outline: none;
  transition: border-color 0.16s;
}
.prompt-area textarea:focus { border-color: var(--accent); }
.prompt-area textarea::placeholder { color: var(--faint); }

.examples {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-top: 14px;
}
.example {
  background: var(--bg4);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  font-size: 13px;
  line-height: 1.4;
  text-align: left;
  font-family: 'Geist', sans-serif;
  display: flex; justify-content: space-between; align-items: center;
  gap: 10px;
  transition: all 0.16s;
}
.example:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}
.example__arrow {
  color: var(--accent);
  font-size: 16px;
  flex-shrink: 0;
}

.actions { display: flex; gap: 8px; align-items: center; justify-content: flex-end; margin-top: 14px; }
button.run {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 11px 22px;
  border-radius: var(--radius-sm);
  font: 600 14px 'Geist', sans-serif;
  letter-spacing: -0.005em;
  transition: all 0.16s;
  box-shadow: var(--shadow-sm);
}
button.run:hover:not(:disabled) {
  filter: brightness(1.06);
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}
button.run:disabled { background: var(--line-2); color: var(--bg2); cursor: not-allowed; }
button.reset {
  background: transparent;
  color: var(--mute);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  font-size: 12.5px;
  font-family: 'Geist', sans-serif;
}
button.reset:hover { color: var(--c-err); border-color: var(--c-err); }

/* ===========================================================
   Activity (what the agent is doing) — friendly trace
   =========================================================== */

.activity {
  padding: 0;
}
.activity__empty {
  padding: 24px;
  color: var(--faint);
  font-size: 14px;
  font-style: italic;
  line-height: 1.5;
}

.act-step {
  padding: 12px 20px;
  border-bottom: 1px solid var(--line);
  display: grid;
  grid-template-columns: 28px 1fr auto;
  gap: 14px;
  align-items: center;
}
.act-step:last-child { border-bottom: none; }

.act-step__icon {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--bg4);
  border: 1.5px solid var(--line-2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  color: var(--mute);
}
.act-step.is-running .act-step__icon {
  border-color: var(--accent);
  background: var(--accent-soft);
  animation: spin 1.4s linear infinite;
}
.act-step.is-done .act-step__icon {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.act-step.is-done .act-step__icon::after { content: '✓'; font-size: 12px; }
.act-step.is-error .act-step__icon {
  background: var(--c-err);
  border-color: var(--c-err);
  color: #fff;
}
.act-step.is-error .act-step__icon::after { content: '!'; font-weight: 700; }

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

.act-step__body { min-width: 0; }
.act-step__title {
  font-size: 14px;
  color: var(--text);
  font-weight: 500;
  line-height: 1.35;
}
.act-step__detail {
  font-size: 12.5px;
  color: var(--mute);
  margin-top: 1px;
  word-break: break-word;
}
.act-step__detail .mono {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11.5px;
  color: var(--mute);
}
.act-step__detail.result {
  color: var(--text);
}

.act-step__technical {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--mute);
  background: var(--bg4);
  padding: 8px 12px;
  margin-top: 6px;
  border-radius: var(--radius-sm);
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 8em;
  overflow-y: auto;
  display: none;
}
.act-step.show-tech .act-step__technical { display: block; }

.act-step__expand {
  background: transparent;
  border: none;
  color: var(--faint);
  font-size: 11px;
  padding: 2px 6px;
  align-self: start;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.act-step__expand:hover { color: var(--text); }

/* ===========================================================
   Response — the agent's actual output
   =========================================================== */

.response {
  padding: 22px 26px;
  font-size: 15.5px;
  line-height: 1.6;
  color: var(--text);
  min-height: 120px;
}
.response.empty { color: var(--faint); font-style: italic; min-height: 60px; padding: 20px 24px; }
.response p { margin: 0 0 12px; }
.response ul, .response ol { padding-left: 22px; margin: 0 0 12px; }
.response li { margin-bottom: 5px; }
.response strong { color: var(--text); font-weight: 600; }
.response code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 1px 6px;
  border-radius: 3px;
}
.response h1, .response h2, .response h3, .response h4 {
  color: var(--text); margin: 18px 0 8px; font-weight: 600; letter-spacing: -0.012em;
}
.response h1 { font-size: 20px; }
.response h2 { font-size: 17px; }
.response h3 { font-size: 14px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--mute); font-weight: 600; }
.response h4 { font-size: 15px; }
.response table {
  border-collapse: collapse;
  margin: 10px 0 16px;
  font-size: 13.5px;
  font-family: 'JetBrains Mono', monospace;
  width: 100%;
}
.response th, .response td {
  border-bottom: 1px solid var(--line);
  padding: 8px 14px 8px 0;
  text-align: left;
}
.response th {
  color: var(--mute);
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.1em;
  font-weight: 600;
}
.response hr { border: none; border-top: 1px solid var(--line); margin: 18px 0; }
.response blockquote { border-left: 3px solid var(--accent); padding-left: 14px; color: var(--mute); margin: 8px 0; }

.cursor {
  display: inline-block; width: 8px; height: 17px; vertical-align: -3px;
  background: var(--accent); margin-left: 2px;
  animation: blink 1s steps(2) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

/* ===========================================================
   Stats footer + error
   =========================================================== */

.stats {
  padding: 11px 20px;
  border-top: 1px solid var(--line);
  background: var(--bg4);
  font-size: 12px;
  color: var(--mute);
  display: flex; gap: 18px; flex-wrap: wrap;
  align-items: baseline;
}
.stats .k { color: var(--faint); text-transform: uppercase; letter-spacing: 0.08em; margin-right: 4px; font-size: 10.5px; font-weight: 600; }
.stats .v { color: var(--text); font-family: 'JetBrains Mono', monospace; font-size: 12px; }

.err-box {
  padding: 14px 20px;
  background: #fceae8;
  border-top: 1px solid var(--c-err);
  color: var(--c-err);
  font-size: 13px;
  line-height: 1.5;
}

/* ===========================================================
   Thinking dots
   =========================================================== */

.thinking {
  display: inline-flex; gap: 5px; align-items: center; padding: 4px 0;
}
.thinking span {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0.4;
  animation: bounceDot 1.2s ease-in-out infinite;
}
.thinking span:nth-child(2) { animation-delay: 0.15s; }
.thinking span:nth-child(3) { animation-delay: 0.3s; }
@keyframes bounceDot {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.35; }
  40%           { transform: translateY(-4px); opacity: 1; }
}

/* ===========================================================
   Right-column context panels
   =========================================================== */

.kv-grid {
  padding: 16px 20px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px 24px;
}
.kv-group .ttl {
  color: var(--mute);
  text-transform: uppercase;
  font-size: 10.5px;
  letter-spacing: 0.1em;
  margin-bottom: 6px;
  font-weight: 600;
}
.kv-group .row {
  display: flex; justify-content: space-between;
  color: var(--text); padding: 3px 0;
  font-size: 13px;
}
.kv-group .row > span:first-child { color: var(--mute); }
.kv-group .row .v {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12.5px;
  font-weight: 500;
}

.sends { padding: 6px 0; }
.sends__row {
  padding: 12px 20px;
  border-bottom: 1px solid var(--line);
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: baseline;
}
.sends__row:last-child { border-bottom: none; }
.sends__row__main { min-width: 0; }
.sends__name {
  font-size: 13.5px;
  color: var(--text);
  font-weight: 500;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sends__date {
  font-family: 'JetBrains Mono', monospace;
  color: var(--faint);
  font-size: 11px;
  margin-top: 2px;
}
.sends__count {
  font-family: 'JetBrains Mono', monospace;
  color: var(--accent);
  font-weight: 600;
  font-size: 13px;
  text-align: right;
}
.sends__count-label {
  display: block;
  font-size: 10px;
  color: var(--faint);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 600;
  margin-top: 1px;
}

.totals {
  padding: 18px 22px 14px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px 28px;
}
.totals .ttl {
  color: var(--mute);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 4px;
  font-weight: 600;
}
.totals .val {
  color: var(--text);
  font-family: 'JetBrains Mono', monospace;
  font-size: 20px;
  font-weight: 500;
  letter-spacing: -0.01em;
}
.totals .sub {
  color: var(--faint);
  font-size: 11.5px;
  margin-top: 2px;
}

.systems-list { padding: 4px 0; }
.systems-list .sys {
  padding: 14px 20px;
  border-bottom: 1px solid var(--line);
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 18px;
  align-items: baseline;
}
.systems-list .sys:last-child { border-bottom: none; }
.systems-list .sys .role {
  color: var(--mute);
  text-transform: uppercase;
  font-size: 10.5px;
  letter-spacing: 0.1em;
  font-weight: 600;
}
.systems-list .sys .platforms {
  color: var(--text);
  font-size: 14px;
  line-height: 1.35;
}

.broadband-callout {
  padding: 20px 22px;
  background: var(--accent-soft);
  border-top: 1px solid var(--accent);
}
.broadband-callout__label {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
  margin-bottom: 10px;
  font-weight: 700;
}
.broadband-callout__title {
  font-size: 16px;
  font-weight: 600;
  margin: 0 0 14px;
  letter-spacing: -0.012em;
  color: var(--text);
}
.broadband-callout ul {
  margin: 0; padding: 0; list-style: none;
}
.broadband-callout li {
  display: grid;
  grid-template-columns: 84px 1fr;
  gap: 14px;
  padding: 5px 0;
  font-size: 13px;
  color: var(--text);
  line-height: 1.45;
}
.broadband-callout li .mono {
  color: var(--accent);
  font-family: 'JetBrains Mono', monospace;
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.preview-note {
  padding: 18px 22px;
  font-size: 13.5px;
  color: var(--mute);
  line-height: 1.6;
}
.preview-note strong { color: var(--text); font-weight: 600; }
.preview-note code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12.5px;
  background: var(--bg3);
  padding: 1px 6px;
  border-radius: 3px;
  color: var(--text);
}

/* ===========================================================
   Mobile / tablet responsive
   =========================================================== */

@media (max-width: 900px) {
  .shell { padding: 16px 16px 60px; }

  .topbar { padding-bottom: 14px; row-gap: 8px; }
  .topbar__brand-line1 { font-size: 22px; }
  .topbar__brand-line2 { font-size: 11.5px; margin-top: 2px; }
  .topbar__meta { gap: 12px; font-size: 11.5px; }
  .hide-narrow { display: none !important; }

  /* Sticky tabs so chapter switching survives scrolling on long pages */
  .tabs {
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--bg);
    padding-top: 10px;
    padding-bottom: 10px;
    margin: 0 -16px 12px;
    padding-left: 16px;
    padding-right: 16px;
    border-bottom: 1px solid var(--line);
  }
  .tab { min-width: 180px; flex: 0 0 auto; padding: 11px 13px; }
  .tab__title-main { font-size: 13.5px; }

  .workspace { grid-template-columns: 1fr; gap: 14px; }

  .agent-head { padding: 18px 18px 16px; }
  .agent-head__title { font-size: 21px; }
  .agent-head__deck { font-size: 14px; }

  .prompt-area { padding: 14px 14px 12px; display: flex; flex-direction: column; }
  .prompt-area textarea { min-height: 80px; max-height: 200px; font-size: 16px; padding: 12px 14px; }

  /* On mobile, reorder so Run sits right under the textarea (visible above
     the keyboard) and the example chips drop below. Default DOM order is
     textarea → examples → actions, which puts Run under a tall chip list
     and often under the on-screen keyboard. */
  .prompt-area .actions { order: 1; margin-top: 12px; justify-content: stretch; }
  .prompt-area .examples { order: 2; grid-template-columns: 1fr; gap: 6px; margin-top: 14px; }
  .example { padding: 13px 14px; font-size: 14px; }

  button.run { flex: 1; padding: 14px 18px; font-size: 16px; font-weight: 600; min-height: 48px; border-radius: 10px; }
  button.reset { padding: 11px 14px; }

  .response { padding: 18px 18px; font-size: 15px; }
  .response h1 { font-size: 18px; }
  .response h2 { font-size: 16px; }

  /* Wide markdown tables become horizontally scrollable — the agent
     produces dense campaign tables that would otherwise overflow. */
  .response table {
    display: block;
    overflow-x: auto;
    max-width: 100%;
    font-size: 12.5px;
    -webkit-overflow-scrolling: touch;
  }
  .response th, .response td { white-space: nowrap; padding: 8px 10px 8px 0; }

  .act-step { padding: 12px 16px; grid-template-columns: 24px 1fr auto; gap: 12px; }
  .act-step__title { font-size: 13.5px; }
  .act-step__technical { display: none !important; } /* hide the JSON entirely on mobile */
  .act-step__expand { display: none; }

  .kv-grid { padding: 14px 16px; grid-template-columns: 1fr; gap: 14px; }
  .totals { padding: 16px 18px 12px; grid-template-columns: 1fr 1fr; }
  .totals .val { font-size: 18px; }
  .systems-list .sys { padding: 12px 16px; grid-template-columns: 90px 1fr; gap: 12px; font-size: 13px; }
  .systems-list .sys .platforms { font-size: 13.5px; }
  .broadband-callout { padding: 16px 18px; }
  .broadband-callout li { grid-template-columns: 70px 1fr; font-size: 12.5px; }

  .stats { padding: 11px 16px; gap: 14px; font-size: 11.5px; }
  .panel__head { padding: 11px 16px; }
}

@media (max-width: 520px) {
  .shell { padding: 12px 12px 56px; }

  .topbar { gap: 10px; }
  .topbar__brand-line1 { font-size: 20px; }
  .topbar__brand-line2 { font-size: 11px; margin-top: 2px; }
  .topbar__meta { gap: 10px; font-size: 11px; }

  /* On phones drop the chapter dek so the four tabs are more compact. */
  .tabs { margin-left: -12px; margin-right: -12px; padding-left: 12px; padding-right: 12px; }
  .tab { min-width: 150px; padding: 10px 12px; grid-template-columns: 1fr auto; gap: 8px; }
  .tab__num { display: none; }
  .tab__title-dek { display: none; }
  .tab__title-main { font-size: 13px; }
  .tab__status { font-size: 10px; letter-spacing: 0.08em; }

  .agent-head { padding: 16px 16px 14px; }
  .agent-head__title { font-size: 19px; }
  .agent-head__badge { padding: 5px 10px 5px 9px; font-size: 10.5px; }

  .response { padding: 16px 16px; font-size: 14.5px; }
  .response th, .response td { padding: 7px 9px 7px 0; }

  .totals { grid-template-columns: 1fr; }
  .examples { grid-template-columns: 1fr; }

  .stats { gap: 10px; }
  .stats .v { font-size: 11.5px; }
}
