:root{
  --navy:#102694; --navy-2:#1c3bc4; --yellow:#FFEA3D;
  --blue:#0070C0; --cyan:#00B0F0; --green:#00B050; --red:#FF4141;
  --bg:#F2F5FB; --border:#E2E8F4; --ink:#1b2340; --muted:#5a6485;
}
*{box-sizing:border-box}
html,body{margin:0;padding:0}
body{
  font-family:Poppins,system-ui,-apple-system,Segoe UI,sans-serif;
  background:var(--bg); color:var(--ink);
  -webkit-text-size-adjust:100%;
  padding-bottom:88px;
}
button,input{font-family:inherit}

/* ---------- header ---------- */
.hdr{
  background:linear-gradient(135deg,var(--navy) 0%,var(--navy-2) 100%);
  color:#fff; padding:16px 16px 18px;
  position:sticky; top:0; z-index:20;
  box-shadow:0 4px 18px rgba(16,38,148,.22);
}
.hdr-row{display:flex; align-items:center; gap:12px; max-width:760px; margin:0 auto}
.logo{
  background:var(--yellow); color:var(--navy); font-weight:800; font-size:15px;
  padding:6px 11px; border-radius:9px; letter-spacing:.5px; flex:none;
}
.hdr h1{font-size:17px; font-weight:600; margin:0; line-height:1.2}
.hdr .sub{font-size:12px; opacity:.78; margin-top:2px}
.hdr .count{
  margin-left:auto; background:rgba(255,255,255,.14); border:1px solid rgba(255,255,255,.2);
  padding:7px 12px; border-radius:999px; font-size:12px; font-weight:600; white-space:nowrap;
}

/* ---------- layout ---------- */
.wrap{max-width:760px; margin:0 auto; padding:16px}
.card{
  background:#fff; border:1px solid var(--border); border-radius:14px;
  padding:18px; margin-bottom:14px; box-shadow:0 2px 10px rgba(16,38,148,.05);
}
.card h2{font-size:15px; color:var(--blue); font-weight:700; margin:0 0 12px}
.hidden{display:none !important}

