/* =========================================================
   KASH - DASHBOARD.CSS COMPLETO CORREGIDO
========================================================= */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: Arial, Helvetica, sans-serif;
    background: #f1f5f9;
    color: #0f172a;
}

a {
    text-decoration: none;
}

button,
input,
select,
textarea {
    font-family: inherit;
}

/* =========================================================
   LOGIN / REGISTRO
========================================================= */

.login-body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0f172a, #1e3a8a);
    padding: 24px;
}

.login-card {
    width: 100%;
    max-width: 460px;
    background: #ffffff;
    border-radius: 24px;
    padding: 34px;
    box-shadow: 0 22px 55px rgba(15, 23, 42, 0.28);
}

.registro-card {
    max-width: 560px;
}

.login-header {
    text-align: center;
    margin-bottom: 26px;
}

.login-icon {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: #dbeafe;
    color: #2563eb;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 34px;
    margin-bottom: 14px;
}

.login-title {
    font-size: 30px;
    font-weight: 900;
    color: #0f172a;
    margin-bottom: 8px;
}

.login-subtitle {
    color: #64748b;
    font-size: 15px;
}

.login-register-box {
    margin-top: 20px;
    text-align: center;
}

/* =========================================================
   LAYOUT GENERAL
========================================================= */

.dashboard-container {
    display: flex;
    min-height: 100vh;
    background: #f1f5f9;
}

.sidebar {
    width: 300px;
    min-width: 300px;
    background: linear-gradient(180deg, #1e3a8a, #172554);
    color: #ffffff;
    display: flex;
    flex-direction: column;
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    z-index: 20;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 34px 28px;
}

.sidebar-brand i {
    font-size: 36px;
    color: #facc15;
}

.sidebar-brand strong {
    display: block;
    font-size: 25px;
    font-weight: 900;
    line-height: 1;
}

.sidebar-brand span {
    display: block;
    margin-top: 6px;
    color: #cbd5e1;
    font-size: 15px;
}

.sidebar-menu {
    display: flex;
    flex-direction: column;
    padding: 20px 0;
}

.sidebar-menu a {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 18px 32px;
    color: #ffffff;
    font-size: 17px;
    font-weight: 700;
    transition: 0.2s ease;
    border-left: 5px solid transparent;
}

.sidebar-menu a i {
    width: 24px;
    font-size: 18px;
    text-align: center;
}

.sidebar-menu a:hover,
.sidebar-menu a.active {
    background: rgba(37, 99, 235, 0.55);
    border-left-color: #22c55e;
}

.sidebar-user {
    margin-top: auto;
    padding: 26px 28px;
    border-top: 1px solid rgba(255, 255, 255, 0.15);
    display: flex;
    align-items: center;
    gap: 14px;
}

.sidebar-avatar {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: #2563eb;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
}

.sidebar-user strong {
    display: block;
    color: #ffffff;
    font-size: 15px;
}

.sidebar-user span {
    display: block;
    color: #22c55e;
    font-size: 13px;
    margin-top: 4px;
}

.main-content {
    margin-left: 300px;
    width: calc(100% - 300px);
    min-height: 100vh;
    padding: 34px 38px;
    background: #f1f5f9;
}

/* =========================================================
   TOPBAR / HEADER
========================================================= */

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 28px;
}

.menu-button {
    width: 46px;
    height: 46px;
    border-radius: 13px;
    border: none;
    background: #ffffff;
    color: #1e3a8a;
    font-size: 20px;
    box-shadow: 0 8px 22px rgba(15, 23, 42, 0.08);
    cursor: pointer;
}

.topbar-info {
    display: flex;
    align-items: center;
    gap: 16px;
    color: #475569;
    font-weight: 700;
}

.topbar-info div {
    background: #ffffff;
    border-radius: 14px;
    padding: 12px 16px;
    box-shadow: 0 8px 22px rgba(15, 23, 42, 0.06);
}

.notification-dot {
    background: #ef4444;
    color: #ffffff;
    padding: 3px 8px;
    border-radius: 999px;
    font-size: 12px;
    margin-left: 6px;
}

.dashboard-header {
    margin-bottom: 26px;
}

.dashboard-header h2 {
    font-size: 32px;
    font-weight: 900;
    color: #0f172a;
    margin-bottom: 8px;
}

.dashboard-header p {
    color: #64748b;
    font-size: 15px;
    line-height: 1.6;
}

/* =========================================================
   TARJETAS ESTADISTICAS
========================================================= */

.stats-grid {
    margin-bottom: 28px;
}

.modern-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 22px;
}

.stat-card {
    min-height: 145px;
}

.modern-card {
    background: #ffffff;
    border-radius: 22px;
    padding: 26px;
    box-shadow: 0 14px 35px rgba(15, 23, 42, 0.08);
    display: flex;
    align-items: center;
    gap: 20px;
    border-bottom: 5px solid transparent;
}

.stat-icon {
    width: 62px;
    height: 62px;
    min-width: 62px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
}

.stat-title {
    font-size: 14px;
    text-transform: uppercase;
    font-weight: 900;
    color: #64748b;
}

.stat-value {
    font-size: 34px;
    font-weight: 900;
    color: #020617;
    margin: 6px 0;
}

.stat-card small {
    color: #64748b;
}

.blue-card {
    border-bottom-color: #2563eb;
}

.green-card {
    border-bottom-color: #22c55e;
}

.orange-card {
    border-bottom-color: #f97316;
}

.red-card {
    border-bottom-color: #ef4444;
}

.purple-card {
    border-bottom-color: #8b5cf6;
}

.blue-icon {
    background: #dbeafe;
    color: #2563eb;
}

.green-icon {
    background: #dcfce7;
    color: #16a34a;
}

.orange-icon {
    background: #ffedd5;
    color: #f97316;
}

.red-icon {
    background: #fee2e2;
    color: #ef4444;
}

.purple-icon {
    background: #ede9fe;
    color: #7c3aed;
}

/* =========================================================
   PANELES
========================================================= */

.dashboard-bottom {
    display: grid;
    grid-template-columns: 1fr;
    gap: 24px;
}

.panel-card {
    background: #ffffff;
    border-radius: 22px;
    padding: 28px;
    box-shadow: 0 14px 35px rgba(15, 23, 42, 0.08);
    margin-bottom: 28px;
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 24px;
}

.panel-header h3 {
    font-size: 21px;
    font-weight: 900;
    color: #0f172a;
    margin: 0;
}

/* =========================================================
   FORMULARIOS
========================================================= */

.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    font-weight: 800;
    color: #1e293b;
    margin-bottom: 8px;
    font-size: 15px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    min-height: 48px;
    border: 1px solid #cbd5e1;
    border-radius: 13px;
    padding: 12px 15px;
    font-size: 15px;
    background: #ffffff;
    color: #0f172a;
    outline: none;
    transition: 0.2s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.14);
}

.form-group small {
    display: block;
    margin-top: 6px;
    color: #64748b;
    font-size: 13px;
}

.filters-form {
    display: grid;
    grid-template-columns: 2fr 1fr 1.4fr auto;
    gap: 16px;
    align-items: end;
    margin-bottom: 26px;
}

.filters-form .form-group {
    margin-bottom: 0;
}

.form-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 16px;
}

.filters-form .form-actions {
    margin-top: 0;
    align-items: end;
}

/* =========================================================
   BOTONES
========================================================= */

.btn,
.btn-primary,
.btn-outline,
.btn-small {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-decoration: none;
    border-radius: 13px;
    font-weight: 900;
    cursor: pointer;
    line-height: 1;
    white-space: nowrap;
    transition: 0.2s ease;
}

.btn,
button.btn,
a.btn {
    width: auto;
    min-height: 46px;
    padding: 12px 20px;
    border: 2px solid #2563eb;
    background: #2563eb;
    color: #ffffff;
}

.btn-primary,
button.btn-primary,
a.btn-primary {
    width: auto;
    min-height: 46px;
    padding: 12px 20px;
    border: 2px solid #2563eb;
    background: #2563eb;
    color: #ffffff;
    box-shadow: 0 10px 22px rgba(37, 99, 235, 0.22);
}

.btn:hover,
.btn-primary:hover {
    background: #1d4ed8;
    border-color: #1d4ed8;
}

.btn-outline,
a.btn-outline,
button.btn-outline {
    width: auto;
    min-height: 46px;
    padding: 12px 20px;
    border: 2px solid #2563eb;
    background: #ffffff;
    color: #2563eb;
}

.btn-outline:hover {
    background: #eff6ff;
}

/* Boton Crear empleado / Crear cliente - CORREGIDO */
.panel-header a.btn,
.panel-header a.btn-primary,
.panel-header .btn,
.panel-header .btn-primary {
    width: auto !important;
    min-width: 175px !important;
    max-width: max-content !important;
    min-height: 48px !important;
    padding: 13px 22px !important;
    background: #dbeafe !important;
    border: 2px solid #2563eb !important;
    color: #000000 !important;
    font-weight: 900 !important;
    box-shadow: none !important;
    opacity: 1 !important;
    overflow: visible !important;
}

.panel-header a.btn *,
.panel-header a.btn-primary *,
.panel-header .btn *,
.panel-header .btn-primary * {
    color: #000000 !important;
    opacity: 1 !important;
}

.panel-header a.btn:hover,
.panel-header a.btn-primary:hover,
.panel-header .btn:hover,
.panel-header .btn-primary:hover {
    background: #bfdbfe !important;
    color: #000000 !important;
}

.form-actions .btn,
.form-actions .btn-primary,
.form-actions .btn-outline {
    width: auto !important;
    max-width: max-content !important;
}

.btn-small {
    width: 38px;
    height: 38px;
    padding: 0;
    font-size: 14px;
    border: none;
}

.btn-edit {
    background: #2563eb;
    color: #ffffff;
}

.btn-view {
    background: #0ea5e9;
    color: #ffffff;
}

.btn-delete {
    background: #ef4444;
    color: #ffffff;
}

.table-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* =========================================================
   TABLAS
========================================================= */

.table-responsive {
    width: 100%;
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    background: #ffffff;
    border-radius: 16px;
    overflow: hidden;
}

.data-table thead {
    background: #f8fafc;
}

.data-table th {
    text-align: left;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #475569;
    padding: 15px 14px;
    border-bottom: 1px solid #e2e8f0;
}

.data-table td {
    padding: 15px 14px;
    border-bottom: 1px solid #e2e8f0;
    color: #334155;
    font-size: 14px;
    vertical-align: middle;
}

.data-table tr:hover {
    background: #f8fafc;
}

/* =========================================================
   BADGES / ALERTAS
========================================================= */

.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 7px 11px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 900;
}

.badge-success {
    background: #dcfce7;
    color: #166534;
}

.badge-warning {
    background: #fef3c7;
    color: #92400e;
}

.badge-danger {
    background: #fee2e2;
    color: #991b1b;
}

.badge-neutral {
    background: #e5e7eb;
    color: #111827;
}

.alert {
    position: relative;
    padding: 15px 17px 15px 54px;
    border: 1px solid #dbe3ee;
    border-left-width: 5px;
    border-radius: 15px;
    margin-bottom: 18px;
    font-weight: 850;
    line-height: 1.45;
    box-shadow: 0 14px 30px rgba(15, 23, 42, 0.07);
}

.alert::before {
    content: "i";
    position: absolute;
    left: 16px;
    top: 15px;
    width: 25px;
    height: 25px;
    border-radius: 9px;
    display: grid;
    place-items: center;
    font-size: 12px;
    font-weight: 950;
    line-height: 1;
}

.alert-success,
.alert-ok,
.alert.ok {
    background: #ecfdf5;
    color: #14532d;
    border-color: #bbf7d0;
    border-left-color: #16a34a;
}

.alert-success::before,
.alert-ok::before,
.alert.ok::before {
    content: "OK";
    background: #16a34a;
    color: #ffffff;
}

.alert-warning,
.alert.warning {
    background: #fffbeb;
    color: #78350f;
    border-color: #fde68a;
    border-left-color: #f59e0b;
}

.alert-warning::before,
.alert.warning::before {
    content: "!";
    background: #f59e0b;
    color: #111827;
}

.alert-error,
.alert.error {
    background: #fef2f2;
    color: #7f1d1d;
    border-color: #fecaca;
    border-left-color: #dc2626;
}

.alert-error::before,
.alert.error::before {
    content: "!";
    background: #dc2626;
    color: #ffffff;
}

.alert-info,
.alert.info {
    background: #eff6ff;
    color: #1e3a8a;
    border-color: #bfdbfe;
    border-left-color: #2563eb;
}

.alert-info::before,
.alert.info::before {
    content: "i";
    background: #2563eb;
    color: #ffffff;
}

.payment-date-badge {
    display: inline-grid;
    grid-template-columns: auto auto;
    align-items: center;
    gap: 7px;
    min-height: 32px;
    padding: 6px 10px;
    border: 1px solid #dbe3ee;
    border-left-width: 4px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 950;
    line-height: 1;
    white-space: nowrap;
}

.payment-date-wrap,
.payment-plan-date {
    display: inline-flex;
    max-width: 100%;
}

.payment-date-badge strong {
    font-size: 12px !important;
    font-weight: 950 !important;
    line-height: 1 !important;
}

.payment-date-badge em {
    display: inline-flex;
    align-items: center;
    min-height: 20px;
    padding: 3px 7px;
    border-radius: 999px;
    font-size: 10px;
    font-style: normal;
    font-weight: 950;
    text-transform: uppercase;
}

.payment-date-overdue,
.loan-row-overdue td {
    background: #fef2f2;
}

.payment-date-overdue {
    color: #7f1d1d;
    border-color: #fecaca;
    border-left-color: #dc2626;
}

.payment-date-overdue em {
    background: #dc2626;
    color: #ffffff;
}

.payment-date-today,
.loan-row-today td {
    background: #fffbeb;
}

.payment-date-today {
    color: #78350f;
    border-color: #fde68a;
    border-left-color: #f59e0b;
}

.payment-date-today em {
    background: #f59e0b;
    color: #111827;
}

.payment-date-upcoming,
.payment-date-paid,
.loan-row-upcoming td,
.loan-row-paid td {
    background: #f0fdf4;
}

.payment-date-upcoming,
.payment-date-paid {
    color: #14532d;
    border-color: #bbf7d0;
    border-left-color: #16a34a;
}

.payment-date-upcoming em,
.payment-date-paid em {
    background: #16a34a;
    color: #ffffff;
}

.payment-date-neutral,
.loan-row-neutral td {
    background: #f8fafc;
}

.payment-date-neutral {
    color: #475569;
    border-color: #e2e8f0;
    border-left-color: #94a3b8;
}

.payment-date-neutral em {
    background: #94a3b8;
    color: #ffffff;
}

.cc-table tr[class*="loan-row-"] td:first-child {
    border-left: 4px solid transparent;
}

.cc-table tr.loan-row-overdue td:first-child {
    border-left-color: #dc2626;
}

.cc-table tr.loan-row-today td:first-child {
    border-left-color: #f59e0b;
}

.cc-table tr.loan-row-upcoming td:first-child,
.cc-table tr.loan-row-paid td:first-child {
    border-left-color: #16a34a;
}

/* =========================================================
   RESUMENES / ACCIONES RAPIDAS
========================================================= */

.admin-summary {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.summary-item {
    background: #f8fafc;
    border-radius: 16px;
    padding: 16px;
    border: 1px solid #e2e8f0;
}

.summary-item span {
    display: block;
    color: #64748b;
    font-size: 13px;
    margin-bottom: 6px;
    font-weight: 700;
}

.summary-item strong {
    color: #0f172a;
    font-size: 15px;
}

.quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.quick-actions a {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 13px 18px;
    background: #eff6ff;
    color: #1d4ed8;
    border-radius: 13px;
    font-weight: 900;
    border: 1px solid #bfdbfe;
}

.empty-text {
    color: #64748b;
    font-size: 15px;
    padding: 18px 0;
}

.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    margin-top: 22px;
    color: #475569;
    font-weight: 800;
}

/* =========================================================
   FIX FINAL FUERTE PARA BOTONES VACIOS
========================================================= */

.panel-header a[href*="crear"] {
    background: #dbeafe !important;
    color: #000000 !important;
    border: 2px solid #2563eb !important;
    min-width: 180px !important;
    max-width: max-content !important;
    width: auto !important;
    height: auto !important;
    min-height: 48px !important;
    padding: 13px 22px !important;
    opacity: 1 !important;
    text-indent: 0 !important;
    font-size: 15px !important;
    font-weight: 900 !important;
    overflow: visible !important;
}

.panel-header a[href*="crear"] i,
.panel-header a[href*="crear"] span {
    color: #000000 !important;
    opacity: 1 !important;
    display: inline-block !important;
}

/* =========================================================
   RESPONSIVE
========================================================= */

@media (max-width: 1200px) {
    .modern-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .filters-form {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 900px) {
    .sidebar {
        position: relative;
        width: 100%;
        min-width: 100%;
        height: auto;
    }

    .dashboard-container {
        flex-direction: column;
    }

    .main-content {
        margin-left: 0;
        width: 100%;
    }
}

@media (max-width: 768px) {
    .main-content {
        padding: 22px;
    }

    .modern-grid {
        grid-template-columns: 1fr;
    }

    .filters-form {
        grid-template-columns: 1fr;
    }

    .panel-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .panel-header a.btn,
    .panel-header a.btn-primary,
    .form-actions .btn,
    .form-actions .btn-primary,
    .form-actions .btn-outline {
        width: 100% !important;
        max-width: 100% !important;
    }

    .admin-summary {
        grid-template-columns: 1fr;
    }

    .topbar {
        flex-direction: column;
        align-items: flex-start;
        gap: 14px;
    }

    .topbar-info {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* =========================================================
   FIX COMPATIBILIDAD - PAGINAS SUPADMIN ANTIGUAS/NUEVAS
========================================================= */

.top-actions,
.top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 26px;
    flex-wrap: wrap;
}

.top-actions h1,
.top-actions h2,
.top-bar h1,
.top-bar h2 {
    font-size: 30px;
    line-height: 1.15;
    font-weight: 900;
    color: #0f172a;
    margin-bottom: 6px;
}

.top-actions p,
.top-bar p {
    color: #64748b;
    font-size: 15px;
    line-height: 1.5;
}

.card,
.form-box,
.table-box,
.system-card {
    background: #ffffff;
    border-radius: 22px;
    padding: 28px;
    box-shadow: 0 14px 35px rgba(15, 23, 42, 0.08);
    margin-bottom: 28px;
}

.table-box {
    overflow-x: auto;
}

.table-box table,
.card table,
.system-card table {
    width: 100%;
    border-collapse: collapse;
    background: #ffffff;
}

.table-box thead,
.card thead,
.system-card thead {
    background: #f8fafc;
}

.table-box th,
.card th,
.system-card th {
    text-align: left;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #475569;
    padding: 15px 14px;
    border-bottom: 1px solid #e2e8f0;
    white-space: nowrap;
}

.table-box td,
.card td,
.system-card td {
    padding: 15px 14px;
    border-bottom: 1px solid #e2e8f0;
    color: #334155;
    font-size: 14px;
    vertical-align: middle;
}

.table-box tr:hover,
.card tr:hover,
.system-card tr:hover {
    background: #f8fafc;
}

.actions-cell,
.table-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    min-width: 210px;
}

.btn-small,
a.btn-small,
button.btn-small {
    width: auto;
    min-width: 38px;
    min-height: 38px;
    height: auto;
    padding: 9px 12px;
    border-radius: 11px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 900;
    line-height: 1;
    border: none;
    text-decoration: none;
    white-space: nowrap;
}

.btn-view,
a.btn-view,
button.btn-view {
    background: #0ea5e9;
    color: #ffffff;
}

.btn-edit,
a.btn-edit,
button.btn-edit {
    background: #2563eb;
    color: #ffffff;
}

.btn-delete,
a.btn-delete,
button.btn-delete {
    background: #ef4444;
    color: #ffffff;
}

.btn-view i,
.btn-edit i,
.btn-delete i,
.btn-small i {
    color: inherit;
}

.badge.activo,
.badge-active,
.badge-success {
    background: #dcfce7;
    color: #166534;
}

.badge.inactivo,
.badge.suspendido,
.badge-danger {
    background: #fee2e2;
    color: #991b1b;
}

.badge.pendiente,
.badge-warning {
    background: #fef3c7;
    color: #92400e;
}

.badge.pagado {
    background: #dcfce7;
    color: #166534;
}

.badge.mora,
.badge.vencido {
    background: #fee2e2;
    color: #991b1b;
}

.activity-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.activity-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 15px 16px;
    border-radius: 16px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
}

.activity-icon {
    width: 46px;
    min-width: 46px;
    height: 46px;
    border-radius: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

.activity-item strong {
    display: block;
    color: #0f172a;
    font-size: 15px;
    margin-bottom: 4px;
}

.activity-item span {
    display: block;
    color: #64748b;
    font-size: 14px;
}

.password-box {
    position: relative;
}

.login-alert-error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
    border-radius: 14px;
    padding: 12px 14px;
    margin-bottom: 16px;
    font-weight: 700;
}

.w-100 {
    width: 100% !important;
}

.text-success,
.online-text {
    color: #22c55e !important;
}

.margin-right {
    margin-right: 8px;
}

@media (max-width: 768px) {
    .top-actions,
    .top-bar {
        align-items: flex-start;
        flex-direction: column;
    }

    .top-actions .btn,
    .top-actions .btn-primary,
    .top-bar .btn,
    .top-bar .btn-primary {
        width: 100%;
        max-width: 100%;
    }
}

/* Variables usadas por archivos antiguos */
:root {
    --primary: #0f172a;
    --secondary: #2563eb;
    --accent: #22c55e;
    --danger: #ef4444;
    --warning: #f97316;
}

.stats-grid:not(.modern-grid) {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 22px;
    margin-bottom: 28px;
}

.stat-card:not(.modern-card) {
    background: #ffffff;
    border-radius: 22px;
    padding: 26px;
    box-shadow: 0 14px 35px rgba(15, 23, 42, 0.08);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    border-bottom: 5px solid #2563eb;
}

.copyright {
    margin-top: 20px;
    text-align: center;
    color: #64748b;
    font-size: 14px;
}

@media (max-width: 900px) {
    .stats-grid:not(.modern-grid) {
        grid-template-columns: 1fr;
    }
}
/* =========================================================
   KASH RESPONSIVE REAL - BASE PARA CELULAR Y PWA
========================================================= */

