/*
 * Beam shared components — Stage 1.U S3.
 *
 * Gallery coverage index:
 * primary-btn, danger-btn, secondary-btn, tertiary-btn, icon-btn, link-btn, btn-primary, btn-tertiary,
 * field, field-affix, input-base, beam-select, beam-multi-select,
 * beam-checkbox, beam-radio, beam-toggle, segmented-control, toggle-chip,
 * beam-panel, beam-section, beam-table, beam-table-toolbar,
 * workspace, workflow-tabs,
 * beam-tooltip, tag-chip, meta-chip, summary-strip, beam-banner,
 * beam-modal, file-upload, file-upload-item, download-csv-button,
 * ag-theme-beam, beam-empty-state.
 */

.primary-btn,
.btn-primary,
.danger-btn,
.secondary-btn,
.btn-tertiary,
.tertiary-btn,
.download-csv-button {
    align-items: center;
    appearance: none;
    border-radius: var(--radius-button);
    box-sizing: border-box;
    cursor: pointer;
    display: inline-flex;
    font-family: inherit;
    /* 14px / 20px, the styleguide's body-medium (Leonie, 22 Oct 2026). This
       read --body-small-font-size / -line-height, which no file defines, so
       every button took the text size around it: 16px on most pages, 14px
       on the styles page. */
    font-size: var(--body-medium-regular-font-size);
    font-weight: var(--headings-large-h5-font-weight);
    gap: var(--space-2);
    justify-content: center;
    line-height: var(--body-medium-regular-line-height);
    min-height: var(--control-height);
    padding: var(--control-pad-y) var(--control-pad-x);
    text-decoration: none;
    white-space: nowrap;
}

/* Primary is TEAL, everywhere (decision D-06).
   `.btn-primary` had two contradictory definitions: teal in buttons.css (Figma Buttons 2.0,
   `--primary-300`) and near-black here. This file is unlayered and loads after main.css, so the
   near-black won on every surface that links it — which is why site-setup.css:1984 carries a
   `button.btn-primary` specificity patch to force teal back, and why the three surfaces using the
   `.primary-btn` spelling (admin globals, site globals, ui-gallery) rendered near-black.
   Teal is the shipped brand action colour, so it wins and the near-black is retired. */
.primary-btn,
.btn-primary {
    background: var(--primary-300);
    border: 1px solid var(--primary-300);
    color: var(--corelight-100);
}

/* Destructive (UI standards T60815): delete/remove only, never for a main action. */
.danger-btn {
    background: var(--alert-700);
    border: 1px solid var(--alert-700);
    color: var(--corelight-100);
}

.danger-btn:hover:not(:disabled) {
    background: var(--alert-900);
    border-color: var(--alert-900);
}

.secondary-btn,
.btn-tertiary,
.download-csv-button {
    background-color: var(--corelight-100);
    border: 1px solid var(--corelight-900);
    border-color: var(--corelight-900);
    color: var(--coredark-700);
}

/* Tertiary = the ghost/text tier the vocabulary was missing (standards §9). Transparent until
   hovered, no border, so it reads as clearly subordinate to the outlined secondary. Cancel in a
   modal footer and Back in a page action bar are the canonical uses. */
.tertiary-btn {
    background: transparent;
    border: 1px solid transparent;
    color: var(--coredark-700);
}

.tertiary-btn:hover:not(:disabled) {
    background: var(--light-300);
}

.primary-btn:hover:not(:disabled):not([aria-disabled="true"]),
.btn-primary:hover:not(:disabled) {
    background: var(--primary-500);
    border-color: var(--primary-500);
}

.secondary-btn:hover:not(:disabled),
.btn-tertiary:hover:not(:disabled),
.download-csv-button:hover:not(:disabled) {
    background: var(--corelight-300);
}

/* Disabled is a MUTED TREATMENT, not a pale wash of the enabled colour (standards §9, S-02).
   `opacity: .45` over teal produced a pale mint that is indistinguishable from an idle-but-
   enabled Save — the audit measured exactly that confusion on the component modals and Add Site.
   A disabled control now reads as grey, so "can't press this" is legible without hovering, and
   the text keeps enough contrast to be read (the pale-teal-on-white combination failed §12). */
.primary-btn:disabled,
.primary-btn[aria-disabled="true"],
.btn-primary:disabled,
.danger-btn:disabled,
.secondary-btn:disabled,
.btn-tertiary:disabled,
.tertiary-btn:disabled,
.download-csv-button:disabled {
    background: var(--light-700);
    border-color: var(--light-700);
    color: var(--coredark-100);
    cursor: not-allowed;
    opacity: 1;
}

.primary-btn--compact,
.danger-btn--compact,
.secondary-btn--compact,
.btn-primary--compact,
.btn-tertiary--compact,
.tertiary-btn--compact {
    min-height: var(--control-height-sm);
    padding-inline: var(--space-4);
}

.btn-icon {
    align-items: center;
    display: inline-flex;
    flex: 0 0 auto;
    justify-content: center;
}

.icon-btn {
    align-items: center;
    appearance: none;
    background: var(--corelight-100);
    border: 1px solid var(--corelight-900);
    border-radius: var(--radius-button);
    color: var(--coredark-700);
    cursor: pointer;
    display: inline-flex;
    font-family: inherit;
    font-size: var(--body-large-font-size);
    height: var(--control-height);
    justify-content: center;
    line-height: var(--body-large-line-height);
    padding: 0;
    width: var(--control-height);
}

.icon-btn--compact {
    box-sizing: border-box;
    height: var(--control-height-icon-compact);
    width: var(--control-height-icon-compact);
}

.icon-btn--lg {
    height: calc(var(--control-height) + var(--space-2));
    width: calc(var(--control-height) + var(--space-2));
}

.icon-btn:hover:not(:disabled) {
    background: var(--corelight-300);
}

.link-btn {
    appearance: none;
    background: transparent;
    border: 0;
    color: var(--text-link);
    cursor: pointer;
    font: inherit;
    padding: 0;
    text-decoration: underline;
    text-underline-offset: var(--radius-xs);
}

.field {
    color: var(--coredark-700);
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    min-width: 0;
}

.field > span:first-child,
.field__label {
    color: var(--coredark-700);
    font-size: var(--body-medium-regular-font-size);
    font-weight: var(--headings-large-h5-font-weight);
    line-height: var(--body-medium-regular-line-height);
}

.field-grid {
    display: grid;
    gap: var(--space-4);
    grid-template-columns: repeat(auto-fit, minmax(min(100%, calc(var(--drawer-w) - var(--space-8))), 1fr));
}

/* Form controls stay at 16px / 24px (the styleguide's body-large) while
   buttons, tabs and labels are 14px: iOS Safari zooms into any focused field
   under 16px (Harry, #499, 23 Oct). */
.input-base,
.field input:not([type="checkbox"]):not([type="radio"]),
.field textarea,
.field select,
.beam-select {
    appearance: none;
    background: var(--corelight-100);
    border: 1px solid var(--corelight-900);
    border-radius: var(--radius-input);
    box-sizing: border-box;
    color: var(--coredark-700);
    font-family: inherit;
    font-size: var(--body-large-regular-font-size);
    line-height: var(--body-large-regular-line-height);
    min-height: var(--control-height);
    padding: var(--space-2) var(--space-3);
    width: 100%;
}

/* Read-only: a value already decided elsewhere (the Create user modal's
   partner / customer, fixed by the side menu's selection). */
.input-base[readonly],
.field input[readonly]:not([type="checkbox"]):not([type="radio"]) {
    background: var(--light-300);
    color: var(--dark-300);
    cursor: default;
}

