:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #e8eef7;
  background: #07111f;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  --bg: #07111f;
  --panel: rgba(12, 27, 45, 0.88);
  --panel-solid: #0c1b2d;
  --panel-soft: #10233a;
  --border: rgba(148, 163, 184, 0.17);
  --border-strong: rgba(148, 163, 184, 0.28);
  --text: #f8fafc;
  --muted: #9aa9bc;
  --accent: #5eead4;
  --accent-strong: #2dd4bf;
  --danger: #fda4af;
  --warning: #fde68a;
  --shadow: 0 28px 80px rgba(0, 0, 0, 0.36);
  --surface: var(--panel-solid);
  --surface-muted: var(--panel-soft);
  --line: var(--border);
}

* { box-sizing: border-box; }
html { min-width: 320px; min-height: 100%; }
body {
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 8% 4%, rgba(20, 184, 166, 0.17), transparent 32rem),
    radial-gradient(circle at 95% 88%, rgba(59, 130, 246, 0.14), transparent 36rem),
    linear-gradient(145deg, #07111f 0%, #0b1728 55%, #07101c 100%);
}
button, input { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }

.app-shell { min-height: 100vh; }
.center-view {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1.25rem;
}

.loader-card,
.setup-card {
  width: min(100%, 590px);
  padding: clamp(2rem, 6vw, 4rem);
  text-align: center;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 28px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}
