/*
 * The order ticket.
 *
 * The buttons are oversized on purpose. Everything else on this desk optimises for
 * information density; this one block optimises for hitting the right target without
 * looking at it, because the moment a scalper is clicking BUY their eyes are on the tape.
 */

.ticket {
  display: flex;
  flex-direction: column;
  gap: var(--space-2, 0.5rem);
  height: 100%;
}

.ticket__modes,
.ticket__sizes {
  display: flex;
  gap: var(--space-1, 0.25rem);
}

.chip--on {
  border-color: var(--green);
  color: var(--green);
  box-shadow: 0 0 6px color-mix(in srgb, var(--green) 35%, transparent);
}

.ticket__preview {
  display: flex;
  align-items: baseline;
  gap: var(--space-2, 0.5rem);
  font-variant-numeric: tabular-nums;
  margin: 0;
}

.ticket__price {
  font-size: var(--font-size-lg, 1.125rem);
  font-weight: 700;
  color: var(--ink);
}

.ticket__at {
  color: var(--ink-muted);
}

.ticket__buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-2, 0.5rem);
  flex: 1 1 auto;
  min-height: 3rem;
}

.ticket__go {
  border: 1px solid currentColor;
  background: transparent;
  font: inherit;
  font-weight: 800;
  font-size: var(--font-size-lg, 1.125rem);
  letter-spacing: 0.08em;
  cursor: pointer;
  /* No transition on press: a button that animates is a button that reports the click
     later than it happened, and on this path the feedback is the point. */
  transition: background-color 80ms linear;
}

.ticket__go--buy {
  color: var(--green);
}

.ticket__go--buy:hover {
  background: color-mix(in srgb, var(--green) 18%, transparent);
}

.ticket__go--sell {
  color: var(--orange);
}

.ticket__go--sell:hover {
  background: color-mix(in srgb, var(--orange) 18%, transparent);
}

/*
 * SAFE / ARMED. One toggle for the session rather than a dialog per order — so it has to
 * be unmissable, because it is the entire safety story on the fast path.
 */
.ticket__arm {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink-muted);
  font: inherit;
  font-weight: 700;
  letter-spacing: 0.1em;
  padding-block: var(--space-1, 0.25rem);
  cursor: pointer;
}

.ticket__arm--on {
  border-color: var(--orange);
  color: var(--orange);
  box-shadow: 0 0 10px color-mix(in srgb, var(--orange) 40%, transparent);
}

@media (prefers-reduced-motion: reduce) {
  .ticket__go {
    transition: none;
  }
}

/*
 * A cold desk must be unmistakable. Dimming the buttons is not decoration: the disabled
 * attribute already blocks the click, and this is what stops the trader reaching for it
 * in the first place.
 */
.ticket--safe .ticket__go {
  opacity: 0.4;
  cursor: not-allowed;
}

.ticket--armed .ticket__arm {
  animation: arm-pulse 1.6s ease-in-out infinite;
}

@keyframes arm-pulse {
  0%,
  100% {
    box-shadow: 0 0 6px color-mix(in srgb, var(--orange) 30%, transparent);
  }
  50% {
    box-shadow: 0 0 14px color-mix(in srgb, var(--orange) 60%, transparent);
  }
}

@media (prefers-reduced-motion: reduce) {
  .ticket--armed .ticket__arm {
    animation: none;
  }
}

.ticket__reject {
  margin: 0;
  color: var(--orange);
  font-size: var(--font-size-xs, 0.6875rem);
  letter-spacing: 0.04em;
}

.ticket__shortcuts {
  display: flex;
  align-items: center;
  gap: var(--space-1, 0.25rem);
}

/*
 * The exit. Bordered in orange and never dimmed — arming gates entering risk, and a
 * trader who disarmed in a panic must not then find the way out greyed out.
 */
.ticket__cancel {
  border: 1px solid var(--orange);
  background: transparent;
  color: var(--orange);
  font: inherit;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: var(--space-1, 0.25rem) var(--space-2, 0.5rem);
  cursor: pointer;
}

/*
 * The cheat sheet. Two columns, monospaced chords, and no search box: a list short
 * enough to read is faster than a list you have to query.
 */
.keysheet {
  display: flex;
  flex-direction: column;
  gap: var(--space-1, 0.25rem);
  max-height: 60vh;
  overflow-y: auto;
}

.keysheet__row {
  display: grid;
  grid-template-columns: 6rem 1fr;
  gap: var(--space-2, 0.5rem);
  align-items: baseline;
}

.keysheet__chord {
  font-family: ui-monospace, monospace;
  font-size: var(--font-size-xs, 0.6875rem);
  border: 1px solid var(--line);
  padding: 0 var(--space-1, 0.25rem);
  color: var(--green);
  text-align: center;
}

.keysheet__label {
  color: var(--ink-muted);
}

/*
 * The command palette. Deliberately plain: it is on screen for under two seconds, and
 * anything that animates in is time the trader spends waiting to type.
 */
.palette {
  min-width: min(32rem, 90vw);
}

.palette__input {
  width: 100%;
  background: transparent;
  border: 1px solid var(--line);
  color: var(--ink);
  font: inherit;
  padding: var(--space-1, 0.25rem) var(--space-2, 0.5rem);
}

.palette__input:focus {
  outline: none;
  border-color: var(--green);
}

.palette__rows {
  list-style: none;
  margin: var(--space-2, 0.5rem) 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
}

.palette__row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-2, 0.5rem);
  padding: var(--space-1, 0.25rem) var(--space-2, 0.5rem);
}

.palette__row[aria-selected='true'] {
  background: color-mix(in srgb, var(--orange) 22%, transparent);
}

/* A field that is listening for keys has to look like it: everything typed while it
   glows goes into the binding rather than into the desk. */
.keysheet__chord--recording {
  border-color: var(--orange);
  color: var(--orange);
  box-shadow: 0 0 8px color-mix(in srgb, var(--orange) 45%, transparent);
}

button.keysheet__chord {
  background: transparent;
  cursor: pointer;
  font: inherit;
  font-family: ui-monospace, monospace;
}
