:root {
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Arial, sans-serif;
  color: #111827;
}

/* Loading spinner */
.loading-spinner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #f6f7f9;
  z-index: 9999;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid #e5e7eb;
  border-top-color: #111827;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.loading-spinner p {
  margin-top: 16px;
  color: #6b7280;
  font-size: 14px;
}

body {
  margin: 0;
  padding: 24px;
  padding-left: max(24px, env(safe-area-inset-left));
  padding-right: max(24px, env(safe-area-inset-right));
  background: #f6f7f9;
  min-height: 100vh;
}

/* Override padding for auth wrapper pages */
body:has(.auth-wrapper) {
  padding: 0;
}

/* Mobile: remove padding to use full screen */
@media (max-width: 600px) {
  body {
    padding: 0;
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
  }
}

html, body {
  width: 100%;
  overflow-x: hidden;
  box-sizing: border-box;
}

*, *::before, *::after {
  box-sizing: inherit;
}

.card {
  max-width: 680px;
  margin: 0 auto;
  background: #fff;
  padding: 24px;
  border-radius: 16px;
  box-shadow: 0 2px 8px rgba(0,0,0,.04);
  position: relative;
}

@media (max-width: 600px) {
  .card {
    border-radius: 0;
    box-shadow: none;
    padding: 20px;
    min-height: 100vh;
  }
}

.header h1 { margin: 0; font-size: 24px; font-weight: 700; }
.subtitle { margin: 6px 0 24px; color: #6b7280; font-size: 14px; line-height: 1.5; }

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

.col-span-2 { grid-column: 1 / -1; }

.field-row {
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: 100%;
}

.field { display: grid; gap: 8px; }
.field label { display: grid; gap: 8px; }
.field span { font-size: 14px; color: #374151; font-weight: 600; }
.hint { color: #9ca3af; font-size: 13px; }
.field-hint { 
  color: #6b7280; 
  font-size: 12px; 
  font-weight: 400;
  margin-top: -2px;
}

.form-actions {
  display: flex;
  gap: 12px;
  margin-top: 8px;
}

.form-actions .btn-primary,
.form-actions .btn-secondary {
  flex: 1;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
}

.checkbox-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
  margin: 0;
}

.checkbox-label span {
  font-size: 14px;
  color: #374151;
  line-height: 1.4;
}

input, textarea, select, button {
  font: inherit;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid #e5e7eb;
  background: #fff;
  transition: border-color 0.2s, background-color 0.2s;
}

input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: #a78bfa;
  background: #faf5ff;
}

/* Email validation states */
input[type="email"].valid {
  border-color: #10b981;
}

input.invalid,
input[type="email"].invalid {
  border-color: #ef4444;
}

textarea { resize: vertical; }

button {
  cursor: pointer;
  border: 0;
  background: #111827;
  color: #fff;
  padding: 10px 14px;
  border-radius: 10px;
}

/* Desktop: reduce button padding */
@media (min-width: 600px) {
  button {
    padding: 8px 16px;
  }
}

button:disabled { opacity: .6; cursor: not-allowed; }

button.secondary {
  background: #eef2ff;
  color: #111827;
  border: 1px solid #d0d7de;
}

button.ghost {
  background: transparent;
  color: #374151;
  border: 1px dashed #d0d7de;
}

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

.spacer { flex: 1; }

.hidden { display: none !important; }

.section {
  border: 1px solid #e5e7eb;
  border-radius: 16px;
  padding: 16px;
  background: #f9fafb;
}

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

.sectionHeader h2 {
  margin: 0;
  font-size: 16px;
}

.checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #374151;
}

.participantsList {
  display: grid;
  gap: 10px;
}

.participantRow {
  display: grid;
  grid-template-columns: 1fr 110px 40px;
  gap: 10px;
  align-items: center;
}

.participantRow .pctWrap {
  display: grid;
  gap: 4px;
}

.participantRow input[type="number"] {
  text-align: right;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border: 1px solid #e5e7eb;
  border-radius: 999px;
  background: #fff;
  font-size: 12px;
  color: #374151;
}

.actionsRow {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
}

.note {
  margin: 10px 0 0;
  font-size: 12px;
  color: #6b7280;
}

.footer {
  margin-top: 32px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  align-items: stretch;
}

.footer-buttons {
  display: flex;
  gap: 12px;
}

.footer-buttons button {
  flex: 1;
  padding: 14px 16px;
  font-size: 16px;
  font-weight: 600;
  border-radius: 12px;
  /* Subtle style - light background with border */
  background: #f9fafb;
  color: #374151;
  border: 1px solid #e5e7eb;
}

.footer-buttons button:hover {
  background: #f3f4f6;
  border-color: #d1d5db;
}

#submitBtn {
  width: 100%;
  padding: 14px 16px;
  font-size: 16px;
  font-weight: 600;
  border-radius: 12px;
}

#cancelBtn {
  background: #f3f4f6;
  color: #374151;
  border: 1px solid #d1d5db;
}

#cancelBtn:hover {
  background: #e5e7eb;
}

.status { margin: 0; font-size: 13px; }
.status.ok { color: #0a7a2f; }
.status.err { color: #b4231a; }
.status.loading { color: #0066cc; font-weight: 500; }

/* Inline spinner for status messages */
.status .spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid #a3d0ff;
  border-top-color: #0066cc;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  vertical-align: middle;
  margin-right: 6px;
}


/* Adaptaciones para pantallas grandes (desktop) */
@media (min-width: 769px) {
  .grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
  }

  .col-span-2 {
    grid-column: 1 / -1;
  }
  
  .field-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
}

select {
  max-width: 100%;
  min-width: 0;
}

/* Mejoras generales de legibilidad táctil */
input, select, textarea, button {
  font-size: 16px; /* evita zoom automático en iOS al enfocar */
}

/* ===== Auth Styles ===== */
.hidden {
  display: none !important;
}

/* Auth wrapper - centers login box */
.auth-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  padding-left: max(24px, env(safe-area-inset-left));
  padding-right: max(24px, env(safe-area-inset-right));
  background: #f6f7f9;
  margin: -24px; /* Offset body padding */
}

/* Auth box - container for login/register forms */
.auth-box {
  width: 100%;
  max-width: 420px;
  background: #fff;
  padding: 32px 24px;
  border-radius: 16px;
  box-shadow: 0 10px 28px rgba(0,0,0,.08);
}

/* Auth header */
.auth-header {
  text-align: center;
  margin-bottom: 24px;
}

.auth-header h1 {
  margin: 0 0 8px;
  font-size: 28px;
  font-weight: 600;
  color: #111827;
}

.auth-header p {
  margin: 0;
  font-size: 14px;
  color: #6b7280;
}

/* Form group styling */
.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 6px;
  color: #374151;
}

.form-group input {
  width: 100%;
  box-sizing: border-box;
}

.form-group .password-wrapper {
  position: relative;
  width: 100%;
}

.form-group .password-wrapper input {
  padding-right: 44px;
}

/* Auth forms */
.auth-box form {
  margin-bottom: 0;
}

.auth-box form h2 {
  margin: 0 0 20px;
  font-size: 22px;
  font-weight: 600;
  color: #111827;
  text-align: center;
}

/* Error message in auth forms */
.error {
  color: #b4231a;
  background: #fef2f2;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 14px;
  margin: 14px 0;
}

/* Success message in auth forms */
.success {
  color: #065f46;
  background: #d1fae5;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 14px;
  margin: 14px 0;
}

/* Form description text */
.form-description {
  color: #6b7280;
  font-size: 14px;
  margin: -10px 0 20px 0;
  line-height: 1.5;
}

