/* =========================================================
   MOJSEKRETAR - SPECIFIKACIJA FISKALNOG RAČUNA
   Ovaj fajl ide POSLE faktura.css
   ========================================================= */

.spec-page-title {
    max-width: 900px;
    font-size: clamp(44px, 6vw, 76px) !important;
    line-height: 0.98 !important;
}

.spec-help-text {
    max-width: 720px;
    margin: -12px 0 24px;
    color: var(--soft);
    font-size: 12px;
    line-height: 1.6;
}


/* =========================================================
   STAVKE - FORMA
   ========================================================= */

.spec-items-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.spec-item {
    display: grid;
    grid-template-columns:
        minmax(260px, 2fr)
        minmax(150px, 0.8fr)
        105px
        minmax(190px, 1fr)
        38px;

    gap: 12px;
    align-items: end;

    padding: 18px;

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

    background: var(--surface);
}

.spec-items-list[data-vat-registered="0"]
.spec-item {
    grid-template-columns:
        minmax(280px, 2fr)
        minmax(160px, 0.8fr)
        minmax(190px, 1fr)
        38px;
}

.spec-item .field {
    min-width: 0;
}

.spec-item .field input,
.spec-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;
}

.spec-item-calc {
    min-width: 0;
    min-height: 48px;

    display: flex;
    flex-direction: column;
    justify-content: center;

    gap: 2px;
}

.spec-item-calc > span {
    color: #778386;
    font-size: 9px;
}

.spec-item-calc > strong {
    font-size: 13px;
}

.spec-item-calc > small {
    color: #7b8789;
    font-size: 9px;
    line-height: 1.35;
}

.spec-remove-item {
    margin-bottom: 7px;
}


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

.spec-pages {
    width: 100%;
}

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

    margin: 0 auto 32px;

    padding: 12mm 10mm 12mm;

    position: relative;

    box-sizing: border-box;

    overflow: hidden;

    background: #ffffff;
    color: #162527;

    border: 1px solid #e2e7e5;

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

.spec-a4-grid {
    width: 100%;
    height: 100%;

    display: grid;

    /*
        Levo: sadržaj specifikacije
        Desno: mesto za originalni fiskalni račun
    */
    grid-template-columns:
        minmax(0, 1fr)
        72mm;

    gap: 8mm;

    align-items: stretch;
}

.spec-paper-content {
    min-width: 0;
    height: 100%;

    display: flex;
    flex-direction: column;
}


/* =========================================================
   DESNA ZONA - FISKALNI RAČUN
   ========================================================= */

.fiscal-receipt-slot {
    height: 138mm;

    padding: 10mm 5mm;

    position: relative;

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

    text-align: center;

    border: 1.5px dashed #d84a4a;
    border-radius: 6px;

    background:
        linear-gradient(
            180deg,
            rgba(216, 74, 74, 0.035),
            rgba(216, 74, 74, 0.012)
        );

    color: #b03e3e;

    box-sizing: border-box;
}
/* NE-PDV FIRMA */
.spec-pages[data-vat-registered="0"] .fiscal-receipt-slot {
    height: 92mm;
}

.fiscal-receipt-slot::before,
.fiscal-receipt-slot::after {
    content: "";

    position: absolute;
    top: 7mm;

    width: 13mm;
    height: 1.5px;

    background: #d84a4a;
}

.fiscal-receipt-slot::before {
    left: 8mm;
}

.fiscal-receipt-slot::after {
    right: 8mm;
}

.receipt-slot-kicker {
    margin-bottom: 7px;

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

    letter-spacing: 0.8px;
    text-transform: uppercase;
}

.receipt-slot-title {
    max-width: 52mm;

    margin-bottom: 8px;

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

    line-height: 1.25;
    letter-spacing: -0.6px;
}

.receipt-slot-text {
    max-width: 50mm;

    color: #b85b5b;

    font-size: 9px;
    line-height: 1.55;
}


/* =========================================================
   LEVA STRANA DOKUMENTA
   ========================================================= */

.spec-seller {
    padding-bottom: 8mm;
    margin-bottom: 7mm;

    border-bottom: 1.5px solid #162527;
}

