* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --dark: #092328;
    --deep-green: #12544F;
    --green: #2A835F;
    --light-green: #8BBB92;

    --text: #0d2629;
    --soft: #637073;
    --line: #dfe5e3;
    --surface: #f7faf8;
}

body {
    min-height: 100vh;

    font-family: "Inter", sans-serif;

    background: #ffffff;

    color: var(--text);
}


/* HEADER */

.invoice-header {
    position: fixed;

    top: 0;
    left: 0;

    width: 100%;

    z-index: 1000;

    display: flex;
    justify-content: space-between;
    align-items: center;

    padding: 22px 4%;

    background: rgba(255,255,255,0.94);

    backdrop-filter: blur(16px);

    border-bottom: 1px solid rgba(9,35,40,0.06);
}

.back-link {
    color: var(--soft);

    text-decoration: none;

    font-size: 12px;
    font-weight: 500;
}

.invoice-logo {
    display: flex;

    font-size: 22px;
    font-weight: 700;

    letter-spacing: -1.3px;
}

.logo-main {
    color: var(--dark);
}

.logo-accent {
    color: var(--green);
}


/* PAGE */

.invoice-page {
    width: 100%;
    max-width: 1120px;

    margin: 0 auto;

    padding:
        140px 24px
        100px;
}


/* TITLE */

.invoice-title-section {
    margin-bottom: 70px;
}

.eyebrow {
    margin-bottom: 12px;

    color: var(--green);

    font-size: 11px;
    font-weight: 600;

    text-transform: uppercase;

    letter-spacing: 0.7px;
}

.invoice-title-section h1 {
    font-size: clamp(52px, 7vw, 88px);

    line-height: 0.95;

    letter-spacing: -4px;

    margin-bottom: 22px;
}

.subtitle {
    max-width: 620px;

    color: var(--soft);

    font-size: 16px;
    line-height: 1.6;
}


/* COMPANY */

.company-block {
    padding: 30px 0;

    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);

    display: flex;
    justify-content: space-between;

    gap: 40px;

    margin-bottom: 70px;
}

.label {
    display: block;

    margin-bottom: 8px;

    color: var(--green);

    font-size: 10px;
    font-weight: 600;

    text-transform: uppercase;
}

.company-block h2 {
    font-size: 28px;

    letter-spacing: -1.4px;
}

.company-details {
    max-width: 480px;

    display: flex;
    flex-wrap: wrap;

    justify-content: flex-end;

    gap: 8px 22px;

    color: var(--soft);

    font-size: 12px;
}


/* SECTION */

.form-section {
    margin-bottom: 80px;
}

.section-head {
    margin-bottom: 30px;
}

.section-number {
    margin-bottom: 8px;

    color: var(--green);

    font-size: 10px;
    font-weight: 600;
}

.section-head h2 {
    font-size: 34px;

    letter-spacing: -1.7px;
}


/* FORM */

.form-grid {
    display: grid;

    grid-template-columns:
        repeat(2, minmax(0, 1fr));

    gap: 22px;
}

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

    gap: 8px;
}

.field-wide {
    grid-column: 1 / -1;
}

.field label {
    color: #4e5c5f;

    font-size: 11px;
    font-weight: 500;
}

.field input,
.field textarea {
    width: 100%;

    padding: 14px 15px;

    border: 1px solid var(--line);

    border-radius: 12px;

    background: #ffffff;

    color: var(--text);

    font-family: inherit;

    font-size: 14px;

    outline: none;

    transition:
        border-color 0.2s ease,
        box-shadow 0.2s ease;
}

.field input:focus,
.field textarea:focus {
    border-color: var(--light-green);

    box-shadow:
        0 0 0 4px rgba(139,187,146,0.12);
}


/* BUYER MODE */

.buyer-mode {
    display: flex;

    gap: 8px;

    margin-bottom: 24px;
}

.mode-button {
    padding: 10px 14px;

    border: 1px solid var(--line);

    border-radius: 10px;

    background: white;

    color: var(--text);

    font-family: inherit;

    font-size: 11px;

    cursor: pointer;
}

.mode-button.active {
    background: var(--dark);

    border-color: var(--dark);

    color: white;
}

.pib-search {
    display: none;

    margin-bottom: 26px;
}

.pib-search.visible {
    display: block;
}

.inline-input {
    display: flex;

    gap: 8px;
}

.inline-input input {
    flex: 1;
}

.inline-input button {
    padding: 0 18px;

    border: none;

    border-radius: 10px;

    background: var(--green);

    color: white;

    font-family: inherit;

    cursor: pointer;
}

.pib-field small {
    color: #8a9496;

    font-size: 10px;
}


/* ITEMS */

.items-list {
    display: flex;
    flex-direction: column;

    gap: 12px;
}

.invoice-item {
    display: grid;

    grid-template-columns:
        minmax(220px, 2.2fr)
        100px
        100px
        140px
        120px
        90px
        120px
        38px;

    gap: 12px;

    align-items: end;

    padding: 18px;

    border: 1px solid var(--line);

    border-radius: 16px;

    background: var(--surface);
}
.invoice-item .field {
    min-width: 0;
}

.invoice-item .field input,
.invoice-item .field select {
    width: 100%;
    height: 48px;

    padding: 0 14px;

    border: 1px solid var(--line);
    border-radius: 12px;

    background: #ffffff;

    color: var(--text);

    font-family: inherit;
    font-size: 14px;

    box-sizing: border-box;
}

.invoice-item .field select {
    cursor: pointer;
}

.item-total-box {
    height: 48px;

    display: flex;
    flex-direction: column;

    justify-content: center;

    gap: 2px;

    white-space: nowrap;
}
.item-total-box span {
    color: #778386;

    font-size: 9px;
}

.item-total-box strong {
    font-size: 13px;
}

.remove-item {
    width: 34px;
    height: 34px;

    align-self: end;
    justify-self: center;

    margin-bottom: 7px;

    border: none;

    border-radius: 50%;

    background: #ffffff;

    color: #768285;

    font-size: 18px;

    cursor: pointer;
}


.add-item-button {
    margin-top: 14px;

    padding: 11px 16px;

    border: 1px solid var(--line);

    border-radius: 10px;

    background: #ffffff;

    color: var(--text);

    font-family: inherit;

    font-size: 11px;

    cursor: pointer;
}


/* PAYMENT */

.payment-grid {
    display: grid;

    grid-template-columns:
        repeat(3, 1fr);

    gap: 1px;

    border: 1px solid var(--line);

    border-radius: 16px;

    overflow: hidden;

    background: var(--line);

    margin-bottom: 24px;
}

.payment-grid > div {
    padding: 22px;

    background: #ffffff;
}

.payment-label {
    display: block;

    margin-bottom: 8px;

    color: var(--green);

    font-size: 9px;
    font-weight: 600;

    text-transform: uppercase;
}

.payment-grid strong {
    font-size: 13px;
}

.note-field textarea {
    resize: vertical;
}


/* SUMMARY */

.invoice-summary {
    padding-top: 35px;

    border-top: 1px solid var(--line);

    display: flex;
    justify-content: space-between;
    align-items: center;

    gap: 30px;
}

.invoice-summary span {
    display: block;

    margin-bottom: 7px;

    color: var(--soft);

    font-size: 11px;
}

.invoice-summary strong {
    font-size: 34px;

    letter-spacing: -1.5px;
}

.preview-button {
    padding: 14px 22px;

    border: none;

    border-radius: 12px;

    background: var(--dark);

    color: white;

    font-family: inherit;

    font-size: 12px;
    font-weight: 600;

    cursor: pointer;
}


/* MOBILE */

