* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --secondary: #8b5cf6;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --bg-dark: #0f172a;
    --bg-darker: #020617;
    --bg-card: #1e293b;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --border: #334155;
}

html,
body {
    height: 100%;
    width: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden;
    /* Prevent body scroll */
    position: fixed;
    /* Fix body to prevent rubber-banding on iOS */

    /* Visual Styles */
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: linear-gradient(135deg, var(--bg-darker) 0%, var(--bg-dark) 100%);
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.container {
    display: flex;
    flex-direction: column;
    height: 100%;
    /* Fill available space (respects keyboard resize) */
    width: 100%;
}

/* Header */
.header {
    background: rgba(30, 41, 59, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
    padding: calc(0.75rem + env(safe-area-inset-top)) 1rem 0.75rem 1rem;
    padding-top: max(0.75rem, env(safe-area-inset-top));
    z-index: 100;
}

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

.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}

.logo-icon {
    font-size: 1.5rem;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-4px);
    }
}

.logo-text {
    font-size: 1.25rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.expenses-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 8px;
    width: 36px;
    height: 36px;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.3s ease;
    -webkit-tap-highlight-color: transparent;
}

.expenses-toggle:active {
    background: var(--bg-card);
    transform: scale(0.95);
}

.auth-button {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.8rem;
    white-space: nowrap;
}

.auth-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(99, 102, 241, 0.3);
}

.user-badge {
    /* Legacy class kept for compatibility, but hidden if not used */
    display: none;
}

/* Redesigned Profile Button */
.profile-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    transition: transform 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}

.profile-btn:active {
    transform: scale(0.95);
}

.profile-avatar-wrapper {
    position: relative;
    width: 40px;
    height: 40px;
}

.profile-avatar-icon {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.1);
}

/* Gold border for premium */
.profile-avatar-wrapper.premium .profile-avatar-icon {
    border: 2px solid #ffd700;
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.3);
}

.profile-crown-overlay {
    position: absolute;
    top: -8px;
    right: -6px;
    font-size: 1.2rem;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5));
    animation: gentleFloat 3s ease-in-out infinite;
    z-index: 10;
}

.user-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
}

.user-name {
    font-weight: 500;
    color: var(--text-primary);
    font-size: 0.9rem;
}

.logout-btn {
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 8px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    color: var(--text-secondary);
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

.logout-btn:hover {
    background: var(--bg-card);
    color: var(--danger);
    border-color: var(--danger);
}

.logout-btn:active {
    transform: scale(0.95);
}

#userInfo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    position: relative;
}

/* Main Content - Mobile First */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 0;
    overflow: hidden;
    min-height: 0;
    /* Crucial for nested scrolling */
}

/* Chat Container */
.chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: transparent;
    overflow: hidden;
    min-height: 0;
    /* Crucial for nested scrolling */
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    -webkit-overflow-scrolling: touch;
}

.chat-messages::-webkit-scrollbar {
    width: 4px;
}

.chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 2px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: #475569;
}

/* Welcome Message */
.welcome-message {
    text-align: center;
    padding: 2rem 1rem;
    animation: fadeIn 0.5s ease;
}

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

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

.welcome-icon {
    font-size: 3rem;
    margin-bottom: 0.75rem;
    animation: bounce 2s ease infinite;
}

@keyframes bounce {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-8px);
    }
}

.welcome-message h2 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.welcome-message p {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-bottom: 1.5rem;
    line-height: 1.5;
}

.examples {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.example-item {
    background: var(--bg-card);
    padding: 0.85rem 1rem;
    border-radius: 10px;
    border: 1px solid var(--border);
    text-align: left;
    color: var(--text-secondary);
    transition: all 0.3s ease;
    cursor: pointer;
    font-size: 0.9rem;
}

.example-item:hover,
.example-item:active {
    border-color: var(--primary);
    color: var(--text-primary);
    transform: translateX(3px);
    background: rgba(99, 102, 241, 0.1);
}

/* Chat Messages */
.message {
    display: flex;
    gap: 0.6rem;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-15px);
    }

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

.message.user {
    flex-direction: row-reverse;
}

.message-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.message.user .message-avatar {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
}

.message.assistant .message-avatar {
    background: var(--bg-card);
    border: 2px solid var(--border);
}

