@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:ital,wght@0,300;0,400;0,500;0,600;0,700;0,800;1,400;1,600&display=swap');

:root {
  /* Android App Design Tokens (Paper-like Editorial Light Theme) */
  --bg: #F5F5F2;
  --surface: #FFFFFF;
  --surface-subtle: #FAFAF8;
  --surface-hover: #F0F0EC;
  
  --text-primary: #111111;
  --text-secondary: #6F6F6A;
  --text-muted: #A1A19B;
  
  --border: #E4E4DF;
  --border-light: #ECECE7;
  
  --primary: #4338CA;
  --primary-strong: #2B20D9;
  --primary-soft: #EEECFB;
  --primary-glow: rgba(67, 56, 202, 0.12);
  
  /* Semantic Colors */
  --income: #15966F;
  --income-bg: #E7F6F0;
  
  --expense: #D94A5B;
  --expense-bg: #FBECEF;
  
  --warning: #D58A18;
  --warning-soft: #FFF4DC;
  
  --white: #FFFFFF;
  --black: #111111;
  
  /* Spacing */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 12px;
  --space-lg: 16px;
  --space-xl: 20px;
  --space-xxl: 24px;
  --space-xxxl: 32px;
  --space-huge: 40px;
  
  /* Radii */
  --radius-sm: 12px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-xl: 32px;
  --radius-pill: 999px;
  
  /* Shadows */
  --shadow-subtle: 0 2px 8px rgba(0, 0, 0, 0.03);
  --shadow-card: 0 6px 20px rgba(0, 0, 0, 0.04), 0 1px 3px rgba(0, 0, 0, 0.02);
  --shadow-float: 0 12px 32px rgba(0, 0, 0, 0.08), 0 2px 6px rgba(0, 0, 0, 0.04);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

#app-container {
  width: 100%;
  max-width: 540px;
  min-height: 100vh;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  position: relative;
  box-shadow: 0 0 50px rgba(0, 0, 0, 0.05);
}

/* ---- Top Header ---- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(env(safe-area-inset-top) + 16px) var(--space-xl) 14px;
  background: rgba(245, 245, 242, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(228, 228, 223, 0.6);
}

/* ---- Top Navigation Tab Bar ---- */
.top-nav-bar {
  position: sticky;
  top: 58px;
  z-index: 39;
  display: flex;
  background: var(--bg);
  padding: 8px var(--space-xl) 10px;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  border-bottom: 1px solid var(--border-light);
}

.top-nav-bar::-webkit-scrollbar {
  display: none;
}

.top-nav-tab {
  flex: 1;
  padding: 8px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  font-size: 13px;
  font-weight: 700;
  font-family: inherit;
  color: var(--text-secondary);
  cursor: pointer;
  white-space: nowrap;
  text-align: center;
  transition: all 0.15s cubic-bezier(0.16, 1, 0.3, 1);
}

.top-nav-tab:hover {
  background: var(--surface-hover);
  color: var(--text-primary);
}

.top-nav-tab.active {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--white);
  box-shadow: 0 2px 8px var(--primary-glow);
}

.brand-wrap {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.brand-badge {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  background: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--white);
  font-weight: 800;
  font-size: 14px;
  box-shadow: 0 2px 8px var(--primary-glow);
}

.brand-title {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.3px;
  color: var(--text-primary);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.icon-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-primary);
  width: 38px;
  height: 38px;
  border-radius: var(--radius-pill);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: var(--shadow-subtle);
  position: relative;
}

.icon-btn:hover {
  background: var(--surface-hover);
  transform: translateY(-1px);
}

.icon-btn:active {
  transform: scale(0.95);
}

.icon-btn.spinning svg {
  animation: spin 0.8s linear infinite;
}

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

.badge-dot {
  position: absolute;
  top: 4px;
  right: 4px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: var(--radius-pill);
  background: var(--expense);
  color: var(--white);
  font-size: 9px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--surface);
}

