/* ==================================================================
   ticket.css — the trade ticket card, app.neurostats.ai.
   Everything is scoped under #ticket-* / .tk-*. The card reuses .demo,
   which keeps the dark instrument well (--well) in BOTH page themes —
   the same convention as the surface, replay, scan and target cards —
   so in-card ink uses the same literal white alphas style.css already
   uses inside .demo; everything else rides the design tokens from
   style.css (--mono, --cyan, --amber, --well, --ease-out).

   Layout intent: on a wide card the ticket reads left-to-right as the
   three questions in order — what it costs, what the odds are, what it
   pays — then the levels, then the picture. On a phone it collapses to
   one column in that same order, so the reading sequence never changes.
   ================================================================== */

/* --------------------------- control bar -------------------------- */

.tk-bar { flex-wrap: wrap; row-gap: 10px; justify-content: flex-start; }

.tk-group { display: inline-flex; align-items: center; gap: 9px; min-width: 0; }

.tk-label {
  font-family: var(--mono);
  font-size: 11px; font-weight: 500;
  letter-spacing: 0.16em; text-transform: uppercase;
  color: rgba(245, 245, 247, 0.42);
  white-space: nowrap;
}

/* segmented control — Call/Put and the level-entry tabs. Mirrors
   #surface-tabs and .replay-windows so the kit reads as one instrument. */
.tk-seg {
  display: inline-flex; gap: 4px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 999px; padding: 4px;
}

.tk-seg-btn {
  appearance: none; border: 0; cursor: pointer;
  background: transparent; color: rgba(245, 245, 247, 0.6);
  font-family: var(--mono); font-size: 12px; font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
  padding: 6px 14px; border-radius: 999px;
  transition: background 0.2s var(--ease-out), color 0.2s var(--ease-out);
}
.tk-seg-btn:hover { color: rgba(245, 245, 247, 0.9); }
.tk-seg-btn[aria-pressed="true"] {
  background: rgba(245, 245, 247, 0.92);
  color: var(--well);
}

/* expiry / valuation-date selects — same chevron trick replay.css uses
   (a data: URI, allowed by the app CSP through img-src data:) */
