/* COT Report Browser
   Dark by default, matching how these tables are usually read. Both themes are
   defined token-level so nothing inherits a colour from the wrong set. */

:root,
:root[data-theme="dark"] {
  --bg:            #14171b;
  --surface:       #1b1f24;
  --surface-2:     #22272e;
  --surface-3:     #2a3038;
  --ink:           #e9edf2;
  --ink-2:         #b3bcc7;
  --ink-muted:     #7d8894;
  --rule:          #2e343c;
  --rule-strong:   #3d444e;
  --accent:        #e0a63c;

  /* Diverging heatmap: two hues either side of a neutral gray midpoint.
     Five equal steps per arm, lightness monotonic outward from the middle. */
  --d-neg-5: #7d2f26;
  --d-neg-4: #8e3a2f;
  --d-neg-3: #9d4739;
  --d-neg-2: #7c4740;
  --d-neg-1: #4e3c3c;
  --d-mid:   #2b3138;
  --d-pos-1: #35453f;
  --d-pos-2: #2f5a45;
  --d-pos-3: #2b724f;
  --d-pos-4: #2f8a5c;
  --d-pos-5: #37a268;

  --ink-on-fill: #f2f6fa;
  /* Reserved status palette. Deliberately NOT steps from the diverging ramp:
     that ramp's negative arm is darkest at its extreme while the positive arm
     is brightest, so reusing them as label ink gave 1.13:1 on the bearish pill.
     All three pairs below are measured at >= 7:1. */
  --status-good-ink: #5FD99A;  --status-good-bg: #16301F;
  --status-bad-ink:  #FF8A7A;  --status-bad-bg:  #331A17;
  --status-flat-ink: #B3BCC7;  --status-flat-bg: #22272E;
  --warn-bg:   #3a2c10;
  --warn-edge: #6b5218;
  --warn-ink:  #f0c256;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 10px 30px -18px rgba(0,0,0,.8);
}

:root[data-theme="light"] {
  --bg:            #eef1f5;
  --surface:       #ffffff;
  --surface-2:     #f3f6f9;
  --surface-3:     #e7ecf2;
  --ink:           #10151b;
  --ink-2:         #3d4753;
  --ink-muted:     #66707d;
  --rule:          #dbe1e9;
  --rule-strong:   #c2cad4;
  --accent:        #8a5b12;

  --d-neg-5: #e2857a;
  --d-neg-4: #ec9c90;
  --d-neg-3: #f4b3a8;
  --d-neg-2: #f7cdc6;
  --d-neg-1: #f2e0dc;
  --d-mid:   #eceff3;
  --d-pos-1: #dfe9e2;
  --d-pos-2: #c8e6d5;
  --d-pos-3: #a8d9bf;
  --d-pos-4: #85caa6;
  --d-pos-5: #63ba8d;

  --ink-on-fill: #0d1218;
  --status-good-ink: #126B41;  --status-good-bg: #DCF0E4;
  --status-bad-ink:  #A32B20;  --status-bad-bg:  #FBE2DE;
  --status-flat-ink: #4A5563;  --status-flat-bg: #EDF0F4;
  --warn-bg:   #fdf3d6;
  --warn-edge: #e3c66f;
  --warn-ink:  #6b4e0a;
  --shadow: 0 1px 2px rgba(16,21,27,.06), 0 10px 30px -18px rgba(16,21,27,.35);
}

/* Colour-safe alternative: blue/orange survives deuteranopia and protanopia,
   which red/green does not. Same structure, same number of steps. */
:root[data-cvd="on"][data-theme="dark"],
:root[data-cvd="on"]:not([data-theme="light"]) {
  --d-neg-5: #9a5a12;
  --d-neg-4: #a9691a;
  --d-neg-3: #8e6030;
  --d-neg-2: #6b4f36;
  --d-neg-1: #47403a;
  --d-pos-1: #33424f;
  --d-pos-2: #2d5271;
  --d-pos-3: #2a6591;
  --d-pos-4: #2f79ad;
  --d-pos-5: #3c8ec6;
}

:root[data-cvd="on"][data-theme="light"] {
  --d-neg-5: #e0a253;
  --d-neg-4: #ebb877;
  --d-neg-3: #f2cd9c;
  --d-neg-2: #f6e0c4;
  --d-neg-1: #f0e8de;
  --d-pos-1: #dee6ee;
  --d-pos-2: #c2d6e9;
  --d-pos-3: #9dc0dd;
  --d-pos-4: #76a8ce;
  --d-pos-5: #5490bd;
}

/* Categorical palette for the analytics charts.
   Trader categories are IDENTITIES, not magnitudes and not polarities, so they
   take distinct hues assigned in a fixed order - never the diverging ramp, and
   never cycled if the list ever grows. Deliberately avoids the green/red of the
   status palette, which is reserved for verdicts.

   Both sets were checked with the dataviz validator rather than by eye, and pass
   the lightness band, chroma floor, adjacent-pair CVD separation (worst pair
   dE 12.1 deutan / 10.3 protan, against a target of 8), the normal-vision floor
   and 3:1 contrast against their own surface. Dark steps are selected against
   #1b1f24 and light steps against #ffffff - not flipped from one another. */
:root,
:root[data-theme="dark"] {
  --cat-1: #5894E0;   /* Dealer / Intermediary   */
  --cat-2: #37A88A;   /* Asset Manager           */
  --cat-3: #C0851F;   /* Leveraged Funds         */
  --cat-4: #A57CD2;   /* Other Reportables       */
  --cat-5: #DA6A76;   /* Non-Reportable          */

  --chart-grid:  #2a3038;
  --chart-zero:  #4a525d;
  --chart-cross: #6b7682;
  --chart-band:  rgba(136,150,166,.14);
}

:root[data-theme="light"] {
  --cat-1: #346FB8;
  --cat-2: #008367;
  --cat-3: #9A6100;
  --cat-4: #8058AB;
  --cat-5: #B14554;

  --chart-grid:  #e2e8ef;
  --chart-zero:  #b6bfca;
  --chart-cross: #8b95a1;
  --chart-band:  rgba(70,86,104,.10);
}

/* Sequential ramp for the options heatmap.
   Open interest is magnitude, not polarity, so it takes ONE hue stepped by
   lightness - never the diverging red/green used for COT positioning. A
   single-hue ramp is also inherently colourblind-safe, since it varies in
   lightness rather than in hue. */
