:root {
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-full: 9999px;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --font-heading: 'Space Grotesk', sans-serif;
    --font-body: 'Outfit', sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
    height: 100%;
}

body {
    font-family: var(--font-body);
    background: var(--bg-primary);
    background-image: var(--gradient-bg);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: var(--font-heading);
    font-weight: 600;
    line-height: 1.25;
}

button {
    font-family: inherit;
    cursor: pointer;
    border: none;
    background: none;
}

input,
select,
textarea {
    font-family: inherit;
    font-size: 16px;
}

a {
    text-decoration: none;
    color: inherit;
}

.app {
    display: flex;
    min-height: 100vh;
}

.main {
    flex: 1;
    margin-left: 270px;
    width: calc(100% - 270px);
    max-width: 100%;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.content {
    padding: 32px;
    flex: 1;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

.sidebar {
    width: 270px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    transition: transform 0.3s ease;
    box-shadow: 10px 0 30px rgba(0, 0, 0, 0.2);
}

.sidebar-header {
    padding: 24px;
    border-bottom: 1px solid var(--border-color);
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 20px;
}

.logo-text {
    font-family: var(--font-heading);
    font-size: 20px;
    font-weight: 700;
}

.logo-badge {
    font-size: 10px;
    background: var(--primary-bg);
    color: var(--primary-light);
    padding: 2px 8px;
    border-radius: var(--radius-full);
    margin-left: auto;
    font-weight: 700;
}

.profile-switcher {
    padding: 16px 24px;
    border-bottom: 1px solid var(--border-color);
}

.profile-select {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-weight: 500;
    cursor: pointer;
}

.nav {
    flex: 1;
    padding: 24px 16px;
    overflow-y: auto;
}

.nav-section {
    margin-bottom: 24px;
}

.nav-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-muted);
    padding: 0 12px;
    margin-bottom: 8px;
    letter-spacing: 1px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-weight: 500;
    transition: var(--transition);
    margin-bottom: 4px;
    cursor: pointer;
    position: relative;
}

.nav-item:hover {
    background: var(--bg-card);
    color: var(--text-primary);
}

.nav-item.active {
    background: var(--primary-bg);
    color: var(--primary-light);
}

.nav-item i {
    font-size: 20px;
}

.nav-badge {
    position: absolute;
    right: 12px;
    background: var(--danger);
    color: white;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: var(--radius-full);
    min-width: 18px;
    text-align: center;
}

.sidebar-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    background: var(--bg-secondary);
}

.theme-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition);
}

.theme-toggle:hover {
    border-color: var(--border-hover);
}

.theme-toggle-label {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 500;
    color: var(--text-secondary);
    font-size: 14px;
}

.toggle-switch {
    width: 40px;
    height: 22px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-full);
    position: relative;
    transition: var(--transition);
    border: 1px solid var(--border-color);
}

.toggle-switch::after {
    content: '';
    position: absolute;
    top: 1px;
    left: 1px;
    width: 18px;
    height: 18px;
    background: var(--text-secondary);
    border-radius: 50%;
    transition: var(--transition);
}

[data-theme="light"] .toggle-switch::after {
    transform: translateX(18px);
    background: var(--warning);
}

.install-btn {
    display: none;
    width: 100%;
    margin-top: 12px;
    padding: 12px 16px;
    background: var(--primary);
    border-radius: var(--radius-md);
    color: white;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: var(--transition);
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.install-btn:hover {
    background: var(--primary-dark);
}

.install-btn.show {
    display: flex;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 32px;
    background: var(--bg-primary);
    background-image: linear-gradient(180deg, rgba(255, 255, 255, 0.02), transparent 60%);
    position: sticky;
    top: 0;
    z-index: 50;
    backdrop-filter: blur(10px);
}

.topbar-left h1 {
    font-size: 28px;
    margin-bottom: 4px;
}

.topbar-left p {
    font-size: 14px;
    color: var(--text-muted);
}

.mobile-app-bar {
    display: none;
}

.mobile-app-logo {
    display: flex;
    align-items: center;
    gap: 8px;
}

.mobile-app-logo-img {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    object-fit: cover;
}

.mobile-app-logo-text {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 16px;
}

.mobile-app-spacer {
    width: 44px;
}

.mobile-logo {
    display: none;
    align-items: center;
    gap: 8px;
}

.mobile-logo-img {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    object-fit: cover;
}

.mobile-logo-text {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 16px;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.topbar-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: 20px;
    transition: var(--transition);
    position: relative;
}

.topbar-btn:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
    border-color: var(--border-hover);
}

.topbar-btn .notif-dot {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 8px;
    height: 8px;
    background: var(--danger);
    border-radius: 50%;
    border: 2px solid var(--bg-card);
}

.mobile-menu-btn {
    display: none;
}

.page {
    display: none;
    animation: fadeIn 0.4s ease forwards;
}

.page.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
    margin-bottom: 32px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-md);
    transition: var(--transition);
}

.stat-card:hover {
    transform: translateY(-4px);
    border-color: var(--border-hover);
    box-shadow: var(--shadow-lg);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    margin-bottom: 20px;
}

.stat-icon.green {
    background: var(--primary-bg);
    color: var(--primary-light);
}

.stat-icon.red {
    background: var(--danger-bg);
    color: var(--danger);
}