.field textarea {
    min-height: calc(var(--control-height) * 2);
    resize: vertical;
}

.field input:focus,
.field textarea:focus,
.field select:focus,
.input-base:focus,
.beam-select:focus {
    border-color: var(--text-link);
    box-shadow: 0 0 0 var(--radius-xs) var(--map-polygon-hover);
    outline: none;
}

.field-affix {
    align-items: stretch;
    display: flex;
    min-width: 0;
    position: relative;
}

.field-affix input {
    padding-right: calc(var(--space-8) + var(--space-4));
}

.field-affix__suffix,
.input-suffix,
.input-suffix-right {
    align-items: center;
    color: var(--text-secondary);
    display: inline-flex;
    font-size: var(--body-medium-regular-font-size);
    inset-block: 0;
    padding-inline: var(--space-3);
    pointer-events: none;
    position: absolute;
    right: 0;
}

.beam-select,
.field select {
    background-image: linear-gradient(45deg, transparent 50%, var(--coredark-700) 50%),
        linear-gradient(135deg, var(--coredark-700) 50%, transparent 50%);
    background-position: calc(100% - var(--space-4)) 50%,
        calc(100% - var(--space-3)) 50%;
    background-repeat: no-repeat;
    background-size: var(--space-1) var(--space-1),
        var(--space-1) var(--space-1);
    padding-right: var(--space-8);
}

.beam-checkbox,
.beam-radio {
    align-items: center;
    color: var(--coredark-700);
    display: inline-flex;
    font-size: var(--body-medium-regular-font-size);
    gap: var(--space-2);
    line-height: var(--body-medium-regular-line-height);
}

.beam-checkbox input,
.beam-radio input {
    accent-color: var(--coredark-700);
    height: var(--space-4);
    width: var(--space-4);
}

.beam-toggle {
    align-items: center;
    color: var(--coredark-700);
    cursor: pointer;
    display: inline-flex;
    font-size: var(--body-medium-regular-font-size);
    gap: var(--space-2);
}

.beam-toggle input {
    appearance: none;
    background: var(--corelight-900);
    border-radius: var(--control-height);
    cursor: pointer;
    height: var(--space-5);
    position: relative;
    width: calc(var(--space-8) + var(--space-2));
}

.beam-toggle input::after {
    background: var(--corelight-100);
    border-radius: 50%;
    content: "";
    height: calc(var(--space-4) - var(--radius-xs));
    left: var(--radius-xs);
    position: absolute;
    top: var(--radius-xs);
    transition: transform 120ms ease;
    width: calc(var(--space-4) - var(--radius-xs));
}

.beam-toggle input:checked {
    background: var(--coredark-700);
}

.beam-toggle input:checked::after {
    transform: translateX(var(--space-5));
}

.segmented-control,
.beam-multi-select__trigger-row {
    align-items: center;
    background: var(--corelight-100);
    border: 1px solid var(--corelight-900);
    border-radius: var(--radius-md);
    display: inline-flex;
    overflow: hidden;
}

.segmented-control__button {
    appearance: none;
    background: transparent;
    border: 0;
    color: var(--coredark-700);
    cursor: pointer;
    font-family: inherit;
    font-size: var(--body-medium-regular-font-size);
    font-weight: var(--headings-large-h5-font-weight);
    line-height: var(--body-medium-regular-line-height);
    min-height: var(--control-height-sm);
    padding: var(--space-2) var(--space-4);
}

/* The link form, for a control whose options are pages (Manage's ranges and
   levels, CPM T61701): an <a> is inline, so min-height would not apply. */
a.segmented-control__button {
    align-items: center;
    display: inline-flex;
    justify-content: center;
    text-decoration: none;
}

.segmented-control__button + .segmented-control__button {
    border-left: 1px solid var(--border-strong);
}

.segmented-control__button--active,
.segmented-control__button[aria-selected="true"] {
    /* Dark, not the settings-surface blue (--text-link): UI standards T60816. */
    background: var(--dark-300);
    color: var(--corelight-100);
}

/* The control clips its corners (overflow: hidden), which also clipped the
   global focus ring (globals.css, offset 2px outside the button): keyboard
   focus showed only a sliver at the divider. Inset, the ring sits just inside
   the button's edge, whole. */
.segmented-control__button:focus-visible {
    outline-offset: -2px;
}

.toggle-chip,
.tag-chip,
.meta-chip {
    align-items: center;
    appearance: none;
    background: var(--corelight-300);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-md);
    color: var(--coredark-700);
    cursor: pointer;
    display: inline-flex;
    font-family: inherit;
    font-size: var(--body-medium-regular-font-size);
    gap: var(--space-1);
    line-height: var(--body-medium-regular-line-height);
    padding: var(--space-2) var(--space-3);
}

.toggle-chip--active,
.tag-chip--selected,
.meta-chip--selected {
    background: var(--coredark-700);
    border-color: var(--coredark-700);
    color: var(--corelight-100);
}

.beam-panel,
.beam-section {
    background: var(--surface-panel);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-lg);
    color: var(--text-primary);
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
    min-width: 0;
    padding: var(--space-5);
}

.beam-section {
    border-radius: 0;
    border-inline: 0;
    padding: var(--space-6);
}

.beam-panel__header,
.beam-section__header,
.beam-table-toolbar {
    align-items: center;
    display: flex;
    gap: var(--space-3);
    justify-content: space-between;
    min-width: 0;
}

.beam-panel__title,
.beam-section__title {
    color: var(--text-primary);
    font-size: var(--headings-large-h4-font-size);
    font-weight: var(--headings-large-h4-font-weight);
    line-height: var(--headings-large-h4-line-height);
    margin: 0;
}

.beam-panel__description,
.beam-section__description,
.beam-empty-state {
    color: var(--text-secondary);
    font-size: var(--body-medium-regular-font-size);
    line-height: var(--body-medium-regular-line-height);
    margin: 0;
}

.beam-empty-state {
    align-items: center;
    border: 1px dashed var(--corelight-900);
    border-radius: var(--radius-md);
    display: flex;
    justify-content: center;
    min-height: calc(var(--control-height) * 3);
    padding: var(--space-6);
}

.beam-table {
    border-collapse: separate;
    border-spacing: 0;
    color: var(--text-primary);
    font-size: var(--body-medium-regular-font-size);
    line-height: var(--body-medium-regular-line-height);
    width: 100%;
}

.beam-table th,
.beam-table td {
    border-bottom: 1px solid var(--surface-divider);
    padding: var(--space-3);
    text-align: left;
    vertical-align: middle;
}

.beam-table th {
    background: var(--table-header-bg);
    border-radius: 0;
    color: var(--table-header-fg);
    font-size: var(--table-header-font-size);
    font-weight: var(--table-header-font-weight);
}

.beam-table__double-text {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
}

.beam-table__secondary {
    color: var(--text-secondary);
}

.beam-table__status {
    background: var(--table-status-bg);
    border-radius: var(--radius-sm);
    color: var(--table-status-text);
    display: inline-flex;
    font-weight: var(--headings-large-h5-font-weight);
    padding: var(--space-1) var(--space-2);
}

.beam-table__progress {
    background: var(--surface-muted);
    border-radius: var(--radius-sm);
    height: var(--space-2);
    overflow: hidden;
}

.beam-table__progress-bar {
    background: var(--table-progress-fill);
    height: 100%;
}

/* ── Standard table (CPM T60406) ──────────────────────────────────────────
 * com.beam.ui.components/data-table + /js/components/data-table.js.
 * The look is defined once, here: purple headers, hairline rules, the 14px
 * dense-data step, numbers right-aligned in tabular figures. It is scoped to
 * .beam-data-table so the class-only .beam-table users (admin globals, round
 * history) keep today's look until they migrate (plan phase 4).
 */
