/* Reset y base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: #fafafa;
    color: #1a1a1a;
    line-height: 1.5;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
    background: #fff;
    min-height: 100vh;
}

/* Header */
.header {
    text-align: center;
    padding-bottom: 20px;
    margin-bottom: 30px;
    border-bottom: 1px solid #e0e0e0;
}
.logo-img {
    max-width: 150px;
    height: auto;
    margin-bottom: 6px;
    display: block;
    margin-left: auto;
    margin-right: auto;
}

/* Logo responsive en móvil */
@media (max-width: 768px) {
    .logo-img {
        max-width: 150px;
    }
}
.title {
    font-size: 20px;
    font-weight: 300;
    color: #1a1a1a;
    margin-bottom: 6px;
    letter-spacing: -0.3px;
}

/* Sections */
.section {
    background: #fafafa;
    padding: 20px;
    margin-bottom: 20px;
    border-radius: 2px;
}

.section-title {
    font-size: 13px;
    font-weight: 500;
    color: #1a1a1a;
    margin-bottom: 16px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Fields */
.field {
    margin-bottom: 16px;
}

.label {
    display: block;
    font-size: 12px;
    color: #666;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.input,
.input-display {
    width: 100%;
    padding: 12px 14px;
    font-size: 15px;
    border: 1px solid #ddd;
    background: #fff;
    color: #1a1a1a;
    border-radius: 2px;
    font-family: inherit;
}

.input:focus {
    outline: none;
    border-color: #1a1a1a;
}

.input-display {
    background: #f5f5f5;
    border-color: #e0e0e0;
    color: #1a1a1a;
}

.info-text {
    font-size: 13px;
    color: #666;
    margin-top: 8px;
}

/* Grid */
.grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

/* Buttons */
.buttons {
    text-align: center;
    margin: 20px 0;
}

.btn {
    padding: 12px 24px;
    font-size: 14px;
    font-weight: 500;
    color: #fff;
    background: #1a1a1a;
    border: none;
    border-radius: 2px;
    cursor: pointer;
    margin: 0 6px 10px 6px;
    min-width: 140px;
    transition: background 0.2s;
}

.btn:hover {
    background: #333;
}

.btn-secondary {
    background: #999;
}

.btn-secondary:hover {
    background: #777;
}

.btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* Result box */
.result-box {
    background: #f5f5f5;
    padding: 20px;
    text-align: center;
    margin: 20px 0;
    border-left: 3px solid #1a1a1a;
}

.result-label {
    font-size: 11px;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.result-value {
    font-size: 26px;
    font-weight: 300;
    color: #1a1a1a;
}

/* Table */
.table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-top: 16px;
}

.table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
}

.table thead {
    background: #f8f9fa;
}

.table th {
    padding: 10px 8px;
    text-align: left;
    font-size: 11px;
    font-weight: 500;
    color: #666;
    border-bottom: 2px solid #e0e0e0;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.table th.align-right {
    text-align: right;
}

.table td {
    padding: 10px 8px;
    font-size: 14px;
    border-bottom: 1px solid #f0f0f0;
}

.table td.align-right {
    text-align: right;
}

/* Expand button */
.expand-btn {
    cursor: pointer;
    color: #666;
    font-size: 16px;
    font-weight: bold;
    background: none;
    border: none;
    padding: 0 8px;
    user-select: none;
}

.expand-btn:hover {
    color: #1a1a1a;
}

/* Delete button */
.btn-delete {
    cursor: pointer;
    color: #dc3545;
    font-size: 14px;
    background: none;
    border: none;
    padding: 0 4px;
    margin-left: 4px;
    user-select: none;
}

.btn-delete:hover {
    color: #c82333;
}

@media print {
    .btn-delete {
        display: none !important;
    }
}

/* Desglose row */
.desglose-row {
    background: #fafafa;
}

.desglose-content {
    padding: 16px 20px;
    font-size: 13px;
    line-height: 1.8;
}

.desglose-title {
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #666;
    margin-bottom: 12px;
}

.desglose-line {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
}

.desglose-line.total {
    border-top: 2px solid #ddd;
    margin-top: 8px;
    padding-top: 12px;
    font-weight: 500;
    font-size: 14px;
}

.desglose-label {
    color: #666;
}

.desglose-value {
    font-weight: 500;
    color: #1a1a1a;
}

/* Total box */
.total-box {
    background: #1a1a1a;
    color: #fff;
    padding: 16px;
    text-align: center;
    margin-top: 16px;
}

.total-label {
    font-size: 11px;
    opacity: 0.7;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.total-value {
    font-size: 24px;
    font-weight: 300;
}

/* Footer */
.footer {
    text-align: center;
    padding: 30px 20px;
    margin-top: 40px;
    border-top: 1px solid #e0e0e0;
    color: #999;
    font-size: 13px;
}

.footer a {
    color: #666;
    text-decoration: none;
}

.footer a:hover {
    color: #1a1a1a;
}

.small {
    font-size: 12px;
    margin-top: 6px;
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 12px;
    }

    .header {
        margin-bottom: 12px;
        padding-bottom: 10px;
    }

    .title {
        font-size: 18px;
    }

    .section {
        padding: 16px;
        margin-bottom: 16px;
    }

    .section-title {
        font-size: 12px;
        margin-bottom: 12px;
    }

    .field {
        margin-bottom: 12px;
    }

    .grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .btn {
        width: 100%;
        margin: 0 0 8px 0;
    }

    .result-box {
        padding: 16px;
        margin: 16px 0;
    }

    .result-value {
        font-size: 22px;
    }

    .table {
        font-size: 12px;
    }

    .table th,
    .table td {
        padding: 8px 4px;
        font-size: 11px;
    }

    .desglose-content {
        padding: 12px;
        font-size: 12px;
    }

    .total-box {
        padding: 14px;
    }

    .total-value {
        font-size: 20px;
    }
}

/* Select dropdown arrow */
select {
    appearance: none;
    background-image: url('data:image/svg+xml;charset=UTF-8,%3Csvg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 12 12"%3E%3Cpath fill="%23666" d="M10.293 3.293L6 7.586 1.707 3.293A1 1 0 00.293 4.707l5 5a1 1 0 001.414 0l5-5a1 1 0 10-1.414-1.414z"/%3E%3C/svg%3E');
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 40px;
}

/* Loading state */
.loading {
    opacity: 0.6;
    pointer-events: none;
}
/* ========================================
   ESTILOS DE IMPRESIÓN / PDF
   ======================================== */

@media print {
    /* Ocultar TODO excepto lo que queremos */
    body > *:not(.container) {
        display: none !important;
    }
    
    .container > *:not(#lineasSection) {
        display: none !important;
    }
    
    /* Ocultar header, formularios, botones */
    .header,
    .section:not(#lineasSection),
    .buttons,
    .result-box,
    .footer,
    #btnExportar {
        display: none !important;
    }
    
    /* Mostrar SOLO la sección de líneas */
    #lineasSection {
        display: block !important;
        margin: 0 !important;
        padding: 0 !important;
        background: white !important;
    }
    
    /* Quitar el título "Líneas acumuladas" si quieres */
    .lines-title {
        display: none !important;
        /* O mantenerlo: display: block !important; */
    }
    
    /* Estilos limpios para la tabla */
    .table-wrapper {
        overflow: visible !important;
    }
    
    .table {
        width: 100% !important;
        border-collapse: collapse !important;
        page-break-inside: avoid;
    }
    
    .table th,
    .table td {
        border: 1px solid #333 !important;
        padding: 8px !important;
        font-size: 12px !important;
    }
    
    .table thead {
        background: #f0f0f0 !important;
    }
    
    /* Ocultar botones + de expandir */
    .expand-btn {
        display: none !important;
    }
    
    /* Ocultar filas de desglose expandidas */
    .desglose-row {
        display: none !important;
    }
    
    /* Mostrar SOLO el total */
    .total-box {
        display: block !important;
        background: white !important;
        border: 2px solid #333 !important;
        padding: 15px !important;
        margin-top: 20px !important;
        text-align: right !important;
        page-break-inside: avoid;
    }
    
    .total-label {
        color: #333 !important;
        font-size: 14px !important;
        font-weight: bold !important;
    }
    
    .total-value {
        color: #000 !important;
        font-size: 20px !important;
        font-weight: bold !important;
    }
    
    /* Añadir logo o cabecera OTIV (opcional) */
    #lineasSection::before {
        content: "lab.otiv.es - Preexistencia Continente";
        display: block;
        text-align: center;
        font-size: 16px;
        font-weight: bold;
        margin-bottom: 20px;
        padding-bottom: 10px;
        border-bottom: 2px solid #333;
    }
    
    /* Añadir fecha al pie (opcional) */
    #lineasSection::after {
        content: "Fecha: " attr(data-date);
        display: block;
        text-align: right;
        font-size: 10px;
        margin-top: 20px;
        color: #666;
    }
    
    /* Forzar fondo blanco y evitar colores */
    * {
        background: white !important;
        color: black !important;
    }
    
    /* Excepto el total que puede tener fondo */
    .total-box {
        background: #f0f0f0 !important;
    }
    /* Logo en impresión */
    .logo-img-print {
        display: block !important;
        max-width: 1000px;
        height: auto;
        margin: 0 auto 6px auto;
    }
    
    /* Ocultar logo del header normal */
    .header .logo-img {
        display: none !important;
    }
}
```

### **4. Guardar**

1. Scroll abajo
2. Commit message: `Añadir estilos de impresión`
3. **Commit changes**

### **5. Esperar redeploy**

- Vercel redeploy automático (1-2 min)

---

## **✅ RESULTADO:**

Cuando hagas clic en **"📄 Exportar a PDF"** (que usa `window.print()`), se imprimirá:
```
┌─────────────────────────────────────────┐
│ Oficina Técnica de Ingeniería y        │
│      Valoraciones S.L.                  │
├─────────────────────────────────────────┤
│                                         │
│ TABLA DE LÍNEAS                         │
│ (Solo la tabla, sin botones +)          │
│                                         │
├─────────────────────────────────────────┤
│ TOTAL PREEXISTENCIA                     │
│ 54.382,38 €                             │
└─────────────────────────────────────────┘
