/* =========================================================
   Executive Data Interpreter — design system
   ========================================================= */

:root {
  --navy-900: #0B2141;
  --navy-800: #10305C;
  --navy-700: #17406F;
  --ink-900: #0E1B2E;
  --ink-700: #33445C;
  --ink-500: #5D6E86;
  --ink-400: #8494A8;

  --blue-600: #2563EB;
  --blue-500: #3B82F6;
  --blue-100: #E6EEFC;
  --blue-050: #F2F6FE;

  --teal-600: #0E9F87;
  --teal-500: #14B8A6;
  --amber-500: #F59E0B;
  --amber-050: #FEF4E3;
  --rose-500: #E05252;
  --green-600: #15925F;

  --page: #F4F6FA;
  --surface: #FFFFFF;
  --surface-alt: #F8FAFD;
  --line: #E3E8F0;
  --line-strong: #D3DBE7;

  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 8px;

  --shadow-card: 0 1px 2px rgba(14, 27, 46, .05), 0 6px 18px -12px rgba(14, 27, 46, .18);
  --shadow-pop: 0 8px 28px -10px rgba(14, 27, 46, .28);

  --font: "Inter", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --font-num: "SF Mono", "Roboto Mono", ui-monospace, "Cascadia Mono", Menlo, monospace;

  --series-1: #2563EB;
  --series-2: #14B8A6;
  --series-3: #F59E0B;
  --series-4: #8B5CF6;
  --series-5: #E05252;
  --series-6: #0EA5E9;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
}

body {
  background: var(--page);
  color: var(--ink-900);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: -0.012em; color: var(--navy-900); }
p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute; left: 12px; top: -60px; z-index: 50;
  background: var(--navy-900); color: #fff; padding: 10px 14px;
  border-radius: var(--radius-sm); text-decoration: none;
  transition: top .15s ease;
}
.skip-link:focus { top: 12px; }

:focus-visible {
  outline: 2px solid var(--blue-600);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ---------------------------------------------------------- topbar */

.topbar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 14px 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-mark { width: 26px; height: 26px; flex: none; }
.brand-mark rect:nth-child(1) { fill: var(--blue-500); }
.brand-mark rect:nth-child(2) { fill: var(--navy-800); }
.brand-mark rect:nth-child(3) { fill: var(--teal-500); }

.brand-text h1 {
  font-size: 18px;
  line-height: 1.2;
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}
.brand-text p {
  font-size: 12.5px;
  color: var(--ink-500);
  margin-top: 2px;
}

.pill {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  padding: 3px 7px;
  border-radius: 999px;
}
.pill-beta { background: var(--blue-100); color: var(--blue-600); }

.stepper {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 auto;
  font-size: 13px;
  color: var(--ink-400);
  white-space: nowrap;
}
.step { display: inline-flex; align-items: center; gap: 7px; font-weight: 550; }
.step i {
  width: 11px; height: 11px; border-radius: 50%;
  border: 2px solid var(--line-strong);
  display: inline-block;
}
.step.is-active { color: var(--navy-900); }
.step.is-active i { border-color: var(--blue-600); background: var(--blue-600); box-shadow: 0 0 0 3px var(--blue-100); }
.step.is-done { color: var(--ink-700); }
.step.is-done i { border-color: var(--blue-600); background: transparent; }
.step-arrow { color: var(--line-strong); }

.topbar-right { display: flex; align-items: center; gap: 10px; margin-left: auto; }

.source-pill, .status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-alt);
  font-size: 12px;
  max-width: 260px;
}
.source-pill strong { display: block; font-weight: 600; font-size: 12.5px; color: var(--navy-900);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 190px; }
.source-pill em { font-style: normal; color: var(--ink-400); font-size: 11px; }
.source-pill .dot { background: var(--teal-500); }