.tk-select {
  appearance: none; -webkit-appearance: none; cursor: pointer;
  background-color: rgba(255, 255, 255, 0.06);
  color: rgba(245, 245, 247, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  font-family: var(--mono); font-size: 12.5px; font-weight: 600;
  letter-spacing: 0.02em;
  padding: 6px 28px 6px 14px;
  max-width: 100%;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='5'%3E%3Cpath d='M0 0l4 5 4-5z' fill='%23a7a7ad'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  transition: color 0.2s var(--ease-out), border-color 0.2s var(--ease-out);
}
.tk-select:hover { color: rgba(245, 245, 247, 1); border-color: rgba(255, 255, 255, 0.35); }
.tk-select:disabled { opacity: 0.5; cursor: default; }
.tk-select option { background: var(--well); color: rgba(245, 245, 247, 0.9); }

/* strike stepper */
.tk-step {
  display: inline-flex; align-items: center; gap: 2px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 999px; padding: 3px;
}

.tk-step-btn {
  appearance: none; border: 0; cursor: pointer;
  width: 26px; height: 26px;
  border-radius: 50%;
  background: transparent;
  color: rgba(245, 245, 247, 0.75);
  font-family: var(--mono); font-size: 15px; font-weight: 600;
  line-height: 1;
  transition: background 0.18s var(--ease-out), color 0.18s var(--ease-out);
}
.tk-step-btn:hover:not(:disabled) { background: rgba(255, 255, 255, 0.1); color: rgba(245, 245, 247, 1); }
.tk-step-btn:disabled { opacity: 0.28; cursor: default; }

.tk-step-val {
  min-width: 7ch; text-align: center;
  font-family: var(--mono); font-size: 13px; font-weight: 600;
  color: rgba(245, 245, 247, 0.95);
  font-variant-numeric: tabular-nums;
}

/* contracts stepper — a native number input, so the arrow keys, the
   spinner and the mobile numeric keypad all come for free */
.tk-num {
  width: 4.6em;
  background: rgba(255, 255, 255, 0.06);
  color: rgba(245, 245, 247, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  font-family: var(--mono); font-size: 13px; font-weight: 600;
  padding: 6px 10px;
  text-align: center;
  font-variant-numeric: tabular-nums;
  transition: border-color 0.2s var(--ease-out);
}
.tk-num:hover { border-color: rgba(255, 255, 255, 0.35); }

/* ------------------------------ head ------------------------------ */

.tk-head {
  margin: 0;
  padding: 13px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  font-family: var(--mono);
  font-size: clamp(14px, 1.8vw, 18px);
  font-weight: 600;
  letter-spacing: -0.01em;
  color: rgba(245, 245, 247, 0.97);
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}
.tk-head:empty { display: none; }

/* ---------------------------- the blocks -------------------------- */

.tk-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1.15fr);
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.tk-block {
  padding: 15px 18px 17px;
  border-left: 1px solid rgba(255, 255, 255, 0.05);
  min-width: 0;
}
.tk-block:first-child { border-left: 0; }

.tk-block-h {
  margin: 0 0 11px;
  font-family: var(--mono);
  font-size: 10px; font-weight: 600;
  letter-spacing: 0.16em; text-transform: uppercase;
  color: rgba(245, 245, 247, 0.42);
}

/* a definition list, because that is what these rows are: a labelled
   figure each. dt/dd share a row on a grid so the numbers line up. */
.tk-rows {
  display: grid;
  grid-template-columns: minmax(0, auto) minmax(0, 1fr);
  gap: 6px 14px;
  margin: 0;
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
}

.tk-dt {
  margin: 0;
  font-size: 11.5px; font-weight: 500;
  color: rgba(245, 245, 247, 0.46);
  line-height: 1.45;
  /* the label track is auto-sized, so on a narrow card it can be squeezed
     below its own max-content width; without this the longest label clips
     instead of wrapping */
  overflow-wrap: anywhere;
}

.tk-dd {
  margin: 0;
  font-size: 12.5px; font-weight: 500;
  color: rgba(245, 245, 247, 0.88);
  line-height: 1.45;
  text-align: right;
  overflow-wrap: anywhere;
}

/* the one figure per block that answers the block's question */
.tk-dd.tk-big {
  font-size: 17px; font-weight: 600;
  letter-spacing: -0.015em;
  color: rgba(245, 245, 247, 0.97);
}

/* max loss is not a warning colour for drama — it is the single
   certainty on the panel, and it should be the line the eye lands on */
.tk-dd.tk-warn { color: rgba(255, 224, 138, 0.92); font-weight: 600; }

.tk-up { color: rgba(126, 231, 200, 0.95); }
.tk-dn { color: rgba(255, 158, 158, 0.92); }
.tk-muted { color: rgba(245, 245, 247, 0.46); }

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

.tk-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

.tk-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--mono);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.tk-table .tk-cap {
  caption-side: bottom;
  padding-top: 9px;
  text-align: left;
  font-size: 10.5px; line-height: 1.5;
  color: rgba(245, 245, 247, 0.38);
}

.tk-table th, .tk-table td {
  padding: 5px 8px 5px 0;
  text-align: right;
  white-space: nowrap;
}
.tk-table thead th {
  font-size: 9.5px; font-weight: 600;
  letter-spacing: 0.11em; text-transform: uppercase;
  color: rgba(245, 245, 247, 0.38);
  border-bottom: 1px solid rgba(255, 255, 255, 0.09);
  padding-bottom: 7px;
}
.tk-table tbody th {
  text-align: left;
  font-weight: 500;
  color: rgba(245, 245, 247, 0.55);
  padding-right: 14px;
}
.tk-table tbody td { color: rgba(245, 245, 247, 0.88); }
.tk-table thead th:first-child { text-align: left; }
.tk-table tbody tr + tr th, .tk-table tbody tr + tr td {
  border-top: 1px solid rgba(255, 255, 255, 0.04);
}

