/* The Dashboard (templates/dashboard/): Overview, Referrals and Kalshi.
   Shared: the two-column grid, cards, money colors. dp-* is the Kalshi tab
   and shared pieces, dc-* the Overview, dr-* Referrals. */

.dash { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 16px; align-items: start; }
.dash-main, .dash-side { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.dash [id^="sec-"] { scroll-margin-top: calc(var(--tl-topbar-h, 56px) + 16px); }
/* Overview: the side column (Accounts, Referrals) stays in view while the
   main column scrolls, once the columns sit side by side. */
@media (min-width: 1101px) {
  .dash.is-pinned > .dash-side { position: sticky; top: calc(var(--tl-topbar-h, 56px) + 16px); }
}
@media (max-width: 1100px) { .dash { grid-template-columns: minmax(0, 1fr); } }
/* The left sidebar: room above its Exchange accounts label. */
.dash-nav .tl-side-label { margin-top: 14px; }

.dp-pad { padding: 16px 18px 18px; }
.dp-lede { margin: 0 0 14px; font-size: 14px; line-height: 1.55; color: var(--tl-ink-70); max-width: 62ch; }
.dp-lede.is-quiet { margin: 0; color: var(--tl-ink-55); }
.dp-dim { color: var(--tl-ink-50); }
.dash .is-up { color: var(--tl-up); }
.dash .is-down { color: var(--tl-down); }
.dp-note { margin: 0; padding: 0 4px; font-size: 12.5px; line-height: 1.55; color: var(--tl-ink-55); max-width: 78ch; }

/* ---- On the line */
.dp-head-sum { font-size: 13px; color: var(--tl-ink-60); font-variant-numeric: tabular-nums; white-space: nowrap; }
.dp-head-sum b { color: var(--tl-ink); font-weight: 650; }
.dp-pos-list { list-style: none; margin: 0; padding: 0; }
.dp-pos { display: grid; grid-template-columns: minmax(0, 1fr) minmax(200px, 1.5fr) 112px; gap: 24px; align-items: center; margin: 0; padding: 16px 18px; }
.dp-pos + .dp-pos { border-top: 1px solid var(--tl-line-06); }
.dp-pos-game { font-size: 14px; font-weight: 600; color: var(--tl-ink); text-decoration: none; }
.dp-pos-game:hover { text-decoration: underline; text-underline-offset: 2px; }
.dp-pos-pick { margin-top: 3px; font-size: 13px; color: var(--tl-ink-60); }
.dp-pos-pick b { font-weight: 600; color: var(--tl-ink-75); }
.dp-pos-money { text-align: right; font-variant-numeric: tabular-nums; }
.dp-pos-val { font-size: 17px; font-weight: 650; letter-spacing: -0.3px; }
.dp-pos-chg { margin-top: 2px; font-size: 12.5px; white-space: nowrap; }
@media (max-width: 680px) {
  .dp-pos { grid-template-columns: minmax(0, 1fr) auto; gap: 10px 16px; }
  .dp-pos-rail { grid-column: 1 / -1; grid-row: 2; }
}

/* The price rail: 0–100¢. --a is the price paid, --b the price now (both
   0–100). --t runs 0 to 1 once on load, so the now marker travels out from
   the price paid to where it stands. */
@property --t { syntax: '<number>'; inherits: true; initial-value: 1; }
.dp-rail {
  --c: calc(var(--a) + (var(--b) - var(--a)) * var(--t));
  --ink: var(--tl-ink-45);
  position: relative; height: 40px;
  animation: dp-run 0.9s cubic-bezier(.2, .7, .2, 1) 0.2s both;
}
.dp-rail.is-up { --ink: var(--tl-up); }
.dp-rail.is-down { --ink: var(--tl-down); }
@keyframes dp-run { from { --t: 0; } to { --t: 1; } }
.dp-rail-track, .dp-rail-fill { position: absolute; top: 25.5px; height: 5px; border-radius: 3px; }
.dp-rail-track { left: 0; right: 0; background: var(--tl-fill-06); }
/* the 50¢ mark */
.dp-rail-track::after { content: ''; position: absolute; left: 50%; top: -3px; width: 1px; height: 10px; background: var(--tl-line-14); }
.dp-rail-fill { left: calc(min(var(--a), var(--c)) * 1%); width: calc((max(var(--a), var(--c)) - min(var(--a), var(--c))) * 1%); background: var(--ink); }
.dp-rail-mark { position: absolute; top: 28px; border-radius: 50%; transform: translate(-50%, -50%); }
.dp-rail-mark.is-paid { left: calc(var(--a) * 1%); width: 10px; height: 10px; background: var(--tl-card-bg); box-shadow: inset 0 0 0 2px var(--tl-ink-55); }
.dp-rail-mark.is-now { left: calc(var(--c) * 1%); width: 12px; height: 12px; background: var(--ink); box-shadow: 0 0 0 3px var(--tl-card-bg); }
/* A label sits over its marker and slides along its own width with the
   marker (0% at the left end, 100% at the right), so it never leaves the
   rail. Close prices share one label. */
.dp-rail-lbl { position: absolute; top: 0; font-size: 11.5px; line-height: 16px; white-space: nowrap; font-variant-numeric: tabular-nums; color: var(--tl-ink-55); }
.dp-rail-lbl.is-paid { left: calc(var(--a) * 1%); transform: translateX(calc(var(--a) * -1%)); }
.dp-rail-lbl.is-now { left: calc(var(--c) * 1%); transform: translateX(calc(var(--c) * -1%)); color: var(--ink); font-weight: 600; }
.dp-rail-lbl.is-both { --m: calc((var(--a) + var(--b)) / 2); left: calc(var(--m) * 1%); transform: translateX(calc(var(--m) * -1%)); }
.dp-rail-lbl.is-both b { color: var(--ink); font-weight: 600; }
.dp-rail.is-flat .dp-rail-lbl b { color: var(--tl-ink-75); }
.dp-rail-none { font-size: 12.5px; color: var(--tl-ink-50); }
@media (prefers-reduced-motion: reduce) { .dp-rail { animation: none; } }

/* ---- Settled */
.dp-table a { color: var(--tl-ink); }
.dp-final { margin-left: 4px; font-size: 12px; color: var(--tl-ink-50); font-variant-numeric: tabular-nums; }
.dp-res { display: inline-block; padding: 1px 7px; border-radius: var(--tl-r-tag); font-size: 12px; font-weight: 600; background: var(--tl-fill-05); color: var(--tl-ink-60); }
.dp-res.is-won { background: var(--tl-up-bg); color: var(--tl-up); }
.dp-res.is-lost { background: var(--tl-down-bg); color: var(--tl-down); }
.dp-res.is-live { background: var(--tl-down-bg); color: var(--tl-down); }

/* ---- Side: the account */
.dp-state { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--tl-ink-60); }
.dp-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--tl-up); }
.dp-state.is-bad { color: var(--tl-down); }
.dp-state.is-bad .dp-dot { background: var(--tl-down); }
.dp-state.is-off { color: var(--tl-ink-50); }
.dp-cash-k, .dp-wl-sub { font-size: 12.5px; color: var(--tl-ink-55); }
.dp-cash, .dp-wl { font-size: 30px; font-weight: 650; letter-spacing: -0.9px; line-height: 1.15; font-variant-numeric: tabular-nums; }
.dp-wl-sub { margin-top: 2px; }
.dp-alert { margin: 12px 0 0; padding: 9px 12px; border-radius: var(--tl-r-btn); background: var(--tl-down-bg); color: var(--tl-down); font-size: 13px; line-height: 1.45; }
.dp-meta { margin: 14px 0 0; padding: 0; }
.dp-meta > div { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; border-top: 1px solid var(--tl-line-06); font-size: 13px; }
.dp-meta dt { color: var(--tl-ink-55); }
.dp-meta dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; color: var(--tl-ink-75); }
.dp-meta dd.dp-net { font-weight: 650; }
.dp-acct-actions { margin-top: 12px; }

