/* ==========================================================================
   ACCOUNTA - Modern Fintech Design System
   ========================================================================== */

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

:root {
  /* Brand Core Palette */
  --bg: #070d18;
  --bg-deep: #030712;
  --bg-surface: rgba(13, 21, 38, 0.72);
  --card: rgba(13, 22, 40, 0.68);
  --card-hover: rgba(19, 32, 58, 0.85);
  --muted: #94a3b8;
  --muted-dark: #64748b;
  --muted-light: #cbd5e1;
  
  /* Accents */
  --accent: #10b981;
  --accent-bright: #34d399;
  --accent-glow: rgba(16, 185, 129, 0.35);
  --accent-bg: rgba(16, 185, 129, 0.12);
  --cyan: #06b6d4;
  --cyan-bright: #38bdf8;
  --cyan-glow: rgba(6, 182, 212, 0.3);
  --danger: #f43f5e;
  --danger-bright: #fb7185;
  --danger-bg: rgba(244, 63, 94, 0.12);
  --warning: #f59e0b;
  --text: #f8fafc;
  
  /* Glassmorphism & Borders */
  --glass: rgba(255, 255, 255, 0.04);
  --glass-2: rgba(255, 255, 255, 0.02);
  --glass-strong: rgba(255, 255, 255, 0.07);
  --line: rgba(255, 255, 255, 0.08);
  --line-soft: rgba(255, 255, 255, 0.05);
  --line-glow: rgba(16, 185, 129, 0.4);
  --panel: rgba(255, 255, 255, 0.03);
  --panel-strong: rgba(255, 255, 255, 0.06);
  
  /* Shadows & Elevations */
  --shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.25);
  --shadow: 0 16px 40px -10px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 24px 60px -12px rgba(0, 0, 0, 0.65);
  --shadow-glow: 0 0 35px -5px rgba(16, 185, 129, 0.2);
  
  /* Radii */
  --radius-xs: 6px;
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-full: 9999px;

  /* Typography */
  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, monospace;

  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html, body, #root {
  height: 100%;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  background: var(--bg);
  min-height: 100vh;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  position: relative;
  overflow-x: hidden;
}

/* Ambient Background Glow Orbs */
.ambient-glow {
  position: fixed;
  width: 600px;
  height: 600px;
  border-radius: 50%;
  pointer-events: none;
  z-index: -1;
  filter: blur(120px);
  opacity: 0.45;
  will-change: transform;
}

.ambient-glow-top {
  top: -200px;
  left: 10%;
  background: radial-gradient(circle, rgba(16, 185, 129, 0.25) 0%, rgba(6, 182, 212, 0.15) 50%, transparent 70%);
  animation: floatOrb 18s ease-in-out infinite alternate;
}

.ambient-glow-bottom {
  bottom: -200px;
  right: 5%;
  background: radial-gradient(circle, rgba(6, 182, 212, 0.2) 0%, rgba(99, 102, 241, 0.12) 50%, transparent 70%);
  animation: floatOrb 22s ease-in-out infinite alternate-reverse;
}

@keyframes floatOrb {
  0% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(40px, 30px) scale(1.08); }
  100% { transform: translate(-30px, -20px) scale(0.95); }
}

/* Scrollbar Customization */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: rgba(7, 13, 24, 0.8);
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.14);
  border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(16, 185, 129, 0.5);
}

/* Base Layout */
.app {
  max-width: 1040px;
  margin: 32px auto;
  padding: 0 24px 48px;
  position: relative;
}

.app-narrow {
  max-width: 480px;
}

/* Page Header & Brand */
.header {
  margin-bottom: 24px;
}

.header-shell,
.page-header-top,
.section-header,
.inline-stack,
.control-row,
.split-grid,
.stats-grid,
.settings-row,
.brand-block,
.brand-row,
.header-actions,
.header-title-row,
.table-header,
.table-row,
.button-row,
.filter-row {
  display: flex;
}

.page-header {
  margin-bottom: 24px;
}

