/* ═══════════════════════════════════════════════
   Finance Analytics — Premium Design System
   ═══════════════════════════════════════════════ */

/* ─── Design Tokens ─── */
:root {
  --bg:              #f0f2f8;
  --surface:         #ffffff;
  --surface-2:       #f8f9fc;
  --surface-3:       #f3f4f9;
  --border:          #e4e7ef;
  --border-subtle:   #eef0f6;
  --text-primary:    #0f172a;
  --text-secondary:  #475569;
  --text-muted:      #94a3b8;
  --accent:          #4f46e5;
  --accent-light:    #eef2ff;
  --accent-hover:    #4338ca;
  --accent-glow:     rgba(79,70,229,.18);
  --success:         #059669;
  --success-light:   #ecfdf5;
  --danger:          #dc2626;
  --danger-light:    #fef2f2;
  --warning:         #d97706;
  --warning-light:   #fffbeb;
  --shadow-xs:       0 1px 2px rgba(0,0,0,.04);
  --shadow-sm:       0 1px 4px rgba(0,0,0,.06), 0 2px 8px rgba(0,0,0,.04);
  --shadow:          0 4px 20px rgba(0,0,0,.07), 0 1px 6px rgba(0,0,0,.04);
  --shadow-lg:       0 12px 40px rgba(0,0,0,.1), 0 4px 12px rgba(0,0,0,.06);
  --shadow-xl:       0 24px 60px rgba(0,0,0,.14), 0 8px 20px rgba(0,0,0,.08);
  --radius-sm:       8px;
  --radius:          12px;
  --radius-lg:       16px;
  --radius-xl:       20px;
  --nav-height:      60px;
  --font:            'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono:       'JetBrains Mono', 'SF Mono', 'Fira Code', monospace;
  --transition:      .18s cubic-bezier(.22,1,.36,1);
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: auto;
  -moz-osx-font-smoothing: auto;
}

/* ─── Custom Scrollbar ─── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* ══════════════════════════════════
   NAVBAR
══════════════════════════════════ */
.navbar {
  position: sticky;
  top: 0;
  z-index: 200;
  height: var(--nav-height);
  background: #0d1117;
  border-bottom: 1px solid rgba(255,255,255,.06);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  box-shadow: 0 1px 24px rgba(0,0,0,.25);
}

.navbar::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent 5%, rgba(99,102,241,.35) 35%, rgba(167,139,250,.25) 65%, transparent 95%);
  pointer-events: none;
}

.nav-brand {
  color: white;
  text-decoration: none;
  font-size: .95rem;
  font-weight: 700;
  letter-spacing: -.015em;
  display: flex;
  align-items: center;
  gap: .55rem;
  transition: opacity var(--transition);
}

.nav-brand:hover { opacity: .85; }

.nav-brand-icon {
  width: 28px;
  height: 28px;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .8rem;
  box-shadow: 0 0 12px rgba(99,102,241,.5);
  flex-shrink: 0;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: .15rem;
}

.nav-links a {
  color: rgba(255,255,255,.45);
  text-decoration: none;
  font-size: .8rem;
  font-weight: 500;
  padding: .32rem .72rem;
  border-radius: 99px;
  border: 1px solid transparent;
  transition: color var(--transition), background var(--transition), border-color var(--transition), box-shadow var(--transition);
  letter-spacing: .015em;
  white-space: nowrap;
}

.nav-links a:hover {
  color: rgba(255,255,255,.85);
  background: rgba(255,255,255,.07);
  border-color: rgba(255,255,255,.08);
}

.nav-links a.active {
  color: #c7d2fe;
  font-weight: 600;
  background: rgba(99,102,241,.2);
  border-color: rgba(99,102,241,.4);
  box-shadow: 0 0 10px rgba(99,102,241,.2);
}

.account-switch-form {
  display: flex;
  align-items: center;
  margin: 0;
  position: relative;
}

