/* Shared calendar — week (day columns) + month grid */
.kb-cal-toolbar { display:flex; flex-wrap:wrap; gap:12px; align-items:center; justify-content:space-between; margin:16px 0; }
.kb-cal-nav { display:flex; align-items:center; gap:8px; }
.kb-cal-nav strong { font-size:16px; }
.kb-cal-views, .kb-cal-filters { display:flex; gap:8px; }
.kb-legend { display:flex; flex-wrap:wrap; gap:14px; align-items:center; margin-bottom:12px; font-size:13px; color:#45606F; }
.kb-legend-item { display:inline-flex; align-items:center; gap:6px; }
.kb-dot { display:inline-block; width:12px; height:12px; border-radius:50%; vertical-align:middle; }

#kb-calendar { position:relative; min-height:200px; overflow-x:auto; margin-top:20px; }
#kb-calendar.kb-loading { opacity:.5; }
.kb-cal-empty { padding:30px; text-align:center; color:#45606F; }
.kb-sr { position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip:rect(0,0,0,0); white-space:nowrap; border:0; }

/* Empty period (no lessons in the shown week/month) */
.kb-cal-none { display:flex; flex-direction:column; align-items:center; gap:14px; padding:44px 20px; text-align:center;
  background:#F3F7FA; border:1px dashed #9FB6C3; border-radius:10px; }
.kb-cal-none p { margin:0; color:#2E4A5A; font-size:15px; max-width:46ch; }
.kb-cal-none-actions { display:flex; flex-wrap:wrap; gap:10px; justify-content:center; }

/* Week view */
.kb-week-wrap { display:flex; flex-direction:column; gap:6px; }
.kb-wband { grid-template-columns:repeat(7, minmax(0, 1fr)); gap:4px 6px; }
.kb-week { display:grid; grid-template-columns:repeat(7, minmax(0, 1fr)); gap:6px; }
.kb-day { background:#fff; border:1px solid #D9DFD9; border-radius:8px; overflow:hidden; display:flex; flex-direction:column; min-height:120px; min-width:0; }
/* Today: filled day header (not a ring — rings are reserved for keyboard focus) */
.kb-day-today .kb-day-head { background:#16587B; border-bottom-color:#16587B; }
.kb-day-today .kb-day-head span, .kb-day-today .kb-day-head strong { color:#fff; }
.kb-day-head { padding:8px; text-align:center; background:#EDF4F8; border-bottom:1px solid #D9DFD9; line-height:1.2; }
.kb-day-head span { display:block; font-size:11px; text-transform:uppercase; letter-spacing:.04em; color:#45606F; }
.kb-day-head strong { font-size:14px; color:#16587B; }
.kb-day-body { padding:6px; display:flex; flex-direction:column; gap:6px; flex:1; }
.kb-day-empty { color:#5E7886; text-align:center; padding:8px 0; }
.kb-day-multi { display:none; flex-direction:column; gap:6px; }

/* Event card */
.kb-ev { border-left:4px solid var(--ev,#16587B); background:#F3F7FA; border-radius:6px; padding:6px 8px; cursor:pointer; transition:transform .08s, box-shadow .08s;
  overflow-wrap:anywhere; hyphens:auto; }
.kb-ev:hover { transform:translateY(-1px); box-shadow:0 3px 10px rgba(15,63,89,.12); }
.kb-ev:focus-visible, .kb-span-bar:focus-visible, .kb-day-row:focus-visible, .kb-mcell-has:focus-visible { outline:2px solid #16587B; outline-offset:2px; }
.kb-ev-time { font-size:12px; font-weight:700; color:var(--ev-text, var(--ev,#16587B)); }
.kb-ev-title { font-size:13px; font-weight:600; color:#12303F; line-height:1.35; }
.kb-ev-sub { font-size:11px; color:#45606F; hyphens:manual; }
.kb-ev-foot { display:flex; flex-wrap:wrap; justify-content:space-between; align-items:center; gap:4px; margin-top:3px; }
.kb-ev-occ { font-size:11px; color:#16587B; background:#E6F0F5; border-radius:10px; padding:1px 7px; }
.kb-ev-tag { font-size:10px; text-transform:uppercase; letter-spacing:.04em; color:var(--ev-ink,#fff); background:var(--ev,#16587B); border-radius:10px; padding:1px 7px; }
.kb-ev-full { background:#EEF1F3; }
.kb-ev-full .kb-ev-occ, .kb-ev-tag-full { background:#f3d9d4 !important; color:#902 !important; }
.kb-ev-mine { box-shadow:0 0 0 1px var(--ev,#16587B) inset; }
.kb-ev-cont { border-left-style:dashed; background:#EDF4F8; }
.kb-ev-tag-cont { background:#B9D5E4 !important; color:#0F3F59 !important; }

/* Trainer dots on a lesson card */
.kb-ev-sub { display:flex; align-items:center; gap:5px; min-width:0; }
.kb-ev-dots { display:inline-flex; gap:3px; flex-shrink:0; }
.kb-ev-dot { width:9px; height:9px; border-radius:50%; display:inline-block; box-shadow:0 0 0 1px rgba(0,0,0,.08); }
.kb-mcell .kb-ev-dots, .kb-month .kb-ev-dots { display:none; }

/* Concurrent lessons — stacked under each other (readable) */
.kb-cluster { display:flex; flex-direction:column; gap:6px; }
.kb-cluster .kb-ev { flex:1 1 0; min-width:0; }
.kb-cluster-multi .kb-ev-title { font-size:12px; }

/* Add-lesson affordance on a day */
.kb-add-day { display:inline-flex; align-items:center; justify-content:center; width:20px; height:20px; border-radius:50%;
  background:#16587B; color:#fff !important; text-decoration:none; font-weight:700; line-height:1; font-size:15px; }
.kb-day-head { position:relative; }
.kb-day-head .kb-add-day { position:absolute; top:6px; right:6px; opacity:0; transition:opacity .12s; }
.kb-day:hover .kb-add-day, .kb-add-day:focus-visible { opacity:1; }
.kb-mcell-num { display:flex; justify-content:space-between; align-items:center; }
.kb-mcell .kb-add-day { width:16px; height:16px; font-size:12px; opacity:0; }
.kb-mcell:hover .kb-add-day { opacity:1; }

/* Filter chips (checkbox list) — the checkbox stays focusable, only visually hidden */
.kb-filter-chips { display:flex; flex-wrap:wrap; gap:6px; align-items:center; }
.kb-chip { position:relative; display:inline-flex; align-items:center; gap:5px; padding:4px 10px; border:1px solid #6B8796; border-radius:16px; cursor:pointer; font-size:13px; background:#fff; user-select:none; }
.kb-chip input { position:absolute; opacity:0; width:1px; height:1px; margin:0; pointer-events:none; }
.kb-chip:has(input:checked) { background:#16587B; color:#fff; border-color:#16587B; }
.kb-chip:has(input:focus-visible) { outline:2px solid #16587B; outline-offset:2px; }
.kb-chip .kb-dot { width:10px; height:10px; }
.kb-chip:has(input:checked) .kb-dot { box-shadow:0 0 0 1.5px #fff; }
.kb-filter-group { display:flex; flex-direction:column; gap:6px; }
.kb-filter-group > strong { font-size:11px; text-transform:uppercase; letter-spacing:.04em; color:#45606F; }

/* Month view — stacked week rows so multi-day events can span columns */
.kb-month { display:flex; flex-direction:column; gap:4px; min-width:0; }
.kb-month-head, .kb-mcells, .kb-mband { display:grid; grid-template-columns:repeat(7, minmax(0, 1fr)); }
.kb-month-head { gap:4px; }
.kb-month-dow { text-align:center; font-size:11px; text-transform:uppercase; letter-spacing:.04em; color:#45606F; padding:4px 0; }
.kb-mweek { display:flex; flex-direction:column; }
.kb-mcells { gap:4px; }
.kb-mband { gap:2px 4px; padding:2px 0; align-content:start; }

/* Continuous spanning bar for multi-day events (Google-calendar style) */
.kb-span { min-width:0; }
.kb-span-bar { --ev:#16587B; display:flex; align-items:center; gap:8px; min-width:0; height:22px;
  padding:0 10px; border-radius:5px; cursor:pointer; color:var(--ev-ink,#fff); background:var(--ev);
  box-shadow:0 1px 3px rgba(15,63,89,.18); transition:filter .08s; }
.kb-span-bar:hover { filter:brightness(.94); }
.kb-span-contl .kb-span-bar { border-top-left-radius:0; border-bottom-left-radius:0; }
.kb-span-contr .kb-span-bar { border-top-right-radius:0; border-bottom-right-radius:0; }
.kb-span-text { flex:1 1 auto; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-size:12px; }
.kb-span-title { font-weight:700; }
.kb-span-type, .kb-span-trainer, .kb-span-loc { font-weight:400; }
.kb-span-occ { flex:0 0 auto; font-size:11px; font-weight:700; background:var(--ev-pill, rgba(0,0,0,.2)); border-radius:9px; padding:1px 8px; }
.kb-span-bar.kb-span-full { background:#EEF1F3; color:#12303F; box-shadow:inset 4px 0 0 var(--ev), 0 1px 3px rgba(15,63,89,.18); }
.kb-span-bar.kb-span-full .kb-span-occ { background:#f3d9d4; color:#902; }
.kb-span-bar.kb-span-mine { box-shadow:0 0 0 2px #fff inset, 0 1px 3px rgba(15,63,89,.25); }

.kb-mcell { background:#fff; border:1px solid #D9DFD9; border-radius:6px; min-height:96px; padding:4px; display:flex; flex-direction:column; gap:3px; min-width:0; }
.kb-mcell-out { background:#FAF6EE; }
.kb-mcell-out .kb-mcell-num { color:#45606F; font-weight:600; }
.kb-mcell-today .kb-mcell-num > span:first-child { display:inline-flex; align-items:center; justify-content:center; min-width:22px; height:22px; padding:0 5px; border-radius:11px; background:#16587B; color:#fff; }
.kb-mcell-num { font-size:12px; font-weight:700; color:#16587B; text-align:right; }
.kb-mcell .kb-ev { padding:2px 5px; font-size:11px; border-left-width:3px; overflow:hidden; white-space:nowrap; text-overflow:ellipsis; }
.kb-mcell .kb-ev-time { display:inline; }
.kb-mcell .kb-ev-occ { background:none; padding:0; float:right; }
.kb-more { font-size:11px; color:#45606F; text-align:center; }

/* Day overlay — all lessons of a single day (opened from a month cell) */
.kb-mcell-has { cursor:pointer; }
.kb-mcell-has:hover { border-color:#84B3CE; box-shadow:0 2px 8px rgba(15,63,89,.10); }
.kb-more { cursor:pointer; }

.kb-day-modal-overlay { position:fixed; inset:0; z-index:99999; display:flex; align-items:center; justify-content:center;
  padding:20px; background:rgba(15,63,89,.5); }
.kb-day-modal { width:100%; max-width:520px; max-height:calc(100vh - 40px); max-height:calc(100dvh - 40px); display:flex; flex-direction:column; overflow:hidden;
  background:#F5EEDD; border-radius:12px; box-shadow:0 18px 50px rgba(15,63,89,.35); }
.kb-day-modal-head { display:flex; align-items:center; justify-content:space-between; gap:12px;
  padding:10px 10px 10px 18px; background:#16587B; color:#fff; }
.kb-day-modal-head strong { font-size:16px; }
.kb-day-modal-close { display:inline-flex; align-items:center; justify-content:center; width:44px; height:44px; background:none; border:0; border-radius:8px;
  color:#fff; font-size:26px; line-height:1; cursor:pointer; padding:0; }
.kb-day-modal-close:hover { background:rgba(255,255,255,.12); }
.kb-day-modal-close:focus-visible { outline:2px solid #84B3CE; outline-offset:0; }

.kb-day-list { padding:10px; overflow-y:auto; display:flex; flex-direction:column; gap:6px; }
.kb-day-row { display:flex; align-items:center; gap:12px; padding:10px 12px; cursor:pointer;
  background:#fff; border:1px solid #D9DFD9; border-left:4px solid var(--ev,#16587B); border-radius:8px;
  transition:transform .08s, box-shadow .08s; }
.kb-day-row:hover { transform:translateY(-1px); box-shadow:0 3px 10px rgba(15,63,89,.12); }
.kb-day-row-time { flex:0 0 auto; min-width:64px; font-size:13px; font-weight:700; color:var(--ev-text, var(--ev,#16587B)); }
.kb-day-row-main { flex:1 1 auto; min-width:0; display:flex; flex-direction:column; gap:1px; }
.kb-day-row-title { font-size:14px; font-weight:600; color:#12303F; }
.kb-day-row-meta { font-size:12px; color:#45606F; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.kb-day-row-occ { flex:0 0 auto; font-size:12px; color:#16587B; background:#E6F0F5; border-radius:10px; padding:2px 9px; }
.kb-day-row-full { background:#EEF1F3; }
.kb-day-row-full .kb-day-row-occ { background:#f3d9d4; color:#902; }
.kb-day-row-mine { box-shadow:0 0 0 1px var(--ev,#16587B) inset; }

@media (max-width:782px) {
  .kb-week { grid-template-columns:1fr; }
  .kb-wband { display:none; }
  .kb-day-multi { display:flex; }
  .kb-day-empty-wide { display:none; }
  .kb-day { min-height:auto; flex-direction:row; }
  .kb-day-head { flex:0 0 64px; display:flex; flex-direction:column; justify-content:center; border-bottom:0; border-right:1px solid #D9DFD9; }
  .kb-day-body { min-width:0; }
  .kb-day-empty { text-align:left; padding:6px 4px; }
  .kb-mcell { min-height:64px; }
}

/* Phones: compact month — lessons become coloured bars, a tap opens the day list */
@media (max-width:600px) {
  .kb-cal-nav { flex-wrap:wrap; }
  .kb-cal-nav strong { flex-basis:100%; order:-1; font-size:17px; }
  .kb-month-head, .kb-mcells, .kb-month { gap:2px; }
  .kb-mcells, .kb-mband { gap:2px; }
  .kb-mcell { min-height:58px; padding:3px; border-radius:5px; gap:2px; }
  .kb-mcell-num { text-align:center; justify-content:center; font-size:12px; }
  .kb-mcell .kb-ev { height:6px; padding:0; border:0; border-radius:3px; font-size:0; line-height:0; }
  /* ≥ 3:1 against the white cell: the darkened lesson colour, slate grey when full */
  .kb-mcell .kb-ev, .kb-span-bar { background:var(--ev-text, var(--ev,#16587B)); }
  .kb-mcell .kb-ev > * { display:none; }
  .kb-mcell .kb-ev-full, .kb-span-bar.kb-span-full { background:#6B8796; box-shadow:none; }
  .kb-more { font-size:10px; line-height:1.1; }
  .kb-more-label { display:none; }
  .kb-span-bar { position:relative; height:8px; padding:0; border-radius:4px; }
  /* tenký pruh, ale dotyková plocha ≥ 24 px */
  .kb-span-bar::before { content:''; position:absolute; left:0; right:0; top:50%; height:24px; transform:translateY(-50%); }
  /* text hidden only visually — the bar keeps its accessible name (date, title, occupancy) */
  .kb-span-bar > * { position:absolute; width:1px; height:1px; margin:-1px; padding:0; overflow:hidden; clip:rect(0,0,0,0); white-space:nowrap; border:0; }
  .kb-month-dow { font-size:10px; letter-spacing:0; }
}

/* Page scroll is locked while a modal is open */
html.kb-scroll-lock, html.kb-scroll-lock body { overflow:hidden; }
html.kb-scroll-lock body { padding-right:var(--kb-sbw, 0px); }

@media (pointer:coarse) {
  .kb-chip { min-height:44px; }
}