.page-header-top {
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 12px 0;
}

.brand-row {
  align-items: center;
  gap: 16px;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
}

.brand-logo-wrap {
  position: relative;
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.brand-logo-wrap-lg {
  width: 72px;
  height: 72px;
}

.brand-logo-wrap:hover {
  transform: scale(1.08) rotate(2deg);
}

.brand-logo {
  width: 100%;
  height: 100%;
  object-fit: contain;
  position: relative;
  z-index: 2;
  filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.4));
}

.brand-glow {
  position: absolute;
  inset: -4px;
  background: radial-gradient(circle, var(--accent) 0%, var(--cyan) 60%, transparent 80%);
  border-radius: 50%;
  opacity: 0.35;
  filter: blur(12px);
  z-index: 1;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.brand-logo-wrap:hover .brand-glow {
  opacity: 0.75;
  transform: scale(1.2);
}

.brand-block {
  flex-direction: column;
  gap: 2px;
}

.brand-title-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.page-title {
  font-size: 1.85rem;
  font-weight: 800;
  margin: 0;
  letter-spacing: -0.03em;
  background: linear-gradient(135deg, #ffffff 40%, var(--muted-light) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-badge {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.2), rgba(6, 182, 212, 0.2));
  border: 1px solid rgba(16, 185, 129, 0.4);
  color: var(--accent-bright);
}

.lead {
  color: var(--muted);
  margin: 0;
  font-size: 13.5px;
  font-weight: 450;
  line-height: 1.4;
}

/* User Menu & Auth Area */
.auth-area {
  position: relative;
}

.auth-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.login-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  font-size: 14px;
}

.user-menu {
  position: relative;
}

.user-menu-trigger {
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.035);
  backdrop-filter: blur(10px);
  color: var(--text);
  cursor: pointer;
  padding: 5px 14px 5px 6px;
  font-weight: 600;
  font-size: 14px;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.user-menu-trigger:hover,
.user-menu-trigger[aria-expanded="true"] {
  border-color: rgba(16, 185, 129, 0.4);
  background: rgba(255, 255, 255, 0.07);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
  transform: translateY(-1px);
}

.user-menu-avatar {
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.25), rgba(6, 182, 212, 0.2));
  color: var(--accent-bright);
  font-size: 12px;
  font-weight: 700;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.user-menu-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.user-menu-name {
  max-width: 130px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-menu-trigger::after {
  content: "";
  width: 6px;
  height: 6px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(45deg) translateY(-2px);
  transition: transform 0.2s ease, border-color 0.2s ease;
  margin-left: 2px;
}

.user-menu-trigger[aria-expanded="true"]::after {
  transform: rotate(225deg) translateY(0);
  border-color: var(--accent);
}

.user-menu-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 50;
  min-width: 190px;
  padding: 6px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-sm);
  background: rgba(10, 16, 30, 0.95);
  backdrop-filter: blur(16px);
  box-shadow: var(--shadow-lg);
  opacity: 0;
  pointer-events: none;
  transform: translateY(-8px) scale(0.97);
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
  visibility: hidden;
}

.user-menu-dropdown.show {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
  visibility: visible;
}

.user-menu-item {
  width: 100%;
  min-height: 38px;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 0;
  border-radius: var(--radius-xs);
  background: transparent;
  color: var(--text);
  cursor: pointer;
  padding: 8px 12px;
  text-align: left;
  font: inherit;
  font-size: 13.5px;
  font-weight: 500;
  transition: all 0.15s ease;
}

.user-menu-item:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--accent-bright);
}

.user-menu-item-icon {
  width: 16px;
  height: 16px;
  stroke-width: 2px;
}

/* ==========================================================================
   Tab Navigation - Modern Floating Pill Bar
   ========================================================================== */

.tab-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px;
  background: rgba(11, 19, 36, 0.7);
  backdrop-filter: blur(16px);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
  overflow-x: auto;
  scrollbar-width: none;
}

