:root {
  color-scheme: light;
  --bg: #f5f4ef;
  --surface: #ffffff;
  --surface-soft: #f9faf7;
  --ink: #202521;
  --muted: #697066;
  --line: #d9ded6;
  --green: #1f7a4d;
  --green-soft: #e6f3eb;
  --blue: #235d9f;
  --gold: #9a6b16;
  --red: #a33c35;
  --shadow: 0 16px 40px rgba(37, 42, 39, 0.08);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--ink);
}

[data-view-panel][hidden] {
  display: none !important;
}

.auth-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
}

.auth-shell {
  width: min(420px, calc(100% - 32px));
}

.auth-panel {
  display: grid;
  gap: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 24px;
}

.auth-panel h1 {
  margin: 0;
  font-size: 32px;
  line-height: 1;
}

.auth-error {
  margin: 0;
  border: 1px solid rgba(163, 60, 53, 0.24);
  border-radius: 6px;
  background: #fff2f0;
  color: var(--red);
  padding: 10px 12px;
  font-size: 13px;
  font-weight: 700;
}

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

button {
  cursor: pointer;
}

.shell {
  width: min(1600px, 100%);
  margin: 0 auto;
  padding: 24px;
}

.topbar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(360px, 640px);
  align-items: end;
  gap: 24px;
  padding: 8px 0 20px;
}

.brand-block h1 {
  margin: 0;
  font-size: 46px;
  font-weight: 760;
  line-height: 1;
  letter-spacing: 0;
}

.view-switch {
  display: inline-flex;
  gap: 2px;
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 3px;
}

.view-option {
  min-height: 34px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--muted);
  padding: 7px 11px;
  font-size: 13px;
  font-weight: 760;
}

.view-option.is-active {
  background: var(--green);
  color: white;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--green);
  font-size: 12px;
  font-weight: 760;
  letter-spacing: 0;
  text-transform: uppercase;
}

.connection {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 10px;
  align-items: end;
}

.field {
  display: grid;
  gap: 6px;
  min-width: 0;
}

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

.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink);
  padding: 9px 10px;
  outline: none;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(35, 93, 159, 0.14);
}

.field textarea {
  min-height: 104px;
  resize: vertical;
}

.primary-action,
.secondary-action,
.tertiary-action,
.link-action {
  min-height: 40px;
  border-radius: 6px;
  border: 1px solid transparent;
  padding: 9px 14px;
  font-weight: 760;
  text-decoration: none;
  white-space: nowrap;
}

.primary-action {
  background: var(--green);
  color: white;
}

.secondary-action,
.tertiary-action,
.link-action {
  background: var(--surface);
  border-color: var(--line);
  color: var(--ink);
}

.tertiary-action {
  min-height: 32px;
  padding: 6px 10px;
  background: var(--surface-soft);
  font-size: 12px;
}

.quick-chip {
  min-height: 40px;
  align-self: end;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  padding: 9px 14px;
  font-weight: 760;
  white-space: nowrap;
}

.quick-chip.is-active,
.quick-chip[aria-pressed="true"] {
  border-color: rgba(31, 122, 77, 0.28);
  background: var(--green);
  color: white;
}

.primary-action:hover,
.secondary-action:hover,
.tertiary-action:hover,
.link-action:hover,
.quick-chip:hover {
  filter: brightness(0.97);
}

.primary-action:disabled,
.secondary-action:disabled,
.tertiary-action:disabled,
.quick-chip:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(120px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.metric {
  min-height: 82px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 14px;
  display: grid;
  align-content: center;
  gap: 8px;
}

.metric-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 720;
}

.metric strong {
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 24px;
  line-height: 1;
}

.filters {
  display: grid;
  grid-template-columns:
    minmax(170px, 1.3fr) minmax(130px, 0.9fr) minmax(140px, 1fr)
    minmax(96px, 0.65fr) minmax(96px, 0.65fr) minmax(96px, 0.65fr)
    minmax(96px, 0.65fr) minmax(145px, 1fr);
  gap: 10px;
  align-items: end;
  margin-bottom: 12px;
}

.status-line {
  min-height: 28px;
  color: var(--muted);
  font-size: 13px;
}

.status-line[data-tone="error"] {
  color: var(--red);
}

.status-line[data-tone="ok"] {
  color: var(--green);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(360px, 0.85fr);
  gap: 18px;
  align-items: start;
}

