/* Páginas del módulo Costos (Packing / Materia prima) — optimizado móvil */
:root {
    --logo-orange: #EA580C;
    --logo-teal: #0D9488;
    --logo-teal-light: #ccfbf1;
    --logo-teal-dark: #0f766e;
    --logo-dark: #1F2937;
    --border: #e2e8f0;
    --surface: #ffffff;
    --muted: #64748b;
    --muted-light: #94a3b8;
    --safe-top: env(safe-area-inset-top, 0);
    --safe-right: env(safe-area-inset-right, 0);
    --safe-bottom: env(safe-area-inset-bottom, 0);
    --safe-left: env(safe-area-inset-left, 0);
}

* { box-sizing: border-box; }

html {
    -webkit-text-size-adjust: 100%;
}

body.costos-page {
    margin: 0;
    font-family: 'Inter', system-ui, sans-serif;
    background: linear-gradient(160deg, #f0fdfa 0%, #f8fafc 50%, #f1f5f9 100%);
    color: var(--logo-dark);
    min-height: 100vh;
    min-height: calc(100vh - var(--safe-top) - var(--safe-bottom));
    padding: 24px 20px 40px;
    padding-left: max(20px, calc(20px + var(--safe-left)));
    padding-right: max(20px, calc(20px + var(--safe-right)));
    padding-bottom: max(40px, calc(40px + var(--safe-bottom)));
    line-height: 1.5;
    -webkit-tap-highlight-color: rgba(13, 148, 136, 0.15);
}

.costos-back {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--logo-teal);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 28px;
    padding: 6px 0;
    border-radius: 6px;
    transition: color 0.2s, background 0.2s;
}
.costos-back:hover {
    color: var(--logo-teal-dark);
    background: var(--logo-teal-light);
    text-decoration: none;
}
.costos-back-arrow { font-size: 1.1rem; }

/* Navegación rápida entre módulos */
.costos-nav {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 12px;
    margin-bottom: 20px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}
.costos-nav-link {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--logo-teal);
    text-decoration: none;
    padding: 6px 12px;
    border-radius: 8px;
    transition: background 0.2s, color 0.2s;
    -webkit-tap-highlight-color: transparent;
}
.costos-nav-link:hover {
    background: var(--logo-teal-light);
    color: var(--logo-teal-dark);
    text-decoration: none;
}
.costos-nav-link.is-active {
    background: var(--logo-teal);
    color: #fff;
}
@media (max-width: 480px) {
    .costos-nav { gap: 6px 10px; margin-bottom: 16px; padding: 8px 0; }
    .costos-nav-link { font-size: 0.8125rem; padding: 8px 10px; min-height: 44px; display: inline-flex; align-items: center; }
}

.costos-main {
    max-width: 720px;
    margin: 0 auto;
}

.costos-title-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 12px;
}
.costos-title-row .costos-calc-btn {
    margin-left: auto;
}
.costos-title {
    font-family: 'DM Serif Display', Georgia, serif;
    font-size: 2.25rem;
    font-weight: 400;
    color: var(--logo-dark);
    margin: 0;
    letter-spacing: -0.02em;
}
.costos-title--con-icono {
    display: inline-flex;
    align-items: center;
    gap: 12px;
}
.costos-title-icono {
    font-size: 1.5rem;
    color: var(--logo-teal);
    opacity: 0.9;
}
.costos-title--con-icono .costos-title-icono.fa-eye {
    color: var(--logo-teal-dark);
}
.costos-title--con-icono .costos-title-icono.fa-pen {
    color: var(--logo-orange);
}
.costos-calc-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--logo-teal-dark);
    background: var(--logo-teal-light);
    border: 1px solid var(--logo-teal);
    border-radius: 10px;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.2s, color 0.2s;
}
.costos-calc-btn-text-short {
    display: none;
}
.costos-calc-btn:hover {
    background: var(--logo-teal);
    color: #fff;
}
.costos-calc-btn[aria-expanded="true"] {
    background: var(--logo-teal);
    color: #fff;
}
.costos-btn-nueva {
    background: var(--logo-orange);
    color: #fff;
    text-decoration: none;
}
.costos-btn-nueva:hover {
    background: var(--logo-orange-dark, #c2410c);
    color: #fff;
}
.costos-btn-nueva.costos-btn-loading {
    pointer-events: none;
    opacity: 0.9;
}
.costos-calc-panel {
    margin-bottom: 24px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.06);
    overflow: hidden;
}
.costos-calc-inner {
    padding: 20px;
}
.costos-calc-block {
    margin-bottom: 20px;
}
.costos-calc-block:last-of-type {
    margin-bottom: 0;
}
.costos-calc-datos {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}
.costos-calc-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.costos-calc-destino {
    padding-top: 16px;
    border-top: 1px solid var(--border);
}
.costos-calc-resultado-block {
    padding-top: 16px;
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.costos-calc-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--logo-dark);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.costos-calc-input {
    width: 100%;
    padding: 12px 14px;
    font-size: 1rem;
    border: 1px solid var(--border);
    border-radius: 10px;
    font-family: inherit;
}
.costos-calc-input:focus {
    outline: none;
    border-color: var(--logo-teal);
    box-shadow: 0 0 0 2px rgba(13, 148, 136, 0.2);
}
.costos-calc-select {
    width: 100%;
    padding: 12px 14px;
    font-size: 1rem;
    border: 1px solid var(--border);
    border-radius: 10px;
    font-family: inherit;
    background: var(--surface);
}
.costos-calc-select:focus {
    outline: none;
    border-color: var(--logo-teal);
}
.costos-calc-resultado {
    display: block;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--logo-teal-dark);
    min-height: 1.5em;
    line-height: 1.4;
}
.costos-calc-note {
    margin: 16px 0 0;
    font-size: 0.75rem;
    color: var(--muted-light);
    font-style: italic;
}

/* Bloque leyenda + botón antes del formulario (ej. Nuevo detalle receta — Seleccionar Insumo) */
.costos-edit-leyenda-insumo {
    margin-bottom: 1.25rem;
    text-align: center;
}
.costos-edit-leyenda-insumo .costos-edit-leyenda-titulo-receta {
    font-weight: 700;
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
    color: var(--text, #1a1a2e);
}
.costos-edit-leyenda-insumo .costos-edit-leyenda-texto {
    margin-bottom: 0.75rem;
}
.costos-edit-leyenda-insumo .costos-calc-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

/* Página Editar materia prima — formulario con datos del registro */
.costos-edit-form {
    background: var(--surface);
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.06);
    border: 1px solid var(--border);
    max-width: 560px;
}

/* Mensajes de error o restricciones en formularios (sin alert nativo) */
.costos-alert {
    display: none;
    padding: 12px 16px;
    border-radius: 10px;
    margin-bottom: 16px;
    font-size: 0.9rem;
    line-height: 1.45;
    max-width: 560px;
}
.costos-alert.is-visible {
    display: block;
}
.costos-alert--error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #b91c1c;
}
.costos-alert--success {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #15803d;
}