/* Legacy support */
.error-message {
  color: #b4231a;
  background: #fef2f2;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 14px;
  margin: 10px 0;
}

.auth-form {
  margin-top: 10px;
}

.auth-switch {
  text-align: center;
  font-size: 14px;
  color: #6b7280;
  margin-top: 16px;
  margin-bottom: 0;
}

.auth-switch a {
  color: #2563eb;
  text-decoration: none;
  font-weight: 500;
}

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

/* Auth buttons */
.auth-box .btn,
.auth-box .btn-primary {
  width: 100%;
  padding: 12px 16px;
  font-size: 16px;
  font-weight: 500;
  margin-top: 6px;
  margin-bottom: 6px;
}

/* Password match hint */
.password-match {
  display: block;
  font-size: 12px;
  margin-top: 6px;
  font-weight: 500;
}

.password-match.match {
  color: #10b981;
}

.password-match.no-match {
  color: #ef4444;
}

/* Mobile responsiveness for auth */
@media (max-width: 600px) {
  .auth-wrapper {
    padding: 20px;
    padding-left: max(20px, env(safe-area-inset-left));
    padding-right: max(20px, env(safe-area-inset-right));
    margin: 0;
  }

  .auth-box {
    padding: 28px 20px;
    max-width: 100%;
  }

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

/* Header with user info */
.header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 2px;
}

.header-row h1 {
  flex: 1 1 auto;
  margin: 0;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.user-email {
  font-size: 12px;
  color: #6b7280;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 120px;
}

.logout-btn {
  background: none;
  border: 1px solid #d1d5db;
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 12px;
  color: #6b7280;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}

.logout-btn:hover {
  background: #f3f4f6;
  border-color: #9ca3af;
  color: #374151;
}

/* Desktop: more space for email */
@media (min-width: 600px) {
  .user-email {
    font-size: 13px;
    max-width: 180px;
  }

  .logout-btn {
    font-size: 13px;
    padding: 6px 12px;
  }
}

/* Password field with toggle button */
.password-field {
  position: relative;
  width: 100%;
}

.password-field input {
  width: 100%;
  padding-right: 44px; /* Space for the eye icon */
}

.toggle-password {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  padding: 6px;
  cursor: pointer;
  color: #9ca3af;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s;
  border-radius: 4px;
  width: 32px;
  height: 32px;
}

.toggle-password:hover {
  color: #6b7280;
  background: #f3f4f6;
}

.toggle-password:focus {
  outline: 2px solid #3b82f6;
  outline-offset: 2px;
}

.eye-icon {
  pointer-events: none;
  width: 18px;
  height: 18px;
}

/* Password match indicator */
.field-hint {
  display: block;
  font-size: 12px;
  margin-top: 4px;
  transition: all 0.2s;
}

.field-hint.match {
  color: #10b981;
}

.field-hint.no-match {
  color: #ef4444;
}

/* Password field validation states */
.password-field.valid input {
  border-color: #10b981;
}

.password-field.invalid input {
  border-color: #ef4444;
}

/* Loading state for buttons */
button[disabled] {
  opacity: 0.6;
  cursor: not-allowed;
}

button.loading {
  position: relative;
  color: transparent;
}

button.loading::after {
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
  top: 50%;
  left: 50%;
  margin-left: -8px;
  margin-top: -8px;
  border: 2px solid #ffffff;
  border-radius: 50%;
  border-top-color: transparent;
  animation: spinner 0.6s linear infinite;
}

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

/* Password strength indicator */
.password-strength {
  margin-top: 8px;
}

.strength-bar {
  height: 4px;
  background: #e5e7eb;
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 4px;
}

.strength-bar-fill {
  height: 100%;
  transition: width 0.3s ease, background-color 0.3s ease;
  border-radius: 2px;
}

.strength-bar-fill.weak {
  background-color: #ef4444;
}

.strength-bar-fill.acceptable {
  background-color: #f59e0b;
}

.strength-bar-fill.good {
  background-color: #3b82f6;
}

.strength-bar-fill.strong {
  background-color: #10b981;
}

.strength-text {
  font-size: 12px;
  color: #6b7280;
  font-weight: 500;
}

/* Navbar Component */
/* Navbar elements (integrated into header-row) */
.navbar-username {
  font-size: 12px;
  color: #6b7280;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 120px;
  flex-shrink: 0;
}

.hamburger-btn {
  background: none;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  padding: 5px 10px;
  font-size: 20px;
  cursor: pointer;
  transition: all 0.15s;
  color: #6b7280;
  line-height: 1;
  flex-shrink: 0;
}

.hamburger-btn:hover {
  background: #f3f4f6;
  border-color: #9ca3af;
  color: #374151;
}

/* Desktop: more space */
@media (min-width: 600px) {
  .navbar-username {
    font-size: 13px;
    max-width: 180px;
  }
}

/* Dropdown Menu */
.dropdown-menu {
  position: absolute;
  top: 48px;
  right: 20px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
  min-width: 200px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all 0.2s;
  z-index: 1000;
  overflow: hidden;
}

.dropdown-menu-open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.dropdown-item {
  display: block;
  padding: 12px 16px;
  color: #374151;
  text-decoration: none;
  font-size: 14px;
  transition: background 0.15s;
  border: none;
  width: 100%;
  text-align: left;
  background: none;
  cursor: pointer;
  font-family: inherit;
}

.dropdown-item:hover {
  background: #f9fafb;
}

.dropdown-item.active {
  background: #eff6ff;
  color: #2563eb;
  font-weight: 500;
}

.dropdown-logout {
  border-top: 1px solid #e5e7eb;
  color: #dc2626;
}

.dropdown-logout:hover {
  background: #fef2f2;
}

/* Dropdown Overlay */
.dropdown-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: transparent;
  opacity: 0;
  visibility: hidden;
  z-index: 999;
  transition: all 0.2s;
}

.dropdown-overlay-visible {
  opacity: 1;
  visibility: visible;
}

/* Mobile adjustments */
@media (max-width: 600px) {
  .dropdown-menu {
    right: 12px;
  }
}

/* Profile Page Styles */
.profile-section {
  margin-bottom: 32px;
}

.section-title {
  font-size: 18px;
  font-weight: 600;
  color: #111827;
  margin: 0 0 16px 0;
  padding-bottom: 8px;
  border-bottom: 1px solid #e5e7eb;
}

.action-buttons {
  display: flex;
  gap: 12px;
  margin-top: 16px;
}

.info-grid {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

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

.info-label {
  font-size: 13px;
  font-weight: 500;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.info-value {
  font-size: 16px;
  color: #111827;
}

/* No household state */
.no-household {
  text-align: center;
  padding: 48px 24px;
  background: #f9fafb;
  border-radius: 12px;
  border: 2px dashed #d1d5db;
}

.no-household-icon {
  font-size: 48px;
  margin-bottom: 16px;
}

.no-household-text {
  font-size: 16px;
  font-weight: 500;
  color: #374151;
  margin: 0 0 8px 0;
}

.no-household-hint {
  font-size: 14px;
  color: #6b7280;
  margin: 0 0 24px 0;
}

/* Household card */
.household-card {
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 20px;
}

.household-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
}

.household-icon {
  font-size: 32px;
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  border-radius: 12px;
  border: 1px solid #e5e7eb;
  flex-shrink: 0;
}

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

.household-name {
  font-size: 18px;
  font-weight: 600;
  color: #111827;
  margin: 0 0 4px 0;
}

.household-meta {
  font-size: 13px;
  color: #6b7280;
  margin: 0;
}

.household-actions {
  display: flex;
  gap: 8px;
}

/* Loading section */
.loading-section {
  text-align: center;
  padding: 48px 24px;
}

.spinner-small {
  width: 32px;
  height: 32px;
  border: 3px solid #e5e7eb;
  border-top-color: #111827;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 16px;
}

.loading-section p {
  font-size: 14px;
  color: #6b7280;
  margin: 0;
}

/* Error box */
.error-box {
  text-align: center;
  padding: 32px 24px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 12px;
}

.error-box p {
  color: #b91c1c;
  font-size: 14px;
  margin: 0 0 16px 0;
}

/* Mobile responsiveness for profile */
@media (max-width: 600px) {
  .household-header {
    flex-direction: column;
    text-align: center;
  }
  
  .household-actions {
    flex-direction: column;
  }
  
  .household-actions .btn-secondary {
    width: 100%;
  }
}

/* Household Page Styles */
.household-section {
  margin-bottom: 32px;
}

.household-header-card {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 24px;
  background: linear-gradient(135deg, #f9fafb 0%, #f3f4f6 100%);
  border-radius: 12px;
  border: 1px solid #e5e7eb;
}

.household-icon-large {
  font-size: 48px;
  width: 80px;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  border-radius: 16px;
  border: 1px solid #e5e7eb;
  flex-shrink: 0;
}

.household-info-large h2 {
  font-size: 24px;
  font-weight: 600;
  color: #111827;
  margin: 0 0 8px 0;
}

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

.section-header h3 {
  margin: 0;
}

/* Members List */
.members-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 400px;
  overflow-y: auto;
  padding-right: 4px;
}

.member-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
}

.member-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #e0e7ff;
  color: #4f46e5;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 16px;
  flex-shrink: 0;
}

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

