/* ===========================
   Global variables
   =========================== */
:root {
  --text:    #f5f7fb;
  --muted:   rgba(255,255,255,0.55);
  --border:  rgba(255,255,255,0.10);
  --card:    rgba(255,255,255,0.07);
  --card2:   rgba(255,255,255,0.04);
  --primary: #ffcc00;
  --primary2:#ff9900;
  --primary-contrast: #000;
  --success: #4ddc7f;
  --danger:  #ff5a6a;
  --toast-bg:      rgba(20,20,20,0.90);
  --toast-success: rgba(34,197,94,0.85);
  --toast-error:   rgba(239,68,68,0.85);
  --row-updated:   rgba(77,220,127,0.15);
}

/* ===========================
   Base styles
   =========================== */
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: 'Poppins', ui-sans-serif, system-ui, -apple-system, sans-serif;
  color: var(--text);
  background: radial-gradient(circle at top, #1c1c1c, #000);
  min-height: 100vh;
  -webkit-text-size-adjust: 100%;
}

.app { max-width: 1100px; margin: 0 auto; padding: 16px; }
h1, h2 { margin: 0 0 12px; font-weight: 700; }

.card {
  background: var(--card);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px;
  box-shadow: 0 10px 40px rgba(0,0,0,.45);
  margin-bottom: 20px;
}

.form-panel h2 { font-size: clamp(18px, 2vw, 22px); }

/* ===========================
   Form grid
   =========================== */
.grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

label { display: grid; gap: 6px; font-size: 14px; font-weight: 600; }
input[type="text"], input[type="date"], input[type="number"], select, textarea {
  width: 100%;
  border: 1px solid var(--border);
  background: rgba(0,0,0,0.30);
  color: var(--text);
  padding: 10px 12px;
  border-radius: 10px;
  font-weight: 500;
  font-size: 16px;
  font-family: 'Poppins', sans-serif;
}
select option {
  background: #1c1c1c;
  color: var(--text);
}
input[readonly] { opacity: .8; }

/* ðŸ”¹ Ajuste especial para TextField de descripciÃ³n */
#descInput {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

/* ðŸ”¹ Aseguramos que todos los inputs no se salgan del card */
input[type="text"], input[type="date"], input[type="number"], select {
  max-width: 100%;
  box-sizing: border-box;
}

.actions { margin-top: 12px; display: flex; gap: 10px; flex-wrap: wrap; }
button {
  cursor: pointer;
  border-radius: 10px;
  padding: 10px 14px;
  border: 1px solid transparent;
  font-weight: 700;
  font-size: 15px;
}
button.primary { background: var(--primary); color: var(--primary-contrast); }
button.ghost { background: transparent; border-color: var(--border); color: var(--text); }
button.danger { background: var(--danger); color: #fff; }
button:active { transform: translateY(1px); }

/* ===========================
   Table
   =========================== */
.table-wrapper { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.tbl { width: 100%; border-collapse: collapse; min-width: 600px; }
.tbl thead th {
  text-align: left;
  font-size: 13px;
  padding: 10px 12px;
  background: rgba(255,255,255,0.06);
  border-bottom: 1px solid var(--border);
  color: var(--muted);
  font-weight: 600;
  letter-spacing: 0.3px;
}
.tbl tbody td {
  padding: 12px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}
.tbl tbody tr:last-child td { border-bottom: 1px solid var(--border); }

/* Badges */
.badge { display:inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.badge.high { background: color-mix(in oklab, var(--danger), var(--card) 60%); }
.badge.medium { background: color-mix(in oklab, orange, var(--card) 60%); }
.badge.low { background: color-mix(in oklab, var(--success), var(--card) 60%); }

/* ===========================
   Calendar
   =========================== */
.calendar { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; }
.daycell {
  min-height: 110px;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 8px;
  background: color-mix(in oklab, var(--card), black 2%);
  display: grid; grid-template-rows: auto 1fr; gap: 6px;
}
.daycell .dd { text-align: right; font-weight: 700; opacity: .85; }
.daycell .row { font-size: 12px; color: var(--muted); line-height: 1.25; }

/* ===========================
   Responsive
   =========================== */
@media (max-width: 900px) { .grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px) {
  .grid { grid-template-columns: 1fr; }
  label { font-size: 15px; }
  /* Exclude radio/checkbox/file from full-width override */
  input:not([type="radio"]):not([type="checkbox"]):not([type="file"]),
  select, textarea { font-size: 16px; padding: 12px; width: 100% !important; max-width: 100% !important; }
  .actions { justify-content: space-between; margin-top: 16px; }
  button { flex: 1; padding: 12px; font-size: 15px; }

  .table-wrapper { overflow-x: visible; }
  .tbl { border: 0; min-width: unset; }
  .tbl thead { display: none; }
  .tbl, .tbl tbody, .tbl tr, .tbl td { display: block; width: 100%; }
  .tbl tr {
    margin-bottom: 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 10px;
    background: var(--card);
  }
  .tbl td {
    text-align: right;
    padding: 8px;
    font-size: 14px;
    border: none;
    position: relative;
  }
  .tbl td::before {
    content: attr(data-label);
    position: absolute;
    left: 10px;
    font-weight: 600;
    color: var(--muted);
  }
  .tbl tr:last-child { margin-bottom: 0; }
}

/* ===========================
   Extra inputs
   =========================== */
input.readonly { background: #e0e0e0; color: #555; cursor: not-allowed; }
.short-input { max-width: 180px; }
textarea.big-textarea { min-height: 80px; resize: vertical; }
.readonly-input { background: #e5e7eb; color: #6b7280; cursor: not-allowed; }

/* ===========================
   Confirm Modal
   =========================== */
.modal.hidden { display: none; }
.modal {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.72);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center;
  z-index: 5000;  /* above all edit modals (z-index 1000) */
  padding: 16px;
}
.modal-content {
  background: rgba(255, 255, 255, 0.08);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text);
  padding: 28px 24px;
  border-radius: 18px;
  max-width: 420px;
  width: 100%;
  text-align: center;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.65);
  animation: confirmFadeIn 0.18s ease;
}
@keyframes confirmFadeIn {
  from { opacity: 0; transform: translateY(10px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0)    scale(1); }
}
.modal-content p {
  margin: 0 0 20px;
  font-size: 15px;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.88);
  text-align: left;
}
.modal-content p strong {
  display: block;
  text-align: center;
  font-size: 14px;
  color: var(--primary, #ffcc00);
  margin-bottom: 12px;
  letter-spacing: .02em;
}
.confirm-fields {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  margin-top: 2px;
}
.confirm-fields td {
  padding: 5px 6px;
  vertical-align: top;
  border-bottom: 1px solid rgba(255,255,255,.06);
  color: rgba(255,255,255,.85);
}
.confirm-fields td:first-child {
  width: 35%;
  color: rgba(255,255,255,.45);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  padding-right: 10px;
  white-space: nowrap;
}
.confirm-fields tr:last-child td { border-bottom: none; }

/* ===========================
   Form panel toggle
   =========================== */
.card-header { display: flex; justify-content: space-between; align-items: center; }
#formPanel.collapsed { display: none; }

/* ===== TOASTS ===== */
.toast-container { position: fixed; top: 20px; right: 20px; z-index: 9999; }
.toast {
  background: var(--toast-bg);
  color: #fff;
  padding: 10px 16px;
  border-radius: 6px;
  margin-top: 8px;
  opacity: 0;
  transform: translateY(-20px);
  transition: all 0.3s ease;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.success { background: var(--toast-success); }
.toast.error { background: var(--toast-error); }

/* ===== ROW HIGHLIGHT ===== */
tr.updated {
  background-color: var(--row-updated) !important;
  transition: background-color 1.5s ease;
}

/* ===== SPINNER ===== */
.spinner {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0,0,0,0.7);
  color: white;
  padding: 20px 30px;
  border-radius: 8px;
  font-size: 16px;
  z-index: 10000;
}
.hidden { display: none !important; }

/* ===========================
   Logo Responsive Mejorado
   =========================== */
.logo {
  display: block;
  width: 15vw;          /* ðŸ”¹ Escala con el ancho de la pantalla */
  max-width: 220px;     /* ðŸ”¹ No mÃ¡s grande que esto */
  min-width: 120px;     /* ðŸ”¹ No mÃ¡s chico que esto */
  height: auto;
  object-fit: contain;
}

@media (max-width: 900px) {
  .logo {
    width: 20vw;        /* ðŸ”¹ Tablet */
    max-width: 180px;
    min-width: 100px;
  }
}

@media (max-width: 600px) {
  .logo {
    width: 30vw;        /* ðŸ”¹ Mobile */
    max-width: 150px;
    min-width: 90px;
  }
}
.app .card:first-of-type {
  margin-top: 10px; /* antes era 20px */
}

/* ===========================
   Panel Toggle Button
   =========================== */
.panel-toggle {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 18px;
  font-size: 16px;
  font-weight: 700;
  background: var(--card);
  color: var(--text);
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.2s ease;
}

.panel-toggle:hover {
  background: color-mix(in oklab, var(--card), var(--text) 5%);
}

.panel-toggle .icon {
  font-size: 18px;
  font-weight: bold;
}

/* Overlay que bloquea toda la pÃ¡gina */
#loadingOverlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.6); /* fondo semi-transparente */
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999; /* siempre encima */
  visibility: hidden; /* oculto por defecto */
}

/* Spinner elegante */
#loadingOverlay .spinner {
  border: 6px solid rgba(255,255,255,0.2);
  border-top: 6px solid #4a90e2;
  border-radius: 50%;
  width: 60px;
  height: 60px;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* ========================= */
/* TAB MENU (Dark/Light)     */
/* ========================= */
.tab-menu {
  display: flex;
  justify-content: space-around;
  align-items: center;
  background: var(--card);
  border-radius: 12px;
  margin: 10px 0 20px;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0,0,0,0.25);
}