.mobile-overlay {
    display: none;
}

.body-menu-open {
    overflow: hidden;
}

/* PC: boton hamburguesa visible pero no obligatorio */
.menu-button {
    display: inline-flex;
}

/* Tablet */
@media (max-width: 1100px) {
    .main-content {
        padding: 26px;
    }

    .modern-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .filters-form {
        grid-template-columns: 1fr 1fr;
    }

    .filters-form .form-actions {
        grid-column: 1 / -1;
    }
}

/* Kash responsive repair 2026-07-11: shared clients, loans, forms and tools. */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html,
body {
    width: 100%;
    max-width: 100%;
    margin: 0;
    overflow-x: hidden;
}

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

.dashboard-container,
.main-content,
.cc-wrap,
.cc-card,
.cc-table-scroll,
.cc-table,
.form-grid,
.cc-actions,
.client-cell,
.payment-plan,
.payment-plan-card,
.payment-plan-list,
.payment-plan-row {
    min-width: 0;
    max-width: 100%;
}

body,
.cc-card,
.cc-table,
.cc-table th,
.cc-table td,
.client-cell,
.client-cell strong,
.client-cell-meta,
.muted,
.btn,
.badge,
.payment-date-badge,
.payment-plan-card,
.payment-plan-row,
.client-due-card,
.client-due-summary,
.client-due-body {
    word-break: normal !important;
    overflow-wrap: anywhere !important;
    hyphens: none !important;
}

.btn,
a.btn,
button.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
    max-width: 100%;
    min-height: 44px;
    white-space: normal !important;
    text-align: center;
    line-height: 1.15;
}

.payment-date-badge {
    display: inline-flex !important;
    align-items: center !important;
    flex-wrap: nowrap !important;
    width: auto !important;
    max-width: 100% !important;
    white-space: nowrap !important;
}

.payment-plan,
.payment-plan-list {
    width: 100%;
}

.payment-plan-row {
    grid-template-columns: minmax(130px, max-content) minmax(0, 1fr) auto !important;
}

.client-last-method {
    display: inline-flex !important;
    align-items: center !important;
    width: auto !important;
    max-width: 100% !important;
    padding: 8px 12px !important;
    border-radius: 12px !important;
    background: #f1f5f9 !important;
    color: #334155 !important;
    font-size: 16px !important;
    font-weight: 850 !important;
    line-height: 1.25 !important;
}

.clients-results-card,
.loan-results-card {
    overflow: visible !important;
}

.clients-results-card .clients-card-table td[data-label="Acciones"] .cc-actions,
.clients-table td[data-label="Acciones"] .cc-actions,
.loan-results-card .cc-table td[data-label="Acciones"] .cc-actions {
    align-items: stretch;
}

@media (min-width: 1101px) {
    .clients-results-card .clients-card-table td[data-label="Acciones"] .cc-actions,
    .clients-table td[data-label="Acciones"] .cc-actions,
    .loan-results-card .cc-table td[data-label="Acciones"] .cc-actions {
        display: grid !important;
        grid-template-columns: 1fr !important;
        gap: 10px !important;
    }

    .clients-results-card .clients-card-table td[data-label="Acciones"] .btn,
    .clients-table td[data-label="Acciones"] .btn,
    .loan-results-card .cc-table td[data-label="Acciones"] .btn {
        width: 100% !important;
    }
}

