*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  height: 100%;
  overflow: hidden;
}

body {
  font-family: 'Be Vietnam Pro', -apple-system, sans-serif;
  background: #ffffff;
  -webkit-font-smoothing: antialiased;
}

/* ══════════════════════════════════════
   MÀN HÌNH CHỌN TÀI KHOẢN
══════════════════════════════════════ */
#loginScreen {
  position: fixed;
  inset: 0;
  z-index: 999;
  background: #ffffff;
  display: flex;
  flex-direction: column;
  padding: 0 16px max(env(safe-area-inset-bottom, 0px), 24px);
  transition: opacity .3s, transform .3s;
  overscroll-behavior: none;
}

#loginScreen.hidden {
  opacity: 0;
  pointer-events: none;
  transform: translateY(-16px);
}

.login-top {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding-top: max(env(safe-area-inset-top, 0px), 56px);
}

.login-greeting {
  font-size: 16px;
  font-weight: 600;
  color: #666;
  letter-spacing: -0.32px;
  line-height: 1.3;
  margin-bottom: 8px;
}

.login-title {
  font-size: 24px;
  font-weight: 600;
  color: #212121;
  letter-spacing: -0.48px;
  line-height: 1.3;
  margin-bottom: 28px;
}

.user-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.user-card {
  background: #fff;
  border: 1px solid #f0f0f0;
  border-radius: 20px;
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 16px;
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s;
  -webkit-tap-highlight-color: transparent;
}

.user-card.selected {
  border: 2px solid #212121;
}

.user-card:active {
  opacity: 0.85;
}

.user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 36px;
  background: #d9d9d9;
  flex-shrink: 0;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 600;
  color: #fff;
}

.user-avatar.selected-ring {
  border: 2px solid #fff;
  box-shadow: 0 0 0 2px #212121;
}

.user-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 36px;
}

.user-info {
  flex: 1;
  min-width: 0;
}

.user-handle {
  font-size: 14px;
  font-weight: 400;
  color: #999;
  letter-spacing: -0.28px;
  line-height: 1.3;
}

.user-name {
  font-size: 20px;
  font-weight: 600;
  color: #4d4d4d;
  letter-spacing: -0.4px;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.btn-next {
  font-family: 'Be Vietnam Pro', sans-serif;
  font-size: 16px;
  font-weight: 600;
  color: #fff;
  background: #4d4d4d;
  border: none;
  border-radius: 16px;
  height: 56px;
  width: 100%;
  cursor: pointer;
  letter-spacing: -0.32px;
  margin-top: 16px;
  transition: opacity .15s;
}

.btn-next:disabled {
  opacity: 0.4;
}

.btn-next:active:not(:disabled) {
  opacity: 0.85;
}

/* ══ PIN SCREEN ══ */
#pinScreen {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 24px 48px;
  background: var(--bg, #ffffff);
  z-index: 90;
  gap: 0;
}

#pinScreen.hidden {
  display: none;
}

.pin-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin-bottom: 32px;
}

.pin-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: #a8d5e2;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  font-weight: 700;
  color: #fff;
  overflow: hidden;
}

.pin-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.pin-title {
  font-family: 'Be Vietnam Pro', sans-serif;
  font-size: 20px;
  font-weight: 700;
  color: #212121;
  letter-spacing: -0.4px;
}

.pin-boxes {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
  cursor: text;
}

.pin-box {
  width: 64px;
  height: 64px;
  background: #fff;
  border: 2px solid #f0f0f0;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Be Vietnam Pro', sans-serif;
  font-size: 24px;
  font-weight: 600;
  color: #212121;
  transition: border-color 0.15s;
}

.pin-box.active {
  border-color: #3378ff;
}

#pinError {
  font-family: 'Be Vietnam Pro', sans-serif;
  font-size: 13px;
  color: #e53935;
  text-align: center;
  margin: 0 0 20px;
  visibility: hidden;
}

#pinError.show {
  visibility: visible;
}

.pin-submit-btn {
  width: 100%;
  background: #3378ff;
  border: 1.5px solid #0048d8;
  box-shadow: 0px 6px 0px #0048d8;
  border-radius: 16px;
  margin-top: 0;
}

.pin-submit-btn:disabled {
  opacity: 0.4;
  box-shadow: none;
}

/* ══════════════════════════════════════
   APP CHÍNH
══════════════════════════════════════ */
#appScreen {
  position: fixed;
  inset: 0;
  overflow-y: scroll;
  overflow-x: hidden;
  overscroll-behavior: none;
  opacity: 0;
  transition: opacity .3s;
}

