:root {
    --bg-main: #0B0F19;
    --bg-card: rgba(23, 31, 48, 0.75);
    --border-card: rgba(255, 255, 255, 0.08);
    --text-primary: #F8FAFC;
    --text-secondary: #94A3B8;
    --text-muted: #64748B;

    --primary: #6366F1;
    --primary-hover: #4F46E5;
    --accent: #38BDF8;

    --success: #10B981;
    --success-bg: rgba(16, 185, 129, 0.15);
    --danger: #EF4444;
    --danger-bg: rgba(239, 68, 68, 0.15);
    --warning: #F59E0B;
    --warning-bg: rgba(245, 158, 11, 0.15);

    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Inter', sans-serif;
}

body {
    background-color: var(--bg-main);
    color: var(--text-primary);
    min-height: 100vh;
    background-image:
        radial-gradient(at 15% 15%, rgba(99, 102, 241, 0.12) 0px, transparent 50%),
        radial-gradient(at 85% 85%, rgba(56, 189, 248, 0.1) 0px, transparent 50%);
    background-attachment: fixed;
    overflow-x: clip;
}

h1,
h2,
h3,
h4,
.sidebar-brand {
    font-family: 'Outfit', sans-serif;
}

/* GLASS PANEL UTILITY */
.glass-panel {
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-card);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow);
}

.hidden {
    display: none !important;
}

/* AUTH SCREEN */
.auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

.auth-card {
    width: 100%;
    max-width: 440px;
    padding: 40px 32px;
    animation: fadeIn 0.4s ease-out;
}

.auth-header {
    text-align: center;
    margin-bottom: 30px;
}

.logo-badge {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    font-size: 26px;
    color: #FFF;
    box-shadow: 0 8px 20px rgba(99, 102, 241, 0.4);
}

.auth-header h2 {
    font-size: 26px;
    margin-bottom: 6px;
}

.auth-header p {
    color: var(--text-secondary);
    font-size: 14px;
}

.auth-tabs {
    display: flex;
    background: rgba(15, 23, 42, 0.6);
    border-radius: var(--radius-sm);
    padding: 4px;
    margin-bottom: 24px;
}

.tab-btn {
    flex: 1;
    padding: 10px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 14px;
    cursor: pointer;
    border-radius: 6px;
    transition: var(--transition);
}

.tab-btn.active {
    background: var(--primary);
    color: #FFF;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.auth-form {
    display: none;
    flex-direction: column;
    gap: 16px;
}

.auth-form.active {
    display: flex;
}

/* FORMS & INPUTS */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 10px;
    position: relative;
}

.form-group label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
}

.form-group input,
.form-group select {
    width: 100%;
    height: 46px;
    padding: 0 14px;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--border-card);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 14px;
    outline: none;
    box-sizing: border-box;
    transition: var(--transition);
}

/* Fix iOS Safari native input[type="date"] vertical stretching */
input[type="date"] {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    height: 46px !important;
    padding: 0 14px !important;
    box-sizing: border-box !important;
    line-height: normal;
    text-align: center;
}

input[type="date"]::-webkit-date-and-time-value {
    text-align: center;
    margin: 0;
    line-height: normal;
    min-height: auto;
}

input[type="date"]::-webkit-calendar-picker-indicator {
    filter: invert(0.8);
    cursor: pointer;
}

.form-group input:focus,
.form-group select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

/* CUSTOM SELECT DROPDOWN COMPONENT */
.custom-select-wrapper {
    position: relative;
    width: 100%;
    user-select: none;
}

.custom-select-wrapper select {
    display: none !important;
}

.custom-select-trigger {
    width: 100%;
    height: 46px;
    padding: 0 14px;
    box-sizing: border-box;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--border-card);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 14px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: var(--transition);
}

.custom-select-trigger:hover,
.custom-select-wrapper.open .custom-select-trigger {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.custom-select-trigger .arrow-icon {
    font-size: 12px;
    color: var(--text-muted);
    transition: transform 0.2s ease;
    margin-left: 8px;
}

.custom-select-wrapper.open .custom-select-trigger .arrow-icon {
    transform: rotate(180deg);
}

.custom-select-menu {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    background: #1e293b;
    border: 1px solid var(--border-card);
    border-radius: 12px;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5);
    z-index: 9999;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s ease;
    max-height: 220px;
    overflow-y: auto;
}

