.copy-tip { cursor: help; }

/* Markets page: a tidy summary panel above the table. */
label[for="marketApyFilter"] { display: none !important; }

#marketMetrics {
  display: grid !important;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0;
  margin: 16px 0 20px;
  padding: 0;
  border: 1px solid var(--sc-border, #d5d9d8);
  border-radius: 12px;
  background: var(--sc-surface, #ffffff);
  overflow: hidden;
}
#marketMetrics:empty,
#marketMetrics > :empty { display: none !important; }

#marketMetrics > .market-metric {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  padding: 18px 20px;
  border-right: 1px solid var(--sc-border, #d5d9d8);
  border-bottom: 1px solid var(--sc-border, #d5d9d8);
}
#marketMetrics > .market-metric:last-child { border-right: 0; }

#marketMetrics > .market-metric > span {
  color: var(--sc-ink-2, #526167);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
}
#marketMetrics > .market-metric > strong {
  color: var(--sc-ink, #182126);
  font-size: clamp(20px, 2.4vw, 26px);
  font-weight: 700;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
}
#marketMetrics > .market-metric > small {
  color: var(--sc-ink-2, #526167);
  font-size: 12px;
  line-height: 1.35;
}

@media (max-width: 600px) {
  #marketMetrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #marketMetrics > .market-metric { padding: 14px 16px; }
  #marketMetrics > .market-metric:nth-child(2n) { border-right: 0; }
  #marketMetrics > .market-metric:nth-child(-n+2) { border-bottom: 1px solid var(--sc-border, #d5d9d8); }
  #marketMetrics > .market-metric:nth-child(n+3) { border-bottom: 0; }
}

/* Markets list: centered layout, clean table, nothing clipped. */
html[data-markets-list] main#appView {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 24px 64px;
}
html[data-markets-list] #stockListPanel,
html[data-markets-list] #marketlist { min-width: 0; overflow-x: auto; }
html[data-markets-list] table.table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 14px;
}
html[data-markets-list] table.table th {
  padding: 12px 16px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-align: left;
  white-space: nowrap;
  color: var(--sc-ink-2, #8a98ab);
  border-bottom: 1px solid var(--line, #283247);
}
html[data-markets-list] table.table td {
  padding: 16px;
  vertical-align: middle;
  border-bottom: 1px solid var(--line, #283247);
}
html[data-markets-list] table.table tbody tr:hover td { background: rgba(127, 147, 176, 0.06); }
html[data-markets-list] table.table th:last-child,
html[data-markets-list] table.table td:last-child { text-align: right; }
/* Markets page uses the full screen width. */
html[data-markets-list] main#appView,
html[data-markets-list] .app-shell {
  max-width: none !important;
  width: 100%;
  padding: 24px 32px 64px !important;
  margin: 0 !important;
}

/* Summary: a small single row of four figures. TVL is removed from this panel. */
#marketMetrics .market-metric[hidden],
#marketMetrics #totalStockTvl[hidden],
#totalStockTvl[hidden] { display: none !important; }
.app-mode #marketMetrics {
  display: grid !important;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)) !important;
  max-width: 820px !important;
  margin: 12px 0 16px !important;
}
.app-mode #marketMetrics > .market-metric { padding: 10px 14px !important; }
.app-mode #marketMetrics > .market-metric > strong { font-size: 16px !important; }
.app-mode #marketMetrics > .market-metric > span { font-size: 11px !important; }
.app-mode #marketMetrics > .market-metric > small { font-size: 10px !important; }
.app-mode #marketMetrics > .market-metric,
.app-mode #marketMetrics #totalStockTvl { grid-column: auto !important; width: auto !important; }
.app-mode #marketMetrics > .liquidity-hero { grid-column: 1 / -1 !important; width: auto !important; }

/* Summary as a flex panel: liquidity on top, the other figures share the row below. */
html[data-production-route] body.app-mode #marketMetrics,
html[data-production-route][data-markets-list] body.app-mode:not(.stock-detail-mode) #marketMetrics,
.app-mode #marketMetrics {
  display: flex !important;
  flex-wrap: wrap !important;
  grid-template-columns: none !important;
  width: 100% !important;
  max-width: 820px !important;
}
.app-mode #marketMetrics > .market-metric {
  flex: 1 1 0 !important;
  min-width: 140px !important;
  width: auto !important;
  grid-column: auto !important;
  box-sizing: border-box !important;
}
.app-mode #marketMetrics > .liquidity-hero { flex: 1 1 0 !important; }
.app-mode #marketMetrics {
  max-width: 600px !important;
  margin: 12px 0 16px !important;
  border-radius: 10px !important;
}
.app-mode #marketMetrics > .market-metric {
  padding: 10px 14px !important;
  min-width: 0 !important;
}
.app-mode #marketMetrics > .market-metric > strong { font-size: 17px !important; }
.app-mode #marketMetrics > .market-metric:empty,
.app-mode #marketMetrics > .market-metric:has(strong:empty) { display: none !important; }

