:root {
  color-scheme: dark;
  --bg: #071019;
  --bg-soft: #0b1520;
  --panel: #0f1b27;
  --panel-2: #111f2d;
  --line: #203243;
  --line-soft: rgba(132, 163, 190, 0.18);
  --text: #edf5fb;
  --muted: #8fa1b3;
  --faint: #607383;
  --cyan: #43c8f2;
  --green: #3ed487;
  --red: #ff647c;
  --amber: #f4b84f;
  --blue: #7aa7ff;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.28);
  --sidebar-bg: rgba(7, 16, 25, 0.94);
  --topbar-bg: rgba(7, 16, 25, 0.9);
  --control-bg: #0a1420;
  --control-bg-elevated: rgba(15, 27, 39, 0.92);
  --panel-bg: rgba(15, 27, 39, 0.88);
  --tile-bg: rgba(7, 16, 25, 0.38);
  --modal-bg: #0d1824;
  --overlay-bg: rgba(2, 7, 12, 0.72);
  --radius: 6px;
  --radius-sm: 4px;
  --sidebar: 232px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}


html[data-theme="light"] {
  color-scheme: light;
  --bg: #f5f8fb;
  --bg-soft: #edf3f8;
  --panel: #ffffff;
  --panel-2: #f3f7fb;
  --line: #c8d6e2;
  --line-soft: rgba(58, 84, 106, 0.16);
  --text: #122333;
  --muted: #5f7183;
  --faint: #7f93a4;
  --cyan: #0c99c6;
  --green: #139b62;
  --red: #d53f5b;
  --amber: #b7791f;
  --blue: #326ee6;
  --shadow: 0 18px 40px rgba(18, 35, 51, 0.12);
  --sidebar-bg: rgba(255, 255, 255, 0.94);
  --topbar-bg: rgba(245, 248, 251, 0.92);
  --control-bg: #ffffff;
  --control-bg-elevated: rgba(255, 255, 255, 0.94);
  --panel-bg: rgba(255, 255, 255, 0.92);
  --tile-bg: rgba(255, 255, 255, 0.7);
  --modal-bg: #ffffff;
  --overlay-bg: rgba(14, 24, 34, 0.34);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    linear-gradient(180deg, rgba(20, 47, 68, 0.42), transparent 360px),
    var(--bg);
  color: var(--text);
  letter-spacing: 0;
}

html[data-theme="light"] body {
  background:
    linear-gradient(180deg, rgba(12, 153, 198, 0.12), transparent 360px),
    var(--bg);
}

button,
input,
select {
  font: inherit;
}

button {
  color: inherit;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: var(--sidebar) minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 18px 14px;
  border-right: 1px solid var(--line);
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  gap: 24px;
  z-index: 10;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 4px 10px;
}

.brand-mark {
  width: 40px;
  height: 40px;
  border-radius: var(--radius);
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #122536, #1f4560);
  border: 1px solid rgba(67, 200, 242, 0.32);
  color: var(--cyan);
  font-weight: 800;
  font-size: 13px;
}

.brand strong {
  display: block;
  font-size: 15px;
  line-height: 1.2;
}

.brand span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.nav-stack {
  display: grid;
  gap: 6px;
}

.nav-item,
.mobile-tabs button {
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: transparent;
  color: var(--muted);
  text-align: left;
  cursor: pointer;
  font-size: 13px;
  font-weight: 650;
}

.nav-item:hover,
.nav-item.is-active {
  color: var(--text);
  background: rgba(67, 200, 242, 0.09);
  border-color: rgba(67, 200, 242, 0.2);
}

.sidebar-status {
  margin-top: auto;
  display: grid;
  gap: 9px;
  padding: 12px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: var(--tile-bg);
  color: var(--muted);
  font-size: 12px;
}

.sidebar-status div {
  display: flex;
  align-items: center;
  gap: 7px;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--faint);
}

.status-dot.is-live {
  background: var(--green);
  box-shadow: 0 0 0 4px rgba(62, 212, 135, 0.12);
}

.workspace {
  min-width: 0;
  padding: 16px 18px 84px;
}

.topbar {
  position: sticky;
  top: 0;
  display: grid;
  grid-template-columns: auto minmax(220px, 1fr) auto auto auto auto auto;
  gap: 10px;
  align-items: center;
  z-index: 8;
  padding: 10px;
  margin: -16px -18px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--topbar-bg);
  backdrop-filter: blur(12px);
}

.mobile-menu {
  display: none;
}

.symbol-search {
  height: 40px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--control-bg-elevated);
}

.symbol-search span {
  color: var(--muted);
  font-size: 12px;
}

input,
select {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--control-bg);
  color: var(--text);
  padding: 0 10px;
  outline: none;
}

.symbol-search input {
  width: 100%;
  min-height: 30px;
  border: 0;
  padding: 0;
  background: transparent;
}

input:focus,
select:focus {
  border-color: rgba(67, 200, 242, 0.65);
  box-shadow: 0 0 0 3px rgba(67, 200, 242, 0.12);
}

.segmented {
  display: inline-grid;
  grid-auto-flow: column;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--control-bg);
}

.segmented button,
.mini-tabs button {
  min-width: 40px;
  min-height: 30px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
}

.segmented button.is-active,
.mini-tabs button.is-active {
  color: var(--text);
  background: rgba(67, 200, 242, 0.16);
}

.toolbar-select {
  width: 82px;
}

.primary-action,
.ghost-button,
.account-button,
.close-button {
  min-height: 38px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  padding: 0 14px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.primary-action {
  color: #031018;
  background: var(--cyan);
}

.primary-action:hover {
  background: #6ed9f7;
}

.ghost-button,
.account-button,
.close-button {
  color: var(--text);
  background: var(--control-bg-elevated);
  border-color: var(--line);
}

.ghost-button:hover,
.account-button:hover,
.close-button:hover {
  border-color: rgba(67, 200, 242, 0.42);
}

.account-button {
  min-width: 82px;
  max-width: 190px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  text-overflow: ellipsis;
}

.account-button.is-login-cta {
  color: #031018;
  background: var(--cyan);
  border-color: rgba(67, 200, 242, 0.75);
  box-shadow: 0 0 0 3px rgba(67, 200, 242, 0.14);
  font-size: 13px;
}

.account-button.is-login-cta:hover {
  background: #6ed9f7;
}

.ghost-button.danger {
  color: var(--red);
  border-color: rgba(255, 100, 124, 0.32);
}

.primary-action.full {
  width: 100%;
}

.ghost-button.full {
  width: 100%;
}

.theme-toggle {
  min-width: 64px;
}

.view {
  display: none;
}

.view.is-active {
  display: block;
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin: 10px 0 14px;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: clamp(24px, 3vw, 36px);
  line-height: 1.05;
  letter-spacing: 0;
}

h2 {
  font-size: 15px;
  line-height: 1.25;
}

h3 {
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.page-head p,
.panel-title p,
.muted-text {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.freshness,
.control-row {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
}

.control-row label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
}

.metrics-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.metric-tile {
  min-height: 78px;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-bg);
  color: var(--muted);
  padding: 13px;
  cursor: pointer;
}

.metric-tile span {
  display: block;
  font-size: 12px;
  margin-bottom: 10px;
}

.metric-tile strong {
  color: var(--text);
  font-size: 28px;
  line-height: 1;
}

.metric-tile.is-active {
  border-color: rgba(67, 200, 242, 0.5);
  background: linear-gradient(135deg, rgba(67, 200, 242, 0.14), var(--panel-bg));
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 320px);
  gap: 12px;
}

.lower-grid,
.exchange-grid,
.billing-layout {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.exchange-grid,
.billing-layout {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.simulation-detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(280px, 0.8fr);
  gap: 12px;
  margin-top: 12px;
}

.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-bg);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.panel-title {
  min-height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 14px;
  border-bottom: 1px solid var(--line-soft);
}

.panel-title.compact {
  min-height: 48px;
}

.panel-actions,
.button-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.table-wrap {
  overflow: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

.data-table th,
.data-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line-soft);
  text-align: left;
  font-size: 12px;
  vertical-align: middle;
}

.data-table th {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.data-table tbody tr:hover {
  background: rgba(67, 200, 242, 0.05);
}

.symbol-cell {
  display: grid;
  gap: 3px;
}

.symbol-cell strong {
  font-size: 13px;
}

.symbol-cell span,
.source-tag,
.time-text {
  color: var(--muted);
  font-size: 11px;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 66px;
  min-height: 24px;
  padding: 0 8px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 900;
}

.badge.long {
  color: #062014;
  background: var(--green);
}

.badge.short {
  color: #24060d;
  background: var(--red);
}

.badge.wait {
  color: #2b2107;
  background: var(--amber);
}

.badge.error {
  color: var(--text);
  background: #6f3542;
}

.positive {
  color: var(--green);
}

.negative {
  color: var(--red);
}

.watchlist-panel {
  min-height: 100%;
}

.mini-tabs {
  display: inline-grid;
  grid-auto-flow: column;
  gap: 2px;
  padding: 2px;
  background: var(--control-bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.watch-block {
  padding: 13px 14px 4px;
}

.watch-list {
  display: grid;
  gap: 6px;
  margin-top: 9px;
}

.watch-row,
.mini-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  min-height: 34px;
  padding: 8px 10px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
  background: var(--tile-bg);
  font-size: 12px;
}

.mini-table {
  display: grid;
  gap: 6px;
  padding: 12px;
}

.sim-summary,
.stats-pair,
.performance-grid {
  display: grid;
  gap: 10px;
}

.sim-summary {
  grid-template-columns: repeat(3, 1fr);
  padding: 14px;
}

.sim-summary div,
.stats-pair span,
.performance-card {
  display: grid;
  gap: 6px;
  padding: 12px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: var(--tile-bg);
}

.sim-summary span,
.stats-pair span,
.performance-card span {
  color: var(--muted);
  font-size: 11px;
}

.sim-summary strong,
.performance-card strong {
  font-size: 20px;
}

.sparkline {
  height: 58px;
  margin: 0 14px 14px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(62, 212, 135, 0.16), transparent),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.035) 0, rgba(255, 255, 255, 0.035) 1px, transparent 1px, transparent 20px);
}

