/* ============================== FUTURES BOARD ==============================
   The Futures tab (rendered by assets/futures.js) — same after-hours
   trading-floor family as the Market Update tab: a deep EastCo-navy slab,
   light text, brightened gold, glowing green/red moves. The --dk-* token
   VALUES are copied from the #panel-marketdesk block in styles.css — if the
   desk palette ever moves, move this block with it. Everything is scoped to
   #panel-futures / .fut-* so no other tab is touched, and a light
   @media print variant (bottom) keeps a printout off a wall of dark ink. */
#panel-futures {
  --dk-bg-top: #0b2139;
  --dk-card: #102a49;      /* elevated dark card (the drill-down board) */
  --dk-card-2: #0d2440;    /* the summary board surface */
  --dk-line: #22466c;      /* borders on dark */
  --dk-line-soft: rgba(255, 255, 255, 0.09);
  --dk-text: #eaf2fb;      /* body text */
  --dk-head: #ffffff;      /* headings + product names */
  --dk-muted: #aec0d5;     /* small notes, kept high-contrast for older eyes */
  --dk-faint: #97aac0;     /* finest print, still legible */
  --dk-gold: #f2b12a;      /* brightened gold for dark */
  --dk-gold-deep: #ffce5a; /* gold text / chips */
  --dk-gold-soft: rgba(214, 150, 0, 0.16);
  --dk-blue: #5aa9f5;      /* pop-blue chip labels (unit notes) */
  --dk-blue-soft: rgba(56, 132, 222, 0.20);
  --dk-pos: #46d98a;       /* glow green */
  --dk-neg: #ff6f61;       /* glow red */
}

/* The dark slab — same floating-panel treatment as the marketdesk. */
#panel-futures.active {
  color: var(--dk-text);
  background:
    radial-gradient(70% 44% at 12% -6%, rgba(214, 150, 0, 0.12), transparent 60%),
    radial-gradient(80% 55% at 102% -4%, rgba(29, 92, 150, 0.28), transparent 55%),
    linear-gradient(180deg, var(--dk-bg-top) 0%, #071a2e 55%, #05121f 100%);
  border: 1px solid #163350;
  border-radius: 18px;
  padding: 1.6rem 1.6rem 2rem;
  box-shadow: 0 14px 46px rgba(3, 12, 24, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.04);
  -webkit-print-color-adjust: exact; print-color-adjust: exact;
}

/* Shared classes that also live on the light tabs — restyled only in here. */
#panel-futures .page-title { color: var(--dk-head); }
#panel-futures .page-sub { color: var(--dk-muted); }
#panel-futures .section-head h3 { color: var(--dk-head); }
#panel-futures .section-head .hint { color: var(--dk-muted); }
#panel-futures .empty {
  background: rgba(255, 255, 255, 0.04); border-color: var(--dk-line); color: var(--dk-muted);
}
#panel-futures .muted { color: var(--dk-faint); }
#panel-futures .pos { color: var(--dk-pos); text-shadow: 0 0 10px rgba(70, 217, 138, 0.30); }
#panel-futures .neg { color: var(--dk-neg); text-shadow: 0 0 10px rgba(255, 111, 97, 0.28); }

/* ---- Masthead: page title + the board-as-of stamp ---- */
.fut-masthead { display: flex; align-items: baseline; gap: 0.9rem; flex-wrap: wrap; }
.fut-stamp {
  font-family: var(--font-mono); font-size: 0.72rem; letter-spacing: 0.05em;
  color: var(--dk-gold-deep); background: var(--dk-gold-soft);
  border: 1px solid rgba(242, 177, 42, 0.30); border-radius: 999px;
  padding: 0.18rem 0.62rem; white-space: nowrap;
  -webkit-print-color-adjust: exact; print-color-adjust: exact;
}

/* ---- The board card: its own horizontal scroller, never the page ---- */
.fut-wrap {
  overflow-x: auto; margin-top: 0.6rem;
  background: var(--dk-card-2); border: 1px solid var(--dk-line); border-radius: var(--radius);
  box-shadow: 0 6px 18px rgba(3, 12, 24, 0.35);
}
.fut-table { min-width: 720px; }

/* Dark table treatment (marketdesk family): navy header with a thin gold
   underline, light hairlines. Quote figures go monospace like the header
   ticker — a quotes board, not a statement table. */
#panel-futures thead th {
  background: #0e2c4d; color: #dfeaf7;
  border-bottom: 2px solid rgba(242, 177, 42, 0.32);
}
#panel-futures tbody td { color: var(--dk-text); border-bottom-color: var(--dk-line-soft); }
#panel-futures tbody tr:hover { background: transparent; } /* kill the paper hover */
#panel-futures td.num { font-family: var(--font-mono); font-size: 0.82rem; }
#panel-futures tr[hidden] { display: none; }

/* ---- Product rows: the whole row is the drill-down control ---- */
.fut-prod-row { cursor: pointer; }
.fut-prod-row td { padding-top: 0.62rem; padding-bottom: 0.62rem; }
.fut-prod-row:hover td { background: rgba(255, 255, 255, 0.05); }
.fut-prod-cell { min-width: 200px; }
.fut-toggle {
  display: inline-flex; align-items: center; gap: 0.5rem;
  background: none; border: none; padding: 0; cursor: pointer;
  font: inherit; color: var(--dk-head); font-weight: 700; text-align: left;
}
.fut-toggle:focus-visible { outline: 2px solid var(--dk-gold); outline-offset: 3px; border-radius: 4px; }
.fut-caret::before {
  content: "▸"; display: inline-block; color: var(--dk-gold);
  font-size: 0.78rem; transition: transform 0.18s ease;
}
.fut-prod-row.open .fut-caret::before { transform: rotate(90deg); }
.fut-unit {
  font-size: 0.6rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--dk-blue); background: var(--dk-blue-soft);
  border: 1px solid rgba(90, 169, 245, 0.28); border-radius: 999px;
  padding: 0.08rem 0.45rem; white-space: nowrap;
  -webkit-print-color-adjust: exact; print-color-adjust: exact;
}
.fut-ct { font-weight: 600; }