.custom-select-wrapper.open .custom-select-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.custom-select-trigger .trigger-label {
    display: flex;
    align-items: center;
    gap: 8px;
}

.custom-select-option {
    padding: 10px 14px;
    font-size: 14px;
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background 0.15s ease;
}

.custom-select-option .option-text {
    display: flex;
    align-items: center;
    gap: 8px;
}

.select-option-icon {
    font-size: 15px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.custom-select-option:hover {
    background: rgba(255, 255, 255, 0.08);
}

.custom-select-option.selected {
    background: var(--primary);
    color: #ffffff;
    font-weight: 600;
}

.custom-select-option .check-icon {
    font-size: 13px;
    opacity: 0;
    margin-left: 8px;
}

.custom-select-option.selected .check-icon {
    opacity: 1;
}

.form-row {
    display: flex;
    gap: 12px;
}

.form-row .form-group {
    flex: 1;
}

/* BUTTONS */
.btn {
    padding: 12px 20px;
    border: none;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: var(--transition);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-hover));
    color: #FFF;
    box-shadow: 0 4px 14px rgba(99, 102, 241, 0.35);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.5);
}

.btn-success {
    background: linear-gradient(135deg, #10B981, #059669);
    color: #FFF;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--primary);
    color: var(--accent);
}

.btn-outline:hover {
    background: rgba(99, 102, 241, 0.15);
}

.btn-block {
    width: 100%;
}

.btn-link {
    background: none;
    border: none;
    color: var(--accent);
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
}

/* MAIN LAYOUT */
.main-layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 260px;
    padding: 24px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    border-radius: 0;
    border-right: 1px solid var(--border-card);
    border-top: none;
    border-bottom: none;
    border-left: none;
    z-index: 100;
}

.sidebar-brand {
    font-size: 22px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-primary);
    margin-bottom: 36px;
}

.sidebar-brand i {
    color: var(--accent);
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    text-align: left;
    transition: var(--transition);
}

.nav-item i {
    font-size: 16px;
    width: 20px;
}

.nav-item:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

.nav-item.active {
    background: linear-gradient(90deg, rgba(99, 102, 241, 0.2), transparent);
    border-left: 3px solid var(--primary);
    color: var(--accent);
    font-weight: 600;
}

.user-profile-widget {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: rgba(15, 23, 42, 0.5);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-card);
}

.avatar-circle {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: #FFF;
}

.user-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.user-name {
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
}

.user-role {
    font-size: 11px;
    color: var(--text-muted);
}

.btn-logout {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 6px;
    transition: var(--transition);
}

.btn-logout:hover {
    color: var(--danger);
}

.content-area {
    flex: 1;
    padding: 0 30px 30px 30px;
    overflow-y: auto;
}

.topbar {
    position: -webkit-sticky;
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(15, 23, 42, 0.92);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
    padding-top: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 0;
}

.topbar h1 {
    font-size: 24px;
    font-weight: 700;
    text-align: left;
    letter-spacing: 0.5px;
    margin: 0;
    color: var(--text-primary);
}

.topbar-right {
    display: flex;
    justify-content: flex-end;
    align-items: center;
}

.mobile-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 20px;
    cursor: pointer;
    margin-right: 12px;
}

/* APP VIEWS */
.app-view {
    display: none;
    animation: fadeIn 0.3s ease-out;
}

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

/* STATS GRID */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-card);
    border-radius: var(--radius-md);
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 20px;
    box-shadow: var(--shadow);
}

.stat-icon {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
}

.balance-card .stat-icon {
    background: rgba(56, 189, 248, 0.15);
    color: var(--accent);
}

.income-card .stat-icon {
    background: var(--success-bg);
    color: var(--success);
}

.expense-card .stat-icon {
    background: var(--danger-bg);
    color: var(--danger);
}

.stat-info span {
    font-size: 13px;
    color: var(--text-secondary);
}

.stat-info h3 {
    font-size: 24px;
    font-weight: 700;
    margin-top: 4px;
}

