:root {
  color-scheme: light;
  --page: #f4f6f8;
  --ink: #101828;
  --muted: #667085;
  --quiet: #98a2b3;
  --panel: #ffffff;
  --panel-strong: #ffffff;
  --line: #e4e7ec;
  --line-strong: #cfd4dc;
  --black: #101828;
  --green: #067647;
  --amber: #b54708;
  --orange: #b54708;
  --red: #b42318;
  --blue: #175cd3;
  --blue-soft: #eff6ff;
  --yellow: #b7791f;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06);
  --r: 10px;
  --surface-2: #f8fafc;
  --surface-3: #f1f5f9;
  --terminal: #171916;
  --terminal-2: #20231f;
  --terminal-line: rgba(255, 255, 255, .10);
  --terminal-muted: rgba(255, 255, 255, .52);
  --terminal-active: #b8aa7a;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 10px;
  --row-h: 64px;
  --focus: 0 0 0 3px rgba(23, 92, 211, .12);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: "IBM Plex Sans", "HarmonyOS Sans SC", "Microsoft YaHei UI", "Noto Sans SC", sans-serif;
  font-size: 15px;
  letter-spacing: 0;
  background:
    linear-gradient(90deg, rgba(16,24,40,.012) 1px, transparent 1px),
    linear-gradient(180deg, rgba(16,24,40,.012) 1px, transparent 1px),
    var(--page);
  background-size: 56px 56px, 56px 56px, auto;
}

a, button, input, select {
  font: inherit;
  letter-spacing: 0;
}

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

button, .primary, .ghost {
  min-height: 36px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: var(--panel-strong);
  color: var(--ink);
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
}

button:hover, .primary:hover, .ghost:hover {
  border-color: #b2ccff;
  background: #f8fbff;
}

.primary {
  background: var(--blue);
  border-color: var(--blue);
  color: white;
  font-weight: 700;
}

.primary:hover {
  background: #1849a9;
  border-color: #1849a9;
}

.icon-btn { width: 38px; padding: 0; }

svg { width: 17px; height: 17px; stroke-width: 2.1; flex: 0 0 auto; }

.shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
}

.rail {
  position: sticky;
  top: 0;
  height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 22px;
  background: #101828;
  color: white;
  padding: 22px 16px;
}

.brand { display: block; }

.brand b, .brand span, .rail-note span, .rail-note b { display: block; }
.brand b { font-size: 18px; line-height: 1.2; }
.brand span, .rail-note span { color: rgba(255,255,255,.56); font-size: 12px; margin-top: 2px; }

nav { display: grid; gap: 5px; align-content: start; }

.nav-btn {
  width: 100%;
  min-height: 42px;
  border: 0;
  display: grid;
  grid-template-columns: 24px 1fr auto;
  gap: 8px;
  align-items: center;
  background: transparent;
  color: rgba(255,255,255,.72);
  text-align: left;
  padding: 0 10px;
  border-radius: 8px;
}

.nav-btn.active, .nav-btn:hover {
  background: rgba(255,255,255,.09);
  color: white;
}

.nav-btn.active::after {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 99px;
  background: var(--terminal-active);
}

.nav-btn.soon { opacity: .58; }

.rail-note {
  border-top: 1px solid rgba(255,255,255,.14);
  padding-top: 14px;
}

.main {
  position: relative;
  overflow: hidden;
  padding: 28px 32px;
  min-width: 0;
}

.page-decor {
  position: absolute;
  top: 10px;
  right: 44px;
  width: min(230px, 22vw);
  height: 170px;
  opacity: .10;
  pointer-events: none;
  filter: grayscale(1);
}

.page-decor svg {
  width: 100%;
  height: 100%;
}

.decor-line {
  fill: none;
  stroke: rgba(16, 24, 40, .42);
  stroke-width: 2.5;
  stroke-linecap: round;
}

.decor-line.soft {
  stroke: rgba(16, 24, 40, .30);
  stroke-width: 2;
}

.decor-bars rect {
  fill: rgba(16, 24, 40, .20);
}

.topbar, #decision, .view {
  max-width: 1460px;
  margin: 0 auto;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 18px;
  margin-bottom: 16px;
}

.eyebrow {
  display: inline-flex;
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
  text-transform: uppercase;
}

h1, h2, h3, p { margin: 0; }
h1 { margin-top: 4px; font-size: 30px; line-height: 1.15; font-weight: 700; }
h2 { font-size: 22px; line-height: 1.18; }
h3 { font-size: 16px; line-height: 1.24; font-weight: 650; }

.top-actions { display: flex; gap: 8px; align-items: center; }

