:root {
  --bg: #f5f7f4;
  --panel: #ffffff;
  --ink: #17201a;
  --muted: #6a736c;
  --line: #dfe5dc;
  --accent: #0d7c66;
  --accent-2: #a83c32;
  --gold: #bd8a15;
  --shadow: 0 18px 45px rgba(18, 31, 24, 0.09);
  --sidebar-bezier: cubic-bezier(0.22, 1, 0.36, 1);
}

body[data-theme="dark"] {
  --bg: #0f1412;
  --panel: #171d1a;
  --ink: #eef4ef;
  --muted: #9aa79f;
  --line: #29322d;
  --accent: #52c7a0;
  --accent-2: #ef8d84;
  --gold: #e0b54d;
  --shadow: 0 24px 54px rgba(0, 0, 0, 0.32);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--bg);
  font-family: Inter, "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
  transition: background 0.2s ease, color 0.2s ease;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 0;
  border-radius: 7px;
  padding: 11px 16px;
  color: #fff;
  background: var(--ink);
  cursor: pointer;
}

button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

button:hover {
  background: #243229;
}

body[data-theme="dark"] button {
  color: #ffffff;
  background: #24453a;
}

body[data-theme="dark"] button:hover {
  background: #2c5749;
}

.app-shell {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  min-height: 100vh;
  align-items: start;
  transition: grid-template-columns 0.42s var(--sidebar-bezier);
  will-change: grid-template-columns;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding: 24px;
  background: #101712;
  color: #f8fbf4;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-gutter: stable;
  transition:
    padding 0.42s var(--sidebar-bezier),
    gap 0.42s var(--sidebar-bezier);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  position: relative;
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 7px;
  color: #101712;
  background: linear-gradient(145deg, #e3f7db 0%, #c7eddb 100%);
  font-weight: 800;
  font-size: 14px;
  letter-spacing: 0;
  line-height: 1;
  border: 0;
  cursor: pointer;
  isolation: isolate;
  transition:
    transform 0.32s var(--sidebar-bezier),
    box-shadow 0.24s ease,
    background 0.24s ease;
}

.brand-mark::after {
  content: "";
  position: absolute;
  top: 9px;
  right: 8px;
  width: 8px;
  height: 2px;
  border-radius: 999px;
  background: #a83c32;
  opacity: 0.78;
}

.brand-mark:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.16);
}

.brand-mark:focus-visible {
  outline: 2px solid rgba(217, 240, 206, 0.78);
  outline-offset: 2px;
}

.brand span,
.status-panel span {
  display: block;
  color: #aeb9b0;
  font-size: 13px;
}

.status-panel .network-status.good {
  color: #9fd7b2;
}

.status-panel .network-status.warn {
  color: #f0cf85;
}

.status-panel .network-status.bad {
  color: #f3a39b;
}

.brand-copy strong {
  display: block;
  font-size: 17px;
  letter-spacing: 0;
}

.brand-copy,
.status-panel div,
.sidebar-review {
  opacity: 1;
  transform: translateX(0);
  visibility: visible;
  will-change: opacity, transform;
  transition:
    opacity 0.24s ease,
    transform 0.4s var(--sidebar-bezier),
    visibility 0s linear;
}

.headline-block {
  display: grid;
  gap: 8px;
}

.headline-summary {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.nav {
  display: grid;
  gap: 8px;
}

.nav a {
  display: flex;
  align-items: center;
  color: #dce6da;
  text-decoration: none;
  padding: 11px 12px;
  border-radius: 7px;
  white-space: nowrap;
  overflow: hidden;
  transition:
    width 0.42s var(--sidebar-bezier),
    height 0.42s var(--sidebar-bezier),
    padding 0.42s var(--sidebar-bezier),
    color 0.28s ease,
    background 0.28s ease,
    transform 0.42s var(--sidebar-bezier);
}

.nav a.active,
.nav a:hover {
  color: #101712;
  background: #d9f0ce;
}

.status-panel {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  transition:
    padding 0.56s var(--sidebar-bezier),
    gap 0.56s var(--sidebar-bezier),
    width 0.56s var(--sidebar-bezier);
}

.status-dot {
  width: 10px;
  height: 10px;
  margin-top: 5px;
  border-radius: 50%;
  background: var(--gold);
}

.status-dot.live {
  background: #55c47a;
}

.status-dot.error {
  background: #df5b4f;
}

.workspace {
  display: grid;
  gap: 20px;
  padding: 28px;
}

.topbar,
.panel-heading,
.actions,
.filter-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.topbar h1,
.panel h2 {
  margin: 0;
  letter-spacing: 0;
}

.topbar h1 {
  font-size: clamp(30px, 4vw, 52px);
}

.actions {
  position: relative;
  align-self: flex-start;
}

.top-account-widget {
  position: relative;
  z-index: 20;
}

.account-menu-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 104px;
  height: 42px;
  padding: 0 12px 0 6px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--ink);
  background: #fff;
  font-weight: 800;
}

.account-menu-btn:hover {
  color: var(--ink);
  background: #eef8ed;
}

.account-avatar {
  display: inline-grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border-radius: 50%;
  color: #101712;
  background: #d9f0ce;
  background-position: center;
  background-size: cover;
  font-size: 13px;
  font-weight: 900;
}

.account-avatar.large {
  width: 46px;
  height: 46px;
  font-size: 18px;
}

.account-avatar.has-image {
  color: transparent;
}

.top-account-widget .account-panel {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: min(420px, calc(100vw - 32px));
  max-height: calc(100vh - 96px);
  overflow: auto;
  z-index: 40;
  color: var(--ink);
  background: #fff;
  border-color: var(--line);
  box-shadow: var(--shadow);
}

body[data-theme="dark"] .actions .account-menu-btn,
body[data-theme="dark"] .top-account-widget .account-panel {
  color: #eaf7ef;
  background: rgba(14, 22, 18, 0.96);
  border-color: rgba(213, 255, 224, 0.16);
}

body[data-theme="dark"] .actions .account-menu-btn:hover {
  color: #ffffff;
  background: rgba(82, 199, 160, 0.2);
}

