/* ============================================================
   BROWSE — master list of leads + deals
   ============================================================ */

.tool-pane--browse { overflow: auto; }
.br { padding: 20px 24px 60px; display: flex; flex-direction: column; gap: 14px; }

.br-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 16px;
  padding: 18px 22px;
  background: var(--bg-elevated);
  border: 1px solid var(--stroke);
  border-radius: var(--radius);
  position: relative;
}
.br-head::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0;
  width: 3px; background: var(--red);
}
.br-head__l { padding-left: 6px; flex: 1; min-width: 0; }
.br-head__title { font-family: var(--font-head); font-weight: 600; font-size: 24px; letter-spacing: -0.02em; margin: 4px 0 6px; }
.br-head__sub { margin: 0; font-size: 13px; color: var(--fg2); max-width: 760px; line-height: 1.55; text-wrap: pretty; }

.br-tabs { display: inline-flex; gap: 2px; padding: 3px; background: var(--bg-recessed); border-radius: var(--radius); }
.br-tab {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px;
  border-radius: var(--radius);
  font-family: var(--font-head); font-weight: 500; font-size: 13px;
  color: var(--fg2);
}
.br-tab:hover { color: var(--fg1); }
.br-tab.is-on { background: var(--bg-elevated); color: var(--fg1); box-shadow: 0 1px 3px rgba(26,26,26,0.05); }
.br-tab .t-label { background: rgba(26,26,26,0.06); padding: 1px 6px; border-radius: var(--radius); font-size: 9px; }
.br-tab.is-on .t-label { background: rgba(237,8,0,0.10); color: var(--red); }

[data-mode="banzai"] .br-head { background: var(--bg-elevated); border-color: rgba(255,255,255,0.10); }
[data-mode="banzai"] .br-tabs { background: rgba(0,0,0,0.20); }
[data-mode="banzai"] .br-tab.is-on { background: rgba(255,255,255,0.08); }

