* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: "Segoe UI", Arial, Helvetica, sans-serif;
    background: #f3f1ec;
    color: #1d2430;
}

a {
    color: inherit;
}

.site-header {
    background: #173a3a;
    color: #fff;
}

.site-header-inner,
.page,
.site-footer {
    width: min(1180px, calc(100% - 32px));
    margin-left: auto;
    margin-right: auto;
}

.site-header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px 0;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
}

.brand-mark {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #e4572e;
    font-weight: 700;
}

.brand small {
    display: block;
    color: #c9d6d4;
    font-size: 0.78rem;
}

.site-nav {
    display: flex;
    gap: 8px;
}

.site-nav a {
    text-decoration: none;
    padding: 8px 12px;
    border-radius: 999px;
    color: #e7eeed;
}

.site-nav a.is-active,
.site-nav a:hover {
    background: #2b5858;
}

.page {
    padding: 28px 0 48px;
}

.page-heading {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    align-items: flex-start;
    margin-bottom: 24px;
}

.eyebrow {
    margin: 0 0 4px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.75rem;
    color: #e4572e;
    font-weight: 700;
}

h1 {
    margin: 0 0 8px;
    font-size: 2rem;
}

.lede,
.criteria,
.note,
.table-meta {
    color: #5b6775;
}

.criteria {
    max-width: 360px;
    margin: 0;
    font-size: 0.92rem;
}

/* ── Dos bloques de métricas ────────────────────────────────────── */
.metrics-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 24px;
}

.metrics-block {
    background: #fff;
    border: 1px solid #ddd6c8;
    border-radius: 14px;
    padding: 18px 20px 16px;
    box-shadow: 0 4px 12px rgb(23 58 58 / 4%);
}

.metrics-block-title {
    margin: 0 0 14px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: #8b9caa;
}

.cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 10px;
    margin-bottom: 0;
}

.card,
.panel,
.status-card {
    background: #f7f3ea;
    border: 1px solid #e8e1d4;
    border-radius: 10px;
    padding: 14px 16px;
}

.card h3,
.card h2,
.status-card h2 {
    margin: 0 0 6px;
    font-size: 0.82rem;
    color: #5b6775;
    font-weight: 600;
}

.metric {
    margin: 0;
    font-size: 1.4rem;
    font-weight: 700;
    color: #173a3a;
}

.metric-sub {
    margin: 4px 0 0;
    font-size: 0.73rem;
    color: #9aa5af;
}

.toolbar {
    display: grid;
    grid-template-columns: 1.4fr 1fr 1fr;
    gap: 12px;
    margin-bottom: 12px;
}

.toolbar label,
.search-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 0.85rem;
    color: #5b6775;
}

.toolbar input,
.toolbar select {
    border: 1px solid #cfc6b6;
    border-radius: 8px;
    padding: 10px 12px;
    font: inherit;
    background: #fff;
}

.table-wrap {
    overflow-x: auto;
    background: #fff;
    border: 1px solid #ddd6c8;
    border-radius: 12px;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 860px;
}

.data-table th,
.data-table td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid #eee7db;
    font-size: 0.92rem;
}

.data-table th {
    background: #f7f3ea;
    color: #173a3a;
    font-weight: 700;
}

.data-table td.numeric {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.customer-name {
    font-weight: 600;
}

.error-banner {
    background: #fde8e4;
    color: #8c2f13;
    border-radius: 8px;
    padding: 12px 14px;
}

.site-footer {
    padding: 16px 0 32px;
    color: #7b8794;
    font-size: 0.85rem;
}

.status-card ul {
    margin: 0;
    padding-left: 20px;
}

@media (max-width: 900px) {
    .cards,
    .toolbar,
    .page-heading {
        grid-template-columns: 1fr;
        display: grid;
    }

    .cards {
        grid-template-columns: 1fr 1fr;
    }

    .site-header-inner {
        flex-direction: column;
        align-items: flex-start;
    }
}

@media (max-width: 640px) {
    .cards {
        grid-template-columns: 1fr;
    }
}

/* ── Selector de periodo ────────────────────────────────────── */

.period-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.period-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: #5b6775;
    white-space: nowrap;
}

.period-options {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.period-btn {
    border: 1px solid #cfc6b6;
    border-radius: 999px;
    padding: 6px 14px;
    font: inherit;
    font-size: 0.88rem;
    background: #fff;
    color: #3a4552;
    cursor: pointer;
    transition: background .12s, border-color .12s, color .12s;
}

.period-btn:hover:not(:disabled) {
    background: #f0f8f7;
    border-color: #173a3a;
    color: #173a3a;
}

.period-btn.is-active {
    background: #173a3a;
    border-color: #173a3a;
    color: #fff;
    font-weight: 600;
}

.period-btn:disabled {
    opacity: .5;
    cursor: default;
}

.period-loading {
    font-size: 0.85rem;
    color: #5b6775;
    font-style: italic;
}

/* ── Periodo personalizado ──────────────────────────────────── */

.period-custom {
    display: flex;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 10px 16px;
    margin-bottom: 20px;
    padding: 14px 16px;
    background: #f7f3ea;
    border: 1px solid #e0d9cc;
    border-radius: 10px;
}

.period-custom-label {
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: #8b9caa;
    align-self: center;
    white-space: nowrap;
}

.period-custom-fields {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    flex-wrap: wrap;
    flex: 1;
}

.period-custom-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 0.82rem;
    color: #5b6775;
    font-weight: 600;
}

.period-custom-field input[type="date"] {
    border: 1px solid #cfc6b6;
    border-radius: 8px;
    padding: 7px 10px;
    font: inherit;
    font-size: 0.88rem;
    background: #fff;
    color: #1d2430;
}

.period-custom-apply {
    border: 1px solid #173a3a;
    border-radius: 999px;
    padding: 7px 18px;
    font: inherit;
    font-size: 0.88rem;
    background: #173a3a;
    color: #fff;
    cursor: pointer;
    font-weight: 600;
    transition: background .12s;
    align-self: flex-end;
}

