/* ============================================================
   账户交易 Tab · 样式
   ============================================================ */

.ta-wrapper {
  display: flex;
  width: 100%;
  height: 100%;
  gap: 0;
  position: relative;
}

.ta-main {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  position: relative;
}

/* ── 鉴权遮罩 ── */
.ta-auth-gate {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-base);
}

.ta-auth-gate.hidden { display: none; }

.ta-auth-box {
  text-align: center;
  padding: 32px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  width: 320px;
}

.ta-auth-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 16px;
}

.ta-auth-box input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg-elevated);
  color: var(--text-primary);
  font-size: 14px;
  margin-bottom: 8px;
  box-sizing: border-box;
}

.ta-auth-box input:focus {
  border-color: var(--accent);
  outline: none;
}

.ta-auth-error {
  color: var(--signal-warn);
  font-size: 12px;
  margin-bottom: 8px;
}

.ta-auth-error.hidden { display: none; }

.ta-auth-box button {
  width: 100%;
  padding: 10px;
  border: none;
  border-radius: 4px;
  background: var(--accent);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 4px;
}

.ta-auth-box button:hover { opacity: 0.9; }

/* ── 子Tab ── */
.ta-content { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.ta-content.hidden { display: none; }

.ta-sub-tabs {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-surface);
  flex-shrink: 0;
}

.ta-sub-btn {
  padding: 5px 14px;
  border: none;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.ta-sub-btn:hover { color: var(--text-primary); }
.ta-sub-btn.active { color: var(--accent); border-bottom-color: var(--accent); }

.ta-refresh-btn {
  margin-left: auto;
  padding: 3px 10px;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: transparent;
  color: var(--text-secondary);
  font-size: 11px;
  font-family: var(--font-mono);
  cursor: pointer;
  transition: all 0.15s;
}
.ta-refresh-btn:hover { border-color: var(--accent); color: var(--accent); }

.ta-refresh-hint {
  font-size: 10px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

/* ── 子面板 ── */
.ta-sub-panel {
  display: none;
  flex: 1;
  overflow-y: auto;
  padding: 12px;
}

.ta-sub-panel.active { display: block; }

/* ── 资金卡片 ── */
.ta-balance-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.ta-bal-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 16px;
}

.ta-bal-label {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.ta-bal-value {
  font-size: 24px;
  font-weight: 800;
  font-family: var(--font-mono);
  color: var(--text-primary);
}

/* ── 表格 ── */
.ta-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.ta-table th {
  text-align: left;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 11px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  position: sticky;
  top: 0;
  background: var(--bg-base);
  z-index: 1;
}

.ta-table td {
  padding: 7px 10px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 11px;
  white-space: nowrap;
}

.ta-table tr:hover td { background: var(--bg-hover); }

.ta-empty {
  text-align: center;
  color: var(--text-muted) !important;
  padding: 24px 10px !important;
  font-family: var(--font-ui) !important;
}

.ta-side-buy  { color: var(--signal-high) !important; font-weight: 700; }
.ta-side-sell { color: var(--signal-warn) !important; font-weight: 700; }

.ta-status-filled       { color: var(--signal-high); }
.ta-status-new,
.ta-status-partialfilled { color: var(--signal-mid); }
.ta-status-canceled,
.ta-status-rejected     { color: var(--text-muted); }

.ta-cancel-btn {
  padding: 2px 8px;
  border: 1px solid var(--signal-warn);
  border-radius: 3px;
  background: transparent;
  color: var(--signal-warn);
  font-size: 10px;
  cursor: pointer;
}
.ta-cancel-btn:hover { background: rgba(248,81,73,0.1); }

/* ── 下单栏（右侧） ── */
.ta-order-panel {
  width: 260px;
  padding: 14px;
  border-left: 1px solid var(--border);
  background: var(--bg-base);
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  flex-shrink: 0;
}

.ta-order-panel.hidden { display: none; }

.ta-order-panel h3 {
  margin: 0;
  font-size: 14px;
  color: var(--text-primary);
  font-weight: 700;
}

.ta-order-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.ta-order-field label {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
}

.ta-order-field input,
.ta-order-field select {
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg-elevated);
  color: var(--text-primary);
  font-size: 13px;
  font-family: var(--font-mono);
}

.ta-order-field input:focus,
.ta-order-field select:focus {
  border-color: var(--accent);
  outline: none;
}

/* 买卖切换 */
.ta-side-toggle {
  display: flex;
  gap: 0;
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.ta-side-btn {
  flex: 1;
  padding: 8px;
  border: none;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
  background: var(--bg-elevated);
  color: var(--text-muted);
}

.ta-side-btn.buy.active {
  background: rgba(63,185,80,0.2);
  color: var(--signal-high);
}

.ta-side-btn.sell.active {
  background: rgba(248,81,73,0.2);
  color: var(--signal-warn);
}

.ta-ord-max {
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  cursor: pointer;
}
.ta-ord-max:hover { text-decoration: underline; }

.ta-order-check label {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-size: 12px;
  color: var(--text-secondary);
}

.ta-order-check input[type="checkbox"] {
  accent-color: var(--accent);
}

.ta-order-estimate {
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  min-height: 16px;
}

.ta-order-submit {
  padding: 10px;
  border: none;
  border-radius: 4px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
  background: rgba(63,185,80,0.2);
  color: var(--signal-high);
  border: 1px solid var(--signal-high);
}

.ta-order-submit:hover { background: rgba(63,185,80,0.3); }

.ta-order-submit.sell-mode {
  background: rgba(248,81,73,0.2);
  color: var(--signal-warn);
  border-color: var(--signal-warn);
}

.ta-order-submit.sell-mode:hover { background: rgba(248,81,73,0.3); }

.ta-order-risk {
  font-size: 10px;
  color: var(--signal-warn);
  text-align: center;
  opacity: 0.7;
}

.ta-order-msg {
  font-size: 11px;
  min-height: 16px;
  text-align: center;
  font-family: var(--font-mono);
}

.ta-order-msg.success { color: var(--signal-high); }
.ta-order-msg.error   { color: var(--signal-warn); }

/* ── 确认弹窗 ── */
.ta-confirm-overlay {
  position: absolute;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.6);
}

.ta-confirm-overlay.hidden { display: none; }

.ta-confirm-box {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 24px;
  width: 380px;
  max-width: 90%;
}

.ta-confirm-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 16px;
}

.ta-confirm-details {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.8;
  margin-bottom: 20px;
  font-family: var(--font-mono);
  background: var(--bg-base);
  padding: 12px;
  border-radius: 4px;
}

.ta-confirm-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.ta-confirm-actions button {
  padding: 8px 20px;
  border-radius: 4px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

#ta-confirm-cancel {
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-secondary);
}

.ta-confirm-submit {
  border: none;
  background: var(--signal-high);
  color: #fff;
}

.ta-confirm-submit.sell-mode {
  background: var(--signal-warn);
}

/* ── 响应式 ── */
@media (max-width: 1200px) {
  .ta-order-panel { width: 220px; }
  .ta-balance-cards { grid-template-columns: repeat(2, 1fr); }
}
