/* Institutional back office (team console + master admin).
   The public site wears the team's brand. The back office deliberately does not: it uses one fixed, sober palette
   (navy, slate, white, hairline rules, system fonts, tabular figures), the way a bank's back office looks the same
   for every branch. The team's own colour survives only as a small mark beside its name: --bh-brand-mark is resolved
   at :root from the team's tokens, before .bh-console overrides them.
   Colours are defined once here as tokens (architecture §9d); nothing below hard-codes a colour outside :root. */

:root {
    --bh-brand-mark: var(--bh-primary);
    --bh-inst-navy: #0b2545;
    --bh-inst-navy-deep: #071a33;
    --bh-inst-steel: #1f4e8c;          /* links and primary actions; white text on it: 8.0:1 */
    --bh-inst-steel-bright: #1d4ed8;
    --bh-inst-surface: #f3f5f8;
    --bh-inst-raised: #ffffff;
    --bh-inst-ink: #111c2d;
    --bh-inst-muted: #4f5b6b;          /* on surface: 6.6:1 */
    --bh-inst-rule: #d6dce4;
    --bh-inst-on-navy: #e8edf4;
    --bh-inst-on-navy-faint: rgba(255, 255, 255, .12);
    --bh-inst-on-strong: #ffffff;
    --bh-inst-secure: #1f7a4d;         /* on white: 5.4:1 */
    --bh-inst-shadow: rgba(17, 28, 45, .18);
    --bh-inst-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.bh-console {
    --bh-primary: var(--bh-inst-steel);
    --bh-primary-deep: var(--bh-inst-navy);
    --bh-primary-bright: var(--bh-inst-steel-bright);
    --bh-accent: var(--bh-inst-steel);
    --bh-surface: var(--bh-inst-surface);
    --bh-surface-raised: var(--bh-inst-raised);
    --bh-ink: var(--bh-inst-ink);
    --bh-ink-muted: var(--bh-inst-muted);
    --bh-on-primary: var(--bh-inst-on-strong);
    --bh-font-heading: var(--bh-inst-font);
    --bh-font-body: var(--bh-inst-font);
    --bh-font-quote: var(--bh-inst-font);
    --bh-radius: 4px;
    --bh-button-radius: 4px;
    --bh-hairline: var(--bh-inst-rule);
    background: var(--bh-inst-surface);
    color: var(--bh-inst-ink);
    font-family: var(--bh-inst-font);
    font-size: 15px;
    font-variant-numeric: tabular-nums;
}

.bh-console h1, .bh-console h2, .bh-console h3, .bh-console h4 { letter-spacing: 0; font-weight: 600; }
.bh-console .bh-pagehead { border-bottom: 1px solid var(--bh-inst-rule); padding-bottom: 16px; }
.bh-console .bh-pagehead h1 { font-size: 1.6rem; }
.bh-console .bh-eyebrow { color: var(--bh-inst-muted); font-weight: 600; letter-spacing: .1em; font-size: .72rem; }
.bh-console .bh-eyebrow a { color: inherit; }
.bh-console .bh-card { border-radius: 4px; border: 1px solid var(--bh-inst-rule); box-shadow: none; }
.bh-console .bh-btn { font-weight: 600; letter-spacing: 0; min-height: 40px; --_fg: var(--bh-inst-on-strong); }
.bh-console .bh-btn--sm { min-height: 32px; }
.bh-console .bh-btn:hover { transform: none; }
.bh-console .bh-banner { border-radius: 4px; background: color-mix(in srgb, var(--bh-inst-steel) 7%, var(--bh-inst-raised)); border-color: color-mix(in srgb, var(--bh-inst-steel) 30%, transparent); }
.bh-console .bh-table th { background: var(--bh-inst-surface); color: var(--bh-inst-muted); font-weight: 600; }
.bh-console .bh-table tr:hover td { background: color-mix(in srgb, var(--bh-inst-steel) 4%, transparent); }
.bh-console .bh-input,
.bh-console .bh-field input:not([type=checkbox]):not([type=radio]),
.bh-console .bh-field select,
.bh-console .bh-field textarea { border-width: 1px; min-height: 40px; border-color: color-mix(in srgb, var(--bh-inst-ink) 28%, transparent); }

/* Sidebar */
.bh-console .bh-side { background: var(--bh-inst-navy); color: var(--bh-inst-on-navy); gap: 1px; border-right: 1px solid var(--bh-inst-navy-deep); overflow-y: auto; }
.bh-console .bh-side a { border-radius: 3px; font-weight: 500; font-size: .88rem; opacity: .82; padding: 5px 12px; }
.bh-console .bh-side a:hover { background: var(--bh-inst-on-navy-faint); }
.bh-console .bh-side a.active { background: var(--bh-inst-on-navy-faint); opacity: 1; box-shadow: inset 3px 0 0 var(--bh-inst-on-navy); }
.bh-console .bh-side .bh-badge { background: var(--bh-inst-on-navy); color: var(--bh-inst-navy); }
.bh-console .bh-side__brand { display: grid; grid-template-columns: auto 1fr; column-gap: 10px; align-items: center; font-weight: 600; font-size: 1rem; border-bottom: 1px solid var(--bh-inst-on-navy-faint); margin-bottom: 6px; }
.bh-console .bh-side__brand::before { content: ""; grid-row: span 2; width: 8px; height: 30px; border-radius: 2px; background: var(--bh-brand-mark); box-shadow: 0 0 0 1px var(--bh-inst-on-navy-faint); }
.bh-console .bh-side__section { font-size: .66rem; letter-spacing: .12em; text-transform: uppercase; opacity: .55; padding: 10px 12px 2px; }

/* The secure-session bar across the top of every back-office page. It stays in view while the page scrolls, so who is
   signed in (and for which team) is always visible; anchors scroll to just below it. */
:root:has(.bh-secbar) { scroll-padding-top: 64px; }
.bh-secbar {
    position: sticky; top: 0; z-index: 40;
    display: flex; flex-wrap: wrap; gap: 6px 18px; align-items: center; justify-content: space-between;
    margin: -28px calc(-1 * clamp(16px, 3vw, 40px)) 24px; padding: 8px clamp(16px, 3vw, 40px);
    background: var(--bh-inst-raised); border-bottom: 1px solid var(--bh-inst-rule); font-size: .8rem; color: var(--bh-inst-muted);
}
.bh-secbar__secure { display: inline-flex; align-items: center; gap: 6px; color: var(--bh-inst-secure); font-weight: 600; }
.bh-secbar__secure::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--bh-inst-secure); }
.bh-secbar__meta { display: flex; flex-wrap: wrap; gap: 4px 16px; align-items: center; }
.bh-secbar a { color: var(--bh-inst-steel); }

