/* MU Equity Research Dashboard, stylesheet part 6/7: 06-dcf-mobile-and-dark-overrides.css
   Files load in numeric order; the cascade relies on source order. */
/* ============= DCF + COMPS SLIDE, mobile responsive fixes ============= */

/* Tables inside .calc need to scroll horizontally on all screen sizes */
.calc table.fin {
  display: block;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  max-width: 100%;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
}
.calc table.fin::-webkit-scrollbar { height: 6px; }
.calc table.fin::-webkit-scrollbar-track { background: var(--bg); }
.calc table.fin::-webkit-scrollbar-thumb { background: var(--accent); border-radius: 3px; }

/* Sensitivity heatmap, ensure it scrolls cleanly */
#dcfSens {
  display: block;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  max-width: 100%;
  width: 100%;
}
#dcfSens thead, #dcfSens tbody { white-space: nowrap; }
#dcfSens::-webkit-scrollbar { height: 6px; }
#dcfSens::-webkit-scrollbar-track { background: var(--bg); }
#dcfSens::-webkit-scrollbar-thumb { background: var(--accent); border-radius: 3px; }

/* Comp table chart-card wrapper, explicit scroll container */
#dcf .chart-card {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  max-width: 100%;
}
#dcf .chart-card > table.fin {
  min-width: 760px; /* the 9-column comp table */
}
#dcf .chart-card::-webkit-scrollbar { height: 6px; }
#dcf .chart-card::-webkit-scrollbar-track { background: var(--bg); }
#dcf .chart-card::-webkit-scrollbar-thumb { background: var(--accent); border-radius: 3px; }

/* DCF segment forecast table inside .calc, wide on mobile */
#dcfSegTable { min-width: 520px; }

/* Tablet (<= 900px): tighten DCF layout */
@media (max-width: 900px) {
  /* Stack calc-grid earlier on tablet too */
  #dcf .calc-grid { grid-template-columns: 1fr; gap: 12px; }
  /* Tighten DCF section padding */
  #dcf { padding: 14px 16px 12px; }
  #dcf h3 { font-size: 12px; }
  #dcf p { font-size: 13px; }
  /* DCF tab buttons - compact */
  #dcf .tabs .tab-btn { padding: 7px 12px; font-size: 12px; }
  /* DCF input sliders - tighter */
  #dcf .calc { padding: 12px; }
  #dcf .calc h4 { font-size: 14px; }
  #dcf .calc-row label { font-size: 12px; min-width: 110px; }
  #dcf .calc-row .val-badge { font-size: 12px; min-width: 50px; }
  /* DCF output PT value - smaller */
  #dcf .calc-output .pt-val { font-size: 28px; }
  /* Probability cards in DCF inputs */
  #dcf .prob-card { padding: 8px; }
  #dcf .prob-card .pct { font-size: 20px; }
  #dcf .prob-card .case { font-size: 9px; letter-spacing: 0.5px; }
  /* Reverse DCF KPI grid - 2 cols on tablet */
  #dcf .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  /* DCF thesis-grid stacks */
  #dcf .thesis-grid { grid-template-columns: 1fr; gap: 10px; }
  /* DCF tables - keep horizontal scroll, slightly smaller font */
  #dcf table.fin { font-size: 11px; }
  #dcf table.fin th, #dcf table.fin td { padding: 5px 6px; }
  /* Sensitivity heatmap on tablet */
  #dcfSens td { padding: 7px 5px; font-size: 11px; }
}