.beam-data-table {
    --beam-data-table-header-fg: var(--beam-purple);
    --beam-data-table-rule: var(--surface-divider);
    --beam-data-table-font-size: var(--body-medium-regular-font-size); /* 14px */
    --beam-data-table-line-height: var(--body-medium-regular-line-height);
    /* Never stretched by a flex or grid parent: align-self covers flex,
       justify-self covers grid's inline axis. */
    align-self: flex-start;
    display: inline-flex;
    flex-direction: column;
    gap: var(--space-3);
    justify-self: start;
    max-width: 100%;
    min-width: 0;
    vertical-align: top;
}

/* As wide as the content needs by default (R6); --full fills its container
   in a block, flex or grid parent alike. */
.beam-data-table--full {
    align-self: stretch;
    display: flex;
    justify-self: stretch;
    width: 100%;
}

/* The progress track and fill are empty <span>s: they need to be blocks to
   take a height, and the track a width of its own in a table that fits its
   content. */
.beam-data-table .beam-table__progress,
.beam-data-table .beam-table__progress-bar {
    display: block;
}

.beam-data-table .beam-table__progress {
    min-width: calc(var(--space-8) * 3);
}

/* The toolbar, filter row, filtered-out rows and hidden columns all use the
   `hidden` attribute; a component rule setting `display` must never win. */
.beam-data-table [hidden],
.beam-data-table[hidden] {
    display: none !important;
}

.beam-data-table__toolbar {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-3);
}

.beam-data-table__search,
.beam-data-table__filter {
    background: var(--corelight-100);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-input);
    color: var(--text-primary);
    font: inherit;
    font-size: var(--beam-data-table-font-size);
    min-width: 0;
}

.beam-data-table__search {
    flex: 1 1 calc(var(--space-8) * 7);
    max-width: calc(var(--space-8) * 10);
    min-height: var(--control-height-sm);
    padding: var(--space-1) var(--space-3);
}

.beam-data-table__search:focus-visible,
.beam-data-table__filter:focus-visible,
.beam-data-table__sort:focus-visible {
    outline: 2px solid var(--primary-100);
    outline-offset: 1px;
}

.beam-data-table__count {
    color: var(--text-secondary);
    font-size: var(--body-small-regular-font-size);
    margin-inline-start: auto;
    white-space: nowrap;
}

/* The chooser panel is anchored to its trigger's wrapper, so it opens directly
   under the button that opened it (R5), whatever the page scroll is. */
.beam-data-table__chooser {
    position: relative;
}

.beam-data-table__chooser-panel {
    background: var(--surface-panel);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-md);
    box-shadow: 0 var(--space-1) var(--space-3) rgba(0, 0, 0, 0.12);
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
    min-width: calc(var(--space-8) * 6);
    padding: var(--space-2);
    position: absolute;
    right: 0;
    top: calc(100% + var(--space-1));
    z-index: var(--z-dropdown);
}

.beam-data-table__chooser-option {
    align-items: center;
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: flex;
    font-size: var(--beam-data-table-font-size);
    gap: var(--space-2);
    padding: var(--space-1) var(--space-2);
    white-space: nowrap;
}

.beam-data-table__chooser-option:hover {
    background: var(--surface-muted);
}

.beam-data-table__scroll {
    max-width: 100%;
    overflow-x: auto;
}

.beam-data-table .beam-table {
    font-size: var(--beam-data-table-font-size);
    line-height: var(--beam-data-table-line-height);
    width: auto;
}

.beam-data-table--full .beam-table {
    width: 100%;
}

.beam-data-table .beam-table th,
.beam-data-table .beam-table td {
    border-bottom: 1px solid var(--beam-data-table-rule);
    padding: var(--space-2) var(--space-3);
}

.beam-data-table .beam-data-table__head th {
    background: var(--table-header-bg);
    color: var(--beam-data-table-header-fg);
    font-size: var(--body-medium-bold-font-size); /* 14px — up from the 12px .beam-table header */
    font-weight: 700;
    vertical-align: bottom;
}

/* A long label ("Annual savings") wraps rather than setting its column wider
   than the figures under it, which is where the empty gaps in a table come
   from (R6). Single words never break. */
.beam-data-table__head .beam-data-table__label {
    text-wrap: balance;
    white-space: normal; /* numeric headers are nowrap; their label still wraps */
}

/* The header cell: sort button and funnel side by side, the resize handle on
   its right edge. A numeric header mirrors it so the label's right edge stays
   over the figures. */
.beam-data-table .beam-data-table__head th {
    position: relative;
}

.beam-data-table__th {
    align-items: flex-end;
    display: flex;
    gap: var(--space-1);
}

.beam-data-table th.is-numeric .beam-data-table__th {
    flex-direction: row-reverse;
}

/* The funnel (AG Grid's column-filter button), in place of a row of filter
   controls under the headers. Inert and arrow-less until enhanced, like the
   sort button. */
.beam-data-table__funnel {
    align-items: center;
    appearance: none;
    background: none;
    border: 0;
    border-radius: var(--radius-xs);
    color: var(--text-secondary);
    cursor: pointer;
    display: inline-flex;
    flex: none;
    height: var(--space-5);
    justify-content: center;
    opacity: 0.55;
    padding: 0;
    width: var(--space-5);
}

.beam-data-table__funnel:hover,
.beam-data-table__funnel[aria-expanded="true"] {
    background: var(--surface-muted);
    opacity: 1;
}

/* An active filter's funnel is Beam pink, so a filtered column stands out
   from the purple headers at a glance. */
.beam-data-table__funnel.is-active {
    color: var(--beam-pink);
    opacity: 1;
}

.beam-data-table__funnel:focus-visible {
    opacity: 1;
    outline: 2px solid var(--primary-100);
    outline-offset: 1px;
}

.beam-data-table:not(.is-enhanced) .beam-data-table__funnel,
.beam-data-table:not(.is-enhanced) .beam-data-table__resizer {
    display: none;
}

/* The popovers' container takes no room of its own — a flex item here would
   add the wrapper's gap under every filterable table. */
.beam-data-table__filter-panels {
    display: contents;
}

/* The funnel's popover. position: fixed and placed by data-table.js from the
   funnel's box, so the table's horizontal scroll box cannot clip it. */
.beam-data-table__filter-panel {
    background: var(--surface-panel);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-md);
    box-shadow: 0 var(--space-1) var(--space-3) rgba(0, 0, 0, 0.12);
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    min-width: calc(var(--space-8) * 7);
    padding: var(--space-3);
    position: fixed;
    z-index: var(--z-dropdown);
}

.beam-data-table__filter-title {
    color: var(--beam-data-table-header-fg);
    font-size: var(--body-small-regular-font-size);
    font-weight: 700;
}

.beam-data-table__filter {
    padding: var(--space-1) var(--space-2);
    width: 100%;
}

.beam-data-table__filter-clear {
    align-self: flex-start;
    font-size: var(--body-small-regular-font-size);
}

/* Drag handle on each header's right edge; a hairline shows on hover. Wholly
   INSIDE its own cell: after a resize the cells clip (fixed layout), and a
   handle hanging past the edge would be half hidden under the next header. */
.beam-data-table__resizer {
    bottom: 0;
    cursor: col-resize;
    position: absolute;
    right: 0;
    top: 0;
    touch-action: none;
    width: var(--space-2);
    z-index: 1;
}

.beam-data-table__resizer::after {
    background: transparent;
    bottom: 25%;
    content: "";
    right: 0;
    position: absolute;
    top: 25%;
    width: 2px;
}

