/* ===========================================================================
   components.css  ·  Componentes neuomórficos reutilizables
   =========================================================================== */

/* ---------- Superficies ---------- */
.surface {
  background: var(--bg);
  border-radius: var(--r-lg);
  box-shadow: var(--nm-raised);
}

.surface--sm { box-shadow: var(--nm-raised-sm); border-radius: var(--r-md); }
.surface--lg { box-shadow: var(--nm-raised-lg); border-radius: var(--r-xl); }
.surface--inset { box-shadow: var(--nm-inset); }

.card {
  background: var(--bg);
  border-radius: var(--r-lg);
  box-shadow: var(--nm-raised);
  padding: var(--sp-5);
}

/* ---------- Tipografía utilitaria ---------- */
.eyebrow {
  font-size: var(--fs-xs);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--text-faint);
  font-weight: var(--fw-bold);
}

.muted { color: var(--text-soft); }
.faint { color: var(--text-faint); }

.wordmark {
  font-family: var(--font-display);
  font-weight: var(--fw-bold);
  letter-spacing: var(--tracking-tighter);
  font-size: var(--fs-xl);
  white-space: nowrap;
}
/* Único guiño de acento de toda la interfaz: el punto de marca. */
.wordmark span {
  color: var(--text);
  position: relative;
}
.wordmark span::after {
  content: "";
  display: inline-block;
  width: 0.32em;
  height: 0.32em;
  margin-left: 0.06em;
  border-radius: 50%;
  background: var(--accent);
  vertical-align: baseline;
}

/* ---------- Botones ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  padding: 0.8rem 1.4rem;
  border: none;
  border-radius: var(--r-pill);
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-display);
  font-size: var(--fs-base);
  font-weight: var(--fw-bold);
  letter-spacing: -0.01em;
  cursor: pointer;
  box-shadow: var(--nm-raised-sm);
  transition: box-shadow var(--t-fast), transform var(--t-fast), color var(--t-fast), background var(--t-fast);
  -webkit-user-select: none;
  user-select: none;
}

.btn:hover { box-shadow: var(--nm-raised); }
.btn:active { box-shadow: var(--nm-pressed); transform: translateY(1px); }

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  box-shadow: var(--nm-inset-sm);
}

.btn--block { width: 100%; }

/* Primario: texto en tinta plena, sin acento */
.btn--primary { color: var(--text); }

/* Sólido: relleno de tinta (negro sobre claro / blanco sobre oscuro).
   La CTA contundente del sistema es B/N, no de acento. */
.btn--solid {
  background: var(--text);
  color: var(--bg);
  box-shadow: var(--nm-raised-sm);
}
.btn--solid:hover {
  box-shadow: var(--nm-raised);
  background: color-mix(in srgb, var(--text) 88%, var(--bg));
}
.btn--solid:active { box-shadow: var(--nm-pressed); }
.btn--solid:disabled { background: var(--text); }

.btn--ghost {
  box-shadow: none;
  color: var(--text-soft);
}
.btn--ghost:hover { box-shadow: var(--nm-raised-sm); color: var(--text); }
.btn--ghost:active { box-shadow: var(--nm-pressed); }

.btn--icon {
  width: 46px;
  height: 46px;
  padding: 0;
  border-radius: 50%;
}

.btn--sm { padding: 0.5rem 0.95rem; font-size: var(--fs-sm); }

.btn--danger { color: var(--danger); }

/* ---------- Formularios ---------- */
.field {
  margin-bottom: var(--sp-4);
}

.label {
  display: block;
  margin-bottom: var(--sp-2);
  font-size: var(--fs-sm);
  font-weight: var(--fw-bold);
  letter-spacing: -0.01em;
  color: var(--text);
}

.input,
.select,
.textarea {
  width: 100%;
  padding: 0.75rem 0.95rem;
  background: var(--bg-sunken);
  border: none;
  border-radius: var(--r-sm);
  color: var(--text);
  font-family: inherit;
  font-size: var(--fs-base);
  box-shadow: var(--nm-inset-sm);
  transition: box-shadow var(--t-fast);
}

