/* ============================================================
   Finance Management App - Apple-Inspired Design System
   ============================================================ */

/* ----------------------------------------------------------
   1. CSS Variables
   ---------------------------------------------------------- */

:root {
  --bg-primary: #f5f5f7;
  --bg-secondary: #ffffff;
  --bg-tertiary: #f0f0f2;
  --text-primary: #1d1d1f;
  --text-secondary: #6e6e73;
  --text-tertiary: #86868b;
  --accent: #007AFF;
  --accent-light: #e8f2ff;
  --green: #34C759;
  --green-light: #e8f8ed;
  --red: #FF3B30;
  --red-light: #fde8e7;
  --orange: #FF9500;
  --orange-light: #fff3e0;
  --purple: #AF52DE;
  --purple-light: #f3e8fa;
  --border: #d2d2d7;
  --border-light: #e8e8ed;
  --shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.12);
  --radius: 14px;
  --radius-sm: 8px;
  --radius-lg: 20px;
  --sidebar-width: 260px;
  --header-height: 64px;
  --transition: all 0.3s cubic-bezier(0.25, 0.1, 0.25, 1);
}

/* ----------------------------------------------------------
   Dark Mode
   ---------------------------------------------------------- */

[data-theme="dark"] {
  --bg-primary: #000000;
  --bg-secondary: #1c1c1e;
  --bg-tertiary: #2c2c2e;
  --text-primary: #f5f5f7;
  --text-secondary: #98989d;
  --text-tertiary: #6e6e73;
  --accent: #0A84FF;
  --accent-light: #1a3a5c;
  --green: #30D158;
  --green-light: #1a3d24;
  --red: #FF453A;
  --red-light: #3d1a1a;
  --orange: #FF9F0A;
  --orange-light: #3d2e0a;
  --purple: #BF5AF2;
  --purple-light: #2e1a3d;
  --border: #38383a;
  --border-light: #2c2c2e;
  --shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.4);
}

/* ----------------------------------------------------------
   2. Reset & Base
   ---------------------------------------------------------- */

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: -apple-system, 'Inter', 'SF Pro Display', 'SF Pro Text',
    'Helvetica Neue', Helvetica, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  color: var(--text-primary);
  background-color: var(--bg-primary);
  min-height: 100vh;
  overflow-x: hidden;
}

::selection {
  background-color: var(--accent);
  color: #ffffff;
}

::-moz-selection {
  background-color: var(--accent);
  color: #ffffff;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: var(--transition);
}

a:hover {
  opacity: 0.8;
}

img {
  max-width: 100%;
  display: block;
}

ul, ol {
  list-style: none;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  outline: none;
  background: none;
}

input, select, textarea {
  font-family: inherit;
  font-size: inherit;
  outline: none;
}

h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  line-height: 1.2;
  color: var(--text-primary);
}

/* ----------------------------------------------------------
   3. Auth Screen
   ---------------------------------------------------------- */

#auth-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  position: relative;
  overflow: hidden;
}

#auth-screen::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(ellipse at 30% 50%, rgba(255, 255, 255, 0.08) 0%, transparent 60%),
              radial-gradient(ellipse at 70% 20%, rgba(255, 255, 255, 0.05) 0%, transparent 50%);
  animation: authBgShift 20s ease-in-out infinite alternate;
}

@keyframes authBgShift {
  0% { transform: translate(0, 0); }
  100% { transform: translate(-5%, 3%); }
}

.auth-card {
  position: relative;
  background: var(--bg-secondary);
  max-width: 420px;
  width: 100%;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 40px;
  animation: scaleIn 0.5s ease forwards;
  z-index: 1;
}

[data-theme="dark"] .auth-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
}

.auth-logo {
  text-align: center;
  margin-bottom: 32px;
}

.auth-logo h1 {
  font-size: 26px;
  font-weight: 700;
  margin-bottom: 6px;
}

.auth-logo p {
  color: var(--text-secondary);
  font-size: 14px;
}

.auth-logo .logo-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 16px;
  background: linear-gradient(135deg, var(--accent), var(--purple));
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  color: #fff;
}

.auth-tabs {
  display: flex;
  background: var(--bg-tertiary);
  border-radius: 10px;
  padding: 3px;
  margin-bottom: 28px;
}

.auth-tab {
  flex: 1;
  padding: 10px 16px;
  text-align: center;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  border-radius: 8px;
  transition: var(--transition);
  cursor: pointer;
}

.auth-tab.active {
  background: var(--bg-secondary);
  color: var(--text-primary);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
}

.auth-form {
  display: none;
}

.auth-form.active {
  display: block;
  animation: fadeIn 0.3s ease;
}

.auth-form .form-group {
  margin-bottom: 18px;
}

.auth-form label,
.auth-form .form-group label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 8px;
  text-transform: none !important;
  letter-spacing: normal !important;
}

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

.input-wrapper .input-icon {
  position: absolute;
  left: 14px;
  width: 16px;
  height: 16px;
  color: var(--text-tertiary);
  pointer-events: none;
  z-index: 1;
}

.input-wrapper .input-icon svg {
  width: 16px;
  height: 16px;
}

.input-wrapper input,
.form-group .input-wrapper input {
  width: 100%;
  padding: 14px 44px 14px 44px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-tertiary);
  color: var(--text-primary);
  font-size: 15px;
  font-family: inherit;
  transition: var(--transition);
  outline: none;
}

.input-wrapper input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.15);
  background: var(--bg-secondary);
}

.input-wrapper input::placeholder {
  color: var(--text-tertiary);
}

.toggle-password {
  position: absolute;
  right: 12px;
  background: none;
  border: none;
  color: var(--text-tertiary);
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
}

.toggle-password:hover {
  color: var(--text-secondary);
}

.toggle-password svg,
.toggle-password i {
  width: 18px;
  height: 18px;
}

.auth-form input[type="text"],
.auth-form input[type="email"],
.auth-form input[type="password"] {
  box-sizing: border-box;
}

.auth-form-title {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 20px;
}

.auth-form-desc {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 20px;
  line-height: 1.5;
}

.form-row {
  display: flex;
  align-items: center;
  margin-bottom: 16px;
}

.form-row-between {
  justify-content: space-between;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  margin-bottom: 16px;
}

.checkbox-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
  cursor: pointer;
}

.link-forgot {
  font-size: 13px;
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}

.link-forgot:hover {
  text-decoration: underline;
}

.link-inline {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}

.link-inline:hover {
  text-decoration: underline;
}

.btn-full {
  width: 100%;
  justify-content: center;
}

.auth-switch {
  text-align: center;
  margin-top: 20px;
  font-size: 14px;
  color: var(--text-secondary);
}

.auth-switch a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}

.auth-switch a:hover {
  text-decoration: underline;
}

.auth-error {
  background: var(--red-light);
  color: var(--red);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 16px;
  display: none;
}

.auth-error.visible {
  display: block;
}

.auth-submit {
  width: 100%;
  padding: 14px;
  background: var(--accent);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  margin-top: 8px;
}

.auth-submit:hover {
  transform: scale(1.02);
  filter: brightness(1.05);
}

.auth-submit:active {
  transform: scale(0.98);
}

.auth-footer {
  text-align: center;
  margin-top: 20px;
  font-size: 13px;
  color: var(--text-tertiary);
}

.auth-footer a {
  color: var(--accent);
  font-weight: 500;
}

/* ----------------------------------------------------------
   4. Layout
   ---------------------------------------------------------- */

#app-container {
  display: flex;
  min-height: 100vh;
}

.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  padding: 32px;
  max-width: 100%;
  min-height: 100vh;
  animation: fadeIn 0.4s ease;
}

.page {
  display: none;
}

.page.active {
  display: block;
  animation: slideUp 0.4s ease;
}

/* ----------------------------------------------------------
   5. Sidebar
   ---------------------------------------------------------- */

#sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-light);
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: var(--transition);
  overflow-y: auto;
  overflow-x: hidden;
}

/* Sidebar Header / User Profile Area */
.sidebar-header {
  padding: 24px 20px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  position: relative;
}

.sidebar-header::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 20px;
  right: 20px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border-light) 20%, var(--border-light) 80%, transparent);
}

.user-avatar-wrapper {
  position: relative;
  flex-shrink: 0;
}

.user-avatar {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6366f1, #8b5cf6, #a855f7);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.5px;
  flex-shrink: 0;
  box-shadow: 0 2px 10px rgba(139, 92, 246, 0.3);
  transition: transform 0.25s cubic-bezier(0.25, 0.1, 0.25, 1),
              box-shadow 0.25s cubic-bezier(0.25, 0.1, 0.25, 1);
}

.user-avatar:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 16px rgba(139, 92, 246, 0.4);
}

.user-avatar svg {
  width: 22px;
  height: 22px;
  stroke-width: 2;
}

.status-dot {
  position: absolute;
  bottom: 1px;
  right: 1px;
  width: 12px;
  height: 12px;
  background: var(--green);
  border-radius: 50%;
  border: 2.5px solid var(--bg-secondary);
  box-shadow: 0 0 0 0 rgba(52, 199, 89, 0.4);
  animation: statusPulse 3s ease-in-out infinite;
}

@keyframes statusPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(52, 199, 89, 0.4); }
  50% { box-shadow: 0 0 0 4px rgba(52, 199, 89, 0); }
}

.user-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}

.user-name {
  font-size: 14px;
  font-weight: 650;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
  letter-spacing: -0.01em;
}

.user-email {
  font-size: 12px;
  color: var(--text-tertiary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
  letter-spacing: 0.01em;
}

/* Close button - hidden on desktop, shown on mobile */
.sidebar-close-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
  flex-shrink: 0;
  margin-left: auto;
  padding: 0;
}

.sidebar-close-btn:hover {
  background: var(--border-light);
  color: var(--text-primary);
}

.sidebar-close-btn svg {
  width: 16px;
  height: 16px;
  stroke-width: 2.5;
}

