/* ============================================================================
   bi.css — Marketlens Business Intelligence component library
   ----------------------------------------------------------------------------
   The config-driven BI module template (Competitors / Industry / Partners /
   Products) + Business Profile. Built ON the Huddle tokens (var(--*)) so it
   drops into the single global stylesheet. Class families match the existing
   `bi-*` structure (vanilla JS, no framework). Includes a dark theme layer.
   ========================================================================== */

/* ---- Dark theme: token overrides only (indigo primary preserved) ---------- */
[data-theme="dark"] {
  --bg-app: #0E1117; --bg-surface: #0A0D12; --bg-card: #161B23; --bg-subtle: #1B212B;
  --bg-hover: #20272F; --bg-active: #28303A; --bg-inverse: #F0F2F5;
  --text-primary: #F2F4F7; --text-secondary: #CBD2DC; --text-muted: #8A94A3; --text-disabled: #5A6472; --text-inverse: #0E1117;
  --border-subtle: #232A34; --border-default: #2F3845; --border-strong: #3C4654;
  --primary-tint: #1D2236; --primary-tint-2: #262C45;
  --gray-100: #20272F; --gray-200: #2A323D; --gray-300: #3C4654; --gray-75: #12161D;
  --success-surface: #0E2A1A; --success-border: #1C5236;
  --danger-surface: #2A1413; --danger-border: #5A211C;
  --warning-surface: #2A2009; --warning-border: #5A4410;
  --info-surface: #0E2030; --info-border: #1C3F5C;
  --focus-ring: 0 0 0 4px rgba(99,102,241,.35);
  --shadow-xs: 0 1px 2px rgba(0,0,0,.4); --shadow-sm: 0 1px 3px rgba(0,0,0,.5);
  --shadow-md: 0 4px 10px rgba(0,0,0,.5); --shadow-lg: 0 12px 20px rgba(0,0,0,.55);
}
.bi-root { background: var(--bg-surface); color: var(--text-primary); min-height: 100vh; }

/* ============ Module header (1A) ============ */
.bi-page { max-width: 1200px; margin: 0 auto; padding: 28px 32px 64px; }
.bi-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; margin-bottom: 20px; flex-wrap: wrap; }
.bi-header__titles { min-width: 0; }
.bi-title { display: flex; align-items: center; gap: 12px; font-size: var(--text-xl); font-weight: var(--weight-semibold); letter-spacing: var(--tracking-snug); color: var(--text-primary); margin: 0; }
.bi-title__icon { width: 34px; height: 34px; border-radius: var(--radius-md); background: var(--primary-tint); color: var(--primary); display: inline-flex; align-items: center; justify-content: center; }
.bi-subtitle { font-size: var(--text-sm); color: var(--text-muted); margin: 6px 0 0; }
.bi-subtitle b { color: var(--text-secondary); font-weight: var(--weight-medium); }

/* market chip */
.bi-market-chip { display: inline-flex; align-items: center; gap: 8px; margin-top: 12px; padding: 6px 12px 6px 10px; border-radius: var(--radius-pill); background: var(--primary-tint); border: 1px solid var(--indigo-200); color: var(--indigo-700); font-size: var(--text-sm); font-weight: var(--weight-semibold); cursor: pointer; transition: background-color .12s; }
[data-theme="dark"] .bi-market-chip { border-color: var(--primary-tint-2); color: var(--indigo-300); }
.bi-market-chip:hover { background: var(--primary-tint-2); }
.bi-market-chip svg { width: 15px; height: 15px; }
.bi-market-chip__hint { font-weight: var(--weight-regular); color: var(--text-muted); font-size: var(--text-xs); }
.bi-market-chip--unset { background: var(--warning-surface); border-color: var(--warning-border); color: var(--warning); }
.bi-market-chip--unset:hover { background: var(--warning-surface); filter: brightness(1.05); }

.bi-header-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* ============ Stat cards / lifecycle filter (1B) ============ */
.bi-stat-cards { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; margin-bottom: 18px; }
@media (max-width: 900px) { .bi-stat-cards { grid-template-columns: repeat(2, 1fr); } }
.bi-stat-card { text-align: left; background: var(--bg-card); border: 1px solid var(--border-subtle); border-radius: var(--radius-lg); box-shadow: var(--shadow-xs); padding: 14px 16px; display: flex; flex-direction: column; gap: 6px; position: relative; }
.bi-stat-card--clickable { cursor: pointer; transition: border-color .12s, box-shadow .12s, background-color .12s; }
.bi-stat-card--clickable:hover { border-color: var(--border-default); box-shadow: var(--shadow-sm); }
.bi-stat-card--active { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-tint); background: var(--primary-tint); }
.bi-stat-card__top { display: flex; align-items: center; gap: 7px; }
.bi-stat-card__dot { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 auto; }
.bi-stat-card__label { font-size: var(--text-sm); font-weight: var(--weight-medium); color: var(--text-muted); }
.bi-stat-card--active .bi-stat-card__label { color: var(--indigo-700); }
[data-theme="dark"] .bi-stat-card--active .bi-stat-card__label { color: var(--indigo-300); }
.bi-stat-card__value { font-size: var(--text-2xl); font-weight: var(--weight-bold); letter-spacing: var(--tracking-tight); color: var(--text-primary); line-height: 1; font-variant-numeric: tabular-nums; }
.bi-stat-card__value--text { font-size: var(--text-md); font-weight: var(--weight-semibold); }

