:root {
    --primary: #4361ee;
    --primary-light: #eef1ff;
    --success: #10b981;
    --success-light: #ecfdf5;
    --warning: #f59e0b;
    --danger: #ef4444;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-500: #6b7280;
    --gray-700: #374151;
    --gray-900: #111827;
    --radius: 12px;
    --shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
    --shadow-md: 0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.06);
    --shadow-lg: 0 10px 15px rgba(0,0,0,.1), 0 4px 6px rgba(0,0,0,.05);
}

* {
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--gray-50);
    color: var(--gray-900);
    min-height: 100vh;
}

.navbar {
    background: white;
    border-bottom: 1px solid var(--gray-200);
    padding: 1rem 0;
    box-shadow: var(--shadow);
}

.navbar-brand {
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--primary) !important;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.navbar-brand i {
    font-size: 1.5rem;
}

.hero-section h1 {
    color: var(--gray-900);
}

.hero-section .lead {
    max-width: 680px;
    margin: 0.5rem auto 0;
}

.section-card {
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    background: white;
}

.section-card .card-header {
    background: white;
    border-bottom: 1px solid var(--gray-200);
    padding: 1rem 1.25rem;
}

.section-card .card-header h5 {
    margin: 0;
    font-weight: 600;
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--gray-900);
}

.section-card .card-header h5 i {
    color: var(--primary);
    font-size: 1.1rem;
}

.section-card .card-body {
    padding: 1.25rem;
}

.form-label {
    font-weight: 500;
    font-size: 0.875rem;
    color: var(--gray-700);
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.form-label i {
    font-size: 0.8rem;
}

.form-control, .form-select {
    border-radius: 8px;
    border: 1px solid var(--gray-300);
    font-size: 0.9375rem;
    transition: border-color .15s, box-shadow .15s;
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(67, 97, 238, .15);
}

.input-group-text {
    background: var(--gray-100);
    border-color: var(--gray-300);
    color: var(--gray-500);
    font-size: 0.875rem;
}

.form-text {
    font-size: 0.75rem;
    color: var(--gray-500);
}

.ratio-preview {
    background: var(--primary-light);
    border: 1px solid rgba(67, 97, 238, .2);
    border-radius: 8px;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.form-check-input:checked {
    background-color: var(--primary);
    border-color: var(--primary);
}

.form-switch .form-check-input {
    width: 3em;
    height: 1.5em;
    cursor: pointer;
}

.method-toggle .form-check-label {
    font-size: 0.875rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}

.expense-type-legend {
    display: flex;
    gap: 1.25rem;
    flex-wrap: wrap;
    padding: 0.75rem;
    background: var(--gray-50);
    border-radius: 8px;
    border: 1px solid var(--gray-200);
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.8rem;
}

.expense-row {
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    background: var(--gray-50);
    border-radius: 8px;
    border: 1px solid var(--gray-200);
    transition: box-shadow .15s;
}

.expense-row:hover {
    box-shadow: var(--shadow);
}

.remove-expense-btn {
    border-radius: 8px;
}

.suggestions-panel {
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: 8px;
    padding: 1rem;
}

.suggestions-header {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.9rem;
}

.suggestion-chip {
    border-radius: 20px;
    font-size: 0.8rem;
    transition: all .15s;
}

.suggestion-chip:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.suggestion-chip i {
    font-size: 0.7rem;
}

#calculate-btn {
    background: var(--primary);
    border-color: var(--primary);
    border-radius: 10px;
    font-weight: 600;
    box-shadow: var(--shadow-md);
    transition: all .2s;
}

#calculate-btn:hover {
    background: #3451d1;
    transform: translateY(-1px);
    box-shadow: var(--shadow-lg);
}

#calculate-btn:active {
    transform: translateY(0);
}

.stat-card {
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 1rem;
    text-align: center;
}

.stat-card-highlight {
    background: var(--success-light);
    border-color: #a7f3d0;
}

.stat-icon {
    font-size: 1.5rem;
    color: var(--primary);
    margin-bottom: 0.25rem;
}

.stat-card-highlight .stat-icon {
    color: var(--success);
}

.stat-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--gray-500);
    font-weight: 600;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--gray-900);
    margin-top: 0.15rem;
}

.stat-card-highlight .stat-value {
    color: var(--success);
}

.vehicle-comparison-detail {
    font-size: 0.8rem;
    line-height: 1.6;
}

.results-table th {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--gray-500);
    font-weight: 600;
    border-bottom: 2px solid var(--gray-200);
}

.results-table th i {
    margin-right: 0.25rem;
}

.results-table td {
    font-size: 0.9rem;
    vertical-align: middle;
}

.results-card {
    animation: slideUp .4s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.alert {
    border-radius: var(--radius);
}

footer {
    border-top: 1px solid var(--gray-200);
    margin-top: 2rem;
}

.bg-success-subtle {
    background-color: var(--success-light) !important;
}

@media (max-width: 768px) {
    .expense-type-legend {
        flex-direction: column;
        gap: 0.5rem;
    }

    .expense-row .row > div {
        margin-bottom: 0.25rem;
    }

    .stat-value {
        font-size: 1.25rem;
    }
}
