:root {
    --color-baseline: #000000;
    --color-revised: #004799;
    --color-actual: #04a7dd;
    --color-pos-variance: #28a745;
    --color-neg-variance: #dc3545;
    --color-projected: #ffa500;
    --color-predicted: #8b0000;
    --color-blue: #1cb7ff;
}

/* Global Styles (formerly in base.html) */
body {
    font-family: 'Inter', sans-serif;
    background-color: #f4f7f9;
    font-size: 0.8rem;
    padding-bottom: 0;
    /* Removed bottom padding since we use flex layout */
    overflow-x: hidden;
}

#app-wrapper {
    display: flex;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
}

#sidebar-wrapper {
    width: 240px;
    background-color: #fff;
    border-right: 1px solid #e2e8f0;
    flex-shrink: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1030;
    display: flex;
    flex-direction: column;
}

#sidebar-wrapper.collapsed {
    width: 0;
    border-right: none;
    overflow: hidden;
}

/* Prevent transition on load */
[data-sidebar-collapsed="true"] #sidebar-wrapper {
    width: 0 !important;
    border-right: none !important;
    transition: none !important;
}

[data-sidebar-collapsed="true"] #sidebar-wrapper>* {
    opacity: 0 !important;
    transition: none !important;
}

#sidebar-wrapper.collapsed * {
    opacity: 0;
    pointer-events: none;
}

#sidebar-wrapper>* {
    transition: opacity 0.2s ease;
    min-width: 240px;
    /* Prevent content squishing during transition */
}

#main-content-wrapper {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    height: 100%;
    overflow-y: auto;
    background-color: #f4f7f9;
    padding-left: 0.75rem;
    /* Added gap between sidebar and content */
}

.navbar {
    z-index: 1020;
    background-color: #fff !important;
    border-bottom: 1px solid #e2e8f0 !important;
    padding: 0.5rem 1rem !important;
}

.navbar {
    box-shadow: 0 2px 4px rgba(0, 0, 0, .05);
    background-color: #fff !important;
    font-size: 1rem;
    transition: padding 0.2s ease-in-out, font-size 0.2s ease-in-out;
    border-bottom: 2px solid #000000 !important;
    backface-visibility: hidden;
    -webkit-font-smoothing: antialiased;
    will-change: padding, font-size;
}

.navbar-shrunk {
    padding-top: 0.15rem !important;
    padding-bottom: 0.15rem !important;
    font-size: 0.75rem !important;
    min-height: auto;
}

.navbar-shrunk .navbar-brand {
    font-size: 0.9rem !important;
}

.navbar-shrunk .nav-link {
    padding-top: 0.25rem !important;
    padding-bottom: 0.25rem !important;
}

.navbar-shrunk .btn-sm {
    padding: 0.1rem 0.4rem !important;
    font-size: 0.7rem !important;
}

.card {
    border: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, .05);
    margin-bottom: 20px;
    border-radius: 12px;
}

.card-header {
    background-color: #fff;
    border-bottom: 1px solid #edf2f7;
    font-weight: 600;
    padding: 1.25rem 1.5rem;
}

.btn-primary {
    background-color: #004799d3;
    border-color: #004799d3;
}

.btn-primary:hover {
    background-color: #003a7dbe;
    border-color: #003a7dbe;
}

.nav-tabs .nav-link {
    color: #64748b;
    border: none;
    border-bottom: 2px solid transparent;
    padding: 1rem 1.5rem;
    font-weight: 500;
}

.nav-tabs .nav-link.active {
    color: #004799d3;
    border-bottom: 2px solid #004799d3;
    background: none;
}

/* Global Theme Overrides */
.text-primary {
    color: #004799d3 !important;
}

.bg-primary {
    background-color: #004799d3 !important;
}

.border-primary {
    border-color: #004799d3 !important;
}

.btn-outline-primary {
    color: #004799d3;
    border-color: #004799d3;
}

.btn-outline-primary:hover {
    background-color: #004799d3;
    border-color: #004799d3;
    color: #fff;
}

.table th {
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 0.05em;
    background-color: #f8fafc;
    padding: 0.5rem;
}

.table td {
    padding: 0.5rem;
    vertical-align: middle;
}

.table .btn {
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
}