:root,
:root[data-theme="dark"] {
  --s-0: #1b2027;
  --s-1: #17313f;
  --s-2: #124357;
  --s-3: #0d566f;
  --s-4: #0c6a88;
  --s-5: #147fa1;
  --s-6: #2b95b8;
  --s-7: #4fabcd;
  --s-8: #7cc3e0;
  --s-9: #b0dcf0;
  --ink-on-seq-low: #cbd5e0;
  --ink-on-seq-high: #08141c;
}

:root[data-theme="light"] {
  --s-0: #f4f7fa;
  --s-1: #e2eef5;
  --s-2: #cbe3ef;
  --s-3: #aed5e7;
  --s-4: #8cc4dc;
  --s-5: #66b0d0;
  --s-6: #4599c1;
  --s-7: #2b80ab;
  --s-8: #1c6791;
  --s-9: #114f73;
  --ink-on-seq-low: #16202b;
  --ink-on-seq-high: #f2f8fc;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: ui-sans-serif, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ---------- report tabs ----------
   Six items with long labels do not fit a phone. Rather than let them force the
   whole document wide - which is what clipped the masthead and every table on
   mobile - the links collapse behind a button below 860px and stack vertically.
   Desktop keeps the plain horizontal bar. */
.tabs {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 0 24px;
  background: var(--bg);
  border-bottom: 1px solid var(--rule);
  position: relative;
}
.nav-links { display: flex; gap: 2px; flex: 1; }
.tabs a {
  padding: 13px 18px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-muted);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
}
.tabs a:hover { color: var(--ink-2); }
.tabs a.on { color: var(--accent); border-bottom-color: var(--accent); }
.nav-tgl { margin: 6px 0; padding: 6px 12px; min-height: 30px; font-size: 12px; flex: none; }

/* Grouped links: a button that opens a small menu. Opens on hover (and on
   keyboard focus) where there is a mouse, and on tap elsewhere - see initNav().
   The menu sits flush under the button, with no gap, so moving the pointer down
   into it never crosses dead space that would close it. */
.nav-group { position: relative; display: flex; }
.nav-group-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 13px 18px;
  background: none;
  border: 0;
  border-bottom: 2px solid transparent;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-muted);
  white-space: nowrap;
  cursor: pointer;
}
.nav-group-btn::after {
  content: "";
  width: 5px;
  height: 5px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: translateY(-2px) rotate(45deg);
}
.nav-group-btn:hover, .nav-group.open .nav-group-btn { color: var(--ink-2); }
.nav-group.on .nav-group-btn { color: var(--accent); border-bottom-color: var(--accent); }

.nav-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 250px;
  flex-direction: column;
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 8px;
  box-shadow: var(--shadow);
  z-index: 60;
}
.nav-group.open .nav-menu { display: flex; }
@media (hover: hover) and (min-width: 861px) {
  .nav-group:hover .nav-menu,
  .nav-group:has(:focus-visible) .nav-menu { display: flex; }
}
.tabs .nav-menu a {
  padding: 10px 14px;
  border-bottom: 0;
  border-radius: 6px;
}
.tabs .nav-menu a:hover { background: var(--surface-2); color: var(--ink); }
.tabs .nav-menu a.on { color: var(--accent); background: var(--surface-2); }

/* The burger is desktop-hidden; it only exists below the breakpoint. */
.nav-burger {
  display: none;
  align-items: center;
  gap: 9px;
  background: none;
  border: 0;
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  padding: 12px 4px;
  cursor: pointer;
}
.burger-bars {
  position: relative;
  width: 18px;
  height: 2px;
  background: currentColor;
  border-radius: 2px;
}
.burger-bars::before, .burger-bars::after {
  content: "";
  position: absolute;
  left: 0;
  width: 18px;
  height: 2px;
  background: currentColor;
  border-radius: 2px;
}
.burger-bars::before { top: -6px; }
.burger-bars::after  { top: 6px; }
/* Open state: the bars become an X, so the control shows what it will do. */
.nav-burger[aria-expanded="true"] .burger-bars { background: transparent; }
.nav-burger[aria-expanded="true"] .burger-bars::before { top: 0; transform: rotate(45deg); }
.nav-burger[aria-expanded="true"] .burger-bars::after  { top: 0; transform: rotate(-45deg); }

@media (max-width: 860px) {
  .tabs { padding: 0 16px; justify-content: space-between; }
  .nav-burger { display: inline-flex; }

  .nav-links {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    gap: 0;
    background: var(--surface);
    border-bottom: 1px solid var(--rule);
    box-shadow: var(--shadow);
    z-index: 50;
  }
  .nav-links.open { display: flex; }
  .tabs .nav-links a {
    padding: 14px 16px;
    border-bottom: 1px solid var(--rule);
    border-left: 3px solid transparent;
  }
  .tabs .nav-links a.on {
    border-bottom-color: var(--rule);
    border-left-color: var(--accent);
    background: var(--surface-2);
  }

  /* In the phone menu every group is already expanded under a small heading -
     one tap to a page, as before - so the group button is just a label. */
  .nav-group { display: block; }
  .nav-group-btn {
    width: 100%;
    padding: 14px 16px 6px;
    border-bottom: 0;
    font-size: 10.5px;
    letter-spacing: .09em;
    text-transform: uppercase;
    pointer-events: none;
    cursor: default;
  }
  .nav-group-btn::after { display: none; }
  .nav-group.on .nav-group-btn { color: var(--ink-muted); border-bottom-color: transparent; }
  .nav-menu {
    display: flex;
    position: static;
    min-width: 0;
    padding: 0;
    background: none;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }
  .tabs .nav-links .nav-menu a {
    padding: 14px 16px 14px 28px;
    border-radius: 0;
    border-bottom: 1px solid var(--rule);
    border-left: 3px solid transparent;
  }
  .tabs .nav-links .nav-menu a.on { border-left-color: var(--accent); }
}

/* ---------- page caveat ---------- */
/* For limitations a reader needs before trusting the numbers. Quieter than the
   staleness warning: this is permanent context, not a fault to act on. */
.caveat {
  margin: 0;
  padding: 14px 24px 18px;
  border-top: 1px solid var(--rule);
  background: var(--surface-2);
  color: var(--ink-2);
  font-size: 12.5px;
  line-height: 1.6;
}
.caveat strong { color: var(--ink); }
.caveat a { color: var(--accent); }
.caveat p { margin: 0 0 10px; }
.caveat p:last-child { margin-bottom: 0; }


