:root {
    --primary-color:#0033a0;
    --secondary-color:#2c3e50;
    --accent-color:#c9963a;
    --light-color:#ecf0f1;
    --bg-color:#c6ede3;
    --error-bg:#ffe6e6;
    --error-color:#b30000;
}

* { box-sizing:border-box; }

body {
    margin:0;
    font-family:'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background:var(--bg-color);
    color:#222;
    line-height:1.5;
}

h1,h2,h3 {
    margin:0 0 1rem;
    font-weight:600;
    color:var(--secondary-color);
}

.main-title {
    text-align:center;
    color:var(--primary-color);
    font-size:2.1rem;
    margin-top:10px;
    margin-bottom:28px;
    letter-spacing:.5px;
}

/* Résumé : bordure verte 2px */
.summary-title {
    text-align:center;
    color:var(--primary-color);
    font-size:1.6rem;
    margin:0 0 24px;
    padding-bottom:6px;
    border-bottom:2px solid var(--accent-color);
}

.container {
    max-width:1300px;
    margin:0 auto;
    padding:20px 20px 40px;
}

.simulator-layout {
    display:grid;
    grid-template-columns:1fr 2fr;
    gap:32px;
    align-items:flex-start;
}

.form-section,
.results-section {
    background:#fff;
    border:2px solid var(--accent-color);
    border-radius:12px;
    padding:24px;
    box-shadow:0 5px 15px rgba(0,0,0,.08);
}

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

label {
    display:block;
    margin-bottom:6px;
    font-weight:600;
    color:#005177;
}

.assurance-mode {
    display:flex;
    flex-direction:column;
    gap:6px;
    padding:8px 12px;
    background:#f4f9fb;
    border:1px solid #d2e5ec;
    border-radius:8px;
}

.assurance-mode label {
    font-weight:500;
    display:flex;
    gap:8px;
    align-items:center;
    margin:0;
    color:#2c3e50;
}

input[type="text"],
input[type="number"],
input[type="date"] {
    width:100%;
    padding:12px 14px;
    border:1px solid #bdbdbd;
    border-radius:8px;
    font-size:15px;
    transition:border-color .25s, box-shadow .25s;
    background:#fff;
}

input:focus {
    outline:none;
    border-color:var(--primary-color);
    box-shadow:0 0 0 3px rgba(0,51,160,.25);
}

.btn-calculate,
.btn-pdf {
    width:100%;
    background:var(--primary-color);
    color:#fff;
    border:none;
    padding:14px 18px;
    font-size:16px;
    font-weight:600;
    border-radius:8px;
    cursor:pointer;
    transition:background .25s;
    margin-top:6px;
}

.btn-calculate:hover,
.btn-pdf:hover {
    background:#2859c0;
}

.btn-pdf {
    background:var(--accent-color);
    color:#003;
}

.btn-pdf:hover {
    background:#12e3ae;
}

.alert {
    background:var(--error-bg);
    color:var(--error-color);
    border:1px solid var(--error-color);
    padding:16px 20px;
    border-radius:10px;
    margin-bottom:24px;
}

.summary-grid {
    display:grid;
    gap:16px;
    grid-template-columns:repeat(auto-fill,minmax(210px,1fr));
    margin-bottom:24px;
}

.summary-item {
    background:var(--light-color);
    padding:14px 16px;
    border-radius:10px;
    display:flex;
    flex-direction:column;
    gap:6px;
    box-shadow:0 2px 6px rgba(0,0,0,.05);
}

.summary-item.highlight {
    background:#fff9e6;
    border:1px solid #f4d053;
}

.label {
    font-size:13px;
    text-transform:uppercase;
    letter-spacing:.5px;
    color:var(--secondary-color);
}

.value {
    font-size:18px;
    font-weight:600;
    color:var(--primary-color);
    word-break:break-word;
}

.amortissement-wrapper { margin-top:32px; }

.table-responsive {
    width:100%;
    overflow-x:auto;
    border:1px solid #dcdcdc;
    border-radius:10px;
    background:#fff;
    -webkit-overflow-scrolling:touch;
}

table {
    width:100%;
    border-collapse:collapse;
    font-size:14px;
}

thead th {
    background:var(--primary-color);
    color:#fff;
    text-align:left;
    padding:10px 12px;
    position:sticky;
    top:0;
    z-index:2;
}

tbody td {
    padding:10px 12px;
    border-bottom:1px solid #e3e3e3;
    text-align:right;
}

tbody td:first-child,
tbody td:nth-child(2) { text-align:left; }

tbody tr:nth-child(even) { background:#f8fbfd; }
tbody tr:hover { background:#e8f3ff; }

@media (max-width:980px) {
    .simulator-layout { grid-template-columns:1fr; }
}

@media (max-width:640px) {
    .summary-grid { grid-template-columns: 1fr 1fr !important; }

    table { display:block; overflow-x:auto; -webkit-overflow-scrolling:touch; min-width:0 !important; }
    table, thead, tbody, th, tr { display:block; }
    thead { display:none; }
    tbody tr {
        background:#fff;
        margin:0 0 14px;
        border:1px solid #e2e2e2;
        border-radius:10px;
        padding:8px 10px;
    }
    tbody td {
        display:flex;
        justify-content:space-between;
        gap:12px;
        text-align:left;
        border-bottom:1px solid #ececec;
        padding:8px 10px;
    }
    tbody td::before {
        content:attr(data-label);
        font-weight:600;
        color:#2c3e50;
    }
    .table-responsive { overflow-x:auto; }
}

.visually-hidden {
    position:absolute !important;
    width:1px;
    height:1px;
    padding:0;
    margin:-1px;
    overflow:hidden;
    clip:rect(0 0 0 0);
    border:0;
}
@media (max-width:600px) {
    * { box-sizing: border-box; }
    body { overflow-x: hidden; }
    .simulator-layout { 
        grid-template-columns: 1fr !important; 
        padding: 8px !important;
    }
    .form-section, .results-section {
        width: 100% !important;
        min-width: 0 !important;
    }
    input, select, button, textarea {
        width: 100% !important;
        min-width: 0 !important;
        max-width: 100% !important;
    }
    table {
        min-width: 0 !important;
        width: 100% !important;
        font-size: 0.75rem !important;
    }
    table td, table th {
        padding: 4px 6px !important;
        word-break: break-word;
    }
    .summary-grid {
        grid-template-columns: 1fr 1fr !important;
    }
    .container {
        padding: 8px !important;
        max-width: 100% !important;
    }
}

/* MOBILE FIX FINAL */
@media (max-width:768px) {
    .simulator-layout {
        display: block !important;
    }
    .form-section,
    .results-section {
        width: 100% !important;
        min-width: 0 !important;
        max-width: 100% !important;
        margin-bottom: 20px;
    }
    .summary-grid {
        grid-template-columns: 1fr 1fr !important;
    }
    .amortissement-wrapper {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
    }
    .table-responsive {
        overflow-x: auto !important;
        max-width: 100% !important;
    }
}
