/* ==========================================================================
   Monefy App - Core Stylesheet & Design System (Enterprise Edition)
   ========================================================================== */

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

:root {
  --bg-app: #F3F4F6;
  --bg-card: #FFFFFF;
  --bg-surface: #FFFFFF;
  --bg-surface-secondary: #F9FAFB;
  --bg-surface-hover: #F3F4F6;
  --text-primary: #111827;
  --text-secondary: #4B5563;
  --text-muted: #9CA3AF;
  
  --border-color: #E5E7EB;
  --border-subtle: #F3F4F6;
  
  --accent-primary: #10B981;
  --color-income: #10B981;
  --color-expense: #EF4444;
  --color-transfer: #6366F1;
  
  --chart-empty-ring: #E5E7EB;
  --chart-bg-track: #F3F4F6;

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
  --shadow-fab-green: 0 8px 20px -4px rgba(16, 185, 129, 0.45);
  --shadow-fab-red: 0 8px 20px -4px rgba(239, 68, 68, 0.45);

  --font-heading: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --radius-full: 9999px;

  --safe-area-bottom: env(safe-area-inset-bottom, 16px);
}

[data-theme="dark"] {
  --bg-app: #0F172A;
  --bg-card: #1E293B;
  --bg-surface: #1E293B;
  --bg-surface-secondary: #0F172A;
  --bg-surface-hover: #334155;
  --text-primary: #F8FAFC;
  --text-secondary: #94A3B8;
  --text-muted: #64748B;
  
  --border-color: #334155;
  --border-subtle: #1E293B;

  --chart-empty-ring: #334155;
  --chart-bg-track: #1E293B;

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 12px -2px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 12px 30px -4px rgba(0, 0, 0, 0.6);
}

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

html, body {
  width: 100%;
  height: 100%;
  font-family: var(--font-body);
  background-color: #0B0F19;
  color: var(--text-primary);
  overflow-x: hidden;
  user-select: none;
}

body.modal-open {
  overflow: hidden;
}

/* ==========================================================================
   Auth Screen Overlay (Gatekeeper)
   ========================================================================== */
.auth-screen-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: radial-gradient(circle at 50% 20%, #1E293B 0%, #090D16 100%);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
}

.auth-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 20px;
}

.auth-logo-circle {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: rgba(16, 185, 129, 0.15);
  color: var(--accent-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 8px;
}

.auth-title {
  font-family: var(--font-heading);
  font-size: 24px;
  font-weight: 800;
  color: var(--text-primary);
}

.auth-tagline {
  font-size: 12px;
  color: var(--text-muted);
}

.auth-tabs {
  display: flex;
  background: var(--bg-surface-secondary);
  padding: 4px;
  border-radius: var(--radius-full);
  margin-bottom: 16px;
}

.auth-tab-btn {
  flex: 1;
  background: transparent;
  border: none;
  padding: 8px 0;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all 0.2s ease;
}

.auth-tab-btn.active {
  background: var(--bg-surface);
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
}

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

.auth-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.auth-field label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
}

.auth-input {
  background: var(--bg-surface-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  color: var(--text-primary);
  font-size: 13px;
  outline: none;
}

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

.auth-color-row {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}

.auth-color-dot {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
}

.auth-color-dot.active {
  border-color: #FFFFFF;
  box-shadow: 0 0 0 2px var(--accent-primary);
}

.auth-submit-btn {
  margin-top: 8px;
  padding: 12px;
  font-size: 14px;
}

.auth-locked-warning {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: var(--color-expense);
  padding: 12px;
  border-radius: var(--radius-md);
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.auth-footer {
  display: flex;
  justify-content: center;
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--border-subtle);
}

.auth-admin-link {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 11px;
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  transition: color 0.2s ease;
}

.auth-admin-link:hover {
  color: var(--text-primary);
}

/* ==========================================================================
   App Frame & Viewport
   ========================================================================== */
.app-viewport {
  width: 100%;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  background: radial-gradient(circle at 50% 0%, #1E293B 0%, #090D16 100%);
  padding: 20px 0;
  transition: all 0.3s ease;
}

.mode-phone .mobile-frame {
  width: 100%;
  max-width: 440px;
  height: 920px;
  max-height: 95vh;
  background: var(--bg-surface-secondary);
  border-radius: 44px;
  box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.7), 0 0 0 10px #1E293B, 0 0 0 12px #334155;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

.mode-fluid { padding: 0; }
.mode-fluid .mobile-frame {
  width: 100%;
  max-width: 800px;
  height: 100vh;
  max-height: 100vh;
  border-radius: 0;
  box-shadow: none;
  background: var(--bg-surface-secondary);
}

@media (max-width: 600px) {
  .app-viewport { padding: 0; background: var(--bg-surface-secondary); }
  .mobile-frame { width: 100% !important; max-width: 100% !important; height: 100vh !important; max-height: 100vh !important; border-radius: 0 !important; box-shadow: none !important; }
}

.phone-notch {
  width: 100%;
  height: 24px;
  background: var(--bg-surface-secondary);
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  z-index: 10;
}

.phone-speaker {
  width: 50px;
  height: 4px;
  background: var(--border-color);
  border-radius: 4px;
}

/* Top Family Room Bar */
.top-family-bar {
  background: var(--bg-surface);
  padding: 8px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-subtle);
}

.family-budget-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-surface-secondary);
  border: 1px solid var(--border-color);
  padding: 4px 10px 4px 6px;
  border-radius: var(--radius-full);
  cursor: pointer;
  color: var(--text-primary);
  transition: all 0.2s ease;
}

