/*
 * Project shell: the /projects/details layout (header with the project total, room bar with the room switcher and
 * the totals line, the pinnable rooms rail, Room breakdown panel).
 * Spec: docs/superpowers/specs/2026-10-11-project-details-revised-layout-design.md, section 4.4.
 *
 * App.razor links this file on every page, so it must stay inert everywhere else:
 *  - every selector starts with .project-details-page, inside @media and @container too. The prefix also
 *    lets these rules outrank the page's compact typography rules in themes/theme-base.css;
 *  - no literal hex colour and no !important. Colours come from the --app-* and --eq-* theme tokens;
 *  - every class this file introduces carries the ps- prefix, because the Cobalt collision test scans the
 *    global stylesheets for the class names the /ai-consulting page uses.
 * ProjectShellCssGuardTests enforces the first two rules.
 *
 * Density: this page uses the relaxed register by owner decision D2 (2026-10-11): 8px radius, 16px padding,
 * a 22px/600 title. It is a deliberate exception to the design system's dense rules.
 */

.project-details-page {
    --ps-radius: 8px;
    --ps-pad: 16px;
}

/* ---------- Header (Surface B) ---------- */

/* z-index 12 lets the Actions menu (Bootstrap, 1000) and the version menu paint over the lock badge (10)
   and its popover (11), and still sit under the AVIP column (1058). */
.project-details-page .ps-header {
    position: relative;
    z-index: 12;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: var(--ps-pad);
    padding: var(--ps-pad) 0;
}

.project-details-page .ps-header-main {
    flex: 1 1 auto;
    min-width: 0;
}

.project-details-page .ps-breadcrumb {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    line-height: 1.4;
    color: var(--app-text-label);
}

.project-details-page .ps-breadcrumb a {
    color: var(--app-accent-border);
    text-decoration: none;
}

.project-details-page .ps-breadcrumb a:hover {
    text-decoration: underline;
}

.project-details-page .ps-title-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px 12px;
    margin: 4px 0;
}

.project-details-page .ps-title {
    margin: 0;
    min-width: 0;
    font-size: 22px;
    font-weight: 600;
    line-height: 1.25;
    color: var(--app-text-strong);
    overflow-wrap: anywhere;
}

.project-details-page .ps-meta {
    font-size: 12px;
    line-height: 1.4;
    color: var(--app-text-label);
}

/* ---------- Pills: project status, and the version picker's trigger ---------- */

/* VersionsPicker's scoped .picker-trigger rule has the same specificity; this file loads after
   BlazorApp1.styles.css, so the override wins on order. */
.project-details-page .ps-status-pill,
.project-details-page .picker-trigger {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 26px;
    padding: 0 10px;
    font-size: 12px;
    font-weight: 500;
    line-height: 1;
    white-space: nowrap;
    border: 1px solid var(--app-border-color);
    border-radius: 999px;
    background: transparent;
    cursor: pointer;
    transition: background-color var(--app-transition-fast), border-color var(--app-transition-fast);
}

.project-details-page .ps-status-pill:focus-visible,
.project-details-page .picker-trigger:focus-visible {
    outline: 2px solid var(--app-accent-border);
    outline-offset: 2px;
}

.project-details-page .ps-status-pill i {
    font-size: 11px;
}

.project-details-page .ps-status-pill:hover {
    border-color: currentColor;
}

.project-details-page .ps-status-pill--progress {
    color: var(--app-accent-border);
    border-color: var(--app-accent-border);
    background: var(--app-accent-tint);
}

.project-details-page .ps-status-pill--revision {
    color: var(--app-status-warn);
    border-color: color-mix(in srgb, var(--app-status-warn) 50%, transparent);
    background: color-mix(in srgb, var(--app-status-warn) 10%, transparent);
}

.project-details-page .ps-status-pill--complete {
    color: var(--app-status-ok);
    border-color: color-mix(in srgb, var(--app-status-ok) 50%, transparent);
    background: color-mix(in srgb, var(--app-status-ok) 10%, transparent);
}

.project-details-page .ps-status-pill--default {
    color: var(--app-text-label);
    border-color: var(--app-border-color);
}

.project-details-page .picker-trigger {
    color: var(--app-text-strong);
    border-color: var(--app-accent-border);
    background: var(--app-accent-tint);
}

/* Also replaces the scoped hover, whose fallback paints a pale light-mode fill on the dark theme. */
.project-details-page .ps-status-pill--progress:hover,
.project-details-page .picker-trigger:hover {
    background: color-mix(in srgb, var(--app-accent-border) 18%, transparent);
}

