/* CONNECTOR_BUDGET_BASELINES_DESKTOP_V1 */

.bb-modal-box{
    width:min(1320px,97vw);
    max-height:95vh;
    padding:0;
    gap:0;
    overflow:hidden;
}

.bb-modal-header{
    display:flex;
    align-items:flex-start;
    justify-content:space-between;
    gap:16px;
    padding:18px 20px;
    background:linear-gradient(135deg,#0f172a,#1e3a8a);
    color:#fff;
}

.bb-modal-header h2{
    margin:5px 0 0;
    color:#fff;
    font-size:21px;
}

.bb-modal-header-main{
    min-width:0;
}

.bb-modal-header-badges{
    display:flex;
    gap:8px;
    flex-wrap:wrap;
}

.bb-modal-close{
    display:grid;
    place-items:center;
    width:42px;
    height:42px;
    margin:0;
    padding:0;
    border:0;
    border-radius:12px;
    background:rgba(255,255,255,.14);
    color:#fff;
}

.bb-workspace-scroll{
    min-height:0;
    padding:16px;
    overflow:auto;
    background:#f8fafc;
}

.bb-loading,
.bb-error,
.bb-empty{
    padding:26px;
    color:#64748b;
    text-align:center;
}

.bb-error{
    color:#b91c1c;
}

.bb-empty.large{
    display:flex;
    min-height:180px;
    flex-direction:column;
    align-items:center;
    justify-content:center;
    gap:8px;
    border:1px dashed #cbd5e1;
    border-radius:16px;
    background:#fff;
}

.bb-empty.large i{
    font-size:30px;
    color:#94a3b8;
}

.bb-empty.large strong{
    color:#334155;
    font-size:17px;
}

.bb-summary-grid{
    display:grid;
    grid-template-columns:repeat(4,minmax(0,1fr));
    gap:11px;
    margin-bottom:14px;
}

.bb-summary-card{
    min-width:0;
    padding:14px;
    border:1px solid #e2e8f0;
    border-top:4px solid #64748b;
    border-radius:15px;
    background:#fff;
}

.bb-summary-card.baseline{border-top-color:#7c3aed}
.bb-summary-card.current{border-top-color:#2563eb}
.bb-summary-card.change{border-top-color:#16a34a}
.bb-summary-card.negative{border-top-color:#dc2626}
.bb-summary-card.draft{border-top-color:#f59e0b}

.bb-summary-card span,
.bb-summary-card strong,
.bb-summary-card small{
    display:block;
}

.bb-summary-card span{
    color:#64748b;
    font-size:10px;
    font-weight:900;
    letter-spacing:.04em;
    text-transform:uppercase;
}

.bb-summary-card strong{
    margin-top:5px;
    color:#0f172a;
    font-size:20px;
    overflow-wrap:anywhere;
}

.bb-summary-card small{
    margin-top:4px;
    color:#64748b;
    font-size:10px;
    line-height:1.35;
}

.bb-workspace-grid{
    display:grid;
    grid-template-columns:300px minmax(0,1fr);
    gap:13px;
    align-items:start;
}

.bb-versions-panel,
.bb-version-detail{
    min-width:0;
    padding:14px;
    border:1px solid #e2e8f0;
    border-radius:17px;
    background:#fff;
}

.bb-versions-panel{
    position:sticky;
    top:0;
}

.bb-panel-heading{
    display:flex;
    align-items:flex-start;
    justify-content:space-between;
    gap:10px;
    margin-bottom:11px;
}

.bb-panel-heading h3,
.bb-version-title h3{
    margin:0;
    color:#0f172a;
}

.bb-panel-heading p,
.bb-version-title p{
    margin:4px 0 0;
    color:#64748b;
    font-size:11px;
    line-height:1.4;
}

.bb-panel-heading button{
    display:grid;
    place-items:center;
    width:38px;
    height:38px;
    margin:0;
    padding:0;
    border:0;
    border-radius:10px;
    background:#2563eb;
    color:#fff;
}

.bb-panel-heading button:disabled{
    background:#e2e8f0;
    color:#94a3b8;
}

.bb-version-list{
    display:grid;
    gap:8px;
}

.bb-version-card{
    display:grid;
    gap:5px;
    width:100%;
    margin:0;
    padding:12px;
    border:1px solid #e2e8f0;
    border-left:4px solid #94a3b8;
    border-radius:12px;
    background:#f8fafc;
    color:#0f172a;
    text-align:left;
}

.bb-version-card.draft{border-left-color:#f59e0b}
.bb-version-card.approved{border-left-color:#16a34a}
.bb-version-card.archived{border-left-color:#94a3b8;opacity:.86}
.bb-version-card.active{box-shadow:0 0 0 3px rgba(37,99,235,.13);border-color:#60a5fa}

.bb-version-card strong,
.bb-version-card small,
.bb-version-card span{
    display:block;
}

.bb-version-top{
    display:flex!important;
    align-items:center;
    justify-content:space-between;
    gap:8px;
}

.bb-version-top em{
    padding:4px 7px;
    border-radius:999px;
    background:#e2e8f0;
    color:#475569;
    font-size:9px;
    font-style:normal;
    font-weight:900;
}

.bb-version-total{
    color:#0f172a;
    font-size:17px;
    font-weight:900;
}

.bb-version-card small{
    color:#64748b;
    font-size:9px;
}

.bb-version-detail-header{
    display:flex;
    align-items:flex-start;
    justify-content:space-between;
    gap:14px;
    margin-bottom:11px;
}

.bb-version-title{
    min-width:0;
}

.bb-version-title small{
    display:block;
    margin-top:5px;
    color:#475569;
}

.bb-status{
    display:inline-flex;
    align-items:center;
    width:max-content;
    margin:0 5px 5px 0;
    padding:6px 9px;
    border-radius:999px;
    background:#e2e8f0;
    color:#475569;
    font-size:10px;
    font-weight:900;
}

.bb-status.draft{background:#fef3c7;color:#92400e}
.bb-status.approved{background:#dcfce7;color:#166534}
.bb-status.archived{background:#e2e8f0;color:#475569}
.bb-status.baseline{background:#ede9fe;color:#6d28d9}
.bb-status.closed{background:#fee2e2;color:#b91c1c}

.bb-version-actions{
    display:flex;
    justify-content:flex-end;
    gap:7px;
    flex-wrap:wrap;
}

.bb-version-actions button,
.bb-form-actions button,
.bb-compare-actions button{
    display:inline-flex;
    align-items:center;
    justify-content:center;
    gap:7px;
    min-height:40px;
    margin:0;
    padding:9px 11px;
    border:0;
    border-radius:10px;
    background:#2563eb;
    color:#fff;
    font-weight:900;
}

.bb-version-actions button.secondary,
.bb-form-actions button.secondary,
.bb-compare-actions button.secondary{
    background:#e2e8f0;
    color:#334155;
}

.bb-version-actions button.danger{
    background:#fee2e2;
    color:#b91c1c;
}

.bb-selected-metrics{
    display:grid;
    grid-template-columns:repeat(4,minmax(0,1fr));
    gap:8px;
    margin-bottom:12px;
}

.bb-selected-metrics span{
    display:grid;
    gap:3px;
    padding:9px;
    border-radius:10px;
    background:#f8fafc;
    color:#64748b;
    font-size:10px;
    font-weight:900;
    text-transform:uppercase;
}

.bb-selected-metrics strong{
    color:#0f172a;
    font-size:12px;
    text-transform:none;
    overflow-wrap:anywhere;
}

.bb-items-table-wrap{
    overflow:auto;
    border:1px solid #e2e8f0;
    border-radius:13px;
}

.bb-items-table{
    min-width:1000px;
    margin:0;
    border-radius:0;
    box-shadow:none;
}

.bb-items-table th,
.bb-items-table td{
    padding:11px 10px;
    white-space:normal;
    vertical-align:top;
}

.bb-items-table td strong,
.bb-items-table td small{
    display:block;
}

.bb-items-table td small{
    margin-top:3px;
    color:#64748b;
}

.bb-category{
    display:inline-flex;
    padding:5px 8px;
    border-radius:999px;
    background:#dbeafe;
    color:#1d4ed8;
    font-size:10px;
    font-weight:900;
}

.bb-money{
    font-weight:900;
    white-space:nowrap!important;
}

.bb-item-actions{
    display:flex;
    gap:6px;
}

.bb-item-actions button{
    display:grid;
    place-items:center;
    width:34px;
    height:34px;
    margin:0;
    padding:0;
    border:0;
    border-radius:9px;
    background:#2563eb;
    color:#fff;
}

.bb-item-actions button.danger{
    background:#dc2626;
}

.bb-readonly{
    color:#64748b;
    font-size:10px;
    font-weight:800;
}

.bb-items-mobile{
    display:none;
}

.bb-form-box{
    width:min(760px,94vw);
    max-height:92vh;
    padding:0;
    gap:0;
    overflow:hidden;
}

.bb-form-header{
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:12px;
    padding:16px 18px;
    background:#0f172a;
    color:#fff;
}

.bb-form-header h2{
    margin:0;
    color:#fff;
    font-size:19px;
}

.bb-form-header button{
    display:grid;
    place-items:center;
    width:38px;
    height:38px;
    margin:0;
    padding:0;
    border:0;
    border-radius:10px;
    background:rgba(255,255,255,.13);
    color:#fff;
}

.bb-form-scroll{
    display:grid;
    gap:12px;
    padding:16px;
    overflow:auto;
    background:#f8fafc;
}

.bb-form-grid{
    display:grid;
    grid-template-columns:repeat(2,minmax(0,1fr));
    gap:12px;
}

.bb-form-grid label{
    display:grid;
    gap:6px;
    min-width:0;
    margin:0;
    color:#475569;
    font-size:11px;
    font-weight:900;
}

.bb-form-grid label.full{
    grid-column:1/-1;
}

.bb-form-grid input,
.bb-form-grid select,
.bb-form-grid textarea{
    width:100%;
    min-width:0;
    box-sizing:border-box;
    padding:11px 12px;
    border:1px solid #cbd5e1;
    border-radius:11px;
    background:#fff;
}

.bb-form-grid textarea{
    min-height:86px;
    resize:vertical;
}

.bb-form-actions{
    display:flex;
    justify-content:flex-end;
    gap:9px;
    padding:13px 16px;
    border-top:1px solid #e2e8f0;
    background:#fff;
}

.bb-compare-box{
    width:min(980px,95vw);
    max-height:92vh;
    padding:0;
    gap:0;
    overflow:hidden;
}

.bb-compare-selectors{
    display:grid;
    grid-template-columns:1fr 1fr auto;
    gap:10px;
    align-items:end;
    padding:15px;
    background:#f8fafc;
}

.bb-compare-selectors label{
    display:grid;
    gap:6px;
    color:#475569;
    font-size:11px;
    font-weight:900;
}

.bb-compare-selectors select{
    width:100%;
    padding:11px;
    border:1px solid #cbd5e1;
    border-radius:11px;
    background:#fff;
}

.bb-compare-result{
    padding:15px;
    overflow:auto;
}

.bb-compare-total{
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:12px;
    margin-bottom:12px;
    padding:13px;
    border-radius:12px;
    background:#f8fafc;
}

.bb-compare-total strong{
    font-size:20px;
}

.bb-compare-table-wrap{
    overflow:auto;
}

#project-budget-version-summary{
    display:grid;
    grid-template-columns:repeat(4,minmax(0,1fr));
    gap:8px;
    margin-bottom:12px;
}

#project-budget-version-summary > div{
    display:grid;
    gap:3px;
    padding:10px;
    border:1px solid #e2e8f0;
    border-radius:11px;
    background:#f8fafc;
}

#project-budget-version-summary span{
    color:#64748b;
    font-size:10px;
    font-weight:900;
    text-transform:uppercase;
}

#project-budget-version-summary strong{
    color:#0f172a;
    font-size:14px;
}

#project-budget-version-summary small{
    color:#b45309;
    font-size:10px;
}

.positive{color:#166534!important}
.negative{color:#b91c1c!important}

@media(max-width:1100px){
    .bb-summary-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
    .bb-workspace-grid{grid-template-columns:1fr}
    .bb-versions-panel{position:static}
    .bb-version-list{grid-template-columns:repeat(2,minmax(0,1fr))}
}

@media(max-width:768px){
    #budget-baseline-workspace-modal,
    #budget-version-create-modal,
    #budget-version-edit-modal,
    #budget-version-item-modal,
    #budget-compare-modal{
        align-items:flex-end;
        padding:0;
    }

    .bb-modal-box,
    .bb-form-box,
    .bb-compare-box{
        width:100%;
        max-width:100vw;
        height:100dvh;
        max-height:100dvh;
        margin:0;
        border-radius:0;
    }

    .bb-summary-grid,
    .bb-version-list,
    .bb-selected-metrics,
    .bb-form-grid,
    .bb-compare-selectors,
    #project-budget-version-summary{
        grid-template-columns:1fr!important;
    }

    .bb-version-detail-header{
        flex-direction:column;
    }

    .bb-version-actions{
        display:grid;
        grid-template-columns:1fr 1fr;
        width:100%;
    }

    .bb-version-actions button{
        width:100%;
    }

    .bb-items-table-wrap{display:none}
    .bb-items-mobile{display:grid;gap:10px}

    .bb-item-card{
        display:grid;
        gap:10px;
        padding:13px;
        border:1px solid #e2e8f0;
        border-left:4px solid #2563eb;
        border-radius:14px;
        background:#fff;
    }

    .bb-item-card strong,
    .bb-item-card small{
        display:block;
    }

    .bb-item-card small{
        margin-top:4px;
        color:#64748b;
    }

    .bb-item-card > b{
        color:#0f172a;
        font-size:20px;
    }

    .bb-item-card dl{
        display:grid;
        grid-template-columns:1fr 1fr;
        gap:7px;
        margin:0;
    }

    .bb-item-card dl div{
        padding:8px;
        border-radius:9px;
        background:#f8fafc;
    }

    .bb-item-card dt{
        color:#64748b;
        font-size:9px;
        font-weight:900;
        text-transform:uppercase;
    }

    .bb-item-card dd{
        margin:3px 0 0;
        color:#0f172a;
        overflow-wrap:anywhere;
    }

    .bb-item-actions button{
        width:100%;
        height:42px;
    }

    .bb-form-actions,
    .bb-compare-actions{
        display:grid;
        grid-template-columns:1fr 1fr;
        padding-bottom:calc(12px + env(safe-area-inset-bottom));
    }
}