.status-pill .dot, .source-pill .dot {
  width: 8px; height: 8px; border-radius: 50%; flex: none;
  background: var(--ink-400);
}
.status-pill[data-state="live"] { background: #EAF7F1; border-color: #C6E9D9; color: #0F6B47; }
.status-pill[data-state="live"] .dot { background: var(--green-600); }
.status-pill[data-state="prototype"] { background: var(--amber-050); border-color: #F6DFB4; color: #8A5A08; }
.status-pill[data-state="prototype"] .dot { background: var(--amber-500); }
.status-pill[data-state="error"] { background: #FDECEC; border-color: #F5C9C9; color: #9B2C2C; }
.status-pill[data-state="error"] .dot { background: var(--rose-500); }

/* ------------------------------------------------- mobile switcher */

.mobile-switch { display: none; }

/* --------------------------------------------------------- layout */

.workspace {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 67fr) minmax(0, 33fr);
  gap: 16px;
  padding: 16px 20px 20px;
}

.column { min-width: 0; min-height: 0; display: flex; flex-direction: column; gap: 14px; }
.column-left { overflow-y: auto; overflow-x: hidden; padding-right: 2px; }
.column-right { overflow: hidden; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
}

.card-title {
  font-size: 14px;
  font-weight: 650;
}

/* --------------------------------------------------------- upload */

.upload-card { padding: 16px; }

.upload-grid {
  display: grid;
  grid-template-columns: 236px minmax(0, 1fr);
  gap: 18px;
  align-items: stretch;
}

.dropzone {
  border: 1.5px dashed var(--line-strong);
  border-radius: var(--radius-md);
  background: var(--surface-alt);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 18px 12px;
  cursor: pointer;
  text-align: center;
  transition: border-color .15s ease, background .15s ease;
}
.dropzone:hover { border-color: var(--blue-500); background: var(--blue-050); }
.dropzone.is-over { border-color: var(--blue-600); background: var(--blue-100); }
.dz-icon { width: 26px; height: 26px; stroke: var(--blue-600); margin-bottom: 4px; }
.dz-title { font-weight: 600; color: var(--navy-900); }
.dz-sub { color: var(--ink-500); font-size: 12.5px; }

.context-block { display: flex; flex-direction: column; gap: 7px; }
.context-block label { font-weight: 600; font-size: 13.5px; color: var(--navy-900); }
.context-block textarea {
  width: 100%;
  resize: vertical;
  min-height: 62px;
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--ink-900);
  line-height: 1.45;
}
.context-block textarea::placeholder { color: var(--ink-400); }
.context-block textarea:focus { outline: none; border-color: var(--blue-500); box-shadow: 0 0 0 3px var(--blue-100); }

.upload-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 12px;
  color: var(--ink-400);
}

