/* ════════════════════════════════════════════
   AI CHATBOT — Wealth Finance Assistant
   wealth-ai.css — tách riêng từ financemanager.html
════════════════════════════════════════════ */

/* ── Floating trigger button ── */
.ai-fab {
  position: fixed;
  bottom: 80px;
  right: 20px;
  width: 50px; height: 50px;
  background: none;
  border: none;
  box-shadow: none;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; z-index: 90;
  transition: transform 0.18s var(--easing), opacity 0.18s;
  user-select: none;
}
.ai-fab:hover { opacity: 0.8; }
.ai-fab:active { transform: scale(0.89); }
.ai-fab-icon { width: 42px; height: 42px; }
.ai-fab-badge {
  position: absolute; top: -5px; right: -5px;
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--up); border: 2px solid var(--bg);
  display: none; align-items: center; justify-content: center;
  font-family: 'Space Mono', monospace; font-size: 8px;
  color: #fff; font-weight: 700;
}
.ai-fab-badge.show { display: flex; }




/* ── Chat panel backdrop ── */
.ai-chat-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.78); backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 600; display: none; align-items: flex-end;
}
.ai-chat-backdrop.open { display: flex; animation: backdropIn 0.22s ease forwards; }

/* ── Chat panel ── */
.ai-chat-panel {
  width: 100%; max-width: 430px; margin: 0 auto;
  background: var(--s0);
  border: 1px solid var(--border-md); border-bottom: none;
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  height: 92dvh; display: flex; flex-direction: column;
  animation: sheetRise 0.34s cubic-bezier(0.32,0.72,0,1) forwards;
  box-shadow: 0 -4px 60px rgba(0,0,0,0.7), 0 0 0 1px rgba(255,255,255,0.03) inset;
  overflow: hidden;
}

/* ── Panel header ── */
.ai-chat-header {
  flex-shrink: 0;
  padding: 14px 18px 12px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px;
}
.ai-chat-grip {
  width: 36px; height: 4px; border-radius: 2px;
  background: rgba(212,180,106,0.22);
  position: absolute; top: 10px; left: 50%; transform: translateX(-50%);
}
.ai-chat-avatar {
  width: 36px; height: 36px; border-radius: 12px;
  background: linear-gradient(145deg, rgba(212,180,106,0.18), rgba(212,180,106,0.06));
  border: 1px solid var(--gold-border);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 0 14px rgba(212,180,106,0.18);
}
.ai-chat-title-block { flex: 1; }
.ai-chat-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 15px; font-weight: 700; color: var(--text);
  line-height: 1.2;
}
.ai-chat-subtitle {
  font-family: 'Space Mono', monospace; font-size: 8.5px;
  color: var(--up); letter-spacing: 0.05em;
  display: flex; align-items: center; gap: 5px; margin-top: 2px;
}
.ai-chat-subtitle::before {
  content: '';
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--up); box-shadow: 0 0 6px var(--up);
  animation: blink 3s ease-in-out infinite;
  flex-shrink: 0;
}
.ai-chat-close {
  width: 30px; height: 30px; border-radius: 50%;
  background: rgba(255,255,255,0.05); border: 1px solid var(--border);
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  color: var(--muted); transition: all 0.18s; flex-shrink: 0;
}
.ai-chat-close:hover { background: rgba(255,255,255,0.09); color: var(--text); }

/* ── Messages area ── */
.ai-chat-messages {
  flex: 1; overflow-y: auto; padding: 16px 16px 8px;
  display: flex; flex-direction: column; gap: 12px;
  overscroll-behavior: contain;
  scrollbar-width: thin; scrollbar-color: rgba(212,180,106,0.12) transparent;
  min-height: 0;
  will-change: scroll-position;
}
.ai-chat-messages::-webkit-scrollbar { width: 3px; }
.ai-chat-messages::-webkit-scrollbar-thumb { background: rgba(212,180,106,0.18); border-radius: 2px; }

/* ── Message bubbles ── */
.ai-msg-row {
  display: flex; gap: 8px; align-items: flex-end;
}
.ai-msg-row.user { flex-direction: row-reverse; }