/* Sidebar Footer */
.sidebar-footer {
  padding: 12px 16px 16px;
  border-top: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  gap: 8px;
}

.sidebar-nav {
  flex: 1;
  padding: 12px 12px;
}

.nav-section-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-tertiary);
  padding: 16px 12px 8px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 400;
  cursor: pointer;
  transition: var(--transition);
  margin-bottom: 2px;
  text-decoration: none;
}

.nav-item:hover {
  background: var(--bg-tertiary);
}

.nav-item.active {
  background: var(--accent-light);
  color: var(--accent);
  font-weight: 500;
}

.nav-item .nav-icon {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.nav-item .nav-badge {
  margin-left: auto;
  background: var(--red);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 10px;
  min-width: 20px;
  text-align: center;
}

.sidebar-bottom {
  padding: 16px 20px;
  border-top: 1px solid var(--border-light);
}

.sidebar-bottom .nav-item {
  padding: 10px 16px;
}

.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  font-size: 14px;
  color: var(--text-secondary);
}

/* ----------------------------------------------------------
   5b. Topbar (Mobile only)
   ---------------------------------------------------------- */

.topbar {
  display: none;
}

@media (max-width: 768px) {
  .topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    position: sticky;
    top: 0;
    z-index: 50;
    background: var(--bg-primary);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    background-color: rgba(255, 255, 255, 0.88);
    border-bottom: 0.5px solid var(--border-light);
  }

  [data-theme="dark"] .topbar {
    background-color: rgba(18, 18, 18, 0.92);
  }

  .topbar-menu-btn,
  .topbar-action-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: none;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.15s ease, transform 0.15s ease;
    -webkit-tap-highlight-color: transparent;
  }

  .topbar-menu-btn:active,
  .topbar-action-btn:active {
    transform: scale(0.92);
    background: var(--border);
  }

  .topbar-menu-btn svg,
  .topbar-action-btn svg {
    width: 20px;
    height: 20px;
  }

  .topbar-title {
    font-size: 17px;
    font-weight: 600;
    letter-spacing: -0.2px;
  }

  .topbar-action-btn {
    position: relative;
  }

  .notification-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    min-width: 16px;
    height: 16px;
    border-radius: 8px;
    background: var(--red);
    color: #fff;
    font-size: 10px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    border: 2px solid var(--bg-primary);
  }

  /* Hide duplicate page title on mobile since topbar shows it */
  .page > .page-header > div > .page-title {
    display: none;
  }
}

/* ----------------------------------------------------------
   6. Mobile Navigation
   ---------------------------------------------------------- */

#mobile-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg-primary);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  background-color: rgba(255, 255, 255, 0.92);
  border-top: 0.5px solid var(--border-light);
  z-index: 200;
  padding-bottom: env(safe-area-inset-bottom, 0);
  /* Instagram-style flex layout */
  justify-content: space-around;
  align-items: stretch;
  height: 52px;
}

[data-theme="dark"] #mobile-nav {
  background-color: rgba(18, 18, 18, 0.95);
  border-top-color: rgba(255, 255, 255, 0.08);
}

#mobile-nav .mobile-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  flex: 1;
  padding: 6px 0 2px;
  margin-bottom: 0;
  border-radius: 0;
  background: none;
  color: var(--text-tertiary);
  font-size: 10px;
  font-weight: 400;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: color 0.15s ease;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
  position: relative;
}

#mobile-nav .mobile-nav-item:hover {
  background: none;
}

#mobile-nav .mobile-nav-item svg {
  width: 24px;
  height: 24px;
  stroke-width: 1.5;
  transition: transform 0.15s ease;
}

#mobile-nav .mobile-nav-item.active {
  color: var(--accent);
  font-weight: 600;
  background: none;
}

#mobile-nav .mobile-nav-item.active svg {
  stroke-width: 2;
}

#mobile-nav .mobile-nav-item:active {
  transform: scale(0.90);
}

#mobile-nav .mobile-nav-item span {
  line-height: 1;
  margin-top: 1px;
}

/* More Menu Popup */
.mobile-more-menu {
  position: fixed;
  bottom: calc(50px + env(safe-area-inset-bottom, 0px) + 8px);
  right: 8px;
  background: var(--bg-primary);
  border-radius: 14px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.12), 0 0 0 0.5px rgba(0, 0, 0, 0.06);
  z-index: 250;
  min-width: 180px;
  overflow: hidden;
  animation: slideUp 0.2s ease;
}

[data-theme="dark"] .mobile-more-menu {
  background: var(--bg-secondary);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.4), 0 0 0 0.5px rgba(255, 255, 255, 0.08);
}

.mobile-more-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  color: var(--text-primary);
  font-size: 15px;
  font-weight: 400;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s ease;
}

.mobile-more-item:not(:last-child) {
  border-bottom: 0.5px solid var(--border-light);
}

.mobile-more-item:active {
  background: var(--bg-tertiary);
}

.mobile-more-item svg {
  width: 20px;
  height: 20px;
  color: var(--text-secondary);
  stroke-width: 1.5;
}

.mobile-more-item.active {
  color: var(--accent);
}

.mobile-more-overlay {
  position: fixed;
  inset: 0;
  z-index: 240;
  background: transparent;
}

/* ----------------------------------------------------------
   7. Page Headers
   ---------------------------------------------------------- */

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

.page-header h1 {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.3px;
}

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

.page-header .btn-add {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 18px;
  background: var(--accent);
  color: #ffffff;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  transition: var(--transition);
}

.page-header .btn-add:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
}

/* ----------------------------------------------------------
   8. Stat Cards
   ---------------------------------------------------------- */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--bg-secondary);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

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

.stat-card .stat-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  margin-bottom: 14px;
}

.stat-card .stat-icon.blue {
  background: var(--accent-light);
  color: var(--accent);
}

.stat-card .stat-icon.green {
  background: var(--green-light);
  color: var(--green);
}

.stat-card .stat-icon.red {
  background: var(--red-light);
  color: var(--red);
}

.stat-card .stat-icon.orange {
  background: var(--orange-light);
  color: var(--orange);
}

.stat-card .stat-icon.purple {
  background: var(--purple-light);
  color: var(--purple);
}

.stat-card .stat-label {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 6px;
  font-weight: 400;
}

.stat-card .stat-value {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.5px;
  margin-bottom: 6px;
}

.stat-card .stat-change {
  font-size: 12px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.stat-card .stat-change.positive {
  color: var(--green);
}

.stat-card .stat-change.negative {
  color: var(--red);
}

/* ----------------------------------------------------------
   9. Cards
   ---------------------------------------------------------- */

.card {
  background: var(--bg-secondary);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  transition: var(--transition);
  margin-bottom: 20px;
}

.card:hover {
  box-shadow: var(--shadow-lg);
}

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

.card-header h2 {
  font-size: 18px;
  font-weight: 600;
}

.card-header h3 {
  font-size: 16px;
  font-weight: 600;
}

.card-header .card-action {
  font-size: 13px;
  color: var(--accent);
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}

.card-header .card-action:hover {
  opacity: 0.7;
}

.card-body {
  position: relative;
}

.card-footer {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* ----------------------------------------------------------
   10. Transaction Lists
   ---------------------------------------------------------- */

.transactions-list {
  list-style: none;
}

/* (transaction-item styles moved to enhanced section below) */

/* ── Transaction Section Headers (Privat / Geteilt) ────── */
.transaction-section {
  margin-bottom: 24px;
}
.transaction-section-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 8px 0;
  margin-bottom: 4px;
  border-bottom: 1px solid var(--border-light);
}
.transaction-section-header i {
  width: 16px;
  height: 16px;
}
.transaction-section-header.shared {
  color: var(--accent);
}
.transaction-section-count {
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
  margin-left: auto;
}
.transaction-section-empty {
  padding: 16px;
  text-align: center;
  font-size: 13px;
  color: var(--text-tertiary);
}

/* ── Transaction Group ────────────────────────────────── */
.transaction-group {
  background: var(--bg-primary);
  border-radius: var(--radius-md);
  padding: 4px 16px;
  margin-bottom: 8px;
}
.transaction-date-header {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-tertiary);
  padding: 8px 0 4px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

/* ── Transaction Item (Enhanced) ──────────────────────── */
.transaction-item {
  display: flex;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-light);
  transition: var(--transition);
  gap: 12px;
  cursor: default;
}
.transaction-item:last-child {
  border-bottom: none;
}
.transaction-item:hover {
  background: var(--bg-tertiary);
  margin: 0 -16px;
  padding-left: 16px;
  padding-right: 16px;
  border-radius: var(--radius-sm);
}
.transaction-item.shared-item {
  border-left: 3px solid var(--accent);
  padding-left: 12px;
  margin-left: -4px;
}

/* Transaction Icon (category) */
.txn-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.txn-icon i {
  width: 18px;
  height: 18px;
}

.transaction-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
}
.transaction-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}
.transaction-actions {
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity 0.15s;
}
.transaction-item:hover .transaction-actions {
  opacity: 1;
}

.transaction-details {
  flex: 1;
  min-width: 0;
}
.transaction-description {
  display: block;
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.transaction-category-label {
  font-size: 11px;
  color: var(--text-tertiary);
}
.transaction-amount {
  font-size: 15px;
  font-weight: 600;
  white-space: nowrap;
  text-align: right;
}
.transaction-amount.income { color: var(--green); }
.transaction-amount.expense { color: var(--red); }

/* ── Transaction Meta Badges ──────────────────────────── */
.txn-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 2px;
}
.txn-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 10px;
  font-weight: 500;
  padding: 1px 6px;
  border-radius: 6px;
  white-space: nowrap;
}
.txn-badge i {
  width: 10px;
  height: 10px;
}
.txn-badge.recurring {
  background: #e0f2fe;
  color: #0284c7;
}
.txn-badge.attachment {
  background: #fef3c7;
  color: #92400e;
}
.txn-badge.owner {
  background: #ede9fe;
  color: #7c3aed;
}
.txn-badge.group {
  background: #dbeafe;
  color: #2563eb;
}

