/* Popis robe — samostalna stranica, bez global.css (treba da radi i offline,
   pa vuče što manje). Boje su iste kao na sajtu: --accent-1 #00bfff / #0073aa
   i zelena #94C94A. Tema dolazi iz ../js/theme.js (data-theme na <html>). */

:root {
  --bg: #eef1f6; --surface: #ffffff; --surface-2: #f3f6fa; --line: #dfe4ec;
  --fg: #141a26; --fg-2: #5b6576; --fg-3: #8a93a3;
  --blue: #0073aa; --on-blue: #ffffff; --blue-soft: rgba(0,115,170,.10);
  --green: #4f8a12; --green-soft: rgba(148,201,74,.20);
  --red: #c9372c; --red-soft: rgba(201,55,44,.12);
  --f-ui: 'Poppins', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --f-mono: ui-monospace, 'Cascadia Mono', Consolas, 'Roboto Mono', monospace;
}
[data-theme="dark"] {
  --bg: #0b0e14; --surface: #141a26; --surface-2: #1b2231; --line: #263044;
  --fg: #f0f2f5; --fg-2: #9aa4b5; --fg-3: #6b7585;
  --blue: #00bfff; --on-blue: #08111c; --blue-soft: rgba(0,191,255,.12);
  --green: #94c94a; --green-soft: rgba(148,201,74,.14);
  --red: #ff7b6e; --red-soft: rgba(255,123,110,.12);
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--fg); font-family: var(--f-ui); font-size: 15px;
  -webkit-text-size-adjust: 100%;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }

/* ── Traka sa logom ── */
.bar {
  display: flex; align-items: center; gap: 12px;
  padding: calc(10px + env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) 10px max(16px, env(safe-area-inset-left, 0px));
  background: var(--surface); border-bottom: 1px solid var(--line);
}
.logo img { height: 26px; width: auto; display: block; }
[data-theme="dark"] .logo-light, [data-theme="light"] .logo-dark { display: none; }
.bar-title { font-weight: 600; color: var(--fg-2); border-left: 1px solid var(--line); padding-left: 12px; }
.saved { margin-left: auto; font-size: 12px; color: var(--green); display: flex; align-items: center; gap: 6px; }
.saved::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.saved.err { color: var(--red); }

