:root {
    --bg: #f4efe7;
    --panel: #fffdf9;
    --ink: #1f2933;
    --muted: #667085;
    --line: #d8d1c7;
    --accent: #0e7490;
    --accent-dark: #155e75;
    --accent-soft: #dff5fb;
    --danger: #b42318;
    --shadow: 0 18px 40px rgba(31, 41, 51, 0.08);
    --radius: 20px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family:  system-ui, -apple-system, "Segoe UI", Roboto, sans-serif, Georgia, "Times New Roman", serif;
    color: var(--ink);
    background:
        radial-gradient(circle at top left, rgba(14, 116, 144, 0.16), transparent 28%),
        linear-gradient(180deg, #fbf7f0 0%, var(--bg) 100%);
}

button,
input,
select,
textarea {
    font: inherit;
}

.page-shell {
    width: min(1120px, calc(100% - 32px));
    margin: 32px auto 48px;
}

.hero {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 24px;
    align-items: stretch;
    margin-bottom: 24px;
}

.hero h1,
.panel h2 {
    margin: 0;
    font-weight: 700;
}

.hero-copy,
.muted {
    color: var(--muted);
}

.eyebrow {
    text-transform: uppercase;
    letter-spacing: 0.14em;
    font-size: 0.78rem;
    color: var(--accent-dark);
    margin-bottom: 12px;
}

.hero > div,
.panel {
    background: rgba(255, 253, 249, 0.92);
    border: 1px solid rgba(216, 209, 199, 0.8);
    border-radius: var(--radius);
    padding: 28px;
    box-shadow: var(--shadow);
    backdrop-filter: blur(8px);
}

.hero-card {
    background: linear-gradient(180deg, #f4fbfd 0%, #ecf8fc 100%);
}

.hero {
    display: grid;
    grid-template-columns: 2.0fr 1fr;
    gap: 40px;
    align-items: center;
    padding: 40px 0;
}

/* LEVA STRANA */

.hero-left h1 {
    font-size: 2.2rem;
    line-height: 1.2;
    margin: 10px 0 15px;
}

.hero-copy {
    color: var(--muted);
    max-width: 670px;
    line-height: 1.6;
    text-align: justify !important;
}

.hero-subtitle {
    margin: 6px 0;
    font-size: 1.25rem;
    color: var(--muted);
}

.hero-subtitle.secondary {
    font-size: 1.25rem;
    opacity: 0.85;
}


/* DESNA STRANA */

.hero-right {
    display: flex;
    justify-content: center;
}

.hero-card {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 24px;
    text-align: center;
    max-width: 298px;
    width: 100%;
}

/* MASKOTA */

.hero-mascot {
    width: 100%;
    max-width: 280px;
    height: auto;
    margin-bottom: 12px;
}

.hero-mascot {
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
}

/* TEKST DOBRODOŠLICE */

.hero-welcome {
    margin: 10px 0 14px;
    font-size: 1rem;
    line-height: 1.5;
}

/* TEHNIČKI INFO */

.hero-tech {
    text-align: left;
    font-size: 0.92rem;
    color: var(--muted);
    border-top: 1px solid var(--line);
    padding-top: 12px;
}

.hero-tech p {
    margin: 6px 0;
}

/* RESPONSIVE */

@media (max-width: 900px) {
    .hero {
        grid-template-columns: 1fr;
        text-align: center;
    }

    .hero-left {
        align-items: center;
    }

    .hero-copy {
        margin: 0 auto;
    }

    .hero-tech {
        text-align: center;
    }
}






.invoice-form {
    display: grid;
    gap: 20px;
}

.panel-header {
    margin-bottom: 18px;
}

.panel-header.split,
.submit-row,
.inline-field,
.panel-actions,
.checkbox-row {
    display: flex;
    align-items: center;
}
.checkbox-row input:disabled {
    cursor: not-allowed;
    opacity: 0.6;
}
.panel-header.split,
.submit-row {
    justify-content: space-between;
    gap: 16px;
}

.inline-field {
    gap: 10px;
}

.inline-field input {
    flex: 1 1 auto;
}

.inline-field .secondary-btn {
    flex: 0 0 auto;
    white-space: nowrap;
}

.panel-actions {
    flex-wrap: wrap;
    gap: 10px;
}

.payment-row {
    display: grid;
    grid-template-columns: minmax(80px, 100px) minmax(0, 1fr) auto;
    gap: 16px;
    align-items: end;
}

.document-tools-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    gap: 16px;
    align-items: end;
}

.payment-purpose-field {
    min-width: 0;
}

.payment-model-field {
    max-width: 100px;
}

.payment-reference-field {
    min-width: 0;
}

.payment-copy-btn {
    align-self: end;
}

.grid {
    display: grid;
    gap: 16px;
}

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

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

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

.grid-span-2 {
    grid-column: span 2;
}

/* TEKST LABELA */
label span {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.95rem;
    font-weight: 600;
    color: #374151;
}

.label-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

/* INPUT NORMAL */
input,
select,
textarea {
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

/* FOCUS */
input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(14, 116, 144, 0.15);
}

/* ERROR (prazno required polje) */
.input-error {
    border-color: #dc2626 !important;
    background: #fff7f7;
}

/* ERROR LABEL */
.label-error span {
    color: #b91c1c;
}

/* SUKPTILNA ANIMACIJA */
.input-error:focus {
    box-shadow: 0 0 0 2px rgba(220, 38, 38, 0.15);
}

.field-label {
    display: block;
    margin-bottom: 8px;
    font-size: 0.95rem;
    line-height: 1;
}

.required-mark {
    margin-left: 4px;
    color: #c2410c;
    font-weight: 700;
}

.option-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.86rem;
    color: var(--muted);
}