.costos-edit-field {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    margin-bottom: 14px;
}
.costos-edit-field:last-of-type {
    margin-bottom: 0;
}
.costos-edit-formula-leyenda {
    font-size: 0.8rem;
    color: var(--text-muted, #64748b);
    margin: 4px 0 0 0;
    line-height: 1.35;
}
.costos-edit-seccion-titulo {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--logo-dark);
    margin: 0 0 12px 0;
    padding-bottom: 8px;
    border-bottom: 2px solid rgba(234, 88, 12, 0.25);
    letter-spacing: 0.02em;
}
.costos-edit-seccion-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}
.costos-edit-seccion-header .costos-edit-seccion-titulo {
    margin: 0;
    padding-bottom: 0;
    border-bottom: none;
}
.costos-edit-btn-agregar-item {
    flex-shrink: 0;
}
.costos-edit-seccion-presentacion-equivalencia {
    margin: 14px 0 20px 0;
    padding: 16px 18px;
    background: rgba(234, 88, 12, 0.04);
    border: 1px solid rgba(234, 88, 12, 0.2);
    border-radius: 12px;
}
.costos-edit-seccion-presentacion-equivalencia .costos-edit-seccion-titulo {
    border-bottom-color: rgba(234, 88, 12, 0.35);
}
.costos-edit-seccion-presentacion-equivalencia .costos-edit-field-presentacion {
    margin-bottom: 16px;
}
.costos-edit-seccion-presentacion-equivalencia .costos-edit-section-equivalencia {
    margin-top: 4px;
    margin-bottom: 0;
}
.costos-edit-seccion-precios-costo {
    margin: 18px 0 22px 0;
    padding: 16px 18px;
    background: rgba(13, 148, 136, 0.05);
    border: 1px solid rgba(13, 148, 136, 0.22);
    border-radius: 12px;
}
.costos-edit-seccion-precios-costo .costos-edit-seccion-titulo {
    border-bottom: 2px solid rgba(13, 148, 136, 0.35);
    color: var(--logo-dark);
}
.costos-edit-seccion-precios-costo .costos-edit-field {
    margin-bottom: 12px;
}
.costos-edit-seccion-precios-costo .costos-edit-field:last-child {
    margin-bottom: 0;
}
.costos-edit-seccion-precios-costo .costos-edit-field-informativo .costos-edit-value {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--logo-dark);
}
.costos-edit-seccion {
    margin-top: 28px;
    padding-top: 20px;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
}
.costos-tabla-elaboracion-vinculada .costos-tabla {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}
.costos-tabla-elaboracion-vinculada .costos-tabla th,
.costos-tabla-elaboracion-vinculada .costos-tabla td {
    padding: 10px 12px;
    text-align: left;
    border: 1px solid rgba(0, 0, 0, 0.1);
}
.costos-tabla-elaboracion-vinculada .costos-tabla th {
    background: rgba(234, 88, 12, 0.08);
    font-weight: 600;
    color: var(--logo-dark);
}
.costos-tabla-elaboracion-vinculada .costos-tabla tbody tr:nth-child(even) {
    background: rgba(0, 0, 0, 0.02);
}
.costos-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
.costos-edit-section-equivalencia {
    background: rgba(234, 88, 12, 0.05);
    border-left: 3px solid rgba(234, 88, 12, 0.3);
    border-radius: 0 10px 10px 0;
    padding: 14px 16px 14px 18px;
    margin: 12px 0 18px 0;
}
.costos-edit-section-equivalencia .costos-edit-field {
    margin-bottom: 12px;
}
.costos-edit-section-equivalencia .costos-edit-field:last-child {
    margin-bottom: 0;
}
/* Bloque informativo: Equivalencia + Convertido a (solo lectura) */
.costos-edit-section-equivalencia .costos-edit-field-informativo {
    margin-bottom: 0;
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(234, 88, 12, 0.12);
}
.costos-edit-section-equivalencia .costos-edit-field-informativo:first-of-type {
    border-radius: 8px 8px 0 0;
    padding-bottom: 8px;
}
.costos-edit-section-equivalencia .costos-edit-field-informativo:last-of-type {
    border-radius: 0 0 8px 8px;
    margin-bottom: 14px;
    padding-top: 8px;
    border-top: 1px solid rgba(234, 88, 12, 0.08);
}
.costos-edit-section-equivalencia .costos-edit-field-informativo:only-of-type {
    border-radius: 8px;
    padding: 10px 14px;
    margin-bottom: 14px;
}
.costos-edit-section-equivalencia .costos-edit-field-informativo .costos-edit-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--muted);
}
.costos-edit-section-equivalencia .costos-edit-field-informativo .costos-edit-label-desc {
    font-size: 0.65rem;
    font-style: normal;
    color: var(--muted);
}
.costos-edit-section-equivalencia .costos-edit-field-informativo .costos-edit-value {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--logo-dark);
}
.costos-edit-section-equivalencia .costos-edit-field-informativo .costos-edit-value-cell {
    min-height: 1.5rem;
    padding: 2px 0;
}
.costos-edit-equivalencia-from-table {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: #f0fdfa;
    border: 1px solid var(--logo-teal);
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    color: var(--logo-dark);
}
.costos-edit-equivalencia-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--logo-teal);
    font-size: 1.1rem;
}
.costos-edit-equivalencia-icon i {
    font-size: inherit;
}
.costos-edit-value-equivalencia-display {
    font-weight: 600;
    color: var(--logo-dark);
}
/* Convertido a (valor de tabla EQUIVALENCIAS, solo lectura) */
.costos-edit-convertido-from-table {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: #f0fdfa;
    border: 1px solid var(--logo-teal);
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    color: var(--logo-dark);
}
.costos-edit-convertido-from-table .costos-edit-equivalencia-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--logo-teal);
    font-size: 1.1rem;
}
.costos-edit-value-convertido-display {
    font-weight: 600;
    color: var(--logo-dark);
}
/* Convertir A (valor de tabla EQUIVALENCIAS, columna Convertir-UnidadMedida, solo lectura) */
.costos-edit-convertir-from-table {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: #f0fdfa;
    border: 1px solid var(--logo-teal);
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    color: var(--logo-dark);
}
.costos-edit-convertir-from-table .costos-edit-equivalencia-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--logo-teal);
    font-size: 1.1rem;
}
.costos-edit-value-convertir-display {
    font-weight: 600;
    color: var(--logo-dark);
}
.costos-edit-field.is-textarea {
    flex-direction: column;
    align-items: stretch;
}
.costos-edit-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px 6px;
}
.costos-edit-label-main {
    font-size: inherit;
    font-weight: inherit;
    color: inherit;
    text-transform: inherit;
    letter-spacing: inherit;
}
.costos-edit-label-desc {
    font-size: 0.7rem;
    font-weight: 400;
    text-transform: none;
    letter-spacing: 0;
    color: var(--muted-light);
    font-style: italic;
}
.costos-edit-calc-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--logo-teal);
    font-size: 0.7rem;
}
.costos-edit-calc-icon i {
    font-size: inherit;
}
.costos-edit-calc-icon:hover {
    color: var(--logo-teal-dark);
}
.costos-edit-value-cell {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.costos-edit-value {
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--logo-dark);
    word-break: break-word;
}
.costos-edit-value-edit-btn,
.costos-edit-value-close-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    min-width: 28px;
    min-height: 28px;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: #f8fafc;
    color: var(--muted);
    font-size: 0.75rem;
    cursor: pointer;
    transition: background 0.2s, color 0.2s, border-color 0.2s;
}
.costos-edit-value-edit-btn:hover,
.costos-edit-value-close-btn:hover {
    background: #fff7ed;
    color: var(--logo-orange);
    border-color: #fed7aa;
}
.costos-edit-value-edit-btn:focus-visible,
.costos-edit-value-close-btn:focus-visible {
    outline: 2px solid var(--logo-teal);
    outline-offset: 2px;
}
.costos-edit-input-dynamic {
    flex: 1;
    min-width: 120px;
}
.costos-edit-field-presentacion .costos-edit-value-presentacion {
    font-weight: 600;
    color: var(--logo-dark);
}
.costos-edit-presentacion-inputs-inline {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 16px;
}
.costos-edit-presentacion-inputs-inline .costos-edit-presentacion-label {
    margin: 0;
}
.costos-edit-presentacion-inputs-inline .costos-edit-input {
    min-width: 80px;
    max-width: 120px;
}
.costos-edit-presentacion-inputs-inline .costos-edit-select-presentacion {
    min-width: 140px;
}
.costos-edit-presentacion-inputs {
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: center;
    gap: 8px 12px;
    margin-top: 10px;
    padding: 12px;
    padding-top: 8px;
    background: #f8fafc;
    border-radius: 8px;
    border: 1px solid var(--border);
}
.costos-edit-presentacion-close-row {
    grid-column: 1 / -1;
    display: flex;
    justify-content: flex-end;
    margin-bottom: 4px;
}
.costos-edit-presentacion-close-row .costos-edit-value-close-btn {
    margin-left: auto;
}
.costos-edit-presentacion-leyenda-wrap {
    grid-column: 1 / -1;
    padding: 8px 10px;
    margin-bottom: 4px;
    background: #fff;
    border: 1px dashed var(--border);
    border-radius: 6px;
    font-size: 0.9rem;
}
.costos-edit-presentacion-leyenda-label {
    color: var(--muted);
    font-weight: 600;
    margin-right: 6px;
}
.costos-edit-presentacion-leyenda-value {
    color: var(--logo-dark);
    font-weight: 500;
}
.costos-edit-presentacion-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--muted);
}
.costos-edit-presentacion-inputs .costos-edit-input {
    min-width: 0;
}
.costos-edit-presentacion-combo {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    min-width: 0;
}
.costos-edit-presentacion-combo .costos-edit-select-presentacion {
    flex: 1;
    min-width: 120px;
    padding: 8px 10px;
    font-size: 1rem;
    border: 2px solid var(--logo-orange);
    border-radius: 8px;
    font-family: inherit;
    background: #fff;
}
.costos-edit-presentacion-combo .costos-edit-select-presentacion:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(234, 88, 12, 0.2);
}
.costos-edit-presentacion-combo .costos-edit-input-otra-presentacion {
    flex: 1;
    min-width: 120px;
    padding: 8px 10px;
    border: 2px solid var(--logo-orange);
    border-radius: 8px;
}
.costos-edit-field.is-editable .costos-edit-value {
    display: none;
}
.costos-edit-field.is-editable .costos-edit-input {
    width: 100%;
}
.costos-edit-input {
    width: 100%;
    padding: 10px 12px;
    font-size: 1rem;
    border: 2px solid var(--logo-orange);
    border-radius: 8px;
    font-family: inherit;
}
.costos-edit-input:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(234, 88, 12, 0.2);
}
.costos-edit-readonly {
    display: inline-block;
    background: var(--surface, #f1f5f9);
    border: 1px solid var(--border, #e2e8f0);
    color: var(--muted, #64748b);
    cursor: default;
}
.costos-edit-categoria-wrap {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 120px;
}
.costos-edit-categoria-wrap .costos-edit-select-categoria {
    flex: 1;
    min-width: 140px;
    padding: 10px 12px;
    font-size: 1rem;
    border: 2px solid var(--logo-orange);
    border-radius: 8px;
    font-family: inherit;
    background: #fff;
}
.costos-edit-categoria-wrap .costos-edit-select-categoria:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(234, 88, 12, 0.2);
}
.costos-edit-categoria-wrap .costos-edit-input-otra-categoria {
    flex: 1;
    min-width: 140px;
    padding: 10px 12px;
    font-size: 1rem;
    border: 2px solid var(--logo-orange);
    border-radius: 8px;
}
.costos-edit-marca-wrap,
.costos-edit-lugar-wrap {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 120px;
}
.costos-edit-marca-wrap .costos-edit-select-marca,
.costos-edit-lugar-wrap .costos-edit-select-lugar {
    flex: 1;
    min-width: 140px;
    padding: 10px 12px;
    font-size: 1rem;
    border: 2px solid var(--logo-orange);
    border-radius: 8px;
    font-family: inherit;
    background: #fff;
}
.costos-edit-marca-wrap .costos-edit-select-marca:focus,
.costos-edit-lugar-wrap .costos-edit-select-lugar:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(234, 88, 12, 0.2);
}
.costos-edit-marca-wrap .costos-edit-input-otra-marca,
.costos-edit-lugar-wrap .costos-edit-input-otra-lugar {
    flex: 1;
    min-width: 140px;
    padding: 10px 12px;
    font-size: 1rem;
    border: 2px solid var(--logo-orange);
    border-radius: 8px;
}
.costos-edit-tipo-unidad-medida-wrap {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 120px;
}
.costos-edit-tipo-unidad-medida-wrap .costos-edit-select-tipo-unidad-medida {
    flex: 1;
    min-width: 140px;
    padding: 10px 12px;
    font-size: 1rem;
    border: 2px solid var(--logo-orange);
    border-radius: 8px;
    font-family: inherit;
    background: #fff;
}
.costos-edit-tipo-unidad-medida-wrap .costos-edit-select-tipo-unidad-medida:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(234, 88, 12, 0.2);
}
.costos-edit-tipo-unidad-medida-wrap .costos-edit-input-otra-tipo-unidad-medida {
    flex: 1;
    min-width: 140px;
    padding: 10px 12px;
    font-size: 1rem;
    border: 2px solid var(--logo-orange);
    border-radius: 8px;
}
.costos-edit-textarea {
    min-height: 100px;
    resize: vertical;
    font-family: inherit;
    line-height: 1.4;
}
.costos-edit-field.is-textarea .costos-edit-value {
    display: none;
}
.costos-edit-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}
.costos-edit-actions--final {
    margin-top: 24px;
}
.costos-edit-cabecera {
    margin-bottom: 20px;
    padding: 16px 18px;
    background: rgba(13, 148, 136, 0.05);
    border: 1px solid rgba(13, 148, 136, 0.22);
    border-radius: 12px;
}
.costos-edit-cabecera .costos-edit-seccion-titulo {
    border-bottom: 2px solid rgba(13, 148, 136, 0.35);
    color: var(--logo-dark);
    margin-bottom: 12px;
}
.costos-edit-cabecera-content {
    display: flex;
    flex-wrap: wrap;
    gap: 12px 24px;
}
.costos-edit-cabecera-row {
    font-size: 0.9rem;
}
.costos-edit-cabecera-label {
    font-weight: 600;
    color: var(--muted);
    margin-right: 4px;
}
.costos-edit-cabecera-value {
    color: var(--logo-dark);
    font-weight: 500;
}
.costos-ver-detalle {
    margin-bottom: 20px;
}
.costos-ver-sin-costo {
    margin-top: 16px;
}
.costos-ver-sin-costo .costos-ver-btn-crear-costo {
    text-decoration: none;
}
.costos-ver-asignar-label {
    font-weight: 600;
    color: var(--logo-dark);
    margin: 0 0 8px 0;
}
.costos-ver-asignar-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}
.costos-ver-combo {
    min-width: 200px;
    max-width: 100%;
    padding: 8px 12px;
    font-size: 1rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #fff;
    color: var(--logo-dark);
}
.costos-ver-asignar-msg {
    margin: 8px 0 0 0;
    font-size: 0.9rem;
    color: var(--muted);
}
.costos-ver-asignar-msg-error {
    color: #c2410c;
}
.costos-asignar-banner {
    margin-bottom: 16px;
    padding: 12px 16px;
    background: rgba(0, 120, 130, 0.1);
    border: 1px solid var(--logo-teal);
    border-radius: 10px;
    color: var(--logo-dark);
    font-size: 0.95rem;
}
.costos-asignar-banner a.costos-asignar-banner-back {
    margin-left: 10px;
    color: var(--logo-teal);
    font-weight: 600;
}
.costos-asignar-banner a.costos-asignar-banner-back:hover {
    text-decoration: underline;
}
.costos-card-btn-vincular {
    background: linear-gradient(180deg, var(--logo-teal) 0%, #006d75 100%);
    color: #fff;
    border: none;
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.costos-card-btn-vincular:hover {
    opacity: 0.95;
}
.costos-ver-relacionado {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}
.costos-ver-relacion-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    margin-top: 16px;
    margin-bottom: 8px;
}
.costos-ver-btn-relacion {
    text-decoration: none;
}
.costos-ver-subtitulo {
    font-family: 'DM Serif Display', Georgia, serif;
    font-size: 1.25rem;
    color: var(--logo-dark);
    margin: 0 0 12px 0;
}
.costos-ver-dl {
    display: grid;
    grid-template-columns: minmax(140px, auto) 1fr;
    gap: 8px 24px;
    margin: 0;
}
.costos-ver-dt {
    font-weight: 600;
    color: var(--logo-dark);
    margin: 0;
}
.costos-ver-dd {
    margin: 0;
    color: var(--muted);
}
.costos-ver-seccion-titulo {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 12px;
}
.costos-ver-seccion-titulo .costos-ver-subtitulo {
    margin: 0;
}
.costos-ver-seccion-actions {
    margin-top: 1rem;
}
.costos-edit-btn-save {
    background: linear-gradient(180deg, var(--logo-orange) 0%, #c2410c 100%);
    color: #fff;
    border: none;
    padding: 10px 20px;
    font-size: 0.9rem;
    font-weight: 700;
    border-radius: 10px;
    cursor: pointer;
    font-family: inherit;
}
.costos-edit-btn-save:hover {
    opacity: 0.95;
}
.costos-edit-btn-save:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}
/* Enlaces y botones deshabilitados mientras se cargan datos o se realizan operaciones */
.costos-btn-disabled,
a.costos-btn-disabled {
    opacity: 0.6;
    cursor: not-allowed;
    pointer-events: none;
}
.costos-edit-btn-editar {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-right: 0;
    padding: 10px 20px;
    font-size: 0.9rem;
    font-weight: 700;
    border-radius: 10px;
    text-decoration: none;
    background: var(--logo-teal);
    color: #fff;
    border: none;
    cursor: pointer;
    font-family: inherit;
}
.costos-edit-btn-editar:hover {
    background: var(--logo-teal-dark);
    color: #fff;
    text-decoration: none;
    opacity: 0.95;
}
.costos-edit-btn-cancel {
    display: inline-block;
    margin-right: 12px;
    color: #059669;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
}
.costos-edit-btn-cancel:hover {
    text-decoration: underline;
}
.costos-edit-btn-seleccionar-masa {
    display: block;
    margin-top: 10px;
    padding: 10px 18px;
    font-size: 0.9rem;
    font-weight: 600;
    border-radius: 10px;
    background: var(--logo-teal);
    color: #fff;
    border: none;
    cursor: pointer;
    font-family: inherit;
}
.costos-edit-btn-seleccionar-masa:hover {
    background: var(--logo-teal-dark);
    color: #fff;
    opacity: 0.95;
}
.costos-edit-actions--ver-costo {
    margin-bottom: 1rem;
}
.costos-edit-btn-ver-costo {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    font-size: 0.9rem;
    font-weight: 700;
    border-radius: 10px;
    text-decoration: none;
    background: var(--logo-teal);
    color: #fff;
    border: none;
    cursor: pointer;
    font-family: inherit;
}
.costos-edit-btn-ver-costo:hover {
    background: var(--logo-teal-dark);
    color: #fff;
    text-decoration: none;
    opacity: 0.95;
}

/* Debug equivalencia (visible si config.costos.debugEquivalencia === true) */
.costos-debug-equivalencia {
    margin-top: 2rem;
    padding: 1rem 1.25rem;
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.85rem;
}
.costos-debug-title {
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--muted);
    margin: 0 0 0.75rem 0;
    letter-spacing: 0.02em;
}
.costos-debug-content {
    margin: 0;
    padding: 0.75rem 1rem;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-family: ui-monospace, 'Cascadia Code', 'Source Code Pro', Menlo, monospace;
    font-size: 0.8rem;
    line-height: 1.5;
    color: var(--logo-dark);
    white-space: pre-wrap;
    word-break: break-word;
    overflow-x: auto;
}
/* Colores identificatorios por variable: mismo color donde sea que aparezca la variable */
.costos-debug-content .costos-debug-var-c {
    color: #1d4ed8;
    font-weight: 700;
    background: rgba(29, 78, 216, 0.12);
    padding: 0.1em 0.35em;
    border-radius: 4px;
}
.costos-debug-content .costos-debug-var-fo {
    color: #047857;
    font-weight: 700;
    background: rgba(4, 120, 87, 0.12);
    padding: 0.1em 0.35em;
    border-radius: 4px;
}
.costos-debug-content .costos-debug-var-fd {
    color: #b45309;
    font-weight: 700;
    background: rgba(180, 83, 9, 0.12);
    padding: 0.1em 0.35em;
    border-radius: 4px;
}
.costos-debug-content .costos-debug-var-r {
    color: #6d28d9;
    font-weight: 700;
    background: rgba(109, 40, 217, 0.12);
    padding: 0.1em 0.35em;
    border-radius: 4px;
}
/* Debug precio/costo: Precio (P), Cantidad (C), Equivalencia (E), R1 (precio costo), R2 (precio equiv) */
.costos-debug-content .costos-debug-var-p {
    color: #0369a1;
    font-weight: 700;
    background: rgba(3, 105, 161, 0.12);
    padding: 0.1em 0.35em;
    border-radius: 4px;
}
.costos-debug-content .costos-debug-var-e {
    color: #0d9488;
    font-weight: 700;
    background: rgba(13, 148, 136, 0.12);
    padding: 0.1em 0.35em;
    border-radius: 4px;
}
.costos-debug-content .costos-debug-var-r1 {
    color: #b45309;
    font-weight: 700;
    background: rgba(180, 83, 9, 0.12);
    padding: 0.1em 0.35em;
    border-radius: 4px;
}
.costos-debug-content .costos-debug-var-r2 {
    color: #6d28d9;
    font-weight: 700;
    background: rgba(109, 40, 217, 0.12);
    padding: 0.1em 0.35em;
    border-radius: 4px;
}