/* ---- Side: the record and its form guide (oldest to newest) */
.dp-form { display: flex; flex-wrap: wrap; gap: 3px; list-style: none; margin: 14px 0 0; padding: 0; }
.dp-form li { width: 12px; height: 12px; margin: 0; border-radius: 2px; background: var(--tl-fill-07); }
.dp-form li.is-won { background: var(--tl-up); }
.dp-form li.is-lost { background: var(--tl-down); }

/* ---- Side: what we can see */
.dp-sees .dp-list { margin: 0; padding: 14px 18px 4px; list-style: none; }
.dp-sees .dp-list + .dp-sees-h { margin-top: 6px; }
.dp-list li { position: relative; margin: 0 0 8px; padding-left: 22px; font-size: 13.5px; line-height: 1.45; color: var(--tl-ink-75); }
.dp-list li::before { position: absolute; left: 2px; top: 0; font-weight: 700; }
.dp-list.is-yes li::before { content: '✓'; color: var(--tl-up); }
.dp-list.is-no li::before { content: '×'; color: var(--tl-down); font-size: 15px; line-height: 1.3; }
.dp-sees-h { margin: 0; padding: 12px 18px 0; border-top: 1px solid var(--tl-line-06); font-size: 13px; font-weight: 650; color: var(--tl-ink); }
.dp-sees .dp-list.is-no { padding-bottom: 8px; }

