:root {
    /* Premium Color Palette (HSL for better control) */
    --primary-h: 217;
    --primary-s: 91%;
    --primary-l: 60%;
    --primary: hsl(var(--primary-h), var(--primary-s), var(--primary-l));
    --primary-glow: hsla(var(--primary-h), var(--primary-s), var(--primary-l), 0.3);

    --secondary-h: 280;
    --secondary-s: 70%;
    --secondary-l: 60%;
    --secondary: hsl(var(--secondary-h), var(--secondary-s), var(--secondary-l));

    --bg-dark: #0a0f1e;
    --bg-surface: #131b2e;
    --bg-card: rgba(22, 30, 51, 0.7);

    --text-main: #ffffff;
    --text-muted: #ffffff;
    --text-dim: #ffffff;

    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-highlight: rgba(255, 255, 255, 0.05);

    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;

    --sidebar-width: 280px;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);

    --shadow-premium: 0 10px 30px -5px rgba(0, 0, 0, 0.3);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    background: var(--bg-dark);
    color: var(--text-main);
    font-family: 'Inter', ui-sans-serif, system-ui, -apple-system, sans-serif;
    overflow-x: hidden;
    line-height: 1.5;
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: var(--bg-dark);
}

::-webkit-scrollbar-thumb {
    background: var(--bg-surface);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-dim);
}

/* Glassmorphism Background */
.glass {
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow-premium);
}

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

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

.fade-in {
    animation: fadeIn 0.5s ease forwards;
}

/* Visibility Utilities & Overrides */
.text-muted,
.text-dim,
.label-custom,
.stat-label,
.extra-small {
    color: #ffffff !important;
    opacity: 1 !important;
}

/* Global Glass text visibility */
.glass label,
.glass p,
.glass .text-muted,
.glass .text-dim {
    color: #ffffff !important;
}

.extra-small {
    font-size: 0.75rem;
}

.fw-800 {
    font-weight: 800;
}

.fw-700 {
    font-weight: 700;
}

.fw-600 {
    font-weight: 600;
}

/* Main Layout */
.app-container {
    display: flex;
    min-height: 100vh;
    background: radial-gradient(circle at 0% 0%, rgba(var(--primary-h), 50%, 40%, 0.1) 0%, transparent 40%),
        radial-gradient(circle at 100% 100%, rgba(var(--secondary-h), 50%, 40%, 0.1) 0%, transparent 40%);
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: rgba(10, 15, 30, 0.8);
    backdrop-filter: blur(20px);
    border-right: 1px solid var(--glass-border);
    padding: 2.5rem 1.5rem;
    position: fixed;
    height: 100vh;
    z-index: 1000;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
}

.sidebar-brand {
    font-size: 1.6rem;
    font-weight: 800;
    margin-bottom: 3.5rem;
    display: flex;
    align-items: center;
    gap: 0.85rem;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.5px;
}

.nav-menu {
    list-style: none;
    flex-grow: 1;
}

.nav-item {
    margin-bottom: 0.65rem;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.85rem 1.25rem;
    color: var(--text-muted);
    text-decoration: none !important;
    border-radius: var(--radius-md);
    transition: var(--transition);
    font-weight: 500;
    position: relative;
    overflow: hidden;
}

.nav-link i {
    font-size: 1.1rem;
    transition: var(--transition);
}

.nav-link:hover {
    color: var(--text-main);
    background: var(--glass-highlight);
}

.nav-link.active {
    color: var(--primary);
    background: hsla(var(--primary-h), var(--primary-s), var(--primary-l), 0.1);
}

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

.nav-link.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 25%;
    height: 50%;
    width: 4px;
    background: var(--primary);
    border-radius: 0 4px 4px 0;
    box-shadow: 0 0 10px var(--primary-glow);
}

/* Sidebar Footer / Logout */
.sidebar-footer {
    margin-top: auto;
    padding-top: 2rem;
    border-top: 1px solid var(--glass-border);
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 3rem;
    max-width: 1400px;
}