/* ---------- staleness warning ---------- */
/* Deliberately outside the diverging data palette: this is page state, not a
   measurement, and must not read as "bearish". */
/* `display: flex` beats the browser's [hidden] { display: none }, so an empty
   banner would still paint as a coloured strip. Scoping the flex to :not([hidden])
   lets the attribute do its job. */
.staleness[hidden] { display: none; }

.staleness:not([hidden]) {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  margin: 0;
  padding: 12px 24px;
  background: var(--warn-bg);
  border-bottom: 1px solid var(--warn-edge);
  color: var(--warn-ink);
  font-size: 13px;
  line-height: 1.5;
}
.staleness code {
  background: rgba(0,0,0,.18);
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 12px;
}
.stale-mark {
  flex: none;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--warn-ink);
  color: var(--warn-bg);
  font-weight: 800;
  font-size: 12px;
  line-height: 18px;
  text-align: center;
  margin-top: 1px;
}

/* ---------- controls ---------- */
.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 16px 20px;
  align-items: flex-end;
  padding: 18px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--rule);
  position: sticky;
  top: 0;
  z-index: 20;
}
.ctrl { display: flex; flex-direction: column; gap: 6px; }
/* Capped: left to grow freely the search box ate the row, pushing Display onto
   a line of its own on the pages that also carry a category control. */
.ctrl-market { flex: 1 1 320px; min-width: 260px; max-width: 460px; }
.ctrl-toggles { margin-left: auto; }

/* Once the row has to wrap, `margin-left: auto` strands Display alone on the
   right. Below this width it just follows the other controls. */
@media (max-width: 1180px) {
  .ctrl-toggles { margin-left: 0; }
}

.ctrl label {
  font-size: 10.5px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink-muted);
  font-weight: 600;
}

input[type="text"], select {
  font: inherit;
  font-size: 14px;
  color: var(--ink);
  background: var(--surface-2);
  border: 1px solid var(--rule-strong);
  border-radius: 6px;
  padding: 8px 11px;
  min-height: 38px;
}
input[type="text"] { width: 100%; }
select { cursor: pointer; }
input:focus-visible, select:focus-visible, button:focus-visible, a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.toggles { display: flex; gap: 8px; }
.tgl {
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-2);
  background: var(--surface-2);
  border: 1px solid var(--rule-strong);
  border-radius: 6px;
  padding: 9px 13px;
  min-height: 38px;
  cursor: pointer;
}
.tgl:hover { background: var(--surface-3); color: var(--ink); }
.tgl[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); }
:root[data-theme="dark"] .tgl-dark { display: inline; }
:root[data-theme="dark"] .tgl-light { display: none; }
:root[data-theme="light"] .tgl-dark { display: none; }
:root[data-theme="light"] .tgl-light { display: inline; }

/* ---------- market combobox ---------- */
.combo { position: relative; }
.combo-list {
  position: absolute;
  top: calc(100% + 4px);
  left: 0; right: 0;
  max-height: 380px;
  overflow-y: auto;
  margin: 0;
  padding: 4px;
  list-style: none;
  background: var(--surface-2);
  border: 1px solid var(--rule-strong);
  border-radius: 8px;
  box-shadow: var(--shadow);
  z-index: 40;
}
.combo-list li { border-radius: 5px; }
.combo-opt {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 8px 10px;
  cursor: pointer;
  font-size: 13.5px;
}
.combo-opt:hover, .combo-opt[aria-selected="true"] { background: var(--surface-3); }
.combo-opt .oname { font-weight: 600; }
.combo-opt .osub { color: var(--ink-muted); font-size: 11.5px; white-space: nowrap; }
.combo-group {
  padding: 9px 10px 4px;
  font-size: 10px;
  letter-spacing: .11em;
  text-transform: uppercase;
  color: var(--ink-muted);
  font-weight: 700;
}
.combo-empty { padding: 14px 10px; color: var(--ink-muted); font-size: 13.5px; }

