── Generic SECTION System Styles ──────────────────────────────────────────── */
/* Follows the section-page-container pattern from site.css. */

/* ══════════════════════════════════════════════════════════════════════════
   GRID FONT SCALE
   --lf-grid-font-scale is 1 unless the user asked the grid to fit every column
   into the visible width (sectionColumnMenu.ts's section.columns.fitPage), in
   which case the client writes a fraction onto the <table> element. EVERY size
   the grid rows are made of goes through it — text, cell padding and row height
   — because shrinking the text alone leaves the rows just as tall and buys
   nothing. Written here rather than layered on top: the fixed-mode rules below
   are !important, so an outside override could not win against them.
   ══════════════════════════════════════════════════════════════════════════ */

/* ── Header row (column titles) ────────────────────────────────────────── */
.section-grid-table thead .section-header-row th {
    background-color: #6c757d;
    color: #fff;
    vertical-align: middle;
    white-space: nowrap;
    font-size: calc(0.8125rem * var(--lf-grid-font-scale, 1));
    padding: calc(0.4rem * var(--lf-grid-font-scale, 1)) calc(0.5rem * var(--lf-grid-font-scale, 1));
    box-sizing: border-box;
    user-select: none;
}

/* Measurement pass: sectionPage's _measureNaturalColumnWidths drops the colgroup
   widths and lets the browser size each column to its content. table-layout must
   be auto for that, whatever the current sizing mode says. */
.section-grid-table.section-grid-measuring {
    table-layout: auto !important;
}

/* ── Sort icons ────────────────────────────────────────────────────────── */
.section-sort-icon-default {
    opacity: 0.35;
    font-size: 0.7rem;
}

/* ── Filter row inside thead ───────────────────────────────────────────── */
.section-grid-table thead .section-filter-row th {
    background-color: #f8f9fa;
    padding: 0.2rem 0.3rem;
    vertical-align: middle;
    box-sizing: border-box;
    white-space: normal;
    overflow: hidden;
    border-top: 1px solid #dee2e6;
}

.section-filter-row.d-none {
    display: none;
}

.section-filter-cell select,
.section-filter-cell input {
    font-size: 0.72rem;
    padding: 0.15rem 0.3rem;
    height: 1.7rem;
    border-radius: 0.25rem;
}

.section-filter-cell {
    min-width: 0;
}

.section-filter-cell .section-filter-control {
    display: flex;
    align-items: center;
    gap: 0.15rem;
    width: 100%;
    min-width: 0;
}

.section-filter-cell .section-filter-op {
    flex: 0 0 2.2rem;
    width: 2.2rem;
    max-width: 2.2rem;
    padding: 0.15rem 0.1rem;
    text-align: center;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    cursor: pointer;
}

.section-filter-cell .section-filter-op::-webkit-calendar-picker-indicator {
    display: none !important;
}

.section-filter-cell .section-filter-val {
    flex: 1 1 auto;
    width: 1%;
    min-width: 0;
}

.section-filter-cell .section-filter-val:disabled {
    background-color: #e9ecef;
}

.section-filter-op-menu {
    position: fixed;
    /* z-index set inline via overlayStack.zIndexAbove */
    min-width: max-content;
    max-height: min(22rem, calc(100vh - 1rem));
    overflow-y: auto;
    padding: 0.25rem 0;
}

.section-filter-op-menu .section-filter-op-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 0.75rem;
    font-size: 0.8rem;
    white-space: nowrap;
}

.section-filter-op-menu .section-filter-op-symbol {
    flex: 0 0 1.75rem;
    width: 1.75rem;
    text-align: center;
    font-weight: 700;
}

/* ── Filter bar (legacy, kept for compatibility) ──────────────────────── */
.section-filter-bar {
    background: #f8f9fa;
    border: 1px solid #ced4da;
    border-radius: 0.375rem;
    padding: 0.5rem 0.75rem;
    font-size: 0.8125rem;
}

.section-filter-toggle {
    font-size: 0.8125rem;
}

.section-filter-bar .section-filter-operator {
    flex: 0 0 2.6rem;
    width: 2.6rem;
    max-width: 2.6rem;
    padding-right: 0.2rem;
    text-align: center;
    font-weight: 600;
}

.section-filter-bar .section-filter-operator::-webkit-calendar-picker-indicator {
    display: none !important;
}

/* ── SECTION page body (tablePage-like scroll container) ──────────────────── */
.section-page-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;          /* parent controls clip, no nested scrollbar */
}

.section-page-body .table-responsive {
    height: 100%;
    overflow-y: auto;          /* only the table wrapper scrolls */
}

/* ── Body row: table + virtual record scrollbar ──────────────────────── */
.section-body-row {
    display: flex;
    flex-direction: row;
    flex: 1 1 auto;
    min-height: 0;
    min-width: 0;
    align-items: stretch;
}

.section-body-row > .section-page-body {
    flex: 1 1 auto;
    min-width: 0;
    min-height: 0;
}

.section-body-row > .section-page-body .section-table-wrapper {
    height: 100%;
    min-width: 0;
    max-width: 100%;
}

/* ── Current-row panel: the part of the record that is not in its row (#20) ──
   Top/Bottom are siblings of .section-body-row inside the card; Left/Right are
   flex children of .section-body-row beside .section-page-body. Either way the
   panel never grows the card: it takes what it needs and the rows take the
   rest, which is what keeps the grid's own height calculation honest. */