.spec-company-logo {
    display: block;

    max-width: 42mm;
    max-height: 20mm;

    margin-bottom: 5mm;

    object-fit: contain;
}

.spec-company-name {
    margin-bottom: 3mm;

    color: #092328;

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

    line-height: 1.1;
    letter-spacing: -0.8px;
}

.spec-seller-details {
    display: grid;
    gap: 1.2mm;

    color: #59676a;

    font-size: 8.8px;
    line-height: 1.4;
}

.spec-document-heading {
    margin-bottom: 7mm;
}

.spec-document-kicker {
    margin-bottom: 2mm;

    color: var(--green);

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

    letter-spacing: 0.8px;
    text-transform: uppercase;
}

.spec-document-heading h2 {
    max-width: 100%;

    margin-bottom: 2.5mm;

    font-size: 22px;
    line-height: 1.05;

    letter-spacing: -1px;
}

.spec-number-line {
    color: #4f5e61;

    font-size: 10px;
}

.spec-number-line strong {
    color: #162527;
    font-size: 12px;
}


/* META */

.spec-meta {
    display: grid;
    grid-template-columns: 1fr 1fr;

    gap: 3mm 5mm;

    margin-bottom: 7mm;

    padding: 4mm;

    border: 1px solid #dfe5e3;
    border-radius: 4px;
}

.spec-meta-item span {
    display: block;

    margin-bottom: 1mm;

    color: #7a8587;

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

    text-transform: uppercase;
}

.spec-meta-item strong {
    display: block;

    color: #263638;

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

    overflow-wrap: anywhere;
}


/* KUPAC */

.spec-buyer-box {
    margin-bottom: 7mm;

    padding: 4mm;

    border-left: 2px solid var(--green);

    background: #f7faf8;
}

.spec-preview-label {
    display: block;

    margin-bottom: 1.5mm;

    color: var(--green);

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

    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.spec-buyer-box h3 {
    margin-bottom: 2mm;

    font-size: 13px;
    line-height: 1.2;

    letter-spacing: -0.4px;
}

.spec-buyer-box p {
    margin-bottom: 0.8mm;

    color: #59676a;

    font-size: 8px;
    line-height: 1.35;
}


/* =========================================================
   TABELA
   ========================================================= */

.spec-table-wrap {
    width: calc(100% + 80mm);

    margin-top: 5mm;

    position: relative;
    z-index: 2;

    background: #ffffff;
}

.spec-table {
    width: 100%;

    border-collapse: collapse;
    table-layout: fixed;
}

.spec-table th {
    padding: 2.4mm 1.5mm;

    border-bottom: 1px solid #cfd7d4;

    color: #718082;

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

    text-align: right;
    text-transform: uppercase;

    vertical-align: bottom;
}

.spec-table td {
    padding: 3.3mm 1.5mm;

    border-bottom: 1px solid #e5e9e7;

    color: #263638;

    font-size: 7.7px;

    text-align: right;
    vertical-align: top;

    overflow-wrap: anywhere;
}

.spec-table th:first-child,
.spec-table td:first-child {
    width: 7%;
    text-align: left;
}

.spec-table th:nth-child(2),
.spec-table td:nth-child(2) {
    width: 39%;
    text-align: left;
}

.spec-table th:nth-child(3),
.spec-table td:nth-child(3) {
    width: 18%;
}

.spec-table th:nth-child(4),
.spec-table td:nth-child(4) {
    width: 18%;
}

.spec-table th:nth-child(5),
.spec-table td:nth-child(5) {
    width: 18%;
}

.spec-pages[data-vat-registered="0"]
.spec-table th:nth-child(2),
.spec-pages[data-vat-registered="0"]
.spec-table td:nth-child(2) {
    width: 63%;
}

.spec-pages[data-vat-registered="0"]
.spec-table th:nth-child(3),
.spec-pages[data-vat-registered="0"]
.spec-table td:nth-child(3) {
    width: 30%;
}


/* =========================================================
   DONJI DEO
   ========================================================= */

.spec-bottom {
    margin-top: auto;
    padding-top: 7mm;
}

.spec-note-preview {
    margin-bottom: 6mm;

    color: #536164;

    font-size: 8px;
    line-height: 1.55;

    overflow-wrap: anywhere;
}

.spec-note-preview strong {
    display: block;

    margin-bottom: 1mm;

    color: var(--green);

    font-size: 7px;

    text-transform: uppercase;
}

.spec-totals {
    width: calc(100% + 80mm);

    padding-top: 4mm;

    position: relative;
    z-index: 3;

    background: #ffffff;

    border-top: 1.5px solid #162527;

    box-sizing: border-box;
}

.spec-total-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;

    gap: 6mm;

    margin-bottom: 1.5mm;

    font-size: 8px;
}

