body {
    font-family: 'Arial', sans-serif;
    line-height: 1.6;
    margin: 0;
    padding: 20px;
    background-image: linear-gradient(to right, #d29531, #ffe5c9);
    color: #333;
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.95);
    padding: 25px;
    border-radius: 8px;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.1);
}

h1 {
    color: #2c3e50;
    text-align: center;
    margin-bottom: 25px;
    border-bottom: 2px solid #eee;
    padding-bottom: 10px;
}

.alert {
    padding: 12px 15px;
    margin-bottom: 20px;
    border-radius: 4px;
    font-size: 15px;
}

.alert.success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert.error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.btn {
    display: inline-block;
    background: #F29D33;
    color: white;
    padding: 12px 24px;
    text-decoration: none;
    border-radius: 6px;
    margin: 8px;
    border: none;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    font-weight: 500;
}

.btn:hover {
    background: #e08c2a;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.btn-cancelar {
    background: #e74c3c;
}

.btn-cancelar:hover {
    background: #c0392b;
}

.btn-clear {
    background: #f39c12;
    padding: 8px 16px;
    font-size: 15px;
    margin: 5px;
}

.btn-clear:hover {
    background: #d35400;
}

.btn-pdf {
    background: #e74c3c;
    padding: 8px 16px;
    font-size: 14px;
}

.btn-pdf:hover {
    background: #c0392b;
}

.form-actions {
    margin-top: 30px;
    text-align: center;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 25px;
    font-size: 15px;
    background: white;
    box-shadow: 0 0 10px rgba(0,0,0,0.05);
}

th, td {
    border: 1px solid #ddd;
    padding: 14px;
    text-align: left;
}

th {
    background-color: #F29D33;
    color: white;
    font-weight: 600;
    font-size: 15px;
}

tr:nth-child(even) {
    background-color: rgba(242, 242, 242, 0.7);
}

tr:hover {
    background-color: rgba(233, 233, 233, 0.8);
}

.firma {
    max-width: 180px;
    max-height: 80px;
    display: block;
    margin: 0 auto;
    background: white;
    padding: 5px;
    border: 1px solid #eee;
}

.form-group {
    margin-bottom: 22px;
}

label {
    display: block;
    margin-bottom: 10px;
    font-weight: 600;
    color: #2c3e50;
    font-size: 15px;
}

input[type="text"],
input[type="number"],
input[type="datetime-local"],
textarea,
select {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    box-sizing: border-box;
    font-size: 16px;
    transition: border 0.3s;
    background: rgba(255,255,255,0.8);
}

input[type="text"]:focus,
input[type="number"]:focus,
input[type="datetime-local"]:focus,
textarea:focus,
select:focus {
    border-color: #F29D33;
    outline: none;
    box-shadow: 0 0 0 2px rgba(242, 157, 51, 0.2);
}

textarea {
    height: 120px;
    resize: vertical;
}

select {
    height: 45px;
}

