/* =====================================================================
   eOtpremnice — osnovni stilovi (mobile-first).
   Sistemski font stack (bez teških web fontova = brže učitavanje).
   ===================================================================== */
:root {
  --brand: #0d3b66;
  --brand-2: #1d6fb8;
  --bg: #f4f6f9;
  --card: #ffffff;
  --text: #1a2230;
  --muted: #667085;
  --border: #e2e6ee;
  --ok: #1b7f4b;
  --ok-bg: #e6f4ec;
  --err: #b42318;
  --err-bg: #fdecea;
  --warn: #8a5a00;
  --warn-bg: #fff4d6;
  --radius: 12px;
  --tap: 48px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen,
               Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
  /* Mobilna zaštita: nikad horizontalni scroll cele strane */
  max-width: 100%;
  overflow-x: hidden;
}

/* Globalna zaštita od širokog sadržaja (dugi PIB/UUID/email/naziv) */
img, table, pre, input, select, textarea, video, canvas, object { max-width: 100%; }
/* Dugačke neprelomive niske (email, broj dokumenta, link) smeju da se prelome */
.dl dd, .doc-broj, .doc-partner, .notif-text, .breadcrumb, .review-box, td, .val-box {
  overflow-wrap: anywhere;
  word-break: break-word;
}

a { color: var(--brand-2); text-decoration: none; }
a:hover { text-decoration: underline; }
.muted { color: var(--muted); font-size: .9rem; }

