:root {
  color-scheme: dark;
  --canvas: #080f19;
  --surface: #142133;
  --inset: #101a2b;
  --glass: #152139c7;
  --glass-inset: #0e172780;
  --border: #c0d0fa29;
  --border-strong: #b8cdf75c;
  --rim-light: #ccdeff38;
  --text: #edf2fd;
  --muted: #acb9cf;
  --accent: #c2cdff;
  --accent-strong: #e1eaff;
  --accent-soft: #273856;
  --on-accent: #111d35;
  --positive: #8fdec3;
  --positive-soft: #163431;
  --positive-border: #89e4c840;
  --negative: #ffb3bf;
  --negative-soft: #3a2332;
  --negative-border: #ffb3bf47;
  --warning: #f1d19a;
  --warning-soft: #3a3026;
  --warning-border: #f1d19a42;
  --row-hover: #23334b;
  --radius: 24px;
  --radius-inner: 14px;
  --section-gap: clamp(18px, 2vw, 28px);
  --panel-padding: clamp(20px, 2.35vw, 34px);
  --shadow: inset 0 1px 0 var(--rim-light), 0 16px 40px -26px #000c;
  --ease-out: cubic-bezier(.2, .75, .25, 1);
}

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--canvas);
  color: var(--text);
  font-family: Inter, "Segoe UI", system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

button, select { font: inherit; }
button, a, select { -webkit-tap-highlight-color: transparent; }
a { color: var(--accent); }

:where(button, select, a, [tabindex]):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}

::selection { background: var(--accent); color: var(--on-accent); }