.member-name {
  font-size: 15px;
  font-weight: 500;
  color: #111827;
  margin-bottom: 2px;
}

.member-email {
  font-size: 13px;
  color: #6b7280;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.member-role {
  font-size: 13px;
  padding: 4px 12px;
  border-radius: 6px;
  font-weight: 500;
  flex-shrink: 0;
  min-width: 90px;
  text-align: center;
}

.role-owner {
  background: #fef3c7;
  color: #92400e;
}

.role-member {
  background: #e0e7ff;
  color: #4338ca;
}

/* Contacts List */
.contacts-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 400px;
  overflow-y: auto;
  padding-right: 4px;
}

.contact-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  flex-wrap: nowrap;
  position: relative;
}

.contact-item:has(.three-dots-menu[style*="display: block"]) {
  z-index: 100;
}

.member-item:has(.three-dots-menu[style*="display: block"]) {
  z-index: 100;
}

.contact-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #dbeafe;
  color: #1e40af;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 16px;
  flex-shrink: 0;
}

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

.contact-name {
  font-size: 15px;
  font-weight: 500;
  color: #111827;
  margin-bottom: 2px;
}

.linked-badge {
  font-size: 13px;
  padding: 4px 12px;
  border-radius: 6px;
  background: #d1fae5;
  color: #059669;
  font-weight: 500;
  flex-shrink: 0;
  min-width: 90px;
  text-align: center;
}

.inactive-badge {
  font-size: 13px;
  padding: 4px 12px;
  border-radius: 6px;
  background: #fee2e2;
  color: #dc2626;
  font-weight: 500;
  flex-shrink: 0;
  min-width: 90px;
  text-align: center;
}

.contact-badges {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-shrink: 0;
}

.contact-details {
  font-size: 13px;
  color: #6b7280;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 32px 16px;
  color: #6b7280;
  font-size: 14px;
  background: #f9fafb;
  border-radius: 10px;
  border: 2px dashed #e5e7eb;
}

.empty-state p {
  margin: 0;
}

/* Form card for inline forms */
.form-card {
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 16px;
}

.form-card h4 {
  margin: 0 0 12px 0;
  font-size: 15px;
  font-weight: 600;
  color: #111827;
}

/* Make forms more compact */
.form-card .grid {
  gap: 10px;
}

.form-card .field {
  gap: 4px;
}

.form-card input,
.form-card textarea {
  padding: 8px 10px;
  font-size: 14px;
}

.form-card .form-actions {
  margin-top: 4px;
  gap: 8px;
}

.form-card .form-actions button {
  padding: 8px 12px;
  font-size: 14px;
}

/* Button small */
.btn-small {
  font-size: 13px;
  padding: 6px 12px;
}

/* Member and contact actions */
.member-actions,
.contact-actions {
  display: flex;
  flex-direction: row;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.contact-actions-menu {
  position: relative;
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.btn-menu {
  background: none;
  border: none;
  font-size: 24px;
  color: #6b7280;
  cursor: pointer;
  padding: 4px 8px;
  line-height: 1;
  border-radius: 4px;
}

.btn-menu:hover {
  background: #f3f4f6;
  color: #111827;
}

.contact-actions-menu .actions-dropdown {
  position: fixed;
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  z-index: 1000;
  min-width: 140px;
  padding: 4px 0;
}

.actions-dropdown .dropdown-item {
  display: block;
  width: 100%;
  padding: 10px 16px;
  background: none;
  border: none;
  text-align: left;
  cursor: pointer;
  font-size: 14px;
  color: #111827;
  white-space: nowrap;
}

.actions-dropdown .dropdown-item:hover {
  background: #f3f4f6;
}

.actions-dropdown .dropdown-item.text-danger {
  color: #dc2626;
}

.actions-dropdown .dropdown-item.text-danger:hover {
  background: #fee2e2;
}

.btn-link {
  background: none;
  border: none;
  color: #2563eb;
  cursor: pointer;
  padding: 4px 8px;
  font-size: 13px;
  text-decoration: underline;
  white-space: nowrap;
}

.btn-link:hover {
  color: #1d4ed8;
}

.text-sm {
  font-size: 13px;
}

.text-danger {
  color: #dc2626 !important;
}

.text-danger:hover {
  color: #b91c1c !important;
}

/* Mobile responsiveness */
@media (max-width: 600px) {
  .member-item,
  .contact-item {
    flex-wrap: nowrap;
  }
  
  .contact-actions {
    flex-shrink: 0;
    margin-left: auto;
  }
}

/* Household header actions */
.household-header-actions {
  display: flex;
  gap: 8px;
  margin-left: auto;
  position: relative;
}

.btn-danger {
  background: #dc2626;
  color: #fff;
  border: 1px solid #b91c1c;
}

.btn-danger:hover {
  background: #b91c1c;
}

/* Responsive household header */
@media (max-width: 600px) {
  .household-header-card {
    flex-direction: column;
    text-align: center;
  }
  
  .household-header-actions {
    width: 100%;
    margin-left: 0;
  }
  
  .household-header-actions button {
    flex: 1;
  }
}

/* Modal overlay and modal */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  animation: fadeIn 0.2s;
}

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

.modal {
  background: #fff;
  border-radius: 12px;
  max-width: 500px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  animation: slideIn 0.2s;
}

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

.modal-header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid #e5e7eb;
}

.modal-header h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: #111827;
}

.modal-body {
  padding: 20px 24px;
}

.modal-body p {
  margin: 0 0 12px 0;
  color: #374151;
  line-height: 1.6;
}

