:root {
    --primary: #1a2a6c;
    --secondary: #27ae60;
    --accent: #f39c12;
    --bg: #f8f9fa;
    --text: #2c3e50;
    --white: #ffffff;
    --border: #dee2e6;
    --shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--bg);
    color: var(--text);
    margin: 0;
    padding: 20px;
    line-height: 1.5;
}

.container {
    max-width: 1000px;
    margin: 0 auto;
}

header {
    text-align: center;
    margin-bottom: 20px;
    background: var(--primary);
    color: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: var(--shadow);
}

header h1 {
    margin: 0;
    font-size: 2rem;
}

header p {
    opacity: 0.9;
    margin: 10px 0 0;
}

.main-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 20px;
}

@media (max-width: 900px) {
    .main-grid {
        grid-template-columns: 1fr;
    }
}

.col-left {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.col-right {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.card {
    background: var(--white);
    padding: 15px;
    border-radius: 10px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}

.card h2 {
    margin-top: 0;
    font-size: 1.1rem;
    color: var(--primary);
    border-bottom: 2px solid var(--bg);
    padding-bottom: 8px;
    margin-bottom: 12px;
}

.card-header-toggle {
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    user-select: none;
}

.toggle-icon {
    font-size: 0.8rem;
    transition: transform 0.3s ease;
}

.card.collapsed .toggle-icon {
    transform: rotate(-90deg);
}

.card.collapsed .card-content {
    display: none;
}

.card.collapsed h2 {
    margin-bottom: 0;
    border-bottom: none;
    padding-bottom: 0;
}

.form-box {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    border: 1px solid var(--border);
}

.form-group {
    margin-bottom: 15px;
}

label {
    display: block;
    font-weight: 600;
    margin-bottom: 6px;
    font-size: 0.9rem;
}

input,
select {
    width: 100%;
    padding: 8px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.9rem;
    transition: all 0.2s;
    box-sizing: border-box;
}

input:focus,
select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(26, 42, 108, 0.1);
}

.btn-primary-action {
    width: 100%;
    padding: 10px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background 0.2s;
}

.btn-primary-action:hover {
    background: #111d4e;
}

.btn-secondary-action {
    width: 100%;
    padding: 10px;
    background: #34495E;
    color: white;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background 0.2s;
}

.btn-secondary-action:hover {
    background: #2c3e50;
}

/* Item List */
.item-list {
    margin-top: 15px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.item-row {
    background: #fff;
    border: 1px solid var(--border);
    padding: 12px;
    border-radius: 6px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
}

.item-info strong {
    display: block;
    color: var(--primary);
    font-size: 1.05rem;
}

.item-info span {
    font-size: 0.85rem;
    color: #666;
}

.item-actions {
    display: flex;
    align-items: center;
}

.item-cost {
    font-weight: 700;
    color: var(--text);
    margin-right: 15px;
    font-size: 1.05rem;
}

.btn-delete {
    background: #e74c3c;
    color: white;
    border: none;
    border-radius: 5px;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.8rem;
    transition: background 0.2s;
}

.btn-delete:hover {
    background: #c0392b;
}

/* Results Display */
.results-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
    font-size: 0.95rem;
}

.results-table td {
    padding: 8px 0;
    border-bottom: 1px solid #efefef;
}

.results-table td:last-child {
    text-align: right;
    font-weight: 600;
}

.total-row {
    font-size: 1.2rem;
    color: var(--primary);
    font-weight: bold;
    border-top: 2px solid var(--primary) !important;
}

.total-row td {
    border-top: 2px solid var(--primary) !important;
    font-weight: 700;
    color: var(--primary);
}

.chart-container {
    position: relative;
    height: 380px;
    width: 100%;
    margin: 20px auto;
}

/* Styling specifically for the dark mode projection card */
.projection-card {
    background: linear-gradient(135deg, #1a2a6c, #2a4858);
    color: white;
}

.stat-grid {
    display: grid;
    gap: 20px;
}

.stat-box {
    padding: 20px;
    border-radius: 10px;
    text-align: center;
    transition: all 0.3s;
}

.stat-box .label {
    display: block;
    font-size: 0.85rem;
    text-transform: uppercase;
    opacity: 0.9;
    margin-bottom: 5px;
    font-weight: 600;
}

.stat-box .value {
    font-size: 1.5rem;
    font-weight: 700;
}

.links-grid {
    display: grid;
    gap: 15px;
}

.link-button {
    display: flex;
    align-items: center;
    padding: 15px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    text-decoration: none;
    color: var(--primary);
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.link-button:hover {
    background: var(--primary);
    color: white;
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

@media print {
    @page {
        margin: 1.5cm;
        size: letter;
    }

    body {
        background: white !important;
        color: #1a1a1a !important;
        padding: 0 !important;
        font-size: 10pt;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    .container {
        max-width: 100% !important;
        width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    header {
        border-bottom: 3px solid #0d1b2a;
        padding-bottom: 25px !important;
        margin-bottom: 40px !important;
        text-align: left !important;
    }

    header h1 {
        font-size: 22pt !important;
        color: #0d1b2a !important;
        margin-bottom: 5px !important;
    }

    header p {
        font-size: 11pt !important;
        color: #444 !important;
        display: block !important;
    }

    .main-grid {
        display: block !important;
    }

    .no-print,
    .btn-delete,
    .item-actions button,
    .btn-suggest,
    .form-box button,
    .toggle-icon {
        display: none !important;
    }

    .print-only {
        display: block !important;
    }

    .card {
        background: white !important;
        border: 1px solid #e1e4e8 !important;
        box-shadow: none !important;
        break-inside: avoid;
        margin-bottom: 30px !important;
        padding: 25px !important;
        border-radius: 0 !important;
    }

    /* Forzar visibilidad de contenido colapsado */
    .card.collapsed .card-content {
        display: block !important;
    }

    .card h2 {
        border-bottom: 1.5pt solid #eee !important;
        color: #0d1b2a !important;
        font-size: 14pt !important;
        margin-bottom: 20px !important;
        padding-bottom: 10px !important;
    }

    /* Estilo del Resumen Financiero en Impresión */
    .projection-card {
        background: #fdfdfd !important;
        border: 2pt solid #0d1b2a !important;
        color: #0d1b2a !important;
        padding: 30px !important;
        page-break-after: auto;
    }

    .projection-card h2 {
        color: #0d1b2a !important;
        border-bottom: 1pt solid #0d1b2a !important;
    }

    .stat-box {
        border: 1px solid #ddd !important;
        background: #f8f9fa !important;
        padding: 15px !important;
        border-radius: 4px !important;
    }

    .stat-box .label {
        color: #555 !important;
        font-size: 9pt !important;
    }

    .stat-box .value {
        color: #0d1b2a !important;
        font-size: 18pt !important;
    }

    /* Colores Especiales para Reporte */
    #res-margen {
        color: #1e8449 !important;
    }

    #res-iva-neto {
        color: #a93226 !important;
    }

    #res-costos {
        color: #a93226 !important;
        font-weight: bold !important;
    }

    .results-table {
        width: 100% !important;
        border-collapse: collapse !important;
    }

    .results-table td {
        padding: 10pt 5pt !important;
        border-bottom: 0.5pt solid #eee !important;
        font-size: 10pt !important;
        color: #333 !important;
    }

    .total-row td {
        border-top: 1.5pt solid #0d1b2a !important;
        font-weight: bold !important;
        font-size: 11pt !important;
    }

    /* Inputs en la lista (Personal/Servicios) */
    .item-row input {
        border: none !important;
        background: transparent !important;
        font-weight: bold !important;
        width: auto !important;
        padding: 0 !important;
    }

    /* Gráfico */
    .chart-container {
        height: 300px !important;
        max-width: 450px !important;
        margin: 20px auto !important;
    }

    /* Pie de página de reporte */
    body::after {
        content: "Este reporte es una simulación financiera basada en la legislación de Costa Rica 2026.";
        display: block;
        margin-top: 50px;
        font-size: 8pt;
        color: #888;
        text-align: center;
        border-top: 0.5pt solid #eee;
        padding-top: 10px;
    }
}