/* ---- Connect */
.dp-steps { margin: 0 0 18px; padding-left: 20px; font-size: 14px; line-height: 1.6; color: var(--tl-ink-75); max-width: 66ch; }
.dp-steps li + li { margin-top: 4px; }
.dp-steps a { color: var(--tl-ink); text-decoration: underline; text-underline-offset: 2px; }
.ka-form { display: flex; flex-direction: column; gap: 6px; max-width: 560px; }
.ka-label { margin-top: 8px; font-size: 12.5px; font-weight: 600; color: var(--tl-ink-75); }
.ka-label-hint { font-weight: 400; color: var(--tl-ink-55); }
.ka-link { padding: 0; border: 0; background: none; color: var(--tl-ink); font: inherit; text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
.ka-pem { font-family: var(--tl-mono) !important; font-size: 12px !important; }
.ka-safe { margin: 8px 0 0; font-size: 12.5px; line-height: 1.5; color: var(--tl-ink-55); }
.ka-err { margin: 6px 0 0; font-size: 13px; color: var(--tl-down); }
.ka-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 10px; flex-wrap: wrap; }

/* ---- Disconnect dialog */
.ka-dlg { max-width: 440px; padding: 20px; border: 1px solid var(--tl-line-10); border-radius: var(--tl-r-card); background: var(--tl-card-bg); color: var(--tl-ink); }
.ka-dlg::backdrop { background: rgba(0, 0, 0, .45); }
.ka-dlg h2 { margin: 0 0 8px; font-size: 17px; }
.ka-dlg p { margin: 0; font-size: 14px; line-height: 1.5; color: var(--tl-ink-70); }

/* ---- Overview: segmented buttons in card heads */
.dash .dc-seg { display: inline-flex !important; width: auto !important; margin: 0 !important; padding: 2px; border: 0 !important; border-radius: var(--tl-r-btn) !important; background: var(--tl-fill-05); box-shadow: none !important; overflow: visible !important; }
.dash .dc-seg + .dc-seg { margin-left: 8px !important; }
/* Pico styles every button and [role=group]: !important keeps these small. */
.dash .dc-seg-b { flex: none !important; width: auto !important; height: auto !important; margin: 0 !important; padding: 3px 10px !important; border: 0 !important; border-radius: calc(var(--tl-r-btn) - 2px) !important; background: none !important; color: var(--tl-ink-60) !important; font-family: inherit !important; font-size: 12.5px !important; font-weight: 600 !important; line-height: 1.4 !important; box-shadow: none !important; cursor: pointer; }
.dash .dc-seg-b:hover { color: var(--tl-ink) !important; }
.dash .dc-seg-b[aria-pressed="true"] { background: var(--tl-card-bg) !important; color: var(--tl-ink) !important; box-shadow: 0 0 0 1px var(--tl-line-10) !important; }
.dash .dc-seg-b:focus-visible { outline: 2px solid var(--tl-ink-55); outline-offset: 1px; }