.message-content {
    max-width: 75%;
    padding: 0.85rem 1rem;
    border-radius: 14px;
    line-height: 1.5;
    font-size: 0.95rem;
}

.message.user .message-content {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    border-bottom-right-radius: 4px;
}

.message.assistant .message-content {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-bottom-left-radius: 4px;
    color: var(--text-primary);
}

/* Input Area - Sticky Bottom */
.input-container {
    padding: 1rem;
    background: rgba(30, 41, 59, 0.95);
    backdrop-filter: blur(10px);
    border-top: 1px solid var(--border);
    /* Safe area inset for iPhone notch/home indicator */
    padding-bottom: calc(1rem + env(safe-area-inset-bottom));
}

.chat-form {
    display: flex;
    gap: 0.6rem;
    align-items: center;
}

.message-input {
    flex: 1;
    background: var(--bg-dark);
    border: 2px solid var(--border);
    border-radius: 10px;
    padding: 0.85rem 1rem;
    color: var(--text-primary);
    font-size: 1rem;
    font-family: inherit;
    transition: all 0.3s ease;
    -webkit-appearance: none;
    appearance: none;
}

.message-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.message-input:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.send-button {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border: none;
    border-radius: 10px;
    width: 46px;
    height: 46px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    color: white;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    -webkit-touch-callout: none;
    user-select: none;
}

.send-button:active:not(:disabled) {
    transform: scale(0.95);
}

/* Voice Input Styles */
.send-button.recording {
    background: #ef4444;
    /* Red for recording */
    animation: pulse-record 1.5s infinite;
}

@keyframes pulse-record {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
    }

    70% {
        transform: scale(1.1);
        box-shadow: 0 0 0 10px rgba(239, 68, 68, 0);
    }

    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
    }
}

.send-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Sidebar Overlay - Mobile Only */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 998;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sidebar-overlay.active {
    display: block;
    opacity: 1;
}

/* Sidebar - Mobile Drawer */
.sidebar {
    position: fixed;
    top: 0;
    left: -100%;
    width: 85%;
    max-width: 400px;
    height: 100vh;
    height: 100dvh;
    background: var(--bg-darker);
    z-index: 999;
    display: flex;
    flex-direction: column;
    transition: left 0.3s ease;
    overflow: hidden;
}

.sidebar.active {
    left: 0;
}

.sidebar-header {
    padding: 1rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sidebar-header h3 {
    font-size: 1.1rem;
    font-weight: 600;
}

.sidebar-actions {
    display: flex;
    gap: 0.5rem;
}

.close-sidebar {
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 8px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    color: var(--text-secondary);
    -webkit-tap-highlight-color: transparent;
}

.close-sidebar:active {
    background: var(--bg-card);
    transform: scale(0.95);
}

.refresh-button {
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 8px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    color: var(--text-secondary);
    -webkit-tap-highlight-color: transparent;
}

.refresh-button:active {
    background: var(--bg-card);
    transform: scale(0.95) rotate(90deg);
}

.expenses-list {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    -webkit-overflow-scrolling: touch;
}

.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-secondary);
}

.empty-icon {
    font-size: 3rem;
    display: block;
    margin-bottom: 1rem;
    opacity: 0.5;
}

/* Expense Item */
.expense-item {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0.85rem;
    transition: all 0.3s ease;
    animation: slideIn 0.3s ease;
}

.expense-item:hover,
.expense-item:active {
    border-color: var(--primary);
    transform: translateX(2px);
}

.expense-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 0.4rem;
}

.expense-category {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.8rem;
    font-weight: 500;
}

.expense-amount {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
}

.expense-amount.income-amount {
    color: #22c55e;
}

.expense-description {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-bottom: 0.4rem;
}

.expense-date {
    color: var(--text-secondary);
    font-size: 0.7rem;
}

/* Loading State */
.loading {
    display: flex;
    gap: 0.4rem;
    padding: 0.75rem;
}

.loading-dot {
    width: 7px;
    height: 7px;
    background: var(--text-secondary);
    border-radius: 50%;
    animation: loading 1.4s ease-in-out infinite;
}

.loading-dot:nth-child(1) {
    animation-delay: 0s;
}