/* ---- Views / Screens ---- */
.view {
  flex: 1;
  padding: var(--space-lg) var(--space-xl) 120px;
  display: block;
  animation: fadeIn 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.view.hidden {
  display: none !important;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ---- Typography Tokens ---- */
.caption {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--text-muted);
}

.greeting-caption {
  color: var(--text-secondary);
  letter-spacing: 1.8px;
  margin-bottom: var(--space-xs);
}

.heading-1 {
  font-size: 32px;
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.8px;
  color: var(--text-primary);
}

.heading-2 {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.4px;
  color: var(--text-primary);
}

.heading-3 {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.2px;
  color: var(--text-primary);
}

.display-amount {
  font-size: 46px;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -1.5px;
  color: var(--text-primary);
  margin-top: var(--space-sm);
  font-feature-settings: "tnum";
}

.trend-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  font-weight: 600;
  margin-top: var(--space-sm);
  color: var(--text-secondary);
}

.trend-badge.positive {
  color: var(--income);
}

.trend-badge.negative {
  color: var(--expense);
}

/* ---- Cards & Surfaces ---- */
.card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-card);
  padding: var(--space-xl);
  margin-top: var(--space-xl);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.overview-card {
  margin-top: var(--space-xxl);
  padding: var(--space-xl) var(--space-xl) var(--space-md);
  position: relative;
  overflow: hidden;
}

.card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}

.period-pill {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--primary);
  background: var(--primary-soft);
  padding: 4px 10px;
  border-radius: var(--radius-pill);
}

.overview-val {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: var(--text-primary);
  margin-top: 4px;
}

/* ---- Hero Spending Chart (SVG) ---- */
.chart-container {
  width: 100%;
  height: 130px;
  margin-top: var(--space-md);
  position: relative;
}

.chart-svg {
  width: 100%;
  height: 100%;
  overflow: visible;
}

.chart-labels {
  display: flex;
  justify-content: space-between;
  padding: 0 4px;
  margin-top: 4px;
}

.chart-labels span {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
}

/* ---- Summary Row (Income & Spending Cards) ---- */
.summary-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-md);
  margin-top: var(--space-md);
}

.summary-card {
  margin-top: 0;
  padding: var(--space-lg);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 124px;
}

.summary-amount {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: var(--text-primary);
  margin-top: var(--space-md);
  font-feature-settings: "tnum";
}

.summary-amount.income {
  color: var(--income);
}

.summary-trend {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-top: var(--space-sm);
}

.summary-trend.positive {
  color: var(--income);
}

/* ---- Section Headers ---- */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: var(--space-xxl);
  margin-bottom: var(--space-md);
}

.see-all-btn {
  background: none;
  border: none;
  color: var(--primary);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 4px 0;
}

.see-all-btn:hover {
  color: var(--primary-strong);
}

.detail-back-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 600;
  padding: 8px 16px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  margin-bottom: var(--space-md);
  box-shadow: var(--shadow-subtle);
  transition: all 0.15s ease;
  user-select: none;
}

.detail-back-btn:hover {
  background: var(--surface-hover);
  color: var(--primary);
  border-color: var(--primary);
  transform: translateX(-2px);
}

.detail-back-btn:active {
  transform: scale(0.97);
}

.detail-back-btn svg {
  flex-shrink: 0;
  stroke: currentColor;
  transition: transform 0.15s ease;
}

.detail-back-btn:hover svg {
  transform: translateX(-2px);
}

/* ---- Activity / Insight Card ---- */
.insight-card {
  margin-top: 0;
  display: flex;
  align-items: center;
  padding: var(--space-lg);
  cursor: pointer;
}

.insight-card:hover {
  transform: translateY(-1px);
}

.insight-icon-wrap {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: var(--primary-soft);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  margin-right: var(--space-md);
  flex-shrink: 0;
}

.insight-body {
  flex: 1;
}

.insight-kicker {
  color: var(--primary);
  font-size: 10px;
}

.insight-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-primary);
  margin-top: 2px;
}

