.card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: var(--space-lg);
    box-shadow: var(--shadow);
    transition: transform 0.15s;
}

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

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: var(--space-md) var(--space-lg);
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: var(--font-md);
    transition: all 0.2s;
    white-space: nowrap;
    -webkit-tap-highlight-color: transparent;
}

.btn:active { transform: scale(0.96); }

.btn-primary {
    background: var(--primary);
    color: var(--text-inverse);
}
.btn-primary:active { background: var(--primary-dark); }

.btn-success { background: var(--success); color: var(--text-inverse); }
.btn-danger { background: var(--danger); color: var(--text-inverse); }
.btn-warning { background: var(--warning); color: var(--text-inverse); }

.btn-outline {
    background: transparent;
    border: 1.5px solid var(--border);
    color: var(--text);
}
.btn-outline:active { background: var(--bg-input); }

.btn-ghost {
    background: transparent;
    color: var(--primary);
}
.btn-ghost:active { background: rgba(67, 97, 238, 0.1); }

.btn-sm {
    padding: var(--space-xs) var(--space-md);
    font-size: var(--font-sm);
}

.btn-lg {
    padding: var(--space-lg) var(--space-xl);
    font-size: var(--font-lg);
}

.btn-block { width: 100%; }

.btn-icon {
    width: 40px;
    height: 40px;
    padding: 0;
    border-radius: var(--radius-full);
}

.btn-fab {
    position: fixed;
    bottom: calc(var(--nav-height) + var(--safe-bottom) + var(--space-lg));
    right: var(--space-lg);
    width: 56px;
    height: 56px;
    border-radius: var(--radius-full);
    background: var(--primary);
    color: var(--text-inverse);
    font-size: var(--font-2xl);
    box-shadow: var(--shadow-lg);
    z-index: 90;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.form-group {
    margin-bottom: var(--space-lg);
}

.form-label {
    display: block;
    font-size: var(--font-sm);
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: var(--space-xs);
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: var(--space-md);
    background: var(--bg-input);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: var(--font-md);
    color: var(--text);
    transition: border-color 0.2s;
    appearance: none;
    -webkit-appearance: none;
}

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

.form-select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23636e72' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

.form-textarea {
    min-height: 80px;
    resize: vertical;
}

.form-hint {
    font-size: var(--font-xs);
    color: var(--text-muted);
    margin-top: var(--space-xs);
}

.form-error .form-input,
.form-error .form-select {
    border-color: var(--danger);
}

.form-error .form-hint {
    color: var(--danger);
}

.checkbox-group {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-md);
    background: var(--bg-input);
    border-radius: var(--radius-sm);
    cursor: pointer;
}

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

.divider {
    height: 1px;
    background: var(--border);
    margin: var(--space-lg) 0;
}

.section-divider {
    font-size: var(--font-sm);
    font-weight: 600;
    color: var(--primary);
    text-align: center;
    position: relative;
    margin: var(--space-lg) 0;
}

.section-divider::before,
.section-divider::after {
    content: '';
    position: absolute;
    top: 50%;
    width: calc(50% - 60px);
    height: 1px;
    background: var(--border);
}

.section-divider::before { left: 0; }
.section-divider::after { right: 0; }

.badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: var(--radius-full);
    font-size: var(--font-xs);
    font-weight: 600;
}

.badge-success { background: var(--success-light); color: var(--success); }
.badge-danger { background: var(--danger-light); color: var(--danger); }
.badge-warning { background: var(--warning-light); color: var(--warning); }
.badge-info { background: var(--info-light); color: var(--info); }

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

.progress-fill {
    height: 100%;
    border-radius: var(--radius-full);
    background: var(--primary);
    transition: width 0.5s ease;
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-2xl);
    text-align: center;
    color: var(--text-muted);
}

.empty-state .empty-icon {
    font-size: 48px;
    margin-bottom: var(--space-lg);
    opacity: 0.5;
}

.empty-state .empty-text {
    font-size: var(--font-md);
    margin-bottom: var(--space-lg);
}

.list-item {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md);
    border-radius: var(--radius-sm);
    transition: background 0.15s;
}

.list-item:active { background: var(--bg-input); }

.list-item .item-icon {
    width: 42px;
    height: 42px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--font-xl);
    flex-shrink: 0;
}

.list-item .item-content {
    flex: 1;
    min-width: 0;
}

.list-item .item-title {
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.list-item .item-subtitle {
    font-size: var(--font-sm);
    color: var(--text-secondary);
}

.list-item .item-amount {
    font-weight: 700;
    text-align: right;
    white-space: nowrap;
}

.list-item .item-actions {
    display: flex;
    gap: var(--space-xs);
}

.tab-bar {
    display: flex;
    background: var(--bg-input);
    border-radius: var(--radius);
    padding: 3px;
    gap: 3px;
}

.tab-btn {
    flex: 1;
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-sm);
    font-size: var(--font-sm);
    font-weight: 600;
    text-align: center;
    color: var(--text-secondary);
    transition: all 0.2s;
}

.tab-btn.active {
    background: var(--bg-card);
    color: var(--primary);
    box-shadow: var(--shadow);
}

.stat-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: var(--space-lg);
    box-shadow: var(--shadow);
}

.stat-label {
    font-size: var(--font-sm);
    color: var(--text-secondary);
    margin-bottom: var(--space-xs);
}

.stat-value {
    font-size: var(--font-xl);
    font-weight: 700;
}

.amount-positive { color: var(--success); }
.amount-negative { color: var(--danger); }

.toast-container {
    position: fixed;
    top: var(--space-lg);
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    pointer-events: none;
    width: calc(100% - var(--space-2xl));
    max-width: 400px;
}

.toast {
    padding: var(--space-md) var(--space-lg);
    border-radius: var(--radius-sm);
    color: var(--text-inverse);
    font-weight: 500;
    font-size: var(--font-sm);
    box-shadow: var(--shadow-lg);
    animation: toastIn 0.3s ease, toastOut 0.3s ease 2.7s forwards;
    pointer-events: auto;
    text-align: center;
}

.toast-success { background: var(--success); }
.toast-error { background: var(--danger); }
.toast-info { background: var(--info); }
.toast-warning { background: var(--warning); }

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

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

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    animation: fadeIn 0.2s ease;
}

.modal-content {
    background: var(--bg-card);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUp 0.3s ease;
    padding-bottom: var(--safe-bottom);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-lg);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    background: var(--bg-card);
    z-index: 1;
}

.modal-title {
    font-size: var(--font-lg);
    font-weight: 700;
}

.modal-close {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--font-xl);
    color: var(--text-secondary);
}

.modal-close:active { background: var(--bg-input); }

.modal-body {
    padding: var(--space-lg);
}

.modal-footer {
    display: flex;
    gap: var(--space-md);
    padding: var(--space-lg);
    border-top: 1px solid var(--border);
}

.modal-footer .btn { flex: 1; }

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

.chart-container {
    position: relative;
    width: 100%;
    height: 220px;
    margin-bottom: var(--space-md);
}

.chart-container canvas {
    width: 100% !important;
    height: 100% !important;
}