.spec-total-row span {
    color: #59676a;
}

.spec-total-row strong {
    color: #162527;

    font-size: 9px;
}

.spec-total-row.grand {
    margin-top: 2.5mm;
}

.spec-total-row.grand span,
.spec-total-row.grand strong {
    color: #162527;

    font-size: 12px;
    font-weight: 700;
}
.spec-total-row {
    width: 100%;
}

.spec-total-row strong {
    min-width: 35mm;
    text-align: right;
}

.spec-total-row.grand {
    margin-top: 3mm;
    padding-top: 2mm;

    border-top: 1px solid #e5e9e7;
}

.spec-total-row.grand span,
.spec-total-row.grand strong {
    font-size: 13px;
    font-weight: 700;
}

.spec-signature {
    width: calc(100% + 80mm);

    margin-top: 10mm;
    margin-left: 0;

    text-align: center;

    box-sizing: border-box;
}

.spec-signature-space {
    height: 14mm;
}

.spec-signature-line {
    width: 48mm;
    height: 1px;

    margin: 0 auto 2mm;

    background: #162527;
}

.spec-signature span {
    display: block;

    width: 48mm;
    margin: 0 auto;

    color: #59676a;

    font-size: 7.5px;
    text-align: center;
}


/* =========================================================
   PDF / PRINT
   U preview-u crveno, u PDF-u diskretnije sivo.
   ========================================================= */

.pdf-export-clone .fiscal-receipt-slot {
    border: none !important;
    background: transparent !important;
    color: transparent !important;
}

.pdf-export-clone .fiscal-receipt-slot::before,
.pdf-export-clone .fiscal-receipt-slot::after {
    content: none !important;
    display: none !important;
}

.pdf-export-clone .fiscal-receipt-slot > * {
    visibility: hidden !important;
}

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

@media print {

    html,
    body {
        width: 210mm;

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

        background: #ffffff !important;
    }

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

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

        margin: 0 !important;

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

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

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

     .fiscal-receipt-slot {
        border: none !important;
        background: transparent !important;
        color: transparent !important;
    }

    .fiscal-receipt-slot::before,
    .fiscal-receipt-slot::after {
        content: none !important;
        display: none !important;
    }

    .fiscal-receipt-slot > * {
        visibility: hidden !important;
    }
}


/* =========================================================
   MOBILE FORMA
   ========================================================= */

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

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

    .spec-items-list[data-vat-registered="0"]
    .spec-item {
        grid-template-columns:
            minmax(0, 1fr)
            minmax(0, 1fr);
    }

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

    .spec-item-calc {
        grid-column: 1 / 2;
    }

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

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

        margin-bottom: 0;
    }

    .spec-pages {
        width: 100%;

        overflow: hidden;

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

    .spec-page-sheet {
        transform-origin: top left;
    }

}

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

    .spec-page-title {
        font-size: 39px !important;
        letter-spacing: -2.2px !important;
    }

    .spec-help-text {
        margin-top: -4px;
    }

}

/* =========================================================
   FINAL SPEC DOCUMENT POLISH 2026
   Prava puna tabela ispod zone za fiskalni račun + više strana
========================================================= */

.spec-page-sheet {
    padding: 10mm 10mm 12mm !important;
}

