/* =========================================================
   ANALISIS IA COMERCIAL - APP.CSS
   Estilo profesional inspirado en colores Grupo PELSA
   ========================================================= */

:root {
    --bg: #f4f7fb;
    --bg-soft: #f8fafc;
    --card: #ffffff;
    --card-soft: #f9fbfd;
    --text: #172033;
    --text-strong: #0f172a;
    --muted: #6b7280;
    --muted-soft: #94a3b8;
    /* Colores Grupo PELSA */
    --primary: #ffc20e;
    --primary-dark: #e0a800;
    --primary-soft: #fff4c2;
    --secondary: #003b73;
    --secondary-dark: #001f3f;
    --secondary-soft: #e6eef8;
    --accent: #ffc20e;
    --accent-dark: #d99a00;
    --border: #e5e7eb;
    --border-strong: #d1d5db;
    --success: #15803d;
    --success-soft: #dcfce7;
    --warning: #b45309;
    --warning-soft: #fef3c7;
    --danger: #dc2626;
    --danger-soft: #fee2e2;
    --info: #0369a1;
    --info-soft: #e0f2fe;
    --shadow: 0 18px 45px rgba(15, 23, 42, .08);
    --shadow-soft: 0 8px 24px rgba(15, 23, 42, .06);
    --radius: 22px;
    --radius-md: 16px;
    --radius-sm: 12px;
}

/* -------------------------
   Base
------------------------- */
html,
body {
    font-family: 'Segoe UI', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    background: linear-gradient(180deg, #f8fbff 0%, #f3f6fb 100%);
    color: var(--text);
    min-height: 100%;
    margin: 0;
}

body {
    overflow-x: hidden;
}

a,
.btn-link {
    color: var(--secondary);
    text-decoration: none;
}

    a:hover,
    .btn-link:hover {
        color: var(--primary);
    }

.content {
    padding-top: 1.1rem;
}

h1:focus {
    outline: none;
}

.form-label {
    font-weight: 700;
    color: var(--text-strong);
    margin-bottom: 8px;
}

.form-control,
.form-select {
    border-radius: 14px;
    border: 1px solid var(--border);
    min-height: 48px;
    padding: 10px 14px;
    background: #fff;
}

    .form-control:focus,
    .form-select:focus {
        border-color: var(--secondary);
        box-shadow: 0 0 0 0.15rem rgba(16, 42, 92, .12);
    }

    .btn:focus,
    .btn:active:focus,
    .btn-link.nav-link:focus,
    .form-control:focus,
    .form-check-input:focus {
        box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem rgba(16, 42, 92, .18);
    }

/* -------------------------
   Botones
------------------------- */
.btn-primary,
button.btn-primary {
    border: 0;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #111827;
    padding: 12px 20px;
    border-radius: 14px;
    font-weight: 900;
    min-height: 48px;
    transition: .2s ease;
    box-shadow: 0 10px 24px rgba(255, 194, 14, .24);
}

    .btn-primary:hover,
    button.btn-primary:hover {
        transform: translateY(-1px);
        color: #111827;
        box-shadow: 0 14px 28px rgba(255, 194, 14, .34);
    }

    .btn-primary:disabled,
    button.btn-primary:disabled {
        opacity: .6;
        cursor: not-allowed;
    }

.btn-secondary-app {
    border: 1px solid var(--border);
    background: #fff;
    color: var(--secondary);
    padding: 12px 20px;
    border-radius: 14px;
    font-weight: 700;
    min-height: 48px;
    transition: .2s ease;
}

    .btn-secondary-app:hover {
        background: var(--secondary-soft);
        border-color: #cbd5e1;
    }

.btn-danger-app {
    border: 0;
    background: var(--danger);
    color: white;
    padding: 12px 20px;
    border-radius: 14px;
    font-weight: 700;
    min-height: 48px;
}

/* -------------------------
   Validación
------------------------- */
.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
}

.invalid {
    outline: 1px solid #e50000;
}

.validation-message {
    color: #e50000;
    font-size: .86rem;
    margin-top: 4px;
}

/* -------------------------
   Error boundary
------------------------- */
.blazor-error-boundary {
    background: #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
    border-radius: 14px;
}

    .blazor-error-boundary::after {
        content: "Ha ocurrido un error en la aplicación.";
    }

.darker-border-checkbox.form-check-input {
    border-color: #929292;
}