.select {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  padding-right: 2.6rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  cursor: pointer;
}
.select option {
  background: var(--bg-sunken);
  color: var(--text);
}

.input::placeholder,
.textarea::placeholder { color: var(--text-faint); }

.input:focus,
.select:focus,
.textarea:focus {
  outline: none;
  box-shadow: var(--nm-inset-sm), var(--ring);
}

.textarea { resize: vertical; min-height: 90px; }

.hint {
  margin-top: var(--sp-2);
  font-size: var(--fs-xs);
  color: var(--text-faint);
}

.row-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-2);
}

.link-small {
  font-size: var(--fs-xs);
  font-weight: 600;
}

/* Campo de contraseña con toggle */
.password-wrap { position: relative; }
.password-wrap .input { padding-right: 4rem; }

.password-toggle {
  position: absolute;
  top: 50%;
  right: 0.5rem;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-faint);
  font-size: var(--fs-xs);
  font-weight: 600;
  cursor: pointer;
  padding: 0.3rem 0.5rem;
  border-radius: var(--r-xs);
}
.password-toggle:hover { color: var(--text); }

/* ---------- Switch (toggle de tema) ---------- */
.switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  width: 58px;
  height: 32px;
  border-radius: var(--r-pill);
  background: var(--bg-sunken);
  box-shadow: var(--nm-inset-sm);
  cursor: pointer;
  border: none;
  padding: 0;
}

.switch__thumb {
  position: absolute;
  top: 4px;
  left: 4px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--bg);
  box-shadow: var(--nm-raised-sm);
  display: grid;
  place-items: center;
  font-size: 13px;
  transition: transform var(--t-base);
}

[data-theme="dark"] .switch__thumb {
  transform: translateX(26px);
}

/* ---------- Avatar ---------- */
.avatar {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--bg);
  box-shadow: var(--nm-raised-sm);
  font-family: var(--font-display);
  font-weight: var(--fw-bold);
  font-size: var(--fs-sm);
  color: var(--text);
  flex-shrink: 0;
}

.avatar--lg { width: 56px; height: 56px; font-size: var(--fs-md); }

/* ---------- Badge ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  padding: 0.2rem 0.65rem;
  border-radius: var(--r-pill);
  font-size: var(--fs-xs);
  font-weight: 600;
  background: var(--bg);
  box-shadow: var(--nm-raised-sm);
  color: var(--text-soft);
}

.badge--accent { color: var(--accent); }

/* ---------- Nav items ---------- */
.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  width: 100%;
  padding: 0.8rem 0.95rem;
  border: none;
  background: transparent;
  color: var(--text-soft);
  font-family: var(--font-display);
  font-size: var(--fs-md);
  font-weight: var(--fw-medium);
  letter-spacing: -0.01em;
  border-radius: var(--r-sm);
  cursor: pointer;
  text-align: left;
  transition: color var(--t-fast), box-shadow var(--t-fast);
}

.nav-item__icon {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
}

.nav-item:hover { color: var(--text); }

.nav-item.is-active {
  color: var(--text);
  font-weight: var(--fw-bold);
  background: var(--bg);
  box-shadow: var(--nm-inset-sm);
}

.nav-item.is-active::before {
  content: "";
  position: absolute;
  left: -0.55rem;
  top: 50%;
  transform: translateY(-50%);
  width: 4px;
  height: 62%;
  border-radius: var(--r-pill);
  background: var(--text);
}

/* ---------- Alert (auth) ---------- */
.alert {
  margin-bottom: var(--sp-4);
  padding: 0.75rem 0.95rem;
  border-radius: var(--r-sm);
  font-size: var(--fs-sm);
  line-height: 1.45;
  display: none;
  box-shadow: var(--nm-inset-sm);
}
.alert.show { display: block; }
.alert--error { color: var(--danger); }
.alert--success { color: var(--success); }

/* ---------- Toasts ---------- */
.toast-container {
  position: fixed;
  bottom: var(--sp-5);
  right: var(--sp-5);
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  z-index: 1000;
  max-width: min(360px, calc(100vw - 2rem));
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-3);
  padding: 0.85rem 1rem;
  background: var(--bg);
  border-radius: var(--r-md);
  box-shadow: var(--nm-raised);
  font-size: var(--fs-sm);
  animation: toast-in 0.25s ease;
}

