/* Performance dashboard and P&L screen (Bazooka prototype final.dc.html
   69–211, first use 927–936, dialogs 1125–1155, mobile Dashboard frame).
   Scoped under .dash-page; builds on app.css tokens and components. */
.dash-page { container: dash / inline-size; gap: 28px; }
.dash-main { display: flex; flex-direction: column; gap: 28px; min-width: 0; }
.dash-spacer { flex: 1; }
.dash-page button:focus-visible, .dash-dialog button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---- Dashboard / P&L tabs ---- */
.dash-views { margin: 0 0 -14px; }
.dash-page.dash-first .dash-views { display: none; }

/* ---- header ---- */
.dash-head { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; min-width: 0; }
.dash-title { flex: 1; min-width: 0; white-space: nowrap; }
.dash-title-block { display: flex; flex-direction: column; gap: 4px; flex: 1; min-width: 0; }
.dash-title-row { display: flex; align-items: center; gap: 8px; min-width: 0; }
.dash-title-row .dash-title { flex: 0 1 auto; overflow: hidden; text-overflow: ellipsis; }
.dash-mint-row { display: flex; align-items: center; gap: 6px; color: var(--muted); }
.dash-controls { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; min-width: 0; }
.dash-ranges .seg-opt { padding: 5px 11px; }
.dash-chip { display: inline-flex; align-items: center; height: 32px; padding: 0 12px; border-radius: 8px; background: var(--control); color: var(--fg); font-size: 12px; font-weight: 500; white-space: nowrap; }
.dash-chip.dash-select { padding: 0; }
.dash-chip select { width: auto; min-height: 0; height: 32px; padding: 0 28px 0 12px; border: 0; border-radius: 8px; background-color: var(--control); background-position: right 10px center; color: var(--fg); font-size: 12px; font-weight: 500; }
.dash-chip select:hover { background-color: var(--control-active); }
.dash-chip select[data-dash-tz] { max-width: 190px; text-overflow: ellipsis; }
.dash-reconcile { border-color: var(--stroke-strong); }
.dash-reconcile:disabled { border-color: var(--chip); }
.dash-busy .dash-title::after { content: ""; display: inline-block; width: 10px; height: 10px; margin-left: 10px; vertical-align: middle; border: 2px solid var(--muted); border-top-color: transparent; border-radius: 50%; animation: dash-spin .8s linear infinite; }
@keyframes dash-spin { to { transform: rotate(360deg); } }

/* ---- status banner ---- */
.dash-banner { margin: -8px 0 -4px; }

