* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Arial, sans-serif;
    background: #f4f6f8;
    color: #222;
}

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


/* HEADINGS */

h1 {
    text-align: center;
    margin-bottom: 8px;
}

h2 {
    margin-top: 0;
    margin-bottom: 20px;
}

.subtitle {
    text-align: center;
    color: #666;
    margin-bottom: 30px;
}


/* CARDS */

.card {
    background: white;
    padding: 25px;
    margin-bottom: 20px;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06);
}


/* FORM */

label {
    display: block;
    margin-top: 15px;
    margin-bottom: 6px;
    font-weight: bold;
}

input,
textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #ccc;
    border-radius: 7px;
    font-size: 16px;
}

textarea {
    min-height: 100px;
    resize: vertical;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: normal;
    user-select: none;
}

.checkbox-label input {
    width: auto;
}


/* BUTTONS */

button {
    width: 100%;
    margin-top: 20px;
    padding: 14px;
    border: none;
    border-radius: 7px;
    background: #222;
    color: white;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    user-select: none;
}

button:hover {
    background: #444;
}


/* QUOTE NUMBER + DATE */

.quote-meta {
    margin-bottom: 20px;
}

.meta-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}

.meta-row strong {
    min-width: 80px;
}

.edit-button {
    width: 28px;
    height: 28px;
    margin: 0;
    padding: 0;
    background: #f1f3f5;
    color: #555;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    font-weight: normal;
}

.edit-button:hover {
    background: #e5e7eb;
    color: #222;
}


/* EDIT WINDOWS */

.edit-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}

