:root {
  color-scheme: light dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #0f172a;
  color: #e2e8f0;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at top left, rgba(14, 165, 233, 0.16), transparent 34rem),
    radial-gradient(circle at bottom right, rgba(34, 197, 94, 0.1), transparent 30rem),
    #0f172a;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select {
  font: inherit;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 18px clamp(18px, 4vw, 48px);
  border-bottom: 1px solid rgba(148, 163, 184, 0.18);
  background: rgba(15, 23, 42, 0.78);
  backdrop-filter: blur(18px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.04em;
}

.nav-links,
.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.nav-links a,
.link-button {
  color: #cbd5e1;
}

.link-button {
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.nav-dropdown {
  position: relative;
}

.nav-dropdown summary {
  color: #cbd5e1;
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.nav-dropdown summary::-webkit-details-marker {
  display: none;
}

.nav-dropdown summary::after {
  content: ' ▾';
  font-size: 11px;
  opacity: 0.7;
}

.nav-dropdown[open] summary {
  color: #f8fafc;
}

.nav-dropdown-menu {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  display: flex;
  flex-direction: column;
  min-width: 180px;
  padding: 8px;
  gap: 2px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.97);
  box-shadow: 0 18px 40px rgba(2, 6, 23, 0.55);
  z-index: 20;
}

.nav-dropdown-menu a {
  padding: 7px 10px;
  border-radius: 8px;
  color: #cbd5e1;
}

.nav-dropdown-menu a:hover {
  background: rgba(148, 163, 184, 0.14);
  text-decoration: none;
}

.app-shell {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 32px;
}

.intro-card {
  width: min(100%, 720px);
  padding: clamp(28px, 7vw, 64px);
  border: 1px solid rgba(148, 163, 184, 0.24);
  border-radius: 28px;
  background: linear-gradient(145deg, rgba(15, 23, 42, 0.92), rgba(30, 41, 59, 0.82));
  box-shadow: 0 24px 80px rgba(2, 6, 23, 0.4);
}

.intro-card h1 {
  margin: 0 0 16px;
  font-size: clamp(40px, 8vw, 84px);
  line-height: 0.95;
  letter-spacing: -0.06em;
}

.intro-card p {
  max-width: 560px;
  margin: 0;
  color: #cbd5e1;
  font-size: clamp(18px, 3vw, 22px);
  line-height: 1.55;
}

.page-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: clamp(28px, 5vw, 56px) 0;
}

.page-shell.narrow {
  width: min(520px, calc(100% - 32px));
}

.page-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
}

.page-header h1,
.panel h1,
.panel h2 {
  margin: 0 0 10px;
  letter-spacing: -0.04em;
}

.page-header p,
.panel p,
.list-item span,
.hint {
  color: #94a3b8;
}

.eyebrow {
  margin: 0 0 8px;
  color: #38bdf8;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.panel {
  padding: 24px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 24px;
  background: rgba(15, 23, 42, 0.82);
  box-shadow: 0 20px 70px rgba(2, 6, 23, 0.28);
}

.grid {
  display: grid;
  gap: 18px;
}

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

.form {
  display: grid;
  gap: 16px;
}

.form label,
.chart-controls label {
  display: grid;
  gap: 8px;
  color: #cbd5e1;
  font-size: 14px;
  font-weight: 650;
}

.form input,
.form select,
.chart-controls select {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 14px;
  background: rgba(15, 23, 42, 0.88);
  color: #e2e8f0;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 16px;
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.72);
  color: #e2e8f0;
  cursor: pointer;
}

.button-primary {
  border-color: rgba(56, 189, 248, 0.72);
  background: linear-gradient(135deg, #0284c7, #22c55e);
  color: white;
  font-weight: 750;
}

.button.small {
  min-height: 34px;
  padding: 0 12px;
  font-size: 13px;
}

.list {
  display: grid;
  gap: 12px;
}

.list-item {
  display: grid;
  gap: 6px;
  padding: 16px;
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: 18px;
  background: rgba(30, 41, 59, 0.48);
}

.list-item.wide {
  grid-template-columns: 1fr auto;
  align-items: center;
}

.exchange-account-card {
  gap: 16px;
}

.exchange-account-card-header,
.account-balances-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
}

.exchange-account-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.account-balances {
  display: grid;
  gap: 12px;
  padding-top: 14px;
  border-top: 1px solid rgba(148, 163, 184, 0.14);
}

.account-balances-header h3 {
  margin: 0;
  color: #e2e8f0;
  font-size: 16px;
}

.balance-sync-meta,
.balance-empty {
  color: #94a3b8;
  font-size: 13px;
}

.balance-table-wrap {
  overflow-x: auto;
  border: 1px solid rgba(148, 163, 184, 0.14);
  border-radius: 12px;
}

.balance-table {
  width: 100%;
  min-width: 880px;
  border-collapse: collapse;
  font-size: 13px;
}

.balance-table th,
.balance-table td {
  padding: 11px 12px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.12);
  color: #e2e8f0;
  text-align: right;
  vertical-align: middle;
  font-variant-numeric: tabular-nums;
}

.balance-table th:first-child,
.balance-table td:first-child,
.balance-table th:nth-child(2),
.balance-table td:nth-child(2),
.balance-table th:nth-child(7),
.balance-table td:nth-child(7),
.balance-table th:last-child,
.balance-table td:last-child {
  text-align: left;
}

.balance-table th {
  color: #94a3b8;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.balance-table tbody tr:last-child td {
  border-bottom: 0;
}

.balance-table td:first-child {
  display: grid;
  gap: 3px;
}

.balance-table td:first-child span,
.balance-table td:nth-child(5) span {
  color: #94a3b8;
}

