:root {
  --green-900: #0a3d2e;
  --green-800: #0a5c47;
  --green-700: #0f7a5e;
  --green-600: #1a9972;
  --green-400: #3ec99a;
  --green-100: #e0f5ed;
  --green-50:  #f0faf5;

  --amber-600: #e6a800;
  --amber-100: #fef3c7;
  --red-600:   #dc2626;
  --red-100:   #fee2e2;

  --gray-900: #111827;
  --gray-700: #374151;
  --gray-600: #4b5563;
  --gray-500: #6b7280;
  --gray-400: #9ca3af;
  --gray-300: #d1d5db;
  --gray-100: #f3f4f6;
  --gray-50:  #f9fafb;
  --white:    #ffffff;

  --font-body: 'DM Sans', sans-serif;
  --font-display: 'DM Serif Display', serif;

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

  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);

  --nav-height: 72px;
  --topbar-height: 56px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-body);
  background: var(--gray-100);
  color: var(--gray-900);
  min-height: 100dvh;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}
button { font-family: inherit; cursor: pointer; border: none; background: none; }
input, textarea { font-family: inherit; }
img { max-width: 100%; display: block; }
.hidden { display: none !important; }

.splash {
  position: fixed; inset: 0; z-index: 999;
  background: #f0ead5;
  display: flex; align-items: center; justify-content: center;
  transition: opacity 0.5s ease, transform 0.5s ease;
}
.splash.fade-out { opacity: 0; transform: scale(1.05); pointer-events: none; }
.splash-inner { text-align: center; }
.splash-tagline { font-size: 14px; color: rgba(10,92,71,0.7); letter-spacing: 0.02em; }

.app { position: fixed; inset: 0; display: flex; flex-direction: column; background: var(--gray-50); }

