@page {
    size: A4;
    margin: 15mm;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
    font-family: Arial, Helvetica, sans-serif;
    background: #f5f5f5;
}

body {
    padding: 20px;
}

.controls {
    margin-bottom: 20px;
}

button {
    cursor: pointer;
}

.invoice {
    width: 210mm;
    min-height: 267mm;
    background: white;
    margin: auto;
    padding: 15mm;
    display: flex;
    flex-direction: column;
}

.content-area {
    flex: 1;
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.logo-area {
    width: 50%;
}

.logo {
    width: 120px;
    height: 120px;
}

.customer {
    margin-top: 15px;
    line-height: 1.5;
    width: 320px;
}

.customer input {
    width: 100%;
}

.invoice-info {
    width: 330px;
}

.invoice-title {
    background: #2d2846;
    color: white;
    font-size: 28px;
    font-weight: bold;
    padding: 15px;
    margin-bottom: 15px;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
}

.info-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
}

.info-row input {
    width: 180px;
    text-align: right;
}

input {
    border: none;
    border-bottom: 1px dotted #999;
    background: transparent;
    font: inherit;
}

input:read-only {
    border-bottom: none;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 40px;
}

thead {
    border-bottom: 2px solid black;
}

th {
    text-align: left;
    padding: 8px 4px;
}

td {
    padding: 6px 4px;
}

.row-input {
    width: 100%;
}

.qty,
.price,
.discount {
    width: 70px;
    text-align: right;
}

.number,
.lineTotal {
    text-align: right;
}

.remove-btn {
    background: #d9534f;
    color: white;
    border: none;
    padding: 4px 8px;
}

.list-btn{
    background: #8c5cb8;
    color: white;
    border: none;
    padding: 8px 14px;
    text-decoration: none;
    font-size: 13px;
}

.add-btn {
    background: #5cb85c;
    color: white;
    border: none;
    padding: 8px 14px;
}

.new-btn {
    background: #0275d8;
    color: white;
    border: none;
    padding: 8px 14px;
}

.print-btn {
    background: #f0ad4e;
    color: white;
    border: none;
    padding: 8px 14px;
}

.svg-btn {
    border: none;
    position: relative;
    top: 8px;
    background: transparent;
}

.svg-btn svg {
    width: 25px;
    height: 25px;
}

.summary {
    width: 380px;
    margin-left: auto;
    margin-top: 25px;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
}

.summary-row input[type="number"] {
    width: 120px;
    text-align: right;
}

.grand-total {
    font-weight: bold;
    font-size: 20px;
    border-top: 2px solid black;
    padding-top: 10px;
}

.footer {
    margin-top: auto;
    border-top: 3px solid black;
    padding-top: 12px;
    display: flex;
    justify-content: space-between;
}

.footer div {
    line-height: 1.5;
}

@media print {
    * {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    /* Fixes the gray background box by forcing both html and body to clean white */
    html,
    body {
        background: white !important;
        background-color: white !important;
        padding: 0;
    }

    .controls {
        display: none;
    }

    .invoice {
        width: auto;
        min-height: auto;
        margin: 0;
        padding: 0;
        display: block;
        background: transparent !important;
    }

    input {
        border: none;
    }

    .remove-btn {
        display: none;
    }

    .vat-option {
        display: none !important;
    }

    /* Aligns the footer cleanly to the bottom of the printed page layout */
    .footer {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: white !important;
    }

    .content-area {
        margin-bottom: 50mm;
        /* Space cushion so content doesn't collide with fixed footer */
        page-break-inside: auto;
    }
}