:root {
    --primary-color: #2c3e50;
    --accent-color: #f1c40f; /* Amarillo tipo nota */
    --success-color: #27ae60;
    --danger-color: #c0392b;
    --bg-light: #f8f9fa;
    --border-color: #ddd;
}

* { box-sizing: border-box; font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif; }

body { margin: 0; padding: 20px; background-color: #e9ecef; }

.main-container {
    max-width: 1400px;
    margin: 0 auto;
    background: white;
    padding: 20px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    height: 95vh; /* Ocupar casi toda la pantalla */
}

/* --- HEADER --- */
.invoice-header {
    background-color: var(--accent-color);
    padding: 15px;
    border-radius: 4px;
    margin-bottom: 15px;
}

.header-row {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.input-group {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 150px;
}

.input-group label {
    font-size: 0.85rem;
    font-weight: bold;
    margin-bottom: 5px;
    color: #333;
}

.input-group input {
    padding: 8px;
    border: 1px solid #aaa;
    border-radius: 4px;
}

.readonly-input { background-color: #e0e0e0; cursor: not-allowed; }

/* --- GRID SECTION --- */
.grid-section {
    flex-grow: 1;
    overflow: hidden; /* Handsontable maneja su propio scroll */
    margin-bottom: 15px;
    border: 1px solid var(--border-color);
}

/* --- FOOTER --- */
.invoice-footer {
    border-top: 2px solid var(--primary-color);
    padding-top: 15px;
}

.totals-container {
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
    background-color: #fff3cd; /* Fondo naranja suave */
    padding: 15px;
    border-radius: 4px;
}

.adjustments-panel, .results-panel {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 45%;
}

.adj-row, .res-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.res-row strong { font-size: 1.1rem; }

.highlight {
    color: var(--success-color);
    font-size: 1.2rem;
    border-top: 1px solid #ccc;
    padding-top: 5px;
}

/* Botones */
.actions-bar {
    display: flex;
    justify-content: flex-end;
    gap: 15px;
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    color: white;
    transition: background 0.2s;
}

.btn-primary { background-color: var(--primary-color); }
.btn-primary:hover { background-color: #1a252f; }

.btn-success { background-color: var(--success-color); }
.btn-success:hover { background-color: #219150; }

/* Ajustes visuales para la tabla */
.handsontable th {
    background-color: #3498db;
    color: white;
    font-weight: bold;
}
.htNumeric { color: #333; }