.family-budget-btn:hover {
  background: var(--bg-surface-hover);
}

.room-members-stack {
  display: flex;
  align-items: center;
}

.member-avatar-mini {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  color: #FFFFFF;
  border: 2px solid var(--bg-surface);
  margin-left: -6px;
}

.member-avatar-mini:first-child { margin-left: 0; }
.member-avatar-mini.count { background: var(--bg-surface-hover); color: var(--text-secondary); }

.room-text-info {
  display: flex;
  align-items: center;
  gap: 4px;
}

.room-name {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-primary);
  max-width: 110px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.room-arrow-down {
  color: var(--text-muted);
  display: flex;
  align-items: center;
}

.manual-sync-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.manual-sync-btn.has-pending svg {
  color: #F59E0B;
}

.sync-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  background: #F59E0B;
  color: #FFFFFF;
  font-size: 9px;
  font-weight: 800;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

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

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

/* App Header Top Bar */
.app-header {
  background: var(--bg-surface);
  padding: 10px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  z-index: 20;
}

.account-selector-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-surface-hover);
  border: 1px solid var(--border-color);
  padding: 6px 14px 6px 10px;
  border-radius: var(--radius-full);
  cursor: pointer;
  color: var(--text-primary);
  transition: all 0.2s ease;
}

.account-selector-btn:hover { background: var(--border-color); }

.account-badge-icon {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.account-info-wrap {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
}

.account-name-label {
  font-size: 10px;
  color: var(--text-muted);
  font-weight: 500;
  line-height: 1.1;
}

.account-balance-val {
  font-family: var(--font-heading);
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: transparent;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
}

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

/* Time Period Navigation */
.period-bar {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
}

.period-tabs {
  display: flex;
  justify-content: space-around;
  padding: 4px 8px;
  border-bottom: 1px solid var(--border-subtle);
}

.period-tab {
  background: transparent;
  border: none;
  padding: 8px 10px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: var(--radius-sm);
  position: relative;
  transition: all 0.2s ease;
}

.period-tab.active { color: var(--text-primary); }
.period-tab.active::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 20%;
  right: 20%;
  height: 3px;
  background: var(--accent-primary);
  border-radius: 3px;
}

.period-nav-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 14px;
}

.period-arrow-btn {
  background: transparent;
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.2s ease;
}

.period-arrow-btn:hover { background: var(--bg-surface-hover); }

.period-label-btn {
  background: transparent;
  border: none;
  font-family: var(--font-heading);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  cursor: pointer;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
}

.period-label-btn:hover { background: var(--bg-surface-hover); }

/* App Scrollable Content */
.app-content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding-bottom: 90px;
  display: flex;
  flex-direction: column;
  position: relative;
}

/* Monefy Wheel & Donut Stage */
.monefy-stage-container {
  position: relative;
  width: 100%;
  padding: 10px 8px 12px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  flex-shrink: 0;
  box-sizing: border-box;
}

.donut-chart-container {
  position: relative;
  width: 220px;
  height: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
  flex-shrink: 0;
  margin: 0 auto;
}

.donut-wrapper {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.donut-svg {
  width: 100%;
  height: 100%;
  transform-origin: center;
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.08));
}

.donut-segment { cursor: pointer; }
.donut-segment.is-selected { filter: drop-shadow(0 0 8px currentColor); }
.donut-segment.is-dimmed { opacity: 0.25; }

.donut-center-overlay {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 148px;
  height: 148px;
  border-radius: 50%;
  background: var(--bg-surface);
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.08), var(--shadow-sm);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 6px;
  pointer-events: auto;
}

.donut-label {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 2px;
}

.donut-balance {
  font-family: var(--font-heading);
  font-size: 16px;
  font-weight: 800;
  line-height: 1.1;
  margin-bottom: 4px;
}

