/* Svarahi Gold — trading desk (login, buy/sell, pending orders, trades).
   Same ivory / polished-gold tokens as site.css; components here are only
   used by the four trading pages. */

/* ============ SESSION / STATUS STRIP ============ */
.trade-status {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--gold-pale);
  border: 1px solid rgba(169, 105, 0, .4);
  border-radius: 999px;
  padding: 9px 16px;
  margin-bottom: 14px;
  font-size: .8rem;
  font-weight: 700;
  color: var(--muted);
}
.trade-status:empty { display: none; }
.trade-status.is-busy { color: var(--gold-deep); }
.trade-status.is-ok { background: rgba(8, 166, 62, .1); border-color: rgba(8, 166, 62, .45); color: #0a7a35; }
.trade-status.is-warn { background: rgba(223, 168, 29, .16); border-color: rgba(169, 105, 0, .55); color: var(--gold-deep); }
.trade-status.is-error { background: rgba(197, 32, 38, .09); border-color: rgba(197, 32, 38, .45); color: #b0271f; }
.trade-status a { color: var(--gold-deep); font-weight: 800; }

/* ============ FORM FIELDS ============ */
.field { margin-bottom: 14px; }
.field-label {
  display: block;
  color: var(--gold-deep);
  font-size: .74rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  margin-bottom: 6px;
}
.field-label .fa-solid,
.field-label .bi { margin-right: 6px; }

.trade-input,
.trade-select {
  width: 100%;
  min-height: 46px;
  background: var(--input-bg);
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  padding: 11px 14px;
  color: var(--ink);
  font-size: .95rem;
  font-weight: 700;
}
.trade-input:focus,
.trade-select:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: var(--glow-gold);
}
.field-help { margin: 6px 0 0; font-size: .78rem; color: var(--muted); }

/* ============ LOGIN ============ */
.login-page .page-head {
  max-width: 460px;
  margin-inline: auto;
  text-align: center;
}
.login-page .page-head > div { width: 100%; }
.login-card { max-width: 460px; margin: 0 auto; }
.login-step { display: none; }
.login-step.is-active { display: block; }
.otp-input {
  letter-spacing: .5em;
  text-align: center;
  font-size: 1.35rem;
  font-weight: 800;
}
.otp-hint {
  background: var(--gold-pale);
  border: 1px dashed rgba(169, 105, 0, .5);
  border-radius: 14px;
  padding: 10px 14px;
  font-size: .82rem;
  color: #4a3a1f;
  text-align: center;
}
.otp-hint strong { color: var(--gold-deep); letter-spacing: 2px; }

/* ============ BUY / SELL DESK ============ */
.desk-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.desk-product {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.desk-product img {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  object-fit: cover;
  flex-shrink: 0;
  border: 1px solid var(--line-strong);
}
.desk-product strong {
  display: block;
  color: var(--gold-deep);
  font-size: 1rem;
  font-weight: 800;
  line-height: 1.25;
}
.desk-product small { display: block; color: var(--muted); font-size: .76rem; }

/* Segmented Market / Pending switch */
.trade-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 4px;
  background: var(--gold-pale);
  border: 1px solid var(--line);
  border-radius: 999px;
  margin-bottom: 18px;
}
.trade-toggle button {
  min-height: 44px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: .86rem;
  font-weight: 800;
  letter-spacing: .6px;
  text-transform: uppercase;
  cursor: pointer;
  transition: background .2s ease, color .2s ease;
}
.trade-toggle button[aria-selected="true"] {
  background: var(--gold-bar);
  color: #3a2700;
  box-shadow: var(--shadow-soft);
}

/* Bid / Ask quote pair */
.quote-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}
.quote-card {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px 10px;
  text-align: center;
}
.quote-card .k {
  color: var(--muted);
  font-size: .7rem;
  font-weight: 800;
  letter-spacing: 1.4px;
  text-transform: uppercase;
}
.quote-card .v {
  color: var(--gold-deep);
  font-size: clamp(1.25rem, 4.4vw, 1.7rem);
  font-weight: 800;
  line-height: 1.2;
  margin-top: 4px;
  word-break: break-all;
}
.quote-card .v.up { color: var(--green); }
.quote-card .v.down { color: var(--red); }

/* Order value summary */
.order-total {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  background: var(--gold-pale);
  border: 1px solid rgba(169, 105, 0, .4);
  border-radius: 16px;
  padding: 12px 16px;
  margin-bottom: 16px;
}
.order-total .k {
  color: var(--muted);
  font-size: .74rem;
  font-weight: 800;
  letter-spacing: 1.2px;
  text-transform: uppercase;
}
.order-total .v {
  color: var(--gold-deep);
  font-size: 1.2rem;
  font-weight: 800;
}