/* Crear materia prima: ocultar botón Editar, botón Cerrar (X) y mostrar inputs directamente */
.costos-edit-value-edit-btn-hidden-in-create {
    display: none !important;
}
.costos-form-create .costos-edit-value-close-btn {
    display: none !important;
}

/* Leyenda cuando "Convertir A" no es de la misma categoría que la unidad origen */
.costos-edit-equivalencia-leyenda {
    margin: 0.5rem 0 0 0;
    padding: 0.5rem 0.75rem;
    font-size: 0.8rem;
    line-height: 1.35;
    color: #b45309;
    background: #fffbeb;
    border: 1px solid #f59e0b;
    border-radius: 6px;
    display: none;
}
.costos-edit-equivalencia-leyenda.costos-edit-equivalencia-leyenda-visible {
    display: block;
}

/* Página Editar — móvil: diseño y visibilidad */
@media (max-width: 768px) {
    .costos-edit-form {
        padding: 16px;
        max-width: 100%;
    }
    .costos-edit-field {
        margin-bottom: 16px;
    }
    .costos-edit-label {
        font-size: 0.72rem;
    }
    .costos-edit-value {
        font-size: 0.95rem;
    }
    .costos-edit-input {
        padding: 12px 14px;
        font-size: 16px;
        min-height: 44px;
    }
    .costos-edit-btn-save {
        min-height: 44px;
        padding: 12px 20px;
    }
}
@media (max-width: 480px) {
    #edit-form-container {
        width: 100%;
        max-width: 100%;
    }
    .costos-edit-form {
        padding: 14px 12px;
        border-radius: 12px;
        margin: 0 -2px;
    }
    .costos-edit-field {
        gap: 6px;
        margin-bottom: 18px;
    }
    .costos-edit-label {
        font-size: 0.7rem;
    }
    .costos-edit-value {
        font-size: 1rem;
        line-height: 1.4;
    }
    .costos-edit-input {
        min-height: 48px;
        padding: 14px 16px;
        font-size: 16px;
    }
    .costos-edit-textarea {
        min-height: 120px;
        padding: 14px 16px;
        font-size: 16px;
    }
    .costos-edit-actions {
        margin-top: 20px;
        padding-top: 16px;
    }
    .costos-edit-btn-save {
        width: 100%;
        min-height: 48px;
        font-size: 1rem;
        padding: 14px 20px;
        border-radius: 12px;
    }
    .costos-edit-value-edit-btn,
    .costos-edit-value-close-btn {
        min-width: 44px;
        min-height: 44px;
        width: 44px;
        height: 44px;
    }
    .costos-edit-presentacion-combo .costos-edit-select-presentacion,
    .costos-edit-categoria-wrap .costos-edit-select-categoria,
    .costos-edit-tipo-unidad-medida-wrap .costos-edit-select-tipo-unidad-medida {
        min-height: 44px;
    }
    .costos-main .costos-title {
        font-size: 1.5rem;
    }
    .costos-main .costos-intro {
        font-size: 0.9rem;
    }
}