/* CHARTS GRID */
.charts-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
    margin-bottom: 24px;
}

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

.chart-card {
    padding: 20px;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.card-header h3 {
    font-size: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.chart-wrapper {
    position: relative;
    height: 280px;
    width: 100%;
}

/* DATA TABLE */
.table-card {
    padding: 20px;
}

.table-responsive {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.data-table th {
    text-align: left;
    padding: 12px;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-card);
    font-weight: 500;
}

.data-table td {
    padding: 14px 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.data-table tr:last-child td {
    border-bottom: none;
}

.badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.badge-expense {
    background: var(--danger-bg);
    color: var(--danger);
}

.badge-income {
    background: var(--success-bg);
    color: var(--success);
}

.text-right {
    text-align: right;
}

.text-center {
    text-align: center;
}

/* FILTER BAR */
.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    padding: 16px 20px;
    align-items: center;
    margin-bottom: 20px;
}

/* TRANSACTIONS GRID & CARDS */
.transactions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
    margin-top: 16px;
}

.tx-card {
    padding: 18px;
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    position: relative;
    overflow: hidden;
}

.tx-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.tx-card-income {
    border-left: 5px solid #10B981 !important;
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.06), rgba(15, 23, 42, 0.6));
}

.tx-card-expense {
    border-left: 5px solid #EF4444 !important;
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.06), rgba(15, 23, 42, 0.6));
}

.tx-card-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.tx-card-date {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
    display: flex;
    align-items: center;
}

.tx-card-main {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
}

.tx-card-amount {
    font-size: 20px;
    font-weight: 700;
    font-family: 'Outfit', sans-serif;
}

.tx-card-note {
    font-size: 13px;
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.04);
    padding: 8px 12px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    border: 1px dashed rgba(255, 255, 255, 0.1);
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.filter-group label {
    font-size: 13px;
    color: var(--text-secondary);
}

.filter-group select,
.filter-group input {
    padding: 8px 12px;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--border-card);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 13px;
}

/* BUDGET CARDS */
.view-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.month-picker {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 600;
}

.month-picker button {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
}

.budgets-grid,
.categories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.budget-card {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.budget-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.cat-badge {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 15px;
    font-weight: 600;
}

.cat-icon-box {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #FFF;
}

.progress-bar-bg {
    width: 100%;
    height: 10px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 5px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    border-radius: 5px;
    transition: width 0.5s ease-in-out;
}

.budget-details {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
}

.exceeded-alert {
    background: var(--danger-bg);
    color: var(--danger);
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* CATEGORY CARD */
.category-item-card {
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* MODAL OVERLAY */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}

.modal-card {
    width: 100%;
    max-width: 480px;
    padding: 28px;
    position: relative;
    overflow: visible;
    animation: zoomIn 0.25s ease-out;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.btn-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 24px;
    cursor: pointer;
}

.type-toggle {
    display: flex;
    background: rgba(15, 23, 42, 0.6);
    padding: 4px;
    border-radius: var(--radius-sm);
    gap: 6px;
    border: 1px solid var(--border-card);
}

.toggle-option {
    flex: 1;
    padding: 12px;
    text-align: center;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.25s ease;
}

.toggle-option input[type="radio"] {
    display: none !important;
}

/* Red theme for Chi tiêu (Expense) */
#type-opt-expense.active {
    background: linear-gradient(135deg, #EF4444 0%, #DC2626 100%);
    color: #FFFFFF;
    box-shadow: 0 4px 14px rgba(239, 68, 68, 0.4);
}

/* Green theme for Thu nhập (Income) */
#type-opt-income.active {
    background: linear-gradient(135deg, #10B981 0%, #059669 100%);
    color: #FFFFFF;
    box-shadow: 0 4px 14px rgba(16, 185, 129, 0.4);
}

/* Transaction modal theme switching */
#transaction-modal.theme-expense .modal-card {
    border: 1px solid rgba(239, 68, 68, 0.35);
    box-shadow: 0 10px 30px rgba(239, 68, 68, 0.15);
}

#transaction-modal.theme-expense .btn-primary {
    background: linear-gradient(135deg, #EF4444 0%, #DC2626 100%);
    border-color: #EF4444;
    box-shadow: 0 4px 14px rgba(239, 68, 68, 0.4);
}

#transaction-modal.theme-expense .btn-primary:hover {
    background: linear-gradient(135deg, #DC2626 0%, #B91C1C 100%);
}

#transaction-modal.theme-income .modal-card {
    border: 1px solid rgba(16, 185, 129, 0.35);
    box-shadow: 0 10px 30px rgba(16, 185, 129, 0.15);
}