.loading-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.loading-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes loading {

    0%,
    60%,
    100% {
        transform: translateY(0);
    }

    30% {
        transform: translateY(-8px);
    }
}

/* Profile Dropdown (Moved from bottom) */
.profile-dropdown {
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 0.5rem;
    min-width: 220px;
    z-index: 1000;
    display: none;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.profile-dropdown.active {
    display: block;
}

.profile-info {
    padding: 0.75rem;
}

.profile-name {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.profile-email {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.dropdown-divider {
    height: 1px;
    background: var(--border);
    margin: 0.5rem 0;
}

.dropdown-item {
    width: 100%;
    padding: 0.75rem;
    background: transparent;
    border: none;
    border-radius: 8px;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.95rem;
    text-align: left;
    font-family: inherit;
}

.dropdown-item:hover {
    background: var(--bg-dark);
}

.dropdown-item.logout {
    color: var(--danger);
}

/* Modals (Moved from bottom) */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    z-index: 2000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 2rem;
    max-width: 400px;
    width: 90%;
    text-align: center;
}

.modal-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.modal-content h3 {
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.modal-content p {
    margin-bottom: 1.5rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.modal-input {
    width: 100%;
    background: var(--bg-dark);
    border: 2px solid var(--border);
    border-radius: 10px;
    padding: 0.85rem 1rem;
    color: var(--text-primary);
    font-size: 1rem;
    font-family: inherit;
    margin-bottom: 1.5rem;
    transition: all 0.3s ease;
}

.modal-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.modal-buttons {
    display: flex;
    gap: 0.75rem;
}

.btn-primary-modal,
.btn-secondary-modal {
    flex: 1;
    padding: 0.75rem 1.5rem;
    border-radius: 10px;
}

/* Premium Success Modal */
.premium-success-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    /* Darker backdrop */
    backdrop-filter: blur(8px);
    z-index: 2100;
    /* Higher than regular modals */
    align-items: center;
    justify-content: center;
}

.premium-success-modal.active {
    display: flex;
}

.modal-content.success-content {
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    border: 1px solid rgba(255, 215, 0, 0.3);
    box-shadow: 0 0 30px rgba(255, 215, 0, 0.15);
    padding: 2.5rem 2rem;
    position: relative;
    overflow: hidden;
    max-width: 340px;
    /* Slimmer for iPhone 15 Pro feel */
}

/* Success Animation */
.success-icon {
    position: relative;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.5rem;
}

.crown-large {
    font-size: 4rem;
    animation: successPop 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
    filter: drop-shadow(0 0 15px rgba(255, 215, 0, 0.5));
}

@keyframes successPop {
    0% {
        transform: scale(0) rotate(-15deg);
        opacity: 0;
    }

    60% {
        transform: scale(1.1) rotate(5deg);
    }

    100% {
        transform: scale(1) rotate(0);
        opacity: 1;
    }
}

.sparkles {
    position: absolute;
    top: 0;
    right: 0;
    font-size: 2rem;
    opacity: 0;
    animation: sparkleFade 1s 0.5s forwards;
}

@keyframes sparkleFade {
    0% {
        transform: translate(-20px, 20px) scale(0);
        opacity: 0;
    }

    100% {
        transform: translate(0, 0) scale(1);
        opacity: 1;
    }
}

/* Success Text */
.success-text {
    font-size: 0.95rem;
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

/* Active Features List */
.active-features {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 2rem;
}

.feature-tag {
    background: rgba(255, 215, 0, 0.1);
    color: #ffd700;
    border: 1px solid rgba(255, 215, 0, 0.3);
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
}

/* Buttons */
.btn-success {
    background: linear-gradient(135deg, #ffd700 0%, #ffa500 100%);
    color: #000;
    font-weight: 700;
    width: 100%;
    margin: 0;
}

.btn-success:hover {
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.4);
}

/* Crown Icon Styles */
.user-crown {
    margin-left: 0.2rem;
    font-size: 0.9em;
    filter: drop-shadow(0 0 5px rgba(255, 215, 0, 0.4));
    animation: gentleFloat 3s ease-in-out infinite;
}

@keyframes gentleFloat {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-2px);
    }
}

/* Subscription Menu Status */
.menu-item .menu-label-sub {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    line-height: 1.2;
}

.sub-status {
    font-size: 0.7rem;
    color: #ffd700;
    margin-top: 2px;
}



.btn-primary-modal {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
}

.btn-primary-modal:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(99, 102, 241, 0.3);
}

.btn-secondary-modal {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

.btn-secondary-modal:hover {
    background: var(--bg-dark);
    color: var(--text-primary);
}

/* Tablet and Desktop Overrides */
@media (min-width: 768px) {
    .header {
        padding: 1rem 2rem;
    }

    .header-content {
        max-width: 1600px;
        margin: 0 auto;
    }

    .logo {
        position: static;
        transform: none;
    }

    .logo-icon {
        font-size: 2rem;
    }

    .logo-text {
        font-size: 1.5rem;
    }

    /* .expenses-toggle visible on desktop now */

    .auth-button {
        padding: 0.75rem 1.5rem;
        font-size: 0.95rem;
    }

    .main-content {
        display: flex;
        flex-direction: column;
        padding: 1.5rem 2rem;
        max-width: 1200px;
        /* Constrain width for better readability */
        margin: 0 auto;
        width: 100%;
        height: 100%;
        /* Ensure full height */
    }

    .chat-container {
        background: rgba(30, 41, 59, 0.5);
        backdrop-filter: blur(10px);
        border-radius: 24px;
        border: 1px solid var(--border);
    }

    .chat-messages {
        padding: 2rem;
        gap: 1rem;
    }

    .welcome-message {
        padding: 3rem 2rem;
    }

}

/* Expenses Modal Styles */
.expenses-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.expenses-modal.active {
    opacity: 1;
    pointer-events: auto;
}

.expenses-modal .modal-content {
    background: var(--bg-card);
    width: 100%;
    max-width: 500px;
    height: 80vh;
    max-height: 800px;
    border-radius: 24px;
    border: 1px solid var(--border);
    transform: scale(0.9);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.expenses-modal.active .modal-content {
    transform: scale(1);
}

.expenses-modal .modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(30, 41, 59, 0.5);
}

.expenses-modal h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.refresh-button {
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 8px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    color: var(--text-secondary);
}

.refresh-button:hover {
    background: var(--bg-card);
    color: var(--text-primary);
    transform: rotate(90deg);
}

.expenses-list {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.expenses-list::-webkit-scrollbar {
    width: 6px;
}

.expenses-list::-webkit-scrollbar-track {
    background: transparent;
}

.expenses-list::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-secondary);
    margin-top: auto;
    margin-bottom: auto;
}

.empty-icon {
    font-size: 3rem;
    display: block;
    margin-bottom: 1rem;
    opacity: 0.5;
}

/* Side Menu */
.menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 998;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.menu-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.side-menu {
    position: fixed;
    top: 0;
    left: 0;
    width: 280px;
    height: 100%;
    background: var(--bg-card);
    z-index: 999;
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border);
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
}

