/* ==========================================================================
   Raya — components.css
   Component classes composed by the MVC views, transcribed from the Claude
   Design handoff prototype (design-reference/Raya.dc.html). Token values
   live in tokens/*.css (copied verbatim from design-reference/ — never edit
   them); this file may only reference var(--token).
   ========================================================================== */

/* ==========================================================================
   1. BASE
   ========================================================================== */

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg-app);
  font-family: var(--font-sans);
  color: var(--text-body);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--brand-primary); text-decoration: none; }
a:hover { color: var(--brand-primary-hover); text-decoration: underline; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--slate-300); border-radius: 99px; }

/* ---- Utilities ---- */
.tabular { font-variant-numeric: tabular-nums; }
.scroll-x { overflow-x: auto; }
.scroll-x::-webkit-scrollbar { height: 8px; }
.text-positive { color: var(--success); }
.text-negative { color: var(--danger); }
.text-muted { color: var(--text-muted); }

/* Caps micro-label (section eyebrows, stat labels, table headers) */
.eyebrow {
  font-family: var(--font-brand);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: var(--tracking-caps);
}

/* Page-level heading (screen sections) */
.page-title {
  font-family: var(--font-brand);
  font-size: 20px;
  font-weight: 500;
  color: var(--text-strong);
}
.page-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin: 0 0 22px;
  max-width: 560px;
}

/* ==========================================================================
   2. APP SHELL — sidebar + topbar + content + mobile tabs
   ========================================================================== */

.app-shell {
  display: flex;
  min-height: 100vh;
  width: 100%;
  background: var(--bg-app);
}

/* ---- Desktop sidebar ---- */
.sidebar {
  width: var(--sidebar-width);
  flex: none;
  background: var(--surface-card);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  padding: 24px 14px;
  gap: 4px;
  transition: width var(--dur-base) var(--ease-standard);
}
.sidebar__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 4px 22px;
}
.sidebar__brand img { width: 30px; height: 30px; object-fit: contain; flex: none; }
.sidebar__brand-name {
  font-family: var(--font-brand);
  font-weight: 400;
  font-size: 18px;
  letter-spacing: var(--tracking-heading);
  color: var(--text-strong); /* = ink-900 in light; stays readable in dark */
  text-transform: uppercase;
  white-space: nowrap;
}
.sidebar__nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 12px;
  border-radius: var(--radius-md);
  border: none;
  background: transparent;
  color: var(--text-body);
  font: 500 14px var(--font-sans);
  cursor: pointer;
  text-align: left;
  min-height: 44px;
  text-decoration: none;
}
.sidebar__nav-item:hover { background: var(--slate-50); color: var(--text-body); text-decoration: none; }
.sidebar__nav-item.is-active { background: var(--purple-100); color: var(--purple-600); }
.sidebar__nav-item.is-disabled { opacity: 0.4; cursor: not-allowed; }
.sidebar__nav-item.is-disabled:hover { background: transparent; }
.sidebar__nav-item svg { flex: none; }
.sidebar__nav-item span { white-space: nowrap; }
.sidebar__toggle { margin-top: 8px; color: var(--text-muted); font-size: 13px; }
.sidebar__toggle svg { transition: transform var(--dur-base) var(--ease-standard); }
.sidebar__footer {
  margin-top: auto;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 4px 4px;
}
.sidebar__footer-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-strong);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Collapsed state (toggled by the layout script) */
.sidebar.is-collapsed { width: var(--sidebar-width-collapsed); }
.sidebar.is-collapsed .sidebar__brand,
.sidebar.is-collapsed .sidebar__footer { justify-content: center; }
.sidebar.is-collapsed .sidebar__nav-item { justify-content: center; padding: 11px 0; }
.sidebar.is-collapsed .sidebar__nav-item span,
.sidebar.is-collapsed .sidebar__brand-name,
.sidebar.is-collapsed .sidebar__footer div { display: none; }
.sidebar.is-collapsed .sidebar__toggle svg { transform: rotate(180deg); }

/* ---- Main column ---- */
.app-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 24px;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--surface-card);
}
.topbar__title {
  font-family: var(--font-brand);
  font-size: 19px;
  font-weight: 500;
  color: var(--text-strong);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.topbar__brand-mark { width: 26px; height: 26px; object-fit: contain; flex: none; display: none; }

.app-content {
  flex: 1;
  overflow-y: auto;
  padding: 28px 32px 100px;
}

/* ---- Mobile bottom tabs ---- */
.mobile-tabs {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  height: 64px;
  background: var(--surface-card);
  border-top: 1px solid var(--border-subtle);
  display: none;
  align-items: stretch;
  box-shadow: 0 -4px 16px rgba(30, 18, 61, 0.06);
  z-index: 20;
}
.mobile-tabs__item {
  flex: 1;
  border: none;
  background: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--text-muted);
  cursor: pointer;
  min-height: 44px;
  text-decoration: none;
}
.mobile-tabs__item span { font-size: 10.5px; font-weight: 500; }
.mobile-tabs__item.is-active { color: var(--purple-600); }
.mobile-tabs__item:hover { text-decoration: none; }
.mobile-tabs__item.is-disabled { opacity: 0.4; cursor: not-allowed; }

/* ---- Floating action button (mobile) ---- */
.fab {
  position: fixed;
  right: 20px;
  bottom: 80px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--grad-brand);
  border: none;
  box-shadow: var(--shadow-lg);
  display: none;
  align-items: center;
  justify-content: center;
  color: var(--white);
  cursor: pointer;
  z-index: 21;
}