/* ---------- buttons ---------- */
.btn{
  border:none; border-radius:11px; font-weight:600; font-size:15px;
  padding:14px 18px; cursor:pointer; display:inline-flex; align-items:center;
  justify-content:center; gap:9px; transition:filter .15s, transform .06s;
}
.btn:active{transform:scale(.985)}
.btn:disabled{opacity:.5; cursor:default}
.btn-navy{background:var(--navy); color:#fff}
.btn-yellow{background:var(--yellow); color:var(--navy)}
.btn-green{background:var(--green); color:#fff}
.btn-danger{background:var(--red); color:#fff}
.btn-outline{background:#fff; color:var(--navy); border:1.5px solid var(--border)}
.btn-ghost{background:transparent; color:var(--muted); padding:10px 12px; font-size:14px}
.btn-full{width:100%}
.btn-lg{padding:18px; font-size:17px}

/* ---------- scan entry ---------- */
.scan-hero{display:flex; flex-direction:column; gap:10px}
.manual{display:flex; gap:8px}
.manual input{
  flex:1; min-width:0; border:1.5px solid var(--border); border-radius:11px;
  padding:14px; font-size:16px; outline:none; background:#fff;
}
.manual input:focus{border-color:var(--navy)}

/* ---------- camera ---------- */
.cam-wrap{position:fixed; inset:0; background:#000; z-index:100; display:flex; flex-direction:column}
.cam-wrap video{flex:1; width:100%; height:100%; object-fit:cover}
.cam-frame{
  position:absolute; left:8%; right:8%; top:50%; transform:translateY(-50%);
  height:180px; border:3px solid var(--yellow); border-radius:16px;
  box-shadow:0 0 0 100vmax rgba(0,0,0,.45); pointer-events:none;
}
.cam-line{position:absolute; left:6px; right:6px; top:50%; height:3px; background:var(--red); opacity:.9; border-radius:2px}
.cam-bar{
  position:absolute; left:0; right:0; bottom:0; padding:18px 16px calc(18px + env(safe-area-inset-bottom));
  display:flex; gap:10px; align-items:center; background:linear-gradient(transparent,rgba(0,0,0,.75));
}
.cam-bar .hint{color:#fff; font-size:13px; flex:1; opacity:.9}
.cam-top{position:absolute; top:0; left:0; right:0; padding:calc(14px + env(safe-area-inset-top)) 16px 14px;
  background:linear-gradient(rgba(0,0,0,.65),transparent); color:#fff; font-size:14px; font-weight:600}

/* ---------- result ---------- */
.res-head{
  background:linear-gradient(135deg,var(--navy),var(--navy-2)); color:#fff;
  margin:-18px -18px 14px; padding:18px; border-radius:14px 14px 0 0;
}
.res-head .code{font-size:12px; opacity:.75; letter-spacing:1px; font-family:ui-monospace,monospace}
.res-head .name{font-size:19px; font-weight:700; line-height:1.3; margin-top:5px}
.rows{display:flex; flex-direction:column}
.row{display:flex; gap:12px; padding:10px 2px; border-bottom:1px solid #F0F3FA; font-size:14px}
.row:last-child{border-bottom:none}
.row .k{color:var(--muted); flex:0 0 42%; font-size:13px}
.row .v{font-weight:600; flex:1; word-break:break-word}
.row.big .v{font-size:17px; color:var(--navy)}
.miss{text-align:center; padding:26px 10px}
.miss .ico{font-size:40px}
.miss h3{color:var(--red); margin:10px 0 6px; font-size:17px}
.miss p{color:var(--muted); font-size:14px; margin:0}
.miss .code{font-family:ui-monospace,monospace; font-weight:700; color:var(--ink); font-size:16px; margin-top:8px}

/* ---------- tags / status ---------- */
.tag{display:inline-block; padding:4px 10px; border-radius:999px; font-size:11px; font-weight:600}
.tag-green{background:#E7F8ED; color:#0b6b32}
.tag-blue{background:#EAF1FF; color:var(--navy)}
.note{font-size:13px; color:var(--muted); line-height:1.55}

/* ---------- history ---------- */
.hist{display:flex; flex-direction:column; gap:7px}
.hist-item{
  display:flex; align-items:center; gap:10px; padding:10px 12px;
  background:#F8FAFE; border:1px solid var(--border); border-radius:10px;
  font-size:13px; cursor:pointer;
}
.hist-item .nm{flex:1; font-weight:600; overflow:hidden; text-overflow:ellipsis; white-space:nowrap}
.hist-item .cd{font-family:ui-monospace,monospace; color:var(--muted); font-size:11px}
.dot{width:8px; height:8px; border-radius:50%; flex:none}
.dot.ok{background:var(--green)} .dot.no{background:var(--red)}

/* ---------- import ---------- */
.drop{
  border:2px dashed #C9D4EE; border-radius:12px; padding:26px 16px; text-align:center;
  background:#FAFCFF; cursor:pointer;
}
.drop:hover{border-color:var(--navy)}
.drop .ico{font-size:32px}
.drop .t{font-weight:600; margin-top:8px}
.drop .s{font-size:12px; color:var(--muted); margin-top:4px}
.bar{height:9px; background:#E9EEF9; border-radius:99px; overflow:hidden; margin-top:12px}
.bar i{display:block; height:100%; background:linear-gradient(90deg,var(--navy),var(--cyan)); width:0; transition:width .2s}
select{
  width:100%; padding:11px 12px; border:1.5px solid var(--border); border-radius:10px;
  font-size:14px; background:#fff; margin-top:6px;
}
label.fld{font-size:12px; color:var(--muted); font-weight:600; display:block; margin-top:12px}
.chk{display:flex; flex-wrap:wrap; gap:8px; margin-top:6px}
.chk label{
  display:inline-flex; align-items:center; gap:7px; font-size:13px; font-weight:600;
  background:#F8FAFE; border:1.5px solid var(--border); border-radius:9px; padding:9px 12px; cursor:pointer;
}
.chk label:has(input:checked){border-color:var(--navy); background:#EAF1FF; color:var(--navy)}
.chk input{width:17px; height:17px; accent-color:var(--navy)}

/* barkod čipovi u rezultatu */
.bk{
  display:inline-block; font-family:ui-monospace,monospace; font-size:13px;
  background:#F2F5FB; border:1px solid var(--border); border-radius:7px;
  padding:3px 8px; margin:2px 4px 2px 0;
}

.prev{overflow-x:auto; margin-top:12px; border:1px solid var(--border); border-radius:10px}
table{border-collapse:collapse; width:100%; font-size:12px; white-space:nowrap}
th{background:#F4F7FD; color:var(--navy); text-align:left; padding:8px 10px; font-weight:600}
td{padding:7px 10px; border-top:1px solid #F0F3FA; color:var(--muted)}

/* ---------- search results ---------- */
.sres{margin-top:10px; display:flex; flex-direction:column; gap:6px}

/* ---------- bottom nav ---------- */
.nav{
  position:fixed; left:0; right:0; bottom:0; background:#fff; border-top:1px solid var(--border);
  display:flex; z-index:30; padding-bottom:env(safe-area-inset-bottom);
  box-shadow:0 -3px 16px rgba(16,38,148,.07);
}
.nav button{
  flex:1; border:none; background:transparent; padding:11px 4px 13px; cursor:pointer;
  color:var(--muted); font-size:11px; font-weight:600; display:flex; flex-direction:column;
  align-items:center; gap:3px;
}
.nav button .i{font-size:20px; line-height:1}
.nav button.on{color:var(--navy)}
.nav button.on .i{filter:drop-shadow(0 2px 6px rgba(16,38,148,.35))}

/* ---------- toast ---------- */
.toast{
  position:fixed; left:16px; right:16px; bottom:96px; z-index:200;
  background:var(--navy); color:#fff; padding:13px 16px; border-radius:11px;
  font-size:14px; text-align:center; box-shadow:0 8px 24px rgba(0,0,0,.25);
}
.toast.err{background:var(--red)}
.toast.ok{background:var(--green)}

@media(min-width:720px){
  .nav{max-width:760px; margin:0 auto; border:1px solid var(--border); border-bottom:none; border-radius:14px 14px 0 0}
}