/* ----------------------------- levels ----------------------------- */

.tk-levels {
  padding: 15px 18px 17px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.tk-lv-bar {
  display: flex; align-items: center; flex-wrap: wrap;
  gap: 10px 18px;
  margin-bottom: 14px;
}
.tk-lv-bar .tk-block-h { margin: 0; }

.tk-lv-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px 22px;
}

.tk-lv { min-width: 0; }

.tk-lv-lbl {
  display: block;
  margin-bottom: 6px;
  font-family: var(--mono);
  font-size: 11px; font-weight: 600;
  letter-spacing: 0.14em; text-transform: uppercase;
  color: rgba(255, 224, 138, 0.78);
}

/* the input carries the amber hairline: these two fields are the only
   place on the panel where the member's OWN number goes in */
.tk-lv-in {
  display: flex; align-items: center;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 209, 102, 0.28);
  border-radius: 10px;
  padding: 0 12px;
  transition: border-color 0.2s var(--ease-out);
}
.tk-lv-in:hover { border-color: rgba(255, 209, 102, 0.5); }
.tk-lv-in:focus-within { border-color: var(--amber); }

.tk-lv-pre {
  font-family: var(--mono); font-size: 13px; font-weight: 600;
  color: rgba(255, 224, 138, 0.7);
  padding-right: 4px;
}

.tk-in {
  flex: 1 1 auto;
  min-width: 0;
  appearance: none;
  background: transparent;
  border: 0;
  color: rgba(245, 245, 247, 0.97);
  font-family: var(--mono); font-size: 14px; font-weight: 600;
  font-variant-numeric: tabular-nums;
  padding: 9px 0;
}
.tk-in::placeholder { color: rgba(245, 245, 247, 0.28); font-weight: 500; }
.tk-in:focus { outline: none; }

.tk-lv-out {
  margin: 7px 0 0;
  font-family: var(--mono);
  font-size: 12px; line-height: 1.55;
  color: rgba(245, 245, 247, 0.62);
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}
.tk-lv-out strong { font-weight: 600; }

/* the IV-constant assumption — deliberately NOT small print. It sits at
   the same weight as the numbers it governs. */
.tk-assume {
  margin: 14px 0 0;
  padding: 9px 12px;
  border-left: 2px solid rgba(255, 209, 102, 0.45);
  background: rgba(255, 209, 102, 0.05);
  border-radius: 0 8px 8px 0;
  font-family: var(--mono);
  font-size: 11.5px; line-height: 1.6;
  color: rgba(245, 245, 247, 0.68);
}
.tk-assume:empty { display: none; }

/* ---------------------------- exit plan --------------------------- */
/* Four parts, stacked in one column at every width: each one is either a
   sentence or a wide table, and neither reads better in a half-width
   column. The tables ride .tk-table / .tk-table-wrap unchanged, so the
   exit plan and the payoff table are visibly the same instrument. */

