@keyframes spin {
    to { transform: rotate(360deg); }
}

:root {
    --primary: #4f46e5;
    /* Indigo */
    --primary-light: #e0e7ff;
    --primary-dark: #3730a3;
    --secondary: #10b981;
    /* Emerald/Sage */
    --secondary-light: #d1fae5;
    --accent: #f59e0b;
    /* Amber */

    --bg-color: #f8fafc;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --white: #ffffff;
    --sidebar-bg: #ffffff;

    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(255, 255, 255, 0.5);

    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
    --shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, 0.08);

    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
}
/* Hide Number Spinners */
input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    appearance: none;
    margin: 0;
}
input[type=number] {
    -moz-appearance: textfield;
    appearance: textfield;
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    overflow-x: hidden;
}

/* BACKGROUND DECORATION */
.background-shapes {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    overflow: hidden;
    background: linear-gradient(135deg, #f8fafc 0%, #eff6ff 100%);
}

.shape {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.4;
}

.shape-1 {
    top: -10%;
    right: -10%;
    width: 40vw;
    height: 40vw;
    background: #e0e7ff;
}

.shape-2 {
    bottom: -10%;
    left: 5%;
    width: 35vw;
    height: 35vw;
    background: #d1fae5;
}

/* SIDEBAR */
.sidebar {
    width: 280px;
    height: 100vh;
    background: var(--sidebar-bg);
    border-right: 1px solid #e2e8f0;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    z-index: 100;
}

.sidebar-header {
    padding: 2rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.logo-box {
    width: 45px;
    height: 45px;
    background: var(--primary);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.5rem;
    box-shadow: 0 8px 16px rgba(79, 70, 229, 0.3);
}

.brand-text h1 {
    font-family: 'Outfit', sans-serif;
    font-size: 1.25rem;
    color: var(--text-main);
    letter-spacing: -0.01em;
}

.brand-text p {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.sidebar-nav {
    flex: 1;
    padding: 1rem;
    overflow-y: auto;
}

.nav-group {
    margin-bottom: 2rem;
}

.nav-label {
    display: block;
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    padding: 0 1rem;
    margin-bottom: 0.75rem;
    letter-spacing: 0.05em;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.85rem 1rem;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
    border-radius: 12px;
    transition: var(--transition);
    margin-bottom: 0.25rem;
}

.nav-link i {
    width: 20px;
    font-size: 1.1rem;
    text-align: center;
}

.nav-link:hover {
    background: var(--bg-color);
    color: var(--primary);
}

.nav-link.active {
    background: var(--primary-light);
    color: var(--primary);
}

/* MAIN CONTENT */
.main-content {
    flex: 1;
    padding: 2rem 3rem;
    max-width: 1400px;
}

.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2.5rem;
    position: sticky;
    top: 0;
    z-index: 1000;
    background: rgba(248, 250, 252, 0.95);
    backdrop-filter: blur(10px);
    padding: 1.5rem 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.page-info h2 {
    font-family: 'Outfit', sans-serif;
    font-size: 1.75rem;
    margin-bottom: 0.25rem;
}

.page-info p {
    color: var(--text-muted);
    font-size: 0.95rem;
}

.top-bar-actions {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.month-selector {
    background: white;
    padding: 0.6rem 1rem;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    box-shadow: var(--shadow-sm);
}

.month-selector select {
    border: none;
    outline: none;
    font-weight: 600;
    color: var(--text-main);
    cursor: pointer;
}

/* CARDS & STATS */
.stats-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--white);
    padding: 1.5rem;
    border-radius: 20px;
    display: flex;
    align-items: center;
    gap: 1.25rem;
    box-shadow: var(--shadow);
    border: 1px solid #f1f5f9;
}

.stat-icon {
    width: 55px;
    height: 55px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.icon-primary {
    background: var(--primary-light);
    color: var(--primary);
}

.icon-success {
    background: var(--secondary-light);
    color: var(--secondary);
}

.icon-danger {
    background: #fee2e2;
    color: #ef4444;
}

.stat-info h3 {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.stat-value {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text-main);
}

/* GLASS CARD */
.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 2rem;
    box-shadow: var(--shadow-lg);
}

.dashboard-grid {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 1.5rem;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    position: sticky;
    top: 95px; /* Stay just below .top-bar */
    background: #f8fafc; /* Match page background */
    z-index: 999;
    padding: 1rem 0;
    border-bottom: 1px solid rgba(0,0,0,0.03);
}

.card-header h3 {
    font-family: 'Outfit', sans-serif;
    font-size: 1.2rem;
}

.btn-text {
    background: none;
    border: none;
    color: var(--primary);
    font-weight: 600;
    cursor: pointer;
    font-size: 0.9rem;
}

/* LIST ITEMS */
.simple-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.list-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 16px;
    border: 1px solid #f1f5f9;
}

.item-rank {
    width: 35px;
    height: 35px;
    background: var(--primary);
    color: white;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}

.item-title {
    font-weight: 600;
    font-size: 0.95rem;
    margin-bottom: 0.2rem;
}

.item-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* VIEW VISIBILITY */
.content-view {
    display: none;
    animation: fadeIn 0.4s ease-out;
}

.content-view.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* LOADING OVERLAY */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(5px);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
}

