/* Market dashboard: readable figures, semantic color, inspectable metrics. */
:is(#marketIndexSection, .market-standalone) {
  --dashboard-blue: #2456c7;
  --dashboard-purple: #7652bd;
  --dashboard-teal: #087e88;
  --dashboard-amber: #a96d12;
  font-size: calc(16px * var(--ui-font-scale, 1.14));
  line-height: 1.65;
}
:is(#marketIndexSection, .market-standalone) .market-panel {
  margin-top: 22px;
  padding: 22px;
  border: 1px solid #dce4ef;
  border-radius: 16px;
  background: #fff;
}
:is(#marketIndexSection, .market-standalone) h2 { font-size: calc(28px * var(--ui-font-scale, 1.14)); }
:is(#marketIndexSection, .market-standalone) h3 { font-size: calc(21px * var(--ui-font-scale, 1.14)); margin: 4px 0 10px; }
:is(#marketIndexSection, .market-standalone) .section-kicker { font-size: calc(13px * var(--ui-font-scale, 1.14)); color: #45618e; font-weight: 700; }
:is(#marketIndexSection, .market-standalone) .panel-heading p,
:is(#marketIndexSection, .market-standalone) .summary-badge { font-size: calc(14px * var(--ui-font-scale, 1.14)); }
:is(#marketIndexSection, .market-standalone) .market-index-name { font-size: calc(15px * var(--ui-font-scale, 1.14)); }
:is(#marketIndexSection, .market-standalone) .market-index-close { font-size: clamp(calc(27px * var(--ui-font-scale, 1.14)), 2vw, calc(34px * var(--ui-font-scale, 1.14))); font-weight: 750; }
:is(#marketIndexSection, .market-standalone) .market-index-change { font-size: calc(17px * var(--ui-font-scale, 1.14)); }
:is(#marketIndexSection, .market-standalone) .market-index-sub { font-size: calc(14px * var(--ui-font-scale, 1.14)); }
:is(#marketIndexSection, .market-standalone) .market-index-card { padding: 20px; border-radius: 13px; }
:is(#marketIndexSection, .market-standalone) .market-sentiment-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; align-items: start; }
:is(#marketIndexSection, .market-standalone) .market-sentiment-card {
  --metric-color: #2456c7;
  margin: 0;
  padding: 0;
  display: block;
  border: 1px solid color-mix(in srgb, var(--metric-color) 22%, white);
  border-top: 3px solid var(--metric-color);
  background: color-mix(in srgb, var(--metric-color) 5%, white);
  border-radius: 12px;
  transition: transform 180ms ease, box-shadow 180ms ease;
}
:is(#marketIndexSection, .market-standalone) .market-sentiment-card:nth-child(2) { --metric-color: #a96d12; }
:is(#marketIndexSection, .market-standalone) .market-sentiment-card:nth-child(3) { --metric-color: #7652bd; }
:is(#marketIndexSection, .market-standalone) .market-sentiment-card:nth-child(4) { --metric-color: #087e88; }
:is(#marketIndexSection, .market-standalone) .market-sentiment-card:nth-child(5) { --metric-color: #b65335; }
:is(#marketIndexSection, .market-standalone) .market-sentiment-card:nth-child(6) { --metric-color: #526ba0; }
:is(#marketIndexSection, .market-standalone) .market-sentiment-card summary { padding: 18px 20px; cursor: pointer; list-style: none; display: grid; gap: 8px; }
:is(#marketIndexSection, .market-standalone) .market-sentiment-card summary::-webkit-details-marker { display: none; }
:is(#marketIndexSection, .market-standalone) .market-sentiment-card span { font-size: calc(15px * var(--ui-font-scale, 1.14)); color: #40516a; }
:is(#marketIndexSection, .market-standalone) .market-sentiment-card strong { font-size: calc(32px * var(--ui-font-scale, 1.14)); line-height: 1.2; color: var(--metric-color); font-variant-numeric: tabular-nums; }
:is(#marketIndexSection, .market-standalone) .market-sentiment-card small { display: flex; justify-content: space-between; font-size: calc(12px * var(--ui-font-scale, 1.14)); color: #62718b; }
:is(#marketIndexSection, .market-standalone) .market-sentiment-card small b { display: inline-block; transition: transform 180ms ease; }
:is(#marketIndexSection, .market-standalone) .market-sentiment-card[open] small b { transform: rotate(45deg); }
:is(#marketIndexSection, .market-standalone) .market-sentiment-card p { margin: 0; padding: 0 20px 18px; color: #40516a; font-size: calc(14px * var(--ui-font-scale, 1.14)); }
:is(#marketIndexSection, .market-standalone) .market-sentiment-card:hover { transform: translateY(-3px); box-shadow: 0 8px 18px #233f7614; }
:is(#marketIndexSection, .market-standalone) .market-sentiment-card[open] { box-shadow: 0 0 0 2px color-mix(in srgb, var(--metric-color) 16%, white); }
:is(#marketIndexSection, .market-standalone) table { font-size: calc(15px * var(--ui-font-scale, 1.14)); }
:is(#marketIndexSection, .market-standalone) table th { font-size: calc(14px * var(--ui-font-scale, 1.14)); padding: 13px 12px; background: #eef3fc; }
:is(#marketIndexSection, .market-standalone) table td { padding: 13px 12px; }
:is(#marketIndexSection, .market-standalone) table tbody tr { transition: background 160ms ease; }
:is(#marketIndexSection, .market-standalone) table tbody tr:hover { background: #edf4ff; }
:is(#marketIndexSection, .market-standalone) .market-broken-body { overflow-x: auto; }
:is(#marketIndexSection, .market-standalone) .small-button { font-size: calc(14px * var(--ui-font-scale, 1.14)); min-height: 38px; transition: transform 150ms ease, box-shadow 150ms ease, background 150ms ease; }
:is(#marketIndexSection, .market-standalone) .small-button:hover { box-shadow: 0 4px 12px #2456c720; }
:is(#marketIndexSection, .market-standalone) .small-button:active { transform: scale(.95); }
:is(#marketIndexSection, .market-standalone) :is(button, summary, a, input):focus-visible { outline: 3px solid #567ee2; outline-offset: 3px; }
:is(#marketIndexSection, .market-standalone) button:disabled { cursor: wait; opacity: .65; }
.market-stats-notice { grid-column: 1 / -1; padding: 14px 18px; background: #fff6e5; color: #805219; border: 1px solid #efce91; border-radius: 10px; font-size: calc(15px * var(--ui-font-scale, 1.14)); display: flex; gap: 16px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
@media (max-width: 900px) {
  :is(#marketIndexSection, .market-standalone) .market-sentiment-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  :is(#marketIndexSection, .market-standalone) .market-panel { padding: 16px; }
}
@media (max-width: 480px) {
  :is(#marketIndexSection, .market-standalone) .market-sentiment-grid { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  :is(#marketIndexSection, .market-standalone) * { transition: none !important; animation: none !important; }
  :is(#marketIndexSection, .market-standalone) .market-sentiment-card:hover { transform: none; }
}
/* Keep the workspace grid within the viewport as cards and table text grow. */
.main-workspace:has(#marketIndexSection.is-active) { min-width: 0; grid-template-columns: minmax(0, 1fr); }
#marketIndexSection { min-width: 0; }
#marketIndexSection .market-index-hero-heading > * { min-width: 0; }
@media (max-width: 1350px) {
  #marketIndexSection .market-index-hero-heading { grid-template-columns: minmax(0, 1fr); }
  #marketIndexSection .market-index-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 480px) {
  #marketIndexSection .market-index-grid { grid-template-columns: minmax(0, 1fr); }
}
:is(#marketIndexSection, .market-standalone) .market-sentiment-card:not(details) { padding: 18px 20px; display: grid; gap: 8px; }
