/* BW3 P2P Market — Signed-in shell & surfaces on the Design System (S7-A).
   Tokens only: 0 raw hex colours in this stylesheet. */

/* ---------- Part 1: Research & Account classes from design-system/components/bundle.css ---------- */
.bw3-subnav {
  display: flex;
  align-items: stretch;
  gap: var(--space-1);
  height: 44px;
  padding: 0 var(--space-4);
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  flex: none;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: thin;
}
.bw3-subnav[hidden] { display: none; }
.bw3-subnav__list {
  display: flex;
  align-items: stretch;
  gap: var(--space-1);
}
.bw3-subnav .bw3-tab {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  height: 44px;
  padding: 0 var(--space-3);
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--muted);
  font: 600 var(--type-body)/var(--leading-body) var(--font-sans);
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
  flex: none;
}
.bw3-subnav .bw3-tab:hover { color: var(--text); }
.bw3-subnav .bw3-tab[aria-selected="true"] {
  border-bottom-color: var(--gold);
  color: var(--text);
}
.bw3-subnav__lock { flex: none; color: var(--muted); }

.bw3-dots { display: inline-flex; align-items: center; gap: 3px; vertical-align: middle; }
.bw3-dots i { display: block; width: 6px; height: 6px; border-radius: var(--radius-pill); background: var(--line-strong); }
.bw3-dots i.is-on { background: var(--text); }

.bw3-notes { font-size: 12px; line-height: 18px; color: var(--muted); }
.bw3-notes > summary {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  height: 24px;
  color: var(--muted);
  font-weight: 600;
  cursor: pointer;
  list-style: none;
}
.bw3-notes > summary::-webkit-details-marker { display: none; }
.bw3-notes > summary svg { width: 12px; height: 12px; }

.bw3-check { display: flex; align-items: flex-start; gap: var(--space-2); font-size: 13px; line-height: 20px; }
.bw3-check input { width: 16px; height: 16px; margin: 2px 0 0; accent-color: var(--gold); flex: none; }

.bw3-section { display: flex; flex-direction: column; gap: var(--space-3); padding: var(--space-4); }
.bw3-section + .bw3-section { border-top: 1px solid var(--line); }
.bw3-section__head { display: flex; align-items: center; gap: var(--space-2); }
.bw3-section__title { margin: 0; font-size: 14px; line-height: 20px; font-weight: 600; }

.bw3-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: var(--space-3); }
.bw3-table--two td { height: 44px; }
.bw3-cell2 { display: inline-flex; flex-direction: column; line-height: 16px; }
.bw3-cell2 > span:last-child { font-size: 12px; color: var(--muted); font-weight: 400; }
.bw3-table--two td, .bw3-table--two th { padding: 0 var(--space-2); }
.bw3-table--two td:first-child, .bw3-table--two th:first-child { padding-left: var(--space-3); }
.bw3-two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-4); }

/* ---------- Part 2: Header Account state & Research shell framing ---------- */
.bw3 .bw3-topbar #accountSecurityBtn[data-state="ready"],
.bw3 .bw3-topbar #accountSecurityBtn[data-state="setup"] {
  border-color: var(--line-strong);
  background: var(--raised);
  color: var(--text);
}
.bw3 .bw3-topbar #accountSecurityBtn[data-state="ready"]:hover,
.bw3 .bw3-topbar #accountSecurityBtn[data-state="setup"]:hover {
  background: var(--hover);
}