/* Removed redundant .top-bar styles */

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* MODAL STYLES */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(8px);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease-out;
}

.modal-content {
    max-height: 90vh;
    overflow-y: auto;
}

.input-minimal {
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 0.75rem 1rem;
    font-size: 0.85rem;
    font-weight: 500;
    background: #ffffff;
    color: var(--text-main);
    transition: var(--transition);
    outline: none;
    width: 100%;
}

.input-minimal:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-light);
    background: #ffffff;
}

textarea.input-minimal {
    resize: none;
    line-height: 1.5;
}

select.input-minimal {
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2364748b'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 1.25rem;
    padding-right: 2.5rem;
    -webkit-appearance: none;
    appearance: none;
}

.form-group label {
    display: block;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.025em;
    transition: var(--transition);
}

.form-group:focus-within label {
    color: var(--primary);
}

/* DATA TABLE ENHANCEMENTS */
.data-table, .premium-table {
    width: 100%;
    border-spacing: 0;
    border-collapse: separate;
}

.data-table th, .premium-table th {
    color: var(--text-muted);
    font-weight: 700;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 1rem;
    border-bottom: 2px solid #f1f5f9;
    text-align: left;
    background: #f8fafc;
    position: sticky;
    top: -1px;
    z-index: 50;
    box-shadow: 0 1px 0 #e2e8f0;
}

.data-table td, .premium-table td {
    padding: 1.25rem 1rem;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
}

.data-table tr:hover td, .premium-table tr:hover td {
    background: rgba(79, 70, 229, 0.02);
}

