:root {
  --pl: #1C5DA6; --pl-t: #E3ECF7; --tx: #1b1f24; --mut: #6b7280; --bg: #f3f5f8; --kart: #fff; --rub: #dde3ea;
  --zel: #2F9E44; --zel-t: #E6F6EA; --nar: #E8590C; --nar-t: #FFF0E6; --crv: #C92A2A; --crv-t: #FDECEC; --siva: #868e96; --siva-t: #eef0f3;
  --zuta: #F08C00; --zuta-t: #FFF4DF; --ljub: #7048E8; --ljub-t: #F0EBFF;
  --r: 12px; --sjena: 0 1px 3px rgba(20,30,50,.08), 0 4px 14px rgba(20,30,50,.06);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { font: 16px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--tx); background: var(--bg); -webkit-tap-highlight-color: transparent; }
a { color: var(--pl); }
button { font: inherit; cursor: pointer; border: 0; border-radius: 10px; padding: 10px 16px; background: var(--pl); color: #fff; font-weight: 600; min-height: 42px; }
button:disabled { opacity: .5; cursor: default; }
button.sek { background: #fff; color: var(--pl); border: 1.5px solid var(--pl); }
button.siva { background: var(--siva-t); color: var(--tx); }
button.zel { background: var(--zel); }
button.crv { background: var(--crv); }
button.nar { background: var(--nar); }
button.mali { padding: 6px 10px; min-height: 34px; font-size: 14px; }
input, select, textarea { font: inherit; padding: 10px 12px; border: 1.5px solid var(--rub); border-radius: 10px; background: #fff; color: var(--tx); min-height: 42px; width: 100%; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--pl); outline-offset: 0; border-color: var(--pl); }
label { display: block; font-size: 13px; color: var(--mut); margin: 10px 0 4px; font-weight: 600; }
.ucitavanje { padding: 40px; text-align: center; color: var(--mut); }
#toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 99; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
#toast div { background: #222; color: #fff; padding: 10px 16px; border-radius: 10px; box-shadow: var(--sjena); font-size: 14px; animation: pop .2s; max-width: 90vw; }
#toast div.greska { background: var(--crv); }
#toast div.ok { background: var(--zel); }
@keyframes pop { from { opacity: 0; transform: translateY(8px);} }

/* prijava */
.prijava { min-height: 100vh; display: grid; place-items: center; padding: 16px; background: linear-gradient(160deg, #1C5DA6, #2F9E44); }
.prijava form { background: #fff; padding: 28px 24px; border-radius: 16px; width: 100%; max-width: 360px; box-shadow: var(--sjena); }
.prijava h1 { margin: 0 0 4px; font-size: 22px; color: var(--pl); }
.prijava p { margin: 0 0 12px; color: var(--mut); font-size: 14px; }
.prijava button { width: 100%; margin-top: 18px; }
.logo { width: 48px; height: 48px; margin-bottom: 8px; }

/* okvir */
header.vrh { background: var(--pl); color: #fff; padding: 10px 16px; display: flex; align-items: center; gap: 12px; position: sticky; top: 0; z-index: 10; box-shadow: var(--sjena); }
header.vrh .naslov { font-weight: 700; font-size: 17px; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
header.vrh .naslov small { display: block; font-weight: 400; font-size: 12px; opacity: .85; }
header.vrh button { background: rgba(255,255,255,.18); padding: 8px 12px; min-height: 36px; font-size: 14px; }
header.vrh .posl { background: #fff; color: var(--pl); padding: 4px 10px; border-radius: 999px; font-weight: 700; font-size: 13px; }
nav.tab { display: flex; gap: 4px; background: #fff; border-bottom: 1px solid var(--rub); padding: 6px 12px 0; overflow-x: auto; position: sticky; top: 56px; z-index: 9; }
nav.tab button { background: none; color: var(--mut); border-radius: 8px 8px 0 0; padding: 8px 14px; white-space: nowrap; border-bottom: 3px solid transparent; }
nav.tab button.akt { color: var(--pl); border-bottom-color: var(--pl); }
main { padding: 16px; max-width: 1100px; margin: 0 auto; }
main.siroko { max-width: 1400px; }
.kart { background: var(--kart); border-radius: var(--r); box-shadow: var(--sjena); padding: 14px 16px; margin-bottom: 14px; }
h2 { font-size: 18px; margin: 0 0 10px; }
h3 { font-size: 15px; margin: 14px 0 6px; color: var(--pl); }
.red { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.red > * { flex: 1; }
.red > .fix { flex: 0 0 auto; }
.mut { color: var(--mut); font-size: 13px; }
.tip { background: var(--pl-t); border-left: 4px solid var(--pl); padding: 10px 12px; border-radius: 8px; font-size: 14px; margin: 10px 0; }
.tip.nar { background: var(--nar-t); border-color: var(--nar); }
.tip.crv { background: var(--crv-t); border-color: var(--crv); }
.tip.zel { background: var(--zel-t); border-color: var(--zel); }
.znak { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.s-prazna { background: var(--siva-t); color: var(--siva); }
.s-otvorena { background: var(--pl-t); color: var(--pl); }
.s-na_ovjeri { background: var(--nar-t); color: var(--nar); }
.s-ovjerena { background: var(--zel-t); color: var(--zel); }
.s-zakljucana { background: #333; color: #fff; }
.kasno { color: var(--crv); font-weight: 700; font-size: 12px; }

/* dani (kalendar poslovnice) */
.dani { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.dan { background: #fff; border-radius: var(--r); box-shadow: var(--sjena); padding: 12px 14px; cursor: pointer; border-left: 6px solid var(--siva); display: flex; flex-direction: column; gap: 4px; transition: transform .1s; }
.dan:active { transform: scale(.98); }
.dan.b-otvorena { border-left-color: var(--pl); }
.dan.b-na_ovjeri { border-left-color: var(--nar); background: var(--nar-t); }
.dan.b-ovjerena { border-left-color: var(--zel); }
.dan.b-zakljucana { border-left-color: #333; opacity: .8; }
.dan.danas { outline: 2px solid var(--pl); }
.dan .d { font-weight: 700; font-size: 16px; }
.dan .d span { color: var(--mut); font-weight: 400; font-size: 13px; margin-left: 6px; }
.dan .info { font-size: 13px; color: var(--mut); }
.dan.prosli { opacity: .7; }

/* unos narudžbe */
.zaglavlje { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.zaglavlje .datum { font-size: 20px; font-weight: 800; }
.trazi { position: sticky; top: 56px; z-index: 8; background: var(--bg); padding: 8px 0; }
.grupe { display: flex; gap: 6px; overflow-x: auto; padding: 4px 0 8px; }
.grupe button { background: #fff; color: var(--tx); border: 1.5px solid var(--rub); padding: 6px 12px; min-height: 34px; font-size: 13px; font-weight: 600; white-space: nowrap; border-radius: 999px; }
.grupe button.akt { background: var(--pl); color: #fff; border-color: var(--pl); }
.art { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-bottom: 1px solid var(--rub); background: #fff; }
.art:first-child { border-radius: var(--r) var(--r) 0 0; }
.art:last-child { border-bottom: 0; border-radius: 0 0 var(--r) var(--r); }
.art.ima { background: var(--zel-t); }
.art .n { flex: 1; min-width: 0; }
.art .n b { display: block; font-weight: 600; font-size: 15px; }
.art .n small { color: var(--mut); font-size: 12px; }
.art .k { display: flex; align-items: center; gap: 4px; flex: 0 0 auto; }
.art .k input { width: 78px; text-align: center; padding: 6px; min-height: 40px; font-weight: 700; font-size: 17px; }
.art .k button { width: 40px; min-height: 40px; padding: 0; font-size: 20px; background: var(--pl-t); color: var(--pl); border-radius: 10px; }
.art .k .jm { width: 30px; font-size: 12px; color: var(--mut); text-align: left; }
.art .brzi { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 4px; }
.art .brzi button { background: #fff; color: var(--pl); border: 1.5px solid var(--pl-t); padding: 2px 9px; min-height: 26px; font-size: 13px; border-radius: 999px; }
.art .brzi button.akt { background: var(--pl); color: #fff; border-color: var(--pl); }
.art .brzi button[data-nap] { color: var(--mut); border-color: var(--rub); }
header.vrh a button { padding: 8px 12px; min-height: 36px; }
.lista { background: #fff; border-radius: var(--r); box-shadow: var(--sjena); margin-bottom: 14px; }
.lista .grupa-naslov { padding: 8px 10px; font-weight: 700; color: var(--pl); background: var(--pl-t); font-size: 13px; position: sticky; top: 112px; z-index: 7; }
.dno { position: sticky; bottom: 0; background: #fff; border-top: 1px solid var(--rub); padding: 10px 16px; display: flex; gap: 10px; align-items: center; margin: 0 -16px -16px; box-shadow: 0 -4px 14px rgba(20,30,50,.06); z-index: 8; }
.dno .suma { flex: 1; font-size: 14px; }
.dno .suma b { font-size: 16px; }

/* tablice */
table { width: 100%; border-collapse: collapse; font-size: 14px; background: #fff; }
th, td { padding: 7px 8px; border-bottom: 1px solid var(--rub); text-align: left; vertical-align: top; }
th { background: var(--pl-t); color: var(--pl); font-size: 12px; text-transform: uppercase; letter-spacing: .02em; position: sticky; top: 0; }
td.br, th.br { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
tr.grupa td { background: #f7f9fc; font-weight: 700; color: var(--pl); font-size: 12px; }
tr.uk td { font-weight: 700; border-top: 2px solid var(--pl); }
.tab-omot { overflow-x: auto; border-radius: var(--r); box-shadow: var(--sjena); }
.posl-kart { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; }
.posl-kart .pk { background: #fff; border-radius: var(--r); box-shadow: var(--sjena); padding: 12px 14px; border-top: 5px solid var(--pl); cursor: pointer; }
.posl-kart .pk .ime { font-weight: 700; font-size: 15px; }
.posl-kart .pk .info { font-size: 13px; color: var(--mut); margin-top: 4px; }
.posl-kart .pk.na_ovjeri { background: var(--nar-t); }
.posl-kart .pk.ovjerena { background: var(--zel-t); }
.posl-kart .pk.prazna { opacity: .75; }

/* modal */
.modal-poz { position: fixed; inset: 0; background: rgba(10,20,40,.45); z-index: 50; display: grid; place-items: end center; }
@media (min-width: 700px) { .modal-poz { place-items: center; } }
.modal { background: #fff; width: 100%; max-width: 640px; max-height: 92vh; overflow: auto; border-radius: 16px 16px 0 0; padding: 18px 18px 22px; box-shadow: var(--sjena); }
@media (min-width: 700px) { .modal { border-radius: 16px; } }
.modal h2 { display: flex; justify-content: space-between; align-items: center; }
.modal h2 button { background: var(--siva-t); color: var(--tx); min-height: 34px; padding: 4px 12px; }
.gumbi { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.gumbi button { flex: 1; }
.pregled-red { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px dashed var(--rub); gap: 10px; }
.pregled-red b { white-space: nowrap; }
.kal { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.kal .kd { background: #fff; border-radius: 10px; padding: 8px 10px; box-shadow: var(--sjena); cursor: pointer; border-left: 5px solid var(--siva); font-size: 13px; }
.kal .kd b { display: block; font-size: 15px; }
.kal .kd.akt { outline: 2px solid var(--pl); }
.kal .kd.ima { border-left-color: var(--pl); }
.kal .kd.ceka { border-left-color: var(--nar); background: var(--nar-t); }
.kal .kd.gotovo { border-left-color: var(--zel); }
.kal .kd.zak { border-left-color: #333; }
.tocke { display: flex; gap: 4px; margin-top: 4px; flex-wrap: wrap; }
.tocke span { width: 10px; height: 10px; border-radius: 50%; display: inline-block; background: var(--siva); }
.tocke span.otvorena { background: var(--pl); } .tocke span.na_ovjeri { background: var(--nar); } .tocke span.ovjerena { background: var(--zel); } .tocke span.zakljucana { background: #333; }
.pill { display: inline-flex; align-items: center; gap: 6px; background: #fff; border: 1.5px solid var(--rub); border-radius: 999px; padding: 4px 10px; font-size: 13px; cursor: pointer; user-select: none; }
.pill input { width: auto; min-height: 0; margin: 0; }
.boja { width: 14px; height: 14px; border-radius: 4px; display: inline-block; vertical-align: middle; margin-right: 6px; }
.mala { font-size: 13px; }
.desno { text-align: right; }
@media (max-width: 600px) { main { padding: 12px; } .dno { margin: 0 -12px -12px; } th, td { padding: 6px 5px; font-size: 13px; } }
@media print { header.vrh, nav.tab, .dno, button { display: none !important; } body { background: #fff; } .kart { box-shadow: none; } }