@media (max-width: 760px) {

    .invoice-header {
        padding: 17px 18px;
    }

    .invoice-logo {
        font-size: 18px;
    }

    .invoice-page {
        padding:
            105px 16px
            60px;
    }

    .invoice-title-section {
        margin-bottom: 50px;
    }

    .invoice-title-section h1 {
        font-size: 48px;

        letter-spacing: -2.8px;
    }

    .subtitle {
        font-size: 13px;
    }

    .company-block {
        flex-direction: column;

        gap: 20px;

        margin-bottom: 55px;
    }

    .company-details {
        justify-content: flex-start;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .field-wide {
        grid-column: auto;
    }

        .invoice-item {
        grid-template-columns:
            minmax(0, 1fr)
            minmax(0, 1fr);

        gap: 12px;
    }

    .item-name {
        grid-column: 1 / -1;
    }

    .item-total-box {
        grid-column: 1 / 2;
    }

    .remove-item {
        grid-column: 2 / 3;

        justify-self: end;
        align-self: center;

        margin-bottom: 0;
    }

    .payment-grid {
        grid-template-columns: 1fr;
    }

    .invoice-summary {
        flex-direction: column;

        align-items: stretch;
    }

    .preview-button {
        width: 100%;
    }

}





/* =====================================
   PREVIEW
===================================== */

.invoice-preview-wrapper {
    display: none;

    margin-top: 50px;
}

.invoice-preview-wrapper.visible {
    display: block;
}

.invoice-page.preview-mode
.form-section,
.invoice-page.preview-mode
.company-block,
.invoice-page.preview-mode
.invoice-summary,
.invoice-page.preview-mode
.invoice-title-section {
    display: none;
}


.preview-toolbar {
    margin-bottom: 24px;

    display: flex;
    justify-content: space-between;
    align-items: center;

    gap: 12px;
}

.secondary-button {
    padding: 12px 18px;

    border: 1px solid var(--line);

    border-radius: 10px;

    background: white;

    color: var(--text);

    font-family: inherit;

    font-size: 11px;
    font-weight: 600;

    cursor: pointer;
}


.invoice-preview {
    width: 100%;
    max-width: 900px;

    min-height: 1200px;

    margin: 0 auto;

    padding: 60px;

    background: white;

    border: 1px solid #e3e8e6;

    box-shadow:
        0 30px 80px rgba(9,35,40,0.10);

    color: #162527;
}


/* HEADER */

.preview-header {
    display: flex;
    justify-content: space-between;

    gap: 60px;

    padding-bottom: 40px;

    border-bottom: 2px solid #162527;
}

.preview-seller {
    max-width: 360px;
}

.preview-brand {
    margin-bottom: 18px;

    font-size: 28px;
    font-weight: 700;

    letter-spacing: -1.5px;
}

.preview-seller p {
    margin-bottom: 5px;

    color: #546265;

    font-size: 12px;

    line-height: 1.5;
}


.preview-document-info {
    text-align: right;
}

.preview-kicker {
    margin-bottom: 6px;

    color: var(--green);

    font-size: 11px;
    font-weight: 700;

    letter-spacing: 1px;
}

.preview-document-info h2 {
    margin-bottom: 24px;

    font-size: 34px;

    letter-spacing: -1.8px;
}

.preview-meta {
    display: grid;

    gap: 10px;
}

.preview-meta div {
    display: flex;
    justify-content: space-between;

    gap: 25px;
}

.preview-meta span {
    font-size: 11px;
}

.preview-meta strong {
    font-size: 13px;
}

.preview-meta small {
    font-size: 12px;
    font-weight: 500;
    color: #59676a;
}

/* BUYER */

.preview-buyer-section {
    width: 100%;
    max-width: 420px;

    margin-left: auto;

    padding: 40px 0;

    text-align: right;
}

.preview-label {
    display: block;

    margin-bottom: 9px;

    color: var(--green);

    font-size: 10px;
    font-weight: 700;

    text-transform: uppercase;
}

.preview-buyer-section h3 {
    margin-bottom: 12px;

    font-size: 25px;

    letter-spacing: -1.2px;
}

.preview-buyer-section p {
    margin-bottom: 4px;

    color: #59676a;

    font-size: 11px;
}


/* TABLE */

.preview-table {
    width: 100%;

    border-collapse: collapse;
}

.preview-table th {
    padding: 12px 10px;

    border-bottom: 1px solid #cfd7d4;

    color: #738082;

    font-size: 9px;
    font-weight: 700;

    text-transform: uppercase;

    text-align: right;
}

.preview-table th:first-child {
    text-align: left;
}

.preview-table td {
    padding: 16px 10px;

    border-bottom: 1px solid #e5e9e7;

    font-size: 11px;

    text-align: right;
}

.preview-table td:first-child {
    text-align: left;

    font-weight: 500;
}


/* TOTAL */

.preview-total-section {
    margin-top: 50px;

    display: flex;
    justify-content: space-between;

    gap: 50px;
}

.preview-payment-info {
    max-width: 430px;

    flex: 1;
}

.preview-payment-info p {
    margin-bottom: 14px;
}

.preview-payment-info span {
    display: block;

    margin-bottom: 4px;

    color: #7a8587;

    font-size: 9px;

    text-transform: uppercase;
}

.preview-payment-info strong {
    font-size: 11px;
}


.preview-total {
    min-width: 250px;

    padding-top: 5px;

    text-align: right;
}

.preview-total span {
    display: block;

    margin-bottom: 9px;

    color: #687577;

    font-size: 11px;
}

.preview-total strong {
    font-size: 30px;

    letter-spacing: -1.5px;
}


/* FOOTER */

.preview-footer {
    margin-top: 80px;

    padding-top: 20px;

    border-top: 1px solid #dfe5e3;

    color: #7b8688;

    font-size: 10px;
}


/* =====================================
   MOBILE PREVIEW
   A4 SADRŽAJ OSTAJE DESKTOP RASPORED
===================================== */

@media screen and (max-width: 760px) {

    .preview-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .invoice-page-sheet .preview-header {
        display: flex !important;
        flex-direction: row !important;

        justify-content: space-between !important;
        align-items: flex-start !important;

        gap: 60px !important;
    }

    .invoice-page-sheet .preview-seller {
        max-width: 360px !important;
    }

    .invoice-page-sheet .preview-document-info {
        text-align: right !important;
        margin-left: auto !important;
    }

    .invoice-page-sheet .preview-meta div {
        display: flex !important;
        justify-content: space-between !important;
        gap: 25px !important;
    }

    .invoice-page-sheet .preview-buyer-section {
        margin-left: auto !important;
        text-align: right !important;
    }

    .invoice-page-sheet .preview-total-section {
        display: block !important;
    }

    .invoice-page-sheet .preview-total-bottom {
        text-align: right !important;
    }

    .invoice-page-sheet .preview-signature-right {
        margin-left: auto !important;
        text-align: center !important;
    }

    .invoice-page-sheet .preview-table {
        font-size: inherit !important;
    }

}








.preview-total-section {
    margin-top: 70px;

    display: block;
}

.preview-note-block {
    max-width: 620px;

    color: #536164;

    font-size: 11px;

    line-height: 1.7;
}

.preview-note-block p {
    margin-bottom: 5px;
    white-space: pre-line;
}

.preview-small-title {
    display: block;

    margin-bottom: 10px;

    color: var(--green);

    font-size: 9px;
    font-weight: 700;

    text-transform: uppercase;
}

.preview-total-bottom {
    margin-top: 55px;

    padding-top: 25px;

    border-top: 2px solid #162527;

    text-align: right;
}
.preview-total-row {
    display: flex;
    justify-content: flex-end;
    align-items: baseline;
    gap: 14px;
    margin-bottom: 6px;
}

.preview-total-row span {
    min-width: 150px;
    text-align: right;
    color: #162527;
    font-size: 11px;
}

.preview-total-row strong {
    min-width: 170px;
    text-align: right;
    display: inline-block;
}

.preview-grand-total {
    margin-top: 8px;
}

.preview-grand-total span {
    font-size: 18px;
}

.preview-grand-total strong {
    font-size: 18px;
}

.preview-total-bottom > span {
    display: block;

    margin-bottom: 8px;

    color: #687577;

    font-size: 11px;
}

.preview-total-bottom > strong {
    display: block;

    font-size: 34px;

    letter-spacing: -1.7px;
}

#previewAmountWords {
    margin-top: 8px;

    color: #59676a;

    font-size: 11px;
    font-weight: 500;
}
.preview-bank-account {
    margin-top: 16px !important;

    color: #162527 !important;

    font-size: 13px !important;
    font-weight: 500;
}

