/* Universal order modal */
.order-modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.55);
  z-index: 12050;
}
.order-modal[aria-hidden="false"] { display: flex; }
.order-modal-card {
  width: min(440px, 92vw);
  background: var(--surface, #11151b);
  color: var(--text, #e9edf3);
  border: 1px solid var(--line, #2a3241);
  border-radius: 14px;
  box-shadow: 0 22px 70px rgba(0,0,0,0.45);
  overflow: hidden;
}
.order-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  padding: 0.8rem 1rem;
  border-bottom: 1px solid var(--line, #2a3241);
  background: linear-gradient(135deg, rgba(0, 200, 255, 0.18), rgba(17, 21, 27, 0.92));
  font: 700 0.98rem/1.1 "Exo 2", Inter, system-ui, sans-serif;
}
.order-head-left { display: flex; flex-direction: column; gap: 0.2rem; }
.order-head-title { font: 800 1rem/1.1 "Exo 2", Inter, system-ui, sans-serif; }
.order-head-actions { display: flex; align-items: center; gap: 0.5rem; }
.order-head-ltp { font: 600 0.78rem/1 "Inter", system-ui, sans-serif; color: var(--muted, #8891a3); }
.order-head-pct {
  font: 600 0.72rem/1 "Inter", system-ui, sans-serif;
  color: var(--muted, #9aa3b2);
  padding: 0;
  border-radius: 0;
  background: transparent;
}
.order-head-pct.pos { color: #25b37a; }
.order-head-pct.neg { color: #e05858; }
.order-modal-body { padding: 0.95rem 1rem 0.9rem; }
.order-field label {
  display: block;
  font: 600 0.78rem/1 "Inter", system-ui, sans-serif;
  color: var(--muted, #8891a3);
  margin-bottom: 0.35rem;
}
.order-field input,
.order-field select {
  width: 100%;
  padding: 0.5rem 0.65rem;
  border-radius: 10px;
  border: 1px solid var(--line, #2a3241);
  background: var(--surface-2, #141b24);
  color: var(--text, #e9edf3);
  font: 600 0.88rem/1 "Inter", system-ui, sans-serif;
  box-sizing: border-box;
}
.order-modal-foot {
  padding: 0.7rem 0 0;
  border-top: 1px solid var(--line, #2a3241);
}
.order-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.45rem;
}
.order-actions .order-btn.primary { grid-column: span 2; }
.order-btn {
  padding: 0.5rem 0.85rem;
  border-radius: 10px;
  border: 1px solid var(--line, #2a3241);
  background: var(--surface-2, #141b24);
  color: var(--text, #e9edf3);
  font: 600 0.86rem/1 "Inter", system-ui, sans-serif;
  cursor: pointer;
}
.order-btn.primary {
  background: var(--cyan, #00c8ff);
  color: #0b0e11;
  border-color: transparent;
}
.order-btn.danger {
  background: color-mix(in srgb, #f87171 25%, var(--surface-2, #141b24) 75%);
  border-color: color-mix(in srgb, #f87171 45%, var(--line, #2a3241) 55%);
}
.order-btn-inline {
  padding: 0.4rem 0.7rem;
  font-size: 0.8rem;
}
.order-close {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: 1px solid var(--line, #2a3241);
  background: transparent;
  color: var(--text, #e9edf3);
  font-size: 1rem;
  cursor: pointer;
  display: grid;
  place-items: center;
}
.order-hint {
  font-size: 0.76rem;
  color: var(--muted, #8891a3);
  min-height: 0.8rem;
}
.order-quote-band {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 0.6rem;
  align-items: center;
  padding: 0.6rem 0.7rem;
  border-radius: 12px;
  border: 1px solid var(--line, #2a3241);
  background: var(--surface-2, #141b24);
  margin: 0.7rem 0 0.8rem;
}
.order-quote-side { display: flex; flex-direction: column; gap: 0.15rem; align-items: center; }
.order-quote-label { font: 700 0.68rem/1 "Inter", system-ui, sans-serif; color: var(--muted, #8891a3); }
.order-quote-price { font: 800 0.98rem/1 "Exo 2", Inter, system-ui, sans-serif; }
.order-quote-qty { font: 600 0.7rem/1 "Inter", system-ui, sans-serif; color: var(--muted, #8891a3); }
.order-side-toggle { display: grid; gap: 0.35rem; }
.order-side-btn {
  padding: 0.42rem 0.65rem;
  border-radius: 10px;
  border: 1px solid var(--line, #2a3241);
  background: transparent;
  color: var(--text, #e9edf3);
  font: 700 0.72rem/1 "Inter", system-ui, sans-serif;
  cursor: pointer;
  letter-spacing: 0.4px;
}
.order-side-btn.active {
  background: var(--cyan, #00c8ff);
  color: #0b0e11;
  border-color: transparent;
}
.order-radio-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0;
  margin-bottom: 0.6rem;
  font: 700 0.7rem/1 "Inter", system-ui, sans-serif;
  justify-items: stretch;
  align-items: stretch;
  border: 1px solid var(--line, #2a3241);
  border-radius: 10px;
  overflow: hidden;
  background: var(--surface-2, #141b24);
}
.order-radio-row.order-radio-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  max-width: 260px;
  margin-left: auto;
  margin-right: auto;
}
.order-radio-row.order-radio-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  max-width: 220px;
  margin-left: auto;
  margin-right: auto;
}
.order-radio-row.order-radio-4 {
  max-width: 360px;
  margin-left: auto;
  margin-right: auto;
}
@media (max-width: 640px) {
  .order-radio-row.order-radio-4 {
    max-width: 100%;
  }
  .order-radio-row.order-radio-4 .order-radio {
    padding: 0.35rem 0.2rem;
    font-size: 0.66rem;
  }
}
.order-radio {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.45rem 0.35rem;
  border-right: 1px solid var(--line, #2a3241);
  background: transparent;
  text-align: center;
}
.order-radio-row .order-radio:last-child { border-right: none; }
.order-radio input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.order-radio span { font-weight: 700; }
.order-radio.is-active {
  background: color-mix(in srgb, var(--surface-2, #141b24) 70%, var(--cyan, #00c8ff) 30%);
  border-color: transparent;
  color: #e9edf3;
}
.order-radio-compact { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-bottom: 0; }
.order-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.65rem;
  margin-bottom: 0.6rem;
}
.order-stepper {
  display: grid;
  grid-template-columns: 1fr 34px;
  gap: 0.35rem;
  align-items: center;
}
.order-step-col {
  display: grid;
  grid-template-rows: 1fr 1fr;
  gap: 0.3rem;
}
.order-step {
  height: 30px;
  border-radius: 8px;
  border: 1px solid var(--line, #2a3241);
  background: var(--surface-2, #141b24);
  color: var(--text, #e9edf3);
  font: 700 0.9rem/1 "Inter", system-ui, sans-serif;
  cursor: pointer;
}
@media (max-width: 640px) {
  .order-modal-card { width: min(380px, 92vw); }
  .order-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .order-radio-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .order-radio-row.order-radio-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .order-quote-band { grid-template-columns: 1fr auto 1fr; text-align: center; }
  .order-side-toggle { grid-auto-flow: column; justify-content: center; }
  .order-actions { grid-template-columns: 1fr; }
  .order-actions .order-btn.primary { grid-column: auto; }
  .order-stepper { grid-template-columns: 1fr 30px; }
  .order-step { height: 28px; font-size: 0.85rem; }
  .order-field input { padding: 0.45rem 0.55rem; font-size: 0.82rem; }
  .order-radio-row.order-radio-2 { max-width: 50%; }
  .order-radio-row.order-radio-4 .order-radio { padding: 0.32rem 0.15rem; font-size: 0.64rem; }
}

html[data-theme="light"] .order-modal-card {
  background: #ffffff;
  color: #0b0e11;
  border-color: #e3e8ef;
}
html[data-theme="light"] .order-modal-head {
  background: #f5f7fb;
  border-color: #e3e8ef;
}
html[data-theme="light"] .order-radio,
html[data-theme="light"] .order-quote-band,
html[data-theme="light"] .order-step,
html[data-theme="light"] .order-field input,
html[data-theme="light"] .order-field select {
  background: #f4f7fb;
  border-color: #e3e8ef;
  color: #0b0e11;
}
html[data-theme="light"] .order-radio-row {
  border-color: #e3e8ef;
  background: #f4f7fb;
}
html[data-theme="light"] .order-radio-row .order-radio {
  border-right-color: #e3e8ef;
}
html[data-theme="light"] .order-radio.is-active {
  background: #e6f6ff;
  border-color: #9fdcff;
  color: #0b0e11;
}
html[data-theme="light"] .order-side-btn {
  border-color: #e3e8ef;
  color: #0b0e11;
}
html[data-theme="light"] .order-close {
  border-color: #e3e8ef;
  color: #0b0e11;
}