.balance-status {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border: 1px solid rgba(148, 163, 184, 0.24);
  border-radius: 999px;
  color: #cbd5e1;
  font-size: 12px;
  font-weight: 750;
}

.balance-status.fresh {
  border-color: rgba(34, 197, 94, 0.4);
  color: #86efac;
}

.balance-status.stale {
  border-color: rgba(250, 204, 21, 0.4);
  color: #fde68a;
}

.profile-page {
  width: min(1320px, calc(100% - 32px));
}

.profile-orders-panel {
  display: grid;
  gap: 18px;
  margin-top: 18px;
}

.profile-orders-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
}

.profile-orders-header h2 {
  margin: 0;
  color: #e2e8f0;
  font-size: 20px;
}

.profile-orders-header p {
  margin: 4px 0 0;
}

.profile-orders-count {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 8px;
  color: #94a3b8;
  font-size: 12px;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
}

.profile-orders-filter-form {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr)) auto;
  align-items: end;
  gap: 12px;
}

.profile-orders-filter-form label {
  display: grid;
  gap: 8px;
  color: #cbd5e1;
  font-size: 13px;
  font-weight: 750;
}

.profile-orders-filter-form select {
  width: 100%;
  min-height: 40px;
  padding: 9px 11px;
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.88);
  color: #e2e8f0;
}

.profile-orders-filter-actions,
.profile-order-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.profile-orders-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  border-top: 1px solid rgba(148, 163, 184, 0.16);
  border-left: 1px solid rgba(148, 163, 184, 0.16);
}

.profile-orders-summary div {
  display: grid;
  gap: 6px;
  min-height: 96px;
  padding: 14px;
  border-right: 1px solid rgba(148, 163, 184, 0.16);
  border-bottom: 1px solid rgba(148, 163, 184, 0.16);
}

.profile-orders-summary span,
.profile-orders-summary em {
  color: #94a3b8;
}

.profile-orders-summary span {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.profile-orders-summary strong {
  color: #e2e8f0;
  font-size: 22px;
  font-weight: 850;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.profile-orders-summary strong.positive {
  color: #22c55e;
}

.profile-orders-summary strong.negative {
  color: #ef4444;
}

.profile-orders-summary em {
  font-size: 12px;
  font-style: normal;
  line-height: 1.35;
}

.profile-orders-list {
  display: grid;
  gap: 8px;
}

.profile-orders-list-head,
.profile-order-summary {
  display: grid;
  grid-template-columns: minmax(140px, 1fr) 116px minmax(100px, 0.8fr) 64px minmax(120px, 0.9fr) minmax(94px, 0.7fr) minmax(150px, 1fr) minmax(170px, 1.1fr);
  gap: 10px;
  align-items: center;
}

.profile-orders-list-head {
  padding: 0 14px 0 48px;
  color: #94a3b8;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.profile-orders-list-head a,
.admin-results-table th a,
.server-sort-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
}

.profile-orders-list-head a::after,
.admin-results-table th a::after,
.server-sort-link::after {
  content: "↕";
  color: #64748b;
  font-size: 10px;
}

.profile-orders-list-head a.sorted-asc::after,
.admin-results-table th a.sorted-asc::after,
.server-sort-link.sorted-asc::after {
  content: "↑";
  color: #38bdf8;
}

.profile-orders-list-head a.sorted-desc::after,
.admin-results-table th a.sorted-desc::after,
.server-sort-link.sorted-desc::after {
  content: "↓";
  color: #38bdf8;
}

.profile-order-item {
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.48);
  overflow: hidden;
}

.profile-order-item[open] {
  border-color: rgba(56, 189, 248, 0.32);
  background: rgba(15, 23, 42, 0.66);
}

.profile-order-summary {
  position: relative;
  min-height: 62px;
  padding: 12px 14px 12px 48px;
  cursor: pointer;
  list-style: none;
}

.profile-order-summary::-webkit-details-marker {
  display: none;
}

.profile-order-summary::before {
  content: "+";
  position: absolute;
  top: 20px;
  left: 14px;
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border: 1px solid rgba(148, 163, 184, 0.24);
  border-radius: 999px;
  color: #94a3b8;
  font-weight: 800;
}

.profile-order-item[open] .profile-order-summary::before {
  content: "-";
  color: #38bdf8;
}

.profile-order-summary span {
  color: #e2e8f0;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.profile-order-summary > span {
  display: grid;
  gap: 3px;
}

.profile-order-summary strong {
  color: #e2e8f0;
  font-size: 13px;
}

.profile-order-summary em,
.profile-order-detail-grid span,
.profile-order-events span,
.profile-order-events em {
  color: #94a3b8;
  font-size: 12px;
  font-style: normal;
}

.profile-order-summary .long {
  color: #22c55e;
}

.profile-order-summary .short {
  color: #ef4444;
}

.profile-order-details {
  display: grid;
  gap: 16px;
  padding: 16px;
  border-top: 1px solid rgba(148, 163, 184, 0.14);
  background: rgba(2, 6, 23, 0.18);
}

.profile-order-detail-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.profile-order-detail-grid div {
  display: grid;
  gap: 5px;
  min-height: 64px;
  padding: 10px;
  border: 1px solid rgba(148, 163, 184, 0.14);
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.42);
}

.profile-order-detail-grid strong {
  overflow-wrap: anywhere;
  color: #e2e8f0;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.profile-order-subsection {
  display: grid;
  gap: 10px;
}

.profile-order-subsection h3 {
  margin: 0;
  color: #e2e8f0;
  font-size: 15px;
}

.profile-order-mini-table-wrap {
  overflow-x: auto;
  border: 1px solid rgba(148, 163, 184, 0.14);
  border-radius: 8px;
}

.profile-order-mini-table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
  font-size: 12px;
}

