@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=JetBrains+Mono:wght@600;700&display=swap');

:root {
  --bg-app: #f4f3fb;
  --glass-card: rgba(255, 255, 255, 0.75);
  --glass-card-hover: rgba(255, 255, 255, 0.9);
  --glass-elevated: rgba(255, 255, 255, 0.95);
  --glass-stroke: rgba(255, 255, 255, 0.9);
  --glass-inner-light: inset 0 1.5px 2px 0 rgba(255, 255, 255, 0.95), inset 0 -1px 1px 0 rgba(0, 0, 0, 0.02);

  --text-main: #0c0f24;
  --text-muted: #64708a;
  --text-subtle: #98a2b8;

  --primary-blue: #4f46e5;
  --primary-purple: #7c3aed;
  --gradient-3d-card: linear-gradient(135deg, #4338ca 0%, #6366f1 50%, #8b5cf6 100%);
  --gradient-ring: linear-gradient(135deg, #00d2ff 0%, #7928ca 100%);
  --primary-glow: rgba(79, 70, 229, 0.22);

  --income-green: #10b981;
  --income-bg: rgba(16, 185, 129, 0.12);
  --expense-red: #f43f5e;
  --expense-bg: rgba(244, 63, 94, 0.12);

  --radius-xs: 10px;
  --radius-sm: 16px;
  --radius-md: 24px;
  --radius-lg: 32px;
  --radius-pill: 100px;

  --shadow-glass: 0 20px 45px -10px rgba(70, 85, 130, 0.12), 0 4px 16px -2px rgba(70, 85, 130, 0.04);
  --shadow-pill: 0 4px 14px 0 rgba(70, 85, 130, 0.07);
  --blur-glass: blur(28px) saturate(200%);
}

/* ==========================================================================
   DARK MODE REFINED (FINTECH PREMIUM DARK PALETTE)
   ========================================================================== */
body.dark-mode {
  --bg-app: #080c16 !important;
  --glass-card: rgba(15, 23, 42, 0.8) !important;
  --glass-card-hover: rgba(22, 32, 54, 0.9) !important;
  --glass-elevated: rgba(15, 23, 42, 0.98) !important;
  --glass-stroke: rgba(255, 255, 255, 0.08) !important;
  --glass-inner-light: inset 0 1.5px 2px 0 rgba(255, 255, 255, 0.06), inset 0 -1px 1px 0 rgba(0, 0, 0, 0.5) !important;

  --text-main: #f1f5f9 !important;
  --text-muted: #94a3b8 !important;
  --text-subtle: #64748b !important;

  --gradient-3d-card: linear-gradient(135deg, #1e1b4b 0%, #312e81 50%, #581c87 100%) !important;
  background-color: #080c16 !important;
  background-image: 
    radial-gradient(at 0% 0%, rgba(30, 27, 75, 0.55) 0px, transparent 50%),
    radial-gradient(at 100% 0%, rgba(88, 28, 135, 0.35) 0px, transparent 50%),
    radial-gradient(at 50% 50%, rgba(8, 12, 22, 0.92) 0px, transparent 70%) !important;
}

body.dark-mode .app-fixed-header,
body.dark-mode .mobile-bottom-bar,
body.dark-mode .auth-card,
body.dark-mode .modal-box {
  background: rgba(15, 23, 42, 0.92) !important;
  border-color: rgba(255, 255, 255, 0.1) !important;
  color: #f1f5f9 !important;
}

body.dark-mode input,
body.dark-mode select {
  background-color: rgba(30, 41, 59, 0.85) !important;
  color: #f1f5f9 !important;
  border-color: rgba(255, 255, 255, 0.12) !important;
}

body.dark-mode input:focus {
  background-color: rgba(30, 41, 59, 1) !important;
  border-color: var(--primary-blue) !important;
}

body.dark-mode .settings-list,
body.dark-mode .kpi-item,
body.dark-mode .health-card,
body.dark-mode .account-hero-card,
body.dark-mode .card {
  background: rgba(15, 23, 42, 0.75) !important;
  border-color: rgba(255, 255, 255, 0.08) !important;
}

body.dark-mode .settings-item:hover {
  background: rgba(30, 41, 59, 0.8) !important;
}

body.dark-mode .btn-secondary,
body.dark-mode .quick-pill-btn,
body.dark-mode .btn-preset {
  background: rgba(30, 41, 59, 0.75) !important;
  color: #f1f5f9 !important;
  border-color: rgba(255, 255, 255, 0.08) !important;
}

body.dark-mode .btn-secondary:hover {
  background: rgba(51, 65, 85, 0.9) !important;
  color: #ffffff !important;
}

/* ================= GLOBAL RESPONSIVE LAYOUT (DESKTOP EXPANDED) ================= */
*, *::before, *::after {
  box-sizing: border-box !important;
  min-width: 0 !important;
  margin: 0;
  padding: 0;
  font-family: 'Plus Jakarta Sans', -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
}

html, body {
  width: 100% !important;
  max-width: 100vw !important;
  overflow-x: hidden !important;
  touch-action: manipulation;
}

body {
  min-height: 100vh;
  color: var(--text-main);
  background-color: var(--bg-app);
  background-attachment: fixed;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 5.5rem;
  padding-bottom: 7.5rem;
  padding-left: 1.5rem;
  padding-right: 1.5rem;
}

.app-layout {
  width: 100%;
  max-width: 1280px; /* Luas desktop profesional */
  margin: 0 auto;
  display: flex;
  flex-direction: column;
}

/* ================= FIXED TOP HEADER ================= */
.app-fixed-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 68px;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: var(--blur-glass);
  -webkit-backdrop-filter: var(--blur-glass);
  border-bottom: 1px solid var(--glass-stroke);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 2rem;
  box-shadow: 0 4px 24px -4px rgba(70, 85, 130, 0.08);
}

.header-inner {
  width: 100%;
  max-width: 1280px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.brand-logo-locked {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  user-select: none;
}

.brand-logo-locked .logo-text {
  font-size: 1.45rem;
  font-weight: 900;
  letter-spacing: 2px;
  background: linear-gradient(135deg, #1e1b4b 0%, #4338ca 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

body.dark-mode .brand-logo-locked .logo-text {
  background: linear-gradient(135deg, #818cf8 0%, #c084fc 100%) !important;
  -webkit-background-clip: text !important;
  -webkit-text-fill-color: transparent !important;
}

.brand-logo-locked .logo-badge {
  font-size: 0.65rem;
  font-weight: 800;
  background: #ede9fe;
  color: #5b21b6;
  padding: 0.15rem 0.5rem;
  border-radius: 6px;
}

.mini-user-pill { cursor: pointer; display: flex; align-items: center; }
.avatar-mini {
  width: 38px; height: 38px; border-radius: 50%;
  background: var(--gradient-ring); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 0.9rem;
  box-shadow: 0 4px 12px rgba(121, 40, 202, 0.25);
  background-size: cover; background-position: center;
  border: 2px solid #ffffff;
}

/* ================= DESKTOP VIEW TABS ================= */
.page-view-container { display: none; width: 100%; animation: viewFade 0.22s ease-out forwards; }
.page-view-container.active-view { display: block; }
@keyframes viewFade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

.desktop-view-tabs {
  display: flex; align-items: center;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid var(--glass-stroke);
  padding: 0.3rem; border-radius: var(--radius-pill); gap: 0.35rem;
}

.btn-tab-switch {
  background: transparent; border: none; cursor: pointer;
  font-weight: 700; font-size: 0.85rem; color: var(--text-muted);
  padding: 0.5rem 1.25rem; border-radius: var(--radius-pill);
  display: inline-flex; align-items: center; gap: 0.45rem; transition: all 0.2s ease;
}
.btn-tab-switch:hover { color: var(--text-main); }
.btn-tab-switch.active {
  background: #ffffff; color: var(--primary-blue);
  box-shadow: 0 4px 14px rgba(70, 85, 130, 0.14);
}

body.dark-mode .desktop-view-tabs,
body.dark-mode .btn-tab-switch.active {
  background: rgba(30, 41, 59, 0.95) !important;
  color: #f1f5f9 !important;
}

/* ================= 2-COLUMN MAIN CONTENT (WIDE SCREEN) ================= */
.main-content {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.6rem;
  width: 100%;
}

@media (min-width: 960px) {
  .main-content {
    grid-template-columns: 440px 1fr;
    align-items: start;
  }
}

.pc-sidebar, .pc-main-column {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  width: 100%;
}

/* ================= 3D CARD ================= */
.card-3d-wrapper { perspective: 1000px; width: 100%; margin-bottom: 0.5rem; }
.card-3d-surface {
  width: 100%; height: 220px; border-radius: 26px;
  background: var(--gradient-3d-card); position: relative; overflow: hidden;
  padding: 1.5rem 1.65rem; display: flex; flex-direction: column; justify-content: space-between;
  box-shadow: 0 24px 48px -12px rgba(79, 70, 229, 0.45), 0 12px 24px -6px rgba(124, 58, 237, 0.3);
  color: #ffffff; user-select: none;
}
.card-3d-top { display: flex; justify-content: space-between; align-items: center; }
.card-chip-3d {
  width: 44px; height: 32px; background: linear-gradient(135deg, #ffd700 0%, #d4af37 100%);
  border-radius: 6px; box-shadow: inset 0 1px 2px rgba(255, 255, 255, 0.8), 0 2px 4px rgba(0, 0, 0, 0.15);
}
.btn-card-privacy {
  background: rgba(255, 255, 255, 0.2); border: 1px solid rgba(255, 255, 255, 0.35);
  color: #ffffff; width: 32px; height: 32px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
}
.card-3d-brand { text-align: right; }
.card-3d-brand span { font-size: 1.25rem; font-weight: 900; letter-spacing: 2px; display: block; }
.card-type-tag { font-size: 0.65rem; font-weight: 700; letter-spacing: 1px; opacity: 0.85; text-transform: uppercase; }
.card-3d-middle { margin: 0.35rem 0; }
.card-3d-label { font-size: 0.74rem; opacity: 0.85; font-weight: 600; text-transform: uppercase; }
.card-3d-balance { font-size: 2.3rem; font-weight: 800; letter-spacing: -1px; text-shadow: 0 2px 8px rgba(0, 0, 0, 0.2); }
.card-3d-bottom { display: flex; justify-content: space-between; align-items: flex-end; }
.card-meta-title { display: block; font-size: 0.6rem; font-weight: 700; opacity: 0.8; letter-spacing: 0.8px; }
.card-meta-value { font-size: 0.86rem; font-weight: 800; font-family: 'JetBrains Mono', monospace; }

/* Quick Actions */
.quick-actions-bar { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.55rem; margin-bottom: 0.5rem; }
.quick-pill-btn {
  background: rgba(255, 255, 255, 0.82); border: 1px solid var(--glass-stroke);
  border-radius: var(--radius-sm); padding: 0.75rem 0.4rem; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 0.25rem; font-size: 0.7rem; font-weight: 700;
  color: var(--text-main); cursor: pointer; box-shadow: var(--shadow-pill); transition: all 0.15s;
}
.quick-pill-btn:hover { background: #ffffff; color: var(--primary-blue); transform: translateY(-2px); }

.wallet-switcher-card { padding: 1.15rem 1.4rem; }
.wallet-select-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.55rem; font-size: 0.76rem; font-weight: 700; color: var(--text-muted); }
.wallet-action-links { display: flex; gap: 0.75rem; }

/* ================= CARDS & KPIS ================= */
.card {
  background: var(--glass-card); backdrop-filter: var(--blur-glass);
  border: 1px solid var(--glass-stroke); border-radius: var(--radius-lg); padding: 1.85rem;
  box-shadow: var(--shadow-glass), var(--glass-inner-light); width: 100%;
}
.card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.25rem; width: 100%; }
.card-header h3 { font-size: 1.15rem; font-weight: 800; }
.section-sub { font-size: 0.82rem; color: var(--text-muted); margin-top: 0.15rem; }

.health-metrics-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; width: 100%; }
.health-card {
  background: var(--glass-card); border: 1.5px solid var(--glass-stroke);
  border-radius: 22px; padding: 1.2rem 1.35rem; box-shadow: var(--shadow-glass), var(--glass-inner-light);
  display: flex; flex-direction: column; justify-content: space-between;
}
.health-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.4rem; }
.health-tag { font-size: 0.68rem; font-weight: 800; letter-spacing: 0.6px; color: var(--text-muted); }
.health-icon-badge { width: 28px; height: 28px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 0.85rem; }
.health-value { font-size: 1.4rem; font-weight: 800; letter-spacing: -0.5px; color: var(--text-main); margin-bottom: 0.2rem; }
.health-sub { font-size: 0.76rem; color: var(--text-muted); font-weight: 600; }

.kpi-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; width: 100%; }
.kpi-item {
  display: flex; align-items: center; gap: 0.85rem; padding: 1.1rem 1.35rem;
  border-radius: var(--radius-sm); background: rgba(255, 255, 255, 0.8); border: 1px solid var(--glass-stroke);
}
.kpi-icon { width: 42px; height: 42px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.kpi-income .kpi-icon { background: var(--income-bg); color: var(--income-green); }
.kpi-income .kpi-val { color: var(--income-green); }
.kpi-expense .kpi-icon { background: var(--expense-bg); color: var(--expense-red); }
.kpi-expense .kpi-val { color: var(--expense-red); }
.kpi-label { display: block; font-size: 0.74rem; color: var(--text-muted); font-weight: 600; }
.kpi-val { font-size: 1.15rem; font-weight: 800; display: block; }

.budget-card { padding: 1.35rem 1.6rem; }
.budget-container { width: 100%; }
.budget-labels { display: flex; justify-content: space-between; font-size: 0.82rem; font-weight: 700; color: var(--text-muted); margin-bottom: 0.6rem; }
.progress-track { width: 100%; height: 9px; background: rgba(0, 0, 0, 0.05); border-radius: 100px; overflow: hidden; }
body.dark-mode .progress-track { background: rgba(255, 255, 255, 0.08) !important; }
.progress-bar { height: 100%; width: 0%; background: var(--gradient-3d-card); border-radius: 100px; transition: width 0.4s ease; }

.chart-type-selector { display: flex; align-items: center; background: rgba(255, 255, 255, 0.75); border: 1px solid var(--glass-stroke); padding: 0.25rem; border-radius: var(--radius-pill); gap: 0.25rem; }
body.dark-mode .chart-type-selector { background: rgba(30, 41, 59, 0.8) !important; }
.btn-chart-type { background: transparent; border: none; font-size: 0.76rem; font-weight: 700; color: var(--text-muted); padding: 0.4rem 0.75rem; border-radius: var(--radius-pill); cursor: pointer; }
.btn-chart-type.active { background: #ffffff; color: var(--primary-blue); box-shadow: 0 2px 8px rgba(70, 85, 130, 0.12); }
body.dark-mode .btn-chart-type.active { background: rgba(51, 65, 85, 1) !important; color: #818cf8 !important; }
.chart-wrapper { position: relative; height: 260px; width: 100%; display: flex; justify-content: center; }

/* ================= FORMS & PRESETS ================= */
.form-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 0.95rem; margin-bottom: 1.25rem; width: 100%; }
.col-span-2 { grid-column: span 2; }
.input-group { display: flex; flex-direction: column; gap: 0.45rem; text-align: left; width: 100%; }
.input-group label { font-size: 0.78rem; font-weight: 700; color: var(--text-muted); }

input {
  background-color: rgba(255, 255, 255, 0.75); border: 1.5px solid var(--glass-stroke);
  color: var(--text-main); padding: 0.85rem 1.15rem; border-radius: var(--radius-sm); font-size: 0.92rem; font-weight: 600; outline: none; width: 100%;
}
input:focus { background-color: #ffffff; border-color: var(--primary-blue); box-shadow: 0 0 0 3px var(--primary-glow); }

.amount-presets-row { display: flex; gap: 0.4rem; margin-top: 0.45rem; overflow-x: auto; padding-bottom: 0.15rem; }
.btn-preset {
  background: rgba(255, 255, 255, 0.85); border: 1px solid var(--glass-stroke); border-radius: var(--radius-pill);
  padding: 0.35rem 0.75rem; font-size: 0.74rem; font-weight: 800; color: var(--primary-blue); cursor: pointer; white-space: nowrap;
}
body.dark-mode .btn-preset { color: #818cf8 !important; }
.btn-preset:hover { background: var(--primary-blue); color: #ffffff; }

.checkbox-container-custom { display: flex !important; align-items: center; gap: 0.55rem; cursor: pointer; user-select: none; }
.checkbox-container-custom input { display: none; }
.checkbox-checkmark {
  width: 20px; height: 20px; border-radius: 6px; border: 1.5px solid var(--glass-stroke);
  background: rgba(255, 255, 255, 0.8); display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
}
body.dark-mode .checkbox-checkmark { background: rgba(30, 41, 59, 0.9) !important; }
.checkbox-container-custom input:checked + .checkbox-checkmark { background: var(--primary-blue); border-color: var(--primary-blue); }
.checkbox-container-custom input:checked + .checkbox-checkmark::after { content: '✓'; color: #fff; font-size: 0.75rem; font-weight: 800; }

.ocr-status { display: flex; align-items: center; gap: 0.65rem; background: rgba(79, 70, 229, 0.08); border: 1px solid rgba(79, 70, 229, 0.15); padding: 0.75rem 1rem; border-radius: var(--radius-sm); font-size: 0.8rem; font-weight: 700; color: var(--primary-blue); margin-bottom: 1rem; width: 100%; }
.spinner { width: 16px; height: 16px; border: 2px solid var(--primary-blue); border-top-color: transparent; border-radius: 50%; animation: spin 0.8s linear infinite; flex-shrink: 0; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ================= FULLSCREEN PORTAL MODAL DROPDOWNS ================= */
.custom-select-trigger {
  display: flex; align-items: center; justify-content: space-between; gap: 0.5rem;
  background-color: rgba(255, 255, 255, 0.85); backdrop-filter: blur(14px);
  border: 1.5px solid var(--glass-stroke); color: var(--text-main);
  padding: 0.75rem 1.15rem; border-radius: var(--radius-sm); font-size: 0.88rem; font-weight: 700;
  cursor: pointer; width: 100%; box-shadow: 0 2px 6px rgba(70, 85, 130, 0.04);
}
body.dark-mode .custom-select-trigger {
  background-color: rgba(30, 41, 59, 0.9) !important;
  color: #f1f5f9 !important;
  border-color: rgba(255, 255, 255, 0.12) !important;
}
.custom-select-trigger .chevron-icon { width: 14px; height: 14px; color: var(--text-muted); flex-shrink: 0; }

.custom-dropdown-portal {
  position: fixed !important; inset: 0 !important; width: 100vw !important; height: 100vh !important;
  background: rgba(12, 15, 36, 0.45) !important; backdrop-filter: blur(8px) !important;
  -webkit-backdrop-filter: blur(8px) !important; z-index: 999999 !important;
  display: flex !important; align-items: center !important; justify-content: center !important;
  padding: 1.25rem !important; opacity: 0; visibility: hidden; transition: opacity 0.2s ease, visibility 0.2s ease;
}
.custom-dropdown-portal.active { opacity: 1 !important; visibility: visible !important; }

.custom-dropdown-modal-box {
  background: #ffffff !important; border: 1.5px solid rgba(255, 255, 255, 0.95) !important;
  border-radius: 24px !important; width: 100% !important; max-width: 360px !important;
  max-height: 70vh !important; overflow-y: auto !important; padding: 1.1rem !important;
  display: flex !important; flex-direction: column !important; gap: 0.35rem !important;
  box-shadow: 0 24px 60px rgba(12, 15, 36, 0.3) !important; transform: scale(0.95); transition: transform 0.2s;
}
body.dark-mode .custom-dropdown-modal-box {
  background: #111827 !important; border-color: rgba(255, 255, 255, 0.12) !important; box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6) !important;
}
.custom-dropdown-portal.active .custom-dropdown-modal-box { transform: scale(1) !important; }

.custom-modal-option {
  padding: 0.9rem 1.1rem; font-size: 0.92rem; font-weight: 700; color: var(--text-main);
  border-radius: 14px; cursor: pointer; display: flex; align-items: center; justify-content: space-between;
}
body.dark-mode .custom-modal-option { color: #f1f5f9 !important; }
.custom-modal-option:hover { background: rgba(79, 70, 229, 0.08); color: var(--primary-blue); }
body.dark-mode .custom-modal-option:hover { background: rgba(129, 140, 248, 0.15) !important; color: #818cf8 !important; }
.custom-modal-option.selected { background: var(--primary-blue) !important; color: #ffffff !important; }

/* ================= CALENDAR ================= */
.calendar-nav-controls { display: flex; align-items: center; gap: 0.5rem; }
.calendar-current-label { font-size: 0.86rem; font-weight: 800; color: var(--text-main); min-width: 100px; text-align: center; }
.calendar-grid-wrapper { margin-top: 1rem; background: rgba(255, 255, 255, 0.5); border: 1px solid var(--glass-stroke); border-radius: var(--radius-sm); padding: 1rem; }
body.dark-mode .calendar-grid-wrapper { background: rgba(30, 41, 59, 0.4) !important; }
.calendar-days-header { display: grid; grid-template-columns: repeat(7, 1fr); text-align: center; font-size: 0.74rem; font-weight: 800; color: var(--text-muted); margin-bottom: 0.65rem; }
.calendar-dates-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 0.45rem; }
.cal-cell { background: rgba(255, 255, 255, 0.7); border: 1px solid var(--glass-stroke); border-radius: 14px; min-height: 64px; padding: 0.45rem; display: flex; flex-direction: column; justify-content: space-between; cursor: pointer; }
body.dark-mode .cal-cell { background: rgba(30, 41, 59, 0.7) !important; }
.cal-cell:hover { background: #ffffff; border-color: var(--primary-blue); }
body.dark-mode .cal-cell:hover { background: rgba(51, 65, 85, 0.9) !important; }
.cal-cell.empty { background: transparent; border-color: transparent; cursor: default; }
.cal-cell.has-expense { border-color: rgba(244, 63, 94, 0.3); }
.cal-cell.active-selected { border-color: var(--primary-blue); background: #ffffff; box-shadow: 0 0 0 2px var(--primary-blue); }
.cal-date-num { font-size: 0.8rem; font-weight: 800; color: var(--text-main); }
.cal-expense-tag { font-size: 0.65rem; font-weight: 800; color: var(--expense-red); text-align: right; }
.calendar-day-detail-box { background: rgba(255, 255, 255, 0.8); border: 1px solid var(--glass-stroke); border-radius: var(--radius-sm); padding: 1.2rem; }
body.dark-mode .calendar-day-detail-box { background: rgba(20, 29, 48, 0.9) !important; }

/* ================= ACCOUNT SETTINGS TILES ================= */
.account-container { max-width: 560px !important; margin: 0 auto; width: 100%; display: flex; flex-direction: column; gap: 1.35rem; }
.account-hero-card {
  background: var(--glass-card); border: 1.5px solid var(--glass-stroke); border-radius: 28px; padding: 1.75rem;
  display: flex; align-items: center; gap: 1.35rem; box-shadow: var(--shadow-glass), var(--glass-inner-light);
}
.avatar-hero {
  width: 68px; height: 68px; border-radius: 50%; background: var(--gradient-ring); color: #ffffff;
  display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 1.75rem;
  background-size: cover; background-position: center; border: 3px solid #ffffff; flex-shrink: 0;
}
.account-hero-info h3 { font-size: 1.25rem; font-weight: 800; color: var(--text-main); margin-bottom: 0.15rem; }
.account-hero-info span { font-size: 0.85rem; color: var(--text-muted); font-weight: 600; display: block; }
.status-chip {
  display: inline-flex; align-items: center; gap: 0.35rem; background: rgba(16, 185, 129, 0.1);
  color: var(--income-green); font-size: 0.72rem; font-weight: 700; padding: 0.22rem 0.65rem; border-radius: 100px; margin-top: 0.45rem;
}

.settings-group { display: flex; flex-direction: column; gap: 0.5rem; }
.settings-group-title { font-size: 0.72rem; font-weight: 800; color: var(--text-muted); letter-spacing: 0.8px; padding-left: 0.6rem; text-transform: uppercase; }
.settings-list {
  background: rgba(255, 255, 255, 0.78); border: 1.5px solid var(--glass-stroke); border-radius: 24px; overflow: hidden;
  box-shadow: var(--shadow-glass), var(--glass-inner-light);
}
body.dark-mode .settings-list { background: rgba(17, 24, 39, 0.8) !important; border-color: rgba(255, 255, 255, 0.08) !important; }

.settings-item {
  display: flex; align-items: center; justify-content: space-between; padding: 1.05rem 1.35rem;
  cursor: pointer; border-bottom: 1px solid rgba(0, 0, 0, 0.04);
}
body.dark-mode .settings-item { border-bottom-color: rgba(255, 255, 255, 0.05) !important; }
.settings-item:last-child { border-bottom: none; }
.settings-item:hover { background: rgba(255, 255, 255, 0.95); }
body.dark-mode .settings-item:hover { background: rgba(30, 41, 59, 0.75) !important; }
.settings-item-left { display: flex; align-items: center; gap: 0.95rem; }
.settings-label { font-size: 0.92rem; font-weight: 700; color: var(--text-main); }
.settings-icon-badge { width: 38px; height: 38px; border-radius: 12px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.icon-purple { background: rgba(124, 58, 237, 0.12); color: #7c3aed; }
.icon-blue { background: rgba(37, 99, 235, 0.12); color: #2563eb; }
.icon-indigo { background: rgba(79, 70, 229, 0.12); color: #4f46e5; }
.icon-red { background: rgba(244, 63, 94, 0.12); color: var(--expense-red); }
.settings-arrow { color: var(--text-subtle); }
.account-footer-ver { text-align: center; font-size: 0.74rem; font-weight: 700; color: var(--text-subtle); margin-top: 0.5rem; }

/* iOS Toggle Switch */
.ios-switch { position: relative; display: inline-block; width: 46px; height: 26px; }
.ios-switch input { opacity: 0; width: 0; height: 0; }
.ios-slider { position: absolute; cursor: pointer; inset: 0; background: #cbd5e1; transition: 0.3s; border-radius: 24px; }
body.dark-mode .ios-slider { background: rgba(255,255,255,0.2); }
.ios-slider::before { position: absolute; content: ""; height: 20px; width: 20px; left: 3px; bottom: 3px; background-color: white; transition: 0.3s; border-radius: 50%; }
.ios-switch input:checked + .ios-slider { background-color: var(--primary-blue); }
.ios-switch input:checked + .ios-slider::before { transform: translateX(20px); }

/* Buttons & Toolbar */
.btn { border: none; cursor: pointer; border-radius: var(--radius-pill); font-weight: 700; font-size: 0.9rem; padding: 0.8rem 1.4rem; display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem; }
.btn-primary { background: #0c0f24; color: #ffffff; box-shadow: 0 6px 18px rgba(12, 15, 36, 0.18); }
body.dark-mode .btn-primary { background: #4f46e5 !important; color: #ffffff !important; }
.btn-primary:hover { background: #1e1b4b; }
.btn-secondary { background: rgba(255, 255, 255, 0.85); border: 1px solid var(--glass-stroke); color: var(--text-main); }
.btn-ghost { background: transparent; color: var(--text-muted); }
.btn-sm { padding: 0.55rem 1.05rem; font-size: 0.82rem; }
.btn-xs { padding: 0.4rem 0.8rem; font-size: 0.76rem; }
.btn-block { width: 100%; padding: 1rem; border-radius: var(--radius-sm); }
.link-btn { background: transparent; border: none; color: var(--primary-blue); font-weight: 800; cursor: pointer; }

.toolbar-grid { display: grid; grid-template-columns: 1fr auto; gap: 1rem; width: 100%; }
.filter-card { display: flex; align-items: center; justify-content: space-between; padding: 0.95rem 1.6rem; width: 100%; }
.filter-card label { font-size: 0.86rem; font-weight: 700; color: var(--text-muted); }
.ledger-filter-bar { display: grid; grid-template-columns: 1fr auto; gap: 0.85rem; margin-bottom: 1.35rem; width: 100%; }
.search-input-wrap { display: flex; align-items: center; gap: 0.75rem; background: rgba(255, 255, 255, 0.65); border: 1px solid var(--glass-stroke); padding: 0.7rem 1.15rem; border-radius: var(--radius-pill); width: 100%; }
body.dark-mode .search-input-wrap { background: rgba(30, 41, 59, 0.8) !important; }
.search-input-wrap input { background: transparent; border: none; padding: 0; font-size: 0.9rem; box-shadow: none; width: 100%; }

/* Ledger List */
.tx-ledger-list { display: flex; flex-direction: column; gap: 0.75rem; max-height: 560px; overflow-y: auto; padding-right: 0.25rem; width: 100%; }
.tx-row {
  background: rgba(255, 255, 255, 0.65); border: 1px solid var(--glass-stroke); border-radius: var(--radius-sm);
  padding: 1rem 1.25rem; display: flex !important; justify-content: space-between !important; align-items: center !important; width: 100% !important; gap: 0.75rem !important;
}
.tx-row:hover { background: #ffffff; box-shadow: var(--shadow-pill); }
body.dark-mode .tx-row { background: rgba(30, 41, 59, 0.6) !important; border-color: rgba(255,255,255,0.05) !important; }
body.dark-mode .tx-row:hover { background: rgba(30, 41, 59, 0.95) !important; }

.tx-main-info { display: flex !important; align-items: center !important; gap: 0.85rem !important; flex: 1 1 auto !important; max-width: calc(100% - 140px) !important; overflow: hidden !important; }
.tx-icon-pill { width: 44px; height: 44px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.tx-desc { font-weight: 800; font-size: 0.96rem; color: var(--text-main); white-space: nowrap !important; overflow: hidden !important; text-overflow: ellipsis !important; }
.tx-subtext { font-size: 0.78rem; color: var(--text-muted); display: flex !important; flex-wrap: wrap !important; gap: 0.35rem !important; align-items: center; margin-top: 0.2rem; }
.tx-recurring-tag { background: rgba(79, 70, 229, 0.1); color: var(--primary-blue); padding: 0.18rem 0.5rem; border-radius: 6px; font-weight: 800; font-size: 0.7rem; }
.tx-amount-col { flex: 0 0 auto !important; display: flex !important; align-items: center !important; gap: 0.35rem !important; text-align: right !important; }
.tx-val { font-weight: 800; font-size: 1.1rem; white-space: nowrap !important; }
.tx-val.income { color: var(--income-green); }
.tx-val.expense { color: var(--expense-red); }

.btn-tx-action { background: none; border: none; color: var(--text-subtle); cursor: pointer; padding: 0.3rem; border-radius: 6px; display: inline-flex; align-items: center; justify-content: center; }
.btn-tx-action:hover { color: var(--primary-blue); background: rgba(79, 70, 229, 0.1); }
.btn-tx-del:hover { color: var(--expense-red) !important; background: rgba(244, 63, 94, 0.1) !important; }

/* Modals & Overlay */
.modal-overlay { position: fixed; inset: 0; background: rgba(12, 15, 36, 0.5); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); z-index: 120; display: flex; align-items: center; justify-content: center; padding: 1rem; opacity: 0; visibility: hidden; transition: all 0.2s; }
.modal-overlay.active { opacity: 1; visibility: visible; }
.modal-box { background: var(--glass-elevated); border: 1.5px solid var(--glass-stroke); border-radius: var(--radius-lg); padding: 2.5rem 2.2rem; width: 100%; max-width: 440px; box-shadow: var(--shadow-glass); }
.modal-actions { display: flex; justify-content: flex-end; gap: 0.5rem; }

.avatar-picker-wrap { display: flex; align-items: center; gap: 1.25rem; margin: 1.5rem 0 0.5rem; padding: 1rem; background: rgba(255, 255, 255, 0.7); border: 1px solid var(--glass-stroke); border-radius: var(--radius-sm); width: 100%; }
body.dark-mode .avatar-picker-wrap { background: rgba(30, 41, 59, 0.6) !important; border-color: rgba(255, 255, 255, 0.08) !important; }
.avatar-preview-box { width: 64px; height: 64px; border-radius: 50%; background: var(--gradient-ring); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 1.5rem; background-size: cover; background-position: center; border: 2px solid #fff; box-shadow: 0 4px 14px rgba(121, 40, 202, 0.2); flex-shrink: 0; }

/* ================= CHUNKY FLOATING MOBILE BOTTOM BAR & ELEVATED FAB ================= */
.mobile-bottom-bar {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  width: auto !important;
  min-width: 320px;
  max-width: 380px;
  height: 68px;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(32px) saturate(210%);
  -webkit-backdrop-filter: blur(32px) saturate(210%);
  border: 1.5px solid rgba(255, 255, 255, 0.95);
  border-radius: var(--radius-pill);
  padding: 0 0.75rem;
  display: flex;
  justify-content: space-around;
  align-items: center;
  gap: 0.25rem;
  box-shadow: 0 24px 48px -12px rgba(70, 85, 130, 0.25), 0 8px 20px -4px rgba(70, 85, 130, 0.12), var(--glass-inner-light);
  z-index: 90;
}

body.dark-mode .mobile-bottom-bar {
  background: rgba(15, 23, 42, 0.9) !important;
  border-color: rgba(255, 255, 255, 0.12) !important;
  box-shadow: 0 24px 48px -12px rgba(0, 0, 0, 0.6) !important;
}

.nav-tab-item {
  background: transparent;
  border: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.15rem;
  cursor: pointer;
  color: var(--text-muted);
  padding: 0.4rem 0.55rem;
  border-radius: 16px;
  min-width: 52px;
  height: 52px;
  transition: all 0.2s ease;
}

.nav-tab-item span { font-size: 0.65rem; font-weight: 700; }
.nav-tab-item.active { color: var(--primary-blue); }
body.dark-mode .nav-tab-item.active { color: #818cf8 !important; }
.nav-tab-icon { display: flex; align-items: center; justify-content: center; width: 22px; height: 22px; }

/* ELEVATED PROTRUDING FAB BUTTON (+) */
.nav-tab-fab {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
  color: #ffffff;
  border: 3.5px solid #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transform: translateY(-16px); /* Naik ke atas menonjol keluar bar */
  box-shadow: 0 12px 28px rgba(79, 70, 229, 0.45);
  margin: 0 0.25rem;
  flex-shrink: 0;
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s ease;
}

.nav-tab-fab:hover {
  transform: translateY(-19px) scale(1.04);
  box-shadow: 0 16px 32px rgba(79, 70, 229, 0.55);
}

.nav-tab-fab:active {
  transform: translateY(-13px) scale(0.96);
}

body.dark-mode .nav-tab-fab {
  background: linear-gradient(135deg, #6366f1 0%, #9333ea 100%) !important;
  color: #ffffff !important;
  border-color: #0f172a !important; /* Border menyatu dengan bar dark mode */
  box-shadow: 0 12px 28px rgba(99, 102, 241, 0.45) !important;
}

/* Toast */
.toast-wrapper { position: fixed; top: 1.5rem; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 0.5rem; pointer-events: none; }
.toast { background: #0c0f24; color: #ffffff; font-size: 0.84rem; font-weight: 700; padding: 0.75rem 1.4rem; border-radius: var(--radius-pill); box-shadow: 0 12px 28px rgba(12, 15, 36, 0.2); }

/* PWA Banner */
.pwa-install-banner {
  position: fixed; top: 5.2rem; left: 50%; transform: translateX(-50%); width: calc(100% - 2.5rem); max-width: 460px;
  background: rgba(255, 255, 255, 0.88); backdrop-filter: blur(28px) saturate(200%); border: 1.5px solid rgba(255, 255, 255, 0.95);
  border-radius: var(--radius-md); padding: 0.95rem 1.25rem; display: flex; justify-content: space-between; align-items: center; gap: 0.85rem;
  box-shadow: 0 20px 45px -10px rgba(70, 85, 130, 0.22); z-index: 95; animation: slideDownBanner 0.35s forwards;
}
body.dark-mode .pwa-install-banner { background: rgba(15, 23, 42, 0.95) !important; border-color: rgba(255, 255, 255, 0.15) !important; }
@keyframes slideDownBanner { from { opacity: 0; transform: translate(-50%, -15px) scale(0.96); } to { opacity: 1; transform: translate(-50%, 0) scale(1); } }
.pwa-app-icon { width: 42px; height: 42px; border-radius: 12px; background: var(--gradient-3d-card); color: #ffffff; font-weight: 900; font-size: 0.8rem; display: flex; align-items: center; justify-content: center; }
.pwa-banner-text strong { display: block; font-size: 0.86rem; font-weight: 800; color: var(--text-main); }
.pwa-banner-text span { font-size: 0.72rem; color: var(--text-muted); font-weight: 600; display: block; }
.pwa-banner-actions { display: flex; align-items: center; gap: 0.4rem; }

/* ================= RESPONSIVE MOBILE ADAPTATIONS ================= */
@media (max-width: 959px) {
  body { padding-top: 5rem !important; padding-left: 0.85rem !important; padding-right: 0.85rem !important; padding-bottom: 7.8rem !important; }
  .desktop-view-tabs { display: none !important; }
  .card { padding: 1.35rem 1.15rem !important; }
  .card-3d-surface { height: 200px !important; padding: 1.25rem 1.35rem !important; }
  .card-3d-balance { font-size: 1.95rem !important; }
  .kpi-grid { grid-template-columns: 1fr 1fr !important; gap: 0.75rem !important; }
  .health-metrics-grid { gap: 0.75rem !important; }
  .form-layout { grid-template-columns: 1fr !important; }
  .col-span-2 { grid-column: span 1 !important; }
  .toolbar-grid, .ledger-filter-bar { grid-template-columns: 1fr !important; }
  .filter-card { flex-direction: column; align-items: stretch !important; gap: 0.6rem; }
  .pwa-install-banner { top: 4.6rem; width: calc(100% - 1.5rem); padding: 0.85rem 1rem; }
}

@media (min-width: 960px) {
  .mobile-bottom-bar { display: none !important; }
}

@media print {
  body { background: #fff !important; color: #000 !important; padding: 0 !important; margin: 0 !important; }
  @page { size: A4 portrait; margin: 15mm 12mm; }
  .app-fixed-header, #guest-banner, #auth-view, #app-view, .toast-wrapper, .modal-overlay, .pwa-install-banner { display: none !important; }
  #print-report-sheet { display: block !important; width: 100% !important; }
  
  .print-header { display: flex; justify-content: space-between; align-items: flex-start; border-bottom: 2px solid #111827; padding-bottom: 12px; margin-bottom: 16px; }
  .print-logo-text { font-size: 26pt; font-weight: 900; letter-spacing: 2px; color: #111827; }
  .print-company-desc { font-size: 9pt; color: #4b5563; font-weight: 600; }
  .print-meta { text-align: right; }
  .print-meta h2 { font-size: 14pt; font-weight: 800; margin-bottom: 4px; letter-spacing: 0.5px; }
  .print-meta div { font-size: 9pt; color: #374151; }
  
  .print-summary-box { display: flex; border: 1px solid #e5e7eb; background: #f9fafb; border-radius: 6px; margin-bottom: 20px; }
  .print-summary-item { flex: 1; padding: 10px 14px; border-right: 1px solid #e5e7eb; text-align: center; }
  .print-summary-item span { display: block; font-size: 7.5pt; font-weight: 700; color: #6b7280; margin-bottom: 2px; }
  .print-summary-item strong { font-size: 12pt; font-weight: 800; }
  
  .print-table { width: 100%; border-collapse: collapse; margin-bottom: 30px; font-size: 8.5pt; }
  .print-table th { background: #f3f4f6; color: #111827; border: 1px solid #d1d5db; padding: 8px 10px; font-weight: 800; text-align: left; font-size: 8pt; }
  .print-table td { border: 1px solid #e5e7eb; padding: 7px 10px; }
  .print-table tr:nth-child(even) { background: #fafafa; }
  
  .print-footer { display: flex; justify-content: space-between; margin-top: 40px; page-break-inside: avoid; }
  .print-signature-box { width: 200px; text-align: center; font-size: 8.5pt; }
  .signature-line { height: 60px; border-bottom: 1px solid #111827; margin-bottom: 6px; }
}

/* ==========================================================================
   AUTH SCREEN (CENTERED LUXURY GLASS & DARK MODE SUPPORT)
   ========================================================================== */
.auth-wrapper {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background-color: var(--bg-app);
  background-image: 
    radial-gradient(at 0% 0%, rgba(224, 218, 254, 0.75) 0px, transparent 50%),
    radial-gradient(at 100% 0%, rgba(199, 210, 254, 0.7) 0px, transparent 50%),
    radial-gradient(at 50% 50%, rgba(243, 232, 255, 0.5) 0px, transparent 60%),
    radial-gradient(at 100% 100%, rgba(254, 205, 211, 0.45) 0px, transparent 50%);
  background-attachment: fixed;
  z-index: 1000;
  overflow-y: auto;
}

body.dark-mode .auth-wrapper {
  background-color: #080c16 !important;
  background-image: 
    radial-gradient(at 0% 0%, rgba(30, 27, 75, 0.6) 0px, transparent 50%),
    radial-gradient(at 100% 0%, rgba(88, 28, 135, 0.4) 0px, transparent 50%),
    radial-gradient(at 50% 50%, rgba(8, 12, 22, 0.95) 0px, transparent 70%) !important;
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(32px) saturate(200%);
  -webkit-backdrop-filter: blur(32px) saturate(200%);
  border: 1.5px solid rgba(255, 255, 255, 0.95);
  border-radius: 28px;
  padding: 2.5rem 2.25rem;
  box-shadow: 0 24px 60px -12px rgba(70, 85, 130, 0.2), var(--glass-inner-light);
  display: flex;
  flex-direction: column;
  margin: auto;
}

body.dark-mode .auth-card {
  background: rgba(15, 23, 42, 0.92) !important;
  border-color: rgba(255, 255, 255, 0.1) !important;
  box-shadow: 0 24px 60px -12px rgba(0, 0, 0, 0.7), var(--glass-inner-light) !important;
}

.auth-header {
  text-align: center;
  margin-bottom: 1.25rem;
}

.brand-logo-main {
  font-size: 2.3rem;
  font-weight: 900;
  letter-spacing: 3px;
  background: linear-gradient(135deg, #1e1b4b 0%, #4338ca 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  display: inline-block;
  text-transform: uppercase;
}

body.dark-mode .brand-logo-main {
  background: linear-gradient(135deg, #818cf8 0%, #c084fc 100%) !important;
  -webkit-background-clip: text !important;
  -webkit-text-fill-color: transparent !important;
}

.brand-tagline {
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.6px;
  text-transform: uppercase;
  margin-top: 0.25rem;
}

.auth-text-group {
  text-align: center;
  margin-bottom: 1.75rem;
}

.auth-text-group h1 {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.4px;
  color: var(--text-main);
  margin-bottom: 0.35rem;
}

.auth-subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 600;
  line-height: 1.45;
}

.auth-form-body {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
  width: 100%;
}

.auth-form-body .input-group {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  text-align: left;
}

.auth-form-body .input-group label {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-muted);
}

.auth-form-body input {
  width: 100%;
  background: rgba(255, 255, 255, 0.9);
  border: 1.5px solid var(--glass-stroke);
  padding: 0.9rem 1.15rem;
  border-radius: var(--radius-sm);
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text-main);
  transition: all 0.2s ease;
}

body.dark-mode .auth-form-body input {
  background: rgba(30, 41, 59, 0.85) !important;
  border-color: rgba(255, 255, 255, 0.12) !important;
  color: #f1f5f9 !important;
}

.auth-form-body input:focus {
  background: #ffffff;
  border-color: var(--primary-blue);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

body.dark-mode .auth-form-body input:focus {
  background: rgba(30, 41, 59, 1) !important;
  border-color: var(--primary-blue) !important;
}

.btn-auth-submit {
  height: 50px;
  border-radius: var(--radius-sm);
  margin-top: 0.5rem;
  font-size: 0.95rem;
  font-weight: 800;
  gap: 0.55rem;
  background: #0c0f24;
  color: #ffffff;
}

body.dark-mode .btn-auth-submit {
  background: var(--primary-blue) !important;
  color: #ffffff !important;
  box-shadow: 0 6px 20px rgba(79, 70, 229, 0.4) !important;
}

.btn-auth-submit:hover {
  background: #1e1b4b;
}

body.dark-mode .btn-auth-submit:hover {
  background: #4338ca !important;
}

.auth-footer {
  margin-top: 1.75rem;
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 600;
}

.auth-footer .link-btn {
  margin-left: 0.35rem;
  color: var(--primary-blue);
  font-weight: 800;
  text-decoration: none;
}

body.dark-mode .auth-footer .link-btn {
  color: #818cf8 !important;
}

.auth-footer .link-btn:hover {
  text-decoration: underline;
}

@media (max-width: 480px) {
  .auth-card {
    padding: 2rem 1.4rem;
    border-radius: 24px;
  }
}