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

:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --secondary: #8b5cf6;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --info: #3b82f6;
    --light: #f8fafc;
    --dark: #1e293b;
    --border: #e2e8f0;
    --text: #334155;
    --text-light: #64748b;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.15);
    --radius: 16px;
    --radius-sm: 12px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: var(--text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

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

.auth-card {
    background: white;
    border-radius: 24px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 480px;
    width: 100%;
    overflow: hidden;
}

.auth-header {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    color: white;
    padding: 48px 32px 40px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.auth-header::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
    animation: pulse 4s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 0.5; }
    50% { transform: scale(1.1); opacity: 0.8; }
}

.auth-header h1 {
    font-size: 32px;
    margin-bottom: 8px;
    font-weight: 700;
    position: relative;
    z-index: 1;
}

.auth-header p {
    opacity: 0.95;
    font-size: 15px;
    position: relative;
    z-index: 1;
}

.auth-tabs {
    display: flex;
    background: var(--light);
    padding: 6px;
    margin: 20px 24px 0;
    border-radius: 12px;
    gap: 6px;
}

.tab-btn {
    flex: 1;
    padding: 12px 16px;
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 15px;
    font-weight: 600;
    color: var(--text-light);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 10px;
}

.tab-btn.active {
    color: white;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

.auth-form {
    padding: 28px 32px 36px;
}

.form-group {
    margin-bottom: 20px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--dark);
    font-size: 14px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 15px;
    transition: all 0.3s;
    background: var(--light);
    font-family: inherit;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
    background: white;
}

.btn {
    padding: 12px 20px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    line-height: 1.4;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    box-shadow: 0 4px 16px rgba(99, 102, 241, 0.3);
}

.btn-primary:active {
    transform: scale(0.98);
}

.btn-secondary {
    background: white;
    color: var(--text);
    border: 2px solid var(--border);
    padding: 10px 16px;
}

.btn-secondary:active {
    background: var(--light);
}

.forgot-link {
    display: block;
    text-align: center;
    margin-top: 16px;
    color: var(--primary);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
}

.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    padding: 8px;
    color: var(--dark);
}

.mobile-menu {
    display: none;
    position: fixed;
    top: 70px;
    left: 0;
    right: 0;
    background: white;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
    z-index: 999;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.mobile-menu.active {
    display: block;
}

.mobile-menu ul {
    list-style: none;
    padding: 12px;
}

.mobile-menu li {
    margin-bottom: 8px;
}

.mobile-menu li a {
    display: block;
    padding: 14px 16px;
    color: var(--text);
    text-decoration: none;
    font-weight: 500;
    border-radius: 12px;
    transition: all 0.3s;
}

.mobile-menu li a:active {
    background: var(--light);
    color: var(--primary);
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 24px 20px;
}

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

.page-header .btn {
    width: auto;
    white-space: nowrap;
}

.page-header h1 {
    font-size: 32px;
    color: white;
    font-weight: 700;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    margin-bottom: 4px;
}

.page-header p {
    color: rgba(255, 255, 255, 0.95);
    font-size: 15px;
}

.header-actions {
    display: flex;
    gap: 12px;
    flex-shrink: 0;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 28px;
}

.stat-card {
    background: white;
    border-radius: var(--radius);
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: all 0.3s;
}

.stat-card:active {
    transform: scale(0.98);
}

.stat-icon {
    font-size: 36px;
    width: 64px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 14px;
    flex-shrink: 0;
}

.stat-balance .stat-icon {
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    box-shadow: 0 4px 12px rgba(251, 191, 36, 0.3);
}

.stat-income .stat-icon {
    background: linear-gradient(135deg, #10b981, #059669);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.stat-expense .stat-icon {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.stat-debt .stat-icon {
    background: linear-gradient(135deg, #8b5cf6, #7c3aed);
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3);
}

.stat-content {
    align-items: center;
    flex: 1;
    justify-content: center;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.stat-content h3 {
    font-size: 13px;
    color: var(--text-light);
    margin-bottom: 4px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    font-size: 26px;
    font-weight: 700;
    color: var(--dark);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(500px, 1fr));
    gap: 20px;
}

.card {
    background: white;
    border-radius: var(--radius);
    padding: 24px;
    margin-top: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    overflow: hidden;
}

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

.card h2 {
    font-size: 20px;
    color: var(--dark);
    font-weight: 700;
}

.btn-link {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    white-space: nowrap;
    transition: all 0.3s;
}

.btn-link:hover {
    color: var(--primary-dark);
}

.chart-card {
    min-height: 320px;
}

.chart-card canvas {
    max-height: 280px;
}

.transaction-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.transaction-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    background: var(--light);
    border-radius: var(--radius-sm);
    transition: all 0.3s;
    cursor: pointer;
}

.transaction-item:active {
    background: var(--border);
    transform: scale(0.98);
}

.transaction-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: bold;
    color: white;
    flex-shrink: 0;
}

.transaction-icon.income {
    background: linear-gradient(135deg, var(--success), #059669);
}

.transaction-icon.expense {
    background: linear-gradient(135deg, var(--danger), #dc2626);
}

.transaction-details {
    flex: 1;
    min-width: 0;
}

.transaction-category {
    font-weight: 600;
    color: var(--dark);
    margin-bottom: 4px;
    font-size: 15px;
}

.transaction-date {
    font-size: 13px;
    color: var(--text-light);
}

.transaction-amount {
    font-weight: 700;
    font-size: 17px;
    white-space: nowrap;
}

.transaction-amount.income {
    color: var(--success);
}

.transaction-amount.expense {
    color: var(--danger);
}

.filters-card {
    margin-bottom: 20px;
}

.filters-form {
    display: grid;
    grid-template-columns: auto auto auto auto;
    gap: 12px;
    align-items: end;
}

.filter-group select,
.filter-group input {
    width: 100%;
    padding: 11px 14px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    background: var(--light);
    transition: all 0.3s;
}

.filter-group select:focus,
.filter-group input:focus {
    outline: none;
    border-color: var(--primary);
    background: white;
}

.data-table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--radius-sm);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 600px;
}

.data-table thead {
    background: var(--light);
}

.data-table th {
    padding: 14px 16px;
    text-align: left;
    font-weight: 600;
    color: var(--dark);
    border-bottom: 2px solid var(--border);
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.data-table td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
}

.data-table tbody tr {
    transition: background 0.3s;
}

.data-table tbody tr:hover {
    background: rgba(99, 102, 241, 0.05);
}

.data-table tbody tr:active {
    background: var(--light);
}

.row-disabled {
    opacity: 0.5;
}

.badge {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.badge-income {
    background: #d1fae5;
    color: #059669;
}

.badge-expense {
    background: #fee2e2;
    color: #dc2626;
}

.badge-borrow {
    background: #fef3c7;
    color: #d97706;
}

.badge-loan {
    background: #ddd6fe;
    color: #7c3aed;
}

.badge-paid {
    background: #d1fae5;
    color: #059669;
}

.badge-unpaid {
    background: #fee2e2;
    color: #dc2626;
}

.amount-income {
    color: var(--success);
    font-weight: 600;
}

.amount-expense {
    color: var(--danger);
    font-weight: 600;
}

.amount-debt {
    color: var(--warning);
    font-weight: 600;
}

.btn-icon {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    padding: 8px;
    transition: all 0.3s;
    touch-action: manipulation;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
}

.btn-icon:hover {
    background: var(--light);
}

.btn-icon:active {
    transform: scale(1.1);
    background: var(--border);
}

.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
    padding: 20px;
}

