/**
 * Docmaster - Estilos del Listado Maestro de Documentos
 */

/* ========================================================================= */
/*  LAYOUT GENERAL                                                            */
/* ========================================================================= */

#docmaster-admin {
    max-width: 100%;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* ========================================================================= */
/*  TÍTULO Y DEFINICIÓN                                                       */
/* ========================================================================= */

.docmaster-title {
    margin: 0 0 0.5rem 0;
    font-size: 1.5rem;
    color: #1f2937;
}

.docmaster-definition {
    margin: 0 0 1.25rem 0;
    padding: 0.75rem 1rem;
    background: #f8fafc;
    border-left: 3px solid #2563eb;
    color: #475569;
    font-size: 0.875rem;
    line-height: 1.6;
    border-radius: 0 6px 6px 0;
}

/* ========================================================================= */
/*  BARRA DE ESCANEO + STATS INLINE                                           */
/* ========================================================================= */

.docmaster-scan-bar {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-top: 1.25rem;
    padding: 0.75rem 1rem;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    flex-wrap: wrap;
}

.docmaster-stats-inline {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-left: auto;
}

.dm-stat-inline {
    font-size: 0.8125rem;
    color: #475569;
}

.dm-stat-inline strong {
    color: #2563eb;
    font-weight: 700;
    font-size: 0.9375rem;
}

.dm-stat-sep {
    color: #cbd5e1;
    font-size: 0.75rem;
}

#docmaster-admin .docmaster-btn-scan {
    background: #2563eb !important;
    color: #ffffff !important;
    border: none;
    padding: 0.5rem 1.25rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    transition: background 0.2s;
}

#docmaster-admin .docmaster-btn-scan:hover {
    background: #1d4ed8 !important;
    color: #ffffff !important;
}

#docmaster-admin .docmaster-btn-scan:disabled {
    background: #94a3b8 !important;
    color: #1f2937 !important;
    cursor: not-allowed;
}

.docmaster-btn-scan.scanning {
    background: #f59e0b;
}

.docmaster-scan-status {
    font-size: 0.85rem;
    color: #64748b;
    white-space: pre-line;
    line-height: 1.5;
    margin-top: 8px;
}

.docmaster-scan-status.success {
    color: #16a34a;
    font-weight: 500;
}

.docmaster-scan-status.warning {
    color: #b45309;
    font-weight: 500;
}

.docmaster-scan-status.error {
    color: #dc2626;
    font-weight: 500;
}

/* ========================================================================= */
/*  TABS                                                                       */
/* ========================================================================= */

.docmaster-tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid #e5e7eb;
    margin-bottom: 1rem;
}

.docmaster-tab {
    padding: 0.625rem 1.25rem;
    border: none;
    background: transparent;
    color: #64748b;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.2s;
}

.docmaster-tab:hover {
    color: #1f2937;
}

.docmaster-tab.active {
    color: #2563eb;
    border-bottom-color: #2563eb;
}

.docmaster-tab-content {
    display: none;
}

.docmaster-tab-content.active {
    display: block;
}

/* ========================================================================= */
/*  FILTROS                                                                    */
/* ========================================================================= */