/* ---------- panel ---------- */
main { padding: 24px; }
.panel {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 12px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.panel-head { padding: 22px 24px 16px; text-align: center; border-bottom: 1px solid var(--rule); }
h1 {
  margin: 0 0 6px;
  font-size: clamp(19px, 2.6vw, 27px);
  letter-spacing: -.01em;
  text-wrap: balance;
}
.meta { margin: 0; font-size: 12.5px; color: var(--ink-muted); }
.meta b { color: var(--ink-2); font-weight: 600; }
.meta em { font-style: normal; color: var(--accent); font-size: 11.5px; }

/* ---------- table ---------- */

/* Horizontal only. The table grows to its full height and the PAGE scrolls it,
   so the header scrolls away with everything else - no inner scroll region. */
.scroller { overflow-x: auto; }
table {
  border-collapse: separate;
  border-spacing: 3px;
  width: 100%;
  min-width: 940px;
  padding: 10px;
  font-variant-numeric: tabular-nums;
}
/* Sticky on the THEAD, not on each TH.
   Pinning the cells individually leaves the 3px border-spacing between the two
   header rows transparent, and scrolled data rows show through the seam. The
   row group carries a background of its own that paints behind that spacing, so
   sticking it as one block gives a solid header - and needs no measuring of
   where the second row should stop. */
thead th {
  background: var(--surface-2);
  color: var(--ink-2);
  font-size: 10.5px;
  letter-spacing: .07em;
  text-transform: uppercase;
  font-weight: 700;
  text-align: center;
  padding: 11px 10px;
  border-radius: 6px;
  white-space: nowrap;
  z-index: 5;
}
tbody td {
  text-align: center;
  padding: 9px 10px;
  border-radius: 6px;
  font-size: 13.5px;
  font-weight: 600;
  white-space: nowrap;
  color: var(--ink-on-fill);
  background: var(--d-mid);
}
td.col-date {
  background: var(--surface-2);
  color: var(--ink-2);
  font-weight: 500;
}
tbody tr:hover td { outline: 1px solid var(--rule-strong); }

/* Wide TFF table: five trader categories under umbrella headers. Alternating
   tints keep a row readable across seventeen columns without adding rules. */
table.wide { min-width: 1500px; }

th.umbrella {
  font-size: 10.5px;
  letter-spacing: .06em;
  background: var(--surface-3);
  color: var(--ink);
  border-bottom: 2px solid var(--accent);
}
th.umbrella.alt { background: var(--surface-2); }
th.sub { font-size: 9.5px; letter-spacing: .09em; padding: 7px 8px; }
th.sub.alt { background: var(--surface-2); }



tbody td.grp { font-weight: 500; font-size: 12.5px; padding: 9px 8px; }
tbody td.grp.net { font-weight: 700; }

/* % of open interest, drawn as a proportional bar */
td.bar-cell { position: relative; overflow: hidden; background: var(--surface-2); padding: 0; }
.bar-fill {
  position: absolute;
  inset: 0 auto 0 0;
  border-radius: 6px 0 0 6px;
}
.bar-long { background: var(--d-pos-4); }
.bar-short { background: var(--d-neg-4); }
.bar-text { position: relative; display: block; padding: 9px 10px; color: var(--ink-on-fill); }

.arrow { opacity: .85; margin-right: 3px; }

/* ---------- bias scorecard ---------- */

/* Verdict pill. Carries a word as well as a colour, so the bias is never
   communicated by hue alone. */
.pill {
  display: inline-block;
  font-size: 10px;
  letter-spacing: .09em;
  font-weight: 700;
  padding: 4px 9px;
  border-radius: 999px;
  border: 1px solid currentColor;
  white-space: nowrap;
}
.pill.good { color: var(--status-good-ink); background: var(--status-good-bg); }
.pill.bad  { color: var(--status-bad-ink);  background: var(--status-bad-bg); }
.pill.flat { color: var(--status-flat-ink); background: var(--status-flat-bg); border-color: var(--rule-strong); }

td.trend-cell { font-size: 11.5px; letter-spacing: .03em; color: var(--ink-2); }
td.na { color: var(--ink-muted); font-weight: 500; }
#bias td { font-size: 12.5px; }
#bias th[title] { cursor: help; }

/* ---------- options heatmap ---------- */
table.heat { min-width: unset; width: auto; border-spacing: 2px; }
table.heat th.exp {
  font-size: 10px;
  letter-spacing: .04em;
  padding: 8px 6px;
  min-width: 74px;
  line-height: 1.35;
}
table.heat th.exp .dte { display: block; color: var(--ink-muted); font-weight: 500; letter-spacing: 0; }
table.heat th.strike-head { min-width: 76px; }

td.strike {
  background: var(--surface-2);
  color: var(--ink-2);
  font-weight: 600;
  font-size: 12.5px;
  min-width: 76px;
}

/* The same strike expressed in the underlying's own units - context, so it sits
   quieter than the strike it is derived from. */
td.strike.equiv {
  background: var(--surface-3);
  color: var(--ink-muted);
  font-weight: 500;
}

/* The strike nearest spot - the reference point for reading the whole grid. */
tr.atm td.strike,
tr.atm td.strike.equiv {
  background: var(--accent);
  color: #14171b;
}
tr.atm td { box-shadow: inset 0 0 0 1px var(--accent); }

td.heat-cell {
  font-size: 11.5px;
  font-weight: 600;
  padding: 7px 8px;
  min-width: 74px;
  font-variant-numeric: tabular-nums;
}
td.heat-cell.zero { color: var(--ink-muted); font-weight: 400; }

tfoot td {
  background: var(--surface-3);
  color: var(--ink);
  font-weight: 700;
  font-size: 11.5px;
  padding: 9px 8px;
  border-radius: 6px;
}
tfoot td.label { background: var(--surface-2); color: var(--ink-muted); font-weight: 600; }

.seq-legend { display: inline-flex; align-items: center; gap: 0; margin: 0 6px; }
.seq-legend i { width: 20px; height: 11px; display: block; }
.seq-legend i:first-child { border-radius: 3px 0 0 3px; }
.seq-legend i:last-child { border-radius: 0 3px 3px 0; }

.stat-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 26px;
  justify-content: center;
  margin: 10px 0 0;
  font-size: 12.5px;
  color: var(--ink-muted);
}
.stat-row b { color: var(--ink); font-weight: 700; }

/* ---------- legend & source ---------- */
.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  align-items: center;
  margin: 0;
  padding: 14px 24px;
  border-top: 1px solid var(--rule);
  font-size: 12px;
  color: var(--ink-2);
}
.key { display: inline-flex; align-items: center; gap: 7px; }
.sw { width: 26px; height: 11px; border-radius: 3px; display: inline-block; }
.sw-pos { background: var(--d-pos-4); }
.sw-mid { background: var(--d-mid); border: 1px solid var(--rule-strong); }
.sw-neg { background: var(--d-neg-4); }
.key-note { color: var(--ink-muted); flex: 1 1 260px; min-width: 240px; }

.source {
  margin: 0;
  padding: 13px 24px;
  border-top: 1px solid var(--rule);
  background: var(--surface-2);
  font-size: 11.5px;
  color: var(--ink-muted);
  text-align: center;
}
.source a { color: var(--accent); }

/* ---------- tooltip ---------- */
.tip {
  position: fixed;
  z-index: 60;
  pointer-events: none;
  background: var(--surface-3);
  color: var(--ink);
  border: 1px solid var(--rule-strong);
  border-radius: 7px;
  padding: 9px 11px;
  font-size: 12.5px;
  line-height: 1.45;
  box-shadow: var(--shadow);
  max-width: 280px;
}
.tip b { color: var(--ink); }
.tip .tip-label { color: var(--ink-muted); }

