/* BeHive design system: components. Class prefix: bh-. */

@layer components {
  /* ---------- Icons ---------- */

  /* Font Awesome glyphs (ds_icon) in a square box, centred, so they line
     up with text and controls. Font Awesome's own rules are unlayered and
     read --fa-display, hence the variable rather than display. */
  .bh-icon {
    --fa-display: inline-grid;
    flex: none;
    place-items: center;
    width: 1.25em;
    height: 1.25em;
    font-size: 0.9375em;
    line-height: 1;
    vertical-align: -0.2em;
  }

  /* ---------- Storage tiers: hue, pastel tag and dot ---------- */

  .bh-t-catalog { --tier-hue: var(--bh-tier-catalog); }
  .bh-t-hot { --tier-hue: var(--bh-tier-hot); }
  .bh-t-cold { --tier-hue: var(--bh-tier-cold); }
  .bh-t-nearline { --tier-hue: var(--bh-tier-nearline); }
  .bh-t-cloud { --tier-hue: var(--bh-tier-cloud); }
  .bh-t-space { --tier-hue: var(--bh-tier-space); }
  .bh-t-physical { --tier-hue: var(--bh-tier-physical); }
  .bh-t-offline { --tier-hue: var(--bh-tier-offline); }
  .bh-t-data { --tier-hue: var(--bh-tier-data); }
  .bh-t-unknown { --tier-hue: var(--bh-tier-unknown); }
  .bh-t-deleted { --tier-hue: var(--bh-tier-deleted); }

  [class*='bh-t-'] {
    --tier: var(--tier-hue);
  }

  /* Ingesting is a process, not a place: a hatched mark on slate. */
  .bh-t-ingesting {
    --tier-hue: var(--p-tier-slate);
    --tier: var(--bh-tier-ingesting);
  }

  /* Tag: pastel fill and deep ink, both mixed from the tier hue so they
     hold contrast (5:1 or better) in either theme. */
  .bh-tier {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 24px;
    padding: 0 10px 0 8px;
    border-radius: var(--bh-radius-tag);
    background: color-mix(in oklab, var(--tier-hue, var(--bh-border-strong)) 16%, var(--bh-surface));
    color: color-mix(in oklab, var(--tier-hue, var(--bh-text)) 55%, var(--bh-text));
    font-size: var(--bh-text-xs);
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
  }

  /* Tier icon (Font Awesome duotone), drawn in the tier hue. */
  .bh-tier-icon {
    flex: none;
    width: 1.25em;
    color: color-mix(in oklab, var(--tier-hue, var(--bh-text-muted)) 85%, var(--bh-text));
    font-size: 0.875em;
    text-align: center;
  }

  /* Format code: a neutral outlined tag. */
  .bh-code {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 24px;
    padding: 0 8px;
    border: var(--bh-line) solid var(--bh-border);
    border-radius: var(--bh-radius-sm);
    color: var(--bh-text);
    font-size: var(--bh-text-xs);
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
  }

  a.bh-code {
    transition:
      border-color var(--bh-dur) var(--bh-ease),
      color var(--bh-dur) var(--bh-ease);
  }

  a.bh-code:hover {
    border-color: var(--bh-accent-edge);
    color: var(--bh-accent-text-strong);
    text-decoration: none;
  }

  /* A value that copies itself on click (ds.js, data-bh-copy). */
  .bh-copy {
    min-width: 0;
    max-width: 100%;
    background: none;
    font-family: var(--bh-font-mono);
    text-align: start;
    cursor: copy;
    transition:
      border-color var(--bh-dur) var(--bh-ease),
      color var(--bh-dur) var(--bh-ease);
  }

  .bh-copy:hover {
    border-color: var(--bh-accent-edge);
    color: var(--bh-accent-text-strong);
  }

  .bh-copy:focus-visible {
    outline: 2px solid var(--bh-accent-edge);
    outline-offset: 2px;
  }

  .bh-num {
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
  }

  /* Runtime drawn to scale: --runtime is 0..1 of the longest on screen. */
  .bh-runtime {
    display: grid;
    gap: 4px;
    min-width: 6rem;
  }

  .bh-runtime__bar {
    height: 6px;
    border-radius: var(--bh-radius-full);
    background: var(--bh-border);
    overflow: hidden;
  }

  .bh-runtime__bar::before {
    content: '';
    display: block;
    width: calc(var(--runtime, 0) * 100%);
    min-width: 6px;
    height: 100%;
    border-radius: inherit;
    background: var(--bh-chart);
  }

  /* ---------- App shell ---------- */

  .bh-app {
    display: grid;
    grid-template-columns: var(--bh-rail-w) minmax(0, 1fr);
    grid-template-rows: var(--bh-header-h) 1fr;
    grid-template-areas:
      'header header'
      'rail main';
    min-height: 100dvh;
  }

  .bh-skip {
    position: absolute;
    left: var(--bh-space-4);
    top: -100px;
    z-index: 100;
    padding: var(--bh-space-2) var(--bh-space-4);
    background: var(--bh-accent);
    color: var(--bh-on-accent);
    border-radius: var(--bh-radius);
  }

  .bh-skip:focus {
    top: var(--bh-space-2);
  }

  .bh-header {
    grid-area: header;
    position: sticky;
    top: 0;
    z-index: 30;
    display: flex;
    align-items: center;
    gap: var(--bh-space-4);
    padding: 0 var(--bh-space-4);
    background: var(--bh-shell);
    color: var(--bh-shell-text);
    border-bottom: var(--bh-line) solid var(--bh-border);
  }

  .bh-header__logo {
    display: flex;
    align-items: center;
    width: calc(var(--bh-rail-w) - var(--bh-space-8));
    flex: none;
    border-radius: var(--bh-radius);
  }

  /* The logo PNG is 200x50 with the artwork inset (x 10-187, y 12-41).
     Size by height so the artwork is ~22px tall, and pull the left inset
     back so the hexagon sits on the sidebar's text edge. */
  .bh-header__logo img {
    width: auto;
    height: 36px;
    margin-left: -7px;
    translate: 0 -1px;
  }

  /* Looks like a field, but opens the command palette (palette.js). */
  .bh-header__search {
    display: flex;
    flex: 1;
    align-items: center;
    gap: var(--bh-space-3);
    max-width: 560px;
    min-width: 0;
    height: var(--bh-control-h);
    padding: 0 var(--bh-space-2) 0 var(--bh-space-4);
    border: var(--bh-line) solid transparent;
    border-radius: var(--bh-radius-full);
    background: var(--bh-shell-raised);
    color: var(--bh-shell-muted);
    font: inherit;
    font-size: var(--bh-text-base);
    text-align: left;
    cursor: pointer;
    transition: background var(--bh-dur) var(--bh-ease);
  }

  .bh-header__search:hover {
    background: var(--bh-shell-raised-hover);
    color: var(--bh-shell-text);
  }

  .bh-header__search:focus-visible {
    outline: 2px solid var(--bh-shell-focus);
    outline-offset: 2px;
  }

  .bh-header__search-label {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .bh-header__search > kbd {
    background: var(--bh-shell-raised);
    color: var(--bh-shell-muted);
    font-size: var(--bh-text-xs);
  }

  .bh-header__actions {
    display: flex;
    align-items: center;
    gap: var(--bh-space-1);
    margin-left: auto;
  }

  /* Header search: translucent on the header, white once it has focus. */
  .bh-header .bh-input {
    border-radius: var(--bh-radius-full);
    border-color: transparent;
    background: var(--bh-shell-raised);
    color: var(--bh-shell-text);
  }

  .bh-header .bh-input:hover {
    border-color: transparent;
    background: var(--bh-shell-raised-hover);
  }

  .bh-header .bh-input::placeholder {
    color: var(--bh-shell-muted);
  }

  .bh-header .bh-input:focus-visible {
    border-color: var(--bh-focus);
    background: var(--bh-shell-field);
    color: var(--bh-shell-field-text);
  }

  .bh-header .bh-input:focus-visible::placeholder {
    color: var(--bh-shell-field-muted);
  }

  /* A form around a single header button stays out of the layout. */
  .bh-header__form {
    display: contents;
  }

  /* The theme form holds both buttons: only the switch to the other
     theme shows. */
  :root[data-theme='dark'] .bh-header__form [data-bh-theme-value='dark'],
  :root:not([data-theme='dark'])
    .bh-header__form
    [data-bh-theme-value='light'] {
    display: none;
  }

  .bh-shell-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: var(--bh-space-2);
    height: var(--bh-control-h);
    min-width: var(--bh-control-h);
    justify-content: center;
    padding: 0 var(--bh-space-2);
    border: 0;
    border-radius: var(--bh-radius);
    background: transparent;
    color: var(--bh-shell-text);
    font-size: var(--bh-text-base);
    font-weight: 500;
    text-decoration: none;
    transition: background-color var(--bh-dur) var(--bh-ease);
  }

  .bh-shell-btn:hover,
  .bh-shell-btn[aria-current='page'],
  .bh-shell-btn[aria-expanded='true'] {
    background: var(--bh-shell-raised);
    text-decoration: none;
  }

  .bh-header :focus-visible {
    outline-color: var(--bh-shell-focus);
  }

  /* Counts wear the logo amber. */
  .bh-count {
    display: inline-grid;
    place-items: center;
    min-width: 1.25rem;
    height: 1.25rem;
    padding: 0 0.3rem;
    border-radius: var(--bh-radius-full);
    background: var(--bh-brand);
    color: var(--bh-on-brand);
    box-shadow: 0 0 0 var(--bh-line) var(--bh-shell);
    font-size: var(--bh-text-xs);
    font-weight: 700;
    line-height: 1;
  }

  /* Beside a visible label the count sits inline; icon-only buttons
     (and every shell button on narrow screens) pin it to the corner. */
  .bh-shell-btn:not(:has(.bh-shell-btn__label)) .bh-count {
    position: absolute;
    top: -3px;
    right: -4px;
  }

  .bh-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
    background: var(--bh-shell-raised);
    box-shadow: 0 0 0 var(--bh-line) var(--bh-shell), 0 0 0 4px var(--bh-brand);
  }

  .bh-menu-toggle {
    display: none;
  }

  /* Sidebar */

  .bh-rail {
    grid-area: rail;
    position: sticky;
    top: var(--bh-header-h);
    height: calc(100dvh - var(--bh-header-h));
    overflow-y: auto;
    padding: var(--bh-space-4) var(--bh-space-3) var(--bh-space-8);
    border-right: var(--bh-line) solid var(--bh-nav-border);
    background: var(--bh-nav-bg);
    color: var(--bh-nav-text);
    scrollbar-color: var(--bh-border-strong) transparent;
  }

  .bh-rail__section + .bh-rail__section {
    margin-top: var(--bh-space-5);
  }

  .bh-rail__heading {
    padding: 0 var(--bh-space-3) var(--bh-space-2);
    color: var(--bh-nav-heading);
    font-size: var(--bh-text-xs);
    font-weight: 600;
  }

  .bh-rail ul {
    display: grid;
    gap: 2px;
    list-style: none;
    padding: 0;
  }

  .bh-nav-link {
    position: relative;
    display: flex;
    align-items: center;
    gap: var(--bh-space-3);
    min-height: 36px;
    padding: 0 var(--bh-space-3);
    border: var(--bh-line) solid transparent;
    border-radius: var(--bh-radius);
    color: var(--bh-nav-text);
    font-size: var(--bh-text-base);
    font-weight: 500;
    text-decoration: none;
    transition:
      background-color var(--bh-dur) var(--bh-ease),
      color var(--bh-dur) var(--bh-ease);
  }

  .bh-nav-link:hover {
    background: var(--bh-nav-hover);
    color: var(--bh-nav-active-text);
    text-decoration: none;
  }

  .bh-nav-link .bh-icon {
    color: var(--bh-nav-icon);
  }

  .bh-nav-link[aria-current] {
    border-color: var(--bh-nav-active-border);
    background: var(--bh-nav-active);
    box-shadow: 0 var(--bh-ledge) 0 var(--bh-nav-active-border);
    color: var(--bh-nav-active-text);
    font-weight: 600;
  }

  /* The logo hexagon marks where you are. */
  .bh-nav-link[aria-current='page']::after {
    content: '';
    flex: none;
    width: 9px;
    height: 10px;
    margin-left: auto;
    background: var(--bh-nav-mark);
    clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%);
  }

  .bh-nav-link[aria-current='page']:has(.bh-nav-link__count)::after {
    margin-left: 0;
  }

  .bh-nav-link[aria-current] .bh-icon {
    color: var(--bh-nav-active-text);
  }

  /* A rail button that opens a menu (Administration › More). */
  button.bh-nav-link {
    width: 100%;
    background: none;
    font-family: inherit;
    text-align: left;
    cursor: pointer;
  }

  button.bh-nav-link[aria-current] {
    background: var(--bh-nav-active);
  }

  button.bh-nav-link[aria-expanded='true'] {
    background: var(--bh-nav-hover);
    color: var(--bh-nav-active-text);
  }

  button.bh-nav-link > .bh-icon:last-child {
    margin-left: auto;
  }

  .bh-nav-link__count {
    margin-left: auto;
    color: var(--bh-text-muted);
    font-size: var(--bh-text-xs);
    font-variant-numeric: tabular-nums;
  }

  /* Tier links: the tier dot sits where the icon would, and gains a halo
     on hover and when current. */
  /* Font Awesome's unlayered display rule reads --fa-display. */
  .bh-nav-link--tier .bh-tier-icon {
    --fa-display: inline-grid;
    place-items: center;
    width: 24px;
    height: 24px;
    margin-inline: -2px 0;
    border-radius: 50%;
    font-size: 0.8125rem;
    transition: background-color var(--bh-dur) var(--bh-ease);
  }

  .bh-nav-link--tier:hover .bh-tier-icon,
  .bh-nav-link--tier[aria-current='page'] .bh-tier-icon {
    background: color-mix(in oklab, var(--tier-hue) 22%, transparent);
  }

  /* The collapse toggle closes the rail, at its bottom when it is short. */
  .bh-rail {
    display: flex;
    flex-direction: column;
  }

  .bh-rail__foot {
    margin-top: auto;
    padding-top: var(--bh-space-5);
  }

  /* Collapsed rail (wide screens): icons only. The labels stay for screen
     readers; ds.js repeats them as tooltips. */
  @media (min-width: 961px) {
    [data-rail-collapsed] .bh-app {
      grid-template-columns: var(--bh-rail-w-collapsed) minmax(0, 1fr);
    }

    [data-rail-collapsed] .bh-rail {
      padding-inline: var(--bh-space-2);
      overflow-x: hidden;
    }

    [data-rail-collapsed] .bh-rail__heading,
    [data-rail-collapsed] .bh-nav-link__label {
      position: absolute;
      width: 1px;
      height: 1px;
      padding: 0;
      margin: -1px;
      overflow: hidden;
      clip: rect(0, 0, 0, 0);
      white-space: nowrap;
      border: 0;
    }

    /* Without headings, a rule tells the sections apart. */
    [data-rail-collapsed] .bh-rail__section + .bh-rail__section {
      margin-top: var(--bh-space-3);
      padding-top: var(--bh-space-3);
      border-top: var(--bh-line) solid var(--bh-nav-border);
    }

    [data-rail-collapsed] .bh-nav-link {
      justify-content: center;
      gap: 0;
      padding: 0;
    }

    [data-rail-collapsed] .bh-nav-link[aria-current='page']::after,
    [data-rail-collapsed] button.bh-nav-link > .bh-icon:last-child,
    [data-rail-collapsed] .bh-nav-link__count {
      display: none;
    }

    [data-rail-collapsed] .bh-nav-link--tier .bh-tier-icon {
      margin-inline: 0;
    }
  }

  /* Main */

  .bh-main {
    grid-area: main;
    min-width: 0;
    padding: var(--bh-space-6) var(--bh-space-8) var(--bh-space-12);
  }

  .bh-main:focus {
    outline: none;
  }

  .bh-page-head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: var(--bh-space-3) var(--bh-space-6);
    margin-bottom: var(--bh-space-6);
  }

  .bh-page-head__text {
    flex: 1 1 20rem;
    min-width: 0;
  }

  .bh-page-head__meta {
    margin-top: var(--bh-space-1);
    color: var(--bh-text-muted);
  }

  .bh-page-head__actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--bh-space-2);
  }

  .bh-breadcrumb {
    display: flex;
    flex-wrap: wrap;
    gap: var(--bh-space-2);
    margin-bottom: var(--bh-space-2);
    padding: 0;
    list-style: none;
    color: var(--bh-text-muted);
    font-size: var(--bh-text-sm);
  }

  .bh-breadcrumb li + li::before {
    content: '/';
    margin-right: var(--bh-space-2);
    color: var(--bh-border-strong);
  }

  /* Links take the accent so the way back reads as clickable; plain
     items and the current page stay muted. */
  .bh-breadcrumb a {
    color: var(--bh-accent-text);
    font-weight: 500;
    text-decoration: none;
    border-radius: var(--bh-radius-sm);
  }

  .bh-breadcrumb a:hover {
    color: var(--bh-accent-text-strong);
    text-decoration: underline;
    text-underline-offset: 3px;
  }

  .bh-breadcrumb [aria-current='page'] {
    color: var(--bh-text);
  }

  .bh-section {
    margin-top: var(--bh-space-8);
  }

  .bh-section__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--bh-space-4);
    margin-bottom: var(--bh-space-3);
  }

  .bh-section__desc {
    max-width: 70ch;
    margin-top: var(--bh-space-1);
    color: var(--bh-text-muted);
  }

  .bh-footer {
    margin-top: var(--bh-space-12);
    padding-top: var(--bh-space-4);
    border-top: 1px solid var(--bh-border);
    color: var(--bh-text-muted);
    font-size: var(--bh-text-xs);
  }

  /* Footer buttons (Support opens a dialog) read as the links beside them. */
  .bh-footer button {
    padding: 0;
    border: 0;
    background: none;
    color: var(--bh-accent-text);
    font: inherit;
    cursor: pointer;
  }

  .bh-footer button:hover {
    text-decoration: underline;
    text-decoration-color: var(--bh-link-underline);
    text-decoration-thickness: 2px;
    text-underline-offset: 0.2em;
  }

  /* ---------- Cards (widgets) ---------- */

  .bh-card {
    min-width: 0;
    border: var(--bh-line) solid var(--bh-border);
    border-radius: var(--bh-radius-lg);
    background: var(--bh-surface);
  }

  .bh-card__head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--bh-space-2) var(--bh-space-3);
    padding: var(--bh-space-5) var(--bh-space-6) 0;
  }

  .bh-card__title {
    display: flex;
    align-items: center;
    gap: var(--bh-space-2);
    font-family: var(--bh-font-display);
    font-size: var(--bh-text-lg);
    font-weight: 700;
    letter-spacing: -0.01em;
  }

  /* Font Awesome icons in titles take the accent, softly. */
  .bh-card__title > [class*='fa-'] {
    color: var(--bh-accent-text);
    font-size: 0.875em;
    --fa-secondary-opacity: 0.35;
  }

  .bh-card__head > :last-child:not(:first-child) {
    margin-left: auto;
  }

  .bh-card__desc {
    padding: var(--bh-space-1) var(--bh-space-6) 0;
    color: var(--bh-text-muted);
  }

  .bh-card__body {
    padding: var(--bh-space-4) var(--bh-space-6) var(--bh-space-6);
  }

  /* A table that fills a card runs edge to edge under the head. */
  .bh-card > .bh-table-wrap {
    margin-top: var(--bh-space-4);
    border: 0;
    border-top: var(--bh-line) solid var(--bh-border);
    border-radius: 0 0 calc(var(--bh-radius-lg) - var(--bh-line)) calc(var(--bh-radius-lg) - var(--bh-line));
  }

  .bh-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 22rem), 1fr));
    gap: var(--bh-space-4);
  }

  .bh-cards + .bh-cards,
  .bh-cards + .bh-card,
  .bh-card + .bh-cards,
  .bh-card + .bh-card {
    margin-top: var(--bh-space-4);
  }

  .bh-cards > .bh-card,
  .bh-cards > .bh-cards {
    margin-top: 0;
  }

  .bh-cards--wide {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 34rem), 1fr));
  }

  /* Summary figure: label, big number, optional delta. */
  .bh-stat__label {
    color: var(--bh-text-muted);
    font-size: var(--bh-text-sm);
  }

  .bh-stat__value {
    margin-top: var(--bh-space-1);
    font-family: var(--bh-font-display);
    font-size: 2.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
  }

  /* Stacked share bar: each segment sets --share (0..1) and a tier. */
  .bh-meter {
    display: flex;
    gap: 3px;
    height: 12px;
  }

  .bh-meter > span {
    flex: var(--share, 0) 0 0;
    min-width: 12px;
    border-radius: var(--bh-radius-full);
    background: var(--tier, var(--bh-chart));
  }

  .bh-legend {
    display: flex;
    flex-wrap: wrap;
    gap: var(--bh-space-2) var(--bh-space-4);
    margin-top: var(--bh-space-3);
    padding: 0;
    list-style: none;
    font-size: var(--bh-text-sm);
  }

  .bh-legend li {
    display: inline-flex;
    align-items: center;
    gap: 6px;
  }

  .bh-legend li::before {
    content: '';
    width: var(--bh-dot);
    height: var(--bh-dot);
    border-radius: 50%;
    background: var(--tier, var(--bh-chart));
  }

  .bh-legend .bh-num {
    color: var(--bh-text-muted);
  }

  /* ---------- Buttons ---------- */

  /* Buttons sit on a ledge: a 2px line and a solid lip underneath that
     the button presses into. Default is white on a warm grey line. */
  .bh-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: var(--bh-control-h);
    padding: 0 var(--bh-space-4);
    border: var(--bh-line) solid var(--bh-btn-border);
    border-radius: var(--bh-radius);
    background: var(--bh-surface);
    box-shadow: 0 var(--bh-ledge) 0 var(--bh-btn-border);
    color: var(--bh-text);
    font-size: var(--bh-text-base);
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
    text-decoration: none;
    transition:
      background-color var(--bh-dur) var(--bh-ease),
      border-color var(--bh-dur) var(--bh-ease),
      box-shadow var(--bh-dur) var(--bh-ease),
      translate var(--bh-dur) var(--bh-ease),
      color var(--bh-dur) var(--bh-ease);
  }

  .bh-btn .bh-icon {
    color: var(--bh-text-muted);
  }

  .bh-btn:hover {
    background: var(--bh-accent-soft);
    text-decoration: none;
  }

  .bh-btn:active {
    translate: 0 var(--bh-ledge);
    box-shadow: 0 0 0 transparent;
  }

  .bh-btn--primary {
    border-color: var(--bh-accent);
    background: var(--bh-accent);
    box-shadow: 0 var(--bh-ledge) 0 var(--bh-accent-ledge);
    color: var(--bh-on-accent);
  }

  .bh-btn--primary .bh-icon,
  .bh-btn--danger .bh-icon {
    color: inherit;
  }

  .bh-btn--primary:hover {
    border-color: var(--bh-accent-hover);
    background: var(--bh-accent-hover);
  }

  /* Tertiary: flat, no line, a soft fill on hover. */
  .bh-btn--ghost {
    border-color: transparent;
    background: transparent;
    box-shadow: none;
  }

  .bh-btn--ghost:hover {
    background: var(--bh-control-fill-hover);
  }

  .bh-btn--ghost:active {
    translate: none;
    background: var(--bh-control-fill-active);
  }

  .bh-btn--danger {
    border-color: var(--bh-danger-solid);
    background: var(--bh-danger-solid);
    box-shadow: 0 var(--bh-ledge) 0 var(--bh-danger-ledge);
    color: var(--bh-on-accent);
  }

  .bh-btn--danger:hover {
    border-color: var(--bh-danger-solid-hover);
    background: var(--bh-danger-solid-hover);
  }

  /* Tinted: a soft fill in the colour of what the button does, for rows
     of icon actions that must read at a glance. Green adds, blue moves or
     exports, amber edits, red deletes (the solid --danger stays for the
     one destructive action of a page or dialog). */
  .bh-btn--success,
  .bh-btn--info,
  .bh-btn--warning,
  .bh-btn--danger-soft,
  .bh-btn--accent-soft {
    border-color: var(--tone-line);
    background: var(--tone-soft);
    color: var(--tone);
  }

  .bh-btn--success { --tone: var(--bh-success); --tone-soft: var(--bh-success-soft); --tone-line: var(--bh-success-line); }
  .bh-btn--info { --tone: var(--bh-blue); --tone-soft: var(--bh-blue-soft); --tone-line: var(--bh-blue-line); }
  .bh-btn--warning { --tone: var(--bh-warning); --tone-soft: var(--bh-warning-soft); --tone-line: var(--bh-warning-line); }
  .bh-btn--danger-soft { --tone: var(--bh-danger); --tone-soft: var(--bh-danger-soft); --tone-line: var(--bh-danger-line); }
  .bh-btn--accent-soft { --tone: var(--bh-accent-text-strong); --tone-soft: var(--bh-accent-soft); --tone-line: var(--bh-accent-edge); }

  .bh-btn--success .bh-icon,
  .bh-btn--info .bh-icon,
  .bh-btn--warning .bh-icon,
  .bh-btn--danger-soft .bh-icon,
  .bh-btn--accent-soft .bh-icon {
    color: inherit;
  }

  .bh-btn--success:not(:disabled):hover,
  .bh-btn--info:not(:disabled):hover,
  .bh-btn--warning:not(:disabled):hover,
  .bh-btn--danger-soft:not(:disabled):hover,
  .bh-btn--accent-soft:not(:disabled):hover {
    border-color: var(--tone);
    background: color-mix(in srgb, var(--tone) 16%, var(--tone-soft));
  }

  .bh-btn--sm {
    height: var(--bh-control-h-sm);
    padding: 0 var(--bh-space-3);
    border-radius: var(--bh-radius-sm);
    font-size: var(--bh-text-sm);
  }

  .bh-btn--icon {
    width: var(--bh-control-h);
    padding: 0;
  }

  .bh-btn--sm.bh-btn--icon {
    width: var(--bh-control-h-sm);
  }

  /* Block buttons wrap: long German labels must not overflow. */
  .bh-btn--block {
    width: 100%;
    height: auto;
    min-height: 44px;
    padding-block: var(--bh-space-2);
    font-size: var(--bh-text-md);
    line-height: var(--bh-leading-tight);
    white-space: normal;
    text-align: center;
    text-wrap: balance;
  }

  .bh-btn:disabled,
  .bh-btn[aria-disabled='true'] {
    opacity: 0.4;
    box-shadow: none;
    cursor: not-allowed;
    pointer-events: none;
  }

  .bh-btn[aria-busy='true'] {
    position: relative;
    color: transparent;
    pointer-events: none;
  }

  .bh-btn[aria-busy='true'] .bh-icon {
    color: transparent;
  }

  .bh-btn[aria-busy='true']::after {
    content: '';
    position: absolute;
    width: 1em;
    height: 1em;
    border: 2px solid var(--bh-text-muted);
    border-right-color: transparent;
    border-radius: 50%;
    animation: bh-spin 700ms linear infinite;
  }

  .bh-btn--primary[aria-busy='true']::after {
    border-color: var(--bh-on-accent);
    border-right-color: transparent;
  }

  @keyframes bh-spin {
    to {
      transform: rotate(360deg);
    }
  }

  /* ---------- Forms ---------- */

  .bh-field {
    display: grid;
    gap: 6px;
  }

  .bh-field + .bh-field {
    margin-top: var(--bh-space-4);
  }

  .bh-label {
    font-size: var(--bh-text-base);
    font-weight: 500;
  }

  .bh-label__optional {
    color: var(--bh-text-muted);
    font-weight: 400;
  }

  .bh-help {
    color: var(--bh-text-muted);
    font-size: var(--bh-text-xs);
  }

  /* Django's password rules come as a list. */
  .bh-help ul {
    margin: 0;
    padding-left: 1.25em;
  }

  .bh-error {
    display: flex;
    gap: var(--bh-space-1);
    color: var(--bh-danger);
    font-size: var(--bh-text-xs);
    font-weight: 500;
  }

  .bh-error ul {
    list-style: none;
    padding: 0;
  }

  .bh-input,
  .bh-select,
  .bh-textarea {
    width: 100%;
    min-height: var(--bh-control-h);
    padding: 0 var(--bh-space-3);
    border: var(--bh-line) solid var(--bh-control-border);
    border-radius: var(--bh-radius);
    background: var(--bh-surface);
    color: var(--bh-text);
    font-size: var(--bh-text-base);
    transition:
      border-color var(--bh-dur) var(--bh-ease),
      background-color var(--bh-dur) var(--bh-ease);
  }

  .bh-textarea {
    min-height: 6rem;
    padding: 6px var(--bh-space-3);
    resize: vertical;
  }

  .bh-select {
    appearance: none;
    padding-right: var(--bh-space-8);
    background-image: linear-gradient(45deg, transparent 50%, currentColor 50%),
      linear-gradient(135deg, currentColor 50%, transparent 50%);
    background-position:
      calc(100% - 16px) 50%,
      calc(100% - 11px) 50%;
    background-size: 5px 5px;
    background-repeat: no-repeat;
  }

  .bh-input::placeholder,
  .bh-textarea::placeholder {
    color: var(--bh-text-faint);
  }

  .bh-input:hover,
  .bh-select:hover,
  .bh-textarea:hover {
    border-color: var(--bh-accent-text);
  }

  .bh-input:focus-visible,
  .bh-select:focus-visible,
  .bh-textarea:focus-visible {
    border-color: var(--bh-focus);
  }

  .bh-input[aria-invalid='true'],
  .bh-select[aria-invalid='true'],
  .bh-textarea[aria-invalid='true'] {
    border-color: var(--bh-danger);
  }

  .bh-input[aria-invalid='true']:focus-visible,
  .bh-select[aria-invalid='true']:focus-visible,
  .bh-textarea[aria-invalid='true']:focus-visible {
    outline-color: var(--bh-danger-ring);
  }

  /* File input: the browser's button drawn as a design system button. */
  .bh-input.bh-file {
    padding: 4px;
    cursor: pointer;
  }

  .bh-file::file-selector-button {
    height: calc(var(--bh-control-h) - 10px);
    margin-right: var(--bh-space-3);
    padding: 0 var(--bh-space-3);
    border: var(--bh-line) solid var(--bh-control-border);
    border-radius: var(--bh-radius-sm);
    background: var(--bh-control-fill);
    color: var(--bh-text);
    font: inherit;
    font-size: var(--bh-text-sm);
    font-weight: 500;
    cursor: pointer;
  }

  .bh-file:hover::file-selector-button {
    background: var(--bh-control-fill-hover);
  }

  .bh-input:disabled,
  .bh-select:disabled,
  .bh-textarea:disabled {
    border-color: var(--bh-border);
    background: var(--bh-surface-sunken);
    color: var(--bh-text-faint);
    cursor: not-allowed;
  }

  .bh-input--sm,
  .bh-select--sm {
    min-height: var(--bh-control-h-sm);
    font-size: var(--bh-text-sm);
  }

  .bh-input-icon {
    position: relative;
  }

  .bh-input-icon > .bh-icon {
    position: absolute;
    left: var(--bh-space-3);
    top: 50%;
    translate: 0 -50%;
    color: var(--bh-text-muted);
    pointer-events: none;
  }

  .bh-header .bh-input-icon > .bh-icon {
    color: var(--bh-shell-muted);
  }

  .bh-header .bh-input-icon:focus-within > .bh-icon {
    color: var(--bh-shell-field-muted);
  }

  .bh-input-icon > .bh-input {
    padding-left: var(--bh-space-10);
  }

  .bh-input-icon:has(> kbd) > .bh-input {
    padding-right: 4.5rem;
  }

  .bh-input-icon > kbd {
    position: absolute;
    right: var(--bh-space-2);
    top: 50%;
    translate: 0 -50%;
    background: var(--bh-shell-raised);
    color: var(--bh-shell-muted);
    font-size: var(--bh-text-xs);
    pointer-events: none;
  }

  .bh-input-icon:focus-within > kbd {
    visibility: hidden;
  }

  .bh-check {
    display: inline-flex;
    align-items: center;
    gap: var(--bh-space-2);
    font-size: var(--bh-text-base);
    cursor: pointer;
  }

  .bh-check input {
    margin: 0;
  }

  /* Checkboxes: rounded squares that fill honey with an ink tick. */
  .bh-check input[type='checkbox'],
  .bh-table input[type='checkbox'] {
    appearance: none;
    display: inline-grid;
    place-content: center;
    flex: none;
    width: 20px;
    height: 20px;
    margin: 0;
    border: var(--bh-line) solid var(--bh-control-border);
    border-radius: 7px;
    background: var(--bh-surface);
    cursor: pointer;
    vertical-align: middle;
    transition:
      background-color var(--bh-dur) var(--bh-ease),
      border-color var(--bh-dur) var(--bh-ease);
  }

  .bh-check input[type='checkbox']::before,
  .bh-table input[type='checkbox']::before {
    content: '';
    width: 12px;
    height: 12px;
    background: var(--bh-on-accent);
    clip-path: polygon(14% 52%, 0 66%, 38% 100%, 100% 22%, 86% 8%, 37% 70%);
    scale: 0;
    transition: scale var(--bh-dur) var(--bh-ease);
  }

  .bh-check input[type='checkbox']:hover,
  .bh-table input[type='checkbox']:hover {
    border-color: var(--bh-accent-edge);
  }

  .bh-check input[type='checkbox']:checked,
  .bh-table input[type='checkbox']:checked {
    border-color: var(--bh-accent-edge);
    background: var(--bh-accent);
  }

  .bh-check input[type='checkbox']:checked::before,
  .bh-table input[type='checkbox']:checked::before {
    scale: 1;
  }

  .bh-fieldset {
    border: 0;
    padding: 0;
  }

  .bh-fieldset legend {
    margin-bottom: var(--bh-space-2);
    font-size: var(--bh-text-base);
    font-weight: 500;
  }

  .bh-form-actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--bh-space-2);
    margin-top: var(--bh-space-6);
  }

  /* ---------- Filter bar ---------- */

  .bh-filterbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--bh-space-2);
    margin-bottom: var(--bh-space-3);
  }

  .bh-card > .bh-filterbar {
    margin: var(--bh-space-4) var(--bh-space-5) 0;
  }

  .bh-filterbar .bh-input-icon {
    flex: 1 1 16rem;
    max-width: 24rem;
  }

  .bh-filterbar__count {
    margin-left: auto;
    color: var(--bh-text-muted);
    font-size: var(--bh-text-sm);
  }

  /* ---------- Badges (tags) ---------- */

  .bh-badge {
    display: inline-flex;
    align-items: center;
    gap: var(--bh-space-1);
    height: 24px;
    padding: 0 10px;
    border-radius: var(--bh-radius-tag);
    background: var(--bh-info-soft);
    color: var(--bh-info);
    font-size: var(--bh-text-xs);
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
  }

  .bh-badge--success { background: var(--bh-success-soft); color: var(--bh-success); }
  .bh-badge--warning { background: var(--bh-warning-soft); color: var(--bh-warning); }
  .bh-badge--danger { background: var(--bh-danger-soft); color: var(--bh-danger); }
  .bh-badge--info { background: var(--bh-info-soft); color: var(--bh-info); }
  .bh-badge--accent { background: var(--bh-accent-soft); color: var(--bh-accent-text); }

  /* A status badge can lead with a dot in its own colour. */
  .bh-badge--dot::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
  }

  /* ---------- Facts strip ---------- */

  /* Key figures in a row, divided by 2px lines; wraps on narrow screens. */
  .bh-facts {
    display: flex;
    flex-wrap: wrap;
    gap: var(--bh-space-3) 0;
    margin: 0;
    padding: 0;
  }

  .bh-facts > div {
    display: grid;
    gap: 2px;
    padding: 0 var(--bh-space-5);
    border-left: var(--bh-line) solid var(--bh-border);
  }

  .bh-facts > div:first-child {
    padding-left: 0;
    border-left: 0;
  }

  .bh-facts dt {
    color: var(--bh-text-muted);
    font-size: var(--bh-text-xs);
  }

  .bh-facts dd {
    margin: 0;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
  }

  /* ---------- Progress ---------- */

  /* --progress is 0..1; the label above it is optional. */
  .bh-progress {
    display: grid;
    gap: 4px;
    min-width: 7rem;
    color: var(--bh-text-muted);
    font-size: var(--bh-text-xs);
    font-variant-numeric: tabular-nums;
  }

  .bh-progress__bar {
    height: 6px;
    border-radius: var(--bh-radius-full);
    background: var(--bh-border);
    overflow: hidden;
  }

  .bh-progress__bar::before {
    content: '';
    display: block;
    width: calc(var(--progress, 0) * 100%);
    min-width: 6px;
    height: 100%;
    border-radius: inherit;
    background: var(--bh-accent);
  }

  /* ---------- People ---------- */

  .bh-person {
    display: inline-flex;
    align-items: center;
    gap: var(--bh-space-2);
    white-space: nowrap;
  }

  .bh-person__avatar {
    display: inline-grid;
    place-items: center;
    flex: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--bh-accent-soft);
    color: var(--bh-accent-text-strong);
    font-size: 0.6875rem;
    font-weight: 700;
    object-fit: cover;
  }

  /* ---------- Tables ---------- */

  /* The wrap only scrolls sideways, for tables wider than the page. It
     never scrolls vertically: a nested vertical scroller under the
     pointer would catch the wheel and the page would stop scrolling. */
  .bh-table-wrap {
    overflow-x: auto;
    border: var(--bh-line) solid var(--bh-border);
    border-radius: var(--bh-radius-lg);
    background: var(--bh-surface);
  }

  .bh-table {
    width: 100%;
    font-size: var(--bh-text-base);
  }

  .bh-table th,
  .bh-table td {
    height: 45px;
    padding: var(--bh-space-2) var(--bh-space-3);
    border-bottom: 1px solid var(--bh-border);
    text-align: left;
    vertical-align: middle;
  }

  .bh-table tbody tr:last-child > * {
    border-bottom: 0;
  }

  .bh-table thead th {
    position: sticky;
    top: 0;
    z-index: 1;
    height: 40px;
    background: var(--bh-surface-sunken);
    color: var(--bh-text-muted);
    font-size: var(--bh-text-xs);
    font-weight: 600;
    line-height: var(--bh-leading-tight);
    text-wrap: balance;
  }

  .bh-table th[aria-sort] a,
  .bh-table th .bh-sort {
    display: inline-flex;
    align-items: center;
    gap: var(--bh-space-1);
    color: inherit;
    text-decoration: none;
  }

  .bh-table th[aria-sort] a:hover {
    color: var(--bh-text);
  }

  .bh-table th[aria-sort='ascending'],
  .bh-table th[aria-sort='descending'] {
    color: var(--bh-text);
  }

  .bh-table .bh-col-num {
    text-align: right;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
  }

  .bh-table .bh-col-actions {
    width: 1%;
    text-align: right;
    white-space: nowrap;
  }

  .bh-table .bh-col-check {
    width: 1%;
    padding-right: 0;
  }

  .bh-table tbody tr {
    transition: background-color var(--bh-dur) var(--bh-ease);
  }

  .bh-table tbody tr:hover {
    background: var(--bh-surface-hover);
  }

  /* Selection follows the row checkbox; .is-selected covers rows
     selected some other way. */
  .bh-table tbody tr:has(> .bh-col-check input:checked),
  .bh-table tbody tr.is-selected {
    background: var(--bh-accent-soft);
  }

  .bh-table tbody tr:has(> .bh-col-check input:checked):hover,
  .bh-table tbody tr.is-selected:hover {
    background: var(--bh-accent-soft-hover);
  }

  /* Each row opens with a rounded tier marker, like a chart legend key;
     it grows to full height on hover and selection. */
  .bh-table .bh-col-band {
    width: 12px;
    padding: 0;
  }

  .bh-table td.bh-col-band {
    position: relative;
  }

  .bh-table td.bh-col-band::before {
    content: '';
    position: absolute;
    inset: 8px auto 8px 6px;
    width: 5px;
    border-radius: var(--bh-radius-full);
    background: var(--tier, transparent);
    transform: scaleY(0.6);
    transition: transform var(--bh-dur) var(--bh-ease);
  }

  .bh-table tbody tr:hover td.bh-col-band::before,
  .bh-table tbody tr:has(> .bh-col-check input:checked) td.bh-col-band::before,
  .bh-table tbody tr.is-selected td.bh-col-band::before {
    transform: none;
  }

  .bh-table__title {
    display: block;
    color: var(--bh-text);
    font-weight: 500;
    text-decoration: none;
  }

  a.bh-table__title:hover {
    color: var(--bh-accent-text);
    text-decoration: none;
  }

  .bh-table__sub {
    display: block;
    color: var(--bh-text-muted);
    font-size: var(--bh-text-xs);
  }

  .bh-table--compact th,
  .bh-table--compact td {
    height: 36px;
  }

  /* ---------- Tabs ---------- */

  /* Tabs: a line under the strip; the current tab is underlined in
     honey. Each tab draws its own stretch of the line, so a strip that
     wraps keeps a line under every row; the strip draws the rest. */
  .bh-tabs {
    display: flex;
    flex-wrap: wrap;
    max-width: 100%;
    margin-bottom: var(--bh-space-5);
    box-shadow: inset 0 calc(var(--bh-line) * -1) 0 var(--bh-border);
  }

  .bh-tab {
    display: inline-flex;
    align-items: center;
    height: 40px;
    padding: 0 var(--bh-space-3);
    border: 0;
    border-bottom: var(--bh-line) solid var(--bh-border);
    border-radius: 0;
    background: none;
    color: var(--bh-text-muted);
    font: inherit;
    font-size: var(--bh-text-base);
    font-weight: 600;
    white-space: nowrap;
    text-decoration: none;
    cursor: pointer;
    transition:
      color var(--bh-dur) var(--bh-ease),
      border-color var(--bh-dur) var(--bh-ease),
      box-shadow var(--bh-dur) var(--bh-ease);
  }

  .bh-tab:hover {
    border-bottom-color: var(--bh-border-strong);
    color: var(--bh-text);
    text-decoration: none;
  }

  .bh-tab[aria-selected='true'],
  .bh-tab[aria-current='page'] {
    border-bottom-color: var(--bh-accent);
    box-shadow: inset 0 -1px 0 var(--bh-accent);
    color: var(--bh-text);
  }

  /* A count beside the tab's label. */
  .bh-tab__count {
    margin-left: var(--bh-space-2);
    padding: 0 6px;
    border-radius: var(--bh-radius-tag);
    background: var(--bh-control-fill);
    color: var(--bh-text-muted);
    font-size: var(--bh-text-xs);
    font-variant-numeric: tabular-nums;
    line-height: 1.5;
  }

  .bh-tab[aria-selected='true'] .bh-tab__count {
    background: var(--bh-accent-soft);
    color: var(--bh-accent-text-strong);
  }

  .bh-tab:focus-visible {
    outline-offset: -2px;
    border-radius: var(--bh-radius-sm) var(--bh-radius-sm) 0 0;
  }

  /* ---------- Menus (popover) ---------- */

  .bh-menu {
    position: fixed;
    inset: auto;
    margin: 0;
    min-width: 240px;
    max-width: min(320px, calc(100vw - 32px));
    padding: 6px;
    border: var(--bh-line) solid var(--bh-popper-border);
    border-radius: var(--bh-radius-lg);
    background: var(--bh-surface);
    color: var(--bh-text);
    box-shadow: var(--bh-shadow);
  }

  /* Hidden until ds.js has placed it under its button. */
  .bh-menu:popover-open:not([data-bh-placed]) { visibility: hidden; }

  /* First-visit introduction of a header button (ds.js, data-bh-intro):
     a card under the button, its arrow on the button's centre. */
  .bh-intro {
    position: fixed;
    inset: auto;
    width: min(20rem, calc(100vw - 16px));
    margin: 0;
    padding: var(--bh-space-4);
    overflow: visible;
    border: var(--bh-line) solid var(--bh-popper-border);
    border-radius: var(--bh-radius-lg);
    background: var(--bh-surface);
    color: var(--bh-text);
    box-shadow: var(--bh-shadow);
    font-size: var(--bh-text-sm);
  }

  .bh-intro:popover-open:not([data-bh-placed]) {
    visibility: hidden;
  }

  .bh-intro::before {
    content: '';
    position: absolute;
    top: -7px;
    left: var(--bh-intro-arrow, 50%);
    width: 12px;
    height: 12px;
    border-top: var(--bh-line) solid var(--bh-popper-border);
    border-left: var(--bh-line) solid var(--bh-popper-border);
    background: var(--bh-surface);
    translate: -50% 0;
    rotate: 45deg;
  }

  .bh-intro p {
    margin: 0 0 var(--bh-space-2);
  }

  .bh-intro__title {
    display: flex;
    align-items: center;
    gap: var(--bh-space-2);
    font-family: var(--bh-font-display);
    font-size: var(--bh-text-md);
    font-weight: 600;
  }

  .bh-intro__title .bh-icon {
    color: var(--bh-accent-text);
  }

  .bh-intro__aside {
    color: var(--bh-text-muted);
  }

  .bh-intro__actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--bh-space-2);
    margin-top: var(--bh-space-3);
  }

  @media (prefers-reduced-motion: no-preference) {
    .bh-intro:popover-open[data-bh-placed] {
      animation: bh-intro-in 240ms var(--bh-ease) both;
    }
  }

  @keyframes bh-intro-in {
    from {
      opacity: 0;
      translate: var(--bh-intro-from, 0 -6px);
    }
  }

  /* A tour step beside a rail section: the arrow on its left edge. */
  .bh-intro[data-bh-side='right'] {
    --bh-intro-from: -6px 0;
  }

  .bh-intro[data-bh-side='right']::before {
    top: var(--bh-intro-arrow, 50%);
    left: -7px;
    translate: 0 -50%;
    rotate: -45deg;
  }

  .bh-tour__actions {
    align-items: center;
  }

  .bh-tour__progress {
    margin-right: auto;
    color: var(--bh-text-muted);
    font-size: var(--bh-text-xs);
    font-variant-numeric: tabular-nums;
  }

  /* ---------- Welcome to v2 (ds/_welcome.html) ---------- */

  /* The preview video edge to edge, then three things to know, each led
     by the real part of the interface it names. */
  .bh-welcome {
    width: min(620px, calc(100vw - 32px));
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  .bh-welcome__media {
    position: relative;
    aspect-ratio: 16 / 9;
    background: var(--bh-shell);
  }

  .bh-welcome__media video {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
  }

  .bh-welcome__close {
    position: absolute;
    top: var(--bh-space-3);
    right: var(--bh-space-3);
    background: var(--bh-overlay);
    color: var(--bh-on-overlay);
  }

  .bh-welcome__close:hover {
    background: var(--bh-overlay);
    color: var(--bh-on-overlay);
    opacity: 0.85;
  }

  .bh-welcome__body {
    padding: var(--bh-space-6) var(--bh-space-6) 0;
  }

  .bh-welcome__body h2 {
    font-family: var(--bh-font-display);
    font-size: var(--bh-text-2xl);
    font-weight: 700;
    letter-spacing: var(--bh-display-track);
    line-height: var(--bh-leading-tight);
    text-wrap: balance;
  }

  .bh-welcome__lead {
    max-width: 52ch;
    margin-top: var(--bh-space-2);
    color: var(--bh-text-muted);
    text-wrap: pretty;
  }

  .bh-welcome__list {
    margin: var(--bh-space-5) 0 0;
    padding: 0;
    list-style: none;
  }

  .bh-welcome__list li {
    display: grid;
    grid-template-columns: 5.5rem 1fr;
    gap: var(--bh-space-4);
    align-items: baseline;
    padding: var(--bh-space-3) 0;
    border-top: var(--bh-line) solid var(--bh-border);
  }

  .bh-welcome__list strong {
    font-weight: 600;
  }

  .bh-welcome__list p {
    margin-top: 2px;
    color: var(--bh-text-muted);
    font-size: var(--bh-text-sm);
  }

  /* The lead column holds the interface's own parts: keycaps, tier
     icons in their hues, the colour scheme chips. */
  .bh-welcome__key {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    align-items: center;
    align-self: center;
  }

  .bh-welcome__tiers .bh-tier-icon {
    color: var(--tier);
  }

  .bh-welcome__foot {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    align-items: center;
    gap: var(--bh-space-2);
    padding: var(--bh-space-5) var(--bh-space-6) var(--bh-space-6);
  }

  /* Under the actions, on a line of its own: a way out, not a choice
     on par with them. */
  .bh-welcome__classic {
    flex-basis: 100%;
    order: 1;
    color: var(--bh-text-muted);
    font-size: var(--bh-text-sm);
    text-align: right;
  }

  @media (max-width: 520px) {
    .bh-welcome__body {
      padding: var(--bh-space-5) var(--bh-space-4) 0;
    }

    .bh-welcome__list li {
      grid-template-columns: 1fr;
      gap: var(--bh-space-2);
    }

    .bh-welcome__foot {
      padding: var(--bh-space-4);
    }

    .bh-welcome__foot .bh-btn {
      flex: 1 1 auto;
    }

    .bh-welcome__classic {
      text-align: center;
    }
  }

  @media (prefers-reduced-motion: no-preference) {
    .bh-welcome[open] {
      animation: bh-welcome-in 320ms var(--bh-ease) both;
    }
  }

  @keyframes bh-welcome-in {
    from {
      opacity: 0;
      translate: 0 12px;
      scale: 0.98;
    }
  }

  .bh-menu__head {
    padding: var(--bh-space-3);
    border-radius: calc(var(--bh-radius-lg) - 6px);
    background: var(--bh-accent-soft);
    margin-bottom: 6px;
  }

  .bh-menu__head small {
    display: block;
    color: var(--bh-text-muted);
  }

  .bh-menu__item {
    display: flex;
    align-items: center;
    gap: var(--bh-space-2);
    width: 100%;
    min-height: 36px;
    padding: 0 var(--bh-space-3);
    border: 0;
    border-radius: var(--bh-radius-sm);
    background: none;
    color: var(--bh-text);
    font-size: var(--bh-text-base);
    text-align: left;
    text-decoration: none;
  }

  .bh-menu__count {
    margin-left: auto;
  }

  .bh-menu__item:hover {
    background: var(--bh-surface-hover);
    text-decoration: none;
  }

  .bh-menu__item:focus-visible {
    background: var(--bh-surface-hover);
    text-decoration: none;
    outline: 2px solid var(--bh-focus);
    outline-offset: -2px;
  }

  .bh-menu__item[aria-current='page'],
  .bh-menu__item[aria-pressed='true'] {
    background: var(--bh-accent-soft);
    color: var(--bh-accent-text-strong);
    font-weight: 600;
  }

  .bh-menu__item[aria-pressed='true']:hover {
    background: var(--bh-accent-soft-hover);
  }

  .bh-menu__item[aria-current='page'] .bh-icon,
  .bh-menu__item[aria-pressed='true'] .bh-icon {
    color: var(--bh-accent-text);
  }

  /* A labelled control inside a menu (language). */
  .bh-menu__field {
    display: flex;
    align-items: center;
    gap: var(--bh-space-2);
    padding: var(--bh-space-1) var(--bh-space-3);
  }

  .bh-menu__field > .bh-icon {
    color: var(--bh-text-muted);
  }

  .bh-menu__item .bh-icon,
  .bh-menu__item small {
    color: var(--bh-text-muted);
  }

  .bh-menu__sep {
    height: var(--bh-line);
    margin: 6px var(--bh-space-2);
    background: var(--bh-border);
  }

  .bh-menu__label {
    padding: var(--bh-space-2) var(--bh-space-3) var(--bh-space-1);
    color: var(--bh-text-muted);
    font-size: var(--bh-text-xs);
    font-weight: 600;
  }

  /* Notifications center (ds/_header.html): the latest announcements,
     the unread ones marked with an accent edge. Wider than a menu: each
     item is a title and a line of text. */
  .bh-notices {
    width: min(380px, calc(100vw - 32px));
    max-width: none;
  }

  .bh-notices__head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: var(--bh-space-3);
    padding: var(--bh-space-2) var(--bh-space-3);
    font-size: var(--bh-text-sm);
  }

  .bh-notices__list {
    max-height: min(26rem, 60vh);
    margin: 0;
    padding: 0;
    overflow-y: auto;
    list-style: none;
  }

  .bh-notices__empty {
    margin: 0;
    padding: var(--bh-space-3);
    color: var(--bh-text-muted);
    font-size: var(--bh-text-sm);
  }

  .bh-menu__item.bh-notice {
    display: grid;
    gap: 2px;
    padding-block: var(--bh-space-2);
    box-shadow: inset 3px 0 0 transparent;
  }

  .bh-menu__item.bh-notice.is-unread {
    background: var(--bh-accent-soft);
    box-shadow: inset 3px 0 0 var(--bh-accent-edge);
  }

  .bh-menu__item.bh-notice.is-unread:hover {
    background: var(--bh-accent-soft-hover);
  }

  .bh-notice__head {
    display: flex;
    align-items: center;
    gap: var(--bh-space-2);
    color: var(--bh-text-muted);
    font-size: var(--bh-text-xs);
  }

  .bh-notice__title {
    font-weight: 600;
    line-height: var(--bh-leading-tight);
  }

  .bh-notice__text {
    color: var(--bh-text-muted);
    font-size: var(--bh-text-sm);
    overflow-wrap: anywhere;
  }

  /* Colour scheme picker: a chip of each scheme's header and accent. */
  .bh-swatch {
    flex: none;
    width: 18px;
    height: 18px;
    border-radius: var(--bh-radius-sm);
    background: linear-gradient(135deg, var(--sw-shell) 50%, var(--sw-accent) 50%);
    box-shadow: 0 0 0 1px var(--bh-border-strong);
  }

  .bh-swatch--indigo { --sw-shell: var(--p-indigo-shell); --sw-accent: var(--p-indigo-500); }
  .bh-swatch--gold { --sw-shell: var(--p-propolis); --sw-accent: var(--p-honey-500); }
  .bh-swatch--petrol { --sw-shell: var(--p-petrol-shell); --sw-accent: var(--p-petrol-500); }

  /* ---------- Segments: one choice among a few, all in sight ---------- */

  /* A row of keys on the control fill; the chosen one is raised like the
     current rail item. Items are links (aria-current) or buttons
     (aria-pressed). */
  .bh-segments {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 2px;
    padding: 3px;
    border-radius: var(--bh-radius);
    background: var(--bh-control-fill);
  }

  .bh-segments__item {
    display: inline-flex;
    align-items: center;
    gap: var(--bh-space-2);
    height: var(--bh-control-h-sm);
    padding: 0 var(--bh-space-3);
    border: 1px solid transparent;
    border-radius: var(--bh-radius-sm);
    background: none;
    color: var(--bh-text-muted);
    font: inherit;
    font-size: var(--bh-text-sm);
    font-weight: 600;
    white-space: nowrap;
    text-decoration: none;
    cursor: pointer;
    transition:
      color var(--bh-dur) var(--bh-ease),
      background-color var(--bh-dur) var(--bh-ease);
  }

  .bh-segments__item:hover {
    color: var(--bh-text);
    text-decoration: none;
  }

  .bh-segments__item[aria-current],
  .bh-segments__item[aria-pressed='true'] {
    border-color: var(--bh-nav-active-border);
    background: var(--bh-nav-active);
    box-shadow: 0 var(--bh-ledge) 0 var(--bh-nav-active-border);
    color: var(--bh-nav-active-text);
  }

  .bh-segments__item:focus-visible {
    outline-offset: 1px;
  }

  /* ---------- Filter chips ---------- */

  /* Active filters: one chip per value; the chip drops it. */
  .bh-filter-chips {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--bh-space-2);
    margin-bottom: var(--bh-space-3);
  }

  .bh-filter-chip {
    display: inline-flex;
    align-items: center;
    gap: var(--bh-space-1);
    max-width: 100%;
    height: 28px;
    padding: 0 6px 0 10px;
    border: var(--bh-line) solid var(--bh-accent-edge);
    border-radius: var(--bh-radius-full);
    background: var(--bh-accent-soft);
    color: var(--bh-accent-text-strong);
    font-size: var(--bh-text-sm);
    text-decoration: none;
  }

  .bh-filter-chip > span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .bh-filter-chip:hover {
    background: var(--bh-accent-soft-hover);
    text-decoration: none;
  }

  .bh-filter-chip .bh-icon {
    opacity: 0.7;
  }

  .bh-filter-chip:hover .bh-icon {
    opacity: 1;
  }

  /* ---------- Facets: filter menus ---------- */

  /* A filter menu under a filter bar button: checkboxes (several
     choices, applied together) or menu items (one choice, applied at
     once), with a search field over long lists (ds.js). */
  .bh-facet {
    width: 300px;
    padding: var(--bh-space-2);
  }

  .bh-facet__search {
    margin-bottom: var(--bh-space-2);
  }

  .bh-facet__options {
    display: grid;
    max-height: min(320px, 50vh);
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  .bh-facet__options .bh-check {
    min-height: 34px;
    padding: 0 var(--bh-space-2);
    border-radius: var(--bh-radius-sm);
  }

  .bh-facet__options .bh-check:hover {
    background: var(--bh-surface-hover);
  }

  .bh-facet__options .bh-menu__item {
    min-height: 34px;
    padding: 0 var(--bh-space-2);
  }

  .bh-facet__options .bh-menu__item > span {
    flex: 1;
    min-width: 0;
  }

  /* The tick of the chosen item; the others keep its room. */
  .bh-facet__options .bh-menu__item > .bh-icon {
    visibility: hidden;
  }

  .bh-facet__options .bh-menu__item[aria-pressed='true'] > .bh-icon {
    visibility: visible;
  }

  .bh-facet__options > [hidden] {
    display: none;
  }

  .bh-facet__options > p {
    padding: var(--bh-space-2);
  }

  .bh-facet__foot {
    display: flex;
    justify-content: flex-end;
    margin-top: var(--bh-space-2);
    padding-top: var(--bh-space-2);
    border-top: var(--bh-line) solid var(--bh-border);
  }

  /* On the button: how many values are ticked, or the chosen one. */
  .bh-facet__count {
    display: inline-grid;
    place-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: var(--bh-radius-full);
    background: var(--bh-accent);
    color: var(--bh-on-accent, #fff);
    font-size: var(--bh-text-xs);
    font-weight: 700;
    line-height: 1;
  }

  .bh-facet__value {
    max-width: 16rem;
    overflow: hidden;
    font-weight: 600;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  /* ---------- Hover card ---------- */

  /* Shown by ds.js over [data-bh-hovercard] links: a preview, never the
     only way to an action (the link leads to the same page). */
  .bh-hovercard {
    position: fixed;
    z-index: 50;
    display: grid;
    gap: var(--bh-space-3);
    width: min(22rem, calc(100vw - 16px));
    padding: var(--bh-space-4);
    border: var(--bh-line) solid var(--bh-popper-border);
    border-radius: var(--bh-radius-lg);
    background: var(--bh-surface);
    color: var(--bh-text);
    box-shadow: var(--bh-shadow);
    font-size: var(--bh-text-sm);
  }

  .bh-hovercard[hidden] {
    display: none;
  }

  .bh-hovercard__media {
    display: flex;
    gap: var(--bh-space-3);
    min-width: 0;
  }

  .bh-hovercard__media :is(img, svg.bh-default-poster) {
    flex: none;
    width: 72px;
    height: 108px;
    border-radius: var(--bh-radius-sm);
    background: var(--bh-surface-sunken);
    object-fit: cover;
  }

  /* A person: a round avatar instead of a poster. */
  .bh-hovercard__media--person img {
    width: 56px;
    height: 56px;
    border-radius: 50%;
  }

  .bh-hovercard__text {
    display: grid;
    align-content: start;
    gap: var(--bh-space-2);
    min-width: 0;
  }

  .bh-hovercard__title {
    color: var(--bh-text);
    font-family: var(--bh-font-display);
    font-size: var(--bh-text-md);
    font-weight: 700;
    line-height: 1.25;
    overflow-wrap: anywhere;
  }

  .bh-hovercard__tags,
  .bh-hovercard__actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--bh-space-1);
  }

  .bh-hovercard__actions {
    gap: var(--bh-space-2);
    padding-top: var(--bh-space-3);
    border-top: var(--bh-line) solid var(--bh-border);
  }

  .bh-hovercard__loading {
    display: grid;
    gap: var(--bh-space-2);
  }

  .bh-hovercard__loading .bh-skeleton:last-child {
    width: 60%;
  }

  /* ---------- Dialog ---------- */

  /* The reset zeroes every margin; a modal dialog centres itself with
     margin: auto, so give it back. */
  .bh-dialog {
    margin: auto;
    width: min(560px, calc(100vw - 32px));
    max-height: calc(100dvh - 64px);
    padding: 0;
    border: var(--bh-line) solid var(--bh-popper-border);
    border-radius: var(--bh-radius-xl);
    background: var(--bh-surface);
    color: var(--bh-text);
    box-shadow: var(--bh-shadow-modal);
  }

  .bh-dialog--wide {
    width: min(760px, calc(100vw - 32px));
  }

  .bh-dialog__body {
    overflow-y: auto;
  }

  .bh-dialog::backdrop {
    background: var(--bh-shell-scrim);
  }

  .bh-dialog__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--bh-space-4);
    padding: var(--bh-space-6) var(--bh-space-6) 0;
  }

  .bh-dialog__head h2 {
    font-family: var(--bh-font-display);
    font-size: var(--bh-text-xl);
    font-weight: 700;
  }

  .bh-dialog__head .bh-btn {
    margin: -6px -10px 0 0;
  }

  .bh-dialog__body {
    padding: var(--bh-space-3) var(--bh-space-6) var(--bh-space-6);
  }

  .bh-dialog__foot {
    display: flex;
    justify-content: flex-end;
    gap: var(--bh-space-2);
    padding: 0 var(--bh-space-6) var(--bh-space-6);
  }

  /* ---------- Notices and toasts ---------- */

  .bh-alert {
    display: flex;
    align-items: flex-start;
    gap: var(--bh-space-2);
    padding: var(--bh-space-3) var(--bh-space-4);
    border: var(--bh-line) solid var(--bh-info-line);
    border-radius: var(--bh-radius);
    background: var(--bh-info-soft);
    color: var(--bh-text);
  }

  .bh-alert > .bh-icon {
    margin-top: 0.15em;
    color: var(--bh-info);
  }

  .bh-alert + .bh-alert {
    margin-top: var(--bh-space-2);
  }

  .bh-alert--success { border-color: var(--bh-success-line); background: var(--bh-success-soft); }
  .bh-alert--success > .bh-icon { color: var(--bh-success); }
  .bh-alert--warning { border-color: var(--bh-warning-line); background: var(--bh-warning-soft); }
  .bh-alert--warning > .bh-icon { color: var(--bh-warning); }
  .bh-alert--danger { border-color: var(--bh-danger-line); background: var(--bh-danger-soft); }
  .bh-alert--danger > .bh-icon { color: var(--bh-danger); }

  .bh-alert__body {
    flex: 1;
    min-width: 0;
  }

  .bh-alert__close {
    margin: -0.25rem -0.5rem -0.25rem 0;
  }

  .bh-messages {
    margin-bottom: var(--bh-space-6);
  }

  .bh-toasts {
    position: fixed;
    right: var(--bh-space-4);
    bottom: var(--bh-space-4);
    z-index: 60;
    display: grid;
    gap: var(--bh-space-2);
    width: min(380px, calc(100vw - 32px));
  }

  .bh-toast {
    display: flex;
    align-items: flex-start;
    gap: var(--bh-space-2);
    padding: var(--bh-space-3) var(--bh-space-4);
    border: var(--bh-line) solid var(--bh-popper-border);
    border-radius: var(--bh-radius);
    background: var(--bh-surface);
    color: var(--bh-text);
    box-shadow: var(--bh-shadow);
    animation: bh-toast-in var(--bh-dur) var(--bh-ease);
  }

  .bh-toast > .bh-icon {
    margin-top: 0.15em;
    color: var(--bh-info);
  }

  .bh-toast--success > .bh-icon { color: var(--bh-success); }
  .bh-toast--warning > .bh-icon { color: var(--bh-warning); }
  .bh-toast--error > .bh-icon { color: var(--bh-danger); }

  @keyframes bh-toast-in {
    from {
      opacity: 0;
      transform: translateY(8px);
    }
  }

  /* ---------- Pagination ---------- */

  .bh-pagination {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--bh-space-3);
    margin-top: var(--bh-space-4);
    color: var(--bh-text-muted);
    font-size: var(--bh-text-sm);
  }

  /* Under a table that fills a card: inset like the card body. */
  .bh-card > .bh-pagination {
    margin: 0;
    padding: var(--bh-space-3) var(--bh-space-6);
    border-top: var(--bh-line) solid var(--bh-border);
  }

  .bh-pagination ul {
    display: flex;
    gap: var(--bh-space-1);
    padding: 0;
    list-style: none;
  }

  .bh-pagination a,
  .bh-pagination span[aria-current] {
    display: inline-grid;
    place-items: center;
    min-width: var(--bh-control-h);
    height: var(--bh-control-h);
    padding: 0 var(--bh-space-2);
    border-radius: var(--bh-radius-full);
    color: var(--bh-text);
    font-size: var(--bh-text-base);
    font-weight: 600;
    text-decoration: none;
  }

  .bh-pagination a:hover {
    background: var(--bh-control-fill-hover);
  }

  .bh-pagination span[aria-current] {
    background: var(--bh-accent);
    box-shadow: 0 var(--bh-ledge) 0 var(--bh-accent-ledge);
    color: var(--bh-on-accent);
  }

  /* ---------- Empty and loading ---------- */

  .bh-empty {
    display: grid;
    justify-items: center;
    gap: var(--bh-space-2);
    padding: var(--bh-space-12) var(--bh-space-6);
    color: var(--bh-text-muted);
    text-align: center;
  }

  .bh-empty__title {
    color: var(--bh-text);
    font-family: var(--bh-font-display);
    font-size: var(--bh-text-lg);
    font-weight: 700;
  }

  .bh-empty .bh-btn {
    margin-top: var(--bh-space-2);
  }

  .bh-skeleton {
    display: block;
    height: 0.8em;
    border-radius: var(--bh-radius-sm);
    background: var(--bh-skeleton);
    animation: bh-pulse 1.4s ease-in-out infinite;
  }

  @keyframes bh-pulse {
    50% {
      opacity: 0.5;
    }
  }

  /* ---------- Command palette ---------- */

  /* A modal search, high on the screen so results grow downwards. */
  .bh-palette {
    width: min(680px, calc(100vw - 32px));
    max-height: min(560px, calc(100dvh - 96px));
    margin: 12vh auto auto;
    padding: 0;
    overflow: hidden;
    border: var(--bh-line) solid var(--bh-popper-border);
    border-radius: var(--bh-radius-xl);
    background: var(--bh-surface);
    color: var(--bh-text);
    box-shadow: var(--bh-shadow-modal);
  }

  .bh-palette[open] {
    display: flex;
    flex-direction: column;
  }

  .bh-palette::backdrop {
    background: var(--bh-shell-scrim);
  }

  .bh-palette__field {
    display: flex;
    flex: none;
    align-items: center;
    gap: var(--bh-space-3);
    padding: 0 var(--bh-space-4);
    border-bottom: var(--bh-line) solid var(--bh-border);
  }

  .bh-palette__field > .bh-icon {
    color: var(--bh-accent-text);
    font-size: 1.125rem;
  }

  .bh-palette__input {
    flex: 1;
    min-width: 0;
    height: 3.5rem;
    border: 0;
    background: none;
    color: var(--bh-text);
    font: inherit;
    font-size: var(--bh-text-md);
    outline: none;
  }

  .bh-palette__input::placeholder {
    color: var(--bh-text-faint);
  }

  .bh-palette__field > kbd,
  .bh-palette__foot kbd {
    color: var(--bh-text-muted);
    font-size: var(--bh-text-xs);
  }

  .bh-palette__results {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: var(--bh-space-2);
  }

  .bh-palette__results:empty {
    display: none;
  }

  .bh-palette__section + .bh-palette__section {
    margin-top: var(--bh-space-2);
  }

  .bh-palette__group {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: var(--bh-space-3);
    padding: var(--bh-space-2) var(--bh-space-3) var(--bh-space-1);
    color: var(--bh-text-muted);
    font-size: var(--bh-text-xs);
    font-weight: 600;
  }

  .bh-palette__all {
    color: var(--bh-accent-text);
    font-weight: 500;
  }

  .bh-palette__item {
    display: flex;
    align-items: center;
    gap: var(--bh-space-3);
    min-height: 2.5rem;
    padding: var(--bh-space-1) var(--bh-space-3);
    border-radius: var(--bh-radius);
    cursor: pointer;
  }

  .bh-palette__item[aria-selected='true'] {
    background: var(--bh-accent-soft);
  }

  .bh-palette__icon {
    flex: none;
    width: 1.25rem;
    color: var(--bh-text-muted);
    text-align: center;
  }

  .bh-palette__item[aria-selected='true'] .bh-palette__icon {
    color: var(--bh-accent-text);
  }

  .bh-palette__poster {
    flex: none;
    width: 1.25rem;
    height: 1.875rem;
    border-radius: 3px;
    object-fit: cover;
    background: var(--bh-surface-sunken);
  }

  .bh-palette__text {
    display: flex;
    flex: 1;
    align-items: center;
    gap: var(--bh-space-2);
    min-width: 0;
  }

  .bh-palette__label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .bh-palette__label mark {
    background: none;
    color: var(--bh-accent-text);
    font-weight: 600;
  }

  .bh-palette__meta {
    flex: none;
    max-width: 40%;
    overflow: hidden;
    color: var(--bh-text-muted);
    font-size: var(--bh-text-sm);
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .bh-palette__out {
    flex: none;
    color: var(--bh-text-muted);
  }

  .bh-palette__out:hover {
    color: var(--bh-accent-text);
  }

  .bh-palette__loading {
    display: flex;
    align-items: center;
    gap: var(--bh-space-3);
    padding: var(--bh-space-2) var(--bh-space-3);
    color: var(--bh-text-muted);
    font-size: var(--bh-text-sm);
  }

  .bh-palette__skeleton {
    height: 0.9rem;
    margin: var(--bh-space-3);
  }

  .bh-palette__empty,
  .bh-palette__hint {
    margin: 0;
    padding: var(--bh-space-6) var(--bh-space-5);
    color: var(--bh-text-muted);
    text-align: center;
    text-wrap: balance;
  }

  .bh-palette__foot {
    display: flex;
    flex: none;
    flex-wrap: wrap;
    gap: var(--bh-space-2) var(--bh-space-5);
    padding: var(--bh-space-2) var(--bh-space-4);
    border-top: var(--bh-line) solid var(--bh-border);
    background: var(--bh-surface-sunken);
    color: var(--bh-text-muted);
    font-size: var(--bh-text-xs);
  }

  .bh-palette__foot kbd + kbd {
    margin-left: 2px;
  }

  @media (max-width: 600px) {
    .bh-palette {
      margin-top: var(--bh-space-4);
      max-height: calc(100dvh - 32px);
    }

    .bh-palette__foot {
      display: none;
    }
  }

  /* ---------- Definition lists (detail metadata) ---------- */

  /* Label / value pairs, every other row banded so the eye can follow a
     label across to its value. The band is drawn on both cells, so the
     columns sit flush and padding makes the gutter. */
  .bh-dl {
    display: grid;
    grid-template-columns: minmax(8rem, max-content) 1fr;
    align-items: stretch;
  }

  .bh-dl dt,
  .bh-dl dd {
    padding: var(--bh-space-2) var(--bh-space-3);
  }

  /* Labels are plain text, so they can centre on values that hold a tag
     or a button; values stay block (and stretched, for the band) so their
     inline content keeps flowing. */
  .bh-dl dt {
    display: flex;
    align-items: center;
    color: var(--bh-text-muted);
  }

  .bh-dl dd {
    margin: 0;
    min-width: 0;
    overflow-wrap: anywhere;
  }

  .bh-dl dt:nth-of-type(even),
  .bh-dl dt:nth-of-type(even) + dd {
    background: var(--bh-stripe);
  }

  .bh-dl dt:nth-of-type(even) {
    border-radius: var(--bh-radius-sm) 0 0 var(--bh-radius-sm);
  }

  .bh-dl dt:nth-of-type(even) + dd {
    border-radius: 0 var(--bh-radius-sm) var(--bh-radius-sm) 0;
  }

  /* ---------- Auth pages ---------- */

  .bh-auth {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
    min-height: 100dvh;
  }

  .bh-auth__panel {
    display: flex;
    flex-direction: column;
    padding: var(--bh-space-8) clamp(1rem, 6vw, 5rem);
    background: var(--bh-surface);
  }

  .bh-auth__form {
    width: 100%;
    max-width: 360px;
    margin: auto 0;
    padding: var(--bh-space-10) 0;
  }

  .bh-auth__form h1 {
    margin-bottom: var(--bh-space-2);
    font-size: 2.5rem;
  }

  .bh-auth__lead {
    margin-bottom: var(--bh-space-8);
    color: var(--bh-text-muted);
    font-size: var(--bh-text-md);
  }

  /* Pages beside the sign-in form: a back link above the title and a
     status icon (password reset, logged out). */
  .bh-auth__back {
    margin-bottom: var(--bh-space-6);
    font-size: var(--bh-text-sm);
  }

  .bh-auth__back a {
    display: inline-flex;
    align-items: center;
    gap: var(--bh-space-2);
    color: var(--bh-text-muted);
  }

  .bh-auth__icon {
    margin-bottom: var(--bh-space-4);
    color: var(--bh-accent-text, var(--bh-accent));
    font-size: 2.5rem;
    line-height: 1;
  }

  .bh-auth__icon--success {
    color: var(--bh-success);
  }

  .bh-auth__icon--danger {
    color: var(--bh-danger);
  }

  .bh-auth__form .bh-input,
  .bh-auth__form .bh-select {
    min-height: 44px;
    font-size: var(--bh-text-md);
  }

  .bh-auth__divider {
    display: flex;
    align-items: center;
    gap: var(--bh-space-3);
    margin: var(--bh-space-6) 0;
    color: var(--bh-text-muted);
    font-size: var(--bh-text-sm);
  }

  .bh-auth__divider::before,
  .bh-auth__divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--bh-border);
  }

  .bh-auth__foot {
    display: flex;
    flex-wrap: wrap;
    gap: var(--bh-space-4);
    color: var(--bh-text-muted);
    font-size: var(--bh-text-sm);
  }

  .bh-auth__foot a {
    color: inherit;
  }

  /* The brand side: propolis, the amber logo, and the services as
     floating widget cards. */
  .bh-auth__shelf {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    gap: var(--bh-space-8);
    padding: var(--bh-space-10) clamp(1.5rem, 5vw, 4rem);
    background:
      radial-gradient(60% 50% at 85% 15%, rgb(242 173 29 / 0.28), transparent 70%),
      radial-gradient(50% 40% at 10% 90%, rgb(43 179 255 / 0.22), transparent 70%),
      var(--bh-shell);
    color: var(--bh-shell-text);
    overflow: hidden;
  }

  /* Same inset correction as the header logo, at ~31px artwork. */
  .bh-auth__logo {
    position: absolute;
    top: var(--bh-space-8);
    left: calc(clamp(1.5rem, 5vw, 4rem) - 10px);
    width: auto;
    height: 52px;
  }

  .bh-auth__shelf h2 {
    max-width: 14ch;
    font-family: var(--bh-font-display);
    font-size: clamp(2.25rem, 4.2vw, 3.75rem);
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1;
  }

  .bh-auth__shelf p {
    max-width: 44ch;
    color: var(--bh-shell-muted);
    font-size: var(--bh-text-md);
  }

  .bh-cartons {
    display: grid;
    gap: var(--bh-space-2);
    padding: 0;
    list-style: none;
  }

  .bh-carton {
    display: grid;
    grid-template-columns: auto minmax(4rem, max-content) 1fr;
    align-items: center;
    gap: var(--bh-space-3);
    min-height: 52px;
    padding: 0 var(--bh-space-5);
    border: var(--bh-line) solid var(--bh-shell-border);
    border-radius: var(--bh-radius-full);
    background: var(--bh-shell-raised);
    backdrop-filter: blur(6px);
  }

  .bh-carton::before {
    content: '';
    width: var(--bh-dot);
    height: var(--bh-dot);
    border-radius: 50%;
    background: var(--bh-brand);
  }

  .bh-carton__code {
    font-size: var(--bh-text-base);
    font-weight: 600;
  }

  .bh-carton__desc {
    color: var(--bh-shell-muted);
    font-size: var(--bh-text-sm);
    text-align: right;
  }

  /* ---------- Responsive shell ---------- */

  @media (max-width: 960px) {
    .bh-app {
      grid-template-columns: minmax(0, 1fr);
      grid-template-areas:
        'header'
        'main';
    }

    .bh-menu-toggle {
      display: inline-flex;
    }

    .bh-header {
      gap: var(--bh-space-2);
      padding: 0 var(--bh-space-2);
    }

    .bh-header__logo {
      width: auto;
    }

    .bh-header__logo img {
      height: 32px;
      margin-left: -6px;
    }

    .bh-header__search kbd,
    .bh-shell-btn__label {
      display: none;
    }

    .bh-shell-btn .bh-count {
      position: absolute;
      top: -3px;
      right: -4px;
    }

    .bh-rail {
      position: fixed;
      top: var(--bh-header-h);
      left: 0;
      z-index: 40;
      width: min(var(--bh-rail-w), 85vw);
      translate: -100% 0;
      transition: translate var(--bh-dur) var(--bh-ease);
      box-shadow: var(--bh-shadow);
    }

    [data-nav-open] .bh-rail {
      translate: 0 0;
    }

    /* The drawer is never collapsed. */
    .bh-rail__foot {
      display: none;
    }

    .bh-scrim {
      position: fixed;
      inset: var(--bh-header-h) 0 0;
      z-index: 35;
      background: var(--bh-shell-scrim);
    }

    .bh-main {
      padding: var(--bh-space-5) var(--bh-space-4) var(--bh-space-10);
    }

    .bh-auth {
      grid-template-columns: minmax(0, 1fr);
    }

    .bh-auth__shelf {
      order: -1;
      gap: var(--bh-space-4);
      padding-top: calc(var(--bh-space-8) + 64px);
    }

    .bh-auth__shelf h2 {
      font-size: var(--bh-text-xl);
    }

    .bh-cartons {
      display: none;
    }

    .bh-auth__form {
      padding: var(--bh-space-6) 0;
    }
  }

  @media (max-width: 600px) {
    .bh-header__search {
      display: none;
    }

    /* Phones keep the logo's hexagon: the room goes to the buttons. */
    .bh-header__logo img {
      width: 24px;
      object-fit: cover;
      object-position: left center;
    }

    .bh-search-toggle {
      display: inline-flex;
    }

    .bh-card__head,
    .bh-card__body {
      padding-inline: var(--bh-space-4);
    }

    .bh-card > .bh-filterbar {
      margin-inline: var(--bh-space-4);
    }

    .bh-card > .bh-pagination {
      padding-inline: var(--bh-space-4);
    }

    .bh-dl {
      grid-template-columns: minmax(0, 1fr);
    }

    .bh-dl dt {
      padding-bottom: 0;
    }

    .bh-dl dt:nth-of-type(even) {
      border-radius: var(--bh-radius-sm) var(--bh-radius-sm) 0 0;
    }

    .bh-dl dt:nth-of-type(even) + dd {
      border-radius: 0 0 var(--bh-radius-sm) var(--bh-radius-sm);
    }
  }

  @media (min-width: 601px) {
    .bh-search-toggle {
      display: none;
    }
  }
}

