:root {
  color-scheme: dark;
  --topbar-height: 58px;
  --bottom-nav-height: 61px;
  --bg: #080b0f;
  --panel: #11161d;
  --panel-2: #171d26;
  --panel-3: #0d131b;
  --line: #252b35;
  --line-soft: #1b222d;
  --text: #eef3f8;
  --muted: #8c96a3;
  --green: #2bd576;
  --green-soft: #10251a;
  --red: #ff5a5f;
  --red-soft: #2a1418;
  --amber: #e6ad42;
  --amber-soft: #28200f;
  --blue: #7fa7ff;
  --blue-soft: #101b31;
  --teal: #43c6d6;
  --teal-soft: #0f2529;
  --shadow: 0 14px 36px rgba(0, 0, 0, 0.28);
  --radius: 8px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  letter-spacing: 0;
}

button,
input,
select {
  font: inherit;
}

button {
  border: 0;
}

.app-shell {
  min-height: 100vh;
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto 1fr auto;
  overflow-x: hidden;
}

.app-shell > * {
  min-width: 0;
}

.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 58px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  background: rgba(8, 11, 15, 0.96);
  backdrop-filter: blur(18px);
}

.top-left,
.top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.top-left {
  flex: 1 1 auto;
  overflow: hidden;
}

.top-actions {
  flex: 0 1 auto;
  justify-content: flex-end;
}

.top-actions .chip {
  flex: 1 1 auto;
  min-width: 0;
  max-width: 68px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.brand {
  flex: 1 1 auto;
  display: grid;
  gap: 2px;
  min-width: 0;
}

.brand strong {
  font-size: 15px;
  line-height: 1.1;
}

.brand span,
.mini {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.3;
}

.brand strong,
.brand span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.icon-button,
.back-button {
  min-width: 34px;
  height: 34px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  display: grid;
  place-items: center;
  cursor: pointer;
}

.back-button {
  padding: 0 10px;
  font-size: 12px;
  font-weight: 800;
}

.content {
  width: min(1180px, 100%);
  max-width: 100%;
  min-width: 0;
  margin: 0 auto;
  padding: calc(var(--topbar-height) + 14px) 14px calc(122px + env(safe-area-inset-bottom));
}

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

.span-12 { grid-column: span 12; }
.span-8 { grid-column: span 8; }
.span-6 { grid-column: span 6; }
.span-4 { grid-column: span 4; }
.span-wide { grid-column: 1 / -1; }

.panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.panel.pad {
  padding: 12px;
}

.surface {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}

.section-title,
.row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}

.section-title {
  margin-bottom: 10px;
}

.section-title h2 {
  margin: 0;
  font-size: 16px;
  line-height: 1.15;
}

.section-title p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.row {
  min-height: 38px;
  align-items: center;
}

.row + .row,
.stack > * + * {
  margin-top: 8px;
}

.row.tight {
  min-height: 28px;
}