/* ── Transaction Cards Grid ───────────────────────────── */
.transaction-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}
.transaction-card {
  background: var(--bg-primary);
  border-radius: var(--radius-md);
  padding: 16px;
  border: 1px solid var(--border-light);
  transition: var(--transition);
}
.transaction-card:hover {
  box-shadow: var(--shadow-md);
}
.transaction-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}
.transaction-card-body {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 10px;
}
.transaction-card-actions {
  display: flex;
  justify-content: flex-end;
  gap: 4px;
}
.transaction-category-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.transaction-date-label {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-left: auto;
}

/* Dark mode overrides for transaction badges */
[data-theme="dark"] .txn-badge.recurring {
  background: rgba(2, 132, 199, 0.15);
  color: #38bdf8;
}
[data-theme="dark"] .txn-badge.attachment {
  background: rgba(146, 64, 14, 0.15);
  color: #fbbf24;
}
[data-theme="dark"] .txn-badge.owner {
  background: rgba(124, 58, 237, 0.15);
  color: #a78bfa;
}
[data-theme="dark"] .txn-badge.group {
  background: rgba(37, 99, 235, 0.15);
  color: #60a5fa;
}
[data-theme="dark"] .transaction-group {
  background: var(--bg-secondary);
}
[data-theme="dark"] .transaction-section-count {
  background: var(--bg-tertiary);
}

/* Summary Cards */
.summary-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.summary-card-content {
  display: flex;
  align-items: baseline;
  gap: 12px;
}

.summary-card-label {
  font-size: 14px;
  color: var(--text-secondary);
}

.summary-card-value {
  font-size: 24px;
  font-weight: 700;
}

.summary-card-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.summary-card-income .summary-card-value {
  color: var(--green);
}

.summary-card-expense .summary-card-value {
  color: var(--red);
}

/* Category Breakdown */
.category-breakdown {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.breakdown-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.breakdown-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.breakdown-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 500;
}

.breakdown-values {
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 500;
}

.color-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

.breakdown-bar {
  width: 100%;
  height: 8px;
  background: var(--bg-tertiary);
  border-radius: 4px;
  overflow: hidden;
}

.breakdown-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.8s cubic-bezier(0.25, 0.1, 0.25, 1);
}

.transaction-amount.expense {
  color: var(--red);
}

.category-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 500;
}

.category-badge.food { background: var(--orange-light); color: var(--orange); }
.category-badge.transport { background: var(--accent-light); color: var(--accent); }
.category-badge.shopping { background: var(--purple-light); color: var(--purple); }
.category-badge.health { background: var(--red-light); color: var(--red); }
.category-badge.entertainment { background: var(--green-light); color: var(--green); }
.category-badge.income { background: var(--green-light); color: var(--green); }
.category-badge.bills { background: var(--orange-light); color: var(--orange); }

/* ----------------------------------------------------------
   11. Debt Cards
   ---------------------------------------------------------- */

.debt-card {
  background: var(--bg-secondary);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
  transition: var(--transition);
}

.debt-card:hover {
  box-shadow: var(--shadow-lg);
}

.debt-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 20px;
}

.debt-card-header h3 {
  font-size: 17px;
  font-weight: 600;
  margin-bottom: 4px;
}

.debt-card-header .debt-type {
  font-size: 12px;
  color: var(--text-tertiary);
}

.debt-card-header .debt-amount {
  font-size: 22px;
  font-weight: 700;
  text-align: right;
}

.debt-card-header .debt-original {
  font-size: 12px;
  color: var(--text-tertiary);
  text-align: right;
}

.debt-progress {
  margin-bottom: 16px;
}

.debt-progress-bar {
  width: 100%;
  height: 8px;
  background: var(--bg-tertiary);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 6px;
}

.debt-progress-fill {
  height: 100%;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--green), #2ac94e);
  transition: width 1s cubic-bezier(0.25, 0.1, 0.25, 1);
  animation: progressFill 1.2s ease forwards;
}

.debt-progress-labels {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-tertiary);
}

.debt-stats {
  display: flex;
  gap: 20px;
  padding: 14px 0;
  border-top: 1px solid var(--border-light);
  border-bottom: 1px solid var(--border-light);
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.debt-stat {
  flex: 1;
  min-width: 80px;
}

.debt-stat-label {
  display: block;
  font-size: 11px;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.debt-stat-value {
  display: block;
  font-size: 15px;
  font-weight: 600;
}

.debt-details {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin: 14px 0;
  padding: 14px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
}

.debt-detail-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.debt-detail-item .label {
  font-size: 12px;
  color: var(--text-tertiary);
  font-weight: 500;
}

.debt-detail-item .value {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

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

.debt-name {
  font-size: 17px;
  font-weight: 600;
  margin-bottom: 4px;
}

.debt-creditor {
  font-size: 13px;
  color: var(--text-tertiary);
}

.debt-amount {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
}

.debt-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* Due date info on debt cards */
.due-date-info {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  margin-bottom: 12px;
  background: var(--accent-light);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  color: var(--accent);
}
.due-date-info i,
.due-date-info [data-lucide] {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

/* Recurring indicator */
.recurring-indicator {
  display: inline-flex;
  align-items: center;
  margin-left: auto;
  color: var(--accent);
}
.recurring-indicator i,
.recurring-indicator [data-lucide] {
  width: 14px;
  height: 14px;
}

/* Due date badges */
.badge-due-soon {
  background: var(--orange);
  color: #fff;
  margin-left: 6px;
}
.badge-overdue {
  background: var(--red);
  color: #fff;
  margin-left: 6px;
}

/* Recurring hint in form */
.recurring-hint {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-top: 4px;
  font-style: italic;
}

.debt-what-if {
  margin-top: 14px;
  padding: 16px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
}

.debt-what-if-toggle {
  font-size: 14px;
  font-weight: 500;
  color: var(--accent);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
}

.debt-what-if-content {
  display: none;
  margin-top: 12px;
}

.debt-what-if-content.open {
  display: block;
  animation: slideUp 0.3s ease;
}

/* ----------------------------------------------------------
   12. Goal Cards
   ---------------------------------------------------------- */

.goal-card {
  background: var(--bg-secondary);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
  transition: var(--transition);
}

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

.goal-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.goal-card-header h3 {
  font-size: 17px;
  font-weight: 600;
}

.goal-target {
  font-size: 13px;
  color: var(--text-secondary);
}

.progress-ring-container {
  display: flex;
  align-items: center;
  gap: 24px;
  margin-bottom: 16px;
}

.progress-ring {
  position: relative;
  width: 80px;
  height: 80px;
  flex-shrink: 0;
}

.progress-ring svg {
  transform: rotate(-90deg);
  width: 80px;
  height: 80px;
}

.progress-ring .ring-bg {
  fill: none;
  stroke: var(--bg-tertiary);
  stroke-width: 6;
}

.progress-ring .ring-fill {
  fill: none;
  stroke: var(--accent);
  stroke-width: 6;
  stroke-linecap: round;
  transition: stroke-dashoffset 1s cubic-bezier(0.25, 0.1, 0.25, 1);
}

.progress-ring .ring-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 18px;
  font-weight: 700;
  color: var(--accent);
}

.progress-bar-wrapper {
  margin-bottom: 12px;
}

.progress-bar {
  width: 100%;
  height: 10px;
  background: var(--bg-tertiary);
  border-radius: 5px;
  overflow: hidden;
}

.progress-bar-fill,
.progress-fill {
  height: 100%;
  border-radius: 5px;
  background: linear-gradient(90deg, var(--accent), #3d9aff);
  transition: width 1s cubic-bezier(0.25, 0.1, 0.25, 1);
  animation: progressFill 1.2s ease forwards;
}

.progress-labels {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-tertiary);
  margin-top: 6px;
}

.goal-details {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 13px;
}

.goal-detail {
  color: var(--text-secondary);
}

.goal-detail strong {
  color: var(--text-primary);
  font-weight: 600;
}

/* ----------------------------------------------------------
   13. Charts
   ---------------------------------------------------------- */

.chart-container {
  background: var(--bg-secondary);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  margin-bottom: 20px;
  min-height: 300px;
}

.chart-container canvas {
  width: 100% !important;
  max-height: 350px;
}

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

.chart-header h3 {
  font-size: 17px;
  font-weight: 600;
}

.chart-legend {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.chart-legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-secondary);
}

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

.chart-period-toggle {
  display: flex;
  background: var(--bg-tertiary);
  border-radius: 8px;
  padding: 2px;
}

.chart-period-btn {
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
}

.chart-period-btn.active {
  background: var(--bg-secondary);
  color: var(--text-primary);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

/* ----------------------------------------------------------
   14. Forms
   ---------------------------------------------------------- */

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 14px 16px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-tertiary);
  color: var(--text-primary);
  font-size: 15px;
  transition: var(--transition);
}

.form-group textarea {
  resize: vertical;
  min-height: 100px;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.12);
  background: var(--bg-secondary);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
  color: var(--text-tertiary);
}

.form-group select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236e6e73' d='M6 8.5L1 3.5h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}

.form-group .form-hint {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-top: 6px;
}

.form-group .form-error {
  font-size: 12px;
  color: var(--red);
  margin-top: 6px;
}

.form-group.error input,
.form-group.error select {
  border-color: var(--red);
}

.form-row {
  display: flex;
  gap: 16px;
}

.form-row .form-group {
  flex: 1;
}

/* Settings Toggle List */
.settings-toggles {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.settings-toggle-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
}

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

.settings-toggle-item:first-child {
  padding-top: 0;
}

.settings-toggle-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  min-width: 0;
}

.settings-toggle-label {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text);
}

.settings-toggle-desc {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

/* Toggle Switch (iOS style) */
.toggle-switch {
  position: relative;
  width: 52px;
  height: 28px;
  flex-shrink: 0;
}

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

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--border);
  border-radius: 28px;
  transition: var(--transition);
}

