:root {
  --bg-main: #090d16;
  --bg-card: #111726;
  --bg-card-alt: #161f33;
  --border: #23304d;
  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  --accent-indigo: #6366f1;
  --accent-emerald: #10b981;
  --accent-amber: #f59e0b;
  --accent-rose: #f43f5e;
  --accent-cyan: #06b6d4;
}

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

html, body {
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
}

body {
  background: var(--bg-main);
  color: var(--text-main);
  font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, sans-serif;
  line-height: 1.45;
  padding-bottom: 48px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 13px 26px;
  background: rgba(17, 23, 38, 0.94);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(10px);
  flex-wrap: wrap;
  gap: 12px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.brand-badge {
  background: linear-gradient(135deg, #6366f1, #10b981);
  color: #fff;
  font-weight: 800;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  padding: 6px 10px;
  border-radius: 6px;
  white-space: nowrap;
  flex-shrink: 0;
}

.brand h1 {
  font-size: 1.15rem;
  font-weight: 700;
}

.subtitle {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.telemetry-bar {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
}

.pill {
  background: var(--bg-card-alt);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 5px 10px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
}

.pill-label { color: var(--text-muted); }
.pill-value {
  font-weight: 600;
  font-family: "SF Mono", Menlo, monospace;
}

.highlight-emerald { color: var(--accent-emerald); }

.upload-btn {
  background: rgba(99, 102, 241, 0.18);
  border: 1px solid var(--accent-indigo);
  color: #e0e7ff;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 0.77rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.upload-btn:hover {
  background: var(--accent-indigo);
  color: #fff;
}

.workspace {
  max-width: 1580px;
  margin: 0 auto;
  padding: 16px 24px;
}

/* 3-Act Story Hero */
.story-hero {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

.hero-step {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 15px;
  min-width: 0;
}

.hero-step.highlight-step {
  border-color: rgba(16, 185, 129, 0.5);
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.12), rgba(17, 23, 38, 0.95));
}

.step-num {
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.07em;
  color: var(--accent-cyan);
  display: block;
  margin-bottom: 3px;
}

.highlight-step .step-num {
  color: var(--accent-emerald);
}

.hero-step h3 {
  font-size: 0.92rem;
  margin-bottom: 4px;
}

.hero-step p {
  font-size: 0.77rem;
  color: #cbd5e1;
}

/* Scenario Strip & Dilemma Card */
.scenario-strip {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
}

.strip-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.scenario-tabs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 10px;
}

.scenario-tab {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-main);
  padding: 11px 15px;
  border-radius: 10px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 3px;
  text-align: left;
  transition: all 0.15s ease;
  min-width: 0;
}

.scenario-tab:hover { border-color: #4f6396; }

.scenario-tab.active {
  background: linear-gradient(180deg, rgba(99, 102, 241, 0.24), rgba(17, 23, 38, 0.96));
  border-color: var(--accent-indigo);
  box-shadow: 0 0 16px rgba(99, 102, 241, 0.25);
}

.scenario-tab .tab-cat {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent-cyan);
  font-weight: 700;
}

.scenario-tab .tab-title {
  font-size: 0.92rem;
  font-weight: 700;
}

.scenario-tab .tab-loc {
  font-size: 0.74rem;
  color: var(--text-muted);
}

.dilemma-card {
  background: var(--bg-card-alt);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 16px;
  display: grid;
  grid-template-columns: 1.2fr 1fr 1.1fr;
  gap: 16px;
  font-size: 0.8rem;
}

.dilemma-col { min-width: 0; }

.dilemma-tag {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 4px;
  margin-bottom: 5px;
  letter-spacing: 0.05em;
}