.side-menu.active {
    transform: translateX(0);
}

.menu-header {
    padding: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border);
}

.menu-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

.close-menu-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
}

.menu-items {
    flex: 1;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    overflow-y: auto;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    width: 100%;
    background: transparent;
    border: none;
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 1rem;
    text-align: left;
    cursor: pointer;
    transition: all 0.2s ease;
}

.menu-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.menu-item:active {
    transform: scale(0.98);
}

.menu-item.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.menu-icon {
    font-size: 1.5rem;
}

.tag-coming-soon {
    font-size: 0.7rem;
    background: var(--bg-dark);
    color: var(--text-secondary);
    padding: 0.2rem 0.6rem;
    border-radius: 10px;
    margin-left: auto;
}

.menu-divider {
    height: 1px;
    background: var(--border);
    margin: 0.5rem 0;
}

.menu-footer {
    padding: 1.5rem;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.8rem;
    border-top: 1px solid var(--border);
}

/* About Modal */
.about-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.about-modal.active {
    opacity: 1;
    pointer-events: auto;
}

.about-modal .modal-content {
    background: var(--bg-card);
    width: 100%;
    max-width: 320px;
    border-radius: 24px;
    padding: 1.5rem;
    border: 1px solid var(--border);
    transform: scale(0.9);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.about-modal.active .modal-content {
    transform: scale(1);
}

.about-modal .modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.about-modal h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0;
}