body[data-theme="dark"] .account-avatar {
  color: #dfffe7;
  background: rgba(112, 214, 126, 0.16);
  border-color: rgba(213, 255, 224, 0.18);
}

.account-profile-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: center;
}

.account-sync-panel {
  display: grid;
  gap: 12px;
  margin: 14px 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfa;
}

.account-sync-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.account-sync-head span,
.account-sync-section span,
.account-sync-panel small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.account-sync-head strong,
.account-sync-section strong {
  display: block;
  margin-top: 3px;
  font-size: 15px;
}

.account-sync-section {
  display: grid;
  gap: 7px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.account-sync-details {
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.account-sync-details summary {
  cursor: pointer;
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
}

.account-sync-details summary span {
  float: right;
  color: var(--muted);
}

.avatar-upload {
  display: inline-flex;
  margin-top: 6px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.eyebrow {
  margin: 0 0 7px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.actions select,
input,
textarea {
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--ink);
  background: #fff;
}

.actions select,
input {
  height: 42px;
  padding: 0 12px;
}

.password-field {
  position: relative;
  display: block;
}

.password-field input {
  width: 100%;
  padding-right: 72px;
}

.password-toggle-btn {
  position: absolute;
  top: 6px;
  right: 6px;
  min-width: 58px;
  height: 30px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--ink);
  background: #eef6eb;
  font-size: 13px;
  font-weight: 800;
  line-height: 1;
}

.password-toggle-btn:hover {
  color: var(--ink);
  background: #dff0d9;
}

body[data-theme="dark"] .password-toggle-btn {
  color: #eaf7ef;
  background: rgba(82, 199, 160, 0.16);
  border-color: rgba(213, 255, 224, 0.18);
}

body[data-theme="dark"] .password-toggle-btn:hover {
  background: rgba(82, 199, 160, 0.26);
}

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

.metrics article,
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.metrics article {
  padding: 18px;
}

.metrics span,
.trade-stats span,
.leverage-output span,
.monitor-output span,
.scenario-card span,
.profit-output span,
.position-output span {
  color: var(--muted);
  font-size: 13px;
}

.metrics strong,
.trade-stats strong,
.leverage-output strong,
.monitor-output strong,
.scenario-card strong,
.profit-output strong,
.position-output strong {
  display: block;
  margin-top: 7px;
  font-size: 24px;
}

.sync-actions,
.exchange-bind-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.compact-sync-actions button {
  flex: 1 1 110px;
}

.sync-actions button,
.exchange-bind-row button {
  min-width: 92px;
  height: 38px;
  padding: 0 12px;
  font-weight: 800;
}

.exchange-bind-row button.active {
  color: #fff;
  background: var(--accent);
}

.device-session-list,
.sync-log-list {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.device-session-item,
.sync-log-item {
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  border: 1px solid rgba(27, 44, 35, 0.08);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
}

.device-session-item {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
}

.device-session-item strong,
.sync-log-item strong {
  font-size: 13px;
}

.device-session-item span,
.sync-log-item span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.device-session-item.current {
  border-color: rgba(13, 124, 102, 0.24);
  background: #f0faf4;
}

.panel {
  padding: 20px;
}

.subsection-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-top: 22px;
}

.subsection-heading h3 {
  margin: 0;
}

.subsection-heading span {
  max-width: 520px;
  color: var(--muted);
  font-size: 13px;
  text-align: right;
}

.compact-heading {
  margin-top: 18px;
}

.filter-row label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
}

.scanner-controls {
  display: grid;
  gap: 10px;
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fbfcfa;
}

.api-source-box {
  display: grid;
  gap: 8px;
  justify-items: end;
  flex: 1;
  min-width: 360px;
}

.api-source-box .scan-mode-row {
  justify-content: flex-end;
}

.api-source-hint {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  text-align: right;
  width: min(100%, 560px);
  line-height: 1.4;
  white-space: normal;
  word-break: keep-all;
  overflow-wrap: normal;
  text-wrap: balance;
}

.scanner-shell {
  display: grid;
  grid-template-columns: minmax(260px, 0.9fr) minmax(0, 1.1fr);
  gap: 14px;
  margin-top: 16px;
}

.scanner-preference-card {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: linear-gradient(180deg, #f8fbf6, #eef5ef);
}

.scanner-preference-head {
  display: grid;
  gap: 8px;
}

.scanner-preference-head h3,
.scanner-tools-top h3 {
  margin: 0;
}

.scanner-caption {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.bias-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.bias-btn {
  padding: 10px 12px;
  color: var(--ink);
  background: #edf1eb;
}

.bias-btn:hover {
  color: var(--ink);
  background: #dfe7dc;
}

.bias-btn.active {
  color: #fff;
  background: var(--ink);
}

.bias-btn.active:hover {
  color: #fff;
  background: var(--ink);
}

.event-mode-block {
  display: grid;
  gap: 10px;
  padding-top: 12px;
  border-top: 1px solid rgba(23, 32, 26, 0.08);
}

.event-mode-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
}

.event-mode-head strong {
  color: var(--ink);
}

.event-mode-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.event-mode-btn {
  padding: 9px 10px;
  color: var(--ink);
  background: #edf1eb;
}

.event-mode-btn:hover {
  color: var(--ink);
  background: #dfe7dc;
}

.event-mode-btn.active {
  color: #fff;
  background: var(--accent-2);
}

.event-mode-btn.active:hover {
  color: #fff;
  background: var(--accent-2);
}

.scanner-tools-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.scanner-refresh-btn {
  flex: none;
  align-self: flex-start;
  min-width: 112px;
}

.scan-mode-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-start;
}

.scan-mode-btn {
  padding: 9px 14px;
  color: var(--ink);
  background: #edf1eb;
  white-space: nowrap;
}

.symbol-search-field {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.symbol-search-field input {
  width: 100%;
}

.setup-tag {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.scan-mode-btn:hover {
  background: #dfe7dc;
}

.scan-mode-btn.active {
  color: #fff;
  background: var(--accent);
}

.scan-mode-btn.active:hover {
  background: #0f6c59;
}

.scan-mode-hint {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  text-align: left;
  max-width: 520px;
  line-height: 1.45;
}

.decision-summary {
  display: grid;
  grid-template-columns: 1.3fr repeat(3, minmax(150px, 0.7fr));
  gap: 10px;
  margin-top: 16px;
}

.decision-card {
  min-width: 0;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfa;
}

.decision-card.primary {
  border-color: rgba(13, 124, 102, 0.32);
  background: #f2faf6;
}

.decision-card.muted {
  background: #f6f7f4;
}

.decision-card span,
.decision-card small {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.decision-card strong {
  display: block;
  margin: 4px 0;
  overflow: hidden;
  color: var(--ink);
  font-size: 22px;
  line-height: 1.18;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.table-wrap {
  overflow-x: auto;
  margin-top: 16px;
}

table {
  width: 100%;
  min-width: 920px;
  border-collapse: collapse;
}

th,
td {
  padding: 13px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}

th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.positive {
  color: var(--accent);
}

.negative {
  color: var(--accent-2);
}

.direction-badge,
.score,
.win-rate {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 28px;
  border-radius: 7px;
  font-weight: 800;
}

.direction-badge {
  min-width: 58px;
  padding: 0 10px;
}

.direction-badge.long {
  color: var(--accent);
  background: #e8f5ef;
}

.direction-badge.short {
  color: var(--accent-2);
  background: #fbecea;
}

.score,
.win-rate {
  min-width: 50px;
  padding: 0 8px;
  background: #eef5eb;
  color: var(--accent);
}

.pick-btn {
  padding: 8px 11px;
  background: var(--accent);
}

.pick-btn.short {
  background: var(--accent-2);
}

.pick-btn:disabled,
.quick-open-btn:disabled {
  cursor: not-allowed;
  opacity: 0.5;
  filter: grayscale(0.25);
}

.decision-empty-row strong {
  display: block;
  padding: 18px 6px;
  color: var(--muted);
  font-size: 15px;
  white-space: normal;
}

.observation-pool {
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfa;
}

.observation-pool summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 14px;
  cursor: pointer;
  font-weight: 800;
}

.observation-pool summary::marker {
  content: "";
}

.observation-pool summary strong {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 26px;
  border-radius: 8px;
  color: var(--accent);
  background: #e8f5ef;
}

.observation-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding: 0 14px 14px;
}

.observation-card {
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.observation-card.long {
  border-color: rgba(13, 124, 102, 0.22);
}

.observation-card.short {
  border-color: rgba(176, 62, 48, 0.22);
}

.observation-card-head,
.observation-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.observation-card p {
  margin: 9px 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.observation-card-foot span {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wait-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.wait-summary strong,
.wait-summary span {
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f6f7f4;
}

.split {
  display: grid;
  grid-template-columns: minmax(240px, 0.68fr) minmax(560px, 1.32fr);
  gap: 20px;
}

.strategy-panel {
  max-width: 760px;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  color: var(--accent);
  background: #eef5eb;
  font-weight: 800;
}

.pill.short {
  color: var(--accent-2);
  background: #fbecea;
}

.strategy-plan {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

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

.execution-plan-empty {
  grid-column: 1 / -1;
  padding: 12px 14px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: #fbfcfa;
  font-size: 13px;
}

.strategy-card {
  padding: 12px 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfa;
}

.highlight-card {
  border-color: rgba(13, 124, 102, 0.28);
  background: #eef7f2;
}

.strategy-card strong {
  display: block;
  margin-bottom: 5px;
}

.option-strategy-panel {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid rgba(189, 138, 21, 0.34);
  border-radius: 8px;
  background: rgba(189, 138, 21, 0.08);
}

.rolling-trend-panel {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid rgba(13, 124, 102, 0.28);
  border-radius: 8px;
  background: rgba(13, 124, 102, 0.08);
}

.option-strategy-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.rolling-trend-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.option-strategy-head h3 {
  margin: 0;
  font-size: 16px;
}

.rolling-trend-head h3 {
  margin: 0;
  font-size: 16px;
}

.option-strategy-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.rolling-trend-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.option-strategy-card {
  padding: 12px;
  border: 1px solid rgba(189, 138, 21, 0.22);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.54);
}

.rolling-trend-card {
  padding: 12px;
  border: 1px solid rgba(13, 124, 102, 0.22);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.56);
}

.option-strategy-card strong {
  display: block;
  margin-bottom: 5px;
}

.rolling-trend-card strong {
  display: block;
  margin-bottom: 5px;
}

.option-strategy-card span,
.option-strategy-head span,
.rolling-trend-card span,
.rolling-trend-head span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.rolling-trend-levels {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.rolling-trend-levels span {
  min-width: 0;
  overflow: hidden;
  padding: 9px 10px;
  border-radius: 8px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.58);
  font-size: 12px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.monitor-panel {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.monitor-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

.monitor-output {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.monitor-output div {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8faf7;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.form-grid label,
.leverage-grid label,
.trade-entry-grid label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
}

.position-output,
.profit-output {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

.position-output {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 0;
}

.profit-output {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.position-output div,
.profit-output div {
  padding: 14px;
  border-radius: 8px;
  background: #f5f8f3;
}

.risk-plan-board {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 16px;
}

.distance-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.distance-strip div {
  padding: 10px 12px;
  border: 1px dashed var(--line);
  border-radius: 10px;
  background: rgba(13, 124, 102, 0.05);
}

.distance-strip strong {
  display: block;
  margin-top: 6px;
  font-size: 20px;
}

.risk-plan-card {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfa;
}

.risk-plan-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.risk-plan-head h3 {
  margin: 0;
}

.risk-head-note {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: rgba(23, 32, 26, 0.06);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.leverage-grid select {
  height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--ink);
  background: #fff;
}

.leverage-output,
.scenario-grid {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.leverage-output {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.leverage-output div,
.scenario-card {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8faf7;
}

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

.scenario-card {
  display: grid;
  gap: 3px;
  cursor: pointer;
  width: 100%;
  color: inherit;
  font: inherit;
  text-align: left;
}

.scenario-card h4 {
  margin: 0;
}

.scenario-card p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.scenario-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 2px;
}

.scenario-card.safe {
  border-color: rgba(13, 124, 102, 0.28);
  background: #eef7f2;
}

.scenario-card.warn {
  border-color: rgba(189, 138, 21, 0.35);
  background: #fff8e8;
}

.scenario-card.danger {
  border-color: rgba(168, 60, 50, 0.3);
  background: #fbecea;
}

.scenario-card.recommended {
  border-width: 2px;
  box-shadow: 0 14px 32px rgba(13, 124, 102, 0.14);
}

.scenario-card.active-plan {
  outline: 2px solid rgba(13, 124, 102, 0.18);
  outline-offset: 1px;
}

.order-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 68px;
  height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}

.order-status.pending {
  color: var(--gold);
  background: #fff8e8;
}

.order-status.take_profit {
  color: var(--accent);
  background: #e8f5ef;
}

.order-status.open {
  color: #1358b7;
  background: #e8f0ff;
}

.order-status.entry_touched {
  color: #0b5f78;
  background: #e4f7fb;
}

.order-status.stop_loss {
  color: var(--accent-2);
  background: #fbecea;
}

.order-status.cancel_warning {
  color: #9a6a00;
  background: #fff4da;
}

.order-status.cancelled {
  color: #6c7a71;
  background: #eef2ef;
}

.trade-row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  white-space: normal;
}

.trade-row-actions .tiny-btn {
  margin-bottom: 0;
}

.scenario-metrics,
.scenario-prices,
.scenario-pnl {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.scenario-metrics div,
.scenario-prices div,
.scenario-pnl div {
  padding: 7px 8px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.58);
}

.execution-scenario-grid {
  margin-top: 16px;
}

.execution-scenario-grid .scenario-card {
  gap: 10px;
}

.execution-scenario-grid .scenario-pnl {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.execution-coach {
  margin-top: 16px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfa;
}

.coach-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.coach-card {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f5f8f3;
}

.coach-card strong {
  font-size: 15px;
}

.coach-card p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.coach-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-top: 8px;
  border-top: 1px dashed var(--line);
}

.coach-line span {
  color: var(--muted);
  font-size: 12px;
}

.coach-line b {
  font-size: 16px;
}

.optimization-card h4 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.optimization-card h4 small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.style-advisor {
  margin-top: 12px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: #fbfcfa;
  font-size: 13px;
}

.style-advisor strong {
  color: var(--ink);
}

.style-advisor.conservative {
  border-color: rgba(13, 124, 102, 0.24);
  background: #eef7f2;
}

.style-advisor.standard {
  border-color: rgba(189, 138, 21, 0.28);
  background: #fff8e8;
}

.style-advisor.aggressive {
  border-color: rgba(168, 60, 50, 0.24);
  background: #fbecea;
}

.style-advisor.rolling {
  border-color: rgba(13, 124, 102, 0.3);
  background: #e8f5ef;
}

textarea {
  width: 100%;
  min-height: 150px;
  margin-top: 14px;
  padding: 14px;
  resize: vertical;
}

.saved-plans {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.saved-plan {
  padding: 12px;
  border-left: 4px solid var(--accent);
  background: #fbfcfa;
}

.trade-stats {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.trade-stats article {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8faf7;
}

.trade-filter-bar {
  display: grid;
  grid-template-columns: 1.2fr repeat(3, minmax(0, 0.8fr));
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fbfcfa;
}

.trade-filter-bar label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
}

.pending-order-alert {
  padding: 12px 14px;
  border: 1px solid rgba(168, 60, 50, 0.28);
  border-radius: 12px;
  background: #fbecea;
  color: #9d3f37;
  font-weight: 700;
  line-height: 1.6;
}

.trade-time-cell {
  display: grid;
  gap: 4px;
}

.trade-time-cell strong {
  font-size: 13px;
  font-weight: 700;
}

.trade-time-cell span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.trade-entry-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.trade-entry-grid select {
  height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--ink);
  background: #fff;
}

.trade-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 12px;
}

.trade-actions span {
  color: var(--muted);
  font-size: 13px;
}

.trade-table {
  min-width: 980px;
}

.setup-table {
  min-width: 680px;
}

.danger-btn {
  background: var(--accent-2);
}

.ghost-btn {
  margin-right: 6px;
  color: var(--ink);
  background: #edf1eb;
}

.ghost-btn:hover {
  background: #dfe7dc;
}

.tiny-btn {
  padding: 7px 10px;
  font-size: 12px;
}

.sidebar-top,
.sidebar-tools,
.sidebar-review-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.sidebar-top {
  display: grid;
  gap: 14px;
  min-height: 156px;
  align-content: start;
}

.sidebar-tools {
  display: flex;
  gap: 8px;
  min-height: 44px;
  align-items: center;
}

.icon-btn {
  padding: 11px 12px;
  color: #f4f8f3;
  background: rgba(255, 255, 255, 0.09);
  border: 1px solid rgba(255, 255, 255, 0.08);
  min-height: 44px;
  min-width: 108px;
  font-weight: 800;
  letter-spacing: 0;
  transition:
    background 0.24s ease,
    color 0.24s ease,
    transform 0.32s var(--sidebar-bezier);
}

.icon-btn:hover {
  background: rgba(255, 255, 255, 0.16);
}

.sidebar-footer {
  display: grid;
  gap: 12px;
  margin-top: auto;
}

.account-panel {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
}

.account-panel h3 {
  margin: 0;
  font-size: 16px;
}

.account-signed-out,
.account-signed-in {
  display: grid;
  gap: 8px;
}

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

.auth-message {
  color: #aeb9b0;
  font-size: 12px;
  line-height: 1.45;
}

.auth-message.positive {
  color: #9fd7b2;
}

.auth-message.negative {
  color: #f3a39b;
}

.sidebar-review {
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
}

.sidebar-review h3 {
  margin: 0;
  font-size: 16px;
}

.sidebar-review-hint {
  margin: 8px 0 0;
  color: #b6c2b8;
  font-size: 13px;
  line-height: 1.5;
}

.sidebar-score {
  display: block;
  margin-top: 8px;
  font-size: 44px;
  line-height: 1;
  letter-spacing: -0.03em;
}

.sidebar .status-panel {
  order: 2;
}

.sidebar-review-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.sidebar-review-item,
.sidebar-review-empty {
  padding: 12px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
}

.sidebar-review-item strong {
  display: block;
  margin-bottom: 8px;
}

.sidebar-review-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  color: #dce8de;
  font-size: 12px;
}

.workspace {
  display: grid;
  gap: 20px;
  min-width: 0;
}

.stack-layout {
  display: grid;
  gap: 20px;
}

.strategy-panel,
.risk-panel {
  width: 100%;
  max-width: none;
}

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

.feature-hidden {
  display: none !important;
}

.position-shell {
  display: grid;
  gap: 16px;
}

.account-hero {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

.account-balance-card {
  display: grid;
  gap: 10px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: linear-gradient(180deg, #f7fbf7, #eef6f1);
}

.account-balance-layout {
  display: grid;
  grid-template-columns: minmax(320px, 1.35fr) minmax(320px, 1fr);
  gap: 20px;
  align-items: start;
}

.account-balance-primary {
  display: grid;
  gap: 12px;
  align-content: start;
  min-width: 0;
}

.account-input-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: end;
}

.stat-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.account-balance-metrics {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-auto-flow: row;
}

.account-stat-card {
  display: grid;
  gap: 6px;
  min-height: 118px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.72);
}

.account-stat-card span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.account-stat-card strong {
  display: block;
  margin-top: 0;
  font-size: clamp(24px, 2.2vw, 38px);
  line-height: 1.05;
  letter-spacing: -0.03em;
  white-space: nowrap;
}

.account-balance-card span,
.compact-field {
  color: var(--muted);
  font-size: 13px;
}

.account-balance-value {
  font-size: clamp(38px, 5vw, 58px);
  line-height: 1;
  letter-spacing: -0.04em;
}

.account-balance-hint {
  margin: 0;
  max-width: 36ch;
  color: var(--muted);
  line-height: 1.65;
  text-wrap: pretty;
}

.account-controls {
  display: grid;
  gap: 10px;
}

.execution-compact-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.budget-mode-bar {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.budget-mode-btn {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--ink);
  background: #edf1eb;
  font-weight: 800;
}

.budget-mode-btn:hover {
  color: var(--ink);
  background: #dfe7dc;
}

.budget-mode-btn.active {
  color: #fff;
  background: var(--ink);
}

.budget-mode-btn.active:hover {
  color: #fff;
  background: #243229;
}

.execution-budget-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.execution-card {
  display: grid;
  gap: 8px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.72);
}

.execution-card-value strong {
  display: block;
  margin-top: 2px;
  font-size: clamp(24px, 2vw, 34px);
  line-height: 1.08;
  letter-spacing: -0.03em;
}

.execution-helper-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.execution-helper-row.single {
  grid-template-columns: 1fr;
}

.execution-auto-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.execution-advanced {
  display: grid;
  gap: 10px;
  padding: 12px 14px;
  border: 1px dashed var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.52);
}

.execution-advanced summary {
  cursor: pointer;
  color: var(--muted);
  font-weight: 700;
}

.execution-card-hint strong {
  display: block;
  margin-top: 2px;
  font-size: 14px;
  line-height: 1.55;
  letter-spacing: normal;
}

.execution-budget-grid .execution-card-hint {
  grid-column: 1 / -1;
}

.execution-price-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfa;
}

.execution-price-strip div {
  min-width: 0;
  padding: 10px 12px;
  border-radius: 8px;
  background: #f5f8f3;
}

.execution-price-strip span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.execution-price-strip strong {
  display: block;
  margin-top: 5px;
  overflow: hidden;
  color: var(--ink);
  font-size: 20px;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.compact-action-bar {
  margin-top: 0;
}

.execution-warning {
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--muted);
  line-height: 1.6;
}

.compact-field {
  display: grid;
  gap: 6px;
}

.field-title-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.risk-percent-summary {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.45;
  white-space: normal;
  flex: 1 1 220px;
  text-align: right;
}

.risk-percent-summary.good {
  color: var(--accent);
}

.risk-percent-summary.warn {
  color: #b26a16;
}

.risk-percent-summary.danger {
  color: var(--accent-2);
}

.compact-field-short {
  max-width: 200px;
}

.risk-percent-field {
  flex: 1 1 420px;
  max-width: 560px;
}

.risk-percent-field input {
  max-width: 260px;
}

.compact-field-short input {
  min-height: 44px;
  padding-inline: 14px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45);
}

#positionExposure {
  font-size: clamp(22px, 2vw, 32px);
  line-height: 1.15;
  white-space: nowrap;
}

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

.risk-preset-btn {
  display: grid;
  gap: 10px;
  min-height: 62px;
  padding: 12px 14px;
  color: var(--ink);
  background: #edf1eb;
  border: 1px solid var(--line);
  font-weight: 800;
  text-align: left;
}

.preset-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.preset-name {
  font-size: 15px;
}

.risk-preset-btn small {
  color: currentColor;
  font-size: 12px;
  font-weight: 800;
  opacity: 0.78;
}

.preset-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}

.preset-metrics span {
  min-width: 0;
  padding: 7px 8px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.62);
}