.project-details-page .picker-trigger .row-current-mark {
    width: auto;
    font-size: 10px;
    color: var(--app-accent-border);
}

.project-details-page .picker-trigger .picker-chev {
    font-size: 9px;
    color: var(--app-text-label);
}

/* ---------- Header actions: timer chip, reset, Ask AVIP, Actions ---------- */

.project-details-page .ps-header-actions {
    flex: none;
    display: flex;
    align-items: center;
    gap: 8px;
}

.project-details-page .ps-timer-chip,
.project-details-page .ps-ask-avip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 36px;
    padding: 0 14px;
    font-size: 13px;
    line-height: 1;
    white-space: nowrap;
    border: 1px solid var(--app-border-color);
    border-radius: var(--ps-radius);
    background: var(--app-surface-panel);
    cursor: pointer;
    transition: background-color var(--app-transition-fast), border-color var(--app-transition-fast);
}

.project-details-page .ps-timer-chip {
    font-family: var(--bs-font-monospace);
    font-variant-numeric: tabular-nums;
    color: var(--app-text-data);
}

.project-details-page .ps-timer-glyph {
    font-size: 10px;
}

.project-details-page .ps-ask-avip {
    font-weight: 600;
    color: var(--app-text-strong);
}

.project-details-page .ps-timer-chip:hover,
.project-details-page .ps-ask-avip:hover {
    background: var(--app-surface-hover);
}

.project-details-page .ps-ask-avip.active {
    border-color: var(--app-accent-border);
    background: var(--app-accent-tint);
}

.project-details-page .ps-timer-reset {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    padding: 0;
    font-size: 11px;
    color: var(--app-text-label);
    border: 1px solid var(--app-border-color);
    border-radius: var(--ps-radius);
    background: transparent;
    cursor: pointer;
}

.project-details-page .ps-timer-reset:hover {
    color: var(--app-text-strong);
    background: var(--app-surface-hover);
}

.project-details-page .ps-timer-chip:focus-visible,
.project-details-page .ps-ask-avip:focus-visible,
.project-details-page .ps-timer-reset:focus-visible {
    outline: 2px solid var(--app-accent-border);
    outline-offset: 2px;
}

/* The project total before tax beside Ask AVIP, and the quieter Optional line under it. Figures in mono. */
.project-details-page .ps-header-total {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
    padding: 0 4px;
    line-height: 1.2;
    white-space: nowrap;
}

.project-details-page .ps-header-total-main {
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.project-details-page .ps-header-total-label,
.project-details-page .ps-header-total-optional {
    font-size: 12px;
    color: var(--app-text-label);
}

.project-details-page .ps-header-total-value {
    font-family: var(--bs-font-monospace);
    font-size: 16px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: var(--app-text-strong);
}

.project-details-page .ps-header-total-optional {
    display: flex;
    gap: 6px;
}

.project-details-page .ps-header-total-figure {
    font-family: var(--bs-font-monospace);
    font-variant-numeric: tabular-nums;
}

/* The header's one solid control. --bs-white is Bootstrap 5.1's root white: the app has no --app-* token
   that stays white in both themes, and the label sits on the same blue fill in both. */
.project-details-page .ps-actions-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 36px;
    padding: 0 16px;
    font-size: 13px;
    font-weight: 600;
    line-height: 1;
    color: var(--bs-white);
    border: 1px solid var(--app-brand-primary);
    border-radius: var(--ps-radius);
    background: var(--app-brand-primary);
}

.project-details-page .ps-actions-btn:hover,
.project-details-page .ps-actions-btn[aria-expanded="true"] {
    color: var(--bs-white);
    background: color-mix(in srgb, var(--app-brand-primary) 85%, var(--bs-white));
}

/* Bootstrap's .btn:focus ring would stay on after a mouse click; the keyboard ring below replaces it. */
.project-details-page .ps-actions-btn:focus {
    box-shadow: none;
}

.project-details-page .ps-actions-btn:focus-visible {
    color: var(--bs-white);
    outline: 2px solid var(--app-accent-border);
    outline-offset: 2px;
}

.project-details-page .ps-actions-btn i {
    font-size: 10px;
    transition: transform var(--app-transition-fast);
}

.project-details-page .ps-actions-btn[aria-expanded="true"] i {
    transform: rotate(180deg);
}

/* ---------- Shell frame and grid ---------- */

/* The query container for the horizontal rail mode. It wraps the outer LockedOverlay, so the grid and the lock
   badge are its descendants (a container query restyles only descendants), while the header stays outside it.
   Spec section 6 item 3: Safari must not clip a position: fixed descendant of an inline-size container. Where it
   does, the @container block below becomes viewport media queries keyed on .page.is-hidden (the full-screen mode
   that hides the sidebar) and this declaration goes. */