body.bw3.research-view {
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  font-family: var(--font-sans);
  --panel: var(--surface);
  --panel-2: var(--raised);
  --line-2: var(--line-strong);
  --border: var(--line);
  --accent: var(--gold);
  --accent-dim: var(--gold-bg);
  --buy-dim: var(--buy-bg);
  --sell-dim: var(--sell-bg);
  --warn-dim: var(--warn-bg);
  color-scheme: dark;
}
body.bw3.research-view[data-theme="light"] { color-scheme: light; }
body.bw3.research-view #ticker { display: none; }
body.bw3.research-view #workspaceTabs > #researchToggle {
  color: var(--text);
  box-shadow: inset 0 -2px 0 var(--gold);
}
body.bw3.research-view .wrap {
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
body.bw3.research-view .workspace-view.active {
  flex: 1 1 auto;
  min-height: 0;
  height: auto;
  overflow: auto;
}
body.bw3.research-view .bw3-badge,
body.bw3.research-view .vbadge,
body.bw3.research-view .best-badge,
body.bw3.research-view .status-pill,
body.bw3.research-view .pill {
  font-size: var(--type-caption);
  line-height: 16px;
}
.bw3-subnav .bw3-tab .bw3-badge {
  height: 20px;
  padding: 0 var(--space-1);
  border-color: var(--line-strong);
  color: var(--muted);
}

/* Shared pagehead padding & caveat tags in Research views */
body.bw3.research-view .bw3-pagehead {
  flex-wrap: wrap;
  row-gap: var(--space-2);
}

/* ---------- Part 3: Signed-in Offers (#viewOrders) ---------- */
.bw3 #viewOrders .side-books {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-4);
  padding: var(--space-4) !important;
  height: auto;
  min-height: 0;
  overflow: visible;
  border-top: 0;
  background: var(--bg);
}
.bw3 #viewOrders .side-book-panel {
  min-width: 0;
  min-height: 0;
  max-height: 70vh;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  overflow: hidden;
}
.bw3 #viewOrders .side-head {
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--line);
}
.bw3 #viewOrders .side-title {
  font-size: var(--type-heading);
  line-height: var(--leading-heading);
  font-weight: 600;
  color: var(--text);
}
.bw3 #viewOrders .side-sub {
  margin-top: 2px;
  font-size: var(--type-caption);
  line-height: var(--leading-caption);
  color: var(--muted);
}
.bw3 #viewOrders .side-controls select,
.bw3 #viewOrders .side-filters-extra select,
.bw3 #viewOrders .side-filters-extra input[type="text"],
.bw3 #viewOrders .fbtn {
  min-height: var(--control-sm);
  height: var(--control-sm);
  padding: 0 var(--space-3);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-control);
  background: var(--raised);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: var(--type-caption);
  font-weight: 600;
}
.bw3 #viewOrders .fbtn:hover { background: var(--hover); }
.bw3 #viewOrders .fbtn.active {
  border-color: var(--gold);
  background: var(--gold-bg);
  color: var(--gold);
}
.bw3 #viewOrders .side-filters-extra .bw3-label {
  font-size: var(--type-caption);
  line-height: var(--leading-caption);
  color: var(--muted);
}
.bw3 #viewOrders .side-stats {
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.bw3 #viewOrders .side-stat {
  padding: var(--space-2) var(--space-3);
  border-right: 1px solid var(--line);
}
.bw3 #viewOrders .side-stat .l {
  font-size: var(--type-caption);
  line-height: var(--leading-caption);
  color: var(--muted);
  text-transform: none;
  letter-spacing: 0;
  font-weight: 500;
}
.bw3 #viewOrders .side-stat .v {
  margin-top: 2px;
  font-family: var(--font-mono);
  font-size: var(--type-num);
  line-height: var(--leading-num);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: var(--text);
}
.bw3 #viewOrders .side-book-scroll {
  min-height: 260px;
  flex: 1 1 auto;
  overflow: auto;
  scroll-padding-top: var(--control-lg);
}
.bw3 #viewOrders table.book {
  font-size: var(--type-body);
  line-height: var(--leading-body);
}
.bw3 #viewOrders table.book th {
  height: var(--control-sm);
  padding: 0 var(--space-2);
  font-size: var(--type-caption);
  line-height: var(--leading-caption);
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0;
  color: var(--muted);
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.bw3 #viewOrders table.book td {
  padding: var(--space-2);
  font-family: var(--font-mono);
  font-size: var(--type-num);
  line-height: var(--leading-num);
  font-variant-numeric: tabular-nums;
  border-bottom: 1px solid var(--line);
}
.bw3 #viewOrders table.book td:nth-child(5),
.bw3 #viewOrders table.book td:nth-child(6),
.bw3 #viewOrders table.book td:last-child {
  font-family: var(--font-sans);
}
.bw3 #viewOrders table.book .paycell {
  font-size: var(--type-caption);
  color: var(--muted);
}
.bw3 #viewOrders table.book tbody tr { animation: none; }
.bw3 #viewOrders table.book tbody tr:hover { background: var(--hover); }
.bw3 #viewOrders .best-badge {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  padding: 0 var(--space-2);
  border-radius: var(--radius-sm);
  background: var(--buy-solid);
  color: var(--on-buy);
  font-family: var(--font-sans);
  font-size: var(--type-caption);
  font-weight: 700;
  letter-spacing: 0;
  margin-right: var(--space-1);
}
.bw3 #viewOrders .vbadge {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  padding: 0 var(--space-1);
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: var(--type-caption);
  font-weight: 700;
}
.bw3 #viewOrders .cmpl.warn { color: var(--warn); }
.bw3 #viewOrders .empty-note { font-size: var(--type-body); color: var(--muted); }
.bw3 #viewOrders .price-level-child td { background: var(--raised); }
.bw3 #viewOrders .trade-btn { min-height: var(--control-sm); }
@media (max-width: 1279px) {
  .bw3 #viewOrders .side-books {
    grid-template-columns: 1fr;
    height: auto;
    overflow: visible;
  }
  .bw3 #viewOrders .side-book-panel {
    height: auto;
    min-height: 0;
    max-height: none;
  }
  .bw3 #viewOrders .side-book-scroll {
    flex: none;
    min-height: 220px;
    max-height: 420px;
    scroll-padding-top: var(--control-lg);
  }
}