/* Filters */
.br-filters {
  background: var(--bg-elevated);
  border: 1px solid var(--stroke);
  border-radius: var(--radius);
  padding: 12px 16px;
  display: flex; flex-direction: column; gap: 12px;
}
.br-filters__row {
  display: flex; gap: 14px; flex-wrap: wrap; align-items: center;
}
.br-filters__search {
  flex: 1; min-width: 280px;
  display: flex; align-items: center; gap: 6px;
  padding: 7px 10px;
  background: var(--bg-primary);
  border: 1px solid var(--stroke);
  border-radius: var(--radius);
  color: var(--fg3);
}
.br-filters__search input {
  flex: 1; border: 0; background: transparent; outline: none;
  font-size: 13px; color: var(--fg1);
}
.br-filters__sort {
  display: inline-flex; align-items: center; gap: 6px;
}
.br-filters__sort select {
  padding: 6px 10px;
  background: var(--bg-primary);
  border: 1px solid var(--stroke);
  border-radius: var(--radius);
  font-size: 13px;
}
.br-filters__group { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.br-filters__group--score input[type="range"] { width: 110px; }
.br-chips { display: inline-flex; gap: 4px; flex-wrap: wrap; }
.br-chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px;
  border: 1px solid var(--stroke);
  background: var(--bg-primary);
  border-radius: var(--radius);
  font-size: 11px;
  color: var(--fg2);
}
.br-chip:hover { background: var(--bg-elevated); color: var(--fg1); }
.br-chip.is-on { background: var(--ink); color: #fff; border-color: var(--ink); }

[data-mode="banzai"] .br-filters { background: var(--bg-elevated); border-color: rgba(255,255,255,0.10); }
[data-mode="banzai"] .br-filters__search,
[data-mode="banzai"] .br-filters__sort select,
[data-mode="banzai"] .br-chip { background: rgba(255,255,255,0.04); border-color: rgba(255,255,255,0.10); color: rgba(255,255,255,0.85); }
[data-mode="banzai"] .br-chip.is-on { background: #fff; color: #141412; border-color: #fff; }
[data-mode="banzai"] .br-filters__search input { color: rgba(255,255,255,0.92); }

/* Aggregate strip */
.br-aggregate {
  display: flex; gap: 0;
  background: var(--bg-elevated);
  border: 1px solid var(--stroke);
  border-radius: var(--radius);
  overflow: hidden;
}
.br-aggregate > div {
  flex: 1;
  padding: 10px 16px;
  display: flex; flex-direction: column; gap: 2px;
  border-right: 1px solid var(--stroke);
}
.br-aggregate > div:last-child { border-right: 0; }
.br-aggregate strong {
  font-family: var(--font-head); font-weight: 600; font-size: 16px; letter-spacing: -0.01em;
}
.br-aggregate strong + * { margin-left: 4px; font-size: 11px; color: var(--fg3); }

[data-mode="banzai"] .br-aggregate { background: var(--bg-elevated); border-color: rgba(255,255,255,0.10); }
[data-mode="banzai"] .br-aggregate > div { border-right-color: rgba(255,255,255,0.08); }

/* Table */
.br-list {
  background: var(--bg-elevated);
  border: 1px solid var(--stroke);
  border-radius: var(--radius);
  overflow: hidden;
}
.br-bulk {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 10px 14px;
  border-bottom: 1px solid var(--stroke);
  background: var(--bg-primary);
}
.br-bulk strong {
  font-size: 12px;
  color: var(--fg1);
}
.br-bulk label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.br-bulk select {
  min-height: 30px;
  border: 1px solid var(--stroke);
  border-radius: var(--radius);
  background: var(--bg-primary);
  color: var(--fg1);
  padding: 5px 8px;
  font-size: 12px;
}
.br-table {
  display: flex; flex-direction: column;
}
.br-table__hd,
.br-row {
  display: grid;
  grid-template-columns:
    30px       /* select */
    80px       /* id */
    minmax(220px, 1.6fr) /* main */
    140px      /* stage */
    50px       /* priority dot */
    72px       /* score */
    110px      /* sites · products */
    100px      /* budget */
    72px       /* waiting */
    100px;     /* updated */
  gap: 10px;
  align-items: center;
  padding: 10px 16px;
  font-size: 12px;
}
.br-table--leads .br-table__hd,
.br-table--leads .br-row {
  grid-template-columns:
    30px      /* select */
    80px      /* id */
    minmax(180px, 1.4fr) /* name */
    100px     /* type */
    minmax(180px, 1fr) /* contact */
    130px     /* region */
    90px      /* deals */
    90px      /* sites/units */
    100px     /* pipeline */
    100px;    /* since */
}
.br-table__hd {
  background: var(--bg-recessed);
  border-bottom: 1px solid var(--stroke);
  color: var(--fg3);
}
.br-table__hd .r,
.br-row .r { text-align: right; justify-self: end; }
.br-row { border-bottom: 1px solid var(--stroke); }
.br-row:last-child { border-bottom: 0; }
.br-row:hover { background: var(--row-hover); }
.br-row.is-checked { background: rgba(26,26,26,0.025); }
.br-row--action {
  width: 100%;
  text-align: left;
}
.br-row--action:focus-visible {
  outline: 2px solid rgba(228,0,0,0.22);
  outline-offset: -2px;
}
.br-check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  min-width: 22px;
  height: 22px;
  cursor: pointer;
}
.br-check input {
  width: 15px;
  height: 15px;
  accent-color: var(--red);
}

.br-row__id { font-size: 11px; color: var(--fg2); }
.br-row__main { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.br-row__main strong { font-size: 13px; font-family: var(--font-head); font-weight: 600; }
.br-row__sub { font-size: 10px; color: var(--fg3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.br-row__pri { width: 12px; height: 12px; }
.br-row__contact { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.br-row__email { font-size: 11px; color: var(--fg3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.br-row__updated { color: var(--fg3); font-size: 11px; }
.br-row__since   { color: var(--fg3); font-size: 11px; }
.br-row__wait.is-hot { color: var(--red); font-weight: 600; }
.br-row__deals-sub { color: var(--fg3); font-size: 10px; }

.br-stage {
  font-family: var(--font-mono); font-size: 10px;
  letter-spacing: 0.06em; padding: 2px 7px;
  border-radius: var(--radius);
  background: rgba(26,26,26,0.06);
  color: var(--fg2);
  white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
  max-width: 100%;
  display: inline-block;
}
.br-stage--qualifying      { background: rgba(26,26,26,0.06); color: var(--fg2); }
.br-stage--qualified-open  { background: rgba(46,125,80,0.12); color: #1f5e3a; }
.br-stage--site-capture    { background: rgba(37,99,235,0.12); color: #1d4ed8; }
.br-stage--estimating      { background: rgba(217,138,42,0.14); color: #8c5b1a; }
.br-stage--proposal-draft  { background: rgba(237,8,0,0.10); color: var(--red); }

.br-type-pill {
  font-family: var(--font-mono); font-size: 9px;
  letter-spacing: 0.10em; padding: 2px 7px;
  border-radius: var(--radius);
  text-transform: uppercase;
}
.br-type-pill--retail   { background: rgba(46,125,80,0.12);  color: #1f5e3a; }
.br-type-pill--business { background: rgba(37,99,235,0.12);  color: #1d4ed8; }

.br-empty {
  padding: 32px;
  text-align: center;
  color: var(--fg3);
  font-size: 13px;
}

.br-pager {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px;
  background: var(--bg-elevated);
  border: 1px solid var(--stroke);
  border-radius: var(--radius);
}
.br-pager__r { display: flex; gap: 6px; }

[data-mode="banzai"] .br-list,
[data-mode="banzai"] .br-pager { background: var(--bg-elevated); border-color: rgba(255,255,255,0.10); }
[data-mode="banzai"] .br-bulk { background: rgba(0,0,0,0.18); border-bottom-color: rgba(255,255,255,0.08); }
[data-mode="banzai"] .br-bulk select { background: rgba(255,255,255,0.04); border-color: rgba(255,255,255,0.10); color: rgba(255,255,255,0.9); }
[data-mode="banzai"] .br-table__hd { background: rgba(0,0,0,0.20); border-bottom-color: rgba(255,255,255,0.10); color: rgba(255,255,255,0.55); }
[data-mode="banzai"] .br-row { border-bottom-color: rgba(255,255,255,0.06); }
[data-mode="banzai"] .br-stage { background: rgba(255,255,255,0.06); color: rgba(255,255,255,0.8); }

/* Responsive */
@media (max-width: 1280px) {
  .br-table__hd, .br-row {
    grid-template-columns: 30px 70px 1fr 110px 30px 60px 90px 90px 60px 80px;
    gap: 6px; font-size: 11px;
  }
  .br-table--leads .br-table__hd, .br-table--leads .br-row {
    grid-template-columns: 30px 70px 1fr 80px 1fr 100px 70px 80px 90px 80px;
  }
}
@media (max-width: 1000px) {
  .br-table__hd { display: none; }
  .br-bulk,
  .br-bulk label,
  .br-bulk .btn {
    width: 100%;
  }
  .br-bulk {
    align-items: stretch;
  }
  .br-row,
  .br-table--leads .br-row {
    grid-template-columns: 28px 1fr;
    gap: 4px;
    padding: 12px 14px;
  }
  .br-row > :not(.br-check) {
    grid-column: 2;
  }
  .br-row .r { text-align: left; justify-self: start; }
}
