/* ============================================================
   Personal Finance App — v2
   Mobile-first, lavender/violet design.
   ============================================================ */

/* ---------- Tokens ---------- */
:root {
  --bg:             #F4F2FB;
  --bg-page:        #E8E4F4;
  --surface:        #FFFFFF;
  --surface-soft:   #FAFAFE;
  --border:         #ECE8FA;
  --border-strong:  #D8D2F0;

  --text:           #1A1B33;
  --text-muted:     #8A8AA8;
  --text-soft:      #B5B5C9;

  --primary:        #6B6BFF;
  --primary-light:  #8B7FFF;
  --primary-soft:   #EEEBFF;
  --primary-fade:   rgba(139, 127, 255, 0.10);

  --income:         #19A57A;
  --income-soft:    rgba(25, 165, 122, 0.12);
  --expense:        #E54B4B;
  --expense-soft:   rgba(229, 75, 75, 0.10);

  --c-orange:       #FF8A3D;
  --c-teal:         #3FBA9F;
  --c-blue:         #4D7EE5;
  --c-pink:         #FF6FA3;
  --c-purple:       #8B6BFF;
  --c-red:          #E54B7B;
  --c-sky:          #5DADE2;
  --c-mint:         #48C9B0;

  --radius:         18px;
  --radius-sm:      12px;
  --radius-lg:      24px;
  --shadow-sm:      0 1px 2px rgba(26, 27, 51, 0.04);
  --shadow-md:      0 6px 20px rgba(26, 27, 51, 0.06);
  --shadow-lg:      0 16px 40px rgba(26, 27, 51, 0.12);
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
ul { list-style: none; padding: 0; margin: 0; }
input, select, button { font-family: inherit; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
    Arial, "PingFang HK", "Microsoft JhengHei", sans-serif;
  background: var(--bg-page);
  color: var(--text);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  min-height: 100vh;
  min-height: 100dvh;
}

/* ---------- Phone Frame (desktop) ---------- */
.phone-frame {
  width: 100%;
  max-width: 420px;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

@media (min-width: 720px) {
  body { padding: 32px 16px; }
  .phone-frame {
    min-height: auto;
    height: calc(100vh - 64px);
    max-height: 920px;
    border-radius: 36px;
    box-shadow: 0 20px 60px rgba(26, 27, 51, 0.18), 0 0 0 8px #1A1B33;
    overflow: hidden;
  }
}

.app {
  flex: 1;
  padding: 18px 18px 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.app::-webkit-scrollbar { display: none; }

/* ---------- Header ---------- */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 0 16px;
}

.user-block { display: flex; align-items: center; gap: 12px; }

.avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, #B5AEFF 0%, #8B7FFF 100%);
  color: #fff;
  font-weight: 600;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(139, 127, 255, 0.35);
}

.user-text .greeting {
  font-size: 12px;
  color: var(--text-muted);
  margin: 0 0 2px;
  font-weight: 500;
}

.user-name {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0;
}

.header-actions { display: flex; gap: 6px; }

.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: transparent;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  transition: background 0.15s ease, color 0.15s ease, transform 0.1s ease;
}
.icon-btn:hover { background: var(--primary-soft); color: var(--primary); }
.icon-btn:active { transform: scale(0.94); }

.icon-btn-primary {
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 22px;
  font-weight: 300;
  line-height: 1;
}
.icon-btn-primary:hover { background: var(--primary); color: #fff; }

/* ---------- Balance Card ---------- */
.balance-card {
  position: relative;
  border-radius: var(--radius-lg);
  padding: 22px 22px 20px;
  color: #fff;
  background: linear-gradient(135deg, #8B7FFF 0%, #6B6BFF 55%, #5D5AE6 100%);
  overflow: hidden;
  box-shadow: 0 12px 32px rgba(107, 107, 255, 0.30);
  margin-bottom: 14px;
}

.balance-blob {
  position: absolute;
  pointer-events: none;
  border-radius: 50%;
}
.balance-blob-1 {
  top: -40px;
  right: -40px;
  width: 180px;
  height: 180px;
  background: radial-gradient(circle, rgba(255,255,255,0.18) 0%, rgba(255,255,255,0) 70%);
}
.balance-blob-2 {
  bottom: -60px;
  right: 30px;
  width: 140px;
  height: 140px;
  background: radial-gradient(circle, rgba(107, 91, 255, 0.45) 0%, rgba(107, 91, 255, 0) 70%);
}

.balance-label {
  font-size: 13px;
  margin: 0 0 6px;
  opacity: 0.85;
  font-weight: 500;
  position: relative;
  z-index: 1;
}

.balance-amount {
  font-size: 36px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0;
  position: relative;
  z-index: 1;
  font-variant-numeric: tabular-nums;
}

.my-balances {
  position: relative;
  z-index: 1;
  margin-top: 16px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: rgba(255, 255, 255, 0.18);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  padding: 8px 14px 8px 16px;
  border-radius: 999px;
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  transition: background 0.15s ease;
}
.my-balances:hover { background: rgba(255, 255, 255, 0.28); }

.circle-arrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.25);
  font-size: 11px;
  line-height: 1;
}

