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

/* ------------------------------------------------------------------ */
/* Tokeni dizajna — boje Carinskog skladišta, mjere po Sirius dizajnu  */
/* ------------------------------------------------------------------ */

:root {
  /* površine */
  --pozadina: #f4f4f5;
  --kartica: #ffffff;
  --kartica-tiho: #fafafa;
  --ivica: #ebebeb;
  --ivica-jaca: #e0e0e0;
  --ivica-tiha: #f2f2f2;       /* razdjelnici unutar kartice */
  --ivica-red: #f5f5f5;        /* linije između redova tabele */

  /* tekst */
  --tekst: #171717;
  --tekst-telo: #404040;
  --tekst-blagi: #737373;
  --tekst-tihi: #a3a3a3;
  --tekst-ugaseni: #d4d4d4;

  /* akcenti */
  --akcent: #171717;
  --akcent-hover: #2e2e2e;
  --akcent-svetlo: #f4f4f5;
  --akcent-senka: 0 2px 8px rgba(23, 23, 23, .28);

  /* bočna traka */
  --sidebar-bg: #171717;
  --sidebar-kartica: #212121;
  --sidebar-ivica: rgba(255, 255, 255, .09);
  --sidebar-tekst: #a1a1a1;
  --sidebar-grupa: #737373;
  --sidebar-aktivno: #ffffff;

  /* semantika */
  --crvena: #dc2626;
  --crvena-blaga: #fef2f2;
  --crvena-tint: #fee2e2;
  --crvena-ivica: #fecaca;
  --zelena: #16a34a;
  --zelena-blaga: #f0fdf4;
  --zuta: #b45309;
  --zuta-blaga: #fffbeb;
  --zuta-ivica: #fde68a;

  /* mjere */
  --radius: 8px;
  --radius-dugme: 10px;
  --radius-veliki: 16px;
  --visina-polja: 42px;
  --visina-dugmeta: 41px;
  --senka-kartica: 0 1px 4px rgba(0, 0, 0, .06);
}

html, body { height: 100%; font-variant-numeric: tabular-nums; }

body {
  font-family: Inter, "Segoe UI", system-ui, -apple-system, sans-serif;
  font-size: 13.5px;
  color: var(--tekst);
  background: var(--pozadina);
  display: flex;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--tekst-ugaseni); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--tekst-tihi); }

/* ------------------------------------------------------------------ */
/* Bočna traka                                                         */
/* ------------------------------------------------------------------ */

