:root {
    --primary: #0EA5E9;
    --primary-dark: #0284C7;
    --secondary: #0EA5E9;
    --danger: #EF4444;
    --danger-dark: #DC2626;
    --warning: #F59E0B;
    --success: #0EA5E9;
    --background: #F8FAFC;
    --surface: #FFFFFF;
    --text: #1E293B;
    --text-muted: #64748B;
    --border: #E2E8F0;
    --sidebar-width: 260px;
}

html {
    font-size: 16px;
}

@media (max-width: 768px) {
    html {
        font-size: 14px;
    }
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--background);
    color: var(--text);
    line-height: 1.6;
}

.app-container {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: var(--sidebar-width);
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 100;
}

.logo {
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--border);
}

.logo-icon {
    font-size: 28px;
}

.logo-icon:first-child {
    font-size: 32px;
    font-weight: 700;
    color: #10B981;
}

.logo-text {
    font-size: 20px;
    font-weight: 700;
    color: var(--primary);
}

.nav-menu {
    flex: 1;
    padding: 16px 12px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: 8px;
    margin-bottom: 4px;
    transition: all 0.2s;
    font-size: 14px;
}

.nav-item:hover {
    background: var(--background);
    color: var(--text);
}

.nav-item.active {
    background: var(--primary);
    color: white;
}

.nav-icon {
    width: 18px;
    height: 18px;
}

.nav-footer {
    padding: 16px;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 12px;
}

.toggle-values-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    padding: 6px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.toggle-values-btn:hover {
    background: var(--bg-secondary);
    color: var(--text);
}

.toggle-values-btn.active {
    color: var(--primary);
    background: rgba(34, 197, 94, 0.1);
}

.user-info {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-avatar {
    width: 36px;
    height: 36px;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}

.user-name {
    font-weight: 500;
    font-size: 14px;
}

.logout-btn {
    color: var(--text-muted);
    padding: 8px;
    border-radius: 6px;
}

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

.logout-btn svg {
    width: 20px;
    height: 20px;
}

.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 32px;
    min-height: 100vh;
}

.alert {
    padding: 16px 20px;
    border-radius: 8px;
    margin-bottom: 24px;
    font-weight: 500;
}

.alert-success {
        background: #DBEAFE;
        color: #1E40AF;
        border: 1px solid #93C5FD;
}

.alert-error {
    background: #FEE2E2;
    color: #991B1B;
    border: 1px solid #FECACA;
}

.dashboard-header {
    margin-bottom: 32px;
}

.dashboard-header h1 {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 4px;
}

.dashboard-subtitle {
    color: var(--text-muted);
}

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

.stats-3 {
    grid-template-columns: repeat(3, 1fr);
}