.preview-bank-account strong {
    font-weight: 700;
}

.preview-company-logo {
    display: block;

    max-width: 150px;
    max-height: 75px;

    object-fit: contain;

    margin-bottom: 18px;
}





.invoice-data-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 210px;
    gap: 24px;
    align-items: start;
}

.invoice-data-fields {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 22px 20px;
}

.invoice-data-fields .field-full {
    grid-column: 1 / -1;
}


/* CRVENA NAPOMENA */

.optional-fields-note {
    margin-top: 23px;

    padding: 15px;

    border: 1px solid rgba(195, 62, 62, 0.22);
    border-radius: 12px;

    background: #fff8f8;

    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.optional-note-icon {
    flex: 0 0 auto;

    width: 20px;
    height: 20px;

    border-radius: 50%;

    display: grid;
    place-items: center;

    background: #c83f3f;
    color: #ffffff;

    font-size: 11px;
    font-weight: 700;
}

.optional-fields-note p {
    color: #a53838;

    font-size: 10px;
    font-weight: 500;

    line-height: 1.5;
}


@media (max-width: 900px) {

    .invoice-data-layout {
        grid-template-columns: 1fr;
    }

    .optional-fields-note {
        margin-top: 0;
    }

}


@media (max-width: 600px) {

    .invoice-data-fields {
        grid-template-columns: 1fr;
    }

    .invoice-data-fields .field-full {
        grid-column: auto;
    }

}

.preview-signature-right {
    width: 280px;
    margin-top: 70px;
    margin-left: auto;
    text-align: center;
}

.signature-space {
    height: 70px;
}

.signature-line-right {
    width: 100%;
    height: 1px;
    background: #162527;
    margin-bottom: 10px;
}

.preview-signature-right span {
    display: block;
    color: #59676a;
    font-size: 11px;
    font-weight: 500;
}





/* =====================================
   A4 MULTI PAGE INVOICE
===================================== */

.invoice-pages {
    width: 100%;
}

.invoice-page-sheet {
    width: 210mm;
    min-height: 297mm;

    margin: 0 auto 32px;

    padding: 18mm 17mm 18mm;

    position: relative;

    background: #ffffff;

    color: #162527;

    border: 1px solid #e2e7e5;

    box-shadow:
        0 25px 70px
        rgba(9,35,40,0.10);

    overflow: hidden;
}


/* BROJ STRANE */

.invoice-page-number {
    position: absolute;

    right: 17mm;
    bottom: 9mm;

    color: #889294;

    font-size: 9px;
}


/* HEADER NA DRUGOJ, TREĆOJ... STRANI */

.continuation-header {
    margin-bottom: 32px;

    padding-bottom: 16px;

    border-bottom: 1px solid #dfe5e3;

    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 20px;
}

.continuation-header strong {
    color: #092328;

    font-size: 15px;
    font-weight: 600;

    letter-spacing: -0.4px;
}

.continuation-header span {
    color: #667477;

    font-size: 10px;
}


/* TABELA */

.invoice-page-sheet
.preview-items-section {
    width: 100%;
}

.invoice-page-sheet
.preview-table {
    width: 100%;

    border-collapse: collapse;
}

.invoice-page-sheet
.preview-table th {
    padding: 11px 9px;

    border-bottom: 1px solid #cfd7d4;

    color: #718082;

    font-size: 9px;
    font-weight: 600;

    text-align: right;

    text-transform: uppercase;
}

.invoice-page-sheet
.preview-table th:first-child {
    text-align: left;
}

.invoice-page-sheet
.preview-table td {
    padding: 15px 9px;

    border-bottom: 1px solid #e5e9e7;

    color: #263638;

    font-size: 11px;

    text-align: right;

    vertical-align: top;
}

.invoice-page-sheet
.preview-table td:first-child {
    width: 44%;

    text-align: left;

    font-weight: 500;

    word-break: break-word;
}


/* POSLEDNJA STRANA */

.invoice-page-sheet
.preview-total-section {
    margin-top: 48px;
}

.invoice-page-sheet
.preview-total-bottom {
    margin-top: 45px;
}

.preview-amount-words {
    margin-top: 9px;

    color: #59676a;

    font-size: 11px;
    font-weight: 500;
}


/* MOBILE PREVIEW */

@media (max-width: 900px) {

    .invoice-pages {
        overflow-x: auto;

        padding-bottom: 15px;
    }

    .invoice-page-sheet {
        width: 210mm;

        margin-bottom: 22px;

        transform-origin: top left;
    }

}


/* PRINT / PDF */

@media print {

    body {
        background: #ffffff !important;
    }

    .invoice-header,
    .preview-toolbar {
        display: none !important;
    }

    .invoice-pages {
        width: auto;

        overflow: visible;
    }

    .invoice-page-sheet {
        width: 210mm;
        min-height: 297mm;

        margin: 0;

        border: none;

        box-shadow: none;

        page-break-after: always;
        break-after: page;
    }

    .invoice-page-sheet:last-child {
        page-break-after: auto;
        break-after: auto;
    }

}
/* =====================================
   STRICT A4 FORMAT
===================================== */

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

.invoice-page-sheet {
    width: 210mm !important;
    height: 297mm !important;
    min-height: 297mm !important;

    margin: 0 auto 32px;

    padding: 18mm 17mm 18mm;

    box-sizing: border-box;

    overflow: hidden;

    background: #ffffff;
}


/* PREVIEW NA EKRANU */

.invoice-pages {
    width: 100%;
}

@media screen {

    .invoice-page-sheet {
        border: 1px solid #e2e7e5;

        box-shadow:
            0 25px 70px
            rgba(9,35,40,0.10);
    }

}


/* PRINT / PDF */

@media print {

    html,
    body {
        width: 210mm;
        margin: 0 !important;
        padding: 0 !important;

        background: #ffffff !important;
    }

    .invoice-header,
    .preview-toolbar {
        display: none !important;
    }

    .invoice-pages {
        width: 210mm;

        margin: 0;
        padding: 0;

        overflow: visible !important;
    }

    .invoice-page-sheet {
        width: 210mm !important;
        height: 297mm !important;
        min-height: 297mm !important;

        margin: 0 !important;

        border: none !important;
        box-shadow: none !important;

        page-break-after: always;
        break-after: page;

        page-break-inside: avoid;
        break-inside: avoid;
    }

    .invoice-page-sheet:last-child {
        page-break-after: auto;
        break-after: auto;
    }

}








/* =====================================
   PDF EXPORT MODE
===================================== */

.pdf-exporting .invoice-pages {
    width: 210mm !important;

    margin: 0 !important;
    padding: 0 !important;

    background: #ffffff !important;

    overflow: visible !important;
}


@media screen and (max-width: 900px) {

    .invoice-preview-wrapper {
        overflow-x: hidden;
    }

    .invoice-pages {
        width: 100%;

        overflow: hidden;

        display: flex;
        flex-direction: column;
        align-items: center;
    }

}


/* =====================================
   MOBILE DATE INPUT FIX
===================================== */

@media (max-width: 760px) {

    html,
    body {
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
    }

    .invoice-page,
    .invoice-data-layout,
    .invoice-data-fields,
    .form-section,
    .field {
        width: 100%;
        max-width: 100%;
        min-width: 0;
        box-sizing: border-box;
    }

    .invoice-data-fields {
        grid-template-columns: minmax(0, 1fr);
    }

    .field input,
    .field textarea,
    .field select {
        width: 100%;
        max-width: 100%;
        min-width: 0;

        box-sizing: border-box;
    }

    input[type="date"] {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;

        display: block;

        box-sizing: border-box;

        -webkit-appearance: none;
        appearance: none;
    }

}

/* =====================================
   MOBILE INVOICE LAYOUT POLISH
===================================== */

@media (max-width: 760px) {

    .invoice-page {
        width: 100%;
        max-width: 100%;
        padding-left: 18px;
        padding-right: 18px;
        box-sizing: border-box;
    }

    .invoice-title-section,
    .company-block,
    .form-section,
    .invoice-summary {
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }

    .invoice-header {
        padding-left: 18px;
        padding-right: 18px;
        box-sizing: border-box;
    }

    .invoice-title-section h1 {
        font-size: 42px;
        line-height: 1;
    }

    .company-block h2 {
        font-size: 27px;
        line-height: 1.1;
    }

    .section-head h2 {
        font-size: 34px;
        line-height: 1.05;
    }

    .form-grid,
    .buyer-grid,
    .payment-grid,
    .invoice-data-fields {
        grid-template-columns: minmax(0, 1fr) !important;
        gap: 18px;
    }

    .field {
        width: 100%;
        max-width: 100%;
        min-width: 0;
    }

    .field input,
    .field textarea,
    .field select {
        width: 100%;
        max-width: 100%;
        min-width: 0;
        box-sizing: border-box;
    }

    input[type="date"] {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;

        font-size: 16px;

        box-sizing: border-box;
    }

}

@media (max-width: 760px) {

    input[type="date"] {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;

        box-sizing: border-box !important;

        display: block;
    }

    .invoice-data-fields .field {
        width: 100%;
        max-width: 100%;
        min-width: 0;
    }

    .invoice-data-fields .field input {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;

        box-sizing: border-box !important;
    }

}
@media (max-width: 760px) {

    input[type="date"] {
        -webkit-appearance: none;
        appearance: none;
    }

}

@media (max-width: 760px) {

    .invoice-data-fields input {
        height: 52px !important;
        padding: 14px 15px !important;
        box-sizing: border-box !important;
    }

    .invoice-data-fields input[type="date"] {
        height: 52px !important;
        min-height: 52px !important;

        padding: 14px 15px !important;

        line-height: normal !important;

        -webkit-appearance: none;
        appearance: none;
    }

}





/* =====================================
   PREVIEW MODE - CLEAN LAYOUT
===================================== */

.invoice-page.preview-mode
.invoice-title-section,

.invoice-page.preview-mode
.company-block,

.invoice-page.preview-mode
.form-section,

.invoice-page.preview-mode
.invoice-summary {
    display: none !important;
}


/* preview odmah ispod headera */




.invoice-preview-wrapper {
    margin-top: 0 !important;
    padding-top: 0 !important;
}


.invoice-preview-wrapper.visible {
    display: block !important;

    width: 100%;
    max-width: 100%;

    margin: 0 !important;
    padding: 0 !important;

    box-sizing: border-box;
}


/* =====================================
   PREVIEW TOOLBAR
===================================== */

.preview-toolbar {
    width: 100%;
    max-width: 100%;

    margin: 0 auto 28px !important;

    display: flex;
    align-items: center;
    justify-content: center;

    gap: 12px;

    box-sizing: border-box;
}


/* MOBILE */

  @media (max-width: 760px) {

    .invoice-page.preview-mode {
        padding:
            85px 16px 30px !important;
    }

    .preview-toolbar {
        display: grid;

        grid-template-columns: 1fr;

        gap: 12px;

        margin-bottom: 22px !important;
    }


    .preview-toolbar button {
        width: 100% !important;
        max-width: 100% !important;

        margin: 0 !important;

        box-sizing: border-box;
    }


    .invoice-pages {
        width: 100%;

        display: block !important;

        overflow: hidden !important;

        box-sizing: border-box;
    }


}






/* =====================================
   FIX PREVIEW TOOLBAR
===================================== */

.invoice-preview-wrapper.visible {
    display: block !important;
}

.invoice-preview-wrapper.visible .preview-toolbar {
    display: flex !important;

    width: 100%;
    max-width: 100%;

    margin: 0 auto 24px !important;

    position: relative;
    z-index: 50;

    opacity: 1 !important;
    visibility: visible !important;

    box-sizing: border-box;
}

.invoice-preview-wrapper.visible
#backToEdit,

.invoice-preview-wrapper.visible
#downloadPdfButton {
    display: inline-flex !important;

    opacity: 1 !important;
    visibility: visible !important;
}