.preset-metrics b,
.preset-metrics em {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.preset-metrics b {
  color: var(--ink);
  font-size: 15px;
  font-style: normal;
}

.preset-metrics em {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
  font-weight: 700;
}

.risk-preset-btn[data-risk-preset="conservative"] {
  color: var(--accent);
  background: #e8f5ef;
  border-color: rgba(13, 124, 102, 0.18);
}

.risk-preset-btn[data-risk-preset="conservative"]:hover,
.risk-preset-btn[data-risk-preset="conservative"].active {
  color: #fff;
  background: var(--accent);
}

.risk-preset-btn:hover {
  background: #dfe7dc;
}

.risk-preset-btn[data-risk-preset="standard"]:hover,
.risk-preset-btn[data-risk-preset="standard"].active {
  color: #fff;
  background: var(--ink);
  border-color: rgba(23, 32, 26, 0.18);
}

.risk-preset-btn.active {
  color: #fff;
  background: var(--ink);
}

.risk-preset-btn.active .preset-metrics span,
.risk-preset-btn:hover .preset-metrics span {
  background: rgba(255, 255, 255, 0.16);
}

.risk-preset-btn.active .preset-metrics b,
.risk-preset-btn.active .preset-metrics em,
.risk-preset-btn:hover .preset-metrics b,
.risk-preset-btn:hover .preset-metrics em {
  color: #fff;
}

.risk-preset-btn.aggressive {
  color: var(--accent-2);
  background: #fbecea;
  border-color: rgba(168, 60, 50, 0.2);
}

.risk-preset-btn.aggressive:hover,
.risk-preset-btn.aggressive.active {
  color: #fff;
  background: var(--accent-2);
}

.risk-preset-btn.rolling {
  color: #e6fff2;
  background: #13271f;
  border-color: rgba(13, 124, 102, 0.32);
}

.risk-preset-btn.rolling:hover,
.risk-preset-btn.rolling.active {
  color: #fff;
  background: #0b1a13;
  border-color: rgba(13, 124, 102, 0.52);
}

.risk-preset-btn.unavailable,
.risk-preset-btn:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

.risk-preset-btn.unavailable:hover,
.risk-preset-btn:disabled:hover {
  color: inherit;
  background: #edf1eb;
}

.risk-preset-btn.rolling.unavailable,
.risk-preset-btn.rolling:disabled,
.risk-preset-btn.rolling.unavailable:hover,
.risk-preset-btn.rolling:disabled:hover {
  color: #557064;
  background: #e8eee9;
  border-color: var(--line);
}

.risk-action-bar {
  display: flex;
  justify-content: flex-end;
}

.quick-open-btn {
  min-width: 132px;
  padding: 12px 18px;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 800;
}

.quick-open-btn.long {
  background: var(--accent);
}

.quick-open-btn.short {
  background: var(--accent-2);
}

.quick-open-btn:disabled {
  opacity: 0.45;
}

.mini-toggle-btn {
  flex: none;
  min-width: 42px;
  padding: 4px 8px;
  border-radius: 999px;
  color: var(--muted);
  background: rgba(23, 32, 26, 0.06);
  font-size: 11px;
  font-weight: 700;
}

.mini-toggle-btn:hover {
  color: var(--ink);
  background: rgba(23, 32, 26, 0.12);
}

.scenario-grid {
  grid-template-columns: 1fr;
}

.optimization-card {
  gap: 12px;
}

.optimization-card h4 {
  font-size: 18px;
}

.trade-integrated-panel {
  display: grid;
  gap: 16px;
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

.trade-compose-shell {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fbfcfa;
}

.trade-actions {
  justify-content: space-between;
}

.trade-actions span {
  flex: 1;
  line-height: 1.5;
}

.back-to-top {
  position: fixed;
  right: 20px;
  bottom: 20px;
  left: auto;
  z-index: 30;
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  min-width: 64px;
  padding: 11px 14px;
  border-radius: 999px;
}

.back-to-top.visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.app-shell.sidebar-collapsed {
  grid-template-columns: 88px minmax(0, 1fr);
}

.app-shell.sidebar-collapsed .brand-copy,
.app-shell.sidebar-collapsed .status-panel div,
.app-shell.sidebar-collapsed .sidebar-review {
  opacity: 0;
  visibility: hidden;
  transform: translateX(-12px);
  pointer-events: none;
  transition:
    opacity 0.18s ease,
    transform 0.32s var(--sidebar-bezier),
    visibility 0s linear 0.18s;
}

.app-shell.sidebar-collapsed .brand-copy,
.app-shell.sidebar-collapsed .status-panel {
  display: none;
}

.app-shell.sidebar-collapsed .sidebar-review {
  max-height: 0;
  padding: 0;
  border-width: 0;
  overflow: hidden;
}

.app-shell.sidebar-collapsed .sidebar {
  gap: 22px;
  padding: 24px 0;
  align-items: center;
  overflow-y: hidden;
}

.app-shell.sidebar-collapsed .sidebar-top {
  width: 48px;
  min-height: 116px;
  gap: 12px;
  align-content: start;
  justify-items: center;
}

.app-shell.sidebar-collapsed .brand {
  width: 48px;
  display: grid;
  gap: 0;
  place-items: center;
  justify-content: center;
}

.app-shell.sidebar-collapsed .brand-mark {
  width: 48px;
  height: 48px;
  border-radius: 10px;
}

.app-shell.sidebar-collapsed .sidebar-tools {
  width: 48px;
  display: grid;
  gap: 0;
  place-items: center;
}

.app-shell.sidebar-collapsed .sidebar-tools .icon-btn {
  width: 48px;
  min-width: 48px;
  min-height: 48px;
  padding: 0;
  border-radius: 12px;
  font-size: 15px;
  line-height: 1;
  display: grid;
  place-items: center;
}

.app-shell.sidebar-collapsed .nav a {
  position: relative;
  display: grid;
  width: 48px;
  height: 48px;
  min-height: 48px;
  padding: 0;
  color: transparent;
  font-size: 0;
  line-height: 0;
  white-space: nowrap;
  overflow: hidden;
  transform: translateX(0);
  border-radius: 12px;
}

.app-shell.sidebar-collapsed .nav {
  width: 48px;
  gap: 12px;
  justify-items: center;
}

.app-shell.sidebar-collapsed .nav a::after {
  content: attr(data-short);
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #dce6da;
  font-size: 17px;
  font-weight: 800;
  line-height: 1;
  opacity: 1;
  transform: scale(1);
  transition:
    color 0.24s ease,
    transform 0.24s ease,
    opacity 0.2s ease;
}

.app-shell.sidebar-collapsed .nav a.active::after,
.app-shell.sidebar-collapsed .nav a:hover::after {
  color: #101712;
}

.app-shell.sidebar-collapsed .status-panel {
  width: 48px;
  min-height: 42px;
  justify-content: center;
  padding-inline: 0;
  border-radius: 12px;
}

.app-shell.sidebar-collapsed .sidebar-footer {
  display: none;
}

.app-shell.sidebar-collapsed .status-dot {
  margin-top: 0;
}

body[data-theme="dark"] .sidebar {
  background: #0a100d;
}

body[data-theme="dark"] .icon-btn {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.16);
}

body[data-theme="dark"] .mini-toggle-btn {
  color: #d2ddd5;
  background: rgba(255, 255, 255, 0.08);
}

body[data-theme="dark"] .mini-toggle-btn:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.14);
}