.top-actions .primary {
  background: var(--panel-strong);
  border-color: var(--line-strong);
  color: var(--ink);
  font-weight: 650;
}

.top-actions .primary:hover {
  background: #f8fbff;
  border-color: #b2ccff;
}

#decision { margin-bottom: 14px; }

.decision {
  border: 1px solid var(--line-strong);
  border-radius: var(--r);
  overflow: hidden;
  box-shadow: var(--shadow);
  background: var(--panel-strong);
  display: grid;
  grid-template-columns: minmax(300px, 1.15fr) repeat(4, minmax(140px, .45fr));
}

.decision-main, .decision-cell {
  padding: 15px 16px;
  border-right: 1px solid var(--line);
}

.decision-cell:last-child { border-right: 0; }

.decision-main { display: grid; gap: 7px; }
.decision-main strong { font-size: 19px; line-height: 1.25; font-weight: 700; }
.decision-main span, .decision-cell span, .muted { color: var(--muted); }
.decision-cell { display: grid; align-content: center; gap: 6px; }
.decision-cell b { font-size: 20px; line-height: 1.1; font-weight: 700; }

.dot {
  width: 8px;
  height: 8px;
  display: inline-block;
  border-radius: 99px;
  background: var(--green);
  margin-right: 6px;
}
.dot.warn { background: var(--amber); }
.dot.bad { background: var(--red); }
.dot.info { background: var(--blue); }

.view {
  animation: none;
}

.notice {
  min-height: 44px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--blue);
  border-radius: 8px;
  background: #fff;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--ink);
  box-shadow: var(--shadow);
  margin-bottom: 14px;
}

.notice.ok { border-left-color: var(--green); }
.notice.warn { border-left-color: var(--orange); }
.notice.bad { border-left-color: var(--red); }

.notice button {
  width: 30px;
  height: 30px;
  min-height: 30px;
  padding: 0;
}

.auth-locked .main,
.auth-locked .rail {
  filter: blur(5px);
  pointer-events: none;
  user-select: none;
}

.auth-gate {
  position: fixed;
  inset: 0;
  z-index: 72;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(238, 242, 239, .62);
  backdrop-filter: blur(10px);
}

.auth-card {
  width: min(760px, 100%);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
  padding: 22px;
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr);
  gap: 16px;
}

.auth-icon {
  width: 46px;
  height: 46px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: #eef4ff;
  color: var(--blue);
}

.auth-copy {
  display: grid;
  gap: 12px;
}

.auth-copy h2 {
  margin: 0;
  font-size: 24px;
  line-height: 1.2;
}

.auth-copy p {
  margin: 0;
  color: var(--muted);
  max-width: 620px;
}

.auth-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.auth-meta span,
.auth-error {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 9px;
}

.auth-error {
  width: fit-content;
  border-color: rgba(192, 57, 43, .24);
  background: #fff5f4;
  color: var(--red);
  border-radius: 8px;
}

.auth-form {
  display: grid;
  grid-template-columns: minmax(150px, 220px) auto;
  gap: 10px;
  justify-content: start;
  align-items: center;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(16, 24, 40, .42);
  backdrop-filter: blur(7px);
}

.confirm-modal {
  width: min(520px, 100%);
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 22px 60px rgba(16, 24, 40, .28);
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 14px;
  padding: 18px;
}

.modal-icon {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: var(--blue-soft);
  color: var(--blue);
}

.confirm-modal h3 {
  margin: 0 0 8px;
  font-size: 18px;
}

.purchase-modal {
  position: relative;
  width: min(860px, 100%);
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 22px 60px rgba(16, 24, 40, .28);
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(230px, .7fr);
  gap: 18px;
  padding: 22px;
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  min-height: 32px;
  padding: 0;
}

.purchase-copy {
  display: grid;
  gap: 12px;
  align-content: start;
}

.purchase-copy h3 {
  margin: 0;
  font-size: 22px;
}

.purchase-copy p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

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

.purchase-facts div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: var(--surface-2);
  display: grid;
  gap: 4px;
}

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

.purchase-facts .copyable-fact {
  padding: 0;
}

.fact-copy {
  min-height: 76px;
  width: 100%;
  border: 0;
  border-radius: 8px;
  padding: 10px;
  background: transparent;
  color: var(--ink);
  display: grid;
  grid-template-columns: minmax(0, 1fr) 18px;
  align-items: end;
  justify-items: start;
  gap: 6px;
  text-align: left;
}

.fact-copy:hover {
  background: #eef4ff;
}