.display-4 {
    font-weight: 700;
    color: #1e293b;
}

.text-muted {
    color: #94a3b8 !important;
}

.hover-primary:hover {
    color: #004799d3 !important;
}

/* Centralized Theme Utility Classes */
.text-baseline {
    color: var(--color-baseline) !important;
}

.bg-baseline {
    background-color: var(--color-baseline) !important;
}

.text-revised {
    color: var(--color-revised) !important;
}

.bg-revised {
    background-color: var(--color-revised) !important;
}

.text-actual {
    color: var(--color-actual) !important;
}

.bg-actual {
    background-color: var(--color-actual) !important;
}

.text-pos-variance {
    color: var(--color-pos-variance) !important;
}

.text-neg-variance {
    color: var(--color-neg-variance) !important;
}

.bg-pos-variance {
    background-color: var(--color-pos-variance) !important;
}

.bg-neg-variance {
    background-color: var(--color-neg-variance) !important;
}

.text-projected {
    color: var(--color-projected) !important;
}

.bg-projected {
    background-color: var(--color-projected) !important;
}

.text-predicted {
    color: var(--color-predicted) !important;
}

.bg-predicted {
    background-color: var(--color-predicted) !important;
}

/* Dashboard Styles (formerly in dashboard.html) */
.table-hover tbody tr {
    border-bottom: 2px solid #cbd5e1 !important;
}

.table-hover tbody tr:last-child {
    border-bottom: none !important;
}

/* Project Detail Styles (formerly in project_detail.html) */
.project-detail-tabs .nav-link {
    background-color: #e9ecef;
    color: #495057;
    margin-right: 2px;
    border: 1px solid #dee2e6;
    border-bottom: none;
}

.project-detail-tabs .nav-link.active {
    background-color: #fff !important;
    color: #004799d3;
    border-color: #dee2e6 #dee2e6 #fff;
    font-weight: 600;
}

.project-detail-tabs .nav-link:hover:not(.active) {
    background-color: #dee2e6;
}

/* Bulk Timesheet Styles (formerly in bulk_timesheet.html) */
#timesheetGrid .hour-input::-webkit-inner-spin-button,
#timesheetGrid .hour-input::-webkit-outer-spin-button {
    -webkit-appearance: none;
    appearance: none;
    margin: 0;
}

#timesheetGrid .hour-input {
    -webkit-appearance: none;
    -moz-appearance: textfield;
    appearance: none;
    border: none;
    background: transparent;
    width: 100%;
    height: 100%;
    padding: 0.4rem 0.1rem;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.2s;
}

#timesheetGrid .hour-input:focus {
    background: #f0f7ff;
    box-shadow: inset 0 0 0 2px #2563eb;
    outline: none;
    border-radius: 4px;
    background: #ededed;
}

#timesheetGrid .hour-input::placeholder {
    color: #e2e8f0;
}

#timesheetGrid td {
    padding: 0;
    height: 32px;
    vertical-align: middle;
}

#timesheetGrid thead tr th {
    background-color: #f1f5f9;
    color: #1e293b;
    padding: 0.5rem 0.25rem;
    font-size: 0.8rem;
    border-bottom: 2px solid #cbd5e1 !important;
}

.daily-total-cell {
    font-size: 0.85rem;
    color: #475569;
}

.table-responsive {
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
}

#timesheetGrid tbody tr {
    transition: background 0.15s;
}

#timesheetGrid tbody tr:hover {
    background-color: rgba(37, 99, 235, 0.05);
}

#timesheetGrid tbody tr.is-saturday,
#timesheetGrid tbody tr.is-saturday td {
    background-color: #ededed !important;
}

#timesheetGrid tbody tr.is-sunday,
#timesheetGrid tbody tr.is-sunday td {
    background-color: #d0d0d0 !important;
}

#timesheetGrid tbody tr.weekly-total-row td {
    background-color: #334155 !important;
    color: #f1f5f9 !important;
    border-top: 2px solid #1e293b !important;
    padding: 0.25rem 0.5rem;
    cursor: default;
}

/* Cash Flow Styles (formerly in project_cash_flow.html) */
.sticky-col {
    position: sticky;
    left: 0;
    background-color: #f8fafc !important;
    z-index: 15;
    border-right: 2px solid #dee2e6 !important;
}

