/* ==========================================================================
   Portal de Certificados Laborales — IPS MedCare
   --------------------------------------------------------------------------
   TODO el CSS está prefijado con .cp-portal. Ninguna regla puede afectar el
   encabezado, el pie ni el resto del sitio web de Odoo.
   ========================================================================== */

/* --------------------------------------------------------------- Tokens */
.cp-portal {
    --cp-primary: #1565c0;
    --cp-primary-600: #1976d2;
    --cp-primary-700: #0d47a1;
    --cp-blue: #2f5fd0;
    --cp-sky: #29b6f6;
    --cp-grad: linear-gradient(100deg, #2f5fd0 0%, #29b6f6 100%);
    --cp-primary-soft: color-mix(in srgb, var(--cp-primary) 8%, #ffffff);
    --cp-primary-line: color-mix(in srgb, var(--cp-primary) 20%, #ffffff);
    --cp-ink: #263238;
    --cp-ink-soft: #37474f;
    --cp-muted: #607d8b;
    --cp-line: #e1e8f0;
    --cp-line-soft: #eef3f9;
    --cp-bg: #f7f9fc;
    --cp-surface: #ffffff;
    --cp-danger: #c62828;
    --cp-danger-bg: #ffebee;
    --cp-radius-sm: 9px;
    --cp-radius: 14px;
    --cp-radius-lg: 20px;
    --cp-shadow-sm: 0 1px 2px rgba(21, 101, 192, .07);
    --cp-shadow: 0 10px 30px -22px rgba(21, 101, 192, .55);
    --cp-shadow-lg: 0 30px 70px -30px rgba(13, 71, 161, .55);
    --cp-font: inherit;
    --cp-header-h: 68px;

    position: relative;
    color: var(--cp-ink);
    font-family: var(--cp-font);
    font-size: 16px;
    line-height: 1.55;
    background: var(--cp-bg);
    -webkit-font-smoothing: antialiased;
}

.cp-portal *,
.cp-portal *::before,
.cp-portal *::after {
    box-sizing: border-box;
}

.cp-portal [hidden] {
    display: none !important;
}

.cp-portal img {
    max-width: 100%;
    display: block;
}

.cp-portal a {
    color: inherit;
    text-decoration: none;
}

.cp-portal h1,
.cp-portal h2,
.cp-portal h3,
.cp-portal p {
    margin: 0;
}

.cp-portal button {
    font: inherit;
}

.cp-portal :focus-visible {
    outline: 3px solid color-mix(in srgb, var(--cp-primary) 55%, #ffffff);
    outline-offset: 2px;
}

.cp-portal .cp-wrap {
    width: min(1180px, 100% - 40px);
    margin-inline: auto;
}

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

.cp-portal .cp-eyebrow {
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--cp-muted);
}

.cp-portal .cp-skip {
    position: absolute;
    left: -9999px;
    top: 0;
    background: var(--cp-ink);
    color: #fff;
    padding: 10px 16px;
    z-index: 999;
    border-radius: 0 0 8px 0;
}

.cp-portal .cp-skip:focus {
    left: 0;
}

/* -------------------------------------------------------- Logo en header */
.cp-standalone .cp-brand-logo {
    height: 36px;
    width: auto;
    max-width: 120px;
    object-fit: contain;
    border-radius: 6px;
    flex: none;
}

/* -------------------------------------------------------- Nav links mejorados */
.cp-standalone .cp-nav-link {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 8px 14px;
    border-radius: 999px;
    font-size: 13.5px;
    font-weight: 600;
    color: #37474f;
    text-decoration: none;
    transition: background .15s ease, color .15s ease;
}

.cp-standalone .cp-nav-link:hover {
    background: #e8f2fd;
    color: #0d47a1;
}

.cp-standalone .cp-nav-link--logout {
    color: var(--cp-danger);
}

.cp-standalone .cp-nav-link--logout:hover {
    background: var(--cp-danger-bg);
    color: var(--cp-danger);
}

/* -------------------------------------------------------- Footer mejorado */
.cp-standalone .cp-footer-inner {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 24px;
    flex-wrap: wrap;
    padding: 28px 0;
    font-size: 12.5px;
    color: #607d8b;
}

.cp-standalone .cp-footer-left {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    min-width: 0;
}

.cp-standalone .cp-footer-logo {
    height: 32px;
    width: auto;
    max-width: 90px;
    object-fit: contain;
    border-radius: 5px;
    flex: none;
    margin-top: 2px;
    opacity: .85;
}

.cp-standalone .cp-footer-brand {
    font-weight: 700;
    color: #37474f;
    margin-bottom: 4px;
}

.cp-standalone .cp-footer-note {
    max-width: 520px;
    line-height: 1.5;
}

.cp-standalone .cp-footer-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
}

.cp-standalone .cp-footer-contact {
    display: flex;
    align-items: center;
    gap: 5px;
}

.cp-standalone .cp-footer-contact a {
    color: var(--cp-primary);
    text-decoration: none;
}

.cp-standalone .cp-footer-contact a:hover {
    text-decoration: underline;
}

.cp-standalone .cp-footer-copy {
    color: #90a4ae;
}

/* ------------------------------------------------------- Banda de título */
.cp-portal .cp-band {
    position: relative;
    overflow: hidden;
    background: var(--cp-grad);
    padding: 46px 0 42px;
    text-align: center;
}

.cp-portal .cp-band--sm {
    padding: 34px 0 30px;
}

.cp-portal .cp-band-inner {
    position: relative;
    z-index: 2;
    width: min(1180px, 100% - 40px);
    margin: 0 auto;
}

.cp-portal .cp-band h1 {
    color: #fff;
    font-size: clamp(28px, 3.6vw, 42px);
    line-height: 1.15;
    letter-spacing: -.015em;
    font-weight: 500;
    margin: 0;
}

.cp-portal .cp-band--sm h1 {
    font-size: clamp(24px, 3vw, 34px);
}

.cp-portal .cp-band-eyebrow {
    color: rgba(255, 255, 255, .78);
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: .14em;
    text-transform: uppercase;
    margin-bottom: 6px;
}

.cp-portal .cp-band-wave {
    position: absolute;
    right: -30px;
    top: 50%;
    transform: translateY(-50%);
    width: 55%;
    height: 150%;
    color: rgba(255, 255, 255, .13);
    z-index: 1;
    pointer-events: none;
}

/* ---------------------------------------------------------- Acceso (login) */
.cp-portal .cp-login-page {
    padding: 44px 0 56px;
    background:
        radial-gradient(700px 320px at 8% 0%, rgba(41, 182, 246, .14), transparent 62%),
        radial-gradient(600px 320px at 96% 100%, rgba(21, 101, 192, .12), transparent 62%),
        repeating-linear-gradient(135deg, rgba(21, 101, 192, .035) 0 16px, transparent 16px 32px);
}

.cp-portal .cp-login-card {
    width: min(980px, 100% - 40px);
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1fr 1fr;
    background: var(--cp-surface);
    border: 1px solid var(--cp-line);
    border-radius: 22px;
    overflow: hidden;
    box-shadow: 0 34px 80px -48px rgba(13, 71, 161, .65);
    min-height: 540px;
}

.cp-portal .cp-login-aside {
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 24px;
    padding: 40px 38px 30px;
    color: #fff;
    background:
        radial-gradient(500px 260px at 90% 0%, rgba(255, 255, 255, .16), transparent 60%),
        linear-gradient(150deg, #2f5fd0 0%, #1565c0 45%, #29b6f6 100%);
}

.cp-portal .cp-login-wave {
    position: absolute;
    left: 0;
    right: 0;
    bottom: -12%;
    width: 100%;
    height: 70%;
    color: rgba(255, 255, 255, .16);
    pointer-events: none;
}

.cp-portal .cp-login-aside-top {
    position: relative;
    z-index: 2;
}

.cp-portal .cp-login-mark {
    width: 46px;
    height: 46px;
    border-radius: 13px;
    display: grid;
    place-items: center;
    background: rgba(255, 255, 255, .16);
    border: 1px solid rgba(255, 255, 255, .28);
    margin-bottom: 16px;
}

.cp-portal .cp-login-mark svg {
    width: 22px;
    height: 22px;
}

.cp-portal .cp-login-brand {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -.01em;
}

.cp-portal .cp-login-brand-sub {
    font-size: 12.5px;
    color: rgba(255, 255, 255, .78);
    margin-top: 2px;
}

.cp-portal .cp-login-aside-body {
    position: relative;
    z-index: 2;
}

.cp-portal .cp-login-claim {
    font-size: 20px;
    line-height: 1.4;
    font-weight: 600;
    color: #fff;
    margin-bottom: 12px;
    display: -webkit-box;
    -webkit-line-clamp: 6;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.cp-portal .cp-login-text {
    font-size: 13px;
    line-height: 1.6;
    color: rgba(255, 255, 255, .8);
    overflow: hidden;
}

.cp-portal .cp-login-aside-foot {
    position: relative;
    z-index: 2;
    font-size: 11.5px;
    color: rgba(255, 255, 255, .65);
    border-top: 1px solid rgba(255, 255, 255, .18);
    padding-top: 14px;
}

.cp-portal .cp-login-form {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 48px 44px 36px;
}

.cp-portal .cp-login-badge {
    position: absolute;
    top: 38px;
    right: 30px;
    display: flex;
    align-items: center;
    gap: 10px;
    background: linear-gradient(100deg, #2f5fd0, #2196f3);
    color: #fff;
    padding: 11px 16px;
    border-radius: 12px;
    box-shadow: 0 16px 30px -18px rgba(33, 150, 243, .95);
}

.cp-portal .cp-login-badge-icon {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    display: grid;
    place-items: center;
    background: rgba(255, 255, 255, .18);
}

.cp-portal .cp-login-badge-icon svg {
    width: 16px;
    height: 16px;
}

.cp-portal .cp-login-badge-text {
    display: flex;
    flex-direction: column;
    line-height: 1.1;
}

.cp-portal .cp-login-badge-text strong {
    font-size: 13px;
}

.cp-portal .cp-login-badge-text small {
    font-size: 11px;
    color: rgba(255, 255, 255, .8);
}

.cp-portal .cp-login-title {
    font-size: clamp(26px, 2.6vw, 32px);
    font-weight: 600;
    letter-spacing: -.02em;
    color: var(--cp-primary);
    margin: 0 0 8px;
    max-width: 65%;
}

.cp-portal .cp-login-sub {
    font-size: 13.5px;
    color: var(--cp-muted);
    margin-bottom: 22px;
    max-width: 92%;
}

.cp-portal .cp-login-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin: 6px 0 14px;
}

.cp-portal .cp-check {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 13.5px;
    color: var(--cp-ink-soft);
    cursor: pointer;
}

.cp-portal .cp-check input {
    width: 17px;
    height: 17px;
    accent-color: var(--cp-primary);
    cursor: pointer;
}

.cp-portal .cp-login-help {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--cp-primary-700);
}

.cp-portal .cp-login-help:hover {
    text-decoration: underline;
}

.cp-portal .cp-login-foot {
    margin-top: 16px;
    font-size: 12.5px;
    color: var(--cp-muted);
}

.cp-portal .cp-login-foot a {
    color: var(--cp-primary-700);
    font-weight: 600;
}

.cp-portal .cp-login-legal {
    width: min(980px, 100% - 40px);
    margin: 18px auto 0;
    text-align: center;
    font-size: 11.5px;
    color: var(--cp-muted);
}

/* -------------------------------------------------------------- Sección */
.cp-portal .cp-section {
    padding: 34px 0;
}

.cp-portal .cp-section--tight {
    padding-top: 0;
}

.cp-portal .cp-section-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
    margin-bottom: 18px;
}

.cp-portal .cp-section-head h2 {
    font-size: 20px;
    font-weight: 600;
    letter-spacing: -.01em;
    color: var(--cp-ink);
}

.cp-portal .cp-section-sub {
    font-size: 13px;
    color: var(--cp-muted);
    margin-top: 2px;
}

/* ---------------------------------------------------------------- Buscador */
.cp-portal .cp-search {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1 1 260px;
    min-width: 220px;
    background: var(--cp-surface);
    border: 1px solid var(--cp-line);
    border-radius: 10px;
    padding: 0 12px;
    transition: border-color .15s ease, box-shadow .15s ease;
}

.cp-portal .cp-search > svg {
    width: 17px;
    height: 17px;
    color: var(--cp-muted);
    flex: none;
}

.cp-portal .cp-search input {
    flex: 1;
    border: 0;
    background: transparent;
    outline: 0;
    font: inherit;
    font-size: 14.5px;
    color: var(--cp-ink);
    padding: 11px 0;
    min-width: 0;
}

.cp-portal .cp-search input::placeholder {
    color: #90a4ae;
}

.cp-portal .cp-search:focus-within {
    border-color: var(--cp-primary-600);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--cp-primary) 12%, transparent);
}