/* Summary: compact. Empty volume slot is hidden; liquidity shares the top row only when volume has a value. */
.app-mode #marketMetrics > .market-volume:not(:has(strong:not(:empty))) { display: none !important; }
.app-mode #marketMetrics > .market-metric:nth-child(1),
.app-mode #marketMetrics > .liquidity-hero { grid-column: 1 / -1 !important; width: auto !important; }
.app-mode #marketMetrics > .liquidity-hero { border-right: 0 !important; }
.app-mode #marketMetrics:has(> .market-volume:has(strong:not(:empty))) > .market-metric:nth-child(1) { grid-column: span 3 !important; }
.app-mode #marketMetrics:has(> .market-volume:has(strong:not(:empty))) > .market-volume { grid-column: span 3 !important; }
.app-mode #marketMetrics > :not(.market-metric):not(.summary-count) { display: none !important; }
html[data-markets-list] #appView .app-heading {
  display: flex !important;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
}
html[data-markets-list] #appView .app-heading > div:first-child { flex: 1 1 320px; min-width: 0; }
html[data-markets-list] #appView .app-heading > #marketMetrics > .market-metric { padding: 18px 18px !important; min-height: 104px; }
html[data-markets-list] #appView .app-heading > #marketMetrics > .market-metric > strong { font-size: 16px !important; white-space: nowrap; }
html[data-markets-list] #appView .app-heading > #marketMetrics {
  flex: 1 1 100% !important;
  width: 100% !important;
  max-width: none !important;
  height: auto !important;
  align-self: flex-start !important;
  align-content: flex-start !important;
  margin: 4px 0 0 0 !important;
}
@media (max-width: 900px) {
  html[data-markets-list] #appView .app-heading > #marketMetrics { max-width: none !important; }
  html[data-markets-list] #appView .app-heading > div:first-child > p:not(.feed-status):not(.section-label) { display: none !important; }
  html[data-markets-list] #appView .app-heading { height: auto !important; min-height: 0 !important; display: block !important; }
  html[data-markets-list] #appView .app-heading > #marketMetrics { flex: 1 1 100% !important; width: 100% !important; max-width: 100% !important; margin: 16px 0 0 !important; }
  .app-mode #marketMetrics > .market-metric { flex: 1 1 45% !important; min-width: 0 !important; }
  .app-mode #marketMetrics > .liquidity-hero { flex: 1 1 100% !important; }
  .app-mode #marketMetrics > .market-metric > strong { font-size: 18px !important; }
}
.app-mode #marketMetrics > .summary-count {
  display: block !important;
  flex: 1 1 100% !important;
  margin: 0 !important;
  padding: 10px 14px !important;
  font-size: 12px !important;
  color: var(--sc-ink-2, #526167) !important;
  text-align: right;
  border-bottom: 1px solid var(--line, #d7ded7) !important;
  background: transparent !important;
}
.app-mode #marketMetrics { margin: 12px 0 16px !important; }
.app-mode #marketMetrics > .market-metric { padding: 12px 16px !important; gap: 4px !important; }
.app-mode #marketMetrics .market-metric > span { font-size: 12px !important; }
.app-mode #marketMetrics .market-metric > strong { font-size: 18px !important; margin: 2px 0 0 !important; }
.app-mode #marketMetrics .market-metric > small { font-size: 11px !important; }

/* Search and sort: one clean field each, no doubled borders. */
html[data-markets-list] .search-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line, #283247);
  border-radius: 8px;
  background: transparent;
  min-width: 260px;
}
html[data-markets-list] .search-wrap input {
  flex: 1;
  min-width: 0;
  border: 0 !important;
  outline: none;
  background: transparent;
  box-shadow: none;
  color: inherit;
  font: inherit;
}
html[data-markets-list] .search-wrap:focus-within { border-color: var(--sc-accent, #7ea2ff); }
html[data-markets-list] .toolbar select {
  height: 40px;
  min-width: 200px;
  padding: 0 32px 0 12px;
  border-radius: 8px;
}

/* Phone: two even columns, with available liquidity across the full top row. */
@media (max-width: 760px) {
  html[data-markets-list] #marketMetrics { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  html[data-markets-list] #marketMetrics > .liquidity-hero { grid-column: 1 / -1 !important; }
  html[data-markets-list] #marketMetrics > .market-metric { padding: 12px 14px !important; min-height: 0 !important; }
}
/* Summary box: older per-tile borders are cleared, so only the even grid dividers show. */
html body.app-mode #marketMetrics > .market-metric:nth-child(n) {
  border: 0 !important;
  background: var(--p, #ffffff) !important;
  margin: 0 !important;
}
html body.app-mode #marketMetrics {
  background: var(--line, #d7ded7) !important;
  gap: 1px !important;
  border: 1px solid var(--line, #d7ded7) !important;
}
html body.app-mode #appView .app-heading > #marketMetrics {
  width: min(780px, 100%) !important;
  max-width: min(780px, 100%) !important;
  flex: 0 0 auto !important;
}
/* Summary box, clean at every width: even dividers, compact on medium screens. */
html[data-markets-list] #marketMetrics {
  display: grid !important;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)) !important;
  gap: 1px !important;
  background: var(--line, #d7ded7) !important;
  border: 1px solid var(--line, #d7ded7) !important;
  border-radius: 12px !important;
  overflow: hidden !important;
  width: 100% !important;
  max-width: 100% !important;
  padding: 0 !important;
}
html[data-markets-list] #marketMetrics > .market-metric {
  background: var(--p, #ffffff) !important;
  border: 0 !important;
  border-radius: 0 !important;
  margin: 0 !important;
  padding: 14px 16px !important;
  min-width: 0 !important;
  width: auto !important;
  grid-column: auto !important;
}
html[data-markets-list] #marketMetrics > .liquidity-hero { grid-column: auto !important; }
@media (max-width: 1200px) {
  html[data-markets-list] #appView .app-heading > #marketMetrics { max-width: 560px !important; flex: 0 0 auto !important; }
}

/* Markets list at every width: one aligned toolbar, consistent cards and spacing. */
html[data-markets-list] .market-toolbar {
  display: grid !important;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 12px 16px;
  height: auto !important;
  padding: 14px 0 16px !important;
}
html[data-markets-list] .market-toolbar .toolbar { flex-wrap: nowrap !important; }
html[data-markets-list] .market-toolbar .search-wrap { flex: 1 1 0 !important; min-width: 120px !important; max-width: none !important; }
html[data-markets-list] .market-toolbar .toolbar select { flex: 0 0 auto !important; width: 180px; }
html[data-markets-list] .market-toolbar .toolbar .refresh { flex: 0 0 auto !important; }
@media (max-width: 760px) {
  html[data-markets-list] .market-toolbar { grid-template-columns: 1fr; gap: 10px; padding: 10px 0 12px !important; }
  /* Search, sort and refresh share one compact row. */
  html[data-markets-list] .market-toolbar .toolbar { flex-wrap: nowrap !important; gap: 8px !important; }
  html[data-markets-list] .market-toolbar .search-wrap { flex: 1 1 0 !important; min-width: 0 !important; height: 36px !important; padding: 0 10px !important; }
  html[data-markets-list] .market-toolbar .search-wrap input { font-size: 13px !important; }
  html[data-markets-list] .market-toolbar .toolbar select { width: 132px !important; min-width: 0 !important; height: 36px !important; font-size: 13px !important; padding: 0 26px 0 10px !important; }
  html[data-markets-list] .market-toolbar .toolbar .refresh { height: 36px !important; padding: 0 10px !important; font-size: 13px !important; }
}
html[data-markets-list] .market-toolbar > .explore-switch { flex: 0 0 auto; }
html[data-markets-list] .market-toolbar .toolbar {
  flex: 1 1 320px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  min-width: 0;
}
html[data-markets-list] .toolbar .search-wrap { flex: 1 1 200px; min-width: 160px; max-width: 360px; }
html[data-markets-list] .toolbar select,
html[data-markets-list] .toolbar .refresh { height: 42px; }
html[data-markets-list] .toolbar select { flex: 0 0 auto; min-width: 180px; }
html[data-markets-list] #marketlist { width: 100%; }
/* While market data loads, show a visible message instead of an empty area. */
html[data-markets-list] #marketlist .empty {
  min-height: 180px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--sc-ink-2, #526167);
  font-size: 14px;
}
html[data-markets-list] #marketlist .empty::before {
  content: "Loading live markets…";
}
html[data-markets-list] #marketlist .empty:has(.glyph)::before { content: none; }
/* Once markets are shown, the loading placeholder takes no space at all. */
html[data-markets-list] #marketlist:has(a[href^="#/market/"]) .empty,
html[data-markets-list] #marketlist:has(table.table tbody tr) .empty,
html[data-markets-list] #marketlist:has(.market-card) .empty {
  display: none !important;
  min-height: 0 !important;
}

