/* Left edge of the Brief panel: drag (or arrow keys) to resize; editor-brief-rail.js
   keeps the width in --brief-rail-w. The collapsed panel hides it with its other parts. */
.pf-resize {
    position: absolute;
    top: 0;
    bottom: 0;
    left: -4px;
    z-index: 5;
    width: 8px;
    cursor: col-resize;
    touch-action: none;
}
.pf-resize::after {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    left: 3px;
    width: 2px;
    background: transparent;
    transition: background 0.15s;
}
.pf-resize:hover::after,
.pf-resize:focus-visible::after,
.is-resizing-brief .pf-resize::after {
    background: var(--button-primary, var(--brand-orange));
}
.pf-resize:focus-visible {
    outline: none;
}
body.is-resizing-brief {
    cursor: col-resize;
    user-select: none;
}
@media (max-width: 1099px) {
    .pf-resize {
        display: none;
    }
}
/* Small projects (one use, at most one unit type) keep the tree as a slim rail. */
.pf.is-rail {
    grid-template-columns: 64px minmax(0, 1fr) var(--brief-rail-w, 400px);
}
.pf.is-rail .pf-tree {
    padding: 10px 6px;
}
.pf.is-rail .pf-tree-label,
.pf.is-rail .pf-tree-count {
    display: none;
}
.pf.is-rail .pf-tree-abbr {
    display: inline;
    font-size: 11px;
    font-weight: 600;
    color: var(--gray-600);
}
.pf.is-rail .pf-tree-node,
.pf.is-rail .pf-tree-add {
    flex-direction: column;
    justify-content: center;
    gap: 3px;
    padding: 6px 2px;
}
.pf.is-rail .pf-menu {
    position: fixed;
    z-index: 40;
    min-width: 200px;
}
@media (min-width: 1100px) {
    .pf.is-panel-collapsed {
        grid-template-columns: 220px minmax(0, 1fr) 44px;
    }
    .pf.is-rail.is-panel-collapsed {
        grid-template-columns: 64px minmax(0, 1fr) 44px;
    }
    :is(.pf, .setup-split).is-panel-collapsed .pf-panel > :not(.pf-expand) {
        display: none;
    }
    :is(.pf, .setup-split).is-panel-collapsed .pf-expand {
        display: flex;
        flex: 1;
        align-items: center;
        justify-content: center;
        border: none;
        background: var(--gray-50);
        font: inherit;
        font-size: 13px;
        color: var(--gray-600);
        cursor: pointer;
    }
    .pf-expand span {
        writing-mode: vertical-rl;
    }
}
/* 1100–1440 px: the tree is a slim rail with progress dots. */
@media (min-width: 1100px) and (max-width: 1439px) {
    .pf {
        grid-template-columns: 64px minmax(0, 1fr) var(--brief-rail-w, 400px);
    }
    .pf.is-panel-collapsed {
        grid-template-columns: 64px minmax(0, 1fr) 44px;
    }
    .pf .pf-tree {
        padding: 10px 6px;
    }
    .pf .pf-tree-label,
    .pf .pf-tree-count {
        display: none;
    }
    .pf .pf-tree-abbr {
        display: inline;
        font-size: 11px;
        font-weight: 600;
        color: var(--gray-600);
    }
    .pf .pf-tree-node,
    .pf .pf-tree-add {
        flex-direction: column;
        justify-content: center;
        gap: 3px;
        padding: 6px 2px;
    }
    .pf .pf-tree-room-item {
        display: none;
    }
    .pf .pf-tree-item {
        padding-left: 0;
    }
    .pf .pf-tree .pf-tree-arrow {
        display: none;
    }
    .pf .pf-menu {
        position: fixed;
        z-index: 40;
        min-width: 200px;
    }
}
/* Below 1100 px: breadcrumb instead of the tree, the panel opens from an edge tab. */
@media (max-width: 1099px) {
    .pf,
    .pf.is-rail {
        grid-template-columns: minmax(0, 1fr);
        grid-template-rows: auto minmax(0, 1fr);
        grid-template-areas: "crumbs" "main";
    }
    .pf-tree {
        display: none;
    }
    .pf-crumbs {
        display: flex;
    }
    .pf-panel {
        position: fixed;
        top: var(--sticky-header-offset);
        right: 0;
        bottom: 0;
        z-index: 60;
        width: min(420px, 92vw);
        box-shadow: -8px 0 24px rgba(var(--black-rgb), 0.12);
        transform: translateX(100%);
        visibility: hidden;
        transition: transform 0.2s ease, visibility 0.2s;
    }
    :is(.pf, .setup-split).is-panel-open .pf-panel {
        transform: none;
        visibility: visible;
    }
    .pf-collapse-toggle {
        display: none;
    }
    .pf-close {
        display: inline-block;
    }
    .pf-edge-tab {
        display: block;
        position: fixed;
        top: 50%;
        right: 0;
        z-index: 55;
        padding: 14px 8px;
        border: 1px solid var(--gray-300);
        border-right: none;
        border-radius: var(--radius) 0 0 var(--radius);
        background: var(--white);
        box-shadow: -2px 0 8px rgba(var(--black-rgb), 0.08);
        font: inherit;
        font-size: 13px;
        color: var(--gray-800);
        writing-mode: vertical-rl;
        transform: translateY(-50%);
        cursor: pointer;
    }
    :is(.pf, .setup-split).is-panel-open .pf-edge-tab {
        display: none;
    }
}
/* Mobile: the panel is a bottom sheet and its totals are the handle. The Brief
   beside the form steps has no totals, so it keeps the edge tab and slides in. */
@media (max-width: 640px) {
    #setup-shell:has(#setup-panel-new:not([hidden]) .pf) {
        padding-left: 12px;
        padding-right: 12px;
    }
    .setup-shell #setup-panel-new:has(.pf) .setup-actions {
        padding-bottom: 68px;
    }
    .pf-main {
        padding: 0 14px 24px;
    }
    .pf .pf-edge-tab,
    .pf.is-panel-open .pf-edge-tab {
        display: none;
    }
    .pf .pf-panel {
        top: auto;
        left: 0;
        width: auto;
        height: 80vh;
        border-left: none;
        border-top: 1px solid var(--gray-200);
        border-radius: 14px 14px 0 0;
        box-shadow: 0 -8px 24px rgba(var(--black-rgb), 0.12);
        transform: translateY(calc(100% - 64px));
        visibility: visible;
    }
    .pf-totals {
        padding: 18px 48px 10px 16px;
        border-radius: 14px 14px 0 0;
        cursor: pointer;
    }
    .pf-totals::before {
        content: '';
        position: absolute;
        top: 6px;
        left: 50%;
        width: 36px;
        height: 4px;
        margin-left: -18px;
        border-radius: 2px;
        background: var(--gray-300);
    }
    .pf-sheet-toggle {
        display: block;
        position: absolute;
        top: 0;
        right: 0;
        bottom: 0;
        width: 48px;
        border: none;
        background: none;
        color: var(--gray-500);
        cursor: pointer;
    }
    .pf-sheet-toggle::after {
        content: '▴';
    }
    .pf.is-panel-open .pf-sheet-toggle::after {
        content: '▾';
    }
    .pf .pf-close {
        display: none;
    }
}