@media (max-width: 1100px) {
    .cc-wrap {
        width: 100%;
        padding: 14px;
    }

    .cc-card {
        width: 100%;
        padding: 16px;
        border-radius: 16px;
    }

    .form-grid,
    .report-filter-grid,
    .dashboard-filter-form,
    .dashboard-client-search-form {
        display: grid !important;
        grid-template-columns: 1fr !important;
        gap: 14px !important;
    }

    .form-group input,
    .form-group select,
    .form-group textarea,
    .form-group .btn,
    .report-filter-actions .btn {
        width: 100% !important;
        min-width: 0 !important;
    }

    .cc-table-scroll {
        overflow: visible !important;
    }

    .clients-results-card,
    .loan-results-card {
        padding: 0 !important;
        background: transparent !important;
        border: 0 !important;
        box-shadow: none !important;
    }

    .clients-results-card .clients-card-table,
    .clients-results-card .clients-card-table thead,
    .clients-results-card .clients-card-table tbody,
    .clients-results-card .clients-card-table tr,
    .clients-results-card .clients-card-table td,
    .loan-results-card .cc-table,
    .loan-results-card .cc-table thead,
    .loan-results-card .cc-table tbody,
    .loan-results-card .cc-table tr,
    .loan-results-card .cc-table td {
        display: block !important;
        width: 100% !important;
        min-width: 0 !important;
        max-width: 100% !important;
    }

    .clients-results-card .clients-card-table thead,
    .loan-results-card .cc-table thead {
        display: none !important;
    }

    .clients-results-card .clients-card-table tbody,
    .loan-results-card .cc-table tbody {
        display: grid !important;
        gap: 14px !important;
    }

    .clients-results-card .clients-card-table tr,
    .loan-results-card .cc-table tr {
        display: grid !important;
        grid-template-columns: minmax(0, 1fr) !important;
        width: 100% !important;
        padding: 16px !important;
        border: 1px solid #dbe3ee !important;
        border-left: 6px solid var(--kash-neutral, #94a3b8) !important;
        border-radius: 18px !important;
        background: #fff !important;
        box-shadow: 0 16px 34px rgba(15, 23, 42, .08) !important;
    }

    .clients-results-card .clients-card-table tr.loan-row-overdue,
    .loan-results-card .cc-table tr.loan-row-overdue {
        border-left-color: var(--kash-overdue, #dc2626) !important;
        background: var(--kash-overdue-bg, #fff7f7) !important;
    }

    .clients-results-card .clients-card-table tr.loan-row-today,
    .loan-results-card .cc-table tr.loan-row-today {
        border-left-color: var(--kash-today, #f59e0b) !important;
        background: var(--kash-today-bg, #fffaf0) !important;
    }

    .clients-results-card .clients-card-table tr.loan-row-upcoming,
    .clients-results-card .clients-card-table tr.loan-row-paid,
    .loan-results-card .cc-table tr.loan-row-upcoming,
    .loan-results-card .cc-table tr.loan-row-paid {
        border-left-color: var(--kash-ok, #16a34a) !important;
        background: var(--kash-ok-bg, #f8fff9) !important;
    }

    .clients-results-card .clients-card-table td,
    .loan-results-card .cc-table td {
        display: block !important;
        width: 100% !important;
        padding: 12px 0 !important;
        border: 0 !important;
        border-bottom: 1px solid #e5e7eb !important;
        background: transparent !important;
        overflow: visible !important;
        white-space: normal !important;
    }

    .clients-results-card .clients-card-table td:last-child,
    .loan-results-card .cc-table td:last-child {
        border-bottom: 0 !important;
        padding-bottom: 0 !important;
    }

    .clients-results-card .clients-card-table td::before,
    .loan-results-card .cc-table td::before {
        content: attr(data-label) !important;
        display: block !important;
        margin-bottom: 7px !important;
        color: #64748b !important;
        font-size: 12px !important;
        font-weight: 950 !important;
        line-height: 1.15 !important;
        text-transform: uppercase !important;
        letter-spacing: 0 !important;
    }

    .clients-results-card .client-cell {
        width: 100% !important;
        max-width: none !important;
        gap: 7px !important;
    }

    .clients-results-card .client-cell strong {
        font-size: clamp(18px, 6vw, 24px) !important;
        line-height: 1.15 !important;
    }

    .clients-results-card .client-cell-meta,
    .clients-results-card .muted,
    .loan-results-card .muted {
        font-size: 15px !important;
        line-height: 1.35 !important;
    }

    .clients-results-card td[data-label="Saldo"],
    .loan-results-card td[data-label="Valores"] {
        display: grid !important;
        gap: 9px !important;
    }

    .payment-plan {
        grid-template-columns: 1fr !important;
        gap: 10px !important;
    }

    .payment-plan-row {
        display: grid !important;
        grid-template-columns: 1fr !important;
        gap: 8px !important;
    }

    .payment-plan-row em,
    .payment-date-badge {
        justify-self: start !important;
    }

    .payment-date-badge {
        white-space: normal !important;
        width: fit-content !important;
    }

    .clients-results-card .clients-card-table td[data-label="Acciones"] .cc-actions,
    .clients-table td[data-label="Acciones"] .cc-actions,
    .loan-results-card .cc-table td[data-label="Acciones"] .cc-actions {
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: wrap !important;
        gap: 8px !important;
        width: 100% !important;
        min-width: 0 !important;
        overflow: visible !important;
    }

    .clients-results-card .clients-card-table td[data-label="Acciones"] .btn,
    .clients-table td[data-label="Acciones"] .btn,
    .loan-results-card .cc-table td[data-label="Acciones"] .btn {
        flex: 1 1 126px !important;
        width: auto !important;
        min-width: 118px !important;
        max-width: none !important;
        min-height: 48px !important;
        padding: 12px 10px !important;
        font-size: 15px !important;
        line-height: 1.15 !important;
    }

    .client-score-pill,
    .client-score-card,
    .health-score-card {
        width: 100% !important;
        min-width: 0 !important;
        max-width: 260px !important;
        overflow: visible !important;
    }

    .client-score-pill span,
    .client-score-pill small,
    .client-score-card span,
    .health-score-card span {
        writing-mode: horizontal-tb !important;
        white-space: normal !important;
    }
}

@media (max-width: 420px) {
    .cc-wrap {
        padding: 10px;
    }

    .clients-results-card .clients-card-table tr,
    .loan-results-card .cc-table tr {
        padding: 14px !important;
        border-radius: 16px !important;
    }

    .clients-results-card .clients-card-table td[data-label="Acciones"] .btn,
    .clients-table td[data-label="Acciones"] .btn,
    .loan-results-card .cc-table td[data-label="Acciones"] .btn {
        flex-basis: calc(50% - 4px) !important;
        min-width: 0 !important;
        font-size: 14px !important;
    }
}

/* Celular */
@media (max-width: 768px) {
    body {
        background: #f1f5f9;
    }

    .dashboard-container {
        display: block;
        min-height: 100vh;
    }

    .sidebar {
        position: fixed;
        width: 285px;
        min-width: 285px;
        height: 100vh;
        left: -290px;
        top: 0;
        bottom: 0;
        z-index: 1000;
        transition: left 0.25s ease;
    }

    .sidebar.sidebar-open {
        left: 0;
    }

    .mobile-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(15, 23, 42, 0.55);
        z-index: 900;
    }

    .mobile-overlay.mobile-overlay-active {
        display: block;
    }

    .sidebar-brand {
        padding: 26px 22px;
    }

    .sidebar-brand strong {
        font-size: 22px;
    }

    .sidebar-menu {
        padding: 10px 0;
    }

    .sidebar-menu a {
        padding: 15px 24px;
        font-size: 15px;
    }

    .sidebar-user {
        padding: 20px 22px;
    }

    .main-content {
        margin-left: 0;
        width: 100%;
        padding: 18px;
    }

    .topbar {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        margin-bottom: 24px;
    }

    .topbar-info {
        gap: 8px;
    }

    .topbar-info div {
        padding: 9px 11px;
        font-size: 12px;
    }

    .dashboard-header h2 {
        font-size: 25px;
        line-height: 1.2;
    }

    .dashboard-header p {
        font-size: 14px;
    }

    .modern-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .modern-card {
        min-height: auto;
        padding: 20px;
    }

    .stat-icon {
        width: 54px;
        height: 54px;
        min-width: 54px;
        font-size: 22px;
    }

    .stat-value {
        font-size: 28px;
    }

    .panel-card {
        padding: 20px;
        border-radius: 18px;
    }

    .panel-header {
        flex-direction: column;
        align-items: stretch;
        gap: 14px;
    }

    .panel-header h3 {
        font-size: 20px;
    }

    .panel-header .btn,
    .panel-header .btn-primary,
    .panel-header a.btn,
    .panel-header a.btn-primary {
        width: 100% !important;
        max-width: 100% !important;
        justify-content: center;
    }

    .filters-form {
        grid-template-columns: 1fr;
        gap: 14px;
    }

    .filters-form .form-actions {
        display: grid;
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .filters-form .form-actions .btn-primary,
    .filters-form .form-actions .btn-outline {
        width: 100% !important;
        max-width: 100% !important;
    }

    .form-group input,
    .form-group select,
    .form-group textarea {
        min-height: 46px;
        font-size: 14px;
    }

    /* Tabla modo tarjetas en celular */
    .table-responsive {
        overflow-x: visible;
    }

    .data-table {
        border-collapse: separate;
        border-spacing: 0 14px;
        background: transparent;
    }

    .data-table thead {
        display: none;
    }

    .data-table,
    .data-table tbody,
    .data-table tr,
    .data-table td {
        display: block;
        width: 100%;
    }

    .data-table tr {
        background: #ffffff;
        border-radius: 18px;
        padding: 14px;
        box-shadow: 0 10px 25px rgba(15, 23, 42, 0.08);
    }

    .data-table td {
        border-bottom: 1px solid #e2e8f0;
        padding: 11px 0;
        display: flex;
        align-items: flex-start;
        justify-content: space-between;
        gap: 14px;
        font-size: 14px;
    }

    .data-table td:last-child {
        border-bottom: none;
    }

    .data-table td::before {
        content: attr(data-label);
        font-weight: 900;
        color: #475569;
        min-width: 92px;
        max-width: 120px;
    }

    .table-actions {
        width: 100%;
        display: grid;
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .btn-small,
    a.btn-small,
    button.btn-small {
        width: 100%;
        justify-content: center;
        min-height: 40px;
    }
}

/* Celulares pequenos */
@media (max-width: 420px) {
    .main-content {
        padding: 14px;
    }

    .dashboard-header h2 {
        font-size: 22px;
    }

    .topbar-info {
        flex-direction: column;
        align-items: flex-end;
    }

    .modern-card {
        align-items: flex-start;
    }

    .data-table td {
        flex-direction: column;
        gap: 5px;
    }

    .data-table td::before {
        min-width: auto;
        max-width: none;
    }
}
/* =========================================================
   FIX DEFINITIVO BOTONES DE ACCIONES EN TABLAS
   Ver / Editar / Eliminar
========================================================= */

.data-table th:last-child,
.data-table td:last-child {
    min-width: 270px !important;
    width: 270px !important;
}

.table-actions,
.actions-cell {
    display: flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
    gap: 8px !important;
    flex-wrap: nowrap !important;
    min-width: 250px !important;
    width: max-content !important;
}

.table-actions .btn-small,
.actions-cell .btn-small,
.data-table .btn-small,
.data-table a.btn-small,
.data-table button.btn-small {
    width: auto !important;
    min-width: auto !important;
    max-width: none !important;
    height: auto !important;
    min-height: 38px !important;
    padding: 10px 13px !important;
    border-radius: 12px !important;

    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 6px !important;

    font-size: 13px !important;
    font-weight: 900 !important;
    line-height: 1 !important;
    white-space: nowrap !important;

    overflow: visible !important;
    text-indent: 0 !important;
    opacity: 1 !important;
    text-decoration: none !important;
    border: none !important;
}

.table-actions .btn-small i,
.actions-cell .btn-small i,
.data-table .btn-small i {
    color: inherit !important;
    font-size: 13px !important;
    width: auto !important;
    min-width: auto !important;
    margin: 0 !important;
}

.table-actions .btn-view,
.actions-cell .btn-view,
.data-table .btn-view {
    background: #0ea5e9 !important;
    color: #ffffff !important;
}

.table-actions .btn-edit,
.actions-cell .btn-edit,
.data-table .btn-edit {
    background: #2563eb !important;
    color: #ffffff !important;
}

.table-actions .btn-delete,
.actions-cell .btn-delete,
.data-table .btn-delete {
    background: #ef4444 !important;
    color: #ffffff !important;
}

/* Evita que el texto de las acciones se corte */
.table-actions a,
.actions-cell a {
    overflow: visible !important;
    color: #ffffff !important;
}

/* =========================================================
   EN CELULAR LOS BOTONES SE APILAN BONITO
========================================================= */

@media (max-width: 768px) {
    .data-table th:last-child,
    .data-table td:last-child {
        min-width: 100% !important;
        width: 100% !important;
    }

    .table-actions,
    .actions-cell {
        width: 100% !important;
        min-width: 100% !important;
        display: grid !important;
        grid-template-columns: 1fr !important;
        gap: 8px !important;
    }

    .table-actions .btn-small,
    .actions-cell .btn-small,
    .data-table .btn-small,
    .data-table a.btn-small,
    .data-table button.btn-small {
        width: 100% !important;
        min-height: 42px !important;
        justify-content: center !important;
    }
}
/* =========================================================
   ACCIONES DE TABLA - FIX LIMPIO SIN btn-small
========================================================= */

.data-table th:last-child,
.data-table td.actions-column {
    min-width: 330px !important;
    width: 330px !important;
}

.row-actions {
    display: flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
    gap: 10px !important;
    flex-wrap: nowrap !important;
    width: 100% !important;
}

.row-actions .action-btn {
    width: auto !important;
    min-width: 82px !important;
    height: 40px !important;
    min-height: 40px !important;
    padding: 0 13px !important;

    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 7px !important;

    border-radius: 12px !important;
    border: none !important;
    text-decoration: none !important;

    font-size: 13px !important;
    font-weight: 900 !important;
    line-height: 1 !important;
    white-space: nowrap !important;

    overflow: visible !important;
    opacity: 1 !important;
    text-indent: 0 !important;
}

.row-actions .action-btn i,
.row-actions .action-btn span {
    color: inherit !important;
    font-size: 13px !important;
    display: inline-block !important;
    opacity: 1 !important;
    text-indent: 0 !important;
}

.row-actions .action-view {
    background: #0ea5e9 !important;
    color: #ffffff !important;
}

.row-actions .action-edit {
    background: #2563eb !important;
    color: #ffffff !important;
}

.row-actions .action-delete {
    background: #ef4444 !important;
    color: #ffffff !important;
}

/* Celular: botones uno debajo del otro */
@media (max-width: 768px) {
    .data-table th:last-child,
    .data-table td.actions-column {
        min-width: 100% !important;
        width: 100% !important;
    }

    .data-table td.actions-column {
        display: block !important;
    }

    .data-table td.actions-column::before {
        display: block !important;
        margin-bottom: 10px !important;
    }

    .row-actions {
        display: grid !important;
        grid-template-columns: 1fr !important;
        gap: 8px !important;
        width: 100% !important;
    }

    .row-actions .action-btn {
        width: 100% !important;
        min-width: 100% !important;
        height: 42px !important;
    }
}
/* =========================================================
   VER PRESTAMO - DETALLE / CUOTAS / PAGOS
========================================================= */

.loan-detail-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
    margin-top: 18px;
}

.loan-detail-card {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 18px;
    padding: 18px;
    box-shadow: 0 10px 25px rgba(15, 23, 42, 0.06);
}

.loan-detail-card span {
    display: block;
    color: #64748b;
    font-size: 13px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 7px;
}

.loan-detail-card strong {
    display: block;
    color: #0f172a;
    font-size: 18px;
    font-weight: 900;
    word-break: break-word;
}

.loan-progress-box {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 18px;
    padding: 18px;
    margin-top: 18px;
}

.loan-progress-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
    font-weight: 900;
    color: #0f172a;
}

.loan-progress-track {
    width: 100%;
    height: 12px;
    border-radius: 999px;
    background: #e5e7eb;
    overflow: hidden;
}

.loan-progress-fill {
    height: 100%;
    border-radius: 999px;
    background: #2563eb;
}

.loan-info-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    margin-top: 16px;
}

.loan-info-item {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    padding: 14px;
}

.loan-info-item span {
    display: block;
    color: #64748b;
    font-size: 13px;
    font-weight: 800;
    margin-bottom: 5px;
}

.loan-info-item strong {
    color: #111827;
    font-size: 15px;
    font-weight: 900;
    word-break: break-word;
}

.section-gap {
    margin-top: 22px;
}

.text-muted-small {
    color: #64748b;
    font-size: 13px;
    font-weight: 700;
}

@media (max-width: 1100px) {
    .loan-detail-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 768px) {
    .loan-detail-grid,
    .loan-info-list {
        grid-template-columns: 1fr;
    }

    .loan-progress-info {
        align-items: flex-start;
        flex-direction: column;
    }
}

/* =========================================================
   KASH - OPERACION 2026
   Recibos, ficha cliente y celular compacto
========================================================= */

.renewal-lock {
    max-width: 860px;
    margin-left: auto;
    margin-right: auto;
    text-align: center;
}

.renewal-lock-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 16px;
    border-radius: 20px;
    display: grid;
    place-items: center;
    background: #fef3c7;
    color: #92400e;
    font-size: 34px;
    font-weight: 900;
}

.client-profile-grid,
.receipt-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
}

.client-profile-grid > div,
.receipt-grid > div {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    padding: 15px;
}

.client-profile-grid span,
.receipt-grid span {
    display: block;
    color: #64748b;
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
    margin-bottom: 6px;
}

.client-profile-grid strong,
.receipt-grid strong {
    color: #0f172a;
    font-size: 16px;
    font-weight: 900;
    word-break: break-word;
}

.receipt-grid small {
    display: block;
    margin-top: 5px;
    color: #64748b;
    font-weight: 800;
}

.receipt-card {
    max-width: 980px;
    margin-left: auto;
    margin-right: auto;
}

.receipt-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 18px;
    margin-bottom: 22px;
}

.receipt-brand {
    display: flex;
    align-items: center;
    gap: 14px;
}

.receipt-brand img {
    width: 70px;
    height: 70px;
    object-fit: cover;
    border-radius: 18px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 12px 28px rgba(15, 23, 42, .12);
}

.receipt-status {
    display: grid;
    gap: 8px;
    justify-items: end;
}

.receipt-status small {
    color: #64748b;
    font-size: 12px;
    font-weight: 900;
}

.receipt-note {
    margin-top: 16px;
    padding: 14px;
    border-radius: 14px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
}

.section-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 18px;
}

.section-head h3 {
    margin: 0 0 5px;
}

.monthly-main-card {
    border-top: 5px solid #2563eb;
}

@media (max-width: 980px) {
    .client-profile-grid,
    .receipt-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 640px) {
    .client-profile-grid,
    .receipt-grid {
        grid-template-columns: 1fr;
    }

    .receipt-head {
        display: grid;
    }

    .receipt-brand {
        align-items: flex-start;
    }

    .receipt-status {
        justify-items: start;
    }

    .section-head {
        display: grid;
    }

    .cc-card {
        padding: 16px !important;
    }

    .cc-card h2 {
        font-size: 22px;
    }

    .cc-card h3 {
        font-size: 18px;
    }

    .cc-table td {
        font-size: 14px;
    }
}

/* Cobros: cada prestamo usa una fila completa y cada cuota conserva su espacio. */
.cobros-list-grid {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 16px !important;
}

.cobros-list-grid > .client-due-card {
    width: 100% !important;
    max-width: none !important;
}

.client-due-card .payment-plan {
    width: 100% !important;
    grid-template-columns: minmax(260px, .75fr) minmax(420px, 1.25fr) !important;
}

.client-due-card .payment-plan-card,
.client-due-card .payment-plan-list,
.client-due-card .payment-plan-row {
    width: 100% !important;
    min-width: 0 !important;
}

.client-due-card .payment-plan-list {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 10px !important;
}

.client-due-card .payment-plan-row {
    display: grid !important;
    grid-template-columns: minmax(150px, max-content) minmax(0, 1fr) auto !important;
    align-items: center !important;
    gap: 12px !important;
    padding: 12px !important;
}

.client-due-card .payment-plan-row > span,
.client-due-card .payment-plan-row > em {
    min-width: 0 !important;
    writing-mode: horizontal-tb !important;
    word-break: normal !important;
    overflow-wrap: break-word !important;
}

.client-due-card .payment-plan-row > em {
    justify-self: end !important;
}

.client-due-card .payment-plan-date,
.client-due-card .payment-date-badge {
    width: max-content !important;
    max-width: 100% !important;
    white-space: nowrap !important;
}

@media (max-width: 900px) {
    .client-due-card .payment-plan {
        grid-template-columns: minmax(0, 1fr) !important;
    }

    .client-due-card .payment-plan-row {
        grid-template-columns: minmax(145px, max-content) minmax(0, 1fr) auto !important;
    }
}

@media (max-width: 560px) {
    .client-due-card .payment-plan-row {
        grid-template-columns: minmax(0, 1fr) !important;
        align-items: start !important;
    }

    .client-due-card .payment-plan-row > em {
        justify-self: start !important;
    }

    .client-due-card .payment-plan-date,
    .client-due-card .payment-date-badge {
        width: auto !important;
        white-space: normal !important;
    }
}

/* Kash mobile repair: keep client/payment controls usable on narrow screens. */
.client-last-method {
    display: inline-flex !important;
    align-items: center !important;
    gap: 6px !important;
    width: fit-content !important;
    max-width: 100% !important;
    padding: 8px 11px !important;
    border-radius: 12px !important;
    background: #f1f5f9 !important;
    color: #334155 !important;
    font-size: 16px !important;
    font-weight: 850 !important;
    line-height: 1.2 !important;
}

@media (max-width: 1100px) {
    .clients-table td[data-label="Acciones"] .cc-actions,
    .clients-results-card .clients-card-table td[data-label="Acciones"] .cc-actions,
    .loan-results-card .cc-table td[data-label="Acciones"] .cc-actions {
        display: flex !important;
        flex-wrap: nowrap !important;
        gap: 8px !important;
        width: 100% !important;
        min-width: 0 !important;
        overflow-x: auto !important;
        overflow-y: hidden !important;
        padding-bottom: 4px !important;
        -webkit-overflow-scrolling: touch !important;
        scrollbar-width: thin !important;
    }

    .clients-table td[data-label="Acciones"] .btn,
    .clients-results-card .clients-card-table td[data-label="Acciones"] .btn,
    .loan-results-card .cc-table td[data-label="Acciones"] .btn {
        flex: 0 0 auto !important;
        width: auto !important;
        max-width: 150px !important;
        min-width: 0 !important;
        min-height: 46px !important;
        padding: 11px 12px !important;
        line-height: 1.15 !important;
        white-space: normal !important;
        overflow: visible !important;
    }

    .clients-table td[data-label="Acciones"] .btn-success,
    .clients-results-card .clients-card-table td[data-label="Acciones"] .btn-success,
    .loan-results-card .cc-table td[data-label="Acciones"] .btn-success {
        grid-column: auto !important;
    }

    .clients-table .payment-date-badge,
    .clients-results-card .payment-date-badge,
    .loan-results-card .payment-date-badge {
        display: inline-flex !important;
        align-items: center !important;
        width: max-content !important;
        max-width: 100% !important;
        gap: 6px !important;
        border-radius: 999px !important;
        white-space: normal !important;
    }
}

@media print {
    .sidebar,
    .topbar,
    .no-print,
    .mobile-overlay {
        display: none !important;
    }

    .main-content {
        margin: 0 !important;
        width: 100% !important;
        padding: 0 !important;
        background: #fff !important;
    }

    .cc-wrap {
        width: 100% !important;
        padding: 0 !important;
    }

    .cc-card,
    .receipt-card {
        box-shadow: none !important;
        border: 1px solid #d1d5db !important;
        border-radius: 0 !important;
    }
}
/* =========================================================
   CREAR / REGISTRAR PRESTAMO - FORMULARIOS Y PREVIEW
========================================================= */

.form-grid-2 {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.form-grid-full {
    grid-column: 1 / -1;
}

.loan-preview {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    padding: 22px;
    margin: 22px 0;
}

.loan-preview h3 {
    font-size: 18px;
    margin-bottom: 16px;
    color: #0f172a;
}

.loan-preview-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}

.loan-preview-item {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    padding: 16px;
}

.loan-preview-item span {
    display: block;
    color: #64748b;
    font-size: 13px;
    font-weight: 800;
    margin-bottom: 6px;
}

.loan-preview-item strong {
    display: block;
    color: #0f172a;
    font-size: 17px;
    font-weight: 900;
    word-break: break-word;
}

.stat-value-small {
    font-size: 20px !important;
    line-height: 1.2;
}

.payment-preview {
    margin-top: 20px;
}

@media (max-width: 900px) {
    .loan-preview-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 768px) {
    .form-grid-2,
    .loan-preview-grid {
        grid-template-columns: 1fr;
    }
}

/* =========================================================
   KASH UI POLISH 2026
   Capa final para escritorio, tablet y celular
========================================================= */

:root {
    --cc-bg: #eef3f8;
    --cc-surface: #ffffff;
    --cc-surface-soft: #f8fafc;
    --cc-border: #dbe3ee;
    --cc-text: #0b1220;
    --cc-muted: #5c6f8a;
    --cc-primary: #2563eb;
    --cc-primary-dark: #1d4ed8;
    --cc-sidebar: #1d357a;
    --cc-sidebar-dark: #17285f;
    --cc-accent: #22c55e;
    --cc-shadow: 0 18px 42px rgba(15, 23, 42, 0.08);
}

html {
    background: var(--cc-bg);
}

body {
    background:
        linear-gradient(180deg, rgba(255,255,255,.72), rgba(238,243,248,.96) 260px),
        var(--cc-bg);
    color: var(--cc-text);
    font-size: 16px;
    line-height: 1.45;
}

.dashboard-container {
    background: transparent;
}

.sidebar {
    width: 278px;
    min-width: 278px;
    background: linear-gradient(180deg, var(--cc-sidebar), var(--cc-sidebar-dark));
    box-shadow: 18px 0 40px rgba(15, 23, 42, 0.08);
}

.sidebar-brand {
    min-height: 118px;
    padding: 28px 26px 24px;
    gap: 12px;
    flex-wrap: wrap;
}

.sidebar-brand strong {
    font-size: 30px;
    letter-spacing: 0;
}

.sidebar-brand span {
    margin-top: 2px;
    color: #dbeafe;
    font-weight: 800;
}

.sidebar-menu {
    padding: 12px 0;
}

.sidebar-menu a {
    min-height: 56px;
    padding: 14px 26px;
    font-size: 17px;
    border-left-width: 5px;
}

.sidebar-menu a:hover,
.sidebar-menu a.active {
    background: rgba(37, 99, 235, 0.62);
    border-left-color: var(--cc-accent);
}

.sidebar-user {
    padding: 20px 26px;
}

.sidebar-user strong,
.sidebar-user span {
    word-break: break-word;
}

.main-content {
    margin-left: 278px;
    width: calc(100% - 278px);
    padding: 34px 36px 44px;
    background: transparent;
}

.topbar {
    width: min(100%, 1400px);
    margin: 0 auto 26px;
    min-height: 58px;
    gap: 14px;
}

.topbar-title {
    flex: 1;
    min-width: 0;
}

.topbar-title strong {
    display: block;
    font-size: 22px;
    line-height: 1.2;
    color: var(--cc-text);
}

.topbar-title span {
    display: block;
    margin-top: 4px;
    color: var(--cc-muted);
    font-size: 13px;
    font-weight: 800;
    line-height: 1.25;
}

.topbar-date {
    color: var(--cc-text);
    font-weight: 800;
    white-space: nowrap;
    background: rgba(255, 255, 255, 0.7);
    border: 1px solid rgba(219, 227, 238, 0.9);
    border-radius: 12px;
    padding: 10px 14px;
}

.monthly-pill {
    display: inline-flex;
    flex-direction: column;
    justify-content: center;
    min-height: 46px;
    max-width: 240px;
    border-radius: 14px;
    padding: 8px 14px;
    border: 1px solid transparent;
    font-weight: 900;
    line-height: 1.15;
}

.monthly-pill span {
    font-size: 14px;
    white-space: nowrap;
}

.monthly-pill small {
    margin-top: 3px;
    font-size: 12px;
    font-weight: 800;
    opacity: .78;
}

.monthly-pill-ok {
    background: #dcfce7;
    border-color: #bbf7d0;
    color: #14532d;
}

.monthly-pill-warn {
    background: #fef3c7;
    border-color: #fde68a;
    color: #92400e;
}

.monthly-calendar {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-height: 54px;
    max-width: 310px;
    border-radius: 16px;
    padding: 8px 12px 8px 8px;
    border: 1px solid transparent;
    color: #0f172a;
    cursor: pointer;
    font-family: inherit;
    text-align: left;
}

.monthly-dropdown {
    position: relative;
}

.topbar-extra {
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.monthly-popover {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    width: 314px;
    padding: 16px;
    border-radius: 18px;
    border: 1px solid #dbe3ee;
    background: #ffffff;
    box-shadow: 0 24px 55px rgba(15, 23, 42, .16);
    opacity: 0;
    pointer-events: none;
    transform: translateY(-6px);
    transition: .18s ease;
    z-index: 80;
}

.monthly-popover-wide {
    width: 360px;
}

.monthly-open .monthly-popover {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

.monthly-popover-head {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: baseline;
    margin-bottom: 12px;
}

.monthly-popover-head strong {
    font-size: 16px;
}

.monthly-popover-head span,
.monthly-popover-foot,
.monthly-popover-empty {
    color: #64748b;
    font-size: 12px;
    font-weight: 800;
}

.monthly-weekdays,
.monthly-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 6px;
}

.monthly-weekdays {
    margin-bottom: 7px;
}

.monthly-weekdays span {
    text-align: center;
    color: #64748b;
    font-size: 11px;
    font-weight: 900;
}

.monthly-day {
    height: 34px;
    border-radius: 10px;
    display: grid;
    place-items: center;
    font-size: 13px;
    font-weight: 900;
    background: #f1f5f9;
    color: #475569;
    position: relative;
}

.monthly-day small {
    position: absolute;
    right: 4px;
    bottom: 3px;
    min-width: 15px;
    height: 15px;
    border-radius: 999px;
    display: grid;
    place-items: center;
    background: rgba(255,255,255,.86);
    color: inherit;
    font-size: 9px;
    line-height: 1;
}

.monthly-day-blank {
    background: transparent;
}

.monthly-day-active {
    background: #dcfce7;
    color: #166534;
}

.monthly-day-expire {
    background: #fee2e2;
    color: #991b1b;
    box-shadow: inset 0 0 0 2px #ef4444;
}

.monthly-day-off {
    background: #f1f5f9;
    color: #94a3b8;
}

.monthly-legend {
    display: flex;
    gap: 14px;
    margin: 12px 0 8px;
}

.monthly-legend span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #475569;
    font-size: 12px;
    font-weight: 900;
}

.monthly-legend i {
    width: 11px;
    height: 11px;
    border-radius: 999px;
    display: inline-block;
}

.legend-active {
    background: #22c55e;
}

.legend-expire {
    background: #ef4444;
}

.expire-list {
    display: grid;
    gap: 8px;
    margin-top: 10px;
    max-height: 150px;
    overflow: auto;
}

.expire-list-row {
    display: grid;
    grid-template-columns: 34px 1fr;
    gap: 9px;
    align-items: start;
    padding: 9px;
    border-radius: 12px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
}

.expire-list-row strong {
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    border-radius: 10px;
    background: #fee2e2;
    color: #991b1b;
}

.expire-list-row span {
    color: #0f172a;
    font-size: 13px;
    font-weight: 800;
    line-height: 1.35;
}

.monthly-calendar-icon {
    width: 42px;
    min-width: 42px;
    height: 42px;
    border-radius: 12px;
    background: rgba(255,255,255,.68);
    display: grid;
    place-items: center;
    overflow: hidden;
    box-shadow: inset 0 0 0 1px rgba(15,23,42,.06);
}

.monthly-calendar-icon span {
    width: 100%;
    padding: 2px 0;
    background: #2563eb;
    color: #ffffff;
    font-size: 9px;
    line-height: 1;
    text-align: center;
    font-weight: 900;
}

.monthly-calendar-icon strong {
    font-size: 17px;
    line-height: 1;
    font-weight: 900;
}

.monthly-calendar-copy {
    min-width: 0;
}

.monthly-calendar-copy span {
    display: block;
    font-size: 14px;
    font-weight: 900;
    white-space: nowrap;
}

.monthly-calendar-copy small {
    display: block;
    margin-top: 3px;
    color: currentColor;
    font-size: 12px;
    font-weight: 800;
    opacity: .76;
    white-space: nowrap;
}

.notify-pill {
    display: grid;
    grid-template-columns: auto auto;
    column-gap: 10px;
    row-gap: 2px;
    align-items: center;
    max-width: 330px;
    min-height: 54px;
    padding: 9px 14px;
    border-radius: 16px;
    border: 1px solid transparent;
    text-decoration: none;
}

.notify-pill span {
    color: inherit;
    font-size: 13px;
    font-weight: 900;
}

.notify-pill strong {
    min-width: 30px;
    height: 30px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    justify-self: end;
    background: rgba(255,255,255,.7);
    color: inherit;
    font-size: 15px;
    font-weight: 900;
}

.notify-pill small {
    grid-column: 1 / -1;
    color: inherit;
    font-size: 12px;
    font-weight: 800;
    opacity: .76;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.notify-pill-ok {
    background: #dcfce7;
    border-color: #bbf7d0;
    color: #14532d;
}

.notify-pill-warn {
    background: #fef3c7;
    border-color: #fde68a;
    color: #92400e;
}

.menu-button {
    display: none;
    width: 44px;
    min-width: 44px;
    height: 44px;
    border-radius: 12px;
    border: 1px solid var(--cc-border);
    background: var(--cc-surface);
    color: var(--cc-primary);
    font-size: 22px;
    box-shadow: none;
}

.cc-wrap,
.dashboard-header,
.stats-grid,
.dashboard-bottom,
.top-actions,
.top-bar {
    width: min(100%, 1400px);
    margin-left: auto;
    margin-right: auto;
}

.cc-card,
.panel-card,
.card,
.form-box,
.table-box,
.system-card,
.modern-card,
.stat-card:not(.modern-card) {
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: 18px;
    box-shadow: var(--cc-shadow);
}

.cc-card h2,
.cc-card h3,
.panel-header h3 {
    color: var(--cc-text);
    line-height: 1.2;
}

.cc-grid {
    align-items: stretch;
}

.cc-grid .cc-card {
    margin-bottom: 0;
}

.cc-grid .cc-card .muted:first-child {
    display: block;
    margin-bottom: 6px;
    color: #536987;
    font-weight: 700;
}

.cc-grid .cc-card h2,
.stat-value {
    font-size: 30px;
    line-height: 1.12;
    letter-spacing: 0;
}

.form-grid {
    align-items: start;
}

.form-group {
    margin-bottom: 0;
}

.form-group label {
    font-size: 14px;
    line-height: 1.2;
}

.form-group input,
.form-group select,
.form-group textarea {
    box-shadow: inset 0 1px 0 rgba(15, 23, 42, 0.02);
}

.form-group textarea {
    line-height: 1.45;
}

.btn,
button.btn,
a.btn,
.btn-primary,
button.btn-primary,
a.btn-primary,
.btn-outline,
a.btn-outline,
button.btn-outline {
    border-radius: 12px;
    min-height: 44px;
    padding: 11px 18px;
    font-size: 15px;
}

.btn-primary,
button.btn-primary,
a.btn-primary,
.btn,
button.btn,
a.btn {
    background: var(--cc-primary);
    border-color: var(--cc-primary);
}

.btn:hover,
.btn-primary:hover {
    background: var(--cc-primary-dark);
    border-color: var(--cc-primary-dark);
    transform: translateY(-1px);
}

.btn-secondary,
a.btn-secondary,
button.btn-secondary {
    background: #e8eef7;
    color: var(--cc-text);
    border-color: #e8eef7;
    box-shadow: none;
}

.btn-success,
a.btn-success,
button.btn-success {
    background: #16a34a;
    border-color: #16a34a;
}

.cc-actions {
    align-items: center;
}

.cc-table {
    overflow: hidden;
    border-radius: 12px;
}

.cc-table th {
    color: var(--cc-text);
    font-weight: 900;
}

.cc-table td {
    color: var(--cc-text);
}

.cc-table tr:hover td,
.data-table tr:hover,
.table-box tr:hover,
.card tr:hover,
.system-card tr:hover {
    background: #f8fbff;
}

.badge {
    letter-spacing: 0;
}

.filters-form {
    align-items: end;
}

@media (min-width: 1181px) {
    .cc-card > form .form-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

@media (max-width: 1180px) {
    .main-content {
        padding: 28px 24px 38px;
    }

    .cc-wrap {
        padding: 22px 0;
    }

    .sidebar {
        width: 250px;
        min-width: 250px;
    }

    .main-content {
        margin-left: 250px;
        width: calc(100% - 250px);
    }
}

@media (max-width: 900px) {
    .menu-button {
        display: inline-flex;
    }

    .dashboard-container {
        display: block;
    }

    .sidebar {
        position: fixed;
        width: 286px;
        min-width: 286px;
        height: 100vh;
        left: -292px;
        top: 0;
        bottom: 0;
        z-index: 1000;
        transition: left .24s ease;
    }

    .sidebar.sidebar-open {
        left: 0;
    }

    .mobile-overlay.mobile-overlay-active {
        display: block;
    }

    .main-content {
        margin-left: 0;
        width: 100%;
        padding: 18px;
    }

    .topbar {
        min-height: 52px;
        margin-bottom: 16px;
    }

    .topbar-title strong {
        font-size: 19px;
    }

    .topbar-title span {
        font-size: 12px;
    }

    .topbar-date {
        font-size: 13px;
        padding: 8px 10px;
    }

    .monthly-pill {
        max-width: none;
        flex: 1 1 180px;
    }

    .monthly-calendar,
    .notify-pill {
        flex: 1 1 230px;
        max-width: none;
    }

    .monthly-dropdown {
        flex: 1 1 230px;
    }

    .topbar-extra {
        flex: 1 1 480px;
    }

    .cc-wrap {
        padding: 12px 0 24px;
    }

    .cc-card,
    .panel-card,
    .card,
    .form-box,
    .table-box,
    .system-card {
        padding: 18px;
        border-radius: 14px;
        margin-bottom: 16px;
    }
}

@media (max-width: 640px) {
    body {
        font-size: 15px;
    }

    .main-content {
        padding: 14px;
    }

    .topbar {
        align-items: center;
        gap: 10px;
    }

    .topbar-date {
        max-width: 128px;
        white-space: normal;
        text-align: right;
        line-height: 1.15;
    }

    .monthly-pill {
        order: 3;
        width: 100%;
        max-width: 100%;
    }

    .monthly-pill span {
        white-space: normal;
    }

    .monthly-calendar,
    .notify-pill {
        order: 3;
        width: 100%;
        max-width: 100%;
    }

    .monthly-dropdown {
        order: 3;
        width: 100%;
    }

    .topbar-extra {
        order: 3;
        width: 100%;
        display: grid;
        grid-template-columns: 1fr;
    }

    .monthly-popover {
        width: min(100%, 330px);
        left: 0;
        right: auto;
    }

    .monthly-popover-wide {
        width: min(100%, 360px);
    }

    .monthly-calendar-copy span,
    .monthly-calendar-copy small,
    .notify-pill small {
        white-space: normal;
    }

    .cc-grid,
    .modern-grid,
    .stats-grid:not(.modern-grid) {
        grid-template-columns: 1fr;
        gap: 14px;
    }

    .cc-grid .cc-card h2,
    .stat-value {
        font-size: 26px;
    }

    .form-group input,
    .form-group select,
    .form-group textarea {
        min-height: 48px;
        font-size: 15px;
    }

    .cc-actions {
        display: grid;
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .cc-actions .btn,
    .cc-actions a.btn,
    .cc-actions button.btn,
    .filters-form .btn,
    .filters-form a.btn,
    .filters-form button.btn {
        width: 100%;
    }

    .cc-table {
        border-radius: 0;
    }

    .cc-table tr {
        box-shadow: 0 10px 24px rgba(15,23,42,.06);
    }
}
/* =========================================================
   VER PRESTAMO - DETALLE / CUOTAS / PAGOS
========================================================= */

.loan-detail-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
    margin-top: 18px;
}

.loan-detail-card {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 18px;
    padding: 18px;
    box-shadow: 0 10px 25px rgba(15, 23, 42, 0.06);
}

.loan-detail-card span {
    display: block;
    color: #64748b;
    font-size: 13px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 7px;
}

.loan-detail-card strong {
    display: block;
    color: #0f172a;
    font-size: 18px;
    font-weight: 900;
    word-break: break-word;
}

.loan-progress-box {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 18px;
    padding: 18px;
    margin-top: 18px;
}

.loan-progress-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
    font-weight: 900;
    color: #0f172a;
}

.loan-progress-track {
    width: 100%;
    height: 12px;
    border-radius: 999px;
    background: #e5e7eb;
    overflow: hidden;
}

.loan-progress-fill {
    height: 100%;
    border-radius: 999px;
    background: #2563eb;
}

.loan-info-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    margin-top: 16px;
}

.loan-info-item {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    padding: 14px;
}

.loan-info-item span {
    display: block;
    color: #64748b;
    font-size: 13px;
    font-weight: 800;
    margin-bottom: 5px;
}

.loan-info-item strong {
    color: #111827;
    font-size: 15px;
    font-weight: 900;
    word-break: break-word;
}

.section-gap {
    margin-top: 22px;
}

.text-muted-small {
    color: #64748b;
    font-size: 13px;
    font-weight: 700;
}

@media (max-width: 1100px) {
    .loan-detail-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 768px) {
    .loan-detail-grid,
    .loan-info-list {
        grid-template-columns: 1fr;
    }

    .loan-progress-info {
        align-items: flex-start;
        flex-direction: column;
    }
}

/* Capa final EOF: mantiene Salir accesible y el menu desplazable. */
.sidebar {
    height: 100vh !important;
    max-height: 100vh !important;
    overflow: hidden !important;
}

.sidebar-brand {
    flex: 0 0 auto;
}

.sidebar-menu {
    flex: 1 1 auto !important;
    min-height: 0;
    overflow-y: auto !important;
    overscroll-behavior: contain;
    padding: 8px 0 10px !important;
    scrollbar-width: none;
}

.sidebar-menu::-webkit-scrollbar {
    width: 0;
    height: 0;
}

.sidebar-menu a {
    min-height: 52px !important;
    padding-top: 12px !important;
    padding-bottom: 12px !important;
}

.sidebar-footer {
    flex: 0 0 auto;
    padding: 14px 20px 18px;
    border-top: 1px solid rgba(255, 255, 255, 0.16);
    background: linear-gradient(180deg, rgba(23, 40, 95, 0.92), rgba(15, 31, 76, 0.98));
}

.sidebar-contact {
    display: grid;
    gap: 3px;
    margin-bottom: 12px;
    padding: 12px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.09);
    border: 1px solid rgba(255, 255, 255, 0.14);
}

