/**
 * Componentes Partilhados - Toasts, Modais, etc.
 */

/* ===== TOAST CONTAINER ===== */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
    max-width: calc(100vw - 40px);
}

/* ===== TOAST ===== */
.toast {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    border-radius: 12px;
    background: var(--toast-bg, #fff);
    box-shadow: var(--toast-shadow, 0 4px 20px rgba(0, 0, 0, 0.15));
    pointer-events: auto;
    transform: translateX(120%);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    max-width: 380px;
    min-width: 280px;
}

.toast-show {
    transform: translateX(0);
    opacity: 1;
}

.toast-hide {
    transform: translateX(120%);
    opacity: 0;
}

.toast-icon {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: bold;
    flex-shrink: 0;
}

.toast-message {
    flex: 1;
    font-size: 14px;
    line-height: 1.4;
    color: var(--toast-text, #333);
}

.toast-close {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: #999;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s;
    flex-shrink: 0;
}

.toast-close:hover {
    background: rgba(0, 0, 0, 0.05);
    color: #333;
}

/* Toast Types */
.toast-success {
    border-left: 4px solid #10b981;
}

.toast-success .toast-icon {
    background: #d1fae5;
    color: #10b981;
}

.toast-error {
    border-left: 4px solid #ef4444;
}

.toast-error .toast-icon {
    background: #fee2e2;
    color: #ef4444;
}

.toast-warning {
    border-left: 4px solid #f59e0b;
}

.toast-warning .toast-icon {
    background: #fef3c7;
    color: #f59e0b;
}

.toast-info {
    border-left: 4px solid #3b82f6;
}

.toast-info .toast-icon {
    background: #dbeafe;
    color: #3b82f6;
}

/* ===== CONFIRM MODAL ===== */
.confirm-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10001;
    opacity: 0;
    transition: opacity 0.2s ease;
    padding: 20px;
}

.confirm-overlay.confirm-show {
    opacity: 1;
}

.confirm-modal {
    background: var(--dialog-bg, #fff);
    border-radius: 16px;
    max-width: 400px;
    width: 100%;
    transform: scale(0.9);
    transition: transform 0.2s ease;
    overflow: hidden;
}

.confirm-show .confirm-modal {
    transform: scale(1);
}

.confirm-header {
    padding: 20px 24px 0;
}

.confirm-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: var(--dialog-header-text, #1e293b);
}

.confirm-body {
    padding: 12px 24px 24px;
}

.confirm-body p {
    margin: 0;
    color: var(--dialog-body-text, #64748b);
    font-size: 15px;
    line-height: 1.5;
}

.confirm-footer {
    padding: 16px 24px;
    background: var(--dialog-footer-bg, #f1f5f9);
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.confirm-footer .btn {
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
}

.confirm-footer .btn-cancel {
    background: var(--card-bg, #fff);
    color: var(--text-primary, #334155);
    border: 1px solid var(--border-color, #cbd5e1);
}

.confirm-footer .btn-cancel:hover {
    background: var(--hover-bg, #e8edf5);
}

.confirm-footer .btn-confirm {
    background: #3b82f6;
    color: #fff;
}

.confirm-footer .btn-confirm:hover {
    background: #2563eb;
}

/* Confirm Types */
.confirm-danger .btn-confirm {
    background: #ef4444;
}

.confirm-danger .btn-confirm:hover {
    background: #dc2626;
}

.confirm-warning .btn-confirm {
    background: #f59e0b;
}

.confirm-warning .btn-confirm:hover {
    background: #d97706;
}

/* ===== MOBILE RESPONSIVE ===== */
@media (max-width: 480px) {
    .toast-container {
        top: auto;
        bottom: 20px;
        right: 10px;
        left: 10px;
    }

    .toast {
        max-width: none;
        min-width: auto;
        width: 100%;
        transform: translateY(120%);
    }

    .toast-show {
        transform: translateY(0);
    }

    .toast-hide {
        transform: translateY(120%);
    }

    .confirm-modal {
        margin: 0 10px;
    }

    .confirm-footer {
        flex-direction: column-reverse;
    }

    .confirm-footer .btn {
        width: 100%;
        padding: 14px;
    }
}

/* ===== SAFE AREA (NOTCH) ===== */
@supports (padding-top: env(safe-area-inset-top)) {
    .toast-container {
        top: calc(20px + env(safe-area-inset-top));
        right: calc(20px + env(safe-area-inset-right));
    }

    @media (max-width: 480px) {
        .toast-container {
            bottom: calc(20px + env(safe-area-inset-bottom));
            right: calc(10px + env(safe-area-inset-right));
            left: calc(10px + env(safe-area-inset-left));
        }
    }
}

/* ===== LUCIDE ICONS ===== */
.lucide-icon,
[data-lucide] {
    width: 1em;
    height: 1em;
    display: inline-block;
    vertical-align: middle;
}

.header-icon {
    width: 1.5rem;
    height: 1.5rem;
    margin-right: 0.5rem;
    vertical-align: -0.2em;
}

.section-icon {
    width: 1.25rem;
    height: 1.25rem;
    margin-right: 0.5rem;
    vertical-align: -0.15em;
}

.section-icon.warning {
    color: var(--warning);
}

.card-icon [data-lucide] {
    width: 1.5rem;
    height: 1.5rem;
}

.card-receitas .card-icon [data-lucide] {
    color: var(--success);
}

.card-despesas .card-icon [data-lucide] {
    color: var(--danger);
}

.card-saldo .card-icon [data-lucide] {
    color: var(--primary);
}

/* Icon in buttons */
.btn [data-lucide],
.btn-link [data-lucide],
.btn-export [data-lucide] {
    width: 1rem;
    height: 1rem;
    vertical-align: -0.15em;
    margin-right: 0.25rem;
}

.btn-add [data-lucide] {
    width: 1.25rem;
    height: 1.25rem;
}

/* ===== USER MENU ===== */
.user-menu {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-right: 0.75rem;
}

.user-name {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--gray-700);
    display: none;
}

@media (min-width: 768px) {
    .user-name {
        display: inline;
    }
}

.btn-logout {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    background: transparent;
    border: 1px solid var(--gray-200);
    border-radius: 0.5rem;
    color: var(--gray-600);
    cursor: pointer;
    transition: all 0.2s;
}

.btn-logout:hover {
    background: #fee2e2;
    border-color: #fecaca;
    color: var(--danger);
}

.btn-logout [data-lucide] {
    width: 1.25rem;
    height: 1.25rem;
}

/* ===== PROFILE CARD ===== */
.profile-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.5rem;
    background: var(--card-bg, white);
    border-radius: 0.75rem;
    box-shadow: var(--shadow-sm, 0 1px 3px rgba(0,0,0,0.1));
    margin-bottom: 1rem;
}

.profile-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.profile-avatar {
    width: 3.5rem;
    height: 3.5rem;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary) 0%, #6366f1 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.5rem;
    font-weight: 600;
}

.profile-avatar [data-lucide] {
    width: 1.5rem;
    height: 1.5rem;
}

.profile-details {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.profile-name {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--gray-900);
}

.profile-email {
    font-size: 0.875rem;
    color: var(--gray-500);
}

.btn-outline {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1rem;
    background: transparent;
    border: 1px solid var(--gray-300);
    border-radius: 0.5rem;
    color: var(--gray-700);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-outline:hover {
    background: var(--gray-50);
    border-color: var(--gray-400);
}

.btn-outline [data-lucide] {
    width: 1rem;
    height: 1rem;
}

/* ===== ABOUT CARD ===== */
.about-card {
    background: var(--card-bg, white);
    border-radius: 0.75rem;
    box-shadow: var(--shadow-sm, 0 1px 3px rgba(0,0,0,0.1));
    overflow: hidden;
}

.about-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--gray-100);
}

.about-item:last-child {
    border-bottom: none;
}

.about-label {
    font-size: 0.875rem;
    color: var(--gray-600);
}

.about-value {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--gray-900);
}

/* ===== BUTTON VARIANTS ===== */
.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
}

.btn-full {
    width: 100%;
    justify-content: center;
}

.btn-full [data-lucide] {
    width: 1.25rem;
    height: 1.25rem;
    margin-right: 0.5rem;
}

/* ===== INPUT WRAPPER ===== */
.input-wrapper {
    position: relative;
}

.input-wrapper input {
    padding-right: 3rem;
}

.password-toggle {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--gray-400);
    cursor: pointer;
    padding: 0.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.password-toggle:hover {
    color: var(--gray-600);
}

.password-toggle [data-lucide] {
    width: 1.25rem;
    height: 1.25rem;
}

/* ===== SEARCH BOX WITH ICON ===== */
.search-box {
    position: relative;
}

.search-box .search-icon {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    width: 1.25rem;
    height: 1.25rem;
    color: var(--gray-400);
    pointer-events: none;
}

.search-box .search-input {
    padding-left: 2.5rem;
}

.search-box .search-clear {
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
}

.search-box .search-clear [data-lucide] {
    width: 1rem;
    height: 1rem;
}

/* ===== PAGE HEADER ===== */
.page-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.page-header h1 {
    flex: 1;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
}

.page-header .header-spacer {
    width: 2.5rem;
}

.btn-back {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    background: var(--card-bg, white);
    border: 1px solid var(--border-color, var(--gray-200));
    border-radius: 0.5rem;
    color: var(--text-secondary, var(--gray-700));
    text-decoration: none;
    transition: all 0.2s;
}

.btn-back:hover {
    background: var(--gray-50);
    border-color: var(--gray-300);
}

.btn-back [data-lucide] {
    width: 1.25rem;
    height: 1.25rem;
}

.btn-add-small {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    background: var(--primary);
    border: none;
    border-radius: 0.5rem;
    color: white;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-add-small:hover {
    background: var(--primary-dark, #2563eb);
    transform: scale(1.05);
}

.btn-add-small [data-lucide] {
    width: 1.25rem;
    height: 1.25rem;
}

/* ===== DARK MODE via [data-theme="dark"] ===== */
[data-theme="dark"] .profile-name {
    color: var(--text-primary);
}

[data-theme="dark"] .profile-email {
    color: var(--text-secondary);
}

[data-theme="dark"] .about-item {
    border-color: var(--border-color);
}

[data-theme="dark"] .about-label {
    color: var(--text-secondary);
}

[data-theme="dark"] .about-value {
    color: var(--text-primary);
}

[data-theme="dark"] .btn-outline {
    border-color: var(--border-color);
    color: var(--text-primary);
}

[data-theme="dark"] .btn-outline:hover {
    background: var(--hover-bg);
    border-color: var(--gray-300);
}

[data-theme="dark"] .user-name {
    color: var(--text-primary);
}

[data-theme="dark"] .btn-logout {
    border-color: var(--border-color);
    color: var(--text-secondary);
}

[data-theme="dark"] .btn-logout:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: rgba(239, 68, 68, 0.3);
    color: #f87171;
}

[data-theme="dark"] .btn-back:hover {
    background: var(--hover-bg);
}

[data-theme="dark"] .search-box .search-icon {
    color: var(--text-tertiary);
}

/* ===== MOBILE RESPONSIVE ===== */
@media (max-width: 480px) {
    .profile-card {
        flex-direction: column;
        text-align: center;
    }

    .profile-info {
        flex-direction: column;
    }

    .btn-outline {
        width: 100%;
        justify-content: center;
    }
}

/* ============================================
   UI/UX IMPROVEMENTS
   ============================================ */

/* ===== SKELETON LOADERS ===== */
.skeleton {
    background: linear-gradient(
        90deg,
        var(--bg-secondary, #e8edf5) 25%,
        var(--hover-bg, rgba(0, 0, 0, 0.04)) 50%,
        var(--bg-secondary, #e8edf5) 75%
    );
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s infinite;
    border-radius: 4px;
}

@keyframes skeleton-shimmer {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

.skeleton-text {
    height: 1em;
    margin-bottom: 0.5em;
}

.skeleton-text.short {
    width: 40%;
}

.skeleton-text.medium {
    width: 70%;
}

.skeleton-text.long {
    width: 100%;
}

.skeleton-circle {
    border-radius: 50%;
}

.skeleton-card {
    padding: 1rem;
    background: var(--card-bg, white);
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
}

.skeleton-row {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* ===== FADE IN ANIMATION ===== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.3s ease-out;
}

/* ===== SLIDE IN ANIMATION ===== */
@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.slide-in-right {
    animation: slideInRight 0.3s ease-out;
}

.slide-in-up {
    animation: slideInUp 0.3s ease-out;
}

/* ===== SCALE ANIMATION ===== */
@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.scale-in {
    animation: scaleIn 0.2s ease-out;
}

/* ===== PULSE ANIMATION ===== */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.pulse {
    animation: pulse 2s ease-in-out infinite;
}

/* ===== BOUNCE ANIMATION ===== */
@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-5px);
    }
}

.bounce {
    animation: bounce 0.5s ease;
}

/* ===== LOADING SPINNER ===== */
.spinner {
    width: 24px;
    height: 24px;
    border: 3px solid var(--bg-secondary, #e8edf5);
    border-top-color: var(--primary, #3b82f6);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.spinner-sm {
    width: 16px;
    height: 16px;
    border-width: 2px;
}

.spinner-lg {
    width: 40px;
    height: 40px;
    border-width: 4px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ===== LOADING STATE ===== */
.loading-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(var(--card-bg-rgb, 255, 255, 255), 0.8);
    border-radius: inherit;
    z-index: 10;
}

.btn.loading {
    position: relative;
    pointer-events: none;
    color: transparent !important;
}

.btn.loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin-top: -8px;
    margin-left: -8px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

/* ===== ACCESSIBILITY IMPROVEMENTS ===== */

/* Focus visible styles */
:focus-visible {
    outline: 2px solid var(--primary, #3b82f6);
    outline-offset: 2px;
}

/* Skip to content link */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--primary, #3b82f6);
    color: white;
    padding: 8px 16px;
    z-index: 10000;
    transition: top 0.2s;
}

.skip-link:focus {
    top: 0;
}

/* Screen reader only */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* High contrast mode improvements */
@media (prefers-contrast: high) {
    .card,
    .conta-card,
    .transaction-item {
        border: 2px solid currentColor;
    }

    .btn {
        border: 2px solid currentColor;
    }

    .progress-bar,
    .progress-bar-hero {
        border: 1px solid currentColor;
    }
}

/* Reduced motion preference */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .skeleton {
        animation: none;
        background: var(--bg-secondary, #e8edf5);
    }
}

/* ===== HAPTIC FEEDBACK (VISUAL) ===== */
.tap-effect {
    transition: transform 0.1s ease;
}

.tap-effect:active {
    transform: scale(0.97);
}

/* ===== RIPPLE EFFECT ===== */
.ripple {
    position: relative;
    overflow: hidden;
}

.ripple::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    pointer-events: none;
    background-image: radial-gradient(circle, var(--primary, #3b82f6) 10%, transparent 10.01%);
    background-repeat: no-repeat;
    background-position: 50%;
    transform: scale(10, 10);
    opacity: 0;
    transition: transform 0.5s, opacity 0.8s;
}

.ripple:active::after {
    transform: scale(0, 0);
    opacity: 0.3;
    transition: 0s;
}

/* ===== STAGGERED LIST ANIMATION ===== */
.stagger-list > * {
    animation: fadeIn 0.3s ease-out backwards;
}

.stagger-list > *:nth-child(1) { animation-delay: 0ms; }
.stagger-list > *:nth-child(2) { animation-delay: 50ms; }
.stagger-list > *:nth-child(3) { animation-delay: 100ms; }
.stagger-list > *:nth-child(4) { animation-delay: 150ms; }
.stagger-list > *:nth-child(5) { animation-delay: 200ms; }
.stagger-list > *:nth-child(6) { animation-delay: 250ms; }
.stagger-list > *:nth-child(7) { animation-delay: 300ms; }
.stagger-list > *:nth-child(8) { animation-delay: 350ms; }
.stagger-list > *:nth-child(9) { animation-delay: 400ms; }
.stagger-list > *:nth-child(10) { animation-delay: 450ms; }

/* ===== EMPTY STATE IMPROVED ===== */
.empty-state-modern {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 1.5rem;
    text-align: center;
}

.empty-state-modern .empty-icon {
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-secondary, #e8edf5);
    border-radius: 20px;
    margin-bottom: 1.5rem;
}

.empty-state-modern .empty-icon i,
.empty-state-modern .empty-icon svg {
    width: 40px;
    height: 40px;
    color: var(--text-tertiary, #94a3b8);
}

.empty-state-modern h3 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary, #0f172a);
    margin: 0 0 0.5rem;
}

.empty-state-modern p {
    font-size: 0.9375rem;
    color: var(--text-secondary, #64748b);
    margin: 0 0 1.5rem;
    max-width: 300px;
}

/* ===== NOTIFICATION BADGE ===== */
.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    font-size: 0.75rem;
    font-weight: 600;
    color: white;
    background: var(--danger, #ef4444);
    border-radius: 10px;
}

.badge-sm {
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    font-size: 0.625rem;
}

.badge-primary {
    background: var(--primary, #3b82f6);
}

.badge-success {
    background: var(--success, #22c55e);
}

.badge-warning {
    background: var(--warning, #f59e0b);
}

/* Position badge on parent */
.has-badge {
    position: relative;
}

.has-badge .badge {
    position: absolute;
    top: -6px;
    right: -6px;
}

/* ===== TOOLTIP ===== */
[data-tooltip] {
    position: relative;
}

[data-tooltip]::before {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(-4px);
    padding: 6px 10px;
    background: var(--gray-900, #0f172a);
    color: white;
    font-size: 0.75rem;
    font-weight: 500;
    white-space: nowrap;
    border-radius: 6px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s, transform 0.2s;
    z-index: 1000;
}

[data-tooltip]::after {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: var(--gray-900, #0f172a);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s;
    z-index: 1000;
}

[data-tooltip]:hover::before,
[data-tooltip]:hover::after {
    opacity: 1;
    visibility: visible;
}

[data-tooltip]:hover::before {
    transform: translateX(-50%) translateY(-8px);
}

/* ===== PROGRESS INDICATOR ===== */
.progress-steps {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.progress-step {
    width: 8px;
    height: 8px;
    background: var(--bg-secondary, #dce3ed);
    border-radius: 50%;
    transition: all 0.2s;
}

.progress-step.active {
    width: 24px;
    background: var(--primary, #3b82f6);
    border-radius: 4px;
}

.progress-step.completed {
    background: var(--success, #22c55e);
}

/* ===== DARK MODE FOR NEW COMPONENTS via [data-theme="dark"] ===== */
[data-theme="dark"] .skeleton {
    background: linear-gradient(
        90deg,
        #334155 25%,
        #475569 50%,
        #334155 75%
    );
    background-size: 200% 100%;
}

[data-theme="dark"] .spinner {
    border-color: #334155;
    border-top-color: #60a5fa;
}

[data-theme="dark"] [data-tooltip]::before {
    background: #f1f5f9;
    color: #0f172a;
}

[data-theme="dark"] [data-tooltip]::after {
    border-top-color: #f1f5f9;
}

[data-theme="dark"] .empty-state-modern .empty-icon {
    background: #334155;
}

/* ===== TOGGLE SWITCH (REPETIR) ===== */
.repetir-group {
    margin-top: 0.25rem;
}

.toggle-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    user-select: none;
}

.toggle-text {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--text-primary, #0f172a);
}

.toggle-text [data-lucide] {
    width: 1.125rem;
    height: 1.125rem;
    color: var(--text-tertiary, #94a3b8);
}

.toggle-switch {
    position: relative;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}

.toggle-slider {
    position: absolute;
    inset: 0;
    background: var(--toggle-bg, #cbd5e1);
    border-radius: 24px;
    transition: background 0.2s;
    cursor: pointer;
}

.toggle-slider::before {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    left: 2px;
    bottom: 2px;
    background: white;
    border-radius: 50%;
    transition: transform 0.2s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.toggle-switch input:checked + .toggle-slider {
    background: var(--primary, #3b82f6);
}

.toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(20px);
}

.toggle-switch input:focus-visible + .toggle-slider {
    outline: 2px solid var(--primary, #3b82f6);
    outline-offset: 2px;
}

/* ===== REPEAT OPTIONS ===== */
.repeat-options {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.75rem;
    overflow: hidden;
    animation: slideDown 0.2s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        max-height: 0;
        margin-top: 0;
    }
    to {
        opacity: 1;
        max-height: 60px;
        margin-top: 0.75rem;
    }
}

.repeat-options select {
    flex: 1;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border-color, #dce3ed);
    border-radius: 0.5rem;
    background: var(--card-bg, #fff);
    color: var(--text-primary, #0f172a);
    font-size: 0.875rem;
    cursor: pointer;
    appearance: auto;
}

/* ===== RECURRING SUGGESTION BANNER ===== */
.recurring-suggestion {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: var(--card-bg, #fff);
    border: 1px solid var(--primary-light, #60a5fa);
    border-left: 4px solid var(--primary, #3b82f6);
    border-radius: 0.75rem;
    margin-bottom: 1rem;
    animation: slideInUp 0.3s ease-out;
    box-shadow: var(--shadow-sm);
}

.recurring-suggestion-icon {
    flex-shrink: 0;
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #dbeafe;
    border-radius: 0.5rem;
    color: var(--primary, #3b82f6);
}

.recurring-suggestion-icon [data-lucide] {
    width: 1.125rem;
    height: 1.125rem;
}

.recurring-suggestion-text {
    flex: 1;
    font-size: 0.8125rem;
    color: var(--text-secondary, #475569);
    line-height: 1.4;
}

.recurring-suggestion-text strong {
    color: var(--text-primary, #0f172a);
}

.recurring-suggestion-actions {
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
}

.recurring-suggestion-actions .btn-suggestion {
    padding: 0.375rem 0.75rem;
    border: none;
    border-radius: 0.375rem;
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-suggestion.accept {
    background: var(--primary, #3b82f6);
    color: white;
}

.btn-suggestion.accept:hover {
    background: var(--primary-dark, #2563eb);
}

.btn-suggestion.dismiss {
    background: var(--bg-secondary, #e8edf5);
    color: var(--text-secondary, #64748b);
}

.btn-suggestion.dismiss:hover {
    background: var(--hover-bg, rgba(0,0,0,0.08));
}

/* ===== PATTERNS BANNER ===== */
.patterns-banner {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 1rem;
    background: linear-gradient(135deg, #fef3c7, #fde68a);
    border-radius: 0.75rem;
    margin-bottom: 1rem;
    font-size: 0.875rem;
    color: #92400e;
    animation: fadeIn 0.3s ease-out;
}

.patterns-banner [data-lucide] {
    width: 1.125rem;
    height: 1.125rem;
    flex-shrink: 0;
}

.patterns-banner a {
    margin-left: auto;
    color: #92400e;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
}

.patterns-banner a:hover {
    text-decoration: underline;
}

/* ===== DARK MODE - RECURRING COMPONENTS ===== */
[data-theme="dark"] .toggle-text {
    color: var(--text-primary);
}

[data-theme="dark"] .toggle-text [data-lucide] {
    color: var(--text-tertiary);
}

[data-theme="dark"] .repeat-options select {
    background: var(--card-bg);
    border-color: var(--border-color);
    color: var(--text-primary);
}

[data-theme="dark"] .recurring-suggestion {
    background: var(--card-bg);
    border-color: rgba(96, 165, 250, 0.3);
}

[data-theme="dark"] .recurring-suggestion-icon {
    background: rgba(59, 130, 246, 0.2);
    color: #60a5fa;
}

[data-theme="dark"] .recurring-suggestion-text {
    color: var(--text-secondary);
}

[data-theme="dark"] .recurring-suggestion-text strong {
    color: var(--text-primary);
}

[data-theme="dark"] .btn-suggestion.dismiss {
    background: var(--hover-bg);
    color: var(--text-secondary);
}

[data-theme="dark"] .patterns-banner {
    background: linear-gradient(135deg, rgba(251, 191, 36, 0.15), rgba(245, 158, 11, 0.1));
    color: #fbbf24;
}

[data-theme="dark"] .patterns-banner a {
    color: #fbbf24;
}

/* ===== MOBILE - RECURRING COMPONENTS ===== */
@media (max-width: 480px) {
    .recurring-suggestion {
        flex-wrap: wrap;
    }

    .recurring-suggestion-actions {
        width: 100%;
        justify-content: flex-end;
    }

    .repeat-options {
        flex-wrap: wrap;
    }

    .repeat-options select {
        min-width: 0;
    }
}

/* ============================================
   Card Glass Effect (v3.0)
   ============================================ */
.card-glass {
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg, 1rem);
    box-shadow: var(--elevation-2, 0 4px 12px rgba(0,0,0,0.1));
    transition: transform var(--transition-normal), box-shadow var(--transition-normal);
}

.card-glass:hover {
    box-shadow: var(--elevation-3, 0 8px 24px rgba(0,0,0,0.12));
}

/* ============================================
   Hero Card (Dashboard v3.0)
   ============================================ */
.hero-card {
    background: var(--gradient-primary);
    border-radius: var(--radius-xl, 1.5rem);
    padding: var(--space-6, 1.5rem);
    color: white;
    position: relative;
    overflow: hidden;
    margin-bottom: var(--space-6, 1.5rem);
}

.hero-card::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -30%;
    width: 60%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
    pointer-events: none;
}

.hero-saldo-label {
    font-size: var(--text-sm, 0.875rem);
    opacity: 0.85;
    font-weight: 500;
    margin-bottom: var(--space-1, 0.25rem);
}

.hero-saldo-value {
    font-size: var(--text-3xl, 2rem);
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1.2;
}

.hero-variacao {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: var(--text-sm, 0.875rem);
    font-weight: 600;
    margin-top: var(--space-2, 0.5rem);
    padding: 2px 10px;
    border-radius: var(--radius-full, 9999px);
    background: rgba(255, 255, 255, 0.2);
}

.hero-variacao svg {
    width: 14px;
    height: 14px;
}

.hero-row {
    display: flex;
    gap: var(--space-4, 1rem);
    margin-top: var(--space-4, 1rem);
}

.hero-stat {
    flex: 1;
    background: rgba(255, 255, 255, 0.15);
    border-radius: var(--radius-md, 0.75rem);
    padding: var(--space-3, 0.75rem);
    text-align: center;
}

.hero-stat-label {
    font-size: var(--text-xs, 0.75rem);
    opacity: 0.8;
    font-weight: 500;
}

.hero-stat-value {
    font-size: var(--text-lg, 1.125rem);
    font-weight: 700;
    margin-top: 2px;
}

.hero-progress {
    margin-top: var(--space-4, 1rem);
}

.hero-progress-bar {
    height: 6px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
    overflow: hidden;
}

.hero-progress-fill {
    height: 100%;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 3px;
    transition: width 1s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.hero-progress-label {
    display: flex;
    justify-content: space-between;
    font-size: var(--text-xs, 0.75rem);
    opacity: 0.75;
    margin-top: 4px;
}

/* ============================================
   Quick Stats Mini Cards (Dashboard v3.0)
   ============================================ */
.quick-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-3, 0.75rem);
    margin-bottom: var(--space-6, 1.5rem);
}

.quick-stat-card {
    background: var(--card-bg);
    border-radius: var(--radius-lg, 1rem);
    padding: var(--space-4, 1rem);
    box-shadow: var(--elevation-1, 0 1px 3px rgba(0,0,0,0.08));
    text-align: center;
    transition: transform var(--transition-normal), box-shadow var(--transition-normal);
}

.quick-stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--elevation-2, 0 4px 12px rgba(0,0,0,0.1));
}

.quick-stat-emoji {
    font-size: 1.25rem;
    margin-bottom: var(--space-1, 0.25rem);
}

.quick-stat-value {
    font-size: var(--text-xl, 1.25rem);
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1.2;
}

.quick-stat-label {
    font-size: var(--text-xs, 0.75rem);
    color: var(--text-tertiary);
    font-weight: 500;
    margin-top: 2px;
}

.quick-stat-change {
    font-size: var(--text-xs, 0.75rem);
    font-weight: 600;
    margin-top: 4px;
}

.quick-stat-change.positive { color: var(--success); }
.quick-stat-change.negative { color: var(--danger); }
.quick-stat-change.neutral { color: var(--text-tertiary); }

/* Score colors */
.score-green { color: var(--success); }
.score-yellow { color: var(--warning); }
.score-red { color: var(--danger); }

/* ============================================
   Calendar Heatmap (Dashboard v3.0)
   ============================================ */
.calendar-heatmap {
    background: var(--card-bg);
    border-radius: var(--radius-lg, 1rem);
    padding: var(--space-4, 1rem);
    box-shadow: var(--elevation-1, 0 1px 3px rgba(0,0,0,0.08));
    margin-bottom: var(--space-6, 1.5rem);
}

.calendar-heatmap-header {
    display: flex;
    align-items: center;
    gap: var(--space-2, 0.5rem);
    margin-bottom: var(--space-3, 0.75rem);
}

.calendar-heatmap-header svg {
    width: 18px;
    height: 18px;
    color: var(--text-secondary);
}

.calendar-heatmap-title {
    font-size: var(--text-sm, 0.875rem);
    font-weight: 600;
    color: var(--text-primary);
}

.calendar-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
    margin-bottom: 4px;
}

.calendar-weekday {
    text-align: center;
    font-size: 0.625rem;
    font-weight: 600;
    color: var(--text-tertiary);
    text-transform: uppercase;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
}

.calendar-day {
    aspect-ratio: 1;
    border-radius: var(--radius-sm, 0.375rem);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.625rem;
    font-weight: 500;
    color: var(--text-tertiary);
    cursor: pointer;
    transition: all var(--transition-fast);
    position: relative;
}

.calendar-day:hover {
    transform: scale(1.2);
    z-index: 1;
}

.calendar-day.empty {
    cursor: default;
}

.calendar-day.empty:hover {
    transform: none;
}

.calendar-day.today {
    outline: 2px solid var(--primary);
    outline-offset: 1px;
}

/* Heatmap intensity levels */
.calendar-day.level-0 { background: var(--bg-secondary); }
.calendar-day.level-1 { background: rgba(34, 197, 94, 0.2); color: var(--success); }
.calendar-day.level-2 { background: rgba(34, 197, 94, 0.4); color: white; }
.calendar-day.level-3 { background: rgba(245, 158, 11, 0.4); color: white; }
.calendar-day.level-4 { background: rgba(239, 68, 68, 0.4); color: white; }
.calendar-day.level-5 { background: rgba(239, 68, 68, 0.7); color: white; }

.calendar-legend {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 4px;
    margin-top: var(--space-2, 0.5rem);
    font-size: 0.625rem;
    color: var(--text-tertiary);
}

.calendar-legend-block {
    width: 12px;
    height: 12px;
    border-radius: 2px;
}

/* ============================================
   Smart Feed (Dashboard v3.0)
   ============================================ */
.smart-feed {
    margin-bottom: var(--space-6, 1.5rem);
}

.smart-feed-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-3, 0.75rem);
}

.smart-feed-title {
    font-size: var(--text-base, 1rem);
    font-weight: 700;
    color: var(--text-primary);
}

.smart-feed-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-2, 0.5rem);
}

.feed-item {
    display: flex;
    align-items: center;
    gap: var(--space-3, 0.75rem);
    padding: var(--space-3, 0.75rem) var(--space-4, 1rem);
    background: var(--card-bg);
    border-radius: var(--radius-md, 0.75rem);
    box-shadow: var(--elevation-1, 0 1px 3px rgba(0,0,0,0.08));
    transition: transform var(--transition-fast);
    cursor: pointer;
    text-decoration: none;
    color: inherit;
}

.feed-item:hover {
    transform: translateX(4px);
}

.feed-item-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md, 0.75rem);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.feed-item-icon svg {
    width: 18px;
    height: 18px;
}

.feed-item-icon.insight { background: rgba(59, 130, 246, 0.1); color: var(--primary); }
.feed-item-icon.warning { background: rgba(245, 158, 11, 0.1); color: var(--warning); }
.feed-item-icon.success { background: rgba(34, 197, 94, 0.1); color: var(--success); }
.feed-item-icon.danger { background: rgba(239, 68, 68, 0.1); color: var(--danger); }
.feed-item-icon.celebration { background: rgba(168, 85, 247, 0.1); color: #a855f7; }
.feed-item-icon.transaction { background: var(--bg-secondary); color: var(--text-secondary); }
.feed-item-icon.recurring { background: rgba(34, 197, 94, 0.1); color: var(--success); }

.feed-item-content {
    flex: 1;
    min-width: 0;
}

.feed-item-text {
    font-size: var(--text-sm, 0.875rem);
    color: var(--text-primary);
    font-weight: 500;
    line-height: 1.4;
}

.feed-item-meta {
    font-size: var(--text-xs, 0.75rem);
    color: var(--text-tertiary);
    margin-top: 2px;
}

.feed-item-value {
    font-size: var(--text-base, 1rem);
    font-weight: 700;
    flex-shrink: 0;
}

.feed-item-value.despesa { color: var(--danger); }
.feed-item-value.receita { color: var(--success); }

/* ============================================
   Animated Number Counter (v3.0)
   ============================================ */
.counter-animate {
    display: inline-block;
    transition: opacity 0.2s;
}

/* ============================================
   Stagger Animations (v3.0)
   ============================================ */
.stagger-in > * {
    opacity: 0;
    transform: translateY(10px);
    animation: staggerFadeIn 0.4s ease forwards;
}

.stagger-in > *:nth-child(1) { animation-delay: 0ms; }
.stagger-in > *:nth-child(2) { animation-delay: 50ms; }
.stagger-in > *:nth-child(3) { animation-delay: 100ms; }
.stagger-in > *:nth-child(4) { animation-delay: 150ms; }
.stagger-in > *:nth-child(5) { animation-delay: 200ms; }
.stagger-in > *:nth-child(6) { animation-delay: 250ms; }
.stagger-in > *:nth-child(7) { animation-delay: 300ms; }
.stagger-in > *:nth-child(8) { animation-delay: 350ms; }
.stagger-in > *:nth-child(9) { animation-delay: 400ms; }
.stagger-in > *:nth-child(10) { animation-delay: 450ms; }

@keyframes staggerFadeIn {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================
   Info Bottom Sheet (Metric Explanations)
   ============================================ */
.info-sheet-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.info-sheet-backdrop.active {
    opacity: 1;
    visibility: visible;
}

.info-sheet {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--card-bg);
    border-radius: 1.25rem 1.25rem 0 0;
    max-height: 85vh;
    overflow-y: auto;
    transform: translateY(100%);
    transition: transform 0.35s cubic-bezier(0.32, 0.72, 0, 1);
    z-index: 1001;
    padding-bottom: env(safe-area-inset-bottom, 0);
}

.info-sheet-backdrop.active .info-sheet {
    transform: translateY(0);
}

.info-sheet-handle {
    width: 36px;
    height: 4px;
    background: var(--gray-300);
    border-radius: 2px;
    margin: 10px auto 0;
}

.info-sheet-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem 0.5rem;
}

.info-sheet-header h3 {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.info-sheet-header h3 .info-header-emoji {
    font-size: 1.25rem;
}

.info-sheet-close {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background var(--transition-fast);
}

.info-sheet-close:hover {
    background: var(--border-color);
}

.info-sheet-close svg {
    width: 16px;
    height: 16px;
}

.info-sheet-body {
    padding: 0.75rem 1.25rem 1.5rem;
}

.info-description {
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 1rem;
}

/* Score Circle */
.info-score-display {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.25rem;
    padding: 1rem;
    background: var(--bg-secondary);
    border-radius: 0.75rem;
}

.info-score-circle {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 800;
    color: white;
    flex-shrink: 0;
}

.info-score-circle.green { background: linear-gradient(135deg, #22c55e, #16a34a); }
.info-score-circle.yellow { background: linear-gradient(135deg, #f59e0b, #d97706); }
.info-score-circle.red { background: linear-gradient(135deg, #ef4444, #dc2626); }

.info-score-text {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.info-score-text strong {
    color: var(--text-primary);
}

/* Breakdown Bars */
.info-breakdown-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.info-breakdown-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.info-breakdown-icon {
    font-size: 1rem;
    width: 24px;
    text-align: center;
    flex-shrink: 0;
}

.info-breakdown-label {
    font-size: 0.8125rem;
    color: var(--text-primary);
    font-weight: 500;
    min-width: 100px;
    flex-shrink: 0;
}

.info-breakdown-bar-track {
    flex: 1;
    height: 6px;
    background: var(--bg-secondary);
    border-radius: 3px;
    overflow: hidden;
    min-width: 60px;
}

.info-breakdown-bar-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.info-breakdown-bar-fill.green { background: var(--success); }
.info-breakdown-bar-fill.yellow { background: var(--warning); }
.info-breakdown-bar-fill.red { background: var(--danger); }
.info-breakdown-bar-fill.blue { background: var(--primary); }

.info-breakdown-pts {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-secondary);
    min-width: 40px;
    text-align: right;
    flex-shrink: 0;
}

/* Formula Breakdown (Safe-to-Spend) */
.info-formula {
    background: var(--bg-secondary);
    border-radius: 0.75rem;
    padding: 1rem;
    margin-bottom: 1rem;
}

.info-formula-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    font-size: 0.875rem;
    border-bottom: 1px solid var(--border-color);
}

.info-formula-row:last-child {
    border-bottom: none;
}

.info-formula-row .formula-label {
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.info-formula-row .formula-label svg {
    width: 14px;
    height: 14px;
}

.info-formula-row .formula-value {
    font-weight: 600;
}

.info-formula-row .formula-value.positive { color: var(--success); }
.info-formula-row .formula-value.negative { color: var(--danger); }

.info-formula-row.result {
    border-top: 2px solid var(--border-color);
    margin-top: 0.25rem;
    padding-top: 0.75rem;
}

.info-formula-row.result .formula-label {
    color: var(--text-primary);
    font-weight: 700;
}

.info-formula-row.result .formula-value {
    font-size: 1rem;
    font-weight: 800;
    color: var(--primary);
}

/* Velocity Gauge */
.info-velocity-gauge {
    background: var(--bg-secondary);
    border-radius: 0.75rem;
    padding: 1rem;
    margin-bottom: 1rem;
}

.info-gauge-bar-container {
    position: relative;
    height: 8px;
    background: var(--border-color);
    border-radius: 4px;
    margin: 1rem 0 0.75rem;
    overflow: visible;
}

.info-gauge-zone {
    position: absolute;
    top: 0;
    height: 100%;
    border-radius: 4px;
}

.info-gauge-zone.below { left: 0; width: 33.3%; background: rgba(34, 197, 94, 0.3); }
.info-gauge-zone.normal { left: 33.3%; width: 33.4%; background: rgba(59, 130, 246, 0.3); }
.info-gauge-zone.above { left: 66.7%; width: 33.3%; background: rgba(239, 68, 68, 0.3); }

.info-gauge-marker {
    position: absolute;
    top: -4px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 3px solid var(--card-bg);
    box-shadow: 0 1px 4px rgba(0,0,0,0.2);
    transform: translateX(-50%);
    transition: left 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.info-gauge-marker.green { background: var(--success); }
.info-gauge-marker.blue { background: var(--primary); }
.info-gauge-marker.red { background: var(--danger); }

.info-gauge-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.6875rem;
    color: var(--text-tertiary);
    margin-top: 0.25rem;
}

.info-gauge-comparison {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    margin-top: 1rem;
}

.info-gauge-stat {
    text-align: center;
    padding: 0.625rem;
    background: var(--card-bg);
    border-radius: 0.5rem;
}

.info-gauge-stat-label {
    font-size: 0.6875rem;
    color: var(--text-tertiary);
    margin-bottom: 0.25rem;
}

.info-gauge-stat-value {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
}

/* Tip box */
.info-tip {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.75rem;
    background: rgba(59, 130, 246, 0.06);
    border-radius: 0.75rem;
    border-left: 3px solid var(--primary);
    margin-top: 0.75rem;
}

.info-tip svg {
    width: 16px;
    height: 16px;
    color: var(--primary);
    flex-shrink: 0;
    margin-top: 1px;
}

.info-tip span {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* Heatmap Legend Explanation */
.info-heatmap-scale {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem;
    background: var(--bg-secondary);
    border-radius: 0.75rem;
    margin-bottom: 1rem;
}

.info-heatmap-scale-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    flex: 1;
}

.info-heatmap-color {
    width: 28px;
    height: 28px;
    border-radius: 0.375rem;
}

.info-heatmap-label {
    font-size: 0.625rem;
    color: var(--text-tertiary);
    text-align: center;
}

/* Quick Stat Card - clickable state */
.quick-stat-card {
    cursor: pointer;
    position: relative;
}

.quick-stat-card::after {
    content: '';
    position: absolute;
    bottom: 6px;
    left: 50%;
    transform: translateX(-50%);
    width: 20px;
    height: 3px;
    border-radius: 1.5px;
    background: var(--border-color);
    opacity: 0.6;
    transition: opacity var(--transition-fast);
}

.quick-stat-card:hover::after {
    opacity: 1;
}

/* Section info button */
.section-info-btn {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: var(--text-tertiary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color var(--transition-fast), background var(--transition-fast);
    padding: 0;
    margin-left: auto;
}

.section-info-btn:hover {
    color: var(--primary);
    background: rgba(59, 130, 246, 0.08);
}

.section-info-btn svg {
    width: 16px;
    height: 16px;
}

/* ============================================
   Top Merchants Section (Dashboard v3.1)
   ============================================ */
.top-merchants-section {
    margin-bottom: var(--space-6, 1.5rem);
}

.top-merchants-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-2, 0.5rem);
}

.merchant-item {
    display: flex;
    align-items: center;
    gap: var(--space-3, 0.75rem);
    padding: var(--space-3, 0.75rem) var(--space-4, 1rem);
    background: var(--card-bg);
    border-radius: var(--radius-md, 0.75rem);
    box-shadow: var(--elevation-1, 0 1px 3px rgba(0,0,0,0.08));
}

.merchant-rank {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.6875rem;
    font-weight: 700;
    flex-shrink: 0;
}

.merchant-rank.rank-1 { background: linear-gradient(135deg, #fbbf24, #f59e0b); color: white; }
.merchant-rank.rank-2 { background: linear-gradient(135deg, #94a3b8, #64748b); color: white; }
.merchant-rank.rank-3 { background: linear-gradient(135deg, #d97706, #b45309); color: white; }
.merchant-rank.rank-other { background: var(--bg-secondary); color: var(--text-tertiary); }

.merchant-info {
    flex: 1;
    min-width: 0;
}

.merchant-name {
    font-size: var(--text-sm, 0.875rem);
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.merchant-count {
    font-size: var(--text-xs, 0.75rem);
    color: var(--text-tertiary);
}

.merchant-total {
    font-size: var(--text-sm, 0.875rem);
    font-weight: 700;
    color: var(--danger);
    flex-shrink: 0;
}

.merchant-bar-track {
    width: 60px;
    height: 4px;
    background: var(--bg-secondary);
    border-radius: 2px;
    overflow: hidden;
    flex-shrink: 0;
}

.merchant-bar-fill {
    height: 100%;
    background: var(--danger);
    border-radius: 2px;
    opacity: 0.6;
    transition: width 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Desktop: wider info sheet */
@media (min-width: 768px) {
    .info-sheet {
        max-width: 480px;
        left: 50%;
        transform: translateX(-50%) translateY(100%);
        border-radius: 1.25rem 1.25rem 0 0;
    }

    .info-sheet-backdrop.active .info-sheet {
        transform: translateX(-50%) translateY(0);
    }
}