/* Phone (<= 600px): even more compact */
@media (max-width: 600px) {
  #dcf { padding: 12px 12px 10px; }
  #dcf h2 { font-size: 16px; }
  #dcf .sub { font-size: 10px; margin-bottom: 8px; }
  #dcf p { font-size: 12px; line-height: 1.5; }
  /* DCF tab buttons - scroll horizontally as full-flex row */
  #dcf .tabs { overflow-x: auto; flex-wrap: nowrap; }
  #dcf .tabs .tab-btn { padding: 7px 10px; font-size: 11px; white-space: nowrap; flex-shrink: 0; }
  /* DCF calculator more compact */
  #dcf .calc { padding: 10px; }
  #dcf .calc h4 { font-size: 13px; }
  #dcf .calc .sub-lbl { font-size: 9px; margin-bottom: 8px; }
  #dcf .calc-row { gap: 6px; margin: 6px 0; }
  #dcf .calc-row label { font-size: 11px; min-width: 95px; }
  #dcf .calc-row .val-badge { font-size: 11px; min-width: 45px; }
  #dcf .calc-row input[type="range"] { height: 24px; }
  #dcf .calc-output { padding: 10px; margin-top: 10px; }
  #dcf .calc-output .pt-val { font-size: 24px; }
  #dcf .calc-output .pt-lbl { font-size: 9px; }
  #dcf .calc-output .pt-delta { font-size: 11px; }
  #dcf .prob-matrix { grid-template-columns: repeat(3, 1fr); gap: 5px; }
  #dcf .prob-card { padding: 6px 4px; }
  #dcf .prob-card .pct { font-size: 16px; }
  #dcf .prob-card .case { font-size: 8px; }
  /* DCF KPI grid - keep 2 cols on phone */
  #dcf .kpi-grid { grid-template-columns: repeat(2, 1fr); gap: 5px; }
  #dcf .kpi { padding: 7px 9px; }
  #dcf .kpi .val { font-size: 14px; }
  #dcf .kpi .lbl { font-size: 9px; }
  #dcf .kpi .delta { font-size: 9px; }
  /* DCF tables: ensure all scroll */
  #dcf table.fin { font-size: 10.5px; }
  #dcf table.fin th, #dcf table.fin td { padding: 4px 5px; }
  /* Sensitivity heatmap on phone - tiny but readable */
  #dcfSens { font-size: 10px; }
  #dcfSens td { padding: 5px 4px; font-size: 10px; }
  /* Thesis valuation verdict cards stacked */
  #dcf .thesis { padding: 10px 12px; }
  #dcf .thesis h4 { font-size: 14px; }
  #dcf .thesis p { font-size: 11.5px; line-height: 1.5; }
  /* Section heading inside DCF */
  #dcf .chart-card { padding: 8px 8px 10px; }
  #dcf .chart-card .footnote { font-size: 10px; }

  /* --- Variant-B header (DCF-era dashboards: the slide-nav + theme/mode/print/
     tour controls live INSIDE the header). On phones the ~9-button control row
     wrapped into a cluttered grid and the "1 / 14" slide counter broke across
     two lines. Tidy it: keep the slide-nav group on one line, declutter the
     desktop-only print control, and give the buttons a consistent compact size. */
  /* The header is a single non-wrapping flex line on desktop (overflow:auto).
     On phones, allow it to wrap so the control cluster can drop to its own full
     line (below) instead of overflowing into a clipped horizontal scroll. */
  header.top { flex-wrap: wrap; overflow: visible; }
  header.top .top-row { row-gap: 5px; align-items: center; }
  header.top #slideCounter { white-space: nowrap; font-size: 12px; padding: 0 2px; }
  header.top .slide-nav { flex-wrap: nowrap; gap: 6px; align-items: center; }
  header.top #printBtn { display: none; }            /* print/PDF is a desktop affordance */
  header.top .toggle-btn { padding: 5px 8px; font-size: 11px; }
  header.top #tourBtn { padding: 5px 9px; }
  /* Put the whole control cluster on its OWN single row. It was wrapping into a
     3-row block (what made the header tall + cluttered); squeezing it onto the
     ribbon line left it only ~110px, hiding even the Next-slide button behind a
     scroll. Giving it flex-basis:100% drops it to a full-width line (~328px
     usable) where the ~300px cluster fits whole, every control visible, no
     scroll on normal phones. overflow-x:auto is a safety net for <340px phones.
     Targeted via the control row's inline margin-left:auto (the ticker row
     doesn't have it), no :has() needed. */
  header.top .top-row[style*="margin-left:auto"]{
    flex: 1 0 100%;
    flex-wrap: nowrap;
    justify-content: flex-start;
    margin-left: 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
    scrollbar-width: none;
  }
  header.top .top-row[style*="margin-left:auto"]::-webkit-scrollbar{ display: none; }
}

