/* ─── Calendar Enhancements ─── */
.cal-day {
  position: relative;
  min-height: 80px;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: center;
  padding: 4px;
}

.cal-day-label {
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--text-secondary);
  background: rgba(var(--accent-rgb), 0.1);
  padding: 1px 4px;
  border-radius: 4px;
  max-width: 90%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

.month-reminders-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.reminder-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  border: 1px solid rgba(210, 180, 120, 0.1);
}

.reminder-date {
  width: 45px;
  text-align: center;
  font-weight: 800;
  font-size: 0.9rem;
  color: var(--accent);
  line-height: 1.1;
}

.reminder-date span {
  display: block;
  font-size: 0.65rem;
  text-transform: uppercase;
  color: var(--text-muted);
}

.reminder-details {
  flex: 1;
}

.reminder-name {
  font-weight: 700;
  font-size: 0.9rem;
}

.reminder-amount {
  font-weight: 800;
  color: var(--red);
}

.reminder-credit {
  border-left: 3px solid #00D09C;
}

/* Update cal-dots to be more compact if we have labels */
.cal-dots {
  margin-top: auto;
  padding-bottom: 2px;
}

/* ----------   
CashFlow — Premium Dark Glass Design
────────────────────────────────────────── */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&display=swap');

/* ─── Design Tokens ─── */
:root {
  /* Surfaces */
  --bg: #0F0F1A;
  --bg-card: rgba(22, 22, 40, 0.85);
  --bg-card-hover: rgba(30, 30, 50, 0.92);
  --bg-glass: rgba(18, 18, 36, 0.88);
  --border-glass: rgba(100, 100, 180, 0.12);
  --border-subtle: rgba(80, 80, 140, 0.10);

  /* Text */
  --text-primary: #F0F0F8;
  --text-secondary: #A0A0C0;
  --text-muted: #606080;

  /* Gradients */
  --grad-green: linear-gradient(135deg, #00D09C 0%, #00B86E 100%);
  --grad-red: linear-gradient(135deg, #FF6B6B 0%, #EE4444 100%);
  --grad-blue: linear-gradient(135deg, #5C7CFA 0%, #4263EB 100%);
  --grad-purple: linear-gradient(135deg, #A855F7 0%, #7C3AED 100%);
  --grad-amber: linear-gradient(135deg, #FBBF24 0%, #F59E0B 100%);
  --grad-teal: linear-gradient(135deg, #2DD4BF 0%, #14B8A6 100%);
  --grad-hero: linear-gradient(145deg, #1A1A2E 0%, #16213E 50%, #0F3460 100%);
  --grad-fab: linear-gradient(135deg, #5C7CFA 0%, #A855F7 100%);
  --grad-safe: linear-gradient(135deg, rgba(0, 208, 156, 0.15) 0%, rgba(0, 184, 110, 0.08) 100%);
  --grad-danger: linear-gradient(135deg, rgba(255, 107, 107, 0.15) 0%, rgba(238, 68, 68, 0.08) 100%);

  /* Accent colors */
  --accent: #5C7CFA;
  --accent-rgb: 92, 124, 250;
  --accent-light: #748FFC;
  --green: #00D09C;
  --green-soft: rgba(0, 208, 156, 0.12);
  --red: #FF6B6B;
  --red-soft: rgba(255, 107, 107, 0.12);
  --amber: #FBBF24;
  --amber-soft: rgba(251, 191, 36, 0.12);
  --purple: #A855F7;
  --purple-soft: rgba(168, 85, 247, 0.12);
  --teal: #2DD4BF;

  /* Category colors */
  --cat-emi: #FF6B6B;
  --cat-sip: #5C7CFA;
  --cat-rent: #FBBF24;
  --cat-sub: #A855F7;
  --cat-bill: #2DD4BF;
  --cat-insurance: #F97316;
  --cat-loan: #EC4899;
  --cat-tax: #64748B;
  --cat-investment: #06B6D4;
  --cat-other: #94A3B8;

  /* Metrics */
  --radius-sm: 12px;
  --radius-md: 16px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.25);
  --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.35);
  --shadow-glow: 0 0 40px rgba(92, 124, 250, 0.15);
  --transition: .22s cubic-bezier(.4, 0, .2, 1);

  /* Layout */
  --header-h: 60px;
  --tab-h: 64px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --content-max: 640px;
}

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

html {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

body {
  background: var(--bg);
  color: var(--text-primary);
  min-height: 100dvh;
  overflow-x: hidden;
}

/* Animated background orbs */
body::before,
body::after {
  content: '';
  position: fixed;
  z-index: -1;
  border-radius: 50%;
  filter: blur(80px);
  pointer-events: none;
  animation: orbFloat 20s ease-in-out infinite alternate;
}

body::before {
  width: 400px;
  height: 400px;
  top: -100px;
  left: -100px;
  background: rgba(92, 124, 250, 0.08);
}

body::after {
  width: 350px;
  height: 350px;
  bottom: -80px;
  right: -80px;
  background: rgba(168, 85, 247, 0.06);
  animation-delay: -10s;
}

@keyframes orbFloat {
  0% {
    transform: translate(0, 0) scale(1);
  }

  50% {
    transform: translate(30px, 20px) scale(1.1);
  }

  100% {
    transform: translate(-20px, 40px) scale(0.95);
  }
}

a {
  color: var(--accent);
  text-decoration: none;
  touch-action: manipulation;
}

button {
  font: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
  touch-action: manipulation;
}

input,
select,
textarea {
  font: inherit;
}

/* ─── Scrollbar ─── */
::-webkit-scrollbar {
  width: 4px;
  height: 4px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--text-muted);
  border-radius: 99px;
}

/* ─── Utility ─── */
.hidden {
  display: none !important;
}

.glass-card {
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 16px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: box-shadow var(--transition), transform var(--transition), border-color var(--transition);
}

.glass-card:hover {
  border-color: rgba(100, 100, 180, 0.2);
}

.icon {
  width: 22px;
  height: 22px;
  fill: currentColor;
}

.icon-btn {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  transition: background var(--transition), transform var(--transition);
  color: var(--text-secondary);
}

.icon-btn:hover {
  background: rgba(100, 100, 180, 0.12);
  transform: scale(1.05);
}

/* ────────── Splash ────────── */
/* ────────── Login Screen ────────── */
.login-screen {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  overflow: hidden;
}

.login-screen.hidden {
  display: none;
}

.login-bg-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  pointer-events: none;
  animation: orbFloat 8s ease-in-out infinite alternate;
}

.login-orb1 {
  width: 350px;
  height: 350px;
  background: radial-gradient(circle, rgba(92, 124, 250, 0.25) 0%, transparent 70%);
  top: -80px;
  left: -80px;
}

.login-orb2 {
  width: 300px;
  height: 300px;
  background: radial-gradient(circle, rgba(168, 85, 247, 0.2) 0%, transparent 70%);
  bottom: -60px;
  right: -60px;
  animation-delay: -4s;
}

.login-card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 360px;
  margin: 24px;
  padding: 36px 32px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.login-logo {
  font-size: 2rem;
  font-weight: 900;
  letter-spacing: -0.03em;
  color: var(--text-primary);
}

.login-subtitle {
  font-size: .78rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .08em;
  margin: 0 0 28px;
}

.login-form {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.login-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.login-label {
  font-size: .78rem;
  font-weight: 700;
  color: var(--text-secondary);
}

.login-input {
  width: 100%;
  padding: 12px 16px;
  /* 16px prevents iOS Safari zoom on focus */
  font-size: 16px;
}

.login-error {
  font-size: .8rem;
  color: var(--red);
  background: var(--red-soft);
  border-radius: 8px;
  padding: 8px 12px;
  text-align: center;
  font-weight: 600;
}

.login-error.hidden {
  display: none;
}

.login-error.shake {
  animation: shake .4s ease;
}

.login-btn {
  margin-top: 4px;
  padding: 14px;
  background: var(--grad-blue);
  color: #fff;
  font-size: .95rem;
  font-weight: 700;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  transition: opacity .2s, transform .15s;
  letter-spacing: .02em;
}

.login-btn:hover {
  opacity: .9;
  transform: translateY(-1px);
}

.login-btn:active {
  transform: translateY(0);
  opacity: 1;
}

@keyframes shake {

  0%,
  100% {
    transform: translateX(0)
  }

  20% {
    transform: translateX(-8px)
  }

  40% {
    transform: translateX(8px)
  }

  60% {
    transform: translateX(-6px)
  }

  80% {
    transform: translateX(6px)
  }
}

/* ────────── Splash ────────── */
.splash {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  background: var(--bg);
  transition: opacity .5s ease, visibility .5s ease;
}

.splash.fade-out {
  opacity: 0;
  visibility: hidden;
}

.splash-ring {
  width: 56px;
  height: 56px;
  border: 3px solid rgba(92, 124, 250, 0.15);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}

.splash-logo {
  font-weight: 900;
  font-size: 1.5rem;
  color: var(--text-primary);
  letter-spacing: -0.03em;
}

.splash-accent {
  color: var(--accent);
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ────────── Header ────────── */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  /* Height expands to include the status bar / notch area */
  height: calc(var(--header-h) + env(safe-area-inset-top, 0px));
  display: flex;
  align-items: center;
  justify-content: space-between;
  /* Explicit padding — avoid shorthand overrides */
  padding-top: env(safe-area-inset-top, 0px);
  padding-left: 16px;
  padding-right: 16px;
  padding-bottom: 0;
  background: rgba(15, 15, 26, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-glass);
}

.header-left {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.logo-link {
  text-decoration: none;
  color: inherit;
  display: flex;
  align-items: baseline;
  gap: 8px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.logo {
  font-size: 1.2rem;
  font-weight: 900;
  letter-spacing: -.03em;
  color: var(--text-primary);
}

.logo-accent {
  color: var(--accent);
}

.logo-tag {
  font-size: .6rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .08em;
}

.header-right {
  display: flex;
  gap: 4px;
}

/* ────────── Tab bar ────────── */
.tab-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 100;
  /* Grow height so it extends behind the iOS home indicator */
  height: calc(var(--tab-h) + env(safe-area-inset-bottom, 0px));
  display: flex;
  align-items: center;
  justify-content: space-around;
  background: rgba(15, 15, 26, 0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--border-glass);
  /* Tabs sit at the top of the bar, safe area is below */
  padding-top: 0;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

.tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  font-size: .58rem;
  font-weight: 700;
  color: var(--text-muted);
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  transition: color var(--transition);
  position: relative;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.tab-icon {
  width: 22px;
  height: 22px;
  fill: currentColor;
  transition: transform var(--transition);
}

.tab.active {
  color: var(--accent);
}

.tab.active .tab-icon {
  transform: scale(1.15);
}

.tab.active::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  translate: -50% 0;
  width: 24px;
  height: 3px;
  border-radius: 0 0 99px 99px;
  background: var(--grad-fab);
}

/* ────────── Main content ────────── */
.main-content {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: calc(var(--header-h) + env(safe-area-inset-top, 0px) + 12px) 12px calc(var(--tab-h) + env(safe-area-inset-bottom, 0px) + 20px);
}

.view {
  display: none;
  animation: fadeUp .3s ease;
}

.view.active {
  display: block;
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ────────── Hero balance card ───────── */
.hero-card {
  background: var(--grad-hero);
  border: 1px solid rgba(92, 124, 250, 0.15);
  border-radius: var(--radius-lg);
  padding: 24px 20px 20px;
  margin-bottom: 12px;
  text-align: center;
  box-shadow: var(--shadow), var(--shadow-glow);
  position: relative;
  overflow: hidden;
}

.hero-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: radial-gradient(circle at 70% 20%, rgba(92, 124, 250, 0.1) 0%, transparent 50%),
    radial-gradient(circle at 30% 80%, rgba(168, 85, 247, 0.08) 0%, transparent 50%);
  pointer-events: none;
}

.hero-label {
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.hero-value {
  font-size: 2.2rem;
  font-weight: 900;
  letter-spacing: -.03em;
  background: linear-gradient(135deg, #F0F0F8 0%, #A0A0C0 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-sub {
  margin-top: 10px;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 14px;
  border-radius: 99px;
  font-size: .72rem;
  font-weight: 700;
}

.hero-badge.safe {
  background: var(--grad-safe);
  border: 1px solid rgba(0, 208, 156, 0.2);
  color: var(--green);
}

.hero-badge.danger {
  background: var(--grad-danger);
  border: 1px solid rgba(255, 107, 107, 0.2);
  color: var(--red);
}

.badge-icon {
  width: 14px;
  height: 14px;
  fill: currentColor;
}

/* ────────── Account scroll (dashboard) ────────── */
.account-scroll {
  margin-bottom: 12px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.account-scroll::-webkit-scrollbar {
  display: none;
}

.account-cards {
  display: flex;
  gap: 10px;
  padding: 2px;
  min-width: min-content;
}

.acc-card {
  flex: 1;
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 14px;
  box-shadow: var(--shadow);
  transition: transform var(--transition), box-shadow var(--transition);
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.acc-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.acc-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
}

.acc-card[data-color="blue"]::before {
  background: var(--grad-blue);
}

.acc-card[data-color="green"]::before {
  background: var(--grad-green);
}

.acc-card[data-color="purple"]::before {
  background: var(--grad-purple);
}

.acc-card[data-color="amber"]::before {
  background: var(--grad-amber);
}

.acc-card[data-color="teal"]::before {
  background: var(--grad-teal);
}

.acc-card[data-color="red"]::before {
  background: var(--grad-red);
}

.acc-icon {
  font-size: 1.3rem;
  margin-bottom: 6px;
}

.acc-name {
  font-size: .72rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.acc-balance {
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: -.02em;
}

.acc-predicted {
  font-size: .65rem;
  font-weight: 600;
  margin-top: 4px;
  padding: 3px 8px;
  border-radius: 6px;
  display: inline-block;
}

.acc-predicted.safe {
  background: var(--green-soft);
  color: var(--green);
}

.acc-predicted.danger {
  background: var(--red-soft);
  color: var(--red);
}

.acc-predicted.warning {
  background: var(--amber-soft);
  color: var(--amber);
}

/* ────────── Prediction card ────────── */
.prediction-card {
  margin-bottom: 12px;
}

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

.pred-title {
  font-size: .82rem;
  font-weight: 800;
}

.pred-date {
  font-size: .68rem;
  font-weight: 600;
  color: var(--text-muted);
}

.pred-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
}

.pred-row+.pred-row {
  border-top: 1px solid var(--border-subtle);
}

.pred-acc-name {
  flex: 1;
  font-size: .8rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.pred-current {
  font-size: .75rem;
  font-weight: 600;
  color: var(--text-muted);
  min-width: 80px;
  text-align: right;
}

.pred-arrow {
  color: var(--text-muted);
  font-size: .75rem;
}

.pred-predicted {
  font-size: .82rem;
  font-weight: 800;
  min-width: 80px;
  text-align: right;
}

.pred-predicted.positive {
  color: var(--green);
}

.pred-predicted.negative {
  color: var(--red);
}

.pred-predicted.warning {
  color: var(--amber);
}

.pred-deductions {
  font-size: .65rem;
  font-weight: 600;
  color: var(--red);
  opacity: 0.8;
  margin-left: 4px;
}

/* ────────── Charts ────────── */
.chart-card {
  margin-bottom: 12px;
}

.chart-title {
  font-size: .75rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-secondary);
  margin-bottom: 10px;
}

.chart-wrap {
  position: relative;
  height: 180px;
}

.chart-wrap-wide {
  height: 150px;
}

.chart-wrap-donut {
  height: 200px;
}

.chart-wrap-tall {
  height: 220px;
}

/* ────────── Section cards ────────── */
.section-card {
  margin-bottom: 12px;
}

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

.section-title {
  font-size: .85rem;
  font-weight: 800;
}

.link-btn {
  font-size: .72rem;
  font-weight: 700;
  color: var(--accent);
  transition: color var(--transition), transform var(--transition);
  display: inline-block;
}

.link-btn:hover {
  color: var(--accent-light);
  transform: translateX(2px);
}

/* ─── Empty states ─── */
.empty-state {
  text-align: center;
  padding: 32px 16px;
}

.empty-icon {
  font-size: 2.5rem;
  margin-bottom: 8px;
}

.empty-msg {
  font-size: .82rem;
  color: var(--text-muted);
  text-align: center;
  padding: 16px 0;
  font-weight: 600;
}

/* ─── Deduction rows ─── */
.ded-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 8px;
  border-radius: var(--radius-sm);
  transition: background var(--transition);
  animation: fadeUp .3s ease;
}

.ded-row:hover {
  background: rgba(100, 100, 180, 0.06);
}

.ded-row+.ded-row {
  border-top: 1px solid var(--border-subtle);
}

.ded-icon-wrap {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  font-size: 1.1rem;
}

.ded-icon-wrap.cat-emi {
  background: rgba(255, 107, 107, 0.12);
}

.ded-icon-wrap.cat-sip {
  background: rgba(92, 124, 250, 0.12);
}

.ded-icon-wrap.cat-rent {
  background: rgba(251, 191, 36, 0.12);
}

.ded-icon-wrap.cat-subscription {
  background: rgba(168, 85, 247, 0.12);
}

.ded-icon-wrap.cat-bill {
  background: rgba(45, 212, 191, 0.12);
}

.ded-icon-wrap.cat-insurance {
  background: rgba(249, 115, 22, 0.12);
}

.ded-icon-wrap.cat-loan {
  background: rgba(236, 72, 153, 0.12);
}

.ded-icon-wrap.cat-tax {
  background: rgba(100, 116, 139, 0.12);
}

.ded-icon-wrap.cat-other {
  background: rgba(148, 163, 184, 0.12);
}

.ded-details {
  flex: 1;
  min-width: 0;
}

.ded-name {
  font-size: .84rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ded-meta {
  font-size: .68rem;
  color: var(--text-muted);
  font-weight: 600;
  margin-top: 2px;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.ded-badge {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 6px;
  font-size: .6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .03em;
}

.ded-badge.freq {
  background: rgba(92, 124, 250, 0.12);
  color: var(--accent);
}

.ded-badge.account {
  background: rgba(168, 85, 247, 0.1);
  color: var(--purple);
}

.ded-badge.paused {
  background: rgba(100, 100, 120, 0.15);
  color: var(--text-muted);
}

.ded-amount {
  font-size: .88rem;
  font-weight: 800;
  color: var(--red);
  white-space: nowrap;
}

.credit-amount {
  font-size: .88rem;
  font-weight: 800;
  color: #00D09C;
  white-space: nowrap;
}

/* ── Deductions / Credits Toggle ── */
.ded-toggle {
  display: flex;
  gap: 4px;
  padding: 4px;
  border-radius: var(--radius);
  margin-bottom: 12px;
}

.toggle-btn {
  flex: 1;
  padding: 8px 12px;
  border-radius: calc(var(--radius) - 4px);
  font-size: .8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-muted);
  transition: all var(--transition);
  text-align: center;
}

.toggle-btn.active {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 2px 12px rgba(92, 124, 250, 0.35);
}

/* ── Credit icon background ── */
.ded-icon-wrap.cat-credit {
  background: linear-gradient(135deg, rgba(0,208,156,0.2) 0%, rgba(0,184,110,0.3) 100%);
  border: 1px solid rgba(0,208,156,0.3);
}

/* ── Green calendar dot for credits ── */
.cal-dot.dot-credit {
  background: #00D09C;
}

.ded-actions {
  display: flex;
  gap: 2px;
}

.ded-actions .icon-btn {
  width: 30px;
  height: 30px;
}

.ded-actions .icon {
  width: 15px;
  height: 15px;
}

/* ─── Accounts list ─── */
.accounts-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.account-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  border-radius: var(--radius-md);
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  box-shadow: var(--shadow);
  transition: transform var(--transition), box-shadow var(--transition);
  animation: fadeUp .3s ease;
  position: relative;
  overflow: hidden;
}

.account-row:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-lg);
}

.account-row::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 4px;
}

.account-row[data-color="blue"]::before {
  background: var(--grad-blue);
}

.account-row[data-color="green"]::before {
  background: var(--grad-green);
}

.account-row[data-color="purple"]::before {
  background: var(--grad-purple);
}

.account-row[data-color="amber"]::before {
  background: var(--grad-amber);
}

.account-row[data-color="teal"]::before {
  background: var(--grad-teal);
}

.account-row[data-color="red"]::before {
  background: var(--grad-red);
}

.account-icon {
  font-size: 1.8rem;
}

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

.account-name {
  font-size: .92rem;
  font-weight: 800;
}

.account-bank {
  font-size: .7rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-top: 1px;
}

.account-balance-wrap {
  text-align: right;
}

.account-balance {
  font-size: 1.1rem;
  font-weight: 900;
  letter-spacing: -.02em;
}

.account-pred-badge {
  display: inline-block;
  font-size: .62rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
  margin-top: 3px;
}

.account-pred-badge.safe {
  background: var(--green-soft);
  color: var(--green);
}

.account-pred-badge.danger {
  background: var(--red-soft);
  color: var(--red);
}

.account-actions {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.account-actions .icon-btn {
  width: 30px;
  height: 30px;
}

.account-actions .icon {
  width: 14px;
  height: 14px;
}

/* ────────── View header ────────── */
.view-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.view-title {
  font-size: 1.4rem;
  font-weight: 900;
  letter-spacing: -.03em;
}

.primary-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 9px 18px;
  border-radius: var(--radius-xl);
  font-size: .78rem;
  font-weight: 800;
  color: #fff;
  background: var(--grad-fab);
  box-shadow: 0 4px 20px rgba(92, 124, 250, 0.3);
  transition: transform var(--transition), box-shadow var(--transition);
}

.primary-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 28px rgba(92, 124, 250, 0.4);
}

.primary-btn:active {
  transform: scale(.96);
}

.btn-icon {
  width: 16px;
  height: 16px;
  fill: #fff;
}

.secondary-btn {
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: .78rem;
  font-weight: 700;
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  color: var(--text-secondary);
  transition: background var(--transition), transform var(--transition);
}

.secondary-btn:hover {
  background: var(--bg-card-hover);
  transform: translateY(-1px);
}

.danger-btn {
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: .78rem;
  font-weight: 700;
  background: var(--red-soft);
  color: var(--red);
  border: 1px solid rgba(255, 107, 107, 0.2);
  transition: background var(--transition);
}

.danger-btn:hover {
  background: rgba(255, 107, 107, 0.2);
}

/* ────────── Filter bar ────────── */
.filter-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  padding: 12px;
  flex-wrap: wrap;
}

.select-input,
.date-input,
.text-input {
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-glass);
  background: rgba(15, 15, 30, 0.6);
  color: var(--text-primary);
  /* 16px minimum prevents iOS Safari from zooming on focus */
  font-size: 16px;
  font-weight: 600;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.select-input:focus,
.date-input:focus,
.text-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(92, 124, 250, 0.12);
}

.select-input option {
  background: var(--bg);
}

/* ────────── FAB ────────── */
.fab {
  position: fixed;
  bottom: calc(var(--tab-h) + env(safe-area-inset-bottom, 0px) + 14px);
  right: 16px;
  z-index: 90;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--grad-fab);
  box-shadow: 0 6px 28px rgba(92, 124, 250, 0.4);
  transition: transform var(--transition), box-shadow var(--transition);
}

.fab svg {
  width: 24px;
  height: 24px;
  fill: #fff;
}

.fab:hover {
  transform: scale(1.1) rotate(8deg);
  box-shadow: 0 8px 36px rgba(92, 124, 250, 0.5);
}

.fab:active {
  transform: scale(.94);
}

/* ────────── Modal ────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0, 0, 0, 0.6);
  display: grid;
  place-items: center;
  padding: 16px;
  animation: fadeIn .2s ease;
  backdrop-filter: blur(4px);
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

.modal {
  width: 100%;
  max-width: 440px;
  max-height: 88dvh;
  overflow-y: auto;
  border-radius: var(--radius-lg);
  box-shadow: 0 16px 60px rgba(0, 0, 0, 0.5);
  animation: modalUp .28s cubic-bezier(.34, 1.56, .64, 1);
}

@keyframes modalUp {
  from {
    opacity: 0;
    transform: translateY(24px) scale(0.97);
  }
}

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

.modal-title {
  font-size: 1.05rem;
  font-weight: 900;
}

.modal-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.form-group label {
  font-size: .68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-secondary);
}

.form-group input,
.form-group select,
.form-group textarea {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-glass);
  background: rgba(15, 15, 30, 0.6);
  color: var(--text-primary);
  font-size: .85rem;
  font-weight: 600;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(92, 124, 250, 0.12);
}

.form-group select option {
  background: var(--bg);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.form-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 4px;
}

/* ─── Settings ─── */
.settings-modal {
  max-width: 380px;
}

.settings-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.setting-row label {
  font-size: .82rem;
  font-weight: 700;
}

.danger-row {
  padding-top: 14px;
  border-top: 1px solid var(--border-glass);
}

.file-input {
  font-size: .72rem;
  color: var(--text-secondary);
}

.settings-divider {
  height: 1px;
  background: var(--border-glass);
  margin: 4px 0;
}

.settings-section-title {
  font-size: .78rem;
  font-weight: 800;
  color: var(--accent-light);
  text-transform: uppercase;
  letter-spacing: .05em;
  margin: 0;
}

.setting-note {
  font-size: .72rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.setting-note.success {
  color: var(--green);
}

.setting-note.error {
  color: var(--red);
}

.sync-always-on-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: .72rem;
  font-weight: 700;
  color: var(--green);
  background: var(--green-soft);
  padding: 4px 10px;
  border-radius: 99px;
}

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

/* ─── Confirm ─── */
.confirm-modal {
  max-width: 360px;
  text-align: center;
}

.confirm-msg {
  font-size: .92rem;
  font-weight: 600;
  margin-bottom: 16px;
  line-height: 1.5;
}

.confirm-actions {
  display: flex;
  gap: 8px;
  justify-content: center;
}

/* ─── Toast ─── */
.toast {
  position: fixed;
  bottom: calc(var(--tab-h) + 20px + env(safe-area-inset-bottom));
  left: 50%;
  translate: -50%;
  z-index: 300;
  padding: 10px 24px;
  border-radius: var(--radius-xl);
  font-size: .78rem;
  font-weight: 800;
  background: var(--grad-fab);
  color: #fff;
  box-shadow: 0 4px 24px rgba(92, 124, 250, 0.4);
  animation: toastIn .3s cubic-bezier(.34, 1.56, .64, 1);
  pointer-events: none;
}

@keyframes toastIn {
  from {
    opacity: 0;
    translate: -50% 12px;
  }
}

/* ────────── Calendar ────────── */
.month-selector {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-bottom: 12px;
  padding: 10px 16px;
}

.month-label {
  font-weight: 800;
  font-size: .88rem;
  min-width: 140px;
  text-align: center;
}

.calendar-grid {
  margin-bottom: 12px;
  padding: 12px;
}

.cal-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  margin-bottom: 8px;
}

.cal-weekdays span {
  text-align: center;
  font-size: .62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
}

.cal-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 3px;
}