.cp-portal .cp-search--head {
    flex: 0 1 330px;
}

/* ---------------------------------------------------------------- Tarjetas */
.cp-portal .cp-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.cp-portal .cp-card {
    --cp-card-accent: var(--cp-primary);
    position: relative;
    display: flex;
    align-items: center;
    gap: 14px;
    background: var(--cp-surface);
    border: 1px solid var(--cp-line);
    border-radius: var(--cp-radius);
    padding: 18px 18px 18px 20px;
    box-shadow: var(--cp-shadow-sm);
    transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
    overflow: hidden;
}

.cp-portal .cp-card::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: var(--cp-card-accent);
}

.cp-portal .cp-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--cp-shadow);
    border-color: var(--cp-primary-line);
}

.cp-portal .cp-card-logo {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: #eef4fb;
    display: grid;
    place-items: center;
    overflow: hidden;
    flex: none;
}

.cp-portal .cp-card-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 6px;
}

.cp-portal .cp-card-initial {
    font-weight: 800;
    font-size: 20px;
    color: var(--cp-primary-700);
}

.cp-portal .cp-card-body {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex: 1;
}

.cp-portal .cp-card-body strong {
    font-size: 14.5px;
    font-weight: 700;
    letter-spacing: -.01em;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.3;
    color: var(--cp-ink);
}

.cp-portal .cp-card-body small {
    color: var(--cp-muted);
    font-size: 12.5px;
    margin-top: 3px;
}

.cp-portal .cp-card-arrow {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: var(--cp-line-soft);
    color: var(--cp-muted);
    flex: none;
    transition: background .18s ease, color .18s ease, transform .18s ease;
}

.cp-portal .cp-card-arrow svg {
    width: 16px;
    height: 16px;
}

.cp-portal .cp-card:hover .cp-card-arrow {
    background: var(--cp-primary-600);
    color: #fff;
    transform: translateX(2px);
}

.cp-portal .cp-empty {
    text-align: center;
    color: var(--cp-muted);
    padding: 26px;
    border: 1px dashed var(--cp-line);
    border-radius: var(--cp-radius);
    background: var(--cp-surface);
    font-size: 14px;
}

.cp-portal .cp-help-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    flex-wrap: wrap;
    background: var(--cp-surface);
    border: 1px solid var(--cp-line);
    border-radius: var(--cp-radius-lg);
    padding: 26px 28px;
    box-shadow: var(--cp-shadow-sm);
}

.cp-portal .cp-help-card h2 {
    font-size: 18px;
    letter-spacing: -.01em;
    margin-bottom: 6px;
    color: var(--cp-ink);
}

.cp-portal .cp-help-card p {
    color: var(--cp-muted);
    font-size: 14px;
    max-width: 620px;
}

/* ---------------------------------------------------------------- Botones */
.cp-portal .cp-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 1px solid transparent;
    border-radius: 8px;
    padding: 11px 20px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: transform .12s ease, background .15s ease, box-shadow .15s ease, color .15s ease;
    white-space: nowrap;
}

.cp-portal .cp-btn svg {
    width: 16px;
    height: 16px;
}

.cp-portal .cp-btn:active {
    transform: translateY(1px);
}

.cp-portal .cp-btn--primary {
    background: linear-gradient(100deg, var(--cp-blue), #2196f3);
    color: #fff;
    box-shadow: 0 10px 22px -14px rgba(33, 150, 243, .9);
}

.cp-portal .cp-btn--primary:hover {
    box-shadow: 0 14px 26px -12px rgba(33, 150, 243, .85);
    color: #fff;
}

.cp-portal .cp-btn--ghost {
    background: var(--cp-surface);
    border-color: var(--cp-line);
    color: var(--cp-ink-soft);
}

.cp-portal .cp-btn--ghost:hover {
    border-color: var(--cp-primary-line);
    background: var(--cp-primary-soft);
    color: var(--cp-primary-700);
}

.cp-portal .cp-btn--soft {
    background: var(--cp-primary-soft);
    color: var(--cp-primary-700);
    border-color: transparent;
}

.cp-portal .cp-btn--soft:hover {
    background: color-mix(in srgb, var(--cp-primary) 14%, #ffffff);
}

.cp-portal .cp-btn--sm {
    padding: 9px 14px;
    font-size: 13px;
}

.cp-portal .cp-btn--xs {
    padding: 7px 12px;
    font-size: 12.5px;
    border-radius: 7px;
}

.cp-portal .cp-btn--block {
    width: 100%;
    padding: 13px 20px;
    font-size: 15px;
}

.cp-portal .cp-btn--pill {
    border-radius: 999px;
}

.cp-portal .cp-icon-btn {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    display: inline-grid;
    place-items: center;
    border: 1px solid transparent;
    background: transparent;
    color: var(--cp-muted);
    cursor: pointer;
    transition: background .15s ease, color .15s ease;
}

.cp-portal .cp-icon-btn svg {
    width: 17px;
    height: 17px;
}

.cp-portal .cp-icon-btn:hover {
    background: var(--cp-primary-soft);
    color: var(--cp-primary-700);
}

/* ------------------------------------------------------------------ Login */
.cp-portal .cp-auth {
    display: flex;
    justify-content: center;
    padding: 4px 0 34px;
}

.cp-portal .cp-auth-card {
    width: min(460px, 100%);
    background: var(--cp-surface);
    border: 1px solid var(--cp-line);
    border-radius: var(--cp-radius-lg);
    box-shadow: 0 24px 60px -34px rgba(13, 71, 161, .55);
    padding: 32px 34px 26px;
    position: relative;
}

.cp-portal .cp-back {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 600;
    color: var(--cp-muted);
    margin-bottom: 20px;
}

.cp-portal .cp-back svg {
    width: 15px;
    height: 15px;
}

.cp-portal .cp-back:hover {
    color: var(--cp-primary-700);
}

.cp-portal .cp-auth-icon {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    background: #e8f2fd;
    color: var(--cp-primary);
    margin-bottom: 16px;
}

.cp-portal .cp-auth-icon svg {
    width: 26px;
    height: 26px;
}

.cp-portal .cp-auth-title {
    font-size: 25px;
    letter-spacing: -.02em;
    line-height: 1.2;
    margin: 6px 0 10px;
    color: var(--cp-ink);
    font-weight: 600;
}

.cp-portal .cp-auth-lead {
    color: var(--cp-muted);
    font-size: 14.5px;
    margin-bottom: 20px;
}

.cp-portal .cp-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.cp-portal .cp-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--cp-ink-soft);
}

