:root {
  --green: #006b3f;
  --green-600: #00804b;
  --green-50: #eaf5ee;
  --lime: #94c83d;
  --navy: #10243e;
  --text: #1c2b3a;
  --muted: #64748b;
  --line: #e3e8ee;
  --bg: #f4f7f5;
  --card: #ffffff;
  --amber: #d98a00;
  --amber-50: #fff4dc;
  --red: #c62f2f;
  --red-50: #fdeaea;
  --blue: #1f6fb2;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16, 36, 62, .06), 0 4px 16px rgba(16, 36, 62, .05);
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--text);
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); }
body { font-size: 15px; line-height: 1.45; }
a { color: var(--green); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 26px; margin: 0; color: var(--navy); letter-spacing: -.01em; }
h2 { font-size: 18px; margin: 0 0 12px; color: var(--navy); }
h3 { font-size: 15px; margin: 0 0 8px; color: var(--navy); }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.center { text-align: center; }

/* ---------- brand ---------- */
.brand { display: flex; align-items: center; gap: 10px; color: var(--navy); text-decoration: none !important; }
.brand b { display: block; font-size: 16px; font-weight: 700; letter-spacing: -.01em; }
.brand small { display: block; font-size: 12px; color: var(--muted); }
.brand-mark {
  width: 34px; height: 34px; border-radius: 10px; flex: none;
  background: var(--green) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Cpath d='M9 22c0-8 6-13 15-13-1 9-6 14-13 14l-2-1z' fill='%2394c83d'/%3E%3C/svg%3E") center/100% no-repeat;
}
.brand-lg b { font-size: 22px; }
.brand-lg small { font-size: 14px; }
.brand-lg .brand-mark { width: 46px; height: 46px; border-radius: 12px; }