/* MOBILE */

@media screen and (max-width: 760px) {

    .invoice-preview-wrapper.visible
    .preview-toolbar {
        display: flex !important;

        flex-direction: column;

        align-items: stretch;

        gap: 12px;

        padding: 0;

        margin-bottom: 22px !important;
    }

    .invoice-preview-wrapper.visible
    .preview-toolbar button {
        width: 100% !important;
        max-width: 100% !important;

        margin: 0 !important;
    }

}



/* =====================================
   FINAL PREVIEW LAYOUT
===================================== */

.invoice-preview-wrapper {
    display: none;
}

.invoice-preview-wrapper.visible {
    display: block !important;
    width: 100%;
    margin: 0 !important;
    padding: 0 !important;
}


/* kada smo u preview modu sakrij formu */

.invoice-page.preview-mode
.invoice-title-section,

.invoice-page.preview-mode
.company-block,

.invoice-page.preview-mode
.form-section,

.invoice-page.preview-mode
.invoice-summary {
    display: none !important;
}


/* ukloni veliki razmak koji forma inače ima */



/* dugmad */

.preview-toolbar {
    width: 100%;

    margin: 0 0 24px !important;

    display: flex !important;

    align-items: center;
    justify-content: space-between;

    gap: 12px;

    position: relative;
    z-index: 100;
}

.preview-toolbar button {
    display: inline-flex !important;

    align-items: center;
    justify-content: center;

    visibility: visible !important;
    opacity: 1 !important;
}


/* =====================================
   MOBILE PREVIEW
===================================== */

@media screen and (max-width: 760px) {

    .invoice-page.preview-mode {
        padding:
            18px 16px 40px !important;
    }

    .invoice-preview-wrapper.visible {
        width: 100% !important;
        max-width: 100% !important;
    }

    .preview-toolbar {
        display: flex !important;

        flex-direction: column;

        align-items: stretch;

        width: 100%;

        margin:
            0 0 18px !important;

        gap: 10px;
    }

    .preview-toolbar button {
        width: 100% !important;
        max-width: 100% !important;

        min-height: 52px;

        margin: 0 !important;

        box-sizing: border-box;
    }

    .invoice-pages {
        width: 100%;

        overflow: hidden !important;

        display: block !important;
    }

}

/* =====================================
   PREVIEW TOOLBAR POSITION - FINAL
===================================== */

.invoice-page.preview-mode {
    padding-top: 0 !important;
}

.invoice-preview-wrapper.visible {
    display: block !important;

    width: 100%;
    max-width: 100%;

    margin-top: 100px !important;

    position: relative;
    z-index: 10;
}

.invoice-preview-wrapper.visible .preview-toolbar {
    display: flex !important;

    width: 100%;
    max-width: 100%;

    margin: 0 0 24px 0 !important;
    padding: 0;

    position: relative;

    opacity: 1 !important;
    visibility: visible !important;

    z-index: 20;
}

.invoice-preview-wrapper.visible
.preview-toolbar button {
    display: inline-flex !important;

    align-items: center;
    justify-content: center;

    opacity: 1 !important;
    visibility: visible !important;
}


/* MOBILE */