/* BUY / SELL buttons */
.trade-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.btn-buy,
.btn-sell {
  min-height: 52px;
  border: 0;
  border-radius: 16px;
  color: #fff;
  font-size: .98rem;
  font-weight: 800;
  letter-spacing: 1px;
  text-transform: uppercase;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: transform .2s ease, box-shadow .2s ease, filter .2s ease;
}
.btn-buy { background: linear-gradient(135deg, #06a337, #0fce4f 52%, #068c2c); box-shadow: 0 6px 16px rgba(8, 166, 62, .3); }
.btn-sell { background: linear-gradient(135deg, #b81d22, #e0363c 52%, #a4161a); box-shadow: 0 6px 16px rgba(197, 32, 38, .3); }
.btn-buy:hover,
.btn-sell:hover { transform: translateY(-2px); filter: brightness(1.05); }
.btn-buy:disabled,
.btn-sell:disabled { opacity: .55; cursor: not-allowed; transform: none; filter: none; box-shadow: none; }

.trade-note {
  display: flex;
  gap: 10px;
  margin: 16px 0 0;
  padding: 12px 14px;
  background: var(--panel-2);
  border: 1px dashed var(--line-strong);
  border-radius: 14px;
  color: var(--muted);
  font-size: .8rem;
  line-height: 1.65;
}
.trade-note i { color: var(--gold-deep); flex-shrink: 0; margin-top: 3px; }

/* ============ ORDER / TRADE TABLES ============ */
.order-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.order-table {
  width: 100%;
  min-width: 620px;
  border-collapse: collapse;
  font-size: .86rem;
}
.order-table th {
  padding: 10px 12px;
  text-align: left;
  color: var(--gold-deep);
  font-size: .7rem;
  font-weight: 800;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  border-bottom: 1px solid var(--line-strong);
  white-space: nowrap;
}
.order-table td {
  padding: 12px;
  border-bottom: 1px solid var(--line);
  color: #3a2f17;
  vertical-align: middle;
}
.order-table tbody tr:last-child td { border-bottom: 0; }
.order-table tbody tr:hover { background: var(--gold-pale); }
.order-table .num { text-align: right; font-weight: 800; white-space: nowrap; }
.order-table .product-cell strong { display: block; color: var(--gold-deep); font-weight: 800; }
.order-table .product-cell small { color: var(--muted); font-size: .72rem; }
.order-table .muted-cell { color: var(--muted); font-size: .76rem; white-space: nowrap; }

.side-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-width: 58px;
  justify-content: center;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: .68rem;
  font-weight: 800;
  letter-spacing: .8px;
  text-transform: uppercase;
}
.side-tag.buy { background: rgba(8, 166, 62, .13); color: #0a7a35; }
.side-tag.sell { background: rgba(197, 32, 38, .12); color: #b0271f; }

.state-tag {
  display: inline-block;
  border-radius: 999px;
  padding: 4px 10px;
  background: var(--gold-pale);
  border: 1px solid var(--line-strong);
  color: var(--gold-deep);
  font-size: .68rem;
  font-weight: 800;
  letter-spacing: .6px;
  text-transform: uppercase;
  white-space: nowrap;
}

.row-actions { display: flex; gap: 8px; justify-content: flex-end; }
.btn-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 1px solid var(--line-strong);
  background: var(--panel-2);
  color: var(--gold-deep);
  display: inline-grid;
  place-items: center;
  cursor: pointer;
  transition: background .2s ease, color .2s ease, transform .2s ease;
}
.btn-icon:hover { transform: translateY(-2px); }
.btn-icon.modify:hover { background: var(--gold-bar); color: #3a2700; }
.btn-icon.delete { color: #b0271f; }
.btn-icon.delete:hover { background: linear-gradient(135deg, #b81d22, #e0363c); color: #fff; }
.btn-icon:disabled { opacity: .5; cursor: not-allowed; transform: none; }

.table-summary {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  font-size: .78rem;
  color: var(--muted);
}
.table-summary b { color: var(--gold-deep); }

/* ============ MODIFY ORDER DIALOG ============ */
.order-dialog {
  width: min(440px, calc(100vw - 28px));
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 22px;
  background: linear-gradient(150deg, #fffefb, #fff9e8);
  color: var(--ink);
  box-shadow: var(--shadow);
}
.order-dialog::backdrop { background: rgba(16, 16, 16, .58); }
.order-dialog-form { padding: 22px 22px 18px; }
.order-dialog-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}
.order-dialog-kicker {
  color: var(--muted);
  font-size: .68rem;
  font-weight: 800;
  letter-spacing: 1.4px;
  text-transform: uppercase;
}
.order-dialog-head h3 {
  margin: 4px 0 2px;
  color: var(--gold-deep);
  font-size: 1.1rem;
  font-weight: 800;
}
.order-dialog-head p { margin: 0; color: var(--muted); font-size: .8rem; }
.order-dialog-close {
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: var(--panel-2);
  color: var(--gold-deep);
  cursor: pointer;
}
.order-dialog-close:hover { background: var(--gold-bar); color: #3a2700; }
.order-dialog-actions { display: flex; gap: 10px; margin-top: 16px; }
.order-dialog-actions .btn { flex: 1; }
.order-dialog-actions .btn.primary { flex: 1; }

/* ============ DESK ENTRY CARDS ============ */
.desk-links { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.desk-link {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  border-radius: 18px;
  border: 1px solid var(--line-strong);
  background: var(--panel-2);
  text-decoration: none;
  transition: transform .2s ease, border-color .2s ease, box-shadow .2s ease;
}
.desk-link:hover { transform: translateY(-3px); border-color: var(--gold); box-shadow: var(--shadow-soft); }
.desk-link .glyph {
  width: 46px;
  height: 46px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--gold-gradient);
  color: #3a2700;
  font-size: 1.15rem;
  box-shadow: 0 4px 12px rgba(94, 59, 0, .3);
}
.desk-link strong { display: block; color: var(--gold-deep); font-size: .94rem; font-weight: 800; }
.desk-link small { color: var(--muted); font-size: .78rem; line-height: 1.5; display: block; }

@media (max-width: 575.98px) {
  .trade-input,
  .trade-select { font-size: 1rem; }
  .desk-head { gap: 10px; }
  .quote-pair { gap: 8px; }
  .order-dialog-form { padding: 18px 16px 14px; }
  .trade-actions { grid-template-columns: 1fr; }
}