.ai-msg-avatar-sm {
  width: 26px; height: 26px; border-radius: 8px; flex-shrink: 0;
  background: linear-gradient(145deg, rgba(212,180,106,0.16), rgba(212,180,106,0.05));
  border: 1px solid var(--gold-border);
  display: flex; align-items: center; justify-content: center;
  align-self: flex-end;
}

.ai-bubble {
  max-width: 82%; padding: 10px 13px;
  border-radius: 16px;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 13.5px; line-height: 1.5;
  position: relative;
}
.ai-bubble.bot {
  background: var(--s2);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
  color: var(--text-2);
}
.ai-bubble.user {
  background: linear-gradient(145deg, rgba(212,180,106,0.22), rgba(212,180,106,0.12));
  border: 1px solid var(--gold-border);
  border-bottom-right-radius: 4px;
  color: var(--text);
}
.ai-bubble.error {
  background: var(--down-bg); border-color: var(--down-border);
  color: var(--down);
}
.ai-msg-time {
  font-family: 'Space Mono', monospace; font-size: 8px;
  color: var(--muted); margin-top: 4px; text-align: right;
}
.ai-msg-row.bot .ai-msg-time { text-align: left; margin-left: 34px; }

/* ── Typing indicator ── */
.ai-typing-row {
  display: flex; gap: 8px; align-items: flex-end;
}
.ai-typing-bubble {
  background: var(--s2); border: 1px solid var(--border);
  border-radius: 16px; border-bottom-left-radius: 4px;
  padding: 12px 16px;
  display: flex; align-items: center; gap: 5px;
}
.ai-typing-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--muted);
  animation: aiTyping 1.4s ease-in-out infinite;
}
.ai-typing-dot:nth-child(2) { animation-delay: 0.2s; }
.ai-typing-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes aiTyping {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-4px); opacity: 1; }
}

