:root {
  --page-bg: #eef4fb;
  --surface: rgba(255, 255, 255, 0.9);
  --surface-strong: #ffffff;
  --surface-muted: #f5f8fc;
  --surface-border: #d7e2f0;
  --surface-border-strong: #c0d0e4;
  --surface-shadow: 0 14px 36px rgba(15, 42, 86, 0.08);
  --surface-shadow-soft: 0 8px 22px rgba(16, 42, 86, 0.05);
  --brand-900: #0f2a56;
  --brand-800: #15396e;
  --brand-700: #1a5fc0;
  --brand-600: #266fd8;
  --brand-500: #3b82f6;
  --brand-050: #edf5ff;
  --success-600: #1f8f57;
  --danger-600: #c33f36;
  --warning-600: #b57207;
  --text-900: #112237;
  --text-700: #35506f;
  --text-500: #5c7797;
  --text-inverse: #f7fbff;
  --focus-ring: 0 0 0 0.28rem rgba(38, 111, 216, 0.18);
  --radius-xl: 20px;
  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 10px;
  --touch-target: 38px;
}

html[data-theme="light"] {
  color-scheme: light;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --page-bg: #09121d;
  --surface: rgba(17, 27, 40, 0.96);
  --surface-strong: #142131;
  --surface-muted: #101c2b;
  --surface-border: rgba(138, 165, 197, 0.34);
  --surface-border-strong: rgba(168, 194, 226, 0.48);
  --surface-shadow: 0 18px 38px rgba(2, 10, 24, 0.46);
  --surface-shadow-soft: 0 10px 24px rgba(2, 10, 24, 0.34);
  --brand-900: #ebf4ff;
  --brand-800: #d8eaff;
  --brand-700: #b9dbff;
  --brand-600: #7bb8ff;
  --brand-500: #3b82f6;
  --brand-050: rgba(76, 145, 255, 0.18);
  --success-600: #8af0ba;
  --danger-600: #ffb0a9;
  --warning-600: #ffd975;
  --text-900: #f5f9ff;
  --text-700: #e1ecf9;
  --text-500: #bfd1e6;
  --text-inverse: #08111e;
  --focus-ring: 0 0 0 0.28rem rgba(96, 165, 250, 0.24);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  color: var(--text-900);
  font-family: "PingFang SC", "SF Pro Text", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: linear-gradient(180deg, #f7f9fd 0%, #eff4fb 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0;
}

.skip-link {
  position: absolute;
  left: 12px;
  top: -48px;
  z-index: 1100;
  padding: 10px 14px;
  border-radius: 999px;
  background: var(--brand-900);
  color: var(--text-inverse);
  text-decoration: none;
}

.skip-link:focus {
  top: 12px;
}

.navbar {
  position: sticky;
  top: 0;
  z-index: 1040;
  backdrop-filter: blur(14px);
  background: linear-gradient(180deg, #f8fbff, #eef4fc) !important;
  border-bottom: 1px solid #d5e1f2;
  box-shadow: 0 4px 14px rgba(22, 52, 96, 0.08);
}

.navbar .container-fluid.app-shell {
  padding-block: 0.28rem;
}

.navbar-brand {
  color: #183354 !important;
  font-weight: 800;
  letter-spacing: 0.4px;
}

.navbar .nav-link {
  min-height: var(--touch-target);
  display: inline-flex;
  align-items: center;
  padding-inline: 14px;
  border-radius: 999px;
  color: #3a577a;
  transition: background-color 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.navbar .nav-link:hover,
.navbar .nav-link:focus-visible {
  background: rgba(59, 130, 246, 0.12);
  color: #24496f;
}

.navbar .nav-link.active {
  background: linear-gradient(180deg, #3f83f2, #2f67d8);
  color: #ffffff;
  font-weight: 700;
  box-shadow: 0 6px 14px rgba(46, 104, 210, 0.28);
}

.navbar .btn,
.navbar .btn-sm {
  min-height: var(--touch-target);
}

.theme-switch {
  display: inline-flex;
  align-items: center;
  padding: 3px;
  border-radius: 999px;
  border: 1px solid #c6d6ec;
  background: #eaf2ff;
  box-shadow: inset 0 1px 0 #ffffff;
}

.btn-theme-toggle {
  min-width: 72px;
  min-height: 36px !important;
  padding-inline: 12px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #4b678a;
  font-weight: 700;
  box-shadow: none;
}

.btn-theme-toggle:hover,
.btn-theme-toggle:focus-visible {
  color: #2f4d73;
  background: rgba(63, 131, 242, 0.14);
}

.btn-theme-toggle.is-active {
  color: #ffffff;
  background: linear-gradient(180deg, #79a8f6, #4f89e8);
  box-shadow: 0 4px 10px rgba(60, 111, 196, 0.26);
}

.navbar-toolbar {
  color: #5f7898;
}

.navbar .btn-outline-light {
  color: #2b4f79;
  border-color: #9eb7d9;
  background: rgba(255, 255, 255, 0.72);
}

.navbar .btn-outline-light:hover {
  color: #173a63;
  border-color: #7d9fcf;
  background: #f4f8ff;
}

.app-main {
  position: relative;
  padding-top: 0.12rem;
  padding-bottom: 0.26rem;
}

.app-shell {
  max-width: 1500px;
}

.page-section + .page-section {
  margin-top: 0.38rem;
}

.page-hero--tight {
  margin-bottom: 0.22rem;
  padding: 0.42rem 0.62rem;
}

.min-vh-75 {
  min-height: 75vh;
}

.page-hero {
  position: relative;
  margin-bottom: 0.42rem;
  padding: 0.58rem 0.74rem;
  border: 1px solid rgba(215, 226, 240, 0.95);
  border-radius: var(--radius-xl);
  background:
    linear-gradient(140deg, rgba(255, 255, 255, 0.98), rgba(242, 248, 255, 0.92)),
    linear-gradient(90deg, rgba(26, 95, 192, 0.08), rgba(59, 130, 246, 0.04));
  box-shadow: var(--surface-shadow);
}

.page-hero::after {
  content: "";
  position: absolute;
  inset: 0 auto auto 0;
  width: 100%;
  height: 2px;
  background: linear-gradient(90deg, rgba(26, 95, 192, 0.95), rgba(59, 130, 246, 0.48), transparent 72%);
}

.page-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  margin-bottom: 0.28rem;
  color: var(--brand-700);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.page-title-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.58rem;
  flex-wrap: wrap;
}

.page-title {
  margin: 0;
  color: var(--text-900);
  font-size: clamp(1.18rem, 1.62vw, 1.62rem);
  font-weight: 800;
  line-height: 1.08;
}

.page-subtitle {
  max-width: 920px;
  margin: 0.22rem 0 0;
  color: var(--text-700);
  font-size: 0.9rem;
  line-height: 1.38;
}

.page-actions,
.section-actions,
.toolbar-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
}

.tool-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.48rem;
  flex-wrap: wrap;
}

.mobile-only {
  display: none !important;
}

.desktop-only {
  display: inline !important;
}

.hero-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.34rem;
  margin-top: 0.32rem;
}

.hero-tag {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0.16rem 0.5rem;
  border: 1px solid rgba(164, 189, 222, 0.6);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.68);
  color: var(--text-700);
  font-size: 0.76rem;
  font-weight: 700;
}

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

.workbench-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.28fr) minmax(320px, 0.94fr);
  gap: 0.75rem;
}

.dashboard-main-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(330px, 0.92fr);
  gap: 0.75rem;
}

.dashboard-hero-grid {
  display: grid;
  grid-template-columns: minmax(340px, 1.1fr) minmax(0, 1.35fr);
  gap: 0.75rem;
}

.summary-strip {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.55rem;
  align-items: stretch;
  overflow-x: auto;
  scrollbar-width: thin;
}

.summary-strip__item {
  min-width: 150px;
  flex: 1 0 150px;
  padding: 0.7rem 0.82rem;
  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);
}

.summary-strip__item--asset {
  min-width: 260px;
  flex-basis: 260px;
  flex-grow: 1.45;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(241, 247, 255, 0.95)),
    linear-gradient(120deg, rgba(59, 130, 246, 0.12), transparent 72%);
}

.summary-strip__label {
  color: var(--text-500);
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.2;
}

.summary-strip__value {
  margin-top: 0.18rem;
  color: var(--text-900);
  font-size: clamp(1.08rem, 1.4vw, 1.42rem);
  font-weight: 400;
  line-height: 1.06;
  white-space: nowrap;
}

.summary-strip__item--asset .summary-strip__value {
  font-size: clamp(1.2rem, 1.7vw, 1.58rem);
  letter-spacing: -0.04em;
}

.positions-account-strip {
  display: grid;
  grid-template-columns: repeat(8, minmax(104px, 1fr));
  overflow-x: auto;
  border: 1px solid var(--surface-border);
  border-radius: 10px;
  background: var(--surface-strong);
  scrollbar-width: thin;
}

.positions-account-item {
  min-width: 104px;
  padding: 0.48rem 0.58rem;
  border-right: 1px solid var(--surface-border);
  white-space: nowrap;
}

.positions-account-item:last-child {
  border-right: 0;
}

.positions-account-label {
  color: var(--text-500);
  font-size: 0.7rem;
  font-weight: 700;
  line-height: 1.2;
}

.positions-account-value {
  margin-top: 0.16rem;
  color: var(--text-900);
  font-family: var(--mono-font);
  font-size: clamp(0.88rem, 0.92vw, 1.02rem);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
  letter-spacing: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.positions-account-sub {
  margin-top: 0.12rem;
  color: var(--text-500);
  font-size: 0.68rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
}

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

.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(--success-600);
}

.kpi-negative {
  color: var(--danger-600);
}

.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);
}

.badge-muted {
  background: rgba(53, 80, 111, 0.12);
  color: var(--text-700);
}

.surface-muted {
  background: var(--surface-muted);
}

.trade-ticket-section {
  background: color-mix(in srgb, var(--surface-strong) 88%, transparent);
}

.status-inline {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--text-500);
  font-size: 0.92rem;
}

.danger-zone {
  border: 1px solid rgba(195, 63, 54, 0.18);
  background: rgba(255, 244, 243, 0.85);
}

.list-compact {
  display: grid;
  gap: 0.35rem;
  margin: 0;
  padding-left: 1rem;
}

.app-toast-stack {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 1100;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  width: min(360px, calc(100vw - 24px));
}

.app-toast {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.65rem;
  padding: 0.9rem 1rem;
  border-radius: 16px;
  border: 1px solid rgba(215, 226, 240, 0.9);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 14px 32px rgba(16, 42, 86, 0.18);
  animation: toast-in 0.18s ease-out;
}

.app-toast__body {
  min-width: 0;
}

.app-toast__title {
  margin: 0 0 0.15rem;
  font-size: 0.92rem;
  font-weight: 800;
}

.app-toast__message {
  margin: 0;
  color: var(--text-700);
  font-size: 0.92rem;
  line-height: 1.45;
}

.app-toast__close {
  min-width: 34px;
  min-height: 34px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--text-500);
  font-size: 1.1rem;
}

.app-toast--success {
  border-color: rgba(31, 143, 87, 0.22);
}

.app-toast--danger {
  border-color: rgba(195, 63, 54, 0.24);
}

.app-toast--warning {
  border-color: rgba(181, 114, 7, 0.24);
}

.app-toast--success .app-toast__title {
  color: var(--success-600);
}

.app-toast--danger .app-toast__title {
  color: var(--danger-600);
}

.app-toast--warning .app-toast__title {
  color: var(--warning-600);
}

.app-toast--info .app-toast__title {
  color: var(--brand-700);
}

.app-confirm__message {
  color: var(--text-700);
  line-height: 1.55;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 991.98px) {
  .page-hero {
    padding: 0.52rem 0.62rem;
  }

  .card-body,
  .card-header {
    padding-inline: 0.62rem;
  }

  .toolbar-grid {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }

  .split-grid,
  .workbench-grid,
  .dashboard-main-grid,
  .dashboard-hero-grid {
    grid-template-columns: 1fr;
  }

}