.modal-footer {
  padding: 16px 24px 20px;
  border-top: 1px solid #e5e7eb;
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

.modal-footer button {
  min-width: 100px;
}

/* Scope modal specific styles */
.scope-modal {
  background: #fff;
  border-radius: 12px;
  max-width: 500px;
  width: 90%;
  padding: 24px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  animation: slideIn 0.2s;
}

.scope-options {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.scope-option {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px;
  border: 2px solid #e5e7eb;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.15s;
}

.scope-option:hover {
  border-color: #2563eb;
  background-color: #eff6ff;
}

.scope-option input[type="radio"] {
  margin-top: 2px;
  cursor: pointer;
}

.scope-option input[type="radio"]:checked {
  accent-color: #2563eb;
}

.scope-option:has(input:checked) {
  border-color: #2563eb;
  background-color: #eff6ff;
}

.scope-option-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.scope-option-content strong {
  font-size: 14px;
  font-weight: 600;
  color: #111827;
}

.scope-option-content span {
  font-size: 12px;
  color: #6b7280;
  line-height: 1.4;
}

.scope-option-danger {
  border-color: #fee2e2;
}

.scope-option-danger:hover {
  border-color: #dc2626;
  background-color: #fef2f2;
}

.scope-option-danger:has(input:checked) {
  border-color: #dc2626;
  background-color: #fef2f2;
}

.modal-actions {
  display: flex;
  gap: 12px;
  margin-top: 24px;
}

.modal-content {
  background: #fff;
  border-radius: 12px;
  max-width: 500px;
  width: 90%;
  padding: 24px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  animation: slideIn 0.2s;
}

/* Back link */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: #6b7280;
  text-decoration: none;
  font-size: 14px;
  margin-bottom: 16px;
  transition: color 0.15s;
}

.back-link:hover {
  color: #2563eb;
}

.back-link:active {
  color: #1d4ed8;
}

/* Back link inside header */
.header .back-link {
  margin-bottom: 12px;
  margin-top: -4px;
}

/* Section description */
.section-description {
  font-size: 13px;
  color: #6b7280;
  margin: -8px 0 16px 0;
  line-height: 1.5;
}

/* Home page styles */
.month-navigation {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 24px 0;
  gap: 16px;
}

.month-navigation h2 {
  font-size: 18px;
  font-weight: 600;
  color: #111827;
  margin: 0;
  text-transform: capitalize;
}

.btn-nav {
  background: transparent;
  border: 1px solid #d1d5db;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 13px;
  color: #374151;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.btn-nav:hover {
  background: #f3f4f6;
  border-color: #9ca3af;
}

.btn-nav:active {
  background: #e5e7eb;
}

.income-summary {
  background: #ffffff;
  padding: 20px;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
}

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

.income-header h2 {
  font-size: 16px;
  font-weight: 600;
  color: #111827;
  margin: 0;
}

.btn-text {
  background: transparent;
  border: none;
  color: #2563eb;
  cursor: pointer;
  font-size: 13px;
  padding: 4px 8px;
  border-radius: 4px;
  transition: background 0.2s;
}

.btn-text:hover {
  background: #eff6ff;
}

.income-total {
  font-size: 28px;
  font-weight: 700;
  color: #2e7d32;
  margin: 8px 0;
}

.income-count {
  font-size: 13px;
  color: #6b7280;
  margin: 0 0 12px 0;
}

.income-details {
  margin-top: 16px;
}

.income-section {
  margin-bottom: 16px;
}

.income-section h3 {
  font-size: 14px;
  font-weight: 600;
  margin: 0 0 8px 0;
}

.income-type-group {
  margin-bottom: 12px;
}

.income-type-header {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: #374151;
  margin-bottom: 4px;
}

.income-entries {
  padding-left: 8px;
}

.income-entry {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  color: #6b7280;
  line-height: 1.6;
}

.btn-delete-income {
  background: none;
  border: none;
  padding: 4px 8px;
  cursor: pointer;
  font-size: 14px;
  opacity: 0.6;
  transition: opacity 0.2s;
}

.btn-delete-income:hover {
  opacity: 1;
}

.income-total-section {
  font-size: 15px;
  color: #111827;
  text-align: right;
}

.expenses-placeholder {
  margin-top: 32px;
  padding: 24px;
  background-color: #f5f5f5;
  border-radius: 8px;
  text-align: center;
}

.expenses-placeholder h2 {
  color: #666;
  margin-bottom: 8px;
  font-size: 16px;
}

.expenses-placeholder p {
  color: #999;
  font-size: 13px;
  margin: 0;
}

/* Three-dots menu for accounts */
.three-dots-btn {
  background: transparent;
  border: none;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  padding: 4px 8px;
  color: #6b7280;
  border-radius: 4px;
}

.three-dots-btn:hover {
  background: #f3f4f6;
  color: #374151;
}

.contact-actions {
  position: relative;
}

.member-actions {
  position: relative;
  min-width: 36px;
  display: flex;
  justify-content: flex-end;
}

.three-dots-menu {
  display: none;
  position: absolute;
  right: 0;
  top: 100%;
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  z-index: 1000;
  min-width: 120px;
  margin-top: 4px;
}

.three-dots-menu.menu-above {
  top: auto;
  bottom: 100%;
  margin-top: 0;
  margin-bottom: 4px;
}

.three-dots-menu .menu-item {
  display: block;
  width: 100%;
  padding: 8px 12px;
  border: none;
  background: transparent;
  text-align: left;
  font-size: 14px;
  color: #374151;
  cursor: pointer;
  transition: background 0.2s;
}

.three-dots-menu .menu-item:hover {
  background: #f3f4f6;
}

.three-dots-menu .menu-item:first-child {
  border-top-left-radius: 6px;
  border-top-right-radius: 6px;
}

.three-dots-menu .menu-item:last-child {
  border-bottom-left-radius: 6px;
  border-bottom-right-radius: 6px;
}

.three-dots-menu .menu-item-danger {
  color: #dc2626;
}

.three-dots-menu .menu-item-danger:hover {
  background: #fee2e2;
}

.empty-state {
  text-align: center;
  padding: 24px;
  color: #6b7280;
}

.empty-state-text {
  margin: 0;
  font-size: 14px;
}

/* ========================================
   MODERN DASHBOARD STYLES

/* ========================================
   MODERN DASHBOARD STYLES - LIGHT THEME
   ======================================== */

.dashboard {
  background: #f9fafb;
  min-height: 100vh;
  color: #111827;
  padding: 0;
}

.dashboard-header {
  padding: 20px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #e5e7eb;
  background: white;
}

.dashboard-title {
  font-size: 24px;
  font-weight: 600;
  color: #111827;
  margin: 0;
}

/* Tabs */
.tabs-container {
  position: relative;
  display: flex;
  align-items: center;
  margin: 20px -24px 0 -24px;
  background: white;
  border-top: 1px solid #e5e7eb;
  border-bottom: 1px solid #e5e7eb;
}

@media (max-width: 600px) {
  .tabs-container {
    margin: 16px -20px 0 -20px;
  }
}

.tabs-wrapper {
  flex: 1;
  overflow-x: auto;
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE/Edge */
  display: flex;
  justify-content: center;
}

@media (max-width: 600px) {
  .tabs-wrapper {
    justify-content: flex-start;
  }
}

.tabs-wrapper::-webkit-scrollbar {
  display: none; /* Chrome/Safari */
}

.dashboard-tabs {
  display: flex;
  gap: 0;
  padding: 0 8px;
  min-width: min-content;
  flex: 0 1 auto;
}

@media (max-width: 600px) {
  .dashboard-tabs {
    padding: 0 8px;
  }
}

.tab-scroll-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 100%;
  background: linear-gradient(to right, rgba(255, 255, 255, 0.95), white);
  border: none;
  padding: 10px;
  color: #6b7280;
  cursor: pointer;
  transition: all 0.3s ease;
  flex-shrink: 0;
  z-index: 1;
  box-shadow: -2px 0 8px rgba(0, 0, 0, 0.1);
  outline: none;
  font-size: 20px;
  font-weight: bold;
}