.cal-day {
  min-height: 54px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 4px 2px;
  border-radius: 10px;
  font-size: .78rem;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition), transform var(--transition);
  position: relative;
  gap: 3px;
}

.cal-day:hover {
  background: rgba(100, 100, 180, 0.1);
}

.cal-day.today {
  background: rgba(92, 124, 250, 0.12);
  border: 1px solid rgba(92, 124, 250, 0.3);
  font-weight: 900;
  color: var(--accent);
}

.cal-day.has-deductions {
  font-weight: 800;
}

.cal-day.selected {
  background: rgba(92, 124, 250, 0.2);
  border: 1px solid var(--accent);
}

.cal-day.empty {
  cursor: default;
  color: transparent;
}

.cal-day.other-month {
  color: var(--text-muted);
  opacity: 0.3;
}

/* Colorful category chips in calendar */
.cal-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  justify-content: center;
  width: 100%;
}

.cal-chip {
  font-size: .48rem;
  font-weight: 800;
  padding: 1px 4px;
  border-radius: 99px;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 1px;
  max-width: 100%;
  overflow: hidden;
  line-height: 1.4;
}

.cal-chip.chip-emi {
  background: rgba(92, 124, 250, .2);
  color: var(--cat-emi);
}

.cal-chip.chip-sip {
  background: rgba(52, 211, 153, .2);
  color: var(--cat-sip);
}

