/* ============================================================
   BlueHook Design System — COMPONENTS
   Shared, token-driven, clean-modern-SaaS component library.
   Uses ONLY .bh-* class names (never Bootstrap class names) so it is
   safe to load alongside the console's Bootstrap-override layer
   (bluehook.css). Loaded on every surface after bh-tokens.css.
   Full light + dark (via the tokens), a11y + reduced-motion built in.
   ============================================================ */

/* ---- base / a11y ---------------------------------------------------- */
.bh-app :where(button, [role="button"], a, input, select, textarea, [tabindex]):focus-visible {
    outline: 2px solid var(--bh-primary);
    outline-offset: 2px;
    border-radius: 4px;
}
.bh-app :where(button, a, .bh-btn, .bh-tab, .bh-chip) { -webkit-tap-highlight-color: transparent; }
@media (prefers-reduced-motion: reduce) {
    .bh-app *, .bh-app *::before, .bh-app *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
        scroll-behavior: auto !important;
    }
}
.bh-app .bh-mono { font-family: var(--bh-font-mono); font-variant-numeric: tabular-nums; }
.bh-app .bh-nowrap { white-space: nowrap; }
.bh-app .bh-truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bh-visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ---- page header --------------------------------------------------- */
.bh-page { padding: var(--sp-6) var(--sp-8); max-width: 1560px; margin: 0 auto; }
.bh-page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--sp-4); margin-bottom: var(--sp-6); flex-wrap: wrap; }
.bh-page-title { font-family: var(--bh-font-heading); font-size: var(--h1); font-weight: var(--fw-bold); letter-spacing: var(--ls-tight); color: var(--bh-text); line-height: var(--lh-tight); margin: 0; }
.bh-page-sub { font-size: var(--fs-sm); color: var(--bh-text-muted); margin-top: var(--sp-1); }
.bh-page-actions { display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; }
.bh-eyebrow { font-size: var(--fs-xs); font-weight: var(--fw-semibold); letter-spacing: var(--ls-caps); text-transform: uppercase; color: var(--bh-text-faint); }

/* ---- card ---------------------------------------------------------- */
.bh-card { background: var(--bh-bg-card); border: 1px solid var(--bh-border); border-radius: var(--bh-radius-lg); box-shadow: var(--bh-shadow-card); transition: box-shadow var(--bh-transition), border-color var(--bh-transition); }
.bh-card-pad { padding: var(--sp-5); }
.bh-card-head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); padding: var(--sp-4) var(--sp-5); border-bottom: 1px solid var(--bh-border-light); }
.bh-card-title { font-size: var(--fs-md); font-weight: var(--fw-semibold); color: var(--bh-text); margin: 0; display: flex; align-items: center; gap: var(--sp-2); }
.bh-card-body { padding: var(--sp-5); }
.bh-card-hover:hover { box-shadow: var(--bh-shadow); border-color: var(--bh-border-strong); }
.bh-grid { display: grid; gap: var(--sp-4); }
.bh-grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.bh-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.bh-grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