.wallet-list,
.detail-pane {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.table-head,
.wallet-row {
  display: grid;
  grid-template-columns:
    minmax(190px, 1.5fr) minmax(110px, 0.9fr) minmax(80px, 0.6fr)
    minmax(92px, 0.7fr) minmax(76px, 0.55fr) minmax(70px, 0.5fr)
    minmax(116px, 0.85fr) minmax(96px, 0.65fr);
  gap: 10px;
  align-items: center;
}

.table-head {
  min-height: 42px;
  padding: 0 14px;
  background: var(--surface-soft);
  color: var(--muted);
  border-bottom: 1px solid var(--line);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.table-body {
  display: grid;
}

.wallet-row {
  width: 100%;
  min-height: 58px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  padding: 0 14px;
  text-align: left;
}

.wallet-row:hover {
  background: #f4f8f5;
}

.wallet-row[aria-selected="true"] {
  background: var(--green-soft);
  box-shadow: inset 4px 0 0 var(--green);
}

.sync-view {
  display: grid;
  gap: 16px;
}

.funnel-view {
  display: grid;
  gap: 16px;
}

.sync-view[hidden] {
  display: none;
}

.funnel-view[hidden] {
  display: none;
}

.sync-summary-grid {
  margin-bottom: 0;
}

.funnel-summary-grid {
  grid-template-columns: repeat(6, minmax(110px, 1fr));
  margin-bottom: 0;
}

.funnel-breakdown {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 14px;
}

.funnel-breakdown h2 {
  margin: 0 0 10px;
  font-size: 13px;
  font-weight: 800;
}

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

.count-chip {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--muted);
  padding: 5px 8px;
  font-size: 12px;
  font-weight: 760;
}

.gate2-failure-table {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.gate2-failure-row {
  min-width: 720px;
  min-height: 36px;
  display: grid;
  grid-template-columns:
    42px minmax(168px, 0.7fr) minmax(270px, 1fr) minmax(110px, 0.4fr);
  gap: 10px;
  align-items: center;
  padding: 0 10px;
  font-size: 12px;
}

.gate2-failure-row:nth-child(even) {
  background: var(--surface-soft);
}

.gate2-failure-head {
  min-height: 32px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.gate2-failure-filter {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gate2-failure-stage {
  color: var(--muted);
}

.funnel-filters {
  grid-template-columns:
    minmax(220px, 1.4fr) minmax(160px, 1fr) minmax(140px, 0.8fr)
    minmax(150px, 0.8fr) auto;
  margin-bottom: 0;
}

.sync-history {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.funnel-list {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.sync-table-head,
.sync-row {
  display: grid;
  grid-template-columns:
    minmax(190px, 1.2fr) minmax(150px, 1fr) minmax(86px, 0.55fr)
    minmax(92px, 0.6fr) minmax(92px, 0.6fr) minmax(92px, 0.6fr)
    minmax(92px, 0.6fr) minmax(98px, 0.7fr) minmax(90px, 0.6fr);
  gap: 10px;
  align-items: center;
}

.funnel-table-head,
.funnel-row {
  display: grid;
  grid-template-columns:
    minmax(190px, 1.25fr) minmax(140px, 0.85fr) minmax(92px, 0.55fr)
    minmax(82px, 0.48fr) minmax(150px, 0.95fr) minmax(112px, 0.65fr)
    minmax(112px, 0.65fr);
  gap: 10px;
  align-items: center;
}

.sync-table-head {
  min-height: 42px;
  padding: 0 14px;
  background: var(--surface-soft);
  color: var(--muted);
  border-bottom: 1px solid var(--line);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.funnel-table-head {
  min-height: 42px;
  padding: 0 14px;
  background: var(--surface-soft);
  color: var(--muted);
  border-bottom: 1px solid var(--line);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.sync-table-body {
  display: grid;
}

.funnel-table-body {
  display: grid;
}

.sync-row {
  min-height: 62px;
  border-bottom: 1px solid var(--line);
  padding: 0 14px;
  cursor: pointer;
}

.funnel-row {
  width: 100%;
  min-height: 60px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  padding: 0 14px;
  text-align: left;
}

.funnel-row:hover {
  background: #f4f8f5;
}

.funnel-row[aria-selected="true"] {
  background: var(--green-soft);
  box-shadow: inset 4px 0 0 var(--green);
}

.funnel-row[data-status-bucket="failed"] {
  box-shadow: inset 4px 0 0 var(--red);
}

.funnel-row[data-status-bucket="incomplete"],
.funnel-row[data-issue="true"] {
  background: #fffaf0;
  box-shadow: inset 4px 0 0 var(--gold);
}

.funnel-row[data-status-bucket="strong"],
.funnel-row[data-status-bucket="watched"] {
  box-shadow: inset 4px 0 0 var(--green);
}

.sync-row:hover,
.sync-row[aria-selected="true"] {
  background: #f4f8f5;
}

.sync-row:focus-visible {
  outline: 3px solid rgba(35, 93, 159, 0.28);
  outline-offset: -3px;
}

.sync-row[data-status="failed"],
.sync-row[data-status="timed-out"] {
  box-shadow: inset 4px 0 0 var(--red);
}

.sync-row[data-status="running"] {
  box-shadow: inset 4px 0 0 var(--blue);
}

.sync-run-cell {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.sync-run-status {
  width: fit-content;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  padding: 3px 7px;
  font-size: 11px;
  font-weight: 760;
}

.sync-run-meta {
  color: var(--muted);
  font-size: 12px;
}

.sync-row[data-status="completed"] .sync-run-status {
  border-color: rgba(31, 122, 77, 0.28);
  background: var(--green-soft);
  color: var(--green);
}

.sync-row[data-status="failed"] .sync-run-status,
.sync-row[data-status="timed-out"] .sync-run-status {
  border-color: rgba(163, 60, 53, 0.24);
  background: #fff2f0;
  color: var(--red);
}

.sync-row[data-status="running"] .sync-run-status {
  border-color: rgba(35, 93, 159, 0.24);
  background: #eef5ff;
  color: var(--blue);
}

.sync-source-panel,
.sync-gate2-panel {
  display: grid;
  gap: 10px;
  border-bottom: 1px solid var(--line);
  background: #fbfcfa;
  padding: 12px 14px 14px;
}

.sync-source-panel {
  box-shadow: inset 4px 0 0 var(--green);
}

.sync-gate2-panel {
  box-shadow: inset 4px 0 0 var(--red);
}

.sync-gate2-note {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.sync-source-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.sync-source-panel-header h3 {
  margin: 0;
  font-size: 13px;
  font-weight: 800;
}

.sync-source-meta,
.sync-source-warning {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 760;
}

.sync-source-meta {
  color: var(--muted);
}

.sync-source-warning {
  border-color: rgba(163, 60, 53, 0.24);
  background: #fff2f0;
  color: var(--red);
}

.sync-source-table {
  display: grid;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
}

.sync-source-row {
  min-width: 980px;
  min-height: 34px;
  display: grid;
  grid-template-columns:
    minmax(170px, 1fr) repeat(6, minmax(112px, 0.7fr));
  gap: 10px;
  align-items: center;
  padding: 0 10px;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.sync-source-row:nth-child(even) {
  background: var(--surface-soft);
}

.sync-source-head {
  min-height: 32px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.sync-source-row.has-decode-errors {
  background: #fff7f6;
}

.source-count-source-cell {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.source-count-error-cell {
  color: var(--red);
  font-weight: 800;
}

.sync-source-empty {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  padding: 14px;
  text-align: left;
}

.sync-source-error {
  border-color: rgba(163, 60, 53, 0.24);
  background: #fff2f0;
  color: var(--red);
}

.sync-block-cell,
.sync-duration-cell,
.sync-found-cell,
.sync-analyzed-cell,
.sync-gate1-cell,
.sync-gate2-fail-cell,
.sync-gate2-pass-cell,
.sync-issues-cell {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.funnel-address-cell,
.funnel-status-cell,
.funnel-tier-cell,
.funnel-gate-cell,
.funnel-outcome-cell,
.funnel-latest-cell,
.funnel-analyzed-cell {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.funnel-address-cell {
  font-family:
    "SFMono-Regular", Consolas, "Liberation Mono", ui-monospace, monospace;
  font-size: 13px;
  color: #26332b;
}

.status-pill {
  display: inline-flex;
  width: fit-content;
  max-width: 100%;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--muted);
  padding: 4px 8px;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.status-pill[data-bucket="failed"],
.status-pill[data-status="error"] {
  border-color: rgba(163, 60, 53, 0.24);
  background: #fff2f0;
  color: var(--red);
}

.status-pill[data-bucket="incomplete"],
.status-pill[data-status="trade_history_truncated"],
.status-pill[data-status="incomplete"] {
  border-color: rgba(154, 107, 22, 0.28);
  background: #fff7df;
  color: var(--gold);
}

.status-pill[data-bucket="checking"] {
  border-color: rgba(35, 93, 159, 0.24);
  background: #eef5ff;
  color: var(--blue);
}

.status-pill[data-bucket="strong"],
.status-pill[data-bucket="watched"] {
  border-color: rgba(31, 122, 77, 0.28);
  background: var(--green-soft);
  color: var(--green);
}

.address-cell,
.niche-cell,
.history-cell,
.analyzed-cell,
.latest-seen-cell {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.address-cell {
  font-family:
    "SFMono-Regular", Consolas, "Liberation Mono", ui-monospace, monospace;
  font-size: 13px;
  color: #26332b;
}

.niche-cell {
  font-weight: 760;
  text-transform: capitalize;
}

.numeric {
  font-variant-numeric: tabular-nums;
}

.pnl-positive,
.metric-positive {
  color: var(--green);
}

.pnl-negative,
.metric-negative {
  color: var(--red);
}

.load-row {
  display: flex;
  justify-content: center;
  padding: 12px;
  background: var(--surface-soft);
}

.load-row[hidden] {
  display: none;
}

.empty-state {
  padding: 32px 18px;
  color: var(--muted);
  text-align: center;
}

.detail-pane {
  position: sticky;
  top: 16px;
}

.detail-empty {
  min-height: 220px;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 8px;
  padding: 28px;
  color: var(--muted);
  text-align: center;
}

.detail-empty h2,
.detail-empty p {
  margin: 0;
}

.detail-empty h2 {
  color: var(--ink);
}

.detail-content {
  display: grid;
}

.detail-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
  padding: 18px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-soft);
}

.detail-title {
  margin: 0;
  font-size: 26px;
  line-height: 1.1;
  text-transform: capitalize;
  letter-spacing: 0;
}

.address-line {
  display: block;
  max-width: 100%;
  margin-top: 8px;
  overflow-wrap: anywhere;
  color: var(--muted);
  font-family:
    "SFMono-Regular", Consolas, "Liberation Mono", ui-monospace, monospace;
  font-size: 12px;
}

.badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}

.badge {
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  padding: 5px 8px;
  font-size: 12px;
  font-weight: 760;
}

.badge-pass {
  border-color: rgba(31, 122, 77, 0.28);
  background: var(--green-soft);
  color: var(--green);
}

.badge-fail {
  border-color: rgba(163, 60, 53, 0.24);
  background: #fff2f0;
  color: var(--red);
}

.badge-warning {
  border-color: rgba(154, 107, 22, 0.28);
  background: #fff7df;
  color: var(--gold);
}

.detail-actions {
  display: flex;
  gap: 8px;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  background: var(--line);
}

.kpi {
  min-height: 82px;
  display: grid;
  align-content: center;
  gap: 6px;
  background: var(--surface);
  padding: 14px;
}

.kpi span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 720;
}

.kpi strong {
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 22px;
}

.detail-section {
  padding: 18px;
  border-top: 1px solid var(--line);
}

.watch-control-section {
  display: grid;
  gap: 12px;
}

.watch-actions {
  flex-wrap: wrap;
}

.detail-section h3 {
  margin: 0 0 12px;
  font-size: 15px;
}

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

.evidence-item {
  border-left: 3px solid var(--green);
  background: var(--surface-soft);
  padding: 10px 12px;
}

.evidence-item span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 720;
}

.evidence-item strong {
  display: block;
  margin-top: 5px;
  overflow-wrap: anywhere;
}

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

.market-pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 40px;
}

.market-page-status,
.market-page-current {
  color: var(--muted);
  font-size: 12px;
  font-weight: 720;
  white-space: nowrap;
}

.market-page-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.market-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.market-actions {
  margin-top: 10px;
}

.market-title {
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
  font-size: 14px;
  font-weight: 760;
}

.market-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
}

.market-stats {
  min-width: 112px;
  display: grid;
  justify-items: end;
  gap: 4px;
  font-variant-numeric: tabular-nums;
}

.market-stats strong {
  font-size: 15px;
}

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

.market-trades {
  grid-column: 1 / -1;
}

.trade-panel {
  margin-top: 4px;
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.trade-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.trade-summary span {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-soft);
  padding: 5px 9px;
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
}

.trade-warning {
  margin: 0 0 10px;
  color: var(--gold);
  font-size: 12px;
  font-weight: 700;
}

.trade-table {
  display: grid;
  gap: 2px;
  overflow-x: auto;
}

.trade-row {
  min-width: 760px;
  display: grid;
  grid-template-columns: 172px 64px minmax(110px, 1fr) 92px 84px 96px 104px;
  gap: 10px;
  align-items: center;
  padding: 7px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.trade-row:nth-child(even) {
  background: var(--surface-soft);
}

.trade-head {
  color: var(--muted);
  font-weight: 760;
}

.trade-buy {
  color: var(--green);
  font-weight: 760;
}

.trade-sell {
  color: var(--red);
  font-weight: 760;
}

.strong-analysis-list {
  display: grid;
  gap: 8px;
}

.strong-analysis-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.strong-analysis-row h4,
.strong-analysis-row p {
  margin: 0;
}

.strong-analysis-row h4 {
  font-size: 14px;
  text-transform: capitalize;
}

.strong-analysis-row p {
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
}

.funnel-detail-error {
  border: 1px solid rgba(163, 60, 53, 0.24);
  border-radius: 6px;
  background: #fff2f0;
  color: var(--red);
}

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

  .detail-pane {
    position: static;
  }
}

@media (max-width: 920px) {
  .shell {
    padding: 16px;
  }

  .brand-block h1 {
    font-size: 32px;
  }

  .topbar,
  .connection,
  .filters {
    grid-template-columns: 1fr;
  }

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

  .table-head {
    display: none;
  }

  .sync-table-head {
    display: none;
  }

  .funnel-summary-grid,
  .funnel-breakdown,
  .funnel-filters {
    grid-template-columns: 1fr;
  }

  .funnel-table-head {
    display: none;
  }

  .wallet-row {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "address roi"
      "niche pnl"
      "history closed"
      "latest latest";
    gap: 5px 12px;
    min-height: 86px;
    padding: 12px 14px;
  }

  .address-cell {
    grid-area: address;
  }

  .niche-cell {
    grid-area: niche;
  }

  .roi-cell {
    grid-area: roi;
  }

  .pnl-cell {
    grid-area: pnl;
  }

  .closed-cell {
    grid-area: closed;
  }

  .history-cell {
    grid-area: history;
    color: var(--muted);
    font-size: 12px;
  }

  .win-cell {
    display: none;
  }

  .analyzed-cell,
  .latest-seen-cell {
    grid-area: latest;
    color: var(--muted);
    font-size: 12px;
  }

  .sync-row {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "run run"
      "blocks duration"
      "found analyzed"
      "gate1 gate2pass"
      "gate2fail issues";
    gap: 6px 12px;
    min-height: 122px;
    padding: 12px 14px;
  }

  .sync-run-cell {
    grid-area: run;
  }

  .sync-block-cell {
    grid-area: blocks;
  }

  .sync-duration-cell {
    grid-area: duration;
  }

  .sync-found-cell {
    grid-area: found;
  }

  .sync-analyzed-cell {
    grid-area: analyzed;
  }

  .sync-gate1-cell {
    grid-area: gate1;
  }

  .sync-gate2-fail-cell {
    grid-area: gate2fail;
  }

  .sync-gate2-pass-cell {
    grid-area: gate2pass;
  }

  .sync-issues-cell {
    grid-area: issues;
  }

  .funnel-row {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "address status"
      "outcome tier"
      "latest gate"
      "analyzed analyzed";
    gap: 6px 12px;
    min-height: 112px;
    padding: 12px 14px;
  }

  .funnel-address-cell {
    grid-area: address;
  }

  .funnel-status-cell {
    grid-area: status;
    justify-self: end;
  }

  .funnel-tier-cell {
    grid-area: tier;
    justify-self: end;
  }

  .funnel-gate-cell {
    grid-area: gate;
    justify-self: end;
  }

  .funnel-outcome-cell {
    grid-area: outcome;
  }

  .funnel-latest-cell {
    grid-area: latest;
  }

  .funnel-analyzed-cell {
    grid-area: analyzed;
    color: var(--muted);
    font-size: 12px;
  }

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

@media (max-width: 620px) {
  .summary-grid,
  .kpi-grid,
  .evidence-grid,
  .detail-header,
  .market-row {
    grid-template-columns: 1fr;
  }

  .strong-analysis-row {
    grid-template-columns: 1fr;
  }

  .detail-actions,
  .market-stats {
    justify-items: start;
  }

  .market-pager {
    align-items: stretch;
    flex-direction: column;
  }

  .market-page-controls {
    justify-content: space-between;
  }
}