.cal-chip.chip-investment {
  background: rgba(6, 182, 212, .2);
  color: var(--cat-investment);
}

.cal-chip.chip-rent {
  background: rgba(245, 158, 11, .2);
  color: var(--cat-rent);
}

.cal-chip.chip-subscription {
  background: rgba(168, 85, 247, .2);
  color: var(--cat-sub);
}

.cal-chip.chip-bill {
  background: rgba(45, 212, 191, .2);
  color: var(--cat-bill);
}

.cal-chip.chip-insurance {
  background: rgba(249, 115, 22, .2);
  color: var(--cat-insurance);
}

.cal-chip.chip-loan {
  background: rgba(236, 72, 153, .2);
  color: var(--cat-loan);
}

.cal-chip.chip-tax {
  background: rgba(100, 116, 139, .2);
  color: var(--cat-tax);
}

.cal-chip.chip-other {
  background: rgba(148, 163, 184, .2);
  color: var(--cat-other);
}

.cal-amount {
  font-size: .5rem;
  font-weight: 700;
  color: var(--red);
  white-space: nowrap;
}




.cal-detail {
  margin-bottom: 12px;
}

.cal-detail-title {
  font-size: .82rem;
  font-weight: 800;
  margin-bottom: 8px;
}

/* ────────── Simulator ────────── */
.simulator-card {
  margin-bottom: 12px;
}