.cp-portal .cp-input-group {
    position: relative;
    display: flex;
    align-items: center;
}

.cp-portal .cp-input-group input {
    width: 100%;
    border: 1px solid var(--cp-line);
    border-radius: 10px;
    padding: 13px 74px 13px 14px;
    font: inherit;
    font-size: 15px;
    letter-spacing: .04em;
    background: #fbfdff;
    color: var(--cp-ink);
    transition: border-color .15s ease, box-shadow .15s ease;
}

.cp-portal .cp-input-group input:focus {
    outline: none;
    border-color: var(--cp-primary-600);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--cp-primary) 12%, transparent);
    background: #fff;
}

.cp-portal .cp-input-toggle {
    position: absolute;
    right: 6px;
    border: 0;
    background: transparent;
    color: var(--cp-primary-700);
    font-size: 12.5px;
    font-weight: 700;
    padding: 8px 10px;
    border-radius: 7px;
    cursor: pointer;
}

.cp-portal .cp-input-toggle:hover {
    background: var(--cp-primary-soft);
}

.cp-portal .cp-auth-foot {
    margin-top: 16px;
    font-size: 12.5px;
    color: var(--cp-muted);
    text-align: center;
}

.cp-portal .cp-alert {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    border-radius: 10px;
    padding: 12px 14px;
    font-size: 13.5px;
    line-height: 1.45;
    margin-bottom: 18px;
}

.cp-portal .cp-alert svg {
    width: 18px;
    height: 18px;
    flex: none;
    margin-top: 1px;
}

.cp-portal .cp-alert--error {
    background: var(--cp-danger-bg);
    color: var(--cp-danger);
    border: 1px solid #ffcdd2;
}

/* ------------------------------------------------------- Barra de sesión */
.cp-portal .cp-company-bar {
    background: var(--cp-surface);
    border-bottom: 1px solid var(--cp-line);
}

.cp-portal .cp-company-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 14px 0;
    flex-wrap: wrap;
}

.cp-portal .cp-company-id {
    display: flex;
    align-items: center;
    gap: 9px;
    min-width: 0;
}

.cp-portal .cp-session-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #2e7d32;
    box-shadow: 0 0 0 4px rgba(46, 125, 50, .14);
    flex: none;
}

.cp-portal .cp-company-logo {
    width: 28px;
    height: 28px;
    border-radius: 7px;
    object-fit: contain;
    background: #fff;
    border: 1px solid var(--cp-line);
    padding: 2px;
    flex: none;
}

.cp-portal .cp-session-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--cp-ink-soft);
}

.cp-portal .cp-company-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* --------------------------------------------------- Aviso de búsqueda */
.cp-portal .cp-buscar-form {
    display: inline-flex;
    margin: 0;
}

.cp-portal .cp-aviso-wrap {
    padding: 12px 0 0;
}

.cp-portal .cp-aviso {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 16px;
    border-radius: var(--cp-radius-sm);
    font-size: 14px;
    font-weight: 600;
    line-height: 1.4;
    border: 1px solid transparent;
}

.cp-portal .cp-aviso svg {
    width: 18px;
    height: 18px;
    flex: 0 0 auto;
}

.cp-portal .cp-aviso--ok {
    background: #e8f5e9;
    border-color: #b7dfb9;
    color: #1b5e20;
}

.cp-portal .cp-aviso--info {
    background: var(--cp-primary-soft);
    border-color: var(--cp-primary-line);
    color: var(--cp-primary-700);
}

.cp-portal .cp-aviso--error {
    background: var(--cp-danger-bg);
    border-color: #f3c4c4;
    color: var(--cp-danger);
}

/* --------------------------------------------------------- Eje de fecha */
/* Dos preguntas distintas: cuándo se atendió (fecha del examen) y cuándo
   llegó el archivo. El conmutador deja claro cuál se está mirando. */
.cp-portal .cp-eje-wrap {
    padding: 18px 0 0;
    display: flex;
    align-items: center;
    gap: 10px 16px;
    flex-wrap: wrap;
}

.cp-portal .cp-eje {
    display: inline-flex;
    gap: 4px;
    padding: 4px;
    background: var(--cp-surface);
    border: 1px solid var(--cp-line);
    border-radius: 999px;
    box-shadow: var(--cp-shadow-sm);
}

.cp-portal .cp-eje-opt {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 9px 16px;
    border-radius: 999px;
    font-size: 14px;
    font-weight: 600;
    color: var(--cp-muted);
    text-decoration: none;
    white-space: nowrap;
    transition: background .15s ease, color .15s ease;
}

.cp-portal .cp-eje-opt svg {
    width: 17px;
    height: 17px;
    flex: 0 0 auto;
}

.cp-portal .cp-eje-opt:hover {
    color: var(--cp-primary-700);
    background: var(--cp-primary-soft);
}

.cp-portal .cp-eje-opt.is-active {
    background: var(--cp-grad);
    color: #fff;
    box-shadow: 0 8px 18px -12px rgba(21, 101, 192, .95);
}

.cp-portal .cp-eje-hint {
    margin: 0;
    font-size: 13px;
    line-height: 1.45;
    color: var(--cp-muted);
    flex: 1 1 220px;
    min-width: 0;
}

.cp-portal .cp-atajos {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.cp-portal .cp-chip {
    font-size: 13px;
    font-weight: 600;
    color: var(--cp-primary-700);
    background: var(--cp-primary-soft);
    border: 1px solid var(--cp-primary-line);
    border-radius: 999px;
    padding: 6px 14px;
    text-decoration: none;
    transition: background .15s ease, color .15s ease;
}

.cp-portal .cp-chip:hover {
    background: var(--cp-primary-line);
}

.cp-portal .cp-chip.is-active {
    background: var(--cp-primary);
    border-color: var(--cp-primary);
    color: #fff;
}

/* --------------------------------------------------------------- Filtros */
.cp-portal .cp-toolbar-wrap {
    padding: 20px 0 0;
}

.cp-portal .cp-toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    background: var(--cp-surface);
    border: 1px solid var(--cp-line);
    border-radius: var(--cp-radius);
    padding: 12px;
    box-shadow: var(--cp-shadow-sm);
}

.cp-portal .cp-select,
.cp-portal .cp-date input {
    font: inherit;
    font-size: 14px;
    color: var(--cp-ink-soft);
    background: #f8fafc;
    border: 1px solid var(--cp-line);
    border-radius: 10px;
    padding: 10px 12px;
    outline: 0;
}

.cp-portal .cp-select:focus,
.cp-portal .cp-date input:focus {
    border-color: var(--cp-primary-600);
    background: #fff;
}

.cp-portal .cp-dates {
    display: flex;
    gap: 8px;
}

.cp-portal .cp-date {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--cp-muted);
}

.cp-portal .cp-date input {
    padding: 9px 10px;
}

.cp-portal .cp-results-meta {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    padding: 14px 4px 0;
    font-size: 13.5px;
    color: var(--cp-ink-soft);
}

/* ------------------------------------------------------------- Sugerencias */
.cp-portal .cp-suggest {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: var(--cp-surface);
    border: 1px solid var(--cp-line);
    border-radius: 12px;
    box-shadow: 0 20px 40px -24px rgba(13, 71, 161, .5);
    padding: 6px;
    z-index: 60;
    max-height: 340px;
    overflow: auto;
}

.cp-portal .cp-suggest a {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 9px 12px;
    border-radius: 8px;
}

.cp-portal .cp-suggest a:hover,
.cp-portal .cp-suggest a.is-active {
    background: var(--cp-primary-soft);
}

.cp-portal .cp-suggest strong {
    font-size: 13.5px;
    color: var(--cp-ink);
}

.cp-portal .cp-suggest small {
    color: var(--cp-muted);
    font-size: 12px;
}