/* ---------- login ---------- */
.login {
  min-height: 100vh; display: grid; place-items: center; padding: 24px;
  background: linear-gradient(135deg, #00502f 0%, var(--green) 55%, #2d8a3e 100%);
}
.login-card {
  width: 100%; max-width: 380px; background: #fff; border-radius: 18px; padding: 32px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .25); display: grid; gap: 16px;
}
.login-card .brand { margin-bottom: 8px; }

/* ---------- topbar ---------- */
.topbar { background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.topbar::after { content: ""; display: block; height: 3px; background: linear-gradient(90deg, var(--green), var(--lime)); }
.topbar-inner { max-width: 1320px; margin: 0 auto; padding: 10px 20px; display: flex; align-items: center; gap: 24px; flex-wrap: wrap; }
.nav { display: flex; gap: 4px; flex-wrap: wrap; }
.nav a { padding: 8px 14px; border-radius: 999px; color: var(--text); font-weight: 500; text-decoration: none; }
.nav a:hover { background: var(--green-50); }
.nav a.active { background: var(--green); color: #fff; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.year-pick { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.year-pick select { width: auto; padding: 6px 8px; }
.user-menu { position: relative; }
.user-drop {
  position: absolute; right: 0; top: calc(100% + 6px); background: #fff; border: 1px solid var(--line);
  border-radius: 10px; box-shadow: var(--shadow); min-width: 170px; padding: 6px; z-index: 30;
}
.user-drop button { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 8px 10px; border-radius: 6px; cursor: pointer; font: inherit; }
.user-drop button:hover { background: var(--green-50); }

.container { max-width: 1320px; margin: 0 auto; padding: 24px 20px 60px; }

/* ---------- page head ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head p { margin: 4px 0 0; color: var(--muted); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------- cards ---------- */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; border: 1px solid #edf1ee; }
.card + .card { margin-top: 18px; }
.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat { background: #fff; border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); border-left: 4px solid var(--green); }
.stat .v { font-size: 30px; font-weight: 700; color: var(--navy); line-height: 1.1; }
.stat .l { color: var(--muted); font-size: 13px; margin-top: 2px; }
.stat.amber { border-left-color: var(--amber); }
.stat.red { border-left-color: var(--red); }
.stat.blue { border-left-color: var(--blue); }
a.stat { text-decoration: none; display: block; }
a.stat:hover { transform: translateY(-1px); }

/* ---------- buttons & forms ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--line); background: #fff; color: var(--text); border-radius: 10px;
  padding: 8px 14px; font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap; text-decoration: none !important;
}
.btn:hover { border-color: #c7d2cc; background: #fafcfb; }
.btn-primary { background: var(--green); border-color: var(--green); color: #fff; }
.btn-primary:hover { background: var(--green-600); border-color: var(--green-600); }
.btn-danger { color: var(--red); border-color: #f0c9c9; }
.btn-danger:hover { background: var(--red-50); border-color: var(--red); }
.btn-approve { background: var(--green); border-color: var(--green); color: #fff; }
.btn-reject { background: #fff; border-color: var(--red); color: var(--red); }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-sm { padding: 4px 10px; font-size: 13px; border-radius: 8px; }
.btn-block { width: 100%; padding: 11px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

label { display: grid; gap: 5px; font-size: 13px; font-weight: 600; color: #334155; }
input, select, textarea {
  width: 100%; font: inherit; font-weight: 400; color: var(--text); padding: 9px 11px; border: 1px solid #cfd8d3;
  border-radius: 9px; background: #fff;
}
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(0, 107, 63, .25); border-color: var(--green); }
textarea { min-height: 70px; resize: vertical; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 600; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--green); }
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }
.form-error { color: var(--red); margin: 0; min-height: 1em; font-size: 13px; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; margin-bottom: 14px; }
.filters label { min-width: 150px; }
.filters .check { min-width: 0; }
.hint { font-size: 12px; color: var(--muted); font-weight: 400; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 9px 10px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; background: #f8faf9; }
tbody tr:hover { background: #fafcfb; }
tfoot td { font-weight: 700; border-top: 2px solid var(--line); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.row-click { cursor: pointer; }
.empty { padding: 28px; text-align: center; color: var(--muted); }

/* ---------- badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 999px; white-space: nowrap; }
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.b-approved { background: var(--green-50); color: var(--green); }
.b-pending { background: var(--amber-50); color: #a46800; }
.b-rejected { background: var(--red-50); color: var(--red); }
.b-paper-yes { background: #eef3f8; color: #3d5a7a; }
.b-paper-no { background: var(--red-50); color: var(--red); }
.chip { display: inline-block; font-size: 12px; padding: 2px 8px; border-radius: 6px; color: #fff; margin: 1px 2px 1px 0; font-weight: 600; }
.chip.temp { opacity: .85; outline: 1px dashed rgba(255,255,255,.8); outline-offset: -3px; }
.bar { height: 8px; background: #e8eeea; border-radius: 99px; overflow: hidden; min-width: 80px; display: flex; }
.bar span { display: block; height: 100%; }
.bar .a { background: var(--green); }
.bar .p { background: #f0b640; }

/* ---------- tabs ---------- */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.tab { padding: 8px 14px; border-radius: 10px; border: 1px solid var(--line); background: #fff; cursor: pointer; font: inherit; font-weight: 600; }
.tab.active { background: var(--navy); color: #fff; border-color: var(--navy); }

/* ---------- calendar ---------- */
.cal-wrap { overflow-x: auto; }
.cal { border-collapse: separate; border-spacing: 0; width: 100%; table-layout: fixed; font-size: 12px; }
.cal th, .cal td { border-bottom: 1px solid var(--line); border-right: 1px solid #eef2ef; padding: 0; text-align: center; height: 30px; }
.cal th { background: #f8faf9; text-transform: none; letter-spacing: 0; font-size: 11px; color: var(--muted); padding: 4px 0; line-height: 1.15; }
.cal th.name, .cal td.name { width: 170px; text-align: left; padding: 0 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 13px; color: var(--text); }
.cal th.name { font-size: 11px; color: var(--muted); }
.cal .we { background: #f1f4f2; }
.cal .hol { background: #fde9d4; }
.cal .today { box-shadow: inset 0 0 0 2px var(--blue); }
.cal td.off { cursor: pointer; }
.cal td.off.approved { background: var(--c, var(--green)); }
.cal td.off.pending { background: repeating-linear-gradient(45deg, var(--c, var(--green)) 0 4px, #fff 4px 7px); }
.cal td.off.k-nahradni.approved { background: #7aa7d6; }
.cal td.off.k-jine.approved { background: #9aa5b1; }
.cal td.na { background: repeating-linear-gradient(-45deg, #e5e9e7 0 3px, #fff 3px 6px); }
.cal tr.sum td { font-weight: 700; background: #f8faf9; height: 26px; }
.cal tr.sum td.over { background: var(--red); color: #fff; }
.cal tr.sum td.warn { background: #ffe2a8; }
.cal .tempmark { color: var(--muted); font-size: 11px; }
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12px; color: var(--muted); margin-top: 12px; align-items: center; }
.legend i { display: inline-block; width: 16px; height: 12px; border-radius: 3px; vertical-align: -2px; margin-right: 5px; }

/* ---------- conflicts panel ---------- */
.info-panel { background: #f8faf9; border: 1px solid var(--line); border-radius: 12px; padding: 14px; display: grid; gap: 10px; }
.info-row { display: flex; justify-content: space-between; gap: 10px; }
.alert { border-radius: 10px; padding: 10px 12px; font-size: 14px; }
.alert-ok { background: var(--green-50); color: #0b5a35; }
.alert-warn { background: var(--amber-50); color: #7a4f00; }
.alert-bad { background: var(--red-50); color: #8e1f1f; }
.alert ul { margin: 6px 0 0; padding-left: 18px; }

/* ---------- modal ---------- */
.modal-back { position: fixed; inset: 0; background: rgba(16, 36, 62, .45); display: grid; place-items: start center; padding: 5vh 16px; z-index: 50; overflow-y: auto; }
.modal { background: #fff; border-radius: 18px; width: 100%; max-width: 640px; box-shadow: 0 30px 80px rgba(0,0,0,.3); }
.modal-wide { max-width: 860px; }
.modal-head { padding: 18px 22px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; }
.modal-head h2 { margin: 0; }
.modal-body { padding: 20px 22px; display: grid; gap: 16px; }
.modal-foot { padding: 14px 22px; border-top: 1px solid var(--line); display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; background: #fafcfb; border-radius: 0 0 18px 18px; }
.modal-foot .left { margin-right: auto; }
.x { border: 0; background: none; font-size: 22px; cursor: pointer; color: var(--muted); line-height: 1; }

.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--navy); color: #fff; padding: 11px 18px; border-radius: 10px; z-index: 60; box-shadow: var(--shadow); }
.toast.err { background: var(--red); }

.print-head, .print-foot { display: none; }

@media (max-width: 760px) {
  .form-grid { grid-template-columns: 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
  .topbar-right { margin-left: 0; width: 100%; }
}

/* ================= TISK A4 ================= */
@media print {
  html, body { background: #fff; }
  body { font-size: 10.5pt; }
  .no-print, .topbar, .actions, .filters, .tabs, .btn, #modal-root, .toast { display: none !important; }
  .container { max-width: none; padding: 0; }
  .card, .stat { box-shadow: none; border: 0; padding: 0; }
  .card + .card { margin-top: 8mm; }
  .page-head { margin-bottom: 4mm; }
  .page-head p { color: #333; }
  h1 { font-size: 16pt; }
  h2 { font-size: 12.5pt; margin-bottom: 3mm; }
  .print-head {
    display: flex; justify-content: space-between; align-items: center;
    border-bottom: 2px solid var(--green); padding-bottom: 3mm; margin-bottom: 5mm;
  }
  .print-head .brand b { font-size: 12pt; }
  .print-head .brand small { font-size: 9pt; color: #444; }
  .print-head .brand-mark { width: 9mm; height: 9mm; }
  .print-head .meta { font-size: 9pt; color: #444; text-align: right; }
  .print-foot { display: flex; justify-content: space-between; margin-top: 14mm; font-size: 9.5pt; gap: 20mm; }
  .print-foot div { flex: 1; border-top: 1px solid #555; padding-top: 2mm; text-align: center; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  table { font-size: 9.5pt; }
  th { background: #eef3f0 !important; color: #222; }
  th, td { padding: 4.5px 6px; border-bottom: 1px solid #cfd6d2; }
  tr { break-inside: avoid; }
  thead { display: table-header-group; }
  .badge { padding: 1px 6px; font-size: 8.5pt; }
  .stats { grid-template-columns: repeat(4, 1fr); gap: 4mm; margin-bottom: 6mm; }
  .stat { border: 1px solid #cfd6d2 !important; border-left: 4px solid var(--green) !important; padding: 3mm 4mm !important; border-radius: 3mm; }
  .stat .v { font-size: 16pt; }
  .cal { font-size: 7.5pt; }
  .cal th, .cal td { height: 6.2mm; border-right: 1px solid #d9dfdb; border-bottom: 1px solid #d9dfdb; }
  .cal th.name, .cal td.name { width: 38mm; font-size: 8.5pt; padding: 0 2mm; }
  .cal .today { box-shadow: none; }
  .hide-print { display: none !important; }
  a { color: inherit; }
}