.spec-first-page-content,
.spec-continuation-content {
    width: 100%;
    height: 100%;
    min-height: 0;

    display: flex;
    flex-direction: column;
}

.spec-top-grid {
    width: 100%;

    display: grid;
    grid-template-columns: minmax(0, 1fr) 72mm;
    gap: 8mm;
    align-items: start;
}

.spec-top-left {
    min-width: 0;
}

/* firma je kompaktnija, linija ide bliže sadržaju */
.spec-seller {
    padding-bottom: 4mm !important;
    margin-bottom: 4mm !important;
    border-bottom-width: 1.2px !important;
}

.spec-company-logo {
    max-width: 35mm !important;
    max-height: 14mm !important;
    margin-bottom: 2.5mm !important;
}

.spec-company-name {
    margin-bottom: 1.6mm !important;
    font-size: 17px !important;
    line-height: 1.08 !important;
}

.spec-seller-details {
    gap: 0.6mm !important;
    font-size: 7.8px !important;
    line-height: 1.28 !important;
}

.spec-seller-details .preview-bank-accounts {
    margin-top: 1mm !important;
    gap: 0 !important;
}

.spec-seller-details .preview-bank-account,
.spec-seller-details .preview-bank-name,
.spec-seller-details .preview-bank-account strong {
    font-size: 7.6px !important;
    line-height: 1.25 !important;
}

.spec-document-heading {
    margin-bottom: 4mm !important;
}

.spec-document-heading h2 {
    margin-bottom: 1.5mm !important;
    font-size: 18px !important;
    line-height: 1.05 !important;
}

.spec-number-line {
    font-size: 8px !important;
}

.spec-number-line strong {
    font-size: 9.5px !important;
}

.spec-meta {
    gap: 2mm 4mm !important;
    margin-bottom: 4mm !important;
    padding: 3mm !important;
}

.spec-meta-item span {
    margin-bottom: 0.6mm !important;
    font-size: 6.5px !important;
}

.spec-meta-item strong {
    font-size: 8px !important;
}

.spec-buyer-box {
    margin-bottom: 0 !important;
    padding: 3mm !important;
}

.spec-buyer-box h3 {
    margin-bottom: 1mm !important;
    font-size: 11px !important;
}

.spec-buyer-box p {
    margin-bottom: 0.4mm !important;
    font-size: 7.2px !important;
}

/* tabela sada zaista kreće ISPOD cele gornje zone i ide punom širinom */
.spec-first-page-content .spec-table-wrap,
.spec-continuation-content .spec-table-wrap {
    width: 100% !important;
    margin-top: 5mm !important;
    position: static !important;
    z-index: auto !important;
}

.spec-continuation-content .spec-table-wrap {
    margin-top: 0 !important;
}

.spec-table {
    width: 100% !important;
    table-layout: fixed !important;
    border-collapse: collapse !important;
}

.spec-table thead {
    display: table-header-group;
}

.spec-table tr {
    break-inside: avoid !important;
    page-break-inside: avoid !important;
}

.spec-table th {
    padding: 2mm 1.2mm !important;
    font-size: 6.4px !important;
    line-height: 1.15 !important;
    white-space: normal;
}

.spec-table td {
    padding: 2.6mm 1.2mm !important;
    font-size: 7.4px !important;
    line-height: 1.3 !important;
}

.spec-table .spec-col-rb,
.spec-table .spec-col-number,
.spec-vat-value {
    white-space: nowrap !important;
    word-break: keep-all !important;
    overflow-wrap: normal !important;
}

.spec-table .spec-col-description {
    white-space: normal !important;
    overflow-wrap: anywhere !important;
    text-align: left !important;
}

.spec-vat-value small {
    display: inline !important;
    margin-left: 1mm;
    font-size: 6.2px !important;
    color: #718082;
}

.spec-table .spec-col-total strong {
    font-weight: 700;
}

/* završni blok više nema veštačkih +80mm širina */
.spec-first-page-content .spec-bottom,
.spec-continuation-content .spec-bottom {
    width: 100%;
    margin-top: auto !important;
    padding-top: 5mm !important;
    flex-shrink: 0;
    break-inside: avoid !important;
    page-break-inside: avoid !important;
}