@layer utilities {
  .bh-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }

  .bh-muted {
    color: var(--bh-text-muted);
  }

  .bh-stack > * + * {
    margin-top: var(--bh-space-4);
  }

  .bh-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--bh-space-2);
  }

  .bh-row--between {
    justify-content: space-between;
  }

  .bh-w-auto {
    width: auto;
  }

  .bh-nowrap {
    white-space: nowrap;
  }

  /* A tight vertical stack of badges or small parts, left-aligned. */
  .bh-stack-xs {
    display: grid;
    justify-items: start;
    gap: 4px;
  }

  .bh-mt-3 {
    margin-top: var(--bh-space-3);
  }

  .bh-mt-4 {
    margin-top: var(--bh-space-4);
  }

  .bh-form-narrow {
    max-width: 32rem;
  }

  /* ---------- Disclosure: a collapsible row inside a card ---------- */

  .bh-disclosure {
    border: var(--bh-line) solid var(--bh-border);
    border-radius: var(--bh-radius);
  }

  .bh-disclosure > summary {
    display: flex;
    align-items: center;
    gap: var(--bh-space-2);
    min-height: var(--bh-control-h);
    padding: var(--bh-space-2) var(--bh-space-3);
    border-radius: inherit;
    font-weight: 600;
    cursor: pointer;
    list-style: none;
  }

  .bh-disclosure > summary::-webkit-details-marker {
    display: none;
  }

  .bh-disclosure > summary:hover {
    background: var(--bh-surface-hover);
  }

  .bh-disclosure > summary:focus-visible {
    outline: 2px solid var(--bh-focus);
    outline-offset: 2px;
  }

  .bh-disclosure > summary > .fa-solid,
  .bh-disclosure > summary > .fa-duotone {
    color: var(--bh-accent-text);
  }

  .bh-disclosure > summary > .bh-icon {
    flex: none;
    margin-left: auto;
    color: var(--bh-text-muted);
    transition: transform var(--bh-dur) var(--bh-ease);
  }

  .bh-disclosure:not([open]) > summary > .bh-icon {
    transform: rotate(-90deg);
  }

  .bh-disclosure[open] > summary {
    border-bottom: var(--bh-line) solid var(--bh-border);
    border-radius: var(--bh-radius) var(--bh-radius) 0 0;
  }

  .bh-disclosure__label {
    min-width: 0;
  }

  .bh-disclosure__meta {
    margin-left: auto;
    font-weight: 400;
  }

  /* As specific as the summary icon rule above, so the meta alone takes
     the free space and sits against the chevron. */
  .bh-disclosure > summary > .bh-disclosure__meta + .bh-icon {
    margin-left: 0;
  }

  .bh-disclosure > :not(summary) {
    margin: var(--bh-space-2) var(--bh-space-3);
  }

  .bh-disclosure > .bh-table-wrap {
    margin: 0;
  }

  /* ---------- Yes / no ---------- */

  .bh-bool {
    display: inline-flex;
    align-items: center;
    gap: var(--bh-space-1);
  }

  .bh-bool--yes > i {
    color: var(--bh-success);
  }

  .bh-bool--no > i {
    color: var(--bh-text-faint);
  }

  /* ---------- Journey: a lifecycle as hexagon stops on one line ---------- */

  /* An order's or a source request's stops. The line leading on from a
     stop fills to --fill (0..1): done, it is whole; while processing, it
     is the progress; for a sharing, how much of the link window has
     passed. States: done, current, upcoming, failed, stopped. */
  .bh-journey {
    --bh-node: 28px;
    display: flex;
    margin: 0;
    padding: var(--bh-space-6) var(--bh-space-6) var(--bh-space-5);
    list-style: none;
  }

  .bh-journey__stop {
    position: relative;
    display: grid;
    flex: 1 1 0;
    align-content: start;
    justify-items: start;
    gap: 2px;
    min-width: 0;
  }

  /* The last stop takes only its own width, at the right edge, so the
     line before it runs the rest of the card. */
  .bh-journey__stop:last-child {
    flex: 0 1 auto;
    max-width: 16rem;
  }

  .bh-journey__node {
    display: grid;
    place-items: center;
    width: calc(var(--bh-node) * 0.875);
    height: var(--bh-node);
    margin-bottom: var(--bh-space-2);
    background: var(--bh-border-strong);
    clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%);
    color: var(--bh-on-accent);
    font-size: 0.75rem;
  }

  .bh-journey__node::before {
    content: '';
    grid-area: 1 / 1;
    width: calc(100% - 4px);
    height: calc(100% - 4.6px);
    background: var(--bh-surface);
    clip-path: inherit;
  }

  .bh-journey__node > .bh-icon {
    grid-area: 1 / 1;
    position: relative;
  }

  .bh-journey__stop--done .bh-journey__node,
  .bh-journey__stop--done .bh-journey__node::before {
    background: var(--bh-accent);
  }

  .bh-journey__stop--current .bh-journey__node {
    background: var(--bh-accent-edge);
  }

  .bh-journey__stop--current .bh-journey__node::before {
    background: var(--bh-accent-soft);
  }

  /* Where the order is now: a honey core that breathes while it runs. */
  .bh-journey__stop--current .bh-journey__node::after {
    content: '';
    grid-area: 1 / 1;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--bh-accent);
    animation: bh-journey-live 1.6s var(--bh-ease) infinite alternate;
  }

  @keyframes bh-journey-live {
    from { transform: scale(0.7); opacity: 0.6; }
    to { transform: scale(1); opacity: 1; }
  }

  @media (prefers-reduced-motion: reduce) {
    .bh-journey__stop--current .bh-journey__node::after {
      animation: none;
    }
  }

  .bh-journey__stop--failed .bh-journey__node,
  .bh-journey__stop--failed .bh-journey__node::before {
    background: var(--bh-danger-solid);
    color: #fff;
  }

  .bh-journey__stop--stopped .bh-journey__node,
  .bh-journey__stop--stopped .bh-journey__node::before {
    background: var(--bh-text-muted);
    color: var(--bh-surface);
  }

  /* From this node's right edge to the next node's left edge. */
  .bh-journey__line {
    position: absolute;
    top: calc(var(--bh-node) / 2 - 2px);
    left: calc(var(--bh-node) * 0.875 + var(--bh-space-2));
    right: var(--bh-space-2);
    height: 4px;
    border-radius: var(--bh-radius-full);
    background: var(--bh-border);
  }

  .bh-journey__line::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: var(--bh-accent);
    transform: scaleX(var(--fill, 0));
    transform-origin: left;
    transition: transform 600ms var(--bh-ease);
  }

  .bh-journey__line--failed::before {
    background: var(--bh-danger-solid);
  }

  .bh-journey__line--stopped::before {
    background: var(--bh-text-muted);
  }

  /* Time on the line: how long it took, or how long the links stay
     open. It sits above the line, on the card. */
  .bh-journey__line-note {
    position: absolute;
    bottom: calc(100% + var(--bh-space-1));
    left: 50%;
    translate: -50% 0;
    padding: 0 var(--bh-space-2);
    color: var(--bh-text-muted);
    font-size: var(--bh-text-xs);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
  }

  .bh-journey__label {
    font-family: var(--bh-font-display);
    font-size: var(--bh-text-md);
    font-weight: 700;
    letter-spacing: -0.01em;
  }

  .bh-journey__stop--upcoming .bh-journey__label {
    color: var(--bh-text-muted);
    font-weight: 600;
  }

  .bh-journey__stop--failed .bh-journey__label {
    color: var(--bh-danger);
  }

  .bh-journey__when {
    color: var(--bh-text-muted);
    font-size: var(--bh-text-sm);
    font-variant-numeric: tabular-nums;
  }

  .bh-journey__note {
    margin-top: var(--bh-space-1);
    font-size: var(--bh-text-sm);
  }

  /* Narrow screens: the journey runs down, the line between nodes. */
  @media (max-width: 600px) {
    .bh-journey {
      flex-direction: column;
      gap: var(--bh-space-8);
      padding-inline: var(--bh-space-4);
    }

    .bh-journey__stop,
    .bh-journey__stop:last-child {
      max-width: none;
      padding-left: calc(var(--bh-node) + var(--bh-space-3));
    }

    .bh-journey__node {
      position: absolute;
      top: 0;
      left: 0;
    }

    .bh-journey__line {
      top: calc(var(--bh-node) + var(--bh-space-2));
      bottom: calc(-1 * var(--bh-space-8) + var(--bh-space-2));
      left: calc(var(--bh-node) * 0.4375 - 2px);
      right: auto;
      width: 4px;
      height: auto;
    }

    .bh-journey__line::before {
      transform: scaleY(var(--fill, 0));
      transform-origin: top;
    }

    .bh-journey__line-note {
      bottom: 0;
      left: calc(100% + var(--bh-space-3) + var(--bh-node) * 0.4375);
      translate: none;
      padding: 0;
    }
  }
}