.tab-menu button {
  flex: 1;
  padding: 14px 0;
  font-size: 15px;
  font-weight: 600;
  color: var(--muted);
  background: transparent;
  border: none;
  cursor: pointer;
  position: relative;
  transition: color 0.3s ease, background 0.3s ease;
}

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

.tab-menu button.active {
  color: var(--primary);
  background: rgba(59, 130, 246, 0.1); /* azul suave */
}

/* Línea de indicador */
.tab-menu button.active::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 25%;
  width: 50%;
  height: 3px;
  background: var(--primary);
  border-radius: 2px;
}

/* ========================= */
/* TAB CONTENTS              */
/* ========================= */
.tab-content {
  display: none;
  animation: fadeIn 0.25s ease-in-out;
}
.tab-content.active { display: block; }

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

/* ========================= */
/* Mobile friendly           */
/* ========================= */
@media (max-width: 600px) {
  .tab-menu {
    border-radius: 8px;
    font-size: 14px;
  }
  .tab-menu button {
    padding: 12px 0;
    font-size: 14px;
  }
}

/* ===== HEADER ===== */
.app-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 0 14px;
  position: relative;
  z-index: 100;
}

.logo {
  width: 60px;
  height: auto;
  flex-shrink: 0;
}

/* Tab nav fills remaining space */
.app-header .tab-menu { flex: 1; }

/* ===== USER INFO ===== */
.user-info {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.user-name {
  font-size: 13px;
  color: var(--muted);
  white-space: nowrap;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.btn-logout {
  padding: 6px 14px;
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s, border-color 0.2s;
}
.btn-logout:hover {
  background: rgba(255,255,255,0.08);
  border-color: rgba(255,255,255,0.30);
}

/* ===== MENU TOGGLE (hamburger) ===== */
.menu-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 6px;
  width: 44px;
  height: 44px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 12px;
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
  transition: background 0.2s, border-color 0.2s;
}
.menu-toggle:hover  { background: rgba(255,255,255,0.10); border-color: rgba(255,255,255,0.22); }
.menu-toggle:active { background: rgba(255,255,255,0.16); }

.hb-bar {
  display: block;
  width: 20px;
  height: 2.5px;
  background: var(--text);
  border-radius: 2px;
  transition: transform 0.28s ease, opacity 0.2s ease, width 0.2s ease;
  transform-origin: center;
}
.menu-toggle.open .hb-bar:nth-child(2) { width: 14px; }
/* Animate to ✕ when open */
.menu-toggle.open .hb-bar:nth-child(1) { transform: translateY(8.5px) rotate(45deg); }
.menu-toggle.open .hb-bar:nth-child(2) { opacity: 0; }
.menu-toggle.open .hb-bar:nth-child(3) { transform: translateY(-8.5px) rotate(-45deg); }

/* ===== NAV OVERLAY (backdrop) ===== */
.nav-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 150;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}
.nav-overlay.open { display: block; }

/* ===== NAV MENU ===== */
.tab-menu {
  display: flex;
  gap: 12px;
  background: transparent;
}

.tab-menu button {
  padding: 8px 14px;
  border: none;
  background: transparent;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  transition: color 0.3s ease, border-bottom 0.3s ease;
}

.tab-menu button:hover { color: var(--text); }
.tab-menu button.active {
  color: var(--primary);
  border-bottom: 2px solid var(--primary);
}

/* ===== MOBILE ===== */
@media (max-width: 768px) {
  /* Sticky header — z-index > nav-overlay (150) so the drawer
     (inside this stacking context) paints above the backdrop */
  .app-header {
    position: sticky;
    top: 0;
    background: #111;
    padding: 8px 0;
    z-index: 300;
    gap: 10px;
    border-bottom: 1px solid rgba(255,255,255,0.07);
  }

  .logo { width: 44px; }

  /* Hide full name on mobile — space is tight */
  .user-name { display: none; }

  .btn-logout {
    padding: 5px 10px;
    font-size: 12px;
  }

  .menu-toggle { display: flex; }

  /* ── Mobile nav drawer ── */
  .tab-menu {
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 68px;
    left: 0;
    right: 0;
    z-index: 310;             /* above nav-overlay (150) directly */
    background: #0d0d0d;      /* solid — no backdrop-filter to avoid blur artefacts */
    border-bottom: 1px solid rgba(255,255,255,0.1);
    box-shadow: 0 16px 48px rgba(0,0,0,0.8);
    border-radius: 0 0 24px 24px;
    padding: 10px 16px 24px;
    gap: 4px;
    transform: translateY(calc(-100% - 68px));
    transition: transform 0.32s cubic-bezier(0.4, 0, 0.2, 1);
    margin: 0;
    overflow: hidden;
  }

  .tab-menu.open {
    transform: translateY(0);
  }

  /* Large, tappable buttons */
  .tab-menu button {
    width: 100%;
    padding: 18px 20px;
    text-align: left;
    font-size: 17px;
    font-weight: 600;
    color: rgba(255,255,255,0.6);
    background: transparent;
    border: none;
    border-radius: 14px;
    cursor: pointer;
    position: relative;
    transition: background 0.15s, color 0.15s;
  }

  /* Remove desktop underline indicator */
  .tab-menu button::after { display: none; }

  .tab-menu button:active {
    background: rgba(255,255,255,0.06);
  }

  .tab-menu button.active {
    color: var(--primary);
    background: rgba(255,204,0,0.1);
    border-bottom: none;
  }

  /* Yellow left-edge accent for active tab */
  .tab-menu button.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 10px;
    bottom: 10px;
    width: 3px;
    background: var(--primary);
    border-radius: 0 2px 2px 0;
  }

}