body[data-theme="dark"] .bias-btn:hover {
  color: var(--ink);
  background: #2a342e;
}

body[data-theme="dark"] .metrics article,
body[data-theme="dark"] .panel,
body[data-theme="dark"] .trade-compose-shell,
body[data-theme="dark"] .risk-plan-card,
body[data-theme="dark"] .execution-coach,
body[data-theme="dark"] .coach-card,
body[data-theme="dark"] .account-balance-card,
body[data-theme="dark"] .account-stat-card,
body[data-theme="dark"] .execution-card,
body[data-theme="dark"] .execution-price-strip,
body[data-theme="dark"] .execution-price-strip div,
body[data-theme="dark"] .execution-warning,
body[data-theme="dark"] .position-output div,
body[data-theme="dark"] .profit-output div,
body[data-theme="dark"] .leverage-output div,
body[data-theme="dark"] .scenario-card,
body[data-theme="dark"] .trade-stats article,
body[data-theme="dark"] .strategy-card,
body[data-theme="dark"] .option-strategy-panel,
body[data-theme="dark"] .option-strategy-card,
body[data-theme="dark"] .rolling-trend-panel,
body[data-theme="dark"] .rolling-trend-card,
body[data-theme="dark"] .rolling-trend-levels span,
body[data-theme="dark"] .account-sync-panel,
body[data-theme="dark"] .device-session-item,
body[data-theme="dark"] .sync-log-item,
body[data-theme="dark"] .sidebar-review-item,
body[data-theme="dark"] .sidebar-review-empty {
  background: #171d1a;
}