.signature-container {
    position: relative;
    border: 1px solid #ddd;
    margin-bottom: 18px;
    background: white;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.signature-pad {
    width: 100%;
    height: 220px;
    display: block;
    touch-action: none;
    cursor: crosshair;
    background: white;
}

.action-buttons {
    display: flex;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
    margin-top: 25px;
}

/* Estilos para contenedor de items */
.items-container {
    margin-bottom: 20px;
    padding: 15px;
    background-color: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #ddd;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

/* Fila de item - diseño flexible */
.item-row {
    display: flex;
    margin-bottom: 15px;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background-color: white;
    border-radius: 6px;
    border: 1px solid #ddd;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
}

.item-row:hover {
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
    border-color: #F29D33;
}

/* Select de items */
.item-select {
    flex: 2;
    min-width: 200px;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    background-color: white;
    font-size: 15px;
    transition: border 0.3s;
}

.item-select:focus {
    border-color: #F29D33;
    outline: none;
    box-shadow: 0 0 0 2px rgba(242, 157, 51, 0.2);
}

/* Campo de cantidad */
.item-cantidad {
    flex: 0.5;
    min-width: 100px;
    max-width: 120px;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 15px;
    text-align: center;
    transition: border 0.3s;
}

.item-cantidad:focus {
    border-color: #F29D33;
    outline: none;
    box-shadow: 0 0 0 2px rgba(242, 157, 51, 0.2);
}

/* Botón eliminar item */
.btn-remove-item {
    flex: 0.3;
    min-width: 90px;
    padding: 10px 12px;
    background-color: #e74c3c;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.btn-remove-item:hover {
    background-color: #c0392b;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

/* Botón agregar item */
.btn-add-item {
    padding: 12px 20px;
    background-color: #27ae60;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    margin-bottom: 15px;
    font-weight: 600;
    font-size: 15px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.btn-add-item:hover {
    background-color: #219653;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

/* Ajustes para Select2 */
.select2-container--default .select2-selection--single {
    height: 42px !important;
    border: 1px solid #ddd !important;
    border-radius: 6px !important;
}

.select2-container--default .select2-selection--single .select2-selection__rendered {
    line-height: 40px !important;
    padding-left: 12px !important;
}

.select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 40px !important;
}

.select2-dropdown {
    border: 1px solid #ddd !important;
    border-radius: 6px !important;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1) !important;
}

.select2-results__option--highlighted {
    background-color: #F29D33 !important;
}

/* Mejoras específicas para tablet/móvil */
@media (max-width: 1024px) {
    body {
        padding: 15px;
    }
    
    .container, .principal {
        padding: 20px;
    }
    
    .btn {
        padding: 10px 20px;
        font-size: 15px;
        margin: 6px;
    }
    
    table {
        font-size: 14px;
    }
    
    th, td {
        padding: 12px 10px;
    }
    
    .signature-pad {
        height: 180px;
    }
    
    /* Items responsive para tablet */
    .item-row {
        gap: 10px;
        padding: 10px;
    }
    
    .item-select {
        min-width: 180px;
        font-size: 14px;
    }
    
    .item-cantidad {
        min-width: 90px;
        max-width: 110px;
    }
    
    .btn-remove-item {
        min-width: 80px;
        font-size: 13px;
        padding: 10px;
    }
}

@media (max-width: 768px) {
    .container, .principal {
        padding: 15px;
    }
    
    h1 {
        font-size: 24px;
        margin-bottom: 20px;
    }
    
    .signature-pad {
        height: 160px;
    }
    
    table {
        font-size: 13px;
    }
    
    th, td {
        padding: 10px 8px;
    }
    
    .form-group {
        margin-bottom: 18px;
    }
    
    input[type="text"],
    input[type="number"],
    input[type="datetime-local"],
    textarea,
    select {
        padding: 10px;
        font-size: 15px;
    }
    
    .action-buttons {
        flex-direction: column;
        align-items: center;
    }
    
    .btn {
        width: 100%;
        max-width: 300px;
        margin: 5px 0;
    }
    
    /* Items responsive para móvil */
    .items-container {
        padding: 12px;
    }
    
    .item-row {
        flex-direction: column;
        gap: 12px;
        padding: 15px;
        align-items: stretch;
    }
    
    .item-select {
        flex: none !important;
        width: 100% !important;
        min-width: 100% !important;
        max-width: 100% !important;
        margin-bottom: 5px;
        box-sizing: border-box;
    }
    
    .item-cantidad {
        flex: none !important;
        width: 100% !important;
        min-width: 100% !important;
        max-width: 100% !important;
        margin-bottom: 5px;
        box-sizing: border-box;
    }
    
    .btn-remove-item {
        flex: none !important;
        width: 100% !important;
        min-width: 100% !important;
        max-width: 100% !important;
        padding: 12px;
        font-size: 14px;
        box-sizing: border-box;
    }
    
    /* Forzar que Select2 también se ajuste en móvil */
    .select2-container {
        width: 100% !important;
        box-sizing: border-box;
    }
    
    .btn-add-item {
        width: 100%;
        padding: 15px;
        font-size: 16px;
    }
}

@media (max-width: 480px) {
    body {
        padding: 10px;
    }
    
    .container, .principal {
        padding: 12px;
    }
    
    table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }
    
    .signature-pad {
        height: 140px;
    }
    
    .firma {
        max-width: 120px;
        max-height: 60px;
    }
    
    /* Items responsive para móviles pequeños */
    .items-container {
        padding: 10px;
        margin-bottom: 15px;
    }
    
    .item-row {
        flex-direction: column !important;
        padding: 12px;
        margin-bottom: 12px;
        gap: 15px;
    }
    
    .item-select,
    .item-cantidad {
        flex: none !important;
        width: 100% !important;
        min-width: 100% !important;
        max-width: 100% !important;
        font-size: 14px;
        padding: 12px;
        box-sizing: border-box;
    }
    
    .btn-remove-item {
        flex: none !important;
        width: 100% !important;
        min-width: 100% !important;
        max-width: 100% !important;
        padding: 14px;
        font-size: 15px;
        font-weight: 600;
        box-sizing: border-box;
    }
    
    /* Forzar Select2 en móviles pequeños */
    .select2-container {
        width: 100% !important;
        display: block !important;
        box-sizing: border-box;
    }
    
    .select2-container .select2-selection--single {
        width: 100% !important;
        box-sizing: border-box;
    }
    
    /* Mejorar select2 en móvil */
    .select2-container--default .select2-selection--single {
        height: 46px !important;
        width: 100% !important;
    }
    
    .select2-container--default .select2-selection--single .select2-selection__rendered {
        line-height: 44px !important;
        font-size: 14px;
    }
}