/* BADGES */
.badge {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.badge-success { background: rgba(16, 185, 129, 0.1); color: #10b981 !important; }
.badge-pending { background: rgba(245, 158, 11, 0.1); color: #d97706 !important; }
.badge-danger { background: rgba(239, 68, 68, 0.1); color: #ef4444 !important; }

/* ACTION BUTTONS */
.btn-action {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    cursor: pointer;
    transition: var(--transition);
}

.btn-action:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.btn-verify { background: var(--primary); color: white; }
.btn-edit { background: rgba(79, 70, 229, 0.1); color: var(--primary); }
.btn-delete { background: rgba(239, 68, 68, 0.1); color: #ef4444; }

/* BUDGET SECTION STATES */
#budgetWrapper.disabled {
    opacity: 0.5;
    pointer-events: none;
    filter: grayscale(1);
}


/* DATE CHIPS */
.date-chip {
    background: var(--primary-light);
    color: var(--primary);
    padding: 6px 12px;
    border-radius: 10px;
    font-size: 0.8rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
    border: 1px solid rgba(79, 70, 229, 0.2);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
}

.date-chip input {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    padding: 2px 6px;
    font-size: 0.75rem;
    color: var(--text-main);
    width: 120px;
    outline: none;
}

.date-chip input:focus {
    border-color: var(--primary);
}

.date-chip i {
    cursor: pointer;
    font-size: 1rem;
    color: #cbd5e1;
}

.date-chip i:hover {
    color: #ef4444;
}

.date-chip.incidental {
    background: rgba(16, 185, 129, 0.1);
    color: var(--secondary);
    border-color: rgba(16, 185, 129, 0.2);
}

/* SUBGROUP ROW COLORS */
.row-subtitle-level-1 {
    background: #22c55e !important;
    color: white !important;
}
.row-subtitle-level-1 i {
    color: white !important;
}
.row-subtitle-level-2 {
    background: #fbbf24 !important;
    color: #1e293b !important;
}
.row-subtitle-level-2 i {
    color: #1e293b !important;
}

/* HORIZONTAL SCROLL NAV - INLINE SLIDERS (TOP & BOTTOM) */
.recap-scroll-nav-inline {
    width: 100%;
    height: 12px;
    display: flex;
    align-items: center;
    background: #f8fafc;
    padding: 10px 0;
}

#recapScrollNavTop {
    position: sticky;
    top: 155px; /* Offset to stay below all headers */
    z-index: 998;
    margin-top: -1.5rem;
    margin-bottom: 0.5rem;
    border-bottom: 1px solid rgba(0,0,0,0.03);
}

#recapScrollNavBottom {
    position: fixed;
    bottom: 0;
    left: 280px; /* Sidebar width */
    right: 0;
    z-index: 1000;
    background: rgba(248, 250, 252, 0.95);
    backdrop-filter: blur(10px);
    padding: 12px 30px;
    border-top: 1px solid rgba(0,0,0,0.05);
    box-shadow: 0 -4px 15px rgba(0,0,0,0.05);
    display: none; /* Controlled by active view */
}

/* Show bottom slider only when monthly view is active */
#viewMonthlyCapaian.active + #recapScrollNavBottom,
body:has(#viewMonthlyCapaian.active) #recapScrollNavBottom {
    display: flex !important;
}

.recap-scroll-progress-bg {
    flex: 1;
    height: 6px;
    background: rgba(0, 0, 0, 0.04);
    border-radius: 10px;
    position: relative;
    cursor: pointer;
    overflow: visible; /* Expands clickable area via ::after */
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.recap-scroll-progress-bg::after {
    content: '';
    position: absolute;
    top: -10px; bottom: -10px; left: 0; right: 0;
    z-index: 10;
}

.recap-scroll-progress-fill {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    width: 0%;
    border-radius: 10px;
    transition: width 0.1s linear;
}

.btn-scroll-floating {
    display: none; /* Hide buttons if not needed in inline layout */
}
.btn-scroll-floating:hover {
    background: var(--primary) !important;
    transform: scale(1.1);
}
.btn-scroll-floating:active {
    transform: scale(0.95);
}
.row-subtitle-level-3 {
    background: #38bdf8 !important;
    color: white !important;
}
.row-subtitle-level-3 i {
    color: white !important;
}

.input-subtitle {
    background: transparent;
    border: none;
    color: inherit;
    font-weight: 800;
    width: 100%;
    font-family: inherit;
    font-size: inherit;
    outline: none;
    padding: 0;
}
.input-subtitle:focus {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    padding: 2px 5px;
}

/* PRINT STYLES */
@media print {
    @page {
        size: A4 landscape;
        margin: 1cm !important;
    }

    body {
        background: white !important;
        color: black !important;
        padding: 0 !important;
        margin: 0 !important;
    }

    .sidebar, .top-bar, .background-shapes, .card-actions, .btn-action, .modal-overlay, .btn-primary, .btn-text, .btn-logout, .logo-box, .brand-text {
        display: none !important;
    }

    .main-content {
        padding: 0 !important;
        margin: 0 !important;
        max-width: 100% !important;
        width: 100% !important;
    }

    .glass-card {
        background: white !important;
        backdrop-filter: none !important;
        border: none !important;
        box-shadow: none !important;
        padding: 0 !important;
        margin-bottom: 2rem;
    }

    .premium-table th, .premium-table td {
        border: 1px solid #000 !important;
        color: black !important;
        padding: 6px !important;
        font-size: 8pt !important;
    }

    .premium-table thead th {
        background-color: #f1f5f9 !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .row-subtitle-level-1 {
        background-color: #22c55e !important;
        color: white !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .row-subtitle-level-2 {
        background-color: #fbbf24 !important;
        color: black !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
}