.sim-desc {
  font-size: .75rem;
  color: var(--text-muted);
  margin: 4px 0 12px;
  font-weight: 500;
}

.sim-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sim-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.sim-btn {
  align-self: flex-start;
}

.sim-result {
  margin-top: 14px;
  padding: 14px;
  border-radius: var(--radius-sm);
  animation: fadeUp .3s ease;
}

.sim-result.safe {
  background: var(--grad-safe);
  border: 1px solid rgba(0, 208, 156, 0.2);
}

.sim-result.unsafe {
  background: var(--grad-danger);
  border: 1px solid rgba(255, 107, 107, 0.2);
}

.sim-verdict {
  font-size: 1rem;
  font-weight: 900;
  margin-bottom: 6px;
}

.sim-verdict.safe {
  color: var(--green);
}

.sim-verdict.unsafe {
  color: var(--red);
}

.sim-details {
  font-size: .78rem;
  font-weight: 600;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* ────────── Breakdown ────────── */
.breakdown-card {
  margin-bottom: 12px;
}

.breakdown-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
  justify-content: center;
}

.breakdown-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: .68rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.breakdown-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

/* ────────── Suggestions ────────── */
.suggestions-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.suggestion-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: var(--radius-sm);
  animation: fadeUp .3s ease;
}