/* ===========================
   Búsqueda global — Resumenes
   =========================== */
.summary-search-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(0,0,0,0.28);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0 14px;
  margin-bottom: 14px;
  transition: border-color 0.2s;
}
.summary-search-bar:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(255,204,0,0.15);
}
.summary-search-icon { font-size: 16px; flex-shrink: 0; opacity: 0.6; }
#summarySearch,
#invSearch {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font-size: 15px;
  font-family: 'Poppins', sans-serif;
  font-weight: 500;
  padding: 12px 0;
  min-width: 0;
}
#summarySearch::placeholder,
#invSearch::placeholder { color: var(--muted); opacity: 0.7; }
#summarySearch::-webkit-search-cancel-button,
#invSearch::-webkit-search-cancel-button { cursor: pointer; opacity: 0.6; }

/* ===========================
   Filtros combinados — Resumenes
   =========================== */
.summary-filters {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 10px;
}
.summary-type-radios {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  flex: 1;
  min-width: 0;
}
.summary-type-radios label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
}
.summary-user-select {
  background: rgba(0,0,0,0.28);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-size: 14px;
  font-family: 'Poppins', sans-serif;
  font-weight: 500;
  padding: 8px 12px;
  min-width: 160px;
  max-width: 220px;
  cursor: pointer;
  transition: border-color 0.2s;
}
.summary-user-select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(255,204,0,0.15);
}
@media (max-width: 600px) {
  .summary-filters { flex-direction: column; align-items: stretch; gap: 10px; }
  .summary-type-radios { gap: 8px; }
  .summary-type-radios label {
    flex: 1;
    justify-content: center;
    padding: 10px 12px;
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 14px;
  }
  .summary-user-select { max-width: 100%; min-width: 0; width: 100%; }
}

/* Panel de resumen en tema oscuro */
.summary-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;

  margin: 15px 0;
  padding: 12px 15px;
  border-radius: 10px;

  background: #13161c;           /* oscuro */
  border: 1px solid #2a2f39;     /* borde sutil */
  color: #e9eef5;                /* texto claro */
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

/* Título + monto destacado */
.highlight-total .label {
  font-size: 1.05rem;
  font-weight: 600;
  opacity: .95;
}

.highlight-total .amount {
  font-size: 1.9rem;
  font-weight: 800;
  margin-top: 4px;
  color: #4da3ff;               /* acento */
  text-shadow: 0 1px 2px rgba(0,0,0,.25);
}

.highlight-total .date-range {
  margin-top: 4px;
  font-size: .92rem;
  color: #aeb7c4;
}

/* Notas de la tabla (por si se cortan) */
#investmentsTable td[data-label="Notas"] {
  white-space: pre-wrap;
  word-break: break-word;
  max-width: 320px;
}
.balance-result {
  font-size: 1.2rem;
  font-weight: 700;
  margin-top: 8px;
  text-align: center;
  transition: color 0.3s ease;
}

/* =========================
   Resumen entendible
   ========================= */

.summary-final{
  font-size: 26px;
  font-weight: 900;
  margin-top: 12px;
}

.summary-explain{
  margin-top: 8px;
  font-size: 13px;
  line-height: 1.45;
  opacity: .9;
}

.summary-prev{
  margin-top: 8px;
  font-size: 13px;
  opacity: .85;
}

/* opcional: resaltado de pasos dentro del explain */
.summary-explain .step-label{
  opacity: .85;
}

.summary-explain .step-value{
  font-weight: 800;
}
/* =========================
   Resumen PRO (mobile first)
   ========================= */

.summary-box .balance-result {
  text-align: center;
}

/* Headline principal */
#summaryFinal {
  font-size: 22px;
  font-weight: 900;
  margin-top: 10px;
  line-height: 1.15;
}

/* Pasos */
.summary-steps{
  margin: 12px auto 0;
  padding: 0;
  max-width: 560px;
  list-style: none;
  display: grid;
  gap: 10px;
  text-align: left;
}

.summary-step{
  border: 1px solid rgba(255,255,255,.08);
  background: rgba(255,255,255,.03);
  border-radius: 12px;
  padding: 10px 12px;
}

.step-title{
  font-weight: 800;
  margin-bottom: 6px;
}

.step-calc{
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px;
  line-height: 1.35;
  font-size: 14px;
}

.mono{
  font-variant-numeric: tabular-nums;
}

.op{
  opacity: .7;
  font-weight: 700;
}

.strong{
  font-weight: 900;
}

.muted{
  opacity: .75;
  font-weight: 700;
}

