﻿/* ── Custom tooltip ────────────────────────────────────────────────── */
.va-tip {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.va-tip::after {
    content: attr(data-tip);
    position: absolute;
    bottom: calc(100% + 7px);
    left: 50%;
    transform: translateX(-50%) translateY(3px);
    background: #1e293b;
    color: #fff;
    font-size: 11px;
    font-weight: 500;
    padding: 4px 9px;
    border-radius: 6px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s, transform 0.15s;
    z-index: 9999;
    box-shadow: 0 2px 8px rgba(0,0,0,0.22);
    line-height: 1.4;
}

.va-tip:hover::after {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.va-tip-left::after {
    bottom: auto;
    left: auto;
    right: calc(100% + 7px);
    top: 50%;
    transform: translateX(3px) translateY(-50%);
}

.va-tip-left:hover::after {
    transform: translateX(0) translateY(-50%);
}

.va-tip-bottom::after {
    bottom: auto;
    top: calc(100% + 7px);
    transform: translateX(-50%) translateY(-3px);
}

.va-tip-bottom:hover::after {
    transform: translateX(-50%) translateY(0);
}

.va-tip-right::after {
    bottom: auto;
    left: calc(100% + 7px);
    top: 50%;
    transform: translateX(-3px) translateY(-50%);
}

.va-tip-right:hover::after {
    transform: translateX(0) translateY(-50%);
}

/* ── Layout ──────────────────────────────────────────────────────────── */
.va-container {
    position: fixed !important;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 12px;
    pointer-events: none;
}

    .va-container > * {
        pointer-events: all;
    }

.va-panel {
    position: fixed !important;
    right: 24px;
    bottom: 92px;
    z-index: 9998;
    width: 460px;
    height: 620px;
    border-radius: 16px !important;
    overflow: hidden;
    box-shadow: 0 12px 40px rgba(0,0,0,0.28) !important;
    background: #ffffff !important;
    display: grid !important;
    grid-template-rows: auto 1fr auto auto auto;
}

/* Header */
.va-header {
    background: linear-gradient(135deg, #0891b2 0%, #0ea5e9 55%, #2563eb 100%);
    padding: 11px 14px 12px; /* tăng padding-bottom để lộ nền xanh phía dưới */
    flex-shrink: 0;
    user-select: none;
}

    .va-header button, .va-header .mud-icon-button {
        cursor: pointer !important;
    }

.va-badge-pro {
    background: linear-gradient(135deg, #fbbf24, #f97316);
    color: white;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 10px;
    letter-spacing: 0.3px;
    white-space: nowrap;
}

.va-status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}

.va-online {
    background: #22c55e;
    box-shadow: 0 0 6px rgba(34,197,94,.7);
}

.va-listening {
    background: #ef4444;
    animation: vaBlink 1s ease-in-out infinite;
}

.va-badge-gemini {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: white;
    font-size: 10px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 8px;
    white-space: nowrap;
}

.va-badge-processing {
    background: linear-gradient(135deg, #f59e0b, #ef4444);
    color: white;
    font-size: 10px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 8px;
    animation: vaBlink 1s ease-in-out infinite;
    white-space: nowrap;
}

/* Tabs */
.va-tabs {
    display: flex;
    background: #ffffff;
    padding: 10px 10px 8px;
    gap: 6px;
    flex-shrink: 0;
    border-radius: 16px 16px 0 0; /* bo tròn 2 góc trên */
    margin-top: -14px; /* đè lên header để tạo hiệu ứng nổi */
    position: relative;
    z-index: 2;
    box-shadow: 0 -3px 10px rgba(0,0,0,0.05);
}

.va-tab-btn {
    flex: 1;
    padding: 6px 0;
    border-radius: 9px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
    border: 1.5px solid transparent;
    background: linear-gradient(#fff, #fff) padding-box, linear-gradient(135deg, #3b82f6, #38bdf8) border-box;
    color: #6b7280;
}

    .va-tab-btn.active {
        background: linear-gradient(135deg, #3b82f6, #38bdf8) padding-box, linear-gradient(135deg, #3b82f6, #38bdf8) border-box;
        border: 1.5px solid transparent;
        color: white;
        font-weight: 700;
        box-shadow: 0 2px 10px rgba(8,145,178,0.28);
    }

/* Content area */
.va-content {
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    position: relative;
    background-color: #f0faff;
}

.va-content::before {
        content: '';
        position: absolute;
        inset: 0;
        background-image: url('/images/logo-chatbot.png');
        background-size: 130px 130px;
        background-repeat: no-repeat;
        background-position: center center;
        opacity: 0.3;
        pointer-events: none;
        z-index: 0;
        top: 80px;
    }

/* Chat greeting bar */
.va-greeting-bar {
    background: linear-gradient(90deg, #3b82f6 0%, #38bdf8 100%);
    padding: 5px 14px;
    font-size: 12px;
    color: white;
    font-weight: 500;
    flex-shrink: 0;
    opacity: 0.95;
}

/* Chat area */
.va-chat-history {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 12px;
    scroll-behavior: smooth;
    background: transparent;
    position: relative;
    z-index: 1;
}

    .va-chat-history > *:last-child {
        margin-bottom: auto;
    }

/* User bubble */
.va-bubble-user {
    max-width: 82%;
    background: linear-gradient(135deg, #3b82f6, #2563eb) !important;
    border-radius: 16px 4px 16px 16px !important;
    padding: 9px 13px !important;
}

    .va-bubble-user .mud-typography {
        color: white !important;
    }

/* AI bubble */
.va-bubble-ai {
    max-width: 84%;
    background: #ffffff !important;
    border-radius: 4px 16px 16px 16px !important;
    padding: 9px 13px !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08) !important;
}

/* User avatar */
.va-user-avatar {
    width: 28px;
    height: 28px;
    min-width: 28px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    color: white;
    flex-shrink: 0;
}

.va-typing {
    display: flex;
    gap: 4px;
    align-items: center;
    padding: 2px 0;
    min-width: 32px;
}

    .va-typing span {
        width: 7px;
        height: 7px;
        border-radius: 50%;
        background: #2563eb;
        animation: vaTyping .9s ease-in-out infinite;
    }

        .va-typing span:nth-child(2) {
            animation-delay: .2s;
        }

        .va-typing span:nth-child(3) {
            animation-delay: .4s;
        }

.va-waveform {
    display: flex;
    align-items: center;
    gap: 3px;
    height: 22px;
}

.va-wave-bar {
    width: 3px;
    height: 5px;
    border-radius: 3px;
    background: #ef4444;
    animation: vaWave .6s ease-in-out infinite;
}

    .va-wave-bar:nth-child(1) { animation-delay: 0s; }
    .va-wave-bar:nth-child(2) { animation-delay: .1s; }
    .va-wave-bar:nth-child(3) { animation-delay: .2s; }
    .va-wave-bar:nth-child(4) { animation-delay: .1s; }
    .va-wave-bar:nth-child(5) { animation-delay: 0s; }

.va-interim {
    padding: 3px 12px 2px;
    font-size: 12px;
    color: #888;
    min-height: 20px;
    flex-shrink: 0;
    background: #f0faff;
}

/* Suggestions */
.va-suggestions {
    padding: 5px 10px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 5px;
    background: #f0faff;
    flex-shrink: 0;
}

.va-suggestion-chip {
    font-size: 11px !important;
    height: auto !important;
    min-height: 30px !important;
    padding: 3px 4px !important;
    white-space: normal !important;
    text-align: center !important;
    cursor: pointer !important;
    border-radius: 10px !important;
}

/* Input section */
.va-input-wrapper {
    position: relative;
    flex-shrink: 0;
}

/* Excel file badge */
.va-excel-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 4px 12px 2px;
    padding: 5px 10px;
    background: #f0fdf4;
    border: 1px solid #86efac;
    border-radius: 8px;
    font-size: 12px;
}

.va-excel-badge-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #166534;
    font-weight: 500;
}

.va-excel-badge-remove {
    flex-shrink: 0;
    background: none;
    border: none;
    cursor: pointer;
    color: #6b7280;
    font-size: 12px;
    line-height: 1;
    padding: 0 2px;
}

    .va-excel-badge-remove:hover {
        color: #ef4444;
    }

.va-input-section {
    background: #ffffff;
    padding: 7px 10px;
    border-top: 1px solid #e5e7eb;
}

.va-input-gw {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    border-radius: 14px;
    padding: 1.5px;
}

.va-input-inner {
    background: #fff;
    border-radius: 13px;
    display: flex;
    flex-direction: column;
    padding: 8px 6px 4px 10px;
    gap: 0;
}

.va-input-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 2px;
}

.va-text-input {
    width: 100%;
    border: none;
    outline: none;
    font-size: 13px;
    background: transparent;
    font-family: inherit;
    padding: 0;
    resize: none;
    line-height: 22px;
    min-height: 28px;
    overflow-y: hidden;
    display: block;
    box-sizing: border-box;
}

    .va-text-input.is-multiline {
        width: 100%;
    }

    .va-text-input::placeholder {
        color: #aaa;
    }

.va-input-actions {
    display: flex;
    align-items: center;
    gap: 0;
    flex-shrink: 0;
    margin-left: auto;
}

.va-model-dropdown {
    position: relative;
    flex-shrink: 0;
}

.va-model-trigger {
    display: flex;
    align-items: center;
    gap: 3px;
    font-size: 13px;
    font-weight: 500;
    background: #fff;
    color: #3c4043;
    border: 1px solid #dadce0;
    border-radius: 20px;
    padding: 6px 10px 6px 14px;
    cursor: pointer;
    font-family: inherit;
}

    .va-model-trigger svg {
        flex-shrink: 0;
        color: #5f6368;
    }

.va-model-backdrop {
    position: fixed;
    inset: 0;
    z-index: 20;
    background: transparent;
}

.va-model-panel {
    position: absolute;
    bottom: calc(100% + 8px);
    right: 0;
    z-index: 21;
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 8px 28px rgba(0,0,0,0.18);
    padding: 6px;
    min-width: 180px;
    animation: vaFadeInUp 0.15s ease-out;
}

.va-model-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 8px;
    border-radius: 9px;
    cursor: pointer;
    transition: background 0.12s;
}

    .va-model-item:hover {
        background: #f3f4f6;
    }

    .va-model-item.selected {
        background: #f1f3f4;
    }

.va-model-check {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.va-model-name {
    font-size: 13px;
    font-weight: 600;
    color: #1f2937;
}

/* Command palette */
.va-command-palette {
    position: absolute;
    bottom: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: 1.5px solid #3b82f6;
    border-radius: 10px 10px 0 0;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.13);
    max-height: 196px;
    overflow-y: auto;
    z-index: 1;
}

.va-command-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 14px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    transition: background 0.15s;
    user-select: none;
}

    .va-command-item:last-child {
        border-bottom: none;
    }

    .va-command-item:hover, .va-command-active {
        background: #e0f2fe;
    }

.va-command-name {
    font-size: 12px;
    font-weight: 600;
    color: #3b82f6;
    font-family: monospace;
}

.va-command-desc {
    font-size: 11px;
    color: #888;
    margin-top: 1px;
}

/* Message actions */
.va-msg-actions {
    display: flex;
    align-items: center;
    gap: 2px;
    margin-left: 34px;
    margin-top: -4px;
}

.va-msg-action-btn {
    opacity: 0.55;
    transition: opacity .15s;
}

    .va-msg-action-btn:hover {
        opacity: 1;
    }

.va-msg-action-active {
    opacity: 1 !important;
}

.va-ai-text ul, .va-ai-text ol {
    margin: 4px 0 4px 16px;
    padding: 0;
}

.va-ai-text li {
    margin-bottom: 2px;
}

.va-ai-text b, .va-ai-text strong {
    font-weight: 600;
}

.va-cursor {
    display: inline-block;
    width: 2px;
    margin-left: 1px;
    color: #2563eb;
    font-weight: bold;
    animation: vaBlink 0.7s ease-in-out infinite;
}

/* Thinking stream */
/* Thinking stream */
.va-thinking-stream {
    display: flex;
    align-items: center;
    gap: 7px;
    margin-bottom: 7px;
    padding: 6px 11px;
    background: linear-gradient(135deg, #f0f9ff, #e0f2fe);
    border: 1px solid #bae6fd;
    border-radius: 10px;
    animation: vaFadeInUp 0.2s ease-out;
}

.va-thinking-icon {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #0ea5e9;
    animation: vaThinkPulse 1.6s ease-in-out infinite;
}

.va-thinking-stream-label {
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 220px;
    display: block;
    background: linear-gradient(90deg, #94a3b8 0%, #0ea5e9 50%, #94a3b8 100%);
    background-size: 200% 100%;
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    animation: vaThinkShimmer 2.2s linear infinite;
}

@keyframes vaThinkShimmer {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

@keyframes vaThinkPulse {
    0%, 100% {
        opacity: 0.55;
        transform: scale(0.9);
    }

    50% {
        opacity: 1;
        transform: scale(1.08);
    }
}

/* History tab */
.va-history-search {
    padding: 8px 12px;
    background: #fff;
    border-bottom: 1px solid #e5e7eb;
    flex-shrink: 0;
}

    .va-history-search input {
        width: 100%;
        box-sizing: border-box;
        border: 1.5px solid #e5e7eb;
        border-radius: 10px;
        padding: 6px 12px;
        font-size: 12px;
        outline: none;
        font-family: inherit;
        background: #f9fafb;
    }

        .va-history-search input:focus {
            border-color: #3b82f6;
        }

.va-conv-list {
    flex: 1;
    overflow-y: auto;
    padding: 6px 8px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.va-conv-card {
    background: #fff;
    border-radius: 10px;
    padding: 9px 12px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.07);
    cursor: pointer;
    transition: box-shadow 0.15s;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}

    .va-conv-card:hover {
        box-shadow: 0 3px 12px rgba(59,130,246,0.18);
    }

.va-conv-title {
    font-size: 12px;
    font-weight: 600;
    color: #1e3a5f;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 310px;
}

.va-conv-meta {
    font-size: 11px;
    color: #888;
}

.va-conv-open-btn {
    font-size: 11px;
    color: #3b82f6;
    font-weight: 700;
    white-space: nowrap;
    flex-shrink: 0;
}

.va-load-more-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px 20px;
    font-size: 12px;
    font-weight: 600;
    color: #0ea5e9;
    background: #e0f2fe;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    transition: background 0.15s;
    font-family: inherit;
}

    .va-load-more-btn:hover:not(:disabled) {
        background: #bae6fd;
    }

    .va-load-more-btn:disabled {
        opacity: 0.6;
        cursor: default;
    }

/* Stats tab */
.va-stats-content {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
}

.va-period-toggle {
    display: flex;
    background: #f0f0f0;
    border-radius: 20px;
    padding: 2px;
    gap: 2px;
}

.va-period-toggle button {
    border: none;
    background: transparent;
    border-radius: 18px;
    padding: 3px 12px;
    font-size: 11px;
    font-weight: 500;
    color: #666;
    cursor: pointer;
    transition: all 0.2s;
}

.va-period-toggle button.active {
    background: #fff;
    color: #3b82f6;
    font-weight: 600;
    box-shadow: 0 1px 3px rgba(0,0,0,0.12);
}

.va-stat-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 12px;
}

.va-stat-card2 {
    background: #fff;
    border-radius: 10px;
    padding: 10px 12px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.07);
}

.va-sc-label {
    font-size: 10px;
    color: #888;
    margin-bottom: 2px;
}

.va-sc-value {
    font-size: 18px;
    font-weight: 700;
    color: #1e3a5f;
    line-height: 1.2;
}

.va-sc-trend {
    font-size: 10px;
    margin-top: 3px;
    font-weight: 600;
}

.va-sc-trend.up   { color: #22c55e; }
.va-sc-trend.down { color: #ef4444; }

.va-chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.va-chart-title {
    font-size: 11px;
    font-weight: 600;
    color: #555;
}

.va-chart-avg {
    font-size: 10px;
    color: #888;
}

.va-custom-chart {
    display: flex;
    gap: 2px;
    background: #f0faff;
    border-radius: 12px;
    padding: 8px 8px 6px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
    margin-bottom: 12px;
}

.va-cc-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    min-width: 0;
}

.va-cc-val {
    font-size: 9px;
    font-weight: 700;
    color: #0369a1;
    height: 13px;
    line-height: 13px;
    white-space: nowrap;
}

.va-cc-bar-area {
    width: 52%;
    height: 68px;
    display: flex;
    align-items: flex-end;
}

.va-cc-bar {
    width: 100%;
    min-height: 4px;
    border-radius: 4px 4px 0 0;
    background: rgba(56, 189, 248, 0.35);
    transition: height 0.35s ease;
}

.va-cc-bar.today {
    background: linear-gradient(180deg, #2563eb 0%, #0ea5e9 100%);
}

.va-cc-day {
    font-size: 9px;
    color: #aaa;
    white-space: nowrap;
}

.va-budget-card {
    background: #fff;
    border: 1px solid #cffafe;
    border-radius: 10px;
    padding: 10px 12px;
    margin-bottom: 12px;
}

.va-budget-title  { font-size: 11px; font-weight: 600; color: #0369a1; }
.va-budget-amount { font-size: 11px; font-weight: 700; color: #555; }

.va-budget-card .mud-progress-linear {
    height: 8px !important;
    min-height: 8px !important;
    background-color: #e5e7eb !important;
    border-radius: 4px !important;
}

.va-budget-card .mud-progress-linear-bar {
    background-color: #2563eb !important;
}

.va-budget-est {
    font-size: 10px;
    color: #0284c7;
}

.va-admin-section {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 10px;
    padding: 10px 12px;
    margin-bottom: 8px;
}

.va-admin-title {
    font-size: 11px;
    font-weight: 700;
    color: #1e40af;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* FAB */
.va-fab {
    border-radius: 50% !important;
}

.va-fab-active {
    animation: vaFabPulse 1.2s ease-out infinite !important;
}

.va-fab-spin .mud-button-icon-start {
    animation: vaSpin 1s linear infinite;
    display: inline-flex;
}

/* Custom FAB open button (pill with logo + label) */
.va-fab-open-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 24px;
    border: none;
    background: linear-gradient(135deg, #0a6ccb 0%, #1e90ff 100%);
    color: #ffffff;
    font-size: 13px;
    font-weight: 600;
    cursor: grab;
    box-shadow: 0 4px 12px rgba(10, 108, 203, 0.4);
    transition: all 0.3s ease;
    user-select: none;
}

.va-fab-open-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(37,99,235,0.55);
}

.va-fab-logo-img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.va-fab-open-label {
    font-size: 14px;
    font-weight: 600;
    color: white;
    letter-spacing: 0.2px;
}

/* Custom FAB close button (circle with X) */
.va-fab-close-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 16px rgba(37,99,235,0.45);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.va-fab-close-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(37,99,235,0.55);
}

/* Greeting bubble */
.va-greeting-bubble {
    position: fixed;
    bottom: 80px;
    right: 24px;
    width: 210px;
    background: #ffffff;
    border-radius: 12px;
    padding: 12px 32px 12px 14px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.18);
    font-size: 13px;
    line-height: 1.5;
    color: #333;
    z-index: 9999;
    animation: vaFadeInUp 0.35s ease-out;
}

    .va-greeting-bubble::after {
        content: '';
        position: absolute;
        bottom: -8px;
        right: 80px;
        border-left: 8px solid transparent;
        border-right: 8px solid transparent;
        border-top: 8px solid #ffffff;
        filter: drop-shadow(0 2px 1px rgba(0,0,0,0.06));
    }

.va-greeting-close {
    position: absolute;
    top: 6px;
    right: 8px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 15px;
    color: #aaa;
    line-height: 1;
    padding: 2px 4px;
    border-radius: 4px;
    transition: color 0.15s;
}

    .va-greeting-close:hover {
        color: #555;
    }

@keyframes vaWave {
    0%, 100% { height: 5px; }
    50%       { height: 20px; }
}

@keyframes vaTyping {
    0%, 100% { transform: translateY(0); }
    50%       { transform: translateY(-6px); }
}

@keyframes vaFabPulse {
    0%   { box-shadow: 0 0 0 0    rgba(244,67,54,.7); }
    70%  { box-shadow: 0 0 0 12px rgba(244,67,54,0); }
    100% { box-shadow: 0 0 0 0    rgba(244,67,54,0); }
}

@keyframes vaBlink {
    50% { opacity: .3; }
}

@keyframes vaSpin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

@keyframes vaFadeInUp {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes vaFadeInDown {
    from { opacity: 0; transform: translateY(-8px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0)   scale(1); }
}

/* ── History popup dropdown ────────────────────────────────────────── */
.va-history-backdrop {
    position: absolute;
    inset: 0;
    z-index: 59;
    background: transparent;
}

.va-history-popup {
    position: absolute;
    top: 54px;
    right: 8px;
    width: 340px;
    max-height: 460px;
    z-index: 60;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.22), 0 2px 8px rgba(0,0,0,0.10);
    border: 1px solid #e5e7eb;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: vaFadeInDown 0.16s ease-out;
}

.va-history-popup-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 8px 10px 14px;
    background: #f8fafc;
    border-bottom: 1px solid #e5e7eb;
    flex-shrink: 0;
}

.va-history-popup-title {
    color: #1e293b;
    font-size: 13px;
    font-weight: 700;
}

/* ── Budget circle icon ────────────────────────────────────────────── */
.va-budget-circle-wrap {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.va-budget-circle-btn {
    background: none;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    padding: 0;
    transition: background 0.15s;
}

    .va-budget-circle-btn:hover {
        background: #f0f4ff;
    }

/* ── Budget hover popup ────────────────────────────────────────────── */
.va-budget-popup {
    position: absolute;
    bottom: calc(100% + 10px);
    right: -8px;
    width: 210px;
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 8px 28px rgba(0,0,0,0.16);
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    opacity: 0;
    pointer-events: none;
    transform: translateY(6px);
    transition: opacity 0.18s ease, transform 0.18s ease;
    z-index: 30;
    border: 1px solid #e5e7eb;
}

.va-budget-circle-wrap:hover .va-budget-popup {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

.va-budget-popup-title {
    font-size: 10px;
    font-weight: 700;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.6px;
}

.va-budget-popup-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.va-budget-popup-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.va-budget-popup-label {
    font-size: 11px;
    color: #374151;
    font-weight: 500;
}

.va-budget-popup-val {
    font-size: 11px;
    font-weight: 700;
}

.va-budget-popup-bar {
    height: 6px;
    background: #e5e7eb;
    border-radius: 3px;
    overflow: hidden;
}

.va-budget-popup-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.3s ease;
    min-width: 2px;
}

.va-budget-popup-meta {
    font-size: 10px;
    color: #9ca3af;
}

.va-budget-popup-divider {
    height: 1px;
    background: #f0f0f0;
    margin: -2px 0;
}

.va-budget-popup-warn {
    font-size: 10px;
    color: #f59e0b;
    font-weight: 600;
    text-align: center;
    padding: 2px 0 0;
}