#appScreen.visible {
  opacity: 1;
}

.app-inner {
  max-width: 430px;
  margin: 0 auto;
  padding: max(env(safe-area-inset-top, 0px), 20px) 16px 24px;
  padding-bottom: 200px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* HEADER — ngang: avatar + tên/handle + settings */
.home-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 4px;
}

.home-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
}

.home-avatar {
  width: 48px;
  height: 48px;
  border-radius: 36px;
  background: #d9d9d9;
  overflow: hidden;
  border: 2px solid #fff;
  box-shadow: 0 3px 9px rgba(0, 0, 0, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 600;
  color: #fff;
  flex-shrink: 0;
}

.home-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 36px;
}

.home-user-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.home-greeting {
  font-family: 'Be Vietnam Pro', sans-serif;
  font-size: 20px;
  font-weight: 600;
  color: #212121;
  letter-spacing: -0.4px;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.home-handle {
  font-family: 'Be Vietnam Pro', sans-serif;
  font-size: 14px;
  font-weight: 400;
  color: #999;
  letter-spacing: -0.28px;
  line-height: 1.3;
}

.settings-btn {
  background: #747474;
  border: 2px solid #545454;
  box-shadow: 0px 4px 0px #545454;
  border-radius: 12px;
  width: 40px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  color: white;
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
}

.settings-btn:active {
  opacity: 0.6;
}

.settings-btn svg {
  width: 22px;
  height: 22px;
}

/* OVER-BUDGET POPUP */
.overbudget-overlay {
  position: fixed;
  inset: 0;
  z-index: 400;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s;
}

.overbudget-overlay.show {
  opacity: 1;
  pointer-events: all;
}

.overbudget-card {
  background: #fff;
  border: 1px solid #f0f0f0;
  border-radius: 20px;
  padding: 24px 24px;
  width: 100%;
  max-width: 320px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  transform: scale(0.92) translateY(16px);
  transition: transform .28s cubic-bezier(.34, 1.56, .64, 1);
}

.overbudget-overlay.show .overbudget-card {
  transform: scale(1) translateY(0);
}

.overbudget-lottie {
  width: 200px;
  height: 200px;
}

.overbudget-text {
  font-size: 16px;
  font-weight: 400;
  color: #999;
  letter-spacing: 0px;
  line-height: 1.3;
  text-align: center;
  width: 100%;
}

.overbudget-btn {
  font-family: 'Be Vietnam Pro', sans-serif;
  font-size: 16px;
  font-weight: 600;
  color: #fff;
  background: #3378FF;
  border: 2px solid #0048D8;
  border-radius: 16px;
  padding: 13px 24px;
  width: 100%;
  cursor: pointer;
  letter-spacing: 0px;
  line-height: 1.3;
  -webkit-tap-highlight-color: transparent;
  box-shadow: 0 6px 0 0 #0048D8;
  transform: translateY(0);
  transition: transform .1s, box-shadow .1s;
}

.overbudget-btn:active {
  transform: translateY(4px);
  box-shadow: 0 2px 0 0 #000;
}

/* PRAISE POPUP */
.praise-overlay {
  position: fixed;
  inset: 0;
  z-index: 400;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s;
}

.praise-overlay.show {
  opacity: 1;
  pointer-events: all;
}

.praise-card {
  background: #fff;
  border: 1px solid #f0f0f0;
  border-radius: 20px;
  padding: 24px 24px;
  width: 100%;
  max-width: 320px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  transform: scale(0.92) translateY(16px);
  transition: transform .28s cubic-bezier(.34, 1.56, .64, 1);
}

.praise-overlay.show .praise-card {
  transform: scale(1) translateY(0);
}

.praise-lottie {
  width: 200px;
  height: 200px;
}

.praise-text {
  font-size: 16px;
  font-weight: 400;
  color: #999;
  letter-spacing: 0px;
  line-height: 1.3;
  text-align: center;
  width: 100%;
}

.praise-btn {
  font-family: 'Be Vietnam Pro', sans-serif;
  font-size: 16px;
  font-weight: 600;
  color: #fff;
  background: #34C759;
  border: 2px solid #248A3D;
  border-radius: 16px;
  padding: 13px 24px;
  width: 100%;
  cursor: pointer;
  letter-spacing: 0px;
  line-height: 1.3;
  -webkit-tap-highlight-color: transparent;
  box-shadow: 0 6px 0 0 #248A3D;
  transform: translateY(0);
  transition: transform .1s, box-shadow .1s;
}

.praise-btn:active {
  transform: translateY(4px);
  box-shadow: 0 2px 0 0 #1a6b2e;
}

/* CARD (kept for compatibility with input-card etc.) */
.card {
  background: #fafafa;
  border: 2px solid #f5f5f5;
  border-radius: 24px;
  padding: 16px;
}

/* BALANCE HERO */
.balance-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 0 8px;
  gap: 0;
}

