﻿/* PrestaSoft UI system
   Archivo limpio: base, modulos, tema final y microinteracciones. */

.sidebar,
.nav-scrollable {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.sidebar::-webkit-scrollbar,
.nav-scrollable::-webkit-scrollbar {
    display: none;
    height: 0;
    width: 0;
}

h1:focus {
    outline: none;
}

.valid.modified:not([type=checkbox]) {
    outline: 0;
}

.invalid {
    border-color: #fecdd3 !important;
    box-shadow: 0 0 0 .18rem rgba(190, 18, 60, .08) !important;
    outline: 0;
}

.validation-message {
    color: var(--ps-danger);
    display: none !important;
    font-size: var(--ps-font-sm);
    font-weight: 650;
    margin-top: .35rem;
}

.blazor-error-boundary {
    background: #b32121;
    border-radius: 12px;
    color: #ffffff;
    padding: 1rem 1rem 1rem 1.25rem;
}

.blazor-error-boundary::after {
    content: "Ocurrio un error inesperado.";
}

.darker-border-checkbox.form-check-input {
    border-color: #929292;
}

.form-floating > .form-control-plaintext::placeholder,
.form-floating > .form-control::placeholder {
    color: var(--bs-secondary-color);
    text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder,
.form-floating > .form-control:focus::placeholder {
    text-align: start;
}

/* Sistema visual consolidado. Mantener al final para estabilizar la cascada. */
:root {
    --ps-primary: #111827;
    --ps-primary-hover: #1f2937;
    --ps-accent: #0f766e;
    --ps-accent-hover: #115e59;
    --ps-accent-soft: #eef6f5;
    --ps-bg: #f6f8fb;
    --ps-surface: #ffffff;
    --ps-surface-soft: #f8fafc;
    --ps-border: #e2e8f0;
    --ps-border-strong: #cbd5e1;
    --ps-border-soft: #eef2f7;
    --ps-text: #0f172a;
    --ps-muted: #64748b;
    --ps-success: #047857;
    --ps-success-bg: #ecfdf5;
    --ps-warning: #b45309;
    --ps-warning-bg: #fffbeb;
    --ps-danger: #be123c;
    --ps-danger-bg: #fff1f2;
    --ps-radius-sm: 10px;
    --ps-radius-md: 14px;
    --ps-radius-lg: 18px;
    --ps-shadow-sm: 0 6px 16px rgba(15, 23, 42, .06);
    --ps-shadow-md: 0 14px 34px rgba(15, 23, 42, .08);
    --ps-shadow-lg: 0 22px 55px rgba(15, 23, 42, .10);
    --ps-font-xs: .76rem;
    --ps-font-sm: .84rem;
    --ps-font-base: .94rem;
    --ps-font-title: 1.58rem;
    --ps-weight-normal: 400;
    --ps-weight-medium: 500;
    --ps-weight-semibold: 650;
    --ps-weight-bold: 750;
    --ps-weight-heavy: 800;
}

html,
body {
    background: var(--ps-bg);
    color: var(--ps-text);
    font-family: Inter, "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, Arial, sans-serif;
    font-size: var(--ps-font-base);
    font-weight: var(--ps-weight-normal);
}

a,
.btn-link {
    color: var(--ps-accent);
}

a:hover,
.btn-link:hover {
    color: var(--ps-accent-hover);
}

.content {
    background: var(--ps-bg);
    max-width: 1540px;
    padding-top: 1.5rem;
}

.page-header {
    align-items: flex-end;
    border-bottom: 1px solid var(--ps-border);
    display: flex;
    gap: 1rem;
    justify-content: space-between;
    margin-bottom: 1.35rem;
    padding-bottom: 1rem;
}

.page-actions {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: .65rem;
    justify-content: flex-end;
}

.action-buttons {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: .45rem;
    justify-content: flex-end;
}

.page-eyebrow,
.surface-eyebrow {
    color: var(--ps-accent) !important;
    font-size: .74rem;
    font-weight: var(--ps-weight-heavy);
    letter-spacing: .08em;
    text-transform: uppercase;
}

.page-title,
.page-header h1 {
    color: var(--ps-text);
    font-size: var(--ps-font-title);
    font-weight: var(--ps-weight-heavy);
    letter-spacing: 0;
    line-height: 1.15;
}

.page-description {
    color: var(--ps-muted);
    font-size: .94rem;
    max-width: 56rem;
}

.surface,
.card.shadow-sm,
.metric-card,
.client-form-shell,
.client-files-panel,
.client-reference-panel,
.client-documents-panel,
.client-search-surface {
    background: var(--ps-surface);
    border: 1px solid var(--ps-border);
    border-radius: var(--ps-radius-lg);
    box-shadow: var(--ps-shadow-md);
    overflow: hidden;
}

.surface-header,
.card-header,
.card-header.bg-light,
.client-search-header {
    background: linear-gradient(135deg, #ffffff, var(--ps-surface-soft)) !important;
    border-bottom: 1px solid var(--ps-border);
    color: var(--ps-text);
    padding: 1.05rem 1.2rem;
}

.surface-title,
.client-search-surface .surface-title {
    color: var(--ps-text);
    font-size: 1rem;
    font-weight: var(--ps-weight-bold);
    letter-spacing: 0;
}

.surface-body,
.card-body {
    padding: 1.2rem;
}

.toolbar,
.client-search-toolbar,
.quick-client-box,
.balance-panel,
.detail-item,
.client-form-section.compact,
.client-upload-box,
.loan-plan-summary {
    background: var(--ps-surface-soft) !important;
    border: 1px solid var(--ps-border) !important;
    border-radius: var(--ps-radius-lg) !important;
}

.form-section,
.client-form-section {
    border-color: var(--ps-border-soft);
}

.form-section-title {
    color: #334155;
    font-size: .94rem;
    font-weight: var(--ps-weight-bold);
}

.form-label {
    color: #334155;
    font-size: var(--ps-font-sm);
    font-weight: 700;
}

.form-control,
.form-select,
.input-group-text,
.client-input,
.client-file-input {
    background-color: #ffffff;
    border-color: #dbe3ef;
    border-radius: var(--ps-radius-md);
    color: var(--ps-text);
    min-height: 2.65rem;
}

.form-control::placeholder,
.search-input::placeholder {
    color: #94a3b8;
}

.form-control:focus,
.form-select:focus,
.form-check-input:focus,
.client-input:focus,
.search-input:focus {
    border-color: var(--ps-accent) !important;
    box-shadow: 0 0 0 .22rem rgba(15, 118, 110, .12) !important;
}

.form-check-input:checked {
    background-color: var(--ps-accent);
    border-color: var(--ps-accent);
}

.btn,
.btn-action,
.btn-page,
.module-tab {
    border-radius: var(--ps-radius-sm);
    font-weight: var(--ps-weight-bold);
    min-height: 2.35rem;
    transition: background-color .16s ease, border-color .16s ease, color .16s ease, box-shadow .16s ease;
}

.btn:hover:not(:disabled),
.btn-action:hover:not(:disabled),
.btn-page:hover:not(:disabled),
.module-tab:hover {
    box-shadow: var(--ps-shadow-sm);
}

.btn-primary,
.btn-dark,
.btn-search,
.btn-action.primary {
    background: var(--ps-primary) !important;
    border-color: var(--ps-primary) !important;
    color: #ffffff !important;
    font-weight: var(--ps-weight-heavy);
}

.btn-primary:hover,
.btn-dark:hover,
.btn-search:hover:not(:disabled),
.btn-action.primary:hover:not(:disabled) {
    background: var(--ps-accent-hover) !important;
    border-color: var(--ps-accent-hover) !important;
    color: #ffffff !important;
}

.btn-success,
.module-tab.active {
    background: var(--ps-accent) !important;
    border-color: var(--ps-accent) !important;
    color: #ffffff !important;
}

.btn-success:hover,
.module-tab.active:hover {
    background: var(--ps-accent-hover) !important;
    border-color: var(--ps-accent-hover) !important;
}

.btn-outline-primary,
.btn-outline-success,
.btn-outline-dark,
.btn-outline-secondary,
.btn-soft-primary,
.btn-action.secondary,
.btn-page {
    background: #ffffff !important;
    border: 1px solid var(--ps-border-strong) !important;
    color: #334155 !important;
    font-weight: 700;
}

.btn-outline-primary:hover,
.btn-outline-success:hover,
.btn-outline-dark:hover,
.btn-outline-secondary:hover,
.btn-soft-primary:hover,
.btn-action.secondary:hover:not(:disabled),
.btn-page:hover:not(:disabled) {
    background: var(--ps-accent-soft) !important;
    border-color: #99f6e4 !important;
    color: var(--ps-accent-hover) !important;
}

.btn-action.danger {
    background: var(--ps-danger-bg) !important;
    border: 1px solid #fecdd3 !important;
    color: var(--ps-danger) !important;
}

.btn-action.danger:hover:not(:disabled) {
    background: #ffe4e6 !important;
    border-color: #fda4af !important;
    color: #9f1239 !important;
}

.btn-warning {
    background: var(--ps-warning-bg) !important;
    border-color: #fde68a !important;
    color: var(--ps-warning) !important;
}

.btn-danger,
.btn-outline-danger:hover {
    background: var(--ps-danger-bg) !important;
    border-color: #fecdd3 !important;
    color: var(--ps-danger) !important;
}

.app-table-shell,
.compact-table {
    background: #ffffff;
    border: 1px solid var(--ps-border);
    border-radius: var(--ps-radius-lg);
    overflow: hidden;
}

.table,
.client-table {
    color: #334155;
}

.table thead th,
.client-table thead th,
.compact-table table thead th {
    background: var(--ps-surface-soft) !important;
    border-bottom: 1px solid var(--ps-border) !important;
    color: var(--ps-muted) !important;
    font-size: var(--ps-font-xs);
    font-weight: var(--ps-weight-heavy);
    letter-spacing: .06em;
    text-transform: uppercase;
}

.table tbody td,
.client-table tbody td {
    border-color: var(--ps-border-soft) !important;
    vertical-align: middle;
}

.table tbody tr:hover,
.client-table tbody tr:hover {
    background: #fbfdfc !important;
}

.table-active,
.client-search-surface .table-selected {
    --bs-table-bg-state: var(--ps-accent-soft);
    background: var(--ps-accent-soft) !important;
    box-shadow: inset 4px 0 0 var(--ps-accent);
}

.status-badge {
    align-items: center;
    border-radius: 999px;
    display: inline-flex;
    font-size: var(--ps-font-xs);
    font-weight: var(--ps-weight-bold);
    line-height: 1;
    min-height: 1.55rem;
    padding: .38rem .62rem;
}

.status-info,
.badge.bg-primary {
    background: var(--ps-accent-soft) !important;
    border: 1px solid #ccfbf1;
    color: var(--ps-accent-hover) !important;
}

.status-active,
.status-paid,
.badge.bg-success,
.text-bg-success {
    background: var(--ps-success-bg) !important;
    border: 1px solid #a7f3d0;
    color: var(--ps-success) !important;
}

.status-warning,
.badge.bg-warning {
    background: var(--ps-warning-bg) !important;
    border: 1px solid #fde68a;
    color: var(--ps-warning) !important;
}

.status-risk,
.status-overdue,
.badge.bg-danger {
    background: var(--ps-danger-bg) !important;
    border: 1px solid #fecdd3;
    color: var(--ps-danger) !important;
}

.status-cancelled {
    background: var(--ps-danger-bg) !important;
    border: 1px solid #fecdd3;
    color: var(--ps-danger) !important;
}

.status-inactive,
.badge.bg-secondary {
    background: #f8fafc !important;
    border: 1px solid var(--ps-border);
    color: var(--ps-muted) !important;
}

.client-search-surface .search-icon,
.search-icon {
    background: transparent !important;
    color: var(--ps-muted);
}

.client-search-surface .search-input {
    min-height: 2.625rem;
}

.client-search-surface .client-table-footer small,
.client-table-footer small {
    background: var(--ps-surface-soft);
    border: 1px solid var(--ps-border);
    border-radius: 999px;
    color: var(--ps-muted) !important;
    font-weight: 700;
    padding: .5rem .75rem;
}

.client-name,
.detail-value,
.metric-value,
.quick-action-title {
    font-weight: var(--ps-weight-bold);
}

.client-meta span,
.mobile-client-info strong,
.loan-plan-summary strong,
.parameter-logo-preview,
.empty-icon {
    font-weight: 700;
}

.loan-plan-summary small,
.mobile-client-info small,
.detail-label,
.metric-label {
    font-size: var(--ps-font-xs);
    font-weight: var(--ps-weight-bold);
    letter-spacing: .05em;
}

.btn-sm,
.btn-action {
    font-size: .8rem;
    min-width: 5.35rem;
    padding-left: .8rem;
    padding-right: .8rem;
}

.page-actions .btn,
.action-buttons .btn,
.action-buttons .btn-action {
    white-space: nowrap;
}

.client-table .action-buttons {
    flex-wrap: nowrap;
}

.client-table td.text-end {
    white-space: nowrap;
}

.client-create-layout:has(> .client-create-main:only-child) {
    grid-template-columns: minmax(0, 1fr);
    max-width: 1120px;
}

.parameter-logo-preview,
.client-empty-state {
    background: var(--ps-surface-soft);
    border-color: var(--ps-border);
}

.confirm-dialog {
    border-radius: 20px;
    box-shadow: var(--ps-shadow-lg);
}

@media (max-width: 1100px) {
    .client-create-layout,
    .client-expediente-layout {
        grid-template-columns: 1fr;
    }

    .client-section-nav {
        position: static;
    }
}

@media (max-width: 768px) {
    .content {
        padding-top: 1rem;
    }

    .page-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .page-actions,
    .action-buttons,
    .confirm-dialog-actions {
        width: 100%;
    }

    .page-actions .btn,
    .action-buttons .btn,
    .action-buttons .btn-action {
        flex: 1 1 auto;
    }

    .client-search-header,
    .surface-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .client-search-body,
    .surface-body,
    .card-body {
        padding: 1rem;
    }
}

@media (max-width: 520px) {
    .page-title,
    .page-header h1 {
        font-size: 1.35rem;
    }

    .client-table-footer,
    .pagination-actions,
    .confirm-dialog-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .btn-page,
    .confirm-dialog-actions .btn {
        width: 100%;
    }
}

/* Complementos de formularios y guias conservados del sistema anterior. */
.cash-amount {
    font-weight: var(--ps-weight-bold);
}

.required-label::after {
    background: var(--ps-accent-soft);
    border: 1px solid rgba(15, 118, 110, .14);
    border-radius: 999px;
    color: var(--ps-accent);
    content: "Obligatorio";
    display: inline-flex;
    font-size: .65rem;
    font-weight: var(--ps-weight-bold);
    line-height: 1;
    margin-left: .45rem;
    padding: .22rem .45rem;
    text-transform: uppercase;
    vertical-align: .08rem;
}

.client-form-header {
    background: #ffffff;
}

.client-validation {
    display: none !important;
}

.client-form-guide {
    background: var(--ps-surface-soft);
}

.guide-title {
    align-items: center;
    display: flex;
    gap: .65rem;
}

.guide-title .surface-title {
    margin: 0;
}

.guide-help-icon {
    align-items: center;
    background: var(--ps-accent-soft);
    border: 1px solid rgba(15, 118, 110, .18);
    border-radius: 999px;
    color: var(--ps-accent);
    display: inline-flex;
    flex: 0 0 auto;
    font-size: .82rem;
    font-weight: var(--ps-weight-heavy);
    height: 1.75rem;
    justify-content: center;
    width: 1.75rem;
}

.field-help {
    align-items: center;
    background: var(--ps-accent-soft);
    border: 1px solid rgba(15, 118, 110, .16);
    border-radius: 999px;
    color: var(--ps-accent);
    cursor: help;
    display: inline-flex;
    font-size: .68rem;
    font-weight: var(--ps-weight-heavy);
    height: 1.05rem;
    justify-content: center;
    margin-left: .28rem;
    transform: translateY(-1px);
    width: 1.05rem;
}

.section-help-toggle {
    background: #ffffff;
    border: 1px solid var(--ps-border);
    border-radius: 999px;
    color: var(--ps-accent);
    font-size: .76rem;
    font-weight: var(--ps-weight-bold);
    margin-left: auto;
    min-height: 1.9rem;
    padding: .25rem .75rem;
}

.section-help-toggle:hover {
    background: var(--ps-accent-soft);
    border-color: rgba(15, 118, 110, .22);
}

.section-help-panel {
    background: var(--ps-accent-soft);
    border: 1px solid rgba(15, 118, 110, .14);
    border-radius: var(--ps-radius-md);
    color: #334155;
    display: grid;
    font-size: .86rem;
    gap: .45rem;
    line-height: 1.45;
    margin: .85rem 0 1rem;
    padding: .85rem 1rem;
}

.section-help-panel strong {
    color: var(--ps-text);
}

.client-guide-item {
    align-items: flex-start;
    color: #475467;
    display: flex;
    font-size: .9rem;
    gap: .55rem;
}

.client-guide-item + .client-guide-item {
    margin-top: .75rem;
}

.client-guide-dot {
    background: var(--ps-accent);
    border-radius: 999px;
    flex: 0 0 auto;
    height: .48rem;
    margin-top: .45rem;
    width: .48rem;
}

.client-switch-card strong,
.client-switch-card small {
    display: block;
}

.client-switch-card strong {
    color: var(--ps-text);
}

.client-switch-card small {
    color: var(--ps-muted);
    font-size: .82rem;
    margin-top: .1rem;
}

/* Layouts y componentes especificos de modulos. */
.quick-actions,
.case-list,
.client-file-list,
.client-reference-list,
.client-address-list,
.plan-help-grid,
.client-switch-grid,
.client-kpi-grid,
.loan-plan-summary {
    display: grid;
    gap: .85rem;
}

.quick-actions {
    grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
}

.quick-action,
.case-item,
.client-file-row,
.client-reference-card,
.client-document-card,
.client-address-card,
.client-address-summary,
.client-switch-card {
    background: #ffffff;
    border: 1px solid var(--ps-border);
    border-radius: var(--ps-radius-md);
    color: #334155;
    text-decoration: none;
}

.quick-action {
    display: block;
    padding: 1rem;
}

.case-item {
    display: grid;
    gap: .75rem;
    grid-template-columns: 1fr auto;
    padding: .95rem;
}

.case-item.selected {
    border-color: var(--ps-accent);
    box-shadow: 0 0 0 3px rgba(15, 118, 110, .08);
}

.detail-grid {
    display: grid;
    gap: .85rem;
    grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
}

.detail-item {
    padding: .9rem;
}

.person-summary-card {
    align-items: center;
    background: linear-gradient(135deg, #ffffff, var(--ps-accent-soft));
    border: 1px solid var(--ps-border);
    border-radius: var(--ps-radius-lg);
    display: flex;
    gap: 1rem;
    justify-content: space-between;
    margin-bottom: 1rem;
    padding: 1rem;
}

.person-summary-header {
    align-items: center;
    display: flex;
    gap: .85rem;
    min-width: 0;
}

.person-summary-name {
    color: var(--ps-text);
    font-size: 1.16rem;
    font-weight: var(--ps-weight-heavy);
    line-height: 1.2;
}

.person-summary-sections {
    display: grid;
    gap: 1rem;
}

.person-summary-section,
.info-summary-section {
    background: #ffffff;
    border: 1px solid var(--ps-border);
    border-radius: var(--ps-radius-lg);
    padding: 1rem;
}

.person-detail-grid,
.info-detail-grid {
    grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
    margin-top: .75rem;
}

.person-detail-grid .detail-item,
.info-detail-grid .detail-item {
    background: var(--ps-surface-soft) !important;
    border-color: var(--ps-border-soft) !important;
    min-width: 0;
    padding: .82rem .9rem;
}

.person-detail-grid .detail-label,
.info-detail-grid .detail-label {
    color: var(--ps-muted);
    font-size: .68rem;
    font-weight: 700;
    letter-spacing: .06em;
    line-height: 1.1;
    margin-bottom: .32rem;
    text-transform: uppercase;
}

.person-detail-grid .detail-value,
.info-detail-grid .detail-value {
    color: #1f2937;
    font-size: .9rem;
    font-weight: 600;
    line-height: 1.35;
    overflow-wrap: anywhere;
}

.person-notes {
    background: var(--ps-surface-soft);
    border: 1px solid var(--ps-border-soft);
    border-radius: var(--ps-radius-md);
    color: var(--ps-text);
    margin-top: .75rem;
    padding: .9rem;
    white-space: pre-wrap;
}

.person-notes.empty {
    color: var(--ps-muted);
    font-style: italic;
}

.flow-steps {
    display: grid;
    gap: .75rem;
    grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
    margin-bottom: 1rem;
}

.flow-step {
    background: #ffffff;
    border: 1px solid var(--ps-border);
    border-radius: var(--ps-radius-md);
    padding: .85rem;
}

.flow-step-number,
.client-section-number {
    align-items: center;
    background: var(--ps-accent) !important;
    border-radius: 999px;
    color: #ffffff;
    display: inline-flex;
    flex: 0 0 auto;
    font-size: .8rem;
    font-weight: var(--ps-weight-heavy);
    height: 1.7rem;
    justify-content: center;
    margin-bottom: .55rem;
    width: 1.7rem;
}

.flow-step-title {
    color: var(--ps-text);
    font-weight: var(--ps-weight-bold);
}

.flow-step-text {
    color: var(--ps-muted);
    font-size: .82rem;
    margin-top: .2rem;
}

.client-search-body {
    padding: 1.35rem 1.6rem 1.45rem;
}

.client-search-toolbar {
    align-items: end;
    display: grid;
    gap: .9rem;
    grid-template-columns: minmax(0, 1fr) auto;
    margin: 0 0 1.15rem;
    padding: 1rem;
}

.search-input-wrapper {
    position: relative;
}

.search-icon {
    color: var(--ps-muted);
    left: .95rem;
    pointer-events: none;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
}

.search-input {
    font-size: .86rem;
    min-height: 2.625rem;
    padding-left: 2.45rem;
}

.btn-search {
    align-items: center;
    border: 1px solid var(--ps-primary);
    border-radius: var(--ps-radius-md);
    display: inline-flex;
    font-size: .86rem;
    justify-content: center;
    min-height: 2.625rem;
    min-width: 8.75rem;
    padding: 0 .95rem;
    white-space: nowrap;
}

.btn-search-content {
    align-items: center;
    display: inline-flex;
    gap: .5rem;
}

.client-table-footer,
.pagination-actions {
    align-items: center;
    display: flex;
    gap: .75rem;
}

.client-table-footer {
    justify-content: space-between;
    margin-top: 1rem;
    padding: 0;
}

.pagination-actions {
    gap: .38rem;
}

.btn-page.current {
    background: #f1f5f9 !important;
    color: var(--ps-muted) !important;
}

.client-profile {
    align-items: center;
    display: grid;
    gap: .75rem;
    grid-template-columns: 6px minmax(0, 1fr);
}

.client-row-marker {
    align-self: stretch;
    border-radius: 999px;
    min-height: 2.6rem;
    width: 6px;
}

.client-row-marker.active {
    background: var(--ps-accent);
}

.client-row-marker.inactive {
    background: #cbd5e1;
}

.client-row-marker.cancelled {
    background: var(--ps-danger);
}

.client-row-marker.risk {
    background: #e11d48;
}

.client-identity,
.client-file-info,
.client-reference-content {
    min-width: 0;
}

.client-meta {
    display: flex;
    flex-wrap: wrap;
    gap: .4rem;
    margin-top: .35rem;
}

.client-meta span {
    background: var(--ps-surface-soft);
    border: 1px solid var(--ps-border);
    border-radius: 999px;
    color: var(--ps-muted);
    font-size: var(--ps-font-xs);
    font-weight: 700;
    padding: .2rem .5rem;
}

.client-mobile-list {
    display: none;
}

.client-mobile-card {
    padding: 1rem;
}

.mobile-client-info {
    display: grid;
    gap: .65rem;
    margin: 1rem 0;
}

.mobile-client-info div {
    background: var(--ps-surface-soft);
    border: 1px solid var(--ps-border-soft);
    border-radius: var(--ps-radius-md);
    padding: .65rem .75rem;
}

.mobile-client-info strong {
    color: var(--ps-text);
    display: block;
    font-size: .88rem;
    font-weight: 700;
    margin-top: .2rem;
    word-break: break-word;
}

.licensing-payment-card {
    background: var(--ps-surface);
    border: 1px solid var(--ps-border);
    border-radius: var(--ps-radius-lg);
    display: grid;
    gap: .85rem;
}

.licensing-payment-card-header {
    align-items: flex-start;
    display: flex;
    gap: .8rem;
    justify-content: space-between;
    min-width: 0;
}

.licensing-payment-card-header .client-identity {
    min-width: 0;
}

.licensing-payment-total {
    align-items: flex-end;
    display: flex;
    flex-direction: column;
    flex: 0 0 auto;
    gap: .15rem;
    text-align: right;
}

.licensing-payment-total strong {
    color: var(--ps-text);
    font-size: 1rem;
    font-weight: var(--ps-weight-heavy);
    line-height: 1.15;
}

.licensing-payment-total span,
.licensing-payment-info span {
    color: var(--ps-muted);
    display: block;
    font-size: var(--ps-font-xs);
    font-weight: 700;
    line-height: 1.35;
    margin-top: .18rem;
    overflow-wrap: anywhere;
}

.licensing-payment-info {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 18rem), 1fr));
    margin: 0;
}

.transfer-payment-panel,
.transfer-account-list,
.transfer-admin-list {
    display: grid;
    gap: .85rem;
    min-width: 0;
}

.transfer-account-list.compact {
    gap: .75rem;
}

.transfer-account-card {
    background: var(--ps-surface);
    border: 1px solid var(--ps-border);
    border-radius: 8px;
    display: grid;
    gap: .8rem;
    min-width: 0;
    padding: .95rem;
}

.transfer-account-card-header {
    align-items: flex-start;
    display: flex;
    gap: .85rem;
    justify-content: space-between;
    min-width: 0;
}

.transfer-account-card-header > div:first-child {
    min-width: 0;
}

.transfer-detail-grid {
    display: grid;
    gap: .65rem;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 11rem), 1fr));
    min-width: 0;
}