/* Dashboard Header */
.content-header {
    margin-bottom: 3rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.page-title h1 {
    font-size: 1.875rem;
    font-weight: 800;
    color: var(--text-main);
    margin-bottom: 0.5rem;
    letter-spacing: -0.5px;
}

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

/* Dashboard Statistics Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.75rem;
    margin-bottom: 3rem;
}

.stat-card {
    padding: 1.75rem;
    border-radius: var(--radius-lg);
    position: relative;
    overflow: hidden;
}

.stat-card-inner {
    position: relative;
    z-index: 2;
}

.stat-label {
    display: block;
    color: var(--text-muted);
    font-size: 0.875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.75rem;
}

.stat-value {
    display: block;
    font-size: 2.25rem;
    font-weight: 800;
    color: var(--text-main);
    letter-spacing: -1px;
    line-height: 1;
}

.stat-icon-bg {
    position: absolute;
    right: -1rem;
    bottom: -1rem;
    font-size: 6rem;
    opacity: 0.05;
    transform: rotate(-15deg);
    transition: var(--transition);
}

.stat-card:hover .stat-icon-bg {
    transform: rotate(0deg) scale(1.1);
    opacity: 0.08;
}

/* Accent Borders for Cards */
.border-primary {
    border-top: 4px solid var(--primary);
}

.border-success {
    border-top: 4px solid var(--success);
}

.border-warning {
    border-top: 4px solid var(--warning);
}

.border-danger {
    border-top: 4px solid var(--danger);
}

.border-info {
    border-top: 4px solid var(--info);
}

/* Table Section Styling */
.section-card {
    border-radius: var(--radius-lg);
    padding: 2rem;
    margin-bottom: 2.5rem;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.section-title {
    font-size: 1.25rem;
    font-weight: 700;
}

/* Custom Table Styling */
.table-responsive {
    border-radius: var(--radius-md);
    overflow: visible;
}

.custom-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 10px;
}

.custom-table thead th {
    padding: 1rem 1.5rem;
    color: var(--text-dim);
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    border: none;
}

.custom-table tbody tr {
    transition: var(--transition);
}

.custom-table tbody td {
    padding: 1.25rem 1.5rem;
    background: rgba(255, 255, 255, 0.02);
    border-top: 1px solid var(--glass-border);
    border-bottom: 1px solid var(--glass-border);
    vertical-align: middle;
}

.custom-table tbody td:first-child {
    border-left: 1px solid var(--glass-border);
    border-top-left-radius: var(--radius-md);
    border-bottom-left-radius: var(--radius-md);
}

.custom-table tbody td:last-child {
    border-right: 1px solid var(--glass-border);
    border-top-right-radius: var(--radius-md);
    border-bottom-right-radius: var(--radius-md);
}

.custom-table tbody tr:hover td {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(var(--primary-h), var(--primary-s), var(--primary-l), 0.2);
}

.custom-table tbody tr:hover {
    transform: translateY(-2px);
}

/* Badge Styling */
.badge-custom {
    padding: 0.45rem 0.85rem;
    border-radius: 2rem;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.badge-active {
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.badge-due {
    background: rgba(245, 158, 11, 0.15);
    color: #fbbf24;
    border: 1px solid rgba(245, 158, 11, 0.2);
}

.badge-left {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

/* Buttons */
.btn-premium {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    border: none;
    padding: 0.85rem 1.75rem;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 0.95rem;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 0.65rem;
    cursor: pointer;
    box-shadow: 0 4px 20px -5px var(--primary-glow);
    text-decoration: none !important;
}

.btn-premium:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px -5px var(--primary-glow);
    filter: brightness(1.1);
    color: white;
}

.btn-icon {
    width: 38px;
    height: 38px;
    padding: 0;
    justify-content: center;
    border-radius: 10px;
}

.btn-outline-custom {
    background: transparent;
    border: 1px solid var(--glass-border);
    color: var(--text-main);
    padding: 0.75rem 1.25rem;
    border-radius: var(--radius-md);
    transition: var(--transition);
    font-weight: 500;
    text-decoration: none !important;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-outline-custom:hover {
    background: var(--glass-highlight);
    border-color: var(--text-dim);
    color: white;
}

/* Modals & Alerts */
.alert-premium {
    background: var(--bg-surface);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    margin-bottom: 2rem;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 1rem;
}

.alert-success-mod {
    border-left: 4px solid var(--success);
}

.alert-error-mod {
    border-left: 4px solid var(--danger);
    background: rgba(239, 68, 68, 0.05);
}

/* Forms Styling */
.form-group-custom {
    margin-bottom: 1.75rem;
}

.label-custom {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.input-premium {
    width: 100%;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    padding: 0.85rem 1.15rem;
    color: white;
    font-size: 1rem;
    transition: var(--transition);
}

.input-premium:focus {
    outline: none;
    border-color: var(--primary);
    background: rgba(255, 255, 255, 0.07);
    box-shadow: 0 0 0 4px hsla(var(--primary-h), var(--primary-s), var(--primary-l), 0.1);
}

/* Search Bar */
.search-wrapper {
    position: relative;
    max-width: 400px;
    width: 100%;
}

.search-input {
    padding-left: 2.75rem;
}

.search-icon {
    position: absolute;
    left: 1.15rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-dim);
    pointer-events: none;
}

/* User Profile Specifics */
.user-profile-header {
    background: linear-gradient(135deg, hsla(var(--primary-h), var(--primary-s), var(--primary-l), 0.1), hsla(var(--secondary-h), var(--secondary-s), var(--secondary-l), 0.1));
    border-radius: var(--radius-lg);
    padding: 2.5rem;
    margin-bottom: 2.5rem;
    display: flex;
    align-items: center;
    gap: 2.5rem;
}

.profile-img-placeholder {
    width: 120px;
    height: 120px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    color: white;
    box-shadow: 0 15px 35px -10px var(--primary-glow);
}

.profile-info h2 {
    font-size: 2rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
}

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

/* Payment Grid */
.payment-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 1rem;
}

.month-item {
    padding: 1.25rem;
    border-radius: var(--radius-md);
    text-align: center;
    border: 1px solid var(--glass-border);
    transition: var(--transition);
}

.month-item.paid {
    background: rgba(16, 185, 129, 0.08);
    border-color: rgba(16, 185, 129, 0.2);
}

.month-item.unpaid {
    background: rgba(255, 255, 255, 0.02);
}

.month-item .month-name {
    display: block;
    font-weight: 700;
    font-size: 1rem;
    margin-bottom: 0.25rem;
}

.month-item .month-status {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

/* Editable Month Grid (Profile Edit) */
.month-grid-edit {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 1rem;
}

.month-item-edit {
    padding: 1rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--glass-border);
    background: rgba(255, 255, 255, 0.02);
    transition: var(--transition);
}

.month-item-edit label {
    color: var(--text-main);
    font-weight: 700;
    font-size: 0.8rem;
}

.month-item-edit.paid {
    background: rgba(16, 185, 129, 0.08);
    border-color: rgba(16, 185, 129, 0.2);
}

.month-item-edit.unpaid {
    background: rgba(239, 68, 68, 0.04);
    border-color: rgba(239, 68, 68, 0.1);
}

.month-item-edit .input-group-text {
    color: var(--text-muted);
}

/* Responsive Overrides */
/* Mobile Toggle & Overlay */
.mobile-toggle {
    display: none;
    background: var(--bg-surface);
    border: 1px solid var(--glass-border);
    color: white;
    padding: 0.5rem 0.85rem;
    border-radius: var(--radius-sm);
    font-size: 1.25rem;
    cursor: pointer;
    z-index: 1001;
    transition: var(--transition);
}

.mobile-toggle:hover {
    background: var(--glass-highlight);
    border-color: var(--primary);
}

.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
}

.sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Responsive Overrides */
@media (max-width: 1024px) {
    .sidebar {
        left: -100%;
        width: 280px;
    }

    .sidebar.active {
        left: 0;
    }

    .main-content {
        margin-left: 0;
        padding: 1.5rem;
    }

    .mobile-toggle {
        display: block;
    }

    .content-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1.5rem;
    }

    .search-wrapper {
        max-width: 100%;
    }
}

@media (max-width: 768px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .stat-card {
        padding: 1.25rem;
    }

    .stat-value {
        font-size: 1.75rem;
    }

    .user-profile-header {
        flex-direction: column;
        text-align: center;
        padding: 1.5rem;
        gap: 1.5rem;
    }

    .profile-img-placeholder {
        width: 100px;
        height: 100px;
        font-size: 2.5rem;
    }

    .section-card {
        padding: 1.25rem;
    }

    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .custom-table {
        display: block;
        width: 100%;
    }

    /* Table Mobile View Transformation */
    .custom-table thead {
        display: none;
    }

    .custom-table tbody,
    .custom-table tr,
    .custom-table td {
        display: block;
        width: 100%;
    }

    .custom-table tr {
        margin-bottom: 1rem;
        background: var(--bg-card);
        border-radius: var(--radius-md);
        padding: 1rem;
        border: 1px solid var(--glass-border);
    }

    .custom-table td {
        border: none !important;
        background: transparent !important;
        padding: 0.5rem 0 !important;
        display: flex;
        justify-content: space-between;
        align-items: center;
        text-align: right;
    }

    .custom-table td::before {
        content: attr(data-label);
        font-size: 0.75rem;
        font-weight: 700;
        text-transform: uppercase;
        color: var(--text-dim);
        margin-right: 1rem;
        text-align: left;
    }

    .custom-table td:last-child {
        justify-content: flex-end;
        padding-top: 1rem !important;
        border-top: 1px solid var(--glass-border) !important;
        margin-top: 0.5rem;
    }
}

/* Login Page Specifics */
.login-screen {
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-dark);
    position: relative;
    overflow: hidden;
}

.login-blob {
    position: absolute;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, var(--primary-glow) 0%, transparent 70%);
    top: -200px;
    left: -200px;
    z-index: 0;
}

.login-blob-2 {
    position: absolute;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, hsla(var(--secondary-h), var(--secondary-s), var(--secondary-l), 0.1) 0%, transparent 70%);
    bottom: -150px;
    right: -150px;
    z-index: 0;
}

.login-container {
    max-width: 450px;
    width: 100%;
    padding: 3.5rem;
    border-radius: var(--radius-lg);
    position: relative;
    z-index: 10;
}