.docmaster-filters {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.docmaster-select,
.docmaster-input {
    padding: 0.5rem 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 0.875rem;
    color: #374151;
    background: white;
    transition: border-color 0.2s;
}

.docmaster-select:focus,
.docmaster-input:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.docmaster-input {
    min-width: 250px;
}

/* Filtro de fechas (vigencia) */
.docmaster-filters-dates {
    align-items: center;
    margin-top: -0.5rem;
}

.dm-filter-label {
    font-size: 0.8125rem;
    font-weight: 600;
    color: #475569;
    white-space: nowrap;
}

.docmaster-input-date {
    min-width: 120px !important;
    max-width: 130px;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

.dm-filter-sep {
    color: #94a3b8;
    font-size: 0.875rem;
}

.dm-btn-clear {
    background: none;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    color: #94a3b8;
    cursor: pointer;
    padding: 0.375rem 0.5rem;
    font-size: 0.75rem;
    line-height: 1;
    transition: all 0.2s;
}

.dm-btn-clear:hover {
    background: #fee2e2;
    border-color: #fca5a5;
    color: #dc2626;
}

/* ========================================================================= */
/*  TABLA                                                                      */
/* ========================================================================= */

.docmaster-table-wrap {
    overflow-x: auto;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
}

.docmaster-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8125rem;
}

.docmaster-table thead th {
    background: #f8fafc;
    padding: 0.625rem 0.75rem;
    text-align: left;
    font-weight: 600;
    color: #475569;
    border-bottom: 2px solid #e5e7eb;
    white-space: nowrap;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    user-select: none;
}

.docmaster-table thead th.sortable {
    cursor: pointer;
}

.docmaster-table thead th.sortable:hover {
    background: #f1f5f9;
    color: #2563eb;
}

.docmaster-table thead th.sort-asc::after {
    content: ' \25B2';
    font-size: 0.625rem;
}

.docmaster-table thead th.sort-desc::after {
    content: ' \25BC';
    font-size: 0.625rem;
}

.docmaster-table tbody tr {
    border-bottom: 1px solid #f1f5f9;
    transition: background 0.15s;
}

.docmaster-table tbody tr:hover {
    background: #f8fafc;
}

.docmaster-table tbody td {
    padding: 0.5rem 0.75rem;
    color: #374151;
    vertical-align: middle;
}

/* Columnas específicas */
.dm-col-title { min-width: 200px; }
.dm-col-title a {
    color: #2563eb;
    text-decoration: none;
    font-weight: 500;
}
.dm-col-title a:hover { text-decoration: underline; }

.dm-col-code { min-width: 100px; }
.dm-col-version { min-width: 60px; text-align: center; }
.dm-col-validity { min-width: 100px; }
.dm-col-ns { min-width: 120px; }
.dm-col-formats { min-width: 70px; text-align: center; }
.dm-col-actions { min-width: 50px; text-align: center; }

/* Columna procedimiento en formatos */
.dm-col-fproc {
    min-width: 180px;
    font-size: 0.75rem;
    color: #475569;
    line-height: 1.4;
}
.dm-col-fproc a {
    color: #2563eb;
    text-decoration: none;
    font-weight: 500;
}
.dm-col-fproc a:hover { text-decoration: underline; }

/* Badge de namespace */
.dm-ns-badge {
    display: inline-block;
    padding: 0.125rem 0.5rem;
    background: #eff6ff;
    color: #2563eb;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
}

/* ========================================================================= */
/*  EDICIÓN INLINE                                                             */
/* ========================================================================= */

.dm-editable {
    cursor: pointer;
    position: relative;
}

.dm-editable:hover {
    background: #eff6ff !important;
}

.dm-editable:hover .dm-cell-value::after {
    content: ' \270E';
    color: #94a3b8;
    font-size: 0.75rem;
}

.dm-editable.editing {
    padding: 0.25rem;
}

.dm-editable .dm-edit-input {
    width: 100%;
    padding: 0.375rem 0.5rem;
    border: 2px solid #2563eb;
    border-radius: 4px;
    font-size: 0.8125rem;
    outline: none;
    box-sizing: border-box;
}

.dm-editable.saving .dm-cell-value {
    opacity: 0.5;
}

/* ========================================================================= */
/*  FORMATOS                                                                   */
/* ========================================================================= */

.dm-btn-formats {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 4px;
    padding: 0.125rem 0.5rem;
    cursor: pointer;
    transition: all 0.2s;
}

.dm-btn-formats:hover {
    background: #dbeafe;
    border-color: #93c5fd;
}

.dm-format-count {
    font-weight: 600;
    color: #2563eb;
    font-size: 0.8125rem;
}

.dm-no-formats {
    color: #cbd5e1;
    font-size: 0.8125rem;
}

.dm-formats-row td {
    padding: 0 !important;
    background: #f8fafc;
}

.dm-formats-cell {
    border-left: 3px solid #2563eb;
}

.dm-formats-list {
    padding: 0.75rem 1rem;
}

.dm-formats-list table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.75rem;
}

.dm-formats-list table th {
    background: #e2e8f0;
    padding: 0.375rem 0.5rem;
    text-align: left;
    font-weight: 600;
    color: #475569;
}