/* Calculadora: móvil — orden segmentado y UX táctil */
@media (max-width: 768px) {
    .costos-calc-inner {
        padding: 16px;
    }
    .costos-calc-datos {
        grid-template-columns: 1fr;
        gap: 14px;
    }
    .costos-calc-block {
        margin-bottom: 18px;
    }
    .costos-calc-destino,
    .costos-calc-resultado-block {
        padding-top: 18px;
    }
    .costos-calc-input,
    .costos-calc-select {
        padding: 14px 16px;
        font-size: 16px;
        min-height: 48px;
    }
    .costos-calc-resultado {
        font-size: 1rem;
        padding: 12px 0;
    }
    .costos-calc-btn {
        font-size: 0.8rem;
        padding: 7px 11px;
    }
}
@media (max-width: 480px) {
    .costos-title-row { gap: 10px; align-items: center; }
    .costos-calc-btn {
        font-size: 0.75rem;
        padding: 10px 14px;
        min-height: 44px;
        gap: 6px;
    }
    .costos-calc-btn .costos-calc-btn-text-long { display: none; }
    .costos-calc-btn .costos-calc-btn-text-short { display: inline; }
    .costos-calc-btn i { font-size: 0.9rem; }
    .costos-calc-inner {
        padding: 14px;
    }
    .costos-calc-datos {
        gap: 12px;
    }
    .costos-calc-label {
        font-size: 0.75rem;
    }
    .costos-calc-input,
    .costos-calc-select {
        padding: 12px 14px;
        min-height: 44px;
    }
}