.beam-data-table__resizer:hover::after,
.beam-data-table__resizer:focus-visible::after,
.beam-data-table__resizer.is-dragging::after {
    background: var(--border-default);
}

.beam-data-table__resizer:focus-visible {
    outline: none;
}

/* After the first resize the table is fixed-layout: a column can then be
   narrower than its content, which ellipses. */
.beam-data-table .beam-table.is-fixed-layout {
    table-layout: fixed;
}

/* Cells clip at their column's edge; text still wraps (a long word breaks)
   and only the single-line cells — numbers, dates, header labels — ellipse. */
.beam-data-table .beam-table.is-fixed-layout th,
.beam-data-table .beam-table.is-fixed-layout td {
    overflow: hidden;
    overflow-wrap: anywhere;
    text-overflow: ellipsis;
}

.beam-data-table .beam-table.is-fixed-layout .beam-data-table__th,
.beam-data-table .beam-table.is-fixed-layout .beam-data-table__sort {
    max-width: 100%;
    min-width: 0;
}

/* A header label keeps wrapping ("Annual / savings"); it breaks mid-word only
   in a column the user has made too narrow for its words. */
.beam-data-table .beam-table.is-fixed-layout .beam-data-table__label {
    min-width: 0;
    overflow: hidden;
}

.beam-data-table__sort-icon {
    flex: none;
}

/* The totals row: always last (it is the tfoot, so no sort moves it). */
.beam-data-table .beam-table tfoot td {
    background: var(--table-header-bg);
    border-bottom: 0;
    border-top: 1px solid var(--beam-data-table-header-fg);
    color: var(--text-primary);
    font-weight: 700;
}

.beam-data-table .beam-table tfoot .beam-data-table__totals-label {
    color: var(--beam-data-table-header-fg);
}

/* tabular-nums alone is not enough in Arial: kerning still pulls a "11" pair
   together (1111 measures 28px against 8888's 31px), so figures only line up
   by place value with kerning off. */
.beam-data-table .beam-table .is-numeric {
    font-kerning: none;
    font-variant-numeric: tabular-nums;
    text-align: right;
    white-space: nowrap;
}

.beam-data-table .beam-table td.is-date {
    font-kerning: none;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.beam-data-table__sort {
    align-items: center;
    appearance: none;
    background: none;
    border: 0;
    color: inherit;
    cursor: pointer;
    display: inline-flex;
    font: inherit;
    gap: var(--space-2);
    margin: 0;
    padding: 0;
    text-align: inherit;
}

/* Numeric headers put the arrow on the left so the label's right edge lines
   up with the numbers under it. */
.beam-data-table th.is-numeric .beam-data-table__sort {
    flex-direction: row-reverse;
}

/* Until data-table.js runs the sort buttons are disabled and show no arrows:
   with no JS a header must read as a header, not as a control that does
   nothing. */
.beam-data-table__sort:disabled {
    cursor: default;
}

.beam-data-table:not(.is-enhanced) .beam-data-table__sort-icon {
    display: none;
}

.beam-data-table__sort-icon {
    display: inline-flex;
    flex-direction: column;
    gap: 2px;
}

.beam-data-table__sort-icon::before,
.beam-data-table__sort-icon::after {
    border-inline: 4px solid transparent;
    content: "";
    opacity: 0.3;
}

.beam-data-table__sort-icon::before {
    border-bottom: 4px solid currentColor;
}

.beam-data-table__sort-icon::after {
    border-top: 4px solid currentColor;
}

th[aria-sort="ascending"] .beam-data-table__sort-icon::before,
th[aria-sort="descending"] .beam-data-table__sort-icon::after {
    opacity: 1;
}

th[aria-sort="ascending"] .beam-data-table__sort-icon::after,
th[aria-sort="descending"] .beam-data-table__sort-icon::before {
    opacity: 0;
}

.beam-data-table .beam-table tbody tr:hover td {
    background: var(--surface-muted);
}

/* R7: pins and selections, where the table has them. Pinned rows stay first
   under every sort; the rule under the last one separates them from the rest. */
.beam-data-table .beam-table tr.is-pinned td:first-child {
    box-shadow: inset 3px 0 0 var(--beam-purple);
}

.beam-data-table .beam-table tr.is-pinned:not(:has(+ tr.is-pinned)) td {
    border-bottom: 1px solid var(--beam-data-table-header-fg);
}

.beam-data-table .beam-table tbody tr.is-selected td,
.beam-data-table .beam-table tbody tr.is-selected:hover td {
    background: var(--light-500);
}

.beam-data-table .beam-table tr.is-selected td:first-child {
    box-shadow: inset 3px 0 0 var(--primary-100);
}

.beam-data-table__empty td {
    color: var(--text-secondary);
    padding: var(--space-6);
    text-align: center;
}

.summary-strip {
    display: grid;
    gap: var(--space-3);
    grid-template-columns: repeat(auto-fit, minmax(calc(var(--drawer-collapse-handle-w) * 5), 1fr));
}

.summary-strip__item {
    background: var(--surface-panel);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
    padding: var(--space-3);
}

.summary-strip__label {
    color: var(--text-secondary);
    font-size: var(--body-medium-regular-font-size);
    line-height: var(--body-medium-regular-line-height);
}

.summary-strip__value {
    color: var(--text-primary);
    font-size: var(--headings-large-h4-font-size);
    font-weight: var(--headings-large-h4-font-weight);
    line-height: var(--headings-large-h4-line-height);
}

/* Headline numbers: a compact tile, the value in the heading face and the
   page title's colour, the tiles side by side in one row, each sized to its
   content (wrapping only on a narrow screen) rather than to the container. */
.summary-strip--headline {
    display: flex;
    flex-wrap: wrap;
}
.summary-strip--headline .summary-strip__item {
    gap: 0;
    min-width: 6.5rem;
    padding: var(--space-1) var(--space-3);
}
.summary-strip__item--success .summary-strip__value,
.summary-strip--headline .summary-strip__item--success .summary-strip__value {
    color: var(--status-success-text);
}
.summary-strip--headline .summary-strip__label {
    font-size: 12px;
    line-height: 16px;
}
.summary-strip--headline .summary-strip__value {
    /* Beam purple, as the headline tiles (Listy, 2 Nov). */
    color: var(--beam-purple);
    font-family: var(--headings-large-h3-font-family);
    font-size: var(--headings-large-h3-font-size);
    font-weight: var(--headings-large-h3-font-weight);
    font-variant-numeric: tabular-nums;
    line-height: var(--headings-large-h3-line-height);
}

.beam-banner {
    align-items: flex-start;
    background: var(--surface-muted);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    display: flex;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
}

.beam-banner[hidden] {
    display: none;
}

.beam-banner--stale {
    background: var(--status-stale-bg);
    border-color: var(--status-stale-border);
    color: var(--status-stale-text);
}

.beam-banner--changed {
    background: var(--status-changed-bg);
    border-color: var(--status-changed-border);
    color: var(--status-changed-text);
}

.beam-banner--error {
    background: var(--status-error-bg);
    border-color: var(--status-error-border);
    color: var(--status-error-text);
}

/* Collapsible variant (CPM T60830): a head line over the body. Collapsed, only
   the head shows — title, summary ("2 warnings") and the toggle — so the banner
   costs one line of height. /js/components/banner.js drives it; the `hidden`
   attribute does the hiding, paired with explicit rules so no display value
   set elsewhere can out-rank it. */
.beam-banner--collapsible {
    flex-direction: column;
    gap: var(--space-2);
}

.beam-banner--collapsible.beam-banner--collapsed {
    padding-bottom: var(--space-2);
    padding-top: var(--space-2);
}

.beam-banner__head {
    align-items: baseline;
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-1) var(--space-3);
    width: 100%;
}