.donut-balance.positive { color: var(--color-income); }
.donut-balance.negative { color: var(--color-expense); }

.donut-sub-stats {
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: 100%;
}

.donut-stat {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-size: 10.5px;
  font-weight: 600;
}

.donut-stat.income { color: var(--color-income); }
.donut-stat.expense { color: var(--color-expense); }

.stat-dot { width: 6px; height: 6px; border-radius: 50%; }
.stat-dot.green { background: var(--color-income); }
.stat-dot.red { background: var(--color-expense); }

/* Center Category Highlight Card */
.donut-center-details {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.donut-center-cat-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 2px;
}

.donut-center-cat-name {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-primary);
  max-width: 110px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.donut-center-cat-amount {
  font-family: var(--font-heading);
  font-size: 14px;
  font-weight: 800;
}

.donut-center-cat-pct {
  font-size: 9.5px;
  color: var(--text-muted);
  margin-bottom: 2px;
}

.donut-center-reset-btn {
  background: var(--bg-surface-hover);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  font-size: 9.5px;
  padding: 2px 8px;
  display: flex;
  align-items: center;
  gap: 3px;
  color: var(--text-secondary);
  cursor: pointer;
}

/* Categories Grid */
.categories-ring-container {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px 4px;
  padding: 12px 6px 14px 6px;
  box-sizing: border-box;
  flex-shrink: 0;
  clear: both;
  z-index: 1;
}

.ring-cat-node {
  background: transparent;
  border: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  cursor: pointer;
  position: relative;
  transition: transform 0.15s ease;
  width: 100%;
  box-sizing: border-box;
}

.ring-cat-node:hover { transform: translateY(-2px); }
.ring-cat-node:active { transform: scale(0.94); }

.ring-cat-bubble {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--bg-surface);
  border: 2px solid var(--node-color);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  color: var(--node-color);
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.ring-cat-node.has-data .ring-cat-bubble {
  background: var(--node-color);
  color: #FFFFFF;
}

.ring-cat-node.is-selected .ring-cat-bubble {
  box-shadow: 0 0 0 4px var(--node-color) 44, var(--shadow-md);
  transform: scale(1.08);
}

.ring-cat-badge {
  position: absolute;
  top: -6px;
  right: -8px;
  background: var(--bg-card);
  color: var(--node-color);
  border: 1px solid var(--node-color);
  font-size: 8.5px;
  font-weight: 700;
  padding: 1px 4px;
  border-radius: 8px;
  box-shadow: var(--shadow-sm);
  white-space: nowrap;
  z-index: 3;
}

.ring-cat-title {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-top: 4px;
  text-align: center;
  width: 100%;
  max-width: 74px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
}

/* Budget Card with Collaborative Breakdown */
.budget-progress-container {
  width: 100%;
  padding: 0 16px;
  margin: 6px 0 14px 0;
  box-sizing: border-box;
  flex-shrink: 0;
  clear: both;
  position: relative;
  z-index: 2;
}

.budget-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  box-shadow: var(--shadow-sm);
  width: 100%;
  box-sizing: border-box;
}

.budget-card.over-budget {
  border-color: var(--color-expense);
  background: rgba(239, 68, 68, 0.05);
}

.budget-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  margin-bottom: 6px;
}

.budget-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  color: var(--text-primary);
}

.budget-values { font-family: var(--font-heading); }
.budget-spent { font-weight: 700; color: var(--text-primary); }
.budget-total { color: var(--text-muted); }

.budget-progress-bar {
  width: 100%;
  height: 6px;
  background: var(--bg-surface-secondary);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 6px;
}

.budget-progress-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.4s ease;
}

.budget-card-footer {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-muted);
}

.budget-members-breakdown {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--border-subtle);
}

.member-stat-pill {
  background: var(--bg-surface-secondary);
  border: 1px solid var(--border-color);
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  font-size: 10px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.member-stat-name { color: var(--text-secondary); font-weight: 600; }
.member-stat-val { font-weight: 700; color: var(--text-primary); }

/* Transactions Feed */
.history-section-container {
  width: 100%;
  padding: 0 16px;
  margin: 4px 0 20px 0;
  box-sizing: border-box;
  flex-shrink: 0;
  clear: both;
}

.history-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  margin-bottom: 8px;
}

.history-section-title {
  font-family: var(--font-heading);
  font-size: 14px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.badge-count {
  background: var(--bg-surface-hover);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--radius-full);
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 600;
  margin-bottom: 10px;
}

.filter-chip button {
  background: transparent;
  border: none;
  cursor: pointer;
  color: inherit;
  display: flex;
  align-items: center;
}

.tx-day-group {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  margin-bottom: 12px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.tx-day-header {
  background: var(--bg-surface-secondary);
  padding: 8px 14px;
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-color);
}