.accuracy-dial {
  height: 118px;
  margin: 14px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(67, 200, 242, 0.26);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(67, 200, 242, 0.16), var(--tile-bg));
  text-align: center;
}

.accuracy-dial strong {
  font-size: 30px;
}

.accuracy-dial span {
  color: var(--muted);
  font-size: 11px;
}

.stats-pair {
  grid-template-columns: repeat(2, 1fr);
  padding: 0 14px 14px;
}

.form-panel {
  padding: 14px;
}

.form-panel .panel-title {
  margin: -14px -14px 14px;
}

.form-panel label,
.login-card label {
  display: grid;
  gap: 7px;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 12px;
}

.check-row {
  display: flex !important;
  grid-template-columns: none !important;
  align-items: center;
  gap: 8px !important;
}

.check-row input {
  min-height: auto;
  width: 16px;
  height: 16px;
}

.form-message {
  min-height: 18px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 12px;
}

.sim-ledger,
.performance-grid,
.plan-list {
  padding: 14px;
}

.sim-ledger {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.ledger-card,
.plan-card {
  padding: 13px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: var(--tile-bg);
}

.ledger-card span,
.plan-card span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  margin-bottom: 7px;
}

.ledger-card strong,
.plan-card strong {
  font-size: 20px;
}

.sim-position-list,
.custom-metric-list {
  display: grid;
  gap: 10px;
  padding: 14px;
}

.position-card,
.custom-metric-item,
.empty-state {
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: var(--tile-bg);
}

.position-card {
  padding: 13px;
}

.position-card header,
.custom-metric-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.position-card header {
  margin-bottom: 12px;
}

.position-card header strong,
.custom-metric-item strong,
.empty-state strong {
  display: block;
  font-size: 13px;
}

.position-card header span,
.custom-metric-item span,
.empty-state span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
}

.position-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.position-metrics span {
  min-width: 0;
  padding: 9px;
  border-radius: var(--radius-sm);
  background: rgba(7, 16, 25, 0.24);
  color: var(--muted);
  font-size: 11px;
}

.position-metrics strong {
  display: block;
  overflow-wrap: anywhere;
  margin-top: 4px;
  color: var(--text);
  font-size: 12px;
}

.funding-history-panel {
  margin-top: 12px;
}

.funding-history-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border-top: 1px solid var(--line);
}

.funding-history-row {
  display: flex;
  min-width: 0;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}

.funding-history-row:nth-child(odd) {
  border-right: 1px solid var(--line);
}

.funding-history-row > span {
  display: grid;
  min-width: 0;
  gap: 4px;
}

.funding-history-row > span:last-child {
  text-align: right;
}

.funding-history-row strong,
.funding-history-row small {
  overflow-wrap: anywhere;
}

.funding-history-row small {
  color: var(--muted);
}

.card-checkout-panel,
.billing-portal-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px;
  margin-bottom: 14px;
  border: 1px solid var(--line);
  background: var(--panel-2);
}

.card-checkout-panel[hidden],
.billing-portal-panel[hidden] {
  display: none;
}

.card-checkout-panel > div,
.billing-portal-panel > div {
  display: grid;
  gap: 4px;
}

.card-checkout-panel p,
.billing-portal-panel p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.billing-portal-panel {
  border-color: rgba(35, 161, 134, 0.35);
}

@media (max-width: 760px) {
  .funding-history-list {
    grid-template-columns: 1fr;
  }

  .funding-history-row:nth-child(odd) {
    border-right: 0;
  }

  .funding-history-row,
  .card-checkout-panel,
  .billing-portal-panel {
    align-items: stretch;
    flex-direction: column;
  }

  .funding-history-row > span:last-child {
    text-align: left;
  }
}

.simulation-trades-panel {
  margin-top: 14px;
}

.simulation-trade-controls {
  display: grid;
  grid-template-columns: minmax(130px, 1fr) 112px 132px 86px auto;
  gap: 8px;
  align-items: center;
}

.simulation-trade-controls input,
.simulation-trade-controls select {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--control-bg);
  color: var(--text);
  padding: 0 10px;
  font: inherit;
  font-size: 12px;
}

.simulation-trades-table {
  min-width: 980px;
}

.simulation-trades-table td strong,
.simulation-trades-table td em {
  display: inline-flex;
  margin-bottom: 4px;
}

.muted-cell {
  display: block;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.custom-metric-item {
  padding: 10px;
}

.custom-metric-item .ghost-button {
  min-height: 30px;
  padding: 0 10px;
}

.empty-state {
  padding: 14px;
}

.empty-state.compact {
  padding: 10px;
}

.plan-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.plan-card.is-selected {
  border-color: rgba(67, 200, 242, 0.55);
  background: rgba(67, 200, 242, 0.08);
}

.payment-qr {
  width: min(100%, 220px);
  border-radius: var(--radius);
  border: 1px solid var(--line);
  margin-bottom: 12px;
}

.modal-layer {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: var(--overlay-bg);
  backdrop-filter: blur(10px);
  z-index: 40;
}

.modal-layer[hidden] {
  display: none;
}

.login-card,
.account-card {
  width: 100%;
  max-width: 520px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--modal-bg);
  box-shadow: var(--shadow);
  padding: 18px;
  position: relative;
}

.login-card h2 {
  font-size: 24px;
  margin-bottom: 8px;
  padding-right: 44px;
}

.login-card p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
  margin-bottom: 16px;
}

.account-card {
  max-width: 640px;
}

.account-profile {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding-right: 42px;
}

.account-avatar {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(67, 200, 242, 0.16);
  color: var(--cyan);
  font-size: 15px;
  font-weight: 900;
  border: 1px solid rgba(67, 200, 242, 0.28);
}

.account-profile h2 {
  margin: 0 0 4px;
  font-size: 22px;
}

.account-profile p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-status-badge {
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(62, 212, 135, 0.28);
  border-radius: 999px;
  padding: 0 10px;
  color: var(--green);
  background: rgba(62, 212, 135, 0.08);
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.account-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 16px;
}

.account-summary-grid > div,
.account-detail-row {
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: var(--tile-bg);
  padding: 12px;
}

.account-summary-grid span,
.account-detail-row span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.account-summary-grid strong,
.account-detail-row strong {
  display: block;
  margin-top: 6px;
  font-size: 18px;
  line-height: 1.2;
}

.account-summary-grid small,
.account-detail-row small {
  display: block;
  min-height: 16px;
  margin-top: 6px;
  color: var(--muted);
  font-size: 11px;
  overflow-wrap: anywhere;
}

.account-action-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-top: 14px;
}

.account-action-grid .ghost-button {
  width: 100%;
}

.account-detail-list {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.account-detail-row {
  display: grid;
  grid-template-columns: 128px minmax(0, 1fr);
  gap: 6px 12px;
  align-items: center;
}

.account-detail-row strong {
  margin-top: 0;
  font-size: 14px;
}

.account-detail-row small {
  grid-column: 2;
  margin-top: 0;
}

.account-footer {
  display: flex;
  justify-content: flex-end;
  margin-top: 14px;
}

.auth-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  padding: 4px;
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--control-bg);
}

.auth-tabs button {
  min-height: 34px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
}

.auth-tabs button.is-active {
  background: rgba(67, 200, 242, 0.16);
  color: var(--text);
}

.auth-panel {
  display: none;
}

.auth-panel.is-active {
  display: block;
}

.password-step {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line-soft);
}

.terms-row {
  align-items: flex-start;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--line-soft);
}

.close-button {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  min-height: 32px;
  padding: 0;
  font-size: 18px;
  line-height: 1;
}

.admin-code-box {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--line-soft);
  color: var(--muted);
  font-size: 12px;
}

.mobile-tabs {
  display: none;
}

@media (max-width: 1080px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    display: none;
  }

  .topbar {
    grid-template-columns: auto minmax(0, 1fr) auto auto auto auto;
  }

  .mobile-menu {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--control-bg-elevated);
    color: var(--text);
    padding: 0 12px;
  }

  .segmented {
    display: none;
  }

  .dashboard-grid,
  .lower-grid,
  .exchange-grid,
  .billing-layout,
  .simulation-detail-grid {
    grid-template-columns: 1fr;
  }

  .simulation-trade-controls {
    width: 100%;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }

  .simulation-trade-controls .ghost-button {
    grid-column: 1 / -1;
  }

  .metrics-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .mobile-tabs {
    position: fixed;
    left: 10px;
    right: 10px;
    bottom: 10px;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 4px;
    padding: 5px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--topbar-bg);
    z-index: 30;
  }

  .mobile-tabs button {
    text-align: center;
    padding: 0 4px;
    min-height: 38px;
    font-size: 11px;
  }

  .mobile-tabs button.is-active {
    color: var(--text);
    background: rgba(67, 200, 242, 0.16);
  }
}