/* ---- Responsive: below desktop the sidebar hides, tabs + FAB appear ---- */
@media (max-width: 1023px) {
  .sidebar { display: none; }
  .mobile-tabs { display: flex; }
  .fab { display: flex; }
  .topbar__brand-mark { display: block; }
  .topbar__title { font-size: 17px; }
  .app-content { padding: 18px 16px 100px; }
}

/* ==========================================================================
   3. BUTTONS
   ========================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 42px;
  padding: 0 20px;
  font-family: var(--font-brand);
  font-size: 15px;
  font-weight: 400;
  letter-spacing: 0.01em;
  line-height: 1;
  border-radius: var(--radius-pill);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease-standard),
              border-color var(--dur-fast) var(--ease-standard),
              box-shadow var(--dur-fast) var(--ease-standard),
              transform var(--dur-fast) var(--ease-standard);
  white-space: nowrap;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  text-decoration: none;
  /* primary (default) */
  background: var(--brand-primary);
  color: var(--text-on-brand);
  box-shadow: var(--shadow-sm);
}
.btn:hover { text-decoration: none; color: var(--text-on-brand); }
.btn:focus-visible { outline: none; box-shadow: var(--shadow-focus); }
.btn:not(:disabled):active { transform: translateY(1px) scale(0.99); }
.btn:disabled { cursor: not-allowed; opacity: 0.5; }

.btn:not(:disabled):not(.btn--secondary):not(.btn--ghost):not(.btn--inverse):hover {
  filter: brightness(1.06);
  box-shadow: var(--shadow-md);
}

/* Sizes */
.btn--sm { height: 34px; padding: 0 14px; font-size: 13px; gap: 7px; }
.btn--lg { height: 50px; padding: 0 28px; font-size: 16px; gap: 10px; }
.btn--full { width: 100%; }

/* Variants */
.btn--secondary {
  background: var(--surface-card);
  color: var(--text-strong);
  border-color: var(--border-default);
  box-shadow: none;
}
.btn--secondary:hover { color: var(--text-strong); border-color: var(--border-strong); background: var(--slate-50); }
.btn--ghost { background: transparent; color: var(--brand-primary); box-shadow: none; }
.btn--ghost:hover { background: var(--purple-100); color: var(--brand-primary); }
.btn--inverse { background: var(--surface-inverse); color: var(--text-on-inverse); box-shadow: none; }
.btn--inverse:hover { filter: brightness(1.18); }

.btn--danger { background: var(--danger); }

/* Gradient fills (primary CTAs) */
.btn--grad-brand  { background: var(--grad-brand); }
.btn--grad-purple { background: var(--grad-purple); }
.btn--grad-green  { background: var(--grad-green); }
.btn--grad-blue   { background: var(--grad-blue); }
.btn--grad-orange { background: var(--grad-orange); }

/* Quiet square icon button */
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  padding: 0;
  color: var(--slate-500);
  background: transparent;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease-standard),
              color var(--dur-fast) var(--ease-standard),
              transform var(--dur-fast) var(--ease-standard);
}
.icon-btn:hover { background: var(--slate-100); color: var(--text-strong); }
.icon-btn:active { transform: scale(0.94); }
.icon-btn:focus-visible { outline: none; box-shadow: var(--shadow-focus); }
.icon-btn--bordered { border: 1px solid var(--border-subtle); background: var(--surface-card); width: 40px; height: 40px; color: var(--text-body); }

/* Theme toggle (topbar): moon in light, sun in dark — prototype Raya.dc.html */
.theme-toggle .theme-toggle__sun { display: none; }
.theme-toggle .theme-toggle__moon { display: block; }
:root[data-theme="dark"] .theme-toggle .theme-toggle__sun { display: block; }
:root[data-theme="dark"] .theme-toggle .theme-toggle__moon { display: none; }

/* ==========================================================================
   4. BADGE (status pill) & TAG (category chip)
   ========================================================================== */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 22px;
  padding: 0 10px;
  font-family: var(--font-brand);
  font-size: 12px;
  letter-spacing: 0.02em;
  line-height: 1;
  border-radius: var(--radius-pill);
  background: var(--slate-100);
  color: var(--slate-600);
}
.badge--purple { background: var(--purple-100); color: var(--purple-700); }
.badge--green  { background: var(--green-100);  color: var(--green-700); }
.badge--blue   { background: var(--blue-100);   color: var(--blue-700); }
.badge--orange { background: var(--orange-100); color: var(--orange-700); }
.badge--danger { background: var(--danger-bg);  color: var(--danger); }

.badge--solid { background: var(--slate-500); color: var(--white); }
.badge--solid.badge--purple { background: var(--purple-500); }
.badge--solid.badge--green  { background: var(--green-500); }
.badge--solid.badge--blue   { background: var(--blue-500); }
.badge--solid.badge--orange { background: var(--orange-500); }
.badge--solid.badge--danger { background: var(--danger); }

.tag {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 28px;
  padding: 0 12px;
  font-family: var(--font-brand);
  font-size: 13px;
  border-radius: var(--radius-sm);
  background: var(--slate-100);
  color: var(--ink-800);
  border: 1px solid var(--slate-200);
}
.tag--purple { background: var(--purple-100); color: var(--purple-700); border-color: var(--purple-300); }
.tag--green  { background: var(--green-100);  color: var(--green-700);  border-color: var(--green-300); }
.tag--blue   { background: var(--blue-100);   color: var(--blue-700);   border-color: var(--blue-300); }
.tag--orange { background: var(--orange-100); color: var(--orange-700); border-color: var(--orange-300); }