/* ---------- Part 4: Signed-in Merchants · All merchants (#viewMerchant.desk-all .mi-shell) ---------- */
.bw3 #viewMerchant.desk-all .mi-shell {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: var(--type-body);
  line-height: var(--leading-body);
}
.bw3 #viewMerchant.desk-all .mi-toolbar {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  padding: var(--space-3) var(--space-4);
}
.bw3 #viewMerchant.desk-all .mi-title strong {
  font-size: var(--type-heading);
  line-height: var(--leading-heading);
  font-weight: 600;
}
.bw3 #viewMerchant.desk-all .mi-title small,
.bw3 #viewMerchant.desk-all .mi-filters label > span,
.bw3 #viewMerchant.desk-all .mi-kpis small,
.bw3 #viewMerchant.desk-all .mi-kpis .mi-definition span,
.bw3 #viewMerchant.desk-all .mi-pane-head small,
.bw3 #viewMerchant.desk-all .mi-detail-head small,
.bw3 #viewMerchant.desk-all .mi-merchant-cell small,
.bw3 #viewMerchant.desk-all .mi-detail-stats small,
.bw3 #viewMerchant.desk-all .mi-section-title small,
.bw3 #viewMerchant.desk-all .mi-section-title strong,
.bw3 #viewMerchant.desk-all .mi-analytics-grid small,
.bw3 #viewMerchant.desk-all .mi-cohort-row,
.bw3 #viewMerchant.desk-all .mi-cohort-row b,
.bw3 #viewMerchant.desk-all .mi-cohort-row small,
.bw3 #viewMerchant.desk-all .mi-confidence-head,
.bw3 #viewMerchant.desk-all .mi-confidence-list > div,
.bw3 #viewMerchant.desk-all .mi-confidence-list b,
.bw3 #viewMerchant.desk-all .mi-heatmap-hours,
.bw3 #viewMerchant.desk-all .mi-heatmap-label,
.bw3 #viewMerchant.desk-all .mi-heatmap-key,
.bw3 #viewMerchant.desk-all .mi-side-summary strong,
.bw3 #viewMerchant.desk-all .mi-side-summary small,
.bw3 #viewMerchant.desk-all .mi-side-summary b,
.bw3 #viewMerchant.desk-all .mi-provenance,
.bw3 #viewMerchant.desk-all .mi-detail-empty span,
.bw3 #viewMerchant.desk-all #miEvidence,
.bw3 #viewMerchant.desk-all #miWatchNotice,
.bw3 #viewMerchant.desk-all #miCohortStatus {
  font-size: var(--type-caption);
  line-height: var(--leading-caption);
  text-transform: none;
  letter-spacing: 0;
}
.bw3 #viewMerchant.desk-all .mi-filters select,
.bw3 #viewMerchant.desk-all .mi-filters input,
.bw3 #viewMerchant.desk-all .mi-detail-actions select,
.bw3 #viewMerchant.desk-all .mi-shell .fbtn {
  min-height: var(--control-sm);
  height: var(--control-sm);
  padding: 0 var(--space-3);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-control);
  background: var(--raised);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: var(--type-caption);
  font-weight: 600;
}
.bw3 #viewMerchant.desk-all .mi-detail-actions select {
  width: auto;
  flex: none;
}
.bw3 #viewMerchant.desk-all .mi-shell .fbtn:hover:not(:disabled) { background: var(--hover); }
.bw3 #viewMerchant.desk-all .mi-shell .fbtn:disabled {
  background: var(--surface);
  border-color: var(--line-strong);
  color: var(--muted);
  opacity: 1;
  cursor: not-allowed;
}
.bw3 #viewMerchant.desk-all .mi-watch-panel,
.bw3 #viewMerchant.desk-all #miEvidence {
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
}
.bw3 #viewMerchant.desk-all .mi-watch-panel h3 {
  margin: 0 0 var(--space-1);
  font-size: var(--type-body);
  line-height: var(--leading-body);
  font-weight: 600;
  color: var(--text);
}
.bw3 #viewMerchant.desk-all .mi-watch-panel p {
  font-size: var(--type-caption);
  line-height: var(--leading-caption);
  color: var(--muted);
}
.bw3 #viewMerchant.desk-all #miWatchList {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: var(--space-2);
}
.bw3 #viewMerchant.desk-all #miWatchList button {
  min-height: var(--control-sm);
  padding: 0 var(--space-2);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-control);
  background: var(--raised);
  color: var(--text);
  font-size: var(--type-caption);
}
.bw3 #viewMerchant.desk-all .mi-kpis > div {
  background: var(--surface);
  border-color: var(--line);
}
.bw3 #viewMerchant.desk-all .mi-kpis strong {
  font-family: var(--font-mono);
  font-size: var(--type-title);
  line-height: var(--leading-title);
  font-variant-numeric: tabular-nums;
}
.bw3 #viewMerchant.desk-all .mi-ranking,
.bw3 #viewMerchant.desk-all .mi-detail {
  background: var(--surface);
}
.bw3 #viewMerchant.desk-all .mi-table {
  font-size: var(--type-body);
  font-variant-numeric: tabular-nums;
}
.bw3 #viewMerchant.desk-all .mi-table th {
  height: var(--control-sm);
  background: var(--surface);
  color: var(--muted);
  font-size: var(--type-caption);
  text-transform: none;
  letter-spacing: 0;
}
.bw3 #viewMerchant.desk-all .mi-table td {
  height: 44px;
  font-family: var(--font-mono);
  font-size: var(--type-num);
  border-bottom: 1px solid var(--line);
}
.bw3 #viewMerchant.desk-all .mi-table th:first-child,
.bw3 #viewMerchant.desk-all .mi-table td:first-child {
  font-family: var(--font-sans);
  background: var(--surface);
}
.bw3 #viewMerchant.desk-all .mi-table tbody tr:hover,
.bw3 #viewMerchant.desk-all .mi-table tbody tr.selected,
.bw3 #viewMerchant.desk-all .mi-table tbody tr:hover td:first-child,
.bw3 #viewMerchant.desk-all .mi-table tbody tr.selected td:first-child {
  background: var(--hover);
}
.bw3 #viewMerchant.desk-all .mi-merchant-open {
  min-height: var(--control-sm);
  padding: var(--space-1) 0;
  color: var(--text);
  font-family: var(--font-sans);
  font-size: var(--type-body);
  text-align: left;
}
.bw3 #viewMerchant.desk-all .mi-merchant-cell b {
  font-size: var(--type-body);
  line-height: var(--leading-body);
}
.bw3 #viewMerchant.desk-all .vbadge {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  padding: 0 var(--space-1);
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: var(--type-caption);
  font-weight: 700;
}
.bw3 #viewMerchant.desk-all .vbadge.binance {
  background: var(--venue-bin);
  color: var(--on-venue-bin);
  border-color: var(--venue-bin);
}
.bw3 #viewMerchant.desk-all .vbadge.bybit {
  background: var(--venue-byb);
  color: var(--on-venue-byb);
  border-color: var(--venue-byb);
}
.bw3 #viewMerchant.desk-all .mi-confidence {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 2px var(--space-2);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--raised);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: var(--type-caption);
  line-height: 16px;
  font-weight: 600;
  white-space: nowrap;
}
.bw3 #viewMerchant.desk-all .mi-confidence--unavailable {
  color: var(--muted);
  border-color: var(--line);
}
.bw3 #viewMerchant.desk-all .mi-detail-stats b,
.bw3 #viewMerchant.desk-all .mi-analytics-grid b,
.bw3 #viewMerchant.desk-all .mi-cohort-row b,
.bw3 #viewMerchant.desk-all .mi-confidence-list b,
.bw3 #viewMerchant.desk-all .mi-side-summary b {
  font-family: var(--font-mono);
  font-size: var(--type-caption);
  font-variant-numeric: tabular-nums;
}
.bw3 #viewMerchant.desk-all .mi-cohort-scroll th,
.bw3 #viewMerchant.desk-all .mi-cohort-scroll td {
  border-bottom: 1px solid var(--line);
  font-size: var(--type-caption);
}
.bw3 #viewMerchant.desk-all .status-pill {
  padding: 2px var(--space-2);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--raised);
  color: var(--text);
}
.bw3 #viewMerchant.desk-all .status-pill.ok { color: var(--buy); }
.bw3 #viewMerchant.desk-all .status-pill.warn { color: var(--warn); }