/* ============ Filter chip rows (1C) ============ */
.bi-status-filter { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.bi-status-filter__label { font-size: var(--text-xs); font-weight: var(--weight-semibold); text-transform: uppercase; letter-spacing: var(--tracking-wide); color: var(--text-disabled); min-width: 84px; }
.bi-status-chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 11px; border-radius: var(--radius-pill); border: 1px solid var(--border-default); background: var(--bg-card); color: var(--text-secondary); font-size: var(--text-xs); font-weight: var(--weight-medium); cursor: pointer; transition: background-color .12s, border-color .12s, color .12s; }
.bi-status-chip:hover { background: var(--bg-hover); }
.bi-status-chip__n { font-weight: var(--weight-semibold); opacity: .65; }
.bi-status-chip--active { background: var(--primary); border-color: var(--primary); color: #fff; }
.bi-status-chip--active .bi-status-chip__n { opacity: .85; }
/* per-category color dots */
.bi-status-chip__cdot { width: 7px; height: 7px; border-radius: 50%; }
.bi-cat-look { background: var(--blue-500); } .bi-cat-comp { background: var(--green-500); } .bi-cat-alt { background: var(--amber-500); }
.bi-cat-direct { background: var(--indigo-600); } .bi-cat-indirect { background: var(--gray-400); }
.bi-cat-potential { background: var(--gray-400); } .bi-cat-prospect { background: var(--blue-500); } .bi-cat-active { background: var(--green-500); } .bi-cat-declined { background: var(--red-500); }

/* ---- filter bar (dropdown pills, one per dimension) ---- */
.bi-filterbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.bi-filterbar__label { display: inline-flex; align-items: center; gap: 6px; font-size: var(--text-xs); font-weight: var(--weight-semibold); text-transform: uppercase; letter-spacing: var(--tracking-wide); color: var(--text-disabled); }
.bi-filterbar__label svg { width: 14px; height: 14px; }
.bi-filterpill { position: relative; }
.bi-filterpill__btn { display: inline-flex; align-items: center; gap: 7px; height: 32px; padding: 0 10px; border-radius: var(--radius-md); border: 1px solid var(--border-default); background: var(--bg-card); color: var(--text-secondary); font-size: var(--text-sm); font-weight: var(--weight-medium); cursor: pointer; font-family: var(--font-sans); transition: background-color .12s, border-color .12s; }
.bi-filterpill__btn:hover { background: var(--bg-hover); }
.bi-filterpill__btn > svg { width: 14px; height: 14px; color: var(--text-muted); }
.bi-filterpill--active .bi-filterpill__btn { border-color: var(--indigo-200); background: var(--primary-tint); color: var(--indigo-700); }
[data-theme="dark"] .bi-filterpill--active .bi-filterpill__btn { border-color: var(--primary-tint-2); color: var(--indigo-300); }
.bi-filterpill__dot { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 auto; }
.bi-filterpill__val { font-weight: var(--weight-semibold); }
.bi-filterpill__x { display: inline-flex; margin-left: 1px; border-radius: 4px; color: var(--text-muted); }
.bi-filterpill__x:hover { color: var(--text-primary); background: var(--bg-active); }
.bi-filtermenu { position: absolute; top: 37px; left: 0; min-width: 210px; background: var(--bg-card); border: 1px solid var(--border-subtle); border-radius: var(--radius-lg); box-shadow: var(--shadow-md); padding: 6px; z-index: 30; animation: bi-pop .14s cubic-bezier(.16,.84,.44,1); }
.bi-filtermenu__item { display: flex; align-items: center; gap: 9px; width: 100%; padding: 7px 10px; border: none; background: none; border-radius: var(--radius-sm); cursor: pointer; font-size: var(--text-sm); color: var(--text-secondary); font-family: var(--font-sans); text-align: left; }
.bi-filtermenu__item:hover { background: var(--bg-hover); color: var(--text-primary); }
.bi-filtermenu__n { margin-left: auto; font-size: 11px; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.bi-filtermenu__check { color: var(--primary); display: inline-flex; }
.bi-filtermenu__check svg { width: 15px; height: 15px; }
.bi-clearall { font-size: var(--text-xs); font-weight: var(--weight-semibold); color: var(--text-link); background: none; border: none; cursor: pointer; padding: 6px 8px; }

/* ---- per-card facet dropdown (status / engagement / pipeline) ---- */
.bi-facetdd { position: relative; display: inline-block; }
.bi-facetbtn { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 9px; border-radius: var(--radius-pill); border: 1px solid var(--border-default); background: var(--bg-card); font-size: 11px; font-weight: var(--weight-semibold); cursor: pointer; font-family: var(--font-sans); transition: background-color .12s; }
.bi-facetbtn:hover { background: var(--bg-hover); }
.bi-facetbtn__dot { width: 7px; height: 7px; border-radius: 50%; flex: 0 0 auto; }
.bi-facetbtn > svg { width: 12px; height: 12px; opacity: .55; }
.bi-facetmenu { position: absolute; bottom: 32px; left: 0; min-width: 168px; background: var(--bg-card); border: 1px solid var(--border-subtle); border-radius: var(--radius-md); box-shadow: var(--shadow-md); padding: 5px; z-index: 30; animation: bi-pop .14s cubic-bezier(.16,.84,.44,1); }
.bi-facetmenu--down { bottom: auto; top: 32px; }
.bi-facetmenu__label { font-size: 10px; font-weight: var(--weight-semibold); text-transform: uppercase; letter-spacing: .04em; color: var(--text-disabled); padding: 5px 9px 3px; }
.bi-facetmenu__item { display: flex; align-items: center; gap: 9px; width: 100%; padding: 7px 9px; border: none; background: none; border-radius: 6px; cursor: pointer; font-size: var(--text-sm); color: var(--text-secondary); font-family: var(--font-sans); text-align: left; }
.bi-facetmenu__item:hover { background: var(--bg-hover); color: var(--text-primary); }
.bi-facetmenu__item .bi-facetbtn__dot { width: 8px; height: 8px; }
.bi-facetmenu__check { margin-left: auto; color: var(--primary); display: inline-flex; }
.bi-facetmenu__check svg { width: 15px; height: 15px; }

/* ============ Bulk bar (1D) ============ */
.bi-bulk-bar { display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: var(--primary-tint); border: 1px solid var(--indigo-200); border-radius: var(--radius-lg); margin-bottom: 16px; flex-wrap: wrap; }
[data-theme="dark"] .bi-bulk-bar { border-color: var(--primary-tint-2); }
.bi-bulk-bar__count { font-size: var(--text-sm); font-weight: var(--weight-semibold); color: var(--indigo-700); }
[data-theme="dark"] .bi-bulk-bar__count { color: var(--indigo-300); }
.bi-bulk-bar__sep { width: 1px; height: 22px; background: var(--indigo-200); }
[data-theme="dark"] .bi-bulk-bar__sep { background: var(--primary-tint-2); }

/* ============ Entity card (1E) ============ */
.bi-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); gap: 14px; }
@media (max-width: 820px) { .bi-list { grid-template-columns: 1fr; } }
.bi-select-wrap { position: relative; }
.bi-select-wrap__check { position: absolute; top: 14px; left: 14px; z-index: 2; }
.bi-select-wrap--on .bi-card { padding-left: 46px; }
.bi-select-wrap--selected .bi-card { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-tint); }