.tk-exit {
  padding: 15px 18px 17px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.tk-exit-part { margin-top: 18px; }
.tk-exit-part:first-of-type { margin-top: 12px; }

.tk-exit-sub {
  margin: 0 0 8px;
  font-family: var(--mono);
  font-size: 10px; font-weight: 600;
  letter-spacing: 0.14em; text-transform: uppercase;
  color: rgba(245, 245, 247, 0.42);
}

/* the heading bar of part 3 — heading and its segmented control on one
   line, wrapping to two on a phone */
.tk-exit-bar {
  display: flex; align-items: center; flex-wrap: wrap;
  gap: 8px 16px;
  margin-bottom: 9px;
}
.tk-exit-bar .tk-exit-sub { margin: 0; }

.tk-exit-line {
  margin: 0 0 5px;
  font-family: var(--mono);
  font-size: 12.5px; line-height: 1.6;
  color: rgba(245, 245, 247, 0.82);
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}
.tk-exit-line:last-child { margin-bottom: 0; }

/* the two decay crossings: the same amber the member's own levels use on
   the payoff diagram, because these are the dates they act on */
.tk-exit-hot { color: rgba(255, 224, 138, 0.92); font-weight: 600; }

.tk-exit-list {
  list-style: none;
  margin: 0; padding: 0;
  display: grid; gap: 9px;
}

.tk-exit-lvl { font-weight: 600; color: rgba(245, 245, 247, 0.97); }

.tk-exit-list .tk-exit-sub,
.tk-exit-line .tk-exit-sub {
  display: inline;
  margin: 0;
  font-size: 11.5px; font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  color: rgba(245, 245, 247, 0.58);
}

.tk-exit-note {
  margin: 9px 0 0;
  font-family: var(--mono);
  font-size: 11px; line-height: 1.65;
  color: rgba(245, 245, 247, 0.42);
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}
.tk-exit-note:empty { display: none; }

/* the probability column is the one this block may never drop, so it is
   the one column that is never dimmed */
.tk-table td.tk-exit-p { color: rgba(245, 245, 247, 0.97); font-weight: 600; }

/* the row the ticket above is already describing */
.tk-exit-sel th, .tk-exit-sel td { background: rgba(255, 209, 102, 0.07); }
.tk-table tbody tr.tk-exit-sel th { color: rgba(255, 224, 138, 0.92); }

.tk-exit-mark {
  margin-left: 8px;
  font-size: 9.5px; font-weight: 600;
  letter-spacing: 0.11em; text-transform: uppercase;
  color: rgba(255, 224, 138, 0.72);
}

.tk-decay-canvas {
  width: 100%;
  height: 92px;
  display: block;
  margin: 10px 0 0;
  border-radius: 8px;
}

/* same treatment as .tk-assume: the constant-IV assumption sits at the
   weight of the numbers it governs, not in small print under them */
.tk-exit-assume {
  margin: 16px 0 0;
  padding: 9px 12px;
  border-left: 2px solid rgba(255, 209, 102, 0.45);
  background: rgba(255, 209, 102, 0.05);
  border-radius: 0 8px 8px 0;
  font-family: var(--mono);
  font-size: 11.5px; line-height: 1.6;
  color: rgba(245, 245, 247, 0.68);
}
.tk-exit-assume:empty { display: none; }

/* ----------------------------- canvas ----------------------------- */

.tk-canvas {
  width: 100%;
  height: clamp(260px, 34vw, 380px);
  display: block;
}

.tk-legend {
  margin: 0;
  padding: 9px 18px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  font-family: var(--mono);
  font-size: 11px; line-height: 1.6;
  color: rgba(245, 245, 247, 0.42);
}
.tk-legend:empty { display: none; }

/* --------------------------- order line --------------------------- */

.tk-order-wrap {
  display: flex; align-items: flex-start; gap: 14px;
  flex-wrap: wrap;
  padding: 15px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.tk-order {
  flex: 1 1 320px;
  min-width: 0;
  margin: 0;
  padding: 11px 14px;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  font-family: var(--mono);
  font-size: 13px; font-weight: 600;
  letter-spacing: 0.01em;
  line-height: 1.6;
  color: rgba(245, 245, 247, 0.95);
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
  /* a text block the member is meant to select by hand as well as by button */
  -webkit-user-select: text; user-select: text;
}
.tk-order:empty { display: none; }
.tk-order-main, .tk-order-sub { display: block; }
.tk-order-sub {
  margin-top: 4px;
  font-size: 11.5px; font-weight: 500;
  color: rgba(255, 224, 138, 0.85);
}

.tk-btn {
  appearance: none; cursor: pointer;
  flex: 0 0 auto;
  background: transparent; color: rgba(245, 245, 247, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.16);
  font-family: var(--mono); font-size: 12px; font-weight: 500;
  padding: 8px 16px; border-radius: 999px;
  transition: color 0.2s var(--ease-out), border-color 0.2s var(--ease-out);
}
.tk-btn:hover { color: rgba(245, 245, 247, 0.9); border-color: rgba(255, 255, 255, 0.35); }

.tk-order-note {
  flex: 1 1 100%;
  margin: 0;
  font-family: var(--mono);
  font-size: 11px; line-height: 1.6;
  color: rgba(255, 224, 138, 0.7);
}
.tk-order-note:empty { display: none; }

/* ------------------- provenance / status / notice ----------------- */

.tk-prov {
  margin: 0;
  padding: 10px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  font-family: var(--mono);
  font-size: 11px; line-height: 1.65;
  color: rgba(245, 245, 247, 0.4);
  font-variant-numeric: tabular-nums;
}
.tk-prov:empty { display: none; }

/* always visible, never dismissible */
.tk-disclose {
  margin: 0;
  padding: 11px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  font-family: var(--mono);
  font-size: 11.5px; line-height: 1.6;
  color: rgba(245, 245, 247, 0.55);
}

/* mirrors #surface-readout, .replay-verdict and .scan-status so every
   card in the kit ends the same way */
.tk-status {
  margin: 0;
  min-height: 40px;
  padding: 10px 18px;
  font-family: var(--mono);
  font-size: 12.5px; line-height: 1.5;
  color: rgba(245, 245, 247, 0.66);
  font-variant-numeric: tabular-nums;
}

/* -------------------------- focus rings --------------------------- */

.tk-seg-btn:focus, .tk-select:focus, .tk-step-btn:focus,
.tk-num:focus, .tk-btn:focus, .tk-order:focus { outline: none; }
.tk-seg-btn:focus-visible, .tk-select:focus-visible, .tk-step-btn:focus-visible,
.tk-num:focus-visible, .tk-btn:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
}
.tk-lv-in:focus-within { box-shadow: 0 0 0 2px rgba(25, 182, 201, 0.35); }
.tk-order:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
}