/* ==========================================================================
   5. ALERT (inline banner) — uses the standard sans per the prototype
   ========================================================================== */

.alert {
  display: flex;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  background: var(--info-bg);
  border-left: 3px solid var(--info);
}
.alert--success { background: var(--success-bg); border-left-color: var(--success); }
.alert--warning { background: var(--warning-bg); border-left-color: var(--warning); }
.alert--danger  { background: var(--danger-bg);  border-left-color: var(--danger); }

.alert__content { flex: 1; min-width: 0; }
.alert__title { font-size: 14px; color: var(--text-strong); margin-bottom: 3px; }
.alert__body { font-size: 13px; color: var(--text-body); line-height: 1.5; }

/* ==========================================================================
   6. FORMS — fields use the standard sans (Redsans is for labels/buttons)
   ========================================================================== */

.field {
  width: 100%;
  height: 44px;
  font-family: var(--font-sans);
  font-size: 15px;
  color: var(--text-strong);
  background: var(--surface-card);
  border: 1.5px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: 0 14px;
  outline: none;
  transition: border-color var(--dur-fast) var(--ease-standard),
              box-shadow var(--dur-fast) var(--ease-standard);
}
.field:hover:not(:disabled):not(:focus) { border-color: var(--border-strong); }
.field:focus { border-color: var(--purple-400); box-shadow: var(--shadow-focus); }
.field::placeholder { color: var(--slate-400); }
.field:disabled { background: var(--slate-100); cursor: not-allowed; opacity: 0.7; }
.field--invalid { border-color: var(--danger); }
.field--sm { height: 36px; font-size: 14px; padding: 0 10px; }
.field--lg { height: 52px; font-size: 16px; padding: 0 16px; }

select.field {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 40px;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%237b7491' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
}

textarea.field {
  height: auto;
  padding: 12px 14px;
  line-height: 1.5;
  resize: vertical;
}

/* Input with a leading icon/symbol (e.g. "$") */
.field-wrap { position: relative; width: 100%; }
.field-wrap .field { padding-left: 40px; }
.field-wrap__icon {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--slate-400);
  display: inline-flex;
  pointer-events: none;
}

/* Label + control + helper/error */
.form-field { display: flex; flex-direction: column; gap: 7px; }
.form-field > label {
  font-family: var(--font-brand);
  font-size: 13px;
  font-weight: 400;
  color: var(--text-strong);
  letter-spacing: 0.01em;
}
.form-field__required { color: var(--danger); margin-left: 3px; }
.form-field__helper { font-family: var(--font-brand); font-size: 12px; color: var(--text-muted); }
.form-field__error  { font-family: var(--font-brand); font-size: 12px; color: var(--danger); }

/* ---- Form layout: stacked fields with breathing room between lines ---- */
.form-stack { display: flex; flex-direction: column; gap: 16px; }
.form-row   { display: flex; gap: 12px; }
.form-row > * { flex: 1; min-width: 0; }

/* ---- Custom dropdown (Dropdown.dc.html) — replaces the generic <select> ----
   Markup: .dd > hidden input + .dd__trigger + .dd__panel > .dd__option */
.dd { position: relative; min-width: 0; font-family: var(--font-sans); }
.dd__trigger {
  width: 100%;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 12px 0 14px;
  background: var(--surface-card);
  border: 1.5px solid var(--border-default);
  border-radius: var(--radius-md);
  cursor: pointer;
  font-family: var(--font-sans);
  font-size: 15px;
  color: var(--text-strong);
  text-align: left;
  transition: border-color 120ms var(--ease-standard), box-shadow 120ms var(--ease-standard);
}
.dd--sm .dd__trigger { height: 40px; font-size: 14px; }
.dd__trigger.is-placeholder { color: var(--text-muted); }
.dd.is-open .dd__trigger {
  border-color: var(--focus-ring);
  box-shadow: 0 0 0 3px rgba(155, 140, 241, 0.25);
}
.dd__value { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dd__chevron { flex: none; transform: rotate(0deg); transition: transform 160ms var(--ease-standard); }
.dd.is-open .dd__chevron { transform: rotate(180deg); }
.dd__panel {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 100%;
  width: max-content;
  max-width: 280px;
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 6px;
  z-index: 50;
  max-height: 264px;
  overflow-y: auto;
  overflow-x: hidden;
  animation: ddIn 130ms var(--ease-standard);
  display: none;
}
.dd.is-open .dd__panel { display: block; }
/* Opens upward when there isn't room below (e.g. near a dialog's scroll edge). */
.dd__panel--up { top: auto; bottom: calc(100% + 6px); }
/* Right-aligned panel: for dropdowns near a dialog's right edge, where a
   max-content panel anchored left would spill outside the frame. */
.dd--right .dd__panel { left: auto; right: 0; }
.dd__option {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  cursor: pointer;
  font-family: var(--font-sans);
  font-size: 14px;
  color: var(--text-body);
  text-align: left;
  min-height: 40px;
}
.dd__option:hover { background: var(--slate-100); }
.dd__option.is-selected { background: var(--purple-100); color: var(--brand-primary); }
.dd__option[hidden] { display: none; }
.dd__dot { width: 8px; height: 8px; border-radius: 50%; flex: none; background: transparent; }
.dd__option-label { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dd__option-sub { flex: none; font-size: 12px; color: var(--text-muted); white-space: nowrap; }
.dd__option.is-selected .dd__option-sub { color: var(--brand-primary); opacity: 0.75; }
.dd__check { flex: none; color: var(--brand-primary); display: none; }
.dd__option.is-selected .dd__check { display: inline-flex; }
/* Group header in a multi dd: toggles all its options (e.g. a whole month). */
.dd__group {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 10px 4px;
  border: none;
  background: transparent;
  cursor: pointer;
  font-family: var(--font-brand);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
  color: var(--text-muted);
  text-align: left;
}
.dd__group:hover, .dd__group.is-selected { color: var(--brand-primary); }
@keyframes ddIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }

/* ---- Tipo segmented (Registrar movimiento dialog): sliding Gasto/Ingreso pill ---- */
.tipo-seg {
  position: relative;
  display: flex;
  padding: 4px;
  background: var(--slate-100);
  border-radius: var(--radius-pill);
}
.tipo-seg__slider {
  position: absolute;
  top: 4px; bottom: 4px; left: 4px;
  width: calc(50% - 4px);
  background: var(--danger-bg);
  border-radius: var(--radius-pill);
  box-shadow: var(--shadow-xs);
  transition: left 260ms var(--ease-standard), background 260ms var(--ease-standard);
}
.tipo-seg:has(input[value="Ingreso"]:checked) .tipo-seg__slider { left: 50%; background: var(--success-bg); }
.tipo-seg__opt {
  position: relative;
  z-index: 1;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-radius: var(--radius-pill);
  padding: 9px 0;
  font: 500 13px var(--font-brand);
  cursor: pointer;
  min-height: 40px;
  color: var(--text-muted);
  transition: color 200ms var(--ease-standard);
}
.tipo-seg__opt input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; }
.tipo-seg__opt:has(input[value="Gasto"]:checked)   { color: var(--danger); }
.tipo-seg__opt:has(input[value="Ingreso"]:checked) { color: var(--success); }