.bi-card { background: var(--bg-card); border: 1px solid var(--border-subtle); border-radius: var(--radius-lg); box-shadow: var(--shadow-xs); padding: 16px; display: flex; flex-direction: column; gap: 12px; cursor: pointer; transition: border-color .12s, box-shadow .12s; position: relative; }
.bi-card:hover { border-color: var(--border-default); box-shadow: var(--shadow-sm); }
.bi-card--pending { box-shadow: inset 3px 0 0 var(--warning), var(--shadow-xs); }
.bi-card--archived { opacity: .62; background: var(--bg-subtle); }
.bi-card--ours { border-color: var(--indigo-200); }
[data-theme="dark"] .bi-card--ours { border-color: var(--primary-tint-2); }

.bi-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.bi-card__name { font-size: var(--text-md); font-weight: var(--weight-semibold); color: var(--text-primary); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; flex: 1; min-width: 0; }
.bi-card__name .bi-ours-star { color: var(--indigo-600); flex: 0 0 auto; }
.bi-variant-tag { font-size: 10px; font-weight: var(--weight-semibold); text-transform: uppercase; letter-spacing: .03em; color: var(--text-muted); background: var(--gray-100); padding: 2px 7px; border-radius: var(--radius-sm); }
.bi-card-badges { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; flex: 0 1 auto; }

/* badges (validation / relationship / source) */
.bi-badge { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: var(--weight-medium); line-height: 16px; padding: 1px 8px; border-radius: var(--radius-pill); border: 1px solid transparent; white-space: nowrap; }
.bi-badge svg { width: 11px; height: 11px; }
.bi-badge__dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.bi-badge--pending { background: var(--warning-surface); color: var(--warning); border-color: var(--warning-border); }
.bi-badge--archived { background: var(--gray-100); color: var(--text-muted); }
.bi-badge--validated { background: var(--success-surface); color: var(--success); border-color: var(--success-border); }
.bi-badge--look { background: var(--blue-50); color: var(--blue-500); }
.bi-badge--comp { background: var(--green-50); color: var(--green-500); }
.bi-badge--alt  { background: var(--amber-50); color: var(--amber-500); }
[data-theme="dark"] .bi-badge--look { background: var(--info-surface); }
[data-theme="dark"] .bi-badge--comp { background: var(--success-surface); }
[data-theme="dark"] .bi-badge--alt { background: var(--warning-surface); }
.bi-badge--manual { background: var(--gray-100); color: var(--text-secondary); }
.bi-badge--fetched { background: var(--primary-tint); color: var(--indigo-700); }
[data-theme="dark"] .bi-badge--fetched { color: var(--indigo-300); }
.bi-badge--ai { background: var(--primary-tint); color: var(--indigo-700); }
[data-theme="dark"] .bi-badge--ai { color: var(--indigo-300); }
.bi-badge--feed { background: var(--info-surface); color: var(--info); }

.bi-card__url { display: inline-flex; align-items: center; gap: 6px; font-size: var(--text-xs); color: var(--text-link); text-decoration: none; }
.bi-card__url svg { width: 13px; height: 13px; color: var(--text-muted); }
.bi-card__meta { display: flex; flex-direction: column; gap: 5px; }
.bi-meta-row { display: flex; gap: 8px; font-size: var(--text-xs); }
.bi-meta-row__l { color: var(--text-muted); min-width: 90px; }
.bi-meta-row__v { color: var(--text-secondary); font-weight: var(--weight-medium); }

