

/* 持仓操作：预览行 + 手数比例下拉 + 交易记录快捷按钮 */
.op-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  margin-top: 0.65rem;
}

.op-preview {
  flex: 1 1 360px;
  min-width: 0;
  font-size: 0.8125rem;
  line-height: 1.6;
}

.op-preview .op-preview-item {
  display: inline-block;
  margin-right: 0.9rem;
  white-space: nowrap;
}

.op-preview b {
  color: var(--text-900);
  font-family: var(--mono-font);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.op-preview b.kpi-positive {
  color: var(--ds-up);
}

.op-preview b.kpi-negative {
  color: var(--ds-down);
}

.op-foot-actions {
  display: flex;
  gap: 0.5rem;
  margin-left: auto;
}

.op-lots-ratio {
  flex: 0 0 76px;
  max-width: 76px;
  padding-left: 0.45rem;
  padding-right: 1.35rem;
  font-size: 0.8125rem;
}

.trade-quick {
  white-space: nowrap;
}

.trade-quick .btn-group {
  flex-wrap: nowrap;
}

/* 当前持仓行：保存 + 加/减/清 快捷按钮 */
.position-row-actions {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  white-space: nowrap;
}

.position-row-actions .btn-group {
  flex-wrap: nowrap;
}

.position-row-actions .btn-group .btn {
  padding-left: 0.42rem;
  padding-right: 0.42rem;
}

/* 持仓页：剩余现金即入口，现金调整 / 持仓操作默认收起 */
.positions-collapsible[hidden] {
  display: none !important;
}

.positions-account-item--action {
  position: relative;
  cursor: pointer;
  transition: background-color 0.16s ease;
}

.positions-account-item--action:hover,
.positions-account-item--action:focus-within {
  background: rgba(37, 99, 235, 0.07);
}

.positions-account-item--action.is-open {
  background: rgba(37, 99, 235, 0.11);
}

.positions-account-hit {
  position: absolute;
  inset: 0;
  z-index: 1;
  padding: 0;
  border: 0;
  border-radius: inherit;
  background: transparent;
  cursor: pointer;
}

.positions-account-hit:focus-visible {
  outline: 2px solid #2563eb;
  outline-offset: -2px;
}

.positions-account-caret {
  display: inline-block;
  margin-left: 0.12rem;
  font-size: 0.62rem;
  line-height: 1;
  opacity: 0.6;
  transition: transform 0.16s ease;
}

.positions-account-item--action.is-open .positions-account-caret {
  transform: rotate(180deg);
  opacity: 1;
}

html[data-theme="dark"] .positions-account-item--action:hover,
html[data-theme="dark"] .positions-account-item--action:focus-within {
  background: rgba(96, 165, 250, 0.12);
}

html[data-theme="dark"] .positions-account-item--action.is-open {
  background: rgba(96, 165, 250, 0.18);
}

.form-range-pair {
  display: flex;
  align-items: center;
  gap: 0.38rem;
}

.trade-filter-form {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.45rem 0.5rem;
}

.trade-filter-form > * {
  min-width: 0;
}

.trade-filter-form .form-control,
.trade-filter-form .form-select {
  width: 100%;
}

.form-range-pair .form-control {
  min-width: 0;
  flex: 1 1 0;
}

.form-range-pair__sep {
  color: var(--text-500);
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1;
}

.form-control--compact {
  max-width: 190px;
}

@media (max-width: 991.98px) {
  .form-control--compact {
    max-width: none;
  }
}

.stack-grid {
  display: grid;
  gap: 0.75rem;
}

.surface-accent {
  position: relative;
}

.surface-accent::before {
  content: "";
  position: absolute;
  inset: 0 auto auto 0;
  width: 100%;
  height: 2px;
  background: linear-gradient(90deg, rgba(26, 95, 192, 0.88), rgba(59, 130, 246, 0.32), transparent 72%);
}

.compact-card .card-header {
  padding: 0.44rem 0.62rem;
}

.compact-card .card-body {
  padding: 0.5rem 0.62rem;
}

.app-panel-card {
  border: 1px solid #d7e2f1;
  border-radius: 12px;
  background: #fbfdff;
  box-shadow: 0 6px 18px rgba(19, 46, 84, 0.05);
}

.app-panel-card::before {
  display: none;
}

.app-panel-card .card-header {
  background: #edf3fb;
  border-bottom: 1px solid #d6e2f1;
}

html[data-theme="dark"] .app-panel-card {
  border-color: rgba(123, 151, 186, 0.4);
  background: rgba(14, 24, 38, 0.92);
  box-shadow: 0 10px 24px rgba(2, 10, 24, 0.34);
}

html[data-theme="dark"] .app-panel-card .card-header {
  background: rgba(23, 38, 58, 0.96);
  border-bottom-color: rgba(123, 151, 186, 0.32);
}

.compact-form .row {
  --bs-gutter-x: 0.45rem;
  --bs-gutter-y: 0.42rem;
}

.panel-scroll {
  max-height: 420px;
  overflow: auto;
}

.panel-scroll-sm {
  max-height: 214px;
  overflow: auto;
}

.helper-note,
.form-note,
.empty-state,
.inline-note {
  color: var(--text-500);
  font-size: 0.88rem;
  line-height: 1.42;
}

.app-card,
.card {
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--surface-shadow-soft);
  overflow: hidden;
}