@media (max-width: 767.98px) {
  body {
    background-size: auto, auto, auto;
  }

  .page-title {
    font-size: 1.14rem;
  }

  .page-actions,
  .section-actions,
  .toolbar-row {
    width: 100%;
  }

  .page-actions .btn,
  .section-actions .btn,
  .toolbar-row .btn {
    flex: 1 1 100%;
    min-height: 36px;
  }

  .toolbar-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .table > :not(caption) > * > * {
    padding: 0.34rem 0.4rem;
  }

  .app-toast-stack {
    left: 12px;
    right: 12px;
    width: auto;
  }
}

@media (orientation: landscape) and (max-width: 991.98px) {
  .chart-stage {
    min-height: 360px;
  }
}

html[data-theme="dark"] body {
  background:
    radial-gradient(1200px 420px at -10% -20%, rgba(29, 78, 216, 0.28) 0%, transparent 58%),
    radial-gradient(920px 340px at 120% -15%, rgba(14, 116, 144, 0.22) 0%, transparent 56%),
    linear-gradient(180deg, #0b1522 0%, var(--page-bg) 100%);
}

html[data-theme="dark"] body::before {
  opacity: 0.16;
}

html[data-theme="dark"] .navbar {
  background: linear-gradient(90deg, rgba(15, 42, 86, 0.96), rgba(24, 77, 156, 0.92)) !important;
  border-bottom-color: rgba(103, 136, 178, 0.34);
  box-shadow: 0 10px 28px rgba(5, 15, 35, 0.38);
}

html[data-theme="dark"] .navbar .nav-link {
  color: rgba(235, 244, 255, 0.84);
}

html[data-theme="dark"] .navbar .nav-link:hover,
html[data-theme="dark"] .navbar .nav-link:focus-visible {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.14);
}

html[data-theme="dark"] .navbar .nav-link.active {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.22);
  box-shadow: none;
}

html[data-theme="dark"] .navbar-toolbar {
  color: #d7e8fb;
}

html[data-theme="dark"] .navbar .btn-outline-light {
  color: #eaf3ff;
  border-color: rgba(197, 220, 247, 0.58);
  background: rgba(255, 255, 255, 0.08);
}

html[data-theme="dark"] .navbar .btn-outline-light:hover {
  color: #ffffff;
  border-color: rgba(216, 234, 255, 0.7);
  background: rgba(255, 255, 255, 0.16);
}

html[data-theme="dark"] .page-hero,
html[data-theme="dark"] .card,
html[data-theme="dark"] .app-toast,
html[data-theme="dark"] .modal-content {
  background: linear-gradient(180deg, rgba(19, 31, 47, 0.99), rgba(13, 22, 33, 0.97));
}

html[data-theme="dark"] .page-hero {
  border-color: rgba(144, 172, 206, 0.26);
}

html[data-theme="dark"] .page-hero::after,
html[data-theme="dark"] .surface-accent::before {
  background: linear-gradient(90deg, rgba(123, 184, 255, 0.92), rgba(90, 160, 255, 0.42), transparent 72%);
}

html[data-theme="dark"] .card-header,
html[data-theme="dark"] .modal-header,
html[data-theme="dark"] .modal-footer {
  background: linear-gradient(180deg, rgba(23, 38, 58, 0.99), rgba(16, 27, 42, 0.99));
  border-color: rgba(138, 165, 197, 0.32);
}

html[data-theme="dark"] .form-control,
html[data-theme="dark"] .form-select,
html[data-theme="dark"] textarea.form-control,
html[data-theme="dark"] .select2-container--default .select2-selection--multiple {
  background: rgba(16, 26, 39, 0.98);
  color: var(--text-900);
  border-color: rgba(144, 172, 206, 0.4);
}

html[data-theme="dark"] .form-control::placeholder,
html[data-theme="dark"] textarea.form-control::placeholder {
  color: #8ea8c8;
}

html[data-theme="dark"] .table-wrap {
  border: 1px solid rgba(117, 145, 177, 0.28);
  background: rgba(10, 18, 29, 0.55);
}

html[data-theme="dark"] .table {
  --bs-table-bg: transparent;
  --bs-table-color: var(--text-900);
  --bs-table-color-state: var(--text-900);
  --bs-table-color-type: var(--text-900);
  --bs-table-striped-bg: rgba(93, 132, 176, 0.1);
  --bs-table-striped-color: var(--text-900);
  --bs-table-hover-bg: rgba(59, 130, 246, 0.14);
  --bs-table-hover-color: var(--text-900);
  --bs-table-active-bg: rgba(88, 155, 238, 0.2);
  --bs-table-active-color: var(--text-900);
  --bs-table-border-color: rgba(117, 145, 177, 0.28);
  color: var(--text-900);
  background-color: rgba(15, 26, 40, 0.62);
}

html[data-theme="dark"] .table .text-dark {
  color: var(--text-900) !important;
}

html[data-theme="dark"] .table > :not(caption) > * > * {
  border-bottom-color: rgba(117, 145, 177, 0.25);
}

html[data-theme="dark"] .table thead th {
  background: rgba(24, 39, 59, 0.98);
  border-bottom-color: rgba(130, 158, 190, 0.44);
  color: var(--text-700);
  box-shadow: inset 0 -1px 0 rgba(130, 158, 190, 0.32);
}

html[data-theme="dark"] .table tbody tr:nth-child(odd) {
  background: rgba(20, 34, 52, 0.34);
}

html[data-theme="dark"] .table tbody tr:nth-child(even) {
  background: rgba(13, 24, 37, 0.22);
}

html[data-theme="dark"] .table tbody tr:hover {
  background: rgba(59, 130, 246, 0.16);
}

html[data-theme="dark"] .table tbody tr:hover > * {
  background-color: rgba(59, 130, 246, 0.22) !important;
}

html[data-theme="dark"] .danger-zone {
  background: rgba(86, 24, 22, 0.32);
}

html[data-theme="dark"] .text-muted,
html[data-theme="dark"] .helper-note,
html[data-theme="dark"] .form-note,
html[data-theme="dark"] .empty-state,
html[data-theme="dark"] .inline-note,
html[data-theme="dark"] .card-subtitle,
html[data-theme="dark"] .status-inline,
html[data-theme="dark"] .metric-card .metric-label,
html[data-theme="dark"] .metric-card .metric-hint {
  color: var(--text-500) !important;
}

html[data-theme="dark"] .page-title,
html[data-theme="dark"] .section-heading,
html[data-theme="dark"] .metric-card .metric-value,
html[data-theme="dark"] .asset-hero__value,
html[data-theme="dark"] .kpi-mini__value,
html[data-theme="dark"] .summary-strip__value,
html[data-theme="dark"] .table,
html[data-theme="dark"] .card-header,
html[data-theme="dark"] .form-label,
html[data-theme="dark"] .navbar-brand,
html[data-theme="dark"] h1,
html[data-theme="dark"] h2,
html[data-theme="dark"] h3,
html[data-theme="dark"] h4,
html[data-theme="dark"] h5,
html[data-theme="dark"] h6 {
  color: var(--text-900) !important;
}

html[data-theme="dark"] .metric-card .metric-value {
  text-shadow: 0 0 0 transparent, 0 2px 10px rgba(0, 0, 0, 0.16);
}

html[data-theme="dark"] .page-subtitle,
html[data-theme="dark"] .asset-hero__meta,
html[data-theme="dark"] .hero-tag,
html[data-theme="dark"] .kpi-mini__label,
html[data-theme="dark"] .summary-strip__label {
  color: var(--text-700) !important;
}

html[data-theme="dark"] .hero-tag {
  border-color: rgba(144, 172, 206, 0.34);
  background: rgba(20, 34, 50, 0.86);
}

html[data-theme="dark"] .metric-card,
html[data-theme="dark"] .kpi-mini,
html[data-theme="dark"] .summary-strip__item {
  background:
    linear-gradient(180deg, rgba(24, 39, 58, 0.98), rgba(15, 26, 40, 0.98)),
    linear-gradient(120deg, rgba(123, 184, 255, 0.08), transparent 68%);
  border-color: rgba(144, 172, 206, 0.28);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

html[data-theme="dark"] .text-success,
html[data-theme="dark"] .kpi-positive {
  color: var(--success-600) !important;
}

html[data-theme="dark"] .text-danger,
html[data-theme="dark"] .kpi-negative {
  color: var(--danger-600) !important;
}

html[data-theme="dark"] .badge-muted {
  background: rgba(173, 198, 228, 0.12);
  color: var(--text-700);
}

html[data-theme="dark"] .badge-soft {
  background: rgba(59, 130, 246, 0.2);
  color: var(--brand-800);
}

html[data-theme="dark"] .badge.text-bg-light,
html[data-theme="dark"] .text-bg-light {
  background: rgba(143, 197, 253, 0.12) !important;
  color: var(--text-900) !important;
  border-color: rgba(144, 172, 206, 0.34) !important;
}

html[data-theme="dark"] .bg-secondary {
  background-color: rgba(117, 145, 177, 0.78) !important;
}

html[data-theme="dark"] .table-light {
  --bs-table-bg: rgba(144, 172, 206, 0.18);
  --bs-table-color: var(--text-900);
  --bs-table-border-color: rgba(144, 172, 206, 0.34);
}

html[data-theme="dark"] .table-warning {
  --bs-table-bg: rgba(176, 126, 45, 0.24);
  --bs-table-color: #ffe6bf;
  --bs-table-border-color: rgba(232, 183, 104, 0.38);
}

html[data-theme="dark"] .btn-primary {
  border-color: #5ea4ff;
  background: linear-gradient(180deg, #3f89f2, #225dba);
}

html[data-theme="dark"] .btn-outline-primary {
  color: #dcecff;
  border-color: rgba(144, 172, 206, 0.44);
  background: rgba(31, 49, 73, 0.85);
}

html[data-theme="dark"] .btn-outline-secondary {
  color: var(--text-700);
  border-color: rgba(144, 172, 206, 0.36);
  background: rgba(28, 42, 61, 0.78);
}

html[data-theme="dark"] .btn-outline-danger {
  color: #ffd0cb;
  border-color: rgba(255, 155, 147, 0.4);
  background: rgba(72, 26, 25, 0.5);
}

html[data-theme="dark"] .btn-outline-light {
  color: var(--text-900);
  border-color: rgba(223, 236, 255, 0.42);
  background: rgba(255, 255, 255, 0.06);
}

html[data-theme="dark"] .btn-outline-light:hover,
html[data-theme="dark"] .btn-outline-light:focus-visible {
  background: rgba(255, 255, 255, 0.14);
  color: #ffffff;
}

html[data-theme="dark"] .navbar .nav-link {
  color: rgba(239, 246, 255, 0.86);
}

html[data-theme="dark"] .navbar .nav-link.active {
  background: rgba(255, 255, 255, 0.18);
}

html[data-theme="dark"] .table a,
html[data-theme="dark"] .page-eyebrow {
  color: var(--brand-700);
}

html[data-theme="dark"] .app-toast {
  border-color: rgba(117, 145, 177, 0.34);
}

html[data-theme="dark"] .app-toast__message,
html[data-theme="dark"] .app-confirm__message {
  color: var(--text-700);
}

html[data-theme="dark"] .theme-switch {
  border-color: rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.07);
}

html[data-theme="dark"] .btn-theme-toggle {
  color: rgba(245, 249, 255, 0.78);
}

html[data-theme="dark"] .btn-theme-toggle.is-active {
  color: #08111e;
  background: linear-gradient(180deg, rgba(245, 249, 255, 0.92), rgba(221, 234, 255, 0.84));
}

html[data-theme="dark"] .btn-close {
  filter: invert(1) grayscale(1) brightness(1.25);
  opacity: 1;
}

html[data-theme="dark"] .nav-tabs {
  border-bottom-color: rgba(117, 145, 177, 0.3);
}

html[data-theme="dark"] .nav-tabs .nav-link {
  color: var(--text-500);
  border-color: transparent;
}

html[data-theme="dark"] .nav-tabs .nav-link.active {
  color: var(--text-900);
  background: rgba(20, 32, 48, 0.95);
  border-color: rgba(117, 145, 177, 0.3) rgba(117, 145, 177, 0.3) transparent;
}

html[data-theme="dark"] .trade-ticket-section {
  background: rgba(22, 34, 51, 0.9);
  border-color: rgba(117, 145, 177, 0.32) !important;
}

html[data-theme="dark"] .select2-dropdown,
html[data-theme="dark"] .select2-container--default .select2-search--dropdown .select2-search__field {
  background: rgba(16, 26, 39, 0.98);
  color: var(--text-900);
  border-color: rgba(144, 172, 206, 0.4);
}

html[data-theme="dark"] .select2-container--default .select2-selection--multiple .select2-selection__choice {
  background: rgba(59, 130, 246, 0.2);
  color: var(--text-900);
  border-color: rgba(144, 172, 206, 0.36);
}

html[data-theme="dark"] .select2-container--default .select2-selection--multiple .select2-selection__choice__remove {
  color: var(--text-700);
}

html[data-theme="dark"] canvas {
  filter: saturate(0.94) brightness(0.92);
}

.strategy-total-input,.holding-lots-input {
    min-height: 26px;
}

/* 2026-04 redesign layer */
.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  margin-right: 8px;
  background: linear-gradient(180deg, rgba(106, 170, 255, 0.85), rgba(52, 114, 211, 0.95));
  color: #f6fbff;
  font-size: 16px;
  font-weight: 800;
}