.file-list { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.file-chip {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--blue-050);
  border: 1px solid var(--blue-100);
  color: var(--navy-800);
  border-radius: 999px;
  padding: 5px 6px 5px 12px;
  font-size: 12.5px;
  max-width: 100%;
}
.file-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-chip em { font-style: normal; color: var(--ink-400); }
.file-chip button {
  border: 0; background: transparent; cursor: pointer;
  color: var(--ink-500); line-height: 1; padding: 3px 5px; border-radius: 50%;
  font-size: 14px;
}
.file-chip button:hover { background: #fff; color: var(--rose-500); }

.upload-actions { display: flex; align-items: center; gap: 10px; margin-top: 14px; }

.btn {
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  padding: 9px 16px;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease, color .15s ease;
}
.btn-primary { background: var(--navy-800); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--navy-900); }
.btn-primary:disabled { background: #C9D2E0; color: #fff; cursor: not-allowed; }
.btn-quiet { background: var(--surface); border-color: var(--line-strong); color: var(--ink-700); }
.btn-quiet:hover { border-color: var(--blue-500); color: var(--blue-600); }
.btn-ghost { background: transparent; color: var(--ink-500); padding: 6px 10px; font-size: 12.5px; }
.btn-ghost:hover { color: var(--blue-600); }

/* -------------------------------------------------------- notices */

.notice-stack { display: flex; flex-direction: column; gap: 8px; }
.notice {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 10px 13px;
  border-radius: var(--radius-md);
  font-size: 12.8px;
  border: 1px solid;
  line-height: 1.45;
}
.notice b { font-weight: 650; }
.notice-info { background: var(--blue-050); border-color: var(--blue-100); color: var(--navy-800); }
.notice-warn { background: var(--amber-050); border-color: #F6DFB4; color: #8A5A08; }
.notice-error { background: #FDECEC; border-color: #F5C9C9; color: #9B2C2C; }
.notice-mark { font-weight: 700; flex: none; }

/* --------------------------------------------------------- visual */

.visual-card { padding: 18px 18px 14px; display: flex; flex-direction: column; min-height: 320px; }

/* [hidden] is only display:none in the UA stylesheet, so any component rule
   that sets display (flex/grid/block) silently overrides it. Panels toggled
   by the hidden attribute must not render. */
[hidden] { display: none !important; }

.empty-state, .loading-state {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 8px; text-align: center; padding: 34px 20px;
}
.empty-art { width: 92px; height: auto; opacity: .5; margin-bottom: 6px; }
.empty-art rect { fill: var(--blue-100); }
.empty-art path { stroke: var(--teal-500); }
.empty-state h2 { font-size: 16px; }
.empty-state p { color: var(--ink-500); max-width: 380px; }

.loading-state p { color: var(--ink-700); font-weight: 550; }
.loader { display: flex; gap: 6px; margin-bottom: 6px; }
.loader span {
  width: 8px; height: 8px; border-radius: 50%; background: var(--blue-500);
  animation: pulse 1.1s ease-in-out infinite;
}
.loader span:nth-child(2) { animation-delay: .15s; }
.loader span:nth-child(3) { animation-delay: .3s; }
@keyframes pulse { 0%, 100% { opacity: .25; transform: translateY(0); } 50% { opacity: 1; transform: translateY(-4px); } }

.visual-body { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.visual-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.visual-head h2 { font-size: 16.5px; line-height: 1.3; }
.visual-head p { color: var(--ink-500); font-size: 12.8px; margin-top: 3px; }
.visual-controls { display: flex; align-items: center; gap: 8px; flex: none; }

.select-wrap select {
  appearance: none;
  border: 1px solid var(--line-strong);
  background: var(--surface) url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'><path d='M2 4.5 6 8.5 10 4.5' fill='none' stroke='%235D6E86' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/></svg>") no-repeat right 9px center;
  border-radius: var(--radius-sm);
  padding: 6px 28px 6px 11px;
  font-size: 12.5px;
  font-weight: 550;
  color: var(--ink-700);
  cursor: pointer;
}

.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 12px 0 4px; }
.legend-item {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 12.3px; color: var(--ink-700);
  background: none; border: 0; padding: 2px 0; cursor: pointer;
}
.legend-item.is-off { opacity: .38; }
.legend-swatch { width: 11px; height: 11px; border-radius: 3px; flex: none; }
.legend-swatch.is-line { height: 3px; border-radius: 2px; width: 16px; }

.chart-frame { flex: 1; min-height: 240px; position: relative; }
.chart-frame svg { display: block; width: 100%; height: 100%; overflow: visible; }
.chart-note { font-size: 11.8px; color: var(--ink-400); margin-top: 8px; }

.axis-line { stroke: var(--line-strong); }
.grid-line { stroke: var(--line); stroke-dasharray: 3 4; }
.axis-text { fill: var(--ink-500); font-size: 11px; font-family: var(--font); }
.axis-title { fill: var(--ink-400); font-size: 10.5px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; }
.mark { transition: opacity .12s ease; }
.mark.is-dim { opacity: .3; }
.hit { fill: transparent; cursor: pointer; }
.hit.is-selected { fill: var(--blue-600); fill-opacity: .06; }

.chart-message {
  display: flex; align-items: center; justify-content: center; height: 100%;
  color: var(--ink-500); text-align: center; padding: 20px;
}

.data-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.data-table th, .data-table td {
  padding: 7px 10px; text-align: left; border-bottom: 1px solid var(--line);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 220px;
}
.data-table th { color: var(--ink-500); font-weight: 600; background: var(--surface-alt); position: sticky; top: 0; }
.data-table td.num, .data-table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table-wrap { max-height: 100%; overflow: auto; border: 1px solid var(--line); border-radius: var(--radius-md); }

/* ------------------------------------------------------- snapshot */

.snapshot-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 14px;
}
.snapshot-card, .table-card { padding: 15px 16px; min-width: 0; }
.card-title span { font-weight: 500; color: var(--ink-400); }

.metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(105px, 1fr));
  gap: 10px;
  margin-top: 12px;
}
.metric {
  border-left: 1px solid var(--line);
  padding-left: 12px;
}
.metric:first-child { border-left: 0; padding-left: 0; }
.metric-label { font-size: 11.8px; color: var(--ink-500); display: block; }
.metric-value {
  font-size: 21px; font-weight: 680; letter-spacing: -0.02em; color: var(--navy-900);
  display: block; margin-top: 2px; font-variant-numeric: tabular-nums;
}
.metric-delta { font-size: 11.8px; margin-top: 2px; display: block; font-variant-numeric: tabular-nums; }
.metric-delta.up { color: var(--green-600); }
.metric-delta.down { color: var(--rose-500); }
.metric-delta.flat { color: var(--ink-400); }