.tab-scroll-btn:hover {
  background: linear-gradient(to right, rgba(249, 250, 251, 0.95), #f9fafb);
  color: #374151;
  box-shadow: -3px 0 12px rgba(0, 0, 0, 0.15);
  transform: scale(1.1);
}

.tab-scroll-btn:active {
  background: linear-gradient(to right, rgba(243, 244, 246, 0.95), #f3f4f6);
  transform: scale(1.05);
}

.tab-scroll-left {
  border-right: 1px solid transparent;
  background: linear-gradient(to left, rgba(255, 255, 255, 0.95), white);
  box-shadow: 2px 0 8px rgba(0, 0, 0, 0.1);
}

.tab-scroll-left:hover {
  background: linear-gradient(to left, rgba(249, 250, 251, 0.95), #f9fafb);
  box-shadow: 3px 0 12px rgba(0, 0, 0, 0.15);
}

.tab-scroll-right {
  border-left: 1px solid transparent;
  animation: pulse-hint 2s ease-in-out infinite;
}

@keyframes pulse-hint {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.7;
  }
}

.tab-btn {
  flex: 1;
  max-width: 150px;
  min-height: 72px;
  padding: 12px 12px;
  background: none;
  border: none;
  color: #6b7280;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  position: relative;
  transition: color 0.2s;
  white-space: normal;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1.3;
  word-wrap: break-word;
}

@media (max-width: 600px) {
  .tab-btn {
    max-width: 110px;
    flex: 0 0 auto;
    padding: 12px 20px;
    min-height: 60px;
  }
}

.tab-btn:hover {
  color: #374151;
}

.tab-btn.active {
  color: #111827;
}

.tab-btn.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: #10b981;
}

/* Dashboard Content */
.dashboard-content {
  padding: 24px;
  max-width: 600px;
  margin: 0 auto;
}

@media (max-width: 600px) {
  .dashboard-content {
    padding: 24px 15px;
  }
}

/* Month Selector */
.month-selector {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-bottom: 16px;
}

.month-nav-btn {
  background: white;
  border: 1px solid #e5e7eb;
  padding: 10px;
  border-radius: 50%;
  color: #6b7280;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  width: 40px;
  height: 40px;
}

.month-nav-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.month-nav-btn:disabled:hover {
  background: white;
  border-color: #e5e7eb;
  color: #6b7280;
}

.month-nav-btn:hover {
  background: #f3f4f6;
  border-color: #d1d5db;
  color: #374151;
}

.month-display {
  background: white;
  border: 1px solid #e5e7eb;
  padding: 10px 24px;
  border-radius: 20px;
  font-size: 15px;
  font-weight: 500;
  color: #111827;
  min-width: 180px;
  text-align: center;
}

/* Total Display */
.total-display {
  text-align: center;
  margin-bottom: 40px;
}

.total-label {
  font-size: 16px;
  color: #6b7280;
  margin-bottom: 8px;
}

.total-amount {
  font-size: 36px;
  font-weight: 700;
  color: #111827;
}

/* Category Cards */
#categories-container {
  position: relative;
}

.categories-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 80px;
}

.category-card {
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  overflow: visible;
  transition: transform 0.2s, box-shadow 0.2s;
}

.category-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.category-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  cursor: pointer;
}

.category-icon {
  font-size: 28px;
  width: 48px;
  height: 48px;
  background: #f3f4f6;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

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

.category-name {
  font-size: 16px;
  font-weight: 600;
  color: #111827;
  margin-bottom: 4px;
}

.category-amount {
  font-size: 15px;
  color: #6b7280;
}

.category-percentage {
  background: #f3f4f6;
  padding: 6px 14px;
  border-radius: 16px;
  font-size: 14px;
  font-weight: 600;
  color: #374151;
}

/* Category Details */
.category-details {
  border-top: 1px solid #e5e7eb;
  padding: 0 20px 16px 20px;
}

.category-details.hidden {
  display: none;
}

/* Sub-category card (for grouped categories) */
.category-sub-card {
  margin: 12px 0;
  padding: 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: background-color 0.2s;
}

.category-sub-card:hover {
  background: #f9fafb;
}

.category-sub-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.category-sub-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.category-sub-name {
  font-size: 14px;
  font-weight: 500;
  color: #374151;
}

.category-sub-amount {
  font-size: 14px;
  color: #6b7280;
}

.category-sub-percentage {
  font-size: 13px;
  font-weight: 600;
  color: #6b7280;
}

.category-sub-details {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #e5e7eb;
}

.category-sub-details.hidden {
  display: none;
}

.income-detail-entry,
.movement-detail-entry {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid #f3f4f6;
  position: relative;
}

.income-detail-entry:has(.three-dots-menu[style*="display: block"]),
.movement-detail-entry:has(.three-dots-menu[style*="display: block"]) {
  z-index: 100;
}

.income-detail-entry:last-child,
.movement-detail-entry:last-child {
  border-bottom: none;
}

.entry-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.entry-description-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.entry-description {
  font-size: 14px;
  color: #111827;
  font-weight: 500;
}

.entry-date {
  font-size: 12px;
  color: #9ca3af;
  margin-top: 2px;
}

.entry-member-badge,
.entry-payment-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 12px;
  background-color: #f3f4f6;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Optional: Different color for payment badges if desired */
.entry-payment-badge {
  background-color: #e0f2fe;
  color: #0369a1;
  text-transform: none;
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
  max-width: 100px;
  line-height: 1.2;
  text-align: center;
}

/* Badge for SPLIT movements */
.entry-split-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 12px;
  background-color: #dcfce7;
  color: #15803d;
  text-transform: none;
  letter-spacing: 0.5px;
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
  max-width: 100px;
  line-height: 1.2;
  text-align: center;
}

/* Badge for auto-generated movements */
.entry-autogenerated-badge {
  display: inline-block;
  font-size: 16px;
  padding: 2px 6px;
  border-radius: 12px;
  background-color: #fef3c7;
  color: #92400e;
  text-align: center;
  cursor: help;
  margin-right: 4px;
}

/* Status badges for templates (used/pending) */
.entry-status-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 12px;
  text-transform: none;
  letter-spacing: 0.5px;
  white-space: nowrap;
  line-height: 1.2;
  text-align: center;
}

.entry-status-done {
  background-color: #dcfce7;
  color: #15803d;
}

.entry-status-pending {
  background-color: #f3f4f6;
  color: #6b7280;
}

.entry-amount {
  font-size: 15px;
  font-weight: 600;
  color: #111827;
}

.entry-actions {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Floating Add Button */
/* Floating actions container */
.floating-actions {
  position: fixed;
  bottom: 40px;
  right: 32px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 16px;
  z-index: 100;
}

.btn-add-floating {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #10b981;
  color: white;
  border: none;
  font-size: 24px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
  transition: transform 0.2s, box-shadow 0.2s;
}

.btn-add-floating:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 16px rgba(16, 185, 129, 0.4);
}

.btn-filter-floating {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #6366f1;
  color: white;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
  transition: transform 0.2s, box-shadow 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-filter-floating:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 16px rgba(99, 102, 241, 0.4);
}

.btn-group-toggle {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #f59e0b;
  color: white;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
  transition: transform 0.2s, box-shadow 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-group-toggle:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 16px rgba(245, 158, 11, 0.4);
}

/* Filter dropdown */
.filter-dropdown {
  position: fixed;
  bottom: 80px;
  right: 20px;
  background: white;
  border-radius: 16px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  width: 320px;
  max-height: calc(100vh - 160px);
  overflow-y: auto;
  z-index: 1000;
  display: none;
}