@media (max-width: 680px) {
  .workspace {
    padding: 12px 10px 86px;
  }

  .topbar {
    margin: -12px -10px 12px;
    grid-template-columns: minmax(0, 1fr) auto auto;
  }

  .mobile-menu {
    display: none;
  }

  .account-button {
    min-height: 36px;
    padding: 0 12px;
    max-width: 132px;
  }

  .symbol-search {
    grid-column: 1 / -1;
  }

  .toolbar-select,
  .theme-toggle {
    min-height: 36px;
  }

  .primary-action {
    min-height: 36px;
  }

  .page-head {
    display: grid;
    align-items: start;
  }

  .metrics-row {
    grid-template-columns: 1fr 1fr;
  }

  .metric-tile {
    min-height: 68px;
    padding: 10px;
  }

  .metric-tile strong {
    font-size: 23px;
  }

  .panel-title {
    align-items: flex-start;
    display: grid;
  }

  .account-card {
    max-height: calc(100vh - 28px);
    overflow: auto;
    padding: 16px;
  }

  .account-profile {
    grid-template-columns: 40px minmax(0, 1fr);
    padding-right: 38px;
  }

  .account-avatar {
    width: 40px;
    height: 40px;
    font-size: 13px;
  }

  .account-status-badge {
    grid-column: 1 / -1;
    justify-self: start;
  }

  .account-summary-grid,
  .account-detail-row {
    grid-template-columns: 1fr;
  }

  .account-detail-row small {
    grid-column: auto;
  }

  .account-action-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .sim-summary,
  .stats-pair,
  .plan-list,
  .sim-ledger,
  .position-metrics {
    grid-template-columns: 1fr;
  }

  .signal-table {
    min-width: 0;
    table-layout: fixed;
  }

  .signal-table th,
  .signal-table td {
    padding: 10px 8px;
  }

  .signal-table th:nth-child(2),
  .signal-table td:nth-child(2),
  .signal-table th:nth-child(n + 5),
  .signal-table td:nth-child(n + 5) {
    display: none;
  }

  .signal-table th:nth-child(1),
  .signal-table td:nth-child(1) {
    width: 54%;
  }

  .signal-table th:nth-child(3),
  .signal-table td:nth-child(3) {
    width: 27%;
  }

  .signal-table th:nth-child(4),
  .signal-table td:nth-child(4) {
    width: 19%;
    text-align: right;
  }

  .signal-table .badge {
    min-width: 58px;
  }

  .symbol-cell span {
    display: -webkit-box;
    overflow: hidden;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
  }
}

/* Final cascade layer for the TopBill trading-console redesign. */
:root {
  --bg: #050b12;
  --bg-soft: #07111c;
  --panel: #0d1723;
  --panel-2: #101d2b;
  --line: rgba(98, 132, 164, 0.28);
  --line-soft: rgba(116, 148, 177, 0.14);
  --text: #f3f8fc;
  --muted: #9aaec0;
  --faint: #62778a;
  --cyan: #18bdf8;
  --green: #24d684;
  --red: #ff5f7a;
  --amber: #f3b84e;
  --blue: #68a7ff;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.34);
  --sidebar-bg: rgba(4, 12, 20, 0.96);
  --topbar-bg: rgba(6, 14, 23, 0.88);
  --control-bg: rgba(4, 11, 18, 0.82);
  --control-bg-elevated: rgba(13, 25, 38, 0.92);
  --panel-bg: linear-gradient(180deg, rgba(18, 33, 49, 0.92), rgba(9, 18, 29, 0.92));
  --tile-bg: rgba(10, 22, 34, 0.74);
  --modal-bg: linear-gradient(180deg, #101d2b, #0a1420);
  --overlay-bg: rgba(1, 6, 12, 0.74);
  --radius: 8px;
  --radius-sm: 6px;
  --sidebar: 248px;
}

html[data-theme="light"] {
  --bg: #f3f7fb;
  --bg-soft: #eaf1f7;
  --panel: #ffffff;
  --panel-2: #f5f9fc;
  --line: rgba(52, 82, 108, 0.22);
  --line-soft: rgba(52, 82, 108, 0.12);
  --text: #102132;
  --muted: #617588;
  --faint: #8497a8;
  --cyan: #068fc1;
  --green: #07965b;
  --red: #d83e59;
  --amber: #b7791f;
  --blue: #286be8;
  --shadow: 0 24px 70px rgba(39, 60, 82, 0.13);
  --sidebar-bg: rgba(255, 255, 255, 0.94);
  --topbar-bg: rgba(244, 248, 252, 0.9);
  --control-bg: rgba(255, 255, 255, 0.88);
  --control-bg-elevated: rgba(255, 255, 255, 0.96);
  --panel-bg: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(247, 251, 254, 0.96));
  --tile-bg: rgba(255, 255, 255, 0.82);
  --modal-bg: linear-gradient(180deg, #ffffff, #f6f9fc);
  --overlay-bg: rgba(15, 26, 38, 0.34);
}

body {
  background:
    linear-gradient(rgba(255, 255, 255, 0.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.014) 1px, transparent 1px),
    linear-gradient(145deg, rgba(24, 189, 248, 0.13), transparent 34%),
    linear-gradient(180deg, #06111d 0%, var(--bg) 42%, #03070d 100%);
  background-size: 46px 46px, 46px 46px, auto, auto;
  font-feature-settings: "tnum" 1, "cv03" 1, "cv04" 1;
}

html[data-theme="light"] body {
  background:
    linear-gradient(rgba(36, 62, 86, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(36, 62, 86, 0.035) 1px, transparent 1px),
    linear-gradient(145deg, rgba(6, 143, 193, 0.13), transparent 38%),
    var(--bg);
  background-size: 46px 46px, 46px 46px, auto, auto;
}

.sidebar {
  padding: 20px 14px;
  border-right-color: rgba(102, 137, 169, 0.2);
  background: linear-gradient(180deg, rgba(10, 24, 37, 0.92), rgba(2, 8, 14, 0.96)), var(--sidebar-bg);
  box-shadow: inset -1px 0 0 rgba(255, 255, 255, 0.04);
}

html[data-theme="light"] .sidebar {
  background: var(--sidebar-bg);
}

.brand {
  min-height: 56px;
  padding: 4px 6px 14px;
  border-bottom: 1px solid var(--line-soft);
}

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(24, 189, 248, 0.26), rgba(36, 214, 132, 0.1)), #071727;
  box-shadow: inset 0 0 0 1px rgba(24, 189, 248, 0.34), 0 10px 28px rgba(24, 189, 248, 0.13);
  color: #68ddff;
  font-size: 12px;
  font-weight: 900;
}

.brand strong {
  font-size: 18px;
}

.brand span {
  color: var(--faint);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.nav-stack {
  gap: 4px;
}

.nav-item,
.mobile-tabs button {
  position: relative;
  min-height: 42px;
  border-radius: 8px;
  color: #a8bacb;
  font-weight: 760;
}

.nav-item:hover,
.nav-item.is-active {
  background: linear-gradient(90deg, rgba(24, 189, 248, 0.18), rgba(24, 189, 248, 0.05));
  border-color: rgba(24, 189, 248, 0.24);
}

.nav-item.is-active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 9px;
  bottom: 9px;
  width: 3px;
  border-radius: 99px;
  background: var(--cyan);
  box-shadow: 0 0 18px rgba(24, 189, 248, 0.48);
}

.sidebar-status {
  padding: 14px;
  border-color: rgba(98, 132, 164, 0.22);
  border-radius: 10px;
  background: linear-gradient(180deg, rgba(17, 32, 48, 0.72), rgba(8, 18, 30, 0.72));
}

.workspace {
  padding: 18px 22px 92px;
}

.topbar {
  grid-template-columns: auto minmax(260px, 1fr) auto auto auto auto auto;
  gap: 12px;
  padding: 12px 18px;
  margin: -18px -22px 18px;
  border-bottom-color: rgba(102, 137, 169, 0.22);
  background: var(--topbar-bg);
  box-shadow: 0 12px 38px rgba(0, 0, 0, 0.18);
  backdrop-filter: blur(18px) saturate(135%);
}

.symbol-search,
input,
select,
.segmented,
.mini-tabs {
  border-color: rgba(99, 134, 167, 0.28);
  background: var(--control-bg);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.035);
}

.symbol-search {
  height: 42px;
  border-radius: 10px;
}