.cp-portal .cp-suggest .cp-suggest-empty {
    display: block;
    padding: 10px 12px;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--cp-primary-700);
    border-top: 1px solid var(--cp-line-soft);
    margin-top: 4px;
}

/* ---------------------------------------------------------------- Grupos */
.cp-portal .cp-groups {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.cp-portal .cp-group {
    background: var(--cp-surface);
    border: 1px solid var(--cp-line);
    border-radius: var(--cp-radius);
    box-shadow: var(--cp-shadow-sm);
    overflow: hidden;
}

.cp-portal .cp-group-head {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 15px 18px;
    cursor: pointer;
    user-select: none;
    background: linear-gradient(180deg, #ffffff, #fafcff);
    transition: background .15s ease;
}

.cp-portal .cp-group-head:hover {
    background: var(--cp-primary-soft);
}

.cp-portal .cp-group-icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    display: grid;
    place-items: center;
    background: #e8f2fd;
    color: var(--cp-primary);
    flex: none;
}

.cp-portal .cp-group-icon svg {
    width: 19px;
    height: 19px;
}

.cp-portal .cp-group-title {
    flex: 1;
    min-width: 0;
}

.cp-portal .cp-group-title h2 {
    font-size: 16px;
    letter-spacing: -.01em;
    line-height: 1.25;
    color: var(--cp-ink);
    font-weight: 600;
}

.cp-portal .cp-group-title p {
    font-size: 12.5px;
    color: var(--cp-muted);
    margin-top: 2px;
}

.cp-portal .cp-chevron {
    width: 30px;
    height: 30px;
    display: grid;
    place-items: center;
    color: var(--cp-muted);
    transition: transform .2s ease;
    flex: none;
}

.cp-portal .cp-chevron svg {
    width: 18px;
    height: 18px;
}

.cp-portal .cp-group.is-collapsed .cp-chevron {
    transform: rotate(-90deg);
}

.cp-portal .cp-group.is-collapsed .cp-group-body {
    display: none;
}

.cp-portal .cp-group-body {
    border-top: 1px solid var(--cp-line-soft);
}

.cp-portal .cp-patient {
    padding: 14px 18px;
    border-bottom: 1px dashed var(--cp-line-soft);
}

.cp-portal .cp-patient:last-child {
    border-bottom: 0;
}

.cp-portal .cp-patient-head {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.cp-portal .cp-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-size: 14px;
    font-weight: 800;
    color: var(--cp-primary-700);
    background: #e8f2fd;
    border: 1px solid #d6e6f8;
    flex: none;
}

.cp-portal .cp-patient-id {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.cp-portal .cp-patient-id strong {
    font-size: 14px;
    letter-spacing: -.005em;
    line-height: 1.3;
    color: var(--cp-ink);
}

.cp-portal .cp-patient-id small {
    font-size: 12px;
    color: var(--cp-muted);
}

.cp-portal .cp-docs {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
    gap: 8px;
    padding-left: 44px;
}

.cp-portal .cp-doc {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    background: #f8fafc;
    border: 1px solid var(--cp-line-soft);
    border-radius: 10px;
    padding: 8px 10px;
    transition: border-color .15s ease, background .15s ease;
}

.cp-portal .cp-doc:hover {
    background: #fff;
    border-color: var(--cp-primary-line);
}

.cp-portal .cp-doc-type {
    font-size: 12px;
    font-weight: 700;
    padding: 4px 9px;
    border-radius: 999px;
    background: #e3f2fd;
    color: #0d47a1;
    max-width: 100%;
    flex: 0 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cp-portal .cp-doc-type[data-tipo="certificado"] {
    background: #e3f2fd;
    color: #0d47a1;
}

.cp-portal .cp-doc-type[data-tipo="hcl"] {
    background: #ede9fe;
    color: #5b21b6;
}

.cp-portal .cp-doc-type[data-tipo="optometria"] {
    background: #fff8e1;
    color: #8d6e00;
}

.cp-portal .cp-doc-type[data-tipo="ingreso"] {
    background: #e8f5e9;
    color: #1b5e20;
}

.cp-portal .cp-doc-type[data-tipo="periodico"] {
    background: #e0f7fa;
    color: #006064;
}

.cp-portal .cp-doc-type[data-tipo="retiro"] {
    background: #fce4ec;
    color: #880e4f;
}

.cp-portal .cp-doc-type[data-tipo="post_incapacidad"] {
    background: #fff3e0;
    color: #8d4a00;
}

.cp-portal .cp-doc-type[data-tipo="otro"] {
    background: #eceff1;
    color: #37474f;
}

.cp-portal .cp-doc-size {
    font-size: 11.5px;
    color: var(--cp-muted);
    white-space: nowrap;
    flex: none;
}

.cp-portal .cp-doc-actions {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 2px;
    flex: none;
}

.cp-portal .cp-more {
    display: flex;
    justify-content: center;
    padding: 22px 0 0;
}

/* ---------------------------------------------------------- Estado vacío */
.cp-portal .cp-empty-state {
    background: var(--cp-surface);
    border: 1px dashed var(--cp-line);
    border-radius: var(--cp-radius-lg);
    padding: 44px 24px;
    text-align: center;
    color: var(--cp-muted);
}

.cp-portal .cp-empty-icon {
    width: 62px;
    height: 62px;
    border-radius: 16px;
    display: grid;
    place-items: center;
    background: #e8f2fd;
    color: var(--cp-primary);
    margin: 0 auto 16px;
}

.cp-portal .cp-empty-icon svg {
    width: 30px;
    height: 30px;
}

.cp-portal .cp-empty-state h2 {
    font-size: 18px;
    color: var(--cp-ink);
    margin-bottom: 6px;
    font-weight: 600;
}

.cp-portal .cp-empty-state p {
    font-size: 14px;
    max-width: 460px;
    margin: 0 auto;
}

/* ----------------------------------------------------------------- Modal */
.cp-standalone .cp-modal {
    position: fixed;
    inset: 0;
    z-index: 1100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 22px;
}

.cp-standalone .cp-modal[hidden] {
    display: none !important;
}

.cp-standalone .cp-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, .6);
    backdrop-filter: blur(3px);
    animation: cp-fade .18s ease;
}

.cp-standalone .cp-modal-panel {
    position: relative;
    width: min(1080px, 100%);
    height: min(90vh, 900px);
    background: #fff;
    border-radius: 16px;
    box-shadow: var(--cp-shadow-lg);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: cp-pop .2s ease;
}

.cp-standalone .cp-modal-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 15px 18px;
    border-bottom: 1px solid var(--cp-line);
}

.cp-standalone .cp-modal-titles h2 {
    font-size: 17px;
    letter-spacing: -.01em;
    margin-top: 2px;
    color: var(--cp-ink);
    font-weight: 600;
}

.cp-standalone .cp-modal-meta {
    font-size: 12.5px;
    color: var(--cp-muted);
    margin-top: 2px;
}

.cp-standalone .cp-modal-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.cp-standalone .cp-modal-body {
    flex: 1;
    background: #eef3f9;
    min-height: 0;
}

.cp-standalone .cp-modal-body iframe {
    width: 100%;
    height: 100%;
    border: 0;
    display: block;
}

body.cp-modal-open {
    overflow: hidden;
}

@keyframes cp-fade {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes cp-pop {
    from { opacity: 0; transform: translateY(8px) scale(.99); }
    to { opacity: 1; transform: none; }
}

/* ----------------------------------------------------------------- Error */
.cp-portal .cp-error {
    max-width: 560px;
    text-align: center;
    padding: 60px 0 72px;
}

.cp-portal .cp-error-icon {
    width: 64px;
    height: 64px;
    border-radius: 18px;
    display: grid;
    place-items: center;
    background: var(--cp-danger-bg);
    color: var(--cp-danger);
    margin: 0 auto 18px;
}

.cp-portal .cp-error-icon svg {
    width: 30px;
    height: 30px;
}

.cp-portal .cp-error-title {
    font-size: 25px;
    letter-spacing: -.02em;
    margin: 8px 0 10px;
    color: var(--cp-ink);
    font-weight: 600;
}

.cp-portal .cp-error-message {
    color: var(--cp-muted);
    font-size: 15px;
}

.cp-portal .cp-error-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 24px;
    flex-wrap: wrap;
}

/* ==========================================================================
   Layout independiente (solo cuando layout_mode = standalone).
   Estas reglas viven bajo body.cp-standalone y no se aplican en el sitio.
   ========================================================================== */
body.cp-standalone {
    margin: 0;
    background: #f7f9fc;
    font-family: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
}

.cp-standalone .cp-header {
    position: sticky;
    top: 0;
    z-index: 40;
    background: rgba(255, 255, 255, .92);
    backdrop-filter: saturate(180%) blur(12px);
    border-bottom: 1px solid #e1e8f0;
}

.cp-standalone .cp-header-inner {
    height: 68px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.cp-standalone .cp-brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    text-decoration: none;
}