.tag-question { background: rgba(56, 189, 248, 0.18); color: #7dd3fc; }
.tag-old { background: rgba(244, 63, 94, 0.18); color: #fda4af; }
.tag-new { background: rgba(16, 185, 129, 0.18); color: #6ee7b7; }

.dilemma-quote {
  font-weight: 600;
  color: #f8fafc;
  font-size: 0.85rem;
}

/* Mobile-only elements hidden on desktop */
.mobile-quick-bar,
.mobile-drawer-handle,
.mobile-bottom-bar,
.mobile-backdrop {
  display: none;
}

/* Main Studio Grid */
.studio-grid {
  display: grid;
  grid-template-columns: 365px 1fr;
  gap: 18px;
  align-items: start;
}

.studio-grid > * {
  min-width: 0;
}

.control-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  position: sticky;
  top: 72px;
}

.sweet-spot-btn {
  width: 100%;
  background: linear-gradient(135deg, #4f46e5, #059669);
  border: 1px solid rgba(255, 255, 255, 0.22);
  color: #fff;
  padding: 11px 13px;
  border-radius: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 11px;
  text-align: left;
  margin-bottom: 16px;
  box-shadow: 0 4px 18px rgba(79, 70, 229, 0.35);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.sweet-spot-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 24px rgba(16, 185, 129, 0.45);
}

.sweet-spot-btn .sparkle {
  font-size: 1.35rem;
}

.sweet-spot-btn strong {
  display: block;
  font-size: 0.88rem;
}

.sweet-spot-btn small {
  display: block;
  font-size: 0.71rem;
  color: #d1fae5;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.panel-header h2 {
  font-size: 0.92rem;
  font-weight: 700;
}

.badge-subtle {
  font-size: 0.67rem;
  background: var(--bg-card-alt);
  border: 1px solid var(--border);
  padding: 2px 7px;
  border-radius: 5px;
  color: #a5b4fc;
}

.preset-group { margin-bottom: 14px; }

.group-label {
  display: block;
  font-size: 0.71rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin-bottom: 6px;
  font-weight: 600;
}

.preset-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.preset-btn {
  background: var(--bg-card-alt);
  border: 1px solid var(--border);
  color: var(--text-main);
  padding: 8px 10px;
  border-radius: 7px;
  font-size: 0.74rem;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  min-height: 38px;
}

.preset-btn:hover { border-color: var(--accent-indigo); }

.preset-btn.active {
  background: rgba(99, 102, 241, 0.24);
  border-color: var(--accent-indigo);
  color: #fff;
  font-weight: 600;
}

.slider-group { margin-bottom: 13px; }
.slider-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.slider-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.78rem;
  margin-bottom: 4px;
  gap: 6px;
}

.slider-header label {
  color: #cbd5e1;
  font-weight: 500;
}

.slider-val {
  color: #a5b4fc;
  font-weight: 700;
  font-family: "SF Mono", Menlo, monospace;
  font-size: 0.75rem;
  white-space: nowrap;
}

input[type="range"] {
  width: 100%;
  height: 26px;
  accent-color: var(--accent-indigo);
  cursor: pointer;
  touch-action: pan-y;
}

.slider-ticks {
  display: flex;
  justify-content: space-between;
  font-size: 0.66rem;
  color: var(--text-muted);
}

.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 14px 0;
}

.architecture-details {
  margin-top: 12px;
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px 11px;
  font-size: 0.73rem;
}

.architecture-details summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--text-muted);
}

.cov-list {
  list-style: none;
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  color: #cbd5e1;
}

.dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 6px;
}

.dot-target { background: #38bdf8; }
.dot-past { background: #a855f7; }
.dot-known { background: #6366f1; }
.dot-cat { background: #10b981; }

/* Right Stage & Plain-English Advisor Banner */
.main-stage {
  display: flex;
  flex-direction: column;
  gap: 15px;
  min-width: 0;
}

.advisor-banner {
  border-radius: 12px;
  padding: 16px 20px;
  border: 1px solid var(--border);
  transition: all 0.2s ease;
}

.advisor-banner.status-danger {
  background: linear-gradient(135deg, rgba(244, 63, 94, 0.16), rgba(17, 23, 38, 0.96));
  border-color: rgba(244, 63, 94, 0.55);
}

.advisor-banner.status-success {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.16), rgba(17, 23, 38, 0.96));
  border-color: rgba(16, 185, 129, 0.55);
}

.advisor-banner.status-warning {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.16), rgba(17, 23, 38, 0.96));
  border-color: rgba(245, 158, 11, 0.55);
}