.profile-order-mini-table th,
.profile-order-mini-table td {
  padding: 9px 10px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.12);
  color: #e2e8f0;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.profile-order-mini-table th:first-child,
.profile-order-mini-table td:first-child,
.profile-order-mini-table th:nth-child(2),
.profile-order-mini-table td:nth-child(2) {
  text-align: left;
}

.profile-order-mini-table th {
  color: #94a3b8;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.profile-order-events {
  display: grid;
  gap: 8px;
}

.profile-order-events div {
  display: grid;
  gap: 4px;
  padding: 10px;
  border: 1px solid rgba(148, 163, 184, 0.14);
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.42);
}

.profile-order-events strong {
  color: #e2e8f0;
  font-size: 13px;
}

.order-status-badge {
  display: inline-flex;
  align-items: center;
  width: max-content;
  min-height: 26px;
  padding: 0 9px;
  border: 1px solid rgba(148, 163, 184, 0.24);
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.72);
  color: #cbd5e1;
  font-size: 12px;
  font-weight: 750;
}

.order-status-badge.pending_submit,
.order-status-badge.submitted,
.order-status-badge.accepted,
.order-status-badge.executing,
.order-status-badge.cancel_requested {
  border-color: rgba(56, 189, 248, 0.4);
  color: #7dd3fc;
}

.order-status-badge.partially_filled {
  border-color: rgba(250, 204, 21, 0.42);
  color: #fde68a;
}

.order-status-badge.filled {
  border-color: rgba(34, 197, 94, 0.42);
  color: #86efac;
}

.order-status-badge.protected,
.order-status-badge.closed_tp,
.order-status-badge.all_done {
  border-color: rgba(34, 197, 94, 0.42);
  color: #86efac;
}

.order-status-badge.unprotected,
.order-status-badge.exit_failed {
  border-color: rgba(250, 204, 21, 0.42);
  color: #fde68a;
}

.order-status-badge.closed_sl {
  border-color: rgba(239, 68, 68, 0.42);
  color: #fca5a5;
}

.order-status-badge.closed_exit {
  border-color: rgba(148, 163, 184, 0.42);
  color: #cbd5e1;
}

.order-status-badge.canceled,
.order-status-badge.rejected,
.order-status-badge.expired,
.order-status-badge.failed,
.order-status-badge.sync_lost {
  border-color: rgba(239, 68, 68, 0.42);
  color: #fca5a5;
}

.listing-pagination-meta,
.listing-pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: #94a3b8;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.listing-pagination {
  justify-content: flex-end;
}

.listing-pagination-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 0 12px;
  border: 1px solid rgba(148, 163, 184, 0.24);
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.72);
  color: #cbd5e1;
  cursor: pointer;
  font-size: 12px;
  font-weight: 750;
}

.listing-pagination-button.disabled {
  cursor: default;
  opacity: 0.45;
}

.auto-trading-config-card {
  display: grid;
  gap: 16px;
}

.auto-trading-form {
  display: grid;
  gap: 18px;
}

.auto-trading-settings-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.auto-trading-settings-grid label {
  display: grid;
  gap: 8px;
  color: #cbd5e1;
  font-size: 13px;
  font-weight: 750;
}

.auto-trading-settings-grid input,
.auto-trading-settings-grid select {
  width: 100%;
  min-height: 40px;
  padding: 9px 11px;
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.88);
  color: #e2e8f0;
}

.auto-trading-settings-grid .toggle-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
}

.auto-trading-settings-grid .toggle-row input {
  width: auto;
  min-height: auto;
}

.risk-mode-field[hidden] {
  display: none;
}

.setting-label {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.setting-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 40px;
  color: #cbd5e1;
  font-size: 13px;
  font-weight: 750;
}

.setting-toggle-row .toggle-row {
  flex: 1;
}

.setting-help-button {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  padding: 0;
  border: 1px solid rgba(56, 189, 248, 0.42);
  border-radius: 999px;
  background: rgba(14, 165, 233, 0.12);
  color: #bae6fd;
  cursor: pointer;
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
}

.setting-help-button:hover,
.setting-help-button:focus-visible {
  border-color: rgba(56, 189, 248, 0.78);
  background: rgba(14, 165, 233, 0.22);
  outline: none;
}

.settings-popover-backdrop[hidden] {
  display: none;
}

.settings-popover-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(2, 6, 23, 0.68);
  backdrop-filter: blur(10px);
}

.settings-popover-panel {
  display: grid;
  gap: 14px;
  width: min(100%, 480px);
  padding: 20px;
  border: 1px solid rgba(148, 163, 184, 0.24);
  border-radius: 8px;
  background: #0f172a;
  box-shadow: 0 24px 90px rgba(2, 6, 23, 0.58);
}

.settings-popover-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.settings-popover-header h2 {
  margin: 0;
  color: #e2e8f0;
  font-size: 18px;
  line-height: 1.2;
}

.settings-popover-close {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid rgba(148, 163, 184, 0.24);
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.86);
  color: #cbd5e1;
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
}

.settings-popover-close:hover,
.settings-popover-close:focus-visible {
  border-color: rgba(56, 189, 248, 0.62);
  color: #f8fafc;
  outline: none;
}

.settings-popover-panel p {
  margin: 0;
  color: #cbd5e1;
  font-size: 14px;
  line-height: 1.55;
}

.settings-popover-example {
  display: grid;
  gap: 6px;
  padding: 12px;
  border: 1px solid rgba(34, 197, 94, 0.22);
  border-radius: 8px;
  background: rgba(22, 163, 74, 0.1);
}

.settings-popover-example span {
  color: #86efac;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.risk-preset-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.risk-preset-card {
  display: grid;
  gap: 5px;
  min-height: 94px;
  padding: 12px;
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.42);
}