/* ---------- Part 5: Signed-in Escrow Preview (#viewNative) ---------- */
.bw3 #viewNative .native-panel {
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: var(--type-body);
}
.bw3 #viewNative .native-topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  gap: var(--space-3);
}
.bw3 #viewNative .native-title-group {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
}
.bw3 #viewNative .native-wallet-strip {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: var(--space-3);
}
.bw3 #viewNative .native-wallet-strip small,
.bw3 #viewNative .native-mode-notice,
.bw3 #viewNative .native-data-health small,
.bw3 #viewNative .native-data-state,
.bw3 #viewNative .native-market-stats small,
.bw3 #viewNative .native-balance-grid small,
.bw3 #viewNative .native-section-head small,
.bw3 #viewNative .native-column-note,
.bw3 #viewNative .native-table,
.bw3 #viewNative .native-table th,
.bw3 #viewNative .native-table .native-order-id,
.bw3 #viewNative .native-row-select,
.bw3 #viewNative .native-ticket-head small,
.bw3 #viewNative .native-side-switch button,
.bw3 #viewNative .native-type-tabs button,
.bw3 #viewNative .native-selected-order,
.bw3 #viewNative .native-ticket-fields label > span,
.bw3 #viewNative .native-ticket-fields label > div b,
.bw3 #viewNative .native-quote > div,
.bw3 #viewNative .native-risk-copy,
.bw3 #viewNative .native-account-tabs button,
.bw3 #viewNative .native-trade-state,
.bw3 #viewNative .native-trade-list button,
.bw3 #viewNative .native-timeline-head strong,
.bw3 #viewNative .native-approval,
.bw3 #viewNative .native-timeline-step,
.bw3 #viewNative .native-timeline-step time {
  font-size: var(--type-caption);
  line-height: var(--leading-caption);
  text-transform: none;
  letter-spacing: 0;
}
.bw3 #viewNative .native-wallet-strip b,
.bw3 #viewNative .native-market-stats b,
.bw3 #viewNative .native-table td,
.bw3 #viewNative .native-ticket-fields input,
.bw3 #viewNative .native-quote b,
.bw3 #viewNative .native-balance-grid b,
.bw3 #viewNative .native-timeline-step time {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}
.bw3 #viewNative .native-body { min-width: 0; }
.bw3 #viewNative .native-wallet-strip .hbtn {
  min-height: var(--control-sm);
  height: var(--control-sm);
  padding: 0 var(--space-3);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-control);
  background: var(--raised);
  color: var(--text);
  font-size: var(--type-caption);
  font-weight: 600;
}
.bw3 #viewNative .native-wallet-strip .hbtn:hover { background: var(--hover); }
.bw3 #viewNative .native-locked {
  min-height: 160px;
  padding: var(--space-6) var(--space-4);
  margin: var(--space-4);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: var(--surface);
  color: var(--muted);
  font-size: var(--type-body);
}
.bw3 #viewNative .native-mode-notice {
  background: var(--gold-bg);
  border-bottom: 1px solid var(--line);
  color: var(--text);
}
.bw3 #viewNative .native-mode-copy b { color: var(--gold); }
.bw3 #viewNative .native-mode-copy span,
.bw3 #viewNative .native-data-health small { color: var(--muted); }
.bw3 #viewNative .native-data-health button {
  min-width: var(--control-sm);
  width: var(--control-sm);
  height: var(--control-sm);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-control);
  background: var(--raised);
  color: var(--text);
}
.bw3 #viewNative .native-market-pane,
.bw3 #viewNative .native-ticket,
.bw3 #viewNative .native-account {
  background: var(--surface);
}
.bw3 #viewNative .native-market-stats b { font-size: var(--type-body); }
.bw3 #viewNative .native-table th {
  background: var(--surface);
  color: var(--muted);
  font-weight: 600;
}
.bw3 #viewNative .native-table td:last-child,
.bw3 #viewNative .native-table .native-payments { font-family: var(--font-sans); }
.bw3 #viewNative .native-table tbody tr:hover { background: var(--hover); }
.bw3 #viewNative .native-row-select {
  min-height: var(--control-sm);
  padding: 0 var(--space-2);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-control);
  background: var(--raised);
  color: var(--text);
  font-weight: 600;
}
.bw3 #viewNative .native-row-select:hover { background: var(--hover); }
.bw3 #viewNative .native-side-switch {
  background: var(--raised);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-control);
}
.bw3 #viewNative .native-side-switch button {
  min-height: var(--control-sm);
  height: var(--control-sm);
  color: var(--muted);
  font-weight: 600;
}
.bw3 #viewNative .native-side-switch button.active.buy {
  background: var(--buy-solid);
  color: var(--on-buy);
}
.bw3 #viewNative .native-side-switch button.active.sell {
  background: var(--sell-solid);
  color: var(--on-sell);
}
.bw3 #viewNative .native-type-tabs button {
  min-height: var(--control-sm);
  color: var(--muted);
}
.bw3 #viewNative .native-type-tabs button.active,
.bw3 #viewNative .native-account-tabs button.active {
  color: var(--text);
}
.bw3 #viewNative .native-type-tabs button.active::after,
.bw3 #viewNative .native-account-tabs button.active::after {
  background: var(--gold);
}
.bw3 #viewNative .native-selected-order {
  background: var(--gold-bg);
  color: var(--gold);
  min-height: 28px;
}
.bw3 #viewNative .native-ticket-fields label > div,
.bw3 #viewNative .native-ticket-row select {
  height: var(--control-md);
  min-height: var(--control-md);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-control);
  background: var(--raised);
  color: var(--text);
}
.bw3 #viewNative .native-ticket-fields input { font-size: var(--type-body); }
.bw3 #viewNative .native-submit {
  height: var(--control-md);
  min-height: var(--control-md);
  border: 1px solid var(--gold);
  border-radius: var(--radius-control);
  background: var(--gold-fill);
  color: var(--on-gold);
  font-size: var(--type-body);
  font-weight: 600;
}
.bw3 #viewNative .native-submit:disabled {
  background: var(--raised);
  border-color: var(--line-strong);
  color: var(--muted);
  opacity: 1;
  cursor: not-allowed;
}
.bw3 #viewNative .native-account-tabs button { min-height: var(--control-md); color: var(--muted); }
.bw3 #viewNative .native-trade-list button { min-height: var(--control-sm); }
.bw3 #viewNative .native-approval { color: var(--gold); }
.bw3 #viewNative .native-trade-state {
  background: var(--gold-bg);
  color: var(--gold);
  border: 1px solid var(--line);
}
.bw3 #viewNative .native-trade-state.released,
.bw3 #viewNative .native-trade-state.resolved {
  background: var(--buy-bg);
  color: var(--buy);
}
.bw3 #viewNative .native-trade-state.disputed {
  background: var(--sell-bg);
  color: var(--sell);
}
.bw3 #viewNative .pill {
  padding: 2px var(--space-2);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--raised);
  color: var(--text);
}
.bw3 #viewNative .pill.warn { color: var(--warn); }
.bw3 #viewNative .pill.ok { color: var(--buy); }
.bw3 #viewNative .pill.bad { color: var(--sell); }
@media (max-width: 1180px) {
  .bw3 #viewNative .native-books { grid-template-columns: 1fr; }
  .bw3 #viewNative .native-book-side + .native-book-side { border-left: 0; border-top: 1px solid var(--line); }
}