.dm-formats-list table td {
    padding: 0.375rem 0.5rem;
    border-bottom: 1px solid #e5e7eb;
}

.dm-formats-list table td a {
    color: #2563eb;
    text-decoration: none;
}

.dm-formats-list table td a:hover {
    text-decoration: underline;
}

/* ========================================================================= */
/*  BOTONES DE ACCIÓN                                                          */
/* ========================================================================= */

.dm-btn-edit {
    display: inline-block;
    width: 24px;
    height: 24px;
    line-height: 24px;
    text-align: center;
    border-radius: 4px;
    color: #64748b;
    text-decoration: none;
    transition: all 0.2s;
    font-size: 0.875rem;
}

.dm-btn-edit:hover {
    background: #eff6ff;
    color: #2563eb;
}

/* ========================================================================= */
/*  COLUMNA ACCIÓN EN FORMATOS - Dropdown                                      */
/* ========================================================================= */

.dm-col-factions {
    min-width: 50px;
    text-align: center;
}

.dm-fmt-action-wrap {
    position: relative;
    display: inline-block;
}

.dm-btn-edit-multi {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
}

.dm-fmt-action-menu {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    margin-top: 4px;
    min-width: 220px;
    max-width: 360px;
    background: #fff;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    z-index: 100;
    overflow: hidden;
}

.dm-fmt-action-menu.open {
    display: block;
}

.dm-fmt-action-item {
    display: block;
    padding: 0.5rem 0.75rem;
    color: #374151;
    text-decoration: none;
    font-size: 0.8rem;
    line-height: 1.4;
    border-bottom: 1px solid #f1f5f9;
    transition: background 0.15s;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dm-fmt-action-item:last-child {
    border-bottom: none;
}

.dm-fmt-action-item:hover {
    background: #eff6ff;
    color: #2563eb;
}

/* ========================================================================= */
/*  FORMATOS TAB - editable                                                    */
/* ========================================================================= */

.dm-fmt-editable {
    cursor: pointer;
}

.dm-fmt-editable:hover {
    background: #eff6ff !important;
}

.dm-fmt-editable:hover .dm-cell-value::after {
    content: ' \270E';
    color: #94a3b8;
    font-size: 0.75rem;
}

/* ========================================================================= */
/*  CÓDIGOS DUPLICADOS                                                         */
/* ========================================================================= */

/* Fila con código duplicado — fondo rojo suave */
tr.dm-duplicate > td {
    background: #fef2f2 !important;
    border-bottom-color: #fca5a5 !important;
}

tr.dm-duplicate .dm-col-code .dm-cell-value,
tr.dm-duplicate [data-field="code"] .dm-cell-value {
    color: #dc2626 !important;
    font-weight: 700;
}

/* Botón corregir duplicado */
.dm-btn-fix-dup {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: 1px solid #f87171;
    border-radius: 4px;
    color: #dc2626;
    cursor: pointer;
    font-size: 0.85rem;
    padding: 2px 6px;
    margin-left: 4px;
    transition: background 0.2s, transform 0.1s;
    vertical-align: middle;
    line-height: 1;
}

.dm-btn-fix-dup:hover {
    background: #fee2e2;
    transform: scale(1.1);
}

.dm-btn-fix-dup:disabled {
    opacity: 0.5;
    cursor: wait;
}

/* Botón sincronizar formato al procedimiento */
.dm-btn-sync-fmt {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: 1px solid #60a5fa;
    border-radius: 4px;
    color: #2563eb;
    cursor: pointer;
    font-size: 0.85rem;
    padding: 2px 6px;
    margin-left: 4px;
    transition: background 0.2s, transform 0.1s;
    vertical-align: middle;
    line-height: 1;
}

.dm-btn-sync-fmt:hover {
    background: #dbeafe;
    transform: scale(1.1);
}

.dm-btn-sync-fmt:disabled {
    opacity: 0.5;
    cursor: wait;
}

/* Botón masivo Corregir Todos — mismo estilo que Escanear Documentos */
.dm-btn-fix-all {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.5rem 1.25rem;
    background: #dc2626 !important;
    color: #ffffff !important;
    border: none;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
    margin-left: 0.5rem;
}

.dm-btn-fix-all:hover {
    background: #b91c1c !important;
    color: #ffffff !important;
}

.dm-btn-fix-all:disabled {
    background: #94a3b8 !important;
    color: #1f2937 !important;
    cursor: wait;
}

.dm-btn-fix-all .dm-dup-count {
    background: rgba(255,255,255,0.3);
    padding: 1px 6px;
    border-radius: 10px;
    font-size: 0.75rem;
}

/* Tabla de pendientes de revisión manual */
.dm-pending-review {
    margin-top: 1.5rem;
    border: 1px solid #fca5a5;
    border-radius: 8px;
    overflow: hidden;
}

.dm-pending-review-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #fef2f2;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #fca5a5;
}