body[data-theme="dark"] .device-session-item.current {
  background: rgba(82, 199, 160, 0.12);
  border-color: rgba(82, 199, 160, 0.24);
}

body[data-theme="dark"] .risk-head-note {
  background: rgba(219, 231, 222, 0.12);
  color: #dbe7de;
}

body[data-theme="dark"] .risk-percent-summary {
  color: #b7c4bb;
}

body[data-theme="dark"] .risk-percent-summary.good {
  color: #7de2b9;
}

body[data-theme="dark"] .risk-percent-summary.warn {
  color: #f0bf6a;
}

body[data-theme="dark"] .risk-percent-summary.danger {
  color: #ff9d95;
}

body[data-theme="dark"] input,
body[data-theme="dark"] textarea,
body[data-theme="dark"] select,
body[data-theme="dark"] .leverage-grid select,
body[data-theme="dark"] .trade-entry-grid select,
body[data-theme="dark"] .actions select {
  color: var(--ink);
  background: #101612;
}

body[data-theme="dark"] .ghost-btn {
  color: var(--ink);
  background: #202923;
}

body[data-theme="dark"] .scan-mode-btn {
  color: var(--ink);
  background: #232d27;
}

body[data-theme="dark"] .event-mode-block {
  border-top-color: rgba(213, 255, 224, 0.12);
}