/* ---------- Part 6: Signed-in Account Security modal (#accountSecurityOverlay) ---------- */
.bw3 #accountSecurityOverlay {
  background: var(--scrim);
  font-family: var(--font-sans);
  --panel: var(--surface);
  --panel-2: var(--raised);
  --line-2: var(--line-strong);
  --border: var(--line);
  --accent: var(--gold);
  --accent-dim: var(--gold-bg);
  --buy-dim: var(--buy-bg);
  --sell-dim: var(--sell-bg);
  --warn-dim: var(--warn-bg);
}
.bw3 #accountSecurityOverlay .account-security-box {
  background: var(--surface);
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow-overlay);
  color: var(--text);
}
.bw3 #accountSecurityOverlay .account-security-box > .modal-head,
.bw3 #accountSecurityOverlay .account-security-box > #accountSecuritySummary,
.bw3 #accountSecurityOverlay .account-security-box > #accountSecurityAuthenticated {
  flex: none;
}
.bw3 #accountSecurityOverlay .account-security-summary,
.bw3 #accountSecurityOverlay .account-security-section-head span,
.bw3 #accountSecurityOverlay .account-security-section-head small,
.bw3 #accountSecurityOverlay .account-security-row-main strong,
.bw3 #accountSecurityOverlay .account-security-row-main small,
.bw3 #accountSecurityOverlay .account-security-current,
.bw3 #accountSecurityOverlay .account-security-empty,
.bw3 #accountSecurityOverlay .account-activity-help,
.bw3 #accountSecurityOverlay .account-activity-row strong,
.bw3 #accountSecurityOverlay .account-activity-row small,
.bw3 #accountSecurityOverlay .account-activity-category,
.bw3 #accountSecurityOverlay .account-trial p,
.bw3 #accountSecurityOverlay .account-trial-confirm,
.bw3 #accountSecurityOverlay .recovery-confirm,
.bw3 #accountSecurityOverlay .modal-note {
  font-size: var(--type-caption);
  line-height: var(--leading-caption);
}
.bw3 #accountSecurityOverlay .account-security-section-head span,
.bw3 #accountSecurityOverlay .account-security-row-main strong,
.bw3 #accountSecurityOverlay .account-activity-row strong {
  font-size: var(--type-body);
  line-height: var(--leading-body);
  font-weight: 600;
  color: var(--text);
}
.bw3 #accountSecurityOverlay .account-security-section-head small,
.bw3 #accountSecurityOverlay .account-security-row-main small,
.bw3 #accountSecurityOverlay .account-activity-help,
.bw3 #accountSecurityOverlay .account-activity-row small,
.bw3 #accountSecurityOverlay .account-security-empty {
  color: var(--muted);
}
.bw3 #accountSecurityOverlay .account-activity-row { border-top: 1px solid var(--line); }
.bw3 #accountSecurityOverlay .account-activity-category { color: var(--gold); font-weight: 600; }
.bw3 #accountSecurityOverlay .account-security-summary .security-state { color: var(--gold); }
.bw3 #accountSecurityOverlay .account-security-summary .security-state.ready { color: var(--buy); }
.bw3 #accountSecurityOverlay .account-security-summary b,
.bw3 #accountSecurityOverlay .account-security-row-main small,
.bw3 #accountSecurityOverlay .account-activity-row small {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}
.bw3 #accountSecurityAuthenticated .fbtn,
.bw3 #accountSecurityAuthenticated input:not([type="checkbox"]),
.bw3 #accountSecurityAuthenticated select,
.bw3 #accountSecurityAuthenticated a.fbtn {
  min-height: var(--control-sm);
  height: var(--control-sm);
  padding: 0 var(--space-3);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-control);
  background: var(--raised);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: var(--type-caption);
  font-weight: 600;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.bw3 #accountSecurityAuthenticated .fbtn:hover:not(:disabled),