.insight-desc {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 2px;
  line-height: 1.4;
}

/* ---- Transaction List & Rows ---- */
.transaction-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  margin-top: var(--space-sm);
}

.txn-row {
  display: flex;
  align-items: center;
  padding: 14px var(--space-lg);
  border-bottom: 1px solid var(--border-light);
  cursor: pointer;
  transition: background 0.15s ease;
}

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

.txn-row:hover {
  background: var(--surface-subtle);
}

.avatar-circle {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-pill);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  margin-right: var(--space-md);
  flex-shrink: 0;
}

.txn-info {
  flex: 1;
  min-width: 0;
  padding-right: var(--space-md);
}

.txn-merchant {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.txn-sub {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.txn-amt-col {
  text-align: right;
  flex-shrink: 0;
}

.txn-amount {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  font-feature-settings: "tnum";
}

.txn-amount.income {
  color: var(--income);
}

.status-badge-chip {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: var(--radius-pill);
  margin-top: 3px;
  text-transform: uppercase;
}

.status-badge-chip.review {
  background: var(--warning-soft);
  color: var(--warning);
}

.status-badge-chip.split {
  background: var(--primary-soft);
  color: var(--primary);
}

/* ---- Filter Controls & Pills ---- */
.search-input-wrap {
  position: relative;
  margin-bottom: var(--space-md);
}

.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
}

.search-input {
  width: 100%;
  padding: 12px 14px 12px 42px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  font-size: 15px;
  font-family: inherit;
  color: var(--text-primary);
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.search-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.pill-scroller {
  display: flex;
  gap: var(--space-sm);
  overflow-x: auto;
  padding-bottom: var(--space-sm);
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.pill-scroller::-webkit-scrollbar {
  display: none;
}

.pill-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.pill-btn:hover {
  background: var(--surface-hover);
  color: var(--text-primary);
}

.pill-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--white);
  box-shadow: 0 2px 8px var(--primary-glow);
}

/* ---- Date Range Filter ---- */
.date-filter-container {
  margin-top: var(--space-xs);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.date-presets-scroller {
  margin-bottom: 0;
  padding-bottom: 2px;
}

.date-range-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 8px 12px;
  box-shadow: var(--shadow-subtle);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.date-range-bar:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.date-range-inputs {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
}

.date-input-field {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  min-width: 0;
}

.date-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-secondary);
  letter-spacing: 0.5px;
  flex-shrink: 0;
}

.date-input-wrap {
  flex: 1;
  min-width: 0;
}

.date-picker-input {
  width: 100%;
  border: 1px solid var(--border);
  background: var(--surface-subtle);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  font-size: 13px;
  font-family: inherit;
  font-weight: 500;
  color: var(--text-primary);
  outline: none;
  cursor: pointer;
  transition: all 0.15s ease;
  min-width: 0;
  -webkit-appearance: none;
  appearance: none;
}

.date-picker-input:hover {
  background: var(--surface);
  border-color: var(--text-muted);
}

.date-picker-input:focus {
  background: var(--surface);
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-glow);
}

.date-picker-input::-webkit-calendar-picker-indicator {
  cursor: pointer;
  opacity: 0.65;
  transition: opacity 0.15s ease;
}

.date-picker-input::-webkit-calendar-picker-indicator:hover {
  opacity: 1;
}

.date-range-sep {
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  user-select: none;
  flex-shrink: 0;
}

.date-clear-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 10px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: var(--surface-subtle);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: all 0.15s ease;
}

.date-clear-action-btn:hover {
  background: var(--expense-bg);
  color: var(--expense);
  border-color: rgba(217, 74, 91, 0.3);
}

.date-filter-summary {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--primary);
  padding: 2px 4px;
}

.summary-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--primary);
  flex-shrink: 0;
}

@media (max-width: 440px) {
  .date-range-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }
  .date-clear-action-btn {
    align-self: flex-end;
  }
}

