* {
    box-sizing: border-box;
    margin: 0;
    font-family: 'Segoe UI', Roboto, system-ui, sans-serif;
}

body {
    background: #f0f2f5;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    padding: 16px;
}

.app-container {
    max-width: 1400px;
    width: 100%;
    background: white;
    border-radius: 32px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.12);
    overflow: visible;
    padding: 24px 28px;
    transition: all 0.2s;
    position: relative;
}

/* HEADER PEGAJOSO */
.sticky-header {
    position: sticky;
    top: 0;
    background: white;
    padding: 15px 0;
    z-index: 1000;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid #e0e4e9;
    margin-bottom: 20px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.02);
    flex-wrap: wrap;
    gap: 15px;
}

.sticky-left {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

.titulo-sticky {
    font-size: 1.4rem;
    font-weight: 700;
    color: #e8551c;
    white-space: nowrap;
}

.btn-reset {
    background-color: #e74c3c;
    color: white;
    border: none;
    border-radius: 40px;
    padding: 10px 25px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 4px 10px rgba(231, 76, 60, 0.2);
}

.btn-reset:hover {
    background-color: #c0392b;
    transform: scale(1.02);
}

.piezas-counter {
    background: #2ecc71;
    color: white;
    padding: 8px 18px;
    border-radius: 40px;
    font-weight: 600;
    font-size: 1rem;
}

.sticky-totals {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.total-sticky {
    background: linear-gradient(145deg, #1f2b38, #15232e);
    color: white;
    padding: 8px 18px;
    border-radius: 40px;
    font-size: 0.95rem;
    font-weight: 500;
    white-space: nowrap;
}

.total-sticky span {
    font-weight: 700;
    font-size: 1.1rem;
    color: #b0f0cf;
}

/* TÍTULOS DE SECCIÓN */
.titulo-seccion {
    text-align: center;
    font-size: 2rem;
    font-weight: 600;
    color: #e8551c;
    margin: 40px 0 30px;
    padding-bottom: 10px;
    border-bottom: 3px solid #e8551c;
}

/* SUBTÍTULOS */
.subtitulo {
    font-size: 1.4rem;
    font-weight: 500;
    color: #2c3e50;
    margin: 25px 0 15px;
}

.costo-hora {
    background: #f8fafd;
    padding: 15px 25px;
    border-radius: 50px;
    margin: 20px 0;
    font-size: 1.2rem;
    border: 1px solid #dee4ec;
}

.costo-hora strong {
    color: #e8551c;
    font-size: 1.4rem;
}

/* TARJETAS DE PIEZAS */
.materiales-container {
    display: flex;
    flex-direction: column;
    gap: 30px;
    margin: 20px 0;
}

.tarjeta-pieza {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 32px;
    padding: 25px 30px;
    box-shadow: 0 6px 12px rgba(0,0,0,0.02);
}

.titulo-pieza {
    font-size: 1.8rem;
    font-weight: 600;
    color: #0a1c2f;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px dashed #cbd5e1;
}

/* SECCIÓN COSTOS VARIABLES */
.seccion-costos-variables {
    background: #f8fafd;
    border-radius: 24px;
    padding: 20px;
    margin-bottom: 25px;
}

.costo-mp {
    font-size: 1.2rem;
    font-weight: 500;
    background: #ffffff;
    padding: 12px 20px;
    border-radius: 50px;
    display: inline-block;
    margin-bottom: 20px;
    border: 1px solid #dee4ec;
}

.costo-mp span {
    font-weight: 700;
    color: #2c3e50;
}

/* SECCIÓN OPERACIONES */
.seccion-operaciones {
    background: #ffffff;
    border-radius: 24px;
    padding: 20px;
    border: 1px solid #e9edf2;
}

/* GOLPES CONTAINER */
.golpes-container {
    margin: 20px 0;
    padding: 15px;
    background: #f8fafd;
    border-radius: 20px;
}

.golpe-item {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.golpe-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.switch-opciones {
    display: flex;
    gap: 5px;
}

.switch-btn {
    background: #e0e4e9;
    border: none;
    border-radius: 20px;
    padding: 8px 15px;
    font-size: 0.9rem;
    font-weight: 600;
    color: #2c3e50;
    cursor: pointer;
    transition: all 0.2s;
}

.switch-btn:hover {
    background: #2ecc71;
    color: white;
}

.btn-agregar-golpe {
    background: #2ecc71;
    color: white;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    font-size: 1.5rem;
    font-weight: bold;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.btn-agregar-golpe:hover {
    background: #27ae60;
    transform: scale(1.1);
}

/* CAMPOS DE INPUT */
.campos-fila {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin: 15px 0;
}

.campo {
    min-width: 160px;
}

.campo label {
    display: block;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    font-weight: 600;
    color: #4b5e71;
    margin-bottom: 6px;
}

.campo input {
    width: 100%;
    padding: 14px 18px;
    font-size: 1.1rem;
    border: 2px solid #dde3ea;
    border-radius: 30px;
    background: white;
    font-weight: 500;
    color: #11181f;
    transition: 0.15s;
}

.campo input:focus {
    outline: none;
    border-color: #2ecc71;
    box-shadow: 0 0 0 4px rgba(46,204,113,0.15);
}

.campo input[readonly] {
    background-color: #f3f6f9;
    border-color: #cbd5e1;
    color: #1e2a36;
    font-weight: 600;
}

.valor-pesos {
    position: relative;
}

.valor-pesos::before {
    content: '$';
    position: absolute;
    left: 18px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.1rem;
    font-weight: 600;
    color: #5e6f82;
    pointer-events: none;
    z-index: 1;
}

.valor-pesos input {
    padding-left: 40px;
}

/* BOTÓN AGREGAR PIEZA */
.btn-agregar {
    background: white;
    border: 2px dashed #2ecc71;
    border-radius: 80px;
    padding: 20px 40px;
    font-size: 1.8rem;
    font-weight: 700;
    color: #2ecc71;
    width: fit-content;
    margin: 30px auto;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    transition: 0.2s;
}

.btn-agregar:hover {
    background: #e8f8ef;
    border-color: #27ae60;
    color: #27ae60;
}

/* TOTALES */
.total-material,
.total-conformado,
.costo-variable-final,
.costo-fijo-total {
    background: linear-gradient(145deg, #1f2b38, #15232e);
    border-radius: 40px;
    padding: 20px 30px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 15px;
    color: white;
    margin: 25px 0;
    box-shadow: 0 18px 25px -10px rgba(0,40,20,0.3);
}

.total-material h3,
.total-conformado h3,
.costo-variable-final h3,
.costo-fijo-total h3 {
    font-size: 1.5rem;
    font-weight: 500;
    color: #b0f0cf;
}

.total-material .valor-total,
.total-conformado .valor-total,
.costo-variable-final .valor-total,
.costo-fijo-total .valor-total {
    font-size: 2rem;
    font-weight: 700;
    background: rgba(255,255,255,0.05);
    padding: 8px 30px;
    border-radius: 100px;
    border: 1px solid rgba(255,255,255,0.2);
}

/* SWITCH DE SERIE PRODUCCION */
.serie-controls {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}
/* Estilos para campos de cálculo automático (naranja) */
.campo-auto input[readonly] {
    background-color: #fff3e0;
    border-color: #e8551c;
    color: #e8551c;
    font-weight: 700;
}

.campo-auto input[readonly]:focus {
    border-color: #e8551c;
    box-shadow: 0 0 0 4px rgba(232, 85, 28, 0.15);
}

/* Estilos para los controles de serie */
.serie-controls {
    display: flex;
    gap: 8px;
    margin-top: 10px;
    flex-wrap: wrap;
}

.serie-btn {
    background: #e0e4e9;
    border: none;
    border-radius: 20px;
    padding: 6px 12px;
    font-size: 0.85rem;
    font-weight: 600;
    color: #2c3e50;
    cursor: pointer;
    transition: all 0.2s;
    flex: 1;
    min-width: 70px;
}

.serie-btn:hover {
    background: #2ecc71;
    color: white;
}

/* RESPONSIVE */
@media (max-width: 768px) {
    .app-container {
        padding: 15px;
    }
    
    .sticky-header {
        flex-direction: column;
        align-items: stretch;
    }
    
    .sticky-left {
        justify-content: space-between;
    }
    
    .sticky-totals {
        justify-content: space-around;
    }
    
    .titulo-sticky {
        font-size: 1.2rem;
    }
    
    .campos-fila {
        grid-template-columns: 1fr;
    }
    
    .golpe-item {
        flex-direction: column;
        align-items: stretch;
    }
    
    .golpe-controls {
        justify-content: space-between;
    }
}

@media (min-width: 1920px) {
    .app-container {
        max-width: 1800px;
        padding: 40px 50px;
    }
    
    .campo input {
        font-size: 1.3rem;
        padding: 18px 25px;
    }
}