/* Dark only (your choice, 2026-11-18): the logo's near-white text (#F4F2EC) and gold (#CEB14A). */
:root {
  --bg: #0b0b0b; --card: #151515; --raised: #1d1d1d; --line: #2a2a2a; --strike: #262626;
  --fg: #f4f2ec; --muted: #9b9890; --accent: #ceb14a;
  --good: #3ccf86; --bad: #f2646f; --warn: #e8b84a;
  --call-bar: rgba(242, 100, 111, 0.16); --put-bar: rgba(60, 207, 134, 0.16); --itm: rgba(206, 177, 74, 0.07);
  color-scheme: dark;
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; } /* `nav { display: flex }` would otherwise show a hidden nav */
body { margin: 0; background: var(--bg); color: var(--fg); }
header { display: flex; flex-wrap: wrap; gap: 8px 20px; align-items: center; padding: 10px 16px;
         border-bottom: 1px solid var(--line); background: #000; position: sticky; top: 0; z-index: 5; }
.logo { height: 23px; width: auto; display: block; }
nav { display: flex; flex-wrap: wrap; gap: 4px; margin-left: auto; }
nav button { background: none; color: var(--fg); border: 1px solid transparent; }
nav button.on { border-color: var(--line); background: var(--raised); }
main { max-width: 1100px; margin: 0 auto; padding: 8px 16px 48px; }
main:has(> .board:not([hidden])) { max-width: none; }
h1 { font-size: 1.3rem; margin: 16px 0 8px; }
h2 { font-size: 1.05rem; margin: 20px 0 6px; }
h3 { font-size: 0.85rem; color: var(--muted); font-weight: 600; margin: 16px 0 4px; }
label { display: flex; flex-direction: column; gap: 2px; font-size: 0.85rem; color: var(--muted); margin: 6px 0; }
label.check { flex-direction: row; align-items: center; gap: 6px; }
label.inline { flex-direction: row; align-items: center; gap: 8px; margin: 0; }
input, select, textarea { font: inherit; color: var(--fg); background: var(--card); border: 1px solid var(--line);
                          border-radius: 6px; padding: 6px 8px; min-width: 0; }
textarea { width: 100%; }
button { font: inherit; padding: 6px 12px; border-radius: 6px; border: 1px solid var(--accent);
         background: var(--accent); color: #111; cursor: pointer; }
button.quiet { background: none; color: var(--accent); }
button.icon { background: none; border-color: var(--line); color: var(--fg); padding: 4px 9px; }
.row { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: flex-end; }
#login-form { max-width: 360px; }
.note { color: var(--muted); font-size: 0.85rem; }
.scroll { overflow-x: auto; }
table { border-collapse: collapse; font-size: 0.85rem; font-variant-numeric: tabular-nums; }
th, td { text-align: left; padding: 4px 10px 4px 0; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { color: var(--muted); font-weight: 600; }
#message { margin: 0; padding: 8px 16px; background: var(--card); border-bottom: 1px solid var(--line); }
#message.bad { color: var(--bad); }
#message.good { color: var(--good); }
.up { color: var(--good); }
.down { color: var(--bad); }

/* The index picker in the header */
.index-pick { position: relative; }
#index-btn { display: flex; align-items: baseline; gap: 8px; background: var(--raised); color: var(--fg);
             border: 1px solid var(--line); border-radius: 999px; padding: 6px 14px; }
#index-btn .ltp { font-weight: 600; font-variant-numeric: tabular-nums; }
#index-btn .caret { color: var(--muted); }
.index-menu { position: absolute; top: calc(100% + 6px); left: 0; min-width: 260px; background: var(--card);
              border: 1px solid var(--line); border-radius: 12px; padding: 6px; z-index: 10;
              box-shadow: 0 12px 32px rgba(0, 0, 0, 0.6); }
.index-menu .pick { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; width: 100%; text-align: left;
                    background: none; color: var(--fg); border: 0; border-radius: 8px; padding: 10px 12px; }
.index-menu .pick small { grid-column: 1 / -1; }
.index-menu .pick.on, .index-menu .pick:hover { background: var(--raised); }

/* The board */
.board-bar { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; padding: 10px 0 6px; }
.board-bar .side { color: var(--muted); font-weight: 600; }
.board-bar .side:last-child { text-align: right; }
.board-bar .expiry { display: flex; gap: 8px; align-items: center; }
.summary { display: flex; flex-wrap: wrap; gap: 6px 22px; align-items: center; padding: 8px 12px; margin-bottom: 8px;
           background: var(--card); border: 1px solid var(--line); border-radius: 10px; }
.summary .fig { display: flex; flex-direction: column; }
.summary .label { color: var(--muted); font-size: 0.75rem; }
.summary .value { font-weight: 600; font-variant-numeric: tabular-nums; }
.summary .warn, .status.warn { color: var(--warn); }
.status { margin-left: auto; font-weight: 700; font-size: 0.8rem; letter-spacing: 0.04em; }
.status.live { color: var(--good); }
.status.live::before { content: "● "; }
.status.stale { color: var(--bad); }
.board-wrap { overflow: auto; max-height: calc(100vh - 230px); border: 1px solid var(--line); border-radius: 10px; }
#board { width: 100%; font-size: 0.9rem; }
#board th { position: sticky; top: 0; background: #000; z-index: 2; text-align: center; padding: 8px 10px;
            font-size: 0.75rem; letter-spacing: 0.03em; text-transform: uppercase; }
#board td { padding: 6px 10px; text-align: center; vertical-align: middle; position: relative; }
#board td .v { position: relative; display: block; }
#board td small { position: relative; display: block; font-size: 0.72rem; color: var(--muted); }
#board td small.up { color: var(--good); }
#board td small.down { color: var(--bad); }
#board td small.position { color: var(--accent); }
#board td.muted { color: var(--muted); }
#board td.old .v { opacity: 0.55; }
#board td.buildup { text-align: center; white-space: normal; min-width: 7.5em; font-size: 0.85rem; }
/* two classes: these win over the ITM highlight (#board td.itm) on in-the-money cells */
#board td.buildup.bu-up { background: rgba(60, 207, 134, 0.10); }
#board td.buildup.bu-down { background: rgba(242, 100, 111, 0.10); }
#board td.itm { background: var(--itm); }
#board .strike { background: var(--strike); font-weight: 600; min-width: 96px; }
#board th.strike { background: #1f1f1f; }
#board .bar { position: absolute; top: 4px; bottom: 4px; border-radius: 3px; }
#board .bar.call { right: 0; background: var(--call-bar); }
#board .bar.put { left: 0; background: var(--put-bar); }
.tags { display: flex; gap: 4px; justify-content: center; margin-top: 3px; flex-wrap: wrap; }
.tag { font-size: 0.66rem; font-weight: 600; border-radius: 999px; padding: 1px 7px; }
.tag.res { background: rgba(242, 100, 111, 0.18); color: var(--bad); }
.tag.sup { background: rgba(60, 207, 134, 0.18); color: var(--good); }
.tag.pain { background: rgba(206, 177, 74, 0.18); color: var(--accent); }
.spot-row td { padding: 0; border-bottom: 2px solid var(--fg); position: relative; height: 0; }
.spot-tag { position: absolute; left: 50%; top: 100%; transform: translate(-50%, -50%); /* on the middle of the line (collapsed border) */ z-index: 1;
            background: var(--fg); color: #111; border-radius: 999px; padding: 2px 12px; font-weight: 600;
            font-size: 0.85rem; white-space: nowrap; font-variant-numeric: tabular-nums; }
.spot-tag small { display: inline !important; font-size: 0.85rem !important; }
.spot-tag small.up { color: #12804a !important; }
.spot-tag small.down { color: #b4232f !important; }

/* Customise */
dialog { background: var(--card); color: var(--fg); border: 1px solid var(--line); border-radius: 16px;
         padding: 16px 20px; width: min(420px, 92vw); max-height: 85vh; }
dialog::backdrop { background: rgba(0, 0, 0, 0.6); }
.dialog-head { display: flex; align-items: center; gap: 8px; }
.dialog-head h2 { margin: 0; margin-right: auto; }
label.switch { flex-direction: row; justify-content: space-between; align-items: center; color: var(--fg);
               font-size: 0.95rem; padding: 6px 0; margin: 0; cursor: pointer; }
label.switch input { appearance: none; width: 42px; height: 24px; border-radius: 999px; background: var(--raised);
                     border: 1px solid var(--line); position: relative; cursor: pointer; padding: 0; }
label.switch input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px;
                            border-radius: 50%; background: var(--muted); transition: left 0.15s; }
label.switch input:checked { background: var(--accent); border-color: var(--accent); }
label.switch input:checked::after { left: 20px; background: #111; }
label.switch input:focus-visible { outline: 2px solid var(--fg); outline-offset: 2px; }
.column-row { display: flex; align-items: center; gap: 6px; }
.column-row label.switch { flex: 1; }
.column-row button.icon { padding: 2px 8px; }
.column-row button:disabled { opacity: 0.3; cursor: default; }
.sides-row { justify-content: space-between; align-items: center; padding: 6px 0; }
.segmented { display: flex; background: var(--raised); border-radius: 999px; padding: 3px; }
.segmented button { background: none; border: 0; color: var(--fg); border-radius: 999px; padding: 4px 14px; }
.segmented button.on { background: var(--fg); color: #111; }

@media (max-width: 700px) {
  nav { margin-left: 0; }
  .board-bar .side { display: none; }
  .board-bar { grid-template-columns: 1fr; justify-items: center; }
  #board { font-size: 0.8rem; }
  #board td, #board th { padding: 5px 6px; }
}
.algo-switch { max-width: 420px; font-size: 1rem; }

/* The Algo page: the algos on the left (a dropdown on phones), the chosen one's details on the right */
.algo-layout { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 20px; align-items: start; }
.algo-list { display: flex; flex-direction: column; gap: 4px; margin-top: 16px; position: sticky; top: 64px; }
.algo-list button { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; text-align: left; background: var(--card);
                    color: var(--fg); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.algo-list button small { color: var(--muted); }
.algo-list button.on { border-color: var(--accent); background: var(--raised); }
.algo-list .state { font-size: 0.75rem; font-weight: 700; color: var(--muted); }
.algo-list .state.live { color: var(--good); }
.algo-pick { display: none; margin-top: 16px; }
@media (max-width: 700px) {
  .algo-layout { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .algo-list { display: none; }
  .algo-pick { display: flex; }
}