/* ---- KPI / stat ---------------------------------------------------- */
.bh-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: var(--sp-4); }
.bh-kpi { position: relative; background: linear-gradient(162deg, var(--bh-primary-light) 0%, var(--bh-bg-card) 44%); border: 1px solid var(--bh-border); border-radius: var(--bh-radius-lg); padding: var(--sp-5); overflow: hidden; box-shadow: var(--bh-shadow-card); transition: box-shadow var(--bh-transition), transform var(--bh-transition), border-color var(--bh-transition); }
.bh-kpi:hover { box-shadow: var(--bh-shadow); transform: translateY(-2px); border-color: var(--bh-border-strong); }
.bh-kpi::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--bh-primary); }
.bh-kpi.is-danger { background: linear-gradient(162deg, var(--bh-danger-light) 0%, var(--bh-bg-card) 44%); }
.bh-kpi.is-warning { background: linear-gradient(162deg, var(--bh-warning-light) 0%, var(--bh-bg-card) 44%); }
.bh-kpi.is-success { background: linear-gradient(162deg, var(--bh-success-light) 0%, var(--bh-bg-card) 44%); }
.bh-kpi.is-accent { background: linear-gradient(162deg, var(--bh-primary-light) 0%, var(--bh-bg-card) 44%); }
.bh-kpi.is-danger::before { background: var(--bh-danger); }
.bh-kpi.is-warning::before { background: var(--bh-warning); }
.bh-kpi.is-success::before { background: var(--bh-success); }
.bh-kpi.is-accent::before { background: var(--bh-accent); }
.bh-kpi-label { font-size: var(--fs-xs); font-weight: var(--fw-semibold); letter-spacing: var(--ls-wide); text-transform: uppercase; color: var(--bh-text-muted); }
.bh-kpi-value { font-family: var(--bh-font-heading); font-size: var(--fs-3xl); font-weight: var(--fw-bold); letter-spacing: var(--ls-tight); color: var(--bh-text); line-height: 1.1; margin-top: var(--sp-2); font-variant-numeric: tabular-nums; }
.bh-kpi-value small { font-size: var(--fs-lg); font-weight: var(--fw-semibold); color: var(--bh-text-muted); }
.bh-kpi-delta { font-size: var(--fs-sm); color: var(--bh-text-muted); margin-top: var(--sp-1); display: flex; align-items: center; gap: 4px; }
.bh-kpi-delta.up { color: var(--bh-success); }
.bh-kpi-delta.down { color: var(--bh-danger); }

/* ---- buttons ------------------------------------------------------- */
.bh-btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2); font-family: var(--bh-font); font-size: var(--fs-sm); font-weight: var(--fw-semibold); line-height: 1; padding: 0 14px; height: 36px; border-radius: var(--bh-radius); border: 1px solid transparent; cursor: pointer; white-space: nowrap; transition: background var(--bh-transition), border-color var(--bh-transition), color var(--bh-transition), box-shadow var(--bh-transition); text-decoration: none; }
.bh-btn:disabled, .bh-btn.is-disabled { opacity: .55; pointer-events: none; }
.bh-btn i { font-size: 13px; }
.bh-btn-primary { background: var(--bh-primary-grad); color: #fff; box-shadow: 0 1px 2px rgba(37, 99, 235, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.14); }
.bh-btn-primary:hover { background: var(--bh-primary-grad-hover); box-shadow: 0 3px 10px -2px rgba(37, 99, 235, 0.42), inset 0 1px 0 rgba(255, 255, 255, 0.14); }
.bh-btn-primary:active { box-shadow: 0 0 0 3px var(--bh-primary-glow); }
.bh-btn-ghost { background: var(--bh-bg-card); color: var(--bh-text-secondary); border-color: var(--bh-border); }
.bh-btn-ghost:hover { background: var(--bh-bg-elevated); border-color: var(--bh-border-strong); color: var(--bh-text); }
.bh-btn-soft { background: var(--bh-primary-weak); color: var(--bh-primary); }
.bh-btn-soft:hover { background: var(--bh-primary-light); }
.bh-btn-danger { background: var(--bh-danger); color: #fff; }
.bh-btn-danger:hover { filter: brightness(.94); }
.bh-btn-danger-soft { background: var(--bh-danger-light); color: var(--bh-danger); }
.bh-btn-sm { height: 30px; font-size: var(--fs-xs); padding: 0 10px; }
.bh-btn-lg { height: 42px; font-size: var(--fs-md); padding: 0 20px; }
.bh-btn-icon { width: 36px; height: 36px; padding: 0; }
.bh-btn-icon.bh-btn-sm { width: 30px; height: 30px; }
.bh-btn-block { width: 100%; }

/* ---- badges / pills / chips / tags --------------------------------- */
.bh-badge { display: inline-flex; align-items: center; gap: 5px; font-size: var(--fs-xs); font-weight: var(--fw-semibold); line-height: 1; padding: 4px 9px; border-radius: var(--bh-radius-pill); background: var(--bh-bg-elevated); color: var(--bh-text-secondary); border: 1px solid transparent; white-space: nowrap; }
.bh-badge.is-primary { background: var(--bh-primary-weak); color: var(--bh-primary); }
.bh-badge.is-success { background: var(--bh-success-light); color: var(--bh-success); }
.bh-badge.is-warning { background: var(--bh-warning-light); color: var(--bh-warning); }
.bh-badge.is-danger  { background: var(--bh-danger-light);  color: var(--bh-danger); }
.bh-badge.is-info    { background: var(--bh-info-light);    color: var(--bh-info); }
.bh-badge.is-neutral { background: var(--bh-bg-elevated); color: var(--bh-text-muted); }
.bh-badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.bh-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--bh-text-faint); display: inline-block; }
.bh-dot.is-success { background: var(--bh-success); box-shadow: 0 0 0 3px var(--bh-success-light); }
.bh-dot.is-danger { background: var(--bh-danger); box-shadow: 0 0 0 3px var(--bh-danger-light); }
.bh-dot.is-warning { background: var(--bh-warning); box-shadow: 0 0 0 3px var(--bh-warning-light); }
.bh-chip { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-sm); font-weight: var(--fw-medium); padding: 5px 10px; border-radius: var(--bh-radius); background: var(--bh-bg-elevated); color: var(--bh-text-secondary); border: 1px solid var(--bh-border); cursor: pointer; transition: all var(--bh-transition); }
.bh-chip:hover { border-color: var(--bh-primary-line); color: var(--bh-primary); }
.bh-chip.is-active { background: var(--bh-primary-weak); border-color: var(--bh-primary-line); color: var(--bh-primary); }
.bh-chip .x { opacity: .55; cursor: pointer; }
.bh-chip .x:hover { opacity: 1; }