@media (max-width: 700px) {
  .controls { padding: 14px 16px; }
  main { padding: 14px; }
  .ctrl-toggles { margin-left: 0; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* ============================================================================
   HOMEPAGE
   ----------------------------------------------------------------------------
   The Alpha Traders gradient (#3462DB royal blue -> #08E0F0 cyan, sampled from
   the logo) is used for CHROME ONLY: masthead, headings, card hovers, links.
   It never touches a data mark. The diverging red/green and the sequential
   heatmap ramp encode polarity and magnitude respectively; repainting them to
   match a logo would break what they mean.
   ========================================================================= */

:root, :root[data-theme="dark"] {
  --brand-a: #3462DB;
  --brand-b: #08E0F0;
  --brand-glow: rgba(8, 224, 240, .14);
}
:root[data-theme="light"] {
  --brand-a: #2A50B8;
  --brand-b: #0895A8;
  --brand-glow: rgba(52, 98, 219, .10);
}

/* ---------- masthead ---------- */
.masthead {
  padding: 46px 24px 34px;
  text-align: center;
  border-bottom: 1px solid var(--rule);
  background:
    radial-gradient(120% 140% at 50% -30%, var(--brand-glow), transparent 62%),
    var(--surface);
}
.brand-logo { height: 46px; width: auto; margin: 0 0 18px; }

/* Two real assets rather than a CSS filter on one. */
.logo-light { display: none; }
:root[data-theme="light"] .logo-dark { display: none; }
:root[data-theme="light"] .logo-light { display: inline-block; }

.masthead h1 {
  margin: 0 0 10px;
  font-size: clamp(26px, 4vw, 40px);
  letter-spacing: -.02em;
  background: linear-gradient(96deg, var(--brand-a), var(--brand-b));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.lede {
  margin: 0 auto;
  max-width: 60ch;
  color: var(--ink-2);
  font-size: 15px;
  line-height: 1.6;
}

/* ---------- section headings ---------- */
.section-h {
  margin: 34px 0 14px;
  font-size: 13px;
  letter-spacing: .13em;
  text-transform: uppercase;
  color: var(--ink-muted);
  font-weight: 700;
}
.panel-head h2 { margin: 0 0 6px; font-size: 19px; letter-spacing: -.01em; }
.panel-head { text-align: left; }

/* ---------- stat tiles ---------- */
.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 2px;
  background: var(--rule);
  border-bottom: 1px solid var(--rule);
}
.tile {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 18px 20px;
  background: var(--surface);
}
.tile-label {
  font-size: 10.5px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink-muted);
  font-weight: 700;
}
.tile-value { font-size: 30px; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.tile-note { font-size: 11.5px; color: var(--ink-muted); }
.tile.tone-good .tile-value { color: var(--status-good-ink); }
.tile.tone-bad  .tile-value { color: var(--status-bad-ink); }
.tile.tone-flat .tile-value { color: var(--ink); }

/* ---------- signal lists ---------- */
.signal-cols {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 0 2px;
  background: var(--rule);
}
.signal-cols > div { background: var(--surface); padding: 18px 20px 20px; }
.col-h {
  margin: 0 0 12px;
  font-size: 10.5px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink-muted);
  font-weight: 700;
}
.signals { list-style: none; margin: 0; padding: 0; }
.signal {
  display: grid;
  grid-template-columns: 76px 46px auto 1fr;
  align-items: center;
  gap: 10px;
  padding: 7px 0;
  border-bottom: 1px solid var(--rule);
  font-size: 13px;
}
.signal:last-child { border-bottom: 0; }
.signal-pair { font-weight: 700; }
/* The pill sits in an auto/1fr track, so without this it stretches to fill the
   row and reads as a bar rather than a label. */
.signal .pill { justify-self: start; }
.signal-score { font-weight: 800; font-variant-numeric: tabular-nums; text-align: right; }
.signal-score.tone-good { color: var(--status-good-ink); }
.signal-score.tone-bad  { color: var(--status-bad-ink); }
.signal-trend { color: var(--ink-muted); font-size: 11.5px; text-align: right; }

.panel-foot {
  margin: 0;
  padding: 13px 20px;
  border-top: 1px solid var(--rule);
  background: var(--surface-2);
  font-size: 12.5px;
  color: var(--ink-muted);
}
.panel-foot a { color: var(--brand-b); text-decoration: none; font-weight: 600; }
.panel-foot a:hover { text-decoration: underline; }

/* ---------- tool cards ---------- */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 14px;
}
.card {
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 10px;
  text-decoration: none;
  color: inherit;
  position: relative;
  overflow: hidden;
}
/* The gradient rail only appears on hover, so the resting grid stays calm and
   the hovered card is unambiguous. */
.card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: linear-gradient(180deg, var(--brand-a), var(--brand-b));
  opacity: 0;
  transition: opacity .15s ease;
}
.card:hover { border-color: var(--rule-strong); background: var(--surface-2); }
.card:hover::before { opacity: 1; }
.card-kicker {
  font-size: 10px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--brand-b);
  font-weight: 700;
}
.card-title { font-size: 17px; font-weight: 700; letter-spacing: -.01em; }
.card-desc { font-size: 13px; color: var(--ink-2); line-height: 1.55; flex: 1; }
.card-stat {
  font-size: 11.5px;
  color: var(--ink-muted);
  padding-top: 8px;
  border-top: 1px solid var(--rule);
  font-variant-numeric: tabular-nums;
}

/* ---------- data status table ---------- */
.status-table { border-spacing: 0; min-width: 620px; padding: 0; }
.status-table th {
  text-align: left;
  background: var(--surface-2);
  padding: 10px 20px;
  border-radius: 0;
}
.status-table td {
  text-align: left;
  padding: 11px 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--rule);
  border-radius: 0;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-2);
}
.status-table tr:last-child td { border-bottom: 0; }
.src-name { color: var(--ink) !important; font-weight: 700 !important; }
.src-cadence { color: var(--ink-muted) !important; font-size: 12px !important; }

/* ---------- footer ---------- */
.site-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px 12px;
  padding: 26px 24px 40px;
  color: var(--ink-muted);
  font-size: 12px;
  border-top: 1px solid var(--rule);
  margin-top: 34px;
  text-align: center;
}
/* Copyright drops to its own line so the strapline stays the thing you read. */
.foot-copy { flex-basis: 100%; opacity: .75; font-size: 11.5px; }
.foot-logo { height: 20px; width: auto; opacity: .6; }

body.home main { max-width: 1180px; margin: 0 auto; }

@media (max-width: 620px) {
  .masthead { padding: 32px 16px 26px; }

  /* The status table is the one place a phone has to scroll sideways for a
     column it rarely needs. Cadence is the least load-bearing of the five, so
     it goes and the rest fits. */
  .status-table th:nth-child(4), .status-table td:nth-child(4) { display: none; }
  .status-table { min-width: 0; }
  .status-table th, .status-table td { padding-left: 14px; padding-right: 14px; }
  .signal { grid-template-columns: 66px 42px auto; }
  .signal-trend { display: none; }
}

/* ==========================================================================
   Positioning analytics
   ========================================================================== */

/* .panel itself carries no padding - the report tables are meant to run edge to
   edge. Everything in an analytics panel is prose, bars or a chart, so each
   block sets its own gutter and the panel gets a floor of breathing room. */
.analytics { margin-bottom: 20px; padding-bottom: 24px; }
.analytics:last-child { margin-bottom: 0; }

.analytics > .an-split,
.analytics > .an-cards,
.analytics > .chart-host,
.analytics > .chart-legend,
.analytics > .an-banner,
.analytics > .key-note { padding-left: 24px; padding-right: 24px; }