.spec-first-page-content .spec-totals,
.spec-continuation-content .spec-totals,
.spec-first-page-content .spec-signature,
.spec-continuation-content .spec-signature {
    width: 100% !important;
}

.spec-totals {
    padding-top: 3mm !important;
}

.spec-total-row {
    margin-bottom: 1mm !important;
    font-size: 7.5px !important;
}

.spec-total-row strong {
    font-size: 8.5px !important;
}

.spec-total-row.grand {
    margin-top: 2mm !important;
    padding-top: 1.5mm !important;
}

.spec-total-row.grand span,
.spec-total-row.grand strong {
    font-size: 11px !important;
}

.spec-signature {
    margin-top: 6mm !important;
    break-inside: avoid !important;
    page-break-inside: avoid !important;
}

.spec-signature-space {
    height: 8mm !important;
}

.spec-signature-line {
    width: 45mm !important;
}

.spec-signature span {
    width: 45mm !important;
    font-size: 7px !important;
}

.spec-note-preview {
    margin-bottom: 4mm !important;
    font-size: 7.5px !important;
    line-height: 1.4 !important;
    white-space: pre-line;
}

/* nastavak dokumenta */
.spec-continuation-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8mm;

    margin-bottom: 5mm;
    padding-bottom: 3mm;

    border-bottom: 1px solid #dfe5e3;
}

.spec-continuation-header strong {
    color: #092328;
    font-size: 11px;
    font-weight: 700;
}

.spec-continuation-header span {
    color: #667477;
    font-size: 7.5px;
    text-align: right;
}

.spec-page-number {
    position: absolute;
    right: 10mm;
    bottom: 5mm;

    color: #889294;
    font-size: 7px;
}

@media print {
    .spec-table tr,
    .spec-bottom,
    .spec-signature {
        break-inside: avoid !important;
        page-break-inside: avoid !important;
    }
}

/* =========================================================
   KUPAC - CLEAN TAB SELEKCIJA
   isti vizuelni jezik kao PDV na ponudi
========================================================= */

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

    gap: 24px;

    margin-bottom: 24px;
}

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

.spec-buyer-control-title {
    display: block;

    margin-bottom: 10px;

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

/* neutrališemo stari izgled mode-button samo u ovom delu */
.spec-buyer-choice {
    display: inline-flex !important;
    align-items: center;
    flex-wrap: nowrap;

    gap: 24px !important;

    width: auto !important;
    margin: 0 !important;
    padding: 0 !important;

    border: 0 !important;
    border-bottom: 1px solid #dfe5e3 !important;
    border-radius: 0 !important;

    background: transparent !important;
    box-shadow: none !important;
}

.spec-buyer-choice .spec-choice-button {
    position: relative;

    width: auto !important;
    min-width: 0 !important;
    min-height: 0 !important;
    height: auto !important;

    padding: 8px 0 10px !important;

    border: 0 !important;
    border-radius: 0 !important;

    background: transparent !important;
    box-shadow: none !important;

    color: #7a8784 !important;

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

    cursor: pointer;

    opacity: 1 !important;
    transform: none !important;

    transition: color .18s ease;
}

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

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

    height: 2px;

    background: transparent;

    transition: background .18s ease;
}

.spec-buyer-choice .spec-choice-button:hover:not(:disabled) {
    color: #2A835F !important;
    background: transparent !important;
}

.spec-buyer-choice .spec-choice-button.active {
    color: #12544F !important;
    background: transparent !important;
}

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

/* Fizičko lice nema PIB pretragu. Dugme ostaje vidljivo, ali mirno posivi. */
.spec-buyer-choice .spec-choice-button:disabled {
    color: #b7c0bd !important;

    cursor: not-allowed;

    opacity: 1 !important;
}

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

.spec-buyer-mode-help {
    display: block;

    margin-top: 8px;

    color: #8a9592;
    font-size: 10.5px;
    line-height: 1.45;
}

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