/* ---- tabs / segmented ---------------------------------------------- */
.bh-tabs { display: inline-flex; align-items: center; gap: 2px; border-bottom: 1px solid var(--bh-border); }
.bh-tab { appearance: none; background: none; border: 0; font-family: var(--bh-font); font-size: var(--fs-sm); font-weight: var(--fw-medium); color: var(--bh-text-muted); padding: 10px 14px; cursor: pointer; position: relative; display: inline-flex; align-items: center; gap: 7px; transition: color var(--bh-transition); }
.bh-tab:hover { color: var(--bh-text); }
.bh-tab.is-active { color: var(--bh-primary); }
.bh-tab.is-active::after { content: ""; position: absolute; left: 8px; right: 8px; bottom: -1px; height: 2px; border-radius: 2px 2px 0 0; background: var(--bh-primary); }
.bh-tab .cnt { font-size: var(--fs-xs); font-weight: var(--fw-semibold); background: var(--bh-bg-elevated); color: var(--bh-text-muted); border-radius: var(--bh-radius-pill); padding: 1px 7px; }
.bh-tab.is-active .cnt { background: var(--bh-primary-weak); color: var(--bh-primary); }
.bh-seg { display: inline-flex; background: var(--bh-bg-elevated); border: 1px solid var(--bh-border); border-radius: var(--bh-radius); padding: 3px; gap: 2px; }
.bh-seg button { appearance: none; background: none; border: 0; font: inherit; font-size: var(--fs-sm); font-weight: var(--fw-medium); color: var(--bh-text-muted); padding: 5px 12px; border-radius: calc(var(--bh-radius) - 3px); cursor: pointer; transition: all var(--bh-transition); }
.bh-seg button.is-active { background: var(--bh-bg-card); color: var(--bh-text); box-shadow: var(--bh-shadow-sm); }