.stat-icon.yellow {
    background: rgba(245, 158, 11, 0.1);
    color: var(--accent);
}

.stat-icon.blue {
    background: rgba(59, 130, 246, 0.1);
    color: var(--info);
}

.stat-value {
    font-family: var(--font-heading);
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 4px;
}

.stat-label {
    font-size: 14px;
    color: var(--text-muted);
    font-weight: 500;
}

.quick-actions {
    display: flex;
    gap: 12px;
    margin-bottom: 32px;
    flex-wrap: wrap;
}

.quick-action-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-full);
    font-weight: 600;
    font-size: 14px;
    color: var(--text-secondary);
    transition: var(--transition);
}

.quick-action-btn:hover {
    background: var(--bg-card-hover);
    border-color: var(--primary);
    color: var(--text-primary);
    transform: translateY(-2px);
}

.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-md);
    transition: var(--transition);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.card-title {
    font-size: 18px;
    font-weight: 600;
}

.card-subtitle {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 4px;
}

.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}

.grid-4 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
}

.chart-container {
    position: relative;
    height: 300px;
    width: 100%;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    font-size: 14px;
    font-weight: 600;
    border-radius: var(--radius-md);
    transition: var(--transition);
    user-select: none;
}

.btn-primary {
    background: var(--primary);
    color: white;
    box-shadow: 0 8px 20px rgba(5, 150, 105, 0.25);
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 10px 26px rgba(5, 150, 105, 0.35);
}

.btn-secondary {
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-hover);
    transform: translateY(-1px);
}

.btn-danger {
    background: var(--danger-bg);
    color: var(--danger);
}

.btn-danger:hover {
    background: var(--danger);
    color: white;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 13px;
    border-radius: var(--radius-sm);
}

.btn-block {
    width: 100%;
}

.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
}

.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
    text-transform: uppercase;
}

.form-input {
    width: 100%;
    padding: 14px 16px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    transition: var(--transition);
}

.form-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-bg);
}

.form-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.form-row-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.radio-group {
    display: flex;
    gap: 8px;
    background: var(--bg-input);
    padding: 4px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.radio-btn {
    flex: 1;
    padding: 10px;
    border-radius: var(--radius-sm);
    text-align: center;
    font-weight: 600;
    font-size: 14px;
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition);
    border: none;
}

.radio-btn.active {
    background: var(--bg-card);
    color: var(--text-primary);
}

.radio-btn.income.active {
    color: var(--primary-light);
    background: var(--primary-bg);
}

.radio-btn.expense.active {
    color: var(--danger);
    background: var(--danger-bg);
}

.table-container {
    overflow-x: auto;
    margin: -24px;
}

.table {
    width: 100%;
    border-collapse: collapse;
    min-width: 600px;
}

.table th {
    text-align: left;
    padding: 16px 24px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-card);
}

.table td {
    padding: 16px 24px;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

.table tr:last-child td {
    border-bottom: none;
}

.transaction-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}

.transaction-name {
    font-weight: 500;
    display: block;
    color: var(--text-primary);
}

.transaction-category {
    font-size: 13px;
    color: var(--text-muted);
}

.transaction-amount {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 15px;
}

.transaction-amount.income {
    color: var(--primary-light);
}

.transaction-amount.expense {
    color: var(--danger);
}

.transaction-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    border-radius: var(--radius-full);
    font-size: 11px;
    font-weight: 600;
}

.transaction-badge.installment {
    background: rgba(59, 130, 246, 0.1);
    color: var(--info);
}

.transaction-badge.recurring {
    background: rgba(139, 92, 246, 0.1);
    color: var(--purple);
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--overlay);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
    padding: 20px;
    backdrop-filter: blur(4px);
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    transform: scale(0.95);
    transition: var(--transition);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.modal-overlay.active .modal {
    transform: scale(1);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 24px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-card);
}

.modal-title {
    font-size: 18px;
    font-weight: 600;
}

.modal-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: 20px;
    transition: var(--transition);
}

.modal-close:hover {
    background: var(--bg-input);
    color: var(--text-primary);
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    padding: 24px;
    border-top: 1px solid var(--border-color);
    background: var(--bg-card);
}

.credit-card {
    aspect-ratio: 1.58;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    border-radius: var(--radius-lg);
    padding: 24px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: relative;
    overflow: hidden;
    color: white;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3);
    transition: var(--transition);
}

.credit-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 30px rgba(0, 0, 0, 0.4);
}

.credit-card::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -30%;
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
}