.dm-pending-review-header h3 {
    margin: 0;
    font-size: 0.9375rem;
    color: #991b1b;
}

.dm-pending-review-header .dm-btn-clear-pending {
    background: #fee2e2;
    border: 1px solid #fca5a5;
    border-radius: 4px;
    color: #991b1b;
    cursor: pointer;
    font-size: 0.8125rem;
    padding: 4px 12px;
    transition: background 0.2s;
}

.dm-pending-review-header .dm-btn-clear-pending:hover {
    background: #fecaca;
}

.dm-pending-review table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8125rem;
}

.dm-pending-review th {
    background: #fff5f5;
    padding: 0.5rem 0.75rem;
    text-align: left;
    font-weight: 600;
    color: #991b1b;
    border-bottom: 1px solid #fca5a5;
}

.dm-pending-review td {
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid #fde8e8;
}

.dm-pending-review tr:last-child td {
    border-bottom: none;
}

.dm-pending-review .dm-old-code {
    color: #dc2626;
    text-decoration: line-through;
}

.dm-pending-review .dm-new-code {
    color: #16a34a;
    font-weight: 600;
}

.dm-pending-review .dm-btn-dismiss {
    background: none;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    color: #6b7280;
    cursor: pointer;
    font-size: 0.75rem;
    padding: 2px 8px;
}

.dm-pending-review .dm-btn-dismiss:hover {
    background: #f3f4f6;
    color: #374151;
}

/* ========================================================================= */
/*  REPARADOR GENERAL                                                          */
/* ========================================================================= */

.dm-btn-repair-all {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.5rem 1.25rem;
    background: #059669 !important;
    color: #ffffff !important;
    border: none;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
    margin-left: 0.5rem;
}

.dm-btn-repair-all:hover {
    background: #047857 !important;
    color: #ffffff !important;
}

.dm-btn-repair-all:disabled {
    background: #94a3b8 !important;
    color: #1f2937 !important;
    cursor: wait;
}

.dm-repair-spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: dm-spin 0.8s linear infinite;
    vertical-align: middle;
}

@keyframes dm-spin {
    to { transform: rotate(360deg); }
}

.dm-repair-results {
    margin-top: 1.5rem;
    border: 1px solid #6ee7b7;
    border-radius: 8px;
    overflow: hidden;
}

.dm-repair-results-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #ecfdf5;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #6ee7b7;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.dm-repair-results-header h3 {
    margin: 0;
    font-size: 0.9375rem;
    color: #065f46;
}