/* ---- Bottom Navigation Bar ---- */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 540px;
  z-index: 50;
  display: flex;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--border);
  padding: 8px 12px calc(8px + env(safe-area-inset-bottom));
  justify-content: space-around;
}

.nav-tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
  padding: 6px 4px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: color 0.15s ease;
  position: relative;
}

.nav-tab svg {
  width: 20px;
  height: 20px;
  stroke-width: 2.2;
}

.nav-tab:hover {
  color: var(--text-primary);
}

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

.nav-tab .tab-badge {
  position: absolute;
  top: 2px;
  right: 18%;
  width: 8px;
  height: 8px;
  background: var(--expense);
  border-radius: 50%;
}

/* ---- Splitter & Friends Screen ---- */
.friends-scroll {
  display: flex;
  gap: var(--space-sm);
  flex-wrap: wrap;
  margin-top: var(--space-md);
}

.friend-chip {
  padding: 8px 16px;
  border-radius: var(--radius-pill);
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.friend-chip.selected {
  background: var(--primary);
  color: var(--white);
  border-color: var(--primary);
  box-shadow: 0 2px 8px var(--primary-glow);
}

.input-row {
  display: flex;
  gap: var(--space-sm);
  margin-top: var(--space-sm);
}

.app-input {
  flex: 1;
  padding: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 15px;
  font-family: inherit;
  color: var(--text-primary);
  outline: none;
}

.app-input:focus {
  border-color: var(--primary);
}

.btn {
  padding: 12px 20px;
  border-radius: var(--radius-pill);
  font-size: 14px;
  font-weight: 700;
  font-family: inherit;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.15s ease;
}

.btn-primary {
  background: var(--primary);
  color: var(--white);
}

.btn-primary:hover {
  background: var(--primary-strong);
}

.btn-secondary {
  background: var(--surface);
  color: var(--text-primary);
  border: 1px solid var(--border);
}

.btn-danger {
  background: var(--expense);
  color: var(--white);
}

.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(17, 17, 17, 0.5);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  align-items: flex-end;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-overlay.active {
  display: flex !important;
  opacity: 1 !important;
  pointer-events: auto !important;
}

#loginScreen.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: rgba(17, 17, 17, 0.6);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  align-items: center;
  justify-content: center;
  padding: var(--space-xl);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

#loginScreen.modal-overlay.active {
  display: flex !important;
  opacity: 1 !important;
  pointer-events: auto !important;
}

#loginScreen .modal-sheet {
  background: var(--surface);
  border-radius: var(--radius-xl);
  max-width: 400px;
  width: 100%;
  padding: 36px 24px 28px;
  box-shadow: var(--shadow-float);
  transform: scale(1) translateY(0) !important;
  text-align: center;
  border: 1px solid var(--border);
}

.modal-sheet {
  width: 100%;
  max-width: 540px;
  max-height: 85vh;
  background: var(--surface);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  padding: var(--space-xl) var(--space-xl) calc(var(--space-xxl) + env(safe-area-inset-bottom));
  overflow-y: auto;
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: var(--shadow-float);
  border: 1px solid var(--border);
  border-bottom: none;
}

.modal-overlay.active .modal-sheet {
  transform: translateY(0) !important;
}

.sheet-handle {
  width: 36px;
  height: 4px;
  border-radius: var(--radius-pill);
  background: var(--border);
  margin: 0 auto var(--space-lg);
}

.sheet-amount {
  font-size: 38px;
  font-weight: 800;
  letter-spacing: -1px;
  text-align: center;
  margin-top: var(--space-sm);
}

.sheet-merchant {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-secondary);
  text-align: center;
  margin-top: 2px;
  margin-bottom: var(--space-xl);
}

.detail-table {
  width: 100%;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  margin-bottom: var(--space-xl);
}

.detail-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-light);
}

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

.detail-row .label {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}

.detail-row .value {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}

.raw-toggle-btn {
  background: none;
  border: none;
  color: var(--primary);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: var(--space-sm);
}

