/* MONO — components.css */

.card {
    background: var(--surface-raised);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: var(--space-4);
}

.card--surface { background: var(--surface); }

.stat-card { display: flex; flex-direction: column; gap: var(--space-2); }
.stat-card__label { color: var(--text-secondary); font-size: 13px; }
.stat-card__value { font-size: 24px; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.stat-card__delta { font-size: 12px; display: inline-flex; align-items: center; gap: 4px; color: var(--text-secondary); }
.stat-card__delta[data-direction="up"]::before { content: "▲"; font-size: 9px; }
.stat-card__delta[data-direction="down"]::before { content: "▼"; font-size: 9px; }

.grid { display: grid; gap: var(--space-4); }
.grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid-cols-4 { grid-template-columns: repeat(4, 1fr); }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    min-height: 44px;
    padding: 0 var(--space-4);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    border: 1px solid transparent;
    transition: background-color var(--duration-fast) var(--easing), transform var(--duration-fast) var(--easing), opacity var(--duration-fast) var(--easing);
    white-space: nowrap;
}
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn--primary { background: var(--text-primary); color: var(--background); }
.btn--primary:hover { opacity: 0.88; }

.btn--secondary { background: var(--surface); color: var(--text-primary); border-color: var(--border); }
.btn--secondary:hover { background: var(--border); }

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

.btn--danger { background: var(--negative); color: #ffffff; }

.btn--sm { min-height: 36px; padding: 0 var(--space-3); font-size: 13px; }
.btn--icon { width: 44px; height: 44px; padding: 0; flex-shrink: 0; }
.btn--block { width: 100%; }

.btn svg { width: 18px; height: 18px; flex-shrink: 0; }

.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: var(--radius-full);
    font-size: 12px;
    font-weight: 600;
    border: 1px solid var(--border);
    color: var(--text-secondary);
}
.badge--positive { color: var(--positive); border-color: currentColor; }
.badge--negative { color: var(--negative); border-color: currentColor; }
.badge--outline-only { background: transparent; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

.list { display: flex; flex-direction: column; }
.list-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) 0;
    border-bottom: 1px solid var(--border);
}
.list-item:last-child { border-bottom: none; }

.list-item__icon {
    width: 40px; height: 40px;
    border-radius: var(--radius-full);
    background: var(--surface);
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.list-item__icon svg { width: 18px; height: 18px; }

.list-item__body { flex: 1; min-width: 0; }
.list-item__title { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-item__meta { font-size: 12px; color: var(--text-secondary); }
.list-item__amount { font-weight: 700; font-size: 14px; font-variant-numeric: tabular-nums; flex-shrink: 0; text-align: right; }
.list-item__amount[data-sign="negative"] { color: var(--negative); }
.list-item__amount[data-sign="positive"] { color: var(--positive); }

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: var(--space-3);
    padding: var(--space-7) var(--space-4);
    color: var(--text-secondary);
}
.empty-state svg { width: 40px; height: 40px; color: var(--text-tertiary); }

/* Toasts */
.toast-region {
    position: fixed;
    bottom: calc(var(--bottom-nav-height) + var(--space-4) + var(--safe-bottom));
    left: 50%;
    transform: translateX(-50%);
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    width: min(92vw, 380px);
}
.toast {
    background: var(--text-primary);
    color: var(--background);
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-sm);
    font-size: 13px;
    box-shadow: var(--shadow-md);
    display: flex;
    align-items: center;
    gap: var(--space-2);
    animation: toast-in var(--duration-base) var(--easing);
}
.toast[data-type="error"] { background: var(--negative); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* Modal / bottom sheet */
.modal-overlay {
    position: fixed; inset: 0;
    background: var(--overlay);
    z-index: 90;
    display: flex;
    align-items: flex-end;
    justify-content: center;
}
.modal-overlay[hidden] { display: none; }

.modal-sheet {
    background: var(--surface-raised);
    width: 100%;
    max-width: 480px;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    padding: var(--space-5);
    padding-bottom: calc(var(--space-5) + var(--safe-bottom));
    max-height: 88vh;
    overflow-y: auto;
    animation: sheet-in var(--duration-base) var(--easing);
}
@keyframes sheet-in { from { transform: translateY(24px); opacity: 0.6; } to { transform: translateY(0); opacity: 1; } }

.modal-sheet__handle {
    width: 36px; height: 4px;
    border-radius: var(--radius-full);
    background: var(--border-strong);
    margin: 0 auto var(--space-4);
}

.modal-sheet__header { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--space-4); }