body[data-theme="dark"] .event-mode-btn {
  color: var(--ink);
  background: #232d27;
}

body[data-theme="dark"] .event-mode-btn.active {
  color: #ffffff;
  background: var(--accent-2);
}

body[data-theme="dark"] .scan-mode-btn.active {
  color: #08100d;
  background: var(--accent);
}

body[data-theme="dark"] .api-source-hint {
  color: var(--muted);
}

body[data-theme="dark"] .bias-btn {
  color: var(--ink);
  background: #232d27;
}

body[data-theme="dark"] .bias-btn.active,
body[data-theme="dark"] .actions button {
  color: #ffffff;
  background: var(--accent);
}

body[data-theme="dark"] .risk-preset-btn {
  color: var(--ink);
  background: #232d27;
}

body[data-theme="dark"] .risk-preset-btn.active {
  color: #ffffff;
  background: var(--ink);
}

body[data-theme="dark"] .risk-preset-btn[data-risk-preset="conservative"] {
  color: #bfeeda;
  background: rgba(82, 199, 160, 0.12);
  border-color: rgba(82, 199, 160, 0.24);
}

body[data-theme="dark"] .risk-preset-btn[data-risk-preset="conservative"]:hover,
body[data-theme="dark"] .risk-preset-btn[data-risk-preset="conservative"].active {
  color: #08100d;
  background: var(--accent);
  border-color: rgba(82, 199, 160, 0.42);
}