.account-switch-form select {
  appearance: none;
  -webkit-appearance: none;
  height: 32px;
  min-width: 104px;
  max-width: 140px;
  padding: 0 2rem 0 .78rem !important;
  border-radius: 99px;
  border: 1px solid rgba(148,163,184,.22);
  background:
    linear-gradient(45deg, transparent 50%, #a5b4fc 50%) calc(100% - 16px) 13px / 6px 6px no-repeat,
    linear-gradient(135deg, #a5b4fc 50%, transparent 50%) calc(100% - 12px) 13px / 6px 6px no-repeat,
    rgba(15,23,42,.72);
  color: #eef2ff;
  font-size: .8rem;
  font-weight: 600;
  line-height: 32px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.06);
  cursor: pointer;
  outline: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: border-color var(--transition), background-color var(--transition), box-shadow var(--transition), color var(--transition);
}

.account-switch-form select:hover,
.account-switch-form select:focus {
  border-color: rgba(129,140,248,.7);
  background-color: rgba(30,41,59,.86);
  color: #fff;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.08),
    0 0 0 3px rgba(99,102,241,.18);
}

.account-switch-form option {
  color: #0f172a;
  background: #fff;
}

/* ══════════════════════════════════
   CONTAINER
══════════════════════════════════ */
.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 2rem;
}

/* ══════════════════════════════════
   PAGE ENTRY ANIMATIONS
══════════════════════════════════ */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes scaleIn {
  from { opacity: 0; transform: scale(.96); }
  to   { opacity: 1; transform: scale(1); }
}

@keyframes slideRight {
  from { opacity: 0; transform: translateX(-12px); }
  to   { opacity: 1; transform: translateX(0); }
}

@keyframes shimmer {
  from { background-position: -200% center; }
  to   { background-position: 200% center; }
}

@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(99,102,241,0); }
  50%       { box-shadow: 0 0 0 4px rgba(99,102,241,.15); }
}

.container > * {
  animation: fadeUp .5s cubic-bezier(.22,1,.36,1) both;
}
.container > *:nth-child(1) { animation-delay: .04s; }
.container > *:nth-child(2) { animation-delay: .09s; }
.container > *:nth-child(3) { animation-delay: .14s; }
.container > *:nth-child(4) { animation-delay: .19s; }
.container > *:nth-child(5) { animation-delay: .24s; }
.container > *:nth-child(6) { animation-delay: .29s; }
.container > *:nth-child(7) { animation-delay: .34s; }
.container > *:nth-child(8) { animation-delay: .39s; }

/* ══════════════════════════════════
   CARDS
══════════════════════════════════ */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1.5rem;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition), transform var(--transition), border-color var(--transition);
  position: relative;
  overflow: hidden;
}

.card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(135deg, rgba(255,255,255,.4) 0%, transparent 60%);
  pointer-events: none;
}

/* ─── Grids ─── */
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.25rem; }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1.25rem; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.25rem; }

/* ══════════════════════════════════
   AUTH FORM
══════════════════════════════════ */
.auth-form {
  max-width: 440px;
  margin: 5rem auto;
  background: var(--surface);
  padding: 2.75rem 2.5rem;
  border-radius: var(--radius-xl);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-xl);
  animation: scaleIn .45s cubic-bezier(.22,1,.36,1) both;
  position: relative;
  overflow: hidden;
}

.auth-form::after {
  content: '';
  position: absolute;
  top: -80px;
  right: -80px;
  width: 200px;
  height: 200px;
  background: radial-gradient(circle, rgba(99,102,241,.08) 0%, transparent 70%);
  pointer-events: none;
}

.auth-form h1 {
  font-size: 1.65rem;
  font-weight: 800;
  margin-bottom: 2rem;
  letter-spacing: -.03em;
  color: var(--text-primary);
}

.auth-form p {
  margin-top: 1.25rem;
  text-align: center;
  font-size: .875rem;
  color: var(--text-muted);
}

.auth-form p a {
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
}

.auth-form p a:hover { text-decoration: underline; }