@media (min-width: 1024px) {
    .modal-overlay { align-items: center; }
    .modal-sheet { border-radius: var(--radius-lg); max-height: 80vh; }
    .toast-region { bottom: var(--space-5); left: auto; right: var(--space-5); transform: none; }
}

/* Confirmation card (AI chat / receipt review) */
.confirm-card {
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-md);
    padding: var(--space-4);
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    background: var(--surface);
}
.confirm-card__row { display: flex; justify-content: space-between; gap: var(--space-3); font-size: 13px; }
.confirm-card__row dt { color: var(--text-secondary); }
.confirm-card__row dd { font-weight: 600; text-align: right; }
.confirm-card__actions { display: flex; gap: var(--space-2); margin-top: var(--space-2); }
.confirm-card__actions .btn { flex: 1; }

/* Chat */
.chat-scroll { display: flex; flex-direction: column; gap: var(--space-3); padding-bottom: var(--space-4); }
.chat-bubble { max-width: 82%; padding: var(--space-3) var(--space-4); border-radius: var(--radius-md); font-size: 14px; line-height: 1.5; }
.chat-bubble--user { align-self: flex-end; background: var(--text-primary); color: var(--background); border-bottom-right-radius: 4px; }
.chat-bubble--assistant { align-self: flex-start; background: var(--surface); border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.chat-bubble--assistant .confirm-card { margin-top: var(--space-2); }

.chat-input-bar {
    display: flex;
    gap: var(--space-2);
    align-items: flex-end;
    padding: var(--space-3);
    border-top: 1px solid var(--border);
    background: var(--background);
}
.chat-input-bar textarea {
    flex: 1;
    resize: none;
    max-height: 120px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: var(--space-3);
    background: var(--surface);
}

/* Tabs / segmented control */
.segmented {
    display: inline-flex;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 3px;
    gap: 2px;
}
.segmented button, .segmented a {
    padding: var(--space-2) var(--space-3);
    border-radius: calc(var(--radius-sm) - 3px);
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    min-height: 36px;
    align-items: center;
}
.segmented button[aria-selected="true"], .segmented a[aria-selected="true"] { background: var(--surface-raised); color: var(--text-primary); box-shadow: var(--shadow-sm); }

/* Progress bar (budgets, goals) */
.progress { height: 8px; border-radius: var(--radius-full); background: var(--surface); overflow: hidden; border: 1px solid var(--border); }
.progress__fill { height: 100%; background: var(--text-primary); border-radius: var(--radius-full); transition: width var(--duration-base) var(--easing); }
.progress__fill[data-state="over"] { background: var(--negative); }

/* Skeleton loading */
.skeleton { background: linear-gradient(90deg, var(--surface) 25%, var(--border) 37%, var(--surface) 63%); background-size: 400% 100%; animation: skeleton-shimmer 1.4s ease infinite; border-radius: var(--radius-sm); }
@keyframes skeleton-shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }
@media (prefers-reduced-motion: reduce) { .skeleton { animation: none; } }

.icon-btn { width: 44px; height: 44px; display: inline-flex; align-items: center; justify-content: center; border-radius: var(--radius-full); color: var(--text-secondary); }
.icon-btn:hover { background: var(--surface); color: var(--text-primary); }
.icon-btn svg { width: 20px; height: 20px; }