/* ---- tables -------------------------------------------------------- */
.bh-table-wrap { overflow-x: auto; border: 1px solid var(--bh-border); border-radius: var(--bh-radius-lg); background: var(--bh-bg-card); }
.bh-table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
.bh-table caption { text-align: left; padding: var(--sp-3) var(--sp-4); font-size: var(--fs-md); font-weight: var(--fw-semibold); color: var(--bh-text); }
.bh-table thead th { text-align: left; font-size: var(--fs-xs); font-weight: var(--fw-semibold); letter-spacing: var(--ls-wide); text-transform: uppercase; color: var(--bh-text-muted); background: var(--bh-bg-elevated); padding: 10px 14px; border-bottom: 1px solid var(--bh-border); white-space: nowrap; position: sticky; top: 0; z-index: 1; }
.bh-table tbody td { padding: 11px 14px; border-bottom: 1px solid var(--bh-border-light); color: var(--bh-text-secondary); vertical-align: middle; }
.bh-table tbody tr:last-child td { border-bottom: 0; }
.bh-table tbody tr { transition: background var(--bh-transition); }
.bh-table.is-hover tbody tr:hover { background: var(--bh-bg-table-hover); }
.bh-table.is-striped tbody tr:nth-child(even) { background: var(--bh-bg-table-stripe); }
.bh-table th.sortable { cursor: pointer; user-select: none; }
.bh-table th.sortable::after { content: "\f0dc"; font-family: FontAwesome; opacity: .3; margin-left: 6px; font-size: 10px; }
.bh-table th.sortable.asc::after { content: "\f0de"; opacity: .8; }
.bh-table th.sortable.desc::after { content: "\f0dd"; opacity: .8; }
.bh-td-strong { color: var(--bh-text); font-weight: var(--fw-medium); }

/* ---- forms --------------------------------------------------------- */
.bh-field { display: flex; flex-direction: column; gap: 6px; }
.bh-label { font-size: var(--fs-sm); font-weight: var(--fw-medium); color: var(--bh-text-secondary); }
.bh-hint { font-size: var(--fs-xs); color: var(--bh-text-muted); }
.bh-input, .bh-select, .bh-textarea { font-family: var(--bh-font); font-size: var(--fs-sm); color: var(--bh-text); background: var(--bh-bg-input); border: 1px solid var(--bh-border); border-radius: var(--bh-radius); padding: 0 12px; height: 38px; width: 100%; transition: border-color var(--bh-transition), box-shadow var(--bh-transition); }
.bh-textarea { height: auto; min-height: 96px; padding: 10px 12px; resize: vertical; line-height: var(--lh-normal); }
.bh-input:focus, .bh-select:focus, .bh-textarea:focus { outline: none; border-color: var(--bh-primary-line); box-shadow: 0 0 0 3px var(--bh-primary-glow); }
.bh-input::placeholder, .bh-textarea::placeholder { color: var(--bh-text-faint); }
.bh-select { appearance: none; 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='%235D6B84' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 32px; }
.bh-input-group { position: relative; display: flex; align-items: center; }
.bh-input-group > i { position: absolute; left: 12px; color: var(--bh-text-faint); font-size: 13px; pointer-events: none; }
.bh-input-group .bh-input { padding-left: 34px; }
.bh-switch { position: relative; display: inline-block; width: 38px; height: 22px; }
.bh-switch input { opacity: 0; width: 0; height: 0; }
.bh-switch .track { position: absolute; inset: 0; background: var(--bh-border-strong); border-radius: 999px; transition: background var(--bh-transition); cursor: pointer; }
.bh-switch .track::before { content: ""; position: absolute; left: 3px; top: 3px; width: 16px; height: 16px; background: #fff; border-radius: 50%; transition: transform var(--bh-transition); box-shadow: var(--bh-shadow-sm); }
.bh-switch input:checked + .track { background: var(--bh-primary); }
.bh-switch input:checked + .track::before { transform: translateX(16px); }

/* ---- modal --------------------------------------------------------- */
.bh-modal-scrim { position: fixed; inset: 0; background: rgba(11, 21, 36, .48); backdrop-filter: blur(2px); z-index: var(--z-modal); display: flex; align-items: center; justify-content: center; padding: var(--sp-5); opacity: 0; pointer-events: none; transition: opacity var(--bh-transition); }
.bh-modal-scrim.is-open { opacity: 1; pointer-events: auto; }
.bh-modal { background: var(--bh-bg-modal); border: 1px solid var(--bh-border); border-radius: var(--bh-radius-xl); box-shadow: var(--bh-shadow-lg); width: 100%; max-width: 520px; max-height: 88vh; display: flex; flex-direction: column; transform: translateY(8px) scale(.99); transition: transform var(--bh-transition-slow); }
.bh-modal-scrim.is-open .bh-modal { transform: none; }
.bh-modal-head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); padding: var(--sp-4) var(--sp-5); border-bottom: 1px solid var(--bh-border-light); }
.bh-modal-title { font-size: var(--fs-md); font-weight: var(--fw-semibold); color: var(--bh-text); margin: 0; }
.bh-modal-body { padding: var(--sp-5); overflow-y: auto; }
.bh-modal-foot { display: flex; align-items: center; justify-content: flex-end; gap: var(--sp-2); padding: var(--sp-4) var(--sp-5); border-top: 1px solid var(--bh-border-light); }
.bh-modal-x { appearance: none; background: none; border: 0; color: var(--bh-text-faint); font-size: 18px; cursor: pointer; width: 30px; height: 30px; border-radius: var(--bh-radius-sm); display: inline-flex; align-items: center; justify-content: center; }
.bh-modal-x:hover { background: var(--bh-bg-elevated); color: var(--bh-text); }

