/* ==========================================================================
   SECCIÓN REPUESTOS
   ========================================================================== */
#view-repuestos .rp-card:hover {
    transform: none;
}

.rp-grid {
    display: grid;
    gap: 20px;
    margin-bottom: 20px;
}

.rp-grid-2-1 { grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); }
.rp-grid-1-1 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }

@media (max-width: 1100px) {
    .rp-grid-2-1,
    .rp-grid-1-1 { grid-template-columns: minmax(0, 1fr); }
}

.rp-card-sub {
    font-size: 0.78rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* Selector de periodo (botones segmentados) */
.rp-segmented {
    display: inline-flex;
    padding: 4px;
    gap: 4px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 999px;
}

.rp-segmented button {
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 0.82rem;
    font-weight: 600;
    padding: 7px 16px;
    border-radius: 999px;
    cursor: pointer;
    transition: var(--transition);
}

.rp-segmented button:hover { color: var(--text-primary); }

.rp-segmented button.activo {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

/* Pedido sugerido */
.rp-pedido {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.rp-pedido-item {
    display: grid;
    grid-template-columns: 12px minmax(0, 1fr) 64px 76px;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-primary);
}

.rp-pedido-nombre {
    font-weight: 600;
    font-size: 0.9rem;
    line-height: 1.25;
}

.rp-pedido-nombre small {
    display: block;
    font-weight: 400;
    font-size: 0.72rem;
    color: var(--text-muted);
}

.rp-pedido-num {
    text-align: center;
    line-height: 1.1;
}

.rp-pedido-num b {
    display: block;
    font-size: 1.2rem;
    font-weight: 800;
}

.rp-pedido-num small {
    font-size: 0.66rem;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: var(--text-muted);
}

.rp-pedido-num.destacado {
    background: var(--primary-glow);
    border-radius: var(--radius-sm);
    padding: 4px 0;
}

.rp-pedido-num.destacado b { color: var(--primary); }

[data-theme="dark"] .rp-pedido-num.destacado b { color: var(--primary-light); }

.rp-pedido-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 12px 0;
    margin-top: 4px;
    border-top: 1px dashed var(--border-color);
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.rp-pedido-total b { color: var(--text-primary); font-size: 1rem; }

.rp-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.rp-vacio {
    padding: 28px 12px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.88rem;
}

/* Tabla compacta (compras por modelo y detalle) */
.rp-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.86rem;
    font-variant-numeric: tabular-nums;
}

.rp-table th {
    padding: 10px 12px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    text-align: left;
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
}

.rp-table td {
    padding: 11px 12px;
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
    vertical-align: middle;
}

.rp-table tbody tr:last-child td { border-bottom: none; }
.rp-table tbody tr:hover td { background: var(--primary-glow); }
.rp-table .num { text-align: right; }

.rp-pill {
    display: inline-block;
    min-width: 36px;
    padding: 3px 10px;
    border-radius: 999px;
    text-align: center;
    font-weight: 700;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
}

.rp-pill.fuerte {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

/* Bitácora en matriz */
.rp-matriz-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 16px;
    flex-wrap: wrap;
}

.rp-filtros {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: flex-end;
}

.rp-filtros .form-group { margin: 0; }
.rp-filtros label { font-size: 0.72rem; }

.rp-leyenda {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin: 14px 0 10px;
}

.rp-leyenda span { display: inline-flex; align-items: center; gap: 6px; }

.rp-matriz-wrap {
    overflow-x: auto;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
}

.rp-matriz {
    border-collapse: separate;
    border-spacing: 0;
    width: max-content;
    min-width: 100%;
    font-size: 0.85rem;
    font-variant-numeric: tabular-nums;
}

.rp-matriz th,
.rp-matriz td {
    padding: 8px 6px;
    text-align: center;
    white-space: nowrap;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
}

.rp-matriz thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: var(--bg-primary);
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: var(--text-secondary);
    min-width: 64px;
    line-height: 1.15;
}

.rp-matriz thead th small {
    display: block;
    font-size: 0.65rem;
    font-weight: 500;
    color: var(--text-muted);
}

.rp-matriz thead th.mes-actual {
    color: var(--primary);
    box-shadow: inset 0 -2px 0 var(--primary);
}

[data-theme="dark"] .rp-matriz thead th.mes-actual { color: var(--primary-light); }