.table-scroll { max-height: 190px; overflow: auto; margin-top: 10px; }
.support-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.support-table th, .support-table td { padding: 7px 8px; border-bottom: 1px solid var(--line); text-align: left; }
.support-table th { color: var(--ink-500); font-weight: 600; position: sticky; top: 0; background: var(--surface); }
.support-table td.num, .support-table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.support-table tr.is-selected td { background: var(--blue-050); }
.support-table tbody tr { cursor: pointer; }
.support-table tbody tr:hover td { background: var(--surface-alt); }

.disclaimer { font-size: 11.8px; color: var(--ink-400); display: flex; gap: 7px; padding: 0 2px 4px; }
.spark { color: var(--blue-500); }

/* -------------------------------------------------------- analyst */

.analyst-card {
  padding: 15px 16px 6px;
  display: flex; flex-direction: column;
  min-height: 0;
  flex: 1 1 auto;
}
.analyst-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.analyst-head h2 { font-size: 15px; display: flex; align-items: center; gap: 8px; }
.analyst-source { font-size: 11.5px; color: var(--ink-400); }

.analyst-scroll { overflow-y: auto; margin-top: 12px; padding-right: 4px; padding-bottom: 12px; }

.placeholder { color: var(--ink-500); font-size: 13px; }
.placeholder ul { margin: 10px 0 0; padding-left: 18px; color: var(--ink-400); }
.placeholder li { margin-bottom: 4px; }

.analysis-summary {
  font-size: 12.8px; color: var(--ink-700);
  background: var(--surface-alt);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  margin-bottom: 12px;
}

