* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    font-family: Arial, Helvetica, sans-serif;
    background: #f4f7f5;
    color: #102c24;
}

button,
input,
textarea {
    font: inherit;
}

a {
    text-decoration: none;
    color: inherit;
}

.facture-page {
    width: min(1180px, calc(100% - 40px));
    margin: 0 auto;
    padding: 35px 0 60px;
}


/* =========================================================
   HEADER
========================================================= */

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 30px;
    margin-bottom: 30px;
}

.back-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 22px;
    color: #0b8f4d;
    font-weight: 700;
    font-size: 14px;
}

.page-title .eyebrow {
    display: block;
    margin-bottom: 8px;
    color: #0b9b50;
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 1.5px;
}

.page-title h1 {
    margin: 0;
    font-size: clamp(30px, 4vw, 44px);
    line-height: 1.08;
    letter-spacing: -1.5px;
}

.page-title p {
    margin: 12px 0 0;
    color: #72827d;
    font-size: 16px;
}

.document-badge {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 15px 18px;
    background: #ffffff;
    border: 1px solid #e3ebe7;
    border-radius: 18px;
    box-shadow: 0 8px 25px rgba(16, 44, 36, 0.05);
}

.badge-icon {
    width: 45px;
    height: 45px;
    display: grid;
    place-items: center;
    border-radius: 14px;
    background: #e9f8ef;
    font-size: 21px;
}

.document-badge strong {
    display: block;
    font-size: 13px;
    letter-spacing: 1px;
}

.document-badge small {
    display: block;
    margin-top: 4px;
    color: #7b8985;
}


/* =========================================================
   CARDS
========================================================= */

.card {
    margin-bottom: 20px;
    padding: 28px;
    background: #ffffff;
    border: 1px solid #e4ebe8;
    border-radius: 24px;
    box-shadow: 0 8px 30px rgba(16, 44, 36, 0.04);
}

.section-heading {
    margin-bottom: 25px;
}

.section-heading > div {
    display: flex;
    align-items: flex-start;
    gap: 14px;
}

.section-number {
    min-width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    background: #e8f7ee;
    color: #0a934a;
    font-size: 12px;
    font-weight: 800;
}

.section-heading h2 {
    margin: 0;
    font-size: 20px;
}

.section-heading p {
    margin: 5px 0 0;
    color: #84918d;
    font-size: 14px;
}

.section-heading-lines {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
}


/* =========================================================
   TYPE DOCUMENT
========================================================= */

.document-type-options {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
}

.document-type-option {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 18px;
    border: 1.5px solid #e2ebe7;
    border-radius: 18px;
    cursor: pointer;
    transition: .2s ease;
}

.document-type-option:hover {
    border-color: #0b9b50;
    background: #fbfffc;
}

.document-type-option.active {
    border-color: #0b9b50;
    background: #f0fbf4;
}

.document-type-option input {
    display: none;
}

.type-icon {
    width: 48px;
    height: 48px;
    display: grid;
    place-items: center;
    border-radius: 14px;
    background: #e9f8ef;
    font-size: 21px;
}

.type-content strong {
    display: block;
    font-size: 16px;
}

.type-content small {
    display: block;
    margin-top: 5px;
    color: #7e8d88;
}


/* =========================================================
   FORM
========================================================= */

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.form-group {
    min-width: 0;
}

.form-group.full {
    grid-column: 1 / -1;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #41544d;
    font-size: 13px;
    font-weight: 700;
}

.form-control,
.readonly-field {
    width: 100%;
    min-height: 48px;
    padding: 13px 15px;
    border: 1px solid #dce6e1;
    border-radius: 13px;
    background: #ffffff;
    color: #16332a;
    outline: none;
    transition: .2s ease;
}

.form-control:focus {
    border-color: #0b9b50;
    box-shadow: 0 0 0 4px rgba(11, 155, 80, .08);
}

.textarea {
    resize: vertical;
}

.readonly-field {
    display: flex;
    align-items: center;
    background: #f4f7f5;
    color: #788780;
}

.search-wrapper {
    position: relative;
}

.search-wrapper .form-control {
    padding-right: 45px;
}

.search-icon {
    position: absolute;
    top: 50%;
    right: 15px;
    transform: translateY(-50%);
}


/* =========================================================
   CLIENT RESULTS
========================================================= */

.client-results {
    position: relative;
    z-index: 10;
}

.client-result {
    display: flex;
    justify-content: space-between;
    gap: 15px;
    padding: 14px 15px;
    background: #ffffff;
    border: 1px solid #e0e8e4;
    border-top: 0;
    cursor: pointer;
}

.client-result:hover {
    background: #f0faf4;
}

.client-result strong {
    display: block;
}

.client-result small {
    color: #7d8a86;
}


/* =========================================================
   TABLE
========================================================= */