/* ---------- Income / Expense Card ---------- */
.ie-card {
  display: flex;
  align-items: stretch;
  background: var(--primary-soft);
  border-radius: var(--radius);
  padding: 16px 8px;
  margin-bottom: 22px;
}

.ie-item {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
}

.ie-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  flex-shrink: 0;
}
.ie-icon.up   { background: var(--income);  color: #fff; }
.ie-icon.down { background: var(--expense); color: #fff; }

.ie-label {
  font-size: 12px;
  color: var(--text-muted);
  margin: 0 0 2px;
  font-weight: 500;
}
.ie-amount {
  font-size: 16px;
  font-weight: 700;
  margin: 0;
  letter-spacing: -0.01em;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.ie-divider {
  width: 1px;
  background: var(--border-strong);
  margin: 4px 0;
}

/* ---------- Section block ---------- */
.section-block { margin-bottom: 22px; }

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  gap: 10px;
}

.section-title {
  font-size: 16px;
  font-weight: 700;
  margin: 0;
  letter-spacing: -0.01em;
}

.see-all {
  color: var(--primary);
  font-size: 13px;
  font-weight: 600;
  background: none;
  border: 0;
  cursor: pointer;
  padding: 0;
}
.see-all:hover { opacity: 0.75; }

/* ---------- Period Dropdown ---------- */
.period-dropdown { position: relative; }

.period-trigger {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--primary-fade);
  color: var(--primary);
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.period-trigger:hover { background: rgba(139, 127, 255, 0.18); }
.period-trigger[aria-expanded="true"] {
  background: rgba(139, 127, 255, 0.20);
  border-color: rgba(139, 127, 255, 0.25);
}

.period-trigger .cal-icon { display: inline-flex; }
.period-trigger .chevron {
  font-size: 11px;
  transition: transform 0.2s ease;
  margin-left: 2px;
}
.period-trigger[aria-expanded="true"] .chevron { transform: rotate(180deg); }

.period-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  padding: 6px;
  min-width: 180px;
  z-index: 50;
  margin: 0;
  list-style: none;
  animation: menuIn 0.15s ease;
}

@keyframes menuIn {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.period-menu li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 12px;
  border-radius: 10px;
  font-size: 14px;
  color: var(--text);
  cursor: pointer;
  transition: background 0.12s ease;
  user-select: none;
}
.period-menu li:hover { background: var(--surface-soft); }
.period-menu li.active {
  background: var(--primary-fade);
  color: var(--primary);
  font-weight: 600;
}
.period-menu li .check {
  color: var(--primary);
  font-weight: 700;
  font-size: 13px;
}
.period-menu li:not(.active) .check { visibility: hidden; }

/* ---------- Top 5 Horizontal Scroll ---------- */
.horizontal-scroll {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  margin: 0 -18px;
  padding: 4px 18px 12px;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
}
.horizontal-scroll::-webkit-scrollbar { display: none; }

.top5-card {
  flex: 0 0 140px;
  height: 168px;
  border-radius: 20px;
  padding: 18px 14px;
  color: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  scroll-snap-align: start;
  position: relative;
  overflow: hidden;
  box-shadow: 0 6px 18px rgba(26, 27, 51, 0.10);
}
.top5-card::after {
  content: "";
  position: absolute;
  top: -20px;
  right: -20px;
  width: 80px;
  height: 80px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 50%;
  pointer-events: none;
}

.rank-circle {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.30);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 16px;
  backdrop-filter: blur(4px);
  z-index: 1;
}

.top5-name {
  font-size: 14px;
  font-weight: 500;
  opacity: 0.95;
  z-index: 1;
}
.top5-amount {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.01em;
  z-index: 1;
  font-variant-numeric: tabular-nums;
}

/* ---------- Budget Grid ---------- */
.budget-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.budget-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 14px;
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 96px;
  transition: transform 0.1s ease;
}
.budget-card:active { transform: scale(0.99); }