.beam-banner__summary {
    font-size: var(--body-medium-regular-font-size);
    line-height: var(--body-medium-regular-line-height);
}

.beam-banner__toggle {
    align-items: center;
    appearance: none;
    background: transparent;
    border: 0;
    border-radius: var(--radius-sm);
    color: inherit;
    cursor: pointer;
    display: inline-flex;
    font-family: inherit;
    font-size: var(--body-medium-regular-font-size);
    font-weight: var(--body-medium-bold-font-weight);
    gap: var(--space-1);
    line-height: var(--body-medium-regular-line-height);
    margin-left: auto;
    padding: 0 var(--space-1);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.beam-banner__toggle:hover {
    text-decoration-thickness: 2px;
}

.beam-banner__toggle:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: 2px;
}

/* A chevron drawn with borders, so it takes the banner's own text colour. */
.beam-banner__chevron {
    border-bottom: 2px solid currentColor;
    border-right: 2px solid currentColor;
    display: inline-block;
    height: var(--space-2);
    transform: translateY(2px) rotate(-135deg);
    width: var(--space-2);
}

.beam-banner--collapsed .beam-banner__chevron {
    transform: translateY(-2px) rotate(45deg);
}

.beam-banner__summary[hidden],
.beam-banner__toggle[hidden],
.beam-banner__body[hidden] {
    display: none;
}

.beam-banner__body {
    width: 100%;
}

.workspace {
    background: var(--surface-canvas);
    display: grid;
    flex: 1;
    grid-template-columns: minmax(0, 1fr) var(--workspace-drawer-w, var(--drawer-w));
    grid-template-rows: auto minmax(0, 1fr);
    min-height: 0;
    min-width: 0;
}

.workspace__header {
    background: var(--surface-panel);
    border-bottom: 1px solid var(--border-strong);
    display: flex;
    flex-direction: column;
    grid-column: 1 / -1;
    min-width: 0;
}

.workspace__canvas {
    min-height: 0;
    min-width: 0;
    overflow-y: auto;
}

.workspace__settings {
    background: var(--surface-panel);
    border-left: 1px solid var(--border-strong);
    display: flex;
    flex-direction: column;
    min-height: 0;
    min-width: 0;
    overflow: hidden;
    position: relative;
}

.workspace__settings-header {
    align-items: center;
    border-bottom: 1px solid var(--border-strong);
    display: flex;
    flex: 0 0 auto;
    justify-content: space-between;
    min-height: calc(var(--control-height) + var(--space-8));
    padding: var(--space-4) var(--space-6);
}

.workspace__settings-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
}

.workspace__settings-footer {
    align-items: center;
    border-top: 1px solid var(--surface-divider);
    display: flex;
    flex: 0 0 auto;
    gap: var(--space-3);
    justify-content: flex-end;
    padding: var(--space-4) var(--space-6);
}

.workspace__settings-tag {
    align-items: center;
    appearance: none;
    background: var(--surface-panel);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-button) 0 0 var(--radius-button);
    color: var(--text-primary);
    cursor: pointer;
    display: inline-flex;
    height: var(--drawer-collapse-handle-w);
    justify-content: center;
    position: absolute;
    right: 100%;
    top: var(--space-4);
    width: var(--drawer-collapse-handle-w);
}

.workflow-tabs {
    align-items: flex-end;
    border-bottom: 1px solid var(--border-strong);
    display: flex;
    gap: var(--space-1);
    min-width: 0;
}

.workflow-tabs__tab {
    appearance: none;
    background: transparent;
    border: 0;
    border-bottom: 3px solid transparent;
    /* Unselected tabs recede (T60816); the selected one is teal below. */
    color: var(--text-secondary);
    text-decoration: none;
    cursor: pointer;
    display: inline-flex;
    font-family: inherit;
    font-size: var(--body-medium-regular-font-size);
    font-weight: var(--headings-large-h5-font-weight);
    gap: var(--space-2);
    line-height: var(--body-medium-regular-line-height);
    padding: var(--space-3) var(--space-4) calc(var(--space-3) - var(--radius-xs));
    /* Never wrap (standards §6, as .workflow-tabs__label below): ui/tabs puts
       the label straight in the tab, so a squeezed bar broke "As-builts" over
       two lines (T61707). The bar scrolls instead. */
    white-space: nowrap;
}

/* D-07: the active tab accent is teal, like every other active state.
   This was `--text-link` (the settings-surface blue) — so the CANONICAL tab primitive was blue
   while WP-13 had
   already converged globals' local `.admin-globals-sub-tab` to teal. The WP-16 consistency matrix
   caught the inversion: the exception had been fixed and the canon left wrong. It is also the
   blue in S-17's "Load|Tariffs underline", since the meter modal uses this primitive.
   `--text-link` itself is unchanged — links still use it. */
.workflow-tabs__tab--active,
.workflow-tabs__tab[aria-selected="true"] {
    border-bottom-color: var(--primary-300);
    color: var(--primary-300);
}

.workflow-tabs__tab--disabled,
.workflow-tabs__tab[aria-disabled="true"] {
    color: var(--text-secondary);
    cursor: not-allowed;
    opacity: 0.55;
}

.workflow-tabs__tab--stale {
    color: var(--status-stale-text);
}

.workflow-tabs__tab--processing {
    color: var(--text-link);
}

.workflow-tabs__icon,
/* Segments and tabs size to their LONGEST label and never truncate (standards §6: "Quar…" is a
   defect). `white-space: nowrap` plus no width cap means the group grows instead of clipping; if
   a group genuinely cannot fit, its container scrolls rather than the label being cut. */
.workflow-tabs__label {
    display: inline-flex;
    overflow: visible;
    text-overflow: clip;
    white-space: nowrap;
}

.workflow-tabs {
    overflow-x: auto;
}

.segmented-control__button {
    flex: 0 0 auto;
    white-space: nowrap;
}

/* Info trigger for the existing BeamUI floating tooltip; inherits the label's
   colour and the global keyboard focus ring, including in totals bands. */
.beam-info {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: none;
    width: var(--space-4);
    height: var(--space-4);
    margin-inline-start: var(--space-1);
    padding: 0;
    border: var(--border-width-thin) solid currentColor;
    border-radius: 50%;
    background: transparent;
    color: inherit;
    font: inherit;
    font-size: var(--body-small-regular-font-size);
    line-height: 1;
    vertical-align: middle;
    cursor: help;
}

/* The glyph is drawn, not text: the label it follows keeps its own text
   ("Incentives", not "Incentivesi") for copy, find and text locators. */
.beam-info::before {
    content: "i";
}

.beam-info--alert {
    color: var(--alert-700);
}

.beam-info--alert::before {
    content: "!";
    font-weight: 700;
}

.beam-tooltip-anchor {
    display: inline-flex;
    position: relative;
}

.beam-tooltip {
    background: var(--tooltip-bg);
    border-radius: var(--radius-tooltip);
    color: var(--tooltip-text);
    display: block;
    filter: drop-shadow(0 var(--space-1) var(--space-2) var(--map-polygon-hover));
    font-size: var(--body-medium-regular-font-size);
    line-height: var(--body-medium-regular-line-height);
    max-width: var(--drawer-w);
    padding: var(--space-2) var(--space-3);
    position: absolute;
    transform: translateY(calc(-1 * var(--space-2)));
    width: max-content;
    z-index: var(--z-toast);
}

.beam-tooltip.hidden,
.beam-multi-select__listbox.hidden,
.beam-modal.hidden {
    display: none;
}

.beam-tooltip:not(.hidden) {
    display: block;
}