.toast.is-leaving { animation: toast-out 0.2s ease forwards; }

.toast__dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-top: 0.4rem;
  flex-shrink: 0;
  background: var(--text);
}
.toast--success .toast__dot { background: var(--success); }
.toast--error .toast__dot { background: var(--danger); }
.toast--info .toast__dot { background: var(--text); }

.toast__body { flex: 1; }
.toast__title { font-family: var(--font-display); font-weight: var(--fw-bold); }
.toast__msg { color: var(--text-soft); }

@keyframes toast-in {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes toast-out {
  to { opacity: 0; transform: translateX(24px); }
}

/* ---------- Modal ---------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  display: grid;
  place-items: center;
  padding: var(--sp-4);
  z-index: 900;
  animation: fade-in 0.2s ease;
}

.modal {
  width: 100%;
  max-width: 440px;
  background: var(--bg);
  border-radius: var(--r-xl);
  box-shadow: var(--nm-raised-lg);
  padding: var(--sp-6);
  animation: modal-in 0.25s ease;
}

.modal__title { margin-bottom: var(--sp-2); }
.modal__actions {
  display: flex;
  gap: var(--sp-3);
  justify-content: flex-end;
  margin-top: var(--sp-5);
}

@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes modal-in {
  from { opacity: 0; transform: scale(0.96) translateY(8px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

/* ---------- Selector de acento (swatches) ---------- */
.swatches {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-3);
}

.swatch {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  box-shadow: var(--nm-raised-sm);
  position: relative;
}

.swatch.is-active::after {
  content: "";
  position: absolute;
  inset: -5px;
  border-radius: 50%;
  box-shadow: var(--nm-inset-sm);
}

.swatch--custom {
  display: grid;
  place-items: center;
  background: var(--bg);
  color: var(--text-soft);
  overflow: hidden;
}
.swatch--custom input[type="color"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  border: none;
  padding: 0;
}

/* ---------- KPI cards y skeleton (dashboard) ---------- */
.kpi {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  padding: var(--sp-6);
  background: var(--bg);
  border-radius: var(--r-lg);
  box-shadow: var(--nm-raised);
}
.kpi__label {
  font-size: var(--fs-xs);
  color: var(--text-faint);
  font-weight: var(--fw-bold);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
}
.kpi__value {
  font-family: var(--font-display);
  font-size: var(--fs-2xl);
  font-weight: var(--fw-bold);
  letter-spacing: var(--tracking-tighter);
  line-height: 1;
}
.kpi__delta { font-size: var(--fs-sm); font-weight: var(--fw-bold); }
.kpi__delta--up { color: var(--success); }
.kpi__delta--down { color: var(--danger); }

.skeleton {
  position: relative;
  overflow: hidden;
  background: var(--bg-sunken);
  box-shadow: var(--nm-inset-sm);
  border-radius: var(--r-sm);
}
.skeleton::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--shadow-light) 60%, transparent), transparent);
  animation: shimmer 1.4s infinite;
}
.skeleton--text { height: 0.85rem; }
.skeleton--title { height: 2.4rem; width: 50%; }
.skeleton--chart { height: 260px; border-radius: var(--r-lg); }

/* Contenedor de gráficos (Chart.js usa la altura del contenedor) */
.chart-box {
  position: relative;
  height: 260px;
}

/* ===========================================================================
   Dashboard bento
   =========================================================================== */
.bento {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  grid-auto-rows: minmax(10px, auto);
  gap: var(--sp-5);
}

.bento > * { min-width: 0; }

.bento__balance   { grid-column: span 4; }
.bento__spending  { grid-column: span 5; grid-row: span 2; }
.bento__tx        { grid-column: span 3; grid-row: span 2; }
.bento__accounts  { grid-column: span 4; }
.bento__expenses  { grid-column: span 8; }
.bento__savings   { grid-column: span 4; }

