:root {
  --navy: #14213D;
  --accent: #E8590C;
  --bg: #F3F5F8;
  --card: #ffffff;
  --line: #D5DAE3;
  --muted: #566074;
  --danger: #B42318;
  --radius: 10px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--navy);
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 16px; line-height: 1.45;
}
a { color: #0B5ED7; }
h1 { font-size: 22px; margin: 4px 0 14px; }
h2 { font-size: 16px; margin: 0 0 10px; }
.muted { color: var(--muted); font-size: 14px; }
.wrap { max-width: 720px; margin: 0 auto; padding: 14px 16px 96px; }

.top {
  position: sticky; top: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between;
  gap: 10px; padding: 10px 16px; background: var(--navy); color: #fff;
}
.top .brand { color: #fff; font-weight: 800; font-size: 20px; text-decoration: none; letter-spacing: -0.3px; }
.top nav { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; justify-content: flex-end; }
.top nav a { color: #fff; text-decoration: none; font-size: 14px; font-weight: 600; }
.top nav a.btn { color: #fff; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 10px 16px;
  border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--navy);
  font: inherit; font-weight: 600; text-decoration: none; cursor: pointer;
}
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-sm { min-height: 36px; padding: 6px 12px; font-size: 14px; }
.btn:active { transform: translateY(1px); }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin: 0 0 14px; }
.card.narrow { max-width: 420px; margin: 40px auto; }
.card.empty { text-align: center; }
.logo { font-size: 30px; font-weight: 800; letter-spacing: -0.5px; }

.flash { background: #E7F0FF; border: 1px solid #B6D0FF; color: #123A7A; padding: 10px 12px; border-radius: 8px; margin: 0 0 14px; }
.flash.err { background: #FDECEA; border-color: #F5B5AE; color: #7A1A12; }

label { display: block; font-size: 14px; font-weight: 600; color: var(--muted); margin: 0 0 12px; }
input[type=text], input[type=tel], input[type=email], input[type=number], input[type=password], input[type=date],
input[type=search], select, textarea {
  display: block; width: 100%; min-height: 44px; margin-top: 4px; padding: 10px 12px; font: inherit; color: var(--navy);
  background: #fff; border: 1px solid #B8C0CE; border-radius: 8px;
}
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus, .btn:focus-visible, a:focus-visible { outline: 3px solid #8FB7FF; outline-offset: 1px; }
.group-label { font-size: 14px; font-weight: 600; color: var(--muted); margin: 4px 0 6px; }
.checks { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 12px; }
.check { display: inline-flex; align-items: center; gap: 8px; margin: 0; padding: 8px 12px; min-height: 44px; border: 1px solid #B8C0CE; border-radius: 8px; background: #fff; color: var(--navy); font-weight: 500; }
.check input { width: 20px; height: 20px; margin: 0; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.actions { display: flex; gap: 10px; margin: 0 0 14px; flex-wrap: wrap; }
.actions.sticky {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 9; margin: 0; padding: 10px 16px;
  background: #fff; border-top: 1px solid var(--line); justify-content: flex-end;
}
.inline-form { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.inline-form label { flex: 1; min-width: 160px; margin: 0; }
.inline-form input[type=text] { margin-top: 0; }

.search { display: flex; gap: 8px; margin: 0 0 12px; align-items: flex-end; }
.search input { margin-top: 0; }
.search label { flex: 1; margin: 0; }
.card.search { padding: 14px; }

.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 8px; margin-bottom: 8px; }
.chip { flex: none; padding: 8px 12px; border: 1px solid var(--line); border-radius: 999px; background: #fff; color: var(--navy); text-decoration: none; font-size: 14px; font-weight: 600; white-space: nowrap; }
.chip.on { background: var(--navy); border-color: var(--navy); color: #fff; }

.list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.item { display: block; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; color: inherit; text-decoration: none; }
.item:active { background: #EEF1F6; }
.item-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.num { font-size: 18px; letter-spacing: -0.2px; }
.item-main { font-weight: 600; margin-top: 2px; }
.item-sub { color: var(--muted); font-size: 14px; }
.dot { opacity: .6; }
.list.compact .item { padding: 10px 12px; }

.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 13px; font-weight: 700; background: #E5E8EE; color: #2B3550; white-space: nowrap; }
.st-dijagnostika { background: #DCEBFF; color: #0B3D91; }
.st-ceka_dijelove { background: #FFF0CC; color: #7A4B00; }
.st-u_popravku { background: #FFE1D0; color: #8A3300; }
.st-gotovo { background: #D8F3DC; color: #14532D; }
.st-preuzeto { background: #E5E8EE; color: #2B3550; }
.st-odustao { background: #FDE1DE; color: #7A1A12; }

.head-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 10px; }
.big-num { font-size: 30px; font-weight: 800; letter-spacing: -0.5px; line-height: 1.1; }
.kv { display: grid; grid-template-columns: 110px 1fr; gap: 6px 10px; margin: 0; }
.kv dt { color: var(--muted); font-size: 14px; }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.pre { white-space: pre-wrap; overflow-wrap: anywhere; }

.upload { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.upload label.btn { margin: 0; color: #fff; font-size: 16px; }
.photos { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.photo { margin: 0; }
.photo img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); background: #E5E8EE; }
.photo input.cap { min-height: 38px; margin-top: 6px; font-size: 14px; padding: 6px 8px; }
.photo input.cap.saved { border-color: #2F9E44; }
.link-danger { background: none; border: 0; padding: 8px 0; color: var(--danger); font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; }

.timeline { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 10px; }
.timeline li { border-left: 3px solid var(--line); padding: 2px 0 2px 12px; }
.timeline li.tl-rad { border-left-color: var(--accent); }
.tl-date { font-size: 13px; color: var(--muted); }

.danger-zone summary { cursor: pointer; font-weight: 700; color: var(--danger); }
.danger-zone .inline-form { margin-top: 8px; }

.scanner { position: relative; border-radius: 10px; overflow: hidden; background: #000; margin-bottom: 10px; }
.scanner video { display: block; width: 100%; max-height: 60vh; object-fit: cover; }
.scan-frame { position: absolute; inset: 18% 18%; border: 3px solid rgba(255, 255, 255, .85); border-radius: 12px; box-shadow: 0 0 0 999px rgba(0, 0, 0, .25); }

@media (max-width: 480px) {
  .row2 { grid-template-columns: 1fr; }
  .kv { grid-template-columns: 96px 1fr; }
}

/* --- Obavijesti, potpis, cekanje preuzimanja --- */
.banner { display: block; padding: 10px 12px; border-radius: 8px; margin: 0 0 14px; border: 1px solid; font-size: 15px; }
.banner.warn { background: #FFF4D6; border-color: #F0CF75; color: #5C3D00; }
.banner.ok { background: #E3F6E8; border-color: #A5D9B3; color: #14532D; }
.banner.info { background: #E7F0FF; border-color: #B6D0FF; color: #123A7A; }
.banner.muted-banner { background: #EEF1F6; border-color: var(--line); color: var(--muted); }
.banner a { color: inherit; font-weight: 700; }
a.banner-link { text-decoration: none; color: #5C3D00; }
.foot-links { margin-top: 18px; }

#sigBox { margin-top: 12px; }
#sigCanvas { display: block; width: 100%; height: 200px; background: #fff; border: 1.5px dashed #8C95A6; border-radius: 8px; touch-action: none; cursor: crosshair; }
.sig-img { display: block; max-width: 100%; max-height: 140px; border: 1px solid var(--line); border-radius: 8px; background: #fff; padding: 6px; }

.timeline li.tl-poruka { border-left-color: #2F9E44; }
.wait .item-link { display: block; color: inherit; text-decoration: none; }
.item.wait { padding: 12px 14px; }
.wait-actions { margin: 10px 0 0; }
.lvl-30 { border-left: 4px solid #E8590C; }
.lvl-60, .lvl-rok { border-left: 4px solid var(--danger); }
.lvl-14 { border-left: 4px solid #E0A800; }
.lvl-badge-14 { background: #FFF0CC; color: #7A4B00; }
.lvl-badge-30 { background: #FFE1D0; color: #8A3300; }
.lvl-badge-60, .lvl-badge-rok { background: #FDE1DE; color: #7A1A12; }
.lvl-badge-ok { background: #D8F3DC; color: #14532D; }
code { background: #EEF1F6; padding: 1px 6px; border-radius: 4px; font-size: 14px; }

/* --- Statistika, cjenik, dijelovi --- */
.stat-tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 0 0 14px; }
.tile { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.tile-n { font-size: 22px; font-weight: 800; letter-spacing: -0.3px; }
.stat-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.stat-table th, .stat-table td { text-align: right; padding: 6px 4px; border-bottom: 1px solid var(--line); vertical-align: top; }
.stat-table th:first-child, .stat-table td:first-child { text-align: left; }
.stat-table thead th { color: var(--muted); font-weight: 600; font-size: 13px; }
.stat-table tfoot th { border-bottom: 0; }
.bar { height: 8px; background: #E5E8EE; border-radius: 99px; overflow: hidden; margin-top: 4px; min-width: 40px; }
.bar > span { display: block; height: 100%; background: var(--accent); border-radius: 99px; }
.bar-row { display: grid; grid-template-columns: minmax(80px, 1.2fr) 2fr auto; gap: 10px; align-items: center; margin: 0 0 8px; font-size: 14px; }
.bar-row .bar { margin: 0; }
details.card summary { cursor: pointer; }
.pin-box { font-size: 26px; font-weight: 800; letter-spacing: 4px; }
.profit { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; margin: 12px 0 0; }
.profit .tot { font-weight: 800; border-top: 1px solid var(--line); padding-top: 4px; }
[hidden] { display: none !important; }