.beam-multi-select {
    position: relative;
    width: 100%;
}

.beam-multi-select__trigger {
    min-width: 100%;
}

.beam-multi-select__listbox {
    background: var(--surface-panel);
    border: 1px solid var(--corelight-900);
    border-radius: var(--radius-md);
    box-shadow: 0 var(--space-2) var(--space-4) var(--map-polygon-hover);
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
    left: 0;
    margin-top: var(--space-1);
    min-width: 100%;
    padding: var(--space-2);
    position: absolute;
    top: 100%;
    z-index: var(--z-dropdown);
}

.beam-multi-select__listbox:not(.hidden) {
    display: flex;
}

.beam-multi-select__option {
    align-items: center;
    display: flex;
    gap: var(--space-2);
    padding: var(--space-2);
}

.beam-modal {
    align-items: center;
    /* WP-04: was --map-polygon-hover, a 16% hover tint that did not read as a backdrop (S-18). */
    background: var(--scrim);
    display: flex;
    inset: 0;
    justify-content: center;
    padding: var(--space-6);
    position: fixed;
    z-index: var(--z-modal);
}

.beam-modal:not(.hidden) {
    display: flex;
}

.beam-modal__panel {
    background: var(--surface-panel);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-modal);
    box-shadow: 0 var(--space-4) var(--space-8) var(--map-polygon-hover);
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - (var(--space-6) * 2));
    max-width: var(--globals-modal-w);
    min-width: min(100%, var(--drawer-w));
    overflow: hidden;
    width: min(100%, calc(var(--drawer-w) * 2));
}

/* Canonical modal size scale (standards §8, I-02): size to content, four steps.
   `min()` against 96vw keeps every step sound at 1280 wide; the panel's own max-height plus body
   scroll keep it sound at 690 high.
   ADDITIVE ONLY. `--sm` and `--lg` keep their existing values because they have live consumers on
   other packages' surfaces — `full-systems-table.html:149` (WP-09) and `admin/globals.clj:790,1661`
   (WP-13) — and silently rewidening those from WP-04 would be exactly the fence breach this
   campaign forbids. The kill-list records the migration: `--sm` is really a 320px drawer width,
   not the standards' ~480 confirm, so its consumer moves to `--confirm` when WP-09 touches it. */
.beam-modal__panel--sm {
    width: var(--drawer-w); /* legacy 320px — see note above */
}

.beam-modal__panel--confirm {
    width: min(480px, 96vw);
}

.beam-modal__panel--md {
    width: min(720px, 96vw);
}

.beam-modal__panel--lg {
    width: var(--globals-w); /* legacy min(960px, 92vw) — see note above */
}

.beam-modal__panel--xl,
.beam-modal__panel--full {
    width: var(--globals-modal-w);
}

.beam-modal__header,
.beam-modal__footer {
    align-items: center;
    background: var(--surface-panel);
    display: flex;
    gap: var(--space-3);
    justify-content: space-between;
    padding: var(--space-5) var(--space-6);
}

.beam-modal__header {
    border-bottom: 1px solid var(--surface-divider);
}

.beam-modal__footer {
    border-top: 1px solid var(--surface-divider);
    justify-content: flex-end;
}

.beam-modal__title {
    color: var(--text-primary);
    font-size: var(--headings-large-h4-font-size);
    font-weight: var(--headings-large-h4-font-weight);
    line-height: var(--headings-large-h4-line-height);
    margin: 0;
}

.beam-modal__body {
    overflow: auto;
    padding: var(--space-6);
}

.beam-modal__close,
.modal-close-button {
    align-items: center;
    appearance: none;
    background: var(--corelight-100);
    border: 1px solid var(--corelight-900);
    border-radius: var(--radius-button);
    color: var(--coredark-700);
    cursor: pointer;
    display: inline-flex;
    height: var(--control-height);
    justify-content: center;
    width: var(--control-height);
}

.file-upload {
    align-items: center;
    background: var(--surface-panel);
    border: 1px dashed var(--corelight-900);
    border-radius: var(--radius-lg);
    color: var(--text-secondary);
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    justify-content: center;
    min-height: calc(var(--control-height) * 4);
    padding: var(--space-6);
    text-align: center;
}

.file-upload--dragover {
    background: var(--surface-muted);
    border-color: var(--text-link);
}

.file-upload__input {
    display: none;
}

.file-upload-item {
    align-items: center;
    background: var(--surface-panel);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-md);
    display: flex;
    gap: var(--space-3);
    min-width: 0;
    padding: var(--space-3);
}

.file-upload-item--error {
    background: var(--file-upload-error-bg);
    border-color: var(--file-upload-error-border);
}

.file-upload-item--grid {
    align-items: stretch;
    flex-direction: column;
    width: calc(var(--drawer-collapse-handle-w) * 5);
}

.file-upload-item__thumb {
    align-items: center;
    background: var(--surface-muted);
    border-radius: var(--radius-sm);
    display: flex;
    height: calc(var(--control-height) * 2);
    justify-content: center;
}

.file-upload-item__body {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    gap: var(--space-1);
    min-width: 0;
}