.raw-box {
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-secondary);
  white-space: pre-wrap;
  word-break: break-word;
  margin-bottom: var(--space-lg);
}

/* Toast */
.toast {
  position: fixed;
  bottom: 84px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--text-primary);
  color: var(--white);
  padding: 10px 20px;
  border-radius: var(--radius-pill);
  font-size: 13px;
  font-weight: 600;
  z-index: 120;
  box-shadow: var(--shadow-float);
  animation: popUp 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes popUp {
  from { opacity: 0; transform: translate(-50%, 10px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

/* Skeleton Loading State */
.skeleton {
  background: linear-gradient(90deg, #ECECE7 25%, #F5F5F2 50%, #ECECE7 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-md);
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ============================================================
   CREDIT CARD SPEND & STATEMENT OPTIMIZER STYLES
   ============================================================ */

.cards-header-wrap {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: var(--space-md);
  flex-wrap: wrap;
  gap: 12px;
}

.cards-sim-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-date-input {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  padding: 6px 12px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  outline: none;
  cursor: pointer;
  transition: border-color 0.2s;
}

.card-date-input:focus {
  border-color: var(--primary);
}

.btn-secondary-pill {
  padding: 6px 14px;
  font-size: 12px;
  border-radius: var(--radius-pill);
  background: var(--surface);
  border: 1px solid var(--border);
  font-weight: 700;
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-secondary-pill:hover {
  background: var(--surface-hover);
}

/* Hero Recommendation Card */
.card-hero-rec {
  background: linear-gradient(135deg, #181824 0%, #281D33 50%, #17202A 100%);
  color: #FFFFFF;
  border-radius: var(--radius-lg);
  padding: 22px 20px;
  box-shadow: 0 14px 34px rgba(24, 24, 36, 0.24);
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.card-hero-rec::before {
  content: "";
  position: absolute;
  top: -40px;
  right: -40px;
  width: 140px;
  height: 140px;
  background: radial-gradient(circle, rgba(200, 34, 42, 0.25) 0%, rgba(200, 34, 42, 0) 70%);
  border-radius: 50%;
  pointer-events: none;
}

.card-hero-rec-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.card-rec-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.14);
  backdrop-filter: blur(8px);
  padding: 5px 10px;
  border-radius: var(--radius-pill);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.6px;
  color: #FBBF24;
  border: 1px solid rgba(251, 191, 36, 0.3);
}

.card-runway-pill {
  display: inline-flex;
  align-items: center;
  background: #10B981;
  color: #FFFFFF;
  padding: 5px 12px;
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.3px;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.35);
}

.card-hero-name {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.5px;
  margin: 0;
  color: #FFFFFF;
}

.card-hero-sub {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.7);
  margin-top: 4px;
}

.card-hero-stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.card-stat-box {
  background: rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.card-stat-num {
  font-size: 16px;
  font-weight: 800;
  color: #FFFFFF;
  margin: 4px 0 2px;
  font-feature-settings: 'tnum';
}

.card-stat-desc {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.65);
}

.card-hero-reason-box {
  margin-top: 16px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.07);
  border-radius: var(--radius-md);
  font-size: 12px;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.9);
  border-left: 3px solid #10B981;
}

/* Card Utilization List */
.card-utilization-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 0;
}

.card-util-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  box-shadow: var(--shadow-subtle);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.card-util-item:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-card);
}

.card-util-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.card-util-title-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.card-color-dot {
  width: 12px;
  height: 12px;
  border-radius: 4px;
  flex-shrink: 0;
}

.card-util-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
}

.card-util-variant {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 1px;
}

.card-util-edit-btn {
  background: none;
  border: none;
  color: var(--primary);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: background 0.15s ease;
}

.card-util-edit-btn:hover {
  background: var(--primary-soft);
}

.card-util-bar-track {
  width: 100%;
  height: 8px;
  background: var(--surface-hover);
  border-radius: var(--radius-pill);
  overflow: hidden;
  margin: 10px 0 8px;
}

