:root {
    /* Auto mode base (Light mode default) */
    --bg-color: #fafafa;
    --surface-color: #ffffff;
    --text-primary: #111827;
    --text-secondary: #6b7280;
    --border-color: #e5e7eb;
    --primary-color: #0f172a;
    --accent-color: #2563eb;
    --accent-light: #eff6ff;
    --danger-color: #dc2626;
    
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -2px rgba(0, 0, 0, 0.025);
    
    --radius-md: 12px;
    --radius-lg: 16px;
    
    --transition-fast: 0.2s ease;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg-color: #0f172a;
        --surface-color: #1e293b;
        --text-primary: #f8fafc;
        --text-secondary: #94a3b8;
        --border-color: #334155;
        --primary-color: #ffffff;
        --accent-color: #3b82f6;
        --accent-light: #1d4ed8;
        --danger-color: #ef4444;
        
        --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
        --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
        --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4);
    }
}

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

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.5;
    padding: 2rem;
    transition: background-color var(--transition-fast), color var(--transition-fast);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
}

/* Header */
.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 3rem;
    flex-wrap: wrap;
    gap: 2rem;
}

.user-info h1 {
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 0.25rem;
}

.user-info p {
    color: var(--text-secondary);
    font-size: 1rem;
}

.total-summary {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.summary-card {
    background-color: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.25rem 1.5rem;
    min-width: 200px;
    box-shadow: var(--shadow-sm);
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.summary-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.summary-card.primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.summary-card.primary .summary-label {
    color: var(--bg-color);
    opacity: 0.8;
}

.summary-card.primary .summary-value {
    color: var(--bg-color);
}

.summary-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.summary-value {
    font-size: 1.5rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.summary-value.highlight {
    color: var(--accent-color);
}

/* Grid layout */
.loans-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

/* Cards */
.loan-card {
    background-color: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.loan-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

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

.loan-name {
    font-size: 1.125rem;
    font-weight: 600;
}

.badge {
    background-color: var(--accent-light);
    color: var(--accent-color);
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.data-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
    font-size: 0.9375rem;
}

.data-row:last-child {
    margin-bottom: 0;
}

.data-label {
    color: var(--text-secondary);
}

.data-value {
    font-weight: 500;
    font-variant-numeric: tabular-nums;
}

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

.total-row {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px dashed var(--border-color);
}

.total-row .data-label {
    font-weight: 600;
    color: var(--text-primary);
}

.total-row .data-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary-color);
}

/* Status colors */
.text-normal {
    color: var(--text-primary);
}

.text-warning {
    color: #f59e0b;
    font-weight: 600;
}

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

/* Mobile responsive */
@media (max-width: 768px) {
    body {
        padding: 1rem;
    }
    .user-info h1 {
        font-size: 1.5rem;
    }
    .dashboard-header {
        flex-direction: column;
        align-items: stretch;
        gap: 1.5rem;
    }
    .total-summary {
        flex-direction: column;
    }
    .summary-card {
        flex: 1;
        width: 100%;
        padding: 1rem;
    }
    .loans-grid {
        gap: 1rem;
    }
    .loan-card {
        padding: 1.25rem;
    }
    .summary-value {
        font-size: 1.25rem;
    }
}
