#box_main {
  flex-grow: 1;
  min-width: 0;
  padding-top: var(--space-16);
  padding-bottom: var(--space-16);
  padding-left: var(--space-16);
}

/* ── Filter ── */
#box_filter {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  gap: 12px;
}

#btn_set_indicators {
  height: 44px;
}

/* ── Server-rendered first-screen header + summary (SSR seed; JS hides both
   once the K-line hydrates). The dashboard has no analysis-page CSS, so define
   the bits the SSR header/strip need here; the .ssr-summary grid/stat styles
   are shared in css/studio/base.css. ── */
.ssr-head { display: flex; flex-direction: column; margin-bottom: var(--space-12); }
.ssr-head .titlewrap { display: flex; flex-direction: column; gap: var(--space-2); }
.ssr-head .titlewrap h1 { margin: 0; color: var(--ink); }
.ssr-head .titlewrap .meta { font-size: 12px; color: var(--color-greyMedium); }
.ssr-summary.card {
  background: var(--surface-card); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md); padding: var(--space-16);
}
.ssr-summary .card-h h6 { margin: 0; color: var(--ink); }
.ssr-summary .mono { font-family: "Roboto Mono", monospace; font-variant-numeric: tabular-nums; }
.ssr-summary .pos { color: var(--color-greenData); }
.ssr-summary .neg { color: var(--color-redData); }

/* ── Chart container — explicit height (crypto dashboard convention); the
   page scrolls, so the stock nav / CTA below never steal chart height.
   Viewport-aware so the K-line + volume pane fill the screen without the
   chart itself overflowing it; 100vh line is the fallback for no-dvh. ── */
#chart_container {
  width: 100%;
  height: clamp(520px, calc(100vh - 250px), 860px);
  height: clamp(520px, calc(100dvh - 250px), 860px);
  background: var(--surface-card);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

/* studio/base.css (shared with crypto) paints the skeleton and SSR stat divider
   with base tokens; re-declare them on role vars so they follow this page's card. */
.is-wait .skel { background: var(--surface-card); }
.ssr-stat + .ssr-stat { border-left-color: var(--border-hairline); }

/* ── Set Indicators button ── */
#box_chart_toolbar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 8px;
}

.btn_set_indicators {
  height: 40px;
  padding: 0 var(--space-16);
  border: 1px solid var(--border-frame);
  border-radius: var(--radius-md);
  background: transparent;
  font-size: 14px;
  color: var(--ink-2);
  cursor: pointer;
  outline: none;
  white-space: nowrap;
  flex-shrink: 0;
  transition: all var(--motion-fast) ease;
}
.btn_set_indicators:hover {
  background: var(--surface-muted);
}

/* ── Modal sizing ── */
#modal_set_indicators .modal-content {
  width: 350px;
  padding: var(--space-24) var(--space-32);
}

#modal_set_indicators .modal-header {
  padding: 0 0 var(--space-12);
  border: 0px;
  margin-bottom: 16px;
}

#modal_set_indicators .modal-body {
  padding: 0;
}

/* ── Set Indicators modal — mirrors crypto dashboard ── */
#modal_set_indicators .modal-body .box_indicator {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 14px;
  font-family: "Plus Jakarta Sans", sans-serif;
  font-weight: 600;
  margin-bottom: 16px;
  padding-right: var(--space-12);
  cursor: pointer;
  user-select: none;
}

#modal_set_indicators .modal-body .box_indicator:lang(zh),
#modal_set_indicators .modal-body .box_indicator:lang(cn),
#modal_set_indicators .modal-body .box_indicator:lang(ja) {
  font-family: "Noto Sans TC", sans-serif;
  font-weight: 500;
}

#modal_set_indicators .modal-body .box_indicator span {
  display: inline-flex;
  vertical-align: middle;
  width: 22px;
  height: 22px;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-xs);
  margin-right: 8px;
  font-size: 10px;
}

/* Indicator checkboxes carry .form-check-input and eat the global recipe in
   main.css (canon › Components › Checkbox / Radio) — no per-page restyle. */

/* ── Loading / empty ── */
.loader_wrap {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: var(--space-48) 0;
  color: var(--color-greyMedium);
  font-size: 14px;
}

/* ── Range cards grid ── */
#box_range_cards {
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 14px;
}

.rcard.card {
  border: none;
  background: var(--surface-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: var(--space-12) var(--space-16);
}

.rcard-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 10px;
  gap: 6px;
}

.rcard-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-2);
  min-width: 0; /* the figure is the card's point — the title wraps before the value is cut */
  display: block; /* inline flow keeps 1Y after the last word when the title wraps */
}

.rcard-1y {
  font-size: 10px;
  font-weight: 500;
  color: var(--tag-neutral-text);
  background: var(--tag-neutral-bg);
  border-radius: var(--radius-micro);
  display: inline-flex;
  align-items: center;
  height: 18px;
  padding: 0 6px; /* canon Mini tag recipe */
  line-height: 1;
  flex-shrink: 0;
  margin-left: 5px;
  vertical-align: 0.5px; /* glyph-alignment nudge, not a spacing token: 1px pushes the title text onto the next pixel row at 1x (tag/text centre offset up to 1.5px in en); 0.5px keeps that offset ≤0.75px in zh/en at 1x and 2x with the tightest title box */
}

.rcard-1y[hidden] { display: none; }

.rcard-cur {
  font-size: 13px;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  text-align: right;
  flex-shrink: 0;
  white-space: nowrap;
}

.rbar-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: auto; /* .card is a flex column: pin the track to the bottom so a wrapped title doesn't break row alignment */
}

.rbar-val {
  font-size: 13px;
  color: var(--color-greyMedium);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

.rbar-track-wrap {
  flex: 1;
  min-width: 0;
}


.rbar-track {
  position: relative;
  height: 4px;
  background: var(--surface-muted);
  border-radius: 2px;
}

.rbar-fill {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  background: var(--color-primary);
  border-radius: 2px;
  transition: width var(--motion-slow) ease;
}

.rbar-dot {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 9px;
  height: 9px;
  background: var(--color-primary);
  border: 2px solid var(--surface-card);
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  transition: left var(--motion-slow) ease;
}

@media (max-width: 1300px) {
  #box_range_cards { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 768px) {
  #box_range_cards { grid-template-columns: repeat(2, 1fr); }
  .rcard-head { flex-direction: column; align-items: flex-start; gap: var(--space-2); }
  .rcard-cur { text-align: left; }
}

/* ── RWD ── */
@media (max-width: 1300px) {
  #box_main {
    padding-left: 0;
  }
  #chart_container {
    border-radius: var(--radius-lg);
  }
}

@media (max-width: 768px) {
  /* Mobile: filter + 2×2 stacked range cards above eat ~380px, so size the chart to
     what's left of the screen instead of a share of a fixed 660px box. */
  #chart_container {
    height: clamp(420px, calc(100vh - 420px), 620px);
    height: clamp(420px, calc(100dvh - 420px), 620px);
  }
  #btn_stock_select {
    flex: 1;
    min-width: 0;
    max-width: 240px;
  }
  .btn_set_indicators {
    padding: 0 var(--space-12);
    font-size: 12px;
    flex-shrink: 1;
  }
}