@media screen and (max-width: 760px) {

    .invoice-preview-wrapper.visible {
        margin-top: 80px !important;
    }

    .invoice-preview-wrapper.visible
    .preview-toolbar {
        display: flex !important;

        flex-direction: column;

        width: 100%;

        gap: 10px;

        margin-bottom: 20px !important;
    }

    .invoice-preview-wrapper.visible
    .preview-toolbar button {
        width: 100% !important;
        max-width: 100% !important;

        min-height: 52px;

        margin: 0 !important;

        box-sizing: border-box;
    }

}

/* =====================================
   LARGE NUMBERS / A4 TABLE FIX
===================================== */

.invoice-page-sheet .preview-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}

.invoice-page-sheet .preview-table th {
    padding: 10px 5px;

    border-bottom: 1px solid #cfd7d4;

    color: #718082;

    font-size: 8px;
    font-weight: 600;

    text-align: right;

    text-transform: uppercase;

    overflow-wrap: anywhere;
}

.invoice-page-sheet .preview-table td {
    padding: 14px 5px;

    border-bottom: 1px solid #e5e9e7;

    color: #263638;

    font-size: 9px;

    text-align: right;

    vertical-align: top;

    overflow-wrap: anywhere;
    word-break: break-word;
}

.invoice-page-sheet .preview-table th:first-child,
.invoice-page-sheet .preview-table td:first-child {
    text-align: left;
}

.invoice-page-sheet .preview-table td:first-child {
    font-weight: 500;
    word-break: break-word;
}


.invoice-page-sheet .preview-table th:nth-child(1),
.invoice-page-sheet .preview-table td:nth-child(1) {
    width: 4%;
}

.invoice-page-sheet .preview-table th:nth-child(2),
.invoice-page-sheet .preview-table td:nth-child(2) {
    width: 14%;
    text-align: left;
}

.invoice-page-sheet .preview-table th:nth-child(3),
.invoice-page-sheet .preview-table td:nth-child(3) {
    width: 5%;
}

.invoice-page-sheet .preview-table th:nth-child(4),
.invoice-page-sheet .preview-table td:nth-child(4) {
    width: 7%;
}

.invoice-page-sheet .preview-table th:nth-child(5),
.invoice-page-sheet .preview-table td:nth-child(5) {
    width: 12%;
}

.invoice-page-sheet .preview-table th:nth-child(6),
.invoice-page-sheet .preview-table td:nth-child(6) {
    width: 12%;
}

.invoice-page-sheet .preview-table th:nth-child(7),
.invoice-page-sheet .preview-table td:nth-child(7) {
    width: 7%;
}

.invoice-page-sheet .preview-table th:nth-child(8),
.invoice-page-sheet .preview-table td:nth-child(8) {
    width: 12%;
}

.invoice-page-sheet .preview-table th:nth-child(9),
.invoice-page-sheet .preview-table td:nth-child(9) {
    width: 7%;
}

.invoice-page-sheet .preview-table th:nth-child(10),
.invoice-page-sheet .preview-table td:nth-child(10) {
    width: 10%;
}

.invoice-page-sheet .preview-table th:nth-child(11),
.invoice-page-sheet .preview-table td:nth-child(11) {
    width: 10%;
}


/* =====================================
   LARGE AMOUNT IN WORDS FIX
===================================== */

.preview-amount-words {
    max-width: 100%;

    margin-top: 9px;
    margin-left: auto;

    color: #59676a;

    font-size: 10px;
    font-weight: 500;

    line-height: 1.5;

    overflow-wrap: anywhere;
    word-break: break-word;
}
/* =========================================================
   BANK ACCOUNTS ON DOCUMENTS
========================================================= */

.preview-bank-accounts {
    margin-top: 3px;

    display: flex;
    flex-direction: column;

    gap: 2px;
}


.preview-seller .preview-bank-account,
.spec-seller-details .preview-bank-account {
    margin: 0 !important;

    display: flex;
    align-items: baseline;
    flex-wrap: wrap;

    gap: 4px;

    line-height: 1.45;
}


.preview-seller .preview-bank-name,
.spec-seller-details .preview-bank-name {
    color: inherit;

    font-size: inherit;
    font-weight: 500;
}


.preview-seller .preview-bank-account strong,
.spec-seller-details .preview-bank-account strong {
    color: inherit;

    font-size: inherit;
    font-weight: 600;
}

/* =========================================================
   COMPACT COMPANY INFO
========================================================= */

.preview-seller {
    line-height: 1.25;
}

.preview-brand {
    margin-top: 3px !important;
    margin-bottom: 7px !important;

    font-size: 20px !important;
    line-height: 1.1 !important;
}

.preview-seller p {
    margin: 2px 0 !important;

    font-size: 9px !important;
    line-height: 1.3 !important;
}


/* Računi malo zbijeniji */

.preview-bank-accounts {
    margin-top: 4px !important;

    gap: 0 !important;
}

.preview-seller .preview-bank-account {
    margin: 1px 0 !important;

    font-size: 8.5px !important;
    line-height: 1.25 !important;
}

.preview-seller .preview-bank-name {
    font-size: 8.5px !important;
    font-weight: 500 !important;
}

.preview-seller .preview-bank-account strong {
    font-size: 8.5px !important;
    font-weight: 600 !important;
}
.preview-company-logo {
    max-width: 105px !important;
    max-height: 42px !important;

    margin-bottom: 5px !important;
}

@media (max-width: 760px) {

    input,
    textarea,
    select,
    button {
        font-size: 16px;
    }

    input,
    textarea,
    select {
        -webkit-text-size-adjust: 100%;
    }

}


/* =========================================================
   FINAL DOCUMENT POLISH 2026
   Kompaktniji A4, stabilne tabele i siguran potpis
========================================================= */

.invoice-page-sheet {
    padding: 14mm 15mm 14mm !important;
    display: flex !important;
    flex-direction: column !important;
}

.invoice-page-sheet .preview-header {
    gap: 34px !important;
    padding-bottom: 14px !important;
    border-bottom-width: 1.5px !important;
    align-items: flex-start !important;
}

.invoice-page-sheet .preview-seller {
    max-width: 48% !important;
    min-width: 0;
}

.invoice-page-sheet .preview-company-logo {
    max-width: 96px !important;
    max-height: 38px !important;
    margin-bottom: 5px !important;
}

.invoice-page-sheet .preview-brand {
    margin: 0 0 5px !important;
    font-size: 18px !important;
    line-height: 1.08 !important;
    letter-spacing: -0.65px !important;
}

.invoice-page-sheet .preview-seller p {
    margin: 1.5px 0 !important;
    font-size: 8.5px !important;
    line-height: 1.28 !important;
}

.invoice-page-sheet .preview-bank-accounts {
    margin-top: 3px !important;
    gap: 0 !important;
}

.invoice-page-sheet .preview-bank-account,
.invoice-page-sheet .preview-bank-name,
.invoice-page-sheet .preview-bank-account strong {
    font-size: 8.2px !important;
    line-height: 1.25 !important;
}

.invoice-page-sheet .preview-document-info h2 {
    margin-bottom: 12px !important;
    font-size: 27px !important;
    line-height: 1 !important;
    letter-spacing: -1.2px !important;
}

.invoice-page-sheet .preview-kicker {
    margin-bottom: 4px !important;
    font-size: 9px !important;
}

.invoice-page-sheet .preview-meta {
    gap: 5px !important;
}

.invoice-page-sheet .preview-meta div {
    gap: 16px !important;
}

.invoice-page-sheet .preview-meta span {
    font-size: 8.5px !important;
}

.invoice-page-sheet .preview-meta strong,
.invoice-page-sheet .preview-meta small {
    font-size: 9.5px !important;
}

.invoice-page-sheet .preview-buyer-section {
    max-width: 390px !important;
    padding: 18px 0 20px !important;
}

.invoice-page-sheet .preview-label {
    margin-bottom: 5px !important;
    font-size: 8px !important;
}