.toggle-slider::before {
  content: '';
  position: absolute;
  height: 22px;
  width: 22px;
  left: 3px;
  bottom: 3px;
  background-color: #ffffff;
  border-radius: 50%;
  transition: var(--transition);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

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

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

/* Date input */
.form-group input[type="date"] {
  position: relative;
}

.form-group input[type="date"]::-webkit-calendar-picker-indicator {
  opacity: 0.5;
  cursor: pointer;
}

/* ----------------------------------------------------------
   15. Modals
   ---------------------------------------------------------- */

.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-overlay.active {
  display: flex;
  animation: fadeIn 0.2s ease;
}

.modal {
  background: var(--bg-secondary);
  max-width: 500px;
  width: 90%;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: scaleIn 0.3s cubic-bezier(0.25, 0.1, 0.25, 1);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-light);
}

.modal-header h2 {
  font-size: 18px;
  font-weight: 600;
}

.modal-close {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--bg-tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
}

.modal-close:hover {
  background: var(--border);
  color: var(--text-primary);
}

.modal-body {
  padding: 24px;
  overflow-y: auto;
  max-height: 60vh;
  -webkit-overflow-scrolling: touch;
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  padding: 16px 24px;
  border-top: 1px solid var(--border-light);
}

/* ----------------------------------------------------------
   16. Buttons
   ---------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  border: none;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
  text-decoration: none;
  line-height: 1.3;
}

.btn:hover {
  transform: translateY(-1px);
  filter: brightness(1.05);
}

.btn:active {
  transform: translateY(0) scale(0.98);
}

.btn-primary {
  background: var(--accent);
  color: #ffffff;
}

.btn-primary:hover {
  box-shadow: 0 4px 12px rgba(0, 122, 255, 0.3);
}

.btn-secondary {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.btn-secondary:hover {
  background: var(--border-light);
}

.btn-danger {
  background: var(--red);
  color: #ffffff;
}

.btn-danger:hover {
  box-shadow: 0 4px 12px rgba(255, 59, 48, 0.3);
}

.btn-success {
  background: var(--green);
  color: #ffffff;
}

.btn-success:hover {
  box-shadow: 0 4px 12px rgba(52, 199, 89, 0.3);
}

.btn-outline {
  background: transparent;
  color: var(--accent);
  border: 1.5px solid var(--accent);
}

.btn-outline:hover {
  background: var(--accent-light);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}

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

.btn-icon {
  width: 38px;
  height: 38px;
  padding: 0;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.btn-sm {
  padding: 7px 14px;
  font-size: 13px;
}

.btn-lg {
  padding: 14px 28px;
  font-size: 16px;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  filter: none;
}

/* ----------------------------------------------------------
   17. Toast Notifications
   ---------------------------------------------------------- */

#toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  background: var(--bg-secondary);
  box-shadow: var(--shadow-lg);
  border-radius: var(--radius);
  padding: 14px 32px 14px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 280px;
  max-width: 400px;
  pointer-events: auto;
  animation: slideInRight 0.4s cubic-bezier(0.25, 0.1, 0.25, 1);
  position: relative;
  overflow: hidden;
  flex-wrap: nowrap;
}
.toast::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
}

.toast.success::before { background: var(--green); }
.toast.error::before { background: var(--red); }
.toast.warning::before { background: var(--orange); }
.toast.info::before { background: var(--accent); }

.toast-body {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}

.toast-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.toast.success .toast-icon { color: var(--green); }
.toast.error .toast-icon { color: var(--red); }
.toast.warning .toast-icon { color: var(--orange); }
.toast.info .toast-icon { color: var(--accent); }

.toast-message {
  font-size: 13px;
  color: var(--text-secondary);
  flex: 1;
  min-width: 0;
}

.toast-close {
  background: none;
  border: none;
  color: var(--text-tertiary);
  cursor: pointer;
  font-size: 16px;
  padding: 4px;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  position: absolute;
  top: 8px;
  right: 8px;
}
.toast-close svg {
  width: 14px;
  height: 14px;
}

.toast-close:hover {
  color: var(--text-primary);
}

.toast.removing,
.toast.hiding {
  animation: slideOutRight 0.3s cubic-bezier(0.25, 0.1, 0.25, 1) forwards;
}

@keyframes slideOutRight {
  to {
    transform: translateX(120%);
    opacity: 0;
  }
}

/* ----------------------------------------------------------
   18. Badges & Pills
   ---------------------------------------------------------- */

.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.2px;
}

.badge-primary { background: var(--accent-light); color: var(--accent); }
.badge-success { background: var(--green-light); color: var(--green); }
.badge-danger { background: var(--red-light); color: var(--red); }
.badge-warning { background: var(--orange-light); color: var(--orange); }
.badge-purple { background: var(--purple-light); color: var(--purple); }
.badge-neutral { background: var(--bg-tertiary); color: var(--text-secondary); }

/* ----------------------------------------------------------
   19. Tables
   ---------------------------------------------------------- */

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th {
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-tertiary);
  padding: 10px 14px;
  border-bottom: 2px solid var(--border-light);
}

.data-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-light);
  font-size: 14px;
  vertical-align: middle;
}

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

.data-table tr:hover td {
  background: var(--bg-tertiary);
}

.data-table .text-right {
  text-align: right;
}

.data-table .text-center {
  text-align: center;
}

/* ----------------------------------------------------------
   20. Filter Bar
   ---------------------------------------------------------- */

.filter-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.filter-select {
  padding: 9px 32px 9px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-size: 13px;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10'%3E%3Cpath fill='%236e6e73' d='M5 7L1 3h8z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  cursor: pointer;
  transition: var(--transition);
}

.filter-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.1);
}

.filter-input {
  position: relative;
  flex: 1;
  min-width: 200px;
}

.filter-input input {
  width: 100%;
  padding: 9px 14px 9px 38px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-size: 13px;
  transition: var(--transition);
}

.filter-input input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.1);
}

.filter-input .filter-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-tertiary);
  font-size: 16px;
  pointer-events: none;
}

/* ----------------------------------------------------------
   21. Insights Section
   ---------------------------------------------------------- */

.insight-card {
  background: var(--bg-secondary);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  margin-bottom: 12px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  border-left: 4px solid transparent;
  transition: var(--transition);
}

.insight-card:hover {
  box-shadow: var(--shadow-lg);
}

.insight-card.tip { border-left-color: var(--accent); }
.insight-card.warning { border-left-color: var(--orange); }
.insight-card.alert { border-left-color: var(--red); }
.insight-card.positive { border-left-color: var(--green); }

.insight-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.insight-card.tip .insight-icon { background: var(--accent-light); color: var(--accent); }
.insight-card.warning .insight-icon { background: var(--orange-light); color: var(--orange); }
.insight-card.alert .insight-icon { background: var(--red-light); color: var(--red); }
.insight-card.positive .insight-icon { background: var(--green-light); color: var(--green); }

.insight-content h4 {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 4px;
}

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

/* ----------------------------------------------------------
   22. Forecast Section
   ---------------------------------------------------------- */

.forecast-table {
  width: 100%;
  border-collapse: collapse;
}

.forecast-table th {
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-tertiary);
  padding: 10px 14px;
  border-bottom: 2px solid var(--border-light);
}

.forecast-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-light);
  font-size: 14px;
}

.forecast-timeline {
  position: relative;
  padding-left: 24px;
}

.forecast-timeline::before {
  content: '';
  position: absolute;
  left: 8px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--border-light);
}

.forecast-event {
  position: relative;
  padding: 12px 0;
  padding-left: 20px;
}

.forecast-event::before {
  content: '';
  position: absolute;
  left: -20px;
  top: 16px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--bg-secondary);
}

.forecast-event-date {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-bottom: 4px;
}

.forecast-event-title {
  font-size: 14px;
  font-weight: 500;
}

.recommendation-card {
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
  padding: 16px;
  margin-bottom: 10px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.recommendation-card .rec-icon {
  font-size: 20px;
  flex-shrink: 0;
  margin-top: 2px;
}

.recommendation-card h4 {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 4px;
}

.recommendation-card p {
  font-size: 13px;
  color: var(--text-secondary);
}

/* ----------------------------------------------------------
   23. Settings Page
   ---------------------------------------------------------- */

.settings-section {
  margin-bottom: 32px;
}

.settings-section-header {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-tertiary);
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-light);
}

.settings-group {
  background: var(--bg-secondary);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-light);
  gap: 16px;
}

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

.settings-row-info {
  flex: 1;
}

.settings-row-info h4 {
  font-size: 15px;
  font-weight: 500;
  margin-bottom: 2px;
}

.settings-row-info p {
  font-size: 13px;
  color: var(--text-tertiary);
}

.settings-row-control {
  flex-shrink: 0;
}

.settings-danger {
  border: 2px solid var(--red);
  border-radius: var(--radius);
}

.settings-danger .settings-section-header {
  color: var(--red);
  padding: 16px 20px;
  margin-bottom: 0;
  border-bottom: 1px solid var(--red-light);
}

/* ----------------------------------------------------------
   24. Shared / Group Section
   ---------------------------------------------------------- */

.member-avatars {
  display: flex;
  align-items: center;
}

.member-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2px solid var(--bg-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  margin-left: -8px;
}

.member-avatar:first-child {
  margin-left: 0;
}

.member-avatar.a { background: var(--accent); }
.member-avatar.b { background: var(--green); }
.member-avatar.c { background: var(--orange); }
.member-avatar.d { background: var(--purple); }
.member-avatar.e { background: var(--red); }

.member-avatar.add {
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  font-size: 16px;
  cursor: pointer;
  transition: var(--transition);
}

.member-avatar.add:hover {
  background: var(--border);
}

.role-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
}

.role-badge.owner { background: var(--accent-light); color: var(--accent); }
.role-badge.admin { background: var(--purple-light); color: var(--purple); }
.role-badge.member { background: var(--bg-tertiary); color: var(--text-secondary); }

.group-card {
  background: var(--bg-secondary);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  margin-bottom: 12px;
  transition: var(--transition);
}