.file-upload-item__name {
    color: var(--text-primary);
    font-weight: var(--headings-large-h5-font-weight);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-upload-item__meta,
.file-upload-item__error {
    color: var(--text-secondary);
    font-size: var(--body-medium-regular-font-size);
}

.file-upload-item__error {
    color: var(--status-error-text);
}

.file-upload-item__progress {
    background: var(--surface-muted);
    border-radius: var(--radius-sm);
    height: var(--space-2);
    overflow: hidden;
}

.file-upload-item__progress-bar {
    background: var(--file-upload-progress);
    height: 100%;
}

.ag-theme-beam {
    --ag-background-color: var(--ag-beam-background);
    --ag-foreground-color: var(--ag-beam-foreground);
    --ag-border-color: var(--ag-beam-border);
    --ag-header-background-color: var(--surface-muted);
    --ag-odd-row-background-color: var(--surface-page);
    --ag-selected-row-background-color: var(--map-polygon-hover);
    --ag-row-hover-color: var(--surface-muted);
    --ag-font-family: inherit;
}

@media (max-width: 700px) {
    .beam-panel__header,
    .beam-section__header,
    .beam-table-toolbar {
        align-items: stretch;
        flex-direction: column;
    }

    .beam-modal {
        padding: var(--space-3);
    }
}

.ui-gallery {
    background: var(--surface-page);
    color: var(--text-primary);
    display: flex;
    flex-direction: column;
    gap: var(--space-6);
    padding: var(--space-6);
}

.ui-gallery__header {
    background: var(--coredark-700);
    color: var(--corelight-100);
    padding: var(--space-6);
}

.ui-gallery__header h1,
.ui-gallery__header p {
    margin: 0;
}

.ui-gallery__header h1 {
    font-size: var(--headings-large-h2-font-size);
    font-weight: var(--headings-large-h2-font-weight);
    line-height: var(--headings-large-h2-line-height);
}

.ui-gallery__row {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.ui-gallery__row-label {
    color: var(--text-secondary);
    font-size: var(--body-medium-regular-font-size);
    font-weight: var(--headings-large-h5-font-weight);
    line-height: var(--body-medium-regular-line-height);
    text-transform: uppercase;
}

.ui-gallery__controls {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-3);
}

.ui-gallery__wide {
    width: min(100%, var(--globals-w));
}

.ui-gallery__narrow {
    width: min(100%, var(--drawer-w));
}

.ui-gallery__chart-grid,
.ui-gallery__load-demo {
    min-width: min(100%, calc(var(--drawer-w) * 2));
    overflow-x: auto;
}

.beam-chart-canvas {
    background: var(--corelight-100);
    border: 1px solid var(--corelight-900);
    border-radius: var(--radius-card);
    box-sizing: border-box;
    max-width: 100%;
}

.load-canvas-readout {
    color: var(--text-secondary);
    font-size: var(--body-medium-regular-font-size);
    line-height: var(--body-medium-regular-line-height);
    min-height: var(--body-medium-regular-line-height);
}

.ui-gallery__load-demo .load-canvas {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}

.ui-gallery__load-demo .load-kpi-strip,
.ui-gallery__load-demo .load-canvas-toolbar,
.ui-gallery__load-demo .load-canvas-actions,
.ui-gallery__load-demo .load-canvas-tabs,
.ui-gallery__load-demo .load-canvas-toggle,
.ui-gallery__load-demo .load-canvas-legend {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
}

.ui-gallery__load-demo .load-kpi {
    border: 1px solid var(--corelight-900);
    border-radius: var(--radius-card);
    padding: var(--space-2) var(--space-3);
}

.ui-gallery__load-demo .load-kpi span,
.ui-gallery__load-demo .load-canvas-card__meta,
.ui-gallery__load-demo .load-canvas-legend,
.ui-gallery__load-demo .load-canvas-empty {
    color: var(--text-secondary);
    font-size: var(--body-medium-regular-font-size);
}

.ui-gallery__load-demo .load-kpi strong,
.ui-gallery__load-demo .load-canvas-card__title {
    color: var(--text-primary);
    display: block;
    font-size: var(--body-large-font-size);
    font-weight: var(--headings-large-h5-font-weight);
}

.ui-gallery__load-demo .load-canvas-toolbar {
    justify-content: space-between;
}

.ui-gallery__load-demo .load-canvas-tabs,
.ui-gallery__load-demo .load-canvas-toggle {
    border: 1px solid var(--corelight-900);
    border-radius: var(--radius-button);
    gap: 0;
    overflow: hidden;
}

.ui-gallery__load-demo .load-canvas-tabs button,
.ui-gallery__load-demo .load-canvas-toggle button {
    background: var(--corelight-100);
    border: 0;
    color: var(--text-primary);
    cursor: pointer;
    font: inherit;
    padding: var(--space-2) var(--space-3);
}

.ui-gallery__load-demo .load-canvas-tabs button.active,
.ui-gallery__load-demo .load-canvas-toggle button.active {
    background: var(--coredark-700);
    color: var(--corelight-100);
}

.ui-gallery__load-demo .load-canvas-charts {
    display: grid;
    gap: var(--space-4);
}

.ui-gallery__load-demo .load-canvas-card {
    border: 1px solid var(--corelight-900);
    border-radius: var(--radius-card);
    padding: var(--space-3);
}

.ui-gallery__load-demo .load-canvas-card__header {
    align-items: baseline;
    display: flex;
    gap: var(--space-3);
    justify-content: space-between;
}

.ui-gallery__load-demo .load-canvas-chart {
    height: auto;
    max-width: 100%;
}

.ui-gallery__load-demo .load-canvas-legend i {
    border-radius: var(--radius-xs);
    display: inline-block;
    height: var(--space-3);
    margin-right: var(--space-1);
    width: var(--space-3);
}

.ui-gallery__load-demo .load-heatmap {
    display: grid;
    gap: var(--radius-xs);
    grid-template-columns: calc(var(--space-8) + var(--space-2)) repeat(24, minmax(var(--space-4), 1fr));
}

.ui-gallery__load-demo .load-heatmap__hour,
.ui-gallery__load-demo .load-heatmap__month {
    color: var(--text-secondary);
    font-size: var(--body-medium-regular-font-size);
    line-height: var(--body-medium-regular-line-height);
    text-align: center;
}

.ui-gallery__load-demo .load-heatmap__cell {
    aspect-ratio: 1;
    min-width: var(--space-4);
}

.ui-gallery__modal-demo .beam-modal {
    background: transparent;
    padding: 0;
    position: static;
}

.ui-gallery__token-grid {
    display: grid;
    gap: var(--space-3);
    grid-template-columns: repeat(auto-fit, minmax(calc(var(--drawer-collapse-handle-w) * 6), 1fr));
}

.ui-gallery__token {
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-md);
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    padding: var(--space-3);
}

.ui-gallery__swatch {
    background: var(--token-swatch, var(--surface-muted));
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    height: var(--control-height);
}


/* ── UI standards (2026-10-07 audit, CPM T58892) ─────────────────────────────
   Page header (T60811) and status pill (T60817). Rendered by
   com.beam.ui.components/page-header and /status-pill; shown on
   /app2/admin/styles#standards. Buttons (T60815) are the primary-btn /
   secondary-btn / tertiary-btn / icon-btn family above; tabs (T60816) are
   .workflow-tabs and .segmented-control. */

.beam-page-header {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
    margin-bottom: var(--space-6);
}

/* A partner's logo (page-header :logo, Listy, 22 Oct): the box the side
   menu's Beam mark fills (140 x 82, sidebar.css), level with it, and as far
   in from the window's right edge as the mark is from its left (20px). The
   header sits inside the Admin pages' padding (pt-10 pr-8: 40px top, 32px
   right) and the mark 12px below the top, so the logo rises 28px and reaches
   12px into the right padding; out of the flow, it doesn't move the title. */
.beam-page-header--logo {
    position: relative;
    padding-right: 156px;
}
.beam-page-header__logo {
    position: absolute;
    top: -28px;
    right: -12px;
    width: 140px;
    height: 82px;
    max-width: none;
    object-fit: contain;
    object-position: right center;
}

.beam-page-header__row {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-4);
    justify-content: space-between;
}

.beam-page-header__actions {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
}

.beam-breadcrumb {
    align-items: center;
    color: var(--dark-300);
    display: flex;
    flex-wrap: wrap;
    font-size: 12px;
    gap: var(--space-2);
    line-height: 16px;
}

.beam-breadcrumb a {
    color: var(--primary-300);
    text-decoration: none;
}

.beam-breadcrumb a:hover {
    text-decoration: underline;
}

.beam-breadcrumb__sep {
    color: var(--text-secondary);
}

.beam-page-title {
    color: var(--dark-300);
    font-family: var(--headings-large-h2-font-family);
    font-size: var(--headings-large-h2-font-size);
    font-weight: var(--headings-large-h2-font-weight);
    line-height: var(--headings-large-h2-line-height);
    margin: 0;
}

.beam-section-title {
    /* Section heading inside a page (H2 standard): Fieldwork Black 20px, Dark 300. */
    color: var(--dark-300);
    font-family: var(--headings-large-h2-font-family);
    font-size: var(--headings-large-h3-font-size);
    font-weight: var(--headings-large-h2-font-weight);
    line-height: var(--headings-large-h3-line-height);
    margin: 0;
}

.beam-page-subtitle {
    color: var(--text-secondary);
    font-size: var(--body-medium-regular-font-size);
    line-height: var(--body-medium-regular-line-height);
    margin: 0;
}

.beam-status {
    align-items: center;
    border: 1px solid transparent;
    border-radius: 999px;
    box-sizing: border-box;
    display: inline-flex;
    font-size: 12px;
    font-weight: 700;
    height: 24px;
    line-height: 1;
    padding: 0 var(--space-3);
    white-space: nowrap;
}

.beam-status--success {
    background: var(--status-success-bg);
    border-color: var(--status-success-border);
    color: var(--status-success-text);
}

.beam-status--waiting {
    background: var(--status-warning-bg);
    border-color: var(--status-warning-border);
    color: var(--status-warning-text);
}

.beam-status--problem {
    background: var(--status-error-bg);
    border-color: var(--status-error-border);
    color: var(--status-error-text);
}