.project-details-page .ps-shell-frame {
    container-type: inline-size;
    container-name: ps-shell;
}

/* Rail | room panel. align-items: start keeps the rail at its own height instead of stretching to the panel's. */
.project-details-page .ps-shell-body {
    display: grid;
    grid-template-columns: 330px minmax(0, 1fr);
    gap: var(--ps-pad);
    align-items: start;
}

/* The pin is off: no rail column, so the room panel takes the full width. Listed after the base grid, whose
   specificity it shares, so it wins on order. */
.project-details-page .ps-shell-body--rail-hidden {
    grid-template-columns: minmax(0, 1fr);
}

.project-details-page .ps-room-panel {
    min-width: 0;
}

/* ---------- Rooms rail (Surface C) ---------- */

.project-details-page .ps-rail {
    background: var(--app-surface-panel);
    border: 1px solid var(--app-border-hairline);
    border-radius: var(--ps-radius);
    padding: 12px;
}

/* "Rooms" and the count on one baseline, then "+ Room" pushed right. The negative inline margin runs the
   hairline to the rail's edges, as the mockup draws it. */
.project-details-page .ps-rail-head {
    display: flex;
    align-items: baseline;
    gap: 6px;
    margin: 0 -12px 8px;
    padding: 0 12px 12px;
    border-bottom: 1px solid var(--app-border-hairline);
    font-size: 14px;
    font-weight: 600;
    line-height: 1.3;
    color: var(--app-text-strong);
}

.project-details-page .ps-rail-head > span + span {
    font-size: 12px;
    font-weight: 400;
    color: var(--app-text-label);
}

.project-details-page .ps-rail-add {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    height: 28px;
    padding: 0 10px;
    font-size: 13px;
    font-weight: 500;
    line-height: 1;
    white-space: nowrap;
    color: var(--app-text-strong);
    border: 1px solid var(--app-border-color);
    border-radius: 6px;
    background: transparent;
    cursor: pointer;
    transition: background-color var(--app-transition-fast);
}

.project-details-page .ps-rail-add:hover:not(:disabled) {
    background: var(--app-surface-hover);
}

.project-details-page .ps-rail-add:disabled {
    color: var(--app-text-disabled);
    cursor: not-allowed;
}

/* A room row: the name (two lines at most) and its total on the first line, "n items" under the name. */
.project-details-page .ps-rail-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 2px 12px;
    padding: 10px 12px;
    margin-bottom: 4px;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color var(--app-transition-fast);
}

.project-details-page .ps-rail-row:hover {
    background: var(--app-surface-hover);
}

/* The open room: the raised slab with the accent outline. Listed with :hover so hovering keeps the slab. */
.project-details-page .ps-rail-row--active,
.project-details-page .ps-rail-row--active:hover {
    background: var(--app-surface-raised);
    box-shadow: inset 0 0 0 1px var(--app-accent-border);
}

.project-details-page .ps-rail-row:focus-visible,
.project-details-page .ps-rail-archived-toggle:focus-visible,
.project-details-page .ps-rail-add:focus-visible {
    outline: 2px solid var(--app-accent-border);
    outline-offset: 2px;
}

.project-details-page .ps-rail-name {
    min-width: 0;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
    overflow-wrap: anywhere;
    font-size: 13px;
    font-weight: 500;
    line-height: 1.35;
    color: var(--app-text-strong);
}

.project-details-page .ps-rail-row--active .ps-rail-name {
    font-weight: 600;
}

.project-details-page .ps-rail-optional {
    font-size: 12px;
    font-weight: 400;
    color: var(--app-text-label);
}

.project-details-page .ps-rail-total {
    font-size: 13px;
    font-weight: 600;
    line-height: 1.35;
    text-align: right;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
    color: var(--app-text-strong);
}

.project-details-page .ps-rail-count {
    font-size: 12px;
    line-height: 1.35;
    color: var(--app-text-label);
}

/* A room with unpriced lines: "n unpriced" in the warning ink, right of "n items" under the total. */
.project-details-page .ps-rail-attn {
    grid-column: 2;
    grid-row: 2;
    justify-self: end;
    font-size: 12px;
    line-height: 1.35;
    color: var(--app-status-warn);
    white-space: nowrap;
}

/* A room with units not drawn: "n not drawn" in the warning ink, right-aligned under the total in row 2, or in row 3
   under "n unpriced" (--below). A fixed row keeps it beside the item count: auto placement would put it after a
   full-width "in lieu of" or "link broken" line. */