.edit-window {
    width: 100%;
    max-width: 400px;
    background: white;
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.edit-window h3 {
    margin-top: 0;
    margin-bottom: 18px;
}

.edit-window input {
    width: 100%;
}

.edit-window-buttons {
    display: flex;
    gap: 10px;
    margin-top: 18px;
}

.edit-window-buttons button {
    margin-top: 0;
}

.cancel-edit {
    background: #f1f3f5;
    color: #333;
}

.cancel-edit:hover {
    background: #e2e5e8;
}

.save-edit {
    background: #222;
}

.save-edit:hover {
    background: #444;
}


/* QUOTE ITEMS */

.quote-item {
    display: grid;
    grid-template-columns: 1fr 80px 100px 150px 40px;
    gap: 10px;
    align-items: end;
    margin-bottom: 15px;
    padding: 15px;
    border: 1px solid #ddd;
    border-radius: 8px;
}

.quote-item input {
    margin: 0;
}

.item-field {
    display: flex;
    flex-direction: column;
}

.item-field label {
    margin-top: 0;
    margin-bottom: 6px;
    font-size: 13px;
    color: #666;
}

.remove-item {
    width: 40px;
    height: 40px;
    margin: 0;
    padding: 0;
    background: #f1f3f5;
    color: #777;
    border: 1px solid #ddd;
    border-radius: 7px;
    font-size: 16px;
    font-weight: normal;
}

.remove-item:hover {
    background: #e5e7eb;
    color: #222;
}


/* QUOTE PREVIEW */

.result {
    border: 2px solid #222;
}

.quote-header {
    text-align: left;
}

.quote-header h2 {
    text-align: left;
    margin-bottom: 20px;
    font-size: 32px;
    letter-spacing: 1px;
}

.quote-meta-preview {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 1px solid #ddd;
}

.quote-meta-preview p {
    margin: 0;
    color: #555;
}

.quote-meta-preview strong {
    color: #222;
}

.quote-header p {
    margin: 6px 0;
}


/* BUSINESS DETAILS */

.business-preview {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    margin-top: 25px;
}

.business-preview strong {
    font-size: 20px;
    margin-bottom: 6px;
}

.business-preview span {
    color: #666;
    font-size: 14px;
    white-space: pre-line;
}

.business-preview span:empty {
    display: none;
}


/* CUSTOMER */

.customer-preview {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

.customer-preview h3,
.notes-preview h3 {
    margin: 0 0 12px;
    font-size: 13px;
    font-weight: bold;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: #666;
}

.customer-preview p {
    margin: 5px 0;
    color: #555;
}

.customer-preview p:first-of-type {
    font-size: 17px;
    font-weight: bold;
    color: #222;
}

.customer-preview p:empty {
    display: none;
}


/* ITEMS PREVIEW */

.items-preview {
    margin-top: 35px;
}

.items-header,
.preview-item {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 20px;
    padding: 14px 0;
}

.items-header {
    border-bottom: 2px solid #222;
    font-weight: bold;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #555;
}

.preview-item {
    border-bottom: 1px solid #eee;
}

.preview-item span {
    color: #555;
    line-height: 1.4;
}

.preview-item strong {
    font-size: 15px;
    color: #222;
}

.items-header span:last-child,
.preview-item strong {
    text-align: right;
}


/* TOTALS */

.totals {
    margin-top: 20px;
}

.totals p {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 20px;
    margin: 0;
    padding: 2px 0;
}

.totals p strong {
    text-align: right;
    font-weight: bold;
}

.totals .grand-total {
    border: none;
    margin-top: 2px;
    padding-top: 2px;
    font-size: 20px;
    font-weight: bold;
}

.totals .grand-total span,
.totals .grand-total strong {
    font-weight: bold;
}


/* NOTES */

.notes-preview {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

.notes-preview h3 {
    margin: 0 0 12px;
    font-size: 13px;
    font-weight: bold;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: #666;
}

.notes-preview p {
    margin: 0;
    white-space: pre-line;
    line-height: 1.5;
}


/* QUOTE ACTIONS */

.quote-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 40px;
}

.quote-actions .print-button,
.quote-actions .pdf-button {
    flex: 1;
}

.quote-actions .new-quote-button {
    flex-basis: 100%;
}

.quote-actions button {
    margin-top: 0;
}

.pdf-button {
    background: #222;
}

.pdf-button:hover {
    background: #444;
}

.new-quote-button {
    background: #3b82f6;
}

.new-quote-button:hover {
    background: #2563eb;
}


/* PRINT */

@page {
    size: A4;
    margin: 0;
}

@media print {

    html,
    body {
        margin: 0;
        padding: 0;
        background: white;
    }

    .container {
        max-width: none;
        margin: 0;
        padding: 0;
    }

    body>.container>h1,
    body>.container>.subtitle,
    body>.container>.card:not(.result),
    .quote-actions {
        display: none !important;
    }

    .result {
        display: block !important;
        width: 100%;
        margin: 0;
        padding: 20mm;
        border: none;
        box-shadow: none;
        border-radius: 0;
    }

    .business-preview span,
    .customer-preview h3,
    .notes-preview h3 {
        color: #222;
    }
}

/* MOBILE */

@media (max-width: 600px) {

    .container {
        margin: 20px auto;
        padding: 12px;
    }

    .card {
        padding: 20px;
    }


    /* ITEM INPUTS */

    .quote-item {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 8px;
        align-items: center;
        padding: 12px;
    }

    .quote-item .item-description {
        grid-column: 1 / 3;
    }

    .quote-item .item-quantity {
        grid-column: 1;
    }

    .quote-item .item-unit {
        grid-column: 2;
    }

    .quote-item .item-price {
        grid-column: 1 / 3;
    }

    .quote-item .remove-item {
        grid-column: 1 / 3;
        width: 100%;
        height: 40px;
    }


    /* BUTTONS */

    .quote-actions {
        flex-direction: column;
    }

}

/* INFORMATION SECTION */

.info-section {
    margin: 40px 0 20px;
    padding: 30px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.06);
}

.info-section h2 {
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 24px;
    color: #222;
}

.info-section h3 {
    margin-top: 25px;
    margin-bottom: 10px;
    font-size: 18px;
    color: #333;
}

.info-section p {
    margin: 0 0 15px;
    line-height: 1.6;
    color: #555;
}

.info-section ol {
    margin: 0 0 15px;
    padding-left: 25px;
    color: #555;
    line-height: 1.8;
}

footer {
    text-align: center;
    margin: 30px 0;
    color: #777;
    font-size: 13px;
}

footer p {
    margin: 4px 0;
}