.fact-copy b {
  min-width: 0;
  width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
  line-height: 1.2;
}

.purchase-qr {
  display: grid;
  gap: 8px;
  text-align: center;
  color: var(--muted);
  font-size: 12px;
}

.purchase-qr .asset-image-frame {
  width: min(260px, 100%);
  height: 260px;
  justify-self: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
  background: #f8fafc;
}

.purchase-qr img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
}

.activation-box {
  grid-column: 1 / -1;
  border-top: 1px solid var(--line);
  padding-top: 14px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(180px, .35fr);
  gap: 10px;
}

.activation-box label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.activation-box textarea {
  min-height: 74px;
  resize: vertical;
}

.activation-box .modal-actions {
  grid-column: 1 / -1;
}

.modal-message {
  display: grid;
  gap: 5px;
  color: var(--muted);
  line-height: 1.5;
}

.modal-message p { margin: 0; }

.modal-actions {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 4px;
}

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

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

.panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--panel);
  box-shadow: 0 1px 0 rgba(255,255,255,.78) inset;
  animation: none;
}

@keyframes panelIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.panel-head {
  min-height: 54px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.panel-body { padding: 16px 18px; }
.span3 { grid-column: span 3; }
.span4 { grid-column: span 4; }
.span5 { grid-column: span 5; }
.span6 { grid-column: span 6; }
.span7 { grid-column: span 7; }
.span8 { grid-column: span 8; }
.span12 { grid-column: 1 / -1; }

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

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

.exchange-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: var(--panel-strong);
  display: grid;
  gap: 12px;
  width: 100%;
  text-align: left;
  align-items: stretch;
  justify-content: stretch;
}

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

.exchange-logo {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: #eef4f1;
  border: 1px solid var(--line);
  font-weight: 900;
}