.balance-hero .date-chip {
  margin-bottom: 12px;
}

.balance-hero-label {
  color: #7f7f7f;
  font-size: 14px;
  font-family: 'Be Vietnam Pro', sans-serif;
  letter-spacing: -0.28px;
  text-align: center;
  margin-top: 12px;
}

.balance-hero-amount {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-top: 8px;
}

.balance-hero-num {
  font-family: 'Be Vietnam Pro', sans-serif;
  font-size: 36px;
  font-weight: 600;
  letter-spacing: -0.72px;
  color: #33c84c;
  line-height: 1.3;
}

.balance-hero-num.green {
  color: #33c84c;
}

.balance-hero-num.amber {
  color: #ffc756;
}

.balance-hero-num.red {
  color: #ff3b30;
}

.balance-hero-unit {
  font-family: 'Be Vietnam Pro', sans-serif;
  font-size: 32px;
  font-weight: 600;
  color: #4d4d4d;
  letter-spacing: -0.64px;
  line-height: 1.3;
}

/* INCOME / EXPENSE ROW */
.income-expense-row {
  display: flex;
  flex-direction: row;
  gap: 12px;
  align-items: center;
  justify-content: center;
  margin-top: -4px;
}

.ie-group {
  display: flex;
  flex-direction: row;
  gap: 8px;
  align-items: center;
}

.ie-group__icon {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  flex-shrink: 0;
}

.ie-group__icon--income {
  background: rgba(51, 200, 76, 0.2);
}

.ie-group__icon--expense {
  background: rgba(255, 153, 44, 0.2);
}

.ie-group__text {
  font-weight: 400;
  font-size: 14px;
  line-height: 1.3;
  color: #4d4d4d;
  letter-spacing: -0.28px;
}

/* BUDGET CARDS ROW */
.budget-cards-row {
  display: flex;
  flex-direction: row;
  gap: 12px;
  width: 100%;
}

.budget-card {
  flex: 1;
  background: #fafafa;
  border: 2px solid #f5f5f5;
  border-radius: 24px;
  padding: 16px;
  height: 79px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-start;
  -webkit-tap-highlight-color: transparent;
}

.budget-card:active {
  opacity: 0.85;
}

.budget-card__label {
  font-weight: 400;
  font-size: 14px;
  line-height: 1.3;
  color: #999;
  letter-spacing: -0.28px;
}

.budget-card__value-row {
  display: flex;
  flex-direction: row;
  gap: 4px;
  align-items: center;
}

.budget-card__value,
.budget-card__unit {
  font-weight: 600;
  font-size: 16px;
  line-height: 1.3;
  color: #4d4d4d;
  letter-spacing: -0.32px;
}

/* TRANSACTION SECTION */
.transaction-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.section-header-row {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
  height: 30px;
}

.section-header-row__label {
  font-weight: 400;
  font-size: 14px;
  line-height: 1.3;
  color: #7f7f7f;
  letter-spacing: -0.28px;
}

.txn-count-chip {
  background: #f2f2f2;
  border: none;
  border-radius: 30px;
  padding: 10px 12px;
  font-weight: 400;
  font-size: 14px;
  line-height: 1.3;
  color: #666;
  letter-spacing: -0.28px;
  cursor: pointer;
  font-family: 'Be Vietnam Pro', sans-serif;
  -webkit-tap-highlight-color: transparent;
}

.txn-count-chip:active {
  background: #e5e5e5;
  transform: scale(0.95);
}

.cards-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.history-empty {
  font-size: 13px;
  color: #ccc;
  text-align: center;
  padding: 6px 0;
}

/* TX CARD (swipe-to-reveal) */
.tx-card-wrapper {
  width: 100%;
  height: 75px;
  overflow: hidden;
  position: relative;
  flex-shrink: 0;
}

.tx-card__delete {
  position: absolute;
  left: calc(100% + 12px);
  top: 13px;
  width: 48px;
  height: 48px;
  background: rgba(255, 113, 113, 0.2);
  border: none;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
  cursor: pointer;
  color: #ff7171;
}

.tx-card__delete-icon {
  font-size: 16px;
  font-weight: 600;
  line-height: 1;
}