.credit-card.purple {
    background: linear-gradient(135deg, #4C1D95 0%, #7C3AED 100%);
}

.credit-card.blue {
    background: linear-gradient(135deg, #1E40AF 0%, #3B82F6 100%);
}

.credit-card.green {
    background: linear-gradient(135deg, #065F46 0%, #10B981 100%);
}

.credit-card.orange {
    background: linear-gradient(135deg, #9A3412 0%, #F97316 100%);
}

.card-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.card-bank {
    font-size: 16px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.card-chip {
    width: 44px;
    height: 34px;
    background: linear-gradient(135deg, #D4AF37 0%, #F4E4BC 50%, #D4AF37 100%);
    border-radius: 6px;
}

.card-number {
    font-family: 'Space Grotesk', monospace;
    font-size: 20px;
    letter-spacing: 3px;
    margin: 20px 0;
}

.card-bottom {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
}

.card-info-group label {
    display: block;
    font-size: 9px;
    text-transform: uppercase;
    opacity: 0.8;
    margin-bottom: 2px;
}

.card-badges {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: 6px;
}

.card-badge {
    font-size: 10px;
    padding: 4px 8px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.16);
    color: white;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    font-weight: 600;
}

.card-badge.success { background: rgba(16, 185, 129, 0.3); }
.card-badge.warning { background: rgba(245, 158, 11, 0.3); }
.card-badge.danger { background: rgba(239, 68, 68, 0.35); }
.card-badge.ghost { background: rgba(255, 255, 255, 0.12); opacity: 0.9; }

.card-metrics {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 12px;
}

.card-metric span {
    display: block;
    font-size: 10px;
    text-transform: uppercase;
    opacity: 0.7;
    letter-spacing: 0.6px;
}

.card-metric strong {
    display: block;
    font-size: 14px;
    font-weight: 700;
    margin-top: 4px;
}

.card-progress {
    margin-top: 12px;
    background: rgba(0, 0, 0, 0.2);
    height: 6px;
    border-radius: 6px;
    overflow: hidden;
}

.card-progress-bar {
    height: 100%;
    background: white;
    opacity: 0.9;
    transition: width 0.3s ease;
}

.card-actions {
    display: grid;
    grid-template-columns: 1.2fr 1fr auto auto;
    gap: 8px;
    margin-top: 14px;
}

.card-actions .btn {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

.card-actions .btn-icon {
    padding: 6px 8px;
}

.card-footnote {
    font-size: 11px;
    opacity: 0.75;
    text-align: center;
    margin-top: 8px;
}

.card-info-group span {
    font-size: 14px;
    font-weight: 600;
}

.toast-container {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 12px;
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: 0 20px 25px rgba(0, 0, 0, 0.15);
    animation: slideIn 0.3s ease;
    max-width: 400px;
    pointer-events: auto;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.toast.success {
    border-left: 4px solid var(--success);
}

.toast.error {
    border-left: 4px solid var(--danger);
}

.toast.warning {
    border-left: 4px solid var(--warning);
}

.toast-message {
    flex: 1;
    font-weight: 500;
    font-size: 14px;
}

.update-banner {
    position: fixed;
    top: var(--demo-banner-height, 0px);
    left: 16px;
    right: 16px;
    z-index: 1005;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 16px;
    border-radius: var(--radius-md);
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.25);
}

.update-banner-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.update-banner-title {
    font-weight: 600;
}

.update-banner-note {
    font-size: 12px;
    color: var(--text-muted);
}

.update-banner-actions {
    display: flex;
    gap: 8px;
}

@media (max-width: 1200px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .grid-3 {
        grid-template-columns: 1fr;
    }

    .grid-4 {
        grid-template-columns: repeat(2, 1fr);
    }

    .themes-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .update-banner {
        top: calc(var(--demo-banner-height, 0px) + 56px);
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .update-banner-actions {
        width: 100%;
    }

    .update-banner-actions .btn {
        width: 100%;
    }

    html,
    body {
        width: 100%;
        overflow-x: hidden;
    }

    .mobile-app-bar {
        display: flex;
        align-items: center;
        justify-content: space-between;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        height: 56px;
        padding: 0 16px;
        background: var(--bg-primary);
        border-bottom: 1px solid var(--border-color);
        z-index: 1001;
    }

    .app {
        width: 100%;
        min-height: 100dvh;
        overflow-x: hidden;
    }

    .sidebar {
        transform: translateX(-100%);
        width: 80%;
        max-width: 320px;
        z-index: 1002;
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .main {
        margin-left: 0;
        width: 100%;
        min-height: 100dvh;
        padding-top: 56px;
    }

    .mobile-menu-btn {
        display: flex;
    }

    .content {
        padding: 16px;
        margin-bottom: 80px;
        width: 100%;
        max-width: 100%;
    }

    .stats-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .grid-2 {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .grid-4 {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .form-row,
    .form-row-3 {
        grid-template-columns: 1fr;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }

    .page-header-actions {
        width: 100%;
        justify-content: stretch;
    }

    .page-header-actions .btn {
        flex: 1;
    }

    .topbar {
        padding: 16px;
        width: 100%;
        max-width: 100%;
        position: sticky;
        top: 56px;
        z-index: 1000;
    }

    .topbar-left {
        display: flex;
        align-items: center;
        gap: 10px;
    }

    .topbar-left h1 {
        font-size: 18px;
        margin-bottom: 0;
    }

    .topbar-left p {
        display: none;
    }

    .mobile-logo {
        display: none;
    }

    .topbar-right {
        flex-wrap: wrap;
        gap: 8px;
        justify-content: flex-end;
    }

    .topbar-right .mobile-menu-btn {
        order: 1;
    }

    .period-selector {
        order: 2;
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .period-selector::-webkit-scrollbar {
        display: none;
    }

    .page {
        width: 100%;
        max-width: 100%;
    }

    .mobile-overlay {
        z-index: 1000;
    }

    .table th,
    .table td {
        padding: 12px 16px;
    }

    .card {
        padding: 16px;
    }
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* Page Header */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 16px;
}

.page-header h2 {
    font-size: 20px;
}

.page-header-actions {
    display: flex;
    gap: 12px;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
}

.empty-state-icon {
    width: 80px;
    height: 80px;
    background: var(--bg-tertiary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    font-size: 36px;
    color: var(--text-muted);
}

.empty-state h3 {
    font-size: 18px;
    margin-bottom: 8px;
}

.empty-state p {
    color: var(--text-muted);
    margin-bottom: 20px;
}

/* Progress Bar */
.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary) 0%, var(--primary-light) 100%);
    border-radius: var(--radius-full);
    transition: width 0.5s ease;
}

/* Goals Grid */
.goals-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.goal-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    transition: var(--transition);
}

.goal-card:hover {
    border-color: var(--primary);
}

.goal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 16px;
}

.goal-icon {
    width: 48px;
    height: 48px;
    background: var(--primary-bg);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: var(--primary-light);
}

.goal-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 4px;
}

.goal-target {
    font-size: 13px;
    color: var(--text-muted);
}

.goal-progress-text {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 14px;
}

.goal-current {
    font-weight: 600;
    color: var(--primary-light);
}

.goal-remaining {
    color: var(--text-muted);
}

/* Cards Grid */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 24px;
}

.card-details {
    padding: 20px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 0 0 var(--radius-xl) var(--radius-xl);
    margin-top: -16px;
}

.card-detail-row {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-color);
}

.card-detail-row:last-child {
    border-bottom: none;
}

.card-detail-label {
    font-size: 14px;
    color: var(--text-muted);
}

.card-detail-value {
    font-weight: 600;
}

/* Recurring Item */
.recurring-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    margin-bottom: 12px;
}

.recurring-item-info {
    flex: 1;
}

.recurring-item-name {
    font-weight: 600;
    margin-bottom: 4px;
}

.recurring-item-details {
    font-size: 13px;
    color: var(--text-muted);
}

.recurring-item-amount {
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 16px;
}

.recurring-item-amount.expense {
    color: var(--danger);
}

.recurring-item-amount.income {
    color: var(--primary-light);
}

/* Transaction Actions */
.transaction-actions {
    display: flex;
    gap: 8px;
}

.transaction-date {
    font-size: 13px;
    color: var(--text-muted);
}

/* Notifications */
.notification-item {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 16px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    margin-bottom: 12px;
    transition: var(--transition);
}

.notification-item.unread {
    border-left: 3px solid var(--primary);
}

.notification-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}

.notification-icon.warning {
    background: rgba(245, 158, 11, 0.1);
    color: var(--accent);
}

.notification-icon.danger {
    background: var(--danger-bg);
    color: var(--danger);
}

.notification-icon.success {
    background: var(--primary-bg);
    color: var(--primary-light);
}

.notification-content {
    flex: 1;
}

.notification-title {
    font-weight: 600;
    margin-bottom: 4px;
}

.notification-text {
    font-size: 14px;
    color: var(--text-secondary);
}

.notification-time {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 8px;
}

/* Color & Icon Picker */
.color-picker {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.color-option {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    border: 3px solid transparent;
    transition: var(--transition);
}

.color-option:hover {
    transform: scale(1.1);
}

.color-option.selected {
    border-color: var(--text-primary);
}

.icon-picker {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 8px;
}

.icon-option {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 20px;
    cursor: pointer;
    transition: var(--transition);
}

.icon-option:hover {
    background: var(--bg-card-hover);
}

.icon-option.selected {
    background: var(--primary-bg);
    border-color: var(--primary);
    color: var(--primary-light);
}

/* Categories */
.category-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--bg-input);
    border-radius: var(--radius-md);
    margin-bottom: 8px;
    transition: var(--transition);
}

.category-item:hover {
    background: var(--bg-card-hover);
}

.category-item-color {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.category-item-name {
    flex: 1;
    font-weight: 500;
}

.category-item-count {
    font-size: 13px;
    color: var(--text-muted);
}

/* Backup */
.backup-actions {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.backup-card {
    flex: 1;
    min-width: 200px;
    background: var(--bg-card);
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-lg);
    padding: 32px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
}

.backup-card:hover {
    border-color: var(--primary);
    background: var(--primary-bg);
}

.backup-card i {
    font-size: 40px;
    color: var(--primary-light);
    margin-bottom: 16px;
}

.backup-card h4 {
    margin-bottom: 8px;
}

.backup-card p {
    font-size: 14px;
    color: var(--text-muted);
}

/* Sharing */
.share-code {
    font-family: var(--font-heading);
    font-size: 32px;
    letter-spacing: 8px;
    text-align: center;
    padding: 24px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    margin: 20px 0;
}

/* Projection Card */
.projection-card {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    border-radius: var(--radius-lg);
    padding: 24px;
    color: white;
}

.projection-card h4 {
    font-size: 14px;
    opacity: 0.9;
    margin-bottom: 8px;
}

.projection-card .value {
    font-family: var(--font-heading);
    font-size: 32px;
    font-weight: 700;
}

.projection-card .note {
    font-size: 13px;
    opacity: 0.8;
    margin-top: 8px;
}

/* Summary Card */
.summary-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px;
}

.summary-card-title {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.summary-card-value {
    font-family: var(--font-heading);
    font-size: 24px;
    font-weight: 700;
}

/* Comparison */
.comparison-row {
    display: flex;
    align-items: center;
    padding: 16px 0;
    border-bottom: 1px solid var(--border-color);
}

.comparison-row:last-child {
    border-bottom: none;
}

.comparison-label {
    flex: 1;
    font-weight: 500;
}

.comparison-values {
    display: flex;
    gap: 24px;
}

.comparison-value {
    text-align: right;
    min-width: 100px;
}

.comparison-value .amount {
    font-family: var(--font-heading);
    font-weight: 600;
}

.comparison-value .period {
    font-size: 12px;
    color: var(--text-muted);
}

/* Filters */
.filters {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.filter-select {
    padding: 10px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-weight: 500;
    min-width: 150px;
}

.filter-select:focus {
    outline: none;
    border-color: var(--primary);
}

/* Mobile Overlay */
.mobile-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--overlay);
    z-index: 99;
    display: none;
}

.mobile-overlay.active {
    display: block;
}

/* Toast Icon & Close */
.toast-icon {
    font-size: 24px;
}

.toast.success .toast-icon {
    color: var(--success);
}

.toast.error .toast-icon {
    color: var(--danger);
}

.toast.warning .toast-icon {
    color: var(--warning);
}

.toast-close {
    color: var(--text-muted);
    font-size: 20px;
    cursor: pointer;
    background: none;
    border: none;
}

/* Text colors */
.text-muted {
    color: var(--text-muted);
}

/* Credit Card */
.credit-card {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    border-radius: var(--radius-lg);
    padding: 20px;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
    color: white;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3);
    transition: var(--transition);
    min-height: 240px;
    max-width: 340px;
    width: 100%;
}