.cp-standalone .cp-brand-mark {
    width: 38px;
    height: 38px;
    border-radius: 11px;
    display: grid;
    place-items: center;
    color: #fff;
    background: linear-gradient(140deg, #2f5fd0, #29b6f6);
    flex: none;
}

.cp-standalone .cp-brand-mark svg {
    width: 20px;
    height: 20px;
}

.cp-standalone .cp-brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.15;
    min-width: 0;
}

.cp-standalone .cp-brand-text strong {
    font-size: 15px;
    color: #263238;
}

.cp-standalone .cp-brand-text small {
    font-size: 12px;
    color: #607d8b;
}

.cp-standalone .cp-nav {
    display: flex;
    gap: 6px;
}

.cp-standalone .cp-nav a {
    padding: 8px 14px;
    border-radius: 999px;
    font-size: 14px;
    font-weight: 600;
    color: #37474f;
    text-decoration: none;
}

.cp-standalone .cp-nav a:hover {
    background: #e8f2fd;
    color: #0d47a1;
}

.cp-standalone .cp-main {
    min-height: calc(100vh - 68px - 150px);
}

.cp-standalone .cp-footer {
    border-top: 1px solid #e1e8f0;
    background: #fff;
    margin-top: 20px;
}

.cp-standalone .cp-footer-inner {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
    padding: 26px 0;
    font-size: 12.5px;
    color: #607d8b;
}

.cp-standalone .cp-footer-brand {
    font-weight: 700;
    color: #37474f;
    margin-bottom: 4px;
}

.cp-standalone .cp-footer-note {
    max-width: 620px;
    line-height: 1.5;
}

.cp-standalone .cp-wrap {
    width: min(1180px, 100% - 40px);
    margin-inline: auto;
}

/* ------------------------------------------------------------ Responsive */
@media (max-width: 860px) {
    .cp-portal .cp-band {
        padding: 34px 0 32px;
    }

    .cp-portal .cp-band-wave {
        width: 90%;
        opacity: .55;
    }

    .cp-portal .cp-docs {
        padding-left: 0;
    }

    .cp-portal .cp-login-card {
        grid-template-columns: 1fr;
        min-height: 0;
    }

    .cp-portal .cp-login-aside {
        min-height: 0;
        padding: 26px 26px 22px;
        gap: 14px;
    }

    .cp-portal .cp-login-claim {
        font-size: 18px;
        -webkit-line-clamp: 2;
        margin-bottom: 0;
    }

    .cp-portal .cp-login-text,
    .cp-portal .cp-login-aside-foot {
        display: none;
    }

    .cp-portal .cp-login-form {
        padding: 26px 26px 28px;
    }

    .cp-portal .cp-login-badge {
        position: static;
        align-self: flex-start;
        margin-bottom: 18px;
    }

    .cp-portal .cp-login-title {
        max-width: 100%;
    }
}

@media (max-width: 640px) {
    .cp-portal .cp-wrap,
    .cp-portal .cp-band-inner,
    .cp-portal .cp-login-card,
    .cp-portal .cp-login-legal {
        width: min(100% - 28px, 1180px);
    }

    .cp-portal .cp-section-head {
        align-items: stretch;
    }

    .cp-portal .cp-search--head {
        flex: 1 1 100%;
    }

    .cp-portal .cp-toolbar {
        padding: 10px;
    }

    .cp-portal .cp-search {
        flex: 1 1 100%;
    }

    .cp-portal .cp-dates {
        flex: 1 1 100%;
    }

    .cp-portal .cp-date {
        flex: 1;
    }

    .cp-portal .cp-date input {
        width: 100%;
    }

    .cp-portal .cp-toolbar .cp-btn {
        flex: 1;
    }

    .cp-portal .cp-auth-card {
        padding: 24px 22px 20px;
    }

    .cp-standalone .cp-modal {
        padding: 0;
    }

    .cp-standalone .cp-modal-panel {
        height: 100vh;
        border-radius: 0;
    }

    .cp-standalone .cp-modal-head {
        flex-direction: column;
        align-items: stretch;
    }

    .cp-standalone .cp-modal-actions {
        justify-content: flex-start;
    }

    .cp-portal .cp-doc {
        flex-wrap: wrap;
    }

    .cp-portal .cp-doc-type {
        max-width: 100%;
    }

    .cp-portal .cp-doc-actions {
        margin-left: auto;
    }
}

@media (prefers-reduced-motion: reduce) {
    .cp-portal *,
    .cp-portal *::before,
    .cp-portal *::after {
        animation-duration: .001ms !important;
        transition-duration: .001ms !important;
        scroll-behavior: auto !important;
    }
}

/* ============================================================
   TIMELINE DE DOCUMENTOS (rediseño)
   ============================================================ */