@media (max-width: 1200px) {
  .bento { grid-template-columns: repeat(6, 1fr); }
  .bento__balance  { grid-column: span 3; }
  .bento__accounts { grid-column: span 3; }
  .bento__spending { grid-column: span 6; grid-row: auto; }
  .bento__tx       { grid-column: span 6; grid-row: auto; }
  .bento__expenses { grid-column: span 6; }
  .bento__savings  { grid-column: span 6; }
}

@media (max-width: 720px) {
  .bento { grid-template-columns: 1fr; }
  .bento > * { grid-column: span 1 !important; grid-row: auto !important; }
}

/* Card base del bento: relieve y layout en columna */
.tile {
  display: flex;
  flex-direction: column;
  background: var(--bg);
  border-radius: var(--r-lg);
  box-shadow: var(--nm-raised);
  padding: var(--sp-5);
}
.tile__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  margin-bottom: var(--sp-4);
}
.tile__title {
  font-family: var(--font-display);
  font-size: var(--fs-md);
  font-weight: var(--fw-bold);
  letter-spacing: -0.01em;
}
.tile__link {
  font-size: var(--fs-xs);
  font-weight: var(--fw-bold);
  color: var(--text-soft);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}
.tile__link:hover { color: var(--text); }

/* ---- Balance ---- */
.balance__amount {
  font-family: var(--font-display);
  font-size: var(--fs-3xl);
  font-weight: var(--fw-bold);
  letter-spacing: var(--tracking-tighter);
  line-height: 1;
  margin: var(--sp-2) 0 var(--sp-1);
}
.balance__amount .balance__cents { color: var(--text-faint); }
.balance__meta { color: var(--text-soft); font-size: var(--fs-sm); }
.balance__actions {
  display: flex;
  gap: var(--sp-3);
  margin-top: var(--sp-5);
}
.balance__actions .btn { flex: 1; }

/* ---- Mini cuentas ---- */
.acct-list {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
}
.acct {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--r-md);
  background: var(--bg);
  box-shadow: var(--nm-raised-sm);
}
.acct__icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: var(--r-sm);
  background: var(--text);
  color: var(--bg);
  flex-shrink: 0;
}
.acct__info { flex: 1; min-width: 0; }
.acct__alias {
  font-weight: var(--fw-bold);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.acct__bank { font-size: var(--fs-xs); color: var(--text-faint); }
.acct__saldo {
  font-family: var(--font-display);
  font-weight: var(--fw-bold);
  letter-spacing: -0.01em;
  white-space: nowrap;
}

/* ---- Transacciones ---- */
.tx-list { display: flex; flex-direction: column; gap: var(--sp-1); }
.tx {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-2);
  border-radius: var(--r-sm);
}
.tx + .tx { border-top: 1px solid var(--line); }
.tx__icon {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--bg);
  box-shadow: var(--nm-raised-sm);
  flex-shrink: 0;
}
.tx__info { flex: 1; min-width: 0; }
.tx__name {
  font-weight: var(--fw-bold);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tx__date { font-size: var(--fs-xs); color: var(--text-faint); }
.tx__amount {
  font-family: var(--font-display);
  font-weight: var(--fw-bold);
  letter-spacing: -0.01em;
  white-space: nowrap;
}
.tx__amount--in { color: var(--success); }
.tx__amount--out { color: var(--text); }

/* ---- Medidor de ahorro ---- */
.gauge {
  position: relative;
  display: grid;
  place-items: center;
  flex: 1;
  width: 100%;
}
.gauge__center {
  position: absolute;
  top: 58%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  pointer-events: none;
}
.gauge__value {
  font-family: var(--font-display);
  font-size: var(--fs-2xl);
  font-weight: var(--fw-bold);
  letter-spacing: var(--tracking-tighter);
  line-height: 1;
}
.gauge__label {
  font-size: var(--fs-xs);
  color: var(--text-soft);
  font-weight: var(--fw-bold);
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

/* Las tiles con gráfico necesitan que el canvas crezca */
.tile--chart { min-height: 320px; }
.tile--chart .chart-box { flex: 1; height: auto; min-height: 220px; }
.tile--gauge .chart-box { height: 200px; width: 100%; }

@keyframes shimmer { to { transform: translateX(100%); } }

/* ---------- Empty state ---------- */
.empty-state {
  display: grid;
  place-items: center;
  text-align: center;
  gap: var(--sp-3);
  padding: var(--sp-7) var(--sp-5);
  color: var(--text-soft);
}
.empty-state__icon {
  display: grid;
  place-items: center;
  width: 84px;
  height: 84px;
  border-radius: 50%;
  background: var(--bg);
  box-shadow: var(--nm-inset);
  color: var(--text);
}

/* ---------- Popover ---------- */
.popover {
  background: var(--bg);
  border-radius: var(--r-lg);
  box-shadow: var(--nm-raised-lg);
  padding: var(--sp-5);
  min-width: 240px;
}
.popover__title {
  font-size: var(--fs-sm);
  font-weight: 700;
  margin-bottom: var(--sp-3);
}
.popover__section + .popover__section {
  margin-top: var(--sp-5);
}

/* ===========================================================================
   Drawer (panel lateral)
   =========================================================================== */
.drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 950;
  background: rgba(0, 0, 0, 0.45);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  display: flex;
  justify-content: flex-end;
  opacity: 0;
  transition: opacity 0.25s ease;
}
.drawer-backdrop.is-open { opacity: 1; }
.drawer-backdrop.is-leaving { opacity: 0; }

.drawer__panel {
  width: 100%;
  max-width: 620px;
  height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  border-left: 1px solid var(--line-strong);
  box-shadow: -18px 0 48px rgba(0, 0, 0, 0.4);
  transform: translateX(100%);
  transition: transform 0.28s ease;
}
.drawer-backdrop.is-open .drawer__panel { transform: translateX(0); }
.drawer-backdrop.is-leaving .drawer__panel { transform: translateX(100%); }

.drawer__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  padding: var(--sp-5) var(--sp-5) var(--sp-4);
  border-bottom: 1px solid var(--line);
}
.drawer__title {
  font-family: var(--font-display);
  font-size: var(--fs-xl);
  font-weight: var(--fw-bold);
  letter-spacing: var(--tracking-tight);
}
.drawer__close { font-size: 1.6rem; line-height: 1; }