.transfer-detail-grid div {
    background: var(--ps-surface-soft);
    border: 1px solid var(--ps-border-soft);
    border-radius: 8px;
    min-width: 0;
    padding: .65rem .75rem;
}

.transfer-detail-grid span {
    color: var(--ps-muted);
    display: block;
    font-size: var(--ps-font-xs);
    font-weight: 700;
    line-height: 1.25;
    text-transform: uppercase;
}

.transfer-detail-grid strong {
    color: var(--ps-text);
    display: block;
    font-size: .92rem;
    line-height: 1.35;
    overflow-wrap: anywhere;
}

.transfer-instructions {
    color: var(--ps-muted);
    font-size: var(--ps-font-sm);
    line-height: 1.5;
    margin: 0;
    overflow-wrap: anywhere;
}

.master-license-card {
    background: var(--ps-surface);
    border: 1px solid var(--ps-border);
    border-radius: var(--ps-radius-lg);
    display: grid;
    gap: .85rem;
}

.master-license-card-header {
    align-items: flex-start;
    display: flex;
    gap: .85rem;
    justify-content: space-between;
    min-width: 0;
}

.master-license-card-header .client-identity {
    min-width: 0;
}

.master-license-status {
    align-items: flex-end;
    display: flex;
    flex: 0 0 auto;
    flex-direction: column;
    gap: .25rem;
    text-align: right;
}

.master-license-status small,
.master-license-info span {
    color: var(--ps-muted);
    display: block;
    font-size: var(--ps-font-xs);
    font-weight: 700;
    line-height: 1.35;
    margin-top: .18rem;
    overflow-wrap: anywhere;
}

.master-license-info {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 16rem), 1fr));
    margin: 0;
}

.master-license-info .form-control {
    min-width: 0;
    width: 100%;
}