body[data-theme="dark"] .risk-preset-btn[data-risk-preset="standard"] {
  color: #f5d58a;
  background: rgba(224, 181, 77, 0.14);
  border-color: rgba(224, 181, 77, 0.28);
}

body[data-theme="dark"] .risk-preset-btn[data-risk-preset="standard"]:hover,
body[data-theme="dark"] .risk-preset-btn[data-risk-preset="standard"].active {
  color: #101712;
  background: var(--gold);
  border-color: rgba(224, 181, 77, 0.42);
}

body[data-theme="dark"] .risk-preset-btn.aggressive {
  color: #ffd7d2;
  background: rgba(239, 141, 132, 0.12);
  border-color: rgba(239, 141, 132, 0.24);
}

body[data-theme="dark"] .risk-preset-btn.aggressive:hover,
body[data-theme="dark"] .risk-preset-btn.aggressive.active,
body[data-theme="dark"] .quick-open-btn.short {
  color: #ffffff;
  background: var(--accent-2);
  border-color: rgba(239, 141, 132, 0.42);
}

body[data-theme="dark"] .risk-preset-btn.rolling {
  color: #d7ffe8;
  background: rgba(82, 199, 160, 0.12);
  border-color: rgba(82, 199, 160, 0.24);
}

body[data-theme="dark"] .risk-preset-btn.rolling:hover,
body[data-theme="dark"] .risk-preset-btn.rolling.active {
  color: #08100d;
  background: var(--accent);
  border-color: rgba(82, 199, 160, 0.42);
}