.risk-preset-card.active {
  border-color: rgba(56, 189, 248, 0.58);
  background: rgba(14, 165, 233, 0.12);
}

.risk-preset-card strong {
  color: #e2e8f0;
  font-size: 14px;
}

.risk-preset-card span,
.risk-preset-card small {
  color: #94a3b8;
  font-size: 12px;
  line-height: 1.35;
}

.auto-trading-overrides {
  display: grid;
  gap: 16px;
}

.auto-trading-overrides h3 {
  margin: 0 0 10px;
  color: #e2e8f0;
  font-size: 15px;
}

.setting-chip-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

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

.setting-chip-grid.pairs {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  max-height: 260px;
  overflow: auto;
  padding-right: 4px;
}

.setting-chip-grid label {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 8px 10px;
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.44);
  color: #cbd5e1;
  font-size: 13px;
}

.setting-chip-grid .pair-symbol {
  font-weight: 800;
}

.setting-chip-grid .pair-market-label {
  color: #94a3b8;
  font-size: 12px;
  font-weight: 700;
}

.strategy-setting-grid {
  display: grid;
  gap: 8px;
}

.strategy-setting-row {
  display: grid;
  grid-template-columns: 72px minmax(180px, 1fr) minmax(160px, 220px);
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 8px 10px;
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.44);
}

.strategy-setting-row span {
  color: #cbd5e1;
  font-size: 13px;
  font-weight: 750;
}

.strategy-setting-row select {
  width: 100%;
  min-height: 36px;
  padding: 8px 10px;
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.88);
  color: #e2e8f0;
}

.checkboxes {
  display: flex;
  gap: 14px;
}

.checkboxes label {
  display: flex;
  align-items: center;
  gap: 8px;
}

.flash {
  width: min(1180px, calc(100% - 32px));
  margin: 16px auto 0;
  padding: 12px 16px;
  border-radius: 14px;
}

.flash-notice {
  background: rgba(34, 197, 94, 0.16);
  color: #bbf7d0;
}

.flash-alert,
.form-errors {
  background: rgba(239, 68, 68, 0.16);
  color: #fecaca;
}

.form-errors {
  padding: 12px 14px;
  border-radius: 14px;
}

.chart-controls {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 18px;
}

.chart-panel {
  padding: 0;
  overflow: hidden;
}

.chart-status {
  padding: 14px 18px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.16);
  color: #94a3b8;
}

.chart-toggle {
  display: flex !important;
  flex-direction: row !important;
  align-items: center;
  gap: 8px;
  align-self: end;
  padding-bottom: 10px;
}

.chart-toggle input[type="checkbox"] {
  width: auto;
  margin: 0;
}

.signal-explanation-details {
  margin: 8px 0 0;
  padding-left: 18px;
  display: grid;
  gap: 4px;
  font-size: 0.86rem;
  color: #7d8aa3;
}

.chart-container {
  position: relative;
  min-height: 620px;
}

.strategy-performance {
  border-top: 1px solid rgba(148, 163, 184, 0.16);
  background: rgba(2, 6, 23, 0.18);
}

.signal-history {
  border-top: 1px solid rgba(148, 163, 184, 0.16);
  background: rgba(15, 23, 42, 0.58);
}

.chart-positions {
  border-top: 1px solid rgba(148, 163, 184, 0.16);
  background: rgba(2, 6, 23, 0.24);
}

.performance-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  padding: 18px;
}

.performance-header.compact {
  align-items: center;
}

.performance-header h2 {
  margin: 0;
  color: #e2e8f0;
  font-size: 18px;
  line-height: 1.2;
}

.performance-kicker {
  margin: 0 0 6px;
  color: #38bdf8;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.performance-filters {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.performance-filter {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.58);
  color: #94a3b8;
  font-size: 12px;
  white-space: nowrap;
}

.performance-filter strong {
  color: #e2e8f0;
  font-weight: 750;
}

.performance-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-top: 1px solid rgba(148, 163, 184, 0.16);
  border-left: 1px solid rgba(148, 163, 184, 0.16);
}

.performance-metric {
  display: grid;
  gap: 6px;
  min-height: 104px;
  padding: 16px;
  border-right: 1px solid rgba(148, 163, 184, 0.16);
  border-bottom: 1px solid rgba(148, 163, 184, 0.16);
}

.performance-metric span,
.performance-metric em,
.performance-loading,
.performance-empty {
  color: #94a3b8;
}

.performance-metric span {
  font-size: 12px;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.performance-metric strong {
  color: #e2e8f0;
  font-size: 26px;
  font-weight: 850;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.performance-metric strong.positive {
  color: #22c55e;
}

.performance-metric strong.negative {
  color: #ef4444;
}

.performance-metric em {
  font-size: 12px;
  font-style: normal;
  line-height: 1.35;
}

.performance-loading,
.performance-empty {
  font-size: 14px;
}

.performance-empty {
  padding: 0 18px 18px;
}

.signal-history-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  padding: 18px;
}

.signal-history-header.compact {
  align-items: center;
}

.signal-history-header h2 {
  margin: 0;
  color: #e2e8f0;
  font-size: 18px;
  line-height: 1.2;
}

.chart-positions-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  padding: 18px;
}

.chart-positions-header.compact {
  align-items: center;
}

.chart-positions-header h2 {
  margin: 0;
  color: #e2e8f0;
  font-size: 18px;
  line-height: 1.2;
}

.signal-history-table-wrap {
  overflow-x: auto;
  border-top: 1px solid rgba(148, 163, 184, 0.16);
}

.chart-positions-table-wrap {
  overflow-x: auto;
  border-top: 1px solid rgba(148, 163, 184, 0.16);
}

.signal-history-table {
  width: 100%;
  min-width: 980px;
  border-collapse: collapse;
  font-size: 13px;
}