.filter-dropdown.show {
  display: block;
}

/* Filter loading overlay */
.filter-loading-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.95);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: 16px;
  z-index: 10;
}

.filter-loading-overlay .spinner {
  width: 32px;
  height: 32px;
  border-width: 3px;
}

.filter-loading-overlay p {
  margin-top: 12px;
  color: #6b7280;
  font-size: 13px;
  font-weight: 500;
}

.filter-section {
  padding: 20px;
  border-bottom: 1px solid #f3f4f6;
}

.filter-section:last-child {
  border-bottom: none;
}

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

.filter-section-title {
  font-weight: 600;
  font-size: 13px;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.filter-section-actions {
  display: flex;
  gap: 8px;
}

.filter-link-btn {
  background: none;
  border: none;
  color: #8b5cf6;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: all 0.2s;
  text-decoration: underline;
}

.filter-link-btn:hover {
  background: #f3e8ff;
  color: #7c3aed;
}

.filter-options {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.filter-sub-options {
  margin-left: 20px;
  margin-top: 4px;
  padding-left: 12px;
  border-left: 2px solid #f3f4f6;
  max-height: 500px;
  overflow: hidden;
  transition: max-height 0.3s ease, opacity 0.3s ease;
  opacity: 1;
}

.filter-sub-options.collapsed {
  max-height: 0;
  opacity: 0;
  margin-top: 0;
}

.filter-category {
  margin-bottom: 12px;
}

.filter-category:last-child {
  margin-bottom: 0;
}

.filter-checkbox-label {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 14px;
  color: #374151;
  padding: 8px 12px;
  border-radius: 8px;
  transition: background 0.15s;
  user-select: none;
}

.filter-checkbox-label:hover {
  background: #f9fafb;
}

.filter-category-label {
  font-weight: 600;
  margin-bottom: 4px;
  color: #111827;
  position: relative;
}

.filter-category-label:hover {
  background: #f9fafb;
}

.category-toggle-icon {
  margin-left: auto;
  color: #6b7280;
  transition: transform 0.3s ease;
}

.category-toggle-icon.rotated {
  transform: rotate(180deg);
}

.filter-checkbox {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: #8b5cf6;
  border-radius: 4px;
}

.filter-footer {
  display: flex;
  gap: 8px;
  padding: 16px 20px;
  background: #fafbfc;
  border-radius: 0 0 16px 16px;
}

.filter-footer .btn-small {
  flex: 1;
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 500;
  border-radius: 8px;
}

@media (max-width: 600px) {
  .filter-dropdown {
    width: calc(100vw - 40px);
    max-width: 360px;
    right: 20px;
    left: 20px;
    margin: 0 auto;
    bottom: 80px;
  }
  
  /* More compact filter sections */
  .filter-section {
    padding: 12px 16px;
  }
  
  .filter-section-header {
    margin-bottom: 10px;
  }
  
  .filter-section-title {
    font-size: 11px;
    letter-spacing: 0.3px;
  }
  
  .filter-section-actions {
    gap: 6px;
  }
  
  .filter-link-btn {
    font-size: 11px;
    padding: 2px 6px;
  }
  
  /* Compact checkboxes */
  .filter-checkbox-label {
    gap: 8px;
    font-size: 13px;
    padding: 6px 8px;
  }
  
  .filter-checkbox {
    width: 16px;
    height: 16px;
  }
  
  /* Compact sub-options */
  .filter-sub-options {
    margin-left: 16px;
    padding-left: 10px;
    margin-top: 2px;
  }
  
  .filter-category {
    margin-bottom: 8px;
  }
  
  .filter-options {
    gap: 2px;
  }
  
  /* Compact footer */
  .filter-footer {
    padding: 12px 16px;
  }
  
  .filter-footer .btn-small {
    padding: 8px 12px;
    font-size: 12px;
  }
  
  .floating-actions {
    right: 24px;
    bottom: 32px;
  }
  
  .btn-filter-floating,
  .btn-add-floating,
  .btn-group-toggle {
    width: 56px;
    height: 56px;
  }
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 60px 20px;
}

.empty-icon {
  font-size: 64px;
  margin-bottom: 16px;
}

.empty-state p {
  font-size: 16px;
  color: #6b7280;
  margin-bottom: 24px;
}

.btn-primary {
  background: #10b981;
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-primary:hover {
  background: #059669;
}

/* Add budget button */
.btn-add-budget {
  background: #10b981;
  color: white;
  border: none;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.btn-add-budget:hover {
  background: #059669;
  transform: translateY(-1px);
}

.btn-add-budget:active {
  transform: translateY(0);
}

/* Coming Soon */
.coming-soon {
  text-align: center;
  padding: 80px 20px;
}

.coming-soon-icon {
  font-size: 80px;
  margin-bottom: 20px;
  opacity: 0.3;
}

.coming-soon p {
  font-size: 18px;
  color: #6b7280;
}

/* Loading State */
.loading-state {
  text-align: center;
  padding: 80px 20px;
}

.loading-state .loading-spinner {
  position: relative;
  width: 40px;
  height: 40px;
  margin: 0 auto 20px;
  border: 4px solid #e5e7eb;
  border-top-color: #10b981;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  background: transparent;
  z-index: auto;
}

.loading-state p {
  font-size: 16px;
  color: #6b7280;
}


/* Tipo selector - circular buttons */
.tipo-selector {
  display: flex;
  justify-content: center;
  gap: 24px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.tipo-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  background: transparent;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
  padding: 0;
}

.tipo-btn:hover .tipo-icon {
  transform: scale(1.05);
}

.tipo-btn.active .tipo-icon {
  background: #dbeafe;
  border-color: #3b82f6;
}

.tipo-icon {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: #f3f4f6;
  border: 2px solid #e5e7eb;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
  transition: all 0.2s;
}

.split-icon {
  color: #374151;
  font-weight: 700;
}

.tipo-label {
  font-size: 13px;
  text-align: center;
  color: #6b7280;
  line-height: 1.3;
  font-weight: 500;
  max-width: 80px;
}

.tipo-btn.active .tipo-label {
  color: #2563eb;
  font-weight: 600;
}

/* Mobile: 2 columns */
@media (max-width: 600px) {
  .tipo-selector {
    gap: 16px;
  }
  
  .tipo-icon {
    width: 64px;
    height: 64px;
    font-size: 32px;
  }
  
  .tipo-label {
    font-size: 12px;
  }
}

/* ================================
   Modern Expense Group Cards (Gastos)
   ================================ */

.expense-group-card {
  background: #ffffff;
  border-radius: 16px;
  padding: 20px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  transition: all 0.2s ease;
  cursor: pointer;
}

.expense-group-card:hover {
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.expense-group-header {
  display: flex;
  align-items: center;
  gap: 16px;
}

.expense-group-icon-container {
  width: 56px;
  height: 56px;
  background: #f3f4f6;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.expense-group-icon {
  font-size: 28px;
}

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

.expense-group-name {
  font-size: 17px;
  font-weight: 600;
  color: #111827;
  margin-bottom: 4px;
}

.expense-group-amount {
  font-size: 15px;
  color: #6b7280;
  font-weight: 500;
}

.expense-group-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.expense-group-percentage {
  background: #f3f4f6;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 600;
  color: #374151;
}

.expense-group-chevron {
  color: #9ca3af;
  transition: transform 0.2s ease;
}

.expense-group-chevron.rotated {
  transform: rotate(90deg);
}

/* Budget Indicator */
.budget-indicator {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  margin-right: 12px;
  min-width: 140px;
}

.budget-text {
  font-size: 12px;
  font-weight: 600;
  color: #6b7280;
  white-space: nowrap;
}

.budget-bar {
  width: 100%;
  height: 6px;
  background-color: #e5e7eb;
  border-radius: 3px;
  overflow: hidden;
}

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

.budget-percentage {
  font-size: 13px;
  font-weight: 700;
}

.expense-group-details {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid #e5e7eb;
}

.expense-group-details.hidden {
  display: none;
}

/* Loan Cards - Modern design with avatars */
.loan-card .expense-group-header {
  gap: 20px;
}

.loan-header-split {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.loan-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 700;
  color: white;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
  flex-shrink: 0;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.loan-center-info {
  flex: 1;
  text-align: center;
  min-width: 0;
}

.loan-card .expense-group-name {
  font-size: 17px;
  font-weight: 600;
  color: #111827;
  margin-bottom: 4px;
}

.loan-card .expense-group-amount {
  font-size: 15px;
  font-weight: 500;
  color: #6b7280;
}

/* Settled loans */
.loan-settled {
  opacity: 0.85;
}

.loan-settled .expense-group-name {
  color: #6b7280;
}

.settled-amount {
  color: #10b981 !important;
  font-size: 15px !important;
  font-weight: 500 !important;
}

/* Loans Summary */
.loans-summary {
  display: flex;
  gap: 32px;
  margin-bottom: 40px;
  margin-top: 32px;
  padding: 0;
  background: transparent;
  border: none;
}

.summary-item {
  flex: 1;
  text-align: center;
  padding: 0;
  background: transparent;
  border: none;
}

.summary-label {
  font-size: 14px;
  color: #6b7280;
  margin-bottom: 8px;
  font-weight: 500;
}

.summary-amount {
  font-size: 32px;
  font-weight: 700;
  color: #111827;
}

.summary-divider {
  display: none;
}

/* Credit Cards Tab Styles */
.credit-card-card {
  background: white;
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  border: 1px solid #e5e7eb;
  cursor: pointer;
  transition: all 0.2s ease;
}

.credit-card-card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.credit-card-card.card-paid {
  background: #f0fdf4;
  border-color: #86efac;
}

.card-period-badge {
  font-size: 12px;
  font-weight: 500;
  color: #6b7280;
  background: #f3f4f6;
  padding: 4px 10px;
  border-radius: 12px;
  white-space: nowrap;
  margin-right: 8px;
}

.expense-group-amount-sub {
  font-size: 14px;
  font-weight: 600;
  color: #374151;
  margin-top: 2px;
}

.expense-group-amount-sub.paid-amount {
  color: #059669;
}

.debt-amount {
  color: #374151 !important;
}

.paid-amount {
  color: #059669 !important;
}

.payment-amount {
  color: #059669 !important;
}

.available-positive {
  color: #374151 !important;
}

.available-negative {
  color: #374151 !important;
}

.card-section {
  background: white;
  margin-bottom: 12px;
  border-radius: 8px;
  padding: 8px 12px;
}

.card-section .expense-category-header {
  cursor: pointer;
}

.card-net-summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px;
  background: #f9fafb;
  border-radius: 8px;
  margin-top: 12px;
}

.net-label {
  font-weight: 500;
  color: #374151;
}

.net-amount {
  font-size: 18px;
  font-weight: 700;
}

.net-amount.paid {
  color: #059669;
}

.net-amount.debt {
  color: #374151;
}

.card-loading {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 24px;
  justify-content: center;
  color: #6b7280;
}

.loading-spinner-small {
  width: 20px;
  height: 20px;
  border: 2px solid #e5e7eb;
  border-top-color: #111827;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.entry-category-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 12px;
  background-color: #f3f4f6;
  color: #4b5563;
}

.entry-account-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 12px;
  background-color: #dcfce7;
  color: #15803d;
}

.payment-entry {
  background: #f0fdf4;
  border-radius: 8px;
  margin: 4px 0;
  padding: 8px 12px;
}

.expense-category-count {
  font-size: 12px;
  color: #9ca3af;
  margin-left: auto;
  margin-right: 8px;
}

/* Expense Category Items (sub-categories within groups) */
.expense-category-item {
  padding: 14px 0;
  border-bottom: 1px solid #f3f4f6;
  transition: all 0.2s ease;
}

/* Budget category item - remove old styles, use expense-category-item behavior */

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

/* Add gray background container when category is expanded - wraps header + movements */
.expense-category-item:has(.expense-category-details:not(.hidden)) {
  background: #f3f4f6;
  padding: 16px;
  margin: 8px 0;
  border-radius: 12px;
  border-bottom: none;
}

.expense-category-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

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

.expense-category-name {
  font-size: 15px;
  font-weight: 500;
  color: #374151;
}

.expense-category-amount {
  font-size: 14px;
  color: #9ca3af;
}

.expense-category-percentage {
  font-size: 13px;
  font-weight: 600;
  color: #9ca3af;
  flex-shrink: 0;
}

.category-chevron {
  color: #9ca3af;
  flex-shrink: 0;
  transition: transform 0.2s ease;
}

.category-chevron.rotated {
  transform: rotate(90deg);
}

.expense-category-details {
  margin-top: 12px;
}

.expense-category-details.hidden {
  display: none;
}

/* Chronological view styles */
.chronological-movements-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-bottom: 100px;
}

.chronological-movement-card {
  background: #ffffff;
  border-radius: 16px;
  padding: 20px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: space-between;
  overflow: visible;
  position: relative;
}

.chronological-movement-card:has(.three-dots-menu[style*="display: block"]) {
  z-index: 100;
}

.chronological-movement-card:hover {
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.movement-main-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex: 1;
  gap: 16px;
  min-width: 0;
}

.movement-left {
  flex: 1;
  min-width: 0;
  max-width: calc(100% - 150px);
}

.movement-description {
  font-size: 16px;
  font-weight: 600;
  color: #111827;
  margin-bottom: 2px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  word-break: break-word;
  position: relative;
  cursor: help;
  max-width: 100%;
}

.movement-category-name {
  font-size: 14px;
  font-weight: 500;
  color: #6b7280;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: help;
  max-width: 100%;
}

.movement-amount {
  font-size: 18px;
  font-weight: 700;
  color: #111827;
  margin-bottom: 2px;
}

.movement-date {
  font-size: 12px;
  color: #9ca3af;
}

.movement-right-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  position: relative;
  flex-shrink: 0;
  max-width: 150px;
}

/* Tooltips for truncated text */
.movement-description[title]:hover::after,
.movement-category-name[title]:hover::after {
  content: attr(title);
  position: absolute;
  left: 0;
  top: 100%;
  margin-top: 4px;
  background: rgba(17, 24, 39, 0.95);
  color: white;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  white-space: normal;
  word-break: break-word;
  max-width: 300px;
  z-index: 1000;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  pointer-events: none;
}

.movement-description[title] {
  position: relative;
}

.movement-category-name[title] {
  position: relative;
}

/* Movement detail entries within categories */
.expense-category-details .movement-detail-entry {
  padding: 14px 12px;
  background: white; /* White background for each movement */
  border-radius: 8px;
  margin-bottom: 8px;
}

.expense-category-details .movement-detail-entry:last-child {
  margin-bottom: 0;
}

/* Responsive adjustments */
@media (max-width: 600px) {
  .expense-group-card {
    padding: 16px;
    border-radius: 12px;
  }
  
  .expense-group-icon-container {
    width: 48px;
    height: 48px;
  }
  
  .expense-group-icon {
    font-size: 24px;
  }
  
  .expense-group-name {
    font-size: 16px;
  }
  
  .expense-group-amount {
    font-size: 14px;
  }
  
  /* Budget indicator mobile */
  .budget-indicator {
    min-width: 100px;
    margin-right: 8px;
  }
  
  .budget-text {
    font-size: 10px;
  }
  
  .budget-bar {
    height: 5px;
  }
  
  .budget-percentage {
    font-size: 11px;
  }
  
  /* Loan cards mobile */
  .loan-card .expense-group-name {
    font-size: 16px;
  }
  
  .loan-card .expense-group-amount {
    font-size: 14px;
  }
  
  .loan-avatar {
    width: 48px;
    height: 48px;
    font-size: 16px;
  }
  
  /* Chronological view mobile */
  .chronological-movement-card {
    padding: 16px;
    border-radius: 12px;
  }
  
  .chronological-movement-card .movement-left {
    max-width: calc(100% - 120px);
  }
  
  .movement-description {
    font-size: 15px;
  }
  
  .movement-category-name {
    font-size: 13px;
  }
  
  .movement-amount {
    font-size: 16px;
  }
  
  /* Allow badges to wrap on mobile */
  .entry-payment-badge,
  .entry-split-badge {
    white-space: normal;
    max-width: 90px;
    line-height: 1.2;
    text-align: center;
  }
  
  /* Disable hover tooltips on mobile (use native title tooltip instead) */
  .movement-description[title]:hover::after,
  .movement-category-name[title]:hover::after {
    display: none;
  }
  
  /* Loans summary mobile */
  .loans-summary {
    gap: 24px;
    margin-bottom: 40px;
    margin-top: 25px;
  }
  
  .summary-amount {
    font-size: 28px;
  }
  
  .summary-label {
    font-size: 13px;
  }
  
  .expense-group-percentage {
    font-size: 13px;
    padding: 5px 12px;
  }
}

/* Loan direction toggle (Hacer/Pagar préstamo) */
.loan-direction-selector {
  display: flex;
  gap: 12px;
  margin-top: 8px;
}

.loan-direction-btn {
  flex: 1;
  padding: 12px 16px;
  background: #f3f4f6;
  border: 2px solid #e5e7eb;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  color: #6b7280;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
}

.loan-direction-btn:hover {
  background: #e5e7eb;
}

.loan-direction-btn.active {
  background: #dbeafe;
  border-color: #3b82f6;
  color: #1e40af;
}


/* Budget-specific styles */
.budget-group-section {
  margin-bottom: 24px;
}

.group-header-budget {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: #f9fafb;
  border-radius: 8px;
  margin-bottom: 12px;
}

.group-header-budget .group-name {
  font-weight: 600;
  color: #374151;
}

.group-header-budget .group-summary {
  font-size: 14px;
  color: #6b7280;
}

.group-header-budget .group-percentage {
  margin-left: 8px;
  font-weight: 500;
}

.group-budgets {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.total-sublabel {
  text-align: center;
  margin-top: 8px;
  font-size: 14px;
  color: #6b7280;
}

.empty-hint {
  margin-top: 8px;
  font-size: 14px;
  color: #9ca3af;
}

.btn-add-budget-inline,
.btn-edit-budget-inline {
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  transition: background-color 0.2s;
  margin-left: 8px;
}

.btn-add-budget-inline:hover {
  background-color: #f3f4f6;
}

.btn-edit-budget-inline:hover {
  background-color: #f3f4f6;
}

.no-budget-text {
  color: #9ca3af;
  font-style: italic;
  font-size: 14px;
}

/* Remove spinner arrows from budget input */
.budget-inline-input::-webkit-inner-spin-button,
.budget-inline-input::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.budget-inline-input[type="number"] {
  -moz-appearance: textfield;
  appearance: textfield;
}

/* Remove spinner arrows from modal number inputs */
#modal-input[type="number"]::-webkit-inner-spin-button,
#modal-input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

#modal-input[type="number"] {
  -moz-appearance: textfield;
  appearance: textfield;
}

/* ===== Template Entry Styles ===== */
.template-icon {
  font-size: 16px;
}

/* Chevron rotation for budget categories */
.category-chevron {
  transition: transform 0.2s ease;
}

/* Budget action buttons container */
.budget-action-buttons {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 16px 0 0 0;
  border-top: 1px solid #e5e7eb;
  margin-top: 16px;
}

.budget-action-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px 16px;
  background: white;
  border: 2px solid #e5e7eb;
  border-radius: 12px;
  color: #374151;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  width: 100%;
}

.budget-action-btn:hover {
  background: #f9fafb;
  border-color: #2563eb;
  color: #2563eb;
}

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

/* Remove spinners from all number inputs */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

input[type="number"] {
  -moz-appearance: textfield;
  appearance: textfield;
}

/* Budget Cards (unified style for both sections) */
.budget-templates-card,
.budget-summary-card {
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 12px;
}

.budget-card-title {
  font-size: 12px;
  font-weight: 700;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 12px;
}

/* Budget Templates List */
.budget-templates-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}