#transaction-modal.theme-income .btn-primary {
    background: linear-gradient(135deg, #10B981 0%, #059669 100%);
    border-color: #10B981;
    box-shadow: 0 4px 14px rgba(16, 185, 129, 0.4);
}

#transaction-modal.theme-income .btn-primary:hover {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 20px;
}

/* COLOR & ICON PICKERS */
.color-options {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    padding: 4px 0;
}

.color-swatch {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
    outline: none;
    position: relative;
}

.color-swatch:hover {
    transform: scale(1.15);
}

.color-swatch.active {
    border-color: #FFFFFF;
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.4);
    transform: scale(1.15);
}

.custom-color-picker,
.random-color-picker {
    background: rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-primary);
    font-size: 13px;
    position: relative;
    overflow: hidden;
    border: 1px dashed rgba(255, 255, 255, 0.4);
    transition: transform 0.2s ease, background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.random-color-picker:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.8);
}

.custom-color-picker input[type="color"] {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.icon-picker-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 8px;
    max-height: 130px;
    overflow-y: auto;
    padding: 8px;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--border-card);
    border-radius: var(--radius-sm);
}

.icon-swatch {
    height: 36px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid transparent;
    color: var(--text-secondary);
    font-size: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.icon-swatch:hover {
    background: rgba(255, 255, 255, 0.15);
    color: var(--text-primary);
}

.icon-swatch.active {
    background: var(--primary);
    color: #FFFFFF;
    border-color: var(--accent);
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.4);
}

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

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

@keyframes zoomIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* =========================================================
   IPHONE 15 (393px x 852px) & MOBILE RESPONSIVE OPTIMIZATION
   ========================================================= */

/* Prevent iOS Safari auto-zoom on form inputs */
@media screen and (max-width: 768px) {

    input[type="text"],
    input[type="number"],
    input[type="email"],
    input[type="password"],
    input[type="date"],
    select,
    textarea {
        font-size: 16px !important;
    }
}

/* Sidebar Backdrop Overlay */
.sidebar-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    z-index: 99;
    animation: fadeIn 0.2s ease-out;
}

/* Mobile Bottom Navigation Bar (iPhone / Mobile) */
.mobile-bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: calc(65px + env(safe-area-inset-bottom, 0px));
    padding-bottom: env(safe-area-inset-bottom, 0px);
    background: rgba(15, 23, 42, 0.94);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-top: 1px solid var(--border-card);
    z-index: 90;
    justify-content: space-around;
    align-items: center;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.4);
}

.mobile-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 10px;
    font-weight: 500;
    gap: 4px;
    cursor: pointer;
    flex: 1;
    height: 100%;
    transition: all 0.2s ease;
    padding-top: 4px;
}

.mobile-nav-item i {
    font-size: 18px;
    transition: transform 0.2s ease, color 0.2s ease;
}

.mobile-nav-item.active {
    color: var(--primary-light);
    font-weight: 600;
}

.mobile-nav-item.active i {
    transform: translateY(-2px);
    color: var(--primary-light);
}

/* FAB Center Button */
.mobile-nav-item.fab-item {
    position: relative;
    top: -5px;
}

.fab-circle {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: #FFFFFF;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
    font-size: 18px;
    transition: transform 0.2s ease;
}

.fab-circle:active {
    transform: scale(0.92);
}