.symbol-search span,
.control-row label,
.form-panel label,
.login-card label {
  color: var(--faint);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

input,
select,
.primary-action,
.ghost-button,
.account-button,
.close-button {
  border-radius: 8px;
}

input:focus,
select:focus {
  border-color: rgba(24, 189, 248, 0.72);
  box-shadow: 0 0 0 3px rgba(24, 189, 248, 0.13);
}

.segmented {
  border-radius: 10px;
  padding: 4px;
}

.segmented button,
.mini-tabs button,
.primary-action,
.ghost-button,
.account-button {
  font-weight: 850;
}

.segmented button.is-active,
.mini-tabs button.is-active {
  color: #eaf9ff;
  background: linear-gradient(180deg, #22bdf8, #0a8ed1);
  box-shadow: 0 8px 24px rgba(24, 189, 248, 0.22);
}

.primary-action {
  color: #031018;
  background: linear-gradient(180deg, #6bdcff, #15aee8);
  box-shadow: 0 10px 28px rgba(24, 189, 248, 0.2);
}

.primary-action:hover {
  background: linear-gradient(180deg, #8ae6ff, #23bdfa);
}

.ghost-button,
.account-button,
.close-button {
  border-color: rgba(98, 132, 164, 0.28);
  background: var(--control-bg-elevated);
}

.ghost-button:hover,
.account-button:hover,
.close-button:hover {
  border-color: rgba(24, 189, 248, 0.48);
  background: rgba(18, 36, 54, 0.96);
}

.page-head {
  margin: 12px 0 18px;
}

h1 {
  font-size: clamp(28px, 3vw, 40px);
  line-height: 1.02;
  font-weight: 860;
}

h2 {
  font-size: 16px;
  font-weight: 820;
}

h3 {
  color: #8fa8bd;
  font-size: 11px;
  font-weight: 850;
  letter-spacing: 0.06em;
}

.freshness {
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  background: rgba(9, 20, 32, 0.66);
}

.metrics-row {
  gap: 12px;
  margin-bottom: 14px;
}

.metric-tile {
  position: relative;
  min-height: 96px;
  padding: 16px 16px 14px 76px;
  border-color: rgba(98, 132, 164, 0.26);
  border-radius: 10px;
  background: linear-gradient(180deg, rgba(21, 38, 56, 0.88), rgba(9, 19, 31, 0.88)), var(--panel);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.04);
  transition: transform 140ms ease, border-color 140ms ease;
}

.metric-tile:hover {
  transform: translateY(-1px);
  border-color: rgba(24, 189, 248, 0.42);
}

.metric-tile::before {
  content: "S";
  position: absolute;
  left: 16px;
  top: 18px;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  color: #e9fbff;
  background: linear-gradient(180deg, #22bdf8, #077fbd);
  box-shadow: 0 12px 26px rgba(24, 189, 248, 0.22);
  font-size: 16px;
  font-weight: 900;
}

.metric-tile:nth-child(2)::before {
  content: "L";
  background: linear-gradient(180deg, #33e292, #07965b);
}

.metric-tile:nth-child(3)::before {
  content: "S";
  background: linear-gradient(180deg, #ff8297, #d83e59);
}

.metric-tile:nth-child(4)::before {
  content: "W";
  background: linear-gradient(180deg, #f8c868, #b7791f);
}

.metric-tile span {
  margin-bottom: 9px;
  color: #9bb1c4;
  font-size: 11px;
  font-weight: 850;
  text-transform: uppercase;
}

.metric-tile strong {
  font-size: 31px;
  font-weight: 860;
}

.metric-tile.is-active {
  border-color: rgba(24, 189, 248, 0.56);
  background: linear-gradient(135deg, rgba(24, 189, 248, 0.18), rgba(13, 28, 43, 0.92) 44%, rgba(7, 16, 27, 0.96));
}

.dashboard-grid {
  grid-template-columns: minmax(0, 1fr) minmax(280px, 340px);
}

.dashboard-grid,
.lower-grid,
.exchange-grid,
.billing-layout,
.simulation-detail-grid {
  gap: 14px;
}

.panel {
  border-color: rgba(98, 132, 164, 0.26);
  border-radius: 10px;
  background: var(--panel-bg);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.035);
}

.panel-title {
  min-height: 62px;
  padding: 15px 16px;
  border-bottom-color: var(--line-soft);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.026), transparent);
}

.data-table {
  min-width: 840px;
}

.data-table th,
.data-table td {
  padding: 12px 14px;
  border-bottom-color: rgba(116, 148, 177, 0.1);
  font-size: 12px;
}

.data-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  color: #89a1b5;
  background: rgba(8, 18, 29, 0.96);
  font-size: 10px;
  letter-spacing: 0.05em;
}

html[data-theme="light"] .data-table th {
  background: rgba(247, 251, 254, 0.96);
}

.data-table tbody tr:nth-child(2n) {
  background: rgba(255, 255, 255, 0.018);
}

.data-table tbody tr:hover {
  background: rgba(24, 189, 248, 0.075);
}

.badge {
  min-height: 25px;
  border-radius: 7px;
  font-size: 10px;
  letter-spacing: 0.03em;
}

.badge.long {
  color: #dfffee;
  background: linear-gradient(180deg, rgba(36, 214, 132, 0.32), rgba(7, 150, 91, 0.18));
  border: 1px solid rgba(36, 214, 132, 0.28);
}

.badge.short {
  color: #ffe5ea;
  background: linear-gradient(180deg, rgba(255, 95, 122, 0.28), rgba(216, 62, 89, 0.16));
  border: 1px solid rgba(255, 95, 122, 0.28);
}

.badge.wait {
  color: #ffe9ba;
  background: linear-gradient(180deg, rgba(243, 184, 78, 0.28), rgba(183, 121, 31, 0.14));
  border: 1px solid rgba(243, 184, 78, 0.26);
}

.watch-row,
.mini-row,
.sim-summary div,
.stats-pair span,
.performance-card,
.ledger-card,
.plan-card,
.position-card,
.custom-metric-item,
.empty-state,
.account-summary-grid > div,
.account-detail-row {
  border-color: rgba(116, 148, 177, 0.16);
  border-radius: 9px;
  background: rgba(7, 18, 30, 0.62);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.025);
}

.sparkline {
  height: 68px;
  border-radius: 9px;
  background:
    linear-gradient(180deg, rgba(36, 214, 132, 0.18), transparent 78%),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.035) 0 1px, transparent 1px 22px);
}

.accuracy-dial {
  width: 124px;
  height: 124px;
  margin: 16px auto;
  border: 0;
  background: radial-gradient(circle at center, var(--panel) 0 44%, transparent 45%), conic-gradient(var(--green) 0 72%, var(--red) 72% 88%, rgba(145, 167, 186, 0.28) 88% 100%);
}

.login-card,
.account-card {
  border-color: rgba(116, 148, 177, 0.28);
  border-radius: 12px;
  background: var(--modal-bg);
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.46), inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.account-card {
  max-width: 680px;
}

.mobile-tabs {
  border-radius: 12px;
  box-shadow: 0 18px 46px rgba(0, 0, 0, 0.34);
  backdrop-filter: blur(18px);
}

@media (max-width: 1080px) {
  .workspace {
    padding: 14px 14px 92px;
  }

  .topbar {
    margin: -14px -14px 16px;
    grid-template-columns: auto minmax(0, 1fr) auto auto auto auto;
  }

  .dashboard-grid,
  .lower-grid,
  .exchange-grid,
  .billing-layout,
  .simulation-detail-grid {
    grid-template-columns: 1fr;
  }
}

.terms-row input {
  flex: 0 0 16px;
  margin-top: 2px;
}

.terms-copy {
  flex: 1 1 auto;
  min-width: 0;
  overflow-wrap: anywhere;
  color: var(--muted);
  font-weight: 600;
  line-height: 1.5;
  text-transform: none;
}

/* TopBill console v4: dense, decision-first trading workspace. */
:root {
  --bg: #090c10;
  --bg-soft: #0d1117;
  --panel: #111820;
  --panel-2: #151d26;
  --line: #25303b;
  --line-soft: rgba(147, 164, 181, 0.14);
  --text: #edf2f7;
  --muted: #9aa8b5;
  --faint: #6f7d8a;
  --cyan: #37b7d8;
  --green: #20bf73;
  --red: #ef5b6c;
  --amber: #e6ad45;
  --blue: #5d8df6;
  --shadow: 0 10px 28px rgba(0, 0, 0, 0.2);
  --sidebar-bg: #0c1117;
  --topbar-bg: rgba(9, 13, 18, 0.94);
  --control-bg: #0a0f14;
  --control-bg-elevated: #121920;
  --panel-bg: #111820;
  --tile-bg: #0f151c;
  --modal-bg: #111820;
  --overlay-bg: rgba(0, 0, 0, 0.72);
  --radius: 6px;
  --radius-sm: 4px;
  --sidebar: 220px;
}

html[data-theme="light"] {
  --bg: #f2f5f7;
  --bg-soft: #e8edf1;
  --panel: #ffffff;
  --panel-2: #f7f9fb;
  --line: #d2dbe3;
  --line-soft: rgba(43, 61, 77, 0.12);
  --text: #14212d;
  --muted: #5f6f7d;
  --faint: #82909c;
  --cyan: #087e9e;
  --green: #087c4a;
  --red: #c93d51;
  --amber: #9a6713;
  --blue: #315fc4;
  --shadow: 0 8px 22px rgba(27, 41, 54, 0.08);
  --sidebar-bg: #ffffff;
  --topbar-bg: rgba(246, 248, 250, 0.95);
  --control-bg: #ffffff;
  --control-bg-elevated: #ffffff;
  --panel-bg: #ffffff;
  --tile-bg: #f8fafb;
  --modal-bg: #ffffff;
}

body,
html[data-theme="light"] body {
  background: var(--bg);
}

.sidebar,
html[data-theme="light"] .sidebar {
  padding: 16px 12px;
  background: var(--sidebar-bg);
  box-shadow: none;
}

.brand {
  min-height: 50px;
  padding: 2px 4px 14px;
}

.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 6px;
  background: #10242c;
  box-shadow: none;
}

.brand strong {
  font-size: 16px;
}

.nav-item,
.mobile-tabs button {
  min-height: 38px;
  border-radius: 5px;
}

.nav-item:hover,
.nav-item.is-active {
  background: rgba(55, 183, 216, 0.1);
}

.nav-item.is-active::before {
  top: 8px;
  bottom: 8px;
  box-shadow: none;
}

.sidebar-status {
  padding: 12px;
  border-radius: 6px;
  background: var(--tile-bg);
}

.workspace {
  padding: 14px 16px 82px;
}

.topbar {
  grid-template-columns: minmax(240px, 1fr) auto auto auto auto auto;
  gap: 8px;
  min-height: 58px;
  margin: -14px -16px 14px;
  padding: 8px 16px;
  background: var(--topbar-bg);
  box-shadow: none;
}

.symbol-search,
input,
select,
.segmented,
.mini-tabs {
  border-color: var(--line);
  background: var(--control-bg);
  box-shadow: none;
}

.symbol-search,
.segmented {
  height: 38px;
  border-radius: 6px;
}

input,
select,
.primary-action,
.ghost-button,
.account-button,
.close-button {
  border-radius: 5px;
}

.segmented button.is-active,
.mini-tabs button.is-active,
.primary-action {
  color: #041014;
  background: var(--cyan);
  box-shadow: none;
}

.ghost-button,
.account-button,
.close-button {
  background: var(--control-bg-elevated);
}

.ghost-button:hover,
.account-button:hover,
.close-button:hover {
  border-color: var(--cyan);
  background: var(--panel-2);
}

.page-head {
  margin: 8px 0 12px;
}

h1 {
  font-size: 24px;
  line-height: 1.2;
}

h2 {
  font-size: 15px;
}

h3 {
  letter-spacing: 0;
}

