/* Soporte integrado: boton del encabezado, panel de tickets, popup de ticket nuevo y conversacion.
   Paleta clara de cToken (app.css: --brand-navy, --surface, --border-soft). */

/* ---------------------------------------------------------------- Boton del encabezado */
.soporte-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    height: 36px;
    padding: 0 14px;
    border: 1px solid var(--border-soft);
    border-radius: 999px;
    background: #fff;
    color: var(--brand-navy);
    font-family: 'Inter Tight', 'Inter', sans-serif;
    font-weight: 600;
    font-size: 13.5px;
    cursor: pointer;
    transition: border-color .15s ease, background .15s ease;
}

    .soporte-btn svg { width: 17px; height: 17px; }
    .soporte-btn:hover:not(:disabled) { border-color: var(--brand-accent); background: var(--surface); }

.soporte-btn-off { opacity: .45; cursor: not-allowed; }

.soporte-btn-n {
    min-width: 19px;
    height: 19px;
    padding: 0 5px;
    border-radius: 999px;
    background: #dc2626;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    line-height: 19px;
    text-align: center;
}

/* ---------------------------------------------------------------- Panel lateral */
.soporte-fondo {
    position: fixed;
    inset: 0;
    background: rgba(15, 39, 66, .35);
    z-index: 1040;
    display: flex;
    justify-content: flex-end;
    animation: soporte-fade .15s ease-out;
}

.soporte-panel {
    width: min(480px, 100%);
    height: 100%;
    background: #fff;
    box-shadow: -18px 0 50px rgba(15, 39, 66, .22);
    display: flex;
    flex-direction: column;
    animation: soporte-entra .2s ease-out;
}

@keyframes soporte-fade { from { opacity: 0; } }
@keyframes soporte-entra { from { transform: translateX(30px); opacity: 0; } }

.soporte-panel-cab {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px 60px 14px 18px;
    border-bottom: 1px solid var(--border-soft);
    min-height: 64px;
}

    .soporte-panel-cab h2 { font-size: 19px; font-weight: 600; margin: 0; color: var(--brand-navy); }

.soporte-panel-ic, .soporte-modal-ic {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: #e8f1fb;
    color: var(--brand-accent);
    display: inline-grid;
    place-items: center;
    flex: none;
}

    .soporte-panel-ic svg { width: 19px; height: 19px; }

.soporte-nuevo { margin-left: auto; border-radius: 999px; padding: 4px 14px; }
.soporte-cerrar { top: 50%; transform: translateY(-50%); }

.soporte-tabs { display: flex; gap: 4px; padding: 10px 18px 0; border-bottom: 1px solid var(--border-soft); }

    .soporte-tabs button {
        border: 0;
        background: none;
        padding: 8px 10px;
        font-size: 13.5px;
        font-weight: 600;
        color: var(--text-muted);
        border-bottom: 2px solid transparent;
    }

        .soporte-tabs button.activo { color: var(--brand-navy); border-bottom-color: var(--brand-navy); }

.soporte-lista { flex: 1; overflow-y: auto; padding: 8px 10px 16px; }

.soporte-vacio { padding: 28px 10px; text-align: center; color: var(--text-muted); font-size: 14px; }

.soporte-fila {
    width: 100%;
    display: flex;
    gap: 10px;
    text-align: left;
    border: 0;
    background: none;
    border-radius: var(--radius-md);
    padding: 11px 10px;
    border-bottom: 1px solid #eef2f6;
}

    .soporte-fila:hover { background: var(--surface); }
    .soporte-fila.cerrada { opacity: .7; }