.invoice-page-sheet .preview-buyer-section h3 {
    margin-bottom: 6px !important;
    font-size: 18px !important;
    line-height: 1.15 !important;
    letter-spacing: -0.6px !important;
}

.invoice-page-sheet .preview-buyer-section p {
    margin-bottom: 2px !important;
    font-size: 8.5px !important;
    line-height: 1.3 !important;
}

.invoice-page-sheet .continuation-header {
    margin-bottom: 18px !important;
    padding-bottom: 10px !important;
}

.invoice-page-sheet .preview-items-section {
    width: 100%;
    flex-shrink: 0;
}

.invoice-page-sheet .preview-table {
    width: 100% !important;
    table-layout: fixed !important;
    border-collapse: collapse !important;
}

.invoice-page-sheet .preview-table thead {
    display: table-header-group;
}

.invoice-page-sheet .preview-table tr {
    break-inside: avoid !important;
    page-break-inside: avoid !important;
}

.invoice-page-sheet .preview-table th,
.invoice-page-sheet .preview-table td {
    width: auto !important;
    box-sizing: border-box;
}

.invoice-page-sheet .preview-table th {
    padding: 7px 4px !important;
    font-size: 7.4px !important;
    line-height: 1.15 !important;
    white-space: normal;
    overflow-wrap: normal !important;
    word-break: normal !important;
}

.invoice-page-sheet .preview-table td {
    padding: 9px 4px !important;
    font-size: 8.3px !important;
    line-height: 1.32 !important;
    overflow-wrap: normal !important;
    word-break: normal !important;
}

.invoice-page-sheet .preview-table .col-description {
    text-align: left !important;
    white-space: normal !important;
    overflow-wrap: anywhere !important;
    word-break: normal !important;
    font-weight: 500;
}

.invoice-page-sheet .preview-table .numeric-cell,
.invoice-page-sheet .preview-table .table-percent,
.invoice-page-sheet .preview-table .col-rb,
.invoice-page-sheet .preview-table .col-unit {
    white-space: nowrap !important;
    word-break: keep-all !important;
    overflow-wrap: normal !important;
}

.invoice-page-sheet .preview-table .col-total strong {
    font-weight: 700;
}

/* Faktura/profaktura sa PDV-om */
.invoice-page-sheet .preview-table.is-vat col.col-rb-width { width: 4%; }
.invoice-page-sheet .preview-table.is-vat col.col-description-width { width: 22%; }
.invoice-page-sheet .preview-table.is-vat col.col-unit-width { width: 5%; }
.invoice-page-sheet .preview-table.is-vat col.col-quantity-width { width: 6%; }
.invoice-page-sheet .preview-table.is-vat col.col-price-width { width: 9%; }
.invoice-page-sheet .preview-table.is-vat col.col-line-price-width { width: 9%; }
.invoice-page-sheet .preview-table.is-vat col.col-discount-width { width: 6%; }
.invoice-page-sheet .preview-table.is-vat col.col-base-width { width: 9%; }
.invoice-page-sheet .preview-table.is-vat col.col-vat-rate-width { width: 6%; }
.invoice-page-sheet .preview-table.is-vat col.col-vat-amount-width { width: 10%; }
.invoice-page-sheet .preview-table.is-vat col.col-total-width { width: 14%; }

/* Firma van PDV sistema dobija širi opis */
.invoice-page-sheet .preview-table.no-vat col.col-rb-width { width: 5%; }
.invoice-page-sheet .preview-table.no-vat col.col-description-width { width: 35%; }
.invoice-page-sheet .preview-table.no-vat col.col-unit-width { width: 7%; }
.invoice-page-sheet .preview-table.no-vat col.col-quantity-width { width: 8%; }
.invoice-page-sheet .preview-table.no-vat col.col-price-width { width: 12%; }
.invoice-page-sheet .preview-table.no-vat col.col-line-price-width { width: 12%; }
.invoice-page-sheet .preview-table.no-vat col.col-discount-width { width: 8%; }
.invoice-page-sheet .preview-table.no-vat col.col-total-width { width: 13%; }

.invoice-page-sheet .preview-total-section {
    margin-top: 24px !important;
    flex-shrink: 0 !important;
    break-inside: avoid !important;
    page-break-inside: avoid !important;
}

.invoice-page-sheet .preview-note-block {
    max-width: 100% !important;
    font-size: 9px !important;
    line-height: 1.45 !important;
}

.invoice-page-sheet .preview-small-title {
    margin-bottom: 5px !important;
    font-size: 7.5px !important;
}

.invoice-page-sheet .preview-total-bottom {
    margin-top: 18px !important;
    padding-top: 13px !important;
    border-top-width: 1.5px !important;
}

.invoice-page-sheet .preview-total-row {
    gap: 10px !important;
    margin-bottom: 4px !important;
}

.invoice-page-sheet .preview-total-row span {
    min-width: 125px !important;
    font-size: 9px !important;
}

.invoice-page-sheet .preview-total-row strong {
    min-width: 145px !important;
    font-size: 10px !important;
    white-space: nowrap;
}

.invoice-page-sheet .preview-grand-total {
    margin-top: 6px !important;
}

.invoice-page-sheet .preview-grand-total span,
.invoice-page-sheet .preview-grand-total strong {
    font-size: 15px !important;
}

.invoice-page-sheet .preview-amount-words {
    margin-top: 6px !important;
    font-size: 8.5px !important;
    line-height: 1.35 !important;
}

.invoice-page-sheet .preview-signature-right {
    width: 215px !important;
    margin-top: 22px !important;
    margin-left: auto !important;
    break-inside: avoid !important;
    page-break-inside: avoid !important;
}

.invoice-page-sheet .signature-space {
    height: 24px !important;
}

.invoice-page-sheet .signature-line-right {
    width: 100% !important;
    margin-bottom: 6px !important;
}

.invoice-page-sheet .preview-signature-right span {
    font-size: 8.5px !important;
}

.invoice-page-number {
    right: 15mm !important;
    bottom: 6mm !important;
    font-size: 7.5px !important;
}

@media print {
    .invoice-page-sheet .preview-table tr,
    .invoice-page-sheet .preview-total-section,
    .invoice-page-sheet .preview-signature-right {
        break-inside: avoid !important;
        page-break-inside: avoid !important;
    }
}


/* =========================================================
   KUPAC - PRAVNO / FIZIČKO LICE
   Vizuelno usklađeno sa PDV tabovima na Ponudi
========================================================= */

.buyer-controls {
    display: flex;
    flex-direction: column;
    align-items: flex-start;

    gap: 24px;

    margin-bottom: 24px;
}

.buyer-control-block {
    width: 100%;
}

.buyer-control-title {
    display: block;

    margin-bottom: 10px;

    color: #162527;

    font-size: 13px;
    font-weight: 650;
    line-height: 1.3;
}

.buyer-choice {
    display: inline-flex;
    align-items: center;
    flex-wrap: nowrap;

    gap: 24px;

    width: auto;

    border-bottom: 1px solid #dfe5e3;
}

.buyer-choice-button {
    position: relative;

    min-width: 0;
    min-height: 0;

    padding: 8px 0 10px;

    border: 0;
    border-radius: 0;

    background: transparent;
    box-shadow: none;

    color: #7a8784;

    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.25;

    cursor: pointer;

    transition: color .18s ease;
}

.buyer-choice-button::after {
    content: "";

    position: absolute;

    left: 0;
    right: 0;
    bottom: -1px;

    height: 2px;

    background: transparent;

    transition: background .18s ease;
}

.buyer-choice-button:hover:not(:disabled) {
    color: #2A835F;
}

.buyer-choice-button.active {
    color: #12544F;
}

.buyer-choice-button.active::after {
    background: #2A835F;
}

.buyer-choice-button:disabled {
    color: #b7c0bd;

    cursor: not-allowed;

    opacity: 1;
}

.buyer-choice-button:disabled::after {
    background: transparent;
}