.period-custom-apply:hover:not(:disabled) {
    background: #0f2828;
}

.period-custom-apply:disabled {
    opacity: .5;
    cursor: default;
}

.period-custom-error {
    width: 100%;
    margin: 0;
    font-size: 0.82rem;
    color: #c0392b;
    font-weight: 500;
}

/* ── Login ─────────────────────────────────────────────────── */

.login-body {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: #f3f1ec;
}

.login-wrap {
    width: 100%;
    max-width: 400px;
    padding: 24px 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.login-card {
    width: 100%;
    background: #fff;
    border: 1px solid #ddd6c8;
    border-radius: 16px;
    padding: 36px 32px 32px;
    box-shadow: 0 12px 32px rgb(23 58 58 / 8%);
}

.login-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 28px;
}

.login-brand-mark {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #e4572e;
    color: #fff;
    font-weight: 700;
    font-size: 1.2rem;
    flex-shrink: 0;
}

.login-brand-name {
    display: block;
    font-size: 1.15rem;
    color: #173a3a;
}

.login-brand-sub {
    display: block;
    font-size: 0.78rem;
    color: #7b8794;
    margin-top: 1px;
}

.login-title {
    margin: 0 0 20px;
    font-size: 1.3rem;
    color: #1d2430;
}

.login-error {
    margin: 0 0 16px;
    padding: 10px 14px;
    background: #fde8e4;
    color: #8c2f13;
    border-radius: 8px;
    font-size: 0.92rem;
}

.login-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 16px;
}

.login-field label {
    font-size: 0.88rem;
    font-weight: 600;
    color: #3a4552;
}

.login-field input {
    border: 1px solid #cfc6b6;
    border-radius: 8px;
    padding: 11px 14px;
    font: inherit;
    font-size: 1rem;
    background: #faf8f4;
    outline: none;
    transition: border-color .15s, box-shadow .15s;
}

.login-field input:focus {
    border-color: #173a3a;
    box-shadow: 0 0 0 3px rgb(23 58 58 / 12%);
    background: #fff;
}

.login-btn {
    display: block;
    width: 100%;
    margin-top: 8px;
    padding: 13px;
    background: #173a3a;
    color: #fff;
    border: none;
    border-radius: 8px;
    font: inherit;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: background .15s;
}

.login-btn:hover {
    background: #1e5050;
}

.login-footer {
    margin: 0;
    font-size: 0.8rem;
    color: #9aa3ac;
    text-align: center;
}

/* ── Módulos de inicio ──────────────────────────────────────── */

.module-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-top: 8px;
}

.module-card {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    background: #fff;
    border: 1px solid #ddd6c8;
    border-radius: 14px;
    padding: 20px;
    box-shadow: 0 8px 20px rgb(23 58 58 / 4%);
    text-decoration: none;
    color: inherit;
}

.module-card--active {
    border-color: #173a3a;
    transition: background .15s, box-shadow .15s;
}

.module-card--active:hover {
    background: #f0f8f7;
    box-shadow: 0 12px 28px rgb(23 58 58 / 10%);
}

.module-card--soon {
    opacity: .55;
    cursor: default;
}

.module-card-icon {
    font-size: 1.8rem;
    line-height: 1;
    flex-shrink: 0;
}

.module-card h2 {
    margin: 0 0 4px;
    font-size: 1rem;
    color: #173a3a;
}

.module-card p {
    margin: 0;
    font-size: 0.88rem;
    color: #5b6775;
}

.module-soon-label {
    font-size: 0.8rem;
    color: #9aa3ac;
    font-style: italic;
}

/* ── Usuario / logout en header ─────────────────────────────── */

.site-user {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-left: auto;
}

.site-user-name {
    font-size: 0.88rem;
    color: #c9d6d4;
}

.btn-logout {
    font-size: 0.85rem;
    text-decoration: none;
    padding: 6px 12px;
    border-radius: 999px;
    border: 1px solid #4a7a7a;
    color: #e7eeed;
    transition: background .15s;
}

.btn-logout:hover {
    background: #2b5858;
    border-color: #2b5858;
}

/* ── Tarjetas abonos / venta neta ───────────────────────────────── */
.card--refund {
    border-top: 3px solid #c0392b;
}

.card--refund .metric {
    color: #c0392b;
}

.card--net {
    border-top: 3px solid #27ae60;
}

.card--net .metric {
    color: #27ae60;
}

/* ── Columna abonos en tabla ────────────────────────────────────── */
td.refund-cell {
    color: #999;
}

td.refund-cell.has-refund {
    color: #c0392b;
    font-weight: 500;
}

