[hidden] { display: none !important; }
:root {
  --bg: #f6f7f9;
  --panel: #ffffff;
  --text: #1c2430;
  --muted: #64707d;
  --line: #dde2e8;
  --accent: #2563eb;
  --today: #fff7d6;
  --out: #eef0f3;
  --danger: #b91c1c;
  --ok: #15803d;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12161c;
    --panel: #1b2129;
    --text: #e6eaef;
    --muted: #96a1ad;
    --line: #2d3540;
    --accent: #60a5fa;
    --today: #3a3420;
    --out: #161a20;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
body { margin: 0; font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--text); }
h1 { font-size: 20px; margin: 0; }
h2 { font-size: 18px; margin: 0 0 12px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
h3 { font-size: 14px; margin: 18px 0 8px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.small { font-size: 12px; color: var(--muted); }
code { font-size: 12px; background: var(--out); padding: 1px 4px; border-radius: 4px; }

.btn { display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel); color: var(--text); cursor: pointer; text-decoration: none; font: inherit; }
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.ghost { background: transparent; }
.badge { background: var(--danger); color: #fff; border-radius: 999px; padding: 0 7px; font-size: 12px; }

.top { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding: 14px 16px; background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.top .sub { color: var(--muted); font-size: 13px; }
.top-right { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.me { color: var(--muted); }
.live { font-size: 12px; color: var(--muted); padding: 3px 8px; border-radius: 999px; border: 1px solid var(--line); }
.live.ok { color: var(--ok); border-color: currentColor; }
.live.ok::before { content: "● "; }

.info { padding: 10px 16px 0; max-width: 1400px; margin: 0 auto; }
.info p { margin: 0 0 10px; color: var(--muted); }
.legend { padding: 0 6px; border-radius: 4px; color: var(--text); }
.holiday-sample { font-weight: 700; outline: 2px solid var(--danger); }
.swapped-sample { background: repeating-linear-gradient(45deg, var(--out), var(--out) 4px, transparent 4px, transparent 8px); }
.toolbar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.seg button { border: 0; background: var(--panel); color: var(--text); padding: 6px 12px; cursor: pointer; font: inherit; }
.seg button.active { background: var(--accent); color: #fff; }
.oncall-now { margin-left: auto; }
.people-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-bottom: 10px; }
.chip { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; }
.chip i, .dot { width: 12px; height: 12px; border-radius: 3px; display: inline-block; vertical-align: -1px; margin-right: 4px; }

main#view { padding: 0 16px 40px; max-width: 1400px; margin: 0 auto; }

/* koledar */
.calendar { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.cal-head, .days { display: grid; grid-template-columns: repeat(7, 1fr); }
.cal-head div { padding: 6px 8px; font-weight: 600; font-size: 12px; color: var(--muted); border-bottom: 1px solid var(--line); }
.week { border-bottom: 1px solid var(--line); position: relative; }
.week:last-child { border-bottom: 0; }
.day { min-height: 64px; padding: 4px 6px; border-right: 1px solid var(--line); }
.day:last-child { border-right: 0; }
.day.wkend { background: color-mix(in srgb, var(--out) 50%, transparent); }
.day.out { background: var(--out); color: var(--muted); }
.day.today { background: var(--today); }
.dnum { font-size: 12px; font-weight: 600; }
.lane { position: absolute; left: 0; right: 0; top: 26px; height: 30px; }
.band {
  position: absolute; top: 0; height: 28px; border: 0; border-radius: 6px; padding: 0 8px; cursor: pointer;
  background: var(--c); color: #fff; font: 600 12px/28px system-ui, sans-serif; text-align: left;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; box-shadow: 0 1px 2px rgb(0 0 0 / .15);
}
.band.cont { border-top-left-radius: 0; border-bottom-left-radius: 0; }
.band.more { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.band.done { opacity: .55; }
.band.active { box-shadow: 0 0 0 2px var(--panel), 0 0 0 4px var(--c); }
.band.mine { text-decoration: underline; text-underline-offset: 3px; }
.band.holiday { font-weight: 900; outline: 3px solid var(--danger); outline-offset: -3px; }
.band.swapped { background: repeating-linear-gradient(45deg, var(--c), var(--c) 6px, color-mix(in srgb, var(--c) 60%, #fff) 6px, color-mix(in srgb, var(--c) 60%, #fff) 12px); }
.band:focus-visible { outline: 3px solid var(--accent); }

/* seznam */
.table-wrap { overflow-x: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; }
table { border-collapse: collapse; width: 100%; }
th, td { padding: 6px 8px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
th { font-size: 12px; color: var(--muted); position: sticky; top: 0; background: var(--panel); }
td.num, th.num { text-align: right; }
td.small { white-space: normal; }
table.list tbody tr { cursor: pointer; }
table.list tbody tr:hover { background: var(--out); }
tr.done { color: var(--muted); }
tr.current { background: var(--today); }
tr.holiday td { font-weight: 700; }
tr.holiday td:first-child { border-left: 4px solid var(--danger); }
tr.swapped td:nth-child(7) { background: repeating-linear-gradient(45deg, var(--out), var(--out) 4px, transparent 4px, transparent 8px); }
tr.mine td:nth-child(7) { text-decoration: underline; }

/* dialog */
dialog { border: 1px solid var(--line); border-radius: 12px; padding: 20px; width: min(640px, calc(100vw - 32px)); max-height: calc(100vh - 32px); background: var(--panel); color: var(--text); }
dialog::backdrop { background: rgb(0 0 0 / .4); }
.close { position: absolute; right: 12px; top: 8px; border: 0; background: none; font-size: 24px; cursor: pointer; color: var(--muted); }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; margin: 0; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; }
.holiday-text { font-weight: 700; color: var(--danger); }
.tag { font-size: 12px; font-weight: 500; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--line); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
form label { display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: var(--muted); margin-bottom: 8px; }
input, select { font: inherit; padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); color: var(--text); width: 100%; }
input[type="checkbox"] { width: auto; }
input.narrow { width: 70px; }
.row { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.row label { flex: 1; }
.swap { border: 1px solid var(--line); border-radius: 8px; padding: 10px; margin-bottom: 8px; }
.swap.pending { border-left: 4px solid var(--accent); }
.quote { font-style: italic; }
.admin-box { margin-top: 16px; border-top: 1px solid var(--line); padding-top: 10px; }
.admin-box summary { cursor: pointer; color: var(--muted); }
.history { padding-left: 18px; margin: 0; }
.people td { padding: 4px; }
.api-list li { margin-bottom: 4px; }

.toast { position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 8px; z-index: 100; max-width: calc(100vw - 32px); }
.toast.error { background: var(--danger); color: #fff; }

.login-page { display: grid; place-items: center; min-height: 100vh; }
.login-card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 32px; text-align: center; max-width: calc(100vw - 32px); }
.login-card p { color: var(--muted); }

@media (max-width: 700px) {
  .day { min-height: 56px; padding: 2px 3px; }
  .band { font-size: 10px; padding: 0 3px; }
  .oncall-now { margin-left: 0; }
  .top { position: static; }
  table.list th:nth-child(1), table.list td:nth-child(1),
  table.list th:nth-child(5), table.list td:nth-child(5),
  table.list th:nth-child(6), table.list td:nth-child(6),
  table.list th:nth-child(8), table.list td:nth-child(8) { display: none; }
}

/* skrbništvo, mesečni pregled */
dialog.wide { width: min(1000px, calc(100vw - 32px)); }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; border-bottom: 1px solid var(--line); margin-bottom: 12px; }
.tabs button { border: 0; background: none; color: var(--muted); padding: 8px 12px; cursor: pointer; font: inherit; border-bottom: 2px solid transparent; }
.tabs button.active { color: var(--text); border-bottom-color: var(--accent); font-weight: 600; }
fieldset { border: 1px solid var(--line); border-radius: 8px; margin: 0 0 12px; padding: 10px 12px; }
legend { font-weight: 600; padding: 0 4px; }
.src { color: var(--muted); font-size: 11px; }
.link { border: 0; background: none; color: var(--accent); cursor: pointer; font-size: 11px; padding: 0; text-decoration: underline; }
.scopes { display: flex; flex-direction: column; gap: 4px; margin-bottom: 8px; }
label.check { flex-direction: row; align-items: center; gap: 6px; color: var(--text); font-size: 13px; }
.key-box { border: 1px solid var(--ok); border-radius: 8px; padding: 10px; margin-bottom: 12px; display: flex; flex-direction: column; gap: 8px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
.nowrap { white-space: nowrap; }
.roles-help { padding-left: 18px; }
.error-text { color: var(--danger); }
.month-head { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; flex-wrap: wrap; }
.month-head select { width: auto; min-width: 180px; }
table.report tbody tr.person-row { cursor: pointer; }
table.report tfoot td { font-weight: 700; border-top: 2px solid var(--line); }
table.report tr.detail > td { background: var(--out); padding: 8px; }
table.inner { background: var(--panel); border-radius: 6px; }
table.inner td, table.inner th { font-size: 12px; }
.me .tag { margin-left: 4px; }