.form-floating > .form-control-plaintext::placeholder,
.form-floating > .form-control::placeholder {
    color: var(--bs-secondary-color);
    text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder,
.form-floating > .form-control:focus::placeholder {
    text-align: start;
}

/* -------------------------
   Layout general
------------------------- */
.page-shell {
    width: min(1280px, 100%);
    margin: 0 auto;
    padding: 28px;
}

.page-header {
    margin-bottom: 22px;
}

.page-title {
    margin: 0;
    font-size: clamp(1.7rem, 4vw, 2.8rem);
    font-weight: 900;
    color: var(--text-strong);
}

.page-subtitle {
    margin: 8px 0 0;
    color: var(--muted);
    font-size: 1rem;
}

/* -------------------------
   Hero principal
------------------------- */
.hero-card {
    background: linear-gradient(120deg, var(--secondary-dark) 0%, var(--secondary) 58%, #0b5fa5 100%);
    color: white;
    border-radius: var(--radius);
    padding: 34px;
    box-shadow: 0 24px 55px rgba(0, 59, 115, .18);
    margin-bottom: 22px;
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(255,255,255,.08);
}

    .hero-card::before {
        content: "";
        position: absolute;
        inset: 0;
        background: radial-gradient(circle at top right, rgba(255, 194, 14, .22), transparent 34%);
        pointer-events: none;
    }

    .hero-card::after {
        content: "";
        position: absolute;
        width: 260px;
        height: 260px;
        right: -80px;
        top: -80px;
        background: rgba(255, 194, 14, .18);
        border-radius: 50%;
    }

    .hero-card h1 {
        margin: 0;
        font-size: clamp(2rem, 4vw, 3.2rem);
        font-weight: 900;
        letter-spacing: -.03em;
        line-height: 1.05;
    }

.eyebrow {
    margin: 0 0 10px;
    text-transform: uppercase;
    letter-spacing: .16em;
    font-size: .78rem;
    opacity: .8;
    font-weight: 800;
}

.muted {
    color: var(--muted);
}

.hero-card .muted {
    color: rgba(255,255,255,.82);
    max-width: 680px;
}

.small {
    font-size: .86rem;
}

/* -------------------------
   Tarjetas generales
------------------------- */
.search-card,
.alert-card,
.client-card,
.kpi-card,
.panel-card,
.table-card {
    background: rgba(255,255,255,.92);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(226, 232, 240, .9);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.panel-card {
    padding: 24px;
    margin-bottom: 18px;
}

.panel-title {
    margin: 0 0 14px;
    font-size: 1.15rem;
    font-weight: 900;
    color: var(--text-strong);
}

/* -------------------------
   Buscador
------------------------- */
.search-card {
    padding: 22px;
    margin-bottom: 22px;
}

.search-row {
    display: flex;
    gap: 14px;
    align-items: center;
}

.search-input {
    min-height: 50px;
    border-radius: 16px;
}

/* -------------------------
   Alertas
------------------------- */
.alert-card {
    padding: 16px 18px;
    margin-bottom: 18px;
    color: var(--warning);
    background: var(--warning-soft);
    border-color: #fde68a;
}

.alert-danger-app {
    color: var(--danger);
    background: var(--danger-soft);
    border-color: #fecaca;
}

.alert-success-app {
    color: var(--success);
    background: var(--success-soft);
    border-color: #bbf7d0;
}

/* -------------------------
   Grid de clientes
------------------------- */
.client-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 22px;
}

.client-card {
    padding: 20px;
    cursor: pointer;
    transition: .25s ease;
    position: relative;
    overflow: hidden;
}

    .client-card::before {
        content: "";
        position: absolute;
        inset: 0 auto 0 0;
        width: 5px;
        background: linear-gradient(180deg, var(--secondary), var(--primary));
        border-radius: 12px;
    }

    .client-card:hover {
        transform: translateY(-5px);
        box-shadow: 0 25px 55px rgba(15, 23, 42, .12);
    }

.client-card-header {
    display: flex;
    align-items: start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
}

.client-card h3 {
    margin: 0;
    font-size: 1.08rem;
    font-weight: 900;
    color: var(--text-strong);
    line-height: 1.25;
}

.client-card p {
    margin: 4px 0 0;
    color: var(--muted);
}

.badge {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 7px 12px;
    background: var(--primary-soft);
    color: #7a4f00;
    font-size: .78rem;
    font-weight: 900;
    white-space: nowrap;
    border: 1px solid rgba(255, 194, 14, .45);
}

.badge-success {
    background: var(--success-soft);
    color: var(--success);
}

.badge-warning {
    background: var(--warning-soft);
    color: var(--warning);
}

.badge-info {
    background: var(--secondary-soft);
    color: var(--secondary);
}

.client-metrics {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 14px;
}

    .client-metrics div {
        background: linear-gradient(180deg, #ffffff, #f8fafc);
        border: 1px solid #eef2f7;
        border-radius: 16px;
        padding: 14px;
    }

    .client-metrics span {
        display: block;
        font-size: .78rem;
        color: var(--muted);
        font-weight: 600;
    }

    .client-metrics strong {
        display: block;
        margin-top: 6px;
        font-size: 1rem;
        color: var(--secondary);
        font-weight: 900;
    }

/* -------------------------
   KPIs
------------------------- */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 18px;
}

.kpi-card {
    padding: 18px;
}

.kpi-label {
    display: block;
    color: var(--muted);
    font-size: .82rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .06em;
}

.kpi-value {
    display: block;
    margin-top: 8px;
    font-size: clamp(1.4rem, 3vw, 2.1rem);
    font-weight: 900;
    color: var(--secondary);
}

.kpi-note {
    display: block;
    margin-top: 4px;
    font-size: .86rem;
    color: var(--muted);
}

/* -------------------------
   Tablas
------------------------- */
.table-card {
    overflow: hidden;
    margin-bottom: 18px;
}

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

.table-app {
    width: 100%;
    border-collapse: collapse;
    font-size: .92rem;
}

    .table-app th {
        background: linear-gradient(180deg, #f8fbff, #f1f5f9);
        color: var(--secondary);
        font-size: .78rem;
        text-transform: uppercase;
        letter-spacing: .06em;
        padding: 14px;
        border-bottom: 1px solid var(--border);
        white-space: nowrap;
        font-weight: 900;
    }

    .table-app td {
        padding: 14px;
        border-bottom: 1px solid var(--border);
        color: var(--text);
        vertical-align: middle;
    }

    .table-app tr:hover td {
        background: #fafcff;
    }

    .table-app tr:last-child td {
        border-bottom: 0;
    }

.text-right {
    text-align: right;
}

.text-success-app {
    color: var(--success);
    font-weight: 800;
}

.text-danger-app {
    color: var(--danger);
    font-weight: 800;
}

.text-muted-app {
    color: var(--muted);
}

/* -------------------------
   Acciones
------------------------- */
.action-row {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
    margin-top: 18px;
}

/* -------------------------
   Login futuro
------------------------- */
.login-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
    background: linear-gradient(135deg, var(--secondary-dark), var(--secondary), var(--primary-dark));
}

.login-card {
    width: min(460px, 100%);
    background: white;
    border-radius: 28px;
    box-shadow: 0 25px 80px rgba(0,0,0,.25);
    padding: 32px;
}

.login-title {
    margin: 0;
    font-size: 2rem;
    font-weight: 900;
    color: var(--secondary);
}

.login-subtitle {
    margin: 8px 0 24px;
    color: var(--muted);
}

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

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

    .page-shell {
        padding: 20px;
    }
}

@media (max-width: 640px) {
    .page-shell {
        padding: 14px;
    }

    .hero-card {
        padding: 24px;
    }

    .search-row {
        flex-direction: column;
        align-items: stretch;
    }

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

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

    .hero-card,
    .search-card,
    .client-card,
    .kpi-card,
    .panel-card,
    .table-card {
        border-radius: 18px;
    }

    .client-card-header {
        flex-direction: column;
    }

    .badge {
        align-self: flex-start;
    }

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

    .action-row {
        flex-direction: column;
        align-items: stretch;
    }

        .action-row button,
        .action-row a {
            width: 100%;
            text-align: center;
        }
}

@media print {
    body {
        background: white;
    }

    .no-print {
        display: none !important;
    }

    .page-shell {
        width: 100%;
        padding: 0;
    }

    .hero-card,
    .search-card,
    .client-card,
    .kpi-card,
    .panel-card,
    .table-card {
        box-shadow: none;
    }
}

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

.process-card {
    background: linear-gradient(180deg, #ffffff, #f8fafc);
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 18px;
}

    .process-card span {
        width: 36px;
        height: 36px;
        display: inline-grid;
        place-items: center;
        border-radius: 999px;
        background: linear-gradient(135deg, var(--secondary), var(--primary));
        color: white;
        font-weight: 900;
        margin-bottom: 12px;
    }

    .process-card strong {
        display: block;
        color: var(--text-strong);
        font-size: 1rem;
        margin-bottom: 6px;
    }

    .process-card p {
        color: var(--muted);
        margin: 0;
        font-size: .9rem;
    }

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

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

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

    .summary-grid div {
        background: linear-gradient(180deg, #ffffff, #f8fafc);
        border: 1px solid var(--border);
        border-radius: 16px;
        padding: 16px;
    }

    .summary-grid span {
        display: block;
        color: var(--muted);
        font-size: .82rem;
        font-weight: 700;
    }

    .summary-grid strong {
        display: block;
        color: var(--secondary);
        margin-top: 6px;
        font-size: 1.8rem;
        font-weight: 900;
    }

.table-header-app {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 22px;
    border-bottom: 1px solid var(--border);
}

    .table-header-app h2 {
        margin: 0;
        color: var(--secondary);
        font-size: 1.15rem;
        font-weight: 900;
    }

    .table-header-app p {
        margin: 4px 0 0;
        color: var(--muted);
        font-size: .9rem;
    }

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

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

    .table-header-app {
        padding: 16px;
    }
}

.mora-box {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 14px;
    border-radius: 16px;
    padding: 10px;
    border: 1px solid transparent;
}

    .mora-box div {
        border-radius: 12px;
        padding: 10px;
    }

    .mora-box span {
        display: block;
        font-size: .72rem;
        font-weight: 800;
        text-transform: uppercase;
        letter-spacing: .04em;
    }

    .mora-box strong {
        display: block;
        margin-top: 4px;
        font-size: .95rem;
        font-weight: 900;
    }

.mora-danger {
    background: #fff1f2;
    border-color: #fecdd3;
}

    .mora-danger div {
        background: #ffffff;
    }

    .mora-danger span {
        color: #be123c;
    }

    .mora-danger strong {
        color: #9f1239;
    }

.mora-ok {
    grid-template-columns: 1fr;
    background: #ecfdf5;
    border-color: #bbf7d0;
}

    .mora-ok div {
        background: #ffffff;
    }

    .mora-ok span {
        color: #15803d;
    }

    .mora-ok strong {
        color: #166534;
    }

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

.tabs-shell {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding-bottom: 8px;
    margin: 18px 0 22px;
}

.tab-btn {
    border: 1px solid var(--border);
    background: white;
    color: var(--secondary);
    padding: 12px 18px;
    border-radius: 14px;
    font-weight: 800;
    white-space: nowrap;
    transition: .2s ease;
}

    .tab-btn:hover {
        background: var(--secondary-soft);
    }

    .tab-btn.active {
        background: linear-gradient(135deg, var(--secondary), var(--secondary-dark));
        color: white;
        border-color: var(--secondary);
    }

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

.annual-card {
    background: linear-gradient(180deg, #ffffff, #f8fafc);
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 18px;
}

.annual-year {
    display: block;
    color: var(--muted);
    font-size: .82rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .05em;
}

.annual-card strong {
    display: block;
    margin-top: 8px;
    font-size: 1.6rem;
    color: var(--secondary);
    font-weight: 900;
}

.annual-card small {
    display: block;
    margin-top: 6px;
    color: var(--muted);
}

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

@media (max-width: 640px) {
    .tab-btn {
        padding: 10px 14px;
        font-size: .92rem;
    }
}

.tabs-shell {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding-bottom: 8px;
    margin: 18px 0 22px;
}

.tab-btn {
    border: 1px solid var(--border);
    background: white;
    color: var(--secondary);
    padding: 12px 18px;
    border-radius: 14px;
    font-weight: 900;
    white-space: nowrap;
    transition: .2s ease;
}

    .tab-btn:hover {
        background: var(--secondary-soft);
    }

    .tab-btn.active {
        background: linear-gradient(135deg, var(--secondary), var(--secondary-dark));
        color: white;
        border-color: var(--secondary);
        box-shadow: inset 0 -4px 0 var(--primary);
    }

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

.annual-card {
    background: linear-gradient(180deg, #ffffff, #f8fafc);
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 18px;
}

.annual-year {
    display: block;
    color: var(--muted);
    font-size: .82rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .05em;
}

.annual-card strong {
    display: block;
    margin-top: 8px;
    font-size: 1.6rem;
    color: var(--secondary);
    font-weight: 900;
}

.annual-card small {
    display: block;
    margin-top: 6px;
    color: var(--muted);
}

.chart-grid {
    display: grid;
    grid-template-columns: 1.3fr .7fr;
    gap: 18px;
}

.simple-bars {
    display: grid;
    gap: 14px;
    margin-top: 18px;
}

.bar-row {
    display: grid;
    grid-template-columns: 58px 1fr 110px;
    gap: 12px;
    align-items: center;
}

    .bar-row span {
        font-weight: 900;
        color: var(--secondary);
    }

    .bar-row strong {
        text-align: right;
        color: var(--text-strong);
    }

.bar-track {
    height: 14px;
    border-radius: 999px;
    background: #e5eaf2;
    overflow: hidden;
}

.bar-fill {
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--secondary), var(--primary));
}

.monthly-chart {
    height: 260px;
    display: grid;
    grid-template-columns: repeat(12, minmax(48px, 1fr));
    gap: 10px;
    align-items: end;
    overflow-x: auto;
    padding: 22px 0 8px;
}

.month-group {
    min-width: 48px;
    display: grid;
    gap: 8px;
    justify-items: center;
}

.month-bars {
    height: 210px;
    display: flex;
    align-items: end;
    gap: 5px;
}

.mini-bar {
    width: 10px;
    min-height: 4px;
    border-radius: 999px 999px 4px 4px;
    display: block;
}

.year-1,
.legend-year-1 {
    background: #94a3b8;
}

.year-2,
.legend-year-2 {
    background: #003b73;
}

.year-3,
.legend-year-3 {
    background: #ffc20e;
}

.month-group small {
    color: var(--muted);
    font-weight: 800;
    font-size: .72rem;
}

.chart-legend {
    display: flex;
    gap: 18px;
    flex-wrap: wrap;
    margin-top: 12px;
}

    .chart-legend span {
        display: inline-flex;
        align-items: center;
        gap: 8px;
        color: var(--muted);
        font-weight: 800;
    }

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

.visit-card {
    display: grid;
    gap: 12px;
    margin-top: 14px;
}

    .visit-card div {
        background: linear-gradient(180deg, #ffffff, #f8fafc);
        border: 1px solid var(--border);
        border-radius: 16px;
        padding: 16px;
    }

    .visit-card span {
        display: block;
        color: var(--muted);
        font-size: .78rem;
        font-weight: 800;
        text-transform: uppercase;
        letter-spacing: .05em;
    }

    .visit-card strong {
        display: block;
        margin-top: 6px;
        color: var(--secondary);
        font-size: 1rem;
        font-weight: 900;
    }

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

.ia-preview-card {
    background: linear-gradient(180deg, #ffffff, #f8fafc);
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 18px;
}

    .ia-preview-card span {
        display: block;
        color: var(--muted);
        font-size: .78rem;
        font-weight: 900;
        text-transform: uppercase;
        letter-spacing: .05em;
    }

    .ia-preview-card strong {
        display: block;
        margin-top: 8px;
        color: var(--secondary);
        font-size: 1.15rem;
        font-weight: 900;
    }

    .ia-preview-card p {
        color: var(--muted);
        margin: 8px 0 0;
    }

@media (max-width: 980px) {
    .annual-grid,
    .chart-grid,
    .ia-preview-grid {
        grid-template-columns: 1fr;
    }

    .bar-row {
        grid-template-columns: 50px 1fr 90px;
    }
}

@media (max-width: 640px) {
    .tabs-shell {
        margin-top: 14px;
    }

    .tab-btn {
        padding: 10px 14px;
        font-size: .9rem;
    }

    .monthly-chart {
        grid-template-columns: repeat(12, 46px);
    }

    .bar-row {
        grid-template-columns: 1fr;
        gap: 6px;
    }

        .bar-row strong {
            text-align: left;
        }
}

.ia-main-text {
    font-size: 1.08rem;
    line-height: 1.7;
    color: var(--text);
    margin: 0;
}

.ia-kpi-text {
    font-size: 1.05rem !important;
    line-height: 1.35;
}

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

.ia-list {
    margin: 0;
    padding-left: 1.2rem;
    display: grid;
    gap: 10px;
    color: var(--text);
}

    .ia-list li {
        line-height: 1.5;
    }

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

.question-card {
    background: linear-gradient(180deg, #ffffff, #f8fafc);
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 18px;
}

    .question-card strong {
        display: block;
        color: var(--secondary);
        font-size: 1rem;
        line-height: 1.4;
    }

    .question-card span {
        display: block;
        margin-top: 8px;
        color: var(--muted);
        font-size: .92rem;
        line-height: 1.45;
    }

@media (max-width: 980px) {
    .ia-grid-2,
    .question-grid {
        grid-template-columns: 1fr;
    }
}

.mix-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    padding: 4px 8px;
    border-radius: 999px;
    font-size: .75rem;
    font-weight: 900;
    margin-left: 4px;
}

    .mix-badge.lost {
        background: #fee2e2;
        color: #b91c1c;
    }

    .mix-badge.cont {
        background: #e6eef8;
        color: #003b73;
    }

    .mix-badge.new {
        background: #dcfce7;
        color: #15803d;
    }

.summary-grid small {
    display: block;
    margin-top: 4px;
    color: var(--muted);
    font-size: .78rem;
}

.chart-box {
    position: relative;
    width: 100%;
    height: 320px;
    margin-top: 14px;
}

.chart-box-large {
    height: 390px;
}

@media (max-width: 640px) {
    .chart-box {
        height: 280px;
    }

    .chart-box-large {
        height: 330px;
    }
}

/* ===== Correcciones graficas Chart.js ===== */
.chart-box {
    position: relative;
    width: 100%;
    height: 320px;
    margin-top: 14px;
}

.chart-box-large {
    height: 390px;
}

.chart-box canvas {
    width: 100% !important;
    height: 100% !important;
    display: block;
}

@media (max-width: 640px) {
    .chart-box {
        height: 280px;
    }

    .chart-box-large {
        height: 330px;
    }
}

/* =========================================================
   Buscador profesional clientes - responsive
   ========================================================= */

.search-card-clientes {
    width: 100%;
    padding: 22px;
}

.search-label {
    display: block;
    margin-bottom: 10px;
}

.search-row-clientes {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 128px;
    gap: 14px;
    align-items: stretch;
    width: 100%;
}

.search-input-clientes {
    width: 100% !important;
    max-width: none !important;
    min-width: 0;
    height: 56px;
    border-radius: 16px;
    padding: 0 18px;
    font-size: 1rem;
    box-sizing: border-box;
}

.search-button-clientes {
    width: 128px;
    min-width: 128px;
    height: 56px;
    padding: 0 18px;
    border-radius: 16px;
    white-space: nowrap;
    box-sizing: border-box;
}

/* Tablet */
@media (max-width: 900px) {
    .search-row-clientes {
        grid-template-columns: minmax(0, 1fr) 120px;
    }

    .search-button-clientes {
        width: 120px;
        min-width: 120px;
    }
}

/* Móvil */
@media (max-width: 640px) {
    .search-card-clientes {
        padding: 18px;
    }

    .search-row-clientes {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .search-input-clientes {
        height: 56px;
        font-size: .95rem;
    }

    .search-button-clientes {
        width: 100%;
        min-width: 0;
        height: 56px;
    }
}

/* =========================================================
   Loading profesional PELSA
   ========================================================= */

.loading-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: grid;
    place-items: center;
    padding: 24px;
    background: rgba(244, 247, 251, .72);
    backdrop-filter: blur(10px);
    animation: loadingFadeIn .18s ease-out;
}

.loading-card {
    width: min(460px, 100%);
    background: rgba(255, 255, 255, .96);
    border: 1px solid rgba(226, 232, 240, .95);
    border-radius: 28px;
    box-shadow: 0 28px 80px rgba(15, 23, 42, .18);
    padding: 34px 30px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

    .loading-card::before {
        content: "";
        position: absolute;
        inset: 0;
        background: radial-gradient(circle at top right, rgba(255, 194, 14, .22), transparent 32%), radial-gradient(circle at bottom left, rgba(0, 59, 115, .12), transparent 34%);
        pointer-events: none;
    }

.loading-logo {
    width: 84px;
    height: 84px;
    margin: 0 auto 18px;
    border-radius: 28px;
    display: grid;
    place-items: center;
    position: relative;
    background: linear-gradient(135deg, var(--secondary-dark), var(--secondary));
    box-shadow: 0 20px 36px rgba(0, 59, 115, .25);
}

    .loading-logo::before,
    .loading-logo::after {
        content: "";
        position: absolute;
        inset: -8px;
        border-radius: 34px;
        border: 2px solid rgba(255, 194, 14, .35);
        animation: loadingPulse 1.6s ease-out infinite;
    }

    .loading-logo::after {
        animation-delay: .55s;
    }

.bolt {
    position: relative;
    z-index: 2;
    font-size: 2.5rem;
    filter: drop-shadow(0 8px 16px rgba(255, 194, 14, .35));
    animation: boltFloat 1.4s ease-in-out infinite;
}

.loading-title {
    position: relative;
    z-index: 2;
    font-size: 1.35rem;
    font-weight: 900;
    color: var(--secondary);
    margin-bottom: 8px;
}

.loading-text {
    position: relative;
    z-index: 2;
    color: var(--muted);
    font-size: .98rem;
    line-height: 1.55;
    max-width: 360px;
    margin: 0 auto 22px;
}

.loading-progress {
    position: relative;
    z-index: 2;
    height: 10px;
    border-radius: 999px;
    background: #e5eaf2;
    overflow: hidden;
    margin: 0 auto 18px;
}

    .loading-progress span {
        display: block;
        height: 100%;
        width: 45%;
        border-radius: 999px;
        background: linear-gradient(90deg, var(--secondary), var(--primary), var(--secondary));
        animation: loadingBar 1.45s ease-in-out infinite;
    }

.loading-dots {
    position: relative;
    z-index: 2;
    display: inline-flex;
    gap: 7px;
    align-items: center;
    justify-content: center;
}

    .loading-dots i {
        width: 9px;
        height: 9px;
        border-radius: 999px;
        background: var(--primary);
        animation: loadingDot 1s ease-in-out infinite;
    }

        .loading-dots i:nth-child(2) {
            animation-delay: .15s;
        }

        .loading-dots i:nth-child(3) {
            animation-delay: .3s;
        }

@keyframes loadingFadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes loadingPulse {
    0% {
        transform: scale(.88);
        opacity: .85;
    }

    100% {
        transform: scale(1.25);
        opacity: 0;
    }
}

@keyframes boltFloat {
    0%, 100% {
        transform: translateY(0) scale(1);
    }

    50% {
        transform: translateY(-4px) scale(1.04);
    }
}

@keyframes loadingBar {
    0% {
        transform: translateX(-110%);
    }

    50% {
        transform: translateX(60%);
    }

    100% {
        transform: translateX(230%);
    }
}

@keyframes loadingDot {
    0%, 100% {
        transform: translateY(0);
        opacity: .45;
    }

    50% {
        transform: translateY(-5px);
        opacity: 1;
    }
}

@media (max-width: 640px) {
    .loading-card {
        padding: 28px 22px;
        border-radius: 24px;
    }

    .loading-logo {
        width: 74px;
        height: 74px;
        border-radius: 24px;
    }

    .loading-title {
        font-size: 1.18rem;
    }

    .loading-text {
        font-size: .92rem;
    }
}

/* =========================================================
   Corrección responsive móvil general
   ========================================================= */

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

.page,
main,
.content {
    max-width: 100%;
    overflow-x: hidden;
}

.page-shell {
    width: 100%;
    max-width: 1280px;
    box-sizing: border-box;
    margin-left: auto;
    margin-right: auto;
}

/* Evita que títulos largos de clientes rompan el ancho móvil */
.hero-card {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

    .hero-card h1 {
        max-width: 100%;
        overflow-wrap: anywhere;
        word-break: normal;
    }

/* Botones principales */
.action-row {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

/* Pestañas */
.tabs-shell {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
}

/* Tarjetas, tablas y gráficos */
.panel-card,
.table-card,
.kpi-card,
.search-card,
.client-card,
.chart-box {
    max-width: 100%;
    box-sizing: border-box;
}

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

/* =========================================================
   Vista móvil
   ========================================================= */

@media (max-width: 640px) {
    .content {
        padding-left: 0 !important;
        padding-right: 0 !important;
    }

    .page-shell {
        padding: 14px;
        width: 100%;
        max-width: 100%;
    }

    .hero-card {
        padding: 24px 20px;
        border-radius: 22px;
        text-align: left;
    }

        .hero-card h1 {
            font-size: clamp(1.75rem, 9vw, 2.45rem);
            line-height: 1.08;
            letter-spacing: -0.04em;
        }

        .hero-card .muted {
            font-size: .95rem;
            line-height: 1.45;
        }

    .action-row {
        display: grid;
        grid-template-columns: 1fr;
        gap: 10px;
        align-items: stretch;
    }

        .action-row button,
        .action-row a {
            width: 100%;
            min-width: 0;
            justify-content: center;
            text-align: center;
            box-sizing: border-box;
        }

    .tabs-shell {
        display: flex;
        gap: 8px;
        padding-bottom: 8px;
        margin-top: 14px;
        margin-bottom: 18px;
    }

    .tab-btn {
        flex: 0 0 auto;
        padding: 10px 14px;
        font-size: .9rem;
    }

    .kpi-grid,
    .summary-grid,
    .chart-grid,
    .annual-grid,
    .ia-grid-2,
    .question-grid {
        grid-template-columns: 1fr !important;
    }

    .panel-card,
    .table-card,
    .kpi-card {
        border-radius: 18px;
    }

    .chart-box,
    .chart-box-large {
        height: 300px;
    }

    .seller-chip {
        max-width: 100%;
    }
}

/* =========================================================
   Login profesional con Chepe PELSA
   ========================================================= */

.login-shell-pelsa {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 28px;
    background: radial-gradient(circle at top left, rgba(255, 194, 14, .16), transparent 26%), radial-gradient(circle at bottom right, rgba(0, 59, 115, .18), transparent 30%), linear-gradient(135deg, #f8fbff, #eef4fb);
}

.login-card-pelsa {
    width: min(980px, 100%);
    display: grid;
    grid-template-columns: 1.05fr .95fr;
    background: rgba(255,255,255,.96);
    border: 1px solid rgba(226,232,240,.95);
    border-radius: 32px;
    box-shadow: 0 35px 90px rgba(15,23,42,.18);
    overflow: hidden;
}

.login-form-panel {
    padding: 42px;
}

    .login-form-panel h1 {
        margin: 0;
        color: var(--secondary);
        font-size: clamp(2rem, 4vw, 3rem);
        font-weight: 900;
        letter-spacing: -.04em;
    }

.login-eyebrow {
    color: var(--secondary);
}

.login-subtitle-pro {
    color: var(--muted);
    line-height: 1.55;
    margin: 12px 0 28px;
}

.login-field {
    display: grid;
    gap: 8px;
    margin-bottom: 16px;
}

    .login-field label {
        color: var(--text-strong);
        font-weight: 900;
        font-size: .92rem;
    }

.login-input {
    height: 54px;
    border-radius: 16px;
}

.login-button {
    width: 100%;
    margin-top: 8px;
}

.login-alert {
    background: #fff4c2;
    border: 1px solid rgba(255, 194, 14, .65);
    color: #7a4f00;
    border-radius: 16px;
    padding: 12px 14px;
    font-weight: 700;
    margin-bottom: 18px;
}

.login-help {
    margin-top: 18px;
    color: var(--muted);
    font-size: .9rem;
}

.login-character-panel {
    position: relative;
    background: radial-gradient(circle at top right, rgba(255,255,255,.20), transparent 32%), linear-gradient(150deg, #001f3f, #003b73 64%, #0b5fa5);
    display: grid;
    place-items: center;
    padding: 34px;
    overflow: hidden;
}

    .login-character-panel::after {
        content: "";
        position: absolute;
        right: -70px;
        top: -70px;
        width: 260px;
        height: 260px;
        border-radius: 50%;
        background: rgba(255, 194, 14, .22);
    }

.chepe-glow {
    position: absolute;
    width: 340px;
    height: 340px;
    border-radius: 50%;
    background: rgba(255, 194, 14, .18);
    filter: blur(20px);
}

.chepe-img {
    position: relative;
    z-index: 2;
    max-height: 420px;
    max-width: 82%;
    object-fit: contain;
    filter: drop-shadow(0 25px 35px rgba(0,0,0,.28));
    animation: chepeFloat 3s ease-in-out infinite;
}

.chepe-message {
    position: absolute;
    z-index: 3;
    left: 28px;
    bottom: 28px;
    right: 28px;
    background: rgba(255,255,255,.94);
    border: 1px solid rgba(255,255,255,.75);
    border-radius: 20px;
    padding: 16px;
    box-shadow: 0 15px 35px rgba(0,0,0,.14);
}

    .chepe-message strong {
        display: block;
        color: var(--secondary);
        font-size: 1.1rem;
        margin-bottom: 4px;
    }

    .chepe-message span {
        display: block;
        color: var(--muted);
        line-height: 1.35;
    }

@keyframes chepeFloat {
    0%, 100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-8px);
    }
}

@media (max-width: 820px) {
    .login-card-pelsa {
        grid-template-columns: 1fr;
    }

    .login-character-panel {
        min-height: 360px;
        order: -1;
    }

    .chepe-img {
        max-height: 280px;
    }

    .login-form-panel {
        padding: 30px 24px;
    }
}

@media (max-width: 520px) {
    .login-shell-pelsa {
        padding: 16px;
    }

    .login-card-pelsa {
        border-radius: 24px;
    }

    .login-character-panel {
        min-height: 300px;
        padding: 20px;
    }

    .chepe-message {
        position: relative;
        left: auto;
        right: auto;
        bottom: auto;
        margin-top: 14px;
    }

    .chepe-img {
        max-height: 220px;
    }
}
/* =========================================================
   Login seguro PELSA - layout vacío
   ========================================================= */

.login-door-shell {
    min-height: 100vh;
    width: 100%;
    display: grid;
    place-items: center;
    padding: 32px;
    background: radial-gradient(circle at top left, rgba(255, 194, 14, .18), transparent 26%), radial-gradient(circle at bottom right, rgba(0, 59, 115, .20), transparent 34%), linear-gradient(135deg, #f8fbff, #eef4fb);
    overflow-x: hidden;
}

.login-door-card {
    width: min(1180px, 100%);
    display: grid;
    grid-template-columns: 1.08fr .92fr;
    background: rgba(255,255,255,.96);
    border: 1px solid rgba(226,232,240,.95);
    border-radius: 34px;
    box-shadow: 0 36px 95px rgba(15,23,42,.18);
    overflow: hidden;
}



.login-door-form {
    padding: 54px 50px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    background: radial-gradient(circle at top right, rgba(255, 194, 14, .12), transparent 28%), #ffffff;
}

.login-brand-mini {
    margin-bottom: 24px;
}

    .login-brand-mini img {
        width: 145px;
        height: auto;
        display: block;
    }

.login-eyebrow {
    color: var(--secondary);
}

.login-door-form h1 {
    margin: 0;
    color: var(--secondary);
    font-size: clamp(2.3rem, 4vw, 3.4rem);
    font-weight: 950;
    letter-spacing: -.05em;
    line-height: 1;
}

.login-door-subtitle {
    color: var(--muted);
    line-height: 1.6;
    margin: 16px 0 30px;
    max-width: 430px;
    font-size: 1rem;
}

.login-field {
    display: grid;
    gap: 8px;
    margin-bottom: 17px;
}

    .login-field label {
        color: var(--text-strong);
        font-weight: 900;
        font-size: .92rem;
    }

.login-input {
    height: 58px;
    border-radius: 18px;
    padding-left: 18px;
    font-size: 1rem;
}

    .login-input:focus {
        border-color: var(--primary);
        box-shadow: 0 0 0 .22rem rgba(255, 194, 14, .24);
    }

.login-button {
    width: 100%;
    min-height: 58px;
    margin-top: 8px;
    font-size: 1rem;
}

.login-alert {
    background: #fff4c2;
    border: 1px solid rgba(255, 194, 14, .65);
    color: #7a4f00;
    border-radius: 16px;
    padding: 13px 15px;
    font-weight: 800;
    margin-bottom: 20px;
}

.login-secure-note {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 22px;
    color: var(--muted);
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 14px;
}

    .login-secure-note span {
        width: 40px;
        height: 40px;
        border-radius: 999px;
        display: grid;
        place-items: center;
        background: var(--primary-soft);
    }

    .login-secure-note strong {
        display: block;
        color: var(--secondary);
        font-size: .95rem;
    }

    .login-secure-note small {
        display: block;
        margin-top: 2px;
    }

@media (max-width: 980px) {
    .login-door-card {
        grid-template-columns: 1fr;
    }

    .login-door-image {
        min-height: 420px;
    }

    .login-door-form {
        padding: 38px 30px;
    }
}

@media (max-width: 640px) {
    .login-door-shell {
        padding: 14px;
        place-items: start center;
    }

    .login-door-card {
        border-radius: 26px;
    }

    .login-door-image {
        min-height: 280px;
    }

    .login-door-form {
        padding: 28px 22px;
    }

    .login-brand-mini img {
        width: 120px;
    }

    .login-door-form h1 {
        font-size: 2.25rem;
    }
}

/* =========================================================
   Pantalla protegida sin sesión
   ========================================================= */

.protected-empty-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
    background: radial-gradient(circle at top left, rgba(255, 194, 14, .16), transparent 30%), linear-gradient(135deg, #f8fbff, #eef4fb);
}

.protected-card {
    width: min(520px, 100%);
    text-align: center;
    background: rgba(255,255,255,.96);
    border: 1px solid var(--border);
    border-radius: 28px;
    padding: 36px;
    box-shadow: 0 28px 75px rgba(15,23,42,.16);
}

.protected-icon {
    width: 84px;
    height: 84px;
    margin: 0 auto 18px;
    display: grid;
    place-items: center;
    border-radius: 28px;
    background: var(--primary-soft);
    font-size: 2.6rem;
}

.protected-card h1 {
    color: var(--secondary);
    font-size: 2rem;
    font-weight: 950;
    margin: 0 0 10px;
}

.protected-card p {
    color: var(--muted);
    margin: 0 0 22px;
}

.protected-login-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}

    .protected-login-link:hover {
        color: #111827;
        text-decoration: none;
    }


/* =========================================================
   Login visual corregido: Chepe como entrada, sin formulario duplicado
   ========================================================= */

.login-door-card {
    width: min(1120px, 100%);
    display: grid;
    grid-template-columns: 1fr .88fr;
    background: rgba(255,255,255,.98);
    border: 1px solid rgba(226,232,240,.95);
    border-radius: 34px;
    box-shadow: 0 36px 95px rgba(15,23,42,.18);
    overflow: hidden;
}

.login-door-visual {
    position: relative;
    min-height: 640px;
    background: linear-gradient(135deg, #001f3f, #003b73);
    overflow: hidden;
}

.login-door-visual-bg {
    position: absolute;
    inset: 0;
    background-image: linear-gradient(90deg, rgba(0,31,63,.12), rgba(0,31,63,.08)), url('/images/login-pelsa-door.png');
    background-repeat: no-repeat;
    background-size: 185% auto;
    background-position: left center;
    transform: scale(1.02);
}

/* Capa elegante para ocultar cualquier parte del formulario falso de la imagen */
.login-door-visual::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, rgba(0,31,63,0) 0%, rgba(0,31,63,.12) 50%, rgba(0,31,63,.75) 100%), radial-gradient(circle at bottom left, rgba(255,194,14,.18), transparent 35%);
    pointer-events: none;
}

.login-door-caption {
    position: absolute;
    left: 34px;
    right: 34px;
    bottom: 34px;
    z-index: 2;
    background: rgba(255,255,255,.92);
    border: 1px solid rgba(255,255,255,.75);
    border-radius: 22px;
    padding: 18px 20px;
    box-shadow: 0 18px 42px rgba(0,0,0,.18);
}

    .login-door-caption span {
        display: block;
        color: #7a4f00;
        font-size: .78rem;
        font-weight: 900;
        text-transform: uppercase;
        letter-spacing: .08em;
        margin-bottom: 5px;
    }

    .login-door-caption strong {
        display: block;
        color: #003b73;
        line-height: 1.35;
        font-size: 1.05rem;
    }

.login-door-form {
    padding: 54px 50px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    background: radial-gradient(circle at top right, rgba(255, 194, 14, .12), transparent 28%), #ffffff;
}

.login-brand-mini img {
    width: 150px;
    height: auto;
    display: block;
}

@media (max-width: 980px) {
    .login-door-card {
        grid-template-columns: 1fr;
    }

    .login-door-visual {
        min-height: 360px;
    }

    .login-door-visual-bg {
        background-size: 145% auto;
        background-position: left 38%;
    }

    .login-door-form {
        padding: 38px 30px;
    }
}

@media (max-width: 640px) {
    .login-door-shell {
        padding: 14px;
    }

    .login-door-card {
        border-radius: 26px;
    }

    .login-door-visual {
        min-height: 270px;
    }

    .login-door-visual-bg {
        background-size: 170% auto;
        background-position: left center;
    }

    .login-door-caption {
        left: 18px;
        right: 18px;
        bottom: 18px;
        padding: 14px 16px;
    }

        .login-door-caption strong {
            font-size: .92rem;
        }

    .login-door-form {
        padding: 28px 22px;
    }

    .login-brand-mini img {
        width: 120px;
    }
}


/* =========================================================
   Login visual corregido: Chepe como entrada, sin formulario duplicado
   ========================================================= */

.login-door-card {
    width: min(1120px, 100%);
    display: grid;
    grid-template-columns: 1fr .88fr;
    background: rgba(255,255,255,.98);
    border: 1px solid rgba(226,232,240,.95);
    border-radius: 34px;
    box-shadow: 0 36px 95px rgba(15,23,42,.18);
    overflow: hidden;
}

.login-door-visual {
    position: relative;
    min-height: 640px;
    background: linear-gradient(135deg, #001f3f, #003b73);
    overflow: hidden;
}

.login-door-visual-bg {
    position: absolute;
    inset: 0;
    background-image: linear-gradient(90deg, rgba(0,31,63,.12), rgba(0,31,63,.08)), url('/images/login-pelsa-door.png');
    background-repeat: no-repeat;
    background-size: 185% auto;
    background-position: left center;
    transform: scale(1.02);
}

/* Capa elegante para ocultar cualquier parte del formulario falso de la imagen */
.login-door-visual::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, rgba(0,31,63,0) 0%, rgba(0,31,63,.12) 50%, rgba(0,31,63,.75) 100%), radial-gradient(circle at bottom left, rgba(255,194,14,.18), transparent 35%);
    pointer-events: none;
}

.login-door-caption {
    position: absolute;
    left: 34px;
    right: 34px;
    bottom: 34px;
    z-index: 2;
    background: rgba(255,255,255,.92);
    border: 1px solid rgba(255,255,255,.75);
    border-radius: 22px;
    padding: 18px 20px;
    box-shadow: 0 18px 42px rgba(0,0,0,.18);
}

    .login-door-caption span {
        display: block;
        color: #7a4f00;
        font-size: .78rem;
        font-weight: 900;
        text-transform: uppercase;
        letter-spacing: .08em;
        margin-bottom: 5px;
    }

    .login-door-caption strong {
        display: block;
        color: #003b73;
        line-height: 1.35;
        font-size: 1.05rem;
    }

.login-door-form {
    padding: 54px 50px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    background: radial-gradient(circle at top right, rgba(255, 194, 14, .12), transparent 28%), #ffffff;
}

.login-brand-mini img {
    width: 150px;
    height: auto;
    display: block;
}

@media (max-width: 980px) {
    .login-door-card {
        grid-template-columns: 1fr;
    }

    .login-door-visual {
        min-height: 360px;
    }

    .login-door-visual-bg {
        background-size: 145% auto;
        background-position: left 38%;
    }

    .login-door-form {
        padding: 38px 30px;
    }
}

@media (max-width: 640px) {
    .login-door-shell {
        padding: 14px;
    }

    .login-door-card {
        border-radius: 26px;
    }

    .login-door-visual {
        min-height: 270px;
    }

    .login-door-visual-bg {
        background-size: 170% auto;
        background-position: left center;
    }

    .login-door-caption {
        left: 18px;
        right: 18px;
        bottom: 18px;
        padding: 14px 16px;
    }

        .login-door-caption strong {
            font-size: .92rem;
        }

    .login-door-form {
        padding: 28px 22px;
    }

    .login-brand-mini img {
        width: 120px;
    }
}

/* =========================================================
   Home / Inicio comercial
   ========================================================= */

.home-hero {
    display: grid;
    grid-template-columns: 1.35fr .65fr;
    gap: 22px;
    align-items: stretch;
    margin-bottom: 22px;
}

.home-hero-content {
    position: relative;
    overflow: hidden;
    background: linear-gradient(135deg, #001f3f 0%, #003b73 62%, #0b5fa5 100%);
    color: white;
    border-radius: var(--radius);
    padding: 34px;
    box-shadow: var(--shadow);
}

    .home-hero-content::after {
        content: "";
        position: absolute;
        right: -70px;
        top: -70px;
        width: 260px;
        height: 260px;
        border-radius: 999px;
        background: rgba(255, 194, 14, .22);
    }

    .home-hero-content h1 {
        position: relative;
        z-index: 2;
        margin: 0;
        font-size: clamp(2rem, 4vw, 3.6rem);
        font-weight: 950;
        letter-spacing: -.05em;
        line-height: 1.03;
    }

    .home-hero-content p {
        position: relative;
        z-index: 2;
        max-width: 720px;
        margin: 14px 0 0;
        color: rgba(255,255,255,.82);
        line-height: 1.55;
        font-size: 1.04rem;
    }

.home-actions {
    position: relative;
    z-index: 2;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 24px;
}

.home-hero-panel {
    display: grid;
    gap: 16px;
}

.home-status-card {
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px;
    box-shadow: var(--shadow);
}

    .home-status-card span {
        display: block;
        color: var(--muted);
        text-transform: uppercase;
        letter-spacing: .08em;
        font-size: .76rem;
        font-weight: 900;
    }

    .home-status-card strong {
        display: block;
        margin-top: 8px;
        color: var(--secondary);
        font-size: 1.35rem;
        font-weight: 950;
    }

    .home-status-card small {
        display: block;
        margin-top: 6px;
        color: var(--muted);
    }

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

.home-module-card {
    cursor: pointer;
    display: grid;
    grid-template-columns: 58px 1fr;
    gap: 16px;
    align-items: start;
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px;
    box-shadow: var(--shadow);
    transition: .22s ease;
}

    .home-module-card:hover {
        transform: translateY(-4px);
        box-shadow: 0 24px 60px rgba(15, 23, 42, .12);
    }

    .home-module-card.disabled {
        cursor: default;
        opacity: .72;
    }

        .home-module-card.disabled:hover {
            transform: none;
        }

.home-module-icon {
    width: 58px;
    height: 58px;
    border-radius: 18px;
    display: grid;
    place-items: center;
    background: var(--primary-soft);
    font-size: 1.65rem;
}

.home-module-card h2 {
    margin: 0;
    color: var(--secondary);
    font-size: 1.18rem;
    font-weight: 950;
}

.home-module-card p {
    margin: 8px 0 0;
    color: var(--muted);
    line-height: 1.45;
}

.home-info-panel {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 20px;
    align-items: center;
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
}

    .home-info-panel h2 {
        margin: 0;
        color: var(--secondary);
        font-weight: 950;
    }

    .home-info-panel p {
        margin: 8px 0 0;
        color: var(--muted);
    }

.home-steps {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

    .home-steps span {
        display: inline-flex;
        align-items: center;
        border-radius: 999px;
        background: #fff4c2;
        color: #7a4f00;
        font-weight: 900;
        padding: 10px 14px;
        font-size: .86rem;
    }

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

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

    .home-info-panel {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .home-hero-content {
        padding: 26px 22px;
    }

    .home-actions {
        display: grid;
        grid-template-columns: 1fr;
    }

        .home-actions button,
        .home-actions a {
            width: 100%;
        }

    .home-module-card {
        grid-template-columns: 1fr;
    }
}

.email-send-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 160px;
    gap: 14px;
    align-items: center;
    margin-top: 16px;
}

.email-input {
    min-height: 54px;
    border-radius: 16px;
}

@media (max-width: 640px) {
    .email-send-row {
        grid-template-columns: 1fr;
    }

        .email-send-row button {
            width: 100%;
        }
}

/* =========================================================
   Layout principal fijo: sidebar + header + footer
   ========================================================= */

.app-layout {
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr);
    width: 100%;
    height: 100vh;
    overflow: hidden;
    background: linear-gradient(180deg, #f8fbff 0%, #f3f6fb 100%);
}

.app-sidebar {
    height: 100vh;
    overflow: hidden;
    background: linear-gradient(180deg, #001f3f 0%, #003b73 72%, #002b55 100%);
    border-right: 4px solid #ffc20e;
    box-shadow: 8px 0 28px rgba(15, 23, 42, .12);
    z-index: 20;
}

.app-main {
    min-width: 0;
    height: 100vh;
    display: grid;
    grid-template-rows: 74px minmax(0, 1fr);
    overflow: hidden;
}

.app-header {
    position: sticky;
    top: 0;
    z-index: 15;
    height: 74px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 0 28px;
    background: rgba(255,255,255,.92);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid #e5e7eb;
    box-shadow: 0 10px 28px rgba(15, 23, 42, .04);
}

.app-header-title {
    display: grid;
    line-height: 1.15;
}

    .app-header-title span {
        color: #6b7280;
        font-size: .78rem;
        font-weight: 900;
        text-transform: uppercase;
        letter-spacing: .08em;
    }

    .app-header-title strong {
        color: #003b73;
        font-size: 1.05rem;
        font-weight: 950;
    }

.app-content-scroll {
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    scroll-behavior: smooth;
}

.app-content {
    padding: 28px;
    min-height: calc(100vh - 74px - 88px);
}

.seller-chip {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 999px;
    padding: 8px 14px 8px 8px;
    box-shadow: 0 10px 24px rgba(15, 23, 42, .06);
}

.seller-avatar {
    width: 38px;
    height: 38px;
    border-radius: 999px;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, #003b73, #001f3f);
    color: #ffc20e;
    font-weight: 900;
    font-size: .85rem;
}

.seller-info {
    display: grid;
    line-height: 1.15;
}

    .seller-info span {
        color: #6b7280;
        font-size: .72rem;
        font-weight: 800;
        text-transform: uppercase;
        letter-spacing: .06em;
    }

    .seller-info strong {
        color: #003b73;
        font-size: .92rem;
        font-weight: 900;
    }

.logout-button {
    border: 0;
    background: #fff4c2;
    color: #7a4f00;
    font-weight: 900;
    border-radius: 999px;
    padding: 8px 12px;
    cursor: pointer;
}

    .logout-button:hover {
        background: #ffc20e;
        color: #111827;
    }

.app-footer {
    min-height: 88px;
    margin: 0 28px 28px;
    padding: 18px 22px;
    border-radius: 22px;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    box-shadow: 0 16px 42px rgba(15, 23, 42, .06);
    display: grid;
    grid-template-columns: 1fr 1.4fr auto;
    gap: 18px;
    align-items: center;
    color: #6b7280;
}

    .app-footer strong {
        display: block;
        color: #003b73;
        font-weight: 950;
        font-size: 1rem;
    }

    .app-footer span {
        display: block;
        font-size: .88rem;
    }

    .app-footer small {
        display: block;
        margin-top: 3px;
        color: #94a3b8;
    }

.footer-year {
    color: #7a4f00;
    background: #fff4c2;
    border: 1px solid rgba(255, 194, 14, .55);
    border-radius: 999px;
    padding: 9px 14px;
    font-weight: 900;
    white-space: nowrap;
}

/* Error UI */
#blazor-error-ui {
    background: #fff4c2;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, .2);
    display: none;
    left: 0;
    padding: .65rem 1.25rem .75rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 10000;
    color: #7a4f00;
}

    #blazor-error-ui .dismiss {
        cursor: pointer;
        position: absolute;
        right: .75rem;
        top: .5rem;
    }

/* =========================================================
   Responsive
   ========================================================= */

@media (max-width: 900px) {
    .app-layout {
        grid-template-columns: 220px minmax(0, 1fr);
    }
}

@media (max-width: 640.98px) {
    .app-layout {
        display: flex;
        flex-direction: column;
        height: 100vh;
    }

    .app-sidebar {
        width: 100%;
        height: auto;
        max-height: 180px;
        overflow-y: auto;
        border-right: 0;
        border-bottom: 4px solid #ffc20e;
    }

    .app-main {
        height: calc(100vh - 180px);
        grid-template-rows: auto minmax(0, 1fr);
    }

    .app-header {
        position: sticky;
        top: 0;
        height: auto;
        min-height: 76px;
        padding: 12px 14px;
        flex-direction: column;
        align-items: stretch;
    }

    .app-header-title {
        display: none;
    }

    .seller-chip {
        width: 100%;
        border-radius: 18px;
    }

    .app-content {
        padding: 14px;
    }

    .app-footer {
        margin: 0 14px 14px;
        grid-template-columns: 1fr;
        text-align: left;
    }

    .footer-year {
        width: fit-content;
    }
}

/* =========================================================
   FIX FOOTER FIJO PELSA
   Header fijo + contenido con scroll + footer visible
   ========================================================= */

.app-layout {
    display: grid !important;
    grid-template-columns: 280px minmax(0, 1fr) !important;
    width: 100% !important;
    height: 100vh !important;
    overflow: hidden !important;
}

.app-sidebar {
    height: 100vh !important;
    overflow: hidden !important;
}

.app-main {
    min-width: 0 !important;
    height: 100vh !important;
    display: grid !important;
    grid-template-rows: 74px minmax(0, 1fr) 76px !important;
    overflow: hidden !important;
}

.app-header {
    height: 74px !important;
    z-index: 30 !important;
}

.app-content-scroll {
    min-height: 0 !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    padding-bottom: 0 !important;
}

.app-content {
    padding: 28px !important;
    min-height: auto !important;
}

.app-footer {
    display: none !important;
}

.app-footer-fixed {
    min-height: 76px;
    padding: 12px 22px;
    background: rgba(255,255,255,.96);
    border-top: 1px solid #e5e7eb;
    box-shadow: 0 -10px 28px rgba(15, 23, 42, .05);
    display: grid;
    grid-template-columns: 1fr 1.4fr auto;
    gap: 18px;
    align-items: center;
    color: #6b7280;
    z-index: 25;
}

    .app-footer-fixed strong {
        display: block;
        color: #003b73;
        font-weight: 950;
        font-size: 1rem;
    }

    .app-footer-fixed span {
        display: block;
        font-size: .88rem;
    }

    .app-footer-fixed small {
        display: block;
        margin-top: 3px;
        color: #94a3b8;
    }

.footer-year {
    color: #7a4f00;
    background: #fff4c2;
    border: 1px solid rgba(255, 194, 14, .55);
    border-radius: 999px;
    padding: 9px 14px;
    font-weight: 900;
    white-space: nowrap;
}

@media (max-width: 640.98px) {
    .app-layout {
        display: flex !important;
        flex-direction: column !important;
        height: 100vh !important;
    }

    .app-main {
        height: calc(100vh - 180px) !important;
        grid-template-rows: auto minmax(0, 1fr) auto !important;
    }

    .app-footer-fixed {
        grid-template-columns: 1fr;
        gap: 6px;
        padding: 12px 14px;
        font-size: .82rem;
    }

        .app-footer-fixed div:nth-child(2) {
            display: none;
        }

    .footer-year {
        width: fit-content;
        font-size: .78rem;
        padding: 7px 11px;
    }
}

/* =========================================================
   Seguridad / Usuarios - Diseño profesional
   ========================================================= */

.users-admin-layout {
    display: grid;
    grid-template-columns: minmax(360px, .85fr) minmax(0, 1.15fr);
    gap: 22px;
    align-items: start;
}

.users-form-card,
.users-list-card {
    background: rgba(255,255,255,.96);
    border: 1px solid rgba(226,232,240,.95);
    border-radius: 26px;
    box-shadow: 0 24px 60px rgba(15, 23, 42, .08);
    padding: 24px;
}

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

.users-card-eyebrow {
    display: block;
    color: #7a4f00;
    font-size: .72rem;
    font-weight: 950;
    text-transform: uppercase;
    letter-spacing: .12em;
    margin-bottom: 6px;
}

.users-card-header h2 {
    margin: 0;
    color: #003b73;
    font-size: 1.35rem;
    font-weight: 950;
    letter-spacing: -.02em;
}

.users-card-header p {
    margin: 7px 0 0;
    color: #6b7280;
    line-height: 1.45;
}

.users-icon {
    width: 58px;
    height: 58px;
    min-width: 58px;
    border-radius: 18px;
    display: grid;
    place-items: center;
    background: #fff4c2;
    font-size: 1.7rem;
    box-shadow: 0 12px 28px rgba(255, 194, 14, .20);
}

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

.field-box {
    display: grid;
    gap: 7px;
}

    .field-box label {
        color: #0f172a;
        font-weight: 900;
        font-size: .9rem;
    }

    .field-box .form-control {
        width: 100%;
        min-height: 54px;
        border-radius: 16px;
        background: #ffffff;
    }

.field-span-2 {
    grid-column: span 2;
}

.users-switches {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.users-switch {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    background: linear-gradient(180deg, #ffffff, #f8fafc);
    border: 1px solid #e5e7eb;
    border-radius: 18px;
    padding: 15px;
    cursor: pointer;
}

    .users-switch input {
        margin-top: 4px;
    }

    .users-switch strong {
        display: block;
        color: #003b73;
        font-weight: 950;
    }

    .users-switch small {
        display: block;
        margin-top: 3px;
        color: #6b7280;
        line-height: 1.35;
    }

.users-form-actions {
    display: flex;
    gap: 12px;
    align-items: center;
    justify-content: flex-start;
    margin-top: 4px;
}

.users-table-wrapper {
    overflow-x: auto;
}

.users-table td {
    vertical-align: middle;
}

.user-main-cell {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-avatar-small {
    width: 42px;
    height: 42px;
    min-width: 42px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, #003b73, #001f3f);
    color: #ffc20e;
    font-weight: 950;
    font-size: .82rem;
}

.user-main-cell strong {
    display: block;
    color: #0f172a;
    font-weight: 950;
}

.user-main-cell small {
    display: block;
    color: #6b7280;
    margin-top: 2px;
}

.user-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    padding: 8px 12px;
    font-weight: 950;
    font-size: .78rem;
    background: #e6eef8;
    color: #003b73;
    border: 1px solid rgba(0, 59, 115, .12);
    white-space: nowrap;
}

    .user-pill.admin {
        background: #fff4c2;
        color: #7a4f00;
        border-color: rgba(255, 194, 14, .5);
    }

    .user-pill.inactive {
        background: #fee2e2;
        color: #991b1b;
        border-color: #fecaca;
    }

.users-empty {
    border: 1px dashed #cbd5e1;
    border-radius: 20px;
    padding: 24px;
    background: #f8fafc;
    text-align: center;
}

    .users-empty strong {
        display: block;
        color: #003b73;
        font-size: 1.05rem;
        font-weight: 950;
    }

    .users-empty span {
        display: block;
        margin-top: 6px;
        color: #6b7280;
    }

.d-block {
    display: block;
}

@media (max-width: 1100px) {
    .users-admin-layout {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .users-form-card,
    .users-list-card {
        padding: 18px;
        border-radius: 22px;
    }

    .users-card-header {
        flex-direction: column;
    }

    .users-form-grid,
    .users-switches {
        grid-template-columns: 1fr;
    }

    .field-span-2 {
        grid-column: span 1;
    }

    .users-form-actions {
        display: grid;
        grid-template-columns: 1fr;
    }

        .users-form-actions button {
            width: 100%;
        }
}
/* =========================================================
   FIX FINAL Usuarios + Autocomplete + Botón editar
   ========================================================= */

.users-admin-layout {
    display: grid !important;
    grid-template-columns: minmax(380px, .82fr) minmax(0, 1.18fr) !important;
    gap: 24px !important;
    align-items: start !important;
}

.users-form-card,
.users-list-card {
    width: 100% !important;
    box-sizing: border-box !important;
}

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

.field-box {
    display: grid !important;
    gap: 8px !important;
}

    .field-box label {
        display: block !important;
        color: #0f172a !important;
        font-weight: 900 !important;
        font-size: .9rem !important;
        line-height: 1.2 !important;
    }

    .field-box .form-control,
    .field-box input {
        width: 100% !important;
        min-width: 0 !important;
        min-height: 58px !important;
        border-radius: 16px !important;
        box-sizing: border-box !important;
    }

.field-span-2 {
    grid-column: span 2 !important;
}

.users-switches {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 14px !important;
}

.users-form-actions {
    display: flex !important;
    gap: 12px !important;
    align-items: center !important;
}

.btn-sm-app {
    min-height: 36px !important;
    padding: 8px 12px !important;
    border-radius: 12px !important;
    font-size: .82rem !important;
    font-weight: 900 !important;
}

.selected-user-row td {
    background: #fff9db !important;
}

    .selected-user-row td:first-child {
        box-shadow: inset 4px 0 0 #ffc20e;
    }

.users-table th,
.users-table td {
    white-space: nowrap;
}

    .users-table td:nth-child(2) {
        white-space: normal;
    }

input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus {
    -webkit-box-shadow: 0 0 0 1000px #ffffff inset !important;
    -webkit-text-fill-color: #172033 !important;
    transition: background-color 9999s ease-in-out 0s !important;
}

@media (max-width: 1100px) {
    .users-admin-layout {
        grid-template-columns: 1fr !important;
    }
}

@media (max-width: 640px) {
    .users-form-grid,
    .users-switches {
        grid-template-columns: 1fr !important;
    }

    .field-span-2 {
        grid-column: span 1 !important;
    }

    .users-form-actions {
        display: grid !important;
        grid-template-columns: 1fr !important;
    }

        .users-form-actions button {
            width: 100% !important;
        }

    .users-table th,
    .users-table td {
        white-space: nowrap;
    }
}

/* =========================================================
   FIX FINAL MOVIL - Usuarios y layout sin desplazamiento lateral
   ========================================================= */

html,
body {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden !important;
}

.app-layout,
.app-main,
.app-content-scroll,
.app-content,
.page-shell {
    max-width: 100%;
    overflow-x: hidden !important;
    box-sizing: border-box;
}

.users-admin-layout,
.users-form-card,
.users-list-card,
.users-form-grid,
.users-table-wrapper {
    max-width: 100%;
    box-sizing: border-box;
}

@media (max-width: 640.98px) {
    .app-sidebar {
        position: relative !important;
        overflow: visible !important;
        max-height: 145px !important;
        height: 145px !important;
        z-index: 2000 !important;
    }

    .app-main {
        height: calc(100vh - 145px) !important;
        min-width: 0 !important;
    }

    .page-shell {
        width: 100% !important;
        max-width: 100% !important;
        padding: 14px !important;
        margin: 0 !important;
    }

    .users-admin-layout {
        display: grid !important;
        grid-template-columns: minmax(0, 1fr) !important;
        width: 100% !important;
        max-width: 100% !important;
        gap: 16px !important;
    }

    .users-form-card,
    .users-list-card {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        padding: 18px !important;
        border-radius: 22px !important;
        overflow: hidden !important;
    }

    .users-form-grid {
        display: grid !important;
        grid-template-columns: minmax(0, 1fr) !important;
        gap: 14px !important;
        width: 100% !important;
    }

    .field-box,
    .field-span-2 {
        grid-column: auto !important;
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
    }

        .field-box .form-control,
        .field-box input,
        .users-form-grid input {
            width: 100% !important;
            max-width: 100% !important;
            min-width: 0 !important;
            box-sizing: border-box !important;
        }

    .users-switches {
        display: grid !important;
        grid-template-columns: minmax(0, 1fr) !important;
        gap: 12px !important;
        width: 100% !important;
    }

    .users-switch {
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
    }

    .users-form-actions {
        display: grid !important;
        grid-template-columns: minmax(0, 1fr) !important;
        gap: 10px !important;
        width: 100% !important;
    }

        .users-form-actions button {
            width: 100% !important;
        }

    .users-table-wrapper {
        width: 100% !important;
        max-width: 100% !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
    }

    .users-table {
        min-width: 720px;
    }

    .app-footer-fixed {
        position: relative !important;
        z-index: 10 !important;
    }
}
/* =========================================================
   FIX APP LAYOUT POR NUEVA ALTURA HEADER MOVIL
   ========================================================= */

@media (max-width: 640.98px) {
    .app-sidebar {
        max-height: 178px !important;
        height: 178px !important;
        overflow: visible !important;
    }

    .app-main {
        height: calc(100vh - 178px) !important;
    }
}

@media (max-width: 430px) {
    .app-sidebar {
        max-height: 172px !important;
        height: 172px !important;
    }

    .app-main {
        height: calc(100vh - 172px) !important;
    }
}
/* =========================================================
   Reportes generados
   ========================================================= */

.report-filter-card {
    background: rgba(255,255,255,.96);
    border: 1px solid rgba(226,232,240,.95);
    border-radius: 26px;
    box-shadow: 0 20px 48px rgba(15, 23, 42, .07);
    padding: 22px;
    margin-bottom: 22px;
}

.report-filter-grid {
    display: grid;
    grid-template-columns: 1fr 1.4fr 130px 150px auto;
    gap: 16px;
    align-items: end;
}

.report-filter-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.report-type-pill {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 7px 12px;
    background: #e6eef8;
    color: #003b73;
    font-weight: 950;
    font-size: .78rem;
    border: 1px solid rgba(0, 59, 115, .12);
    white-space: nowrap;
}

.report-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    flex-wrap: wrap;
}

.reportes-table td {
    vertical-align: middle;
}

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

@media (max-width: 1100px) {
    .report-filter-grid {
        grid-template-columns: 1fr 1fr;
    }

    .report-filter-actions {
        grid-column: span 2;
    }
}

@media (max-width: 640px) {
    .report-filter-card {
        padding: 18px;
        border-radius: 22px;
    }

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

    .report-filter-actions {
        grid-column: auto;
        display: grid;
        grid-template-columns: 1fr;
    }

        .report-filter-actions button {
            width: 100%;
        }

    .reportes-table {
        min-width: 850px;
    }

    .report-actions {
        justify-content: flex-start;
    }
}
/* =========================================================
   FIX VISUAL FINAL - Reportes generados
   ========================================================= */

.report-filter-card {
    background: rgba(255,255,255,.98) !important;
    border: 1px solid rgba(226,232,240,.95) !important;
    border-radius: 28px !important;
    box-shadow: 0 22px 56px rgba(15, 23, 42, .08) !important;
    padding: 24px !important;
    margin-bottom: 24px !important;
}

.report-filter-grid {
    display: grid !important;
    grid-template-columns: 1.1fr 1.7fr .8fr .9fr auto !important;
    gap: 18px !important;
    align-items: end !important;
}

    .report-filter-grid > div {
        min-width: 0 !important;
    }

    .report-filter-grid label,
    .report-filter-card .form-label {
        display: block !important;
        margin-bottom: 7px !important;
        color: #0f172a !important;
        font-weight: 900 !important;
        font-size: .88rem !important;
    }

.report-filter-card .form-control,
.report-filter-card select,
.report-filter-card input {
    width: 100% !important;
    min-height: 52px !important;
    border-radius: 16px !important;
    border: 1px solid #e5e7eb !important;
    background: #ffffff !important;
    box-shadow: 0 8px 20px rgba(15, 23, 42, .03) !important;
    font-weight: 700 !important;
}

.report-filter-actions {
    display: flex !important;
    gap: 10px !important;
    align-items: center !important;
    justify-content: flex-end !important;
}

.table-card {
    background: rgba(255,255,255,.98) !important;
    border: 1px solid rgba(226,232,240,.95) !important;
    border-radius: 28px !important;
    box-shadow: 0 24px 60px rgba(15, 23, 42, .08) !important;
    overflow: hidden !important;
}

.table-header-app {
    padding: 22px 24px !important;
    border-bottom: 1px solid #e5e7eb !important;
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%) !important;
}

    .table-header-app h2 {
        margin: 0 !important;
        color: #003b73 !important;
        font-size: 1.25rem !important;
        font-weight: 950 !important;
    }

    .table-header-app p {
        margin: 6px 0 0 !important;
        color: #6b7280 !important;
    }

.reportes-table-wrapper {
    padding: 0 !important;
    width: 100% !important;
    overflow-x: auto !important;
}

.reportes-table {
    width: 100% !important;
    border-collapse: separate !important;
    border-spacing: 0 !important;
}

    .reportes-table thead th {
        background: #f1f5f9 !important;
        color: #003b73 !important;
        font-size: .72rem !important;
        font-weight: 950 !important;
        text-transform: uppercase !important;
        letter-spacing: .12em !important;
        padding: 16px 18px !important;
        border-bottom: 1px solid #e5e7eb !important;
        white-space: nowrap !important;
    }

    .reportes-table tbody td {
        padding: 18px !important;
        border-bottom: 1px solid #edf2f7 !important;
        vertical-align: middle !important;
        background: #ffffff !important;
    }

    .reportes-table tbody tr:hover td {
        background: #f8fbff !important;
    }

.report-type-pill {
    display: inline-flex !important;
    align-items: center !important;
    border-radius: 999px !important;
    padding: 8px 13px !important;
    background: #e6eef8 !important;
    color: #003b73 !important;
    font-weight: 950 !important;
    font-size: .78rem !important;
    border: 1px solid rgba(0, 59, 115, .12) !important;
    white-space: nowrap !important;
}

.report-actions {
    display: flex !important;
    justify-content: flex-end !important;
    align-items: center !important;
    gap: 8px !important;
    flex-wrap: nowrap !important;
}

.btn-sm-app {
    min-height: 38px !important;
    padding: 8px 13px !important;
    border-radius: 13px !important;
    font-size: .82rem !important;
    font-weight: 950 !important;
    white-space: nowrap !important;
}

.user-pill {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    border-radius: 999px !important;
    padding: 8px 12px !important;
    font-weight: 950 !important;
    font-size: .78rem !important;
    background: #e6eef8 !important;
    color: #003b73 !important;
    border: 1px solid rgba(0, 59, 115, .12) !important;
    white-space: nowrap !important;
}

    .user-pill.inactive {
        background: #fee2e2 !important;
        color: #991b1b !important;
        border-color: #fecaca !important;
    }

.muted.small,
.small {
    font-size: .78rem !important;
    color: #6b7280 !important;
    margin-top: 4px !important;
}

.reportes-table strong {
    color: #0f172a !important;
    font-weight: 950 !important;
}

/* Para que no se estire demasiado en pantallas grandes */
.page-shell {
    max-width: 1540px !important;
    margin-left: auto !important;
    margin-right: auto !important;
}

/* Responsive tablet */
@media (max-width: 1200px) {
    .report-filter-grid {
        grid-template-columns: 1fr 1fr 150px 150px !important;
    }

    .report-filter-actions {
        grid-column: span 4 !important;
        justify-content: flex-start !important;
    }
}

/* Responsive móvil */
@media (max-width: 640.98px) {
    .report-filter-card {
        padding: 18px !important;
        border-radius: 22px !important;
    }

    .report-filter-grid {
        grid-template-columns: 1fr !important;
        gap: 14px !important;
    }

    .report-filter-actions {
        grid-column: auto !important;
        display: grid !important;
        grid-template-columns: 1fr !important;
        justify-content: stretch !important;
    }

        .report-filter-actions button {
            width: 100% !important;
        }

    .table-card {
        border-radius: 22px !important;
    }

    .table-header-app {
        padding: 18px !important;
    }

    .reportes-table {
        min-width: 920px !important;
    }

    .report-actions {
        justify-content: flex-start !important;
    }
}

/* =========================================================
   FIX MOVIL - Filtros Reportes Generados
   Campos más compactos y alineados
   ========================================================= */

@media (max-width: 640.98px) {
    .report-filter-card {
        padding: 20px !important;
        border-radius: 24px !important;
        margin: 0 0 20px 0 !important;
    }

    .report-filter-grid {
        display: grid !important;
        grid-template-columns: 1fr !important;
        gap: 16px !important;
    }

        .report-filter-grid label,
        .report-filter-card .form-label {
            margin-bottom: 8px !important;
            font-size: .95rem !important;
            color: #0f172a !important;
            font-weight: 950 !important;
            line-height: 1.2 !important;
        }

    .report-filter-card .form-control,
    .report-filter-card select,
    .report-filter-card input {
        width: 100% !important;
        height: 58px !important;
        min-height: 58px !important;
        max-height: 58px !important;
        padding: 0 20px !important;
        border-radius: 18px !important;
        font-size: .96rem !important;
        font-weight: 850 !important;
        line-height: 58px !important;
        color: #0f172a !important;
        background: #ffffff !important;
        border: 1px solid #e5e7eb !important;
        box-shadow: 0 10px 24px rgba(15, 23, 42, .04) !important;
        box-sizing: border-box !important;
    }

        .report-filter-card input::placeholder {
            color: #7b8494 !important;
            font-weight: 750 !important;
            opacity: 1 !important;
        }

    .report-filter-card select {
        appearance: auto !important;
        -webkit-appearance: menulist !important;
        line-height: normal !important;
    }

    .report-filter-card input[type="number"] {
        appearance: textfield !important;
        -moz-appearance: textfield !important;
    }

        .report-filter-card input[type="number"]::-webkit-outer-spin-button,
        .report-filter-card input[type="number"]::-webkit-inner-spin-button {
            -webkit-appearance: none !important;
            margin: 0 !important;
        }

    .report-filter-actions {
        display: grid !important;
        grid-template-columns: 1fr !important;
        gap: 10px !important;
        margin-top: 4px !important;
    }

        .report-filter-actions button {
            width: 100% !important;
            min-height: 54px !important;
            border-radius: 16px !important;
        }
}
/* =========================================================
   FIX PC - Filtros Reportes Generados más elegantes
   No afecta móvil
   ========================================================= */

@media (min-width: 641px) {
    .report-filter-card {
        padding: 22px 24px !important;
        margin-bottom: 22px !important;
        border-radius: 26px !important;
        background: rgba(255,255,255,.98) !important;
        box-shadow: 0 20px 50px rgba(15, 23, 42, .07) !important;
    }

    .report-filter-grid {
        display: grid !important;
        grid-template-columns: 1.05fr 1.75fr .8fr .9fr auto auto !important;
        gap: 14px !important;
        align-items: end !important;
    }

        .report-filter-grid > div {
            min-width: 0 !important;
        }

        .report-filter-grid label,
        .report-filter-card .form-label {
            display: block !important;
            margin-bottom: 6px !important;
            font-size: .82rem !important;
            font-weight: 950 !important;
            color: #0f172a !important;
            line-height: 1.1 !important;
        }

    .report-filter-card .form-control,
    .report-filter-card select,
    .report-filter-card input {
        height: 48px !important;
        min-height: 48px !important;
        max-height: 48px !important;
        padding: 0 16px !important;
        border-radius: 15px !important;
        font-size: .9rem !important;
        font-weight: 800 !important;
        line-height: normal !important;
        box-sizing: border-box !important;
    }

    .report-filter-actions {
        display: contents !important;
    }

        .report-filter-actions .btn-primary,
        .report-filter-actions .btn-secondary-app {
            height: 48px !important;
            min-height: 48px !important;
            padding: 0 22px !important;
            border-radius: 15px !important;
            white-space: nowrap !important;
            align-self: end !important;
        }

    .table-card {
        margin-top: 0 !important;
    }
}

/* =========================================================
   MODAL APP - Reenvío de reportes
   ========================================================= */

.modal-backdrop-app {
    position: fixed;
    inset: 0;
    z-index: 5000;
    background: rgba(15, 23, 42, .58);
    backdrop-filter: blur(7px);
    display: grid;
    place-items: center;
    padding: 22px;
}

.modal-card-app {
    width: min(560px, 100%);
    background: #ffffff;
    border-radius: 28px;
    border: 1px solid rgba(226,232,240,.95);
    box-shadow: 0 32px 90px rgba(15, 23, 42, .32);
    overflow: hidden;
    animation: modalInApp .18s ease-out;
}

@keyframes modalInApp {
    from {
        opacity: 0;
        transform: translateY(12px) scale(.98);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-header-app {
    padding: 24px;
    background: linear-gradient(135deg, #001f3f 0%, #003b73 70%, #1d4f82 100%);
    color: #ffffff;
    display: flex;
    justify-content: space-between;
    gap: 18px;
    align-items: flex-start;
}

.modal-eyebrow {
    display: block;
    color: #ffc20e;
    font-size: .72rem;
    font-weight: 950;
    text-transform: uppercase;
    letter-spacing: .13em;
    margin-bottom: 7px;
}

.modal-header-app h2 {
    margin: 0;
    color: #ffffff;
    font-size: 1.55rem;
    font-weight: 950;
    letter-spacing: -.02em;
}

.modal-header-app p {
    margin: 8px 0 0;
    color: rgba(255,255,255,.80);
    line-height: 1.4;
}

.modal-close-app {
    width: 42px;
    height: 42px;
    border: 1px solid rgba(255,255,255,.22);
    border-radius: 14px;
    background: rgba(255,255,255,.12);
    color: #ffffff;
    font-size: 1.8rem;
    line-height: 1;
    cursor: pointer;
}

    .modal-close-app:hover {
        background: rgba(255,255,255,.20);
    }

.modal-body-app {
    padding: 24px;
    display: grid;
    gap: 18px;
}

.modal-report-summary {
    border: 1px solid #e5e7eb;
    border-radius: 20px;
    padding: 16px;
    background: #f8fafc;
}

    .modal-report-summary span {
        display: block;
        color: #6b7280;
        font-size: .8rem;
        font-weight: 850;
    }

    .modal-report-summary strong {
        display: block;
        color: #003b73;
        font-size: 1.05rem;
        font-weight: 950;
        margin-top: 3px;
    }

    .modal-report-summary small {
        display: block;
        color: #6b7280;
        margin-top: 4px;
    }

.modal-body-app .form-control {
    width: 100%;
    min-height: 56px;
    border-radius: 17px;
    padding: 0 18px;
    font-weight: 800;
}

.modal-pdf-link {
    display: inline-flex;
    width: fit-content;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    border-radius: 999px;
    padding: 10px 16px;
    background: #e6eef8;
    color: #003b73;
    font-weight: 950;
    border: 1px solid rgba(0, 59, 115, .12);
}

    .modal-pdf-link:hover {
        color: #003b73;
        background: #dceafb;
    }

.modal-footer-app {
    padding: 18px 24px 24px;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    border-top: 1px solid #eef2f7;
}

@media (max-width: 640px) {
    .modal-backdrop-app {
        align-items: end;
        padding: 12px;
    }

    .modal-card-app {
        border-radius: 24px 24px 18px 18px;
    }

    .modal-header-app {
        padding: 20px;
    }

        .modal-header-app h2 {
            font-size: 1.25rem;
        }

    .modal-body-app {
        padding: 20px;
    }

    .modal-footer-app {
        display: grid;
        grid-template-columns: 1fr;
        padding: 16px 20px 20px;
    }

        .modal-footer-app button {
            width: 100%;
        }
}

/* =========================================================
   Seguridad de rutas / Acceso denegado
   ========================================================= */

.protected-denied-card {
    border: 1px solid #fecaca !important;
    background: linear-gradient(180deg, #ffffff 0%, #fff7f7 100%) !important;
}

    .protected-denied-card .protected-icon {
        background: #fee2e2 !important;
        color: #991b1b !important;
    }


/* =========================================================
   Usuarios - Acciones activar/desactivar
   ========================================================= */

.user-actions-row {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.btn-danger-soft {
    border: 1px solid #fecaca;
    background: #fff1f2;
    color: #991b1b;
    font-weight: 950;
    box-shadow: 0 8px 18px rgba(153, 27, 27, .08);
}

    .btn-danger-soft:hover:not(:disabled) {
        background: #fee2e2;
        color: #7f1d1d;
    }

.btn-success-soft {
    border: 1px solid #bbf7d0;
    background: #ecfdf5;
    color: #166534;
    font-weight: 950;
    box-shadow: 0 8px 18px rgba(22, 101, 52, .08);
}

    .btn-success-soft:hover:not(:disabled) {
        background: #dcfce7;
        color: #14532d;
    }

    .btn-danger-soft:disabled,
    .btn-success-soft:disabled {
        opacity: .55;
        cursor: not-allowed;
        box-shadow: none;
    }

.field-help {
    display: block;
    margin-top: 3px;
    color: #6b7280;
    font-size: .78rem;
    line-height: 1.3;
}

@media (max-width: 640px) {
    .user-actions-row {
        justify-content: flex-start;
    }
}

/* =========================================================
   Usuarios - Switch deshabilitado para propio usuario
   ========================================================= */

.users-switch.switch-disabled {
    opacity: .68;
    cursor: not-allowed;
    background: #f8fafc !important;
}

    .users-switch.switch-disabled input {
        cursor: not-allowed;
    }

    .users-switch.switch-disabled strong {
        color: #64748b !important;
    }

    .users-switch.switch-disabled small {
        color: #991b1b !important;
        font-weight: 800;
    }


/* =========================================================
   Ruta sugerida de visitas
   ========================================================= */

.route-panel-card {
    background: rgba(255,255,255,.98);
    border: 1px solid rgba(226,232,240,.95);
    border-radius: 28px;
    box-shadow: 0 24px 60px rgba(15, 23, 42, .08);
    padding: 24px;
    margin-bottom: 24px;
}

.route-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 20px;
}

    .route-header h2 {
        margin: 0;
        color: #003b73;
        font-weight: 950;
        font-size: 1.5rem;
    }

.route-summary-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
    margin-bottom: 20px;
}

    .route-summary-grid div {
        border: 1px solid #e5e7eb;
        border-radius: 18px;
        padding: 15px;
        background: linear-gradient(180deg, #ffffff, #f8fafc);
    }

    .route-summary-grid span {
        display: block;
        color: #6b7280;
        font-size: .78rem;
        font-weight: 850;
    }

    .route-summary-grid strong {
        display: block;
        color: #003b73;
        font-size: 1.45rem;
        font-weight: 950;
        margin-top: 5px;
    }

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

.route-table th,
.route-table td {
    vertical-align: middle;
}

.route-order {
    display: inline-grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 13px;
    background: #003b73;
    color: #ffc20e;
    font-weight: 950;
}

.route-risk-pill {
    display: inline-flex;
    border-radius: 999px;
    padding: 8px 12px;
    font-size: .78rem;
    font-weight: 950;
    border: 1px solid transparent;
}

.risk-high {
    background: #fee2e2;
    color: #991b1b;
    border-color: #fecaca;
}

.risk-medium {
    background: #fff4c2;
    color: #7a4f00;
    border-color: rgba(255, 194, 14, .55);
}

.risk-low {
    background: #dcfce7;
    color: #166534;
    border-color: #bbf7d0;
}

@media (max-width: 900px) {
    .route-header {
        display: grid;
        grid-template-columns: 1fr;
    }

    .route-summary-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .route-table {
        min-width: 980px;
    }
}

@media (max-width: 640px) {
    .route-panel-card {
        padding: 18px;
        border-radius: 22px;
    }

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

    .route-header button {
        width: 100%;
    }
}

/* =========================================================
   Clientes IA - Tabs, búsqueda y ruta paginada
   ========================================================= */

.clients-tabs {
    margin-bottom: 18px !important;
}

.clients-search-card {
    display: grid !important;
    grid-template-columns: 260px minmax(0, 1fr) !important;
    gap: 24px !important;
    align-items: end !important;
    padding: 24px !important;
}

    .clients-search-card .form-label {
        color: #0f172a !important;
        font-weight: 950 !important;
        margin-bottom: 6px !important;
    }

.search-help {
    margin: 0 !important;
    line-height: 1.35 !important;
}

.clients-search-row {
    display: grid !important;
    grid-template-columns: minmax(280px, 1fr) auto auto !important;
    gap: 12px !important;
    align-items: center !important;
}

    .clients-search-row .form-control {
        min-height: 54px !important;
        border-radius: 17px !important;
    }

    .clients-search-row button {
        min-height: 54px !important;
        border-radius: 16px !important;
        white-space: nowrap !important;
    }

.route-header-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.route-pager {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-top: 18px;
    padding: 14px 16px;
    border: 1px solid #e5e7eb;
    background: #f8fafc;
    border-radius: 18px;
    color: #6b7280;
    font-weight: 800;
}

.route-pager-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

    .route-pager-actions span {
        color: #003b73;
        font-weight: 950;
    }

.route-table td {
    border-bottom: 1px solid #eef2f7 !important;
}

.route-table tbody tr:hover td {
    background: #f8fbff !important;
}

@media (max-width: 980px) {
    .clients-search-card {
        grid-template-columns: 1fr !important;
        gap: 14px !important;
    }

    .clients-search-row {
        grid-template-columns: 1fr !important;
    }

        .clients-search-row button {
            width: 100% !important;
        }

    .route-header-actions {
        display: grid;
        grid-template-columns: 1fr;
        width: 100%;
    }

        .route-header-actions button {
            width: 100%;
        }

    .route-pager {
        display: grid;
        grid-template-columns: 1fr;
    }

    .route-pager-actions {
        justify-content: space-between;
    }
}

@media (max-width: 640px) {
    .clients-tabs {
        overflow-x: auto;
        display: flex !important;
        gap: 10px !important;
    }

        .clients-tabs .tab-btn {
            white-space: nowrap;
        }

    .clients-search-card {
        padding: 18px !important;
        border-radius: 22px !important;
    }

    .route-table {
        min-width: 980px;
    }
}

/* =========================================================
   Ruta visitas - Plan IA
   ========================================================= */

.route-ai-card {
    margin: 22px 0;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 26px;
    box-shadow: 0 20px 50px rgba(15, 23, 42, .06);
    padding: 24px;
}

.route-ai-header {
    margin-bottom: 18px;
}

    .route-ai-header h2 {
        margin: 0;
        color: #003b73;
        font-weight: 950;
    }

.route-ai-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
    margin-bottom: 18px;
}

    .route-ai-grid article {
        border: 1px solid #e5e7eb;
        border-radius: 20px;
        padding: 18px;
        background: linear-gradient(180deg, #ffffff, #f8fafc);
    }

    .route-ai-grid span,
    .route-ai-client-grid span {
        display: block;
        color: #7a4f00;
        font-size: .75rem;
        font-weight: 950;
        text-transform: uppercase;
        letter-spacing: .08em;
        margin-bottom: 8px;
    }

    .route-ai-grid p,
    .route-ai-client-grid p {
        margin: 0;
        color: #172033;
        line-height: 1.5;
    }

.route-ai-inner {
    margin: 14px 0;
    box-shadow: none !important;
}

.route-ai-clients {
    margin-top: 18px;
}

.route-ai-client-card {
    border: 1px solid #e5e7eb;
    border-radius: 22px;
    padding: 18px;
    background: #ffffff;
    margin-top: 14px;
}

.route-ai-client-header {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 14px;
    align-items: center;
    margin-bottom: 16px;
}

    .route-ai-client-header h3 {
        margin: 0;
        color: #003b73;
        font-weight: 950;
    }

    .route-ai-client-header p {
        margin: 3px 0 0;
        color: #6b7280;
    }

.route-ai-client-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
}

    .route-ai-client-grid div {
        border: 1px solid #eef2f7;
        border-radius: 18px;
        padding: 14px;
        background: #f8fafc;
    }

.route-ai-questions {
    margin-top: 14px;
    padding: 14px 16px;
    border-radius: 18px;
    background: #fff4c2;
    border: 1px solid rgba(255, 194, 14, .55);
}

    .route-ai-questions strong {
        display: block;
        color: #7a4f00;
        margin-bottom: 8px;
        font-weight: 950;
    }

    .route-ai-questions ul {
        margin: 0;
        padding-left: 18px;
    }

    .route-ai-questions li {
        margin-bottom: 6px;
    }

@media (max-width: 980px) {
    .route-ai-grid,
    .route-ai-client-grid {
        grid-template-columns: 1fr;
    }

    .route-ai-client-header {
        grid-template-columns: auto 1fr;
    }

        .route-ai-client-header button {
            grid-column: span 2;
            width: 100%;
        }
}

@media (max-width: 640px) {
    .route-ai-card {
        padding: 18px;
        border-radius: 22px;
    }
}

/* =========================================================
   Ruta sugerida - Subpestañas, toolbar y selector
   ========================================================= */

.route-subtabs {
    display: inline-flex;
    gap: 10px;
    padding: 8px;
    background: #eef3f8;
    border: 1px solid #dbe4ef;
    border-radius: 999px;
    margin: 0 0 18px;
}

.route-subtab {
    border: 0;
    border-radius: 999px;
    padding: 11px 18px;
    font-weight: 950;
    color: #003b73;
    background: transparent;
    cursor: pointer;
}

    .route-subtab.active {
        background: #003b73;
        color: #ffc20e;
        box-shadow: 0 10px 24px rgba(0, 59, 115, .18);
    }

.route-toolbar {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: center;
    padding: 16px 18px;
    margin-bottom: 14px;
    border: 1px solid #e5e7eb;
    background: #ffffff;
    border-radius: 20px;
}

    .route-toolbar strong {
        display: block;
        color: #003b73;
        font-weight: 950;
    }

    .route-toolbar span {
        display: block;
        margin-top: 3px;
        color: #6b7280;
        font-size: .86rem;
    }

.route-page-size {
    display: flex;
    align-items: center;
    gap: 10px;
}

    .route-page-size label {
        color: #6b7280;
        font-weight: 850;
    }

    .route-page-size .form-control {
        width: 96px;
        min-height: 42px;
        border-radius: 14px;
        font-weight: 900;
    }

.route-ia-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 16px;
}

@media (max-width: 700px) {
    .route-subtabs {
        width: 100%;
        display: grid;
        grid-template-columns: 1fr;
        border-radius: 22px;
    }

    .route-subtab {
        width: 100%;
        border-radius: 16px;
    }

    .route-toolbar {
        display: grid;
        grid-template-columns: 1fr;
    }

    .route-page-size {
        justify-content: space-between;
    }

        .route-page-size .form-control {
            width: 120px;
        }

    .route-ia-actions {
        display: grid;
        grid-template-columns: 1fr;
    }

        .route-ia-actions button {
            width: 100%;
        }
}
/* =========================================================
   Loading overlay - IA / PDF ruta visitas
   ========================================================= */

.loading-overlay-app {
    position: fixed;
    inset: 0;
    z-index: 7000;
    display: grid;
    place-items: center;
    padding: 24px;
    background: rgba(241, 245, 249, .72);
    backdrop-filter: blur(8px);
}

.loading-card-app {
    width: min(520px, 100%);
    background: rgba(255,255,255,.96);
    border: 1px solid rgba(226,232,240,.95);
    border-radius: 30px;
    padding: 34px 32px;
    text-align: center;
    box-shadow: 0 32px 90px rgba(15, 23, 42, .22);
    position: relative;
    overflow: hidden;
}

    .loading-card-app::after {
        content: "";
        position: absolute;
        right: -85px;
        top: -85px;
        width: 210px;
        height: 210px;
        border-radius: 50%;
        background: rgba(255, 194, 14, .16);
    }

.loading-icon-app {
    width: 82px;
    height: 82px;
    margin: 0 auto 18px;
    border-radius: 24px;
    display: grid;
    place-items: center;
    background: #003b73;
    color: #ffc20e;
    font-size: 2.2rem;
    font-weight: 950;
    box-shadow: 0 20px 45px rgba(0, 59, 115, .22);
    position: relative;
    z-index: 1;
}

.loading-card-app h2 {
    margin: 0;
    color: #003b73;
    font-size: 1.45rem;
    font-weight: 950;
    position: relative;
    z-index: 1;
}

.loading-card-app p {
    margin: 12px auto 22px;
    max-width: 390px;
    color: #6b7280;
    font-size: .98rem;
    line-height: 1.55;
    position: relative;
    z-index: 1;
}

.loading-bar-app {
    height: 8px;
    width: 100%;
    border-radius: 999px;
    background: #e5e7eb;
    overflow: hidden;
    position: relative;
    z-index: 1;
}

    .loading-bar-app span {
        display: block;
        height: 100%;
        width: 38%;
        border-radius: 999px;
        background: linear-gradient(90deg, #ffc20e, #003b73);
        animation: loadingBarMove 1.25s ease-in-out infinite;
    }

.loading-dots-app {
    margin-top: 20px;
    display: flex;
    justify-content: center;
    gap: 8px;
    position: relative;
    z-index: 1;
}

    .loading-dots-app span {
        width: 10px;
        height: 10px;
        border-radius: 999px;
        background: #ffc20e;
        animation: loadingDotPulse 1s ease-in-out infinite;
    }

        .loading-dots-app span:nth-child(2) {
            animation-delay: .15s;
        }

        .loading-dots-app span:nth-child(3) {
            animation-delay: .3s;
        }

@keyframes loadingBarMove {
    0% {
        transform: translateX(-110%);
    }

    50% {
        transform: translateX(85%);
    }

    100% {
        transform: translateX(270%);
    }
}

@keyframes loadingDotPulse {
    0%, 100% {
        opacity: .35;
        transform: translateY(0);
    }

    50% {
        opacity: 1;
        transform: translateY(-4px);
    }
}

@media (max-width: 640px) {
    .loading-overlay-app {
        padding: 16px;
        align-items: center;
    }

    .loading-card-app {
        border-radius: 26px;
        padding: 28px 22px;
    }

    .loading-icon-app {
        width: 72px;
        height: 72px;
        border-radius: 22px;
        font-size: 2rem;
    }

    .loading-card-app h2 {
        font-size: 1.25rem;
    }

    .loading-card-app p {
        font-size: .92rem;
    }
}

/* =========================================================
   Plan de crédito IA - Análisis cliente
   ========================================================= */

.credit-plan-card {
    border: 1px solid rgba(255, 194, 14, .38) !important;
    background: linear-gradient(180deg, #ffffff 0%, #fffdf3 100%) !important;
}

.credit-plan-header {
    margin-bottom: 18px;
}

.credit-plan-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
}

    .credit-plan-grid article {
        border: 1px solid #e5e7eb;
        border-radius: 18px;
        padding: 16px;
        background: #ffffff;
    }

        .credit-plan-grid article span {
            display: block;
            color: #7a4f00;
            font-size: .75rem;
            font-weight: 950;
            text-transform: uppercase;
            letter-spacing: .08em;
            margin-bottom: 8px;
        }

        .credit-plan-grid article p {
            margin: 0;
            color: #172033;
            line-height: 1.5;
        }

.credit-plan-wide {
    grid-column: span 2;
}

.credit-questions {
    margin-top: 16px;
    padding: 16px 18px;
    border-radius: 18px;
    background: #fff4c2;
    border: 1px solid rgba(255, 194, 14, .55);
}

    .credit-questions strong {
        display: block;
        color: #7a4f00;
        margin-bottom: 8px;
        font-weight: 950;
    }

    .credit-questions ul {
        margin: 0;
        padding-left: 18px;
    }

    .credit-questions li {
        margin-bottom: 7px;
        line-height: 1.45;
    }

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

    .credit-plan-wide {
        grid-column: auto;
    }
}

/* =========================================================
   Búsqueda de productos para cliente
   ========================================================= */

.product-search-card {
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
}

.product-search-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 18px;
}

.price-list-pill {
    flex: 0 0 auto;
    padding: 10px 14px;
    border-radius: 999px;
    background: #fff4c2;
    border: 1px solid rgba(255, 194, 14, .55);
    color: #7a4f00;
    font-weight: 950;
    font-size: .86rem;
}

.product-search-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    gap: 10px;
    align-items: center;
}

@media (max-width: 780px) {
    .product-search-header {
        flex-direction: column;
    }

    .product-search-row {
        grid-template-columns: 1fr;
    }

    .price-list-pill {
        width: fit-content;
    }
}

.product-zero-check {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 0 12px;
    min-height: 44px;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    background: #ffffff;
    color: #003b73;
    font-weight: 800;
    white-space: nowrap;
}

    .product-zero-check input {
        width: 16px;
        height: 16px;
        accent-color: #ffc20e;
    }

.product-thumb {
    width: 64px;
    height: 64px;
    border-radius: 14px;
    overflow: hidden;
    border: 1px solid #e5e7eb;
    background: #f8fafc;
    display: grid;
    place-items: center;
}

    .product-thumb img {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }

.product-thumb-empty {
    padding: 6px;
    text-align: center;
    font-size: .7rem;
    color: #94a3b8;
    font-weight: 800;
}

@media (max-width: 780px) {
    .product-zero-check {
        justify-content: center;
        width: 100%;
    }
}

.product-thumb-button {
    padding: 0;
    cursor: pointer;
}

    .product-thumb-button:hover {
        transform: translateY(-1px);
        box-shadow: 0 10px 22px rgba(15,23,42,.12);
    }

.link-button-app {
    border: 0;
    background: transparent;
    color: #003b73;
    padding: 0;
    cursor: pointer;
    font-weight: 900;
    text-align: left;
}

    .link-button-app:hover {
        text-decoration: underline;
    }

.product-detail-modal {
    width: min(980px, calc(100vw - 28px));
    max-height: calc(100vh - 36px);
    overflow: auto;
}

.product-detail-body {
    display: grid;
    gap: 18px;
}

.product-detail-top {
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr);
    gap: 18px;
    align-items: start;
}

.product-detail-image {
    width: 220px;
    height: 220px;
    border-radius: 22px;
    overflow: hidden;
    border: 1px solid #e5e7eb;
    background: #f8fafc;
    display: grid;
    place-items: center;
}

    .product-detail-image img {
        width: 100%;
        height: 100%;
        object-fit: contain;
        background: white;
    }

.product-detail-no-image {
    color: #94a3b8;
    font-weight: 900;
}

.product-detail-info h3 {
    margin: 0 0 6px;
    color: #003b73;
    font-size: 1.35rem;
}

.product-detail-kpis {
    margin-top: 16px;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

    .product-detail-kpis div {
        border: 1px solid #e5e7eb;
        background: #ffffff;
        border-radius: 16px;
        padding: 14px;
    }

    .product-detail-kpis span {
        display: block;
        color: #6b7280;
        font-size: .72rem;
        font-weight: 900;
        text-transform: uppercase;
        letter-spacing: .08em;
        margin-bottom: 6px;
    }

    .product-detail-kpis strong {
        display: block;
        color: #003b73;
        font-size: 1.05rem;
    }

    .product-detail-kpis small {
        display: block;
        color: #6b7280;
        margin-top: 4px;
    }

.product-detail-section {
    border: 1px solid #e5e7eb;
    border-radius: 18px;
    overflow: hidden;
    background: #fff;
}

    .product-detail-section h3 {
        margin: 0;
        padding: 16px 18px;
        color: #003b73;
        border-bottom: 1px solid #e5e7eb;
        background: #f8fafc;
    }

@media (max-width: 780px) {
    .product-detail-top {
        grid-template-columns: 1fr;
    }

    .product-detail-image {
        width: 100%;
        height: 260px;
    }

    .product-detail-kpis {
        grid-template-columns: 1fr;
    }
}


/* =========================================================
   Resumen por marca - análisis cliente
   ========================================================= */

.brand-opportunity-card {
    background: linear-gradient(180deg, #ffffff 0%, #fffdf3 100%);
    border: 1px solid rgba(255, 194, 14, .35) !important;
}

.brand-opportunity-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin-top: 14px;
}

.brand-opportunity-item {
    border: 1px solid #e5e7eb;
    border-radius: 18px;
    padding: 14px;
    background: #ffffff;
}

    .brand-opportunity-item span {
        display: block;
        color: #003b73;
        font-weight: 950;
        margin-bottom: 8px;
    }

    .brand-opportunity-item strong {
        display: block;
        font-size: 1.1rem;
        margin-bottom: 6px;
    }

    .brand-opportunity-item small {
        display: block;
        color: #6b7280;
        line-height: 1.4;
    }

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

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

.btn-small-app {
    min-height: 34px;
    padding: 8px 12px;
    font-size: .78rem;
}

/* =========================
   CRM COTIZACIONES
========================= */

.crm-kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 18px;
    margin-bottom: 22px;
}

.crm-kpi-card {
    position: relative;
    background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
    border: 1px solid #e5edf6;
    border-radius: 20px;
    padding: 20px 22px;
    box-shadow: 0 8px 28px rgba(15, 39, 74, 0.06);
    overflow: hidden;
}

    .crm-kpi-card::after {
        content: "";
        position: absolute;
        right: -18px;
        top: -18px;
        width: 84px;
        height: 84px;
        border-radius: 50%;
        opacity: .10;
    }

.crm-kpi-open::after {
    background: #1ca64c;
}

.crm-kpi-process::after {
    background: #f2b705;
}

.crm-kpi-closed::after {
    background: #d93025;
}

.crm-kpi-amount::after {
    background: #163e7a;
}

.crm-kpi-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.crm-kpi-title {
    font-size: .83rem;
    font-weight: 800;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: #6c7788;
}

.crm-kpi-icon {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #f2f6fb;
    color: #163e7a;
    font-weight: 900;
    font-size: .9rem;
}

.crm-kpi-number {
    font-size: 2.2rem;
    line-height: 1;
    font-weight: 900;
    color: #173f7c;
    margin-bottom: 8px;
}

.crm-kpi-footer {
    color: #7d8798;
    font-size: .92rem;
}

/* PANEL PRINCIPAL */

.crm-panel {
    background: #ffffff;
    border: 1px solid #e7edf5;
    border-radius: 24px;
    box-shadow: 0 14px 40px rgba(13, 35, 67, 0.08);
    overflow: hidden;
}

.crm-panel-header {
    padding: 24px 24px 18px 24px;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    border-bottom: 1px solid #edf2f7;
    background: linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
}

.crm-panel-title-wrap h2 {
    margin: 0;
    color: #143b78;
    font-size: 1.85rem;
    font-weight: 900;
    letter-spacing: -.02em;
}

.crm-panel-title-wrap p {
    margin: 8px 0 0;
    color: #778294;
    font-size: .98rem;
}

.crm-eyebrow {
    display: inline-block;
    margin-bottom: 8px;
    font-size: .78rem;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: #b38700;
}

.crm-toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.crm-check {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-height: 44px;
    padding: 0 16px;
    border-radius: 14px;
    border: 1px solid #e5ebf3;
    background: #fffaf0;
    font-weight: 700;
    color: #173f7c;
}

    .crm-check input {
        width: 16px;
        height: 16px;
    }

/* BOTONES */

.crm-btn {
    border: none;
    border-radius: 14px;
    min-height: 44px;
    padding: 0 18px;
    font-weight: 800;
    cursor: pointer;
    transition: all .18s ease;
}

    .crm-btn:hover {
        transform: translateY(-1px);
    }

.crm-btn-secondary {
    background: #ffffff;
    color: #173f7c;
    border: 1px solid #d8e2ef;
    box-shadow: 0 4px 16px rgba(17, 43, 84, 0.05);
}

.crm-btn-detail {
    background: linear-gradient(135deg, #173f7c 0%, #24539c 100%);
    color: #ffffff;
    padding: 0 16px;
    min-height: 38px;
    border-radius: 12px;
    box-shadow: 0 10px 20px rgba(23, 63, 124, 0.18);
}

    .crm-btn-detail:hover {
        box-shadow: 0 14px 24px rgba(23, 63, 124, 0.22);
    }

/* LOADING / EMPTY */

.crm-loading-box,
.crm-empty-state {
    padding: 38px 24px;
    text-align: center;
}

.crm-loading-box {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    color: #667487;
    font-weight: 700;
}

.crm-loading-spinner {
    width: 20px;
    height: 20px;
    border: 3px solid #d9e4f1;
    border-top-color: #173f7c;
    border-radius: 50%;
    animation: crm-spin .9s linear infinite;
}

@keyframes crm-spin {
    to {
        transform: rotate(360deg);
    }
}

.crm-empty-icon {
    font-size: 2.4rem;
    margin-bottom: 8px;
}

/* TABLA */

.crm-table-wrap {
    overflow-x: auto;
}

.crm-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

    .crm-table thead th {
        background: #f5f8fc;
        color: #173f7c;
        font-size: .8rem;
        font-weight: 900;
        letter-spacing: .06em;
        text-transform: uppercase;
        padding: 16px 18px;
        border-bottom: 1px solid #e7eef6;
    }

    .crm-table tbody td {
        padding: 16px 18px;
        border-bottom: 1px solid #eef3f8;
        vertical-align: middle;
        background: #ffffff;
        transition: background .15s ease;
    }

    .crm-table tbody tr:hover td {
        background: #fbfdff;
    }

.crm-row-open td:first-child {
    border-left: 4px solid #1ca64c;
}

.crm-row-process td:first-child {
    border-left: 4px solid #f2b705;
}

.crm-row-closed td:first-child {
    border-left: 4px solid #d93025;
}

.crm-doc-main {
    font-weight: 900;
    font-size: 1.15rem;
    color: #1a2a44;
}

.crm-doc-sub,
.crm-date-sub,
.crm-metric-sub,
.crm-days-sub {
    color: #7b8696;
    font-size: .88rem;
    margin-top: 4px;
}

.crm-date-main,
.crm-days-main,
.crm-metric-main {
    color: #1f2f48;
    font-weight: 800;
}

.crm-amount-main {
    color: #d93025;
    font-size: 1.15rem;
    font-weight: 900;
}

.crm-alert-text {
    margin-top: 6px;
    color: #d93025;
    font-size: .82rem;
    font-weight: 700;
}

/* CHIPS / BADGES */

.crm-chip {
    display: inline-flex;
    align-items: center;
    min-height: 32px;
    padding: 0 12px;
    border-radius: 999px;
    font-size: .8rem;
    font-weight: 900;
    letter-spacing: .03em;
    text-transform: uppercase;
}

.crm-chip-type {
    background: #eef3fb;
    color: #173f7c;
}

.estado-badge,
.estado-badge-open,
.estado-badge-process,
.estado-badge-closed {
    display: inline-flex;
    align-items: center;
    min-height: 30px;
    padding: 0 12px;
    border-radius: 999px;
    font-size: .78rem;
    font-weight: 900;
    letter-spacing: .03em;
    text-transform: uppercase;
}

.estado-badge-open {
    background: #e5f7eb;
    color: #198b43;
}

.estado-badge-process {
    background: #fff7db;
    color: #b88400;
}

.estado-badge-closed {
    background: #fde9e7;
    color: #d93025;
}

/* AYUDAS */

.text-right {
    text-align: right;
}

.text-center {
    text-align: center;
}

/* RESPONSIVE */

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

@media (max-width: 900px) {
    .crm-panel-header {
        flex-direction: column;
        align-items: stretch;
    }

    .crm-toolbar {
        justify-content: flex-start;
    }
}

@media (max-width: 768px) {
    .crm-kpi-grid {
        grid-template-columns: 1fr;
    }

    .crm-panel-title-wrap h2 {
        font-size: 1.45rem;
    }

    .crm-kpi-number {
        font-size: 1.8rem;
    }

    .crm-table thead th,
    .crm-table tbody td {
        padding: 12px 12px;
    }
}
/* =========================
   CRM PRIORIDAD COTIZACIONES
========================= */

.crm-priority-summary {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin: -4px 0 24px;
}

    .crm-priority-summary article {
        background: #ffffff;
        border: 1px solid #e7edf5;
        border-radius: 18px;
        padding: 14px 18px;
        box-shadow: 0 8px 22px rgba(13, 35, 67, 0.05);
    }

    .crm-priority-summary span {
        display: block;
        color: #738094;
        font-size: .76rem;
        font-weight: 900;
        text-transform: uppercase;
        letter-spacing: .06em;
        margin-bottom: 5px;
    }

    .crm-priority-summary strong {
        display: block;
        color: #143b78;
        font-size: 1.35rem;
        font-weight: 950;
    }

.crm-priority {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 30px;
    min-width: 72px;
    padding: 0 12px;
    border-radius: 999px;
    font-size: .76rem;
    font-weight: 950;
    letter-spacing: .05em;
    text-transform: uppercase;
}

.crm-priority-high {
    background: #fde9e7;
    color: #d93025;
    border: 1px solid rgba(217, 48, 37, .16);
}

.crm-priority-medium {
    background: #fff7db;
    color: #b88400;
    border: 1px solid rgba(184, 132, 0, .18);
}

.crm-priority-low {
    background: #e8f7ee;
    color: #198b43;
    border: 1px solid rgba(25, 139, 67, .16);
}

.crm-priority-reason {
    margin-top: 6px;
    color: #7c8797;
    font-size: .78rem;
    line-height: 1.25;
    max-width: 160px;
}

.crm-row-priority-high td {
    background: linear-gradient(90deg, rgba(217,48,37,.035), #ffffff 22%);
}

.crm-row-priority-medium td {
    background: linear-gradient(90deg, rgba(242,183,5,.045), #ffffff 22%);
}

.crm-row-priority-low td {
    background: linear-gradient(90deg, rgba(25,139,67,.025), #ffffff 22%);
}

.crm-table tbody tr:hover td {
    background: #f8fbff !important;
}

.text-warning-app {
    color: #b88400 !important;
}

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

@media (max-width: 760px) {
    .crm-priority-summary {
        grid-template-columns: 1fr;
    }
}

/* =========================
   CRM FUNNEL COTIZACIONES
========================= */

.crm-funnel-panel {
    background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
    border: 1px solid #e7edf5;
    border-radius: 24px;
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: 0 14px 40px rgba(13, 35, 67, 0.07);
}

.crm-funnel-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 18px;
}

    .crm-funnel-header h2 {
        margin: 0;
        color: #143b78;
        font-size: 1.65rem;
        font-weight: 950;
    }

    .crm-funnel-header p {
        margin: 6px 0 0;
        color: #768296;
    }

.crm-funnel-grid {
    display: grid;
    grid-template-columns: 1.15fr 1fr 1fr 1fr 1.15fr;
    gap: 12px;
    align-items: stretch;
    margin-bottom: 18px;
}

.crm-funnel-step {
    position: relative;
    border: 1px solid #e4ebf4;
    background: #ffffff;
    border-radius: 18px;
    padding: 18px 16px;
    text-align: left;
    min-height: 116px;
    cursor: pointer;
    overflow: hidden;
    box-shadow: 0 8px 22px rgba(13, 35, 67, .05);
    transition: all .18s ease;
}

    .crm-funnel-step:hover {
        transform: translateY(-2px);
        box-shadow: 0 16px 30px rgba(13, 35, 67, .10);
    }

    .crm-funnel-step::after {
        content: "";
        position: absolute;
        right: -26px;
        top: 50%;
        transform: translateY(-50%) rotate(45deg);
        width: 52px;
        height: 52px;
        background: inherit;
        border-top: 1px solid #e4ebf4;
        border-right: 1px solid #e4ebf4;
        z-index: 1;
    }

    .crm-funnel-step:last-child::after {
        display: none;
    }

.crm-funnel-label {
    display: block;
    color: #6f7b8f;
    font-size: .76rem;
    font-weight: 950;
    letter-spacing: .07em;
    text-transform: uppercase;
    margin-bottom: 8px;
}

.crm-funnel-step strong {
    display: block;
    color: #143b78;
    font-size: 2rem;
    font-weight: 950;
    line-height: 1;
    margin-bottom: 8px;
}

.crm-funnel-step small {
    display: block;
    color: #7c8797;
    font-size: .9rem;
    font-weight: 700;
}

.crm-funnel-open {
    background: linear-gradient(180deg, #ffffff 0%, #eefaf2 100%);
}

.crm-funnel-process {
    background: linear-gradient(180deg, #ffffff 0%, #fff8df 100%);
}

.crm-funnel-closed {
    background: linear-gradient(180deg, #ffffff 0%, #fff0ef 100%);
}

.crm-funnel-high {
    background: linear-gradient(180deg, #ffffff 0%, #fff3ec 100%);
}

.crm-funnel-open strong {
    color: #198b43;
}

.crm-funnel-process strong {
    color: #b88400;
}

.crm-funnel-closed strong,
.crm-funnel-high strong {
    color: #d93025;
}

/* FILTROS */

.crm-filter-bar {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    padding-top: 4px;
}

.crm-filter-pill {
    border: 1px solid #dce6f2;
    background: #ffffff;
    color: #173f7c;
    border-radius: 999px;
    min-height: 38px;
    padding: 0 16px;
    font-weight: 900;
    font-size: .84rem;
    cursor: pointer;
    transition: all .16s ease;
}

    .crm-filter-pill:hover {
        transform: translateY(-1px);
        box-shadow: 0 8px 16px rgba(13, 35, 67, .08);
    }

    .crm-filter-pill.active {
        background: #173f7c;
        border-color: #173f7c;
        color: #ffffff;
        box-shadow: 0 12px 22px rgba(23, 63, 124, .20);
    }

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

    .crm-funnel-step::after {
        display: none;
    }
}

@media (max-width: 680px) {
    .crm-funnel-grid {
        grid-template-columns: 1fr;
    }

    .crm-funnel-panel {
        padding: 18px;
    }
}

.crm-funnel-step.active {
    outline: 3px solid rgba(23, 63, 124, .18);
    border-color: #173f7c;
    box-shadow: 0 18px 34px rgba(23, 63, 124, .14);
    transform: translateY(-2px);
}

/* =========================
   CRM DETALLE COTIZACION
========================= */

.crm-detail-funnel {
    background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
    border: 1px solid #e7edf5;
    border-radius: 18px;
    padding: 18px;
}

.crm-detail-funnel-header {
    margin-bottom: 14px;
}

    .crm-detail-funnel-header h3 {
        margin: 0;
        color: #143b78;
        font-size: 1.25rem;
        font-weight: 950;
    }

    .crm-detail-funnel-header p {
        margin: 6px 0 0;
        color: #768296;
        font-size: .92rem;
    }

.crm-detail-mini-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 10px;
}

    .crm-detail-mini-grid .crm-filter-pill {
        min-height: 62px;
        border-radius: 16px;
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        justify-content: center;
        line-height: 1.2;
    }

        .crm-detail-mini-grid .crm-filter-pill strong {
            display: block;
            margin-top: 4px;
            font-size: 1.25rem;
        }

.crm-line-status {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 28px;
    padding: 0 10px;
    border-radius: 999px;
    font-size: .72rem;
    font-weight: 950;
    letter-spacing: .04em;
    text-transform: uppercase;
    background: #eef3fb;
    color: #173f7c;
}

.crm-line-status-pending {
    background: #fde9e7;
    color: #d93025;
}

.crm-line-status-partial {
    background: #fff7db;
    color: #b88400;
}

.crm-line-status-done {
    background: #e8f7ee;
    color: #198b43;
}

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

@media (max-width: 620px) {
    .crm-detail-mini-grid {
        grid-template-columns: 1fr;
    }
}

.crm-ai-card {
    margin-top: 24px;
    border-left: 5px solid #173f7c;
    background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
}

    .crm-ai-card .credit-questions {
        margin-top: 18px;
    }

    .crm-ai-card .table-responsive-app {
        margin-top: 18px;
    }