.credit-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 30px rgba(0, 0, 0, 0.4);
}

.credit-card::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -30%;
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
}

.credit-card.purple {
    background: linear-gradient(135deg, #4C1D95 0%, #7C3AED 100%);
}

.credit-card.blue {
    background: linear-gradient(135deg, #1E40AF 0%, #3B82F6 100%);
}

.credit-card.green {
    background: linear-gradient(135deg, #065F46 0%, #10B981 100%);
}

.credit-card.orange {
    background: linear-gradient(135deg, #9A3412 0%, #F97316 100%);
}

.card-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.card-bank {
    font-size: 16px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.card-chip {
    width: 44px;
    height: 34px;
    background: linear-gradient(135deg, #D4AF37 0%, #F4E4BC 50%, #D4AF37 100%);
    border-radius: 6px;
    margin-top: 16px;
}

.card-number {
    font-family: 'Space Grotesk', monospace;
    font-size: 20px;
    letter-spacing: 3px;
    margin: 20px 0;
}

.card-bottom {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-top: auto;
}

.card-info-group label {
    display: block;
    font-size: 9px;
    text-transform: uppercase;
    opacity: 0.8;
    margin-bottom: 2px;
}

.card-info-group span {
    font-size: 14px;
    font-weight: 600;
}

.card-actions {
    display: flex;
    gap: 8px;
    margin-top: 16px;
}

.card-actions .btn {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: none;
}

.card-actions .btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Calendar Events */
.calendar-event {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
    transition: var(--transition);
}

.calendar-event:hover {
    background: var(--bg-card-hover);
}

.calendar-event:last-child {
    border-bottom: none;
}

.calendar-event.past {
    opacity: 0.5;
}

.calendar-event.today {
    background: var(--primary-bg);
    border-left: 3px solid var(--primary);
}

.calendar-day {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    font-family: var(--font-heading);
    font-size: 20px;
    font-weight: 700;
    flex-shrink: 0;
}

.calendar-event.today .calendar-day {
    background: var(--primary);
    color: white;
}

.calendar-event-info {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
}

.calendar-event-name {
    font-weight: 500;
}

.calendar-event-amount {
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 16px;
}

.calendar-event-amount.expense {
    color: var(--danger);
}

.calendar-event-amount.income {
    color: var(--primary-light);
}

/* Bill History */
.bill-history-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    margin-bottom: 12px;
}

.bill-history-month {
    font-weight: 600;
    font-size: 15px;
}

.bill-history-amount {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 18px;
    color: var(--primary-light);
}

.bill-history-date {
    font-size: 12px;
    color: var(--text-muted);
}

/* Budget Progress Bar */
.budget-bar {
    width: 100%;
    height: 6px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.budget-fill {
    height: 100%;
    background: var(--primary);
    border-radius: var(--radius-full);
    transition: width 0.5s ease;
}

.budget-fill.warning {
    background: var(--warning);
}

.budget-fill.over {
    background: var(--danger);
}

/* Budget list (dashboard) */
.budget-item {
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
}

.budget-item:last-child {
    border-bottom: none;
}

.budget-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 6px;
}

.budget-item-name {
    font-weight: 600;
}

.budget-item-values {
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 500;
}

.budget-item-meta {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 6px;
}

/* Insights */
.insight-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
}

.insight-item:last-child {
    border-bottom: none;
}

.insight-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    background: rgba(59, 130, 246, 0.12);
    color: var(--info);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

.insight-text {
    font-size: 14px;
    color: var(--text-secondary);
}

/* Demo note */
.demo-note {
    font-size: 12px;
    color: var(--text-muted);
    background: var(--bg-tertiary);
    padding: 8px 12px;
    border-radius: var(--radius-md);
    margin-bottom: 12px;
}

/* Planned vs real */
.plan-real-item {
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
}

.plan-real-item:last-child {
    border-bottom: none;
}

.plan-real-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 6px;
}

.plan-real-name {
    font-weight: 600;
}

.plan-real-values {
    font-size: 12px;
    color: var(--text-muted);
}

.plan-real-diff {
    font-size: 13px;
    font-weight: 600;
}

.plan-real-diff.positive {
    color: var(--success);
}

.plan-real-diff.negative {
    color: var(--danger);
}

/* Health indicators */
.health-item {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 12px;
}

.health-item-title {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.health-item-value {
    font-size: 18px;
    font-weight: 700;
}

.health-item-status {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 6px;
}

.health-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: var(--radius-full);
    font-size: 12px;
    font-weight: 600;
}

.health-badge.good {
    background: rgba(16, 185, 129, 0.12);
    color: var(--success);
}

.health-badge.warn {
    background: rgba(245, 158, 11, 0.12);
    color: var(--warning);
}

.health-badge.risk {
    background: rgba(239, 68, 68, 0.12);
    color: var(--danger);
}

/* Checklist */
.checklist-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-color);
}

.checklist-item:last-child {
    border-bottom: none;
}

.checklist-progress {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 12px;
    color: var(--text-muted);
}

/* Simulator */
.simulator-result {
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    padding: 12px;
}

/* Demo mode */
.demo-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 12px 24px;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.16) 0%, rgba(139, 92, 246, 0.2) 100%);
    border-bottom: 1px solid var(--border-color);
}