.costos-intro {
    color: var(--muted);
    line-height: 1.65;
    margin: 0 0 28px;
    font-size: 0.95rem;
}

.costos-filter-section {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
}
.costos-filter-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--logo-dark);
}
.costos-filter-input {
    flex: 1;
    max-width: 320px;
    padding: 10px 14px 10px 36px;
    font-size: 1rem;
    border: 1px solid var(--border);
    border-radius: 10px;
    font-family: inherit;
    background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%2394a3b8' viewBox='0 0 16 16'%3E%3Cpath d='M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001c.03.04.062.078.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1.007 1.007 0 0 0-.115-.1zM12 6.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0z'/%3E%3C/svg%3E") no-repeat 12px center;
}
.costos-filter-input:focus {
    outline: none;
    border-color: var(--logo-teal);
    box-shadow: 0 0 0 2px rgba(13, 148, 136, 0.2);
}
.costos-filter-input::placeholder {
    color: var(--muted-light);
}
.costos-filter-select {
    padding: 10px 32px 10px 12px;
    font-size: 0.9375rem;
    font-weight: 600;
    border: 1px solid var(--border);
    border-radius: 10px;
    font-family: inherit;
    background: var(--surface);
    color: var(--logo-dark);
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%2364748b' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    min-width: 180px;
}
.costos-filter-select:focus {
    outline: none;
    border-color: var(--logo-teal);
    box-shadow: 0 0 0 2px rgba(13, 148, 136, 0.2);
}
.costos-filter-label-dias {
    margin-left: 8px;
}
@media (max-width: 768px) {
    .costos-filter-label-dias { margin-left: 0; }
    .costos-filter-select { min-width: 160px; }
}
@media (max-width: 480px) {
    .costos-filter-select { width: 100%; max-width: 280px; min-width: 0; min-height: 44px; }
}
.costos-filter-count {
    margin: 0;
    font-size: 0.875rem;
    color: var(--muted);
    flex-basis: 100%;
}
.costos-filter-group-by {
    display: flex;
    align-items: center;
    gap: 8px;
}
.costos-filter-group-by .costos-filter-select {
    min-width: 200px;
}

/* Filtro y buscar en columna: filtro arriba, buscar debajo */
.costos-filter-section--stacked {
    flex-direction: column;
    align-items: flex-start;
    gap: 14px;
}
.costos-filter-section--stacked .costos-filter-count {
    flex-basis: auto;
}
.costos-filter-search {
    display: flex;
    align-items: center;
    gap: 8px;
}
.costos-filter-search .costos-filter-input {
    min-width: 280px;
}

/* Listado agrupado (Productos elaborados) */
.costos-listado-grupo {
    margin-bottom: 28px;
}
.costos-grupo-titulo {
    font-size: 1rem;
    font-weight: 700;
    color: var(--logo-teal-dark);
    margin: 0 0 12px;
    padding-bottom: 6px;
    border-bottom: 2px solid var(--logo-teal-light);
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 6px;
}
.costos-grupo-count {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--muted);
}
.costos-grupo-cards {
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}

.costos-placeholder {
    color: var(--muted-light);
    font-size: 0.9rem;
    font-style: italic;
}

.costos-datos {
    margin-top: 4px;
}
.costos-datos-message .costos-placeholder {
    margin: 0 0 8px;
}
.costos-placeholder-small {
    font-size: 0.8rem;
    margin-top: 4px;
}
.costos-loading {
    color: var(--muted);
    font-size: 0.9rem;
}