.topbar {
  height: calc(var(--topbar-height) + var(--safe-top));
  padding-top: var(--safe-top);
  background: var(--green-800);
  display: flex; align-items: center; justify-content: space-between;
  padding-left: 16px; padding-right: 16px;
  flex-shrink: 0;
  position: relative; z-index: 10;
}
.topbar-left { display: flex; align-items: center; gap: 8px; }
.topbar-title { font-family: var(--font-display); font-size: 22px; color: #fff; letter-spacing: -0.3px; }
.topbar-right { display: flex; align-items: center; gap: 4px; }
.icon-btn {
  width: 38px; height: 38px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: rgba(255,255,255,0.85);
  transition: background 0.15s;
  position: relative;
}
.icon-btn:active { background: rgba(255,255,255,0.12); }
.notif-dot {
  position: absolute; top: 7px; right: 7px;
  width: 8px; height: 8px; border-radius: 50%;
  background: #ef4444; border: 2px solid var(--green-800);
}

.main-content { flex: 1; overflow: hidden; position: relative; }
.screen {
  position: absolute; inset: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: calc(var(--nav-height) + var(--safe-bottom) + 12px);
  opacity: 0; transform: translateX(20px);
  transition: opacity 0.22s ease, transform 0.22s ease;
  pointer-events: none;
}
.screen.active { opacity: 1; transform: translateX(0); pointer-events: auto; }

.home-hero {
  background: linear-gradient(160deg, var(--green-800) 0%, var(--green-700) 100%);
  padding: 20px 20px 28px; color: #fff;
}
.hero-greeting { font-family: var(--font-display); font-size: 22px; line-height: 1.25; margin-bottom: 20px; opacity: 0.95; }
.hero-stats {
  display: flex; background: rgba(255,255,255,0.1);
  border-radius: var(--radius-lg); border: 1px solid rgba(255,255,255,0.15);
  overflow: hidden;
}
.hero-stat { flex: 1; padding: 14px 8px; text-align: center; cursor: pointer; transition: background 0.15s; }
.hero-stat:active { background: rgba(255,255,255,0.08); }
.hero-stat-num { display: block; font-size: 28px; font-weight: 600; line-height: 1; margin-bottom: 4px; }
.hero-stat-num.warn { color: #fbbf24; }
.hero-stat-label { font-size: 11px; opacity: 0.75; text-transform: uppercase; letter-spacing: 0.06em; }
.hero-stat-divider { width: 1px; background: rgba(255,255,255,0.15); margin: 12px 0; }

.reputation-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 14px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: var(--radius-md);
  padding: 12px 14px;
}
.reputation-left {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
}
.reputation-label {
  font-size: 10px;
  font-weight: 600;
  color: rgba(255,255,255,0.7);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  white-space: nowrap;
}
.reputation-stars { display: flex; gap: 3px; }
.star {
  font-size: 20px;
  line-height: 1;
  transition: color 0.15s;
}
.star-empty { color: rgba(255,255,255,0.25); }
.star-filled { color: #fbbf24; }
.star-half { color: rgba(251,191,36,0.5); }

.reputation-right {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.reputation-soon {
  font-size: 10px;
  font-weight: 700;
  color: #fbbf24;
  background: rgba(251,191,36,0.15);
  border-radius: 999px;
  padding: 2px 8px;
  align-self: flex-start;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.reputation-hint {
  font-size: 11px;
  color: rgba(255,255,255,0.65);
  line-height: 1.4;
}


.section-header { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px 10px; }
.section-title { font-size: 13px; font-weight: 600; color: var(--gray-500); text-transform: uppercase; letter-spacing: 0.07em; }
.chip-btn {
  font-size: 12px; font-weight: 500; color: var(--green-700);
  background: var(--green-100); border-radius: 999px; padding: 4px 12px;
  transition: background 0.15s;
}
.chip-btn:active { background: var(--green-400); color: #fff; }

.filter-wrapper { position: relative; }
.filter-menu {
  position: absolute;
  right: 0; top: calc(100% + 6px);
  background: var(--white);
  border-radius: var(--radius-md);
  box-shadow: 0 4px 20px rgba(0,0,0,0.14);
  border: 1px solid var(--gray-100);
  overflow: hidden;
  z-index: 100;
  min-width: 140px;
}
.filter-menu button {
  display: block; width: 100%;
  text-align: left; padding: 11px 16px;
  font-size: 13px; font-weight: 500;
  color: var(--gray-900);
  background: transparent;
  border-bottom: 1px solid var(--gray-100);
  transition: background 0.12s;
}
.filter-menu button:last-child { border-bottom: none; }
.filter-menu button:active { background: var(--green-50); }

.loan-list { padding: 0 16px; display: flex; flex-direction: column; gap: 10px; }
.loan-card {
  background: var(--white); border-radius: var(--radius-md); box-shadow: var(--shadow-sm);
  display: flex; align-items: center; gap: 12px; padding: 14px;
  cursor: pointer; transition: transform 0.12s, box-shadow 0.12s;
  border-left: 4px solid transparent; position: relative; overflow: hidden;
}
.loan-card:active { transform: scale(0.985); box-shadow: none; }
.loan-card.status-ok   { border-left-color: var(--green-600); }
.loan-card.status-soon { border-left-color: var(--amber-600); }
.loan-card.status-late { border-left-color: var(--red-600); }

.loan-thumb {
  width: 52px; height: 52px; border-radius: var(--radius-sm);
  background: var(--gray-100); overflow: hidden; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; border: 1px solid var(--gray-100);
}
.loan-thumb img { width: 100%; height: 100%; object-fit: cover; }
.loan-info { flex: 1; min-width: 0; }
.loan-item-name { font-size: 15px; font-weight: 600; color: var(--gray-900); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 3px; }
.loan-meta { font-size: 12px; color: var(--gray-500); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.loan-badge { font-size: 11px; font-weight: 600; padding: 4px 10px; border-radius: 999px; flex-shrink: 0; }
.badge-ok   { background: var(--green-100); color: var(--green-800); }
.badge-soon { background: var(--amber-100); color: var(--amber-600); }
.badge-late { background: var(--red-100);   color: var(--red-600); }
.badge-done { background: var(--gray-100);  color: var(--gray-500); }

.empty-state { text-align: center; padding: 60px 30px; }
.empty-icon { font-size: 48px; margin-bottom: 12px; }
.empty-title { font-size: 17px; font-weight: 600; color: var(--gray-700); margin-bottom: 6px; }
.empty-sub { font-size: 13px; color: var(--gray-500); line-height: 1.5; }

.photo-preview {
  width: 100%; height: 220px;
  background: linear-gradient(160deg, var(--green-900) 0%, var(--green-700) 100%);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; position: relative; overflow: hidden;
}
.photo-placeholder { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; color: rgba(255,255,255,0.75); text-align: center; }
.photo-placeholder svg { opacity: 0.7; }
.photo-placeholder span { font-size: 15px; font-weight: 500; color: rgba(255,255,255,0.9); }
.photo-placeholder small { font-size: 12px; opacity: 0.6; }
#photo-img { width: 100%; height: 100%; object-fit: cover; position: absolute; inset: 0; }
.photo-change-btn {
  position: absolute; bottom: 12px; right: 12px;
  background: rgba(0,0,0,0.55); color: #fff; font-size: 12px; font-weight: 500;
  padding: 6px 14px; border-radius: 999px; backdrop-filter: blur(4px);
}

.form-body { padding: 20px 16px; }
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 12px; font-weight: 600; color: var(--gray-500); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 7px; }
.form-input {
  width: 100%; padding: 12px 14px; font-size: 15px;
  background: var(--white); border: 1.5px solid var(--gray-300); border-radius: var(--radius-sm);
  color: var(--gray-900); transition: border-color 0.15s, box-shadow 0.15s;
  outline: none; appearance: none; -webkit-appearance: none;
}
.form-input:focus { border-color: var(--green-600); box-shadow: 0 0 0 3px rgba(26,153,114,0.15); }
.form-textarea { resize: none; height: 80px; line-height: 1.5; }

.input-with-mic {
  position: relative;
  display: flex;
  align-items: center;
}
.input-with-mic .form-input {
  padding-right: 44px;
}
.mic-btn {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 32px; height: 32px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--gray-500);
  background: var(--gray-100);
  transition: background 0.15s, color 0.15s, transform 0.15s;
  flex-shrink: 0;
}
.mic-btn:active { transform: translateY(-50%) scale(0.92); }
.mic-btn.listening {
  color: #fff;
  background: var(--red-600);
  animation: micPulse 1.1s infinite;
}
.mic-btn-textarea {
  top: 18px;
  transform: none;
}
.mic-btn-textarea.listening { transform: none; }

.input-with-contact .form-input {
  padding-right: 80px;
}
.contact-btn {
  position: absolute;
  right: 42px;
  top: 50%;
  transform: translateY(-50%);
  width: 32px; height: 32px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--gray-500);
  background: var(--gray-100);
  transition: background 0.15s, color 0.15s, transform 0.15s;
  flex-shrink: 0;
}
.contact-btn:active { transform: translateY(-50%) scale(0.92); background: var(--green-100); color: var(--green-800); }

.contact-dropdown {
  margin-top: 6px;
  background: var(--white);
  border: 1.5px solid var(--gray-300);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
  max-height: 220px;
  overflow-y: auto;
}
.contact-dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  cursor: pointer;
  border-bottom: 1px solid var(--gray-100);
  transition: background 0.12s;
}
.contact-dropdown-item:last-child { border-bottom: none; }
.contact-dropdown-item:active { background: var(--green-100); }
.contact-avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--green-100);
  color: var(--green-800);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 600;
  flex-shrink: 0;
}
.contact-dropdown-text { flex: 1; min-width: 0; }
.contact-dropdown-name { font-size: 13px; font-weight: 600; color: var(--gray-900); }
.contact-dropdown-phone { font-size: 11px; color: var(--gray-500); }