.card-util-bar-fill {
  height: 100%;
  border-radius: var(--radius-pill);
  transition: width 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.fill-optimal { background: #10B981; }
.fill-moderate { background: #F59E0B; }
.fill-high { background: #EF4444; }

.card-util-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: var(--text-secondary);
}

.card-util-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: var(--radius-pill);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.badge-optimal { background: #E7F6F0; color: #15966F; }
.badge-moderate { background: #FFF4DC; color: #D58A18; }
.badge-high { background: #FBECEF; color: #D94A5B; }
.badge-fresh { background: #EEECFB; color: #4338CA; }
.badge-statement { background: #FEE2E2; color: #B91C1C; }

/* Calendar Card */
.calendar-card {
  margin-top: 0;
}

.calendar-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-light);
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  margin-top: 10px;
}

.cal-day-cell {
  background: var(--surface-subtle);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 8px 6px;
  min-height: 64px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  cursor: pointer;
  transition: all 0.15s ease;
}

.cal-day-cell:hover {
  background: var(--surface-hover);
  border-color: var(--primary);
  transform: translateY(-1px);
}

.cal-day-cell.cal-today {
  border: 2px solid var(--primary);
  background: var(--primary-soft);
}

.cal-day-cell.cal-selected {
  border: 2px solid #111111;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.cal-day-cell.cal-statement {
  background: #FFFBEB;
  border-color: #FDE68A;
}

.cal-day-num {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-primary);
}

.cal-card-badge {
  font-size: 9px;
  font-weight: 700;
  padding: 2px 4px;
  border-radius: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 4px;
  line-height: 1.2;
}

.badge-card-icici { background: rgba(200, 34, 42, 0.12); color: #C8222A; }
.badge-card-indusind { background: rgba(138, 21, 56, 0.12); color: #8A1538; }
.badge-card-supermoney { background: rgba(224, 26, 79, 0.12); color: #E01A4F; }
.badge-card-swiggy { background: rgba(252, 128, 25, 0.12); color: #C25B00; }
.badge-card-flipkart { background: rgba(40, 116, 240, 0.12); color: #1D5EC9; }
.badge-card-sbi { background: rgba(95, 37, 159, 0.12); color: #5F259F; }
.badge-card-indian { background: rgba(212, 160, 23, 0.15); color: #9E7404; }
.badge-card-upi { background: #FEF3C7; color: #92400E; font-weight: 800; }

.cal-day-status {
  font-size: 8px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-top: 2px;
}

.calendar-legend {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border-light);
  font-size: 11px;
  color: var(--text-secondary);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

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

.dot-best { background: #10B981; }
.dot-good { background: #4338CA; }
.dot-statement { background: #F59E0B; }

/* Rules List */
.rule-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-light);
}

.rule-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.rule-num {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 12px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 2px;
}

.rule-text {
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-secondary);
}

.rule-text strong {
  color: var(--text-primary);
}

/* ==========================================================================
   Financial Obligations & Calendar Styles
   ========================================================================== */

/* Urgent Cash Buffer Banner */
.ob-urgent-banner {
  background: #FEF3C7;
  border: 1px solid #FDE68A;
  border-left: 4px solid #D97706;
  padding: 14px 16px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-top: var(--space-md);
  border-radius: var(--radius-md);
}

.ob-urgent-icon {
  font-size: 22px;
  line-height: 1;
  flex-shrink: 0;
  margin-top: 2px;
}

.ob-urgent-content {
  flex: 1;
  min-width: 0;
}

.ob-urgent-title {
  font-size: 14px;
  font-weight: 700;
  color: #92400E;
  margin-top: 2px;
}

.ob-urgent-desc {
  font-size: 12px;
  color: #78350F;
  margin-top: 3px;
  line-height: 1.4;
}

/* KPI Summary Grid */
.ob-kpi-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: var(--space-md);
}

.ob-kpi-card {
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  border: 1px solid var(--border-light);
}

.ob-kpi-val {
  font-size: 20px;
  font-weight: 800;
  font-feature-settings: 'tnum';
  color: var(--text-primary);
  margin-top: 4px;
}

.ob-kpi-sub {
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 3px;
}

/* Filters */
.ob-filters-wrap {
  margin-top: var(--space-lg);
}

.filter-pill-scroll {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  padding-bottom: 2px;
}

.filter-pill-scroll::-webkit-scrollbar {
  display: none;
}

.filter-chip {
  padding: 6px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  color: var(--text-secondary);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.filter-chip:hover {
  background: var(--surface-hover);
  color: var(--text-primary);
}

.filter-chip.active {
  background: var(--text-primary);
  color: var(--white);
  border-color: var(--text-primary);
}

/* Obligations Table */
.ob-table-card {
  padding: 0;
  overflow: hidden;
  margin-top: var(--space-sm);
  border: 1px solid var(--border);
}

.ob-table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.ob-table {
  width: 100%;
  min-width: 680px;
  border-collapse: collapse;
  font-size: 13px;
  text-align: left;
}

.ob-table th {
  padding: 12px 14px;
  background: var(--surface-subtle);
  border-bottom: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.6px;
  text-transform: uppercase;
}

.ob-table td {
  padding: 13px 14px;
  border-bottom: 1px solid var(--border-light);
  vertical-align: middle;
}

.ob-table tr:last-child td {
  border-bottom: none;
}

.ob-table tr:hover td {
  background: rgba(240, 240, 236, 0.4);
}

/* Category Badges */
.ob-cat-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  margin-top: 3px;
}

.ob-cat-sip { background: #E0E7FF; color: #3730A3; }
.ob-cat-insurance { background: #D1FAE5; color: #065F46; }
.ob-cat-subscription { background: #EDE9FE; color: #5B21B6; }
.ob-cat-utility { background: #FEF3C7; color: #92400E; }

/* Status Badges */
.ob-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px;
  border-radius: var(--radius-pill);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.ob-status-confirmed { background: #DCFCE7; color: #166534; }
.ob-status-predicted { background: #F3E8FF; color: #6B21A8; }

/* Source Pill */
.ob-source-pill {
  font-size: 11px;
  color: var(--text-secondary);
  background: var(--surface-hover);
  padding: 2px 8px;
  border-radius: 6px;
  border: 1px solid var(--border-light);
  display: inline-block;
  white-space: nowrap;
}

/* Confidence Meter */
.ob-conf-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
}

.ob-conf-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

.ob-conf-dot.high { background: #10B981; }
.ob-conf-dot.med { background: #F59E0B; }

/* Days remaining badge */
.ob-due-countdown {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  margin-top: 2px;
}

.ob-countdown-urgent { background: #FEE2E2; color: #991B1B; }
.ob-countdown-soon { background: #FEF3C7; color: #92400E; }
.ob-countdown-normal { background: var(--surface-subtle); color: var(--text-secondary); }

/* Amount Change Pill */
.ob-amt-change {
  font-size: 10px;
  font-weight: 700;
  color: #D94A5B;
  display: block;
  margin-top: 2px;
}

/* Calendar Dots */
.ob-calendar-legend {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border-light);
  font-size: 11px;
  color: var(--text-secondary);
}

.ob-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.dot-sip { background: #3730A3; }
.dot-insurance { background: #065F46; }
.dot-sub { background: #7C3AED; }
.dot-util { background: #D97706; }

.cal-ob-pill {
  font-size: 8px;
  font-weight: 700;
  padding: 1px 4px;
  border-radius: 3px;
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
  display: block;
}

.cal-ob-sip { background: #E0E7FF; color: #3730A3; }
.cal-ob-insurance { background: #D1FAE5; color: #065F46; }
.cal-ob-sub { background: #EDE9FE; color: #5B21B6; }
.cal-ob-util { background: #FEF3C7; color: #92400E; }



