/* Grid de cabecera y filas de ingredientes */
.ingr-headers {
    display: grid;
    grid-template-columns: 1.4fr 80px 60px 110px 90px 80px 36px;
    gap: 0.4rem;
    margin-bottom: 0.4rem;
}

.ingr-headers span {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-muted, #9ca3af);
    padding-left: 2px;
}

.ingr-row {
    display: grid;
    grid-template-columns: 1.4fr 80px 60px 110px 90px 80px 36px;
    gap: 0.4rem;
    align-items: center;
    margin-bottom: 0.45rem;
}

@media (max-width: 640px) {

    .ingr-headers,
    .ingr-row {
        grid-template-columns: 1fr 70px 55px 90px 75px 65px 30px;
    }
}

@media (max-width: 480px) {
    .ingr-headers {
        display: none;
    }

    .ingr-row {
        grid-template-columns: 1fr 1fr;
        gap: 0.35rem;
        padding: 0.5rem;
        background: var(--color-bg-subtle, #f9fafb);
        border-radius: 8px;
        margin-bottom: 0.6rem;
    }

    .ingr-row .ingr-nombre {
        grid-column: 1 / -1;
    }

    .ingr-del {
        grid-column: 2;
        justify-self: end;
    }
}

.ingr-input {
    width: 100%;
    padding: 0.45rem 0.55rem;
    border: 1.5px solid var(--color-border, #e5e7eb);
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.88rem;
    background: var(--color-bg, #fff);
    color: var(--color-text, #111827);
    transition: border-color .18s;
    box-sizing: border-box;
}

.ingr-input:focus {
    border-color: #2563eb;
    outline: none;
}

.ingr-input.num {
    text-align: right;
    -moz-appearance: textfield;
}

.ingr-input.num::-webkit-inner-spin-button {
    -webkit-appearance: none;
}

.ingr-del {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    border: 1.5px solid #fca5a5;
    background: transparent;
    color: #ef4444;
    cursor: pointer;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all .18s;
    flex-shrink: 0;
}

.ingr-del:hover {
    background: #fef2f2;
}

.btn-add {
    margin-top: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    border: 1.5px dashed var(--color-border, #d1d5db);
    background: transparent;
    font-family: inherit;
    font-size: 0.88rem;
    font-weight: 600;
    color: #2563eb;
    cursor: pointer;
    transition: all .18s;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.btn-add:hover {
    border-color: #2563eb;
    background: #eff6ff;
}

.input-suffix {
    padding: 0 0.65rem;
    font-weight: 600;
    color: var(--color-text-muted, #6b7280);
    font-size: 0.88rem;
    display: flex;
    align-items: center;
    white-space: nowrap;
}

/* Barra de costes multicolor */
.coste-seg {
    height: 100%;
    transition: width .4s;
    position: relative;
}

.coste-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 4px;
    flex-shrink: 0;
}

.leyenda-item {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.78rem;
    color: var(--color-text-muted, #6b7280);
    margin-right: 10px;
    margin-bottom: 4px;
}

/* Desglose por ingrediente (cards) */
.desglose-cards {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.desglose-card {
    display: grid;
    grid-template-columns: auto 1fr auto auto auto;
    align-items: center;
    gap: 0.4rem 0.75rem;
    padding: 0.6rem 0.9rem;
    border-radius: 8px;
    background: var(--color-bg-subtle, #f9fafb);
    border: 1.5px solid var(--color-border, #e5e7eb);
    font-size: 0.88rem;
}

.desglose-card__dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.desglose-card__nombre {
    font-weight: 600;
    color: var(--color-text, #111827);
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.desglose-card__cant {
    font-size: 0.82rem;
    color: var(--color-text-muted, #6b7280);
    white-space: nowrap;
}

.desglose-card__coste {
    font-weight: 700;
    color: #2563eb;
    white-space: nowrap;
}

.desglose-card__pct {
    font-size: 0.82rem;
    color: var(--color-text-muted, #6b7280);
    white-space: nowrap;
    min-width: 42px;
    text-align: right;
}

/* Footer del desglose */
.desglose-footer {
    margin-top: 0.5rem;
    padding: 0.65rem 0.9rem;
    border-radius: 8px;
    border: 1.5px solid var(--color-border, #e5e7eb);
    background: var(--color-bg, #fff);
    font-size: 0.88rem;
}

.desglose-footer-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.15rem 0;
    color: var(--color-text-muted, #6b7280);
}

.desglose-footer-row.total {
    font-weight: 700;
    color: var(--color-text, #111827);
    font-size: 0.95rem;
    border-top: 1.5px solid var(--color-border, #e5e7eb);
    margin-top: 0.35rem;
    padding-top: 0.5rem;
}

.desglose-footer-row .val {
    font-weight: 600;
    color: #2563eb;
}

.desglose-footer-row.total .val {
    font-size: 1rem;
}