.beam-status--info {
    background: var(--status-info-bg);
    border-color: var(--status-info-border);
    color: var(--status-info-text);
}

.beam-status--neutral {
    background: var(--status-stale-bg);
    border-color: var(--status-stale-border);
    color: var(--status-stale-text);
}

/* Beam dark green, in the same pale-fill family as the tones above. */
.beam-status--brand {
    background: var(--tint-green);
    border-color: var(--beam-green);
    color: var(--beam-green);
}

/* BeamWhen (CPM T61355): how long ago or how far off, optionally beside the
   short date with its year. resources/public/js/components/when.js renders it;
   the Procure project list's When column and Project History both use it. */
.beam-when {
    align-items: baseline;
    display: inline-flex;
    gap: var(--space-2);
    white-space: nowrap;
}
.beam-when__ago {
    color: var(--text-primary);
}
.beam-when__date {
    color: var(--text-secondary);
    font-size: 11px;
}
.beam-when--future .beam-when__ago {
    color: var(--status-success-text);
    font-weight: 700;
}
.beam-when--past .beam-when__ago {
    color: var(--status-error-text);
    font-weight: 700;
}
/* The deadline form (Listy, 19 Oct): a dot on the column's timeline, then the
   text, both in one colour set by how far off the deadline is. */
.beam-when--deadline {
    align-items: center;
}
.beam-when--deadline .beam-when__ago {
    color: var(--beam-when-dot, var(--text-primary));
}
.beam-when__dot {
    flex: 0 0 10px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--beam-when-dot, var(--text-secondary));
    /* A ring of the surface, so the column's line stops short of the dot. */
    box-shadow: 0 0 0 3px var(--surface-panel);
}
.beam-when--deadline-future { --beam-when-dot: var(--beam-teal); }
.beam-when--deadline-recent { --beam-when-dot: var(--beam-green); }
.beam-when--deadline-months { --beam-when-dot: var(--timeline-blue); }
.beam-when--deadline-old { --beam-when-dot: var(--alert-700); }
/* An event timeline's bands (BeamWhen.historyBand; Project History, Listy
   22 Oct): much finer steps than a deadline's, since a project lasts 2-3
   weeks, and older events grey, not red -- an old event is not overdue. */
.beam-when--history-hour { --beam-when-dot: var(--beam-teal); }
.beam-when--history-today { --beam-when-dot: var(--beam-green); }
.beam-when--history-week { --beam-when-dot: var(--timeline-blue); }
.beam-when--history-older { --beam-when-dot: var(--text-secondary); }

/* ── Event Log entry (CPM T61706) ───────────────────────────────────────────
   One entry, the same on Manage Overview and Management: the fault, its date
   and a standard status pill, then the body (manage_actions.clj
   event-log-entry; Management's column header reuses .beam-event__header so
   the two can't drift). Colours read Manage's --bd-* palette where it is set
   and fall back to the standard text and border tokens elsewhere. The 12px /
   13px text matches the Manage tables around it (no body token at 13px). */
.beam-event-list {
    display: flex;
    flex-direction: column;
}

.beam-event {
    padding: calc(var(--space-2) + 2px) 0; /* 10px: the Manage table row rhythm */
    border-bottom: 1px solid var(--bd-border, var(--border-strong));
    font-size: 13px;
    line-height: 18px;
}

.beam-event:last-child {
    border-bottom: none;
}

.beam-event__header {
    display: grid;
    /* The date column is wider than its text ("3mo ago 23 Jun 26" is about
       120px), so there is always clear space before the status pill
       (Leonie, 22 Oct). Columns in rem so they follow the text size. */
    grid-template-columns: minmax(0, 1fr) 9rem 6rem;
    align-items: center;
    column-gap: var(--space-5);
}

.beam-event__fault {
    font-weight: 600;
    color: var(--bd-text, var(--text-primary));
    min-width: 0;
    overflow-wrap: break-word;
}

.beam-event__date {
    color: var(--bd-text-secondary, var(--text-secondary));
    font-size: var(--body-small-regular-font-size);
    white-space: nowrap;
}

.beam-event__status {
    justify-self: end;
}

/* Overview's panel is too narrow for three columns: the fault takes the first
   line, the date and status the second (Management keeps the columns its
   Description / Date / Status header lines up with). */
.beam-overview__q--issues .beam-event__header {
    grid-template-columns: minmax(0, 1fr) auto;
    row-gap: var(--space-1);
}

.beam-overview__q--issues .beam-event__fault {
    grid-column: 1 / -1;
}

.beam-event__body {
    margin: calc(var(--space-1) + 2px) 0 0; /* 6px under the header line */
    font-size: var(--body-small-regular-font-size);
    line-height: 1.45;
    color: var(--bd-text-secondary, var(--text-secondary));
}

/* Auto-cleared zero-generation issue (issue-autoclear): the note line under a
   resolved entry. Inherits .beam-event__body's secondary text token; italic
   so it reads as the system's remark. */
.beam-event__note {
    font-style: italic;
}

/* Floating tooltip variant for triggers inside scrolling tables and modals. */
.beam-tooltip--floating {
    position: fixed;
    z-index: var(--z-tooltip-over-modal);
    text-align: left;
    transform: none;
    width: max-content;
    max-width: min(320px, calc(100vw - 32px));
    white-space: normal;
    word-break: normal;
    overflow-wrap: normal;
}
@media print { .beam-tooltip--floating { display: none !important; } }

/* ── Headline tiles (Listy, 1 Nov) ───────────────────────────────────────
   The headline panel beside a page's map: three to a row, each a label, one
   number in Beam purple (the Assessments table's figures), and what it is
   measured against; a thin bar where a mix is the point; a technology tile
   puts the table's icon beside its two-line size. */
.headline-tiles {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: var(--space-3);
}
@media (max-width: 720px) {
    .headline-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.headline-tile {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
    min-height: 84px;
    box-sizing: border-box;
    padding: var(--space-3) 14px;
    border: 1px solid var(--light-700);
    border-radius: var(--radius-lg);
    background: var(--light-100);
}
.headline-tile__label {
    font: 400 13px/18px Arial, Helvetica, sans-serif;
    color: var(--dark-300);
}
.headline-tile__value {
    font-family: var(--headings-large-h3-font-family);
    font-weight: 900;
    font-size: 22px;
    line-height: 26px;
    color: var(--beam-purple);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.headline-tile__context {
    font: 400 12px/16px Arial, Helvetica, sans-serif;
    color: var(--dark-300);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.headline-tile__bar {
    display: flex;
    height: 6px;
    border-radius: 3px;
    overflow: hidden;
    background: var(--light-500);
}
.headline-tile__seg--done { background: var(--status-success-border); }
.headline-tile__seg--progress { background: var(--status-info-border); }
.headline-tile__seg--waiting { background: var(--status-warning-border); }
.headline-tile__seg--problem { background: var(--alert-700); }
.headline-tile__seg--stopped { background: var(--beam-green); }
.headline-tile__seg--none { background: var(--light-900); }
/* A technology tile's size: the style guide's size chip (capacity-metric,
   extra.css), as the tables draw it (Listy, 3 Nov). */
.headline-tile__metric { display: flex; align-items: center; min-height: 34px; min-width: 0; color: var(--beam-purple); }

/* A date-and-time field as a date and one hourly list
   (js/components/hourly-datetime.js; Listy, 4 Nov). */
.bm-hourly { display: inline-flex; gap: 8px; align-items: center; flex-wrap: wrap; max-width: 100%; }
.bm-hourly > input[type="date"] { width: auto; min-width: 150px; }
.bm-hourly > select { width: auto; min-width: 110px; }
