.otc-page { background: var(--panel); }

.otc-workspace {
  width: min(calc(100% - 2 * var(--gutter)), var(--app-width));
  max-width: none;
  padding: 36px 0 52px;
}

.otc-heading {
  display: grid;
  grid-template-columns: 1fr minmax(0, auto) 1fr;
  align-items: end;
  gap: 12px;
  margin-bottom: 25px;
}

.otc-heading > div { grid-column: 2; text-align: center; }
.otc-heading > .button { grid-column: 3; justify-self: end; }
.otc-heading h1 { color: var(--accent); }

.otc-heading p {
  margin-top: 6px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

.otc-status { margin: 0; }
.otc-workspace > .otc-status:not([hidden]) { margin-bottom: 14px; }
.otc-auth { display: grid; justify-items: start; gap: 14px; padding: 22px; }

.otc-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 20px;
}

.otc-ticket {
  --otc-ticket-gutter: clamp(20px, 5.4vw, 110px);
  border-radius: 16px;
  box-shadow: 0 5px 24px #3732730b;
}

.otc-section-header {
  padding: 18px 22px;
}

.otc-section-header h2 { color: var(--accent); }
.otc-ticket .otc-section-header {
  padding: 28px var(--otc-ticket-gutter) 19px;
}

.otc-form {
  display: grid;
  gap: 18px;
  padding: 0 var(--otc-ticket-gutter) 32px;
}

.otc-request-options,
.otc-quote-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.otc-request-options { align-items: end; }
.otc-request-options .field select { min-height: 44px; background: var(--tint); }