.brand-title {
  display: block;
  line-height: 1;
}

.brand-subtitle {
  display: block;
  margin-top: 2px;
  color: rgba(231, 241, 255, 0.78);
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.desktop-meta {
  color: #6d84a3;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  font-weight: 700;
}

.page-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 28px;
  padding: 0 9px;
  margin-right: 8px;
  border-radius: 8px;
  background: linear-gradient(180deg, #3d84ff, #2f67d8);
  color: #ffffff;
  font-size: 0.92rem;
  font-weight: 800;
  box-shadow: 0 6px 14px rgba(31, 92, 189, 0.28);
}

.metric-tile-grid {
  display: grid;
  gap: 0.6rem;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.metric-tile {
  border: 1px solid var(--surface-border);
  border-radius: 12px;
  padding: 0.62rem 0.72rem;
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.96), rgba(246, 251, 255, 0.94));
}

.metric-tile__label {
  font-size: 0.76rem;
  color: var(--text-500);
  font-weight: 700;
}

.metric-tile__value {
  margin-top: 0.2rem;
  color: var(--text-900);
  font-size: 1.58rem;
  line-height: 1;
  font-weight: 800;
}

.metric-tile__sub {
  margin-top: 0.2rem;
  font-size: 0.72rem;
  color: var(--text-500);
}

.dashboard-shell-card {
  overflow: visible;
}

.dashboard-bottom-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr);
  gap: 0.75rem;
}

.users-filter-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr auto;
  gap: 0.5rem;
  align-items: end;
}

.mobile-tabbar {
  display: none;
}

@media (max-width: 991.98px) {
  .navbar {
    position: sticky;
    top: 0;
  }

  .navbar-brand .brand-subtitle,
  .desktop-meta {
    display: none;
  }

  html,
  body {
    scroll-padding-bottom: calc(82px + env(safe-area-inset-bottom));
  }

  .app-main {
    padding-bottom: calc(82px + env(safe-area-inset-bottom)) !important;
  }

  .mobile-tabbar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1080;
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(0, 1fr);
    grid-template-columns: none;
    border-top: 1px solid #d9e2f2;
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(18px);
    padding: 6px 4px calc(8px + env(safe-area-inset-bottom));
    box-shadow: 0 -6px 18px rgba(11, 32, 68, 0.08);
  }

  .mobile-tabbar__item {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    min-height: 50px;
    min-width: 0;
    padding: 2px 2px;
    text-decoration: none;
    color: #7b879e;
    border-radius: 0;
    position: relative;
  }

  .mobile-tabbar__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    color: currentColor;
  }

  .mobile-tabbar__icon svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
    fill: none;
    stroke-width: 1.9;
    stroke-linecap: round;
    stroke-linejoin: round;
    line-height: 1;
  }

  .mobile-tabbar__label {
    font-size: 0.62rem;
    font-weight: 600;
    line-height: 1.15;
    text-align: center;
    white-space: nowrap;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .mobile-tabbar__item.active {
    color: #2f6bff;
    background: transparent;
  }

  .mobile-tabbar__item.active::before {
    display: none;
  }

  .metric-tile-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-bottom-grid {
    grid-template-columns: 1fr;
  }

  .users-filter-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 767.98px) {
  .page-hero {
    padding: 0.48rem 0.54rem;
  }

  .page-hero--tight {
    padding: 0.42rem 0.52rem;
  }

  .summary-strip__item--asset {
    min-width: 210px;
    flex-basis: 210px;
  }

  .metric-tile__value {
    font-size: 1.32rem;
  }

  .users-filter-grid {
    grid-template-columns: 1fr;
  }
}

html[data-theme="dark"] .brand-subtitle {
  color: rgba(210, 229, 251, 0.72);
}

html[data-theme="dark"] .desktop-meta {
  color: rgba(207, 227, 250, 0.82);
}