@keyframes micPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(220,38,38,0.4); }
  50% { box-shadow: 0 0 0 6px rgba(220,38,38,0.15); }
}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.btn-primary {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--green-700); color: #fff; font-size: 15px; font-weight: 600;
  padding: 14px 20px; border-radius: var(--radius-md);
  transition: background 0.15s, transform 0.1s; border: none;
}
.btn-primary:active { background: var(--green-900); transform: scale(0.98); }
.btn-primary.full { width: 100%; }

.btn-outline {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  background: transparent; color: var(--gray-700); font-size: 15px; font-weight: 500;
  padding: 13px 20px; border-radius: var(--radius-md); border: 1.5px solid var(--gray-300);
  transition: background 0.15s;
}
.btn-outline:active { background: var(--gray-100); }

.btn-secondary {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--green-100); color: var(--green-800); font-size: 14px; font-weight: 600;
  padding: 12px 16px; border-radius: var(--radius-md); border: none;
  transition: background 0.15s; flex: 1;
}
.btn-secondary:active { background: var(--green-400); color: #fff; }

.push-banner {
  margin: -14px 16px 14px;
  background: var(--white);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  padding: 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--green-100);
}
.push-banner-icon { font-size: 24px; flex-shrink: 0; }
.push-banner-text { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.push-banner-text strong { font-size: 13px; color: var(--gray-900); }
.push-banner-text span { font-size: 11px; color: var(--gray-500); line-height: 1.3; }
.push-banner-btn {
  background: var(--green-700); color: #fff; font-size: 12px; font-weight: 600;
  padding: 8px 14px; border-radius: 999px; flex-shrink: 0; white-space: nowrap;
}
.push-banner-btn:active { background: var(--green-900); }

.debts-section {
  margin: 20px 16px 6px;
}
.debts-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.debts-soon-badge {
  font-size: 10px;
  font-weight: 700;
  color: var(--amber-600);
  background: var(--amber-100);
  border-radius: 999px;
  padding: 3px 9px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.debts-placeholder {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: var(--gray-50);
  border: 1.5px dashed var(--gray-300);
  border-radius: var(--radius-md);
  padding: 14px;
}
.debts-placeholder-icon {
  font-size: 24px;
  flex-shrink: 0;
  opacity: 0.6;
}
.debts-placeholder-text { display: flex; flex-direction: column; gap: 4px; }
.debts-placeholder-text strong { font-size: 13px; color: var(--gray-700); }
.debts-placeholder-text span { font-size: 12px; color: var(--gray-500); line-height: 1.5; }


.field-hint { font-size: 11px; color: var(--gray-500); margin-top: 6px; line-height: 1.4; }


.detail-photo {
  width: 100%; height: 220px;
  background: linear-gradient(160deg, var(--green-900) 0%, var(--green-700) 100%);
  position: relative; overflow: hidden;
  display: flex; align-items: center; justify-content: center; font-size: 64px;
}
.detail-photo img { width: 100%; height: 100%; object-fit: cover; position: absolute; inset: 0; }
.detail-status-bar { position: absolute; bottom: 0; left: 0; right: 0; padding: 10px 16px; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.detail-status-bar.ok   { background: rgba(26,153,114,0.7); }
.detail-status-bar.soon { background: rgba(217,119,6,0.75); }
.detail-status-bar.late { background: rgba(220,38,38,0.75); }
.detail-status-text { color: #fff; font-size: 13px; font-weight: 600; }

.detail-body { padding: 20px 16px; }
.detail-title { font-family: var(--font-display); font-size: 26px; color: var(--gray-900); margin-bottom: 4px; line-height: 1.2; }
.detail-sub { font-size: 14px; color: var(--gray-500); margin-bottom: 20px; }

.info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 20px; }
.info-block { background: var(--gray-50); border-radius: var(--radius-sm); padding: 12px 14px; border: 1px solid var(--gray-100); }
.info-block-label { font-size: 10px; font-weight: 600; color: var(--gray-500); text-transform: uppercase; letter-spacing: 0.07em; margin-bottom: 4px; }
.info-block-value { font-size: 13px; font-weight: 600; color: var(--gray-900); word-break: break-all; }
.info-block-value.late { color: var(--red-600); }
.info-block-value.soon { color: var(--amber-600); }

.detail-notes { background: var(--gray-50); border-radius: var(--radius-sm); padding: 14px; margin-bottom: 20px; border: 1px solid var(--gray-100); }
.detail-notes-label { font-size: 10px; font-weight: 600; color: var(--gray-500); text-transform: uppercase; letter-spacing: 0.07em; margin-bottom: 4px; }
.detail-notes-text { font-size: 13px; color: var(--gray-700); line-height: 1.5; }

.notif-history-title { font-size: 12px; font-weight: 600; color: var(--gray-500); text-transform: uppercase; letter-spacing: 0.07em; margin-bottom: 10px; }
.notif-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--gray-100); font-size: 13px; color: var(--gray-600); }
.notif-row:last-child { border-bottom: none; }
.notif-row-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.dot-green { background: var(--green-600); }
.dot-amber { background: var(--amber-600); }

.detail-actions { display: flex; gap: 10px; margin-bottom: 12px; }
.detail-actions-column { display: flex; flex-direction: column; gap: 10px; }

.notif-list { padding: 12px 16px; display: flex; flex-direction: column; gap: 10px; }
.notif-card { background: var(--white); border-radius: var(--radius-md); box-shadow: var(--shadow-sm); padding: 14px; display: flex; align-items: flex-start; gap: 12px; }
.notif-card-icon { width: 38px; height: 38px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 18px; flex-shrink: 0; }
.ni-red   { background: var(--red-100); }
.ni-amber { background: var(--amber-100); }
.ni-green { background: var(--green-100); }
.ni-gray  { background: var(--gray-100); }
.notif-card-body { flex: 1; }
.notif-card-text { font-size: 14px; color: var(--gray-900); line-height: 1.4; margin-bottom: 4px; }
.notif-card-sub  { font-size: 12px; color: var(--gray-500); }

.notif-delete-btn {
  width: 26px; height: 26px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--gray-400);
  background: transparent;
  flex-shrink: 0;
  transition: background 0.15s, color 0.15s;
}
.notif-delete-btn:active { background: var(--red-100); color: var(--red-600); }