/* Markets list: the borrowing-risk note is removed, and the toolbar sits directly above the table. */
html[data-markets-list] .market-risk-note { display: none !important; }
html[data-markets-list] #stockListPanel .market-toolbar { margin-bottom: 20px; }

/* Markets list: the unlabeled utilization bars were confusing next to Lend APY, so they are hidden. */
html[data-markets-list] .market-utilization { display: none !important; }

/* Markets list: remove the extra filter rows, keeping search, sort and the risk note. */
html[data-markets-list] .hide-full-control,
html[data-markets-list] .market-filterbar { display: none !important; }

/* Header: the language picker must not overlap the menu. */
html body .site-header { gap: 12px; }
html body .site-nav { flex-shrink: 1; min-width: 0; overflow: hidden; }
html body .header-actions { flex-shrink: 0; gap: 8px; }
html body .language-control select { width: 84px; }

/* Toolbar: one row of tabs, search and sort, with the sort text fully visible. */
html[data-markets-list] .market-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
html[data-markets-list] .market-toolbar .toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
html[data-markets-list] .search-wrap { min-width: 220px; flex: 1 1 220px; }
html[data-markets-list] .toolbar select { min-width: 190px; padding-right: 28px; }
html[data-markets-list] .toolbar .refresh { white-space: nowrap; }