.master-license-actions {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.master-licenses-table-shell > .table-responsive {
    overflow-x: visible !important;
}

.master-licenses-table-shell .client-table {
    min-width: 0 !important;
    table-layout: fixed;
    width: 100%;
}

.master-licenses-table-shell .client-table th,
.master-licenses-table-shell .client-table td {
    overflow-wrap: anywhere;
    white-space: normal !important;
}

.master-licenses-table-shell .client-table th:nth-child(1) {
    width: 16%;
}

.master-licenses-table-shell .client-table th:nth-child(2) {
    width: 15%;
}

.master-licenses-table-shell .client-table th:nth-child(3) {
    width: 13%;
}

.master-licenses-table-shell .client-table th:nth-child(4),
.master-licenses-table-shell .client-table th:nth-child(5) {
    width: 10%;
}

.master-licenses-table-shell .client-table th:nth-child(6) {
    width: 16%;
}

.master-licenses-table-shell .client-table th:nth-child(7) {
    width: 10%;
}

.master-licenses-table-shell .client-table th:nth-child(8) {
    width: 10%;
}

.master-licenses-table-shell .client-table .form-control {
    min-width: 0;
    width: 100%;
}

.master-licenses-table-shell .client-table .action-buttons {
    flex-wrap: wrap;
    gap: .4rem;
    justify-content: flex-end;
}

.master-licenses-table-shell .client-table .btn-action {
    min-width: 4.7rem;
    padding-left: .58rem;
    padding-right: .58rem;
}

@media (max-width: 1700px) {
    .content :where(.master-licenses-table-shell) {
        display: none;
    }

    .content :where(.master-licenses-mobile-list) {
        display: grid;
        gap: .9rem;
    }
}

@media (max-width: 1500px) {
    .content :where(.licensing-payments-table-shell, .master-licenses-table-shell) {
        display: none;
    }

    .content :where(.licensing-payments-mobile-list, .master-licenses-mobile-list) {
        display: grid;
        gap: .9rem;
    }

    .content :where(.licensing-payment-card-header, .master-license-card-header, .transfer-account-card-header) {
        align-items: stretch;
        flex-direction: column;
    }

    .content :where(.transfer-account-card-header .action-buttons) {
        justify-content: flex-start;
    }

    .content :where(.licensing-payment-total, .master-license-status) {
        align-items: flex-start;
        background: var(--ps-surface-soft);
        border: 1px solid var(--ps-border-soft);
        border-radius: var(--ps-radius-md);
        padding: .65rem .75rem;
        text-align: left;
        width: 100%;
    }
}

.client-expediente-layout,
.client-create-layout,
.acreditado-edit-layout {
    align-items: start;
    display: grid;
    gap: 1.15rem;
}

.client-expediente-layout {
    grid-template-columns: minmax(16rem, .32fr) minmax(0, 1fr);
}

.client-create-layout,
.plan-form-layout {
    grid-template-columns: minmax(0, 1.35fr) minmax(21rem, .65fr);
}

.client-expediente-side,
.client-create-main,
.client-create-side,
.acreditados-form-column {
    min-width: 0;
}

.client-create-side,
.client-side-actions {
    display: grid;
    gap: 1rem;
}

.client-section-nav {
    position: sticky;
    top: 5.5rem;
}

.client-section-heading {
    align-items: flex-start;
    display: flex;
    gap: .75rem;
    margin-bottom: 1rem;
}

.client-section-heading .btn-soft-add {
    flex: 0 0 auto;
}

.btn-soft-add {
    align-items: center;
    background: var(--ps-accent-soft) !important;
    border: 1px solid #99f6e4 !important;
    color: var(--ps-accent-hover) !important;
    display: inline-flex;
    gap: .35rem;
    min-height: 2rem;
    padding: .35rem .7rem;
    white-space: nowrap;
}

.btn-soft-add span {
    font-size: 1rem;
    font-weight: var(--ps-weight-heavy);
    line-height: 1;
}

.btn-soft-add:hover {
    background: #ccfbf1 !important;
    border-color: #5eead4 !important;
    color: var(--ps-primary-hover) !important;
}

.client-section-number {
    margin-bottom: 0;
}

.client-form-actions {
    align-items: center;
    background: rgba(255, 255, 255, .94);
    border-top: 1px solid var(--ps-border);
    bottom: 0;
    box-shadow: 0 -10px 24px rgba(15, 23, 42, .06);
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    justify-content: space-between;
    padding: 1rem 1.15rem;
    position: sticky;
    z-index: 5;
    backdrop-filter: blur(12px);
}

.client-switch-grid {
    grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
}

.client-switch-card {
    align-items: flex-start;
    cursor: pointer;
    display: flex;
    gap: .75rem;
    padding: .9rem;
}

.client-switch-card.danger {
    background: #fffafa;
    border-color: #fecaca;
}

.client-upload-box {
    border-style: dashed !important;
    padding: 1rem;
}

.client-file-input {
    align-items: center;
    display: flex;
    padding: .45rem .65rem;
}

.client-file-row,
.client-reference-card,
.client-document-card {
    align-items: center;
    display: grid;
    gap: .75rem;
    grid-template-columns: auto minmax(0, 1fr) auto;
    padding: .8rem;
}

.client-file-icon,
.client-reference-avatar,
.empty-icon {
    align-items: center;
    background: var(--ps-accent-soft) !important;
    border: 1px solid #ccfbf1;
    border-radius: var(--ps-radius-sm);
    color: var(--ps-accent-hover) !important;
    display: inline-flex;
    font-weight: var(--ps-weight-heavy);
    height: 2.5rem;
    justify-content: center;
    width: 2.5rem;
}

.client-reference-avatar {
    border-radius: 999px;
}

.client-file-name {
    color: var(--ps-text);
    font-weight: var(--ps-weight-bold);
    overflow-wrap: anywhere;
}

.client-file-meta {
    color: var(--ps-muted);
    font-size: .82rem;
    overflow-wrap: anywhere;
}

.client-file-actions {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: .45rem;
    justify-content: flex-end;
}

.client-file-action {
    align-items: center;
    display: inline-flex;
    font-size: .78rem;
    justify-content: center;
    line-height: 1;
    min-height: 2rem;
    padding: .35rem .65rem;
    white-space: nowrap;
}

.document-preview-backdrop {
    align-items: center;
    background: rgba(15, 23, 42, .58);
    display: flex;
    inset: 0;
    justify-content: center;
    padding: 1.25rem;
    position: fixed;
    z-index: 1080;
}

.document-preview-modal {
    background: #ffffff;
    border: 1px solid rgba(226, 232, 240, .9);
    border-radius: var(--ps-radius-lg);
    box-shadow: var(--ps-shadow-lg);
    display: flex;
    flex-direction: column;
    max-height: min(88vh, 920px);
    max-width: 1040px;
    overflow: hidden;
    width: min(100%, 1040px);
}

.document-preview-header {
    align-items: center;
    border-bottom: 1px solid var(--ps-border);
    display: flex;
    gap: 1rem;
    justify-content: space-between;
    padding: 1rem 1.15rem;
}

.document-preview-title {
    color: var(--ps-text);
    font-weight: var(--ps-weight-heavy);
    overflow-wrap: anywhere;
}

.document-preview-meta {
    color: var(--ps-muted);
    font-size: var(--ps-font-xs);
    margin-top: .2rem;
}

.document-preview-body {
    background: var(--ps-surface-soft);
    min-height: 420px;
    overflow: auto;
    padding: 1rem;
}

.document-preview-frame {
    background: #ffffff;
    border: 1px solid var(--ps-border);
    border-radius: var(--ps-radius-md);
    height: min(70vh, 720px);
    width: 100%;
}

.document-preview-image {
    background: #ffffff;
    border: 1px solid var(--ps-border);
    border-radius: var(--ps-radius-md);
    display: block;
    margin: 0 auto;
    max-height: 70vh;
    max-width: 100%;
    object-fit: contain;
}

.document-preview-empty {
    align-items: center;
    color: var(--ps-muted);
    display: flex;
    flex-direction: column;
    gap: .65rem;
    justify-content: center;
    min-height: 360px;
    text-align: center;
}

.document-preview-empty strong {
    color: var(--ps-text);
}

.archivo-preview {
    border-radius: var(--ps-radius-sm);
    height: 2.5rem;
    object-fit: cover;
    width: 2.5rem;
}

.client-document-group + .client-document-group,
.client-detail-block {
    border-top: 1px solid var(--ps-border);
    margin-top: 1rem;
    padding-top: 1rem;
}

.client-document-grid {
    grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr));
}

.client-kpi-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin-bottom: 1rem;
}

.client-address-card,
.client-address-summary {
    padding: 1rem;
}

.client-address-card-header,
.client-address-summary-header {
    align-items: center;
    display: flex;
    gap: 1rem;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.client-address-title {
    color: var(--ps-text);
    font-weight: var(--ps-weight-bold);
}

.client-inline-check {
    align-items: center;
    color: #334155;
    display: inline-flex;
    font-size: .82rem;
    font-weight: 700;
    gap: .4rem;
    margin: 0;
}

.client-address-summary-grid {
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    margin-top: .85rem;
}

.client-address-summary small {
    color: var(--ps-muted);
    display: block;
    margin-top: .45rem;
}

.person-address-line {
    color: var(--ps-text);
    font-size: .94rem;
    font-weight: 600;
    line-height: 1.45;
    margin-top: .8rem;
}

.acreditados-layout,
.acreditado-edit-layout {
    grid-template-columns: 1fr;
}

.acreditados-directory .client-search-body {
    padding: 1.35rem 1.6rem 1.45rem;
}

.acreditados-tabs,
.acreditados-members,
.acreditados-directory .app-table-shell,
.quick-client-box {
    margin-bottom: 1rem;
}

.acreditado-edit-layout .client-form-shell,
.acreditado-edit-layout > aside.client-form-shell {
    max-width: 980px;
}

.compact-table {
    margin: 0;
}

.quick-client-box {
    padding: 1rem;
}

.plan-form-layout {
    grid-template-columns: minmax(0, 1fr) minmax(18rem, .34fr);
}

.plan-help-grid {
    grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
}

.plan-form-layout .form-text {
    color: var(--ps-muted);
    font-size: .78rem;
    line-height: 1.45;
}

.plan-form-layout .client-switch-card {
    min-height: 4.5rem;
}

.plan-preview {
    margin-top: 1rem;
}

.plan-preview .surface-body {
    padding: 1rem;
}

.plan-preview .detail-grid {
    grid-template-columns: 1fr;
}

.plan-preview-table {
    max-height: 20rem;
    overflow: auto;
}

.plan-preview-table table {
    min-width: 38rem;
}

.loan-plan-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding: .75rem;
}

.loan-plan-summary div {
    background: #ffffff;
    border: 1px solid var(--ps-border-soft);
    border-radius: var(--ps-radius-sm);
    padding: .65rem;
}

.loan-plan-summary strong {
    color: var(--ps-text);
    display: block;
    font-size: .86rem;
    font-weight: 700;
    margin-top: .2rem;
}

.empty-state,
.client-empty-state,
.client-loading-state {
    align-items: center;
    color: var(--ps-muted);
    display: flex;
    flex-direction: column;
    gap: .5rem;
    justify-content: center;
    min-height: 8rem;
    padding: 1.5rem;
    text-align: center;
}

.client-loading-state .loading-spinner,
.loading-spinner {
    border-color: #e2e8f0;
    border-radius: 999px;
    border-style: solid;
    border-top-color: var(--ps-accent) !important;
    border-width: 2px;
    height: 2.4rem;
    width: 2.4rem;
}

.spinner,
.loading-spinner {
    animation: spin .75s linear infinite;
}

.spinner {
    border: 2px solid rgba(255,255,255,.35);
    border-radius: 999px;
    border-top-color: #ffffff;
    height: .95rem;
    width: .95rem;
}

.parameter-logo-preview {
    color: var(--ps-muted);
    display: grid;
    font-size: .86rem;
    min-height: 118px;
    padding: 18px;
    place-items: center;
}

.parameter-logo-preview img {
    max-height: 92px;
    max-width: 100%;
    object-fit: contain;
}

.confirm-dialog-overlay {
    background: rgba(15, 23, 42, .46);
    backdrop-filter: blur(5px);
    display: grid;
    inset: 0;
    padding: 18px;
    place-items: center;
    position: fixed;
    z-index: 2500;
}

.confirm-dialog {
    background: #ffffff;
    border: 1px solid var(--ps-border);
    overflow: hidden;
    width: min(460px, 100%);
}

.confirm-dialog-header {
    display: grid;
    gap: 16px;
    grid-template-columns: auto 1fr;
    padding: 24px 24px 18px;
}

.confirm-dialog-icon {
    border-radius: 14px;
    display: grid;
    font-weight: var(--ps-weight-heavy);
    height: 42px;
    place-items: center;
    width: 42px;
}

.confirm-dialog-icon.danger {
    background: var(--ps-danger-bg);
    color: var(--ps-danger);
}

.confirm-dialog-icon.warning {
    background: var(--ps-warning-bg);
    color: var(--ps-warning);
}

.confirm-dialog-icon.primary {
    background: var(--ps-accent-soft);
    color: var(--ps-accent);
}

.confirm-dialog h2 {
    color: var(--ps-text);
    font-size: 1.08rem;
    font-weight: var(--ps-weight-heavy);
    margin: 0;
}

.confirm-dialog p {
    color: var(--ps-muted);
    font-size: .92rem;
    line-height: 1.45;
    margin: 7px 0 0;
}

.confirm-dialog-message {
    white-space: pre-line;
}

.confirm-dialog-actions {
    background: var(--ps-surface-soft);
    border-top: 1px solid var(--ps-border-soft);
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    padding: 16px 24px 22px;
}

/* Microinteracciones finales */
.surface,
.client-search-surface,
.metric-card,
.client-mobile-card,
.transfer-account-card,
.client-reference-card,
.client-document-card {
    transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;
}

.surface:hover,
.client-search-surface:hover,
.metric-card:hover,
.client-mobile-card:hover,
.transfer-account-card:hover,
.client-reference-card:hover,
.client-document-card:hover {
    border-color: var(--ps-border-strong);
    box-shadow: var(--ps-shadow-lg);
}

.btn:active:not(:disabled),
.btn-action:active:not(:disabled),
.btn-page:active:not(:disabled),
.module-tab:active:not(:disabled) {
    transform: translateY(0) scale(.985);
}

.btn:focus-visible,
.btn-action:focus-visible,
.btn-page:focus-visible,
.module-tab:focus-visible,
.form-control:focus-visible,
.form-select:focus-visible {
    outline: 3px solid rgba(15, 118, 110, .18);
    outline-offset: 2px;
}

.table tbody tr,
.client-table tbody tr {
    transition: background-color .16s ease, box-shadow .16s ease;
}

.table tbody tr:hover,
.client-table tbody tr:hover {
    box-shadow: inset 4px 0 0 rgba(15, 118, 110, .22);
}

.alert {
    animation: ps-slide-fade-in .22s ease both;
}

.confirm-dialog-overlay {
    animation: ps-fade-in .18s ease both;
}

.confirm-dialog {
    animation: ps-dialog-in .2s cubic-bezier(.2, .8, .2, 1) both;
}

.loading-spinner {
    animation-duration: .75s;
}

.btn[disabled],
.btn-action:disabled,
.btn-page:disabled {
    transform: none !important;
}

.action-icon {
    background: currentColor !important;
    display: inline-block;
    flex: 0 0 auto;
    height: .95rem;
    mask-position: center;
    mask-repeat: no-repeat;
    mask-size: contain;
    width: .95rem;
}

.action-icon-view {
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 5c5.5 0 9.5 5.2 9.5 7s-4 7-9.5 7-9.5-5.2-9.5-7S6.5 5 12 5Zm0 2C8.1 7 5 10.6 4.6 12c.4 1.4 3.5 5 7.4 5s7-3.6 7.4-5C19 10.6 15.9 7 12 7Zm0 2.2a2.8 2.8 0 1 1 0 5.6 2.8 2.8 0 0 1 0-5.6Z'/%3E%3C/svg%3E");
}

.action-icon-edit {
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M5 17.2 16.9 5.3l1.8 1.8L6.8 19H5v-1.8ZM18.2 4l1.8 1.8-1.1 1.1-1.8-1.8L18.2 4ZM4 21h16v-2H9.8l-2 2H4Z'/%3E%3C/svg%3E");
}

.action-icon-pay {
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M3 6.5A2.5 2.5 0 0 1 5.5 4h13A2.5 2.5 0 0 1 21 6.5v11a2.5 2.5 0 0 1-2.5 2.5h-13A2.5 2.5 0 0 1 3 17.5v-11ZM5 8v2h14V8H5Zm2 6v2h5v-2H7Zm8.8-.9-2.9 2.9-1.4-1.4-1.2 1.2 2.6 2.6 4.1-4.1-1.2-1.2Z'/%3E%3C/svg%3E");
}

.action-icon-receipt {
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M6 3h12v18l-2-1.2-2 1.2-2-1.2-2 1.2-2-1.2L6 21V3Zm3 5v2h6V8H9Zm0 4v2h6v-2H9Zm0 4v2h4v-2H9Z'/%3E%3C/svg%3E");
}

.action-icon-cancel {
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2a10 10 0 1 0 0 20 10 10 0 0 0 0-20Zm-4.2 6.4 1.4-1.4 2.8 2.8 2.8-2.8 1.4 1.4-2.8 2.8 2.8 2.8-1.4 1.4-2.8-2.8-2.8 2.8-1.4-1.4 2.8-2.8-2.8-2.8Z'/%3E%3C/svg%3E");
}