.tx-day-total.positive { color: var(--color-income); }
.tx-day-total.negative { color: var(--color-expense); }

.tx-items-wrapper { display: flex; flex-direction: column; }

.tx-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-subtle);
  cursor: pointer;
  transition: background 0.15s ease;
}

.tx-item:last-child { border-bottom: none; }
.tx-item:hover { background: var(--bg-surface-hover); }

.tx-icon-wrap {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.tx-info { flex: 1; display: flex; flex-direction: column; gap: 2px; }

.tx-main-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.tx-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.tx-amount {
  font-family: var(--font-heading);
  font-size: 13px;
  font-weight: 700;
}

.tx-amount.expense { color: var(--color-expense); }
.tx-amount.income { color: var(--color-income); }
.tx-amount.transfer { color: var(--color-transfer); }

.tx-sub-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  color: var(--text-muted);
}

.tx-author-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
}

.author-dot { width: 5px; height: 5px; border-radius: 50%; }
.tx-account-tag { font-weight: 600; color: var(--text-secondary); }
.tx-note { color: var(--text-secondary); font-style: italic; }

.tx-delete-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  transition: color 0.15s ease;
}

.tx-delete-btn:hover { color: var(--color-expense); }

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  color: var(--text-muted);
  text-align: center;
}

.empty-state svg { margin-bottom: 12px; opacity: 0.4; }
.empty-state p { font-size: 13px; }

/* Floating Bottom Action Bar */
.bottom-action-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 12px 24px calc(var(--safe-area-bottom) + 6px) 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: linear-gradient(to top, var(--bg-surface-secondary) 80%, rgba(15, 23, 42, 0) 100%);
  z-index: 30;
  pointer-events: none;
}

.fab-btn {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: none;
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  pointer-events: auto;
  transition: transform 0.15s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.2s ease;
}

.fab-btn:active { transform: scale(0.92); }
.fab-expense { background: linear-gradient(135deg, #EF4444 0%, #DC2626 100%); box-shadow: var(--shadow-fab-red); }
.fab-income { background: linear-gradient(135deg, #10B981 0%, #059669 100%); box-shadow: var(--shadow-fab-green); }

.fab-transfer {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  color: var(--color-transfer);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  pointer-events: auto;
  box-shadow: var(--shadow-md);
  transition: all 0.2s ease;
}

.fab-transfer:active { transform: scale(0.92); }

/* ==========================================================================
   Modals & Keypad
   ========================================================================== */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.modal-backdrop.is-open { opacity: 1; pointer-events: auto; }

.keypad-sheet {
  width: 100%;
  max-width: 440px;
  background: var(--bg-surface);
  border-top-left-radius: var(--radius-xl);
  border-top-right-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  padding: 16px 20px calc(var(--safe-area-bottom) + 12px) 20px;
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1);
  display: flex;
  flex-direction: column;
  max-height: 92vh;
  overflow-y: auto;
}

.modal-backdrop.is-open .keypad-sheet { transform: translateY(0); }

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

.keypad-close-btn, .keypad-done-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--text-secondary);
  padding: 6px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.keypad-done-btn { color: var(--accent-primary); background: rgba(16, 185, 129, 0.12); }

.keypad-type-switcher {
  display: flex;
  background: var(--bg-surface-secondary);
  padding: 3px;
  border-radius: var(--radius-full);
}

.type-pill {
  background: transparent;
  border: none;
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all 0.2s ease;
}

.type-pill.active { background: var(--bg-surface); color: var(--text-primary); box-shadow: var(--shadow-sm); }
.expense-theme .type-pill.active { color: var(--color-expense); }
.income-theme .type-pill.active { color: var(--color-income); }
.transfer-theme .type-pill.active { color: var(--color-transfer); }

.keypad-meta-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  overflow-x: auto;
}

.meta-chip-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-surface-secondary);
  border: 1px solid var(--border-color);
  padding: 6px 10px;
  border-radius: var(--radius-md);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  cursor: pointer;
  white-space: nowrap;
}