/* Open product row: gold wash + gold spine so the drill-down reads attached. */
.fut-prod-row.open td { background: rgba(242, 177, 42, 0.10); border-bottom-color: transparent; }
.fut-prod-row.open:hover td { background: rgba(242, 177, 42, 0.15); }
.fut-prod-row.open td:first-child { box-shadow: inset 3px 0 0 var(--dk-gold); }

/* ---- Drill-down: the full contract board, inset on an elevated card ---- */
.fut-detail-row > td {
  padding: 0 0.7rem 0.9rem; white-space: normal;
  background: rgba(242, 177, 42, 0.045); border-bottom: 1px solid var(--dk-line);
  box-shadow: inset 3px 0 0 var(--dk-gold);
}
.fut-sub-head { display: flex; align-items: baseline; gap: 0.6rem; flex-wrap: wrap; padding: 0.65rem 0.2rem 0.5rem; }
.fut-sub-title { font-family: var(--font-display); font-weight: 700; font-size: 0.88rem; color: var(--dk-gold-deep); }
.fut-sub-unit { font-size: 0.7rem; color: var(--dk-muted); }
.fut-subwrap {
  overflow-x: auto;
  background: var(--dk-card); border: 1px solid var(--dk-line); border-radius: 8px;
}
.fut-subtable { min-width: 640px; }
.fut-subtable thead th {
  position: static; /* no sticky inside the drill-down */
  background: rgba(255, 255, 255, 0.05); color: var(--dk-muted);
  border-bottom: 1px solid var(--dk-line); font-size: 0.64rem;
}
.fut-subtable tbody tr:nth-child(even) td { background: rgba(255, 255, 255, 0.028); }
.fut-subtable tbody tr:hover td { background: rgba(255, 255, 255, 0.06); }
.fut-subtable tbody tr:last-child td { border-bottom: none; }
.fut-front {
  display: inline-block; margin-left: 0.45rem;
  background: var(--dk-gold-soft); color: var(--dk-gold-deep);
  border: 1px solid rgba(242, 177, 42, 0.35); border-radius: 999px;
  padding: 0.04rem 0.45rem; font-size: 0.6rem; font-weight: 700;
  letter-spacing: 0.05em; text-transform: uppercase;
  -webkit-print-color-adjust: exact; print-color-adjust: exact;
}

/* ---- Footer note: small, muted, plain-voice ---- */
.fut-foot { margin-top: 1.1rem; font-size: 0.72rem; color: var(--dk-faint); line-height: 1.5; }

@media (max-width: 480px) {
  #panel-futures.active { padding: 1.1rem 0.95rem 1.5rem; border-radius: 14px; }
  .fut-masthead { gap: 0.5rem; }
}

/* Light print variant — never dump a page of solid dark ink. Mirrors the
   marketdesk print approach: revert the slab and every .fut-* surface to the
   paper palette; keep the meaningful gold fills. */
@media print {
  #panel-futures.active {
    color: var(--ink); background: #fff; border: none; border-radius: 0; box-shadow: none; padding: 0;
  }
  #panel-futures .page-title, #panel-futures .section-head h3 { color: var(--ink); }
  #panel-futures .page-sub, #panel-futures .section-head .hint { color: var(--muted); }
  #panel-futures .muted, .fut-foot { color: var(--faint); }
  #panel-futures .pos { color: var(--green); text-shadow: none; }
  #panel-futures .neg { color: var(--red); text-shadow: none; }
  #panel-futures tbody td { color: var(--ink); border-bottom-color: var(--line); }
  .fut-wrap { background: #fff; border-color: var(--line); box-shadow: none; }
  .fut-stamp { color: var(--gold-deep); background: var(--gold-soft); border-color: #e6d3a0; }
  .fut-toggle { color: var(--ink); }
  .fut-caret::before { color: var(--gold); }
  .fut-unit { color: var(--navy-800); background: var(--blue-soft); border-color: #cfe0f2; }
  .fut-prod-row.open td { background: #fdf5df; }
  .fut-prod-row.open td:first-child { box-shadow: inset 3px 0 0 var(--gold); }
  .fut-detail-row > td { background: #fbf8ef; border-bottom-color: var(--line); box-shadow: inset 3px 0 0 var(--gold); }
  .fut-sub-title { color: var(--gold-deep); }
  .fut-sub-unit { color: var(--muted); }
  .fut-subwrap { background: #fff; border-color: var(--line); }
  .fut-subtable thead th { background: #f2efe7; color: var(--muted); border-bottom-color: var(--line); }
  .fut-subtable tbody tr:nth-child(even) td { background: #fff; }
  .fut-front { background: var(--gold-soft); color: var(--gold-deep); border-color: #e6d3a0; }
  .fut-stamp, .fut-unit, .fut-front, .fut-prod-row.open td, .fut-detail-row > td {
    -webkit-print-color-adjust: exact; print-color-adjust: exact;
  }
}