/* ══════════════════════════════════
   FORM ELEMENTS
══════════════════════════════════ */
.form-group { margin-bottom: 1.15rem; }

.form-group label {
  display: block;
  margin-bottom: .4rem;
  font-size: .8rem;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: .025em;
  text-transform: uppercase;
}

.form-group input {
  width: 100%;
  padding: .7rem 1rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: .95rem;
  font-family: var(--font);
  color: var(--text-primary);
  background: var(--surface);
  transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
  outline: none;
}

.form-group input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
  background: #fafbff;
}

.form-group input:hover:not(:focus) {
  border-color: #c7d0e8;
}

/* ══════════════════════════════════
   BUTTONS
══════════════════════════════════ */
.btn {
  padding: .7rem 1.5rem;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: .9rem;
  font-family: var(--font);
  font-weight: 600;
  letter-spacing: .015em;
  transition: all var(--transition);
  outline: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
}

.btn-primary {
  background: linear-gradient(135deg, #4f46e5, #7c3aed);
  color: white;
  width: 100%;
  margin-top: .5rem;
  box-shadow: 0 4px 14px rgba(79,70,229,.35);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #4338ca, #6d28d9);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(79,70,229,.45);
}

.btn-primary:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(79,70,229,.3);
}

/* ══════════════════════════════════
   ALERTS / BANNERS
══════════════════════════════════ */
.alert {
  padding: .9rem 1.15rem;
  border-radius: var(--radius-sm);
  margin-bottom: 1.15rem;
  font-size: .88rem;
  font-weight: 500;
  display: flex;
  align-items: flex-start;
  gap: .55rem;
  animation: slideRight .3s cubic-bezier(.22,1,.36,1) both;
}

.alert-error {
  background: var(--danger-light);
  color: #b91c1c;
  border: 1px solid #fecaca;
}

.alert-success {
  background: var(--success-light);
  color: #065f46;
  border: 1px solid #a7f3d0;
}

/* ══════════════════════════════════
   TABLES
══════════════════════════════════ */
table { width: 100%; border-collapse: collapse; }

th, td {
  padding: .8rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border-subtle);
  font-size: .875rem;
}

thead tr {
  position: relative;
}

th {
  font-weight: 700;
  font-size: .72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .07em;
  background: var(--surface-2);
  white-space: nowrap;
}

th:first-child { border-radius: var(--radius-sm) 0 0 0; }
th:last-child  { border-radius: 0 var(--radius-sm) 0 0; }

tbody tr {
  transition: background var(--transition);
}

tbody tr:last-child td { border-bottom: none; }

tbody tr:hover td {
  background: #f8f9ff;
}

/* ══════════════════════════════════
   BADGES
══════════════════════════════════ */
.badge {
  display: inline-flex;
  align-items: center;
  padding: .22rem .65rem;
  border-radius: 99px;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .025em;
  white-space: nowrap;
}

