/* Rel. Materiales — spreadsheet-style quick editing */

body.rm-qe-fill-dragging {
    cursor: crosshair;
    user-select: none;
}

.rm-qe-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 34px;
    padding: 6px 13px;
    border: 1px solid rgba(45, 212, 191, 0.32);
    border-radius: 7px;
    background: rgba(20, 184, 166, 0.11);
    color: #5eead4;
    cursor: pointer;
    font-size: 0.78rem;
    font-weight: 700;
    white-space: nowrap;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.rm-qe-toggle:hover,
.rm-qe-toggle.is-active {
    border-color: rgba(45, 212, 191, 0.62);
    background: rgba(20, 184, 166, 0.22);
    color: #ccfbf1;
}

.rm-qe-toggle .material-symbols-outlined {
    font-size: 17px;
}

.rm-qe-toolbar[hidden] {
    display: none !important;
}

.rm-qe-toolbar {
    display: grid;
    gap: 8px;
    margin-bottom: 12px;
    padding: 10px 12px;
    border: 1px solid rgba(45, 212, 191, 0.24);
    border-radius: 10px;
    background: linear-gradient(135deg, rgba(15, 118, 110, 0.23), rgba(15, 23, 42, 0.94));
    box-shadow: 0 8px 24px rgba(2, 6, 23, 0.18);
}

.rm-qe-toolbar-main,
.rm-qe-actions,
.rm-qe-summary,
.rm-qe-warning {
    display: flex;
    align-items: center;
}

.rm-qe-toolbar-main {
    justify-content: space-between;
    gap: 14px;
}

.rm-qe-summary {
    gap: 7px;
    color: #ccfbf1;
    font-size: 0.82rem;
    font-weight: 700;
    white-space: nowrap;
}

.rm-qe-summary .material-symbols-outlined {
    color: #2dd4bf;
    font-size: 18px;
}

.rm-qe-actions {
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 7px;
}

.rm-qe-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    min-height: 32px;
    padding: 5px 10px;
    border: 1px solid rgba(148, 163, 184, 0.28);
    border-radius: 6px;
    background: rgba(30, 41, 59, 0.82);
    color: #dbeafe;
    cursor: pointer;
    font-size: 0.74rem;
    font-weight: 650;
    transition: background 0.15s ease, border-color 0.15s ease, opacity 0.15s ease;
}

.rm-qe-action:hover:not(:disabled) {
    border-color: rgba(94, 234, 212, 0.5);
    background: rgba(51, 65, 85, 0.95);
}

.rm-qe-action:disabled {
    cursor: not-allowed;
    opacity: 0.42;
}

.rm-qe-action .material-symbols-outlined {
    font-size: 16px;
}

.rm-qe-action-danger {
    border-color: rgba(248, 113, 113, 0.28);
    color: #fecaca;
}

.rm-qe-action-primary {
    border-color: rgba(45, 212, 191, 0.46);
    background: #0f766e;
    color: #f0fdfa;
}

.rm-qe-action-primary:hover:not(:disabled) {
    background: #0d9488;
}

.rm-qe-warning {
    gap: 7px;
    padding: 7px 9px;
    border: 1px solid rgba(251, 191, 36, 0.2);
    border-radius: 7px;
    background: rgba(120, 53, 15, 0.18);
    color: #fde68a;
    font-size: 0.76rem;
}

.rm-qe-warning .material-symbols-outlined {
    flex: 0 0 auto;
    font-size: 17px;
}

.rm-qe-shortcuts {
    color: #94a3b8;
    font-size: 0.69rem;
}

.rm-qe-mode #rm-bulk-bar {
    display: none !important;
}

.rm-qe-cell {
    position: relative;
    min-width: 92px;
    padding: 5px 7px !important;
    border-right: 1px solid rgba(71, 85, 105, 0.22);
    transition: background 0.12s ease, box-shadow 0.12s ease;
}

.rm-qe-cell[data-field="unidad_medida"] {
    min-width: 104px;
}

.rm-qe-cell[data-field="precio_unitario"] {
    min-width: 116px;
}

.rm-qe-cell.is-active {
    z-index: 2;
    background: rgba(20, 184, 166, 0.1);
    box-shadow: inset 0 0 0 2px #2dd4bf;
}

.rm-qe-cell.is-dirty {
    background: rgba(251, 191, 36, 0.09);
    box-shadow: inset 3px 0 0 #fbbf24;
}

.rm-qe-cell.is-dirty.is-active {
    box-shadow: inset 3px 0 0 #fbbf24, inset 0 0 0 2px #2dd4bf;
}

.rm-qe-cell.is-invalid {
    background: rgba(239, 68, 68, 0.11);
    box-shadow: inset 0 0 0 2px #ef4444;
}

.rm-qe-cell.is-fill-preview {
    background: rgba(45, 212, 191, 0.16);
    box-shadow: inset 0 0 0 1px rgba(94, 234, 212, 0.8);
}

.rm-qe-editor-wrap {
    position: relative;
    display: flex;
    align-items: center;
    min-height: 30px;
}

.rm-qe-editor {
    width: 100%;
    min-width: 74px;
    height: 30px;
    padding: 4px 24px 4px 7px;
    border: 1px solid rgba(100, 116, 139, 0.52);
    border-radius: 5px;
    outline: none;
    background: rgba(15, 23, 42, 0.74);
    color: #f8fafc;
    font-family: inherit;
    font-size: 0.78rem;
    font-weight: 600;
}

.rm-qe-editor:focus {
    border-color: #2dd4bf;
    background: rgba(15, 23, 42, 0.98);
}

.rm-qe-editor[aria-invalid="true"] {
    border-color: #f87171;
}

.rm-qe-dirty-marker {
    position: absolute;
    top: 3px;
    right: 4px;
    display: none;
    width: 6px;
    height: 6px;
    border-radius: 999px;
    background: #fbbf24;
    box-shadow: 0 0 0 2px rgba(15, 23, 42, 0.88);
    pointer-events: none;
}

.rm-qe-cell.is-dirty .rm-qe-dirty-marker {
    display: block;
}

.rm-qe-fill-handle {
    position: absolute;
    right: -2px;
    bottom: -2px;
    display: block;
    width: 12px;
    height: 12px;
    padding: 0;
    border: 2px solid #0f172a;
    border-radius: 3px;
    background: #2dd4bf;
    cursor: crosshair;
    opacity: 0;
    transform: scale(0.75);
    transition: opacity 0.1s ease, transform 0.1s ease;
}

.rm-qe-cell.is-active .rm-qe-fill-handle,
.rm-qe-cell:hover .rm-qe-fill-handle,
.rm-qe-fill-handle:focus-visible {
    opacity: 1;
    transform: scale(1);
}

.rm-qe-fill-handle:focus-visible {
    outline: 2px solid #f8fafc;
    outline-offset: 2px;
}

.rm-qe-saving .rm-qe-action-primary .material-symbols-outlined {
    animation: rm-qe-spin 0.8s linear infinite;
}

@keyframes rm-qe-spin {
    to { transform: rotate(360deg); }
}

@media (max-width: 1100px) {
    .rm-qe-toolbar-main {
        align-items: flex-start;
        flex-direction: column;
    }

    .rm-qe-actions {
        justify-content: flex-start;
    }
}

@media (max-width: 760px) {
    .rm-qe-toggle {
        min-height: 40px;
    }

    .rm-qe-action {
        min-height: 40px;
    }

    .rm-qe-shortcuts {
        display: none;
    }
}