.chart-positions-table {
  width: 100%;
  min-width: 1140px;
  border-collapse: collapse;
  font-size: 13px;
}

.signal-history-table th,
.signal-history-table td,
.chart-positions-table th,
.chart-positions-table td {
  padding: 12px 10px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.14);
  color: #e2e8f0;
  text-align: right;
  vertical-align: middle;
  font-variant-numeric: tabular-nums;
}

.signal-history-table th:first-child,
.signal-history-table td:first-child,
.signal-history-table th:nth-child(2),
.signal-history-table td:nth-child(2),
.signal-history-table th:nth-child(3),
.signal-history-table td:nth-child(3),
.signal-history-table th:nth-child(4),
.signal-history-table td:nth-child(4),
.signal-history-table th:last-child,
.signal-history-table td:last-child,
.chart-positions-table th:first-child,
.chart-positions-table td:first-child,
.chart-positions-table th:nth-child(2),
.chart-positions-table td:nth-child(2),
.chart-positions-table th:nth-child(3),
.chart-positions-table td:nth-child(3),
.chart-positions-table th:nth-child(4),
.chart-positions-table td:nth-child(4),
.chart-positions-table th:nth-child(5),
.chart-positions-table td:nth-child(5),
.chart-positions-table th:last-child,
.chart-positions-table td:last-child {
  text-align: left;
}

.signal-history-table th,
.chart-positions-table th {
  color: #94a3b8;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.signal-history-table th.sortable,
.chart-positions-table th.sortable {
  cursor: pointer;
  user-select: none;
}

.signal-history-table th.sortable::after,
.chart-positions-table th.sortable::after {
  content: "↕";
  display: inline-block;
  margin-left: 6px;
  color: #64748b;
  font-size: 10px;
}

.signal-history-table th.sorted-asc::after,
.chart-positions-table th.sorted-asc::after {
  content: "↑";
  color: #38bdf8;
}

.signal-history-table th.sorted-desc::after,
.chart-positions-table th.sorted-desc::after {
  content: "↓";
  color: #38bdf8;
}

.signal-history-table td:first-child,
.chart-positions-table td:first-child {
  display: grid;
  gap: 3px;
}

.signal-history-table td:first-child span,
.chart-positions-table td:first-child span {
  color: #94a3b8;
}

.signal-history-table tbody tr {
  cursor: pointer;
}

.signal-history-table tbody tr:hover,
.signal-history-table tbody tr.selected {
  background: rgba(30, 41, 59, 0.58);
}

.chart-positions-table tbody tr.settled {
  opacity: 0.48;
}

.chart-positions-table tbody tr.settled:hover {
  opacity: 0.72;
}

.signal-history-table .long,
.chart-positions-table .long {
  color: #22c55e;
}

.signal-history-table .short,
.chart-positions-table .short {
  color: #ef4444;
}

.signal-history-table .positive {
  color: #22c55e;
}

.signal-history-table .negative {
  color: #ef4444;
}

.chart-position-tool-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #94a3b8;
  font-size: 12px;
  font-weight: 750;
}

.chart-position-tool-toggle input {
  position: relative;
  width: 36px;
  height: 20px;
  margin: 0;
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 999px;
  appearance: none;
  background: rgba(15, 23, 42, 0.9);
  cursor: pointer;
  transition: border-color 0.16s ease, background 0.16s ease;
}

.chart-position-tool-toggle input::before {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #94a3b8;
  transition: transform 0.16s ease, background 0.16s ease;
}

.chart-position-tool-toggle input:checked {
  border-color: rgba(34, 197, 94, 0.56);
  background: rgba(34, 197, 94, 0.18);
}

.chart-position-tool-toggle input:checked::before {
  transform: translateX(16px);
  background: #22c55e;
}

.chart-positions-spoiler {
  border-top: 1px solid rgba(148, 163, 184, 0.16);
}

.chart-positions-spoiler summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  color: #94a3b8;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  user-select: none;
}

.chart-positions-spoiler summary::marker {
  color: #38bdf8;
}

.chart-positions-spoiler summary strong {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 26px;
  height: 24px;
  padding: 0 8px;
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 999px;
  color: #cbd5e1;
  font-size: 12px;
  letter-spacing: 0;
}

.signal-status-badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 9px;
  border: 1px solid rgba(148, 163, 184, 0.24);
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.72);
  color: #cbd5e1;
  font-size: 12px;
  font-weight: 750;
}

.signal-status-badge.ready {
  border-color: rgba(56, 189, 248, 0.4);
  color: #7dd3fc;
}

.signal-status-badge.triggered {
  border-color: rgba(250, 204, 21, 0.42);
  color: #fde68a;
}

.signal-status-badge.pending_submit,
.signal-status-badge.submitted,
.signal-status-badge.accepted,
.signal-status-badge.executing,
.signal-status-badge.partially_filled,
.signal-status-badge.cancel_requested {
  border-color: rgba(56, 189, 248, 0.36);
  color: #7dd3fc;
}

.signal-status-badge.protected {
  border-color: rgba(34, 197, 94, 0.42);
  color: #86efac;
}

.signal-status-badge.closed_tp,
.signal-status-badge.all_done {
  border-color: rgba(34, 197, 94, 0.34);
  color: #86efac;
}

.signal-status-badge.closed_sl {
  border-color: rgba(239, 68, 68, 0.34);
  color: #fca5a5;
}

.signal-status-badge.closed_exit {
  border-color: rgba(148, 163, 184, 0.42);
  color: #cbd5e1;
}

.signal-status-badge.unprotected,
.signal-status-badge.exit_failed,
.signal-status-badge.filtered {
  border-color: rgba(250, 204, 21, 0.42);
  color: #fde68a;
}