.demo-banner-content {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-primary);
}

.demo-banner-content i {
    font-size: 22px;
    color: var(--info);
}

.demo-banner-title {
    font-weight: 600;
    font-size: 14px;
}

.demo-banner-text {
    font-size: 12px;
    color: var(--text-secondary);
}

.demo-mode-card {
    border: 1px dashed var(--border-color);
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.08) 0%, rgba(59, 130, 246, 0.06) 100%);
}

/* Chart empty state */
.chart-empty {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: var(--text-muted);
    font-size: 13px;
    background: var(--bg-card);
}

/* AI Insights */
.ai-insights-card {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.08) 0%, rgba(59, 130, 246, 0.06) 100%);
    border: 1px solid rgba(139, 92, 246, 0.2);
}

.ai-badge {
    font-size: 10px;
    background: linear-gradient(135deg, #8B5CF6 0%, #3B82F6 100%);
    color: white;
    padding: 2px 8px;
    border-radius: var(--radius-full);
    margin-left: 8px;
}

.ai-insight-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    margin-bottom: 10px;
    border-left: 3px solid var(--purple);
}

.ai-insight-item.warning {
    border-left-color: var(--warning);
}

.ai-insight-item.success {
    border-left-color: var(--success);
}

.ai-insight-item.danger {
    border-left-color: var(--danger);
}