.drawer__body {
  flex: 1;
  overflow-y: auto;
  padding: var(--sp-6, 2rem) var(--sp-6, 2rem) var(--sp-5);
}

/* Tipografía más generosa dentro del drawer */
.drawer__body .label {
  font-size: var(--fs-base);
  margin-bottom: var(--sp-2);
}
.drawer__body .input,
.drawer__body .select,
.drawer__body .textarea {
  padding: 0.95rem 1.1rem;
  font-size: var(--fs-md);
}
.drawer__body .field { margin-bottom: var(--sp-5); }
/* Ítems de compra mantienen escala compacta dentro del drawer */
.drawer__body .item-row .input { padding: 0.5rem 0.6rem; font-size: var(--fs-sm); }
.drawer__body .item-row .select { padding: 0.5rem 1.9rem 0.5rem 0.6rem; font-size: var(--fs-sm); }
.drawer__body .item-row .label { font-size: var(--fs-xs); }
.drawer__foot .btn { font-size: var(--fs-md); padding: 0.9rem 1.4rem; }
.drawer__foot {
  display: flex;
  gap: var(--sp-3);
  justify-content: flex-end;
  padding: var(--sp-4) var(--sp-5);
  border-top: 1px solid var(--line);
}
.drawer__foot .btn--solid { flex: 1; }

/* ===========================================================================
   CRUD: filterbar, listas, segmented, chips
   =========================================================================== */
.page-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  margin-bottom: var(--sp-5);
  flex-wrap: wrap;
}

.filterbar {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-3);
  margin-bottom: var(--sp-5);
  padding: var(--sp-4);
  background: var(--bg);
  border-radius: var(--r-md);
  box-shadow: var(--nm-inset-sm);
}
.filterbar .field { margin-bottom: 0; flex: 1; min-width: 140px; }
.filterbar .input { padding: 0.55rem 0.75rem; font-size: var(--fs-sm); }
.filterbar .select { padding: 0.55rem 2.2rem 0.55rem 0.75rem; font-size: var(--fs-sm); background-position: right 0.7rem center; }