.group-card:hover {
  box-shadow: var(--shadow-lg);
}

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

.group-card-header h3 {
  font-size: 16px;
  font-weight: 600;
}

.group-card-meta {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 13px;
  color: var(--text-secondary);
}

/* ----------------------------------------------------------
   25. Animations
   ---------------------------------------------------------- */

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

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

@keyframes slideInRight {
  from { transform: translateX(100%); }
  to { transform: translateX(0); }
}

@keyframes scaleIn {
  from {
    transform: scale(0.9);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

@keyframes progressFill {
  from { width: 0; }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

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

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

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

/* Page and card staggered animations */
.animate-in {
  animation: slideUp 0.4s ease forwards;
}

.animate-in:nth-child(1) { animation-delay: 0s; }
.animate-in:nth-child(2) { animation-delay: 0.05s; }
.animate-in:nth-child(3) { animation-delay: 0.1s; }
.animate-in:nth-child(4) { animation-delay: 0.15s; }
.animate-in:nth-child(5) { animation-delay: 0.2s; }
.animate-in:nth-child(6) { animation-delay: 0.25s; }
.animate-in:nth-child(7) { animation-delay: 0.3s; }
.animate-in:nth-child(8) { animation-delay: 0.35s; }

.stat-value-animated {
  animation: countUp 0.5s ease forwards;
}

/* ----------------------------------------------------------
   26. Scrollbar
   ---------------------------------------------------------- */

/* WebKit (Chrome, Safari, Edge) */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

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

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-tertiary);
}

/* Firefox */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

/* ----------------------------------------------------------
   27. Print Styles
   ---------------------------------------------------------- */

@media print {
  #sidebar,
  #mobile-nav,
  .btn,
  .btn-add,
  .page-header-actions,
  .filter-bar,
  .modal-overlay,
  #toast-container,
  .theme-toggle,
  .sidebar-bottom {
    display: none !important;
  }

  .main-content {
    margin-left: 0 !important;
    padding: 0 !important;
  }

  body {
    background: #fff;
    color: #000;
  }

  .card,
  .stat-card,
  .debt-card,
  .goal-card,
  .chart-container {
    box-shadow: none !important;
    border: 1px solid #ddd;
    break-inside: avoid;
  }
}

/* ----------------------------------------------------------
   28. Responsive Breakpoints
   ---------------------------------------------------------- */

/* Tablet */
@media (max-width: 1024px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .main-content {
    padding: 24px;
  }

  .form-row {
    flex-direction: column;
    gap: 0;
  }
}

/* Mobile */
@media (max-width: 768px) {
  #sidebar {
    display: flex;
    transform: translateX(-100%);
    box-shadow: none;
    z-index: 150;
    transition: transform 0.3s cubic-bezier(0.25, 0.1, 0.25, 1);
  }

  #sidebar.open {
    transform: translateX(0);
    box-shadow: var(--shadow-lg);
  }

  .sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.35);
    z-index: 140;
    transition: opacity 0.3s ease;
  }

  .sidebar-overlay.active {
    display: block;
  }

  .sidebar-close-btn {
    display: flex;
  }

  #mobile-nav {
    display: flex;
  }

  .main-content {
    margin-left: 0;
    padding: 0 16px 20px;
    padding-bottom: calc(70px + env(safe-area-inset-bottom, 0px));
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }

  .page-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .page-header h1 {
    font-size: 24px;
  }

  .page-header-actions {
    width: 100%;
  }

  .page-header .btn-add {
    width: 100%;
    justify-content: center;
  }

  .card {
    padding: 18px;
  }

  .stat-card {
    padding: 18px;
  }

  .stat-card .stat-value {
    font-size: 24px;
  }

  .modal {
    width: 100%;
    max-width: 100%;
    border-radius: var(--radius) var(--radius) 0 0;
    align-self: flex-end;
    max-height: 85vh;
  }

  .modal-overlay {
    align-items: flex-end;
    padding: 0;
  }

  .filter-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .filter-input {
    min-width: unset;
  }

  .chart-container {
    padding: 16px;
    min-height: 250px;
  }

  .debt-stats {
    flex-direction: column;
    gap: 12px;
  }

  .group-card-meta {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  #toast-container {
    left: 16px;
    right: 16px;
    top: 16px;
  }

  .toast {
    min-width: unset;
    width: 100%;
  }

  .data-table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}

/* Small mobile */
@media (max-width: 380px) {
  .main-content {
    padding: 16px 12px;
    padding-bottom: calc(70px + env(safe-area-inset-bottom, 0px));
  }

  .auth-card {
    padding: 28px 20px;
  }
}

/* Large desktop */
@media (min-width: 1400px) {
  .main-content {
    max-width: 1200px;
    margin-left: var(--sidebar-width);
    margin-right: auto;
  }
}

/* Sidebar overlay on tablet */
@media (min-width: 769px) and (max-width: 1024px) {
  #sidebar {
    transform: translateX(-100%);
    box-shadow: var(--shadow-lg);
    z-index: 150;
  }

  #sidebar.open {
    transform: translateX(0);
  }

  .sidebar-close-btn {
    display: flex;
  }

  .main-content {
    margin-left: 0;
  }

  .sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.3);
    z-index: 140;
  }

  .sidebar-overlay.active {
    display: block;
  }
}

/* ----------------------------------------------------------
   29. Utility Classes
   ---------------------------------------------------------- */

.text-green { color: var(--green) !important; }
.text-red { color: var(--red) !important; }
.text-orange { color: var(--orange) !important; }
.text-accent { color: var(--accent) !important; }
.text-purple { color: var(--purple) !important; }
.text-secondary { color: var(--text-secondary) !important; }
.text-tertiary { color: var(--text-tertiary) !important; }

.bg-green { background: var(--green-light) !important; }
.bg-red { background: var(--red-light) !important; }
.bg-orange { background: var(--orange-light) !important; }
.bg-accent { background: var(--accent-light) !important; }

.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mt-4 { margin-top: 32px; }

.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.mb-4 { margin-bottom: 32px; }

.ml-1 { margin-left: 8px; }
.ml-2 { margin-left: 16px; }

.mr-1 { margin-right: 8px; }
.mr-2 { margin-right: 16px; }

.p-1 { padding: 8px; }
.p-2 { padding: 16px; }
.p-3 { padding: 24px; }

.hidden { display: none !important; }
.visible { display: block; }

.flex { display: flex; }
.flex-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.flex-center {
  display: flex;
  align-items: center;
  justify-content: center;
}
.flex-col {
  display: flex;
  flex-direction: column;
}
.flex-wrap { flex-wrap: wrap; }
.flex-1 { flex: 1; }
.items-center { align-items: center; }

.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }
.gap-3 { gap: 24px; }

.text-center { text-align: center; }
.text-right { text-align: right; }
.text-left { text-align: left; }

.font-bold { font-weight: 700; }
.font-medium { font-weight: 500; }
.font-normal { font-weight: 400; }

.text-sm { font-size: 13px; }
.text-xs { font-size: 11px; }
.text-lg { font-size: 18px; }
.text-xl { font-size: 22px; }

.w-full { width: 100%; }
.overflow-hidden { overflow: hidden; }
.truncate {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rounded { border-radius: var(--radius); }
.rounded-sm { border-radius: var(--radius-sm); }
.rounded-lg { border-radius: var(--radius-lg); }
.rounded-full { border-radius: 9999px; }

.shadow { box-shadow: var(--shadow); }
.shadow-lg { box-shadow: var(--shadow-lg); }
.shadow-none { box-shadow: none; }

.border { border: 1px solid var(--border); }
.border-bottom { border-bottom: 1px solid var(--border-light); }

.cursor-pointer { cursor: pointer; }

/* ----------------------------------------------------------
   30. Empty States
   ---------------------------------------------------------- */

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  text-align: center;
}

.empty-state-icon {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--bg-tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  color: var(--text-tertiary);
  margin-bottom: 20px;
}

.empty-state h3 {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 8px;
}

.empty-state p {
  font-size: 14px;
  color: var(--text-secondary);
  max-width: 320px;
  margin-bottom: 20px;
  line-height: 1.5;
}

/* ----------------------------------------------------------
   31. Loading States
   ---------------------------------------------------------- */

.skeleton {
  background: linear-gradient(
    90deg,
    var(--bg-tertiary) 25%,
    var(--border-light) 50%,
    var(--bg-tertiary) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
  border-radius: var(--radius-sm);
}

.skeleton-text {
  height: 14px;
  margin-bottom: 8px;
  border-radius: 4px;
}

.skeleton-text.short { width: 60%; }
.skeleton-text.medium { width: 80%; }
.skeleton-text.long { width: 100%; }

.skeleton-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
}

.skeleton-card {
  height: 120px;
  border-radius: var(--radius);
}

.skeleton-chart {
  height: 300px;
  border-radius: var(--radius);
}

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border-light);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.spinner-sm {
  width: 18px;
  height: 18px;
  border-width: 2px;
}

.spinner-lg {
  width: 48px;
  height: 48px;
  border-width: 4px;
}

.loading-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  z-index: 10;
}

[data-theme="dark"] .loading-overlay {
  background: rgba(0, 0, 0, 0.5);
}

/* ----------------------------------------------------------
   32. Two-Column Grid Layout
   ---------------------------------------------------------- */

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}

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