.sidebar {
  width: 273px;
  flex-shrink: 0;
  height: 100vh;
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Vrh: visina se poklapa sa gornjom trakom (54px) */
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 16px 12px;
  border-bottom: 1px solid var(--sidebar-ivica);
}
.logo-ikona { display: block; width: 28px; height: 28px; flex-shrink: 0; }
.logo-ikona svg { display: block; width: 100%; height: 100%; }
.naziv { white-space: nowrap; letter-spacing: -.3px; }
.naziv span { color: #22c55e; }
.brand strong {
  color: #fff;
  font-size: 17px;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar nav { flex: 1; overflow-y: auto; padding-bottom: 12px; }
.nav-sekcija { padding-top: 12px; }

/* Naslov grupe — klikom se grupa skuplja */
.nav-grupa {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: calc(100% - 16px);
  height: auto;
  margin: 2px 8px;
  padding: 7px 12px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--sidebar-grupa);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  text-align: left;
  box-shadow: none;
  transition: background 150ms ease, color 150ms ease;
}
.nav-grupa:hover { background: rgba(255, 255, 255, .04); color: var(--sidebar-tekst); }
.nav-grupa svg { width: 13px; height: 13px; flex-shrink: 0; transition: transform 180ms ease; }
.nav-sekcija.skupljena .nav-grupa svg { transform: rotate(-90deg); }
.nav-sekcija.skupljena .nav-stavke { display: none; }

.tab {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  width: calc(100% - 16px);
  height: auto;
  margin: 1px 8px;
  padding: 8px 14px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--sidebar-tekst);
  font-size: 13.5px;
  font-weight: 400;
  text-align: left;
  box-shadow: none;
  transition: all .15s;
}
.tab span { flex: 1; }
.tab svg { width: 16px; height: 16px; flex-shrink: 0; opacity: .85; stroke-width: 2.2; }
.tab:hover { background: rgba(255, 255, 255, .04); color: #e5e5e5; }
.tab.active {
  background: var(--sidebar-kartica);
  border-color: var(--sidebar-ivica);
  color: var(--sidebar-aktivno);
  font-weight: 600;
}
.tab.active svg { opacity: 1; }

.sidebar-dno {
  padding: 12px 20px 14px;
  border-top: 1px solid var(--sidebar-ivica);
  color: var(--sidebar-grupa);
  font-size: 11.5px;
}

/* Zupčanik pored naziva — otvara Podešavanja */
.brand .zupcanik {
  width: 28px;
  height: 28px;
  margin-left: auto;
  padding: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--sidebar-tekst);
  box-shadow: none;
  flex-shrink: 0;
}
.brand .zupcanik:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.brand .zupcanik.active { background: var(--sidebar-kartica); color: #fff; border: 1px solid var(--sidebar-ivica); }
.brand .zupcanik svg { width: 16px; height: 16px; }

/* ------------------------------------------------------------------ */
/* Avatar u gornjoj traci i njegov meni                                */
/* ------------------------------------------------------------------ */

.topbar-desno { display: flex; align-items: center; gap: 12px; }
.avatar-omot { position: relative; }
.avatar {
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 50%;
  background: linear-gradient(135deg, #22c55e, #15803d);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  box-shadow: none;
}
.avatar:hover { background: linear-gradient(135deg, #16a34a, #166534); }
.avatar-meni {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 60;
  min-width: 260px;
  background: var(--kartica);
  border: 1px solid var(--ivica);
  border-radius: 10px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, .08);
  overflow: hidden;
}
.meni-glava { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--ivica-tiha); }
.meni-tekst { flex: 1; min-width: 0; }
.meni-tekst .ime { font-size: 13.5px; font-weight: 600; color: var(--tekst); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.meni-tekst .email { font-size: 12px; color: var(--tekst-blagi); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.meni-glava .av {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #22c55e, #15803d);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
}
.meni-stavka {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  height: auto;
  padding: 11px 16px;
  border-radius: 0;
  background: var(--kartica);
  color: var(--tekst);
  font-size: 13.5px;
  font-weight: 400;
  text-align: left;
  justify-content: flex-start;
  box-shadow: none;
}
.meni-stavka:hover { background: #f4f6f6; }
.meni-stavka + .meni-stavka { border-top: 1px solid var(--ivica-tiha); }
.meni-stavka.opasno { color: var(--crvena); }
.meni-stavka.opasno:hover { background: var(--crvena-blaga); }

/* ------------------------------------------------------------------ */
/* Podešavanja                                                         */
/* ------------------------------------------------------------------ */

.pod-linija { display: flex; border-bottom: 2px solid var(--ivica-tiha); }
.pod-linija button {
  height: auto;
  padding: 10px 18px;
  margin-bottom: -2px;
  border-radius: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--tekst-blagi);
  font-size: 13.5px;
  font-weight: 400;
  box-shadow: none;
}
.pod-linija button:hover { color: var(--tekst); }
.pod-linija button.akt { color: var(--tekst); font-weight: 600; border-bottom-color: var(--tekst); }
.pod-linija button:active:not(:disabled) { transform: none; }
.podesavanja-sadrzaj { flex: 1; min-height: 0; overflow: auto; padding: 24px; }
.kartica-tabela { border: 1px solid var(--ivica); border-radius: 12px; overflow: hidden; }
.kartica-tabela th { padding: 11px 16px; }
.kartica-tabela td { padding: 12px 16px; }
.kartica-tabela tbody tr:last-child td { border-bottom: none; }
td.tiho { color: var(--tekst-blagi); }
.korisnik-red { display: inline-flex; align-items: center; gap: 10px; }
.avatar-mali {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #22c55e, #15803d);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
}
button.mala-okvir {
  height: auto;
  padding: 5px 12px;
  border-radius: 7px;
  border: 1px solid var(--ivica);
  background: var(--kartica);
  color: var(--tekst-telo);
  font-size: 12.5px;
  font-weight: 500;
  box-shadow: none;
}
button.mala-okvir:hover { background: var(--kartica-tiho); }

/* Forma korisnika / lozinke za brisanje */
.korisnik-forma {
  max-width: 760px;
  padding: 24px;
  border: 1px solid var(--ivica);
  border-radius: 12px;
  background: var(--kartica);
}
.korisnik-vrh { display: flex; align-items: center; gap: 16px; margin-bottom: 22px; }
.korisnik-vrh h3 { font-size: 16px; font-weight: 700; margin: 0 0 3px; }
.korisnik-vrh .hint { margin: 0; }
.avatar-veliki {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #22c55e, #15803d);
  color: #fff;
  font-size: 18px;
  font-weight: 700;
}
.avatar-veliki.crveni { background: var(--crvena-tint); color: var(--crvena); border-radius: 14px; }
.korisnik-forma label { display: flex; flex-direction: column; gap: 5px; margin-bottom: 16px; font-size: 12.5px; font-weight: 600; color: var(--tekst-telo); }
.korisnik-forma .red { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.korisnik-forma select:disabled { background-color: var(--kartica-tiho); color: var(--tekst-blagi); cursor: not-allowed; }
.korisnik-akcije { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 8px; }
.korisnik-akcije .akcije { display: flex; gap: 12px; margin: 0; }
.korisnik-akcije .akcije button { height: auto; padding: 12px 24px; font-size: 14px; }
button.opasno-okvir {
  height: auto;
  padding: 10px 16px;
  border-radius: 8px;
  border: 1px solid var(--crvena-ivica);
  background: var(--kartica);
  color: var(--crvena);
  font-size: 13px;
  font-weight: 500;
  box-shadow: none;
}
button.opasno-okvir:hover { background: var(--crvena-blaga); }
@media (max-width: 760px) { .korisnik-forma .red { grid-template-columns: 1fr; } }

/* ------------------------------------------------------------------ */
/* Prijava — tamni panel levo, forma desno                             */
/* ------------------------------------------------------------------ */

body.prijava-aktivna > .sidebar, body.prijava-aktivna > main { display: none; }
.prijava-ekran { position: fixed; inset: 0; z-index: 200; display: flex; background: #fff; }
.prijava-panel { flex: 1; position: relative; overflow: hidden; background: var(--sidebar-bg); color: #fff; }
.prijava-panel .brend { position: absolute; top: 32px; left: 32px; display: flex; align-items: center; gap: 10px; }
.prijava-panel .brend .logo-ikona { width: 36px; height: 36px; }
.prijava-panel .brend b { font-size: 18px; font-weight: 700; }
.prijava-panel .slogan { position: absolute; left: 40px; right: 40px; bottom: 76px; }
.prijava-panel .slogan div:first-child { font-size: 38px; font-weight: 700; line-height: 1.22; letter-spacing: -.5px; }
.prijava-panel .slogan div:last-child { font-size: 15px; color: rgba(255, 255, 255, .68); margin-top: 14px; line-height: 1.6; }
.prijava-panel .fusnota { position: absolute; left: 40px; bottom: 28px; font-size: 12px; color: rgba(255, 255, 255, .45); }
.kocke { position: absolute; inset: 0; }
.kocke span {
  position: absolute;
  width: 14px;
  height: 14px;
  border: 1px solid rgba(255, 255, 255, .22);
  border-radius: 3px;
  animation: treperi 4s ease-in-out infinite;
}
.kocke span.zelena {
  width: 22px;
  height: 22px;
  border: none;
  border-radius: 5px;
  background: linear-gradient(150deg, #22c55e, #15803d);
  box-shadow: 0 0 0 10px rgba(34, 197, 94, .14), 0 0 0 22px rgba(34, 197, 94, .06);
  animation: none;
}
@keyframes treperi { 0%, 100% { opacity: 1; } 50% { opacity: .3; } }

.prijava-desno { flex: 1; display: flex; align-items: center; justify-content: center; padding: 40px; overflow: auto; }
.prijava-forma { width: 100%; max-width: 380px; }
.prijava-forma .logo-plocica {
  width: 48px;
  height: 48px;
  margin: 0 auto 20px;
  border-radius: 10px;
  border: 1px solid var(--ivica);
  box-shadow: 0 1px 2px rgba(0, 0, 0, .04);
  display: flex;
  align-items: center;
  justify-content: center;
}
.prijava-forma .logo-plocica .logo-ikona { width: 28px; height: 28px; }
.prijava-forma h1 { font-size: 30px; font-weight: 700; letter-spacing: -.5px; text-align: center; margin-bottom: 8px; }
.prijava-forma .pod { text-align: center; color: var(--tekst-blagi); font-size: 14px; margin-bottom: 32px; }
.prijava-forma label { display: block; font-size: 12.5px; font-weight: 600; color: var(--tekst-telo); margin-bottom: 5px; }
.prijava-forma .polje { position: relative; margin-bottom: 20px; }
.prijava-forma .polje input[type="password"], .prijava-forma .polje input.otkriveno { padding-right: 44px; }
.prijava-forma .oko {
  position: absolute;
  right: 4px;
  top: 25px;
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--tekst-tihi);
  box-shadow: none;
}
.prijava-forma .oko:hover { background: var(--kartica-tiho); color: var(--tekst); }
.prijava-forma .oko svg { width: 18px; height: 18px; }
.prijava-forma .greska {
  padding: 10px 12px;
  margin-bottom: 12px;
  border-radius: 8px;
  background: var(--crvena-blaga);
  border: 1px solid var(--crvena-ivica);
  color: var(--crvena);
  font-size: 13px;
  text-align: center;
}
.prijava-forma button[type="submit"] { width: 100%; height: auto; padding: 11px 14px; border-radius: 8px; font-size: 14px; }
.prijava-forma .dno { margin-top: 22px; text-align: center; font-size: 12.5px; color: var(--tekst-tihi); }
@media (max-width: 900px) { .prijava-panel { display: none; } }

/* ------------------------------------------------------------------ */
/* Glavni dio: gornja traka + sadržaj                                  */
/* ------------------------------------------------------------------ */

main {
  flex: 1;
  min-width: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.topbar {
  height: 54px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  background: var(--kartica);
  border-bottom: 1px solid var(--ivica);
}
.mrvice { display: flex; align-items: center; gap: 6px; font-size: 13.5px; color: var(--tekst-blagi); }
.mrvice .kosa { color: var(--tekst-ugaseni); }
.mrvice .poslednja { color: var(--tekst); font-weight: 600; }

.sadrzaj { flex: 1; min-height: 0; overflow: auto; padding: 20px; }

/* Stranica zauzima punu visinu, kartica liste se rasteže */
.panel { height: 100%; display: flex; flex-direction: column; gap: 20px; }
.panel > .forma { flex-shrink: 0; }

/* ------------------------------------------------------------------ */
/* Dugmad                                                              */
/* ------------------------------------------------------------------ */

button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: var(--visina-dugmeta);
  padding: 0 19px;
  border: none;
  border-radius: var(--radius-dugme);
  background: var(--akcent);
  color: #fff;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  box-shadow: var(--akcent-senka);
  transition: transform .5s cubic-bezier(.34, 1.56, .64, 1), background .12s, border-color .12s, color .12s;
}
button:hover { background: var(--akcent-hover); }
button:active:not(:disabled) { transform: scale(.88); transition: transform .08s ease-out; }
button:focus { outline: none; }
button:focus-visible { outline: 2px solid var(--tekst); outline-offset: 2px; }
button > span:first-child:not(:only-child) { font-weight: 600; }

button.secondary {
  background: var(--kartica);
  color: var(--tekst-telo);
  border: 1px solid var(--ivica);
  box-shadow: none;
  font-size: 13.5px;
  font-weight: 500;
  padding: 0 14px;
}
button.secondary:hover { background: var(--kartica-tiho); }

/* Dugme samo sa ikonom (41×41) */
button.ikona-dugme {
  width: var(--visina-dugmeta);
  height: var(--visina-dugmeta);
  padding: 0;
  flex-shrink: 0;
  background: var(--kartica);
  color: var(--tekst-blagi);
  border: 1px solid var(--ivica);
  box-shadow: none;
}
button.ikona-dugme:hover { background: var(--kartica-tiho); color: var(--tekst); }
button.ikona-dugme.opasno { color: var(--crvena); }
button.ikona-dugme.opasno:hover { background: var(--crvena-blaga); color: var(--crvena); }

button.puna-crvena { background: var(--crvena); color: #fff; box-shadow: none; }
button.puna-crvena:hover { background: #b91c1c; }

button:disabled { opacity: .45; cursor: not-allowed; }
button.secondary:disabled:hover { background: var(--kartica); }

/* Katanac za ručnu izmenu težina */
.vrh-dugmici { display: flex; align-items: center; gap: 8px; }
.katanac .ik-otkljucano { display: none; }
.katanac.otkljucan .ik-zakljucano { display: none; }
.katanac.otkljucan .ik-otkljucano { display: inline; }
.katanac.otkljucan { background: var(--zuta-blaga); border-color: var(--zuta-ivica); color: var(--zuta); }
.katanac.otkljucan:hover { background: #fef3c7; }

/* ------------------------------------------------------------------ */
/* Polja                                                               */
/* ------------------------------------------------------------------ */

input, select, textarea {
  width: 100%;
  height: var(--visina-polja);
  padding: 0 14px;
  border: 1px solid var(--ivica-jaca);
  border-radius: var(--radius);
  background: var(--kartica);
  color: var(--tekst);
  font-family: inherit;
  font-size: 13.5px;
  font-variant-numeric: tabular-nums;
  outline: none;
  transition: border-color .12s;
}
select {
  appearance: none;
  padding-right: 38px;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23737373' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  cursor: pointer;
}
input::placeholder { color: var(--tekst-tihi); }
input:focus, select:focus { border-color: var(--akcent); }

/* Obavezno polje koje je korisnik ostavio prazno */
input:user-invalid, select:user-invalid { border-color: var(--crvena); }
/* Nepostojeći ili nepotpun datum */
input.datum-neispravan, .kupci td.odgovor input.datum-neispravan {
  border-color: var(--crvena);
  background: var(--crvena-blaga);
  color: var(--crvena);
  font-weight: 600;
}

input[readonly] { background: var(--kartica-tiho); color: var(--tekst-tihi); cursor: default; }
input[readonly]:focus { border-color: var(--ivica-jaca); }
input[type="search"]::-webkit-search-cancel-button { cursor: pointer; }

/* Checkbox kao u Siriusu: 18×18, zaobljen 4px */
input[type="checkbox"] {
  appearance: none;
  width: 18px;
  height: 18px;
  padding: 0;
  flex-shrink: 0;
  border: 1.5px solid #7d7d7d;
  border-radius: 4px;
  background: var(--kartica);
  cursor: pointer;
  display: inline-grid;
  place-content: center;
}
input[type="checkbox"]:checked {
  background: var(--akcent) url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='8' viewBox='0 0 10 8' fill='none' stroke='white' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M1 4L3.5 6.5L9 1'/%3E%3C/svg%3E") no-repeat center;
  border-color: var(--akcent);
}

.check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: var(--visina-dugmeta);
  padding: 0 14px;
  border: 1px solid var(--ivica);
  border-radius: var(--radius-dugme);
  background: var(--kartica);
  color: var(--tekst-telo);
  font-size: 13.5px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
}

/* ------------------------------------------------------------------ */
/* Kartica stranice: naslov, alatke, tabela, straničenje               */
/* ------------------------------------------------------------------ */

.lista-kartica {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--kartica);
  border: 1px solid var(--ivica);
  border-radius: var(--radius-veliki);
  box-shadow: var(--senka-kartica);
  overflow: hidden;
  position: relative;
}
.lista-vrh { padding: 20px 24px 0; flex-shrink: 0; }

.naslov-red {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 41px;
  margin-bottom: 14px;
}
.naslov-red h1 { font-size: 24px; font-weight: 700; color: var(--tekst); letter-spacing: -.3px; line-height: 1.2; }
.naslov-levo { display: flex; align-items: center; gap: 12px; min-width: 0; }
.naslov-levo h1 { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.naslov-akcije { display: flex; align-items: center; gap: 8px; }
.podnaslov { margin: -6px 0 2px; color: var(--tekst-blagi); font-size: 13.5px; line-height: 1.6; }
.podnaslov strong { color: var(--tekst); font-weight: 600; }

/* Red alatki: brojač, filteri i pretraga uz desnu ivicu */
.alatke-red {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 0;
}
.alatke-red.levo { justify-content: flex-start; }
.alatke-red select {
  width: auto;
  height: var(--visina-dugmeta);
  border-color: var(--ivica);
  border-radius: var(--radius-dugme);
  color: var(--tekst-telo);
  font-weight: 500;
}

/* Brojač zapisa (pilula) */
.lista-brojac {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 11px 0 9px;
  border-radius: 999px;
  background: var(--akcent-svetlo);
  border: 1px solid var(--ivica);
  color: var(--tekst);
  font-size: 13px;
}
.lista-brojac:empty { display: none; }
.lista-brojac svg { width: 15px; height: 15px; color: var(--tekst-blagi); }
.lista-brojac b { font-weight: 600; }
.lista-brojac .od { color: var(--tekst-blagi); }

/* Polje pretrage sa lupom */
.pretraga-polje {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: var(--visina-dugmeta);
  padding: 0 12px;
  border: 1px solid var(--ivica);
  border-radius: var(--radius-dugme);
  background: var(--kartica);
  color: var(--tekst-tihi);
  transition: border-color .12s;
}
.pretraga-polje:focus-within { border-color: var(--akcent); }
.pretraga-polje svg { width: 17px; height: 17px; flex-shrink: 0; }
.pretraga-polje input {
  width: 120px;
  height: auto;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--tekst-telo);
}

/* Prostor za tabelu — broj redova po strani se prilagođava visini */
.tabela-prostor { flex: 1 1 0; min-height: 0; overflow: auto; }
/* prva kolona u ravni sa naslovom kartice (24px), kao u Siriusu */
.tabela-prostor th:first-child, .tabela-prostor td:first-child { padding-left: 24px; }

/* Straničenje */
.lista-dno {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-shrink: 0;
  padding: 12px 20px;
  border-top: 1px solid var(--ivica-tiha);
}
.lista-dno:empty { display: none; }
.lista-dno .str-nav {
  height: auto;
  padding: 6px 12px;
  gap: 4px;
  border-radius: 8px;
  border: 1px solid var(--ivica);
  background: var(--kartica);
  color: var(--tekst-telo);
  font-size: 13px;
  font-weight: 500;
  box-shadow: none;
}
.lista-dno .str-nav:hover { background: var(--kartica-tiho); }
.lista-dno .str-nav:disabled { opacity: 1; background: var(--kartica-tiho); color: var(--tekst-ugaseni); }
.lista-dno .str-nav svg { width: 16px; height: 16px; }
.str-brojevi { display: flex; align-items: center; gap: 3px; }
.str-brojevi button {
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--tekst-telo);
  font-size: 13px;
  font-weight: 400;
  box-shadow: none;
}
.str-brojevi button:hover { background: var(--kartica-tiho); }
.str-brojevi button.akt { background: var(--akcent); color: #fff; font-weight: 700; }
.str-brojevi .tri { width: 32px; text-align: center; color: var(--tekst-tihi); font-size: 13px; }

/* ------------------------------------------------------------------ */
/* Tabele                                                              */
/* ------------------------------------------------------------------ */

table { width: 100%; border-collapse: collapse; font-size: 13.5px; background: var(--kartica); }
th {
  padding: 10px 14px;
  text-align: left;
  font-size: 14px;
  font-weight: 700;
  color: var(--tekst);
  background: var(--kartica-tiho);
  border-bottom: 1px solid var(--ivica-tiha);
  white-space: nowrap;
}
td {
  padding: 11px 14px;
  color: var(--tekst-telo);
  border-bottom: 1px solid var(--ivica-red);
  vertical-align: middle;
  white-space: nowrap;
}
td strong, td b { color: var(--tekst); font-weight: 500; }
tbody tr:hover td { background: var(--kartica-tiho); }
td.broj, th.broj { text-align: right; font-variant-numeric: tabular-nums; }

/* Kolona „Akcija" */
th.akcija { width: 80px; min-width: 80px; padding: 10px 30px 10px 8px; text-align: center; }
td.akcija { width: 80px; min-width: 80px; padding: 11px 32px 11px 14px; text-align: right; }
td .akcije-celija { display: flex; justify-content: flex-end; gap: 6px; }
td button.ikona {
  width: 30px;
  height: 30px;
  padding: 0;
  border-radius: 7px;
  border: 1px solid var(--ivica);
  background: var(--kartica);
  color: var(--tekst-blagi);
  box-shadow: none;
}
td button.ikona:hover { color: var(--tekst); background: var(--kartica-tiho); }
td button.ikona.opasno:hover { color: var(--crvena); background: var(--crvena-blaga); }
td button.ikona svg { width: 18px; height: 18px; }

.tabela-omot { overflow-x: auto; }

/* Prazna lista */
.prazno { padding: 48px; text-align: center; color: var(--tekst-tihi); font-size: 13.5px; }
.lista-kartica .prazno { border-top: 1px solid var(--ivica-tiha); }

/* ------------------------------------------------------------------ */
/* Bedževi i poruke                                                    */
/* ------------------------------------------------------------------ */

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 23px;
  padding: 4px 8px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 500;
  line-height: 15px;
}
.badge.zeleno { background: var(--zelena-blaga); color: var(--zelena); }
.badge.sivo { background: #f4f4f5; color: #525252; }
.badge.narandzasto { background: var(--zuta-blaga); color: var(--zuta); }

/* Obaveštenje: tamna pilula pri vrhu, po sredini */
.poruka {
  position: fixed;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 120;
  max-width: 90vw;
  padding: 10px 18px;
  border-radius: 999px;
  background: var(--tekst);
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .3);
}
.poruka.greska { background: var(--crvena); }

/* ------------------------------------------------------------------ */
/* Forme (ulaz, izlaz, povlačenje)                                     */
/* ------------------------------------------------------------------ */

.forma {
  background: var(--kartica);
  border: 1px solid var(--ivica);
  border-radius: var(--radius-veliki);
  box-shadow: var(--senka-kartica);
  padding: 20px 24px 24px;
}
.forma-vrh {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 41px;
  margin-bottom: 16px;
}
.forma h2 { font-size: 24px; font-weight: 700; letter-spacing: -.3px; color: var(--tekst); }
.forma h3 { font-size: 14px; font-weight: 700; color: var(--tekst); margin: 24px 0 12px; }
.forma label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 16px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--tekst-telo);
}
.forma .red { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 0 16px; }
.forma .akcije { display: flex; gap: 12px; margin-top: 24px; max-width: 440px; }
.forma .akcije button { flex: 1; height: auto; padding: 12px; font-size: 14px; }
.hint { font-size: 13px; color: var(--tekst-blagi); margin-bottom: 10px; line-height: 1.5; }
.obavezno { color: var(--crvena); margin-left: 2px; }
#ulaz-dodaj-stavku, #izlaz-dodaj-stavku { margin-top: 12px; }

/* ------------------------------------------------------------------ */
/* Dijalog registra (artikal, HS, zemlja, dobavljač, klijent)          */
/* ------------------------------------------------------------------ */

.dijalog-pozadina {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(10, 10, 10, .45);
  backdrop-filter: blur(2px);
}
.forma.dijalog {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 51;
  width: 480px;
  max-width: 90vw;
  max-height: 90vh;
  overflow: auto;
  padding: 24px;
  border: none;
  border-radius: 14px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .25);
}
.forma.dijalog .forma-vrh { min-height: 0; margin-bottom: 20px; }
.forma.dijalog h2 { font-size: 18px; font-weight: 600; letter-spacing: 0; }
.forma.dijalog .red { grid-template-columns: 1fr 1fr; }
.forma.dijalog .akcije { max-width: none; margin-top: 8px; }
.forma.dijalog .dijalog-obrisi { width: 36px; height: 36px; }
.forma.dijalog:not(.izmena) .dijalog-obrisi { display: none; }

/* ------------------------------------------------------------------ */
/* Stavke u formi                                                      */
/* ------------------------------------------------------------------ */

.stavke-omot { border: 1px solid var(--ivica); border-radius: 12px; overflow-x: auto; }
.stavke-tabela th { font-size: 13px; padding: 10px 6px; }
.stavke-tabela th:first-child, .stavke-tabela td:first-child { padding-left: 12px; }
.stavke-tabela th:last-child, .stavke-tabela td:last-child { padding-right: 12px; }
.stavke-tabela td { padding: 6px; border-bottom: none; }
.stavke-tabela input, .stavke-tabela select { height: 38px; padding: 0 10px; font-size: 13.5px; }
.stavke-tabela select { padding-right: 30px; background-position: right 10px center; }
.stavke-tabela tbody tr:hover td { background: transparent; }
.stavke-tabela td button.ikona { width: 38px; height: 38px; }

/* Ručno unete težine i izmenjena cijena */
.stavke-tabela input.rucna-tezina,
.stavke-tabela input.izmenjena-cijena {
  background: var(--zuta-blaga);
  border-color: #fcd34d;
  color: var(--zuta);
  font-weight: 600;
}
.stavke-tabela input.izmenjena-cijena:focus { border-color: #f59e0b; }

/* Padajuća lista sa pretragom (artikal / proizvod) */
.artikal-celija { position: relative; min-width: 250px; }
.artikal-lista {
  position: absolute;
  top: calc(100% + 4px);
  left: 8px;
  right: 8px;
  z-index: 20;
  max-height: 300px;
  overflow-y: auto;
  padding: 8px;
  background: var(--kartica);
  border: 1px solid var(--ivica);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .12);
}
.artikal-opcija {
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 13.5px;
  font-weight: 400;
  color: var(--tekst-telo);
  cursor: pointer;
}
.artikal-opcija:hover { background: #f4f6f6; }
.artikal-opcija.aktivna { background: #f4f6f6; color: var(--tekst); font-weight: 600; }
.artikal-opcija.aktivna span { opacity: .75 !important; }
.artikal-prazno { padding: 8px 10px; color: var(--tekst-blagi); font-size: 13px; font-weight: 400; }

/* ------------------------------------------------------------------ */
/* Povlačenje: proizvod i serije kao oznake                            */
/* ------------------------------------------------------------------ */

.forma .povlacenje-red { grid-template-columns: 160px 180px minmax(0, 1fr); }
.proizvod-celija { display: block; min-width: 0; }
.proizvod-celija .artikal-lista { left: 0; right: 0; }
.serije-polje {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  min-height: var(--visina-polja);
  padding: 6px 8px;
  border: 1px solid var(--ivica-jaca);
  border-radius: var(--radius);
  background: var(--kartica);
  font-weight: 400;
  cursor: text;
  transition: border-color .12s;
}
.serije-polje:focus-within { border-color: var(--akcent); }
.serije-polje input { flex: 1; min-width: 200px; width: auto; height: 28px; padding: 0 6px; border: none; }
.serija-oznaka {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  height: 28px;
  padding: 0 4px 0 10px;
  border-radius: 8px;
  background: #f4f4f5;
  color: var(--tekst);
  font-size: 13px;
  font-weight: 600;
}
.serija-oznaka button {
  width: 20px;
  height: 20px;
  padding: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--tekst-blagi);
  font-size: 15px;
  line-height: 1;
  box-shadow: none;
}
.serija-oznaka button:hover { background: var(--ivica); color: var(--tekst); }
.serija-predlog {
  height: 26px;
  margin: 0 4px 4px 0;
  padding: 0 10px;
  border-radius: 8px;
  border: 1px dashed var(--ivica-jaca);
  background: var(--kartica);
  color: var(--tekst-telo);
  font-size: 12.5px;
  font-weight: 500;
  box-shadow: none;
}
.serija-predlog:hover { background: var(--kartica-tiho); border-style: solid; }
td .serije-lista { display: flex; flex-wrap: wrap; gap: 4px; }

/* Kupci: količine po seriji naslagane u ćeliji — po jedna linija za svaku seriju.
   Sve ćelije su poravnate uz vrh, pa naziv i polja stoje u ravni prve serije. */
.kupci td { vertical-align: top; }
.kupci td:not(.slog):not(.fiks) { padding-top: 5px; }
.kupci td.fiks:not(.slog) { padding-top: 12px; }
.kupci td.slog { padding: 4px 6px; vertical-align: top; }
.kupci td.slog.fiks { padding-left: 10px; text-align: left; }
.kupci .slog-red { display: flex; align-items: center; gap: 6px; height: 30px; }
.kupci .slog-red + .slog-red { margin-top: 3px; }
.kupci .ser {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 56px;
  height: 22px;
  padding: 0 7px;
  border-radius: 6px;
  background: #f4f4f5;
  color: var(--tekst);
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
}
.kupci .slog-red b { min-width: 36px; text-align: right; font-variant-numeric: tabular-nums; }
.kupci .slog-red input { height: 28px; width: 72px; text-align: right; }
.kupci td.slog input[name="na_stanju"], .kupci td.slog input[name="primljena_kol"] { width: 72px; }
.kupci tbody tr.zavrseno .ser { color: var(--tekst-tihi); }
#stampa-povlacenja .sp-ser { display: inline-block; min-width: 40px; padding: 0 4px; border: 1px solid #ccc; border-radius: 4px; font-size: 8px; font-weight: 700; text-align: center; }

/* Kupci u povlačenju: prve četiri kolone iz Excela su zalepljene levo,
   praćenje (datumi, količine, status) se pomjera desno */
.kupci-vrh {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin: 24px 0 12px;
}
.kupci-vrh { align-items: center; }
.kupci-vrh h3 { margin: 0; }
.kupci-vrh .vrh-dugmici { flex-wrap: wrap; justify-content: flex-end; }
.forma label.check { flex-direction: row; align-items: center; gap: 8px; margin: 0; font-size: 13.5px; font-weight: 500; }
.kupci-vrh .pretraga-polje input { width: 190px; }
#povlacenje-predlozi:empty { display: none; }
.kupci-omot { border: 1px solid var(--ivica); border-radius: 12px; overflow: auto; max-height: 60vh; }
.kupci { width: max-content; min-width: 100%; border-collapse: separate; border-spacing: 0; }
.kupci th, .kupci td { white-space: nowrap; padding: 6px; border-bottom: 1px solid var(--ivica-red); }
.kupci th { position: sticky; top: 0; z-index: 3; font-size: 13px; padding: 10px 6px; border-bottom: 1px solid var(--ivica-tiha); }
.kupci th.fiks, .kupci td.fiks { position: sticky; z-index: 2; background: var(--kartica); overflow: hidden; text-overflow: ellipsis; padding: 6px 10px; }
.kupci th.fiks { z-index: 4; background: var(--kartica-tiho); }
.kupci .k1 { left: 0;     width: 120px; min-width: 120px; max-width: 120px; }
.kupci .k2 { left: 120px; width: 260px; min-width: 260px; max-width: 260px; }
.kupci .k3 { left: 380px; width: 220px; min-width: 220px; max-width: 220px; }
.kupci .k4 { left: 600px; width: 128px; min-width: 128px; max-width: 128px; text-align: right; font-variant-numeric: tabular-nums;
  border-right: 1px solid var(--ivica); box-shadow: 4px 0 8px -5px rgba(0, 0, 0, .12); }
.kupci td.k2, .kupci td.k3 { color: var(--tekst); }
.kupci td.k2 { font-weight: 500; }
.kupci td.k4 { font-weight: 600; }
.kupci tbody tr:hover td { background: var(--kartica-tiho); }
.kupci tbody tr:hover td.fiks { background: var(--kartica-tiho); }
.kupci tbody tr.zavrseno td { color: var(--tekst-tihi); }
.kupci tbody tr.zavrseno td.fiks { color: var(--tekst-tihi); font-weight: 400; }
.kupci input, .kupci select { height: 36px; font-size: 13px; }
.kupci input[name$="_poslat"], .kupci input[name="podsjetnik"], .kupci input[name="poziv"],
.kupci input[name="odgovor_primljen"], .kupci input[name="datum_prijema"] { width: 116px; }
.kupci input[name="na_stanju"], .kupci input[name="primljena_kol"] { width: 96px; text-align: right; }
.kupci input[name="broj_pk"] { width: 130px; }
.kupci select[name="status"] { width: 122px; padding-right: 30px; background-position: right 10px center; }

/* Odgovor kupca (Odgovor primljen, Na stanju kod kupca): plava polja za unos */
.kupci th.odgovor { color: #1e40af; }
.kupci td.odgovor input { background: #eff6ff; border-color: #bfdbfe; }
.kupci td.odgovor input:focus { border-color: #2563eb; }
.kupci select.zavrseno { background-color: var(--zelena-blaga); border-color: #bbf7d0; color: var(--zelena); font-weight: 600; }
.kupci td.akcija { width: 50px; min-width: 50px; padding: 6px 10px 6px 4px; }
.kupci td.akcija button.ikona { width: 34px; height: 34px; }
.kupci-prazno {
  padding: 28px;
  text-align: center;
  color: var(--tekst-tihi);
  border: 1px dashed var(--ivica-jaca);
  border-radius: 12px;
  font-size: 13.5px;
}

/* ------------------------------------------------------------------ */
/* Otpremnice                                                          */
/* ------------------------------------------------------------------ */

#otpremnice { margin-top: 28px; border-top: 1px solid var(--ivica-tiha); padding-top: 20px; }
.otpremnice-vrh {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.otpremnice-vrh h3 { margin: 0; }
.otpremnice-vrh .hint { margin: 3px 0 0; }

.otpremnica {
  border: 1px solid var(--ivica);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 16px;
  background: var(--kartica);
}
.otpremnica-glava {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
  padding-bottom: 14px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--ivica-tiha);
}
.otpremnica-glava h4 { font-size: 15px; font-weight: 700; }
.ot-meta { font-size: 12.5px; color: var(--tekst-blagi); line-height: 1.65; margin-top: 5px; }
.ot-meta strong { color: var(--tekst); font-weight: 600; }
.ot-meta.desno { text-align: right; }
.otpremnica table { border: 1px solid var(--ivica); border-radius: 10px; border-collapse: separate; border-spacing: 0; overflow: hidden; }
.otpremnica th { font-size: 13px; }
.otpremnica tr.ot-zbir td { font-weight: 700; background: var(--kartica-tiho); border-top: 1px solid var(--ivica); border-bottom: none; }

.ot-imh {
  display: flex;
  align-items: flex-end;
  gap: 14px;
  flex-wrap: wrap;
  padding: 13px 15px;
  margin-bottom: 14px;
  border-radius: 10px;
  background: var(--kartica-tiho);
  border: 1px solid var(--ivica);
}
.ot-imh.nepotpuna { background: var(--zuta-blaga); border-color: var(--zuta-ivica); }
.ot-imh label { display: flex; flex-direction: column; gap: 5px; margin: 0; font-size: 12.5px; font-weight: 600; color: var(--tekst-telo); }
.ot-imh input { width: 180px; height: 38px; }
.ot-ceka { font-size: 12.5px; color: var(--zuta); font-weight: 600; padding-bottom: 10px; }
.ot-imh:not(.nepotpuna) .ot-ceka { display: none; }

/* Potpisi samo pri štampi */
.ot-potpisi { display: none; justify-content: space-between; gap: 20px; margin-top: 26px; font-size: 12.5px; color: var(--tekst-blagi); flex-wrap: wrap; }

/* Izlaz kome nedostaje IMH na otpremnicama */
tbody tr.ceka-imh td { background: var(--zuta-blaga); }
tbody tr.ceka-imh:hover td { background: #fef3c7; }
tbody tr.ceka-imh td:first-child { box-shadow: inset 3px 0 0 #f59e0b; }

/* ------------------------------------------------------------------ */
/* Lager — KPI pločice                                                 */
/* ------------------------------------------------------------------ */

.kpi { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 2px; }
.kpi:empty { display: none; }
.kpi > div {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px 16px;
  border: 1px solid var(--ivica);
  border-radius: 14px;
  background: var(--kartica);
}
.kpi span { font-size: 10px; font-weight: 700; letter-spacing: .8px; text-transform: uppercase; color: var(--tekst-tihi); }
.kpi b { font-size: 19px; font-weight: 800; letter-spacing: -.3px; color: var(--tekst); font-variant-numeric: tabular-nums; }
.kpi .zeleno-k { background: var(--zelena-blaga); border-color: #bbf7d0; }
.kpi .zeleno-k b { color: #15803d; }
.kpi .zuto-k { background: var(--zuta-blaga); border-color: var(--zuta-ivica); }
.kpi .zuto-k b { color: var(--zuta); }
.kpi .crveno-k { background: var(--crvena-blaga); border-color: var(--crvena-ivica); }
.kpi .crveno-k b { color: var(--crvena); }

/* ------------------------------------------------------------------ */
/* Pregled ulaza — segmentirani tabovi i sadržaj                       */
/* ------------------------------------------------------------------ */

.pod-tabovi {
  display: inline-flex;
  gap: 2px;
  height: var(--visina-dugmeta);
  padding: 2px;
  background: #f4f4f5;
  border: 1px solid #e9e9eb;
  border-radius: 9px;
}
.pod-tab {
  height: 100%;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: var(--tekst-blagi);
  font-size: 13px;
  font-weight: 500;
  box-shadow: none;
}
.pod-tab:hover { background: transparent; color: var(--tekst); }
.pod-tab.akt { background: var(--kartica); border-color: var(--ivica); color: var(--tekst); font-weight: 600; box-shadow: 0 1px 2px rgba(0, 0, 0, .05); }
.pod-tab.akt:hover { background: var(--kartica); }

#pregled-sadrzaj { flex: 1; min-height: 0; overflow: auto; display: flex; flex-direction: column; }
#pregled-sadrzaj.kilaza { padding: 4px 24px 24px; display: block; }
#pregled-sadrzaj > .hint { padding: 0 24px; }

/* Matrica stanja (Lager) */
.matrica-omot { overflow-x: auto; background: var(--kartica); }
.matrica { width: max-content; min-width: 100%; border-collapse: separate; border-spacing: 0; }
.matrica th, .matrica td { white-space: nowrap; padding: 11px 14px; }
.matrica th { font-size: 13.5px; }
.matrica tbody tr:hover td { background: var(--kartica-tiho); }
.matrica tbody tr:hover td.stanje-cel { background: #dcfce7; }

.matrica th.fiks, .matrica td.fiks {
  position: sticky;
  background: var(--kartica);
  z-index: 2;
  overflow: hidden;
  text-overflow: ellipsis;
}
.matrica th.fiks { background: var(--kartica-tiho); z-index: 3; }
.matrica .f1 { left: 0;     width: 92px;  min-width: 92px;  max-width: 92px; }
.matrica .f2 { left: 92px;  width: 260px; min-width: 260px; max-width: 260px; }
.matrica .f3 { left: 352px; width: 116px; min-width: 116px; max-width: 116px; }
.matrica .f4 { left: 468px; width: 110px; min-width: 110px; max-width: 110px; }
.matrica .f4 { border-right: 1px solid var(--ivica); box-shadow: 4px 0 8px -5px rgba(0, 0, 0, .12); }
.matrica td.stanje-cel { font-weight: 700; color: var(--tekst); background: var(--zelena-blaga); text-align: right; }
.matrica td.stanje-cel.prazno-st { background: var(--kartica-tiho); color: var(--tekst-blagi); font-weight: 600; }
.matrica td.rok-blizu { color: var(--zuta); font-weight: 600; }
.matrica td.rok-istekao { color: var(--crvena); font-weight: 700; }
.matrica.lager .f1 { width: 142px; min-width: 142px; max-width: 142px; }   /* +10px zbog uvlake 24px */
.matrica.lager .f2 { left: 142px; }
.matrica.lager .f3 { left: 402px; }
.matrica.lager .f4 { left: 518px; }
.matrica tbody tr.klik { cursor: pointer; }

/* ------------------------------------------------------------------ */
/* Obrnuta matrica — izlazi su redovi, artikli kolone                  */
/* ------------------------------------------------------------------ */

.omatrica-omot { flex: 1; min-height: 0; overflow: auto; background: var(--kartica); border-top: 1px solid var(--ivica-tiha); }
.omatrica { width: max-content; min-width: 100%; border-collapse: separate; border-spacing: 0; }
.omatrica th, .omatrica td { border-bottom: 1px solid var(--ivica-red); white-space: nowrap; padding: 10px 14px; }
.omatrica td.broj { text-align: right; font-variant-numeric: tabular-nums; }

/* Zaglavlje u dva reda: gore artikal, ispod serija · rok.
   Visine moraju biti tačne da između zalepljenih redova ne ostane procjep. */
.omatrica thead th { position: sticky; background: var(--kartica-tiho); z-index: 3; }
.omatrica thead tr.art-red th {
  top: 0;
  border-bottom: none;
  padding: 11px 14px 2px;
  line-height: 16px;
  vertical-align: bottom;
  text-align: right;
  font-size: 13px;
  font-weight: 700;
  color: var(--tekst);
  min-width: 118px;
}
.omatrica thead tr.serija-red th {
  top: 29px;
  padding: 0 14px 10px;
  line-height: 15px;
  text-align: right;
  font-size: 11px;
  font-weight: 500;
  color: var(--tekst-blagi);
  border-bottom: 1px solid var(--ivica-tiha);
}
.omatrica .rok-blizu { color: var(--zuta); font-weight: 650; }
.omatrica .rok-istekao { color: var(--crvena); font-weight: 700; }

/* Prva kolona (izlaz / IMH / klijent) ostaje vidljiva pri pomeranju udesno */
.omatrica .prva {
  position: sticky;
  left: 0;
  z-index: 2;
  background: var(--kartica);
  text-align: left;
  min-width: 250px;
  border-right: 1px solid var(--ivica);
  box-shadow: 4px 0 8px -5px rgba(0, 0, 0, .12);
}
.omatrica thead .prva { z-index: 4; background: var(--kartica-tiho); padding-left: 24px; }
.omatrica tbody .prva, .omatrica tfoot .prva { padding-left: 24px; }
.omatrica .prva .dat { color: var(--tekst-tihi); font-weight: 400; }

.omatrica tr.ulaz-red td { background: var(--zelena-blaga); font-weight: 700; color: var(--tekst); }
.omatrica tbody tr:hover td { background: var(--kartica-tiho); }
.omatrica tbody tr.ulaz-red:hover td { background: #dcfce7; }

/* Red STANJE zalepljen za dno — vidi se i kad ima 30 izlaza */
.omatrica tfoot td {
  position: sticky;
  bottom: 0;
  z-index: 3;
  background: #eaf7ee;
  font-weight: 700;
  color: var(--tekst);
  border-top: 2px solid #bbf7d0;
  border-bottom: none;
}
.omatrica tfoot .prva { z-index: 5; background: #eaf7ee; }
.omatrica tfoot td.nula { color: var(--tekst-blagi); font-weight: 600; }
.omatrica .prazna { color: var(--ivica-jaca); }
.omatrica .zbir-kol { border-left: 1px solid var(--ivica); font-weight: 650; padding-right: 24px; }

/* Kilaža po naimenovanju */
.naim { border: 1px solid var(--ivica); border-radius: 12px; overflow: hidden; margin-top: 16px; background: var(--kartica); }
.naim-glava {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 13px 18px;
  background: var(--kartica-tiho);
  border-bottom: 1px solid var(--ivica-tiha);
  font-size: 13.5px;
  font-weight: 700;
}
.naim-glava .ostatak { font-weight: 400; color: var(--tekst-blagi); }
.naim-glava .ostatak b { color: var(--tekst); }
.naim th { font-size: 13px; }
.naim tr.imj-red td { background: var(--zelena-blaga); font-weight: 650; color: var(--tekst); }
.naim td.ostaje-cel { font-weight: 650; color: var(--tekst); background: var(--kartica-tiho); }
.naim th.grupa-poc, .naim td.grupa-poc { border-left: 1px solid var(--ivica); }
.naim tbody tr:last-child td { border-bottom: none; }

/* ------------------------------------------------------------------ */
/* Modal — brisanje uz lozinku i potvrda                               */
/* ------------------------------------------------------------------ */

.modal-pozadina {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(10, 10, 10, .45);
  backdrop-filter: blur(2px);
}
.modal {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 380px;
  max-width: 100%;
  padding: 28px;
  border-radius: 14px;
  background: var(--kartica);
  box-shadow: 0 8px 32px rgba(0, 0, 0, .18);
}
.modal-glava { display: flex; align-items: center; gap: 10px; }
.modal-ikona {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: var(--crvena-tint);
  color: var(--crvena);
}
.modal h2 { font-size: 16px; font-weight: 700; color: var(--tekst); }
.modal p { font-size: 13.5px; color: var(--tekst-blagi); line-height: 1.6; }
.modal label { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; font-size: 12.5px; font-weight: 600; color: var(--tekst-telo); }
.modal label:last-child { margin-bottom: 0; }
.modal .hint { margin-bottom: 12px; }
.modal .akcije { display: flex; gap: 10px; }
.modal .akcije button { flex: 1; height: auto; padding: 11px; border-radius: 9px; font-size: 13.5px; }

/* ------------------------------------------------------------------ */
/* Štampa povlačenja — A4 položeno, sve kolone na jednoj širini        */
/* ------------------------------------------------------------------ */

#stampa-povlacenja { display: none; color: #111; background: #fff; }
.sp-glava {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 8px;
  margin-bottom: 10px;
  border-bottom: 1.5px solid #171717;
}
.sp-brend { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 700; letter-spacing: -.3px; }
.sp-brend .logo-ikona { width: 22px; height: 22px; }
.sp-brend b span { color: #16a34a; }
.sp-naslov { flex: 1; text-align: center; }
.sp-naslov h1 { font-size: 16px; font-weight: 700; margin: 0 0 3px; }
.sp-naslov div { font-size: 10.5px; color: #444; }
.sp-naslov b { color: #111; }
.sp-desno { text-align: right; font-size: 10px; color: #444; line-height: 1.5; white-space: nowrap; }
#stampa-povlacenja table { width: 100%; border-collapse: collapse; font-size: 9px; table-layout: auto; }
#stampa-povlacenja th, #stampa-povlacenja td { border: 1px solid #bbb; padding: 3px 4px; vertical-align: top; line-height: 1.3; }
#stampa-povlacenja th { background: #f0f0f0; font-size: 8.5px; font-weight: 700; text-align: left; white-space: nowrap; }
#stampa-povlacenja th.br, #stampa-povlacenja td.br { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
#stampa-povlacenja td.dat, #stampa-povlacenja td.nw { white-space: nowrap; }
#stampa-povlacenja td.sivo { color: #888; }
#stampa-povlacenja tr.zavrseno td { color: #777; }
#stampa-povlacenja td.status-z { color: #15803d; font-weight: 700; }
#stampa-povlacenja thead { display: table-header-group; }
#stampa-povlacenja tr { page-break-inside: avoid; }
.sp-dno { margin-top: 8px; font-size: 9px; color: #666; display: flex; justify-content: space-between; }

/* ------------------------------------------------------------------ */
/* Manji ekrani                                                        */
/* ------------------------------------------------------------------ */

@media (max-width: 900px) {
  .matrica .f2 { width: 180px; min-width: 180px; max-width: 180px; }
  .matrica .f3 { left: 272px; }
  .matrica .f4 { left: 388px; }
  .matrica.lager .f3 { left: 322px; }
  .matrica.lager .f4 { left: 438px; }
  .forma .povlacenje-red { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 760px) {
  body { flex-direction: column; overflow: auto; height: auto; }
  html { height: auto; }
  .sidebar { width: 100%; height: auto; }
  .sidebar nav { display: flex; flex-wrap: wrap; padding: 8px; }
  .nav-sekcija { padding: 0; display: contents; }
  .nav-grupa, .sidebar-dno { display: none; }
  .nav-sekcija.skupljena .nav-stavke, .nav-stavke { display: contents; }
  .tab { width: auto; margin: 2px; }
  main { height: auto; overflow: visible; }
  .sadrzaj { padding: 16px; overflow: visible; }
  .panel { height: auto; }
  .lista-kartica { flex: none; }
  .tabela-prostor { flex: none; }
  .lista-vrh { padding: 16px 16px 0; }
  .pretraga-polje, .pretraga-polje input { width: 100%; }
  .pretraga-polje { flex: 1 1 100%; }
  .forma { padding: 16px; }
  .forma.dijalog .red, .forma .povlacenje-red { grid-template-columns: 1fr; }
}

/* ------------------------------------------------------------------ */
/* Štampa                                                              */
/* ------------------------------------------------------------------ */

@media print {
  html, body, main, .sadrzaj, .panel, .lista-kartica, .tabela-prostor, #pregled-sadrzaj {
    height: auto !important;
    overflow: visible !important;
    display: block !important;
  }
  .panel.hidden, .hidden { display: none !important; }
  body { background: #fff; }
  .sadrzaj { padding: 0; }
  .lista-kartica { border: none; box-shadow: none; border-radius: 0; }
  .lista-vrh { padding: 0 0 10px; }

  /* Štampa otpremnica: vidi se samo taj deo forme, svaka na svojoj strani */
  .stampa-otpremnice #izlaz-forma.forma { display: block !important; border: none; box-shadow: none; padding: 0; }
  .stampa-otpremnice #izlaz-forma > *:not(#otpremnice) { display: none !important; }
  .stampa-otpremnice #otpremnice { border-top: none; padding-top: 0; margin-top: 0; }
  .stampa-otpremnice .otpremnice-vrh { display: none !important; }
  .stampa-otpremnice .otpremnica {
    border: none;
    box-shadow: none;
    padding: 0;
    margin: 0 0 10mm;
    page-break-after: always;
    page-break-inside: avoid;
  }
  .stampa-otpremnice .otpremnica:last-child { page-break-after: auto; }
  .stampa-otpremnice .otpremnica-glava { border-bottom: 1px solid #999; }
  .stampa-otpremnice .otpremnica th,
  .stampa-otpremnice .otpremnica td { border-bottom: 1px solid #ccc; font-size: 10.5px; padding: 5px 7px; }
  .stampa-otpremnice .ot-imh { background: none; border: none; padding: 0 0 8px; }
  .stampa-otpremnice .ot-imh input { border: none; padding: 0; width: auto; height: auto; min-width: 120px; font-weight: 600; }
  .stampa-otpremnice .ot-ceka { display: none !important; }
  .stampa-otpremnice .ot-potpisi { display: flex !important; }

  /* Štampa povlačenja: samo pripremljeni ispis, ceo list je tabela */
  body.stampa-povlacenja > :not(#stampa-povlacenja) { display: none !important; }
  body.stampa-povlacenja #stampa-povlacenja { display: block; width: auto; min-height: 0; margin: 0; padding: 0; }

  .sidebar, .topbar, .alatke-red, .lista-dno, .forma, .pod-tabovi, button { display: none !important; }
  .kpi { margin-bottom: 12px; }
  .stampa-otpremnice .forma#izlaz-forma { display: block !important; }
  .matrica-omot, .omatrica-omot, .naim { border: none; box-shadow: none; overflow: visible; }
  .matrica th.fiks, .matrica td.fiks { position: static; box-shadow: none; }
  .omatrica thead th, .omatrica tfoot td, .omatrica .prva { position: static; box-shadow: none; }
  .omatrica th, .omatrica td { border-bottom: 1px solid #ccc; padding: 5px 7px; font-size: 10.5px; }
  .omatrica thead tr.art-red th { padding: 5px 7px 1px; line-height: 13px; }
  .omatrica thead tr.serija-red th { padding: 0 7px 5px; line-height: 12px; font-size: 9.5px; }
  th, td, .matrica th, .matrica td, .naim th, .naim td { border-bottom: 1px solid #ccc; padding: 5px 7px; font-size: 10.5px; }
  .naim { page-break-inside: avoid; }
}
