.estimate-editor-wrapper {
    background-color: #ffffff;
    min-height: calc(100vh - 80px);
    display: flex;
    flex-direction: column;
    position: relative;
}

.estimate-top-bar {
    display: grid;
    grid-template-columns: auto 1fr auto; 
    align-items: center;
    padding: 8px 10px;
    border-bottom: 1px solid var(--border-color);
    background-color: #ffffff;
    position: sticky;
    top: 72px; 
    z-index: 90;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    gap: 10px;
}

.estimate-title-display {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-color);
    width: 100%;
    padding: 4px 8px;
    text-align: center;
    font-family: var(--font-family);
    cursor: pointer;
    border-radius: 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.estimate-title-display:active {
    background-color: #f3f4f6;
}

.estimate-title-display .edit-icon {
    font-size: 1rem;
    color: #9CA3AF;
    margin-left: 8px;
    vertical-align: middle;
}

.action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: auto;
    height: 48px;
    padding: 0 16px;
    background-color: transparent;
    border: none;
    cursor: pointer;
    font-size: 1.1rem;
    color: #2563EB;
    transition: all 0.2s;
    border-radius: 8px;
    gap: 8px;
}

.action-btn:hover {
    background-color: #EFF6FF;
}

.action-btn:active {
    opacity: 0.7;
}

.action-btn i {
    font-size: 1.5rem;
}

.btn-text {
    font-weight: 600;
    display: inline-block;
}

.estimate-table-container {
    flex: 1;
    overflow-y: auto;
    padding-bottom: 80px;
}

.estimate-sheet {
    width: 100%;
    border-collapse: collapse;
}

.sheet-header {
    background-color: #607D8B;
    color: #FFFFFF;
    position: sticky;
    top: 0;
    z-index: 80;
}

.sheet-header th {
    padding: 12px 4px;
    font-weight: 700;
    font-size: 0.75rem;
    text-transform: uppercase;
    border-right: 1px solid #B0BEC5;
    text-align: center;
}

.sheet-header th:last-child {
    border-right: none;
}

.sheet-row {
    background-color: #FFFFFF;
    border-bottom: 1px solid #B0BEC5;
}

.sheet-row:nth-child(odd) {
    background-color: #ECEFF1;
}

.sheet-cell {
    padding: 0;
    border-right: 1px solid #B0BEC5;
    height: 44px;
    font-size: 0.9rem;
    color: #000000;
    font-family: var(--font-family);
    vertical-align: middle;
}

.sheet-cell:last-child {
    border-right: none;
}

.clickable-cell {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    padding: 0 8px;
    cursor: pointer;
    min-height: 44px;
}

.clickable-cell:active {
    background-color: rgba(37, 99, 235, 0.1);
}

.text-center { justify-content: center; }
.text-right { justify-content: flex-end; font-weight: 600; }
.text-left { justify-content: flex-start; }

.col-name { width: 40%; }
.col-qty { width: 12%; }
.col-unit { width: 8%; }
.col-price { width: 15%; }
.col-total { width: 20%; }
.col-delete { width: 5%; }

.total-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: #f8fafc;
    border-top: 1px solid var(--border-color);
    padding: 16px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 -4px 10px rgba(0,0,0,0.05);
    z-index: 100;
    max-width: var(--max-width);
    margin: 0 auto;
}

.total-label {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-color);
}

.total-value {
    font-size: 1.5rem;
    font-weight: 800;
    color: #16A34A;
}

.delete-btn-cell {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    color: #9CA3AF;
    cursor: pointer;
    transition: color 0.2s;
}

.delete-btn-cell:hover {
    color: var(--error-color);
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    backdrop-filter: blur(2px);
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-container {
    background-color: #fff;
    width: 90%;
    max-width: 400px;
    border-radius: 20px;
    padding: 24px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
    transform: scale(0.9);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-overlay.active .modal-container {
    transform: scale(1);
}

.modal-input-wrapper {
    position: relative;
    margin-bottom: 24px;
    border: 2px solid #2563EB;
    border-radius: 12px;
    padding: 12px;
    background: #EFF6FF;
}

.modal-label {
    position: absolute;
    top: -10px;
    left: 12px;
    background-color: #fff;
    padding: 0 6px;
    font-size: 0.85rem;
    color: #2563EB;
    font-weight: 600;
    border-radius: 4px;
}

.modal-input {
    width: 100%;
    border: none;
    background: transparent;
    font-size: 1.1rem;
    color: #1F2937;
    outline: none;
    font-family: var(--font-family);
    padding: 4px 0;
}

.modal-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.modal-btn-save {
    background-color: #E5E7EB; 
    color: #9CA3AF; 
    border: none;
    padding: 14px;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: not-allowed; 
    transition: all 0.2s;
    pointer-events: none; 
}

.modal-btn-save.active {
    background-color: #2563EB;
    color: #ffffff;
    cursor: pointer;
    pointer-events: auto;
}

.modal-btn-cancel {
    background-color: transparent;
    border: none;
    color: #6B7280;
    font-size: 1rem;
    cursor: pointer;
    padding: 8px;
}

.unit-options {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.unit-option {
    padding: 10px;
    border: 1px solid #E5E7EB;
    border-radius: 8px;
    text-align: center;
    cursor: pointer;
    font-size: 0.9rem;
    color: #4B5563;
    transition: all 0.2s;
}

.unit-option.selected {
    background-color: #EFF6FF;
    border-color: #2563EB;
    color: #2563EB;
    font-weight: 600;
}

@media (max-width: 768px) {
    .estimate-top-bar {
        top: 60px;
        grid-template-columns: 48px 1fr 48px;
    }
    
    .btn-text {
        display: none;
    }

    .action-btn {
        width: 48px;
        padding: 0;
        border-radius: 50%;
    }

    .action-btn:hover {
        background-color: transparent;
    }

    .col-unit { display: none; }
    .col-name { width: 35%; }
    .col-qty { width: 15%; }
    .col-price { width: 20%; }
    .col-total { width: 25%; }
    
    .sheet-cell {
        font-size: 0.8rem;
    }
}