@media (max-width: 1024px) {
  .grid-3 {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .grid-2,
  .grid-3 {
    grid-template-columns: 1fr;
  }
}

/* ----------------------------------------------------------
   33. Tabs Component
   ---------------------------------------------------------- */

.tabs {
  display: flex;
  border-bottom: 2px solid var(--border-light);
  margin-bottom: 20px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.tab-item {
  padding: 12px 20px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  white-space: nowrap;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: var(--transition);
}

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

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

/* ----------------------------------------------------------
   34. Dropdown Menu
   ---------------------------------------------------------- */

.dropdown {
  position: relative;
  display: inline-block;
}

.dropdown-menu {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  min-width: 180px;
  z-index: 500;
  overflow: hidden;
  animation: scaleIn 0.15s ease;
}

.dropdown-menu.open {
  display: block;
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  font-size: 14px;
  color: var(--text-primary);
  cursor: pointer;
  transition: var(--transition);
}

.dropdown-item:hover {
  background: var(--bg-tertiary);
}

.dropdown-item.danger {
  color: var(--red);
}

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

/* ----------------------------------------------------------
   35. Tooltip
   ---------------------------------------------------------- */

.tooltip {
  position: relative;
}

.tooltip::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) scale(0.9);
  background: var(--text-primary);
  color: var(--bg-secondary);
  font-size: 12px;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: 6px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: all 0.2s ease;
  z-index: 600;
}

.tooltip:hover::after {
  opacity: 1;
  transform: translateX(-50%) scale(1);
}

/* ----------------------------------------------------------
   36. Glassmorphism Helpers
   ---------------------------------------------------------- */

.glass {
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.3);
}

[data-theme="dark"] .glass {
  background: rgba(28, 28, 30, 0.7);
  border-color: rgba(255, 255, 255, 0.08);
}

/* ----------------------------------------------------------
   37. Reduced Motion
   ---------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ----------------------------------------------------------
   38. Focus Visible (Accessibility)
   ---------------------------------------------------------- */

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

button:focus:not(:focus-visible),
a:focus:not(:focus-visible),
input:focus:not(:focus-visible),
select:focus:not(:focus-visible) {
  outline: none;
}

/* ----------------------------------------------------------
   39. Misc / Context Menu
   ---------------------------------------------------------- */

.divider {
  width: 100%;
  height: 1px;
  background: var(--border-light);
  margin: 16px 0;
}

.avatar-sm {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  font-size: 11px;
}

.avatar-md {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  font-size: 15px;
}

.avatar-lg {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  font-size: 20px;
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  background: var(--bg-tertiary);
  color: var(--text-secondary);
}

.tag .tag-remove {
  cursor: pointer;
  font-size: 14px;
  color: var(--text-tertiary);
  margin-left: 2px;
}

.tag .tag-remove:hover {
  color: var(--red);
}

/* Notification dot */
.notification-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--red);
  display: inline-block;
}

/* Currency display */
.currency {
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.3px;
}

/* ----------------------------------------------------------
   Password Change Success Message
   ---------------------------------------------------------- */

.auth-success {
  background-color: var(--green-light);
  color: var(--green);
  border: 1px solid var(--green);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 13px;
  margin-bottom: 16px;
  line-height: 1.4;
}

/* ----------------------------------------------------------
   Family Members & Invitation System
   ---------------------------------------------------------- */

/* Page header actions */
.page-header-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

/* Members Grid */
.members-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

/* Member Card */
.member-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  background: var(--bg-tertiary);
  border-radius: var(--radius);
  transition: var(--transition);
  position: relative;
}

.member-card:hover {
  box-shadow: var(--shadow);
}

.member-card-self {
  border: 2px solid var(--accent);
  background: var(--accent-light);
}

.member-avatar {
  width: 48px;
  height: 48px;
  min-width: 48px;
  border-radius: 50%;
  background: var(--accent);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 16px;
  letter-spacing: 0.5px;
}

.member-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.member-name {
  font-weight: 600;
  font-size: 15px;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.member-you-badge {
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-light);
  padding: 1px 8px;
  border-radius: 10px;
  line-height: 1.6;
}

.member-email {
  font-size: 13px;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.member-role-label {
  font-size: 12px;
  font-weight: 600;
  padding: 2px 10px;
  border-radius: 10px;
  display: inline-block;
  width: fit-content;
  margin-top: 2px;
}

.role-admin {
  background: var(--purple-light);
  color: var(--purple);
}

.role-member {
  background: var(--green-light);
  color: var(--green);
}

.role-readonly {
  background: var(--orange-light);
  color: var(--orange);
}

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

/* Member Permissions */
.member-permissions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px 0;
}

.member-permissions .checkbox-label {
  font-size: 14px;
}

/* Invitation System */
.invite-method-tabs {
  display: flex;
  gap: 0;
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
  padding: 4px;
  margin-bottom: 20px;
}

.invite-tab {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  background: transparent;
  border: none;
  border-radius: calc(var(--radius-sm) - 2px);
  cursor: pointer;
  transition: var(--transition);
}

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

.invite-tab.active {
  background: var(--bg-secondary);
  color: var(--accent);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
  font-weight: 600;
}

.invite-tab i,
.invite-tab svg {
  width: 16px;
  height: 16px;
}

/* Invite Method Content */
.invite-method-content {
  animation: fadeIn 0.25s ease;
}

.invite-method-content:not(.active) {
  display: none;
}

.invite-method-desc {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 16px;
}

/* Invite Code Display */
.invite-code-display {
  text-align: center;
  padding: 24px;
  margin-bottom: 16px;
  background: var(--bg-tertiary);
  border-radius: var(--radius);
  border: 2px dashed var(--border);
}

.invite-code-value {
  font-size: 36px;
  font-weight: 700;
  letter-spacing: 4px;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
  display: block;
  margin-bottom: 8px;
  word-break: break-all;
}

.invite-code-hint {
  font-size: 12px;
  color: var(--text-tertiary);
}

/* Invite Link Display */
.invite-link-display {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 16px;
}

.invite-link-display .form-input {
  flex: 1;
  font-size: 13px;
  background: var(--bg-tertiary);
}

/* Role Presets */
.role-presets {
  display: flex;
  gap: 10px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.role-preset {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border: 2px solid var(--border-light);
  border-radius: var(--radius-sm);
  background: var(--bg-secondary);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
}

.role-preset:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.role-preset.active {
  border-color: var(--accent);
  background: var(--accent-light);
  color: var(--accent);
  font-weight: 600;
}

.role-preset i,
.role-preset svg {
  width: 16px;
  height: 16px;
}

/* Pending Invitations */
.pending-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 24px;
  padding: 0 8px;
  border-radius: 12px;
  background: var(--orange);
  color: #ffffff;
  font-size: 12px;
  font-weight: 700;
}

.invitation-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border-light);
}

.invitation-item:last-child {
  border-bottom: none;
}

.invitation-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.invitation-method {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  font-size: 14px;
  color: var(--text-primary);
}

.invitation-method i,
.invitation-method svg {
  width: 16px;
  height: 16px;
  color: var(--accent);
}

.invitation-email {
  font-size: 13px;
  color: var(--text-secondary);
}

.invitation-meta {
  font-size: 12px;
  color: var(--text-tertiary);
}

.invitation-code-small {
  font-size: 12px;
  color: var(--text-secondary);
  word-break: break-all;
  max-width: 100%;
  overflow-wrap: break-word;
}

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

/* Responsive adjustments */
@media (max-width: 600px) {
  .members-grid {
    grid-template-columns: 1fr;
  }

  .invite-method-tabs {
    flex-direction: column;
    gap: 4px;
  }

  .invite-tab {
    justify-content: flex-start;
  }

  .role-presets {
    flex-direction: column;
  }

  .page-header-actions {
    flex-direction: column;
    width: 100%;
  }

  .page-header-actions .btn {
    width: 100%;
    justify-content: center;
  }

  .invite-link-display {
    flex-direction: column;
  }

  .invitation-item {
    flex-direction: column;
    align-items: flex-start;
  }

  .invitation-actions {
    align-self: flex-end;
  }
}

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

/* ----------------------------------------------------------
   Fixkosten List
   ---------------------------------------------------------- */

.fixcost-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  border-bottom: 1px solid var(--border-light);
  transition: var(--transition);
}

.fixcost-item:last-child {
  border-bottom: none;
}

.fixcost-item:hover {
  background: var(--bg-tertiary);
}

.fixcost-info {
  display: flex;
  align-items: center;
  gap: 14px;
  flex: 1;
}

.fixcost-icon {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.fixcost-icon.miete { background: var(--red-light); color: var(--red); }
.fixcost-icon.strom { background: var(--orange-light); color: var(--orange); }
.fixcost-icon.internet { background: var(--accent-light); color: var(--accent); }
.fixcost-icon.versicherungen { background: var(--purple-light); color: var(--purple); }
.fixcost-icon.abos { background: #ffe5ec; color: #FF2D55; }
.fixcost-icon.auto { background: var(--purple-light); color: var(--purple); }
.fixcost-icon.gesundheit { background: #ffe5ec; color: #FF6482; }
.fixcost-icon.sonstiges { background: var(--bg-tertiary); color: var(--text-secondary); }

.fixcost-details {
  flex: 1;
}

.fixcost-name {
  font-weight: 600;
  font-size: 15px;
  color: var(--text-primary);
  display: block;
}

.fixcost-meta {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 2px;
  display: block;
}

.fixcost-amount {
  font-weight: 700;
  font-size: 16px;
  color: var(--red);
  margin-right: 12px;
  white-space: nowrap;
}

.fixcost-actions {
  display: flex;
  gap: 4px;
}

/* ----------------------------------------------------------
   Payment History
   ---------------------------------------------------------- */

.payment-history-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.payment-history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-light);
  transition: var(--transition);
}

.payment-history-item:last-child {
  border-bottom: none;
}

.payment-history-item:hover {
  background: var(--bg-tertiary);
}

.payment-history-info {
  flex: 1;
}

.payment-history-date {
  font-weight: 600;
  font-size: 14px;
  color: var(--text-primary);
  display: block;
}

.payment-history-note {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 2px;
  display: block;
}

.payment-history-amount {
  font-weight: 700;
  font-size: 16px;
  color: var(--green);
  margin-right: 12px;
}

.payment-history-actions {
  display: flex;
  gap: 4px;
}

.payment-history-summary {
  display: flex;
  justify-content: space-between;
  padding: 14px 16px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
  font-weight: 600;
}

/* ----------------------------------------------------------
   Goal Card Improvements
   ---------------------------------------------------------- */

/* ---- Goal Cards (Redesigned) ---- */
.goal-card {
  background: var(--bg-secondary);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  transition: var(--transition);
  overflow: hidden;
}
.goal-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}
.goal-card.completed {
  border-left: 3px solid #34C759;
}

