:root {
  color-scheme: light dark;
  --bg: #f2f2f7;
  --bg-elevated: #ffffff;
  --text: #1c1c1e;
  --text-muted: #6e6e73;
  --border: rgba(60, 60, 67, 0.15);
  --accent: #0a84ff;
  --green: #34c759;
  --red: #ff3b30;
  --orange: #ff9500;
  --purple: #af52de;
  --shadow: 0 1px 2px rgba(0,0,0,0.06), 0 4px 12px rgba(0,0,0,0.05);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000;
    --bg-elevated: #1c1c1e;
    --text: #f2f2f7;
    --text-muted: #98989f;
    --border: rgba(255, 255, 255, 0.12);
    --shadow: 0 1px 2px rgba(0,0,0,0.3), 0 4px 16px rgba(0,0,0,0.4);
  }
}

/* ---------- Temas explícitos (anulan el prefers-color-scheme del sistema) ---------- */
:root[data-theme="light"] {
  --bg: #f2f2f7; --bg-elevated: #ffffff; --text: #1c1c1e; --text-muted: #6e6e73;
  --border: rgba(60, 60, 67, 0.15); --accent: #0a84ff; --purple: #af52de;
  --shadow: 0 1px 2px rgba(0,0,0,0.06), 0 4px 12px rgba(0,0,0,0.05);
}
:root[data-theme="dark"] {
  --bg: #000000; --bg-elevated: #1c1c1e; --text: #f2f2f7; --text-muted: #98989f;
  --border: rgba(255, 255, 255, 0.12); --accent: #0a84ff; --purple: #af52de;
  --shadow: 0 1px 2px rgba(0,0,0,0.3), 0 4px 16px rgba(0,0,0,0.4);
}
:root[data-theme="pink"] {
  --bg: #fdf1f5; --bg-elevated: #ffffff; --text: #402530; --text-muted: #9c6f83;
  --border: rgba(219, 39, 119, 0.15); --accent: #ec4899; --green: #16a34a; --red: #e11d48;
  --orange: #f59e0b; --purple: #d6336c;
  --shadow: 0 1px 2px rgba(219,39,119,0.08), 0 4px 12px rgba(219,39,119,0.08);
}
:root[data-theme="pink-dark"] {
  --bg: #1a0e14; --bg-elevated: #2b1620; --text: #ffe9f0; --text-muted: #c48ba0;
  --border: rgba(255, 182, 206, 0.16); --accent: #ff6f9c; --green: #34d399; --red: #fb7185;
  --orange: #fbbf24; --purple: #f472b6;
  --shadow: 0 1px 2px rgba(0,0,0,0.35), 0 4px 16px rgba(0,0,0,0.45);
}
:root[data-theme="lavender"] {
  --bg: #f5f2fb; --bg-elevated: #ffffff; --text: #2e2a3d; --text-muted: #8b84a3;
  --border: rgba(124, 109, 182, 0.2); --accent: #7c5cff; --green: #16a34a; --red: #e11d48;
  --orange: #f59e0b; --purple: #9061f9;
  --shadow: 0 1px 2px rgba(90,70,160,0.08), 0 4px 12px rgba(90,70,160,0.08);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  height: 100%;
  height: -webkit-fill-available;
  overscroll-behavior-y: none;
  -webkit-text-size-adjust: 100%;
}

/* Sin zoom por doble toque ni pellizco: en iPhone ese zoom descuadra la pantalla y los
   botones quedan "corridos" (hay que tocar más abajo de donde se ven). */
html, body, * {
  touch-action: manipulation;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}
/* Sin selección de texto (un doble toque selecciona la palabra y mueve la pantalla), salvo al escribir. */
body, body * {
  -webkit-user-select: none;
  user-select: none;
}
input, textarea {
  -webkit-user-select: text;
  user-select: text;
}
/* iOS amplía la pantalla al enfocar un campo con letra menor a 16px. */
select, input, textarea { font-size: 16px; }

body {
  position: fixed;
  inset: 0;
  width: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  height: -webkit-fill-available;
}