.tx-card__body {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 75px;
  background: #fafafa;
  border: 2px solid #f5f5f5;
  border-radius: 24px;
  padding: 0 16px;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  transition: transform 0.25s ease;
  transform: translateX(0);
  z-index: 2;
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
  touch-action: pan-y;
}

.tx-card__body.revealed {
  transform: translateX(-60px);
}

.tx-card__left {
  display: flex;
  flex-direction: row;
  gap: 12px;
  align-items: center;
  min-width: 0;
  flex: 1;
}

.tx-card__icon {
  width: 24px;
  height: 24px;
  border-radius: 8px;
  flex-shrink: 0;
}

.tx-card__icon--in {
  background: rgba(51, 200, 76, 0.2);
}

.tx-card__icon--out {
  background: rgba(255, 153, 44, 0.2);
}

.tx-card__text {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.tx-card__name {
  font-weight: 600;
  font-size: 16px;
  line-height: 1.3;
  color: #4d4d4d;
  letter-spacing: -0.32px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tx-card__time {
  font-weight: 400;
  font-size: 12px;
  line-height: 1.3;
  color: #999;
  letter-spacing: -0.24px;
}

.tx-card__right {
  display: flex;
  flex-direction: row;
  gap: 4px;
  align-items: center;
  flex-shrink: 0;
}

.tx-card__amount,
.tx-card__unit {
  font-weight: 600;
  font-size: 16px;
  line-height: 1.3;
  color: #4d4d4d;
  letter-spacing: -0.32px;
}

.tx-card__unit {
  color: #999;
  font-weight: 400;
  font-size: 13px;
}

.date-chip {
  background: rgba(0, 0, 0, 0.05);
  border-radius: 30px;
  padding: 8px 12px;
  display: inline-block;
  font-family: 'Be Vietnam Pro', sans-serif;
  font-size: 14px;
  color: #666;
  letter-spacing: -0.28px;
  white-space: nowrap;
}

/* ══════════════════════════════════════
   INPUT STICKY
══════════════════════════════════════ */
.input-wrap {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 430px;
  padding: 10px 16px max(env(safe-area-inset-bottom, 0px), 16px);
  background: linear-gradient(to bottom, transparent, #f5f5f5 28%);
  z-index: 50;
}

.input-card {
  background: #fff;
  border: 1px solid #f0f0f0;
  border-radius: 20px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.input-card-lbl {
  font-size: 14px;
  font-weight: 400;
  color: #999;
  letter-spacing: -0.28px;
  height: 24px;
  display: flex;
  align-items: center;
}

.input-row {
  display: flex;
  align-items: center;
  gap: 4px;
}

.exp-input {
  flex: 1;
  height: 48px;
  background: #ececec;
  border: none;
  border-radius: 16px;
  padding: 4px 12px;
  font-family: 'Be Vietnam Pro', sans-serif;
  font-size: 14px;
  font-weight: 400;
  color: #212121;
  letter-spacing: -0.24px;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
  min-width: 0;
}

.exp-input::placeholder {
  color: #999;
}

.exp-input:focus {
  background: #e4e4e4;
}

/* Nút mic (icon) thay text "Nhập" */
.btn-mic-submit {
  width: 74px;
  height: 48px;
  flex-shrink: 0;
  background: #014BDE;
  border: none;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background .15s;
}

.btn-mic-submit.listening {
  background: #ff7171;
  animation: mic-pulse 1s ease-in-out infinite;
}

.btn-mic-submit:active {
  opacity: 0.85;
}

.btn-mic-submit svg {
  width: 18px;
  height: 18px;
  stroke: #fff;
}

@keyframes mic-pulse {

  0%,
  100% {
    transform: scale(1)
  }

  50% {
    transform: scale(1.08)
  }
}

.mic-status {
  font-size: 12px;
  color: #ff7171;
  letter-spacing: -0.2px;
  text-align: center;
  height: 0;
  overflow: hidden;
  transition: height .2s;
}

.mic-status.show {
  height: 18px;
}

.chips-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.chip {
  background: #ececec;
  border-radius: 30px;
  height: 30px;
  padding: 0 10px;
  display: flex;
  align-items: center;
  font-size: 12px;
  font-weight: 400;
  color: #666;
  letter-spacing: -0.24px;
  cursor: pointer;
  white-space: nowrap;
  border: none;
  font-family: 'Be Vietnam Pro', sans-serif;
}

.chip:active {
  background: #ddd;
}

/* FEEDBACK */
/* TOAST — slide down từ trên */
.feedback {
  position: fixed;
  top: max(env(safe-area-inset-top, 0px), 16px);
  left: 50%;
  transform: translateX(-50%) translateY(-120%);
  width: calc(100% - 32px);
  max-width: 398px;
  font-size: 13px;
  line-height: 1.5;
  border-radius: 14px;
  letter-spacing: -0.2px;
  padding: 11px 14px;
  z-index: 500;
  transition: transform .3s cubic-bezier(.34, 1.56, .64, 1), opacity .3s;
  opacity: 0;
  pointer-events: none;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

.feedback.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

.feedback.ok {
  background: #f0faf4;
  color: #1a7a45;
}

.feedback.warn {
  background: #fffaed;
  color: #8a5c00;
}

.feedback.over {
  background: #fff1f0;
  color: #b32d22;
}

.feedback.err {
  background: #f4f4f4;
  color: #555;
}

/* ══════════════════════════════════════
   POPUP XÁC NHẬN XOÁ
══════════════════════════════════════ */
.popup-overlay {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: rgba(0, 0, 0, 0.32);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .22s;
}

.popup-overlay.show {
  opacity: 1;
  pointer-events: all;
}

.popup-box {
  background: #fff;
  border: 1px solid #f0f0f0;
  border-radius: 20px;
  padding: 16px;
  width: 100%;
  max-width: 330px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  transform: scale(0.93);
  transition: transform .22s;
}

.popup-overlay.show .popup-box {
  transform: scale(1);
}

.popup-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  width: 100%;
}

.popup-icon {
  width: 96px;
  height: 96px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ff7171;
}

.popup-icon svg {
  width: 72px;
  height: 72px;
}

.popup-text {
  font-size: 14px;
  font-weight: 400;
  color: #999;
  letter-spacing: -0.28px;
  line-height: 1.3;
  text-align: center;
  width: 100%;
}

.popup-actions {
  display: flex;
  flex-direction: column;
  width: 100%;
}

.popup-confirm {
  font-family: 'Be Vietnam Pro', sans-serif;
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  background: #4d4d4d;
  border: none;
  border-radius: 12px;
  padding: 11px 17px;
  cursor: pointer;
  letter-spacing: -0.28px;
  width: 100%;
  text-align: center;
  line-height: 1.3;
}

.popup-confirm:active {
  background: #333;
}

.popup-cancel {
  font-family: 'Be Vietnam Pro', sans-serif;
  font-size: 14px;
  font-weight: 600;
  color: #4d4d4d;
  background: none;
  border: none;
  padding: 11px 17px;
  cursor: pointer;
  letter-spacing: -0.28px;
  width: 100%;
  text-align: center;
  line-height: 1.3;
}

/* ══════════════════════════════════════
   MODAL NGÂN SÁCH
══════════════════════════════════════ */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.28);
  z-index: 200;
  display: flex;
  align-items: flex-end;
  padding: 0 16px max(env(safe-area-inset-bottom, 0px), 24px);
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s;
}

.overlay.show {
  opacity: 1;
  pointer-events: all;
}

.sheet {
  background: #fff;
  border-radius: 20px;
  padding: 20px 16px;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transform: translateY(16px);
  transition: transform .25s;
}

.overlay.show .sheet {
  transform: translateY(0);
}

.sheet-note {
  font-size: 12px;
  color: #999;
  letter-spacing: -0.24px;
  line-height: 1.55;
}

.sheet-note b {
  color: #34c759;
  font-weight: 600;
}

.sheet-row {
  display: flex;
  gap: 10px;
}

.sheet-input {
  flex: 1;
  height: 40px;
  background: #ececec;
  border: none;
  border-radius: 12px;
  padding: 4px 12px;
  font-family: 'Be Vietnam Pro', sans-serif;
  font-size: 15px;
  font-weight: 400;
  color: #212121;
  letter-spacing: -0.24px;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
  min-width: 0;
}

.sheet-input::placeholder {
  color: #999;
  font-size: 13px;
}

.sheet-input:focus {
  background: #e4e4e4;
}

.btn-luu {
  font-family: 'Be Vietnam Pro', sans-serif;
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  background: #4d4d4d;
  border: none;
  border-radius: 12px;
  padding: 11px 17px;
  cursor: pointer;
  white-space: nowrap;
}

.btn-luu:active {
  background: #333;
}

.btn-huy {
  font-family: 'Be Vietnam Pro', sans-serif;
  font-size: 14px;
  font-weight: 400;
  color: #999;
  background: none;
  border: none;
  cursor: pointer;
  text-align: center;
  padding: 4px 0;
  letter-spacing: -0.24px;
}

/* ══════════════════════════════════════
   DARK MODE
══════════════════════════════════════ */
/* Cards */
/* Text */
/* Chips & inputs bg */
/* Dividers */
/* New home UI dark mode */
/* Popup overlay */
/* Buttons */
/* Toast feedback */



/* ── NÚT PILL NHẬP CHI TIÊU ── */
#addBtnWrap {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 178px;
  background: linear-gradient(to bottom, rgba(255, 255, 255, 0), white);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: max(20px, calc(env(safe-area-inset-bottom, 0px) + 20px));
  gap: 12px;
  z-index: 10;
  pointer-events: none;
}

.btn-add-expense {
  background: #747474;
  border: 2px solid #545454;
  box-shadow: 0px 6px 0px #545454;
  border-radius: 24px;
  width: 76px;
  height: 70px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 28px;
  font-weight: 400;
  cursor: pointer;
  pointer-events: auto;
  -webkit-tap-highlight-color: transparent;
  transform: translateY(0);
  transition: transform .1s ease, box-shadow .1s ease;
}

.btn-add-expense:active {
  transform: translateY(4px);
  box-shadow: 0px 2px 0px #545454;
}

.mic-btn {
  background: #3378ff;
  border: 2px solid #0048d8;
  box-shadow: 0px 6px 0px #0048d8;
  border-radius: 24px;
  width: 76px;
  height: 70px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 24px;
  cursor: pointer;
  pointer-events: auto;
  -webkit-tap-highlight-color: transparent;
  transform: translateY(0);
  transition: transform .1s ease, box-shadow .1s ease;
}

.mic-btn:active {
  transform: translateY(4px);
  box-shadow: 0px 2px 0px #0048d8;
}

/* ── INPUT BOTTOM SHEET ── */
.sheet-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0, 0, 0, 0.6);
  opacity: 0;
  pointer-events: none;
  transition: opacity .3s;
}