/* ---- drawer (slide-over) ------------------------------------------- */
.bh-drawer-scrim { position: fixed; inset: 0; background: rgba(11, 21, 36, .40); z-index: var(--z-drawer); opacity: 0; pointer-events: none; transition: opacity var(--bh-transition); }
.bh-drawer-scrim.is-open { opacity: 1; pointer-events: auto; }
.bh-drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(560px, 94vw); background: var(--bh-bg-card); border-left: 1px solid var(--bh-border); box-shadow: var(--bh-shadow-lg); z-index: var(--z-drawer); display: flex; flex-direction: column; transform: translateX(100%); transition: transform var(--bh-transition-slow) var(--bh-ease-out); }
.bh-drawer.is-open { transform: none; }
.bh-drawer-head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); padding: var(--sp-4) var(--sp-5); border-bottom: 1px solid var(--bh-border-light); }
.bh-drawer-body { padding: var(--sp-5); overflow-y: auto; flex: 1; }
.bh-drawer-foot { padding: var(--sp-4) var(--sp-5); border-top: 1px solid var(--bh-border-light); display: flex; gap: var(--sp-2); justify-content: flex-end; }

/* ---- toast --------------------------------------------------------- */
.bh-toasts { position: fixed; bottom: var(--sp-5); right: var(--sp-5); z-index: var(--z-toast); display: flex; flex-direction: column; gap: var(--sp-2); pointer-events: none; }
.bh-toast { pointer-events: auto; display: flex; align-items: flex-start; gap: 10px; min-width: 260px; max-width: 380px; background: var(--bh-bg-card); border: 1px solid var(--bh-border); border-left: 3px solid var(--bh-primary); border-radius: var(--bh-radius); box-shadow: var(--bh-shadow-lg); padding: 12px 14px; font-size: var(--fs-sm); color: var(--bh-text-secondary); transform: translateX(12px); opacity: 0; transition: transform var(--bh-transition-slow) var(--bh-ease-out), opacity var(--bh-transition); }
.bh-toast.is-in { transform: none; opacity: 1; }
.bh-toast.is-success { border-left-color: var(--bh-success); }
.bh-toast.is-danger { border-left-color: var(--bh-danger); }
.bh-toast.is-warning { border-left-color: var(--bh-warning); }
.bh-toast i { font-size: 14px; margin-top: 1px; }
.bh-toast.is-success i { color: var(--bh-success); }
.bh-toast.is-danger i { color: var(--bh-danger); }
.bh-toast.is-warning i { color: var(--bh-warning); }