/* Idle warning (js/blauhaus.js shows it a minute before the session ends). */
.bh-idle {
    position: fixed; right: 16px; bottom: 16px; z-index: 60; max-width: 360px; padding: 16px;
    background: var(--bh-inst-raised); color: var(--bh-inst-ink); border: 1px solid var(--bh-inst-rule); border-top: 3px solid var(--bh-warning-ink);
    border-radius: 4px; box-shadow: 0 12px 32px var(--bh-inst-shadow); font-family: var(--bh-inst-font); font-size: .9rem;
}
.bh-idle[hidden] { display: none; }
.bh-idle p { margin: 0 0 10px; }

/* Sign-in card */
.bh-signin { min-height: 80vh; display: grid; place-items: center; padding: 32px 16px; background: var(--bh-inst-surface); font-family: var(--bh-inst-font); }
.bh-signin__card { width: min(420px, 100%); background: var(--bh-inst-raised); color: var(--bh-inst-ink); border: 1px solid var(--bh-inst-rule); border-top: 4px solid var(--bh-inst-navy); border-radius: 4px; padding: 28px; }
.bh-signin__brand { font-size: .75rem; letter-spacing: .12em; text-transform: uppercase; color: var(--bh-inst-muted); font-weight: 600; margin: 0 0 4px; font-family: var(--bh-inst-font); }
.bh-signin__title { font-family: var(--bh-inst-font); font-size: 1.5rem; font-weight: 600; letter-spacing: 0; margin: 0 0 18px; }
.bh-signin .bh-btn { border-radius: 4px; font-family: var(--bh-inst-font); font-weight: 600; letter-spacing: 0; }
.bh-signin .bh-btn--primary { --_bg: var(--bh-inst-navy); --_fg: var(--bh-inst-on-strong); }
.bh-signin .bh-btn--ghost { color: var(--bh-inst-ink); border-width: 1px; border-color: var(--bh-inst-rule); }
.bh-signin .bh-field input { border-radius: 4px; border-width: 1px; }
.bh-signin a { color: var(--bh-inst-steel); }
.bh-signin__assurances { list-style: none; padding: 16px 0 0; margin: 20px 0 0; border-top: 1px solid var(--bh-inst-rule); display: grid; gap: 6px; font-size: .8rem; color: var(--bh-inst-muted); }
.bh-signin__assurances li { display: flex; gap: 8px; align-items: center; }
.bh-signin__assurances li::before { content: "✓"; color: var(--bh-inst-secure); font-weight: 700; }
.bh-code-input { letter-spacing: .3em; font-size: 1.2rem; text-align: center; font-variant-numeric: tabular-nums; }

@media (max-width: 900px) {
    .bh-secbar { margin-top: 0; }
    .bh-console .bh-side__section { display: none; }
}

/* Connect an AI (consent screen) and the Connected AIs card. */
.bh-consent { border: 1px solid var(--bh-inst-rule); border-radius: 4px; padding: 12px; margin: 0; display: grid; gap: 10px; }
.bh-consent legend { padding: 0 4px; }
.bh-consent__item { display: grid; grid-template-columns: auto 1fr; gap: 10px; align-items: start; }
.bh-consent__item input { margin-top: 4px; }
.bh-consent__detail { display: block; }
.bh-consent__pii { margin-left: 6px; font-size: .7rem; vertical-align: middle; }
.bh-consent__rules { margin: 4px 0 8px; padding-left: 18px; color: var(--bh-inst-muted); display: grid; gap: 4px; }
.bh-key { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; word-break: break-all; background: var(--bh-inst-surface); border: 1px solid var(--bh-inst-rule); border-radius: 4px; padding: 8px 10px; }