.clear-all-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0 0 10px auto;
  font-size: 12px;
  font-weight: 600;
  color: var(--gray-500);
  background: var(--white);
  border: 1px solid var(--gray-300);
  border-radius: 999px;
  padding: 6px 12px;
}
.clear-all-btn:active { background: var(--gray-100); }

.history-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 16px 10px;
}
.sort-select {
  font-size: 12px;
  font-weight: 600;
  color: var(--green-800);
  background: var(--green-100);
  border: none;
  border-radius: 999px;
  padding: 6px 10px;
  appearance: none;
  -webkit-appearance: none;
}

.history-count-badge {
  font-size: 11px;
  font-weight: 700;
  background: var(--gray-200, #e5e7eb);
  color: var(--gray-600);
  border-radius: 999px;
  padding: 2px 9px;
  min-width: 22px;
  text-align: center;
}

.history-item-delete-btn {
  width: 28px; height: 28px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--gray-400);
  background: transparent;
  flex-shrink: 0;
  transition: background 0.15s, color 0.15s;
}
.history-item-delete-btn:active { background: var(--red-100); color: var(--red-600); }


.notif-empty { text-align: center; padding: 60px 30px; color: var(--gray-500); }
.notif-empty-icon { font-size: 40px; margin-bottom: 10px; }
.notif-empty-text { font-size: 14px; }