.badge-blue   { background: #eff6ff; color: #2563eb; }
.badge-green  { background: #ecfdf5; color: #059669; }
.badge-orange { background: #fffbeb; color: #b45309; }
.badge-red    { background: #fef2f2; color: #b91c1c; }

.ea-stat-imported { color: #27ae60; }
.ea-stat-skipped  { color: #d97706; }
.ea-stat-failed   { color: #c0392b; }

/* ══════════════════════════════════
   TYPOGRAPHY
══════════════════════════════════ */
h1 {
  font-size: 1.55rem;
  font-weight: 800;
  margin-bottom: 1.5rem;
  letter-spacing: -.03em;
  color: var(--text-primary);
  line-height: 1.25;
}

h2 {
  font-size: .95rem;
  font-weight: 700;
  margin-bottom: 1rem;
  color: var(--text-secondary);
  letter-spacing: -.01em;
}

/* ══════════════════════════════════
   PAGE PROGRESS BAR
══════════════════════════════════ */
#nprogress-bar {
  position: fixed;
  top: 0;
  left: 0;
  height: 2px;
  background: linear-gradient(90deg, #4f46e5, #8b5cf6, #ec4899);
  z-index: 9999;
  transition: width .3s ease;
  border-radius: 0 2px 2px 0;
}

/* ══════════════════════════════════
   STAT CARD ENHANCEMENTS
══════════════════════════════════ */
.stat-number {
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: -.04em;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}

.stat-card {
  transition: box-shadow var(--transition), transform var(--transition), border-color var(--transition) !important;
}

.stat-card:hover {
  box-shadow: var(--shadow) !important;
  transform: translateY(-2px);
}

/* icon badge inside stat cards */
.stat-icon {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: .8rem;
  flex-shrink: 0;
}

/* slim progress bar inside cards */
.stat-progress {
  margin-top: .7rem;
}
.stat-progress-header {
  display: flex;
  justify-content: space-between;
  font-size: .62rem;
  color: #cbd5e1;
  margin-bottom: .3rem;
}
.stat-progress-track {
  height: 3px;
  background: #f1f4f9;
  border-radius: 99px;
  overflow: hidden;
}
.stat-progress-fill {
  height: 100%;
  border-radius: 99px;
  transition: width .6s cubic-bezier(.22,1,.36,1);
}

/* ══════════════════════════════════
   SELECT / INPUT OVERRIDES
══════════════════════════════════ */
select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%2394a3b8' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right .75rem center;
  padding-right: 2.25rem !important;
  cursor: pointer;
  font-family: var(--font);
  color: var(--text-primary);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background-color: var(--surface);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
  font-size: .875rem;
}

select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

select:hover:not(:focus) { border-color: #c7d0e8; }

input[type="text"]:not(.form-group input),
input[type="search"]:not(.form-group input) {
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: .45rem .75rem;
  font-family: var(--font);
  font-size: .875rem;
  color: var(--text-primary);
  background: var(--surface);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}

input[type="text"]:not(.form-group input):focus,
input[type="search"]:not(.form-group input):focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

/* ══════════════════════════════════
   TOOLTIPS / HOVER EFFECTS
══════════════════════════════════ */
[title] { cursor: help; }

/* ══════════════════════════════════
   LINK STYLES
══════════════════════════════════ */
a:not(.nav-brand):not(.nav-links a):not(.btn) {
  color: var(--accent);
  text-decoration: none;
  transition: color var(--transition);
}

a:not(.nav-brand):not(.nav-links a):not(.btn):hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

/* ══════════════════════════════════
   LOADING SKELETON
══════════════════════════════════ */
@keyframes skeleton-wave {
  from { background-position: -200% 0; }
  to   { background-position: 200% 0; }
}

.skeleton {
  background: linear-gradient(90deg, #f0f2f5 25%, #e8eaf0 50%, #f0f2f5 75%);
  background-size: 200% 100%;
  animation: skeleton-wave 1.5s infinite;
  border-radius: 6px;
}

/* ══════════════════════════════════
   CHART CONTAINER
══════════════════════════════════ */
[id$="-chart"],
[id$="-pie"],
[id$="-bar"] {
  transition: opacity .3s;
}

/* ══════════════════════════════════
   RESPONSIVE
══════════════════════════════════ */

/* ─── Dashboard layout ─── */
.dashboard-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 2rem;
}

.dashboard-stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.25rem;
  margin-bottom: 1.75rem;
}

.dashboard-chart-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  margin-bottom: 1.75rem;
}

.table-responsive {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

@media (max-width: 1024px) {
  .container { padding: 1.5rem; }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .dashboard-stat-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  .container { padding: 1rem; }
  .grid-3, .grid-2, .grid-4 { grid-template-columns: 1fr; }
  .navbar { padding: 0 1rem; flex-wrap: wrap; height: auto; min-height: var(--nav-height); }
  .nav-links a { padding: .3rem .5rem; font-size: .75rem; }
  .dashboard-stat-grid { grid-template-columns: repeat(2, 1fr); }
  .dashboard-chart-grid { grid-template-columns: 1fr; }
  .dashboard-header { flex-direction: column; align-items: flex-start; }

  /* Stat cards: tighter on mobile */
  .stat-card { padding: 1rem !important; }
  .stat-number { font-size: 1.2rem; }

  /* Chart heights: shorter on mobile to prevent overflow */
  #cat-pie, #merchant-pie { height: 260px !important; }
  #trend-chart, #cat-bar  { height: 260px !important; }
  #card-pie, #merchant-pie2 { height: 260px !important; }

  /* Mobile nav collapse */
  .nav-toggle {
    display: flex;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: .4rem;
  }
  .nav-toggle span {
    display: block;
    width: 22px;
    height: 2px;
    background: rgba(255,255,255,.7);
    border-radius: 2px;
    transition: all .2s;
  }
  .nav-end { position: relative; display: flex; align-items: center; gap: .5rem; }
  .nav-links {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: #161b22;
    border: 1px solid rgba(255,255,255,.08);
    border-radius: 10px;
    box-shadow: 0 8px 32px rgba(0,0,0,.4);
    flex-direction: column;
    padding: .4rem;
    gap: 0;
    min-width: 140px;
    z-index: 300;
  }
  .nav-links.open { display: flex; }
  .nav-links a { width: 100%; padding: .55rem .75rem; border-radius: 6px; font-size: .85rem; }
  .account-switch-form { width: 100%; }
  .account-switch-form select {
    width: 100%;
    max-width: none;
    height: 34px;
    border-radius: 6px;
    font-size: .85rem;
  }
  .col-hide-mobile { display: none; }
}

@media (min-width: 769px) {
  .nav-toggle { display: none; }
}

/* ══════════════════════════════════
   IMPORT / EMAIL ACCOUNT FORM
══════════════════════════════════ */
.ea-field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .75rem;
}

@media (max-width: 480px) {
  .ea-field-grid { grid-template-columns: 1fr; }
}

/* ══════════════════════════════════
   IMPORT PAGE OVERRIDES
══════════════════════════════════ */
.ea-submit-btn {
  background: linear-gradient(135deg, #0f172a, #1e293b) !important;
  transition: all var(--transition) !important;
}
.ea-submit-btn:hover {
  background: linear-gradient(135deg, #1e293b, #334155) !important;
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(15,23,42,.25) !important;
}

.ea-btn-sm {
  border-radius: var(--radius-sm) !important;
  font-family: var(--font) !important;
  transition: all var(--transition) !important;
}

/* ══════════════════════════════════
   SMOOTH FOCUS RING
══════════════════════════════════ */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ══════════════════════════════════
   SELECTION
══════════════════════════════════ */
::selection {
  background: rgba(79,70,229,.15);
  color: var(--text-primary);
}

/* ══════════════════════════════════
   USER MENU (头像 + 下拉)
══════════════════════════════════ */
.nav-end {
  display: flex;
  align-items: center;
  gap: .5rem;
  margin-left: auto;
  flex-shrink: 0;
}

.user-menu {
  position: relative;
}

.user-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: linear-gradient(135deg, #7c3aed, #2563eb);
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: box-shadow var(--transition);
  flex-shrink: 0;
}

.user-avatar:hover {
  box-shadow: 0 0 0 3px rgba(124,58,237,.35);
}

.user-dropdown {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + 10px);
  background: #1e293b;
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 10px;
  min-width: 168px;
  z-index: 1000;
  box-shadow: 0 8px 28px rgba(0,0,0,.45);
  overflow: hidden;
}

.user-dropdown.open {
  display: block;
}

.user-dropdown-info {
  padding: 10px 14px 9px;
  border-bottom: 1px solid rgba(255,255,255,.06);
}

.user-dropdown-name {
  font-size: 13px;
  font-weight: 600;
  color: #f1f5f9;
  line-height: 1.3;
}

.user-dropdown-username {
  font-size: 11px;
  color: #475569;
  margin-top: 1px;
}

.user-dropdown-item {
  display: block;
  width: 100%;
  padding: 9px 14px;
  background: none;
  border: none;
  text-align: left;
  font-size: 12px;
  font-family: var(--font);
  color: #e2e8f0;
  cursor: pointer;
  text-decoration: none;
  transition: background var(--transition);
}

.user-dropdown-item:hover {
  background: rgba(255,255,255,.06);
}

/* ══════════════════════════════════
   CHANGE PASSWORD PANEL
══════════════════════════════════ */
.cp-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.4);
  z-index: 1000;
  backdrop-filter: blur(2px);
}

.cp-overlay.open {
  display: block;
}

.cp-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 320px;
  background: #1e293b;
  border-left: 1px solid rgba(255,255,255,.1);
  transform: translateX(100%);
  transition: transform var(--transition);
  z-index: 1001;
  padding: 28px 24px;
  display: flex;
  flex-direction: column;
}

.cp-panel.open {
  transform: translateX(0);
}

.cp-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.cp-header span {
  font-size: 16px;
  font-weight: 700;
  color: #f1f5f9;
}

.cp-close-btn {
  background: none;
  border: none;
  color: #64748b;
  font-size: 22px;
  cursor: pointer;
  line-height: 1;
  padding: 0 2px;
  transition: color var(--transition);
}

.cp-close-btn:hover {
  color: #94a3b8;
}

.cp-field {
  margin-bottom: 16px;
}

.cp-field label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: #94a3b8;
  margin-bottom: 6px;
}

.cp-field input {
  width: 100%;
  box-sizing: border-box;
  background: #0f172a;
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 7px;
  padding: 10px 12px;
  font-size: 13px;
  font-family: var(--font);
  color: #f1f5f9;
  transition: border-color var(--transition);
}

.cp-field input:focus {
  outline: none;
  border-color: #7c3aed;
}

.cp-submit {
  width: 100%;
  background: linear-gradient(135deg, #7c3aed, #2563eb);
  border: none;
  border-radius: 7px;
  padding: 11px;
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font);
  color: #fff;
  cursor: pointer;
  margin-top: 8px;
  transition: opacity var(--transition);
}

.cp-submit:hover {
  opacity: .9;
}

.change-pw-success {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 7px;
  background: rgba(5,150,105,.12);
  border: 1px solid rgba(5,150,105,.3);
  color: #34d399;
  font-size: 13px;
  text-align: center;
}

.change-pw-error {
  margin-top: 14px;
  padding: 10px 14px;
  border-radius: 7px;
  background: rgba(220,38,38,.1);
  border: 1px solid rgba(220,38,38,.25);
  color: #f87171;
  font-size: 13px;
}

/* ─── Transactions: responsive table / card list ─── */
.txn-table-wrap { display: block; }
.txn-card-list  { display: none; }

@media (max-width: 640px) {
  .txn-table-wrap { display: none; }
  .txn-card-list  { display: flex; flex-direction: column; gap: .6rem; }
}

.txn-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: .75rem 1rem;
  background: var(--surface);
}

.txn-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: .5rem;
  margin-bottom: .45rem;
}

.txn-card-merchant {
  font-size: .88rem;
  font-weight: 600;
  color: var(--text-primary);
  flex: 1;
  min-width: 0;
  word-break: break-word;
}

.txn-card-amount {
  font-size: 1rem;
  font-weight: 800;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

.txn-expense { color: var(--danger); }
.txn-income  { color: var(--success); }

.txn-card-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .35rem;
}

.txn-meta-date {
  font-size: .75rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  margin-right: .1rem;
}

.txn-meta-card {
  font-size: .72rem;
  color: var(--text-muted);
  margin-left: auto;
}

.drilldown-hint {
  margin-left: 6px;
  font-size: 0.75em;
  color: #aaa;
  cursor: default;
  vertical-align: middle;
  transition: color 0.2s;
  user-select: none;
}
.drilldown-hint:hover { color: #4a90d9; }