.row-title,
.metric {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.row-title strong,
.metric strong {
  font-size: 13px;
  font-weight: 730;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.row-title span,
.metric span {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.25;
}

.value {
  text-align: right;
  font-size: 13px;
  line-height: 1.15;
  font-weight: 760;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

.value small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 520;
}

.hero-stat {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  padding: 12px;
}

.hero-stat .number {
  font-size: clamp(34px, 8vw, 48px);
  line-height: 0.95;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

.hero-stat .caption {
  margin-top: 5px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.3;
}

.status-strip,
.mini-grid,
.metric-grid {
  display: grid;
  gap: 8px;
}

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

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

.status-pill,
.mini-stat,
.metric {
  min-width: 0;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: var(--panel-2);
  padding: 9px;
  display: grid;
  align-content: center;
  gap: 3px;
}

.status-pill span,
.mini-stat span,
.metric span {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.15;
}

.status-pill strong,
.mini-stat strong,
.metric strong {
  font-size: 13px;
  line-height: 1.15;
  font-weight: 760;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

.chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  border-radius: 999px;
  border: 1px solid var(--line);
  padding: 0 8px;
  color: var(--muted);
  background: var(--panel-3);
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.chip.green { color: var(--green); border-color: #214d34; background: var(--green-soft); }
.chip.amber { color: var(--amber); border-color: #5a4519; background: var(--amber-soft); }
.chip.red { color: var(--red); border-color: #53252a; background: var(--red-soft); }
.chip.blue { color: var(--blue); border-color: #263c68; background: var(--blue-soft); }
.chip.teal { color: var(--teal); border-color: #24515a; background: var(--teal-soft); }

.positive { color: var(--green); }
.negative { color: var(--red); }
.pending { color: var(--amber); }
.right { text-align: right; }

.tabs,
.seg {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  min-height: 36px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-2);
  gap: 3px;
}

.tab,
.seg span {
  min-width: 0;
  min-height: 30px;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  font-weight: 760;
  display: grid;
  place-items: center;
  cursor: pointer;
}

.tab.active,
.seg span.active {
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--line);
}

.toolbar,
.button-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.button-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.button {
  min-height: 42px;
  border-radius: var(--radius);
  padding: 0 13px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  font-weight: 760;
  cursor: pointer;
}

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

.button.compact {
  min-height: 30px;
  padding: 0 9px;
  font-size: 11px;
}

.data-row .button {
  min-height: 32px;
  padding: 0 10px;
  font-size: 11px;
}

.button.primary {
  border-color: #214d34;
  background: var(--green-soft);
  color: #bfffe0;
}

.button.danger {
  border-color: #53252a;
  background: var(--red-soft);
  color: #ffd3d3;
}

.button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.action-pending .fixed-action .button,
.action-pending #preview-trade,
.action-pending #submit-trade,
.action-pending #create-strategy,
.action-pending #create-wallet,
.action-pending [data-create-wallet],
.action-pending #create-deposit-address,
.action-pending #quote-deposit,
.action-pending [data-wallet-reconcile],
.action-pending [data-wallet-default],
.action-pending [data-pause-strategy],
.action-pending [data-cancel-order] {
  opacity: 0.58;
  pointer-events: none;
}

.form-grid {
  display: grid;
  gap: 10px;
}

.strategy-builder {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-items: end;
}

.field {
  display: grid;
  gap: 5px;
}

.field span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.field input,
.field select {
  min-height: 42px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0 10px;
  background: var(--panel-3);
  color: var(--text);
}

.check-row {
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0 10px;
  background: var(--panel-3);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.check-row input {
  width: 16px;
  height: 16px;
  accent-color: var(--green);
}

.notice,
.alert {
  border: 1px solid rgba(127, 167, 255, 0.35);
  border-radius: var(--radius);
  padding: 10px;
  background: rgba(127, 167, 255, 0.08);
  color: #d5e6ff;
  font-size: 12px;
  line-height: 1.45;
}

.notice.warn,
.alert.warn {
  border-color: #5a4519;
  background: var(--amber-soft);
  color: #e6c072;
}

.action-error,
.data-errors {
  display: grid;
  gap: 8px;
  margin-bottom: 10px;
}

.notice-actions {
  margin-top: 8px;
}

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}

.data-table {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--panel);
}

.data-row {
  min-height: 38px;
  display: grid;
  grid-template-columns: 1.25fr 0.7fr 0.7fr 0.8fr;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-top: 1px solid var(--line);
  font-size: 12px;
}

.data-row:first-child {
  border-top: 0;
}

.data-row.head {
  min-height: 30px;
  color: var(--muted);
  background: var(--panel-2);
  font-size: 10px;
  text-transform: uppercase;
  font-weight: 800;
}

.data-row strong {
  font-size: 12px;
  line-height: 1.15;
}

.table {
  width: 100%;
  border-collapse: collapse;
}

.table th,
.table td {
  border-bottom: 1px solid var(--line-soft);
  padding: 9px 10px;
  text-align: left;
  font-size: 12px;
  vertical-align: top;
}

.table th {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.table td:last-child,
.table th:last-child {
  text-align: right;
}

.legs {
  display: grid;
  gap: 7px;
}

.leg,
.list-card {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-2);
  padding: 9px;
}

.strategy-card {
  align-items: start;
}

.progress,
.risk-line {
  height: 7px;
  border-radius: 99px;
  background: #252b35;
  overflow: hidden;
}

.progress {
  width: 86px;
  margin-top: 5px;
}

.progress span,
.risk-line span {
  display: block;
  height: 100%;
  background: var(--green);
}

.fixed-action {
  position: sticky;
  bottom: 72px;
  z-index: 8;
  padding: 10px 0 0;
  background: linear-gradient(to top, var(--bg), rgba(8, 11, 15, 0));
}

.bars-wrap,
.heatmap-wrap,
.window-bars-scroll,
.heatmap-scroll {
  overflow-x: auto;
}

.bars {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 32px;
  align-items: end;
  gap: 6px;
  min-height: 162px;
  padding: 10px 2px 2px;
}

.bar-item {
  display: grid;
  grid-template-rows: 20px 104px 24px;
  gap: 4px;
  text-align: center;
  color: var(--muted);
  font-size: 10px;
}

.bar-track {
  align-self: stretch;
  display: flex;
  align-items: flex-end;
  border-radius: 6px;
  background: var(--panel-3);
  border: 1px solid var(--line-soft);
  overflow: hidden;
}

.bar-fill {
  width: 100%;
  min-height: 2px;
  background: var(--blue);
}

.pnl-wrap {
  position: relative;
}

.pnl-bars {
  min-height: 132px;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(42px, 1fr);
  align-items: end;
  gap: 6px;
  padding: 8px 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  overflow-x: auto;
  overflow-y: hidden;
}

.pnl-axis {
  position: absolute;
  left: 8px;
  right: 8px;
  top: 70px;
  height: 1px;
  background: var(--line);
}

.pnl-bar-item {
  min-width: 0;
  height: 116px;
  display: grid;
  grid-template-rows: 22px 74px 16px;
  gap: 3px;
  align-items: end;
  justify-items: stretch;
  color: var(--muted);
  font-size: 8px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.pnl-value {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 8px;
  font-weight: 800;
}

.pnl-track {
  min-width: 0;
  height: 74px;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  border: 1px solid var(--line-soft);
  border-radius: 5px;
  background: var(--panel-3);
  overflow: hidden;
}

.pnl-bar {
  width: 100%;
  min-height: 4px;
  border-radius: 0;
  background: var(--green);
  align-self: flex-start;
}

.pnl-bar.neg {
  background: var(--red);
  align-self: flex-end;
}

.pnl-date {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 8px;
}

.heatmap {
  display: grid;
  grid-template-columns: 56px repeat(24, 24px) 40px;
  gap: 3px;
  min-width: 710px;
  font-size: 9px;
}

.heat-cell,
.heat-head,
.heat-date,
.heat-total {
  min-height: 20px;
  border-radius: 4px;
  display: grid;
  place-items: center;
  font-variant-numeric: tabular-nums;
}

.heat-head,
.heat-date,
.heat-total {
  color: var(--muted);
  background: var(--panel-3);
  border: 1px solid var(--line-soft);
  font-weight: 800;
}

.heat-date {
  position: sticky;
  left: 0;
  z-index: 2;
}

.heat-total {
  position: sticky;
  right: 0;
  z-index: 2;
}

.heat-cell {
  border: 1px solid rgba(255, 255, 255, 0.04);
  background: rgba(127, 167, 255, 0.08);
  color: #e9f1ff;
  font-weight: 800;
}

.heat-cell.l1 { background: #1c3459; }
.heat-cell.l2 { background: #2b5fa3; }
.heat-cell.l3 { background: #528fe8; color: #07111f; }
.heat-cell.l4 { background: #8db7ff; color: #06101e; }

.bottom-nav {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 2px;
  width: min(430px, 100vw);
  max-width: min(430px, 100vw);
  min-width: 0;
  overflow: hidden;
  border-top: 1px solid var(--line);
  background: rgba(8, 11, 15, 0.97);
  backdrop-filter: blur(18px);
  padding: 7px 6px calc(7px + env(safe-area-inset-bottom));
}

.nav-button {
  min-width: 0;
  min-height: 46px;
  border-radius: var(--radius);
  background: transparent;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 4px;
  overflow: hidden;
  padding: 0 2px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-dot {
  width: 16px;
  height: 3px;
  border-radius: 99px;
  background: transparent;
}

.nav-button.active {
  color: var(--text);
  background: var(--panel);
}

.nav-button.active .nav-dot {
  background: var(--text);
}

.empty {
  color: var(--muted);
  font-size: 12px;
  padding: 12px;
}

.auth-card {
  width: min(430px, calc(100vw - 32px));
  margin: 42px auto;
}

.login-mark {
  height: 112px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  display: grid;
  place-items: center;
}

.login-mark strong {
  font-size: 24px;
}

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

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

  .span-8,
  .span-6,
  .span-4,
  .span-12 {
    grid-column: span 1;
  }

  .metric-grid,
  .mini-grid,
  .status-strip {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

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

  .topbar {
    min-height: 56px;
    padding: 9px 10px;
  }

  .chip {
    font-size: 10px;
    padding: 0 7px;
  }
}

@media (max-width: 560px) {
  .mini-grid,
  .metric-grid,
  .status-strip {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
  }

  .strategy-builder {
    grid-template-columns: 1fr;
  }

  .section-title {
    align-items: flex-start;
  }

  .top-actions {
    gap: 5px;
  }

  .icon-button,
  .back-button {
    min-width: 32px;
    height: 32px;
  }
}

/* Prototype parity: mobile trading terminal shell and components. */
.app-shell {
  width: min(430px, 100%);
  margin: 0 auto;
  border-left: 1px solid var(--line);
  border-right: 1px solid var(--line);
  background: var(--bg);
}

.app-shell .content {
  width: 100%;
  padding: calc(var(--topbar-height) + 12px + env(safe-area-inset-top)) 12px calc(122px + env(safe-area-inset-bottom));
}

.app-shell .content.scroll {
  overflow-y: auto;
}

.panel {
  padding: 12px;
  box-shadow: none;
}

.topbar {
  position: fixed;
  left: 50%;
  top: 0;
  transform: translateX(-50%);
  width: min(430px, 100vw);
  max-width: min(430px, 100vw);
  min-height: var(--topbar-height);
  padding: 9px 10px;
  padding-top: calc(9px + env(safe-area-inset-top));
}

.back-btn,
.back-button {
  min-width: 32px;
  width: 32px;
  height: 32px;
  padding: 0;
  font-size: 20px;
  line-height: 1;
}

.top-actions {
  gap: 5px;
}

.wallet-shortcut {
  color: var(--green);
  font-weight: 900;
}

.icon-button {
  min-width: 30px;
  width: 30px;
  height: 30px;
  font-size: 12px;
}

.bottom-nav {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  padding: 7px 6px calc(7px + env(safe-area-inset-bottom));
}

.nav-button {
  min-height: 46px;
}

.button.green,
.button.primary {
  border-color: #214d34;
  background: var(--green-soft);
  color: #bfffe0;
}

.button.secondary {
  background: var(--panel);
}

.button-row.single-action {
  grid-template-columns: minmax(0, 1fr);
}

.input-box {
  min-width: 0;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-2);
  padding: 8px 9px;
  display: grid;
  gap: 4px;
}

.input-box span {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.1;
  font-weight: 800;
}

.input-box input,
.input-box select {
  min-width: 0;
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-size: 13px;
  font-weight: 760;
}

.input-box strong {
  font-size: 13px;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.input-box.disabled {
  opacity: 0.68;
}

.choice-box {
  gap: 8px;
}

.choice-box input[type="hidden"] {
  display: none;
}

.choice-grid,
.strategy-wallet-choice-list {
  display: grid;
  gap: 6px;
}

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

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

.choice-card {
  position: relative;
  min-width: 0;
  min-height: 44px;
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  background: var(--panel-3);
  color: var(--text);
  display: grid;
  gap: 3px;
  align-content: center;
  text-align: left;
  padding: 8px;
  cursor: pointer;
}

.choice-card:active {
  transform: translateY(1px);
}

.choice-card strong {
  min-width: 0;
  font-size: 12px;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.choice-card small {
  min-width: 0;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.choice-card.selected {
  border-color: rgba(43, 213, 118, 0.68);
  background: rgba(43, 213, 118, 0.1);
  padding-right: 28px;
}

.choice-card.selected::after {
  content: "✓";
  position: absolute;
  top: 6px;
  right: 6px;
  width: 16px;
  height: 16px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: rgba(43, 213, 118, 0.18);
  border: 1px solid rgba(43, 213, 118, 0.62);
  color: #bfffe0;
  font-size: 10px;
  font-weight: 900;
}

.choice-card:focus-visible {
  outline: 2px solid rgba(127, 167, 255, 0.8);
  outline-offset: 2px;
}

.strategy-wallet-choice-list {
  max-height: 148px;
  overflow-y: auto;
  padding-right: 2px;
  scrollbar-width: thin;
}

.trade-choice-list {
  display: grid;
  gap: 6px;
  max-height: 132px;
  overflow-y: auto;
  padding-right: 2px;
  scrollbar-width: thin;
}

.market-choice-list {
  max-height: 154px;
}

.wallet-choice {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
}

.market-choice {
  grid-template-columns: minmax(0, 1fr) minmax(54px, auto);
  align-items: center;
  gap: 8px;
}

.choice-main,
.choice-side {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.choice-side {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.input-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.chart {
  height: 86px;
  display: flex;
  align-items: flex-end;
  gap: 5px;
  padding: 9px 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-2);
}

.bar {
  flex: 1;
  min-width: 7px;
  border-radius: 4px 4px 0 0;
  background: linear-gradient(to top, var(--blue), var(--teal));
}

.table {
  display: grid;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--panel);
}

.tr {
  min-height: 36px;
  display: grid;
  grid-template-columns: 1.15fr 0.65fr 0.65fr 0.65fr;
  align-items: center;
  gap: 7px;
  padding: 7px 9px;
  border-top: 1px solid var(--line-soft);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.tr:first-child {
  border-top: 0;
}

.tr.head {
  min-height: 28px;
  color: var(--muted);
  background: var(--panel-2);
  font-size: 9px;
  font-weight: 800;
  text-transform: uppercase;
}

.tr.selected {
  background: rgba(43, 213, 118, 0.08);
}

.tr span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.tr span:not(:first-child) {
  text-align: right;
}

.market-card,
.group-card,
.wallet-item {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-2);
  padding: 9px;
}

.wallet-overview {
  background: linear-gradient(180deg, rgba(43, 213, 118, 0.07), var(--panel) 58%);
}

.wallet-balance {
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: var(--panel-3);
  padding: 10px;
}

.wallet-action-row {
  grid-template-columns: 1fr 1fr;
}

.wallet-manager {
  background: var(--panel);
}

.wallet-list-compact {
  display: grid;
  gap: 6px;
  max-height: 210px;
  overflow-y: auto;
  padding-right: 2px;
  scrollbar-width: thin;
}

.wallet-item.compact {
  grid-template-columns: minmax(0, 1fr) auto;
  padding: 7px;
  gap: 7px;
}

.wallet-item.compact .value {
  min-width: 74px;
}

.wallet-item.compact .toolbar {
  gap: 5px;
}

.details-summary {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  list-style: none;
}

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

.details-summary::after {
  content: "›";
  width: 24px;
  height: 24px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
  display: grid;
  place-items: center;
  transform: rotate(90deg);
}

.details-summary.compact::after {
  width: 22px;
  height: 22px;
}

details[open] > .details-summary::after {
  transform: rotate(-90deg);
}

details.panel > .details-summary + * {
  margin-top: 10px;
}

.evidence-details {
  min-width: 0;
  border-top: 1px solid var(--line-soft);
  padding-top: 8px;
}

.evidence-details .factor-strip {
  margin-top: 8px;
}

.session-panel {
  background: var(--panel-3);
}

.market-card.selected,
.group-card.selected,
.wallet-item.selected {
  border-color: rgba(43, 213, 118, 0.55);
  background: rgba(43, 213, 118, 0.08);
}

.market-card .mini-grid {
  grid-column: 1 / -1;
}

.market-card .toolbar,
.wallet-item .toolbar {
  grid-column: 1 / -1;
}

.market-card {
  cursor: pointer;
}

.market-inline-detail {
  min-width: 0;
  display: grid;
  gap: 8px;
}

.bucket-decision-list {
  display: grid;
  gap: 8px;
}

.bucket-decision-list.compact {
  gap: 5px;
}

.bucket-decision-row {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(84px, 1fr) minmax(138px, auto) auto;
  align-items: center;
  gap: 7px;
  min-height: 42px;
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  background: var(--panel-2);
  padding: 6px 7px;
}

.bucket-decision-row.projected {
  border-color: rgba(127, 167, 255, 0.55);
  background: rgba(127, 167, 255, 0.08);
}

.bucket-decision-row.selected {
  border-color: rgba(43, 213, 118, 0.65);
  background: rgba(43, 213, 118, 0.1);
}

.bucket-decision-row.selectable {
  cursor: pointer;
}

.bucket-main {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.bucket-main strong {
  font-size: 12px;
  line-height: 1.1;
  overflow-wrap: anywhere;
}

.bucket-main span {
  color: var(--muted);
  font-size: 9px;
  line-height: 1.15;
}

.bucket-numbers {
  min-width: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(38px, auto));
  gap: 5px;
  justify-content: end;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.bucket-numbers span {
  min-width: 0;
  display: grid;
  gap: 1px;
  font-size: 11px;
  font-weight: 780;
}

.bucket-numbers small {
  color: var(--muted);
  font-size: 8px;
  line-height: 1;
  font-weight: 760;
}

.bucket-flags {
  display: flex;
  justify-content: flex-end;
  gap: 4px;
  flex-wrap: wrap;
}

.bucket-flags .chip {
  min-height: 19px;
  padding: 0 6px;
  font-size: 9px;
}

.bucket-decision-card {
  min-width: 0;
  display: grid;
  gap: 8px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: var(--panel-2);
  padding: 9px;
}

.bucket-decision-card.projected {
  border-color: rgba(127, 167, 255, 0.55);
  background: rgba(127, 167, 255, 0.08);
}

.bucket-decision-card.selectable {
  cursor: pointer;
}

.bucket-decision-card.selectable:hover {
  border-color: #33445c;
}

.bucket-decision-card.selected {
  border-color: rgba(43, 213, 118, 0.65);
  background: rgba(43, 213, 118, 0.1);
}

.trade-bucket-scroll {
  max-height: min(312px, 45vh);
  overflow-y: auto;
  padding-right: 2px;
  scrollbar-width: thin;
}

.bucket-tags {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
}

.group-card.stack {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: stretch;
}

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

.metric-grid.compact.four {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

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

.estimate-legs,
.position-bucket-table,
.repair-order-table {
  display: grid;
  gap: 4px;
}

.estimate-leg,
.position-bucket-row,
.repair-order-row {
  min-width: 0;
  display: grid;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  background: var(--panel-2);
  padding: 5px 7px;
  font-size: 10px;
  font-variant-numeric: tabular-nums;
}

.estimate-leg {
  grid-template-columns: minmax(86px, 1fr) 44px 58px 54px;
}

.estimate-leg.head {
  min-height: 24px;
  color: var(--muted);
  background: var(--panel-3);
  font-size: 8px;
  font-weight: 800;
  text-transform: uppercase;
}

.position-bucket-row {
  grid-template-columns: minmax(68px, 1fr) 52px 54px 42px 54px;
}

.repair-rounds {
  min-width: 0;
}

.repair-round-card {
  min-width: 0;
  display: grid;
  gap: 7px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: var(--panel-2);
  padding: 8px;
}

.repair-order-row {
  grid-template-columns: minmax(62px, 1fr) 42px 54px 54px 52px;
}

.position-bucket-row.head,
.repair-order-row.head {
  min-height: 24px;
  color: var(--muted);
  background: var(--panel-3);
  font-size: 8px;
  font-weight: 800;
  text-transform: uppercase;
}

.estimate-leg strong,
.position-bucket-row strong,
.repair-order-row strong {
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 10px;
}

.estimate-leg span,
.position-bucket-row span,
.repair-order-row span {
  min-width: 0;
  text-align: right;
  overflow-wrap: anywhere;
}

.strategy-card {
  background: var(--panel);
}

.window-bars-scroll,
.heatmap-scroll {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  padding: 8px;
  scrollbar-width: thin;
}

.window-bars {
  min-width: 720px;
  height: 112px;
  display: grid;
  grid-template-columns: repeat(30, minmax(18px, 1fr));
  align-items: end;
  gap: 4px;
}

.window-bar-item {
  height: 100%;
  display: grid;
  grid-template-rows: 16px 1fr 14px;
  align-items: end;
  justify-items: center;
  gap: 3px;
}

.window-count,
.window-date {
  color: var(--muted);
  font-size: 8px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.window-count {
  color: var(--text);
  font-weight: 760;
}

.window-date {
  transform: rotate(-45deg);
  transform-origin: center;
  margin-top: 2px;
}

.window-bar-track {
  width: 100%;
  height: 70px;
  display: flex;
  align-items: end;
  justify-content: center;
}

.window-bar-fill {
  width: 12px;
  min-height: 2px;
  border-radius: 4px 4px 1px 1px;
  background: var(--blue);
  opacity: 0.82;
}

.heatmap-wide {
  display: grid;
  grid-template-columns: 52px repeat(24, 18px) 40px;
  gap: 3px;
  min-width: 620px;
  font-size: 8px;
}

.heat-corner,
.heat-hour,
.heat-date,
.heat-total,
.heat-avg,
.heat-cell {
  min-height: 18px;
  border-radius: 4px;
  display: grid;
  place-items: center;
  font-variant-numeric: tabular-nums;
}

.heat-corner,
.heat-hour,
.heat-date,
.heat-total,
.heat-avg {
  color: var(--muted);
  background: var(--panel-3);
  border: 1px solid var(--line-soft);
  font-weight: 800;
}

.heat-date {
  position: sticky;
  left: 0;
  z-index: 2;
  text-align: right;
  padding-right: 5px;
}

.heat-total {
  position: sticky;
  right: 0;
  z-index: 2;
}

.insight-market-stack {
  display: grid;
  gap: 8px;
}

.insight-market-card,
.market-prediction-card {
  min-width: 0;
}

.insight-market-card {
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: var(--panel-2);
  padding: 9px;
  cursor: pointer;
}

.insight-market-card:hover {
  border-color: #33445c;
}

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

.factor-strip span {
  min-height: 22px;
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  background: var(--panel-2);
  color: var(--muted);
  padding: 0 8px;
  font-size: 10px;
  font-weight: 760;
}

.distribution-bars {
  min-height: 120px;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(22px, 1fr);
  gap: 5px;
  align-items: end;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: thin;
}

.distribution-item {
  min-width: 0;
  height: 112px;
  display: grid;
  grid-template-rows: 18px 1fr 18px;
  gap: 3px;
  justify-items: center;
  color: var(--muted);
  font-size: 9px;
  font-variant-numeric: tabular-nums;
}

.distribution-value,
.distribution-label {
  white-space: nowrap;
}

.distribution-value {
  color: var(--text);
  font-weight: 760;
}

.distribution-track {
  width: 100%;
  height: 72px;
  display: flex;
  align-items: end;
  justify-content: center;
  border-radius: 6px;
  background: var(--panel-3);
  border: 1px solid var(--line-soft);
  overflow: hidden;
}

.distribution-fill {
  width: 100%;
  min-height: 2px;
  background: var(--blue);
}

.distribution-fill.teal {
  background: var(--teal);
}

.timeline {
  display: grid;
  gap: 0;
}

.event {
  min-width: 0;
  display: grid;
  grid-template-columns: 14px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 9px 0;
  border-top: 1px solid var(--line-soft);
}

.event:first-child {
  border-top: 0;
}

.event-dot {
  width: 8px;
  height: 8px;
  border-radius: 99px;
  background: var(--green);
}

.event-dot.amber {
  background: var(--amber);
}

.event-dot.green {
  background: var(--green);
}

.auth-screen {
  min-height: 100vh;
  display: grid;
  align-content: start;
  gap: 12px;
  padding-top: 42px;
}

.login-mark {
  height: 118px;
  background: var(--panel);
}

.fixed-action {
  position: sticky;
  bottom: calc(68px + env(safe-area-inset-bottom));
  z-index: 8;
  padding: 8px 0 0;
  background: linear-gradient(to top, var(--bg), rgba(9, 11, 15, 0));
}