.project-details-page .ps-rail-drawn {
    grid-column: 2;
    grid-row: 2;
    justify-self: end;
    font-size: 12px;
    line-height: 1.35;
    color: var(--app-status-warn);
    white-space: nowrap;
}

.project-details-page .ps-rail-drawn--below {
    grid-row: 3;
}

/* A linked optional room's sub-line under the row: "in lieu of {Base}", or "link broken" in the warning ink when
   its link does not resolve. Full width, so a long base name never squeezes the total. */
.project-details-page .ps-rail-lieu {
    grid-column: 1 / -1;
    font-size: 12px;
    color: var(--app-text-label);
}

.project-details-page .ps-rail-lieu--warn {
    color: var(--app-status-warn);
}

/* Archived rooms: the whole row reads in the disabled ink. */
.project-details-page .ps-rail-row--muted :is(.ps-rail-name, .ps-rail-optional, .ps-rail-total, .ps-rail-count) {
    color: var(--app-text-disabled);
}

/* A separate rule, not a fifth entry in the list above: :is() takes its most specific argument, so adding this
   selector there would raise the specificity of every listed element. The warning keeps its ink on archived rows. */
.project-details-page .ps-rail-row--muted .ps-rail-lieu:not(.ps-rail-lieu--warn) {
    color: var(--app-text-disabled);
}

.project-details-page .ps-rail-archived {
    margin-top: 8px;
}

.project-details-page .ps-rail-archived-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    margin-bottom: 4px;
    font-size: 12px;
    color: var(--app-text-label);
    border-radius: 6px;
    cursor: pointer;
    transition: background-color var(--app-transition-fast);
}

.project-details-page .ps-rail-archived-toggle:hover {
    background: var(--app-surface-hover);
}

.project-details-page .ps-rail-archived-toggle i {
    font-size: 9px;
    transition: transform var(--app-transition-fast);
}

.project-details-page .ps-rail-archived-toggle[aria-expanded="true"] i {
    transform: rotate(90deg);
}

.project-details-page .ps-rail-empty {
    padding: 16px 12px;
    font-size: 13px;
    text-align: center;
    color: var(--app-text-label);
}

/* ---------- Lock badge and popover over the rail head ---------- */

/* The outer LockedOverlay paints its badge and popover top-right of its wrapper (LockedOverlay.razor.css:46-56,
   :70-78), which is now the room panel's toolbar. Two columns: both sit over the right end of the rail head,
   where "+ Room" is disabled on a locked version. The popover keeps its default 38px drop below the badge.
   Both grow leftwards from that anchor, and .project-details-page clips what passes the rail's left edge (it is
   overflow-auto), so both are capped at the rail's width less 16px each side. The badge label ellipsizes and
   stays on one line, so the popover below it never overlaps it; the popover repeats the approval date in full.
   The popover's values wrap, an approver id with no spaces included (LockedOverlay.razor:24). */
.project-details-page .ps-shell-frame > .locked-overlay-wrapper > .locked-overlay-badge {
    top: 10px;
    left: calc(330px - 16px);
    right: auto;
    transform: translateX(-100%);
    max-width: calc(330px - 32px);
}