.modal-content {
  color: var(--text-900);
}

.card-header {
  padding: 0.5rem 0.68rem;
  color: var(--text-900);
  font-weight: 700;
  background: linear-gradient(180deg, #fbfdff, #eef5fe);
  border-bottom: 1px solid var(--surface-border);
}

.card-body {
  padding: 0.58rem 0.68rem;
}

.card-subtitle {
  margin: 0.14rem 0 0;
  color: var(--text-500);
  font-size: 0.86rem;
  font-weight: 600;
}

.section-heading {
  margin: 0;
  color: var(--text-900);
  font-size: 0.9rem;
  font-weight: 800;
  line-height: 1.12;
}

.metric-card {
  height: 100%;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(244, 249, 255, 0.9)),
    linear-gradient(120deg, rgba(59, 130, 246, 0.07), transparent 62%);
}

.metric-card .card-body {
  padding-top: 0.74rem;
  padding-bottom: 0.78rem;
}

.metric-card .metric-label {
  color: var(--text-500);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.metric-card .metric-value {
  margin-top: 0.28rem;
  color: var(--text-900);
  font-size: clamp(1.5rem, 1.95vw, 2.15rem);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.02em;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.06);
}

.metric-card .metric-value.metric-value-sm {
  font-size: clamp(1.16rem, 1.45vw, 1.42rem);
}

.metric-card .metric-hint {
  margin-top: 0.22rem;
  color: var(--text-500);
  font-size: 0.8rem;
}

.asset-hero-card .card-body {
  padding: 0.8rem 0.9rem;
}

.asset-hero__value {
  margin-top: 0.38rem;
  color: var(--text-900);
  font-size: clamp(2rem, 3vw, 3rem);
  font-weight: 900;
  line-height: 0.96;
  letter-spacing: -0.04em;
}

.asset-hero__meta {
  margin-top: 0.44rem;
  color: var(--text-700);
  font-size: 0.86rem;
  line-height: 1.42;
}

.kpi-rack {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.65rem;
}

.kpi-mini {
  min-height: 100%;
  padding: 0.7rem 0.8rem;
  border: 1px solid var(--surface-border);
  border-radius: 15px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(245, 249, 255, 0.92)),
    linear-gradient(120deg, rgba(59, 130, 246, 0.08), transparent 66%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.55);
}

.kpi-mini__label {
  color: var(--text-500);
  font-size: 0.78rem;
  font-weight: 700;
}

.kpi-mini__value {
  margin-top: 0.2rem;
  color: var(--text-900);
  font-size: clamp(1.14rem, 1.45vw, 1.48rem);
  font-weight: 800;
  line-height: 1.05;
}

/* 红涨绿跌：盈利/上涨用红色，亏损/下跌用绿色。 */
.kpi-positive {
  color: var(--ds-up);
}