/* Nombre empresa en la barra */
.cp-standalone .cp-company-name {
    font-size: 16px;
    font-weight: 700;
    color: var(--cp-ink, #263238);
    margin: 0;
    line-height: 1.2;
}

/* Botón peligro (cerrar sesión) */
.cp-standalone .cp-btn--danger {
    color: #c62828;
    border-color: #ffcdd2;
}
.cp-standalone .cp-btn--danger:hover {
    background: #ffebee;
    color: #b71c1c;
    border-color: #ef9a9a;
}

/* ── Contenedor timeline ── */
.cp-standalone .cp-timeline {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 8px 0 32px;
}

/* ── Grupo de fecha/tipo ── */
.cp-standalone .cp-tl-group {
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 1px 4px rgba(15,23,42,.07), 0 0 0 1px rgba(37,99,235,.06);
    overflow: hidden;
    transition: box-shadow .15s ease;
}
.cp-standalone .cp-tl-group:hover {
    box-shadow: 0 4px 16px rgba(15,23,42,.1), 0 0 0 1px rgba(37,99,235,.1);
}

/* ── Cabecera del grupo ── */
.cp-standalone .cp-tl-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    cursor: pointer;
    user-select: none;
    border-bottom: 1px solid #f0f4f8;
    transition: background .12s ease;
}
.cp-standalone .cp-tl-header:hover { background: #f8faff; }

.cp-standalone .cp-tl-marker {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: var(--cp-primary-soft, #e3f0ff);
    color: var(--cp-primary, #1565c0);
    display: flex;
    align-items: center;
    justify-content: center;
    flex: none;
}
.cp-standalone .cp-tl-marker svg { width: 18px; height: 18px; }

.cp-standalone .cp-tl-header-text { flex: 1; min-width: 0; }

.cp-standalone .cp-tl-date {
    font-size: 15px;
    font-weight: 700;
    color: var(--cp-ink, #263238);
    margin: 0;
}

.cp-standalone .cp-tl-count {
    font-size: 12px;
    color: var(--cp-muted, #607d8b);
    margin-top: 1px;
    display: block;
}

/* Colapsar/expandir */
.cp-standalone .cp-tl-group.is-collapsed .cp-tl-body { display: none; }
.cp-standalone .cp-tl-group.is-collapsed .cp-chevron svg { transform: rotate(-90deg); }
.cp-standalone .cp-chevron svg { transition: transform .2s ease; }

/* ── Cuerpo del grupo ── */
.cp-standalone .cp-tl-body {
    display: flex;
    flex-direction: column;
    gap: 0;
}

/* ── Tarjeta de persona ── */
.cp-standalone .cp-person-card {
    padding: 14px 18px;
    border-top: 1px solid #f0f4f8;
    transition: background .1s ease;
}
.cp-standalone .cp-person-card:first-child { border-top: none; }
.cp-standalone .cp-person-card:hover { background: #fafbff; }

.cp-standalone .cp-person-head {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.cp-standalone .cp-avatar-lg {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--cp-grad, linear-gradient(135deg, #2f5fd0, #29b6f6));
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: none;
    text-transform: uppercase;
    box-shadow: 0 2px 6px rgba(37,99,235,.25);
}

.cp-standalone .cp-person-info { min-width: 0; }

.cp-standalone .cp-person-name {
    display: block;
    font-size: 14px;
    font-weight: 700;
    color: var(--cp-ink, #263238);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cp-standalone .cp-person-cedula {
    font-size: 12px;
    color: var(--cp-muted, #607d8b);
    display: block;
}

/* ── Chips de documentos ── */
.cp-standalone .cp-doc-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-left: 48px; /* alinea con el nombre */
}

.cp-standalone .cp-doc-chip {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    background: #f4f7ff;
    border: 1px solid #dde7ff;
    border-radius: 8px;
    transition: border-color .12s ease, box-shadow .12s ease;
}
.cp-standalone .cp-doc-chip:hover {
    border-color: var(--cp-primary-line, #90caf9);
    box-shadow: 0 2px 8px rgba(37,99,235,.1);
}

.cp-standalone .cp-chip-type {
    font-size: 12px;
    font-weight: 600;
    color: var(--cp-primary, #1565c0);
    text-transform: capitalize;
    white-space: nowrap;
}

/* Colores por tipo */
.cp-standalone .cp-chip-type[data-tipo="periodico"] { color: #7b1fa2; }
.cp-standalone .cp-chip-type[data-tipo="ingreso"] { color: #2e7d32; }
.cp-standalone .cp-chip-type[data-tipo="retiro"] { color: #e65100; }
.cp-standalone .cp-chip-type[data-tipo="hcl"] { color: #1565c0; }
.cp-standalone .cp-chip-type[data-tipo="optometria"] { color: #006064; }
.cp-standalone .cp-chip-type[data-tipo="post_incapacidad"] { color: #880e4f; }

.cp-standalone .cp-chip-size {
    font-size: 11px;
    color: var(--cp-muted, #607d8b);
    white-space: nowrap;
}

.cp-standalone .cp-chip-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-left: 2px;
}

/* Botón xs más pequeño */
.cp-standalone .cp-btn--xs {
    padding: 4px 9px;
    font-size: 12px;
    gap: 4px;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    font-weight: 600;
}

@media (max-width: 600px) {
    .cp-standalone .cp-doc-chips { margin-left: 0; }
    .cp-standalone .cp-chip-size { display: none; }
}

/* ============================================================
   GRID DE TARJETAS DE PERSONAS (nuevo diseño)
   ============================================================ */

/* Secciones por fecha */
.cp-standalone .cp-date-sections {
    display: flex;
    flex-direction: column;
    gap: 24px;
    padding-bottom: 40px;
}

.cp-standalone .cp-date-section {
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 1px 4px rgba(15,23,42,.07), 0 0 0 1px rgba(37,99,235,.06);
    overflow: hidden;
}

/* Cabecera de fecha */
.cp-standalone .cp-date-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    background: linear-gradient(135deg, #f8faff 0%, #eff4ff 100%);
    border-bottom: 1px solid #e2eaff;
    cursor: pointer;
    user-select: none;
    transition: background .12s ease;
}
.cp-standalone .cp-date-header:hover {
    background: linear-gradient(135deg, #eff4ff 0%, #e2eaff 100%);
}

.cp-standalone .cp-date-icon {
    width: 34px;
    height: 34px;
    border-radius: 9px;
    background: var(--cp-primary, #1565c0);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: none;
    box-shadow: 0 2px 6px rgba(21,101,192,.3);
}
.cp-standalone .cp-date-icon svg { width: 17px; height: 17px; }

.cp-standalone .cp-date-info { flex: 1; }

.cp-standalone .cp-date-label {
    display: block;
    font-size: 15px;
    font-weight: 700;
    color: var(--cp-ink, #263238);
}

.cp-standalone .cp-date-meta {
    display: block;
    font-size: 12px;
    color: var(--cp-muted, #607d8b);
    margin-top: 1px;
}

/* Colapsar */
.cp-standalone .cp-date-section.is-collapsed .cp-persons-grid { display: none; }
.cp-standalone .cp-date-section.is-collapsed .cp-chevron svg { transform: rotate(-90deg); }
.cp-standalone .cp-chevron svg { transition: transform .2s ease; }

/* ── GRID de tarjetas ── */
.cp-standalone .cp-persons-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1px;
    background: #eef2ff;
}

/* Tarjeta de persona */
.cp-standalone .cp-person-card {
    background: #fff;
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    /* Clave: un ítem de grid con `1fr` tiene min-width automático = su
       contenido, así que la tarjeta crecía más que su columna y tapaba el
       botón de descarga de la fila. Con min-width:0 la tarjeta respeta la
       columna y el que se recorta es el texto de la píldora. */
    min-width: 0;
    transition: background .1s ease;
    /* Permite que el tamaño (KB) aparezca u oculte según el ancho real de la
       ficha, no del viewport: hay 5 fichas por fila aunque la pantalla sea
       grande. */
    container-type: inline-size;
}
.cp-standalone .cp-person-card:hover { background: #fafbff; }

.cp-standalone .cp-pcard-head {
    display: flex;
    align-items: center;
    gap: 10px;
}

.cp-standalone .cp-avatar-circle {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--cp-grad, linear-gradient(135deg, #2f5fd0, #29b6f6));
    color: #fff;
    font-size: 14px;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: none;
    text-transform: uppercase;
    box-shadow: 0 2px 5px rgba(37,99,235,.22);
}

.cp-standalone .cp-pcard-id {
    min-width: 0;
    flex: 1;
}

.cp-standalone .cp-pcard-name {
    display: block;
    font-size: 12.5px;
    font-weight: 700;
    color: var(--cp-ink, #263238);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

.cp-standalone .cp-pcard-cedula {
    display: block;
    font-size: 11px;
    color: var(--cp-muted, #607d8b);
    margin-top: 1px;
}

/* Documentos de la persona */
.cp-standalone .cp-pcard-docs {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    align-items: center;
}

/* Pill de documento (clicable = abrir visor) */
.cp-standalone .cp-doc-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 9px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    text-decoration: none;
    background: #e8efff;
    color: var(--cp-primary, #1565c0);
    border: 1px solid #c4d7ff;
    cursor: pointer;
    transition: all .13s ease;
    white-space: nowrap;
}
.cp-standalone .cp-doc-pill:hover {
    background: var(--cp-primary, #1565c0);
    color: #fff;
    border-color: var(--cp-primary, #1565c0);
    box-shadow: 0 2px 8px rgba(21,101,192,.3);
    transform: translateY(-1px);
}

/* Colores por tipo en la pill */
.cp-standalone .cp-doc-pill[data-tipo="periodico"] { background: #f3e5f5; color: #7b1fa2; border-color: #ce93d8; }
.cp-standalone .cp-doc-pill[data-tipo="periodico"]:hover { background: #7b1fa2; color: #fff; border-color: #7b1fa2; }
.cp-standalone .cp-doc-pill[data-tipo="ingreso"] { background: #e8f5e9; color: #2e7d32; border-color: #a5d6a7; }
.cp-standalone .cp-doc-pill[data-tipo="ingreso"]:hover { background: #2e7d32; color: #fff; border-color: #2e7d32; }
.cp-standalone .cp-doc-pill[data-tipo="retiro"] { background: #fff3e0; color: #e65100; border-color: #ffcc80; }
.cp-standalone .cp-doc-pill[data-tipo="retiro"]:hover { background: #e65100; color: #fff; border-color: #e65100; }
.cp-standalone .cp-doc-pill[data-tipo="hcl"] { background: #e3f2fd; color: #1565c0; border-color: #90caf9; }
.cp-standalone .cp-doc-pill[data-tipo="post_incapacidad"] { background: #fce4ec; color: #880e4f; border-color: #f48fb1; }
.cp-standalone .cp-doc-pill[data-tipo="post_incapacidad"]:hover { background: #880e4f; color: #fff; border-color: #880e4f; }

/* Botón de descarga (solo ícono) */
.cp-standalone .cp-doc-pill--dl {
    padding: 4px 7px;
    background: #f1f5f9;
    color: #64748b;
    border-color: #e2e8f0;
}
.cp-standalone .cp-doc-pill--dl:hover {
    background: #475569;
    color: #fff;
    border-color: #475569;
}

.cp-standalone .cp-pill-size {
    font-size: 10px;
    opacity: .75;
}

/* Nota de resultados */
.cp-standalone .cp-results-note {
    font-size: 12.5px;
    margin-top: 6px;
}

/* Nombre empresa prominente */
.cp-standalone .cp-company-name {
    font-size: 17px;
    font-weight: 800;
    color: var(--cp-ink, #263238);
    margin: 0;
    line-height: 1.2;
}

/* Botón peligro */
.cp-standalone .cp-btn--danger { color: #c62828; border-color: #ffcdd2; }
.cp-standalone .cp-btn--danger:hover { background: #ffebee; border-color: #ef9a9a; }

/* Responsive: móvil → 1 columna */
@media (max-width: 500px) {
    .cp-standalone .cp-persons-grid {
        grid-template-columns: 1fr;
    }
    .cp-standalone .cp-pill-size { display: none; }
}

/* ==========================================================================
   Ajustes 2026-10-23 — logo de la empresa, desplegable de empresas y
   fondo corporativo del acceso (foto de escritorio + velo claro).
   ========================================================================== */

/* ------------------------------------------------- Fondo corporativo (foto) */
/* Escritorio de trabajo con portátil y estetoscopio. La foto se cubre con un
   velo blanco suave para que la tarjeta mantenga el contraste y el texto no
   compita con el fondo. */
.cp-portal .cp-login-page {
    padding: 44px 0 96px;
    background-color: #eef4fb;
    background-image:
        linear-gradient(180deg, rgba(255, 255, 255, .55) 0%, rgba(238, 244, 251, .72) 100%),
        url("../img/login-bg.jpg");
    background-repeat: no-repeat, no-repeat;
    background-position: center center, center center;
    background-size: cover, cover;
}

/* ------------------------------------------------------- Logo en la tarjeta */
.cp-portal .cp-login-mark {
    position: relative;
    width: 58px;
    height: 58px;
    border-radius: 15px;
    display: grid;
    place-items: center;
    padding: 6px;
    background: #fff;
    border: 1px solid rgba(255, 255, 255, .6);
    box-shadow: 0 12px 26px -16px rgba(4, 32, 84, .8);
    overflow: hidden;
    margin-bottom: 16px;
}

.cp-portal .cp-login-logo {
    position: relative;
    z-index: 2;
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
}

.cp-portal .cp-login-mark-fallback {
    position: absolute;
    z-index: 1;
    width: 22px;
    height: 22px;
    color: var(--cp-primary);
}

/* ------------------------------------------------ Desplegable de empresas */
/* La tarjeta recortaba la lista (overflow: hidden). Se libera el recorte y
   cada mitad se redondea por su cuenta para conservar las esquinas. */
.cp-portal .cp-login-card {
    overflow: visible;
}

.cp-portal .cp-login-aside {
    border-radius: 22px 0 0 22px;
}

@media (max-width: 860px) {
    .cp-portal .cp-login-aside {
        border-radius: 22px 22px 0 0;
    }
}

.cp-portal .cp-combo {
    position: relative;
}

.cp-portal .cp-combo input {
    width: 100%;
    border: 1px solid var(--cp-line);
    border-radius: 10px;
    padding: 13px 44px 13px 14px;
    font: inherit;
    font-size: 15px;
    letter-spacing: 0;
    background: #fbfdff;
    color: var(--cp-ink);
    transition: border-color .15s ease, box-shadow .15s ease;
}

.cp-portal .cp-combo input:focus {
    outline: none;
    border-color: var(--cp-primary-600);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--cp-primary) 12%, transparent);
    background: #fff;
}

.cp-portal .cp-combo-toggle {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    width: 32px;
    height: 32px;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--cp-muted);
    cursor: pointer;
    transition: background .15s ease, color .15s ease;
}

.cp-portal .cp-combo-toggle:hover {
    background: var(--cp-primary-soft);
    color: var(--cp-primary-700);
}

.cp-portal .cp-combo-toggle svg {
    width: 18px;
    height: 18px;
    transition: transform .2s ease;
}

.cp-portal .cp-combo.is-open .cp-combo-toggle svg {
    transform: rotate(180deg);
}

.cp-portal .cp-combo-list {
    position: absolute;
    z-index: 40;
    left: 0;
    right: 0;
    top: calc(100% + 6px);
    max-height: 272px;
    overflow-y: auto;
    margin: 0;
    padding: 6px;
    list-style: none;
    background: #fff;
    border: 1px solid var(--cp-line);
    border-radius: 12px;
    box-shadow: 0 26px 52px -30px rgba(13, 71, 161, .55);
    overscroll-behavior: contain;
}

.cp-portal .cp-combo-list[hidden] {
    display: none;
}

.cp-portal .cp-combo-option {
    display: flex;
    flex-direction: column;
    gap: 1px;
    padding: 9px 11px;
    border-radius: 8px;
    cursor: pointer;
    border: 1px solid transparent;
}

.cp-portal .cp-combo-option[hidden] {
    display: none;
}

.cp-portal .cp-combo-option:hover,
.cp-portal .cp-combo-option.is-active {
    background: var(--cp-primary-soft);
}

.cp-portal .cp-combo-option[aria-selected="true"] {
    background: var(--cp-primary-soft);
    border-color: color-mix(in srgb, var(--cp-primary) 30%, transparent);
}

.cp-portal .cp-combo-option-name {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--cp-ink);
    line-height: 1.35;
}

.cp-portal .cp-combo-option-user {
    font-size: 11.5px;
    color: var(--cp-muted);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.cp-portal .cp-combo-option mark {
    background: #fff1a8;
    color: inherit;
    border-radius: 3px;
    padding: 0 1px;
}

.cp-portal .cp-combo-empty {
    margin: 8px 2px 0;
    font-size: 12.5px;
    color: var(--cp-muted);
}

.cp-portal .cp-combo-empty[hidden] {
    display: none;
}

@media (max-width: 720px) {
    .cp-portal .cp-combo-list { max-height: 210px; }
}

/* ==========================================================================
   Visor de PDF — rediseño del encabezado (2026-10-24)
   ========================================================================== */

/* Los tokens de color viven en .cp-portal, pero el modal es hijo directo de
   <body>: sin esta copia, var(--cp-line) / var(--cp-ink) no se resolvían y el
   encabezado salía sin bordes ni colores, con los botones como enlaces sueltos. */
.cp-standalone {
    --cp-primary: #1565c0;
    --cp-primary-600: #1976d2;
    --cp-primary-700: #0d47a1;
    --cp-primary-soft: color-mix(in srgb, var(--cp-primary) 8%, #ffffff);
    --cp-primary-line: color-mix(in srgb, var(--cp-primary) 20%, #ffffff);
    --cp-ink: #263238;
    --cp-ink-soft: #37474f;
    --cp-muted: #607d8b;
    --cp-line: #e1e8f0;
    --cp-line-soft: #eef3f9;
    --cp-danger: #c62828;
    --cp-danger-bg: #ffebee;
    --cp-shadow-lg: 0 30px 70px -30px rgba(13, 71, 161, .55);
}

.cp-standalone .cp-modal-panel {
    border-radius: 18px;
}

.cp-standalone .cp-modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    /* Una sola línea: si el título es largo se recorta con puntos suspensivos
       en vez de empujar los botones fuera de la tarjeta. Antes, con wrap,
       el botón «Descargar» se desbordaba y quedaba cortado. */
    flex-wrap: nowrap;
    padding: 16px 20px;
    background: linear-gradient(180deg, #f6faff 0%, #ffffff 100%);
    border-bottom: 1px solid var(--cp-line);
}

.cp-standalone .cp-modal-heading {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
    flex: 1 1 auto;
}

.cp-standalone .cp-modal-chip {
    width: 44px;
    height: 44px;
    flex: none;
    border-radius: 13px;
    display: grid;
    place-items: center;
    color: var(--cp-primary);
    background: var(--cp-primary-soft);
    border: 1px solid var(--cp-primary-line);
}

.cp-standalone .cp-modal-chip svg {
    width: 22px;
    height: 22px;
}

.cp-standalone .cp-modal-titles {
    min-width: 0;
    flex: 1 1 auto;
}

.cp-standalone .cp-modal-eyebrow {
    margin: 0 0 3px;
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--cp-primary-700);
    line-height: 1;
}

.cp-standalone .cp-modal-titles h2 {
    margin: 0;
    font-size: 19px;
    font-weight: 600;
    letter-spacing: -.015em;
    line-height: 1.25;
    color: var(--cp-ink);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cp-standalone .cp-modal-meta {
    margin: 3px 0 0;
    font-size: 12.5px;
    color: var(--cp-muted);
    line-height: 1.35;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cp-standalone .cp-modal-meta:empty {
    display: none;
}

.cp-standalone .cp-modal-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: nowrap;
    flex: 0 0 auto;
    justify-content: flex-end;
    margin-left: auto;
}

.cp-standalone .cp-modal-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    height: 38px;
    padding: 0 15px;
    border-radius: 10px;
    border: 1px solid var(--cp-line);
    background: #fff;
    color: var(--cp-ink-soft);
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
    transition: background .15s ease, border-color .15s ease, color .15s ease;
}

.cp-standalone .cp-modal-btn svg {
    width: 16px;
    height: 16px;
    flex: none;
}

.cp-standalone .cp-modal-btn:hover {
    background: var(--cp-primary-soft);
    border-color: var(--cp-primary-line);
    color: var(--cp-primary-700);
}

.cp-standalone .cp-modal-close {
    width: 38px;
    height: 38px;
    flex: none;
    display: grid;
    place-items: center;
    border-radius: 50%;
    border: 1px solid var(--cp-line);
    background: #fff;
    color: var(--cp-muted);
    cursor: pointer;
    transition: background .15s ease, border-color .15s ease, color .15s ease;
}

.cp-standalone .cp-modal-close svg {
    width: 18px;
    height: 18px;
}

.cp-standalone .cp-modal-close:hover {
    background: var(--cp-danger-bg);
    border-color: #f7c1c1;
    color: var(--cp-danger);
}

.cp-standalone .cp-modal-body {
    background: #eef3f9;
    box-shadow: inset 0 1px 0 rgba(13, 71, 161, .06);
}

@media (max-width: 620px) {
    .cp-standalone .cp-modal-head {
        padding: 12px 14px;
        gap: 12px;
    }
    .cp-standalone .cp-modal-chip { display: none; }
    .cp-standalone .cp-modal-titles h2 { font-size: 16px; }
    .cp-standalone .cp-modal-btn span { display: none; }
    .cp-standalone .cp-modal-btn { padding: 0 11px; }
}

/* ==========================================================================
   Ficha de persona — una fila por documento (2026-10-24)
   Antes los botones de descarga estaban en un bucle aparte y se desalineaban.
   ========================================================================== */
.cp-standalone .cp-pcard-docs {
    display: flex;
    flex-direction: column;
    gap: 5px;
    align-items: stretch;
    /* La columna de documentos debe quedarse dentro de la ficha: sin esto
       crecía hasta el ancho de la píldora más larga y empujaba el botón de
       descarga fuera de la tarjeta. */
    min-width: 0;
    max-width: 100%;
}

.cp-standalone .cp-doc-row {
    display: flex;
    align-items: center;
    gap: 5px;
    min-width: 0;
    max-width: 100%;
}

/* La píldora cede espacio, no empuja: base 0 y recorte propio para que sus
   hijos nunca se salgan de la fila (antes el botón de descarga quedaba
   cortado por el borde de la ficha). */
.cp-standalone .cp-doc-row .cp-doc-pill {
    flex: 1 1 0%;
    min-width: 0;
    overflow: hidden;
}

.cp-standalone .cp-doc-row .cp-pill-icon {
    flex: 0 0 auto;
}

.cp-standalone .cp-doc-row .cp-pill-tipo {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Motivo del examen: segunda dimensión, más discreta que el tipo. */
.cp-standalone .cp-doc-row .cp-pill-motivo {
    flex: 0 0 auto;
    padding: 1px 6px;
    border-radius: 999px;
    background: #eef2f7;
    color: #475569;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: .02em;
    white-space: nowrap;
}

.cp-standalone .cp-doc-row .cp-pill-size {
    flex: 0 0 auto;
    white-space: nowrap;
    /* En la ficha mandan el tipo y el motivo; el tamaño ya está en el
       tooltip y en el visor. Se recupera solo si la ficha es ancha. */
    display: none;
}

@container (min-width: 330px) {
    .cp-standalone .cp-doc-row .cp-pill-size { display: inline; }
}

@media (max-width: 480px) {
    .cp-standalone .cp-doc-row .cp-pill-motivo { display: none; }
}

.cp-standalone .cp-doc-dl {
    flex: none;
    display: inline-grid;
    place-items: center;
    width: 24px;
    height: 24px;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    background: #f1f5f9;
    color: #64748b;
    text-decoration: none;
    transition: background .13s ease, color .13s ease, border-color .13s ease;
}

.cp-standalone .cp-doc-dl:hover {
    background: var(--cp-primary, #1565c0);
    border-color: var(--cp-primary, #1565c0);
    color: #fff;
}

/* Colores por tipo: los nuevos documentos también se distinguen */
.cp-standalone .cp-doc-pill[data-tipo="optometria"] { background: #cffafe; color: #0e7490; border-color: #67e8f9; }
.cp-standalone .cp-doc-pill[data-tipo="optometria"]:hover { background: #0e7490; color: #fff; border-color: #0e7490; }
.cp-standalone .cp-doc-pill[data-tipo="visiometria"] { background: #ede9fe; color: #6d28d9; border-color: #c4b5fd; }
.cp-standalone .cp-doc-pill[data-tipo="visiometria"]:hover { background: #6d28d9; color: #fff; border-color: #6d28d9; }
.cp-standalone .cp-doc-pill[data-tipo="audiometria"] { background: #e0f2fe; color: #0369a1; border-color: #7dd3fc; }
.cp-standalone .cp-doc-pill[data-tipo="audiometria"]:hover { background: #0369a1; color: #fff; border-color: #0369a1; }
.cp-standalone .cp-doc-pill[data-tipo="espirometria"] { background: #dcfce7; color: #15803d; border-color: #86efac; }
.cp-standalone .cp-doc-pill[data-tipo="espirometria"]:hover { background: #15803d; color: #fff; border-color: #15803d; }
.cp-standalone .cp-doc-pill[data-tipo="ekg"] { background: #fee2e2; color: #b91c1c; border-color: #fca5a5; }
.cp-standalone .cp-doc-pill[data-tipo="ekg"]:hover { background: #b91c1c; color: #fff; border-color: #b91c1c; }
.cp-standalone .cp-doc-pill[data-tipo="psicosensometrico"] { background: #fef3c7; color: #b45309; border-color: #fcd34d; }
.cp-standalone .cp-doc-pill[data-tipo="psicosensometrico"]:hover { background: #b45309; color: #fff; border-color: #b45309; }

/* ==========================================================================
   Conmutador de eje y acciones de cabecera en pantallas estrechas
   (2026-10-25, v18.0.5.2.1)
   Dos opciones de texto largo no caben en una píldora horizontal a 390 px:
   se reparten el ancho y el texto puede partirse en dos líneas. Los botones
   de la cabecera pasan a su propia fila, porque con «Buscar nuevos» son tres.
   ========================================================================== */
@media (max-width: 620px) {
    .cp-portal .cp-company-actions {
        width: 100%;
    }
    .cp-portal .cp-company-actions .cp-btn {
        flex: 1 1 auto;
        justify-content: center;
    }
    .cp-portal .cp-buscar-form {
        flex: 1 1 auto;
    }
    .cp-portal .cp-buscar-form .cp-btn {
        width: 100%;
    }
}

@media (max-width: 560px) {
    .cp-portal .cp-eje {
        width: 100%;
    }
    .cp-portal .cp-eje-opt {
        flex: 1 1 0;
        min-width: 0;
        justify-content: center;
        padding: 8px 6px;
        font-size: 12.5px;
        line-height: 1.2;
        white-space: normal;
        text-align: center;
    }
    .cp-portal .cp-eje-opt svg {
        width: 14px;
        height: 14px;
    }
    .cp-portal .cp-eje-hint {
        flex: 1 1 100%;
        font-size: 12px;
    }
}

/* Las etiquetas de fecha («Cargado desde») son más largas que «Desde» y en
   pantalla estrecha parten en dos líneas; sin esto el campo se sale de la
   tarjeta de filtros. */
@media (max-width: 560px) {
    .cp-portal .cp-dates {
        flex-wrap: wrap;
        width: 100%;
    }
    .cp-portal .cp-date {
        flex: 1 1 140px;
        min-width: 0;
    }
    .cp-portal .cp-date input {
        width: 100%;
        min-width: 0;
    }
}

/* ==========================================================================
   Animaciones de carga (2026-10-25, v18.0.5.3.0)
   Mismo lenguaje visual que el cargador de ssi_medcare (anillo girando +
   leyenda), pero en CSS propio: el portal no carga Bootstrap.
   ========================================================================== */
.cp-standalone .cp-spinner {
    display: block;
    width: 3rem;
    height: 3rem;
    border-radius: 50%;
    border: 0.3rem solid color-mix(in srgb, var(--cp-primary) 18%, #ffffff);
    border-top-color: var(--cp-primary);
    animation: cp-giro 0.8s linear infinite;
}

.cp-standalone .cp-spinner--lg {
    width: 3.6rem;
    height: 3.6rem;
    border-width: 0.34rem;
}

@keyframes cp-giro {
    to { transform: rotate(360deg); }
}

/* Sin animación para quien la tenga desactivada: se queda un anillo estático. */
@media (prefers-reduced-motion: reduce) {
    .cp-standalone .cp-spinner {
        animation-duration: 2.4s;
    }
    .cp-standalone .cp-progress-fill::after {
        animation: none;
    }
}

/* --- Capa de carga sobre el visor de PDF --- */
.cp-standalone .cp-modal-body {
    position: relative;
}

.cp-standalone .cp-loading {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    padding: 24px;
    text-align: center;
    background: rgba(255, 255, 255, 0.94);
    z-index: 3;
}

.cp-standalone .cp-loading[hidden] {
    display: none;
}

.cp-standalone .cp-loading-text {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: var(--cp-muted);
}

.cp-standalone .cp-loading-text--error {
    color: var(--cp-danger);
}

/* --- Ventana de progreso del ZIP --- */
.cp-standalone .cp-zip-panel {
    max-width: 460px;
    width: calc(100% - 32px);
    /* El panel normal ocupa 90vh porque es un visor; esta ventana es pequeña
       y debe ajustarse a su contenido. */
    height: auto;
    max-height: 90vh;
    padding: 0;
}

.cp-standalone .cp-zip-body {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    padding: 34px 30px 28px;
    text-align: center;
}

.cp-standalone .cp-zip-title {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: var(--cp-ink);
}

.cp-standalone .cp-zip-meta {
    margin: 0;
    font-size: 14px;
    color: var(--cp-ink-soft);
    font-variant-numeric: tabular-nums;
}

.cp-standalone .cp-zip-hint {
    margin: 0;
    font-size: 12.5px;
    line-height: 1.45;
    color: var(--cp-muted);
}

.cp-standalone .cp-progress {
    position: relative;
    width: 100%;
    height: 10px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--cp-primary) 12%, #ffffff);
    overflow: hidden;
}

.cp-standalone .cp-progress-fill {
    display: block;
    height: 100%;
    border-radius: 999px;
    background: var(--cp-grad);
    transition: width 0.35s ease;
    position: relative;
    overflow: hidden;
}

/* Brillo que recorre la barra: da la sensación de avance continuo aunque el
   paso tarde (un PDF grande puede tardar varios segundos). */
.cp-standalone .cp-progress-fill::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg,
        rgba(255, 255, 255, 0) 0%,
        rgba(255, 255, 255, 0.55) 50%,
        rgba(255, 255, 255, 0) 100%);
    transform: translateX(-100%);
    animation: cp-brillo 1.4s ease-in-out infinite;
}

@keyframes cp-brillo {
    to { transform: translateX(100%); }
}

.cp-standalone .cp-zip-actions {
    display: flex;
    gap: 10px;
    margin-top: 4px;
}

.cp-standalone .cp-zip-actions[hidden] {
    display: none;
}