.project-details-page .ps-shell-frame > .locked-overlay-wrapper > .locked-overlay-badge > .badge-label {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

.project-details-page .ps-shell-frame > .locked-overlay-wrapper > .locked-overlay-popover {
    top: 48px;
    left: calc(330px - 16px);
    right: auto;
    transform: translateX(-100%);
    max-width: calc(330px - 32px);
}

/* Only the values break anywhere; the row labels ("Approver:") keep their width and never split. */
.project-details-page .ps-shell-frame > .locked-overlay-wrapper > .locked-overlay-popover .val {
    overflow-wrap: anywhere;
}

/* With the rail unpinned there is no rail head to sit over: both return top-right, as in the stacked mode below. */
.project-details-page .ps-shell-frame:has(.ps-shell-body--rail-hidden) > .locked-overlay-wrapper > .locked-overlay-badge {
    top: 12px;
    left: auto;
    right: 16px;
    transform: none;
    max-width: none;
}

.project-details-page .ps-shell-frame:has(.ps-shell-body--rail-hidden) > .locked-overlay-wrapper > .locked-overlay-popover {
    top: 50px;
    left: auto;
    right: 16px;
    transform: none;
    max-width: none;
}

/* ---------- Room totals line (Surface D) ---------- */

/* "Sell $… · Cost $… · Margin $… n%" on one line of the room bar, then the Needs attention chip. The title on the
   figures says "Room, before tax": they count the whole room, the table footer counts equipment only. */
.project-details-page .ps-totals {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px 12px;
    min-width: 0;
}

.project-details-page .ps-totals-figures {
    display: inline-flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 4px 8px;
    font-size: 13px;
    line-height: 1.4;
    cursor: default;
}

.project-details-page .ps-totals-item {
    display: inline-flex;
    align-items: baseline;
    gap: 6px;
    white-space: nowrap;
}

/* The margin dollars and percent, kept together. */
.project-details-page .ps-totals-margin {
    display: inline-flex;
    align-items: baseline;
    gap: 6px;
}

.project-details-page .ps-totals-label,
.project-details-page .ps-totals-sep {
    color: var(--app-text-label);
}

.project-details-page .ps-totals-value {
    font-family: var(--bs-font-monospace);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: var(--app-text-strong);
}

/* "× n rooms = $…" after Margin when the room quantity is above one. */
.project-details-page .ps-totals-qty {
    font-family: var(--bs-font-monospace);
    font-size: 12px;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    color: var(--app-text-label);
}

.project-details-page .ps-margin {
    font-family: var(--bs-font-monospace);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: var(--app-status-ok);
}

/* A loss: the dollars and the percent both read in the danger colour. Listed after .ps-totals-value and .ps-margin,
   whose specificity it shares, so it wins on order. */
.project-details-page .ps-margin--negative {
    color: var(--app-danger);
}

/* The Needs attention chip: amber outline and tint, one item per count with its Find action. */
.project-details-page .ps-attention {
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px 12px;
    padding: 3px 10px;
    font-size: 12px;
    line-height: 1.4;
    color: var(--app-status-warn);
    border: 1px solid color-mix(in srgb, var(--app-status-warn) 60%, transparent);
    border-radius: 999px;
    background: color-mix(in srgb, var(--app-status-warn) 12%, transparent);
}

.project-details-page .ps-attention-item {
    display: inline-flex;
    align-items: baseline;
    gap: 6px;
    white-space: nowrap;
}

.project-details-page .ps-attention-item + .ps-attention-item::before {
    content: "·";
    margin-right: 6px;
}

.project-details-page .ps-attention-label {
    font-weight: 600;
}

/* "Find price" and the not-drawn line's "Find": buttons styled as links. */
.project-details-page .ps-find-price,
.project-details-page .ps-find-not-drawn {
    padding: 0;
    font-size: 12px;
    font-weight: 500;
    line-height: 1.4;
    color: var(--app-status-warn);
    text-decoration: underline;
    text-underline-offset: 2px;
    border: 0;
    background: none;
    cursor: pointer;
}

.project-details-page .ps-find-price:hover:not(:disabled),
.project-details-page .ps-find-not-drawn:hover:not(:disabled) {
    text-decoration-thickness: 2px;
}

.project-details-page .ps-find-price:focus-visible,
.project-details-page .ps-find-not-drawn:focus-visible {
    outline: 2px solid var(--app-accent-border);
    outline-offset: 2px;
}

.project-details-page .ps-find-price:disabled,
.project-details-page .ps-find-not-drawn:disabled {
    color: var(--app-text-disabled);
    text-decoration: none;
    cursor: not-allowed;
}

/* ---------- Room toolbar (Surface D) ---------- */

/* The left group holds the pin, the switcher, Room qty and the totals line, so it wraps on a narrow card instead of
   pushing the actions group off the edge. */
.project-details-page .eq-toolbar-meta {
    flex-wrap: wrap;
    min-width: 0;
}

/* The pin and the ‹ › arrows: square ghost buttons as tall as the .btn-sm controls beside them. */
.project-details-page .ps-pin-btn,
.project-details-page .ps-room-step {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    padding: 0;
    font-size: 11px;
    color: var(--app-text-label);
    border: 1px solid var(--app-border-color);
    border-radius: 6px;
    background: transparent;
    cursor: pointer;
    transition: background-color var(--app-transition-fast), color var(--app-transition-fast);
}

.project-details-page .ps-pin-btn:hover,
.project-details-page .ps-room-step:hover:not(:disabled) {
    color: var(--app-text-strong);
    background: var(--app-surface-hover);
}

/* Pinned: the rail is on screen. */
.project-details-page .ps-pin-btn.active {
    color: var(--app-accent-border);
    border-color: var(--app-accent-border);
    background: var(--app-accent-tint);
}

.project-details-page .ps-room-step:disabled {
    color: var(--app-text-disabled);
    cursor: not-allowed;
}

.project-details-page .ps-room-nav {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
}

/* The anchor of the dropdown panel. */
.project-details-page .ps-switcher {
    position: relative;
    min-width: 0;
}

/* "Auditorium · 25 items ▾": the room name strong, the count quiet, the name ellipsised on a narrow bar. */
.project-details-page .ps-switcher-trigger {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    max-width: 320px;
    height: 28px;
    padding: 0 10px;
    font-size: 13px;
    line-height: 1;
    color: var(--app-text-strong);
    border: 1px solid var(--app-border-color);
    border-radius: 6px;
    background: var(--app-surface-panel);
    cursor: pointer;
    transition: background-color var(--app-transition-fast), border-color var(--app-transition-fast);
}

.project-details-page .ps-switcher-trigger:hover,
.project-details-page .ps-switcher-trigger[aria-expanded="true"] {
    border-color: var(--app-accent-border);
    background: var(--app-surface-hover);
}

.project-details-page .ps-switcher-name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 600;
}