.analytics > .panel-head { padding-bottom: 20px; }
.analytics > .an-split { padding-top: 22px; }
.analytics > .chart-host { padding-top: 18px; }
.analytics > .an-banner { margin-top: 20px; }
.analytics > .key-note { margin-top: 14px; line-height: 1.6; }

.an-h3 { margin: 0; font-size: 15px; letter-spacing: .01em; }
.an-sub { margin: 2px 0 14px; font-size: 12px; color: var(--ink-muted); }

/* ---- charts */

.chart-host { width: 100%; }
.chart { display: block; width: 100%; height: auto; touch-action: pan-y; }
.chart-axis { font: 11px/1 ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif; }
.gauge-end { font: 10px/1 ui-sans-serif, system-ui, -apple-system, sans-serif; }

.chart-legend {
  display: flex; flex-wrap: wrap; gap: 8px 18px;
  justify-content: center; padding-top: 14px;
}
.lg-item { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; color: var(--ink-2); }
.lg-sw { width: 11px; height: 11px; border-radius: 3px; flex: none; }

.chart-tip {
  position: fixed; z-index: 60; pointer-events: none;
  background: var(--surface-2); color: var(--ink);
  border: 1px solid var(--rule-strong); border-radius: 8px;
  padding: 9px 11px; box-shadow: var(--shadow);
  font-size: 12px; min-width: 190px;
}
.chart-tip[hidden] { display: none; }
.ct-head { font-weight: 700; margin-bottom: 6px; color: var(--ink); }
.ct-row { display: grid; grid-template-columns: 12px 1fr auto; align-items: center; gap: 8px; padding: 2px 0; }
.ct-sw { width: 10px; height: 10px; border-radius: 3px; }
.ct-label { color: var(--ink-2); }
.ct-val { font-variant-numeric: tabular-nums; }

/* ---- long/short split bars */

.an-split { display: grid; grid-template-columns: minmax(0,1.55fr) minmax(0,1fr); gap: 28px; }
.an-bars { display: flex; flex-direction: column; gap: 20px; min-width: 0; }

.sb-row { min-width: 0; }
.sb-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 5px; }
.sb-name { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; font-size: 13px; }
.sb-dot { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.sb-net {
  font-size: 11px; font-weight: 700; letter-spacing: .04em;
  padding: 3px 8px; border-radius: 999px; font-variant-numeric: tabular-nums; white-space: nowrap;
}
.sb-net.good { color: var(--status-good-ink); background: var(--status-good-bg); }
.sb-net.bad  { color: var(--status-bad-ink);  background: var(--status-bad-bg); }
.sb-net.flat { color: var(--status-flat-ink); background: var(--status-flat-bg); }

/* 2px surface gap: without it the long and short blocks read as one bar that
   changes hue somewhere in the middle, rather than as two quantities. */
.sb-track { display: flex; gap: 2px; height: 26px; }
.sb-fill {
  display: flex; align-items: center; min-width: 34px; border-radius: 4px;
  font-size: 11px; font-weight: 600; font-variant-numeric: tabular-nums;
  color: var(--ink-on-fill); overflow: hidden;
}
.sb-fill span { padding: 0 7px; white-space: nowrap; }
.sb-fill.long  { background: var(--d-pos-3); justify-content: flex-start; }
.sb-fill.short { background: var(--d-neg-3); justify-content: flex-end; }

/* Three columns rather than space-between: the middle "% of OI" stays centred
   under the track even when the two end labels differ in length. */
.sb-foot {
  display: grid; grid-template-columns: 1fr auto 1fr; gap: 4px 10px;
  font-size: 11px; color: var(--ink-muted); margin-top: 5px;
}
.sb-foot .sb-s { text-align: right; }
.sb-foot b { color: var(--ink-2); font-variant-numeric: tabular-nums; }
.sb-oi { font-variant-numeric: tabular-nums; }

/* ---- gauge card */

.an-gauge-card {
  background: var(--surface-2); border: 1px solid var(--rule);
  border-radius: 10px; padding: 20px 18px; text-align: center; min-width: 0;
}
.an-gauge-card .an-h3, .an-gauge-card .an-sub { text-align: center; }
.an-gauge { display: flex; justify-content: center; }
.gauge { display: block; }

.an-index { margin: 6px 0 8px; display: flex; flex-direction: column; align-items: center; gap: 1px; }
.an-index-n { font-size: 40px; line-height: 1; font-weight: 700; font-variant-numeric: tabular-nums; }
.an-index span { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-muted); }
.an-verdict { margin: 0 0 10px; }

.an-warn {
  display: flex; gap: 8px; text-align: left; margin: 0 0 12px;
  background: var(--warn-bg); border: 1px solid var(--warn-edge); color: var(--warn-ink);
  border-radius: 8px; padding: 9px 11px; font-size: 12px; line-height: 1.45;
}
.an-warn-mark {
  flex: none; width: 16px; height: 16px; border-radius: 50%; margin-top: 1px;
  background: var(--warn-ink); color: var(--warn-bg);
  font-size: 11px; font-weight: 800; line-height: 16px; text-align: center;
}

.an-range { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 0 0 12px; }
.an-range > div { background: var(--surface); border: 1px solid var(--rule); border-radius: 8px; padding: 12px 8px; }
.an-range dt { font-size: 10px; letter-spacing: .07em; text-transform: uppercase; color: var(--ink-muted); }
.an-range dd { margin: 2px 0 0; font-size: 16px; font-weight: 700; font-variant-numeric: tabular-nums; }
.an-range .an-when { font-size: 10px; font-weight: 400; color: var(--ink-muted); }
.an-note { margin: 0; font-size: 11px; color: var(--ink-muted); }

/* ---- per-category cards */

.an-cards {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 12px; margin-top: 24px;
}
.an-card {
  background: var(--surface-2); border: 1px solid var(--rule);
  border-left-width: 3px; border-radius: 8px; padding: 13px 14px;
  display: flex; flex-direction: column; gap: 2px; min-width: 0;
}
.an-card.tone-edge-good { border-left-color: var(--status-good-ink); }
.an-card.tone-edge-bad  { border-left-color: var(--status-bad-ink); }
.an-card.tone-edge-flat { border-left-color: var(--rule-strong); }
.an-card-name { display: flex; align-items: center; gap: 7px; font-size: 11px; color: var(--ink-2); }
.an-card-net { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }
.an-card-sub { font-size: 11px; color: var(--ink-muted); font-variant-numeric: tabular-nums; }