/* ---- hero ---- */
.dash-hero { display: grid; grid-template-columns: minmax(0, 1.3fr) repeat(3, minmax(0, 1fr)); align-items: end; min-width: 0; }
.dash-hero-main { display: flex; flex-direction: column; gap: 10px; min-width: 0; padding-right: 32px; }
.dash-hero-label { display: flex; align-items: center; gap: 10px; color: var(--text-secondary); font-size: 13px; }
.dash-hero-unit { display: none; margin-left: -6px; }
.dash-link { height: auto; padding: 0; border: 0; border-radius: 0; background: none; color: var(--muted); font-size: 11px; font-weight: 400; cursor: pointer; }
.dash-link:hover:not(:disabled) { background: none; color: var(--fg); }
.dash-link:disabled { color: var(--faint); cursor: default; }
.dash-hero-box { max-width: 100%; }
.dash-hero-box:not(.pos):not(.neg) { background: var(--card); }
.dash-hero-num { font-size: clamp(28px, 2.4vw, 36px); }
.dash-return { padding: 3px 8px; border-radius: 6px; font-size: 12px; font-weight: 600; white-space: nowrap; background: var(--chip); color: var(--text-secondary); }
.hero-box.pos .dash-return { background: color-mix(in srgb, var(--ok) 14%, transparent); color: var(--ok); }
.hero-box.neg .dash-return { background: color-mix(in srgb, var(--danger) 14%, transparent); color: var(--danger-text); }
.dash-hero-split { display: flex; flex-wrap: wrap; gap: 4px 18px; color: var(--text-secondary); font-size: 13px; white-space: nowrap; }
.dash-hero-split b { color: var(--fg); font-weight: 400; }
.dash-bd-link { color: var(--accent-link); }
.dash-bd-link:hover { color: var(--fg); }
.dash-prov { padding: 2px 7px; border-radius: 5px; background: color-mix(in srgb, var(--warning) 12%, transparent); color: var(--warning-ink); font-size: 11px; white-space: nowrap; cursor: help; }
.dash-cov { align-self: flex-start; display: inline-flex; align-items: center; gap: 8px; height: auto; padding: 5px 10px; border: 0; border-radius: 20px; background: color-mix(in srgb, var(--warning) 10%, transparent); color: var(--warning-ink); font-size: 12px; font-weight: 400; cursor: pointer; }
.dash-cov:hover:not(:disabled) { background: color-mix(in srgb, var(--warning) 16%, transparent); }
.dash-cov i { width: 6px; height: 6px; border-radius: 50%; background: var(--warning); }
.dash-cov-cta::before { content: "· "; }
.dash-cov-text { max-width: 440px; margin: 0; color: var(--text-secondary); font-size: 12px; line-height: 1.6; }
.dash-asof { margin: 0; color: var(--muted); font-size: 12px; }
.dash-asof:empty { display: none; }
.dash-asof.stale { color: var(--warning-text); }
.dash-stat { display: flex; flex-direction: column; gap: 6px; min-width: 0; padding: 0 24px; border-left: 1px solid var(--hairline); }
.dash-stat-label { color: var(--text-secondary); font-size: 13px; }
.dash-stat-value { font-size: clamp(20px, 2vw, 28px); font-weight: 600; letter-spacing: -.03em; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dash-stat-sub { min-height: 18px; color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dash-stat-m { display: none; }
.dash-hero[aria-busy="true"] .dash-hero-num, .dash-hero[aria-busy="true"] .dash-stat-value, .dash-hero[aria-busy="true"] .dash-hero-split b { color: transparent; border-radius: 6px; background: var(--chip); animation: bz-pulse 1.4s ease-in-out infinite; -webkit-text-stroke: 0; }
.dash-hero[aria-busy="true"] .dash-hero-box { background: transparent; border-color: transparent; padding-left: 0; }
.dash-hero[aria-busy="true"] .dash-hero-num { min-width: 220px; }
.dash-hero[aria-busy="true"] .dash-stat-value { min-width: 96px; align-self: flex-start; }
.dash-blank { color: var(--muted); }
.dash-unknown { color: var(--warning-text); }
.dash-muted { color: var(--muted); }
.dash-warn-text { color: var(--warning-text); }
.dash-error-text { color: var(--danger-text); }

/* ---- P&L breakdown ---- */
.dash-page .card.dash-bd { display: flex; flex-direction: column; gap: 12px; padding: 16px 20px; }
.dash-bd-head { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 10px; min-width: 0; }
.dash-bd-cols { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px 32px; }
.dash-bd-col { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.dash-bd-h { margin: 0; color: var(--muted); font-size: 12px; font-weight: 500; }
.dash-bd-list { display: flex; flex-direction: column; gap: 2px; margin: 0; min-width: 0; }
.dash-bd-list > div { display: flex; justify-content: space-between; gap: 12px; padding: 3px 0; font-size: 13px; }
.dash-bd-list dt { color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dash-bd-list dd { margin: 0; font-variant-numeric: tabular-nums; white-space: nowrap; }
.dash-bd-list .dash-bd-sub { padding-left: 12px; font-size: 12px; }
.dash-bd-list .dash-bd-sub dt { color: var(--muted); }
.dash-bd-list .dash-bd-sum, .dash-bd-list .dash-bd-total { border-top: 1px solid var(--hairline); padding-top: 6px; }
.dash-bd-list .dash-bd-total dt { color: var(--fg); font-weight: 600; }
.dash-bd-list .dash-bd-total dd { font-weight: 600; }

/* ---- chart card ---- */
.dash-page .card.dash-chart-card { display: flex; flex-direction: column; gap: 14px; padding: 18px 20px 14px; }
.dash-chart-head { display: flex; align-items: center; gap: 6px; min-width: 0; }
.dash-tabs { display: flex; align-items: center; gap: 6px; }
.dash-tab { height: auto; padding: 6px 12px; border: 0; border-radius: 7px; background: transparent; color: var(--dim); font-size: 13px; font-weight: 500; white-space: nowrap; }
.dash-tab:hover:not(:disabled) { background: transparent; color: var(--fg); }
.dash-tab[aria-selected="true"], .dash-tab[aria-selected="true"]:hover { background: var(--chip); color: var(--fg); }
.dash-short { display: none; }
.dash-hint { flex: 1; min-width: 0; color: var(--muted); font-size: 12px; text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dash-readout { display: flex; align-items: baseline; flex-wrap: wrap; gap: 2px 12px; min-height: 16px; margin: -6px 0 -4px; color: var(--muted); font-size: 11px; }
.dash-readout b { color: var(--fg); font-weight: 500; }
.dash-chart-wrap { position: relative; min-width: 0; margin: 0; }
.dash-chart { height: 196px; min-width: 0; }
.dash-chart-state { position: absolute; inset: 0; z-index: 4; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 16px; background: var(--card); color: var(--muted); font-size: 12px; text-align: center; }
.dash-chart-skel { display: none; }
.dash-chart-state.loading .dash-chart-skel { display: block; position: absolute; inset: 12px 52px 28px 0; border-radius: 8px; background: linear-gradient(180deg, transparent 0 calc(25% - 1px), var(--control-active) calc(25% - 1px) 25%, transparent 25% calc(50% - 1px), var(--control-active) calc(50% - 1px) 50%, transparent 50% calc(75% - 1px), var(--control-active) calc(75% - 1px) 75%, transparent 75%); animation: bz-pulse 1.4s ease-in-out infinite; }
.dash-chart-state.loading > span:not(.dash-chart-skel) { position: relative; }
.dash-chart-note { margin: -6px 0 0; color: var(--muted); font-size: 11px; line-height: 1.5; }
.dash-chart-note:empty { display: none; }

/* ---- calendar + positions ---- */
.dash-pair { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.35fr); gap: 20px; align-items: start; min-width: 0; }
.dash-card-title { margin: 0; font-size: 14px; font-weight: 600; }
.dash-card-title-sm { margin: 0; font-size: 13px; font-weight: 600; }
.dash-count { color: var(--muted); font-size: 12px; font-weight: 400; }
.dash-seg-sm { padding: 2px; border-radius: 7px; background: var(--control-active); }
.dash-seg-sm .seg-opt { padding: 3px 9px; border-radius: 5px; }
.dash-page .card.dash-cal { display: flex; flex-direction: column; gap: 14px; padding: 18px 20px; }
.dash-cal-grid { container: calgrid / inline-size; }
.dash-cal:focus { outline: none; }
.dash-cal:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.dash-cal-top { display: flex; align-items: center; gap: 8px; }
.dash-cal-top .dash-card-title { flex: 1; }
.dash-cal-nav { display: flex; align-items: center; gap: 10px; min-width: 0; }
.dash-cal-step { width: 22px; height: 22px; padding: 0; border: 0; border-radius: 6px; background: transparent; color: var(--muted); font-size: 15px; line-height: 1; }
.dash-cal-step:hover:not(:disabled) { background: var(--control-active); color: var(--fg); }
.dash-cal-step:disabled { color: var(--faint); background: transparent; cursor: default; }
.dash-cal-label { font-size: 15px; font-weight: 600; white-space: nowrap; }
.dash-today { height: auto; padding: 3px 9px; border: 0; border-radius: 6px; background: var(--control-active); color: var(--accent-link); font-size: 12px; font-weight: 500; }
.dash-today:hover:not(:disabled) { background: var(--chip); color: var(--accent-link); }
.dash-cal-total { flex: 1; min-width: 0; font-size: 15px; font-weight: 600; text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dash-cal-grid { display: grid; gap: 4px; min-width: 0; }
.dash-cal-grid.month { grid-template-columns: repeat(7, minmax(0, 1fr)); }
.dash-cal-grid.year { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.dash-cal-grid[aria-busy="true"] .dash-cal-day, .dash-cal-grid[aria-busy="true"] .dash-cal-month { animation: bz-pulse 1.4s ease-in-out infinite; }
.dash-cal-weekday { color: var(--muted); font-size: 11px; text-align: center; }
.dash-cal-day, .dash-cal-month { --i: 0; display: flex; flex-direction: column; align-items: stretch; justify-content: space-between; gap: 2px; min-width: 0; height: auto; aspect-ratio: 1.15; margin: 0; padding: 5px 6px; border: 0; border-radius: 7px; background: var(--control-active); color: var(--fg); font-size: 11px; font-weight: 400; line-height: 1.2; text-align: left; overflow: hidden; cursor: pointer; }
.dash-cal-month { aspect-ratio: 1.6; padding: 8px 9px; }
.dash-cal-day:hover:not(.future), .dash-cal-month:hover:not(.future) { background: var(--control-active); box-shadow: inset 0 0 0 1.5px var(--text-secondary); }
.dash-cal-num { color: var(--dim); font-size: 11px; }
.dash-cal-val { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; font-weight: 600; }
.dash-cal-sub { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: 10px; }
.dash-cal-day.pos, .dash-cal-month.pos { background: color-mix(in srgb, var(--ok) calc(10% + 18% * var(--i)), transparent); }
.dash-cal-day.pos .dash-cal-val, .dash-cal-month.pos .dash-cal-val { color: var(--ok); }
.dash-cal-day.neg, .dash-cal-month.neg { background: color-mix(in srgb, var(--danger) calc(10% + 22% * var(--i)), transparent); }
.dash-cal-day.pos:hover, .dash-cal-month.pos:hover { background: color-mix(in srgb, var(--ok) calc(10% + 18% * var(--i)), transparent); }
.dash-cal-day.neg:hover, .dash-cal-month.neg:hover { background: color-mix(in srgb, var(--danger) calc(10% + 22% * var(--i)), transparent); }
.dash-cal-day.unknown, .dash-cal-month.unknown { outline: 1px dashed var(--warning); outline-offset: -1px; }
.dash-cal-day.unknown .dash-cal-val, .dash-cal-month.unknown .dash-cal-val { color: var(--warning-text); }
.dash-cal-day.future, .dash-cal-month.future { background: color-mix(in srgb, var(--control) 80%, var(--card)); cursor: default; }
.dash-cal-day.future .dash-cal-num, .dash-cal-month.future .dash-cal-num { color: var(--faint); }
.dash-cal-day.today, .dash-cal-month.today { box-shadow: inset 0 0 0 1.5px var(--accent); }
.dash-cal-pad { min-width: 0; }
.dash-cal-summary { display: flex; flex-wrap: wrap; gap: 6px 16px; color: var(--text-secondary); font-size: 12px; }
.dash-cal-summary:empty { display: none; }
.dash-cal-summary .dash-muted, .dash-cal-summary .dash-warn-text { font-size: 11px; }
.dash-cal-summary .banner-action { height: 24px; }
.dash-cal-foot { display: flex; align-items: center; flex-wrap: wrap; gap: 10px 14px; padding-top: 12px; border-top: 1px solid var(--hairline); color: var(--muted); font-size: 11px; }
.dash-cal-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 0; padding: 0; list-style: none; }
.dash-cal-legend li { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.dash-sw { width: 8px; height: 8px; border-radius: 2px; }
.dash-sw-pos { background: color-mix(in srgb, var(--ok) 50%, transparent); }
.dash-sw-neg { background: color-mix(in srgb, var(--danger) 50%, transparent); }
.dash-sw-flat { background: var(--chip); }
.dash-sw-unknown { border: 1px dashed var(--warning); }
.dash-cal-tools { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 14px; margin-left: auto; }
.dash-tz { width: auto; max-width: 170px; min-height: 0; height: 24px; padding: 0 22px 0 8px; border: 0; border-radius: 6px; background-color: transparent; background-position: right 6px center; color: var(--muted); font-size: 11px; }
.dash-tz:hover { background-color: var(--control-active); color: var(--fg); }
.dash-check { display: inline-flex; align-items: center; gap: 6px; margin: 0; color: var(--muted); font-size: 11px; white-space: nowrap; cursor: pointer; }
.dash-check input[type=checkbox] { width: 14px; height: 14px; }
.dash-cal-tools .dash-link { color: var(--text-secondary); white-space: nowrap; }

.dash-page .card.dash-pos { padding: 0; overflow: hidden; }
.dash-pos-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 16px 20px; }
.dash-search { flex: 0 1 150px; min-width: 90px; }
.dash-search > input { height: 28px; min-height: 28px; border-radius: 7px; background: var(--control-active); }
.dash-pos-bar { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; flex-basis: 100%; min-width: 0; }
.dash-pill-tabs { display: flex; flex-wrap: wrap; gap: 2px; flex: 1; min-width: 0; }
.dash-pill-tab { height: auto; padding: 4px 9px; border: 0; border-radius: 6px; background: transparent; color: var(--dim); font-size: 12px; font-weight: 500; white-space: nowrap; }
.dash-pill-tab:hover:not(:disabled) { background: transparent; color: var(--fg); }
.dash-pill-tab[aria-pressed="true"], .dash-pill-tab[aria-pressed="true"]:hover { background: var(--chip); color: var(--fg); }
.dash-sort { display: inline-flex; align-items: center; gap: 2px; color: var(--muted); font-size: 11px; }
.dash-sort select { width: auto; min-height: 0; height: 24px; padding: 0 22px 0 8px; border: 0; border-radius: 6px; background-color: transparent; background-position: right 6px center; color: var(--muted); font-size: 11px; }
.dash-sort select:hover { background-color: var(--control-active); color: var(--fg); }
.dash-sort-dir { width: 24px; height: 24px; padding: 0; border: 0; border-radius: 6px; background: transparent; color: var(--muted); font-size: 12px; }
.dash-sort-dir:hover:not(:disabled) { background: var(--control-active); color: var(--fg); }

/* ---- tables ---- */
.dash-tbl { font-size: 13px; }
.dash-tbl thead th { padding-top: 0; padding-bottom: 8px; border-bottom: 0; background: var(--card); font-size: 11px; font-weight: 400; color: var(--muted); }
.dash-tbl th:first-child, .dash-tbl td:first-child { padding-left: 20px; }
.dash-tbl th:last-child, .dash-tbl td:last-child { padding-right: 20px; }
.dash-tbl th button { height: auto; padding: 0; border: 0; border-radius: 0; background: none; color: inherit; font: inherit; }
.dash-tbl th button:hover:not(:disabled) { background: none; color: var(--fg); }
.dash-tbl th[aria-sort="descending"] button::after { content: " ↓"; color: var(--fg); }
.dash-tbl th[aria-sort="ascending"] button::after { content: " ↑"; color: var(--fg); }
.dash-tbl th[aria-sort]::after { content: none; }
.dash-tbl tbody td { height: 48px; padding-top: 4px; padding-bottom: 4px; border-top: 1px solid var(--control-active); border-bottom: 0; }
.dash-tbl td.num { white-space: nowrap; }
.dash-tbl tbody tr:hover { background: var(--control); }
.dash-pos-scroll > table { min-width: 480px; }
.dash-pos-tbl th:nth-child(1) { width: 34%; }
.dash-x { width: 28px; }
.dash-pos-tbl tbody tr.dash-row { cursor: pointer; }
.dash-tok { display: flex; align-items: center; gap: 10px; min-width: 0; }
.dash-tok .tile { font-size: 11px; }
.dash-tok-text { display: flex; flex-direction: column; min-width: 0; }
.dash-tok-text > a, .dash-tok-text > strong { overflow: hidden; color: var(--fg); font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }
.dash-tok-text > a:hover { color: var(--accent-link); }
.dash-tok-text > small { overflow: hidden; color: var(--muted); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.dash-sec { color: var(--text-secondary); }
.dash-pnl { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.25; }
.dash-pnl b { font-weight: 500; }
.dash-pnl small { font-size: 11px; opacity: .7; }
.dash-pnl small.dash-muted { opacity: 1; }
.dash-expand { width: 22px; height: 22px; padding: 0; border: 0; border-radius: 6px; background: transparent; color: var(--muted); font-size: 13px; line-height: 1; transition: transform var(--motion) var(--ease); }
.dash-expand:hover:not(:disabled) { background: var(--control-active); color: var(--fg); }
.dash-expand[aria-expanded="true"] { transform: rotate(90deg); color: var(--fg); }
tr.dash-detail > td { height: auto; padding: 12px 20px 16px; background: var(--row-sel); }
tr.dash-detail:hover { background: transparent; }
.dash-kv { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px 20px; margin: 0; }
.dash-kv > div { min-width: 0; }
.dash-kv dt { color: var(--muted); font-size: 11px; }
.dash-kv dd { margin: 2px 0 0; font-size: 12px; overflow-wrap: anywhere; }
.dash-kv .dash-kv-wide { grid-column: 1 / -1; }
.dash-issues { margin: 4px 0 0 16px; padding: 0; color: var(--warning-text); font-size: 11px; }
.dash-detail-links { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 14px; margin-top: 10px; font-size: 12px; }
.dash-tbl-foot { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; padding: 10px 20px; border-top: 1px solid var(--control-active); color: var(--muted); font-size: 11px; }
.dash-tbl-foot > span:empty { display: none; }
.dash-tbl .empty { padding: 32px 16px; }
.dash-tbl tr.dash-empty-row:hover { background: transparent; }
.dash-tbl tr.skel td { height: 48px; }

.dash-page .card.dash-trades { padding: 0; overflow: hidden; }
.dash-trades-head { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--hairline); }
.dash-fill-scroll > table { min-width: 860px; }
.dash-fill-tbl thead th { padding-top: 8px; border-bottom: 1px solid var(--hairline); }
.dash-fill-tbl tbody td { height: 40px; padding-top: 2px; padding-bottom: 2px; border-top: 0; border-bottom: 1px solid var(--hairline-inner); font-size: 12px; }
.dash-fill-tbl tbody tr:last-child td { border-bottom: 0; }
.dash-fill-tbl .dash-time { color: var(--muted); font: 400 11px var(--font-mono); white-space: nowrap; }
.dash-fill-tbl .dash-mono { color: var(--text-secondary); font: 400 11px var(--font-mono); }
.dash-fill-tok { display: flex; align-items: center; gap: 8px; min-width: 0; font-weight: 500; white-space: nowrap; }
.dash-side { font-weight: 600; }
.dash-side.buy { color: var(--ok); }
.dash-side.sell { color: var(--danger-text); }
.dash-fill-tbl tr.dash-failed td { opacity: .6; }
.dash-fill-tbl a.ext, .dash-fill-tbl .dash-sig { font-family: var(--font-mono); font-size: 11px; }

.dash-page .card.dash-notes { padding: 0; }
.dash-notes-toggle { display: flex; align-items: center; gap: 10px; width: 100%; height: auto; padding: 14px 20px; border: 0; border-radius: 12px; background: transparent; color: var(--fg); text-align: left; }
.dash-notes-toggle:hover:not(:disabled) { background: transparent; }
.dash-notes-label { color: var(--muted); font-size: 12px; font-weight: 400; }
.dash-notes-body { display: flex; flex-direction: column; gap: 10px; padding: 0 20px 14px; }
.dash-notes-body ul { margin: 0; padding-left: 18px; color: var(--text-secondary); font-size: 12px; line-height: 1.7; }
.dash-attribution { margin: 0; color: var(--muted); font-size: 11px; }
.dash-attribution a { color: var(--text-secondary); }

/* ---- first use ----
   The welcome block sits in the middle of the free page area. A step card
   turns orange on hover and on keyboard focus. */
.dash-page.dash-first { position: relative; min-height: calc(100dvh - 24px); justify-content: center; }
.dash-welcome { position: relative; z-index: 1; isolation: isolate; display: flex; flex-direction: column; align-items: center; gap: 28px; width: 100%; max-width: 980px; margin: 0 auto; padding-bottom: 6vh; }
.dash-welcome::before { content: ""; position: absolute; z-index: -1; inset: -80px 10% auto; height: 340px; background: radial-gradient(closest-side, color-mix(in srgb, var(--accent) 16%, transparent), transparent); filter: blur(24px); pointer-events: none; }
.dash-welcome-head { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; }
.dash-welcome-mark { display: grid; place-items: center; width: 56px; height: 56px; margin-bottom: 6px; border: 1px solid var(--stroke-strong); border-radius: 16px; background: linear-gradient(180deg, var(--raised), var(--card)); box-shadow: 0 0 0 6px color-mix(in srgb, var(--accent) 6%, transparent), 0 12px 32px rgba(0, 0, 0, .45); }
.dash-welcome-head :is(h2, .dash-welcome-title) { margin: 0; color: var(--fg); font-size: 34px; font-weight: 650; letter-spacing: -.035em; line-height: 1.15; }
.dash-welcome-head :is(h2, .dash-welcome-title) span { color: var(--accent); }
.dash-welcome-head p { margin: 0; color: var(--text-secondary); font-size: 14px; }
.dash-steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; width: 100%; }
.dash-step { position: relative; display: flex; flex-direction: column; gap: 8px; min-height: 196px; padding: 20px; border: 1px solid var(--hairline); border-radius: 16px; background: linear-gradient(180deg, color-mix(in srgb, var(--raised) 70%, var(--card)), var(--card)); color: var(--fg); overflow: hidden; transition: border-color var(--motion) var(--ease), transform var(--motion) var(--ease), box-shadow var(--motion) var(--ease), background var(--motion) var(--ease); }
.dash-step::before { content: ""; position: absolute; inset: 0 0 auto; height: 2px; background: linear-gradient(90deg, transparent, var(--accent), transparent); opacity: 0; transition: opacity var(--motion) var(--ease); }
.dash-step-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.dash-step-icon { display: grid; place-items: center; width: 44px; height: 44px; border: 1px solid var(--stroke-strong); border-radius: 12px; background: var(--control); color: var(--text-secondary); transition: color var(--motion) var(--ease), background var(--motion) var(--ease), border-color var(--motion) var(--ease); }
.dash-step-icon svg { width: 20px; height: 20px; }
.dash-step-n { color: var(--faint); font: 500 12px var(--font-mono); letter-spacing: .04em; transition: color var(--motion) var(--ease); }
.dash-step-t { font-size: 17px; font-weight: 600; letter-spacing: -.01em; }
.dash-step-d { color: var(--muted); font-size: 13px; line-height: 1.5; }
.dash-step-cta { display: inline-flex; align-items: center; gap: 6px; margin-top: auto; padding-top: 12px; color: var(--text-secondary); font-size: 13px; font-weight: 500; transition: color var(--motion) var(--ease); }
.dash-step-arrow { transition: transform var(--motion) var(--ease); }
.dash-step:is(:hover, :focus-visible) { border-color: color-mix(in srgb, var(--accent) 70%, transparent); background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 9%, var(--card)), var(--card) 70%); box-shadow: 0 16px 40px -18px color-mix(in srgb, var(--accent) 55%, transparent); transform: translateY(-3px); color: var(--fg); }
.dash-step:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.dash-step:is(:hover, :focus-visible)::before { opacity: 1; }
.dash-step:is(:hover, :focus-visible) .dash-step-icon { border-color: color-mix(in srgb, var(--accent) 45%, transparent); background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent); }
.dash-step:is(:hover, :focus-visible) :is(.dash-step-n, .dash-step-cta) { color: var(--accent); }
.dash-step:is(:hover, :focus-visible) .dash-step-arrow { transform: translateX(4px); }
.dash-welcome-note { display: flex; align-items: center; gap: 14px; padding: 6px 6px 6px 16px; border: 1px solid var(--hairline); border-radius: 999px; background: var(--card); color: var(--text-secondary); font-size: 12px; line-height: 1.5; }
.dash-welcome-note-text { display: inline-flex; align-items: center; gap: 10px; }
.dash-welcome-note-text svg { flex: none; color: var(--accent); }
.dash-welcome-note-text { color: var(--fg); font-weight: 500; }
.dash-welcome-note-text i { flex: none; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 18%, transparent); }
.dash-welcome-note .dash-reconcile { border-radius: 999px; }
.dash-welcome-note .dash-reconcile:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
@media (prefers-reduced-motion: reduce) {
  .dash-step, .dash-step-arrow { transition: none; }
  .dash-step:is(:hover, :focus-visible), .dash-step:is(:hover, :focus-visible) .dash-step-arrow { transform: none; }
}
.dash-page.dash-first .dash-controls, .dash-page.dash-first .dash-title { display: none; }
.dash-page.dash-first .dash-head:not(:has(.dash-title-block)) { display: none; }