/* Responsive breakpoint for Mobile / iPhone 15 (393px width) */
@media (max-width: 768px) {
    body {
        padding-bottom: calc(70px + env(safe-area-inset-bottom, 0px));
    }

    .main-layout {
        display: block;
        min-height: 100vh;
    }

    .sidebar {
        position: fixed;
        left: -290px;
        top: 0;
        bottom: 0;
        width: 280px;
        z-index: 100;
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        padding-top: max(20px, env(safe-area-inset-top, 0px));
        border-radius: 0 20px 20px 0;
    }

    .sidebar.open {
        transform: translateX(290px);
    }

    .mobile-toggle {
        display: none !important;
    }

    .content-area {
        padding: 0 14px 20px 14px;
    }

    /* Topbar on iPhone 15 (393px width) */
    .topbar {
        position: -webkit-sticky;
        position: sticky;
        top: 0;
        z-index: 100;
        background: rgba(15, 23, 42, 0.95);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 10px;
        margin-bottom: 16px;
        padding-top: max(14px, env(safe-area-inset-top, 0px));
        padding-bottom: 12px;
        border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    }

    .topbar-left {
        display: flex;
        align-items: center;
        gap: 10px;
        flex: 1;
        min-width: 0;
    }

    .topbar h1 {
        font-size: 16px;
        text-align: left;
        letter-spacing: 0.3px;
        line-height: 1.2;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .topbar-right .btn {
        padding: 8px 12px;
        font-size: 12px;
        border-radius: 10px;
    }

    .mobile-bottom-nav {
        display: flex;
    }

    /* Dashboard Cards on 393px Screen */
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 12px;
        margin-bottom: 20px;
    }

    .stat-card {
        padding: 16px;
        border-radius: 16px;
        gap: 14px;
    }

    .stat-icon {
        width: 44px;
        height: 44px;
        font-size: 18px;
        border-radius: 12px;
    }

    .stat-info h3 {
        font-size: 20px;
    }

    /* Charts Grid on Mobile */
    .charts-grid {
        grid-template-columns: 1fr;
        gap: 16px;
        margin-bottom: 20px;
    }

    .chart-card {
        padding: 16px;
        border-radius: 16px;
    }

    /* Filter rows in views */
    .view-actions {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
        margin-bottom: 18px;
    }

    .view-actions .action-buttons {
        width: 100%;
        display: flex;
        gap: 8px;
    }

    .view-actions .action-buttons .btn {
        flex: 1;
    }

    .glass-panel.p-4.mb-4 {
        padding: 14px !important;
    }

    .filter-group {
        width: 100%;
        flex-direction: column;
        align-items: stretch;
    }

    .filter-group select,
    .filter-group input {
        width: 100%;
    }

    /* Grids on 393px Viewport */
    .transactions-grid,
    .budgets-grid,
    .categories-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .category-item-card {
        padding: 14px 16px;
        border-radius: 14px;
    }

    .budget-card {
        padding: 16px;
        border-radius: 16px;
    }

    /* Modals on iPhone 15 (Bottom Sheet style) */
    .modal-overlay {
        align-items: flex-end;
        padding: 0;
    }

    .modal-card {
        max-width: 100%;
        border-radius: 24px 24px 0 0;
        padding: 24px 20px;
        padding-bottom: max(24px, env(safe-area-inset-bottom, 0px));
        animation: slideUpModal 0.28s cubic-bezier(0.32, 0.72, 0, 1);
    }

    @keyframes slideUpModal {
        from {
            transform: translateY(100%);
        }

        to {
            transform: translateY(0);
        }
    }

    .icon-picker-grid {
        grid-template-columns: repeat(5, 1fr);
    }
}

/* MONTH FILTER BUTTONS IN TRANSACTIONS VIEW */
.month-filter-container {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 20px;
    margin-bottom: 24px;
    overflow-x: auto;
    scrollbar-width: thin;
    border-radius: 18px;
}

.month-filter-label {
    font-weight: 600;
    color: var(--text-secondary);
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}

.month-filter-btn-group {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}

.month-filter-btn {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: var(--text-secondary);
    padding: 8px 18px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.month-filter-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    color: var(--text-primary);
    transform: translateY(-1px);
}

.month-filter-btn.active {
    background: linear-gradient(135deg, #6366F1 0%, #4F46E5 100%);
    color: #ffffff;
    border-color: #6366F1;
    box-shadow: 0 4px 14px rgba(99, 102, 241, 0.4);
}