/* QCC Radna evidencija — design system */
:root {
    --bg: #f6f5f1;
    --surface: #ffffff;
    --surface-2: #faf9f6;
    --ink: #1d1f1c;
    --ink-2: #3a3d38;
    --muted: #6d716a;
    --faint: #9a9d95;
    --line: #e4e2dc;
    --line-2: #d6d3cb;
    --accent: #1f6f5c;
    --accent-hover: #185a4a;
    --accent-soft: #e3efea;
    --amber: #a86a0c;
    --amber-soft: #fbf0d9;
    --red: #b3372f;
    --red-soft: #f9e5e2;
    --green: #1f7a4d;
    --green-soft: #e1f1e8;
    --blue: #2f5f94;
    --blue-soft: #e5edf6;
    --gray-soft: #eeede8;
    --radius: 10px;
    --radius-sm: 7px;
    --sidebar-w: 248px;
    --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --shadow-pop: 0 12px 40px rgba(29, 31, 28, .18);
    --tabbar-h: 62px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0; background: var(--bg); color: var(--ink);
    font: 400 14px/1.5 var(--font); -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -.01em; line-height: 1.25; }
h2 { font-size: 18px; } h3 { font-size: 15px; }
p { margin: 0 0 .75em; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
hr { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }
img { max-width: 100%; }
[hidden] { display: none !important; }
.icon { width: 18px; height: 18px; flex: none; vertical-align: -3px; }
.muted { color: var(--muted); } .faint { color: var(--faint); }
.small { font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.right { text-align: right; } .center { text-align: center; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.spacer { flex: 1; }
.stack > * + * { margin-top: 16px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
pre.debug { text-align: left; background: var(--gray-soft); padding: 12px; border-radius: var(--radius-sm); overflow: auto; max-width: 100%; font-size: 12px; }

/* ---------- Shell ---------- */
.shell { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; }
.sidebar {
    position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column;
    background: #efede6; border-right: 1px solid var(--line); z-index: 40;
}
.brand { display: flex; align-items: center; gap: 11px; padding: 18px 18px 14px; color: var(--ink); flex: none; }
.brand:hover { text-decoration: none; }
.brand-mark {
    width: 34px; height: 34px; border-radius: 9px; background: var(--accent); color: #fff;
    display: grid; place-items: center; font-weight: 700; font-size: 17px; flex: none;
}
.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-text strong, .auth-brand strong { font-size: 15px; line-height: 1.2; }
.brand-text small, .auth-brand small { color: var(--muted); font-size: 12px; }
.nav { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 4px 10px 12px; scrollbar-width: thin; }
.nav-group { margin-top: 6px; }
.nav-group-head {
    width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 8px;
    background: none; border: 0; padding: 8px 10px; cursor: pointer; color: var(--muted);
    font: 600 11px/1 var(--font); letter-spacing: .08em; text-transform: uppercase; border-radius: 6px;
}
.nav-group-head:hover { color: var(--ink); background: rgba(0,0,0,.03); }
.nav-group-head .caret { width: 14px; height: 14px; transition: transform .18s; }
.nav-group.is-collapsed .caret { transform: rotate(-90deg); }
.nav-group.is-collapsed .nav-items { display: none; }
.nav-link {
    display: flex; align-items: center; gap: 11px; padding: 8px 10px; margin: 1px 0; border-radius: 8px;
    color: var(--ink-2); font-weight: 500; white-space: nowrap; position: relative;
}
.nav-link span { overflow: hidden; text-overflow: ellipsis; }
.nav-link .icon { color: var(--muted); }
.nav-link:hover { background: rgba(0,0,0,.045); text-decoration: none; }
.nav-link.is-active { background: var(--surface); color: var(--accent); box-shadow: 0 0 0 1px var(--line); }
.nav-link.is-active .icon { color: var(--accent); }
.nav-link.is-active::before { content: ""; position: absolute; left: -10px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--accent); }
.sidebar-user { flex: none; display: flex; align-items: center; gap: 6px; padding: 12px; border-top: 1px solid var(--line); }
.user-chip { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; color: var(--ink); padding: 4px; border-radius: 8px; }
.user-chip:hover { background: rgba(0,0,0,.045); text-decoration: none; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; font-weight: 600; flex: none; }
.user-meta { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.user-meta strong { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-meta small { color: var(--muted); font-size: 11.5px; }
.icon-btn {
    width: 36px; height: 36px; display: inline-grid; place-items: center; border: 0; background: none; color: var(--muted);
    border-radius: 8px; cursor: pointer; flex: none;
}
.icon-btn:hover { background: rgba(0,0,0,.06); color: var(--ink); }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: 12px; padding: 20px 28px 4px; }
.menu-btn { display: none; }
.back-btn { display: none; margin-left: -4px; }
.back-btn.show { display: inline-grid; }
.page-title { font-size: 22px; font-weight: 650; letter-spacing: -.02em; }
.page-actions { margin-left: auto; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.content { padding: 16px 28px 56px; min-width: 0; max-width: 1500px; width: 100%; }
.sidebar-backdrop { display: none; }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 36px; padding: 0 14px;
    border: 1px solid var(--line-2); background: var(--surface); color: var(--ink); border-radius: 8px;
    font: 500 13.5px/1 var(--font); cursor: pointer; white-space: nowrap; transition: background .12s, border-color .12s;
}
.btn:hover { background: var(--surface-2); border-color: #c4c1b8; text-decoration: none; }
.btn:focus-visible, .icon-btn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, .tab:focus-visible, .nav-link:focus-visible {
    outline: 2px solid var(--accent); outline-offset: 2px;
}
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: rgba(0,0,0,.05); border-color: transparent; }
.btn-danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn-danger:hover { background: #962d26; border-color: #962d26; }
.btn-outline-danger { color: var(--red); border-color: #e3bcb7; }
.btn-outline-danger:hover { background: var(--red-soft); border-color: var(--red); }
.btn-sm { height: 30px; padding: 0 10px; font-size: 12.5px; border-radius: 7px; }
.btn-block { width: 100%; height: 40px; }
.btn[disabled], .btn.is-disabled { opacity: .5; pointer-events: none; }
.btn-group { display: inline-flex; }
.btn-group .btn { border-radius: 0; margin-left: -1px; }
.btn-group .btn:first-child { border-radius: 8px 0 0 8px; margin-left: 0; }
.btn-group .btn:last-child { border-radius: 0 8px 8px 0; }

/* ---------- Cards ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.card + .card { margin-top: 16px; }
.card-header { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.card-header h2, .card-header h3 { font-size: 15px; }
.card-header .actions { margin-left: auto; display: flex; gap: 8px; }
.card-body { padding: 18px; }
.card-footer { padding: 12px 18px; border-top: 1px solid var(--line); display: flex; gap: 8px; justify-content: flex-end; background: var(--surface-2); border-radius: 0 0 var(--radius) var(--radius); }
.card > .table-wrap:last-child { border-radius: 0 0 var(--radius) var(--radius); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; max-width: 100%; }
.table-wrap.tall { max-height: calc(100vh - 230px); overflow: auto; }
.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
.table th {
    position: sticky; top: 0; z-index: 2; background: var(--surface-2); text-align: left; padding: 10px 14px;
    font: 600 11.5px/1.2 var(--font); text-transform: uppercase; letter-spacing: .05em; color: var(--muted);
    border-bottom: 1px solid var(--line); white-space: nowrap;
}
.table td { padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: #faf9f5; }
.table .num, .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table th.num { text-align: right; }
.table td.actions, .table th.actions { text-align: right; white-space: nowrap; width: 1%; }
.table tfoot td { font-weight: 600; background: var(--surface-2); border-top: 1px solid var(--line-2); }
.table .strong { font-weight: 600; }
.table .title-cell { font-weight: 550; color: var(--ink); }
.table-compact td, .table-compact th { padding: 6px 10px; }
.table a.row-link { color: var(--ink); font-weight: 550; }
.table a.row-link:hover { color: var(--accent); }

/* ---------- Forms ---------- */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 18px; }
.form-grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.form-grid .span-2 { grid-column: span 2; } .form-grid .span-all { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > label, .label { font-size: 12.5px; font-weight: 550; color: var(--ink-2); }
.field > label .req, .req { color: var(--red); }
input, select, textarea { font: inherit; color: var(--ink); }
.field input:not([type=checkbox]):not([type=radio]):not([type=file]):not([type=color]),
.field select, .field textarea, .input, .select {
    width: 100%; min-height: 38px; padding: 8px 11px; background: var(--surface); border: 1px solid var(--line-2);
    border-radius: 8px; transition: border-color .12s, box-shadow .12s;
}
.field textarea { min-height: 84px; resize: vertical; line-height: 1.45; }
.field select, .select { appearance: none; padding-right: 32px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236d716a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9.5 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 10px center; background-size: 16px; }
.field input:focus, .field select:focus, .field textarea:focus, .input:focus, .select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); outline: 0; }
.field input[readonly], .field input:disabled, .field select:disabled { background: var(--gray-soft); color: var(--muted); }
.field input[type=color] { width: 54px; height: 38px; padding: 3px; border: 1px solid var(--line-2); border-radius: 8px; background: var(--surface); }
.field input[type=file] { font-size: 13px; }
.field .hint { font-size: 12px; color: var(--muted); }
.field .error { font-size: 12.5px; color: var(--red); }
.field.has-error input, .field.has-error select, .field.has-error textarea { border-color: var(--red); }
.check { display: flex; align-items: center; gap: 8px; font-size: 13.5px; cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--accent); }
.form-actions { display: flex; gap: 10px; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); }
.form-section { margin: 4px 0 14px; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); }
.form-section:not(:first-child) { margin-top: 26px; }
.inline-input { height: 30px; min-height: 30px; padding: 4px 8px; border: 1px solid var(--line-2); border-radius: 6px; background: var(--surface); width: 110px; font-variant-numeric: tabular-nums; }

/* ---------- Badges / chips ---------- */
.badge {
    display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 550;
    line-height: 1.5; white-space: nowrap; background: var(--gray-soft); color: var(--ink-2);
}
.badge-green { background: var(--green-soft); color: var(--green); }
.badge-amber { background: var(--amber-soft); color: var(--amber); }
.badge-red { background: var(--red-soft); color: var(--red); }
.badge-blue { background: var(--blue-soft); color: var(--blue); }
.badge-gray { background: var(--gray-soft); color: var(--muted); }
.badge .dot, .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; display: inline-block; }
.chip {
    display: flex; align-items: center; gap: 6px; padding: 4px 8px; font-size: 12px; line-height: 1.3; border-radius: 6px;
    background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--chip-color, var(--accent));
    color: var(--ink); cursor: pointer; text-align: left; width: 100%; font-variant-numeric: tabular-nums; overflow: hidden;
}
.chip:hover { background: var(--surface-2); border-color: var(--line-2); border-left-color: var(--chip-color, var(--accent)); text-decoration: none; }
.chip b { font-weight: 600; white-space: nowrap; }
.chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-2); }