.tab-bar::-webkit-scrollbar {
  display: none;
}

.tab-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--muted);
  padding: 9px 14px;
  cursor: pointer;
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  user-select: none;
}

.tab-btn:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  transform: translateY(-1px);
}

.tab-btn.active {
  color: #34d399;
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.18), rgba(6, 182, 212, 0.1));
  border-color: rgba(16, 185, 129, 0.35);
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.15);
}

.tab-icon {
  width: 16px;
  height: 16px;
  stroke-width: 2px;
  transition: transform 0.2s ease, color 0.2s ease;
}

.tab-btn:hover .tab-icon {
  transform: scale(1.1);
}

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

.tab-link {
  text-decoration: none;
}

.tab-btn[hidden] {
  display: none !important;
}

.tab-dynamic-group {
  display: flex;
  gap: 6px;
}

.tab-btn-add {
  padding: 8px 12px;
  font-size: 16px;
  border: 1px dashed rgba(255, 255, 255, 0.2);
}

.tab-btn-add:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.tab-btn-admin {
  margin-left: auto;
}

.tab-btn-admin[hidden] + .tab-btn-settings {
  margin-left: auto;
}

/* ==========================================================================
   Tab Views & Animations
   ========================================================================== */

.tab-view {
  display: none;
}

.tab-view.active {
  display: block;
  animation: viewSlideIn 0.32s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

#add-transaction-view.tab-view.active,
#subscriptions-view.tab-view.active,
#goals-view.tab-view.active {
  display: grid;
}