/* Table fits the page: fixed column widths, no sideways scrolling, nothing cut off. */
html[data-markets-list] #marketlist { overflow-x: visible; }
html[data-markets-list] #marketlist table.table { table-layout: fixed; min-width: 0; width: 100%; }
html[data-markets-list] table.table th:nth-child(1),
html[data-markets-list] table.table td:nth-child(1) { width: 26%; padding-left: 0; }
html[data-markets-list] table.table th:nth-child(2),
html[data-markets-list] table.table td:nth-child(2) { width: 14%; }
html[data-markets-list] table.table th:nth-child(3),
html[data-markets-list] table.table td:nth-child(3) { width: 12%; }
html[data-markets-list] table.table th:nth-child(4),
html[data-markets-list] table.table td:nth-child(4) { width: 18%; white-space: nowrap; }
html[data-markets-list] table.table th:nth-child(5),
html[data-markets-list] table.table td:nth-child(5) { width: 12%; }
html[data-markets-list] table.table th:nth-child(6),
html[data-markets-list] table.table td:nth-child(6) { width: 18%; white-space: nowrap; }
html[data-markets-list] table.table td:nth-child(6) a,
html[data-markets-list] table.table td:nth-child(6) button { white-space: nowrap; }
html[data-markets-list] table.table td:nth-child(4) > *,
html[data-markets-list] table.table td:nth-child(4) span { margin-left: 6px; }
html[data-markets-list] table.table td:nth-child(4) span:first-child { margin-left: 0; }
html[data-markets-list] table.table td { padding: 14px 12px; }

/* Summary panel: liquidity spans the full top row when there is no volume figure, so no empty block. */
.app-mode #marketMetrics > .market-metric:first-child:not(:has(+ .market-volume)) { grid-column: span 6 !important; }
.app-mode #marketMetrics > .market-volume { grid-column: span 3 !important; }