html[data-theme="dark"] .page-number {
  background: linear-gradient(180deg, #5a9eff, #3b7ef0);
}

html[data-theme="dark"] .metric-tile {
  background: linear-gradient(160deg, rgba(24, 38, 57, 0.96), rgba(17, 29, 45, 0.96));
  border-color: rgba(142, 170, 204, 0.3);
}

html[data-theme="dark"] .mobile-tabbar {
  border-top-color: #17304b;
  background: rgba(12, 24, 41, 0.94);
  box-shadow: 0 -8px 22px rgba(2, 8, 18, 0.42);
}

html[data-theme="dark"] .mobile-tabbar__item {
  color: #7f96b5;
}

html[data-theme="dark"] .mobile-tabbar__item.active {
  color: #60a5fa;
}

/* Dashboard pixel alignment */
.dashboard-title-strip {
  margin-bottom: 0.12rem;
  padding: 0.08rem 0.06rem 0.02rem;
}

.dashboard-title-strip .page-title {
  display: inline-flex;
  align-items: center;
  gap: 0.46rem;
  font-size: clamp(2rem, 2.45vw, 2.45rem);
  line-height: 1.02;
  letter-spacing: -0.01em;
}

.dashboard-shell-card {
  border-radius: 14px;
  border-color: #cad8eb;
  background: linear-gradient(180deg, #f8fbff, #f2f7ff);
  box-shadow: 0 8px 24px rgba(25, 56, 105, 0.07);
}

.dashboard-shell-card .card-header {
  padding: 0.42rem 0.62rem;
  background: linear-gradient(180deg, #f6f9ff, #edf4ff);
  border-bottom-color: #cddbef;
}

.dashboard-shell-card .tool-header {
  align-items: center;
}

.dashboard-overview-title {
  display: inline-flex;
  align-items: center;
  gap: 0.62rem;
}

.dashboard-shell-card .section-heading {
  font-size: 1rem;
  line-height: 1.1;
}

.dashboard-updated-at {
  color: #5f7898;
  font-size: 0.97rem;
  font-weight: 700;
  line-height: 1;
}

.dashboard-shell-card .card-body {
  padding: 0.58rem 0.62rem;
}

.dashboard-shell-card .summary-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.52rem;
  overflow: visible;
}

.dashboard-shell-card .summary-strip__item,
.dashboard-shell-card .summary-strip__item--asset {
  min-width: 0;
  flex: none;
  border-radius: 13px;
  border-color: #ccdbef;
  background: #ffffff;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.9) inset;
}

.dashboard-shell-card .summary-strip__item {
  padding: 0.58rem 0.68rem;
  min-height: 94px;
}

.dashboard-shell-card .summary-strip__item--asset {
  padding: 0.64rem 0.72rem;
  min-height: 94px;
}

.dashboard-shell-card .summary-strip__item--asset-with-nav {
  display: none;
}

.dashboard-shell-card .summary-strip__label {
  color: #607b9d;
  font-size: 0.82rem;
  font-weight: 700;
}

.dashboard-shell-card .summary-strip__value {
  margin-top: 0.22rem;
  font-size: clamp(.62rem, 1.92vw, 1.38rem);
  line-height: 1.2;
  letter-spacing: -0.015em;
}

.dashboard-shell-card .summary-strip__item--asset .summary-strip__value {
  font-family: "SF Pro Display", "DIN Alternate", "PingFang SC", "Segoe UI", sans-serif;
  font-size: clamp(2.3rem, 2.95vw, 3rem);
  line-height: 1.2;
  letter-spacing: -0.03em;
  font-weight: 400;
}

.dashboard-shell-card .summary-strip__item--asset .summary-strip__value--asset-compact {
  font-size: clamp(1.78rem, 2.2vw, 2.2rem);
  letter-spacing: -0.02em;
  font-weight: 500;
}

.dashboard-shell-card .metric-tile__sub {
  margin-top: 0.22rem;
  font-size: 0.8rem;
  color: #6c86a7;
  font-weight: 700;
  line-height: 1.2;
}

.summary-strip__cash-line {
  margin-top: 0.16rem;
  font-size: 0.78rem;
  font-weight: 700;
  color: #3f628e;
}

.summary-strip__returns-line {
  display: inline-flex;
  align-items: center;
  gap: 0.18rem;
  font-size: 0.95rem;
  line-height: 1.15;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}

.summary-strip__returns-sep {
  color: #8aa1be;
}

.summary-strip__returns-title {
  margin-top: 0.24rem;
}

.summary-strip__asset-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.86rem;
  align-items: start;
}

.summary-strip__asset-right {
  text-align: right;
}

.summary-strip__asset-right .summary-strip__label {
  text-align: right;
}

.summary-strip__asset-right .summary-strip__value {
  margin-top: 0.16rem;
  font-size: clamp(1.26rem, 1.58vw, 1.62rem);
  line-height: 1.06;
  letter-spacing: -0.02em;
  font-weight: 500;
}

.summary-strip__nav-returns {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.2rem;
  margin-top: 0.18rem;
  white-space: nowrap;
}

.summary-strip__nav-item {
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1;
}

.summary-strip__nav-sep {
  color: #7f97b6;
  font-size: 0.74rem;
  line-height: 1;
}

.dashboard-shell-card .table-wrap {
  border-radius: 12px;
  border: 1px solid #d6e2f3;
  background: #ffffff;
  padding: 0.2rem 0.5rem !important;
}

.dashboard-shell-card .table > :not(caption) > * > * {
  padding: 0.42rem 0.5rem;
}

.dashboard-shell-card .table thead th {
  background: #ebf2fb;
  border-bottom-color: #d4e1f2;
  color: #4f6d92;
  font-size: 0.8rem;
}

.dashboard-shell-card .table tbody tr:hover {
  background: rgba(59, 130, 246, 0.05);
}

.dashboard-shell-card .panel-scroll {
  max-height: 306px;
}

.dashboard-shell-card .panel-scroll-sm {
  max-height: 306px;
}

.dashboard-panel-card {
  border: 1px solid #d7e2f1;
  border-radius: 12px;
  background: #fbfdff;
  box-shadow: none;
}

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

.dashboard-panel-card .card-header {
  padding: 0.42rem 0.58rem;
  background: #edf3fb;
  border-bottom: 1px solid #d6e2f1;
  min-height: 46px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.dashboard-panel-card .section-heading {
  color: #1f3e64;
  font-size: 0.94rem;
  font-weight: 800;
}

.dashboard-panel-card .card-subtitle {
  color: #5f7b9e;
  font-size: 0.82rem;
  font-weight: 700;
}

.dashboard-panel-card .card-body {
  padding: 0.44rem 0.52rem;
}

.dashboard-panel-card .tool-header {
  align-items: center;
}

.dashboard-action-link {
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
  border: 0;
  background: transparent;
  padding: 0;
  margin: 0;
  min-height: 0;
  color: #49698f;
  font-size: 0.88rem;
  line-height: 1;
  font-weight: 700;
  text-decoration: none;
  box-shadow: none;
}

.dashboard-action-link svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.dashboard-action-link:hover,
.dashboard-action-link:focus-visible {
  color: #2a5d98;
  background: transparent;
  transform: none;
}

.dashboard-action-link:disabled {
  opacity: 0.62;
}

.dashboard-panel-card .table-wrap {
  border: 1px solid #dde7f4;
  border-radius: 10px;
  background: #ffffff;
  padding: 0.16rem 0.38rem !important;
}

.holdings-table-desktop {
  display: block;
}

.holdings-table-mobile {
  display: none;
}

.dashboard-panel-card .table thead th {
  background: #ebf2fb;
  border-bottom-color: #d7e3f2;
  color: #4f6d92;
}

.dashboard-panel-card .table > :not(caption) > * > * {
  padding: 0.4rem 0.46rem;
}

table[data-table-id="backtestJobs"] th[data-col-key="type"],
table[data-table-id="backtestJobs"] td[data-mobile-col="type"] {
  width: 7.5rem;
  max-width: 7.5rem;
}

.job-type-label {
  display: inline-block;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: bottom;
}

.dashboard-bottom-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.62rem;
}

@media (max-width: 767.98px) {
  .dashboard-title-strip {
    padding: 0.02rem 0.02rem 0;
  }

  .dashboard-shell-header {
    display: none !important;
  }

  .desktop-only {
    display: none !important;
  }

  .mobile-only {
    display: inline !important;
  }

  .dashboard-refresh-action {
    display: none !important;
  }

  .dashboard-shell-card > .card-header,
  .dashboard-panel-card > .card-header,
  .app-panel-card > .card-header {
    background: transparent !important;
    border-bottom: 0 !important;
    padding: 0.52rem 0.56rem 0.28rem;
  }

  .dashboard-shell-card .card-body,
  .dashboard-panel-card .card-body {
    padding-top: 0.36rem;
  }

  .dashboard-overview-title {
    gap: 0.48rem;
  }

  .dashboard-shell-card .section-heading {
    font-size: 1rem;
    line-height: 1.2;
  }

  .dashboard-updated-at {
    font-size: 0.84rem;
    line-height: 1.15;
  }

  .dashboard-shell-card .summary-strip {
    grid-template-columns: minmax(0, 1fr);
    gap: 0.5rem;
  }

  .summary-strip__item--asset-desktop,
  .summary-strip__item--perf-week,
  .summary-strip__item--perf-combined,
  .summary-strip__item--nav-desktop {
    display: none;
  }

  .dashboard-shell-card .summary-strip__item--asset-with-nav {
    display: block;
    grid-column: 1 / -1;
  }

  .dashboard-shell-card .summary-strip__item {
    min-height: 84px;
    padding: 0.56rem 0.58rem;
    border-radius: 10px;
  }

  .dashboard-shell-card .summary-strip__item--asset {
    min-height: 92px;
    padding: 0.62rem 0.62rem;
  }

  .summary-strip__asset-layout {
    gap: 0.56rem;
  }

  .dashboard-shell-card .summary-strip__label {
    font-size: 0.72rem;
    line-height: 1.2;
  }

  .dashboard-shell-card .summary-strip__value {
    margin-top: 0.16rem;
    font-size: 1.38rem;
    line-height: 1.15;
    font-variant-numeric: tabular-nums;
  }

  .dashboard-shell-card .summary-strip__item--asset .summary-strip__value {
    font-size: 1.94rem;
    line-height: 1.05;
    letter-spacing: -0.02em;
  }

  .dashboard-shell-card .summary-strip__item--asset .summary-strip__value--asset-compact {
    font-size: 1.66rem;
  }

  .summary-strip__cash-line {
    margin-top: 0.14rem;
    font-size: 0.68rem;
  }

  .summary-strip__asset-right .summary-strip__label {
    font-size: 0.68rem;
  }

  .summary-strip__asset-right .summary-strip__value {
    font-size: 1.2rem;
    line-height: 1.08;
  }

  .summary-strip__nav-returns {
    margin-top: 0.14rem;
    gap: 0.12rem;
  }

  .summary-strip__returns-title {
    margin-top: 0.2rem;
  }

  .summary-strip__nav-item,
  .summary-strip__nav-sep {
    font-size: 0.66rem;
  }

  .dashboard-shell-card .metric-tile__sub {
    margin-top: 0.2rem;
    font-size: 0.72rem;
    line-height: 1.2;
  }

  .dashboard-holdings-header {
    flex-wrap: nowrap;
  }

  .dashboard-holdings-header .section-actions {
    width: auto;
    flex-wrap: nowrap;
    gap: 0.32rem;
    margin-left: auto;
  }

  .dashboard-holdings-pnl {
    display: none !important;
  }

  .dashboard-holdings-header .dashboard-action-link {
    font-size: 0.82rem;
  }

  .holdings-table-desktop {
    display: none;
  }

  .holdings-table-mobile {
    display: block;
  }

  .holdings-table-mobile .table > :not(caption) > * > * {
    padding: 0.36rem 0.38rem;
    font-size: 0.78rem;
  }

  .holdings-table-mobile .table thead th {
    font-size: 0.74rem;
  }

  .dashboard-panel-card .table-wrap {
    padding: 0.14rem 0.26rem !important;
  }

  .dashboard-bottom-grid {
    grid-template-columns: 1fr;
    gap: 0.56rem;
  }

  .dashboard-shell-card .card-header,
  .dashboard-shell-card .card-body {
    padding-left: 0.5rem;
    padding-right: 0.5rem;
  }
}

html[data-theme="dark"] .dashboard-shell-card {
  border-color: rgba(120, 149, 183, 0.5);
  background: linear-gradient(180deg, rgba(15, 27, 42, 0.98), rgba(10, 20, 31, 0.98));
  box-shadow: 0 12px 26px rgba(2, 10, 24, 0.4);
}

html[data-theme="dark"] .dashboard-shell-card .card-header {
  background: linear-gradient(180deg, rgba(24, 39, 58, 0.99), rgba(16, 28, 44, 0.99));
  border-bottom-color: rgba(120, 149, 183, 0.36);
}

html[data-theme="dark"] .dashboard-shell-card .summary-strip__item,
html[data-theme="dark"] .dashboard-shell-card .summary-strip__item--asset {
  border-color: rgba(128, 158, 193, 0.36);
  background: linear-gradient(180deg, rgba(23, 37, 55, 0.98), rgba(16, 28, 43, 0.98));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

html[data-theme="dark"] .dashboard-shell-card .summary-strip__label,
html[data-theme="dark"] .dashboard-shell-card .metric-tile__sub {
  color: #9fb5d1;
}

html[data-theme="dark"] .dashboard-shell-card .table-wrap {
  border-color: rgba(115, 145, 180, 0.32);
  background: rgba(11, 20, 32, 0.72);
}

html[data-theme="dark"] .dashboard-shell-card .table thead th {
  background: rgba(24, 40, 61, 0.98);
  border-bottom-color: rgba(127, 157, 193, 0.4);
  color: #c6d9f0;
}

html[data-theme="dark"] .dashboard-panel-card {
  border-color: rgba(123, 151, 186, 0.4);
  background: rgba(14, 24, 38, 0.92);
}

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

html[data-theme="dark"] .dashboard-panel-card .section-heading {
  color: #e1edfb;
}

html[data-theme="dark"] .dashboard-panel-card .card-subtitle {
  color: #9fb7d3;
}

html[data-theme="dark"] .dashboard-panel-card .table-wrap {
  border-color: rgba(115, 145, 180, 0.32);
  background: rgba(11, 20, 32, 0.76);
}

html[data-theme="dark"] .dashboard-panel-card .table thead th {
  background: rgba(24, 40, 61, 0.98);
  border-bottom-color: rgba(127, 157, 193, 0.4);
  color: #c6d9f0;
}

/* Compact nav */
.navbar-compact {
  min-height: 44px;
}

.navbar-compact .container-fluid.app-shell {
  padding-block: 0.08rem;
}

.navbar-compact .navbar-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.34rem;
  padding: 0;
  margin-right: 0.72rem;
  letter-spacing: 0;
}

.brand-logo-icon {
  width: 22px;
  height: 22px;
  object-fit: contain;
}

.brand-name {
  font-size: 1.03rem;
  line-height: 1;
  font-weight: 800;
}

.mobile-brand-meta {
  display: none;
}

.mobile-brand-title,
.mobile-brand-date {
  color: #e6edf7;
  font-size: 0.9rem;
  font-weight: 700;
  line-height: 1;
}

.navbar-compact .navbar-nav {
  align-items: center;
}

.navbar-compact .nav-link {
  position: relative;
  min-height: 22px;
  padding: 0.22rem 0.48rem;
  border-radius: 0;
  background: transparent !important;
  color: #426084;
  font-size: 0.95rem;
  line-height: 1.1;
  font-weight: 600;
}

.navbar-compact .nav-link::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -5px;
  width: 16px;
  height: 2px;
  border-radius: 999px;
  background: #2f6ee5;
  transform: translateX(-50%) scaleX(0);
  transform-origin: center;
  transition: transform 0.18s ease;
}

.navbar-compact .nav-link:hover,
.navbar-compact .nav-link:focus-visible {
  color: #24496f;
  background: transparent !important;
}

.navbar-compact .nav-link.active {
  color: #163860;
  font-weight: 700;
  box-shadow: none;
}

.navbar-compact .nav-link.active::after {
  transform: translateX(-50%) scaleX(1);
}

.navbar-compact .navbar-toolbar {
  gap: 0.3rem;
  align-items: center;
}

.navbar-compact .desktop-meta {
  font-size: 0.8rem;
  color: #5c7899;
  letter-spacing: 0;
}

.account-switcher {
  position: relative;
}

.navbar-compact .btn-account-switch {
  min-width: 84px;
  max-width: 148px;
  height: 26px;
  min-height: 26px;
  max-height: 26px;
  padding: 0 0.55rem;
  border-radius: 999px;
  border: 1px solid #b8cbe3;
  background: rgba(255, 255, 255, 0.82);
  color: #3a5a80;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.8rem;
  line-height: 1;
  box-sizing: border-box;
  vertical-align: middle;
}

.navbar-compact .btn-account-switch:hover,
.navbar-compact .btn-account-switch:focus-visible {
  color: #234b76;
  border-color: #8eaedf;
  background: #f5f9ff;
}

.account-switcher__name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-switcher__menu {
  min-width: 210px;
  padding: 0.4rem 0;
}

.account-switcher__section-label {
  padding: 0.15rem 1rem 0.35rem;
  font-size: 0.7rem;
  color: #6a829e;
  text-transform: uppercase;
}

.account-switcher__item {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
}

.account-switcher__item small {
  color: #7990aa;
  text-transform: uppercase;
}

.account-switcher__item.is-active,
.account-switcher__item:disabled {
  opacity: 1;
  background: rgba(84, 131, 193, 0.08);
  color: #244c78;
}

.navbar-compact .badge {
  display: none;
}

.navbar-compact .theme-switch {
  border: 0;
  background: transparent;
  padding: 0;
  box-shadow: none;
}

.navbar-compact .btn-theme-icon,
.navbar-compact .btn-logout-icon {
  width: 26px;
  height: 26px;
  min-width: 26px;
  min-height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  border: 1px solid #b8cbe3;
  background: rgba(255, 255, 255, 0.82);
  color: #3a5a80;
  padding: 0;
  box-shadow: none;
}

.navbar-compact .btn-theme-icon:hover,
.navbar-compact .btn-theme-icon:focus-visible,
.navbar-compact .btn-logout-icon:hover,
.navbar-compact .btn-logout-icon:focus-visible {
  color: #234b76;
  border-color: #8eaedf;
  background: #f5f9ff;
  transform: none;
}