.suggestion-row.transfer {
  background: rgba(92, 124, 250, 0.06);
  border: 1px solid rgba(92, 124, 250, 0.12);
}

.suggestion-row.warning {
  background: var(--amber-soft);
  border: 1px solid rgba(251, 191, 36, 0.15);
}

.suggestion-icon {
  font-size: 1.2rem;
  flex-shrink: 0;
}

.suggestion-text {
  font-size: .78rem;
  font-weight: 600;
  color: var(--text-secondary);
  line-height: 1.4;
}

.suggestion-amount {
  font-size: .82rem;
  font-weight: 800;
  color: var(--accent);
  white-space: nowrap;
}

/* ────────── Responsive ────────── */
@media (max-width:640px) {
  .form-row {
    grid-template-columns: 1fr;
  }

  .sim-row {
    grid-template-columns: 1fr;
  }

  .hero-value {
    font-size: 1.8rem;
  }

  .view-title {
    font-size: 1.2rem;
  }

  .tab {
    padding: 6px 6px;
  }

  .tab span {
    font-size: .52rem;
  }
}

/* ────────── Investment category ────────── */
.cat-investment {
  background: rgba(6, 182, 212, 0.15);
}

/* ────────── Account Accordion ────────── */
.acc-accordion {
  border-radius: var(--radius-md);
  overflow: hidden;
  margin-bottom: 10px;
  border: 1px solid var(--border-glass);
  background: var(--bg-card);
  box-shadow: var(--shadow);
}

