/* layout.css -- the C1 shell. Region heights are fixed constants: a mode
   change swaps the dock's *contents*, never any region's height, so nothing
   below the top bar ever reflows. That is the fix for the old #controls row,
   which grew by a line whenever Backtest was switched on. */

#rail {
  flex: 0 0 var(--w-rail);
  display: flex; flex-direction: column; align-items: center;
  gap: var(--sp-1); padding: var(--sp-1) 0;
  background: var(--chrome); border-right: 1px solid var(--border);
  z-index: 40;
}
.rail-btn {
  width: var(--tap); height: var(--tap);
  display: flex; align-items: center; justify-content: center;
  font-size: var(--fs-md); color: var(--muted);
  background: var(--panel); border: none; border-radius: var(--radius);
  cursor: pointer;
}
.rail-btn.active { background: var(--border); color: var(--text); box-shadow: inset 2px 0 0 var(--accent); }
.rail-btn-last { margin-top: auto; }
.rail-btn[hidden] { display: none; }

#shell { flex: 1 1 auto; display: flex; flex-direction: column; min-width: 0; min-height: 0; }

#topBar {
  flex: 0 0 var(--h-topbar); position: relative;
  display: flex; align-items: center; gap: var(--sp-2);
  padding: 0 var(--sp-4); box-sizing: border-box;
  background: var(--chrome); border-bottom: 1px solid var(--border);
}
#topBarSpacer { flex: 1 1 auto; }
#status { color: var(--muted); font-size: var(--fs-sm); min-width: 70px; }

#tickerBtn {
  min-width: 240px; max-width: 340px; height: 44px; min-height: 0; padding: 0 var(--sp-3);
  display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2);
  font: inherit; font-size: var(--fs-md); font-weight: 600;
  color: var(--text); background: var(--panel);
  border: 1px solid var(--border); border-radius: var(--radius); cursor: pointer;
}
#tickerBtnName { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#cutoff {
  padding: 0 var(--sp-2); font: inherit; color: var(--text);
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
}
.ctrl-select {
  padding: 0 var(--sp-2); font: inherit; font-size: var(--fs-base);
  color: var(--text); background: var(--panel);
  border: 1px solid var(--border); border-radius: var(--radius);
}
#timeframeSelect { min-width: 96px; }
#indexSelect { min-width: 150px; }

.mode-pill {
  padding: 0 var(--sp-3); font: inherit; font-size: var(--fs-base); font-weight: 600;
  color: var(--muted); background: var(--panel);
  border: 1px solid var(--border); border-radius: var(--radius); cursor: pointer;
}
.mode-pill[aria-pressed="true"] {
  color: var(--accent); border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 14%, transparent);
}

/* Screening progress rides the top bar's bottom edge -- visible without
   costing a row, and gone the moment the request finishes. */
#screenProgress {
  display: none; position: absolute; left: 0; right: 0; bottom: -1px;
  width: 100%; height: 2px; border: none; background: transparent;
  accent-color: var(--accent);
}
#screenProgress.visible { display: block; }

#tabRow {
  flex: 0 0 var(--h-tabs); display: flex; padding: 0 var(--sp-4); box-sizing: border-box;
  background: var(--chrome); border-bottom: 1px solid var(--border);
}
#tabRow .tab {
  padding: 0 var(--sp-5); font: inherit; font-size: var(--fs-base); font-weight: 600;
  color: var(--muted); background: none; border: none;
  border-bottom: 2px solid transparent; cursor: pointer; min-height: 0;
}
#tabRow .tab.active { color: var(--text); border-bottom-color: var(--accent); }
body.no-fundamentals #tabRow .tab[data-tab="fundamentals"] { display: none; }

.pane { display: none; }
.pane.active { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; }

#dock {
  flex: 0 0 var(--h-dock); position: relative;
  display: flex; align-items: center; gap: var(--sp-2);
  padding: 0 var(--sp-4); box-sizing: border-box;
  background: var(--chrome); border-top: 1px solid var(--border);
  overflow-x: auto; overflow-y: hidden; scrollbar-width: thin;
}
.dock-group { display: none; align-items: center; gap: var(--sp-2); width: 100%; }
/* The backtest row is the widest, and at 1440px it fits with only a few px to
   spare (which is why two of the six outcome figures already live behind
   #btOutMore). Nothing wraps -- the dock's height is fixed so the chart never
   reflows -- so give it a scroll instead: a longer benchmark name or a wider
   reveal-status string then costs a swipe rather than silently clipping the
   controls off the right edge. min-width:0 lets the flex item actually shrink. */
.dock-group.active { display: flex; }
.dock-group > * { flex-shrink: 0; }
.dock-spacer { flex: 1 1 auto; }
#dock .ctrl-select { min-height: 0; height: 34px; }
#dock button, .dock-btn {
  min-height: 0; min-width: var(--tap); height: 40px; padding: 0 var(--sp-3);
  font: inherit; font-size: var(--fs-md); color: var(--text); background: var(--panel);
  border: 1px solid var(--border); border-radius: var(--radius); cursor: pointer;
}
#dock button:disabled, .dock-btn:disabled { opacity: 0.35; cursor: default; }
.dock-readout { font-size: var(--fs-base); color: var(--muted); white-space: nowrap; }
#dockPrice { color: var(--text); font-weight: 600; }
.dock-chg-up { color: var(--up); }
.dock-chg-down { color: var(--down); }
#addToWatchlistGroup { display: flex; align-items: center; gap: var(--sp-2); }
#addToWatchlistSelect { padding: 0 var(--sp-2); font: inherit; color: var(--text); background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); }
#addToWatchlistStatus, #revealStatus { font-size: var(--fs-sm); color: var(--muted); }
.bt-muted { color: var(--muted); font-size: var(--fs-micro); }