@keyframes viewSlideIn {
  0% {
    opacity: 0;
    transform: translateY(10px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ==========================================================================
   Modern Cards & Glassmorphism
   ========================================================================== */

.card {
  background: var(--card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  padding: 24px;
  border-radius: var(--radius-md);
  margin-bottom: 20px;
  box-shadow: var(--shadow);
  border: 1px solid var(--line);
  position: relative;
  transition: border-color 0.25s ease, box-shadow 0.25s ease, transform 0.25s ease;
}

.card:hover {
  border-color: rgba(255, 255, 255, 0.12);
}

.card-muted {
  background: rgba(255, 255, 255, 0.02);
}

.card-tight {
  padding: 16px;
}

.section-title,
.panel-title {
  margin: 0;
  letter-spacing: -0.02em;
  font-weight: 700;
}

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

.panel-title {
  font-size: 1.05rem;
  color: var(--text);
}

.header-title-row {
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.section-header {
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.section-header-lg {
  margin-bottom: 22px;
}

.section-stack {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.page-stack {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.inline-stack {
  align-items: center;
  gap: 12px;
}

.inline-stack-wrap {
  flex-wrap: wrap;
}

.inline-gap-sm { gap: 6px; }
.inline-gap-md { gap: 10px; }
.inline-gap-lg { gap: 16px; }

.muted-copy { color: var(--muted); font-size: 14px; }
.meta-copy { color: var(--muted); font-size: 13px; }
.accent-copy { color: var(--accent-bright); }
.danger-copy { color: var(--danger-bright); }

/* ==========================================================================
   Financial Overview - High-Impact Modern Stats
   ========================================================================== */

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-top: 6px;
}

.stat {
  padding: 20px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid var(--line);
  position: relative;
  overflow: hidden;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  text-align: left;
}

.stat::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: transparent;
  transition: background 0.25s ease;
}

.stat:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.35);
  background: rgba(255, 255, 255, 0.04);
}

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

.stat-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.stat-icon svg,
.stat-icon i {
  width: 18px;
  height: 18px;
  stroke-width: 2.2px;
}

.income-icon {
  background: var(--accent-bg);
  color: var(--accent-bright);
}

.expense-icon {
  background: var(--danger-bg);
  color: var(--danger-bright);
}

.net-icon {
  background: rgba(6, 182, 212, 0.15);
  color: var(--cyan-bright);
}

.stat-badge {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.05);
  color: var(--muted);
}

.stat h3 {
  font-family: var(--font-mono);
  font-size: 1.85rem;
  font-weight: 700;
  margin: 0 0 6px 0;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

.stat p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.stat-income::before {
  background: linear-gradient(90deg, var(--accent), var(--cyan));
}
.stat-income h3 {
  color: var(--accent-bright);
  text-shadow: 0 0 24px rgba(16, 185, 129, 0.25);
}

.stat-expense::before {
  background: linear-gradient(90deg, var(--danger), #fb923c);
}
.stat-expense h3 {
  color: var(--danger-bright);
  text-shadow: 0 0 24px rgba(244, 63, 94, 0.25);
}

.stat-net::before {
  background: linear-gradient(90deg, var(--cyan), #818cf8);
}
.stat-net h3 {
  color: var(--cyan-bright);
  text-shadow: 0 0 24px rgba(6, 182, 212, 0.25);
}

/* ==========================================================================
   Form Controls, Inputs & Selects
   ========================================================================== */

.input-card .row {
  display: block;
  margin-bottom: 14px;
}

.input-card .row.two-up,
.input-card .row.split-grid-compact {
  display: grid;
}

.row label {
  display: block;
  color: var(--muted-light);
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 7px;
}

input[type="text"],
input[type="number"],
input[type="password"],
input[type="date"],
input[type="search"],
select {
  width: 100%;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.035);
  color: inherit;
  font-family: inherit;
  font-size: 14px;
  transition: all 0.2s ease;
}

select {
  appearance: none;
  -webkit-appearance: none;
  min-height: 44px;
  padding-right: 36px;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-position: calc(100% - 12px) center;
  background-size: 16px 16px;
  background-repeat: no-repeat;
}

select:hover {
  border-color: rgba(255, 255, 255, 0.16);
  background-color: rgba(255, 255, 255, 0.055);
}

select option {
  background: #0f172a;
  color: var(--text);
  padding: 8px;
}

input:focus,
select:focus {
  outline: none;
  border-color: var(--accent);
  background-color: rgba(255, 255, 255, 0.06);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.18), 0 0 16px rgba(16, 185, 129, 0.1);
}

.input-icon-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.input-icon-wrap .input-icon {
  position: absolute;
  left: 14px;
  width: 18px;
  height: 18px;
  color: var(--muted);
  pointer-events: none;
}

.input-icon-wrap input {
  padding-left: 42px;
}

.search-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.search-input-wrap .search-icon {
  position: absolute;
  left: 10px;
  width: 15px;
  height: 15px;
  color: var(--muted);
  pointer-events: none;
}

.search-input-wrap input {
  padding-left: 32px;
}

.two-up { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.three-up { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.split-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.split-grid-compact { display: grid; grid-template-columns: 2fr 1fr; gap: 12px; }

/* ==========================================================================
   Buttons & Interactive Actions
   ========================================================================== */

.actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 6px;
}

.btn-primary,
.btn-ghost,
.btn-secondary,
.btn-danger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: inherit;
  font-weight: 600;
  font-size: 14px;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  text-decoration: none;
  user-select: none;
}

.btn-primary svg,
.btn-ghost svg,
.btn-secondary svg,
.btn-danger svg {
  width: 16px;
  height: 16px;
  stroke-width: 2.2px;
}

.btn-primary {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  border: none;
  color: #031e13;
  font-weight: 700;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 22px rgba(16, 185, 129, 0.45);
  filter: brightness(1.05);
}

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

.btn-ghost {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--muted-light);
}

.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  border-color: rgba(255, 255, 255, 0.16);
  transform: translateY(-1px);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.09);
  border-color: var(--accent);
  color: var(--accent-bright);
  transform: translateY(-1px);
}

.btn-danger {
  background: var(--danger-bg);
  border: 1px solid rgba(244, 63, 94, 0.35);
  color: var(--danger-bright);
}

.btn-danger:hover {
  background: rgba(244, 63, 94, 0.22);
  border-color: var(--danger-bright);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(244, 63, 94, 0.25);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 12.5px;
}

/* ==========================================================================
   Ledger & Transactions List
   ========================================================================== */

.ledger-card .entries {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}

.entry {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--line-soft);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.entry:hover {
  background: rgba(255, 255, 255, 0.055) !important;
  transform: translateX(4px);
  border-color: rgba(255, 255, 255, 0.12);
}

.entry .left {
  display: flex;
  gap: 14px;
  align-items: center;
}

.chip {
  padding: 6px 10px;
  border-radius: var(--radius-xs);
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.02em;
}

.amount {
  font-family: var(--font-mono);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

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

.amount.expense {
  color: var(--danger-bright);
}

.recurring-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(6, 182, 212, 0.15);
  color: var(--cyan-bright);
  border: 1px solid rgba(6, 182, 212, 0.3);
  margin-left: 6px;
  vertical-align: middle;
}

.entry-subline {
  font-size: 12px;
  color: var(--muted);
  margin-top: 3px;
}

.ledger-controls {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

/* ==========================================================================
   Subscriptions, Budgets & Goals
   ========================================================================== */

.subscription-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.subscription-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 16px;
  align-items: center;
  padding: 16px 20px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid var(--line);
  transition: all 0.2s ease;
}

.subscription-card:hover {
  background: rgba(255, 255, 255, 0.045);
  border-color: rgba(255, 255, 255, 0.12);
  transform: translateY(-1px);
}

.subscription-amount {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 1.1rem;
}

.subscription-date-grid {
  display: grid;
  grid-template-columns: 1fr 1.4fr 1fr;
  gap: 10px;
}

/* Goals */
.goals-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.goal-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  background: rgba(255, 255, 255, 0.025);
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: all 0.2s ease;
}