.freshness {
  min-height: 36px;
  border-radius: 5px;
  background: var(--tile-bg);
}

.system-notice {
  position: sticky;
  top: 66px;
  z-index: 18;
  min-height: 38px;
  margin: -4px 0 10px;
  padding: 8px 10px 8px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid rgba(55, 183, 216, 0.36);
  border-radius: 5px;
  background: #102027;
  color: #cdeef5;
  font-size: 12px;
}

.system-notice[hidden] {
  display: none;
}

.system-notice[data-tone="error"] {
  border-color: rgba(239, 91, 108, 0.42);
  background: #261217;
  color: #ffdbe0;
}

.system-notice[data-tone="success"] {
  border-color: rgba(32, 191, 115, 0.42);
  background: #10231a;
  color: #d5f8e6;
}

.system-notice button {
  width: 24px;
  height: 24px;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
}

.market-pulse,
.funding-kpis,
.strategy-strip,
.simulation-comparison {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  overflow: hidden;
}

.pulse-item,
.funding-kpis > div,
.strategy-strip > div,
.simulation-comparison > div {
  min-width: 0;
  padding: 11px 14px;
  border-left: 1px solid var(--line-soft);
}

.pulse-item:first-child,
.funding-kpis > div:first-child,
.strategy-strip > div:first-child,
.simulation-comparison > div:first-child {
  border-left: 0;
}

.pulse-item span,
.funding-kpis span,
.strategy-strip span,
.simulation-comparison span {
  display: block;
  color: var(--faint);
  font-size: 10px;
  font-weight: 750;
  text-transform: uppercase;
}

.pulse-item strong,
.funding-kpis strong,
.strategy-strip strong,
.simulation-comparison strong {
  display: block;
  margin-top: 3px;
  overflow: hidden;
  color: var(--text);
  font-size: 16px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pulse-item small {
  display: block;
  margin-top: 3px;
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.metrics-row {
  gap: 8px;
  margin-bottom: 10px;
}

.metric-tile {
  min-height: 68px;
  padding: 11px 14px;
  border-radius: 6px;
  background: var(--panel);
  box-shadow: none;
  transform: none;
}

.metric-tile::before {
  display: none;
}

.metric-tile:nth-child(2) {
  border-left: 3px solid var(--green);
}

.metric-tile:nth-child(3) {
  border-left: 3px solid var(--red);
}

.metric-tile:nth-child(4) {
  border-left: 3px solid var(--amber);
}

.metric-tile:hover {
  transform: none;
}

.metric-tile span {
  min-height: 0;
  margin-bottom: 2px;
  font-size: 10px;
}

.metric-tile strong {
  font-size: 24px;
}

.metric-tile.is-active {
  background: var(--panel-2);
}

.dashboard-grid {
  grid-template-columns: minmax(0, 1fr) minmax(248px, 300px);
}

.panel {
  border-radius: 6px;
  background: var(--panel);
  box-shadow: none;
}

.panel-title {
  min-height: 54px;
  padding: 11px 13px;
  background: transparent;
}

.signal-controls {
  display: grid;
  grid-template-columns: repeat(4, minmax(116px, 1fr)) auto;
  gap: 8px;
  padding: 9px 12px;
  border-bottom: 1px solid var(--line-soft);
  background: var(--bg-soft);
}

.signal-controls label {
  min-width: 0;
}

.signal-controls label span {
  display: block;
  margin-bottom: 4px;
  color: var(--faint);
  font-size: 9px;
  font-weight: 750;
  text-transform: uppercase;
}

.signal-controls select,
.funding-controls select {
  width: 100%;
  min-height: 32px;
  padding: 0 8px;
  font-size: 11px;
}

.compact-action {
  align-self: end;
  min-height: 32px;
  padding: 0 12px;
}

.data-table {
  min-width: 760px;
}

.data-table th,
.data-table td {
  padding: 9px 11px;
  font-size: 11px;
}

.data-table th,
html[data-theme="light"] .data-table th {
  background: var(--bg-soft);
  letter-spacing: 0;
}

.data-table tbody tr:nth-child(2n) {
  background: rgba(255, 255, 255, 0.012);
}

.signal-row.long {
  box-shadow: inset 2px 0 0 var(--green);
}

.signal-row.short {
  box-shadow: inset 2px 0 0 var(--red);
}

.signal-symbol-button {
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.signal-symbol-button strong,
.signal-symbol-button span,
.muted-cell {
  display: block;
}

.signal-symbol-button strong {
  color: var(--text);
  font-size: 12px;
}

.signal-symbol-button span,
.muted-cell {
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
  font-style: normal;
}

.confidence-line {
  position: relative;
  display: block;
  width: 74px;
  margin-top: 5px;
  padding-top: 5px;
  color: var(--muted);
  font-size: 10px;
}

.confidence-line::before,
.confidence-line i {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  height: 2px;
}

.confidence-line::before {
  width: 100%;
  background: var(--line);
}

.confidence-line i {
  width: var(--confidence);
  background: var(--cyan);
}

.alignment {
  display: block;
  font-size: 10px;
  white-space: nowrap;
}

.alignment.aligned {
  color: var(--green);
}

.alignment.conflict {
  color: var(--amber);
}

.empty-table {
  padding: 24px 12px;
  color: var(--muted);
  text-align: center;
}

.skeleton-row span {
  display: block;
  height: 28px;
  border-radius: 3px;
  background: var(--panel-2);
  animation: topbill-pulse 1.2s ease-in-out infinite;
}

@keyframes topbill-pulse {
  50% { opacity: 0.42; }
}

.watch-row,
.mini-row,
.sim-summary div,
.stats-pair span,
.performance-card,
.ledger-card,
.position-card,
.custom-metric-item,
.empty-state,
.account-summary-grid > div,
.account-detail-row {
  border-radius: 4px;
  background: transparent;
  box-shadow: none;
}

.funding-kpis {
  margin-bottom: 12px;
}

.funding-controls {
  display: grid;
  grid-template-columns: minmax(145px, 1fr) minmax(130px, 1fr);
  min-width: 300px;
}

.strategy-strip {
  margin: 10px 0;
}

.strategy-strip strong {
  font-size: 12px;
}

.simulation-comparison {
  position: relative;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  padding-bottom: 34px;
}

.simulation-comparison p {
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 8px;
  margin: 0;
  color: var(--muted);
  font-size: 10px;
}

.performance-recent-panel {
  margin-top: 12px;
}

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

.performance-card {
  min-height: 74px;
  align-content: center;
  padding: 10px 12px;
}

.performance-card span {
  margin: 0;
  padding: 0;
}

.performance-card strong {
  font-size: 20px;
}

.signal-detail-card {
  position: relative;
  width: min(760px, 100%);
  max-height: calc(100vh - 36px);
  overflow: auto;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--modal-bg);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.45);
}

.signal-detail-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding-right: 34px;
}

.signal-detail-head span:first-child {
  color: var(--muted);
  font-size: 11px;
}

.signal-detail-head h2 {
  margin: 4px 0 0;
  font-size: 22px;
}

.detail-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 16px 0;
  border-block: 1px solid var(--line);
}

.detail-summary > div {
  padding: 11px 12px;
  border-left: 1px solid var(--line-soft);
}

.detail-summary > div:first-child {
  border-left: 0;
}

.detail-summary span,
.detail-summary strong {
  display: block;
}

.detail-summary span {
  color: var(--muted);
  font-size: 10px;
  text-transform: uppercase;
}

.detail-summary strong {
  margin-top: 4px;
  font-size: 16px;
}

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

.signal-detail-grid section {
  min-width: 0;
  padding-top: 10px;
  border-top: 1px solid var(--line-soft);
}

.signal-detail-grid h3,
.detail-reasons h3 {
  margin: 0 0 8px;
  color: var(--muted);
}

.signal-detail-grid dl {
  margin: 0;
}

.signal-detail-grid dl div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 5px 0;
}

.signal-detail-grid dt {
  color: var(--muted);
}

.signal-detail-grid dd {
  margin: 0;
  text-align: right;
}

.detail-reasons {
  margin-top: 15px;
  padding-top: 11px;
  border-top: 1px solid var(--line-soft);
}

.detail-reasons p {
  margin: 5px 0;
  color: var(--text);
  font-size: 12px;
  line-height: 1.45;
}

.detail-reasons.muted p {
  color: var(--muted);
}

.login-card,
.account-card {
  border-radius: 7px;
  background: var(--modal-bg);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.44);
}

.mobile-tabs {
  border-radius: 7px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.28);
}

html[data-theme="light"] .watch-row,
html[data-theme="light"] .mini-row,
html[data-theme="light"] .performance-card,
html[data-theme="light"] .ledger-card,
html[data-theme="light"] .position-card,
html[data-theme="light"] .custom-metric-item,
html[data-theme="light"] .empty-state,
html[data-theme="light"] .account-summary-grid > div,
html[data-theme="light"] .account-detail-row {
  background: transparent;
}

@media (max-width: 1080px) {
  .workspace {
    padding: 12px 12px 82px;
  }

  .topbar {
    margin: -12px -12px 12px;
    grid-template-columns: minmax(0, 1fr) auto auto auto auto;
  }

  .dashboard-grid,
  .lower-grid,
  .exchange-grid,
  .billing-layout,
  .simulation-detail-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .market-pulse,
  .funding-kpis,
  .strategy-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .pulse-item:nth-child(3),
  .funding-kpis > div:nth-child(3),
  .strategy-strip > div:nth-child(3) {
    border-left: 0;
    border-top: 1px solid var(--line-soft);
  }

  .pulse-item:nth-child(4),
  .funding-kpis > div:nth-child(4),
  .strategy-strip > div:nth-child(4) {
    border-top: 1px solid var(--line-soft);
  }

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

  .signal-controls .compact-action {
    grid-column: 1 / -1;
  }

  .funding-controls {
    min-width: 0;
    width: 100%;
  }

  .performance-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
    padding: 8px;
  }
}