.soporte-punto { width: 8px; height: 8px; border-radius: 999px; margin-top: 7px; flex: none; }
    .soporte-punto.on { background: var(--brand-accent); box-shadow: 0 0 0 3px #dbeafe; }

.soporte-fila-cuerpo { display: flex; flex-direction: column; gap: 3px; min-width: 0; flex: 1; }
.soporte-fila-l1, .soporte-conv-l1 { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.soporte-fila-l3 { font-size: 12px; color: var(--text-muted); display: flex; gap: 4px; }
.soporte-asunto { font-size: 14px; color: #1f2b3a; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.soporte-no { font-family: 'Space Mono', monospace; font-size: 12px; color: var(--brand-navy); font-weight: 700; }

.soporte-pill { font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 999px; }
    .soporte-pill.est-nuevo { background: #e8f1fb; color: #1d4ed8; }
    .soporte-pill.est-analisis { background: #fff8e1; color: #a16207; }
    .soporte-pill.est-espera { background: #fff1e6; color: #c2410c; }
    .soporte-pill.est-desarrollo { background: #efe9fb; color: #6d28d9; }
    .soporte-pill.est-resuelto { background: #e7f5ea; color: #15803d; }
    .soporte-pill.est-cerrado { background: #eef2f6; color: #64748b; }

.soporte-prio { font-size: 11px; color: var(--text-muted); }
    .soporte-prio.prio-critica { color: #b91c1c; font-weight: 700; }
    .soporte-prio.prio-alta { color: #c2410c; font-weight: 600; }

/* ---------------------------------------------------------------- Popup de ticket nuevo */
.soporte-overlay { z-index: 1060; align-items: center; padding: 4vh 16px; }

.soporte-modal {
    position: relative;
    width: 100%;
    max-width: 880px;
    max-height: 92vh;
    background: #fff;
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 60px rgba(15, 39, 66, .35);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.soporte-modal-cab {
    position: relative;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 20px 64px 16px 28px;
    border-bottom: 1px solid var(--border-soft);
}

    .soporte-modal-cab h2 { margin: 0; font-size: 21px; font-weight: 600; color: var(--brand-navy); }

.soporte-modal-ic { width: 40px; height: 40px; font-size: 26px; font-weight: 500; }

.soporte-modal-cuerpo { padding: 14px 28px 18px; overflow-y: auto; flex: 1; }

.soporte-lbl { display: block; margin: 12px 0 6px; }

.soporte-tipos { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }

.soporte-tipo {
    text-align: left;
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-md);
    background: #fff;
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    transition: border-color .15s ease, background .15s ease;
}

    .soporte-tipo b { font-family: 'Inter Tight', 'Inter', sans-serif; color: var(--brand-navy); font-size: 14px; }
    .soporte-tipo span { font-size: 12.5px; color: #3d4a5c; line-height: 1.3; }
    .soporte-tipo:hover { border-color: var(--brand-accent); }
    .soporte-tipo.sel { border: 2px solid var(--brand-accent); background: #f2f8fe; padding: 9px 11px; }

.soporte-impactos { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }

.soporte-impacto {
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-md);
    background: #fff;
    padding: 8px 10px;
    font-size: 13px;
    color: #1f2b3a;
}

    .soporte-impacto:hover { border-color: var(--brand-accent); }
    .soporte-impacto.sel { border-color: var(--brand-accent); background: #f2f8fe; font-weight: 600; }
    .soporte-impacto.imp-no_vende.sel { border-color: #ef4444; background: #fdecec; color: #b91c1c; }

.soporte-medidor { max-width: 260px; }

.soporte-auto {
    margin-top: 14px;
    border: 1px solid var(--border-soft);
    background: var(--surface);
    border-radius: var(--radius-md);
    padding: 12px 16px;
    font-size: 13px;
}

    .soporte-auto > b { color: var(--brand-navy); font-size: 13.5px; }

.soporte-auto-datos { display: flex; flex-wrap: wrap; gap: 4px 22px; margin-top: 6px; color: #3d4a5c; }
    .soporte-auto-datos code { font-family: 'Space Mono', monospace; color: var(--brand-navy); font-size: 12px; }

.soporte-auto-error {
    margin-top: 8px;
    background: #fdecec;
    color: #b91c1c;
    border-radius: 8px;
    padding: 6px 10px;
}

    .soporte-auto-error code { font-family: 'Space Mono', monospace; color: #b91c1c; margin-left: 4px; }

.soporte-adjuntos { display: flex; flex-wrap: wrap; gap: 10px; }

.soporte-adj {
    position: relative;
    width: 150px;
    height: 96px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-soft);
    background: #eef2f6;
    overflow: hidden;
}

    .soporte-adj img { width: 100%; height: 100%; object-fit: cover; }

.soporte-adj-ext {
    position: absolute;
    inset: 0 0 26px;
    display: grid;
    place-items: center;
    font-family: 'Space Mono', monospace;
    font-weight: 700;
    color: var(--brand-navy);
}

.soporte-adj-nom {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 3px 7px;
    font-size: 11px;
    background: rgba(255, 255, 255, .9);
    color: #3d4a5c;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.soporte-adj-quitar {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 22px;
    height: 22px;
    border-radius: 999px;
    border: 0;
    background: rgba(255, 255, 255, .92);
    color: #3d4a5c;
    font-size: 11px;
    line-height: 1;
}

.soporte-zona {
    flex: 1;
    min-width: 240px;
    min-height: 96px;
    border: 1.5px dashed #c5d1de;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 4px 6px;
    padding: 10px 14px;
    font-size: 13px;
    color: var(--text-muted);
    text-align: center;
    transition: border-color .15s ease, background .15s ease;
}

    .soporte-zona.soporte-zona-activa { border-color: var(--brand-accent); background: #f2f8fe; }

.soporte-elegir, .soporte-camara {
    position: relative;
    margin: 0;
    font-size: 13px;
    color: var(--brand-accent);
    font-weight: 600;
    cursor: pointer;
}

    .soporte-elegir input, .soporte-camara input {
        position: absolute;
        inset: 0;
        opacity: 0;
        cursor: pointer;
        width: 100%;
    }

/* Camara: solo en pantallas tactiles. */
.soporte-camara { display: none; }

@media (pointer: coarse) {
    .soporte-camara { display: inline-block; margin-left: 8px; }
}

.soporte-alerta { margin: 12px 0 0; font-size: 13.5px; }

.soporte-modal-pie {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 28px;
    border-top: 1px solid var(--border-soft);
    background: #fff;
}

    .soporte-modal-pie .btn { border-radius: var(--radius-md); padding: 8px 20px; }
    .soporte-modal-pie .btn-primary { background: var(--brand-navy); border-color: var(--brand-navy); }

.soporte-captura {
    margin: 0 auto 0 0;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-weight: 500;
    color: #3d4a5c;
    cursor: pointer;
}

/* ---------------------------------------------------------------- Conversacion */
.soporte-volver {
    border: 0;
    background: none;
    width: 30px;
    height: 30px;
    border-radius: 8px;
    color: var(--brand-navy);
    flex: none;
}

    .soporte-volver:hover { background: var(--surface); }
    .soporte-volver svg { width: 20px; height: 20px; }

.soporte-conv-tit { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.soporte-conv-asunto { font-weight: 600; color: #1f2b3a; font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.soporte-panel > .soporte-alerta { margin: 10px 16px 0; }

.soporte-chat {
    flex: 1;
    overflow-y: auto;
    background: var(--surface);
    padding: 16px 16px 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.soporte-burbuja {
    max-width: 85%;
    padding: 9px 13px 6px;
    border-radius: 14px;
    font-size: 14px;
    box-shadow: var(--shadow-sm);
}

    .soporte-burbuja.propia { align-self: flex-end; background: var(--brand-navy); color: #fff; border-bottom-right-radius: 4px; }
    .soporte-burbuja.ajena { align-self: flex-start; background: #fff; border: 1px solid var(--border-soft); border-bottom-left-radius: 4px; }
    .soporte-burbuja.propia a { color: #bfdbfe; }
    .soporte-burbuja.interna { align-self: flex-end; background: #fffbea; border: 1px dashed #e9b949; color: #7a5300; border-bottom-right-radius: 4px; }
    .soporte-burbuja.interna .soporte-autor { color: #a16207; }

.soporte-autor { display: block; font-size: 11.5px; font-weight: 700; color: var(--brand-accent); margin-bottom: 2px; }
.soporte-texto { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.4; }
.soporte-hora { display: block; text-align: right; font-size: 10.5px; opacity: .65; margin-top: 3px; }

.soporte-burbuja-adj { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 7px; }

.soporte-mini {
    width: 96px;
    height: 72px;
    padding: 0;
    border: 1px solid rgba(0, 0, 0, .08);
    border-radius: 8px;
    overflow: hidden;
    background: #e2e8f0;
}

    .soporte-mini img { width: 100%; height: 100%; object-fit: cover; }

.soporte-adj-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 1px solid var(--border-soft);
    background: #fff;
    color: var(--brand-navy);
    border-radius: 999px;
    padding: 3px 10px;
    font-size: 12px;
}

    .soporte-adj-chip.off { opacity: .5; text-decoration: line-through; }
    .soporte-adj-chip button { border: 0; background: none; padding: 0; font-size: 10px; color: var(--text-muted); }

.soporte-sistema { text-align: center; }
    .soporte-sistema span { font-size: 11.5px; color: var(--text-muted); background: #e9eef4; border-radius: 999px; padding: 3px 10px; }
    .soporte-sistema.interna span { background: #fdf3d3; color: #8a6100; }

.soporte-conv-pie { border-top: 1px solid var(--border-soft); padding: 12px 16px 14px; display: flex; flex-direction: column; gap: 8px; }

.soporte-escribir { border: 1px solid var(--border-soft); border-radius: var(--radius-md); padding: 6px; }
    .soporte-escribir textarea { border: 0; resize: none; padding: 6px 8px; box-shadow: none !important; }
    .soporte-escribir .btn-primary { background: var(--brand-navy); border-color: var(--brand-navy); border-radius: 8px; padding: 4px 16px; }

.soporte-estado-fin { display: flex; align-items: center; justify-content: space-between; font-size: 13.5px; color: var(--text-muted); }

.soporte-calif { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; background: var(--surface); border-radius: var(--radius-md); padding: 10px 12px; }
.soporte-calif-tit { font-weight: 600; font-size: 13.5px; color: var(--brand-navy); }
.soporte-estrellas button, .soporte-calif.hecha span { border: 0; background: none; font-size: 22px; line-height: 1; color: #cbd5e1; padding: 0 1px; }
    .soporte-estrellas button.on, .soporte-calif.hecha span.on { color: #f59e0b; }
.soporte-calif .form-control { flex: 1; min-width: 160px; }

/* Visor de imagenes */
.soporte-visor { z-index: 1080; flex-direction: column; align-items: center; justify-content: center; gap: 10px; background: rgba(10, 28, 48, .85); }
    .soporte-visor img { max-width: 92vw; max-height: 82vh; border-radius: 8px; box-shadow: 0 20px 60px rgba(0, 0, 0, .4); background: #fff; }
    .soporte-visor .venta-modal-cerrar { position: fixed; top: 18px; right: 18px; }
.soporte-visor-nom { color: #e2e8f0; font-size: 13px; }

/* ---------------------------------------------------------------- Aviso de error con "Reportar este error" */
.aviso-reportar {
    border: 0;
    background: none;
    padding: 0;
    margin-left: 8px;
    color: inherit;
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 2px;
    cursor: pointer;
    white-space: nowrap;
}

@media (max-width: 720px) {
    .soporte-tipos, .soporte-impactos { grid-template-columns: repeat(2, 1fr); }
    .soporte-modal-cuerpo, .soporte-modal-pie { padding-left: 16px; padding-right: 16px; }
    .soporte-modal-pie { flex-wrap: wrap; }
    .soporte-captura { width: 100%; }
}

@media print {
    .soporte-fondo, .soporte-overlay, .soporte-btn { display: none !important; }
}

.soporte-mail { max-width: 360px; }

/* ---------------------------------------------------------------- Adjuntos al responder (AdjuntosSoporte compacto) */
.soporte-adjuntos.compacto { gap: 8px; padding: 6px 6px 2px; }
    .soporte-adjuntos.compacto:empty { display: none; }
    .soporte-adjuntos.compacto .soporte-adj { width: 112px; height: 72px; }
    .soporte-adjuntos.compacto .soporte-adj-nom { font-size: 10.5px; padding: 2px 6px; }

.soporte-adj-acc { display: flex; align-items: center; gap: 4px 10px; flex-wrap: wrap; min-width: 0; }

.soporte-adj-btn {
    position: relative;
    margin: 0;
    height: 30px;
    min-width: 32px;
    padding: 0 7px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
}

    .soporte-adj-btn:hover { background: var(--surface); color: var(--brand-navy); }
    .soporte-adj-btn svg { width: 17px; height: 17px; flex: none; }
    .soporte-adj-btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
    .soporte-adj-btn.off { opacity: .45; pointer-events: none; }

/* Camara: solo en pantallas tactiles. */
.soporte-camara-btn { display: none; }

@media (pointer: coarse) {
    .soporte-camara-btn { display: inline-flex; }
}

.soporte-captura-chica { margin: 0; font-size: 12.5px; gap: 6px; white-space: nowrap; }

.soporte-adj-error { margin: 6px 6px 0; font-size: 12.5px; color: #b91c1c; }

/* Panel del cliente: clip, camara y captura a la izquierda; Enviar a la derecha. */
.soporte-escribir .soporte-adj-acc { padding: 0 2px; }
.soporte-escribir .soporte-escribir-enviar { margin-left: auto; }