.ai-insight-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}

.ai-insight-content {
    flex: 1;
}

.ai-insight-title {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 4px;
}

.ai-insight-text {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
}

.ai-insight-action {
    margin-top: 8px;
}

/* Quick widget */
.quick-widget {
    margin-bottom: 24px;
}

.quick-widget-item {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-color);
}

.quick-widget-item:last-child {
    border-bottom: none;
}

.onboarding-card {
    border: 1px dashed var(--border-color);
    background: var(--bg-secondary);
    margin-bottom: 24px;
}

.weekly-review-card {
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    margin-bottom: 24px;
}

/* Health score */
.health-score-display {
    text-align: center;
    padding: 24px 0;
}

.health-score-circle {
    position: relative;
    width: 180px;
    height: 180px;
    margin: 0 auto 20px;
}

.health-score-circle svg {
    transform: rotate(-90deg);
    width: 100%;
    height: 100%;
}

.health-score-circle .score-bg {
    fill: none;
    stroke: var(--bg-tertiary);
    stroke-width: 12;
}

.health-score-circle .score-fill {
    fill: none;
    stroke: var(--primary);
    stroke-width: 12;
    stroke-linecap: round;
    stroke-dasharray: 565.48;
    stroke-dashoffset: 565.48;
    transition: stroke-dashoffset 1s ease, stroke 0.5s ease;
}