.bw3 #accountSecurityAuthenticated a.fbtn:hover { background: var(--hover); }
.bw3 #accountSecurityAuthenticated .fbtn.primary {
  background: var(--raised);
  border-color: var(--line-strong);
  color: var(--text);
}
.bw3 #accountSecurityAuthenticated #accountPasskeyCreate.primary {
  background: var(--gold-fill);
  border-color: var(--gold);
  color: var(--on-gold);
}
.bw3 #accountSecurityAuthenticated .fbtn:disabled {
  background: var(--surface);
  border-color: var(--line-strong);
  color: var(--muted);
  opacity: 1;
  cursor: not-allowed;
}
.bw3 #accountSecurityOverlay #accountSecurityLogout {
  min-height: var(--control-sm);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-control);
}

/* ---------- Part 5: History card filterbar (#viewReports) ---------- */
.bw3 #viewReports .reports-controls {
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: var(--surface);
}

/* ---------- Part 6: Narrow desktop footer wrapping (900-1100px) & Phone (<= 899px) ---------- */
@media (min-width: 900px) and (max-width: 1100px) {
  .bw3 .footer-bar {
    flex-wrap: wrap;
    height: auto;
    min-height: var(--statusline);
    gap: var(--space-1) var(--space-2);
    padding: var(--space-1) var(--space-3);
  }
}
@media (max-width: 899px) {
  .bw3 #researchSubnav { display: none; }
  .bw3.research-view .bw3-pagehead {
    height: auto;
    min-height: var(--control-lg);
    padding: var(--space-2) var(--space-3);
  }
  .bw3.research-view .bw3-pagehead__sub { white-space: normal; }
  .bw3.research-view :is(button, select, input:not([type="checkbox"]), a[href], summary),
  .bw3 #accountSecurityAuthenticated :is(button, select, input:not([type="checkbox"]), a[href], summary) {
    min-height: var(--control-lg);
  }
  .bw3 #viewOrders .side-books { padding: var(--space-2) !important; gap: var(--space-3); }
  .bw3 #viewOrders .side-book-panel { min-height: 0; border: 1px solid var(--line); }
  .bw3 #viewOrders .side-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .bw3 #viewOrders .side-stat { border-bottom: 1px solid var(--line); }
  .bw3 #viewMerchant.desk-all .mi-toolbar { padding: var(--space-2) var(--space-3); }
  .bw3 #viewMerchant.desk-all .mi-search-field input { width: 100%; }
  .bw3 #viewNative .native-locked { margin: var(--space-2); padding: var(--space-4); }
  .bw3 #viewReports.reports-shell { padding: var(--space-3); }
  .bw3 #viewReports .reports-controls button,
  .bw3 #viewReports .reports-controls input { min-height: var(--control-lg); height: var(--control-lg); }
}
@media (max-width: 480px) {
  .bw3 #viewOrders .side-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