.project-details-page .ps-switcher-count {
    flex: none;
    font-family: var(--bs-font-monospace);
    font-size: 12px;
    color: var(--app-text-label);
}

.project-details-page .ps-switcher-trigger i {
    flex: none;
    font-size: 9px;
    color: var(--app-text-label);
}

/* "Room 1 of 4". */
.project-details-page .ps-room-position {
    font-family: var(--bs-font-monospace);
    font-size: 12px;
    white-space: nowrap;
    color: var(--app-text-label);
}

.project-details-page .ps-pin-btn:focus-visible,
.project-details-page .ps-room-step:focus-visible,
.project-details-page .ps-switcher-trigger:focus-visible,
.project-details-page .ps-switcher-add:focus-visible,
.project-details-page .ps-switcher-archived:focus-visible {
    outline: 2px solid var(--app-accent-border);
    outline-offset: 2px;
}

/* The dropdown: the search box, the room list and the footer, at the z-index Bootstrap gives its own dropdown menus.
   That z-index only orders it inside the room panel. On a locked version .locked-overlay-content carries a filter,
   which makes it a stacking context, so everything inside it (this panel and the toolbar's Bootstrap menus included)
   paints under the lock badge, a later positioned sibling of that content; the rule after this one hides the badge
   while such a menu is open. */
.project-details-page .ps-switcher-panel {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    width: 340px;
    max-width: calc(100vw - 32px);
    padding: 8px;
    border: 1px solid var(--app-border-color);
    border-radius: var(--ps-radius);
    background: var(--app-surface-panel);
    box-shadow: var(--app-shadow-lg);
}

/* The lock badge would paint over the open switcher panel or an open toolbar menu (Notes, Columns, Fill prices, ⋯),
   whatever their z-index (see above), so it steps aside until the menu closes. Its popover is not hidden: while it is
   open, its backdrop (LockedOverlay.razor) takes every click on the room panel, so no menu can open under it. */
.project-details-page .ps-shell-frame:has(.ps-switcher-panel, .eq-toolbar .dropdown-menu.show) > .locked-overlay-wrapper > .locked-overlay-badge {
    visibility: hidden;
}

.project-details-page .ps-switcher-search {
    width: 100%;
    height: 32px;
    padding: 0 10px;
    font-size: 13px;
    color: var(--app-text-strong);
    border: 1px solid var(--app-border-color);
    border-radius: 6px;
    background: var(--app-surface-sunken);
}

.project-details-page .ps-switcher-search:focus {
    outline: none;
    border-color: var(--app-accent-border);
}

.project-details-page .ps-switcher-list {
    max-height: 320px;
    margin: 6px 0;
    overflow-y: auto;
}

/* A room: the name and its total on the first line, the item count and the room's marks under the name. */
.project-details-page .ps-switcher-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 2px 12px;
    padding: 6px 8px;
    border-radius: 6px;
    cursor: pointer;
}

.project-details-page .ps-switcher-row:hover,
.project-details-page .ps-switcher-row--highlight {
    background: var(--app-surface-hover);
}

/* The open room: the accent slab the rail draws. Listed with :hover, whose specificity is higher, and after the
   highlight rule, so a hovered or highlighted open row keeps it. */
.project-details-page .ps-switcher-row--active,
.project-details-page .ps-switcher-row--active:hover {
    background: var(--app-accent-tint);
    box-shadow: inset 0 0 0 1px var(--app-accent-border);
}

.project-details-page .ps-switcher-row-name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 13px;
    font-weight: 500;
    color: var(--app-text-strong);
}

.project-details-page .ps-switcher-optional {
    font-weight: 400;
    color: var(--app-text-label);
}

.project-details-page .ps-switcher-row-total {
    font-family: var(--bs-font-monospace);
    font-size: 12px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    text-align: right;
    white-space: nowrap;
    color: var(--app-text-strong);
}