#cashFlowTable thead th {
    vertical-align: middle;
    background-color: #f8fafc;
}

.variance-red {
    background-color: #fff5f5;
    color: #e53e3e;
    font-weight: 600;
}

.table-sm th,
.table-sm td {
    padding: 0.4rem 0.6rem;
    font-size: 0.72rem;
}

/* Sidebar & Project Layout Styles */
:root {
    --sidebar-width: 190px;
    --sidebar-bg: #f8f9fa;
    --sidebar-active-bg: #e9ecef;
    --sidebar-active-color: #0d6efd;
}

.project-container {
    display: flex;
    width: 100%;
}

.project-sidebar {
    width: 100%;
    background-color: #fff;
    flex-shrink: 0;
    padding-top: 0;
}

.project-content {
    flex-grow: 1;
    padding: 1.5rem 1rem 1.5rem 0.5rem;
    min-width: 0;
}

@media (min-width: 1400px) {
    .project-content {
        padding-right: 0.5rem;
        padding-left: 0.75rem;
    }
}

.sidebar-link {
    display: flex;
    align-items: center;
    padding: 0.35rem 0.75rem;
    color: #495057;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.85rem;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}

.sidebar-link:hover {
    background-color: var(--sidebar-active-bg);
    color: var(--sidebar-active-color);
}

.sidebar-link.active {
    background-color: #fff;
    color: var(--sidebar-active-color);
    border-left-color: var(--sidebar-active-color);
    font-weight: 600;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.02);
}

.sidebar-link i {
    margin-right: 12px;
    font-size: 1.1rem;
    width: 20px;
    text-align: center;
}

.sidebar-header {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.05rem;
    color: var(--color-revised);
    padding: 0.8rem 0.75rem 0.3rem 0.75rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    user-select: none;
    font-weight: 700;
    opacity: 0.85;
}

.sidebar-header:hover {
    opacity: 1;
    color: var(--color-revised);
}

.sidebar-header i.chevron {
    transition: transform 0.3s ease;
    font-size: 0.7rem;
    margin-right: 0;
}

.sidebar-header[aria-expanded="true"] i.chevron {
    transform: rotate(180deg);
}

.nav-section {
    border-bottom: 2px solid #000000;
    padding-bottom: 0.4rem;
    margin-bottom: 0.5rem;
}

.project-topbar {
    display: none;
    background: white;
    border-bottom: 1px solid #dee2e6;
    padding: 0.75rem 1rem;
    position: sticky;
    top: 0;
    z-index: 1010;
}

@media (max-width: 991.98px) {
    .project-sidebar {
        display: none;
    }

    .project-container {
        flex-direction: column;
        margin-top: 0;
    }

    .project-topbar {
        display: flex;
        align-items: center;
        justify-content: space-between;
    }

    .project-content {
        padding: 1rem;
    }
}

/* Project Selection Banner Title */
.project-banner-title {
    color: #038be6;
    font-size: 1.2rem;
    /* <--- Font size is specified here */
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 700;
    transition: color 0.2s ease;
}

.project-banner-title:hover {
    color: #026fb8;
}

/* --- Premium Toast Notifications --- */
.toast-container {
    z-index: 2000;
}

.toast-premium {
    backdrop-filter: blur(12px) saturate(180%);
    -webkit-backdrop-filter: blur(12px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 0.75rem;
    color: white;
    box-shadow: 0 10px 30px -5px rgba(0, 0, 0, 0.3);
}

.toast-premium.bg-success {
    background-color: rgba(16, 185, 129, 0.6) !important;
}

.toast-premium.bg-danger {
    background-color: rgba(239, 68, 68, 0.6) !important;
}

.toast-premium.bg-warning {
    background-color: rgba(245, 158, 11, 0.6) !important;
    color: #ffffff;
}

.toast-premium.bg-primary {
    background-color: rgba(37, 99, 235, 0.6) !important;
}

.toast-premium .btn-close-white {
    filter: brightness(0) invert(1);
}

.toast-body {
    padding: 1rem;
    font-weight: 500;
    letter-spacing: 0.01em;
}

@keyframes toastFadeIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

.toast.show {
    animation: toastFadeIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}