/* Professional App Layout - Main, Dashboard, Expenses, Settings */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* --- Design Tokens --- */
:root {
    /* Responsive base font (desktop) */
    --font-size-base: 16px;
    --sidebar-width: 280px;
    --header-height: 64px;
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --primary-light: rgba(79, 70, 229, 0.1);
    --sidebar-bg: #1e1b4b;
    --sidebar-bg-hover: rgba(255, 255, 255, 0.06);
    --sidebar-active: linear-gradient(135deg, #4f46e5 0%, #6366f1 100%);
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --border: #e2e8f0;
    --card-bg: #ffffff;
    --card-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    --card-shadow-hover: 0 4px 12px rgba(0, 0, 0, 0.08);
    --income: #059669;
    --income-light: rgba(5, 150, 105, 0.1);
    --expense: #dc2626;
    --expense-light: rgba(220, 38, 38, 0.1);
    --savings: #0d9488;
    --savings-light: rgba(13, 148, 136, 0.1);
    --page-bg: #f8fafc;
    --table-th-bg: #f8fafc;
    --table-row-hover: #f8fafc;
}

/* --- Dark Theme --- */
[data-theme="dark"] {
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;
    --border: #334155;
    --card-bg: #1e293b;
    --card-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    --card-shadow-hover: 0 4px 12px rgba(0, 0, 0, 0.4);
    --primary-light: rgba(129, 140, 248, 0.2);
    --page-bg: #0f172a;
    --table-th-bg: #1e293b;
    --table-row-hover: #334155;
}

[data-theme="dark"] body.app-layout,
[data-theme="dark"] body {
    background: var(--page-bg);
}

/* --- Responsive base typography ---
   Desktop: 16px (default) | Laptop: 15px (≤1200px) | Tablet: 15px (≤992px) | Mobile: 14px (≤576px)
   All rem-based font sizes scale with --font-size-base. */
html {
    font-size: var(--font-size-base);
}

/* Laptop (≤1200px) */
@media (max-width: 1199.98px) {
    :root {
        --font-size-base: 15px;
    }
}

/* Tablet (≤992px) */
@media (max-width: 991.98px) {
    :root {
        --font-size-base: 15px;
    }
}

/* Mobile (≤576px) */
@media (max-width: 575.98px) {
    :root {
        --font-size-base: 14px;
    }
}

/* --- Responsive typography overrides (min sizes for readability) --- */
/* Tablet: stat/chart titles slightly reduced so cards fit */
@media (max-width: 991.98px) {
    .stat-value {
        font-size: 1.5rem;
    }
    .chart-title {
        font-size: 0.9375rem;
    }
}

/* Mobile: ensure minimum readable sizes */
@media (max-width: 575.98px) {
    .app-title {
        font-size: 1.0625rem;
    }
    .stat-label {
        font-size: 0.75rem;
    }
    .stat-value {
        font-size: 1.375rem;
    }
    .stat-hint {
        font-size: 0.75rem;
    }
    .data-table th {
        font-size: 0.6875rem;
    }
    .data-table td {
        font-size: 0.875rem;
    }
    .bottom-nav-link {
        font-size: 10px;
    }
    .bottom-nav-link i {
        font-size: 1.25rem;
    }
    .form-label {
        font-size: 0.75rem;
    }
    .form-control-professional {
        font-size: 0.875rem;
    }
    .chart-title {
        font-size: 0.875rem;
    }
    .chart-subtitle {
        font-size: 0.75rem;
    }
    body.auth-page .auth-brand i {
        font-size: 1.75rem;
    }
    body.auth-page .auth-brand span {
        font-size: 1.25rem;
    }
    body.auth-page .auth-title {
        font-size: 1rem;
    }
    body.auth-page .auth-alert {
        font-size: 0.8125rem;
    }
    body.auth-page .auth-hint {
        font-size: 0.6875rem;
    }
    .home-brand i {
        font-size: 1.35rem;
    }
    .home-brand span {
        font-size: 1.125rem;
    }
    .home-page .expense-total-value {
        font-size: 1.5rem;
    }
    .home-page .add-expense-title {
        font-size: 0.9375rem;
    }
}

/* --- App Layout Body --- */
body.app-layout {
    background: var(--page-bg);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* --- Header --- */
.app-header {
    position: fixed;
    top: 0;
    left: var(--sidebar-width);
    right: 0;
    height: var(--header-height);
    background: var(--card-bg);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    z-index: 100;
    box-shadow: var(--card-shadow);
}

.app-header-left {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sidebar-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    margin-right: 0;
    background: transparent;
    border: none;
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 1.25rem;
    cursor: pointer;
    transition: all 0.2s;
}

.sidebar-toggle:hover {
    background: var(--primary-light);
    color: var(--primary);
}

/* Override style.css so toggle respects theme and is visible */
.app-header .sidebar-toggle {
    color: var(--text-primary);
    margin-right: 0;
}
.app-header .sidebar-toggle:hover {
    color: var(--primary);
}

.app-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0;
    color: var(--text-primary);
}

/* --- User Badge --- */
.user-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    margin-left: 1rem;
    margin-right: 0.75rem;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary) 0%, #6366f1 100%);
    color: #fff;
    font-weight: 600;
    font-size: 0.875rem;
    cursor: default;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(79, 70, 229, 0.3);
    transition: transform 0.2s, box-shadow 0.2s;
}