.app-shell {
  min-height: 100vh;
  background:
    radial-gradient(ellipse 58rem 38rem at -5% -8rem, #26385d, transparent 76%),
    radial-gradient(ellipse 49rem 31rem at 102% 18rem, #143548, transparent 80%),
    var(--canvas);
}

.page {
  width: min(100%, 1600px);
  margin-inline: auto;
  padding: clamp(14px, 3vw, 44px);
  padding-bottom: clamp(34px, 5vw, 72px);
  min-width: 0;
}

.glass-card {
  min-width: 0;
  border: 1px solid var(--border);
  background: linear-gradient(145deg, #b9caff0b, transparent 67%), var(--glass);
  box-shadow: var(--shadow);
  backdrop-filter: blur(20px) saturate(1.2);
}

/* Page introductions and actions */

.header,
.trade-page-header {
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: clamp(20px, 3vw, 48px);
  padding: clamp(28px, 3.15vw, 46px) clamp(25px, 3.5vw, 54px);
  margin-bottom: var(--section-gap);
  border: 1px solid var(--border-strong);
  border-radius: calc(var(--radius) + 6px);
  overflow: hidden;
  color: var(--text);
  background:
    radial-gradient(ellipse at 103% -11%, #7b8bd06e, transparent 62%),
    radial-gradient(ellipse at 86% 113%, #367d7f50, transparent 62%),
    linear-gradient(124deg, #141f34f5, #202c50eb 67%, #2c405de8);
  box-shadow: inset 0 1px 0 #e1ebff50, inset 0 -1px 0 #dae4ff12, 0 28px 56px -42px #000e;
  backdrop-filter: blur(26px) saturate(1.25);
}

.header::before,
.trade-page-header::before {
  position: absolute;
  z-index: -1;
  inset: 0;
  pointer-events: none;
  content: "";
  background:
    radial-gradient(ellipse 74% 170% at 100% -37%, transparent 48%, #c4d1ff2d 57%, #c9d6ff14 61%, transparent 68%),
    radial-gradient(ellipse 86% 165% at 83% -34%, transparent 53%, #8ad6cf2c 63%, transparent 72%),
    linear-gradient(110deg, transparent 53%, #e2edff08 73%, transparent 82%);
  mask-image: linear-gradient(104deg, transparent 24%, black 70%);
}

.title-block { max-width: 54rem; }

.eyebrow,
.strategy-eyebrow {
  display: flex;
  align-items: center;
  gap: 9px;
  width: fit-content;
  font-size: 11px;
  font-weight: 750;
  letter-spacing: .12em;
  line-height: 1.35;
  text-transform: uppercase;
}

.eyebrow { margin-bottom: 14px; color: var(--accent); }
.eyebrow::before, .strategy-eyebrow::before {
  width: 15px;
  height: 1px;
  background: currentColor;
  content: "";
}

.title-block h1,
.trade-page-header h1 {
  margin: 0;
  font-size: clamp(32px, 4.15vw, 60px);
  font-weight: 670;
  line-height: 1.08;
  letter-spacing: -.054em;
  text-wrap: balance;
}

.title-block p,
.trade-page-header p {
  max-width: 57ch;
  margin: 14px 0 0;
  color: #c7d2e9;
  font-size: clamp(14px, 1.3vw, 16px);
  line-height: 1.65;
}

.header-actions, .activity-actions {
  display: flex;
  flex: 0 0 auto;
  flex-wrap: wrap;
  gap: 10px;
  align-items: stretch;
  justify-content: flex-end;
}

button,
.route-link-btn,
.back-link,
.dex-link {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  min-height: 44px;
  padding: 9px 15px;
  border: 1px solid transparent;
  border-radius: 12px;
  font-weight: 650;
  text-align: center;
  text-decoration: none;
  line-height: 1.25;
  transition: background-color .2s var(--ease-out), border-color .2s var(--ease-out),
    color .2s var(--ease-out), box-shadow .22s var(--ease-out), transform .22s var(--ease-out);
}

button {
  cursor: pointer;
  color: var(--on-accent);
  background: var(--accent);
  box-shadow: inset 0 1px #e9f3ff65;
}

button:hover { background: var(--accent-strong); }
button:disabled { cursor: wait; opacity: .65; }

.route-link-btn,
.back-link,
.dex-link {
  border-color: var(--border-strong);
  background: var(--glass-inset);
  color: var(--accent-strong);
}

.route-link-btn:hover,
.back-link:hover,
.dex-link:hover { background: var(--accent-soft); border-color: var(--accent); }

.header-actions > .route-link-btn,
.activity-actions > button {
  border-color: #d3e0ff65;
  background: var(--accent);
  color: var(--on-accent);
}

.header-actions > .route-link-btn:hover,
.activity-actions > button:hover { background: var(--accent-strong); }

.activity-actions > .back-link {
  border-color: var(--border-strong);
  background: #dbe7ff16;
  color: var(--text);
}

.activity-actions > .back-link:hover { background: #dbe7ff29; }

:where(.header, .trade-page-header) :focus-visible { outline-color: var(--accent-strong); }

.status-card {
  display: grid;
  align-content: center;
  min-width: 112px;
  padding: 8px 13px;
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  background: #dbe7ff13;
  box-shadow: inset 0 1px var(--rim-light);
}

.status-label { color: #c7d2e9; font-size: 11px; }
.status-value { display: flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 750; }
.status-value.dry { color: var(--warning); }
.status-value.live { color: var(--negative); }

.pulse-dot,
.entry-status-dot,
.decision-dot {
  flex: 0 0 7px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}

select {
  min-height: 44px;
  max-width: 100%;
  padding: 8px 28px 8px 11px;
  border: 1px solid var(--border-strong);
  border-radius: 11px;
  color: var(--text);
  background: var(--surface);
  transition: border-color .2s var(--ease-out), background-color .2s var(--ease-out);
}

select:hover { border-color: var(--accent); }

/* Strategy, statistics and page sections */

.grid,
.trade-hero-grid,
.strategy-metrics,
.trade-runtime-strip,
.analytics-grid,
.discovery-funnel-grid,
.validation-summary-grid,
.security-provider-grid,
.diagnosis-confidence-row,
.early-funnel-grid,
.diagnostic-grid,
.gate-stage-grid,
.open-position-grid,
.open-position-stats,
.trailing-values {
  display: grid;
  gap: clamp(10px, 1.3vw, 16px);
  min-width: 0;
}

.grid, .trade-hero-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: var(--section-gap); }

.discovery-metric-grid,
.account-grid,
.strategy-metrics,
.discovery-funnel-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }

.metric-card, .trade-hero-card {
  border-radius: var(--radius-inner);
  padding: clamp(14px, 1.6vw, 23px);
  transition: border-color .22s var(--ease-out), box-shadow .22s var(--ease-out);
  background: linear-gradient(150deg, #a9bbff19, transparent 65%), var(--glass);
}

.account-grid > .trade-hero-card:nth-child(2) {
  background: linear-gradient(150deg, #a5c2ff26, #526ca01f 82%), var(--surface);
  border-color: var(--border-strong);
}

.metric-label, .trade-card-label, .strategy-metric > span { color: var(--muted); font-size: 12px; font-weight: 650; }

.metric-value, .trade-card-value, .strategy-metric > strong {
  margin-top: 6px;
  font-size: clamp(20px, 2.15vw, 31px);
  line-height: 1.12;
  font-weight: 700;
  letter-spacing: -.04em;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

.discovery-metric-grid > :last-child .metric-value {
  font-size: clamp(14px, 1.55vw, 21px);
  letter-spacing: -.025em;
  line-height: 1.25;
}

.metric-hint, .trade-card-hint, .strategy-metric > small { margin-top: 7px; color: var(--muted); font-size: 12px; line-height: 1.45; }
.warning-text { color: var(--warning); }
.danger-text { color: var(--negative); }
.positive, .buy, .validation-pass { color: var(--positive); font-weight: 700; }
.negative, .sell, .validation-fail { color: var(--negative); font-weight: 700; }
.validation-warn { color: var(--warning); }
.trade-pnl { font-weight: 700; font-variant-numeric: tabular-nums; }

.active-strategy-panel,
.trade-section,
.wallet-panel,
.signals-panel,
.panel {
  border-radius: var(--radius);
  padding: var(--panel-padding);
}

.active-strategy-panel,
.trade-section { margin-bottom: var(--section-gap); }

.strategy-heading,
.section-title-row,
.strategy-current-results,
.open-position-head,
.position-trailing-heading,
.gate-stage-head,
.signal-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.strategy-heading, .section-title-row { margin-bottom: 20px; }
.strategy-heading > div, .section-title-row > div { min-width: 0; }
.strategy-heading > .trade-status-pill { flex-shrink: 0; }
.strategy-eyebrow { color: var(--accent); }

.strategy-heading h2 {
  margin: 6px 0;
  font-size: clamp(23px, 2.7vw, 36px);
  letter-spacing: -.045em;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.strategy-heading p,
.section-title-row p,
.panel p,
.strategy-policy-grid p,
.entry-candidate-blockers > p {
  margin: 0;
  max-width: 76ch;
  color: var(--muted);
  line-height: 1.6;
  overflow-wrap: anywhere;
}

.section-title-row h3, .panel h3, .strategy-policy-grid h3, .entry-candidate-blockers h3 {
  margin: 0 0 5px;
  font-size: clamp(17px, 1.7vw, 23px);
  letter-spacing: -.025em;
  line-height: 1.22;
}

.strategy-metrics {
  gap: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-inner);
  background: var(--glass-inset);
  box-shadow: inset 0 1px 4px #070c1755;
}

.strategy-metric { display: flex; flex-direction: column; min-width: 0; }
.strategy-metric-unit { font-size: .48em; font-weight: 650; letter-spacing: 0; color: var(--muted); }
.strategy-metrics > .strategy-metric { padding: 16px clamp(12px, 1.5vw, 21px); }
.strategy-metrics > .strategy-metric + .strategy-metric { border-left: 1px solid var(--border); }

.entry-status {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin-top: 17px;
  padding: 11px 13px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--glass-inset);
}

.entry-status-dot { margin-top: .49em; color: var(--accent); }
.entry-status.warning .entry-status-dot { color: var(--warning); }
.entry-status.active .entry-status-dot { color: var(--positive); }
.entry-status p { margin: 3px 0 0; color: var(--muted); font-size: 13px; line-height: 1.55; }

.strategy-detail-link,
.signal-link {
  display: inline-flex;
  margin-top: 13px;
  font-size: 13px;
  font-weight: 700;
  text-underline-offset: .23em;
}

.strategy-current-results, .strategy-policy-grid, .entry-candidate-blockers {
  padding-top: 18px;
  margin-top: 18px;
  border-top: 1px solid var(--border);
}

.strategy-current-results { align-items: center; }
.strategy-current-results > div:first-child { display: grid; gap: 4px; }
.strategy-result-values, .position-pills {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 12px;
}

.strategy-note, .position-trailing-view > small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.strategy-policy-grid, .trade-layout {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--section-gap);
}

.strategy-policy-grid p { margin: 8px 0; }
.strategy-rule-list { margin: 9px 0; padding-left: 20px; color: var(--muted); }
.strategy-rule-list li + li { margin-top: 4px; }

.trade-runtime-strip {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  margin-bottom: var(--section-gap);
  padding: 15px 18px;
  border-radius: var(--radius-inner);
}

.trade-runtime-strip > div, .analytics-grid > div, .open-position-stats > div,
.validation-summary-grid > div, .security-provider-grid > div, .diagnosis-confidence-row > div {
  display: grid;
  align-content: start;
  grid-template-columns: minmax(0, 1fr);
  gap: 4px;
  min-width: 0;
}

.trade-runtime-strip span, .analytics-grid span, .open-position-stats span,
.validation-summary-grid span, .security-provider-grid span, .diagnosis-confidence-row span, .early-funnel-grid span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
  line-height: 1.4;
  letter-spacing: .045em;
  text-transform: uppercase;
  overflow-wrap: anywhere;
}

.trade-runtime-strip strong, .analytics-grid strong, .open-position-stats strong {
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

.analytics-grid,
.validation-summary-grid,
.security-provider-grid,
.diagnosis-confidence-row { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.analytics-grid.discovery-funnel-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.early-funnel-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.diagnostic-grid, .gate-stage-grid, .open-position-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.open-position-stats, .trailing-values { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.analytics-grid > div, .validation-summary-grid > div, .security-provider-grid > div,
.diagnosis-confidence-row > div, .early-funnel-grid > div,
.diagnostic-list-card, .gate-stage-card, .open-position-card,
.allocation-row, .signal-row, .trade-placeholder-row,
.validation-row, .finding-row, .pipeline-step {
  min-width: 0;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-inner);
  background: var(--glass-inset);
}

.analytics-grid strong, .validation-summary-grid strong, .security-provider-grid strong,
.diagnosis-confidence-row strong, .early-funnel-grid strong {
  font-size: clamp(17px, 1.75vw, 24px);
  line-height: 1.2;
  letter-spacing: -.025em;
  overflow-wrap: anywhere;
}

.early-funnel-grid span { display: block; margin-bottom: 4px; }
.analytics-grid small, .diagnostic-empty, .trade-placeholder-description, .gate-stage-card > span:not(.trade-status-pill) {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.diagnosis-grid-spacing,
.gate-stage-footnote,
.security-provider-grid,
.diagnosis-confidence-row,
.diagnostic-grid,
.finding-list { margin-top: 16px; }

.gate-stage-card { display: flex; flex-direction: column; gap: 6px; }
.gate-stage-card.final-gate-card { background: var(--accent-soft); border-color: var(--border-strong); }
.gate-stage-head strong { letter-spacing: -.01em; }
.gate-stage-card .gate-stage-security { color: var(--text); font-weight: 650; }
.gate-stage-footnote { color: var(--muted); font-size: 13px; }

.open-position-head { margin-bottom: 15px; }
.open-position-head strong { display: block; font-size: 19px; overflow-wrap: anywhere; }
.open-position-head span:not(.trade-status-pill) { display: block; color: var(--muted); font-size: 12px; }
.open-position-head > div:first-child { min-width: 0; }
.position-pills { justify-content: flex-end; }
.open-position-stats { gap: 12px 9px; }

.position-trailing-view {
  padding: 14px;
  margin: 13px 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-inner);
  background: linear-gradient(155deg, #c8d5ff0f, transparent 82%), var(--inset);
}

.position-trailing-heading { align-items: center; margin-bottom: 12px; }
.trailing-values .strategy-metric > strong { font-size: clamp(16px, 1.65vw, 22px); }
.trailing-explanation { margin: 10px 0 4px; color: var(--muted); font-size: 13px; }

.open-position-foot {
  margin-top: 13px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.finding-list, .validation-list, .diagnostic-list, .trade-placeholder-list { display: grid; gap: 8px; }
.validation-list { margin-top: 13px; }
.validation-row, .finding-row, .trade-placeholder-row { display: flex; align-items: flex-start; gap: 10px; }
.validation-row, .trade-placeholder-row { justify-content: space-between; }
.validation-row-content, .finding-row > div { display: grid; gap: 3px; min-width: 0; }
.validation-row-content span, .finding-row span:not(.trade-status-pill) { color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.diagnostic-list-card h4 { margin: 0 0 8px; font-size: 14px; }
.diagnostic-row { display: flex; justify-content: space-between; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--border); }
.diagnostic-row:last-child { border-bottom: 0; }
.diagnostic-row span { color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.diagnostic-row strong { font-size: 13px; font-variant-numeric: tabular-nums; }

/* Watchlist, history and other data displays */

.toolbar,
.toolbar-left,
.watchlist-selector {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.toolbar { justify-content: space-between; padding: 13px 16px; margin-bottom: 13px; border-radius: var(--radius-inner); }
.small-text, .watchlist-selector { color: var(--muted); font-size: 13px; }

.table-frame { width: 100%; min-width: 0; }
.entry-candidate-blockers > .table-frame { margin-top: 14px; }

.table-scroll-note {
  display: flex;
  justify-content: flex-end;
  margin: 0 2px 7px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
}

.table-wrap,
.trade-history-table-wrap,
.candidate-table-wrap,
.signal-list,
.allocation-list,
.decision-timeline {
  min-width: 0;
  max-width: 100%;
  overflow: auto;
  scrollbar-width: thin;
  scrollbar-color: #61718e var(--inset);
}

.table-wrap { border-radius: var(--radius-inner); }

.trade-history-table-wrap,
.candidate-table-wrap {
  border: 1px solid var(--border);
  border-radius: var(--radius-inner);
}

.table-wrap, .trade-history-table-wrap, .candidate-table-wrap {
  max-height: min(72vh, 44rem);
  overscroll-behavior-x: contain;
  background: var(--surface);
}

.responsive-table { width: 100%; border-collapse: separate; border-spacing: 0; text-align: left; }
.watchlist-table { min-width: 1270px; }
.trade-history-table { min-width: 1160px; }
.candidate-table { min-width: 575px; }

.responsive-table th {
  position: sticky;
  z-index: 2;
  top: 0;
  padding: 11px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--inset);
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
  letter-spacing: .045em;
  text-transform: uppercase;
  white-space: nowrap;
}

.responsive-table td {
  padding: 12px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  vertical-align: middle;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
  transition: background-color .2s var(--ease-out);
}

.responsive-table tbody tr:last-child td { border-bottom: 0; }
.responsive-table tbody tr:focus-within td { background: var(--row-hover); }
.watchlist-table :is(th, td):nth-child(2) { min-width: 160px; }

:is(.watchlist-table, .trade-history-table) :is(th, td):nth-child(2) {
  position: sticky;
  z-index: 1;
  left: 0;
  box-shadow: 1px 0 var(--border);
}

:is(.watchlist-table, .trade-history-table) th:nth-child(2) { z-index: 3; }

.watchlist-table td:nth-child(7) { min-width: 174px; }
.watchlist-table td:nth-child(17) { min-width: 110px; }
.watchlist-table td:nth-child(5),
.watchlist-table td:nth-child(n + 8):nth-child(-n + 16),
.trade-history-table td:nth-child(n + 5):nth-child(-n + 10) { white-space: nowrap; }
.trade-history-table td:first-child { min-width: 124px; }
.trade-history-table td:last-child { min-width: 205px; vertical-align: top; }
.trade-history-table td:last-child .trade-reason-cell { max-width: 24rem; }
.trade-history-empty { padding: 26px !important; color: var(--muted); text-align: center; }
.candidate-table td { vertical-align: top; }
.candidate-table td:first-child { min-width: 110px; }
.candidate-table td:nth-child(2), .candidate-table td:nth-child(3) { white-space: nowrap; }
.candidate-table ul { margin: 0; padding-left: 17px; color: var(--muted); }
.candidate-setup { display: block; margin-top: 3px; color: var(--accent); }

.rank-pill {
  display: inline-grid;
  width: 25px;
  height: 25px;
  place-items: center;
  border-radius: 7px;
  background: var(--inset);
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.token-cell, .allocation-main { display: flex; align-items: center; gap: 9px; min-width: 0; }
.token-cell > div:last-child, .allocation-token-info { min-width: 0; }
.token-cell > div:last-child { overflow-wrap: anywhere; }

.token-avatar,
.allocation-avatar {
  display: grid;
  flex: 0 0 36px;
  width: 36px;
  height: 36px;
  place-items: center;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 15px;
  font-weight: 750;
  object-fit: cover;
}

.token-name, .allocation-token-name { font-weight: 750; overflow-wrap: anywhere; }
.token-symbol, .mint { color: var(--muted); font-size: 11px; }
.mint {
  overflow: hidden;
  font-family: ui-monospace, Consolas, monospace;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.price-cell, .compact-money { white-space: nowrap; font-weight: 650; }
.price-cell { display: inline-block; padding: 2px 4px; border-radius: 5px; }
.price-cell.flash-up { animation: flash-up 1.1s ease-out; }
.price-cell.flash-down { animation: flash-down 1.1s ease-out; }
@keyframes flash-up { from { background: var(--positive-soft); } to { background: transparent; } }
@keyframes flash-down { from { background: var(--negative-soft); } to { background: transparent; } }

.buy-sell, .source-chip-list { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; }
.buy-sell { flex-wrap: nowrap; }
.slash { color: var(--muted); }
.dex-link { min-height: 36px; padding: 6px 8px; white-space: nowrap; font-size: 12px; }

.trade-status-pill, .setup-badge, .score, .early-score, .security-badge, .source-chip,
.lane-chip, .flag, .native-chip, .signal-badge, .signal-stats span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  max-width: 100%;
  padding: 4px 7px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--inset);
  color: var(--muted);
  font-size: 10px;
  font-weight: 750;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.trade-status-pill,
.security-badge,
.signal-badge { letter-spacing: .025em; }

.score { min-width: 33px; font-size: 12px; }
.flag { margin: 1px 3px 1px 0; }

.trade-status-pill.active, .entry-status.active, .security-badge.pass, .score.high, .flag.none, .signal-badge.watch_buy {
  border-color: var(--positive-border);
  background: var(--positive-soft);
  color: var(--positive);
}

.trade-status-pill.warning, .security-badge.pending, .score.low, .signal-badge.wait, .quote-warning, .trade-warning {
  border-color: var(--warning-border);
  background: var(--warning-soft);
  color: var(--warning);
}

.trade-status-pill.danger, .security-badge.block, .signal-badge.avoid, .flag, .error, .trade-error {
  border-color: var(--negative-border);
  background: var(--negative-soft);
  color: var(--negative);
}

.setup-badge.recovery, .early-score.active, .lane-chip.early, .native-chip {
  border-color: var(--border-strong);
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.signal-stats span { justify-content: flex-start; }
.trail-inline { display: grid; gap: 2px; min-width: 110px; }
.trail-inline small, .trade-reason-cell { color: var(--muted); font-size: 12px; line-height: 1.4; }
.trade-reason-cell { margin-top: 4px; }
.trade-reason-cell + .trade-reason-cell { margin-top: 5px; }

.error, .trade-error, .trade-warning, .quote-warning {
  margin: 0 0 15px;
  padding: 11px 14px;
  border-width: 1px;
  border-style: solid;
  border-radius: var(--radius-inner);
  font-size: 13px;
}

.quote-warning { margin-block: 10px; }

.empty-state, .decision-empty {
  padding: 25px 18px;
  color: var(--muted);
  text-align: center;
  line-height: 1.6;
}

.empty-state { display: grid; justify-items: center; gap: 5px; border-radius: var(--radius-inner); }
.empty-icon { display: grid; width: 36px; height: 36px; place-items: center; border-radius: 10px; background: var(--accent-soft); color: var(--accent); }

.future-section { display: grid; gap: var(--section-gap); margin-top: var(--section-gap); }
.coverage-stats { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-top: 13px; color: var(--muted); font-size: 13px; }
.coverage-stats strong { color: var(--text); font-variant-numeric: tabular-nums; }
.coverage-link { margin-top: 13px; }

.wallet-total, .signal-total { text-align: right; white-space: nowrap; }
.wallet-total span, .signal-total span, .allocation-percent, .allocation-token-sub, .signal-token-name, .signal-meta { color: var(--muted); font-size: 12px; }
.wallet-total strong, .signal-total strong { display: block; font-size: 21px; letter-spacing: -.025em; font-variant-numeric: tabular-nums; }

.allocation-list, .signal-list {
  display: grid;
  gap: 8px;
  max-height: 460px;
  padding-right: 4px;
}

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

.allocation-values { text-align: right; font-variant-numeric: tabular-nums; }
.allocation-usd { font-weight: 750; }
.allocation-token-sub { overflow-wrap: anywhere; }

.allocation-bar-wrap {
  grid-column: 1 / -1;
  height: 5px;
  border-radius: 999px;
  background: var(--accent-soft);
  overflow: hidden;
}

.allocation-bar { height: 100%; border-radius: inherit; background: linear-gradient(90deg, #647fbc, var(--accent)); }
.signal-top > div { min-width: 0; overflow-wrap: anywhere; }
.signal-top > .signal-badge { flex: 0 0 auto; }
.signal-stats { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.signal-reason, .signal-warning, .signal-empty { margin: 6px 0 0; color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
.signal-warning { color: var(--negative); }

.decision-timeline { max-height: 470px; }
.decision-row { display: grid; grid-template-columns: 9px minmax(0, 1fr); gap: 9px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.decision-dot { margin-top: 6px; color: var(--accent); }
.decision-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 10px; }
.decision-head span, .decision-reason { color: var(--muted); font-size: 12px; }
.decision-type { margin-top: 3px; color: var(--accent); font-size: 11px; font-weight: 750; overflow-wrap: anywhere; }
.decision-message, .decision-reason { margin-top: 3px; overflow-wrap: anywhere; }

.pipeline-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
.pipeline-number { color: var(--accent); font-weight: 750; }
.pipeline-step h4 { margin: 4px 0; }
.pipeline-step p { margin: 0; color: var(--muted); }

/* Responsive layout */

@media (hover: hover) and (pointer: fine) {
  :is(button:not(:disabled), .route-link-btn, .back-link, .dex-link):hover {
    transform: translateY(-1px);
    box-shadow: inset 0 1px 0 var(--rim-light), 0 6px 18px -8px #000e;
  }

  :is(button:not(:disabled), .route-link-btn, .back-link, .dex-link):active { transform: translateY(0); }
  :is(.metric-card, .trade-hero-card):hover { border-color: var(--border-strong); }
  .responsive-table tbody tr:hover td { background: var(--row-hover); }
}

.watchlist-table :is(th, td):nth-child(n + 8):nth-child(-n + 16),
.trade-history-table :is(th, td):nth-child(n + 5):nth-child(-n + 10) { text-align: right; }
.watchlist-table .buy-sell { justify-content: flex-end; }

@media (max-width: 1150px) {
  .header, .trade-page-header { grid-template-columns: minmax(0, 1fr); gap: 21px; }
  .header-actions, .activity-actions { justify-content: flex-start; }
  .discovery-metric-grid, .account-grid, .strategy-metrics,
  .analytics-grid.discovery-funnel-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .strategy-metrics > .strategy-metric:nth-child(4) { border-left: 0; }
  .strategy-metrics > .strategy-metric:nth-child(n + 4) { border-top: 1px solid var(--border); }
}

@media (max-width: 800px) {
  .trade-layout, .open-position-grid, .diagnostic-grid { grid-template-columns: minmax(0, 1fr); }
  .strategy-current-results { align-items: flex-start; flex-direction: column; }
  .trade-runtime-strip, .pipeline-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  :root { --panel-padding: 17px; --section-gap: 16px; --radius: 18px; }
  .page { padding-inline: 12px; }
  .header, .trade-page-header { padding: 24px 17px 20px; }
  .header-actions, .activity-actions { display: grid; width: 100%; }
  .header-actions { grid-template-columns: minmax(0, 1fr) auto; }
  .activity-actions { grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); }
  .activity-actions > :is(button, a) { padding-inline: 8px; font-size: clamp(12px, 3.4vw, 14px); }
  .route-link-btn, .back-link, button { padding-inline: 10px; }
  .status-card { min-width: 94px; }
  .strategy-heading { flex-direction: column; }
  .strategy-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .strategy-metrics > .strategy-metric { border-top: 1px solid var(--border); }
  .strategy-metrics > .strategy-metric:nth-child(-n + 2) { border-top: 0; }
  .strategy-metrics > .strategy-metric:nth-child(odd) { border-left: 0; }
  .strategy-metrics > .strategy-metric:nth-child(even) { border-left: 1px solid var(--border); }
  .strategy-metrics > .strategy-metric { padding: 14px 11px; }
  .strategy-metrics .strategy-metric > span { line-height: 1.35; }
  .strategy-policy-grid, .gate-stage-grid { grid-template-columns: minmax(0, 1fr); }
  .grid, .trade-hero-grid, .trade-runtime-strip, .analytics-grid,
  .analytics-grid.discovery-funnel-grid, .validation-summary-grid, .security-provider-grid,
  .diagnosis-confidence-row, .early-funnel-grid, .pipeline-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }

  .metric-label, .trade-card-label { line-height: 1.35; }

  .toolbar { align-items: stretch; }
  .toolbar-left { display: grid; grid-template-columns: minmax(0, 1fr); width: 100%; }
  .toolbar-left > button { width: 100%; }
  .watchlist-selector { flex-wrap: nowrap; }
  .watchlist-selector > select { flex: 1; min-width: 0; }
  .responsive-table th, .responsive-table td { padding-inline: 10px; }
  .watchlist-table :is(th, td):nth-child(2) { width: 9rem; min-width: 9rem; max-width: 9rem; }
  .trade-history-table :is(th, td):nth-child(2) { width: 7rem; min-width: 7rem; max-width: 8rem; }
  .watchlist-table .token-avatar { flex-basis: 29px; width: 29px; height: 29px; }
  .watchlist-table .dex-link { min-height: 44px; }
  .open-position-head { flex-wrap: wrap; }
  .position-pills { justify-content: flex-start; }
  .position-trailing-heading { flex-wrap: wrap; }
  .allocation-list, .signal-list { max-height: none; padding-right: 0; }
  .allocation-row, .signal-row, .open-position-card { padding: 11px; }
}

@media (max-width: 380px) {
  .activity-actions { grid-template-columns: minmax(0, 1fr); }
  .metric-label, .trade-card-label, .strategy-metrics .strategy-metric > span { min-height: 2.7em; }
  .trailing-values { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .trailing-values > :last-child { grid-column: 1 / -1; }
}

@media (prefers-reduced-transparency: reduce) {
  .glass-card { background: var(--surface); backdrop-filter: none; }
  .header, .trade-page-header { backdrop-filter: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