.stat-card {
    background: var(--surface);
    border-radius: 12px;
    padding: 24px;
    display: flex;
    align-items: flex-start;
    gap: 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    border: 1px solid var(--border);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-icon svg {
    width: 24px;
    height: 24px;
}

.stat-income .stat-icon {
    background: #DBEAFE;
    color: var(--primary);
}

.stat-expense .stat-icon {
    background: #FEE2E2;
    color: var(--danger);
}

.stat-balance .stat-icon {
    background: #DBEAFE;
    color: var(--secondary);
}

.stat-debt .stat-icon {
    background: #FEF3C7;
    color: var(--warning);
}

.stat-content {
    display: flex;
    flex-direction: column;
}

.stat-label {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.stat-value {
    font-size: 21px;
    font-weight: 700;
    font-family: 'JetBrains Mono', monospace;
}

.stat-sub {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}

.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-muted { color: var(--text-muted); }
.text-right { text-align: right; }
.text-center { text-align: center; }

.score-card {
    background: var(--surface);
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 32px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    border: 1px solid var(--border);
}

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

.score-header h3 {
    font-size: 16px;
    font-weight: 600;
}

.score-badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 14px;
}

.score-good { background: #DBEAFE; color: #1E40AF; }
.score-warning { background: #FEF3C7; color: #92400E; }
.score-danger { background: #FEE2E2; color: #991B1B; }

.score-bar {
    height: 12px;
    background: var(--background);
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 12px;
}

.score-progress {
    height: 100%;
    background: linear-gradient(90deg, var(--danger), var(--warning), var(--primary));
    border-radius: 6px;
    transition: width 0.5s ease;
}

.score-description {
    font-size: 14px;
    color: var(--text-muted);
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
}

.card {
    background: var(--surface);
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    border: 1px solid var(--border);
}

.card-full {
    grid-column: span 2;
}

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

.card-header h3 {
    font-size: 16px;
    font-weight: 600;
}

.total-badge {
    background: var(--danger);
    color: white;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 600;
    margin-left: auto;
    margin-right: 12px;
}

.card-body {
    padding: 24px;
}

.bills-list, .alerts-list {
    list-style: none;
}

.bill-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}

.bill-item:last-child {
    border-bottom: none;
}

.bill-item.urgent .bill-date {
    color: var(--danger);
    font-weight: 600;
}

.bill-item.warning .bill-date {
    color: var(--warning);
    font-weight: 600;
}

.bill-desc {
    font-weight: 500;
}

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

.bill-amount {
    font-weight: 600;
    font-family: 'JetBrains Mono', monospace;
}

.alert-item {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 8px;
}

.alert-item:last-child {
    margin-bottom: 0;
}

.alert-info { background: #DBEAFE; }
.alert-warning { background: #FEF3C7; }
.alert-danger { background: #FEE2E2; }

.alert-title {
    display: block;
    font-weight: 600;
    margin-bottom: 4px;
}

.alert-msg {
    font-size: 13px;
    color: var(--text-muted);
}

.empty-state {
    text-align: center;
    padding: 40px;
    color: var(--text-muted);
}

.empty-state p {
    margin-bottom: 16px;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 32px;
    flex-wrap: wrap;
    gap: 16px;
}

.page-header .action-buttons {
    display: flex;
    gap: 8px;
    margin-left: auto;
}

.page-header .action-buttons .btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    font-size: 13px;
}

@media print {
    .page-header .action-buttons { display: none !important; }
}

.page-title h1 {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 4px;
}

.page-subtitle {
    color: var(--text-muted);
}

.page-actions {
    display: flex;
    gap: 12px;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 500;
    font-size: 14px;
    text-decoration: none;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
}

.btn svg {
    width: 18px;
    height: 18px;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

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

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

.btn-ghost:hover {
    background: var(--background);
    color: var(--text);
}

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

.btn-danger:hover {
    background: #FEE2E2;
}

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

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

.btn-warning {
    background: #FEF3C7;
    border: 1px solid #F59E0B;
    color: #92400E;
}

.btn-warning:hover {
    background: #FDE68A;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
}

.btn-block {
    width: 100%;
    justify-content: center;
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table th,
.table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.table th {
    font-size: 12px;
    text-transform: uppercase;
    color: var(--text-muted);
    font-weight: 600;
    letter-spacing: 0.5px;
}

.table tr:hover {
    background: var(--background);
}

.row-paid {
    opacity: 0.6;
}

.table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
}

.category-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.status-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.status-paid { background: #DBEAFE; color: #1E40AF; }
.status-pending { background: #FEF3C7; color: #92400E; }

.badge-fixed {
    background: #DBEAFE;
    color: #1E40AF;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    margin-left: 8px;
}

.badge-recurrent {
    background: #D1FAE5;
    color: #065F46;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    margin-left: 8px;
    font-weight: bold;
}

.month-filter input {
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 14px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

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

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    font-size: 14px;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.2s;
}

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

.form-group small {
    display: block;
    margin-top: 4px;
    font-size: 12px;
    color: var(--text-muted);
}

.form-checkboxes {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 24px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 400;
    cursor: pointer;
}

.checkbox-label input {
    width: auto;
}

.error-text {
    color: var(--danger);
    font-size: 13px;
    margin-top: 4px;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
}

.auth-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #0EA5E9 0%, #0284C7 100%);
}

.auth-container {
    width: 100%;
    max-width: 420px;
    padding: 20px;
}

.auth-card {
    background: var(--surface);
    border-radius: 16px;
    padding: 40px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}

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

.auth-header .logo-icon {
    font-size: 48px;
}

.auth-header h1 {
    font-size: 24px;
    margin: 16px 0 8px;
    color: var(--text);
}

.auth-header p {
    color: var(--text-muted);
}

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

.auth-footer {
    text-align: center;
    margin-top: 24px;
    color: var(--text-muted);
}

.auth-footer a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
}

.auth-links {
    text-align: center;
    margin-top: 16px;
    margin-bottom: 8px;
}

.auth-links a {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 14px;
}

.auth-links a:hover {
    color: var(--primary);
    text-decoration: underline;
}

.strategy-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
    margin-bottom: 32px;
}

.strategy-card {
    background: var(--surface);
    border-radius: 12px;
    padding: 24px;
    border: 2px solid var(--border);
}

.strategy-avalanche {
    border-color: var(--primary);
}

.strategy-snowball {
    border-color: var(--secondary);
}

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

.strategy-header h3 {
    font-size: 18px;
}

.strategy-tag {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.tag-primary {
    background: #DBEAFE;
    color: #1E40AF;
}

.tag-secondary {
    background: #DBEAFE;
    color: #1E40AF;
}

.strategy-desc {
    color: var(--text-muted);
    margin-bottom: 20px;
}

.strategy-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 20px;
}

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

.strategy-stat .stat-label {
    font-size: 11px;
    text-transform: uppercase;
    color: var(--text-muted);
}

.strategy-stat .stat-value {
    font-size: 16px;
    font-weight: 600;
    display: block;
    margin-top: 4px;
}

.strategy-debts h4 {
    font-size: 14px;
    margin-bottom: 12px;
    color: var(--text-muted);
}

.strategy-debts ol {
    padding-left: 20px;
}

.strategy-debts li {
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 12px;
}

.strategy-debts li:last-child {
    border-bottom: none;
}

.interest-badge {
    background: #FEE2E2;
    color: var(--danger);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
}

.balance {
    margin-left: auto;
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
}

.comparison-card {
    margin-top: 24px;
}

.comparison-card ul {
    padding-left: 24px;
    margin: 16px 0;
}

.comparison-card li {
    margin-bottom: 8px;
}

.tip {
    background: #FEF3C7;
    padding: 16px;
    border-radius: 8px;
    margin-top: 16px;
}

@media (max-width: 1024px) {
    .dashboard-grid,
    .strategy-grid {
        grid-template-columns: 1fr;
    }
    
    .card-full {
        grid-column: span 1;
    }
    
    .stats-3 {
        grid-template-columns: 1fr;
    }
}

.mobile-menu-btn {
    display: none;
}

@media (max-width: 768px) {
    html, body {
        overflow-x: hidden;
    }
    
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        z-index: 1001;
        position: fixed;
        top: 0;
        left: 0;
        height: 100vh;
        width: 280px;
        overflow-y: auto;
        box-shadow: 2px 0 10px rgba(0,0,0,0.1);
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .logo {
        padding: 16px;
    }
    
    .logo-icon {
        font-size: 24px;
    }
    
    .logo-text {
        font-size: 18px;
    }
    
    .nav-menu {
        padding: 12px 8px;
    }
    
    .nav-item {
        padding: 10px 12px;
        font-size: 14px;
    }
    
    .nav-icon {
        width: 20px;
        height: 20px;
    }
    
    .nav-footer {
        flex-wrap: wrap;
        gap: 8px;
        padding: 12px;
    }
    
    .user-info {
        flex: 1 1 auto;
        min-width: 0;
    }
    
    .user-avatar {
        width: 32px;
        height: 32px;
        font-size: 14px;
    }
    
    .user-name {
        font-size: 13px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 100px;
    }
    
    .main-content {
        margin-left: 0 !important;
        width: 100%;
        padding: 16px !important;
        padding-top: 70px !important;
    }
    
    .form-grid {
        grid-template-columns: 1fr;
    }
    
    .mobile-menu-btn {
        display: flex !important;
        position: fixed;
        top: 12px;
        left: 12px;
        z-index: 1002;
        background: var(--primary);
        border: none;
        border-radius: 8px;
        padding: 10px 14px;
        cursor: pointer;
        box-shadow: 0 2px 8px rgba(34, 197, 94, 0.4);
    }
    
    .mobile-menu-btn svg {
        width: 24px;
        height: 24px;
        color: white;
    }
    
    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0,0,0,0.5);
        z-index: 1000;
    }
    
    .sidebar-overlay.open {
        display: block;
    }
    
    .page-header {
        flex-direction: column;
        gap: 12px;
        align-items: flex-start;
        margin-bottom: 16px;
    }
    
    .page-actions {
        width: 100%;
        justify-content: flex-start;
    }
    
    .dashboard-header {
        flex-direction: column;
        gap: 12px;
        align-items: flex-start;
        margin-bottom: 16px;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .stat-card {
        padding: 16px;
    }
    
    .stat-label {
        font-size: 12px;
    }
    
    .stat-value {
        font-size: 20px;
    }
    
    h1 {
        font-size: 1.4rem;
        margin-top: 40px;
    }
    
    h2 {
        font-size: 1.2rem;
    }
    
    h3 {
        font-size: 1rem;
    }
    
    .card {
        padding: 16px;
        margin-bottom: 16px;
        overflow-x: auto;
    }
    
    .card-header {
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .card-header h3 {
        font-size: 14px;
        width: 100%;
    }
    
    .btn {
        padding: 10px 14px;
        font-size: 13px;
    }
    
    .btn-sm {
        padding: 6px 10px;
        font-size: 12px;
    }
    
    .table {
        font-size: 12px;
    }
    
    .table th, .table td {
        padding: 8px 6px;
    }
}
