/* Dashboard layout v2 (DASHBOARD_LAYOUT_V2, 20/11). Linked ONLY when the server
   enables it (views/dashboard.pug / demo.pug, block headExtra). */

/* Badge: active card only, on its own line under the gauge box, aligned to
   the right, touching no border (decision 20/11, replaces the corner badge).
   The active card is one badge line taller; the inset shadow does not change
   its size. */
.results-card [data-capture="gauge"][data-rule-applies="true"] {
  box-shadow: inset 0 0 0 1px rgba(212, 175, 55, 0.55);
}
.results-card [data-capture="gauge"] .rule-badge {
  display: block;
  width: fit-content;
  max-width: calc(100% - 8px);
  margin: 6px 4px 2px auto;
  padding: 2px 8px;
  border-radius: 999px;
  background: #d4af37;          /* #1a1a1a text on it: 8.3:1 (AA) */
  color: #1a1a1a;
  font-size: 11px;
  font-weight: 600;
  line-height: 16px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* TradingView chart on desktop (> 768 px): sticky (decision 20/11). The left
   grid cell still stretches to the right column's height (the sticky card
   needs that room to move in); the card itself takes its own height and stays
   in view while scrolling. No top bar is fixed on this page (the site header
   scrolls away), so the card sticks 16 px from the top of the viewport.
   Chart height = min(600 px, viewport - 16 px top - 16 px bottom margin -
   58 px card title/padding), never under 400 px. Mobile is untouched (auto
   mode hides the chart; manual mode keeps its own height). */
@media screen and (min-width: 769px) {
  .dashboard-grid .chart-card {
    position: sticky;
    top: 16px;
    align-self: start;
    height: auto !important;
  }
  .dashboard-grid .chart-card #tradingview-widget {
    height: clamp(400px, calc(100vh - 16px - 16px - 58px), 600px) !important;
  }
}

/* Capture mode (22/11): the bot sets html[data-capture-layout="full"] before
   a full_page screenshot, which does not scroll, so the sticky card would
   leave a gap under the chart. With the attribute, desktop only: the card is
   not sticky and stretches to the full height of the left grid cell (= the
   grid row = the right column); #tradingview-widget fills the card under its
   title (the iframe is already 100 % of it, #52). Without the attribute
   nothing changes. */
@media screen and (min-width: 769px) {
  html[data-capture-layout="full"] .dashboard-grid .chart-card {
    position: static;
    align-self: stretch;
    height: auto !important;
    display: flex;
    flex-direction: column;
  }
  html[data-capture-layout="full"] .dashboard-grid .chart-card #tradingview-widget {
    flex: 1 1 auto;
    min-height: 0;
    height: auto !important;
  }
}