/* ——— Vista tarjetas (materia prima, estilo modelo11) ——— */
.costos-cards-wrap {
    width: 100%;
}
.costos-cat-title {
    font-size: 0.85rem;
    font-weight: 800;
    color: #9a3412;
    text-transform: uppercase;
    margin: 28px 0 12px;
    letter-spacing: 1.5px;
    border-left: 4px solid var(--logo-orange);
    padding-left: 10px;
}
.costos-cat-title:first-child {
    margin-top: 0;
}
.costos-card {
    background: var(--surface);
    border-radius: 20px;
    padding: 16px;
    margin-bottom: 12px;
    border: 1px solid #ffedd5;
    box-shadow: 0 4px 12px rgba(234, 88, 12, 0.06);
}
.costos-card-header {
    margin-bottom: 6px;
}
.costos-card-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--logo-dark);
}
.costos-card-meta {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin: 4px 0;
}
.costos-card-body {
    margin-top: 8px;
}
.costos-card-extra {
    list-style: disc;
    margin: 0 0 0 1.1em;
    padding: 0;
}
.costos-card-extra li {
    margin-bottom: 4px;
}
.costos-card-extra li:last-child {
    margin-bottom: 0;
}
.costos-card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}
.costos-card-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    font-size: 0.85rem;
    font-weight: 600;
    border-radius: 10px;
    text-decoration: none;
    transition: background 0.2s, color 0.2s;
}
.costos-card-btn-ver {
    background: var(--logo-teal-light);
    color: var(--logo-teal-dark);
}
.costos-card-btn-ver:hover {
    background: var(--logo-teal);
    color: #fff;
}
.costos-card-btn-editar {
    background: #ffedd5;
    color: var(--logo-orange);
}
.costos-card-btn-editar:hover {
    background: var(--logo-orange);
    color: #fff;
}
.costos-card-btn-seleccionar {
    background: var(--logo-teal);
    color: #fff;
}
.costos-card-btn-seleccionar:hover {
    background: #0d9488;
    color: #fff;
}
.costos-card-deshabilitado {
    opacity: 0.82;
    border-left: 3px solid #94a3b8;
    background: linear-gradient(to right, rgba(148, 163, 184, 0.06), var(--surface));
}
.costos-card-deshabilitado .costos-card-name {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.costos-card-deshabilitado-icon {
    display: inline-flex;
    align-items: center;
    color: #94a3b8;
    font-size: 0.95em;
    flex-shrink: 0;
}
.costos-card-main {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
}
.costos-card-left-wrap {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.costos-card-left {
    min-width: 0;
}
.costos-card-info {
    min-width: 0;
}
.costos-card-presentacion-row {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    width: 100%;
}
.costos-card-presentacion-row .costos-card-presentacion:empty,
.costos-card-presentacion-row .costos-card-old-price:empty {
    display: none;
}
.costos-card-presentacion-row .costos-card-old-price {
    margin-bottom: 0;
    flex-shrink: 0;
    text-align: right;
}
.costos-card-name {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--logo-dark);
    margin: 0 0 4px;
    line-height: 1.25;
}
.costos-card-presentacion {
    font-size: 0.8rem;
    color: #9a3412;
    opacity: 0.85;
    font-weight: 500;
}
.costos-card-price-side {
    text-align: right;
    min-width: 100px;
}
.costos-card-old-price {
    display: block;
    font-size: 0.7rem;
    color: var(--muted-light);
    text-decoration: line-through;
    margin-bottom: 2px;
}
.costos-card-price-row {
    display: block;
}
.costos-card-price-wrap {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.costos-card-price {
    font-size: 1.25rem;
    font-weight: 900;
    color: #000;
}
.costos-card-price .costos-trend-up {
    color: #b91c1c;
    font-size: 0.9em;
    margin-left: 2px;
}
.costos-card-price .costos-trend-down {
    color: #15803d;
    font-size: 0.9em;
    margin-left: 2px;
}
.costos-card-visualizar-precio-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    min-width: 28px;
    min-height: 28px;
    padding: 0;
    border: 1px solid #fed7aa;
    border-radius: 6px;
    background: #fff7ed;
    color: var(--logo-orange);
    font-size: 0.75rem;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
    flex-shrink: 0;
    text-decoration: none;
}
.costos-card-visualizar-precio-btn:hover {
    background: #ffedd5;
    color: var(--logo-dark);
}
.costos-card-visualizar-precio-btn:focus-visible {
    outline: 2px solid var(--logo-orange);
    outline-offset: 2px;
}
.costos-card-edit-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    min-width: 32px;
    min-height: 32px;
    border-radius: 8px;
    background: #fff7ed;
    border: 1px solid #fed7aa;
    color: var(--logo-orange);
    font-size: 0.85rem;
    transition: background 0.2s, color 0.2s;
    text-decoration: none;
}
.costos-card-edit-btn:hover {
    background: #ffedd5;
    color: var(--logo-dark);
}
.costos-card-edit-btn:focus-visible {
    outline: 2px solid var(--logo-orange);
    outline-offset: 2px;
}
.costos-card-days {
    display: block;
    font-size: 0.65rem;
    color: var(--muted);
    font-weight: 600;
    text-transform: uppercase;
    margin-top: 4px;
}
.costos-card-days.costos-dias-amarillo {
    background: linear-gradient(135deg, #fefce8 0%, #fef9c3 100%);
    color: #713f12;
    padding: 2px 6px;
    border-radius: 4px;
    display: inline-block;
    margin-top: 6px;
}
.costos-card-days.costos-dias-rojo {
    background: linear-gradient(135deg, #fef2f2 0%, #fecaca 100%);
    color: #7f1d1d;
    padding: 2px 6px;
    border-radius: 4px;
    display: inline-block;
    margin-top: 6px;
}
.costos-card-days.costos-dias-urgente {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
    color: #fff;
    padding: 2px 6px;
    border-radius: 4px;
    display: inline-block;
    margin-top: 6px;
}
.costos-expand-btn {
    background: #fff7ed;
    border: 1px solid #fed7aa;
    color: var(--logo-orange);
    font-size: 0.7rem;
    font-weight: 700;
    padding: 6px 12px;
    border-radius: 8px;
    margin-top: 12px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: 0.2s;
    font-family: inherit;
}
.costos-expand-btn:hover {
    background: #ffedd5;
}
.costos-expand-btn:active {
    transform: scale(0.98);
}
.costos-extra-info {
    display: none;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    background: #fffaf5;
    padding: 15px;
    border-radius: 12px;
    margin-top: 12px;
    font-size: 0.75rem;
    border: 1px dashed #fed7aa;
}
.costos-extra-info.costos-extra-show {
    display: grid;
    animation: costos-extra-fade 0.3s ease;
}
@keyframes costos-extra-fade {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}
.costos-extra-item {
    color: var(--muted);
}
.costos-extra-item b {
    display: block;
    color: var(--logo-dark);
    font-size: 0.8rem;
    margin-top: 2px;
}
.costos-extra-actions {
    grid-column: 1 / -1;
    margin-top: 8px;
    padding-top: 12px;
    border-top: 1px dashed #fed7aa;
}
.costos-extra-info .costos-card-edit-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 18px;
    min-width: 180px;
    min-height: 44px;
    white-space: nowrap;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--logo-teal-dark);
    background: var(--logo-teal-light);
    border: 1px solid var(--logo-teal);
    border-radius: 10px;
    text-decoration: none;
    transition: background 0.2s, color 0.2s;
    box-sizing: border-box;
}
.costos-extra-info .costos-card-edit-btn:hover {
    background: var(--logo-teal);
    color: #fff;
    text-decoration: none;
}
@media (max-width: 480px) {
    .costos-card-main {
        flex-direction: column;
        gap: 10px;
    }
    .costos-card-left-wrap {
        display: contents;
    }
    .costos-card-left {
        width: 100%;
        order: 0;
    }
    .costos-card-price-side {
        order: 1;
        text-align: right;
        width: 100%;
    }
    .costos-card-presentacion-row {
        order: 2;
        width: 100%;
    }
    .costos-card-info {
        width: 100%;
    }
    .costos-card-name {
        width: 100%;
        font-size: 1rem;
    }
    .costos-card-price-row {
        display: flex;
        flex-direction: row-reverse;
        justify-content: space-between;
        align-items: center;
        gap: 12px;
        margin-top: 8px;
        width: 100%;
    }
    .costos-card-presentacion-row .costos-card-presentacion {
        font-size: 0.75rem;
    }
    .costos-card-presentacion-row .costos-card-old-price {
        font-size: 0.65rem;
    }
    .costos-card-price-wrap {
        gap: 6px;
    }
    .costos-card-edit-btn {
        width: 44px;
        height: 44px;
        min-width: 44px;
        min-height: 44px;
        font-size: 0.9rem;
        justify-content: center;
        align-items: center;
    }
    .costos-card-price-row .costos-card-price {
        text-align: right;
        font-size: 1.1rem;
    }
    .costos-card-price-row .costos-card-days,
    .costos-card-days {
        font-size: 0.55rem;
        margin-top: 0;
        letter-spacing: 0.02em;
    }
    .costos-card-price-row .costos-card-days {
        text-align: left;
        flex-shrink: 0;
        max-width: 60%;
    }
    .costos-card-days.costos-dias-amarillo,
    .costos-card-days.costos-dias-rojo,
    .costos-card-days.costos-dias-urgente {
        padding: 2px 4px;
        font-size: 0.5rem;
    }
    .costos-expand-btn {
        font-size: 0.7rem;
        padding: 10px 14px;
        min-height: 44px;
        align-items: center;
    }
    .costos-extra-info {
        grid-template-columns: 1fr;
        font-size: 0.7rem;
        padding: 12px;
    }
}

.costos-table-wrap {
    width: 100%;
    border-radius: 12px;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.06), 0 2px 4px -2px rgba(0,0,0,0.04);
}

