/* v2.2 modern */
:root {
  --red: #b0121b;
  --red-dark: #8a0d14;
  --red-soft: #fdeeee;
  --ink: #17171c;
  --muted: #6d6d78;
  --bg: #f5f5f8;
  --card: #ffffff;
  --line: #ececf1;
  --line-strong: #d9d9e1;
  --ok: #17803a;
  --warn: #946200;
  --bad: #b3261e;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(20, 20, 35, .04), 0 6px 20px rgba(20, 20, 35, .05);
  --ring: 0 0 0 3px rgba(176, 18, 27, .18);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
.wrap { max-width: 940px; margin: 0 auto; padding: 0 18px; }
main.wrap { padding-top: 22px; padding-bottom: 48px; }
a { color: var(--red); text-underline-offset: 2px; }
h1 { font-size: 1.65rem; line-height: 1.2; letter-spacing: -.015em; font-weight: 750; margin: .2rem 0 1rem; }
h2 { font-size: 1.1rem; font-weight: 700; letter-spacing: -.005em; margin: 0 0 .75rem; }
h3 { font-size: 1rem; font-weight: 700; margin: 18px 0 6px; }
.muted { color: var(--muted); font-size: .92rem; }

/* zaglavlje */
.top { background: linear-gradient(135deg, var(--red) 0%, var(--red-dark) 100%); color: #fff; position: sticky; top: 0; z-index: 10; box-shadow: 0 2px 14px rgba(120, 10, 16, .25); }
.top-in { display: flex; align-items: center; justify-content: space-between; padding-top: 12px; padding-bottom: 8px; }
.brand { color: #fff; text-decoration: none; font-weight: 700; font-size: 1.05rem; letter-spacing: -.005em; display: inline-flex; align-items: center; gap: 10px; }
.brand-mark { white-space: nowrap; flex-shrink: 0; background: #fff; color: var(--red); border-radius: 9px; padding: 2px 7px; margin-right: 0; font-size: .9rem; box-shadow: 0 1px 3px rgba(0, 0, 0, .18); }
.logout { margin: 0; }
button.link { background: rgba(255, 255, 255, .14); border: 0; color: #fff; text-decoration: none; font: inherit; font-size: .9rem; cursor: pointer; padding: 6px 12px; border-radius: 999px; transition: background .15s; }
button.link:hover { background: rgba(255, 255, 255, .26); }
.nav { display: flex; gap: 4px; overflow-x: auto; padding-bottom: 10px; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav a { color: #fff; text-decoration: none; padding: 6px 13px; border-radius: 999px; white-space: nowrap; font-size: .93rem; opacity: .88; transition: background .15s, opacity .15s; }
.nav a:hover { background: rgba(255, 255, 255, .14); opacity: 1; }
.nav a.on { background: #fff; color: var(--red); font-weight: 650; opacity: 1; }
@media (min-width: 761px) {
  .nav { flex-wrap: wrap; overflow-x: visible; row-gap: 4px; }
}

/* kartice */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin-bottom: 16px; box-shadow: var(--shadow); }
.card.narrow { max-width: 420px; margin: 28px auto; }
.card.narrow-left { max-width: 480px; }
.danger-zone { border-color: #f1c9c6; background: #fffafa; }
.head-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.head-row h1 { margin: 0; }
.foot { padding-bottom: 28px; color: var(--muted); text-align: center; }
.foot a { color: var(--muted); }

/* redovi */
.row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px 0; border-top: 1px solid var(--line); }
.card > .row:first-of-type, .card > h2 + .row, .card > p + .row { border-top: 0; }
.row.cancelled { opacity: .6; }
.row .grow { flex: 1; }
.actions { display: flex; gap: 6px; flex-shrink: 0; }

/* oznake */
.tag { display: inline-block; font-size: .76rem; font-weight: 600; padding: 2px 10px; border-radius: 999px; background: #eeeef3; color: #40404a; vertical-align: middle; }
.tag.ok { background: #dff5e6; color: var(--ok); }
.tag.bad { background: #fde4e2; color: var(--bad); }
.tag.warn { background: #fff1c9; color: var(--warn); }
.docs { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 5px; }
.doc-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.doc-row label.check { margin: 0; flex: 1 1 200px; }
.doc-until { margin: 0; display: flex; align-items: center; gap: 8px; font-weight: 400; flex: 0 1 220px; }
.doc-until input { margin: 0; }

/* statistika */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 16px; }
.stats.compact { margin: 14px 0 0; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; text-align: center; box-shadow: var(--shadow); }
.stats.compact .stat { background: var(--bg); box-shadow: none; border-color: transparent; }
.stat .n { font-size: 1.75rem; font-weight: 750; color: var(--red); line-height: 1.1; letter-spacing: -.02em; }
.stat .l { font-size: .8rem; color: var(--muted); margin-top: 2px; }

/* forme */
label { display: block; font-size: .88rem; font-weight: 600; margin-bottom: 14px; color: #2a2a33; }
label.check { display: flex; align-items: center; gap: 10px; font-weight: 450; font-size: .95rem; margin-bottom: 8px; color: var(--ink); }
label.check.danger { color: var(--bad); }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=time], input[type=search], input:not([type]), select, textarea {
  display: block; width: 100%; margin-top: 5px; padding: 10px 13px; font: inherit; font-weight: 400; color: inherit;
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: #fff;
  transition: border-color .15s, box-shadow .15s;
}
input:hover, select:hover, textarea:hover { border-color: #b9b9c4; }
input:focus, select:focus, textarea:focus { outline: 0; border-color: var(--red); box-shadow: var(--ring); }
input[type=checkbox], input[type=radio] { width: 20px; height: 20px; accent-color: var(--red); flex-shrink: 0; }
textarea { resize: vertical; }
fieldset { border: 1px solid var(--line); border-radius: 12px; margin: 0 0 16px; padding: 12px 14px 6px; background: #fcfcfd; }
legend { font-size: .82rem; font-weight: 650; padding: 0 8px; color: var(--muted); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.grid3 { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 0 14px; }
form.inline { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
form.inline label { margin: 0; }
form.inline input[type=text] { min-width: 220px; }
form.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 14px; }
form.filters select, form.filters input[type=search] { width: auto; margin: 0; }
form.filters label.check { margin: 0; }

/* gumbi */
.btn {
  display: inline-block; padding: 10px 18px; border-radius: var(--radius-sm); border: 1px solid var(--line-strong); background: #fff; color: var(--ink);
  font: inherit; font-weight: 650; font-size: .95rem; text-decoration: none; cursor: pointer; text-align: center;
  transition: background .15s, border-color .15s, box-shadow .15s, transform .05s;
}
.btn:hover { background: #f7f7fa; border-color: #b9b9c4; }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 0; box-shadow: var(--ring); }
.btn.primary { background: var(--red); border-color: var(--red); color: #fff; box-shadow: 0 2px 8px rgba(176, 18, 27, .28); }
.btn.primary:hover { background: var(--red-dark); border-color: var(--red-dark); }
.btn.danger { background: #fff; border-color: var(--bad); color: var(--bad); }
.btn.danger:hover { background: #fff3f2; }
.btn.small { padding: 6px 13px; font-size: .88rem; }
.actions-bar { display: flex; gap: 8px; flex-wrap: wrap; margin: 4px 0 16px; }
.actions-bar.sticky { position: sticky; top: 100px; z-index: 5; background: var(--bg); padding: 8px 0; margin: 0; }

/* poruke */
.flash { padding: 12px 16px; border-radius: 12px; margin-bottom: 14px; background: #e9f0fe; color: #1a3d8f; font-weight: 500; }
.flash.ok { background: #dff5e6; color: var(--ok); }
.flash.err { background: #fde4e2; color: var(--bad); }
.flash.warn { background: #fff1c9; color: var(--warn); }

/* prisustvo */
.row.att { flex-direction: column; align-items: stretch; gap: 8px; }
.att-name { font-weight: 650; }
.seg { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.seg-opt { margin: 0; font-weight: 600; }
.seg-opt input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.seg-opt span { display: block; text-align: center; padding: 10px 4px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); font-size: .88rem; background: #fff; cursor: pointer; transition: background .12s, color .12s, border-color .12s; }
.seg-opt:hover span { background: #f7f7fa; }
.seg-opt.p input:checked + span { background: var(--ok); border-color: var(--ok); color: #fff; }
.seg-opt.a input:checked + span { background: var(--bad); border-color: var(--bad); color: #fff; }
.seg-opt.e input:checked + span { background: #d29922; border-color: #d29922; color: #fff; }
.seg-opt.n input:checked + span { background: #8b8b95; border-color: #8b8b95; color: #fff; }
.seg-opt input:focus-visible + span { outline: 3px solid #6c9bff; outline-offset: 1px; }

.body-text { margin-top: 10px; white-space: normal; }
details.reset { margin: 0 0 6px; }
details.reset summary { cursor: pointer; font-size: .88rem; color: var(--muted); padding: 2px 0 6px; }
fieldset.guardian legend { color: var(--ink); }

@media (max-width: 560px) {
  .wrap { padding: 0 14px; }
  .card { padding: 16px; border-radius: 14px; }
  .grid2, .grid3 { grid-template-columns: 1fr; }
  .row { align-items: flex-start; }
  .actions { flex-direction: column; }
  .actions-bar.sticky { top: 92px; }
  h1 { font-size: 1.45rem; }
  .page-head .actions { flex-direction: row; flex-wrap: wrap; }
  table.fin th, table.fin td { padding: 8px 5px; }
  .brand { font-size: .98rem; }
}

/* izvještaji i grafikoni */
.bar { display: block; width: 100%; height: 12px; border-radius: 6px; background: #ececf1; }
.bar .pr, .sw.pr { fill: var(--ok); background: var(--ok); }
.bar .ex, .sw.ex { fill: #d29922; background: #d29922; }
.bar .ab, .sw.ab { fill: var(--bad); background: var(--bad); }
.sw { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin: 0 4px 0 12px; vertical-align: -1px; }
.sw:first-child { margin-left: 0; }
.legend { font-size: .88rem; margin: 0 0 10px; }
.rep-row { padding: 10px 0; border-top: 1px solid var(--line); }
.rep-row:first-of-type { border-top: 0; }
.rep-top { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 5px; }
.chart { width: 100%; max-height: 220px; display: block; }
.chart .axis { stroke: var(--line); stroke-width: 1; }
.chart .col { fill: var(--ok); }
.chart .val { font: 600 11px system-ui, sans-serif; fill: var(--ink); }
.chart .lab { font: 11px system-ui, sans-serif; fill: var(--muted); }
.chart .note { font: 10px system-ui, sans-serif; fill: var(--muted); }

@media print {
  .top, .foot, .actions-bar { display: none; }
  body { background: #fff; }
  .card { border: 0; box-shadow: none; padding: 0 0 8px; break-inside: avoid; }
}

.card ul, .card ol { margin: 6px 0 10px; padding-left: 22px; }
.card li { margin-bottom: 4px; }

.fee-row { flex-wrap: wrap; }
.fee-actions { align-items: center; flex-wrap: wrap; }
.fee-actions form { margin: 0; }
.fee-actions select { width: auto; margin: 0; padding: 6px 8px; }

/* notifikacije */
[hidden] { display: none !important; }
textarea[readonly] { width: 100%; }

/* tablice */
.xscroll { overflow-x: auto; }
table.fin { width: 100%; border-collapse: collapse; margin: 8px 0; }
table.fin th, table.fin td { padding: 9px 10px; border-bottom: 1px solid var(--line); text-align: right; }
table.fin th:first-child, table.fin td:first-child { text-align: left; }
table.fin thead th { color: var(--muted); font-weight: 650; font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; border-bottom: 2px solid var(--line); }
table.fin tr.sum td { font-weight: 700; border-top: 2px solid var(--line); }
table.fin tbody tr:hover td { background: #fafafd; }
.neg { color: var(--bad); }

/* rang lista */
table.rank th, table.rank td { text-align: center; }
table.rank th:first-child, table.rank td:first-child { text-align: left; width: 48px; }
table.rank th:nth-child(2), table.rank td:nth-child(2) { text-align: left; }
table.rank th:last-child, table.rank td:last-child { text-align: right; }
table.rank td:nth-child(2) a { font-weight: 650; text-decoration: none; }
table.rank td:nth-child(2) a:hover { text-decoration: underline; }
table.rank td small { display: block; line-height: 1.3; }
table.rank tr.me td { background: var(--red-soft); }
.rk { display: inline-grid; place-items: center; min-width: 30px; height: 30px; padding: 0 6px; border-radius: 999px; background: #eeeef3; color: #40404a; font-weight: 700; font-size: .85rem; }
.rk.r1 { background: #fde9a6; color: #6e5000; }
.rk.r2 { background: #e3e6ee; color: #3d4352; }
.rk.r3 { background: #f6d8c1; color: #7a431b; }

/* takmicenja */
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 8px 12px; flex-wrap: wrap; margin: 0 0 14px; }
.page-head h1 { margin: 0; }
.res-row { display: grid; grid-template-columns: 110px minmax(120px, 1fr) 110px auto auto; gap: 2px 8px; align-items: end; padding: 10px 0; border-top: 1px solid var(--line); }
.card > h2 + .res-row, .card > form > .res-row:first-child { border-top: 0; }
.res-row .who { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; }
.res-row label { font-size: .82rem; margin: 0; }
.res-row select, .res-row input:not([type=checkbox]) { padding: 7px 10px; margin-top: 2px; }
.res-row label.check { white-space: nowrap; padding-bottom: 7px; font-size: .88rem; }
@media (max-width: 760px) {
  .res-row { grid-template-columns: 1fr 1fr; }
}

/* najava izostanka */
.absence { margin-top: 8px; }
form.absence { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
details.absence summary { cursor: pointer; display: inline-block; font-size: .88rem; font-weight: 600; color: var(--red); padding: 4px 12px; border: 1px solid var(--line-strong); border-radius: 999px; background: #fff; list-style: none; }
details.absence summary::-webkit-details-marker { display: none; }
details.absence[open] summary { background: var(--red-soft); border-color: #f1c9c6; }
details.absence form { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
details.absence input { flex: 1 1 200px; margin: 0; }

.brand-logo { background: #fff; border-radius: 9px; padding: 3px 8px; display: inline-flex; box-shadow: 0 1px 3px rgba(0, 0, 0, .18); }
.brand-logo img { height: 30px; width: auto; display: block; }
.login-logo { text-align: center; margin: 8px auto 18px; }
.login-logo img { max-width: 280px; width: 80%; height: auto; }
@media (max-width: 560px) { .brand-logo img { height: 24px; } }