.buyer-mode-help {
    display: block;

    margin-top: 8px;

    color: #8a9592;

    font-size: 10.5px;
    line-height: 1.45;
}

.buyer-mode-help[hidden] {
    display: none !important;
}


@media (max-width: 760px) {

    .buyer-controls {
        gap: 22px;

        margin-bottom: 22px;
    }

    .buyer-control-title {
        font-size: 13px;
    }

    .buyer-choice {
        gap: 22px;

        max-width: 100%;
    }

    .buyer-choice-button {
        padding: 7px 0 9px;

        font-size: 16px;

        white-space: nowrap;
    }

    .buyer-mode-help {
        font-size: 11px;
    }

}

/* =========================================================
   MOBILE NO AUTO-ZOOM - FINAL OVERRIDE
   iOS/Safari zumira fokusirana polja ako je computed font < 16px.
========================================================= */
@media screen and (max-width: 760px) {
    html body input:not([type="checkbox"]):not([type="radio"]),
    html body textarea,
    html body select,
    html body .invoice-item .field input,
    html body .invoice-item .field select {
        font-size: 16px !important;
        -webkit-text-size-adjust: 100%;
    }
}

/* =========================================================
   SAVED CUSTOMERS
========================================================= */

.saved-customer-picker {
    position: relative;

    max-width: 620px;

    margin: 4px 0 24px;
}

.saved-customer-label {
    display: block;

    margin-bottom: 8px;

    color: #526164;

    font-size: 11px;
    font-weight: 600;
}

.saved-customer-search-wrap {
    position: relative;
}

.saved-customer-search {
    width: 100%;

    height: 46px;

    padding: 0 14px;

    border: 1px solid var(--line);
    border-radius: 12px;

    outline: none;

    background: #ffffff;
    color: var(--text);

    font-family: inherit;
    font-size: 14px;

    transition:
        border-color .18s ease,
        box-shadow .18s ease;
}

.saved-customer-search:focus {
    border-color: var(--light-green);

    box-shadow:
        0 0 0 4px rgba(139, 187, 146, .12);
}

.saved-customer-help {
    display: block;

    margin-top: 7px;

    color: #8a9592;

    font-size: 10.5px;
    line-height: 1.45;
}

.saved-customer-results {
    position: absolute;

    top: calc(100% + 7px);
    left: 0;
    right: 0;

    z-index: 80;

    max-height: 260px;

    overflow-y: auto;

    padding: 6px;

    border: 1px solid rgba(9, 35, 40, .10);
    border-radius: 14px;

    background: #ffffff;

    box-shadow:
        0 18px 42px rgba(9, 35, 40, .13);
}

.saved-customer-results[hidden] {
    display: none !important;
}

.saved-customer-result {
    width: 100%;

    display: flex;
    flex-direction: column;
    align-items: flex-start;

    gap: 3px;

    padding: 11px 12px;

    border: 0;
    border-radius: 10px;

    background: transparent;

    color: var(--text);

    font-family: inherit;
    text-align: left;

    cursor: pointer;

    transition: background .16s ease;
}

.saved-customer-result:hover,
.saved-customer-result:focus-visible {
    background: #f4f8f5;

    outline: none;
}

.saved-customer-result strong {
    color: var(--dark);

    font-size: 12px;
    font-weight: 600;
}

.saved-customer-result small {
    color: #7d8987;

    font-size: 10px;
}

.saved-customer-empty {
    padding: 13px 12px;

    color: #7d8987;

    font-size: 11px;
}

.saved-customer-empty.is-error {
    color: #a84c45;
}

.customer-save-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;

    gap: 12px;

    margin-top: 17px;
}

.customer-save-button {
    position: relative;

    padding: 0 0 3px;

    border: 0;

    background: transparent;
    color: var(--green);

    font-family: inherit;
    font-size: 11px;
    font-weight: 600;

    cursor: pointer;
}

.customer-save-button::after {
    content: "";

    position: absolute;

    left: 0;
    bottom: 0;

    width: 0;
    height: 1px;

    background: currentColor;

    transition: width .18s ease;
}

.customer-save-button:hover::after {
    width: 100%;
}

.customer-save-button:disabled {
    opacity: .55;
    cursor: wait;
}

.customer-save-message {
    color: #788582;

    font-size: 10.5px;
}

.customer-save-message.is-success {
    color: var(--green);
}

.customer-save-message.is-error {
    color: #a84c45;
}

@media (max-width: 760px) {

    .saved-customer-picker {
        max-width: none;

        margin-bottom: 22px;
    }

    .saved-customer-label {
        font-size: 13px;
    }

    .saved-customer-search {
        font-size: 16px !important;
    }

    .saved-customer-result strong {
        font-size: 14px;
    }

    .saved-customer-result small,
    .saved-customer-help,
    .customer-save-message {
        font-size: 11px;
    }

    .customer-save-button {
        font-size: 13px;
    }
}

/* =====================================
   IPS QR PLAĆANJE
===================================== */

.payment-account-cell {
    min-width: 0;
}

.payment-account-select {
    width: 100%;
    min-width: 0;
    padding: 0;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--text);
    font: inherit;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
}

.payment-account-select:focus {
    color: var(--green);
}

.payment-help {
    display: block;
    margin-top: 8px;
    color: #7a8789;
    font-size: 10px;
    line-height: 1.45;
}

.payment-qr-cell {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.invoice-qr-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 0;
    border: 0;
    background: transparent;
    color: #748184;
    font: inherit;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
}

.invoice-qr-toggle-dot {
    width: 32px;
    height: 18px;
    position: relative;
    border-radius: 999px;
    background: #dfe5e3;
    transition: background .18s ease;
}

.invoice-qr-toggle-dot::after {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #ffffff;
    box-shadow: 0 1px 4px rgba(9, 35, 40, .16);
    transition: transform .18s ease;
}

.invoice-qr-toggle.is-active {
    color: var(--text);
}

.invoice-qr-toggle.is-active .invoice-qr-toggle-dot {
    background: var(--green);
}

.invoice-qr-toggle.is-active .invoice-qr-toggle-dot::after {
    transform: translateX(14px);
}

.preview-ips-payment {
    display: flex;
    justify-content: flex-end;
    width: 100%;
    margin-top: 12px;
    padding: 0;
    border: 0;
    background: transparent;
}

.preview-ips-qr {
    display: block;
    width: 82px;
    height: 82px;
    object-fit: contain;
    background: #ffffff;
}

@media (max-width: 760px) {
    .payment-account-select,
    .invoice-qr-toggle {
        font-size: 16px;
    }
}


/* ===== Dokument: datum i potpis 2026-10 ===== */
.document-date-input {
    font-variant-numeric: tabular-nums;
    letter-spacing: .02em;
}
.signature-choice-block {
    margin-top: 22px;
}
.signature-choice-title {
    display: block;
    margin-bottom: 9px;
    font-size: 13px;
    font-weight: 650;
    color: #162527;
}
.signature-choice {
    display: inline-flex;
    gap: 4px;
    padding: 4px;
    border: 1px solid #dfe5e3;
    border-radius: 12px;
    background: #f7faf8;
}
.signature-choice-button {
    border: 0;
    border-radius: 9px;
    padding: 9px 13px;
    background: transparent;
    color: #586669;
    font: inherit;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
}
.signature-choice-button.active {
    background: #ffffff;
    color: #092328;
    box-shadow: 0 1px 4px rgba(9,35,40,.12);
}
.document-valid-without-signature {
    width: 100%;
    margin-top: 24px;
    text-align: center;
    font-size: 8.5px;
    font-weight: 600;
    color: #667477;
}
.continuation-header-full {
    align-items: flex-start !important;
}
.continuation-company {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.continuation-company > span,
.continuation-company-details {
    display: block;
    font-size: 7.5px !important;
    line-height: 1.25;
    color: #667477;
}

/* kompaktnije A4 strane */
.invoice-page-sheet .preview-buyer-section { padding-top:12px !important; padding-bottom:14px !important; }
.invoice-page-sheet .continuation-header { margin-bottom:12px !important; padding-bottom:8px !important; }
.invoice-page-sheet .preview-total-section { margin-top:16px !important; }
.invoice-page-sheet .preview-total-bottom { margin-top:12px !important; padding-top:10px !important; }

/* ===== Zavrsni blok dokumenata: QR levo, iznosi desno, napomena ispod, potpis pri dnu ===== */
.invoice-page-sheet.invoice-page-last {
    padding-bottom: 42mm !important;
}

.invoice-page-sheet .preview-final-layout {
    position: static !important;
    display: block !important;
    width: 100% !important;
    margin-top: 14px !important;
}

.invoice-page-sheet .preview-final-top-row {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) minmax(260px, 330px) !important;
    align-items: end !important;
    gap: 24px !important;
    padding-top: 10px !important;
    border-top: 1.5px solid #162527 !important;
}