.goal-card:hover {
  border-color: rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
}

.goal-progress {
  height: 10px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.07);
  overflow: hidden;
}

.goal-progress-fill {
  height: 100%;
  border-radius: var(--radius-full);
  background: linear-gradient(90deg, var(--accent), var(--cyan));
  box-shadow: 0 0 12px rgba(16, 185, 129, 0.4);
  transition: width 0.4s ease;
}

/* Insights Stat Boxes */
.insights-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 14px;
  margin-top: 14px;
}

.stat-box {
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid var(--line);
  padding: 18px 16px;
  border-radius: var(--radius-sm);
  text-align: center;
  transition: all 0.2s ease;
}

.stat-box:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.12);
  transform: translateY(-2px);
}

.stat-box .value {
  font-family: var(--font-mono);
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 6px;
}

.stat-box .label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* ==========================================================================
   Modals & Overlays
   ========================================================================= */

.modal-shell[hidden],
.subscription-modal-overlay[hidden] {
  display: none !important;
}

.modal-shell,
.subscription-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 24px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 6, 23, 0.82);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  animation: backdropFade 0.2s ease forwards;
}

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

.modal-card,
.subscription-modal {
  position: relative;
  z-index: 2;
  width: min(100%, 500px);
  background: rgba(14, 23, 42, 0.95);
  backdrop-filter: blur(24px);
  border-radius: var(--radius-lg);
  padding: 28px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.7);
  animation: modalEnter 0.28s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes modalEnter {
  from {
    opacity: 0;
    transform: scale(0.94) translateY(14px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

/* ==========================================================================
   Settings Page Modernization
   ========================================================================== */

.settings-shell,
.settings-container,
.admin-shell {
  max-width: 1040px;
  margin: 0 auto;
}

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

.settings-heading {
  margin: 0 0 18px 0;
  color: var(--accent-bright);
  font-size: 17px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
}

.settings-heading svg {
  width: 18px;
  height: 18px;
  color: var(--accent-bright);
}

.settings-row {
  justify-content: space-between;
  align-items: center;
  padding: 14px 0;
  border-bottom: 1px solid var(--line-soft);
  gap: 16px;
}

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

.profile-items-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.profile-items-grid .settings-row {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.02);
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
}

.danger-zone {
  background: rgba(244, 63, 94, 0.04);
  border: 1px solid rgba(244, 63, 94, 0.22);
  border-radius: var(--radius-sm);
  padding: 18px;
}

/* ==========================================================================
   Login Page Styling
   ========================================================================== */

.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}

.login-container {
  max-width: 440px;
  width: 100%;
  margin: 0 auto;
  padding: 24px;
}

.login-card {
  padding: 36px 32px;
  border-radius: var(--radius-lg);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 25px 60px -10px rgba(0, 0, 0, 0.6);
}

.login-card #messages {
  min-height: 20px;
  text-align: center;
  font-size: 13.5px;
  margin-bottom: 18px;
}