.acc-accordion-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 12px;
  cursor: pointer;
  user-select: none;
  touch-action: manipulation;
  transition: background var(--transition);
}

.acc-accordion-header:active {
  background: rgba(100, 100, 180, 0.08);
}

.acc-accordion-header[data-color="blue"] {
  border-left: 3px solid var(--accent);
}

.acc-accordion-header[data-color="green"] {
  border-left: 3px solid var(--green);
}

.acc-accordion-header[data-color="purple"] {
  border-left: 3px solid var(--purple);
}

.acc-accordion-header[data-color="amber"] {
  border-left: 3px solid var(--amber);
}

.acc-accordion-header[data-color="teal"] {
  border-left: 3px solid var(--teal);
}

.acc-accordion-header[data-color="red"] {
  border-left: 3px solid var(--red);
}

.accordion-chevron {
  font-size: 18px;
  line-height: 1;
  color: var(--text-muted);
  transition: transform 0.25s ease;
  margin-left: 2px;
  flex-shrink: 0;
}

.acc-accordion.open .accordion-chevron {
  transform: rotate(180deg);
}

.acc-accordion-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.32s ease;
}

.acc-accordion.open .acc-accordion-body {
  max-height: 1200px;
  border-top: 1px solid var(--border-subtle);
}

.acc-ded-list {
  padding: 4px 0;
}