/* Top: title + menu */
.goal-card-top {
  margin-bottom: 16px;
}
.goal-card-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
.goal-card-title-row .goal-name {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.goal-card-menu {
  display: flex;
  gap: 2px;
  flex-shrink: 0;
}
.btn-icon-sm { width: 30px; height: 30px; padding: 0; display: inline-flex; align-items: center; justify-content: center; }
.btn-icon-sm svg { width: 14px; height: 14px; }
.goal-deadline-badge,
.goal-complete-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  padding: 3px 8px;
  border-radius: 20px;
  margin-top: 8px;
}
.goal-deadline-badge {
  background: var(--bg-tertiary);
  color: var(--text-secondary);
}
.goal-deadline-badge svg { width: 12px; height: 12px; }
.goal-complete-badge {
  background: rgba(52, 199, 89, 0.15);
  color: #34C759;
  font-weight: 600;
}
.goal-complete-badge svg { width: 14px; height: 14px; }

/* Progress section */
.goal-card-progress {
  margin-bottom: 16px;
}
.goal-card-progress-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 8px;
}
.goal-card-progress-pct {
  font-size: 28px;
  font-weight: 800;
  line-height: 1;
}
.goal-card-progress-amounts {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}
.goal-card-progress-amounts .text-muted {
  font-weight: 400;
}
.goal-card-bar {
  width: 100%;
  height: 8px;
  background: var(--bg-tertiary);
  border-radius: 4px;
  overflow: hidden;
}
.goal-card-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.8s cubic-bezier(0.25, 0.1, 0.25, 1);
  min-width: 2px;
}

/* Stats row */
.goal-card-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}
.goal-stat {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-tertiary);
  border-radius: 8px;
  padding: 8px 12px;
  flex: 1;
  min-width: 0;
}
.goal-stat-label {
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
}
.goal-stat-value {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-left: auto;
  white-space: nowrap;
}

/* Action buttons */
.goal-card-actions {
  display: flex;
  gap: 8px;
}
.goal-btn-main {
  flex: 1;
}
.goal-card-actions .btn { font-size: 13px; }

/* ----------------------------------------------------------
   View Toggle (List vs Tile)
   ---------------------------------------------------------- */

.view-toggle {
  display: flex;
  gap: 4px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
  padding: 3px;
}

.view-toggle-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 30px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  border-radius: 6px;
  cursor: pointer;
  transition: var(--transition);
}

.view-toggle-btn.active {
  background: var(--bg-secondary);
  color: var(--accent);
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.view-toggle-btn:hover:not(.active) {
  color: var(--text-primary);
}

/* Tile/Grid view for transactions */
.transactions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}

.transaction-tile {
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
  padding: 16px;
  border: 1px solid var(--border-light);
  transition: var(--transition);
}

.transaction-tile:hover {
  box-shadow: var(--shadow);
  transform: translateY(-1px);
}

.transaction-tile-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 8px;
}

.transaction-tile-amount {
  font-size: 20px;
  font-weight: 700;
}

.transaction-tile-amount.income { color: var(--green); }
.transaction-tile-amount.expense { color: var(--red); }

.transaction-tile-category {
  font-size: 12px;
  padding: 3px 8px;
  border-radius: 12px;
  background: var(--bg-tertiary);
  color: var(--text-secondary);
}

.transaction-tile-desc {
  font-size: 14px;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.transaction-tile-date {
  font-size: 12px;
  color: var(--text-tertiary);
}

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

/* ----------------------------------------------------------
   Sidebar profile link hover
   ---------------------------------------------------------- */

.sidebar-profile-link:hover {
  opacity: 0.8;
}

.sidebar-profile-link:hover .user-avatar {
  box-shadow: 0 0 0 3px var(--accent);
}

/* ----------------------------------------------------------
   Debt card quick-action buttons
   ---------------------------------------------------------- */

.debt-card-quick-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.debt-card-quick-actions .btn {
  font-size: 12px;
  padding: 6px 10px;
}

/* ----------------------------------------------------------
   Profile Avatar Images
   ---------------------------------------------------------- */

.user-avatar img,
.avatar-large img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

/* Settings Avatar Preview (keep small) */
.settings-avatar-preview {
  width: 80px !important;
  height: 80px !important;
  cursor: pointer;
  transition: var(--transition);
  border: 3px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  overflow: hidden;
}

.settings-avatar-preview i,
.settings-avatar-preview svg {
  width: 32px;
  height: 32px;
  color: var(--text-secondary);
}

.settings-avatar-preview:hover {
  border-color: var(--accent);
  transform: scale(1.05);
}

.settings-avatar-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

/* Avatar Lightbox */
.avatar-lightbox {
  position: relative;
  max-width: 90vw;
  max-height: 90vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.avatar-lightbox img {
  width: 70vmin;
  height: 70vmin;
  max-width: 400px;
  max-height: 400px;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 12px 60px rgba(0,0,0,0.6);
  border: 4px solid rgba(255,255,255,0.2);
}

.avatar-lightbox-close {
  position: absolute;
  top: -15px;
  right: -15px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: var(--card-bg);
  color: var(--text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
  z-index: 1;
}

#modal-avatar-lightbox {
  background: rgba(0,0,0,0.85);
}

/* ----------------------------------------------------------
   Account Tabs (Privat / Gemeinschaftskonto)
   ---------------------------------------------------------- */

.account-tabs {
  display: flex;
  gap: 0;
  background: var(--card-bg);
  border-radius: 12px;
  padding: 4px;
  margin-bottom: 16px;
  border: 1px solid var(--border);
}

.account-tab {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 500;
  border-radius: 10px;
  cursor: pointer;
  transition: var(--transition);
}

.account-tab:hover {
  color: var(--text);
  background: rgba(255,255,255,0.05);
}

.account-tab.active {
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(59,130,246,0.3);
}

.account-tab i,
.account-tab svg {
  width: 16px;
  height: 16px;
}

.group-filter-bar {
  margin-bottom: 8px;
}

.group-filter-bar .filter-group {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.group-filter-bar label {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
}

.group-filter-select {
  min-width: 180px;
}

/* ----------------------------------------------------------
   Group Cards & Group Management
   ---------------------------------------------------------- */

.groups-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}

.group-card {
  background: var(--card-bg);
  border-radius: 16px;
  padding: 20px;
  border: 1px solid var(--border);
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.group-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: var(--group-color, var(--accent));
  border-radius: 4px 0 0 4px;
}

.group-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0,0,0,0.15);
  border-color: var(--group-color, var(--accent));
}

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

.group-card-name {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
  margin: 0;
}

.group-card-type {
  font-size: 0.75rem;
  padding: 3px 10px;
  border-radius: 20px;
  background: rgba(59,130,246,0.15);
  color: var(--accent);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.group-card-desc {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 12px;
  line-height: 1.4;
}

.group-card-meta {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.group-card-meta i,
.group-card-meta svg {
  width: 14px;
  height: 14px;
}

.group-card-meta-item {
  display: flex;
  align-items: center;
  gap: 4px;
}

.group-card-actions {
  display: flex;
  gap: 8px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

/* Group Type Preset Buttons */
.group-type-presets {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.group-type-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 12px 8px;
  border: 2px solid var(--border);
  background: transparent;
  color: var(--text-secondary);
  border-radius: 12px;
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 500;
  transition: var(--transition);
}

.group-type-btn:hover {
  border-color: var(--accent);
  color: var(--text);
}

.group-type-btn.active {
  border-color: var(--accent);
  background: rgba(59,130,246,0.1);
  color: var(--accent);
  font-weight: 600;
}

.group-type-btn i,
.group-type-btn svg {
  width: 20px;
  height: 20px;
}

/* Group Color Preset Buttons */
.group-color-presets {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.group-color-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 3px solid transparent;
  cursor: pointer;
  transition: var(--transition);
  padding: 0;
}

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

.group-color-btn.active {
  border-color: #fff;
  box-shadow: 0 0 0 2px var(--accent), 0 2px 8px rgba(0,0,0,0.2);
  transform: scale(1.1);
}

/* Group Detail View */
.group-detail-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.group-detail-color {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1.2rem;
}

.group-detail-color i,
.group-detail-color svg {
  width: 24px;
  height: 24px;
}

.group-detail-info h3 {
  font-size: 1.15rem;
  font-weight: 700;
  margin: 0 0 4px;
}

.group-detail-info p {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin: 0;
}

.group-members-section {
  margin-top: 20px;
}

.group-members-section h4 {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--text);
}

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

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

.group-member-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.group-member-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.85rem;
}

.group-member-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.group-member-name {
  font-weight: 600;
  font-size: 0.9rem;
}

.group-member-email {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.group-member-role {
  font-size: 0.75rem;
  padding: 3px 10px;
  border-radius: 20px;
  font-weight: 600;
}

.group-member-role.owner {
  background: rgba(245,158,11,0.15);
  color: #f59e0b;
}

.group-member-role.admin {
  background: rgba(59,130,246,0.15);
  color: var(--accent);
}

.group-member-role.member {
  background: rgba(16,185,129,0.15);
  color: #10b981;
}

.group-member-role.readonly {
  background: rgba(156,163,175,0.15);
  color: #9ca3af;
}

/* Permission Toggles */
.permission-toggles {
  margin-top: 8px;
}

/* Role Presets in group member modal */
#modal-add-group-member .role-presets {
  display: flex;
  gap: 8px;
}

@media (max-width: 600px) {
  .group-type-presets {
    grid-template-columns: repeat(2, 1fr);
  }
  .groups-grid {
    grid-template-columns: 1fr;
  }
  .account-tabs {
    font-size: 0.82rem;
  }
  .account-tab {
    padding: 8px 10px;
    font-size: 0.82rem;
  }
}

/* ----------------------------------------------------------
   Form Section Divider
   ---------------------------------------------------------- */

.form-section-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0 12px;
}