.section-rowpanel {
    display: flex;
    flex-direction: column;
    min-height: 0;
    min-width: 0;
    gap: 0.35rem;
    padding: 0.4rem 0.5rem;
    border: 1px solid var(--bs-border-color, #dee2e6);
    border-radius: 0.375rem;
    background: var(--bs-tertiary-bg, #f8f9fa);
}

.section-rowpanel-top { margin-bottom: 0.5rem; }
.section-rowpanel-bottom { margin-top: 0.5rem; }

.section-rowpanel-left,
.section-rowpanel-right {
    flex: 0 0 auto;
    overflow-y: auto;
}

.section-rowpanel-left { margin-right: 0.5rem; }
.section-rowpanel-right { margin-left: 0.5rem; }

.section-rowpanel-head {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--bs-secondary-color, #6c757d);
}

.section-rowpanel-toggle {
    border: 0;
    background: transparent;
    padding: 0 0.15rem;
    line-height: 1;
    color: inherit;
    cursor: pointer;
}

.section-rowpanel-title {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.section-rowpanel-body {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    min-width: 0;
}

/* Folded: the heading stays, so the panel does not appear and disappear as the
   cursor moves — only its body goes. */
.section-rowpanel-collapsed > .section-rowpanel-body { display: none; }

.section-rowpanel-group { min-width: 0; }

.section-rowpanel-group-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--bs-secondary-color, #6c757d);
    margin-bottom: 0.2rem;
}

/* The declared number of flow columns, and one column as soon as there is no
   room for two — the same concession a form group makes. */
.section-rowpanel-fields {
    display: grid;
    grid-template-columns: repeat(var(--lf-rowpanel-cols, 2), minmax(0, 1fr));
    gap: 0.25rem 0.75rem;
}

@media (max-width: 720px) {
    .section-rowpanel-fields { grid-template-columns: minmax(0, 1fr); }
}

.section-rowpanel-field {
    display: flex;
    align-items: baseline;
    gap: 0.4rem;
    min-width: 0;
}

.section-rowpanel-label {
    flex: 0 0 auto;
    max-width: 45%;
    font-size: 0.75rem;
    color: var(--bs-secondary-color, #6c757d);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin: 0;
}

.section-rowpanel-value {
    flex: 1 1 auto;
    min-width: 0;
    font-size: 0.8125rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Only shown when there is no record under the cursor — an empty list, or a
   cursor that has not landed yet. */
.section-rowpanel-empty { display: none; }

.section-rowpanel-blank .section-rowpanel-group { display: none; }

.section-rowpanel-blank .section-rowpanel-empty {
    display: block;
    font-size: 0.8125rem;
    font-style: italic;
    color: var(--bs-secondary-color, #6c757d);
}

/* ── Table wrapper — horizontal scroll when columns exceed the section box.
   The section chrome stays a fixed size; only this inner scroller grows a
   scrollbar. overflow-y is hidden (not visible) so this box is a real
   scrollport: overflow-x:auto + overflow-y:visible would compute both to
   auto and the horizontal bar at the bottom of height:100% gets clipped by
   .section-page-body { overflow:hidden }. min-width:0 lets the flex parent
   shrink the wrapper instead of letting the table's min-content widen it. */
.section-table-wrapper {
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    /* Vertical pans are the record window (sectionSwipeScroll.ts, issue #160);
       horizontal pans stay native overflow-x. Not on .section-page-body: the
       kanban host is a sibling and still needs pan-y on its columns. */
    touch-action: pan-x;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
    /* The sticky column header (z-index 2) is a stacking context of its own. Without a
       context on this scrollport, that header is painted over a menu that hangs into the
       grid from outside it — the FullEdit view menu, whose 1050 is trapped in the header
       (issue #329; the same trap as #328). Isolation keeps the header above the rows and
       below everything outside this box. It does not clip, and it does not contain a
       position:fixed menu (the filter operator list). */
    isolation: isolate;
}

/* Form view (issue #234, M7): the module itself scrolls; record change is a
   horizontal gesture / the pagination buttons, not a vertical page snap.
   The view class sits on the table, inside this wrapper, so a descendant
   selector never reached it and the module stayed overflow-y:hidden (issue #329). */
.section-table-wrapper:has(> .section-grid-table.section-view-form) {
    overflow-y: auto;
    overflow-x: hidden;
    touch-action: pan-y;
    overscroll-behavior: contain;
}

/* ── Virtual vertical scrollbar (record navigation, not pixel overflow) ─ */
.section-vscroll {
    flex: 0 0 16px;
    width: 16px;
    min-width: 16px;
    display: flex;
    flex-direction: column;
    align-self: stretch;
    min-height: 0;
    background: var(--bs-tertiary-bg, #f1f3f5);
    border: 1px solid var(--bs-border-color, #dee2e6);
    user-select: none;
    touch-action: none;
    box-sizing: border-box;
}

.section-vscroll-btn {
    flex: 0 0 16px;
    width: 100%;
    height: 16px;
    padding: 0;
    margin: 0;
    border: 0;
    background: transparent;
    color: var(--bs-secondary-color, #6c757d);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    line-height: 1;
    font-size: 0.55rem;
}

.section-vscroll-btn:hover:not(:disabled) {
    background: var(--bs-secondary-bg, #e9ecef);
    color: var(--bs-body-color, #212529);
}

.section-vscroll-btn:disabled {
    opacity: 0.35;
    cursor: default;
}

.section-vscroll-track {
    flex: 1 1 auto;
    position: relative;
    min-height: 8px;
    cursor: pointer;
}

.section-vscroll-thumb {
    position: absolute;
    left: 2px;
    right: 2px;
    min-height: 18px;
    border-radius: 3px;
    background: #adb5bd;
    cursor: grab;
    box-sizing: border-box;
}

.section-vscroll-thumb:hover {
    background: #868e96;
}

.section-vscroll.is-dragging .section-vscroll-thumb,
.section-vscroll-thumb:active {
    background: #6c757d;
    cursor: grabbing;
}

.section-vscroll.is-disabled .section-vscroll-thumb {
    background: #ced4da;
    cursor: default;
}

body.lf-section-vscroll-dragging {
    cursor: grabbing !important;
    user-select: none !important;
}

.section-vscroll-tooltip {
    position: fixed;
    pointer-events: none;
    padding: 0.15rem 0.45rem;
    border-radius: 0.25rem;
    background: var(--bs-body-bg, #fff);
    color: var(--bs-body-color, #212529);
    border: 1px solid var(--bs-border-color, #dee2e6);
    box-shadow: 0 0.15rem 0.4rem rgba(0, 0, 0, 0.18);
    font-size: 0.75rem;
    font-variant-numeric: tabular-nums;
    line-height: 1.3;
    white-space: nowrap;
    opacity: 0;
}

.section-vscroll-tooltip.is-visible {
    opacity: 1;
}

/* ══════════════════════════════════════════════════════════════════════════
   GRID TABLE — desktop defaults
   ══════════════════════════════════════════════════════════════════════════ */
.section-grid-table {
    margin-bottom: 0;
    font-size: calc(0.875rem * var(--lf-grid-font-scale, 1));
    table-layout: fixed;
    width: 100%;
    min-width: 600px;
}

.section-grid-table thead th {
    background-color: #6c757d;
    color: #fff;
    vertical-align: middle;
    white-space: nowrap;
    font-size: calc(0.8125rem * var(--lf-grid-font-scale, 1));
    padding: calc(0.5rem * var(--lf-grid-font-scale, 1)) calc(0.4rem * var(--lf-grid-font-scale, 1));
    box-sizing: border-box;
    border-right: 1px solid #dee2e6;
}

.section-grid-table thead th:last-child {
    border-right: 0;
}

.section-grid-table tbody td {
    vertical-align: middle;
    padding: calc(0.35rem * var(--lf-grid-font-scale, 1)) calc(0.4rem * var(--lf-grid-font-scale, 1));
    height: calc(36px * var(--lf-grid-font-scale, 1));
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    box-sizing: border-box;
    border-right: 1px solid #dee2e6;
}

.section-grid-table tbody td:last-child {
    border-right: 0;
}

.section-row {
    cursor: pointer;
    transition: background-color 0.15s ease;
    height: calc(36px * var(--lf-grid-font-scale, 1));
}

/* ══════════════════════════════════════════════════════════════════════════
   FIXED-COLUMN MODE — locks desktop dimensions at every viewport width.
   Critical: uses px (not rem) so that html { font-size: 14px } in site.css
   does not shrink the table on narrow screens.
   Overrides Bootstrap .table and site.css global table selector.
   ══════════════════════════════════════════════════════════════════════════ */
.section-grid-table.section-grid-table-fixed {
    table-layout: auto !important;
    width: auto !important;
    /* 0.875rem × 16px = 14px, locked against html{font-size:14px}; the scale is the
       user's own "fit the columns into the page" choice, not a viewport effect. */
    font-size: calc(14px * var(--lf-grid-font-scale, 1)) !important;
}

.section-grid-table.section-grid-table-fixed thead th {
    font-size: calc(13px * var(--lf-grid-font-scale, 1)) !important;   /* 0.8125rem × 16px = 13px */
    padding: calc(8px * var(--lf-grid-font-scale, 1)) calc(6px * var(--lf-grid-font-scale, 1)) !important;
    white-space: nowrap !important;
    border-right: 1px solid #dee2e6 !important;
}

.section-grid-table.section-grid-table-fixed thead th:last-child {
    border-right: 0 !important;
}

.section-grid-table.section-grid-table-fixed tbody td {
    padding: calc(5px * var(--lf-grid-font-scale, 1)) calc(6px * var(--lf-grid-font-scale, 1)) !important;
    height: calc(36px * var(--lf-grid-font-scale, 1)) !important;
    font-size: calc(14px * var(--lf-grid-font-scale, 1)) !important;
    white-space: nowrap !important;
    border-right: 1px solid #dee2e6 !important;
}

.section-grid-table.section-grid-table-fixed tbody td:last-child {
    border-right: 0 !important;
}

.section-grid-table.section-grid-table-fixed .section-row {
    height: calc(36px * var(--lf-grid-font-scale, 1)) !important;
}

/* ── Fitted columns ───────────────────────────────────────────────────────
   Set by sectionPage's _applyFontScale while "fit all columns to the width"
   is in force. Must come AFTER the fixed-mode block above, whose
   table-layout: auto !important it deliberately overrides: auto layout lets a
   header whose text does not fit push its column wider, which is exactly what
   the user asked to stop. Fixed layout honours the <colgroup> to the pixel and
   the header truncates like the cells below it already do. */
.section-grid-table.section-grid-table-fixed.section-grid-fitted,
.section-grid-table.section-grid-fitted {
    table-layout: fixed !important;
}

.section-grid-table.section-grid-fitted thead th {
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ── Sticky header ─────────────────────────────────────────────────────── */
.section-grid-table thead {
    position: sticky;
    top: 0;
    z-index: 2;
}

/* ── Row hover ─────────────────────────────────────────────────────────── */
.section-row:hover {
    background-color: rgba(108, 117, 125, 0.08);
}

/* Current row (set on click, tracked by record id). Bootstrap's table gives every <td>
   its own opaque background (--bs-table-bg) plus its own inset box-shadow (used for
   hover/striping) — both paint on top of a background-color/box-shadow set on the <tr>
   itself, which is why setting them there renders invisible. Target the cells directly
   instead. The first cell's box-shadow layers the accent stripe together with Bootstrap's
   own hover/state shadow so a hovered current row still tints that cell (a single
   box-shadow declaration replaces, it doesn't merge with, one set on the same element). */
.section-row.section-row-current > td {
    background-color: rgba(13, 110, 253, 0.12);
}

.section-row.section-row-current:hover > td {
    background-color: rgba(13, 110, 253, 0.16);
}

.section-row.section-row-current > td:first-child {
    box-shadow: inset 3px 0 0 0 var(--bs-primary, #0d6efd),
        inset 0 0 0 9999px var(--bs-table-bg-state, var(--bs-table-bg-type, var(--bs-table-accent-bg)));
}

/* QueryMode / BulkMode prototype row in the grid tbody */
.section-query-row > td,
.section-bulk-row > td {
    background-color: #f8f9fa;
    vertical-align: middle;
}

.section-interaction-fallback {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem 1.25rem;
    padding: 0.75rem 1rem;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
}

.section-interaction-fallback-field {
    display: flex;
    flex-direction: column;
    min-width: 10rem;
    flex: 1 1 12rem;
    max-width: 24rem;
}

.section-interaction-fallback-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: #495057;
    margin-bottom: 0.2rem;
}

/* Active toolbar action button (insert/edit awaiting completion) */
.section-tb-btn.section-tb-btn-active {
    background-color: var(--bs-warning, #ffc107);
    border-color: var(--bs-warning, #ffc107);
    color: #212529;
}


/* ── Placeholder row (for height measurement) ────────────────────────── */
.section-placeholder-row td {
    color: transparent;
    user-select: none;
    pointer-events: none;
}

/* ── Sortable headers ────────────────────────────────────────────────── */
.section-sortable {
    cursor: pointer;
    user-select: none;
}

.section-sortable:hover {
    color: #fff;
    background-color: #5a6268;
}

/* ── Filter count badge ──────────────────────────────────────────────── */
.section-filter-count {
    font-size: 0.65rem;
}

/* ── Action buttons ──────────────────────────────────────────────────── */
.section-btn-edit,
.section-btn-delete {
    padding: 0.125rem 0.375rem;
    font-size: 0.75rem;
    line-height: 1;
}

/* ── Create / Reload buttons ─────────────────────────────────────────── */
.section-btn-create {
    background-color: #6c757d;
    border-color: #6c757d;
    color: #fff;
}
.section-btn-create:hover {
    background-color: #5a6268;
    border-color: #5a6268;
    color: #fff;
}

.section-btn-reload {
    background-color: #6c757d;
    border-color: #6c757d;
    color: #fff;
}
.section-btn-reload:hover {
    background-color: #5a6268;
    border-color: #5a6268;
    color: #fff;
}

.section-filter-apply {
    background-color: #6c757d;
    border-color: #6c757d;
    color: #fff;
}
.section-filter-apply:hover {
    background-color: #5a6268;
    border-color: #5a6268;
    color: #fff;
}

/* ── Modal form ──────────────────────────────────────────────────────── */
.section-modal-body {
    padding: 1.5rem;
}

.section-form {
    font-size: 0.875rem;
}

.section-form label {
    font-weight: 500;
    margin-bottom: 0.125rem;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.025em;
    color: #6c757d;
}

.section-form .form-control-plaintext {
    font-size: 0.875rem;
    padding: 0.375rem 0;
}

/* ── Multiselect dropdown filter ──────────────────────────────────── */
.section-multiselect-dd {
    display: inline-flex;
    flex: 1 1 auto;
    min-width: 0;
}

.section-multiselect-btn {
    font-size: 0.72rem;
    padding: 0.15rem 0.4rem;
    height: 1.7rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
}

.section-multiselect-menu {
    max-height: 300px;
    overflow-y: auto;
    min-width: 160px;
    font-size: 0.8rem;
}

.section-multiselect-menu .section-multiselect-item {
    cursor: pointer;
    user-select: none;
    padding: 0.2rem 0.5rem;
    font-size: 0.78rem;
}

.section-multiselect-menu .section-multiselect-item:hover {
    background-color: #e9ecef;
}

.section-multiselect-cb {
    width: 0.8rem;
    height: 0.8rem;
    margin: 0;
    cursor: pointer;
}

/* ── Toolbar row ───────────────────────────────────────────────────── */
/* Three zones, same as the detail popup header: LEFT title, CENTER commands,
   RIGHT page-info + enlarge (pinned to the trailing edge). Title, record
   label and enlarge stay on one row: the title ellipsizes if the row is tight. */
.section-toolbar-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    grid-template-rows: auto;
    align-items: center;
    gap: 0.25rem;
    margin-bottom: 0.5rem;
    flex-shrink: 0;
    /* The strip carries a background of its own now (--lf-theme-toolbar-bg), so it needs
       enough padding not to read as text printed on a coloured rectangle. Kept here, with
       the rest of this row's geometry, rather than in theme.css, which stays colour-only. */
    padding: 0.3rem 0.45rem;
    border-radius: 0.3rem;
    border: 1px solid transparent;
}

/* While a menu hangs out of the toolbar it has to paint above the grid's sticky
   header (z-index 2, its own stacking context). The menu's own 1050 does not get
   it there: the row is not a stacking context, so the header, later in the tree,
   is drawn across the menu (issue #329; the same trap as #328). Only while a menu
   is open — a closed row stays out of the way of whatever the grid draws over its edge. */
.section-toolbar-row:has(.section-view-menu.open),
.section-toolbar-row:has(.lf-tb-overflow.is-open) {
    position: relative;
    z-index: 3;
}

/* Title on the left: icon + ellipsized text + optional documents signal. */
.section-toolbar-title {
    grid-column: 1;
    grid-row: 1;
    justify-self: start;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 1.25rem;
    font-weight: 600;
    color: #495057;
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
}

.section-toolbar-title > :first-child {
    flex-shrink: 0;
}

.section-toolbar-title-text {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* The space a host pinned (documents: which element the files belong to). Same line as the
   title; the name stays whole and the path is the one that gives up width. */
.section-toolbar-title:has(.section-toolbar-title-path) .section-toolbar-title-text {
    flex-shrink: 0;
}

.section-toolbar-title-path {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 400;
    font-size: 0.85rem;
    color: var(--bs-secondary-color, #6c757d);
}

/* Inside a surface (a SpaDesktop window or a SpaTabs tab) the shell's own chrome already shows
   an icon + title, and already provides "make this the only thing here" — so a section's own
   title and Enlarge button (which fullscreens a section within <main>, meaningless when the
   surface already IS just that one section) are redundant. Hidden via CSS only: the markup/JS
   (including _fullscreenManager) are unchanged, just never shown or reachable by click.
   Keyed off the surface element; it used to be html.lf-bare, back when a surface was a document
   of its own rendered without chrome (issue #59). */
.lf-surface-inline .composite-section-title,
.lf-surface-inline .section-toolbar-title,
.lf-surface-inline .section-btn-fullscreen {
    display: none;
}

/* The primary page of a desktop window is closed by the window. The close on a stack page
   stays: that page is a sibling of the surface, not inside it. */
.lf-window .lf-surface-inline .section-btn-surface-close {
    display: none;
}

/* Center section: pagination + action buttons */
.section-toolbar-center {
    grid-column: 2;
    grid-row: 1;
    justify-self: center;
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    gap: 0.25rem;
}

/* Page info: combined text (Pagina x di y · N righe) */
.section-page-info {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.8rem;
    color: #6c757d;
    white-space: nowrap;
    flex-shrink: 0;
}

.section-page-info-sep {
    color: #adb5bd;
    font-weight: 300;
}

.section-page-info-rows {
    color: #adb5bd;
}

/* Right zone: page info then enlarge, flush to the trailing edge like .section-modal-window. */
.section-toolbar-end {
    grid-column: 3;
    grid-row: 1;
    justify-self: end;
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    gap: 0.35rem;
    min-width: max-content;
}
.section-full-edit-caption > .section-action-btn-group {
    grid-column: 2;
    grid-row: 1;
    justify-self: center;
}
.section-toolbar-window {
    flex: 0 0 auto;
}

/* Section fullscreen: occupies the whole <main> workspace between header and footer.
   top/left/width/height are set inline from <main>.getBoundingClientRect(), same
   anchoring as the detail modal. */
.section-is-fullscreen {
    position: fixed;
    z-index: 40;
    margin: 0;
    background: var(--bs-body-bg, #fff);
}
.section-is-fullscreen .section-page-container,
.section-is-fullscreen .section-page-card {
    height: 100%;
    min-height: 0;
}
.section-is-fullscreen .section-page-card {
    border-radius: 0;
}

/* Holds the original slot so sibling panes on a composite page do not reflow
   while this section is taken out of flow. */
.section-fullscreen-placeholder {
    flex: 0 0 auto;
    pointer-events: none;
    visibility: hidden;
}

/* The size and shape of `.section-tb-btn` now live in css/core/toolbar.css, which owns
   the one contract both command toolbars answer to (this one and the global FullEdit
   strip) and the three button shapes the user can pick from on the Theme page. What
   stays here is only what is this toolbar's own.

   The `.btn-group.section-tb-btn` pair that used to follow went with it: the linked-
   descriptor dropdown was the only thing that put the button class on the GROUP rather
   than on the button inside it, and it no longer does (core/sectionPage.ts) — a group is
   not a button and sizing it like one is what those two rules existed to undo. */

/* Back-to-origin button: highlighted when a link context is active */
.section-btn-linkback {
    background-color: #cfe2ff;
    border-color: #9ec5fe;
    color: #052c65;
}
.section-btn-linkback:hover {
    background-color: #b6d4ff;
    border-color: #79aefd;
}

/* Filter button: blue tint when filters are active */
.section-btn-filter.section-btn-filter-active,
.section-btn-filter.section-btn-filter-active > .btn {
    background-color: #cfe2ff;
    border-color: #9ec5fe;
    color: #052c65;
}
.section-btn-filter.section-btn-filter-active:hover,
.section-btn-filter.section-btn-filter-active > .btn:hover {
    background-color: #b6d4ff;
    border-color: #79aefd;
}

/* Bulk Edit: warning tint while BulkMode is active */
.section-btn-bulk.section-btn-bulk-active,
.section-btn-bulk.section-btn-bulk-active > .btn {
    background-color: var(--bs-warning, #ffc107);
    border-color: var(--bs-warning, #ffc107);
    color: #212529;
}
.section-btn-bulk.section-btn-bulk-active:hover,
.section-btn-bulk.section-btn-bulk-active > .btn:hover {
    background-color: #ffca2c;
    border-color: #ffc720;
}

/* Split button: primary action on the body, secondary menu on the caret */
.lf-split-btn-wrap {
    position: relative;
    display: inline-flex;
}

.lf-split-btn {
    display: inline-flex;
    vertical-align: middle;
}

.lf-split-btn-caret {
    min-width: 1.1rem;
    padding-left: 0.2rem;
    padding-right: 0.25rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.lf-split-btn-caret .fa-caret-down {
    font-size: 0.55rem;
}

/* The caret's own width and height are toolbar.css's (--lf-tb-caret-width). */

/* ══════════════════════════════════════════════════════════════════════════
   RESPONSIVE — toolbar & responsive-mode table adjustments only
   Fixed-mode tables (.section-grid-table-fixed) are completely excluded.
   ══════════════════════════════════════════════════════════════════════════ */

/* Tablet and below */
@media (max-width: 991.98px) {
    .section-page-container .section-page-card {
        padding: 0.5rem !important;
    }

    /* Toolbar buttons are not here any more: their metrics (including the
       narrower ones below 768px) are toolbar.css's, so that all three button
       shapes shrink together instead of one rule undoing another. */
    .section-page-body .btn-group .btn {
        font-size: 0.75rem;
        padding: 0.2rem 0.4rem;
    }

    .section-title {
        font-size: 1rem;
    }
}

/* Phone */
@media (max-width: 767.98px) {
    /* ── Responsive-mode tables only ── */
    .section-grid-table:not(.section-grid-table-fixed) {
        table-layout: auto !important;
        width: auto !important;
        min-width: 500px;
        font-size: 0.8rem;
    }

    .section-grid-table:not(.section-grid-table-fixed) thead th {
        font-size: 0.72rem;
        padding: 0.35rem 0.4rem;
    }

    .section-grid-table:not(.section-grid-table-fixed) tbody td {
        padding: 0.25rem 0.4rem;
        height: 32px;
        font-size: 0.78rem;
    }

    .section-grid-table:not(.section-grid-table-fixed) .section-row {
        height: 32px;
    }

    /* ── Wrapper always scrolls ── */
    .section-table-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* ── Action buttons ── */
    .section-btn-edit,
    .section-btn-delete {
        padding: 0.1rem 0.3rem;
        font-size: 0.68rem;
    }

    /* ── Filter row ── */
    .section-filter-cell .section-filter-op {
        flex: 0 0 1.8rem;
        width: 1.8rem;
        max-width: 1.8rem;
    }

    .section-filter-cell select,
    .section-filter-cell input {
        font-size: 0.68rem;
    }

    .section-multiselect-btn {
        font-size: 0.68rem;
    }

    /* ── Toolbar: title + record label + enlarge stay on row 1; commands wrap below ── */
    .section-toolbar-row {
        grid-template-columns: minmax(0, 1fr) auto;
        grid-template-rows: auto auto;
    }

    .section-toolbar-title {
        font-size: 1rem;
        grid-row: 1;
    }

    .section-toolbar-center,
    .section-full-edit-caption > .section-action-btn-group {
        grid-column: 1 / -1;
        grid-row: 2;
        justify-self: center;
        margin: 0.2rem 0;
    }

    .section-toolbar-end {
        grid-column: 2;
        grid-row: 1;
        justify-self: end;
    }

    .section-page-info {
        font-size: 0.7rem;
    }

    .section-title {
        font-size: 0.95rem;
        margin-bottom: 0.35rem;
        padding-bottom: 0.25rem;
    }

    .section-modal-body {
        padding: 1rem;
    }

    .section-form .col-md-6 {
        width: 100%;
    }
}

/* Small phones */
@media (max-width: 575.98px) {
    /* ── Responsive-mode tables only ── */
    .section-grid-table:not(.section-grid-table-fixed) {
        table-layout: auto !important;
        width: auto !important;
        min-width: 400px;
        font-size: 0.75rem;
    }

    .section-grid-table:not(.section-grid-table-fixed) thead th {
        font-size: 0.68rem;
        padding: 0.25rem 0.3rem;
    }

    .section-grid-table:not(.section-grid-table-fixed) tbody td {
        padding: 0.2rem 0.3rem;
        height: 28px;
        font-size: 0.72rem;
    }

    .section-grid-table:not(.section-grid-table-fixed) .section-row {
        height: 28px;
    }

    /* ── Toolbar: ultra-compact ── */
    /* The buttons themselves are toolbar.css's, as above. */
    .section-toolbar-row > small {
        font-size: 0.65rem;
    }

    .section-title {
        font-size: 0.85rem;
    }

    .section-filter-cell .section-filter-op {
        flex: 0 0 1.5rem;
        width: 1.5rem;
        max-width: 1.5rem;
        font-size: 0.6rem;
    }

    .section-filter-cell select,
    .section-filter-cell input {
        font-size: 0.62rem;
        padding: 0.1rem 0.2rem;
        height: 1.4rem;
    }

    .section-multiselect-btn {
        font-size: 0.62rem;
        padding: 0.1rem 0.25rem;
        height: 1.4rem;
    }
}
/* ── Section views: card & list (point 9) ─────────────────────────────────── */
/* Card/List views reuse the grid table's tbody so paging/scroll stay intact;
   the header rows are hidden and each record renders as a full-width cell. */
.section-grid-table.section-view-card thead,
.section-grid-table.section-view-list thead {
    display: none;
}

.section-grid-table.section-view-card,
.section-grid-table.section-view-list {
    border-collapse: separate;
    border-spacing: 0;
}

.section-grid-table.section-view-card td,
.section-grid-table.section-view-list td {
    border: none;
}

.section-card-cell,
.section-list-cell {
    padding: 0.25rem 0.35rem !important;
}

/* Multi-column card layout: the tbody becomes a grid so cards flow left-to-right
   and fill the full container width; each row's single <td> (display:contents on
   the <tr> lets it participate directly) is one grid item = one card. */
.section-grid-table.section-view-card tbody {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 0.45rem;
    align-items: start;
    padding: 0.15rem;
}

.section-grid-table.section-view-card tbody tr.section-card-row {
    display: contents;
}

.section-grid-table.section-view-card td.section-card-cell {
    display: block !important;
    height: auto !important;
    padding: 0 !important;
    white-space: normal !important;
    overflow: visible !important;
    border: none !important;
}

.section-card {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    border: 1px solid var(--bs-border-color, #dee2e6);
    border-radius: 0.4rem;
    padding: 0.4rem 0.55rem;
    background: var(--bs-body-bg, #fff);
    height: 100%;
    box-sizing: border-box;
}

/* Issue #230: each declared group is its own CSS grid; field widths span tracks. */
.section-card-group {
    display: grid;
    gap: 0.15rem 0.6rem;
    min-width: 0;
}

.section-card-group-legend {
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    color: var(--bs-secondary-color, #6c757d);
}

.section-card-field {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.section-card-field[draggable="true"],
th.section-sortable[draggable="true"] {
    cursor: grab;
}

.section-card-field.section-field-dragging,
th.section-sortable.section-field-dragging {
    opacity: 0.55;
}

.section-card-field.section-field-drop-before,
th.section-sortable.section-field-drop-before {
    box-shadow: inset 3px 0 0 var(--bs-primary, #0d6efd);
}

.section-card-field.section-field-drop-after,
th.section-sortable.section-field-drop-after {
    box-shadow: inset -3px 0 0 var(--bs-primary, #0d6efd);
}

.section-card-field[data-fixed="1"],
th.section-sortable[data-fixed="1"] {
    cursor: default;
}

.section-card-label {
    font-size: 0.58rem;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    color: var(--bs-secondary-color, #6c757d);
}

.section-card-value {
    font-size: 0.8rem;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    /* Same reason as .section-form-view-value below: a blanked draft field must
       still be a box you can see and click. */
    min-height: 1.3em;
}

/* Selection checkbox moved inside the card (top-right) so the card stays the
   only grid item per row — keeping it as a sibling <td> would break pairing
   once cards wrap onto multiple grid rows. */
.section-card-sel {
    position: absolute;
    top: 0.4rem;
    right: 0.5rem;
}

.section-list-item {
    display: flex;
    align-items: baseline;
    gap: 0.75rem;
    padding: 0.4rem 0.6rem;
    border-bottom: 1px solid var(--bs-border-color, #eee);
}

.section-list-title {
    font-weight: 600;
    flex: 0 0 auto;
}

.section-list-details {
    display: flex;
    flex-wrap: wrap;
    gap: 0.15rem 0.9rem;
    color: var(--bs-secondary-color, #6c757d);
    font-size: 0.75rem;
}

.section-row.section-card-row:hover .section-card,
.section-row.section-list-row:hover .section-list-item {
    background: var(--bs-tertiary-bg, #f4f6f8);
}

.section-view-btn.active {
    background-color: var(--bs-secondary, #6c757d);
    color: #fff;
}

/* ── Form view: one full record per page, grouped read-only fields ─────────── */
.section-grid-table.section-view-form thead {
    display: none;
}

.section-grid-table.section-view-form,
.section-grid-table.section-view-form td {
    border: none;
}

.section-form-cell {
    padding: 0.35rem 0.4rem !important;
}

.section-form-view {
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
}

.section-form-view-group {
    border: 1px solid var(--bs-border-color, #dee2e6);
    border-radius: 0.5rem;
    padding: 0.4rem 0.9rem 0.8rem;
    margin: 0;
    background: var(--bs-body-bg, #fff);
    min-width: 0;
}

.section-form-view-legend {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--bs-secondary-color, #6c757d);
    width: auto;
    padding: 0 0.4rem;
    margin: 0;
}

.section-form-view-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 0.55rem 1.4rem;
}

.section-form-view-field {
    display: flex;
    flex-direction: column;
    min-width: 0;
    padding: 0.15rem 0;
    border-bottom: 1px solid var(--bs-border-color-translucent, rgba(0, 0, 0, 0.06));
}

.section-form-view-label {
    font-size: 0.62rem;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    color: var(--bs-secondary-color, #6c757d);
}

.section-form-view-value {
    font-size: 0.95rem;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
    /* An empty span builds no line box, so a field with no text is a zero-height
       box: the draft record New inserts (insertDraftRow blanks every [data-field])
       collapsed into a stack of labels, and FieldEditor — which sizes its overlay
       to the cell rect exactly (fieldEditor.ts _position) — opened a two-pixel
       input nobody could type in. One line's worth of height, always. */
    min-height: 1.3em;
}

/* The record the page was showing while a draft is open on top of it. Form view
   paints one record per page (sectionPage.ts startCalculation forces pageSize = 1),
   so without this New put a blank module above a full one and the page read as two
   records at once. Set per row by _parkFormSiblings, never on the tbody: the slice
   that follows Save or Cancel replaces the rows wholesale, which is also what
   clears it. */
.section-row.section-form-row-parked {
    display: none;
}

/* A draft's fields are empty, so nothing in them says "type here" the way a value
   does. Same cue the kanban draft card uses. */
.section-row.section-full-edit-new .section-form-view-value,
.section-row.section-full-edit-new .section-card-value {
    cursor: text;
}

/* ── Bound form (FormEditMode = BoundControls) ─────────────────────────────
   The form view's value spans hold live controls instead of text. The span keeps
   its place in the grid; only what is inside it changes, so the layout is the
   same whether the record is being read or written — which is the point: a form
   that rearranges itself when you start typing is a form you have to re-find
   your place in. */
.section-form-view-value[data-bound-control] {
    white-space: normal;
    overflow: visible;
}

.section-bound-input {
    width: 100%;
    min-width: 0;
}

/* A disabled control is a read-only or store-generated field. It stays in place,
   flat rather than boxed, so it reads as "this one is not yours to change"
   instead of "this one is broken". */
.section-bound-input:disabled,
.section-bound-input[readonly]:disabled {
    background: transparent;
    border-color: transparent;
    padding-left: 0;
    padding-right: 0;
    color: var(--bs-secondary-color, #6c757d);
}

.section-bound-delegated {
    cursor: pointer;
    background: var(--bs-body-bg, #fff);
}

.section-bound-check {
    margin-top: 0.15rem;
}

.section-bound-fk {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    min-width: 0;
}

.section-bound-fk .section-eip-fk-text {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* A field the server refused. Cleared on the next successful commit of that field. */
.section-bound-field-error .section-bound-input {
    border-color: var(--bs-danger, #dc3545);
}

/* ── Toolbar view menu (single button + dropdown of available views) ──────── */
.section-view-menu-wrap {
    position: relative;
    display: inline-flex;
}

.section-view-menu {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    z-index: 1050;
    min-width: 168px;
    padding: 0.25rem;
    background: var(--bs-body-bg, #fff);
    border: 1px solid var(--bs-border-color, #dee2e6);
    border-radius: 0.5rem;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.section-view-menu.open {
    display: block;
}

.section-view-item {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    width: 100%;
    padding: 0.4rem 0.6rem;
    border: none;
    border-radius: 0.35rem;
    background: transparent;
    color: var(--bs-body-color, #212529);
    font-size: 0.85rem;
    text-align: left;
    cursor: pointer;
}

.section-view-item:hover {
    background: var(--bs-tertiary-bg, #f4f6f8);
}

.section-view-item:disabled {
    opacity: 0.45;
    cursor: default;
}

.section-view-item:disabled:hover {
    background: transparent;
}

.section-view-item.active {
    font-weight: 600;
}

/* Divides the menu into its three parts: the shapes the section offers, "Manage
   views…", then the user's own saved views. */
.section-view-item-sep {
    margin-top: 0.25rem;
    border-top: 1px solid var(--bs-border-color, #dee2e6);
    padding-top: 0.45rem;
    border-radius: 0;
}

.section-view-item-icon {
    width: 1rem;
    text-align: center;
    color: var(--bs-secondary-color, #6c757d);
}

.section-view-item-label {
    flex: 1 1 auto;
}

.section-view-check {
    color: var(--bs-primary, #0d6efd);
    font-size: 0.8rem;
}

/* ── Composite pages (point 4): multi-section layouts ─────────────────────── */
/* Fills <main> exactly (100% of its content box — main.container-fluid in core/shell.css already
   insets it a few px on every side, so this stays flush with no height guesswork/padding
   of its own; a stale hardcoded calc(100vh - Npx) here used to drift from main's real,
   flexbox-computed height and throw the outer margin off). */
.composite-page {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    height: 100%;
    min-height: 0;
}

/* PageToolbar-scope designed commands: a fixed chrome strip immediately above the composite
   page, deliberately rendered as its sibling rather than its child — see contextMenu.ts's
   renderPageToolbar for why (pageSplitter treats every direct child as a resizable pane). */
.composite-page-toolbar {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    flex-wrap: wrap;
    margin-bottom: 0.5rem;
    /* Same reason as .section-toolbar-row above. */
    padding: 0.3rem 0.45rem;
    border-radius: 0.3rem;
    border: 1px solid transparent;
}

/* Page splitters: one handle between every direct child of the page root. */
.composite-page.lf-page-split-root {
    gap: 0;
}

.lf-page-splitter {
    flex: 0 0 7px;
    width: 100%;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 3px;
    background: transparent;
    cursor: row-resize;
    position: relative;
    touch-action: none;
    user-select: none;
    z-index: 2;
}

.lf-page-splitter::before {
    content: "";
    position: absolute;
    left: 12%;
    right: 12%;
    top: 50%;
    height: 2px;
    transform: translateY(-50%);
    border-radius: 1px;
    background: var(--bs-border-color, #ced4da);
    transition: background-color 0.12s ease, height 0.12s ease, left 0.12s ease, right 0.12s ease;
}

.lf-page-splitter:hover::before,
.lf-page-splitter:focus-visible::before,
.lf-page-splitter.is-dragging::before {
    height: 3px;
    left: 8%;
    right: 8%;
    background: var(--bs-secondary, #6c757d);
}

.lf-page-splitter:focus-visible {
    outline: 2px solid var(--bs-secondary, #6c757d);
    outline-offset: 1px;
}

body.lf-page-splitter-active {
    cursor: row-resize !important;
}

body.lf-page-splitter-active * {
    cursor: row-resize !important;
    user-select: none !important;
}

.composite-page.lf-page-split-root > .lf-page-split-pane {
    min-height: 0;
}

.composite-page[data-layout="Explorer"] {
    flex-direction: row;
    gap: 0;
}

.composite-explorer-side {
    flex: 0 0 28%;
    min-width: 16rem;
    max-width: 50%;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

.composite-explorer-side > .composite-section {
    flex: 1 1 50%;
    min-height: 8rem;
    overflow: hidden;
}

.composite-explorer-main {
    flex: 1 1 auto;
    min-width: 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.composite-explorer-main > .composite-section {
    flex: 1 1 auto;
    min-height: 0;
}

.composite-page[data-layout="Explorer"] > .lf-page-splitter {
    flex: 0 0 7px;
    width: 7px;
    height: auto;
    cursor: col-resize;
}

.composite-page[data-layout="Explorer"] > .lf-page-splitter::before {
    left: 50%;
    right: auto;
    top: 12%;
    bottom: 12%;
    width: 2px;
    height: auto;
    transform: translateX(-50%);
}

.composite-page[data-layout="Explorer"] > .lf-page-splitter:hover::before,
.composite-page[data-layout="Explorer"] > .lf-page-splitter:focus-visible::before,
.composite-page[data-layout="Explorer"] > .lf-page-splitter.is-dragging::before {
    width: 3px;
    height: auto;
    top: 8%;
    bottom: 8%;
    left: 50%;
    right: auto;
}

body.lf-page-splitter-active-vertical {
    cursor: col-resize !important;
}

body.lf-page-splitter-active-vertical * {
    cursor: col-resize !important;
    user-select: none !important;
}

.composite-page[data-layout="MasterDetail"] .composite-master {
    /* Give the master a definite share of the page height so section-page-body
       (flex:1; min-height:0) does not collapse to 0 before the first load.
       Detail still takes the larger remaining share below. */
    flex: 0 1 38%;
    max-height: 42%;
    /* 10rem (160px at the shell's 16px root) left the master, under its toolbar, filter row and
       header, room for one row on a 720px-high window, and it paged through the rest a record at a
       time. A min-height beats the max-height, so a short window gives the master five or six rows
       and the detail the rest; a tall one is unchanged, the 38% being more than this already. */
    min-height: 300px;
    overflow: auto;
}

.composite-page[data-layout="MasterDetail"] .composite-detail {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

/* The detail region's tabs are a tabset (issue #36), so the strip and the panes are one element
   here, not two siblings — hence `> .lf-tabset >` where these rules used to say `>`. */
.composite-page[data-layout="MasterDetail"] .composite-detail > .lf-tabset > .composite-tab-content {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.composite-page[data-layout="MasterDetail"] .composite-detail > .lf-tabset > .composite-tab-content > .tab-pane {
    flex: 1 1 auto;
    min-height: 0;
}

.composite-page[data-layout="MasterDetail"] .composite-detail > .lf-tabset > .composite-tab-content > .tab-pane.active {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.composite-page[data-layout="MasterDetail"] .composite-detail > .composite-section {
    flex: 1 1 auto;
    min-height: 0;
}

.composite-section {
    min-height: 0;
    display: flex;
    flex-direction: column;
}

/* .lf-section-host, not the section marker itself: that marker's data-* prefix is configurable
   (EmbeddedSettings.AttributePrefix, issue #119) and a static stylesheet cannot match a name
   chosen at runtime. _CompositePage.cshtml emits the class beside the marker, and
   sectionPage.ts adds it to hosts a view declared itself. */
.composite-section > .lf-section-host,
.composite-section > [data-custom-panel] {
    flex: 1 1 auto;
    min-height: 0;
}

.custom-panel-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    overflow: auto;
}

.composite-tab-content {
    flex: 1 1 auto;
    min-height: 0;
}

.composite-tab-content .tab-pane.active {
    height: 100%;
}

.composite-page[data-layout="Stacked"] .composite-section,
.composite-page[data-layout="Single"] .composite-section {
    flex: 1 1 auto;
}

/* ── Field-link inherited/locked inputs (point 6) ─────────────────────────── */
.section-inherited-locked {
    background-color: var(--bs-tertiary-bg, #eef1f4) !important;
    cursor: not-allowed;
}

/* ── Linked fields (FK A → B) ─────────────────────────────────────────────── */
/* Read-only display box of the referenced record inside A's form. */
.section-linked-widget .section-linked-display {
    background-color: var(--bs-secondary-bg, #f2f4f7);
    cursor: default;
}
.section-linked-widget .section-linked-display:read-only {
    background-color: var(--bs-secondary-bg, #f2f4f7);
}
/* Virtual B columns in A's grid. */
.section-grid-table td.section-linked-cell {
    font-style: italic;
    color: var(--bs-secondary-color, #6c757d);
}
.section-header-row th.section-linked-header {
    font-style: italic;
}

/* ── FK picker window (hosts a real section module) ───────────────────────── */
.section-picker-root {
    position: fixed;
    inset: 0;
    /* z-index assigned by overlayStack.registerOverlay */
    display: flex;
    align-items: center;
    justify-content: center;
}
.section-picker-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, .5);
}
.section-picker {
    position: relative;
    width: min(1100px, 95vw);
    height: min(80vh, 820px);
    display: flex;
    flex-direction: column;
    background: var(--bs-body-bg, #fff);
    border: 1px solid var(--bs-border-color, #dee2e6);
    border-radius: .5rem;
    overflow: hidden;
}
.section-picker.section-picker-expanded {
    width: calc(100vw - 1.5rem);
    height: calc(100vh - 1.5rem);
    max-width: none;
}
.section-picker-header {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .5rem;
    padding: .55rem .9rem;
    border-bottom: 1px solid var(--bs-border-color, #dee2e6);
}
.section-picker-titleblock {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: .15rem;
}
.section-picker-title {
    font-weight: 600;
}
.section-picker-hint {
    font-weight: 400;
    line-height: 1.2;
}
.section-picker-window {
    flex: 0 0 auto;
    align-items: center;
}
.section-picker-window .btn-close {
    margin-left: .35rem;
}
/* The embedded SectionManager renders into this element and sizes to 100% height,
   so it needs a definite, scroll-contained box to lay out its virtual grid. */
.section-picker-host {
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
    position: relative;
}
/* Inside the picker the section is already framed by the window chrome: drop its
   own outer card padding/shadow so the grid fills the host cleanly. */
.section-picker-host .section-page-container,
.section-picker-host .section-page-card {
    height: 100%;
}
.section-picker-host .section-page-card {
    padding: .5rem !important;
    border: 0;
    box-shadow: none;
}

/* Read-only B fields shown under the linked-field widget (e.g. country description). */
.section-linked-details {
    margin-top: .35rem;
    display: flex;
    flex-direction: column;
    gap: .15rem;
}
.section-linked-detail {
    display: flex;
    gap: .4rem;
    font-size: .8125rem;
    line-height: 1.25;
}
.section-linked-detail-label {
    color: var(--bs-secondary-color, #6c757d);
    font-weight: 500;
    min-width: 7rem;
}
.section-linked-detail-label::after { content: ":"; }
.section-linked-detail-val {
    color: var(--bs-body-color, #212529);
}

/* Foreign-key picker inside the inline insert/edit bar (filter row). */
.section-filter-control.section-linked-filter {
    display: flex;
    align-items: center;
    gap: .15rem;
    flex: 1 1 auto;
    min-width: 0;
}
.section-linked-filter .section-linked-filter-display {
    flex: 1 1 auto;
    min-width: 3rem;
    background-color: var(--bs-secondary-bg, #f2f4f7);
    cursor: default;
}
.section-linked-filter .btn {
    flex: 0 0 auto;
}

/* ── Section detail modal: anchored to <main>, title-bar toolbar, maximize ── */

/* Anchor the whole modal (and its own scoped backdrop) to the content area rect that
   is set inline from <main>.getBoundingClientRect(), so it NEVER overlaps the fixed app
   header or footer. Bootstrap's viewport-fixed backdrop is disabled; this element IS the
   backdrop (dim wash) confined to the content area. */
.section-detail-modal.section-modal-anchored {
    position: fixed;
    background: rgba(15, 23, 42, .45);
}

/* Title bar in three zones: LEFT title/icon/#id, CENTER toolbar, RIGHT window controls.
   LEFT and RIGHT are `auto` (sized to their own content, never squeezed) so the title never
   degrades into the single-character-per-line wrap `overflow-wrap: anywhere` below would
   otherwise produce; CENTER is the only flexible (`minmax(0, 1fr)`) track, so it is the one that
   shrinks — and, per the rule below, scrolls horizontally instead of shrinking its buttons —
   whenever a toolbar's natural width doesn't fit. This matters far more than it used to once
   FullEdit's private per-modal toolbar (detailFullEditToolbar.ts) started sharing this same
   header: it carries five button groups plus a "go to a page" search box, comfortably wider than
   the classic Insert/Edit/Delete/Save/Cancel + pagination toolbar this layout was first written
   for — verified live: without this, the title column was compressed to a few px and its text
   wrapped one letter per line. */
.section-detail-modal .modal-header.section-modal-header {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: .5rem;
    padding-block: .4rem;
}
.section-modal-titlebar {
    grid-column: 1;
    justify-self: start;
    display: flex;
    align-items: center;
    gap: .4rem;
    min-width: 0;
    max-width: 100%;
}
.section-modal-title-icon { flex: 0 0 auto; opacity: .8; }
.section-modal-title {
    font-weight: 600;
    font-size: .95rem;
    line-height: 1.15;
    min-width: 0;
    /* If the section title is too long for its zone, wrap onto a second line (and the
       slightly smaller font already helps it fit) rather than pushing the toolbar. */
    overflow-wrap: anywhere;
}
.section-modal-recid {
    flex: 0 0 auto;
    color: var(--bs-secondary-color, #6c757d);
    font-variant-numeric: tabular-nums;
}
.section-modal-mode {
    flex: 0 0 auto;
    font-weight: 600;
    letter-spacing: .02em;
}
.section-modal-mode:empty { display: none; }
/* Record-state indicator (Issue #13): green dot = read/unchanged, yellow = new,
   red = modified (with a live count of changed fields). Sits left of the record
   navigation toolbar. "Read" shows only the colored dot; "new"/"modified" also
   carry a short text label so the state isn't conveyed by color alone. */
.section-modal-recordstate {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    font-size: .72rem;
    font-weight: 600;
    line-height: 1;
}
.section-modal-recordstate-dot { font-size: .5rem; }
.section-modal-recordstate-label:empty { display: none; }

/* Grid/card/form's single record-state indicator (Issue #13/#55 revision), left of the
   toolbar's "Pag x/y (…) N righe" page info (sectionPage.ts's _buildToolbarRecordStateHtml).
   FieldEditor and SectionEditInPlace are both singletons, so at most one row is ever mid-edit
   — this one lives outside the <table> (in the toolbar), so EditInPlace gates it via
   .section-eip-active-root on the section's root instead of .section-eip-active on the
   <table> itself (see activate()/deactivate() in sectionEditInPlace.ts). Not used by list,
   which is always read-only and has no record-state indicator at all. */
.section-toolbar-recordstate {
    display: none;
    align-items: center;
    gap: .3rem;
    font-size: .72rem;
    font-weight: 600;
    line-height: 1;
    margin-right: .5rem;
}
html.lf-full-edit .section-toolbar-recordstate,
.section-eip-active-root .section-toolbar-recordstate {
    display: inline-flex;
}
.section-toolbar-recordstate-dot { font-size: .5rem; }
.section-toolbar-recordstate-label:empty { display: none; }
.section-modal-toolbar,
.section-detail-fulledit-toolbar {
    grid-column: 2;
    justify-self: center;
    /* Grid items default to `min-width: auto` (= their own min-content), which would keep
       forcing this column back to its natural (unwrapped) width — wider than the
       `minmax(0, 1fr)` track above ever promises it — and squeeze the title/window-controls
       columns instead of actually shrinking. `min-width: 0` lets the column take whatever width
       the track assigns; `flex-wrap: wrap` (Bootstrap's own `.btn-toolbar` default — restored
       here rather than fighting it) then reflows the button groups onto a second row instead of
       clipping them, so the row grows the header's height rather than hiding buttons or (worse)
       clipping the "Go to a page" / view-switcher dropdowns that pop out of this same row via
       `position: absolute` (an `overflow: hidden`/`auto` here would have cut those off).
       Issue #43's detail profile is narrower (New/Save/Delete +
       pagination, plus any section-level custom commands) — the wrap still matters when
       those sit next to a long title. */
    min-width: 0;
    max-width: 100%;
    flex-wrap: wrap;
    row-gap: .25rem;
}
.section-modal-window { grid-column: 3; justify-self: end; align-items: center; flex: 0 0 auto; }

/* Incremental maximize: 3 steps. Sizes are relative to the anchored box (= the content
   area), so "fullscreen" fills <main> only — never the header/footer. */
.section-modal-anchored .section-modal-dialog {
    max-height: 100%;
    margin: .5rem auto;
}
.section-modal-anchored .section-modal-dialog.section-modal-size-0 { max-width: 800px; }
.section-modal-anchored .section-modal-dialog.section-modal-size-1 { max-width: min(1200px, 94%); }
.section-modal-anchored .section-modal-dialog.section-modal-size-2 {
    max-width: none;
    width: 100%;
    height: 100%;
    margin: 0;
}
.section-modal-anchored .section-modal-dialog.section-modal-size-2 .modal-content {
    height: 100%;
    border: 0;
    border-radius: 0;
}

/* The detail lives entirely in the (scrollable) body and is horizontally centered;
   there is no footer, so it can never spill into the header/footer. */
.section-detail-modal .section-modal-body { overflow: auto; }
.section-detail-modal .section-modal-body .section-form {
    max-width: 1040px;
    margin-inline: auto;
}
.section-modal-dialog.section-modal-size-2 .section-modal-body .section-form { max-width: 1280px; }

/* Descriptor opt-in (DetailZoomOnEnlarge): zoom text + controls together with the
   container. When off, only the container grows and the content reflows at its own size. */
.section-modal-dialog.section-modal-zoom.section-modal-size-1 .section-modal-body { zoom: 1.15; }
.section-modal-dialog.section-modal-zoom.section-modal-size-2 .section-modal-body { zoom: 1.30; }

/* Visual accent for the active editing/creating mode. */
.section-modal-dialog.section-modal-editing .modal-content { box-shadow: 0 0 0 2px var(--bs-warning, #ffc107); }
.section-modal-dialog.section-modal-creating .modal-content { box-shadow: 0 0 0 2px var(--bs-success, #198754); }

/* Dirty (modified-after-read) indicators: per-field accent + a record-level asterisk. */
.section-field-dirty .form-control,
.section-field-dirty .form-select,
.section-field-dirty textarea.form-control {
    border-color: var(--bs-warning, #ffc107);
    box-shadow: 0 0 0 .12rem rgba(255, 193, 7, .25);
}
.section-field-dirty .form-label::after {
    content: " \25CF"; /* small bullet */
    color: var(--bs-warning, #ffc107);
    font-size: .7em;
    vertical-align: middle;
}
.section-modal-dirty .section-modal-recid::after {
    content: " *";
    color: var(--bs-warning, #ffc107);
    font-weight: 700;
}

/* ── Generic dialog / popup module (replaces native alert/confirm) ── */
.dialog-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, .5);
    opacity: 0;
    transition: opacity .15s ease;
}
.dialog-backdrop.show { opacity: 1; }

/* A dialog confined to one surface (issue #59 §7.2: SpaDesktop anchors dialogs to the window
   they belong to). The wrapper is positioned and sized to that window by dialog.ts; the backdrop
   and the modal, which both assume the viewport, are pulled back inside it. */
.dialog-overlay-root.dialog-confined .dialog-backdrop,
.dialog-overlay-root.dialog-confined .dialog-modal {
    position: absolute;
    inset: 0;
}
.dialog-modal.dialog-animate .modal-dialog {
    transform: translateY(-10px) scale(.985);
    opacity: 0;
    transition: transform .15s ease, opacity .15s ease;
}
.dialog-modal.dialog-animate.show .modal-dialog {
    transform: none;
    opacity: 1;
}
.dialog-message { white-space: normal; word-break: break-word; }
.dialog-header .dialog-icon { opacity: .85; }
.dialog-prompt .form-label { font-weight: 600; }

/* ── EditInPlace (single floating in-cell editor) ────────────────────── */
.section-eip-active .section-row td { cursor: cell; }
.section-eip-active { user-select: none; }
.section-eip-cell-current { outline: 2px solid var(--bs-primary, #0d6efd); outline-offset: -2px; }

/* ── FullEdit: the cell cursor (issue #112) ──────────────────────────────
   Where the keyboard is after Escape closed the field editor: the cell is
   outlined and focused, but is not an editor. Same outline EditInPlace uses
   for the same idea one line above — two editors, one visual answer to
   "which cell am I on". Not keyed off `:focus`: the cell only claims focus
   when nothing else has (fieldEditor.ts _showCursor), and the cursor still
   has to be visible when something else did. */
.section-field-cell-current,
.section-field-cell-current:focus,
.section-field-cell-current:focus-visible { outline: 2px solid var(--bs-primary, #0d6efd); outline-offset: -2px; }
/* A read-only session answering "edit this" (issue #187, D5): the outline shakes once. Not under
   prefers-reduced-motion, where the toast alone says it. */
.section-field-cell-refused { animation: lf-cell-refused .3s ease-in-out; }
@keyframes lf-cell-refused {
    0%, 100% { outline-offset: -2px; }
    25% { outline-offset: -4px; outline-color: var(--bs-warning, #ffc107); }
    75% { outline-offset: 0; outline-color: var(--bs-warning, #ffc107); }
}
.section-eip-row-current { background: rgba(13, 110, 253, .06); }
.section-eip-row-dirty td[data-field] { }
.section-eip-row-dirty::after { }

.section-eip-editor {
    position: fixed;
    /* z-index set inline via overlayStack.zIndexAbove */
    box-sizing: border-box;
    display: flex;
    align-items: stretch;
    background: var(--bs-body-bg, #fff);
    box-shadow: 0 2px 10px rgba(0, 0, 0, .18);
    border-radius: 2px;
    overflow: visible;
}
.section-eip-editor .section-eip-input {
    width: 100%;
    height: 100%;
    box-sizing: border-box;
    border: 2px solid var(--bs-primary, #0d6efd);
    border-radius: 2px;
    padding: 0 .4rem;
    font-size: .85rem;
    background: var(--bs-body-bg, #fff);
    color: var(--bs-body-color, #212529);
}
.section-eip-editor textarea.section-eip-input { padding: .25rem .4rem; resize: none; }
.section-eip-editor .section-eip-check {
    margin: auto;
    width: 1.1rem;
    height: 1.1rem;
}
.section-eip-editor select.section-eip-input { padding: 0 .2rem; }
.section-eip-editor .section-eip-input:disabled {
    background: var(--bs-secondary-bg, #e9ecef);
    border-color: var(--bs-secondary, #6c757d);
    color: var(--bs-secondary-color, #6c757d);
}
/* Editing mode (issue #5): the border switches from "selected, arrows change cell" (blue,
   the default look above) to "typing, arrows move the caret" (amber) so the two keyboard
   states are visually distinguishable at a glance. */
.section-eip-editor.section-eip-editor-editing .section-eip-input {
    border-color: var(--bs-warning, #ffc107);
}

.section-eip-fk {
    display: flex;
    width: 100%;
    height: 100%;
    align-items: center;
    gap: .25rem;
    border: 2px solid var(--bs-primary, #0d6efd);
    border-radius: 2px;
    background: var(--bs-body-bg, #fff);
    padding: 0 .25rem;
    box-sizing: border-box;
}
.section-eip-fk-text {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: .85rem;
}
.section-eip-fk-btn { flex: 0 0 auto; padding: 0 .35rem; line-height: 1.2; }
/* A button whose icon has not been drawn yet is still a button: without a minimum it collapsed
   to its borders (2px) and a click meant for it hit the text beside it. */
.section-eip-fk-btn { min-width: 1.6rem; min-height: 1.4rem; }
.section-eip-fk-more { min-width: 1rem; }
.section-eip-fk-btn + .section-eip-fk-btn { margin-left: 0; }
/* The caret that opens the secondary-actions dropdown is kept as narrow as possible. */
.section-eip-fk-more { padding: 0 .18rem; }

/* Narrow caret for the modal / insert-bar FK widgets (Bootstrap input-group buttons). */
.section-linked-more,
.section-linked-filter-more { padding-left: .3rem; padding-right: .3rem; }
.section-linked-more .fa-caret-down,
.section-linked-filter-more .fa-caret-down,
.section-eip-fk-more .fa-caret-down { font-size: .8em; }

/* Body-appended dropdown holding the FK secondary actions (Open / Clear). Positioned as
   `fixed` by fkMenu.ts; z-index set via overlayStack.zIndexAbove. */
.section-fk-menu {
    position: fixed;
    min-width: 8rem;
    padding: .25rem 0;
    display: block;
}
.section-fk-menu .section-fk-menu-item {
    display: block;
    width: 100%;
    text-align: left;
    font-size: .875rem;
    padding: .35rem .9rem;
    white-space: nowrap;
}

/* ── Middle-button auto-scroll (sectionMiddleScroll.ts) ──────────────────── */
.section-middle-scroll-active,
.section-middle-scroll-active * {
    cursor: all-scroll !important;
}
body.lf-middle-scroll-active {
    cursor: all-scroll !important;
    user-select: none !important;
}
.section-middle-scroll-marker {
    position: fixed;
    width: 28px;
    height: 28px;
    z-index: 4000;
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--bs-body-bg, #fff);
    border: 1px solid var(--bs-border-color, #dee2e6);
    box-shadow: 0 .15rem .4rem rgba(0, 0, 0, .18);
    color: var(--bs-secondary-color, #6c757d);
    font-size: .75rem;
    opacity: .85;
    transition: color .12s ease, opacity .12s ease;
}
.section-middle-scroll-marker.is-scrolling {
    color: var(--bs-primary, #0d6efd);
    opacity: 1;
}

/* ── Stacked section overlay (sectionOverlay.ts) ─────────────────────────── */
.section-overlay-root {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}
.section-overlay-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, .45);
}
.section-overlay-panel {
    position: relative;
    width: min(960px, 96vw);
    height: min(78vh, 720px);
    display: flex;
    flex-direction: column;
    background: var(--bs-body-bg, #fff);
    border: 1px solid var(--bs-border-color, #dee2e6);
    border-radius: .5rem;
    overflow: hidden;
}
.section-overlay-header {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .65rem .9rem;
    border-bottom: 1px solid var(--bs-border-color, #dee2e6);
}
.section-overlay-title {
    font-weight: 600;
}
.section-overlay-body {
    flex: 1 1 auto;
    overflow: auto;
    padding: .5rem .75rem;
}
.section-overlay-host {
    min-height: 220px;
}
.section-overlay-host:not(.lf-secondary-section) .section-page-card {
    box-shadow: none;
    border: 1px solid var(--bs-border-color, #dee2e6);
    padding: .5rem !important;
}

:root {
    --lf-z-overlay-min: 1080;
    --lf-z-overlay-step: 20;
    --lf-z-editor-step: 10;
}

/* Conflict merge popup (conflictMergePopup.ts) — hosts SectionConflict InMemory section. */
.section-conflict-root {
    position: fixed;
    inset: 0;
    /* z-index assigned by overlayStack.registerOverlay */
    display: flex;
    align-items: center;
    justify-content: center;
}
.section-conflict-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, .45);
}
.section-conflict-panel {
    position: relative;
    width: min(960px, 96vw);
    height: min(78vh, 720px);
    display: flex;
    flex-direction: column;
    background: var(--bs-body-bg, #fff);
    border: 1px solid var(--bs-border-color, #dee2e6);
    border-radius: .5rem;
    overflow: hidden;
}
.section-conflict-header {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .65rem .9rem;
    border-bottom: 1px solid var(--bs-border-color, #dee2e6);
}
.section-conflict-title {
    font-weight: 600;
}
.section-conflict-body {
    flex: 1 1 auto;
    overflow: auto;
    padding: .75rem .9rem;
}
.section-conflict-host {
    min-height: 220px;
}
.section-conflict-host .section-page-card {
    box-shadow: none;
    border: 1px solid var(--bs-border-color, #dee2e6);
    padding: .5rem !important;
}
.section-conflict-footer {
    flex: 0 0 auto;
    display: flex;
    justify-content: flex-end;
    gap: .5rem;
    padding: .65rem .9rem;
    border-top: 1px solid var(--bs-border-color, #dee2e6);
}

/* ══════════════════════════════════════════════════════════════════════════
   "MANAGE VIEWS" POPUP (sectionViewsPanel.ts)
   Two InMemory sections stacked in one overlay: the saved views on top, the
   fields of the selected one below. Same shell as the conflict popup — the two
   are the same kind of thing, a section hosted outside the page flow — but
   taller, because it holds two of them.
   ══════════════════════════════════════════════════════════════════════════ */
.section-views-root {
    position: fixed;
    inset: 0;
    /* z-index assigned by overlayStack.registerOverlay */
    display: flex;
    align-items: center;
    justify-content: center;
}
.section-views-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, .45);
}
.section-views-panel {
    position: relative;
    width: min(1100px, 96vw);
    height: min(86vh, 860px);
    display: flex;
    flex-direction: column;
    background: var(--bs-body-bg, #fff);
    border: 1px solid var(--bs-border-color, #dee2e6);
    border-radius: .5rem;
    overflow: hidden;
}
.section-views-header {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .65rem .9rem;
    border-bottom: 1px solid var(--bs-border-color, #dee2e6);
}
.section-views-title {
    font-weight: 600;
}
.section-views-body {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    gap: .75rem;
    overflow: hidden;
    padding: .75rem .9rem;
}
/* The views list is the smaller of the two: a handful of records against one row
   per field of the section being arranged. */
.section-views-pane-definitions {
    flex: 0 0 38%;
    min-height: 180px;
}
.section-views-pane-fields {
    flex: 1 1 auto;
    min-height: 220px;
    display: flex;
    flex-direction: column;
}
.section-views-pane {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.section-views-host {
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
}
.section-views-host .section-page-card {
    box-shadow: none;
    border: 1px solid var(--bs-border-color, #dee2e6);
    padding: .5rem !important;
}
.section-views-hint {
    flex: 0 0 auto;
}

/* Per-field optimistic-conflict resolution popup (legacy conflictPopup.ts). Body-appended and
   `fixed`-positioned next to the conflicting field, same technique as .section-fk-menu, so it
   is never clipped by the tiny EIP cell editor or the detail modal. */
.section-conflict-popup {
    position: fixed;
    /* z-index set inline via overlayStack.zIndexAbove */
    width: 17rem;
    max-width: calc(100vw - 12px);
    padding: .6rem .7rem;
    background: var(--bs-body-bg, #fff);
    color: var(--bs-body-color, #212529);
    border: 1px solid var(--bs-warning, #ffc107);
    border-radius: .4rem;
    box-shadow: 0 .25rem .75rem rgba(0, 0, 0, .2);
}
.section-conflict-popup-title {
    font-weight: 600;
    font-size: .8125rem;
    margin-bottom: .4rem;
    padding-bottom: .3rem;
    border-bottom: 1px solid var(--bs-border-color, #dee2e6);
}
.section-conflict-popup-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: .5rem;
    font-size: .8125rem;
    line-height: 1.3;
    margin-bottom: .2rem;
}
.section-conflict-popup-tag {
    color: var(--bs-secondary-color, #6c757d);
    white-space: nowrap;
}
.section-conflict-popup-val {
    font-weight: 500;
    text-align: right;
    overflow-wrap: anywhere;
}
.section-conflict-popup-edit {
    display: flex;
    gap: .35rem;
    margin: .4rem 0;
}
.section-conflict-popup-edit input { flex: 1 1 auto; }
.section-conflict-popup-actions {
    display: flex;
    flex-wrap: wrap;
    gap: .3rem;
    margin-top: .5rem;
}
.section-conflict-popup-actions .btn {
    font-size: .75rem;
    padding: .2rem .5rem;
}

.section-btn-eip.section-tb-btn-active {
    background: var(--bs-primary, #0d6efd);
    color: #fff;
    border-color: var(--bs-primary, #0d6efd);
}

.section-eip-ctx { min-width: 12rem; }
.section-eip-ctx-item { font-size: .875rem; }

/* ── Column drag-resize handle ────────────────────────────────────────────
   A thin grab strip on the trailing edge of every resizable header cell.
   Drag to set an explicit width (persisted in localStorage); double-click
   to clear the manual override and go back to the declared/computed width. */
.section-grid-table thead th.section-th-resizable {
    position: relative;
}

.section-col-resize-handle {
    position: absolute;
    top: 0;
    right: -3px;
    bottom: 0;
    width: 6px;
    cursor: col-resize;
    z-index: 3;
    touch-action: none;
}

.section-col-resize-handle:hover,
body.section-col-resizing .section-col-resize-handle {
    background-color: rgba(255, 255, 255, 0.5);
}

/* While dragging: lock the cursor/selection for the whole page, not just the handle,
   so a fast mouse movement that slips off the 6px strip doesn't break the drag. */
body.section-col-resizing {
    cursor: col-resize !important;
    user-select: none !important;
}

/* ── Sized columns: fixed per-type widths via <colgroup> (overrides fill-to-viewport) ── */
.section-grid-table.section-grid-sized {
    table-layout: fixed !important;
    width: auto !important;
    /* Override the base .section-grid-table { min-width: 600px } so a pinned
       sum narrower than 600px is not stretched, and a sum wider than the
       wrapper is free to overflow into the wrapper's horizontal scroll. */
    min-width: 0 !important;
}
.section-grid-table.section-grid-sized .section-col-sel { width: 40px; }

/* Card/list/form views ignore the per-column <colgroup> sizing (it targets the tabular
   grid layout only) — let the table fill the container so the card grid has room to
   lay out multiple columns. */
.section-grid-table.section-grid-sized.section-view-card,
.section-grid-table.section-grid-sized.section-view-list,
.section-grid-table.section-grid-sized.section-view-form {
    width: 100% !important;
}

/* ── Context menu (Page / Section / Field) ─────────────────────────────────── */
.lf-context-menu {
    /* z-index set inline via overlayStack.zIndexAbove */
    min-width: 12rem;
    padding: 0.35rem 0;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

.lf-context-menu .lf-context-menu-item {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.35rem 1rem;
    white-space: nowrap;
}

.lf-element-info-pre {
    max-height: 12rem;
    overflow: auto;
    background: var(--bs-tertiary-bg, #f8f9fa);
    border-radius: 0.25rem;
    padding: 0.5rem;
    white-space: pre-wrap;
    word-break: break-word;
}

.lf-element-info dt {
    font-weight: 500;
}

.lf-element-info dd {
    margin-bottom: 0.35rem;
}

/* ── PageLayout.Canvas and PageLayout.Grid ─────────────────────────────────
   A canvas is a promise that the drawing is exactly what was drawn, so nothing
   here reflows. The three overflow modes are the only answers to a narrow
   viewport, and each one keeps every element in the same place relative to
   every other. A layout that has to adapt uses .composite-grid instead. */

.composite-canvas {
    position: relative;
    width: 100%;
    height: 100%;
}

.composite-canvas.overflow-scroll { overflow: auto; }
.composite-canvas.overflow-clip { overflow: hidden; }

/* Scale keeps the surface at its project size and shrinks the whole thing with
   one transform — proportions exact, nothing repositioned. The scrollbar stays
   on the outer element, which is not transformed, so it does not shrink too. */
.composite-canvas.overflow-scale {
    overflow: hidden auto;
}

.composite-canvas.overflow-scale .composite-canvas-surface {
    transform: scale(var(--canvas-scale, 1));
    transform-origin: top left;
}

.composite-canvas .composite-section {
    margin: 0;
    overflow: hidden;
}

.composite-grid {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: .75rem;
    align-content: start;
    height: 100%;
}

.composite-grid > .composite-section {
    min-width: 0;
    margin: 0;
}

/* Below the smallest common breakpoint a twelve-column grid is one column: the
   point of Grid is that it adapts, and twelve columns on a phone adapt to
   nothing. Canvas pages deliberately do NOT get a rule like this. */
@media (max-width: 575.98px) {
    .composite-grid > .composite-section {
        grid-column: 1 / -1 !important;
    }
}

/* ── GroupLayout.Canvas ────────────────────────────────────────────────────
   A field group drawn by hand. Same three overflow answers as a canvas page,
   for the same reason: the drawing is the promise, so nothing reflows. */

.section-form-canvas { position: relative; width: 100%; }
.section-form-canvas.overflow-scroll { overflow: auto; }
.section-form-canvas.overflow-clip { overflow: hidden; }
.section-form-canvas.overflow-scale { overflow: hidden auto; }

.section-form-canvas.overflow-scale .section-form-canvas-surface {
    transform: scale(var(--canvas-scale, 1));
    transform-origin: top left;
}

.section-form-canvas-item { display: flex; align-items: center; }
.section-form-canvas-item > * { width: 100%; }

.section-form-label { font-weight: 600; }
.section-form-image { max-width: 100%; height: auto; object-fit: contain; }
.section-form-separator { margin: .5rem 0; }
.section-form-spacer { min-height: 1px; }

/* FormElementDescriptor.ColumnSpan, as the server-rendered form spends it. The JS auto-form
   lays a flow group out in Bootstrap columns and spends a span on a col-md-N; _DefaultDetail
   .cshtml lays it out in .section-form-view-grid's auto-fill tracks, where the same intent is
   a grid-column span. Only a span above 1 carries one of these, so an ordinary form of plain
   fields emits no extra class at all. */
.section-form-span-2 { grid-column: span 2; }
.section-form-span-3 { grid-column: span 3; }
.section-form-span-4 { grid-column: span 4; }

/* Settings Keymap: base binding + optional per-device override on the same row. */
.settings-keymap-bindings {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    min-width: 0;
}
.settings-keymap-binding {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 0;
}
.settings-keymap-slot-label {
    flex: 0 0 5.5rem;
    font-size: 0.72rem;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.settings-keymap-scope-bar .settings-keymap-device {
    width: auto;
    min-width: 9rem;
}
.settings-leaf-value.settings-leaf-device-value.text-muted {
    font-style: italic;
}

/* ── Record-dependent UI (SectionUiConfig) ──────────────────────────────────
   A field the record's own rules locked: still readable, still submitted, not
   editable. Odoo greys these; the point is that the value is real, not absent. */
.section-field-readonly {
    background-color: var(--bs-secondary-bg, #e9ecef);
    cursor: default;
}

/* The document's pipeline, ported from widget="statusbar". Not clickable: a state
   is reached by the button that reaches it. */
.section-statusbar {
    display: inline-flex;
}
.section-statusbar .section-statusbar-step {
    cursor: default;
    user-select: none;
}

/* oe_stat_button: a count that is also a way in. */
.section-smartbuttons .section-smartbutton {
    white-space: nowrap;
}

/* The notebook a form declares (Odoo's <notebook><page>). */
.section-form-tabs {
    margin-bottom: 1rem;
}
.section-form-tabpane[hidden] {
    display: none !important;
}
/* A one2many inside a tab: the child section's grid, pinned to the record. The manager writes
   height:100% onto its own root, so it gets an inner root (.section-form-linked-root) filling this
   box, and this box needs a definite height — the same contract as the picker's. */
.section-form-linked {
    position: relative;
    height: 45vh;
    min-height: 280px;
    overflow: hidden;
}
.section-form-linked > .section-form-linked-root {
    position: absolute;
    inset: 0;
}
.section-form-linked + .section-form-linked {
    margin-top: 1rem;
}
.section-form-linked .section-page-container,
.section-form-linked .section-page-card {
    height: 100%;
}
.section-form-linked .section-page-card {
    padding: 0 !important;
    border: 0;
    box-shadow: none;
}
.section-form-linked-empty {
    height: auto;
}
.section-form-linked:has(> .section-form-linked-empty) {
    height: auto;
    min-height: 0;
}

/* Odoo's search-view filters: named questions, above the per-column cells that
   ask the ad-hoc ones. */
.section-search-filters {
    display: flex;
    gap: .25rem;
}
.section-search-filters .section-search-filter {
    border-radius: var(--bs-border-radius-sm) !important;
}


/* ── The board view (kanban) ───────────────────────────────────────────────
   A board is a sibling of the grid table inside .section-page-body, not a
   shape of it: columns of cards cannot be rows. Only one of the two is on
   screen at a time (see sectionPage.setViewMode / _applyKanbanChrome). */
.section-kanban-host {
    height: 100%;
    min-height: 0;
    overflow: hidden;
}

/* Pivot (issue #303): cross-tab host beside the grid / board / calendar. */
.section-pivot-host {
    height: 100%;
    min-height: 0;
    overflow: auto;
    display: flex;
    flex-direction: column;
    gap: .5rem;
    padding: .35rem .5rem;
}

.section-pivot-chrome {
    display: flex;
    flex-wrap: wrap;
    gap: .75rem;
    align-items: center;
}

.section-pivot-pick {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    font-size: .875rem;
}

.section-pivot-scroll {
    overflow: auto;
    min-height: 0;
    flex: 1 1 auto;
}

.section-pivot-table {
    border-collapse: collapse;
    width: max-content;
    min-width: 100%;
    font-size: .875rem;
}

.section-pivot-table th,
.section-pivot-table td {
    border: 1px solid var(--bs-border-color, #dee2e6);
    padding: .35rem .55rem;
    white-space: nowrap;
}

.section-pivot-table thead th,
.section-pivot-table tbody th {
    background: var(--bs-tertiary-bg, #f8f9fa);
    font-weight: 600;
    text-align: left;
}

.section-pivot-table td {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.section-pivot-total {
    font-weight: 600;
    background: var(--bs-tertiary-bg, #f8f9fa);
}

.section-pivot-empty {
    padding: 1.25rem;
    color: var(--bs-secondary-color, #6c757d);
}

/* The board scrolls sideways as one; each column scrolls its own cards. */
.section-kanban-board {
    display: flex;
    align-items: stretch;
    gap: .5rem;
    height: 100%;
    padding: .25rem;
    overflow-x: auto;
    overflow-y: hidden;
}

.section-kanban-column {
    display: flex;
    flex-direction: column;
    flex: 0 0 clamp(210px, 20vw, 300px);
    min-height: 0;
    border: 1px solid var(--bs-border-color, #dee2e6);
    border-radius: .4rem;
    background: var(--bs-tertiary-bg, #f8f9fa);
}

/* A folded column keeps its heading and gives its width back to the stages
   somebody is actually working in. */
.section-kanban-column-folded {
    flex-basis: 2.25rem;
}

.section-kanban-column-folded .section-kanban-column-body {
    display: none;
}

.section-kanban-column-folded .section-kanban-column-head {
    flex-direction: column;
    align-items: center;
    gap: .35rem;
    height: 100%;
}

.section-kanban-column-folded .section-kanban-column-title {
    writing-mode: vertical-rl;
    text-orientation: mixed;
}

/* Folded, the header runs down the column instead of across it, so the aggregate's
   "take a line of your own" (flex-basis 100% below) would claim the full HEIGHT and
   push the count to the floor. The figure is not readable sideways anyway — the name
   and the count are what survive a fold. */
.section-kanban-column-folded .section-kanban-column-aggregate {
    display: none;
}

.section-kanban-column-folded .section-kanban-column-count {
    flex: 0 0 auto;
}

.section-kanban-column-head {
    display: flex;
    /* The aggregate takes a line of its own under the name and the count (it is given
       flex-basis 100% below), which only works if the header is allowed to wrap. */
    flex-wrap: wrap;
    align-items: center;
    gap: .35rem;
    padding: .35rem .45rem;
    border-bottom: 1px solid var(--bs-border-color, #dee2e6);
    font-size: .8125rem;
}

.section-kanban-column-title {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 600;
}

.section-kanban-column-count {
    flex: 0 0 auto;
    padding: 0 .4rem;
    border-radius: 999px;
    background: var(--bs-secondary-bg, #e9ecef);
    font-variant-numeric: tabular-nums;
}

/* The answer to "how much is in this stage" — the question a pipeline review
   is actually about, so it is given room of its own rather than a tooltip. */
.section-kanban-column-aggregate {
    flex: 0 0 100%;
    order: 9;
    text-align: right;
    font-variant-numeric: tabular-nums;
    color: var(--bs-secondary-color, #6c757d);
}

.section-kanban-fold {
    flex: 0 0 auto;
    border: none;
    background: none;
    padding: 0 .15rem;
    color: inherit;
    cursor: pointer;
}

.section-kanban-column-body {
    display: flex;
    flex-direction: column;
    gap: .35rem;
    flex: 1 1 auto;
    min-height: 0;
    padding: .35rem;
    overflow-y: auto;
}

/* The column being dragged over. Nothing else about the board moves while a
   card is in the air — the only question is where it will land. */
.section-kanban-column-over {
    outline: 2px dashed var(--bs-primary, #0d6efd);
    outline-offset: -2px;
}

.section-kanban-card {
    /* A card carries .section-row so the manager's highlight, selection and decoration hooks
       find it exactly as they find a grid row. That class also carries the grid's fixed row
       height (36px), which a card must not have: a card's height is its content, and inheriting
       the row height made every card's fields spill over the card below it. */
    height: auto;
    border: 1px solid var(--bs-border-color, #dee2e6);
    border-radius: .35rem;
    background: var(--bs-body-bg, #fff);
    padding: .4rem .5rem;
    font-size: .8125rem;
    cursor: pointer;
    /* Pointer events drive the drag (one implementation for mouse, finger and
       pen), and a touch that scrolls the column would otherwise cancel it. */
    touch-action: none;
}

.section-kanban-card.section-row-current {
    border-color: var(--bs-primary, #0d6efd);
    box-shadow: 0 0 0 1px var(--bs-primary, #0d6efd) inset;
}

.section-kanban-card.section-full-edit-new {
    border-style: dashed;
    border-color: var(--bs-primary, #0d6efd);
}

.section-kanban-card.section-full-edit-new [data-field] {
    cursor: text;
}

.section-kanban-card-dragging {
    opacity: .55;
}

.section-kanban-card-head {
    display: flex;
    align-items: baseline;
    gap: .35rem;
}

.section-kanban-card-title {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 600;
}

.section-kanban-card-state {
    flex: 0 0 auto;
    font-size: .6rem;
}

.section-kanban-card-fields {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
    gap: .1rem .5rem;
    margin-top: .3rem;
}

.section-kanban-card-field {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.section-kanban-card-label {
    font-size: .68rem;
    color: var(--bs-secondary-color, #6c757d);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.section-kanban-card-value {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.section-kanban-more {
    border: 1px dashed var(--bs-border-color, #dee2e6);
    border-radius: .35rem;
    background: none;
    padding: .3rem;
    font-size: .75rem;
    color: var(--bs-secondary-color, #6c757d);
    cursor: pointer;
}

.section-kanban-empty {
    padding: 1rem;
    color: var(--bs-secondary-color, #6c757d);
}

/* ── Blocking-records panel (what still points at the record you tried to delete) ──
   Same window shape as the FK picker, split in two: the tree of relations on the left,
   the records of the selected relation — a real hosted section — on the right.
   Colours come from the theme's panel trio, so the chrome follows the application
   instead of being a white box in front of a dark one. */
.lf-blocking-root {
    position: fixed;
    inset: 0;
    /* z-index assigned by overlayStack.registerOverlay */
    display: flex;
    align-items: center;
    justify-content: center;
}
.lf-blocking-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, .5);
}
.lf-blocking {
    position: relative;
    width: min(1200px, 96vw);
    height: min(82vh, 860px);
    display: flex;
    flex-direction: column;
    background: var(--lf-theme-panel-bg, #fff);
    color: var(--lf-theme-panel-fg, #212529);
    border: 1px solid var(--lf-theme-panel-border, #dee2e6);
    border-radius: .5rem;
    overflow: hidden;
}
.lf-blocking-header {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .5rem;
    padding: .55rem .9rem;
    background: var(--lf-theme-toolbar-bg, var(--lf-theme-panel-bg, #fff));
    border-bottom: 1px solid var(--lf-theme-panel-border, #dee2e6);
}
.lf-blocking-titleblock {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: .15rem;
}
.lf-blocking-title { font-weight: 600; }
/* The record the tree is rooted on. `.text-muted` would resolve against Bootstrap's own
   palette and disappear on a dark panel, so it is derived from the panel pair instead. */
.lf-blocking-subject,
.lf-blocking-empty,
.lf-blocking-note,
.lf-blocking-node-label .text-muted {
    color: color-mix(in srgb, var(--lf-theme-panel-fg, #212529) 65%, var(--lf-theme-panel-bg, #fff));
}

.lf-blocking-body {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
}
.lf-blocking-tree {
    flex: 0 0 clamp(240px, 30%, 380px);
    min-width: 0;
    overflow: auto;
    border-right: 1px solid var(--lf-theme-panel-border, #dee2e6);
    padding: .35rem 0;
}
.lf-blocking-node {
    display: flex;
    align-items: center;
    gap: .35rem;
    padding: .3rem .6rem .3rem 0;
    cursor: pointer;
    user-select: none;
}
.lf-blocking-node:hover {
    background: color-mix(in srgb, var(--lf-theme-panel-fg, #212529) 8%, var(--lf-theme-panel-bg, #fff));
}
.lf-blocking-node.active {
    background: color-mix(in srgb, var(--lf-theme-accent, #0d6efd) 22%, var(--lf-theme-panel-bg, #fff));
}
/* A relation that follows the delete rather than refusing it: shown, but not as an obstacle. */
.lf-blocking-node.lf-blocking-cascade { opacity: .75; }
.lf-blocking-cascade-badge {
    font-size: .72em;
    padding: .05rem .35rem;
    border-radius: .6rem;
    border: 1px solid color-mix(in srgb, var(--lf-theme-panel-fg, #212529) 25%, var(--lf-theme-panel-bg, #fff));
    color: color-mix(in srgb, var(--lf-theme-panel-fg, #212529) 65%, var(--lf-theme-panel-bg, #fff));
    white-space: nowrap;
}
/* The switch that brings the cascade branch into the tree. Sits between the subject and the
   buttons, so it does not compete with them for the eye while still being in the header. */
.lf-blocking-cascade-toggle {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    cursor: pointer;
    user-select: none;
    color: color-mix(in srgb, var(--lf-theme-panel-fg, #212529) 65%, var(--lf-theme-panel-bg, #fff));
}
/* The plan, in the confirmation that precedes a run and in the account that follows it. */
.lf-blocking-plan {
    margin: 0 0 .6rem 0;
    padding-left: 1.3rem;
    max-height: 40vh;
    overflow: auto;
}
.lf-blocking-plan li { margin-bottom: .15rem; }
/* A cascade something holds in turn: it follows the delete on paper and stops it in the database. */
.lf-blocking-held-badge {
    border-color: var(--lf-theme-danger, #dc3545);
    color: var(--lf-theme-danger, #dc3545);
}
/* The plan as a set of choices: one row per group of records, indented by depth. */
.lf-blocking-decide-list {
    max-height: 45vh;
    overflow: auto;
    margin-bottom: .4rem;
}
.lf-blocking-decide-row {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding-top: .15rem;
    padding-bottom: .15rem;
}
.lf-blocking-decide-label {
    flex: 1 1 auto;
    min-width: 0;
}
.lf-blocking-decide-select {
    flex: 0 0 auto;
    width: auto;
    max-width: 16rem;
}
.lf-blocking-toggle {
    flex: 0 0 1rem;
    text-align: center;
    color: color-mix(in srgb, var(--lf-theme-panel-fg, #212529) 60%, var(--lf-theme-panel-bg, #fff));
}
.lf-blocking-node-label {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.lf-blocking-count {
    flex: 0 0 auto;
    background: color-mix(in srgb, var(--lf-theme-panel-fg, #212529) 12%, var(--lf-theme-panel-bg, #fff));
    color: var(--lf-theme-panel-fg, #212529);
}
.lf-blocking-empty { padding: .6rem .9rem; }
.lf-blocking-right {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
}
.lf-blocking-actions {
    flex: 0 0 auto;
    padding: .45rem .6rem;
    border-bottom: 1px solid var(--lf-theme-panel-border, #dee2e6);
}
.lf-blocking-actions-row {
    display: flex;
    flex-wrap: wrap;
    gap: .35rem;
}
.lf-blocking-note { margin-top: .3rem; }
/* The hosted SectionManager sizes to 100% height, so it needs a definite box. */
.lf-blocking-host {
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
    position: relative;
}
.lf-blocking-host .section-page-container,
.lf-blocking-host .section-page-card { height: 100%; }
.lf-blocking-host .section-page-card {
    padding: .5rem !important;
    border: 0;
    box-shadow: none;
}

/* ── Live record notifications (issue #14) ─────────────────────────────────────
   A cell somebody else just changed, for as long as it takes to notice it. Deliberately a fade
   rather than a colour that stays: the row is not in a state, it had a moment, and a highlight
   that persisted would still be there tomorrow saying nothing. */
@keyframes lf-record-changed-fade {
    0%   { background-color: var(--lf-record-changed-bg, rgba(13, 110, 253, .28)); }
    100% { background-color: transparent; }
}
.lf-record-changed {
    animation: lf-record-changed-fade 2s ease-out;
    /* The cell repaints as its own layer for the duration, so a fifty-row grid does not
       re-rasterise on every frame of one cell's fade. */
    will-change: background-color;
}
@media (prefers-reduced-motion: reduce) {
    .section-field-cell-refused { animation: none; }
    /* No animation, but the change still has to be visible — an outline says the same thing
       without anything moving. */
    .lf-record-changed {
        animation: none;
        outline: 2px solid var(--lf-record-changed-bg, rgba(13, 110, 253, .55));
        outline-offset: -2px;
    }
}

/* -- Tabulator objects: a strip that scrolls, and four sides to put it on (issue #36) ---------
   The markup is written by whoever renders the tabulator (_CompositePage.cshtml's renderTabGroup;
   core/sectionModal.ts through core/tabset.ts's wrapTabset) and is always the same shape, so
   every rule below holds for all of them:

       .lf-tabset.lf-tabset-{top|bottom|left|right}
           > .lf-tabset-bar
               > .lf-tabset-arrow (two, added by core/tabset.ts)
               > .lf-tabset-viewport > ul.nav-tabs
           > .tab-content

   The tabset's flex-direction decides which side the bar is on, and the strip turns with it. The
   arrows are drawn only while there is more strip than viewport (.lf-tabset-overflowing), and
   they OVERLAY the ends of the strip rather than taking room from it, so a tab is the same width
   whether or not the arrows are there. */
.lf-tabset {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    min-width: 0;
}

.lf-tabset-bottom { flex-direction: column-reverse; }
.lf-tabset-left { flex-direction: row; }
.lf-tabset-right { flex-direction: row-reverse; }

.lf-tabset > .lf-tabset-bar {
    position: relative;
    display: flex;
    align-items: stretch;
    flex: 0 0 auto;
    min-width: 0;
    min-height: 0;
}

.lf-tabset-top > .lf-tabset-bar { margin-bottom: 0.5rem; }
.lf-tabset-bottom > .lf-tabset-bar { margin-top: 0.5rem; }

.lf-tabset-left > .lf-tabset-bar,
.lf-tabset-right > .lf-tabset-bar {
    flex-direction: column;
    max-width: 40%;
    max-height: 100%;
}

.lf-tabset-left > .lf-tabset-bar { margin-right: 0.75rem; }
.lf-tabset-right > .lf-tabset-bar { margin-left: 0.75rem; }

/* The one element that scrolls. Its scrollbar is hidden: on a strip of tabs it would be a second,
   thinner thing to aim at, and the arrows and the wheel already say the same thing. */
.lf-tabset > .lf-tabset-bar > .lf-tabset-viewport {
    flex: 1 1 auto;
    min-width: 0;
    min-height: 0;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.lf-tabset-left > .lf-tabset-bar > .lf-tabset-viewport,
.lf-tabset-right > .lf-tabset-bar > .lf-tabset-viewport {
    overflow-x: hidden;
    overflow-y: auto;
}

.lf-tabset > .lf-tabset-bar > .lf-tabset-viewport::-webkit-scrollbar {
    display: none;
}

/* A tab is as wide as its label and never wraps: wrapping is the behaviour being replaced. */
.lf-tabset .lf-tabset-viewport > .nav-tabs {
    flex-wrap: nowrap;
    margin-bottom: 0;
}

.lf-tabset .lf-tabset-viewport > .nav-tabs > .nav-item { flex: 0 0 auto; }
.lf-tabset .lf-tabset-viewport > .nav-tabs > .nav-item > .nav-link { white-space: nowrap; }

/* Room for the arrows to sit over, taken on the STRIP rather than on the viewport: the strip's
   shared border runs along its own padding box, so the line still crosses the whole bar and
   passes under both arrows instead of stopping where the first tab does. */
.lf-tabset-overflowing.lf-tabset-top .lf-tabset-viewport > .nav-tabs,
.lf-tabset-overflowing.lf-tabset-bottom .lf-tabset-viewport > .nav-tabs {
    padding-inline: 1.9rem;
}

.lf-tabset-overflowing.lf-tabset-left .lf-tabset-viewport > .nav-tabs,
.lf-tabset-overflowing.lf-tabset-right .lf-tabset-viewport > .nav-tabs {
    padding-block: 1.6rem;
}

.lf-tabset .lf-tabset-arrow {
    position: absolute;
    display: none;
    z-index: 2;
    align-items: center;
    justify-content: center;
    padding: 0 0.35rem;
    border: 0;
    background: var(--bs-body-bg, #fff);
    color: var(--bs-secondary-color, #6c757d);
    cursor: pointer;
}

.lf-tabset-overflowing > .lf-tabset-bar > .lf-tabset-arrow { display: inline-flex; }

.lf-tabset .lf-tabset-arrow:hover:not(:disabled) {
    color: var(--bs-emphasis-color, #000);
    background: var(--bs-secondary-bg, #e9ecef);
}

/* Disabled, not hidden: an end that has been reached is still an end, and a control that vanishes
   there slides every other tab out from under the pointer. */
.lf-tabset .lf-tabset-arrow:disabled { opacity: 0.35; cursor: default; }

/* Each arrow stops one border-width short of the strip's shared edge, so the line it would
   otherwise cover keeps running underneath it. */
.lf-tabset-top .lf-tabset-arrow { top: 0; bottom: var(--bs-border-width, 1px); min-width: 1.75rem; }
.lf-tabset-top .lf-tabset-arrow-prev { left: 0; }
.lf-tabset-top .lf-tabset-arrow-next { right: 0; }

.lf-tabset-bottom .lf-tabset-arrow { top: var(--bs-border-width, 1px); bottom: 0; min-width: 1.75rem; }
.lf-tabset-bottom .lf-tabset-arrow-prev { left: 0; }
.lf-tabset-bottom .lf-tabset-arrow-next { right: 0; }

.lf-tabset-left .lf-tabset-arrow { left: 0; right: var(--bs-border-width, 1px); min-height: 1.5rem; }
.lf-tabset-left .lf-tabset-arrow-prev { top: 0; }
.lf-tabset-left .lf-tabset-arrow-next { bottom: 0; }

.lf-tabset-right .lf-tabset-arrow { left: var(--bs-border-width, 1px); right: 0; min-height: 1.5rem; }
.lf-tabset-right .lf-tabset-arrow-prev { top: 0; }
.lf-tabset-right .lf-tabset-arrow-next { bottom: 0; }

/* -- The strip on the other three sides -------------------------------------------------------
   Bootstrap draws .nav-tabs for the top edge only: the shared border is a border-bottom, the
   active tab hides its slice of it with a matching border-bottom-color, and the corners round
   upwards. Each block below is that same trick rotated, spelled with Bootstrap's own custom
   properties so a theme that restyles tabs restyles these too. */
.lf-tabset-bottom .lf-tabset-viewport > .nav-tabs {
    border-bottom: 0;
    border-top: var(--bs-nav-tabs-border-width) solid var(--bs-nav-tabs-border-color);
}

.lf-tabset-bottom .lf-tabset-viewport > .nav-tabs .nav-link {
    margin-bottom: 0;
    margin-top: calc(-1 * var(--bs-nav-tabs-border-width));
    border-radius: 0 0 var(--bs-nav-tabs-border-radius) var(--bs-nav-tabs-border-radius);
}

.lf-tabset-bottom .lf-tabset-viewport > .nav-tabs .nav-link.active {
    border-color: var(--bs-nav-tabs-link-active-bg) var(--bs-border-color) var(--bs-border-color);
}

.lf-tabset-left .lf-tabset-viewport > .nav-tabs,
.lf-tabset-right .lf-tabset-viewport > .nav-tabs {
    flex-direction: column;
    flex-wrap: nowrap;
    border-bottom: 0;
}

.lf-tabset-left .lf-tabset-viewport > .nav-tabs {
    border-right: var(--bs-nav-tabs-border-width) solid var(--bs-nav-tabs-border-color);
}

.lf-tabset-right .lf-tabset-viewport > .nav-tabs {
    border-left: var(--bs-nav-tabs-border-width) solid var(--bs-nav-tabs-border-color);
}

.lf-tabset-left .lf-tabset-viewport > .nav-tabs .nav-link,
.lf-tabset-right .lf-tabset-viewport > .nav-tabs .nav-link {
    width: 100%;
    margin-bottom: 0;
    text-align: start;
}

.lf-tabset-left .lf-tabset-viewport > .nav-tabs .nav-link {
    margin-right: calc(-1 * var(--bs-nav-tabs-border-width));
    border-radius: var(--bs-nav-tabs-border-radius) 0 0 var(--bs-nav-tabs-border-radius);
}

.lf-tabset-right .lf-tabset-viewport > .nav-tabs .nav-link {
    margin-left: calc(-1 * var(--bs-nav-tabs-border-width));
    border-radius: 0 var(--bs-nav-tabs-border-radius) var(--bs-nav-tabs-border-radius) 0;
}

.lf-tabset-left .lf-tabset-viewport > .nav-tabs .nav-link.active {
    border-color: var(--bs-border-color) var(--bs-nav-tabs-link-active-bg) var(--bs-border-color) var(--bs-border-color);
}

.lf-tabset-right .lf-tabset-viewport > .nav-tabs .nav-link.active {
    border-color: var(--bs-border-color) var(--bs-border-color) var(--bs-border-color) var(--bs-nav-tabs-link-active-bg);
}

/* The panes take whatever the strip leaves, whichever side it is on. */
.lf-tabset > .tab-content {
    flex: 1 1 auto;
    min-height: 0;
    min-width: 0;
}

/* Odoo's widget="badge": the value of a cell as a pill, coloured by the row's own state
   (SectionUiState.CellClasses). The Bootstrap subtle pairs keep it legible in both themes. */
td.lf-badge > .lf-badge-pill {
    display: inline-block;
    padding: .15em .65em;
    border-radius: 50rem;
    font-size: .85em;
    line-height: 1.4;
    white-space: nowrap;
    background-color: var(--bs-secondary-bg);
    color: var(--bs-body-color);
    border: 1px solid var(--bs-border-color-translucent);
}
td.lf-badge-success > .lf-badge-pill { background-color: var(--bs-success-bg-subtle); color: var(--bs-success-text-emphasis); border-color: var(--bs-success-border-subtle); }
td.lf-badge-danger > .lf-badge-pill { background-color: var(--bs-danger-bg-subtle); color: var(--bs-danger-text-emphasis); border-color: var(--bs-danger-border-subtle); }
td.lf-badge-warning > .lf-badge-pill { background-color: var(--bs-warning-bg-subtle); color: var(--bs-warning-text-emphasis); border-color: var(--bs-warning-border-subtle); }
td.lf-badge-info > .lf-badge-pill { background-color: var(--bs-info-bg-subtle); color: var(--bs-info-text-emphasis); border-color: var(--bs-info-border-subtle); }
td.lf-badge-primary > .lf-badge-pill { background-color: var(--bs-primary-bg-subtle); color: var(--bs-primary-text-emphasis); border-color: var(--bs-primary-border-subtle); }
td.lf-badge-muted > .lf-badge-pill { background-color: transparent; color: var(--bs-secondary-color); }
/* Bulk: the fields that will be written are outlined before the user confirms. */
.section-filter-control.section-bulk-touched {
    outline: 2px solid var(--bs-primary, #0d6efd);
    outline-offset: 1px;
    border-radius: 0.25rem;
}