@media (max-width: 680px) {
  .workspace {
    padding: 10px 8px 82px;
  }

  .topbar {
    grid-template-columns: minmax(0, 1fr) auto minmax(86px, 108px);
    margin: -10px -8px 10px;
    padding: 8px;
  }

  .system-notice {
    top: 104px;
  }

  .page-head {
    gap: 8px;
  }

  h1 {
    font-size: 22px;
  }

  .page-head p {
    font-size: 11px;
  }

  .market-pulse {
    margin-bottom: 8px;
  }

  .pulse-item,
  .funding-kpis > div,
  .strategy-strip > div,
  .simulation-comparison > div {
    padding: 9px 10px;
  }

  .pulse-item strong,
  .funding-kpis strong,
  .simulation-comparison strong {
    font-size: 14px;
  }

  .metrics-row {
    gap: 6px;
  }

  .metric-tile {
    min-height: 58px;
    padding: 8px 10px;
  }

  .metric-tile strong {
    font-size: 20px;
  }

  .panel-title {
    gap: 8px;
  }

  .signal-controls {
    padding: 8px;
    gap: 6px;
  }

  .signal-table {
    min-width: 0;
    table-layout: fixed;
  }

  .signal-table th:nth-child(n + 4),
  .signal-table td:nth-child(n + 4) {
    display: none;
  }

  .signal-table th:nth-child(1),
  .signal-table td:nth-child(1) {
    display: table-cell;
    width: 38%;
  }

  .signal-table th:nth-child(2),
  .signal-table td:nth-child(2) {
    display: table-cell;
    width: 28%;
  }

  .signal-table th:nth-child(3),
  .signal-table td:nth-child(3) {
    display: table-cell;
    width: 34%;
  }

  .signal-table th,
  .signal-table td {
    padding: 8px 7px;
  }

  .confidence-line {
    width: 58px;
  }

  .simulation-comparison {
    grid-template-columns: 1fr;
    padding-bottom: 50px;
  }

  .simulation-comparison > div {
    border-left: 0;
    border-top: 1px solid var(--line-soft);
  }

  .simulation-comparison > div:first-child {
    border-top: 0;
  }

  .signal-detail-card {
    max-height: calc(100vh - 16px);
    padding: 15px 12px;
    border-radius: 6px;
  }

  .detail-summary,
  .signal-detail-grid {
    grid-template-columns: 1fr;
  }

  .detail-summary > div {
    border-left: 0;
    border-top: 1px solid var(--line-soft);
  }

  .detail-summary > div:first-child {
    border-top: 0;
  }

  .performance-recent-table {
    min-width: 620px;
  }
}

@media (max-width: 680px) {
  body {
    background-size: 34px 34px, 34px 34px, auto, auto;
  }

  .workspace {
    padding: 12px 10px 92px;
  }

  .topbar {
    grid-template-columns: minmax(0, 1fr) auto minmax(92px, 112px);
    gap: 8px;
    padding: 10px;
    margin: -12px -10px 14px;
  }

  .theme-toggle {
    display: none;
  }

  .account-button {
    width: 100%;
    min-width: 0;
    max-width: 118px;
    padding: 0 8px;
    font-size: 0;
  }

  .account-button::after {
    content: "Account";
    font-size: 12px;
  }

  .account-button.is-login-cta::after {
    content: "Login";
  }

  #refreshSignals {
    min-width: 0;
    padding: 0 13px;
  }

  h1 {
    font-size: 27px;
  }

  .freshness {
    justify-content: space-between;
    width: 100%;
  }

  .metrics-row {
    gap: 9px;
  }

  .metric-tile {
    min-height: 84px;
    padding: 12px 10px 11px 54px;
  }

  .metric-tile::before {
    left: 10px;
    top: 14px;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    font-size: 13px;
  }

  .metric-tile span {
    min-height: 24px;
    margin-bottom: 6px;
    font-size: 10px;
  }

  .metric-tile strong {
    font-size: 24px;
  }
}

/* Keep the v4 mobile workspace authoritative after legacy responsive rules. */
@media (max-width: 680px) {
  body {
    background: var(--bg);
  }

  .workspace {
    padding: 10px 8px 82px;
  }

  .topbar {
    grid-template-columns: minmax(0, 1fr) auto minmax(86px, 108px);
    gap: 6px;
    margin: -10px -8px 10px;
    padding: 8px;
  }

  h1 {
    font-size: 22px;
  }

  .freshness {
    width: auto;
  }

  .metrics-row {
    gap: 6px;
  }

  .metric-tile {
    min-height: 58px;
    padding: 8px 10px;
  }

  .metric-tile::before {
    display: none;
  }

  .metric-tile span {
    min-height: 0;
    margin-bottom: 3px;
    font-size: 10px;
  }

  .metric-tile strong {
    font-size: 20px;
  }
}

/* TopBill console v6: responsive interactions without layout shifts. */
button,
select,
input,
.nav-item,
.metric-tile,
.signal-symbol-button {
  touch-action: manipulation;
}

button:disabled {
  cursor: wait;
}

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

button.is-busy::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 14px;
  height: 14px;
  margin: -8px 0 0 -8px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  color: var(--text);
  animation: topbill-spin 620ms linear infinite;
}

.primary-action.is-busy::after {
  color: #041014;
}

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

.view.is-active.is-entering {
  animation: topbill-view-in 120ms ease-out both;
}

@keyframes topbill-view-in {
  from { opacity: 0.82; transform: translateY(2px); }
  to { opacity: 1; transform: translateY(0); }
}

.data-table tbody tr {
  transition: background-color 90ms ease, border-color 90ms ease;
}

@media (prefers-reduced-motion: reduce) {
  .view.is-active.is-entering,
  button.is-busy::after,
  .skeleton-row span {
    animation: none;
  }
}

/* v7 billing and commercial readiness */
.billing-layout {
  align-items: start;
}

.billing-trust-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
}

.billing-trust-row span::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 7px;
  border-radius: 50%;
  background: var(--green);
  vertical-align: 1px;
}

.payment-amount-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 48px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--cyan);
  background: var(--panel-2);
}

.payment-amount-row span,
.payment-address-box > span {
  color: var(--muted);
  font-size: 12px;
}

.payment-amount-row strong {
  font-size: 18px;
  font-variant-numeric: tabular-nums;
}

.payment-address-box {
  display: grid;
  gap: 7px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  background: var(--panel-2);
}

.payment-address-box > div {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.payment-address-box code {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  color: var(--text);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.compact-button {
  width: auto;
  min-width: 58px;
  min-height: 32px;
  padding: 6px 10px;
  font-size: 12px;
}

.admin-payment-panel {
  margin-top: 12px;
}

.admin-payment-config {
  margin-top: 12px;
}

.payment-config-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0;
  margin-top: 16px;
  border-block: 1px solid var(--line);
}

.payment-config-group {
  display: grid;
  gap: 12px;
  padding: 16px 18px 18px 0;
}

.payment-config-group + .payment-config-group {
  padding-right: 0;
  padding-left: 18px;
  border-left: 1px solid var(--line);
}

.payment-config-group h3 {
  margin: 0;
  font-size: 14px;
}

.payment-config-actions {
  align-items: center;
  margin-top: 16px;
}

.payment-config-actions .primary-action {
  width: auto;
  min-width: 190px;
}

.payment-config-actions .form-message {
  margin: 0;
}

.admin-payment-panel .table-shell {
  max-height: 360px;
}

.txid-cell {
  color: var(--cyan);
  font-size: 12px;
}

.payment-review-actions {
  display: flex;
  gap: 6px;
}

.billing-legal-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px 20px;
  padding: 20px 12px 8px;
  color: var(--muted);
  font-size: 12px;
}

.billing-legal-links a,
.terms-row a {
  color: var(--cyan);
  text-decoration: none;
}

.billing-legal-links a:hover,
.terms-row a:hover {
  text-decoration: underline;
}

@media (max-width: 720px) {
  .account-button {
    font-size: 12px;
  }

  .account-button::after,
  .account-button.is-login-cta::after {
    display: none;
    content: none;
  }

  .payment-address-box > div {
    align-items: stretch;
    flex-direction: column;
  }

  .payment-address-box code {
    overflow-wrap: anywhere;
    white-space: normal;
  }

  .payment-address-box .compact-button {
    width: 100%;
  }

  .admin-payment-panel {
    margin-inline: 0;
  }

  .payment-config-grid {
    grid-template-columns: 1fr;
  }

  .payment-config-group,
  .payment-config-group + .payment-config-group {
    padding: 14px 0;
    border-left: 0;
  }

  .payment-config-group + .payment-config-group {
    border-top: 1px solid var(--line);
  }

  .payment-config-actions,
  .payment-config-actions .primary-action {
    width: 100%;
  }
}

/* v13 focused membership checkout */
.membership-page-head {
  align-items: end;
}

.membership-status {
  max-width: min(100%, 360px);
  padding: 8px 11px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-2);
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.membership-checkout {
  margin-top: 12px;
  border-radius: 8px;
}

.beta-access-panel {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(250px, 0.9fr) minmax(220px, 0.7fr);
  gap: 28px;
  align-items: center;
  margin-top: 12px;
  padding: 28px;
  border-color: color-mix(in srgb, var(--accent) 42%, var(--line));
}

.beta-access-copy h2 {
  margin: 8px 0 10px;
  font-size: 22px;
  line-height: 1.25;
}

.beta-access-copy p,
.beta-access-action small {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.beta-status-label {
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0;
}

.beta-access-points {
  display: grid;
  gap: 10px;
}

.beta-access-points span {
  position: relative;
  padding-left: 18px;
  color: var(--text);
  font-size: 13px;
  line-height: 1.4;
}

.beta-access-points span::before {
  position: absolute;
  top: 7px;
  left: 0;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--positive);
  content: "";
}