.user-badge:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.4);
}

.user-initials {
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

/* --- Profile Dropdown --- */
.profile-dropdown {
    position: relative;
}

.profile-dropdown .user-badge {
    cursor: pointer;
}

.profile-dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 200px;
    padding: 0.5rem 0;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: var(--card-shadow-hover);
    z-index: 150;
    display: none;
}

.profile-dropdown.open .profile-dropdown-menu {
    display: block;
}

.profile-dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 1rem;
    color: var(--text-primary);
    text-decoration: none;
    font-size: 0.9375rem;
    font-weight: 500;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    cursor: pointer;
    transition: background 0.15s;
}

.profile-dropdown-item:hover {
    background: var(--primary-light);
}

.profile-dropdown-item i {
    font-size: 1.125rem;
    width: 1.25rem;
    color: var(--primary);
}

.profile-dropdown-item.profile-dropdown-item-logout:hover {
    background: var(--expense-light);
}

.profile-dropdown-item.profile-dropdown-item-logout i {
    color: var(--expense);
}

.profile-dropdown-divider {
    height: 1px;
    margin: 0.25rem 0;
    background: var(--border);
}

.profile-dropdown-theme-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.profile-dropdown-theme-toggle {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.5rem;
    background: var(--primary-light);
    border-radius: 8px;
    border: 1px solid var(--border);
}

.profile-dropdown-theme-toggle button {
    padding: 0.25rem 0.5rem;
    border: none;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    background: transparent;
    color: var(--text-secondary);
    transition: all 0.2s;
}

.profile-dropdown-theme-toggle button.active {
    background: var(--primary);
    color: #fff;
}

.btn-logout {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s;
}

.btn-logout:hover {
    background: var(--primary-light);
    border-color: var(--primary);
    color: var(--primary);
}

/* --- Month filter (calendar) --- */
.month-filter-wrapper {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-left: auto;
}

.month-filter-label {
    display: flex;
    align-items: center;
    color: var(--text-secondary);
    font-size: 1.125rem;
    cursor: pointer;
}

.month-filter-label i {
    color: var(--primary);
}

.month-filter-input {
    padding: 0.4rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.875rem;
    color: var(--text-primary);
    background: var(--card-bg);
    cursor: pointer;
    min-width: 140px;
}

.month-filter-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px var(--primary-light);
}

.month-filter-input::-webkit-calendar-picker-indicator {
    cursor: pointer;
    opacity: 0.6;
}

[data-theme="dark"] .month-filter-input::-webkit-calendar-picker-indicator {
    filter: invert(1);
    opacity: 0.85;
    cursor: pointer;
}