.signal-status-badge.completed {
  border-color: rgba(34, 197, 94, 0.42);
  color: #86efac;
}

.signal-status-badge.invalidated {
  border-color: rgba(239, 68, 68, 0.42);
  color: #fca5a5;
}

.signal-status-badge.expired,
.signal-status-badge.sync_lost {
  border-color: rgba(148, 163, 184, 0.36);
  color: #cbd5e1;
}

.signal-status-badge.canceled,
.signal-status-badge.rejected,
.signal-status-badge.failed {
  border-color: rgba(239, 68, 68, 0.34);
  color: #fca5a5;
}

.strategy-results-page {
  width: min(1320px, calc(100% - 32px));
}

.observability-events-page {
  width: min(1480px, calc(100% - 32px));
}

.admin-results-hero {
  display: grid;
  grid-template-columns: minmax(180px, 0.8fr) minmax(0, 3.2fr);
  gap: 20px;
  margin-bottom: 18px;
}

.admin-results-title h2 {
  margin: 0;
  color: #e2e8f0;
  font-size: 20px;
}

.admin-results-filters {
  margin-bottom: 18px;
}

.admin-results-refresh-status,
.admin-results-refresh-meta {
  color: #94a3b8;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.admin-results-refresh-meta {
  margin: -4px 0 12px;
}

.admin-results-filter-form {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr)) auto;
  align-items: end;
  gap: 14px;
}

.admin-results-filter-form label {
  display: grid;
  gap: 8px;
  color: #cbd5e1;
  font-size: 13px;
  font-weight: 750;
}

.admin-results-filter-form select,
.admin-results-filter-form input {
  width: 100%;
  min-height: 42px;
  padding: 10px 12px;
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.88);
  color: #e2e8f0;
}

.admin-backtest-form-panel {
  display: grid;
  gap: 18px;
  margin-bottom: 18px;
}

.admin-backtest-form {
  display: grid;
  gap: 22px;
}

.backtest-form-group {
  display: grid;
  gap: 4px;
}

.backtest-form-group .setting-section-title {
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.16);
}

.backtest-form-group-fields {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-items: end;
  gap: 14px;
}

.admin-backtest-form label {
  display: grid;
  gap: 8px;
  color: #cbd5e1;
  font-size: 13px;
  font-weight: 750;
}

.admin-backtest-form input,
.admin-backtest-form select {
  width: 100%;
  min-height: 42px;
  padding: 10px 12px;
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.88);
  color: #e2e8f0;
}

.admin-backtest-form-actions {
  display: flex;
  align-items: center;
}

.admin-results-filter-actions {
  display: flex;
  gap: 8px;
}

.admin-backtest-exclusion-form {
  display: grid;
  gap: 16px;
}

.admin-backtest-exclusion-form fieldset {
  display: grid;
  gap: 10px;
  min-width: 0;
  padding: 0;
  border: 0;
}

.admin-backtest-exclusion-form legend {
  margin-bottom: 8px;
  color: #94a3b8;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.admin-backtest-exclusion-options {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.admin-backtest-exclusion-options label {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 10px 12px;
  border: 1px solid rgba(148, 163, 184, 0.24);
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.72);
  color: #cbd5e1;
  font-size: 13px;
  font-weight: 750;
}

.admin-backtest-exclusion-options input {
  width: 16px;
  height: 16px;
  accent-color: #38bdf8;
}

.admin-results-metrics {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: 8px;
  overflow: hidden;
}

.admin-results-metrics div {
  display: grid;
  gap: 6px;
  min-height: 96px;
  padding: 14px;
  border-right: 1px solid rgba(148, 163, 184, 0.16);
  background: rgba(2, 6, 23, 0.18);
}

.admin-results-metrics div:last-child {
  border-right: 0;
}

.admin-results-metrics span,
.admin-results-metrics em,
.admin-strategy-stats span,
.admin-strategy-card-footer span,
.admin-results-table span {
  color: #94a3b8;
}