.topbar {
  padding: calc(var(--safe-top) + 10px) 16px 8px;
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 5;
  border-bottom: 1px solid var(--border);
}
.topbar h1 {
  font-size: 22px;
  margin: 0 0 8px;
  font-weight: 700;
  letter-spacing: -0.3px;
}
.topbar-fila { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
/* Insignia "por Holbaph": el interruptor lleva degradado y las letras siguen el color del tema. */
.por-holbaph { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 600; color: var(--text-muted); text-decoration: none; white-space: nowrap; }
.por-holbaph .hb-logo { height: 14px; width: auto; color: var(--text); }
.login-links { display: flex; justify-content: space-between; gap: 8px; margin-top: 14px; }
.link-btn { background: none; border: 0; padding: 6px 2px; font: inherit; font-size: 13px; color: var(--accent); cursor: pointer; }
.login-aviso { color: var(--text); background: var(--bg-elevated); border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; font-size: 13px; margin: 0 0 12px; text-align: left; }
.login-aviso.hidden, .form-group.hidden, .link-btn.hidden { display: none; }
.plan-chip { display: inline-block; margin: 0 0 4px; padding: 4px 12px; border-radius: 999px; font-size: 13px; font-weight: 600; background: var(--bg); border: 1px solid var(--border); }
.canje { display: flex; gap: 8px; margin-top: 12px; }
.canje input { flex: 1; min-width: 0; padding: 12px; font-size: 15px; border-radius: 12px; border: 1px solid var(--border); background: var(--bg-elevated); color: var(--text); text-transform: uppercase; }
.por-centro { display: flex; justify-content: center; margin-top: 18px; }
.por-centro .hb-logo { height: 16px; }
.month-switch {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--bg-elevated);
  border-radius: 10px;
  padding: 4px;
  width: fit-content;
  box-shadow: var(--shadow);
}
.month-label {
  font-weight: 600;
  font-size: 15px;
  min-width: 130px;
  text-align: center;
  text-transform: capitalize;
}
.icon-btn {
  border: none;
  background: transparent;
  color: var(--accent);
  font-size: 20px;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  line-height: 1;
  cursor: pointer;
}
.icon-btn:active { background: var(--border); }

main#views {
  flex: 1;
  overflow-y: auto;
  padding: 12px 16px calc(90px + var(--safe-bottom));
  -webkit-overflow-scrolling: touch;
}

.view.hidden { display: none; }

.cards-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 20px;
}
.cards-grid-2 { grid-template-columns: 1fr; }

.card {
  background: var(--bg-elevated);
  border-radius: 16px;
  padding: 14px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.card-label { font-size: 12.5px; color: var(--text-muted); font-weight: 500; }
.card-value { font-size: 20px; font-weight: 700; letter-spacing: -0.3px; }
.card-income .card-value { color: var(--green); }
.card-expense .card-value { color: var(--orange); }
.card-balance .card-value { color: var(--accent); }
.card-pending .card-value { color: var(--red); }

.section-block { margin-bottom: 22px; }
.section-block h2 {
  font-size: 15px;
  font-weight: 700;
  margin: 0 0 10px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--text-muted);
}
.section-title-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 10px;
}
.section-title-row h2 { margin: 0; }
.muted { color: var(--text-muted); font-size: 13px; }

.progress-bar-track {
  background: var(--border);
  border-radius: 8px;
  height: 10px;
  overflow: hidden;
}
.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--green), var(--accent));
  border-radius: 8px;
  transition: width 0.3s ease;
  width: 0%;
}

.categoria-list, .deuda-list, .ingreso-list { display: flex; flex-direction: column; gap: 8px; }

.categoria-row {
  background: var(--bg-elevated);
  border-radius: 12px;
  padding: 10px 14px;
  box-shadow: var(--shadow);
}
.categoria-row-top { display: flex; justify-content: space-between; font-size: 14px; margin-bottom: 6px; }
.categoria-row-top strong { font-weight: 600; }
.categoria-bar-track { background: var(--border); border-radius: 6px; height: 6px; overflow: hidden; }
.categoria-bar-fill { height: 100%; background: var(--purple); }

.deuda-groups { display: flex; flex-direction: column; gap: 18px; }
.deuda-group-title {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin: 0 0 8px 4px;
}
.deuda-group-total { color: var(--accent); font-size: 13px; }
.deuda-group-items { display: flex; flex-direction: column; gap: 8px; }

.deuda-card {
  background: var(--bg-elevated);
  border-radius: 14px;
  padding: 12px 14px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 12px;
}
.deuda-info { flex: 1; min-width: 0; }
.deuda-empresa { font-size: 13px; color: var(--text-muted); font-weight: 500; }
.deuda-detalle { font-size: 15.5px; font-weight: 600; margin: 1px 0 5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.deuda-meta { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text-muted); }
.deuda-meta .valor { font-weight: 700; color: var(--text); }
.mini-progress-track { background: var(--border); border-radius: 5px; height: 5px; overflow: hidden; margin-top: 6px; }
.mini-progress-fill { height: 100%; background: var(--purple); }