/* ---------- Topbar ---------- */
.topbar {
  background: var(--brand);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  height: 56px;
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar-brand { color: #fff; font-weight: 700; font-size: 1.15rem; }
.topbar-brand:hover { text-decoration: none; }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.topbar-firma { font-size: .85rem; opacity: .95; max-width: 40vw; overflow: hidden;
                text-overflow: ellipsis; white-space: nowrap; }
.lic { font-size: .75rem; padding: 3px 8px; border-radius: 999px; }
.lic-ok { background: rgba(255,255,255,.18); }
.logout-form { margin: 0; }
.btn-link { background: none; border: 1px solid rgba(255,255,255,.4); color: #fff;
            padding: 6px 12px; border-radius: 8px; cursor: pointer; font-size: .85rem; }
.btn-link:hover { background: rgba(255,255,255,.12); }
.topbar-link { color: #fff; font-size: .9rem; padding: 6px 10px; border-radius: 8px; background: rgba(255,255,255,.12); }
.topbar-link:hover { background: rgba(255,255,255,.22); text-decoration: none; }

/* ---------- Admin: chips / filter / tabela / detalj ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.chip { background: #fff; border: 1px solid var(--border); border-radius: 999px; padding: 5px 12px; font-size: .82rem; }

.filter-bar { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.filter-bar .input { min-height: 42px; flex: 0 1 auto; width: auto; }
.filter-bar input[name="q"] { flex: 1 1 220px; }

.table-wrap { overflow-x: auto; background: #fff; border: 1px solid var(--border); border-radius: var(--radius); }
.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th, .table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table th { background: #f8fafc; font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.table tr:last-child td { border-bottom: none; }
.small { font-size: .8rem; }

.badge { font-size: .72rem; padding: 3px 9px; border-radius: 999px; font-weight: 600; }
.badge-demo { background: var(--warn-bg); color: var(--warn); }
.badge-active { background: var(--ok-bg); color: var(--ok); }
.badge-suspended { background: var(--err-bg); color: var(--err); }
.badge-expired { background: #eee; color: #555; }

.btn-sm { font-size: .82rem; padding: 5px 10px; border: 1px solid var(--border); border-radius: 8px; color: var(--brand-2); }
.btn-sm:hover { background: #f0f6fc; text-decoration: none; }
.btn-ghost { background: #fff; border: 1px solid var(--border); color: var(--text); }
.btn-ghost:hover { background: #f4f6f9; text-decoration: none; }
.btn-danger-ghost { background: #fff; border: 1px solid #f3c2bd; color: var(--err); }
.btn-danger-ghost:hover { background: var(--err-bg); }
.btn-danger { background: var(--err); color: #fff; border: none; }
.btn-danger:hover { background: #97271d; text-decoration: none; }
.pager { display: flex; align-items: center; gap: 14px; margin-top: 16px; justify-content: center; }

.breadcrumb { margin: 0 0 8px; font-size: .9rem; }
.detail-grid { display: grid; grid-template-columns: 1fr; gap: 16px; }
.detail-card { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.card-title { font-size: 1rem; margin: 0 0 12px; }
.dl { display: grid; grid-template-columns: minmax(0,130px) minmax(0,1fr); gap: 6px 12px; margin: 0; font-size: .9rem; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; min-width: 0; }
.hint { font-size: .85rem; color: var(--muted); margin: 0 0 12px; }
.form-inline { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; }
.form-inline .input { width: auto; min-height: 42px; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.ok-dot { color: var(--ok); font-size: .8rem; font-weight: 600; }
.off-dot { color: var(--muted); font-size: .8rem; font-weight: 600; }

@media (min-width: 720px) {
  .detail-grid { grid-template-columns: 1fr 1fr; }
}

/* ---------- Subnav ---------- */
.subnav {
  background: #fff; border-bottom: 1px solid var(--border);
  display: flex; gap: 2px; overflow-x: auto; padding: 0 8px;
  position: sticky; top: 56px; z-index: 9; -webkit-overflow-scrolling: touch;
}
.subnav a {
  padding: 12px 14px; color: var(--muted); font-size: .9rem; font-weight: 600;
  white-space: nowrap; border-bottom: 3px solid transparent;
}
.subnav a:hover { color: var(--brand-2); text-decoration: none; }
.subnav a.active { color: var(--brand); border-bottom-color: var(--brand-2); }

/* ---------- Page head (naslov + akcija) ---------- */
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 8px 0 16px; flex-wrap: wrap; }
.page-head .page-title { margin: 0; }
.section-title { font-size: 1.05rem; margin: 26px 0 12px; color: var(--muted); }

/* ---------- Prazno stanje ---------- */
.empty {
  background: #fff; border: 1px dashed var(--border); border-radius: var(--radius);
  padding: 32px 20px; text-align: center;
}
.empty p { margin: 0 0 12px; }

/* ---------- Akcije u redu tabele ---------- */
.row-actions { display: flex; gap: 8px; align-items: center; white-space: nowrap; }
.row-actions form { margin: 0; }
.btn-sm-danger { color: var(--err); border-color: #f3c2bd; background: #fff; cursor: pointer; }
.btn-sm-danger:hover { background: var(--err-bg); }

/* ---------- Forma u kartici ---------- */
.card-form {
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px; max-width: 560px;
}
.form-actions { display: flex; gap: 10px; margin-top: 8px; }
.field-label small { font-weight: 400; color: var(--muted); }

/* ---------- Soft tile (šifarnici) ---------- */
.tile-soft { background: #f8fafc; }

/* ---------- Sync kontrole + bar ---------- */
.sync-controls { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.sync-days { font-size: .85rem; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.sync-days .input { width: auto; min-height: 40px; }
.sync-bar { display: flex; align-items: center; gap: 12px; margin: 4px 0 16px; }
.sync-bar-track { flex: 1; height: 8px; background: #e8edf3; border-radius: 999px; overflow: hidden; }
.sync-bar-fill { width: 0; height: 100%; background: linear-gradient(90deg,#1d6fb8,#0d3b66); transition: width .3s ease; }
.sync-bar-text { font-size: .82rem; color: var(--muted); white-space: nowrap; }

/* ---------- Tabovi ---------- */
.tabs { display: flex; gap: 4px; overflow-x: auto; border-bottom: 2px solid var(--border); margin-bottom: 14px; -webkit-overflow-scrolling: touch; }
.tab {
  background: none; border: none; padding: 12px 14px; cursor: pointer;
  font-size: .9rem; font-weight: 600; color: var(--muted); white-space: nowrap;
  border-bottom: 3px solid transparent; margin-bottom: -2px; display: flex; align-items: center; gap: 8px;
}
.tab:hover { color: var(--brand-2); }
.tab.active { color: var(--brand); border-bottom-color: var(--brand-2); }
.tab-count { background: #e8edf3; color: var(--muted); border-radius: 999px; padding: 1px 8px; font-size: .75rem; font-weight: 700; }
.tab.active .tab-count { background: var(--brand-2); color: #fff; }

/* ---------- Lista dokumenata ---------- */
.doc-list { display: flex; flex-direction: column; }
.doc-row {
  display: grid; grid-template-columns: 1fr 1.4fr auto auto; gap: 12px; align-items: center;
  padding: 12px 14px; border: 1px solid var(--border); border-top: none; color: var(--text); font-size: .9rem;
}
.doc-row:first-child { border-top: 1px solid var(--border); border-radius: 10px 10px 0 0; }
.doc-row:last-child { border-radius: 0 0 10px 10px; }
.doc-row:hover:not(.doc-head) { background: #f6f9fc; text-decoration: none; }
.doc-head { background: #f8fafc; font-size: .76rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 700; }
.doc-broj { font-weight: 700; }
.doc-partner { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-datum { color: var(--muted); white-space: nowrap; }
.doc-status { font-size: .74rem; padding: 3px 9px; border-radius: 999px; font-weight: 600; white-space: nowrap; text-align: center; }
.st-draft { background: #eef0f3; color: #555; }
.st-sent { background: #eaf2fb; color: var(--brand); }
.st-recv { background: #fff4d6; color: var(--warn); }
.st-conf { background: #e4f0ff; color: #1d6fb8; }
.st-done { background: var(--ok-bg); color: var(--ok); }
.st-cancel { background: var(--err-bg); color: var(--err); }
.st-other { background: #eee; color: #555; }
.doc-loading, .doc-empty { padding: 28px; text-align: center; color: var(--muted); background: #fff; border: 1px dashed var(--border); border-radius: var(--radius); }

@media (max-width: 560px) {
  .doc-row { grid-template-columns: 1fr auto; row-gap: 4px; }
  .doc-partner { grid-column: 1 / -1; order: 3; }
  .doc-head { display: none; }
}

/* ---------- Wizard ---------- */
.wiz-steps { display: flex; gap: 4px; overflow-x: auto; margin-bottom: 18px; -webkit-overflow-scrolling: touch; }
.wiz-step { display: flex; align-items: center; gap: 6px; padding: 8px 12px; font-size: .82rem; color: var(--muted); white-space: nowrap; border-bottom: 3px solid var(--border); flex: 1; justify-content: center; }
.wiz-step span { display: inline-flex; width: 22px; height: 22px; align-items: center; justify-content: center; border-radius: 50%; background: var(--border); color: #fff; font-size: .75rem; font-weight: 700; }
.wiz-step.active { color: var(--brand); border-bottom-color: var(--brand-2); font-weight: 600; }
.wiz-step.active span { background: var(--brand-2); }
.wiz-step.done span { background: var(--ok); }
.wiz-panel { display: none; background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; margin-bottom: 16px; }
.wiz-panel.active { display: block; }
.wiz-nav { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 30px; }
.wiz-nav .btn { min-width: 120px; }
.sub-title { font-size: .95rem; margin: 16px 0 10px; color: var(--brand); }

.radio-cards { display: flex; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.radio-card { flex: 1; min-width: 140px; border: 2px solid var(--border); border-radius: 10px; padding: 14px; cursor: pointer; display: flex; flex-direction: column; gap: 3px; position: relative; }
.radio-card input { position: absolute; opacity: 0; }
.radio-card:has(input:checked) { border-color: var(--brand-2); background: #eef5fc; }
.rc-title { font-weight: 700; }
.rc-desc { font-size: .82rem; color: var(--muted); }

.review-box { background: #f8fafc; border: 1px solid var(--border); border-radius: 10px; padding: 14px; margin-bottom: 14px; }
.wiz-final-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }

/* Tabela artikala na PREGLEDU (korak 5) — tekst se prelama, šifra vidljiva */
.review-table { width: 100%; border-collapse: collapse; font-size: .88rem; table-layout: fixed; }
.review-table th, .review-table td {
  padding: 8px 10px; text-align: left; border-bottom: 1px solid var(--border);
  vertical-align: top; overflow-wrap: anywhere; word-break: break-word;
}
.review-table th { background: #f8fafc; font-size: .74rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); }
.review-table tr:last-child td { border-bottom: none; }
.review-table .rv-rb    { width: 32px; color: var(--muted); }
.review-table .rv-sifra { width: 28%; color: var(--muted); }
.review-table .rv-kol   { width: 22%; white-space: nowrap; text-align: right; }
.review-table .rv-naziv { font-weight: 600; }
.val-box { padding: 12px 14px; border-radius: 10px; margin-top: 12px; font-size: .9rem; }
.val-loading { background: #eef2f7; color: var(--muted); }
.val-ok { background: var(--ok-bg); color: var(--ok); }
.val-err { background: var(--err-bg); color: var(--err); }
.val-box ul { margin: 8px 0 0; padding-left: 20px; }

/* ---------- Artikli (kartice) ---------- */
.item-card { border: 1px solid var(--border); border-radius: 10px; padding: 14px; margin-bottom: 12px; background: #fcfdfe; }
.item-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.item-no { font-weight: 700; color: var(--brand); font-size: .9rem; }
.item-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.item-grid .field { margin: 0; }
.akciza-fields { margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--border); }
.akciza-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; }
.akc-tag { display: inline-block; font-size: .7rem; background: #fff4d6; color: #8a5a00; padding: 1px 7px; border-radius: 999px; margin-left: 6px; }

/* ---------- Lifecycle akcije (detalj dokumenta) ---------- */
.action-btns { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 10px; }
.action-btns .btn { flex: 1 1 auto; min-width: 160px; }
#action-result:empty { display: none; }

/* ---------- Fajlovi (PDF/XML) ---------- */
.file-btns { display: flex; flex-wrap: wrap; gap: 10px; }
.file-btns .btn { flex: 0 1 auto; }
.pdf-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.pdf-frame { width: 100%; height: 75vh; min-height: 480px; border: 1px solid var(--border); border-radius: 8px; background: #f4f6f9; }

/* ---------- Modal (confirm/alert zamena) ---------- */
.modal-overlay {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(13,33,59,.55);
  display: flex; align-items: center; justify-content: center;
  padding: 20px; opacity: 0; transition: opacity .15s ease;
  -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px);
}
/* hidden atribut MORA da pobedi display:flex iznad (inače overlay blokira klikove) */
.modal-overlay[hidden] { display: none; }
/* dok nije .open (i tokom fade-out), ne hvataj klikove */
.modal-overlay:not(.open) { pointer-events: none; }
.modal-overlay.open { opacity: 1; pointer-events: auto; }
.modal-dialog {
  background: #fff; border-radius: 16px; width: 100%; max-width: 420px;
  padding: 22px 22px 18px; box-shadow: 0 20px 60px rgba(13,59,102,.35);
  transform: translateY(8px) scale(.98); transition: transform .15s ease;
}
.modal-overlay.open .modal-dialog { transform: translateY(0) scale(1); }
.modal-title { margin: 0 0 10px; font-size: 1.15rem; color: var(--brand); }
.modal-body { font-size: .95rem; color: var(--text); line-height: 1.5; }
.modal-body p { margin: 0 0 6px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }
.modal-actions .btn { min-width: 110px; }
@media (max-width: 480px) {
  .modal-actions { flex-direction: column-reverse; }
  .modal-actions .btn { width: 100%; }
}

/* ---------- QR skeniranje računa ---------- */
.qr-box { background: #f8fafc; border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; margin-bottom: 16px; }
/* licenca baner + obaveštenja */
.lic-bar { text-align: center; padding: 9px 14px; font-size: .88rem; font-weight: 600; }
.lic-bar-warn { background: var(--warn-bg); color: var(--warn); border-bottom: 1px solid #f0e0b0; }
.lic-bar-expired { background: var(--err-bg); color: var(--err); border-bottom: 1px solid #f3c2bd; }
.topbar-bell { position: relative; }
.bell-badge { position: absolute; top: -4px; right: -4px; background: var(--err); color: #fff; font-size: .65rem; font-weight: 700; min-width: 16px; height: 16px; line-height: 16px; border-radius: 999px; padding: 0 4px; text-align: center; }
.notif-list { display: flex; flex-direction: column; gap: 10px; }
.notif-item { display: flex; gap: 12px; background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; }
.notif-item.unread { border-left: 4px solid var(--brand-2); background: #f6faff; }
.notif-icon { font-size: 1.4rem; flex: 0 0 auto; }
.notif-title { font-weight: 700; }
.notif-text { font-size: .9rem; color: var(--muted); margin: 2px 0; }
.qr-actions { display: flex; flex-wrap: wrap; gap: 10px; }
#qr-reader { max-width: 360px; margin: 12px auto; border-radius: 10px; overflow: hidden; }
.qr-manual { margin-top: 12px; display: flex; flex-direction: column; gap: 10px; max-width: 480px; }
#qr-status:empty { display: none; }
#qr-status { margin-top: 10px; }

/* ---------- Forma prijemnice (količine) ---------- */
.receipt-form { margin-top: 6px; }
.receipt-form .table td { vertical-align: middle; }
.ta-c { text-align: center; }
.rej-warn { color: var(--err); font-weight: 700; }
#rcpt-broj { max-width: 220px; }

/* ---------- Autocomplete (firme) ---------- */
.ac-box {
  position: absolute; left: 0; right: 0; top: 100%; z-index: 40;
  background: #fff; border: 1px solid var(--border); border-radius: 0 0 10px 10px;
  box-shadow: 0 8px 24px rgba(13,59,102,.14); max-height: 320px; overflow-y: auto;
  max-width: 100%; box-sizing: border-box;
}
.ac-item { padding: 10px 12px; cursor: pointer; display: flex; flex-direction: column; gap: 2px; border-bottom: 1px solid #f0f3f7; min-width: 0; }
.ac-item:last-child { border-bottom: none; }
.ac-item.active, .ac-item:hover { background: #eef5fc; }
/* dugi nazivi firmi se prelamaju umesto da šire dropdown/stranu */
.ac-name { font-weight: 600; font-size: .9rem; overflow-wrap: anywhere; word-break: break-word; }
.ac-meta { font-size: .78rem; color: var(--muted); overflow-wrap: anywhere; }
.ac-badge { align-self: flex-start; font-size: .68rem; padding: 1px 7px; border-radius: 999px; margin-top: 2px; }
.ac-saved { background: var(--ok-bg); color: var(--ok); }
.ac-unreg { background: var(--warn-bg); color: var(--warn); }


/* ---------- Demo traka ---------- */
.demo-bar {
  background: var(--warn-bg);
  color: var(--warn);
  text-align: center;
  padding: 8px 12px;
  font-size: .85rem;
  font-weight: 600;
  border-bottom: 1px solid #f0e0b0;
}

/* ---------- Container ---------- */
.container { max-width: 880px; margin: 0 auto; padding: 16px; }
.page-title { font-size: 1.4rem; margin: 8px 0 16px; }
.welcome { margin: 0 0 20px; color: var(--muted); }

/* ---------- Flash ---------- */
.flash { padding: 12px 14px; border-radius: 10px; margin-bottom: 14px; font-size: .92rem; }
.flash-success { background: var(--ok-bg); color: var(--ok); }
.flash-error { background: var(--err-bg); color: var(--err); }
.flash-info { background: #eaf2fb; color: var(--brand); }

/* ---------- Auth ekran ---------- */
.auth-body { display: flex; min-height: 100vh; align-items: center; justify-content: center; padding: 20px; }
.auth-card { background: var(--card); width: 100%; max-width: 420px; border-radius: var(--radius);
             box-shadow: 0 6px 24px rgba(13,59,102,.08); padding: 28px 24px; }
.auth-logo { text-align: center; margin-bottom: 20px; }
.auth-logo .brand { font-size: 1.5rem; font-weight: 800; color: var(--brand); }
.auth-logo .brand-sub { display: block; font-size: .8rem; color: var(--muted); letter-spacing: .12em;
                        text-transform: uppercase; }
.auth-title { font-size: 1.25rem; margin: 0 0 18px; text-align: center; }
.auth-foot { text-align: center; margin-top: 18px; font-size: .9rem; color: var(--muted); }

/* ---------- Forme ---------- */
.form { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field-label { font-size: .85rem; color: var(--muted); font-weight: 600; }
.field-row { display: flex; gap: 12px; }
.field-row .field { flex: 1; }
.input {
  width: 100%;
  min-height: var(--tap);
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 1rem;
  background: #fff;
  color: var(--text);
}
.input:focus { outline: none; border-color: var(--brand-2); box-shadow: 0 0 0 3px rgba(29,111,184,.15); }

/* ---------- Dugmad ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: var(--tap);
  padding: 12px 18px;
  border: none; border-radius: 10px;
  font-size: 1rem; font-weight: 600;
  cursor: pointer; text-decoration: none;
}
.btn-primary { background: var(--brand-2); color: #fff; }
.btn-primary:hover { background: var(--brand); text-decoration: none; }
.btn-block { width: 100%; }

/* ---------- Dashboard pločice ---------- */
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.tile {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 16px;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  text-align: center; color: var(--text);
  min-height: 120px; justify-content: center;
}
.tile:hover { text-decoration: none; border-color: var(--brand-2); box-shadow: 0 4px 14px rgba(13,59,102,.08); }
.tile-icon { font-size: 2rem; line-height: 1; color: var(--brand-2); }
.tile-label { font-weight: 600; }
.tile-primary { background: var(--brand-2); color: #fff; border-color: var(--brand-2); }
.tile-primary .tile-icon { color: #fff; }

.info-box { margin-top: 20px; background: #eaf2fb; border: 1px solid #d4e4f7;
            border-radius: 10px; padding: 14px; font-size: .92rem; color: var(--brand); }

@media (min-width: 600px) {
  .tiles { grid-template-columns: repeat(4, 1fr); }
}

/* ---------- PWA install baner ---------- */
.pwa-banner {
  position: fixed; left: 12px; right: 12px; bottom: 12px; z-index: 50;
  display: flex; align-items: center; gap: 12px;
  background: #fff; border: 1px solid var(--border); border-radius: 14px;
  padding: 12px 14px; box-shadow: 0 8px 28px rgba(13,59,102,.18);
  max-width: 520px; margin: 0 auto;
}
.pwa-banner-icon { border-radius: 9px; flex: 0 0 auto; }
.pwa-banner-text { display: flex; flex-direction: column; line-height: 1.3; flex: 1; min-width: 0; }
.pwa-banner-text strong { font-size: .95rem; }
.pwa-banner-text span { font-size: .8rem; color: var(--muted); }
.pwa-banner-btn { min-height: 40px; padding: 8px 16px; flex: 0 0 auto; }
.pwa-banner-close {
  position: absolute; top: 6px; right: 10px;
  background: none; border: none; font-size: 1.3rem; line-height: 1;
  color: var(--muted); cursor: pointer; padding: 2px 6px;
}
.pwa-ios { padding-right: 36px; }
/* hidden atribut MORA da pobedi display:flex (inače × ne sklanja baner) */
.pwa-banner[hidden] { display: none !important; }
@media (display-mode: standalone) { .pwa-banner { display: none !important; } }

/* =====================================================================
   MOBILNA OPTIMIZACIJA — sprečava horizontalni overflow na telefonu
   ===================================================================== */
@media (max-width: 560px) {
  .container { padding: 12px; }

  /* Redovi sa više polja -> jedno ispod drugog na uskom ekranu */
  .field-row { flex-wrap: wrap; gap: 10px; }
  .field-row .field { flex: 1 1 100%; }

  /* Dugmad u akcijama ne smeju da forsiraju širinu */
  .action-btns .btn { min-width: 0; flex: 1 1 100%; }
  .wiz-final-actions .btn { flex: 1 1 100%; }
  .file-btns .btn { flex: 1 1 100%; }

  /* Filter bar (admin) -> puna širina */
  .filter-bar .input, .filter-bar .btn { flex: 1 1 100%; width: 100%; }

  /* Naslovi i dugme „dodaj" u zaglavlju strane -> uspravno */
  .page-head { flex-direction: column; align-items: stretch; }
  .page-head .btn { width: 100%; }

  /* Sync kontrole na strani dokumenata */
  .sync-controls { width: 100%; }
  .sync-controls .btn, .sync-days { flex: 1 1 100%; }

  /* Firma u headeru ne sme da gura layout */
  .topbar-firma { max-width: 30vw; }

  /* Naslovi da se prelome umesto da šire stranu */
  .page-title, .card-title, .auth-title { overflow-wrap: anywhere; }

  /* Wizard koraci i tabovi — skrol unutar njih, ne cele strane (već imaju overflow-x:auto) */
  .wiz-steps .wiz-step { font-size: .75rem; padding: 6px 8px; }

  /* Kartice forme ne smeju biti šire od ekrana */
  .card-form, .detail-card, .auth-card { max-width: 100%; }
}