/* Movement variant (cuenta detalle dialog): Apartado (left, success) / Retiro (right, danger) */
.tipo-seg:has(input[value="Apartado"]:checked) .tipo-seg__slider { background: var(--success-bg); }
.tipo-seg:has(input[value="Retiro"]:checked) .tipo-seg__slider { left: 50%; background: var(--danger-bg); }
.tipo-seg__opt:has(input[value="Apartado"]:checked) { color: var(--success); }
.tipo-seg__opt:has(input[value="Retiro"]:checked)   { color: var(--danger); }

/* Three-option variant (cuenta detalle dialog: Apartado / Retiro / Transferencia) */
.tipo-seg--3 .tipo-seg__slider { width: calc(33.333% - 4px); }
.tipo-seg--3:has(input[value="Retiro"]:checked) .tipo-seg__slider { left: 33.333%; }
.tipo-seg--3:has(input[value="Transferencia"]:checked) .tipo-seg__slider { left: 66.666%; background: var(--blue-100); }
.tipo-seg__opt:has(input[value="Transferencia"]:checked) { color: var(--blue-600); }

/* ---- Estado segmented (Registrar movimiento dialog): Pendiente/Apartado/Pagado pills ---- */
.est-seg { display: flex; gap: 8px; }
.est-seg__opt {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 44px;
  padding: 0 8px;
  border-radius: var(--radius-md);
  cursor: pointer;
  font: 500 13px var(--font-brand);
  border: 1.5px solid var(--border-default);
  background: var(--surface-card);
  color: var(--text-muted);
}
.est-seg__opt input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; }
.est-seg__dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.est-seg__opt--pendiente .est-seg__dot { background: var(--warning); }
.est-seg__opt--apartado  .est-seg__dot { background: var(--info); }
.est-seg__opt--pagado    .est-seg__dot { background: var(--success); }
.est-seg__opt--pendiente:has(input:checked) { border-color: var(--warning); background: var(--warning-bg); color: var(--warning); }
.est-seg__opt--apartado:has(input:checked)  { border-color: var(--info); background: var(--info-bg); color: var(--info); }
.est-seg__opt--pagado:has(input:checked)    { border-color: var(--success); background: var(--success-bg); color: var(--success); }

/* ---- Inline "Real" editor (Transacciones): label button swaps to an input ---- */
.real-edit { display: inline-flex; align-items: center; }
.real-edit__label {
  border: none;
  background: none;
  padding: 2px 4px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.real-edit__label svg { opacity: 0.5; }
.real-edit__input {
  width: 88px;
  text-align: right;
  font-size: 13px;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--purple-400);
  outline: none;
  font-variant-numeric: tabular-nums;
}
.real-edit__label[hidden],
.real-edit__input[hidden] { display: none; }

/* ---- Checkbox / Radio (CSS-only, hidden native input) ---- */
.checkbox, .radio {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-family: var(--font-brand);
  font-size: 15px;
  color: var(--text-body);
  user-select: none;
}
.checkbox input, .radio input, .switch input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  margin: 0;
}
.checkbox__control {
  position: relative;
  width: 20px; height: 20px; flex: none;
  border-radius: var(--radius-xs);
  border: 1.5px solid var(--border-strong);
  background: var(--surface-card);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background var(--dur-fast) var(--ease-standard),
              border-color var(--dur-fast) var(--ease-standard);
}
.checkbox__control svg { visibility: hidden; }
.checkbox input:checked + .checkbox__control { background: var(--purple-500); border-color: var(--purple-500); }
.checkbox input:checked + .checkbox__control svg { visibility: visible; }
.checkbox input:focus-visible + .checkbox__control { box-shadow: var(--shadow-focus); }