.navbar-compact .btn-theme-icon svg,
.navbar-compact .btn-logout-icon svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.theme-icon {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.theme-icon--moon {
  display: none;
}

html[data-theme="dark"] .theme-icon--sun {
  display: none;
}

html[data-theme="dark"] .theme-icon--moon {
  display: block;
}

html[data-theme="dark"] .navbar-compact .nav-link {
  color: #dbe8fb;
}

html[data-theme="dark"] .navbar-compact .nav-link:hover,
html[data-theme="dark"] .navbar-compact .nav-link:focus-visible {
  color: #ffffff;
}

html[data-theme="dark"] .navbar-compact .nav-link.active {
  color: #ffffff;
}

html[data-theme="dark"] .navbar-compact .nav-link::after {
  background: #7db7ff;
}

html[data-theme="dark"] .navbar-compact .desktop-meta {
  color: #c8dbf4;
}

html[data-theme="dark"] .navbar-compact .btn-account-switch {
  border-color: rgba(198, 220, 247, 0.52);
  background: rgba(255, 255, 255, 0.08);
  color: #dcecff;
}

html[data-theme="dark"] .navbar-compact .btn-account-switch:hover,
html[data-theme="dark"] .navbar-compact .btn-account-switch:focus-visible {
  border-color: rgba(216, 234, 255, 0.72);
  background: rgba(255, 255, 255, 0.16);
  color: #ffffff;
}

html[data-theme="dark"] .account-switcher__menu {
  background: #10263f;
  border-color: rgba(167, 196, 231, 0.2);
}

html[data-theme="dark"] .account-switcher__section-label,
html[data-theme="dark"] .account-switcher__item small {
  color: #98b6d8;
}

html[data-theme="dark"] .account-switcher__item {
  color: #e8f1ff;
}

html[data-theme="dark"] .account-switcher__item.is-active,
html[data-theme="dark"] .account-switcher__item:disabled {
  background: rgba(125, 183, 255, 0.18);
  color: #ffffff;
}

html[data-theme="dark"] .mobile-brand-title {
  color: #edf4ff;
}

html[data-theme="dark"] .mobile-brand-date {
  color: #9db4d4;
}

html[data-theme="dark"] .navbar-compact .btn-theme-icon,
html[data-theme="dark"] .navbar-compact .btn-logout-icon {
  border-color: rgba(198, 220, 247, 0.52);
  background: rgba(255, 255, 255, 0.08);
  color: #dcecff;
}

html[data-theme="dark"] .navbar-compact .btn-theme-icon:hover,
html[data-theme="dark"] .navbar-compact .btn-theme-icon:focus-visible,
html[data-theme="dark"] .navbar-compact .btn-logout-icon:hover,
html[data-theme="dark"] .navbar-compact .btn-logout-icon:focus-visible {
  border-color: rgba(216, 234, 255, 0.72);
  background: rgba(255, 255, 255, 0.16);
  color: #ffffff;
}

@media (max-width: 991.98px) {
  .navbar-compact {
    min-height: 40px;
  }

  .brand-name,
  .navbar-compact .navbar-collapse .navbar-nav {
    display: none;
  }

  .navbar-compact .navbar-brand {
    margin-right: auto;
    position: relative;
    z-index: 4;
  }

  .navbar-compact .navbar-collapse {
    display: flex !important;
    flex-basis: auto;
    flex-grow: 0;
    align-items: center;
    position: relative;
    z-index: 5;
  }

  .navbar-compact .navbar-toolbar {
    position: relative;
    z-index: 6;
    pointer-events: auto;
  }

  .navbar-compact .btn-theme-icon,
  .navbar-compact .btn-logout-icon,
  .navbar-compact .btn-account-switch {
    position: relative;
    z-index: 7;
    pointer-events: auto;
    touch-action: manipulation;
  }

  .navbar-compact .btn-account-switch {
    max-width: 112px;
  }

  .mobile-brand-meta {
    display: inline-flex;
    align-items: baseline;
    gap: 0.42rem;
    margin-left: 0.08rem;
  }

  .mobile-brand-title {
    color: #163b63;
    font-size: 1rem;
    font-weight: 700;
  }

  .mobile-brand-date {
    color: #5e799a;
    font-size: 0.88rem;
    font-weight: 600;
  }

  .brand-logo-icon {
    width: 20px;
    height: 20px;
  }
}

html[data-theme="dark"] .dashboard-updated-at {
  color: #9ab4d2;
}

html[data-theme="dark"] .dashboard-action-link {
  color: #9ab8dc;
}

html[data-theme="dark"] .dashboard-action-link:hover,
html[data-theme="dark"] .dashboard-action-link:focus-visible {
  color: #c6dcf6;
}

/* ============================================================ */
/* Trading-platform polish (2026-04-27)                          */
/* Goal: tighten typography, add terminal-style market status,    */
/* tabular numerics, sleeker tables, deeper dark theme.           */
/* ============================================================ */

:root {
  --mono-font: "SFMono-Regular", "JetBrains Mono", "Fira Code", "Roboto Mono",
               "Menlo", "Consolas", "DejaVu Sans Mono", monospace;
  --tape-up: #16a34a;
  --tape-down: #dc2626;
  --tape-flat: #94a3b8;
  --grid-line: rgba(120, 145, 178, 0.16);
  --status-live: #10b981;
  --status-closed: #f59e0b;
  --status-after: #64748b;
}

html[data-theme="dark"] {
  --page-bg: #050a14;
  --surface: rgba(13, 22, 36, 0.96);
  --surface-strong: #0f1a2c;
  --surface-muted: #0a1421;
  --surface-border: rgba(83, 113, 153, 0.32);
  --surface-border-strong: rgba(120, 152, 196, 0.46);
  --surface-shadow: 0 18px 38px rgba(0, 4, 12, 0.55);
  --surface-shadow-soft: 0 10px 24px rgba(0, 4, 12, 0.40);
  --grid-line: rgba(140, 168, 200, 0.12);
  --tape-up: #34d399;
  --tape-down: #f87171;
  --tape-flat: #94a3b8;
}

html[data-theme="dark"] body {
  background:
    radial-gradient(ellipse at top, rgba(38, 111, 216, 0.10), transparent 55%),
    linear-gradient(180deg, #050a14 0%, #030711 100%);
}

/* ---------- Market status sub-bar (sits inside the navbar) ---------- */

.market-statusbar {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.18rem 0;
  font-family: var(--mono-font);
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--text-700);
  white-space: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
}

.market-statusbar::-webkit-scrollbar { display: none; }

.market-statusbar__group {
  display: inline-flex;
  align-items: center;
  gap: 0.32rem;
}

.market-statusbar__label {
  color: var(--text-500);
  font-size: 0.66rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.market-statusbar__value {
  color: var(--text-900);
  font-variant-numeric: tabular-nums;
}

.market-statusbar__sep {
  width: 1px;
  height: 14px;
  background: var(--surface-border);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.34rem;
  padding: 0.12rem 0.5rem;
  border-radius: 999px;
  border: 1px solid currentColor;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: rgba(16, 185, 129, 0.08);
}

.status-pill--live {
  color: var(--status-live);
  background: rgba(16, 185, 129, 0.10);
}

.status-pill--closed {
  color: var(--status-closed);
  background: rgba(245, 158, 11, 0.10);
}

.status-pill--after {
  color: var(--status-after);
  background: rgba(100, 116, 139, 0.10);
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  position: relative;
}

.status-pill--live .status-dot::after {
  content: "";
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.45;
  animation: status-pulse 1.6s ease-out infinite;
}

@keyframes status-pulse {
  0%   { transform: scale(0.6); opacity: 0.55; }
  70%  { transform: scale(1.7); opacity: 0;    }
  100% { transform: scale(1.7); opacity: 0;    }
}

@media (max-width: 991.98px) {
  .market-statusbar {
    gap: 0.55rem;
    font-size: 0.7rem;
  }
  .market-statusbar__group--user,
  .market-statusbar__sep--user {
    display: none;
  }
}

@media (max-width: 767.98px) {
  .market-statusbar {
    gap: 0.45rem;
    font-size: 0.68rem;
  }
  .market-statusbar__label {
    font-size: 0.6rem;
  }
  .market-statusbar__group--density,
  .market-statusbar__sep--density {
    display: none;
  }
}

/* ---------- Tabular numerics everywhere data shows up ---------- */

.summary-strip__value,
.summary-strip__cash-line,
.summary-strip__nav-returns,
.summary-strip__returns-line,
.metric-card .metric-value,
.kpi-mini__value,
.asset-hero__value,
.dashboard-holdings-pnl,
.dashboard-updated-at,
table.table td,
table.table th {
  font-variant-numeric: tabular-nums;
}

.summary-strip__value,
.metric-card .metric-value,
.kpi-mini__value,
.asset-hero__value {
  font-family: var(--mono-font);
  letter-spacing: -0.01em;
}

/* Numeric cells in data tables get monospace */
table.table tbody td,
table.table tfoot td {
  font-variant-numeric: tabular-nums;
}

/* ---------- Sleeker, denser data tables ---------- */

table.table {
  --bs-table-bg: transparent;
  border-collapse: separate;
  border-spacing: 0;
}

table.table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: linear-gradient(180deg, rgba(245, 249, 255, 0.96), rgba(232, 240, 252, 0.96));
  color: var(--text-700);
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-bottom: 1px solid var(--surface-border-strong);
  padding: 0.42rem 0.55rem;
}

table.table tbody td {
  padding: 0.4rem 0.55rem;
  border-bottom: 1px solid var(--grid-line);
  font-size: 0.86rem;
  color: var(--text-900);
}

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

table.table tbody tr:nth-child(even) td {
  background: rgba(245, 249, 255, 0.45);
}

table.table tbody tr:nth-child(even):hover td {
  background: rgba(59, 130, 246, 0.08);
}

html[data-theme="dark"] table.table thead th {
  background: linear-gradient(180deg, rgba(15, 26, 44, 0.96), rgba(11, 19, 32, 0.96));
  color: #b8cce6;
  border-bottom-color: rgba(120, 152, 196, 0.32);
}

html[data-theme="dark"] table.table tbody td {
  color: #e2ecf9;
  border-bottom-color: rgba(120, 152, 196, 0.12);
}

html[data-theme="dark"] table.table tbody tr:nth-child(even) td {
  background: rgba(255, 255, 255, 0.018);
}

html[data-theme="dark"] table.table tbody tr:hover td {
  background: rgba(96, 165, 250, 0.10);
}

html[data-theme="dark"] table.table tbody tr:nth-child(even):hover td {
  background: rgba(96, 165, 250, 0.13);
}

/* ---------- Card header polish: tiny indicator on accents ---------- */

.surface-accent .card-header {
  position: relative;
}

.surface-accent .card-header .section-heading {
  position: relative;
  padding-left: 0.4rem;
}

.surface-accent .card-header .section-heading::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.18rem;
  bottom: 0.18rem;
  width: 3px;
  border-radius: 2px;
  background: linear-gradient(180deg, var(--brand-600), var(--brand-700));
}

/* ---------- Summary strip: terminal feel ---------- */

.summary-strip__label {
  text-transform: uppercase;
  letter-spacing: 0.10em;
  font-size: 0.68rem;
  color: var(--text-500);
}

html[data-theme="dark"] .summary-strip__item {
  background:
    linear-gradient(180deg, rgba(20, 32, 50, 0.92), rgba(13, 22, 36, 0.86)),
    linear-gradient(120deg, rgba(96, 165, 250, 0.10), transparent 70%);
  border-color: rgba(96, 137, 188, 0.28);
}

html[data-theme="dark"] .summary-strip__item--asset {
  background:
    linear-gradient(180deg, rgba(22, 36, 58, 0.94), rgba(13, 22, 36, 0.92)),
    linear-gradient(120deg, rgba(96, 165, 250, 0.18), transparent 72%);
  border-color: rgba(120, 162, 215, 0.36);
}

/* ---------- Page hero: trading-terminal style ---------- */

.page-hero {
  background:
    linear-gradient(140deg, rgba(255, 255, 255, 0.99), rgba(238, 246, 255, 0.94)),
    linear-gradient(90deg, rgba(26, 95, 192, 0.10), rgba(59, 130, 246, 0.04));
}

html[data-theme="dark"] .page-hero {
  border-color: rgba(96, 137, 188, 0.36);
  background:
    linear-gradient(140deg, rgba(17, 30, 50, 0.96), rgba(11, 19, 32, 0.94)),
    linear-gradient(90deg, rgba(96, 165, 250, 0.16), rgba(59, 130, 246, 0.04));
}

.page-eyebrow {
  font-family: var(--mono-font);
  letter-spacing: 0.18em;
}

/* ---------- Buttons: a touch crisper ---------- */