.health-score-circle .score-fill.excellent { stroke: #10B981; }
.health-score-circle .score-fill.good { stroke: #3B82F6; }
.health-score-circle .score-fill.fair { stroke: #F59E0B; }
.health-score-circle .score-fill.poor { stroke: #EF4444; }

.score-value {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}

.score-value span {
    font-size: 48px;
    font-weight: 700;
    font-family: var(--font-heading);
    line-height: 1;
}

.score-value small {
    display: block;
    font-size: 14px;
    color: var(--text-muted);
    margin-top: 4px;
}

.score-label {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-secondary);
}

.health-factors {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-top: 24px;
}

.health-factor {
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    padding: 16px;
}

.health-factor-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.health-factor-name {
    font-size: 13px;
    color: var(--text-secondary);
}

.health-factor-score {
    font-size: 18px;
    font-weight: 700;
}

.health-factor-bar {
    height: 6px;
    background: var(--bg-card);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.health-factor-fill {
    height: 100%;
    border-radius: var(--radius-full);
    transition: width 0.5s ease;
}

.health-tips {
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid var(--border-color);
}

.health-tip {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    margin-bottom: 8px;
}

.health-tip-icon {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.health-tip-text {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* Privacy mode */
.privacy-mode .stat-value,
.privacy-mode .transaction-amount,
.privacy-mode .budget-item-values,
.privacy-mode .plan-real-values,
.privacy-mode .health-item-value,
.privacy-mode .money-value,
.privacy-mode .card-info-group span,
.privacy-mode .bill-history-amount,
.privacy-mode .summary-card-value {
    filter: blur(8px);
    user-select: none;
}

.privacy-mode .stat-value:hover,
.privacy-mode .transaction-amount:hover,
.privacy-mode .budget-item-values:hover,
.privacy-mode .plan-real-values:hover {
    filter: none;
}

/* Couple mode */
.couple-panel {
    background: linear-gradient(135deg, rgba(236, 72, 153, 0.08) 0%, rgba(139, 92, 246, 0.06) 100%);
    border: 1px solid rgba(236, 72, 153, 0.2);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 24px;
}

.couple-partners {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 24px;
    margin-bottom: 24px;
}

.partner-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px;
    text-align: center;
    min-width: 180px;
}

.partner-avatar {
    font-size: 48px;
    margin-bottom: 12px;
}

.partner-name-input {
    background: transparent;
    border: none;
    border-bottom: 2px solid var(--border-color);
    text-align: center;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    padding: 8px;
    width: 100%;
    transition: var(--transition);
}

.partner-name-input:focus {
    outline: none;
    border-bottom-color: var(--primary);
}

.partner-income {
    margin-top: 12px;
}

.partner-income small {
    display: block;
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.partner-income-input {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 8px 12px;
    width: 100%;
    text-align: center;
    font-size: 14px;
    color: var(--text-primary);
}

.couple-divider {
    font-size: 32px;
    color: #EC4899;
    animation: pulse 2s infinite;
}

.split-options {
    display: flex;
    gap: 12px;
}

.split-option {
    flex: 1;
    cursor: pointer;
}

.split-option input {
    display: none;
}

.split-option-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 16px;
    background: var(--bg-tertiary);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    transition: var(--transition);
}

.split-option input:checked + .split-option-card {
    border-color: #EC4899;
    background: rgba(236, 72, 153, 0.1);
}

.split-option-card i {
    font-size: 24px;
    color: #EC4899;
}

.couple-balance-card {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: 20px;
    margin: 24px 0;
    text-align: center;
}

.balance-title {
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 16px;
}

.balance-display {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 16px;
}

.balance-display .debtor {
    color: var(--danger);
}

.balance-display .creditor {
    color: var(--success);
}

.balance-display .amount {
    font-size: 28px;
    display: block;
    margin: 8px 0;
}

/* Simulator */
.simulator-container {
    display: grid;
    grid-template-columns: 400px 1fr;
    gap: 24px;
}

.investment-types {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.investment-type-option {
    cursor: pointer;
}

.investment-type-option input {
    display: none;
}

.investment-type-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 16px 12px;
    background: var(--bg-tertiary);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    transition: var(--transition);
    text-align: center;
}

.investment-type-option input:checked + .investment-type-card {
    border-color: var(--primary);
    background: var(--primary-bg);
}

.investment-type-card i {
    font-size: 24px;
    color: var(--primary);
}

.investment-type-card span {
    font-weight: 600;
    font-size: 13px;
}

.investment-type-card small {
    font-size: 11px;
    color: var(--text-muted);
}

.form-range {
    width: 100%;
    height: 6px;
    border-radius: var(--radius-full);
    background: var(--bg-tertiary);
    outline: none;
    -webkit-appearance: none;
}

.form-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
}

.range-value {
    text-align: center;
    font-size: 14px;
    color: var(--text-secondary);
    margin-top: 8px;
}

.simulator-chart-container {
    height: 300px;
    margin-bottom: 24px;
}

.simulator-comparison {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

.simulator-result-card {
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    padding: 20px;
    text-align: center;
    border-left: 4px solid var(--primary);
    position: relative;
}

.simulator-result-card h4 {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.simulator-result-card .value {
    font-size: 24px;
    font-weight: 700;
    color: var(--success);
    margin-bottom: 4px;
}

.simulator-result-card .gain {
    font-size: 12px;
    color: var(--text-secondary);
}

.simulator-result-card .gain strong {
    color: var(--success);
}

/* Themes */
.themes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
}

.theme-card {
    background: var(--bg-tertiary);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px;
    cursor: pointer;
    transition: var(--transition);
}

.theme-card.locked {
    opacity: 0.6;
    cursor: not-allowed;
}

.theme-card.active {
    border-color: var(--primary);
    background: var(--primary-bg);
}

.theme-card-title {
    font-weight: 600;
    margin-bottom: 8px;
}

.theme-card-note {
    font-size: 12px;
    color: var(--text-muted);
}

/* Badges */
.badges-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px;
}

.badge-card {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 12px;
    text-align: center;
}

.badge-card.locked {
    opacity: 0.6;
}

.badge-card i {
    font-size: 22px;
    margin-bottom: 6px;
    color: var(--primary-light);
}

.badge-title {
    font-size: 13px;
    font-weight: 600;
}

.badge-note {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* Comparison */
.compare-table {
    width: 100%;
    border-collapse: collapse;
}

.compare-table th,
.compare-table td {
    padding: 12px;
    border-bottom: 1px solid var(--border-color);
    text-align: left;
}

.compare-table th {
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
}

/* FAB */
.fab-container {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 1200;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.fab-main {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 12px 20px rgba(5, 150, 105, 0.3);
}

.fab-menu {
    display: none;
    flex-direction: column;
    gap: 10px;
}

.fab-menu.show {
    display: flex;
}

.fab-item {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Retirement */
.retirement-hero {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 24px;
    margin-bottom: 24px;
}

.retirement-main-value,
.retirement-monthly {
    background: var(--bg-tertiary);
    border-radius: var(--radius-lg);
    padding: 24px;
    text-align: center;
}

.retirement-main-value .label,
.retirement-monthly .label {
    display: block;
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.retirement-main-value .value {
    display: block;
    font-size: 36px;
    font-weight: 700;
    color: var(--success);
    font-family: var(--font-heading);
}

.retirement-main-value .value-real {
    display: block;
    font-size: 14px;
    color: var(--text-secondary);
    margin-top: 4px;
}

.retirement-monthly .value {
    display: block;
    font-size: 28px;
    font-weight: 700;
    color: var(--primary);
    font-family: var(--font-heading);
}

.retirement-chart-container {
    height: 250px;
    margin-bottom: 24px;
}

.retirement-milestones {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.retirement-milestone {
    flex: 1;
    min-width: 140px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    padding: 16px;
    text-align: center;
    position: relative;
}

.retirement-milestone::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 4px;
    height: 4px;
    background: var(--primary);
    border-radius: 50%;
}

.retirement-milestone .age {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.retirement-milestone .amount {
    font-size: 16px;
    font-weight: 700;
}

/* Stat value colors */
.stat-value.positive {
    color: var(--primary-light);
}

.stat-value.negative {
    color: var(--danger);
}

/* Credit card mini icon for tables */
.credit-card-mini {
    display: inline-block;
    width: 22px;
    height: 14px;
    border-radius: 3px;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
}

.credit-card-mini.purple {
    background: linear-gradient(135deg, #4C1D95 0%, #7C3AED 100%);
}

.credit-card-mini.blue {
    background: linear-gradient(135deg, #1E40AF 0%, #3B82F6 100%);
}

.credit-card-mini.green {
    background: linear-gradient(135deg, #065F46 0%, #10B981 100%);
}

.credit-card-mini.orange {
    background: linear-gradient(135deg, #9A3412 0%, #F97316 100%);
}

/* Button icon style */
.btn-icon {
    padding: 6px 10px;
    min-width: auto;
}

/* ===== MOBILE RESPONSIVENESS FIXES ===== */
@media (max-width: 768px) {
    .content {
        padding: 12px;
        margin-bottom: 90px;
        width: 100%;
        overflow-x: hidden;
        max-width: 100%;
    }

    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin: 0;
        padding: 0 12px;
        width: 100%;
        max-width: 100%;
    }

    .table {
        min-width: 600px;
        /* Force table to retain shape and scroll */
    }

    .credit-card {
        max-width: 100%;
        min-height: 240px;
        height: auto;
        aspect-ratio: auto;
    }

    .cards-grid {
        grid-template-columns: 1fr;
    }

    .card-actions {
        grid-template-columns: 1fr 1fr;
    }

    .card-actions .btn {
        font-size: 12px;
        padding: 8px 10px;
    }

    .card-actions .btn-icon {
        padding: 8px;
    }

    .stats-grid {
        grid-template-columns: 1fr 1fr;
        /* Compact stats */
    }

    .stats-grid .stat-card:nth-child(n+5) {
        grid-column: span 2;
        /* Last cards full width */
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .page-header-actions {
        width: 100%;
        display: grid;
        grid-template-columns: 1fr 1fr;
    }

    .modal-content {
        width: 95%;
        margin: 10px;
        max-height: 90vh;
        overflow-y: auto;
    }

    /* Better touch targets for mobile */
    .btn-icon,
    .action-btn {
        min-width: 44px;
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
}
/* Backup Banner Responsive */
#backupWarningBanner {
    position: sticky;
    top: 0;
    z-index: 999;
}

@media (max-width: 768px) {
    #backupWarningBanner {
        flex-direction: column;
        gap: 12px;
        padding: 16px;
    }
    
    #backupWarningBanner > div:last-child {
        width: 100%;
        justify-content: stretch;
    }
    
    #backupWarningBanner button {
        flex: 1;
    }

    .demo-banner {
        flex-direction: column;
        align-items: flex-start;
    }
}

@media (max-width: 992px) {
    .simulator-container {
        grid-template-columns: 1fr;
    }

    .investment-types {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .health-factors {
        grid-template-columns: 1fr;
    }

    .health-score-circle {
        width: 150px;
        height: 150px;
    }

    .score-value span {
        font-size: 36px;
    }

    .couple-partners {
        flex-direction: column;
    }

    .couple-divider {
        transform: rotate(90deg);
    }

    .split-options {
        flex-direction: column;
    }

    .retirement-hero {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .simulator-result-card .value {
        font-size: 20px;
    }

    .retirement-main-value .value {
        font-size: 24px;
    }

    .retirement-monthly .value {
        font-size: 22px;
    }

    .badges-grid {
        grid-template-columns: 1fr;
    }
}