body[data-theme="dark"] .risk-preset-btn.unavailable,
body[data-theme="dark"] .risk-preset-btn:disabled {
  color: rgba(218, 235, 224, 0.58);
  background: #202923;
  border-color: rgba(213, 255, 224, 0.12);
}

body[data-theme="dark"] .quick-open-btn.long {
  color: #ffffff;
  background: var(--accent);
}

body[data-theme="dark"] .scanner-controls,
body[data-theme="dark"] .scanner-preference-card {
  background: #171d1a;
}

body[data-theme="dark"] .decision-card,
body[data-theme="dark"] .observation-pool,
body[data-theme="dark"] .observation-card,
body[data-theme="dark"] .wait-summary strong,
body[data-theme="dark"] .wait-summary span {
  background: #171d1a;
}

body[data-theme="dark"] .decision-card.primary {
  background: rgba(82, 199, 160, 0.1);
  border-color: rgba(82, 199, 160, 0.25);
}

body[data-theme="dark"] .decision-card.muted {
  background: #141a17;
}

body[data-theme="dark"] .observation-pool summary strong {
  color: #bfeeda;
  background: rgba(82, 199, 160, 0.12);
}

body[data-theme="dark"] .trade-filter-bar {
  background: #171d1a;
}

body[data-theme="dark"] .budget-mode-btn {
  background: #202923;
}

body[data-theme="dark"] .budget-mode-btn:hover {
  color: #ffffff;
  background: #2a342d;
}

body[data-theme="dark"] .budget-mode-btn.active {
  background: #dbe7de;
  color: #101612;
}

body[data-theme="dark"] .budget-mode-btn.active:hover {
  background: #dbe7de;
  color: #101612;
}

body[data-theme="dark"] .execution-advanced {
  background: rgba(23, 29, 26, 0.82);
}

body[data-theme="dark"] .pending-order-alert {
  background: rgba(168, 60, 50, 0.16);
  color: #f1b4ab;
  border-color: rgba(239, 141, 132, 0.28);
}

body[data-theme="dark"] .execution-card-hint strong {
  color: #dbe7de;
}

body[data-theme="dark"] .style-advisor {
  color: #dbe7de;
  background: #18201c;
}

body[data-theme="dark"] .style-advisor strong {
  color: #ffffff;
}

body[data-theme="dark"] .style-advisor.conservative {
  border-color: rgba(82, 199, 160, 0.35);
  background: rgba(82, 199, 160, 0.12);
}

body[data-theme="dark"] .style-advisor.standard {
  border-color: rgba(240, 207, 133, 0.35);
  background: rgba(240, 207, 133, 0.12);
}

body[data-theme="dark"] .style-advisor.aggressive {
  border-color: rgba(239, 141, 132, 0.35);
  background: rgba(239, 141, 132, 0.12);
}

body[data-theme="dark"] .style-advisor.rolling {
  border-color: rgba(82, 199, 160, 0.38);
  background: rgba(82, 199, 160, 0.16);
}

body[data-theme="dark"] .distance-strip div {
  background: rgba(82, 199, 160, 0.08);
}

body[data-theme="dark"] .actions button,
body[data-theme="dark"] .pick-btn {
  color: #ffffff;
  background: var(--accent);
}

body[data-theme="dark"] .danger-btn {
  color: #ffffff;
  background: var(--accent-2);
}

body[data-theme="dark"] .table-wrap table {
  background: transparent;
}

body[data-theme="dark"] .daily-performance-card {
  background: linear-gradient(180deg, rgba(23,29,26,0.96), rgba(18,24,20,0.96));
}

@media (max-width: 980px) {
  .app-shell,
  .metrics,
  .scanner-shell,
  .account-hero,
  .decision-summary,
  .risk-plan-board,
  .execution-price-strip,
  .daily-performance-grid,
  .leverage-output,
  .monitor-output,
  .profit-output,
  .position-output,
  .coach-grid,
  .execution-plan-grid,
  .option-strategy-grid,
  .rolling-trend-grid,
  .rolling-trend-levels,
  .observation-grid,
  .scenario-grid,
  .trade-stats,
  .trade-entry-grid,
  .strategy-plan {
    grid-template-columns: 1fr;
  }

  .app-shell {
    grid-template-columns: 1fr;
  }

  .app-shell.sidebar-collapsed {
    grid-template-columns: 88px minmax(0, 1fr);
  }

  .back-to-top {
    left: auto;
    right: 18px;
    bottom: 18px;
  }

  .sidebar {
    position: static;
    height: auto;
    min-height: auto;
  }

  .app-shell.sidebar-collapsed .sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    min-height: 100vh;
    padding: 24px 0;
  }

  .app-shell.sidebar-collapsed .brand-copy,
  .app-shell.sidebar-collapsed .status-panel div {
    display: none;
  }

  .topbar,
  .panel-heading,
  .subsection-heading,
  .filter-row {
    align-items: stretch;
    flex-direction: column;
  }

  .scan-mode-row {
    justify-content: stretch;
  }

  .scan-mode-hint {
    text-align: left;
  }

  .scanner-tools-top {
    flex-direction: column;
  }

  .account-stat-card {
    min-height: auto;
  }

  .subsection-heading span {
    max-width: none;
    text-align: left;
  }
}

@media (max-width: 560px) {
  .workspace,
  .sidebar {
    padding: 18px;
  }

  .sidebar-top,
  .sidebar-tools,
  .trade-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .actions,
  .bias-row,
  .event-mode-row,
  .budget-mode-bar,
  .account-input-row,
  .account-balance-layout,
  .account-balance-metrics,
  .execution-compact-grid,
  .execution-auto-row,
  .execution-helper-row,
  .form-grid,
  .distance-strip,
  .execution-price-strip,
  .risk-preset-bar,
  .position-output,
  .profit-output,
  .daily-performance-grid,
  .decision-summary,
  .leverage-output,
  .monitor-output,
  .scenario-grid,
  .coach-grid,
  .execution-plan-grid,
  .option-strategy-grid,
  .rolling-trend-grid,
  .rolling-trend-levels,
  .observation-grid,
  .trade-actions,
  .strategy-plan {
    grid-template-columns: 1fr;
    display: grid;
  }
}
