 /*   invoice.css (часть 1)
   Основные стили (не конфликтуют с сайтом)
   ====================================================== */

/* Только для счета */
.invoice,
.invoice *{
    box-sizing:border-box;
}

/* ------------------------------ */

.invoice{

    width:210mm;
    max-width:100%;

    min-height:297mm;

    margin:100px auto 40px;

    background:#fff;

    border:1px solid #d8d8d8;

    border-radius:8px;

    box-shadow:0 5px 25px rgba(0,0,0,.08);

    padding:12mm;

    color:#222;

    font-family:Arial,Helvetica,sans-serif;

    font-size:13px;

    visibility:visible;
}

/* ------------------------------ */

.invoice .invoice-header{
    margin-bottom:15px;
    page-break-after:avoid;
}

.invoice .invoice-header h1{

    margin:0 0 12px;

    text-align:center;

    font-size:24px;

    font-weight:700;

    color:#111;

    text-transform:uppercase;

    letter-spacing:.5px;

}

/* ------------------------------ */

.invoice .invoice-meta{

    display:flex;

    justify-content:space-between;

    gap:20px;

    margin-bottom:10px;

}

.invoice .field{

    flex:1;

}

.invoice .field label{

    display:block;

    margin-bottom:4px;

    font-weight:bold;

    font-size:12px;

}

.invoice .field input{

    width:100%;

}

/* ------------------------------ */

.invoice input{

    width:100%;

    height:28px;

    padding:4px 6px;

    border:1px solid #999;

    outline:none;

    background:#fff;

    font-size:13px;

    transition:.2s;

}

.invoice input:focus{

    border-color:#1565c0;

}

/* ------------------------------ */

.invoice table{

    width:100%;

    border-collapse:collapse;

}

/* ------------------------------ */

.invoice .details{

    margin-bottom:12px;

}

.invoice .details th{

    padding:7px;

    border:1px solid #555;

    background:#f2f2f2;

    text-align:left;

    font-size:13px;

}

.invoice .details td{

    border:1px solid #777;

    padding:3px 6px;

    height:30px;

}

.invoice .details td:first-child{

    width:140px;

    background:#fafafa;

    font-weight:bold;

}

/* ------------------------------ */

.invoice .items{

    margin-top:10px;

}

.invoice .items thead th{

    padding:7px;

    border:1px solid #555;

    background:#2f5ea7;

    color:#fff;

    text-align:center;

    font-size:13px;

}

.invoice .items tbody td{

    border:1px solid #777;

    padding:2px;

    height:30px;

}

.invoice .items input{

    border:none;

    height:24px;

    padding:3px 5px;

    background:transparent;

}

.invoice .items input:focus{

    background:#eef6ff;

}

/* Выравнивание */

.invoice .items td:nth-child(1){

    text-align:center;

}

.invoice .items td:nth-child(4),

.invoice .items td:nth-child(5),

.invoice .items td:nth-child(6){

    text-align:right;

}

/* ------------------------------ */

.invoice .remove-row{

    width:24px;

    height:24px;

    border:none;

    border-radius:4px;

    background:#d32f2f;

    color:#fff;

    cursor:pointer;

    transition:.2s;

}

.invoice .remove-row:hover{

    background:#b71c1c;

}




/* ======================================================
   invoice.css (часть 2)
   Кнопки, итоги, подпись, печать A4
   ====================================================== */

/* ------------------------------ */
/* Кнопки */

.invoice .invoice-actions{

    margin:12px 0;

}

.invoice .invoice-actions button,

.invoice .buttons button{

    display:inline-block;

    padding:8px 16px;

    border:none;

    border-radius:4px;

    background:#1565c0;

    color:#fff;

    font-size:13px;

    cursor:pointer;

    transition:.2s;

}

.invoice .invoice-actions button:hover,

.invoice .buttons button:hover{

    background:#0d47a1;

}

.invoice .buttons{

    margin-top:20px;

    text-align:center;

}

.invoice .buttons button{

    margin:0 6px;

}

/* ------------------------------ */
/* Итоги */