.radio__control {
  position: relative;
  width: 20px; height: 20px; flex: none;
  border-radius: var(--radius-pill);
  border: 1.5px solid var(--border-strong);
  background: var(--surface-card);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: border-color var(--dur-fast) var(--ease-standard);
}
.radio__control::after {
  content: "";
  width: 10px; height: 10px;
  border-radius: var(--radius-pill);
  background: var(--purple-500);
  transform: scale(0);
  transition: transform var(--dur-fast) var(--ease-standard);
}
.radio input:checked + .radio__control { border-color: var(--purple-500); }
.radio input:checked + .radio__control::after { transform: scale(1); }
.radio input:focus-visible + .radio__control { box-shadow: var(--shadow-focus); }

/* ---- Switch ---- */
.switch {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  font-family: var(--font-brand);
  font-size: 15px;
  color: var(--text-body);
  user-select: none;
  position: relative;
}
.switch__track {
  position: relative;
  width: 44px; height: 26px; flex: none;
  border-radius: var(--radius-pill);
  background: var(--slate-300);
  transition: background var(--dur-base) var(--ease-standard);
}
.switch__track::after {
  content: "";
  position: absolute;
  top: 3px; left: 3px;
  width: 20px; height: 20px;
  border-radius: var(--radius-pill);
  background: var(--white);
  box-shadow: var(--shadow-sm);
  transition: left var(--dur-base) var(--ease-out);
}
.switch input:checked + .switch__track { background: var(--purple-500); }
.switch input:checked + .switch__track::after { left: 21px; }
.switch input:focus-visible + .switch__track { box-shadow: var(--shadow-focus); }

/* ---- Selectable option card (pay-cycle radios) ---- */
.choice-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--border-subtle);
  background: var(--surface-card);
  cursor: pointer;
  min-height: 44px;
  transition: border-color var(--dur-fast) var(--ease-standard),
              background var(--dur-fast) var(--ease-standard);
}
.choice-card.is-selected,
.choice-card:has(input:checked) { border-color: var(--purple-400); background: var(--sel-active-bg); }
.choice-card__title { font-size: 14px; font-weight: 500; color: var(--text-strong); }
.choice-card__desc { font-size: 12px; color: var(--text-muted); }

/* ---- Segmented pill toggle (Gasto | Ingreso) ---- */
.segmented {
  display: flex;
  gap: 8px;
  padding: 4px;
  background: var(--slate-100);
  border-radius: var(--radius-pill);
}
.segmented__option {
  flex: 1;
  border: none;
  border-radius: var(--radius-pill);
  padding: 9px 0;
  font: 500 13px var(--font-brand);
  cursor: pointer;
  min-height: 40px;
  background: transparent;
  color: var(--text-muted);
  transition: background var(--dur-fast) var(--ease-standard),
              color var(--dur-fast) var(--ease-standard);
}
.segmented__option.is-active,
.segmented__option:has(input:checked) { background: var(--surface-card); color: var(--text-strong); box-shadow: var(--shadow-xs); }

/* ==========================================================================
   7. CARDS & SURFACES
   ========================================================================== */

.card {
  position: relative;
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.card--padded { padding: 22px; }
.card--interactive { transition: transform var(--dur-base) var(--ease-out), box-shadow var(--dur-base) var(--ease-out); cursor: pointer; }
.card--interactive:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.card__accent {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
  background: var(--grad-brand);
}

/* ---- Stat / total card (dashboard) ---- */
.stat-card {
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 20px;
}
.stat-card__label { margin-bottom: 8px; }        /* combine with .eyebrow */
.stat-card__value {
  font-size: 26px;
  font-weight: 500;
  color: var(--text-strong);
  font-variant-numeric: tabular-nums;
}
/* This rule loses to the .text-positive/.text-negative utilities only with the
   extra specificity — .stat-card__value alone would win by source order. */
.stat-card__value.text-positive { color: var(--success); }
.stat-card__value.text-negative { color: var(--danger); }
.stat-card--inverse {
  background: var(--ink-900);
  border: none;
  box-shadow: var(--shadow-md);
}
.stat-card__sub {
  margin-top: 4px;
  font-size: 12px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}
.stat-card--inverse .stat-card__label { color: rgba(255, 255, 255, 0.65); }
.stat-card--inverse .stat-card__value.text-positive { color: var(--positive-on-inverse); }
.stat-card--inverse .stat-card__value.text-negative { color: var(--negative-on-inverse); }
.stat-card--inverse .stat-card__sub { color: rgba(255, 255, 255, 0.65); }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
}

/* ---- Period strip card (próximas quincenas) ---- */
.period-strip {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 8px;
}
.period-card {
  flex: none;
  width: 190px;
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 16px;
  box-shadow: var(--shadow-xs);
}
.period-card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}
.period-card__label { font-family: var(--font-brand); font-size: 13px; font-weight: 500; color: var(--text-strong); }
.period-card__range { font-size: 11px; color: var(--text-muted); margin-bottom: 12px; }
.period-card__balance { font-size: 19px; font-weight: 500; font-variant-numeric: tabular-nums; color: var(--success); }
.period-card__balance.text-negative { color: var(--danger); }
.period-card__today {
  font-size: 10px;
  font-weight: 600;
  color: var(--ink-900);
  background: var(--white);
  border-radius: var(--radius-pill);
  padding: 2px 8px;
  letter-spacing: var(--tracking-caps);
}
.period-card--current {
  background: var(--period-current-bg);
  border: none;
  box-shadow: var(--shadow-md);
}
.period-card--current .period-card__label { color: var(--white); }
.period-card--current .period-card__range { color: rgba(255, 255, 255, 0.6); }
.period-card--current .period-card__balance { color: var(--positive-on-inverse); }
.period-card--current .period-card__balance.text-negative { color: var(--negative-on-inverse); }