.sheet-overlay.show {
  opacity: 1;
  pointer-events: all;
}

.input-sheet {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%) translateY(110%);
  width: 100%;
  max-width: 430px;
  background: #fff;
  border-radius: 24px 24px 0 0;
  padding: 20px 16px max(calc(env(safe-area-inset-bottom, 0px) + 64px), 80px);
  display: flex;
  flex-direction: column;
  gap: 20px;
  z-index: 201;
  transition: transform .35s cubic-bezier(.32, 0, .67, 0);
}

.input-sheet.show {
  transform: translateX(-50%) translateY(0);
  transition: transform .35s cubic-bezier(.33, 1, .68, 1);
}

.sheet-title {
  font-size: 20px;
  font-weight: 600;
  color: #000;
  letter-spacing: -0.4px;
  line-height: 1.3;
  text-align: center;
  width: 100%;
}

.sheet-input-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ── MÀN CÀI ĐẶT ── */
#settingsScreen {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: #ffffff;
  transform: translateX(100%);
  transition: transform .3s cubic-bezier(.32, 0, .67, 0);
  overflow-y: auto;
}

#settingsScreen.show {
  transform: translateX(0);
  transition: transform .3s cubic-bezier(.33, 1, .68, 1);
}

.settings-inner {
  max-width: 430px;
  margin: 0 auto;
  padding: max(env(safe-area-inset-top, 0px), 20px) 16px 32px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.settings-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 40px;
  margin-bottom: 4px;
}