.bottom-nav {
  height: calc(var(--nav-height) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  background: var(--white); border-top: 1px solid var(--gray-100);
  display: flex; align-items: stretch; flex-shrink: 0;
  box-shadow: 0 -4px 20px rgba(0,0,0,0.06);
}
.nav-item { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; color: var(--gray-400); font-size: 11px; font-weight: 500; transition: color 0.15s; }
.nav-item.active { color: var(--green-700); }
.nav-item span { line-height: 1; }
.nav-fab {
  width: 52px; height: 52px; border-radius: 50%; background: var(--green-700);
  display: flex; align-items: center; justify-content: center; color: #fff;
  box-shadow: 0 4px 16px rgba(15,122,94,0.4); margin-top: -14px;
  transition: transform 0.15s, box-shadow 0.15s;
}
.nav-item:active .nav-fab { transform: scale(0.93); box-shadow: 0 2px 8px rgba(15,122,94,0.3); }

.toast {
  position: fixed; bottom: calc(var(--nav-height) + var(--safe-bottom) + 16px);
  left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--gray-900); color: #fff; font-size: 14px; font-weight: 500;
  padding: 12px 20px; border-radius: 999px; z-index: 500;
  opacity: 0; transition: opacity 0.25s, transform 0.25s; pointer-events: none;
  white-space: nowrap; max-width: 90vw; text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.modal-overlay {
  position: fixed; inset: 0; z-index: 900; background: rgba(0,0,0,0.5);
  display: flex; align-items: flex-end; justify-content: center; backdrop-filter: blur(2px);
}
.modal {
  background: var(--white); border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  padding: 28px 24px calc(28px + var(--safe-bottom)); width: 100%; max-width: 480px;
  animation: slideUp 0.25s ease;
}
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
.modal-icon { font-size: 36px; text-align: center; margin-bottom: 12px; }
.modal-title { font-family: var(--font-display); font-size: 22px; text-align: center; margin-bottom: 8px; color: var(--gray-900); }
.modal-body { font-size: 14px; color: var(--gray-500); text-align: center; margin-bottom: 24px; line-height: 1.5; }
.modal-actions { display: flex; gap: 10px; }
.modal-actions .btn-outline, .modal-actions .btn-primary { flex: 1; }

/* ── SETTINGS SCREEN ───────────────────────── */
.settings-hero {
  background: linear-gradient(160deg, var(--green-800) 0%, var(--green-700) 100%);
  padding: 24px 20px 20px;
  display: flex; align-items: center; gap: 14px;
}
.settings-hero-icon { font-size: 32px; }
.settings-hero-title {
  font-family: var(--font-display);
  font-size: 26px;
  color: #fff;
}
.settings-section { padding: 20px 16px 0; }
.settings-section-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin-bottom: 10px;
}
.settings-card {
  background: var(--white);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  padding: 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}
.settings-card-icon {
  width: 42px; height: 42px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.settings-card-body { flex: 1; min-width: 0; }
.settings-card-title { font-size: 14px; font-weight: 600; color: var(--gray-900); margin-bottom: 3px; }
.settings-card-desc { font-size: 11px; color: var(--gray-500); line-height: 1.4; }
.settings-card-btn {
  background: var(--green-700);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
  transition: background 0.15s;
}
.settings-card-btn:active { background: var(--green-900); }
.settings-info-block {
  background: var(--white);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  margin-bottom: 10px;
}
.settings-info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--gray-100);
  font-size: 13px;
  color: var(--gray-700);
}
.settings-info-row:last-child { border-bottom: none; }
.settings-info-row span:last-child { font-weight: 600; color: var(--gray-900); }

/* ── AI ASSISTANT ───────────────────────────── */
.btn-ai-assistant {
  width: 100%;
  display: flex; align-items: center; justify-content: flex-start; gap: 12px;
  background: linear-gradient(135deg, #7c3aed 0%, #4f46e5 100%);
  color: #fff;
  padding: 14px 18px;
  border-radius: var(--radius-md);
  border: none;
  margin-bottom: 4px;
  transition: opacity 0.15s, transform 0.1s;
  box-shadow: 0 4px 14px rgba(124,58,237,0.35);
  text-align: left;
}
.btn-ai-assistant:active { opacity: 0.88; transform: scale(0.98); }
.btn-ai-assistant svg { flex-shrink: 0; }
.btn-ai-assistant-text {
  display: flex; flex-direction: column; gap: 2px;
}
.btn-ai-assistant-title {
  font-size: 15px; font-weight: 700; line-height: 1.2;
}
.btn-ai-assistant-sub {
  font-size: 11px; font-weight: 400;
  opacity: 0.85; line-height: 1.3;
}


.ai-divider {
  display: flex; align-items: center; gap: 10px;
  margin: 10px 0;
  color: var(--gray-400);
  font-size: 12px;
}
.ai-divider::before, .ai-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--gray-200, #e5e7eb);
}