.kpi-negative {
  color: var(--ds-down);
}

.btn {
  min-height: var(--touch-target);
  border-radius: 9px;
  font-weight: 700;
  padding-inline: 10px;
  transition: transform 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease, background-color 0.18s ease, border-color 0.18s ease;
}

.btn-sm {
  min-height: 34px;
  padding-inline: 9px;
}

.btn:hover,
.btn:focus-visible {
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0);
}

.btn-primary {
  border-color: #124ea7;
  background: linear-gradient(180deg, #2873db, #1452ad);
  box-shadow: 0 10px 22px rgba(20, 82, 173, 0.18);
}

.btn-outline-primary {
  color: var(--brand-700);
  border-color: #8fb4e6;
  background: rgba(255, 255, 255, 0.82);
}

.btn-outline-secondary {
  color: var(--text-700);
  border-color: #bfd1e6;
  background: rgba(255, 255, 255, 0.82);
}

.btn-outline-danger,
.btn-danger {
  border-color: #d8685f;
  color: var(--danger-600);
}

.btn-outline-light {
  min-height: 38px;
}

.btn-link {
  min-height: auto;
  padding: 0;
}

.btn[disabled],
.btn.disabled {
  opacity: 0.6;
  transform: none;
  box-shadow: none;
}

.form-control,
.form-select,
textarea.form-control {
  min-height: 38px;
  border-radius: 11px;
  border-color: var(--surface-border-strong);
  color: var(--text-900);
  background-color: rgba(255, 255, 255, 0.96);
}

.form-control::placeholder,
textarea.form-control::placeholder {
  color: #7f97b4;
}

.form-control:focus,
.form-select:focus,
.btn:focus-visible,
.form-check-input:focus,
.nav-link:focus-visible,
.btn-close:focus-visible {
  border-color: #7aa7e4;
  box-shadow: var(--focus-ring);
}

.form-label {
  color: var(--text-700);  font-weight: 700;
  margin-bottom: 0.22rem;
  font-size: 0.8rem;
}

.form-check-input {
  width: 1.1rem;
  height: 1.1rem;
}

.modal-header .btn-close {
  opacity: 0.9;
  padding: 0.48rem;
  margin: 0;
  border-radius: 10px;
}

.toolbar-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 0.75rem;
}

.toolbar-grid > * {
  min-width: 0;
}

.select2-container--default .select2-selection--multiple {
  min-height: var(--touch-target);
  border: 1px solid var(--surface-border-strong);
  border-radius: 12px;
}

.select2-container--default .select2-selection--multiple .select2-selection__choice {
  background: var(--brand-050);
  color: var(--text-900);
  border-color: var(--surface-border);
}

.select2-container--default .select2-selection--multiple .select2-selection__choice__remove {
  color: var(--text-700);
}

.select2-dropdown {
  border-color: var(--surface-border-strong);
  background: var(--surface-strong);
}

.select2-container--default .select2-results__option {
  color: var(--text-900);
}

.select2-container--default .select2-results__option--highlighted.select2-results__option--selectable {
  background: var(--brand-600);
  color: #ffffff;
}

.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: 14px;
  padding: .3rem .8rem !important;
}

.table {
  margin-bottom: 0;
  color: var(--text-900);
}

.table tbody tr {
  transition: background-color 0.16s ease;
}

.table > :not(caption) > * > * {
  vertical-align: middle;
  padding: 0.38rem 0.46rem;
  min-height: 34px;
}

.table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #edf4ff;
  border-bottom: 1px solid #d6e3f5;
  color: var(--text-700);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.table tbody tr:hover {
  background: rgba(59, 130, 246, 0.04);
}

.table tbody tr:hover > * {
  background-color: rgba(59, 130, 246, 0.08) !important;
}

.table a {
  color: var(--brand-700);
  font-weight: 700;
  text-decoration: none;
}

.table a:hover {
  text-decoration: underline;
}

.table-warning {
  --bs-table-bg: rgba(255, 244, 210, 0.72);
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  padding: 0.2rem 0.42rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
}

.badge-soft {
  background: var(--brand-050);
  color: var(--brand-800);
}