/* ---- Simple list card (pagos de esta quincena, periodos generados) ---- */
.list-card { overflow: hidden; }                  /* combine with .card */
.list-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-subtle);
}
.list-row:last-child { border-bottom: none; }
.list-row__main { min-width: 0; flex: 1; }
.list-row__title {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-strong);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.list-row__amount {
  font-size: 15px;
  font-weight: 500;
  color: var(--text-strong);
  flex: none;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* ---- Empty state ---- */
.empty-state {
  max-width: 520px;
  margin: 60px auto;
  text-align: center;
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 48px 32px;
}
.empty-state__icon {
  width: 64px; height: 64px;
  border-radius: var(--radius-lg);
  background: var(--purple-100);
  color: var(--purple-500);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
}
.empty-state__title { font-size: 19px; font-weight: 500; color: var(--text-strong); margin-bottom: 8px; }
.empty-state__body { font-size: 14px; line-height: 1.6; color: var(--text-muted); margin: 0 0 24px; }

/* ==========================================================================
   8. DATA TABLE (transacciones, plantillas)
   ========================================================================== */

.table-card { overflow-x: auto; }                 /* combine with .card */
.table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
}
.table th {
  padding: 12px 10px;
  background: var(--slate-50);
  border-bottom: 1px solid var(--border-subtle);
  font-family: var(--font-brand);
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: var(--tracking-caps);
  text-align: left;
}
.table td {
  padding: 14px 10px;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 13px;
  color: var(--text-muted);
  vertical-align: middle;
}
.table th:first-child, .table td:first-child { padding-left: 18px; }
.table th:last-child,  .table td:last-child  { padding-right: 18px; }
.table tr:last-child td { border-bottom: none; }
.table tbody tr { transition: background var(--dur-fast) var(--ease-standard); }
.table tbody tr:hover { background: var(--slate-50); }
.table .is-inactive td { opacity: 0.5; }

.table__title { font-size: 14px; font-weight: 500; color: var(--text-strong); }
.table .cell-num { text-align: right; font-variant-numeric: tabular-nums; }
.table .cell-center { text-align: center; }

/* ---- Prototype grid table: white card + CSS grid, headers slate-50 ----
   Markup: .gtable-card > .gtable (grid-template-columns inline per screen)
   Cells: .gtable__th / .gtable__td; rows use display:contents wrappers. */
.gtable-card {
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow-x: auto;
}
.gtable { display: grid; column-gap: 0; padding: 0; }
.gtable__row { display: contents; }
.gtable__th {
  padding: 12px 10px;
  background: var(--slate-50);
  border-bottom: 1px solid var(--border-subtle);
  font-family: var(--font-brand);
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: var(--tracking-caps);
}
.gtable__td {
  padding: 14px 10px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  font-size: 13px;
  color: var(--text-muted);
  min-width: 0;
}
.gtable__th:first-child, .gtable__td:first-child { padding-left: 18px; }
.gtable__th:last-child,  .gtable__td:last-child  { padding-right: 18px; padding-left: 10px; }
.gtable__td--strong { font-size: 14px; font-weight: 500; color: var(--text-strong); }
.gtable__td--num { justify-content: flex-end; font-size: 14px; font-weight: 500; text-align: right; font-variant-numeric: tabular-nums; }
.gtable__td--stack { flex-direction: column; align-items: flex-start; justify-content: center; gap: 3px; }
.gtable__name { font-size: 14px; font-weight: 500; color: var(--text-strong); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }

/* Mobile card list (isCardView < 768px) */
/* ---- Row selection (transactions): checkbox column + live summary bar ---- */
.tx-check {
  width: 17px;
  height: 17px;
  accent-color: var(--purple-500);
  cursor: pointer;
  flex: none;
}
.gtable__th.gtable__th--check,
.gtable__td.gtable__td--check { justify-content: center; padding-left: 14px; padding-right: 6px; }
.gtable__row.is-selected > .gtable__td { background: var(--sel-active-bg); }
.selbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 18px;
  padding: 12px 16px;
  margin-bottom: 14px;
  background: var(--surface-sunken);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
}
.selbar[hidden] { display: none; }
.selbar__count { font-family: var(--font-brand); font-size: 13px; font-weight: 600; color: var(--text-strong); }
.selbar__stat { font-size: 13px; color: var(--text-muted); }
.selbar__value { font-weight: 600; font-variant-numeric: tabular-nums; }
.selbar__value--pos { color: var(--success); }
.selbar__value--neg { color: var(--danger); }
.selbar__clear {
  margin-left: auto;
  border: none;
  background: none;
  padding: 0;
  font-size: 12px;
  color: var(--brand-primary);
  cursor: pointer;
}

.tpl-cards { display: none; flex-direction: column; gap: 10px; }
@media (max-width: 767px) {
  .gtable-card { display: none; }
  .tpl-cards { display: flex; }
}
.tpl-card {
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 16px;
}
.tpl-card__head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; margin-bottom: 8px; }
.tpl-card__title { font-size: 15px; font-weight: 500; color: var(--text-strong); }
.tpl-card__meta { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.tpl-card__foot { display: flex; justify-content: space-between; align-items: center; padding-top: 10px; border-top: 1px solid var(--border-subtle); }

/* Inline editable amount (Real column) */
.amount-edit {
  border: none;
  background: none;
  padding: 2px 4px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-strong);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-variant-numeric: tabular-nums;
}
.amount-edit svg { opacity: 0.5; }
.amount-edit--income { color: var(--success); }
.amount-edit__input {
  width: 88px;
  text-align: right;
  font-size: 13px;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--purple-400);
  outline: none;
  font-variant-numeric: tabular-nums;
}