/* ---------- Tabs / toolbar ---------- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a, .tabs button {
    padding: 10px 14px; font: 500 13.5px/1 var(--font); color: var(--muted); background: none; border: 0; cursor: pointer;
    border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap;
}
.tabs a:hover, .tabs button:hover { color: var(--ink); text-decoration: none; }
.tabs .is-active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 16px; }
.toolbar .input, .toolbar .select, .toolbar input, .toolbar select { height: 36px; min-height: 36px; padding: 6px 11px; border: 1px solid var(--line-2); border-radius: 8px; background: var(--surface); width: auto; }
.toolbar .select, .toolbar select { padding-right: 32px; appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236d716a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9.5 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 10px center; background-size: 16px; }
.toolbar input:focus, .toolbar select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); outline: 0; }
.toolbar .search { position: relative; }
.toolbar .search input { padding-left: 34px; min-width: 240px; }
.toolbar .search .icon { position: absolute; left: 10px; top: 9px; color: var(--faint); pointer-events: none; }
.toolbar .spacer { flex: 1; }

/* ---------- Empty / stat / alert ---------- */
.empty { text-align: center; padding: 48px 20px; color: var(--muted); }
.empty h2 { color: var(--ink); margin: 6px 0 6px; }
.empty p { max-width: 420px; margin: 0 auto 16px; }
.empty .empty-icon { width: 40px; height: 40px; color: var(--faint); }
.error-page { padding-top: 72px; }
.error-code { font-size: 56px; font-weight: 700; letter-spacing: -.04em; color: var(--line-2); line-height: 1; margin-top: 8px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
.stat-label { font-size: 12px; color: var(--muted); font-weight: 550; text-transform: uppercase; letter-spacing: .05em; }
.stat-value { font-size: 26px; font-weight: 650; letter-spacing: -.02em; margin-top: 6px; font-variant-numeric: tabular-nums; line-height: 1.1; }
.stat-sub { font-size: 12.5px; color: var(--muted); margin-top: 4px; }
.stat.is-warn .stat-value { color: var(--amber); } .stat.is-bad .stat-value { color: var(--red); } .stat.is-good .stat-value { color: var(--green); }
.alert { display: flex; gap: 10px; align-items: flex-start; padding: 11px 14px; border-radius: 8px; margin-bottom: 14px; font-size: 13.5px; border: 1px solid; }
.alert-error { background: var(--red-soft); color: var(--red); border-color: #efc6c1; }
.alert-info { background: var(--blue-soft); color: var(--blue); border-color: #c9d9ec; }
.alert-warn { background: var(--amber-soft); color: var(--amber); border-color: #efd9a8; }
.alert-success { background: var(--green-soft); color: var(--green); border-color: #bfe0cd; }
.kv { display: grid; grid-template-columns: 160px 1fr; gap: 8px 16px; margin: 0; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; }

/* ---------- Modal ---------- */
.modal { position: fixed; inset: 0; z-index: 100; display: none; align-items: center; justify-content: center; padding: 20px; }
.modal.open { display: flex; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(29, 31, 28, .45); animation: fade .15s; }
.modal-dialog {
    position: relative; background: var(--surface); border-radius: 14px; width: 100%; max-width: 520px; max-height: calc(100vh - 40px);
    display: flex; flex-direction: column; box-shadow: var(--shadow-pop); animation: pop .16s;
}
.modal-dialog.lg { max-width: 760px; } .modal-dialog.sm { max-width: 400px; }
.modal-header { display: flex; align-items: center; gap: 10px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.modal-header h3 { font-size: 16px; flex: 1; }
.modal-body { padding: 20px; overflow-y: auto; }
.modal-footer { padding: 14px 20px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 8px; background: var(--surface-2); border-radius: 0 0 14px 14px; }
body.modal-open { overflow: hidden; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98); } }

/* ---------- Drawer (desni panel) ---------- */
.drawer { position: fixed; inset: 0; z-index: 90; display: none; }
.drawer.open { display: block; }
.drawer-panel { position: absolute; top: 0; right: 0; bottom: 0; width: 440px; max-width: 100%; background: var(--surface); box-shadow: var(--shadow-pop); display: flex; flex-direction: column; animation: slide .2s; }
.drawer .modal-backdrop { position: absolute; }
@keyframes slide { from { transform: translateX(30px); opacity: 0; } }

/* ---------- Toast ---------- */
.toast-stack { position: fixed; right: 18px; bottom: 18px; z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; pointer-events: none; }
.toast {
    pointer-events: auto; display: flex; align-items: center; gap: 10px; padding: 11px 16px; max-width: 380px; border-radius: 10px;
    background: var(--ink); color: #fff; box-shadow: var(--shadow-pop); font-size: 13.5px; animation: pop .2s;
}
.toast .icon { width: 18px; height: 18px; }
.toast-success .icon { color: #7fd6a8; } .toast-error { background: #7d221c; } .toast-error .icon { color: #ffb4ac; } .toast-info .icon { color: #a9c8ec; }
.toast.leaving { opacity: 0; transform: translateY(6px); transition: .25s; }

/* ---------- Auth ---------- */
body.bare { background: var(--bg); }
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.auth-card { width: 100%; max-width: 380px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 30px; display: flex; flex-direction: column; gap: 16px; }
.auth-card h1 { font-size: 22px; }
.auth-brand { display: flex; gap: 11px; align-items: center; }
.auth-brand > div { display: flex; flex-direction: column; line-height: 1.2; }
.bare-content { max-width: none; padding: 0; }

/* ---------- Bottom tab bar (mobile) ---------- */
.tabbar { display: none; }

/* ---------- Pomocne klase za module ---------- */
.week-nav { display: inline-flex; align-items: center; gap: 6px; }
.cell-weekend { background: #f4f2ec; } .cell-holiday { background: var(--red-soft); } .cell-today { background-image: linear-gradient(rgba(31,111,92,.08), rgba(31,111,92,.08)); }
.dot-amber { width: 7px; height: 7px; border-radius: 50%; background: var(--amber); display: inline-block; }
.text-red { color: var(--red); } .text-amber { color: var(--amber); } .text-green { color: var(--green); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
    .form-grid.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 899px) {
    .shell { display: block; }
    .sidebar { position: fixed; inset: 0 auto 0 0; width: min(290px, 86vw); transform: translateX(-100%); transition: transform .22s, box-shadow .22s; }
    body.sidebar-open .sidebar { transform: none; box-shadow: var(--shadow-pop); }
    .sidebar-backdrop { position: fixed; inset: 0; background: rgba(29,31,28,.4); z-index: 39; }
    body.sidebar-open .sidebar-backdrop { display: block; }
    body.sidebar-open { overflow: hidden; }
    .menu-btn { display: inline-grid; margin-left: -8px; }
    .topbar { padding: 14px 16px 2px; position: sticky; top: 0; z-index: 20; background: var(--bg); }
    .page-title { font-size: 19px; }
    .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
    .stat { padding: 12px 14px; }
    .stat-value { font-size: 22px; }
    .content { padding: 12px 16px calc(var(--tabbar-h) + 28px); }
    .tabbar {
        display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; height: var(--tabbar-h);
        background: var(--surface); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom);
    }
    .tab { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; background: none; border: 0; color: var(--muted); font: 500 11px/1 var(--font); cursor: pointer; min-width: 0; padding: 0 2px; }
    .tab span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
    .tab:hover { text-decoration: none; }
    .tab.is-active { color: var(--accent); }
    .tab .icon { width: 21px; height: 21px; }
    .form-grid, .form-grid.cols-3, .form-grid.cols-4, .grid-2, .grid-3 { grid-template-columns: 1fr; }
    .form-grid .span-2 { grid-column: auto; }
    .toolbar .search input { min-width: 0; width: 100%; }
    .toolbar .search { flex: 1 1 100%; }
    .kv { grid-template-columns: 1fr; gap: 0 0; } .kv dt { margin-top: 10px; font-size: 12px; }
    .modal { align-items: flex-end; padding: 0; }
    .modal-dialog { max-width: none; border-radius: 16px 16px 0 0; max-height: 92vh; }
    .toast-stack { left: 12px; right: 12px; bottom: calc(var(--tabbar-h) + 12px); align-items: stretch; }
    .toast { max-width: none; }
    .page-actions .btn { height: 34px; }
    /* Several header buttons: drop them under the title as one scrollable row instead of stacking. */
    .topbar { flex-wrap: wrap; }
    .page-actions:has(.btn + .btn) { order: 3; flex: 1 1 100%; margin-left: 0; flex-wrap: nowrap; overflow-x: auto; }
}

/* ---------- Print ---------- */
@media print {
    @page { margin: 12mm; }
    body { background: #fff; color: #000; font-size: 11pt; }
    .sidebar, .sidebar-backdrop, .tabbar, .topbar .menu-btn, .topbar .back-btn, .toolbar, .toast-stack, .no-print, .page-actions, .btn, .tabs, .form-actions { display: none !important; }
    .shell { display: block; }
    .topbar { padding: 0 0 8px; position: static; }
    .content { padding: 0; max-width: none; }
    .card { border: 0; border-radius: 0; }
    .card + .card { margin-top: 10px; }
    .table-wrap, .table-wrap.tall { overflow: visible; max-height: none; }
    .table th { position: static; background: #f0f0f0 !important; color: #000; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    .table td, .table th { padding: 4px 6px; border-color: #bbb; }
    .table tbody tr:hover td { background: none; }
    .page-break { page-break-after: always; }
    a { color: #000; text-decoration: none; }
}

/* ---------- Znacka sa brojem uz stavku menija (nav badge) ---------- */
.nav-badge { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--red); color: #fff; font: 600 11.5px/20px var(--font); text-align: center; font-variant-numeric: tabular-nums; }

/* ---------- Per-korisnik dozvole (Korisnici) ---------- */
.perm-groups { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.perm-group { border: 1px solid var(--border, #e3e3e3); border-radius: 8px; padding: 10px 12px; min-width: 0; }
.perm-group legend { font-weight: 600; font-size: 13px; padding: 0 6px; }
.perm-group .check { display: flex; align-items: center; gap: 8px; padding: 3px 0; font-size: 13.5px; }