.beta-access-action {
  display: grid;
  gap: 9px;
  justify-items: stretch;
}

.beta-access-action strong {
  font-size: 18px;
}

.beta-access-action .primary-action {
  width: 100%;
  margin-top: 4px;
}

@media (max-width: 980px) {
  .beta-access-panel {
    grid-template-columns: 1fr 1fr;
  }

  .beta-access-action {
    grid-column: 1 / -1;
  }
}

@media (max-width: 640px) {
  .beta-access-panel {
    grid-template-columns: 1fr;
    gap: 20px;
    padding: 20px;
  }

  .beta-access-action {
    grid-column: auto;
  }
}

.checkout-progress {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  min-height: 54px;
  border-bottom: 1px solid var(--line);
  background: var(--panel-2);
}

.checkout-step {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
}

.checkout-step + .checkout-step::before {
  position: absolute;
  top: 14px;
  bottom: 14px;
  left: 0;
  width: 1px;
  background: var(--line);
  content: "";
}

.checkout-step span {
  display: inline-grid;
  width: 23px;
  height: 23px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--control-bg);
  font-size: 11px;
}

.checkout-step.is-active {
  color: var(--text);
}

.checkout-step.is-active span {
  border-color: var(--cyan);
  color: var(--cyan);
}

.checkout-step.is-complete span {
  border-color: var(--green);
  background: rgba(45, 207, 142, 0.1);
  color: var(--green);
}

.membership-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(330px, 0.75fr);
}

.membership-options,
.checkout-summary {
  min-width: 0;
  padding: 20px;
}

.checkout-summary {
  border-left: 1px solid var(--line);
  background: var(--panel-2);
}

.section-heading,
.checkout-summary-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.section-heading > div,
.checkout-summary-head > div {
  display: flex;
  align-items: center;
  gap: 9px;
}

.section-heading h2,
.checkout-summary-head h2 {
  margin: 0;
  font-size: 15px;
}

.section-heading > span,
.checkout-account-state {
  color: var(--muted);
  font-size: 11px;
  text-align: right;
}

.section-index {
  color: var(--cyan);
  font-size: 10px;
  font-weight: 800;
}

.membership-options .plan-list {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  padding: 0;
  margin-top: 13px;
}

.membership-options .plan-card {
  display: grid;
  grid-template-rows: auto auto auto 1fr;
  gap: 9px;
  min-height: 154px;
  padding: 13px;
  text-align: left;
  border-color: var(--line);
  border-radius: 6px;
  background: var(--control-bg);
}

.membership-options .plan-card:hover {
  border-color: var(--muted);
}

.membership-options .plan-card.is-selected {
  border-color: var(--cyan);
  background: rgba(67, 200, 242, 0.07);
}

.plan-card-head {
  display: flex !important;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 0 !important;
}

.plan-card-head strong {
  color: var(--text);
  font-size: 13px;
}

.plan-card-head em {
  padding: 3px 5px;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--muted);
  font-size: 9px;
  font-style: normal;
  white-space: nowrap;
}

.plan-card.is-selected .plan-card-head em {
  border-color: rgba(67, 200, 242, 0.45);
  color: var(--cyan);
}

.plan-price {
  margin: 0 !important;
  color: var(--text) !important;
  font-size: 23px !important;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.plan-price small {
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
}

.plan-term,
.plan-features {
  margin: 0 !important;
  color: var(--muted) !important;
  font-size: 10px !important;
  line-height: 1.35;
}

.plan-features {
  align-self: end;
  padding-top: 8px;
  border-top: 1px solid var(--line-soft);
}

.payment-method-heading {
  margin-top: 24px;
}

.payment-method-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 13px;
}

.payment-method-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 58px;
  padding: 9px 10px;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--control-bg);
  color: var(--text);
}

.payment-method-option span {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.payment-method-option small,
.payment-method-option em {
  color: var(--muted);
  font-size: 9px;
  font-style: normal;
}

.payment-method-option.is-selected {
  border-color: var(--green);
  background: rgba(45, 207, 142, 0.07);
}

.payment-method-option.is-selected em {
  color: var(--green);
}

.payment-method-empty,
.checkout-unavailable {
  padding: 14px;
  border: 1px dashed var(--line);
  border-radius: 6px;
  color: var(--muted);
  font-size: 11px;
}

.checkout-unavailable {
  margin-top: 16px;
}

.checkout-unavailable strong {
  color: var(--text);
  font-size: 13px;
}

.checkout-unavailable p {
  margin: 7px 0 0;
}

.checkout-account-state {
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.checkout-account-state.is-signed-in {
  color: var(--green);
}

#paymentReadyPanel {
  display: grid;
  gap: 11px;
  margin-top: 16px;
}

#paymentReadyPanel[hidden] {
  display: none;
}

.order-summary-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 11px;
}

.order-summary-row strong {
  max-width: 70%;
  color: var(--text);
  font-size: 11px;
  text-align: right;
}

.checkout-summary label {
  display: grid;
  gap: 7px;
  margin: 0;
  color: var(--muted);
  font-size: 11px;
}

.payment-guidance {
  margin: 0;
  padding: 9px 10px;
  border-left: 2px solid var(--amber);
  color: var(--muted);
  font-size: 10px;
  line-height: 1.45;
}

.checkout-summary .primary-action {
  width: 100%;
}

.checkout-summary .payment-qr,
.admin-billing-console > .panel {
  border-radius: 8px;
}

.admin-billing-console {
  margin-top: 12px;
}

.admin-billing-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.admin-billing-header > div:first-child {
  display: grid;
  gap: 2px;
}

.admin-billing-header > div:first-child span {
  color: var(--cyan);
  font-size: 9px;
  font-weight: 800;
}

.admin-billing-header > div:first-child strong {
  font-size: 13px;
}

.admin-billing-tabs {
  display: inline-flex;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-2);
}

.admin-billing-tabs button {
  min-height: 31px;
  padding: 0 10px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 10px;
}

.admin-billing-tabs button.is-active {
  background: var(--control-bg-elevated);
  color: var(--text);
}

.admin-billing-console > .panel {
  margin-top: 0;
}

@media (max-width: 960px) {
  .membership-workspace {
    grid-template-columns: 1fr;
  }

  .checkout-summary {
    border-top: 1px solid var(--line);
    border-left: 0;
  }
}

@media (max-width: 720px) {
  .membership-page-head {
    align-items: stretch;
  }

  .membership-status {
    width: 100%;
  }

  .checkout-progress {
    min-height: 48px;
  }

  .checkout-step {
    gap: 5px;
    font-size: 10px;
  }

  .checkout-step span {
    width: 20px;
    height: 20px;
    font-size: 9px;
  }

  .membership-options,
  .checkout-summary {
    padding: 14px;
  }

  .section-heading,
  .checkout-summary-head {
    align-items: flex-start;
  }

  .section-heading > span {
    max-width: 42%;
  }

  .membership-options .plan-list {
    grid-template-columns: 1fr;
  }

  .membership-options .plan-card {
    grid-template-columns: 1fr auto;
    grid-template-rows: auto auto auto;
    min-height: 0;
  }

  .plan-card-head,
  .plan-features {
    grid-column: 1 / -1;
  }

  .plan-price {
    align-self: center;
  }

  .plan-term {
    align-self: center;
    text-align: right;
  }

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

  .admin-billing-header {
    align-items: stretch;
    flex-direction: column;
  }

  .admin-billing-tabs,
  .admin-billing-tabs button {
    width: 100%;
  }

  .admin-billing-tabs button {
    flex: 1;
  }
}

/* Funding Edge workbench */
.funding-page-head {
  align-items: end;
}

.page-kicker {
  margin-bottom: 5px;
  color: var(--green);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0;
}

.funding-primary-controls {
  display: grid;
  grid-template-columns: repeat(4, minmax(112px, 1fr)) auto;
  align-items: end;
  width: min(100%, 810px);
}

.funding-primary-controls label {
  min-width: 0;
}

.funding-primary-controls select {
  width: 100%;
  min-height: 34px;
}

.funding-kpis-5 {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.funding-kpis-5 > div:nth-child(5) {
  border-left: 1px solid var(--line-soft);
}

.funding-kpis-5 strong {
  font-variant-numeric: tabular-nums;
  white-space: normal;
}

.funding-model-strip {
  display: flex;
  align-items: center;
  gap: 10px 22px;
  min-height: 42px;
  margin: -2px 0 12px;
  padding: 7px 11px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--muted);
  font-size: 11px;
}

.funding-model-strip > span:first-child {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--text);
}

.funding-model-strip .status-dot.live {
  background: var(--green);
  box-shadow: 0 0 0 3px rgba(62, 212, 135, 0.12);
}

.funding-model-strip .ghost-button {
  min-height: 28px;
  margin-left: auto;
  padding: 4px 10px;
}

.funding-health-notice {
  margin: -4px 0 12px;
  padding: 9px 11px;
  border: 1px solid rgba(214, 158, 46, 0.4);
  background: rgba(214, 158, 46, 0.08);
  color: var(--text);
  font-size: 12px;
  line-height: 1.45;
}

.funding-health-notice.is-live {
  border-color: rgba(62, 212, 135, 0.28);
  background: rgba(62, 212, 135, 0.06);
}

.funding-health-notice.is-stale {
  border-color: rgba(239, 91, 91, 0.45);
  background: rgba(239, 91, 91, 0.08);
  color: var(--red);
}

#view-funding .data-table {
  min-width: 1120px;
}

#view-funding .data-table td {
  height: 54px;
  font-variant-numeric: tabular-nums;
}

.funding-row.ready td:first-child {
  box-shadow: inset 3px 0 0 var(--green);
}