/* Small pill action ("pagar") in rows */
.btn-pill-sm {
  border: 1px solid var(--border-subtle);
  background: var(--surface-card);
  border-radius: var(--radius-pill);
  padding: 6px 14px;
  font-family: var(--font-brand);
  font-size: 12px;
  color: var(--text-body);
  cursor: pointer;
  white-space: nowrap;
  transition: border-color var(--dur-fast) var(--ease-standard), background var(--dur-fast) var(--ease-standard);
}
.btn-pill-sm:hover { border-color: var(--border-strong); background: var(--slate-50); }

/* Sortable header (prototype: chevron 0.35 → 1, active column purple, asc rotates 180°) */
a.gtable__th--sort {
  display: flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  user-select: none;
  text-decoration: none;
  color: var(--text-muted);
}
a.gtable__th--sort:hover { color: var(--text-strong); text-decoration: none; }
a.gtable__th--sort svg { flex: none; opacity: 0.35; transition: transform 160ms ease, opacity 160ms ease; }
a.gtable__th--sort.is-active { color: var(--purple-600); }
a.gtable__th--sort.is-active:hover { color: var(--purple-600); }
a.gtable__th--sort.is-active svg { opacity: 1; }

/* Pager (prototype buildPager: 34px square buttons, active page purple) */
.pager {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 16px;
}
.pager__info { font-size: 13px; color: var(--text-muted); font-family: var(--font-brand); }
.pager__nav { display: flex; align-items: center; gap: 6px; }
.pager__btn {
  min-width: 34px;
  height: 34px;
  padding: 0 8px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background: var(--surface-card);
  color: var(--text-body);
  font-family: var(--font-brand);
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  transition: border-color var(--dur-fast) var(--ease-standard), background var(--dur-fast) var(--ease-standard);
}
a.pager__btn:hover { border-color: var(--border-strong); background: var(--slate-50); color: var(--text-body); text-decoration: none; }
.pager__btn--active { background: var(--purple-600); color: var(--white); border-color: var(--purple-600); }
.pager__btn--disabled { opacity: 0.4; }
.pager__ellipsis { min-width: 20px; text-align: center; color: var(--text-muted); font-size: 13px; }

/* Search pill above the tables (prototype "Buscar…" input) */
.searchbox { position: relative; flex: 1 1 220px; min-width: 200px; max-width: 340px; }
.searchbox--wide { flex: none; width: 100%; max-width: none; }
.searchbox svg { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); pointer-events: none; }
.searchbox input {
  width: 100%;
  height: 40px;
  padding: 0 14px 0 38px;
  border-radius: var(--radius-pill);
  border: 1.5px solid var(--border-subtle);
  background: var(--surface-card);
  font-family: var(--font-brand);
  font-size: 14px;
  color: var(--text-body);
  outline: none;
  box-sizing: border-box;
}
.searchbox input:focus { border-color: var(--purple-400); box-shadow: var(--shadow-focus); }
.searchbox input::-webkit-search-cancel-button { cursor: pointer; }

/* ==========================================================================
   9. PROGRESS BAR (desglose por categoría)
   ========================================================================== */

.progress {
  height: 6px;
  background: var(--slate-100);
  border-radius: 99px;
  overflow: hidden;
}
.progress__fill {
  height: 100%;
  background: var(--purple-500);
  border-radius: 99px;
}

/* Chart legend dot */
.legend-dot {
  width: 9px; height: 9px;
  border-radius: 2px;
  display: inline-block;
}

/* ==========================================================================
   10. CUENTAS (resumen strip, tree table, detalle)
   ========================================================================== */

/* Dashboard "Resumen de cuentas" card (prototype stripCards: 210×130, hover lift) */
.acct-card {
  flex: none;
  width: 210px;
  height: 130px;
  display: flex;
  flex-direction: column;
  text-align: left;
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 16px;
  box-shadow: var(--shadow-xs);
  cursor: pointer;
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  transition: box-shadow 160ms var(--ease-standard), transform 160ms var(--ease-standard);
}
.acct-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); text-decoration: none; }

/* Savings blue dot next to the account name */
.acct-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--blue-500);
  flex: none;
}

/* Detail header: content left, sparkline/CTA column right; stacks on mobile */
.acct-head {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 24px;
  align-items: center;
}
@media (max-width: 760px) {
  .acct-head { grid-template-columns: 1fr; }
}

/* 34px bordered icon action (prototype table actions) */
.icon-btn--sm { width: 34px; height: 34px; border: 1px solid var(--border-subtle); background: var(--surface-card); border-radius: var(--radius-md); }

/* ==========================================================================
   11. AVATAR — auto-tinted initials
   ========================================================================== */

.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px; height: 40px;
  flex: none;
  border-radius: var(--radius-pill);
  background: var(--purple-100);
  color: var(--purple-700);
  font-family: var(--font-brand);
  font-size: 16px;
  letter-spacing: 0.02em;
  overflow: hidden;
  user-select: none;
}
.avatar--sm { width: 32px; height: 32px; font-size: 13px; }
.avatar--lg { width: 52px; height: 52px; font-size: 21px; }
.avatar--green  { background: var(--green-100);  color: var(--green-700); }
.avatar--blue   { background: var(--blue-100);   color: var(--blue-700); }
.avatar--orange { background: var(--orange-100); color: var(--orange-700); }

/* ==========================================================================
   12. DIALOG — works with the native <dialog> element
   ========================================================================== */