.modal-content {
    background: white;
    border-radius: 20px;
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: modalSlide 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal-small {
    max-width: 440px;
}

@keyframes modalSlide {
    from {
        opacity: 0;
        transform: translateY(-30px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 28px;
    border-bottom: 2px solid var(--border);
    background: var(--light);
}

.modal-header h2 {
    font-size: 20px;
    color: var(--dark);
    font-weight: 700;
}

.close {
    font-size: 28px;
    color: var(--text-light);
    cursor: pointer;
    transition: all 0.3s;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    line-height: 1;
}

.close:hover {
    background: rgba(0, 0, 0, 0.05);
}

.close:active {
    background: var(--border);
    color: var(--danger);
}

.modal-content form {
    padding: 28px;
}

.tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 4px;
}

.tabs .tab-btn {
    padding: 12px 20px;
    background: white;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s;
    white-space: nowrap;
    flex-shrink: 0;
    font-size: 14px;
}

.tabs .tab-btn.active {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    border-color: transparent;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.tab-content {
    animation: fadeIn 0.3s ease;
}

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

.profile-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
}

.fab {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    border: none;
    font-size: 28px;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(99, 102, 241, 0.4);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 999;
    transition: all 0.3s;
}

.fab:active {
    transform: scale(0.9);
}

.accounts-quick {
    background: white;
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.accounts-quick h2 {
    font-size: 20px;
    color: var(--dark);
    margin-bottom: 20px;
    font-weight: 700;
}

.accounts-grid-small {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

.account-mini {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px;
    background: var(--light);
    border-radius: var(--radius-sm);
    transition: all 0.3s;
}

.account-mini:hover {
    background: var(--border);
}

.account-mini .account-icon {
    font-size: 32px;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    border-radius: 12px;
    flex-shrink: 0;
}

.account-name {
    font-size: 13px;
    color: var(--text-light);
    margin-bottom: 4px;
    font-weight: 500;
}

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

.account-card {
    background: white;
    border-radius: var(--radius);
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: all 0.3s;
    flex-direction: column;
}

.account-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.account-card .account-icon {
    font-size: 48px;
    width: 72px;
    height: 72px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--light);
    border-radius: 16px;
    flex-shrink: 0;
}

.account-info {
    flex: 1;
    min-width: 0;
}

.account-info h3 {
    font-size: 18px;
    color: var(--dark);
    margin-bottom: 6px;
    font-weight: 600;
}

.account-balance {
    font-size: 15px;
    color: var(--text-light);
    font-weight: 600;
}

.select-with-add {
    display: flex;
    gap: 8px;
    align-items: stretch;
}

.select-with-add select {
    flex: 1;
}

.btn-add-inline {
    width: 44px;
    height: auto;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    border: none;
    font-size: 22px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.3s;
}

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

.fab-menu {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 999;
}

.fab-options {
    position: absolute;
    bottom: 76px;
    right: 0;
    display: none;
    flex-direction: column;
    gap: 12px;
    animation: fadeInUp 0.3s ease;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fab-option {
    background: white;
    color: var(--dark);
    padding: 14px 20px;
    border-radius: 12px;
    border: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    cursor: pointer;
    font-weight: 600;
    white-space: nowrap;
    transition: all 0.3s;
    font-size: 14px;
}

.fab-option:active {
    transform: scale(0.95);
    background: var(--light);
}

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

@media (max-width: 768px) {
    .navbar-menu {
        display: none;
    }
    
    .mobile-menu-btn {
        display: block;
    }
    
    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .page-header h1 {
        font-size: 28px;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .stat-card {
        padding: 20px;
    }
    
    .stat-icon {
        width: 56px;
        height: 56px;
        font-size: 32px;
    }
    
    .stat-value {
        font-size: 22px;
    }
    
    .filters-form {
        grid-template-columns: 1fr;
    }
    
    .card {
        padding: 20px;
    }
    
    .card h2 {
        font-size: 18px;
    }
    
    .transaction-icon {
        width: 44px;
        height: 44px;
        font-size: 18px;
    }
    
    .transaction-category {
        font-size: 14px;
    }
    
    .transaction-amount {
        font-size: 16px;
    }
    
    .fab {
        display: flex;
    }
    
    .page-header .btn,
    .transaction-detail-actions .btn {
        width: 100%;
    }
    
    .header-actions {
        display: none;
    }
    
    .data-table {
        font-size: 13px;
    }
    
    .data-table th,
    .data-table td {
        padding: 12px 10px;
    }
    
    .modal-content {
        margin: 0;
        border-radius: 16px;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .accounts-grid-small {
        grid-template-columns: 1fr;
    }
    
    .accounts-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 20px 16px;
    }
    
    .auth-header h1 {
        font-size: 28px;
    }
    
    .auth-form {
        padding: 24px 20px 32px;
    }
    
    .page-header h1 {
        font-size: 24px;
    }
    
    .stat-card {
        padding: 18px;
        gap: 14px;
    }
    
    .stat-icon {
        width: 52px;
        height: 52px;
        font-size: 28px;
    }
    
    .stat-value {
        font-size: 20px;
    }
    
    .card {
        padding: 18px;
    }
    
    .transaction-item {
        padding: 14px;
        gap: 12px;
    }
    
    .fab {
        width: 56px;
        height: 56px;
        bottom: 20px;
        right: 20px;
        font-size: 24px;
    }
    
    .modal {
        padding: 12px;
    }
    
    .modal-header {
        padding: 20px 18px;
    }
    
    .modal-content form {
        padding: 24px 18px;
    }
    
    .btn-icon {
        width: 34px;
        height: 34px;
        font-size: 16px;
    }
}

@media (hover: hover) {
    .stat-card:hover {
        transform: translateY(-4px);
        box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    }
    
    .transaction-item:hover {
        background: var(--border);
        transform: translateX(4px);
    }
    
    .btn-primary:hover {
        transform: translateY(-2px);
        box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4);
    }
    
    .fab:hover {
        transform: scale(1.1);
        box-shadow: 0 12px 32px rgba(99, 102, 241, 0.5);
    }
    
    .btn-secondary:hover {
        background: var(--light);
        border-color: var(--primary);
    }
}

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--light);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

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

.period-selector {
    display: flex;
    gap: 12px;
    margin-bottom: 28px;
    padding: 6px;
    background: white;
    border-radius: var(--radius);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.period-btn {
    padding: 12px 24px;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s;
    white-space: nowrap;
    flex-shrink: 0;
}

.period-btn:hover {
    background: var(--light);
}

.period-btn.active {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.stat-card-advanced {
    background: white;
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: all 0.3s;
}

.stat-card-advanced:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

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

.stat-label {
    font-size: 13px;
    color: var(--text-light);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-trend {
    font-size: 14px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 20px;
}

.stat-trend.trend-up {
    background: #d1fae5;
    color: #059669;
}

.stat-trend.trend-down {
    background: #fee2e2;
    color: #dc2626;
}

.stat-value-large {
    font-size: 32px;
    font-weight: 700;
    color: var(--dark);
    margin-bottom: 8px;
}

.stat-subtitle {
    font-size: 13px;
    color: var(--text-light);
}

.text-success {
    color: var(--success);
}

.text-danger {
    color: var(--danger);
}

.chart-card-large {
    min-height: 400px;
}

.chart-card-large canvas {
    max-height: 340px;
}

.category-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.category-item {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    padding: 16px;
    background: var(--light);
    border-radius: var(--radius-sm);
    transition: all 0.3s;
}

.category-item:hover {
    background: var(--border);
}

.category-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.category-name {
    font-weight: 600;
    color: var(--dark);
    font-size: 15px;
}

.category-count {
    font-size: 12px;
    color: var(--text-light);
}

.category-amount {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
    min-width: 140px;
}

.category-bar {
    width: 100%;
    height: 6px;
    background: var(--border);
    border-radius: 3px;
    overflow: hidden;
}

.category-bar-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.5s ease;
}

.category-bar-fill.income {
    background: linear-gradient(90deg, var(--success), #059669);
}

.category-bar-fill.expense {
    background: linear-gradient(90deg, var(--danger), #dc2626);
}

.accounts-activity {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.account-activity-item {
    padding: 20px;
    background: var(--light);
    border-radius: var(--radius-sm);
    transition: all 0.3s;
}

.account-activity-item:hover {
    background: var(--border);
}

.account-activity-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.account-icon-small {
    font-size: 28px;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    border-radius: 12px;
    flex-shrink: 0;
}

.account-name-small {
    font-weight: 600;
    color: var(--dark);
    font-size: 15px;
}

.account-activity-bars {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.activity-bar-row {
    display: grid;
    grid-template-columns: 80px 1fr 100px;
    align-items: center;
    gap: 12px;
}

.activity-label {
    font-size: 13px;
    color: var(--text-light);
    font-weight: 500;
}

.activity-bar {
    height: 8px;
    background: var(--border);
    border-radius: 4px;
    overflow: hidden;
}

.activity-bar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.5s ease;
}

.activity-bar-fill.income {
    background: linear-gradient(90deg, var(--success), #059669);
}

.activity-bar-fill.expense {
    background: linear-gradient(90deg, var(--danger), #dc2626);
}

.activity-value {
    font-size: 14px;
    font-weight: 600;
    color: var(--dark);
    text-align: right;
}

@media (max-width: 768px) {
    .period-selector {
        padding: 4px;
        gap: 8px;
    }
    
    .period-btn {
        padding: 10px 16px;
        font-size: 14px;
    }
    
    .stat-value-large {
        font-size: 26px;
    }
    
    .chart-card-large {
        min-height: 320px;
    }
    
    .chart-card-large canvas {
        max-height: 260px;
    }
    
    .accounts-activity {
        grid-template-columns: 1fr;
    }
    
    .activity-bar-row {
        grid-template-columns: 70px 1fr 90px;
        gap: 8px;
    }
    
    .category-amount {
        min-width: 120px;
    }
}

@media (max-width: 480px) {
    .stat-card-advanced {
        padding: 18px;
    }
    
    .stat-value-large {
        font-size: 24px;
    }
    
    .category-item {
        flex-direction: column;
        align-items: stretch;
    }
    
    .category-amount {
        min-width: auto;
        align-items: flex-start;
    }
}

.budgets-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 20px;
    margin-bottom: 28px;
}

.budget-card {
    background: white;
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    display: flex;
    flex-direction: column;
    gap: 16px;
    transition: all 0.3s;
}

.budget-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.budget-inactive {
    background: var(--light);
    opacity: 0.7;
}

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

.budget-header > div:first-child {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.budget-icon {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--light);
    border-radius: var(--radius-sm);
    font-size: 22px;
    flex-shrink: 0;
}

.budget-name {
    font-size: 18px;
    font-weight: 700;
    color: var(--dark);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.budget-actions {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

.budget-amounts {
    display: flex;
    justify-content: space-between;
    gap: 16px;
}

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

.amount-label {
    display: block;
    font-size: 13px;
    color: var(--text-light);
    margin-bottom: 4px;
    font-weight: 500;
}

.amount-value {
    font-size: 20px;
    font-weight: 700;
    color: var(--dark);
}

.budget-progress {
    margin-top: 4px;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--border);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.4s ease-out;
}

.progress-success {
    background: linear-gradient(90deg, var(--success), #059669);
}
.progress-warning {
    background: linear-gradient(90deg, var(--warning), #d97706);
}
.progress-danger {
    background: linear-gradient(90deg, var(--danger), #dc2626);
}

.progress-label {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    color: var(--text-light);
    margin-top: 8px;
    font-weight: 500;
}

.budget-period {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    color: var(--text-light);
    border-top: 1px solid var(--border);
    padding-top: 12px;
    margin-top: 12px;
}

.budget-alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 14px;
    margin-top: 8px;
    text-align: center;
}

.budget-alert-warning {
    background: #fef3c7; /* Копируем стиль .badge-borrow */
    color: #d97706;
}

.budget-alert-danger {
    background: #fee2e2; /* Копируем стиль .badge-expense */
    color: #dc2626;
}

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

    .budget-card {
        padding: 20px;
    }

    .budget-name {
        font-size: 16px;
    }

    .amount-value {
        font-size: 18px;
    }
}


.notification-container {
    position: fixed;
    /* 70px (высота навбара) + 10px отступ */
    top: 80px; 
    right: 20px;
    z-index: 2000; /* Поверх всего */
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 320px;
    max-width: 90%;
}

.notification {
    background: white;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    /* Левая цветная полоска */
    border-left: 5px solid;
    /* Анимация появления */
    animation: slideInRight 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 1;
    transition: opacity 0.3s, transform 0.3s;
    word-break: break-word; /* Перенос длинных слов */
}

/* Анимация исчезновения */
.notification.closing {
    opacity: 0;
    transform: translateX(calc(100% + 20px));
}

/* Зеленая полоска для успеха */
.notification.success {
    border-color: var(--success);
}

/* Красная полоска для ошибки */
.notification.error {
    border-color: var(--danger);
}

/* Текст уведомления */
.notification span:first-child {
    flex-grow: 1;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.5;
    color: var(--dark);
    padding-right: 10px;
}

/* Кнопка "X" (закрыть) */
.notification .close-btn {
    font-size: 24px;
    color: var(--text-light);
    cursor: pointer;
    transition: all 0.3s;
    padding: 0 4px;
    margin-left: 16px;
    line-height: 1;
    align-self: flex-start; /* На случай, если текст многострочный */
}

.notification .close-btn:hover {
    color: var(--dark);
}

/* Анимация появления (слайд справа) */
@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(calc(100% + 20px));
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Адаптивность для мобильных */
@media (max-width: 480px) {
    .notification-container {
        top: 80px;
        right: 16px;
        left: 16px;
        width: auto;
        max-width: none;
    }
}

@media (max-width: 480px) {
    .notification-container {
        top: 80px;
        right: 16px;
        left: 16px;
        width: auto;
        max-width: none;
    }
}

/* Стили для целей накоплений */
.savings-goals-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 20px;
    margin-bottom: 28px;
}

.goal-completed {
    position: relative;
    overflow: hidden;
}

.goal-completed::before {
    content: '✓';
    position: absolute;
    top: 16px;
    right: 16px;
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, var(--success), #059669);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: bold;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
    z-index: 1;
}

.goal-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.goal-header h3 {
    flex: 1;
    font-size: 18px;
    font-weight: 700;
    color: var(--dark);
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.goal-icon {
    font-size: 32px;
    width: 52px;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--light);
    border-radius: var(--radius-sm);
    flex-shrink: 0;
}

.goal-actions {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

.goal-description {
    color: var(--text-light);
    font-size: 14px;
    margin-bottom: 16px;
    line-height: 1.5;
    min-height: 42px;
}

.goal-progress {
    margin-bottom: 16px;
}

.progress-bar {
    width: 100%;
    height: 12px;
    background: var(--border);
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 8px;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    border-radius: 6px;
    transition: width 0.5s ease-out;
    box-shadow: inset 0 2px 4px rgba(255, 255, 255, 0.3);
}

.goal-completed .progress-bar-fill {
    background: linear-gradient(90deg, var(--success), #059669);
}

.progress-text {
    display: flex;
    justify-content: space-between;
    font-size: 15px;
    font-weight: 600;
    color: var(--dark);
}

.goal-footer {
    display: flex;
    justify-content: space-between;
    padding-top: 12px;
    border-top: 1px solid var(--border);
    font-size: 13px;
    color: var(--text-light);
    font-weight: 500;
}

.card-placeholder {
    text-align: center;
    padding: 48px 24px;
    background: var(--light);
    border: 2px dashed var(--border);
}

.card-placeholder p {
    font-size: 18px;
    color: var(--text-light);
    margin-bottom: 20px;
}

@media (max-width: 768px) {
    .savings-goals-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .goal-header h3 {
        font-size: 16px;
    }
    
    .goal-icon {
        width: 48px;
        height: 48px;
        font-size: 28px;
    }
    
    .goal-completed::before {
        width: 40px;
        height: 40px;
        font-size: 20px;
    }
}

@media (max-width: 480px) {
    .goal-header {
        flex-wrap: wrap;
    }
    
    .goal-actions {
        width: 100%;
        justify-content: flex-end;
        margin-top: 8px;
    }
    
    .card-placeholder {
        padding: 36px 20px;
    }
    
    .card-placeholder p {
        font-size: 16px;
    }
}

/* Navbar */
.navbar {
    background: white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.navbar-container {
    max-width: none;
    margin: 0;
    padding: 0 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 70px;
    position: relative;
}

.navbar-brand {
    display: none;
}

.navbar-menu {
    display: none;
}

.navbar-menu-right {
    display: none;
}

.nav-icon-btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    padding: 0;
    border-radius: 50%;
    transition: all 0.3s;
    text-decoration: none;
    color: var(--dark);
}

.nav-icon-btn:hover {
    background: var(--light);
}

.btn-logout {
    background: none !important;
    box-shadow: none !important;
}

.btn-logout:hover {
    background: rgba(239, 68, 68, 0.1) !important;
    color: var(--danger) !important;
    transform: none !important;
}

.sidebar-toggle {
    display: block;
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    padding: 8px 12px;
    color: var(--dark);
    transition: all 0.3s;
    border-radius: 8px;
    position: absolute;
    left: 20px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-toggle:hover {
    background: var(--light);
}

.sidebar-toggle:active {
    background: var(--border);
    transform: scale(0.95);
}

/* Sidebar */
.sidebar {
    position: fixed;
    left: -280px;
    top: 0;
    width: 280px;
    height: 100vh;
    background: white;
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.1);
    transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1100;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.sidebar.active {
    left: 0;
}

.sidebar-header {
    padding: 8px 24px;
    border-bottom: 2px solid var(--border);
    background: var(--light);
}

.sidebar-brand {
    font-size: 24px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-decoration: none;
    display: block;
}

.sidebar-content {
    padding: 20px 0;
    flex: 1;
    overflow-y: auto;
}

.sidebar-section {
    margin-bottom: 24px;
}

.sidebar-section-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-light);
    padding: 8px 24px;
    margin-bottom: 8px;
}

.sidebar-menu {
    list-style: none;
    padding: 0;
    margin: 0;
}

.navbar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 24px;
    color: var(--text);
    text-decoration: none;
    transition: all 0.3s;
    font-weight: 500;
    border-left: 3px solid transparent;
}

.navbar-link:hover {
    background: var(--light);
    color: var(--primary);
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 24px;
    color: var(--text);
    text-decoration: none;
    transition: all 0.3s;
    font-weight: 500;
    border-left: 3px solid transparent;
}

.sidebar-link:hover {
    background: var(--light);
    color: var(--primary);
}

.sidebar-link.active {
    background: linear-gradient(90deg, rgba(99, 102, 241, 0.1), transparent);
    color: var(--primary);
    border-left-color: var(--primary);
    font-weight: 600;
}

.sidebar-icon {
    font-size: 20px;
    width: 24px;
    text-align: center;
    flex-shrink: 0;
}

.navbar-icon {
    font-size: 20px;
    width: 24px;
    text-align: center;
    flex-shrink: 0;
}

.navbar-text {
    flex: 1;
    font-size: 15px;
}

.sidebar-text {
    flex: 1;
    font-size: 15px;
}

.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
    z-index: 1050;
}

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

/* Адаптация контента под sidebar */
@media (min-width: 1200px) {
    .sidebar {
        left: 0;
    }
    
    .sidebar-toggle {
        display: none;
    }
    
    .sidebar-overlay {
        display: none;
    }
    
    .navbar {
        margin-left: 280px;
    }
    
    .container {
        margin-left: 280px;
    }
}

@media (max-width: 1199px) {
    .sidebar {
        top: 70px;
        height: calc(100vh - 70px);
    }
    
    .sidebar-header {
        display: none;
    }
}

/* Скроллбар для sidebar */
.sidebar::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-track {
    background: transparent;
}

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

.sidebar::-webkit-scrollbar-thumb:hover {
    background: var(--text-light);
}

/* Мобильный бренд */
.navbar-brand-mobile {
    font-size: 20px;
    font-weight: 700;
    color: var(--dark);
    text-decoration: none;
}

/* На десктопе прячем мобильный бренд и правое меню */
@media (min-width: 1200px) {
    .navbar-brand-mobile {
        display: none;
    }
    
    .navbar-menu-right {
        display: none;
    }
    
    .sidebar-toggle {
        display: none;
    }
    
    /* Центрируем контейнер с учетом sidebar */
    .container {
        margin-left: 280px;
        margin-right: 0;
        max-width: calc(1400px);
        padding-left: 20px;
        padding-right: 20px;
    }
    
    .navbar {
        margin-left: 280px;
    }
}

/* На мобилке прячем иконки из навбара, они в sidebar */
@media (max-width: 1199px) {
    .navbar-menu-right {
        display: flex;
    }
    
    .navbar-brand-mobile {
        display: block;
    }
}

.sidebar-profile-section {
    display: none;
    margin-top: auto;
    padding-top: 20px;
    border-top: 2px solid var(--border);
}

@media (min-width: 1200px) {
    .sidebar-profile-section {
        display: block;
    }
    
    .sidebar-content {
        display: flex;
        flex-direction: column;
        height: calc(100vh - 70px);
    }
}

.sidebar-profile-mobile {
    display: block;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 2px solid var(--border);
}

@media (min-width: 1200px) {
    .sidebar {
        left: 0;
    }
    
    .sidebar-toggle {
        display: none;
    }
    
    .sidebar-overlay {
        display: none;
    }
    
    /* Navbar: только иконки справа */
    .navbar {
        margin-left: 280px;
    }
    
    .navbar-brand-mobile {
        display: none;
    }
    
    .navbar-container {
        justify-content: flex-end;
    }
    
    .navbar-menu-right {
        list-style: none;
        display: flex;
    }
    
    /* Прячем профиль из sidebar */
    .sidebar-profile-mobile {
        display: none;
    }
    
    /* Контейнер по центру */
    .container {
        margin-left: 22%;
        max-width: calc(1400px);
    }
}

/* Мобилка */
@media (max-width: 1199px) {
    .sidebar {
        top: 70px;
        height: calc(100vh - 70px);
    }
    
    .sidebar-header {
        display: none;
    }
    
    .navbar-menu-right {
        display: none;
    }
}

.tag-select-container { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.tag-select-item { display: block; }
.tag-select-item input { display: none; }
.tag-select-item label {
    display: block; padding: 8px 16px; border-radius: 20px; background: #e5e7eb;
    cursor: pointer; font-size: 13px; transition: all 0.2s;
    border: 2px solid transparent;
    font-weight: 500;
    opacity: 0.6;
}
.tag-select-item input:checked + label { 
    opacity: 1;
    transform: scale(1.05);
    border: 2px solid #1f2937;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}
.tag-select-item label:hover { opacity: 0.9; transform: scale(1.02); }
.attachment-list { list-style: none; padding: 0; margin-top: 10px; }
.attachment-item { 
    display: flex; justify-content: space-between; align-items: center; 
    padding: 10px; border: 1px solid #eee; border-radius: 8px; margin-bottom: 5px;
    background: #f9fafb;
}
.file-upload-area {
    border: 2px dashed #ddd;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    margin-top: 10px;
}
.file-upload-area:hover { border-color: #6366f1; background: #f9fafb; }
.select-with-add { display: flex; gap: 5px; }
.select-with-add select { flex: 1; }
.btn-add-inline {
    background: #6366f1;
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
}
.btn-add-inline:hover { background: #4f46e5; }

.financial-health-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: var(--radius);
    padding: 32px;
    margin-bottom: 28px;
    box-shadow: 0 8px 24px rgba(102, 126, 234, 0.3);
}

.financial-health-card h2 {
    color: white;
    margin-bottom: 24px;
}

.health-grid {
    display: grid;
    grid-template-columns: 200px 1fr;
    gap: 32px;
    align-items: start;
}

.health-score-circle {
    position: relative;
    width: 160px;
    height: 160px;
    margin: 0 auto;
}

.health-score-circle svg {
    transform: rotate(-90deg);
    width: 100%;
    height: 100%;
}

.health-score-value {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}

.health-score-number {
    font-size: 48px;
    font-weight: 700;
    line-height: 1;
    margin-bottom: 8px;
}

.health-score-label {
    font-size: 14px;
    opacity: 0.95;
    font-weight: 500;
}

.recommendations-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.recommendation-item {
    padding: 16px 20px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    margin-bottom: 12px;
    line-height: 1.6;
    font-size: 15px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.recommendation-success {
    background: rgba(16, 185, 129, 0.2);
    border-color: rgba(16, 185, 129, 0.3);
}

.records-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.record-card {
    padding: 24px;
    background: var(--light);
    border-radius: 12px;
    transition: all 0.3s;
    border: 2px solid transparent;
}

.record-card:hover {
    background: white;
    border-color: var(--primary);
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
}

.record-label {
    font-size: 13px;
    color: var(--text-light);
    margin-bottom: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.record-value {
    font-size: 22px;
    font-weight: 700;
    color: var(--dark);
    margin-bottom: 8px;
}

.record-subtitle {
    font-size: 13px;
    color: var(--text-light);
}

.top-transactions-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.summary-item {
    padding: 20px;
    background: var(--light);
    border-radius: 12px;
    transition: all 0.3s;
}

.summary-item:hover {
    background: white;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.summary-label {
    font-size: 13px;
    color: var(--text-light);
    margin-bottom: 8px;
    font-weight: 500;
}

.summary-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--dark);
}

.expense-structure-item {
    margin-bottom: 24px;
}

.expense-structure-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.expense-structure-name {
    font-weight: 600;
    font-size: 15px;
    color: var(--dark);
}

.expense-structure-amount {
    font-weight: 700;
    font-size: 16px;
    color: var(--danger);
}

.expense-structure-bar {
    width: 100%;
    height: 14px;
    background: var(--border);
    border-radius: 7px;
    overflow: hidden;
    position: relative;
}

.expense-structure-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--danger), #dc2626);
    border-radius: 7px;
    transition: width 0.6s ease-out;
    box-shadow: inset 0 2px 4px rgba(255, 255, 255, 0.3);
}

.expense-structure-details {
    font-size: 13px;
    color: var(--text-light);
    margin-top: 6px;
}

.filters-form {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    align-items: end;
}

.filter-group {
    display: flex;
    flex-direction: column;
}

.filter-group label {
    font-size: 14px;
    font-weight: 600;
    color: var(--dark);
    margin-bottom: 8px;
}

.filter-group select,
.filter-group input[type="date"] {
    width: 100%;
    padding: 12px 14px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    background: var(--light);
    transition: all 0.3s;
    font-family: inherit;
}

.filter-group select:focus,
.filter-group input[type="date"]:focus {
    outline: none;
    border-color: var(--primary);
    background: white;
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

.filter-actions {
    display: flex;
    gap: 8px;
}

.stat-card-advanced {
    background: white;
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: all 0.3s;
}

.stat-card-advanced:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

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

.stat-label {
    font-size: 13px;
    color: var(--text-light);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-trend {
    font-size: 14px;
    font-weight: 700;
    padding: 6px 12px;
    border-radius: 20px;
}

.stat-trend.trend-up {
    background: #d1fae5;
    color: #059669;
}

.stat-trend.trend-down {
    background: #fee2e2;
    color: #dc2626;
}

.stat-value-large {
    font-size: 32px;
    font-weight: 700;
    color: var(--dark);
    margin-bottom: 12px;
    line-height: 1.2;
}

.stat-subtitle {
    font-size: 13px;
    color: var(--text-light);
    line-height: 1.6;
}

.text-success {
    color: var(--success);
}

.text-danger {
    color: var(--danger);
}

.category-item .category-count {
    line-height: 1.6;
}

.account-activity-header {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    margin-bottom: 16px;
}

.top-transaction-card {
    background: white;
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

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

    .health-score-circle {
        width: 140px;
        height: 140px;
    }

    .health-score-number {
        font-size: 40px;
    }

    .top-transactions-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .financial-health-card {
        padding: 24px 20px;
    }

    .health-score-circle {
        width: 120px;
        height: 120px;
    }

    .health-score-number {
        font-size: 36px;
    }

    .records-grid {
        grid-template-columns: 1fr;
    }

    .filters-form {
        grid-template-columns: 1fr;
    }

    .stat-value-large {
        font-size: 26px;
    }

    .summary-grid {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    }

    .summary-value {
        font-size: 24px;
    }

    .expense-structure-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }
}

@media (max-width: 480px) {
    .financial-health-card {
        padding: 20px 16px;
    }

    .recommendation-item {
        padding: 12px 16px;
        font-size: 14px;
    }

    .record-card {
        padding: 18px;
    }

    .record-value {
        font-size: 20px;
    }

    .stat-card-advanced {
        padding: 20px;
    }

    .stat-value-large {
        font-size: 24px;
    }

    .expense-structure-bar {
        height: 10px;
    }
}

.chart-card-large {
    min-height: 400px;
}

.chart-card-large canvas {
    max-height: 340px;
}

@media (hover: hover) {
    .record-card:hover {
        transform: translateY(-4px);
    }

    .summary-item:hover {
        transform: translateY(-2px);
    }
}

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

.filter-checkbox-group input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.filter-checkbox-group span {
    font-size: 14px;
    font-weight: 500;
    color: var(--dark);
}

.card-gradient {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.card-gradient h2,
.card-gradient h3 {
    color: white;
}

.health-recommendations {
    margin-top: 0;
}

.health-recommendations h3 {
    font-size: 18px;
    margin-bottom: 16px;
    font-weight: 700;
}

.percentage-badge {
    display: inline-block;
    padding: 4px 10px;
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary);
    border-radius: 12px;
    font-size: 12px;
    font-weight: 700;
    margin-left: 8px;
}

.amount-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    background: var(--light);
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
}

.transaction-meta {
    font-size: 12px;
    color: var(--text-light);
    margin-top: 4px;
}

.stat-divider {
    display: inline-block;
    margin: 0 6px;
    color: var(--border);
}

/* Улучшенные стили для фильтров */
.filters-card {
    margin-bottom: 24px;
    background: white;
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.filters-form {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    align-items: end;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.filter-group label {
    font-size: 14px;
    font-weight: 600;
    color: var(--dark);
    margin-bottom: 0;
}

.filter-group select,
.filter-group input[type="date"] {
    width: 100%;
    padding: 12px 14px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    background: var(--light);
    transition: all 0.3s;
    font-family: inherit;
}

.filter-group select:focus,
.filter-group input[type="date"]:focus {
    outline: none;
    border-color: var(--primary);
    background: white;
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

/* Стили для checkbox "Сравнение" */
.filter-checkbox-wrapper {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.filter-checkbox-wrapper label:first-child {
    font-size: 14px;
    font-weight: 600;
    color: var(--dark);
    margin-bottom: 4px;
}

.filter-checkbox-group {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    background: var(--light);
    border-radius: var(--radius-sm);
    border: 2px solid var(--border);
    transition: all 0.3s;
    cursor: pointer;
    min-height: 48px;
}

.filter-checkbox-group:hover {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.05);
}

.filter-checkbox-group input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
    margin: 0;
    accent-color: var(--primary);
}

.filter-checkbox-group span {
    font-size: 14px;
    font-weight: 500;
    color: var(--dark);
    user-select: none;
}

/* Группа кнопок фильтров */
.filter-actions {
    display: flex;
    gap: 8px;
    align-items: flex-end;
}

.filter-actions .btn {
    min-width: 120px;
    white-space: nowrap;
}

/* Адаптив для фильтров */
@media (max-width: 1024px) {
    .filters-form {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    }
}

@media (max-width: 768px) {
    .filters-form {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .filter-actions {
        flex-direction: column;
        width: 100%;
    }
    
    .filter-actions .btn {
        width: 100%;
    }
}

/* ======= СТИЛИ ДЛЯ ШАБЛОНОВ ======= */
.templates-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
}

.template-card {
    background: white;
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: all 0.3s;
}

.template-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

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

.template-header h3 {
    font-size: 18px;
    font-weight: 700;
    color: var(--dark);
    margin: 0;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.template-details {
    margin-bottom: 16px;
    padding: 16px;
    background: var(--light);
    border-radius: var(--radius-sm);
}

.template-details p {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    font-size: 14px;
    color: var(--text);
}

.template-details p:last-child {
    margin-bottom: 0;
}

.template-details strong {
    color: var(--text-light);
    font-weight: 600;
    font-size: 13px;
}

.template-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.template-actions form {
    flex: 1;
    min-width: 100px;
}

form .btn-sm {
    width: 100%;
}

/* ======= СТИЛИ ДЛЯ ЦЕЛЕЙ НАКОПЛЕНИЙ ======= */
.savings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
}

.savings-card {
    background: white;
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: all 0.3s;
}

.savings-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.savings-completed {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.1), rgba(5, 150, 105, 0.05));
    border: 2px solid var(--success);
    position: relative;
    overflow: hidden;
}

.savings-completed::before {
    content: '✓';
    position: absolute;
    top: 16px;
    right: 16px;
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, var(--success), #059669);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: bold;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
    z-index: 1;
}

.savings-header {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 20px;
}

.savings-icon {
    font-size: 36px;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--light);
    border-radius: var(--radius-sm);
    flex-shrink: 0;
}

.savings-header > div {
    flex: 1;
    min-width: 0;
}

.savings-header h3 {
    font-size: 18px;
    font-weight: 700;
    color: var(--dark);
    margin: 0 0 4px 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.savings-date {
    font-size: 13px;
    color: var(--text-light);
    font-weight: 500;
    margin: 0;
}

.savings-progress {
    margin-bottom: 16px;
}

.savings-amounts {
    display: flex;
    justify-content: space-between;
    font-size: 15px;
    font-weight: 600;
    color: var(--dark);
    margin-top: 10px;
}

.savings-description {
    color: var(--text-light);
    font-size: 14px;
    margin-bottom: 16px;
    line-height: 1.6;
    min-height: 42px;
}

.savings-actions {
    display: flex;
    gap: 8px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}


.savings-actions form {
    flex: 1;
}

/* Адаптив для шаблонов и целей */
@media (max-width: 768px) {
    .templates-grid,
    .savings-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .template-card,
    .savings-card {
        padding: 20px;
    }
    
    .template-header h3,
    .savings-header h3 {
        font-size: 16px;
    }
    
    .savings-icon {
        width: 52px;
        height: 52px;
        font-size: 32px;
    }
    
    .savings-completed::before {
        width: 40px;
        height: 40px;
        font-size: 20px;
    }
}

@media (max-width: 480px) {
    .template-actions,
    .savings-actions {
        flex-direction: column;
    }
    
    .btn-sm {
        width: 100%;
        min-width: auto;
    }
    
    .template-actions form,
    .savings-actions form {
        width: 100%;
    }
}

/* Стили для целей накоплений */
.savings-goals-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 20px;
    margin-bottom: 28px;
}

.pagination {
    display: flex;
    justify-content: center;
    gap: 5px;
    margin: 20px 0;
    flex-wrap: wrap;
}

.pagination a,
.pagination span {
    display: inline-block;
    padding: 8px 12px;
    text-decoration: none;
    border: 1px solid #ddd;
    color: #333;
    border-radius: 5px;
    transition: background 0.3s, color 0.3s;
    background: white;
}

.pagination a:hover {
    background-color: #007bff;
    color: #fff;
}

.pagination .active {
    background-color: #007bff;
    color: #fff;
    border-color: #007bff;
    pointer-events: none;
}

.pagination .disabled {
    color: #aaa;
    border-color: #ddd;
    pointer-events: none;
}

.account-header, .account-header div { 
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.highlight-card {background: #f9fbff; border: 1px solid #e3e9ff;}
.highlight-card .card-label {text-transform: uppercase; font-size: 12px; color: #7480a7; letter-spacing: .08em;}
.highlight-card .sub-info {font-size: 13px; color: #6b7280;}
.income-list div {display: flex; justify-content: space-between; margin-bottom: 6px; font-size: 14px;}
.income-list strong {font-size: 16px;}
.details-list {list-style: none; padding: 0; margin: 0;}
.details-list li {display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px dashed #edf0f7;}
.details-list span {color: #6b7280;}
.days-grid {display:flex; flex-wrap:wrap; gap:8px; margin-top:10px;}
.day-pill {padding:6px 12px; border-radius:999px; border:1px solid #e5e7eb; font-size:13px; color:#6b7280;}
.day-pill.day-active {background:#eef6ff; border-color:#60a5fa; color:#2563eb;}
.btn.btn-outline {border:1px solid #d1d5db; background:#fff; color:#374151;}
.comment-block {margin-top:15px; padding:12px; background:#f8fafc; border-radius:8px;}
.comment-block .card-label {margin-bottom:4px;}
.data-table th:nth-child(4), .data-table td:nth-child(4) {text-align:left;}



.page-header {
    margin-bottom: 30px;
    color: white;
}

.page-header h1 {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 8px;
}

.page-header p {
    font-size: 16px;
    opacity: 0.9;
}

.filters-card {
    background: white;
    border-radius: 20px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.1);
}

.filters-form {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 20px;
    align-items: end;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.filter-group label {
    font-size: 11px;
    font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

.filter-group select:not([multiple]),
.filter-group input {
    padding: 14px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    font-size: 15px;
    transition: all 0.3s ease;
    background: white;
    font-weight: 500;
    color: #1e293b;
}

.filter-group select:not([multiple]):focus,
.filter-group input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
}

.filter-actions {
    grid-column: span 6;
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.btn {
    padding: 14px 28px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 15px;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-secondary {
    background: #667eea;
    color: white;
}

.btn-secondary:hover {
    background: #5568d3;
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.4);
}

.btn-link {
    background: transparent;
    color: #64748b;
    border: 2px solid #e2e8f0;
}

.btn-link:hover {
    color: #475569;
    background: #f8fafc;
    border-color: #cbd5e1;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.stat-card {
    display: flex;
    background: white;
    border-radius: 20px;
    padding: 28px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    flex-direction: column;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #667eea, #764ba2);
}

.stat-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 12px 30px rgba(0,0,0,0.15);
}

.stat-card h3 {
    font-size: 11px;
    font-weight: 700;
    color: #94a3b8;
    margin: 0 0 16px 0;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.stat-value {
    font-size: 32px;
    font-weight: 800;
    margin: 0 0 8px 0;
    line-height: 1;
    letter-spacing: -0.5px;
}

.stat-subtitle {
    font-size: 13px;
    color: #94a3b8;
    margin: 0;
    font-weight: 500;
}

.text-success { color: #10b981; }
.text-danger { color: #ef4444; }
.text-info { color: #3b82f6; }
.text-warning { color: #f59e0b; }

.chart-card {
    background: white;
    border-radius: 20px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
}

.chart-card h2 {
    font-size: 20px;
    font-weight: 700;
    margin: 0 0 24px 0;
    color: #1e293b;
}

.chart-container {
    position: relative;
    height: 350px;
    margin-bottom: 20px;
}

.data-table-wrapper {
    overflow-x: auto;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
}

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

.data-table thead {
    background: #f8fafc;
}

.data-table th {
    padding: 18px;
    text-align: left;
    font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: 0.8px;
    border-bottom: 2px solid #e2e8f0;
}

.data-table td {
    padding: 18px;
    border-bottom: 1px solid #f1f5f9;
    color: #334155;
}

.data-table tbody tr:hover {
    background: #f8fafc;
}

.category-cell {
    display: flex;
    align-items: center;
    gap: 14px;
    font-weight: 600;
}

.category-icon {
    font-size: 24px;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    background: #f1f5f9;
}

.amount-cell {
    font-weight: 700;
    font-size: 15px;
}

.count-badge {
    display: inline-block;
    padding: 6px 14px;
    background: #e0e7ff;
    color: #4f46e5;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
}

.choices__inner {
    border: 2px solid #e2e8f0 !important;
    border-radius: 12px !important;
    padding: 10px 14px !important;
    min-height: 52px !important;
    background: white !important;
    transition: all 0.3s ease !important;
}

.choices__inner:focus,
.choices.is-focused .choices__inner {
    border-color: #667eea !important;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1) !important;
}

.choices__list--multiple .choices__item {
    background: #667eea !important;
    border: none !important;
    border-radius: 10px !important;
    padding: 8px 14px !important;
    margin: 3px !important;
    font-size: 13px !important;
    font-weight: 600 !important;
}

.choices__button {
    border-left: 1px solid rgba(255,255,255,0.3) !important;
    opacity: 1 !important;
}

.choices__list--dropdown {
    border: 2px solid #e2e8f0 !important;
    border-radius: 12px !important;
    margin-top: 4px !important;
}

.choices__list--dropdown .choices__item--selectable {
    padding: 14px 18px !important;
    font-size: 14px !important;
    transition: all 0.2s ease !important;
}

.choices__list--dropdown .choices__item--selectable:hover {
    background: #f1f5f9 !important;
}

.choices__list--dropdown .choices__item--selectable.is-highlighted {
    background: #667eea !important;
    color: white !important;
}

.section-title {
    font-size: 24px;
    font-weight: 700;
    color: white;
    margin: 50px 0 25px 0;
    padding-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(500px, 1fr));
    gap: 24px;
    margin-bottom: 30px;
}

.btn-sm {
    flex: 1;
    min-width: 100px;
    padding: 10px 16px;
    font-size: 13px;
}

.account-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.savings-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}


@media (max-width: 1200px) {
    .filters-form {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .filter-actions {
        grid-column: span 3;
    }
}

@media (max-width: 768px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .filters-form {
        grid-template-columns: 1fr;
    }
    
    .filter-actions {
        grid-column: span 1;
        flex-direction: column;
    }
    
    .charts-grid {
        grid-template-columns: 1fr;
    }
    
    .chart-container {
        height: 280px;
    }
    
    .stat-card {
        padding: 24px;
    }
    
    .stat-value {
        font-size: 28px;
    }
    
    .page-header h1 {
        font-size: 26px;
    }
    
    .data-table {
        font-size: 13px;
    }
    
    .data-table th,
    .data-table td {
        padding: 14px 10px;
    }
    
    .category-icon {
        width: 40px;
        height: 40px;
        font-size: 20px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 15px;
    }
    
    .filters-card {
        padding: 20px;
    }
    
    .chart-card {
        padding: 20px;
    }
    
    .stat-card h3 {
        font-size: 10px;
    }
    
    .stat-value {
        font-size: 24px;
    }
    
    .stat-subtitle {
        font-size: 12px;
    }
}


/* Navbar */
.navbar {
    background: white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    position: sticky;
    top: 0;
    z-index: 1000;
    display: flex;
    justify-content: center;
}

.navbar-container {
    max-width: none;
    margin: 0;
    width: 100%;
    padding: 0 20px;
    display: grid;
    grid-template-columns: 50px 1fr 50px;
    align-items: center;
    height: 50px;
}

.sidebar-toggle {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    padding: 8px;
    color: var(--dark);
    transition: all 0.3s;
    border-radius: 8px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    justify-self: start;
}

.sidebar-toggle:hover {
    background: var(--light);
}

.sidebar-toggle:active {
    background: var(--border);
    transform: scale(0.95);
}

/* Логотип в центре */
.navbar-brand-center {
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    justify-self: center;
}

/* Стили для логотипа в навбаре */
.navbar-logo {
    height: 40px;
    width: auto;
    object-fit: contain;
    display: block;
}

/* Стили для логотипа в sidebar */
.sidebar-logo {
    height: 50px;
    width: auto;
    object-fit: contain;
    display: block;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}

.navbar-brand-mobile {
    display: none;
}

.navbar-brand {
    display: none;
}

.navbar-menu {
    display: none;
}

.navbar-menu-right {
    display: none;
}

/* На десктопе (1200px и больше) прячем мобильные элементы */
@media (min-width: 1200px) {
    .navbar-brand-center {
        display: none;
    }
    
    .sidebar-toggle {
        display: none;
    }
    
    .navbar-container {
        display: flex;
        justify-content: flex-end;
    }
}

/* Мобилка и планшеты */
@media (max-width: 1199px) {
    .navbar-container {
        display: flex;
        grid-template-columns: 50px 1fr 50px;
    }
    
    .navbar-logo {
        height: 35px;
    }
}

/* Совсем маленькие экраны */
@media (max-width: 480px) {
    .navbar-logo {
        height: 30px;
    }
    
    .navbar-container {
        padding: 0 16px;
        grid-template-columns: 40px 1fr 40px;
    }
}

.transactions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.transaction-card {
    background: white;
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: all 0.3s;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.transaction-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.transaction-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    padding-bottom: 16px;
    border-bottom: 2px solid var(--light);
}

.transaction-card-title {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 0;
}

.transaction-card-title .transaction-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    flex-shrink: 0;
}

.transaction-card-title .transaction-icon.income {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.15), rgba(5, 150, 105, 0.1));
}

.transaction-card-title .transaction-icon.expense {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.15), rgba(220, 38, 38, 0.1));
}

.transaction-card-title h3 {
    font-size: 16px;
    font-weight: 700;
    color: var(--dark);
    margin: 0 0 4px 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.transaction-card-actions {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

.transaction-card-details {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.transaction-card-amount {
    font-size: 28px;
    font-weight: 700;
    text-align: center;
    padding: 16px;
    border-radius: var(--radius-sm);
}

.transaction-card-amount.income {
    color: var(--success);
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.1), rgba(5, 150, 105, 0.05));
}

.transaction-card-amount.expense {
    color: var(--danger);
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.1), rgba(220, 38, 38, 0.05));
}

.transaction-card-info {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.transaction-card-info p {
    display: flex;
    justify-content: space-between;
    font-size: 14px;
    color: var(--text);
    margin: 0;
    padding: 8px 0;
    border-bottom: 1px dashed var(--border);
}

.transaction-card-info p:last-child {
    border-bottom: none;
}

.transaction-card-info strong {
    color: var(--text-light);
    font-weight: 600;
    font-size: 13px;
}

.transaction-card-comment {
    padding: 12px 16px;
    background: var(--light);
    border-radius: var(--radius-sm);
    font-size: 14px;
    color: var(--text);
    line-height: 1.6;
}

.transaction-card-comment p {
    margin: 0;
}

.transaction-card-footer {
    display: flex;
    gap: 8px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

.transaction-card-footer .btn {
    flex: 1;
}

.empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    color: var(--text-light);
    font-size: 18px;
}

@media (max-width: 768px) {
    .transactions-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .transaction-card {
        padding: 20px;
    }
    
    .transaction-card-amount {
        font-size: 24px;
        padding: 14px;
    }
    
    .transaction-card-title h3 {
        font-size: 15px;
    }
}

@media (max-width: 480px) {
    .transaction-card-actions {
        width: 100%;
        justify-content: flex-end;
    }
}

.transaction-detail-header {
    text-align: center;
    padding: 40px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px 12px 0 0;
    color: white;
}

.transaction-detail-header.income {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
}

.transaction-detail-header.expense {
    background: linear-gradient(135deg, #eb3349 0%, #f45c43 100%);
}

.transaction-type-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin-bottom: 20px;
}

.transaction-icon-large {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
}

.transaction-type-text {
    font-size: 20px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.transaction-amount-large {
    font-size: 48px;
    font-weight: 700;
    margin-bottom: 10px;
}

.transaction-commission {
    font-size: 16px;
    opacity: 0.9;
    font-weight: 500;
}

.transaction-detail-body {
    padding: 30px;
}

.detail-row {
    display: grid;
    grid-template-columns: 200px 1fr;
    gap: 20px;
    padding: 20px 0;
    border-bottom: 1px solid #eee;
}

.detail-row-full {
    grid-template-columns: 1fr;
}

.detail-row:last-of-type {
    border-bottom: none;
}

.detail-label {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    color: #555;
}

.detail-icon {
    font-size: 20px;
}

.detail-value {
    display: flex;
    align-items: center;
    color: #333;
    font-size: 16px;
}

.page-header-btn { 
    display: flex;
}

.detail-comment {
    white-space: pre-wrap;
    line-height: 1.6;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    margin-top: 10px;
}

.tags-display {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tag-badge {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 20px;
    color: white;
    font-size: 14px;
    font-weight: 500;
}

.attachments-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 10px;
}

.attachment-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 15px;
    background: #f8f9fa;
    border-radius: 8px;
    text-decoration: none;
    color: #333;
    transition: all 0.2s;
}

.attachment-item:hover {
    background: #e9ecef;
    transform: translateX(5px);
}

.attachment-icon {
    font-size: 24px;
}

.attachment-name {
    flex: 1;
    font-weight: 500;
}

.attachment-size {
    color: #777;
    font-size: 14px;
}

.detail-footer {
    padding: 15px 0 5px 0;
}

.detail-meta {
    color: #777;
    font-size: 14px;
}

.transaction-detail-actions {
    padding: 20px 30px;
    background: #f8f9fa;
    border-radius: 0 0 12px 12px;
    text-align: center;
    align-content: center;
    width: 100%;
}

.transaction-detail-actions .btn{
    width: 100%;
    margin: 5px 0;
}

@media (max-width: 768px) {
    .detail-row {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .page-header-btn .btn { 
        width: 100%;
    }
    
    .transaction-amount-large {
        font-size: 36px;
    }
    
    .transaction-icon-large {
        width: 50px;
        height: 50px;
        font-size: 28px;
    }
}

.heatmap-calendar {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
    padding: 20px 0;
}

.heatmap-day {
    aspect-ratio: 1;
    border-radius: 4px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    position: relative;
    border: 1px solid #e5e7eb;
}

.heatmap-day:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 10;
}

.heatmap-day.future {
    opacity: 0.3;
    cursor: default;
}

.heatmap-day.today {
    border: 2px solid #3b82f6;
    font-weight: bold;
}

.day-number {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 2px;
}

.day-amount {
    font-size: 9px;
    color: #6b7280;
}

/* Интенсивность цвета */
.heatmap-day[data-intensity="0"] { background-color: #f9fafb; }
.heatmap-day[data-intensity="1"] { background-color: #fee2e2; }
.heatmap-day[data-intensity="2"] { background-color: #fecaca; }
.heatmap-day[data-intensity="3"] { background-color: #fca5a5; }
.heatmap-day[data-intensity="4"] { background-color: #f87171; }
.heatmap-day[data-intensity="5"] { background-color: #ef4444; color: white; }

.heatmap-legend {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 15px;
    font-size: 12px;
    color: #6b7280;
}

.legend-item {
    width: 20px;
    height: 20px;
    border-radius: 3px;
    border: 1px solid #e5e7eb;
}

.weekday-labels {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
    margin-bottom: 8px;
    font-size: 12px;
    font-weight: 600;
    text-align: center;
    color: #6b7280;
}

.btn-link{
    border: none;
}

.heatmap-day[data-color-type="neutral"] {
    background-color: #f9fafb;
    color: #6b7280;
}

.heatmap-day[data-color-type="positive"][data-intensity="1"] {
    background-color: #d1fae5;
    color: #065f46;
}

.heatmap-day[data-color-type="positive"][data-intensity="2"] {
    background-color: #6ee7b7;
    color: #065f46;
}

.heatmap-day[data-color-type="positive"][data-intensity="3"] {
    background-color: #34d399;
    color: #ffffff;
}

.heatmap-day[data-color-type="positive"][data-intensity="4"] {
    background-color: #10b981;
    color: #ffffff;
}

.heatmap-day[data-color-type="positive"][data-intensity="5"] {
    background-color: #059669;
    color: #ffffff;
}

.heatmap-day[data-color-type="negative"][data-intensity="1"] {
    background-color: #fee2e2;
    color: #991b1b;
}

.heatmap-day[data-color-type="negative"][data-intensity="2"] {
    background-color: #fca5a5;
    color: #991b1b;
}

.heatmap-day[data-color-type="negative"][data-intensity="3"] {
    background-color: #f87171;
    color: #ffffff;
}

.heatmap-day[data-color-type="negative"][data-intensity="4"] {
    background-color: #ef4444;
    color: #ffffff;
}

.heatmap-day[data-color-type="negative"][data-intensity="5"] {
    background-color: #dc2626;
    color: #ffffff;
}

.heatmap-day.future {
    opacity: 0.3;
    pointer-events: none;
}

.heatmap-day.today {
    border: 2px solid #3b82f6;
}

.day-amount {
    font-size: 0.7em;
    font-weight: 600;
    margin-top: 2px;
}

.legend-item {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    border: 1px solid #d1d5db;
}

.account-select-container {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 10px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #f9fafb;
}

.account-select-item input[type="checkbox"] {
    display: none;
}

.account-select-item input[type="checkbox"]:checked + label {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
    color: white !important;
    border-color: #667eea !important;
    box-shadow: 0 4px 6px rgba(102, 126, 234, 0.3);
    transform: translateY(-2px);
}

.account-select-item label:hover {
    border-color: #667eea;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.account-select-item label:active {
    transform: translateY(0);
}