
        .breadcrumb { font-size: 0.9rem; color: #64748b; margin-bottom: 0.5rem; cursor: pointer; display: flex; align-items: center; gap: 0.5rem; }
        .breadcrumb:hover { color: var(--accent); }

        /* GRID */
        .project-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1.5rem; }
        .project-card { background: var(--surface); border: 1px solid var(--border); border-radius: 0.75rem; padding: 1.5rem; transition: transform 0.2s; display: flex; flex-direction: column; gap: 1rem; position: relative; }
        .project-card:hover { transform: translateY(-3px); box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1); border-color: var(--accent); }
        .project-card.active { border: 2px solid var(--accent); background: #f0f9ff; }
        .card-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 0.5rem; padding-right: 4rem; }
        .status-badge { background: #dcfce7; color: #166534; font-size: 0.7rem; font-weight: 700; padding: 0.25rem 0.5rem; border-radius: 99px; text-transform: uppercase; }
        .project-title { font-size: 1.1rem; font-weight: 700; color: var(--primary); margin: 0 0 0.25rem 0; }
        .project-meta { font-size: 0.85rem; color: var(--text-light); margin: 0; display: flex; flex-direction: column; gap: 0.2rem; }
        .card-stats { margin-top: auto; padding-top: 1rem; border-top: 1px solid var(--border); font-size: 0.85rem; color: #64748b; display: flex; justify-content: space-between; }
        .actions { display: flex; gap: 0.5rem; margin-top: 1rem; }
        .btn-card { flex: 1; padding: 0.5rem; border: 1px solid var(--border); background: var(--surface); border-radius: 0.375rem; font-size: 0.85rem; font-weight: 600; color: var(--text); cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 0.4rem; }
        .btn-card:hover { background: var(--accent); color: white; border-color: var(--accent); }
        .btn-primary-card { background: var(--primary); color: var(--bg); border: none; }
        .btn-primary-card:hover { background: var(--accent); color: white; }

        /* ICONS */
        .icon-actions { position: absolute; top: 1rem; right: 1rem; display: flex; gap: 0.25rem; }
        .btn-icon { background: transparent; border: none; cursor: pointer; color: #94a3b8; padding: 4px; border-radius: 4px; }
        .btn-icon:hover { background: #f1f5f9; color: var(--accent); }
        .btn-icon.delete:hover { color: var(--danger); }

        /* DETAILS */
        #projectDetail { display: none; }
        .detail-header { background: var(--surface); padding: 1.5rem; border-radius: 0.75rem; border: 1px solid var(--border); margin-bottom: 1.5rem; position: relative; }
        .calc-list { display: flex; flex-direction: column; gap: 1rem; overflow-y: auto; max-height: 60vh; padding-bottom: 2rem; }
        .calc-item { background: var(--surface); border: 1px solid var(--border); border-radius: 0.5rem; padding: 1rem; display: flex; justify-content: space-between; align-items: center; }
        .calc-res { font-family: monospace; font-weight: 600; color: var(--accent); background: #eff6ff; padding: 0.25rem 0.5rem; border-radius: 4px; font-size: 0.85rem; }
        
        .calc-actions { display: flex; gap: 0.5rem; align-items: center; }
        .btn-calc-action { padding: 0.4rem 0.6rem; font-size: 0.75rem; border: 1px solid var(--border); border-radius: 4px; background: var(--surface); cursor: pointer; color: var(--text-light); display: flex; align-items: center; gap: 0.3rem; font-weight: 600; text-decoration: none;}        
        .btn-calc-action:hover { background: #f1f5f9; color: var(--accent); border-color: var(--accent); }
        .btn-calc-action.delete:hover { color: var(--danger); border-color: var(--danger); background: #fef2f2; }

        /* MODAL */   
        .form-group { margin-bottom: 1rem; }
        .form-group label { display: block; margin-bottom: 0.4rem; font-weight: 500; font-size: 0.85rem; color: #64748b; }
        .form-group input, .form-group select { width: 100%; padding: 0.6rem; border: 1px solid var(--border); border-radius: 0.375rem; font-size: 0.95rem; box-sizing: border-box; background: var(--surface); color: var(--text); }
        .modal-actions { display: flex; justify-content: flex-end; gap: 0.5rem; margin-top: 1.5rem; }
        .btn-cancel { background: var(--surface); border: 1px solid var(--border); color: var(--text); padding: 0.6rem 1rem; border-radius: 0.375rem; cursor: pointer; font-weight: 500; }
        
        /* SEARCH BAR */
        .search-container { position: relative; width: 100%; max-width: 300px; margin-top: 0.5rem; }
        .search-input { width: 100%; padding: 0.6rem 0.6rem 0.6rem 2.2rem; border: 1px solid var(--border); border-radius: 0.5rem; font-size: 0.9rem; background: var(--surface); color: var(--text); }
        .search-icon { position: absolute; right: 0.7rem; top: 35%; transform: translateY(-50%); width: 16px; height: 16px; color: #94a3b8; }

        /* FILTER BUTTONS */
        .filter-group { display: flex; gap: 0.5rem; margin-top: 1rem; overflow-x: auto; padding-bottom: 0.5rem; }
        .filter-btn { padding: 0.4rem 1rem; border: 1px solid var(--border); background: var(--surface); color: var(--text-light); border-radius: 99px; font-size: 0.85rem; cursor: pointer; font-weight: 500; white-space: nowrap; transition: all 0.2s; }
        .filter-btn:hover { border-color: var(--accent); color: var(--accent); }
        .filter-btn.active { background: var(--accent); color: white; border-color: var(--accent); }
        
        [data-theme="dark"] .filter-btn { background: #0f172a; border-color: #334155; }
        [data-theme="dark"] .filter-btn.active { background: var(--accent); border-color: var(--accent); color: white; }
        

        /* BOQ SUMMARY */
        .boq-summary-bar { display: flex; gap: 4px; height: 8px; width: 100%; border-radius: 4px; overflow: hidden; margin-top: 0.5rem; background: #f1f5f9; }
        .boq-legend { display: flex; gap: 1rem; margin-top: 0.5rem; font-size: 0.75rem; color: var(--text-light); }
        .legend-item { display: flex; align-items: center; gap: 0.3rem; }
        .legend-dot { width: 8px; height: 8px; border-radius: 50%; }

        /* --- BOQ SPECIFIC STYLES --- */
        .boq-table { width: 100%; border-collapse: collapse; text-align: left; }
        .boq-table th, .boq-table td { padding: 0.75rem; border-bottom: 1px solid var(--border); }
        .boq-table th { color: var(--text-light); font-size: 0.85rem; text-transform: uppercase; background: #f8fafc; }
        .boq-table input { padding: 0.4rem; font-size: 0.85rem; border-radius: 4px; border: 1px solid transparent; background: transparent; width: 100%; box-sizing: border-box; }
        .boq-table input:hover, .boq-table input:focus { border-color: var(--accent); background: var(--surface); outline: none; }
        .boq-row-auto { border-left: 3px solid var(--success); }
        .boq-row-manual { border-left: 3px solid var(--warning); }
        .btn-close-modal { position: absolute; top: 1rem; right: 1rem; border: none; background: none; font-size: 1.5rem; cursor: pointer; color: var(--text-light); width: auto; margin:0; padding:0; }
        .btn-close-modal:hover { color: var(--danger); }
        
        [data-theme="dark"] .boq-table input { color: var(--text); }
        [data-theme="dark"] .boq-table th { background: #0f172a; border-color: var(--border); }

/* --- NEW: Shift Divider Class --- */
.calc-shift-divider {
    display: flex;
    align-items: center;
    gap: 8px;
    border-right: 1px solid var(--border);
    padding-right: 12px;
    margin-right: 12px;
}

/* Prevents the "Shift to:" text from wrapping to a second line */
.calc-shift-divider small {
    white-space: nowrap;
    flex-shrink: 0; 
}

/* --- Responsive Modal Layouts --- */
.modal-split-layout {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 1.5rem;
    margin-top: 1rem;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.form-row input, .form-row select {
    width: 100%;
    padding: 0.5rem;
    border-radius: 4px;
    border: 1px solid var(--border);
    box-sizing: border-box;
    font-size: 0.9rem;
}

.table-responsive-wrapper {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.5rem;
    max-height: 400px;
    overflow-y: auto;
    overflow-x: auto; /* Crucial for mobile tables */
}

.custom-levels-table th, .custom-levels-table td {
    white-space: nowrap; /* Prevents text from wrapping and squashing */
}

/* --- Modal Scroll Fix --- */
.modal {
    max-height: 90vh; /* Keeps the modal within the screen height */
    overflow-y: auto; /* Enables internal scrolling */
}

/* --- Table Alignment & Cramming Fixes --- */
.custom-levels-table th, .custom-levels-table td {
    vertical-align: top; /* Keeps rows perfectly aligned even with multi-line text */
    padding: 0.75rem 0.5rem; /* Slightly more breathing room */
}

/* --- NEW: Mobile Responsiveness for Calc List --- */
@media (max-width: 768px) {
    .calc-item {
        flex-direction: column;
        align-items: stretch; /* Makes children take full width */
        gap: 1rem;
    }
    
    .calc-info h4 {
        flex-wrap: wrap; /* Allows the PASS/FAIL badges to wrap if the title is long */
        gap: 0.5rem;
    }
    
    .calc-actions {
        width: 100%;
        flex-wrap: wrap; /* Allows buttons to wrap to the next line */
        justify-content: space-between;
    }
    
    .calc-shift-divider {
        width: 100%;
        border-right: none; /* Remove vertical divider on mobile */
        border-bottom: 1px solid var(--border); /* Add horizontal divider instead */
        padding-right: 0;
        margin-right: 0;
        padding-bottom: 0.75rem;
        margin-bottom: 0.25rem;
        justify-content: space-between; /* Pushes label and select to opposite ends */
    }
    
    .btn-calc-action {
        flex: 1 1 calc(33.333% - 0.5rem); /* Makes the 3 buttons sit side-by-side evenly */
        justify-content: center; /* Centers the icon and text */
        padding: 0.6rem 0.4rem; /* Slightly larger tap target for mobile */
    }

         .modal-split-layout {
        grid-template-columns: 1fr; /* Stacks the input form ABOVE the table */
    }

    .form-row {
        grid-template-columns: 1fr; /* Stacks input boxes vertically */
        }
        .custom-levels-table th, .custom-levels-table td {
        white-space: normal; 
    }
}