.ai-modal-overlay {
  position: fixed; inset: 0; z-index: 950;
  background: rgba(0,0,0,0.55);
  display: flex; align-items: flex-end; justify-content: center;
  backdrop-filter: blur(3px);
}
.ai-modal {
  background: var(--white);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  width: 100%; max-width: 480px;
  height: 72vh;
  display: flex; flex-direction: column;
  animation: slideUp 0.28s ease;
  overflow: hidden;
}
.ai-modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 18px 12px;
  border-bottom: 1px solid var(--gray-100);
  flex-shrink: 0;
}
.ai-modal-title {
  display: flex; align-items: center; gap: 8px;
  font-size: 16px; font-weight: 600; color: var(--gray-900);
}
.ai-modal-icon { font-size: 20px; }
.ai-modal-close {
  width: 30px; height: 30px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; color: var(--gray-500);
  background: var(--gray-100);
  transition: background 0.15s;
}
.ai-modal-close:active { background: var(--gray-200, #e5e7eb); }

.ai-chat-area {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex; flex-direction: column; gap: 10px;
  -webkit-overflow-scrolling: touch;
}
.ai-bubble {
  max-width: 88%;
  padding: 10px 14px;
  border-radius: 18px;
  font-size: 14px;
  line-height: 1.45;
}
.ai-bubble-bot {
  background: var(--gray-100);
  color: var(--gray-900);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}
.ai-bubble-user {
  background: linear-gradient(135deg, #7c3aed 0%, #4f46e5 100%);
  color: #fff;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}
.ai-bubble-typing {
  background: var(--gray-100);
  color: var(--gray-500);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
  font-style: italic;
}
.ai-bubble em { font-style: italic; opacity: 0.8; }

.ai-input-area {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 14px calc(12px + var(--safe-bottom));
  border-top: 1px solid var(--gray-100);
  background: var(--white);
  flex-shrink: 0;
}
.ai-mic-btn {
  width: 40px; height: 40px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--gray-500);
  background: var(--gray-100);
  flex-shrink: 0;
  transition: background 0.15s, color 0.15s;
}
.ai-mic-btn.listening {
  background: var(--red-600); color: #fff;
  animation: micPulse 1.1s infinite;
}
.ai-text-input {
  flex: 1;
  padding: 10px 12px;
  font-size: 14px;
  background: var(--gray-100);
  border: none;
  border-radius: 999px;
  color: var(--gray-900);
  outline: none;
}
.ai-send-btn {
  width: 38px; height: 38px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #7c3aed 0%, #4f46e5 100%);
  color: #fff;
  flex-shrink: 0;
  transition: opacity 0.15s;
}
.ai-send-btn:active { opacity: 0.8; }

.ai-apply-btn {
  width: 100%;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--green-700); color: #fff;
  font-size: 14px; font-weight: 600;
  padding: 12px; border-radius: var(--radius-md);
  border: none; margin-top: 6px;
  transition: background 0.15s;
}
.ai-apply-btn:active { background: var(--green-900); }

/* ── MÓDULO DE DINERO ───────────────────────── */
.money-thumb {
  background: linear-gradient(135deg, #e6a800, #8a6200);
  color: #fff;
  font-size: 22px;
}
.money-progress-bar {
  height: 4px;
  background: var(--gray-200, #e5e7eb);
  border-radius: 999px;
  margin-top: 6px;
  overflow: hidden;
}
.money-progress-fill {
  height: 100%;
  background: var(--green-600);
  border-radius: 999px;
  transition: width 0.3s;
}
.money-debtor-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 12px;
}
.money-preview-box {
  background: var(--green-50);
  border: 1.5px solid var(--green-100);
  border-radius: var(--radius-md);
  padding: 14px;
  margin: 12px 0;
}
.money-preview-row {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--gray-700);
  padding: 4px 0;
  border-bottom: 1px solid var(--green-100);
}
.money-preview-row:last-child { border-bottom: none; }
.money-cuota-row {
  background: var(--gray-50);
  border-radius: var(--radius-sm);
  padding: 12px;
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}
.money-cuota-info { flex: 1; min-width: 0; }

/* ── LANDING / SELECTOR DE MÓDULO ─────────────── */
.landing-overlay {
  position: fixed; inset: 0; z-index: 800;
  background: linear-gradient(160deg, var(--green-900) 0%, var(--green-700) 100%);
  display: flex; flex-direction: column;
  align-items: center;
  padding: env(safe-area-inset-top, 0px) 0 env(safe-area-inset-bottom, 0px);
  overflow-y: auto;
}
.landing-logo {
  display: flex; flex-direction: column; align-items: center;
  padding: 40px 20px 24px;
  gap: 12px;
}
.landing-logo-img {
  width: 72px; height: 72px; border-radius: 18px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.3);
}
.landing-app-name {
  font-family: var(--font-display);
  font-size: 34px;
  color: #fff;
  letter-spacing: -0.5px;
}
.landing-tagline {
  font-size: 13px;
  color: rgba(255,255,255,0.65);
  text-align: center;
  max-width: 280px;
  line-height: 1.4;
}

/* Reputación en landing */
.landing-reputation {
  width: 100%;
  max-width: 440px;
  padding: 0 20px;
  margin-bottom: 24px;
}
.reputation-card {
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: var(--radius-lg);
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 16px;
}
.reputation-card-icon { font-size: 28px; flex-shrink: 0; }
.reputation-card-body { flex: 1; }
.reputation-card-title { font-size: 12px; color: rgba(255,255,255,0.65); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 6px; }
.reputation-stars-row { display: flex; gap: 4px; margin-bottom: 3px; }
.rep-star { font-size: 18px; }
.rep-star-on  { color: #fbbf24; }
.rep-star-off { color: rgba(255,255,255,0.2); }
.reputation-card-sub { font-size: 11px; color: rgba(255,255,255,0.5); }
.reputation-soon-tag {
  font-size: 9px; font-weight: 700;
  background: rgba(251,191,36,0.2);
  color: #fbbf24;
  border-radius: 999px;
  padding: 2px 8px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  align-self: flex-start;
  margin-top: 2px;
}

/* Módulo selector cards */
.landing-modules {
  width: 100%;
  max-width: 440px;
  padding: 0 20px 40px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.module-card {
  background: var(--white);
  border-radius: var(--radius-xl);
  padding: 22px 20px;
  display: flex;
  align-items: center;
  gap: 18px;
  cursor: pointer;
  box-shadow: 0 8px 32px rgba(0,0,0,0.18);
  transition: transform 0.15s, box-shadow 0.15s;
}
.module-card:active { transform: scale(0.97); box-shadow: 0 4px 16px rgba(0,0,0,0.12); }
.module-card-icon {
  width: 56px; height: 56px; border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  font-size: 28px; flex-shrink: 0;
}
.module-card-body { flex: 1; }
.module-card-title { font-size: 17px; font-weight: 700; color: var(--gray-900); margin-bottom: 3px; }
.module-card-desc  { font-size: 12px; color: var(--gray-500); line-height: 1.4; }
.module-card-arrow { font-size: 20px; color: var(--gray-300); flex-shrink: 0; }

/* Money module shell */
.money-shell {
  position: fixed; inset: 0; z-index: 700;
  display: flex; flex-direction: column;
  background: var(--gray-50);
}
.money-topbar {
  background: #8a6200;
  height: calc(56px + env(safe-area-inset-top, 0px));
  padding-top: env(safe-area-inset-top, 0px);
  display: flex; align-items: center; justify-content: space-between;
  padding-left: 16px; padding-right: 16px;
  flex-shrink: 0; z-index: 10;
}
.money-topbar-title {
  font-family: var(--font-display);
  font-size: 22px; color: #fff; letter-spacing: -0.3px;
}
.money-main { flex: 1; overflow: hidden; position: relative; }
.money-screen {
  position: absolute; inset: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: calc(80px + env(safe-area-inset-bottom, 0px));
  opacity: 0; transform: translateX(20px);
  transition: opacity 0.22s, transform 0.22s;
  pointer-events: none;
}
.money-screen.active { opacity: 1; transform: translateX(0); pointer-events: auto; }

.money-hero {
  background: linear-gradient(160deg, #c98f00 0%, #8a6200 100%);
  padding: 20px 20px 28px; color: #fff;
}
.money-hero-title { font-family: var(--font-display); font-size: 22px; margin-bottom: 20px; opacity: 0.95; line-height: 1.25; }
.money-stats {
  display: flex;
  background: rgba(255,255,255,0.1);
  border-radius: var(--radius-lg);
  border: 1px solid rgba(255,255,255,0.15);
  overflow: hidden;
}
.money-stat { flex: 1; padding: 14px 8px; text-align: center; cursor: pointer; transition: background 0.15s; }
.money-stat:active { background: rgba(255,255,255,0.08); }
.money-stat-num { display: block; font-size: 28px; font-weight: 600; line-height: 1; margin-bottom: 4px; }
.money-stat-num.warn { color: #fbbf24; }
.money-stat-label { font-size: 11px; opacity: 0.75; text-transform: uppercase; letter-spacing: 0.06em; }
.money-stat-divider { width: 1px; background: rgba(255,255,255,0.15); margin: 12px 0; }

.money-bottom-nav {
  height: calc(68px + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: var(--white);
  border-top: 1px solid var(--gray-100);
  display: flex; align-items: stretch; flex-shrink: 0;
  box-shadow: 0 -4px 20px rgba(0,0,0,0.06);
}
.money-nav-item {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 3px; color: var(--gray-400);
  font-size: 10px; font-weight: 500;
  transition: color 0.15s; cursor: pointer;
  background: none; border: none;
}
.money-nav-item.active { color: #e6a800; }
.money-nav-fab {
  width: 50px; height: 50px; border-radius: 50%;
  background: #e6a800;
  display: flex; align-items: center; justify-content: center;
  color: #fff; margin-top: -12px;
  box-shadow: 0 4px 16px rgba(201,147,10,0.4);
}

.topbar-home-btn {
  font-size: 12px;
  font-weight: 600;
  color: rgba(255,255,255,0.9);
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: 999px;
  padding: 6px 12px;
  transition: background 0.15s;
  white-space: nowrap;
}
.topbar-home-btn:active { background: rgba(255,255,255,0.28); }

.module-switch-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  margin-top: 14px;
  padding: 10px 16px;
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.22);
  border-radius: var(--radius-md);
  color: rgba(255,255,255,0.9);
  font-size: 13px;
  font-weight: 500;
  transition: background 0.15s;
}
.module-switch-btn:active { background: rgba(255,255,255,0.22); }

/* ── MODULE SWITCHER EN TOPBAR ─────────────── */
.module-switch-pill {
  font-size: 12px;
  font-weight: 600;
  color: #fff;
  border-radius: 999px;
  padding: 6px 13px;
  white-space: nowrap;
  transition: opacity 0.15s;
  border: none;
}
.module-switch-pill:active { opacity: 0.8; }

/* En módulo de objetos (verde) → botón "Ir a Dinero" en amarillo rey */
.module-switch-pill:not(.money-pill) {
  background: #e6a800;
}

/* En módulo de dinero (amarillo) → botón "Ir a Objetos" en verde */
.module-switch-pill.money-pill {
  background: var(--green-700);
}


.money-reputation-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 14px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: var(--radius-md);
  padding: 12px 14px;
}

/* ── FORMULARIO DE DEUDOR INDIVIDUAL ──────── */
.money-form-deudor {
  background: var(--gray-50);
  border: 1.5px solid var(--gray-200, #e5e7eb);
  border-radius: var(--radius-md);
  padding: 14px;
  margin-bottom: 12px;
}
.money-form-deudor-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}
.money-form-row {
  display: flex;
  gap: 10px;
}
.money-form-row > div { flex: 1; }

/* ── SECCIÓN POR DEUDOR EN DETALLE ─────── */
.money-deudor-section {
  background: var(--gray-50);
  border-radius: var(--radius-md);
  margin-bottom: 12px;
  overflow: hidden;
  border: 1px solid var(--gray-200, #e5e7eb);
}
.money-deudor-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  background: var(--white);
  border-bottom: 1px solid var(--gray-100);
}
.money-deudor-header.overdue { background: var(--red-50, #fef2f2); }
.money-deudor-name { font-size: 14px; font-weight: 600; color: var(--gray-900); }
.money-deudor-meta { font-size: 11px; color: var(--gray-500); margin-top: 2px; }
.money-cuota-row {
  padding: 10px 14px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  border-bottom: 1px solid var(--gray-100);
}
.money-cuota-row:last-child { border-bottom: none; }
.money-cuota-info { flex: 1; min-width: 0; }

/* ── PANTALLA DE LOGIN ─────────────────────────────────── */
.auth-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: linear-gradient(160deg, #0a5c47 0%, #063d2f 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.auth-overlay.hidden { display: none; }
.auth-card {
  width: 100%;
  max-width: 360px;
  background: #fff;
  border-radius: 20px;
  padding: 32px 24px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.3);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}
.auth-logo {
  width: 96px;
  border-radius: 16px;
  margin-bottom: 16px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.18);
}
.auth-title {
  font-family: 'DM Serif Display', serif;
  font-size: 22px;
  color: #0a5c47;
  margin-bottom: 4px;
}
.auth-subtitle {
  font-size: 13px;
  color: #777;
  margin-bottom: 22px;
}
.auth-input {
  width: 100%;
  box-sizing: border-box;
  padding: 13px 14px;
  margin-bottom: 12px;
  border: 1.5px solid #dcdcdc;
  border-radius: 12px;
  font-size: 15px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s;
}
.auth-input:focus { border-color: #0a5c47; }
.auth-msg {
  width: 100%;
  min-height: 18px;
  font-size: 13px;
  margin-bottom: 10px;
  line-height: 1.4;
}
.auth-btn {
  width: 100%;
  padding: 13px;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  border: none;
  cursor: pointer;
  margin-bottom: 10px;
  transition: opacity 0.15s, transform 0.05s;
}
.auth-btn:active { transform: scale(0.98); }
.auth-btn:disabled { opacity: 0.55; cursor: default; }
.auth-btn-primary { background: #0a5c47; color: #fff; }
.auth-btn-secondary {
  background: #fff;
  color: #0a5c47;
  border: 1.5px solid #0a5c47;
}
.auth-hint {
  font-size: 11.5px;
  color: #999;
  margin-top: 6px;
  line-height: 1.4;
}
.auth-signout-btn {
  margin: 28px auto 0;
  display: block;
  background: transparent;
  border: 1px solid rgba(255,255,255,0.35);
  color: rgba(255,255,255,0.85);
  padding: 9px 22px;
  border-radius: 20px;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
}
.auth-signout-btn:active { background: rgba(255,255,255,0.1); }