/* Dashboard period filter (dropdown: Monthly / Half-yearly / Annual) */
.dashboard-period-filter {
    margin-bottom: 1.25rem;
}
.period-filter-row {
    display: flex;
    align-items: center;
    justify-content: end;
    flex-wrap: wrap;
    gap: 0.75rem;
}
.period-filter-label {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--text-secondary);
}
.period-filter-label i {
    color: var(--primary);
}
.period-dropdown {
    min-width: 160px;
}
.period-pickers {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem;
}
.period-picker-hidden {
    display: none !important;
}
.period-picker-halfyearly,
.period-picker-annual,
.period-picker-daterange {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.period-picker-daterange .month-filter-input {
    width: 140px;
}
.period-select {
    min-width: 140px;
}
.period-year-input {
    width: 90px;
}

/* Expense page filter (month / date range) */
.expense-page-filter {
    margin-bottom: 1.25rem;
}
.expense-filter-row {
    display: flex;
    align-items: center;
    justify-content: end;
    flex-wrap: wrap;
    gap: 0.75rem;
}
.expense-filter-pickers {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem;
}
.expense-picker-hidden {
    display: none !important;
}
.expense-picker-daterange {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.expense-picker-daterange .month-filter-input {
    width: 140px;
}

/* Page-level month filter (on each page, not in header) */
.page-month-filter {
    display: flex;
    align-items: center;
    justify-content: end;
    gap: 0.75rem;
}

.home-page .page-month-filter {
    justify-content: center;
}

.page-month-filter .month-filter-label {
    display: flex;
    align-items: center;
    color: var(--text-secondary);
    font-size: 1rem;
    cursor: pointer;
}

.page-month-filter .month-filter-label i {
    color: var(--primary);
}

/* Home page glass style month filter */
.month-filter-glass .month-filter-label i {
    color: rgba(255, 255, 255, 0.9);
}

.month-filter-glass-input {
    background: rgba(255, 255, 255, 0.15) !important;
    border: 1px solid rgba(255, 255, 255, 0.25) !important;
    color: #fff !important;
}

.month-filter-glass-input:focus {
    background: rgba(255, 255, 255, 0.2) !important;
    border-color: rgba(255, 255, 255, 0.4) !important;
}

.month-filter-glass-input::-webkit-calendar-picker-indicator {
    filter: invert(1);
    opacity: 0.7;
}

/* --- Sidebar --- */
.app-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--sidebar-bg);
    z-index: 200;
    transition: transform 0.2s ease, width 0.25s ease;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: -1;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-brand i {
    font-size: 1.5rem;
    color: #818cf8;
}

.sidebar-brand span {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 1.25rem;
    font-weight: 700;
    color: #fff;
}

.sidebar-brand-xpense {
    background: linear-gradient(135deg, #4f46e5 0%, #6366f1 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
}

.sidebar-nav {
    flex: 1;
    min-height: 0;
    padding: 1rem 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: rgba(255, 255, 255, 0.75);
    text-decoration: none;
    border-radius: 10px;
    font-size: 0.9375rem;
    font-weight: 500;
    transition: all 0.2s;
}

.sidebar-link:hover {
    background: var(--sidebar-bg-hover);
    color: #fff;
}

.sidebar-link.active {
    background: var(--sidebar-active);
    color: #fff;
    box-shadow: 0 2px 8px rgba(79, 70, 229, 0.35);
}

.sidebar-link i {
    font-size: 1.25rem;
    width: 1.5rem;
    text-align: center;
}

.sidebar-link-logout {
    margin-top: auto;
    color: rgba(255, 255, 255, 0.6);
}

.sidebar-link-logout:hover {
    background: rgba(220, 38, 38, 0.2);
    color: #fca5a5;
}

/* Mini/collapsed sidebar (desktop only) – override style.css so toggle is visible */
@media (min-width: 992px) {
    .app-header .sidebar-toggle,
    .sidebar-toggle {
        display: flex !important;
    }
    body.sidebar-collapsed .app-sidebar {
        width: 72px;
    }
    body.sidebar-collapsed .app-header {
        left: 72px;
    }
    body.sidebar-collapsed .app-main {
        margin-left: 72px;
    }
    .app-sidebar.sidebar-collapsed .sidebar-brand {
        justify-content: center;
        padding: 1rem;
    }
    .app-sidebar.sidebar-collapsed .sidebar-brand span {
        display: none;
    }
    .app-sidebar.sidebar-collapsed .sidebar-nav {
        padding: 0.5rem;
        align-items: center;
    }
    .app-sidebar.sidebar-collapsed .sidebar-link {
        justify-content: center;
        padding: 0.75rem;
    }
    .app-sidebar.sidebar-collapsed .sidebar-link span {
        display: none;
    }
    .app-sidebar.sidebar-collapsed .sidebar-link i {
        margin: 0;
    }
}

/* --- Main Content --- */
.app-main {
    margin-left: var(--sidebar-width);
    margin-top: var(--header-height);
    min-height: calc(100vh - var(--header-height));
    padding: 1.5rem 2rem;
}

/* --- Page Header --- */
.page-header {
    margin-bottom: 1.5rem;
}

.page-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 0.25rem 0;
}

.page-subtitle {
    font-size: 0.9375rem;
    color: var(--text-secondary);
    margin: 0;
}

/* --- Dashboard Stat Cards --- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
}

@media (max-width: 1200px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 576px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
}

.stat-card {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 1.5rem;
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    box-shadow: var(--card-shadow);
    border: 1px solid var(--border);
    transition: all 0.2s;
}

.stat-card:hover {
    box-shadow: var(--card-shadow-hover);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
}

.stat-card-income .stat-icon {
    background: var(--income-light);
    color: var(--income);
}

.stat-card-expense .stat-icon {
    background: var(--expense-light);
    color: var(--expense);
}

.stat-card-savings .stat-icon {
    background: var(--savings-light);
    color: var(--savings);
}

.stat-card-dues .stat-icon {
    background: rgba(124, 58, 237, 0.15);
    color: #7c3aed;
}

.stat-content {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.stat-label {
    font-size: 0.8125rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--text-secondary);
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

.stat-hint {
    font-size: 0.8125rem;
    color: var(--text-muted);
}

/* --- Charts Row (Dashboard) --- */
.charts-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
    margin-top: 1.5rem;
}