.chip-icon {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.meta-select, .meta-select-compact {
  background: var(--bg-surface-secondary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  font-size: 12px;
  font-weight: 500;
  padding: 6px 10px;
  border-radius: var(--radius-md);
  outline: none;
  cursor: pointer;
}

.meta-date-input {
  background: var(--bg-surface-secondary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  font-size: 11px;
  padding: 5px 8px;
  border-radius: var(--radius-md);
  outline: none;
}

.transfer-accounts-picker {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
}

.transfer-arrow-icon { color: var(--color-transfer); }

.meta-field { display: flex; flex-direction: column; gap: 2px; }
.meta-field label { font-size: 10px; color: var(--text-muted); }

.keypad-note-row { margin-bottom: 12px; }
.keypad-note-input {
  width: 100%;
  background: var(--bg-surface-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 8px 12px;
  font-size: 13px;
  color: var(--text-primary);
  outline: none;
}
.keypad-note-input:focus { border-color: var(--accent-primary); }

.keypad-display-wrapper {
  background: var(--bg-surface-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.keypad-currency-symbol {
  font-family: var(--font-heading);
  font-size: 24px;
  font-weight: 700;
  color: var(--text-muted);
  margin-right: 8px;
}

.keypad-expression-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  margin-right: 12px;
}

.keypad-expression {
  font-family: var(--font-heading);
  font-size: 28px;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.5px;
  word-break: break-all;
  text-align: right;
}

.keypad-eval-result {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent-primary);
}

.keypad-backspace-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 6px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.keypad-quick-categories {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 10px;
  margin-bottom: 10px;
  scrollbar-width: none;
}
.keypad-quick-categories::-webkit-scrollbar { display: none; }

.quick-cat-btn {
  background: var(--bg-surface-secondary);
  border: 1px solid var(--border-color);
  padding: 6px 10px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-secondary);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.quick-cat-btn.active {
  background: var(--cat-color);
  border-color: var(--cat-color);
  color: #FFFFFF;
  box-shadow: var(--shadow-sm);
}

.quick-cat-icon { display: flex; align-items: center; }
.quick-cat-text { font-size: 11px; font-weight: 600; }

.keypad-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}

.k-btn {
  height: 52px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-surface-secondary);
  color: var(--text-primary);
  font-family: var(--font-heading);
  font-size: 20px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.1s ease;
}

.k-btn:active { transform: scale(0.95); background: var(--border-color); }
.k-btn.op { background: var(--bg-surface); color: var(--text-secondary); font-size: 18px; font-weight: 700; }

.keypad-action-submit-btn {
  width: 100%;
  padding: 14px;
  border-radius: var(--radius-lg);
  border: none;
  font-family: var(--font-heading);
  font-size: 15px;
  font-weight: 700;
  color: #FFFFFF;
  cursor: pointer;
  transition: transform 0.15s ease, opacity 0.2s ease;
}

.expense-theme .keypad-action-submit-btn { background: linear-gradient(135deg, #EF4444 0%, #DC2626 100%); box-shadow: var(--shadow-fab-red); }
.income-theme .keypad-action-submit-btn { background: linear-gradient(135deg, #10B981 0%, #059669 100%); box-shadow: var(--shadow-fab-green); }
.transfer-theme .keypad-action-submit-btn { background: linear-gradient(135deg, #6366F1 0%, #4F46E5 100%); }

.modal-card {
  width: 100%;
  max-width: 440px;
  background: var(--bg-surface);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  padding: 20px;
  margin: auto 12px;
  transform: scale(0.95);
  transition: transform 0.25s ease;
  max-height: 88vh;
  overflow-y: auto;
}

.modal-backdrop.is-open .modal-card { transform: scale(1); }

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
  font-family: var(--font-heading);
  font-size: 16px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.modal-close-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 4px;
}

/* ==========================================================================
   Multi-Budget Switcher & Admin Panel
   ========================================================================== */
.budget-switcher-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.budget-select-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-surface-secondary);
  border: 1px solid var(--border-color);
  padding: 10px 14px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s ease;
}

.budget-select-item.active {
  border-color: var(--accent-primary);
  background: rgba(16, 185, 129, 0.08);
}

.budget-item-icon {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(16, 185, 129, 0.15);
  color: var(--accent-primary);
  display: flex;
  align-items: center;
  justify-content: center;
}

.budget-item-info { flex: 1; }
.budget-item-title { font-size: 13px; font-weight: 700; color: var(--text-primary); }
.budget-item-members { font-size: 10px; color: var(--text-muted); }

.budget-active-badge {
  background: var(--accent-primary);
  color: #FFFFFF;
  font-size: 10px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: var(--radius-full);
}

.budget-room-card {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.1) 0%, rgba(59, 130, 246, 0.1) 100%);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 14px;
  margin-bottom: 12px;
}

.room-card-title-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
}

.room-main-title { font-family: var(--font-heading); font-size: 16px; font-weight: 800; }
.room-subtitle { font-size: 11px; color: var(--accent-primary); font-weight: 600; }

.invite-box {
  background: var(--bg-surface);
  border: 1px dashed var(--border-color);
  border-radius: var(--radius-md);
  padding: 10px;
}

.invite-code-display {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.invite-code-label { font-size: 10px; color: var(--text-muted); font-weight: 700; }
.invite-code-value {
  font-family: monospace;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 1px;
  color: var(--accent-primary);
  background: var(--bg-surface-secondary);
  padding: 2px 8px;
  border-radius: 4px;
}

.invite-buttons-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.btn-primary { background: var(--accent-primary); color: #FFFFFF; }
.btn-sm { padding: 6px 10px; font-size: 11px; }

.members-list-box { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }

.member-row {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-surface-secondary);
  border: 1px solid var(--border-color);
  padding: 8px 12px;
  border-radius: var(--radius-md);
}

.member-avatar-lg {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: #FFFFFF;
  font-size: 13px;
}

.member-row-info { flex: 1; }
.member-row-name { font-size: 13px; font-weight: 600; }
.you-badge { color: var(--accent-primary); font-size: 10px; font-weight: 700; }
.member-row-role { font-size: 10px; color: var(--text-muted); }
.online-status-dot { width: 8px; height: 8px; border-radius: 50%; background: #10B981; }

.room-switch-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border-subtle);
}

/* Admin Dashboard Specific */
.admin-control-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-surface-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px;
}

.admin-control-info { display: flex; flex-direction: column; gap: 2px; }
.admin-control-title { font-size: 13px; font-weight: 700; }
.admin-control-desc { font-size: 11px; color: var(--text-muted); max-width: 260px; }

.admin-db-list, .admin-users-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 180px;
  overflow-y: auto;
}