.back-btn {
  width: 40px;
  height: 40px;
  background: #e6e6e6;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #4d4d4d;
  -webkit-tap-highlight-color: transparent;
}

.back-btn:active {
  opacity: 0.7;
}

.back-btn svg {
  width: 20px;
  height: 20px;
}

.settings-title {
  font-size: 20px;
  font-weight: 600;
  color: #212121;
  letter-spacing: -0.4px;
}

.settings-card {
  background: #fff;
  border: 1px solid #f0f0f0;
  border-radius: 20px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
}

.settings-label {
  font-size: 16px;
  font-weight: 400;
  color: #000;
  letter-spacing: -0.32px;
}

/* Toggle iOS style */
.toggle-wrap {
  width: 72px;
  height: 31px;
  border-radius: 1000px;
  background: #d5d5d5;
  padding: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  transition: background .25s, justify-content .25s;
  -webkit-tap-highlight-color: transparent;
  justify-content: flex-start;
}

.toggle-wrap.on {
  background: #014BDE;
  justify-content: flex-end;
}

.toggle-thumb {
  width: 42px;
  height: 100%;
  border-radius: 10000px;
  background: #fff;
  transition: none;
}


.btn-switch-account {
  font-family: 'Be Vietnam Pro', sans-serif;
  font-size: 16px;
  font-weight: 600;
  color: #fff;
  background: #4d4d4d;
  border: none;
  border-radius: 77px;
  height: 48px;
  padding: 0 32px;
  cursor: pointer;
  letter-spacing: -0.32px;
  align-self: center;
  -webkit-tap-highlight-color: transparent;
}