.project-details-page .ps-switcher-row-meta {
    grid-column: 1 / -1;
    display: flex;
    flex-wrap: wrap;
    gap: 2px 10px;
    font-size: 12px;
    color: var(--app-text-label);
}

.project-details-page .ps-switcher-warn {
    color: var(--app-status-warn);
}

.project-details-page .ps-switcher-row--muted :is(.ps-switcher-row-name, .ps-switcher-row-total) {
    color: var(--app-text-disabled);
}

.project-details-page .ps-switcher-empty {
    padding: 12px 8px;
    font-size: 13px;
    text-align: center;
    color: var(--app-text-label);
}

/* "+ Add room" left, "Archived (n)" right, under a hairline. */
.project-details-page .ps-switcher-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--app-border-hairline);
}

.project-details-page .ps-switcher-add,
.project-details-page .ps-switcher-archived {
    height: 28px;
    padding: 0 10px;
    font-size: 13px;
    font-weight: 500;
    color: var(--app-text-strong);
    border: 1px solid var(--app-border-color);
    border-radius: 6px;
    background: transparent;
    cursor: pointer;
}

.project-details-page .ps-switcher-archived {
    color: var(--app-text-label);
}

.project-details-page .ps-switcher-add:hover:not(:disabled),
.project-details-page .ps-switcher-archived:hover {
    background: var(--app-surface-hover);
}

.project-details-page .ps-switcher-archived[aria-expanded="true"] {
    color: var(--app-text-strong);
    background: var(--app-surface-raised);
}

.project-details-page .ps-switcher-add:disabled {
    color: var(--app-text-disabled);
    cursor: not-allowed;
}

/* A hairline between the room navigation and Room qty. */
.project-details-page .ps-room-bar-divider {
    width: 1px;
    height: 20px;
    background: var(--app-border-color);
}

/* The Notes display menu's anchor; Bootstrap positions its menu against it. */
.project-details-page .ps-notes-mode {
    position: relative;
}

.project-details-page .ps-notes-trigger {
    white-space: nowrap;
}

/* "+ Add product": the room panel's one solid control. The fill is the theme's .btn-primary; this rule lifts the
   label above the page's compact 400 weight and keeps it on one line when the actions group wraps. */
.project-details-page .ps-add-product {
    font-weight: 600;
    white-space: nowrap;
}

/* The "⋯" overflow trigger: as tall as its .btn-sm neighbours, never narrower than it is tall, and bold enough
   for the three dots to read at the compact size. */
.project-details-page .ps-room-more {
    min-width: 28px;
    font-weight: 700;
}

/* ---------- Room breakdown (Surface F) ---------- */

/* The Room Summary, Install Summary and the two financial summary cards, folded behind one toggle. Collapsed, the
   panel is the toggle row alone. The root also carries .room-summary-section, which the page's fullscreen rule
   hides. */
.project-details-page .ps-breakdown {
    margin-top: 8px;
}

/* Open, the four cards follow the toggle; the bottom padding keeps the last one off the room card's edge. */
.project-details-page .ps-breakdown--open {
    padding-bottom: 8px;
}

/* A div with role="button", not a button: the lock overlay disables buttons, and the cards stay readable on a
   locked version. projectShell.js stops Space from scrolling the page when this element has focus. */
.project-details-page .ps-breakdown-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px;
    border-top: 1px solid var(--app-border-hairline);
    font-size: 13px;
    font-weight: 600;
    line-height: 1.3;
    color: var(--app-text-strong);
    cursor: pointer;
    user-select: none;
    transition: background-color var(--app-transition-fast);
}

.project-details-page .ps-breakdown-toggle:hover {
    background: var(--app-surface-hover);
}

/* Inset, because the toggle spans the card's full width and the card would clip an outer ring. */
.project-details-page .ps-breakdown-toggle:focus-visible {
    outline: 2px solid var(--app-accent-border);
    outline-offset: -2px;
}

.project-details-page .ps-breakdown-toggle i {
    font-size: 10px;
    color: var(--app-text-label);
    transition: transform var(--app-transition-fast);
}

.project-details-page .ps-breakdown-toggle[aria-expanded="true"] i {
    transform: rotate(90deg);
}

/* ---------- Horizontal rail mode ---------- */

/* One stacked column with the rail's rows as wrapping chips (outlined; the open room keeps its accent slab),
   whenever the shell is under 1100px wide or the AVIP panel is open. CSS cannot share one block between a container query and a class, so the block is written
   twice; keep the two copies identical. The badge and popover return to their defaults (top 12px / 50px,
   right 16px, from LockedOverlay.razor.css) and drop the two-column width cap. */