.costos-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
    background: var(--surface);
    border-radius: 12px;
    overflow: hidden;
}
.costos-table th,
.costos-table td {
    padding: 12px 14px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    transition: background 0.15s ease;
}
.costos-table th {
    background: linear-gradient(180deg, var(--logo-teal) 0%, var(--logo-teal-dark) 100%);
    color: #fff;
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* Nombre del producto: en línea completa y destacado (prioridad UX) */
.costos-table th.costos-cell-producto,
.costos-table td.costos-cell-producto {
    white-space: nowrap;
    min-width: 12em;
    font-weight: 600;
    color: var(--logo-dark);
}
.costos-table tbody tr:nth-child(even):not(.costos-table-categoria) {
    background: #fafbfc;
}
.costos-table tbody tr:last-child td {
    border-bottom: none;
}
.costos-table tbody tr:hover:not(.costos-table-categoria) td {
    background: #f1f5f9;
}
.costos-table tbody tr:nth-child(even):not(.costos-table-categoria):hover td {
    background: #e2e8f0;
}

/* Fila de agrupación por categoría */
.costos-table tr.costos-table-categoria td {
    background: linear-gradient(90deg, #ecfdf5 0%, #d1fae5 100%);
    color: #065f46;
    font-weight: 700;
    font-size: 0.95rem;
    padding: 14px 16px;
    border-bottom: 2px solid #a7f3d0;
    letter-spacing: 0.02em;
}
.costos-table tr.costos-table-categoria:hover td {
    background: linear-gradient(90deg, #d1fae5 0%, #a7f3d0 100%);
}

/* Cards lista insumos: meta (label-value) */
.insumos-card-meta {
    margin-top: 8px;
    font-size: 0.85rem;
    color: var(--text-muted, #64748b);
}
.insumos-card-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 4px;
}
.insumos-card-row:last-child {
    margin-bottom: 0;
}
.insumos-card-label {
    font-weight: 600;
    color: var(--text-muted, #64748b);
    min-width: 0;
}
.insumos-card-value {
    color: var(--text, #1e293b);
}

/* Leyenda concatenada por columnas (lista insumos) */
.insumos-card-leyenda {
    font-size: 0.85rem;
    color: var(--text-muted, #64748b);
    margin-top: 6px;
    line-height: 1.35;
}
.insumos-card-leyenda .insumos-leyenda-resaltado {
    font-weight: 700;
    color: var(--logo-orange, #ea580c);
    background: rgba(234, 88, 12, 0.08);
    padding: 1px 6px;
    border-radius: 4px;
}
.insumos-card-subleyenda {
    font-size: 0.8rem;
    color: var(--text-muted, #64748b);
    margin-top: 8px;
    margin-bottom: 4px;
    line-height: 1.3;
}
.insumos-card-subleyenda .insumos-leyenda-resaltado {
    font-weight: 700;
    color: var(--logo-orange, #ea580c);
    background: rgba(234, 88, 12, 0.08);
    padding: 1px 6px;
    border-radius: 4px;
}
.insumos-card-subleyenda .insumos-subleyenda-resaltado {
    font-weight: 700;
    color: var(--logo-teal, #0d9488);
    background: rgba(13, 148, 136, 0.12);
    padding: 1px 6px;
    border-radius: 4px;
}

/* Encabezado de grupo en listas (ej. Armador Insumos listGroupBy) */
.costos-table tr.insumos-group-header td {
    background: linear-gradient(90deg, #eff6ff 0%, #dbeafe 100%);
    color: #1e40af;
    font-weight: 700;
    font-size: 0.95rem;
    padding: 10px 16px;
    border-bottom: 1px solid #93c5fd;
    letter-spacing: 0.02em;
}
.costos-table tr.insumos-group-header:hover td {
    background: linear-gradient(90deg, #dbeafe 0%, #bfdbfe 100%);
}

/* Días transcurridos: badges sutiles por antigüedad */
.costos-table td.costos-dias-amarillo {
    background: linear-gradient(135deg, #fefce8 0%, #fef9c3 100%);
    color: #713f12;
    font-weight: 600;
    border-left: 3px solid #eab308;
}
.costos-table td.costos-dias-rojo {
    background: linear-gradient(135deg, #fef2f2 0%, #fecaca 100%);
    color: #7f1d1d;
    font-weight: 600;
    border-left: 3px solid #dc2626;
}
.costos-table td.costos-dias-urgente {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
    color: #fff;
    font-weight: 700;
    border-left: 4px solid #7f1d1d;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.15);
}
.costos-table tbody tr:hover td.costos-dias-amarillo {
    background: linear-gradient(135deg, #fef9c3 0%, #fef08a 100%);
}
.costos-table tbody tr:hover td.costos-dias-rojo {
    background: linear-gradient(135deg, #fecaca 0%, #fca5a5 100%);
}
.costos-table tbody tr:hover td.costos-dias-urgente {
    background: linear-gradient(135deg, #b91c1c 0%, #991b1b 100%);
}

/* Leyenda de referencia Días actualiz. (al final de la tabla materia prima) */
.costos-dias-leyenda {
    margin-top: 16px;
    padding: 12px 14px;
    font-size: 0.8rem;
    color: var(--muted);
    background: #f8fafc;
    border-radius: 10px;
    border: 1px solid var(--border);
    line-height: 1.6;
}
.costos-dias-leyenda-titulo {
    font-weight: 600;
    color: var(--logo-dark);
    margin-right: 6px;
}
.costos-dias-leyenda-item {
    display: inline-block;
    padding: 2px 8px;
    margin: 2px 4px 2px 0;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 500;
}
.costos-dias-leyenda-item:not(.costos-dias-amarillo):not(.costos-dias-rojo):not(.costos-dias-urgente) {
    background: #e2e8f0;
    color: var(--logo-dark);
}
.costos-dias-leyenda .costos-dias-amarillo {
    background: linear-gradient(135deg, #fefce8 0%, #fef9c3 100%);
    color: #713f12;
    border: 1px solid #eab308;
}
.costos-dias-leyenda .costos-dias-rojo {
    background: linear-gradient(135deg, #fef2f2 0%, #fecaca 100%);
    color: #7f1d1d;
    border: 1px solid #dc2626;
}
.costos-dias-leyenda .costos-dias-urgente {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
    color: #fff;
    border: 1px solid #7f1d1d;
}
@media (max-width: 480px) {
    .costos-dias-leyenda {
        margin-top: 12px;
        padding: 10px 12px;
        font-size: 0.75rem;
    }
    .costos-dias-leyenda-item {
        padding: 2px 6px;
        font-size: 0.7rem;
    }
}

/* ——— Responsive: sin barra horizontal — layout en tarjetas (tablet y móvil) ——— */
@media (max-width: 768px) {
    body.costos-page {
        padding: 16px 12px 32px;
        padding-left: max(12px, calc(12px + var(--safe-left)));
        padding-right: max(12px, calc(12px + var(--safe-right)));
    }
    .costos-main {
        max-width: 100%;
    }
    .costos-title {
        font-size: 1.85rem;
    }
    .costos-intro {
        font-size: 0.9rem;
        margin-bottom: 20px;
    }
    .costos-filter-section {
        margin-bottom: 16px;
    }
    .costos-filter-input {
        max-width: 100%;
    }
    .costos-table-wrap {
        overflow: visible;
        box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    }
    .costos-table {
        display: block;
        min-width: 0;
        font-size: 0.9rem;
        box-shadow: none;
        background: transparent;
    }
    .costos-table thead {
        display: none;
    }
    .costos-table tbody {
        display: block;
    }
    .costos-table tr {
        display: block;
        margin-bottom: 12px;
        border-radius: 10px;
        overflow: hidden;
        box-shadow: 0 1px 4px rgba(0,0,0,0.08);
        background: var(--surface);
        border: 1px solid var(--border);
    }
    .costos-table tr.costos-table-categoria {
        background: linear-gradient(90deg, #ecfdf5 0%, #d1fae5 100%);
        border-color: #a7f3d0;
        box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    }
    .costos-table tr.costos-table-categoria td {
        display: block;
        padding: 12px 14px;
        font-size: 0.95rem;
        border: none;
        border-bottom: none;
        background: transparent;
    }
    .costos-table tr.costos-table-categoria td::before {
        display: none;
    }
    .costos-table td {
        display: block;
        padding: 10px 14px;
        border-bottom: 1px solid var(--border);
        font-size: 0.9rem;
        white-space: normal;
        min-width: 0;
    }
    .costos-table td:last-child {
        border-bottom: none;
    }
    .costos-table td::before {
        content: attr(data-label);
        font-weight: 600;
        font-size: 0.75rem;
        text-transform: uppercase;
        letter-spacing: 0.03em;
        color: var(--muted);
        display: block;
        margin-bottom: 4px;
    }
    .costos-table tr.costos-table-categoria td::before {
        display: none;
    }
    .costos-table tbody tr:hover:not(.costos-table-categoria) td,
    .costos-table tbody tr:nth-child(even):not(.costos-table-categoria):hover td {
        background: #f8fafc;
    }
    .costos-table td.costos-cell-producto {
        font-weight: 600;
        color: var(--logo-dark);
    }
    .costos-table td.costos-cell-producto::before {
        color: var(--logo-teal-dark);
    }
    /* Items de la receta: mantener modo tabla detalle (no convertir en cards) */
    .costos-ver-items-table { display: table; min-width: 100%; }
    .costos-ver-items-table thead { display: table-header-group; }
    .costos-ver-items-table tbody { display: table-row-group; }
    .costos-ver-items-table tr { display: table-row; margin-bottom: 0; box-shadow: none; border: none; border-radius: 0; }
    .costos-ver-items-table th,
    .costos-ver-items-table td { display: table-cell; }
    .costos-ver-items-table td::before { display: none !important; content: none !important; }
}

/* ——— Móvil: ajustes de espacio y toques ——— */
@media (max-width: 480px) {
    body.costos-page {
        padding: 12px 10px 24px;
        padding-left: max(10px, calc(10px + var(--safe-left)));
        padding-right: max(10px, calc(10px + var(--safe-right)));
        padding-bottom: max(24px, calc(24px + var(--safe-bottom)));
    }
    .costos-title-row {
        gap: 12px;
    }
    .costos-calc-btn {
        min-height: 44px;
        padding: 10px 14px;
    }
    .costos-calc-btn-text-long {
        display: none;
    }
    .costos-calc-btn-text-short {
        display: inline;
    }
    .costos-back {
        margin-bottom: 20px;
        padding: 10px 4px;
        min-height: 44px;
        min-width: 44px;
        align-items: center;
        border-radius: 8px;
    }
    .costos-title {
        font-size: 1.5rem;
        margin-bottom: 8px;
        line-height: 1.25;
    }
    .costos-intro {
        margin-bottom: 16px;
        font-size: 0.875rem;
        line-height: 1.55;
    }
    .costos-filter-section {
        flex-wrap: wrap;
        margin-bottom: 14px;
        gap: 8px;
    }
    .costos-filter-label {
        width: 100%;
        font-size: 0.8rem;
    }
    .costos-filter-input {
        width: 100%;
        max-width: none;
        min-height: 44px;
        padding-left: 40px;
        font-size: 16px;
    }
    .costos-datos {
        margin-top: 0;
    }
    .costos-table-wrap {
        margin: 0 -2px;
        margin-left: max(-2px, calc(-2px - var(--safe-left)));
        margin-right: max(-2px, calc(-2px - var(--safe-right)));
    }
    .costos-table tr {
        margin-bottom: 10px;
        border-radius: 8px;
    }
    .costos-table td,
    .costos-table tr.costos-table-categoria td {
        padding: 8px 12px;
        font-size: 0.875rem;
    }
    .costos-table td::before {
        font-size: 0.7rem;
    }
}

@media (max-width: 380px) {
    body.costos-page {
        padding: 10px 8px 20px;
        padding-left: max(8px, calc(8px + var(--safe-left)));
        padding-right: max(8px, calc(8px + var(--safe-right)));
    }
    .costos-back {
        font-size: 0.85rem;
        padding: 8px 2px;
    }
    .costos-title {
        font-size: 1.35rem;
    }
    .costos-intro {
        font-size: 0.8125rem;
    }
    .costos-table tr {
        margin-bottom: 8px;
    }
    .costos-table td,
    .costos-table tr.costos-table-categoria td {
        padding: 6px 10px;
        font-size: 0.8125rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .costos-back,
    .costos-table th,
    .costos-table td {
        transition: none;
    }
}

/* ——— Módulo Armador: experiencia móvil unificada ——— */
@media (max-width: 768px) {
    body.costos-page {
        padding: 16px 14px 32px;
        padding-left: max(14px, calc(14px + var(--safe-left)));
        padding-right: max(14px, calc(14px + var(--safe-right)));
    }
    .costos-main {
        max-width: 100%;
    }
    .costos-title {
        font-size: 1.75rem;
    }
    .costos-title-row {
        gap: 12px;
    }
    .costos-calc-btn,
    .costos-btn-nueva {
        min-height: 44px;
        padding: 10px 16px;
        justify-content: center;
    }
    .costos-edit-form {
        padding: 16px;
        max-width: 100%;
    }
    .costos-edit-actions {
        flex-wrap: wrap;
        gap: 10px;
    }
    .costos-edit-btn-save,
    .costos-edit-btn-cancel,
    .costos-edit-btn-editar {
        min-height: 44px;
        padding: 10px 18px;
    }
    .costos-filter-section--stacked .costos-filter-search .costos-filter-input {
        min-width: 0;
        width: 100%;
        max-width: 100%;
    }
    .costos-filter-section--stacked .costos-filter-group-by .costos-filter-select {
        min-width: 0;
        width: 100%;
        max-width: 100%;
    }
    .costos-grupo-cards {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    .costos-card {
        padding: 14px;
        margin-bottom: 10px;
    }
    .costos-card-header .costos-card-title {
        font-size: 1rem;
    }
    .costos-card-actions {
        gap: 8px;
        margin-top: 10px;
        padding-top: 10px;
    }
    .costos-card-btn {
        min-height: 44px;
        padding: 10px 14px;
        font-size: 0.875rem;
    }
    .costos-ver-dl {
        margin: 0;
    }
    .costos-ver-dt,
    .costos-ver-dd {
        padding: 8px 0;
    }
}
@media (max-width: 480px) {
    body.costos-page {
        padding: 12px 12px 24px;
    }
    .costos-intro {
        font-size: 0.9rem;
    }
}

/* Spinner overlay: cargar / guardar / procesar */
.costos-spinner-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}
.costos-spinner-overlay[aria-hidden="true"] {
    display: none;
}
.costos-spinner-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 24px;
}
.costos-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--border);
    border-top-color: var(--logo-teal);
    border-radius: 50%;
    animation: costos-spinner-rotate 0.9s linear infinite;
}
.costos-spinner-text {
    font-size: 0.9rem;
    color: var(--logo-dark);
    font-weight: 500;
}
@keyframes costos-spinner-rotate {
    to { transform: rotate(360deg); }
}
/* Botón deshabilitado durante proceso */
button:disabled .costos-spinner-btn-inner,
.costos-btn-busy {
    pointer-events: none;
    opacity: 0.8;
}
button:disabled,
a.costos-btn-busy {
    cursor: not-allowed;
}

/* Hub: secciones por módulo con opciones Listar / Nuevo */
.costos-hub-modulo {
    margin-top: 1.5rem;
    padding: 1rem 1.25rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}
.costos-hub-modulo:first-of-type {
    margin-top: 1rem;
}
.costos-hub-modulo-titulo {
    margin: 0 0 0.75rem 0;
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--logo-dark);
    display: flex;
    align-items: center;
    gap: 8px;
}
.costos-hub-modulo-titulo i {
    color: var(--logo-teal);
}
.costos-hub-btns {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 12px;
    align-items: center;
}
.costos-hub-btns .costos-calc-btn {
    margin: 0;
}