.sidebar-contact span,
.sidebar-contact small {
    color: #bfdbfe;
    font-size: 12px;
    font-weight: 900;
}

.sidebar-contact a {
    color: #ffffff;
    font-size: 13px;
    font-weight: 900;
    line-height: 1.25;
    overflow-wrap: anywhere;
}

.sidebar-logout {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 46px;
    width: 100%;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.12);
    color: #ffffff;
    font-weight: 900;
    border: 1px solid rgba(255, 255, 255, 0.18);
}

.sidebar-logout:hover {
    background: #fee2e2;
    color: #991b1b;
}

.sidebar-footer .sidebar-user {
    margin-top: 12px !important;
    padding: 12px 4px 0 !important;
    border-top: 0 !important;
}

.report-filter-grid,
.payment-form-grid {
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)) !important;
}

.dashboard-section {
    width: 100%;
    margin: 22px 0;
}

.monthly-main-card .section-head p:not(.monthly-cut-note) {
    display: none;
}

.cutday-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 12px;
}

.cutday-pill {
    display: grid;
    gap: 5px;
    min-height: 112px;
    padding: 14px;
    border: 1px solid #dbe3ee;
    border-left: 5px solid #2563eb;
    border-radius: 14px;
    background: #f8fafc;
    color: #0f172a;
    text-decoration: none;
}

.cutday-pill:hover,
.cutday-pill-active {
    border-left-color: #16a34a;
    background: #f0fdf4;
}

.cutday-pill strong {
    font-size: 18px;
    font-weight: 950;
}

.cutday-pill span,
.cutday-pill small,
.cutday-pill em {
    color: #475569;
    font-size: 13px;
    font-style: normal;
    font-weight: 850;
    line-height: 1.35;
}

.cutday-pill small {
    color: #166534;
}

.monthly-adjust {
    width: 100%;
}

.monthly-adjust summary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 11px 18px;
    border-radius: 12px;
    background: #e2e8f0;
    color: #0f172a;
    font-weight: 900;
    cursor: pointer;
    list-style: none;
}

.monthly-adjust summary::-webkit-details-marker {
    display: none;
}

.monthly-adjust[open] summary {
    background: #dbeafe;
    color: #1d4ed8;
}

.monthly-adjust-form {
    display: grid;
    grid-template-columns: repeat(2, minmax(150px, 1fr));
    gap: 10px;
    width: min(520px, 100%);
    margin-top: 10px;
    padding: 12px;
    border: 1px solid #dbe3ee;
    border-radius: 14px;
    background: #f8fafc;
}

.monthly-adjust-form label {
    display: grid;
    gap: 6px;
    color: #475569;
    font-size: 12px;
    font-weight: 900;
}

.monthly-adjust-form input,
.monthly-adjust-form select {
    min-height: 42px;
    border: 1px solid #cbd5e1;
    border-radius: 11px;
    padding: 9px 11px;
    color: #0f172a;
    background: #ffffff;
}

.monthly-adjust-form .btn {
    grid-column: 1 / -1;
}

/* Marca Kash */
.brand-logo {
    width: 72px;
    height: 52px;
    flex: 0 0 auto;
    border-radius: 14px;
    object-fit: cover;
    background: #ffffff;
    box-shadow: 0 14px 28px rgba(15, 76, 92, 0.2);
}

.brand-copy {
    min-width: 0;
}

.sidebar-brand .brand-copy strong {
    font-size: 30px;
    letter-spacing: 0;
}

.sidebar-brand .brand-copy span {
    font-size: 13px;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

@media (max-width: 900px) {
    .brand-logo {
        width: 66px;
        height: 48px;
        border-radius: 13px;
    }

    .sidebar-brand .brand-copy strong {
        font-size: 24px;
    }

    .monthly-adjust summary,
    .monthly-adjust-form {
        width: 100%;
    }

    .monthly-adjust-form {
        grid-template-columns: 1fr;
    }

    .cutday-list {
        grid-template-columns: 1fr;
    }
}

.dashboard-section > h3 {
    margin: 0 0 6px;
    color: var(--cc-text);
}

.dashboard-section > .muted {
    display: block;
    margin-bottom: 14px;
}

.topbar {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    flex-wrap: wrap;
    gap: 14px !important;
    padding: 14px 16px !important;
    border: 1px solid rgba(219, 227, 238, 0.92);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.82);
    box-shadow: 0 18px 42px rgba(15, 23, 42, 0.08);
    backdrop-filter: blur(10px);
}

.topbar-title {
    display: grid;
    gap: 3px;
}

.topbar-title strong {
    letter-spacing: 0;
}

.topbar-clock {
    display: grid;
    gap: 2px;
    min-width: 190px;
    color: var(--cc-text);
    text-align: right;
    background: linear-gradient(180deg, #ffffff, #f8fafc);
    border: 1px solid rgba(203, 213, 225, 0.95);
    border-radius: 14px;
    padding: 9px 13px;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.06);
}

.topbar-clock span {
    color: var(--cc-muted);
    font-size: 11px;
    font-weight: 900;
    line-height: 1;
    text-transform: uppercase;
}

.topbar-clock strong {
    color: var(--cc-text);
    font-size: 16px;
    font-weight: 950;
    line-height: 1.2;
    white-space: nowrap;
}

.client-due-card {
    padding: 0 !important;
    overflow: hidden;
    border-color: rgba(37, 99, 235, 0.14) !important;
}