@media (max-width: 900px) {
    .module-grid {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 640px) {
    .module-grid {
        grid-template-columns: 1fr;
    }

    .login-card {
        padding: 28px 20px 24px;
    }
}

/* ═══════════════════════════════════════════════════════════
   COMPARATIVA DE PERIODOS
   ═══════════════════════════════════════════════════════════ */

/* Barra con el botón de acceso a la comparativa */
.compare-trigger-bar {
    margin: 10px 0 4px;
    text-align: right;
}

.compare-trigger-btn {
    background: none;
    border: 1px solid #b0b8c1;
    border-radius: 6px;
    color: #555;
    cursor: pointer;
    font-size: 0.82rem;
    padding: 5px 14px;
    transition: background 0.15s, color 0.15s;
}

.compare-trigger-btn:hover {
    background: #f0f4f8;
    color: #2c3e50;
}

/* Panel principal */
.compare-panel {
    background: #fff;
    border: 1px solid #dde3ea;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,.07);
    margin: 12px 0 20px;
    padding: 20px 24px 24px;
}

.compare-panel-header {
    align-items: center;
    display: flex;
    justify-content: space-between;
    margin-bottom: 18px;
}

.compare-panel-title {
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
}

.compare-close-btn {
    background: none;
    border: none;
    color: #888;
    cursor: pointer;
    font-size: 1.1rem;
    padding: 2px 6px;
}

.compare-close-btn:hover { color: #333; }

/* Bloques de selección A / B */
.compare-selectors {
    display: flex;
    gap: 24px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.compare-period-block {
    background: #f7f9fb;
    border: 1px solid #e3e8ee;
    border-radius: 8px;
    flex: 1 1 260px;
    padding: 14px 16px;
}

.compare-period-heading {
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    margin: 0 0 10px;
    text-transform: uppercase;
    color: #5a6470;
}

/* Botones de periodo dentro de la comparativa */
.compare-period-options {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 10px;
}

.compare-btn {
    background: #fff;
    border: 1px solid #c8d0da;
    border-radius: 5px;
    color: #444;
    cursor: pointer;
    font-size: 0.78rem;
    padding: 4px 10px;
    transition: background 0.12s, border-color 0.12s;
}

.compare-btn:hover {
    background: #eef3f8;
}

.compare-btn.is-active {
    background: #2c3e50;
    border-color: #2c3e50;
    color: #fff;
}

/* Fechas reales del periodo seleccionado */
.compare-period-dates {
    color: #666;
    font-size: 0.78rem;
    margin: 8px 0 0;
}

/* Inputs de periodo personalizado dentro del panel */
.compare-custom-fields {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

/* Botón Comparar */
.compare-actions {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 4px;
}

.compare-run-btn {
    background: #2c3e50;
    border: none;
    border-radius: 6px;
    color: #fff;
    cursor: pointer;
    font-size: 0.88rem;
    font-weight: 600;
    padding: 8px 24px;
    transition: background 0.15s;
}

.compare-run-btn:hover   { background: #3d5166; }
.compare-run-btn:disabled { background: #8a9bab; cursor: default; }

.compare-error {
    color: #c0392b;
    font-size: 0.82rem;
    margin: 0;
}

.compare-loading {
    color: #666;
    font-size: 0.9rem;
    margin: 14px 0 0;
    font-style: italic;
}

.compare-fetch-error {
    color: #c0392b;
    margin-top: 14px;
}

/* Tabla de comparativa */
.cmp-table {
    border-collapse: collapse;
    font-size: 0.88rem;
    margin-top: 6px;
    width: 100%;
}

.cmp-table thead th {
    background: #f0f4f8;
    border-bottom: 2px solid #dde3ea;
    font-size: 0.76rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    padding: 8px 10px;
    text-align: left;
    text-transform: uppercase;
    vertical-align: top;
}

/* TH de periodos A y B: contenido apilado */
.cmp-th-period {
    text-align: center;
}

.cmp-th-period .cmp-th-slot,
.cmp-th-period .cmp-th-label,
.cmp-th-period .cmp-th-dates {
    display: block;
}

.cmp-th-slot {
    color: #8a9bab;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
}

.cmp-th-label {
    color: #2c3e50;
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0;
    margin-top: 2px;
    text-transform: none;
}

.cmp-th-dates {
    color: #7a8a99;
    font-size: 0.70rem;
    font-weight: 400;
    letter-spacing: 0;
    margin-top: 1px;
    text-transform: none;
}

.cmp-table th.cmp-val,
.cmp-table td.cmp-val {
    text-align: right;
}

.cmp-table tbody tr:nth-child(even) { background: #f9fbfd; }
.cmp-table tbody tr:hover            { background: #eef3f8; }

.cmp-table td {
    border-bottom: 1px solid #eaecf0;
    padding: 8px 10px;
    vertical-align: middle;
}

/* Filas de sección (NEGOCIO / CLIENTES) */
.cmp-section-row td {
    background: #2c3e50;
    color: #fff;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    padding: 5px 10px;
    text-transform: uppercase;
}

.cmp-label { color: #333; }

/* Indicadores de variación — color neutro, sin semántica bueno/malo */
.cmp-up  { color: #2c3e50; }
.cmp-dn  { color: #2c3e50; }
.cmp-eq  { color: #666; }
.cmp-na  { color: #aaa; }
.cmp-dir { font-size: 0.9em; margin-right: 2px; }
.cmp-pct { color: #777; font-size: 0.78rem; }

/* Gráficos mensuales dentro del panel comparativa */
.cmp-charts {
    border-top: 1px solid #e3e8ee;
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-top: 24px;
    padding-top: 20px;
}

/* Responsive comparativa */
@media (max-width: 700px) {
    .compare-selectors { flex-direction: column; }
    .cmp-table { font-size: 0.78rem; }
    .cmp-table td, .cmp-table th { padding: 6px 6px; }
    .cmp-th-dates { display: none; }
}

/* ═══════════════════════════════════════════════════════════
   EVOLUCIÓN 5 AÑOS
   ═══════════════════════════════════════════════════════════ */

/* Barra de botones: ahora agrupa Comparar + Evolución */
.compare-trigger-bar {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

/* Panel evolución */
.evo-panel {
    background: #fff;
    border: 1px solid #dde3ea;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,.07);
    margin: 12px 0 20px;
    padding: 20px 24px 28px;
}

.evo-panel-header {
    align-items: center;
    display: flex;
    justify-content: space-between;
    margin-bottom: 18px;
}

.evo-panel-title {
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
}

/* Controles: selector de año + botón */
.evo-controls {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
}

.evo-base-label {
    font-size: 0.85rem;
    font-weight: 600;
}

.evo-base-select {
    border: 1px solid #c8d0da;
    border-radius: 5px;
    font-size: 0.88rem;
    padding: 6px 10px;
}

/* Tabla resumen anual */
.evo-summary-wrap,
#evo-summary-wrap {
    margin-bottom: 24px;
    overflow-x: auto;
}

.evo-summary-table {
    border-collapse: collapse;
    font-size: 0.88rem;
    width: 100%;
}

.evo-summary-table thead th {
    background: #f0f4f8;
    border-bottom: 2px solid #dde3ea;
    font-size: 0.74rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    padding: 7px 12px;
    text-align: left;
    text-transform: uppercase;
}

.evo-summary-table th.evo-val,
.evo-summary-table td.evo-val {
    text-align: right;
}

.evo-summary-table tbody tr:nth-child(even) { background: #f9fbfd; }
.evo-summary-table tbody tr:hover            { background: #eef3f8; }

.evo-summary-table td {
    border-bottom: 1px solid #eaecf0;
    padding: 8px 12px;
    vertical-align: middle;
}

.evo-year-cell {
    align-items: center;
    display: flex;
    gap: 8px;
}

.evo-year-dot {
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
    height: 10px;
    width: 10px;
}

.evo-partial {
    color: #7a8a99;
    font-size: 0.74rem;
    font-weight: 400;
}

.evo-val {
    text-align: right;
}

/* Gráficos: 3 bloques apilados */
.evo-charts {
    display: flex;
    flex-direction: column;
    gap: 28px;
}

.evo-chart-block {
    background: #fafbfc;
    border: 1px solid #e8ecf0;
    border-radius: 8px;
    padding: 16px 18px 18px;
}

.evo-chart-title {
    color: #2c3e50;
    font-size: 0.88rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    margin: 0 0 12px;
    text-transform: uppercase;
}

.evo-chart-wrap {
    position: relative;
    /* Altura fija para que Chart.js no colapse */
    height: 240px;
}

.evo-chart-wrap canvas {
    display: block;
    max-height: 240px;
}

/* Responsive evolución */
@media (max-width: 700px) {
    .evo-controls { flex-direction: column; align-items: flex-start; }
    .evo-summary-table { font-size: 0.78rem; }
    .evo-summary-table td, .evo-summary-table th { padding: 6px 8px; }
    .evo-chart-wrap { height: 200px; }
    .evo-chart-wrap canvas { max-height: 200px; }
}

/* ═══════════════════════════════════════════════════════════
   CLIENTES (gestión / CRM)
   ═══════════════════════════════════════════════════════════ */

.crm-note {
    margin: 0;
    color: #5b6775;
    font-size: 0.92rem;
    flex: 1 1 280px;
}

.crm-toolbar {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin: 0 0 14px;
}

.crm-toolbar-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.crm-updated {
    margin: 0;
    font-size: 0.82rem;
    color: #7b8794;
    white-space: nowrap;
}

.crm-refresh-btn {
    background: #fff;
    border: 1px solid #b0b8c1;
    border-radius: 6px;
    color: #445566;
    cursor: pointer;
    font-size: 0.8rem;
    padding: 6px 12px;
}

.crm-refresh-btn:hover {
    background: #f0f4f8;
}

.crm-refresh-btn:disabled {
    opacity: 0.6;
    cursor: default;
}

.crm-refresh-status {
    margin: 0 0 12px;
    font-size: 0.88rem;
    color: #5b6775;
    font-style: italic;
}

body.crm-is-refreshing .crm-cards .metric {
    opacity: 0.45;
}

.crm-block {
    margin-bottom: 18px;
}

.crm-block-lede {
    margin: -6px 0 14px;
    color: #5b6775;
    font-size: 0.88rem;
}

.crm-cards .card--clickable {
    cursor: pointer;
    text-align: left;
    font: inherit;
    width: 100%;
    transition: border-color .15s, box-shadow .15s, background .15s;
}

.crm-cards .card--clickable:hover {
    border-color: #173a3a;
    background: #f7fbfa;
    box-shadow: 0 6px 16px rgb(23 58 58 / 8%);
}

.crm-cards .card--featured {
    border-color: #173a3a;
    border-width: 2px;
    box-shadow: 0 6px 16px rgb(23 58 58 / 10%);
}

.crm-cards .card--anomaly {
    border-top: 3px solid #c0392b;
}

.crm-list-panel {
    background: #fff;
    border: 1px solid #ddd6c8;
    border-radius: 14px;
    padding: 18px 20px 20px;
    margin-bottom: 20px;
    box-shadow: 0 4px 12px rgb(23 58 58 / 4%);
}

.crm-list-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.crm-list-header h2 {
    margin: 0;
    font-size: 1.1rem;
    color: #173a3a;
}

.crm-list-toolbar {
    margin-bottom: 10px;
}

.crm-list-more {
    text-align: center;
    margin-top: 14px;
}

.crm-list-more button {
    padding: .5rem 1.5rem;
    font-size: .95rem;
    cursor: pointer;
}

.crm-vip-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 8px;
}

.crm-vip-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.crm-dir-toolbar {
    grid-template-columns: 1.4fr 1fr 1fr auto;
}

.crm-dir-actions {
    display: flex;
    align-items: flex-end;
}

.crm-dir-total {
    margin: 4px 0 0;
    color: #5b6775;
    font-size: 0.95rem;
}

.crm-detail-btn {
    background: none;
    border: none;
    color: #173a3a;
    cursor: pointer;
    font-size: 0.82rem;
    text-decoration: underline;
    padding: 0;
}

.crm-pagination {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    justify-content: center;
    margin-top: 14px;
}

.crm-page-btn {
    background: #fff;
    border: 1px solid #c8d0da;
    border-radius: 5px;
    color: #444;
    cursor: pointer;
    font-size: 0.8rem;
    min-width: 34px;
    padding: 5px 8px;
}

.crm-page-btn.is-active {
    background: #2c3e50;
    border-color: #2c3e50;
    color: #fff;
}

.crm-page-btn:disabled {
    opacity: 0.45;
    cursor: default;
}

.crm-page-ellipsis {
    color: #9aa5af;
    padding: 0 2px;
}

.level-badge {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 4px;
    background: #eef2f6;
    color: #445566;
}

.level-badge--vip5 {
    background: #e8f1f8;
    color: #1f4e79;
}

.level-badge--vip10 {
    background: #e7eef8;
    color: #163a5f;
}

.level-badge--vip15 {
    background: #dde8f5;
    color: #0f2f4f;
}

.level-badge--guest {
    background: #f4f1ea;
    color: #6b5e4e;
}

.level-badge--anomaly {
    background: #fde8e4;
    color: #8c2f13;
}

@media (max-width: 900px) {
    .crm-dir-toolbar {
        grid-template-columns: 1fr;
    }
}

.crm-vip-header .metrics-block-title {
    margin-bottom: 6px;
}

.vip-progress {
    margin: 12px 0 8px;
    padding: 14px 16px;
    background: #f7f9fb;
    border: 1px solid #e3e8ee;
    border-radius: 8px;
}

.vip-progress-bar {
    height: 6px;
    border-radius: 999px;
    background: linear-gradient(90deg, #173a3a 0%, #4a9a8f 50%, #173a3a 100%);
    background-size: 200% 100%;
    animation: vip-progress-move 1.2s linear infinite;
    margin-bottom: 10px;
}

@keyframes vip-progress-move {
    0% { background-position: 100% 0; }
    100% { background-position: -100% 0; }
}

#vip-progress-text {
    margin: 0;
    color: #5b6775;
    font-size: 0.9rem;
}

.vip-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 10px 0 12px;
}

.vip-candidates-summary {
    margin: 10px 0 4px;
    font-size: 0.92rem;
    font-weight: 600;
    color: #173a3a;
}

.vip-anomaly-alert {
    margin: 10px 0 0;
}

.vip-filter {
    background: #fff;
    border: 1px solid #c8d0da;
    border-radius: 5px;
    color: #444;
    cursor: pointer;
    font-size: 0.78rem;
    padding: 4px 10px;
}

.vip-filter:hover { background: #eef3f8; }

.vip-filter.is-active {
    background: #2c3e50;
    border-color: #2c3e50;
    color: #fff;
}

.vip-email {
    font-size: 0.78rem;
    color: #7b8794;
    font-weight: 400;
    margin-top: 2px;
}

.vip-status {
    display: inline-block;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    padding: 3px 6px;
    border-radius: 4px;
    white-space: normal;
    line-height: 1.25;
    max-width: 100%;
}

.vip-status--up {
    background: #e8f6ef;
    color: #1e7a4a;
}

.vip-status--ok {
    background: #eef2f6;
    color: #445566;
}

.vip-status--warn {
    background: #fff4e5;
    color: #9a5b00;
}

.vip-status--err {
    background: #fde8e4;
    color: #8c2f13;
}

/* Tabla Revisar VIPs: quepa en la tarjeta sin scroll horizontal */
#vip-result .table-wrap {
    overflow-x: visible;
}

#vip-table {
    min-width: 0;
    width: 100%;
    table-layout: fixed;
}

#vip-table th,
#vip-table td {
    padding: 7px 5px;
    font-size: 0.8rem;
    vertical-align: top;
    overflow-wrap: anywhere;
    word-break: break-word;
}

#vip-table th:nth-child(1),
#vip-table td:nth-child(1) { width: 11%; }

#vip-table th:nth-child(2),
#vip-table td:nth-child(2) { width: 8%; }

#vip-table th:nth-child(3),
#vip-table td:nth-child(3) { width: 7%; }

#vip-table th:nth-child(4),
#vip-table td:nth-child(4) { width: 9%; }

#vip-table th:nth-child(5),
#vip-table td:nth-child(5) { width: 7%; }

#vip-table th:nth-child(6),
#vip-table td:nth-child(6) { width: 9%; }

#vip-table th:nth-child(7),
#vip-table td:nth-child(7) { width: 7%; }

#vip-table th:nth-child(8),
#vip-table td:nth-child(8) { width: 8%; }

#vip-table th:nth-child(9),
#vip-table td:nth-child(9) { width: 14%; }

#vip-table th:nth-child(10),
#vip-table td:nth-child(10) { width: 14%; }

#vip-table .customer-name,
#vip-table .vip-email {
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
}

#vip-table td.numeric {
    font-size: 0.78rem;
}

.crm-timings {
    display: none;
    margin-top: 8px;
    font-size: 0.78rem;
    color: #9aa5af;
}

body.crm-debug .crm-timings {
    display: block;
}

@media (max-width: 700px) {
    .crm-vip-header {
        flex-direction: column;
    }
}

/* ═══════════════════════════════════════════════════════════
   DATOS SEM (pantalla + card en Inicio)
   ═══════════════════════════════════════════════════════════ */

.module-sem-summary {
    margin: 0 0 4px;
    font-size: 0.88rem;
    color: #5b6775;
}

.module-sem-link {
    margin: 0;
    font-size: 0.82rem;
    font-weight: 700;
    color: #2c5f8a;
}

/* Barra superior: periodo + actualización */
.sem-topbar {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px 16px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}

.sem-topbar .period-bar {
    margin-bottom: 0;
}

.sem-topbar-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.sem-refresh-btn {
    font-weight: 700;
    letter-spacing: .03em;
}

/* Aviso suave de cobertura/estado */
.sem-warning {
    margin: 0 0 14px;
    padding: 10px 14px;
    font-size: 0.85rem;
    color: #7a5d10;
    background: #fdf6e3;
    border: 1px solid #ead9ab;
    border-radius: 8px;
}

/* Panel de resumen: pedidos protagonista + personas + dinero */
.sem-hero-card {
    text-align: center;
    padding: 26px 22px 22px;
}

.sem-big-number {
    margin: 0;
    font-size: 4rem;
    font-weight: 800;
    line-height: 1;
    color: #173a3a;
}

.sem-big-label {
    margin: 6px 0 22px;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: #8b9caa;
}

/* Total pedidos comerciales (contexto superior) */
.sem-total-comercial-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 14px;
    padding-bottom: 14px;
    border-bottom: 1px dashed #ddd;
}

.sem-total-comercial-number {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1;
    color: #5b6775;
}

.sem-total-comercial-label {
    margin: 0;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: #8b9caa;
}

/* Tooltip informativo */
.sem-info-tooltip {
    position: relative;
    display: inline-flex;
    align-items: center;
    cursor: help;
}

.sem-info-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #c5cdd5;
    color: #fff;
    font-size: 0.6rem;
    font-weight: 700;
    font-style: italic;
    font-family: Georgia, serif;
    line-height: 1;
    text-align: center;
    transition: background .15s;
}

.sem-info-tooltip:hover .sem-info-icon,
.sem-info-tooltip:focus .sem-info-icon {
    background: #5b6775;
}

.sem-info-box {
    display: none;
    position: absolute;
    left: 50%;
    bottom: calc(100% + 8px);
    transform: translateX(-50%);
    width: 300px;
    padding: 12px 14px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0,0,0,.12);
    font-size: 0.75rem;
    font-weight: 400;
    line-height: 1.5;
    color: #333;
    text-align: left;
    letter-spacing: normal;
    text-transform: none;
    z-index: 100;
}

.sem-info-tooltip:hover .sem-info-box,
.sem-info-tooltip:focus .sem-info-box {
    display: block;
}

.sem-info-box strong {
    display: block;
    margin-bottom: 6px;
    font-size: 0.78rem;
    color: #173a3a;
}

.sem-info-states {
    display: block;
    margin: 0 0 8px;
    font-size: 0.72rem;
    line-height: 1.6;
    color: #333;
}

.sem-info-footer {
    display: block;
    font-size: 0.7rem;
    line-height: 1.5;
    color: #8b9caa;
    border-top: 1px solid #eee;
    padding-top: 6px;
    margin-top: 4px;
}

/* Criterios y metodología — documentación general */
.criteria-list {
    margin: 8px 0 12px 18px;
    padding: 0;
    font-size: 0.85rem;
    line-height: 1.6;
    color: #333;
}
.criteria-list li { margin: 4px 0; }
.criteria-example {
    margin: 12px 0 0;
    padding: 12px 14px;
    background: #f7f3ea;
    border: 1px solid #e8e1d4;
    border-radius: 8px;
    font-size: 0.85rem;
    line-height: 1.6;
}
.criteria-example p { margin: 0 0 6px; }
.criteria-example ul { margin: 4px 0 8px 18px; }
.criteria-example li { margin: 2px 0; }

.sem-split {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 26px;
    flex-wrap: wrap;
}

.sem-split-item { min-width: 160px; }

.sem-split-num {
    margin: 0;
    font-size: 1.9rem;
    font-weight: 700;
    line-height: 1.1;
}

.sem-split-item--new .sem-split-num { color: #2c5f8a; }
.sem-split-item--rec .sem-split-num { color: #c0392b; }

.sem-split-label {
    margin: 5px 0 0;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: .07em;
    text-transform: uppercase;
    color: #5b6775;
}

.sem-caption {
    margin: 2px 0 0;
    font-size: 0.72rem;
    color: #9aa5af;
}

.sem-plus {
    font-size: 1.5rem;
    font-weight: 700;
    color: #8b9caa;
}

.sem-sep {
    border: none;
    border-top: 1px solid #eee7d9;
    max-width: 520px;
    margin: 18px auto;
}

.sem-statline {
    display: flex;
    justify-content: center;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 6px 14px;
    margin: 0;
    padding: 2px 0;
    font-size: 1rem;
    color: #5b6775;
}

.sem-statline strong {
    color: #173a3a;
    font-size: 1.08rem;
    font-weight: 700;
}

.sem-statline--sub {
    margin-top: 8px;
    font-size: 0.88rem;
}

.sem-statline--sub strong {
    font-size: 0.95rem;
}

.sem-dot   { color: #b9c2cb; }
.sem-arrow { color: #c0392b; font-weight: 700; }

/* Campañas */
.sem-camp-name {
    font-weight: 600;
    color: #173a3a;
}

.sem-camp-sub {
    margin-top: 2px;
    font-size: 0.72rem;
    color: #9aa5af;
}

.sem-note {
    margin: 12px 0 0;
    font-size: 0.8rem;
    color: #9aa5af;
}

/* Evolución: dos gráficos lado a lado */
.sem-charts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
    gap: 18px;
}

/* Calidad del dato: franja secundaria discreta */
.sem-quality-lede {
    margin: -4px 0 12px;
    font-size: 0.78rem;
    color: #9aa5af;
}

.sem-quality-strip {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
}

.sem-q-chip {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    margin: 0 10px 8px 0;
    padding: 3px 12px;
    font-size: 0.75rem;
    color: #5b6775;
    background: #f7f3ea;
    border: 1px solid #e8e1d4;
    border-radius: 999px;
    white-space: nowrap;
}

.sem-q-count {
    color: #173a3a;
    font-weight: 700;
}

.sem-q-chip--partial {
    border-style: dashed;
}

.sem-q-chip--zero {
    opacity: .45;
}

@media (max-width: 700px) {
    .sem-hero-card { padding: 20px 14px 16px; }
    .sem-big-number { font-size: 3rem; }
    .sem-split { gap: 16px; }
    .sem-split-item { min-width: 120px; }
    .sem-statline { flex-direction: column; align-items: center; gap: 4px; }
    .sem-total-comercial-number { font-size: 1.2rem; }
    .sem-total-comercial-row { gap: 6px; }
    .sem-info-box { width: 240px; left: 0; transform: none; }
}

/* Números clickeables */
.sem-clickable { cursor: pointer; transition: opacity .15s; }
.sem-clickable:hover { opacity: .7; }
.sem-clickable-hint {
    display: inline-block;
    font-size: .7rem;
    color: #5a6a7a;
    margin: 4px 0 0;
    padding: 3px 10px;
    background: #f5f7f9;
    border: 1px solid #b0bac6;
    border-radius: 4px;
    cursor: pointer;
    transition: background .15s, border-color .15s, color .15s;
    user-select: none;
}
.sem-clickable-hint:hover { background: #e8edf2; border-color: #7a8a9a; color: #222; }

/* Rentabilidad estimada */
.sem-rentabilidad-estimada {
    margin: 0;
    font-size: 0.88rem;
    color: #5b6775;
    line-height: 1.6;
}
.sem-rentabilidad-estimada strong { color: #173a3a; }

/* Captación de nuevos */
.sem-captacion-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px;
}

.sem-captacion-card {
    text-align: center;
    padding: 14px 10px;
    background: #faf8f3;
    border: 1px solid #e8e1d4;
    border-radius: 10px;
}

.sem-captacion-value {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 700;
    color: #173a3a;
}

.sem-captacion-label {
    margin: 5px 0 0;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: .05em;
    text-transform: uppercase;
    color: #5b6775;
}

.sem-captacion-sub {
    margin: 3px 0 0;
    font-size: 0.72rem;
    color: #9aa5af;
}

.sem-captacion-aviso {
    margin: 12px 0 0;
    font-size: 0.85rem;
    color: #7a5d10;
    background: #fdf6e3;
    border: 1px solid #ead9ab;
    border-radius: 8px;
    padding: 8px 12px;
}

.sem-captacion-aviso--ok {
    color: #1a7a3a;
    background: #eafaf0;
    border-color: #b5e8c8;
}

/* Captación — ¿Cómo se calcula? */
.sem-captacion-howto { text-align: center; margin: 8px 0 0; }
.sem-captacion-howto-btn {
    background: none; border: none; color: #5a6a7a; font-size: .82rem;
    cursor: pointer; text-decoration: underline; padding: 2px 6px;
}
.sem-captacion-howto-btn:hover { color: #222; }
.sem-captacion-howto-body {
    margin: 14px auto 0; max-width: 520px; text-align: left;
    font-size: .85rem; color: #333; line-height: 1.55;
    background: #f8f9fb; border: 1px solid #dde2e8; border-radius: 8px;
    padding: 16px 18px;
}
.sem-captacion-howto-body h4 { margin: 0 0 8px; font-size: .9rem; color: #111; }
.sem-captacion-howto-body p { margin: 4px 0; }
.sem-captacion-howto-formula { font-style: italic; color: #555; margin: 6px 0 !important; }
.sem-captacion-howto-steps { margin: 4px 0 8px 18px; padding: 0; }
.sem-captacion-howto-steps li { margin: 2px 0; }
.sem-captacion-howto-example {
    background: #fff; border: 1px solid #cdd3da; border-radius: 6px;
    padding: 10px 14px; margin: 10px 0;
}
.sem-captacion-howto-example-title { font-weight: 600; margin-bottom: 4px !important; }
.sem-captacion-howto-arrow { margin-left: 12px !important; }
.sem-captacion-howto-disclaimer { font-size: .78rem; color: #777; margin-top: 10px !important; }

/* Modal de detalle de pedidos */
.modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,.45);
}
.modal[hidden] { display: none; }

.modal-content {
    background: #fff;
    border-radius: 12px;
    padding: 24px 28px;
    max-width: 820px;
    width: 92vw;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 8px 32px rgba(0,0,0,.25);
}

.modal-content h3 {
    margin: 0 0 12px;
    font-size: 1.15rem;
    color: #173a3a;
}

.close-btn {
    position: absolute;
    top: 12px;
    right: 16px;
    font-size: 1.5rem;
    cursor: pointer;
    color: #8b9caa;
    line-height: 1;
}
.close-btn:hover { color: #173a3a; }

.modal-filtro {
    display: flex;
    gap: 8px;
    margin: 0 0 14px;
}

.filtro-btn {
    padding: 5px 12px;
    font-size: 0.78rem;
    border: 1px solid #ddd;
    border-radius: 6px;
    background: #faf8f3;
    cursor: pointer;
    color: #5b6775;
}
.filtro-btn:hover { background: #f0ece1; }
.filtro-btn.activo {
    background: #2c5f8a;
    color: #fff;
    border-color: #2c5f8a;
}

.modal-contenido table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82rem;
}

.modal-contenido th {
    text-align: left;
    padding: 6px 8px;
    border-bottom: 2px solid #ddd;
    color: #5b6775;
    font-size: 0.72rem;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.modal-contenido td {
    padding: 5px 8px;
    border-bottom: 1px solid #f0ece1;
    color: #173a3a;
}

.modal-contenido tr:hover td { background: #faf8f3; }

.paginacion {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 14px;
    font-size: 0.82rem;
    color: #5b6775;
}

.paginacion button {
    padding: 4px 12px;
    font-size: 0.78rem;
    border: 1px solid #ddd;
    border-radius: 6px;
    background: #faf8f3;
    cursor: pointer;
}
.paginacion button:disabled { opacity: .4; cursor: default; }

/* ── Informe para agencia ────────────────────────────────────────── */

.sem-informe-section { margin-top: 36px; }

.sem-informe-desc {
    font-size: 0.92rem;
    color: #5b6775;
    margin-bottom: 14px;
}

.sem-informe-panel {
    background: #faf8f3;
    border: 1px solid #e8e4d9;
    border-radius: 10px;
    padding: 18px 20px;
}

.sem-informe-fields {
    display: flex;
    align-items: flex-end;
    gap: 16px;
    flex-wrap: wrap;
}

.sem-informe-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.sem-informe-field span {
    font-size: 0.82rem;
    font-weight: 600;
    color: #555;
}

.sem-informe-field input[type="date"] {
    padding: 7px 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 0.88rem;
    font-family: inherit;
    background: #fff;
}

.sem-informe-btn {
    padding: 9px 22px;
    background: #2b6454;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}

.sem-informe-btn:hover { background: #224e41; }
.sem-informe-btn:disabled { opacity: 0.5; cursor: default; }

.sem-informe-btn--print {
    background: #555;
}
.sem-informe-btn--print:hover { background: #333; }

.sem-informe-error {
    margin-top: 10px;
    padding: 8px 12px;
    background: #fff3f3;
    border: 1px solid #e8c0c0;
    border-radius: 6px;
    color: #a33;
    font-size: 0.82rem;
}

/* ── Contenedor del informe ──────────────────────────────────────── */

.sem-informe-container {
    margin-top: 32px;
    background: #fff;
    border: 1px solid #d6d2c7;
    border-radius: 4px;
    padding: 0;
    color: #1a1a1a;
    font-size: 0.85rem;
    line-height: 1.5;
    overflow: hidden;
}

.sem-informe-container.hidden { display: none; }

/* ── Cabecera ────────────────────────────────────────────────────── */

.inf-header {
    background: #2b6454;
    color: #fff;
    padding: 28px 36px 24px;
    text-align: center;
}

.inf-header-brand {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 3px;
    text-transform: uppercase;
    opacity: 0.7;
    margin-bottom: 6px;
}

.inf-header-title {
    font-size: 1.55rem;
    font-weight: 700;
    margin: 0 0 10px;
    letter-spacing: -0.3px;
}

.inf-header-periodo {
    font-size: 0.95rem;
    margin: 0 0 4px;
    opacity: 0.92;
}

.inf-header-gen {
    font-size: 0.7rem;
    opacity: 0.55;
    margin: 0;
}

/* ── Secciones ───────────────────────────────────────────────────── */

.inf-section {
    padding: 22px 36px 24px;
    border-bottom: 1px solid #eae7df;
    page-break-inside: avoid;
}

.inf-section:last-of-type { border-bottom: none; }

.inf-section-title {
    font-size: 0.82rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: #2b6454;
    margin: 0 0 14px;
    padding-bottom: 6px;
    border-bottom: 2px solid #2b6454;
}

/* ── KPIs — CRITICAL: todo con !important ─────────────────────── */

.inf-kpi-grid {
    display: grid !important;
    grid-template-columns: repeat(5, 1fr) !important;
    gap: 10px !important;
    width: 100% !important;
}

.inf-kpi-grid--4 {
    display: grid !important;
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 10px !important;
    width: 100% !important;
}

.inf-kpi {
    display: block !important;
    background: #f5f3ee !important;
    border: 1px solid #e4e0d6 !important;
    border-radius: 4px !important;
    padding: 12px 10px 10px !important;
    text-align: center !important;
    min-width: 0 !important;
    float: none !important;
}

.inf-kpi-value {
    display: block !important;
    font-size: 1.2rem !important;
    font-weight: 700 !important;
    color: #1a1a1a !important;
    line-height: 1.2 !important;
    margin-bottom: 4px !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
}

.inf-kpi-label {
    display: block !important;
    font-size: 0.68rem !important;
    color: #777 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.3px !important;
    line-height: 1.3 !important;
}

/* ── Tablas ──────────────────────────────────────────────────────── */

.inf-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82rem;
}

.inf-table th {
    background: #2b6454;
    color: #fff;
    text-align: left;
    padding: 8px 12px;
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.inf-table th:first-child { border-radius: 3px 0 0 0; }
.inf-table th:last-child  { border-radius: 0 3px 0 0; }

.inf-table td {
    padding: 7px 12px;
    border-bottom: 1px solid #ece9e1;
    color: #1a1a1a;
}

.inf-table tbody tr:nth-child(even) td { background: #faf8f3; }
.inf-table tbody tr:hover td { background: #f0ede4; }

.inf-table tfoot td {
    background: #f0ece1;
    font-weight: 700;
    border-top: 2px solid #d0ccc1;
    border-bottom: none;
}

.inf-table .num {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.inf-empty {
    color: #999;
    font-style: italic;
    text-align: center;
    padding: 20px;
}

/* ── Lectura del periodo ─────────────────────────────────────────── */

.inf-lectura {
    background: #f9f8f5;
    border-left: 3px solid #2b6454;
    padding: 14px 18px;
    border-radius: 0 4px 4px 0;
    font-size: 0.85rem;
    line-height: 1.65;
    color: #333;
}

.inf-lectura p { margin: 0 0 8px; }
.inf-lectura p:last-child { margin-bottom: 0; }

/* ── Pie ─────────────────────────────────────────────────────────── */

.inf-footer {
    padding: 14px 36px;
    background: #f5f3ee;
    border-top: 1px solid #e4e0d6;
    font-size: 0.7rem;
    color: #888;
    text-align: center;
}

.inf-footer p { margin: 0; }

/* ── Print ───────────────────────────────────────────────────────── */

@page {
    size: A4 portrait;
    margin: 12mm 12mm 15mm;
}

@media print {
    body { background: #fff !important; margin: 0; padding: 0; }

    /* ── Ocultar TODO el dashboard y el sitio ── */
    header.site-header,
    footer.site-footer,
    .site-user,
    .no-print { display: none !important; }

    /* Ocultar todos los hijos directos del main EXCEPTO el informe */
    main.page > * {
        display: none !important;
    }

    /* ── Mostrar SOLO el informe ── */
    #sem-informe-container {
        display: block !important;
        border: none !important;
        border-radius: 0 !important;
        padding: 0 !important;
        margin: 0 !important;
        box-shadow: none !important;
        width: 100% !important;
        font-size: 8pt !important;
        page-break-inside: auto !important;
    }

    .inf-header {
        background: #2b6454 !important;
        color: #fff !important;
        padding: 14mm 15mm 10mm !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    .inf-header-brand {
        opacity: 0.7 !important;
    }

    .inf-section {
        padding: 8mm 15mm 6mm !important;
        border-bottom: 0.5pt solid #ccc !important;
        page-break-inside: avoid !important;
        page-break-after: auto !important;
    }

    .inf-section-title {
        color: #2b6454 !important;
        border-bottom-color: #2b6454 !important;
    }

    .inf-kpi-grid {
        display: grid !important;
        grid-template-columns: repeat(5, 1fr) !important;
        gap: 3mm !important;
    }

    .inf-kpi-grid--4 {
        display: grid !important;
        grid-template-columns: repeat(4, 1fr) !important;
        gap: 3mm !important;
    }

    .inf-kpi {
        background: #f5f3ee !important;
        border-color: #d0ccc1 !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    .inf-kpi-value {
        font-size: 10pt !important;
        color: #000 !important;
    }

    .inf-table th {
        background: #2b6454 !important;
        color: #fff !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    .inf-table td {
        border-bottom-color: #ddd !important;
    }

    .inf-table tbody tr:nth-child(even) td {
        background: #f8f7f3 !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    .inf-table tfoot td {
        background: #f0ece1 !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    .inf-lectura {
        background: #f9f8f5 !important;
        border-left-color: #2b6454 !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    .inf-footer {
        background: #f5f3ee !important;
    }
}