/* ---- divergence banner */

.an-banner {
  display: flex; gap: 10px; align-items: flex-start;
  border-radius: 8px; padding: 11px 13px; margin-bottom: 14px;
  font-size: 13px; line-height: 1.5;
}
.an-banner.calm { background: var(--surface-2); border: 1px solid var(--rule); color: var(--ink-2); }
.an-banner.hot  { background: var(--warn-bg); border: 1px solid var(--warn-edge); color: var(--warn-ink); }
.an-banner-mark {
  flex: none; width: 17px; height: 17px; border-radius: 50%; margin-top: 2px;
  font-size: 11px; font-weight: 800; line-height: 17px; text-align: center;
}
.an-banner.calm .an-banner-mark { background: var(--rule-strong); color: var(--ink); }
.an-banner.hot  .an-banner-mark { background: var(--warn-ink); color: var(--warn-bg); }
.an-banner b { color: inherit; }

.tone-good { color: var(--status-good-ink); }
.tone-bad  { color: var(--status-bad-ink); }
.tone-flat { color: var(--status-flat-ink); }

/* ---- narrow screens */

@media (max-width: 900px) {
  .an-split { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  .analytics > .an-split,
  .analytics > .an-cards,
  .analytics > .chart-host,
  .analytics > .chart-legend,
  .analytics > .an-banner,
  .analytics > .key-note { padding-left: 16px; padding-right: 16px; }
  .an-cards { grid-template-columns: 1fr 1fr; }
  .an-card-net { font-size: 17px; }
  .an-index-n { font-size: 34px; }
  .sb-fill { min-width: 0; }
  .sb-fill span { padding: 0 5px; }
  /* Stacked, the three foot items get a line each instead of three cramped
     columns fighting over 340px. */
  .sb-foot { grid-template-columns: 1fr 1fr; }
  .sb-foot .sb-oi { grid-row: 2; grid-column: 1 / -1; }
  .chart-legend { justify-content: flex-start; gap: 5px 12px; }
}

/* ---- segmented range control -------------------------------------------- */

.seg {
  display: inline-flex; flex-wrap: wrap; gap: 2px; padding: 3px;
  background: var(--surface-2); border: 1px solid var(--rule); border-radius: 9px;
}
.seg button {
  appearance: none; border: 0; background: transparent; cursor: pointer;
  color: var(--ink-2); font: inherit; font-size: 12px; font-weight: 600;
  letter-spacing: .03em; padding: 6px 11px; border-radius: 6px;
  min-width: 42px; text-align: center;
}
.seg button:hover { background: var(--surface-3); color: var(--ink); }
.seg button[aria-pressed="true"] {
  background: var(--accent); color: #14171b;
}
.seg button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

:root[data-theme="light"] .seg button[aria-pressed="true"] { color: #ffffff; }

@media (max-width: 560px) {
  .ctrl-range { grid-column: 1 / -1; }
  .seg { width: 100%; justify-content: space-between; }
  .seg button { flex: 1 1 auto; min-width: 0; padding: 7px 4px; }
}
.an-thin {
  margin: 18px 0; padding: 14px; border: 1px dashed var(--rule-strong);
  border-radius: 8px; font-size: 12px; color: var(--ink-muted); line-height: 1.5;
}

/* ---- chart zoom toolbar -------------------------------------------------- */

.chart-tools {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 8px 14px; padding-bottom: 10px;
}
.chart-range { font-size: 12px; color: var(--ink-muted); font-variant-numeric: tabular-nums; }
.chart-range.on { color: var(--ink-2); font-weight: 600; }

.chart-btns { display: inline-flex; gap: 2px; padding: 3px; background: var(--surface-2);
  border: 1px solid var(--rule); border-radius: 8px; }
.chart-btns button {
  appearance: none; border: 0; background: transparent; cursor: pointer;
  color: var(--ink-2); font: inherit; font-size: 12px; font-weight: 600;
  min-width: 30px; padding: 4px 9px; border-radius: 5px; line-height: 1.4;
}
.chart-btns button:hover:not(:disabled) { background: var(--surface-3); color: var(--ink); }
.chart-btns button:disabled { opacity: .35; cursor: default; }
.chart-btns button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

/* Dragging out a selection should feel like selecting, not like dragging the
   page or highlighting text. */
.chart { cursor: crosshair; user-select: none; -webkit-user-select: none; }

@media (max-width: 560px) {
  .chart-tools { justify-content: flex-start; }
  .chart-range { order: 2; flex: 1 1 100%; }
}

/* ---- major currency pairs ------------------------------------------------ */

.pair-cell { text-align: left; padding-left: 12px; white-space: nowrap; }
.pair-name { font-weight: 700; font-size: 13px; color: var(--ink); letter-spacing: .01em; }

/* Marks a row whose long/short columns were swapped so the pair reads dollar
   first. Worth calling out on the row itself - it is the one thing about this
   table a reader could otherwise misread without ever noticing. */
.flip-tag {
  display: inline-block; margin-left: 7px; padding: 2px 6px; border-radius: 4px;
  font-size: 9px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase;
  background: var(--surface-3); color: var(--ink-muted); vertical-align: middle;
}
.caveat .flip-tag { margin-left: 0; }

.muted-cell { color: var(--ink-muted); }
.spread-cell { border-left: 2px solid var(--rule-strong); }
.pct-chg { font-weight: 700; }

/* A percentage against a near-zero base is arithmetically fine and analytically
   empty; dot it so the eye does not read it as a real move. */
.pct-wild { text-decoration: underline dotted currentColor 1px; text-underline-offset: 3px; }

#direct { min-width: 1500px; }
#crosses { min-width: 1000px; }
#lev { min-width: 1260px; }
#direct td, #crosses td, #lev td { font-size: 12.5px; }

/* Freeze the pair name. Fifteen columns do not fit any phone, and once the table
   is scrolled sideways a row of numbers with no label on it is unreadable.
   The horizontal box-shadow fills the border-spacing seam to the cell's right,
   for the same reason the header rows need one: with `border-collapse: separate`
   the gap between cells is painted from the table's background, so without it
   the scrolling columns show through. */
#direct td.col-date,
#crosses td.col-date,
#lev td.col-date,
#compare td.col-date {
  position: sticky;
  left: 0;
  z-index: 2;
  box-shadow: 3px 0 0 var(--surface);
}
#direct thead th.col-date,
#crosses thead th.col-date,
#lev thead th.col-date,
#compare thead th.col-date {
  left: 0;
  box-shadow: 3px 0 0 var(--surface);
}