/* ---- empty / error states ------------------------------------------ */
.bh-empty { text-align: center; padding: var(--sp-12) var(--sp-6); color: var(--bh-text-muted); }
.bh-empty-icon { width: 52px; height: 52px; border-radius: var(--bh-radius-lg); background: var(--bh-bg-elevated); color: var(--bh-text-faint); display: inline-flex; align-items: center; justify-content: center; font-size: 22px; margin-bottom: var(--sp-3); }
.bh-empty-title { font-size: var(--fs-md); font-weight: var(--fw-semibold); color: var(--bh-text); }
.bh-empty-sub { font-size: var(--fs-sm); color: var(--bh-text-muted); margin-top: 4px; max-width: 380px; margin-inline: auto; }
.bh-banner { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: var(--bh-radius); font-size: var(--fs-sm); border: 1px solid var(--bh-border); }
.bh-banner.is-danger { background: var(--bh-danger-light); border-color: transparent; color: var(--bh-danger); }
.bh-banner.is-warning { background: var(--bh-warning-light); border-color: transparent; color: var(--bh-warning); }
.bh-banner.is-info { background: var(--bh-info-light); border-color: transparent; color: var(--bh-info); }

/* ---- skeleton / spinner / progress --------------------------------- */
.bh-skel { position: relative; overflow: hidden; background: var(--bh-bg-elevated); border-radius: var(--bh-radius-sm); }
.bh-skel::after { content: ""; position: absolute; inset: 0; transform: translateX(-100%); background: linear-gradient(90deg, transparent, rgba(255,255,255,.55), transparent); animation: bh-shimmer 1.4s infinite; }
body.bh-app.dark-mode .bh-skel::after { background: linear-gradient(90deg, transparent, rgba(255,255,255,.06), transparent); }
@keyframes bh-shimmer { 100% { transform: translateX(100%); } }
.bh-skel-line { height: 12px; margin: 6px 0; }
.bh-skel-line.w-60 { width: 60%; } .bh-skel-line.w-40 { width: 40%; } .bh-skel-line.w-80 { width: 80%; }
.bh-spinner { width: 16px; height: 16px; border: 2px solid var(--bh-border-strong); border-top-color: var(--bh-primary); border-radius: 50%; animation: bh-spin .7s linear infinite; display: inline-block; }
@keyframes bh-spin { to { transform: rotate(360deg); } }
.bh-progress { height: 8px; background: var(--bh-bg-elevated); border-radius: 999px; overflow: hidden; }
.bh-progress > i { display: block; height: 100%; background: var(--bh-primary); border-radius: 999px; transition: width var(--bh-transition-slow); }
.bh-progress.is-success > i { background: var(--bh-success); }
.bh-progress.is-warning > i { background: var(--bh-warning); }

/* ---- chart frame (consumed by bh-charts.js) ------------------------- */
.bh-chart { position: relative; width: 100%; }
.bh-chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.bh-chart-legend { display: flex; flex-wrap: wrap; gap: var(--sp-4); margin-top: var(--sp-3); font-size: var(--fs-xs); color: var(--bh-text-muted); }
.bh-chart-legend span { display: inline-flex; align-items: center; gap: 6px; }
.bh-chart-legend i { width: 9px; height: 9px; border-radius: 2px; display: inline-block; }
.bh-chart-tip { position: absolute; pointer-events: none; background: var(--bh-navy); color: #fff; font-size: var(--fs-xs); padding: 6px 9px; border-radius: var(--bh-radius-sm); box-shadow: var(--bh-shadow-lg); transform: translate(-50%, -120%); white-space: nowrap; opacity: 0; transition: opacity var(--bh-transition); z-index: var(--z-tooltip); }
.bh-chart-tip.is-in { opacity: 1; }

/* ---- misc utilities ------------------------------------------------ */
.bh-divider { height: 1px; background: var(--bh-border-light); margin: var(--sp-4) 0; }
.bh-rowk { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); padding: 9px 0; border-bottom: 1px solid var(--bh-border-light); font-size: var(--fs-sm); }
.bh-rowk:last-child { border-bottom: 0; }
.bh-rowk .k { color: var(--bh-text-muted); }
.bh-rowk .v { color: var(--bh-text); font-weight: var(--fw-semibold); font-variant-numeric: tabular-nums; }
.bh-scroll::-webkit-scrollbar { width: 8px; height: 8px; }
.bh-scroll::-webkit-scrollbar-thumb { background: var(--bh-border-strong); border-radius: 4px; }