.estado-toggle {
  border: none;
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  min-width: 78px;
}
.estado-toggle.pagado { background: rgba(52,199,89,0.15); color: var(--green); }
.estado-toggle.pendiente { background: rgba(255,59,48,0.15); color: var(--red); }

.finalizada-badge {
  font-size: 11px;
  font-weight: 700;
  color: var(--purple);
  background: rgba(175,82,222,0.15);
  padding: 6px 10px;
  border-radius: 10px;
  border: none;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
}

.empty-state {
  text-align: center;
  color: var(--text-muted);
  padding: 40px 20px;
  font-size: 14px;
}

/* ---------- Gastos (consumo / por rendir) ---------- */
.gasto-panel.hidden { display: none; }
.gasto-panel { margin-top: 16px; }
.gasto-list { display: flex; flex-direction: column; gap: 8px; }

.gasto-card {
  background: var(--bg-elevated);
  border-radius: 14px;
  padding: 12px 14px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 12px;
}
.gasto-thumb {
  width: 46px;
  height: 46px;
  border-radius: 10px;
  object-fit: cover;
  background: var(--border);
  flex-shrink: 0;
}
.gasto-thumb-placeholder {
  width: 46px;
  height: 46px;
  border-radius: 10px;
  background: var(--border);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: var(--text-muted);
}
.gasto-info { flex: 1; min-width: 0; }
.gasto-detalle { font-size: 15.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gasto-meta { font-size: 12.5px; color: var(--text-muted); margin-top: 2px; }
.gasto-meta .valor { font-weight: 700; color: var(--text); }
.gasto-right { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }

.badge-estado {
  font-size: 11px;
  font-weight: 700;
  padding: 5px 10px;
  border-radius: 8px;
  white-space: nowrap;
}
.badge-estado.pendiente { background: rgba(255,149,0,0.15); color: var(--orange); }
.badge-estado.rendido { background: rgba(10,132,255,0.15); color: var(--accent); }
.badge-estado.reembolsado { background: rgba(52,199,89,0.15); color: var(--green); }

.photo-attach-row { display: flex; gap: 10px; align-items: center; margin-bottom: 4px; }
.photo-preview {
  width: 72px;
  height: 72px;
  border-radius: 12px;
  object-fit: cover;
  background: var(--border);
}
.photo-preview-empty {
  width: 72px;
  height: 72px;
  border-radius: 12px;
  background: var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  color: var(--text-muted);
}
.btn-photo {
  flex: 1;
  background: var(--bg-elevated);
  border: 1px dashed var(--border);
  border-radius: 10px;
  padding: 12px;
  font-size: 14px;
  font-weight: 600;
  color: var(--accent);
  cursor: pointer;
  text-align: center;
}

.filter-row { margin-bottom: 14px; }
.select-filter {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  font-size: 16px;
}

.ingreso-card {
  background: var(--bg-elevated);
  border-radius: 14px;
  padding: 12px 14px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.ingreso-fuente { font-weight: 600; font-size: 15px; }
.ingreso-tipo { font-size: 12px; color: var(--text-muted); text-transform: capitalize; }
.ingreso-monto { font-weight: 700; color: var(--green); font-size: 16px; }
.ingreso-actions { display: flex; gap: 6px; }

.icon-action {
  border: none;
  background: var(--border);
  width: 30px;
  height: 30px;
  border-radius: 8px;
  font-size: 14px;
  color: var(--text);
  cursor: pointer;
}

.tabbar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  background: var(--bg-elevated);
  border-top: 1px solid var(--border);
  padding: 6px 6px calc(6px + var(--safe-bottom));
  z-index: 10;
}
.tab-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 10.5px;
  font-weight: 500;
  padding: 6px 0;
  cursor: pointer;
}
.tab-btn .tab-icon { font-size: 20px; line-height: 1; }
.tab-btn.active { color: var(--accent); }