.admin-results-metrics span {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.admin-results-metrics strong {
  color: #e2e8f0;
  font-size: 24px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.admin-results-metrics em {
  font-size: 12px;
  font-style: normal;
}

.positive {
  color: #22c55e !important;
}

.negative {
  color: #ef4444 !important;
}

.admin-strategy-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  margin-bottom: 18px;
}

.admin-strategy-card {
  display: grid;
  gap: 16px;
}

.admin-strategy-card-header,
.admin-strategy-card-footer {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 14px;
}

.admin-strategy-card-header h2 {
  margin: 0;
  font-size: 18px;
}

.admin-strategy-card-header > strong {
  color: #22c55e;
  font-size: 28px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.admin-strategy-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.admin-strategy-stats span,
.admin-strategy-card-footer span {
  display: grid;
  gap: 4px;
  font-size: 12px;
}

.admin-strategy-stats strong,
.admin-strategy-card-footer strong {
  color: #e2e8f0;
  font-size: 16px;
  font-variant-numeric: tabular-nums;
}

.admin-results-table-panel {
  display: grid;
  gap: 18px;
}

.admin-results-table-wrap {
  overflow-x: auto;
}

.admin-results-table {
  width: 100%;
  min-width: 980px;
  border-collapse: collapse;
  font-size: 13px;
}

.admin-results-table th,
.admin-results-table td {
  padding: 12px 10px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.14);
  text-align: right;
  vertical-align: middle;
  font-variant-numeric: tabular-nums;
}

.admin-results-table th:first-child,
.admin-results-table td:first-child,
.admin-results-table th:nth-child(2),
.admin-results-table td:nth-child(2) {
  text-align: left;
}

.admin-results-table th {
  color: #94a3b8;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.admin-results-table th.sortable {
  cursor: pointer;
  user-select: none;
}

.admin-results-table th.sortable::after {
  content: "↕";
  display: inline-block;
  margin-left: 6px;
  color: #64748b;
  font-size: 10px;
}

.admin-results-table th.sorted-asc::after {
  content: "↑";
  color: #38bdf8;
}

.admin-results-table th.sorted-desc::after {
  content: "↓";
  color: #38bdf8;
}

.admin-results-table td {
  color: #e2e8f0;
}

.admin-results-table td:first-child {
  display: grid;
  gap: 3px;
}

.admin-results-table tbody tr:hover {
  background: rgba(30, 41, 59, 0.28);
}

.backtest-status-badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 12px;
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 999px;
  color: #cbd5e1;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.backtest-status-badge.completed,
.backtest-status-badge.take_profit {
  border-color: rgba(34, 197, 94, 0.44);
  color: #86efac;
}

.backtest-status-badge.queued,
.backtest-status-badge.running,
.backtest-status-badge.open {
  border-color: rgba(56, 189, 248, 0.44);
  color: #7dd3fc;
}

.backtest-status-badge.pending,
.backtest-status-badge.partial,
.backtest-status-badge.expired,
.backtest-status-badge.skipped {
  border-color: rgba(250, 204, 21, 0.4);
  color: #fde68a;
}

.backtest-status-badge.failed,
.backtest-status-badge.stop_loss {
  border-color: rgba(239, 68, 68, 0.4);
  color: #fca5a5;
}

.observability-events-filter-form {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.observability-events-table {
  min-width: 1280px;
}

.observability-events-table th:nth-child(3),
.observability-events-table td:nth-child(3),
.observability-events-table th:nth-child(6),
.observability-events-table td:nth-child(6),
.observability-events-table th:nth-child(7),
.observability-events-table td:nth-child(7),
.observability-events-table th:nth-child(9),
.observability-events-table td:nth-child(9),
.observability-events-table th:nth-child(10),
.observability-events-table td:nth-child(10) {
  text-align: left;
}

.observability-events-table td:nth-child(3),
.observability-events-table td:nth-child(6),
.observability-events-table td:nth-child(7),
.observability-events-table td:nth-child(9) {
  display: grid;
  gap: 3px;
}

.observability-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 0 10px;
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 999px;
  color: #cbd5e1;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.observability-badge.info,
.observability-badge.success,
.observability-badge.submitted,
.observability-badge.filled {
  border-color: rgba(34, 197, 94, 0.42);
  color: #86efac;
}

.observability-badge.warning,
.observability-badge.blocked,
.observability-badge.accepted,
.observability-badge.partially_filled {
  border-color: rgba(250, 204, 21, 0.42);
  color: #fde68a;
}

.observability-badge.error,
.observability-badge.failed,
.observability-badge.rejected {
  border-color: rgba(239, 68, 68, 0.42);
  color: #fca5a5;
}

.observability-event-details {
  max-width: 360px;
}

.observability-event-details summary {
  color: #38bdf8;
  cursor: pointer;
  font-weight: 800;
}

.observability-event-details h3 {
  margin: 12px 0 6px;
  color: #94a3b8;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.observability-event-details pre {
  max-height: 260px;
  margin: 0;
  padding: 10px;
  overflow: auto;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 8px;
  background: rgba(2, 6, 23, 0.46);
  color: #cbd5e1;
  font-size: 11px;
  line-height: 1.5;
  text-align: left;
  white-space: pre-wrap;
}

.admin-backtest-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin-bottom: 18px;
}

.admin-backtest-kv {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 18px 0 0;
}

.admin-backtest-kv div {
  display: grid;
  gap: 6px;
  min-height: 72px;
  padding: 12px;
  border: 1px solid rgba(148, 163, 184, 0.14);
  border-radius: 8px;
  background: rgba(2, 6, 23, 0.18);
}

.admin-backtest-kv dt {
  color: #94a3b8;
  font-size: 12px;
  font-weight: 800;
}

.admin-backtest-kv dd {
  margin: 0;
  color: #e2e8f0;
  font-weight: 750;
  overflow-wrap: anywhere;
}

.json-preview summary {
  color: #38bdf8;
  cursor: pointer;
}

.json-preview pre {
  max-width: 640px;
  max-height: 280px;
  margin: 10px 0 0;
  overflow: auto;
  padding: 12px;
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: 8px;
  background: rgba(2, 6, 23, 0.54);
  color: #cbd5e1;
  font-size: 12px;
  text-align: left;
  white-space: pre-wrap;
}

.admin-backtest-trades-table,
.admin-backtest-events-table {
  min-width: 1120px;
}

.admin-backtest-events-table th:last-child,
.admin-backtest-events-table td:last-child {
  text-align: left;
}

.exchange-rate-limits-page {
  width: min(1320px, calc(100% - 32px));
}

.exchange-limit-grid {
  display: grid;
  gap: 18px;
  margin-bottom: 18px;
}

.exchange-limit-card {
  display: grid;
  gap: 16px;
}

.exchange-limit-meter {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(30, 41, 59, 0.86);
}

.exchange-limit-meter span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(135deg, #22c55e, #38bdf8);
}

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

.exchange-limit-warning {
  margin: 0;
  color: #facc15;
}

.exchange-limit-breakdowns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.exchange-limit-table {
  min-width: 520px;
}

.chart-ohlc-legend {
  position: absolute;
  z-index: 3;
  top: 12px;
  left: 12px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  max-width: calc(100% - 24px);
  padding: 8px 10px;
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.82);
  color: #cbd5e1;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
  pointer-events: none;
  backdrop-filter: blur(10px);
}

.chart-ohlc-legend[hidden] {
  display: none;
}

.chart-ohlc-legend strong {
  color: #e2e8f0;
  font-weight: 750;
}