.google-login-surface {
  width: 100%;
  min-height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.06);
  font-weight: 600;
  font-size: 14.5px;
  transition: all 0.2s ease;
}

.google-login-surface:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--line-glow);
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  margin: 18px 0;
}

.auth-divider::before,
.auth-divider::after {
  content: "";
  height: 1px;
  flex: 1;
  background: var(--line);
}

.manual-login summary {
  cursor: pointer;
  color: var(--muted-light);
  font-weight: 600;
  font-size: 14px;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 0 14px;
  border-top: 1px solid var(--line-soft);
}

.manual-login summary::-webkit-details-marker {
  display: none;
}

.manual-login summary::after {
  content: "";
  width: 6px;
  height: 6px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(45deg);
  transition: transform 0.2s ease;
}

.manual-login[open] summary::after {
  transform: rotate(225deg);
}

.login-footer {
  text-align: center;
  margin-top: 24px;
  color: var(--muted-dark);
  font-size: 12.5px;
}

/* ==========================================================================
   Responsive Rules
   ========================================================================== */

@media (max-width: 820px) {
  .app {
    padding: 16px;
    margin: 0;
  }
  
  .stats {
    grid-template-columns: 1fr;
  }
  
  .split-grid,
  .profile-items-grid,
  .three-up {
    grid-template-columns: 1fr !important;
  }

  .stat {
    padding: 16px;
  }
}

@media (max-width: 600px) {
  .page-title {
    font-size: 1.5rem;
  }
  
  .tab-bar {
    gap: 4px;
    padding: 4px;
  }
  
  .tab-btn {
    padding: 8px 10px;
    font-size: 12.5px;
  }
  
  .card {
    padding: 16px;
  }
}


/* ==========================================================================
   Admin, Audit, Charts & Specialized Components
   ========================================================================== */

/* Flash Messages */
.flash-message {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  display: none;
  font-size: 13.5px;
}
.success-message {
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.35);
  color: var(--accent-bright);
}
.error-message {
  background: var(--danger-bg);
  border: 1px solid rgba(244, 63, 94, 0.35);
  color: var(--danger-bright);
}

/* Charts */
.chart-canvas-md {
  width: 100% !important;
  height: 250px !important;
  max-height: 250px;
}
.chart-canvas-sm {
  width: 100% !important;
  height: 200px !important;
  max-height: 200px;
}
.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 14px;
  font-size: 13px;
}
.chart-legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
}
.chart-legend-color {
  width: 14px;
  height: 14px;
  border-radius: 4px;
}

/* Timeline Selector & Surface Controls */
.timeline-selector select {
  padding: 8px 36px 8px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background-color: rgba(255, 255, 255, 0.04);
  color: inherit;
  cursor: pointer;
  font-size: 13.5px;
}
.surface-select {
  min-height: 38px;
  padding: 6px 34px 6px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background-color: rgba(255, 255, 255, 0.045);
  color: inherit;
  font-size: 13.5px;
}
.surface-select-sm {
  min-height: 32px;
  padding: 4px 30px 4px 10px;
  font-size: 12.5px;
}
.surface-input {
  min-height: 38px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: inherit;
  font-size: 13.5px;
}
.surface-input-sm {
  min-height: 34px;
  padding: 6px 10px;
  font-size: 13px;
}
.custom-range {
  display: none;
  margin-bottom: 16px;
  padding: 16px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--line);
}