/* Override template item styles inside card */
.budget-templates-card .movement-detail-entry {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
}

.empty-templates-message {
  text-align: center;
  color: #94a3b8;
  padding: 16px;
  font-size: 13px;
  font-style: italic;
  background: #f8fafc;
  border-radius: 8px;
  border: 1px dashed #cbd5e1;
}

.budget-add-template-btn,
.budget-edit-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px 16px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  color: #475569;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  width: 100%;
}

.budget-add-template-btn:hover,
.budget-edit-btn:hover {
  background: #eff6ff;
  border-color: #2563eb;
  color: #2563eb;
}

/* Budget Summary Card */
.budget-summary-card {
  margin-bottom: 0;
}

.budget-summary-rows {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 14px;
}

.budget-summary-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
}

.budget-summary-label {
  color: #64748b;
}

.budget-summary-value {
  font-weight: 500;
  color: #334155;
}

.budget-summary-row.budget-summary-total {
  padding-top: 10px;
  margin-top: 4px;
  border-top: 1px solid #e2e8f0;
}

.budget-summary-row.budget-summary-total .budget-summary-label {
  font-weight: 600;
  color: #334155;
}

.budget-summary-row.budget-summary-total .budget-summary-value {
  font-weight: 700;
  color: #1e293b;
  font-size: 15px;
}