dialog.dialog {
  width: 460px;
  max-width: calc(100% - 32px);
  /* Cap to the viewport so a tall form never clips its footer; body scrolls instead. */
  max-height: calc(100vh - 32px);
  max-height: calc(100dvh - 32px);
  background: var(--surface-card);
  border: none;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  padding: 0;
  flex-direction: column;
  animation: dlgPop var(--dur-base) var(--ease-out);
}
/* Only lay out as a flex column when open — otherwise the browser's default
   `dialog:not([open]) { display: none }` must win, or the modal shows on load. */
dialog.dialog[open] { display: flex; }
/* The <form> (or a bare child) fills the dialog so the body can flex-scroll. */
dialog.dialog[open] > form { display: flex; flex-direction: column; min-height: 0; flex: 1 1 auto; }
dialog.dialog::backdrop {
  background: rgba(30, 18, 61, 0.42);
  backdrop-filter: blur(2px);
  animation: dlgFade var(--dur-base) var(--ease-out);
}
.dialog__body { padding: 24px 24px 20px; font-family: var(--font-sans); font-size: 15px; color: var(--text-body); line-height: 1.6; overflow-y: auto; flex: 1 1 auto; min-height: 0; }
.dialog__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 10px;
}
.dialog__title { font-family: var(--font-brand); font-size: 20px; color: var(--text-strong); letter-spacing: 0.01em; }
.dialog__close {
  flex: none;
  width: 30px; height: 30px;
  border: none;
  background: transparent;
  cursor: pointer;
  color: var(--slate-500);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
}
.dialog__footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 24px;
  background: var(--slate-50);
  border-top: 1px solid var(--border-subtle);
  flex: none;                       /* always visible; never scrolls away */
  border-radius: 0 0 var(--radius-xl) var(--radius-xl);
}
.dialog__form-stack { display: flex; flex-direction: column; gap: 14px; }

/* Confirmation variant (shared _ConfirmDialog partial): narrower, message-only body. */
dialog.dialog--confirm { width: 400px; }

/* Short dialogs whose dropdown panels must escape the frame (prototype's
   dialogOverflowProps on the movement dialog): panels then size and flip
   against the viewport instead of the body's scroll clip. */
dialog.dialog--overflow { overflow: visible; }
dialog.dialog--overflow .dialog__body { overflow-y: visible; }

@keyframes dlgFade { from { opacity: 0; } to { opacity: 1; } }
@keyframes dlgPop  { from { opacity: 0; transform: translateY(8px) scale(0.98); } to { opacity: 1; transform: none; } }

/* ==========================================================================
   13. CALENDARIO DE PAGOS (PayPeriods slice)
   ========================================================================== */

.calendar-grid {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 20px;
  align-items: start;
}
@media (max-width: 1023px) {
  .calendar-grid { grid-template-columns: 1fr; }
}

/* Generated period row (right column of the calendar screen) */
.period-row {
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-xs);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.period-row__title { font-size: 14px; font-weight: 500; color: var(--text-strong); }
.period-row__range { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.period-row__pay { font-size: 12px; color: var(--text-muted); text-align: right; }
.period-row__pay strong { color: var(--text-strong); font-weight: 500; }

/* ============================================================
   Auth (páginas públicas: entrar, registro, contraseña)
   Tarjeta centrada máx. 440px sobre --bg-app, según Auth.dc.html
   ============================================================ */
.auth-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 16px;
  background: var(--bg-app);
}
.auth-card {
  width: 100%;
  max-width: 440px;
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 38px 34px;
}
.auth-brand { display: flex; flex-direction: column; align-items: center; gap: 11px; margin-bottom: 24px; }
.auth-brand img { width: 40px; height: 40px; object-fit: contain; }
.auth-brand span {
  font-family: var(--font-brand);
  font-size: 20px;
  letter-spacing: var(--tracking-heading);
  color: var(--text-strong); /* = ink-900 in light; stays readable in dark */
  text-transform: uppercase;
  line-height: 1;
}
.auth-head { text-align: center; margin-bottom: 26px; }
.auth-head h1, .auth-title {
  font-family: var(--font-brand);
  font-weight: 400;
  font-size: 23px;
  color: var(--text-strong);
  margin: 0;
}
.auth-head p { font-size: 14px; color: var(--text-muted); line-height: 1.55; margin: 8px 0 0; }
.auth-form { display: flex; flex-direction: column; gap: 20px; }
.auth-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: -2px; }
.auth-foot { text-align: center; margin-top: 22px; font-size: 13px; color: var(--text-muted); }
.auth-center { text-align: center; }
.auth-center .auth-title { margin-bottom: 10px; }
.auth-text { font-size: 14px; color: var(--text-muted); line-height: 1.6; margin: 0 0 26px; }
.auth-text strong { color: var(--text-strong); font-weight: 400; }
.auth-icon {
  width: 66px;
  height: 66px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
}
.auth-icon--info    { background: var(--purple-100); color: var(--purple-500); }
.auth-icon--success { background: var(--success-bg); color: var(--success); }
.auth-icon--danger  { background: var(--danger-bg); color: var(--danger); }
.auth-icon--neutral { background: var(--surface-sunken); color: var(--slate-500); }
.auth-badge {
  display: inline-block;
  font-family: var(--font-brand);
  font-size: 12px;
  letter-spacing: 0.14em;
  color: var(--purple-600);
  background: var(--purple-100);
  border-radius: var(--radius-pill);
  padding: 4px 14px;
  margin-bottom: 16px;
}
@media (max-width: 480px) {
  .auth-card { padding: 30px 24px; }
}