@keyframes ps-fade-in {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes ps-slide-fade-in {
    from {
        opacity: 0;
        transform: translateY(-6px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes ps-dialog-in {
    from {
        opacity: 0;
        transform: translateY(8px) scale(.97);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Ajustes de compatibilidad visual para vistas migradas. */
.client-form-subtitle,
.client-help-text,
.case-meta,
.quick-action-text,
.client-action-text,
.client-section-text,
.metric-note {
    color: var(--ps-muted);
    font-size: .86rem;
    line-height: 1.45;
}

.client-form-subtitle {
    margin-top: .25rem;
}

.client-form-status {
    align-items: center;
    color: var(--ps-muted);
    display: flex;
    flex-wrap: wrap;
    font-size: .84rem;
    gap: .45rem;
}

.client-section-title,
.client-action-title,
.case-title,
.client-list-heading,
.metric-card-strong,
.balance-value,
.loan-summary {
    color: var(--ps-text);
    font-weight: var(--ps-weight-bold);
}

.client-action-title {
    font-size: .96rem;
}

.quick-action-title,
.case-title {
    display: block;
}

.quick-action-text {
    display: block;
    margin-top: .25rem;
}

/* Inicio: tarjetas de resumen y accesos rapidos. */
.quick-actions {
    align-items: stretch;
}

.quick-action {
    background:
        linear-gradient(135deg, #ffffff, #f8fafc);
    border: 1px solid var(--ps-border);
    border-radius: var(--ps-radius-lg);
    box-shadow: var(--ps-shadow-sm);
    min-height: 6.4rem;
    padding: 1rem 1.1rem;
    position: relative;
    transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;
}

.quick-action::before {
    background: var(--ps-accent);
    border-radius: 999px;
    content: "";
    height: 2.1rem;
    opacity: .14;
    position: absolute;
    right: 1rem;
    top: 1rem;
    width: 2.1rem;
}

.quick-action:hover {
    border-color: #99f6e4;
    box-shadow: var(--ps-shadow-md);
    color: inherit;
    transform: translateY(-2px);
}

.quick-action-title {
    color: var(--ps-text);
    display: block;
    font-size: .98rem;
    font-weight: var(--ps-weight-heavy);
    line-height: 1.25;
    padding-right: 2.7rem;
}

.quick-action-text {
    color: var(--ps-muted);
    display: block;
    font-size: .84rem;
    line-height: 1.45;
    margin-top: .4rem;
    max-width: 15rem;
}

.metric-card {
    background:
        radial-gradient(circle at top right, rgba(15, 118, 110, .08), transparent 34%),
        #ffffff;
    border: 1px solid var(--ps-border);
    border-radius: var(--ps-radius-lg);
    box-shadow: var(--ps-shadow-sm);
    display: flex;
    flex-direction: column;
    gap: .45rem;
    height: 100%;
    min-height: 8.2rem;
    overflow: hidden;
    padding: 1.05rem 1.15rem;
    position: relative;
}

.metric-card::after {
    background: var(--ps-accent);
    border-radius: 999px;
    bottom: 0;
    content: "";
    height: 4px;
    left: 1.15rem;
    opacity: .75;
    position: absolute;
    right: 1.15rem;
}

.metric-card-strong {
    background:
        radial-gradient(circle at top right, rgba(15, 118, 110, .14), transparent 38%),
        linear-gradient(135deg, #ffffff, #f0fdfa);
    border-color: #99f6e4;
}

.metric-label {
    color: var(--ps-muted);
    font-size: var(--ps-font-xs);
    font-weight: var(--ps-weight-heavy);
    letter-spacing: .06em;
    text-transform: uppercase;
}

.metric-value {
    color: var(--ps-text);
    font-size: 1.82rem;
    font-weight: var(--ps-weight-heavy);
    letter-spacing: 0;
    line-height: 1.05;
}

.metric-value.money {
    font-size: clamp(1.25rem, 2vw, 1.72rem);
    overflow-wrap: anywhere;
}

.metric-note {
    color: var(--ps-muted);
    font-size: .84rem;
    line-height: 1.35;
    margin-top: auto;
    padding-bottom: .25rem;
}

.surface-header {
    align-items: center;
    display: flex;
    gap: 1rem;
    justify-content: space-between;
}

.surface-title {
    margin: 0;
}

.surface-header .btn {
    align-items: center;
    background: #ffffff !important;
    border: 1px solid var(--ps-border-strong) !important;
    border-radius: var(--ps-radius-sm);
    color: #334155 !important;
    display: inline-flex;
    font-size: .8rem;
    font-weight: var(--ps-weight-bold);
    gap: .4rem;
    justify-content: center;
    min-height: 2.2rem;
    padding: .4rem .72rem;
    text-decoration: none;
    white-space: nowrap;
}

.surface-header .btn:hover {
    background: var(--ps-accent-soft) !important;
    border-color: #99f6e4 !important;
    color: var(--ps-accent-hover) !important;
}

.module-tabs {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: .55rem;
}

.module-tabs.vertical-tabs {
    align-items: stretch;
    flex-direction: column;
}

.module-tab {
    align-items: center;
    background: #ffffff;
    border: 1px solid var(--ps-border-strong);
    color: #334155;
    display: inline-flex;
    gap: .45rem;
    justify-content: center;
    padding: .52rem .78rem;
    text-decoration: none;
}

.module-tabs.vertical-tabs .module-tab {
    justify-content: flex-start;
    width: 100%;
}

.client-expediente-main {
    min-width: 0;
}

.client-form-shell .surface-body {
    padding: 0;
}

.client-form-shell .client-form-section {
    border-bottom: 1px solid var(--ps-border-soft);
    padding: 1.15rem;
}

.client-form-shell .client-form-section:last-child {
    border-bottom: 0;
}

.client-form-section.compact {
    padding: 1rem;
}

.client-form-header,
.client-form-guide {
    border-bottom: 1px solid var(--ps-border-soft);
    padding: 1.15rem;
}

.client-form-guide {
    border-top: 1px solid var(--ps-border-soft);
}

.search-box {
    min-width: 0;
    width: 100%;
}

.search-icon {
    background: currentColor !important;
    display: inline-block;
    height: 1rem;
    left: .95rem;
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M10.5 4a6.5 6.5 0 0 1 5.16 10.45l4.45 4.44-1.42 1.42-4.44-4.45A6.5 6.5 0 1 1 10.5 4Zm0 2a4.5 4.5 0 1 0 0 9 4.5 4.5 0 0 0 0-9Z'/%3E%3C/svg%3E");
    mask-position: center;
    mask-repeat: no-repeat;
    mask-size: contain;
    pointer-events: none;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 1rem;
}

.table-sort-button {
    align-items: center;
    background: transparent;
    border: 0;
    color: inherit;
    display: inline-flex;
    font: inherit;
    font-weight: var(--ps-weight-heavy);
    gap: .35rem;
    letter-spacing: inherit;
    padding: 0;
    text-align: inherit;
    text-transform: inherit;
}

.table-sort-button:hover {
    color: var(--ps-accent-hover);
}

.status-group {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: .4rem;
}

.plan-rule-alerts {
    display: grid;
    gap: .55rem;
    margin-bottom: 1rem;
}

.plan-rule-alert {
    background: var(--ps-warning-bg);
    border: 1px solid #fde68a;
    border-radius: var(--ps-radius-md);
    color: var(--ps-warning);
    font-size: .86rem;
    font-weight: 700;
    padding: .7rem .85rem;
}

.client-address-actions {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
}

.file-row,
.document-row,
.address-row {
    align-items: center;
    display: flex;
    gap: .75rem;
}

.table-responsive {
    overflow-x: auto;
}

.table-sm > :not(caption) > * > * {
    padding: .45rem .55rem;
}

.table-light {
    --bs-table-bg: var(--ps-surface-soft);
}

@media (max-width: 768px) {
    .client-search-toolbar,
    .case-item,
    .plan-form-layout,
    .client-create-layout,
    .client-expediente-layout {
        grid-template-columns: 1fr;
    }

    .client-mobile-list {
        display: grid;
        gap: .9rem;
    }

    .action-buttons.mobile {
        display: grid;
        grid-template-columns: 1fr 1fr;
    }
}

/* Compatibilidad para paginas que aun usan estructura Bootstrap directa. */
.content > .d-flex.flex-wrap.justify-content-between.align-items-center.gap-3.mb-4 {
    align-items: flex-end !important;
    border-bottom: 1px solid var(--ps-border);
    gap: 1rem !important;
    margin-bottom: 1.35rem !important;
    padding-bottom: 1rem;
}

.content > .d-flex.flex-wrap.justify-content-between.align-items-center.gap-3.mb-4 h1,
.content h1.h3,
.content h1.h4 {
    color: var(--ps-text);
    font-size: var(--ps-font-title);
    font-weight: var(--ps-weight-heavy);
    letter-spacing: 0;
    line-height: 1.15;
}

.content h1.h4 {
    font-size: 1.28rem;
}

.content .text-muted {
    color: var(--ps-muted) !important;
}

.content .card.shadow-sm,
.content .card {
    background: var(--ps-surface);
    border: 1px solid var(--ps-border);
    border-radius: var(--ps-radius-lg);
    box-shadow: var(--ps-shadow-md) !important;
    overflow: hidden;
}

.content .card-header.bg-dark,
.content .card-header.bg-light,
.content .card-header {
    background: linear-gradient(135deg, #ffffff, var(--ps-surface-soft)) !important;
    border-bottom: 1px solid var(--ps-border);
    color: var(--ps-text) !important;
    font-size: .92rem;
    font-weight: var(--ps-weight-bold);
    padding: 1rem 1.15rem;
}

.content .card-body {
    padding: 1.15rem;
}

.content .display-6,
.content .h4 {
    color: var(--ps-text);
    font-size: 1.55rem;
    font-weight: var(--ps-weight-heavy);
    letter-spacing: 0;
    line-height: 1.1;
}

.content .small {
    font-size: var(--ps-font-xs);
    font-weight: 700;
}

.content .list-group {
    border-color: var(--ps-border);
    border-radius: var(--ps-radius-md);
    overflow: hidden;
}

.content .list-group-item {
    border-color: var(--ps-border-soft);
    color: #334155;
    transition: background-color .16s ease, color .16s ease, box-shadow .16s ease;
}

.content .list-group-item:hover,
.content .list-group-item.active {
    background: var(--ps-accent-soft);
    color: var(--ps-accent-hover);
}

.user-list {
    max-height: 360px;
    overflow: auto;
}

.permission-option {
    align-items: flex-start;
    background: #ffffff;
    border: 1px solid var(--ps-border);
    border-radius: var(--ps-radius-md);
    color: #334155;
    cursor: pointer;
    display: flex;
    gap: .75rem;
    min-height: 4.5rem;
    padding: .8rem;
    transition: background-color .16s ease, border-color .16s ease, box-shadow .16s ease;
    width: 100%;
}

.permission-option:hover {
    background: var(--ps-accent-soft);
    border-color: #99f6e4;
    box-shadow: 0 0 0 3px rgba(15, 118, 110, .08);
}

.permission-option small {
    color: var(--ps-muted);
    display: block;
    font-size: .8rem;
    margin-top: .15rem;
}

/* Normalizacion visual para vistas que aun usan Bootstrap directo. */
.content .row.g-3 > [class*="col-"] > .card.shadow-sm.h-100,
.content .row.g-3.mb-4 > [class*="col-"] > .card.shadow-sm.h-100,
.content .row.g-4 > [class*="col-"] > .card.shadow-sm.h-100 {
    background:
        radial-gradient(circle at top right, rgba(15, 118, 110, .08), transparent 34%),
        #ffffff;
    border: 1px solid var(--ps-border);
    border-radius: var(--ps-radius-lg);
    box-shadow: var(--ps-shadow-sm) !important;
    min-height: 8rem;
    position: relative;
}

.content .row.g-3 > [class*="col-"] > .card.shadow-sm.h-100::after,
.content .row.g-3.mb-4 > [class*="col-"] > .card.shadow-sm.h-100::after,
.content .row.g-4 > [class*="col-"] > .card.shadow-sm.h-100::after {
    background: var(--ps-accent);
    border-radius: 999px;
    bottom: 0;
    content: "";
    height: 4px;
    left: 1.15rem;
    opacity: .72;
    position: absolute;
    right: 1.15rem;
}

.content .row.g-3 > [class*="col-"] > .card.shadow-sm.h-100 .card-body,
.content .row.g-3.mb-4 > [class*="col-"] > .card.shadow-sm.h-100 .card-body,
.content .row.g-4 > [class*="col-"] > .card.shadow-sm.h-100 .card-body {
    display: flex;
    flex-direction: column;
    gap: .35rem;
}

.content .row.g-3 > [class*="col-"] > .card .text-muted.small,
.content .row.g-3.mb-4 > [class*="col-"] > .card .text-muted.small,
.content .row.g-4 > [class*="col-"] > .card .text-muted.small {
    color: var(--ps-muted) !important;
    font-size: var(--ps-font-xs);
    font-weight: var(--ps-weight-heavy);
    letter-spacing: .06em;
    text-transform: uppercase;
}

.content .row.g-3 > [class*="col-"] > .card .display-6,
.content .row.g-3.mb-4 > [class*="col-"] > .card .display-6,
.content .row.g-4 > [class*="col-"] > .card .display-6,
.content .row.g-3 > [class*="col-"] > .card .h4,
.content .row.g-3.mb-4 > [class*="col-"] > .card .h4,
.content .row.g-4 > [class*="col-"] > .card .h4 {
    color: var(--ps-text);
    font-size: clamp(1.25rem, 2vw, 1.72rem);
    font-weight: var(--ps-weight-heavy);
    line-height: 1.08;
    margin: 0;
    overflow-wrap: anywhere;
}

.content .card > .table-responsive,
.surface > .table-responsive {
    border-radius: 0 0 var(--ps-radius-lg) var(--ps-radius-lg);
}

.content .card > .table-responsive .table,
.surface > .table-responsive .table {
    margin-bottom: 0;
}

.content .card-header strong,
.surface-header strong {
    color: var(--ps-text);
    font-size: .96rem;
    font-weight: var(--ps-weight-bold);
}

.toolbar {
    align-items: end;
    display: grid;
    gap: .9rem;
    grid-template-columns: minmax(0, 1fr) auto;
    margin-bottom: 1rem;
    padding: 1rem;
}

.form-section {
    border: 1px solid var(--ps-border-soft);
    border-radius: var(--ps-radius-lg);
    margin-bottom: 1rem;
    padding: 1rem;
}

.form-section:last-child {
    margin-bottom: 0;
}

.form-text {
    color: var(--ps-muted);
    font-size: .78rem;
    line-height: 1.45;
}

.alert {
    border-radius: var(--ps-radius-md);
    border-width: 1px;
    box-shadow: var(--ps-shadow-sm);
    font-weight: 650;
}

.alert-success {
    background: var(--ps-success-bg);
    border-color: #a7f3d0;
    color: var(--ps-success);
}

.alert-danger {
    background: var(--ps-danger-bg);
    border-color: #fecdd3;
    color: var(--ps-danger);
}

.alert-info {
    background: var(--ps-accent-soft);
    border-color: #ccfbf1;
    color: var(--ps-accent-hover);
}

.alert-warning {
    background: var(--ps-warning-bg);
    border-color: #fde68a;
    color: var(--ps-warning);
}

.btn-group,
.btn-group-sm {
    gap: .35rem;
}

.btn-group > .btn,
.btn-group-sm > .btn {
    border-radius: var(--ps-radius-sm) !important;
}

.btn-outline-danger {
    background: #ffffff !important;
    border: 1px solid #fecdd3 !important;
    color: var(--ps-danger) !important;
    font-weight: 700;
}

.btn-outline-danger:hover {
    background: var(--ps-danger-bg) !important;
    border-color: #fecdd3 !important;
    color: var(--ps-danger) !important;
}

.recibo {
    background: #ffffff;
    border: 1px solid var(--ps-border) !important;
    border-radius: var(--ps-radius-lg) !important;
    font-size: .88rem;
    margin: 0 auto;
    max-width: 48rem;
    box-shadow: var(--ps-shadow-md);
}

.recibo dt {
    color: var(--ps-muted);
    font-size: var(--ps-font-xs);
    font-weight: var(--ps-weight-heavy);
    letter-spacing: .05em;
    text-transform: uppercase;
}

.recibo dd {
    color: var(--ps-text);
}

.receipt-header {
    align-items: flex-start;
    display: flex;
    gap: .75rem;
    justify-content: space-between;
}

.receipt-brand {
    align-items: flex-start;
    display: flex;
    gap: .7rem;
    min-width: 0;
}

.receipt-logo {
    flex: 0 0 auto;
    max-height: 3.2rem;
    max-width: 7rem;
    object-fit: contain;
}

.receipt-meta {
    flex: 0 0 auto;
    min-width: 7rem;
}

.receipt-info-grid,
.receipt-balance-grid {
    display: grid;
    gap: .42rem;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-bottom: .65rem;
}

.receipt-info-grid > div,
.receipt-balance-grid > div {
    background: #f8fafc;
    border: 1px solid var(--ps-border);
    border-radius: var(--ps-radius-sm);
    padding: .38rem .5rem;
}

.receipt-info-grid span,
.receipt-balance-grid span {
    color: var(--ps-muted);
    display: block;
    font-size: .66rem;
    font-weight: 800;
    letter-spacing: .05em;
    text-transform: uppercase;
}

.receipt-info-grid strong,
.receipt-balance-grid strong {
    color: var(--ps-text);
    display: block;
    font-size: .82rem;
    margin-top: .08rem;
}

.receipt-breakdown-table {
    border-collapse: collapse;
    margin: .5rem 0 .65rem;
    width: 100%;
}

.receipt-breakdown-table th,
.receipt-breakdown-table td {
    border: 1px solid var(--ps-border);
    padding: .32rem .48rem;
}

.receipt-breakdown-table th {
    background: #111827;
    color: #ffffff;
    font-size: .68rem;
    letter-spacing: .05em;
    text-transform: uppercase;
}

.receipt-breakdown-table td:last-child,
.receipt-breakdown-table th:last-child {
    text-align: right;
}

.receipt-total-row td {
    background: #ecfdf5;
    color: #064e3b;
    font-weight: 800;
}

.receipt-applied-row td {
    background: #f8fafc;
    color: var(--ps-text);
    font-weight: 800;
}

.receipt-note,
.receipt-legal-note {
    color: #334155;
    font-size: .78rem;
}

.receipt-note {
    background: #f8fafc;
    border: 1px solid var(--ps-border);
    border-radius: var(--ps-radius-sm);
    margin-bottom: .65rem;
    padding: .42rem .55rem;
}

.receipt-legal-note {
    border-top: 1px solid var(--ps-border);
    margin: .7rem 0 0;
    padding-top: .5rem;
}

.print-document {
    background: #ffffff;
}

.contract-payment-table {
    border-collapse: collapse;
    color: #111827;
    font-size: .8rem;
    margin-top: .75rem;
    width: 100%;
}

.contract-payment-table th,
.contract-payment-table td {
    border: 1px solid #d1d5db;
    padding: .42rem .5rem;
    text-align: right;
    white-space: nowrap;
}

.contract-payment-table th:nth-child(1),
.contract-payment-table td:nth-child(1),
.contract-payment-table th:nth-child(2),
.contract-payment-table td:nth-child(2) {
    text-align: left;
}

.contract-payment-table thead th,
.contract-payment-table tfoot th {
    font-weight: 800;
}

.contract-payment-table thead th {
    background: #111827;
    border-color: #111827;
    color: #ffffff;
    font-size: .72rem;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.contract-payment-table tbody tr:nth-child(even) td {
    background: #f8fafc;
}

.contract-payment-table tbody td {
    color: #1f2937;
}

.contract-payment-table .money-cell {
    font-variant-numeric: tabular-nums;
}

.contract-payment-table .total-cell {
    color: #065f46;
    font-weight: 800;
}

.contract-payment-table tfoot th {
    background: #ecfdf5;
    border-color: #a7f3d0;
    color: #064e3b;
}

@media print {
    @page {
        margin: 12mm;
        size: letter;
    }

    html,
    body {
        background: #ffffff !important;
        color: #111827 !important;
        height: auto !important;
        margin: 0 !important;
        overflow: visible !important;
    }

    body * {
        box-shadow: none !important;
        text-shadow: none !important;
    }

    .sidebar,
    .top-row,
    .d-print-none,
    .confirm-dialog-backdrop,
    .blazor-error-boundary,
    #blazor-error-ui {
        display: none !important;
    }

    .page,
    main,
    article.content,
    .content {
        background: #ffffff !important;
        display: block !important;
        margin: 0 !important;
        max-width: none !important;
        min-height: 0 !important;
        padding: 0 !important;
        width: 100% !important;
    }

    .print-document {
        border: 0 !important;
        border-radius: 0 !important;
        box-shadow: none !important;
        margin: 0 !important;
        padding: 0 !important;
        width: 100% !important;
    }

    .print-document .app-table-shell {
        border: 1px solid #d1d5db !important;
        border-radius: 0 !important;
        overflow: visible !important;
    }

    .print-document .table-responsive {
        overflow: visible !important;
    }

    .print-document table {
        border-collapse: collapse !important;
        min-width: 0 !important;
        width: 100% !important;
    }

    .print-document th,
    .print-document td {
        background: #ffffff !important;
        border: 1px solid #d1d5db !important;
        color: #111827 !important;
        padding: 6px 8px !important;
    }

    .contract-payment-table,
    .contract-payment-table thead,
    .contract-payment-table tbody,
    .contract-payment-table tfoot,
    .contract-payment-table tr,
    .contract-payment-table th,
    .contract-payment-table td {
        visibility: visible !important;
    }

    .contract-payment-table {
        border-collapse: collapse !important;
        display: table !important;
        font-size: 8.25pt !important;
        margin-top: 4mm !important;
        table-layout: fixed !important;
        width: 100% !important;
    }

    .contract-payment-table th,
    .contract-payment-table td {
        border: 1px solid #9ca3af !important;
        display: table-cell !important;
        padding: 4px 5px !important;
        white-space: nowrap;
    }

    .contract-payment-table thead th {
        background: #111827 !important;
        border-color: #111827 !important;
        color: #ffffff !important;
        font-size: 7.5pt !important;
        letter-spacing: .03em;
    }

    .contract-payment-table tbody tr:nth-child(even) td {
        background: #f3f4f6 !important;
    }

    .contract-payment-table .total-cell {
        color: #064e3b !important;
        font-weight: 800 !important;
    }

    .contract-payment-table tfoot th {
        background: #dcfce7 !important;
        border-color: #86efac !important;
        color: #064e3b !important;
    }

    .contract-payment-table thead {
        display: table-header-group !important;
    }

    .contract-payment-table tbody {
        display: table-row-group !important;
    }

    .contract-payment-table tfoot {
        display: table-footer-group !important;
    }

    .contract-payment-table tfoot th {
        font-weight: 700 !important;
    }

    .print-document thead {
        display: table-header-group;
    }

    .print-document tr,
    .print-document section,
    .print-document header {
        break-inside: avoid;
        page-break-inside: avoid;
    }

    .receipt-header {
        align-items: flex-start !important;
        display: flex !important;
        gap: 5mm !important;
        justify-content: space-between !important;
    }

    .receipt-brand {
        display: flex !important;
    }

    .receipt-logo {
        max-height: 14mm !important;
        max-width: 34mm !important;
    }

    .receipt-info-grid,
    .receipt-balance-grid {
        gap: 2.5mm !important;
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        margin-bottom: 3mm !important;
    }

    .receipt-info-grid > div,
    .receipt-balance-grid > div,
    .receipt-note {
        background: #ffffff !important;
        border: 1px solid #d1d5db !important;
        border-radius: 0 !important;
        padding: 2mm 2.5mm !important;
    }

    .receipt-info-grid span,
    .receipt-balance-grid span {
        font-size: 6.5pt !important;
    }

    .receipt-info-grid strong,
    .receipt-balance-grid strong {
        font-size: 8pt !important;
    }

    .receipt-breakdown-table {
        margin: 2.5mm 0 3mm !important;
    }

    .receipt-breakdown-table th,
    .receipt-breakdown-table td {
        padding: 2mm 2.5mm !important;
    }

    .receipt-breakdown-table th {
        background: #111827 !important;
        color: #ffffff !important;
        font-size: 7pt !important;
    }

    .receipt-total-row td {
        background: #dcfce7 !important;
        color: #064e3b !important;
    }

    .receipt-applied-row td {
        background: #f8fafc !important;
    }
}

.auth-wrapper {
    min-height: 100vh;
}

.bi-search {
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M11.7 10.3a6 6 0 1 0-1.4 1.4l3.5 3.5 1.4-1.4-3.5-3.5ZM6.5 11a4.5 4.5 0 1 1 0-9 4.5 4.5 0 0 1 0 9Z'/%3E%3C/svg%3E");
}

@media (max-width: 768px) {
    .content > .d-flex.flex-wrap.justify-content-between.align-items-center.gap-3.mb-4 {
        align-items: flex-start !important;
        flex-direction: column;
    }

    .content > .d-flex.flex-wrap.justify-content-between.align-items-center.gap-3.mb-4 .btn {
        width: 100%;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: .001ms !important;
        animation-iteration-count: 1 !important;
        scroll-behavior: auto !important;
        transition-duration: .001ms !important;
    }
}

/* Botones sin desplazamiento: conserva hover/color/sombra, solo elimina movimiento. */
.btn:hover,
.btn:active,
.btn-action:hover,
.btn-action:active,
.btn-page:hover,
.btn-page:active,
.btn-search:hover,
.btn-search:active,
.module-tab:hover,
.module-tab:active,
button:hover,
button:active,
[role="button"]:hover,
[role="button"]:active {
    transform: none !important;
}

/* Capa final de unificacion: cualquier modulo debe heredar este contrato visual. */
.content :where(.surface, .card, .client-search-surface, .client-form-shell, .client-files-panel, .client-reference-panel, .client-documents-panel, .metric-card) {
    background: var(--ps-surface) !important;
    border: 1px solid var(--ps-border) !important;
    border-radius: var(--ps-radius-lg) !important;
    box-shadow: var(--ps-shadow-md) !important;
    color: var(--ps-text);
    overflow: hidden;
}

.content :where(.surface-header, .card-header, .client-search-header) {
    align-items: center;
    background: linear-gradient(135deg, #ffffff, var(--ps-surface-soft)) !important;
    border-bottom: 1px solid var(--ps-border) !important;
    color: var(--ps-text) !important;
    display: flex;
    gap: 1rem;
    justify-content: space-between;
    min-height: 3.25rem;
    padding: 1rem 1.15rem !important;
}

.content :where(.surface-body, .card-body, .client-search-body) {
    padding: 1.15rem !important;
}

.content :where(.surface-title, .card-header strong, .form-section-title, .client-section-title, .client-list-heading) {
    color: var(--ps-text) !important;
    font-size: .98rem;
    font-weight: var(--ps-weight-bold);
    letter-spacing: 0;
    margin: 0;
}

.content :where(.toolbar, .client-search-toolbar, .search-toolbar, .filter-toolbar) {
    align-items: end;
    background: var(--ps-surface-soft) !important;
    border: 1px solid var(--ps-border) !important;
    border-radius: var(--ps-radius-lg) !important;
    display: grid;
    gap: .9rem;
    grid-template-columns: minmax(0, 1fr) auto;
    margin-bottom: 1rem;
    padding: 1rem;
}

.content :where(.form-control, .form-select, .input-group-text, .client-input, .client-file-input) {
    background-color: #ffffff !important;
    border: 1px solid #dbe3ef !important;
    border-radius: var(--ps-radius-md) !important;
    color: var(--ps-text) !important;
    font-size: .92rem;
    min-height: 2.625rem;
}

.content :where(
    .form-control.invalid,
    .form-select.invalid,
    .client-input.invalid,
    .form-control.input-validation-error,
    .form-select.input-validation-error,
    .client-input.input-validation-error) {
    border-color: #f43f5e !important;
    box-shadow: 0 0 0 .2rem rgba(244, 63, 94, .12) !important;
    outline: 0 !important;
}

.content :where(textarea.form-control) {
    min-height: 6rem;
}

.content :where(.form-control-lg) {
    min-height: 3rem;
}

.content :where(.form-label) {
    color: #334155 !important;
    font-size: var(--ps-font-sm);
    font-weight: 700;
    margin-bottom: .42rem;
}

.content :where(.form-text, .text-muted, small) {
    color: var(--ps-muted) !important;
}

.content :where(.form-check.form-switch) {
    background: var(--ps-surface-soft);
    border: 1px solid var(--ps-border);
    border-radius: var(--ps-radius-md);
    min-height: 3rem;
    padding: .72rem .85rem .72rem 3rem;
}

.content :where(.form-check-label) {
    color: #334155;
    font-weight: 700;
}

.page-loading-surface {
    align-items: center;
    background: var(--ps-surface);
    border: 1px solid var(--ps-border);
    border-radius: var(--ps-radius-lg);
    box-shadow: var(--ps-shadow-sm);
    color: var(--ps-text);
    display: flex;
    gap: 14px;
    margin-top: 18px;
    min-height: 96px;
    padding: 22px 24px;
}

.page-loading-surface strong,
.page-loading-surface span {
    display: block;
}

.page-loading-surface strong {
    font-weight: 850;
}

.page-loading-surface span {
    color: var(--ps-muted);
    font-size: .9rem;
    margin-top: 3px;
}

.loading-spinner {
    animation: ps-spin .8s linear infinite;
    border: 3px solid #e2e8f0;
    border-top-color: var(--ps-primary);
    border-radius: 999px;
    height: 34px;
    width: 34px;
}

@keyframes ps-spin {
    to {
        transform: rotate(360deg);
    }
}

.content :where(.btn, .btn-action) {
    align-items: center;
    border-radius: var(--ps-radius-sm) !important;
    display: inline-flex;
    font-size: .88rem;
    font-weight: var(--ps-weight-bold);
    gap: .42rem;
    justify-content: center;
    min-height: 2.35rem;
    overflow: hidden;
    position: relative;
    text-decoration: none;
    transition: background-color .16s ease, border-color .16s ease, color .16s ease, box-shadow .16s ease;
    white-space: nowrap;
}

.content :where(.btn-sm) {
    font-size: .8rem;
    min-height: 2.1rem;
    padding: .34rem .72rem;
}

.content :where(.btn-lg) {
    font-size: .95rem;
    min-height: 2.75rem;
    padding: .56rem 1rem;
}

.content :where(.btn-dark, .btn-primary, .btn-search, .btn-action.primary) {
    background: var(--ps-primary) !important;
    border-color: rgba(15, 23, 42, .92) !important;
    color: #ffffff !important;
}

.content :where(.btn-dark, .btn-primary, .btn-search, .btn-action.primary):hover:not(:disabled),
.content :where(.btn-dark, .btn-primary, .btn-search, .btn-action.primary):focus-visible {
    background: var(--ps-accent-hover) !important;
    border-color: rgba(15, 118, 110, .42) !important;
    color: #ffffff !important;
}

.content :where(.btn-dark, .btn-primary, .btn-search, .btn-action.primary):active:not(:disabled) {
    background: var(--ps-accent) !important;
    border-color: rgba(15, 118, 110, .42) !important;
    color: #ffffff !important;
}

.content :where(.btn-success) {
    background: var(--ps-accent) !important;
    border-color: var(--ps-accent) !important;
    color: #ffffff !important;
}

.content :where(.btn-outline-dark, .btn-outline-secondary, .btn-outline-primary, .btn-outline-success, .btn-soft-primary, .btn-page, .btn-action.secondary) {
    background: #ffffff !important;
    border: 1px solid var(--ps-border-strong) !important;
    color: #334155 !important;
}

.content :where(.btn-outline-dark, .btn-outline-secondary, .btn-outline-primary, .btn-outline-success, .btn-soft-primary, .btn-page, .btn-action.secondary):hover {
    background: var(--ps-accent-soft) !important;
    border-color: #99f6e4 !important;
    color: var(--ps-accent-hover) !important;
}

.content :where(.btn-action.danger) {
    background: var(--ps-danger-bg) !important;
    border: 1px solid #fecdd3 !important;
    color: var(--ps-danger) !important;
}

.content :where(.btn-action.danger):hover {
    background: #ffe4e6 !important;
    border-color: #fda4af !important;
    color: #9f1239 !important;
}

.content :where(.btn-danger) {
    background: var(--ps-danger-bg) !important;
    border-color: #fecdd3 !important;
    color: var(--ps-danger) !important;
}

.content :where(.btn-warning) {
    background: var(--ps-warning-bg) !important;
    border-color: #fde68a !important;
    color: var(--ps-warning) !important;
}

.content :where(.app-table-shell, .table-responsive) {
    border-color: var(--ps-border);
}

.content :where(.card > .table-responsive, .surface > .table-responsive) {
    background: #ffffff;
    border-radius: 0 0 var(--ps-radius-lg) var(--ps-radius-lg);
}

.content :where(.app-table-shell) {
    background: #ffffff;
    border-radius: var(--ps-radius-lg);
    overflow: hidden;
}

.content :where(.table) {
    color: #334155;
    margin-bottom: 0;
}

.content :where(.table thead th, .client-table thead th) {
    background: var(--ps-surface-soft) !important;
    border-bottom: 1px solid var(--ps-border) !important;
    color: var(--ps-muted) !important;
    font-size: var(--ps-font-xs);
    font-weight: var(--ps-weight-heavy);
    letter-spacing: .06em;
    text-transform: uppercase;
}

.content :where(.table tbody td, .client-table tbody td) {
    border-color: var(--ps-border-soft) !important;
    color: #334155;
    vertical-align: middle;
}

.content :where(.badge, .status-badge) {
    align-items: center;
    border-radius: 999px;
    display: inline-flex;
    font-size: var(--ps-font-xs);
    font-weight: var(--ps-weight-bold);
    line-height: 1;
    min-height: 1.55rem;
    padding: .38rem .62rem;
}

.content :where(.alert) {
    border-radius: var(--ps-radius-md) !important;
    border-width: 1px !important;
    box-shadow: var(--ps-shadow-sm);
    font-size: .9rem;
}

.content :where(.detail-item, .loan-plan-summary, .quick-client-box, .balance-panel) {
    background: var(--ps-surface-soft) !important;
    border: 1px solid var(--ps-border) !important;
    border-radius: var(--ps-radius-lg) !important;
}

.content :where(.detail-label, .metric-label) {
    color: var(--ps-muted) !important;
    font-size: var(--ps-font-xs);
    font-weight: var(--ps-weight-heavy);
    letter-spacing: .05em;
    text-transform: uppercase;
}

.content :where(.detail-value, .metric-value, .balance-value) {
    color: var(--ps-text) !important;
    font-weight: var(--ps-weight-bold);
}

.content :where(.list-group-item.active) {
    background: var(--ps-accent-soft) !important;
    border-color: #99f6e4 !important;
    color: var(--ps-accent-hover) !important;
}

.wt-field {
    border-color: #dbe3ef;
    border-radius: var(--ps-radius-md);
}

.wt-btn:hover,
.wt-btn:active {
    transform: none !important;
}

/* Tarjetas de metricas limpias, alineadas al estilo general del sistema. */
.content :where(.dashboard-metrics, .client-kpi-grid) .metric-card {
    align-items: center;
    background: #ffffff !important;
    border: 1px solid var(--ps-border) !important;
    border-radius: var(--ps-radius-lg) !important;
    box-shadow: var(--ps-shadow-sm) !important;
    gap: .55rem;
    min-height: 8rem;
    padding: 1.05rem 1.15rem 1rem !important;
    text-align: center;
}

.content :where(.dashboard-metrics, .client-kpi-grid) .metric-card::before {
    display: none;
}

.content :where(.dashboard-metrics, .client-kpi-grid) .metric-card::after {
    display: none;
}

.content :where(.dashboard-metrics, .client-kpi-grid) .metric-card-strong {
    background: #ffffff !important;
    border-color: var(--ps-border) !important;
}

.content :where(.dashboard-metrics, .client-kpi-grid) .metric-label {
    color: var(--ps-muted) !important;
    font-size: var(--ps-font-xs);
    font-weight: var(--ps-weight-heavy);
    letter-spacing: .06em;
    text-transform: uppercase;
}

.content :where(.dashboard-metrics, .client-kpi-grid) .metric-value {
    color: var(--ps-text) !important;
    font-size: 1.72rem;
    font-weight: var(--ps-weight-heavy);
    line-height: 1;
}

.content :where(.dashboard-metrics, .client-kpi-grid) .metric-value.money {
    font-size: clamp(1.12rem, 1.8vw, 1.52rem);
    overflow-wrap: anywhere;
}

.content :where(.dashboard-metrics, .client-kpi-grid) .metric-note {
    border-top: 1px solid var(--ps-border-soft);
    color: var(--ps-muted);
    font-size: .84rem;
    line-height: 1.35;
    margin-top: auto;
    padding-top: .65rem;
    width: 100%;
}

/* Contrato visual de grids: tablas consistentes aunque el componente use card, surface o app-table-shell. */
.content :where(.table-responsive) {
    background: #ffffff;
    border: 1px solid var(--ps-border);
    border-radius: var(--ps-radius-lg);
    overflow-x: auto;
    overflow-y: hidden;
}

.content :where(.card > .table-responsive, .surface > .table-responsive) {
    border-left: 0 !important;
    border-right: 0 !important;
    border-bottom: 0 !important;
    border-radius: 0 0 var(--ps-radius-lg) var(--ps-radius-lg) !important;
}

.content :where(.app-table-shell > .table-responsive) {
    border: 0 !important;
    border-radius: inherit !important;
}

.content :where(.table, .client-table) {
    border-collapse: separate;
    border-spacing: 0;
    color: #334155;
    margin-bottom: 0 !important;
}

.content :where(.table, .client-table) > :not(caption) > * > * {
    padding: .82rem 1rem;
}

.content :where(.table.table-sm, .compact-table .table) > :not(caption) > * > * {
    padding: .62rem .82rem;
}

.content :where(.table thead th, .client-table thead th) {
    background: var(--ps-surface-soft) !important;
    border-bottom: 1px solid var(--ps-border) !important;
    color: var(--ps-muted) !important;
    font-size: var(--ps-font-xs);
    font-weight: var(--ps-weight-heavy);
    letter-spacing: .06em;
    text-transform: uppercase;
    white-space: nowrap;
}

.content :where(.table tbody td, .client-table tbody td) {
    border-bottom: 1px solid var(--ps-border-soft) !important;
    color: #334155;
    vertical-align: middle;
}

.content :where(.table tbody tr:last-child td, .client-table tbody tr:last-child td) {
    border-bottom: 0 !important;
}

.content :where(.table tbody tr, .client-table tbody tr) {
    transition: background-color .16s ease, box-shadow .16s ease;
}

.content :where(.table tbody tr:hover, .client-table tbody tr:hover) {
    background: #fbfdfc !important;
    box-shadow: inset 4px 0 0 rgba(15, 118, 110, .18);
}

/* Botones dentro de grids: evita bordes dobles o anillos heredados al hacer clic. */
.content :where(.app-table-shell, .table-responsive, .client-table, .client-mobile-list) :where(.btn, .btn-action) {
    border-style: solid !important;
    border-width: 1px !important;
    box-shadow: none !important;
    line-height: 1.15;
}

.content :where(.app-table-shell, .table-responsive, .client-table, .client-mobile-list) :where(.btn-dark, .btn-primary, .btn-action.primary) {
    background: var(--ps-primary) !important;
    border-color: rgba(15, 23, 42, .92) !important;
    color: #ffffff !important;
}

.content :where(.app-table-shell, .table-responsive, .client-table, .client-mobile-list) :where(.btn-dark, .btn-primary, .btn-action.primary):hover:not(:disabled),
.content :where(.app-table-shell, .table-responsive, .client-table, .client-mobile-list) :where(.btn-dark, .btn-primary, .btn-action.primary):focus-visible {
    background: var(--ps-accent-hover) !important;
    border-color: rgba(15, 118, 110, .42) !important;
    color: #ffffff !important;
}

.content :where(.app-table-shell, .table-responsive, .client-table, .client-mobile-list) :where(.btn-dark, .btn-primary, .btn-action.primary):active:not(:disabled) {
    background: var(--ps-accent) !important;
    border-color: rgba(15, 118, 110, .42) !important;
    color: #ffffff !important;
}

.content :where(.app-table-shell, .table-responsive, .client-table, .client-mobile-list) :where(.btn:focus:not(:focus-visible), .btn-action:focus:not(:focus-visible)) {
    box-shadow: none !important;
    outline: 0 !important;
}

.content :where(.app-table-shell, .table-responsive, .client-table, .client-mobile-list) :where(.btn:focus-visible, .btn-action:focus-visible) {
    box-shadow: none !important;
    outline: 0 !important;
}

.dashboard-overview {
    align-items: center;
    background:
        linear-gradient(135deg, #ffffff, #f8fafc) !important;
    border: 1px solid var(--ps-border);
    border-radius: var(--ps-radius-lg);
    box-shadow: var(--ps-shadow-sm);
    display: flex;
    gap: 1.25rem;
    justify-content: space-between;
    padding: 1.1rem 1.2rem;
}

.dashboard-overview h2 {
    color: var(--ps-text);
    font-size: 1.08rem;
    font-weight: var(--ps-weight-heavy);
    letter-spacing: 0;
    line-height: 1.2;
    margin: .15rem 0 .25rem;
}

.dashboard-overview p {
    color: var(--ps-muted);
    font-size: .9rem;
    margin: 0;
}

.dashboard-overview-total {
    align-items: flex-end;
    background: #ffffff;
    border: 1px solid var(--ps-border);
    border-radius: var(--ps-radius-md);
    display: flex;
    flex-direction: column;
    min-width: min(20rem, 100%);
    padding: .85rem 1rem;
}

.dashboard-overview-total span {
    color: var(--ps-muted);
    font-size: var(--ps-font-xs);
    font-weight: var(--ps-weight-heavy);
    letter-spacing: .05em;
    text-transform: uppercase;
}

.dashboard-overview-total strong {
    color: var(--ps-text);
    font-size: clamp(1.18rem, 2vw, 1.55rem);
    font-weight: var(--ps-weight-heavy);
    line-height: 1.1;
    margin-top: .2rem;
    overflow-wrap: anywhere;
}

.quick-access-grid {
    display: grid;
    gap: .85rem;
    grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
    padding-top: 1rem;
}

.quick-access-item {
    background: #ffffff;
    border: 1px solid var(--ps-border);
    border-radius: var(--ps-radius-md);
    color: var(--ps-text);
    display: grid;
    gap: .25rem;
    padding: .95rem 1rem;
    text-decoration: none;
    transition: background .15s ease, border-color .15s ease, color .15s ease, box-shadow .15s ease;
}

.quick-access-item:hover {
    background: var(--ps-accent-soft);
    border-color: #d9eeeb;
    color: var(--ps-text);
    box-shadow: var(--ps-shadow-sm);
}

.quick-access-item strong {
    font-size: .95rem;
    font-weight: var(--ps-weight-heavy);
}

.quick-access-item span {
    color: var(--ps-muted);
    font-size: var(--ps-font-sm);
}

.content .dashboard-metrics .metric-card {
    justify-content: center;
    min-height: 9rem;
    padding-top: 1.15rem !important;
}

.dashboard-metrics .metric-icon {
    align-items: center;
    background: var(--ps-accent-soft);
    border: 1px solid #d9eeeb;
    border-radius: 999px;
    display: inline-flex;
    height: 2.15rem;
    justify-content: center;
    margin-bottom: .1rem;
    width: 2.15rem;
}

.dashboard-metrics .metric-icon::before {
    background: var(--ps-accent);
    content: "";
    display: block;
    height: 1.05rem;
    -webkit-mask-image: var(--metric-icon-mask);
    -webkit-mask-position: center;
    -webkit-mask-repeat: no-repeat;
    -webkit-mask-size: contain;
    mask-image: var(--metric-icon-mask);
    mask-position: center;
    mask-repeat: no-repeat;
    mask-size: contain;
    width: 1.05rem;
}

.dashboard-metrics .metric-icon.people {
    --metric-icon-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M6.5 7.5a3 3 0 1 0 0-6 3 3 0 0 0 0 6M1 14s.5-4 5.5-4 5.5 4 5.5 4zm11.5-6.5a2.25 2.25 0 1 0 0-4.5 2.25 2.25 0 0 0 0 4.5M11 9.5c2.55.38 3 3.5 3 3.5h-1.2A6.2 6.2 0 0 0 11 9.5'/%3E%3C/svg%3E");
}

.dashboard-metrics .metric-icon.loan {
    --metric-icon-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3 1.5A1.5 1.5 0 0 1 4.5 0h5L13 3.5v11A1.5 1.5 0 0 1 11.5 16h-7A1.5 1.5 0 0 1 3 14.5zM9 1.2V4h2.8zM5 7h6V6H5zm0 2.5h6v-1H5zm0 2.5h4v-1H5z'/%3E%3C/svg%3E");
}

.dashboard-metrics .metric-icon.balance {
    --metric-icon-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M1 3h14v9H1V3Zm1.5 1.5v6h11v-6h-11ZM8 10a2 2 0 1 0 0-4 2 2 0 0 0 0 4Zm-7.5 3h15v1.5H.5V13Z'/%3E%3C/svg%3E");
}

.dashboard-metrics .metric-icon.capital {
    --metric-icon-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M8 1 14.5 4.5V6H1.5V4.5L8 1Zm-4.5 6h2v5h-2V7Zm3.5 0h2v5H7V7Zm3.5 0h2v5h-2V7ZM1 13h14v2H1v-2Z'/%3E%3C/svg%3E");
}

.dashboard-metrics .metric-icon.company {
    --metric-icon-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M2 15V2.5A1.5 1.5 0 0 1 3.5 1h6A1.5 1.5 0 0 1 11 2.5V5h1.5A1.5 1.5 0 0 1 14 6.5V15h-4v-3H6v3H2Zm3-11h2V2.8H5V4Zm0 2.8h2V5.6H5v1.2Zm0 2.8h2V8.4H5v1.2Zm4-5.6h1V2.8H9V4Zm0 2.8h1V5.6H9v1.2Zm3 2.8h1V8.4h-1v1.2Zm0 2.4h1v-1.2h-1V12Z'/%3E%3C/svg%3E");
}

.dashboard-metrics .metric-icon.group {
    --metric-icon-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M8 7.5a2.75 2.75 0 1 0 0-5.5 2.75 2.75 0 0 0 0 5.5ZM3.5 7a2.15 2.15 0 1 0 0-4.3A2.15 2.15 0 0 0 3.5 7Zm9 0a2.15 2.15 0 1 0 0-4.3 2.15 2.15 0 0 0 0 4.3ZM1 13.75s.35-3.9 4.15-4.2A5.3 5.3 0 0 0 4 13.75h-3Zm4.15.25s.45-5 2.85-5 2.85 5 2.85 5h-5.7Zm6.85-.25a5.3 5.3 0 0 0-1.15-4.2c3.8.3 4.15 4.2 4.15 4.2h-3Z'/%3E%3C/svg%3E");
}

.dashboard-metrics .metric-icon.payment {
    --metric-icon-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M1 3h14v10H1V3Zm2 2v2h10V5H3Zm3.1 6.4 5.5-5.5 1.05 1.05-6.55 6.55L3.35 10.75 4.4 9.7l1.7 1.7Z'/%3E%3C/svg%3E");
}

.dashboard-metrics .metric-icon.overdue {
    --metric-icon-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4 0h1v2h6V0h1v2h1.5A1.5 1.5 0 0 1 15 3.5V5H1V3.5A1.5 1.5 0 0 1 2.5 2H4V0ZM1 6h14v7.5A1.5 1.5 0 0 1 13.5 15h-11A1.5 1.5 0 0 1 1 13.5V6Zm7 1.5a.8.8 0 0 0-.8.8v3.1l2.55 1.5.8-1.25-1.75-1.05V8.3A.8.8 0 0 0 8 7.5Z'/%3E%3C/svg%3E");
}

.dashboard-metrics .metric-icon.promise {
    --metric-icon-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M2 2h12v12H2V2Zm2 2v1.5h8V4H4Zm0 3v1.5h8V7H4Zm0 3v1.5h5V10H4Zm7.2.15 1.05 1.05 2.4-2.4 1.05 1.05-3.45 3.45-2.1-2.1 1.05-1.05Z'/%3E%3C/svg%3E");
}

.dashboard-metrics .metric-icon.documents {
    --metric-icon-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4 1h6l3 3v10.5A1.5 1.5 0 0 1 11.5 16h-7A1.5 1.5 0 0 1 3 14.5v-12A1.5 1.5 0 0 1 4.5 1H4Zm6 1.2V5h2.8L10 2.2ZM5 7h6V6H5v1Zm0 2.5h6v-1H5v1Zm0 2.5h4v-1H5v1Z'/%3E%3C/svg%3E");
}

.dashboard-metrics .metric-icon.activity {
    --metric-icon-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M8 1a7 7 0 1 0 0 14A7 7 0 0 0 8 1Zm.75 3v3.55l2.65 1.6-.8 1.25-3.35-2V4h1.5Z'/%3E%3C/svg%3E");
}

.monitoring-note-list,
.monitoring-path-list {
    display: grid;
    gap: 10px;
}

.monitoring-note-list > div,
.monitoring-path-list > div {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    min-width: 0;
    padding: 10px 12px;
    border: 1px solid var(--ps-border);
    border-radius: 8px;
    background: var(--ps-surface-soft);
}

.monitoring-note-list span:last-child,
.monitoring-path-list span {
    min-width: 0;
    overflow-wrap: anywhere;
}

.monitoring-path-list small {
    flex: 0 0 132px;
    color: var(--ps-muted);
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .04em;
}

@media (max-width: 640px) {
    .monitoring-note-list > div,
    .monitoring-path-list > div {
        display: grid;
    }

    .monitoring-path-list small {
        flex-basis: auto;
    }
}

.attention-list {
    display: grid;
    gap: .75rem;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding: 1rem;
}

.attention-item {
    align-items: center;
    background: #ffffff;
    border: 1px solid var(--ps-border);
    border-radius: var(--ps-radius-md);
    color: inherit;
    display: flex;
    gap: 1rem;
    justify-content: space-between;
    padding: .9rem .95rem;
    text-decoration: none;
    transition: background-color .16s ease, border-color .16s ease, box-shadow .16s ease;
}

.attention-item:hover {
    background: #fbfdfc;
    border-color: #cde8e4;
    box-shadow: var(--ps-shadow-sm);
    color: inherit;
}

.attention-item strong {
    color: var(--ps-text);
    display: block;
    font-size: .92rem;
    font-weight: var(--ps-weight-bold);
    line-height: 1.2;
}

.attention-item small {
    color: var(--ps-muted) !important;
    display: block;
    font-size: .8rem;
    line-height: 1.35;
    margin-top: .2rem;
}

.attention-value {
    align-items: center;
    border-radius: 999px;
    display: inline-flex;
    flex: 0 0 auto;
    font-size: .86rem;
    font-weight: var(--ps-weight-heavy);
    justify-content: center;
    min-height: 2rem;
    min-width: 2.6rem;
    padding: .35rem .65rem;
}

.attention-value.risk {
    background: var(--ps-danger-bg);
    border: 1px solid #fecdd3;
    color: var(--ps-danger);
}

.attention-value.info {
    background: var(--ps-accent-soft);
    border: 1px solid #d9eeeb;
    color: var(--ps-accent-hover);
}

.attention-value.warning {
    background: var(--ps-warning-bg);
    border: 1px solid #fde68a;
    color: var(--ps-warning);
}

@media (max-width: 768px) {
    .dashboard-overview {
        align-items: stretch;
        flex-direction: column;
    }

    .dashboard-overview-total {
        align-items: flex-start;
    }

    .attention-list {
        grid-template-columns: 1fr;
    }

    .content :where(.toolbar, .client-search-toolbar, .search-toolbar, .filter-toolbar) {
        grid-template-columns: 1fr;
    }

    .content :where(.toolbar .btn, .client-search-toolbar .btn, .search-toolbar .btn, .filter-toolbar .btn) {
        width: 100%;
    }
}

/* Responsive final: mantener la app usable desde movil hasta escritorio amplio. */
@media (max-width: 992px) {
    .content {
        max-width: 100%;
    }

    .content :where(.client-create-layout, .client-expediente-layout, .plan-form-layout, .payment-layout, .acreditado-edit-layout) {
        grid-template-columns: 1fr !important;
    }

    .content :where(.row.g-4, .row.g-3) > [class*="col-xl-"],
    .content :where(.row.g-4, .row.g-3) > [class*="col-lg-"] {
        min-width: 0;
    }
}

@media (max-width: 768px) {
    .content {
        padding-left: .85rem !important;
        padding-right: .85rem !important;
        padding-top: 1rem;
    }

    .content :where(.page-header, .surface-header, .card-header, .client-search-header, .client-address-card-header, .client-form-actions) {
        align-items: stretch !important;
        flex-direction: column !important;
        gap: .85rem !important;
    }

    .content :where(.page-actions, .surface-header .d-flex, .card-header .d-flex, .client-form-actions > .d-flex, .client-address-actions) {
        align-items: stretch !important;
        display: grid !important;
        grid-template-columns: 1fr !important;
        width: 100%;
    }

    .content :where(.page-actions .btn, .page-actions a, .surface-header .btn, .client-form-actions .btn, .client-form-actions a, .client-address-actions .btn, .btn-search) {
        justify-content: center;
        width: 100%;
    }

    .content :where(.surface-body, .card-body, .client-search-body) {
        padding: .95rem !important;
    }

    .content :where(.client-form-section, .form-section) {
        padding: .95rem !important;
    }

    .content :where(.client-section-heading) {
        align-items: stretch !important;
        flex-direction: column !important;
        gap: .7rem !important;
    }

    .content :where(.client-section-heading .btn, .client-section-heading button, .client-section-heading a) {
        margin-left: 0 !important;
        width: 100%;
    }

    .content :where(.client-switch-grid, .detail-grid, .person-detail-grid, .info-detail-grid, .dashboard-metrics, .client-kpi-grid, .loan-plan-summary) {
        grid-template-columns: 1fr !important;
    }

    .content :where(.client-form-actions) {
        bottom: 0;
        position: sticky;
    }

    .content :where(.app-table-shell) {
        display: block;
        max-width: 100%;
        overflow: hidden;
    }

    .content :where(.app-table-shell > .table-responsive, .table-responsive) {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
    }

    .content :where(.app-table-shell .table, .app-table-shell .client-table) {
        min-width: 42rem;
    }

    .content :where(.surface-body, .card-body, .client-search-body):has(> .client-mobile-list) > .app-table-shell {
        display: none;
    }

    .content :where(.client-mobile-list) {
        display: grid;
        gap: .9rem;
    }

    .content :where(.action-buttons) {
        justify-content: flex-end;
        width: auto;
    }

    .content :where(.action-buttons.mobile) {
        display: grid;
        grid-template-columns: 1fr 1fr;
        width: 100%;
    }

    .content :where(.licensing-payment-card-header) {
        align-items: stretch;
        flex-direction: column;
    }

    .content :where(.licensing-payment-total) {
        align-items: flex-start;
        background: var(--ps-surface-soft);
        border: 1px solid var(--ps-border-soft);
        border-radius: var(--ps-radius-md);
        padding: .65rem .75rem;
        text-align: left;
        width: 100%;
    }

    .content :where(.modal-document-viewer) {
        width: min(100%, calc(100vw - 1.25rem));
    }
}

@media (max-width: 520px) {
    .content {
        padding-left: .65rem !important;
        padding-right: .65rem !important;
    }

    .content :where(.page-title, .page-header h1) {
        font-size: 1.28rem !important;
        line-height: 1.18;
    }

    .content :where(.surface-title, .client-section-title, .client-name, .person-summary-name) {
        overflow-wrap: anywhere;
    }

    .content :where(.client-search-toolbar, .toolbar, .search-toolbar, .filter-toolbar) {
        padding: .8rem !important;
    }

    .content :where(.client-table-footer, .pagination-actions, .confirm-dialog-actions) {
        align-items: stretch !important;
        flex-direction: column !important;
        width: 100%;
    }

    .content :where(.pagination-actions .btn-page, .confirm-dialog-actions .btn) {
        width: 100%;
    }

    .content :where(.app-table-shell .table, .app-table-shell .client-table) {
        min-width: 36rem;
    }

    .content :where(.action-buttons.mobile) {
        grid-template-columns: 1fr;
    }
}

.phone-input {
    display: grid;
    grid-template-columns: 86px minmax(0, 1fr);
    gap: 8px;
    max-width: 100%;
    position: relative;
    width: 100%;
}

.client-form-shell,
.client-form-shell .surface-body,
.client-form-section,
.form-section {
    overflow: visible !important;
}

.phone-number {
    min-height: 42px;
    min-width: 0;
    width: 100%;
}

.phone-input-lada-only {
    grid-template-columns: 86px;
    width: max-content;
}

.phone-input-lada-only .phone-number {
    display: none;
}

.phone-country-picker {
    min-height: 42px;
    position: relative;
    z-index: 5;
}

.phone-country-button {
    align-items: center;
    background: #ffffff;
    border: 1px solid var(--ps-border);
    border-radius: var(--ps-radius-md);
    color: var(--ps-text);
    display: flex;
    gap: .25rem;
    height: 42px;
    justify-content: center;
    min-width: 0;
    overflow: hidden;
    padding: 0 .22rem;
    width: 100%;
}

.phone-country-button img,
.phone-country-option img {
    border-radius: 4px;
    box-shadow: 0 0 0 1px rgba(15, 23, 42, .08);
    display: block;
    height: 18px;
    object-fit: cover;
    width: 26px;
}

.phone-country-button span,
.phone-country-option span {
    font-weight: 700;
}

.phone-country-menu {
    background: #ffffff;
    border: 1px solid var(--ps-border);
    border-radius: var(--ps-radius-md);
    box-shadow: var(--ps-shadow-md);
    display: grid;
    gap: 3px;
    left: 0;
    max-height: 260px;
    min-width: 128px;
    overflow-y: auto;
    padding: 6px;
    position: absolute;
    top: calc(100% + 6px);
    z-index: 50;
}

.phone-country-option {
    align-items: center;
    background: transparent;
    border: 0;
    border-radius: var(--ps-radius-sm);
    color: var(--ps-text);
    display: flex;
    gap: .5rem;
    justify-content: flex-start;
    min-height: 34px;
    padding: 6px 8px;
    text-align: left;
}

.phone-country-option:hover,
.phone-country-option.selected {
    background: var(--ps-accent-soft);
}

@media (max-width: 576px) {
    .phone-input {
        grid-template-columns: 86px minmax(0, 1fr);
    }

    .phone-input-lada-only {
        grid-template-columns: 86px;
    }
}

@media (max-width: 420px) {
    .phone-input {
        grid-template-columns: 78px minmax(0, 1fr);
        gap: 6px;
    }

    .phone-input-lada-only {
        grid-template-columns: 78px;
    }

    .phone-country-button img,
    .phone-country-option img {
        height: 16px;
        width: 23px;
    }

    .phone-country-button {
        font-size: .82rem;
    }
}

.content :where(.surface:has(.phone-input), .card:has(.phone-input), .client-form-shell:has(.phone-input)) {
    overflow: visible !important;
}

.content :where(.surface:has(.phone-input), .card:has(.phone-input), .client-form-shell:has(.phone-input)) :where(.surface-body, .card-body, .client-form-section, .form-section) {
    overflow: visible !important;
}

/* Caja: vista compacta para cortes diarios. */
.cash-control-panel .surface-body {
    padding: .95rem 1.15rem !important;
}

.cash-filter-grid {
    align-items: end;
    display: grid;
    gap: .85rem;
    grid-template-columns: minmax(12rem, 16rem) minmax(18rem, 1fr) auto;
}

.cash-filter-actions {
    display: flex;
    justify-content: flex-end;
}

.cash-filter-actions .btn {
    min-height: 2.85rem;
    padding-inline: 1.4rem;
}

.cash-summary-grid {
    display: grid;
    gap: .8rem;
    grid-template-columns: repeat(6, minmax(0, 1fr));
}

.cash-summary-card {
    background: #ffffff;
    border: 1px solid var(--ps-border);
    border-radius: var(--ps-radius-lg);
    box-shadow: var(--ps-shadow-sm);
    display: grid;
    gap: .28rem;
    min-width: 0;
    padding: .95rem 1rem;
}

.cash-summary-card.primary {
    background: linear-gradient(135deg, #ffffff, var(--ps-surface-soft));
    border-color: #99f6e4;
}

.cash-summary-card span {
    color: var(--ps-muted);
    font-size: var(--ps-font-xs);
    font-weight: var(--ps-weight-bold);
    letter-spacing: .07em;
    text-transform: uppercase;
}

.cash-summary-card strong {
    color: var(--ps-text);
    font-size: clamp(1rem, 1.25vw, 1.28rem);
    font-weight: 850;
    line-height: 1.15;
    overflow-wrap: anywhere;
}

.cash-summary-card small {
    border-top: 1px solid var(--ps-border-soft);
    color: var(--ps-muted);
    font-size: .78rem;
    font-weight: 650;
    margin-top: .15rem;
    padding-top: .38rem;
}

.cash-content-grid {
    align-items: start;
    display: grid;
    gap: 1rem;
    grid-template-columns: minmax(22rem, .9fr) minmax(26rem, 1.1fr);
}

.cash-content-grid .surface-body {
    padding: .85rem !important;
}

.cash-content-grid .client-table thead th,
.cash-content-grid .client-table tbody td {
    padding: .72rem .85rem;
}

@media (max-width: 1400px) {
    .cash-summary-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 1100px) {
    .cash-content-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .cash-filter-grid,
    .cash-summary-grid {
        grid-template-columns: 1fr;
    }

    .cash-filter-actions,
    .cash-filter-actions .btn {
        width: 100%;
    }
}
/* Controles numericos con formato */
.numeric-input-wrapper {
    display: block;
    position: relative;
    width: 100%;
}

.numeric-input-wrapper .numeric-input.form-control {
    font-weight: var(--ps-weight-normal);
    padding-left: 2.45rem;
    width: 100%;
}

.numeric-input-wrapper .percent-input.form-control {
    padding-left: .9rem;
    padding-right: 2.15rem;
}

.numeric-input-wrapper.plain .numeric-input.form-control,
.numeric-input-wrapper.compact.plain .numeric-input.form-control {
    padding-left: .75rem;
}

.numeric-input-wrapper.compact .numeric-input.form-control {
    min-height: 34px;
    padding-bottom: .28rem;
    padding-top: .28rem;
}

.numeric-input-prefix,
.numeric-input-suffix {
    align-items: center;
    color: var(--ps-muted, #64748b);
    display: inline-flex;
    font-size: .84rem;
    font-weight: 800;
    height: 100%;
    justify-content: center;
    min-width: 2rem;
    pointer-events: none;
    position: absolute;
    top: 0;
    z-index: 2;
}

.numeric-input-prefix {
    left: .2rem;
}

.numeric-input-suffix {
    right: .2rem;
}

.numeric-input-wrapper:focus-within .numeric-input-prefix,
.numeric-input-wrapper:focus-within .numeric-input-suffix {
    color: var(--ps-accent, #0f766e);
}

.numeric-input-wrapper .numeric-input.form-control:disabled ~ .numeric-input-suffix,
.numeric-input-wrapper:has(.numeric-input:disabled) .numeric-input-prefix,
.numeric-input-wrapper:has(.numeric-input:disabled) .numeric-input-suffix {
    color: #94a3b8;
}
/* Refinamientos responsive generales */
@media (max-width: 1200px) {
    .content :where(.dashboard-metrics, .client-kpi-grid) {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    }
}

@media (max-width: 768px) {
    html,
    body {
        overflow-x: hidden;
    }

    .content :where(.surface, .client-search-surface, .card, .client-form-shell) {
        border-radius: 16px !important;
    }

    .content :where(.page-description, .client-form-subtitle, .client-section-text) {
        max-width: 100%;
    }

    .content :where(.row) {
        --bs-gutter-x: 0.85rem;
    }

    .content :where(.btn, .btn-action, .btn-page, .form-control, .form-select) {
        min-height: 42px;
    }

    .content :where(.client-table-footer) {
        gap: 0.7rem;
    }

    .content :where(.client-table-footer small) {
        text-align: center;
        width: 100%;
    }

    .content :where(.app-table-shell .table, .app-table-shell .client-table) {
        min-width: 44rem;
    }
}

@media (max-width: 480px) {
    .content :where(.surface-body, .card-body, .client-search-body) {
        padding: 0.8rem !important;
    }

    .content :where(.client-form-section, .form-section) {
        padding: 0.8rem !important;
    }

    .content :where(.app-table-shell .table, .app-table-shell .client-table) {
        min-width: 38rem;
    }

    .phone-input {
        gap: 5px;
        grid-template-columns: 74px minmax(0, 1fr);
    }

    .phone-country-button {
        font-size: 0.78rem;
    }

    .phone-country-button img {
        height: 15px;
        width: 22px;
    }
}

@media (max-width: 360px) {
    .phone-input {
        grid-template-columns: 1fr;
    }

    .phone-input-lada-only {
        grid-template-columns: 74px;
    }

    .phone-country-menu {
        min-width: 100%;
    }
}
/* Responsive especifico para grupos/acreditados */
.grupo-integrantes-mobile-list,
.acreditados-mobile-list {
    display: none;
}

@media (max-width: 768px) {
    .acreditados-directory .client-search-body {
        padding: 0.95rem !important;
    }

    .acreditados-tabs.module-tabs {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.55rem;
    }

    .acreditados-tabs .module-tab {
        justify-content: center;
        min-height: 2.45rem;
        width: 100%;
    }

    .acreditados-directory .client-search-toolbar {
        grid-template-columns: 1fr;
    }

    .acreditados-directory .btn-search {
        width: 100%;
    }

    .acreditados-directory:has(.acreditados-mobile-list) .app-table-shell,
    .acreditados-members:has(.grupo-integrantes-mobile-list) .app-table-shell {
        display: none !important;
    }

    .acreditados-mobile-list,
    .grupo-integrantes-mobile-list {
        display: grid;
        gap: 0.9rem;
    }

    .acreditados-members .row.g-2 {
        --bs-gutter-x: 0.7rem;
        --bs-gutter-y: 0.7rem;
    }

    .acreditados-members .col-12.d-flex {
        display: grid !important;
        grid-template-columns: 1fr;
    }

    .acreditados-members .col-12.d-flex :where(.btn, a) {
        justify-content: center;
        width: 100%;
    }
}

@media (max-width: 420px) {
    .acreditados-tabs.module-tabs {
        grid-template-columns: 1fr;
    }

    .acreditado-edit-layout .client-form-status {
        align-items: flex-start;
        display: flex;
        flex-wrap: wrap;
        gap: 0.45rem;
        width: 100%;
    }
}
/* Responsive especifico para planes de pago */
.planes-pago-mobile-list {
    display: none;
}

@media (max-width: 768px) {
    .client-search-surface:has(.planes-pago-mobile-list) .client-search-toolbar {
        grid-template-columns: 1fr;
    }

    .client-search-surface:has(.planes-pago-mobile-list) .btn-search {
        width: 100%;
    }

    .client-search-surface:has(.planes-pago-mobile-list) .app-table-shell {
        display: none !important;
    }

    .planes-pago-mobile-list {
        display: grid;
        gap: 0.9rem;
    }

    .planes-pago-mobile-list .status-group {
        margin-top: 0.85rem;
    }
}

/* Legal y operacion comercial */
.legal-consent-card {
    align-items: flex-start;
    background: var(--ps-surface-soft);
    border: 1px solid var(--ps-border);
    border-radius: var(--ps-radius-md);
    color: var(--ps-muted);
    display: flex;
    gap: .7rem;
    line-height: 1.55;
    margin: 1rem 0 0;
    padding: .85rem .95rem;
}

.legal-consent-card.app {
    margin-top: 1.2rem;
}

.legal-consent-card input {
    flex: 0 0 auto;
    margin-top: .25rem;
}

.legal-consent-card a {
    font-weight: var(--ps-weight-bold);
    text-decoration: none;
}

.legal-consent-card a:hover {
    text-decoration: underline;
}

.legal-public-page {
    background: var(--ps-bg);
    color: var(--ps-text);
    min-height: 100vh;
    padding: clamp(1.2rem, 3vw, 3rem);
}

.legal-document {
    background: var(--ps-surface);
    border: 1px solid var(--ps-border);
    border-radius: var(--ps-radius-lg);
    box-shadow: var(--ps-shadow-md);
    margin: 0 auto;
    max-width: 980px;
    overflow: hidden;
}

.surface:has(.client-form-actions),
.card:has(.client-form-actions),
.client-search-surface:has(.client-form-actions) {
    overflow: visible;
}

.legal-document-header {
    background: linear-gradient(135deg, #ffffff, var(--ps-surface-soft));
    border-bottom: 1px solid var(--ps-border);
    padding: clamp(1.35rem, 3vw, 2.3rem);
}

.legal-brand {
    align-items: center;
    color: var(--ps-text);
    display: inline-flex;
    font-weight: var(--ps-weight-heavy);
    gap: .65rem;
    margin-bottom: 1.3rem;
    text-decoration: none;
}

.legal-brand img {
    height: 38px;
    width: auto;
}

.legal-eyebrow {
    color: var(--ps-accent);
    font-size: .76rem;
    font-weight: var(--ps-weight-heavy);
    letter-spacing: .08em;
    margin: 0 0 .4rem;
    text-transform: uppercase;
}

.legal-document h1 {
    font-size: clamp(1.65rem, 4vw, 2.4rem);
    font-weight: var(--ps-weight-heavy);
    letter-spacing: 0;
    margin: 0;
}

.legal-document-header p:last-child {
    color: var(--ps-muted);
    line-height: 1.7;
    margin: 1rem 0 0;
    max-width: 760px;
}

.legal-alert {
    background: var(--ps-warning-bg);
    border-bottom: 1px solid #fde68a;
    color: var(--ps-warning);
    font-weight: var(--ps-weight-bold);
    padding: 1rem clamp(1.35rem, 3vw, 2.3rem);
}

.legal-content {
    padding: clamp(1.35rem, 3vw, 2.3rem);
}

.legal-content h2 {
    color: var(--ps-text);
    font-size: 1.04rem;
    font-weight: var(--ps-weight-heavy);
    letter-spacing: 0;
    margin: 1.5rem 0 .55rem;
}

.legal-content h2:first-child {
    margin-top: 0;
}

.legal-content p,
.legal-content li {
    color: #475569;
    line-height: 1.75;
}

.legal-content ul {
    margin-bottom: 0;
    padding-left: 1.2rem;
}

.legal-footer {
    align-items: center;
    background: var(--ps-surface-soft);
    border-top: 1px solid var(--ps-border);
    display: flex;
    flex-wrap: wrap;
    gap: .9rem;
    padding: 1rem clamp(1.35rem, 3vw, 2.3rem);
}

.legal-footer a {
    font-weight: var(--ps-weight-bold);
    text-decoration: none;
}

@media (max-width: 560px) {
    .legal-consent-card {
        font-size: .86rem;
    }

    .legal-footer {
        align-items: flex-start;
        flex-direction: column;
    }
}

/* Presentacion refinada para paginas legales publicas */
.legal-public-page {
    background:
        linear-gradient(180deg, #f8fafc 0%, #eef6f5 100%);
    padding: clamp(1rem, 2vw, 2rem);
}

.legal-public-shell {
    display: grid;
    gap: 1rem;
    grid-template-columns: minmax(270px, 330px) minmax(0, 1fr);
    margin: 0 auto;
    max-width: 1220px;
}

.legal-side-panel {
    align-self: start;
    background: #111827;
    border: 1px solid rgba(255, 255, 255, .08);
    border-radius: var(--ps-radius-lg);
    box-shadow: var(--ps-shadow-lg);
    color: #ffffff;
    min-height: calc(100vh - clamp(2rem, 4vw, 4rem));
    overflow: hidden;
    padding: clamp(1.15rem, 2vw, 1.5rem);
    position: sticky;
    top: 1rem;
}

.legal-side-panel .legal-brand {
    color: #ffffff;
    margin-bottom: 2rem;
}

.legal-side-panel .legal-brand img {
    background: rgba(255, 255, 255, .96);
    border-radius: 12px;
    height: 42px;
    padding: .35rem;
}

.legal-side-kicker {
    color: #99f6e4;
    font-size: .74rem;
    font-weight: var(--ps-weight-heavy);
    letter-spacing: .08em;
    margin: 0 0 .55rem;
    text-transform: uppercase;
}

.legal-side-panel h2 {
    color: #ffffff;
    font-size: clamp(1.35rem, 2.7vw, 1.75rem);
    font-weight: var(--ps-weight-heavy);
    letter-spacing: 0;
    line-height: 1.15;
    margin: 0;
}

.legal-side-copy {
    color: #cbd5e1;
    font-size: .92rem;
    line-height: 1.7;
    margin: 1rem 0 1.4rem;
}

.legal-doc-nav {
    display: grid;
    gap: .55rem;
    margin-top: 1.2rem;
}

.legal-doc-nav a {
    align-items: center;
    background: rgba(255, 255, 255, .07);
    border: 1px solid rgba(255, 255, 255, .09);
    border-radius: 12px;
    color: #e2e8f0;
    display: flex;
    font-size: .9rem;
    font-weight: var(--ps-weight-bold);
    justify-content: space-between;
    min-height: 44px;
    padding: .75rem .85rem;
    text-decoration: none;
}

.legal-doc-nav a::after {
    color: #99f6e4;
    content: ">";
    font-weight: var(--ps-weight-heavy);
}

.legal-doc-nav a.active,
.legal-doc-nav a:hover {
    background: #ffffff;
    color: #111827;
}

.legal-side-note {
    background: rgba(15, 118, 110, .22);
    border: 1px solid rgba(153, 246, 228, .22);
    border-radius: 14px;
    display: grid;
    gap: .35rem;
    margin-top: 1.4rem;
    padding: 1rem;
}

.legal-side-note strong {
    color: #ffffff;
    font-size: .88rem;
}

.legal-side-note span {
    color: #cbd5e1;
    font-size: .82rem;
    line-height: 1.55;
}

.legal-public-shell .legal-document {
    border-radius: var(--ps-radius-lg);
    margin: 0;
    max-width: none;
}

.legal-public-shell .legal-document-header {
    background: #ffffff;
    padding: clamp(1.25rem, 3vw, 2.2rem);
}

.legal-title-row {
    align-items: flex-start;
    display: flex;
    gap: 1.25rem;
    justify-content: space-between;
}

.legal-title-row h1 {
    color: var(--ps-text);
    font-size: clamp(1.7rem, 3vw, 2.55rem);
    font-weight: var(--ps-weight-heavy);
    letter-spacing: 0;
    line-height: 1.05;
    margin: 0;
}

.legal-title-row p {
    color: var(--ps-muted);
    line-height: 1.75;
    margin: 1rem 0 0;
    max-width: 720px;
}

.legal-login-link {
    align-items: center;
    background: var(--ps-primary);
    border-radius: 12px;
    color: #ffffff;
    display: inline-flex;
    flex: 0 0 auto;
    font-size: .88rem;
    font-weight: var(--ps-weight-bold);
    min-height: 42px;
    padding: 0 .95rem;
    text-decoration: none;
}

.legal-login-link:hover {
    background: var(--ps-primary-hover);
    color: #ffffff;
}

.legal-meta-grid {
    display: flex;
    flex-wrap: wrap;
    gap: .55rem;
    margin-top: 1.3rem;
}

.legal-meta-grid span {
    background: var(--ps-surface-soft);
    border: 1px solid var(--ps-border);
    border-radius: 999px;
    color: #334155;
    font-size: .78rem;
    font-weight: var(--ps-weight-bold);
    min-height: 32px;
    padding: .45rem .72rem;
}

.legal-public-shell .legal-alert {
    align-items: center;
    background: #fffbeb;
    border-bottom: 1px solid #fde68a;
    border-top: 1px solid #fde68a;
    color: #92400e;
    display: flex;
    font-size: .92rem;
    gap: .7rem;
    padding: 1rem clamp(1.25rem, 3vw, 2.2rem);
}

.legal-public-shell .legal-alert::before {
    align-items: center;
    background: #f59e0b;
    border-radius: 999px;
    color: #ffffff;
    content: "!";
    display: inline-flex;
    flex: 0 0 28px;
    font-weight: var(--ps-weight-heavy);
    height: 28px;
    justify-content: center;
}

.legal-public-shell .legal-content {
    display: grid;
    gap: .85rem;
    padding: clamp(1rem, 2vw, 1.5rem);
}

.legal-section {
    background: #ffffff;
    border: 1px solid var(--ps-border);
    border-radius: 14px;
    padding: clamp(1rem, 2vw, 1.25rem);
}

.legal-section.highlight {
    background: #f0fdfa;
    border-color: #99f6e4;
}

.legal-section.highlight.danger {
    background: #fff1f2;
    border-color: #fecdd3;
}

.legal-section h2 {
    align-items: center;
    color: var(--ps-text);
    display: flex;
    font-size: 1rem;
    font-weight: var(--ps-weight-heavy);
    gap: .55rem;
    letter-spacing: 0;
    margin: 0 0 .55rem;
}

.legal-section h2::before {
    background: var(--ps-accent);
    border-radius: 999px;
    content: "";
    flex: 0 0 8px;
    height: 8px;
    width: 8px;
}

.legal-section.highlight.danger h2::before {
    background: var(--ps-danger);
}

.legal-section p,
.legal-section li {
    color: #475569;
    font-size: .94rem;
    line-height: 1.72;
}

.legal-section p:last-child,
.legal-section ul:last-child {
    margin-bottom: 0;
}

@media (max-width: 980px) {
    .legal-public-shell {
        grid-template-columns: 1fr;
    }

    .legal-side-panel {
        min-height: auto;
        position: static;
    }

    .legal-doc-nav {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .legal-doc-nav a {
        align-items: flex-start;
        min-height: 58px;
    }
}

@media (max-width: 720px) {
    .legal-public-page {
        padding: .75rem;
    }

    .legal-doc-nav {
        grid-template-columns: 1fr;
    }

    .legal-title-row {
        display: grid;
    }

    .legal-login-link {
        justify-content: center;
        width: 100%;
    }
}

/* Respaldos */
.backup-config-grid {
    display: grid;
    gap: .85rem;
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.backup-config-item {
    background: var(--ps-surface-soft);
    border: 1px solid var(--ps-border);
    border-radius: var(--ps-radius-md);
    display: grid;
    gap: .35rem;
    min-width: 0;
    padding: .95rem;
}

.backup-config-item span {
    color: var(--ps-muted);
    font-size: var(--ps-font-xs);
    font-weight: var(--ps-weight-heavy);
    letter-spacing: .06em;
    text-transform: uppercase;
}

.backup-config-item strong {
    color: var(--ps-text);
    font-size: .9rem;
    font-weight: var(--ps-weight-bold);
    overflow-wrap: anywhere;
}

.backup-restore-list {
    display: grid;
    gap: .65rem;
}

.backup-restore-item {
    background: var(--ps-surface-soft);
    border: 1px solid var(--ps-border);
    border-radius: var(--ps-radius-md);
    display: grid;
    gap: .25rem;
    padding: .8rem .9rem;
}

.backup-restore-item strong {
    color: var(--ps-text);
    font-size: .88rem;
}

.backup-restore-item span {
    color: var(--ps-muted);
    font-size: .86rem;
}

@media (max-width: 980px) {
    .backup-config-grid {
        grid-template-columns: 1fr;
    }
}