.invoice .totals{

    display:flex;

    justify-content:flex-end;

    margin-top:15px;

}

.invoice .totals td:first-child{
    width:90px;
    white-space:nowrap;
}

.invoice .totals td{

    border:1px solid #777;

    padding:6px;

    height:30px;

}

.invoice .totals td:first-child{

    width:140px;

    background:#fafafa;

    font-weight:bold;

}

.invoice .totals input{

    border:none;

    text-align:right;

    background:transparent;

    font-weight:bold;

}

.invoice .grand td{

    background:#eef6ff;

    font-size:14px;

    font-weight:700;

}

/* ------------------------------ */
/* Подпись */

.invoice .signature{
    margin-top:35px;
    page-break-inside:avoid;
    display:flex;
    justify-content:space-between;
    align-items:flex-end;
    gap:30px;
    font-size:13px;
}

.invoice .signature div{
    min-width:250px;
}

/* ------------------------------ */
/* Компактный режим */

.invoice .details td,

.invoice .items td{

    height:28px;

}

.invoice .items input,

.invoice .details input{

    height:22px;

    font-size:12px;

}

.invoice .items th{

    padding:6px;

}

.invoice .details th{

    padding:6px;

}

/* ------------------------------ */
/* Мобильные */

@media (max-width:900px){

    .invoice{

        width:100%;

        min-height:auto;

        margin:30px auto;

        padding:20px;

    }

    .invoice .invoice-meta{

        flex-direction:column;

        gap:10px;

    }

    .invoice .totals{

        justify-content:stretch;

    }

    .invoice .totals table{

        width:100%;

    }

    .invoice .signature{

        flex-direction:column;

        gap:20px;

    }

    .invoice .items{

        display:block;

        overflow-x:auto;

    }

}

/* ------------------------------ */
/* Печать */

@page{
    size:A4;
    margin:8mm;
}

@media print{
    
    html,
    body{
        background:#fff;
        margin:0;
        padding:0;
    }

    body *{
        visibility:hidden;
    }

    .invoice,
    .invoice *{
        visibility:visible;
    }

    .invoice{
        position:relative;
        width:100%;
        max-width:100%;
        margin:0;
        padding:12mm;
        border:none;
        border-radius:0;
        box-shadow:none;
    
        flex-direction:column;
        background:#fff;
    }

    .invoice .invoice-header{
        page-break-after:avoid;
    }

    .invoice table{
        page-break-inside:auto;
    }

    .invoice tr{
        page-break-inside:avoid;
    }

    .invoice thead{
        display:table-header-group;
    }

    .invoice tfoot{
        display:table-footer-group;
    }

    .invoice .signature{
        margin-top:auto;
        page-break-inside:avoid;
    }

    .invoice .buttons,
    .invoice .invoice-actions,
    .invoice .remove-row{
        display:none !important;
    }

    .invoice input{
        border:none;
        background:transparent;
        padding:0;
        height:auto;
        color:#000;
    }

    .print-footer {
        display: block !important;
        visibility: visible !important;

        position: fixed;
        left: 8mm;
        right: 8mm;
        bottom: 8mm;

        text-align: center;
        font-size: 10pt;
        color: #666;

        border-top: 1px solid #999;
        padding-top: 2mm;
        background: white;
    }


}


/* ===== Розділи договору ===== */

/*.invoice .contract-section{
    margin:24px 0;
    padding-top:10px;
    border-top:1px solid #d9d9d9;
}*/

.invoice .contract-section:first-of-type{
    border-top:none;
    padding-top:0;
}

.invoice .contract-section h3{
    margin:0 0 12px;
    font-size:18px;
    font-weight:700;
    color:#111;
}

.invoice .contract-section p{
    margin:0 0 10px;
    line-height:1.2;
    text-align:justify;
}

.invoice .contract-section strong{
    font-weight:700;
}


.total-text{
    margin-top:8px;
    font-size:14px;
    line-height:1.5;
}

.total-text strong{
    display:inline-block;
    min-width:180px;
}