@media (max-width: 1200px) {
    .charts-row {
        grid-template-columns: repeat(1, 1fr);
    }
}

@media (max-width: 992px) {
    .charts-row {
        grid-template-columns: 1fr;
    }
}

/* --- Chart Card (Dashboard) --- */
.chart-card {
    margin-top: 0;
}

.chart-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border);
}

.chart-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.chart-title i {
    color: var(--primary);
}

.chart-subtitle {
    font-size: 0.8125rem;
    color: var(--text-muted);
}

.chart-body {
    padding: 1.5rem;
    min-height: 260px;
}

/* Dashboard desktop: compact layout */
@media (min-width: 992px) {
    body[data-page="dashboard"] .dashboard-period-filter {
        margin-bottom: 0.75rem;
    }
    body[data-page="dashboard"] .stats-grid {
        gap: 1rem;
    }
    body[data-page="dashboard"] .stat-card {
        padding: 1rem 1.25rem;
    }
    body[data-page="dashboard"] .stat-icon {
        width: 42px;
        height: 42px;
        font-size: 1.25rem;
    }
    body[data-page="dashboard"] .charts-row {
        gap: 1rem;
        margin-top: 1rem;
    }
    body[data-page="dashboard"] .chart-header {
        padding: 0.75rem 1.25rem;
    }
    body[data-page="dashboard"] .chart-body {
        min-height: 260px;
        height: 260px;
        padding: 1rem;
    }
    body[data-page="dashboard"] .chart-body canvas {
        max-height: 260px;
    }
}

/* --- Content Card (Expenses, Settings) --- */
.content-card {
    background: var(--card-bg);
    border-radius: 16px;
    box-shadow: var(--card-shadow);
    border: 1px solid var(--border);
    overflow: hidden;
    margin-top:16px;
}

/* --- Expenses Page --- */
.expense-search-bar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border);
}

.expense-search-label {
    display: flex;
    align-items: center;
    color: var(--text-muted);
    font-size: 1rem;
}

.expense-search-label i {
    color: var(--primary);
}

.expense-search-input {
    flex: 1;
    min-width: 0;
    padding: 0.5rem 1rem;
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 0.9375rem;
    color: var(--text-primary);
    background: var(--card-bg);
    transition: border-color 0.2s;
}

.expense-search-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px var(--primary-light);
}

.expense-search-input::placeholder {
    color: var(--text-muted);
}

.expense-search-bar .btn-primary-professional {
    flex-shrink: 0;
    margin-left: auto;
}

.filters-bar {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border);
}

.form-select-professional {
    min-width: 140px;
    padding: 0.5rem 1rem;
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 0.9375rem;
    color: var(--text-primary);
    background: var(--card-bg);
}