.option-toggle-inline {
    align-self: end;
    margin-bottom: 12px;
    white-space: nowrap;
}

.option-toggle input[type="checkbox"] {
    width: 16px;
    height: 16px;
    margin: 0;
}

label {
    align-self: start;
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 12px 14px;
    background: #fff;
}

input:disabled {
    background: #f6f1ea;
    color: #8a8279;
    cursor: not-allowed;
}

#payment_reference {
    min-width: 0;
}

.segmented-control {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 8px;
}

.segment-btn {
    padding: 10px 14px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: #fff;
    color: var(--ink);
    cursor: pointer;
    transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease, color 0.2s ease;
}

.segment-btn:hover {
    transform: translateY(-1px);
    border-color: var(--accent);
}

.segment-btn.is-active {
    background: var(--accent-soft);
    border-color: var(--accent);
    color: var(--accent-dark);
}

input:focus,
select:focus,
textarea:focus {
    outline: 2px solid rgba(14, 116, 144, 0.15);
    border-color: var(--accent);
}

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

.primary-btn,
.secondary-btn,
.icon-btn {
    border: 0;
    cursor: pointer;
    border-radius: 999px;
    transition: transform 0.2s ease, background 0.2s ease;
}

.primary-btn:hover,
.secondary-btn:hover,
.icon-btn:hover {
    transform: translateY(-1px);
}

.primary-btn {
    padding: 12px 20px;
    background: var(--accent);
    color: #fff;
}

.secondary-btn {
    padding: 10px 14px;
    background: var(--accent-soft);
    color: var(--accent-dark);
}

.icon-btn {
    width: 36px;
    height: 36px;
    background: #fef2f2;
    color: var(--danger);
    font-size: 1.4rem;
    line-height: 1;
}

.table-wrap {
    overflow-x: auto;
}

.items-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}

.items-table th,
.items-table td {
    padding: 12px 10px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: middle;
}

.items-table th {
    color: var(--muted);
    font-size: 0.92rem;
}

.items-table thead th {
    text-align: center;
    font-weight: 600;
}

/* Šifra */
.items-table th:nth-child(1),
.items-table td:nth-child(1) {
    width: 80px;
}

