*, *::before, *::after { box-sizing: border-box; }
html { font-size: 100%; }
body { margin: 0; font-family: var(--mf-font-sans); font-size: var(--mf-fs-md); line-height: var(--mf-lh-body); background: var(--mf-color-bg); color: var(--mf-color-text); }
.skip { position: absolute; left: -999px; top: 0; background: var(--mf-color-surface); color: var(--mf-color-text); padding: var(--mf-space-3); z-index: 100; }
.skip:focus { left: 0; }
:focus-visible { outline: 3px solid var(--mf-color-focus); outline-offset: 2px; }
/* Focos programáticos del router (main, h1 con tabindex=-1): no son controles, sin anillo; teclado real sigue con :focus-visible en botones, enlaces e inputs */
[tabindex="-1"]:focus, [tabindex="-1"]:focus-visible { outline: none; }
h1 { font-size: var(--mf-fs-lg); margin: 0 0 var(--mf-space-4); }
h2 { font-size: var(--mf-fs-md); margin: 0 0 var(--mf-space-2); }
.shell { min-height: 100vh; display: flex; flex-direction: column; }
.topbar { background: var(--mf-color-secondary); color: #FFFFFF; padding: var(--mf-space-3) var(--mf-space-4); display: flex; align-items: center; justify-content: space-between; }
.topbar strong { font-size: var(--mf-fs-md); }
main { flex: 1; padding: var(--mf-space-4); padding-bottom: calc(96px + env(safe-area-inset-bottom, 0px)); max-width: 720px; width: 100%; margin: 0 auto; }
.shell--sin-nav main { padding-bottom: var(--mf-space-4); }
.shell--sin-nav .toasts { bottom: var(--mf-space-4); }
.tabs { position: fixed; bottom: 0; left: 0; right: 0; padding-bottom: env(safe-area-inset-bottom, 0px); background: var(--mf-color-surface); border-top: 1px solid var(--mf-color-border); display: flex; z-index: 10; }
.tabs a { flex: 1; min-height: var(--mf-tabs-h); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; text-decoration: none; color: var(--mf-color-text-muted); font-size: var(--mf-fs-xs); }
.tabs a[aria-current="page"] { color: var(--mf-color-primary); font-weight: 700; box-shadow: inset 0 3px 0 var(--mf-color-primary); }
.tabs .ico { font-size: var(--mf-fs-lg); line-height: 1; }
.card { background: var(--mf-color-surface); border: 1px solid var(--mf-color-surface-2); border-radius: var(--mf-radius-md); box-shadow: var(--mf-shadow-1); padding: var(--mf-space-4); margin-bottom: var(--mf-space-3); }
.hero { background: var(--mf-color-primary); color: var(--mf-color-primary-contrast); }
.hero .big { font-size: var(--mf-fs-3xl); font-weight: 700; font-variant-numeric: tabular-nums; }
.row { display: flex; justify-content: space-between; align-items: center; gap: var(--mf-space-3); }
.muted { color: var(--mf-color-text-muted); font-size: var(--mf-fs-sm); }
.num { font-variant-numeric: tabular-nums; font-weight: 600; }
.income { color: var(--mf-color-income); } .expense { color: var(--mf-color-expense); }
.list { list-style: none; margin: 0; padding: 0; }
.list li { border-bottom: 1px solid var(--mf-color-surface-2); }
.list a, .list .item { display: flex; justify-content: space-between; align-items: center; gap: var(--mf-space-3); padding: var(--mf-space-3) 0; min-height: var(--mf-row-h); color: inherit; text-decoration: none; }
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: var(--mf-ctl-h); min-width: var(--mf-ctl-h); padding: 0 var(--mf-space-5); border-radius: var(--mf-radius-pill); border: 2px solid var(--mf-color-primary); background: var(--mf-color-primary); color: var(--mf-color-primary-contrast); font: inherit; font-weight: 700; cursor: pointer; text-decoration: none; }
.btn.secondary { background: transparent; color: var(--mf-color-primary); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.field { margin-bottom: var(--mf-space-4); }
.field label { display: block; font-weight: 600; margin-bottom: var(--mf-space-1); }
.field input, .field select, .field textarea { width: 100%; min-height: var(--mf-ctl-h); padding: var(--mf-space-2) var(--mf-space-3); font: inherit; color: var(--mf-color-text); background: var(--mf-color-surface); border: 2px solid var(--mf-color-border); border-radius: var(--mf-radius-sm); }
.field .err { color: var(--mf-color-danger); font-size: var(--mf-fs-sm); margin-top: var(--mf-space-1); }
.banner { padding: var(--mf-space-3) var(--mf-space-4); border-left: 6px solid var(--mf-color-warning); background: var(--mf-color-surface); color: var(--mf-color-text); margin-bottom: var(--mf-space-3); border-radius: var(--mf-radius-sm); }
.banner.danger { border-left-color: var(--mf-color-danger); }
.skeleton { height: 72px; border-radius: var(--mf-radius-md); background: var(--mf-color-surface-2); margin-bottom: var(--mf-space-3); animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .5; } }
.empty, .errbox { text-align: center; padding: var(--mf-space-6) var(--mf-space-4); }
.toasts { position: fixed; left: var(--mf-space-4); right: var(--mf-space-4); bottom: 76px; z-index: 20; display: grid; gap: var(--mf-space-2); }
.toast { background: var(--mf-color-secondary); color: #FFFFFF; padding: var(--mf-space-3) var(--mf-space-4); border-radius: var(--mf-radius-md); display: flex; justify-content: space-between; align-items: center; gap: var(--mf-space-3); }
.toast.error { background: var(--mf-color-danger); }
.toast .btn { min-height: 44px; padding: 0 var(--mf-space-3); background: transparent; border-color: #FFFFFF; color: #FFFFFF; }
.bar { height: 14px; background: var(--mf-color-surface-2); border-radius: var(--mf-radius-pill); overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--mf-color-primary); }
.bar > span.w0{width:0}.bar > span.w10{width:10%}.bar > span.w20{width:20%}.bar > span.w30{width:30%}.bar > span.w40{width:40%}.bar > span.w50{width:50%}.bar > span.w60{width:60%}.bar > span.w70{width:70%}.bar > span.w80{width:80%}.bar > span.w90{width:90%}.bar > span.w100{width:100%}
.badge { display: inline-block; padding: 2px var(--mf-space-2); border-radius: var(--mf-radius-pill); border: 1px solid var(--mf-color-border); font-size: var(--mf-fs-xs); }
.bubble { max-width: 85%; padding: var(--mf-space-3); border-radius: var(--mf-radius-md); margin-bottom: var(--mf-space-2); background: var(--mf-color-surface); border: 1px solid var(--mf-color-surface-2); }
.bubble.mine { margin-left: auto; background: var(--mf-color-surface-2); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
@media (min-width: 900px) {
  .shell { flex-direction: row; }
  .tabs { position: sticky; top: 0; bottom: auto; flex-direction: column; width: 220px; height: 100vh; border-top: 0; border-right: 1px solid var(--mf-color-border); }
  .tabs a { flex: 0 0 auto; flex-direction: row; justify-content: flex-start; padding: 0 var(--mf-space-4); gap: var(--mf-space-3); }
  .col { flex: 1; display: flex; flex-direction: column; }
  main { padding-bottom: var(--mf-space-4); }
  .toasts { left: 240px; bottom: var(--mf-space-4); max-width: 420px; }
  .shell--sin-nav .toasts { left: var(--mf-space-4); }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* Gráficos (J.1/J.5): colores solo por clases (CSP sin estilos en línea) y siempre con etiqueta de texto */
.chart { margin: 0 0 var(--mf-space-4); }
.chart figcaption { font-weight: 700; margin-bottom: var(--mf-space-2); }
.chart-svg { width: 100%; max-width: 420px; height: auto; display: block; }
.chart-svg.donut { max-width: 220px; }
.chart-t { font-size: 11px; fill: var(--mf-color-text); font-family: var(--mf-font-sans); }
.legend { list-style: none; margin: var(--mf-space-2) 0 0; padding: 0; font-size: var(--mf-fs-sm); }
.swatch { display: inline-block; width: 12px; height: 12px; border-radius: 3px; vertical-align: middle; margin-right: 4px; }
.sw0 { background: var(--mf-color-primary); } .sw1 { background: var(--mf-color-secondary); } .sw2 { background: var(--mf-color-income); }
.sw3 { background: var(--mf-color-warning); } .sw4 { background: var(--mf-color-focus); } .sw5 { background: var(--mf-color-text-muted); }
/* Modo privado, semáforo, pestañas internas, calendario simple */
.topbar .actions { display: flex; gap: var(--mf-space-2); align-items: center; }
.topbar .badge, .topbar .iconbtn { color: #FFFFFF; border-color: #FFFFFF; background: transparent; }
.iconbtn { min-width: 44px; min-height: 44px; border-radius: var(--mf-radius-pill); border: 1px solid #FFFFFF; font: inherit; cursor: pointer; }
.iconbtn[aria-pressed="true"] { background: #FFFFFF; color: var(--mf-color-secondary); }
/* Semáforo y estado: pastilla SÓLIDA de tamaño fijo (el renglón no cambia de ajuste según el texto) + icono de forma + texto: nunca solo color. */
.sem, .estado { display: inline-flex; align-items: center; justify-content: center; gap: 4px; box-sizing: border-box; width: 104px; min-height: 28px; padding: 2px var(--mf-space-2); border-radius: var(--mf-radius-pill); font-size: var(--mf-fs-xs); font-weight: 700; line-height: 1.2; white-space: nowrap; flex: none; }
.sem.verde, .estado.activo { background: var(--mf-color-solid-ok); color: var(--mf-color-solid-ok-text); }
.sem.amarillo { background: var(--mf-color-solid-warn); color: var(--mf-color-solid-warn-text); }
.sem.rojo, .estado.mora { background: var(--mf-color-solid-late); color: var(--mf-color-solid-late-text); }
.estado.suspendido { background: var(--mf-color-solid-orange); color: var(--mf-color-solid-orange-text); }
.estado.cancelado, .estado.baja { background: var(--mf-color-surface-2); color: var(--mf-color-text); border: 1px solid var(--mf-color-border); }
.estado { width: 92px; }
.crow { display: flex; align-items: center; justify-content: space-between; gap: var(--mf-space-3); width: 100%; }
.crow .main { min-width: 0; flex: 1; }
.crow .pills { display: grid; gap: var(--mf-space-1); justify-items: end; }
.reasons { display: flex; flex-wrap: wrap; gap: var(--mf-space-1); margin-top: var(--mf-space-1); }
/* 0.26.1: fondo SÓLIDO (sin transparencia), por encima de la lista (z-index) y a todo el ancho del contenido (sangría negativa = gutter de <main>) para que nada se vea por los lados; sombra inferior sutil al desplazar. */
.week-head { position: sticky; top: 0; z-index: 6; isolation: isolate; background-color: var(--mf-color-bg); opacity: 1; padding: var(--mf-space-2) var(--mf-space-4); margin: var(--mf-space-4) calc(-1 * var(--mf-space-4)) 0; border-bottom: 2px solid var(--mf-color-border); box-shadow: 0 4px 6px -4px rgb(0 0 0 / 25%); }
.week-head h2 { margin: 0; }
.loadbar { display: flex; align-items: center; gap: var(--mf-space-2); min-height: 28px; color: var(--mf-color-text-muted); font-size: var(--mf-fs-sm); }
.spinner { width: 16px; height: 16px; border-radius: 50%; border: 3px solid var(--mf-color-surface-2); border-top-color: var(--mf-color-primary); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation: none; } }
.subtabs { display: flex; flex-wrap: wrap; gap: var(--mf-space-2); margin-bottom: var(--mf-space-4); }
.subtabs button { min-height: 44px; padding: 0 var(--mf-space-4); border-radius: var(--mf-radius-pill); border: 1px solid var(--mf-color-border); background: var(--mf-color-surface); color: var(--mf-color-text); font: inherit; cursor: pointer; }
.subtabs button[aria-selected="true"] { background: var(--mf-color-secondary); color: #FFFFFF; font-weight: 700; }
.onb { text-align: center; padding: var(--mf-space-5); }
.dots { display: flex; justify-content: center; gap: var(--mf-space-2); margin: var(--mf-space-4) 0; }
.dots span { width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--mf-color-primary); }
.dots span.on { background: var(--mf-color-primary); }
.regbanner { background: var(--mf-color-secondary); color: #FFFFFF; padding: var(--mf-space-3) var(--mf-space-4); border-radius: var(--mf-radius-md); margin-bottom: var(--mf-space-4); font-weight: 600; }
.codes { font-family: ui-monospace, monospace; display: grid; grid-template-columns: 1fr 1fr; gap: var(--mf-space-2); list-style: none; padding: 0; }
.stale { font-size: var(--mf-fs-xs); color: var(--mf-color-text-muted); }

/* Comprobantes (fotos) */
.receipts-box { margin: var(--mf-space-4) 0; }
.receipts-box .row, .receipts-saved .row { flex-wrap: wrap; }
.receipt-thumb { width: 64px; height: 64px; object-fit: cover; border-radius: var(--mf-radius-sm); background: var(--mf-color-surface-2); display: inline-flex; align-items: center; justify-content: center; color: var(--mf-color-text-muted); font-size: var(--mf-fs-xs); }
.receipt-full { max-width: 100%; height: auto; border-radius: var(--mf-radius-sm); }

/* Chat resumido por día, compositor fijo y selector de horarios (decisión del dueño, 26 oct 2026) */

[hidden] { display: none !important; }
.chat-prev { margin-bottom: var(--mf-space-4); }
.chat-days .chat-day { width: 100%; text-align: left; display: flex; flex-direction: column; gap: 2px; min-height: var(--mf-row-h); padding: var(--mf-space-3); margin: var(--mf-space-1) 0; background: var(--mf-color-surface); color: inherit; font: inherit; border: 1px solid var(--mf-color-border); border-radius: var(--mf-radius-md); cursor: pointer; }
.chat-days .chat-day[aria-expanded="true"] { border-color: var(--mf-color-primary); }
.chat-days li { border-bottom: 0; }
.chat-day-body { padding: var(--mf-space-2) 0 var(--mf-space-2) var(--mf-space-3); margin: 0 0 var(--mf-space-2) var(--mf-space-2); border-left: 3px solid var(--mf-color-border); }
.chat-hoy { margin-top: var(--mf-space-3); }
.bubble.system { margin-left: auto; margin-right: auto; text-align: center; background: transparent; border-style: dashed; }
.composer-wrap { position: sticky; bottom: calc(var(--mf-tabs-h) + env(safe-area-inset-bottom, 0px)); z-index: 5; background: var(--mf-color-bg); border-top: 1px solid var(--mf-color-border); padding: var(--mf-space-2) 0; margin-top: var(--mf-space-3); }
.composer { display: flex; align-items: center; gap: var(--mf-space-2); }
.composer input { flex: 1; min-width: 0; min-height: var(--mf-ctl-h); padding: var(--mf-space-2) var(--mf-space-3); font: inherit; color: var(--mf-color-text); background: var(--mf-color-surface); border: 2px solid var(--mf-color-border); border-radius: var(--mf-radius-pill); }
.composer .mic { flex: none; border-color: var(--mf-color-border); background: var(--mf-color-surface); color: var(--mf-color-text-muted); min-width: var(--mf-ctl-h); min-height: var(--mf-ctl-h); }
.composer .mic[disabled] { opacity: .4; filter: grayscale(1); background: var(--mf-color-border); cursor: not-allowed; pointer-events: auto; }
.chat-new { display: flex; margin: 0 auto var(--mf-space-2); min-height: 40px; }
.slots { border: 0; padding: 0; margin: 0 0 var(--mf-space-4); min-width: 0; }
.slots legend { font-weight: 600; padding: 0; margin-bottom: var(--mf-space-2); }
.slots-mode { display: flex; flex-wrap: wrap; gap: var(--mf-space-2); margin-bottom: var(--mf-space-3); }
.slots-mode .btn[aria-pressed="true"] { background: var(--mf-color-primary); color: var(--mf-color-primary-contrast); }
.slots-body { min-height: 208px; }
.slots-day { margin-bottom: var(--mf-space-3); }
.slots-day h3 { font-size: var(--mf-fs-md); margin: 0 0 var(--mf-space-2); }
.slots-day h3::first-letter { text-transform: uppercase; }
.slot-chips { display: flex; flex-wrap: wrap; gap: var(--mf-space-2); }
.slot-chip { position: relative; }
.slot-chip input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.slot-chip label { display: inline-flex; align-items: center; justify-content: center; min-width: 96px; min-height: var(--mf-ctl-h); padding: 0 var(--mf-space-3); border: 2px solid var(--mf-color-border); border-radius: var(--mf-radius-pill); background: var(--mf-color-surface); font-weight: 600; margin: 0; }
.slot-chip input:checked + label { background: var(--mf-color-primary); border-color: var(--mf-color-primary); color: var(--mf-color-primary-contrast); }
.slot-chip input:focus-visible + label { outline: 3px solid var(--mf-color-focus); outline-offset: 2px; }
.slots-loading .shimmer-text { display: block; margin-bottom: var(--mf-space-3); color: var(--mf-color-text-muted); animation: pulse 1.2s ease-in-out infinite; }
@media (min-width: 900px) { .composer-wrap { bottom: 0; } }
.week-head .row { flex-wrap: wrap; justify-content: flex-start; gap: var(--mf-space-1) var(--mf-space-4); }
.week-head .row > span { white-space: nowrap; }
.week-head ~ p.muted { margin: var(--mf-space-2) 0; }

/* «Crea tu acceso»: QR del TOTP y bloque «No puedo escanear» (el texto largo nunca sale de la tarjeta). */
.qr-box { text-align: center; margin: var(--mf-space-3) 0; }
.qr { max-width: 100%; height: auto; border: 1px solid var(--mf-color-surface-2); border-radius: var(--mf-radius-md); }
.manual { margin: var(--mf-space-3) 0; }
.manual summary { cursor: pointer; font-weight: 600; }
code.wrap, .manual code { overflow-wrap: anywhere; word-break: break-all; white-space: normal; }

/* Logo de marca en invitación, «Crea tu acceso» y login (ui/brand.mjs): una variante por tema */
.brand-logo { margin: 0 0 var(--mf-space-3, 12px); }
.brand-logo img { height: 40px; width: auto; max-width: 100%; display: block; }
.brand-logo-oscuro { display: none !important; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="claro"]) .brand-logo-claro { display: none !important; }
  :root:not([data-theme="claro"]) .brand-logo-oscuro { display: block !important; }
}
:root[data-theme="oscuro"] .brand-logo-claro { display: none !important; }
:root[data-theme="oscuro"] .brand-logo-oscuro { display: block !important; }

/* Diálogo modal (0.9.6): confirmaciones de estado del cliente. */
.modal-backdrop { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; padding: var(--mf-space-4); background: rgb(0 0 0 / 60%); }
.modal { width: 100%; max-width: 480px; max-height: 90vh; overflow: auto; padding: var(--mf-space-5); background: var(--mf-color-surface); color: var(--mf-color-text); border: 1px solid var(--mf-color-border); border-radius: var(--mf-radius-md); box-shadow: var(--mf-shadow-1); }
.modal:focus { outline: none; }
.modal-actions { display: flex; flex-wrap: wrap; gap: var(--mf-space-2); justify-content: flex-end; margin-top: var(--mf-space-4); }
.btn.danger { background: var(--mf-color-danger); border-color: var(--mf-color-danger); color: var(--mf-color-primary-contrast); }
.btn.secondary.danger { background: transparent; color: var(--mf-color-danger); }
.form-ok { border-left: 4px solid var(--mf-color-success); }
.form-error { border-left: 4px solid var(--mf-color-danger); padding: var(--mf-space-3) var(--mf-space-4); margin-bottom: var(--mf-space-4); }
.plan-pendiente { border: 2px solid var(--mf-border, currentColor); border-radius: var(--mf-radius, 8px); padding: var(--mf-space-2) var(--mf-space-3); font-weight: 600; }
.back-row { margin: 0 0 var(--mf-space-3); }
.back-btn { min-height: 44px; gap: var(--mf-space-2); }
.back-btn:focus-visible { outline: 3px solid var(--mf-color-focus, currentColor); outline-offset: 2px; }
.plan-actions { display: contents; }
.state-actions { display: flex; flex-wrap: wrap; gap: var(--mf-space-2); margin-bottom: var(--mf-space-4); }
.bar-actions { display: flex; flex-wrap: wrap; gap: var(--mf-space-2); margin-bottom: var(--mf-space-4); }
.topbar .topbar-logout { color: #FFFFFF; border-color: #FFFFFF; background: transparent; min-height: 44px; padding: 0 var(--mf-space-3); white-space: nowrap; }
.idle-warn { position: fixed; left: var(--mf-space-4); right: var(--mf-space-4); bottom: var(--mf-space-4); z-index: 30; background: var(--mf-color-secondary); color: #FFFFFF; padding: var(--mf-space-3) var(--mf-space-4); border-radius: var(--mf-radius-md); display: flex; justify-content: space-between; align-items: center; gap: var(--mf-space-3); }
.idle-warn .btn { min-height: 44px; padding: 0 var(--mf-space-3); background: transparent; border-color: #FFFFFF; color: #FFFFFF; }
.app-lock { max-width: 28rem; margin: 0 auto; padding: var(--mf-space-4); }

/* Marca (fase 1): logo ADMINTEK (letras claras) sobre la banda carbón del encabezado; el nombre del tenant queda como texto para lectores de pantalla. */
.topbar-brand { flex: 0 1 auto; display: inline-flex; align-items: center; min-width: 0; }
.topbar-logo { height: 20px; width: auto; max-width: 100%; display: block; margin-right: var(--mf-space-3); }
/* Tarjeta estilo app de banco (tarjeta-banco.mjs): usa solo los tokens de marca. */
.tbk-art { background: linear-gradient(135deg, var(--mf-color-secondary) 0%, var(--mf-color-secondary) 55%, var(--mf-color-primary) 160%); color: #FFFFFF; border-radius: var(--mf-radius-lg); padding: var(--mf-space-4) var(--mf-space-5); display: flex; flex-direction: column; justify-content: space-between; gap: var(--mf-space-3); aspect-ratio: 1.586 / 1; max-width: 360px; width: 100%; margin: 0 auto var(--mf-space-4); box-shadow: var(--mf-shadow-1); box-sizing: border-box; overflow: hidden; }
.tbk-art-top, .tbk-art-bot { display: flex; justify-content: space-between; align-items: center; gap: var(--mf-space-3); min-width: 0; }
.tbk-brand { font-weight: 800; letter-spacing: .12em; font-size: var(--mf-fs-md); }
.tbk-chip { width: 36px; height: 26px; border-radius: 5px; background: #D9D9D9; opacity: .9; flex: 0 0 auto; }
.tbk-art-num { font-size: var(--mf-fs-lg); letter-spacing: .14em; font-variant-numeric: tabular-nums; }
.tbk-holder, .tbk-inst { font-size: var(--mf-fs-sm); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.tbk-inst { opacity: .85; text-align: right; }
.tbk-art--mini { width: 88px; max-width: 88px; margin: 0; padding: 8px 10px; border-radius: var(--mf-radius-sm); flex: 0 0 88px; }
.tbk-art--mini .tbk-brand { font-size: 8px; } .tbk-art--mini .tbk-chip { width: 14px; height: 10px; flex: 0 0 14px; }
.tbk-art--mini .tbk-art-top { gap: 4px; }
.tbk-art--mini .tbk-art-num { font-size: 9px; letter-spacing: .08em; } .tbk-art--mini .tbk-art-bot { display: none; }
.tbk-row { display: flex; align-items: center; gap: var(--mf-space-3); color: inherit; text-decoration: none; min-width: 0; flex: 1; }
.tbk-row-txt { flex: 1; text-align: left; display: flex; flex-direction: column; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.tbk-saldo .tbk-big { font-size: var(--mf-fs-xl); font-weight: 700; }
.tbk-disp { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--mf-space-2) var(--mf-space-3); margin-top: var(--mf-space-2); }
.tbk-dl { display: grid; grid-template-columns: 1fr auto; gap: var(--mf-space-1) var(--mf-space-3); margin: 0 0 var(--mf-space-3); }
.tbk-dl dt { color: var(--mf-muted, inherit); } .tbk-dl dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
.tbk-estimado .row, .tbk-tasas .row { gap: var(--mf-space-2); }
.tbk-supuestos { margin-top: var(--mf-space-3); } .tbk-supuestos ul { padding-left: var(--mf-space-4); }
.rg-ahorros { margin-top: var(--mf-space-4); }
.tbk-registrar { display: flex; gap: var(--mf-space-2); flex-wrap: wrap; margin-bottom: var(--mf-space-3); }
.tbk-tabs { display: flex; border-bottom: 2px solid var(--mf-color-surface-2); margin-bottom: var(--mf-space-3); }
.tbk-tab { flex: 1; min-height: 48px; background: transparent; border: 0; border-bottom: 3px solid transparent; margin-bottom: -2px; font: inherit; font-weight: 600; color: var(--mf-color-text-muted); cursor: pointer; }
.tbk-tab[aria-selected="true"] { color: var(--mf-color-primary); border-bottom-color: var(--mf-color-primary); }
.tbk-eye { color: var(--mf-color-text); border-color: var(--mf-color-border); background: transparent; }
.tbk-eye[aria-pressed="true"] { background: var(--mf-color-secondary); color: #FFFFFF; }
.tbk-mes h3 { font-size: var(--mf-fs-sm); color: var(--mf-color-text-muted); text-transform: uppercase; letter-spacing: .04em; margin: var(--mf-space-3) 0 0; }
.tbk-tx { min-width: 0; overflow-wrap: anywhere; }
.tbk-foot { display: flex; flex-direction: column; gap: var(--mf-space-3); margin-top: var(--mf-space-4); }
.tbk-lista li .item-actions { padding-bottom: var(--mf-space-3); }

/* Avisos (0.16.0): casillas en línea y etiqueta junto al título */
label.inline { margin-right: 1rem; }
strong + .badge { margin-left: 0.5rem; }

/* 0.19.0 Registro masivo (maquetas docs/maquetas/registro-masivo) y pestaña «Funciones» de la ficha. Móvil primero; escritorio en rejilla. */
.rm-seg { display: flex; gap: var(--mf-space-2); margin-bottom: var(--mf-space-4); }
.rm-seg button { flex: 1; min-height: 44px; display: flex; align-items: center; justify-content: center; border-radius: var(--mf-radius-pill); border: 1px solid var(--mf-color-border); background: var(--mf-color-surface); color: var(--mf-color-text); font: inherit; font-weight: 600; font-size: .875rem; padding: 0 var(--mf-space-2); cursor: pointer; }
.rm-seg button.on { background: var(--mf-color-secondary); color: #FFFFFF; }
.rm-seg button.lock { background: var(--mf-color-surface-2); color: var(--mf-color-text-muted); border-style: dashed; cursor: not-allowed; }
.rm-head { display: none; }
.rm-row { padding: 12px 14px 6px; margin-bottom: 12px; }
.rm-row.has-err { border: 2px solid var(--mf-color-danger); }
.rm-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.rm-n { font-weight: 700; display: flex; align-items: center; gap: 8px; }
.rm-n i { font-style: normal; background: var(--mf-color-secondary); color: #FFFFFF; border-radius: 50%; width: 26px; height: 26px; display: inline-flex; align-items: center; justify-content: center; font-size: .8rem; }
.rm-remove { min-width: 44px; min-height: 44px; border-radius: 999px; border: 2px solid var(--mf-color-border); background: var(--mf-color-surface); color: var(--mf-color-primary); font: inherit; font-weight: 700; font-size: 1.1rem; cursor: pointer; }
.rm-cell { margin-bottom: 12px; }
.rm-cell [aria-invalid="true"] { border-color: var(--mf-color-danger); }
.rm-rcp { margin-bottom: 10px; }
.rm-attach { min-height: 44px; padding: 0 14px; font-size: .875rem; gap: 6px; }
.rm-chev { margin-left: 6px; font-size: .75rem; }
.rm-rcp-panel { margin-top: 8px; padding: 8px 10px; border: 1px solid var(--mf-color-border); border-radius: var(--mf-radius-md); background: var(--mf-color-surface); }
.rm-rcp-panel[hidden] { display: none; }
.rm-rcp-panel .receipts-box { margin: 0; }
.rm-rcp-panel .receipts-box h2 { font-size: 1rem; margin: 0 0 4px; }
.rm-got { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.rm-got.empty { display: none; }
.rm-thumb { width: 40px; height: 40px; border-radius: 6px; object-fit: cover; flex: none; background: var(--mf-color-surface-2); display: inline-flex; align-items: center; justify-content: center; }
.rm-got .meta { font-size: .75rem; color: var(--mf-color-text-muted); line-height: 1.3; min-width: 0; }
.rm-got .meta strong { display: block; color: var(--mf-color-text); font-size: .8125rem; }
.rm-quit { margin-left: auto; background: none; border: 0; font: inherit; font-weight: 700; color: var(--mf-color-primary); text-decoration: underline; min-height: 44px; min-width: 44px; cursor: pointer; }
.rm-add { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 4px 0 16px; }
.rm-counter { font-size: .875rem; color: var(--mf-color-text-muted); font-weight: 600; }
.rm-counter.full { color: var(--mf-color-warning); }
.rm .sum { background: var(--mf-color-surface); border: 1px solid var(--mf-color-surface-2); border-radius: var(--mf-radius-md); box-shadow: var(--mf-shadow-1); padding: 14px 16px; margin-bottom: 16px; }
.rm .sum .row { padding: 4px 0; }
.rm .sum .tot { border-top: 2px solid var(--mf-color-secondary); margin-top: 6px; padding-top: 8px; }
.rm .sum .tot strong { font-size: 1.1rem; }
.rm .neg { color: var(--mf-color-danger); font-weight: 700; }
.rm .actions { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.rm .al { border-left: 6px solid var(--mf-color-danger); background: var(--mf-color-surface); border-radius: 6px; padding: 10px 14px; margin-bottom: 10px; box-shadow: var(--mf-shadow-1); }
.rm .al .tag { font-size: .6875rem; font-weight: 700; letter-spacing: .03em; text-transform: uppercase; }
.rm .al ul { margin: 4px 0 0; padding-left: 18px; }
.rm .kv, .func-grid .kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; font-size: .9rem; }
.rm .kv dt, .func-grid .kv dt { color: var(--mf-color-text-muted); }
.rm .kv dd, .func-grid .kv dd { margin: 0; font-weight: 600; text-align: right; }
.rm .srow { display: flex; justify-content: space-between; gap: 10px; padding: 10px 0; }
.rm .srow .l { min-width: 0; }
.rm .srow .amt { font-weight: 700; white-space: nowrap; }
.rm .pill { display: inline-flex; align-items: center; gap: 4px; border-radius: 999px; padding: 2px 10px; font-size: .75rem; font-weight: 600; white-space: nowrap; background: var(--mf-color-surface); border: 1px solid var(--mf-color-border); }
.rm .center { text-align: center; }
.rm .left { text-align: left; }
.rm .res-ico { width: 64px; height: 64px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 2rem; color: #FFFFFF; margin: 4px auto 10px; }
.rm .res-ico.ok { background: var(--mf-color-success); }
.rm .res-ico.bad { background: var(--mf-color-danger); }
.func-grid { display: grid; gap: var(--mf-space-3); }
.func-row { display: flex; gap: var(--mf-space-3); align-items: flex-start; margin-bottom: var(--mf-space-4); }
.func-switch { width: 48px; height: 28px; flex: none; accent-color: var(--mf-color-success); }
@media (min-width: 900px) {
  .func-grid { grid-template-columns: 1.1fr 1fr; align-items: start; }
  .rm-head { display: grid; gap: 12px; font-weight: 700; font-size: .875rem; padding: 0 16px 6px; color: var(--mf-color-text-muted); }
  .rm-t-pago_deuda .rm-head, .rm-t-pago_deuda .rm-row, .rm-t-pago_tarjeta .rm-head, .rm-t-pago_tarjeta .rm-row { grid-template-columns: 34px 1.8fr 1fr 1.4fr 52px; }
  .rm-t-gasto .rm-head, .rm-t-gasto .rm-row, .rm-t-ingreso .rm-head, .rm-t-ingreso .rm-row { grid-template-columns: 34px 1.3fr 1.2fr 1.3fr .9fr 1.3fr 52px; }
  .rm-row { display: grid; gap: 12px; align-items: start; padding: 12px 16px 4px; margin-bottom: 8px; }
  .rm-top { display: contents; }
  .rm-n { grid-column: 1; padding-top: 12px; }
  .rm-n span { display: none; }
  .rm-remove { grid-column: -2; grid-row: 1; margin-top: 2px; }
  .rm-row .lbl { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .rm-rcp { margin: 0; padding-top: 2px; }
  .rm-rcp.open { grid-column: 1 / -1; }
  .rm-attach { min-height: 44px; }
}

/* 0.20.0 etiqueta Auto/Manual de los movimientos */
.badge.origen { font-size: var(--mf-fs-xs); vertical-align: middle; margin-left: 0.25rem; }
.badge.origen-auto { font-weight: 600; }
.badge.origen-manual { opacity: 0.8; }
.addr { word-break: break-all; }

/* 0.22.0 reporte gerencial */
.rg-filtro { border: 0; margin: 0 0 var(--mf-space-3); }
.rg-chips { display: flex; flex-wrap: wrap; gap: var(--mf-space-2); margin-top: var(--mf-space-2); }
.rg-chip { display: inline-flex; align-items: center; min-height: 44px; padding: 0 var(--mf-space-3); border: 1px solid var(--mf-color-surface-2); border-radius: 999px; }
.rg-scroll { overflow-x: auto; }
.rg-tabla { width: 100%; border-collapse: collapse; }
.rg-tabla th, .rg-tabla td { padding: var(--mf-space-1) var(--mf-space-2); text-align: left; }
.rg-tabla .num { text-align: right; }
.rg-sec th, .rg-sec td { font-weight: 700; background: var(--mf-color-surface-2); }
.rg-tot th, .rg-tot td { font-weight: 700; border-top: 2px solid var(--mf-color-surface-2); }

/* 0.23.0: casilla en línea (no ocupa todo el ancho como los campos de texto) */
.field input[type=checkbox] { width: auto; min-width: 1.25rem; height: 1.25rem; display: inline-block; vertical-align: middle; margin-right: var(--mf-space-2); }
.tabs-wrap { display: flex; flex-wrap: wrap; gap: var(--mf-space-1); height: auto; }
.tabs-wrap button { flex: 1 1 auto; }
.party-list { margin: var(--mf-space-1) 0; } .party-opt { display: block; width: 100%; text-align: left; background: none; border: 1px solid var(--mf-color-border); border-radius: 12px; padding: var(--mf-space-2); margin-bottom: var(--mf-space-1); min-height: 44px; }
.party-sel { display: inline-flex; align-items: center; gap: var(--mf-space-1); }
/* 0.25.0 compras a cuotas */
.plan-rate-row { display: flex; gap: var(--mf-space-2, 8px); }
.plan-rate-row input { flex: 1 1 50%; min-width: 0; }
.plan-rate-row select { flex: 1 1 50%; min-width: 0; }
.plan.card { margin-top: var(--mf-space-3, 12px); }
.plan-inactivo { opacity: .8; }
.plan .rg-tabla { font-size: .875rem; }
.plan .rg-tabla th, .plan .rg-tabla td, #plan-preview .rg-tabla th, #plan-preview .rg-tabla td { padding: 4px 6px; white-space: nowrap; }
.plan-cobrada td { color: var(--mf-color-text-muted); }
.plan-anulada td { color: var(--mf-color-text-muted); text-decoration: line-through; }
.plan-lista { margin-top: var(--mf-space-3, 12px); }
/* 0.27.0 barra de consumo de la tarjeta: verde hasta 70 %, ámbar 70-90 %, rojo por encima de 90 %; el texto acompaña al color */
.tbk-consumo { flex-basis: 100%; margin-top: var(--mf-space-2); }
.tbk-consumo-bar { appearance: none; -webkit-appearance: none; width: 100%; height: 10px; border: 0; border-radius: 999px; background: rgba(127,127,127,.25); overflow: hidden; color: #1a7f37; }
.tbk-consumo-bar::-webkit-progress-bar { background: rgba(127,127,127,.25); border-radius: 999px; }
.tbk-consumo-bar::-webkit-progress-value { background: #1a7f37; border-radius: 999px; }
.tbk-consumo-bar::-moz-progress-bar { background: #1a7f37; border-radius: 999px; }
.tbk-consumo--medio .tbk-consumo-bar { color: #b7791f; } .tbk-consumo--medio .tbk-consumo-bar::-webkit-progress-value { background: #b7791f; } .tbk-consumo--medio .tbk-consumo-bar::-moz-progress-bar { background: #b7791f; }
.tbk-consumo--alto .tbk-consumo-bar { color: #c62828; } .tbk-consumo--alto .tbk-consumo-bar::-webkit-progress-value { background: #c62828; } .tbk-consumo--alto .tbk-consumo-bar::-moz-progress-bar { background: #c62828; }
.tbk-consumo-txt { margin: var(--mf-space-1, 4px) 0 0; }
/* 0.27.0 proveedor elegido: nombre y datos (razón social, RUC-DV, categoría) en bloque compacto, con la ✕ al lado */
.party-sel { display: inline-flex; align-items: flex-start; gap: var(--mf-space-2, 8px); max-width: 100%; white-space: normal; text-align: left; }
.party-sel-txt { display: flex; flex-direction: column; min-width: 0; overflow-wrap: anywhere; }
.party-sel-info { font-size: .85em; }
/* 0.33.5: el chip del proveedor/pagador con relleno parejo (nombre ya no pegado al borde) y la ✕ centrada en vertical */
.party-chip .badge.party-sel { display: flex; align-items: center; justify-content: space-between; gap: var(--mf-space-2, 8px); width: 100%; box-sizing: border-box; padding: 10px 12px; border-radius: 16px; }
.party-chip .party-sel-txt { flex: 1 1 auto; gap: 2px; }
.party-chip .party-sel .iconbtn { flex: 0 0 auto; align-self: center; }
/* Mi Prestamista (0.29.0): comprobante del pago (vista previa al subir y visor) */
.proof-img, .proof-previa { display: block; max-width: 100%; height: auto; border-radius: 8px; margin-top: 8px; }
.proof-img { max-height: 70vh; margin-inline: auto; }
.proof-previa { max-height: 220px; object-fit: contain; }
.proof-previa[hidden] { display: none; }

/* 0.40.0: vista solo-revisión de la ficha (módulo fuera del plan del cliente): se ve todo, no se acciona nada. */
.solo-lectura form, .solo-lectura button, .solo-lectura .actions, .solo-lectura .item-actions { display: none !important; }
.solo-lectura { opacity: 0.92; }
.cambio-card .antes { text-decoration: line-through; }

/* 0.47.0 Guía de uso dentro de la app */
.guia-toc { padding-left: var(--mf-space-4); margin: 0 0 var(--mf-space-3); }
.linklike { background: none; border: 0; padding: var(--mf-space-2) 0; min-height: var(--mf-row-h); color: var(--mf-color-primary); text-decoration: underline; cursor: pointer; font: inherit; text-align: left; }
#guia dt { margin-top: var(--mf-space-3); }
#guia dd { margin: var(--mf-space-1) 0 0; }
.maqueta { border: 2px dashed var(--mf-color-border); border-radius: var(--mf-radius-md); padding: var(--mf-space-3); margin-top: var(--mf-space-3); }
.maqueta-valor { border: 1px solid var(--mf-color-border); border-radius: var(--mf-radius-sm); padding: var(--mf-space-2) var(--mf-space-3); background: var(--mf-color-surface-2); }