/* -------------------------- breakpoints --------------------------- */

/* tablet: the payoff table takes its own full-width row under the two
   figure blocks, which keeps its four columns off a scrollbar */
@media (max-width: 980px) {
  .tk-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .tk-block-wide {
    grid-column: 1 / -1;
    border-left: 0;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
  }
}

/* phone: one column, same reading order — cost, odds, payoff, levels,
   picture, ticket. The control bar scrolls sideways rather than
   wrapping to four rows, the same rule scan.css uses for its chips. */
@media (max-width: 620px) {
  .tk-bar {
    flex-wrap: nowrap;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 12px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
  }
  .tk-bar::-webkit-scrollbar { height: 3px; }
  .tk-bar::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.2); border-radius: 999px; }
  .tk-group { flex: 0 0 auto; }

  .tk-grid { grid-template-columns: minmax(0, 1fr); }
  .tk-block {
    border-left: 0;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    padding: 14px 15px 16px;
  }
  .tk-block:first-child { border-top: 0; }

  /* the desktop track order is kept on purpose: label auto-sized, value
     taking the rest. Reversing it (value at max-content, label at 1fr)
     starves the label — "Contracts" alone clipped at 60px. */
  .tk-levels, .tk-order-wrap, .tk-exit { padding: 14px 15px 16px; }
  .tk-decay-canvas { height: 78px; }
  .tk-head, .tk-legend, .tk-prov, .tk-disclose, .tk-status { padding-left: 15px; padding-right: 15px; }
  .tk-canvas { height: clamp(240px, 58vw, 320px); }
  .tk-btn { width: 100%; text-align: center; }
}

@media (prefers-reduced-motion: reduce) {
  .tk-seg-btn, .tk-select, .tk-step-btn, .tk-num, .tk-btn, .tk-lv-in { transition: none; }
}
