/*
 * The desk: the pieces every page shares since the app was reorganized around one board of instruments.
 * Loaded on every admin page (layouts/admin), after theme.css, so it uses the theme's variables rather than the
 * Futures Analyzer's scoped ones: the bar on symbol pages and the sidebar sit outside `.fx`.
 *
 *   symbol bar     .symbol-links-id and friends: follow, symbol, kind, last close
 *   board          .dk-board: the table the screener, the watchlist and the desk draw
 *   chips          .dk-call (the trend call), .dk-kind (asset class), .dk-range (year range), .dk-follow (the star)
 *   filters        .dk-tabs, .dk-pills, .dk-filter
 *   desk           .dk-desk: the home page's grid, tape and lists
 *   workspaces     .dk-flow: the options pipeline bar; .dk-switch: the strategy switcher; .dk-strategy: hub cards
 *   sidebar        collapsible sections
 */

/* ---- symbol bar ----------------------------------------------------------------------------- */
.symbol-links-id { display: inline-flex; align-items: center; gap: 8px; padding-right: 14px; border-right: 1px solid var(--line); }
.symbol-links-quote { display: inline-flex; align-items: baseline; gap: 6px; color: var(--ink); font-family: var(--font-mono); font-size: 12px; font-variant-numeric: tabular-nums; }
.symbol-links-quote .num { font-family: inherit; }
.symbol-links .fx-up, .dk-up { color: var(--up); }
.symbol-links .fx-down, .dk-down { color: var(--down); }
.symbol-links .fx-flat, .symbol-links .fx-faint { color: var(--muted); }
@media (max-width: 720px) {
  .symbol-links-id { flex-basis: 100%; padding-right: 0; border-right: 0; }
}