.pos{ color: #4ddc7f; }
.neg{ color: #ff4d4d; }

/* Desktop refinamiento */
@media (min-width: 900px){
  #summaryFinal{ font-size: 26px; }
  .step-calc{ font-size: 15px; }
}
/* ===== Resumen PRO (sin 1,2,3) ===== */
.summary-cards{
  margin: 14px auto 0;
  max-width: 640px;
  display: grid;
  gap: 12px;
  text-align: left;
}

.sum-card{
  border: 1px solid rgba(255,255,255,.10);
  background: rgba(255,255,255,.03);
  border-radius: 14px;
  padding: 12px 14px;
}

.sum-title{
  font-weight: 900;
  margin-bottom: 8px;
  letter-spacing: .2px;
}

.sum-sub{
  font-size: 12px;
  opacity: .75;
  margin-top: -6px;
  margin-bottom: 10px;
}

.sum-line{
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin: 6px 0;
  flex-wrap: wrap;
}

.sum-result{
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px dashed rgba(255,255,255,.12);
}

.sum-divider{
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  opacity: .85;
  font-size: 12px;
}

.sum-divider::before,
.sum-divider::after{
  content:"";
  flex: 1;
  height: 1px;
  background: rgba(255,255,255,.10);
}

.sum-divider-strong{
  opacity: 1;
  font-weight: 800;
}

.sum-big{
  font-size: 20px;
  font-weight: 900;
  line-height: 1.15;
}

.sum-calc{
  font-size: 14px;
  opacity: .95;
  line-height: 1.35;
}

.mono{ font-variant-numeric: tabular-nums; }
.strong{ font-weight: 900; }
.muted{ opacity: .75; }

.pos{ color: #4ddc7f; }
.neg{ color: #ff4d4d; }

/* Chips (colores por concepto) */
.chip{
  font-size: 11px;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.10);
  background: rgba(255,255,255,.04);
}

.chip-in{ color:#70b7ff; }   /* ingresos */
.chip-out{ color:#ff7b7b; }  /* gastos */
.chip-net{ color:#ffd36a; }  /* resultado */

/* Mobile: más compacto */
@media (max-width: 520px){
  .sum-card{ padding: 10px 12px; border-radius: 12px; }
  .sum-big{ font-size: 18px; }
  .sum-calc{ font-size: 13px; }
  .sum-line{ gap: 6px; }
}

/* ===========================
   Summary table — cell styles
   =========================== */

/* Date */
.date-compact {
  font-size: 12px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}

/* Type chip */
.type-chip {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.2px;
  white-space: nowrap;
}
.type-chip.income  { background: rgba(77,220,127,0.14); color: #4ddc7f; border: 1px solid rgba(77,220,127,0.25); }
.type-chip.expense { background: rgba(255,90,106,0.14); color: #ff7b7b; border: 1px solid rgba(255,90,106,0.25); }

/* Username */
.user-tag {
  font-size: 12px;
  color: rgba(255,255,255,0.65);
  font-weight: 500;
}

/* Description — clamp to 2 lines */
.cell-text {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  max-width: 200px;
  font-size: 13px;
  line-height: 1.4;
  word-break: break-word;
}

/* Notes — clamp to 1 line */
.cell-notes {
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
  max-width: 140px;
  font-size: 12px;
  color: var(--muted);
  word-break: break-word;
}

/* Total BOB */
.amount-cell {
  font-weight: 700;
  font-size: 13px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* Actions column */
.actions-cell {
  white-space: nowrap;
  vertical-align: middle;
}
.actions-wrap {
  display: inline-flex;
  gap: 8px;
  align-items: center;
}

.action-icon {
  font-size: 17px;
  line-height: 1;
  display: inline-block;
  text-decoration: none;
  transition: transform 0.15s, opacity 0.15s;
  cursor: default;
}

/* Active icons */
.action-icon.has-notes,
.action-icon.has-attach {
  opacity: 1;
  cursor: pointer;
}
.action-icon.has-notes:hover,
.action-icon.has-attach:hover {
  transform: scale(1.25);
}

/* Disabled icons */
.action-icon.no-notes,
.action-icon.no-attach {
  opacity: 0.2;
  filter: grayscale(1);
  cursor: not-allowed;
}

/* Mobile: remove max-width constraints so text wraps in card layout */
@media (max-width: 600px) {
  .cell-text  { max-width: 100%; }
  .cell-notes { max-width: 100%; }
}

/* =============================================
   Edit modal (summary table) — iOS/Android ready
   ============================================= */

/* Backdrop */
#summaryEditModal,
#movEditModal,
#calTxModal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1100;
  background: rgba(0, 0, 0, 0.65);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  align-items: flex-end;
  justify-content: center;
  overscroll-behavior: contain;
}
@media (min-width: 540px) {
  #summaryEditModal,
  #movEditModal,
  #calTxModal { align-items: center; padding: 16px; }
}
#summaryEditModal.open,
#movEditModal.open,
#calTxModal.open { display: flex; }

/* calTxModal: themed border matching primary */
#calTxModal .em-box {
  border-color: rgba(255,204,0,.22);
  box-shadow: 0 -6px 40px rgba(0,0,0,.8), 0 0 0 1px rgba(255,204,0,.07);
}
@media (min-width: 540px) {
  #calTxModal .em-box {
    box-shadow: 0 20px 60px rgba(0,0,0,.75), 0 0 0 1px rgba(255,204,0,.12);
  }
}

/* calTxModal: gold accent line on header */
#calTxModal .em-header {
  position: relative;
  border-bottom: 1px solid rgba(255,255,255,.07);
  overflow: hidden;
}
#calTxModal .em-header::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--primary), var(--primary2));
}
#calTxModal .em-title {
  font-size: 16px;
  font-weight: 800;
  letter-spacing: .3px;
}

/* Box */
.em-box {
  background: #1c1c1e;
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 22px 22px 0 0;
  width: 100%;
  max-width: 600px;
  max-height: 92vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  box-shadow: 0 -6px 40px rgba(0, 0, 0, 0.8);
  padding-bottom: env(safe-area-inset-bottom, 12px);
}
@media (min-width: 540px) {
  .em-box { border-radius: 20px; box-shadow: 0 16px 56px rgba(0,0,0,0.7); padding-bottom: 0; }
}

/* Drag handle (mobile) */
.em-box::before {
  content: '';
  display: block;
  width: 36px;
  height: 4px;
  background: rgba(255, 255, 255, 0.18);
  border-radius: 2px;
  margin: 10px auto 0;
}
@media (min-width: 540px) { .em-box::before { display: none; } }

/* Header */
.em-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px 0;
}
.em-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--primary, #ffcc00);
  letter-spacing: 0.03em;
}
.em-close {
  background: rgba(255, 255, 255, 0.08);
  border: none;
  color: #bbb;
  font-size: 14px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: manipulation;
  transition: background 0.15s, color 0.15s;
  flex-shrink: 0;
}
.em-close:hover { background: rgba(255, 255, 255, 0.16); color: #fff; }

/* Form */
#summaryEditForm,
#movEditForm,
#invPayForm,
#ctxForm {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 16px 20px 12px;
}

/* Field */
.em-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.em-lbl {
  font-size: 11px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.45);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  user-select: none;
}
.em-opt {
  font-style: normal;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.28);
  text-transform: none;
  letter-spacing: 0;
  font-size: 10px;
  margin-left: 4px;
}

/* Inputs */
.em-input {
  -webkit-appearance: none;
  appearance: none;
  background: rgba(255, 255, 255, 0.06);
  border: 1.5px solid rgba(255, 255, 255, 0.10);
  border-radius: 11px;
  color: #f0f0f0;
  font-size: 15px;
  font-family: inherit;
  padding: 11px 14px;
  width: 100%;
  min-height: 44px;
  box-sizing: border-box;
  outline: none;
  touch-action: manipulation;
  transition: border-color 0.15s, background 0.15s;
}
.em-input:focus {
  border-color: var(--primary, #ffcc00);
  background: rgba(255, 255, 255, 0.09);
}
.em-input::placeholder { color: rgba(255, 255, 255, 0.22); }
.em-textarea { resize: vertical; min-height: 68px; }
.em-input[readonly] { cursor: default; opacity: 0.75; }

/* Date picker — dark theme */
input[type="date"].em-input { color-scheme: dark; }
input[type="date"].em-input::-webkit-calendar-picker-indicator {
  filter: invert(0.75);
  cursor: pointer;
  border-radius: 4px;
  padding: 2px;
}
input[type="date"].em-input::-webkit-calendar-picker-indicator:hover {
  filter: invert(1);
  background: rgba(255, 255, 255, 0.1);
}

/* 2-col row (Fecha + Tipo) */
.em-row2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
@media (max-width: 540px) { .em-row2 { grid-template-columns: 1fr; } }

/* Type toggle */
.em-type-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.em-type-btn {
  -webkit-appearance: none;
  appearance: none;
  border: 1.5px solid rgba(255, 255, 255, 0.12);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.04);
  color: rgba(255, 255, 255, 0.45);
  font-size: 13px;
  font-family: inherit;
  font-weight: 600;
  padding: 10px 6px;
  min-height: 44px;
  cursor: pointer;
  touch-action: manipulation;
  transition: all 0.18s;
  white-space: nowrap;
}
.em-type-btn.active.em-ingreso {
  background: rgba(34, 197, 94, 0.15);
  border-color: #22c55e;
  color: #4ade80;
}
.em-type-btn.active.em-egreso {
  background: rgba(220, 38, 38, 0.15);
  border-color: #ef4444;
  color: #f87171;
}

