/* OptionEdge Pro - interface styles. Dark desk terminal. */

:root {
  --bg: #0d1117;
  --bg2: #131a23;
  --panel: #161d27;
  --panel2: #1c2530;
  --line: #263141;
  --line2: #33415a;
  --txt: #e5edf7;
  --dim: #8b9bb0;
  --dim2: #64748b;
  --bull: #22c55e;
  --bull-dim: #16a34a;
  --bear: #ef4444;
  --bear-dim: #dc2626;
  --warn: #f59e0b;
  --info: #38bdf8;
  --accent: #6366f1;
  --gold: #eab308;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--txt);
  font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--info); }

/* ---------- header ---------- */
header {
  background: linear-gradient(180deg, #101823 0%, #0d1117 100%);
  border-bottom: 1px solid var(--line);
  padding: 0 20px;
  position: sticky; top: 0; z-index: 50;
}
.hrow { display: flex; align-items: center; gap: 18px; height: 60px; max-width: 1500px; margin: 0 auto; }
.brand { font-weight: 700; font-size: 17px; letter-spacing: .3px; white-space: nowrap; }
.brand span { color: var(--accent); }
.tag { font-size: 11px; color: var(--dim2); font-weight: 400; letter-spacing: .5px; text-transform: uppercase; }

nav { display: flex; gap: 4px; margin-left: 10px; }
nav button {
  background: transparent; border: 1px solid transparent; color: var(--dim);
  padding: 7px 14px; border-radius: 7px; cursor: pointer; font-size: 13px; font-weight: 500;
}
nav button:hover { color: var(--txt); background: var(--panel); }
nav button.on { color: #fff; background: var(--panel2); border-color: var(--line2); }

.spacer { flex: 1; }

/* ---------- controls ---------- */
.ctl { display: flex; gap: 8px; align-items: center; }
input[type=text], select {
  background: var(--panel); border: 1px solid var(--line2); color: var(--txt);
  padding: 8px 11px; border-radius: 7px; font-size: 13px; outline: none;
  font-family: inherit;
}
input[type=text]:focus, select:focus { border-color: var(--accent); }
input[type=text] { width: 130px; text-transform: uppercase; font-family: var(--mono); font-weight: 600; letter-spacing: .5px; }

button.go {
  background: var(--accent); border: none; color: #fff; padding: 9px 18px;
  border-radius: 7px; cursor: pointer; font-weight: 600; font-size: 13px;
}
button.go:hover { filter: brightness(1.12); }
button.go:disabled { opacity: .5; cursor: default; }

button.ghost {
  background: var(--panel); border: 1px solid var(--line2); color: var(--dim);
  padding: 8px 14px; border-radius: 7px; cursor: pointer; font-size: 13px;
}
button.ghost:hover { color: var(--txt); }

/* ---------- layout ---------- */
main { max-width: 1500px; margin: 0 auto; padding: 20px; }
.view { display: none; }
.view.on { display: block; }

.grid { display: grid; gap: 14px; }
.g4 { grid-template-columns: repeat(4, 1fr); }
.g3 { grid-template-columns: repeat(3, 1fr); }
.g2 { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 1150px) { .g4 { grid-template-columns: repeat(2, 1fr); } .g3, .g2 { grid-template-columns: 1fr; } }

.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 11px;
  padding: 16px; margin-bottom: 14px;
}
.card h3 {
  margin: 0 0 12px; font-size: 12px; text-transform: uppercase; letter-spacing: .9px;
  color: var(--dim); font-weight: 600;
}
.card.tight { padding: 13px; }

/* ---------- price header ---------- */
.phead { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; margin-bottom: 4px; }
.sym { font-size: 30px; font-weight: 700; letter-spacing: -.5px; }
.cname { color: var(--dim); font-size: 14px; }
.px { font-size: 26px; font-weight: 600; font-family: var(--mono); }
.chg { font-size: 15px; font-weight: 600; font-family: var(--mono); }
.meta { color: var(--dim2); font-size: 12px; }

/* ---------- verdict banner ---------- */
.verdict {
  border-radius: 11px; padding: 18px 20px; margin-bottom: 16px;
  border: 1px solid var(--line2); background: var(--panel2);
}
.verdict.bull { border-color: rgba(34,197,94,.45); background: linear-gradient(90deg, rgba(34,197,94,.14), rgba(34,197,94,.03)); }
.verdict.bear { border-color: rgba(239,68,68,.45); background: linear-gradient(90deg, rgba(239,68,68,.14), rgba(239,68,68,.03)); }
.verdict.flat { border-color: rgba(148,163,184,.35); background: linear-gradient(90deg, rgba(148,163,184,.10), rgba(148,163,184,.02)); }
.verdict.warn { border-color: rgba(245,158,11,.5); background: linear-gradient(90deg, rgba(245,158,11,.14), rgba(245,158,11,.03)); }
.vtitle { font-size: 21px; font-weight: 700; letter-spacing: -.2px; }
.vaction { font-size: 15px; margin-top: 5px; font-family: var(--mono); }
.vreasons { margin: 12px 0 0; padding-left: 18px; color: var(--dim); font-size: 13px; }
.vreasons li { margin: 5px 0; }

/* ---------- metric tiles ---------- */
.tile { text-align: center; padding: 15px 12px; }
.tval { font-size: 30px; font-weight: 700; font-family: var(--mono); line-height: 1.1; }
.tlab { font-size: 10.5px; text-transform: uppercase; letter-spacing: .9px; color: var(--dim2); margin-top: 7px; font-weight: 600; }
.tband { font-size: 12px; margin-top: 5px; font-weight: 600; }
.tnote { font-size: 11px; color: var(--dim2); margin-top: 5px; line-height: 1.35; }

.bar { height: 5px; background: var(--line); border-radius: 3px; margin-top: 10px; overflow: hidden; }
.bar > div { height: 100%; border-radius: 3px; transition: width .3s; }

/* ---------- text colors ---------- */
.bull { color: var(--bull); }
.bear { color: var(--bear); }
.flat { color: var(--dim); }
.warnc { color: var(--warn); }
.infoc { color: var(--info); }
.goldc { color: var(--gold); }

/* ---------- tables ---------- */
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th {
  text-align: left; color: var(--dim2); font-weight: 600; font-size: 10.5px;
  text-transform: uppercase; letter-spacing: .7px; padding: 8px 9px;
  border-bottom: 1px solid var(--line2); white-space: nowrap;
}
td { padding: 8px 9px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:last-child td { border-bottom: none; }
tbody tr:hover { background: rgba(255,255,255,.022); }
td.num, th.num { text-align: right; font-family: var(--mono); }
td.sym { font-weight: 700; font-family: var(--mono); }
td.sym.clickable { cursor: pointer; color: var(--info); }
td.sym.clickable:hover { text-decoration: underline; }

/* ---------- structures ---------- */
.struct { border: 1px solid var(--line2); border-radius: 10px; padding: 15px; margin-bottom: 13px; background: var(--panel2); }
.struct.best { border-color: rgba(99,102,241,.55); box-shadow: 0 0 0 1px rgba(99,102,241,.18); }
.sh { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; flex-wrap: wrap; }
.sname { font-size: 16px; font-weight: 700; }
.srank { font-size: 10.5px; color: var(--dim2); text-transform: uppercase; letter-spacing: .8px; font-weight: 600; }
.ticket {
  font-family: var(--mono); font-size: 12.5px; background: #0a0e14; border: 1px solid var(--line2);
  padding: 10px 12px; border-radius: 7px; margin: 11px 0; color: var(--gold);
  word-break: break-all; user-select: all; cursor: copy;
}
.ticket:hover { border-color: var(--gold); }
.tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 9px; }
.tagx {
  font-size: 10.5px; padding: 3px 8px; border-radius: 20px; background: var(--line);
  color: var(--dim); text-transform: uppercase; letter-spacing: .5px; font-weight: 600;
}
.tagx.good { background: rgba(34,197,94,.16); color: var(--bull); }
.tagx.bad { background: rgba(239,68,68,.16); color: var(--bear); }
.tagx.warn { background: rgba(245,158,11,.16); color: var(--warn); }

.kv { display: grid; grid-template-columns: repeat(auto-fit, minmax(112px, 1fr)); gap: 11px; margin: 12px 0; }
.kv > div { background: var(--panel); border-radius: 7px; padding: 9px 11px; border: 1px solid var(--line); }
.kvl { font-size: 10px; text-transform: uppercase; letter-spacing: .7px; color: var(--dim2); font-weight: 600; }
.kvv { font-size: 15px; font-weight: 600; font-family: var(--mono); margin-top: 3px; }

.rules { margin: 10px 0 0; padding-left: 17px; font-size: 12.5px; color: var(--dim); }
.rules li { margin: 5px 0; }

/* ---------- factor bars ---------- */
.fac { display: grid; grid-template-columns: 210px 1fr 60px; gap: 11px; align-items: center; margin: 6px 0; font-size: 12.5px; }
.facname { color: var(--dim); }
.facbar { position: relative; height: 17px; background: var(--bg2); border-radius: 4px; overflow: hidden; }
.facbar .mid { position: absolute; left: 50%; top: 0; bottom: 0; width: 1px; background: var(--line2); }
.facbar .fill { position: absolute; top: 3px; bottom: 3px; border-radius: 3px; }
.facval { text-align: right; font-family: var(--mono); font-size: 12px; }
.facdetail { grid-column: 1 / -1; font-size: 11.5px; color: var(--dim2); padding-left: 2px; margin: -2px 0 8px; }

/* ---------- misc ---------- */
.hint { color: var(--dim2); font-size: 12.5px; line-height: 1.55; }
.err {
  background: rgba(239,68,68,.10); border: 1px solid rgba(239,68,68,.4);
  color: #fca5a5; padding: 14px 16px; border-radius: 9px; margin-bottom: 14px; font-size: 13.5px;
}
.notice {
  background: rgba(245,158,11,.09); border: 1px solid rgba(245,158,11,.35);
  color: #fcd34d; padding: 12px 14px; border-radius: 9px; margin-bottom: 14px; font-size: 13px;
}
.loading { text-align: center; padding: 60px 20px; color: var(--dim); }
.spin {
  width: 34px; height: 34px; border: 3px solid var(--line2); border-top-color: var(--accent);
  border-radius: 50%; animation: sp .8s linear infinite; margin: 0 auto 16px;
}
@keyframes sp { to { transform: rotate(360deg); } }

.empty { text-align: center; padding: 70px 20px; color: var(--dim2); }
.empty h2 { color: var(--dim); font-weight: 600; font-size: 19px; }

svg { display: block; max-width: 100%; }
.chartwrap { overflow-x: auto; }

.disclaim {
  margin-top: 26px; padding: 15px 17px; border: 1px solid var(--line);
  border-radius: 9px; color: var(--dim2); font-size: 11.5px; line-height: 1.65; background: var(--bg2);
}
.disclaim b { color: var(--dim); }

.sublist { display: grid; grid-template-columns: repeat(auto-fit, minmax(430px, 1fr)); gap: 14px; }
@media (max-width: 900px) { .sublist { grid-template-columns: 1fr; } }

.pill { display: inline-block; padding: 2px 8px; border-radius: 20px; font-size: 10.5px; font-weight: 700; letter-spacing: .4px; }
.pill.SETUP { background: rgba(99,102,241,.2); color: #a5b4fc; }
.pill.TREND { background: rgba(56,189,248,.18); color: #7dd3fc; }

.scanbar { display: flex; gap: 10px; align-items: center; margin-bottom: 14px; flex-wrap: wrap; }
.legend { display: flex; gap: 16px; font-size: 11.5px; color: var(--dim2); flex-wrap: wrap; margin-top: 8px; }
.legend i { display: inline-block; width: 11px; height: 3px; vertical-align: middle; margin-right: 5px; border-radius: 2px; }

/* ---------- account gate (cloud mode) ---------- */
.gate {
  position: fixed; inset: 0; background: rgba(8,11,16,.94); z-index: 200;
  display: flex; align-items: center; justify-content: center; padding: 20px;
  backdrop-filter: blur(3px);
}
.gate.hide { display: none; }
.gatebox {
  background: var(--panel); border: 1px solid var(--line2); border-radius: 14px;
  padding: 30px; width: 100%; max-width: 430px;
}
.gatebox h2 { margin: 0 0 6px; font-size: 22px; }
.gatebox .sub { color: var(--dim); font-size: 13px; margin-bottom: 20px; line-height: 1.5; }
.gatebox label { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .7px; color: var(--dim2); margin: 13px 0 5px; font-weight: 600; }
.gatebox input {
  width: 100%; background: var(--bg2); border: 1px solid var(--line2); color: var(--txt);
  padding: 11px 13px; border-radius: 8px; font-size: 14px; outline: none; font-family: inherit;
  text-transform: none; letter-spacing: normal; font-weight: 400;
}
.gatebox input:focus { border-color: var(--accent); }
.gatebox button.go { width: 100%; margin-top: 20px; padding: 12px; font-size: 14px; }
.gswitch { text-align: center; margin-top: 16px; font-size: 13px; color: var(--dim); }
.gswitch a { color: var(--info); cursor: pointer; text-decoration: none; }
.gswitch a:hover { text-decoration: underline; }
.gerr { background: rgba(239,68,68,.12); border: 1px solid rgba(239,68,68,.4); color: #fca5a5;
        padding: 10px 12px; border-radius: 8px; font-size: 13px; margin-top: 15px; }
.gok { background: rgba(34,197,94,.10); border: 1px solid rgba(34,197,94,.35); color: #86efac;
       padding: 10px 12px; border-radius: 8px; font-size: 13px; margin-top: 15px; }

.acctbar { display: flex; align-items: center; gap: 10px; font-size: 12.5px; color: var(--dim); }
.acctbar b { color: var(--txt); }
.acctbar .badge {
  padding: 3px 9px; border-radius: 20px; font-size: 10.5px; font-weight: 700;
  background: var(--line); color: var(--dim); letter-spacing: .4px;
}
.acctbar .badge.trial { background: rgba(245,158,11,.18); color: var(--warn); }
.acctbar .badge.active { background: rgba(34,197,94,.18); color: var(--bull); }
.acctbar .badge.expired { background: rgba(239,68,68,.18); color: var(--bear); }

.plan {
  border: 1px solid var(--line2); border-radius: 11px; padding: 20px; margin: 18px 0;
  background: var(--panel2); text-align: center;
}
.plan .price { font-size: 34px; font-weight: 700; }
.plan .price span { font-size: 15px; color: var(--dim); font-weight: 400; }
.plan ul { text-align: left; margin: 16px 0 0; padding-left: 20px; color: var(--dim); font-size: 13px; }
.plan li { margin: 6px 0; }

/* ---------- live market bar ---------- */
.mktbar {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  background: var(--bg2); border-bottom: 1px solid var(--line);
  padding: 7px 20px; font-size: 12.5px;
}
.mktbar .inner { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; max-width: 1500px; margin: 0 auto; width: 100%; }
.mktstate { font-weight: 700; letter-spacing: .4px; padding: 3px 10px; border-radius: 20px; font-size: 11px; }
.mktstate.open { background: rgba(34,197,94,.18); color: var(--bull); }
.mktstate.pre { background: rgba(245,158,11,.18); color: var(--warn); }
.mktstate.post { background: rgba(56,189,248,.18); color: var(--info); }
.mktstate.closed { background: rgba(148,163,184,.15); color: var(--dim); }
.mktclock { color: var(--dim2); font-family: var(--mono); }
.fut { display: flex; gap: 12px; flex-wrap: wrap; }
.fut span { font-family: var(--mono); font-size: 12px; }
.fut b { color: var(--dim2); font-weight: 600; font-family: inherit; }
.mktnote { color: var(--dim); flex: 1; min-width: 220px; }
.livedot {
  display: inline-block; width: 7px; height: 7px; border-radius: 50%;
  background: var(--bull); margin-right: 5px; animation: pulse 2s infinite;
}
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .3; } }

/* ================================================================== */
/* PHONES                                                             */
/*                                                                     */
/* This interface was laid out as a desktop trading terminal: a 1500px */
/* container, a 1400-unit wide price chart and tables running to nine  */
/* columns. On a 390px screen the chart text renders around 3px tall   */
/* and the tables crush into unreadable slivers.                       */
/*                                                                     */
/* The fix is not to shrink everything - it is to decide, per element, */
/* whether it should STACK or SCROLL. Prose, cards and key/value grids */
/* stack. Charts and wide tables keep a usable minimum width and scroll */
/* sideways inside their own box, so the page itself never scrolls     */
/* horizontally. Shrinking a candlestick chart to phone width destroys */
/* the information; letting the trader swipe it does not.              */
/* ================================================================== */
@media (max-width: 820px) {

  main { padding: 12px; }
  .card { padding: 13px; border-radius: 9px; }

  /* ---- header: let it wrap instead of overflowing ---- */
  .hrow { height: auto; flex-wrap: wrap; gap: 10px; padding: 10px 0; }
  .brand { font-size: 16px; }
  .tag { display: none; }
  .spacer { display: none; }

  /* Tabs scroll sideways rather than wrapping into a ragged block. */
  nav {
    order: 3; width: 100%; margin-left: 0;
    overflow-x: auto; -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  nav::-webkit-scrollbar { display: none; }
  nav button { white-space: nowrap; flex: 0 0 auto; }

  .ctl { order: 2; margin-left: auto; }
  input[type=text] { width: 108px; }

  /* ---- market bar ---- */
  .mktbar { padding: 7px 12px; font-size: 11.5px; }
  .mktbar .inner { gap: 8px; }
  .fut { gap: 8px; width: 100%; order: 3; }
  .mktnote { width: 100%; order: 4; }

  /* ---- everything one column ---- */
  .g4, .g3, .g2 { grid-template-columns: 1fr; }
  .sublist { grid-template-columns: 1fr; }

  /* Metric tiles two-up: four stacked tiles is a lot of scrolling. */
  .grid.g4 { grid-template-columns: 1fr 1fr; }
  .tile { padding: 12px 8px; }
  .tval { font-size: 24px; }

  /* ---- price header ---- */
  .phead { gap: 8px; }
  .sym { font-size: 24px; }
  .px { font-size: 21px; }
  .cname { width: 100%; font-size: 12.5px; }

  .vtitle { font-size: 18px; }
  .vaction { font-size: 13.5px; }

  /* ---- wide tables scroll inside their card ---- */
  .card, .struct { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  table { min-width: 460px; }
  th, td { padding: 7px 6px; font-size: 12px; }

  /* ---- charts keep a legible width and scroll ---- */
  .chartwrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .chartwrap svg { min-width: 760px; }
  .struct svg { min-width: 480px; }

  /* ---- factor rows stack: 210px + 60px of fixed columns leaves
          almost nothing for the bar on a phone ---- */
  .fac { grid-template-columns: 1fr 56px; gap: 8px; }
  .fac .facbar { grid-column: 1 / -1; order: 3; }
  .facdetail { font-size: 11px; }

  .kv { grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 8px; }
  .kvv { font-size: 13.5px; }

  .ticket { font-size: 11px; padding: 9px 10px; }

  /* ---- sign-in and subscribe panels ---- */
  .gatebox { padding: 22px 18px; }
  .gatebox h2 { font-size: 19px; }
  .plan .price { font-size: 28px; }

  /* iOS zooms the page in when a focused input is under 16px. */
  input[type=text], input[type=email], input[type=password], select { font-size: 16px; }
}

/* Very narrow phones */
@media (max-width: 400px) {
  .grid.g4 { grid-template-columns: 1fr 1fr; }
  .sym { font-size: 21px; }
  nav button { padding: 6px 10px; font-size: 12.5px; }
}

/* Standalone mode - when launched from the iPhone home screen there is no
 * browser chrome, so pad for the notch and the home indicator. */
@media (display-mode: standalone) {
  header { padding-top: env(safe-area-inset-top); }
  main { padding-bottom: calc(20px + env(safe-area-inset-bottom)); }
}

/* ------------------------------------------------------------------ */
/* Phone header: everything visible, nothing scrolls sideways.        */
/*                                                                     */
/* The first version let the tab strip and the futures row scroll      */
/* horizontally. That is the wrong trade for navigation: a tab you     */
/* cannot see is a tab you will not press, and hidden market data is   */
/* worse than none. Both now fit the width instead.                    */
/* ------------------------------------------------------------------ */
.fshort { display: none; }

@media (max-width: 820px) {

  /* --- tabs: four equal columns, always all visible --- */
  nav {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 4px;
    overflow: visible;          /* was: scroll sideways */
    width: 100%;
    order: 3;
    margin-left: 0;
  }
  nav button {
    padding: 8px 2px;
    font-size: 12px;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;               /* let grid actually shrink them */
  }

  /* --- market bar: two tidy rows, no sideways scroll --- */
  .mktbar { padding: 6px 12px 8px; }
  .mktbar .inner { gap: 6px 10px; }
  .mktstate { order: 1; }
  .mktclock { order: 2; font-size: 11px; }

  .fut {
    order: 3;
    width: 100%;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 4px;
    overflow: visible;          /* was: scroll sideways */
  }
  .fut span { font-size: 11px; text-align: center; white-space: nowrap; }
  .fut b { display: block; font-size: 9.5px; letter-spacing: .3px; }
  .fname { display: none; }     /* "Russell 2000" does not fit */
  .fshort { display: block; }   /* "RUT" does */

  .mktnote { order: 4; width: 100%; font-size: 11px; line-height: 1.35; }

  /* --- top row: brand shrinks so the ticker box always fits --- */
  .hrow { padding: 8px 0 6px; gap: 8px; }
  .brand { font-size: 15px; flex: 0 1 auto; min-width: 0; }
  .ctl { gap: 6px; }
  input[type=text] { width: 92px; padding: 7px 9px; }
  button.go { padding: 8px 12px; font-size: 12.5px; }
}

/* Small phones: the header must still fit at 360px. */
@media (max-width: 400px) {
  nav button { font-size: 11px; padding: 8px 1px; }
  .brand { font-size: 14px; }
  input[type=text] { width: 82px; }
  .fut b { font-size: 9px; }
  .fut span { font-size: 10.5px; }
}

/* ================================================================== */
/* PHONE: nothing scrolls sideways. Anywhere.                         */
/*                                                                     */
/* Earlier passes kept wide tables and the price chart on a horizontal */
/* scroll. That was the wrong call - a swipe people do not perform is  */
/* the same as data they never see. Tables now stack into cards and    */
/* the chart is drawn for the screen instead of squeezed onto it.      */
/* ================================================================== */
@media (max-width: 820px) {

  /* cards no longer need to scroll, because nothing inside is wide */
  .card, .struct { overflow-x: visible; }

  /* --- tables become stacked cards --- */
  table.stackable { min-width: 0; display: block; }
  table.stackable thead { display: none; }
  table.stackable tbody,
  table.stackable tr,
  table.stackable td { display: block; width: 100%; }

  table.stackable tr {
    border: 1px solid var(--line);
    border-radius: 9px;
    margin-bottom: 8px;
    padding: 3px 0;
    background: rgba(255,255,255,.015);
  }
  table.stackable tr:hover { background: rgba(255,255,255,.015); }

  table.stackable td {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    border: none;
    padding: 5px 11px;
    text-align: right;
    font-size: 12.5px;
  }
  table.stackable td::before {
    content: attr(data-label);
    flex: 0 0 auto;
    color: var(--dim2);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: .6px;
    text-transform: uppercase;
    text-align: left;
    font-family: inherit;
  }
  /* the first cell reads as the row's title */
  table.stackable td:first-child {
    font-weight: 700;
    font-size: 13.5px;
    border-bottom: 1px solid var(--line);
    padding-bottom: 7px;
    margin-bottom: 2px;
  }
  table.stackable td:empty { display: none; }
  /* a hint column of prose should not fight for the right-hand edge */
  table.stackable td.hint { text-align: left; flex-direction: column; gap: 3px; }
  table.stackable td.hint::before { text-align: left; }

  /* --- chart is drawn phone-sized now, so no scroll box --- */
  .chartwrap { overflow-x: visible; }
  .chartwrap svg { min-width: 0; width: 100%; }
  .struct svg { min-width: 0; width: 100%; }

  .legend { gap: 10px; font-size: 10.5px; }
}

/* ================================================================== */
/* WRAPPING                                                            */
/*                                                                     */
/* Long unbroken strings - order tickets, monospace figures, contract  */
/* names - will run straight out of their container unless told not    */
/* to. `overflow-wrap: anywhere` is used rather than `word-break:      */
/* break-all` because break-all chops mid-word even when a clean break */
/* was available a character earlier, which reads badly.               */
/* ================================================================== */

/* the trade plan's aligned bracket */
.ticket.bracket {
  color: var(--txt);
  white-space: pre;
  line-height: 1.6;
  overflow-x: auto;
}

/* the trade plan's label/value rows */
.planlabel {
  width: 92px;
  color: var(--dim2);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: .7px;
  font-weight: 600;
  padding-top: 11px;
}
.planv {
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 600;
  overflow-wrap: anywhere;
}
.planvalue .hint { margin-top: 2px; }

/* nothing should be able to push past its box */
.card, .struct, .verdict, .gatebox, .notice, .err, .disclaim { min-width: 0; }
.ticket, .kvv, .hint, .sname, .vaction, .facdetail, .tnote,
td, th, li, p { overflow-wrap: anywhere; }
.ticket { word-break: normal; }

@media (max-width: 820px) {
  /* The bracket is column-aligned monospace - it only reads at full line
   * length. The rows underneath say exactly the same thing and wrap, so on a
   * phone the bracket is dropped rather than shown broken or scrolling. */
  .ticket.bracket { display: none; }

  /* plan rows stack: a 92px label column plus a wrapping value is too tight */
  table.planrows, table.planrows tbody, table.planrows tr, table.planrows td {
    display: block; width: 100%;
  }
  table.planrows tr {
    border: 1px solid var(--line);
    border-radius: 9px;
    margin-bottom: 8px;
    padding: 8px 11px;
    background: rgba(255,255,255,.015);
  }
  table.planrows td { border: none; padding: 0; }
  .planlabel { width: auto; padding-top: 0; margin-bottom: 3px; }
  .planv { font-size: 13.5px; line-height: 1.45; }

  /* order tickets are long; let them wrap and keep them readable */
  .ticket { font-size: 11.5px; line-height: 1.5; white-space: normal; }

  .kv > div { min-width: 0; }
  .kvv { font-size: 13px; overflow-wrap: anywhere; }
  .vaction { font-size: 13px; line-height: 1.45; }
  .sname { font-size: 15px; line-height: 1.35; }
  .rules li, .vreasons li { font-size: 12.5px; line-height: 1.5; }
}