.chart-ohlc-legend strong.up {
  color: #22c55e;
}

.chart-ohlc-legend strong.down {
  color: #ef4444;
}

.chart-ohlc-time {
  color: #94a3b8;
}

code {
  display: block;
  padding: 12px;
  overflow-x: auto;
  border-radius: 12px;
  background: rgba(2, 6, 23, 0.58);
  color: #bae6fd;
}

@media (max-width: 780px) {
  .topbar,
  .page-header {
    align-items: start;
    flex-direction: column;
  }

  .nav-dropdown[open] {
    flex-basis: 100%;
  }

  .nav-dropdown-menu {
    position: static;
    min-width: 0;
    padding: 4px 0 0 12px;
    border: 0;
    background: transparent;
    box-shadow: none;
  }

  .two-columns,
  .chart-controls,
  .performance-grid,
  .admin-results-hero,
  .admin-results-metrics,
  .exchange-limit-metrics,
  .exchange-limit-breakdowns,
  .admin-strategy-grid,
  .admin-results-filter-form,
  .admin-backtest-form,
  .backtest-form-group-fields,
  .admin-backtest-detail-grid,
  .admin-backtest-kv,
  .profile-orders-filter-form,
  .profile-orders-summary,
  .profile-orders-list-head,
  .profile-order-summary,
  .profile-order-detail-grid,
  .auto-trading-settings-grid,
  .risk-preset-grid,
  .setting-chip-grid,
  .setting-chip-grid.compact,
  .setting-chip-grid.pairs,
  .list-item.wide {
    grid-template-columns: 1fr;
  }

  .strategy-setting-row {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .profile-orders-list-head {
    display: none;
  }

  .profile-order-summary::before {
    top: 12px;
  }

  .performance-header {
    align-items: start;
    flex-direction: column;
  }

  .signal-history-header,
  .chart-positions-header {
    align-items: start;
    flex-direction: column;
  }

  .performance-filters {
    justify-content: flex-start;
  }

  .admin-results-metrics div {
    border-right: 0;
    border-bottom: 1px solid rgba(148, 163, 184, 0.16);
  }

  .admin-results-metrics div:last-child {
    border-bottom: 0;
  }
}

.strategy-settings-form {
  display: grid;
  gap: 16px;
}

.strategy-settings-form .strategy-enabled-toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: #cbd5e1;
  font-size: 13px;
  font-weight: 750;
}

.strategy-settings-form .strategy-enabled-toggle input {
  width: 16px;
  height: 16px;
}

.setting-section-title {
  margin: 0 0 8px;
  color: #cbd5e1;
  font-size: 13px;
  font-weight: 750;
}

.setting-hint {
  margin: 0 0 10px;
  color: #94a3b8;
  font-size: 13px;
  line-height: 1.5;
}

.strategy-symbols-warning {
  color: #fbbf24;
}

.strategy-symbols-block {
  display: grid;
  gap: 10px;
  justify-items: start;
}

.strategy-symbols-block .setting-section-title,
.strategy-symbols-block .setting-hint {
  margin: 0;
}

.strategy-settings-form .setting-chip-grid input[type='checkbox'] {
  width: 14px;
  height: 14px;
  flex: none;
}

.admin-backtest-form .backtest-intervals {
  grid-column: 1 / -1;
  display: grid;
  gap: 8px;
}

.admin-backtest-form .setting-chip-grid label {
  display: flex;
  align-items: center;
  gap: 8px;
}

.admin-backtest-form .setting-chip-grid input[type='checkbox'] {
  width: 14px;
  height: 14px;
  min-height: auto;
}

.scan-market-filters {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
}

.scan-market-filters-count {
  margin-left: auto;
  color: #94a3b8;
  font-size: 13px;
}

.scan-verdict-fits {
  color: #34d399;
  font-weight: 750;
}

.scan-verdict-borderline {
  color: #fbbf24;
}

.scan-verdict-unfit {
  color: #64748b;
}

.scan-onboarding-form {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}

.scan-onboarding-form input[type='text'],
.scan-onboarding-form select {
  min-height: 38px;
  padding: 8px 12px;
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.88);
  color: #e2e8f0;
}

.symbol-scan-history {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 6px;
  color: #cbd5e1;
}

.batch-progress {
  display: grid;
  gap: 12px;
}

.batch-progress-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.batch-progress-actions {
  display: flex;
  gap: 8px;
}

.batch-progress-bar {
  height: 10px;
  border-radius: 6px;
  overflow: hidden;
  background: rgba(148, 163, 184, 0.16);
}

.batch-progress-fill {
  height: 100%;
  border-radius: 6px;
  background: #38bdf8;
  transition: width 0.6s ease;
}

.batch-progress-meta {
  margin: 0;
  color: #94a3b8;
  font-size: 13px;
}

.batch-progress-hint {
  display: block;
  margin-top: 4px;
  color: #94a3b8;
  font-size: 12px;
}

.batch-progress-hint.stale {
  color: #f87171;
  font-weight: 700;
}

.batch-run-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 6px 12px;
}

.batch-run-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: #94a3b8;
  min-height: 20px;
}

.batch-run-item.failed { color: #f87171; }
.batch-run-item.completed { color: #4ade80; }
.batch-run-item.pending { opacity: 0.55; }

.batch-run-label {
  min-width: 96px;
  font-weight: 600;
}

.batch-run-bar {
  flex: 1;
  height: 6px;
  border-radius: 4px;
  overflow: hidden;
  background: rgba(148, 163, 184, 0.16);
}

.batch-run-fill {
  display: block;
  height: 100%;
  border-radius: 4px;
  background: #38bdf8;
  transition: width 0.6s ease;
}

.batch-run-pct {
  min-width: 34px;
  text-align: right;
}