.form-select-professional:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.table-wrapper {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    padding: 1rem 1.5rem;
    text-align: left;
}

.data-table th {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    background: var(--table-th-bg);
}

.data-table tbody tr {
    border-bottom: 1px solid var(--border);
    transition: background 0.15s;
}

.data-table tbody tr:hover {
    background: var(--table-row-hover);
}

.data-table td {
    font-size: 0.9375rem;
    color: var(--text-primary);
}

.table-empty {
    text-align: center;
    padding: 3rem 1.5rem;
    color: var(--text-muted);
    font-size: 0.9375rem;
}

.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border-radius: 8px;
    margin-right: 0.375rem;
    border: 1px solid transparent;
}

.btn-icon i {
    font-size: 0.9375rem;
}

.btn-edit,
.btn-edit-modal,
.btn-edit-savings {
    background: var(--primary-light);
    color: var(--primary);
}

.btn-edit:hover,
.btn-edit-modal:hover,
.btn-edit-savings:hover {
    background: rgba(79, 70, 229, 0.2);
}

.btn-delete,
.btn-delete-savings {
    background: var(--expense-light);
    color: var(--expense);
}

.btn-delete:hover,
.btn-delete-savings:hover {
    background: rgba(220, 38, 38, 0.2);
}

/* --- Settings Page --- */
.settings-card {
    max-width: 640px;
}

.settings-section {
    padding: 1.5rem;
}

.settings-section-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 0.5rem 0;
}

.settings-section-title i {
    color: var(--primary);
}

.settings-section-desc {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin: 0 0 1.5rem 0;
}

.settings-form .form-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr auto;
    gap: 1rem;
    align-items: end;
}

