/* Comentario: tema oscuro con acento violeta/lila personalizable por el
   usuario. El acento vive en una variable CSS que app.js actualiza. */

:root {
  --accent: #7C6FE8;
  --bg: #12101A;
  --surface: #1E1B2E;
  --surface-2: #262238;
  --border: #322D48;
  --text: #F5F5F0;
  --text-secondary: #A9A5BE;
  --text-muted: #6F6B85;
  --danger: #FF8C7A;
  --success: #7FE8C0;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-tap-highlight-color: transparent;
}

#app { min-height: 100vh; padding-bottom: 76px; }

.screen { padding: 20px 16px 8px; max-width: 480px; margin: 0 auto; }

h1 { font-size: 22px; font-weight: 600; margin: 0 0 4px; }
h2 { font-size: 17px; font-weight: 600; margin: 24px 0 10px; }
p { margin: 0; }

.muted { color: var(--text-secondary); font-size: 13px; }
.hint { color: var(--text-muted); font-size: 12px; }

.card {
  background: var(--surface);
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 12px;
}

.stat-big {
  background: var(--surface);
  border-radius: 14px;
  padding: 16px 18px;
  margin-bottom: 10px;
}
.stat-big .label { font-size: 13px; color: var(--text-secondary); margin-bottom: 4px; }
.stat-big .value { font-size: 26px; font-weight: 600; }
.stat-big.danger .value { color: var(--danger); }
.stat-big.danger .label { color: var(--danger); }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.list-row {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 4px; border-bottom: 1px solid var(--border);
}
.list-row:last-child { border-bottom: none; }
.list-row .icon { width: 34px; height: 34px; border-radius: 50%; background: var(--surface-2); display: flex; align-items: center; justify-content: center; flex-shrink: 0; font-size: 15px; }
.list-row .main { flex: 1; min-width: 0; }
.list-row .title { font-size: 15px; }
.list-row .sub { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.list-row .amount { font-size: 15px; font-weight: 600; white-space: nowrap; }

button, .btn {
  font-family: inherit; font-size: 14px; font-weight: 600;
  border-radius: 12px; padding: 13px 16px; border: none;
  cursor: pointer; text-align: center;
}
.btn-primary { background: var(--accent); color: #fff; width: 100%; }
.btn-secondary { background: var(--surface-2); color: var(--text); width: 100%; }
.btn-danger { background: transparent; color: var(--danger); border: 1px solid var(--danger); width: 100%; }
.btn-small { padding: 8px 12px; font-size: 13px; border-radius: 10px; }
.btn-icon { background: transparent; color: var(--text-secondary); padding: 6px; font-size: 18px; }

input, select, textarea {
  width: 100%; background: var(--surface-2); border: 1px solid var(--border);
  color: var(--text); border-radius: 10px; padding: 12px 14px; font-size: 15px;
  font-family: inherit; margin-bottom: 12px;
}
label { font-size: 13px; color: var(--text-secondary); display: block; margin-bottom: 6px; }
.field { margin-bottom: 14px; }

.more-options-toggle { color: var(--accent); font-size: 13px; font-weight: 600; margin: 4px 0 14px; cursor: pointer; }
.more-options { display: none; }
.more-options.open { display: block; }

.toggle-row { display: flex; gap: 8px; margin-bottom: 14px; }
.toggle-btn { flex: 1; padding: 10px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text-secondary); font-size: 13px; cursor: pointer; }
.toggle-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }

.progress-bar { height: 6px; background: var(--border); border-radius: 99px; overflow: hidden; margin: 10px 0; }
.progress-bar-fill { height: 100%; background: var(--accent); }

.finishes-banner { background: rgba(124,111,232,0.15); color: var(--accent); border-radius: 8px; padding: 8px 10px; text-align: center; font-size: 13px; margin-top: 8px; }

.timeline-item { display: flex; gap: 10px; padding: 10px 2px; border-bottom: 1px solid var(--border); }
.timeline-item:last-child { border-bottom: none; }
.timeline-dot { width: 30px; height: 30px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-shrink: 0; font-size: 13px; }