/* Naziv (glavna kolona) */
.items-table th:nth-child(2),
.items-table td:nth-child(2) {
    width: auto;
}

/* JM */
.items-table th:nth-child(3),
.items-table td:nth-child(3) {
    width: 80px;
}

/* Količina */
.items-table th:nth-child(4),
.items-table td:nth-child(4) {
    width: 100px;
}

/* Cena */
.items-table th:nth-child(5),
.items-table td:nth-child(5) {
    width: 130px;
}

/* Popust */
.items-table th:nth-child(6),
.items-table td:nth-child(6) {
    width: 92px;
}

/* PDV */
.items-table th:nth-child(7),
.items-table td:nth-child(7) {
    width: 92px;
}

/* Ukupno */
.items-table th:nth-child(8),
.items-table td:nth-child(8) {
    width: 160px;
}

/* Dugme X */
.items-table th:nth-child(9),
.items-table td:nth-child(9) {
    width: 50px;
    text-align: center;
}

.items-table input {
    width: 100%;
    box-sizing: border-box;
    text-align: right;
}

.item-name {
    text-align: left !important;
}
.item-unit {
    text-align: center !important;
}
.items-table td:nth-child(3) input {
    text-align: center;
}

#load-profile {
    position: relative;
    animation: loadProfilePulse 2.2s ease-in-out 7;
}

#load-profile::after {
    content: "";
    position: absolute;
    inset: -6px;
    border-radius: inherit;
    border: 2px solid rgba(32, 148, 178, 0.28);
    opacity: 0;
    pointer-events: none;
    animation: loadProfileRing 2.2s ease-out 7;
}

@keyframes loadProfilePulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 0 0 rgba(32, 148, 178, 0);
    }
    18% {
        transform: scale(1.04);
        box-shadow: 0 0 0 8px rgba(32, 148, 178, 0.10);
    }
    36% {
        transform: scale(1);
        box-shadow: 0 0 0 rgba(32, 148, 178, 0);
    }
}

@keyframes loadProfileRing {
    0%, 100% {
        opacity: 0;
        transform: scale(1);
    }
    15% {
        opacity: 0.9;
        transform: scale(1);
    }
    45% {
        opacity: 0;
        transform: scale(1.12);
    }
}

.checkbox-row {
    gap: 10px;
    cursor: pointer;
    width: fit-content;
}

.checkbox-row input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin: 0;
    flex: 0 0 18px;
}

.checkbox-row span {
    margin-bottom: 0;
}

.autocomplete-wrap {
    position: relative;
}

.autocomplete-list {
    position: absolute;
    left: 0;
    right: 0;
    top: calc(100% + 6px);
    z-index: 20;
    background: #fffdf9;
    border: 1px solid var(--line);
    border-radius: 14px;
    box-shadow: var(--shadow);
    overflow: hidden;
}

.autocomplete-item {
    width: 100%;
    padding: 12px 14px;
    border: 0;
    border-bottom: 1px solid rgba(216, 209, 199, 0.65);
    background: transparent;
    text-align: left;
    cursor: pointer;
}

.autocomplete-item:last-child {
    border-bottom: 0;
}

.autocomplete-item:hover {
    background: #f4fbfd;
}

.saved-clients {
    margin-top: 18px;
    padding-top: 18px;
    border-top: 1px dashed var(--line);
}

