:root {
  --bg: #f4f6fa; --card: #fff; --text: #1a1f2b; --muted: #667085; --line: #e3e7ee;
  --accent: #1f6feb; --danger: #c62828; --ok: #1a8f4c; --warn: #b26a00;
  --weekend: #f6f7fa; --holiday: #fff1ee;
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  font-size: 14px; color: var(--text);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); }
h1, h2, h3 { margin: 0 0 8px; }
h2 { font-size: 18px; } h3 { font-size: 15px; }
.muted { color: var(--muted); } .err { color: var(--danger); } .ok { color: var(--ok); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; border: 1px solid var(--line); background: var(--card); padding: 6px 12px; border-radius: 6px; color: var(--text); }
button:hover:not(:disabled) { border-color: var(--accent); }
button:disabled { opacity: .5; cursor: not-allowed; }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.danger { color: var(--danger); }
button.small { padding: 2px 8px; font-size: 12px; }
input, select, textarea { border: 1px solid var(--line); border-radius: 6px; padding: 6px 8px; background: #fff; color: var(--text); }
textarea { width: 100%; min-height: 64px; resize: vertical; }
label { display: block; margin: 10px 0 4px; font-weight: 600; font-size: 13px; }
label.inline { display: inline-flex; gap: 6px; align-items: center; font-weight: 400; margin: 4px 12px 4px 0; }

/* Raspored */
header.top { background: #111827; color: #fff; display: flex; align-items: center; gap: 24px; padding: 0 20px; height: 52px; }
header.top .brand { font-weight: 700; letter-spacing: .2px; }
header.top nav { display: flex; gap: 4px; flex: 1; }
header.top nav a { color: #cbd5e1; text-decoration: none; padding: 16px 12px; border-bottom: 3px solid transparent; }
header.top nav a.active { color: #fff; border-bottom-color: var(--accent); }
header.top .who { font-size: 13px; color: #cbd5e1; display: flex; gap: 12px; align-items: center; }
header.top .who button { background: transparent; color: #fff; border-color: #475569; }
main { padding: 16px 20px 40px; max-width: 1400px; margin: 0 auto; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 16px; margin-bottom: 16px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }

/* Prijava */
.login { max-width: 420px; margin: 12vh auto; text-align: center; }
.login a.ms { display: inline-block; margin-top: 14px; background: #2f2f2f; color: #fff; padding: 10px 18px; border-radius: 6px; text-decoration: none; }
.login .devlist { text-align: left; margin-top: 18px; font-size: 13px; }
.login .devlist a { display: block; padding: 4px 0; }

/* Boje odjela */
.dept-pullman { --c: var(--c-pullman, #1f6feb); }
.dept-movenpick { --c: var(--c-movenpick, #1a8f4c); }
.dept-housekeeping { --c: var(--c-housekeeping, #e8710a); }
.dept-hr { --c: var(--c-hr, #7c5cbf); }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; background: var(--c); margin-right: 6px; vertical-align: -1px; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border: 1px solid var(--line); border-radius: 999px; background: #fff; cursor: pointer; user-select: none; }
.chip.off { opacity: .45; text-decoration: line-through; }
.badge { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12px; background: #eef1f6; }
.badge.pending { background: #fff4d6; color: var(--warn); } .badge.approved { background: #dcf5e6; color: var(--ok); }
.badge.rejected { background: #fde4e4; color: var(--danger); } .badge.cancelled { background: #eceff3; color: var(--muted); }

/* Mjesečni kalendar */
.cal-toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.cal-toolbar h2 { margin: 0 8px; min-width: 190px; text-transform: capitalize; }
.legend { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 10px; }
.legend .sw { display: inline-block; width: 28px; height: 12px; border-radius: 3px; vertical-align: -2px; margin-right: 4px; }
.sw.pend { background: repeating-linear-gradient(135deg, #cdd9f4 0 5px, #e8eefb 5px 10px); border: 1px dashed #5b7bd0; }
.month { background: var(--card); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.month .dow { display: grid; grid-template-columns: repeat(7, 1fr); background: #eef1f6; font-weight: 600; font-size: 12px; color: var(--muted); }
.month .dow div { padding: 6px 8px; }
.week { display: grid; grid-template-columns: repeat(7, 1fr); border-top: 1px solid var(--line); }
.day { border-left: 1px solid var(--line); padding: 3px 6px; font-size: 12px; color: var(--muted); overflow: hidden; cursor: pointer; min-width: 0; }
.day:first-child { border-left: 0; }
.day.weekend { background: var(--weekend); }
.day.holiday { background: var(--holiday); }
.day.other { opacity: .55; }
.day .num { font-weight: 600; }
.day.today .num { background: var(--accent); color: #fff; border-radius: 999px; padding: 1px 6px; }
.day .hol { color: var(--danger); margin-left: 6px; font-size: 11px; white-space: nowrap; }
.bar {
  z-index: 2; background: var(--c); color: #fff; border-radius: 4px; margin: 2px 3px; padding: 0 6px;
  font-size: 12px; line-height: 20px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; align-self: center;
}
.bar.cl { border-top-left-radius: 0; border-bottom-left-radius: 0; margin-left: 0; }
.bar.cr { border-top-right-radius: 0; border-bottom-right-radius: 0; margin-right: 0; }
.bar.mine { font-weight: 700; }
.bar.pending {
  background: repeating-linear-gradient(135deg, color-mix(in srgb, var(--c) 30%, white) 0 6px, color-mix(in srgb, var(--c) 14%, white) 6px 12px);
  color: var(--text); outline: 1px dashed var(--c); outline-offset: -1px;
}

/* Vremenska crta */
.tl-wrap { background: var(--card); border: 1px solid var(--line); border-radius: 10px; overflow: auto; }
table.tl { border-collapse: collapse; font-size: 12px; width: 100%; }
table.tl th, table.tl td { border: 1px solid var(--line); text-align: center; padding: 0; min-width: 24px; height: 24px; }
table.tl th { background: #eef1f6; font-weight: 600; padding: 2px; }
table.tl .name { text-align: left; padding: 0 8px; min-width: 170px; position: sticky; left: 0; background: var(--card); white-space: nowrap; z-index: 1; }
table.tl th.name { background: #eef1f6; }
table.tl tr.grp td { background: #f9fafc; text-align: left; font-weight: 600; padding: 3px 8px; }
table.tl tr.sum td { background: #fafbfd; color: var(--muted); font-size: 11px; }
table.tl .we { background: var(--weekend); } table.tl .ho { background: var(--holiday); } table.tl .td { box-shadow: inset 0 -3px 0 var(--accent); }
table.tl td.on { background: var(--c); }
table.tl td.on.pending { background: repeating-linear-gradient(135deg, color-mix(in srgb, var(--c) 30%, white) 0 4px, color-mix(in srgb, var(--c) 14%, white) 4px 8px); }

/* Tablice */
table.t { border-collapse: collapse; width: 100%; }
table.t th, table.t td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.t th { font-size: 12px; color: var(--muted); font-weight: 600; }
.balances { display: flex; gap: 12px; flex-wrap: wrap; }
.bal { border: 1px solid var(--line); border-radius: 10px; padding: 12px 16px; min-width: 260px; background: #fff; }
.bal .big { font-size: 28px; font-weight: 700; }
.bal dl { display: grid; grid-template-columns: auto auto; gap: 2px 14px; margin: 8px 0 0; font-size: 13px; }
.bal dt { color: var(--muted); } .bal dd { margin: 0; text-align: right; font-weight: 600; }

/* Odobravanja */
.req { display: grid; grid-template-columns: 1fr auto; gap: 8px 16px; }
.req .meta { color: var(--muted); font-size: 13px; }
.tabs { display: flex; gap: 6px; margin-bottom: 14px; }
.tabs button.active { background: var(--accent); color: #fff; border-color: var(--accent); }

/* Modal i toast */
.overlay { position: fixed; inset: 0; background: rgba(15, 23, 42, .5); display: flex; align-items: flex-start; justify-content: center; padding: 6vh 12px; overflow: auto; z-index: 50; }
.modal { background: #fff; border-radius: 12px; padding: 20px; width: 100%; max-width: 560px; box-shadow: 0 20px 50px rgba(0, 0, 0, .3); }
.modal.wide { max-width: 720px; }
.modal .actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.preview { background: #f7f9fc; border: 1px solid var(--line); border-radius: 8px; padding: 12px; margin-top: 12px; }
.preview .days { font-size: 26px; font-weight: 700; }
.preview ul { margin: 6px 0 0; padding-left: 18px; }
#toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: #111827; color: #fff; padding: 10px 16px; border-radius: 8px; opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 100; }
#toast.show { opacity: 1; } #toast.bad { background: var(--danger); }

@media (max-width: 760px) {
  header.top { flex-wrap: wrap; height: auto; padding: 8px 12px; gap: 8px; }
  header.top nav a { padding: 8px; }
  main { padding: 10px; }
  .day .hol { display: none; }
  .req { grid-template-columns: 1fr; }
}