/* ---- the follow star ------------------------------------------------------------------------ */
.dk-follow-form { display: inline-flex; margin: 0; }
.dk-follow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 24px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font: 500 12px/1 var(--font-ui);
  cursor: pointer;
}
.dk-follow.is-compact { width: 24px; padding: 0; justify-content: center; }
.dk-follow-star { font-size: 13px; line-height: 1; }
.dk-follow:hover { border-color: rgba(251, 191, 36, 0.45); color: #fcd34d; }
.dk-follow.is-on { border-color: rgba(251, 191, 36, 0.35); background: rgba(251, 191, 36, 0.1); color: #fcd34d; }
.dk-follow:focus-visible { outline: 2px solid var(--active-border); outline-offset: 2px; }

/* ---- chips ---------------------------------------------------------------------------------- */
.dk-kind {
  display: inline-flex;
  align-items: center;
  padding: 1px 7px;
  border: 1px solid var(--line);
  border-radius: 5px;
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
}
.dk-kind-futures, .dk-kind-commodity { border-color: rgba(251, 191, 36, 0.28); color: #fcd34d; }
.dk-kind-index, .dk-kind-currency { border-color: rgba(147, 197, 253, 0.3); color: #bfdbfe; }
.dk-kind-crypto { border-color: rgba(196, 181, 253, 0.32); color: #ddd6fe; }

.dk-call {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  box-sizing: border-box;
  width: 72px;
  padding: 2px 0;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.01em;
  white-space: nowrap;
  cursor: help;
}
.dk-call i { width: 9px; font-size: 9px; font-style: normal; line-height: 1; text-align: center; }
.dk-call:focus-visible { outline: 2px solid var(--active-border); outline-offset: 2px; }
.dk-call.is-enter { border-color: rgba(45, 212, 191, 0.5); background: rgba(45, 212, 191, 0.12); color: #5eead4; }
.dk-call.is-exit { border-color: rgba(248, 113, 113, 0.5); background: rgba(248, 113, 113, 0.12); color: #fca5a5; }
.dk-call.is-enter.is-fresh { border-color: #2dd4bf; background: #2dd4bf; color: #042f2b; }
.dk-call.is-exit.is-fresh { border-color: #f87171; background: #f87171; color: #3b0a0a; }
.dk-call.is-hold { border-color: rgba(45, 212, 191, 0.32); color: #5eead4; }
.dk-call.is-wait, .dk-call.is-none { border-color: var(--line-soft); }

/* The floating tooltip desk_tips.js draws for any [data-tip] element; fixed, so a scrolling table can't clip it. */
.dk-float-tip {
  position: fixed;
  z-index: 60;
  display: none;
  width: max-content;
  max-width: min(300px, calc(100vw - 16px));
  padding: 9px 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: #0b1119;
  box-shadow: 0 16px 34px rgba(0, 0, 0, 0.5);
  color: var(--ink);
  font: 400 12px/1.5 var(--font-ui);
  pointer-events: none;
}
.dk-float-tip.is-open { display: block; }
.dk-float-tip strong { display: block; margin-bottom: 2px; font-weight: 600; }

.dk-range { position: relative; display: inline-block; width: 84px; height: 4px; border-radius: 2px; background: rgba(148, 163, 184, 0.18); vertical-align: middle; }
.dk-range-mark { position: absolute; top: -3px; width: 3px; height: 10px; margin-left: -1px; border-radius: 1px; background: var(--ink); }
.dk-kpi-range .dk-range { width: 120px; }

.dk-board .dk-stale { display: block; width: fit-content; margin: 1px 0 0 auto; }
.dk-stale { margin-left: 6px; padding: 0 5px; border-radius: 4px; background: rgba(251, 191, 36, 0.12); color: #fcd34d; font-family: var(--font-ui); font-size: 10.5px; }
.dk-count { margin-left: 2px; padding: 0 6px; border-radius: 999px; background: rgba(148, 163, 184, 0.14); color: var(--ink); font-family: var(--font-mono); font-size: 11px; line-height: 18px; }

/* ---- tooltips: explanations kept off the page until asked for -------------------------------- */
.dk-tip {
  position: relative;
  display: inline-flex !important;
  align-items: center;
  margin: 0 0 0 5px !important;
  vertical-align: middle;
  letter-spacing: 0 !important;
  text-transform: none !important;
}
.dk-tip-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font: italic 500 10.5px/1 Georgia, serif;
  letter-spacing: 0;
  text-transform: none;
  cursor: help;
}
.dk-tip-btn:hover, .dk-tip-btn:focus-visible, .dk-tip.is-open .dk-tip-btn { border-color: var(--active-border); color: var(--accent-dark); outline: none; }
.dk-tip > .dk-tip-panel {
  position: fixed;
  z-index: 60;
  display: none !important;
  width: min(340px, calc(100vw - 16px));
  margin: 0 !important;
  padding: 10px 12px !important;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: #0b1119;
  box-shadow: 0 16px 34px rgba(0, 0, 0, 0.5);
  color: var(--ink) !important;
  font: 400 12px/1.5 var(--font-ui) !important;
  letter-spacing: 0 !important;
  text-align: left !important;
  text-transform: none !important;
  white-space: normal !important;
  pointer-events: none;
}
.dk-tip:not(.is-open) > .dk-tip-panel { display: none !important; }
.dk-tip > .dk-tip-panel span,
.dk-tip > .dk-tip-panel strong {
  display: block !important;
  margin: 0 !important;
  color: var(--ink) !important;
  font: inherit !important;
  letter-spacing: 0 !important;
  text-transform: none !important;
  white-space: normal !important;
}
.dk-tip > .dk-tip-panel strong { margin-bottom: 3px !important; font-weight: 600 !important; }
.dk-tip.is-open > .dk-tip-panel { display: block !important; }

/* ---- board ---------------------------------------------------------------------------------- */
.dk-board td { padding: 7px 8px; }
.dk-board th { padding-left: 8px; padding-right: 8px; }
.dk-board td:first-child, .dk-board th:first-child { padding-left: 14px; }
.dk-board .fx-name-cell { min-width: 110px; max-width: 200px; }
.dk-board .fx-sub { overflow: hidden; max-width: 132px; text-overflow: ellipsis; }
.dk-board .dk-spark .fx-spark { width: 84px; height: 24px; }
.dk-board .dk-range { width: 72px; }
.dk-board .dk-col-star { width: 36px; padding-left: 0; text-align: right; }
.dk-board th.is-sorted, .dk-board th.is-sorted a { color: var(--accent-dark); }
.dk-sort { color: inherit; text-decoration: none; }
.dk-sort:hover { color: var(--ink); }
.dk-row-fresh td:first-child { box-shadow: inset 2px 0 0 var(--up); }
.dk-context { white-space: nowrap; }
.dk-context-item { display: inline-flex; align-items: center; gap: 5px; margin-right: 10px; color: var(--muted); font-size: 12px; text-decoration: none; }
.dk-context-item:hover { color: var(--ink); }
.dk-context-item b { color: var(--ink); font-weight: 500; }
.dk-board-compact td, .dk-board-compact th { padding-left: 10px; padding-right: 10px; }

/* ---- filters -------------------------------------------------------------------------------- */
.dk-tabs { display: flex; gap: 2px; margin: 0 0 10px; overflow-x: auto; border-bottom: 1px solid var(--line); scrollbar-width: none; }
.dk-tabs::-webkit-scrollbar { display: none; }
.dk-tab {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 6px;
  margin-bottom: -1px;
  padding: 9px 11px 8px;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
}
.dk-tab:hover { color: var(--ink); }
.dk-tab[aria-current="page"] { border-bottom-color: var(--up); color: var(--ink); }

.dk-pills { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0 0 12px; }
.dk-pills-label { margin-right: 4px; color: var(--faint); font-size: 10.5px; font-weight: 500; letter-spacing: 0.08em; text-transform: uppercase; }
.dk-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 26px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
}
.dk-pill:hover { border-color: var(--active-border); color: var(--ink); }
.dk-pill[aria-current="page"] { border-color: var(--active-border); background: var(--active-bg); color: var(--accent-dark); }
.dk-clear { margin-left: 6px; color: var(--muted); font-size: 12px; }

.dk-filter { display: flex; align-items: center; justify-content: flex-end; gap: 8px; margin: 0; }
.dk-filter select { max-width: 190px; }
.dk-filter input[type="search"], .dk-filter select {
  height: 34px;
  padding: 0 11px;
  border: 1px solid var(--control-line);
  border-radius: var(--radius-sm);
  background: var(--input-bg);
  color: var(--ink);
  font: 400 13px/1 var(--font-ui);
}
.dk-filter input[type="search"] { width: min(280px, 50vw); }
.dk .fx-header-side { flex-direction: row; flex-wrap: wrap; justify-content: flex-end; }
@media (max-width: 720px) {
  .dk-filter { flex-wrap: wrap; justify-content: flex-start; }
}
.dk-filter input:focus, .dk-filter select:focus { border-color: var(--active-border); outline: none; box-shadow: 0 0 0 3px var(--active-bg); }
.dk-inline { display: inline-flex; margin: 0; }
.dk-empty h3 { margin: 0 0 4px; font-size: 14px; }
.dk-empty p { margin: 0; max-width: 70ch; }
.dk-kpis-moves { grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); }

.dk-depth { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; }
.dk-depth li { display: grid; gap: 1px; }
.dk-depth a { font-weight: 500; }
.dk-depth span { font-size: 12.5px; }

/* ---- the desk (home) ------------------------------------------------------------------------ */
.dk-tape { display: grid; grid-template-columns: repeat(auto-fit, minmax(124px, 1fr)); gap: 8px; margin: 0 0 12px; }
.dk-tape-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 2px 8px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  text-decoration: none;
}
.dk-tape-item:hover { border-color: var(--active-border); }
.dk-tape-label { overflow: hidden; color: var(--muted); font-size: 11px; font-weight: 500; letter-spacing: 0.04em; text-overflow: ellipsis; text-transform: uppercase; white-space: nowrap; }
.dk-tape-symbol { color: var(--faint); font-family: var(--font-mono); font-size: 10.5px; text-align: right; }
.dk-tape-price { font-family: var(--font-mono); font-size: 15px; font-weight: 500; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.dk-tape-move { align-self: end; font-family: var(--font-mono); font-size: 12px; text-align: right; }
.dk-tape-item .fx-spark { grid-column: 1 / -1; width: 100%; height: 22px; margin-top: 2px; }

.dk-list { display: grid; grid-template-columns: minmax(0, 1fr); margin: 0; padding: 0; list-style: none; }
.dk-list li { display: flex; align-items: center; gap: 10px; padding: 8px 15px; border-bottom: 1px solid var(--line-soft); }
.dk-list li:last-child { border-bottom: 0; }
.dk-list .fx-symbol { min-width: 64px; }
.dk-list-name { flex: 1 1 0; min-width: 0; overflow: hidden; color: var(--muted); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.dk-list-side { margin-left: auto; display: inline-flex; align-items: center; gap: 10px; white-space: nowrap; }
.dk-list b { font-weight: 500; }
.dk-more { display: flex; justify-content: space-between; gap: 12px; }
.dk-health { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 12px; }
.dk-health a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 12px;
  text-decoration: none;
}
.dk-health a:hover { border-color: var(--active-border); color: var(--ink); }
.dk-health b { color: var(--ink); font-family: var(--font-mono); font-weight: 500; }
.dk-health .is-bad { border-color: rgba(248, 113, 113, 0.4); }
.dk-health .is-bad b { color: #fca5a5; }
.dk-section-title { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 22px 0 10px; }
.dk-section-title h2 { margin: 0; font-size: 15px; font-weight: 600; }
.dk-section-title p { margin: 0; color: var(--muted); font-size: 12.5px; }

.dk-desk-row { margin-top: 12px; }
.dk-desk .fx-header-side { align-items: center; }
.dk-fold { margin: 0 0 12px; border: 1px solid var(--line-soft); border-radius: var(--radius); background: var(--surface-soft); }
.dk-fold > summary { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; padding: 11px 14px; cursor: pointer; list-style: none; }
.dk-fold > summary::-webkit-details-marker { display: none; }
.dk-fold > summary::before { content: "+"; width: 10px; color: var(--faint); font-family: var(--font-mono); }
.dk-fold[open] > summary::before { content: "−"; }
.dk-fold > summary strong { font-size: 13.5px; font-weight: 600; }
.dk-fold > summary span { color: var(--muted); font-size: 12.5px; }
.dk-fold[open] { padding: 0 14px 14px; background: transparent; }
.dk-fold[open] > summary { margin: 0 -14px 4px; }
.dk-fold .app-map { margin-bottom: 0; }
.app-map-flow { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }

/* ---- the options workspace bar -------------------------------------------------------------- */
.dk-flow {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 6px;
  margin: 0 0 var(--section-gap);
  padding: 6px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: var(--surface-soft);
}
.dk-flow-title { display: inline-flex; align-items: center; padding: 0 10px 0 6px; color: var(--faint); font-size: 10.5px; font-weight: 500; letter-spacing: 0.08em; text-transform: uppercase; }
.dk-flow-step {
  display: inline-flex;
  flex-direction: column;
  justify-content: center;
  gap: 1px;
  min-width: 132px;
  padding: 6px 12px;
  border: 1px solid transparent;
  border-radius: 7px;
  color: var(--muted);
  text-decoration: none;
}
.dk-flow-step:hover { border-color: var(--line); background: rgba(148, 163, 184, 0.05); color: var(--ink); }
.dk-flow-step[aria-current="page"] { border-color: var(--active-border); background: var(--active-bg); color: var(--ink); }
.dk-flow-step strong { font-size: 13px; font-weight: 500; }
.dk-flow-step span { color: var(--muted); font-size: 11.5px; white-space: nowrap; }
.dk-flow-arrow { display: inline-flex; align-items: center; color: var(--faint); font-size: 12px; }
.dk-flow-gap { flex: 1 1 12px; }
.dk-flow-step.is-warn span { color: #fcd34d; }
.dk-flow-feeds { display: inline-flex; align-items: center; gap: 2px; }
.dk-flow-feed { padding: 4px 9px; border-radius: 6px; color: var(--muted); font-size: 12px; text-decoration: none; }
.dk-flow-feed:hover { background: rgba(148, 163, 184, 0.05); color: var(--ink); }
.dk-flow-feed[aria-current="page"] { background: var(--active-bg); color: var(--ink); }
.trading-viewport-page > .dk-flow, .admin-shell-fixed > .dk-flow { flex: 0 0 auto; }
/* On a phone the four steps sit two by two, without the arrows or the title; the feeds keep their own line. */
@media (max-width: 720px) {
  .dk-flow { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; }
  .dk-flow > .dk-flow-title, .dk-flow-arrow, .dk-flow-gap { display: none; }
  .dk-flow-step { min-width: 0; }
  .dk-flow-feeds { grid-column: 1 / -1; padding-top: 2px; }
}

/* A strategy page has the switcher, so its symbol bar doesn't list the strategies a second time. */
.br:has(.dk-switch) .symbol-links-group-replay { display: none; }

/* ---- the strategy switcher and hub ---------------------------------------------------------- */
.dk-context { display: flex; flex-wrap: wrap; align-items: center; gap: 0 28px; margin: 0 0 4px; }
.dk-context .dk-switch, .dk-context .sl-strip { margin: 0 0 8px; }
.dk-switch { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0 0 12px; }
.dk-switch .dk-pills-label { margin-right: 6px; }

/* The hub is one list: a row per strategy under its group's line, the same six columns all the way down. */
.dk-strategies { --dk-s-cols: 168px minmax(0, 1fr) 150px 160px 72px 190px; margin: 0 0 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.dk-s-cols, .dk-strategy { display: grid; grid-template-columns: var(--dk-s-cols); align-items: center; column-gap: 14px; padding: 0 12px; }
.dk-s-cols { height: 28px; border-bottom: 1px solid var(--line); color: var(--faint); font-size: 10.5px; font-weight: 500; letter-spacing: 0.08em; text-transform: uppercase; }
.dk-group { display: flex; align-items: center; gap: 8px; height: 30px; padding: 0 12px; border-bottom: 1px solid var(--line-soft); background: rgba(148, 163, 184, 0.05); scroll-margin-top: 60px; }
.dk-group h2 { display: inline-flex; align-items: center; gap: 6px; margin: 0; color: var(--ink); font-size: 12px; font-weight: 600; letter-spacing: 0; }
.dk-group > span { color: var(--faint); font-family: var(--font-mono); font-size: 11px; }
.dk-strategy { position: relative; min-height: 36px; border-bottom: 1px solid var(--line-soft); font-size: 12.5px; }
.dk-strategy:last-child { border-bottom: 0; }
.dk-strategy:hover { background: rgba(148, 163, 184, 0.04); }
.dk-strategy p { margin: 0; }
.dk-s-name { display: flex; align-items: center; gap: 6px; min-width: 0; }
.dk-s-name h3 { margin: 0; overflow: hidden; color: var(--ink); font-size: 13px; font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }
.dk-s-what, .dk-s-data, .dk-s-proven, .dk-strategy-facts { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dk-s-what { color: var(--muted); }
.dk-s-data { color: var(--muted); font-family: var(--font-mono); font-size: 11.5px; }
.dk-s-data.fx-up { color: var(--up); }
.dk-s-data.fx-down { color: var(--down); }
.dk-strategy-facts, .dk-s-proven { color: var(--muted); font-size: 12px; }
.dk-strategy-facts a { color: inherit; text-decoration: none; }
.dk-strategy-facts a:hover { color: var(--ink); text-decoration: underline; }
.dk-s-link { color: var(--nav, var(--accent-dark)); font-size: 12px; text-decoration: none; }
.dk-s-link:hover { text-decoration: underline; }
.dk-strategy-form { display: flex; align-items: center; gap: 6px; margin: 0; }
.dk-strategy-form input {
  flex: 1 1 auto;
  min-width: 0;
  height: 26px;
  min-height: 0;
  padding: 0 8px;
  border: 1px solid var(--control-line);
  border-radius: var(--radius-sm);
  background: var(--input-bg);
  color: var(--ink);
  font: 400 12px/1 var(--font-mono);
  text-transform: uppercase;
}
.dk-strategy-form input::placeholder { text-transform: none; font-family: var(--font-ui); }
.dk-strategy-form .fx-button { min-height: 26px; height: 26px; padding: 0 10px; font-size: 12px; }
/* A flip's row unfolds under itself: its form and running automations on the left, its example day on the right. */
.dk-setup { grid-column: 1 / -1; }
.dk-setup > summary { position: absolute; top: 5px; right: 12px; display: inline-flex; align-items: center; justify-content: center; width: 190px; height: 26px; border: 1px solid var(--control-line); border-radius: var(--radius-sm); color: var(--ink); cursor: pointer; font-size: 12px; list-style: none; }
.dk-setup > summary::-webkit-details-marker { display: none; }
.dk-setup > summary:hover, .dk-setup[open] > summary { border-color: var(--active-border); background: var(--active-bg); }
.dk-setup[open] > summary::after { content: " ×"; white-space: pre; }
.dk-setup-body { display: grid; grid-template-columns: minmax(280px, 380px) minmax(0, 1fr); gap: 18px; align-items: start; padding: 10px 0 14px; border-top: 1px solid var(--line-soft); margin-top: 4px; }
.dk-setup-start { display: grid; gap: 10px; }
.dk-setup-start .au-flip-form { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px; }
.dk-setup-start .au-flip-form label { display: grid; gap: 3px; }
.dk-setup-start .au-flip-form input[type="text"], .dk-setup-start .au-flip-form input[type="number"] { width: 100%; box-sizing: border-box; font-family: var(--font-mono); }
.dk-setup-start .au-flip-form .fx-button { align-self: end; }
.dk-setup-running { display: grid; gap: 4px; margin: 0; padding: 0; list-style: none; font-size: 12px; }
.dk-setup-running li { display: flex; flex-wrap: wrap; gap: 8px; }
.dk-example p { color: var(--muted); font-size: 12px; white-space: normal; }
@media (max-width: 1180px) {
  .dk-strategies { --dk-s-cols: 168px minmax(0, 1fr) 170px 76px 200px; }
  .dk-s-cols > :nth-child(3), .dk-strategy > .dk-s-data { display: none; }
  .dk-setup > summary { width: 200px; }
}
@media (max-width: 860px) {
  .dk-s-cols { display: none; }
  .dk-strategy { grid-template-columns: minmax(0, 1fr) auto; row-gap: 4px; padding: 8px 12px; }
  .dk-strategy > .dk-s-what { grid-column: 1 / -1; white-space: normal; }
  .dk-strategy-form { grid-column: 1 / -1; }
  .dk-setup > summary { position: static; width: auto; }
  .dk-setup-body { grid-template-columns: minmax(0, 1fr); }
}
.dk-matrix td.dk-verdict { white-space: nowrap; }
.dk-verdict a { color: inherit; text-decoration: none; }
.dk-verdict a:hover { text-decoration: underline; }
.dk-verdict small { display: block; margin-top: 2px; color: var(--muted); font-family: var(--font-mono); font-size: 11px; }

/* ---- sidebar: collapsible sections ---------------------------------------------------------- */
details.nav-section > summary { display: flex; align-items: center; justify-content: space-between; cursor: pointer; list-style: none; }
details.nav-section > summary::-webkit-details-marker { display: none; }
details.nav-section > summary > span {
  padding: 0 10px 4px;
  color: var(--faint);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
details.nav-section > summary::after { content: "+"; padding: 0 10px 4px; color: var(--faint); font-family: var(--font-mono); font-size: 11px; }
details.nav-section[open] > summary::after { content: "−"; }
details.nav-section > summary:hover > span, details.nav-section > summary:hover::after { color: var(--ink); }
details.nav-section:not([open]) { gap: 0; }
@media (max-width: 900px) {
  /* The phone's sidebar is one row of links: admin_integrations.js opens every section there. */
  details.nav-section > summary { display: none; }
}

/* ---- the instrument workspace: one header and one row of tabs on every tab's page ------------- */
.ws { margin: 0; }
.ws-header { margin-bottom: 10px; }
.ws-price { color: var(--ink); font-size: 16px; }
.ws-quote { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; }
.ws .ws-side { flex-direction: row; align-items: center; gap: 12px; }
.ws-call { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; }
.ws-tabs { margin-bottom: 14px; }
.ws-more { display: inline-flex; align-items: center; gap: 14px; margin-left: auto; padding: 0 4px 8px 16px; font-size: 12px; white-space: nowrap; }
.ws-more a { color: var(--muted); text-decoration: none; }
.ws-more a:hover { color: var(--ink); }
.ws-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px; margin: -4px 0 12px; }
.ws-toolbar .ws-toolbar-note { margin-right: auto; color: var(--muted); font-size: 12.5px; }
.ws-toolbar form { margin: 0; }

/* ---- the decision strip: stance, record, evidence for and against, flags, one next step ------- */
.dk-decision { margin: 0 0 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.dk-decision-main { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 22px; padding: 12px 15px; }
.dk-decision-stance { display: inline-flex; align-items: center; gap: 10px; }
.dk-decision-stance .sbs-signal { padding: 5px 14px; font-size: 15px; }
.dk-decision-kicker { color: var(--faint); font-size: 10.5px; font-weight: 500; letter-spacing: 0.08em; text-transform: uppercase; }
.dk-decision-text { display: flex; flex: 1 1 320px; flex-wrap: wrap; align-items: center; gap: 6px 12px; min-width: 0; }
.dk-decision-text p { margin: 0; font-size: 13.5px; }
.dk-decision-next { margin-left: auto; }
.dk-decision-evidence { display: flex; flex-wrap: wrap; gap: 6px; padding: 10px 15px 12px; border-top: 1px solid var(--line-soft); }
.dk-evidence {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  padding: 3px 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
  cursor: help;
}
.dk-evidence b { color: var(--ink); font-weight: 500; }
.dk-evidence.is-for { border-color: rgba(45, 212, 191, 0.32); }
.dk-evidence.is-for .dk-evidence-mark { color: var(--up); }
.dk-evidence.is-against { border-color: rgba(248, 113, 113, 0.36); }
.dk-evidence.is-against .dk-evidence-mark { color: var(--down); }
.dk-evidence.is-flag { border-color: rgba(251, 191, 36, 0.35); color: #fcd34d; }
.dk-evidence.is-pending { border-style: dashed; cursor: default; }
.dk-evidence:focus-visible { outline: 2px solid var(--active-border); outline-offset: 2px; }
.dk-dots { display: inline-flex; gap: 8px; font-family: var(--font-mono); font-size: 12px; cursor: help; }

/* ---- strategy lifecycle (ADR-0016): the promotion board ------------------------------------- */
.sl-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.sl-board { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; align-items: start; }
.sl-column { min-width: 0; padding: 10px; border: 1px solid var(--line-soft); border-radius: var(--radius); background: var(--surface-soft); }
.sl-column-head { display: flex; align-items: center; gap: 2px; margin: 0 0 10px; font-size: 12px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.sl-column-head .dk-count { margin-left: auto; }
.sl-none { margin: 0; padding: 14px 0; color: var(--muted); font-size: 12px; text-align: center; }
.sl-card { display: grid; gap: 3px; margin: 0 0 8px; padding: 10px 11px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.sl-card:last-child { margin-bottom: 0; }
.sl-card p { margin: 0; }
.sl-card-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.sl-card-name { font-size: 12.5px; }
.sl-card-numbers { color: var(--muted); font-family: var(--font-mono); font-size: 11.5px; }
.sl-chip { display: inline-flex; align-items: center; justify-content: center; gap: 5px; box-sizing: border-box; width: 92px; padding-right: 0; padding-left: 0; cursor: help; white-space: nowrap; }
.sl-chip i { font-style: normal; }
.sl-flag { color: #fcd34d; font-family: var(--font-ui); cursor: help; }
.sl-next { margin-top: 4px !important; padding-top: 6px; border-top: 1px solid var(--line-soft); color: var(--ink); font-size: 12px; cursor: help; }
.sl-next span { color: var(--muted); }
.sl-chip:focus-visible, .sl-flag:focus-visible, .sl-next:focus-visible { outline: 2px solid var(--active-border); outline-offset: 2px; }
@media (max-width: 1100px) { .sl-board { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .sl-board { grid-template-columns: minmax(0, 1fr); } }
.sl-strip { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin: -4px 0 12px; font-size: 12.5px; }
.sl-strip .dk-pills-label { margin-right: 2px; }
.sl-strip-numbers { color: var(--muted); font-family: var(--font-mono); font-size: 11.5px; }
.sl-strip-next { cursor: help; }
.sl-strip-next span { color: var(--muted); }
.sl-strip-next:focus-visible { outline: 2px solid var(--active-border); outline-offset: 2px; }
.sl-mark { display: inline-block; width: 14px; color: var(--muted); font-size: 12px; text-align: center; cursor: help; }
.sl-mark-validated, .sl-mark-live_eligible, .sl-mark-live { color: #5eead4; }
.sl-mark-paper { color: #bfdbfe; }
.sl-lab-cell-top { display: inline-flex; align-items: center; gap: 4px; }
.sl-lab-numbers { display: block; margin-top: 2px; color: var(--muted); font-family: var(--font-mono); font-size: 11.5px; }
.sl-lab-numbers.fx-up { color: var(--up); }
.sl-lab-numbers.fx-down { color: var(--down); }
.fx-table.sl-lab .sl-lab-totals th { border-top: 0; font-weight: 400; letter-spacing: 0; text-transform: none; }
.sl-lab-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: flex-start; gap: 4px 14px; }
.sl-lab-head .sl-lab-sum { margin: 0; color: var(--muted); font-size: 12px; }
.sl-lab-sum b { color: var(--ink); font-family: var(--font-mono); font-weight: 500; }
.sl-lab-sum b.fx-up { color: var(--up); }
.sl-lab-sum i { margin: 0 4px; color: var(--faint); font-style: normal; }
.fx-table.sl-lab td { padding-top: 4px; padding-bottom: 4px; }
.sl-lab .sl-lab-numbers { font-size: 11px; }
.sl-lab-totals .num { color: var(--ink); font-family: var(--font-mono); }
.fx-head-inline { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.fx-head-inline h2, .fx-head-inline h3, .fx-head-inline h4 { margin: 0; }
.dk-depth li { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }

/* ---- the one strategy page shape: Rules, Replay, Verdict, Paper ----------------------------- */
.st-bar { position: sticky; top: 0; z-index: 20; display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 14px; padding: 8px 0; background: var(--bg, #0b0f14); }
.st-bar-step { display: inline-flex; align-items: center; gap: 7px; padding: 4px 12px 4px 5px; border: 1px solid var(--line); border-radius: 999px; color: var(--ink); font-size: 12.5px; text-decoration: none; }
.st-bar-step:hover { border-color: var(--active-border); }
.st-bar-step.is-empty { color: var(--muted); }
.st-n { display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; border-radius: 999px; background: rgba(148, 163, 184, 0.16); color: var(--ink); font-family: var(--font-mono); font-size: 11px; }
.st-step { margin: 0 0 22px; scroll-margin-top: 56px; }
.st-head { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; margin: 0 0 10px; padding-bottom: 8px; border-bottom: 1px solid var(--line-soft); }
.st-head h2 { margin: 0; font-size: 15px; font-weight: 600; }
.st-head p { margin: 0; color: var(--muted); font-size: 12.5px; }
.st-step > .fx-card, .st-step > .fx-grid, .st-step > .fx-section, .st-step > details { margin-bottom: 12px; }
.st-plan h3 { margin: 0; font-size: 14px; font-weight: 600; }
.st-empty, .st-note { margin: 0; color: var(--muted); font-size: 12.5px; }

/* ---- automations: the one table ------------------------------------------------------------- */
.au-table td { vertical-align: middle; }
.au-now { max-width: 320px; color: var(--muted); font-size: 12.5px; }
.au-actions { white-space: nowrap; text-align: right; }
.au-actions .dk-inline + .dk-inline { margin-left: 4px; }
.au-gate { display: grid; gap: 4px; margin: 4px 0 0; padding: 0; list-style: none; font-size: 12.5px; }
.au-gate small { color: var(--muted); font-size: 11.5px; }
.au-gate .is-met span { color: #5eead4; }
.au-gate .is-missing span { color: #fca5a5; }

/* ---- control: risk limits ------------------------------------------------------------------- */
.dk-riskbar { display: inline-block; width: 120px; height: 6px; border-radius: 3px; background: rgba(148, 163, 184, 0.16); overflow: hidden; vertical-align: middle; }
.dk-riskbar > span { display: block; height: 100%; background: var(--up); }
.dk-riskbar.is-near > span { background: var(--amber); }
.dk-riskbar.is-over > span { background: var(--down); }
.dk-limits { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px 18px; margin: 0; }
.dk-limits label { display: grid; gap: 4px; color: var(--muted); font-size: 12px; }
.dk-limits input, .dk-filter input[type="date"] {
  height: 34px;
  padding: 0 10px;
  border: 1px solid var(--control-line);
  border-radius: var(--radius-sm);
  background: var(--input-bg);
  color: var(--ink);
  font: 400 13px/1 var(--font-mono);
}
.dk-limits input { width: 150px; }
.dk-limits input:disabled { opacity: 0.6; }
.admin-topbar-stop { margin: 0; }
.admin-topbar-stop button {
  height: 30px;
  padding: 0 11px;
  border: 1px solid rgba(248, 113, 113, 0.45);
  border-radius: var(--radius-sm);
  background: rgba(248, 113, 113, 0.1);
  color: #fca5a5;
  font: 500 12px/1 var(--font-ui);
  cursor: pointer;
  white-space: nowrap;
}
.admin-topbar-stop button:hover { background: rgba(248, 113, 113, 0.2); }
.admin-topbar-stopped { color: #fcd34d; font-size: 12px; white-space: nowrap; }
@media (max-width: 900px) { .admin-topbar-stop, .admin-topbar-stopped { display: none; } }

/* ---- Today: the queue and the book ---------------------------------------------------------- */
.dk-queue li { align-items: flex-start; }
.dk-queue-dot { flex: 0 0 auto; width: 8px; height: 8px; margin-top: 6px; border-radius: 50%; background: var(--blue); }
.dk-queue .is-bad .dk-queue-dot { background: var(--down); }
.dk-queue .is-warn .dk-queue-dot { background: var(--amber); }
.dk-queue-text { flex: 1 1 0; min-width: 0; font-size: 13px; line-height: 1.45; }
.dk-queue-text b { font-weight: 500; }
.dk-book { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.dk-book > div { display: grid; gap: 2px; padding: 14px 15px; border-right: 1px solid var(--line-soft); }
.dk-book > div:last-child { border-right: 0; }
.dk-book > div > span:first-child { display: flex; align-items: center; gap: 4px; color: var(--muted); font-size: 11px; font-weight: 500; letter-spacing: 0.07em; text-transform: uppercase; }
.dk-book b { font-family: var(--font-mono); font-size: 20px; font-weight: 500; letter-spacing: -0.02em; }
.dk-book small { color: var(--muted); font-size: 12px; }
@media (max-width: 720px) { .dk-book { grid-template-columns: 1fr; } .dk-book > div { border-right: 0; border-bottom: 1px solid var(--line-soft); } }

/* ---- keyboard shortcut sheet ("?") ---------------------------------------------------------- */
.dk-keys {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 60;
  width: 260px;
  padding: 14px 16px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: #0b1119;
  box-shadow: 0 16px 34px rgba(0, 0, 0, 0.5);
  color: var(--ink);
  font-size: 12.5px;
}
.dk-keys strong { display: block; margin-bottom: 8px; font-weight: 600; }
.dk-keys dl { display: grid; grid-template-columns: auto 1fr; gap: 5px 12px; margin: 0; }
.dk-keys dt { display: flex; gap: 3px; }
.dk-keys dd { margin: 0; color: var(--muted); }
.dk-keys kbd { min-width: 18px; padding: 1px 5px; border: 1px solid var(--line-strong); border-radius: 4px; font: 500 11px/1.4 var(--font-mono); text-align: center; }

/* ---- compact tables ("d" toggles it; desk_keys.js remembers it in this browser) -------------- */
.dk-compact .fx-table td, .dk-compact .dense-table td { padding-top: 4px; padding-bottom: 4px; }
.dk-compact .fx-table th, .dk-compact .dense-table th { padding-top: 6px; padding-bottom: 6px; }
.dk-compact .fx-table .fx-sub, .dk-compact .dk-board .fx-sub { display: none; }
.dk-compact .dk-list li { padding-top: 5px; padding-bottom: 5px; }
.dk-compact .dk-board .dk-spark .fx-spark { height: 18px; }

/* The cockpit on a stock's page (admin/cockpits): live quote, position, quick ticket. */
.ck .fx-card-head { align-items: center; }
.ck-ticket { display: inline-flex; align-items: center; gap: 8px; margin: 0; font-size: 12px; color: var(--muted); }
.ck-ticket input { width: 72px; }
.ck-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; }
.ck-quote { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
.ck-price { color: var(--ink); font-size: 22px; font-weight: 600; font-variant-numeric: tabular-nums; }
.ck-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.ck-stats { margin-top: 12px; }



/* ---- watchlists: tabs per list, one line about the chosen list ---------------------------------- */
.wl-tabs { margin-bottom: 8px; }
.wl-tab-off { opacity: 0.6; }
.wl-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; margin: 0 0 14px; font-size: 12.5px; color: var(--muted); }
.wl-chip { box-sizing: border-box; justify-content: flex-start; width: 104px; white-space: nowrap; }
.wl-links { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; margin-left: auto; }
.wl-links a, .wl-link-button { color: var(--muted); font-size: 12px; text-decoration: underline; text-decoration-color: rgba(148, 163, 184, 0.35); text-underline-offset: 3px; }
.wl-links a:hover, .wl-link-button:hover { color: var(--ink); }
.wl-link-button { padding: 0; border: 0; background: none; cursor: pointer; font: inherit; font-size: 12px; }
.dk-col-star form + form { margin-top: 2px; }
.dk-fact { box-sizing: border-box; justify-content: flex-start; min-width: 118px; white-space: nowrap; }
.dk-remove { min-width: 26px; height: 22px; padding: 0; border: 1px solid transparent; border-radius: 6px; background: none; color: var(--faint); cursor: pointer; font-size: 15px; line-height: 1; }
.dk-remove:hover { border-color: var(--line); color: var(--ink); }
@media (max-width: 720px) { .wl-links { margin-left: 0; } }

/* An option flip's example day (FlipExampleHelper): the stock on top, the contract's three endings under it. */
.fe-chart { display: block; width: 100%; max-width: 760px; height: auto; }
.fe-label { fill: var(--muted); font-size: 12px; font-family: var(--font-ui); }
.fe-strong { fill: var(--ink); }
.fe-window { fill: var(--accent-dark); opacity: 0.08; }
.fe-zone { fill: var(--fx-warn); opacity: 0.16; }
.fe-price { stroke: var(--ink); stroke-width: 2; stroke-linejoin: round; }
.fe-average { stroke: var(--accent-dark); stroke-width: 1.5; stroke-dasharray: 6 4; }
.fe-open { stroke: var(--faint); stroke-width: 1; stroke-dasharray: 2 4; }
.fe-funnel { stroke: var(--fx-warn); stroke-width: 1.5; }
.fe-take-level { stroke: var(--up); stroke-width: 1; stroke-dasharray: 6 4; }
.fe-cut-level { stroke: var(--down); stroke-width: 1; stroke-dasharray: 6 4; }
.fe-ending { stroke-width: 2; stroke-linejoin: round; }
.fe-ending-take { stroke: var(--up); }
.fe-ending-cut { stroke: var(--down); }
.fe-ending-out { stroke: var(--muted); stroke-dasharray: 4 3; }
.fe-buy { fill: var(--accent-dark); stroke: var(--surface); stroke-width: 2; }
.fe-end { stroke: var(--surface); stroke-width: 2; }
.fe-end-take { fill: var(--up); }
.fe-end-cut { fill: var(--down); }
.fe-end-out { fill: var(--muted); }

/* ---- one flip on one day (strategies/day) ---------------------------------------------------- */
.fd-form { display: flex; flex-wrap: wrap; align-items: end; gap: 8px 12px; margin: 0 0 12px; color: var(--muted); font-size: 12px; }
.fd-form label { display: grid; gap: 3px; }
.fd-form input, .fd-form select { width: auto; height: 28px; min-height: 0; padding: 0 8px; border: 1px solid var(--control-line); border-radius: var(--radius-sm); background: var(--input-bg); color: var(--ink); font: 400 12px/1 var(--font-mono); }
.fd-form input[type="number"] { width: 84px; }
.fd-form select { padding-right: 24px; font-family: var(--font-ui); }
.fd-form .fx-button { height: 28px; min-height: 28px; }
.fd-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: flex-start; gap: 4px 14px; }
.fd-head .fd-sum { flex: 1 1 auto; margin: 0; color: var(--muted); font-size: 12px; }
.fd-sum b { font-family: var(--font-mono); font-size: 14px; font-weight: 600; color: var(--ink); }
.fd-sum b.fx-up { color: var(--up); }
.fd-sum b.fx-down { color: var(--down); }
.fd-sum i { margin: 0 4px; color: var(--faint); font-style: normal; }
.fd-chart { max-width: none; }
.fd-trades td { padding-top: 5px; padding-bottom: 5px; }
.fd-notes { display: grid; gap: 3px; margin: 0; padding: 8px 14px 12px; list-style: none; color: var(--muted); font-size: 12px; }
.fd-notes .mono { margin-right: 8px; color: var(--faint); }
.dk-setup-day { color: var(--nav, var(--accent-dark)); font-size: 12px; }
.ph-table td { padding-top: 5px; padding-bottom: 5px; }
.sl-lab-flips th.num { white-space: normal; min-width: 76px; line-height: 1.25; }
.sl-flip-cell { display: inline-grid; justify-items: end; text-decoration: none; }
.sl-flip-cell b { color: var(--ink); font-family: var(--font-mono); font-size: 12.5px; font-weight: 500; }
.sl-flip-cell b.fx-up { color: var(--up); }
.sl-flip-cell b.fx-down { color: var(--down); }
.sl-flip-cell small { margin: 0; color: var(--muted); font-family: var(--font-mono); font-size: 10.5px; }
.sl-lab-flips th.num { white-space: normal; min-width: 76px; line-height: 1.25; }
.sl-flip-cell { display: inline-grid; justify-items: end; text-decoration: none; }
.sl-flip-cell b { color: var(--ink); font-family: var(--font-mono); font-size: 12.5px; font-weight: 500; }
.sl-flip-cell b.fx-up { color: var(--up); }
.sl-flip-cell b.fx-down { color: var(--down); }
.sl-flip-cell small { margin: 0; color: var(--muted); font-family: var(--font-mono); font-size: 10.5px; }
.fx-table.sl-lab-flips th, .fx-table.sl-lab-flips td { padding-left: 8px; padding-right: 8px; }
.sl-lab-flips th.num { min-width: 62px; }
.sl-lab-flips th .dk-tip, .sl-lab-flips th [data-tip] { display: none; }
.sl-lab-flips .sl-chip { min-width: 0; padding: 1px 8px; }
.dk-regime { margin-left: auto; overflow: hidden; color: var(--muted); font-family: var(--font-ui) !important; font-size: 11.5px !important; text-overflow: ellipsis; white-space: nowrap; }
.dk-regime b { margin-right: 6px; font-weight: 600; }
.dk-regime-calm { color: var(--up); }
.dk-regime-normal { color: var(--ink); }
.dk-regime-stressed { color: var(--down); }

/* The ten-year swing replay's result by year (FlipDayHelper#swing_year_chart). */
.sw-bar { stroke: none; }
.sw-bar-up { fill: var(--up); }
.sw-bar-down { fill: var(--down); }
.au-flip-form select { height: 28px; }