@media (max-width: 760px) {

    .spec-buyer-controls {
        gap: 22px;
        margin-bottom: 22px;
    }

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

    .spec-buyer-choice {
        gap: 22px !important;
        max-width: 100%;
    }

    .spec-buyer-choice .spec-choice-button {
        font-size: 16px !important;
        padding: 7px 0 9px !important;
        white-space: nowrap;
    }

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


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


/* =========================================================
   AVANSNE UPLATE + KONAČAN IZNOS
   ========================================================= */

.spec-advances-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 12px;
}

.spec-advance {
    display: grid;
    grid-template-columns:
        minmax(180px, 0.8fr)
        minmax(240px, 1.4fr)
        38px;
    gap: 12px;
    align-items: end;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: var(--surface);
}

.spec-advance .field {
    min-width: 0;
}

.spec-advance .field input {
    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;
}

.spec-advance-calc {
    min-height: 48px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 3px;
}

.spec-advance-calc span {
    color: #778386;
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 0.35px;
}

.spec-advance-calc strong {
    color: #263638;
    font-size: 12px;
    font-weight: 600;
}

.spec-remove-advance {
    margin-bottom: 7px;
}

.spec-live-summary {
    min-width: min(430px, 100%);
    display: grid;
    gap: 7px;
}

.spec-live-summary-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 20px;
}

.spec-live-summary-row span {
    color: var(--soft);
    font-size: 12px;
}

.spec-live-summary-row strong {
    text-align: right;
}

.spec-live-summary-final {
    margin-top: 3px;
    padding-top: 7px;
    border-top: 1px solid var(--line);
}

.spec-live-summary-final span,
.spec-live-summary-final strong {
    color: var(--text);
    font-weight: 700;
}

.spec-total-row.spec-advance-row strong,
.spec-total-row.spec-advance-total-row strong {
    color: #46585b;
}

.spec-advance-total-row {
    margin-top: 1.5mm;
    padding-top: 1.5mm;
    border-top: 1px dashed #dfe5e3;
}

.spec-total-words {
    margin-top: 3mm;
    padding-top: 2.5mm;
    border-top: 1px solid #e5e9e7;
}

.spec-total-words span {
    display: block;
    margin-bottom: 1mm;
    color: #7a8587;
    font-size: 7px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.45px;
}

.spec-total-words strong {
    display: block;
    color: #263638;
    font-size: 8.5px;
    font-weight: 600;
    line-height: 1.45;
}

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

    .spec-advance {
        grid-template-columns:
            minmax(0, 1fr)
            38px;
    }

    .spec-advance .field {
        grid-column: 1 / -1;
    }

    .spec-advance-calc {
        grid-column: 1 / 2;
    }

    .spec-remove-advance {
        grid-column: 2 / 3;
        justify-self: end;
        align-self: center;
        margin-bottom: 0;
    }

    .spec-live-summary {
        min-width: 0;
        width: 100%;
    }
}

/* =========================================================
   AVANS - BROJ RAČUNA / DATUM / IZNOS
   ========================================================= */

.spec-advance {
    grid-template-columns:
        minmax(190px, 1.15fr)
        minmax(165px, 0.85fr)
        minmax(160px, 0.8fr)
        minmax(200px, 1.1fr)
        38px;
}

.spec-advance-document-row {
    width: 100%;
    display: grid;
    grid-template-columns: minmax(0, 1.45fr) minmax(31mm, 0.8fr) minmax(34mm, 0.75fr);
    gap: 4mm;
    align-items: end;
    padding: 2.2mm 0;
    border-bottom: 1px solid #e5e9e7;
    box-sizing: border-box;
}

.spec-advance-document-row span {
    display: block;
    margin-bottom: 0.7mm;
    color: #7a8587;
    font-size: 6.4px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.25px;
}

.spec-advance-document-row strong {
    display: block;
    color: #263638;
    font-size: 8px;
    font-weight: 600;
    line-height: 1.35;
    overflow-wrap: anywhere;
}

.spec-advance-document-amount {
    text-align: right;
}

.spec-advance-document-amount strong {
    color: #46585b;
}

