.difusion-titulo {
    font-size: 1rem;
    font-weight: 600;
    color: #1a1a1a;
    letter-spacing: 0.05em;
    margin-bottom: 1rem;
}

.difusion-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.difusion-stats {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.stat-card {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #fff;
    border: 1px solid #e8e6e0;
    border-radius: 10px;
    padding: 10px 16px;
}

.stat-icon {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-icon--enviadas { background: #e8f0fe; color: #1a6bc4; }
.stat-icon--activas  { background: #e6f4ea; color: #1e7e34; }
.stat-icon--pausadas { background: #fde8e8; color: #c0392b; }
.stat-icon--agentes  { background: #ede8fe; color: #5b34b7; }


.difusion-titulo-seccion {
    color: var(--color-azul-principal);
    margin-right: 10px;
}

.stat-info {
    display: flex;
    flex-direction: column;
}

.stat-numero {
    font-size: 1.15rem;
    font-weight: 600;
    color: #1a1a1a;
    line-height: 1.2;
}

.stat-label {
    font-size: 0.75rem;
    color: #888;
}

.btn-nueva-difusion {
    display: flex;
    align-items: center;
    gap: 6px;
    background: #1a6bc4;
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 10px 18px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s;
}

.btn-nueva-difusion:hover { background: #155aa0; }

.btn-chevron { margin-left: 2px; }

.difusion-body {
    display: grid;
    grid-template-columns: 380px 1fr;
    gap: 20px;
    align-items: start;
    padding: 20px 0;
    height: calc(100% - 60px);
    overflow-y: auto;
}

/* ===== PANEL ===== */
.panel {
    background: #fff;
    border: 1px solid #e8e6e0;
    border-radius: 14px;
    overflow: hidden;
}

.panel-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 18px;
    border-bottom: 1px solid #f0eee8;
    font-size: 0.875rem;
    font-weight: 600;
    color: #1a1a1a;
}

.panel-badge {
    margin-left: auto;
    background: #1a6bc4;
    color: #fff;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 20px;
}

.panel-body {
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* ===== FIELDS ===== */
.field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.field-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: #555;
    letter-spacing: 0.03em;
}

.field-input {
    width: 100%;
    padding: 9px 12px;
    font-size: 0.875rem;
    color: #1a1a1a;
    background: #fafaf8;
    border: 1px solid #e0ddd6;
    border-radius: 8px;
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
    font-family: inherit;
}

.field-input:focus {
    border-color: #1a6bc4;
    box-shadow: 0 0 0 3px rgba(26, 107, 196, 0.1);
    background: #fff;
}

.field-textarea {
    resize: vertical;
    min-height: 100px;
    line-height: 1.5;
}

/* ===== TIPO RADIO ===== */
.tipo-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
}

.tipo-opcion {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 7px 4px;
    border-radius: 7px;
    border: 1px solid #e0ddd6;
    font-size: 0.78rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
}

.tipo-opcion input { display: none; }

.tipo-opcion--info    { color: #1a6bc4; }
.tipo-opcion--success { color: #1e7e34; }
.tipo-opcion--warning { color: #d4830a; }
.tipo-opcion--error   { color: #c0392b; }

.tipo-opcion--info:has(input:checked)    { background: #e8f0fe; border-color: #1a6bc4; }
.tipo-opcion--success:has(input:checked) { background: #e6f4ea; border-color: #1e7e34; }
.tipo-opcion--warning:has(input:checked) { background: #fef6e4; border-color: #d4830a; }
.tipo-opcion--error:has(input:checked)   { background: #fde8e8; border-color: #c0392b; }

/* ===== ADJUNTOS ===== */
.adjuntos-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.adj-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 9px 8px;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    border: 1.5px dashed;
    transition: all 0.15s;
    font-family: inherit;
}

.adj-btn--imagen { color: #1a6bc4; border-color: #a8c8f0; background: #f0f6fe; }
.adj-btn--video  { color: #c0392b; border-color: #f0a8a8; background: #fef3f3; }
.adj-btn--pdf    { color: #d4830a; border-color: #f0d0a0; background: #fef9f0; }

.adj-btn--imagen:hover { background: #e0effe; }
.adj-btn--video:hover  { background: #fde8e8; }
.adj-btn--pdf:hover    { background: #fef3e0; }

.adjuntos-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 4px;
}

/* ===== BTN CREAR ===== */
.btn-crear {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 11px;
    background: #1a6bc4;
    color: #fff;
    border: none;
    border-radius: 9px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, transform 0.1s;
    font-family: inherit;
    margin-top: 4px;
}

.btn-crear:hover  { background: #155aa0; }
.btn-crear:active { transform: scale(0.98); }

/* ===== LISTADO ===== */
.list-filtros {
    display: flex;
    gap: 10px;
    padding: 12px 16px;
    border-bottom: 1px solid #f0eee8;
}

.list-search { flex: 1; }
.list-filter { width: 130px; }

.difusion-lista {
    display: flex;
    flex-direction: column;
}

/* ===== DIF ITEM ===== */
.dif-item {
    padding: 14px 16px;
    border-bottom: 1px solid #f5f4f0;
    transition: background 0.15s;
}

.dif-item:last-child { border-bottom: none; }
.dif-item:hover { background: #fafaf8; }
.dif-item--inactivo { opacity: 0.6; }

.dif-item__top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 6px;
}

.dif-item__info {
    display: flex;
    align-items: center;
    gap: 8px;
}

.dif-item__badge {
    font-size: 0.68rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    flex-shrink: 0;
}

.dif-item__badge--info    { background: #e8f0fe; color: #1a6bc4; }
.dif-item__badge--success { background: #e6f4ea; color: #1e7e34; }
.dif-item__badge--warning { background: #fef6e4; color: #d4830a; }
.dif-item__badge--error   { background: #fde8e8; color: #c0392b; }

.dif-item__titulo {
    font-size: 0.9rem;
    font-weight: 600;
    color: #1a1a1a;
    margin: 0;
}

.dif-item__meta {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    color: #999;
    margin-bottom: 10px;
}

.dif-item__destino {
    display: flex;
    align-items: center;
    gap: 3px;
    background: #f0eee8;
    color: #666;
    padding: 2px 7px;
    border-radius: 20px;
    margin-left: 4px;
}

.dif-item__acciones {
    display: flex;
    gap: 6px;
}

.accion-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 6px 12px;
    border-radius: 7px;
    font-size: 0.78rem;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid;
    transition: all 0.15s;
    font-family: inherit;
}

.accion-btn--editar   { color: #1a6bc4; border-color: #a8c8f0; background: #f0f6fe; }
.accion-btn--eliminar { color: #c0392b; border-color: #f0a8a8; background: #fef3f3; }
.accion-btn--ver      { color: #555;    border-color: #ddd;     background: #f5f5f5; }
.accion-btn--ejecutar { color: #1e7e34; border-color: #a8d5b5; background: #e6f4ea; }

.accion-btn--editar:hover   { background: #deeafe; }
.accion-btn--eliminar:hover { background: #fde0e0; }
.accion-btn--ver:hover      { background: #ebebeb; }
.accion-btn--ejecutar:hover { background: #d0edda; }

/* ===== TOGGLE ===== */
.toggle { position: relative; display: inline-block; flex-shrink: 0; }
.toggle input { display: none; }

.toggle__track {
    display: block;
    width: 38px;
    height: 21px;
    background: #ddd;
    border-radius: 20px;
    cursor: pointer;
    transition: background 0.2s;
    position: relative;
}

.toggle__track::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 15px;
    height: 15px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.2s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.toggle input:checked + .toggle__track { background: #1e7e34; }
.toggle input:checked + .toggle__track::after { transform: translateX(17px); }

/* Modal */
.dif-modal-overlay {
    display: none;
    position: fixed; inset: 0; z-index: 1000;
    align-items: center; justify-content: center;
    background: rgba(0,0,0,0.4);
    padding: 16px;
}
.dif-modal-overlay.visible { display: flex; }

.dif-modal {
    background: #fff; border-radius: 14px;
    width: 100%; max-width: 500px;
    max-height: 92vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.dif-modal__header {
    display: flex; align-items: center; gap: 10px;
    padding: 16px 18px; border-bottom: 1px solid #f0eee8;
    flex-shrink: 0;
}
.dif-modal__header h3 { font-size: 0.95rem; font-weight: 600; flex: 1; margin: 0; }
.dif-modal__close {
    background: none; border: none; cursor: pointer;
    font-size: 1rem; color: #aaa; padding: 4px 8px;
}
.dif-modal__close:hover { color: #333; }

.dif-modal__body {
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    overflow-y: auto;
    flex: 1;
}
.dif-modal__mensaje { font-size: 0.9rem; color: #444; line-height: 1.6; }

.dif-modal__adjuntos { display: flex; flex-direction: column; gap: 10px; }

.adj-modal-img {
    width: 100%;
    max-height: none;
    object-fit: contain;
    border-radius: 8px;
    background: #f5f5f5;
    display: block;
}

.adj-modal-video {
    width: 100%;
    max-height: 280px;
    border-radius: 8px;
    background: #000;
}
.adj-modal-pdf   { font-size: 0.85rem; color: #1a6bc4; text-decoration: none; }

.dif-modal__meta {
    display: flex; flex-wrap: wrap; gap: 12px;
    padding-top: 12px; border-top: 1px solid #f0eee8;
    font-size: 0.8rem; color: #888;
    flex-shrink: 0;
}

/* Preview adjuntos en formulario */
.adj-preview-item {
    position: relative; width: 70px; height: 70px;
    border-radius: 8px; overflow: hidden;
    border: 1px solid #e0ddd6; background: #fafaf8;
}
.adj-preview-item img,
.adj-preview-item video { width: 100%; height: 100%; object-fit: cover; }
.adj-remove {
    position: absolute; top: 3px; right: 3px;
    background: rgba(0,0,0,0.55); color: #fff;
    border: none; border-radius: 50%;
    width: 18px; height: 18px; font-size: 10px;
    cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.adj-pdf-thumb {
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    height: 100%; gap: 4px;
    font-size: 0.6rem; color: #d4830a; padding: 4px; text-align: center;
    word-break: break-all;
}

.dif-adj-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 4px;
    flex-shrink: 0;
}

.dif-adj-icon--imagen { background: #e8f0fe; color: #1a6bc4; }
.dif-adj-icon--video  { background: #fde8e8; color: #c0392b; }
.dif-adj-icon--pdf    { background: #fef6e4; color: #d4830a; }
.dif-adj-icon--permanente { 
    margin-left: -5px;
    margin-right: -5px; 
}

.difusion-modal-mensaje {
    white-space: pre-wrap;
}

.dif-modal__mensaje {
    white-space: pre-wrap;
}


/* ── Toolbar de formato ── */
/* ── Quill editor ── */
.ql-container {
    font-family: inherit;
    font-size: 0.9rem;
    border-radius: 0 0 8px 8px !important;
    border-color: #e0e3e9 !important;
    max-height: 220px;
    overflow-y: auto;
}
.ql-toolbar {
    border-radius: 8px 8px 0 0 !important;
    border-color: #e0e3e9 !important;
    background: #f5f6f8;
    padding: 4px 8px !important;
}
.ql-toolbar .ql-formats { margin-right: 8px !important; }
.ql-editor {
    min-height: 90px;
    padding: 10px 12px;
    color: #1a1a1a;
}
.ql-editor.ql-blank::before {
    color: #aaa;
    font-style: normal;
}

.dif-modal__mensaje.ql-editor {
    padding: 0;
    font-size: 0.9rem;
    line-height: 1.6;
    color: #444;
    white-space: normal;
    overflow: visible;
    min-height: unset;
}

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

@media (max-widh: 1024px) {

    .difusion-body {
        grid-template-columns: 320px 1fr;
    }
}

@media (max-width: 768px) {

    /* Header stats: scroll horizontal en mobile */
    .difusion-top {
        flex-direction: column;
        align-items: stretch;
    }

    .difusion-stats {
        overflow-x: auto;
        flex-wrap: nowrap;
        padding-bottom: 4px;
        -webkit-overflow-scrolling: touch;
    }

    .stat-card {
        flex-shrink: 0;
    }

    .btn-nueva-difusion {
        width: 100%;
        justify-content: center;
    }

    /* Body: una columna */
    .difusion-body {
        grid-template-columns: 1fr;
    }

    /* Tipo radio: 2 columnas en lugar de 4 */
    .tipo-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 576px) {

    .btn-nueva-difusion {
        display: none;
    }

    .panel--list {
        display: flex;
        flex-direction: column;
        margin-top: 710px;
    }

    .dif-item:last-child {
        margin-bottom: 150px;
    }

}

@media (max-width: 480px) {

    /* Stats más compactos */
    .stat-card {
        padding: 8px 12px;
    }

    .stat-icon {
        width: 32px;
        height: 32px;
    }

    .stat-numero {
        font-size: 1rem;
    }

    /* Adjuntos: una columna */
    .adjuntos-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    /* Acciones del item: wrap */
    .dif-item__acciones {
        flex-wrap: wrap;
    }

    .accion-btn {
        flex: 1;
        justify-content: center;
        min-width: 80px;
    }

    /* Filtros: columna */
    .list-filtros {
        flex-direction: column;
    }

    .list-filter {
        width: 100%;
    }

    /* Modal full width */
    .dif-modal {
        max-width: 100%;
        margin: 0 12px;
    }
}