.mini-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: var(--sp-4);
  margin-bottom: var(--sp-5);
}
.mini-stat {
  padding: var(--sp-4) var(--sp-5);
  background: var(--bg);
  border-radius: var(--r-md);
  box-shadow: var(--nm-raised-sm);
}
.mini-stat__label {
  font-size: var(--fs-xs);
  color: var(--text-faint);
  font-weight: var(--fw-bold);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
}
.mini-stat__value {
  font-family: var(--font-display);
  font-size: var(--fs-xl);
  font-weight: var(--fw-bold);
  letter-spacing: var(--tracking-tighter);
  line-height: 1.1;
  margin-top: var(--sp-1);
}

.list { display: flex; flex-direction: column; gap: var(--sp-2); }
.list-row {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-4);
  background: var(--bg);
  border-radius: var(--r-md);
  box-shadow: var(--nm-raised-sm);
  cursor: pointer;
  transition: box-shadow var(--t-fast);
}
.list-row:hover { box-shadow: var(--nm-raised); }
.list-row__main { flex: 1; min-width: 0; }
.list-row__title {
  font-weight: var(--fw-bold);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.list-row__sub { font-size: var(--fs-xs); color: var(--text-faint); margin-top: 0.15rem; }
.list-row__amount {
  font-family: var(--font-display);
  font-weight: var(--fw-bold);
  letter-spacing: -0.01em;
  white-space: nowrap;
}
.list-row__actions {
  display: flex;
  gap: var(--sp-2);
  flex-shrink: 0;
}

.segmented {
  display: flex;
  gap: var(--sp-1);
  padding: var(--sp-1);
  background: var(--bg-sunken);
  border-radius: var(--r-pill);
  box-shadow: var(--nm-inset-sm);
  margin-bottom: var(--sp-4);
}
.segmented__btn {
  flex: 1;
  padding: 0.55rem 0.75rem;
  border: none;
  border-radius: var(--r-pill);
  background: transparent;
  color: var(--text-soft);
  font-family: var(--font-display);
  font-size: var(--fs-sm);
  font-weight: var(--fw-bold);
  cursor: pointer;
  transition: background var(--t-fast), color var(--t-fast), box-shadow var(--t-fast);
}
.segmented__btn.is-active {
  background: var(--bg);
  color: var(--text);
  box-shadow: var(--nm-raised-sm);
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  padding: 0.2rem 0.6rem;
  border-radius: var(--r-pill);
  font-size: var(--fs-xs);
  font-weight: var(--fw-bold);
  background: var(--bg-sunken);
  color: var(--text-soft);
  box-shadow: var(--nm-inset-sm);
}
.chip--shared { color: var(--text); }
.chip--tipo { text-transform: capitalize; }

.code-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--r-sm);
  background: var(--bg-sunken);
  box-shadow: var(--nm-inset-sm);
  font-family: monospace;
  font-size: var(--fs-sm);
  font-weight: var(--fw-bold);
  letter-spacing: 0.12em;
  cursor: pointer;
  border: none;
  color: var(--text);
}
.code-chip:hover { box-shadow: var(--nm-inset); }

.item-row {
  display: grid;
  grid-template-columns: 1fr 90px 70px 90px auto;
  gap: var(--sp-2);
  align-items: end;
  padding: var(--sp-3);
  margin-bottom: var(--sp-2);
  border-radius: var(--r-sm);
  background: var(--bg-sunken);
  box-shadow: var(--nm-inset-sm);
}
.item-row .field { margin-bottom: 0; }
.item-row .label { font-size: var(--fs-xs); margin-bottom: var(--sp-1); }
.item-row .input { padding: 0.5rem 0.6rem; font-size: var(--fs-sm); }
.item-row .select { padding: 0.5rem 1.9rem 0.5rem 0.6rem; font-size: var(--fs-sm); background-position: right 0.55rem center; }

@media (max-width: 600px) {
  .item-row { grid-template-columns: 1fr 1fr; }
  .drawer__panel { max-width: 100%; }
}