@media screen and (max-width: 900px) {
    .spec-advance {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    }

    .spec-advance .field {
        grid-column: auto;
    }

    .spec-advance .field:first-child {
        grid-column: 1 / -1;
    }

    .spec-advance-calc {
        grid-column: 1 / 2;
    }

    .spec-remove-advance {
        grid-column: 2 / 3;
    }
}

@media screen and (max-width: 560px) {
    .spec-advance {
        grid-template-columns: 1fr;
    }

    .spec-advance .field,
    .spec-advance .field:first-child,
    .spec-advance-calc,
    .spec-remove-advance {
        grid-column: 1;
    }

    .spec-remove-advance {
        justify-self: end;
    }
}


/* ===== Specifikacije: tip, datum, potpis i nastavak 2026-10 ===== */
.document-date-input { font-variant-numeric: tabular-nums; letter-spacing: .02em; }
.spec-type-choice { display:flex; flex-wrap:wrap; gap:6px; padding:4px; border:1px solid #dfe5e3; border-radius:12px; background:#f7faf8; }
.spec-type-button { flex:1 1 180px; border:0; border-radius:9px; padding:10px 12px; background:transparent; color:#586669; font:inherit; font-size:12px; font-weight:600; cursor:pointer; }
.spec-type-button.active { background:#fff; color:#092328; box-shadow:0 1px 4px rgba(9,35,40,.12); }
.spec-top-grid.no-receipt-slot { grid-template-columns:minmax(0,1fr) !important; }
.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:#fff; color:#092328; box-shadow:0 1px 4px rgba(9,35,40,.12); }
.document-valid-without-signature { width:100%; margin-top:8mm; text-align:center; font-size:8.5px; font-weight:600; color:#667477; }
.spec-continuation-header-full { align-items:flex-start !important; }
.spec-continuation-company, .spec-continuation-document { display:flex; flex-direction:column; gap:1mm; }
.spec-continuation-company span, .spec-continuation-document span { font-size:7px; line-height:1.25; color:#667477; }
.spec-continuation-document { text-align:right; align-items:flex-end; }
.spec-continuation-document strong { font-size:8.5px; color:#092328; }

/* završno poravnanje i kompaktnije strane */
.spec-signature { width:45mm !important; margin-left:auto !important; margin-right:0 !important; text-align:center !important; }
.spec-signature-line, .spec-signature span { margin-left:auto !important; margin-right:0 !important; }
.spec-first-page-content .spec-table-wrap { margin-top:3mm !important; }
.spec-bottom { padding-top:3mm !important; }
.spec-continuation-header { margin-bottom:3mm !important; padding-bottom:2mm !important; }

/* ===== Zavrsni blok specifikacije: napomena ispod ukupnog, potpis pri dnu ===== */
.spec-page-sheet.spec-page-last {
    padding-bottom: 42mm !important;
}

.spec-page-sheet .spec-bottom {
    position: static !important;
    width: 100% !important;
}

.spec-page-sheet .spec-note-preview {
    width: 100% !important;
    max-width: none !important;
    margin-top: 3mm !important;
    padding-top: 2.5mm !important;
    border-top: 1px solid #dfe5e3;
    text-align: left !important;
}

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

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

.spec-page-sheet.spec-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;
}

/* ===== 2026-10-01 korekcija: napomena LEVO, ukupan iznos DESNO ===== */
.spec-page-sheet .spec-final-row {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) minmax(72mm, 88mm) !important;
    align-items: start !important;
    gap: 8mm !important;
    width: 100% !important;
}
.spec-page-sheet .spec-final-left {
    min-width: 0 !important;
    text-align: left !important;
}
.spec-page-sheet .spec-final-left .spec-note-preview {
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 0 !important;
    border-top: 0 !important;
    text-align: left !important;
}
.spec-page-sheet .spec-final-row .spec-totals {
    width: 100% !important;
    margin: 0 !important;
    justify-self: end !important;
}

/* ===== 2026-10-01 balans A4 + slovima ispod ukupnog ===== */
.spec-page-sheet.spec-page-last .spec-bottom {
    margin-top: var(--final-gap, 14mm) !important;
}
.spec-page-sheet .spec-final-row {
    gap: 12mm !important;
}
.spec-page-sheet .spec-total-words {
    display: block !important;
    width: 100% !important;
    margin-top: 2.2mm !important;
    padding-top: 1.8mm !important;
    border-top: 1px solid #dfe5e3 !important;
    text-align: right !important;
    line-height: 1.35 !important;
}
.spec-page-sheet .spec-total-words span,
.spec-page-sheet .spec-total-words strong {
    display: inline !important;
    margin: 0 !important;
    font-size: 7.8px !important;
    line-height: inherit !important;
    text-align: right !important;
}
.spec-page-sheet .spec-total-words span {
    color: #59676a !important;
    font-weight: 500 !important;
}
.spec-page-sheet .spec-total-words strong {
    color: #263638 !important;
    font-weight: 600 !important;
}


/* ===== FINAL POLISH 2026-10-01: čitljiviji PDF + bezbedan prelom/potpis ===== */
/* Uvećanje je namerno ograničeno samo na A4 dokument, ne na formu za unos. */
.spec-page-sheet .spec-company-name { font-size: 18px !important; }
.spec-page-sheet .spec-seller-details,
.spec-page-sheet .spec-seller-details .preview-bank-account,
.spec-page-sheet .spec-seller-details .preview-bank-name,
.spec-page-sheet .spec-seller-details .preview-bank-account strong { font-size: 8.6px !important; }
.spec-page-sheet .spec-document-heading h2 { font-size: 19px !important; }
.spec-page-sheet .spec-number-line { font-size: 9px !important; }
.spec-page-sheet .spec-number-line strong { font-size: 10.5px !important; }
.spec-page-sheet .spec-meta-item span { font-size: 7.5px !important; }
.spec-page-sheet .spec-meta-item strong { font-size: 9px !important; }
.spec-page-sheet .spec-buyer-box h3 { font-size: 12px !important; }
.spec-page-sheet .spec-buyer-box p { font-size: 8.2px !important; }
.spec-page-sheet .spec-table th { font-size: 7.4px !important; padding: 1.8mm 1.1mm !important; }
.spec-page-sheet .spec-table td { font-size: 8.4px !important; padding: 2.2mm 1.1mm !important; line-height: 1.25 !important; }
.spec-page-sheet .spec-vat-value small { font-size: 7.2px !important; }
.spec-page-sheet .spec-note-preview { font-size: 8.5px !important; line-height: 1.35 !important; }
.spec-page-sheet .spec-total-row { font-size: 8.5px !important; }
.spec-page-sheet .spec-total-row strong { font-size: 9.5px !important; }
.spec-page-sheet .spec-total-row.grand span,
.spec-page-sheet .spec-total-row.grand strong { font-size: 12px !important; }
.spec-page-sheet .spec-total-words { font-size: 8.5px !important; line-height: 1.3 !important; }
.spec-page-sheet .spec-advance-document-row span { font-size: 7.2px !important; }
.spec-page-sheet .spec-advance-document-row strong { font-size: 8.8px !important; }
.spec-page-sheet .spec-continuation-header strong { font-size: 12px !important; }
.spec-page-sheet .spec-continuation-company span,
.spec-page-sheet .spec-continuation-document span { font-size: 8px !important; }
.spec-page-sheet .spec-continuation-document strong { font-size: 9.5px !important; }
.spec-page-sheet .spec-page-number { font-size: 8px !important; }
.spec-page-sheet.spec-page-last .spec-signature {
    z-index: 20 !important;
    background: #fff !important;
    padding-top: 1mm !important;
}
.spec-page-sheet.spec-page-last .spec-signature span { font-size: 8px !important; }
.spec-page-sheet.spec-page-last .document-valid-without-signature { z-index: 20 !important; background:#fff !important; }
/* Rezervisan donji pojas za potpis, čak i kod više avansa. */
.spec-page-sheet.spec-page-last { padding-bottom: 45mm !important; }
.spec-page-sheet.spec-page-last .spec-bottom { max-height: 205mm; }

/* 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%); }