.btn-primary {
  background: linear-gradient(180deg, #2873db, #1452ad);
  border-color: #0e3f8a;
  letter-spacing: 0.02em;
}

html[data-theme="dark"] .btn-primary {
  background: linear-gradient(180deg, #3b82f6, #1e5ec8);
  border-color: #1d4ed8;
  box-shadow: 0 8px 22px rgba(8, 22, 58, 0.55);
}

/* ---------- Login: terminal hero ---------- */

.login-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: 1rem;
  align-items: stretch;
  margin: 0 auto;
  max-width: 980px;
}

.login-brand {
  position: relative;
  padding: 1.2rem 1.3rem;
  border-radius: var(--radius-xl);
  border: 1px solid var(--surface-border);
  overflow: hidden;
  background:
    linear-gradient(140deg, rgba(20, 60, 130, 0.96), rgba(8, 27, 65, 0.96)),
    linear-gradient(90deg, rgba(59, 130, 246, 0.18), transparent 60%);
  color: #eaf2ff;
  box-shadow: var(--surface-shadow);
}

.login-brand::before {
  content: "";
  position: absolute;
  inset: -40% -10% auto auto;
  width: 70%;
  height: 80%;
  background: radial-gradient(circle at center, rgba(99, 179, 237, 0.32), transparent 65%);
  pointer-events: none;
}

.login-brand__eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--mono-font);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  color: #8fc1ff;
  text-transform: uppercase;
}

.login-brand__title {
  margin: 0.5rem 0 0.4rem;
  font-size: clamp(1.4rem, 2vw, 1.85rem);
  font-weight: 800;
  letter-spacing: -0.01em;
  color: #ffffff;
}

.login-brand__subtitle {
  margin: 0;
  color: #c4d8f3;
  font-size: 0.92rem;
  line-height: 1.5;
  max-width: 380px;
}

.login-brand__feature-list {
  margin: 0.9rem 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.42rem;
  position: relative;
}

.login-brand__feature-list li {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  color: #d6e6fa;
  font-size: 0.86rem;
  line-height: 1.4;
}

.login-brand__feature-list li::before {
  content: "›";
  color: #7ab8ff;
  font-weight: 800;
  font-family: var(--mono-font);
}

.login-brand__ticker {
  margin-top: 1rem;
  padding: 0.55rem 0.7rem;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.10);
  font-family: var(--mono-font);
  font-size: 0.78rem;
  color: #cee2fa;
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem 1rem;
  position: relative;
}

.login-brand__ticker span {
  display: inline-flex;
  align-items: baseline;
  gap: 0.35rem;
}

.login-brand__ticker em {
  font-style: normal;
  color: #8fc1ff;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 0.66rem;
}

.login-card {
  align-self: stretch;
}

.login-card .card-body {
  padding: 1.25rem 1.2rem;
}

@media (max-width: 767.98px) {
  .login-grid {
    grid-template-columns: 1fr;
  }
  .login-brand {
    padding: 1rem 1.05rem;
  }
}

/* ---------- Number flash on update ---------- */

.flash-up {
  animation: flash-up 0.7s ease-out 1;
}
.flash-down {
  animation: flash-down 0.7s ease-out 1;
}

@keyframes flash-up {
  0% { background-color: rgba(22, 163, 74, 0.28); }
  100% { background-color: transparent; }
}
@keyframes flash-down {
  0% { background-color: rgba(220, 38, 38, 0.24); }
  100% { background-color: transparent; }
}

/* ---------- Slimmer scrollbars for an app feel ---------- */

.panel-scroll::-webkit-scrollbar,
.panel-scroll-sm::-webkit-scrollbar,
.summary-strip::-webkit-scrollbar {
  height: 6px;
  width: 6px;
}

.panel-scroll::-webkit-scrollbar-thumb,
.panel-scroll-sm::-webkit-scrollbar-thumb,
.summary-strip::-webkit-scrollbar-thumb {
  background: rgba(120, 145, 178, 0.35);
  border-radius: 3px;
}

html[data-theme="dark"] .panel-scroll::-webkit-scrollbar-thumb,
html[data-theme="dark"] .panel-scroll-sm::-webkit-scrollbar-thumb,
html[data-theme="dark"] .summary-strip::-webkit-scrollbar-thumb {
  background: rgba(140, 168, 200, 0.30);
}


/* Market status bar wrapper - sits directly under the navbar */
.market-statusbar-wrap {
  position: sticky;
  top: 0;
  z-index: 1039;
  border-bottom: 1px solid var(--surface-border);
  background: linear-gradient(180deg, rgba(245, 249, 255, 0.96), rgba(232, 240, 252, 0.96));
  backdrop-filter: blur(10px);
}

html[data-theme="dark"] .market-statusbar-wrap {
  background: linear-gradient(180deg, rgba(11, 19, 32, 0.96), rgba(8, 14, 24, 0.96));
  border-bottom-color: rgba(96, 137, 188, 0.22);
}

.market-statusbar-wrap .container-fluid.app-shell {
  padding-block: 0;
}

@media (max-width: 991.98px) {
  .market-statusbar {
    padding: 0.16rem 0;
  }
}


/* ============================================================ */
/* Trading-platform polish v2 — buttons / forms / tags /          */
/* numbers / tables / charts / modal-toast / loading / nav        */
/* ============================================================ */

:root {
  --radius-btn: 7px;
  --radius-input: 7px;
  --tag-radius: 5px;
  --btn-shadow-sm: 0 1px 0 rgba(255,255,255,0.6) inset, 0 1px 2px rgba(15,42,86,0.08);
}

html[data-theme="dark"] {
  --btn-shadow-sm: 0 1px 0 rgba(255,255,255,0.05) inset, 0 1px 2px rgba(0,0,0,0.4);
}

/* ---------- 1. Button system ---------- */

.btn {
  border-radius: var(--radius-btn);
  font-weight: 600;
  letter-spacing: 0.01em;
  font-variant-numeric: tabular-nums;
  transition: transform 0.12s ease, box-shadow 0.18s ease,
              background-color 0.18s ease, border-color 0.18s ease,
              color 0.18s ease, opacity 0.18s ease;
}

.btn:hover,
.btn:focus-visible {
  transform: none;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.14);
}

.btn:active { transform: translateY(1px); }

.btn-sm {
  border-radius: 6px;
  min-height: 30px;
  padding-inline: 10px;
  font-size: 0.82rem;
}

