/* --- BRANDING COLORS --- */
:root {
    --brand-primary: #224C5A; /* Deep Teal */
    --brand-accent: #F08A04;  /* Orange */
    --brand-bg: #f4f6f9;
}

/* FIXED LAYOUT SETUP */
html, body { 
    height: 100%; 
    margin: 0; 
    overflow: hidden; 
    background-color: var(--brand-bg); 
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; 
}

#app {
    height: 100%;
    display: flex;
    flex-direction: column;
    padding: 15px;
}

/* --- SECTIONS --- */
.header-section { flex-shrink: 0; margin-bottom: 10px; }
.toolbar-section { flex-shrink: 0; margin-bottom: 10px; }

/* SCROLLABLE TABLE CONTAINER */
.table-wrapper {
    flex-grow: 1;
    overflow-y: auto;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    position: relative;
    padding: 0 15px 15px 15px;
}

/* STICKY TABLE HEADER */
thead th {
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

/* UTILS */
.text-brand { color: var(--brand-primary) !important; }
.text-accent { color: var(--brand-accent) !important; }
.bg-brand { background-color: var(--brand-primary) !important; color: white; }

.btn-primary { background-color: var(--brand-primary); border-color: var(--brand-primary); }
.btn-primary:hover { background-color: #1a3a45; border-color: #1a3a45; }
.btn-outline-primary { color: var(--brand-primary); border-color: var(--brand-primary); }
.btn-outline-primary:hover { background-color: var(--brand-primary); color: white; }
.btn-brand-accent { background-color: var(--brand-accent); color: white; border: none; }
.btn-brand-accent:hover { background-color: #d97b00; color: white; }

.login-card { max-width: 400px; margin: 80px auto; border: none; box-shadow: 0 8px 24px rgba(0,0,0,0.1); border-top: 5px solid var(--brand-accent); }

.table-brand th { background-color: var(--brand-primary) !important; color: white; border-color: #355d6b; }

.input-mini { width: 70px; padding: 4px; text-align: center; border: 1px solid #dee2e6; border-radius: 4px; font-size: 0.9rem; }
.input-mini:focus { border-color: var(--brand-accent); outline: none; }

/* VALIDATION STYLES / DATE INPUTS */
.input-date-d { width: 38px; padding: 2px 0; text-align: center; border: 1px solid #dee2e6; border-radius: 3px; font-size: 0.85rem; }
.input-date-y { width: 48px; padding: 2px 0; text-align: center; border: 1px solid #dee2e6; border-radius: 3px; font-size: 0.85rem; }

.textarea-remarks {
    width: 100%; min-width: 200px; min-height: 38px;
    font-size: 0.85rem; resize: vertical; overflow: hidden; line-height: 1.2;
}

.frozen { background-color: #f0fff4 !important; }
.frozen input { border: none; background: transparent; pointer-events: none; color: var(--brand-primary); font-weight: 600; }
.frozen .textarea-remarks { border: none; background: transparent; color: var(--brand-primary); font-weight: 600; pointer-events: auto; }

.duplicate-row, .invalid-row { background-color: #ffe6e6 !important; border-left: 5px solid #dc3545; }
.duplicate-row input, .invalid-row input { background-color: rgba(255,255,255,0.5); }

/* ERROR & LOADING STATES */
.update-failed { border-left: 5px solid #dc3545 !important; background-color: #fff5f5 !important; }
.row-saving { background-color: rgba(34, 76, 90, 0.05); }
.error-icon { cursor: help; font-size: 0.8rem; margin-right: 4px; }

.total-cell { font-weight: bold; background-color: #e9ecef; width: 60px; text-align: right; padding-right: 8px; border-left: 2px solid #dee2e6; color: var(--brand-primary); }
.company-logo { max-height: 50px; margin-right: 15px; }

.sortable-header { cursor: pointer; user-select: none; transition: background 0.2s; }
.sortable-header:hover { background-color: var(--brand-accent) !important; }
.header-tooltip { cursor: help; text-decoration: underline dotted; }

.rates-legend-compact { 
    font-size: 0.7rem; background: white; border: 1px solid #dee2e6; border-left: 3px solid var(--brand-accent);
    border-radius: 4px; padding: 4px 8px; height: 100%; overflow-y: auto; max-height: 85px; 
}
.legend-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 2px 10px; }
.rate-item-compact { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rate-code { font-weight: bold; color: var(--brand-accent); margin-right: 3px; }

.project-info { font-size: 0.85rem; color: #555; background-color: #f8f9fa; padding: 10px; border-radius: 6px; border-left: 4px solid var(--brand-primary); }
.project-label { font-weight: bold; color: var(--brand-primary); margin-right: 5px; white-space: nowrap;}

.header-input {
    border: 1px solid #ced4da; background-color: white; padding: 1px 5px; border-radius: 3px; 
    font-size: 0.85rem; color: #333; width: 140px; margin-right: 10px;
}
.header-input:focus { outline: 2px solid var(--brand-accent); border-color: var(--brand-accent); }
.header-input:disabled { background: transparent; border: none; font-weight: bold; color: #333; padding-left: 0;}

.transfer-input {
    border: 1px solid #ced4da; background-color: white; padding: 5px 10px; border-radius: 4px; 
    font-size: 0.9rem; color: #333; width: 100%; max-width: 400px;
}

tfoot { border-top: 2px solid var(--brand-primary); font-weight: bold; background-color: #f8f9fa; color: var(--brand-primary); }
.list-enter-active, .list-leave-active { transition: all 0.5s ease; }
.list-enter-from, .list-leave-to { opacity: 0; transform: translateX(30px); }

.custom-modal-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.5); z-index: 1000;
    display: flex; justify-content: center; align-items: center;
}
.custom-modal {
    background: white; padding: 25px; border-radius: 8px; width: 400px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
    border-top: 5px solid var(--brand-accent);
}

.btn-mini-delete {
    padding: 0 5px; font-size: 0.7rem; color: #dc3545; background: none; border: 1px solid #dc3545; border-radius: 4px;
}
.btn-mini-delete:hover { background: #dc3545; color: white; }

.btn-action { width: 26px; height: 26px; padding: 0; font-size: 0.8rem; display: inline-flex; align-items: center; justify-content: center; }

/* IDLE WARNING BANNER */
.idle-banner {
    position: fixed; top: 0; left: 0; width: 100%;
    background-color: #ffc107; color: #000;
    text-align: center; padding: 8px; z-index: 2000;
    font-weight: bold; font-size: 0.9rem;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
}

.link-text { cursor: pointer; color: var(--brand-primary); text-decoration: underline; font-size: 0.9rem; }
.link-text:hover { color: var(--brand-accent); }

/* TOAST NOTIFICATIONS */
.toast-container { position: fixed; bottom: 20px; right: 20px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; max-width: 380px; pointer-events: none; }
.toast-item { padding: 10px 16px; border-radius: 6px; color: white; font-size: 0.88rem; box-shadow: 0 4px 12px rgba(0,0,0,0.25); display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; pointer-events: all; animation: slideIn 0.2s ease; }
@keyframes slideIn { from { opacity: 0; transform: translateX(30px); } to { opacity: 1; transform: translateX(0); } }
.toast-info { background-color: var(--brand-primary); }
.toast-success { background-color: #198754; }
.toast-warning { background-color: #b45309; }
.toast-error { background-color: #dc3545; }
.toast-close { background: none; border: none; color: inherit; cursor: pointer; font-size: 1rem; opacity: 0.8; padding: 0; line-height: 1; flex-shrink: 0; }
.toast-close:hover { opacity: 1; }

/* --- RESPONSIVE MOBILE STYLES --- */
@media (max-width: 991px) {
    html, body { 
        height: auto; 
        overflow: auto; 
    }
    #app {
        height: auto;
        padding: 10px;
    }
    .table-wrapper {
        height: auto;
        box-shadow: none;
        background: transparent;
        padding: 0;
        overflow-y: visible;
    }
    .project-info {
        border-left: none;
        border-top: 4px solid var(--brand-primary);
    }
    .transfer-input {
        max-width: 100%;
    }
}

/* Mobile Card Design */
.mobile-card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    margin-bottom: 12px;
    border: 1px solid #dee2e6;
    overflow: hidden;
    border-left: 5px solid var(--brand-primary);
    transition: all 0.2s ease;
}

.mobile-card.frozen {
    border-left-color: #198754 !important;
    background-color: #f0fff4 !important;
}

.mobile-card.frozen .mobile-rate-input {
    border: none;
    background: transparent;
    pointer-events: none;
    color: var(--brand-primary);
    font-weight: 600;
}

.mobile-card.duplicate-row, .mobile-card.invalid-row {
    border-left-color: #dc3545 !important;
    background-color: #ffe6e6 !important;
}

.mobile-card.update-failed {
    border-left-color: #dc3545 !important;
    background-color: #fff5f5 !important;
}

.mobile-card-header {
    padding: 12px 16px;
    background-color: transparent;
    cursor: pointer;
    user-select: none;
}

.mobile-card-body {
    padding: 16px;
    background-color: transparent;
    border-top: 1px solid #f1f3f5;
}

.mobile-rate-item {
    display: flex;
    flex-direction: column;
    background-color: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    padding: 6px;
}

.mobile-rate-label {
    font-size: 0.7rem;
    font-weight: bold;
    color: #6c757d;
    margin-bottom: 4px;
    text-transform: uppercase;
}

.mobile-rate-input {
    width: 100%;
    padding: 4px;
    text-align: center;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 0.95rem;
    font-weight: bold;
}

.mobile-rate-input:focus {
    border-color: var(--brand-accent);
    outline: none;
}