/* Price row: Cant × Precio = Total */
.em-prices {
  display: grid;
  grid-template-columns: 1fr auto 1.2fr auto 1.1fr;
  gap: 8px;
  align-items: end;
}
.em-price-op {
  font-size: 17px;
  color: rgba(255, 255, 255, 0.25);
  padding-bottom: 12px;
  text-align: center;
  user-select: none;
  line-height: 1;
}
.em-num { text-align: center; }
.em-total {
  font-weight: 700;
  color: var(--primary, #ffcc00);
  font-size: 16px;
  text-align: center;
  border-color: rgba(255, 204, 0, 0.25);
}
@media (max-width: 440px) {
  .em-prices { grid-template-columns: 1fr 1fr; gap: 10px; }
  .em-price-op { display: none; }
  .em-prices .em-field:last-child { grid-column: 1 / -1; }
}

/* File drop zone */
.em-drop {
  position: relative;
  border: 1.5px dashed rgba(255, 255, 255, 0.18);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  min-height: 76px;
  cursor: pointer;
  overflow: hidden;
  transition: border-color 0.2s, background 0.2s;
  touch-action: manipulation;
}
.em-drop:active { background: rgba(255, 255, 255, 0.06); border-color: rgba(255,255,255,0.3); }
.em-file-input {
  position: absolute;
  inset: 0;
  opacity: 0;
  width: 100%;
  height: 100%;
  cursor: pointer;
  z-index: 2;
}
.em-drop-idle {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 14px 12px;
  pointer-events: none;
  text-align: center;
}
.em-drop-done {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  padding: 14px 12px;
  position: relative;
  z-index: 3;  /* above file input */
}
.em-drop-icon { font-size: 22px; line-height: 1; }
.em-drop-txt  { font-size: 13px; font-weight: 600; color: rgba(255, 255, 255, 0.6); }
.em-drop-hint { font-size: 11px; color: rgba(255, 255, 255, 0.28); }
.em-drop-name { font-size: 13px; color: #e0e0e0; flex: 1; word-break: break-all; min-width: 0; }
.em-drop-clear {
  background: rgba(255, 255, 255, 0.10);
  border: none;
  color: #bbb;
  border-radius: 50%;
  width: 26px;
  height: 26px;
  font-size: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  touch-action: manipulation;
  position: relative;
  z-index: 4;
  transition: background 0.15s;
}
.em-drop-clear:hover { background: rgba(255, 255, 255, 0.2); color: #fff; }
.em-receipt-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: rgba(255, 204, 0, 0.75);
  text-decoration: none;
  margin-top: 5px;
  touch-action: manipulation;
}
.em-receipt-link:hover { color: #ffcc00; text-decoration: underline; }

/* Actions */
.em-actions {
  display: flex;
  gap: 10px;
  padding-top: 4px;
}
.em-actions .ghost   { flex: 1; min-height: 46px; touch-action: manipulation; }
.em-actions .primary { flex: 2; min-height: 46px; touch-action: manipulation; }

/* action icon buttons (edit / delete in summary) */
.sum-edit-btn,
.sum-del-btn {
  background: none;
  border: none;
  padding: 0;
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
  transition: transform 0.15s, opacity 0.15s;
  opacity: 0.75;
}
.sum-edit-btn:hover { opacity: 1; transform: scale(1.25); }
.sum-del-btn        { opacity: 0.6; }
.sum-del-btn:hover  { opacity: 1; transform: scale(1.25); }

/* ===========================
   Create form (expenseForm) — uses .em-* classes
   =========================== */
#expenseForm {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 12px 4px 4px;
}

/* ================================================
   Movimientos edit modal — shares all .em-* styles
   ================================================ */
#movEditModal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.65);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  align-items: flex-end;
  justify-content: center;
  overscroll-behavior: contain;
}
@media (min-width: 540px) {
  #movEditModal { align-items: center; padding: 16px; }
}
#movEditModal.open { display: flex; }

/* 3-option type toggle */
.em-type-toggle--3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
}
/* 4-option type toggle (2×2 grid) */
.em-type-toggle--4 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

/* Disabled type buttons */
.em-type-btn:disabled {
  opacity: 0.30;
  cursor: not-allowed;
}
.em-type-btn.active:disabled {
  opacity: 0.65;
}

/* Active colors for inversión types */
.em-type-btn.active.em-inversion {
  background: rgba(99, 102, 241, 0.15);
  border-color: #818cf8;
  color: #a5b4fc;
}
.em-type-btn.active.em-pago-inv {
  background: rgba(14, 165, 233, 0.15);
  border-color: #38bdf8;
  color: #7dd3fc;
}

/* Notes modal */
#notesModal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(4px);
  align-items: center;
  justify-content: center;
}
#notesModal.open {
  display: flex;
}
#notesModal .notes-modal-box {
  background: rgba(30, 30, 30, 0.92);
  backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  padding: 24px 28px;
  max-width: 420px;
  width: 90%;
  box-shadow: 0 8px 32px rgba(0,0,0,0.6);
  position: relative;
}
#notesModal .notes-modal-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted, #aaa);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 10px;
}
#notesModal .notes-modal-body {
  font-size: 15px;
  color: #eee;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}
#notesModal .notes-modal-close {
  position: absolute;
  top: 10px;
  right: 14px;
  background: none;
  border: none;
  color: var(--muted, #aaa);
  font-size: 20px;
  cursor: pointer;
  line-height: 1;
  padding: 2px 6px;
  border-radius: 6px;
  transition: color 0.15s, background 0.15s;
}
#notesModal .notes-modal-close:hover {
  color: #fff;
  background: rgba(255,255,255,0.1);
}

/* ===========================
   Inversión — KPI variant colors
   =========================== */
