/* Maker cockpit (maker.html #cockpit, maker-cockpit.js). Same calm as the summary above it: black ground, quiet 1px
   panels, sentence-case labels in the page's sans, tabular numbers. Mono only for the quote grid's prices. Green/red
   only for P&L (and the surface's blocks); everything else is white, grey and the one teal (time-left buckets are teal
   at falling strength). */
.ck {
  --ck-teal: #2fc8b4; --ck-amber: #d6a552; --ck-violet: #9b8ef0; --ck-pink: #e391b2;
  --ck-inset: #070708; --ck-edge: rgba(255, 255, 255, 0.07);
  margin: 0; padding: 18px 20px 16px; background: var(--mv-panel); border: 1px solid var(--mv-edge); border-radius: 14px; min-width: 0;
}
.ck[hidden] { display: none; }
.ck .num, .ck-gt, .ck-tt { font-variant-numeric: tabular-nums; }

/* top bar: title, market and length switches, the live numbers */
.ck-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 20px; padding: 2px 2px 16px; }
.ck-bl, .ck-br { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; min-width: 0; }
.ck-title { margin: 0 8px 0 0; font-size: 18px; font-weight: 500; letter-spacing: -0.01em; color: var(--mv-ink); }
.ck-seg { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.ck-chip { font: inherit; font-size: 12px; color: var(--mv-label); background: transparent; border: 1px solid var(--mv-edge-lo); border-radius: 999px; padding: 4px 11px; cursor: pointer; white-space: nowrap; }
.ck-chip:hover { color: var(--mv-ink); background: var(--mv-fill); }
.ck-chip[aria-pressed="true"] { color: var(--mv-ink); border-color: rgba(255, 255, 255, 0.3); background: #2a2a30; } /* r27: selected = raised neutral, like the app's chips (no third cyan) */
.ck-chip:focus-visible, .ck-btn:focus-visible, .ck-c:focus-visible { outline: 2px solid rgba(255, 255, 255, 0.6); outline-offset: 1px; }
.ck-kv { display: inline-flex; align-items: baseline; gap: 6px; font-size: 13px; }
.ck-k { font-size: 12.5px; font-weight: 400; color: var(--mv-label); }
.ck-v { font-size: 13px; color: var(--mv-ink); white-space: nowrap; font-variant-numeric: tabular-nums; }
.ck-v .mut { color: var(--mv-mute); }
.ck-state { min-width: 0; font-size: 12px; color: var(--mv-mute); overflow-wrap: anywhere; }
.ck-state.on { color: var(--mv-accent); }
.ck-state.on::before { content: ""; display: inline-block; width: 6px; height: 6px; margin-right: 6px; border-radius: 50%; background: var(--mv-accent); vertical-align: 1px; }
.ck-state.warn { color: var(--mv-amber); }
.ck-empty { margin: 0 0 8px; padding: 16px; border: 1px solid var(--mv-edge-lo); border-radius: 10px; color: var(--mv-label); font-size: 13px; }

/* panels */
/* reading order: the surface and the portfolio, then the quote grid, then the two time charts, then the tape */
.ck-main { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); grid-template-areas: "surf port" "grid grid" "fv ex" "tape tape"; gap: 12px; align-items: start; }
.ck-main[hidden] { display: none; }
.ck-surf { grid-area: surf; } .ck-port { grid-area: port; } .ck-grid { grid-area: grid; } .ck-fv { grid-area: fv; } .ck-ex { grid-area: ex; } .ck-tape { grid-area: tape; }
.ck-p { background: var(--ck-inset); border: 1px solid var(--ck-edge); border-radius: 12px; padding: 14px 16px 16px; min-width: 0; }
.ck-h { display: flex; align-items: baseline; gap: 10px; min-width: 0; margin-bottom: 12px; }
.ck-h h3 { flex: none; margin: 0; font-size: 14px; font-weight: 500; color: var(--mv-ink); white-space: nowrap; }
.ck-cap { min-width: 0; font-size: 12px; color: var(--mv-mute); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* the surface */
.ck-canvas-wrap { position: relative; }
.ck-canvas { display: block; width: 100%; height: 440px; cursor: grab; touch-action: pan-y; }
.ck-canvas:active { cursor: grabbing; }
.ck-ctl { position: absolute; top: 2px; right: 2px; display: flex; gap: 6px; }
.ck-btn { font: inherit; font-size: 12px; color: var(--mv-ink2); background: var(--mv-fill); border: 1px solid var(--mv-edge); border-radius: 999px; padding: 4px 11px; cursor: pointer; }
.ck-btn:hover { color: var(--mv-ink); background: var(--mv-fill-hi); }
.ck-how { margin-top: 8px; }
.ck-how > summary { font-size: 12.5px; }
.ck-legend { margin: 10px 0 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 18px; font-size: 12px; color: var(--mv-mute); }
.ck-legend div { display: grid; grid-template-columns: 48px minmax(0, 1fr); gap: 8px; }
.ck-legend dt { color: var(--mv-ink2); }
.ck-legend dd { margin: 0; }
.ck-hint { margin: 8px 0 0; font-size: 12px; color: var(--mv-mute); }

/* portfolio */
.ck-cards { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; }
.ck-card { display: grid; align-content: start; gap: 3px; padding: 12px 14px; border: 1px solid var(--ck-edge); border-radius: 8px; background: rgba(255, 255, 255, 0.015); min-width: 0; }
.ck-big { font-size: 22px; font-weight: 500; line-height: 1.15; white-space: nowrap; }
.ck-unit { font-size: 12px; color: var(--mv-label); }
.ck-sub { font-size: 12px; color: var(--mv-mute); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ck-stack { display: grid; gap: 6px; margin: 16px 0; }
.ck-sh { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-top: 2px; }
.ck-sh .ck-cap { text-align: right; }
.ck-sbar { position: relative; height: 16px; border-radius: 3px; background: rgba(255, 255, 255, 0.03); }
.ck-sbar i { position: absolute; top: 3px; height: 10px; }
.ck-sbar i.seg { border-radius: 1px; opacity: 0.9; }
.ck-sbar i.lim { top: 0; height: 16px; width: 1px; background: rgba(255, 255, 255, 0.45); }
.ck-sbar i.zero { top: 0; height: 16px; width: 1px; background: rgba(255, 255, 255, 0.18); }
.ck-sbar i.net { top: -2px; height: 20px; width: 2px; margin-left: -1px; background: #fff; }
.ck-leg { display: flex; flex-wrap: wrap; gap: 2px 14px; font-size: 12px; color: var(--mv-label); font-variant-numeric: tabular-nums; }
.ck-leg b { font-weight: 500; color: var(--mv-ink2); }
.sw { display: inline-block; width: 8px; height: 8px; margin-right: 6px; border-radius: 2px; vertical-align: 0; }
.sw-b0 { background: var(--ck-teal); } .sw-b1 { background: rgba(47, 200, 180, 0.62); } .sw-b2 { background: rgba(47, 200, 180, 0.38); } .sw-b3 { background: rgba(47, 200, 180, 0.2); }
.ck-lean { gap: 6px; }
.ck-lt { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; min-width: 0; }
.ck-lt .ck-k { white-space: nowrap; }
.ck-mid { font-size: 15px; font-weight: 500; white-space: nowrap; min-width: 0; color: var(--mv-ink); }
.ck-lbar { position: relative; height: 3px; border-radius: 2px; background: rgba(255, 255, 255, 0.06); }
.ck-lbar i { position: absolute; top: 0; height: 3px; border-radius: 2px; background: rgba(255, 255, 255, 0.55); }
.ck-lbar::after { content: ""; position: absolute; left: 50%; top: -2px; width: 1px; height: 7px; background: rgba(255, 255, 255, 0.18); }
.ck-list { display: grid; gap: 3px; margin-top: 2px; font-size: 12px; font-variant-numeric: tabular-nums; }
.ck-list div { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; min-width: 0; }
.ck-list div span:first-child { flex: none; white-space: nowrap; color: var(--mv-mute); }
.ck-list div span:last-child { min-width: 0; text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--mv-ink2); }
.ck-mini { display: block; width: 100%; height: 150px; }
.ck-foot { margin-top: 6px; font-size: 12px; color: var(--mv-mute); font-variant-numeric: tabular-nums; }

/* quote grid */
.ck-gw { overflow-x: auto; }
.ck-gt { width: 100%; border-collapse: separate; border-spacing: 3px 5px; font-size: 12px; }
.ck-gt th { font-weight: 400; color: var(--mv-label); text-align: left; padding: 0 4px 2px; white-space: nowrap; }
.ck-gt th span { display: block; }
.ck-gt .ck-colh { text-align: center; }
.ck-gt th span.mut { font-size: 11px; font-weight: 400; }
.ck-gt .ck-corner { width: 40px; white-space: normal; font-size: 11px; vertical-align: bottom; }
.ck-gt .ck-rh { color: var(--mv-ink); vertical-align: middle; }
.ck-gt .ck-rh span:last-child { font-size: 11px; font-weight: 400; }
.ck-c { position: relative; min-width: 0; padding: 5px 6px; border: 1px solid var(--ck-edge); border-radius: 7px; background: rgba(255, 255, 255, 0.015); cursor: pointer; vertical-align: top; }
.ck-c:hover { border-color: rgba(255, 255, 255, 0.22); }
.ck-c.sel { border-color: #fff; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.4); }
.ck-c.tp1 { background: rgba(31, 209, 112, 0.06); } .ck-c.tp2 { background: rgba(31, 209, 112, 0.11); border-color: rgba(31, 209, 112, 0.22); } .ck-c.tp3 { background: rgba(31, 209, 112, 0.17); border-color: rgba(31, 209, 112, 0.35); }
.ck-c.tn1 { background: rgba(255, 77, 90, 0.06); } .ck-c.tn2 { background: rgba(255, 77, 90, 0.11); border-color: rgba(255, 77, 90, 0.22); } .ck-c.tn3 { background: rgba(255, 77, 90, 0.17); border-color: rgba(255, 77, 90, 0.35); }
.ck-c.sel.tp1, .ck-c.sel.tp2, .ck-c.sel.tp3, .ck-c.sel.tn1, .ck-c.sel.tn2, .ck-c.sel.tn3 { border-color: #fff; }
.ck-c1 { display: flex; align-items: baseline; gap: 0; color: var(--mv-ink); font-family: var(--mv-mono); font-size: 11.5px; white-space: nowrap; }
.ck-c2, .ck-c3 { display: flex; justify-content: space-between; gap: 6px; font-size: 11px; white-space: nowrap; }
.ck-badge { position: absolute; top: -6px; right: -3px; min-width: 15px; padding: 0 4px; border-radius: 4px; font-size: 10px; font-weight: 600; line-height: 14px; text-align: center; }
.ck-badge.bu { color: #000; background: var(--mv-up); }
.ck-badge.bd { color: #000; background: var(--mv-dn); }
.ck-gempty { color: var(--mv-mute); padding: 12px 4px; }

/* tape */
.ck-tw { max-height: 320px; overflow: auto; }
.ck-tt .ck-ct { max-width: 128px; overflow: hidden; text-overflow: ellipsis; }
.ck-tt { width: 100%; border-collapse: collapse; font-size: 12px; }
.ck-tt th { position: sticky; padding-left: 4px; padding-right: 4px; top: 0; background: var(--ck-inset); font-weight: 400; font-size: 12px; color: var(--mv-label); text-align: left; padding: 0 6px 6px; white-space: nowrap; }
.ck-tt td { padding: 5px 6px; border-top: 1px solid rgba(255, 255, 255, 0.04); white-space: nowrap; }
.ck-tt .r { text-align: right; }

.ck-belief { margin: 12px 2px 0; font-size: 12px; color: var(--mv-mute); font-variant-numeric: tabular-nums; }
.ck-belief[title] { cursor: help; }

@media (max-width: 1023px) {
  .ck-main { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-areas: "surf surf" "port port" "grid grid" "fv ex" "tape tape"; }
}
@media (max-width: 720px) {
  .ck { padding: 14px 12px 12px; border-radius: 12px; }
  .ck-main { grid-template-columns: minmax(0, 1fr); grid-template-areas: "surf" "port" "grid" "fv" "ex" "tape"; }
  .ck-p { padding: 12px 12px 14px; }
  .ck-canvas { height: 320px; }
  .ck-legend { grid-template-columns: minmax(0, 1fr); }
  .ck-cards { grid-template-columns: minmax(0, 1fr); }
  .ck-cap { white-space: normal; }
  .ck-h { flex-wrap: wrap; }
  .ck-big { font-size: 20px; }
  .ck-c { min-width: 98px; }
  .ck-kv-open { display: none; }
}

/* r27 calm: the grid shows bid / ask; theo, edge and lean behind "Show theo and lean" */
.ck-hbtn { margin-left: auto; flex: none; }
.ck-gt:not(.ck-full) .ck-c2, .ck-gt:not(.ck-full) .ck-c3 { display: none; }
.ck-gt:not(.ck-full) .ck-c { padding: 8px 8px; }
.ck-gt:not(.ck-full) .ck-c1 { font-size: 12px; justify-content: center; }

/* bid / ask only: no tint (a tint reads as gain or loss); the tint comes back with theo and lean */
.ck-gt:not(.ck-full) .ck-c { background: rgba(255, 255, 255, 0.015); border-color: var(--ck-edge); }
.ck-gt:not(.ck-full) .ck-c.sel { border-color: #fff; }
