/* Hand-written, no framework. The wireframes in docs/wireframes use the same
   vocabulary, so what was approved there carries over without translation. */
:root {
  --bg: #eef0f3; --panel: #fff; --fg: #1a1d21; --muted: #555e6b;
  --brand: #0b3d5c; --focus: #ffdd00;
  --line: #d8dce2; --head: #f3f5f7; --accent: #1a5fd0;
  --ok-bg: #e8f6ec; --ok-fg: #146c35; --bad-bg: #fde8e8; --bad-fg: #b42318;
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--fg);
  font: 14px/1.5 -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--accent); }
/* Klávesnice: výrazný žlutý rámeček jako na GOV.UK, ať je vždycky vidět kde jsi. */
:focus-visible { outline: 3px solid var(--focus); outline-offset: 0; box-shadow: 0 0 0 5px #0b0c0c; }
main:focus { outline: none; }

/* Záhlaví podle GOV.UK: tmavý pruh se jménem služby a účtem, pod ním
   nabídka, v níž je aktuální stránka podtržená. Na telefonu se nabídka
   schová za tlačítko Menu, místo aby zabrala půl obrazovky. */
.skip { position: absolute; left: -9999px; top: 0; z-index: 100; padding: 10px 14px;
  background: var(--focus); color: #0b0c0c; font-weight: 700; }
.skip:focus { left: 8px; top: 8px; }
.topbar { background: var(--brand); color: #fff; }
.topbar-in, .servicenav-in { max-width: 1100px; margin: 0 auto; padding: 0 20px;
  display: flex; align-items: center; gap: 12px; }
/* The header keeps the same width on every page, wide ones included, so
   nothing jumps when moving between them. */
.topbar-in { min-height: 52px; }
.topbar .brand { display: inline-flex; align-items: center; gap: 8px; font-weight: 700;
  font-size: 20px; letter-spacing: .01em; text-decoration: none; color: #fff; padding: 6px 0; }
.brand-mark { width: 18px; height: 18px; border-radius: 50%; background: #fff;
  box-shadow: inset 0 0 0 5px var(--brand), inset 0 0 0 9px #fff; }
.topbar .spacer { flex: 1; }
.topbar .who { color: #fff; font-size: 14px; text-decoration: underline; text-underline-offset: 3px;
  padding: 12px 4px; }
.topbar form { margin: 0; }
.topbar button.logout { background: transparent; color: #fff; border: 1px solid rgba(255, 255, 255, .7); }
.topbar button.logout:hover { background: rgba(255, 255, 255, .12); border-color: #fff; }
.servicenav { background: var(--panel); border-bottom: 1px solid var(--line); }
.servicenav ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0 22px; }
.servicenav a { display: inline-block; padding: 12px 0 9px; border-bottom: 4px solid transparent;
  color: var(--accent); font-weight: 600; text-decoration: none; }
.servicenav a:hover { text-decoration: underline; text-underline-offset: 3px; }
.servicenav a[aria-current="page"] { color: var(--fg); border-bottom-color: var(--accent); }
.menu-toggle { display: none; }
@media (max-width: 760px) {
  .topbar-in, .servicenav-in { padding: 0 16px; }
  .servicenav-in { display: block; }
  .servicenav.js .menu-toggle { display: inline-flex; align-items: center; gap: 10px; min-height: 44px;
    margin: 2px 0; padding: 0 4px; background: none; border: 0; color: var(--accent);
    font-weight: 700; font-size: 16px; }
  .servicenav.js .menu-toggle::after { content: ""; width: 8px; height: 8px; margin-top: -4px;
    border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg); }
  .servicenav.js.open .menu-toggle::after { transform: rotate(-135deg); margin-top: 4px; }
  .menu-toggle .mt-here { color: var(--fg); font-weight: 600; }
  .menu-toggle .mt-here::before { content: "·"; margin-right: 10px; color: var(--muted); }
  .topbar .who { display: inline-flex; align-items: center; min-height: 44px; padding: 0 8px; }
  .topbar-in { gap: 8px; }
  .servicenav.js ul { display: none; }
  .servicenav.js.open ul { display: block; padding-bottom: 8px; }
  .servicenav li { border-top: 1px solid var(--line); }
  .servicenav a { display: block; padding: 11px 0 11px 12px; border-bottom: 0;
    border-left: 4px solid transparent; }
  .servicenav a[aria-current="page"] { border-left-color: var(--accent); }
}
form.narrow h2 { font-size: 14px; margin: 0 0 12px; }
.topbar form { margin: 0; }

main { max-width: 1100px; margin: 20px auto; padding: 0 20px; }
/* Měsíční přehled je ze své podstaty široký: třicet jedna dnů vedle sebe se do
   sloupce pro běžnou stránku nevejde a buňky by se ořezávaly. */
/* A wide page (the month) grows to its table, centred like every other page:
   at least as wide as a normal page, never wider than the window. */
body.wide main { max-width: 100%; width: fit-content; min-width: min(1100px, 100%); }
h1 { font-size: 20px; margin: 0 0 4px; }
.lead, .muted { color: var(--muted); }
.count { color: var(--muted); font-weight: 400; font-size: 15px; }
.error { color: var(--bad-fg); background: var(--bad-bg); padding: 8px 12px; border-radius: 6px; }

button, .button {
  font: inherit; padding: 6px 14px; border: 1px solid var(--line); background: var(--panel);
  border-radius: 6px; cursor: pointer; text-decoration: none; color: var(--fg);
  display: inline-block;
}
button[type="submit"] { background: var(--accent); color: #fff; border-color: var(--accent); }
button:disabled { opacity: .45; cursor: not-allowed; }
.button:hover, button:hover { border-color: var(--fg); }

table.grid {
  width: 100%; border-collapse: collapse; background: var(--panel);
  border: 1px solid var(--line); border-radius: 8px; overflow: hidden;
}
table.grid th, table.grid td { padding: 7px 12px; border-bottom: 1px solid var(--line); text-align: left; }
table.grid thead th { background: var(--head); font-weight: 600; }
table.grid tbody tr:last-child td { border-bottom: 0; }
table.grid .num { text-align: right; font-variant-numeric: tabular-nums; }

.tag { font-size: 11px; padding: 1px 8px; border-radius: 10px; background: var(--head); }
.tag-active { background: var(--ok-bg); color: var(--ok-fg); }
.tag-inactive { background: var(--head); color: var(--muted); }
.tag-planned { background: #fff9e6; color: #8a6100; }
.tag-fixed { background: #e7edff; color: #1f4bb8; font-weight: 600; }
.notice { background: #fff9e6; border: 1px solid #f0dca0; padding: 10px 14px;
  border-radius: 8px; margin-bottom: 14px; }

dl.facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 20px; max-width: 640px; }
dl.facts dt { color: var(--muted); }
dl.facts dd { margin: 0; }

form.narrow { max-width: 460px; background: var(--panel); padding: 16px;
  border: 1px solid var(--line); border-radius: 8px; }
form.narrow div { margin-bottom: 12px; }
form.narrow label { display: block; font-weight: 600; margin-bottom: 3px; }
form.narrow input, form.narrow select, form.narrow textarea {
  font: inherit; width: 100%; padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px;
}
/* A checkbox is not a text field: stretched to the full width it floats
   away from its own label. */
form.narrow input[type="checkbox"], form.narrow input[type="radio"] {
  width: auto; padding: 0; margin: 0 6px 0 0; vertical-align: -1px; }
form.narrow .helptext { display: block; color: var(--muted); font-size: 12px; margin-top: 3px; }
form.narrow ul.errorlist { margin: 4px 0 0; padding-left: 18px; color: var(--bad-fg); font-size: 13px; }

ul.cards { list-style: none; padding: 0; display: grid; gap: 12px;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
ul.cards a { display: block; padding: 14px; background: var(--panel); text-decoration: none;
  border: 1px solid var(--line); border-radius: 8px; color: var(--fg); }
ul.cards a:hover { border-color: var(--accent); }
ul.cards span { display: block; color: var(--muted); font-size: 13px; margin-top: 3px; }

.split { display: flex; gap: 24px; align-items: flex-start; flex-wrap: wrap; }
.split form.narrow { flex: 1 1 420px; }
dl.facts.aside { flex: 0 1 280px; background: var(--panel); border: 1px solid var(--line);
  border-radius: 8px; padding: 14px; display: block; }
dl.facts.aside dt { font-size: 12px; text-transform: uppercase; letter-spacing: .03em; }
dl.facts.aside dd { margin: 0 0 10px; font-weight: 600; }
dl.facts.aside dd.muted { font-weight: 400; }

button.rmbtn { border: 0; background: transparent; color: var(--muted); font-size: 15px;
  line-height: 1; padding: 0 4px; cursor: pointer; border-radius: 3px; }
button.rmbtn:hover { background: var(--bad-bg); color: var(--bad-fg); }
table.grid form { margin: 0; }

ul.messages { list-style: none; padding: 0; }
ul.messages li { padding: 8px 12px; border-radius: 6px; background: var(--ok-bg); margin-bottom: 10px; }

/* ---- Týdenní rozpis -------------------------------------------------- */
.planhead { display: flex; align-items: flex-start; gap: 16px; flex-wrap: wrap;
  margin-bottom: 14px; }
.planhead > div:first-child { flex: 1; }
.planstatus { display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  font-size: 13px; margin-bottom: 12px; }
.button.approve { background: var(--ok-fg); color: #fff; border-color: var(--ok-fg);
  margin-left: auto; }
.button.approve:hover { background: #15803d; border-color: #15803d; }
.notice.danger { background: #fdecec; border-color: #f3b9b9; color: #8a1c13; }
button.danger { background: var(--bad-fg); color: #fff; border-color: var(--bad-fg); }
button.danger:hover { background: #8a1c13; border-color: #8a1c13; }
.reopenform { margin: 0 0 0 auto; }
.seg { display: flex; }
.seg .button { border-radius: 0; }
.seg .button:first-child { border-radius: 6px 0 0 6px; }
.seg .button:last-child { border-radius: 0 6px 6px 0; border-left: 0; }
.seg .button.on { background: var(--accent); color: #fff; border-color: var(--accent); }

.scroll { overflow-x: auto; }
table.plan { border-collapse: separate; border-spacing: 0; font-size: 12px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 8px;
  white-space: nowrap; width: 100%; }
table.plan th, table.plan td { border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line); padding: 2px 4px; text-align: center; height: 28px; }
table.plan thead th { background: var(--head); font-weight: 600; }
table.plan .rowhead { text-align: left; padding-left: 10px; font-weight: 600; min-width: 70px; }
table.plan .rowhead a { text-decoration: none; color: var(--fg); }
table.plan .rowhead a:hover { text-decoration: underline; }
table.plan .fte { color: var(--muted); font-weight: 400; min-width: 42px; }
table.plan .dnu { min-width: 58px; font-variant-numeric: tabular-nums; background: #fafbfc; }
table.plan td.off { background: #eceef1; color: #b9bec5; }
table.plan th.we, table.plan td.we { background: #e8eaee; color: var(--muted); }
table.plan thead th.we { background: #dfe2e7; }
table.plan select { font: inherit; font-size: 12px; border: 0; background: transparent;
  width: 100%; min-width: 64px; padding: 2px; cursor: pointer; }
table.plan select:hover { background: #e7edff; border-radius: 4px; }
table.plan form { margin: 0; }
.met { color: var(--ok-fg); font-weight: 600; }
.over { color: var(--bad-fg); font-weight: 700; }
.pair { font-variant-numeric: tabular-nums; }
.okk { background: var(--ok-bg); }
.bad { background: var(--bad-bg); color: var(--bad-fg); font-weight: 700; }
.sumrow th, .sumrow td { background: var(--head); font-weight: 700;
  font-variant-numeric: tabular-nums; }

table.bywp td.wpcell { text-align: left; vertical-align: top; white-space: normal;
  min-width: 128px; padding: 4px 6px; }
table.bywp .rowhead .site { display: block; font-weight: 400; color: var(--muted);
  font-size: 10px; }
table.bywp .cnt { display: inline-block; font-variant-numeric: tabular-nums;
  font-size: 11px; font-weight: 700; border-radius: 3px; padding: 0 4px; margin-bottom: 3px; }
table.bywp .cnt form { display: inline-flex; align-items: baseline; gap: 1px; }
table.bywp .cnt input[type=number] { font: inherit; width: 34px; border: 1px solid transparent;
  background: transparent; border-radius: 3px; padding: 0 2px; }
table.bywp .cnt input[type=number]:hover,
table.bywp .cnt input[type=number]:focus { border-color: var(--line); background: #fff; }
table.bywp .names { line-height: 1.4; }
table.bywp .nm { display: inline-block; font-weight: 600; }
table.bywp .nmform { display: inline-flex; align-items: center; gap: 1px;
  margin: 0 5px 2px 0; }
table.bywp button.rm { border: 0; background: transparent; color: var(--muted);
  font-size: 13px; line-height: 1; padding: 0 2px; cursor: pointer; border-radius: 3px; }
table.bywp button.rm:hover { background: var(--bad-bg); color: var(--bad-fg); }
table.bywp .addform select { font-size: 11px; color: var(--muted); min-width: 0; }

.findings-title { font-size: 14px; margin: 20px 0 8px; }
ul.findings { list-style: none; padding: 0; margin: 0; background: var(--panel);
  border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
ul.findings li { padding: 7px 14px; border-bottom: 1px solid var(--line); font-size: 13px; }
ul.findings li:last-child { border-bottom: 0; }
.sev { font-size: 10px; padding: 1px 6px; border-radius: 3px; margin-right: 6px; }
.sev-Závažné { background: #fff4e5; color: #b45309; }
.sev-Významné { background: #fff9e6; color: #8a6100; }
.rule { color: var(--muted); font-size: 11px; margin-right: 4px; }
.tag-draft { background: var(--head); color: var(--muted); }
.tag-approved { background: #e7edff; color: #1f4bb8; }
.tag-archived { background: var(--head); color: var(--muted); }

/* ---- Měsíční přehled -------------------------------------------------- */
/* Pevné rozvržení sloupců. Bez něj si šířky počítá prohlížeč z obsahu, takže
   skrytí pracovišť geometrii přepočítá: při `width:100%` se přebytek rozpustí
   do jména lékaře a úvazku, při `width:auto` se smrští celá tabulka. Takhle
   přepínač mění jen to, co je v buňkách, ne jak tabulka vypadá. */
/* Pevné rozvržení i pevná šířka sloupce dne. Tabulka je pak přesně tak široká,
   kolik potřebuje — na širokém monitoru se neroztáhne přes celé okno (cesta
   očima od jména k prostředku měsíce by byla zbytečně dlouhá) a na užším se
   odroluje v obalu místo toho, aby se ořezávala. */
table.month { border-collapse: separate; border-spacing: 0; font-size: 11px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 8px;
  white-space: nowrap; width: max-content; table-layout: fixed; }
/* 40 px: nejširší buňka v měsíci je značka nepřítomnosti vedle přeškrtnutého
   pracoviště („d MC1“) a ta potřebuje 38 včetně odsazení. Měřeno, ne odhadnuto. */
table.month th:not(.rowhead):not(.fte):not(.q) { width: 40px; }
table.month th, table.month td { overflow: hidden; text-overflow: ellipsis; }
table.month th, table.month td { border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line); text-align: center; padding: 2px 3px; height: 22px; }
table.month thead th { background: var(--head); font-weight: 600; font-size: 10px; }
table.month .rowhead { text-align: left; padding-left: 9px; font-weight: 600;
  width: 78px; }
table.month .rowhead a { text-decoration: none; color: var(--fg); }
table.month .fte { color: var(--muted); font-weight: 400; width: 32px; }
table.month th.we, table.month td.we { background: #e8eaee; color: var(--muted); }
table.month td.mc { min-width: 24px; }
table.month td.off { background: #f7f8f9; }
table.month td.abs { background: #eceef1; }
table.month .ab { font-weight: 700; color: var(--muted); }
table.month .wp { font-weight: 600; }
table.month .wp.struck { color: #5b6270; font-weight: 400; text-decoration: line-through;
  font-size: 10px; }
table.month .ab + .wp { margin-left: 2px; }
table.month .sumrow th, table.month .sumrow td { background: var(--head);
  font-weight: 700; font-variant-numeric: tabular-nums; }


/* ---- Měsíční přehled: interakce ---------------------------------------- */
.monthnav { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
table.month td.mc { position: relative; }
table.month .vsm { position: absolute; left: 2px; bottom: -1px; font-size: 8px;
  line-height: 9px; font-weight: 700; color: #047857; }
table.month td.vs { background: #eafaf1; }
table.month .hl { outline: 2px solid #111827; outline-offset: -2px; }
table.month .dimmed { opacity: .3; }
table.month .sumrow td.lack { background: var(--bad-bg); color: var(--bad-fg); }
table.month .sumrow td.fine { background: var(--ok-bg); color: var(--ok-fg); }
table.month.hide-wp .wp { display: none; }
table.month .rowhead { cursor: default; }

table.month.bywp td.wc { white-space: normal; text-align: left;
  padding: 2px 3px; vertical-align: top; overflow: visible; }
table.month.bywp .nm { display: inline-block; font-weight: 600; margin-right: 3px; }
table.month.bywp .rowhead { width: 120px; }
table.month.bywp .rowhead .wpfull { display: block; font-weight: 400;
  color: var(--muted); font-size: 9px; }

#leg .lbl { color: var(--muted); }
#leg .chip.dim { opacity: .3; }
#leg .chip[data-wp] { cursor: pointer; user-select: none; }
#leg .chip[data-wp]:hover { border-color: var(--fg); }

#tip { position: fixed; z-index: 99; background: #111827; color: #fff; font-size: 11px;
  padding: 5px 8px; border-radius: 5px; pointer-events: none; display: none;
  max-width: 320px; white-space: normal; line-height: 1.4; }
#tip b { color: #93c5fd; }

@media print {
  .noprint, .monthnav, .topbar, #leg, #tip { display: none; }
  body { background: #fff; padding: 0; }
  @page { size: A4 landscape; margin: 8mm; }
  table.month .dimmed { opacity: 1; }
}
table.month.p-V1 td[data-wp="V1"] { background: #dbeafe; }
#leg .chip.on-V1 { background: #dbeafe; }
table.month.p-V2 td[data-wp="V2"] { background: #bfdbfe; }
#leg .chip.on-V2 { background: #bfdbfe; }
table.month.p-VsZ td[data-wp="VsZ"] { background: #fef08a; }
#leg .chip.on-VsZ { background: #fef08a; }
table.month.p-SZ td[data-wp="SZ"] { background: #fecaca; }
#leg .chip.on-SZ { background: #fecaca; }
table.month.p-MC1 td[data-wp="MC1"] { background: #e9d5ff; }
#leg .chip.on-MC1 { background: #e9d5ff; }
table.month.p-Ro td[data-wp="Ro"] { background: #fed7aa; }
#leg .chip.on-Ro { background: #fed7aa; }
table.month.p-Gl td[data-wp="Gl"] { background: #cffafe; }
#leg .chip.on-Gl { background: #cffafe; }
table.month.p-Str td[data-wp="Str"] { background: #fbcfe8; }
#leg .chip.on-Str { background: #fbcfe8; }
table.month.p-Uv td[data-wp="Uv"] { background: #e0e7ff; }
#leg .chip.on-Uv { background: #e0e7ff; }
table.month.p-Odd td[data-wp="Odd"] { background: #f5d0fe; }
#leg .chip.on-Odd { background: #f5d0fe; }
table.month.p-Rezerva td[data-wp="Rezerva"] { background: #f1f5f9; }
#leg .chip.on-Rezerva { background: #f1f5f9; }
table.month.p-VsV td[data-wp="VsV"] { background: #d1fae5; }
#leg .chip.on-VsV { background: #d1fae5; }
table.month.p-SV td[data-wp="SV"] { background: #bbf7d0; }
#leg .chip.on-SV { background: #bbf7d0; }
table.month.p-MC2 td[data-wp="MC2"] { background: #a7f3d0; }
#leg .chip.on-MC2 { background: #a7f3d0; }


/* ---- Služby ------------------------------------------------------------ */
table.month .badge { position: absolute; top: -1px; right: 1px; font-size: 8px;
  font-weight: 700; line-height: 10px; padding: 0 2px; border-radius: 2px; }
table.month .b-o { background: var(--accent); color: #fff; }
table.month .b-x { background: #e0e7ff; color: #1f4bb8; }
table.month .dutyrow td { font-weight: 600; }
table.month.dutymode .dutyrow td[data-duty] { cursor: pointer; }
table.month.dutymode .dutyrow td[data-duty]:hover { outline: 2px solid var(--accent);
  outline-offset: -2px; }
.dutybar { background: #e7edff; border: 1px solid #c3d4f7; border-radius: 8px;
  padding: 8px 14px; margin: 10px 0; font-size: 13px; }
.dutybar form.inline { display: inline; }
.dutybar button.on { background: #1f4bb8; color: #fff; border-color: #1f4bb8; }
.dutybar .badge { display: inline-block; font-size: 10px; font-weight: 700;
  line-height: 12px; padding: 1px 4px; border-radius: 3px; }
.dutybar .b-o { background: var(--accent); color: #fff; }
.dutybar .b-x { background: #e0e7ff; color: #1f4bb8; }
.dutybar .hint { margin-top: 6px; color: var(--muted); font-size: 12px; }
.dutybar .dlog { margin-top: 6px; min-height: 18px; font-weight: 600; }
/* While duties are being entered a click in the grid writes a duty, so the
   cell says so; the picker for hours and absences stays shut (D-74). */
table.month.dutymode[data-duty-edit] #mtb td.mc { cursor: pointer; }
table.month.dutymode[data-duty-edit] #mtb td.mc:hover { outline: 2px solid var(--accent);
  outline-offset: -2px; }
.dutybar button { margin-left: 8px; }
#qsum { margin-top: 6px; }
.dutybar .qmsg { margin-top: 6px; color: var(--bad-fg); }

/* Quota columns: assigned / quota, working days and weekends. They exist only
   while duties are being entered; the rest of the time the month has no use
   for them and they would cost the width of three days. */
table.month .q { display: none; width: 68px; font-variant-numeric: tabular-nums; }
table.month.dutymode .q { display: table-cell; }
table.month .q.qx { border-right: 2px solid #c9cdd4; }
table.month .q i { font-style: normal; color: #c0c5cc; }
.met { color: #15803d; }
.over { color: #b42318; font-weight: 700; }
table.month .q .none, table.month .q .none + .qq { color: #c0c5cc; }
table.month .qi { display: none; width: 30px; font: inherit; padding: 0 2px;
  border: 1px solid #9aa3af; border-radius: 3px; text-align: center;
  appearance: textfield; -moz-appearance: textfield; }
table.month .qi::-webkit-inner-spin-button,
table.month .qi::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
table.month .qi.bad { border-color: var(--bad-fg); background: var(--bad-bg); }
table.month.qedit .q { width: 112px; }
table.month.qedit .qi { display: inline-block; }
table.month.qedit .qq { display: none; }
#dutypick { position: fixed; z-index: 60; background: #fff; border: 1px solid var(--line);
  border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.18); padding: 6px;
  display: none; max-width: 270px; max-height: 300px; overflow-y: auto; }
#dutypick b { display: block; font-size: 11px; color: var(--muted); padding: 2px 6px; }
#dutypick button { font: inherit; font-size: 12px; margin: 2px; padding: 3px 7px;
  border: 1px solid var(--line); background: #fff; border-radius: 5px; cursor: pointer; }
#dutypick button.over { border-color: #e8c08a; background: #fff8ee; }
#dutypick .q { color: var(--muted); font-size: 10px; margin-left: 4px; }


/* ---- Vyrovnávací volno ------------------------------------------------- */
/* Bottom right: the left corner belongs to the Vsetín mark, the top right to
   the duty badge. A bare number, as in the department's spreadsheet - with the
   unit it ran into the last letter of a three-letter workplace, and the row is
   too low to clear the label vertically. */
table.month .cto { display: none; position: absolute; right: 1px; bottom: 1px;
  font-size: 9px; line-height: 1; font-weight: 700; color: #0f766e; }
/* The button shows the hours and does nothing else: nothing in the cell is
   dimmed, and entering does not depend on it (D-71). */
table.month.show-cto .cto { display: inline; }
table.month[data-cto-edit] #mtb td.mc,
table.month[data-abs-edit] #mtb td.mc { cursor: pointer; }
/* The cell being edited, and for a moment the one just written. With the hours
   hidden a write would otherwise change nothing on the screen. */
table.month #mtb td.mc.cell-open,
table.month #mtb td.mc.cell-saved { outline: 2px solid #0f766e; outline-offset: -2px; }
table.month #mtb td.mc.cell-saved .cto { display: inline; }

/* ---- Cell picker: compensatory hours and the absence of one day --------- */
#cellpick, #wppick { position: fixed; z-index: 60; background: #fff; border: 1px solid var(--line);
  border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.18); padding: 6px 8px 8px;
  display: none; max-width: 440px; }
#cellpick .head { display: block; font-size: 12px; padding: 2px 2px 4px; }
#cellpick .row + .row { margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--line); }
#cellpick .cap { display: block; font-size: 10px; text-transform: uppercase;
  letter-spacing: .04em; color: var(--muted); padding: 0 2px 2px; }
#cellpick button { font: inherit; font-size: 12px; margin: 2px; padding: 3px 9px;
  border: 1px solid var(--line); background: #fff; border-radius: 5px; cursor: pointer; }
#cellpick button.on { background: #0f766e; color: #fff; border-color: #0f766e; }
#cellpick button.clear { color: var(--bad-fg); }
#cellpick button:disabled { opacity: .4; cursor: default; }
#cellpick .note { display: block; font-size: 11px; color: var(--muted); padding: 3px 2px 0; }
#cellpick .err { margin-top: 6px; font-size: 12px; color: var(--bad-fg); padding: 0 2px; }
#cellpick .places .grp { display: block; font-size: 10px; color: var(--muted); padding: 3px 2px 0; }
table.month thead th a { color: inherit; text-decoration: none; display: block; }
table.month thead th a:hover { text-decoration: underline; }


/* ---- Denní přehled ------------------------------------------------------ */
.sev-Kritické { background: #fde8e8; color: #b42318; }
.sev-Preference { background: #eef0f3; color: #4b5563; }
.daybar { display: flex; gap: 4px; flex-wrap: wrap; margin: 4px 0 14px; }
.daybtn { display: flex; flex-direction: column; align-items: center; min-width: 42px;
  padding: 3px 6px; border: 1px solid var(--line); background: var(--panel);
  border-radius: 6px; line-height: 1.15; text-decoration: none; color: var(--fg); }
.daybtn:hover { border-color: var(--fg); }
.daybtn.on { background: var(--accent); color: #fff; border-color: var(--accent); }
.daybtn .dw { font-size: 10px; color: var(--muted); }
.daybtn.on .dw { color: #fff; }
.daybtn .dn { font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }

.dash { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.dcards { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; }
.dcard { border: 1px solid var(--line); border-radius: 8px; padding: 12px; background: var(--panel); }
.dcard.ok { background: var(--ok-bg); }
.dcard.bad { background: var(--bad-bg); }
.dcard.todo { background: var(--head); border-style: dashed; }
.dcard .k { font-size: 12px; color: var(--muted); }
.dcard .v { font-size: 30px; font-weight: 700; line-height: 1.1; }
.dcard .s { font-size: 11px; color: var(--muted); }
.dcard .s b { color: var(--fg); }
.dpanel { border: 1px solid var(--line); border-radius: 8px; overflow: hidden;
  background: var(--panel); align-self: start; }
.dpanel.full { grid-column: 1 / -1; }
.dpanel h2 { font-size: 14px; margin: 0; padding: 9px 12px; background: var(--head);
  border-bottom: 1px solid var(--line); }
.dpanel .drow + h2 { border-top: 0; }
.dpanel .cap { float: right; font-weight: 400; font-size: 11px; color: var(--muted); }
.drow { display: flex; align-items: center; gap: 10px; padding: 8px 12px; min-height: 42px;
  border-bottom: 1px solid var(--line); }
.drow.miss { background: var(--bad-bg); }
.drow.idle { color: var(--muted); background: #fafbfc; }
.drow.wrapr { flex-wrap: wrap; gap: 6px 16px; }
.drow .wpn { width: 230px; font-weight: 600; }
.drow .wpn .full { display: block; font-weight: 400; font-size: 12px; color: var(--muted); }
.drow .nc { font-size: 10px; border-radius: 3px; padding: 0 5px; margin-left: 6px;
  vertical-align: 1px; background: #111827; color: #fff; font-weight: 600; }
.drow .docs { flex: 1; }
.drow .cnt { color: var(--muted); font-variant-numeric: tabular-nums; font-weight: 600; }
.dash .pill { display: inline-block; border: 1px solid rgba(0, 0, 0, .18); background: #fff;
  border-radius: 4px; padding: 1px 8px; margin: 1px; font-weight: 600; color: var(--fg); }
.dash .pill small { font-weight: 400; color: var(--muted); margin-left: 2px; }
.dash .pill.offc { border-style: dashed; color: #b45309; }
.dash .pill.duty { border-color: var(--accent); color: var(--accent); }
.dash .pill.duty.none { border-style: dashed; color: var(--bad-fg); border-color: var(--bad-fg); }
.dash .empty { color: var(--bad-fg); font-weight: 600; margin-left: 6px; }
.dash .hint { color: var(--muted); font-size: 12px; }
.dash .hours { font-weight: 700; color: #0f766e; }
.dash .absit { display: inline-flex; align-items: center; gap: 5px; }
.dash .absit small { color: var(--muted); }
.dwarn { padding: 9px 12px; border-bottom: 1px solid var(--line); display: flex; gap: 10px;
  align-items: baseline; }
.dwarn .rule { margin-left: auto; }
.dpanel > :last-child { border-bottom: 0; }
@media (max-width: 1100px) {
  .dash { grid-template-columns: 1fr; }
  .dcards { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 600px) {
  .dcards { grid-template-columns: 1fr 1fr; gap: 8px; }
  .dcard .v { font-size: 24px; }
  .drow .wpn { width: 104px; }
  .drow .wpn .full { display: none; }
  .drow .nc { display: block; width: max-content; margin: 2px 0 0; }
}
@media print {
  .drow.idle { display: none; }
  .dpanel, .dcard { break-inside: avoid; }
}

/* Denní přehled: přesuny a služby */
.dayhint { margin-bottom: 10px; }
.daymsg { margin: 0 0 10px; padding: 7px 12px; border-radius: 6px; font-weight: 600;
  background: #e8f6f3; border: 1px solid #a7d8cf; }
.daymsg.bad { background: var(--bad-bg); border-color: #f3b9b9; color: var(--bad-fg); }
form.inline { display: inline; }
button.danger { color: var(--bad-fg); border-color: #f3b9b9; background: var(--panel); }
.dash[data-move] .pill[draggable] { cursor: grab; user-select: none; }
.dash[data-move] .pill[draggable]:active { cursor: grabbing; }
.dash[data-duty-edit] .pill.duty { cursor: pointer; }
.dash .over { outline: 2px dashed var(--accent); outline-offset: -3px; background: #eef5ff !important; }
.dash .zone { min-height: 42px; }
.dash .btn { font-size: 12px; padding: 3px 9px; border-radius: 5px; }
#daymenu { position: fixed; z-index: 50; background: #fff; border: 1px solid var(--line);
  border-radius: 8px; box-shadow: 0 8px 24px rgba(0, 0, 0, .18); padding: 4px;
  max-height: 340px; overflow: auto; min-width: 210px; font-size: 13px; }
#daymenu div { padding: 5px 10px; border-radius: 5px; cursor: pointer; display: flex; gap: 8px;
  justify-content: space-between; }
#daymenu div:hover { background: #eef5ff; }
#daymenu div.hd { font-size: 11px; color: var(--muted); cursor: default; padding: 7px 10px 2px; }
#daymenu div.hd:hover { background: none; }
#daymenu div.dis { color: #aeb4bb; cursor: default; }
#daymenu div.dis:hover { background: none; }
#daymenu div.cur { font-weight: 700; }
#daymenu small { color: var(--muted); }
#daymenu b.q { font-weight: 600; color: var(--fg); margin-left: 4px; }
#daymenu b.q.full { color: var(--muted); font-weight: 400; }
#daymenu b.q.over { color: var(--bad-fg); }
@media (pointer: coarse) {
  #daymenu div { padding: 10px 12px; }
  .dash .pill { padding: 5px 10px; margin: 2px; }
}
@media print { .dash .btn, #daymenu { display: none; } }

/* Svátek: jako víkend, a v záhlaví ještě poznat na první pohled */
table.month thead th.hol { color: #92400e; }
.holname { color: #b45309; font-weight: 600; }

/* Poznámky ke dnům a k měsíci */
.notes { padding: 9px 14px; border: 1px solid #f0dca0; border-radius: 8px;
  background: #fffbeb; margin: 0 0 12px; }
.notes.empty { background: var(--panel); border-color: var(--line); }
.notes ul { list-style: none; margin: 4px 0 0; padding: 0; }
.notes li { padding: 2px 0; }
.notes .when { font-weight: 600; margin-right: 6px; font-variant-numeric: tabular-nums; }
.notes .hint { color: var(--muted); font-size: 12px; }
.noteedit { display: inline-block; margin-left: 8px; vertical-align: top; }
.noteedit.add { display: block; margin: 6px 0 0; }
.noteedit summary { cursor: pointer; color: var(--accent); font-size: 12px; }
.noteedit[open] { display: block; margin: 4px 0 6px; }
.noteedit form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 6px; }
.noteedit input[type="text"] { flex: 1; min-width: 240px; max-width: 640px; font: inherit;
  padding: 5px 8px; border: 1px solid var(--line); border-radius: 6px; }
.noteedit input[type="date"] { font: inherit; padding: 4px 6px; border: 1px solid var(--line);
  border-radius: 6px; }
.noteedit label { font-size: 12px; color: var(--muted); }
.noteedit .hint { flex-basis: 100%; }
.daybtn { position: relative; }
.daybtn .dot, table.month thead th.noted a::after { content: ""; position: absolute; top: 3px;
  right: 4px; width: 5px; height: 5px; border-radius: 50%; background: #d97706; }
table.month thead th.noted { position: relative; }
table.month thead th.noted a::after { top: 2px; right: 2px; }

/* Objednaní pacienti */
.notice.ok { background: var(--ok-bg); border-color: #b7dfc2; color: var(--ok-fg); }
.impinfo { font-size: 11px; color: var(--muted); padding: 5px 12px 7px;
  border-bottom: 1px solid var(--line); }
.drow .ptswrap { width: 60px; text-align: right; }
.drow .pts { width: 54px; font: inherit; text-align: right; padding: 2px 5px;
  border: 1px solid var(--line); border-radius: 4px; background: #fff; }
.drow .pts::placeholder { color: #b9bec5; }
.drow .ptsv { font-variant-numeric: tabular-nums; color: var(--muted); }
.drow .cnt { min-width: 30px; text-align: right; }
@media print { .drow .pts { border: 0; width: 36px; } }

/* Měsíc, podle lékařů: značka shody v pozadí buňky, jen když je zapnutá */
table.month.show-match td.mc[data-match]::before { position: absolute; left: 1px; top: -2px;
  font-size: 9px; font-weight: 700; }
table.month.show-match td.mc[data-match="ok"]::before { content: "✓"; color: #15803d; }
table.month.show-match td.mc[data-match="idle"]::before { content: "✗"; color: #c2410c; }
table.month.show-match td.mc[data-match="idle"] { background: #ffedd5; }
table.month .matchrow { display: none; }
table.month.show-match .matchrow { display: table-row; }

/* Měsíc, podle pracovišť: počet objednaných a tři stavy barvou buňky */
table.month.bywp .pac { float: right; font-size: 9px; font-weight: 700; color: var(--muted);
  font-variant-numeric: tabular-nums; margin-left: 3px; }
table.month.bywp td.s-ok { background: #ecfdf3; }
table.month.bywp td.s-nolek { background: var(--bad-bg); }
table.month.bywp td.s-nolek .pac { color: var(--bad-fg); }
table.month.bywp td.s-nopac { background: #ffedd5; }

/* Zrušené pracoviště a tlačítko k němu */
.drow.cancelled .wpn { text-decoration: line-through; color: var(--muted); }
.drow .tagx { font-size: 11px; font-weight: 700; color: #92400e; background: #fef3c7;
  border-radius: 3px; padding: 1px 6px; }
.drow .wpact { width: 58px; text-align: right; }
.drow .wpact .btn { color: var(--muted); }

/* Pravidelná dostupnost: tečka za pravidelný den volna, a varování, když na
   takový den přece jen připadlo pracoviště (FR-DOC-11, R-001) */
table.month td.mc .dot { font-weight: 700; color: var(--muted); }
table.month td.mc.unav { background: #f4f5f7; }
table.month td.mc.outside, table.plan td.cell.outside { box-shadow: inset 0 0 0 2px #e8a3a3; }
table.plan td.cell.unav { background: #f4f5f7; }
form.week table { width: auto; margin-bottom: 10px; }
form.week td, form.week th { padding: 4px 12px 4px 0; text-align: left; }
form.week tr.we td:first-child { color: var(--muted); }
form.week input[type="time"] { font: inherit; padding: 2px 4px; }

/* Výběr lékařů v buňce měsíce podle pracovišť: stejný vzhled jako nabídka
   v buňce podle lékařů */
#wppick .head { display: block; font-size: 12px; padding: 2px 2px 4px; }
#wppick .row + .row { margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--line); }
#wppick .cap { display: block; font-size: 10px; text-transform: uppercase;
  letter-spacing: .04em; color: var(--muted); padding: 0 2px 2px; }
#wppick .grp { display: block; font-size: 10px; color: var(--muted); padding: 3px 2px 0; }
#wppick button { font: inherit; font-size: 12px; margin: 2px; padding: 3px 9px;
  border: 1px solid var(--line); background: #fff; border-radius: 5px; cursor: pointer; }
#wppick button small { color: var(--muted); }
#wppick button.on { background: #0f766e; color: #fff; border-color: #0f766e; }
#wppick .note { font-size: 11px; color: var(--muted); padding: 0 2px; }
#wppick .err { margin-top: 6px; font-size: 12px; color: var(--bad-fg); padding: 0 2px; }
table.month.bywp[data-place-edit] td.wc { cursor: pointer; }
table.month.bywp td.wc.cell-open, table.month.bywp td.wc.cell-saved {
  outline: 2px solid #0f766e; outline-offset: -2px; }

/* ---- Tisk měsíčního přehledu (FR-VIEW-09) -------------------------------
   Celý měsíc na jednu stránku A4 na šířku. Na obrazovce je den široký 40 px a
   tabulka 1350 px; na stránku se vejde zhruba 1060 px, takže se v tisku zúží
   sloupce dnů, zmenší písmo a sníží řádky - místo aby se konec měsíce uřízl
   spolu s posuvníkem, jak to dělal prohlížeč do 14. 10. 2026. Barvy buněk se
   tisknou, protože nesou význam (FR-VIEW-16). */
/* Měsíc na úzké obrazovce: řádek s daty drží nahoře a sloupec se jmény
   vlevo, ať se roluje kterýmkoli směrem. Na telefonu proto tabulka roluje
   ve vlastním okně - přilepit záhlaví k celé stránce by nešlo, obal kvůli
   vodorovnému rolování svisle nikam neodjíždí. */
table.month thead th { position: sticky; top: 0; z-index: 2; }
table.month thead tr + tr th { top: 23px; }
table.month :where(th.rowhead) { position: sticky; left: 0; z-index: 1;
  background: var(--panel); box-shadow: 1px 0 0 var(--line); }
table.month thead th.rowhead { z-index: 3; }
@media (max-width: 1024px) {
  .monthwrap { overflow: auto; max-height: calc(100vh - 90px);
    max-height: calc(100dvh - 90px); overscroll-behavior: contain;
    border-radius: 8px; }
  table.month .rowhead { width: 52px; padding-left: 5px; }
}

.printhead { display: none; }
@media print {
  .monthwrap { max-height: none !important; }
  table.month thead th, table.month th.rowhead { position: static !important; }
  .printhead { display: block; font-size: 10px; color: #444; margin-bottom: 4px; }
  .scroll { overflow: visible !important; }
  .dutybar, .ctobar, #cellpick, #wppick, .notice, .noteedit { display: none !important; }
  .planhead { margin-bottom: 4px; }
  .planhead h1 { font-size: 16px; margin: 0; }
  .planhead .lead { display: none; }
  .notes { padding: 3px 8px; margin-bottom: 6px; font-size: 10px; }
  table.month { font-size: 8px; border-radius: 0; }
  table.month th, table.month td { height: 15px; padding: 0 1px; }
  table.month th:not(.rowhead):not(.fte):not(.q) { width: 28px; }
  table.month .rowhead { width: 54px; padding-left: 4px; }
  table.month .fte { width: 22px; }
  table.month .q, table.month .dutyrow td[data-duty] { cursor: auto; }
  table.month .q { display: none !important; }
  table.month thead th { font-size: 8px; }
  table.month .wp.struck { font-size: 7px; }
  table.month .badge, table.month .vsm, table.month .cto { font-size: 6px; line-height: 7px; }
  table.month.bywp .rowhead { width: 70px; }
  table.month.bywp .rowhead .wpfull { display: none; }
  table.month.bywp td.wc { padding: 0 1px; }
  table.month td, table.month th, .notes {
    -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* Žádosti o nepřítomnost */
.badge-count { display: inline-block; min-width: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--bad-fg); color: #fff; font-size: 11px; font-weight: 700; text-align: center;
  text-decoration: none; }
table.month td.mc.req { box-shadow: inset 0 0 0 2px #dc2626; background: #fee2e2 !important; }
.decide { display: flex; gap: 10px; margin: 12px 0; }
.decide button.approve { background: var(--accent); color: #fff; border-color: var(--accent); }
.tag.rq-pending { background: #fef3c7; color: #92400e; }
.tag.rq-approved { background: var(--ok-bg); color: var(--ok-fg); }
.tag.rq-rejected, .tag.rq-cancelled { background: var(--bad-bg); color: var(--bad-fg); }
.tag.rq-withdrawn { background: var(--head); color: var(--muted); }

/* Heat mapa nepřítomností (FR-ABS-14) */
.split { display: flex; gap: 20px; align-items: flex-start; flex-wrap: wrap; margin-bottom: 20px; }
.split > form.narrow { flex: 0 1 380px; }
.mine { max-width: 760px; }
.small { font-size: 12px; }
.heat { flex: 1 1 420px; background: var(--panel); border: 1px solid var(--line);
  border-radius: 8px; padding: 12px 14px; margin-bottom: 16px; }
.heat-nav { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.heat-nav button { padding: 2px 10px; }
.heat-months { display: flex; flex-wrap: wrap; gap: 14px 18px; }
table.heatcal { border-collapse: separate; border-spacing: 2px; font-size: 12px; }
table.heatcal caption { text-align: left; font-weight: 600; padding: 0 2px 4px; }
table.heatcal th { color: var(--muted); font-weight: 400; font-size: 11px; width: 26px; }
table.heatcal td { width: 26px; height: 22px; text-align: center; border-radius: 4px; }
table.heatcal td.hd { cursor: pointer; }
table.heatcal td.past { cursor: default; opacity: .45; }
.lv0 { background: #e8f6ec; }
.lv1 { background: #fcd9a0; }
.lv2 { background: #f6a5a5; }
table.heatcal td.off { background: transparent; color: var(--muted); }
table.heatcal td.own-absence { box-shadow: inset 0 0 0 2px var(--accent); }
table.heatcal td.own-request { box-shadow: inset 0 0 0 2px var(--accent); border: 0; outline: 1px dashed var(--accent); outline-offset: -4px; }
table.heatcal td.sel { background: var(--accent); color: #fff; }
.heat-legend { margin-top: 8px; font-size: 12px; display: flex; flex-wrap: wrap; gap: 4px 6px; align-items: center; }
.heat-legend .sw { display: inline-block; width: 14px; height: 12px; border-radius: 3px; margin-left: 6px; }
.heat-legend .sw.own-absence { box-shadow: inset 0 0 0 2px var(--accent); }
.heat-legend .sw.own-request { outline: 1px dashed var(--accent); outline-offset: -3px; }

/* Audit */
form.filters { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: flex-end; margin: 12px 0 16px; }
form.filters label { display: flex; flex-direction: column; font-size: 12px; color: var(--muted); gap: 2px; }
form.filters input, form.filters select { font: inherit; font-size: 14px; padding: 5px 7px;
  border: 1px solid var(--line); border-radius: 6px; color: var(--fg); }
table.audit td { font-size: 13px; vertical-align: top; }
table.audit td.old { color: var(--muted); }
.nowrap { white-space: nowrap; }
.pager { display: flex; gap: 14px; align-items: center; }

/* Můj program (FR-ME) */
.me-head { display: flex; align-items: center; gap: 12px; }
ul.notices { list-style: none; padding: 0; margin: 0 0 18px; max-width: 760px; }
ul.notices li { display: flex; gap: 10px; align-items: baseline; padding: 6px 10px;
  border: 1px solid var(--line); border-radius: 6px; margin-bottom: 4px; background: var(--panel); }
ul.notices li.read { color: var(--muted); background: transparent; }
ul.notices li .when { color: var(--muted); font-size: 12px; white-space: nowrap; }
ul.notices li form { margin-left: auto; }
.cal-head, .cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px;
  max-width: 980px; }
.cal-head { font-size: 12px; color: var(--muted); margin-bottom: 4px; padding: 0 6px; }
.cal { margin-bottom: 6px; }
.tile { display: flex; flex-direction: column; gap: 2px; min-height: 92px; padding: 6px 8px;
  border: 1px solid var(--line); border-radius: 8px; background: var(--panel); color: var(--fg);
  text-decoration: none; overflow: hidden; position: relative; }
.tile:hover { border-color: var(--accent); }
.tile .t-top { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600;
  color: var(--muted); }
.tile .t-today { color: var(--accent); font-weight: 700; }
.tile .t-dot { width: 8px; height: 8px; border-radius: 50%; background: #d97706; margin-left: auto; }
.tile .t-main { font-size: 16px; font-weight: 700; line-height: 1.2; }
.tile .t-sub { font-size: 12px; line-height: 1.3; color: var(--muted); }
.tile .t-sub .badge { transform: scale(.85); }
.tile .t-sem { color: #6d28d9; font-weight: 700; }
.tile .t-hol { color: var(--muted); font-weight: 400; font-size: 13px; }
.tile.today { box-shadow: 0 0 0 2px var(--accent); }
.tile.off { background: var(--head); }
.tile.past { opacity: .5; }
.tile.vs { background: #e8f0ff; border-color: #b9cdf5; }
.tile.away { background: #e0f2fe; border-color: #9fd3f2; }
.tile.away .t-main { color: #0c4a6e; }
.tile.pending { border-style: dashed; border-color: #d97706; }
.tile.changed { border-color: #d97706; }
.tile.duty-o, .tile.duty-x { border-left: 4px solid #7c3aed; }
.tile .struck { text-decoration: line-through; }
.tile .sh { display: none; }
.cal-key { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; }
.cal-key .k { display: inline-block; width: 14px; height: 12px; border-radius: 3px;
  border: 1px solid var(--line); margin-left: 6px; }
.cal-key .k.vs { background: #e8f0ff; border-color: #b9cdf5; }
.cal-key .k.away { background: #e0f2fe; border-color: #9fd3f2; }
.cal-key .k.pending { border: 1px dashed #d97706; }
.cal-key .k.changed { border-color: #d97706; }
.tag.vs { background: #e0ecff; color: #1d4ed8; }
ul.changes { max-width: 760px; padding-left: 18px; }
ul.changes li { margin-bottom: 4px; }
@media (max-width: 600px) {
  /* On a phone the week still reads across; the tiles just get small. */
  .cal-head, .cal { gap: 3px; }
  .tile { min-height: 64px; padding: 3px 4px; border-radius: 6px; }
  .tile .t-main { font-size: 12px; }
  .tile .t-sub { font-size: 10px; }
  .tile .t-top { font-size: 10px; }
  .tile .t-today { display: none; }
  .tile .lg { display: none; }
  .tile .sh { display: inline; }
  .tile .t-sub { overflow-wrap: anywhere; }
}


/* Semináře */
table.seminars { max-width: 1200px; }
table.seminars td.note { font-size: 13px; }
table.seminars tr.past td { color: var(--muted); }
table.seminars tr.cancelled td { background: var(--head); }
table.seminars tr.mine td { background: #eef5ff; }
table.seminars form.topic { display: flex; gap: 6px; }
table.seminars form.topic input, table.seminars form.topic textarea { flex: 1; min-width: 160px;
  font: inherit; padding: 4px 6px; border: 1px solid var(--line); border-radius: 6px; resize: vertical; }
table.seminars select { font: inherit; padding: 3px 4px; border: 1px solid var(--line); border-radius: 6px; }
table.seminars td.actions form { margin-right: 4px; }
table.seminars button.approve { background: var(--accent); color: #fff; border-color: var(--accent); }
.tag.st-proposed { background: #fef3c7; color: #92400e; }
.tag.st-approved { background: var(--ok-bg); color: var(--ok-fg); }
.tag.st-rejected { background: var(--bad-bg); color: var(--bad-fg); }
.tag.st-missing { background: #fef3c7; color: #92400e; }

/* Výběr služeb lékaři (FR-DUTY-22) */
.roundbar { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; }
table.month th.rowhead.turn-done { background: #c9ecd3; }
table.month th.rowhead.turn-short { background: #f8c9c9; }
table.month th.rowhead.turn-now { box-shadow: inset 0 0 0 2px var(--accent); background: #e0ecff; }
.turnkey { font-size: 12px; color: var(--muted); }
.turnkey span { padding: 1px 6px; border-radius: 4px; }
.turnkey .turn-done { background: #c9ecd3; }
.turnkey .turn-short { background: #f8c9c9; }
.turnkey .turn-now { background: #e0ecff; box-shadow: inset 0 0 0 1px var(--accent); }
button.attn { background: var(--accent); color: #fff; border-color: var(--accent); }

/* Výběr služeb v Mém programu (D-102) */
.board { max-width: 980px; background: var(--panel); border: 1px solid var(--line);
  border-radius: 10px; padding: 12px 14px; margin: 14px 0 18px; }
.board.mine { border: 2px solid #7c3aed; box-shadow: 0 2px 10px rgba(124, 58, 237, .12); }
.board-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 14px; }
.board-head h2 { margin: 0; }
.board-clock { color: var(--muted); font-size: 13px; }
.quota-bars { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 10px 0; font-size: 13px; }
.qb { display: flex; align-items: center; gap: 6px; }
.qb .pips { display: inline-flex; gap: 3px; }
.qb .pips i { width: 10px; height: 10px; border-radius: 50%; border: 1.5px solid #7c3aed; }
.qb .pips i.on { background: #7c3aed; }
.qb.full b { color: var(--ok-fg); }
.duty-cal .dtile { border: 1px solid var(--line); border-radius: 8px; padding: 4px 5px;
  display: flex; flex-direction: column; gap: 3px; min-height: 74px; background: var(--panel); }
.duty-cal .dtile.off { background: var(--head); }
.duty-cal .dtile.past { opacity: .45; }
.duty-cal .t-top { display: flex; justify-content: space-between; font-size: 12px;
  font-weight: 600; color: var(--muted); }
.duty-cal .t-away { background: #e0f2fe; color: #0c4a6e; border-radius: 4px; padding: 0 4px; font-weight: 600; }
.chip { display: inline-flex; align-items: center; gap: 4px; font: inherit; font-size: 12px;
  padding: 2px 6px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel);
  color: var(--fg); cursor: pointer; text-align: left; }
.chip .ck { display: inline-block; width: 14px; height: 14px; line-height: 14px; border-radius: 50%;
  text-align: center; font-size: 10px; font-weight: 700; color: #fff; background: #94a3b8; }
.chip.k-on_call .ck { background: #7c3aed; }
.chip.k-phone_standby .ck { background: #d97706; }
.chip.free { border-style: dashed; border-color: #7c3aed; color: #5b21b6; }
.chip.free:hover { background: #f3e8ff; }
.chip.mine { background: #7c3aed; border-color: #7c3aed; color: #fff; font-weight: 700; }
.chip.mine.k-phone_standby { background: #d97706; border-color: #d97706; }
.chip.taken { color: var(--muted); background: var(--head); cursor: default; }
.chip.blocked { color: var(--muted); border-style: dotted; cursor: not-allowed; background: var(--head); }
.chip:disabled { cursor: default; }
.chip.mini { font-size: 11px; padding: 0 5px; cursor: default; }
.board-foot { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; margin-top: 10px; }
.board-msg { font-size: 13px; color: #5b21b6; flex: 1 1 200px; }
@media (max-width: 600px) {
  .board { padding: 8px; }
  .duty-cal .dtile { min-height: 58px; padding: 2px; }
  .chip { font-size: 10px; padding: 1px 3px; gap: 2px; }
  .chip .ck { width: 12px; height: 12px; line-height: 12px; }
  .chip .cl { display: none; }  /* a dashed chip says "free" on its own */
  .chip { justify-content: center; }
}

/* ---- Telefon: základ (GOV.UK: 16 px písmo, dotykové cíle 44 px) ---------- */
body { font-size: 15px; }
@media (max-width: 760px) {
  body { font-size: 16px; }
  main { padding: 0 16px; margin-top: 16px; }
  h1 { font-size: 24px; line-height: 1.25; }
  h2 { font-size: 19px; }
  button, .button, input:not([type=checkbox]):not([type=radio]):not([type=hidden]), select, textarea {
    min-height: 44px; font-size: 16px; }
  button, .button { padding: 8px 14px; display: inline-flex; align-items: center;
    justify-content: center; gap: 6px; }
  input[type=checkbox], input[type=radio] { width: 24px; height: 24px; }
  button.rmbtn { min-width: 44px; }
}

/* ---- Seznamy na telefonu jako karty (GOV.UK summary list) ------------------
   První buňka řádku je nadpis karty, další jsou dvojice popisek – hodnota.
   Prázdné buňky se nezobrazují; buňka bez názvu sloupce (akce) jde na konec. */
@media (max-width: 760px) {
  table.grid.stack { border: 0; background: transparent; display: block; overflow: visible; }
  table.grid.stack thead { display: none; }
  table.grid.stack tbody { display: grid; gap: 10px; }
  table.grid.stack tr { display: grid; grid-template-columns: minmax(0, 1fr); background: var(--panel);
    border: 1px solid var(--line); border-radius: 8px; padding: 10px 14px; }
  table.grid.stack td { display: grid; grid-template-columns: 7.5em minmax(0, 1fr); gap: 2px 12px;
    padding: 6px 0; border-bottom: 1px solid var(--head); text-align: left; min-width: 0;
    overflow-wrap: anywhere; white-space: normal; }
  table.grid.stack td::before { content: attr(data-label); color: var(--muted); font-size: 14px;
    font-weight: 600; }
  table.grid.stack td:not([data-label])::before { content: none; }
  table.grid.stack td:not([data-label]) { display: block; }
  table.grid.stack td:first-child { display: block; font-size: 18px; padding-top: 0; }
  table.grid.stack td:first-child::before { content: none; }
  table.grid.stack td:last-child { border-bottom: 0; }
  table.grid.stack td:empty { display: none; }
  table.grid.stack td[colspan] { display: block; }
  table.grid.stack td[colspan]::before { content: none; }
}
table.grid th.num { text-align: right; }
@media (max-width: 760px) {
  table.grid.stack td > .tag, table.grid.stack td > span.tag { justify-self: start; }
  table.grid.stack td.num { text-align: left; }
  table.grid.stack td:first-child > a { display: inline-flex; align-items: center; min-height: 44px; }
}
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* Semináře na telefonu: karta úterý – přednášející, téma a poznámka na celou
   šířku, tlačítka pod tím vedle sebe. */
@media (max-width: 760px) {
  table.seminars.stack td { grid-template-columns: 6.5em minmax(0, 1fr); }
  table.seminars form.topic { display: flex; gap: 6px; }
  table.seminars form.topic input { min-width: 0; flex: 1; }
  table.seminars select { width: 100%; }
  table.seminars td.actions { display: flex; flex-wrap: wrap; gap: 8px; white-space: normal; }
  table.seminars td.actions form { margin: 0; }
  table.seminars tr.mine { box-shadow: inset 4px 0 0 var(--accent); }
}
@media (max-width: 760px) {
  table.seminars.stack td { grid-template-columns: 96px minmax(0, 1fr); font-size: 16px; }
  table.seminars form.topic { flex-wrap: wrap; }
  table.seminars form.topic input { flex: 1 1 100%; }
  /* Nadpis stránky nad ovládáním, ne vedle něj. */
  .planhead { flex-direction: column; align-items: stretch; gap: 10px; }
  .planhead .monthnav { justify-content: flex-start; }
}

@media (max-width: 760px) {
  table.seminars form.topic textarea { flex: 1 1 100%; min-width: 0; }
  table.seminars.stack td.actions { display: flex; flex-wrap: wrap; gap: 8px; padding-top: 10px; }
  table.seminars.stack td.actions::before { content: none; }
}

/* Semináře: stav jako výrazný štítek u data, jedno Uložit na řádek. */
table.seminars td.sem-when { white-space: nowrap; }
table.seminars .state { display: inline-block; margin-left: 8px; padding: 2px 10px; border-radius: 4px;
  font-size: 14px; font-weight: 700; letter-spacing: .01em; }
.state.st-approved { background: #cce2d8; color: #005a30; }
.state.st-proposed { background: #fff7bf; color: #594d00; }
.state.st-rejected { background: #f4cdc6; color: #942514; }
.state.st-none, .state.st-open { background: #e8f1f8; color: #0c2d4a; }
.state.st-cancelled { background: #e2e5e9; color: #383f48; }
table.seminars .sem-form { display: grid; gap: 6px; grid-template-columns: minmax(0, 1fr) auto;
  align-items: start; }
table.seminars .sem-form textarea, table.seminars .sem-form input, table.seminars .sem-topic {
  grid-column: 1; }
table.seminars .sem-form button { grid-column: 2; grid-row: 1; }
table.seminars .sem-form textarea, table.seminars .sem-form input[type=text] { font: inherit;
  padding: 5px 8px; border: 1px solid var(--line); border-radius: 6px; width: 100%; resize: vertical; }
table.seminars td.actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
table.seminars td.actions form { margin: 0; }
button.secondary { background: var(--panel); color: var(--accent); border-color: var(--accent); }
button.link-danger { background: none; border: 0; color: var(--bad-fg); text-decoration: underline;
  text-underline-offset: 3px; padding-inline: 4px; }
@media (max-width: 760px) {
  table.seminars.stack td.sem-when { display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
    font-size: 18px; }
  table.seminars.stack td.sem-when .state { margin-left: auto; }
  table.seminars.stack td.sem-what { display: block; }
  table.seminars.stack td.sem-what::before { content: none; }
  table.seminars .sem-form { grid-template-columns: minmax(0, 1fr); }
  table.seminars .sem-form button { grid-column: 1; grid-row: auto; justify-self: start; }
}

/* Semináře – souhrn a „Upravit“ (podle GOV.UK summary list). */
table.seminars td.sem-state { width: 9.5em; }
table.seminars td.sem-state .state { margin-left: 0; }
table.seminars td.actions { justify-content: flex-end; align-items: flex-start; min-width: 12em; }
details.sem-edit > summary { cursor: pointer; color: var(--accent); font-weight: 600;
  text-decoration: underline; text-underline-offset: 3px; padding: 8px 4px; list-style: none;
  display: inline-flex; align-items: center; min-height: 36px; }
details.sem-edit > summary::-webkit-details-marker { display: none; }
details.sem-edit[open] { flex-basis: 100%; }
details.sem-edit[open] > summary { color: var(--fg); }
table.seminars .sem-form { display: grid; grid-template-columns: minmax(0, 1fr); gap: 4px;
  margin: 6px 0 4px; min-width: 260px; }
table.seminars .sem-form label { font-weight: 600; font-size: 14px; margin-top: 6px; }
table.seminars .sem-form button { grid-column: auto; grid-row: auto; justify-self: start; }
table.seminars .sem-form select { justify-self: start; min-width: 8em; }
.sem-more { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 8px;
  padding-top: 8px; border-top: 1px solid var(--line); }
.sem-more form { margin: 0; }
@media (max-width: 760px) {
  table.seminars.stack tr { position: relative; }
  table.seminars.stack td.sem-when { display: block; font-size: 18px; padding-right: 7.5em; }
  table.seminars.stack td.sem-state { position: absolute; top: 12px; right: 14px; width: auto;
    border: 0; padding: 0; display: block; }
  table.seminars.stack td.sem-state::before { content: none; }
  table.seminars.stack td.sem-what { display: grid; }
  table.seminars.stack td.sem-what::before { content: attr(data-label); }
  table.seminars.stack td.actions { display: flex; justify-content: flex-start; padding-top: 8px; }
  table.seminars.stack td.actions::before { content: none; }
  table.seminars.stack td.actions:not(:has(*)) { display: none; }
  details.sem-edit > summary { min-height: 44px; }
  table.seminars .sem-form { min-width: 0; }
}
@media (min-width: 761px) {
  table.seminars td.actions { display: table-cell; text-align: right; white-space: nowrap; }
  table.seminars td.actions > * { display: inline-block; vertical-align: middle; margin-left: 6px; }
  table.seminars td.actions > details[open] { display: block; text-align: left; white-space: normal; }
}
@media (max-width: 760px) {
  details.sem-edit > summary { border: 1px solid var(--accent); border-radius: 6px; padding: 0 16px;
    text-decoration: none; min-height: 44px; }
  table.seminars.stack td.actions { gap: 10px; }
}

/* Kontrast proběhlých dnů: místo průhlednosti tlumená, ale čitelná barva. */
.tile.past { opacity: 1; background: var(--head); }
.tile.past, .tile.past .t-top, .tile.past .t-sub, .tile.past .t-main { color: var(--muted); }
.tile.past.vs, .tile.past.away { background: var(--head); border-color: var(--line); }
table.heatcal td.past { opacity: 1; color: var(--muted); background: var(--head); }
table.heatcal td.off { color: var(--muted); }
.duty-cal .dtile.past { opacity: 1; background: var(--head); color: var(--muted); }
.duty-cal .dtile.past .chip { color: var(--muted); }
@media (max-width: 760px) {
  /* Měsíc na telefonu: vyšší řádky, ať se jména a buňky dají trefit prstem. */
  table.month th, table.month td { height: 30px; }
  table.month .rowhead a { display: block; line-height: 28px; }
}

.duty-cal .t-wd, .duty-cal .t-mo { display: none; }
@media (max-width: 760px) {
  /* Logo, účet, zpětné odkazy, rozbalovací souhrny: všechno aspoň 44 px. */
  .topbar .brand { min-height: 44px; }
  .topbar .who { min-width: 44px; justify-content: center; }
  main p > a:only-child, main > p > a:first-child { display: inline-flex; align-items: center; min-height: 44px; }
  summary { min-height: 44px; display: flex; align-items: center; cursor: pointer; }
  .daybtn { min-height: 44px; min-width: 44px; }
  .heat-nav button { min-width: 44px; }
  table.grid.stack td:first-child > a { min-width: 44px; }
  input[type=checkbox], input[type=radio] { width: 28px !important; height: 28px !important; flex: none; }
  form.narrow label:has(input[type=checkbox]), form.narrow label:has(input[type=radio]) {
    display: flex; align-items: center; gap: 10px; min-height: 44px; font-weight: 400; }

  /* Výběr služeb na telefonu: místo mřížky seznam dnů pod sebou, u každého
     dne dvě velká tlačítka. Proběhlé dny se nevybírají, tak se ani neukazují. */
  .board .cal-head { display: none; }
  .duty-cal { display: block; }
  .duty-cal > div:empty { display: none; }
  .duty-cal .dtile { display: grid; grid-template-columns: 5.5em 1fr 1fr; align-items: center;
    gap: 8px; min-height: 0; padding: 6px 8px; margin-bottom: 6px; }
  .duty-cal .dtile.past { display: none; }
  .duty-cal .t-top { display: block; font-size: 15px; color: var(--fg); }
  .duty-cal .t-wd, .duty-cal .t-mo { display: inline; }
  .duty-cal .t-wd { font-weight: 700; }
  .duty-cal .t-away { display: inline-block; margin-top: 2px; }
  .duty-cal .chip { min-height: 44px; justify-content: center; font-size: 14px; padding: 4px 8px; }
  .duty-cal .chip .ck { width: 18px; height: 18px; line-height: 18px; font-size: 11px; }
  .duty-cal .chip .cl { display: inline; }
}
@media (max-width: 760px) {
  table.grid.stack td > a { display: inline-flex; align-items: center; min-height: 44px; }
  .monthnav .seg .button { min-width: 44px; }
}
@media (max-width: 760px) {
  /* Zaškrtávátko, které nemá svůj popisek kolem sebe, musí být velké samo. */
  input[type=checkbox]:not(label input), input[type=radio]:not(label input) {
    width: 44px !important; height: 44px !important; }
  dd > a:only-child { display: inline-flex; align-items: center; min-height: 44px; }
}

/* ---- Formuláře podle GOV.UK ------------------------------------------------
   Tučný popisek, pod ním nápověda v běžné velikosti, pak pole s výrazným
   okrajem; skupina voleb je fieldset s otázkou jako legendou; hlavní akce
   je velké tlačítko, na telefonu přes celou šířku. */
form.narrow { max-width: 560px; padding: 20px; }
form.narrow > div, form.narrow > fieldset { margin-bottom: 20px; }
form.narrow label { font-size: 16px; font-weight: 700; margin-bottom: 4px; }
form.narrow .helptext { display: block; color: var(--muted); font-size: 15px; margin: 0 0 6px; }
form.narrow input:not([type=checkbox]):not([type=radio]), form.narrow select, form.narrow textarea {
  border: 2px solid #4f5763; border-radius: 4px; padding: 7px 9px; font-size: 16px; }
form.narrow input:focus, form.narrow select:focus, form.narrow textarea:focus {
  outline: 3px solid var(--focus); outline-offset: 0; box-shadow: inset 0 0 0 2px #0b0c0c; }
fieldset.fs { border: 0; padding: 0; margin: 0 0 20px; min-width: 0; }
fieldset.fs > legend { font-size: 18px; font-weight: 700; padding: 0; margin-bottom: 4px; }
fieldset.fs > div > div > label:not(:has(input)) { display: block; margin: 14px 0 4px; font-size: 13px;
  font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
fieldset.fs label:has(input) { display: flex; align-items: center; gap: 10px; font-weight: 400;
  min-height: 36px; margin: 0; }
form.narrow input[type=checkbox], form.narrow input[type=radio] { width: 22px; height: 22px;
  accent-color: var(--accent); flex: none; margin: 0; }
.cb { display: flex; align-items: center; gap: 10px; }
.cb label { margin: 0 !important; }
form.narrow ul.errorlist { list-style: none; padding: 0; margin: 0 0 6px; font-weight: 700; }
form.narrow > button[type=submit], form.narrow .actions button[type=submit] {
  min-height: 44px; padding: 10px 22px; font-size: 17px; font-weight: 600;
  box-shadow: 0 2px 0 #0d3b85; border-radius: 4px; }
@media (max-width: 760px) {
  form.narrow { padding: 16px; }
  form.narrow > button[type=submit] { width: 100%; }
  fieldset.fs label:has(input) { min-height: 44px; }
  form.narrow input[type=checkbox], form.narrow input[type=radio] { width: 28px !important; height: 28px !important; }
}
/* Nápověda pod zaškrtávátkem patří k jeho popisku, ne k dalšímu poli. */
.cb + .helptext { margin-left: 32px !important; }
.cbhint { display: block; color: var(--muted); font-size: 14px; font-weight: 400; }
.cbwarn { display: block; color: #8a3a0a; font-size: 14px; font-weight: 700; }
fieldset.fs label:has(input) { align-items: flex-start; padding: 6px 0; }
fieldset.fs label:has(input) > input { margin-top: 2px; }
button.groupall { margin-left: 10px; min-height: 0; padding: 2px 8px; font-size: 12px; text-transform: none;
  letter-spacing: 0; font-weight: 600; color: var(--accent); background: none; border: 1px solid var(--line); }
/* Dlouhý formulář: hlavní tlačítko v liště připnuté dole, ať je pořád po ruce. */
form.narrow.long > button[type=submit] { position: sticky; bottom: 12px; }
@media (max-width: 760px) {
  form.narrow.long > button[type=submit] { bottom: max(10px, env(safe-area-inset-bottom)); box-shadow: 0 2px 0 #0d3b85, 0 6px 18px rgba(0, 0, 0, .25); }
  button.groupall { min-height: 36px; padding: 4px 12px; font-size: 13px; }
}
fieldset.fs label:has(input) { display: grid; grid-template-columns: auto minmax(0, 1fr);
  column-gap: 12px; align-items: start; }
fieldset.fs label:has(input) > input { grid-row: 1 / span 3; }
fieldset.fs > div > div > label:not(:has(input)) { display: flex; align-items: center; gap: 10px;
  flex-wrap: wrap; }
button.groupall { margin-left: 0; min-height: 44px; min-width: 44px; }
label.cb { display: flex; align-items: center; gap: 10px; min-height: 44px; margin: 0; }
fieldset.fs > div > div > label:not(:has(input)) { margin-bottom: 10px !important; }
form.narrow fieldset.fs label:has(input[type=checkbox]), form.narrow fieldset.fs label:has(input[type=radio]) {
  display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: 12px; align-items: start;
  font-weight: 600; }
fieldset.fs > div > div > label:not(:has(input)) + div { margin-top: 18px; }
/* Lišta s hlavní akcí dlouhého formuláře: na počítači na konci formuláře,
   na telefonu připnutá dole – s vlastním podkladem, ať nic nepřekrývá. */
form.narrow label.cb { display: flex; align-items: center; gap: 12px; font-weight: 700; }
.cb + .helptext { margin-left: 34px !important; }
.formbar { margin-top: 8px; }
.formbar button[type=submit] { min-height: 44px; padding: 10px 22px; font-size: 17px; font-weight: 600;
  box-shadow: 0 2px 0 #0d3b85; border-radius: 4px; }
@media (max-width: 760px) {
  .cb + .helptext { margin-left: 40px !important; }
  .formbar { position: sticky; bottom: 0; z-index: 5; margin: 8px -16px -16px; padding: 12px 16px;
    padding-bottom: max(12px, env(safe-area-inset-bottom)); background: var(--panel);
    border-top: 1px solid var(--line); box-shadow: 0 -4px 12px rgba(0, 0, 0, .08);
    border-radius: 0 0 8px 8px; }
  .formbar button[type=submit] { width: 100%; }
}
/* Zaškrtávátko s nápovědou: nápověda těsně pod názvem, mezi volbami vzduch. */
form.narrow fieldset.fs label:has(input[type=checkbox]) > input,
form.narrow fieldset.fs label:has(input[type=radio]) > input { grid-row: 1; align-self: start; }
form.narrow fieldset.fs .cbhint, form.narrow fieldset.fs .cbwarn { grid-column: 2; margin-top: 2px;
  font-size: 15px; line-height: 1.4; }
form.narrow fieldset.fs label:has(input) { padding: 0; row-gap: 0; }
fieldset.fs > div > div > div { margin-bottom: 16px; }
fieldset.fs > div > div:not(:first-child) > label:not(:has(input)) { margin-top: 28px; }
fieldset.fs > div > div > label:not(:has(input)) + div { margin-top: 12px; }
button.groupall { border-color: var(--accent); color: var(--accent); background: var(--panel); }
.cb + .helptext { margin-top: -6px; }
button.groupall { font-size: 13px; }
/* Nadpis skupiny silnější než nápovědy; přepínač „vybrat / zrušit vše“ jen
   jako tichý textový odkaz na pravé straně. */
fieldset.fs > div > div > label:not(:has(input)) { font-size: 16px; font-weight: 700; color: var(--fg);
  text-transform: none; letter-spacing: 0; justify-content: space-between; border-bottom: 1px solid var(--line);
  padding-bottom: 4px; }
button.groupall { border: 0; background: none; color: var(--accent); text-decoration: underline;
  text-underline-offset: 3px; font-weight: 400; font-size: 14px; padding: 0 4px; }
form.narrow .cb + .helptext { margin: -4px 0 0 34px; }
@media (max-width: 760px) { form.narrow .cb + .helptext { margin-left: 40px; } }
/* Oprávnění, které rozdává všechna ostatní, je vidět na první pohled. */
fieldset.fs label:has(.cbwarn) { background: #fff4e5; box-shadow: inset 4px 0 0 #b45309;
  padding: 8px 8px 8px 12px !important; border-radius: 4px; }
form.narrow h2.formsec { font-size: 18px; margin: 0 0 12px; }
form.narrow fieldset.fs > legend { font-size: 18px; }
/* Zaškrtávátka v dlouhém formuláři jako GOV.UK: na telefonu 40 px, nadpis
   skupiny větší než nápovědy; lišta Uložit připnutá dole i na počítači. */
@media (max-width: 760px) {
  form.narrow input[type=checkbox], form.narrow input[type=radio] { width: 40px !important; height: 40px !important; }
  form.narrow fieldset.fs .cbhint, form.narrow fieldset.fs .cbwarn { margin-top: 0; }
}
fieldset.fs > div > div > label:not(:has(input)) { font-size: 17px; }
form.narrow.long .formbar { position: sticky; bottom: 0; z-index: 5; margin: 12px -20px -20px;
  padding: 12px 20px; background: var(--panel); border-top: 1px solid var(--line);
  box-shadow: 0 -4px 12px rgba(0, 0, 0, .06); border-radius: 0 0 8px 8px; }
@media (min-width: 761px) {
  form.narrow input[type=checkbox], form.narrow input[type=radio] { width: 24px; height: 24px; }
}

/* ---- Nástroje přehledu: na počítači v řadě, na telefonu pod „Nástroje“ ---- */
details.tools { display: contents; }
details.tools > summary { display: none; }
details.tools .tools-in { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
@media (max-width: 760px) {
  .monthnav { gap: 8px; }
  details.tools { display: block; width: 100%; }
  details.tools > summary { display: inline-flex; align-items: center; gap: 8px; min-height: 44px;
    padding: 0 14px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel);
    font-weight: 600; cursor: pointer; list-style: none; }
  details.tools > summary::-webkit-details-marker { display: none; }
  details.tools > summary::after { content: ""; width: 7px; height: 7px; margin-top: -3px;
    border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg); }
  details.tools[open] > summary::after { transform: rotate(-135deg); margin-top: 3px; }
  details.tools .tools-in { margin-top: 8px; padding: 10px; background: var(--panel);
    border: 1px solid var(--line); border-radius: 8px; }
  details.tools .tools-in > * { flex: 1 1 calc(50% - 8px); }
  .monthnav .seg { flex: none; }
}
@media print { details.tools { display: none !important; } }
@media (max-width: 760px) {
  .monthnav > .seg:first-child { order: 1; }
  .monthnav > details.tools { order: 2; width: auto; flex: 1 1 auto; }
  .monthnav > details.tools[open] { flex-basis: 100%; }
  .monthnav > details.tools > summary { width: 100%; justify-content: center; }
  .monthnav > .seg:nth-child(2) { order: 3; flex: 1 1 100%; display: flex; }
  .monthnav > .seg:nth-child(2) > button { flex: 1; }
  .monthnav > #dutyBtn { order: 4; flex: 1 1 100%; }
}
@media (max-width: 760px) {
  .wide-only { display: none; }
  #dayactions:empty { display: none; }
  #dayactions form, #dayactions button { width: 100%; }
  /* Pruh dnů v jednom řádku, posouvá se prstem. */
  .daybar { flex-wrap: nowrap; overflow-x: auto; scroll-snap-type: x proximity;
    margin-inline: -16px; padding: 2px 16px 6px; scrollbar-width: none; }
  .daybar::-webkit-scrollbar { display: none; }
  .daybar .daybtn { flex: none; scroll-snap-align: center; }
}

/* Prázdné poznámky jen jako jeden tichý řádek; nápověda k přesunům sbalená. */
.notes.empty { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; padding: 0;
  border: 0; background: none; margin-bottom: 10px; }
.notes.empty .nh { font-weight: 600; font-size: 14px; color: var(--muted); }
.notes.empty .hint { display: none; }
.notes.empty details.noteedit.add { display: inline-block; margin: 0; }
.notes.empty details.noteedit.add[open] { display: block; flex-basis: 100%; }
details.dayhint { margin: 0 0 12px; font-size: 14px; }
details.dayhint > summary { color: var(--accent); cursor: pointer; font-weight: 600; }
details.dayhint > p { margin: 6px 0 0; padding: 10px 12px; background: #fff9e6;
  border: 1px solid #f0dca0; border-radius: 8px; }

/* Na počítači: nástroje jako tichá skupina s popiskem, oddělená od listování
   obdobím a přepínání pohledu. */
@media (min-width: 761px) {
  details.tools .tools-in { padding-left: 12px; border-left: 1px solid var(--line); gap: 4px; }
  details.tools .tools-in::before { content: "Nástroje"; font-size: 12px; font-weight: 700;
    letter-spacing: .04em; text-transform: uppercase; color: var(--muted); margin-right: 4px; }
  details.tools .tools-in > button, details.tools .tools-in > .button,
  details.tools .tools-in > span > form > button {
    background: none; border-color: transparent; color: var(--accent); padding: 6px 10px; }
  details.tools .tools-in > button:hover, details.tools .tools-in > .button:hover { border-color: var(--line); }
  details.tools .tools-in > button.on { background: #e8eefb; border-color: #c3d3f3; color: var(--fg); }
  details.tools .tools-in > span > form > button.danger { color: var(--bad-fg); }
  .planhead > div:first-child { min-width: 240px; }
  .planhead .lead { white-space: nowrap; }
}
.monthnav .seg > button.on, .monthnav .seg > a.on { background: var(--accent); color: #fff; border-color: var(--accent); }
/* Buňky měsíce: značka nepřítomnosti jako štítek, přeškrtnuté pracoviště čitelné. */
table.month .ab { display: inline-block; padding: 0 3px; border-radius: 3px; background: #dbeafe;
  color: #1e3a8a; font-weight: 700; }
table.month .wp.struck { font-size: 11px; color: #5b6270; text-decoration-thickness: 1.5px; }
/* Přepínače v nástrojích: stejný tvar, zapnutý má fajfku. */
.phone-only { display: none !important; }
@media (min-width: 761px) {
  details.tools .tools-in > button.on { background: none; border-color: transparent; color: var(--fg);
    font-weight: 600; }
  details.tools .tools-in > button.on::before { content: "✓ "; color: var(--ok-fg); }
}
@media (max-width: 760px) {
  .phone-only { display: inline-flex !important; }
  .notes.empty:not(.shown) { display: none; }
  details.tools .tools-in > button.on { background: #e8eefb; border-color: #c3d3f3; }
  details.tools .tools-in > button.on::before { content: "✓ "; color: var(--ok-fg); }
}
@media print { .phone-only { display: none !important; } }
@media (max-width: 760px) { table.month .fte { display: none; } }
@media (max-width: 760px) {
  /* Souhrn dne na telefonu hustší: číslo vedle popisku, ať je rozpis dne výš. */
  .dcards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
  .dcard { padding: 8px 10px; display: grid; grid-template-columns: minmax(0, 1fr) auto;
    column-gap: 8px; align-items: baseline; }
  .dcard .k { font-size: 13px; grid-column: 1; }
  .dcard .v { font-size: 22px; grid-column: 2; grid-row: 1 / span 2; align-self: center; }
  .dcard .s { font-size: 12px; grid-column: 1; }
  /* Měsíc: kódy v buňkách a záhlaví o stupeň větší. */
  table.month { font-size: 12px; }
  table.month thead th { font-size: 11px; }
}
@media (max-width: 760px) {
  .tile .t-sub { overflow-wrap: normal; word-break: normal; }
  .tile .t-sub .badge { transform: none; }
}

/* Můj program: souhrn nahoře (jako zelený panel GOV.UK), úplná legenda. */
.me-panel { max-width: 980px; margin: 8px 0 16px; padding: 14px 18px; background: var(--brand); color: #fff;
  border-radius: 8px; display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 10px 22px; }
.me-panel > div { min-width: 0; }
.me-panel dt { font-size: 13px; font-weight: 600; color: #d6e3ee; }
.me-panel dd { margin: 0; font-size: 18px; font-weight: 700; line-height: 1.3; }
.me-panel a { color: #fff; }
.me-panel .attn dd, .me-panel .attn a { color: var(--focus); }
.tile.vs { background: #e3f4ea; border-color: #a9d8bb; }
.cal-key { display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: center; font-size: 13px;
  color: var(--fg); margin: 8px 0 18px; max-width: 980px; }
.cal-key span { display: inline-flex; align-items: center; gap: 6px; }
.cal-key .k { display: inline-block; width: 16px; height: 14px; border-radius: 3px; border: 1px solid var(--line);
  background: var(--panel); margin: 0; }
.cal-key .k.today { box-shadow: 0 0 0 2px var(--accent); }
.cal-key .k.vs { background: #e3f4ea; border-color: #a9d8bb; }
.cal-key .k.away { background: #e0f2fe; border-color: #9fd3f2; }
.cal-key .k.pending { border: 1px dashed #d97706; }
.cal-key .k.dot { width: 8px; height: 8px; border-radius: 50%; background: #d97706; border: 0; }
.cal-key .k.duty { border-left: 4px solid #7c3aed; }
details.board-peek { max-width: 980px; margin: 10px 0; background: var(--panel); border: 1px solid var(--line);
  border-radius: 8px; }
details.board-peek > summary { padding: 12px 14px; cursor: pointer; font-weight: 600; min-height: 44px; }
details.board-peek > summary .u { color: var(--accent); text-decoration: underline; font-weight: 400; }
details.board-peek > .board { margin: 0; border: 0; border-top: 1px solid var(--line); border-radius: 0 0 8px 8px; }
@media (max-width: 760px) {
  .me-panel { grid-template-columns: 1fr 1fr; padding: 12px 14px; gap: 8px 14px; }
  .me-panel dd { font-size: 16px; }
}
.me-panel dd a { display: inline-flex; align-items: center; min-height: 44px; }

/* Změna proti rozpisu má vlastní barvu; oranžová patří čekající žádosti. */
.tile .t-dot, .cal-key .k.dot { background: #b0186b; }
.tile.changed { border-color: #b0186b; }
details.board-peek > summary { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center;
  justify-content: space-between; }
@media (max-width: 760px) {
  .tile { min-height: 70px; }
  .tile .t-main { font-size: 14px; }
  .tile .t-sub { font-size: 11px; color: var(--fg); }
  .tile .t-top { font-size: 12px; }
}

details.cal-legend > summary { display: none; }
@media (max-width: 760px) {
  details.cal-legend { margin: 6px 0 4px; }
  details.cal-legend > summary { display: inline-flex; align-items: center; min-height: 44px;
    color: var(--accent); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
}
.me-panel dd a { min-width: 44px; }

/* ---- Můj program: 5 týdnů, posun v čase, výběr služeb v dlaždicích (D-104) */
.calnav { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin: 14px 0 6px; }
.calnav .calspan { font-size: 16px; }
.pickbar { max-width: 980px; margin: 14px 0; padding: 12px 14px; border: 2px solid #7c3aed;
  border-radius: 10px; background: var(--panel); }
.pickbar .pb-head { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: baseline; }
.pickbar .pb-foot { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; }
.pickbar .pb-hint { font-size: 13px; color: var(--muted); flex: 1 1 260px; }
.tile.pickable { cursor: default; }
.tile.can-pick { box-shadow: inset 0 0 0 2px #c4b5fd; }
.tile .t-day { color: inherit; text-decoration: none; }
a.t-day:hover { text-decoration: underline; }
.tile .t-pick { display: flex; flex-direction: column; gap: 3px; margin-top: auto; }
.tile .t-pick .chip { font-size: 12px; padding: 2px 6px; justify-content: flex-start; min-height: 0; }
.cal-key .k.pick { box-shadow: inset 0 0 0 2px #c4b5fd; }
dialog.picksheet { border: 0; border-radius: 14px 14px 0 0; padding: 18px 16px 16px;
  width: 100%; max-width: 520px; margin: auto auto 0; box-shadow: 0 -8px 30px rgba(0, 0, 0, .25); }
dialog.picksheet::backdrop { background: rgba(10, 20, 30, .45); }
dialog.picksheet h2 { margin: 0 0 12px; }
.ps-slots { display: grid; gap: 10px; }
.ps-btn { display: flex !important; align-items: center; gap: 12px; justify-content: flex-start !important;
  min-height: 52px; font-size: 17px; font-weight: 600; width: 100%; border-radius: 8px; }
.ps-btn .ck { width: 26px; height: 26px; line-height: 26px; border-radius: 50%; text-align: center;
  color: #fff; background: #7c3aed; font-weight: 700; flex: none; }
.ps-btn.k-phone_standby .ck { background: #d97706; }
.ps-btn.free { border: 2px dashed #7c3aed; color: #5b21b6; background: #faf5ff; }
.ps-btn.mine { background: #7c3aed; color: #fff; border-color: #7c3aed; }
.ps-btn.mine .ck { background: #fff; color: #7c3aed; }
.ps-btn.taken, .ps-btn.blocked { color: var(--muted); background: var(--head); font-weight: 400; font-size: 15px; }
.ps-msg { color: var(--bad-fg); min-height: 1.2em; margin: 8px 0 0; }
.ps-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 10px; }
.ps-foot .ps-day { display: inline-flex; align-items: center; min-height: 44px; }
@media (max-width: 760px) {
  .tile .t-pick { flex-direction: row; gap: 2px; }
  .tile .t-pick .chip { padding: 0; border-radius: 50%; width: 18px; height: 18px; justify-content: center; }
  .tile .t-pick .chip .cl { display: none; }
  .tile .t-pick .chip .ck { width: 16px; height: 16px; line-height: 16px; font-size: 10px; }
  .tile .t-pick .chip.blocked, .tile .t-pick .chip.taken { opacity: .55; }
  .tile.pickable { cursor: pointer; }
}

.pickline { max-width: 980px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px;
  margin: 8px 0; padding: 8px 12px; border: 1px solid #c4b5fd; border-radius: 8px; background: #faf5ff; }
.pickline .button { margin-left: auto; }

/* ---- Hlášení chyb (D-105): tlačítko v pravém dolním rohu, dialog ---------
   Na počítači štítek s textem, na telefonu jen kulatá ikona, ať nezakrývá
   obsah. Nad lištou s hlavní akcí formuláře, aby ji nepřekrylo. */
.bugbtn { position: fixed; right: 16px; bottom: max(16px, env(safe-area-inset-bottom)); z-index: 40;
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 8px 16px 8px 12px;
  background: var(--panel); color: var(--brand); border: 2px solid var(--brand); border-radius: 999px;
  font-weight: 700; text-decoration: none; box-shadow: 0 3px 12px rgba(0, 0, 0, .18); }
.bugbtn:hover { background: var(--brand); color: #fff; }
.bugbtn svg { flex: none; }
body:has(.bugbtn) main { padding-bottom: 80px; }
@media (max-width: 760px) {
  .bugbtn { width: 48px; height: 48px; padding: 0; justify-content: center; right: 12px;
    bottom: max(12px, env(safe-area-inset-bottom)); }
  .bugbtn .bb-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0);
    white-space: nowrap; }
  body:has(.formbar) .bugbtn, body:has(form.narrow.long) .bugbtn { bottom: max(88px, calc(env(safe-area-inset-bottom) + 76px)); }
}
@media print { .bugbtn, dialog.bugdlg { display: none !important; } }
dialog.bugdlg { border: 0; border-radius: 10px; padding: 0; width: min(580px, calc(100% - 32px));
  max-height: calc(100vh - 48px); overflow: auto; box-shadow: 0 10px 40px rgba(0, 0, 0, .3); }
dialog.bugdlg::backdrop { background: rgba(10, 20, 30, .45); }
.bug-body { padding: 20px 22px; }
.bug-body h2 { margin: 0 0 14px; font-size: 22px; }
dialog.bugdlg form.narrow { max-width: none; padding: 0; border: 0; border-radius: 0; margin: 0; }
.bug-preview { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.bug-preview[hidden] { display: none; }
.bug-preview img { max-height: 140px; max-width: 100%; border: 1px solid var(--line); border-radius: 4px; }
.bug-auto { margin: 0 0 18px; color: var(--muted); }
.bug-auto summary { cursor: pointer; color: var(--accent); min-height: 44px; display: flex; align-items: center; }
.bug-auto ul { margin: 0; padding-left: 20px; }
.bug-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.bug-actions button { min-height: 44px; padding: 10px 22px; font-size: 17px; font-weight: 600; border-radius: 4px; }
.bug-actions button[type=submit] { box-shadow: 0 2px 0 #0d3b85; }
.bug-fail { color: var(--bad-fg); font-weight: 700; }
.bug-done p { font-size: 16px; }
@media (max-width: 760px) {
  dialog.bugdlg { width: 100%; max-width: 100%; margin: auto auto 0; border-radius: 14px 14px 0 0;
    max-height: 92vh; }
  .bug-body { padding: 18px 16px max(16px, env(safe-area-inset-bottom)); }
  .bug-actions button { flex: 1 1 auto; }
}
.bug-tabs { flex-wrap: wrap; margin: 0 0 14px; }
.bug-tabs .button { min-height: 44px; display: inline-flex; align-items: center; }
dl.bug-sum { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 8px 20px;
  max-width: 900px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px;
  padding: 14px 18px; }
dl.bug-sum > div { display: contents; }
dl.bug-sum dt { color: var(--muted); font-weight: 600; }
dl.bug-sum dd { margin: 0; overflow-wrap: anywhere; }
.pre { white-space: pre-wrap; }
.bug-shot { max-width: min(100%, 900px); border: 1px solid var(--line); border-radius: 6px; }
.bug-errors code { overflow-wrap: anywhere; }
@media (max-width: 760px) {
  dl.bug-sum { grid-template-columns: 1fr; gap: 2px; }
  dl.bug-sum dd { margin-bottom: 10px; }
}
.bug-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 0 14px; }
dialog.bugdlg .bug-head h2, dialog.bugdlg h2 { margin: 0; font-size: 22px; }
.bug-done h2 { margin-bottom: 12px !important; }
button.bug-x { min-width: 44px; min-height: 44px; padding: 0; font-size: 20px; line-height: 1; flex: none; }
.calnav .seg .button { min-width: 48px; min-height: 44px; justify-content: center; }
dl.bug-sum dd a { display: inline-block; padding: 10px 0; margin: -10px 0; }
.turn-over { max-width: 980px; margin: 10px 0; padding: 10px 14px; background: var(--panel);
  border: 1px solid var(--line); border-left: 4px solid #a78bfa; border-radius: 8px; }
@media (min-width: 761px) {
  dialog.picksheet { margin: auto; border-radius: 14px; max-width: 440px; box-shadow: 0 10px 40px rgba(0, 0, 0, .3); }
  .tile.pickable { cursor: pointer; }
}