@container ps-shell (max-width: 1099.98px) {
    .project-details-page .ps-shell-body {
        grid-template-columns: 1fr;
    }

    .project-details-page .ps-rail-list,
    .project-details-page .ps-rail-archived {
        display: flex;
        flex-wrap: wrap;
        gap: 6px;
    }

    .project-details-page .ps-rail-archived-toggle {
        flex-basis: 100%;
        margin-bottom: 0;
    }

    .project-details-page .ps-rail-row {
        grid-template-columns: auto auto;
        padding: 6px 10px;
        margin-bottom: 0;
        max-width: 100%;
    }

    .project-details-page .ps-rail-row:not(.ps-rail-row--active) {
        box-shadow: inset 0 0 0 1px var(--app-border-hairline);
    }

    .project-details-page .ps-rail-count {
        display: none;
    }

    /* A chip hides "in lieu of" with the count; "link broken" stays as the chip's second line. */
    .project-details-page .ps-rail-lieu:not(.ps-rail-lieu--warn) {
        display: none;
    }

    /* "n unpriced" spans the chip under the name and total, after "link broken" when both show. */
    .project-details-page .ps-rail-attn {
        grid-column: 1 / -1;
        grid-row: auto;
        justify-self: start;
    }

    /* "n not drawn" spans the chip too, after "n unpriced" when both show. */
    .project-details-page .ps-rail-drawn {
        grid-column: 1 / -1;
        grid-row: auto;
        justify-self: start;
    }

    .project-details-page .ps-shell-frame > .locked-overlay-wrapper > .locked-overlay-badge {
        top: 12px;
        left: auto;
        right: 16px;
        transform: none;
        max-width: none;
    }

    .project-details-page .ps-shell-frame > .locked-overlay-wrapper > .locked-overlay-popover {
        top: 50px;
        left: auto;
        right: 16px;
        transform: none;
        max-width: none;
    }
}

.project-details-page .ps-shell.ps-assistant-open .ps-shell-body {
    grid-template-columns: 1fr;
}

.project-details-page .ps-shell.ps-assistant-open .ps-rail-list,
.project-details-page .ps-shell.ps-assistant-open .ps-rail-archived {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.project-details-page .ps-shell.ps-assistant-open .ps-rail-archived-toggle {
    flex-basis: 100%;
    margin-bottom: 0;
}

.project-details-page .ps-shell.ps-assistant-open .ps-rail-row {
    grid-template-columns: auto auto;
    padding: 6px 10px;
    margin-bottom: 0;
    max-width: 100%;
}

.project-details-page .ps-shell.ps-assistant-open .ps-rail-row:not(.ps-rail-row--active) {
    box-shadow: inset 0 0 0 1px var(--app-border-hairline);
}

.project-details-page .ps-shell.ps-assistant-open .ps-rail-count {
    display: none;
}

/* A chip hides "in lieu of" with the count; "link broken" stays as the chip's second line. */
.project-details-page .ps-shell.ps-assistant-open .ps-rail-lieu:not(.ps-rail-lieu--warn) {
    display: none;
}

/* "n unpriced" spans the chip under the name and total, after "link broken" when both show. */
.project-details-page .ps-shell.ps-assistant-open .ps-rail-attn {
    grid-column: 1 / -1;
    grid-row: auto;
    justify-self: start;
}

/* "n not drawn" spans the chip too, after "n unpriced" when both show. */
.project-details-page .ps-shell.ps-assistant-open .ps-rail-drawn {
    grid-column: 1 / -1;
    grid-row: auto;
    justify-self: start;
}

.project-details-page .ps-shell.ps-assistant-open .ps-shell-frame > .locked-overlay-wrapper > .locked-overlay-badge {
    top: 12px;
    left: auto;
    right: 16px;
    transform: none;
    max-width: none;
}

.project-details-page .ps-shell.ps-assistant-open .ps-shell-frame > .locked-overlay-wrapper > .locked-overlay-popover {
    top: 50px;
    left: auto;
    right: 16px;
    transform: none;
    max-width: none;
}

/* ---------- Fullscreen room ---------- */

/* The page's own fullscreen rule hides only direct children of .project-details-page. Everything here sits
   inside .ps-shell, which stays visible because it holds the room card, so these are hidden by name. */
.project-details-page.fullscreen-mode-active :is(.ps-header, .drift-banner, .project-financial-summary, .detailed-summary-section, .ps-rail) {
    display: none;
}

/* The fullscreen room card is position: fixed. No ancestor of it may be a size container, or it could trap the
   card (spec section 4.1), so the frame stops being one while a room is fullscreen. */
.project-details-page.fullscreen-mode-active .ps-shell-frame {
    container-type: normal;
}