/* Very narrow (<= 380px) */
@media (max-width: 380px) {
  #dcf .kpi-grid { grid-template-columns: 1fr; }
  #dcf .prob-card .pct { font-size: 14px; }
  #dcf .calc-output .pt-val { font-size: 20px; }
  #dcf .calc-row label { min-width: 80px; font-size: 10px; }
}

/* (scroll-hint gradient removed, replaced by clean table system below) */


/* Dark mode: ensure headers/navs stay visible */
body.dark header.top {
  background: #16130E !important;
  border-bottom-color: var(--accent);
  color: var(--ink);
}
body.dark header.top .ticker { color: var(--ink); }
body.dark header.top .company { color: var(--muted); }
body.dark header.top .ribbon .lbl { color: var(--muted); }
body.dark header.top .ribbon .val { color: var(--ink); }
body.dark header.top .ribbon .pos { color: var(--green) !important; }
body.dark header.top .ribbon .neg { color: var(--red) !important; }
body.dark header.top .stamp { color: var(--muted); opacity: 1; }  /* full --muted reads >=4.5:1; the global .stamp opacity:.65 dropped it to 3.7 */
body.dark header.top .stamp strong { color: var(--accent-bright); }

/* Slide nav and progress bar in dark mode */
body.dark .slide-nav { background: #16130E !important; border-top-color: var(--accent); }
body.dark .slide-nav-btn:disabled { background: #322B20 !important; color: #6a6e75 !important; }
body.dark .slide-progress-bar { background: rgba(196,85,118,0.18); }

/* Hamburger toggle in dark mode */
body.dark .menu-toggle { background: var(--accent); color: var(--on-accent); }

/* Body background in dark mode */
body.dark { background: var(--bg); color: var(--ink); }

/* Sidebar nav links in dark mode */
body.dark nav.side a { color: var(--ink); }
body.dark nav.side a.active { background: var(--accent-soft); color: var(--accent); border-left-color: var(--accent); }
body.dark nav.side a:hover { background: var(--accent-soft); }
body.dark nav.side .nav-num { color: var(--muted); }

/* Section block text in dark mode - make sure all text is readable */
body.dark section.block { background: var(--panel); color: var(--ink); }
body.dark section.block h2 { color: var(--accent); }
body.dark section.block h3 { color: var(--ink); border-bottom-color: var(--line); }
body.dark section.block p, body.dark section.block li, body.dark section.block td { color: var(--ink); }
body.dark section.block .sub { color: var(--muted); }
body.dark section.block .footnote { color: var(--muted); }

/* KPI text colors */
body.dark .kpi .lbl { color: var(--muted); }
body.dark .kpi .val { color: var(--ink); }
body.dark .kpi .delta { color: var(--muted); }
body.dark .kpi.accent { background: linear-gradient(135deg, #2a1820 0%, #3a1f2a 100%); }
body.dark .kpi.accent .val { color: var(--accent); }

/* Table text colors */
body.dark table.fin { color: var(--ink); }
body.dark table.fin thead th { background: #322B20; color: var(--ink); border-bottom-color: var(--line); }
body.dark table.fin td { border-bottom-color: var(--line); }
body.dark table.fin tbody tr:nth-child(even) { background: rgba(255,255,255,0.02); }
body.dark table.fin .pos { color: var(--green); }
body.dark table.fin .neg { color: var(--red); }

/* Tabs */
body.dark .tabs { border-bottom-color: var(--line); }
body.dark .tab-btn { color: var(--muted); }
body.dark .tab-btn:hover { color: var(--ink); }
body.dark .tab-btn.active { color: var(--accent); border-bottom-color: var(--accent); }

/* Calc rows / inputs */
body.dark .calc-row label { color: var(--ink); }
body.dark .calc-row .val-badge { color: var(--accent); }
body.dark .calc-output { background: #2A241B; border-color: var(--accent); }
body.dark .calc-output .pt-val { color: var(--accent); }
body.dark .calc-output .pt-lbl { color: var(--muted); }
body.dark .calc-output .pt-delta { color: var(--ink); }
body.dark .rr-cell { background: #2A241B; color: var(--ink); border-color: var(--line); }
body.dark .rr-cell .lbl { color: var(--muted); }

/* Roadmap timeline */
body.dark .roadmap { background: #251F16; border-color: var(--line); }
body.dark .roadmap-row.header { color: var(--muted); border-bottom-color: var(--line); }
body.dark .roadmap-row .label-cell { color: var(--ink); }
body.dark .roadmap-bar { background: #322B20; }

/* Toggle buttons (chart overlay toggles) */
body.dark .toggle-btn { background: #2A241B; color: var(--muted); border-color: var(--line); }
body.dark .toggle-btn.on { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
body.dark .toggle-btn:hover { border-color: var(--accent); color: var(--ink); }

/* Risk cards */
body.dark .risk-card { background: #2A241B; }
body.dark .risk-card h5 { color: var(--ink); }
body.dark .risk-card p { color: var(--muted); }

/* Thesis cards, dark-mode palette now lives in 01-base.css (IIL brand moment). */

/* Sources section */
body.dark .sources { background: var(--panel); color: var(--ink); }
body.dark .sources h2 { color: var(--accent); }
body.dark .sources a { color: var(--accent); }
body.dark .sources a:hover { color: #fff; }

/* Data gaps callout */
body.dark .data-gaps { background: rgba(217,164,67,0.10); color: var(--ink); border-left-color: var(--amber); }
body.dark .data-gaps strong { color: var(--amber); }

/* Top controls cluster in dark mode */
body.dark .top-controls { background: rgba(26,29,35,0.92); border-color: var(--line); }
body.dark .top-controls button { color: var(--ink); }
body.dark .top-controls button:hover { background: var(--accent); color: var(--on-accent); }
body.dark .top-controls button.active { background: var(--accent); color: var(--on-accent); }
body.dark .top-controls button::after { background: var(--ink); color: var(--bg); }

/* Probability cards */
body.dark .prob-card.bull { background: rgba(78,200,114,0.15); color: var(--green); }
body.dark .prob-card.base { background: rgba(217,164,67,0.15); color: var(--accent-bright); }
body.dark .prob-card.bear { background: rgba(236,104,104,0.15); color: var(--red); }

/* Footer in dark mode */
body.dark footer.site-footer { background: #100D08; color: var(--muted); }
body.dark footer.site-footer h5 { color: var(--accent-bright); }
body.dark footer.site-footer p, body.dark footer.site-footer li { color: var(--muted); }

/* Overview mode in dark mode */
body.dark .overview-grid { background: var(--bg); }
body.dark .ov-card { background: var(--panel); border-color: var(--line); color: var(--ink); }
body.dark .ov-card:hover { border-color: var(--accent); }
body.dark .ov-card.current { box-shadow: 0 0 0 2px var(--accent), var(--shadow-md); }
body.dark .ov-num { color: var(--accent); }
body.dark .ov-card .ov-title { color: var(--ink); }
body.dark .ov-card .ov-tag { color: var(--muted); }
body.dark .ov-hint { background: var(--panel); color: var(--muted); }
body.dark .overview-grid h2 { color: var(--accent); }

/* Heatmap cells in dark mode - slightly darker for legibility */
body.dark #dcfSens td:first-child { background: #322B20; color: var(--ink); }