.invoice-table-wrapper {
    overflow-x: auto;
}

.invoice-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    min-width: 760px;
}

.invoice-table th {
    padding: 13px 10px;
    background: #f3f7f5;
    color: #63736d;
    font-size: 11px;
    text-align: left;
    text-transform: uppercase;
    letter-spacing: .6px;
}

.invoice-table th:first-child {
    border-radius: 12px 0 0 12px;
}

.invoice-table th:last-child {
    border-radius: 0 12px 12px 0;
}

.invoice-table td {
    padding: 10px 6px;
    border-bottom: 1px solid #edf1ef;
}

.col-number {
    width: 55px;
}

.col-quantity {
    width: 90px;
}

.col-price {
    width: 170px;
}

.col-total {
    width: 170px;
}

.col-action {
    width: 45px;
}

.table-input {
    width: 100%;
    height: 44px;
    padding: 10px 12px;
    border: 1px solid #dce6e1;
    border-radius: 10px;
    outline: none;
}

.table-input:focus {
    border-color: #0b9b50;
}

.line-number {
    text-align: center;
    font-weight: 700;
    color: #71817b;
}

.line-total {
    padding: 12px;
    font-weight: 700;
    white-space: nowrap;
}

.remove-line {
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 9px;
    background: #fff1f0;
    color: #c9483d;
    cursor: pointer;
    font-size: 20px;
}


/* =========================================================
   BUTTONS
========================================================= */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: 48px;
    padding: 0 19px;
    border: 0;
    border-radius: 13px;
    cursor: pointer;
    font-weight: 800;
    transition: .2s ease;
}

.btn-primary {
    background: #0a9749;
    color: #ffffff;
    box-shadow: 0 8px 18px rgba(10, 151, 73, .18);
}

.btn-primary:hover {
    background: #087f3e;
    transform: translateY(-1px);
}

.btn-secondary {
    background: #edf9f1;
    color: #087d3e;
}

.btn-light {
    background: #ffffff;
    color: #40534c;
    border: 1px solid #dfe8e4;
}

.btn-light:hover {
    background: #f6f9f7;
}


/* =========================================================
   SUMMARY
========================================================= */

.summary-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 30px;
    margin-bottom: 20px;
    padding: 28px;
    background: #102f26;
    color: #ffffff;
    border-radius: 24px;
}

.summary-label {
    font-size: 11px;
    letter-spacing: 1.5px;
    color: #8ed0aa;
    font-weight: 800;
}

.summary-left h3 {
    margin: 8px 0 5px;
    font-size: 22px;
}

.summary-left p {
    margin: 0;
    color: #b5c6c0;
    font-size: 14px;
}

.summary-right {
    width: min(360px, 100%);
}

.summary-row {
    display: flex;
    justify-content: space-between;
    gap: 25px;
    padding: 10px 0;
    color: #c2d0cb;
}

.summary-row strong {
    color: #ffffff;
}

.total-row {
    margin-top: 7px;
    padding-top: 17px;
    border-top: 1px solid rgba(255,255,255,.14);
    color: #ffffff;
    font-size: 17px;
}

.total-row strong {
    color: #79e4a4;
    font-size: 21px;
}


/* =========================================================
   ACTIONS
========================================================= */

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}


/* =========================================================
   RESPONSIVE
========================================================= */

@media (max-width: 800px) {

    .facture-page {
        width: min(100% - 24px, 700px);
        padding-top: 20px;
    }

    .page-header {
        flex-direction: column;
    }

    .document-badge {
        width: 100%;
    }

    .document-type-options {
        grid-template-columns: 1fr;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .form-group.full {
        grid-column: auto;
    }

    .section-heading-lines {
        align-items: flex-start;
        flex-direction: column;
    }

    .summary-card {
        flex-direction: column;
        align-items: stretch;
    }

    .summary-right {
        width: 100%;
    }

    .form-actions {
        flex-direction: column-reverse;
    }

    .form-actions .btn {
        width: 100%;
    }
}

@media (max-width: 500px) {

    .card,
    .summary-card {
        padding: 20px;
        border-radius: 18px;
    }

    .page-title h1 {
        font-size: 30px;
    }

    .page-title p {
        font-size: 14px;
    }

}

.sidebar-logo {
    width: 52px;
    height: 52px;

    display: flex;
    align-items: center;
    justify-content: center;

    flex-shrink: 0;

    overflow: hidden;

    background: transparent;

    border: none;

    box-shadow: none;
}

.sidebar-logo img {
    width: 100%;
    height: 100%;

    object-fit: contain;

    display: block;

    background: transparent;

    border: none;

    box-shadow: none;

    /* Permet au blanc de l'image de se fondre
       avec le fond clair de la sidebar */
    mix-blend-mode: multiply;
}