/* ── Transaction confirm card in chat ── */
.ai-tx-card {
  background: var(--s1);
  border: 1px solid var(--border-md);
  border-radius: var(--r-sm);
  padding: 11px 13px;
  margin-top: 8px;
  display: flex; align-items: center; gap: 11px;
  position: relative; overflow: hidden;
}
.ai-tx-card::before {
  content: '';
  position: absolute; left: 0; top: 0; bottom: 0;
  width: 2.5px; border-radius: 2px 0 0 2px;
}
.ai-tx-card.inc::before { background: var(--up); }
.ai-tx-card.exp::before { background: var(--down); }
.ai-tx-icon {
  width: 34px; height: 34px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.ai-tx-icon.inc { background: var(--up-bg); }
.ai-tx-icon.exp { background: var(--down-bg); }
.ai-tx-body { flex: 1; min-width: 0; }
.ai-tx-note {
  font-size: 12.5px; font-weight: 500; color: var(--text);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; text-overflow: ellipsis;
  white-space: normal; line-height: 1.35;
}
.ai-tx-cat {
  font-family: 'Space Mono', monospace; font-size: 9px;
  color: var(--muted); margin-top: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ai-tx-amt {
  font-family: 'Space Mono', monospace; font-size: 12.5px;
  font-weight: 600; white-space: nowrap; letter-spacing: -0.3px;
  flex-shrink: 0;
}
.ai-tx-amt.inc { color: var(--up); }
.ai-tx-amt.exp { color: var(--down); }

/* ── Suggestion chips ── */
.ai-chips-row {
  display: flex; gap: 7px; flex-wrap: wrap; margin-top: 8px;
}
.ai-chip {
  padding: 5px 11px;
  background: rgba(212,180,106,0.07);
  border: 1px solid var(--gold-border);
  border-radius: 99px;
  font-family: 'Space Mono', monospace; font-size: 9.5px;
  color: var(--gold); cursor: pointer; transition: all 0.15s;
  user-select: none; white-space: nowrap;
}
.ai-chip:hover { background: rgba(212,180,106,0.14); border-color: var(--gold-border-hi); }
.ai-chip:active { transform: scale(0.93); }

/* ── Input area ── */
.ai-chat-input-wrap {
  flex-shrink: 0;
  padding: 10px 14px;
  border-top: 1px solid var(--border);
  background: var(--s0);
  display: flex; gap: 10px; align-items: flex-end;
}
.ai-chat-input {
  flex: 1;
  background: var(--s2); border: 1px solid var(--border);
  border-radius: var(--r-md); padding: 11px 14px;
  color: var(--text); font-family: 'Space Grotesk', sans-serif; font-size: 13.5px;
  outline: none; resize: none; min-height: 44px; max-height: 90px; line-height: 1.45;
  transition: border-color 0.2s, background 0.2s;
  scrollbar-width: none;
}
.ai-chat-input::-webkit-scrollbar { display: none; }
.ai-chat-input:focus { border-color: var(--border-md); background: var(--s3); }
.ai-chat-input::placeholder { color: var(--muted); }
.ai-send-btn {
  width: 42px; height: 42px; border-radius: 13px; flex-shrink: 0;
  background: linear-gradient(145deg, #D4B46A, #8C6E2A);
  border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: transform 0.14s var(--easing), opacity 0.14s;
  box-shadow: 0 3px 14px rgba(180,140,52,0.4);
}
.ai-send-btn:hover { opacity: 0.88; }
.ai-send-btn:active { transform: scale(0.88); }
.ai-send-btn:disabled { opacity: 0.35; cursor: not-allowed; transform: none; }
.ai-send-btn svg { display: block; }

/* ── Welcome state ── */
.ai-welcome {
  text-align: center; padding: 10px 8px 4px;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
}
.ai-welcome-icon {
  width: 52px; height: 52px;
  background: none;
  border: none;
  display: flex; align-items: center; justify-content: center;
}
.ai-welcome-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 16px; font-weight: 700; color: var(--text);
}
.ai-welcome-sub {
  font-family: 'Space Mono', monospace; font-size: 10px;
  color: var(--muted); line-height: 1.7; letter-spacing: 0.02em;
}

/* ── Jar evaluation card in chat ── */
.ai-jar-card {
  margin-top: 10px;
  background: var(--s1);
  border: 1px solid var(--border-md);
  border-radius: var(--r-md);
  overflow: hidden;
}
.ai-jar-card-header {
  padding: 10px 13px 9px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 9px;
}
.ai-jar-card-title {
  flex: 1;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 12px; font-weight: 700; color: var(--text);
}
.ai-jar-card-month {
  font-family: 'Space Mono', monospace;
  font-size: 8.5px; color: var(--muted);
  margin-top: 1px;
}
.ai-jar-card-income {
  font-family: 'Space Mono', monospace;
  font-size: 10px; font-weight: 600; color: var(--up);
  white-space: nowrap;
}
.ai-jar-rows { display: flex; flex-direction: column; }
.ai-jar-row {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 13px;
  border-bottom: 1px solid var(--border);
}
.ai-jar-row:last-child { border-bottom: none; }
.ai-jar-emoji {
  font-size: 15px; width: 20px; text-align: center; flex-shrink: 0;
}
.ai-jar-info { flex: 1; min-width: 0; }
.ai-jar-name {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 11px; font-weight: 600; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ai-jar-bar-wrap {
  height: 3px; background: rgba(255,255,255,0.06);
  border-radius: 2px; margin-top: 4px; overflow: hidden;
}
.ai-jar-bar-fill {
  height: 100%; border-radius: 2px;
  transition: width 0.6s cubic-bezier(0.34,1.12,0.64,1);
}
.ai-jar-bar-fill.ok   { background: var(--up); }
.ai-jar-bar-fill.warn { background: #F0B060; }
.ai-jar-bar-fill.over { background: var(--down); }
.ai-jar-bar-fill.empty{ background: var(--muted); }
.ai-jar-right { flex-shrink: 0; text-align: right; }
.ai-jar-amt {
  font-family: 'Space Mono', monospace;
  font-size: 9.5px; font-weight: 600; color: var(--text);
  white-space: nowrap;
}
.ai-jar-pct {
  font-family: 'Space Mono', monospace;
  font-size: 8px; margin-top: 2px; white-space: nowrap;
}
.ai-jar-pct.ok   { color: var(--up); }
.ai-jar-pct.warn { color: #F0B060; }
.ai-jar-pct.over { color: var(--down); }
.ai-jar-pct.empty{ color: var(--muted); }
.ai-jar-dot {
  width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0;
}
.ai-jar-dot.ok   { background: var(--up); }
.ai-jar-dot.warn { background: #F0B060; }
.ai-jar-dot.over { background: var(--down); }
.ai-jar-dot.empty{ background: var(--muted); }
.ai-jar-card-footer {
  padding: 8px 13px;
  border-top: 1px solid var(--border);
  font-family: 'Space Mono', monospace;
  font-size: 9px; color: var(--muted);
  line-height: 1.5; text-align: center;
}
.ai-jar-score-badge {
  display: inline-block;
  padding: 2px 8px; border-radius: 99px;
  font-size: 9px; font-weight: 600;
  margin-bottom: 3px;
}
.ai-jar-score-badge.great { background: var(--up-bg); color: var(--up); border: 1px solid var(--up-border); }
.ai-jar-score-badge.good  { background: rgba(240,176,96,0.12); color: #F0B060; border: 1px solid rgba(240,176,96,0.3); }
.ai-jar-score-badge.bad   { background: var(--down-bg); color: var(--down); border: 1px solid var(--down-border); }

[data-theme="light"] .ai-jar-bar-wrap { background: rgba(0,0,0,0.06); }

.ai-bubble.jar-bubble {
  padding: 0; background: transparent !important; border: none !important;
  max-width: 100%;
}

/* ══════════════════════════════════════════
   AI FAB — Speech Bubble (câu thoại định kỳ)
══════════════════════════════════════════ */
.ai-fab-speech {
  position: fixed;
  bottom: 142px;
  right: 46px;
  max-width: 210px;
  min-width: 130px;
  background: var(--s0);
  border: 1px solid var(--gold-border-hi);
  border-radius: 14px 14px 4px 14px;
  padding: 9px 13px 9px 11px;
  z-index: 89;

  /* Tail — hướng về FAB (bottom-right) */
  filter: drop-shadow(0 4px 18px rgba(0,0,0,0.55));
  pointer-events: none;

  /* Default: ẩn */
  opacity: 0;
  transform: translateY(6px) scale(0.94);
  transform-origin: bottom right;
  transition: none;
}
.ai-fab-speech::after {
  content: '';
  position: absolute;
  bottom: -7px; right: 14px;
  width: 0; height: 0;
  border-left: 7px solid transparent;
  border-right: 0px solid transparent;
  border-top: 7px solid var(--gold-border-hi);
}
.ai-fab-speech::before {
  content: '';
  position: absolute;
  bottom: -5.5px; right: 14.5px;
  width: 0; height: 0;
  border-left: 6.5px solid transparent;
  border-right: 0px solid transparent;
  border-top: 6.5px solid var(--s0);
  z-index: 1;
}

/* Trạng thái hiển thị */
.ai-fab-speech.speech-in {
  animation: speechIn 0.32s cubic-bezier(0.34,1.18,0.64,1) forwards;
}
.ai-fab-speech.speech-out {
  animation: speechOut 0.24s ease-in forwards;
}

@keyframes speechIn {
  from { opacity: 0; transform: translateY(10px) scale(0.88); }
  to   { opacity: 1; transform: translateY(0)   scale(1);    }
}
@keyframes speechOut {
  from { opacity: 1; transform: translateY(0)   scale(1);    }
  to   { opacity: 0; transform: translateY(6px) scale(0.92); }
}

/* Nội dung bên trong */
.ai-fab-speech-text {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--text-2);
  white-space: pre-wrap;
  word-break: break-word;
}
.ai-fab-speech-text em {
  color: var(--gold);
  font-style: normal;
  font-weight: 600;
}

/* Progress bar — đếm ngược tự biến mất */
.ai-fab-speech-bar {
  height: 2px;
  border-radius: 1px;
  background: linear-gradient(90deg, var(--gold-border-hi), rgba(212,180,106,0.2));
  margin-top: 7px;
  transform-origin: left;
  animation: speechBarShrink linear forwards;
}

@keyframes speechBarShrink {
  from { transform: scaleX(1); }
  to   { transform: scaleX(0); }
}

/* Light mode */
[data-theme="light"] .ai-fab-speech {
  background: #F5F0E4;
  box-shadow: 0 4px 20px rgba(0,0,0,0.12);
}
[data-theme="light"] .ai-fab-speech::before {
  border-top-color: #F5F0E4;
}


/* ══════════════════════════════════════════
   DELETE PICK — Danh sách chọn giao dịch để xóa
══════════════════════════════════════════ */
.ai-delete-pick-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 8px;
}
.ai-delete-pick-item {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--s2);
  border: 1px solid var(--border, rgba(255,255,255,0.1));
  border-radius: 10px;
  padding: 8px 10px;
  transition: background 0.15s;
}
.ai-delete-pick-item:hover {
  background: var(--s3);
}
.ai-delete-pick-btn {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(239,68,68,0.15);
  border: 1px solid rgba(239,68,68,0.3);
  border-radius: 8px;
  color: #f87171;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
  margin-left: 4px;
}
.ai-delete-pick-btn:hover {
  background: rgba(239,68,68,0.28);
  transform: scale(1.08);
}
.ai-delete-pick-btn:active {
  transform: scale(0.95);
}


/* ══════════════════════════════════════════
   NAG POPUP — Nhắc nhở dùng Quản Gia
══════════════════════════════════════════ */
#aiNagPopup { display: none; }
#aiNagPopup.open { display: block; }

.ai-nag-backdrop {
  position: fixed; inset: 0; z-index: 9999;
  background: rgba(0,0,0,0.55);
  display: flex; align-items: center; justify-content: center; padding: 24px;
  animation: nagBackdropIn 0.2s ease forwards;
}
@keyframes nagBackdropIn { from { opacity:0; } to { opacity:1; } }

.ai-nag-box {
  background: var(--s2, #141210);
  border: 1px solid var(--gold-border-hi, rgba(212,180,106,0.48));
  border-radius: 22px;
  padding: 28px 24px 22px;
  max-width: 320px; width: 100%;
  text-align: center;
  box-shadow: 0 24px 60px rgba(0,0,0,0.5), 0 0 0 1px rgba(212,180,106,0.08);
  animation: nagBoxIn 0.28s cubic-bezier(0.34,1.2,0.64,1) forwards;
}
@keyframes nagBoxIn {
  from { opacity:0; transform: scale(0.82) translateY(14px); }
  to   { opacity:1; transform: scale(1) translateY(0); }
}

.ai-nag-emoji {
  font-size: 46px; line-height: 1; margin-bottom: 12px;
  animation: nagEmojiShake 0.5s ease 0.15s both;
}
@keyframes nagEmojiShake {
  0%,100% { transform: rotate(0deg); }
  20%     { transform: rotate(-12deg); }
  40%     { transform: rotate(12deg); }
  60%     { transform: rotate(-8deg); }
  80%     { transform: rotate(8deg); }
}

.ai-nag-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 18px; font-weight: 700;
  color: var(--gold, #D4B46A);
  margin-bottom: 10px; letter-spacing: 0.01em;
}
.ai-nag-body {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 14px; line-height: 1.55;
  color: var(--text-2, #D6CAAA);
  margin-bottom: 22px;
}
.ai-nag-actions {
  display: flex; gap: 10px; justify-content: center;
}
.ai-nag-btn-secondary {
  flex: 1; padding: 10px 8px; border-radius: 12px; font-size: 13px;
  font-family: 'Space Grotesk', sans-serif; font-weight: 600;
  background: transparent;
  border: 1px solid var(--border-md, rgba(212,180,106,0.24));
  color: var(--muted, #8C7D62); cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.ai-nag-btn-secondary:hover { background: var(--s3, #1A1814); color: var(--text-2); }
.ai-nag-btn-primary {
  flex: 1.4; padding: 10px 8px; border-radius: 12px; font-size: 13px;
  font-family: 'Space Grotesk', sans-serif; font-weight: 700;
  background: linear-gradient(135deg, var(--gold-light,#F2DE96), var(--gold-dim,#B09050));
  border: none; color: #0A0908; cursor: pointer;
  transition: opacity 0.15s, transform 0.12s;
}
.ai-nag-btn-primary:hover  { opacity: 0.9; }
.ai-nag-btn-primary:active { transform: scale(0.96); }

[data-theme="light"] .ai-nag-box {
  background: var(--s1, #EDE8D8);
  box-shadow: 0 24px 60px rgba(0,0,0,0.18);
}


/* ── Panic mode — bubble đỏ khi số dư âm ── */
.ai-fab-speech.panic {
  background: #2a0a0a;
  border-color: rgba(220,60,60,0.7);
  animation: speechIn 0.32s cubic-bezier(0.34,1.18,0.64,1) forwards,
             panicBubblePulse 1.6s ease-in-out infinite;
}
.ai-fab-speech.panic::after {
  border-top-color: rgba(220,60,60,0.7);
}
.ai-fab-speech.panic::before {
  border-top-color: #2a0a0a;
}
.ai-fab-speech.panic .ai-fab-speech-text {
  color: #ffcccc;
}
.ai-fab-speech.panic .ai-fab-speech-bar {
  background: linear-gradient(90deg, #e03030, rgba(200,40,40,0.2));
}
@keyframes panicBubblePulse {
  0%, 100% { border-color: rgba(220,60,60,0.5); filter: drop-shadow(0 4px 18px rgba(0,0,0,0.55)) drop-shadow(0 0 6px rgba(200,30,30,0.2)); }
  50%       { border-color: rgba(220,60,60,0.9); filter: drop-shadow(0 4px 18px rgba(0,0,0,0.55)) drop-shadow(0 0 12px rgba(200,30,30,0.5)); }
}
[data-theme="light"] .ai-fab-speech.panic {
  background: #fff0f0;
  border-color: rgba(200,50,50,0.6);
}
[data-theme="light"] .ai-fab-speech.panic::before {
  border-top-color: #fff0f0;
}
[data-theme="light"] .ai-fab-speech.panic .ai-fab-speech-text {
  color: #8b1a1a;
}
/* ═══════════════════════════════════════════════════════════
   wealth-ai-learner.css — HabitLearner UI Components
   Thêm vào cuối wealth-ai.css hoặc load riêng
   ═══════════════════════════════════════════════════════════ */

/* ── Smart Suggestion Bar ── */
.habit-suggest-bar {
  padding: 10px 14px;
  border-top: 1px solid var(--border, rgba(212,180,106,0.14));
  animation: habitFadeIn 0.3s ease;
}

.habit-suggest-label {
  font-size: 11px;
  color: var(--muted, #8C7D62);
  margin-bottom: 8px;
  font-weight: 500;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.habit-suggest-chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.habit-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  font-size: 12px;
  border: 1px solid var(--gold-border, rgba(212,180,106,0.22));
  background: var(--s2, #141210);
  color: var(--text-2, #D6CAAA);
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
  white-space: nowrap;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.habit-chip:hover {
  background: var(--gold-glow, rgba(212,180,106,0.18));
  border-color: var(--gold-border-hi, rgba(212,180,106,0.48));
  color: var(--gold-light, #F2DE96);
}

.habit-chip:active {
  transform: scale(0.96);
}

.habit-chip-icon {
  font-size: 13px;
  flex-shrink: 0;
}

.habit-chip-text {
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Recurring Alert Message ── */
.habit-alert-msg .ai-msg-bubble {
  border-left: 3px solid var(--gold, #D4B46A);
  background: var(--s2, #141210);
}

/* ── Autocomplete Popup ── */
.habit-autocomplete {
  position: absolute;
  bottom: 100%;
  left: 0;
  right: 0;
  background: var(--s1, #0F0E0A);
  border: 1px solid var(--border-md, rgba(212,180,106,0.24));
  border-radius: 12px;
  margin-bottom: 4px;
  max-height: 200px;
  overflow-y: auto;
  z-index: 100;
  box-shadow: 0 -4px 16px rgba(0,0,0,0.4);
  animation: habitSlideUp 0.2s ease;
}

.habit-ac-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 10px 14px;
  border: none;
  background: none;
  color: var(--text-2, #D6CAAA);
  font-size: 13px;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  transition: background 0.15s;
}

.habit-ac-item:hover {
  background: var(--gold-glow, rgba(212,180,106,0.18));
}

.habit-ac-item:not(:last-child) {
  border-bottom: 1px solid var(--border, rgba(212,180,106,0.14));
}

.habit-ac-note {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.habit-ac-amount {
  color: var(--gold, #D4B46A);
  font-weight: 600;
  font-size: 12px;
  white-space: nowrap;
}

.habit-ac-count {
  color: var(--muted, #8C7D62);
  font-size: 11px;
  white-space: nowrap;
}

/* ── Animations ── */
@keyframes habitFadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes habitSlideUp {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Light Mode ── */
[data-theme="light"] .habit-chip {
  background: #FDFCF7;
  border-color: rgba(140,125,98,0.25);
  color: #5A5040;
}

[data-theme="light"] .habit-chip:hover {
  background: rgba(212,180,106,0.15);
  border-color: rgba(212,180,106,0.5);
  color: #3A3020;
}

[data-theme="light"] .habit-autocomplete {
  background: #FDFCF7;
  border-color: rgba(140,125,98,0.25);
  box-shadow: 0 -4px 16px rgba(0,0,0,0.08);
}

[data-theme="light"] .habit-ac-item {
  color: #5A5040;
}

[data-theme="light"] .habit-ac-item:hover {
  background: rgba(212,180,106,0.12);
}

[data-theme="light"] .habit-suggest-bar {
  border-top-color: rgba(140,125,98,0.2);
}


/* ══════════════════════════════════════════
   FAB HIDE / RESTORE — chỉ mobile (≤ 767px)
   PC không bị ảnh hưởng
══════════════════════════════════════════ */

/* Nút × để ẩn FAB — chỉ hiện trên mobile */
.ai-fab-dismiss {
  position: fixed;
  bottom: 134px;           /* ngay phía trên .ai-fab (bottom:80 + 50px + 4px) */
  right: 18px;
  width: 22px; height: 22px;
  background: var(--s2, #141210);
  border: 1px solid var(--border-md, rgba(212,180,106,0.24));
  border-radius: 50%;
  cursor: pointer;
  z-index: 92;
  align-items: center; justify-content: center;
  opacity: 0.55;
  transition: opacity 0.15s, transform 0.12s;
  display: none;           /* ẩn theo mặc định; bật qua @media */
}
.ai-fab-dismiss:hover  { opacity: 1; }
.ai-fab-dismiss:active { transform: scale(0.86); }

/* Tab khôi phục — hiện ở mép phải khi FAB đang ẩn */
.ai-fab-restore {
  position: fixed;
  bottom: 88px;
  right: 0;
  width: 20px; height: 48px;
  background: var(--s2, #141210);
  border: 1px solid var(--border-md, rgba(212,180,106,0.24));
  border-right: none;
  border-radius: 10px 0 0 10px;
  cursor: pointer;
  z-index: 92;
  align-items: center; justify-content: center;
  box-shadow: -3px 0 14px rgba(0,0,0,0.45);
  transition: width 0.18s ease;
  display: none;           /* ẩn theo mặc định */
}
.ai-fab-restore:hover  { width: 26px; }
.ai-fab-restore:active { transform-origin: right; transform: scaleX(0.88); }

/* Chỉ kích hoạt trên màn hình mobile */
@media (max-width: 767px) {
  /* Hiện nút dismiss khi FAB đang visible */
  .ai-fab-dismiss { display: flex; }

  /* Trạng thái FAB bị ẩn */
  .ai-fab.ai-fab--hidden {
    opacity: 0;
    transform: translateX(90px);
    pointer-events: none;
    transition: opacity 0.25s ease, transform 0.28s cubic-bezier(0.4,0,0.6,1);
  }
  /* Speech bubble cũng ẩn theo */
  .ai-fab-speech.ai-fab--hidden {
    opacity: 0 !important;
    pointer-events: none !important;
    transition: opacity 0.18s ease !important;
  }
  /* Ẩn nút dismiss khi FAB đang bị ẩn */
  .ai-fab-dismiss.ai-fab--hidden { display: none; }

  /* Hiện tab khôi phục khi FAB đang bị ẩn */
  .ai-fab-restore.ai-fab--show { display: flex; }
}

/* Light mode */
[data-theme="light"] .ai-fab-dismiss,
[data-theme="light"] .ai-fab-restore {
  background: #FDFCF7;
  border-color: rgba(140,125,98,0.3);
  box-shadow: -3px 0 14px rgba(0,0,0,0.1);
}


/* ── Chat header quick actions ── */
.ai-chat-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-right: 2px;
}
.ai-chat-mini-btn {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.04);
  color: var(--text-2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.18s, border-color 0.18s, transform 0.18s;
  font-size: 13px;
}
.ai-chat-mini-btn:hover {
  background: rgba(212,180,106,0.10);
  border-color: var(--border-md);
}
.ai-chat-mini-btn:active {
  transform: scale(0.94);
}
[data-theme="light"] .ai-chat-mini-btn {
  background: rgba(0,0,0,0.03);
}