.rs-kpi--inv::after         { background: linear-gradient(90deg, #a78bfa, #7c3aed); }
.rs-kpi--inv-socios::after  { background: linear-gradient(90deg, #38bdf8, #0284c7); }
.rs-kpi--inv-cov::after     { background: linear-gradient(90deg, #fb923c, #ea580c); }
.rs-kpi--inv-avail::after   { background: linear-gradient(90deg, #34d399, #059669); }
.rs-kpi--inv .rs-kpi-value         { color: #c4b5fd; }
.rs-kpi--inv-socios .rs-kpi-value  { color: #7dd3fc; }
.rs-kpi--inv-cov .rs-kpi-value     { color: #fdba74; }
.rs-kpi--inv-avail .rs-kpi-value   { color: #6ee7b7; }

/* ===========================
   Partner Cards
   =========================== */
.inv-partners-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}

.inv-partner-card {
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.09);
  border-radius: 16px;
  padding: 16px;
  display: flex;
  flex-direction: column;
}

.inv-partner-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.inv-partner-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary2));
  color: #000;
  font-weight: 900;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.inv-partner-name     { font-weight: 800; font-size: 14px; }
.inv-partner-username { font-size: 11px; opacity: .5; }

.inv-partner-pct {
  margin-left: auto;
  font-size: 24px;
  font-weight: 900;
  color: var(--primary);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.inv-progress-bar {
  background: rgba(255,255,255,.08);
  border-radius: 999px;
  height: 6px;
  margin-bottom: 14px;
  overflow: hidden;
}
.inv-progress-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--primary), var(--primary2));
  transition: width 0.6s ease;
}

.inv-partner-rows { flex: 1; }

.inv-pay-btn {
  width: 100%;
  margin-top: 14px;
}

@media (max-width: 540px) {
  .inv-partners-grid { grid-template-columns: 1fr; }
}

/* ===========================
   Investment Payment Notice
   =========================== */
.inv-pay-notice {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  background: rgba(255, 200, 50, 0.08);
  border: 1px solid rgba(255, 200, 50, 0.25);
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 12px;
  font-size: 0.82rem;
  color: var(--text-muted, #aaa);
  line-height: 1.45;
}
.inv-pay-notice-icon { font-size: 1rem; flex-shrink: 0; margin-top: 1px; }

/* ===========================
   Investment Status Chips
   =========================== */
.inv-status-chip {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: .02em;
}
.inv-status--pending {
  background: rgba(255, 180, 50, 0.15);
  color: #ffd36a;
  border: 1px solid rgba(255, 180, 50, 0.3);
}
.inv-status--confirmed {
  background: rgba(80, 200, 120, 0.15);
  color: #6be89b;
  border: 1px solid rgba(80, 200, 120, 0.3);
}
.inv-status--transaction {
  background: rgba(100, 140, 255, 0.15);
  color: #8ca8ff;
  border: 1px solid rgba(100, 140, 255, 0.3);
}
.inv-confirmed-by {
  font-size: 0.72rem;
  color: var(--text-muted, #888);
  margin-top: 2px;
}

/* ===========================
   Investment Confirm Button
   =========================== */
.inv-confirm-btn {
  display: inline-block;
  padding: 5px 12px;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid rgba(80, 200, 120, 0.4);
  background: rgba(80, 200, 120, 0.12);
  color: #6be89b;
  transition: background .15s, opacity .15s;
  margin-left: 6px;
}
.inv-confirm-btn:hover:not([disabled]) {
  background: rgba(80, 200, 120, 0.25);
}
.inv-confirm-btn[disabled] {
  opacity: 0.35;
  cursor: not-allowed;
  color: var(--text-muted, #888);
  border-color: rgba(255,255,255,.12);
  background: rgba(255,255,255,.05);
}
.inv-row-pending td {
  background: rgba(255, 180, 50, 0.04);
}

/* ===========================
   Investment Table Controls
   =========================== */
.inv-table-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}
.inv-page-size-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  color: var(--text-muted, #aaa);
}
.inv-page-size-wrap select {
  padding: 3px 8px;
  border-radius: 7px;
  background: rgba(255,255,255,.07);
  border: 1px solid rgba(255,255,255,.13);
  color: inherit;
  font-size: 0.82rem;
  cursor: pointer;
  width: auto !important;
  max-width: unset !important;
}
.inv-pagination {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}
.inv-pag-btn {
  min-width: 32px;
  height: 30px;
  padding: 0 8px;
  border-radius: 7px;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.06);
  color: inherit;
  font-size: 0.8rem;
  cursor: pointer;
  transition: background .15s;
}
.inv-pag-btn:hover:not([disabled]):not(.active) {
  background: rgba(255,255,255,.12);
}
.inv-pag-btn.active {
  background: rgba(99,102,241,.35);
  border-color: rgba(99,102,241,.5);
  color: #c7d2fe;
  font-weight: 700;
}
.inv-pag-btn[disabled] {
  opacity: .3;
  cursor: not-allowed;
}
.inv-pag-info {
  font-size: 0.78rem;
  color: var(--text-muted, #aaa);
  margin-left: 4px;
  white-space: nowrap;
}
@media (max-width: 480px) {
  .inv-table-controls { flex-direction: column; align-items: flex-start; }
  .inv-pagination { width: 100%; justify-content: center; }
}

/* ===========================
   Investment Payment Modal
   =========================== */
#invPayModal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0,0,0,0.65);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  align-items: flex-end;
  justify-content: center;
  overscroll-behavior: contain;
}
@media (min-width: 540px) {
  #invPayModal { align-items: center; padding: 16px; }
}
#invPayModal.open { display: flex; }

/* ===========================
   Resumenes — Dashboard Redesign
   =========================== */

/* KPI Strip (3 cards in a row) */
.rs-kpi-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 12px;
}

.rs-kpi {
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.09);
  border-radius: 14px;
  padding: 14px 10px 12px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.rs-kpi::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  border-radius: 14px 14px 0 0;
}
.rs-kpi--in::after   { background: linear-gradient(90deg, #4ddc7f, #22c55e); }
.rs-kpi--out::after  { background: linear-gradient(90deg, #ff5a6a, #ef4444); }
.rs-kpi--cash::after { background: linear-gradient(90deg, var(--primary), var(--primary2)); }

.rs-kpi-label {
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .6px;
  opacity: .7;
}
.rs-kpi-sub {
  font-size: 10px;
  opacity: .45;
  margin-bottom: 8px;
}
.rs-kpi-value {
  font-size: 20px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
  margin-bottom: 2px;
}
.rs-kpi--in .rs-kpi-value   { color: #4ddc7f; }
.rs-kpi--out .rs-kpi-value  { color: #ff5a6a; }
.rs-kpi--cash .rs-kpi-value { color: var(--primary); }
.rs-kpi-unit {
  font-size: 10px;
  opacity: .55;
}

/* Summary detail grid (2 cards) */
.rs-summary-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 12px;
}

.rs-card {
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 14px;
  padding: 14px 14px 10px;
  border-left: 3px solid transparent;
}
.rs-card--period { border-left-color: rgba(77,220,127,.5); }
.rs-card--prev   { border-left-color: rgba(255,211,106,.4); }

.rs-card-header {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 12px;
}
.rs-card-icon  { font-size: 18px; line-height: 1; flex-shrink: 0; }
.rs-card-title { font-size: 13px; font-weight: 800; line-height: 1.2; }
.rs-card-range { font-size: 11px; opacity: .5; margin-top: 2px; }

.rs-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 5px 0;
  font-size: 13px;
  border-bottom: 1px solid rgba(255,255,255,.05);
}
.rs-row:last-child { border-bottom: none; }
.rs-row--result {
  margin-top: 6px;
  padding-top: 8px;
  border-top: 1px dashed rgba(255,255,255,.15) !important;
  border-bottom: none !important;
  font-weight: 800;
  font-size: 14px;
}
.rs-label { opacity: .6; font-size: 12px; }
.rs-val   { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* Small label above the table */
.rs-range-label {
  font-size: 12px;
  opacity: .5;
  margin: 8px 0 4px;
}

/* Mobile layout */
@media (max-width: 540px) {
  .rs-kpi-row {
    grid-template-columns: 1fr 1fr;
  }
  .rs-kpi--cash {
    grid-column: 1 / -1;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    text-align: left;
    gap: 12px;
  }
  .rs-kpi--cash .rs-kpi-label,
  .rs-kpi--cash .rs-kpi-sub { display: inline; margin: 0; }
  .rs-kpi--cash .rs-kpi-value { font-size: 26px; }
  .rs-kpi--cash .rs-kpi-unit  { font-size: 12px; }
  .rs-kpi-value { font-size: 17px; }
  .rs-summary-grid { grid-template-columns: 1fr; }
}

/* ===========================
   Resumenes Sub-tabs
   =========================== */
.rs-subtabs {
  display: flex;
  gap: 6px;
  margin-bottom: 14px;
  border-bottom: 2px solid rgba(255,255,255,.08);
  padding-bottom: 0;
}

.rs-subtab-btn {
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  color: rgba(255,255,255,.5);
  font-size: 13px;
  font-weight: 700;
  padding: 8px 14px 10px;
  cursor: pointer;
  margin-bottom: -2px;
  border-radius: 0;
  transition: color .15s, border-color .15s;
  white-space: nowrap;
}
.rs-subtab-btn:hover {
  color: rgba(255,255,255,.85);
}
.rs-subtab-btn.active {
  color: #fff;
  border-bottom-color: var(--primary);
}

.rs-subtab-content {
  display: none;
}
.rs-subtab-content.active {
  display: block;
}

/* ===========================
   Hero: Efectivo Disponible
   =========================== */
.rs-hero {
  background: linear-gradient(135deg, rgba(255,211,106,.12) 0%, rgba(255,179,20,.06) 100%);
  border: 1px solid rgba(255,211,106,.22);
  border-radius: 18px;
  padding: 20px 20px 18px;
  text-align: center;
  margin-bottom: 10px;
  position: relative;
  overflow: hidden;
}
.rs-hero::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--primary), var(--primary2));
  border-radius: 18px 18px 0 0;
}
.rs-hero-eyebrow {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .7px;
  opacity: .55;
  margin-bottom: 10px;
}
.rs-hero-amount {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 6px;
  margin-bottom: 6px;
}
.rs-hero-value {
  font-size: 36px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.5px;
  color: var(--primary);
  line-height: 1;
}
.rs-hero-value.pos { color: var(--primary); }
.rs-hero-value.neg { color: #ff5a6a; }
.rs-hero-currency {
  font-size: 16px;
  font-weight: 700;
  opacity: .5;
  align-self: flex-end;
  margin-bottom: 3px;
}
.rs-hero-sub {
  font-size: 11px;
  opacity: .4;
}

/* ===========================
   KPI row 2-col variant
   =========================== */
.rs-kpi-row--2 {
  grid-template-columns: 1fr 1fr;
}

/* ===========================
   Calendario mensual
   =========================== */
.rs-cal-wrap {
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 16px;
  padding: 14px 12px 0;
  margin-bottom: 10px;
  overflow: hidden;
}

.rs-cal-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  gap: 8px;
}

.rs-cal-nav-center {
  flex: 1;
  text-align: center;
}

.rs-cal-nav-btn {
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.1);
  color: rgba(255,255,255,.85);
  font-size: 22px;
  line-height: 1;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s, transform .1s;
  flex-shrink: 0;
}
.rs-cal-nav-btn:active {
  transform: scale(.92);
  background: rgba(255,255,255,.18);
}
@media (hover: hover) {
  .rs-cal-nav-btn:hover { background: rgba(255,255,255,.15); }
}

.rs-cal-title {
  font-size: 15px;
  font-weight: 800;
  letter-spacing: .2px;
}

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

.rs-cal-dow {
  font-size: 10px;
  font-weight: 700;
  text-align: center;
  opacity: .35;
  text-transform: uppercase;
  padding: 2px 0 6px;
  letter-spacing: .4px;
}

.rs-cal-cell {
  background: rgba(255,255,255,.03);
  border: 1px solid rgba(255,255,255,.06);
  border-radius: 8px;
  padding: 5px 3px 6px;
  min-height: 58px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  overflow: hidden;
  transition: background .18s, border-color .18s, transform .1s;
}
.rs-cal-cell[data-date] { cursor: pointer; }
.rs-cal-cell[data-date]:active { transform: scale(.92); }
@media (hover: hover) {
  .rs-cal-cell[data-date]:hover                { background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.18); }
  .rs-cal-cell--inc[data-date]:hover           { background: rgba(77,220,127,.18);  border-color: rgba(77,220,127,.35); }
  .rs-cal-cell--exp[data-date]:hover           { background: rgba(255,90,106,.17);  border-color: rgba(255,90,106,.32); }
  .rs-cal-cell--both-pos[data-date]:hover      { background: rgba(77,220,127,.15);  border-color: rgba(77,220,127,.3); }
  .rs-cal-cell--both-neg[data-date]:hover      { background: rgba(255,90,106,.14);  border-color: rgba(255,90,106,.28); }
  .rs-cal-cell--today[data-date]:hover         { background: rgba(255,211,106,.14) !important; }
}

.rs-cal-cell--empty {
  background: none;
  border-color: transparent;
}

/* Day tinting */
.rs-cal-cell--inc {
  background: rgba(77,220,127,.10);
  border-color: rgba(77,220,127,.22);
}
.rs-cal-cell--exp {
  background: rgba(255,90,106,.09);
  border-color: rgba(255,90,106,.20);
}
.rs-cal-cell--both-pos {
  background: rgba(77,220,127,.08);
  border-color: rgba(77,220,127,.18);
}
.rs-cal-cell--both-neg {
  background: rgba(255,90,106,.08);
  border-color: rgba(255,90,106,.18);
}
.rs-cal-cell--today {
  border-color: rgba(255,211,106,.55) !important;
  background: rgba(255,211,106,.08) !important;
  box-shadow: 0 0 0 1px rgba(255,211,106,.2);
}
.rs-cal-cell--future {
  opacity: .55;
}

.rs-cal-dn {
  font-size: 12px;
  font-weight: 700;
  opacity: .55;
  line-height: 1;
  margin-bottom: 1px;
}
.rs-cal-dn--today {
  color: var(--primary);
  opacity: 1;
  font-size: 13px;
}

.rs-cal-inc {
  font-size: 9.5px;
  font-weight: 800;
  color: #4ddc7f;
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
}
.rs-cal-exp {
  font-size: 9.5px;
  font-weight: 800;
  color: #ff5a6a;
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
}

/* Calendar footer: month totals */
.rs-cal-footer {
  display: flex;
  align-items: stretch;
  border-top: 1px solid rgba(255,255,255,.08);
  margin: 10px -12px 0;
}
.rs-cal-foot-item {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 10px;
}
.rs-cal-foot-item--inc .rs-cal-foot-icon { color: #4ddc7f; }
.rs-cal-foot-item--exp .rs-cal-foot-icon { color: #ff5a6a; }
.rs-cal-foot-item--net { justify-content: center; }
.rs-cal-foot-item--net .rs-cal-foot-icon { color: var(--primary); }
.rs-cal-foot-item--inc { border-radius: 0 0 0 16px; }
.rs-cal-foot-item--exp {
  justify-content: flex-end;
  border-radius: 0 0 16px 0;
}
.rs-cal-foot-item--exp > * { text-align: right; }
.rs-cal-foot-icon {
  font-size: 16px;
  font-weight: 900;
  flex-shrink: 0;
}
.rs-cal-foot-lbl {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  opacity: .45;
}
.rs-cal-foot-val {
  font-size: 13px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.rs-cal-foot-item--inc .rs-cal-foot-val { color: #4ddc7f; }
.rs-cal-foot-item--exp .rs-cal-foot-val { color: #ff5a6a; }
.rs-cal-foot-item--net.pos .rs-cal-foot-val { color: #4ddc7f; }
.rs-cal-foot-item--net.neg .rs-cal-foot-val { color: #ff5a6a; }
.rs-cal-foot-divider {
  width: 1px;
  background: rgba(255,255,255,.08);
  margin: 8px 0;
}
.rs-cal-foot-empty {
  flex: 1;
  text-align: center;
  padding: 14px;
  font-size: 12px;
  opacity: .35;
}

@media (max-width: 540px) {
  .rs-hero-value { font-size: 30px; }
  .rs-cal-cell   { min-height: 52px; padding: 4px 2px 5px; }
  .rs-cal-dn     { font-size: 11px; }
  .rs-cal-inc,
  .rs-cal-exp    { font-size: 9px; }
  .rs-cal-foot-val { font-size: 12px; }
  .rs-cal-foot-item { padding: 10px 8px; gap: 6px; }
}

/* ===========================
   Calendar day detail modal
   =========================== */
.cal-day-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1050;
  background: rgba(0,0,0,.6);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  align-items: flex-end;
  justify-content: center;
}
@media (min-width: 540px) {
  .cal-day-modal { align-items: center; padding: 20px; }
}
.cal-day-modal.open {
  display: flex;
  animation: calModalIn .18s ease;
}
@keyframes calModalIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.cal-day-modal-box {
  background: #1c1c1e;
  border: 1px solid rgba(255,204,0,.20);
  border-radius: 24px 24px 0 0;
  width: 100%;
  max-width: 480px;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: calBoxIn .26s cubic-bezier(.34,1.15,.64,1);
  box-shadow: 0 -10px 50px rgba(0,0,0,.75), 0 0 0 1px rgba(255,204,0,.08);
}
@media (min-width: 540px) {
  .cal-day-modal-box { border-radius: 20px; max-height: 76vh; }
}
@keyframes calBoxIn {
  from { transform: translateY(32px) scale(.97); opacity: 0; }
  to   { transform: translateY(0)    scale(1);   opacity: 1; }
}

/* Drag handle on mobile */
.cal-day-modal-box::before {
  content: '';
  display: block;
  width: 40px;
  height: 4px;
  background: rgba(255,255,255,.16);
  border-radius: 2px;
  margin: 12px auto 4px;
  flex-shrink: 0;
}
@media (min-width: 540px) { .cal-day-modal-box::before { display: none; } }

.cal-day-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 18px 14px;
  border-bottom: 1px solid rgba(255,255,255,.07);
  flex-shrink: 0;
  position: relative;
}
.cal-day-modal-header::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--primary), var(--primary2));
  border-radius: 24px 24px 0 0;
}
.cal-day-modal-title {
  font-size: 16px;
  font-weight: 800;
  letter-spacing: .2px;
  color: var(--primary);
}
.cal-day-modal-close {
  background: rgba(255,255,255,.07);
  border: 1px solid rgba(255,255,255,.10);
  color: rgba(255,255,255,.55);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s, color .15s;
  flex-shrink: 0;
}
.cal-day-modal-close:hover { background: rgba(255,255,255,.14); color: #fff; }

.cal-day-modal-body {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 4px 18px 12px;
  flex: 1;
}

/* Footer: add-transaction button */
.cal-day-modal-footer {
  padding: 12px 18px;
  padding-bottom: max(18px, env(safe-area-inset-bottom, 18px));
  border-top: 1px solid rgba(255,255,255,.07);
  flex-shrink: 0;
}
@media (min-width: 540px) { .cal-day-modal-footer { padding-bottom: 16px; } }

.cal-day-add-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 15px;
  border-radius: 14px;
  border: none;
  background: linear-gradient(135deg, var(--primary), var(--primary2));
  color: #111;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: .2px;
  cursor: pointer;
  transition: opacity .15s, transform .1s;
  touch-action: manipulation;
}
.cal-day-add-btn:active { transform: scale(.97); opacity: .88; }
.cal-day-add-icon { font-size: 17px; }

/* ── Accordion sections ── */
.cal-day-acc {
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.cal-day-acc:last-of-type { border-bottom: none; }

.cal-day-acc-hd {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0;
  background: none;
  border: none;
  color: inherit;
  cursor: pointer;
  gap: 8px;
  text-align: left;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.cal-day-acc-left {
  display: flex;
  align-items: center;
  gap: 10px;
}
.cal-day-acc-arrow {
  font-size: 14px;
  font-weight: 900;
  width: 26px;
  height: 26px;
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.cal-day-acc-arrow.inc { background: rgba(77,220,127,.18); color: #4ddc7f; }
.cal-day-acc-arrow.exp { background: rgba(255,90,106,.18);  color: #ff5a6a; }
.cal-day-acc-title {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: .1px;
}
.cal-day-acc-badge {
  font-size: 10px;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 20px;
  line-height: 1.5;
}
.cal-day-acc-badge.inc { background: rgba(77,220,127,.15); color: #4ddc7f; }
.cal-day-acc-badge.exp { background: rgba(255,90,106,.15);  color: #ff5a6a; }

.cal-day-acc-right {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}
.cal-day-acc-sub {
  font-size: 15px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.2px;
}
.cal-day-acc-sub.inc { color: #4ddc7f; }
.cal-day-acc-sub.exp { color: #ff5a6a; }
.cal-day-acc-chevron {
  font-size: 20px;
  color: rgba(255,255,255,.28);
  transition: transform .25s ease;
  display: inline-block;
  line-height: 1;
}
.cal-day-acc--open .cal-day-acc-chevron { transform: rotate(90deg); }

.cal-day-acc-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height .3s ease;
}
.cal-day-acc--open .cal-day-acc-body { max-height: 1200px; }

/* Transaction rows inside accordion */
.cal-day-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 9px 4px 9px 36px;
  border-bottom: 1px solid rgba(255,255,255,.04);
  font-size: 14px;
  min-height: 40px;
}
.cal-day-row:last-child { border-bottom: none; padding-bottom: 12px; }
.cal-day-desc {
  flex: 1;
  opacity: .78;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cal-day-amt {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  flex-shrink: 0;
  font-size: 14px;
}
.cal-day-amt.inc { color: #4ddc7f; }
.cal-day-amt.exp { color: #ff5a6a; }

/* Day total bar */
.cal-day-total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 12px 0 4px;
  padding: 13px 16px;
  border-radius: 12px;
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.07);
  font-size: 14px;
  font-weight: 800;
}
.cal-day-total span:first-child { opacity: .55; font-weight: 600; font-size: 12px; letter-spacing: .3px; }
.cal-day-total .pos { color: #4ddc7f; font-size: 16px; }
.cal-day-total .neg { color: #ff5a6a; font-size: 16px; }

.cal-day-loading,
.cal-day-empty {
  text-align: center;
  padding: 40px 0;
  font-size: 14px;
  opacity: .35;
}