.btn-primary {
  background: linear-gradient(180deg, #3b82f6, #1f63d4);
  border-color: #1851b8;
  color: #ffffff;
  box-shadow: var(--btn-shadow-sm), 0 6px 14px rgba(20, 82, 173, 0.18);
}

.btn-primary:hover,
.btn-primary:focus-visible {
  background: linear-gradient(180deg, #4d8df8, #2a72e0);
  border-color: #1648a8;
  color: #ffffff;
}

.btn-outline-primary {
  border-color: var(--surface-border-strong);
  background: transparent;
}

.btn-outline-primary:hover,
.btn-outline-primary:focus-visible {
  background: rgba(59, 130, 246, 0.08);
  border-color: #5e95df;
  color: var(--brand-700);
}

.btn-outline-secondary {
  border-color: var(--surface-border-strong);
  color: var(--text-700);
  background: transparent;
}

.btn-outline-secondary:hover,
.btn-outline-secondary:focus-visible {
  background: rgba(120, 145, 178, 0.10);
  color: var(--text-900);
  border-color: var(--surface-border-strong);
}

/* Ghost button — flat, low-stakes secondary action */
.btn-ghost {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-700);
  box-shadow: none;
}

.btn-ghost:hover,
.btn-ghost:focus-visible {
  background: rgba(120, 145, 178, 0.10);
  color: var(--text-900);
  border-color: rgba(120, 145, 178, 0.20);
}

/* Danger — for irreversible actions */
.btn-danger {
  background: linear-gradient(180deg, #ef4444, #c12d2d);
  border-color: #a82424;
  color: #ffffff;
  box-shadow: var(--btn-shadow-sm), 0 6px 14px rgba(193, 45, 45, 0.22);
}

.btn-danger:hover,
.btn-danger:focus-visible {
  background: linear-gradient(180deg, #f56565, #d12f2f);
  border-color: #9c1f1f;
  color: #ffffff;
}

.btn-outline-danger {
  background: transparent;
  border-color: rgba(220, 38, 38, 0.45);
  color: #c12d2d;
}

.btn-outline-danger:hover,
.btn-outline-danger:focus-visible {
  background: rgba(220, 38, 38, 0.08);
  border-color: #c12d2d;
  color: #a82424;
}

/* Icon-only buttons */
.btn-icon {
  width: 32px;
  height: 32px;
  min-height: 32px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
}

.btn-icon svg {
  width: 15px;
  height: 15px;
  stroke-width: 2;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Spinner inside busy buttons */
.btn .spinner-border-sm {
  width: 0.85rem;
  height: 0.85rem;
  border-width: 0.16em;
  vertical-align: -0.12em;
}

html[data-theme="dark"] .btn-outline-primary {
  border-color: rgba(123, 184, 255, 0.35);
  color: #b9dbff;
}

html[data-theme="dark"] .btn-outline-primary:hover,
html[data-theme="dark"] .btn-outline-primary:focus-visible {
  background: rgba(96, 165, 250, 0.14);
  border-color: rgba(123, 184, 255, 0.55);
  color: #ffffff;
}

html[data-theme="dark"] .btn-outline-secondary {
  border-color: rgba(180, 198, 224, 0.32);
  color: #cdddf0;
}

html[data-theme="dark"] .btn-outline-secondary:hover,
html[data-theme="dark"] .btn-outline-secondary:focus-visible {
  background: rgba(180, 198, 224, 0.10);
  color: #ffffff;
}

html[data-theme="dark"] .btn-ghost {
  color: #cfdcef;
}

html[data-theme="dark"] .btn-ghost:hover,
html[data-theme="dark"] .btn-ghost:focus-visible {
  background: rgba(180, 200, 230, 0.08);
  color: #ffffff;
  border-color: rgba(180, 200, 230, 0.18);
}

html[data-theme="dark"] .btn-outline-danger {
  border-color: rgba(248, 113, 113, 0.45);
  color: #fca5a5;
}

html[data-theme="dark"] .btn-outline-danger:hover {
  background: rgba(248, 113, 113, 0.14);
  color: #fecaca;
  border-color: #fca5a5;
}

/* ---------- 2. Forms — sharper, terminal feel ---------- */

.form-control,
.form-select,
textarea.form-control {
  border-radius: var(--radius-input);
  border-color: var(--surface-border-strong);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-control:focus,
.form-select:focus,
textarea.form-control:focus {
  border-color: #4d8df8;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.20);
}

/* Numeric inputs get monospace */
.form-control[type="number"],
.form-control[inputmode="decimal"],
.form-control[inputmode="numeric"],
.form-control--mono,
input.amount-input,
input[name*="amount"],
input[name*="lots"],
input[name*="cash"] {
  font-family: var(--mono-font);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
}

.form-label {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-500);
  margin-bottom: 0.25rem;
}

.form-select-sm,
.form-control-sm {
  border-radius: 6px;
  font-size: 0.82rem;
}

/* Input prefix/suffix slot */
.input-affix {
  display: inline-flex;
  align-items: stretch;
  border: 1px solid var(--surface-border-strong);
  border-radius: var(--radius-input);
  background: var(--surface-strong);
  overflow: hidden;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.input-affix:focus-within {
  border-color: #4d8df8;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.20);
}

.input-affix > .form-control {
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.input-affix > .form-control:focus {
  box-shadow: none;
}

.input-affix__prefix,
.input-affix__suffix {
  display: inline-flex;
  align-items: center;
  padding: 0 0.55rem;
  background: var(--surface-muted);
  color: var(--text-500);
  font-size: 0.78rem;
  font-weight: 600;
}

.input-affix__suffix {
  border-left: 1px solid var(--surface-border);
}

.input-affix__prefix {
  border-right: 1px solid var(--surface-border);
}

/* Checkbox / radio refinements */
.form-check-input {
  border-radius: 4px;
  border-color: var(--surface-border-strong);
}

.form-check-input:checked {
  background-color: var(--brand-600);
  border-color: var(--brand-700);
}

html[data-theme="dark"] .form-control,
html[data-theme="dark"] .form-select,
html[data-theme="dark"] textarea.form-control {
  background-color: rgba(15, 25, 41, 0.92);
  border-color: rgba(120, 152, 196, 0.32);
  color: var(--text-900);
}

html[data-theme="dark"] .form-control:focus,
html[data-theme="dark"] .form-select:focus {
  border-color: #60a5fa;
  box-shadow: 0 0 0 2px rgba(96, 165, 250, 0.30);
}

html[data-theme="dark"] .input-affix {
  background: rgba(15, 25, 41, 0.92);
  border-color: rgba(120, 152, 196, 0.32);
}

html[data-theme="dark"] .input-affix__prefix,
html[data-theme="dark"] .input-affix__suffix {
  background: rgba(8, 16, 28, 0.92);
  color: #a8bfdc;
  border-color: rgba(120, 152, 196, 0.22);
}

/* ---------- 3. Tag system ---------- */

.tag {
  display: inline-flex;
  align-items: center;
  gap: 0.26rem;
  padding: 0.12rem 0.46rem;
  border-radius: var(--tag-radius);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1.4;
  background: rgba(120, 145, 178, 0.12);
  color: var(--text-700);
  border: 1px solid transparent;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.tag--neutral { background: rgba(120, 145, 178, 0.12); color: var(--text-700); }
.tag--info    { background: rgba(59, 130, 246, 0.12); color: #1f63d4; }
.tag--success { background: rgba(22, 163, 74, 0.14); color: #137a3f; }
.tag--warn    { background: rgba(245, 158, 11, 0.16); color: #a86509; }
.tag--danger  { background: rgba(220, 38, 38, 0.14); color: #b91c1c; }

.tag--outline {
  background: transparent;
  border-color: currentColor;
}

.tag--dot::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  display: inline-block;
}

html[data-theme="dark"] .tag--neutral { color: #cfdcef; background: rgba(180, 200, 230, 0.10); }
html[data-theme="dark"] .tag--info    { background: rgba(96, 165, 250, 0.18); color: #b9dbff; }
html[data-theme="dark"] .tag--success { background: rgba(52, 211, 153, 0.16); color: #6ee7b7; }
html[data-theme="dark"] .tag--warn    { background: rgba(251, 191, 36, 0.18); color: #fcd34d; }
html[data-theme="dark"] .tag--danger  { background: rgba(248, 113, 113, 0.18); color: #fecaca; }

/* Bootstrap badge fallback — make legacy badges visually consistent */
.badge {
  border-radius: var(--tag-radius);
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 0.28em 0.5em;
  font-variant-numeric: tabular-nums;
}

/* ---------- 4. Number presentation ---------- */

.kpi-positive::before,
.num-up::before {
  content: "▲ ";
  font-size: 0.78em;
  letter-spacing: 0;
}

.kpi-negative::before,
.num-down::before {
  content: "▼ ";
  font-size: 0.78em;
  letter-spacing: 0;
}

/* Allow opt-out from arrow when needed */
.kpi-positive.no-arrow::before,
.kpi-negative.no-arrow::before,
.num-up.no-arrow::before,
.num-down.no-arrow::before {
  content: "";
}

.num-flat {
  color: var(--text-500);
}

/* Hero asset card: bigger, change inline */
.summary-strip__item--asset .summary-strip__value--asset-compact {
  font-size: clamp(1.35rem, 2vw, 1.85rem);
  font-weight: 700;
}

.live-position-control-strip .summary-strip__item,
.live-position-control-strip .summary-strip__item--asset {
  min-width: 150px;
  flex: 1 0 150px;
}

.live-position-control-strip .summary-strip__value,
.live-position-control-strip .summary-strip__item--asset .summary-strip__value,
.live-position-control-strip .summary-strip__item--asset .summary-strip__value--asset-compact {
  font-size: 0.86rem;
  line-height: 1.2;
  letter-spacing: normal;
  font-weight: 400;
}

.summary-strip__cash-line {
  font-family: var(--mono-font);
}

/* ---------- 5. Tables polish ---------- */

table.table tbody tr {
  cursor: default;
}

table.table tbody tr.is-clickable {
  cursor: pointer;
}

table.table tbody tr.is-active td {
  background: rgba(59, 130, 246, 0.10) !important;
  box-shadow: inset 3px 0 0 var(--brand-600);
}

table.table th.is-sortable {
  cursor: pointer;
  user-select: none;
  padding-right: 1.2rem;
  position: relative;
}

table.table th.is-sortable::after {
  content: "↕";
  position: absolute;
  right: 0.4rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.7rem;
  opacity: 0.45;
}

table.table th.is-sortable.sort-asc::after { content: "▲"; opacity: 0.85; }
table.table th.is-sortable.sort-desc::after { content: "▼"; opacity: 0.85; }

/* Sticky first column for code/name cells */
table.table.table--sticky-first thead th:first-child,
table.table.table--sticky-first tbody td:first-child {
  position: sticky;
  left: 0;
  background: inherit;
  z-index: 1;
}

table.table.table--sticky-first thead th:first-child {
  z-index: 3;
}

/* Empty-state row: span+icon */
table.table tbody tr td.empty-row {
  text-align: center;
  padding: 1.6rem 0.6rem;
  color: var(--text-500);
}

/* ---------- 6. Charts polish ---------- */

.chart-stage {
  position: relative;
  border-radius: 10px;
  background:
    linear-gradient(180deg, rgba(245, 249, 255, 0.4), transparent 80%);
}

html[data-theme="dark"] .chart-stage {
  background:
    linear-gradient(180deg, rgba(96, 165, 250, 0.04), transparent 80%);
}

/* ---------- 7. Modal accent + Toast animation ---------- */

.modal-content {
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--surface-shadow);
  overflow: hidden;
  position: relative;
}

.modal-content::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 2px;
  background: linear-gradient(90deg, var(--brand-600), var(--brand-500), transparent 80%);
}

.modal-header {
  border-bottom: 1px solid var(--surface-border);
  padding: 0.65rem 0.85rem;
}

.modal-title {
  font-size: 0.95rem;
  font-weight: 800;
}

.modal-body {
  padding: 0.85rem;
  color: var(--text-700);
  font-size: 0.9rem;
}

.modal-footer {
  border-top: 1px solid var(--surface-border);
  padding: 0.55rem 0.7rem;
  gap: 0.4rem;
}

html[data-theme="dark"] .modal-content {
  background: var(--surface-strong);
  border-color: rgba(120, 152, 196, 0.28);
}

@keyframes toast-slide-in {
  from { opacity: 0; transform: translateX(28px) scale(0.97); }
  to   { opacity: 1; transform: translateX(0) scale(1); }
}

@keyframes toast-slide-out {
  from { opacity: 1; transform: translateX(0); }
  to   { opacity: 0; transform: translateX(28px); }
}

.app-toast {
  animation: toast-slide-in 0.22s ease-out 1;
  max-height: 320px;
  overflow: auto;
}

.app-toast.is-leaving {
  animation: toast-slide-out 0.18s ease-in 1 forwards;
}

/* ---------- 8. Loading: spinner + skeleton ---------- */

.skeleton {
  background: linear-gradient(90deg,
              rgba(120, 145, 178, 0.10) 0%,
              rgba(120, 145, 178, 0.20) 50%,
              rgba(120, 145, 178, 0.10) 100%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.4s ease-in-out infinite;
  border-radius: 6px;
  display: inline-block;
  height: 0.85em;
  width: 100%;
  vertical-align: middle;
}

.skeleton--row {
  height: 14px;
  margin: 0.3rem 0;
}

.skeleton--block {
  height: 60px;
  display: block;
}

@keyframes skeleton-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

html[data-theme="dark"] .skeleton {
  background: linear-gradient(90deg,
              rgba(140, 168, 200, 0.10) 0%,
              rgba(140, 168, 200, 0.22) 50%,
              rgba(140, 168, 200, 0.10) 100%);
  background-size: 200% 100%;
}

/* ---------- 9. Empty state with icon ---------- */

.empty-state-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 1.4rem 1rem;
  color: var(--text-500);
  text-align: center;
}

.empty-state-block__icon {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(120, 145, 178, 0.12);
  color: var(--text-500);
}

.empty-state-block__icon svg {
  width: 22px;
  height: 22px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.empty-state-block__title {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text-700);
}

.empty-state-block__hint {
  margin: 0;
  font-size: 0.82rem;
  line-height: 1.45;
  max-width: 320px;
}

.empty-state-block__action {
  margin-top: 0.3rem;
}

html[data-theme="dark"] .empty-state-block__icon {
  background: rgba(140, 168, 200, 0.12);
}

/* ---------- 10. Nav: badge slot only (existing underline style preserved) ---------- */

/* Optional badge slot on nav items */
.nav-link__badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 16px;
  height: 16px;
  padding: 0 5px;
  margin-left: 0.32rem;
  border-radius: 999px;
  font-size: 0.66rem;
  font-weight: 700;
  background: var(--danger-600);
  color: #ffffff;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}


/* ============================================================ */
/* Polish v3 — density / weight-bar / col-toggle / context-menu  */
/*           / pagination / autocomplete / print / sparkline      */
/* ============================================================ */

/* ---------- Density modes ---------- */

body.density-comfortable table.table thead th { padding: 0.55rem 0.65rem; }
body.density-comfortable table.table tbody td { padding: 0.52rem 0.65rem; font-size: 0.9rem; }
body.density-comfortable .compact-card .card-body { padding: 0.7rem 0.85rem; }

body.density-compact table.table thead th { padding: 0.32rem 0.5rem; font-size: 0.7rem; }
body.density-compact table.table tbody td { padding: 0.28rem 0.5rem; font-size: 0.82rem; }
body.density-compact .compact-card .card-body { padding: 0.42rem 0.55rem; }

body.density-min table.table thead th { padding: 0.2rem 0.42rem; font-size: 0.66rem; line-height: 1.1; }
body.density-min table.table tbody td { padding: 0.18rem 0.42rem; font-size: 0.78rem; line-height: 1.18; }
body.density-min .compact-card .card-body { padding: 0.32rem 0.45rem; }
body.density-min .summary-strip__item { padding: 0.5rem 0.6rem; }

/* Density switcher pill */
.density-switch {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 2px;
  border-radius: 7px;
  border: 1px solid var(--surface-border);
  background: var(--surface-muted);
}

.density-switch__btn {
  border: 0;
  background: transparent;
  width: 22px;
  height: 18px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-500);
  cursor: pointer;
  padding: 0;
}

.density-switch__btn svg {
  width: 12px;
  height: 12px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
}

.density-switch__btn.is-active {
  background: var(--brand-700);
  color: #ffffff;
}

.density-switch__btn:hover:not(.is-active) {
  background: rgba(120, 145, 178, 0.12);
  color: var(--text-700);
}

/* ---------- Weight bar (inline) ---------- */

.weight-bar {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  min-width: 110px;
  font-variant-numeric: tabular-nums;
}

.weight-bar__track {
  position: relative;
  flex: 1 1 auto;
  height: 6px;
  border-radius: 3px;
  background: rgba(120, 145, 178, 0.16);
  overflow: hidden;
}

.weight-bar__fill {
  position: absolute;
  inset: 0 auto 0 0;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--brand-600), var(--brand-500));
}

.weight-bar__pct {
  flex: 0 0 auto;
  font-size: 0.78rem;
  color: var(--text-700);
  min-width: 42px;
  text-align: right;
}

html[data-theme="dark"] .weight-bar__track {
  background: rgba(140, 168, 200, 0.14);
}

html[data-theme="dark"] .weight-bar__fill {
  background: linear-gradient(90deg, #60a5fa, #3b82f6);
}

/* ---------- Sparkline ---------- */

.spark {
  display: inline-block;
  vertical-align: middle;
  width: 76px;
  height: 22px;
}

.spark canvas {
  width: 100%;
  height: 100%;
  display: block;
}

/* ---------- Column toggle popover ---------- */

.col-toggle {
  position: relative;
  display: inline-block;
}

.col-toggle__btn {
  min-width: 32px;
  height: 32px;
  padding: 0 0.55rem;
  gap: 0.32rem;
  border-radius: 7px;
  border: 1px solid var(--surface-border-strong);
  background: var(--surface-strong);
  color: var(--text-500);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.76rem;
  font-weight: 700;
}

.col-toggle__btn svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
}

.col-toggle__label {
  line-height: 1;
  white-space: nowrap;
}

.col-toggle__menu {
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  z-index: 1080;
  min-width: 180px;
  max-height: min(320px, calc(100vh - 24px));
  overflow-y: auto;
  padding: 6px;
  border-radius: 8px;
  border: 1px solid var(--surface-border);
  background: var(--surface-strong);
  box-shadow: var(--surface-shadow);
  display: none;
}

.col-toggle.is-open .col-toggle__menu { display: block; }

.col-toggle__item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.32rem 0.4rem;
  border-radius: 5px;
  font-size: 0.82rem;
  color: var(--text-700);
  cursor: pointer;
  user-select: none;
}

.col-toggle__item:hover { background: rgba(120, 145, 178, 0.10); }

.col-toggle__item input { margin: 0; }

/* Hidden columns */
table.table th.col-hidden,
table.table td.col-hidden { display: none !important; }

/* ---------- Mobile card tables (opt-in) ---------- */

@media (max-width: 767.98px) {
  table[data-mobile-card="1"] {
    display: block;
    width: 100%;
  }

  table[data-mobile-card="1"] thead {
    display: none;
  }

  table[data-mobile-card="1"] tbody {
    display: grid;
    gap: 0.72rem;
  }

  table[data-mobile-card="1"] tbody tr {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.44rem 0.68rem;
    padding: 0.72rem;
    border: 1px solid var(--surface-border);
    border-radius: 14px;
    background: var(--surface-strong);
    box-shadow: 0 10px 22px rgba(27, 42, 66, 0.08);
  }

  table[data-mobile-card="1"] tbody tr.paginate-hidden {
    display: none;
  }

  table[data-mobile-card="1"] tbody tr.mobile-card-empty-row {
    display: block;
    grid-template-columns: none;
  }

  table[data-mobile-card="1"] tbody td {
    display: flex;
    min-width: 0;
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-start;
    gap: 0.16rem;
    padding: 0 !important;
    border: 0;
    background: transparent;
    white-space: normal;
    word-break: break-word;
    overflow-wrap: anywhere;
    font-size: 0.82rem;
  }

  table[data-mobile-card="1"] tbody td.col-hidden {
    display: none !important;
  }

  table[data-mobile-card="1"] tbody td::before {
    content: attr(data-label);
    color: var(--text-500);
    font-size: 0.66rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
  }

  table[data-mobile-card="1"] tbody td[data-mobile-priority="primary"] {
    grid-column: 1 / -1;
    font-size: 1rem;
    font-weight: 800;
  }

  table[data-mobile-card="1"] tbody td[data-mobile-priority="primary"]::before {
    font-size: 0.7rem;
  }

  table[data-mobile-card="1"] tbody td[data-mobile-priority="action"] {
    grid-column: 1 / -1;
    padding-top: 0.34rem !important;
    border-top: 1px dashed var(--surface-border);
  }

  table[data-mobile-card="1"] tbody td[data-mobile-priority="action"] .toolbar-row,
  table[data-mobile-card="1"] tbody td[data-mobile-priority="action"] .btn {
    width: 100%;
  }

  table[data-mobile-card="1"] tbody td[data-mobile-priority="action"] .toolbar-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.5rem;
  }

  table[data-mobile-card="1"] tbody td[data-mobile-priority="action"] .btn {
    min-height: 36px;
    white-space: normal;
  }

  table[data-mobile-card="1"] tbody td[data-mobile-priority="meta"] {
    color: var(--text-500);
    font-size: 0.76rem;
  }

  table[data-mobile-card="1"] input.form-control-sm,
  table[data-mobile-card="1"] select.form-select-sm {
    width: 100% !important;
    min-height: 34px;
  }

  table[data-mobile-card="1"][data-table-id="positionsCurrent"] tbody tr,
  table[data-mobile-card="1"].trade-ticket-mobile-table tbody tr {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding: 0.82rem;
  }

  table[data-mobile-card="1"].trade-ticket-mobile-table tbody tr.table-light {
    background: rgba(59, 130, 246, 0.08);
  }

  table[data-mobile-card="1"].trade-ticket-mobile-table tbody tr.table-light td:first-child {
    display: none !important;
  }

  table[data-mobile-card="1"].trade-ticket-mobile-table tbody tr.table-light td:nth-child(2) {
    grid-column: 1 / -1;
    font-weight: 800;
  }

  table[data-mobile-card="1"].trade-ticket-mobile-table tbody td[data-mobile-col="code"],
  table[data-mobile-card="1"].trade-ticket-mobile-table tbody td[data-mobile-col="name"],
  table[data-mobile-card="1"][data-table-id="positionsCurrent"] tbody td[data-mobile-col="code"],
  table[data-mobile-card="1"][data-table-id="positionsCurrent"] tbody td[data-mobile-col="name"] {
    grid-column: auto;
    font-size: 0.95rem;
  }

  table[data-mobile-card="1"][data-table-id="positionsCurrent"] tbody td[data-mobile-col="ops"] {
    grid-column: 1 / -1;
  }

  .trade-ticket-section.table-wrap {
    padding: 0.7rem !important;
  }

  .trade-ticket-section .strategy-total-input {
    width: 132px !important;
  }

  .trade-ticket-table-box {
    overflow: visible;
  }

  @media (max-width: 380px) {
    table[data-mobile-card="1"] tbody td[data-mobile-priority="action"] .toolbar-row {
      grid-template-columns: 1fr;
    }
  }

  .table-paginate {
    padding: 0.55rem 0.1rem 0.1rem;
  }
}

/* ---------- Context menu (right-click) ---------- */

.ctx-menu {
  position: fixed;
  z-index: 1080;
  min-width: 168px;
  padding: 4px;
  border-radius: 8px;
  border: 1px solid var(--surface-border);
  background: var(--surface-strong);
  box-shadow: var(--surface-shadow);
  font-size: 0.84rem;
  color: var(--text-900);
  animation: ctx-menu-in 0.12s ease-out 1;
}

@keyframes ctx-menu-in {
  from { opacity: 0; transform: translateY(-4px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.ctx-menu__item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.42rem 0.6rem;
  border-radius: 5px;
  cursor: pointer;
  white-space: nowrap;
}

.ctx-menu__item:hover { background: rgba(59, 130, 246, 0.10); }

.ctx-menu__item.is-danger { color: var(--danger-600); }
.ctx-menu__item.is-danger:hover { background: rgba(220, 38, 38, 0.10); }

.ctx-menu__sep {
  height: 1px;
  margin: 4px 2px;
  background: var(--surface-border);
}

/* ---------- Pagination footer ---------- */

.table-paginate {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  padding: 0.4rem 0.55rem;
  border-top: 1px solid var(--surface-border);
  font-size: 0.8rem;
  color: var(--text-500);
  font-variant-numeric: tabular-nums;
}

.table-paginate__info {
  flex: 1 1 auto;
}

.table-paginate__controls {
  display: inline-flex;
  align-items: center;
  gap: 0.32rem;
}

.table-paginate__btn {
  width: 26px;
  height: 26px;
  border-radius: 5px;
  border: 1px solid var(--surface-border-strong);
  background: var(--surface-strong);
  color: var(--text-700);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.table-paginate__btn:disabled,
.table-paginate__btn.is-disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.table-paginate__btn:not(:disabled):hover {
  background: rgba(59, 130, 246, 0.08);
  border-color: #5e95df;
}

.table-paginate__pagesize {
  border-radius: 5px;
  border: 1px solid var(--surface-border-strong);
  padding: 1px 4px;
  background: var(--surface-strong);
  color: var(--text-700);
  font-size: 0.78rem;
}

/* Hide rows beyond current page */
table.table tbody tr.paginate-hidden { display: none; }

/* ---------- Autocomplete ---------- */

.symbol-search {
  position: relative;
  display: inline-block;
  width: 100%;
  max-width: 280px;
}

.symbol-search__input {
  width: 100%;
}

.symbol-search__menu {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  z-index: 60;
  max-height: 280px;
  overflow: auto;
  padding: 4px;
  border-radius: 8px;
  border: 1px solid var(--surface-border);
  background: var(--surface-strong);
  box-shadow: var(--surface-shadow);
  display: none;
}

.symbol-search.is-open .symbol-search__menu { display: block; }

.symbol-search__item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.36rem 0.5rem;
  border-radius: 5px;
  font-size: 0.84rem;
  color: var(--text-900);
  cursor: pointer;
  font-variant-numeric: tabular-nums;
}

.symbol-search__item.is-active,
.symbol-search__item:hover { background: rgba(59, 130, 246, 0.10); }

.symbol-search__code {
  font-family: var(--mono-font);
  color: var(--text-700);
  min-width: 64px;
}

.symbol-search__hi {
  background: rgba(245, 158, 11, 0.30);
  color: inherit;
  padding: 0 1px;
  border-radius: 2px;
}

/* ---------- Print ---------- */

@media print {
  html, body { background: #ffffff !important; color: #000 !important; }
  body { font-size: 11pt; }
  .navbar, .market-statusbar-wrap, .mobile-tabbar, .app-toast-stack,
  .section-actions, .page-actions, .toolbar-row,
  .col-toggle, .table-paginate, .density-switch, button, .btn,
  .skip-link, .empty-state-block__action {
    display: none !important;
  }
  .app-shell, .container, .container-fluid { max-width: 100% !important; padding: 0 !important; }
  .card, .compact-card, .surface-accent, .app-panel-card {
    border: 1px solid #999 !important;
    background: #fff !important;
    box-shadow: none !important;
    page-break-inside: avoid;
    overflow: visible !important;
  }
  .card-header { background: #f3f3f3 !important; color: #000 !important; }
  .surface-accent::before, .modal-content::before { display: none !important; }
  table.table { width: 100% !important; }
  table.table thead th { background: #eee !important; color: #000 !important; }
  table.table tbody td { color: #000 !important; border-color: #ccc !important; }
  .kpi-positive { color: #000 !important; font-weight: 700; }
  .kpi-negative { color: #000 !important; font-weight: 700; }
  .kpi-positive::before { content: "+ "; }
  .kpi-negative::before { content: "- "; }
  a, a:visited { color: #000 !important; text-decoration: none !important; }
  .panel-scroll, .panel-scroll-sm { max-height: none !important; overflow: visible !important; }
  .chart-stage { page-break-inside: avoid; }
}


/* ---------- Stepper component (for /app/live future split) ---------- */

.stepper {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.55rem;
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-md);
  background: var(--surface-strong);
  font-size: 0.85rem;
  overflow-x: auto;
  scrollbar-width: none;
}

.stepper::-webkit-scrollbar { display: none; }

.stepper__step {
  display: inline-flex;
  align-items: center;
  gap: 0.42rem;
  padding: 0.28rem 0.52rem;
  border-radius: 6px;
  color: var(--text-500);
  white-space: nowrap;
  cursor: pointer;
}

.stepper__step:hover { background: rgba(120, 145, 178, 0.10); color: var(--text-700); }

.stepper__step.is-current {
  background: rgba(59, 130, 246, 0.10);
  color: var(--brand-700);
  font-weight: 700;
}

.stepper__step.is-done { color: var(--text-700); }

.stepper__step.is-done .stepper__num {
  background: var(--success-600);
  border-color: var(--success-600);
  color: #ffffff;
}

.stepper__step.is-done .stepper__num::before { content: "✓"; }
.stepper__step.is-done .stepper__num span { display: none; }

.stepper__num {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1.5px solid currentColor;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--mono-font);
  font-size: 0.74rem;
  font-weight: 700;
  background: transparent;
}

.stepper__step.is-current .stepper__num {
  background: var(--brand-600);
  border-color: var(--brand-600);
  color: #ffffff;
}

.stepper__sep {
  flex: 0 0 auto;
  width: 18px;
  height: 1px;
  background: var(--surface-border);
}


/* col-toggle header actions */
.card-header { position: relative; }
.card-header--with-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  column-gap: 0.75rem;
}
.card-header--with-actions > :not(.section-actions) {
  grid-column: 1;
  min-width: 0;
}
.card-header--with-actions > .section-actions {
  grid-column: 2;
  grid-row: 1 / span 10;
  align-self: start;
}
.section-actions--generated {
  margin-left: auto;
  justify-content: flex-end;
}

@media (max-width: 575.98px) {
  .card-header--with-actions {
    column-gap: 0.5rem;
  }
  .col-toggle__btn {
    width: 32px;
    padding: 0;
  }
  .col-toggle__label {
    display: none;
  }
}

/* keep arrow + number on one line */
.kpi-positive, .kpi-negative, .num-up, .num-down, .num-flat { white-space: nowrap; }
table.table td.kpi-positive,
table.table td.kpi-negative,
table.table td.num-up,
table.table td.num-down,
table.table td.num-flat { white-space: nowrap; }