.acc-ded-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  border-bottom: 1px solid var(--border-subtle);
}

.acc-ded-row:last-child {
  border-bottom: none;
}

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

.acc-ded-name {
  font-size: .8rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.acc-ded-meta {
  font-size: .68rem;
  color: var(--text-muted);
  margin-top: 1px;
}

.acc-ded-amount {
  font-size: .8rem;
  font-weight: 700;
  white-space: nowrap;
  flex-shrink: 0;
}

.acc-ded-amount.charge {
  color: var(--red);
}

.acc-ded-amount.borrowed {
  color: var(--purple);
}

.acc-ded-actions {
  display: flex;
  gap: 0;
  flex-shrink: 0;
}

.acc-ded-empty {
  padding: 14px 16px;
  font-size: .8rem;
  color: var(--text-muted);
  text-align: center;
  font-style: italic;
}

/* ────────── Status Chips ────────── */
.status-chip {
  font-size: .58rem;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 99px;
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: .05em;
  flex-shrink: 0;
}

.chip-upcoming {
  background: rgba(0, 208, 156, .12);
  color: var(--green);
  border: 1px solid rgba(0, 208, 156, .25);
}

.chip-deducted {
  background: rgba(255, 107, 107, .12);
  color: var(--red);
  border: 1px solid rgba(255, 107, 107, .25);
}

.chip-paused {
  background: rgba(96, 96, 128, .12);
  color: var(--text-muted);
  border: 1px solid rgba(96, 96, 128, .2);
}

/* ────────── CC Badge & Styles ────────── */
.acc-type-badge {
  font-size: .55rem;
  font-weight: 800;
  padding: 1px 5px;
  border-radius: 99px;
  text-transform: uppercase;
  letter-spacing: .05em;
  vertical-align: middle;
  margin-left: 5px;
}

.acc-type-badge.cc {
  background: rgba(168, 85, 247, .12);
  color: var(--purple);
  border: 1px solid rgba(168, 85, 247, .2);
}

.account-pred-badge.cc {
  background: rgba(168, 85, 247, .1);
  color: var(--purple);
  border: 1px solid rgba(168, 85, 247, .15);
}

.acc-predicted.cc-label {
  color: var(--purple);
  font-size: .65rem;
}

/* ── Sync indicator ── */
.sync-indicator {
  font-size: 1rem;
  background: none;
  border: none;
  cursor: default;
  padding: 4px 6px;
  border-radius: 8px;
  line-height: 1;
  opacity: 0;
  transition: opacity .2s;
}

.sync-indicator.syncing {
  animation: pulse 1s infinite;
}

.sync-indicator.error {
  opacity: 1;
}