.member-row {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) 0;
  border-bottom: 1px solid var(--line);
}
.member-row:last-child { border-bottom: none; }
.member-row__info { flex: 1; min-width: 0; }
.member-row__name { font-weight: var(--fw-bold); }
.member-row__mail { font-size: var(--fs-xs); color: var(--text-faint); }

.bento-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: var(--sp-4);
}
.bento-card {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  padding: var(--sp-5);
  background: var(--bg);
  border-radius: var(--r-lg);
  box-shadow: var(--nm-raised);
  cursor: pointer;
  transition: box-shadow var(--t-fast), transform var(--t-fast);
  container-type: inline-size;
}
.bento-card:hover { box-shadow: var(--nm-raised-lg); transform: translateY(-2px); }
.bento-card__saldo {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 7cqi, var(--fs-2xl));
  font-weight: var(--fw-bold);
  letter-spacing: var(--tracking-tighter);
  line-height: 1.05;
  overflow-wrap: anywhere;
  font-variant-numeric: tabular-nums;
}
.bento-card__alias { font-weight: var(--fw-bold); font-size: var(--fs-md); }
.bento-card__meta { font-size: var(--fs-xs); color: var(--text-faint); }
.bento-card__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
  padding-top: var(--sp-3);
}

.cat-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-5);
}
@media (max-width: 720px) { .cat-columns { grid-template-columns: 1fr; } }
.cat-group__title {
  font-family: var(--font-display);
  font-size: var(--fs-md);
  font-weight: var(--fw-bold);
  margin-bottom: var(--sp-3);
}
.cat-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-4);
  margin-bottom: var(--sp-2);
  border-radius: var(--r-sm);
  background: var(--bg);
  box-shadow: var(--nm-raised-sm);
}
.cat-item__name { font-weight: var(--fw-bold); }
.cat-item--system { opacity: 0.75; cursor: default; }
.cat-item--system:hover { box-shadow: var(--nm-raised-sm); }

.form-errors {
  margin-bottom: var(--sp-4);
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--sp-2);
  background: color-mix(in srgb, var(--danger) 12%, transparent);
  color: var(--danger);
  font-size: var(--fs-sm);
  display: none;
}
.form-errors.show { display: block; }

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  padding: var(--sp-3) 0;
}
.toggle-row .label { margin-bottom: 0; }

/* ===========================================================================
   Form page (subpágina de alta/edición a ancho completo)
   =========================================================================== */
.form-page {
  max-width: 900px;
  margin: 0 auto;
}
.form-page__head {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  margin-bottom: var(--sp-6);
}
.form-page__head .eyebrow { margin-bottom: 0.15rem; }
.form-page__head h1 {
  font-family: var(--font-display);
  font-size: var(--fs-2xl);
  font-weight: var(--fw-bold);
  letter-spacing: var(--tracking-tighter);
  line-height: 1;
}
.form-page__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  margin-top: var(--sp-6);
  padding-top: var(--sp-5);
  border-top: 1px solid var(--line);
}
.form-page__foot-main { display: flex; gap: var(--sp-3); margin-left: auto; }
.form-page__foot .btn { font-size: var(--fs-md); padding: 0.9rem 1.6rem; }

/* Campos en dos columnas cuando hay espacio */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 var(--sp-5);
}
@media (max-width: 640px) { .form-grid { grid-template-columns: 1fr; } }

/* Tipografía generosa dentro del formulario de subpágina */
.form-page .label { font-size: var(--fs-base); }
.form-page .input,
.form-page .select,
.form-page .textarea {
  padding: 0.95rem 1.1rem;
  font-size: var(--fs-md);
}
.form-page .field { margin-bottom: var(--sp-5); }
.form-page .segmented { margin-bottom: var(--sp-5); }
.form-page .segmented__btn { font-size: var(--fs-base); padding: 0.7rem 1rem; }
/* Los ítems de compra mantienen su escala compacta */
.form-page .item-row .input { padding: 0.5rem 0.6rem; font-size: var(--fs-sm); }
.form-page .item-row .select { padding: 0.5rem 1.9rem 0.5rem 0.6rem; font-size: var(--fs-sm); }
.form-page .item-row .label { font-size: var(--fs-xs); }
.form-page .item-row .field { margin-bottom: 0; }