.btn-switch-account:active {
  opacity: 0.8;
}

.btn-reset-data {
  font-family: 'Be Vietnam Pro', sans-serif;
  font-size: 16px;
  font-weight: 600;
  color: #666;
  background: #e0e0e0;
  border: none;
  border-radius: 77px;
  height: 48px;
  padding: 0 32px;
  cursor: pointer;
  letter-spacing: -0.32px;
  align-self: center;
  -webkit-tap-highlight-color: transparent;
}

.btn-reset-data:active {
  opacity: 0.8;
}




.btn-sheet-done {
  font-family: 'Be Vietnam Pro', sans-serif;
  font-size: 16px;
  font-weight: 600;
  color: #fff;
  background: #4d4d4d;
  border: none;
  border-radius: 77px;
  height: 48px;
  width: 100%;
  cursor: pointer;
  letter-spacing: -0.32px;
  -webkit-tap-highlight-color: transparent;
}

.btn-sheet-done:active {
  opacity: 0.85;
}

/* ══════════════════════════════════════
       EMPTY STATE
    ══════════════════════════════════════ */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 24px;
  min-height: calc(100dvh - 140px);
  padding: 16px 0 32px;
}

.empty-anim-box {
  width: 212px;
  height: 224px;
  background: rgba(0, 0, 0, 0.15);
  border-radius: 18px;
  flex-shrink: 0;
}

.empty-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  width: 100%;
}

.empty-texts {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.empty-title {
  font-size: 24px;
  font-weight: 600;
  color: #212121;
  letter-spacing: -0.48px;
  line-height: 1.3;
  text-align: center;
}

.empty-subtitle {
  font-size: 16px;
  color: #666;
  text-align: center;
  line-height: 1.4;
}

.empty-btn {
  width: auto;
  white-space: nowrap;
  padding: 16px 28px;
  background: #3378ff;
  border: 2px solid #0048d8;
  border-radius: 20px;
  box-shadow: 0 6px 0 0 #0048d8;
  color: #fff;
  font-family: 'Be Vietnam Pro', sans-serif;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.32px;
  text-align: center;
  cursor: pointer;
  line-height: 1.3;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.08s, box-shadow 0.08s;
}

.empty-btn:active {
  transform: translateY(3px);
  box-shadow: 0 3px 0 0 #0048d8;
}

/* ── FCM TOAST ── */
.fcm-toast {
  position: fixed;
  top: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(0);
  background: #1c1917;
  color: #fff;
  padding: 12px 18px;
  border-radius: 14px;
  font-size: 13px;
  z-index: 99999;
  max-width: 300px;
  width: calc(100% - 40px);
  box-shadow: 0 4px 20px rgba(0, 0, 0, .25);
  opacity: 1;
  transition: opacity .4s ease, transform .4s ease;
}

.fcm-toast-title {
  font-weight: 600;
  margin-bottom: 3px;
}

.fcm-toast-body {
  opacity: .8;
  line-height: 1.4;
}

.fcm-toast-hide {
  opacity: 0;
  transform: translateX(-50%) translateY(-8px);
}

/* VOICE RECORDING OVERLAY */
.voice-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.9);
  display: none;
}

.voice-overlay.show {
  display: block;
}