.fab {
  position: fixed;
  right: 18px;
  bottom: calc(78px + var(--safe-bottom));
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: var(--accent);
  color: white;
  font-size: 28px;
  border: none;
  box-shadow: 0 4px 16px rgba(10,132,255,0.4);
  cursor: pointer;
  z-index: 9;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.fab:active { transform: scale(0.95); }
.fab.hidden { display: none; }

.sheet-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 20;
  display: flex;
  align-items: flex-end;
  transition: opacity 0.2s ease;
}
.sheet-overlay.hidden { display: none; }
.sheet {
  background: var(--bg);
  width: 100%;
  max-height: 88vh;
  overflow-y: auto;
  border-radius: 20px 20px 0 0;
  padding: 8px 20px calc(24px + var(--safe-bottom));
  animation: slideUp 0.25s ease;
}
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
.sheet-handle {
  width: 36px;
  height: 5px;
  background: var(--border);
  border-radius: 3px;
  margin: 10px auto 14px;
}

.sheet h2 { font-size: 19px; margin: 0 0 16px; }
.form-group { margin-bottom: 14px; }
.form-group label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 5px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.form-group input, .form-group select, .form-group textarea {
  width: 100%;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  font-size: 16px;
  font-family: inherit;
}
.form-group textarea { resize: vertical; min-height: 60px; }
.form-row { display: flex; gap: 10px; }
.form-row .form-group { flex: 1; }

.segmented {
  display: flex;
  background: var(--bg-elevated);
  border-radius: 10px;
  padding: 3px;
  border: 1px solid var(--border);
}
.segmented button {
  flex: 1;
  border: none;
  background: transparent;
  padding: 8px 0;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
}
.segmented button.active { background: var(--accent); color: white; }

.btn {
  display: block;
  text-align: center;
  padding: 13px 18px;
  border-radius: 12px;
  border: none;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}
.btn.full { width: 100%; margin-bottom: 10px; }
.btn-primary { background: var(--accent); color: white; }
.btn-secondary { background: var(--bg-elevated); color: var(--text); border: 1px solid var(--border); }
.btn-danger { background: rgba(255,59,48,0.12); color: var(--red); }
.btn-text { background: transparent; color: var(--red); font-weight: 600; }
.file-btn { cursor: pointer; }

.sheet-actions { display: flex; flex-direction: column; gap: 10px; margin-top: 6px; }

.historial-list { display: flex; flex-direction: column; gap: 6px; margin-top: 4px; }
.historial-row {
  display: flex;
  justify-content: space-between;
  font-size: 13.5px;
  padding: 8px 10px;
  background: var(--bg-elevated);
  border-radius: 8px;
}
.historial-row .h-mes { text-transform: capitalize; color: var(--text-muted); }
.historial-row { align-items: center; gap: 8px; }
.rev-ok { color: var(--green); font-weight: 600; }
.rev-warn { color: var(--red); font-weight: 600; }
.btn-mini {
  border: none;
  border-radius: 8px;
  padding: 5px 9px;
  font-size: 12px;
  font-weight: 700;
  font-family: inherit;
  color: var(--purple);
  background: rgba(175,82,222,0.15);
  cursor: pointer;
  white-space: nowrap;
}

.check-list { margin-bottom: 14px; }
.check-list-title {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 5px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.check-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  margin-bottom: 6px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 15px;
}
.check-row input { width: 20px; height: 20px; flex: none; }

.toast {
  position: fixed;
  bottom: calc(90px + var(--safe-bottom));
  left: 50%;
  transform: translateX(-50%);
  background: rgba(28,28,30,0.92);
  color: white;
  padding: 10px 18px;
  border-radius: 10px;
  font-size: 14px;
  z-index: 30;
  transition: opacity 0.25s ease;
}
.toast.hidden { opacity: 0; pointer-events: none; }

/* ---------- Bloqueo con PIN ---------- */
html.locked-boot #app { visibility: hidden; }
.lock-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  background: var(--bg);
}
.lock-overlay.visible, html.locked-boot #lockOverlay { display: flex; }
.lock-box {
  width: 100%;
  max-width: 320px;
  padding: 0 28px;
  text-align: center;
}
.lock-icon { font-size: 42px; margin-bottom: 6px; }
.lock-box h2 { margin: 0 0 4px; font-size: 20px; }
.lock-input {
  width: 100%;
  margin: 18px 0 8px;
  padding: 14px;
  font-size: 26px;
  text-align: center;
  letter-spacing: 10px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
}
.lock-error { color: var(--red); font-size: 13px; margin: 0 0 12px; }
.lock-error.hidden { display: none; }
.login-field {
  font-size: 16px;
  text-align: left;
  letter-spacing: normal;
  margin: 0;
}