.form-section-divider::before,
.form-section-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.form-section-divider span {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
  white-space: nowrap;
}

/* ----------------------------------------------------------
   File Upload Area
   ---------------------------------------------------------- */

.file-upload-area {
  border: 2px dashed var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  overflow: hidden;
}

.file-upload-area:hover,
.file-upload-area.drag-over {
  border-color: var(--accent);
  background: rgba(0, 122, 255, 0.05);
}

.file-upload-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 20px 16px;
  color: var(--text-secondary);
}

.file-upload-area.has-files .file-upload-placeholder {
  padding: 12px 16px;
  flex-direction: row;
  justify-content: center;
  gap: 8px;
}

.file-upload-area.has-files .file-upload-placeholder i {
  width: 18px;
  height: 18px;
}

.file-upload-area.has-files .file-upload-placeholder small {
  display: none;
}

.file-upload-placeholder i {
  width: 32px;
  height: 32px;
  opacity: 0.5;
}

.file-upload-placeholder span {
  font-size: 13px;
  font-weight: 500;
}

.file-upload-placeholder small {
  font-size: 11px;
  opacity: 0.6;
}

.file-upload-preview {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: var(--bg-secondary);
}

.file-upload-preview i {
  width: 20px;
  height: 20px;
  color: var(--accent);
  flex-shrink: 0;
}

.file-upload-preview span {
  flex: 1;
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-remove-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 4px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.file-remove-btn:hover {
  color: var(--danger);
  background: rgba(255, 59, 48, 0.1);
}

.file-remove-btn i {
  width: 16px;
  height: 16px;
  color: inherit;
}

/* ----------------------------------------------------------
   Debt Payment Info Card
   ---------------------------------------------------------- */

.debt-payment-info {
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  margin-top: 10px;
}

.debt-payment-info-title {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
  margin-bottom: 10px;
}

.debt-payment-info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  font-size: 13px;
}

.debt-payment-info-row + .debt-payment-info-row {
  border-top: 1px solid var(--border);
}

.debt-payment-info-label {
  color: var(--text-secondary);
  font-weight: 500;
}

.debt-payment-info-value {
  color: var(--text-primary);
  font-weight: 600;
  text-align: right;
  word-break: break-all;
  max-width: 60%;
}

.debt-payment-info-value.iban {
  font-family: 'SF Mono', 'Fira Code', monospace;
  letter-spacing: 1px;
  font-size: 12px;
}

.debt-attachments-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.debt-att-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  max-width: 220px;
  min-width: 0;
}

.debt-att-chip:hover {
  border-color: var(--accent);
  background: rgba(0, 122, 255, 0.06);
}

.debt-att-chip-icon {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.debt-att-chip-icon.pdf {
  background: rgba(239, 68, 68, 0.12);
}

.debt-att-chip-icon.pdf i {
  width: 18px;
  height: 18px;
  color: #ef4444;
}

.debt-att-chip-icon.img {
  background: rgba(59, 130, 246, 0.12);
}

.debt-att-chip-icon.img i {
  width: 18px;
  height: 18px;
  color: var(--accent);
}

.debt-att-chip-info {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.debt-att-chip-name {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.debt-att-chip-ext {
  font-size: 10px;
  color: var(--text-secondary);
  font-weight: 600;
  letter-spacing: 0.5px;
}

.payment-type-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  background: rgba(0, 122, 255, 0.15);
  color: var(--accent);
}

/* ----------------------------------------------------------
   Debt Header Right (amount + edit button)
   ---------------------------------------------------------- */

.debt-header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.debt-menu-wrapper {
  position: relative;
}

.debt-menu-btn {
  color: var(--text-secondary);
  padding: 4px;
  border-radius: 50%;
  transition: var(--transition);
}

.debt-menu-btn:hover {
  color: var(--text-primary);
  background: var(--bg-secondary);
}

.debt-menu-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  z-index: 100;
  min-width: 160px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
  padding: 4px;
  margin-top: 4px;
}

.debt-menu-dropdown.open {
  display: block;
}

.debt-menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 10px 12px;
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border-radius: 6px;
  transition: var(--transition);
}

.debt-menu-item i {
  width: 16px;
  height: 16px;
}

.debt-menu-item:hover {
  background: var(--bg-primary);
}

.debt-menu-item.danger {
  color: var(--danger);
}

.debt-menu-item.danger:hover {
  background: rgba(255, 59, 48, 0.1);
}

/* File Upload List (multi) */

.file-upload-list {
  margin-top: 10px;
}

.file-chips-header {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 8px;
}

.file-chips-header span {
  font-size: 11px;
  color: var(--text-secondary);
  font-weight: 500;
  letter-spacing: 0.3px;
}

.file-chips-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

@media (max-width: 400px) {
  .file-chips-grid {
    grid-template-columns: 1fr;
  }
}

.file-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  position: relative;
  transition: var(--transition);
  animation: fadeIn 0.2s ease;
}

.file-chip:hover {
  border-color: var(--accent);
  background: rgba(0, 122, 255, 0.04);
}

.file-chip-thumb {
  width: 40px;
  height: 40px;
  border-radius: 6px;
  flex-shrink: 0;
  background-size: cover;
  background-position: center;
  background-color: var(--bg-tertiary);
  overflow: hidden;
}

.file-chip-thumb-pdf {
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(239, 68, 68, 0.1);
}

.file-chip-thumb-pdf i {
  width: 20px;
  height: 20px;
  color: #ef4444;
}

.file-chip-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.file-chip-name {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-chip-size {
  font-size: 10px;
  color: var(--text-secondary);
  opacity: 0.7;
}

.file-chip-remove {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 4px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  opacity: 0.5;
  flex-shrink: 0;
}

.file-chip-remove:hover {
  color: var(--danger);
  background: rgba(255, 59, 48, 0.1);
  opacity: 1;
}

.file-chip-remove i {
  width: 14px;
  height: 14px;
  color: inherit;
}

/* ----------------------------------------------------------
   Debt History Timeline
   ---------------------------------------------------------- */

.history-summary {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
}

.history-summary-item {
  flex: 1;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.history-summary-label {
  font-size: 11px;
  color: var(--text-secondary);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.history-summary-value {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
}

.history-summary-value.accent {
  color: var(--accent);
}

.history-timeline {
  position: relative;
  padding-left: 20px;
}

.history-timeline::before {
  content: '';
  position: absolute;
  left: 6px;
  top: 8px;
  bottom: 8px;
  width: 2px;
  background: var(--border);
  border-radius: 1px;
}

.history-entry {
  position: relative;
  margin-bottom: 12px;
}

.history-entry:last-child {
  margin-bottom: 0;
}

.history-entry-dot {
  position: absolute;
  left: -17px;
  top: 14px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--bg-primary);
  box-shadow: 0 0 0 2px var(--accent);
  z-index: 1;
}

.history-entry-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  transition: var(--transition);
}

.history-entry-card:hover {
  border-color: var(--accent);
}

.history-entry-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.history-entry-amount {
  font-size: 16px;
  font-weight: 700;
  color: var(--success, #22c55e);
}

.history-entry-actions {
  display: flex;
  gap: 2px;
  opacity: 0.4;
  transition: var(--transition);
}

.history-entry-card:hover .history-entry-actions {
  opacity: 1;
}

.btn-icon-sm {
  padding: 4px;
}

.btn-icon-sm i {
  width: 14px;
  height: 14px;
}

.history-entry-bottom {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 6px;
}

.history-entry-date,
.history-entry-note {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--text-secondary);
}

.history-entry-date i,
.history-entry-note i {
  width: 12px;
  height: 12px;
  opacity: 0.6;
}

/* ----------------------------------------------------------
   Share Debt Modal
   ---------------------------------------------------------- */

.share-section {
  margin-bottom: 20px;
}

.share-section:last-child {
  margin-bottom: 0;
}

.share-section-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

.share-section-title i {
  width: 14px;
  height: 14px;
}

.share-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.share-option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  text-align: left;
  width: 100%;
}

.share-option:hover {
  border-color: var(--accent);
  background: rgba(0, 122, 255, 0.04);
  transform: translateX(2px);
}

.share-option-avatar {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
}

.share-option-avatar i {
  width: 20px;
  height: 20px;
}

.share-option-avatar.member {
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  border-radius: 50%;
}

.share-option-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.share-option-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.share-option-sub {
  font-size: 12px;
  color: var(--text-secondary);
}

.share-option-arrow {
  width: 16px;
  height: 16px;
  color: var(--text-secondary);
  opacity: 0.4;
  flex-shrink: 0;
  transition: var(--transition);
}

.share-option:hover .share-option-arrow {
  opacity: 1;
  color: var(--accent);
  transform: translateX(2px);
}

/* ----------------------------------------------------------
   Attachment Viewer Overlay
   ---------------------------------------------------------- */

.attachment-viewer-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10000;
  background: rgba(0, 0, 0, 0.92);
  display: flex;
  flex-direction: column;
  animation: fadeIn 0.2s ease;
}

.attachment-viewer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  background: rgba(30, 30, 30, 0.95);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  flex-shrink: 0;
}

.attachment-viewer-name {
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  margin-right: 16px;
}

.attachment-viewer-actions {
  display: flex;
  gap: 4px;
}

.attachment-viewer-btn {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.7);
  cursor: pointer;
  padding: 8px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.attachment-viewer-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
}

.attachment-viewer-btn i {
  width: 20px;
  height: 20px;
}

.attachment-viewer-close:hover {
  background: rgba(255, 59, 48, 0.3);
  color: #ff3b30;
}

.attachment-viewer-content {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: auto;
  padding: 20px;
}

.attachment-viewer-iframe {
  width: 100%;
  height: 100%;
  border: none;
  border-radius: 8px;
  background: #fff;
}

.attachment-viewer-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

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

/* ----------------------------------------------------------
   End of Style Sheet
   ---------------------------------------------------------- */