.funding-row.watch td:first-child {
  box-shadow: inset 3px 0 0 var(--amber);
}

.funding-row {
  cursor: pointer;
}

.funding-row:focus-visible td,
.funding-row:hover td {
  background: rgba(67, 200, 242, 0.045);
}

.funding-score {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 48px;
  min-height: 25px;
  padding: 3px 7px;
  border: 1px solid var(--line);
  border-radius: 4px;
  font-size: 11px;
  font-weight: 850;
}

.funding-score.grade-a {
  border-color: rgba(62, 212, 135, 0.38);
  background: rgba(62, 212, 135, 0.1);
  color: var(--green);
}

.funding-score.grade-b {
  border-color: rgba(67, 200, 242, 0.38);
  background: rgba(67, 200, 242, 0.08);
  color: var(--cyan);
}

.funding-score.grade-c {
  border-color: rgba(245, 185, 66, 0.38);
  color: var(--amber);
}

.status-ready {
  color: var(--green);
}

.status-watch {
  color: var(--amber);
}

.status-below {
  color: var(--faint);
}

.funding-mobile-list {
  display: none;
}

.funding-risk-note {
  margin-top: 9px;
  color: var(--faint);
  font-size: 10px;
  line-height: 1.5;
}

.funding-detail-card {
  position: relative;
  width: min(780px, 100%);
  max-height: calc(100vh - 36px);
  overflow: auto;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--modal-bg);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.45);
}

.funding-detail-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding-right: 38px;
}

.funding-detail-head > div > span {
  color: var(--muted);
  font-size: 11px;
}

.funding-detail-head h2 {
  margin: 4px 0 0;
  font-size: 21px;
}

.funding-detail-summary,
.funding-leg-grid,
.funding-execution-grid {
  display: grid;
  border-block: 1px solid var(--line);
}

.funding-detail-summary {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-top: 16px;
}

.funding-leg-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border-top: 0;
}

.funding-execution-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-top: 0;
}

.funding-detail-summary > div,
.funding-leg-grid > div,
.funding-execution-grid > div {
  min-width: 0;
  padding: 11px 12px;
  border-left: 1px solid var(--line-soft);
}

.funding-detail-summary > div:first-child,
.funding-leg-grid > div:first-child,
.funding-execution-grid > div:nth-child(3n + 1) {
  border-left: 0;
}

.funding-detail-summary span,
.funding-leg-grid span,
.funding-execution-grid span,
.funding-detail-summary strong,
.funding-leg-grid strong,
.funding-execution-grid strong,
.funding-leg-grid small {
  display: block;
}

.funding-detail-summary span,
.funding-leg-grid span,
.funding-execution-grid span {
  color: var(--muted);
  font-size: 10px;
}

.funding-detail-summary strong,
.funding-leg-grid strong,
.funding-execution-grid strong {
  margin-top: 5px;
  overflow-wrap: anywhere;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}

.funding-leg-grid strong {
  font-size: 19px;
}

.funding-leg-grid small {
  margin-top: 5px;
  color: var(--muted);
  line-height: 1.55;
}

.funding-risk-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 13px;
}

.funding-risk-chip {
  padding: 4px 7px;
  border: 1px solid rgba(255, 95, 122, 0.34);
  border-radius: 4px;
  color: var(--red);
  font-size: 10px;
}

.funding-risk-chip.is-clear {
  border-color: rgba(62, 212, 135, 0.34);
  color: var(--green);
}

@media (max-width: 980px) {
  .funding-page-head {
    align-items: stretch;
    flex-direction: column;
  }

  .funding-primary-controls {
    width: 100%;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .funding-kpis-5 > div:nth-child(4) {
    border-left: 0;
    border-top: 1px solid var(--line-soft);
  }

  .funding-kpis-5 > div:nth-child(5) {
    border-top: 1px solid var(--line-soft);
  }
}

@media (max-width: 620px) {
  .funding-primary-controls {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .funding-primary-controls .primary-action {
    width: 100%;
  }

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

  .funding-kpis-5 > div:nth-child(3),
  .funding-kpis-5 > div:nth-child(5) {
    border-left: 0;
    border-top: 1px solid var(--line-soft);
  }

  .funding-kpis-5 > div:nth-child(4) {
    border-left: 1px solid var(--line-soft);
  }

  .funding-kpis-5 > div:nth-child(5) {
    grid-column: 1 / -1;
  }

  .funding-model-strip {
    align-items: flex-start;
    flex-direction: column;
    gap: 6px;
  }

  .funding-model-strip .ghost-button {
    width: 100%;
    margin-left: 0;
  }

  #view-funding .table-wrap {
    display: none;
  }

  .funding-mobile-list {
    display: grid;
    gap: 1px;
  }

  .funding-mobile-card {
    display: grid;
    gap: 9px;
    width: 100%;
    min-height: 138px;
    padding: 12px;
    border: 0;
    border-left: 3px solid transparent;
    border-bottom: 1px solid var(--line-soft);
    border-radius: 0;
    background: transparent;
    color: var(--text);
    text-align: left;
  }

  .funding-mobile-card.ready {
    border-left-color: var(--green);
  }

  .funding-mobile-card.watch {
    border-left-color: var(--amber);
  }

  .funding-mobile-card:active {
    background: rgba(67, 200, 242, 0.07);
  }

  .funding-mobile-head,
  .funding-mobile-route,
  .funding-mobile-metrics {
    display: flex;
    align-items: center;
  }

  .funding-mobile-head {
    justify-content: space-between;
  }

  .funding-mobile-head > strong {
    font-size: 17px;
  }

  .funding-mobile-route {
    gap: 8px;
    color: var(--muted);
    font-size: 11px;
  }

  .funding-mobile-route b:first-child {
    color: var(--red);
  }

  .funding-mobile-route b:last-child {
    color: var(--green);
  }

  .funding-mobile-route i {
    color: var(--faint);
    font-style: normal;
  }

  .funding-mobile-metrics {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
  }

  .funding-mobile-metrics span,
  .funding-mobile-metrics strong {
    display: block;
  }

  .funding-mobile-metrics span {
    color: var(--muted);
    font-size: 9px;
  }

  .funding-mobile-metrics strong {
    margin-top: 3px;
    color: var(--text);
    font-size: 12px;
  }

  .funding-mobile-card small {
    overflow: hidden;
    color: var(--faint);
    font-size: 10px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .funding-detail-card {
    max-height: calc(100vh - 20px);
    padding: 15px;
  }

  .funding-detail-summary,
  .funding-execution-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .funding-detail-summary > div:nth-child(3),
  .funding-execution-grid > div:nth-child(odd) {
    border-left: 0;
  }
}

/* TopBill console v18: contextual controls and compact funding workflow. */
.topbar {
  grid-template-columns: minmax(0, 1fr) auto auto auto;
}

.market-tools {
  display: grid;
  grid-column: 1;
  grid-template-columns: minmax(220px, 1fr) auto auto;
  gap: 8px;
  min-width: 0;
}

.topbar > #languageSelect {
  grid-column: 2;
}

.topbar > #themeToggle {
  grid-column: 3;
}

.topbar > #accountButton {
  grid-column: 4;
}

body:not([data-view="signals"]) .market-tools {
  display: none;
}

.funding-page-head {
  align-items: stretch;
  flex-direction: column;
}

.funding-primary-controls {
  grid-template-columns: repeat(3, minmax(112px, 1fr)) auto;
  width: 100%;
}

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

.funding-kpis-4 strong {
  font-variant-numeric: tabular-nums;
  white-space: normal;
}

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

#view-funding .data-table {
  min-width: 940px;
}

.funding-row.confirming td:first-child,
.funding-mobile-card.confirming {
  border-left-color: var(--cyan);
  box-shadow: inset 3px 0 0 var(--cyan);
}

.status-confirming {
  color: var(--cyan);
}

@media (max-width: 1080px) {
  .topbar {
    grid-template-columns: auto minmax(0, 1fr) auto auto auto;
  }

  .mobile-menu {
    grid-column: 1;
  }

  .market-tools {
    grid-column: 2;
  }

  .topbar > #languageSelect {
    grid-column: 3;
  }

  .topbar > #themeToggle {
    grid-column: 4;
  }

  .topbar > #accountButton {
    grid-column: 5;
  }
}

@media (max-width: 760px) {
  .funding-kpis-4,
  .strategy-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 680px) {
  .topbar {
    grid-template-columns: minmax(0, 1fr) auto minmax(86px, 108px);
  }

  .mobile-menu {
    display: none;
  }

  .market-tools {
    grid-column: 1 / -1;
    grid-row: 2;
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .market-tools .symbol-search {
    grid-column: 1 / -1;
  }

  .topbar > #languageSelect {
    grid-column: 1;
    grid-row: 1;
    justify-self: start;
  }

  .topbar > #themeToggle {
    grid-column: 2;
    grid-row: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .topbar > #accountButton {
    grid-column: 3;
    grid-row: 1;
  }

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

  .funding-primary-controls .primary-action {
    grid-column: 1 / -1;
  }

  .funding-model-strip {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
  }

  .funding-model-strip .ghost-button {
    grid-column: 1 / -1;
  }

  .mobile-tabs button {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}

.beta-feedback {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin: 0 0 14px;
  padding: 13px 15px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.beta-feedback div {
  min-width: 0;
}

.beta-feedback strong,
.beta-feedback span {
  display: block;
}

.beta-feedback strong {
  color: var(--text);
  font-size: 13px;
}

.beta-feedback span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.beta-feedback .ghost-button {
  flex: 0 0 auto;
  min-height: 34px;
  text-decoration: none;
}

@media (max-width: 620px) {
  .beta-feedback {
    align-items: stretch;
    flex-direction: column;
    gap: 10px;
  }

  .beta-feedback .ghost-button {
    display: flex;
    justify-content: center;
    width: 100%;
  }
}