.admin-db-row {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-surface-secondary);
  border: 1px solid var(--border-color);
  padding: 8px 12px;
  border-radius: var(--radius-md);
}

.db-icon { font-size: 20px; }
.db-name { font-size: 12px; font-weight: 700; }
.db-meta { font-size: 10px; color: var(--text-muted); }
.db-meta code { background: rgba(0, 0, 0, 0.2); padding: 1px 4px; border-radius: 3px; }

.admin-user-row {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-surface-secondary);
  border: 1px solid var(--border-color);
  padding: 6px 10px;
  border-radius: var(--radius-md);
}

.user-row-text { display: flex; flex-direction: column; }
.user-row-name { font-size: 12px; font-weight: 600; }
.user-row-email { font-size: 10px; color: var(--text-muted); }

/* Collaborator Push Toast */
.collab-toast-content { display: flex; align-items: center; gap: 10px; }
.collab-toast-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #FFFFFF;
  font-weight: 700;
  font-size: 11px;
}
.collab-toast-text { font-size: 12px; }

/* Settings */
.settings-body { display: flex; flex-direction: column; gap: 14px; }
.setting-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-subtle);
}

.setting-info { display: flex; flex-direction: column; gap: 2px; }
.setting-title { font-size: 13px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.setting-desc { font-size: 11px; color: var(--text-muted); }

.theme-switch-pills { display: flex; background: var(--bg-surface-secondary); padding: 3px; border-radius: var(--radius-full); }
.theme-switch-pills .pill {
  background: transparent;
  border: none;
  padding: 5px 12px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  border-radius: var(--radius-full);
  cursor: pointer;
}
.theme-switch-pills .pill.active { background: var(--bg-surface); color: var(--text-primary); box-shadow: var(--shadow-sm); }

.settings-select, .settings-num-input {
  background: var(--bg-surface-secondary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 6px 10px;
  border-radius: var(--radius-md);
  font-size: 12px;
  outline: none;
}

.setting-section-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  font-weight: 700;
  margin-top: 8px;
}

.settings-buttons-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

.btn {
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: none;
  transition: all 0.2s ease;
}

.btn-secondary { background: var(--bg-surface-secondary); color: var(--text-primary); border: 1px solid var(--border-color); }
.btn-secondary:hover { background: var(--border-color); }
.btn-outline { background: transparent; border: 1px solid var(--border-color); color: var(--text-secondary); }
.btn-danger-outline { background: transparent; border: 1px solid rgba(239, 68, 68, 0.4); color: var(--color-expense); }
.full-width { width: 100%; }

.toggle-switch { position: relative; display: inline-block; width: 44px; height: 24px; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: var(--border-color);
  transition: .3s;
  border-radius: 24px;
}
.slider:before {
  position: absolute;
  content: "";
  height: 18px; width: 18px;
  left: 3px; bottom: 3px;
  background-color: white;
  transition: .3s;
  border-radius: 50%;
}
input:checked + .slider { background-color: var(--accent-primary); }
input:checked + .slider:before { transform: translateX(20px); }

/* Toast Notification */
.app-toast {
  position: fixed;
  bottom: calc(var(--safe-area-bottom) + 85px);
  left: 50%;
  transform: translateX(-50%) translateY(30px);
  background: #1E293B;
  color: #FFFFFF;
  padding: 10px 20px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  pointer-events: none;
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  z-index: 2000;
  white-space: nowrap;
}

.app-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.animate-scale-in { animation: scaleIn 0.25s cubic-bezier(0.34, 1.56, 0.64, 1); }
.animate-fade-in { animation: fadeIn 0.2s ease-in; }

@keyframes scaleIn { 0% { transform: scale(0.85); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }
@keyframes fadeIn { 0% { opacity: 0; transform: translateY(4px); } 100% { opacity: 1; transform: translateY(0); } }

/* ==========================================================================
   Comprehensive Responsive Breakpoints (All Screen Sizes)
   ========================================================================== */

/* Extra Small Phones (<= 375px, e.g. iPhone SE, Galaxy A-series) */
@media (max-width: 375px) {
  .donut-chart-container {
    width: 190px;
    height: 190px;
  }
  .donut-center-overlay {
    width: 128px;
    height: 128px;
    padding: 4px;
  }
  .donut-balance {
    font-size: 14px;
  }
  .donut-stat {
    font-size: 9.5px;
  }
  .categories-ring-container {
    gap: 8px 2px;
    padding: 8px 4px 12px 4px;
  }
  .ring-cat-bubble {
    width: 38px;
    height: 38px;
  }
  .ring-cat-bubble svg {
    width: 18px;
    height: 18px;
  }
  .ring-cat-title {
    font-size: 9px;
    max-width: 62px;
  }
  .ring-cat-badge {
    font-size: 8px;
    padding: 1px 3px;
  }
  .budget-progress-container,
  .history-section-container {
    padding: 0 10px;
  }
  .bottom-action-bar {
    padding: 10px 16px calc(var(--safe-area-bottom) + 4px) 16px;
  }
  .fab-btn {
    width: 52px;
    height: 52px;
  }
}

/* Medium / Tablets / Fluid Mode (>= 600px) */
@media (min-width: 600px) {
  .categories-ring-container {
    grid-template-columns: repeat(7, 1fr);
    gap: 14px 8px;
    padding: 16px 12px;
  }
  .ring-cat-bubble {
    width: 48px;
    height: 48px;
  }
  .ring-cat-title {
    font-size: 11px;
    max-width: 80px;
  }
}

/* ============================================================================
 * Custom UI Modals, Pickers, Toggles & Management Components
 * ============================================================================ */

/* Toggle Switch */
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  background: var(--bg-surface-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  margin: 6px 0;
  gap: 12px;
}

.toggle-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.toggle-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.toggle-desc {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.3;
}

.toggle-switch {
  position: relative;
  display: inline-block;
  width: 46px;
  height: 26px;
  flex-shrink: 0;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--bg-surface-elevated, #334155);
  border: 1px solid var(--border-color);
  transition: .25s ease;
  border-radius: 26px;
}

.toggle-slider:before {
  position: absolute;
  content: "";
  height: 20px;
  width: 20px;
  left: 2px;
  bottom: 2px;
  background-color: white;
  transition: .25s ease;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.toggle-switch input:checked + .toggle-slider {
  background-color: var(--accent-primary);
  border-color: var(--accent-primary);
}

.toggle-switch input:checked + .toggle-slider:before {
  transform: translateX(20px);
}

/* Color Picker Grid */
.color-picker-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 8px;
  padding: 8px 0;
}

.color-circle-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  justify-content: center;
  outline: none;
}

.color-circle-btn:hover {
  transform: scale(1.15);
}

.color-circle-btn.active {
  border-color: #FFFFFF;
  box-shadow: 0 0 0 2px var(--accent-primary), 0 2px 8px rgba(0,0,0,0.3);
  transform: scale(1.1);
}

/* Icon Picker Grid */
.icon-picker-container {
  max-height: 180px;
  overflow-y: auto;
  padding: 8px;
  background: var(--bg-surface-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  margin-top: 4px;
}

.icon-picker-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
}

.icon-picker-item {
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.18s ease;
}

.icon-picker-item:hover {
  background: var(--bg-surface-elevated);
  color: var(--text-primary);
  border-color: var(--accent-primary);
}

.icon-picker-item.active {
  background: var(--accent-primary);
  color: #FFFFFF;
  border-color: var(--accent-primary);
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.4);
}