.client-due-overdue {
    border-color: #fca5a5 !important;
    background: linear-gradient(180deg, #ffffff, #fef2f2);
}

.client-due-today {
    border-color: #fde68a !important;
    background: linear-gradient(180deg, #ffffff, #fffbeb);
}

.client-due-upcoming {
    border-color: #bbf7d0 !important;
    background: linear-gradient(180deg, #ffffff, #f0fdf4);
}

.client-due-card[open] {
    border-color: rgba(37, 99, 235, 0.42) !important;
    box-shadow: 0 20px 48px rgba(37, 99, 235, 0.12);
}

.client-due-overdue[open] {
    border-color: #ef4444 !important;
    box-shadow: 0 20px 48px rgba(239, 68, 68, 0.14);
}

.client-due-today[open] {
    border-color: #f59e0b !important;
    box-shadow: 0 20px 48px rgba(245, 158, 11, 0.14);
}

.client-due-upcoming[open] {
    border-color: #22c55e !important;
    box-shadow: 0 20px 48px rgba(34, 197, 94, 0.12);
}

.client-due-summary {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 6px 14px;
    align-items: center;
    min-height: 112px;
    padding: 22px 24px;
    cursor: pointer;
    list-style: none;
}

.client-due-summary::-webkit-details-marker {
    display: none;
}

.client-due-summary::after {
    content: "Abrir detalles";
    grid-column: 2;
    grid-row: 1 / span 2;
    align-self: center;
    padding: 8px 11px;
    border-radius: 999px;
    background: #e2e8f0;
    color: #0f172a;
    font-size: 12px;
    font-weight: 900;
}

.client-due-card[open] .client-due-summary::after {
    content: "Cerrar";
    background: #dbeafe;
    color: #1d4ed8;
}

.client-due-kicker {
    font-size: 12px;
    font-weight: 950;
    text-transform: uppercase;
}

.client-due-overdue .client-due-kicker {
    color: #dc2626;
}

.client-due-today .client-due-kicker {
    color: #b45309;
}

.client-due-upcoming .client-due-kicker {
    color: #15803d;
}

.client-due-summary strong {
    color: var(--cc-text);
    font-size: 20px;
    line-height: 1.15;
}

.client-due-summary span:not(.client-due-kicker) {
    color: var(--cc-muted);
    font-size: 14px;
    font-weight: 800;
}

.client-due-summary em {
    grid-column: 1 / -1;
    color: #16a34a;
    font-style: normal;
    font-size: 18px;
    font-weight: 950;
}

.client-due-next {
    grid-column: 1 / -1;
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    color: #475569 !important;
    font-size: 14px !important;
    font-weight: 900 !important;
}

.client-due-overdue .client-due-summary em {
    color: #dc2626;
}

.client-due-today .client-due-summary em {
    color: #b45309;
}

.client-due-body {
    border-top: 1px solid #e5e7eb;
    padding: 20px 24px 24px;
    background: #fbfdff;
}

.client-due-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.client-due-grid div {
    min-width: 0;
    padding: 12px;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    background: #ffffff;
}

.client-due-grid span {
    display: block;
    margin-bottom: 5px;
    color: var(--cc-muted);
    font-size: 12px;
    font-weight: 900;
}

.client-due-grid strong {
    display: block;
    color: var(--cc-text);
    font-size: 14px;
    line-height: 1.25;
    word-break: break-word;
}

.client-due-actions {
    margin-top: 16px !important;
}

.client-due-summary-with-actions::after {
    display: none !important;
}

.client-due-summary-with-actions > em {
    grid-column: 1 !important;
}

.client-due-summary-controls {
    grid-column: 2 !important;
    grid-row: 1 / span 4 !important;
    display: grid !important;
    grid-template-columns: minmax(120px, 1fr) !important;
    gap: 8px !important;
    align-self: center !important;
    min-width: 132px !important;
    margin: 0 !important;
}

.client-due-toggle-label,
.client-due-quick-pay {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 100% !important;
    min-height: 42px !important;
    border-radius: 12px !important;
    text-align: center !important;
    writing-mode: horizontal-tb !important;
    word-break: normal !important;
}

.client-due-toggle-label {
    padding: 9px 11px !important;
    background: #e2e8f0 !important;
    color: #0f172a !important;
    font-size: 12px !important;
    font-weight: 950 !important;
}

.client-due-toggle-label::before {
    content: "Abrir detalles";
}

.client-due-card[open] .client-due-toggle-label {
    background: #dbeafe !important;
    color: #1d4ed8 !important;
}

.client-due-card[open] .client-due-toggle-label::before {
    content: "Cerrar detalles";
}

.client-due-quick-pay {
    padding: 10px 12px !important;
    color: #fff !important;
    font-size: 14px !important;
    font-weight: 950 !important;
    line-height: 1.1 !important;
}

@media (max-width: 760px) {
    .client-due-summary-with-actions {
        grid-template-columns: minmax(0, 1fr) !important;
    }

    .client-due-summary-with-actions > em {
        grid-column: 1 !important;
    }

    .client-due-summary-controls {
        grid-column: 1 !important;
        grid-row: auto !important;
        width: 100% !important;
        min-width: 0 !important;
        margin-top: 8px !important;
    }
}

.client-account-hero {
    display: grid;
    grid-template-columns: minmax(230px, .9fr) minmax(0, 1.6fr);
    gap: 22px;
    align-items: start;
}

.client-kicker {
    display: inline-flex;
    margin-bottom: 8px;
    color: var(--cc-primary);
    font-size: 12px;
    font-weight: 950;
    text-transform: uppercase;
}

.client-account-hero h2 {
    margin: 0 0 8px;
    color: var(--cc-text);
    font-size: 28px;
    line-height: 1.15;
}

.client-profile-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.client-profile-grid div {
    min-width: 0;
    padding: 12px 14px;
    border-left: 4px solid rgba(37, 99, 235, .24);
    border-radius: 10px;
    background: #f8fafc;
}

.client-profile-grid span {
    display: block;
    margin-bottom: 5px;
    color: var(--cc-muted);
    font-size: 12px;
    font-weight: 900;
}

.client-profile-grid strong {
    display: block;
    color: var(--cc-text);
    font-size: 14px;
    line-height: 1.25;
    word-break: break-word;
}

.client-account-loan .client-due-summary {
    min-height: 124px;
}

.dashboard-filter-card {
    padding: 18px 20px !important;
}

.dashboard-filter-form {
    display: grid;
    grid-template-columns: minmax(220px, 360px) auto;
    gap: 12px;
    align-items: end;
}

.dashboard-filter-form .form-group {
    margin-bottom: 0;
}

@media (max-width: 760px) {
    .business-health-grid,
    .smart-dashboard-grid,
    .offline-dashboard-grid {
        grid-template-columns: 1fr;
    }

    .health-score-card {
        min-height: 132px;
    }

    .health-score-card strong {
        font-size: 34px;
    }

    .risk-client-row {
        grid-template-columns: 1fr;
        align-items: start;
    }

    .risk-client-row em,
    .risk-client-row b {
        width: fit-content;
        white-space: normal;
    }

    .client-score-card,
    .client-score-details {
        grid-template-columns: 1fr;
    }

    .client-score-pill {
        width: 100%;
    }

    .client-score-main strong {
        font-size: 36px;
    }

    .topbar {
        padding: 12px !important;
    }

    .topbar-clock {
        width: 100%;
        min-width: 0;
        text-align: left;
    }

    .client-due-summary {
        grid-template-columns: 1fr;
        min-height: auto;
        padding: 18px;
    }

    .client-due-summary::after {
        grid-column: 1;
        grid-row: auto;
        width: fit-content;
    }

    .client-due-body {
        padding: 16px 18px 18px;
    }

    .client-due-grid {
        grid-template-columns: 1fr;
    }

    .dashboard-filter-form {
        grid-template-columns: 1fr;
    }

    .client-account-hero,
    .client-profile-grid {
        grid-template-columns: 1fr;
    }
}

/* =========================================================
   CAPA UX FINAL - NAVEGACION, TABLAS Y FORMULARIOS
========================================================= */

html {
    scroll-behavior: smooth;
}

a,
button,
input,
select,
textarea,
summary {
    -webkit-tap-highlight-color: rgba(37, 99, 235, 0.16);
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible {
    outline: 3px solid rgba(37, 99, 235, 0.34);
    outline-offset: 3px;
}

button:disabled,
.btn:disabled {
    cursor: wait;
    opacity: 0.76;
    transform: none !important;
}

.sidebar-menu a[aria-current="page"] {
    box-shadow: inset 4px 0 0 var(--cc-accent);
}

.cc-card > h2:first-child,
.cc-card > h3:first-child,
.panel-card > h2:first-child,
.panel-card > h3:first-child {
    margin-top: 0;
}

.cc-card > h3:first-child + .cc-actions,
.cc-card > h2:first-child + .cc-actions {
    margin-top: 12px;
}

.cc-card > .cc-actions:first-child {
    margin-top: 0;
    margin-bottom: 18px;
}

.cc-actions .btn,
.cc-actions a.btn,
.cc-actions button.btn {
    min-width: 132px;
}

.cc-table,
.data-table {
    border: 1px solid #e5e7eb;
}

.cc-table tbody tr,
.data-table tbody tr {
    transition: background 0.16s ease, box-shadow 0.16s ease;
}

.cc-table td,
.data-table td {
    line-height: 1.45;
}

.cc-table td .cc-actions,
.data-table td .cc-actions,
.cc-table td .table-actions,
.data-table td .table-actions {
    margin-top: 0;
}

.cc-table td[colspan],
.data-table td[colspan] {
    padding: 24px;
    color: var(--cc-muted);
    font-weight: 800;
    text-align: center;
    background: #f8fafc;
}

.stat-card-positive {
    border-color: rgba(22, 163, 74, 0.26) !important;
    background: linear-gradient(180deg, #ffffff, #f0fdf4);
}

.stat-card-focus {
    border-color: rgba(37, 99, 235, 0.26) !important;
    background: linear-gradient(180deg, #ffffff, #eff6ff);
}

.stat-card-danger {
    border-color: rgba(220, 38, 38, 0.3) !important;
    background: linear-gradient(180deg, #ffffff, #fef2f2);
}

.stat-card-warning {
    border-color: rgba(245, 158, 11, 0.3) !important;
    background: linear-gradient(180deg, #ffffff, #fffbeb);
}

.business-health-grid {
    display: grid;
    grid-template-columns: 1.05fr repeat(4, minmax(180px, 1fr));
    gap: 14px;
    align-items: stretch;
}

.health-score-card {
    display: grid;
    align-content: center;
    gap: 8px;
    min-height: 148px;
    border-left: 6px solid #2563eb !important;
}

.health-score-card span {
    color: var(--cc-muted);
    font-size: 12px;
    font-weight: 950;
    text-transform: uppercase;
}

.health-score-card strong {
    color: var(--cc-text);
    font-size: 42px;
    font-weight: 950;
    line-height: 1;
}

.health-score-card em {
    width: fit-content;
    border-radius: 999px;
    padding: 6px 10px;
    background: #eff6ff;
    color: #1d4ed8;
    font-size: 12px;
    font-style: normal;
    font-weight: 950;
}

.health-sano {
    border-left-color: #16a34a !important;
    background: linear-gradient(180deg, #ffffff, #f0fdf4);
}

.health-sano em {
    background: #dcfce7;
    color: #166534;
}

.health-observar {
    border-left-color: #f59e0b !important;
    background: linear-gradient(180deg, #ffffff, #fffbeb);
}

.health-observar em {
    background: #fef3c7;
    color: #92400e;
}

.health-alerta {
    border-left-color: #dc2626 !important;
    background: linear-gradient(180deg, #ffffff, #fef2f2);
}

.health-alerta em {
    background: #fee2e2;
    color: #991b1b;
}

.smart-dashboard-grid {
    display: grid;
    grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr);
    gap: 16px;
    margin: 18px 0;
}

.smart-alert-list,
.risk-client-list {
    display: grid;
    gap: 10px;
}

.smart-alert {
    display: grid;
    gap: 4px;
    padding: 12px 14px;
    border: 1px solid #e2e8f0;
    border-left-width: 5px;
    border-radius: 14px;
    background: #f8fafc;
}

.smart-alert strong {
    color: var(--cc-text);
    font-size: 14px;
    font-weight: 950;
}

.smart-alert span {
    color: #475569;
    font-size: 13px;
    font-weight: 800;
    line-height: 1.35;
}

.smart-alert-success {
    border-left-color: #16a34a;
    background: #f0fdf4;
}

.smart-alert-warning {
    border-left-color: #f59e0b;
    background: #fffbeb;
}

.smart-alert-danger {
    border-left-color: #dc2626;
    background: #fef2f2;
}

.overdue-buckets {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.overdue-buckets span {
    border-radius: 999px;
    background: #f1f5f9;
    color: #475569;
    padding: 7px 10px;
    font-size: 12px;
    font-weight: 900;
}

.overdue-buckets strong {
    color: var(--cc-text);
}

.risk-client-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    gap: 10px;
    align-items: center;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    background: #ffffff;
    color: var(--cc-text);
    padding: 12px;
    text-decoration: none;
}

.risk-client-row:hover {
    border-color: #93c5fd;
    background: #eff6ff;
}

.risk-client-row span,
.risk-client-row small {
    min-width: 0;
}

.risk-client-row strong,
.risk-client-row small {
    display: block;
}

.risk-client-row strong {
    font-size: 14px;
    font-weight: 950;
}

.risk-client-row small {
    margin-top: 3px;
    color: var(--cc-muted);
    font-size: 12px;
    font-weight: 800;
    overflow-wrap: anywhere;
}

.risk-client-row em {
    border-radius: 999px;
    background: #fee2e2;
    color: #991b1b;
    padding: 6px 9px;
    font-size: 12px;
    font-style: normal;
    font-weight: 950;
    white-space: nowrap;
}

.risk-client-row b {
    color: #991b1b;
    font-size: 13px;
    font-weight: 950;
    white-space: nowrap;
}

.client-score-pill {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 2px 8px;
    align-items: center;
    width: min(100%, 190px);
    border: 1px solid #e2e8f0;
    border-left: 5px solid #64748b;
    border-radius: 13px;
    background: #f8fafc;
    padding: 9px 10px;
}

.client-score-pill strong {
    grid-row: 1 / span 2;
    color: var(--cc-text);
    font-size: 24px;
    font-weight: 950;
    line-height: 1;
}

.client-score-pill span {
    color: var(--cc-text);
    font-size: 13px;
    font-weight: 950;
    line-height: 1.1;
}

.client-score-pill small {
    color: var(--cc-muted);
    font-size: 11px;
    font-weight: 800;
    line-height: 1.25;
}

.client-score-good {
    border-left-color: #16a34a;
    background: #f0fdf4;
}

.client-score-watch {
    border-left-color: #f59e0b;
    background: #fffbeb;
}

.client-score-risk,
.client-score-critical {
    border-left-color: #dc2626;
    background: #fef2f2;
}

.client-score-state {
    margin-top: 8px;
}

.client-score-card {
    display: grid;
    grid-template-columns: minmax(210px, 0.72fr) minmax(0, 1.28fr);
    gap: 16px;
    align-items: stretch;
}

.client-score-main {
    display: grid;
    gap: 12px;
    border-left: 6px solid #64748b;
    border-radius: 14px;
    background: #f8fafc;
    padding: 16px;
}

.client-score-main span {
    display: block;
    color: var(--cc-muted);
    font-size: 12px;
    font-weight: 950;
    text-transform: uppercase;
}

.client-score-main strong {
    display: block;
    color: var(--cc-text);
    font-size: 44px;
    font-weight: 950;
    line-height: 1;
}

.client-score-main em {
    display: inline-flex;
    width: fit-content;
    border-radius: 999px;
    background: #e5e7eb;
    color: #111827;
    padding: 6px 10px;
    font-size: 12px;
    font-style: normal;
    font-weight: 950;
}

.client-score-main p {
    margin: 0;
    color: #475569;
    font-weight: 850;
    line-height: 1.35;
}

.client-score-details {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.client-score-details div {
    min-width: 0;
    border: 1px solid #e2e8f0;
    border-radius: 13px;
    background: #ffffff;
    padding: 12px;
}

.client-score-details span {
    display: block;
    color: var(--cc-muted);
    font-size: 12px;
    font-weight: 900;
}

.client-score-details strong {
    display: block;
    margin-top: 5px;
    color: var(--cc-text);
    font-size: 15px;
    font-weight: 950;
    line-height: 1.2;
    overflow-wrap: normal;
    word-break: normal;
    hyphens: none;
}

.client-score-card-good .client-score-main {
    border-left-color: #16a34a;
    background: #f0fdf4;
}

.client-score-card-watch .client-score-main {
    border-left-color: #f59e0b;
    background: #fffbeb;
}

.client-score-card-risk .client-score-main,
.client-score-card-critical .client-score-main {
    border-left-color: #dc2626;
    background: #fef2f2;
}

.offline-dashboard-card {
    border-color: rgba(37, 99, 235, 0.2) !important;
}

.offline-dashboard-card.offline-dashboard-offline {
    border-color: #fca5a5 !important;
    background: linear-gradient(180deg, #ffffff, #fef2f2);
}

.offline-dashboard-card.offline-dashboard-pending {
    border-color: #fcd34d !important;
}

.offline-dashboard-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.offline-dashboard-grid div {
    min-width: 0;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    background: #f8fafc;
    padding: 12px;
}

.offline-dashboard-grid span {
    display: block;
    color: var(--cc-muted);
    font-size: 12px;
    font-weight: 900;
}

.offline-dashboard-grid strong {
    display: block;
    margin-top: 5px;
    color: var(--cc-text);
    font-size: 18px;
    font-weight: 950;
}

.report-filter-actions,
.payment-form-grid + .cc-actions {
    margin-top: 0;
}

.alert ul {
    margin: 8px 0 0 18px;
}

.alert li + li {
    margin-top: 4px;
}

.payment-plan {
    display: grid;
    grid-template-columns: minmax(220px, 0.9fr) minmax(0, 1.6fr);
    gap: 14px;
    margin-top: 16px;
}

.payment-plan-card {
    min-width: 0;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    background: #f8fafc;
    padding: 16px;
}

.payment-plan-card > span {
    display: block;
    margin-bottom: 7px;
    color: var(--cc-muted);
    font-size: 12px;
    font-weight: 950;
    text-transform: uppercase;
}

.payment-plan-card > strong {
    display: block;
    color: var(--cc-text);
    font-size: 20px;
    font-weight: 950;
    line-height: 1.15;
}

.payment-plan-card small {
    display: block;
    margin-top: 6px;
    color: #475569;
    font-size: 13px;
    font-weight: 800;
    line-height: 1.35;
}

.payment-plan-list {
    display: grid;
    gap: 9px;
    margin-top: 10px;
}

.payment-plan-row {
    display: grid;
    grid-template-columns: minmax(165px, max-content) minmax(0, 1fr) auto;
    gap: 10px;
    align-items: center;
    padding: 10px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    background: #ffffff;
}

.payment-plan-row strong,
.payment-plan-row span {
    color: var(--cc-text);
    font-size: 13px;
    font-weight: 900;
}

.payment-plan-row span {
    color: #475569;
}

.payment-plan-row > span:nth-child(2) {
    min-width: 0;
    line-height: 1.35;
}

.payment-plan-row em {
    justify-self: end;
    border-radius: 999px;
    padding: 6px 9px;
    font-size: 12px;
    font-style: normal;
    font-weight: 950;
    white-space: nowrap;
}

.payment-status-paid {
    background: #dcfce7;
    color: #166534 !important;
    border-color: #bbf7d0;
}

.payment-status-unpaid {
    background: #fee2e2;
    color: #991b1b !important;
    border-color: #fecaca;
}

.payment-status-partial {
    background: #fef3c7;
    color: #92400e !important;
    border-color: #fde68a;
}

.payment-status-neutral {
    background: #f1f5f9;
    color: #475569 !important;
}

.inline-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

.mini-btn {
    min-height: 32px;
    border: 1px solid #cbd5e1;
    border-radius: 999px;
    background: #f8fafc;
    color: var(--cc-text);
    padding: 6px 11px;
    font-size: 12px;
    font-weight: 950;
    cursor: pointer;
}

.mini-btn:hover {
    background: #e8eef7;
}

.payment-live-summary {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin-top: 4px;
}

.payment-live-summary div {
    min-width: 0;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    background: #f8fafc;
    padding: 14px;
}

.payment-live-summary span {
    display: block;
    margin-bottom: 5px;
    color: var(--cc-muted);
    font-size: 12px;
    font-weight: 900;
}

.payment-live-summary strong {
    display: block;
    color: var(--cc-text);
    font-size: 18px;
    font-weight: 950;
}

.payment-live-summary small {
    display: block;
    margin-top: 6px;
    color: var(--cc-muted);
    font-size: 12px;
    font-weight: 800;
    line-height: 1.35;
}

.monthly-prorate-preview {
    margin: 2px 0 6px;
    padding: 12px;
    border: 1px solid rgba(37, 99, 235, 0.22);
    border-radius: 18px;
    background: #eff6ff;
}

.monthly-prorate-preview div {
    border-color: #bfdbfe;
    background: rgba(255, 255, 255, 0.92);
}

.monthly-prorate-preview div:first-child {
    border-color: #bbf7d0;
    background: #ecfdf5;
}

.monthly-prorate-preview div:first-child span,
.monthly-prorate-preview div:first-child strong {
    color: #166534;
}

.monthly-prorate-preview.is-ready div:first-child strong {
    font-size: 20px;
}

.loan-simulator {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin-top: 18px;
    padding: 16px;
    border: 1px solid rgba(37, 99, 235, 0.18);
    border-radius: 16px;
    background: #eff6ff;
}

.loan-simulator div {
    min-width: 0;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.82);
    padding: 12px;
}

.loan-simulator span {
    display: block;
    margin-bottom: 5px;
    color: #1e40af;
    font-size: 12px;
    font-weight: 950;
    text-transform: uppercase;
}

.loan-simulator strong {
    display: block;
    color: var(--cc-text);
    font-size: 17px;
    font-weight: 950;
    line-height: 1.2;
}

.weekday-picker {
    display: flex;
    flex-wrap: wrap;
    gap: 9px;
}

.weekday-option {
    display: inline-flex !important;
    align-items: center;
    gap: 7px;
    min-height: 38px;
    margin: 0 !important;
    padding: 8px 11px;
    border: 1px solid #cbd5e1;
    border-radius: 999px;
    background: #ffffff;
    color: var(--cc-text);
    font-size: 13px !important;
    font-weight: 950 !important;
    cursor: pointer;
}

.weekday-option input {
    width: 16px !important;
    min-height: 16px !important;
    height: 16px;
    margin: 0;
    accent-color: #2563eb;
}

.weekday-option:has(input:checked) {
    border-color: #93c5fd;
    background: #eff6ff;
    color: #1d4ed8;
}

.payment-mini {
    display: grid;
    gap: 5px;
    margin-top: 9px;
    padding: 9px 10px;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    background: #f8fafc;
    color: #475569;
    font-size: 12px;
    font-weight: 800;
    line-height: 1.35;
}

.payment-mini strong {
    color: var(--cc-text);
}

.payment-mini em {
    display: inline-flex;
    align-items: center;
    min-height: 22px;
    padding: 3px 7px;
    border-radius: 999px;
    font-size: 11px;
    font-style: normal;
    font-weight: 950;
}

.quick-filter-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 16px;
}

.quick-filter-row a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    border: 1px solid #cbd5e1;
    border-radius: 999px;
    background: #ffffff;
    color: var(--cc-text);
    padding: 7px 12px;
    font-size: 13px;
    font-weight: 950;
}

.quick-filter-row a:hover {
    background: #eff6ff;
    border-color: #93c5fd;
    color: #1d4ed8;
}

.quick-filter-row a.active {
    background: #2563eb;
    border-color: #2563eb;
    color: #ffffff;
}

@media (min-width: 901px) {
    .sidebar-menu a {
        position: relative;
    }

    .sidebar-menu a:hover {
        transform: translateX(2px);
    }
}

@media (max-width: 640px) {
    .payment-plan {
        grid-template-columns: 1fr;
    }

    .payment-date-badge {
        grid-template-columns: 1fr;
        justify-items: start;
        border-radius: 12px;
        white-space: normal;
    }

    .payment-date-wrap,
    .payment-plan-date {
        width: 100%;
    }

    .payment-plan-row {
        grid-template-columns: 1fr;
        align-items: start;
    }

    .payment-plan-row em {
        justify-self: start;
    }

    .payment-live-summary {
        grid-template-columns: 1fr;
    }

    .loan-simulator {
        grid-template-columns: 1fr;
    }

    .quick-filter-row a {
        flex: 1 1 120px;
    }

    .cc-actions .btn,
    .cc-actions a.btn,
    .cc-actions button.btn {
        min-width: 0;
    }

    .cc-table,
    .data-table {
        border: 0;
    }
}

/* =========================================================
   SISTEMA UNIFICADO DE BOTONES
   Esta capa final mantiene consistencia aun en modulos antiguos.
========================================================= */

.btn,
a.btn,
button.btn,
.btn-primary,
a.btn-primary,
button.btn-primary,
.btn-secondary,
a.btn-secondary,
button.btn-secondary,
.btn-success,
a.btn-success,
button.btn-success,
.btn-warning,
a.btn-warning,
button.btn-warning,
.btn-danger,
a.btn-danger,
button.btn-danger,
.btn-outline,
a.btn-outline,
button.btn-outline {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px !important;
    min-height: 44px !important;
    padding: 11px 17px !important;
    border: 1px solid transparent !important;
    border-radius: 10px !important;
    font-size: 14px !important;
    font-weight: 900 !important;
    line-height: 1.15 !important;
    text-align: center !important;
    text-decoration: none !important;
    white-space: normal !important;
    box-shadow: none !important;
    transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease !important;
}

.btn,
a.btn,
button.btn,
.btn-primary,
a.btn-primary,
button.btn-primary {
    background: #2563eb !important;
    border-color: #2563eb !important;
    color: #ffffff !important;
    box-shadow: 0 7px 16px rgba(37, 99, 235, 0.2) !important;
}

.btn-secondary,
a.btn-secondary,
button.btn-secondary {
    background: #f1f5f9 !important;
    border-color: #cbd5e1 !important;
    color: #1e293b !important;
    box-shadow: none !important;
}

.btn-success,
a.btn-success,
button.btn-success {
    background: #16a34a !important;
    border-color: #16a34a !important;
    color: #ffffff !important;
    box-shadow: 0 7px 16px rgba(22, 163, 74, 0.18) !important;
}

.btn-warning,
a.btn-warning,
button.btn-warning {
    background: #f59e0b !important;
    border-color: #f59e0b !important;
    color: #422006 !important;
    box-shadow: 0 7px 16px rgba(245, 158, 11, 0.18) !important;
}

.btn-danger,
a.btn-danger,
button.btn-danger {
    background: #dc2626 !important;
    border-color: #dc2626 !important;
    color: #ffffff !important;
    box-shadow: 0 7px 16px rgba(220, 38, 38, 0.18) !important;
}

.btn-outline,
a.btn-outline,
button.btn-outline {
    background: #ffffff !important;
    border-color: #2563eb !important;
    color: #1d4ed8 !important;
    box-shadow: none !important;
}

.btn:hover,
a.btn:hover,
button.btn:hover,
.btn-primary:hover,
a.btn-primary:hover,
button.btn-primary:hover {
    background: #1d4ed8 !important;
    border-color: #1d4ed8 !important;
    color: #ffffff !important;
    transform: translateY(-1px) !important;
}

.btn-secondary:hover,
a.btn-secondary:hover,
button.btn-secondary:hover {
    background: #e2e8f0 !important;
    border-color: #94a3b8 !important;
    color: #0f172a !important;
    transform: translateY(-1px) !important;
}

.btn-success:hover,
a.btn-success:hover,
button.btn-success:hover {
    background: #15803d !important;
    border-color: #15803d !important;
    color: #ffffff !important;
    transform: translateY(-1px) !important;
}

.btn-warning:hover,
a.btn-warning:hover,
button.btn-warning:hover {
    background: #d97706 !important;
    border-color: #d97706 !important;
    color: #ffffff !important;
    transform: translateY(-1px) !important;
}

.btn-danger:hover,
a.btn-danger:hover,
button.btn-danger:hover {
    background: #b91c1c !important;
    border-color: #b91c1c !important;
    color: #ffffff !important;
    transform: translateY(-1px) !important;
}

.btn-outline:hover,
a.btn-outline:hover,
button.btn-outline:hover {
    background: #eff6ff !important;
    border-color: #1d4ed8 !important;
    color: #1d4ed8 !important;
    transform: translateY(-1px) !important;
}

.btn:active,
.btn-primary:active,
.btn-secondary:active,
.btn-success:active,
.btn-warning:active,
.btn-danger:active,
.btn-outline:active {
    transform: translateY(0) !important;
}

.btn:focus-visible,
.btn-primary:focus-visible,
.btn-secondary:focus-visible,
.btn-success:focus-visible,
.btn-warning:focus-visible,
.btn-danger:focus-visible,
.btn-outline:focus-visible,
.mini-btn:focus-visible,
.btn-small:focus-visible {
    outline: 3px solid rgba(37, 99, 235, 0.34) !important;
    outline-offset: 3px !important;
}

.panel-header .btn,
.panel-header a.btn,
.panel-header button.btn,
.panel-header .btn-primary,
.panel-header a.btn-primary,
.panel-header button.btn-primary {
    min-width: 0 !important;
    background: #2563eb !important;
    border-color: #2563eb !important;
    color: #ffffff !important;
    box-shadow: 0 7px 16px rgba(37, 99, 235, 0.2) !important;
}

.panel-header .btn.btn-secondary,
.panel-header a.btn.btn-secondary,
.panel-header button.btn.btn-secondary {
    background: #f1f5f9 !important;
    border-color: #cbd5e1 !important;
    color: #1e293b !important;
    box-shadow: none !important;
}

.panel-header .btn.btn-success,
.panel-header a.btn.btn-success,
.panel-header button.btn.btn-success {
    background: #16a34a !important;
    border-color: #16a34a !important;
    color: #ffffff !important;
}

.mini-btn {
    min-height: 34px !important;
    padding: 7px 11px !important;
    border: 1px solid #cbd5e1 !important;
    border-radius: 8px !important;
    background: #ffffff !important;
    color: #334155 !important;
    font-size: 12px !important;
    font-weight: 900 !important;
    line-height: 1 !important;
    box-shadow: none !important;
    cursor: pointer;
    transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease !important;
}

.mini-btn:hover {
    background: #eff6ff !important;
    border-color: #60a5fa !important;
    color: #1d4ed8 !important;
}

.btn-small,
a.btn-small,
button.btn-small {
    min-width: 38px !important;
    min-height: 38px !important;
    padding: 9px 12px !important;
    border: 1px solid #cbd5e1 !important;
    border-radius: 8px !important;
    background: #f8fafc !important;
    color: #334155 !important;
    box-shadow: none !important;
}

.btn-view,
a.btn-view,
button.btn-view,
.table-actions .btn-view,
.actions-cell .btn-view,
.data-table .btn-view {
    background: #e0f2fe !important;
    border-color: #7dd3fc !important;
    color: #075985 !important;
}

.btn-edit,
a.btn-edit,
button.btn-edit,
.table-actions .btn-edit,
.actions-cell .btn-edit,
.data-table .btn-edit {
    background: #dbeafe !important;
    border-color: #93c5fd !important;
    color: #1d4ed8 !important;
}

.btn-delete,
a.btn-delete,
button.btn-delete,
.table-actions .btn-delete,
.actions-cell .btn-delete,
.data-table .btn-delete {
    background: #fee2e2 !important;
    border-color: #fca5a5 !important;
    color: #b91c1c !important;
}

.btn-small:hover,
a.btn-small:hover,
button.btn-small:hover {
    background: #e2e8f0 !important;
    border-color: #94a3b8 !important;
    color: #0f172a !important;
    transform: translateY(-1px) !important;
}

.btn-view:hover,
a.btn-view:hover,
button.btn-view:hover,
.table-actions .btn-view:hover,
.actions-cell .btn-view:hover,
.data-table .btn-view:hover {
    background: #bae6fd !important;
    border-color: #38bdf8 !important;
    color: #075985 !important;
}

.btn-edit:hover,
a.btn-edit:hover,
button.btn-edit:hover,
.table-actions .btn-edit:hover,
.actions-cell .btn-edit:hover,
.data-table .btn-edit:hover {
    background: #bfdbfe !important;
    border-color: #60a5fa !important;
    color: #1d4ed8 !important;
}

.btn-delete:hover,
a.btn-delete:hover,
button.btn-delete:hover,
.table-actions .btn-delete:hover,
.actions-cell .btn-delete:hover,
.data-table .btn-delete:hover {
    background: #fecaca !important;
    border-color: #f87171 !important;
    color: #991b1b !important;
}

.action-btn,
a.action-btn,
button.action-btn,
.row-actions .action-btn {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 7px !important;
    min-height: 40px !important;
    padding: 9px 13px !important;
    border: 1px solid #cbd5e1 !important;
    border-radius: 8px !important;
    background: #f8fafc !important;
    color: #334155 !important;
    font-size: 13px !important;
    font-weight: 900 !important;
    line-height: 1 !important;
    text-align: center !important;
    text-decoration: none !important;
    box-shadow: none !important;
    transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease, transform 0.18s ease !important;
}

.action-view,
a.action-view,
button.action-view,
.row-actions .action-view {
    background: #e0f2fe !important;
    border-color: #7dd3fc !important;
    color: #075985 !important;
}

.action-edit,
a.action-edit,
button.action-edit,
.row-actions .action-edit {
    background: #dbeafe !important;
    border-color: #93c5fd !important;
    color: #1d4ed8 !important;
}

.action-delete,
a.action-delete,
button.action-delete,
.row-actions .action-delete {
    background: #fee2e2 !important;
    border-color: #fca5a5 !important;
    color: #b91c1c !important;
}

.action-btn:hover,
a.action-btn:hover,
button.action-btn:hover,
.row-actions .action-btn:hover {
    transform: translateY(-1px) !important;
}

.action-view:hover,
a.action-view:hover,
button.action-view:hover,
.row-actions .action-view:hover {
    background: #bae6fd !important;
    border-color: #38bdf8 !important;
    color: #075985 !important;
}

.action-edit:hover,
a.action-edit:hover,
button.action-edit:hover,
.row-actions .action-edit:hover {
    background: #bfdbfe !important;
    border-color: #60a5fa !important;
    color: #1d4ed8 !important;
}

.action-delete:hover,
a.action-delete:hover,
button.action-delete:hover,
.row-actions .action-delete:hover {
    background: #fecaca !important;
    border-color: #f87171 !important;
    color: #991b1b !important;
}

@media (max-width: 760px) {
    .cc-actions,
    .form-actions,
    .report-filter-actions,
    .filters-form .form-actions,
    .dashboard-filter-form .cc-actions {
        display: grid !important;
        grid-template-columns: minmax(0, 1fr) !important;
        gap: 10px !important;
        width: 100% !important;
    }

    .cc-actions .btn,
    .cc-actions a.btn,
    .cc-actions button.btn,
    .form-actions .btn,
    .form-actions a.btn,
    .form-actions button.btn,
    .report-filter-actions .btn,
    .report-filter-actions a.btn,
    .report-filter-actions button.btn,
    .filters-form .form-actions .btn,
    .filters-form .form-actions a.btn,
    .filters-form .form-actions button.btn {
        width: 100% !important;
        min-width: 0 !important;
    }

    .inline-actions {
        display: grid !important;
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        width: 100% !important;
    }

    .mini-btn {
        width: 100% !important;
    }

    .data-table td .action-btn,
    .cc-table td .action-btn,
    .row-actions .action-btn {
        width: 100% !important;
        min-width: 0 !important;
    }
}

.route-action-stack {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    min-width: 170px;
}

.route-first-row {
    background: #f0fdf4 !important;
    box-shadow: inset 5px 0 0 #16a34a;
}

.route-first-badge {
    margin-bottom: 7px;
}

.route-action-stack form {
    margin: 0;
}

.route-action-stack .btn,
.route-action-stack a.btn,
.route-action-stack button.btn {
    width: 100% !important;
    min-height: 38px !important;
    padding: 9px 12px !important;
}

.route-promise {
    display: grid;
    gap: 8px;
}

.route-promise summary {
    list-style: none;
    cursor: pointer;
}

.route-promise summary::-webkit-details-marker {
    display: none;
}

.route-promise-box {
    display: grid;
    gap: 8px;
    padding: 10px;
    border: 1px solid #fde68a;
    border-radius: 12px;
    background: #fffbeb;
}

.route-promise-box input,
.route-promise-box textarea {
    width: 100%;
    min-height: 40px;
    border: 1px solid #d6ddea;
    border-radius: 10px;
    padding: 9px 10px;
    font: inherit;
}

.route-promise-box textarea {
    min-height: 72px;
    resize: vertical;
}

@media (max-width: 760px) {
    .route-action-stack {
        min-width: 0;
    }
}

/* Kash PWA and mobile polish */
.pwa-install-button {
    position: fixed;
    left: 50%;
    bottom: 18px;
    z-index: 3000;
    transform: translateX(-50%);
    min-width: 190px;
    min-height: 48px;
    padding: 12px 20px;
    border: 0;
    border-radius: 999px;
    background: #0d4a59;
    color: #ffffff;
    font: inherit;
    font-size: 15px;
    font-weight: 950;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 20px 45px rgba(13, 74, 89, 0.28);
}

.pwa-install-button:disabled {
    cursor: wait;
    opacity: .72;
}

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

    .main-content {
        padding: 12px !important;
    }

    .cc-wrap {
        padding: 10px 0 26px !important;
    }

    .topbar {
        display: grid !important;
        grid-template-columns: 56px minmax(0, 1fr) !important;
        align-items: start !important;
        justify-content: initial !important;
        width: 100% !important;
        gap: 12px !important;
        padding: 14px !important;
        margin: 0 0 18px !important;
        border-radius: 18px !important;
    }

    .menu-button {
        width: 56px !important;
        min-width: 56px !important;
        height: 56px !important;
        min-height: 56px !important;
        border-radius: 16px !important;
        font-size: 34px !important;
        line-height: 1 !important;
    }

    .topbar-title {
        min-width: 0 !important;
        align-self: center !important;
    }

    .topbar-title strong {
        font-size: clamp(24px, 7vw, 34px) !important;
        line-height: 1.05 !important;
        overflow-wrap: anywhere !important;
    }

    .topbar-title span {
        font-size: clamp(14px, 4vw, 17px) !important;
        line-height: 1.22 !important;
        overflow-wrap: anywhere !important;
    }

    .topbar-clock,
    .topbar-date {
        grid-column: 1 / -1 !important;
        grid-row: 2 !important;
        width: 100% !important;
        max-width: none !important;
        min-width: 0 !important;
        padding: 12px 14px !important;
        text-align: left !important;
        white-space: normal !important;
    }

    .topbar-clock strong {
        font-size: clamp(18px, 5.1vw, 24px) !important;
        white-space: normal !important;
        overflow-wrap: anywhere !important;
    }

    .topbar-extra,
    .topbar > .monthly-dropdown {
        grid-column: 1 / -1 !important;
        grid-row: 3 !important;
        display: grid !important;
        grid-template-columns: minmax(0, 1fr) !important;
        gap: 10px !important;
        width: 100% !important;
        min-width: 0 !important;
        max-width: none !important;
        flex: initial !important;
        order: initial !important;
    }

    .topbar-extra .monthly-dropdown,
    .topbar-extra .monthly-calendar,
    .topbar-extra .notify-pill,
    .topbar > .monthly-dropdown .monthly-calendar {
        width: 100% !important;
        min-width: 0 !important;
        max-width: none !important;
        flex: initial !important;
        order: initial !important;
    }

    .monthly-calendar,
    .notify-pill {
        min-height: 74px !important;
        border-radius: 18px !important;
        padding: 12px !important;
    }

    .monthly-calendar-copy,
    .notify-pill span,
    .notify-pill small {
        min-width: 0 !important;
    }

    .monthly-calendar-copy span,
    .monthly-calendar-copy small,
    .notify-pill small {
        white-space: normal !important;
        overflow-wrap: anywhere !important;
    }

    .monthly-popover {
        position: fixed !important;
        left: 12px !important;
        right: 12px !important;
        top: auto !important;
        bottom: 14px !important;
        width: auto !important;
        max-height: 78vh !important;
        overflow: auto !important;
        z-index: 2500 !important;
    }

    .cc-card,
    .panel-card,
    .card,
    .form-box,
    .table-box,
    .system-card {
        width: 100% !important;
        min-width: 0 !important;
    }

    .cc-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 12px !important;
    }

    .dashboard-section > .cc-grid,
    .client-due-grid,
    .payment-plan,
    .form-grid {
        grid-template-columns: minmax(0, 1fr) !important;
    }

    .cc-grid .cc-card {
        min-width: 0 !important;
        min-height: 96px;
        padding: 16px !important;
        margin-bottom: 0 !important;
        border-radius: 16px !important;
    }

    .cc-grid .cc-card h2,
    .stat-value {
        max-width: 100%;
        font-size: clamp(22px, 6.4vw, 30px) !important;
        line-height: 1.08 !important;
        overflow-wrap: anywhere !important;
    }

    .cc-grid .cc-card p,
    .cc-grid .cc-card small,
    .cc-grid .cc-card span,
    .cc-grid .cc-card .muted {
        overflow-wrap: anywhere !important;
    }

    .cc-actions,
    .form-actions,
    .report-filter-actions,
    .filters-form .form-actions,
    .dashboard-filter-form .cc-actions {
        grid-template-columns: minmax(0, 1fr) !important;
    }

    .form-group input,
    .form-group select,
    .form-group textarea,
    input,
    select,
    textarea {
        max-width: 100% !important;
        min-width: 0 !important;
        font-size: 16px !important;
    }

    .cc-table td,
    .data-table td {
        overflow-wrap: anywhere !important;
    }

    .pwa-install-button {
        left: 12px;
        right: 12px;
        bottom: 14px;
        width: auto;
        min-width: 0;
        transform: none;
    }
}

@media (max-width: 390px) {
    .cc-grid {
        grid-template-columns: minmax(0, 1fr) !important;
    }

    .topbar-title strong {
        font-size: clamp(22px, 8vw, 30px) !important;
    }
}

/* =========================================================
   KASH MOBILE + PWA POLISH 20260629
========================================================= */

:root {
    --kash-safe-bottom: env(safe-area-inset-bottom, 0px);
}

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

body {
    min-width: 0;
}

.sidebar,
.main-content,
.topbar,
.cc-wrap,
.cc-card,
.panel-card,
.form-box,
.table-box,
.system-card {
    min-width: 0;
}

.sidebar {
    overflow-y: auto;
    overscroll-behavior: contain;
}

.sidebar-footer {
    margin-top: auto;
}

.topbar {
    position: relative;
    isolation: isolate;
}

.topbar-date span,
.topbar-clock span {
    display: block;
    color: #5c6f8a;
    font-size: 11px;
    font-weight: 950;
    line-height: 1.05;
    text-transform: uppercase;
}

.topbar-date strong,
.topbar-clock strong {
    display: block;
    color: #0b1220;
    font-size: 18px;
    line-height: 1.15;
    letter-spacing: 0;
}

.brand-logo {
    width: 66px;
    height: 66px;
    min-width: 66px;
    border-radius: 18px;
    object-fit: cover;
    background: #ffffff;
    box-shadow: 0 14px 30px rgba(15, 23, 42, 0.16);
}

.cc-card h2,
.cc-card h3,
.panel-header h3,
.dashboard-header h2 {
    overflow-wrap: anywhere;
}

.cc-card h2,
.stat-value {
    font-variant-numeric: tabular-nums;
}

.pwa-install-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 1px solid rgba(255,255,255,.22);
    background: linear-gradient(135deg, #0d4a59, #2563eb);
}

.pwa-install-button::before {
    content: "+";
    width: 22px;
    height: 22px;
    display: inline-grid;
    place-items: center;
    border-radius: 999px;
    background: rgba(255,255,255,.18);
    font-size: 18px;
    line-height: 1;
}

.pwa-install-hint {
    position: fixed;
    left: 50%;
    bottom: calc(76px + var(--kash-safe-bottom));
    z-index: 3001;
    width: min(420px, calc(100% - 24px));
    transform: translateX(-50%);
    padding: 13px 15px;
    border: 1px solid #bfdbfe;
    border-radius: 16px;
    background: #eff6ff;
    color: #1e3a8a;
    font-size: 13px;
    font-weight: 850;
    line-height: 1.35;
    box-shadow: 0 18px 45px rgba(15,23,42,.16);
}

.pwa-install-hint a {
    color: #1d4ed8;
    font-weight: 950;
    text-decoration: underline;
}

.pwa-install-sheet {
    position: fixed;
    inset: 0;
    z-index: 5000;
    display: grid;
    place-items: center;
    padding: 18px;
    background: rgba(15, 23, 42, .48);
}

.pwa-install-panel {
    position: relative;
    width: min(480px, 100%);
    max-height: min(680px, calc(100dvh - 36px));
    overflow: auto;
    border: 1px solid #dbeafe;
    border-radius: 18px;
    background: #ffffff;
    padding: 24px;
    box-shadow: 0 28px 80px rgba(15, 23, 42, .28);
}

.pwa-install-panel h3 {
    margin: 0 86px 8px 0;
    color: #0f172a;
    font-size: 24px;
    line-height: 1.12;
}

.pwa-install-panel p {
    margin: 0 0 14px;
    color: #475569;
    font-size: 14px;
    font-weight: 850;
    line-height: 1.4;
}

.pwa-install-panel ol {
    display: grid;
    gap: 10px;
    margin: 0;
    padding: 0 0 0 22px;
}

.pwa-install-panel li {
    color: #0f172a;
    font-size: 14px;
    font-weight: 850;
    line-height: 1.35;
}

.pwa-install-close {
    position: absolute;
    top: 14px;
    right: 14px;
    min-height: 34px;
    border: 0;
    border-radius: 10px;
    background: #e2e8f0;
    color: #0f172a;
    padding: 8px 11px;
    font-size: 12px;
    font-weight: 950;
    cursor: pointer;
}

.pwa-install-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-top: 18px;
}

@media (max-width: 900px) {
    .dashboard-container {
        min-height: 100dvh;
    }

    .sidebar {
        width: min(320px, 88vw) !important;
        min-width: 0 !important;
        left: calc(-1 * min(330px, 92vw)) !important;
        padding-bottom: calc(14px + var(--kash-safe-bottom));
    }

    .sidebar.sidebar-open {
        left: 0 !important;
    }

    .sidebar-brand {
        min-height: 96px;
        padding: 20px 22px;
        gap: 12px;
        flex-wrap: nowrap;
    }

    .sidebar-brand strong {
        font-size: 28px;
    }

    .sidebar-menu {
        padding: 8px 0;
    }

    .sidebar-menu a {
        min-height: 50px;
        padding: 13px 22px;
        font-size: 16px;
        line-height: 1.2;
    }

    .sidebar-footer {
        padding: 12px 14px 16px;
    }

    .sidebar-contact,
    .sidebar-logout {
        border-radius: 16px;
    }

    .main-content {
        min-height: 100dvh;
        padding: 12px !important;
    }

    .topbar {
        width: 100% !important;
        margin: 0 0 14px !important;
        padding: 12px !important;
        display: grid !important;
        grid-template-columns: 50px minmax(0, 1fr) !important;
        gap: 10px !important;
        align-items: center !important;
        border: 1px solid rgba(219, 227, 238, .9);
        border-radius: 18px;
        background: rgba(255,255,255,.84);
        box-shadow: 0 16px 38px rgba(15, 23, 42, .08);
        backdrop-filter: blur(12px);
    }

    .menu-button {
        width: 50px !important;
        min-width: 50px !important;
        height: 50px !important;
        min-height: 50px !important;
        border-radius: 15px !important;
        font-size: 26px !important;
    }

    .topbar-title {
        min-width: 0 !important;
    }

    .topbar-title strong {
        font-size: clamp(21px, 6vw, 30px) !important;
        line-height: 1.08 !important;
    }

    .topbar-title span {
        font-size: 13px !important;
        line-height: 1.2 !important;
    }

    .topbar-extra,
    .topbar > .monthly-dropdown,
    .topbar-date,
    .topbar-clock {
        grid-column: 1 / -1 !important;
        width: 100% !important;
        max-width: none !important;
    }

    .topbar-extra {
        display: grid !important;
        grid-template-columns: minmax(0, 1fr) !important;
        gap: 10px !important;
    }

    .topbar-date,
    .topbar-clock {
        margin-top: 0;
        padding: 12px 14px !important;
        border-radius: 16px !important;
        text-align: left !important;
        white-space: normal !important;
        background: #f8fbff;
    }

    .topbar-date strong,
    .topbar-clock strong {
        font-size: clamp(18px, 4.9vw, 23px) !important;
        overflow-wrap: anywhere;
    }

    .monthly-calendar,
    .notify-pill {
        width: 100% !important;
        max-width: none !important;
        min-height: 66px !important;
        border-radius: 16px !important;
        padding: 10px 12px !important;
    }

    .monthly-calendar-copy span,
    .monthly-calendar-copy small,
    .notify-pill span,
    .notify-pill small {
        white-space: normal !important;
        overflow: visible !important;
        text-overflow: clip !important;
    }

    .monthly-popover {
        position: fixed !important;
        left: 12px !important;
        right: 12px !important;
        top: auto !important;
        bottom: calc(12px + var(--kash-safe-bottom)) !important;
        width: auto !important;
        max-height: min(78dvh, 620px);
        overflow: auto;
        z-index: 2600;
    }

    .cc-wrap {
        width: 100% !important;
        padding: 6px 0 calc(28px + var(--kash-safe-bottom)) !important;
    }

    .dashboard-section {
        margin-top: 10px;
    }

    .cc-card,
    .panel-card,
    .card,
    .form-box,
    .table-box,
    .system-card {
        padding: 16px !important;
        border-radius: 16px !important;
        margin-bottom: 12px !important;
    }

    .cc-grid {
        gap: 12px !important;
    }

    .cc-grid .cc-card {
        min-height: 104px;
    }

    .cc-grid .cc-card h2,
    .stat-value {
        font-size: clamp(23px, 6.5vw, 32px) !important;
        line-height: 1.05 !important;
    }

    .form-grid,
    .filters-form,
    .dashboard-filter-form {
        grid-template-columns: minmax(0, 1fr) !important;
        gap: 12px !important;
    }

    .form-group input,
    .form-group select,
    .form-group textarea,
    input,
    select,
    textarea {
        min-height: 50px !important;
        font-size: 16px !important;
    }

    .cc-actions,
    .form-actions,
    .report-filter-actions {
        display: grid !important;
        grid-template-columns: minmax(0, 1fr) !important;
        gap: 10px !important;
    }

    .btn,
    .btn-primary,
    .btn-secondary,
    .btn-success,
    .btn-warning,
    .btn-danger,
    .btn-outline,
    button.btn,
    a.btn {
        width: 100% !important;
        min-height: 48px !important;
        white-space: normal !important;
        text-align: center;
    }
}

@media (max-width: 540px) {
    .cc-grid,
    .modern-grid,
    .stats-grid:not(.modern-grid),
    .dashboard-section > .cc-grid {
        grid-template-columns: minmax(0, 1fr) !important;
    }

    .login-box {
        width: 100%;
        padding: 24px 20px !important;
        border-radius: 20px !important;
    }

    .login-brand {
        gap: 12px !important;
    }

    .login-box h1 {
        font-size: clamp(28px, 9vw, 38px) !important;
    }

    .login-note {
        overflow-wrap: anywhere;
    }

    .home-box {
        width: 100%;
        padding: 30px 20px !important;
    }
}

@media (max-width: 430px) {
    .main-content {
        padding: 10px !important;
    }

    .topbar {
        grid-template-columns: 46px minmax(0, 1fr) !important;
        padding: 10px !important;
    }

    .menu-button {
        width: 46px !important;
        min-width: 46px !important;
        height: 46px !important;
        min-height: 46px !important;
    }

    .brand-logo {
        width: 58px;
        min-width: 58px;
        height: 58px;
        border-radius: 16px;
    }

    .sidebar-brand strong {
        font-size: 25px;
    }

    .cc-card,
    .panel-card,
    .card,
    .form-box,
    .table-box,
    .system-card {
        padding: 14px !important;
    }

    .pwa-install-button {
        left: 10px !important;
        right: 10px !important;
        bottom: calc(10px + var(--kash-safe-bottom)) !important;
        min-height: 50px !important;
        width: auto !important;
        transform: none !important;
    }

    .pwa-install-hint {
        left: 10px;
        right: 10px;
        bottom: calc(72px + var(--kash-safe-bottom));
        width: auto;
        transform: none;
    }
}

/* =========================================================
   KASH APP SHELL RESPONSIVE 20260703-3
========================================================= */

:root {
    --kash-ink: #0f172a;
    --kash-muted: #64748b;
    --kash-line: #d9e2ec;
    --kash-panel: #ffffff;
    --kash-bg: #eef4f6;
    --kash-brand: #0d4a59;
    --kash-brand-dark: #073b4c;
    --kash-action: #2563eb;
    --kash-accent: #f59e0b;
    --kash-ok: #16a34a;
    --kash-danger: #dc2626;
    --kash-safe-top: env(safe-area-inset-top, 0px);
}

html {
    background: var(--kash-bg);
}

body {
    color: var(--kash-ink);
    background: var(--kash-bg);
    overflow-x: hidden;
    max-width: 100%;
}

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

.dashboard-container {
    background: linear-gradient(180deg, #f8fbfc 0%, var(--kash-bg) 100%) !important;
}

.sidebar {
    background: var(--kash-brand-dark) !important;
    border-right: 1px solid rgba(255, 255, 255, .12);
    box-shadow: 18px 0 45px rgba(7, 59, 76, .18);
}

.sidebar-brand {
    border-bottom: 1px solid rgba(255, 255, 255, .12);
}

.sidebar-menu {
    gap: 4px;
    padding: 14px 12px !important;
}

.sidebar-menu a {
    min-height: 46px;
    margin: 0 !important;
    padding: 12px 16px !important;
    border-left: 0 !important;
    border-radius: 10px;
    color: rgba(255, 255, 255, .88) !important;
    line-height: 1.18;
}

.sidebar-menu a:hover,
.sidebar-menu a.active,
.sidebar-menu a[aria-current="page"] {
    background: #ffffff !important;
    color: var(--kash-brand-dark) !important;
    box-shadow: 0 10px 24px rgba(2, 6, 23, .18);
}

.sidebar-footer {
    display: grid;
    gap: 10px;
    padding: 14px !important;
    border-top: 1px solid rgba(255, 255, 255, .12);
}

.sidebar-contact,
.sidebar-logout,
.sidebar-footer .sidebar-user {
    min-width: 0;
    border-radius: 10px !important;
}

.sidebar-contact a,
.sidebar-user strong {
    overflow-wrap: anywhere;
}

.main-content {
    padding: 26px !important;
}

.topbar {
    gap: 14px !important;
    min-width: 0;
    padding: 14px !important;
    border: 1px solid rgba(217, 226, 236, .9);
    border-radius: 12px;
    background: rgba(255, 255, 255, .94);
    box-shadow: 0 18px 42px rgba(15, 23, 42, .08);
}

.menu-button {
    flex: 0 0 auto;
    border: 1px solid var(--kash-line) !important;
    background: #f8fbff !important;
    color: var(--kash-brand) !important;
    box-shadow: none !important;
}

.topbar-title {
    min-width: 0;
}

.topbar-title strong,
.dashboard-header h2,
.panel-header h3,
.cc-card h2,
.cc-card h3 {
    letter-spacing: 0;
}

.topbar-title strong {
    display: block;
    color: var(--kash-ink);
    line-height: 1.1;
    overflow-wrap: anywhere;
}

.topbar-title span {
    display: block;
    color: var(--kash-muted);
    font-weight: 850;
    line-height: 1.25;
    overflow-wrap: anywhere;
}

.topbar-date,
.topbar-clock,
.monthly-calendar,
.notify-pill {
    border: 1px solid var(--kash-line) !important;
    border-radius: 10px !important;
    box-shadow: none !important;
}

.cc-wrap {
    width: min(100%, 1420px) !important;
}

.cc-card,
.panel-card,
.card,
.form-box,
.table-box,
.system-card,
.summary-item {
    border: 1px solid rgba(217, 226, 236, .95) !important;
    border-radius: 12px !important;
    box-shadow: 0 16px 38px rgba(15, 23, 42, .07) !important;
}

.cc-grid,
.modern-grid,
.stats-grid {
    align-items: stretch;
}

.cc-grid .cc-card,
.stat-card,
.modern-card {
    min-width: 0;
}

.form-group input,
.form-group select,
.form-group textarea,
input,
select,
textarea {
    max-width: 100%;
    border-color: #cbd5e1;
    border-radius: 10px !important;
}

.password-field {
    position: relative;
}

.password-field input {
    padding-right: 94px !important;
}

.password-toggle {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 74px;
    min-width: 74px;
    max-width: 74px;
    min-height: 34px;
    height: 34px;
    padding: 0;
    border: 0;
    border-radius: 9px;
    background: #e8eef7;
    color: #0f172a;
    font-size: 13px;
    line-height: 1;
    font-weight: 900;
    cursor: pointer;
}

.btn,
.btn-primary,
.btn-secondary,
.btn-success,
.btn-warning,
.btn-danger,
.btn-outline,
.action-btn,
.mini-btn {
    min-width: 0;
    min-height: 46px;
    border-radius: 10px !important;
    line-height: 1.15 !important;
    white-space: normal;
}

.table-responsive {
    -webkit-overflow-scrolling: touch;
}

.cc-table,
.data-table {
    min-width: 0;
}

.cc-table th,
.data-table th {
    color: #334155;
}

.cc-table td,
.data-table td {
    min-width: 0;
    overflow-wrap: anywhere;
}

.dashboard-client-search {
    overflow: hidden !important;
    padding: 20px 22px !important;
    border-color: rgba(191, 219, 254, .72) !important;
    background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%) !important;
}

.dashboard-client-search-head {
    display: grid;
    gap: 6px;
    margin-bottom: 14px;
}

.dashboard-client-search-head h3 {
    margin: 0 !important;
    color: var(--kash-ink);
    font-size: 22px;
    line-height: 1.15;
}

.dashboard-client-search-head p {
    margin: 0 !important;
}

.dashboard-client-search-form {
    display: grid !important;
    grid-template-columns: minmax(320px, 1fr) auto auto !important;
    gap: 10px !important;
    align-items: stretch !important;
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
}

.dashboard-client-search-form .dashboard-client-search-input,
.dashboard-client-search-form input[type="search"].dashboard-client-search-input {
    display: block !important;
    min-width: 0 !important;
    width: 100% !important;
    max-width: none !important;
    min-height: 50px !important;
    height: 50px !important;
    box-sizing: border-box !important;
    border: 1px solid #cbd5e1 !important;
    border-radius: 12px !important;
    background: #ffffff !important;
    padding: 12px 14px !important;
    color: var(--kash-ink) !important;
    font-size: 15px !important;
    font-weight: 850 !important;
    line-height: 1.2 !important;
    box-shadow: inset 0 1px 0 rgba(15, 23, 42, .02) !important;
}

.dashboard-client-search-form .dashboard-client-search-button {
    min-width: 118px !important;
    min-height: 50px !important;
    margin: 0 !important;
    white-space: nowrap !important;
}

.dashboard-client-results {
    display: grid;
    gap: 10px;
    margin-top: 12px;
}

.client-search-row {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(150px, .55fr) auto;
    gap: 10px;
    align-items: center;
    min-width: 0;
    padding: 12px;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    background: #f8fafc;
}

.client-search-main,
.client-search-money,
.client-search-actions {
    min-width: 0;
}

.client-search-main strong,
.client-search-main span,
.client-search-main small,
.client-search-money span,
.client-search-money strong,
.client-search-money small {
    display: block;
    overflow-wrap: anywhere;
}

.client-search-main strong {
    color: var(--kash-ink);
    font-size: 15px;
    font-weight: 950;
    line-height: 1.15;
}

.client-search-main span,
.client-search-main small,
.client-search-money span,
.client-search-money small {
    margin-top: 4px;
    color: var(--kash-muted);
    font-size: 12px;
    font-weight: 850;
    line-height: 1.3;
}

.client-search-money strong {
    margin-top: 3px;
    color: var(--kash-ink);
    font-size: 15px;
    font-weight: 950;
    line-height: 1.15;
}

.client-search-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
}

.client-search-actions .btn {
    min-height: 38px;
    padding: 9px 11px !important;
    font-size: 13px !important;
}

.dashboard-client-empty {
    margin: 12px 0 0;
}

.payment-date-badge {
    max-width: 100%;
}

.pwa-install-button {
    bottom: max(14px, calc(14px + var(--kash-safe-bottom))) !important;
    border-radius: 999px !important;
    background: linear-gradient(135deg, var(--kash-brand), var(--kash-action)) !important;
}

.pwa-install-hint {
    bottom: max(76px, calc(76px + var(--kash-safe-bottom))) !important;
}

@media (max-width: 1180px) {
    .sidebar {
        width: 268px;
        min-width: 268px;
    }

    .main-content {
        margin-left: 268px;
        width: calc(100% - 268px);
        padding: 20px !important;
    }

    .modern-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    }
}

@media (max-width: 900px) {
    .dashboard-container {
        display: block !important;
        min-height: 100dvh;
    }

    .sidebar {
        position: fixed !important;
        inset: 0 auto 0 0 !important;
        width: min(336px, 88vw) !important;
        min-width: 0 !important;
        height: 100dvh !important;
        transform: translateX(-105%);
        transition: transform .2s ease;
        z-index: 2500 !important;
        padding-bottom: calc(12px + var(--kash-safe-bottom));
    }

    .sidebar.sidebar-open {
        transform: translateX(0);
    }

    .mobile-overlay {
        display: block !important;
        position: fixed !important;
        inset: 0 !important;
        z-index: 2400 !important;
        background: rgba(15, 23, 42, .42) !important;
        opacity: 0 !important;
        pointer-events: none !important;
        transition: opacity .2s ease;
    }

    .mobile-overlay.mobile-overlay-active {
        opacity: 1 !important;
        pointer-events: auto !important;
    }

    .body-menu-open {
        overflow: hidden !important;
    }

    .main-content {
        width: 100% !important;
        min-height: 100dvh;
        margin-left: 0 !important;
        padding: 10px !important;
    }

    .topbar {
        position: sticky;
        top: var(--kash-safe-top);
        z-index: 80;
        grid-template-columns: 44px minmax(0, 1fr) !important;
        gap: 9px !important;
        margin-bottom: 10px !important;
        padding: 10px !important;
    }

    .menu-button {
        width: 44px !important;
        min-width: 44px !important;
        max-width: 44px !important;
        height: 44px !important;
        min-height: 44px !important;
    }

    .topbar-extra,
    .topbar > .monthly-dropdown,
    .topbar-date,
    .topbar-clock {
        grid-column: 1 / -1 !important;
        width: 100% !important;
    }

    .topbar-title strong {
        font-size: clamp(18px, 5.2vw, 24px) !important;
    }

    .topbar-title span {
        font-size: 13px !important;
    }

    .cc-wrap {
        padding: 4px 0 calc(22px + var(--kash-safe-bottom)) !important;
    }

    .panel-header,
    .top-actions,
    .top-bar {
        display: grid !important;
        grid-template-columns: minmax(0, 1fr);
        align-items: start !important;
    }

    .form-grid,
    .filters-form,
    .dashboard-filter-form {
        grid-template-columns: minmax(0, 1fr) !important;
    }

    .form-group input,
    .form-group select,
    .form-group textarea,
    input,
    select,
    textarea {
        min-height: 46px !important;
        font-size: 16px !important;
    }
}

@media (max-width: 760px) {
    html,
    body,
    .dashboard-container,
    .main-content,
    .cc-wrap {
        max-width: 100vw !important;
        overflow-x: hidden !important;
    }

    .cc-card,
    .panel-card,
    .card,
    .form-box,
    .table-box,
    .system-card {
        padding: 12px !important;
        margin-bottom: 10px !important;
        min-width: 0 !important;
        overflow: hidden !important;
    }

    .cc-grid,
    .modern-grid,
    .stats-grid,
    .business-health-grid,
    .smart-dashboard-grid {
        width: 100% !important;
        min-width: 0 !important;
        grid-template-columns: minmax(0, 1fr) !important;
        gap: 10px !important;
    }

    .cc-card h2,
    .stat-card h2,
    .modern-card h2,
    .business-health-grid .cc-card h2 {
        max-width: 100%;
        font-size: clamp(20px, 6.6vw, 28px) !important;
        line-height: 1.05 !important;
        margin: 5px 0 !important;
        overflow-wrap: anywhere !important;
    }

    .cc-card h3,
    .panel-header h3,
    .dashboard-section h3 {
        font-size: clamp(18px, 5.2vw, 22px) !important;
        line-height: 1.15 !important;
        margin: 0 0 6px !important;
    }

    .muted,
    .cc-card p,
    .panel-header p {
        font-size: 13px !important;
        line-height: 1.35 !important;
    }

    .cc-grid,
    .modern-grid,
    .stats-grid,
    .admin-summary,
    .client-due-grid,
    .payment-plan,
    .business-health-grid,
    .smart-dashboard-grid,
    .offline-dashboard-grid,
    .client-profile-grid,
    .dashboard-client-search-form,
    .dashboard-client-results,
    .client-search-row {
        grid-template-columns: minmax(0, 1fr) !important;
    }

    .business-health-grid > *,
    .smart-dashboard-grid > *,
    .offline-dashboard-grid > *,
    .client-profile-grid > *,
    .dashboard-section,
    .risk-client-list,
    .risk-client-row,
    .client-search-row {
        min-width: 0 !important;
        max-width: 100% !important;
    }

    .health-score-card {
        min-height: auto !important;
    }

    .health-score-card strong {
        font-size: clamp(28px, 10vw, 38px) !important;
    }

    .smart-alert {
        padding: 10px 12px !important;
        border-radius: 12px !important;
    }

    .risk-client-row {
        display: grid !important;
        grid-template-columns: minmax(0, 1fr) !important;
        gap: 8px !important;
        padding: 10px !important;
    }

    .risk-client-row strong,
    .risk-client-row small,
    .risk-client-row em,
    .risk-client-row b {
        max-width: 100% !important;
        white-space: normal !important;
        overflow-wrap: anywhere !important;
    }

    .risk-client-row em,
    .risk-client-row b {
        justify-self: start !important;
        width: fit-content !important;
    }

    .dashboard-client-search-form {
        align-items: stretch !important;
    }

    .client-search-row {
        padding: 10px !important;
    }

    .client-search-actions {
        display: grid !important;
        grid-template-columns: minmax(0, 1fr) !important;
        justify-content: stretch !important;
        width: 100% !important;
    }

    .cc-actions,
    .form-actions,
    .quick-actions,
    .report-filter-actions,
    .filters-form .form-actions {
        display: grid !important;
        grid-template-columns: minmax(0, 1fr) !important;
        gap: 10px !important;
        width: 100% !important;
    }

    .btn,
    .btn-primary,
    .btn-secondary,
    .btn-success,
    .btn-warning,
    .btn-danger,
    .btn-outline,
    .action-btn,
    .mini-btn,
    .quick-actions a,
    button.btn,
    a.btn {
        width: 100% !important;
        max-width: none !important;
        min-height: 42px !important;
        padding: 10px 12px !important;
        font-size: 14px !important;
    }

    .table-responsive {
        overflow: visible !important;
    }

    .cc-table,
    .data-table {
        display: block !important;
        width: 100% !important;
        border-collapse: separate !important;
        border-spacing: 0 !important;
        background: transparent !important;
        overflow: visible !important;
    }

    .cc-table thead,
    .data-table thead {
        display: none !important;
    }

    .cc-table tbody,
    .data-table tbody,
    .cc-table tr,
    .data-table tr,
    .cc-table td,
    .data-table td {
        display: block !important;
        width: 100% !important;
    }

    .cc-table tr,
    .data-table tr {
        margin: 0 0 10px !important;
        padding: 6px !important;
        border: 1px solid var(--kash-line) !important;
        border-radius: 12px !important;
        background: #ffffff !important;
        box-shadow: 0 10px 26px rgba(15, 23, 42, .06) !important;
    }

    .cc-table td,
    .data-table td {
        position: relative;
        min-height: 32px;
        padding: 7px 6px !important;
        border: 0 !important;
        text-align: left !important;
    }

    .cc-table td::before,
    .data-table td::before {
        content: attr(data-label);
        display: block;
        margin-bottom: 4px;
        color: var(--kash-muted);
        font-size: 11px;
        font-weight: 950;
        line-height: 1.15;
        text-transform: uppercase;
    }

    .cc-table td[colspan]::before,
    .data-table td[colspan]::before {
        content: none;
    }

    .data-table th:last-child,
    .data-table td:last-child,
    .data-table td.actions-column {
        width: 100% !important;
        min-width: 0 !important;
        text-align: left !important;
    }

    .payment-date-badge {
        display: inline-grid !important;
        grid-template-columns: minmax(0, 1fr) !important;
        justify-items: start !important;
        width: 100%;
        border-radius: 10px !important;
        white-space: normal !important;
    }

    .monthly-popover {
        left: 10px !important;
        right: 10px !important;
        bottom: calc(10px + var(--kash-safe-bottom)) !important;
        width: auto !important;
        max-height: min(78dvh, 620px) !important;
    }
}

@media (max-width: 560px) {
    body.home-body,
    body {
        min-height: 100dvh;
    }

    .login-box,
    .box,
    .home-box,
    .offline-card {
        width: 100% !important;
        max-width: none !important;
        padding: 18px !important;
        border-radius: 12px !important;
    }

    .login-brand,
    .register-brand {
        align-items: flex-start !important;
    }

    .login-box h1,
    .register-brand strong,
    .home-box h1 {
        font-size: clamp(24px, 7.6vw, 30px) !important;
    }

    .register-logo,
    .login-logo,
    .brand-logo {
        transform: scale(.88);
        transform-origin: left center;
    }
}

@media (max-width: 390px) {
    .main-content {
        padding: 8px !important;
    }

    .topbar {
        grid-template-columns: 44px minmax(0, 1fr) !important;
        padding: 9px !important;
    }

    .menu-button {
        width: 44px !important;
        min-width: 44px !important;
        height: 44px !important;
        min-height: 44px !important;
    }
}

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

/* Menu button polish: draw the hamburger instead of relying on the phone font. */
.menu-button {
    position: relative !important;
    display: inline-grid !important;
    place-items: center !important;
    flex: 0 0 48px !important;
    width: 48px !important;
    min-width: 48px !important;
    max-width: 48px !important;
    height: 48px !important;
    min-height: 48px !important;
    padding: 0 !important;
    border: 1px solid #dbe3ee !important;
    border-radius: 16px !important;
    background: #ffffff !important;
    box-shadow: 0 14px 28px rgba(15, 23, 42, .08) !important;
    overflow: hidden !important;
    color: transparent !important;
    font-size: 0 !important;
    line-height: 0 !important;
    text-indent: -999px !important;
    cursor: pointer !important;
}

.menu-button::before {
    content: "" !important;
    position: absolute !important;
    left: 50% !important;
    top: 50% !important;
    transform: translate(-50%, -50%) !important;
    width: 24px !important;
    height: 3px !important;
    border-radius: 999px !important;
    background: #2563eb !important;
    box-shadow: 0 -8px 0 #2563eb, 0 8px 0 #2563eb !important;
    text-indent: 0 !important;
}

.menu-button[aria-expanded="true"] {
    border-color: #bfdbfe !important;
    background: #eff6ff !important;
}

.offline-readonly-status {
    position: fixed;
    left: 50%;
    bottom: max(14px, calc(14px + var(--kash-safe-bottom, 0px)));
    z-index: 4600;
    width: min(520px, calc(100vw - 28px));
    transform: translate(-50%, 18px);
    display: grid;
    gap: 3px;
    padding: 13px 16px;
    border: 1px solid #fed7aa;
    border-radius: 16px;
    background: #fff7ed;
    color: #9a3412;
    box-shadow: 0 20px 50px rgba(15, 23, 42, .18);
    opacity: 0;
    pointer-events: none;
    transition: opacity .18s ease, transform .18s ease;
}

.offline-readonly-status strong {
    color: #7c2d12;
    font-size: 13px;
    font-weight: 950;
    line-height: 1.15;
}

.offline-readonly-status span {
    color: #9a3412;
    font-size: 12px;
    font-weight: 850;
    line-height: 1.35;
}

.offline-readonly-status small {
    display: block;
    color: #7c2d12;
    font-size: 11px;
    font-weight: 900;
    line-height: 1.35;
    overflow-wrap: anywhere;
}

.offline-readonly-status button {
    justify-self: start;
    margin-top: 6px;
    min-height: 34px;
    border: 0;
    border-radius: 10px;
    background: #ea580c;
    color: #fff;
    padding: 8px 12px;
    font-size: 12px;
    font-weight: 950;
    cursor: pointer;
}

.offline-readonly-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin-top: 6px;
}

.offline-readonly-actions button {
    margin-top: 0;
}

.offline-queue-panel {
    position: fixed;
    inset: 0;
    z-index: 4700;
    display: grid;
    place-items: center;
    padding: 18px;
    background: rgba(15, 23, 42, .46);
}

.offline-queue-panel[hidden] {
    display: none;
}

.offline-queue-card {
    width: min(720px, 100%);
    max-height: min(720px, calc(100vh - 36px));
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    overflow: hidden;
    border: 1px solid #dbe3ee;
    border-radius: 18px;
    background: #ffffff;
    box-shadow: 0 30px 80px rgba(15, 23, 42, .28);
}

.offline-queue-head,
.offline-queue-actions {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
    padding: 16px;
    border-bottom: 1px solid #e2e8f0;
}

.offline-queue-actions {
    border-top: 1px solid #e2e8f0;
    border-bottom: 0;
    justify-content: flex-end;
}

.offline-queue-head strong {
    display: block;
    color: #0f172a;
    font-size: 18px;
    font-weight: 950;
}

.offline-queue-head span {
    color: #64748b;
    font-size: 13px;
    font-weight: 850;
}

.offline-queue-list {
    display: grid;
    gap: 10px;
    overflow: auto;
    padding: 16px;
    background: #f8fafc;
}

.offline-queue-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px;
    align-items: center;
    padding: 13px;
    border: 1px solid #e2e8f0;
    border-left: 5px solid #64748b;
    border-radius: 14px;
    background: #ffffff;
}

.offline-queue-row-critical {
    border-left-color: #dc2626;
    background: #fff7f7;
}

.offline-queue-row strong,
.offline-queue-row span,
.offline-queue-row small {
    display: block;
}

.offline-queue-row strong {
    color: #0f172a;
    font-weight: 950;
}

.offline-queue-row span {
    margin-top: 4px;
    color: #475569;
    font-size: 13px;
    font-weight: 850;
    line-height: 1.35;
}

.offline-queue-row small {
    margin-top: 5px;
    color: #64748b;
    font-size: 12px;
    font-weight: 800;
}

.offline-queue-row > div:last-child {
    display: grid;
    gap: 7px;
}

.offline-queue-panel button {
    min-height: 38px;
    border: 0;
    border-radius: 11px;
    background: #2563eb;
    color: #ffffff;
    padding: 9px 12px;
    font-weight: 950;
    cursor: pointer;
}

.offline-queue-panel [data-offline-queue-close],
.offline-queue-remove {
    background: #e2e8f0 !important;
    color: #0f172a !important;
}

.offline-queue-row em {
    display: inline-flex;
    justify-content: center;
    border-radius: 999px;
    background: #dcfce7;
    color: #166534;
    padding: 7px 10px;
    font-size: 12px;
    font-style: normal;
    font-weight: 950;
}

.offline-queue-empty {
    border: 1px dashed #cbd5e1;
    border-radius: 14px;
    background: #ffffff;
    padding: 18px;
    color: #64748b;
    font-weight: 850;
    text-align: center;
}

.kash-offline-readonly .offline-readonly-status,
.kash-offline-has-queue .offline-readonly-status,
.offline-readonly-flash .offline-readonly-status {
    opacity: 1;
    transform: translate(-50%, 0);
    pointer-events: auto;
}

.kash-offline-readonly form button[type="submit"],
.kash-offline-readonly form input[type="submit"],
.kash-offline-readonly form button:not([type]) {
    filter: grayscale(.25);
}

.kash-offline-readonly form[data-offline-sync] button[type="submit"],
.kash-offline-readonly form[data-offline-sync] input[type="submit"],
.kash-offline-readonly form[data-offline-sync] button:not([type]) {
    filter: none;
}

.kash-offline-form-busy {
    opacity: .78;
}

.kash-offline-form-queued {
    outline: 2px solid rgba(234, 88, 12, .22);
    outline-offset: 3px;
    border-radius: 12px;
}

@media (max-width: 760px) {
    .offline-readonly-status {
        bottom: max(10px, calc(10px + var(--kash-safe-bottom, 0px)));
        width: calc(100vw - 20px);
        border-radius: 14px;
    }

    .offline-readonly-actions,
    .offline-queue-head,
    .offline-queue-actions,
    .offline-queue-row {
        display: grid;
        grid-template-columns: 1fr;
    }

    .offline-queue-panel button {
        width: 100%;
    }
}

.menu-button:focus-visible {
    outline: 3px solid rgba(37, 99, 235, .28) !important;
    outline-offset: 3px !important;
}

@media (max-width: 900px) {
    .menu-button {
        border-radius: 14px !important;
    }

    .menu-button::before {
        width: 25px !important;
        height: 3px !important;
        box-shadow: 0 -8px 0 #2563eb, 0 8px 0 #2563eb !important;
    }
}

/* Ficha del cliente: evita que el score y los valores se partan en móvil. */
@media (max-width: 900px) {
    .client-score-card {
        grid-template-columns: minmax(0, 1fr) !important;
        gap: 12px !important;
    }

    .client-score-main {
        min-height: auto !important;
        padding: 14px !important;
    }

    .client-score-details {
        width: 100% !important;
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 10px !important;
    }

    .client-score-details div {
        min-width: 0 !important;
        padding: 11px !important;
    }

    .client-score-details span {
        line-height: 1.18 !important;
    }

    .client-score-details strong {
        font-size: clamp(15px, 4.4vw, 19px) !important;
        line-height: 1.14 !important;
        white-space: normal !important;
        overflow-wrap: normal !important;
        word-break: normal !important;
        hyphens: none !important;
    }
}

@media (max-width: 340px) {
    .client-score-details {
        grid-template-columns: minmax(0, 1fr) !important;
    }
}

/* Lista de clientes: ID visible y columnas estables para no romper el score. */
.cc-table-scroll .clients-table {
    min-width: 1180px !important;
    table-layout: fixed !important;
}

.clients-table th:nth-child(1),
.clients-table td:nth-child(1) {
    width: 18% !important;
}

.clients-table th:nth-child(2),
.clients-table td:nth-child(2) {
    width: 16% !important;
}

.clients-table th:nth-child(3),
.clients-table td:nth-child(3) {
    width: 12% !important;
}

.clients-table th:nth-child(4),
.clients-table td:nth-child(4) {
    width: 32% !important;
}

.clients-table th:nth-child(5),
.clients-table td:nth-child(5) {
    width: 12% !important;
}

.clients-table th:nth-child(6),
.clients-table td:nth-child(6) {
    width: 10% !important;
}

.client-cell {
    display: grid;
    gap: 6px;
    min-width: 0;
}

.client-cell strong {
    color: #0f172a;
    font-size: 16px;
    line-height: 1.18;
    overflow-wrap: anywhere;
}

.client-id-badge {
    display: inline-flex;
    width: max-content;
    max-width: 100%;
    align-items: center;
    justify-content: center;
    padding: 7px 10px;
    border-radius: 999px;
    background: #dbeafe;
    color: #1d4ed8;
    font-size: 13px;
    font-weight: 950;
    line-height: 1;
    white-space: nowrap;
}

.client-cell-meta {
    display: block;
    color: #64748b;
    font-size: 13px;
    font-weight: 850;
    line-height: 1.25;
    overflow-wrap: anywhere;
}

.clients-table td[data-label="Estado"] {
    min-width: 145px !important;
}

.clients-table .client-score-pill {
    display: grid !important;
    grid-template-columns: auto minmax(0, 1fr) !important;
    align-items: center !important;
    gap: 4px 8px !important;
    width: min(165px, 100%) !important;
    min-width: 130px !important;
    padding: 10px 12px !important;
    border-radius: 16px !important;
    line-height: 1.1 !important;
    overflow: hidden !important;
}

.clients-table .client-score-pill strong {
    grid-row: 1 / span 2;
    font-size: 28px !important;
    line-height: 1 !important;
    white-space: nowrap !important;
}

.clients-table .client-score-pill span {
    min-width: 0 !important;
    font-size: 12px !important;
    font-weight: 950 !important;
    line-height: 1.1 !important;
    white-space: normal !important;
    overflow-wrap: normal !important;
    word-break: normal !important;
}

.clients-table .client-score-pill small {
    grid-column: 1 / -1;
    display: block !important;
    margin-top: 2px !important;
    font-size: 11px !important;
    line-height: 1.18 !important;
    white-space: normal !important;
    overflow-wrap: normal !important;
    word-break: normal !important;
}

.clients-table .client-score-state {
    margin-top: 8px !important;
}

.clients-table td[data-label="Acciones"] .cc-actions {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 10px !important;
    margin-top: 0 !important;
}

.clients-table td[data-label="Acciones"] .btn {
    width: 100% !important;
    min-width: 0 !important;
}

.cc-table-scroll .clients-table-simple {
    min-width: 1040px !important;
}

.clients-table-simple th:nth-child(1),
.clients-table-simple td:nth-child(1) {
    width: 22% !important;
}

.clients-table-simple th:nth-child(2),
.clients-table-simple td:nth-child(2) {
    width: 18% !important;
}

.clients-table-simple th:nth-child(3),
.clients-table-simple td:nth-child(3) {
    width: 34% !important;
}

.clients-table-simple th:nth-child(4),
.clients-table-simple td:nth-child(4) {
    width: 13% !important;
}

.clients-table-simple th:nth-child(5),
.clients-table-simple td:nth-child(5) {
    width: 13% !important;
}

@media (max-width: 760px) {
    .cc-table-scroll .clients-table {
        min-width: 0 !important;
        overflow: visible !important;
    }

    .clients-table th,
    .clients-table td {
        width: 100% !important;
        min-width: 0 !important;
    }

    .clients-table tbody,
    .clients-table tr,
    .clients-table td {
        display: block !important;
        width: 100% !important;
    }

    .clients-table tr {
        display: grid !important;
        grid-template-columns: minmax(0, 1fr) !important;
        gap: 10px !important;
        padding: 12px !important;
        border-radius: 14px !important;
    }

    .clients-table td {
        padding: 0 !important;
        overflow: visible !important;
    }

    .clients-table td::before {
        margin-bottom: 5px !important;
    }

    .clients-table td[data-label="Cliente"] .client-cell,
    .clients-table td[data-label="Ruta"],
    .clients-table td[data-label="Jefe de ruta"],
    .clients-table td[data-label="Saldo"],
    .clients-table td[data-label="Estado"],
    .clients-table td[data-label="Acciones"] {
        border: 1px solid #e2e8f0 !important;
        border-radius: 12px !important;
        background: #ffffff !important;
        padding: 10px !important;
    }

    .clients-table .client-score-pill {
        display: grid !important;
        grid-template-columns: auto minmax(0, 1fr) !important;
        width: 100% !important;
        min-width: 0 !important;
        max-width: none !important;
        overflow: visible !important;
    }

    .clients-table .client-score-pill strong {
        font-size: 26px !important;
    }

    .clients-table .client-score-pill span,
    .clients-table .client-score-pill small {
        white-space: normal !important;
        word-break: keep-all !important;
        overflow-wrap: normal !important;
        writing-mode: horizontal-tb !important;
    }

    .clients-table td[data-label="Estado"] {
        display: grid !important;
        gap: 8px !important;
    }
}

/* Kash clients responsive hardening: desktop keeps actions readable; mobile becomes cards. */
.btn {
    max-width: 100%;
    white-space: normal;
    text-align: center;
    line-height: 1.15;
}

.clients-table-wrap {
    overflow-x: auto;
    overflow-y: visible;
    scrollbar-gutter: stable;
    border-radius: 14px;
}

.clients-table-wrap .clients-table {
    min-width: 1500px !important;
    table-layout: fixed !important;
}

.clients-table th,
.clients-table td {
    white-space: normal !important;
    word-break: normal !important;
    overflow-wrap: break-word !important;
}

.clients-table-admin th:nth-child(1),
.clients-table-admin td:nth-child(1) { width: 230px !important; }
.clients-table-admin th:nth-child(2),
.clients-table-admin td:nth-child(2) { width: 220px !important; }
.clients-table-admin th:nth-child(3),
.clients-table-admin td:nth-child(3) { width: 180px !important; }
.clients-table-admin th:nth-child(4),
.clients-table-admin td:nth-child(4) { width: 470px !important; }
.clients-table-admin th:nth-child(5),
.clients-table-admin td:nth-child(5) { width: 170px !important; }
.clients-table-admin th:nth-child(6),
.clients-table-admin td:nth-child(6) { width: 230px !important; }

.clients-table-simple th:nth-child(1),
.clients-table-simple td:nth-child(1) { width: 260px !important; }
.clients-table-simple th:nth-child(2),
.clients-table-simple td:nth-child(2) { width: 230px !important; }
.clients-table-simple th:nth-child(3),
.clients-table-simple td:nth-child(3) { width: 470px !important; }
.clients-table-simple th:nth-child(4),
.clients-table-simple td:nth-child(4) { width: 170px !important; }
.clients-table-simple th:nth-child(5),
.clients-table-simple td:nth-child(5) { width: 230px !important; }

.clients-table-admin th:last-child,
.clients-table-admin td[data-label="Acciones"],
.clients-table-simple th:last-child,
.clients-table-simple td[data-label="Acciones"] {
    position: static;
    right: auto;
    z-index: 1;
    background: #ffffff;
}

.clients-table-admin th:last-child,
.clients-table-simple th:last-child {
    z-index: 1;
    background: #f8fafc;
}

.clients-table tr.loan-row-overdue td[data-label="Acciones"] { background: #fef2f2; }
.clients-table tr.loan-row-today td[data-label="Acciones"] { background: #fffbeb; }
.clients-table tr.loan-row-upcoming td[data-label="Acciones"],
.clients-table tr.loan-row-paid td[data-label="Acciones"] { background: #f0fdf4; }

.clients-table td[data-label="Acciones"] .cc-actions {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 10px !important;
    min-width: 0 !important;
    margin-top: 0 !important;
}

.clients-table td[data-label="Acciones"] .btn {
    width: 100% !important;
    min-width: 0 !important;
    min-height: 46px !important;
    padding: 11px 12px !important;
    line-height: 1.15 !important;
    text-align: center !important;
    white-space: normal !important;
    overflow: visible !important;
    box-shadow: none;
}

.clients-table td[data-label="Acciones"] .btn-primary {
    box-shadow: 0 10px 22px rgba(37, 99, 235, .18);
}

.clients-table .payment-plan {
    max-width: 100%;
}

.clients-table .payment-plan-row {
    grid-template-columns: minmax(115px, max-content) minmax(0, 1fr) auto;
}

@media (max-width: 1100px) {
    .clients-table-wrap {
        overflow: visible !important;
        border-radius: 0 !important;
    }

    .clients-table-wrap .clients-table {
        display: block !important;
        width: 100% !important;
        min-width: 0 !important;
        table-layout: auto !important;
    }

    .clients-table thead {
        display: none !important;
    }

    .clients-table tbody {
        display: grid !important;
        gap: 14px !important;
        width: 100% !important;
    }

    .clients-table tr {
        display: grid !important;
        grid-template-columns: minmax(0, 1fr) !important;
        width: 100% !important;
        min-width: 0 !important;
        margin: 0 !important;
        padding: 14px !important;
        border: 1px solid #dbe3ee !important;
        border-left: 5px solid #94a3b8 !important;
        border-radius: 16px !important;
        background: #ffffff !important;
        box-shadow: 0 16px 34px rgba(15, 23, 42, .08) !important;
    }

    .clients-table tr.loan-row-overdue {
        border-left-color: #dc2626 !important;
        background: #fff7f7 !important;
    }

    .clients-table tr.loan-row-today {
        border-left-color: #f59e0b !important;
        background: #fffaf0 !important;
    }

    .clients-table tr.loan-row-upcoming,
    .clients-table tr.loan-row-paid {
        border-left-color: #16a34a !important;
        background: #f8fff9 !important;
    }

    .clients-table tr[class*="loan-row-"] td:first-child {
        border-left: 0 !important;
    }

    .clients-table th,
    .clients-table td {
        width: 100% !important;
        min-width: 0 !important;
        max-width: 100% !important;
    }

    .clients-table td {
        display: block !important;
        position: static !important;
        padding: 11px 0 !important;
        border: 0 !important;
        border-bottom: 1px solid #e5e7eb !important;
        overflow: visible !important;
        word-break: normal !important;
        overflow-wrap: break-word !important;
        white-space: normal !important;
        background: transparent !important;
    }

    .clients-table td:last-child {
        border-bottom: 0 !important;
        padding-bottom: 0 !important;
    }

    .clients-table td::before {
        content: attr(data-label) !important;
        display: block !important;
        margin-bottom: 6px !important;
        color: #64748b !important;
        font-size: 12px !important;
        font-weight: 950 !important;
        line-height: 1.15 !important;
        text-transform: uppercase !important;
        letter-spacing: 0 !important;
    }

    .clients-table td[data-label="Cliente"] .client-cell,
    .clients-table td[data-label="Ruta"],
    .clients-table td[data-label="Jefe de ruta"],
    .clients-table td[data-label="Saldo"],
    .clients-table td[data-label="Estado"],
    .clients-table td[data-label="Acciones"] {
        border: 0 !important;
        border-radius: 0 !important;
        background: transparent !important;
        padding: 0 !important;
    }

    .clients-table .client-cell {
        display: grid !important;
        gap: 6px !important;
        width: 100% !important;
        min-width: 0 !important;
        max-width: none !important;
    }

    .clients-table .client-cell strong {
        font-size: 19px !important;
        line-height: 1.18 !important;
        word-break: normal !important;
        overflow-wrap: break-word !important;
    }

    .clients-table .client-cell-meta {
        font-size: 14px !important;
        line-height: 1.35 !important;
        word-break: normal !important;
        overflow-wrap: break-word !important;
    }

    .clients-table td[data-label="Saldo"] {
        display: grid !important;
        gap: 6px !important;
    }

    .clients-table .payment-plan {
        display: grid !important;
        grid-template-columns: 1fr !important;
        margin-top: 10px !important;
        gap: 10px !important;
    }

    .clients-table .payment-plan-card {
        padding: 12px !important;
        border-radius: 14px !important;
    }

    .clients-table .payment-plan-list {
        display: grid !important;
        gap: 8px !important;
    }

    .clients-table .payment-plan-row {
        display: grid !important;
        grid-template-columns: 1fr !important;
        gap: 7px !important;
        padding: 10px !important;
    }

    .clients-table .payment-plan-row em {
        justify-self: start !important;
    }

    .clients-table .payment-date-badge {
        display: inline-flex !important;
        align-items: center !important;
        gap: 6px !important;
        width: max-content !important;
        max-width: 100% !important;
        white-space: normal !important;
    }

    .clients-table td[data-label="Estado"] {
        display: grid !important;
        grid-template-columns: 1fr !important;
        gap: 10px !important;
    }

    .clients-table .client-score-pill,
    .clients-table .client-score-card,
    .clients-table .health-score-card {
        width: 100% !important;
        max-width: 280px !important;
        min-width: 0 !important;
        overflow: visible !important;
    }

    .clients-table .client-score-pill span,
    .clients-table .client-score-pill small,
    .clients-table .client-score-card span,
    .clients-table .health-score-card span {
        writing-mode: horizontal-tb !important;
        white-space: normal !important;
        word-break: normal !important;
        overflow-wrap: break-word !important;
    }

    .clients-table td[data-label="Acciones"] .cc-actions {
        display: grid !important;
        grid-template-columns: 1fr 1fr !important;
        gap: 10px !important;
        width: 100% !important;
        min-width: 0 !important;
    }

    .clients-table td[data-label="Acciones"] .btn {
        width: 100% !important;
        min-height: 48px !important;
        padding: 12px 10px !important;
        font-size: 15px !important;
        line-height: 1.15 !important;
    }

    .clients-table td[data-label="Acciones"] .btn-success {
        grid-column: 1 / -1 !important;
    }
}

@media (max-width: 460px) {
    .clients-table td[data-label="Acciones"] .cc-actions {
        grid-template-columns: 1fr !important;
    }

    .clients-table .client-cell strong {
        font-size: 18px !important;
    }

    .clients-table .payment-date-badge {
        width: 100% !important;
        justify-content: flex-start !important;
    }

    .clients-table .client-score-pill,
    .clients-table .client-score-card,
    .clients-table .health-score-card {
        max-width: none !important;
    }
}

/* Compact result layouts for Kash PWA */
.clients-results-card {
    padding: 22px !important;
    overflow: hidden !important;
}

.clients-results-card .clients-compact-wrap {
    overflow-x: visible !important;
    overflow-y: visible !important;
    border-radius: 16px !important;
}

.clients-results-card .clients-card-table {
    width: 100% !important;
    min-width: 0 !important;
    table-layout: auto !important;
}

.clients-results-card .clients-card-table th,
.clients-results-card .clients-card-table td {
    white-space: normal !important;
    word-break: normal !important;
    overflow-wrap: break-word !important;
}

.clients-results-card .clients-card-table th:nth-child(1),
.clients-results-card .clients-card-table td:nth-child(1) {
    width: 32% !important;
}

.clients-results-card .clients-card-table th:nth-child(2),
.clients-results-card .clients-card-table td:nth-child(2) {
    width: 48% !important;
}

.clients-results-card .clients-card-table th:nth-child(3),
.clients-results-card .clients-card-table td:nth-child(3) {
    width: 20% !important;
}

.clients-results-card .clients-card-table td[data-label="Acciones"] .cc-actions,
.loan-results-card .cc-table td[data-label="Acciones"] .cc-actions {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 10px !important;
    min-width: 0 !important;
    margin-top: 0 !important;
}

.clients-results-card .clients-card-table td[data-label="Acciones"] .btn,
.loan-results-card .cc-table td[data-label="Acciones"] .btn {
    width: 100% !important;
    min-width: 0 !important;
    min-height: 44px !important;
    padding: 10px 12px !important;
    line-height: 1.15 !important;
    white-space: normal !important;
    overflow: visible !important;
    text-align: center !important;
}

.clients-results-card .client-cell {
    min-width: 0 !important;
    max-width: none !important;
}

.clients-results-card .client-cell strong,
.loan-results-card .cc-table td strong {
    line-height: 1.2 !important;
}

.clients-results-card .client-cell-meta,
.clients-results-card .muted,
.loan-results-card .muted {
    line-height: 1.35 !important;
}

.loan-results-card {
    padding: 22px !important;
    overflow-x: auto !important;
}

.loan-results-card .cc-table {
    width: 100% !important;
    min-width: 980px !important;
    table-layout: fixed !important;
}

.loan-results-card .cc-table th,
.loan-results-card .cc-table td {
    white-space: normal !important;
    word-break: normal !important;
    overflow-wrap: break-word !important;
}

.loan-results-card .cc-table th:nth-child(1),
.loan-results-card .cc-table td:nth-child(1) {
    width: 18% !important;
}

.loan-results-card .cc-table th:nth-child(2),
.loan-results-card .cc-table td:nth-child(2) {
    width: 16% !important;
}

.loan-results-card .cc-table th:nth-child(3),
.loan-results-card .cc-table td:nth-child(3),
.loan-results-card .cc-table th:nth-child(4),
.loan-results-card .cc-table td:nth-child(4),
.loan-results-card .cc-table th:nth-child(5),
.loan-results-card .cc-table td:nth-child(5),
.loan-results-card .cc-table th:nth-child(6),
.loan-results-card .cc-table td:nth-child(6),
.loan-results-card .cc-table th:nth-child(7),
.loan-results-card .cc-table td:nth-child(7) {
    width: 11% !important;
}

.loan-results-card .cc-table th:nth-child(8),
.loan-results-card .cc-table td:nth-child(8) {
    width: 14% !important;
}

.report-filter-actions {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 12px !important;
    margin-top: 0 !important;
}

.report-filter-actions .btn,
.cc-card form .cc-actions .btn {
    width: auto !important;
    min-width: 150px !important;
    white-space: normal !important;
}

.dashboard-client-search-form {
    align-items: stretch !important;
}

.dashboard-client-search-form .btn {
    min-width: 130px !important;
}

@media (max-width: 1240px) {
    .clients-results-card .clients-compact-wrap,
    .loan-results-card {
        overflow-x: visible !important;
    }

    .clients-results-card .clients-card-table,
    .clients-results-card .clients-card-table thead,
    .clients-results-card .clients-card-table tbody,
    .clients-results-card .clients-card-table tr,
    .clients-results-card .clients-card-table td,
    .loan-results-card .cc-table,
    .loan-results-card .cc-table thead,
    .loan-results-card .cc-table tbody,
    .loan-results-card .cc-table tr,
    .loan-results-card .cc-table td {
        display: block !important;
        width: 100% !important;
        min-width: 0 !important;
        max-width: 100% !important;
    }

    .clients-results-card .clients-card-table thead,
    .loan-results-card .cc-table thead {
        display: none !important;
    }

    .clients-results-card .clients-card-table tbody,
    .loan-results-card .cc-table tbody {
        display: grid !important;
        gap: 14px !important;
    }

    .clients-results-card .clients-card-table tr,
    .loan-results-card .cc-table tr {
        display: grid !important;
        grid-template-columns: minmax(0, 1fr) !important;
        padding: 16px !important;
        border: 1px solid #dbe3ee !important;
        border-left: 5px solid #94a3b8 !important;
        border-radius: 16px !important;
        box-shadow: 0 16px 34px rgba(15, 23, 42, .08) !important;
        background: #ffffff !important;
    }

    .clients-results-card .clients-card-table tr.loan-row-overdue,
    .loan-results-card .cc-table tr.loan-row-overdue {
        border-left-color: #dc2626 !important;
        background: #fff7f7 !important;
    }

    .clients-results-card .clients-card-table tr.loan-row-today,
    .loan-results-card .cc-table tr.loan-row-today {
        border-left-color: #f59e0b !important;
        background: #fffaf0 !important;
    }

    .clients-results-card .clients-card-table tr.loan-row-upcoming,
    .clients-results-card .clients-card-table tr.loan-row-paid,
    .loan-results-card .cc-table tr.loan-row-upcoming,
    .loan-results-card .cc-table tr.loan-row-paid {
        border-left-color: #16a34a !important;
        background: #f8fff9 !important;
    }

    .clients-results-card .clients-card-table td,
    .loan-results-card .cc-table td {
        padding: 10px 0 !important;
        border: 0 !important;
        border-bottom: 1px solid #e5e7eb !important;
        background: transparent !important;
    }

    .clients-results-card .clients-card-table td:last-child,
    .loan-results-card .cc-table td:last-child {
        border-bottom: 0 !important;
        padding-bottom: 0 !important;
    }

    .clients-results-card .clients-card-table td::before,
    .loan-results-card .cc-table td::before {
        content: attr(data-label) !important;
        display: block !important;
        margin-bottom: 6px !important;
        color: #64748b !important;
        font-size: 12px !important;
        font-weight: 950 !important;
        line-height: 1.15 !important;
        text-transform: uppercase !important;
    }

    .clients-results-card .clients-card-table td[data-label="Acciones"] .cc-actions,
    .loan-results-card .cc-table td[data-label="Acciones"] .cc-actions {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    }

    .clients-results-card .clients-card-table td[data-label="Acciones"] .btn-success,
    .loan-results-card .cc-table td[data-label="Acciones"] .btn-success {
        grid-column: 1 / -1 !important;
    }
}

@media (max-width: 640px) {
    .clients-results-card,
    .loan-results-card {
        padding: 14px !important;
    }

    .clients-results-card .clients-card-table tr,
    .loan-results-card .cc-table tr {
        padding: 14px !important;
        border-radius: 14px !important;
    }

    .clients-results-card .clients-card-table td[data-label="Acciones"] .cc-actions,
    .loan-results-card .cc-table td[data-label="Acciones"] .cc-actions,
    .report-filter-actions {
        grid-template-columns: 1fr !important;
        display: grid !important;
    }

    .report-filter-actions .btn,
    .cc-card form .cc-actions .btn,
    .dashboard-client-search-form .btn {
        width: 100% !important;
        min-width: 0 !important;
    }
}

/* Final mobile override: these rules intentionally live last. */
.client-last-method {
    display: inline-flex !important;
    align-items: center !important;
    gap: 6px !important;
    width: fit-content !important;
    max-width: 100% !important;
    padding: 8px 11px !important;
    border-radius: 12px !important;
    background: #f1f5f9 !important;
    color: #334155 !important;
    font-size: 16px !important;
    font-weight: 850 !important;
    line-height: 1.2 !important;
}

@media (max-width: 1100px) {
    .clients-table td[data-label="Acciones"] .cc-actions,
    .clients-results-card .clients-card-table td[data-label="Acciones"] .cc-actions,
    .loan-results-card .cc-table td[data-label="Acciones"] .cc-actions {
        display: flex !important;
        flex-wrap: nowrap !important;
        gap: 8px !important;
        width: 100% !important;
        min-width: 0 !important;
        overflow-x: auto !important;
        overflow-y: hidden !important;
        padding-bottom: 4px !important;
        -webkit-overflow-scrolling: touch !important;
        scrollbar-width: thin !important;
    }

    .clients-table td[data-label="Acciones"] .btn,
    .clients-results-card .clients-card-table td[data-label="Acciones"] .btn,
    .loan-results-card .cc-table td[data-label="Acciones"] .btn {
        flex: 0 0 auto !important;
        width: auto !important;
        max-width: 150px !important;
        min-width: 0 !important;
        min-height: 46px !important;
        padding: 11px 12px !important;
        line-height: 1.15 !important;
        white-space: normal !important;
        overflow: visible !important;
    }

    .clients-table td[data-label="Acciones"] .btn-success,
    .clients-results-card .clients-card-table td[data-label="Acciones"] .btn-success,
    .loan-results-card .cc-table td[data-label="Acciones"] .btn-success {
        grid-column: auto !important;
    }

    .clients-table .payment-date-badge,
    .clients-results-card .payment-date-badge,
    .loan-results-card .payment-date-badge {
        display: inline-flex !important;
        align-items: center !important;
        width: max-content !important;
        max-width: 100% !important;
        gap: 6px !important;
        border-radius: 999px !important;
        white-space: normal !important;
    }
}
.cc-inline-form {
  display: inline-flex;
  margin: 0;
  min-width: 0;
}

.cc-inline-form .btn {
  width: auto;
}