/* ---- Overview: the portfolio */
.dc-port-top { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; padding: 16px 18px 4px; }
.dc-total { font-size: 34px; font-weight: 650; letter-spacing: -1.1px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.dc-total-sub { margin-top: 4px; font-size: 13px; color: var(--tl-ink-55); font-variant-numeric: tabular-nums; }
.dc-chg { font-size: 13px; color: var(--tl-ink-60); font-variant-numeric: tabular-nums; }
.dc-chg span { font-weight: 650; }
/* The chart runs to the card's edges, like the Markets chart (.mc-chart). */
.dc-port { overflow: hidden; }
.dc-chart { position: relative; height: 300px; margin-top: 12px; border-top: 1px solid var(--tl-line-06); }
/* Lightweight Charts lays out in a table: Pico's cell background and padding off. */
.dc-chart :is(table, tr, td, th) { padding: 0 !important; border: 0 !important; background: transparent !important; }
.dc-chart-empty { position: absolute; inset: 0; display: grid; place-items: center; font-size: 13px; color: var(--tl-ink-55); pointer-events: none; }
.dc-chart-empty[hidden] { display: none; }
.dc-chg b { font-weight: 650; color: var(--tl-ink); }

/* ---- Overview: the P&L calendar */
.dc-month { display: inline-flex; align-items: center; gap: 6px; }
.dc-month-name { min-width: 112px; text-align: center; font-size: 13px; font-weight: 600; color: var(--tl-ink-75); }
.dc-month-a { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: var(--tl-r-btn); color: var(--tl-ink-75); font-size: 18px; line-height: 1; text-decoration: none; }
.dc-month-a:hover { background: var(--tl-fill-06); color: var(--tl-ink); }
.dc-month-a.is-off { color: var(--tl-ink-35); }
.dc-sum { display: grid; grid-template-columns: repeat(5, minmax(0, auto)); justify-content: space-between; gap: 12px 20px; margin: 0; padding: 14px 18px; border-bottom: 1px solid var(--tl-line-06); }
.dc-sum dt { font-size: 12px; color: var(--tl-ink-55); }
.dc-sum dd { margin: 3px 0 0; font-size: 14px; font-weight: 600; color: var(--tl-ink-75); font-variant-numeric: tabular-nums; white-space: nowrap; }
.dc-sum dd .dp-dim { font-weight: 500; }
.dc-sum .dc-sum-big { font-size: 18px; letter-spacing: -0.3px; }
.dc-cal-wrap { padding: 10px 12px 14px; overflow-x: auto; }
.dc-cal { width: 100%; min-width: 640px; border-collapse: separate; border-spacing: 4px; table-layout: fixed; }
.dc-cal th { padding: 2px 0 4px; font-size: 12px; font-weight: 500; color: var(--tl-ink-55); text-align: center; background: none !important; border: 0 !important; }
.dc-cal th.dc-wk-h { width: 17%; }
.dc-cal td { height: 82px; padding: 7px 8px; border: 1px solid var(--tl-line-06) !important; border-radius: 6px; vertical-align: top; text-align: center; background: var(--tl-fill-03, transparent); }
.dc-cal td > span { display: block; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dc-cal .dc-d { font-size: 12.5px; font-weight: 600; color: var(--tl-ink-60); }
.dc-cal .dc-pnl { margin-top: 5px; font-size: 13.5px; font-weight: 650; color: var(--tl-ink-75); }
.dc-cal .dc-n, .dc-cal .dc-wl { margin-top: 2px; font-size: 11.5px; color: var(--tl-ink-50); }
.dc-cal .dc-wl b { color: var(--tl-ink-75); font-weight: 600; }
.dc-cal .dc-whole { display: none; }
.dc-day.is-out { border-color: transparent !important; background: none; }
.dc-day.is-future .dc-d { color: var(--tl-ink-35); }
.dc-day.is-today { box-shadow: inset 0 0 0 1px var(--tl-ink-45); }
.dc-day.is-up { background: var(--tl-up-bg); border-color: transparent !important; }
.dc-day.is-up .dc-pnl { color: var(--tl-up); }
.dc-day.is-down { background: var(--tl-down-bg); border-color: transparent !important; }
.dc-day.is-down .dc-pnl { color: var(--tl-down); }
.dc-wk { background: var(--tl-fill-05) !important; }
.dc-wk .dc-d { color: var(--tl-ink-75); }
/* A week: its net P&L, big, and its return on what was staked, in the
   week's color. */
.dc-cal .dc-wk-pnl { margin-top: 8px; font-size: 17px; font-weight: 700; letter-spacing: -0.3px; color: var(--tl-ink-75); }
.dc-cal .dc-wk-pct { margin-top: 2px; font-size: 12.5px; font-weight: 600; color: var(--tl-ink-60); }
.dc-wk.is-up { background: var(--tl-up-bg) !important; border-color: transparent !important; }
.dc-wk.is-up .dc-wk-pnl, .dc-wk.is-up .dc-wk-pct { color: var(--tl-up); }
.dc-wk.is-down { background: var(--tl-down-bg) !important; border-color: transparent !important; }
.dc-wk.is-down .dc-wk-pnl, .dc-wk.is-down .dc-wk-pct { color: var(--tl-down); }
.dc-cal-card[aria-busy="true"] .dc-cal-wrap { opacity: .55; transition: opacity .15s; }
/* A day or week with settlements filters the trade log; the picked one is ringed. */
.dc-cal [data-cal-from] { cursor: pointer; }
.dc-cal [data-cal-from]:hover { box-shadow: inset 0 0 0 1px var(--tl-line-20); }
.dc-cal [data-cal-from]:focus-visible { outline: 2px solid var(--tl-ink-55); outline-offset: 1px; }
.dc-cal [data-cal-from].is-picked { box-shadow: inset 0 0 0 2px var(--tl-ink-75); }
@media (max-width: 680px) {
  .dc-sum { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dc-sum > div:first-child { grid-column: 1 / -1; }
  .dc-cal { min-width: 0; border-spacing: 2px; }
  .dc-cal th.dc-wk-h, .dc-cal .dc-wk { display: none; }
  .dc-cal td { height: 52px; padding: 5px 2px; border-radius: 4px; }
  .dc-cal .dc-n, .dc-cal .dc-wl { display: none; }
  .dc-cal .dc-pnl { margin-top: 3px; font-size: 11px; }
  .dc-cal .dc-full { display: none; }
  .dc-cal .dc-whole { display: inline; }
}

/* ---- Overview: the trade log */
.dc-nowrap { white-space: nowrap; }
/* A game's two crests, away then home, then the matchup; the pick's crest. */
.dc-game, .dc-pick { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
.dc-crests { display: inline-flex; flex: none; }
.dc-crests .tl-logo + .tl-logo { margin-left: -4px; }
.dc-pick { gap: 6px; }
.dp-pos-pick .dc-pick { gap: 5px; vertical-align: bottom; }
.dp-pos-game.dc-game { white-space: normal; }

/* The Kalshi logo before its name. */
.dx-logo { display: inline-block; flex: none; margin-right: 6px; border-radius: 3px; vertical-align: -2px; }
.tl-h1 .dx-logo { margin-right: 10px; border-radius: 6px; vertical-align: -3px; }
.tl-side-link .dx-logo { margin-right: 0; }
.tl-card-title .dx-logo { vertical-align: -3px; }
.dp-list .dx-logo { margin: 0 4px 0 0; }
.dc-ticker { font-size: 12.5px; color: var(--tl-ink-60); word-break: break-all; }
.dc-more { padding: 10px 18px 0; }
.dc-log-range { display: inline-flex; align-items: center; gap: 4px; margin-right: 10px; padding: 2px 4px 2px 10px; border-radius: var(--tl-r-btn); background: var(--tl-fill-06); font-size: 12.5px; font-weight: 600; color: var(--tl-ink-75); white-space: nowrap; }
.dc-log-range[hidden] { display: none; }
.dash .dc-log-clear { width: 20px !important; height: 20px !important; margin: 0 !important; padding: 0 !important; border: 0 !important; border-radius: 4px !important; background: none !important; color: var(--tl-ink-55) !important; font-size: 15px !important; line-height: 1 !important; cursor: pointer; }
.dash .dc-log-clear:hover { color: var(--tl-ink) !important; background: var(--tl-fill-06) !important; }
.dc-log-note { margin: 0; padding: 10px 18px 14px; font-size: 12.5px; line-height: 1.5; color: var(--tl-ink-55); }

/* ---- Overview: side cards */
.dc-acct-list { list-style: none; margin: 0; padding: 6px 0; }
.dc-acct-list li { margin: 0; }
.dc-acct { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; padding: 10px 18px; color: inherit; text-decoration: none; }
.dc-acct:hover { background: var(--tl-fill-04, var(--tl-fill-05)); }
.dc-acct-name { font-size: 14px; font-weight: 650; color: var(--tl-ink); }
.dc-acct .dp-state { grid-column: 1; grid-row: 2; }
.dc-acct-val { grid-column: 2; grid-row: 1 / span 2; align-self: center; font-size: 15px; font-weight: 650; font-variant-numeric: tabular-nums; }
.dc-acct-go { font-size: 13px; color: var(--tl-ink-75); text-decoration: underline; text-underline-offset: 2px; }
.dc-ref-note { margin: 12px 0 0; font-size: 12.5px; line-height: 1.5; color: var(--tl-ink-55); }
.dash .dc-ref-go { margin-top: 12px; }
.dc-pitch { padding: 14px 18px 8px; }

/* ---- Referrals */
.dr-earn { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px 32px; align-items: start; }
.dr-meta { margin-top: 0; }
.dr-meta > div:first-child { border-top: 0; }
.dr-bar { height: 6px; margin-top: 12px; border-radius: 3px; background: var(--tl-fill-07); overflow: hidden; }
.dr-bar span { display: block; height: 100%; border-radius: 3px; background: var(--tl-up); }
.dr-bar-note { margin: 8px 0 0; font-size: 12.5px; line-height: 1.5; color: var(--tl-ink-55); }
@media (max-width: 680px) { .dr-earn { grid-template-columns: minmax(0, 1fr); } .dr-meta > div:first-child { border-top: 1px solid var(--tl-line-06); } }
.dr-code { font-family: var(--tl-mono); font-size: 26px; font-weight: 600; letter-spacing: 3px; color: var(--tl-ink); }
.dr-code-note { margin: 8px 0 14px; font-size: 13px; line-height: 1.5; color: var(--tl-ink-60); }
.dash .dr-copy { width: auto !important; margin: 0 !important; }
.dr-rules { margin: 0; padding: 14px 18px 12px 36px; font-size: 13.5px; line-height: 1.5; color: var(--tl-ink-70); }
.dr-rules li { margin: 0 0 8px; }
.dr-rules b { color: var(--tl-ink); font-weight: 650; }

/* Pico's form defaults (full-width buttons, field margins) off here. */
.ka-form .tl-input { margin: 0 !important; }
.ka .ka-actions button { width: auto !important; margin: 0 !important; }
.ka-form .ka-actions .tl-btn-ink-sm { padding: 0 18px; }
.ka-form .ka-label { margin-bottom: 0 !important; }
.ka-form .ka-link { width: auto !important; margin: 0 !important; }
.dash dl, .dash dd { margin-bottom: 0; }