@media (max-width: 560px) {
  .flip-tag { display: none; }
  .pair-cell { padding-left: 8px; }
}

.sub-head { margin: 8px 0 0; font-size: 12.5px; color: var(--ink-2); }
.leg-cell { font-weight: 700; color: var(--ink-2); letter-spacing: .04em; }
.row-empty {
  text-align: left; padding-left: 14px; color: var(--ink-muted);
  font-size: 12px; font-style: italic; background: var(--surface-2);
}

/* ---- LF strength index grid ---------------------------------------------- */

.strength-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 3px;
}
.strength-card {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px; padding: 12px 6px; border-radius: 6px;
  background: var(--d-mid);
}
.strength-pair { font-size: 12px; font-weight: 700; letter-spacing: .03em; color: var(--ink); }
.strength-val { font-size: 15px; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--ink); }
.strength-empty { opacity: .5; }

@media (max-width: 560px) {
  .strength-grid { grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); }
  .strength-pair { font-size: 11px; }
  .strength-val { font-size: 13px; }
}

/* ---- sortable table headers ---------------------------------------------- */

thead th.sortable {
  cursor: pointer;
  user-select: none;
  position: relative;
  padding-right: 18px;
}
thead th.sortable:hover { background: var(--surface-3); color: var(--ink); }

/* A reserved-width arrow rather than one that appears on hover/active only -
   swapping the column width when a sort is applied would shift every other
   header sideways. */
thead th.sortable::after {
  content: '';
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  border: 4px solid transparent;
  opacity: .35;
}
thead th.sortable[aria-sort="none"]::after,
thead th.sortable:not([aria-sort])::after {
  border-top-color: var(--ink-muted);
  margin-top: 2px;
}
thead th.sortable[aria-sort="ascending"]::after {
  border-bottom-color: var(--accent);
  margin-top: -2px;
  opacity: 1;
}
thead th.sortable[aria-sort="descending"]::after {
  border-top-color: var(--accent);
  margin-top: 2px;
  opacity: 1;
}

/* The COT Index's own window toggle, inside the gauge card. Reuses the .seg
   control already defined for the table's date-range picker - same look,
   smaller stakes: this only ever changes what the gauge reads, nothing else
   on the page. .an-gauge-card already centers text, which centers this
   inline-flex control too, so no extra alignment rule is needed here. */
.an-window-seg { margin: 8px 0 10px; }
.an-window-seg button { min-width: 34px; padding: 5px 8px; font-size: 11px; }

/* ---- Max./Min. summary rows in a table header ---------------------------- */

/* These sit in <thead> so they stay attached to the header block rather than
   scrolling away as if they were data - but they hold NUMBERS, so they opt out
   of the uppercase small-caps treatment every other header cell gets. */
.summary-row .summary-label {
  text-align: center;
  font-size: 11px;
  letter-spacing: .06em;
  color: var(--ink-2);
  background: var(--surface-3);
}
.summary-row .summary-cell {
  background: var(--surface-3);
  color: var(--ink);
  font-size: 12.5px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  text-align: center;
  text-transform: none;
  letter-spacing: normal;
  padding: 8px 10px;
  border-radius: 6px;
}
/* The trailing colspan filler carries no value - keep it visually quiet rather
   than letting an empty header-coloured block draw the eye. */
.summary-row td[colspan] { background: transparent; }

/* On the grouped reports (TFF, Disaggregated) the categories are banded with
   an alternating tint across the umbrella and sub headers; the summary cells
   pick it up too so each category reads as one vertical block top to bottom. */
.summary-row .summary-cell.alt { background: var(--surface-2); }

/* ---- Sign-in page ---- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.login-card {
  position: relative;
  width: 100%; max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 12px;
  padding: 26px 24px 24px;
  display: flex; flex-direction: column;
}
.login-card h1 {
  font-size: clamp(1.15rem, 5vw, 1.4rem); font-weight: 700; letter-spacing: -0.01em;
  text-align: center; margin: 0 0 8px; color: var(--login-blue);
}
.login-sub { margin: 0 0 20px; color: var(--ink-2); font-size: 0.85rem; text-align: center; }
.login-card label { font-size: 0.8rem; color: var(--ink-2); margin: 0 0 6px; }
.login-card input {
  background: var(--surface-2); color: var(--ink);
  border: 1px solid var(--rule-strong); border-radius: 8px;
  padding: 11px 12px; font: inherit; margin-bottom: 14px;
}
.login-card input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.login-hint { margin: -8px 0 16px; font-size: 0.78rem; color: var(--ink-muted); }
.login-notice {
  margin: 0 0 14px; padding: 10px 12px; border-radius: 8px; font-size: 0.85rem;
  color: var(--ink); background: var(--surface-3); border-left: 3px solid #3d48d7;
}
.login-error {
  margin: 0 0 14px; padding: 10px 12px; border-radius: 8px; font-size: 0.9rem;
  color: var(--ink); background: var(--surface-3); border-left: 3px solid var(--accent);
}
/* #3d48d7 is the darkest blue in the logo's gradient (sampled from the PNG). */
.login-btn {
  background: #3d48d7; color: #fff; border: 0; border-radius: 8px;
  padding: 12px; font: inherit; font-weight: 600; cursor: pointer;
}
.login-btn:hover:not(:disabled) { filter: brightness(1.15); }
.login-btn:disabled { opacity: 0.6; cursor: progress; }
/* The card is a flex column, which stretches children to full width by default -
   that is what distorted the logo. Keep its own aspect ratio and centre it. */
.login-card .brand-logo {
  align-self: center;
  height: 42px; width: auto; max-width: 100%;
  object-fit: contain;
  margin: 0 0 16px;
}

/* Brand blue for the title, and a soft top-lit background behind the card.
   Light theme uses a deeper blue so the title keeps its contrast. */
:root, :root[data-theme="dark"] { --login-blue: #4b9be0; }
:root[data-theme="light"] { --login-blue: #1f6fc0; }
.login-page { background: linear-gradient(180deg, #2a343c 0%, #1c2126 55%, #171a1e 100%) fixed; }
:root[data-theme="light"] .login-page { background: linear-gradient(180deg, #e3ebf4 0%, #eef2f7 55%, #f4f6f9 100%) fixed; }