.settings-form .form-group {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.settings-form .form-group-action .form-label {
    visibility: hidden;
}

.form-label {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.form-control-professional {
    padding: 0.625rem 1rem;
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 0.9375rem;
    color: var(--text-primary);
    background: var(--card-bg);
    transition: all 0.2s;
}

.form-control-professional:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.btn-primary-professional {
    padding: 0.625rem 1.25rem;
    background: var(--primary);
    border: none;
    border-radius: 10px;
    color: #fff;
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary-professional:hover {
    background: var(--primary-hover);
    color:#fff;
}

/* --- Responsive / Mobile & Tablet App-style --- */
@media (max-width: 991.98px) {
    .app-header {
        left: 0;
        padding: 0 1rem;
        height: 56px;
        min-height: 56px;
    }

    .app-title {
        font-size: 1.125rem;
        flex: 1;
        min-width: 0;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .sidebar-toggle {
        display: flex !important;
        width: 44px;
        height: 44px;
        min-width: 44px;
        min-height: 44px;
        color: var(--primary);
    }
    .app-header .sidebar-toggle:hover {
        color: var(--primary-hover);
        background: var(--primary-light);
    }

    .app-sidebar {
        transform: translateX(-100%);
    }

    .app-sidebar.open {
        transform: translateX(0);
    }

    .app-sidebar.open .sidebar-overlay {
        display: block;
    }

    .app-main {
        margin-left: 0;
        margin-top: 56px;
        padding: 1rem;
        padding-bottom: calc(72px + env(safe-area-inset-bottom, 0px));
        min-height: calc(100vh - 56px);
    }

    .month-filter-wrapper {
        margin-left: 0.5rem;
    }

    .month-filter-input {
        min-width: 120px;
        padding: 0.35rem 0.5rem;
    }

    .user-badge {
        width: 40px;
        height: 40px;
        min-width: 40px;
        min-height: 40px;
    }

    .settings-form .form-row {
        grid-template-columns: 1fr;
    }

    /* Cards: more rounded, full bleed feel */
    .content-card,
    .stat-card {
        border-radius: 20px;
    }

    .stat-card {
        padding: 1.25rem;
    }

    .stats-grid {
        gap: 1rem;
    }

    .btn-icon {
        min-width: 44px;
        min-height: 44px;
    }

    .expense-search-bar .btn-primary-professional,
    .btn-primary-professional {
        min-height: 44px;
        padding: 0.75rem 1.25rem;
    }

    .profile-dropdown-menu {
        min-width: 260px;
        right: 0;
        left: auto;
    }

    .chart-header,
    .chart-body {
        padding: 1rem;
    }

    .content-card .table-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .data-table {
        min-width: 380px;
    }

    .data-table th,
    .data-table td {
        padding: 0.875rem 1rem;
    }

    /* Prevent wrapping in narrow columns on mobile; table scrolls horizontally */
    .data-table th:nth-child(1),
    .data-table td:nth-child(1) {
        min-width: 100px;
        white-space: nowrap;
    }
    .data-table th:nth-child(2),
    .data-table td:nth-child(2) {
        min-width: 90px;
    }
    .data-table th:nth-child(3),
    .data-table td:nth-child(3) {
        min-width: 100px;
        white-space: nowrap;
    }
    .data-table th:nth-child(4),
    .data-table td:nth-child(4) {
        min-width: 88px;
        white-space: nowrap;
    }

    .expense-search-bar {
        padding: 1rem;
    }

    .modal-dialog {
        margin: 0.5rem;
        max-width: calc(100% - 1rem);
    }

    .modal-content {
        border-radius: 20px;
    }
}

/* Bottom navigation - mobile app style (tablet & mobile) */
@media (max-width: 991.98px) {
    .bottom-nav {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        height: calc(64px + env(safe-area-inset-bottom, 0px));
        padding-bottom: env(safe-area-inset-bottom, 0px);
        background: var(--card-bg);
        border-top: 1px solid var(--border);
        display: flex;
        align-items: flex-start;
        justify-content: space-around;
        z-index: 200;
        box-shadow: 0 -2px 20px rgba(0, 0, 0, 0.08);
    }

    .bottom-nav-link {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 0.25rem;
        padding: 0.5rem 0.25rem;
        min-height: 64px;
        color: var(--text-muted);
        text-decoration: none;
        font-size: 0.625rem;
        font-weight: 500;
        transition: color 0.2s, background 0.2s;
        -webkit-tap-highlight-color: transparent;
    }

    .bottom-nav-link i {
        font-size: 1.35rem;
        display: block;
    }

    .bottom-nav-link.active {
        color: var(--primary);
    }

    .bottom-nav-link.active i {
        color: var(--primary);
    }

    .bottom-nav-label {
        display: block;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 100%;
    }
}

@media (min-width: 992px) {
    .bottom-nav {
        display: none !important;
    }
}

/* Home page mobile app style */
@media (max-width: 991.98px) {
    body.home-page .home-header {
        padding: 0 1rem;
        min-height: 56px;
        height: 56px;
    }

    body.home-page .home-main {
        padding-bottom: calc(72px + env(safe-area-inset-bottom, 0px));
        min-height: calc(100vh - 56px);
    }

    body.home-page .home-content {
        padding: 1rem;
        max-width: 100%;
    }

    body.home-page .glass-card {
        border-radius: 20px;
    }

    body.home-page .expense-total-card {
        padding: 1.25rem;
    }

    body.home-page .add-expense-card {
        padding: 1.25rem;
    }

    body.home-page .glass-btn,
    body.home-page .form-control {
        min-height: 44px;
    }
}

@media (min-width: 992px) {
    .home-page .bottom-nav {
        display: none !important;
    }
}

/* --- Home Page UI (match dashboard look, keep same layout) --- */
body.home-page {
    background: var(--page-bg);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.home-header {
    background: var(--card-bg);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--card-shadow);
    display: flex;
    align-items: center;
    gap: 1rem;
}

.home-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.home-brand i {
    font-size: 1.5rem;
    color: var(--primary);
}

.home-brand span {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
}

.home-page .home-brand .sidebar-brand-xpense {
    background: linear-gradient(135deg, #4f46e5 0%, #6366f1 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
}

.home-title {
    color: var(--text-primary);
    font-weight: 600;
}

.home-main {
    background: var(--page-bg);
}

.home-content {
    padding: 1.5rem 2rem;
    max-width: 640px;
    margin: 0 auto;
}

.home-page .glass-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: var(--card-shadow);
}

.home-page .expense-total-card {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.home-page .expense-total-label {
    font-size: 0.8125rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--text-secondary);
}

.home-page .expense-total-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
}

.home-page .add-expense-card {
    padding: 1.5rem;
}

.home-page .add-expense-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 1rem 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.home-page .add-expense-title::before {
    content: none;
}

.home-page .form-label {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.home-page .glass-input,
.home-page .form-control {
    padding: 0.625rem 1rem;
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 0.9375rem;
    color: var(--text-primary);
    background: var(--card-bg);
}

.home-page .glass-input:focus,
.home-page .form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.home-page .glass-btn {
    padding: 0.625rem 1.25rem;
    background: var(--primary);
    border: none;
    border-radius: 10px;
    color: #fff;
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.home-page .glass-btn:hover {
    background: var(--primary-hover);
}

.home-page .month-filter-glass .month-filter-label i {
    color: var(--primary);
}

.home-page .month-filter-glass-input {
    background: var(--card-bg) !important;
    border: 1px solid var(--border) !important;
    color: var(--text-primary) !important;
}

.home-page .month-filter-glass-input:focus {
    background: var(--card-bg) !important;
    border-color: var(--primary) !important;
    box-shadow: 0 0 0 2px var(--primary-light) !important;
}

.home-page .month-filter-glass-input::-webkit-calendar-picker-indicator {
    filter: none;
    opacity: 0.6;
    cursor: pointer;
}

.home-page .glass-btn-menu {
    color: var(--text-secondary);
    text-decoration: none;
    padding: 0.5rem 1rem;
    border: 1px solid var(--border);
    border-radius: 10px;
    font-weight: 500;
    transition: all 0.2s;
}

.home-page .glass-btn-menu:hover {
    background: var(--primary-light);
    border-color: var(--primary);
    color: var(--primary);
}

/* --- Dues Page - Total Badge in Modal --- */
.dues-total-display {
    margin-top: 0.5rem;
}

.dues-total-badge {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: linear-gradient(135deg, #7c3aed 0%, #a855f7 100%);
    color: #fff;
    border-radius: 10px;
    font-size: 0.9375rem;
}

.dues-total-badge i {
    font-size: 1.25rem;
    opacity: 0.9;
}

.dues-total-badge strong {
    font-weight: 700;
}

/* --- Auth pages (login, signup) – match inside app design --- */
body.auth-page.app-layout {
    background: var(--page-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}

.auth-page-wrap {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

body.auth-page .auth-container {
    width: 100%;
    max-width: 420px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
}

body.auth-page .auth-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

body.auth-page .auth-brand i {
    font-size: 2rem;
    color: var(--primary);
}

body.auth-page .auth-brand span {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

body.auth-page .auth-brand .sidebar-brand-xpense {
    background: linear-gradient(135deg, #4f46e5 0%, #6366f1 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
}

body.auth-page .auth-card.content-card {
    width: 100%;
    padding: 0;
    overflow: visible;
}

body.auth-page .auth-card-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border);
}

body.auth-page .auth-title {
    color: var(--text-primary);
    font-size: 1.10rem;
    font-weight: 600;
    margin: 0;
}

body.auth-page .auth-title i {
    color: var(--primary);
}

body.auth-page .auth-card-body {
    padding: 1.5rem 1.5rem 2rem;
}

body.auth-page .auth-alert {
    padding: 0.75rem 1rem;
    border-radius: 10px;
    font-size: 0.875rem;
    margin-bottom: 1rem;
}

body.auth-page .auth-alert-success {
    background: var(--income-light);
    border: 1px solid rgba(5, 150, 105, 0.35);
    color: var(--income);
}

[data-theme="dark"] body.auth-page .auth-alert-success {
    color: #6ee7b7;
}

body.auth-page .auth-alert-error {
    background: var(--expense-light);
    border: 1px solid rgba(220, 38, 38, 0.35);
    color: var(--expense);
}

[data-theme="dark"] body.auth-page .auth-alert-error {
    color: #fca5a5;
}

body.auth-page .auth-form-group .form-label {
    color: var(--text-secondary);
}

body.auth-page .auth-hint {
    color: var(--text-muted);
    font-size: 0.75rem;
    margin-top: 0.25rem;
}

body.auth-page .auth-btn {
    width: 100%;
    margin-top: 0.5rem;
    margin-bottom: 0.5rem;
    padding: 0.75rem 1.25rem;
}

body.auth-page .auth-footer {
    color: var(--text-secondary);
    margin-top: 1rem;
}

body.auth-page .auth-footer a {
    color: var(--primary);
    font-weight: 600;
    text-decoration: none;
}

body.auth-page .auth-footer a:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}