.exchange-logo.binance { background: #fff9e6; color: #7d5700; border-color: #f6d98b; }
.exchange-logo.okx { background: #111827; color: white; }
.exchange-logo.gate { background: #eaf3ff; color: #1c5b94; }
.exchange-logo.bitget { background: #effaf1; color: #1b783e; }

.exchange-logo img {
  width: 24px;
  height: 24px;
  object-fit: contain;
  display: block;
}

.asset-image-frame {
  position: relative;
  width: 100%;
  height: 100%;
  min-width: 1em;
  min-height: 1em;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: #eef2f6;
  color: var(--quiet);
}

.asset-image-frame .asset-image {
  grid-area: 1 / 1;
  opacity: 0;
  transition: opacity .16s ease;
}

.asset-image-frame.is-loaded .asset-image {
  opacity: 1;
}

.asset-spinner {
  grid-area: 1 / 1;
  width: 15px;
  height: 15px;
  border-radius: 999px;
  border: 2px solid #cfd4dc;
  border-top-color: var(--blue);
  animation: spin .72s linear infinite;
}

.asset-image-frame.is-loaded .asset-spinner {
  display: none;
}

.exchange-logo .asset-image-frame {
  width: 24px;
  height: 24px;
  border-radius: 5px;
}

.exchange-logo .asset-image-frame img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.asset-fallback {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  font-weight: 900;
  font-size: 11px;
  color: var(--ink);
}

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

.kpi {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #f9fafb;
}

.kpi span { color: var(--muted); font-size: 12px; }
.kpi b { display: block; margin-top: 6px; font-size: 23px; line-height: 1.04; }
.kpi small { display: block; color: var(--quiet); margin-top: 5px; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }

.chip {
  min-height: 24px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 99px;
  padding: 0 9px;
  background: #f9fafb;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.chip.ok { color: var(--green); background: #ecfdf3; border-color: #abefc6; }
.chip.warn { color: var(--amber); background: #fffaeb; border-color: #fedf89; }
.chip.bad { color: var(--red); background: #fef3f2; border-color: #fecdca; }
.chip.info { color: var(--blue); background: var(--blue-soft); border-color: #b2ccff; }

.source-list, .position-list, .account-list, .event-list {
  display: grid;
  gap: 9px;
}

.action-strip {
  padding: 12px 14px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.source-row {
  display: grid;
  grid-template-columns: 54px 1fr auto;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--panel-strong);
}

.avatar {
  width: 54px;
  height: 54px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line-strong);
  overflow: hidden;
  background: #1d2939;
  color: white;
  font-weight: 900;
}

.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }

.avatar .asset-image-frame {
  border-radius: inherit;
}

.avatar-fallback {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  background:
    linear-gradient(135deg, rgba(255,255,255,.12), rgba(255,255,255,0)),
    #263241;
  color: #fff;
  font-weight: 900;
  font-size: 19px;
}

.row-title { display: grid; gap: 5px; min-width: 0; }
.row-title b { font-size: 17px; overflow-wrap: anywhere; }
.row-title span { color: var(--muted); font-size: 13px; line-height: 1.4; }
.row-title small { color: var(--quiet); font-size: 12px; overflow-wrap: anywhere; }

.position-row {
  display: grid;
  grid-template-columns: minmax(180px, 1.15fr) minmax(128px, .75fr) repeat(3, minmax(112px, .55fr)) auto;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--panel-strong);
}

.position-row.warn {
  border-color: #fedf89;
  background: #fffaf0;
}

.position-row > .chips {
  justify-self: end;
  min-width: 86px;
  justify-content: flex-end;
}

.position-row > .chips .chip { white-space: nowrap; }

.symbol {
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 10px;
  align-items: center;
}

.coin {
  width: 34px;
  height: 34px;
  border-radius: 99px;
  display: grid;
  place-items: center;
  background: #edf2ef;
  border: 1px solid var(--line);
  font-size: 11px;
  font-weight: 900;
  overflow: hidden;
}

.coin img { width: 100%; height: 100%; object-fit: cover; display: block; }

.coin .asset-image-frame {
  border-radius: inherit;
}

.symbol b { display: block; font-size: 17px; }
.symbol span, .cell span { display: block; color: var(--muted); font-size: 12px; margin-top: 3px; }
.cell b { display: block; font-variant-numeric: tabular-nums; font-size: 16px; }

.source-cell b {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.inline-exchange {
  width: 1em;
  height: 1em;
  border-radius: 3px;
  display: inline-grid;
  place-items: center;
  overflow: hidden;
  background: #111614;
  color: white;
  font-size: 1em;
  line-height: 1;
}

.inline-exchange.binance { background: #fff5cf; color: #7d5700; }
.inline-exchange img { width: .86em; height: .86em; object-fit: contain; display: block; }
.inline-exchange .asset-image-frame {
  width: .86em;
  height: .86em;
  min-width: .86em;
  min-height: .86em;
  border-radius: 3px;
}

.inline-exchange .asset-spinner {
  width: .62em;
  height: .62em;
  border-width: 1px;
}

.account-row, .event-row {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--panel-strong);
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: start;
}

.event-row { grid-template-columns: 92px 1fr auto; align-items: center; }
.event-time { color: var(--muted); font-variant-numeric: tabular-nums; }
.event-row b { display: block; }
.event-row span { color: var(--muted); font-size: 13px; margin-top: 3px; display: block; }

.event-row.event-explained {
  display: block;
  padding: 0;
  overflow: hidden;
  border-left: 3px solid transparent;
}

.event-row.event-explained.bad { border-left-color: var(--red); }
.event-row.event-explained.warn { border-left-color: var(--amber); }
.event-row.event-explained.ok { border-left-color: var(--green); }
.event-row.event-explained.info { border-left-color: var(--blue); }

.event-main {
  width: 100%;
  min-height: 68px;
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
}

.event-main:hover { background: #f8fafc; }

.event-copy {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.event-copy em {
  color: var(--ink);
  font-style: normal;
  font-size: 13px;
  overflow-wrap: anywhere;
}

.event-side {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  justify-content: flex-end;
}

.event-side svg {
  width: 16px;
  height: 16px;
  color: var(--muted);
}

.event-detail {
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  padding: 0 12px;
  color: var(--muted);
  transition: max-height .24s ease, opacity .18s ease, padding .24s ease;
}

.event-row.expanded .event-detail {
  max-height: 240px;
  opacity: 1;
  padding: 0 12px 12px 104px;
}

.event-detail p {
  margin: 6px 0 0;
  line-height: 1.55;
}

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

.module-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-strong);
  padding: 14px;
  display: grid;
  gap: 10px;
  min-height: 138px;
}

.module-card.system {
  background: #f9fafb;
}

.module-card.paid {
  border-color: #fedf89;
}

.module-card.locked {
  background: #fffaf0;
}

.module-top, .module-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.module-actions { margin-top: auto; }
.module-actions button:disabled { opacity: .55; cursor: not-allowed; }

.panel-head-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.loading-state {
  grid-column: 1 / -1;
  grid-template-columns: 34px 1fr;
  align-items: center;
}

.loading-spinner {
  width: 22px;
  height: 22px;
  border-radius: 999px;
  border: 2px solid var(--line-strong);
  border-top-color: var(--blue);
  animation: spin .72s linear infinite;
}

.inline-enhancer {
  border: 1px dashed #b2ccff;
  border-radius: 8px;
  padding: 12px;
  background: #f5f8ff;
  display: grid;
  gap: 10px;
}

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

.inline-enhancer-head span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin-top: 4px;
}

.inline-form {
  display: grid;
  grid-template-columns: minmax(220px, 1.25fr) minmax(96px, .46fr) minmax(130px, .6fr) minmax(110px, auto);
  gap: 8px;
  align-items: end;
}

.inline-form label,
.inline-form .field-block {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.portfolio-id-control {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 40px;
  gap: 4px;
  align-items: center;
}

.scan-square {
  width: 40px;
  min-width: 40px;
  min-height: 40px;
  padding: 0;
  border-color: var(--blue);
  background: var(--blue);
  color: #fff;
}

.scan-square:hover {
  border-color: #1849a9;
  background: #1849a9;
  color: #fff;
}

.inline-form [data-save-inline-multi-trader] {
  min-width: 110px;
  min-height: 40px;
  white-space: nowrap;
}

.inline-form [data-save-inline-multi-trader] span {
  white-space: nowrap;
}

.sr-only-file {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.toggle-line {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
}

.scan-choice-modal {
  width: min(430px, 100%);
}

.scan-choice-actions {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.scan-choice-actions button {
  min-height: 46px;
}

.toggle-line input {
  width: 16px;
  height: 16px;
}

.module-workbench {
  display: grid;
  gap: 16px;
}

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

.workbench-summary > div {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-soft);
  padding: 14px;
}

.workbench-summary span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 6px;
}

.workbench-summary b {
  font-size: 15px;
}

.button-row,
.form-actions.compact {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.compact-grid {
  display: grid;
  gap: 12px;
}

.totp-box {
  display: grid;
  gap: 12px;
  max-width: 820px;
}

.totp-box textarea {
  min-height: 76px;
  resize: vertical;
}

.totp-setup-grid {
  display: grid;
  grid-template-columns: 176px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.totp-qr {
  width: 176px;
  min-height: 176px;
  display: grid;
  place-items: center;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
}

.totp-qr svg {
  width: 152px;
  height: 152px;
  display: block;
}

.qr-fallback {
  color: var(--muted);
  font-size: 13px;
}

.totp-secret-fields {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.setup-shell { overflow: hidden; }

.setup-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  border-bottom: 1px solid var(--line);
  background: #f9fafb;
  padding: 12px;
}

.setup-tabs button {
  border: 1px solid transparent;
  border-radius: 8px;
  min-height: 62px;
  background: transparent;
  justify-content: flex-start;
  padding: 10px 12px;
  text-align: left;
}

.setup-tabs button.active {
  background: #fff;
  color: var(--ink);
  border-color: var(--line-strong);
  box-shadow: inset 0 -3px 0 var(--blue);
}

.setup-tabs button > span { display: grid; gap: 2px; }
.setup-tabs b { font-size: 15px; }
.setup-tabs small { color: var(--muted); font-size: 12px; }

.setup-body { padding: 16px; }

.setup-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(260px, .55fr);
  gap: 12px;
}

.setup-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-strong);
  padding: 14px;
  display: grid;
  gap: 12px;
  align-content: start;
}

.setup-card.wide { min-height: 245px; }

textarea {
  width: 100%;
  min-height: 132px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  padding: 12px;
  resize: vertical;
  color: var(--ink);
  background: #fbfcfb;
}

input {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #fbfcfb;
  color: var(--ink);
  padding: 9px 11px;
}

input[type="checkbox"] {
  width: 16px;
  height: 16px;
  min-height: 0;
  padding: 0;
  border-radius: 4px;
  accent-color: var(--blue);
  flex: 0 0 auto;
}

label span { font-weight: 740; }

.form-actions, .compact-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.file-button {
  min-height: 38px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: var(--panel-strong);
  padding: 0 13px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.file-button input { display: none; }

.preview-card {
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #f9fbf8;
}

.preview-card span { display: block; color: var(--muted); margin-top: 4px; }

.wizard-multi-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbff;
  padding: 12px;
}

.wizard-multi-fields .toggle-line {
  align-self: end;
  min-height: 40px;
}

.mini-steps {
  display: grid;
  gap: 8px;
  counter-reset: step;
}

.mini-steps span {
  counter-increment: step;
  display: grid;
  grid-template-columns: 24px 1fr;
  gap: 8px;
  align-items: start;
}

.mini-steps span::before {
  content: counter(step);
  width: 24px;
  height: 24px;
  border-radius: 99px;
  display: grid;
  place-items: center;
  background: #344054;
  color: white;
  font-size: 12px;
  font-weight: 800;
}

.api-flow {
  display: grid;
  gap: 12px;
}

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

.api-choice {
  min-height: 76px;
  display: grid;
  grid-template-columns: 38px 1fr;
  align-items: center;
  justify-content: start;
  text-align: left;
  padding: 10px 12px;
  border-color: var(--line);
  background: #fff;
}

.api-choice.active {
  border-color: #b2ccff;
  background: var(--blue-soft);
  box-shadow: inset 0 0 0 1px rgba(23,92,211,.12);
}

.api-choice span:not(.exchange-logo) { display: grid; gap: 3px; }

.api-choice small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.panel-head.plain {
  min-height: auto;
  padding: 0;
  border: 0;
}

.title-with-logo {
  display: flex;
  align-items: center;
  gap: 9px;
}

.exchange-logo.small {
  width: 30px;
  height: 30px;
  font-size: 12px;
}

.numbered-steps {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  counter-reset: api-step;
}

.numbered-steps span {
  counter-increment: api-step;
  min-height: 66px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f9fafb;
  padding: 10px 10px 10px 38px;
  position: relative;
  font-weight: 720;
  line-height: 1.35;
}

.numbered-steps span::before {
  content: counter(api-step);
  position: absolute;
  left: 10px;
  top: 10px;
  width: 20px;
  height: 20px;
  border-radius: 99px;
  display: grid;
  place-items: center;
  background: #344054;
  color: white;
  font-size: 11px;
  font-weight: 900;
}

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

.permission-grid > div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  display: grid;
  gap: 8px;
  background: #f9fafb;
}

.permission {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
}

.permission.ok { color: #087044; }
.permission.bad { color: #8c1f1f; }

.field-note {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f9fafb;
  padding: 10px 12px;
  color: var(--muted);
  font-size: 13px;
}

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

.credential-fields.compact { margin-top: -2px; }

.credential-fields label {
  display: grid;
  gap: 6px;
}

.save-card { min-height: auto; }

.check-list {
  display: grid;
  gap: 9px;
}

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

.hint-line {
  border-top: 1px solid var(--line);
  padding-top: 10px;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.hint-line.warn { color: var(--amber); }

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

.check-lane {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: var(--panel-strong);
  display: grid;
  gap: 10px;
  align-content: start;
}

.lane-index {
  width: 30px;
  height: 30px;
  border-radius: 99px;
  display: grid;
  place-items: center;
  background: #344054;
  color: white;
  font-weight: 900;
}

.coming-wrap {
  position: relative;
  min-height: 560px;
}

.blurred-demo {
  filter: blur(5px);
  opacity: .5;
  pointer-events: none;
}

.coming-overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(238, 242, 239, .48);
}

.coming-overlay > div {
  width: min(460px, 100%);
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  padding: 22px;
  background: rgba(255,255,255,.94);
  box-shadow: var(--shadow);
  display: grid;
  gap: 14px;
  text-align: center;
}

.module-empty {
  grid-column: 1 / -1;
  min-height: 150px;
  display: grid;
  grid-template-columns: 52px 1fr;
  gap: 14px;
  align-items: center;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  padding: 18px;
  background: #f9fafb;
}

.module-mark {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: #344054;
  color: white;
}

.empty-state {
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  padding: 14px;
  color: var(--muted);
  background: #f9fafb;
}

/* Finance console pass: preserve behavior, replace template-style visuals. */
.rail {
  background:
    linear-gradient(180deg, rgba(255,255,255,.025), transparent 240px),
    var(--terminal);
  border-right: 1px solid #0d0f0c;
}

nav {
  gap: 18px;
}

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

.nav-group-label {
  padding: 0 10px 5px;
  color: var(--terminal-muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
}

.nav-btn {
  position: relative;
  min-height: 38px;
  color: rgba(255,255,255,.72);
  border-radius: 6px;
  padding-left: 12px;
}

.nav-btn.active,
.nav-btn:hover {
  background: rgba(255,255,255,.075);
}

.nav-btn.active::after { display: none; }

.nav-btn.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 7px;
  bottom: 7px;
  width: 2px;
  border-radius: 2px;
  background: var(--terminal-active);
}

.nav-btn.soon {
  opacity: .42;
}

.rail-note {
  border-top-color: var(--terminal-line);
}

.page-decor {
  width: min(210px, 18vw);
  opacity: .055;
}

.decor-line,
.decor-line.soft {
  stroke: rgba(16, 24, 40, .55);
}

.decor-bars rect {
  fill: rgba(16, 24, 40, .26);
}

button,
.primary,
.ghost,
.file-button {
  transition: border-color .16s ease, background-color .16s ease, color .16s ease, transform .16s ease;
}

button:focus-visible,
.exchange-card:focus-visible {
  outline: none;
  box-shadow: var(--focus);
}

button.is-loading {
  position: relative;
  color: transparent !important;
  pointer-events: none;
}

button.is-loading svg,
button.is-loading span {
  opacity: 0;
}

button.is-loading::after {
  content: "";
  position: absolute;
  width: 15px;
  height: 15px;
  border-radius: 999px;
  border: 2px solid var(--blue);
  border-top-color: transparent;
  animation: spin .72s linear infinite;
}

.primary.is-loading::after {
  border-color: #fff;
  border-top-color: transparent;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.panel {
  box-shadow: none;
}

.panel-meta {
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.exchange-card {
  position: relative;
  cursor: pointer;
  gap: 14px;
  padding: 16px;
  min-height: 218px;
  overflow: hidden;
  border-color: #d9e0ea;
  background: #fff;
  transition: border-color .16s ease, background-color .16s ease, transform .16s ease;
}

.exchange-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 2px;
  background: #d0d5dd;
}

.exchange-card:hover {
  border-color: #98a2b3;
  background: #fcfcfd;
  transform: translateY(-1px);
}

.exchange-card-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
}

.exchange-title {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
}

.exchange-title h3 {
  font-size: 17px;
  font-weight: 700;
}

.exchange-title span,
.exchange-state small,
.exchange-equity span,
.exchange-metrics span {
  color: var(--muted);
  font-size: 12px;
}

.exchange-state {
  display: grid;
  justify-items: end;
  gap: 4px;
}

.status-dot {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.status-dot::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 99px;
  background: currentColor;
}

.status-dot.ok { color: var(--green); }
.status-dot.warn { color: var(--amber); }
.status-dot.bad { color: var(--red); }

.exchange-equity {
  display: grid;
  gap: 5px;
  padding-top: 2px;
}

.exchange-equity b {
  font-size: 30px;
  line-height: 1;
  font-weight: 760;
  font-variant-numeric: tabular-nums;
}

.exchange-equity small {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.exchange-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  border: 1px solid var(--line);
  background: var(--line);
}

.exchange-metrics div {
  display: grid;
  gap: 3px;
  min-width: 0;
  padding: 10px;
  background: var(--surface-2);
}

.exchange-metrics b {
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 13px;
  font-weight: 730;
  white-space: nowrap;
}

.exchange-actions {
  display: flex;
  gap: 7px;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity .16s ease, transform .16s ease;
}

.exchange-card:hover .exchange-actions,
.exchange-card:focus-within .exchange-actions {
  opacity: 1;
  transform: translateY(0);
}

.exchange-actions button {
  min-height: 32px;
  padding: 0 10px;
  font-size: 12px;
}

.position-list {
  padding: 0;
}

.position-table {
  display: grid;
}

.position-head,
.position-row {
  display: grid;
  grid-template-columns: minmax(190px, 1.15fr) minmax(150px, .9fr) repeat(3, minmax(96px, .55fr)) minmax(136px, .7fr);
  align-items: center;
  column-gap: 12px;
}

.position-head {
  min-height: 40px;
  padding: 0 18px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  background: var(--surface-2);
}

.position-row {
  position: relative;
  min-height: var(--row-h);
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  padding: 10px 18px;
  background: #fff;
}

.position-row:last-child {
  border-bottom: 0;
}

.position-row:hover {
  background: #f8fafc;
}

.position-row.warn {
  border-color: var(--line);
  background: #fff;
}

.position-row.warn::before,
.position-row.bad::before {
  content: "";
  position: absolute;
  left: 0;
  top: 12px;
  bottom: 12px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--amber);
}

.position-row.bad::before {
  background: var(--red);
}

.position-row .cell span {
  display: none;
}

.position-row .cell b {
  font-size: 15px;
}

.position-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.status-pill {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 9px;
  color: var(--muted);
  background: #fff;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.status-pill.ok {
  color: var(--green);
  border-color: #abefc6;
  background: #f6fef9;
}

.status-pill.warn {
  color: var(--amber);
  border-color: #fedf89;
  background: #fffcf5;
}

.status-pill.bad {
  color: var(--red);
  border-color: #fecdca;
  background: #fffbfa;
}

.row-actions {
  display: flex;
  gap: 5px;
  opacity: 0;
  transition: opacity .16s ease;
}

.position-row:hover .row-actions,
.position-row:focus-within .row-actions {
  opacity: 1;
}

.row-actions button {
  width: 30px;
  min-height: 30px;
  padding: 0;
}

.multi-trader-row .row-actions {
  opacity: 1;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.multi-trader-row .row-actions button {
  width: auto;
  min-height: 32px;
  padding: 6px 9px;
}

[data-tooltip] {
  position: relative;
}

[data-tooltip]:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  z-index: 20;
  right: 0;
  bottom: calc(100% + 8px);
  width: max-content;
  max-width: 260px;
  padding: 7px 9px;
  border: 1px solid #344054;
  border-radius: 6px;
  background: #101828;
  color: #fff;
  box-shadow: 0 8px 20px rgba(16, 24, 40, .14);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.4;
  white-space: normal;
}

.empty-state {
  display: grid;
  grid-template-columns: 82px 1fr;
  gap: 14px;
  align-items: center;
}

.empty-state b,
.empty-state span {
  display: block;
}

.empty-state span {
  margin-top: 4px;
  color: var(--quiet);
  font-size: 12px;
}

.empty-visual {
  width: 82px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  display: grid;
  place-items: center;
}

.empty-visual svg {
  width: 72px;
  height: 34px;
}

.empty-visual path {
  fill: none;
  stroke: #667085;
  stroke-width: 2;
}

.empty-visual circle {
  fill: #98a2b3;
}

.ui-loading .decision-cell b,
.ui-loading .exchange-equity b,
.ui-loading .exchange-metrics b {
  color: transparent;
  border-radius: 4px;
  background: linear-gradient(90deg, #eef2f6 25%, #f8fafc 38%, #eef2f6 63%);
  background-size: 400% 100%;
  animation: skeleton 1.1s ease infinite;
}

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

@media (max-width: 1180px) {
  .shell { grid-template-columns: 1fr; }
  .rail {
    position: static;
    height: auto;
    grid-template-rows: auto auto;
  }
  nav { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .nav-group { align-content: start; }
  .rail-note { display: none; }
  .decision { grid-template-columns: 1fr 1fr; }
  .exchange-grid, .exchange-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .span3, .span4, .span5, .span6, .span7, .span8 { grid-column: 1 / -1; }
  .setup-grid, .check-lanes, .credential-fields, .wizard-multi-fields, .inline-form, .activation-box { grid-template-columns: 1fr; }
  .totp-setup-grid { grid-template-columns: 1fr; }
  .totp-qr { width: 100%; min-height: 180px; }
  .numbered-steps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
  body { font-size: 14px; }
  .main { padding: 14px; }
  .topbar {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: end;
  }
  .top-actions {
    width: auto;
    justify-self: end;
  }
  .top-actions .primary { display: none; }
  h1 { font-size: 28px; }
  nav { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .decision, .exchange-grid, .exchange-grid.two, .kpis, .module-grid, .permission-grid, .api-choice-row, .numbered-steps, .workbench-summary { grid-template-columns: 1fr; }
  .decision-main, .decision-cell { border-right: 0; border-bottom: 1px solid var(--line); }
  .decision-cell:last-child { border-bottom: 0; }
  .nav-group-label { padding-top: 4px; }
  .exchange-card { min-height: auto; }
  .exchange-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .exchange-actions { opacity: 1; transform: none; flex-wrap: wrap; }
  .source-row { grid-template-columns: 48px 1fr; }
  .source-row .ghost { grid-column: 1 / -1; }
  .position-head { display: none; }
  .position-table { gap: 8px; }
  .position-row {
    grid-template-columns: 1fr;
    gap: 9px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 13px 14px;
  }
  .position-row .cell span { display: block; }
  .position-status { align-items: flex-start; }
  .row-actions { opacity: 1; }
  .position-row .symbol, .position-row .position-status { grid-column: 1 / -1; }
  .event-row { grid-template-columns: 1fr; }
  .event-main { grid-template-columns: 1fr; }
  .event-row.expanded .event-detail { padding: 0 12px 12px; }
  .page-decor { display: none; }
  .module-empty { grid-template-columns: 1fr; }
  .action-strip, .compact-actions, .form-actions { display: grid; grid-template-columns: 1fr; }
  .auth-card { grid-template-columns: 1fr; }
  .auth-form { grid-template-columns: 1fr; }
  .auth-form .primary { width: 100%; }
  .setup-tabs { grid-template-columns: 1fr; }
  .confirm-modal, .purchase-modal, .purchase-facts { grid-template-columns: 1fr; }
  .modal-actions { display: grid; grid-template-columns: 1fr; }
}
