/* Dashboard-only styles. The header, footer, buttons, selects and colour
   tokens all come from style.css so the two pages read as one product;
   only the hero, pulse cards and the market table live here. Radii (7px
   controls / 10px surfaces), the 11.5-13px type scale and the flat
   var(--panel) surfaces deliberately mirror the backtester page. */
.dash-body { min-width: 320px; background: var(--bg); }
.visually-hidden { position:absolute!important; width:1px!important; height:1px!important; padding:0!important; margin:-1px!important; overflow:hidden!important; clip:rect(0,0,0,0)!important; white-space:nowrap!important; border:0!important; }

.dash-main { max-width:1280px; margin:0 auto; padding:18px 24px 40px; }

/* ---- hero ---- */
.dash-hero { display:flex; align-items:flex-end; justify-content:space-between; gap:20px; margin-bottom:18px; }
.dash-eyebrow { margin:0 0 8px; color:var(--accent); font-size:11px; letter-spacing:1.2px; font-weight:700; }
.live-dot { display:inline-block; width:6px; height:6px; margin-right:7px; border-radius:50%; background:var(--up); box-shadow:0 0 0 4px color-mix(in srgb,var(--up) 14%,transparent); }
.dash-hero h1 { margin:0; font-size:clamp(21px,2.6vw,26px); font-weight:650; line-height:1.2; letter-spacing:-0.4px; }
.dash-lede { margin:8px 0 0; color:var(--muted); font-size:12.5px; }
.freshness { display:flex; align-items:center; gap:8px; color:var(--muted); font-size:11.5px; text-align:right; }
.freshness::before { content:""; width:7px; height:7px; flex:0 0 auto; border-radius:50%; background:var(--muted); }
.freshness.ok::before { background:var(--up); }
.freshness.warn::before { background:#d29922; }
.freshness.error::before { background:var(--down); }

/* ---- pulse cards (same surface treatment as .panel) ---- */
.pulse-grid { display:grid; grid-template-columns:repeat(4,1fr); gap:12px; margin-bottom:18px; }
.pulse-card { min-height:104px; padding:16px; border:1px solid var(--border); border-radius:10px; background:var(--panel); }
.pulse-label { display:block; color:var(--muted); font-size:11.5px; font-weight:600; }
.pulse-symbol { margin-top:12px; font-size:20px; font-weight:700; letter-spacing:-0.4px; }
.pulse-symbol small { margin-left:2px; color:var(--muted); font-size:13px; font-weight:600; }
.pulse-card p { margin:6px 0 0; color:var(--muted); font-size:12px; overflow-wrap:anywhere; }
.mix-track { height:5px; margin-top:9px; border-radius:3px; background:var(--panel-2); overflow:hidden; }
.mix-track i { display:block; height:100%; background:var(--up); transition:width .25s; }

/* ---- market panel ---- */
.market-panel { border:1px solid var(--border); border-radius:10px; background:var(--panel); overflow:hidden; }
.market-toolbar { min-height:60px; padding:12px 16px; display:flex; align-items:center; justify-content:space-between; gap:14px; border-bottom:1px solid var(--border); }
.market-filter-stack { display:flex; align-items:center; gap:12px; flex-wrap:wrap; }
/* segmented control, matching .mode-toggle on the backtester page */
.market-tabs { display:inline-flex; border:1px solid var(--border); border-radius:8px; overflow:hidden; background:var(--panel-2); }
.market-tabs button { border:0; border-radius:0; padding:7px 15px; background:transparent; color:var(--muted); font-size:12.5px; font-weight:600; cursor:pointer; }
.market-tabs button.active { background:var(--accent); color:var(--bg); }
.crypto-venues { display:flex; align-items:center; gap:5px; padding-left:12px; border-left:1px solid var(--border); }
.crypto-venues[hidden] { display:none; }
.crypto-venues span { margin-right:3px; color:var(--muted); font-size:11.5px; }
.crypto-venues button { padding:5px 10px; border:1px solid var(--border); border-radius:7px; background:var(--panel-2); color:var(--muted); font-size:11.5px; cursor:pointer; }
.crypto-venues button.active { color:var(--accent); border-color:var(--accent); background:color-mix(in srgb,var(--accent) 12%,var(--panel-2)); }
.table-tools { display:flex; gap:8px; }
.dash-search { display:flex; align-items:center; gap:7px; width:180px; padding:0 9px; border:1px solid var(--border); border-radius:7px; background:var(--panel-2); color:var(--muted); }
.dash-search input { width:100%; min-height:34px; padding:0; border:0; outline:0; background:transparent; color:var(--text); font-size:13px; }
.table-tools select { width:auto; min-height:36px; padding:0 28px 0 9px; font-size:12.5px; }
.table-status { min-height:34px; padding:8px 16px; display:flex; align-items:center; justify-content:space-between; gap:12px; border-bottom:1px solid var(--border); background:var(--panel-2); color:var(--muted); font-size:11.5px; }
.table-status p { margin:0; }

/* ---- table ---- */
.dash-table-wrap { overflow:auto; overscroll-behavior-x:contain; -webkit-overflow-scrolling:touch; scrollbar-color:var(--accent) var(--panel-2); }
.dash-table-wrap:focus-visible { outline:2px solid var(--accent); outline-offset:-2px; }
.dash-table { width:100%; min-width:1180px; border-collapse:collapse; font-variant-numeric:tabular-nums; }
.dash-table th { padding:10px 13px; border-bottom:1px solid var(--border); color:var(--muted); font-size:11px; font-weight:600; text-align:right; white-space:nowrap; }
.dash-table th:first-child,.dash-table th:nth-child(2),.dash-table th:nth-child(7) { text-align:left; }
.dash-table td { padding:12px 13px; border-bottom:1px solid color-mix(in srgb,var(--border) 72%,transparent); text-align:right; font-size:12.5px; vertical-align:middle; }
.dash-table td:first-child,.dash-table td:nth-child(2),.dash-table td:nth-child(7) { text-align:left; }
.dash-table tbody tr { transition:background .15s; }
.dash-table tbody tr:hover { background:color-mix(in srgb,var(--panel-2) 65%,transparent); }
.asset-cell { display:flex; align-items:center; gap:10px; }
.asset-avatar { display:grid; place-items:center; width:30px; height:30px; flex:0 0 auto; border-radius:8px; background:color-mix(in srgb,var(--accent) 12%,var(--panel-2)); color:var(--accent); font-size:10.5px; font-weight:800; }
.asset-name strong,.asset-name small { display:block; }
.asset-name strong { font-size:13px; font-weight:650; }
.asset-name small { margin-top:2px; color:var(--muted); font-size:11px; }
.position-badge { display:inline-flex; align-items:center; gap:6px; padding:4px 9px; border-radius:7px; font-size:11.5px; font-weight:650; }
.position-badge::before { content:""; width:5px; height:5px; border-radius:50%; }
.position-badge.long { color:var(--up); background:color-mix(in srgb,var(--up) 11%,transparent); }
.position-badge.long::before { background:var(--up); }
.position-badge.cash { color:var(--muted); background:var(--panel-2); }
.position-badge.cash::before { background:var(--muted); }
.position-since { display:block; margin-top:4px; color:var(--muted); font-size:10.5px; white-space:nowrap; }
/* rows whose venues disagree on the signal -- surfaced, not hidden */
.venue-flag { display:block; margin-top:3px; color:#d29922; font-size:10px; font-weight:600; white-space:nowrap; cursor:help; }
.row-actions { white-space:nowrap; }
.row-actions .row-action + .row-action { margin-left:5px; }
.pos { color:var(--up); }
.neg { color:var(--down); }
.muted { color:var(--muted); }
.metric-pair { white-space:nowrap; }
.metric-pair small { color:var(--muted); }
.strategy-cell strong { display:block; max-width:118px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-size:12px; font-weight:600; }
.strategy-cell small { display:block; margin-top:2px; color:var(--muted); font-size:10.5px; }
.row-action { display:inline-grid; place-items:center; width:28px; height:28px; border:1px solid var(--border); border-radius:7px; background:var(--panel-2); color:var(--muted); text-decoration:none; }
.row-action:hover { color:var(--accent); border-color:var(--accent); text-decoration:none; }
.table-loading { display:flex; justify-content:center; align-items:center; gap:10px; min-height:230px; color:var(--muted); font-size:12.5px; }
.table-loading i { width:16px; height:16px; border:2px solid var(--border); border-top-color:var(--accent); border-radius:50%; animation:spin .8s linear infinite; }
@keyframes spin { to { transform:rotate(360deg); } }

.market-note { display:flex; gap:28px; padding:13px 16px; background:var(--panel-2); color:var(--muted); }
.market-note p { margin:0; max-width:620px; font-size:11.5px; line-height:1.5; }
.market-note b { margin-right:5px; color:var(--text); }

/* ---- mobile row expansion ---- */
.mobile-scroll-hint,.mobile-row-toggle,.mobile-detail-row { display:none; }
.mobile-row-toggle { margin-left:auto; border:0; background:transparent; color:var(--accent); cursor:pointer; }
.mobile-detail-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:10px 14px; }
.mobile-detail-grid div { min-width:0; }
.mobile-detail-grid>div>span,.mobile-detail-grid>div>strong { display:block; }
.mobile-detail-grid>div>span { margin-bottom:2px; color:var(--muted); font-size:10.5px; }
.mobile-detail-grid>div>strong { overflow-wrap:anywhere; font-size:12.5px; font-weight:650; line-height:1.35; }
.mobile-detail-grid>div>strong>span { display:inline; margin:0; font-size:inherit; }
.mobile-detail-actions { margin-top:10px; }
.mobile-detail-actions { display:flex; flex-wrap:wrap; gap:8px; }
.mobile-detail-actions .row-action { width:auto; min-height:40px; padding:0 12px; display:inline-flex; align-items:center; gap:6px; font-size:12px; }

@media (max-width:960px) {
  .pulse-grid { grid-template-columns:1fr 1fr; }
  .market-toolbar { align-items:stretch; flex-direction:column; }
  .market-tabs { overflow:auto; }
  .table-tools { justify-content:space-between; }
  .dash-search { flex:1; }
  .market-note { flex-direction:column; gap:8px; }
}

/* 600px matches the breakpoint style.css uses for the shared header */
@media (max-width:600px) {
  .dash-main { padding:14px 12px 32px; }
  .dash-hero { align-items:flex-start; flex-direction:column; gap:12px; }
  .dash-hero h1 { font-size:22px; }
  .freshness { text-align:left; line-height:1.5; }
  .pulse-grid { grid-template-columns:1fr 1fr; gap:8px; }
  .pulse-card { min-height:96px; padding:13px; }
  .pulse-symbol { margin-top:10px; font-size:18px; }
  .market-toolbar { padding:10px; }
  .market-filter-stack { display:block; }
  .market-tabs { display:flex; width:100%; overflow-x:auto; }
  .market-tabs button { flex:1 0 auto; min-height:40px; padding:7px 12px; }
  .crypto-venues { margin-top:8px; padding:8px 0 0; border-left:0; border-top:1px solid var(--border); overflow-x:auto; }
  .crypto-venues button { min-height:36px; }
  .table-tools { display:grid; grid-template-columns:1fr 1fr; }
  .dash-search { width:auto; min-height:44px; }
  .dash-search input,.table-tools select { min-height:42px; font-size:16px; }
  .table-status { padding:9px 10px; }
  .mobile-scroll-hint { display:block; margin:0; padding:0; border:0; background:transparent; color:var(--accent); font-size:11px; text-align:right; }

  /* the wide table collapses to 4 columns; the rest opens per row */
  .dash-table-wrap { overflow:visible; }
  .dash-table { min-width:0; table-layout:fixed; }
  .dash-table th { padding:9px 6px; font-size:10.5px; }
  .asset-row td { padding:8px 6px; }
  .dash-table th:nth-child(n+5),.asset-row td:nth-child(n+5) { display:none; }
  .dash-table th:first-child { width:37%; }
  .dash-table th:nth-child(2) { width:24%; }
  .dash-table th:nth-child(3) { width:17%; }
  .dash-table th:nth-child(4) { width:22%; }
  .asset-cell { gap:5px; min-width:0; }
  .asset-avatar { display:none; }
  .asset-name { min-width:0; }
  .asset-name strong,.asset-name small { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
  .asset-name strong { font-size:12.5px; }
  .asset-name small { margin-top:2px; font-size:10.5px; }
  .position-badge { min-height:26px; padding:4px 6px; font-size:11px; }
  .venue-flag { font-size:9.5px; line-height:1.2; }
  /* the collapsed-venue count needs the width more than it earns it here */
  .venue-more { display:none; }
  /* the "since <date>" line must stay on one row or every table row doubles */
  .position-since { margin-top:2px; font-size:9.5px; line-height:1.15; white-space:nowrap; }
  .mobile-row-toggle { display:grid; place-items:center; min-width:30px; min-height:38px; padding:0; }
  .mobile-detail-row:not([hidden]) { display:table-row; }
  .mobile-detail-row td { display:table-cell!important; padding:10px 8px 12px; background:var(--panel-2); text-align:left; }
  .market-note { display:flex; padding:13px; flex-direction:column; gap:10px; }
  .row-action { width:44px; height:44px; }
}
