/* limit orders (class prefix od-). Lane orders (docs/LANES.md chapter 7 and the width contract of 3.7).
   Colours only through the tokens of styles.css: no colour literal and no custom property in this file. */

/* ---------- the Limit tab of the trade panel ---------- */
.od-tab { gap: 6px; }
.od-tab.on { border-color: var(--brand); color: var(--brand-hi); }
/* the form takes a row of its own under the panel's row of modes (its box hands its children to that row) */
.od-form { flex: 1 1 100%; min-width: 0; display: grid; gap: 10px; margin-top: 4px; padding: 12px; border: 1px solid var(--line-2); border-radius: var(--radius); background: var(--bg-3); }
.od-form[hidden] { display: none; }
.od-body { display: grid; gap: 10px; min-width: 0; }
.od-sidename { font-size: 13px; overflow-wrap: anywhere; }
.od-amount { position: relative; display: block; }
.od-amount-in, .od-limit-in { min-height: 44px; padding-right: 52px; font-size: 18px; font-weight: 700; }
.od-unit { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); font: 700 12px/1 var(--font-ui); pointer-events: none; }
.od-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.od-chip { flex: 1 1 0; justify-content: center; min-width: 46px; min-height: 30px; cursor: pointer; font: 700 12px/1 var(--font-mono); color: var(--text); }
.od-chip.on { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-hi); }
.od-chip:disabled { opacity: 0.5; cursor: default; }
.od-limit, .od-expiry { display: grid; gap: 6px; min-width: 0; }
.od-k { font-weight: 700; }
.od-bag, .od-fixed, .od-market, .od-get, .od-line, .od-blocked, .od-found { margin: 0; }
.od-market { padding: 8px 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg-2); overflow-wrap: anywhere; }
.od-market.od-wrong { border-color: var(--down); color: var(--down); }
.od-get { font-size: 13.5px; overflow-wrap: anywhere; }
/* the five lines: before the button, always */
.od-lines { display: grid; gap: 6px; margin: 0; padding: 10px 12px 10px 26px; border-radius: 8px; border: 1px solid var(--line); border-left: 3px solid var(--brand); background: var(--bg-2); color: var(--text); font-size: 12.5px; line-height: 1.45; }
.od-blocked { font-weight: 700; color: var(--brand-hi); }
/* the button stays at the bottom of whatever scrolls the form: on a phone that is the trade sheet */
.od-actions { position: sticky; bottom: 0; z-index: 1; display: grid; gap: 6px; padding: 8px 0 2px; background: var(--bg-3); }
.od-go { min-height: 46px; font-size: 15.5px; }
.od-go.btn-primary { box-shadow: var(--glow); }
.od-line { padding: 8px 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg-2); overflow-wrap: anywhere; }
.od-line[hidden] { display: none; }
.od-line-ok { border-color: var(--up); }
.od-line-warn { border-color: var(--warn); }
.od-line-error { border-color: var(--down); }
.od-dry { display: grid; gap: 4px; }
.od-dry:empty { display: none; }
.od-dry-ok { color: var(--up); }
.od-dry-no { color: var(--down); }
.od-dry p { margin: 0; }
.od-rowkv { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; min-width: 0; font-size: 12.5px; }
.od-rowkv .num { min-width: 0; text-align: right; overflow-wrap: anywhere; }

/* ---------- under the position block: what open orders hold ---------- */
.od-locked { margin: 0; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--warn); background: var(--warn-soft); overflow-wrap: anywhere; }

/* ---------- the lists (token page tab, portfolio tab) ---------- */
.od-orders { display: grid; gap: 10px; min-width: 0; padding: 12px; }
.od-head { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.od-count { flex: 1 1 auto; }
/* a lane table sits in a wrapper that scrolls by itself: the page never scrolls sideways */
.od-wrap { overflow-x: auto; min-width: 0; }
.od-list { display: grid; gap: 6px; min-width: 0; }
.od-row { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); align-items: center; gap: 4px 14px; min-width: 0; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg-2); }
.od-row.od-closed { opacity: 0.75; }
.od-l1, .od-l2 { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; min-width: 0; }
.od-l2 { justify-content: flex-end; }
.od-side { font: 700 12px/1 var(--font-ui); }
.od-side-buy { color: var(--up); }
.od-side-sell { color: var(--down); }
.od-amounts { min-width: 0; overflow-wrap: anywhere; }
.od-links { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.od-cancel { min-height: 34px; }
.od-notes { grid-column: 1 / -1; display: grid; gap: 4px; }
.od-notes p { margin: 0; }
.od-flag { padding: 8px 10px; border-radius: 8px; border: 1px solid var(--down); background: var(--down-soft); color: var(--down); font-weight: 700; }
.od-said-ok { color: var(--up); }
.od-said-error { color: var(--down); }
.od-foot { margin: 0; }

/* ---------- under 560 px (docs/LANES.md 3.7) ---------- */
@media (max-width: 559px) {
  /* a row is a two-line card: side, amounts and state on line 1; price, expiry and Cancel on line 2 */
  .od-row { display: block; }
  .od-l2 { margin-top: 8px; justify-content: space-between; }
  .od-notes { margin-top: 8px; }
  .od-cancel { min-height: 44px; }
  .od-form { padding: 10px; }
  .od-orders { padding: 10px; }
}