.saved-clients-header {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.chip-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.client-chip {
    padding: 10px 14px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: #fff;
    cursor: pointer;
}

.client-chip:hover {
    border-color: var(--accent);
    background: #f4fbfd;
}

.logo-tools {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-preview-wrap {
    min-height: 44px;
}

.logo-preview {
    max-width: 220px;
    max-height: 90px;
    object-fit: contain;
    border: 1px solid var(--line);
    background: #fff;
    border-radius: 12px;
    padding: 8px;
}

.summary-card {
    margin-top: 20px;
    display: grid;
    gap: 12px;
    padding: 18px;
    border-radius: 18px;
    background: linear-gradient(180deg, #fff 0%, #f8f4ee 100%);
    border: 1px solid var(--line);
}

.summary-card > div {
    display: flex;
    justify-content: space-between;
    gap: 16px;
}

#vat-breakdown {
    display: grid;
    gap: 10px;
}

.vat-breakdown-row {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    color: var(--muted);
}

.summary-total {
    padding-top: 12px;
    border-top: 1px dashed var(--line);
    font-size: 1.1rem;
}

.section-gap {
    margin-top: 16px;
}

.support-panel {
    background:
        linear-gradient(180deg, rgba(255, 253, 249, 0.98) 0%, rgba(244, 251, 253, 0.95) 100%);
}

.support-grid {
    display: grid;
    grid-template-columns: minmax(220px, 388px) minmax(0, 1fr);
    gap: 24px;
    padding-bottom: 24px;
    align-items: start;
}

.support-qr-block,
.support-copy-block {
    background: rgba(255, 255, 255, 0.88);
    border: 1px solid rgba(216, 209, 199, 0.8);
    border-radius: 18px;
    padding: 18px;
}

.support-qr-block {
    text-align: center;
    position: sticky;
    top: 20px;
}

.support-block-title {
    margin: 0 0 12px;
    font-size: 1.02rem;
    font-weight: 700;
    color: var(--accent-dark);
}

.support-qr-image {
    display: block;
    width: min(100%, 380px);
    margin: 0 auto 16px;
    border-radius: 18px;
    border: 1px solid var(--line);
    background: #fff;
    padding: 10px;
}

.qr-pokazi {
  position: relative;
}

.qr-pokazivac {
  position: absolute;
  top: 182px;
  left: 62%;
  transform: translateX(-50%);
}

@keyframes bounceUpDown {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-10px);
  }
}

.qr-pokazivac {
  animation: bounceUpDown 1.8s ease-in-out infinite;
}

@media (max-width: 490px) {
.qr-pokazivac {
  position: absolute;
  top: 162px;
  left: 57%;
  transform: translateX(-50%);
}


}

@keyframes qrPulse {
  0%, 100% {
    transform: scale(1);
    filter: drop-shadow(0 0 0 rgba(255, 210, 80, 0));
  }
  50% {
    transform: scale(1.02);
    filter: drop-shadow(0 0 14px rgba(255, 210, 80, 0.45));
  }
}

.support-qr-image {
  animation: qrPulse 2.2s ease-in-out infinite;
  transform-origin: center;
  will-change: transform, filter;
}

.support-download-btn {
    display: inline-flex;
    justify-content: center;
    text-decoration: none;
}

.support-amount {
    margin: 14px 0 0;
    color: var(--muted);
    font-weight: 700;
}

.support-copy hr {
    border: 0;
    border-top: 1px solid rgba(216, 209, 199, 0.9);
    margin: 16px 0;
}

.support-copy p {
    margin: 0 0 12px;
    line-height: 1.6;
}

.support-copy p:last-child {
    margin-bottom: 0;
}

.support-list {
    margin: 0;
    padding-left: 20px;
    color: var(--ink);
}

.support-list li + li {
    margin-top: 6px;
}

.is-hidden {
    display: none !important;
}

@media (max-width: 840px) {
    .hero,
    .grid-2,
    .grid-3,
    .grid-4 {
        grid-template-columns: 1fr;
    }

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

    .document-tools-row {
        grid-template-columns: 1fr;
    }

    .label-row {
        align-items: flex-start;
    }

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

    .grid-span-2 {
        grid-column: auto;
    }

    .panel-header.split,
    .submit-row,
    .inline-field,
    .logo-tools {
        flex-direction: column;
        align-items: stretch;
    }

    .checkbox-row {
        width: 100%;
    }

    .payment-model-field {
        max-width: none;
    }

    .payment-copy-btn {
        width: 100%;
    }

    .option-toggle-inline {
        margin-bottom: 0;
    }

    .support-qr-block {
        position: static;
    }

    .page-shell {
        width: min(100% - 20px, 1120px);
        margin-top: 20px;
    }
}