/* ── Ekrani: na telefonu cijela širina, na računaru kolona u sredini ── */
#app { max-width: 600px; margin: 0 auto; background: var(--surface); min-height: calc(100dvh - 47px); }
@media (min-width: 640px) {
  body { padding-bottom: 32px; }
  #app { margin-top: 24px; border-radius: 20px; border: 1px solid var(--line); min-height: 0; overflow: hidden; }
}
.screen { display: flex; flex-direction: column; min-height: inherit; }
.pad { padding: 20px max(18px, env(safe-area-inset-left, 0px)) 28px; }
.top { padding: 14px 18px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 12px; background: var(--surface); }
.top .back { width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); display: grid; place-items: center; flex: none; }
.top .t { min-width: 0; flex: 1; }
.top .t b { display: block; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top .t span { font-size: 12.5px; color: var(--fg-2); }
.sticky2 { position: sticky; top: 0; z-index: 3; background: var(--surface); box-shadow: 0 1px 0 var(--line); }
.foot {
  position: sticky; bottom: 0; margin-top: auto; z-index: 3;
  padding: 12px 18px calc(14px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--line); background: var(--surface);
}

/* ── Dugmad i polja ── */
.btn { border: 0; border-radius: 14px; padding: 14px 18px; font-weight: 600; font-size: 15px; display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; text-decoration: none; }
.btn.primary { background: var(--blue); color: var(--on-blue); }
.btn.ghost { background: var(--surface-2); color: var(--fg); border: 1px solid var(--line); }
.btn.danger { background: var(--red-soft); color: var(--red); }
.btn.small { padding: 10px 16px; font-size: 14px; border-radius: 11px; width: auto; display: inline-flex; }
.btn.big { margin-top: 22px; padding: 16px; font-size: 16px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.linkbtn { border: 0; background: none; color: var(--blue); font-weight: 500; font-size: 14px; padding: 6px 2px; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.filebtn, .filelink { position: relative; overflow: hidden; cursor: pointer; }
.filebtn input, .filelink input { position: absolute; inset: 0; opacity: 0; cursor: pointer; font-size: 0; }
.inp { width: 100%; border: 1px solid var(--line); background: var(--surface-2); border-radius: 12px; padding: 12px 14px; font-size: 16px; }
.lbl, .field label { font-size: 12.5px; font-weight: 600; color: var(--fg-2); letter-spacing: .02em; }
.field { display: grid; gap: 6px; margin-top: 18px; }
.h4 { font-size: 13.5px; font-weight: 600; margin: 24px 0 10px; }

/* ── Početak ── */
.resume { display: flex; gap: 14px; align-items: center; justify-content: space-between; flex-wrap: wrap; padding: 14px 16px; border-radius: 16px; background: var(--blue-soft); border: 1px solid var(--line); margin-bottom: 8px; }
.resume > div { display: grid; gap: 2px; min-width: 0; }
.resume b { font-size: 16px; }
.resume span:last-child { font-size: 13px; color: var(--fg-2); }
.resume .btn { width: auto; }
.inapp { display: grid; gap: 6px; padding: 14px 16px; border-radius: 16px; background: var(--red-soft); border: 1px solid var(--red); margin-bottom: 12px; }
.inapp b { font-size: 15px; }
.inapp span { font-size: 13px; color: var(--fg-2); line-height: 1.45; }
.inapp .inapp-btns { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
.hero h1 { font-size: 25px; line-height: 1.2; margin: 14px 0 8px; text-wrap: balance; }
.hero p { margin: 0; color: var(--fg-2); line-height: 1.55; }
.types { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.type { border: 1.5px solid var(--line); background: var(--surface); border-radius: 14px; padding: 12px; text-align: left; display: grid; gap: 2px; }
.type b { font-size: 14.5px; }
.type span { font-size: 12px; color: var(--fg-2); line-height: 1.35; }
.type[aria-pressed="true"] { border-color: var(--blue); background: var(--blue-soft); }
.import { margin-top: 18px; border: 1.5px dashed var(--line); border-radius: 14px; padding: 14px; display: flex; gap: 12px; align-items: center; background: none; width: 100%; text-align: left; }
.import .ic { width: 40px; height: 40px; border-radius: 10px; background: var(--green-soft); color: var(--green); display: grid; place-items: center; flex: none; }
.import b { display: block; font-size: 14px; }
.import span span { font-size: 12.5px; color: var(--fg-2); }
.import.done { border-style: solid; border-color: var(--green); }
.priv { font-size: 12.5px; color: var(--fg-3); text-align: center; margin: 10px 0 0; }
.restore { text-align: center; margin-top: 18px; }

/* ── Uvoz ── */
.drop { border: 1.5px dashed var(--line); border-radius: 16px; padding: 28px 16px; text-align: center; display: grid; gap: 10px; justify-items: center; background: var(--surface-2); }
.drop.over { border-color: var(--blue); background: var(--blue-soft); }
.drop .ic { width: 48px; height: 48px; border-radius: 12px; background: var(--green-soft); color: var(--green); display: grid; place-items: center; }
.drop b { font-size: 16px; }
.drop > span { font-size: 13px; color: var(--fg-2); }
.tips { margin: 18px 0 0; padding: 0; list-style: none; display: grid; gap: 10px; }
.tips li { display: flex; gap: 10px; font-size: 13.5px; color: var(--fg-2); line-height: 1.45; }
.tips li::before { content: ""; flex: none; width: 6px; height: 6px; border-radius: 50%; background: var(--green); margin-top: 8px; }
.filecard { display: flex; align-items: center; gap: 12px; border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; }
.filecard .ic, .exp .ic { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; flex: none; font: 700 11px var(--f-mono); }
.filecard .ic, .ic.xl { background: #1d6f42; color: #fff; }
.ic.pdf { background: #c9372c; color: #fff; }
.ic.bk { background: var(--blue-soft); color: var(--blue); }
.filecard .fn { flex: 1; min-width: 0; }
.filecard .fn b { display: block; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.filecard .fn span { font-size: 12.5px; color: var(--fg-2); }
.maps { display: grid; gap: 12px; }
.maprow { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 4px 10px; align-items: center; }
.maprow label { font-size: 13.5px; font-weight: 600; }
.maprow label i { font-style: normal; color: var(--blue); }
.maprow select { width: 100%; min-width: 0; border: 1px solid var(--line); background: var(--surface-2); border-radius: 10px; padding: 9px 10px; font-size: 14px; }
.maprow select.auto { border-color: var(--green); }
.maprow small { grid-column: 2; font-size: 12px; color: var(--fg-3); font-family: var(--f-mono); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.warns { display: grid; gap: 6px; margin-top: 14px; }
.warn { font-size: 13px; line-height: 1.45; padding: 9px 12px; border-radius: 10px; background: var(--surface-2); color: var(--fg-2); display: flex; gap: 8px; }
.warn b { color: var(--fg); }
.warn::before { flex: none; font-weight: 700; }
.warn.ok { background: var(--green-soft); }
.warn.ok::before { content: "✓"; color: var(--green); }
.warn.info::before { content: "i"; color: var(--blue); font-family: var(--f-mono); }
.warn.err { background: var(--red-soft); color: var(--fg); }
.warn.err::before { content: "!"; color: var(--red); }
.tblwrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; }
.imptable { width: 100%; border-collapse: collapse; font-size: 12.5px; font-variant-numeric: tabular-nums; }
.imptable th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--fg-3); padding: 8px 10px; background: var(--surface-2); font-weight: 600; }
.imptable td { padding: 8px 10px; border-top: 1px solid var(--line); white-space: nowrap; }
.imptable td.m { font-family: var(--f-mono); font-size: 12px; color: var(--fg-2); }
.imptable .more { color: var(--fg-3); text-align: center; }

/* ── Popis ── */
.locs { display: flex; gap: 8px; padding: 12px 18px 0; overflow-x: auto; scrollbar-width: none; }
.locs::-webkit-scrollbar { display: none; }
.loc { flex: none; border: 1px solid var(--line); background: var(--surface); border-radius: 99px; padding: 7px 14px; font-size: 13.5px; font-weight: 500; display: flex; gap: 6px; align-items: center; }
.loc em { font-style: normal; font-size: 11.5px; color: var(--fg-3); font-family: var(--f-mono); }
.loc[aria-pressed="true"] { background: var(--fg); color: var(--surface); border-color: var(--fg); }
.loc[aria-pressed="true"] em { color: inherit; opacity: .7; }
.loc.add { color: var(--fg-2); border-style: dashed; }
.entry { display: flex; gap: 10px; padding: 12px 18px; }
.entry .inp { flex: 1; min-width: 0; }
.kbdbtn { flex: none; width: 54px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface-2); color: var(--fg); font: 600 13px var(--f-mono); letter-spacing: .02em; }
.scanbtn { flex: none; width: 54px; border-radius: 12px; border: 0; background: var(--blue); color: var(--on-blue); display: grid; place-items: center; }
.sugg { margin: -4px 18px 12px; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--surface); max-height: 50vh; overflow-y: auto; box-shadow: 0 12px 24px -12px rgba(0,0,0,.3); }
.sugg button { display: flex; align-items: center; gap: 10px; width: 100%; border: 0; background: none; padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--line); font-size: 14.5px; }
.sugg button:last-of-type { border-bottom: 0; }
.sugg button:first-child { background: var(--surface-2); }
.sugg .sn { flex: 1; min-width: 0; }
.sugg .sn b { display: block; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sugg .sn b mark { background: none; color: var(--blue); font-weight: 600; }
.sugg small { color: var(--fg-3); font-family: var(--f-mono); font-size: 11.5px; }
.sugg .new { color: var(--blue); font-weight: 500; }
.sugg .note { font-size: 12px; color: var(--fg-3); padding: 8px 14px; background: var(--surface-2); border-bottom: 1px solid var(--line); }
.src { flex: none; font-size: 11px; font-weight: 600; padding: 3px 8px; border-radius: 99px; white-space: nowrap; }
.src.s-spisak { background: var(--green-soft); color: var(--green); }
.src.s-popisano { background: var(--surface-2); color: var(--fg-2); border: 1px solid var(--line); }
.listhead { display: flex; justify-content: space-between; padding: 12px 18px 8px; font-size: 12.5px; color: var(--fg-3); font-weight: 500; }
.item { display: flex; align-items: center; gap: 12px; padding: 12px 18px; border: 0; border-top: 1px solid var(--line); width: 100%; background: none; text-align: left; }
.item .nm { flex: 1; min-width: 0; }
.item .nm b { display: block; font-weight: 500; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item .nm small { font-family: var(--f-mono); font-size: 11.5px; color: var(--fg-3); }
.item .q { font-family: var(--f-mono); font-size: 17px; font-weight: 500; font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.item .q span { font-family: var(--f-ui); font-size: 11.5px; color: var(--fg-2); margin-left: 3px; }
.item.flash { animation: flash 1.2s ease; }
@keyframes flash { 0% { background: var(--green-soft); } 100% { background: transparent; } }
.empty { padding: 40px 30px; text-align: center; color: var(--fg-2); line-height: 1.6; }

/* ── Prozor za količinu ── */
#layer { position: relative; z-index: 30; }
.overlay { position: fixed; inset: 0; background: rgba(8,12,20,.55); display: flex; align-items: flex-end; justify-content: center; z-index: 30; }
.sheet {
  background: var(--surface); width: 100%; max-width: 600px; min-width: 0; border-radius: 22px 22px 0 0;
  padding: 10px 20px calc(20px + env(safe-area-inset-bottom, 0px));
  display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; animation: up .2s ease;
}
@keyframes up { from { transform: translateY(30px); opacity: .4; } }
.grab { width: 40px; height: 4px; border-radius: 4px; background: var(--line); margin: 0 auto; }
.sheet h3 { margin: 0; font-size: 18px; }
.sheet .meta { font-family: var(--f-mono); font-size: 12.5px; color: var(--fg-3); }
.already { font-size: 13px; background: var(--blue-soft); color: var(--blue); padding: 8px 12px; border-radius: 10px; }
.qty { display: flex; align-items: center; gap: 10px; }
.qty button { width: 58px; height: 58px; border-radius: 16px; border: 1px solid var(--line); background: var(--surface-2); font-size: 26px; flex: none; }
.qty input { flex: 1; min-width: 0; width: 0; text-align: center; font-family: var(--f-mono); font-size: 32px; font-weight: 500; border: 0; background: none; padding: 4px; }
.units { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; }
.units button { border: 1px solid var(--line); background: var(--surface); border-radius: 99px; padding: 6px 16px; font-size: 13px; }
.units button[aria-pressed="true"] { background: var(--fg); color: var(--surface); border-color: var(--fg); }
.row2 { display: grid; grid-template-columns: 1fr 2fr; gap: 10px; }
/* Dok je virtuelna tastatura otvorena, prozor stoji iznad nje (v. prilagodiTastaturi
   u popis.js), a dugmad se sklanjaju: dodaje se tasterom ✓/Enter na tastaturi. */
.kbdhint { display: none; font-size: 12.5px; color: var(--fg-3); text-align: center; }
.overlay.kbd .row2 { display: none; }
.overlay.kbd .kbdhint { display: block; }
.overlay.kbd .sheet { border-radius: 22px; padding-bottom: 14px; }

/* ── Kamera ── */
#cam { position: fixed; inset: 0; z-index: 20; background: #06080c; color: #fff; display: flex; flex-direction: column; }
.camtop { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: calc(14px + env(safe-area-inset-top, 0px)) 16px 12px; font-size: 14px; }
.camtools { display: flex; gap: 8px; }
.camtop button { background: rgba(255,255,255,.14); border: 0; color: #fff; border-radius: 10px; padding: 9px 14px; font-size: 14px; }
.camtop button[aria-pressed="true"] { background: #f5c542; color: #1a1400; }
/* Biblioteka sama dimenzioniše video i zatamnjeni okvir prema širini #reader,
   pa video namjerno ne razvlačimo — okvir bi se razišao sa slikom. */
#reader { flex: 1; min-height: 0; overflow: hidden; display: flex; flex-direction: column; justify-content: center; }
#reader video { max-width: 100%; display: block; }
.camhint { text-align: center; padding: 14px 16px calc(20px + env(safe-area-inset-bottom, 0px)); font-size: 14px; opacity: .9; }
.camhint.err { color: #ffb4ab; opacity: 1; }

/* ── Kraj ── */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stat { background: var(--surface-2); border-radius: 14px; padding: 12px; }
.stat b { display: block; font-family: var(--f-mono); font-size: 22px; font-weight: 500; }
.stat span { font-size: 12px; color: var(--fg-2); }
.kom, .exports { display: grid; gap: 8px; }
.exp { display: flex; align-items: center; gap: 12px; border: 1px solid var(--line); background: var(--surface); border-radius: 14px; padding: 12px 14px; text-align: left; width: 100%; }
.exp b { display: block; font-size: 14.5px; }
.exp span span { font-size: 12.5px; color: var(--fg-2); }

/* ── Poruke ── */
#toasts { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(90px + env(safe-area-inset-bottom, 0px)); width: min(560px, calc(100% - 32px)); z-index: 40; display: grid; gap: 8px; pointer-events: none; }
.toast { background: var(--fg); color: var(--surface); border-radius: 12px; padding: 12px 14px; font-size: 14px; line-height: 1.45; display: flex; gap: 12px; align-items: center; pointer-events: auto; animation: up .2s ease; }
.toast span { flex: 1; }
.toast button { border: 0; background: none; color: inherit; font-weight: 700; text-decoration: underline; padding: 4px; }

@media (prefers-reduced-motion: reduce) { * { animation: none !important; } }
#staro { margin-bottom: 10px; }
.predato { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 12px; padding: 10px 18px; background: var(--blue-soft); font-size: 13px; line-height: 1.45; border-bottom: 1px solid var(--line); }
.predato .linkbtn { font-size: 13px; padding: 2px 0; }
.bar-link { font-size: 13px; color: var(--fg-2); text-decoration: none; border: 1px solid var(--line); border-radius: 99px; padding: 4px 10px; }
.bar-link:hover { color: var(--blue); border-color: var(--blue); }
