.h2cil,
.h2cil * {
    box-sizing: border-box;
}

.h2cil {
    --h2cil-bg: #f6f7fb;
    --h2cil-card: #ffffff;
    --h2cil-text: #172033;
    --h2cil-muted: #687085;
    --h2cil-border: #e4e7ee;
    --h2cil-border-strong: #d2d7e3;
    --h2cil-primary: #172033;
    --h2cil-primary-soft: #eef1f7;
    --h2cil-accent: #b3242d;
    --h2cil-green: #116149;
    --h2cil-warning: #8a5a00;
    --h2cil-shadow: 0 22px 55px rgba(23, 32, 51, .10);
    color: var(--h2cil-text);
    font-family: inherit;
    margin: 28px 0;
}

.h2cil-shell {
    background: linear-gradient(135deg, #f7f8fc 0%, #ffffff 42%, #f4f6fa 100%);
    border: 1px solid var(--h2cil-border);
    border-radius: 28px;
    padding: clamp(18px, 3vw, 34px);
    box-shadow: var(--h2cil-shadow);
}

.h2cil-header {
    max-width: 900px;
    margin: 0 0 26px;
}

.h2cil-kicker {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 10px;
    padding: 6px 12px;
    border-radius: 999px;
    background: var(--h2cil-primary-soft);
    color: var(--h2cil-primary);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.h2cil-header h2 {
    margin: 0;
    font-size: clamp(26px, 4vw, 44px);
    line-height: 1.08;
    letter-spacing: -.04em;
    color: var(--h2cil-text);
}

.h2cil-header p:not(.h2cil-kicker) {
    margin: 12px 0 0;
    max-width: 760px;
    color: var(--h2cil-muted);
    font-size: 16px;
    line-height: 1.55;
}

.h2cil-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(320px, .65fr);
    gap: 22px;
    align-items: start;
}

.h2cil-card,
.h2cil-result-panel {
    background: rgba(255, 255, 255, .92);
    border: 1px solid var(--h2cil-border);
    border-radius: 22px;
    box-shadow: 0 12px 28px rgba(23, 32, 51, .05);
}

.h2cil-card {
    padding: clamp(16px, 2vw, 22px);
    margin-bottom: 16px;
}

.h2cil-card-title {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.h2cil-card-title span {
    display: inline-grid;
    place-items: center;
    width: 30px;
    height: 30px;
    border-radius: 10px;
    background: var(--h2cil-primary);
    color: #fff;
    font-size: 13px;
    font-weight: 800;
}

.h2cil-card-title h3 {
    margin: 0;
    font-size: 18px;
    line-height: 1.2;
    color: var(--h2cil-text);
}

.h2cil-fields {
    display: grid;
    gap: 14px;
}

.h2cil-fields-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.h2cil label span,
.h2cil .h2cil-label-text {
    display: block;
    margin-bottom: 6px;
    color: var(--h2cil-muted);
    font-size: 13px;
    font-weight: 650;
}

.h2cil input[type="date"],
.h2cil input[type="text"],
.h2cil select {
    width: 100%;
    min-height: 44px;
    border: 1px solid var(--h2cil-border-strong);
    border-radius: 14px;
    padding: 10px 12px;
    background: #fff;
    color: var(--h2cil-text);
    font-size: 15px;
    outline: none;
    transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}

.h2cil input[type="date"]:focus,
.h2cil input[type="text"]:focus,
.h2cil select:focus {
    border-color: #909bb2;
    box-shadow: 0 0 0 4px rgba(23, 32, 51, .08);
}

.h2cil-help {
    margin: 12px 0 0;
    color: var(--h2cil-muted);
    font-size: 13px;
    line-height: 1.45;
}

.h2cil-table-wrap {
    width: 100%;
    overflow-x: auto;
    border: 1px solid var(--h2cil-border);
    border-radius: 18px;
    background: #fff;
}

.h2cil-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 650px;
}

.h2cil-table th,
.h2cil-table td {
    padding: 11px;
    border-bottom: 1px solid var(--h2cil-border);
    vertical-align: middle;
    text-align: left;
}

.h2cil-table th {
    color: var(--h2cil-muted);
    background: #fafbfe;
    font-size: 12px;
    font-weight: 750;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.h2cil-table tbody tr:last-child td {
    border-bottom: 0;
}

.h2cil-table td input {
    min-height: 40px;
}

.h2cil-primary-btn,
.h2cil-secondary-btn,
.h2cil-small-btn,
.h2cil-light-btn {
    border: 0;
    border-radius: 14px;
    cursor: pointer;
    font-family: inherit;
    font-weight: 750;
    line-height: 1;
    transition: transform .14s ease, box-shadow .14s ease, background .14s ease, opacity .14s ease;
}

.h2cil-primary-btn:hover,
.h2cil-secondary-btn:hover,
.h2cil-small-btn:hover,
.h2cil-light-btn:hover {
    transform: translateY(-1px);
}

.h2cil-primary-btn {
    min-height: 50px;
    padding: 0 22px;
    background: var(--h2cil-primary);
    color: #fff;
    box-shadow: 0 12px 26px rgba(23, 32, 51, .20);
}

.h2cil-secondary-btn,
.h2cil-light-btn {
    min-height: 42px;
    padding: 0 16px;
    margin-top: 12px;
    background: var(--h2cil-primary-soft);
    color: var(--h2cil-primary);
}

.h2cil-small-btn {
    min-height: 34px;
    padding: 0 10px;
    background: #f0f2f7;
    color: var(--h2cil-muted);
    font-size: 12px;
}

.h2cil-small-btn:not(:disabled) {
    color: var(--h2cil-accent);
}

.h2cil button:disabled {
    cursor: not-allowed;
    opacity: .45;
    transform: none !important;
}

.h2cil-toggle {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 13px 14px;
    border: 1px solid var(--h2cil-border);
    border-radius: 16px;
    background: #fff;
    font-weight: 700;
}

.h2cil-toggle input {
    margin-top: 2px;
}

.h2cil-toggle span {
    margin: 0;
    color: var(--h2cil-text);
    font-size: 15px;
}

.h2cil-payments-panel,
.h2cil-capitalization-panel {
    margin-top: 14px;
}

.h2cil-choice-row {
    display: grid;
    gap: 10px;
    padding: 14px;
    border: 1px solid var(--h2cil-border);
    border-radius: 16px;
    background: #fff;
}

.h2cil-choice-row label {
    display: flex;
    gap: 8px;
    align-items: center;
    color: var(--h2cil-text);
    font-weight: 650;
}

.h2cil-actions {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
    margin: 18px 0 0;
}

.h2cil-actions .h2cil-light-btn {
    margin-top: 0;
}

.h2cil-result-panel {
    position: sticky;
    top: 26px;
    min-height: 360px;
    padding: 20px;
}

.h2cil-result-empty {
    display: grid;
    place-items: center;
    text-align: center;
    min-height: 320px;
    color: var(--h2cil-muted);
}

.h2cil-result-empty h3 {
    margin: 12px 0 6px;
    color: var(--h2cil-text);
    font-size: 20px;
}

.h2cil-result-empty p {
    margin: 0;
    max-width: 320px;
    font-size: 14px;
    line-height: 1.5;
}

.h2cil-result-icon {
    display: inline-grid;
    place-items: center;
    width: 58px;
    height: 58px;
    border-radius: 20px;
    background: var(--h2cil-primary);
    color: #fff;
    font-size: 26px;
    font-weight: 900;
}

.h2cil-summary {
    display: grid;
    gap: 14px;
}

.h2cil-total-card {
    padding: 18px;
    border-radius: 20px;
    background: linear-gradient(135deg, var(--h2cil-primary) 0%, #2a344b 100%);
    color: #fff;
}

.h2cil-total-card p {
    margin: 0 0 7px;
    color: rgba(255,255,255,.76);
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
}

.h2cil-total-card strong {
    display: block;
    font-size: clamp(28px, 4vw, 40px);
    line-height: 1;
    letter-spacing: -.04em;
}

.h2cil-total-card small {
    display: block;
    margin-top: 9px;
    color: rgba(255,255,255,.76);
    line-height: 1.35;
}

.h2cil-metrics {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.h2cil-metric {
    padding: 13px;
    border: 1px solid var(--h2cil-border);
    border-radius: 16px;
    background: #fff;
}

.h2cil-metric span {
    display: block;
    margin-bottom: 5px;
    color: var(--h2cil-muted);
    font-size: 12px;
    font-weight: 750;
}

.h2cil-metric strong {
    display: block;
    color: var(--h2cil-text);
    font-size: 18px;
    line-height: 1.2;
}

.h2cil-alert {
    padding: 12px 14px;
    border-radius: 16px;
    background: #fff7e6;
    color: var(--h2cil-warning);
    border: 1px solid #f0d8a8;
    font-size: 13px;
    line-height: 1.45;
}

.h2cil-error-box {
    padding: 16px;
    border: 1px solid #efc1c4;
    border-radius: 18px;
    background: #fff2f3;
    color: #7f1d1d;
}

.h2cil-error-box strong {
    display: block;
    margin-bottom: 8px;
}

.h2cil-error-box ul {
    margin: 0;
    padding-left: 18px;
}

.h2cil-details {
    margin-top: 16px;
    border: 1px solid var(--h2cil-border);
    border-radius: 18px;
    overflow: hidden;
    background: #fff;
}

.h2cil-details summary {
    cursor: pointer;
    padding: 14px 16px;
    font-weight: 800;
    background: #fafbfe;
}

.h2cil-details .h2cil-table-wrap {
    border: 0;
    border-radius: 0;
}

.h2cil-detail-table {
    min-width: 960px;
    font-size: 13px;
}

.h2cil-detail-table td,
.h2cil-detail-table th {
    padding: 9px 10px;
}

.h2cil-detail-event {
    font-weight: 750;
    color: var(--h2cil-primary);
}

.h2cil-detail-payment {
    color: var(--h2cil-green);
    font-weight: 750;
}

.h2cil-detail-warning {
    color: var(--h2cil-warning);
    font-weight: 750;
}

.h2cil-print-btn {
    width: 100%;
    margin-top: 12px;
}

.h2cil-admin-wrap .h2cil-admin-intro {
    max-width: 980px;
    padding: 14px 16px;
    margin: 16px 0;
    border: 1px solid #dcdcde;
    border-radius: 12px;
    background: #fff;
}

.h2cil-admin-wrap code {
    font-size: 15px;
}

.h2cil-admin-table-wrap {
    max-width: 1180px;
    border-radius: 12px;
}

.h2cil-admin-table input[type="text"],
.h2cil-admin-table input[type="date"],
.h2cil-admin-table input[type="number"] {
    width: 100%;
    min-height: 34px;
}

@media (max-width: 980px) {
    .h2cil-grid {
        grid-template-columns: 1fr;
    }
    .h2cil-result-panel {
        position: static;
    }
}

@media (max-width: 720px) {
    .h2cil-shell {
        border-radius: 18px;
        padding: 14px;
    }
    .h2cil-fields-2,
    .h2cil-metrics {
        grid-template-columns: 1fr;
    }
    .h2cil-card,
    .h2cil-result-panel {
        border-radius: 18px;
    }
}

@media print {
    .h2cil-form,
    .h2cil-actions,
    .h2cil-print-btn,
    .h2cil-header,
    .site-header,
    .site-footer,
    header,
    footer,
    nav {
        display: none !important;
    }
    .h2cil-shell,
    .h2cil-result-panel,
    .h2cil-card {
        box-shadow: none !important;
        border: 0 !important;
        background: #fff !important;
    }
    .h2cil-grid {
        display: block;
    }
    .h2cil-result-panel {
        padding: 0;
    }
}

.h2cil-detail-output {
    margin-top: 22px;
}

.h2cil-detail-output[hidden] {
    display: none !important;
}

.h2cil-detail-card {
    padding: clamp(16px, 2vw, 22px);
    background: rgba(255, 255, 255, .96);
    border: 1px solid var(--h2cil-border);
    border-radius: 22px;
    box-shadow: 0 12px 28px rgba(23, 32, 51, .05);
}

.h2cil-detail-head {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    align-items: flex-start;
    margin-bottom: 16px;
}

.h2cil-detail-head h3 {
    margin: 0;
    color: var(--h2cil-text);
    font-size: clamp(22px, 3vw, 30px);
    letter-spacing: -.03em;
}

.h2cil-detail-head p:not(.h2cil-kicker) {
    margin: 8px 0 0;
    color: var(--h2cil-muted);
    line-height: 1.5;
    max-width: 820px;
}

.h2cil-detail-head .h2cil-secondary-btn {
    flex: 0 0 auto;
    margin-top: 0;
}

.h2cil-detail-note {
    margin: 0 0 14px;
    padding: 12px 14px;
    border-radius: 16px;
    background: var(--h2cil-primary-soft);
    color: var(--h2cil-primary);
    font-size: 13px;
    line-height: 1.45;
}

.h2cil code {
    padding: 2px 5px;
    border-radius: 6px;
    background: #f2f4f8;
    color: var(--h2cil-primary);
    font-size: .92em;
    white-space: nowrap;
}

.h2cil-detail-table {
    min-width: 1280px;
}

.h2cil-detail-table small {
    color: var(--h2cil-muted);
}

@media (max-width: 720px) {
    .h2cil-detail-head {
        display: block;
    }
    .h2cil-detail-head .h2cil-secondary-btn {
        width: 100%;
        margin-top: 14px;
    }
}

@media print {
    .h2cil-detail-output {
        margin-top: 20px;
    }
    .h2cil-detail-card {
        box-shadow: none !important;
        border: 0 !important;
        padding: 0 !important;
    }
}

.h2cil-date-readonly {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    min-height: 40px;
    padding: 8px 10px;
    border: 1px solid var(--h2cil-border);
    border-radius: 14px;
    background: #f5f6fa;
    color: var(--h2cil-text);
}

.h2cil-date-readonly span {
    margin: 0;
    color: var(--h2cil-text);
    font-size: 14px;
    font-weight: 750;
    white-space: nowrap;
}

.h2cil-date-manual input[type="date"] {
    background: #fff;
}

.h2cil-mini-link {
    border: 0;
    background: transparent;
    color: var(--h2cil-accent);
    cursor: pointer;
    font-family: inherit;
    font-size: 12px;
    font-weight: 800;
    padding: 4px 5px;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.h2cil-majoration-date-view {
    justify-content: flex-start;
}

.h2cil-case-special-help {
    padding: 10px 12px;
    border: 1px solid #f0d8a8;
    border-radius: 14px;
    background: #fff7e6;
    color: var(--h2cil-warning);
}

.h2cil-modal[hidden] {
    display: none !important;
}

.h2cil-modal {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: grid;
    place-items: center;
    padding: 18px;
}

.h2cil-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(12, 18, 32, .42);
    backdrop-filter: blur(3px);
}

.h2cil-modal-card {
    position: relative;
    z-index: 1;
    width: min(520px, 100%);
    padding: 22px;
    border: 1px solid var(--h2cil-border);
    border-radius: 24px;
    background: #fff;
    box-shadow: 0 28px 80px rgba(12, 18, 32, .22);
}

.h2cil-modal-card h3 {
    margin: 0 0 10px;
    color: var(--h2cil-text);
    font-size: 22px;
    letter-spacing: -.02em;
}

.h2cil-modal-warning {
    margin: 0 0 16px;
    padding: 12px 14px;
    border: 1px solid #f0d8a8;
    border-radius: 16px;
    background: #fff7e6;
    color: var(--h2cil-warning);
    font-size: 13px;
    line-height: 1.45;
}

.h2cil-modal-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    margin-top: 16px;
}

.h2cil-modal-actions .h2cil-light-btn {
    margin-top: 0;
}

.h2cil-modal-actions .h2cil-primary-btn {
    min-height: 42px;
}

.h2cil-amounts-table {
    min-width: 980px;
}

.h2cil-card-intro {
    margin: -4px 0 16px;
    padding: 12px 14px;
    border: 1px solid var(--h2cil-border);
    border-radius: 16px;
    background: #fafbfe;
    color: var(--h2cil-muted);
    font-size: 13px;
    line-height: 1.48;
}

.h2cil-help-inline {
    margin: 10px 0 14px;
    padding: 10px 12px;
    border-left: 3px solid var(--h2cil-border-strong);
    background: #fafbfe;
    border-radius: 12px;
}

.h2cil-toggle-soft {
    margin-top: 14px;
    background: #fafbfe;
}

.h2cil-amount-list {
    display: grid;
    gap: 12px;
}

.h2cil-amount-row {
    display: grid;
    grid-template-columns: minmax(170px, 1.4fr) minmax(120px, .8fr) minmax(155px, 1fr) minmax(155px, 1fr) auto;
    gap: 12px;
    align-items: end;
    padding: 14px;
    border: 1px solid var(--h2cil-border);
    border-radius: 18px;
    background: #fff;
}

.h2cil-amount-field {
    min-width: 0;
}

.h2cil-amount-field-action .h2cil-small-btn {
    min-height: 40px;
}

.h2cil-amount-field-date .h2cil-date-readonly {
    min-width: 0;
}

.h2cil-amount-field-date .h2cil-date-readonly span {
    min-width: 0;
}

.h2cil-payment-table-wrap .h2cil-table,
.h2cil-payments-table {
    min-width: 0;
}

@media (max-width: 1160px) {
    .h2cil-amount-row {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .h2cil-amount-field-label,
    .h2cil-amount-field-action {
        grid-column: 1 / -1;
    }
    .h2cil-amount-field-action .h2cil-label-text {
        display: none;
    }
}

@media (max-width: 620px) {
    .h2cil-amount-row {
        grid-template-columns: 1fr;
    }
    .h2cil-date-readonly {
        flex-wrap: wrap;
    }
}

/* V1.0.6 — détail des calculs plus lisible */
.h2cil-detail-head {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 18px;
    align-items: start;
}

.h2cil-detail-head > div {
    min-width: 0;
}

.h2cil-detail-head p:not(.h2cil-kicker) {
    max-width: none;
}

.h2cil-detail-head .h2cil-secondary-btn {
    width: auto;
    min-width: 220px;
}

.h2cil-detail-table tbody tr td {
    border-bottom: 2px solid var(--h2cil-border);
}

.h2cil-detail-table tbody tr td:first-child {
    border-left: 5px solid transparent;
}

.h2cil-detail-row-event td {
    background: #f8fafc;
}
.h2cil-detail-row-event td:first-child {
    border-left-color: #7d8798;
}

.h2cil-detail-row-interest-simple td {
    background: #f8fbff;
}
.h2cil-detail-row-interest-simple td:first-child {
    border-left-color: #6b7f99;
}

.h2cil-detail-row-interest-major td {
    background: #fff7f8;
}
.h2cil-detail-row-interest-major td:first-child {
    border-left-color: var(--h2cil-accent);
}

.h2cil-detail-row-majoration-start td {
    background: #fff1f2;
}
.h2cil-detail-row-majoration-start td:first-child {
    border-left-color: var(--h2cil-accent);
}

.h2cil-detail-row-payment td {
    background: #f4fbf8;
}
.h2cil-detail-row-payment td:first-child {
    border-left-color: var(--h2cil-green);
}

.h2cil-detail-row-capitalization td {
    background: #fffaf0;
}
.h2cil-detail-row-capitalization td:first-child {
    border-left-color: #b7791f;
}

.h2cil-detail-row-warning td {
    background: #fff7e6;
}
.h2cil-detail-row-warning td:first-child {
    border-left-color: var(--h2cil-warning);
}

.h2cil-detail-row-year-subtotal td {
    background: #eef1f7;
    border-top: 2px solid var(--h2cil-border-strong);
    border-bottom: 2px solid var(--h2cil-border-strong);
    font-weight: 650;
}
.h2cil-detail-row-year-subtotal td:first-child {
    border-left-color: var(--h2cil-primary);
}

@media (max-width: 900px) {
    .h2cil-detail-head {
        grid-template-columns: 1fr;
    }
    .h2cil-detail-head .h2cil-secondary-btn {
        width: 100%;
        min-width: 0;
    }
}

/* V1.0.7 — récapitulatif visuel et total général */
.h2cil-summary-section {
    padding: 13px;
    border: 1px solid var(--h2cil-border);
    border-radius: 18px;
    background: #fff;
}

.h2cil-summary-section h4 {
    margin: 0 0 10px;
    color: var(--h2cil-text);
    font-size: 13px;
    font-weight: 850;
    text-transform: uppercase;
    letter-spacing: .045em;
}

.h2cil-summary-section .h2cil-metrics {
    gap: 8px;
}

.h2cil-summary-section .h2cil-metric {
    padding: 11px;
    border-radius: 14px;
    background: #fafbfe;
}

.h2cil-summary-section-inputs {
    background: #fbfcff;
}

.h2cil-summary-section-results {
    border-color: rgba(23, 32, 51, .16);
    background: #f7f9fc;
}

.h2cil-summary-section-results .h2cil-metric {
    background: #fff;
}

.h2cil-total-card p {
    margin-bottom: 8px;
    color: rgba(255,255,255,.84);
}

.h2cil-detail-row-grand-total td {
    background: linear-gradient(135deg, var(--h2cil-primary) 0%, #2a344b 100%);
    color: #fff;
    border-top: 3px solid rgba(23, 32, 51, .95);
    border-bottom: 0;
    font-weight: 750;
}

.h2cil-detail-row-grand-total td:first-child {
    border-left-color: var(--h2cil-accent);
}

.h2cil-detail-row-grand-total code,
.h2cil-detail-row-grand-total small,
.h2cil-detail-row-grand-total strong {
    color: #fff;
}

/* V1.0.9 — résumé droit simplifié et bouton PDF de synthèse */
.h2cil-result-clean {
    display: grid;
    gap: 8px;
}

.h2cil-result-line {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 11px 12px;
    border: 1px solid var(--h2cil-border);
    border-radius: 14px;
    background: #fff;
}

.h2cil-result-line span {
    color: var(--h2cil-muted);
    font-size: 12px;
    font-weight: 760;
    line-height: 1.25;
}

.h2cil-result-line strong {
    color: var(--h2cil-text);
    font-size: 16px;
    font-weight: 850;
    text-align: right;
    white-space: nowrap;
}

.h2cil-result-line-main {
    border-color: rgba(23, 32, 51, .22);
    background: #f3f6fb;
}

.h2cil-result-line-main strong {
    font-size: 19px;
}

.h2cil-summary-actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
}

.h2cil-summary-actions .h2cil-secondary-btn,
.h2cil-summary-actions .h2cil-light-btn {
    width: 100%;
    margin-top: 0;
}

.h2cil-pdf-btn {
    justify-content: center;
}