.voice-listen-bar {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: max(153px, calc(env(safe-area-inset-bottom, 0px) + 153px));
  width: 361px;
  height: 56px;
  background: #fafafa;
  border: 2px solid #f5f5f5;
  border-radius: 20px;
  padding: 0 16px;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.voice-listen-left {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

@keyframes voice-pulse {

  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(255, 113, 113, 0.4);
    background: rgba(255, 113, 113, 0.15);
  }

  50% {
    box-shadow: 0 0 0 6px rgba(255, 113, 113, 0);
    background: rgba(255, 113, 113, 0.25);
  }
}

.voice-wave-icon {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(255, 113, 113, 0.15);
  color: #ff7171;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: voice-pulse 1.4s ease-in-out infinite;
}

.voice-listen-label {
  font-family: 'Be Vietnam Pro', sans-serif;
  font-weight: 600;
  font-size: 16px;
  color: #ff7171;
  letter-spacing: -0.32px;
  line-height: 1;
}

.voice-transcript {
  font-family: 'Be Vietnam Pro', sans-serif;
  font-weight: 400;
  font-size: 14px;
  color: #4d4d4d;
  flex: 1;
  min-width: 0;
  text-align: right;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.voice-done-btn {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: max(64px, calc(env(safe-area-inset-bottom, 0px) + 64px));
  width: 120px;
  height: 63px;
  background: #3378ff;
  border: 2px solid #0048d8;
  border-radius: 24px;
  box-shadow: 0px 6px 0px 0px #0048d8;
  font-family: 'Be Vietnam Pro', sans-serif;
  font-weight: 800;
  font-size: 24px;
  color: #ffffff;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.voice-done-btn:active {
  transform: translateX(-50%) translateY(4px);
  box-shadow: 0px 2px 0px 0px #0048d8;
}

/* ── MANUAL INPUT POPUP ── */
.manual-backdrop {
  position: fixed;
  inset: 0;
  z-index: 999;
  background: rgba(0, 0, 0, 0.9);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease;
}

.manual-backdrop.show {
  opacity: 1;
  pointer-events: all;
}

.manual-popup {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%) scale(0.96);
  width: 361px;
  max-width: calc(100vw - 32px);
  background: #ffffff;
  border: 1px solid #f0f0f0;
  border-radius: 24px;
  padding: 16px;
  display: none;
  flex-direction: column;
  gap: 16px;
  z-index: 1000;
  opacity: 0;
  transition: opacity .2s ease, transform .2s ease, top .2s ease;
  font-family: 'Be Vietnam Pro', sans-serif;
}

.manual-popup.show {
  display: flex;
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.manual-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.manual-header-spacer {
  width: 28px;
  height: 28px;
  background: #e6e6e6;
  border-radius: 37px;
  opacity: 0;
  flex-shrink: 0;
}

.manual-toggle {
  width: 228px;
  height: 28px;
  background: #ececec;
  border-radius: 48px;
  padding: 2px;
  display: flex;
  gap: 0;
  flex-shrink: 0;
}

.manual-tab {
  flex: 1;
  height: 100%;
  background: transparent;
  border: none;
  border-radius: 35px;
  font-family: 'Be Vietnam Pro', sans-serif;
  font-size: 12px;
  font-weight: 400;
  color: #333333;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background .15s, color .15s, font-weight .15s;
}

.manual-tab.active {
  background: #ffffff;
  font-weight: 600;
  color: #1a1a1a;
}

.manual-close {
  width: 28px;
  height: 28px;
  background: transparent;
  border: none;
  border-radius: 37px;
  color: #666666;
  font-size: 18px;
  cursor: pointer;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
}

.manual-close:active {
  opacity: 0.6;
}

.manual-input-row {
  display: flex;
  gap: 4px;
  align-items: flex-start;
}

.manual-textarea {
  flex: 1;
  height: 50px;
  background: #f5f5f5;
  border: none;
  border-radius: 12px;
  padding: 14px 16px;
  font-family: 'Be Vietnam Pro', sans-serif;
  font-size: 14px;
  font-weight: 400;
  color: #1a1a1a;
  resize: none;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
  line-height: 1.6;
}

.manual-textarea::placeholder {
  color: #999999;
}

.manual-submit {
  width: 72px;
  height: 42px;
  background: #3378ff;
  border: 2px solid #0048d8;
  border-radius: 14px;
  box-shadow: 0px 6px 0px 0px #0048d8;
  color: #ffffff;
  font-size: 20px;
  cursor: pointer;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transform: translateY(0);
  transition: transform .08s, box-shadow .08s;
  -webkit-tap-highlight-color: transparent;
}

.manual-submit:active {
  transform: translateY(4px);
  box-shadow: 0px 2px 0px 0px #0048d8;
}

.manual-chips {
  display: flex;
  flex-direction: row;
  gap: 10px;
  flex-wrap: wrap;
}

.manual-chips.hidden {
  display: none;
}

.manual-chip {
  background: #ececec;
  border: none;
  border-radius: 30px;
  padding: 8px 12px;
  font-family: 'Be Vietnam Pro', sans-serif;
  font-size: 12px;
  font-weight: 400;
  color: #666666;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.manual-chip:active {
  background: #ddd;
}