.advisor-banner.status-neutral {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.15), rgba(17, 23, 38, 0.96));
  border-color: rgba(99, 102, 241, 0.45);
}

.advisor-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
  flex-wrap: wrap;
  gap: 8px;
}

.advisor-badge {
  font-size: 0.7rem;
  font-weight: 800;
  padding: 3px 9px;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.12);
  letter-spacing: 0.05em;
}

.advisor-trust {
  font-size: 0.74rem;
  color: #cbd5e1;
}

.advisor-headline {
  font-size: 1.12rem;
  font-weight: 800;
  margin-bottom: 5px;
  color: #fff;
}

.advisor-explanation {
  font-size: 0.85rem;
  color: #e2e8f0;
  margin-bottom: 10px;
}

.advisor-action-row {
  background: rgba(9, 13, 22, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 0.82rem;
  display: flex;
  align-items: center;
  gap: 10px;
}

.action-pill {
  background: var(--accent-indigo);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 800;
  padding: 3px 7px;
  border-radius: 4px;
  white-space: nowrap;
}

/* Plain-Language Decision Impact Section */
.decision-impact-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 15px 18px;
}

.decision-impact-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 11px;
  flex-wrap: wrap;
  gap: 8px;
}

.decision-impact-header h3 {
  font-size: 0.94rem;
  font-weight: 700;
  color: #f8fafc;
}

.decision-impact-header span {
  font-size: 0.74rem;
  color: var(--text-muted);
}

.decision-cards-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 11px;
  margin-bottom: 12px;
}

.impact-card {
  background: var(--bg-card-alt);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 11px 13px;
  min-width: 0;
}

.impact-card-title {
  font-size: 0.76rem;
  font-weight: 700;
  color: #a5b4fc;
  margin-bottom: 5px;
}

.impact-card p {
  font-size: 0.79rem;
  color: #e2e8f0;
  line-height: 1.45;
}

.receipt-strip {
  background: rgba(9, 13, 22, 0.65);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 10px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 0.78rem;
}

.receipt-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.receipt-item span {
  font-size: 0.68rem;
  color: var(--text-muted);
  text-transform: uppercase;
}

.receipt-item strong {
  font-family: "SF Mono", Menlo, monospace;
  font-size: 0.88rem;
}

.receipt-operator {
  color: var(--text-muted);
  font-weight: 700;
  font-size: 1rem;
}

/* Optimizer Drawer */
.optimizer-drawer {
  background: var(--bg-card-alt);
  border: 1px solid var(--accent-emerald);
  border-radius: 12px;
  padding: 14px 18px;
}

.optimizer-drawer.hidden {
  display: none;
}

.optimizer-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 10px;
  gap: 8px;
}

.optimizer-head h3 {
  font-size: 0.94rem;
  color: #6ee7b7;
}

.optimizer-head p {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.close-drawer-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 4px 9px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.75rem;
  flex-shrink: 0;
}

.opt-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.opt-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.77rem;
  min-width: 540px;
}

.opt-table th, .opt-table td {
  padding: 7px 10px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.opt-table th {
  color: var(--text-muted);
  font-size: 0.7rem;
  text-transform: uppercase;
}

.opt-table tr.opt-winner {
  background: rgba(16, 185, 129, 0.14);
  font-weight: 600;
}

.opt-apply-btn {
  background: var(--accent-indigo);
  color: #fff;
  border: none;
  padding: 5px 10px;
  border-radius: 5px;
  font-size: 0.72rem;
  cursor: pointer;
}

/* KPI Grid */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 11px;
  padding: 12px 15px;
  min-width: 0;
}