/* Numeric columns: right-aligned, with digits of equal width so decimals line up. */
html[data-markets-list] table.table th:nth-child(n+2):nth-child(-n+5),
html[data-markets-list] table.table td:nth-child(n+2):nth-child(-n+5) {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
html[data-markets-list] table.table a:focus-visible,
html[data-markets-list] table.table button:focus-visible,
html[data-markets-list] #stockListPanel input:focus-visible,
html[data-markets-list] #stockListPanel select:focus-visible {
  outline: 2px solid var(--sc-accent, #7ea2ff);
  outline-offset: 2px;
}
@media (prefers-reduced-motion: reduce) {
  html[data-markets-list] table.table tbody tr:hover td { transition: none; }
}

/* Show the market summary only on the Markets list (set by stoxcredit-tips.js). */
html:not([data-markets-list]) #marketMetrics,
html:not([data-markets-list]) .app-mode #marketMetrics { display: none !important; }

/* Overrides the older per-card styles so the four figures form one panel. */
.app-mode #marketMetrics {
  display: grid !important;
  grid-template-columns: repeat(6, minmax(0, 1fr)) !important;
  gap: 0 !important;
  margin: 16px 0 20px !important;
  padding: 0 !important;
  background: transparent !important;
  border: 1px solid var(--line, #283247) !important;
  border-radius: 12px !important;
  overflow: hidden !important;
}
.app-mode #marketMetrics > .market-metric,
.app-mode #marketMetrics #totalStockTvl {
  background: transparent !important;
  background-image: none !important;
  border: 0 !important;
  border-right: 1px solid var(--line, #283247) !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  padding: 18px 20px !important;
  margin: 0 !important;
  width: auto !important;
  min-width: 0 !important;
  grid-column: auto !important;
}
.app-mode #marketMetrics > .market-metric:last-child,
.app-mode #marketMetrics > .market-metric:empty,
.app-mode #marketMetrics > :empty {
  border-right: 0 !important;
}
.app-mode #marketMetrics > :empty { display: none !important; }
.app-mode #marketMetrics .market-metric > strong {
  margin: 6px 0 2px !important;
  font-size: clamp(20px, 2.2vw, 26px) !important;
  font-weight: 600 !important;
  letter-spacing: 0 !important;
}
.app-mode #marketMetrics .market-metric > span { font-weight: 600; }
/* Row 1: Available liquidity and StoxCredit volume. Row 2: TVL, outstanding loans, borrow APY. */
.app-mode #marketMetrics > .market-metric:nth-child(-n+2) { grid-column: span 3 !important; }
.app-mode #marketMetrics > .market-metric:nth-child(n+3),
.app-mode #marketMetrics > .market-metric:nth-child(n+3) { grid-column: span 2 !important; }
.app-mode #marketMetrics > .market-metric:nth-child(3) { border-left: 0 !important; }
.app-mode #marketMetrics > .market-metric:nth-child(-n+2) { border-bottom: 1px solid var(--line, #283247) !important; }
.app-mode #marketMetrics > .market-metric:nth-child(2),
.app-mode #marketMetrics > .market-metric:nth-child(n+3):nth-child(-n+5) { border-right: 1px solid var(--line, #283247) !important; }
.app-mode #marketMetrics > .market-metric:nth-child(5),
.app-mode #marketMetrics > .market-metric:nth-child(2):last-child { border-right: 0 !important; }
@media (max-width: 760px) {
  .app-mode #marketMetrics { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  .app-mode #marketMetrics > .market-metric { grid-column: span 1 !important; border-right: 0 !important; border-bottom: 1px solid var(--line, #283247) !important; }
  .app-mode #marketMetrics > .market-metric:nth-child(2n+1) { border-right: 1px solid var(--line, #283247) !important; }
  .app-mode #marketMetrics > .market-metric:nth-child(n+5) { border-bottom: 0 !important; }
}
.copy-tip:focus-visible, .dashboard-help:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; }
/* Homepage: smaller hero and no empty strip above it. */
html body #homeView { padding-top: 16px !important; }
html body #homeView > .home-lead > .home-sheet-head { display: none !important; }
html body #homeView > .home-lead { row-gap: 0 !important; margin-top: 0 !important; padding-top: 0 !important; }
html body #homeView > .home-lead > .home-lead-copy { padding-top: 8px !important; margin-top: 0 !important; }
html body #homeView #homeTitle { font-size: clamp(30px, 3.4vw, 44px) !important; line-height: 1.1 !important; }
html body #homeView .home-lead-copy > .home-kicker { margin: 0 0 10px !important; }
html body #homeView .home-lead-copy > .home-intro { margin: 14px 0 0 !important; font-size: 16px !important; line-height: 1.5 !important; }
html body #homeView .home-lead-copy > .home-actions { margin: 20px 0 0 !important; }
html body #homeView .home-lead-copy > .home-market-tape { margin-top: 24px !important; }
html body #homeView .home-actions .home-primary { min-height: 44px; padding: 0 18px; font-size: 15px; }
@media (max-width: 760px) {
  html body #homeView { padding-top: 8px !important; }
}
.copy-tip-bubble {
  position: fixed;
  z-index: 1000;
  max-width: min(280px, calc(100vw - 24px));
  padding: 8px 10px;
  border-radius: 6px;
  background: #14191d;
  color: #ffffff;
  font-size: 13px;
  font-weight: 400;
  line-height: 1.4;
  text-align: left;
  text-transform: none;
  letter-spacing: 0;
  pointer-events: none;
}