.close-modal-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0.25rem;
}

.about-modal .modal-body {
    text-align: center;
}

.app-logo-large {
    font-size: 4rem;
    margin-bottom: 1rem;
    animation: float 3s ease-in-out infinite;
}

.about-modal h4 {
    font-size: 1.5rem;
    margin: 0 0 0.5rem 0;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.modal-description {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.5;
    margin-top: 1rem;
}

.developer-info {
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-style: italic;
}

/* Subscription Modal */
.subscription-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.subscription-modal.active {
    opacity: 1;
    pointer-events: auto;
}

.subscription-modal .modal-content {
    background: linear-gradient(145deg, var(--bg-card), #1e204a);
    width: 100%;
    max-width: 350px;
    border-radius: 24px;
    padding: 1.5rem;
    border: 1px solid var(--border);
    transform: scale(0.9);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
    overflow: hidden;
}

/* Premium Glow Effect */
.premium-border::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 215, 0, 0.1) 0%, transparent 60%);
    pointer-events: none;
    z-index: 0;
}

.subscription-modal.active .modal-content {
    transform: scale(1);
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.5);
}

.subscription-modal .modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    position: relative;
    z-index: 1;
}

.subscription-modal h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0;
    background: linear-gradient(135deg, #ffd700, #ffaa00);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.premium-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    text-align: center;
    animation: float 3s ease-in-out infinite;
}

.premium-price {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 1.5rem;
    text-align: center;
}

.premium-price .period {
    font-size: 1rem;
    color: var(--text-secondary);
    font-weight: 400;
}

.premium-features {
    list-style: none;
    text-align: left;
    margin: 0 auto 2rem auto;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    position: relative;
    z-index: 1;
}

.premium-features li {
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.95rem;
}

.btn-premium {
    background: linear-gradient(135deg, #ffd700, #ffaa00);
    color: #000;
    font-weight: 700;
    border: none;
    width: 100%;
    margin-bottom: 1rem;
    position: relative;
    z-index: 1;
    padding: 1rem;
    border-radius: 12px;
    cursor: pointer;
    transition: transform 0.2s;
}

.btn-premium:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(255, 215, 0, 0.3);
}

.terms-link {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-align: center;
}

/* ====== TELEGRAM MODAL ====== */
.telegram-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.telegram-modal.active {
    opacity: 1;
    pointer-events: auto;
}

.telegram-modal .modal-content {
    background: linear-gradient(145deg, var(--bg-card), #1e204a);
    width: 100%;
    max-width: 350px;
    border-radius: 24px;
    padding: 1.5rem;
    border: 1px solid var(--border);
    transform: scale(0.9);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.telegram-modal.active .modal-content {
    transform: scale(1);
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.5);
}

.telegram-modal .modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.telegram-modal h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0;
    color: var(--text-primary);
}

.telegram-modal .modal-body {
    text-align: center;
}

.telegram-modal .telegram-icon {
    margin-bottom: 1rem;
}

.telegram-description {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-bottom: 1.5rem;
    line-height: 1.5;
}

.btn-telegram {
    display: inline-block;
    background: linear-gradient(135deg, #0088cc, #00aaff);
    color: white;
    font-weight: 600;
    border: none;
    padding: 1rem 2rem;
    border-radius: 12px;
    text-decoration: none;
    transition: transform 0.2s, box-shadow 0.2s;
    margin-bottom: 1rem;
}

.btn-telegram:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(0, 136, 204, 0.3);
}

.telegram-hint {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 0.5rem;
}

.success-icon-small {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.telegram-linked-text {
    color: #10b981;
    font-weight: 600;
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
}

.telegram-id-display {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-bottom: 1.5rem;
}

.btn-secondary-modal {
    display: inline-block;
    background: transparent;
    color: #0088cc;
    border: 1px solid #0088cc;
    padding: 0.75rem 1.5rem;
    border-radius: 12px;
    text-decoration: none;
    font-weight: 500;
    transition: background 0.2s;
}

.btn-secondary-modal:hover {
    background: rgba(0, 136, 204, 0.1);
}

.btn-primary-modal {
    display: block;
    text-align: center;
}

.hidden {
    display: none !important;
}