/* ====================================
   NO HOUSEHOLD WELCOME STATE
   ==================================== */
.no-household-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 60px 24px;
  min-height: 60vh;
}

.no-household-icon {
  font-size: 64px;
  margin-bottom: 24px;
  animation: gentle-bounce 2s ease-in-out infinite;
}

@keyframes gentle-bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

.no-household-title {
  font-size: 28px;
  font-weight: 700;
  color: #1e293b;
  margin: 0 0 16px 0;
}

.no-household-text {
  font-size: 16px;
  color: #475569;
  line-height: 1.6;
  margin: 0 0 8px 0;
}

.no-household-text.secondary {
  color: #64748b;
  font-size: 15px;
  font-style: italic;
  margin-bottom: 32px;
}

.no-household-btn {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  color: white;
  font-size: 18px;
  font-weight: 600;
  padding: 16px 48px;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.3);
}

.no-household-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(37, 99, 235, 0.4);
}

.no-household-btn:active {
  transform: translateY(0);
}

.no-household-hint {
  font-size: 14px;
  color: #94a3b8;
  margin-top: 24px;
}

/* ====================================
   HOUSEHOLD CREATE PAGE
   ==================================== */
#household-form.grid {
  display: flex;
  flex-direction: column;
  max-width: 400px;
}

#household-form .form-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 24px;
}

#household-form .form-actions button {
  width: 100%;
  flex: none;
  padding: 14px 24px;
  font-size: 16px;
}
