:root {
  --bg-desk: #e5e4de;
  --bg-slide: #ffffff;
  --bg-subtle: #f8fafc;
  --bg-callout: #fff1f2;

  --ink-900: #0f172a;
  --ink-700: #334155;
  --ink-500: #64748b;
  --ink-400: #94a3b8;

  --border-dark: #0f172a;
  --border-mid: #cbd5e1;
  --border-light: #e2e8f0;

  --crimson: #d92d20;
  --crimson-soft: #fee4e2;
  --navy: #1e3a8a;
  --navy-soft: #dbeafe;
  --teal: #0284c7;
  --teal-soft: #e0f2fe;
  --amber: #d97706;
  --amber-soft: #fef3c7;
  --green: #15803d;
  --green-soft: #dcfce7;

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  width: 100%;
  height: 100%;
  background: var(--bg-desk);
  color: var(--ink-900);
  font-family: var(--font-sans);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Top Toolbar */
.top-toolbar {
  height: 46px;
  background: #ffffff;
  border-bottom: 1px solid var(--border-mid);
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 30;
}

.toolbar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.report-badge {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  background: var(--crimson);
  color: #ffffff;
  padding: 3px 8px;
  border-radius: 3px;
  text-transform: uppercase;
}

.report-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-900);
}

.slide-pills {
  display: flex;
  gap: 3px;
}

.num-pill {
  width: 24px;
  height: 24px;
  border-radius: 4px;
  border: 1px solid var(--border-mid);
  background: #ffffff;
  color: var(--ink-700);
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.14s ease;
}

.num-pill:hover {
  border-color: var(--ink-900);
  background: var(--bg-subtle);
}

.num-pill.active {
  background: var(--ink-900);
  border-color: var(--ink-900);
  color: #ffffff;
}

.toolbar-actions {
  display: flex;
  gap: 8px;
}

.toolbar-btn {
  padding: 5px 12px;
  border-radius: 4px;
  border: 1px solid var(--border-mid);
  background: #ffffff;
  color: var(--ink-900);
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.14s ease;
}

.toolbar-btn:hover {
  background: var(--bg-subtle);
  border-color: var(--ink-900);
}

.toolbar-btn.primary {
  background: var(--ink-900);
  color: #ffffff;
  border-color: var(--ink-900);
}

/* Main Stage */
.stage-container {
  height: calc(100vh - 46px);
  width: 100vw;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px 54px;
  position: relative;
}

.nav-paddle {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 36px;
  height: 64px;
  border-radius: 6px;
  border: 1px solid var(--border-mid);
  background: #ffffff;
  color: var(--ink-900);
  font-size: 24px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08);
  transition: all 0.14s ease;
  z-index: 20;
}

.nav-paddle:hover:not(:disabled) {
  background: var(--ink-900);
  color: #ffffff;
  border-color: var(--ink-900);
}

.nav-paddle:disabled {
  opacity: 0.25;
  cursor: not-allowed;
}

.nav-paddle.left { left: 10px; }
.nav-paddle.right { right: 10px; }

/* The 16:9 Institutional Slide Sheet */
.slide-sheet {
  width: 100%;
  max-width: 1360px;
  height: 100%;
  max-height: 780px;
  background: var(--bg-slide);
  border: 1px solid #cbd5e1;
  box-shadow: 0 14px 36px rgba(15, 23, 42, 0.11);
  border-radius: 4px;
  padding: 20px 28px 14px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
}

/* Slide Header */
.slide-header {
  border-bottom: 2px solid var(--border-dark);
  padding-bottom: 8px;
  margin-bottom: 12px;
  flex-shrink: 0;
}

.slide-kicker-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 3px;
}

.slide-category {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--crimson);
}

.slide-exhibit-num {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 600;
  color: var(--ink-500);
}

.slide-headline {
  font-size: clamp(18px, 1.85vw, 23px);
  font-weight: 800;
  line-height: 1.18;
  letter-spacing: -0.02em;
  color: var(--ink-900);
}

.slide-headline .hl-red {
  color: var(--crimson);
}

