/**
 * plan-builder.css — Go Fire (fAIre)
 * Plan form modal: tabs, item cards, form fields, canvas system,
 * dropzone, toolbar, context menu, split handle, RAG preview drawer.
 * Depends on: layout.css, modals.css (uses .modal-backdrop)
 */

/* ── Plan Form Modal ── */
.plan-form-box {
    background: #141414;
    border: none;
    border-radius: 0;
    box-sizing: border-box;
    /* Fill the entire viewport to give the canvas maximum space */
    width: 100vw;
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.pf-header {
    padding: 18px 24px 14px;
    border-bottom: 1px solid #222;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.pf-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}
.pf-header-spacer {
    width: 28px;
    flex-shrink: 0;
}
.pf-project-name {
    flex: 1;
    text-align: center;
    font-size: 15px;
    letter-spacing: 0.5px;
    color: #f3f3f3;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.pf-title {
    font-size: 13px;
    letter-spacing: 2px;
    color: #e8e8e8;
    font-weight: 600;
}
.pf-close {
    width: 28px;
    height: 28px;
    border: none;
    background: transparent;
    color: #888;
    font-size: 20px;
    cursor: pointer;
    border-radius: 4px;
}
.pf-close:hover { color: #fff; background: #222; }
.pf-meta-grid {
    display: flex;
    gap: 10px;
    justify-content: flex-start;
}
.pf-meta-grid .pf-meta-field { max-width: 260px; }
.plan-form-box:not(.has-canvas) .pf-sidebar { visibility: hidden; width: 0; border: 0; padding: 0; }
.plan-form-box:not(.has-canvas) .pf-body    { grid-template-columns: 0 1fr; }
.pf-meta-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.pf-meta-label {
    font-size: 10px;
    color: #666;
    letter-spacing: 1px;
    text-transform: uppercase;
}
.pf-meta-input,
.pf-field input[type=text],
.pf-field select,
.pf-field textarea {
    background: #0d0d0d;
    border: 1px solid #2a2a2a;
    border-radius: 6px;
    padding: 9px 11px;
    color: #e8e8e8;
    font-size: 12px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.15s;
    width: 100%;
    box-sizing: border-box;
}
.pf-meta-input:focus,
.pf-field input[type=text]:focus,
.pf-field select:focus,
.pf-field textarea:focus { border-color: #ff6b2b66; }
/* Mandatory-field error state. Wins over :focus so the user keeps seeing the
   red border while typing into an empty required field. */
.pf-meta-input.error,
.pf-meta-input.error:focus { border-color: #E04848; box-shadow: 0 0 0 1px #E04848; }
.pf-meta-input::placeholder,
.pf-field input[type=text]::placeholder,
.pf-field textarea::placeholder { color: #555; }
.pf-body {
    flex: 1;
    display: grid;
    grid-template-columns: 300px 1fr;
    min-height: 0;
    min-width: 0;
    overflow: hidden;
}
.pf-sidebar {
    display: flex;
    flex-direction: column;
    min-height: 0;
    min-width: 0;
    overflow-x: hidden;
    border-right: 1px solid #222;
    background: #0c0c0c;
}
.pf-tabs {
    flex: 1;
    padding: 8px 0 14px;
    overflow-y: auto;
    overflow-x: hidden;
    min-height: 0;
    min-width: 0;
}
.pf-tabs-section-head {
    font-size: 9px;
    letter-spacing: 1.6px;
    color: #555;
    font-weight: 700;
    padding: 10px 16px 6px;
    text-transform: uppercase;
}
.pf-tab {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    cursor: pointer;
    border-left: 2px solid transparent;
    transition: background 0.12s;
}
.pf-tab:hover { background: #1a1a1a; }
.pf-tab.active {
    background: #1a1a1a;
    border-left-color: #ff6b2b;
}
/* Sidebar pin glyph — matches the round pin + letter-badge the user sees on canvas. */
.pf-tab-dot {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    font-family: inherit;
    box-shadow: 0 1px 2px rgba(0,0,0,0.5), inset 0 1px 0 rgba(255,255,255,0.22);
    border: 1.5px solid rgba(0,0,0,0.35);
}
.pf-tab-label {
    font-size: 11px;
    letter-spacing: 0.4px;
    color: #ccc;
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.pf-tab.active .pf-tab-label { color: #fff; }
.pf-tab-count {
    font-size: 11px;
    color: #666;
    background: #0d0d0d;
    padding: 2px 6px;
    border-radius: 10px;
    min-width: 16px;
    text-align: center;
    flex-shrink: 0;
}
/* Tab + its hidden sub-items. Hovering the group reveals the sub-items so
   they're discoverable without crowding the sidebar. Sub-items are clickable
   and set a sub-type that the auto-name uses (e.g. "Hallway 1"). */
.pf-tab-group { position: relative; }
.pf-tab-sub {
    display: none;
    padding: 2px 0 8px 44px;
    background: #0e0e0e;
    border-left: 2px solid transparent;
}
.pf-tab-group:hover .pf-tab-sub,
.pf-tab-group.has-active-sub .pf-tab-sub { display: block; }
.pf-tab-sub-item {
    display: block;
    padding: 5px 10px;
    font-size: 10.5px;
    color: #888;
    letter-spacing: 0.6px;
    cursor: pointer;
    border-radius: 4px;
    transition: background 0.12s, color 0.12s;
}
.pf-tab-sub-item::before { content: '\2022  '; color: #444; }
.pf-tab-sub-item:hover  { background: #1a1a1a; color: #ddd; }
.pf-tab-sub-item.active {
    background: #ff6b2b22;
    color: #ff6b2b;
    font-weight: 700;
}

/* ── Tool buttons (sit above the tab list in the left sidebar) ── */
.pf-tools {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 6px;
    padding: 12px 10px;
    border-bottom: 1px solid #222;
    flex-shrink: 0;
}
.pf-tool-vbtn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 8px 2px;
    background: #131313;
    color: #ccc;
    border: 1.5px solid #2a2a2a;
    border-radius: 7px;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 1px;
    font-family: inherit;
    cursor: pointer;
    transition: transform 0.12s ease, background 0.15s, border-color 0.15s, color 0.15s;
}
.pf-tool-vbtn:hover {
    transform: translateY(-1px);
    background: #1a1a1a;
    border-color: #444;
    color: #fff;
}
.pf-tool-vbtn .pf-tool-vbtn-icon {
    font-size: 14px;
    line-height: 1;
}
.pf-tool-vbtn.active {
    background: #ff6b2b;
    border-color: #ff6b2b;
    color: #fff;
    box-shadow: 0 3px 12px rgba(255,107,43,0.45), inset 0 1px 0 rgba(255,255,255,0.18);
}
.pf-content {
    overflow-y: auto;
    padding: 18px 22px;
    min-height: 0;
}
.pf-section-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 14px;
}
.pf-section-title {
    font-size: 13px;
    letter-spacing: 1.5px;
    color: #e8e8e8;
    font-weight: 600;
}
.pf-section-hint {
    font-size: 11px;
    color: #666;
    margin-top: 3px;
}
.pf-add-btn {
    background: #1a1a1a;
    border: 1px dashed #ff6b2b;
    color: #ff6b2b;
    padding: 7px 14px;
    border-radius: 6px;
    font-size: 11px;
    letter-spacing: 1px;
    cursor: pointer;
    font-family: inherit;
}
.pf-add-btn:hover { background: #ff6b2b12; }
.pf-empty {
    padding: 30px 20px;
    text-align: center;
    font-size: 12px;
    color: #555;
    border: 1px dashed #222;
    border-radius: 8px;
}
.pf-items {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.pf-quick-add {
    display: flex;
    gap: 8px;
    margin-bottom: 14px;
    padding: 10px 12px;
    background: #0a0a0a;
    border: 1px solid #1a1a1a;
    border-radius: 8px;
    align-items: center;
}
.pf-quick-add-icon {
    color: #ff6b2b;
    font-size: 16px;
    font-weight: 700;
    padding: 0 4px;
}
.pf-quick-add input {
    flex: 1;
    background: #0d0d0d;
    border: 1px solid #222;
    border-radius: 6px;
    padding: 9px 12px;
    color: #e8e8e8;
    font-size: 12px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.15s;
}
.pf-quick-add input:focus { border-color: #ff6b2b66; }
.pf-quick-add input::placeholder { color: #555; }
.pf-quick-add-hint {
    font-size: 10px;
    color: #555;
    letter-spacing: 0.5px;
    padding: 0 4px;
    white-space: nowrap;
}
.pf-quick-add-hint kbd {
    background: #1a1a1a;
    border: 1px solid #2a2a2a;
    border-radius: 3px;
    padding: 1px 5px;
    font-family: inherit;
    font-size: 9px;
    color: #aaa;
}
.pf-card {
    background: #0d0d0d;
    border: 1px solid #222;
    border-radius: 8px;
    transition: border-color 0.12s;
    overflow: hidden;
}
.pf-card:hover { border-color: #2a2a2a; }
.pf-card.expanded { border-color: #333; background: #0f0f0f; }
.pf-card-head {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    cursor: pointer;
    user-select: none;
}
.pf-card.expanded .pf-card-head {
    border-bottom: 1px solid #1a1a1a;
    background: #111;
}
.pf-card-badge {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    border: 1px solid;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    flex-shrink: 0;
}
.pf-card-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.pf-card-name {
    background: transparent;
    border: none;
    outline: none;
    color: #e8e8e8;
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    padding: 2px 6px 2px 0;
    width: 100%;
    border-bottom: 1px dashed transparent;
}
.pf-card-name::placeholder { color: #555; font-weight: 400; font-style: italic; }
.pf-card-name:hover { border-bottom-color: #2a2a2a; }
.pf-card-name:focus {
    border-bottom-color: #ff6b2b;
    background: #0a0a0a;
    padding-left: 4px;
}
.pf-card-summary {
    font-size: 11px;
    color: #888;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding-right: 8px;
}
.pf-card-summary .pf-dim { color: #444; font-style: italic; }
.pf-card-summary .pf-sum-link { color: #5fd9a3; }
.pf-card-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}
.pf-card-icon-btn {
    background: transparent;
    border: 1px solid transparent;
    color: #666;
    height: 26px;
    padding: 0 9px;
    border-radius: 4px;
    font-size: 10px;
    letter-spacing: 0.5px;
    font-family: inherit;
    font-weight: 600;
    cursor: pointer;
}
.pf-card-icon-btn:hover { color: #ccc; background: #1a1a1a; border-color: #2a2a2a; }
.pf-card-icon-btn.danger { font-size: 16px; font-weight: 400; line-height: 1; padding: 0 8px; }
.pf-card-icon-btn.danger:hover { color: #ff6b6b; border-color: #3a1a1a; background: #1a0e0e; }
.pf-card-chevron {
    color: #555;
    font-size: 11px;
    width: 22px;
    text-align: center;
    user-select: none;
    transition: color 0.12s, transform 0.15s;
}
.pf-card.expanded .pf-card-chevron { color: #ff6b2b; transform: rotate(180deg); }
.pf-card-fields {
    padding: 16px 16px 14px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.pf-card-footer {
    margin-top: 4px;
    padding-top: 12px;
    border-top: 1px dashed #1a1a1a;
}
.pf-add-another-btn {
    background: transparent;
    border: 1px dashed #2a2a2a;
    color: #666;
    padding: 9px 14px;
    border-radius: 6px;
    font-size: 11px;
    letter-spacing: 0.5px;
    cursor: pointer;
    font-family: inherit;
    width: 100%;
    transition: all 0.12s;
}
.pf-add-another-btn:hover {
    color: #ff6b2b;
    border-color: #ff6b2b66;
    background: #ff6b2b08;
}
.pf-field-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}
.pf-field-row.single { grid-template-columns: 1fr; }
.pf-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.pf-field label {
    font-size: 10px;
    color: #666;
    letter-spacing: 1px;
    text-transform: uppercase;
}
.pf-field textarea {
    resize: vertical;
    min-height: 52px;
    font-family: inherit;
}
.pf-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
}
.pf-toggle-switch {
    width: 34px;
    height: 18px;
    background: #2a2a2a;
    border-radius: 10px;
    position: relative;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.15s;
}
.pf-toggle-switch::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #888;
    transition: transform 0.15s, background 0.15s;
}
.pf-toggle-switch.on { background: #ff6b2b44; }
.pf-toggle-switch.on::after {
    transform: translateX(16px);
    background: #ff6b2b;
}
.pf-toggle-label {
    font-size: 11px;
    color: #aaa;
}
.pf-preview {
    border-left: 1px solid #222;
    background: #0a0a0a;
    display: flex;
    flex-direction: column;
    min-height: 0;
}
.pf-preview-head {
    padding: 12px 16px;
    border-bottom: 1px solid #1a1a1a;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.pf-preview-title {
    font-size: 10px;
    letter-spacing: 1.5px;
    color: #666;
}
.pf-preview-toggle {
    background: transparent;
    border: 1px solid #222;
    color: #888;
    padding: 3px 9px;
    font-size: 10px;
    border-radius: 4px;
    cursor: pointer;
    font-family: inherit;
}
.pf-preview-toggle:hover { color: #ccc; border-color: #333; }
.pf-preview-body {
    flex: 1;
    overflow-y: auto;
    padding: 14px 16px;
    font-size: 11px;
    line-height: 1.6;
    color: #bbb;
    white-space: pre-wrap;
    font-family: 'SF Mono', Consolas, Monaco, monospace;
}
.pf-preview-body .pf-prev-header {
    color: #ff6b2b;
    font-weight: 700;
    display: block;
    margin: 12px 0 4px;
}
.pf-preview-body .pf-prev-header:first-child { margin-top: 0; }
.pf-footer {
    padding: 14px 22px;
    border-top: 1px solid #222;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
}
.pf-footer-error {
    color: #ff6b6b;
    font-size: 11px;
    flex: 1;
}
.pf-footer-buttons {
    display: flex;
    gap: 10px;
}
.pf-kbd-hints {
    font-size: 10px;
    color: #555;
    letter-spacing: 0.3px;
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    justify-content: center;
    flex-wrap: wrap;
}
.pf-kbd-hints span { display: inline-flex; align-items: center; }
.pf-kbd-hints .pf-kbd-sep { color: #333; font-weight: 700; }
.pf-kbd-hints kbd {
    background: #1a1a1a;
    border: 1px solid #2a2a2a;
    border-radius: 3px;
    padding: 1px 6px;
    font-family: inherit;
    font-size: 9px;
    color: #aaa;
    margin-right: 6px;
}
/* ── Connect toggle grid (replaces dropdown+chips) ── */
.pf-conn-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.pf-conn-group {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}
.pf-conn-group-label {
    font-size: 9px;
    letter-spacing: 1px;
    color: #555;
    width: 64px;
    padding-top: 6px;
    flex-shrink: 0;
    text-align: right;
}
.pf-conn-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    flex: 1;
}
.pf-conn-pill {
    background: #0d0d0d;
    border: 1px solid #222;
    color: #888;
    padding: 5px 11px;
    border-radius: 14px;
    font-size: 11px;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.1s;
}
.pf-conn-pill:hover {
    border-color: #ff6b2b66;
    color: #ccc;
}
.pf-conn-pill.on {
    background: #ff6b2b22;
    border-color: #ff6b2b;
    color: #ff6b2b;
    font-weight: 600;
}
.pf-conn-pill.on:hover {
    background: #ff6b2b33;
}
.pf-conn-empty {
    font-size: 11px;
    color: #555;
    font-style: italic;
    padding: 6px 0;
}
/* ── Collapsible Notes details ── */
.pf-notes-details {
    border-top: 1px dashed #1a1a1a;
    padding-top: 10px;
}
.pf-notes-details > summary {
    list-style: none;
    cursor: pointer;
    font-size: 10px;
    letter-spacing: 1px;
    color: #666;
    text-transform: uppercase;
    padding: 4px 0;
    user-select: none;
}
.pf-notes-details > summary::-webkit-details-marker { display: none; }
.pf-notes-details > summary::before {
    content: '+ ';
    color: #ff6b2b;
}
.pf-notes-details[open] > summary::before {
    content: '− ';
}
.pf-notes-details > summary:hover { color: #ccc; }
.pf-notes-details textarea {
    margin-top: 6px;
    background: #0d0d0d;
    border: 1px solid #2a2a2a;
    border-radius: 6px;
    padding: 9px 11px;
    color: #e8e8e8;
    font-size: 12px;
    font-family: inherit;
    outline: none;
    width: 100%;
    box-sizing: border-box;
    resize: vertical;
    min-height: 52px;
}
.pf-notes-details textarea:focus { border-color: #ff6b2b66; }
/* ── Collapsible meta header ── */
.pf-header.collapsed .pf-meta-grid { display: none; }
.pf-header-summary {
    display: none;
    font-size: 12px;
    color: #aaa;
    cursor: pointer;
    padding: 6px 10px;
    background: #0d0d0d;
    border: 1px solid #1a1a1a;
    border-radius: 6px;
    transition: border-color 0.12s;
}
.pf-header-summary:hover { border-color: #2a2a2a; color: #e8e8e8; }
.pf-header-summary .pf-sum-sep { color: #444; margin: 0 8px; }
.pf-header-summary .pf-sum-edit {
    color: #666;
    font-size: 10px;
    letter-spacing: 0.5px;
    margin-left: 10px;
}
.pf-header.collapsed .pf-header-summary { display: block; }
.pf-meta-collapse {
    background: transparent;
    border: none;
    color: #555;
    font-size: 11px;
    cursor: pointer;
    padding: 2px 8px;
    border-radius: 3px;
    font-family: inherit;
    letter-spacing: 0.3px;
}
.pf-meta-collapse:hover { color: #ccc; background: #1a1a1a; }

/* ── Canvas visual plan system ── */
/* When canvas is active: tabs | CANVAS | form-right.
   Preview hides. Form slides into the right column. */
.plan-form-box.has-canvas .pf-body {
    grid-template-columns: 300px 1fr;
}
.plan-form-box.has-canvas .pf-sidebar { visibility: visible; width: auto; }
.plan-form-box.has-canvas .pf-content {
    padding: 0;
    display: flex;
    flex-direction: column;
}

.pf-canvas-region {
    display: flex;
    flex-direction: column;
    min-height: 0;
    flex: 1;
}
.pf-canvas-toolbar {
    display: flex;
    align-items: center;
    gap: 3px;
    padding: 6px 10px;
    background: #111;
    border-bottom: 1px solid #1a1a1a;
    flex-shrink: 0;
}
.pf-canvas-toolbar-sep {
    width: 1px;
    height: 20px;
    background: #2a2a2a;
    margin: 0 6px;
}
.pf-canvas-toolbar-spacer {
    flex: 1;
}
.pf-zoom-segment {
    display: inline-flex;
    align-items: center;
    border: 1px solid #2a2a2a;
    border-radius: 6px;
    overflow: hidden;
    background: #0d0d0d;
}
.pf-zoom-segment .pf-canvas-tool-btn {
    border: none !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    padding: 5px 11px;
}
.pf-zoom-segment .pf-canvas-tool-btn:hover {
    background: #1a1a1a !important;
}
.pf-zoom-segment .pf-canvas-zoom-label {
    border-left: 1px solid #2a2a2a;
    border-right: 1px solid #2a2a2a;
    padding: 0 8px;
    line-height: 22px;
    min-width: 44px;
}
.pf-canvas-tool-btn {
    background: #1a1a1a;
    border: 1px solid #2a2a2a;
    color: #aaa;
    padding: 5px 10px;
    border-radius: 5px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.3px;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.12s;
    white-space: nowrap;
}
.pf-canvas-tool-btn:hover { color: #e8e8e8; border-color: #444; background: #222; }
.pf-canvas-tool-btn.active { background: #ff6b2b; border-color: #ff6b2b; color: #fff; }
.pf-canvas-tool-group {
    display: flex;
    gap: 1px;
    background: #2a2a2a;
    border-radius: 5px;
    overflow: hidden;
}
.pf-canvas-tool-group .pf-canvas-tool-btn { border-radius: 0; border: none; border-right: 1px solid #2a2a2a; }
.pf-canvas-tool-group .pf-canvas-tool-btn:last-child { border-right: none; }
.pf-canvas-tool-group .pf-canvas-tool-btn.active { border-color: #ff6b2b; }
.pf-tool-icon { font-size: 13px; line-height: 1; margin-right: 3px; }
/* Prominent Link / Erase buttons — the only canvas tools */
.pf-tool-group-big { gap: 8px; background: transparent !important; border: none !important; overflow: visible !important; }
.pf-canvas-tool-btn.pf-tool-big {
    padding: 9px 22px !important;
    font-size: 12px !important;
    font-weight: 800 !important;
    letter-spacing: 1.2px !important;
    border: 1.5px solid #2a2a2a !important;
    border-radius: 8px !important;
    background: #0f0f0f !important;
    color: #ddd !important;
    box-shadow: 0 1px 2px rgba(0,0,0,0.25) !important;
    transition: transform 0.12s ease, box-shadow 0.15s ease, background 0.15s ease !important;
}
.pf-canvas-tool-btn.pf-tool-big:hover { transform: translateY(-1px); background: #1a1a1a !important; border-color: #444 !important; }
.pf-canvas-tool-btn.pf-tool-big.active {
    background: #ff6b2b !important;
    border-color: #ff6b2b !important;
    color: #fff !important;
    box-shadow: 0 4px 14px rgba(255,107,43,0.45), inset 0 1px 0 rgba(255,255,255,0.18) !important;
}
.pf-canvas-tool-btn.pf-tool-big .pf-tool-icon { font-size: 15px; margin-right: 6px; }
.pf-view-toggle {
    display: flex;
    background: #0d0d0d;
    border-radius: 5px;
    overflow: hidden;
    border: 1px solid #2a2a2a;
    margin-left: auto;
}
.pf-view-btn {
    background: transparent;
    border: none;
    color: #555;
    padding: 5px 11px;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.8px;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.12s;
}
.pf-view-btn:hover { color: #ccc; }
.pf-view-btn.active { background: #222; color: #ff6b2b; }
.pf-view-btn + .pf-view-btn { border-left: 1px solid #2a2a2a; }
.pf-canvas-page-nav {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 10px;
    color: #888;
}
.pf-canvas-page-btn {
    background: #1a1a1a;
    border: 1px solid #2a2a2a;
    color: #aaa;
    width: 22px;
    height: 22px;
    border-radius: 3px;
    cursor: pointer;
    font-family: inherit;
    font-size: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.pf-canvas-page-btn:hover { color: #fff; border-color: #444; }
.pf-canvas-wrap {
    flex: 1;
    position: relative;
    background: #ffffff;
    overflow: hidden;
    min-height: 0;
    min-width: 0;
}
.pf-canvas-wrap canvas {
    position: absolute;
    top: 0;
    left: 0;
}
.pf-canvas-wrap.tool-select { cursor: default; }
.pf-canvas-wrap.tool-pin { cursor: crosshair; }
.pf-canvas-wrap.tool-connect { cursor: cell; }
.pf-canvas-wrap.tool-label { cursor: crosshair; }
.pf-canvas-wrap.tool-zone  { cursor: crosshair; }
/* Tabs column becomes a vertical stack so zones section can sit above the tab list. */
.pf-tabs { display: flex; flex-direction: column; }
.pf-tabs-list { display: flex; flex-direction: column; }
/* ── Flat zones sidebar (above tabs) ── */
.pf-zones-section {
    padding: 8px 12px 8px;
    border-bottom: 1px solid #ececec;
    background: #fafafa;
    font-family: Geist, -apple-system, BlinkMacSystemFont, sans-serif;
    flex-shrink: 0;
}
.pf-zones-head {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 6px;
}
.pf-zones-title {
    font-size: 10px; letter-spacing: 1.4px; font-weight: 700; color: #444;
}
.pf-zones-count {
    display: inline-block; min-width: 18px; padding: 0 6px;
    margin-left: 4px; border-radius: 9px; background: #ff6b2b; color: #fff;
    font-size: 10px; line-height: 16px; text-align: center;
}
.pf-zones-hint { font-size: 10px; color: #999; letter-spacing: 0.4px; }
.pf-zones-empty {
    font-size: 11px; color: #888; padding: 4px 0 6px; font-style: italic;
}
.pf-zones-list { display: flex; flex-direction: column; gap: 4px; }
.pf-zone-row {
    display: flex; align-items: center; gap: 8px;
    padding: 4px 6px; border-radius: 6px; background: #fff;
    border: 1px solid #ececec;
}
.pf-zone-swatch-dot {
    width: 14px; height: 14px; border-radius: 50%;
    border: 1.5px solid rgba(0,0,0,0.15); cursor: pointer; flex-shrink: 0;
}
.pf-zone-name {
    flex: 1; min-width: 0; padding: 4px 8px;
    border: 1px solid transparent; border-radius: 5px;
    font-size: 12px; font-weight: 600; color: #222; background: transparent;
    font-family: inherit; outline: none;
}
.pf-zone-name:hover  { border-color: #e0e0e0; background: #fafafa; }
.pf-zone-name:focus  { border-color: #ff6b2b; background: #fff; }
.pf-zone-del {
    width: 22px; height: 22px; padding: 0; flex-shrink: 0;
    border: 1px solid #f4c6c6; background: #fff5f5; color: #c23030;
    border-radius: 5px; font-size: 14px; font-weight: 700;
    cursor: pointer; line-height: 1;
}
.pf-zone-del:hover { background: #ffe5e5; }
.pf-canvas-wrap.panning { cursor: grabbing !important; }
/* ── Dropzone ── */
.pf-canvas-dropzone {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 20px;
    margin: 10px 22px;
    border: 1.5px dashed #2a2a2a;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s;
    background: #0d0d0d;
}
.pf-canvas-dropzone:hover { border-color: #ff6b2b88; background: #141414; }
.pf-canvas-dropzone.drag-over { border-color: #ff6b2b; background: #1a1008; }
.pf-canvas-dropzone-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: #1a1a1a;
    border: 1px solid #2a2a2a;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: #ff6b2b;
    font-size: 16px;
}
.pf-canvas-dropzone-body {
    flex: 1;
    min-width: 0;
}
.pf-canvas-dropzone-text {
    font-size: 12px;
    color: #ccc;
    font-weight: 600;
}
.pf-canvas-dropzone-hint {
    font-size: 10px;
    color: #555;
    margin-top: 2px;
}
.pf-canvas-dropzone-btn {
    background: #1a1a1a;
    border: 1px solid #ff6b2b;
    color: #ff6b2b;
    padding: 6px 14px;
    border-radius: 5px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    flex-shrink: 0;
    transition: all 0.12s;
}
.pf-canvas-dropzone-btn:hover { background: #ff6b2b; color: #fff; }
/* ── Canvas onboarding hint ── */
.pf-canvas-hint {
    position: absolute;
    bottom: 12px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.75);
    border: 1px solid #333;
    border-radius: 6px;
    padding: 6px 14px;
    font-size: 11px;
    color: #aaa;
    pointer-events: none;
    white-space: nowrap;
    z-index: 5;
    transition: opacity 0.3s;
}
.pf-canvas-hint kbd {
    background: #222;
    border: 1px solid #444;
    border-radius: 3px;
    padding: 1px 5px;
    font-size: 9px;
    color: #ccc;
    margin: 0 2px;
    font-family: inherit;
}
.pf-split-handle {
    height: 8px;
    background: #141414;
    cursor: row-resize;
    flex-shrink: 0;
    position: relative;
    transition: background 0.12s;
}
.pf-split-handle:hover { background: #1a1a1a; }
.pf-split-handle::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 48px;
    height: 3px;
    border-radius: 2px;
    background: #333;
    transition: background 0.12s;
}
.pf-split-handle:hover::after { background: #ff6b2b; }
/* Floating RAG preview drawer */
.pf-rag-drawer {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 340px;
    background: #0a0a0a;
    border-left: 1px solid #222;
    z-index: 20;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.2s ease;
}
.pf-rag-drawer.open { transform: translateX(0); }
.pf-rag-drawer-head {
    padding: 10px 14px;
    border-bottom: 1px solid #1a1a1a;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.pf-rag-drawer-title {
    font-size: 10px;
    letter-spacing: 1.5px;
    color: #666;
}
.pf-rag-drawer-close {
    background: transparent;
    border: 1px solid #222;
    color: #888;
    width: 22px;
    height: 22px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: inherit;
}
.pf-rag-drawer-close:hover { color: #fff; border-color: #444; }
.pf-rag-drawer-body {
    flex: 1;
    overflow-y: auto;
    padding: 14px 16px;
    font-size: 11px;
    line-height: 1.6;
    color: #bbb;
    white-space: pre-wrap;
    font-family: 'SF Mono', Consolas, Monaco, monospace;
}
.pf-rag-drawer-body .pf-prev-header {
    color: #ff6b2b;
    font-weight: 700;
    display: block;
    margin: 12px 0 4px;
}
.pf-rag-drawer-body .pf-prev-header:first-child { margin-top: 0; }
.pf-canvas-zoom-label {
    font-size: 10px;
    color: #666;
    min-width: 38px;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

/* ── Wizard busy overlay (shown during slow async steps) ── */
.gf-wizard-busy {
    position: fixed;
    inset: 0;
    z-index: 1500;
    background: rgba(0,0,0,0.65);
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    animation: gfFadeIn 0.18s ease;
}
.gf-wizard-busy-card {
    background: #141414;
    border: 1px solid #2a2a2a;
    border-radius: 10px;
    padding: 28px 36px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    min-width: 240px;
    box-shadow: 0 18px 48px rgba(0,0,0,0.55);
}
.gf-wizard-busy-spinner {
    width: 30px;
    height: 30px;
    border: 3px solid #2a2a2a;
    border-top-color: #ff6b2b;
    border-radius: 50%;
    animation: gfSpin 0.8s linear infinite;
}
.gf-wizard-busy-msg {
    font-size: 12px;
    letter-spacing: 0.6px;
    color: #d8d8d8;
    font-weight: 500;
}
@keyframes gfSpin {
    from { transform: rotate(0); }
    to   { transform: rotate(360deg); }
}
@keyframes gfFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* ── Upload wizard (page pick + crop) ── */
.gf-wizard .modal-box {
    max-width: 1100px;
    width: 95vw;
    max-height: 94vh;
    display: flex;
    flex-direction: column;
}
.gf-wizard-hint {
    font-size: 12px;
    color: #9a9a9a;
    padding: 4px 2px 14px;
    line-height: 1.5;
}
.gf-wizard-hint b { color: #e0e0e0; font-weight: 600; }
.gf-wizard-thumbs {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 12px;
    max-height: 60vh;
    overflow-y: auto;
    padding: 4px;
}
.gf-wizard-thumb {
    padding: 8px;
    background: #0f0f0f;
    border: 1.5px solid #2a2a2a;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    font-family: inherit;
    transition: border-color 0.12s, transform 0.12s, box-shadow 0.15s;
}
.gf-wizard-thumb:hover {
    border-color: #ff6b2b;
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(255,107,43,0.25);
}
.gf-wizard-thumb canvas {
    max-width: 100%;
    max-height: 220px;
    background: #fff;
    border-radius: 3px;
    display: block;
}
.gf-wizard-thumb-label {
    font-size: 11px;
    color: #ccc;
    letter-spacing: 1.3px;
    font-weight: 700;
}
.gf-wizard-spinner {
    padding: 40px;
    text-align: center;
    color: #777;
    font-size: 12px;
}
.gf-crop-viewport {
    position: relative;
    background: #000;
    border: 1px solid #2a2a2a;
    border-radius: 6px;
    overflow: auto;
    cursor: crosshair;
    margin: 8px 0 14px;
    user-select: none;
    max-height: 65vh;
}
.gf-crop-viewport canvas { display: block; margin: 0 auto; }
.gf-crop-rect {
    position: absolute;
    border: 2.5px dashed #ff6b2b;
    background: rgba(255,107,43,0.22);
    box-shadow: 0 0 0 9999px rgba(0,0,0,0.55);
    pointer-events: none;
    display: none;
    box-sizing: border-box;
    z-index: 2;
}

/* ── Radial pin-type picker ── */
/* Anchor: a 0×0 fixed-position point at the click location. Children use
   absolute positioning inside this point and `transform: translate(-50%,-50%)`
   to center their visual midpoint on (left, top). Sizes scale with
   --pf-picker-scale (set inline by JS from canvas zoom) so the ring stays
   visually proportional to nearby pins. */
.pf-pin-picker {
    position: fixed;
    width: 0;
    height: 0;
    z-index: 2000;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.12s ease;
    --pf-picker-scale: 1;
}
.pf-pin-picker.open {
    opacity: 1;
    pointer-events: auto;
}
.pf-pin-picker-dot {
    position: absolute;
    left: 0;
    top: 0;
    width: calc(8px * var(--pf-picker-scale));
    height: calc(8px * var(--pf-picker-scale));
    background: #ff6b2b;
    border-radius: 50%;
    border: 2px solid #fff;
    transform: translate(-50%, -50%);
    box-shadow: 0 0 0 3px rgba(255,107,43,0.25), 0 2px 6px rgba(0,0,0,0.5);
}
.pf-pin-picker-ring {
    position: absolute;
    left: 0;
    top: 0;
    /* width/height set inline by JS (= 2 × radius). */
    border-radius: 50%;
    border: 1.5px dashed rgba(255,107,43,0.35);
    transform: translate(-50%, -50%);
    pointer-events: none;
}
.pf-pin-picker-btn {
    position: absolute;
    transform: translate(-50%, -50%);
    width: calc(36px * var(--pf-picker-scale));
    height: calc(36px * var(--pf-picker-scale));
    border-radius: 50%;
    border: 2px solid rgba(0,0,0,0.35);
    color: #fff;
    font-weight: 800;
    font-size: calc(13px * var(--pf-picker-scale));
    cursor: pointer;
    box-shadow: 0 3px 10px rgba(0,0,0,0.5), inset 0 1px 0 rgba(255,255,255,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: inherit;
    padding: 0;
    transition: transform 0.12s ease, box-shadow 0.12s;
}
.pf-pin-picker-btn:hover {
    transform: translate(-50%, -50%) scale(1.18);
    box-shadow: 0 5px 16px rgba(0,0,0,0.65), inset 0 1px 0 rgba(255,255,255,0.3);
}
.pf-pin-picker-label {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-top: calc(3px * var(--pf-picker-scale));
    font-size: calc(8px * var(--pf-picker-scale));
    letter-spacing: 1.2px;
    font-weight: 700;
    color: #fff;
    background: rgba(10,10,10,0.85);
    padding: 2px 6px;
    border-radius: 3px;
    white-space: nowrap;
    pointer-events: none;
}

/* ── Read-only Initial Design Assessment view ── */
/* Mirrors the markup window but: tools/areas hidden, left column shows the
   building-level summary, canvas is read-only, hovering a pin shows that
   pin's findings as a popover. Reuses .has-canvas grid + .pf-canvas-wrap. */
.plan-form-box.assessment-mode .pf-tools,
.plan-form-box.assessment-mode .pf-tabs,
.plan-form-box.assessment-mode .pf-canvas-toolbar .pf-canvas-tool-btn[onclick*="triggerPlanUpload"],
.plan-form-box.assessment-mode .pf-kbd-hints {
    display: none !important;
}
.plan-form-box.assessment-mode .pf-canvas-wrap {
    cursor: default !important;
}
.pf-assessment-summary {
    flex: 1;
    overflow-y: auto;
    padding: 18px 20px 24px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    min-height: 0;
}
.pf-assessment-summary-head {
    font-size: 11px;
    letter-spacing: 1.4px;
    font-weight: 700;
    color: #999;
    text-transform: uppercase;
    margin-bottom: 4px;
}
.pf-assess-section {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding-bottom: 12px;
    border-bottom: 1px solid #1a1a1a;
}
.pf-assess-section:last-child { border-bottom: none; }
.pf-assess-label {
    font-size: 10px;
    letter-spacing: 0.8px;
    font-weight: 700;
    color: #888;
    text-transform: uppercase;
}
.pf-assess-body {
    font-size: 12px;
    line-height: 1.5;
    color: #ddd;
    white-space: pre-wrap;
}
.pf-assessment-empty {
    font-size: 12px;
    color: #777;
    font-style: italic;
    padding: 16px 0;
}

/* Pin-finding hover popover */
.pf-pin-popover {
    position: fixed;
    z-index: 2200;
    max-width: 320px;
    background: #141414;
    border: 1px solid #2a2a2a;
    border-radius: 10px;
    padding: 10px 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    font-family: inherit;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.12s ease;
}
.pf-pin-popover.open { opacity: 1; }
.pf-pin-popover-name {
    font-size: 12px;
    font-weight: 700;
    color: #fff;
    margin-bottom: 6px;
    letter-spacing: 0.2px;
}
.pf-pin-popover-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.pf-pin-popover-list li {
    font-size: 11px;
    line-height: 1.45;
    color: #cfcfcf;
}
.pf-pin-popover-ref {
    font-size: 10px;
    color: #ff6b2b;
    font-weight: 600;
    margin-bottom: 2px;
}
.pf-pin-popover-issue { color: #e8e8e8; }
.pf-pin-popover-empty {
    font-size: 11px;
    color: #888;
    font-style: italic;
}

/* Footer button overrides for assessment mode */
.plan-form-box.assessment-mode .modal-btn.cancel,
.plan-form-box.assessment-mode #planFormSaveBtn {
    display: none !important;
}
.pf-assess-btn-edit,
.pf-assess-btn-close,
.pf-assess-btn-export {
    font-family: inherit;
    cursor: pointer;
    border-radius: 6px;
    padding: 9px 16px;
    font-size: 12px;
    font-weight: 600;
}
.pf-assess-btn-edit {
    background: #1a1a1a;
    border: 1px solid #2a2a2a;
    color: #e8e8e8;
}
.pf-assess-btn-edit:hover { background: #222; border-color: #444; }
.pf-assess-btn-export {
    background: #1a1a1a;
    border: 1px solid #2a2a2a;
    color: #e8e8e8;
}
.pf-assess-btn-export:hover { background: #222; border-color: #444; }
.pf-assess-btn-close {
    background: #ff6b2b;
    border: 1px solid #ff6b2b;
    color: #fff;
}
.pf-assess-btn-close:hover { background: #e85f24; }

/* ── Stair-card cross-floor linking section ── */
.pf-stair-link-field { margin-bottom: 10px; }
.pf-stair-link-row {
    display: flex;
    gap: 8px;
    align-items: center;
}
.pf-stair-link-select {
    flex: 1;
    background: #0d0d0d;
    border: 1px solid #2a2a2a;
    border-radius: 6px;
    padding: 9px 11px;
    color: #e8e8e8;
    font-size: 12px;
    font-family: inherit;
    cursor: pointer;
    outline: none;
    transition: border-color 0.15s;
}
.pf-stair-link-select:focus { border-color: #ff6b2b66; }
.pf-stair-link-select option:disabled { color: #555; }
.pf-stair-unlink-btn {
    background: transparent;
    border: 1px solid #4a2a2a;
    color: #c97a7a;
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 11px;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.1s;
    white-space: nowrap;
}
.pf-stair-unlink-btn:hover { background: #2a1818; border-color: #6a3a3a; color: #e8a0a0; }
.pf-stair-link-status {
    margin-top: 6px;
    font-size: 11px;
    color: #ff6b2b;
    font-style: normal;
}
.pf-stair-link-status.pf-dim { color: #666; font-style: italic; }

/* ── Stair-link prompt modal (fired on pin-tool drop when siblings exist) ── */
.pf-stair-link-modal {
    width: 460px;
    max-width: 90vw;
    padding: 22px 22px 18px;
}
.pf-stair-link-modal-title {
    font-size: 14px;
    letter-spacing: 1.2px;
    text-transform: uppercase;
    color: #ff6b2b;
    font-weight: 700;
    margin-bottom: 6px;
}
.pf-stair-link-modal-sub {
    font-size: 12px;
    color: #aaa;
    line-height: 1.5;
    margin-bottom: 14px;
}
.pf-stair-link-modal-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 14px;
    max-height: 320px;
    overflow-y: auto;
}
.pf-stair-link-option {
    background: #0d0d0d;
    border: 1px solid #2a2a2a;
    border-radius: 8px;
    padding: 12px 14px;
    color: #e8e8e8;
    font-family: inherit;
    text-align: left;
    cursor: pointer;
    transition: all 0.12s;
    display: block;
    width: 100%;
}
.pf-stair-link-option:hover {
    border-color: #ff6b2b;
    background: #1a0f08;
    transform: translateY(-1px);
}
.pf-stair-link-option-name {
    font-size: 13px;
    font-weight: 600;
    color: #fff;
    margin-bottom: 2px;
}
.pf-stair-link-option-floor {
    font-size: 11px;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.6px;
}
.pf-stair-link-modal-foot {
    border-top: 1px solid #1a1a1a;
    padding-top: 12px;
    text-align: center;
}
.pf-stair-link-new-btn {
    background: transparent;
    border: 1px solid #2a2a2a;
    color: #aaa;
    border-radius: 6px;
    padding: 9px 18px;
    font-size: 12px;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.1s;
}
.pf-stair-link-new-btn:hover {
    border-color: #444;
    color: #fff;
    background: #1a1a1a;
}