.rp-matriz .col-nombre {
    position: sticky;
    left: 0;
    z-index: 1;
    text-align: left;
    min-width: 250px;
    max-width: 320px;
    white-space: normal;
    padding-left: 14px;
    border-right: 1px solid var(--border-color);
}

.rp-matriz thead .col-nombre { z-index: 3; }

.rp-matriz .col-total {
    border-left: 1px solid var(--border-color);
    min-width: 110px;
    padding-right: 14px;
}

.rp-cliente {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    user-select: none;
}

.rp-chevron {
    width: 16px;
    height: 16px;
    color: var(--text-muted);
    transition: transform 0.15s ease;
    flex-shrink: 0;
}

.rp-cliente.abierto .rp-chevron { transform: rotate(90deg); }

.rp-avatar {
    width: 30px;
    height: 30px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.72rem;
    font-weight: 800;
    color: #fff;
    flex-shrink: 0;
}

.rp-cliente-nombre {
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

.rp-cliente-nombre small {
    display: block;
    font-weight: 500;
    font-size: 0.7rem;
    color: var(--text-muted);
}

.rp-matriz tr.fila-equipo td { background: var(--bg-primary); }

.rp-equipo {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding-left: 32px;
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.25;
}

.rp-equipo svg {
    width: 14px;
    height: 14px;
    margin-top: 2px;
    flex-shrink: 0;
    color: var(--text-muted);
}

.rp-equipo small {
    display: block;
    font-size: 0.68rem;
    color: var(--text-muted);
}

.rp-celda { cursor: pointer; }

.rp-celda .rp-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 30px;
    height: 26px;
    padding: 0 8px;
    border-radius: 8px;
    font-weight: 700;
    color: var(--text-primary);
    background: rgba(79, 70, 229, var(--a, 0.15));
    transition: var(--transition);
}

.rp-celda:hover .rp-num {
    transform: scale(1.1);
    box-shadow: 0 0 0 2px var(--primary-light);
}

.rp-celda .rp-puntos {
    display: flex;
    justify-content: center;
    gap: 3px;
    margin-top: 4px;
    height: 6px;
}

.rp-celda .rp-puntos i {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    display: block;
}

.rp-celda .rp-mas {
    font-size: 0.6rem;
    line-height: 6px;
    color: var(--text-muted);
}

.rp-celda.vacia {
    color: var(--text-muted);
    opacity: 0.35;
    cursor: default;
}

.rp-total {
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: flex-end;
    font-weight: 800;
}

.rp-barra {
    width: 50px;
    height: 6px;
    border-radius: 999px;
    background: var(--border-color);
    overflow: hidden;
}

.rp-barra span {
    display: block;
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--accent), var(--primary));
}

.rp-matriz tr.fila-total td {
    background: var(--bg-primary);
    font-weight: 800;
    border-bottom: none;
}

/* Detalle de cambios de una celda */
#modal-repuestos-detalle .rp-table td.col-equipo {
    white-space: normal;
    min-width: 220px;
}

/* Código de cartucho en el pedido sugerido */
.rp-codigo {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 1px solid var(--border-color);
    background: var(--bg-primary);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.84rem;
    padding: 4px 10px;
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition);
}

.rp-codigo b { letter-spacing: 0.3px; }

.rp-codigo svg {
    width: 13px;
    height: 13px;
    color: var(--text-muted);
}

.rp-codigo:hover {
    border-color: var(--primary-light);
    color: var(--primary);
}

[data-theme="dark"] .rp-codigo:hover { color: var(--primary-light); }

.rp-codigo.vacio {
    border-style: dashed;
    color: var(--text-muted);
    font-weight: 600;
}

.rp-codigo-desc {
    display: block;
    margin-top: 4px;
    font-size: 0.72rem;
    color: var(--text-muted);
    max-width: 220px;
    white-space: normal;
}

.rp-table tr.rp-fila-total td {
    font-weight: 800;
    border-top: 1px dashed var(--border-color);
    border-bottom: none;
    background: transparent;
}

/* Repuesto + impresoras en una sola celda del pedido */
.rp-repuesto {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    min-width: 180px;
}

.rp-repuesto .rp-dot { margin-top: 5px; }

.rp-repuesto small {
    display: block;
    font-size: 0.74rem;
    color: var(--text-muted);
    line-height: 1.3;
}