.badge { font-size: 11px; padding: 3px 8px; border-radius: 99px; font-weight: 600; }
.badge-billed { background: rgba(255,140,122,0.15); color: var(--danger); }
.badge-paid { background: rgba(127,232,192,0.15); color: var(--success); }

.topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.topbar .brand { display: flex; align-items: center; gap: 8px; font-size: 19px; font-weight: 600; }

.navbar {
  position: fixed; bottom: 0; left: 0; right: 0;
  background: var(--surface); border-top: 1px solid var(--border);
  display: flex; padding: 8px 4px calc(8px + env(safe-area-inset-bottom));
  max-width: 480px; margin: 0 auto;
}
.nav-item {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
  background: none; border: none; color: var(--text-muted); font-size: 10px; padding: 6px 2px;
}
.nav-item .nav-icon { font-size: 20px; }
.nav-item.active { color: var(--accent); }

.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.6);
  display: flex; align-items: flex-end; justify-content: center; z-index: 200;
}
.modal-sheet {
  background: var(--surface); border-radius: 20px 20px 0 0; padding: 20px 16px;
  width: 100%; max-width: 480px; max-height: 85vh; overflow-y: auto;
}
.modal-title { font-size: 17px; font-weight: 600; margin-bottom: 16px; }
.modal-actions { display: flex; gap: 10px; margin-top: 16px; }

.calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin-bottom: 20px; }
.calendar-dow { font-size: 10px; color: var(--text-muted); text-align: center; padding-bottom: 4px; }
.calendar-day { aspect-ratio: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; border-radius: 8px; font-size: 11px; color: var(--text-secondary); }
.calendar-day.has-sub { background: var(--surface-2); }
.calendar-day .pills { display: flex; gap: 2px; flex-wrap: wrap; justify-content: center; }
.pill-dot { width: 5px; height: 5px; border-radius: 50%; }

.color-swatches { display: flex; gap: 10px; flex-wrap: wrap; }
.swatch { width: 34px; height: 34px; border-radius: 50%; cursor: pointer; border: 2px solid transparent; }
.swatch.selected { border-color: var(--text); }

.error-text { color: var(--danger); font-size: 13px; margin: 8px 0; }

.empty-state { text-align: center; padding: 40px 20px; color: var(--text-muted); }
.empty-state .icon { font-size: 32px; margin-bottom: 10px; }

/* Comentario: aviso flotante no bloqueante (toast) — aparece abajo,
   se desvanece solo, no interrumpe lo que estabas haciendo */
#toast {
  position: fixed; bottom: 90px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--surface-2); color: var(--text); border: 1px solid var(--border);
  padding: 12px 18px; border-radius: 12px; font-size: 13px; z-index: 999;
  opacity: 0; transition: opacity 0.2s ease, transform 0.2s ease; pointer-events: none;
  max-width: 85%; text-align: center;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.toast-error { background: rgba(255,140,122,0.15); color: var(--danger); border-color: var(--danger); }

/* Comentario: selector S/ / $ pegado al campo de monto, visible siempre */
.currency-toggle { display: flex; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; flex-shrink: 0; }
.currency-btn {
  background: var(--surface-2); color: var(--text-secondary); border: none; padding: 0 14px;
  font-size: 14px; font-weight: 600; cursor: pointer; height: 46px;
}
.currency-btn.active { background: var(--accent); color: #fff; }

/* Comentario: círculo de color con una "x" para quitarlo de la paleta */
.swatch-removable { position: relative; display: inline-block; }
.swatch-removable .swatch { width: 34px; height: 34px; }
.swatch-remove {
  position: absolute; top: -4px; right: -4px; width: 16px; height: 16px; border-radius: 50%;
  background: var(--danger); color: #fff; border: none; font-size: 11px; line-height: 1;
  cursor: pointer; padding: 0;
}