.budget-card.quiet {
  background: var(--surface-soft);
  border-style: dashed;
  border-color: var(--border-strong);
}

.budget-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}

.budget-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 6px;
}

.budget-arrow {
  color: var(--text-soft);
  font-size: 14px;
  line-height: 1;
}

.budget-amount {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  margin: 2px 0 8px;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
}

.budget-card.quiet .budget-amount { color: var(--text-soft); font-weight: 500; }

.progress-bar {
  height: 5px;
  background: var(--surface-soft);
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid var(--border);
}
.progress-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.4s ease;
}
.progress-fill.over { background: var(--expense) !important; }

.budget-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 6px;
}
.budget-left {
  font-size: 11px;
  color: var(--text-muted);
}
.budget-left.over { color: var(--expense); font-weight: 600; }

.budget-spent {
  font-size: 11px;
  color: var(--text-muted);
}

/* ---------- Recent Transactions ---------- */
.recent-list { display: flex; flex-direction: column; gap: 8px; }

.recent-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  transition: transform 0.1s ease;
}
.recent-item:hover { transform: translateY(-1px); }

.recent-icon {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}
.recent-icon.income  { background: var(--income-soft); }
.recent-icon.expense { background: var(--expense-soft); }

.recent-body { flex: 1; min-width: 0; }
.recent-desc {
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 2px;
}
.recent-meta {
  font-size: 12px;
  color: var(--text-muted);
}

.recent-amount {
  font-weight: 700;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.recent-amount.income  { color: var(--income); }
.recent-amount.expense { color: var(--expense); }

.recent-delete {
  background: none;
  border: 0;
  color: var(--text-soft);
  font-size: 14px;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-left: 4px;
  transition: background 0.15s ease, color 0.15s ease;
}
.recent-delete:hover { background: var(--expense-soft); color: var(--expense); }

.empty-message {
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
  padding: 18px 8px;
  background: var(--surface-soft);
  border: 1px dashed var(--border-strong);
  border-radius: 14px;
  margin: 0;
}

/* ---------- Bottom Nav ---------- */
.bottom-nav {
  display: flex;
  align-items: center;
  justify-content: space-around;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
  padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
  position: sticky;
  bottom: 0;
  z-index: 30;
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 4px;
  border-radius: 12px;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 500;
  transition: color 0.15s ease, background 0.15s ease;
}
.nav-item:hover { color: var(--primary); }
.nav-item.active {
  color: var(--primary);
  background: var(--primary-soft);
  font-weight: 600;
}
.nav-icon { display: flex; }

/* ---------- Modal ---------- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
}
.modal[hidden] { display: none; }

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(26, 27, 51, 0.45);
  backdrop-filter: blur(2px);
  animation: fadeIn 0.2s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal-card {
  position: relative;
  background: #fff;
  width: 100%;
  max-width: 420px;
  border-top-left-radius: 28px;
  border-top-right-radius: 28px;
  padding: 12px 22px calc(22px + env(safe-area-inset-bottom));
  max-height: 90vh;
  overflow-y: auto;
  animation: slideUp 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes slideUp {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}

@media (min-width: 720px) {
  .modal { align-items: center; padding: 16px; }
  .modal-card {
    border-radius: 24px;
    margin: 0 16px;
  }
}

.modal-handle {
  width: 40px;
  height: 4px;
  background: var(--border-strong);
  border-radius: 2px;
  margin: 0 auto 16px;
}

.modal-title {
  font-size: 18px;
  font-weight: 700;
  margin: 0 0 16px;
  letter-spacing: -0.01em;
}

.modal-text {
  font-size: 14px;
  color: var(--text);
  margin: 0 0 8px;
  line-height: 1.5;
}
.modal-text.muted { color: var(--text-muted); font-size: 12px; margin-bottom: 16px; }

/* ---------- Form (in modal) ---------- */
.type-toggle {
  display: flex;
  background: var(--surface-soft);
  border-radius: 12px;
  padding: 4px;
  margin-bottom: 16px;
  border: 1px solid var(--border);
}
.type-btn {
  flex: 1;
  padding: 9px 12px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  transition: all 0.15s ease;
}
.type-btn.active {
  background: #fff;
  color: var(--text);
  box-shadow: var(--shadow-sm);
}
.type-btn[data-type="income"].active  { color: var(--income); }
.type-btn[data-type="expense"].active { color: var(--expense); }

.form-row { margin-bottom: 14px; }
.form-row label {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
  margin-bottom: 6px;
}
.form-row input,
.form-row select {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 14px;
  background: var(--surface);
  color: var(--text);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.form-row input:focus,
.form-row select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(139, 127, 255, 0.18);
}

.form-row.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.form-row.split > div { display: flex; flex-direction: column; }

.form-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}
.form-actions .primary-btn,
.form-actions .secondary-btn { flex: 1; }

