/* Market page layout; shared controls and surfaces retain UI primitives. */
.app.market-wide { max-width: var(--layout-market-width); }
.market-body { margin: 0 var(--page-gutter); padding-bottom: 18px; font-variant-numeric: tabular-nums; }
.home-market-card { position: relative; display: block; width: calc(100% - var(--page-gutter) * 2); height: 110px; margin: 14px var(--page-gutter) 0; overflow: hidden; text-align: left; cursor: pointer; --shadow-card: none; }
.home-market-card:focus-visible { outline: 2px solid var(--accent-blue); outline-offset: 2px; }
.home-market-heading { position: absolute; z-index: 1; top: 12px; left: 12px; right: 12px; display: flex; align-items: baseline; justify-content: space-between; gap: 8px; color: var(--text-primary); }
.home-market-heading > span { border-radius: 3px; padding: 2px 3px; background: rgba(255, 255, 255, .88); }
.home-market-heading small { margin-left: 4px; color: var(--text-secondary); font-size: var(--meta-font-size); font-weight: 400; }
.home-market-value { display: flex; align-items: baseline; gap: 6px; font-size: var(--caption-font-size); white-space: nowrap; }
.home-market-value strong { font-size: 17px; font-weight: 600; }
#home-market-trend { display: block; width: 100%; height: 110px; }
.home-market-note { position: absolute; left: 12px; right: 12px; top: 64px; text-align: center; }
#page-cohort { scroll-padding-top: calc(var(--nav-height) + 70px); }
.market-header { position: sticky; top: 0; z-index: 50; }
.market-header .nav-bar { position: static; }
.market-search-dock { position: relative; margin: 0 var(--page-gutter); padding-bottom: 12px; }
.market-search-row { position: relative; border: 1px solid rgba(var(--border-rgb), .6); border-radius: var(--radius-pill); background: var(--bg-card); }
.market-search-row:focus-within { border-color: rgba(var(--accent-blue-rgb), .35); box-shadow: var(--focus-ring); }
.market-search-icon { position: absolute; left: 15px; top: 50%; width: 18px; height: 18px; transform: translateY(-50%); color: var(--text-secondary); pointer-events: none; }
.market-search-row .ui-field { display: block; width: 100%; min-width: 0; height: 44px; min-height: 44px; padding: 0 14px 0 42px; border: 0; border-radius: inherit; background: transparent; box-shadow: none; }
.market-search-row .ui-field:focus { outline: none; background: transparent; box-shadow: none; }
.market-picker { position: absolute; top: calc(100% - 6px); left: 0; right: 0; min-width: 0; --surface-padding: 12px; box-shadow: 0 12px 30px rgba(25, 38, 65, .14); }
.market-picker[hidden] { display: none; }
.market-muted { color: var(--text-secondary); font-size: var(--caption-font-size); }
.market-title { font-size: var(--body-font-size); font-weight: 600; }
.market-up { color: var(--text-positive); }
.market-down { color: var(--text-negative); }
.market-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.market-overview-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-lg); }
.market-visual-card { min-width: 0; overflow: hidden; --shadow-card: none; }
.market-overview { position: relative; height: var(--market-trend-height); }
#market-trend-wrap { position: absolute; inset: 0; }
.market-metric-head { padding: 16px 16px 0; }
.market-metric-head > .market-heading { min-height: 24px; margin-bottom: var(--space-xs); }
.market-metric-note { padding: 0 16px 12px; line-height: 1.5; }
.market-index { display: flex; flex-wrap: wrap; align-items: baseline; gap: 5px 8px; }
.market-index strong { font-size: var(--font-size-24); font-weight: 600; line-height: var(--heading-line-height); }
.market-index span { font-size: var(--body-font-size); }
.market-overview .market-metric-head { position: absolute; z-index: 1; top: 14px; left: 12px; right: 12px; display: flex; flex-direction: column; align-items: flex-start; gap: 3px; padding: 0; pointer-events: none; }
.market-overview .market-metric-head > .market-heading { min-height: 0; margin: 0; }
.market-overview .market-title, .market-overview .market-index, #market-trend-caption { padding: 1px 3px; border-radius: 3px; background: rgba(var(--bg-card-rgb), .88); }
#market-trend { width: 100%; height: 100%; display: block; color: var(--accent-green); }
.market-trend-dates { position: absolute; left: 12px; right: 12px; bottom: 8px; display: flex; justify-content: space-between; color: var(--text-secondary); font-size: var(--meta-font-size); line-height: 1.2; pointer-events: none; text-shadow: 0 1px 3px var(--bg-card), 0 0 5px var(--bg-card); }
.market-trend-dates > span { padding: 2px 3px; border-radius: 3px; background: var(--bg-card); opacity: .9; }
#market-trend-note { position: absolute; top: 60%; left: 12px; right: 12px; padding: 0; text-align: center; }
.market-turnover-card { display: flex; flex-direction: column; height: var(--market-overview-height); }
.market-turnover-card.is-empty { align-self: start; height: auto; }
#market-volume { display: block; width: 100%; height: 138px; flex: 1; min-height: 0; margin-top: 8px; color: #6c67dd; }
#market-volume-note { margin: 8px 0 0; }
#market-volume[hidden], .market-breadth[hidden], .market-breadth-bar[hidden] { display: none; }
#market-volume text { font: 11px var(--site-font); fill: var(--text-secondary); }
.market-volume-grid { stroke: var(--border); stroke-width: 1; }
.market-volume-bar { fill: currentColor; }
.market-volume-bar.is-current { opacity: .6; }
.market-volume-bar.is-partial { stroke: currentColor; stroke-dasharray: 2 2; fill-opacity: .35; }
.market-volume-bar.is-missing { fill: var(--bg-page); stroke: var(--text-muted); stroke-dasharray: 2 3; }
.market-breadth-card { grid-column: 1 / -1; --surface-padding: 12px 16px; --shadow-card: none; --accent-green: #13866f; --accent-red: #d24e67; }
.market-breadth { display: flex; align-items: baseline; gap: 14px; font-size: var(--body-font-size); }
.market-breadth > span { white-space: nowrap; }
.market-breadth b { font-size: 16px; font-weight: 600; }
.market-breadth-bar { display: flex; width: 100%; height: 8px; margin-top: 8px; overflow: hidden; border-radius: 4px; background: var(--bg-page); }
.market-breadth-bar > span { display: flex; align-items: center; justify-content: center; flex-shrink: 0; width: 0; color: white; font-size: var(--caption-font-size); font-variant-numeric: tabular-nums; }
.market-breadth-up { background: var(--accent-green); }
.market-breadth-down { background: var(--accent-red); }
.market-breadth-flat { background: #b8c3d3; }
.market-breadth-missing { background: repeating-linear-gradient(135deg, #e9edf4, #e9edf4 4px, #d6dce7 4px, #d6dce7 6px); }
.market-breadth-foot { margin-top: 6px; text-align: right; font-size: var(--meta-font-size); }
.market-workbench { margin-top: var(--space-lg); }
.market-list-meta { display: flex; justify-content: space-between; gap: 4px; margin: 0 0 8px; }
.market-list { height: 396px; max-height: calc(var(--viewport-height, 100vh) - var(--nav-height) - 140px); overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
#market-list-space { position: relative; }
.market-list-row { position: absolute; width: 100%; height: 44px; padding: 0 6px; display: grid; grid-template-columns: 30px minmax(0,1fr) 10px; text-align: left; }
.market-list-row .market-coin-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.market-list-row small { color: var(--text-secondary); font-size: var(--meta-font-size); }
.market-chart-panel {
    min-width: 0;
    overflow: hidden;
    --market-chart-up: var(--accent-lime);
    --market-chart-down: var(--accent-danger);
    --market-chart-brand: #5756d9;
    --market-chart-grid: var(--chart-grid);
    --market-chart-axis: var(--chart-text);
}
.market-periods { display: grid; grid-template-columns: repeat(5,minmax(0,1fr)); gap: 2px; margin-bottom: 8px; }
.market-periods button { padding-left: 3px; padding-right: 3px; }
.market-candle-inspector { position: absolute; top: 8px; right: 8px; width: 190px; max-width: calc(100% - 16px); padding: 8px 10px; border-radius: var(--control-compact-radius); background: var(--bg-card); box-shadow: 0 2px 14px rgba(25, 38, 65, .14); pointer-events: none; }
.market-candle-inspector[data-side="left"] { left: 8px; right: auto; }
.market-inspector-time { margin-bottom: 5px; color: var(--text-secondary); font-size: var(--meta-font-size); }
.market-ohlc { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 4px 10px; color: var(--text-secondary); font-size: var(--meta-font-size); }
.market-ohlc span { display: flex; flex-wrap: wrap; gap: 2px 4px; }
.market-ohlc b { color: var(--text-primary); font-size: var(--caption-font-size); font-weight: 500; overflow-wrap: anywhere; }
.market-chart-wrap { position: relative; }
.market-candle-chart { display: block; width: 100%; height: 100%; overflow: hidden; touch-action: pan-y; user-select: none; }
.market-candle-chart text { font-family: var(--chart-font-family); font-size: var(--chart-font-size); }
.market-candle-grid { stroke: var(--market-chart-grid); stroke-width: 1; }
.market-candle-axis { fill: var(--market-chart-axis); paint-order: stroke; stroke: var(--bg-card); stroke-width: 3px; stroke-linejoin: round; pointer-events: none; }
.market-candle-guide { pointer-events: none; }
.market-candle-guide line { stroke: var(--market-chart-axis); stroke-width: 1; stroke-dasharray: 3 4; }
.market-candle-chart:focus { outline: none; }
.market-candle-chart:focus-visible { outline: 2px solid var(--market-chart-brand); outline-offset: -2px; }
.market-chart-message { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 20px; background: var(--bg-card); color: var(--text-secondary); font-size: var(--body-font-size); text-align: center; }
.market-chart-message[hidden] { display: none; }
.market-chart-status { color: var(--text-negative); font-size: var(--caption-font-size); }
.market-scan { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 8px; padding: 8px 0 0; }
.market-scan button { flex-direction: row; gap: 8px; height: 36px; min-height: 36px; padding: 4px 12px; }
.market-scan span { flex-shrink: 0; font-size: 16px; line-height: 1; }
.market-scan strong { min-width: 0; font-size: var(--body-font-size); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