/* ---------- Selector de temas ---------- */
.theme-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.theme-swatch {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  background: var(--bg-elevated);
  border: 2px solid var(--border);
  border-radius: 14px;
  padding: 12px 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
}
.theme-swatch.active { border-color: var(--accent); }
.swatch-dot { width: 28px; height: 28px; border-radius: 50%; display: block; box-shadow: inset 0 0 0 1px rgba(0,0,0,0.08); }
.swatch-auto { background: linear-gradient(135deg, #ffffff 50%, #1c1c1e 50%); }
.swatch-light { background: #ffffff; }
.swatch-dark { background: #1c1c1e; }
.swatch-pink { background: #ec4899; }
.swatch-pinkdark { background: #2b1620; box-shadow: inset 0 0 0 1px #ff6f9c; }
.swatch-lavender { background: #7c5cff; }

/* ---------- Botón archivadas / pagadas ---------- */
.filter-row-split { display: flex; gap: 8px; align-items: center; }
.filter-row-split .select-filter { flex: 1; }
.btn-archived {
  white-space: nowrap;
  font-size: 12.5px;
  font-weight: 600;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-muted);
  cursor: pointer;
}

/* ---------- Resumen del filtro por empresa ---------- */
.resumen-filtro-empresa {
  background: var(--bg-elevated);
  border-radius: 12px;
  padding: 12px 14px;
  box-shadow: var(--shadow);
  margin-bottom: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}
.resumen-filtro-empresa.hidden { display: none; }
.resumen-filtro-empresa .rfe-label { font-size: 13px; color: var(--text-muted); font-weight: 500; }
.resumen-filtro-empresa .rfe-total { font-size: 18px; font-weight: 700; color: var(--accent); }

/* ---------- Ícono de deuda ---------- */
.deuda-icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 21px;
  flex-shrink: 0;
  overflow: hidden;
}
.deuda-icon img { width: 100%; height: 100%; object-fit: cover; }

/* ---------- Selector de emojis (form deuda) ---------- */
.icon-picker {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}
.icon-picker button {
  aspect-ratio: 1;
  border-radius: 10px;
  border: 2px solid var(--border);
  background: var(--bg-elevated);
  font-size: 19px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.icon-picker button.active { border-color: var(--accent); background: rgba(10,132,255,0.1); }

.archivada-row {
  background: var(--bg-elevated);
  border-radius: 14px;
  padding: 12px 14px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 12px;
}
.archivada-info { flex: 1; min-width: 0; }
.archivada-fecha { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* ---------- Maestros (Empresas / Categorías) ---------- */
.maestro-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; }
.maestro-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: var(--bg-elevated);
  border-radius: 10px;
  padding: 10px 12px;
  box-shadow: var(--shadow);
}
.maestro-row span { font-size: 14.5px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.maestro-actions { display: flex; gap: 6px; flex-shrink: 0; }

/* ---------- Recordatorio de cierre / saldo inicial ---------- */
.banner-recordatorio {
  background: rgba(255,149,0,0.12);
  color: var(--orange);
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 14px;
}
.banner-recordatorio.hidden { display: none; }
.card-sub { font-size: 11px; color: var(--text-muted); font-weight: 500; }
.card-sub.hidden { display: none; }

/* ---------- Cierre de mes ---------- */
.cierre-card {
  background: var(--bg-elevated);
  border-radius: 14px;
  padding: 14px;
  box-shadow: var(--shadow);
}
.cierre-card p { margin: 0 0 12px; font-size: 13.5px; color: var(--text-muted); }
.cierre-cerrado-badge {
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  color: var(--green);
  background: rgba(52,199,89,0.15);
  padding: 6px 10px;
  border-radius: 8px;
  margin-bottom: 10px;
}

/* ---------- Visor de imágenes ampliadas ---------- */
.image-lightbox {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.92);
  padding: env(safe-area-inset-top, 0px) 16px env(safe-area-inset-bottom, 0px);
}
.image-lightbox.visible { display: flex; }
.image-lightbox img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 8px;
}
.lightbox-close {
  position: absolute;
  top: calc(env(safe-area-inset-top, 0px) + 14px);
  right: 18px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: rgba(255,255,255,0.15);
  color: #fff;
  font-size: 18px;
  cursor: pointer;
  z-index: 1;
}
.ampliable { cursor: zoom-in; }

/* ---------- Spinner de carga (botones "Guardar") ---------- */
.spinner {
  display: inline-block;
  width: 15px;
  height: 15px;
  border: 2.5px solid rgba(255,255,255,0.4);
  border-top-color: #fff;
  border-radius: 50%;
  margin-right: 8px;
  vertical-align: -3px;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.btn:disabled { opacity: 0.75; cursor: default; }