/* A faded picture of the Dashboard (dashGhost) fills the page behind the
   welcome block; it shows only while the welcome block does. */
.dash-page:not(.dash-first) > .dash-ghost { display: none; }
.dash-page > .dash-ghost { position: absolute; inset: 0; z-index: 0; padding: inherit; overflow: hidden; }
.dash-ghost { display: flex; flex-direction: column; gap: 22px; filter: blur(3px) saturate(.85); opacity: .22; pointer-events: none; user-select: none; -webkit-mask-image: linear-gradient(to bottom, #000 70%, transparent); mask-image: linear-gradient(to bottom, #000 70%, transparent); }
.dash-ghost-top { display: grid; grid-template-columns: 1.5fr repeat(3, 1fr); gap: 0; align-items: end; }
.dash-ghost-hero, .dash-ghost-kpi { display: flex; flex-direction: column; gap: 8px; }
.dash-ghost-kpi { padding-left: 28px; border-left: 1px solid var(--hairline); }
.dash-ghost-label { color: var(--muted); font-size: 13px; }
.dash-ghost-num { align-self: flex-start; display: inline-flex; align-items: center; gap: 12px; padding: 10px 16px; border: 1px solid color-mix(in srgb, var(--ok) 40%, transparent); border-radius: 12px; background: color-mix(in srgb, var(--ok) 10%, transparent); color: var(--fg); font-size: 38px; font-weight: 700; letter-spacing: -.02em; }
.dash-ghost-num small { padding: 3px 8px; border-radius: 6px; background: color-mix(in srgb, var(--ok) 20%, transparent); color: var(--ok); font-size: 12px; font-weight: 600; }
.dash-ghost-sub { color: var(--text-secondary); font-size: 12px; }
.dash-ghost-kv { font-size: 30px; font-weight: 600; }
.dash-ghost-card { border: 1px solid var(--hairline); border-radius: 14px; background: var(--card); }
.dash-ghost-chart { display: flex; flex-direction: column; gap: 10px; height: 280px; padding: 16px 20px; }
.dash-ghost-chart svg { flex: 1; width: 100%; min-height: 0; }
.dash-ghost-tabs { display: flex; gap: 22px; color: var(--muted); font-size: 13px; }
.dash-ghost-tabs b { color: var(--fg); font-weight: 600; }
.dash-ghost-line { fill: none; stroke: var(--ok); stroke-width: 2.5; vector-effect: non-scaling-stroke; }
.dash-ghost-area { fill: color-mix(in srgb, var(--ok) 16%, transparent); }
.dash-ghost-bottom { display: grid; grid-template-columns: 1fr 1.2fr; gap: 22px; align-items: start; }
.dash-ghost-cardhead { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 4px 0 12px; color: var(--muted); font-size: 12px; }
.dash-ghost-cardhead b { color: var(--fg); font-size: 14px; font-weight: 600; }
.dash-ghost-calcard { padding: 16px 20px; }
.dash-ghost-cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.dash-ghost-cal i { aspect-ratio: 1.15; border-radius: 6px; background: var(--control); }
.dash-ghost-cal i.off { background: transparent; }
.dash-ghost-cal i.up { background: color-mix(in srgb, var(--ok) 30%, transparent); }
.dash-ghost-cal i.down { background: color-mix(in srgb, var(--danger) 35%, transparent); }
.dash-ghost-rows { display: flex; flex-direction: column; padding: 16px 20px 8px; }
.dash-ghost-row { display: grid; grid-template-columns: 32px 1.4fr 1fr 90px; align-items: center; gap: 16px; height: 54px; border-top: 1px solid var(--hairline); }
.dash-ghost-row b { width: 32px; height: 32px; border-radius: 8px; background: var(--control); }
.dash-ghost-row span { height: 10px; border-radius: 5px; background: var(--control); }
.dash-ghost-row span + span { width: 70%; justify-self: end; }
.dash-ghost-row em { height: 10px; border-radius: 5px; }
.dash-ghost-row em.up { background: color-mix(in srgb, var(--ok) 50%, transparent); }
.dash-ghost-row em.down { background: color-mix(in srgb, var(--danger) 50%, transparent); }

/* ---- dialogs ---- */
.dash-dialog { width: min(720px, calc(100vw - 48px)); max-width: none; max-height: 90vh; padding: 0; border: 1px solid var(--input-border); border-radius: 16px; background: var(--raised); color: var(--fg); box-shadow: 0 40px 100px rgba(0, 0, 0, .7); overflow: hidden; }
.dash-dialog[open] { display: flex; flex-direction: column; }
.dash-dialog::backdrop { background: rgba(0, 0, 0, .6); backdrop-filter: blur(3px); }
.dash-card-dialog { width: min(1040px, calc(100vw - 48px)); }
.dash-dialog-head { display: flex; align-items: center; gap: 10px; padding: 16px 20px; border-bottom: 1px solid var(--kbd-bg); }
.dash-dialog-head h3 { flex: 1; min-width: 0; margin: 0; font-size: 15px; font-weight: 600; }
.dash-dialog-head h3:focus { outline: none; }
.dash-card-scope { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dash-close { width: 28px; height: 28px; padding: 0; border: 0; border-radius: 8px; background: transparent; color: var(--muted); font-size: 18px; line-height: 1; }
.dash-close:hover:not(:disabled) { background: var(--control-active); color: var(--fg); }
.dash-dialog-body { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 14px; padding: 20px; overflow: auto; overscroll-behavior: contain; }
.dash-dialog-body h4 { margin: 4px 0 -4px; color: var(--text-secondary); font-size: 12px; font-weight: 500; }
.dash-dialog-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 0 20px 20px; }
.dash-day-stats { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 1px; margin: 0; border-radius: 10px; overflow: hidden; background: var(--hairline); }
.dash-day-stats > div { display: flex; flex-direction: column; gap: 3px; min-width: 0; padding: 12px; background: var(--panel); }
.dash-day-stats dt { color: var(--muted); font-size: 11px; }
.dash-day-stats dd { margin: 0; font-size: 16px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dash-day-line { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.dash-dialog .dash-tbl thead th { background: var(--raised); }
.dash-dialog .dash-tbl th:first-child, .dash-dialog .dash-tbl td:first-child { padding-left: 0; }
.dash-dialog .dash-tbl th:last-child, .dash-dialog .dash-tbl td:last-child { padding-right: 0; }
.dash-dialog .dash-tbl tbody td { height: 40px; font-size: 12px; border-top: 0; border-bottom: 1px solid var(--hairline-inner); }
.dash-dialog .dash-fill-tbl thead th { border-bottom: 1px solid var(--hairline); }
.dash-day-pos > table { min-width: 620px; }
.dash-state-line { margin: 0; padding: 28px 0; color: var(--muted); font-size: 12px; text-align: center; }
.dash-help { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.5; }

.dash-card-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 20px; align-items: start; }
.dash-card-preview { position: relative; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.dash-card-preview canvas { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; border: 1px solid var(--input-border); border-radius: 14px; background: var(--bg); }
.dash-clip-source { position: absolute; top: 0; left: 0; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.dash-card-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.dash-card-note { color: var(--muted); font-size: 11px; white-space: nowrap; }
.dash-card-status { min-height: 16px; margin: -4px 0 0; color: var(--text-secondary); font-size: 12px; }
.dash-card-status:empty { display: none; }
.dash-card-form { display: flex; flex-direction: column; gap: 14px; min-width: 0; font-size: 12px; }
.dash-fs { display: flex; flex-direction: column; gap: 6px; min-width: 0; margin: 0; padding: 0; border: 0; }
.dash-fs:disabled { opacity: .55; }
.dash-fs > legend { float: left; width: 100%; margin: 0 0 6px; padding: 0; color: var(--muted); font-size: 12px; }
.dash-fs > legend + * { clear: both; }
.dash-seg-fill { display: flex; width: 100%; }
.dash-ropt { position: relative; flex: 1; justify-content: center; height: 28px; margin: 0; padding: 0 6px; color: var(--dim); font-size: 12px; cursor: pointer; }
.dash-ropt > input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.dash-ropt:has(> input:checked) { background: var(--seg-on); color: var(--fg); }
.dash-ropt:has(> input:focus-visible) { outline: 2px solid var(--accent); outline-offset: -2px; }
.dash-upload-row { display: flex; flex-wrap: wrap; gap: 6px; }
.dash-upload { position: relative; margin: 0; }
.dash-upload > input[type=file] { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.dash-upload:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.dash-video-pane { display: flex; flex-direction: column; gap: 6px; }
.dash-video-pane > .btn { align-self: flex-start; }
.dash-trim { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 10px; }
.dash-trim > label { margin: 0; color: var(--muted); font-size: 11px; }
.dash-trim input[type=number] { min-height: 32px; height: 32px; margin-top: 4px; padding: 0 10px; border-radius: 8px; font-size: 12px; }
.dash-trim .dash-check { grid-column: 1 / -1; }
.dash-settings { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.dash-settings > input, .dash-settings > select { min-height: 32px; height: 32px; padding: 0 10px; border-radius: 8px; background-color: var(--panel); font-size: 12px; }
.dash-settings > select { padding-right: 26px; background-position: right 10px center; }
.dash-colours { display: flex; align-items: center; gap: 8px; height: 32px; padding: 0 10px; border: 1px solid var(--input-border); border-radius: 8px; background: var(--panel); }
.dash-colours > span { flex: 1; color: var(--muted); }
.dash-colours input[type=color] { width: 16px; height: 16px; padding: 0; border: 0; border-radius: 4px; background: none; cursor: pointer; }
.dash-colours input[type=color]::-webkit-color-swatch-wrapper { padding: 0; }
.dash-colours input[type=color]::-webkit-color-swatch { border: 0; border-radius: 4px; }
.dash-dchips { display: flex; flex-wrap: wrap; gap: 4px; }
.dash-dchip { position: relative; display: inline-flex; align-items: center; gap: 6px; height: 26px; margin: 0; padding: 0 9px; border: 1px solid var(--kbd-bg); border-radius: 6px; background: transparent; color: var(--muted); font-size: 11px; cursor: pointer; user-select: none; }
.dash-dchip::before { content: "○"; }
.dash-dchip > input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.dash-dchip:has(> input:checked) { border-color: var(--stroke-strong); background: var(--chip); color: var(--fg); }
.dash-dchip:has(> input:checked)::before { content: "✓"; }
.dash-dchip:has(> input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---- skeletons and empty ---- */
.dash-skel { display: inline-block; height: 10px; border-radius: 5px; background: var(--chip); animation: bz-pulse 1.4s ease-in-out infinite; vertical-align: middle; }

/* Narrow calendar grid (about 50 px per day): smaller day values. */
@container calgrid (max-width: 400px) {
  .dash-cal-day { padding: 4px 5px; }
  .dash-cal-day .dash-cal-val { font-size: 10px; letter-spacing: -.02em; }
}

/* ---- container tiers ---- */
@container dash (max-width: 900px) {
  .dash-hero { grid-template-columns: repeat(3, minmax(0, 1fr)); row-gap: 22px; }
  .dash-hero-main { grid-column: 1 / -1; padding-right: 0; }
  .dash-stat:first-of-type { padding-left: 0; border-left: 0; }
  .dash-pair { grid-template-columns: minmax(0, 1fr); }
}
@container dash (max-width: 640px) {
  .dash-hero { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .dash-stat, .dash-stat:first-of-type { display: flex; gap: 3px; padding: 12px; border: 1px solid var(--hairline); border-radius: 10px; background: var(--card); }
  .dash-stat-label, .dash-stat-sub { font-size: 11px; }
  .dash-stat-label { color: var(--muted); }
  .dash-stat-value { font-size: 18px; letter-spacing: -.02em; }
  .dash-stat-m { display: flex; }
  .dash-hero-main { gap: 6px; margin-bottom: 6px; }
  .dash-hero-label { font-size: 12px; }
  .dash-hero .hero-box.dash-hero-box { padding: 0; border: 0; background: transparent; }
  .dash-hero .dash-hero-num { font-size: 40px; letter-spacing: -.04em; -webkit-text-stroke: 0; }
  .dash-hero .hero-box.pos .dash-hero-num { color: var(--ok); }
  .dash-hero .hero-box.neg .dash-hero-num { color: var(--danger); }
  .dash-return { display: none; }
  .dash-hero-split { font-size: 12px; }
  .dash-hero-split b { color: var(--text-secondary); }
  .dash-cov { padding: 4px 9px; font-size: 11px; }
  .dash-hero-unit:not(:empty) { display: inline; }
  .dash-page .card.dash-chart-card { gap: 8px; padding: 12px; border-radius: 12px; }
  .dash-tabs { gap: 4px; }
  .dash-tab { padding: 4px 9px; border-radius: 5px; font-size: 11px; }
  .dash-long { display: none; }
  .dash-short { display: inline; }
  .dash-hint { display: none; }
  .dash-readout { margin: 0; }
  .dash-readout > span:last-child:not(:first-child) { display: none; }
  .dash-chart { height: 140px; }
  .dash-page .card.dash-cal { gap: 10px; padding: 12px; border-radius: 12px; }
  .dash-cal-grid { gap: 3px; }
  .dash-cal-day { aspect-ratio: 1; padding: 3px; border-radius: 5px; }
  .dash-cal-day .dash-cal-num { font-size: 9px; }
  .dash-cal-day .dash-cal-val, .dash-cal-day .dash-cal-sub { display: none; }
  .dash-cal-weekday { font-size: 10px; }
  .dash-cal-label, .dash-cal-total { font-size: 13px; }
  .dash-cal-month { aspect-ratio: 1.3; }
  .dash-pos-head { padding: 12px; }
  .dash-search { flex: 1 1 140px; }
  .dash-tbl th:first-child, .dash-tbl td:first-child { padding-left: 12px; }
  .dash-tbl th:last-child, .dash-tbl td:last-child { padding-right: 12px; }
  .dash-tbl-foot { padding: 10px 12px; }
  .dash-trades-head { padding: 10px 12px; }
  .dash-notes-toggle { padding: 12px; }
  .dash-notes-body { padding: 0 12px 12px; }
  .dash-steps { grid-template-columns: minmax(0, 1fr); }
  .dash-ghost-top { grid-template-columns: 1fr 1fr; }
  .dash-ghost-bottom { grid-template-columns: 1fr; }
  .dash-step { gap: 4px; min-height: 0; padding: 16px; }
  .dash-step-top { margin-bottom: 6px; }
  .dash-step-icon { width: 38px; height: 38px; }
  .dash-step-cta { padding-top: 8px; }
  .dash-welcome-head :is(h2, .dash-welcome-title) { font-size: 26px; }
  .dash-welcome-note { flex-direction: column; gap: 8px; padding: 12px 16px; border-radius: 14px; text-align: center; }
}

/* ---- viewport tiers ---- */
@media (max-width: 999.98px) {
  .dash-card-layout { grid-template-columns: minmax(0, 1fr); }
  .dash-bd-cols { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 720px) {
  .dash-page { gap: 14px; }
  .dash-main { gap: 14px; }
  .dash-head { gap: 8px; }
  .dash-head > .dash-title { display: none; }
  .dash-controls { gap: 6px; width: 100%; }
  .dash-ranges { flex-basis: 100%; padding: 0; background: transparent; gap: 4px; }
  .dash-ranges .seg-opt { padding: 5px 10px; }
  .dash-chip, .dash-chip select, .dash-reconcile { height: 28px; font-size: 11px; }
  .dash-reconcile { margin-left: auto; padding: 0 10px; }
  .dash-banner { margin: 0; }
  .dash-dialog { width: calc(100vw - 24px); max-height: calc(100dvh - 24px); margin: auto auto 12px; border-radius: 20px; }
  .dash-card-dialog { width: calc(100vw - 24px); }
  .dash-dialog-head { padding: 14px 16px; }
  .dash-dialog-body { padding: 16px; }
  .dash-dialog-foot { padding: 0 16px 16px; }
  .dash-day-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .dash-card-note { white-space: normal; }
  .dash-settings { grid-template-columns: minmax(0, 1fr); }
}