.primary-btn {
  background: var(--primary);
  color: #fff;
  padding: 12px 18px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  transition: background 0.15s ease, transform 0.05s ease;
}
.primary-btn:hover  { background: var(--primary-light); }
.primary-btn:active { transform: translateY(1px); }

.secondary-btn {
  background: var(--surface-soft);
  color: var(--text);
  padding: 12px 18px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  border: 1px solid var(--border);
  transition: background 0.15s ease;
}
.secondary-btn:hover { background: var(--border); }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  bottom: calc(96px + env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  background: var(--text);
  color: #fff;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  z-index: 200;
  animation: toastIn 0.25s ease;
}
@keyframes toastIn {
  from { opacity: 0; transform: translate(-50%, 10px); }
  to   { opacity: 1; transform: translate(-50%, 0); }
}

/* ---------- Bottom Spacer (so last card clears nav) ---------- */
.bottom-spacer { height: 20px; }

/* ---------- Loading Overlay ---------- */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  z-index: 300;
  animation: fadeIn 0.2s ease;
}
.loading-overlay[hidden] { display: none; }
.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--primary-soft);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.85s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-overlay p {
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 500;
  margin: 0;
}

/* ---------- Auth Screen ---------- */
.auth-screen {
  position: fixed;
  inset: 0;
  z-index: 400;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  background: linear-gradient(135deg, #B5AEFF 0%, #8B7FFF 45%, #6B6BFF 100%);
  overflow: hidden;
  animation: fadeIn 0.25s ease;
}
.auth-screen[hidden] { display: none; }

.auth-blob {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
}
.auth-blob-1 {
  top: -100px;
  right: -80px;
  width: 320px;
  height: 320px;
  background: radial-gradient(circle, rgba(255,255,255,0.18) 0%, rgba(255,255,255,0) 70%);
}
.auth-blob-2 {
  bottom: -120px;
  left: -60px;
  width: 280px;
  height: 280px;
  background: radial-gradient(circle, rgba(107, 91, 255, 0.35) 0%, rgba(107, 91, 255, 0) 70%);
}

.auth-card {
  position: relative;
  background: #fff;
  border-radius: 24px;
  padding: 32px 26px 24px;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 24px 60px rgba(26, 27, 51, 0.18);
  animation: cardIn 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes cardIn {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0)    scale(1);    }
}

.auth-logo {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: linear-gradient(135deg, #8B7FFF, #6B6BFF);
  color: #fff;
  font-size: 28px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
  box-shadow: 0 8px 20px rgba(107, 107, 255, 0.32);
}

.auth-title {
  text-align: center;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0 0 6px;
  color: var(--text);
}

.auth-subtitle {
  text-align: center;
  font-size: 14px;
  color: var(--text-muted);
  margin: 0 0 22px;
  line-height: 1.4;
}

.auth-tabs {
  display: flex;
  background: var(--surface-soft);
  border-radius: 12px;
  padding: 4px;
  margin-bottom: 18px;
  border: 1px solid var(--border);
}
.auth-tab {
  flex: 1;
  padding: 9px 12px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  background: transparent;
  transition: all 0.15s ease;
}
.auth-tab.active {
  background: #fff;
  color: var(--text);
  box-shadow: var(--shadow-sm);
  font-weight: 600;
}

.auth-form { margin-bottom: 8px; }
.auth-form .form-row { margin-bottom: 12px; }

.auth-error {
  background: var(--expense-soft);
  color: var(--expense);
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 13px;
  margin: 0 0 12px;
  font-weight: 500;
}
.auth-error[hidden] { display: none; }

.auth-submit {
  width: 100%;
  margin-top: 4px;
}
.auth-submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.auth-foot {
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
  margin: 14px 0 0;
}

.account-row {
  margin-top: 4px;
  font-size: 13px;
}
.account-row strong { color: var(--text); font-weight: 600; }

/* ---------- Responsive tweaks ---------- */
@media (max-width: 360px) {
  .balance-amount { font-size: 30px; }
  .top5-card { flex: 0 0 124px; height: 156px; }
  .user-name { font-size: 16px; }
}