.loader-card { width: auto; padding: 1.5rem 2rem; }
.loader-card p { margin: 1rem 0 0; color: var(--muted); }
.spinner {
  display: inline-block;
  width: 2rem;
  height: 2rem;
  border: 3px solid rgba(94, 234, 212, 0.18);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.brand-icon {
  width: 3.25rem;
  height: 3.25rem;
  display: inline-grid;
  place-items: center;
  color: #06231f;
  font-size: 1.55rem;
  font-weight: 900;
  background: linear-gradient(145deg, #99f6e4, #2dd4bf);
  border-radius: 1rem;
  box-shadow: 0 12px 30px rgba(45, 212, 191, 0.18);
}
.brand-icon-small { width: 2.45rem; height: 2.45rem; font-size: 1.15rem; border-radius: 0.75rem; }
.brand-row { display: flex; align-items: center; gap: 0.8rem; color: var(--text); font-weight: 800; }
.eyebrow {
  margin: 0 0 0.65rem;
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 850;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}
h1, h2, p { overflow-wrap: break-word; }
h1 { margin: 0; color: var(--text); font-size: clamp(2rem, 6vw, 4.7rem); line-height: 0.98; letter-spacing: -0.045em; }
h2 { margin: 0; color: var(--text); }
.muted { color: var(--muted); line-height: 1.65; }
code { padding: 0.12rem 0.35rem; color: #bae6fd; background: rgba(14, 165, 233, 0.1); border: 1px solid rgba(56, 189, 248, 0.15); border-radius: 6px; }

.setup-card h1 { margin-top: 1rem; font-size: clamp(2rem, 8vw, 3.6rem); }
.setup-list { margin: 1.5rem auto; padding-left: 1.4rem; max-width: 32rem; color: var(--muted); text-align: left; line-height: 1.7; }

.auth-layout { min-height: 100vh; display: grid; grid-template-columns: minmax(340px, 0.95fr) minmax(420px, 1.05fr); }
.auth-hero {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: clamp(2rem, 5vw, 5rem);
  background:
    linear-gradient(rgba(7, 17, 31, 0.35), rgba(7, 17, 31, 0.72)),
    radial-gradient(circle at 35% 35%, rgba(45, 212, 191, 0.22), transparent 25rem),
    linear-gradient(145deg, #0b2435, #081424 64%, #07111f);
  border-right: 1px solid var(--border);
}
.hero-copy { max-width: 42rem; padding: 5rem 0; }
.hero-copy h1 { max-width: 11ch; }
.hero-copy > p:last-child { max-width: 54ch; margin: 1.6rem 0 0; color: #b8c4d4; font-size: 1.05rem; line-height: 1.75; }
.privacy-note { display: flex; align-items: center; gap: 0.65rem; color: var(--muted); font-size: 0.9rem; }
.privacy-dot { width: 0.65rem; height: 0.65rem; background: #4ade80; border-radius: 50%; box-shadow: 0 0 0 5px rgba(74, 222, 128, 0.11); }

.auth-panel { min-height: 100vh; display: grid; place-items: center; align-content: center; gap: 1.4rem; padding: 2rem; }
.auth-card {
  width: min(100%, 520px);
  padding: clamp(1.5rem, 5vw, 2.7rem);
  background: rgba(10, 24, 41, 0.82);
  border: 1px solid var(--border);
  border-radius: 26px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}
.mobile-brand { display: none; align-items: center; gap: 0.75rem; margin-bottom: 1.5rem; font-weight: 800; }
.auth-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 0.35rem; padding: 0.35rem; background: rgba(2, 8, 23, 0.48); border: 1px solid var(--border); border-radius: 14px; }
.auth-tab { padding: 0.75rem; color: var(--muted); font-weight: 750; background: transparent; border: 0; border-radius: 10px; cursor: pointer; }
.auth-tab.is-active { color: #06231f; background: var(--accent); }
.auth-tab[aria-disabled="true"] { opacity: 0.58; }
.form-heading { margin: 2rem 0 1.5rem; }
.form-heading h2 { font-size: 1.7rem; }
.form-heading p { margin: 0.55rem 0 0; color: var(--muted); line-height: 1.55; }
.auth-form { display: grid; gap: 1rem; }
.field { display: grid; gap: 0.48rem; color: #cbd5e1; font-size: 0.9rem; font-weight: 700; }
.field input {
  width: 100%;
  min-height: 3rem;
  padding: 0.78rem 0.9rem;
  color: var(--text);
  background: rgba(2, 8, 23, 0.48);
  border: 1px solid var(--border-strong);
  border-radius: 11px;
  outline: none;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}
.field input::placeholder { color: #64748b; }
.field input:focus { border-color: var(--accent-strong); box-shadow: 0 0 0 3px rgba(45, 212, 191, 0.12); }
.password-field { position: relative; display: block; }
.password-field input { padding-right: 5.2rem; }
.password-toggle { position: absolute; top: 50%; right: 0.55rem; transform: translateY(-50%); padding: 0.4rem 0.45rem; color: var(--accent); font-size: 0.78rem; font-weight: 800; background: transparent; border: 0; cursor: pointer; }
.check-row { display: flex; align-items: flex-start; gap: 0.65rem; color: var(--muted); font-size: 0.86rem; line-height: 1.4; cursor: pointer; }
.check-row input { width: 1.05rem; height: 1.05rem; margin-top: 0.06rem; accent-color: var(--accent-strong); }
.password-help { margin: -0.2rem 0 0; color: #78899f; font-size: 0.78rem; line-height: 1.45; }
.form-message { min-height: 1.2rem; margin: 0; color: var(--danger); font-size: 0.85rem; line-height: 1.4; }
.auth-footer { margin: 0; color: #64748b; font-size: 0.78rem; }

.button { display: inline-flex; justify-content: center; align-items: center; min-height: 2.8rem; padding: 0.72rem 1rem; font-weight: 800; border: 1px solid transparent; border-radius: 11px; cursor: pointer; transition: transform 150ms ease, background-color 150ms ease, border-color 150ms ease; }
.button:hover:not(:disabled) { transform: translateY(-1px); }
.button:disabled { opacity: 0.58; cursor: wait; }
.button-primary { color: #06231f; background: var(--accent); }
.button-primary:hover:not(:disabled) { background: #99f6e4; }
.button-secondary { color: var(--text); background: rgba(148, 163, 184, 0.08); border-color: var(--border-strong); }
.button-ghost { color: #cbd5e1; background: transparent; border-color: transparent; }
.button-block { width: 100%; }
.text-button { margin-left: 0.35rem; padding: 0; color: var(--warning); font-weight: 800; background: none; border: 0; text-decoration: underline; cursor: pointer; }
.notice { margin-bottom: 1.2rem; padding: 0.9rem 1rem; font-size: 0.84rem; line-height: 1.5; border-radius: 12px; }
.notice-warning { color: #fde68a; background: rgba(245, 158, 11, 0.1); border: 1px solid rgba(245, 158, 11, 0.2); }

.dashboard { min-height: 100vh; }
.topbar { min-height: 76px; display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: 0.9rem clamp(1rem, 4vw, 3.5rem); background: rgba(7, 17, 31, 0.82); border-bottom: 1px solid var(--border); backdrop-filter: blur(16px); }
.user-actions { display: flex; align-items: center; gap: 0.65rem; }
.user-summary { display: grid; justify-items: end; margin-right: 0.5rem; }
.user-summary strong { color: var(--text); font-size: 0.9rem; }
.user-summary span { max-width: 16rem; color: var(--muted); font-size: 0.76rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dashboard-content { width: min(100%, 1280px); margin: 0 auto; padding: clamp(1.2rem, 4vw, 3.5rem); }
.welcome-card { display: flex; justify-content: space-between; align-items: flex-end; gap: 2rem; padding: clamp(1.5rem, 5vw, 3.4rem); background: linear-gradient(145deg, rgba(16, 35, 58, 0.92), rgba(10, 24, 41, 0.82)); border: 1px solid var(--border); border-radius: 26px; box-shadow: var(--shadow); }
.welcome-card h1 { font-size: clamp(2.2rem, 7vw, 4.6rem); }
.welcome-card p:last-child { max-width: 63ch; margin: 1.15rem 0 0; color: var(--muted); line-height: 1.7; }
.secure-badge { flex: 0 0 auto; display: flex; align-items: center; gap: 0.55rem; padding: 0.7rem 0.9rem; color: #86efac; font-size: 0.85rem; font-weight: 800; background: rgba(34, 197, 94, 0.09); border: 1px solid rgba(74, 222, 128, 0.18); border-radius: 999px; }
.feature-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; margin-top: 1rem; }
.feature-card { min-height: 230px; padding: 1.6rem; background: rgba(10, 24, 41, 0.72); border: 1px solid var(--border); border-radius: 20px; }
.feature-number { color: var(--accent); font-size: 0.76rem; font-weight: 900; letter-spacing: 0.12em; }
.feature-card h2 { margin-top: 2.8rem; font-size: 1.2rem; }
.feature-card p { margin: 0.75rem 0 0; color: var(--muted); font-size: 0.92rem; line-height: 1.65; }

.modal { width: min(calc(100% - 2rem), 540px); padding: 0; color: var(--text); background: transparent; border: 0; }
.modal::backdrop { background: rgba(1, 6, 15, 0.76); backdrop-filter: blur(5px); }
.modal-card { display: grid; gap: 1rem; padding: clamp(1.4rem, 5vw, 2.3rem); background: var(--panel-solid); border: 1px solid var(--border-strong); border-radius: 22px; box-shadow: var(--shadow); }
.modal-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; margin-bottom: 0.5rem; }
.icon-button { width: 2.4rem; height: 2.4rem; color: var(--muted); font-size: 1.8rem; line-height: 1; background: transparent; border: 1px solid var(--border); border-radius: 10px; cursor: pointer; }
.modal-note { margin: 0; color: var(--muted); font-size: 0.8rem; line-height: 1.5; }
.modal-actions { display: flex; justify-content: flex-end; gap: 0.7rem; margin-top: 0.4rem; }

.toast { position: fixed; z-index: 20; top: 1rem; left: 50%; transform: translateX(-50%); max-width: min(calc(100% - 2rem), 560px); padding: 0.85rem 1rem; color: #dcfce7; font-size: 0.88rem; font-weight: 750; background: #123225; border: 1px solid rgba(74, 222, 128, 0.26); border-radius: 12px; box-shadow: var(--shadow); }
.toast-error { color: #ffe4e6; background: #3b1720; border-color: rgba(251, 113, 133, 0.28); }

button:focus-visible, input:focus-visible { outline: 3px solid rgba(94, 234, 212, 0.32); outline-offset: 2px; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 900px) {
  .auth-layout { grid-template-columns: 1fr; }
  .auth-hero { display: none; }
  .auth-panel { padding: 1rem; }
  .mobile-brand { display: flex; }
  .feature-grid { grid-template-columns: 1fr; }
  .feature-card { min-height: 0; }
  .feature-card h2 { margin-top: 1.4rem; }
}

@media (max-width: 720px) {
  .topbar { align-items: flex-start; flex-direction: column; }
  .user-actions { width: 100%; flex-wrap: wrap; }
  .user-summary { order: -1; width: 100%; justify-items: start; margin: 0 0 0.25rem; }
  .welcome-card { align-items: flex-start; flex-direction: column; }
  .secure-badge { align-self: flex-start; }
}

@media (max-width: 480px) {
  .auth-card, .setup-card { border-radius: 20px; }
  .auth-panel { place-items: stretch; }
  .button-secondary, .button-ghost { flex: 1 1 auto; }
  .modal-actions { flex-direction: column-reverse; }
  .modal-actions .button { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
}


/* ===== Versión 3: estructura lateral y módulo Cuentas ===== */
:root {
  --sidebar-width: 264px;
  --sidebar-collapsed-width: 76px;
  --surface: #0b1829;
  --surface-raised: #102239;
  --surface-subtle: rgba(13, 29, 49, 0.76);
  --positive: #86efac;
}

select, textarea { font: inherit; }
textarea { resize: vertical; }
.no-scroll { overflow: hidden; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.app-layout {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  min-height: 100vh;
  background: #07111f;
  transition: grid-template-columns 180ms ease;
}
.app-layout.sidebar-collapsed { grid-template-columns: var(--sidebar-collapsed-width) minmax(0, 1fr); }

.sidebar {
  position: sticky;
  top: 0;
  z-index: 12;
  width: var(--sidebar-width);
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  color: var(--text);
  background:
    radial-gradient(circle at 10% 0%, rgba(45, 212, 191, 0.12), transparent 18rem),
    #091526;
  border-right: 1px solid var(--border);
  transition: width 180ms ease, transform 180ms ease;
}
.sidebar-collapsed .sidebar { width: var(--sidebar-collapsed-width); }
.sidebar-brand {
  min-height: 78px;
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.85rem 0.9rem;
  border-bottom: 1px solid var(--border);
}
.brand-text {
  flex: 1;
  min-width: 0;
  font-size: 0.9rem;
  font-weight: 850;
  line-height: 1.15;
}
.sidebar-icon-button,
.topbar-icon-button {
  flex: 0 0 auto;
  width: 2.35rem;
  height: 2.35rem;
  display: inline-grid;
  place-items: center;
  padding: 0;
  color: var(--muted);
  background: rgba(148, 163, 184, 0.07);
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
}
.sidebar-icon-button svg,
.topbar-icon-button svg,
.nav-item svg,
.search-field svg,
.account-icon svg,
.empty-icon svg {
  width: 1.25rem;
  height: 1.25rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.sidebar-collapsed .collapse-button svg { transform: rotate(180deg); }
.sidebar-label { white-space: nowrap; opacity: 1; transition: opacity 100ms ease; }
.sidebar-collapsed .sidebar-label { width: 0; overflow: hidden; opacity: 0; }
.sidebar-collapsed .sidebar-brand { justify-content: center; padding-inline: 0.65rem; }
.sidebar-collapsed .sidebar-brand .brand-icon { display: none; }
.sidebar-collapsed .collapse-button { margin: 0; }

.sidebar-nav { flex: 1; display: grid; align-content: start; gap: 0.35rem; padding: 1rem 0.75rem; }
.nav-item {
  width: 100%;
  min-height: 3rem;
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.7rem 0.85rem;
  color: #aebbd0;
  font-size: 0.9rem;
  font-weight: 750;
  text-align: left;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 12px;
  cursor: pointer;
}
.nav-item svg { flex: 0 0 auto; }
.nav-item:hover { color: var(--text); background: rgba(148, 163, 184, 0.07); }
.nav-item.is-active { color: #06231f; background: var(--accent); }
.sidebar-collapsed .nav-item { justify-content: center; padding-inline: 0.5rem; }

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 0 0.75rem 0.6rem;
  padding: 0.75rem;
  background: rgba(148, 163, 184, 0.06);
  border: 1px solid var(--border);
  border-radius: 13px;
}
.avatar {
  flex: 0 0 auto;
  width: 2.3rem;
  height: 2.3rem;
  display: grid;
  place-items: center;
  color: #06231f;
  font-weight: 900;
  background: var(--accent);
  border-radius: 50%;
}
.sidebar-user-copy { min-width: 0; display: grid; gap: 0.13rem; }
.sidebar-user-copy strong,
.sidebar-user-copy span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-user-copy strong { font-size: 0.83rem; }
.sidebar-user-copy span { color: var(--muted); font-size: 0.68rem; }
.sidebar-collapsed .sidebar-user { justify-content: center; margin-inline: 0.65rem; padding-inline: 0.4rem; }
.sidebar-footer { display: grid; gap: 0.15rem; padding: 0.65rem 0.75rem 1rem; border-top: 1px solid var(--border); }
.nav-item-secondary { min-height: 2.65rem; font-size: 0.8rem; }

.workspace { min-width: 0; min-height: 100vh; background:
  radial-gradient(circle at 100% 0%, rgba(59, 130, 246, 0.08), transparent 30rem),
  #07111f;
}
.workspace-topbar {
  position: sticky;
  top: 0;
  z-index: 8;
  min-height: 78px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem clamp(1rem, 3vw, 2.2rem);
  background: rgba(7, 17, 31, 0.88);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(16px);
}
.topbar-leading { display: flex; align-items: center; gap: 0.85rem; }
.topbar-leading h1 { font-size: 1.35rem; letter-spacing: -0.025em; line-height: 1.2; }
.topbar-kicker { margin: 0 0 0.15rem; color: var(--muted); font-size: 0.68rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.1em; }
.topbar-icon-button { display: none; }
.topbar-user { display: flex; align-items: baseline; gap: 0.4rem; color: var(--muted); font-size: 0.78rem; }
.topbar-user strong { color: var(--text); }
.workspace-content { width: min(100%, 1500px); margin: 0 auto; padding: clamp(1rem, 3vw, 2.3rem); }

.module-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 2rem;
  margin-bottom: 1.25rem;
}
.module-heading h2 { font-size: clamp(1.75rem, 4vw, 2.6rem); letter-spacing: -0.035em; }
.module-heading p:last-child { max-width: 66ch; margin: 0.65rem 0 0; color: var(--muted); line-height: 1.6; }
.module-heading .button { flex: 0 0 auto; }

.summary-section { display: flex; gap: 0.9rem; margin-bottom: 1rem; overflow-x: auto; scrollbar-width: thin; }
.balance-summary { display: flex; gap: 0.9rem; }
.summary-card {
  flex: 0 0 min(290px, 78vw);
  min-height: 132px;
  display: grid;
  align-content: space-between;
  padding: 1.15rem 1.25rem;
  background: linear-gradient(145deg, rgba(16, 35, 58, 0.9), rgba(10, 24, 41, 0.82));
  border: 1px solid var(--border);
  border-radius: 18px;
}
.summary-count-card { flex-basis: 210px; background: linear-gradient(145deg, rgba(45, 212, 191, 0.13), rgba(10, 24, 41, 0.82)); }
.summary-label { color: var(--muted); font-size: 0.75rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.08em; }
.summary-card strong { color: var(--text); font-size: 1.75rem; letter-spacing: -0.035em; }
.summary-count-card strong { color: var(--accent); font-size: 2.4rem; }
.summary-caption { color: #74859b; font-size: 0.72rem; }
.balance-card-empty strong { color: var(--muted); font-size: 1.25rem; }

.accounts-panel {
  min-height: 330px;
  overflow: hidden;
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: 0 18px 55px rgba(0, 0, 0, 0.18);
}
.accounts-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  border-bottom: 1px solid var(--border);
}
.search-field {
  width: min(100%, 410px);
  min-height: 2.85rem;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0 0.85rem;
  color: #71839a;
  background: rgba(2, 8, 23, 0.42);
  border: 1px solid var(--border-strong);
  border-radius: 11px;
}
.search-field input { flex: 1; min-width: 0; color: var(--text); background: transparent; border: 0; outline: 0; }
.search-field input::placeholder { color: #66788e; }
.filter-group { display: flex; gap: 0.6rem; }
.select-field select,
.field select,
.field textarea {
  width: 100%;
  min-height: 3rem;
  padding: 0.72rem 2.1rem 0.72rem 0.85rem;
  color: var(--text);
  background-color: rgba(2, 8, 23, 0.48);
  border: 1px solid var(--border-strong);
  border-radius: 11px;
  outline: none;
}
.select-field select { min-width: 150px; }
.field textarea { padding-right: 0.85rem; line-height: 1.45; }
.field select:focus,
.field textarea:focus,
.select-field select:focus { border-color: var(--accent-strong); box-shadow: 0 0 0 3px rgba(45, 212, 191, 0.12); }
.field small { color: #77889e; font-size: 0.72rem; font-weight: 500; line-height: 1.4; }

.accounts-loading { min-height: 260px; display: flex; justify-content: center; align-items: center; gap: 0.8rem; color: var(--muted); }
.accounts-loading .spinner { width: 1.5rem; height: 1.5rem; }
.empty-state { min-height: 330px; display: grid; place-items: center; align-content: center; padding: 2rem; text-align: center; }
.empty-icon { width: 4rem; height: 4rem; display: grid; place-items: center; color: var(--accent); background: rgba(45, 212, 191, 0.09); border: 1px solid rgba(45, 212, 191, 0.15); border-radius: 18px; }
.empty-icon svg { width: 2rem; height: 2rem; }
.empty-state h3 { margin: 1rem 0 0.35rem; font-size: 1.25rem; }
.empty-state p { max-width: 38ch; margin: 0 0 1.2rem; color: var(--muted); line-height: 1.55; }

.table-wrapper { overflow-x: auto; }
.accounts-table { width: 100%; min-width: 940px; border-collapse: collapse; }
.accounts-table th { padding: 0.8rem 1rem; color: #71839a; font-size: 0.68rem; font-weight: 850; text-align: left; text-transform: uppercase; letter-spacing: 0.08em; background: rgba(2, 8, 23, 0.22); }
.accounts-table td { padding: 1rem; border-top: 1px solid var(--border); vertical-align: middle; }
.accounts-table tbody tr { transition: background 120ms ease; }
.accounts-table tbody tr:hover { background: rgba(148, 163, 184, 0.035); }
.accounts-table tbody tr.is-archived { opacity: 0.72; }
.account-name-cell { display: flex; align-items: center; gap: 0.75rem; min-width: 180px; }
.account-name-cell > div { min-width: 0; display: grid; gap: 0.18rem; }
.account-name-cell strong,
.account-name-cell span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-name-cell strong { max-width: 220px; font-size: 0.9rem; }
.account-name-cell span { color: var(--muted); font-size: 0.72rem; }
.account-icon { flex: 0 0 auto; width: 2.6rem; height: 2.6rem; display: grid; place-items: center; border-radius: 12px; }
.account-icon-bank { color: #7dd3fc; background: rgba(14, 165, 233, 0.1); }
.account-icon-savings { color: #c4b5fd; background: rgba(139, 92, 246, 0.1); }
.account-icon-cash { color: #86efac; background: rgba(34, 197, 94, 0.1); }
.identification-cell { max-width: 240px; color: var(--muted); font-size: 0.8rem; }
.balance-cell { color: var(--text); font-size: 0.9rem; font-weight: 850; white-space: nowrap; }
.type-badge,
.status-badge { display: inline-flex; align-items: center; min-height: 1.7rem; padding: 0.28rem 0.55rem; font-size: 0.67rem; font-weight: 850; border: 1px solid transparent; border-radius: 999px; white-space: nowrap; }
.type-bank { color: #7dd3fc; background: rgba(14, 165, 233, 0.09); border-color: rgba(14, 165, 233, 0.14); }
.type-savings { color: #c4b5fd; background: rgba(139, 92, 246, 0.09); border-color: rgba(139, 92, 246, 0.14); }
.type-cash { color: #86efac; background: rgba(34, 197, 94, 0.09); border-color: rgba(34, 197, 94, 0.14); }
.status-badge.is-active { color: #86efac; background: rgba(34, 197, 94, 0.08); border-color: rgba(34, 197, 94, 0.14); }
.status-badge.is-archived { color: #cbd5e1; background: rgba(148, 163, 184, 0.08); border-color: var(--border); }
.account-actions { display: flex; justify-content: flex-end; gap: 0.25rem; }
.table-action { padding: 0.42rem 0.55rem; color: var(--accent); font-size: 0.72rem; font-weight: 800; background: transparent; border: 0; border-radius: 7px; cursor: pointer; }
.table-action:hover { background: rgba(45, 212, 191, 0.08); }
.table-action.action-archive { color: #fda4af; }
.table-action.action-restore { color: #86efac; }

.accounts-card-list { display: none; gap: 0.75rem; padding: 0.85rem; }
.account-card { display: grid; gap: 1rem; padding: 1rem; background: rgba(2, 8, 23, 0.25); border: 1px solid var(--border); border-radius: 15px; }
.account-card.is-archived { opacity: 0.76; }
.account-card-header,
.account-card-footer { display: flex; justify-content: space-between; align-items: center; gap: 0.75rem; }
.account-card-balance { display: grid; gap: 0.2rem; padding: 0.85rem; background: rgba(148, 163, 184, 0.05); border-radius: 11px; }
.account-card-balance span { color: var(--muted); font-size: 0.7rem; }
.account-card-balance strong { font-size: 1.25rem; }

.account-modal { width: min(calc(100% - 2rem), 680px); }
.account-form { max-height: min(90vh, 850px); overflow-y: auto; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.field-wide { grid-column: 1 / -1; }
.money-field { display: flex; min-height: 3rem; overflow: hidden; background: rgba(2, 8, 23, 0.48); border: 1px solid var(--border-strong); border-radius: 11px; }
.money-field:focus-within { border-color: var(--accent-strong); box-shadow: 0 0 0 3px rgba(45, 212, 191, 0.12); }
.money-field span { min-width: 4rem; display: grid; place-items: center; color: var(--accent); font-size: 0.78rem; background: rgba(45, 212, 191, 0.07); border-right: 1px solid var(--border); }
.money-field input { min-height: auto; border: 0; border-radius: 0; box-shadow: none !important; }
.modal-copy { margin: 0; color: var(--muted); line-height: 1.65; }
.sidebar-overlay { position: fixed; inset: 0; z-index: 10; background: rgba(1, 6, 15, 0.72); backdrop-filter: blur(3px); }

@media (max-width: 1050px) {
  .accounts-toolbar { align-items: stretch; flex-direction: column; }
  .search-field { width: 100%; max-width: none; }
  .filter-group { justify-content: flex-end; }
}

@media (max-width: 820px) {
  .app-layout,
  .app-layout.sidebar-collapsed { display: block; }
  .sidebar,
  .sidebar-collapsed .sidebar {
    position: fixed;
    left: 0;
    width: min(86vw, 300px);
    transform: translateX(-102%);
    box-shadow: 20px 0 60px rgba(0, 0, 0, 0.4);
  }
  .mobile-sidebar-open .sidebar { transform: translateX(0); }
  .sidebar-collapsed .sidebar-label { width: auto; opacity: 1; overflow: visible; }
  .sidebar-collapsed .sidebar-brand { justify-content: flex-start; padding-inline: 0.9rem; }
  .sidebar-collapsed .sidebar-brand .brand-icon { display: inline-grid; }
  .sidebar-collapsed .nav-item { justify-content: flex-start; padding-inline: 0.85rem; }
  .sidebar-collapsed .sidebar-user { justify-content: flex-start; margin-inline: 0.75rem; padding-inline: 0.75rem; }
  .collapse-button { display: none; }
  .topbar-icon-button { display: inline-grid; }
  .topbar-user { display: none; }
  .workspace-content { padding: 1rem; }
  .module-heading { align-items: stretch; flex-direction: column; gap: 1rem; }
  .module-heading .button { align-self: flex-start; }
  .accounts-table { min-width: 850px; }
  .table-wrapper { display: none !important; }
  .accounts-card-list:not([hidden]) { display: grid; }
}

@media (max-width: 590px) {
  .workspace-topbar { min-height: 68px; }
  .module-heading h2 { font-size: 1.7rem; }
  .summary-card { flex-basis: min(270px, 82vw); min-height: 118px; }
  .summary-count-card { flex-basis: 180px; }
  .filter-group { display: grid; grid-template-columns: 1fr 1fr; }
  .select-field select { min-width: 0; }
  .form-grid { grid-template-columns: 1fr; }
  .field-wide { grid-column: auto; }
  .account-card-header { align-items: flex-start; }
  .account-card-footer { align-items: flex-start; flex-direction: column; }
  .account-actions { width: 100%; justify-content: flex-end; }
}

/* ===== Versión 4: módulo Tarjetas de crédito ===== */
.credit-card-summary { display: flex; gap: 0.9rem; }
.credit-summary-card { flex-basis: 330px; gap: 0.8rem; }
.credit-summary-header { display: grid; gap: 0.35rem; }
.credit-summary-header strong { font-size: 1.55rem; }
.credit-summary-details { display: grid; grid-template-columns: 1fr 1fr; gap: 0.65rem; }
.credit-summary-details span { display: grid; gap: 0.2rem; padding: 0.55rem 0.65rem; background: rgba(2, 8, 23, 0.25); border-radius: 9px; }
.credit-summary-details small { color: var(--muted); font-size: 0.66rem; text-transform: uppercase; letter-spacing: 0.06em; }
.credit-summary-details b { font-size: 0.82rem; }
.credit-summary-empty strong { color: var(--muted); font-size: 1.25rem; }

.credit-cards-panel {
  min-height: 330px;
  overflow: hidden;
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: 0 18px 55px rgba(0, 0, 0, 0.18);
}
.credit-card-empty-icon { color: #c4b5fd; background: rgba(139, 92, 246, 0.09); border-color: rgba(139, 92, 246, 0.16); }
.credit-cards-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; padding: 1rem; }
.credit-card-item {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(220px, 0.82fr) minmax(250px, 1.18fr);
  gap: 1rem;
  padding: 1rem;
  background: rgba(2, 8, 23, 0.26);
  border: 1px solid var(--border);
  border-radius: 18px;
  transition: border-color 150ms ease, transform 150ms ease;
}
.credit-card-item:hover { transform: translateY(-1px); border-color: var(--border-strong); }
.credit-card-item.is-archived { opacity: 0.7; }
.credit-card-visual {
  position: relative;
  min-height: 190px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
  padding: 1.05rem;
  color: #f8fafc;
  background: linear-gradient(145deg, #14304d, #0a1627);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 18px;
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.25);
}
.credit-card-visual::after {
  content: "";
  position: absolute;
  width: 12rem;
  height: 12rem;
  right: -5rem;
  bottom: -6rem;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 50%;
}
.credit-card-visual.network-visa { background: linear-gradient(145deg, #173b70, #0a1933); }
.credit-card-visual.network-mastercard { background: linear-gradient(145deg, #623123, #23120e); }
.credit-card-visual.network-amex { background: linear-gradient(145deg, #16615f, #082c31); }
.credit-card-visual.network-other { background: linear-gradient(145deg, #44306c, #171126); }
.credit-card-visual-top,
.credit-card-visual-bottom { position: relative; z-index: 1; display: flex; justify-content: space-between; align-items: center; gap: 0.7rem; }
.credit-card-visual-top span { max-width: 62%; overflow: hidden; color: rgba(255, 255, 255, 0.82); font-size: 0.72rem; text-overflow: ellipsis; white-space: nowrap; }
.credit-card-visual-top strong { font-size: 0.78rem; text-align: right; }
.credit-card-chip { position: relative; z-index: 1; width: 2.7rem; height: 2rem; background: linear-gradient(145deg, #f7d774, #aa8128); border-radius: 6px; box-shadow: inset 0 0 0 1px rgba(79, 55, 3, 0.3); }
.credit-card-number { position: relative; z-index: 1; font-size: clamp(0.84rem, 1.5vw, 1.04rem); letter-spacing: 0.08em; white-space: nowrap; }
.credit-card-visual-bottom strong { max-width: 74%; overflow: hidden; font-size: 0.85rem; text-overflow: ellipsis; white-space: nowrap; }
.credit-card-visual-bottom span { font-size: 0.72rem; font-weight: 850; }
.credit-card-content { min-width: 0; display: grid; align-content: start; gap: 0.85rem; }
.credit-card-status-row { display: flex; justify-content: space-between; align-items: center; gap: 0.6rem; }
.utilization-label { color: var(--muted); font-size: 0.7rem; font-weight: 750; text-align: right; }
.credit-card-metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.5rem; }
.credit-card-metrics > div { min-width: 0; display: grid; gap: 0.25rem; padding: 0.65rem; background: rgba(148, 163, 184, 0.05); border-radius: 10px; }
.credit-card-metrics span { color: var(--muted); font-size: 0.64rem; text-transform: uppercase; letter-spacing: 0.05em; }
.credit-card-metrics strong { overflow: hidden; font-size: 0.78rem; text-overflow: ellipsis; white-space: nowrap; }
.value-danger { color: var(--danger); }
.credit-utilization { height: 0.48rem; overflow: hidden; background: rgba(148, 163, 184, 0.12); border-radius: 999px; }
.credit-utilization span { display: block; height: 100%; background: #4ade80; border-radius: inherit; transition: width 250ms ease; }
.utilization-medium .credit-utilization span { background: #facc15; }
.utilization-high .credit-utilization span { background: #fb923c; }
.utilization-limit .credit-utilization span { background: #fb7185; }
.credit-card-dates { min-height: 1.2rem; margin: 0; color: var(--muted); font-size: 0.72rem; line-height: 1.45; }
.credit-card-actions { display: flex; justify-content: flex-end; gap: 0.25rem; margin-top: auto; }
.security-note { margin: -0.2rem 0 0; padding: 0.75rem 0.85rem; color: #fde68a; font-size: 0.75rem; line-height: 1.45; background: rgba(245, 158, 11, 0.07); border: 1px solid rgba(245, 158, 11, 0.14); border-radius: 10px; }

@media (max-width: 1320px) {
  .credit-cards-grid { grid-template-columns: 1fr; }
}

@media (max-width: 700px) {
  .credit-card-item { grid-template-columns: 1fr; }
  .credit-card-visual { min-height: 180px; }
  .credit-card-metrics { grid-template-columns: 1fr; }
  .credit-card-metrics > div { grid-template-columns: 1fr auto; align-items: center; }
}

/* Compras a meses sin intereses */
.installment-summary-section {
  grid-template-columns: repeat(3, minmax(150px, .65fr)) minmax(280px, 1.5fr);
}
.installment-balance-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 14px;
}
.installment-balance-card { min-height: 100%; }
.installment-toolbar .filter-group { flex-wrap: wrap; }
.installment-purchases-list {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
  width: 100%;
  padding: 20px;
}
.installment-item {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 18px;
  padding: 20px;
  display: grid;
  gap: 16px;
  box-shadow: 0 10px 24px rgba(5, 15, 30, .06);
}
.installment-item.is-cancelled { opacity: .72; }
.installment-item-header {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
}
.installment-item-header h3 { margin: 7px 0 3px; font-size: 1.12rem; }
.installment-item-header p { margin: 0; color: var(--muted); font-size: .88rem; }
.category-pill {
  display: inline-flex;
  padding: 4px 9px;
  border-radius: 999px;
  background: rgba(40, 116, 240, .1);
  color: var(--primary);
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .02em;
}
.installment-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.installment-metrics span {
  display: grid;
  gap: 3px;
  padding: 11px;
  border-radius: 12px;
  background: var(--surface-soft);
}
.installment-metrics small { color: var(--muted); }
.installment-metrics strong { font-size: .94rem; overflow-wrap: anywhere; }
.installment-progress,
.credit-utilization {
  height: 8px;
  border-radius: 999px;
  background: var(--border-soft);
  overflow: hidden;
}
.installment-progress span,
.credit-utilization span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--primary), #61a7ff);
}
.installment-next { margin: 0; color: var(--muted); font-size: .88rem; }
.configuration-warning { color: #a85b00; font-weight: 700; }
.credit-card-dates { display: grid; gap: 4px; }
.credit-card-dates span { display: block; }
.credit-card-metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.credit-summary-details { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.installment-modal .modal-card { width: min(820px, calc(100vw - 28px)); }
.installment-preview {
  margin-top: 18px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface-soft);
  overflow: hidden;
}
.installment-preview:empty { display: none; }
.preview-heading {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}
.preview-heading span { color: var(--muted); font-size: .84rem; }
.preview-schedule { display: grid; }
.preview-schedule > span {
  display: grid;
  grid-template-columns: 80px 1fr 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 11px 16px;
  border-bottom: 1px solid var(--border-soft);
  font-size: .84rem;
}
.preview-schedule > span:last-of-type { border-bottom: 0; }
.preview-schedule span span { color: var(--muted); }
.preview-more { margin: 0; padding: 10px 16px; color: var(--muted); font-size: .82rem; }
.category-control { display: flex; gap: 10px; align-items: stretch; }
.category-control select { flex: 1; }
.button-compact { white-space: nowrap; padding-inline: 14px; }

.schedule-modal-card { width: min(900px, calc(100vw - 28px)); }
.schedule-table-wrap { max-height: min(60vh, 560px); overflow: auto; border: 1px solid var(--border); border-radius: 14px; }
.schedule-table { min-width: 700px; }
.schedule-status {
  display: inline-flex;
  padding: 5px 9px;
  border-radius: 999px;
  font-size: .75rem;
  font-weight: 800;
  white-space: nowrap;
}
.status-scheduled { background: #eaf1fb; color: #315b8a; }
.status-pending { background: #fff2cc; color: #805a00; }
.status-due_today { background: #ffe2ad; color: #8a4900; }
.status-overdue { background: #ffe1e1; color: #9d2525; }
.status-paid_initial,
.status-paid { background: #dff6e8; color: #147142; }
.status-cancelled { background: #eceff3; color: #687383; }

@media (max-width: 1100px) {
  .installment-summary-section { grid-template-columns: repeat(3, 1fr); }
  .installment-balance-summary { grid-column: 1 / -1; }
}
@media (max-width: 720px) {
  .installment-summary-section { grid-template-columns: 1fr; }
  .installment-balance-summary { grid-column: auto; }
  .installment-purchases-list { grid-template-columns: 1fr; padding: 14px; }
  .installment-metrics { grid-template-columns: 1fr; }
  .preview-heading { display: grid; }
  .preview-schedule > span { grid-template-columns: 1fr 1fr; }
  .category-control { display: grid; }
  .credit-card-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}


/* ===== Versión 6: formulario MSI como vista completa ===== */
.installment-subview,
.installment-editor,
.installment-editor-card,
.installment-editor-layout,
.installment-form-panel,
.installment-preview-panel {
  min-width: 0;
}

.installment-editor {
  width: 100%;
  overflow: visible;
}

.installment-editor-heading {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  gap: 1.1rem;
  margin-bottom: 1.25rem;
}

.installment-editor-heading h2 {
  margin-top: 0.15rem;
  font-size: clamp(1.8rem, 4vw, 2.65rem);
  letter-spacing: -0.035em;
}

.installment-editor-heading p:last-child {
  max-width: 72ch;
  margin: 0.55rem 0 0;
  color: var(--muted);
  line-height: 1.6;
}

.editor-back-button {
  min-height: 2.75rem;
  white-space: nowrap;
}

.installment-editor-card {
  width: 100%;
  display: grid;
  gap: 1.25rem;
  padding: clamp(1rem, 2.6vw, 1.75rem);
  overflow: visible;
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: 0 18px 55px rgba(0, 0, 0, 0.18);
}

.installment-editor-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.22fr) minmax(330px, 0.78fr);
  gap: 1.25rem;
  align-items: start;
}

.installment-form-panel,
.installment-preview-panel {
  padding: clamp(1rem, 2vw, 1.3rem);
  background: rgba(2, 8, 23, 0.24);
  border: 1px solid var(--border);
  border-radius: 16px;
}

.installment-form-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.installment-form-fields .field,
.installment-form-fields .category-control,
.installment-form-fields input,
.installment-form-fields select,
.installment-form-fields textarea,
.installment-form-fields .money-field,
.installment-form-fields .money-field input {
  min-width: 0;
  max-width: 100%;
}

.installment-form-fields .money-field {
  width: 100%;
}

.installment-form-fields .money-field span {
  min-width: 4.6rem;
}

.installment-preview-panel {
  display: grid;
  align-content: start;
  gap: 1rem;
}

.preview-panel-heading h3 {
  margin-top: 0.2rem;
  font-size: 1.3rem;
}

.preview-panel-heading p:last-child {
  margin: 0.5rem 0 0;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.55;
}

.installment-editor .installment-preview {
  margin-top: 0;
  overflow: visible;
}

.preview-placeholder {
  padding: 1.1rem;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.55;
  border: 1px dashed var(--border-strong);
  border-radius: 13px;
  background: rgba(148, 163, 184, 0.035);
}

.installment-editor .preview-schedule > span {
  min-width: 0;
  grid-template-columns: auto minmax(0, 1fr) minmax(0, 1fr);
}

.installment-editor .preview-schedule > span > strong {
  grid-column: 2 / -1;
  justify-self: end;
}

.installment-editor-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  padding-top: 0.2rem;
  border-top: 1px solid var(--border);
}

.category-control {
  min-width: 0;
  flex-wrap: wrap;
}

.category-control select {
  min-width: 12rem;
}

/* La regla anterior del modal MSI deja de intervenir en esta vista. */
.installment-modal,
#installment-purchase-dialog {
  display: none !important;
}

@media (max-width: 1120px) {
  .installment-editor-layout {
    grid-template-columns: 1fr;
  }

  .installment-preview-panel {
    order: 2;
  }
}

@media (max-width: 700px) {
  .installment-editor-heading {
    grid-template-columns: 1fr;
  }

  .editor-back-button {
    justify-self: start;
  }

  .installment-form-fields {
    grid-template-columns: 1fr;
  }

  .installment-form-fields .field-wide {
    grid-column: auto;
  }

  .category-control {
    display: grid;
    grid-template-columns: 1fr;
  }

  .category-control select {
    min-width: 0;
  }

  .installment-editor-actions {
    flex-direction: column-reverse;
  }

  .installment-editor-actions .button {
    width: 100%;
  }

  .installment-editor .preview-schedule > span {
    grid-template-columns: 1fr 1fr;
  }

  .installment-editor .preview-schedule > span > strong {
    grid-column: 1 / -1;
    justify-self: start;
  }
}

/* Pagos programados v7 */
.scheduled-summary-section{grid-template-columns:repeat(2,minmax(150px,.7fr)) repeat(2,minmax(220px,1fr));}
.scheduled-money-summary{display:grid;gap:12px;min-width:0}.scheduled-payments-list{display:grid;gap:18px}.scheduled-payment-card{border:1px solid var(--border);background:linear-gradient(145deg,rgba(13,31,50,.96),rgba(7,21,36,.96));border-radius:22px;padding:20px;box-shadow:0 18px 45px rgba(0,0,0,.22)}.scheduled-payment-card.is-paused{opacity:.82}.scheduled-payment-card.is-archived{opacity:.68}.scheduled-card-main{display:flex;justify-content:space-between;gap:20px;align-items:flex-start}.scheduled-card-main h3{font-size:1.25rem;margin:8px 0 4px}.scheduled-card-main p{color:var(--muted);margin:0}.scheduled-card-kicker{display:flex;align-items:center;gap:10px;color:var(--muted);font-size:.82rem}.scheduled-card-amount{text-align:right}.scheduled-card-amount strong{display:block;font-size:1.4rem;color:var(--text)}.scheduled-card-amount span{color:var(--muted);font-size:.82rem}.scheduled-card-next{display:flex;gap:12px;align-items:center;flex-wrap:wrap;margin:18px 0 10px;padding:12px 14px;border:1px solid var(--border);border-radius:14px;background:rgba(4,15,28,.45)}.scheduled-card-next>span:first-child{color:var(--muted)}.scheduled-occurrence-list{display:grid;gap:7px}.scheduled-occurrence-row{display:grid;grid-template-columns:minmax(120px,1fr) minmax(120px,.8fr) minmax(110px,.6fr) auto;gap:12px;align-items:center;padding:9px 4px;border-bottom:1px solid rgba(126,151,177,.13)}.occurrence-actions{display:flex;gap:6px;justify-content:flex-end;flex-wrap:wrap}.occurrence-actions button{border:1px solid var(--border);background:transparent;color:var(--text);border-radius:9px;padding:6px 9px;cursor:pointer}.occurrence-actions button:hover{color:var(--accent);border-color:rgba(76,224,200,.45)}.occurrence-status{display:inline-flex;width:max-content;border-radius:999px;padding:4px 9px;font-size:.75rem;font-weight:800}.status-scheduled{background:rgba(75,140,255,.14);color:#8fb8ff}.status-due_today{background:rgba(255,196,87,.16);color:#ffd477}.status-overdue{background:rgba(255,96,115,.14);color:#ff8797}.status-paid{background:rgba(69,218,167,.14);color:#76e9bd}.status-skipped,.status-cancelled{background:rgba(140,155,175,.15);color:#aab8c8}.status-badge.is-paused{background:rgba(255,196,87,.14);color:#ffd477}.scheduled-editor-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:18px}.scheduled-payment-form{padding:28px}.month-days-field{border:1px solid var(--border);border-radius:16px;padding:16px}.month-days-field legend{font-weight:800;padding:0 8px}.month-day-grid{display:grid;grid-template-columns:repeat(8,minmax(38px,1fr));gap:8px}.month-day-grid label{position:relative}.month-day-grid input{position:absolute;opacity:0}.month-day-grid span{display:grid;place-items:center;min-height:38px;border:1px solid var(--border);border-radius:9px;cursor:pointer}.month-day-grid input:checked+span{background:rgba(76,224,200,.18);border-color:var(--accent);color:var(--accent);font-weight:800}.account-balance-cell small,.mobile-account-value small{display:block;color:var(--muted);font-size:.72rem;margin-top:3px}.credit-card-metrics{grid-template-columns:repeat(3,minmax(0,1fr))}
@media(max-width:1100px){.scheduled-summary-section{grid-template-columns:repeat(2,minmax(0,1fr))}.month-day-grid{grid-template-columns:repeat(7,minmax(38px,1fr))}}
@media(max-width:760px){.scheduled-editor-grid{grid-template-columns:1fr}.scheduled-card-main{flex-direction:column}.scheduled-card-amount{text-align:left}.scheduled-occurrence-row{grid-template-columns:1fr 1fr}.occurrence-actions{grid-column:1/-1;justify-content:flex-start}.month-day-grid{grid-template-columns:repeat(5,minmax(38px,1fr))}.scheduled-summary-section{grid-template-columns:1fr}.credit-card-metrics{grid-template-columns:repeat(2,minmax(0,1fr))}}

/* v8 · Ingresos programados */
.income-card{border-left:3px solid rgba(68,211,155,.38)}
.income-card .scheduled-card-amount strong{color:#76e9bd}
.status-received{background:rgba(69,218,167,.14);color:#76e9bd}
@media(max-width:700px){#scheduled-income-form .scheduled-editor-grid{grid-template-columns:minmax(0,1fr)}}


/* Gastos v10 */
.expense-summary-section {
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
}

.expense-money-summary {
  display: contents;
}

.expense-toolbar {
  align-items: flex-end;
  flex-wrap: wrap;
}

.expense-filter-group {
  flex: 1 1 680px;
  display: grid;
  grid-template-columns: repeat(5, minmax(145px, 1fr));
  gap: 0.75rem;
  align-items: end;
}

.date-filter-field {
  display: grid;
  gap: 0.35rem;
  min-width: 0;
}

.date-filter-field > span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.date-filter-field input {
  width: 100%;
  min-width: 0;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0 0.75rem;
  color: var(--text);
  background: var(--surface);
  font: inherit;
}

.expenses-list {
  display: grid;
  gap: 1rem;
}

.expense-card {
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 1.15rem;
  background: var(--surface);
  box-shadow: 0 12px 32px rgba(7, 17, 31, 0.05);
  display: grid;
  gap: 1rem;
}

.expense-card.is-voided {
  opacity: 0.72;
  background: var(--surface-muted);
}

.expense-card-main {
  display: flex;
  justify-content: space-between;
  gap: 1.5rem;
  align-items: flex-start;
}

.expense-card-copy {
  min-width: 0;
}

.expense-card-copy h3 {
  margin: 0.4rem 0 0.3rem;
  font-size: 1.08rem;
}

.expense-card-copy p,
.expense-card-details {
  color: var(--muted);
  font-size: 0.9rem;
}

.expense-card-copy p {
  margin: 0;
}

.expense-card-amount {
  display: grid;
  justify-items: end;
  flex: 0 0 auto;
  text-align: right;
}

.expense-card-amount strong {
  font-size: 1.2rem;
}

.expense-card-amount span {
  color: var(--muted);
  font-size: 0.8rem;
}

.expense-card-details {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem 1.25rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--line);
}

.expense-editor-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.expense-billing-preview {
  border: 1px solid rgba(52, 211, 153, 0.3);
  border-radius: 16px;
  padding: 1rem;
  background: rgba(52, 211, 153, 0.08);
  display: grid;
  gap: 0.35rem;
}

.expense-billing-preview[hidden] {
  display: none;
}

.expense-billing-preview strong {
  font-size: 1.05rem;
}

.expense-billing-preview small {
  color: var(--muted);
}

@media (max-width: 1180px) {
  .expense-filter-group {
    grid-template-columns: repeat(3, minmax(145px, 1fr));
  }
}

@media (max-width: 720px) {
  .expense-filter-group,
  .expense-editor-grid {
    grid-template-columns: 1fr;
  }

  .expense-card-main {
    display: grid;
    gap: 0.8rem;
  }

  .expense-card-amount {
    justify-items: start;
    text-align: left;
  }

  .expense-card-details {
    display: grid;
  }

  .expense-toolbar .search-field {
    flex-basis: 100%;
  }
}

/* --------------------------------------------------------------------------
   Movimientos v11 — tema oscuro y contraste mejorado
   -------------------------------------------------------------------------- */
.movements-heading { align-items: flex-start; }
.movement-summary-section { align-items: stretch; }
.movement-money-summary { display: contents; }
.movement-money-card { min-width: 220px; }
.movement-money-card small {
  display: block;
  margin-top: .35rem;
  color: var(--muted);
  line-height: 1.4;
}

.movements-panel {
  position: relative;
  overflow: hidden;
  padding: 1.15rem;
  background:
    radial-gradient(circle at 100% 0%, rgba(45, 212, 191, .07), transparent 25rem),
    linear-gradient(145deg, rgba(12, 27, 45, .97), rgba(7, 20, 35, .98));
  border: 1px solid var(--border-strong);
  border-radius: 22px;
  box-shadow: 0 22px 55px rgba(0, 0, 0, .24);
}
.movement-toolbar { margin-bottom: 1.25rem; }
.movement-section + .movement-paid-section { margin-top: 1.25rem; }
.movement-section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: .85rem;
}
.movement-section-heading h3 { margin: .1rem 0 0; color: var(--text); font-size: 1.2rem; }
.movement-count { color: #91a3b8; font-size: .9rem; }
.movement-list { display: grid; gap: .78rem; }

.movement-card,
.movement-statement {
  border: 1px solid rgba(148, 163, 184, .20);
  background:
    linear-gradient(145deg, rgba(18, 41, 67, .96), rgba(10, 27, 47, .98));
  box-shadow: 0 12px 30px rgba(0, 0, 0, .16);
  transition: border-color 160ms ease, transform 160ms ease, box-shadow 160ms ease;
}
.movement-card:hover,
.movement-statement:hover {
  border-color: rgba(94, 234, 212, .35);
  box-shadow: 0 17px 38px rgba(0, 0, 0, .22);
}
.movement-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  align-items: center;
  gap: .95rem;
  padding: 1rem 1.05rem;
  border-radius: 17px;
}
.movement-card-icon,
.movement-paid-icon {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  color: #cbd5e1;
  font-weight: 900;
  background: rgba(148, 163, 184, .10);
  border: 1px solid rgba(148, 163, 184, .15);
  border-radius: 14px;
}
.movement-income .movement-card-icon {
  color: #6ee7b7;
  background: rgba(16, 185, 129, .11);
  border-color: rgba(52, 211, 153, .18);
}
.movement-payment .movement-card-icon {
  color: #fda4af;
  background: rgba(244, 63, 94, .10);
  border-color: rgba(251, 113, 133, .18);
}
.movement-card-main { min-width: 0; }
.movement-card-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: .75rem;
}
.movement-card-heading h3,
.statement-summary-main h3 {
  margin: .12rem 0 .28rem;
  color: var(--text);
  font-size: 1rem;
  letter-spacing: .005em;
  overflow-wrap: anywhere;
}
.movement-type {
  display: block;
  color: #a8b8ca;
  font-size: .73rem;
  font-weight: 800;
  letter-spacing: .055em;
  text-transform: uppercase;
}
.movement-meta {
  display: flex;
  flex-wrap: wrap;
  gap: .45rem .85rem;
  color: #9aabbe;
  font-size: .83rem;
}
.movement-amount { color: #fda4af; white-space: nowrap; }
.amount-positive { color: #6ee7b7; }

.movements-panel .status-badge,
.movement-dialog .status-badge {
  display: inline-flex;
  align-items: center;
  width: max-content;
  padding: .28rem .6rem;
  color: #cbd5e1;
  font-size: .72rem;
  font-weight: 800;
  white-space: nowrap;
  background: rgba(148, 163, 184, .11);
  border: 1px solid rgba(148, 163, 184, .15);
  border-radius: 999px;
}
.movements-panel .status-overdue { color: #fda4af; background: rgba(244, 63, 94, .12); border-color: rgba(251, 113, 133, .22); }
.movements-panel .status-due_today { color: #fde68a; background: rgba(245, 158, 11, .12); border-color: rgba(251, 191, 36, .22); }
.movements-panel .status-pending,
.movements-panel .status-reopened,
.movements-panel .status-partially_paid { color: #fcd34d; background: rgba(234, 179, 8, .10); border-color: rgba(250, 204, 21, .18); }
.movements-panel .status-projected { color: #93c5fd; background: rgba(59, 130, 246, .11); border-color: rgba(96, 165, 250, .20); }
.movements-panel .status-paid,
.movements-panel .status-received { color: #6ee7b7; background: rgba(16, 185, 129, .11); border-color: rgba(52, 211, 153, .19); }
.movements-panel .status-reversed,
.movements-panel .status-paused { color: #b7c5d5; background: rgba(148, 163, 184, .10); border-color: rgba(148, 163, 184, .17); }

.movement-statement { overflow: hidden; border-radius: 18px; }
.movement-statement[open] {
  border-color: rgba(94, 234, 212, .38);
  box-shadow: 0 18px 42px rgba(0, 0, 0, .24), 0 0 0 1px rgba(94, 234, 212, .04);
}
.movement-statement > summary {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: .95rem;
  padding: 1rem 1.05rem;
  list-style: none;
  cursor: pointer;
}
.movement-statement > summary::-webkit-details-marker { display: none; }
.movement-statement > summary::after {
  content: "⌄";
  grid-column: 4;
  color: #a5b4c6;
  font-size: 1.1rem;
  transition: transform .18s ease, color .18s ease;
}
.movement-statement[open] > summary::after { color: var(--accent); transform: rotate(180deg); }
.statement-icon {
  color: #93c5fd;
  background: rgba(59, 130, 246, .12);
  border-color: rgba(96, 165, 250, .20);
}
.statement-summary-main { min-width: 0; }
.statement-totals {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: .25rem;
  min-width: 170px;
  color: var(--text);
  text-align: right;
}
.statement-totals > strong { color: #f8fafc; font-size: 1.08rem; }
.statement-totals small { max-width: 260px; color: #9aabbe; }
.statement-detail {
  padding: .35rem 1.05rem 1.05rem;
  background: rgba(3, 13, 25, .38);
  border-top: 1px solid rgba(148, 163, 184, .14);
}
.statement-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: .9rem;
  padding: .78rem 0;
  border-bottom: 1px solid rgba(148, 163, 184, .12);
}
.statement-item:last-of-type { border-bottom: 0; }
.statement-item > div { min-width: 0; }
.statement-item > div strong,
.statement-item > div span { display: block; }
.statement-item > div strong { color: #edf4fb; }
.statement-item > div span { margin-top: .15rem; color: #91a3b8; font-size: .82rem; }
.statement-item > strong { color: #f8fafc; }
.statement-item.is-projected { opacity: .78; }
.statement-item.is-paid { opacity: .64; text-decoration-color: #64748b; }
.statement-item-status { color: #91a3b8; font-size: .77rem; }
.statement-actions { display: flex; justify-content: flex-end; padding-top: 1rem; }

.movement-paid-section {
  overflow: hidden;
  background: linear-gradient(145deg, rgba(15, 34, 56, .88), rgba(8, 23, 40, .94));
  border: 1px solid rgba(148, 163, 184, .19);
  border-radius: 18px;
}
.movement-paid-section[open] { border-color: rgba(94, 234, 212, .27); }
.movement-paid-section > summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.05rem;
  color: var(--text);
  list-style: none;
  cursor: pointer;
}
.movement-paid-section > summary::-webkit-details-marker { display: none; }
.movement-paid-section > summary span:first-child strong { display: block; margin-top: .1rem; }
.movement-paid-section > summary span:last-child { color: #91a3b8; font-size: .88rem; }
.movement-paid-list { background: rgba(3, 13, 25, .28); border-top: 1px solid rgba(148, 163, 184, .13); }
.movement-paid-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto auto;
  align-items: center;
  gap: .8rem;
  padding: .9rem 1.05rem;
  border-bottom: 1px solid rgba(148, 163, 184, .11);
}
.movement-paid-row:last-child { border-bottom: 0; }
.movement-paid-row:hover { background: rgba(148, 163, 184, .035); }
.movement-paid-row > div:nth-child(2) { min-width: 0; }
.movement-paid-row > div:nth-child(2) strong,
.movement-paid-row > div:nth-child(2) small { display: block; overflow-wrap: anywhere; }
.movement-paid-row > div:nth-child(2) strong { color: #edf4fb; }
.movement-paid-row > div:nth-child(2) small { margin-top: .18rem; color: #91a3b8; }
.movement-empty { padding: 2rem 1rem; }
.movement-empty-inline { padding: 1rem; color: #91a3b8; text-align: center; }

.movement-dialog-card { width: min(720px, calc(100vw - 2rem)); max-height: min(88vh, 900px); overflow: auto; }
.movement-dialog-summary {
  display: flex;
  flex-direction: column;
  gap: .2rem;
  margin-bottom: .9rem;
  padding: .8rem .9rem;
  background: rgba(59, 130, 246, .09);
  border: 1px solid rgba(96, 165, 250, .20);
  border-radius: 13px;
}
.movement-dialog-summary span { color: #a5b4c6; font-size: .86rem; }
.movement-advance-fieldset {
  min-width: 0;
  margin: .8rem 0;
  padding: .8rem;
  border: 1px solid var(--border-strong);
  border-radius: 13px;
}
.movement-advance-fieldset legend { padding: 0 .3rem; font-weight: 750; }
.field-hint { margin: .1rem 0 .7rem; color: var(--muted); font-size: .82rem; }
.advanceable-items { display: grid; gap: .45rem; max-height: 260px; overflow: auto; }
.advanceable-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: .7rem;
  padding: .65rem;
  background: rgba(2, 8, 23, .28);
  border: 1px solid var(--border);
  border-radius: 11px;
  cursor: pointer;
}
.advanceable-item:has(input:checked) { background: rgba(45, 212, 191, .08); border-color: rgba(94, 234, 212, .45); }
.advanceable-item span strong,
.advanceable-item span small { display: block; }
.advanceable-item span small { margin-top: .1rem; color: var(--muted); }
.movement-payment-total {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .8rem 0 .2rem;
  font-size: 1rem;
}
.movement-payment-total strong { font-size: 1.25rem; }

@media (max-width: 900px) {
  .movement-card { grid-template-columns: auto minmax(0, 1fr) auto; }
  .movement-card > .button { grid-column: 2 / -1; justify-self: start; }
  .movement-statement > summary { grid-template-columns: auto minmax(0, 1fr); }
  .movement-statement > summary::after { grid-column: 3; grid-row: 1; }
  .statement-totals { grid-column: 2 / -1; align-items: flex-start; min-width: 0; text-align: left; }
  .movement-paid-row { grid-template-columns: auto minmax(0, 1fr) auto; }
  .movement-paid-row .status-badge { grid-column: 2; }
  .movement-paid-row .movement-amount { grid-column: 3; grid-row: 1 / span 2; }
  .movement-paid-row .button { grid-column: 2 / -1; justify-self: start; }
}

@media (max-width: 620px) {
  .movements-panel { padding: .8rem; border-radius: 17px; }
  .movement-card { grid-template-columns: auto minmax(0, 1fr); padding: .85rem; }
  .movement-card .movement-amount { grid-column: 2; }
  .movement-card > .button { grid-column: 2; }
  .movement-card-heading { display: block; }
  .movement-card-heading .status-badge { margin-top: .38rem; }
  .movement-statement > summary { padding: .85rem; }
  .statement-item { grid-template-columns: minmax(0, 1fr) auto; gap: .45rem; }
  .statement-item-status { grid-column: 1; }
  .statement-item > strong { grid-column: 2; grid-row: 1 / span 2; }
  .movement-paid-row { padding: .78rem; }
  .advanceable-item { grid-template-columns: auto minmax(0, 1fr); }
  .advanceable-item > b { grid-column: 2; }
}

/* ===== Versión 12: acciones de Movimientos como vistas completas ===== */
.movement-subview,
.movement-action-view,
.movement-action-card,
.movement-action-grid,
.movement-action-form,
.movement-action-form .field,
.movement-action-form input,
.movement-action-form select,
.movement-action-form textarea,
.movement-action-form fieldset {
  min-width: 0;
  max-width: 100%;
}

.movement-action-view {
  width: 100%;
  overflow: visible;
}

.movement-action-heading {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  gap: 1.1rem;
  margin-bottom: 1.25rem;
}

.movement-action-heading h2 {
  margin: 0.15rem 0 0;
  font-size: clamp(1.8rem, 4vw, 2.65rem);
  letter-spacing: -0.035em;
}

.movement-action-heading p:last-child {
  max-width: 72ch;
  margin: 0.55rem 0 0;
  color: var(--muted);
  line-height: 1.6;
}

.movement-action-card {
  width: 100%;
  display: grid;
  gap: 1.25rem;
  padding: clamp(1rem, 2.6vw, 1.75rem);
  overflow: visible;
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: 0 18px 55px rgba(0, 0, 0, 0.18);
}

.movement-action-summary {
  display: grid;
  gap: 0.35rem;
  padding: 1rem 1.1rem;
  background: rgba(2, 8, 23, 0.28);
  border: 1px solid var(--border);
  border-radius: 15px;
}

.movement-action-summary strong {
  color: var(--text);
  font-size: 1.05rem;
}

.movement-action-summary span {
  color: var(--muted);
  line-height: 1.5;
}

.movement-action-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  align-items: start;
}

.movement-action-wide {
  grid-column: 1 / -1;
}

.movement-action-form input,
.movement-action-form select,
.movement-action-form textarea {
  width: 100%;
}

.movement-action-view .movement-advance-fieldset {
  width: 100%;
  max-height: none;
  overflow: visible;
}

.movement-action-view .advanceable-items {
  max-height: none;
  overflow: visible;
}

.movement-action-view .advanceable-item {
  grid-template-columns: auto minmax(0, 1fr) auto;
  min-width: 0;
}

.movement-action-view .advanceable-item span,
.movement-action-view .advanceable-item strong,
.movement-action-view .advanceable-item small {
  min-width: 0;
  overflow-wrap: anywhere;
}

.movement-action-buttons {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 0.75rem;
  padding-top: 0.25rem;
}

.movement-action-buttons .button {
  min-width: 9.5rem;
}

@media (max-width: 720px) {
  .movement-action-heading {
    grid-template-columns: 1fr;
  }

  .movement-action-heading .editor-back-button {
    justify-self: start;
  }

  .movement-action-grid {
    grid-template-columns: 1fr;
  }

  .movement-action-wide {
    grid-column: auto;
  }

  .movement-action-buttons {
    display: grid;
    grid-template-columns: 1fr;
  }

  .movement-action-buttons .button {
    width: 100%;
    min-width: 0;
  }

  .movement-action-view .advanceable-item {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .movement-action-view .advanceable-item b {
    grid-column: 2;
    justify-self: start;
  }
}

/* v13: vistas compactas, historiales y listas contraíbles */
.module-compact-bar {
  display: flex;
  align-items: end;
  gap: 1rem;
  margin-bottom: 1.15rem;
  min-height: 3.25rem;
}
.module-compact-spacer { flex: 1 1 auto; }
.movement-period-bar { align-items: end; }
.period-selector,
.detail-period-selector {
  display: flex;
  align-items: end;
  flex-wrap: wrap;
  gap: .75rem;
}
.period-field { min-width: 10.75rem; }
.module-compact-bar .button { flex: 0 0 auto; }

.entity-clickable-row,
.entity-clickable-card { cursor: pointer; }
.entity-clickable-row:hover td,
.entity-clickable-card:hover {
  background-color: rgba(93, 224, 207, .055);
}
.entity-clickable-row:focus-visible,
.entity-clickable-card:focus-visible {
  outline: 2px solid var(--accent, #5ce1cf);
  outline-offset: 3px;
}

.entity-detail-view { display: grid; gap: 1rem; }
.entity-detail-topbar {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 1rem;
  flex-wrap: wrap;
}
.entity-detail-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1.5rem;
  padding: 1.3rem 1.45rem;
  border: 1px solid var(--border-color, #233a52);
  border-radius: 1.25rem;
  background: linear-gradient(135deg, rgba(15, 38, 57, .96), rgba(9, 25, 43, .96));
}
.entity-detail-header h2 { margin: .2rem 0 .35rem; }
.entity-detail-header p { margin: 0; color: var(--muted, #93adca); }
.entity-detail-kicker {
  color: var(--accent, #5ce1cf);
  text-transform: uppercase;
  letter-spacing: .12em;
  font-weight: 800;
  font-size: .76rem;
}
.entity-detail-balance {
  display: grid;
  text-align: right;
  gap: .25rem;
  min-width: 12rem;
}
.entity-detail-balance span,
.credit-detail-metrics small { color: var(--muted, #93adca); }
.entity-detail-balance strong { font-size: clamp(1.5rem, 3vw, 2.2rem); }
.credit-detail-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(8.5rem, 1fr));
  gap: .65rem;
  min-width: min(34rem, 100%);
}
.credit-detail-metrics span {
  display: grid;
  gap: .25rem;
  padding: .75rem .9rem;
  border-radius: .85rem;
  background: rgba(3, 17, 33, .58);
}
.entity-movement-list { display: grid; gap: .65rem; }
.entity-movement-row {
  display: grid;
  grid-template-columns: 8rem minmax(13rem, 1fr) minmax(8rem, auto) minmax(8rem, auto);
  align-items: center;
  gap: 1rem;
  padding: .95rem 1.1rem;
  border: 1px solid var(--border-color, #233a52);
  border-radius: 1rem;
  background: rgba(12, 32, 51, .9);
}
.entity-movement-row.movement-in { border-left: 3px solid #4ce0b3; }
.entity-movement-row.movement-out { border-left: 3px solid #ff8c76; }
.entity-movement-row.is-reversed { opacity: .56; }
.entity-movement-date { color: var(--muted, #93adca); font-size: .9rem; }
.entity-movement-copy { display: grid; gap: .2rem; min-width: 0; }
.entity-movement-copy strong,
.entity-movement-copy span { overflow-wrap: anywhere; }
.entity-movement-copy span { color: var(--muted, #93adca); font-size: .88rem; }
.entity-movement-amount { text-align: right; white-space: nowrap; }
.movement-in .entity-movement-amount { color: #64e4bd; }
.movement-out .entity-movement-amount { color: #ff9a87; }
.entity-movement-balance { display: grid; gap: .12rem; text-align: right; white-space: nowrap; }
.entity-movement-balance small { color: var(--muted, #93adca); }
.compact-empty { padding: 2rem 1rem; }

#credit-cards-grid {
  grid-template-columns: minmax(0, 1fr) !important;
  width: 100%;
}
.credit-card-item {
  width: 100%;
  grid-template-columns: minmax(15rem, 22rem) minmax(0, 1fr);
}

.scheduled-collapsible,
.installment-card-group,
.installment-collapsible {
  border: 1px solid var(--border-color, #233a52);
  border-radius: 1.05rem;
  background: rgba(10, 29, 47, .92);
  overflow: clip;
}
.scheduled-collapsible + .scheduled-collapsible,
.installment-card-group + .installment-card-group { margin-top: .8rem; }
.scheduled-collapsible-summary,
.installment-collapsible-summary,
.installment-card-group > summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.1rem;
  cursor: pointer;
  list-style: none;
}
.scheduled-collapsible-summary::-webkit-details-marker,
.installment-collapsible-summary::-webkit-details-marker,
.installment-card-group > summary::-webkit-details-marker { display: none; }
.scheduled-collapsible-summary h3,
.installment-collapsible-summary h3 { margin: .3rem 0 .25rem; }
.scheduled-collapsible-summary p,
.installment-collapsible-summary p,
.installment-card-group > summary small { margin: 0; color: var(--muted, #93adca); }
.scheduled-collapsible-summary::after,
.installment-collapsible-summary::after {
  content: "⌄";
  font-size: 1.2rem;
  color: var(--muted, #93adca);
  transition: transform .18s ease;
}
.scheduled-collapsible[open] > .scheduled-collapsible-summary::after,
.installment-collapsible[open] > .installment-collapsible-summary::after { transform: rotate(180deg); }
.scheduled-summary-amount { display: grid; gap: .2rem; text-align: right; margin-left: auto; }
.scheduled-summary-amount span { color: var(--muted, #93adca); font-size: .82rem; }
.scheduled-collapsible-body,
.installment-collapsible-body,
.installment-card-group-body {
  padding: 0 1.1rem 1.1rem;
  border-top: 1px solid rgba(76, 110, 143, .35);
}
.installment-card-group > summary span:first-child { display: grid; gap: .2rem; }
.installment-card-group-body { display: grid; gap: .7rem; padding-top: .9rem; }

/* v0.23: grupos MSI horizontales, a todo lo ancho y cerrados por defecto */
#installment-purchases-list,
.installment-card-group,
.installment-card-group-body,
.installment-collapsible {
  width: 100%;
  min-width: 0;
}

#installment-purchases-list {
  grid-template-columns: minmax(0, 1fr);
  align-items: stretch;
}

.installment-card-group-summary {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 1rem;
  width: 100%;
}

.installment-card-group-copy,
.installment-card-group-total {
  min-width: 0;
}

.installment-card-group-copy strong,
.installment-card-group-copy small,
.installment-card-group-total strong,
.installment-card-group-total small {
  overflow-wrap: anywhere;
}

.installment-card-group-total {
  display: grid;
  gap: .18rem;
  text-align: right;
  white-space: nowrap;
}

.installment-card-group-total small {
  color: var(--muted, #93adca);
  font-size: .78rem;
}

.installment-card-group-chevron {
  color: var(--muted, #93adca);
  font-size: 1.2rem;
  transition: transform .18s ease;
}

.installment-card-group[open] > .installment-card-group-summary .installment-card-group-chevron {
  transform: rotate(180deg);
}

.installment-card-group-body {
  grid-template-columns: minmax(0, 1fr);
}

.installment-collapsible-summary {
  width: 100%;
}

.installment-inline-schedule { display: grid; gap: .45rem; margin-top: .85rem; }
.installment-inline-row {
  display: grid;
  grid-template-columns: 6rem 9rem 9rem minmax(7rem, auto) minmax(7rem, auto);
  align-items: center;
  gap: .7rem;
  padding: .65rem .75rem;
  border-radius: .75rem;
  background: rgba(3, 17, 33, .52);
  font-size: .88rem;
}
.installment-inline-row strong { text-align: right; }

@media (max-width: 860px) {
  .entity-detail-header { align-items: stretch; flex-direction: column; }
  .entity-detail-balance { text-align: left; }
  .credit-detail-metrics { grid-template-columns: 1fr; min-width: 0; width: 100%; }
  .entity-movement-row { grid-template-columns: 6.5rem 1fr auto; }
  .entity-movement-balance { grid-column: 2 / -1; text-align: left; display: flex; gap: .45rem; align-items: baseline; }
  .credit-card-item { grid-template-columns: 1fr; }
  .installment-inline-row { grid-template-columns: 1fr 1fr; }
  .installment-inline-row .schedule-status { justify-self: start; }
}

@media (max-width: 600px) {
  .module-compact-bar,
  .entity-detail-topbar,
  .period-selector,
  .detail-period-selector { align-items: stretch; flex-direction: column; }
  .module-compact-bar .button,
  .entity-detail-topbar .button { width: 100%; }
  .period-field { min-width: 0; width: 100%; }
  .entity-movement-row { grid-template-columns: 1fr auto; gap: .45rem .75rem; }
  .entity-movement-date { grid-column: 1 / -1; }
  .entity-movement-copy { grid-column: 1; }
  .entity-movement-amount { grid-column: 2; grid-row: 2; }
  .entity-movement-balance { grid-column: 1 / -1; }
  .scheduled-collapsible-summary,
  .installment-collapsible-summary { align-items: flex-start; }
  .scheduled-summary-amount { display: none; }
  .installment-inline-row { grid-template-columns: 1fr; }
  .installment-inline-row strong { text-align: left; }
  .installment-card-group-summary {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
  }
  .installment-card-group-total {
    grid-column: 1;
    text-align: left;
    white-space: normal;
  }
  .installment-card-group-chevron {
    grid-column: 2;
    grid-row: 1;
  }
}


/* Configuración */
.settings-module {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
}

.settings-grid {
  display: grid;
  gap: 1.25rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.settings-card {
  min-width: 0;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 1rem 1.15rem;
  align-items: start;
  padding: clamp(1.25rem, 2.5vw, 2rem);
  border: 1px solid var(--border);
  border-radius: 22px;
  background:
    linear-gradient(145deg, rgba(18, 42, 67, 0.94), rgba(9, 24, 41, 0.96));
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.2);
}

.settings-card-icon {
  width: 2.8rem;
  height: 2.8rem;
  display: grid;
  place-items: center;
  border-radius: 0.9rem;
  color: #052923;
  background: linear-gradient(145deg, #99f6e4, #2dd4bf);
  font-size: 1.25rem;
  font-weight: 900;
}

.settings-card-copy {
  min-width: 0;
}

.settings-card-copy h2 {
  font-size: clamp(1.2rem, 2vw, 1.55rem);
}

.settings-card-copy > p:last-child,
.settings-card-copy > p:not(.eyebrow) {
  margin: 0.65rem 0 0;
  color: var(--muted);
  line-height: 1.65;
}

.settings-form,
.settings-actions,
.settings-reset-summary {
  grid-column: 1 / -1;
}

.settings-form {
  display: grid;
  gap: 0.9rem;
  padding-top: 0.25rem;
}

.settings-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
}

.settings-danger-card {
  border-color: rgba(251, 113, 133, 0.33);
  background:
    linear-gradient(145deg, rgba(69, 22, 38, 0.56), rgba(25, 18, 31, 0.96));
}

.settings-danger-icon {
  color: #4c0715;
  background: linear-gradient(145deg, #fecdd3, #fb7185);
}

.settings-reset-summary {
  margin: 0;
  padding: 0 0 0 1.2rem;
  color: #d6deea;
  line-height: 1.65;
}

.button-danger {
  color: #fff;
  background: linear-gradient(145deg, #e11d48, #be123c);
  border: 1px solid rgba(253, 164, 175, 0.45);
  box-shadow: 0 10px 25px rgba(190, 18, 60, 0.22);
}

.button-danger:hover:not(:disabled) {
  background: linear-gradient(145deg, #f43f5e, #e11d48);
}

.button-danger:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
}

.settings-reset-view {
  width: 100%;
  max-width: 880px;
  margin: 0 auto;
}

.settings-reset-form {
  display: grid;
  gap: 1rem;
}

.settings-warning-panel {
  padding: 1rem 1.1rem;
  border: 1px solid rgba(251, 113, 133, 0.35);
  border-radius: 16px;
  background: rgba(127, 29, 29, 0.2);
}

.settings-warning-panel strong {
  color: #fecdd3;
}

.settings-warning-panel p {
  margin: 0.35rem 0 0;
  color: #cbd5e1;
  line-height: 1.55;
}

.settings-confirm-check {
  align-items: flex-start;
  padding: 0.9rem 1rem;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(15, 35, 57, 0.58);
}

@media (max-width: 900px) {
  .settings-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .settings-card {
    grid-template-columns: 1fr;
  }

  .settings-card-icon {
    width: 2.55rem;
    height: 2.55rem;
  }

  .settings-actions,
  .settings-actions .button,
  .settings-reset-form .installment-editor-actions,
  .settings-reset-form .installment-editor-actions .button {
    width: 100%;
  }

  .settings-actions,
  .settings-reset-form .installment-editor-actions {
    flex-direction: column-reverse;
  }
}


/* Compras MSI: redondeo mensual compacto */
.installment-rounding-field {
  min-width: 0;
}

.installment-rounding-field select {
  width: 100%;
  max-width: 100%;
}

.installment-rounding-message {
  color: var(--muted);
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.installment-rounding-summary {
  display: grid;
  gap: 0.35rem;
  min-width: 0;
  margin: 0.75rem 0 1rem;
  padding: 0.75rem 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.installment-rounding-summary p {
  min-width: 0;
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.installment-rounding-summary strong {
  color: var(--text);
}

/* ===== Versión 18: acciones de eliminación definitiva ===== */
.installment-actions,
.scheduled-card-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  margin-top: 1rem;
}

.table-action:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* v20: estado de carga de referencias dentro del formulario MSI */
.installment-reference-status {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
  padding: 12px 14px;
  border: 1px solid rgba(116, 199, 236, 0.24);
  border-radius: 12px;
  background: rgba(10, 31, 51, 0.72);
  color: var(--text-muted, #b7c7dc);
}
.installment-reference-status[hidden] { display: none !important; }
.installment-reference-status[data-tone="error"] {
  border-color: rgba(255, 107, 107, 0.45);
  background: rgba(92, 28, 42, 0.42);
  color: #ffe4e6;
}
.installment-reference-status span {
  min-width: 0;
  overflow-wrap: anywhere;
}
.installment-reference-status .button { flex: 0 0 auto; }
@media (max-width: 640px) {
  .installment-reference-status {
    align-items: stretch;
    flex-direction: column;
  }
  .installment-reference-status .button { width: 100%; }
}


/* v0.22: guardado MSI separado de la recarga */
.button[href] { text-decoration: none; }
.topbar-user { display: inline-flex; align-items: center; gap: 0.4rem; flex-wrap: wrap; }
.app-version-badge { display: inline-flex; align-items: center; justify-content: center; min-height: 1.65rem; padding: 0.15rem 0.55rem; border: 1px solid rgba(148, 163, 184, 0.28); border-radius: 999px; background: rgba(15, 23, 42, 0.58); color: #cbd5e1; font-size: 0.75rem; font-weight: 800; line-height: 1; white-space: nowrap; }
.installment-rounding-field select { width: 100%; }
@media (max-width: 640px) { .topbar-user { justify-content: flex-end; } .app-version-badge { flex-basis: auto; } }

/* ===== v0.24: Calendario financiero ===== */
.calendar-module {
  width: 100%;
  max-width: none;
}

.calendar-toolbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: rgba(10, 27, 46, 0.88);
}

.calendar-control {
  display: grid;
  gap: 0.35rem;
  min-width: 0;
}

.calendar-control > span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.calendar-control select,
.calendar-control input {
  min-height: 2.75rem;
  width: 100%;
  min-width: 0;
}

.calendar-account-control {
  flex: 1 1 320px;
  max-width: 520px;
}

.calendar-month-navigation {
  display: flex;
  align-items: end;
  gap: 0.55rem;
}

.calendar-month-navigation .calendar-control {
  width: min(210px, 32vw);
}

.calendar-month-button {
  width: 2.8rem;
  min-width: 2.8rem;
  padding-inline: 0;
}

.calendar-panel {
  width: 100%;
  min-width: 0;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: 22px;
  background: linear-gradient(145deg, rgba(11, 29, 49, 0.96), rgba(7, 19, 34, 0.98));
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.2);
}

.calendar-summary {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.calendar-summary article {
  min-width: 0;
  display: grid;
  gap: 0.35rem;
  padding: 0.9rem 1rem;
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: 14px;
  background: rgba(15, 36, 59, 0.72);
}

.calendar-summary span,
.calendar-day-totals span {
  color: var(--muted);
  font-size: 0.72rem;
}

.calendar-summary strong {
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: clamp(0.95rem, 1.5vw, 1.2rem);
}

.calendar-positive { color: #86efac !important; }
.calendar-negative { color: #fda4af !important; }

.calendar-warnings {
  display: grid;
  gap: 0.65rem;
  margin-bottom: 1rem;
}

.calendar-warning {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 0.75rem;
  align-items: center;
  padding: 0.8rem 0.95rem;
  border: 1px solid rgba(251, 191, 36, 0.3);
  border-radius: 13px;
  background: rgba(120, 53, 15, 0.18);
  color: #fde68a;
}

.calendar-warning span {
  min-width: 0;
  color: #fef3c7;
  overflow-wrap: anywhere;
}

.calendar-warning b {
  white-space: nowrap;
}

.calendar-weekdays {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  border: 1px solid var(--border);
  border-bottom: 0;
  border-radius: 16px 16px 0 0;
  overflow: hidden;
}

.calendar-weekdays span {
  padding: 0.7rem 0.45rem;
  border-right: 1px solid var(--border);
  background: rgba(18, 42, 67, 0.9);
  color: #dbeafe;
  text-align: center;
  font-size: 0.73rem;
  font-weight: 850;
}

.calendar-weekdays span:last-child { border-right: 0; }

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  border-top: 1px solid var(--border);
  border-left: 1px solid var(--border);
  border-radius: 0 0 16px 16px;
  overflow: hidden;
}

.calendar-day-cell {
  min-width: 0;
  min-height: clamp(150px, 14vw, 215px);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 0.55rem;
  padding: 0.7rem;
  border: 0;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  background: rgba(9, 25, 43, 0.74);
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: background 160ms ease, box-shadow 160ms ease;
}

.calendar-day-cell:hover,
.calendar-day-cell:focus-visible {
  z-index: 1;
  background: rgba(22, 52, 82, 0.94);
  box-shadow: inset 0 0 0 2px rgba(45, 212, 191, 0.42);
  outline: none;
}

.calendar-day-placeholder {
  cursor: default;
  background: rgba(5, 15, 27, 0.6);
}

.calendar-day-placeholder:hover { box-shadow: none; background: rgba(5, 15, 27, 0.6); }

.calendar-day-cell.is-today {
  box-shadow: inset 0 0 0 2px rgba(45, 212, 191, 0.65);
  background: rgba(13, 56, 69, 0.45);
}

.calendar-day-cell.has-overdue {
  background-image: linear-gradient(145deg, rgba(127, 29, 29, 0.18), transparent 58%);
}

.calendar-day-cell.has-negative-balance .calendar-day-balance strong {
  color: #fda4af;
}

.calendar-day-number {
  width: 2rem;
  height: 2rem;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.12);
  font-weight: 900;
}

.calendar-day-cell.is-today .calendar-day-number {
  color: #042f2e;
  background: #5eead4;
}

.calendar-day-events-preview {
  min-width: 0;
  display: grid;
  align-content: start;
  gap: 0.35rem;
}

.calendar-day-event {
  min-width: 0;
  display: grid;
  gap: 0.06rem;
  padding: 0.36rem 0.45rem;
  border-radius: 8px;
  background: rgba(15, 35, 57, 0.9);
  font-size: 0.67rem;
}

.calendar-day-event b,
.calendar-day-event em {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.calendar-day-event em {
  color: #cbd5e1;
  font-style: normal;
}

.calendar-day-event.event-in b { color: #86efac; }
.calendar-day-event.event-out b { color: #fda4af; }
.calendar-day-event.status-overdue { border: 1px solid rgba(251, 191, 36, 0.35); opacity: 0.86; }

.calendar-more-events {
  color: var(--muted);
  font-size: 0.66rem;
}

.calendar-day-balance {
  min-width: 0;
  display: grid;
  gap: 0.08rem;
  padding-top: 0.45rem;
  border-top: 1px solid rgba(148, 163, 184, 0.16);
}

.calendar-day-balance small { color: var(--muted); font-size: 0.62rem; }
.calendar-day-balance strong { min-width: 0; overflow-wrap: anywhere; font-size: 0.76rem; }

.calendar-mobile-list { display: none; }

.calendar-day-detail {
  margin-top: 1rem;
  padding: clamp(1rem, 2vw, 1.5rem);
  border: 1px solid var(--border);
  border-radius: 18px;
  background: rgba(12, 31, 51, 0.95);
  scroll-margin-top: 5.5rem;
}

.calendar-day-detail-heading {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.calendar-day-detail-heading h2 { margin-top: 0.2rem; text-transform: capitalize; }

.calendar-day-totals {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.7rem;
  margin-bottom: 1rem;
}

.calendar-day-totals > div {
  min-width: 0;
  display: grid;
  gap: 0.25rem;
  padding: 0.75rem 0.85rem;
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: 12px;
  background: rgba(8, 23, 39, 0.75);
}

.calendar-day-totals strong { overflow-wrap: anywhere; }

.calendar-day-events { display: grid; gap: 0.65rem; }

.calendar-detail-event {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1rem;
  align-items: center;
  padding: 0.8rem 0.9rem;
  border: 1px solid rgba(148, 163, 184, 0.17);
  border-radius: 13px;
  background: rgba(8, 23, 39, 0.7);
}

.calendar-detail-event > div:first-child { min-width: 0; display: grid; gap: 0.15rem; }
.calendar-detail-event > div:first-child span { color: var(--muted); font-size: 0.69rem; }
.calendar-detail-event > div:first-child strong,
.calendar-detail-event > div:first-child small { min-width: 0; overflow-wrap: anywhere; }
.calendar-detail-event > div:first-child small { color: #aebed2; }

.calendar-detail-event-value { display: grid; gap: 0.12rem; text-align: right; }
.calendar-detail-event-value span { color: var(--muted); font-size: 0.68rem; }
.calendar-detail-event.event-in .calendar-detail-event-value b { color: #86efac; }
.calendar-detail-event.event-out .calendar-detail-event-value b { color: #fda4af; }
.calendar-detail-event.status-overdue { border-color: rgba(251, 191, 36, 0.35); }
.calendar-day-empty { margin: 0; color: var(--muted); }

@media (max-width: 1180px) {
  .calendar-summary { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .calendar-day-cell { min-height: 165px; padding: 0.55rem; }
  .calendar-day-event { font-size: 0.62rem; }
}

@media (max-width: 860px) {
  .calendar-toolbar { align-items: stretch; flex-wrap: wrap; }
  .calendar-account-control { flex-basis: 100%; max-width: none; }
  .calendar-month-navigation { flex: 1 1 300px; }
  .calendar-month-navigation .calendar-control { flex: 1; width: auto; }
  .calendar-toolbar > .button:last-child { align-self: end; }
  .calendar-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .calendar-weekdays,
  .calendar-grid { display: none; }
  .calendar-mobile-list { display: grid; gap: 0.55rem; }
  .calendar-mobile-day {
    min-width: 0;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.85rem 0.95rem;
    border: 1px solid var(--border);
    border-radius: 13px;
    background: rgba(10, 29, 49, 0.82);
    color: var(--text);
    text-align: left;
  }
  .calendar-mobile-day > span { min-width: 0; display: grid; gap: 0.15rem; }
  .calendar-mobile-day > span:last-child { text-align: right; }
  .calendar-mobile-day em,
  .calendar-mobile-day small { color: var(--muted); font-size: 0.7rem; font-style: normal; }
  .calendar-mobile-day strong { overflow-wrap: anywhere; }
  .calendar-mobile-day.is-today { border-color: rgba(45, 212, 191, 0.55); }
  .calendar-mobile-day.has-negative-balance strong { color: #fda4af; }
  .calendar-day-totals { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 590px) {
  .calendar-panel { padding: 0.75rem; }
  .calendar-toolbar { padding: 0.8rem; }
  .calendar-toolbar > .button:last-child { width: 100%; }
  .calendar-summary { grid-template-columns: 1fr; }
  .calendar-warning { grid-template-columns: 1fr; gap: 0.25rem; }
  .calendar-warning b { white-space: normal; }
  .calendar-day-detail-heading { flex-direction: column; }
  .calendar-day-detail-heading .button { width: 100%; }
  .calendar-day-totals { grid-template-columns: 1fr; }
  .calendar-detail-event { grid-template-columns: 1fr; }
  .calendar-detail-event-value { text-align: left; }
}

/* Configuración: la seguridad ahora vive dentro del módulo */
.settings-security-card .settings-card-icon {
  font-size: 1rem;
}

/* v0.26 · Copias de seguridad e importación por fases */
.settings-backup-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.settings-backup-view {
  width: 100%;
}

.settings-backup-form {
  display: grid;
  gap: 1.25rem;
}

.backup-select-all,
.backup-section-option,
.backup-mode-option {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}

.backup-select-all {
  font-weight: 700;
}

.backup-section-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

.backup-section-option,
.backup-mode-option {
  min-width: 0;
  padding: 0.9rem 1rem;
  border: 1px solid var(--border-color, rgba(148, 163, 184, 0.25));
  border-radius: 0.9rem;
  background: rgba(15, 23, 42, 0.42);
}

.backup-section-option input,
.backup-mode-option input,
.backup-select-all input {
  flex: 0 0 auto;
  margin-top: 0.2rem;
}

.backup-section-option span,
.backup-mode-option span {
  display: grid;
  min-width: 0;
  gap: 0.2rem;
}

.backup-section-option strong,
.backup-mode-option strong {
  overflow-wrap: anywhere;
}

.backup-section-option small,
.backup-mode-option small {
  color: var(--muted-color, #94a3b8);
  line-height: 1.35;
}

.backup-section-option.is-unavailable {
  opacity: 0.65;
}

.backup-mode-field {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
  margin: 0;
  padding: 0;
  border: 0;
}

.backup-mode-field legend,
.backup-section-title {
  display: block;
  width: 100%;
  margin-bottom: 0.65rem;
  font-weight: 750;
}

.backup-import-preview {
  min-width: 0;
  padding: 1rem;
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 1rem;
  background: rgba(15, 23, 42, 0.34);
}

.backup-placeholder {
  color: var(--muted-color, #94a3b8);
}

.backup-preview-header,
.backup-summary-grid {
  display: grid;
  gap: 0.75rem;
}

.backup-preview-header {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 1rem;
}

.backup-preview-header > div,
.backup-summary-grid > div {
  display: grid;
  min-width: 0;
  gap: 0.2rem;
  padding: 0.75rem;
  border-radius: 0.75rem;
  background: rgba(15, 23, 42, 0.5);
}

.backup-preview-header span,
.backup-summary-grid span {
  color: var(--muted-color, #94a3b8);
  font-size: 0.8rem;
}

.backup-preview-header strong,
.backup-summary-grid strong {
  overflow-wrap: anywhere;
}

.backup-summary-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.backup-dependency-note,
.backup-security-note {
  margin: 0;
}

.backup-dependency-note {
  margin-top: 1rem;
  color: #facc15;
  line-height: 1.45;
}

@media (max-width: 760px) {
  .backup-section-grid,
  .backup-mode-field,
  .backup-preview-header,
  .backup-summary-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .settings-backup-actions .button {
    width: 100%;
  }
}

/* v0.27 — Abonos directos a Compras MSI */
.schedule-status.status-paid_direct {
  background: rgba(57, 191, 133, .14);
  border-color: rgba(57, 191, 133, .34);
  color: #aaf2ce;
}

.schedule-status.status-partial {
  background: rgba(246, 188, 72, .13);
  border-color: rgba(246, 188, 72, .34);
  color: #ffe0a0;
}

.installment-inline-amount {
  display: grid;
  gap: .14rem;
  min-width: 0;
}

.installment-inline-amount strong,
.installment-inline-amount small {
  overflow-wrap: anywhere;
}

.installment-inline-amount small {
  color: var(--muted, #93adca);
  font-size: .72rem;
}

.installment-payment-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: .75rem;
  margin-bottom: 1rem;
}

.installment-payment-summary > span {
  display: grid;
  gap: .25rem;
  min-width: 0;
  padding: .9rem;
  border: 1px solid rgba(145, 177, 213, .16);
  border-radius: 14px;
  background: rgba(16, 42, 71, .56);
}

.installment-payment-summary small,
.installment-payment-preview-heading span,
.installment-payment-preview-row small {
  color: var(--muted, #93adca);
}

.installment-payment-summary strong {
  overflow-wrap: anywhere;
}

.installment-payment-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .85rem;
}

.installment-payment-allocation-preview {
  display: grid;
  gap: .55rem;
  margin-top: 1rem;
  padding: 1rem;
  border: 1px solid rgba(145, 177, 213, .16);
  border-radius: 16px;
  background: rgba(8, 29, 51, .52);
}

.installment-payment-preview-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: .75rem;
  padding-bottom: .45rem;
  border-bottom: 1px solid rgba(145, 177, 213, .13);
}

.installment-payment-preview-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(130px, auto);
  align-items: center;
  gap: .75rem;
  padding: .62rem .7rem;
  border-radius: 12px;
  background: rgba(22, 51, 83, .52);
}

.installment-payment-preview-row strong {
  color: #aaf2ce;
}

.installment-payment-history {
  display: grid;
  gap: .65rem;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(145, 177, 213, .15);
}

.installment-payment-history h4 {
  margin: 0;
}

.installment-payment-history-item {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(180px, .9fr) auto;
  gap: .8rem;
  align-items: center;
  padding: .85rem;
  border: 1px solid rgba(145, 177, 213, .15);
  border-radius: 14px;
  background: rgba(12, 35, 61, .5);
}

.installment-payment-history-item > div {
  display: grid;
  gap: .22rem;
}

.installment-payment-history-item ul {
  margin: 0;
  padding-left: 1.15rem;
  color: var(--muted, #93adca);
  font-size: .82rem;
}

.installment-payment-history-item.is-reversed {
  opacity: .62;
}

.installment-actions .action-primary {
  border-color: rgba(57, 191, 133, .35);
  color: #aaf2ce;
}

@media (max-width: 760px) {
  .installment-payment-summary,
  .installment-payment-grid {
    grid-template-columns: 1fr;
  }

  .installment-payment-preview-heading {
    display: grid;
  }

  .installment-payment-preview-row {
    grid-template-columns: 1fr;
    gap: .2rem;
  }

  .installment-payment-history-item {
    grid-template-columns: 1fr;
  }
}

/* --------------------------------------------------------------------------
   Detalle de tarjetas v0.28 — estados agrupados, sin filtros de fecha
   -------------------------------------------------------------------------- */
.credit-card-statements-view {
  width: 100%;
}
.credit-card-detail-caption {
  max-width: 44rem;
  margin: 0;
  color: var(--muted, #93adca);
  font-size: .9rem;
  text-align: right;
}
.credit-card-planned-account {
  margin-top: .45rem !important;
  color: #b8c8d9 !important;
  font-size: .88rem;
}
.credit-card-statement-section,
.credit-card-paid-statements {
  width: 100%;
  padding: 1.05rem;
  border: 1px solid rgba(148, 163, 184, .18);
  border-radius: 1.25rem;
  background: linear-gradient(145deg, rgba(12, 27, 45, .96), rgba(7, 20, 35, .98));
  box-shadow: 0 18px 42px rgba(0, 0, 0, .18);
}
.credit-card-statement-list {
  display: grid;
  width: 100%;
  gap: .8rem;
}
.credit-card-paid-statements > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  list-style: none;
  cursor: pointer;
}
.credit-card-paid-statements > summary::-webkit-details-marker { display: none; }
.credit-card-paid-statements > summary::after {
  content: "⌄";
  color: #a5b4c6;
  font-size: 1.1rem;
  transition: transform .18s ease, color .18s ease;
}
.credit-card-paid-statements[open] > summary::after {
  color: var(--accent, #5ce1cf);
  transform: rotate(180deg);
}
.credit-card-paid-statements > summary > span:first-child {
  display: grid;
  min-width: 0;
  gap: .2rem;
}
.credit-card-paid-statements > summary strong { color: var(--text); }
.credit-card-paid-statements > summary small { color: var(--muted, #93adca); }
.credit-card-paid-statements[open] > .credit-card-statement-list { margin-top: 1rem; }
.credit-card-statement {
  width: 100%;
}
.credit-card-statement-list .status-badge {
  display: inline-flex;
  align-items: center;
  width: max-content;
  padding: .28rem .6rem;
  color: #cbd5e1;
  font-size: .72rem;
  font-weight: 800;
  white-space: nowrap;
  background: rgba(148, 163, 184, .11);
  border: 1px solid rgba(148, 163, 184, .15);
  border-radius: 999px;
}
.credit-card-statement-list .status-overdue { color: #fda4af; background: rgba(244, 63, 94, .12); border-color: rgba(251, 113, 133, .22); }
.credit-card-statement-list .status-due_today { color: #fde68a; background: rgba(245, 158, 11, .12); border-color: rgba(251, 191, 36, .22); }
.credit-card-statement-list .status-pending,
.credit-card-statement-list .status-reopened,
.credit-card-statement-list .status-partially_paid { color: #fcd34d; background: rgba(234, 179, 8, .10); border-color: rgba(250, 204, 21, .18); }
.credit-card-statement-list .status-projected { color: #93c5fd; background: rgba(59, 130, 246, .11); border-color: rgba(96, 165, 250, .20); }
.credit-card-statement-list .status-paid { color: #6ee7b7; background: rgba(16, 185, 129, .11); border-color: rgba(52, 211, 153, .19); }
.credit-statement-breakdown {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: .65rem;
  margin: .65rem 0 .85rem;
}
.credit-statement-breakdown > span {
  display: grid;
  gap: .25rem;
  padding: .7rem .8rem;
  border: 1px solid rgba(148, 163, 184, .12);
  border-radius: .8rem;
  background: rgba(3, 17, 33, .52);
}
.credit-statement-breakdown small { color: #91a3b8; }
.credit-statement-breakdown strong { color: #f8fafc; }
.credit-statement-credits {
  display: grid;
  gap: .15rem;
  margin-top: .8rem;
  padding-top: .8rem;
  border-top: 1px solid rgba(148, 163, 184, .14);
}
.statement-credit > strong { color: #6ee7b7; }
.statement-credit.is-reversed { opacity: .58; }
.statement-credit.is-reversed > strong { color: #94a3b8; text-decoration: line-through; }

@media (max-width: 860px) {
  .credit-statement-breakdown { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .credit-card-detail-caption { text-align: left; }
}

@media (max-width: 600px) {
  .credit-card-paid-statements > summary { align-items: flex-start; }
  .credit-statement-breakdown { grid-template-columns: 1fr; }
  .credit-card-statement-section,
  .credit-card-paid-statements { padding: .8rem; }
  .credit-card-statement .movement-statement > summary { grid-template-columns: auto minmax(0, 1fr); }
  .credit-card-statement .statement-totals { grid-column: 2 / -1; align-items: flex-start; text-align: left; }
}

/* v0.29 · Abonos parciales a estados programados */
.statement-item.is-partial {
  border-color: rgba(250, 204, 21, .22);
  background: rgba(234, 179, 8, .06);
}
.statement-item.is-partial .statement-item-status,
.statement-item.is-partial > strong { color: #fcd34d; }
.statement-item > div > small {
  display: block;
  margin-top: .2rem;
  color: #94a3b8;
  font-size: .73rem;
}
.statement-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: .65rem;
  margin-top: 1rem;
  padding-top: .85rem;
  border-top: 1px solid rgba(148, 163, 184, .14);
}
.partial-statement-payment-modal {
  width: min(94vw, 920px);
}
.partial-statement-payment-card {
  width: min(94vw, 920px);
  max-width: 920px;
}
.partial-statement-payment-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: .7rem;
  margin: .25rem 0 1rem;
}
.partial-statement-payment-summary > div {
  display: grid;
  gap: .3rem;
  min-width: 0;
  padding: .8rem;
  border: 1px solid rgba(148, 163, 184, .14);
  border-radius: .85rem;
  background: rgba(3, 17, 33, .5);
}
.partial-statement-payment-summary span {
  color: #94a3b8;
  font-size: .76rem;
}
.partial-statement-payment-summary strong {
  color: #f8fafc;
  overflow-wrap: anywhere;
}
.partial-statement-payment-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .85rem;
}
.partial-payment-account,
.partial-payment-notes { grid-column: 1 / -1; }
.partial-payment-preview-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 1.15rem;
}
.partial-payment-preview-heading h3 { margin: .1rem 0 0; }
.partial-payment-preview {
  display: grid;
  gap: .5rem;
  margin-top: .7rem;
}
.partial-payment-allocation {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 1rem;
  padding: .75rem .85rem;
  border: 1px solid rgba(148, 163, 184, .13);
  border-radius: .8rem;
  background: rgba(3, 17, 33, .42);
}
.partial-payment-allocation > div {
  display: grid;
  min-width: 0;
  gap: .22rem;
}
.partial-payment-allocation > div:last-child { text-align: right; }
.partial-payment-allocation span,
.partial-payment-allocation small { color: #94a3b8; }
.partial-payment-allocation b { color: #6ee7b7; }

@media (max-width: 720px) {
  .partial-statement-payment-summary,
  .partial-statement-payment-grid { grid-template-columns: 1fr; }
  .partial-payment-account,
  .partial-payment-notes { grid-column: auto; }
  .partial-payment-preview-heading { align-items: flex-start; flex-direction: column; }
  .partial-payment-allocation { grid-template-columns: 1fr; }
  .partial-payment-allocation > div:last-child { text-align: left; }
  .statement-actions { justify-content: stretch; }
  .statement-actions .button { flex: 1 1 10rem; }
}