.otc-balances {
  display: grid;
  gap: 8px;
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.otc-balances h3 { margin: 0; color: var(--accent); font-size: 13px; font-weight: 700; }
.otc-balances dl { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px 22px; }
.otc-balances dl > div { display: grid; grid-template-columns: max-content minmax(0, 1fr); align-items: baseline; gap: 2px 12px; }
.otc-balances dl > div + div { padding-inline-start: 22px; border-inline-start: 1px solid var(--line); }
.otc-balances dt { color: var(--muted); font-size: 12px; }
.otc-balances dd { text-align: right; font-size: 15px; font-weight: 700; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.otc-balances .otc-status { font-size: 12px; }

.otc-form fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
.otc-form legend { padding: 0 0 7px; color: var(--muted); font-size: 13px; font-weight: 650; }
.otc-side-options { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.otc-side-options label { position: relative; cursor: pointer; }
.otc-side-options input { position: absolute; width: 1px; height: 1px; opacity: 0; }

.otc-side-options span {
  display: grid;
  place-items: center;
  min-height: 44px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.otc-side-options input:checked + span { background: #eeedf9; border-color: #cbc8e6; color: var(--accent); }
.otc-side-options input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

.otc-quote-card {
  min-width: 0;
  gap: 11px;
  padding: clamp(14px, 2vw, 25px);
  border-radius: 15px;
  background: var(--tint);
  color: var(--ink);
  font-size: 16px;
  font-weight: 700;
}

.otc-input-unit {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 4px;
  border: 1px solid #dce0ef;
  border-radius: 9px;
  padding-right: 9px;
  background: var(--panel);
}

.otc-input-unit input { min-height: 48px; border: 0; font-size: 17px; font-weight: 600; font-variant-numeric: tabular-nums; }
.otc-input-unit > span { font-size: 11px; color: var(--muted); white-space: nowrap; }
.otc-input-unit:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.otc-input-unit input:focus { outline: none; }

.otc-quote-submit {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  justify-self: end;
  gap: 12px 18px;
  width: min(100%, 540px);
  padding: 15px 17px;
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 2px 12px #3732730a;
}

.otc-quote-submit > .button { min-height: 44px; border-radius: 999px; }

.otc-estimate {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 13px;
}

.otc-estimate strong { color: var(--accent); font-size: clamp(22px, 2.6vw, 31px); line-height: 1.18; overflow-wrap: anywhere; }
.otc-activity { min-width: 0; }

.otc-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 12px;
  padding-inline: 22px;
  border-bottom: 1px solid var(--line);
}

.otc-tabs button {
  min-height: 40px;
  padding: 6px 4px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

.otc-tabs button[aria-selected="true"] { border-bottom-color: var(--accent); color: var(--accent); }
.otc-activity-panel:focus-visible { outline-offset: -3px; }
.otc-empty { padding: 25px 18px; color: var(--muted); font-size: 13px; }
.otc-entry-list { list-style: none; padding: 0; margin: 0; }

.otc-entry {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 9px 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
}

.otc-entry:last-child { border-bottom: 0; }
.otc-entry h3 { margin: 0 0 4px; font-size: 15px; overflow-wrap: anywhere; }
.otc-entry time { color: var(--muted); font-size: 11px; }
.otc-entry[data-side="BUY"] h3 { color: #18743d; }
.otc-entry[data-side="SELL"] h3 { color: #ac354b; }

.otc-entry-state {
  padding: 4px 8px;
  border-radius: 8px;
  background: var(--tint);
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
}

.otc-entry-state[data-state="pending"], .otc-entry-state[data-state="needs_review"] { background: #fff1d0; color: #684d19; }
.otc-entry-state[data-state="approved"], .otc-entry-state[data-state="completed"] { background: #e6f3e7; color: #235b3b; }
.otc-entry-state[data-state="rejected"] { background: #f9ecee; color: #923743; }
.otc-entry-details { grid-column: 1 / -1; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px 12px; }
.otc-entry-details dt { margin-bottom: 3px; color: var(--muted); font-size: 11px; }
.otc-entry-details dd { font-size: 14px; font-weight: 700; overflow-wrap: anywhere; }
.otc-entry-reason { grid-column: 1 / -1; color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.otc-entry-action { grid-column: 1 / -1; justify-self: start; min-height: 33px; padding: 4px 8px; font-size: 12px; }
.otc-workspace strong, .otc-review dd { font-variant-numeric: tabular-nums; }

.otc-review {
  width: min(510px, calc(100% - 24px));
  max-height: calc(100% - 24px);
  padding: 19px;
  border: 1px solid var(--line);
  border-radius: 14px;
  color: var(--ink);
  background: var(--panel);
}

.otc-review::backdrop { background: #1e1a3d80; }
.otc-review .action-list { justify-content: flex-end; }
.otc-review .otc-status { margin-bottom: 12px; }

@media (max-width: 690px) {
  .otc-workspace { padding-top: 21px; }
  .otc-heading { grid-template-columns: minmax(0, 1fr); justify-items: center; margin-bottom: 15px; }
  .otc-heading > div, .otc-heading > .button { grid-column: 1; justify-self: center; }
  .otc-heading p { font-size: 13px; }
  .otc-grid { gap: 12px; }
  .otc-ticket { --otc-ticket-gutter: 13px; }
  .otc-ticket .otc-section-header { padding-block: 17px 13px; }
  .otc-section-header, .otc-entry { padding-inline: 13px; }
  .otc-form { gap: 12px; padding-bottom: 15px; }
  .otc-request-options, .otc-quote-fields { gap: 10px; }
  .otc-quote-card { gap: 8px; padding: 12px; font-size: 14px; }
  .otc-input-unit input { min-height: 43px; font-size: 15px; }
  .otc-tabs { padding-inline: 9px; gap: 2px 8px; }
  .otc-tabs button { font-size: 12px; }
  .otc-review { padding: 13px; }
  .otc-review .confirmation-summary { padding: 10px; gap: 8px 11px; }
  .otc-review .button { padding-inline: 8px; }
}

@media (max-width: 475px) {
  .otc-request-options, .otc-quote-fields, .otc-quote-submit, .otc-balances dl { grid-template-columns: minmax(0, 1fr); }
  .otc-balances dl > div + div { padding-inline-start: 0; border-inline-start: 0; }
  .otc-quote-submit { gap: 10px; padding: 12px; }
}