.kpi-title {
  font-size: 0.73rem;
  color: var(--text-muted);
  text-transform: uppercase;
}

.kpi-main {
  font-size: 1.4rem;
  font-weight: 800;
  margin: 4px 0 2px;
  font-family: "SF Mono", Menlo, monospace;
  word-break: break-word;
}

.kpi-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.delta-pos { color: var(--accent-emerald); font-weight: 600; }
.delta-neg { color: var(--accent-rose); font-weight: 600; }

/* Charts */
.chart-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 15px 18px;
  min-width: 0;
}

.chart-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.chart-header h2 {
  font-size: 0.96rem;
  font-weight: 700;
}

.chart-header p {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.legend-inline {
  display: flex;
  gap: 12px;
  font-size: 0.74rem;
  color: #cbd5e1;
  flex-wrap: wrap;
}

.swatch {
  display: inline-block;
  width: 11px;
  height: 11px;
  border-radius: 3px;
  margin-right: 5px;
  vertical-align: middle;
}

.swatch-hist { background: #38bdf8; }
.swatch-base { background: #94a3b8; }
.swatch-whatif { background: #6366f1; }
.swatch-fan { background: rgba(99, 102, 241, 0.35); border: 1px solid #6366f1; }
.swatch-actual { background: #10b981; }
.swatch-uni { background: #f59e0b; }
.swatch-seasonal { background: #64748b; }

.canvas-wrap { width: 100%; position: relative; overflow: hidden; }
canvas { width: 100%; display: block; }

.backtest-split {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 16px;
  align-items: center;
}

.backtest-split > * { min-width: 0; }

.scoreboard {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.score-card {
  background: var(--bg-card-alt);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 10px 13px;
}

.score-card.winner {
  border-color: var(--accent-indigo);
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.18), rgba(17, 23, 38, 0.92));
}

.score-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.79rem;
  font-weight: 700;
  margin-bottom: 6px;
  gap: 6px;
  flex-wrap: wrap;
}

.winner-badge {
  background: var(--accent-emerald);
  color: #052e16;
  font-size: 0.64rem;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 800;
}

.score-metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  font-size: 0.73rem;
}

.score-metrics div span {
  display: block;
  color: var(--text-muted);
  font-size: 0.66rem;
}

.score-metrics div strong {
  font-family: "SF Mono", Menlo, monospace;
  font-size: 0.83rem;
}

.bottom-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
}

.bottom-row-2 > * { min-width: 0; }

/* ========================================================================== */
/* RESPONSIVE / MOBILE-FIRST ENHANCEMENTS                                     */
/* ========================================================================== */

@media (max-width: 1180px) {
  .backtest-split {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 1024px) {
  .dilemma-card {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .bottom-row-2 {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 960px) {
  body {
    padding-bottom: 84px; /* space for floating bottom control bar */
  }

  .topbar {
    position: relative;
    padding: 12px 16px;
  }

  .hide-mobile {
    display: none !important;
  }

  .brand h1 {
    font-size: 1.02rem;
  }

  .subtitle {
    font-size: 0.73rem;
  }

  .workspace {
    padding: 12px 14px;
  }

  /* Horizontal swipeable 3-Act Story Hero on phones */
  .story-hero {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    gap: 10px;
    padding-bottom: 4px;
    -webkit-overflow-scrolling: touch;
  }

  .story-hero::-webkit-scrollbar {
    display: none;
  }

  .hero-step {
    flex: 0 0 85%;
    scroll-snap-align: start;
  }

  /* Horizontal swipeable Scenario Tabs on phones */
  .scenario-tabs {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    gap: 9px;
    padding-bottom: 4px;
    -webkit-overflow-scrolling: touch;
  }

  .scenario-tabs::-webkit-scrollbar {
    display: none;
  }

  .scenario-tab {
    flex: 0 0 82%;
    scroll-snap-align: start;
  }

  /* Show Mobile Quick-Action Bar right above the Advisor Banner */
  .mobile-quick-bar {
    display: flex;
    flex-direction: column;
    gap: 9px;
    margin-bottom: 14px;
  }

  .mobile-sweet-btn {
    margin-bottom: 0;
    padding: 10px 13px;
  }

  .mobile-preset-scroll {
    display: flex;
    gap: 7px;
    overflow-x: auto;
    padding-bottom: 2px;
    -webkit-overflow-scrolling: touch;
  }

  .mobile-preset-scroll::-webkit-scrollbar {
    display: none;
  }

  .mobile-preset-scroll .preset-btn {
    flex: 0 0 auto;
    white-space: nowrap;
    padding: 8px 12px;
  }

  /* Single column layout on mobile — main stage comes FIRST, control panel becomes slide-up bottom sheet */
  .studio-grid {
    grid-template-columns: 1fr;
  }

  .control-panel {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    top: auto;
    z-index: 100;
    max-height: 82vh;
    overflow-y: auto;
    border-radius: 18px 18px 0 0;
    border-top: 2px solid var(--accent-indigo);
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.75);
    transform: translateY(105%);
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    padding: 14px 18px 28px;
  }

  .control-panel.drawer-open {
    transform: translateY(0);
  }

  .hide-mobile-btn {
    display: none;
  }

  .mobile-drawer-handle {
    display: block;
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
  }

  .drawer-pill {
    width: 42px;
    height: 4px;
    background: #475569;
    border-radius: 999px;
    margin: 0 auto 10px;
  }

  .drawer-title-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.92rem;
  }

  .drawer-done-btn {
    background: var(--accent-indigo);
    color: #fff;
    border: none;
    padding: 6px 14px;
    border-radius: 7px;
    font-weight: 700;
    font-size: 0.78rem;
    cursor: pointer;
  }

  .mobile-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(5, 8, 15, 0.68);
    backdrop-filter: blur(3px);
    z-index: 90;
  }

  .mobile-backdrop.hidden {
    display: none;
  }

  /* Floating Bottom Bar on Mobile */
  .mobile-bottom-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 80;
    background: rgba(17, 23, 38, 0.96);
    border-top: 1px solid var(--accent-indigo);
    padding: 10px 16px calc(10px + env(safe-area-inset-bottom, 0px));
    backdrop-filter: blur(12px);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.5);
  }

  .mobile-bar-summary {
    display: flex;
    flex-direction: column;
    min-width: 0;
  }

  .mobile-bar-label {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
  }

  .mobile-bar-summary strong {
    font-size: 0.82rem;
    color: #e0e7ff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .mobile-open-sliders-btn {
    background: linear-gradient(135deg, #6366f1, #4f46e5);
    color: #fff;
    border: none;
    padding: 10px 16px;
    border-radius: 9px;
    font-weight: 700;
    font-size: 0.82rem;
    cursor: pointer;
    box-shadow: 0 2px 12px rgba(99, 102, 241, 0.45);
    flex-shrink: 0;
  }

  .decision-cards-grid {
    grid-template-columns: 1fr;
  }

  .kpi-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 9px;
  }

  .kpi-main {
    font-size: 1.18rem;
  }

  .advisor-banner {
    padding: 14px 15px;
  }

  .advisor-headline {
    font-size: 1rem;
  }

  .advisor-action-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }

  /* Clean 2-col grid for the Cashflow Receipt on mobile */
  .receipt-strip {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  .receipt-operator {
    display: none;
  }

  .receipt-item:last-child {
    grid-column: 1 / -1;
    border-top: 1px solid var(--border);
    padding-top: 8px;
  }
}

@media (max-width: 480px) {
  .hide-xs {
    display: none;
  }
  .chart-card {
    padding: 12px 12px;
  }
  .legend-inline {
    gap: 8px;
    font-size: 0.69rem;
  }
}