.insight-list { display: flex; flex-direction: column; gap: 10px; }
.insight {
  display: flex; gap: 11px;
  background: var(--surface-alt);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 12px 13px;
}
.insight-icon {
  width: 30px; height: 30px; border-radius: 50%; flex: none;
  display: grid; place-items: center;
  background: var(--blue-100); color: var(--blue-600);
}
.insight-icon svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.insight[data-type="outlier"] .insight-icon { background: var(--amber-050); color: #B8770B; }
.insight[data-type="risk"] .insight-icon { background: #FDECEC; color: var(--rose-500); }
.insight[data-type="positive"] .insight-icon { background: #E7F6EF; color: var(--green-600); }
.insight[data-type="watch"] .insight-icon { background: #EDF3FA; color: var(--navy-700); }

.insight h3 { font-size: 13.4px; line-height: 1.35; margin-bottom: 4px; }
.insight p { font-size: 12.7px; color: var(--ink-700); line-height: 1.5; }
.basis-tag {
  display: inline-block; margin-top: 7px;
  font-size: 10px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  padding: 2px 7px; border-radius: 999px;
  background: #EEF1F6; color: var(--ink-500);
}
.basis-tag[data-basis="hypothesis"] { background: var(--amber-050); color: #8A5A08; }
.basis-tag[data-basis="fact"] { background: #E7F6EF; color: #0F6B47; }

.leadership-question {
  display: flex; gap: 12px; align-items: flex-start;
  background: var(--navy-900);
  color: #fff;
  border-radius: var(--radius-md);
  padding: 14px;
  margin-top: 12px;
}
.lq-icon { width: 20px; height: 20px; flex: none; stroke: var(--amber-500); margin-top: 1px; }
.lq-label {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em;
  color: #9FB6D6; font-weight: 700; display: block; margin-bottom: 4px;
}
.leadership-question p { font-size: 13.6px; line-height: 1.45; font-weight: 550; }

.quality-notes { margin-top: 14px; }
.quality-notes h4 { font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-400); }
.quality-notes ul { margin: 6px 0 0; padding-left: 17px; color: var(--ink-500); font-size: 12.2px; }
.quality-notes li { margin-bottom: 3px; }

/* ----------------------------------------------------------- chat */

.chat-card {
  padding: 14px 16px 13px;
  display: flex; flex-direction: column;
  flex: 0 0 auto;
  max-height: 46%;
  min-height: 190px;
}

.chip-row { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 8px; }
.chip {
  border: 1px solid var(--blue-100);
  background: var(--blue-050);
  color: var(--navy-800);
  border-radius: 999px;
  padding: 5px 11px;
  font-size: 12px;
  cursor: pointer;
  text-align: left;
}
.chip:hover { border-color: var(--blue-500); background: var(--blue-100); }
.chip:disabled { opacity: .5; cursor: not-allowed; }

.chat-log { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 9px; padding-right: 4px; min-height: 0; }
.chat-log:empty { display: none; }
.msg { max-width: 92%; font-size: 12.9px; line-height: 1.5; border-radius: var(--radius-md); padding: 9px 12px; white-space: pre-wrap; }
.msg-user { align-self: flex-end; background: var(--navy-800); color: #fff; border-bottom-right-radius: 4px; }
.msg-ai { align-self: flex-start; background: var(--surface-alt); border: 1px solid var(--line); color: var(--ink-900); border-bottom-left-radius: 4px; }
.msg-error { align-self: flex-start; background: #FDECEC; border: 1px solid #F5C9C9; color: #9B2C2C; }
.msg-typing { color: var(--ink-400); font-style: italic; }

.chat-form { display: flex; gap: 8px; align-items: center; margin-top: 10px; }
.chat-form input {
  flex: 1; min-width: 0;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 10px 15px;
  background: var(--surface);
}
.chat-form input:focus { outline: none; border-color: var(--blue-500); box-shadow: 0 0 0 3px var(--blue-100); }
.chat-form input:disabled { background: var(--surface-alt); }
.chat-send {
  width: 36px; height: 36px; flex: none;
  border-radius: 50%; border: 0; cursor: pointer;
  background: var(--blue-600); color: #fff;
  display: grid; place-items: center;
}
.chat-send svg { width: 17px; height: 17px; transform: rotate(0deg); }
.chat-send:disabled { background: #C9D2E0; cursor: not-allowed; }

.chat-footnote { font-size: 10.8px; color: var(--ink-400); margin-top: 9px; line-height: 1.4; }

/* -------------------------------------------------------- tooltip */

.tooltip {
  position: fixed;
  z-index: 60;
  pointer-events: none;
  background: var(--navy-900);
  color: #fff;
  border-radius: var(--radius-sm);
  padding: 8px 11px;
  font-size: 12px;
  line-height: 1.45;
  box-shadow: var(--shadow-pop);
  max-width: 240px;
}
.tooltip b { display: block; font-weight: 650; margin-bottom: 3px; }
.tooltip .tt-row { display: flex; align-items: center; gap: 7px; justify-content: space-between; }
.tooltip .tt-key { display: flex; align-items: center; gap: 6px; color: #C5D6EE; }
.tooltip .tt-dot { width: 8px; height: 8px; border-radius: 2px; }
.tooltip .tt-val { font-variant-numeric: tabular-nums; font-weight: 600; }

/* ---------------------------------------------------- breakpoints */

@media (max-width: 1180px) {
  .brand-text p { display: none; }
  .stepper { display: none; }
}

@media (max-width: 980px) {
  body { overflow: auto; }

  .topbar { flex-wrap: wrap; gap: 12px; padding: 12px 14px; position: sticky; top: 0; z-index: 20; }
  .topbar-right { width: 100%; margin-left: 0; }
  .source-pill { max-width: none; flex: 1; }

  .mobile-switch {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
    position: sticky;
    top: 0;
    z-index: 15;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    padding: 8px 14px 10px;
  }
  .mobile-switch button {
    position: relative;
    border: 1px solid var(--line);
    background: var(--surface-alt);
    color: var(--ink-500);
    border-radius: 10px;
    padding: 11px 8px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
  }
  .mobile-switch button.is-active {
    background: var(--navy-800); border-color: var(--navy-800); color: #fff;
  }
  .tab-badge {
    position: absolute; top: 7px; right: 10px;
    width: 8px; height: 8px; border-radius: 50%; background: var(--amber-500);
  }

  .workspace {
    display: block;
    padding: 12px 14px 26px;
  }
  .column { gap: 12px; }
  .column-left, .column-right { overflow: visible; }
  .workspace[data-mobile-view="dashboard"] .column-right { display: none; }
  .workspace[data-mobile-view="analyst"] .column-left { display: none; }
  .workspace .column + .column { margin-top: 12px; }

  .upload-grid { grid-template-columns: 1fr; gap: 12px; }
  .dropzone { padding: 24px 12px; }
  .context-block textarea { min-height: 76px; font-size: 16px; }
  .upload-actions { flex-wrap: wrap; }
  .upload-actions .btn { flex: 1 1 auto; min-height: 44px; }

  .visual-card { min-height: 0; padding: 15px 14px 12px; }
  .chart-frame { min-height: 300px; height: 300px; }
  .visual-head { flex-direction: column; gap: 10px; }
  .visual-controls { width: 100%; justify-content: space-between; }
  .select-wrap select { min-height: 40px; }

  .snapshot-row { grid-template-columns: 1fr; }
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 10px; }
  .metric { border-left: 0; padding-left: 0; }
  .table-scroll { max-height: none; }

  .analyst-card { padding: 14px 14px 4px; }
  .analyst-scroll { overflow: visible; }
  .chat-card { max-height: none; }
  .chat-log { max-height: 340px; }
  .chat-form input { min-height: 44px; font-size: 16px; }
  .chat-send { width: 44px; height: 44px; }
  .chip { padding: 8px 13px; font-size: 13px; }
  .insight h3 { font-size: 14.5px; }
  .insight p { font-size: 13.5px; }
  .leadership-question p { font-size: 15px; }
  .data-table th, .data-table td { max-width: 160px; }
}

@media (max-width: 420px) {
  .brand-text h1 { font-size: 16px; }
  .metric-value { font-size: 19px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

@media print {
  .upload-card, .chat-card, .mobile-switch, .topbar-right { display: none; }
  .workspace { display: block; }
}
