/* =========================================================
   KOVRA PASO 38 — AUDITORÍA VISUAL FINAL
   Capa cargada al final para estabilizar tipografía,
   interacción táctil, adaptación y calidad visual.
========================================================= */

:root {
    --kovra-fs-micro: 9.5px;
    --kovra-fs-meta: 10px;
    --kovra-fs-small: 11px;
    --kovra-fs-body: 12px;
    --kovra-fs-control: 14px;
    --kovra-control-height: 44px;
    --muted: #8f9793;
}

html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    font-synthesis: none;
}

body {
    overflow-x: clip;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

img,
svg,
canvas,
video {
    max-width: 100%;
}

img {
    height: auto;
    image-rendering: auto;
}

.app > *,
.page > *,
.access-shell > *,
.register-shell > * {
    min-width: 0;
}

button,
input,
select,
textarea {
    max-width: 100%;
    font-family: inherit;
}

input,
select,
textarea {
    min-width: 0;
    min-height: 44px;
    font-size: var(--kovra-fs-control) !important;
    line-height: 1.25;
}

textarea {
    min-height: 88px;
    resize: vertical;
}

button {
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
    outline: 2px solid rgba(54,230,107,.78);
    outline-offset: 2px;
}

button:disabled,
input:disabled,
select:disabled,
textarea:disabled {
    opacity: .52;
    cursor: not-allowed;
}

small {
    font-size: var(--kovra-fs-meta) !important;
    line-height: 1.35 !important;
}

.eyebrow,
.topbar-title > span,
.section-heading > div > span,
.section-title .eyebrow,
.card-heading > span,
.brand-panel > span,
.register-header span,
.restore-account-header span {
    font-size: 10px !important;
    line-height: 1.25;
}

.field > span,
.note-field > span,
.late-fee-field > span,
.date-range label > span {
    font-size: 11px !important;
    line-height: 1.3;
}

.status,
.status-chip,
.count-badge,
.risk-badge,
.verified-chip,
.score-badge,
.code-chip,
.section-chip,
.private-chip,
.impact,
.page-chip,
.secure-chip,
.backup-badge,
.restore-badge,
.preview-version,
.account-chip,
.saved-chip,
.late-fee-preview-chip,
.estimate-chip,
.schedule-count,
.closed-chip {
    font-size: 9.5px !important;
    line-height: 1.2;
}

.tab-button,
.filter-button,
.period-button,
.detail-button,
.cancel-preview-button,
.loan-footer button,
.alert-actions button,
.receipt-row-side button,
.legacy-access button {
    font-size: 10.5px !important;
}

.loan-finance span,
.movement-breakdown span,
.closure-breakdown span,
.portfolio-strip span,
.exposure-strip span,
.summary-grid span,
.amount-grid span,
.preview-grid span,
.schedule-summary-grid span,
.aging-card span,
.aging-card small,
.loan-client span,
.loan-due,
.movement-footer,
.sheet-footer,
.security-note {
    font-size: 9.5px !important;
    line-height: 1.35;
}

.loan-finance strong,
.movement-breakdown strong,
.closure-breakdown strong {
    font-size: 10.5px !important;
}

.settings-item strong,
.collection-name-row strong,
.client-note-head strong,
.receipt-history-head strong,
.actions-card strong {
    font-size: 11.5px !important;
}

.settings-item small,
.collection-meta,
.receipt-history-meta,
.client-note-footer,
.local-notice p,
.safety-card p,
.actions-card small {
    font-size: 10px !important;
}

.nav-button > span:last-child,
.nav-button small {
    font-size: 10px !important;
    line-height: 1.1;
}

.quick-menu button {
    font-size: 11px !important;
}

/* El logo gráfico solo vive en Inicio e Inicio de sesión. */
.kovra-logo-slot {
    display: flex;
    align-items: center;
    overflow: hidden;
}

.kovra-logo-image {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: left center;
}

.kovra-logo-home {
    width: clamp(108px, 31vw, 132px);
    height: 38px;
    margin: 0 0 10px;
}

.kovra-logo-login {
    width: clamp(126px, 38vw, 158px);
    height: 44px;
    margin: 0 auto 8px;
}

/* Inicio de sesión: legibilidad sin desperdiciar altura. */
.brand-panel > span {
    letter-spacing: .8px;
}

.brand-panel p,
.card-heading p,
.restore-account-help {
    font-size: 11px !important;
    line-height: 1.42 !important;
}

.login-card {
    width: 100%;
}

.password-field input {
    min-width: 0;
}

.password-field button {
    min-width: 58px;
    font-size: 10.5px !important;
}

.login-button,
.register-button,
.restore-account-button,
.restore-confirm-button,
.create-button,
.back-button {
    min-height: 46px !important;
    font-size: 11.5px !important;
}

/* Plan y documentos: texto pequeño pero nunca microscópico. */
.plan-head {
    font-size: 10px !important;
}

.plan-row {
    min-height: 40px !important;
    font-size: 10.5px !important;
}

/* Evita que flex/grid empujen contenido fuera de pantalla. */
.loan-top > *,
.loan-footer > *,
.toolbar-card > *,
.metric-grid > *,
.summary-grid > *,
.terms-grid > *,
.breakdown-grid > *,
.schedule-summary-grid > *,
.two-column > *,
.late-fee-two-columns > * {
    min-width: 0;
}

/* Área táctil adecuada sin agrandar visualmente todos los chips. */
@media (pointer: coarse) {
    input,
    select,
    textarea {
        /* Evita zoom automático de Safari/iOS al enfocar. */
        font-size: 16px !important;
    }

    button:not(.add-button):not(.aging-card) {
        min-height: 44px;
    }

    .icon-button,
    .notification-button,
    [id^="close"],
    [id^="toggle"] {
        min-width: 44px;
        min-height: 44px;
    }
}

@media (max-width: 380px) {
    .app,
    .page {
        padding-left: 8px !important;
        padding-right: 8px !important;
    }

    .late-fee-two-columns,
    .restore-password-grid {
        grid-template-columns: 1fr !important;
    }

    .loan-footer {
        grid-template-columns: 1fr 1fr !important;
    }

    .loan-footer .loan-due {
        grid-column: 1 / -1;
    }
}

@media (min-width: 700px) {
    .topbar-title strong,
    .section-heading h2 {
        letter-spacing: .05px;
    }
}

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

/* =========================================================
   PASO 38 — PISO DE LEGIBILIDAD PARA COMPONENTES HISTÓRICOS
   Varios módulos antiguos conservaban reglas de 6–8px.
========================================================= */
.toast,
.divider,
.legacy-access span,
.restore-account-preview span,
.status-main span,
.backup-includes span,
.restore-warning p,
.progress-card span,
.identity-banner span,
.scheduled-preview span,
.scheduled-payment-note,
.hero-card span,
.hero-card small,
.audit-chip,
.audit-action,
.audit-head time,
.audit-meta span,
.today-box span,
.filter-button span,
.collection-finance span,
.promise-detail,
.promise-progress-head,
.register-header span,
.id-preview-card > span,
.id-preview-card p,
.client-debt span,
.notification-count,
.payment-info .interest-label,
.promise-dashboard-main span,
.promise-dashboard-side span,
.live-chip,
.alert-main span,
.alert-note,
.section-head span,
.reminder-row span,
.reminder-row time,
.history-empty,
.business-copy span,
.verified-badge,
.stats-grid span,
.lender-id-copy span,
.lender-id-copy small,
.account-session-main span,
.account-session-main small,
.hero-total > span,
.hero-meta,
.metric-grid span,
.movement-client span,
.closure-title span,
.installment-number-chip,
.installment-detail-grid span,
.future-dates > span,
.future-date-chip,
.late-fee-modal-header span,
.late-fee-change-warning p,
.score-label,
.level-badge,
.scale-head,
.scale-numbers,
.metric-card small,
.factor-row p,
.recommendation-card p,
.limit-card p,
.timeline-item p,
.timeline-item time,
.internal-note p,
.completion-box span,
.audit-row div span,
.document-details span,
.upload-zone > span:last-child,
.loan-count,
.installment-cycle-card span,
.late-fee-due-box small,
.kovra-id-label,
.next-payment span,
.loan-amount-row span,
.loan-details-grid span,
.history-item div span,
.record-card p,
.payment-record span,
.receipt-row span,
.document-card small,
.note-card span,
.document-overview span,
.profile-document-row small,
.reference-data-card span,
.change-count,
.client-change-head time,
.client-change-line,
.client-change-actor,
.receipt-summary-grid span,
.receipt-history-breakdown span,
.notes-summary-grid span,
.promise-info span,
.extra-tabs-header span {
    font-size: 9.5px !important;
    line-height: 1.35 !important;
}

.impact,
.private-chip,
.reference-badge,
.document-status,
.record-state,
.profile-document-state,
.receipt-status-chip,
.note-type-chip,
.note-status-chip,
.due-badge,
.client-card .due-chip {
    font-size: 9.5px !important;
    line-height: 1.2 !important;
}

#copyLenderIdButton,
#logoutButton,
#applyDatesButton,
.promise-action-secondary,
.promise-action-primary,
.open-receipt-button,
.note-complete-button {
    font-size: 10px !important;
}

/* Un texto de estado nunca debe quedar por debajo del piso visual. */
[class*="chip"],
[class*="badge"] {
    text-rendering: geometricPrecision;
}

/* Blindaje final: ningún isotipo antiguo reaparece en pantallas operativas. */
.brand-icon,
.brand-mark,
.company-mark,
.screen-header .brand,
.sheet-logo {
    display: none !important;
}

/* Las únicas zonas gráficas autorizadas son estas dos. */
.kovra-logo-slot {
    display: flex !important;
}
