:root {
  --bg: #f4f5f7;
  --card: #ffffff;
  --text: #1c1f24;
  --muted: #6b7280;
  --line: #e3e6ea;
  --brand: #8b1e2d;
  --brand-dark: #6d1522;
  --ok: #1f7a3a;
  --ok-bg: #e6f4ea;
  --warn: #9a6400;
  --warn-bg: #fff4d6;
  --err: #b42318;
  --err-bg: #fdecea;
  --info-bg: #e8eef8;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(0,0,0,.06), 0 1px 6px rgba(0,0,0,.04);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 17px; line-height: 1.45;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- navigacija ---------- */
.topbar {
  background: var(--brand); color: #fff; position: sticky; top: 0; z-index: 20;
  box-shadow: 0 2px 8px rgba(0,0,0,.18);
}
.topbar .inner {
  display: flex; align-items: center; gap: 14px; padding: 0 16px; height: 58px;
  max-width: 1200px; margin: 0 auto;
}
.topbar .logo { font-weight: 700; font-size: 20px; letter-spacing: .3px; white-space: nowrap; color: #fff; }
.topbar .logo small { font-weight: 400; opacity: .8; font-size: 13px; margin-left: 6px; }
.topbar nav { display: flex; gap: 4px; overflow-x: auto; flex: 1; scrollbar-width: none; }
.topbar nav::-webkit-scrollbar { display: none; }
.topbar nav a {
  color: #fff; padding: 8px 12px; border-radius: 8px; white-space: nowrap; font-size: 16px; opacity: .88;
}
.topbar nav a.active, .topbar nav a:hover { background: rgba(255,255,255,.16); opacity: 1; text-decoration: none; }
.topbar .user { font-size: 14px; opacity: .9; white-space: nowrap; }
.topbar .user a { color: #fff; margin-left: 8px; text-decoration: underline; }

.testbar {
  background: var(--warn-bg); color: var(--warn); text-align: center; padding: 6px 12px; font-size: 14px;
  border-bottom: 1px solid #f1dfa6;
}

main { max-width: 1200px; margin: 0 auto; padding: 18px 16px 60px; }
main.narrow { max-width: 760px; }

/* ---------- poruke ---------- */
.flash { padding: 12px 16px; border-radius: var(--radius); margin: 0 0 14px; font-weight: 500; }
.flash.ok { background: var(--ok-bg); color: var(--ok); }
.flash.error { background: var(--err-bg); color: var(--err); }

/* ---------- kartice ---------- */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; margin-bottom: 16px; }
.card h2, .card h3 { margin: 0 0 12px; }
h1 { font-size: 26px; margin: 4px 0 16px; }
h2 { font-size: 20px; }
h3 { font-size: 17px; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.row.between { justify-content: space-between; }
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }

/* ---------- dugmad ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--brand); color: #fff; border: 0; border-radius: 10px; padding: 12px 18px;
  font-size: 17px; font-weight: 600; cursor: pointer; text-decoration: none; min-height: 46px; line-height: 1.2;
}
.btn:hover { background: var(--brand-dark); text-decoration: none; color: #fff; }
.btn.secondary { background: #fff; color: var(--text); border: 1px solid var(--line); }
.btn.secondary:hover { background: #f3f4f6; }
.btn.ok { background: var(--ok); }
.btn.danger { background: var(--err); }
.btn.small { padding: 7px 12px; font-size: 15px; min-height: 36px; }
.btn.big { padding: 18px 22px; font-size: 20px; min-height: 60px; width: 100%; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .5; cursor: default; }

/* ---------- forme ---------- */
label { display: block; font-weight: 600; margin: 12px 0 6px; font-size: 15px; }
label .hint { font-weight: 400; color: var(--muted); }
input[type=text], input[type=number], input[type=email], input[type=password], input[type=date], input[type=search],
select, textarea {
  width: 100%; padding: 12px 14px; font-size: 17px; border: 1px solid #cfd4da; border-radius: 10px; background: #fff;
  color: var(--text); font-family: inherit;
}
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(139,30,45,.35); border-color: var(--brand); }
textarea { min-height: 90px; resize: vertical; }
input[type=file] { width: 100%; padding: 12px; border: 1px dashed #cfd4da; border-radius: 10px; background: #fff; font-size: 15px; }
.check { display: flex; align-items: center; gap: 10px; font-weight: 500; margin: 12px 0; font-size: 17px; }
.check input { width: 24px; height: 24px; }
.form-actions { display: flex; gap: 10px; margin-top: 18px; flex-wrap: wrap; }
.field-row { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }

/* ---------- pretraga i lista artikala (tablet) ---------- */
.search-box { position: relative; }
.search-box input { padding: 16px 18px; font-size: 21px; border-radius: 14px; }
.item-list { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); margin-top: 14px; }
.item-tile {
  display: block; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px;
  color: var(--text); box-shadow: var(--shadow); min-height: 74px;
}
.item-tile:hover { border-color: var(--brand); text-decoration: none; }
.item-tile .name { font-weight: 700; font-size: 18px; }
.item-tile .meta { color: var(--muted); font-size: 14px; margin-top: 3px; }

/* ---------- količina ---------- */
.qty-wrap { display: flex; align-items: stretch; gap: 10px; }
.qty-wrap input { text-align: center; font-size: 30px; font-weight: 700; padding: 10px; }
.qty-wrap button { width: 64px; font-size: 30px; border-radius: 12px; border: 1px solid var(--line); background: #fff; cursor: pointer; }
.qty-quick { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.qty-quick button { padding: 10px 16px; font-size: 17px; border-radius: 999px; border: 1px solid var(--line); background: #fff; cursor: pointer; }
.qty-quick button:hover { border-color: var(--brand); color: var(--brand); }

/* ---------- tabele ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 15.5px; }
th, td { text-align: left; padding: 10px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 13px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); font-weight: 600; }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; white-space: nowrap; }
tr.row-link { cursor: pointer; }
tr.row-link:hover td { background: #faf6f6; }

/* ---------- bedževi ---------- */
.badge {
  display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 13px; font-weight: 600; white-space: nowrap;
  background: #eef0f3; color: #374151;
}
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.err { background: var(--err-bg); color: var(--err); }
.badge.info { background: var(--info-bg); color: #1e40af; }
.badge.urgent { background: var(--err); color: #fff; }

/* ---------- filteri ---------- */
.tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.tabs a {
  padding: 9px 14px; border-radius: 999px; background: #fff; border: 1px solid var(--line); color: var(--text); font-weight: 500;
}
.tabs a.active { background: var(--brand); color: #fff; border-color: var(--brand); }
.tabs a:hover { text-decoration: none; border-color: var(--brand); }
.tabs .count { margin-left: 6px; background: rgba(0,0,0,.08); border-radius: 999px; padding: 1px 8px; font-size: 13px; }
.tabs a.active .count { background: rgba(255,255,255,.25); }

/* ---------- razno ---------- */
.stat { text-align: center; padding: 14px; }
.stat .n { font-size: 34px; font-weight: 700; }
.stat .l { color: var(--muted); font-size: 14px; }
.notice { padding: 12px 14px; border-radius: 10px; margin: 10px 0; font-size: 15px; }
.notice.warn { background: var(--warn-bg); color: var(--warn); }
.notice.info { background: var(--info-bg); color: #1e3a8a; }
.notice.err { background: var(--err-bg); color: var(--err); }
.photos { display: flex; gap: 8px; flex-wrap: wrap; }
.photos img { height: 90px; border-radius: 8px; border: 1px solid var(--line); }
.list-plain { list-style: none; margin: 0; padding: 0; }
.list-plain li { padding: 10px 0; border-bottom: 1px solid var(--line); }
.list-plain li:last-child { border-bottom: 0; }
.login-box { max-width: 380px; margin: 60px auto; }
.login-box h1 { text-align: center; }
.kbd-pin input { font-size: 24px; letter-spacing: 3px; text-align: center; }
details summary { cursor: pointer; font-weight: 600; }
@media (max-width: 600px) {
  body { font-size: 16px; }
  .topbar .inner { padding: 0 10px; gap: 8px; }
  .topbar .user span.name { display: none; }
  main { padding: 12px 10px 50px; }
  .card { padding: 14px; }
}