.slide-headline .hl-navy {
  color: var(--navy);
}

/* Slide Body Layout */
.slide-body {
  flex: 1 1 0%;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
  overflow: hidden;
}

/* 4-KPI Stat Row */
.kpi-row-4 {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  flex-shrink: 0;
  width: 100%;
}

.kpi-tile {
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  border-top: 3px solid var(--navy);
  padding: 8px 12px;
  border-radius: 3px;
  min-width: 0;
  overflow: hidden;
}

.kpi-tile.red-top {
  border-top-color: var(--crimson);
}

.kpi-tile-label {
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 700;
  color: var(--ink-500);
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.kpi-tile-value {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin: 1px 0;
  color: var(--ink-900);
  line-height: 1.15;
}

.kpi-tile-value.red { color: var(--crimson); }
.kpi-tile-value.navy { color: var(--navy); }
.kpi-tile-value.teal { color: var(--teal); }

.kpi-tile-sub {
  font-size: 11px;
  color: var(--ink-700);
  line-height: 1.28;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Main 2-Column Split (Left Visuals/Tables, Right Takeaways) */
.main-split {
  display: grid;
  grid-template-columns: 1.52fr 1fr;
  gap: 16px;
  flex: 1 1 0%;
  min-height: 0;
  overflow: hidden;
}

/* Explicit Grid Split for Left Stack so Chart ALWAYS gets 58% height and Table gets 42% */
.left-stack {
  display: grid;
  grid-template-rows: 1.42fr 1fr;
  gap: 10px;
  min-height: 0;
  height: 100%;
  overflow: hidden;
}

/* Side-by-side 2-Chart Row inside Top of Left Stack */
.dual-chart-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  min-height: 0;
  height: 100%;
  overflow: hidden;
}

/* Chart / Table Card — Strict Containment */
.viz-card {
  background: #ffffff;
  border: 1px solid var(--border-light);
  border-radius: 4px;
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 6px;
  min-height: 0;
  height: 100%;
  overflow: hidden;
  position: relative;
}

.viz-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-light);
  padding-bottom: 5px;
  gap: 8px;
  flex-shrink: 0;
}

.viz-card-title {
  font-size: 11.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: var(--ink-900);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.viz-card-sub {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--ink-500);
  white-space: nowrap;
  flex-shrink: 0;
}

/* Bulletproof Chart.js Container — Canvas can NEVER overflow! */
.canvas-wrapper {
  position: relative;
  flex: 1 1 0%;
  width: 100%;
  min-height: 0;
  overflow: hidden;
}

.canvas-wrapper canvas {
  position: absolute !important;
  top: 0;
  left: 0;
  width: 100% !important;
  height: 100% !important;
}

/* Clean Institutional Table */
.inst-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.inst-table th {
  text-align: left;
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-500);
  background: var(--bg-subtle);
  padding: 5px 8px;
  border-bottom: 1.5px solid var(--border-mid);
  white-space: nowrap;
}

.inst-table td {
  padding: 5px 8px;
  border-bottom: 1px solid var(--border-light);
  color: var(--ink-700);
  vertical-align: middle;
  line-height: 1.25;
}

.inst-table tr:last-child td {
  border-bottom: none;
}

.inst-table .bold-cell {
  font-weight: 700;
  color: var(--ink-900);
  white-space: nowrap;
}

.inst-table .mono-num {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--ink-900);
  white-space: nowrap;
}

.tag-pill {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 3px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
}

.tag-pill.red { background: var(--crimson-soft); color: var(--crimson); }
.tag-pill.navy { background: var(--navy-soft); color: var(--navy); }
.tag-pill.teal { background: var(--teal-soft); color: var(--teal); }
.tag-pill.amber { background: var(--amber-soft); color: var(--amber); }
.tag-pill.green { background: var(--green-soft); color: var(--green); }

/* Right-Hand Takeaway Panel */
.takeaway-rail {
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  border-top: 3.5px solid var(--navy);
  border-radius: 4px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
  min-height: 0;
  height: 100%;
  overflow: hidden;
}