/* ---- responsive ---------------------------------------------------- */
@media (max-width: 1024px) {
    .bh-grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .bh-grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
    .bh-page { padding: var(--sp-4); }
    .bh-grid-2, .bh-grid-3, .bh-grid-4 { grid-template-columns: 1fr; }
    .bh-page-head { flex-direction: column; align-items: stretch; }
}

/* ---- print / board-ready PDF report ---------------------------------
   The custom pages (analytics, compliance, overview…) each have an
   "Export report" button that calls window.print(). On screen the
   branded header/footer injected by bh-shell.js stay hidden; when
   printing we hide the app chrome (rail + topbar), flatten cards, and
   reveal a clean letterhead + confidentiality footer. Produces a
   board-ready PDF via the browser's Save-as-PDF with no app furniture. */
.bh-print-header, .bh-print-footer { display: none; }

@media print {
    @page { margin: 14mm 14mm 16mm; }
    html, body { background: #fff !important; }
    body.bh-app { --bh-bg-body: #fff; }
    /* hide the app chrome + anything explicitly marked no-print */
    .bhs-rail, .bhs-top, .bh-no-print,
    .bh-page-head .bh-btn, .bh-tabs, .bh-segmented { display: none !important; }
    /* main content spans the full page, no offset for the (hidden) rail */
    .bhs-main { margin: 0 !important; padding: 0 !important; max-width: none !important; width: 100% !important; }
    .bh-page { padding: 0 !important; }

    /* branded letterhead + footer become visible */
    .bh-print-header {
        display: flex !important; align-items: baseline; justify-content: space-between;
        gap: 16px; padding: 0 0 12px; margin: 0 0 18px;
        border-bottom: 2px solid #2563EB;
    }
    .bh-print-brand { font-size: 20px; font-weight: 700; color: #0E1A2B; letter-spacing: -0.02em; }
    .bh-print-brand span { color: #2563EB; }
    .bh-print-brand em { font-style: normal; font-weight: 500; color: #5D6B84; font-size: 15px; margin-left: 8px; }
    .bh-print-meta { font-size: 12px; color: #5D6B84; text-align: right; }
    .bh-print-meta .bh-print-date { display: block; }
    .bh-print-footer {
        display: block !important; position: fixed; bottom: 0; left: 0; right: 0;
        padding-top: 6px; border-top: 1px solid #E4E9F2;
        font-size: 10px; color: #8794AB; text-align: center;
    }

    /* flatten interactive surfaces into clean print blocks */
    .bh-card, .bh-kpi, .bh-panel {
        box-shadow: none !important; background: #fff !important;
        border: 1px solid #E4E9F2 !important;
        break-inside: avoid; page-break-inside: avoid;
    }
    .bh-kpi { background-image: none !important; }
    h1, h2, h3, .bh-card-title { break-after: avoid; page-break-after: avoid; }
    table { break-inside: auto; }
    tr, img, svg, .bh-chart { break-inside: avoid; page-break-inside: avoid; }
    a[href]::after { content: ""; } /* no URL clutter */
    * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