.invoice-page-sheet .preview-final-left {
    min-width: 0;
    align-self: end;
}

.invoice-page-sheet .preview-total-bottom {
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
}

.invoice-page-sheet .preview-ips-payment {
    justify-content: flex-start !important;
    margin: 0 0 7px !important;
}

.invoice-page-sheet .preview-reference-inline {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 4px;
    font-size: 8.5px;
    line-height: 1.3;
    color: #59676a;
}

.invoice-page-sheet .preview-reference-inline span,
.invoice-page-sheet .preview-reference-inline strong {
    display: inline !important;
    min-width: 0 !important;
    margin: 0 !important;
    text-align: left !important;
    font-size: inherit !important;
}

.invoice-page-sheet .preview-reference-inline strong {
    color: #162527;
    font-weight: 700;
}

.invoice-page-sheet .preview-note-under-total {
    width: 100% !important;
    max-width: none !important;
    margin-top: 10px !important;
    padding-top: 8px !important;
    border-top: 1px solid #dfe5e3;
    text-align: left !important;
}

.invoice-page-sheet .preview-note-under-total p {
    margin: 0 !important;
    white-space: pre-line;
}

.invoice-page-sheet.invoice-page-last .preview-signature-right {
    position: absolute !important;
    right: 17mm !important;
    bottom: 17mm !important;
    width: 52mm !important;
    margin: 0 !important;
    text-align: center !important;
}

.invoice-page-sheet.invoice-page-last .signature-space {
    height: 8mm !important;
}

.invoice-page-sheet.invoice-page-last .document-valid-without-signature {
    position: absolute !important;
    left: 17mm !important;
    right: 17mm !important;
    bottom: 17mm !important;
    width: auto !important;
    margin: 0 !important;
    text-align: center !important;
}

/* Poziv na broj u editoru je u jednom redu sa vrednoscu. */
.payment-reference-inline {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 7px;
}
.payment-reference-inline .payment-label,
.payment-reference-inline strong {
    margin: 0 !important;
}

@media (max-width: 760px) {
    .invoice-page-sheet .preview-final-top-row {
        grid-template-columns: minmax(0, 1fr) minmax(220px, 300px) !important;
        gap: 16px !important;
    }
}

/* ===== 2026-10-01 korekcija: napomena LEVO, ukupan iznos DESNO ===== */
.invoice-page-sheet .preview-final-top-row {
    grid-template-columns: minmax(0, 1fr) minmax(260px, 330px) !important;
    align-items: start !important;
}
.invoice-page-sheet .preview-final-left {
    min-width: 0 !important;
    text-align: left !important;
}
.invoice-page-sheet .preview-final-left .preview-note-under-total {
    margin-top: 10px !important;
    padding-top: 8px !important;
    border-top: 1px solid #dfe5e3 !important;
    text-align: left !important;
}
.invoice-page-sheet .preview-final-top-row > .preview-total-bottom {
    width: 100% !important;
    justify-self: end !important;
    text-align: left !important;
}

/* ===== 2026-10-01 balans A4: vise vazduha + slovima direktno ispod ukupnog ===== */
.invoice-page-sheet.invoice-page-last .preview-final-layout {
    margin-top: var(--final-gap, 14mm) !important;
}

.invoice-page-sheet .preview-final-top-row {
    gap: 12mm !important;
    padding-top: 4mm !important;
}

.invoice-page-sheet .preview-final-left {
    padding-top: 1mm !important;
}

.invoice-page-sheet .preview-total-bottom {
    min-width: 72mm !important;
}

.invoice-page-sheet .preview-grand-total {
    margin-top: 2.2mm !important;
    padding-top: 1.8mm !important;
    border-top: 1px solid #dfe5e3 !important;
}

.invoice-page-sheet .preview-amount-words {
    display: block !important;
    width: 100% !important;
    margin: 2.2mm 0 0 !important;
    padding: 0 !important;
    text-align: right !important;
    color: #59676a !important;
    font-size: 7.8px !important;
    line-height: 1.35 !important;
}
.invoice-page-sheet .preview-amount-words span,
.invoice-page-sheet .preview-amount-words strong {
    display: inline !important;
    min-width: 0 !important;
    margin: 0 !important;
    font-size: inherit !important;
    line-height: inherit !important;
    text-align: right !important;
}
.invoice-page-sheet .preview-amount-words span {
    font-weight: 500 !important;
}
.invoice-page-sheet .preview-amount-words strong {
    color: #263638 !important;
    font-weight: 600 !important;
}

/* Malo vise ritma izmedju zaglavlja, kupca i tabele, bez rasipanja prostora. */
.invoice-page-sheet .preview-header {
    margin-bottom: 5mm !important;
}
.invoice-page-sheet .preview-buyer-section {
    margin-bottom: 4mm !important;
}
.invoice-page-sheet .preview-items-section {
    margin-top: 2mm !important;
}


/* ===== FINAL POLISH 2026-10-01: +1px čitljivost svih faktura/profaktura ===== */
.invoice-page-sheet .preview-brand { font-size: 19px !important; }
.invoice-page-sheet .preview-seller p { font-size: 9.5px !important; }
.invoice-page-sheet .preview-bank-account,
.invoice-page-sheet .preview-bank-name,
.invoice-page-sheet .preview-bank-account strong { font-size: 9.2px !important; }
.invoice-page-sheet .preview-document-info h2 { font-size: 28px !important; }
.invoice-page-sheet .preview-kicker { font-size: 10px !important; }
.invoice-page-sheet .preview-meta span { font-size: 9.5px !important; }
.invoice-page-sheet .preview-meta strong,
.invoice-page-sheet .preview-meta small { font-size: 10.5px !important; }
.invoice-page-sheet .preview-label { font-size: 9px !important; }
.invoice-page-sheet .preview-buyer-section h3 { font-size: 19px !important; }
.invoice-page-sheet .preview-buyer-section p { font-size: 9.5px !important; }
.invoice-page-sheet .preview-table th { font-size: 8.4px !important; padding: 6px 4px !important; }
.invoice-page-sheet .preview-table td { font-size: 9.3px !important; padding: 8px 4px !important; line-height: 1.28 !important; }
.invoice-page-sheet .continuation-company > span,
.invoice-page-sheet .continuation-company-details { font-size: 8.5px !important; }
.invoice-page-sheet.invoice-page-last .preview-signature-right { z-index:20 !important; background:#fff !important; }
.invoice-page-sheet.invoice-page-last .preview-signature-right span { font-size: 9.5px !important; }

/* Measured pagination uses the full printable area. */
.invoice-page-sheet, .spec-page-sheet { padding-bottom: 15mm !important; }
.invoice-page-sheet.invoice-page-last, .spec-page-sheet.spec-page-last { padding-bottom: 38mm !important; }
.spec-page-sheet .spec-bottom { max-height: none !important; }
.spec-page-sheet.spec-page-last .spec-signature { left:50% !important; right:auto !important; transform:translateX(-50%); }