.takeaway-rail-title {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--navy);
  border-bottom: 1px solid var(--border-mid);
  padding-bottom: 6px;
  margin-bottom: 8px;
}

.takeaway-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.takeaway-list li {
  font-size: 12.2px;
  line-height: 1.42;
  color: var(--ink-700);
  padding-left: 14px;
  position: relative;
}

.takeaway-list li::before {
  content: "•";
  position: absolute;
  left: 1px;
  color: var(--crimson);
  font-weight: 900;
}

.takeaway-list li strong {
  color: var(--ink-900);
  font-weight: 700;
}

/* Red Dashed Meeker Callout Box */
.callout-box {
  background: var(--bg-callout);
  border: 1.5px dashed var(--crimson);
  border-radius: 4px;
  padding: 9px 12px;
  flex-shrink: 0;
}

.callout-label {
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 800;
  color: var(--crimson);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  display: block;
  margin-bottom: 2px;
}

.callout-body {
  font-size: 11.8px;
  font-weight: 600;
  line-height: 1.36;
  color: var(--ink-900);
}

/* 3-Step Horizontal Cards inside Slide 11 */
.step-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  flex: 1;
  min-height: 0;
}

.step-card {
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  border-left: 3.5px solid var(--navy);
  border-radius: 4px;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  overflow: hidden;
}

.step-card.red { border-left-color: var(--crimson); }
.step-card.amber { border-left-color: var(--amber); }
.step-card.green { border-left-color: var(--green); }

/* Slide Footer */
.slide-footer {
  border-top: 1px solid var(--border-mid);
  padding-top: 7px;
  margin-top: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 10.5px;
  color: var(--ink-500);
  flex-shrink: 0;
}

.source-cite {
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.source-cite:hover {
  color: var(--crimson);
  text-decoration: underline;
}

.slide-page-num {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--ink-900);
  flex-shrink: 0;
}

/* Modals & Drawers */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(4px);
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px;
}

.modal-overlay.hidden { display: none; }

.modal-card {
  width: 100%;
  max-width: 1240px;
  height: 84vh;
  background: #ffffff;
  border-radius: 8px;
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.25);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 2px solid var(--ink-900);
  padding-bottom: 12px;
}

.modal-close {
  padding: 6px 12px;
  border-radius: 4px;
  border: 1px solid var(--border-mid);
  background: var(--bg-subtle);
  color: var(--ink-900);
  font-weight: 700;
  cursor: pointer;
}

.thumb-grid {
  flex: 1;
  overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(275px, 1fr));
  gap: 14px;
}

.thumb-card {
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  border-top: 3px solid var(--navy);
  border-radius: 4px;
  padding: 14px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
  transition: all 0.14s ease;
}

.thumb-card:hover {
  border-top-color: var(--crimson);
  background: #ffffff;
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.08);
}

/* Raw Data Drawer */
.source-drawer {
  position: fixed;
  top: 0;
  right: -540px;
  width: 520px;
  height: 100vh;
  background: #ffffff;
  border-left: 2px solid var(--ink-900);
  z-index: 100;
  display: flex;
  flex-direction: column;
  box-shadow: -16px 0 40px rgba(15, 23, 42, 0.18);
  transition: right 0.24s ease;
}

.source-drawer.open { right: 0; }

.drawer-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-mid);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.drawer-tabs {
  padding: 10px 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--border-mid);
}

.drawer-tab {
  padding: 5px 10px;
  border-radius: 4px;
  border: 1px solid var(--border-mid);
  background: #ffffff;
  color: var(--ink-700);
  font-family: var(--font-mono);
  font-size: 11px;
  cursor: pointer;
}

.drawer-tab.active {
  background: var(--ink-900);
  border-color: var(--ink-900);
  color: #ffffff;
  font-weight: 700;
}

.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  background: #f8fafc;
}

.drawer-body pre {
  font-family: var(--font-mono);
  font-size: 11.5px;
  line-height: 1.55;
  color: var(--ink-900);
  white-space: pre-wrap;
}