/* Live Preview Card for Categories */
.live-preview-card {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 8px;
  padding: 16px;
  background: var(--bg-surface-secondary);
  border-radius: var(--radius-md);
  border: 1px dashed var(--border-color);
  margin-bottom: 12px;
}

.preview-bubble {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  transition: all 0.2s ease;
}

.preview-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
}

/* Management Lists (Categories & Accounts) */
.manage-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 380px;
  overflow-y: auto;
  padding-right: 4px;
  margin-bottom: 16px;
}

.manage-item-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  background: var(--bg-surface-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  transition: all 0.2s ease;
  gap: 10px;
}

.manage-item-row:hover {
  border-color: var(--border-focus);
  background: var(--bg-surface-elevated);
}

.manage-item-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}

.manage-icon-wrap {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.manage-info-wrap {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.manage-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.manage-meta {
  font-size: 11px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.badge-excluded {
  background: rgba(239, 68, 68, 0.15);
  color: #EF4444;
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 9.5px;
  font-weight: 600;
}

.badge-included {
  background: rgba(16, 185, 129, 0.15);
  color: #10B981;
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 9.5px;
  font-weight: 600;
}

.manage-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.action-icon-btn {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.18s ease;
}

.action-icon-btn:hover {
  background: var(--bg-surface-secondary);
  color: var(--text-primary);
  border-color: var(--accent-primary);
}

.action-icon-btn.danger:hover {
  background: rgba(239, 68, 68, 0.15);
  color: #EF4444;
  border-color: #EF4444;
}

/* Custom Confirmation Modal */
.confirm-modal-box {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
}

.confirm-icon-circle {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 4px;
}

.confirm-icon-circle.danger {
  background: rgba(239, 68, 68, 0.15);
  color: #EF4444;
}

.confirm-icon-circle.primary {
  background: rgba(16, 185, 129, 0.15);
  color: #10B981;
}

.confirm-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
}

.confirm-desc {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.4;
  margin-bottom: 8px;
}

.confirm-actions-row {
  display: flex;
  gap: 10px;
  width: 100%;
}

.confirm-actions-row .btn {
  flex: 1;
}

/* Transfer Multi-Currency FX Box */
.transfer-fx-container {
  background: var(--bg-surface-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  margin: 6px 14px 10px 14px;
}

.transfer-fx-header {
  font-size: 11px;
  font-weight: 700;
  color: var(--accent-primary);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

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

.transfer-fx-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.transfer-fx-field label {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
}

.transfer-fx-input {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 700;
  outline: none;
  width: 100%;
}

.transfer-fx-input:focus {
  border-color: var(--accent-primary);
}

/* Category Tab Buttons */
.category-tab-bar {
  display: flex;
  background: var(--bg-surface-secondary);
  padding: 4px;
  border-radius: var(--radius-full);
  margin-bottom: 14px;
}

.category-tab-btn {
  flex: 1;
  background: transparent;
  border: none;
  padding: 8px 0;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all 0.2s ease;
}

.category-tab-btn.active {
  background: var(--bg-surface);
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
}

/* Carryover / Rollover Balance Indicators */
.donut-carryover-stat {
  margin-top: 5px;
  font-size: 10px;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.04);
  padding: 2px 8px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-subtle);
  max-width: 90%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.budget-carryover-pill {
  animation: fadeIn 0.2s ease-in;
}

/* ============================================================================
 * Collapsible Categories Section
 * ============================================================================ */
.categories-control-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  max-width: 520px;
  padding: 4px 16px 6px 16px;
  margin-top: 6px;
}

.categories-control-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}

.categories-collapse-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.categories-collapse-btn:hover {
  background: var(--bg-surface-elevated);
  color: var(--text-primary);
  border-color: var(--accent-primary);
}

.categories-ring-container {
  transition: max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.25s ease, padding 0.3s ease;
  max-height: 400px;
  overflow: hidden;
}

.categories-ring-container.is-collapsed {
  max-height: 0;
  padding-top: 0 !important;
  padding-bottom: 0 !important;
  opacity: 0;
  pointer-events: none;
  margin: 0 !important;
}

/* ============================================================================
 * Search Active Banner & Live Search Modal
 * ============================================================================ */
.search-active-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(99, 102, 241, 0.12);
  border: 1px solid rgba(99, 102, 241, 0.3);
  padding: 8px 12px;
  border-radius: var(--radius-md);
  margin-bottom: 12px;
  gap: 8px;
  animation: fadeIn 0.25s ease;
}

.search-banner-info {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: #818CF8;
  flex: 1;
}

.btn-cancel-search {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #EF4444;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.btn-cancel-search:hover {
  background: #EF4444;
  color: #FFFFFF;
}

.modal-card-search {
  max-width: 480px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
}

.search-modal-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
  padding-bottom: 4px;
}

.search-live-header {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  margin-top: 10px;
  margin-bottom: 6px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.search-live-results-list {
  flex: 1;
  overflow-y: auto;
  max-height: 280px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-right: 4px;
  margin-bottom: 10px;
}

.search-empty-results {
  text-align: center;
  padding: 28px 12px;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.search-empty-results p {
  font-size: 13px;
}

.search-modal-actions {
  padding-top: 8px;
  border-top: 1px solid var(--border-color);
}