.bi-variants-row { display: inline-flex; align-items: center; gap: 6px; font-size: var(--text-xs); color: var(--text-secondary); background: var(--bg-subtle); border: 1px solid var(--border-subtle); border-radius: var(--radius-md); padding: 6px 10px; cursor: pointer; align-self: flex-start; }
.bi-variants-row svg { width: 13px; height: 13px; transition: transform .12s; }
.bi-variants-row--open svg.bi-chev { transform: rotate(90deg); }
.bi-variants-row b { color: var(--text-primary); }

.bi-card-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-top: 12px; border-top: 1px solid var(--border-subtle); flex-wrap: wrap; }
.bi-card-foot__left { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.bi-facet { appearance: none; font-family: var(--font-sans); font-size: 11px; font-weight: var(--weight-semibold); padding: 3px 22px 3px 9px; border-radius: var(--radius-pill); border: 1px solid var(--border-default); background: var(--bg-card); color: var(--text-secondary); cursor: pointer; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23667085' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 7px center; }
.bi-facet--live { border-color: var(--green-500); color: var(--green-500); }
.bi-facet--planned { border-color: var(--blue-500); color: var(--blue-500); }
.bi-facet--idea { border-color: var(--gray-400); color: var(--text-muted); }
.bi-foot-date { font-size: 11px; color: var(--text-muted); }
.bi-card-foot__right { display: flex; align-items: center; gap: 4px; }
.bi-iconbtn { width: 28px; height: 28px; display: inline-flex; align-items: center; justify-content: center; border: none; background: none; border-radius: var(--radius-sm); color: var(--text-muted); cursor: pointer; transition: background-color .12s, color .12s; }
.bi-iconbtn:hover { background: var(--bg-hover); color: var(--text-primary); }
.bi-iconbtn svg { width: 16px; height: 16px; }
.bi-ours-toggle.is-ours { color: var(--indigo-600); }
.bi-ours-toggle.is-ours svg { fill: currentColor; }
.bi-viewdetails { display: inline-flex; align-items: center; gap: 4px; font-size: var(--text-xs); font-weight: var(--weight-semibold); color: var(--text-link); cursor: pointer; }
.bi-viewdetails svg { width: 14px; height: 14px; }

/* tree (nested) */
.bi-tree-node--child { margin-left: 28px; position: relative; }
.bi-tree-node--child::before { content: ""; position: absolute; left: -16px; top: 28px; width: 14px; height: 1px; background: var(--border-default); }
.bi-tree-node--child::after { content: ""; position: absolute; left: -16px; top: -8px; bottom: 28px; width: 1px; background: var(--border-default); }

/* ---- view-mode toggle (grid / list) ---- */
.bi-viewtoggle { display: inline-flex; gap: 2px; background: var(--bg-subtle); border: 1px solid var(--border-subtle); border-radius: var(--radius-md); padding: 3px; }
.bi-viewtoggle button { width: 30px; height: 28px; display: inline-flex; align-items: center; justify-content: center; border: none; background: none; border-radius: 6px; color: var(--text-muted); cursor: pointer; }
.bi-viewtoggle button svg { width: 16px; height: 16px; }
.bi-viewtoggle button.on { background: var(--bg-card); color: var(--primary); box-shadow: var(--shadow-xs); }

/* ---- list (rows) view ---- */
.bi-list--rows { display: flex; flex-direction: column; gap: 8px; }
.bi-row { display: flex; align-items: center; gap: 16px; background: var(--bg-card); border: 1px solid var(--border-subtle); border-radius: var(--radius-md); box-shadow: var(--shadow-xs); padding: 11px 16px; cursor: pointer; transition: border-color .12s, box-shadow .12s; position: relative; }
.bi-row:hover { border-color: var(--border-default); box-shadow: var(--shadow-sm); }
.bi-row--pending { box-shadow: inset 3px 0 0 var(--warning), var(--shadow-xs); }
.bi-row--archived { opacity: .62; background: var(--bg-subtle); }
.bi-row--ours { border-color: var(--indigo-200); }
[data-theme="dark"] .bi-row--ours { border-color: var(--primary-tint-2); }
.bi-row__main { min-width: 0; flex: 0 0 220px; display: flex; flex-direction: column; gap: 2px; }
.bi-row__name { font-size: var(--text-sm); font-weight: var(--weight-semibold); color: var(--text-primary); display: flex; align-items: center; gap: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bi-row__name .bi-ours-star { color: var(--indigo-600); fill: currentColor; flex: 0 0 auto; }
.bi-row__url { font-size: 11px; color: var(--text-muted); display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bi-row__url svg { width: 12px; height: 12px; flex: 0 0 auto; }
.bi-row__badges { display: flex; gap: 6px; flex-wrap: wrap; flex: 1; min-width: 0; }
.bi-row__meta { font-size: var(--text-xs); color: var(--text-secondary); flex: 0 0 150px; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bi-row__date { font-size: 11px; color: var(--text-muted); flex: 0 0 120px; white-space: nowrap; }
.bi-row__actions { display: flex; align-items: center; gap: 2px; flex: 0 0 auto; }
.bi-select-wrap--on .bi-row { padding-left: 46px; }
@media (max-width: 1000px) { .bi-row__meta, .bi-row__date { display: none; } }
@media (max-width: 680px) { .bi-row { flex-wrap: wrap; } .bi-row__badges { flex-basis: 100%; } }

/* ============ Empty / loading / error (1G) ============ */
.bi-empty-state { text-align: center; max-width: 540px; margin: 24px auto; background: var(--bg-card); border: 1px dashed var(--border-default); border-radius: var(--radius-xl); padding: 48px 32px; }
.bi-empty-state__icon { width: 64px; height: 64px; border-radius: var(--radius-xl); background: var(--primary-tint); color: var(--primary); display: inline-flex; align-items: center; justify-content: center; margin-bottom: 18px; }
.bi-empty-state__icon svg { width: 30px; height: 30px; }
.bi-empty-state__title { font-size: var(--text-xl); font-weight: var(--weight-semibold); color: var(--text-primary); }
.bi-empty-state__desc { font-size: var(--text-sm); color: var(--text-muted); margin: 8px 0 0; line-height: var(--leading-md); }
.bi-empty-state__actions { display: flex; gap: 10px; justify-content: center; margin: 22px 0 0; flex-wrap: wrap; }
.bi-empty-state__hint { font-size: var(--text-xs); color: var(--text-disabled); margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--border-subtle); line-height: 1.6; }
.bi-subempty { text-align: center; padding: 40px; color: var(--text-muted); font-size: var(--text-sm); }

.bi-skeleton { background: var(--bg-card); border: 1px solid var(--border-subtle); border-radius: var(--radius-lg); padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.bi-skel-line { height: 12px; border-radius: 6px; background: linear-gradient(90deg, var(--gray-100) 25%, var(--bg-hover) 37%, var(--gray-100) 63%); background-size: 400% 100%; animation: bi-shimmer 1.3s ease infinite; }
@keyframes bi-shimmer { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }
@media (prefers-reduced-motion: reduce) { .bi-skel-line { animation: none; } }

/* small buttons reuse hds-btn; bi-btn alias for icon+label secondary in header */
.bi-btn { display: inline-flex; align-items: center; gap: 7px; height: 36px; padding: 0 13px; border-radius: var(--radius-md); font-size: var(--text-sm); font-weight: var(--weight-semibold); font-family: var(--font-sans); cursor: pointer; border: 1px solid var(--border-default); background: var(--bg-card); color: var(--text-secondary); box-shadow: var(--shadow-xs); transition: background-color .12s, color .12s; }
.bi-btn:hover { background: var(--bg-hover); color: var(--text-primary); }
.bi-btn svg { width: 16px; height: 16px; }
.bi-btn--primary { background: var(--primary); border-color: var(--primary); color: #fff; box-shadow: none; }
.bi-btn--primary:hover { background: var(--primary-hover); color: #fff; }
.bi-btn--ai { background: var(--primary-tint); border-color: var(--indigo-200); color: var(--indigo-700); }
[data-theme="dark"] .bi-btn--ai { color: var(--indigo-300); border-color: var(--primary-tint-2); }
.bi-btn--danger { color: var(--danger); border-color: var(--danger-border); }
.bi-btn--danger:hover { background: var(--danger-surface); color: var(--danger); }
.bi-btn:disabled { opacity: .5; cursor: not-allowed; }
.bi-btn--sm { height: 30px; padding: 0 10px; font-size: var(--text-xs); }
.bi-btn:focus-visible, .bi-status-chip:focus-visible, .bi-stat-card:focus-visible, .bi-card:focus-visible { outline: none; box-shadow: var(--focus-ring); }

/* ============ Detail view (1H) ============ */
.bi-detail { max-width: 780px; }
.bi-detail__back { display: inline-flex; align-items: center; gap: 6px; font-size: var(--text-sm); font-weight: var(--weight-medium); color: var(--text-muted); background: none; border: none; cursor: pointer; padding: 6px 0; margin-bottom: 14px; }
.bi-detail__back:hover { color: var(--text-primary); }
.bi-detail__back svg { width: 16px; height: 16px; }
.bi-detail-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.bi-detail__name { font-size: var(--text-2xl); font-weight: var(--weight-bold); letter-spacing: var(--tracking-tight); color: var(--text-primary); display: flex; align-items: center; gap: 10px; }
.bi-detail__name .bi-ours-star { color: var(--indigo-600); fill: currentColor; }
.bi-detail__badges { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.bi-detail-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.bi-detail-section { background: var(--bg-card); border: 1px solid var(--border-subtle); border-radius: var(--radius-lg); box-shadow: var(--shadow-xs); margin-bottom: 16px; }
.bi-detail-section__h { padding: 14px 20px; border-bottom: 1px solid var(--border-subtle); font-size: var(--text-md); font-weight: var(--weight-semibold); color: var(--text-primary); display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.bi-detail-section__body { padding: 4px 20px 14px; }
.bi-detail-row { display: flex; gap: 16px; padding: 11px 0; border-bottom: 1px solid var(--border-subtle); }
.bi-detail-row:last-child { border-bottom: none; }
.bi-detail-row__l { flex: 0 0 170px; font-size: var(--text-sm); color: var(--text-muted); }
.bi-detail-row__v { flex: 1; min-width: 0; font-size: var(--text-sm); color: var(--text-primary); font-weight: var(--weight-medium); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.bi-detail-prov { display: inline-flex; align-items: center; gap: 6px; color: var(--text-secondary); }
.bi-detail-prov svg { width: 14px; height: 14px; color: var(--text-muted); }
.bi-crumb { font-size: var(--text-xs); color: var(--text-muted); margin-bottom: 12px; display: inline-flex; align-items: center; gap: 6px; }
.bi-childrow { display: flex; align-items: center; gap: 10px; padding: 11px 0; border-bottom: 1px solid var(--border-subtle); cursor: pointer; }
.bi-childrow:last-child { border-bottom: none; }
.bi-childrow__name { font-size: var(--text-sm); font-weight: var(--weight-medium); color: var(--text-primary); flex: 1; }
.bi-childrow:hover .bi-childrow__name { color: var(--primary); }
.bi-childrow__chev { color: var(--text-muted); }

/* ---- Products: provider model ---- */
.bi-prov-pills { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.bi-prov-pills__l { font-size: var(--text-xs); color: var(--text-muted); margin-right: 2px; }
.bi-prov-pill { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: var(--weight-semibold); padding: 2px 9px; border-radius: var(--radius-pill); border: 1px solid var(--border-subtle); background: var(--bg-card); color: var(--text-secondary); cursor: pointer; }
.bi-prov-pill svg { width: 12px; height: 12px; }
.bi-prov-pill--us { background: var(--primary-tint); color: var(--indigo-700); border-color: var(--indigo-200); }
[data-theme="dark"] .bi-prov-pill--us { color: var(--indigo-300); border-color: var(--primary-tint-2); }
.bi-prov-pill--comp { color: var(--amber-500); }
.bi-prov-pill--partner { color: var(--green-500); }
.bi-prov-pill--market { color: var(--text-muted); }
.bi-prov-list { display: flex; flex-direction: column; gap: 6px; margin-top: 4px; }
.bi-prov-row { display: flex; align-items: center; gap: 10px; padding: 9px 11px; border: 1px solid var(--border-subtle); border-radius: var(--radius-md); background: var(--bg-subtle); }
.bi-prov-row--us { background: var(--primary-tint); border-color: var(--indigo-200); }
[data-theme="dark"] .bi-prov-row--us { border-color: var(--primary-tint-2); }
.bi-prov-row__icon { width: 26px; height: 26px; border-radius: 6px; display: inline-flex; align-items: center; justify-content: center; background: var(--gray-100); flex: 0 0 auto; }
.bi-prov-row__icon svg { width: 14px; height: 14px; }
.bi-prov-row__name { font-size: var(--text-sm); font-weight: var(--weight-medium); color: var(--text-primary); flex: 1; min-width: 0; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.bi-prov-row__tracked { font-size: 10px; font-weight: var(--weight-semibold); color: var(--text-link); display: inline-flex; align-items: center; gap: 2px; }
.bi-prov-row__price { font-size: var(--text-sm); font-weight: var(--weight-semibold); color: var(--text-primary); font-variant-numeric: tabular-nums; white-space: nowrap; }
.bi-prov-row__meta { font-size: 11px; color: var(--text-muted); white-space: nowrap; }
.bi-rollup-line { font-size: 11px; color: var(--text-muted); }
.bi-rollup-line b { color: var(--text-secondary); }
.bi-dup-banner { display: flex; align-items: center; gap: 10px; padding: 12px 14px; background: var(--warning-surface); border: 1px solid var(--warning-border); border-radius: var(--radius-md); margin-bottom: 16px; }
.bi-dup-banner svg { width: 18px; height: 18px; color: var(--warning); flex: 0 0 auto; }
.bi-dup-banner__t { flex: 1; font-size: var(--text-sm); color: var(--text-primary); }
.bi-dup-banner__t b { font-weight: var(--weight-semibold); }

/* ---- Business Profile page ---- */
.bp-page { max-width: 880px; margin: 0 auto; padding: 28px 32px 64px; }
.bp-lede { font-size: var(--text-sm); color: var(--text-secondary); margin: 6px 0 22px; line-height: var(--leading-md); max-width: 70ch; }
.bp-lede b { color: var(--text-primary); }
.bp-section { background: var(--bg-card); border: 1px solid var(--border-subtle); border-radius: var(--radius-lg); box-shadow: var(--shadow-xs); margin-bottom: 16px; }
.bp-section__h { padding: 15px 22px; border-bottom: 1px solid var(--border-subtle); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.bp-section__title { font-size: var(--text-md); font-weight: var(--weight-semibold); color: var(--text-primary); display: flex; align-items: center; gap: 8px; }
.bp-section__sub { font-size: var(--text-xs); color: var(--text-muted); margin-top: 3px; font-weight: var(--weight-regular); }
.bp-section__body { padding: 18px 22px; }
.bp-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.bp-full { grid-column: 1 / -1; }
@media (max-width: 680px) { .bp-grid { grid-template-columns: 1fr; } }
.bp-label { font-size: var(--text-sm); font-weight: var(--weight-medium); color: var(--text-secondary); margin-bottom: 6px; display: flex; align-items: center; gap: 6px; }
.bp-label__req { color: var(--danger); }
.bp-hint { font-size: 11px; color: var(--text-muted); margin-top: 5px; }
.bp-market { border: 1px solid var(--indigo-200); background: var(--primary-tint); border-radius: var(--radius-md); padding: 16px; }
[data-theme="dark"] .bp-market { border-color: var(--primary-tint-2); }
.bp-market__head { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.bp-market__badge { font-size: 10px; font-weight: var(--weight-bold); letter-spacing: .04em; text-transform: uppercase; color: var(--indigo-700); background: var(--bg-card); border: 1px solid var(--indigo-200); padding: 2px 8px; border-radius: var(--radius-pill); }
[data-theme="dark"] .bp-market__badge { color: var(--indigo-300); border-color: var(--primary-tint-2); }
.bp-market .bp-label { color: var(--indigo-700); }
[data-theme="dark"] .bp-market .bp-label { color: var(--indigo-300); }
.bp-chips { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.bp-chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 7px 5px 12px; border-radius: var(--radius-pill); background: var(--gray-100); color: var(--text-secondary); font-size: var(--text-sm); font-weight: var(--weight-medium); }
.bp-chip svg.bp-lead { width: 13px; height: 13px; color: var(--primary); }
.bp-chip__x { display: inline-flex; cursor: pointer; color: var(--text-muted); border-radius: 4px; }
.bp-chip__x:hover { color: var(--text-primary); background: var(--gray-200); }
.bp-chip__x svg { width: 13px; height: 13px; }
.bp-chip-add { display: inline-flex; align-items: center; gap: 4px; }
.bp-chip-add input { height: 32px; border: 1px solid var(--border-default); border-radius: var(--radius-pill); padding: 0 12px; font-size: var(--text-sm); font-family: var(--font-sans); background: var(--bg-card); color: var(--text-primary); width: 150px; }
.bp-chip-add input:focus { outline: none; border-color: var(--border-focus); box-shadow: var(--focus-ring); }
.bp-status { display: flex; align-items: center; gap: 8px; font-size: var(--text-sm); font-weight: var(--weight-medium); padding: 10px 14px; border-radius: var(--radius-md); margin-top: 14px; }
.bp-status svg { width: 16px; height: 16px; flex: 0 0 auto; }
.bp-status--ok { background: var(--success-surface); color: var(--success); border: 1px solid var(--success-border); }
.bp-status--info { background: var(--info-surface); color: var(--info); border: 1px solid var(--info-border); }

/* ============ Modals (1I/1J/1K) ============ */
.bi-scrim { position: fixed; inset: 0; background: rgba(16,24,40,.5); display: flex; align-items: flex-start; justify-content: center; padding: 44px 20px; z-index: 300; overflow-y: auto; animation: bi-fade .15s ease; }
[data-theme="dark"] .bi-scrim { background: rgba(0,0,0,.62); }
@keyframes bi-fade { from { opacity: 0; } to { opacity: 1; } }
.bi-modal { width: 100%; max-width: 540px; background: var(--bg-card); border: 1px solid var(--border-subtle); border-radius: var(--radius-lg); box-shadow: var(--shadow-xl); margin: auto; animation: bi-pop .16s cubic-bezier(.16,.84,.44,1); }
.bi-modal--wide { max-width: 680px; }
.bi-modal--sm { max-width: 420px; }
@keyframes bi-pop { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .bi-scrim, .bi-modal { animation: none; } }
.bi-modal__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 20px 22px 12px; }
.bi-modal__title { font-size: var(--text-lg); font-weight: var(--weight-semibold); color: var(--text-primary); letter-spacing: var(--tracking-snug); }
.bi-modal__sub { font-size: var(--text-sm); color: var(--text-muted); margin-top: 4px; line-height: var(--leading-sm); }
.bi-modal__body { padding: 0 22px 6px; }
.bi-modal__tabs { padding: 0 22px; }
.bi-modal__foot { display: flex; align-items: center; justify-content: flex-end; gap: 10px; padding: 16px 22px 20px; border-top: 1px solid var(--border-subtle); margin-top: 14px; }
.bi-modal__foot-l { margin-right: auto; }

.bi-form-grid { display: flex; flex-direction: column; gap: 14px; padding: 14px 0 4px; }
.bi-field__label { font-size: var(--text-sm); font-weight: var(--weight-medium); color: var(--text-secondary); margin-bottom: 6px; display: block; }
.bi-field__req { color: var(--danger); }
.bi-rel-multi { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.bi-rel-card { text-align: left; border: 1px solid var(--border-default); border-radius: var(--radius-md); padding: 10px; cursor: pointer; background: var(--bg-card); transition: border-color .12s, background-color .12s; }
.bi-rel-card__name { font-size: var(--text-sm); font-weight: var(--weight-semibold); color: var(--text-primary); }
.bi-rel-card__hint { font-size: 11px; color: var(--text-muted); margin-top: 2px; line-height: 1.4; }
.bi-rel-card--look.on { border-color: var(--blue-500); background: var(--blue-50); }
.bi-rel-card--comp.on { border-color: var(--green-500); background: var(--green-50); }
.bi-rel-card--alt.on { border-color: var(--amber-500); background: var(--amber-50); }
[data-theme="dark"] .bi-rel-card--look.on { background: var(--info-surface); }
[data-theme="dark"] .bi-rel-card--comp.on { background: var(--success-surface); }
[data-theme="dark"] .bi-rel-card--alt.on { background: var(--warning-surface); }
.bi-hint { font-size: var(--text-xs); color: var(--text-muted); background: var(--bg-subtle); border: 1px solid var(--border-subtle); border-radius: var(--radius-md); padding: 9px 11px; line-height: 1.55; }
.bi-hint b { color: var(--text-secondary); font-weight: var(--weight-semibold); }
.bi-rel-tokens { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0; }

/* fetch progress tracker */
.bi-fetch-progress { display: flex; flex-direction: column; padding: 10px 0; }
.bi-fetch-step { display: flex; align-items: center; gap: 12px; padding: 9px 0; }
.bi-fetch-step__dot { width: 26px; height: 26px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; background: var(--gray-100); color: var(--text-muted); border: 1px solid var(--border-subtle); font-size: 12px; font-weight: var(--weight-bold); }
.bi-fetch-step__dot svg { width: 14px; height: 14px; }
.bi-fetch-step--active .bi-fetch-step__dot { background: var(--primary); color: #fff; border-color: var(--primary); }
.bi-fetch-step--done .bi-fetch-step__dot { background: var(--primary-tint); color: var(--indigo-700); border-color: var(--indigo-200); }
[data-theme="dark"] .bi-fetch-step--done .bi-fetch-step__dot { color: var(--indigo-300); }
.bi-fetch-step__label { font-size: var(--text-sm); color: var(--text-muted); }
.bi-fetch-step--active .bi-fetch-step__label, .bi-fetch-step--done .bi-fetch-step__label { color: var(--text-primary); font-weight: var(--weight-medium); }

/* proposed / extracted / exists */
.bi-results-head { display: flex; align-items: center; gap: 10px; font-size: var(--text-sm); font-weight: var(--weight-semibold); color: var(--text-primary); margin: 14px 0 10px; flex-wrap: wrap; }
.bi-proposed-list { display: flex; flex-direction: column; gap: 8px; }
.bi-proposed-card { display: flex; gap: 12px; padding: 12px; border: 1px solid var(--border-subtle); border-radius: var(--radius-md); background: var(--bg-card); cursor: pointer; }
.bi-proposed-card--on { border-color: var(--indigo-200); background: var(--primary-tint); }
[data-theme="dark"] .bi-proposed-card--on { background: var(--primary-tint); }
.bi-proposed-card__main { flex: 1; min-width: 0; }
.bi-proposed-card__name { font-size: var(--text-sm); font-weight: var(--weight-semibold); color: var(--text-primary); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.bi-cat-tag { font-size: 10px; font-weight: var(--weight-semibold); text-transform: uppercase; letter-spacing: .03em; color: var(--text-muted); background: var(--gray-100); padding: 1px 7px; border-radius: var(--radius-sm); }
.bi-proposed-card__url { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.bi-proposed-card__sum { font-size: var(--text-xs); color: var(--text-secondary); margin-top: 5px; line-height: 1.5; }
.bi-proposed-card__pills { display: flex; gap: 6px; margin-top: 8px; }
.bi-conf { font-size: 11px; font-weight: var(--weight-bold); color: var(--text-secondary); white-space: nowrap; font-variant-numeric: tabular-nums; }
.bi-rel-pill { font-size: 10px; font-weight: var(--weight-semibold); padding: 2px 8px; border-radius: var(--radius-pill); border: 1px solid var(--border-default); background: var(--bg-card); color: var(--text-muted); cursor: pointer; }
.bi-rel-pill--look.on { background: var(--blue-50); color: var(--blue-500); border-color: var(--blue-100); }
.bi-rel-pill--comp.on { background: var(--green-50); color: var(--green-500); border-color: var(--green-200); }
.bi-rel-pill--alt.on { background: var(--amber-50); color: var(--amber-500); border-color: var(--amber-200); }
.bi-exists-card { display: flex; align-items: center; gap: 10px; padding: 11px 12px; border: 1px solid var(--border-subtle); border-radius: var(--radius-md); background: var(--bg-subtle); }
.bi-exists-card__check { color: var(--success); flex: 0 0 auto; }
.bi-exists-tag { margin-left: auto; font-size: 10px; font-weight: var(--weight-semibold); color: var(--text-muted); background: var(--gray-100); padding: 2px 8px; border-radius: var(--radius-pill); }

/* cross-fetch */
.bi-web-toggle { display: flex; align-items: center; gap: 10px; padding: 11px 12px; border: 1px solid var(--border-subtle); border-radius: var(--radius-md); background: var(--bg-subtle); margin: 4px 0 14px; }
.bi-web-toggle__meta { flex: 1; }
.bi-web-toggle__t { font-size: var(--text-sm); font-weight: var(--weight-medium); color: var(--text-primary); }
.bi-web-toggle__h { font-size: 11px; color: var(--text-muted); margin-top: 1px; }
.bi-cf-sources { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.bi-cf-source { text-align: left; border: 1px solid var(--border-default); border-radius: var(--radius-md); padding: 12px; cursor: pointer; background: var(--bg-card); display: flex; align-items: center; gap: 10px; transition: border-color .12s, background-color .12s; }
.bi-cf-source--on { border-color: var(--primary); background: var(--primary-tint); }
.bi-cf-source__icon { width: 32px; height: 32px; border-radius: var(--radius-md); background: var(--gray-100); color: var(--text-secondary); display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.bi-cf-source__name { font-size: var(--text-sm); font-weight: var(--weight-semibold); color: var(--text-primary); }
.bi-cf-source__date { font-size: 11px; color: var(--text-muted); }
.bi-web-badge { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; font-weight: var(--weight-semibold); padding: 3px 10px; border-radius: var(--radius-pill); }
.bi-web-badge svg { width: 12px; height: 12px; }
.bi-web-badge--live { background: var(--info-surface); color: var(--info); }
.bi-web-badge--quick { background: var(--gray-100); color: var(--text-muted); }
.bi-web-badge--none { background: var(--warning-surface); color: var(--warning); }

/* confirm / alert / share */
.bi-confirm-icon { width: 44px; height: 44px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.bi-confirm-icon--danger { background: var(--danger-surface); color: var(--danger); }
.bi-confirm-icon--primary { background: var(--primary-tint); color: var(--primary); }
.bi-checklist { display: flex; flex-direction: column; gap: 2px; max-height: 240px; overflow-y: auto; }
.bi-checkrow { display: flex; align-items: center; gap: 10px; padding: 9px 8px; border-radius: var(--radius-sm); cursor: pointer; }
.bi-checkrow:hover { background: var(--bg-hover); }
.bi-checkrow__name { font-size: var(--text-sm); color: var(--text-primary); }
.bi-checkrow__sub { font-size: 11px; color: var(--text-muted); margin-left: auto; }