/* Color Palette for Categories */
.color-palette {
  display: flex;
  gap: 10px;
  padding: 8px 0;
}
.color-option {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  border: 3px solid transparent;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}
.color-option:hover {
  transform: scale(1.15);
}
.color-option.selected {
  border-color: #fff;
  box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px #fff;
}

/* Empty State */
.empty-state {
  padding: 36px 20px;
  border: 1px dashed var(--line);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.015);
  text-align: center;
}
.empty-state-icon {
  font-size: 32px;
  margin-bottom: 10px;
  color: var(--muted);
  animation: floatIcon 3s ease-in-out infinite;
}
@keyframes floatIcon {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}
.empty-state-title {
  color: var(--text);
  font-weight: 600;
  font-size: 15px;
  margin-bottom: 4px;
}

/* Receipts */
.receipt-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}
.receipt-actions .btn-ghost {
  padding: 4px 8px;
  font-size: 12px;
  border-radius: var(--radius-xs);
}
.receipt-file-input {
  display: none;
}
.receipt-paperclip {
  font-size: 12px;
  margin-left: 6px;
  opacity: 0.85;
  vertical-align: middle;
}

/* Admin Console & Audit Log */
.admin-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 14px;
  margin-top: 14px;
}
.table-header,
.table-row {
  display: grid;
  grid-template-columns: minmax(260px, 2.4fr) 0.8fr 0.7fr 160px;
  gap: 14px;
  align-items: center;
}
.table-header {
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 13px;
  color: var(--muted-light);
  margin-bottom: 8px;
}
.table-row {
  padding: 16px;
  border-bottom: 1px solid var(--line-soft);
  transition: background 0.15s ease;
}
.table-row:hover {
  background: rgba(255, 255, 255, 0.02);
}
.admin-user-cell {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.admin-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: var(--panel);
}
.admin-avatar-fallback {
  display: grid;
  place-items: center;
  color: var(--accent-bright);
  font-size: 13px;
  font-weight: 700;
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.2), rgba(6, 182, 212, 0.2));
}
.role-badge {
  font-size: 12.5px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: var(--radius-full);
}
.role-badge.admin {
  background: var(--accent-bg);
  color: var(--accent-bright);
}
.role-badge.user {
  background: rgba(255, 255, 255, 0.05);
  color: var(--muted);
}
.table-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.audit-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
}
.audit-row {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  flex-wrap: wrap;
}
.audit-action {
  font-weight: 700;
  color: var(--accent-bright);
}
.audit-user {
  font-weight: 600;
  min-width: 90px;
}
.audit-target {
  color: var(--muted);
  flex: 1;
  min-width: 80px;
}
.audit-meta {
  color: var(--muted);
  font-size: 0.78rem;
}
.audit-ip {
  color: var(--muted);
  font-size: 0.78rem;
  font-family: var(--font-mono);
}
.audit-filter {
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 8px 14px;
  font-size: 0.88rem;
  min-width: 220px;
}

/* Pouches Specialized Stats */
.pouch-stats-grid {
  grid-template-columns: 1.6fr 1fr;
  gap: 14px;
}
.pouch-support-stack {
  display: grid;
  gap: 12px;
}
.pouch-balance-box {
  padding: 24px;
  text-align: left;
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.1), rgba(6, 182, 212, 0.05));
  border: 1px solid rgba(16, 185, 129, 0.25);
  border-radius: var(--radius-md);
}
.pouch-balance-box .value {
  font-family: var(--font-mono);
  font-size: 32px;
  font-weight: 800;
  line-height: 1.1;
  margin-bottom: 8px;
}
.pouch-transfer-chip.income {
  color: var(--accent-bright);
  background: var(--accent-bg);
}
.pouch-transfer-chip.expense {
  color: var(--danger-bright);
  background: var(--danger-bg);
}