.dm-repair-summary {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.dm-repair-stat {
    font-size: 0.8rem;
    font-weight: 600;
    padding: 2px 10px;
    border-radius: 12px;
}

.dm-repair-ok    { background: #d1fae5; color: #065f46; }
.dm-repair-skip  { background: #fef3c7; color: #92400e; }
.dm-repair-err   { background: #fee2e2; color: #991b1b; }
.dm-repair-pages { background: #dbeafe; color: #1e40af; }

.dm-repair-results-header .dm-btn-clear-repair {
    background: #d1fae5;
    border: 1px solid #6ee7b7;
    border-radius: 4px;
    color: #065f46;
    cursor: pointer;
    font-size: 0.8125rem;
    padding: 4px 12px;
    transition: background 0.2s;
}

.dm-repair-results-header .dm-btn-clear-repair:hover {
    background: #a7f3d0;
}

.dm-repair-results table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8125rem;
}

.dm-repair-results th {
    background: #f0fdf4;
    padding: 0.5rem 0.75rem;
    text-align: left;
    font-weight: 600;
    color: #065f46;
    border-bottom: 1px solid #6ee7b7;
}

.dm-repair-results td {
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid #d1fae5;
}

.dm-repair-results tr:last-child td {
    border-bottom: none;
}

.dm-repair-badge {
    display: inline-block;
    padding: 1px 8px;
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: 600;
}

.dm-repair-badge-ok   { background: #d1fae5; color: #065f46; }
.dm-repair-badge-err  { background: #fee2e2; color: #991b1b; }
.dm-repair-badge-skip { background: #fef3c7; color: #92400e; }

/* ========================================================================= */
/*  ESTADOS Y MENSAJES                                                         */
/* ========================================================================= */

.dm-loading {
    text-align: center;
    padding: 2rem !important;
    color: #94a3b8;
    font-style: italic;
}

.docmaster-no-results {
    text-align: center;
    padding: 2rem;
    color: #94a3b8;
    font-style: italic;
}

/* ========================================================================= */
/*  SYNTAX COMPONENT - Tabla embebida en páginas wiki                          */
/* ========================================================================= */

.docmaster-embed {
    margin: 1rem 0;
}

.docmaster-embed .docmaster-table {
    font-size: 0.8125rem;
}

.docmaster-embed .docmaster-header {
    border-bottom: 1px solid #e5e7eb;
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
}

.docmaster-embed .docmaster-header h3 {
    margin: 0;
    font-size: 1.125rem;
    color: #1f2937;
}

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

@media (max-width: 768px) {
    .docmaster-scan-bar {
        flex-direction: column;
        align-items: flex-start;
    }

    .docmaster-stats-inline {
        margin-left: 0;
        flex-wrap: wrap;
    }

    .docmaster-filters {
        flex-direction: column;
    }

    .docmaster-input {
        min-width: unset;
        width: 100%;
    }

    .dm-col-ns,
    .dm-col-actions {
        display: none;
    }
}

/* =========================================================================
   REFERENCIA DE UBICACIONES
   ========================================================================= */

.docmaster-locations-ref {
    margin-top: 1.5rem;
    padding: 1rem 1.25rem;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
}

.docmaster-locations-ref h4 {
    margin: 0 0 0.75rem 0;
    font-size: 0.85rem;
    font-weight: 600;
    color: #475569;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.dm-locations-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.dm-location-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.3rem 0.7rem;
    background: #fff;
    border: 1px solid #cbd5e1;
    border-radius: 20px;
    font-size: 0.82rem;
    color: #334155;
}

.dm-location-badge em {
    font-style: normal;
    color: #2563eb;
    font-weight: 600;
}

/* Carpetas activas vs vacías */
.dm-folder-active {
    background: #eff6ff;
    border-color: #93c5fd;
    color: #1e40af;
    font-weight: 500;
}

.dm-folder-empty {
    background: #f9fafb;
    border-color: #e5e7eb;
    color: #9ca3af;
}

/* =========================================================================
   ESTRUCTURA DE REFERENCIAS DOCUMENTALES
   ========================================================================= */

.docmaster-structure-ref {
    margin-top: 1rem;
    padding: 1rem 1.25rem;
    background: #fefce8;
    border: 1px solid #fde68a;
    border-radius: 8px;
}

.docmaster-structure-ref h4 {
    margin: 0 0 0.5rem 0;
    font-size: 0.85rem;
    font-weight: 600;
    color: #92400e;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.dm-structure-desc {
    margin: 0 0 0.5rem 0;
    font-size: 0.8125rem;
    color: #78350f;
}

.dm-structure-format {
    margin: 0.5rem 0;
    padding: 0.5rem 0.75rem;
    background: #fff;
    border: 1px solid #fde68a;
    border-radius: 4px;
    text-align: center;
}

.dm-structure-format code {
    font-size: 0.875rem;
    color: #92400e;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.dm-structure-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem 1.5rem;
    margin: 0.5rem 0;
    font-size: 0.8rem;
    color: #78350f;
}

.dm-structure-legend strong {
    color: #92400e;
}

.dm-structure-note {
    margin: 0.5rem 0 0 0;
    font-size: 0.75rem;
    color: #a16207;
    font-style: italic;
}

/* =========================================================================
   CARPETAS DOCUMENTALES VÁLIDAS
   ========================================================================= */

.docmaster-folders-ref {
    margin-top: 1rem;
    padding: 1rem 1.25rem;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
}

.docmaster-folders-ref h4 {
    margin: 0 0 0.75rem 0;
    font-size: 0.85rem;
    font-weight: 600;
    color: #475569;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

/* =========================================================================
   EDICIÓN MASIVA - Checkbox columna
   ========================================================================= */

.dm-col-check {
    width: 36px;
    min-width: 36px;
    max-width: 36px;
    text-align: center;
    padding: 0.5rem 0.25rem !important;
}

.dm-col-check input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: #2563eb;
}

/* Fila seleccionada — azul suave */
tr.dm-selected > td {
    background: #eff6ff !important;
}

tr.dm-selected:hover > td {
    background: #dbeafe !important;
}

/* =========================================================================
   EDICIÓN MASIVA - Barra flotante
   ========================================================================= */

.dm-bulk-toolbar {
    position: sticky;
    top: 0;
    z-index: 100;
    background: #1e293b;
    border: 2px solid #2563eb;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.2);
    padding: 0.75rem 1.25rem;
    margin-bottom: 1rem;
    animation: dm-fade-in 0.25s ease-out;
}

@keyframes dm-fade-in {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
}

.dm-bulk-toolbar-inner {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    max-width: 1200px;
    margin: 0 auto;
    flex-wrap: wrap;
}

.dm-bulk-count {
    color: #ffffff;
    font-weight: 600;
    font-size: 0.875rem;
    white-space: nowrap;
    min-width: 120px;
}

.dm-bulk-field {
    min-width: 140px;
    padding: 0.5rem 0.75rem;
    background: #334155;
    color: #ffffff;
    border: 1px solid #475569;
    border-radius: 6px;
    font-size: 0.875rem;
}

.dm-bulk-field:focus {
    outline: none;
    border-color: #60a5fa;
}

.dm-bulk-value {
    min-width: 180px;
    padding: 0.5rem 0.75rem;
    background: #334155;
    color: #ffffff;
    border: 1px solid #475569;
    border-radius: 6px;
    font-size: 0.875rem;
}

.dm-bulk-value:focus {
    outline: none;
    border-color: #60a5fa;
}

.dm-bulk-value:disabled {
    background: #1e293b;
    color: #64748b;
    border-color: #334155;
    cursor: not-allowed;
}

.dm-bulk-apply {
    background: #2563eb;
    color: #ffffff;
    border: none;
    padding: 0.5rem 1.25rem;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    white-space: nowrap;
}

.dm-bulk-apply:hover {
    background: #1d4ed8;
}

.dm-bulk-apply:disabled {
    background: #475569;
    cursor: not-allowed;
}

.dm-bulk-cancel {
    background: transparent;
    color: #94a3b8;
    border: 1px solid #475569;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.dm-bulk-cancel:hover {
    background: #334155;
    color: #ffffff;
    border-color: #64748b;
}

/* =========================================================================
   SCROLLBAR SUPERIOR DUPLICADA
   ========================================================================= */

.dm-scroll-top {
    overflow-x: auto;
    overflow-y: hidden;
    height: 20px;
    margin-bottom: -1px;
    border: 1px solid #e5e7eb;
    border-bottom: none;
    border-radius: 8px 8px 0 0;
    background: #f8fafc;
}

.dm-scroll-top > div {
    height: 1px;
}

/* Cuando hay scroll-top, la tabla pierde su borde-radius superior */
.dm-scroll-top + .docmaster-table-wrap {
    border-top-left-radius: 0;
    border-top-right-radius: 0;
}

/* Responsive: barra flotante se apila en móvil */
@media (max-width: 768px) {
    .dm-bulk-toolbar-inner {
        flex-direction: column;
        align-items: stretch;
    }
    .dm-bulk-count {
        text-align: center;
    }
    .dm-bulk-field,
    .dm-bulk-value {
        min-width: unset;
        width: 100%;
    }
}
