/* Release 6: the Week tab as one calm surface (spec §5.2) — the header «Октябрь 2026 ▾», the solid «Неделя / День»
   switch, the date strip, the grid's layers, the Day view, the month sheet and the semester strip; plus the pair
   sheet's layer lines. Content is solid (glass only on the floating layer, spec §3.1); the shell's tokens only (no
   colour mixing functions); logical properties for RTL; 44 pt targets; reduced motion and more contrast honoured.
   The layer tokens --layer-0..7 and .lp / .lc-N / .ld live in app.css (the planners screen uses them too). */

/* ---------- the header ---------- */
.cal-head { padding: 8px 4px 2px; }
.cal-titlebar { display: flex; align-items: flex-start; gap: 12px; }
.cal-title { flex: 1; min-width: 0; margin: 0; }
.cal-avatar { flex: none; }
.cal-month-btn {
  display: inline-flex; align-items: center; gap: 4px; max-width: 100%; min-height: 44px; padding: 0; border: 0;
  background: none; color: var(--text); font: inherit; font-size: inherit; font-weight: inherit; letter-spacing: inherit;
  text-align: start; cursor: pointer;
}
.cal-month-btn:disabled { cursor: default; }
.cal-month-btn .ico { flex: none; width: 22px; height: 22px; stroke-width: 2.4; color: var(--accent); transition: transform .25s ease; }
.cal-month-btn:disabled .ico { display: none; }
.cal-month-btn.up .ico { transform: rotate(180deg); }
.cal-month-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-title.fit-1 { font-size: 30px; }                 /* week.js fitTitle: the year never goes to «…» */
.cal-title.fit-2 { font-size: 26px; }
.cal-title.fit-3 { font-size: 22px; }
.cal-sub { margin: 2px 0 0; overflow-wrap: anywhere; }
.cal-mode { margin: 10px 0 0; }
.cal-weekline { margin: 6px 4px 0; font-size: 13px; color: var(--hint); text-align: center; font-variant-numeric: tabular-nums; }
.cal-weekline:empty { display: none; }

/* ---------- the week line (Неделя) and the date strip (День) ---------- */
.cal-strip-row { display: flex; align-items: center; gap: 4px; margin-top: 10px; }
.cal-strip-row .wk-nav { flex: none; width: 44px; height: 44px; border-radius: 22px; background: none; }
.cal-strip-row .cal-weekline { flex: 1; min-width: 0; margin: 0; font-size: 14px; font-weight: 600; color: var(--text); }
.cal-strip { flex: 1; min-width: 0; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 2px;
  touch-action: pan-y; }
.cal-day {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 0;
  min-height: 56px; padding: 4px 0 6px; border: 0; border-radius: 14px; background: none; color: var(--text);
  font: inherit; cursor: pointer;
}
.cal-day:active { background: rgb(var(--text-rgb) / 0.06); }
.cal-wd { font-size: 11px; font-weight: 600; color: var(--hint); text-transform: uppercase; letter-spacing: .02em; }
.cal-dn {
  display: grid; place-items: center; inline-size: 30px; block-size: 30px; border-radius: 15px;
  font-size: 16px; font-weight: 600; font-variant-numeric: tabular-nums;
}
.cal-day.today .cal-wd { color: var(--accent); }
.cal-day.today .cal-dn { box-shadow: inset 0 0 0 1.5px var(--accent); color: var(--accent); }
.cal-day.selected .cal-dn { background: var(--accent); color: var(--accent-text); box-shadow: none; }
.cal-day.off .cal-dn { color: var(--hint); }
.cal-day.off.selected .cal-dn { color: var(--accent-text); }
.cal-dots { display: flex; gap: 3px; block-size: 5px; }
.cal-dot { inline-size: 5px; block-size: 5px; border-radius: 3px; background: rgb(var(--text-rgb) / 0.35); }
.cal-dot.due { background: var(--accent); }
.cal-dot.exam { background: rgb(255 149 0); }

/* ---------- the grid's header row: the date strip of the Неделя mode ---------- */
button.wk-day {
  min-width: 0; min-height: 44px; border: 0; border-radius: 10px; background: none; color: var(--text); font: inherit;
  cursor: pointer; -webkit-tap-highlight-color: transparent;
}
button.wk-day:active { background: rgb(var(--text-rgb) / 0.06); }
.wk-day .cal-dots { margin-block: 1px; }

/* ---------- the grid's cells (release 6 adds to shell.css .wk-*) ---------- */
.cal .wk-grid-host, .cal .cal-dayview { touch-action: pan-y; }
.cal .wk-lesson { position: relative; gap: 2px; padding-block: 4px; padding-inline-end: 2px; }
.wk-top { display: flex; align-items: center; gap: 3px; min-width: 0; }
/* the parity badge sits after the type icon (the cell's upper corner is the correction's dot) */
.wk-par {
  flex: none; display: inline-grid; place-items: center; min-inline-size: 12px; block-size: 12px; padding: 0 2px;
  border-radius: 4px; font-size: 8.5px; font-weight: 800; line-height: 1; background: rgb(var(--bg-rgb) / 0.85);
  color: var(--text);
}
/* the icon and the badge, then the room: it takes a line of its own when the cell is narrow; a room that still
   doesn't fit is left out (week.js fitRooms: a cut «3/2…» would point to the wrong room; the sheet has it) */
.wk-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 1px 3px; min-width: 0; }
.wk-room.cut { display: none; }
.wk-kind { flex: none; display: inline-grid; color: rgb(var(--tint-rgb, var(--text-rgb))); opacity: .85; }
.wk-kind .ico { width: 11px; height: 11px; stroke-width: 2.4; }
.wk-room.changed { color: var(--accent); font-weight: 600; letter-spacing: -.02em; }
/* a parity class: a badge (Н/Ч · T/J · O/E) AND a light hatching (never colour alone) */
.wk-lesson.par {
  background-image: repeating-linear-gradient(-45deg, rgb(var(--tint-rgb) / 0.16) 0 2px, transparent 2px 7px);
}
/* an overlay: its own colour mark and a dot pattern, never the subject's tint */
.wk-lesson.lp {
  border-inline-start: 3px solid rgb(var(--layer-rgb)); border-left-color: rgb(var(--layer-rgb));
  background-color: rgb(var(--layer-rgb) / 0.14);
  background-image: radial-gradient(rgb(var(--layer-rgb) / 0.42) 1px, transparent 1.4px);
  background-size: 6px 6px;
}
.wk-lesson.lp .wk-kind { color: rgb(var(--layer-rgb)); }
.wk-lesson.layer-peek { opacity: .8; }
/* «не моё»: dimmed and dotted, never hidden */
.wk-lesson.dim {
  opacity: .5; background: none; border-left: 0; border-inline-start: 0;
  outline: 1.5px dotted rgb(var(--text-rgb) / 0.45); outline-offset: -2px;
}
/* an intersection of two layers: ringed */
.wk-lesson.cross { box-shadow: inset 0 0 0 2px rgb(255 149 0); }
.wk-lesson.cross.now { box-shadow: inset 0 0 0 2px var(--accent), 0 0 0 2px rgb(255 149 0); }
.wk-cell.offme { background: repeating-linear-gradient(-45deg, rgb(var(--text-rgb) / 0.05) 0 6px, transparent 6px 12px); }
.wk-day.offme .wk-tag { background: rgb(var(--accent-rgb) / 0.14); color: var(--accent); }
.wk-uncovered.hatch {
  background: repeating-linear-gradient(-45deg, rgb(var(--text-rgb) / 0.06) 0 8px, transparent 8px 16px), var(--bg2);
}
.wk-uncovered-actions .btn { max-width: 100%; height: auto; min-height: 44px; white-space: normal; }

/* Release 11.1 (docs/telegram-bot/release-11-1-contract.md §6.3): the leaders' question while the shown week is inside an
   overlap nobody decided — a calm inset card under the grid, solid (never glass), never a badge: the question, the
   sub-line, «Да» (primary, small) and «Оставить старые» (plain). Its absence takes no room. */
.wk-pending-host:empty { display: none; }
.wk-pending {
  display: grid; gap: 4px; margin-block-start: 12px; padding: 14px 16px; border-radius: 16px;
  background: var(--bg2); box-shadow: inset 0 0 0 1px var(--sep);
}
.wk-pending-title { margin: 0; font-size: 16px; font-weight: 600; line-height: 1.3; overflow-wrap: anywhere; }
.wk-pending-sub { margin: 0; font-size: 14px; line-height: 1.35; color: var(--subtitle); overflow-wrap: anywhere; }
.wk-pending-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-block-start: 8px; }
.wk-pending-actions .btn { min-height: 44px; min-inline-size: 76px; max-width: 100%; height: auto; white-space: normal; }
@media (prefers-contrast: more) {
  .wk-pending { box-shadow: inset 0 0 0 1px var(--text); }
  .wk-pending-sub { color: var(--text); }
}
.wk-legend.always { display: flex; }
.wk-key-layer b, .wk-key-dim b { inline-size: 22px; block-size: 14px; padding: 0; border-left: 0; border-radius: 4px; }
.wk-key-layer b { border-inline-start: 3px solid rgb(var(--layer-rgb)); }
.wk-key-layer b.lp {
  background-color: rgb(var(--layer-rgb) / 0.14);
  background-image: radial-gradient(rgb(var(--layer-rgb) / 0.55) 1px, transparent 1.4px); background-size: 6px 6px;
}
.wk-key-dim b { background: none; outline: 1.5px dotted rgb(var(--text-rgb) / 0.5); outline-offset: -2px; }
@media (min-width: 480px) { .wk-legend.always .wk-key:not(.wk-key-layer):not(.wk-key-dim) { display: none; } }

/* ---------- the Day view ---------- */
.cal-dayview { margin-top: 10px; transition: opacity .2s ease; }
.cal-dayview.loading { opacity: .5; }
.cal-day-bar { display: flex; align-items: center; gap: 6px; }
.cal-day-bar .wk-nav { width: 44px; height: 44px; border-radius: 22px; }   /* 44 pt (spec §10) */
.cal-day-title { flex: 1; min-width: 0; margin: 0; font-size: 20px; font-weight: 700; text-align: center; overflow-wrap: anywhere; }
.cal-day-body { margin-top: 8px; touch-action: pan-y; }
.cal-day-head { margin: 4px 4px 0; font-size: 17px; font-weight: 600; }
.cal-day-head.holiday, .cal-day-head.break, .cal-day-head.off_me { color: var(--accent); }
.cal-day-note { margin: 4px 4px 0; font-size: 14px; line-height: 1.4; color: var(--subtitle); }
.cal-day-list { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.cal-lesson {
  display: flex; align-items: stretch; gap: 12px; min-height: 64px; padding: 10px 12px; border: 0;
  border-inline-start: 4px solid rgb(var(--tint-rgb, var(--text-rgb))); border-radius: 14px;
  background: var(--bg2); color: var(--text); font: inherit; text-align: start; cursor: pointer;
}
.cal-lesson:active { scale: .985; }
.cal-lesson.past { opacity: .55; }
.cal-lesson.now { box-shadow: inset 0 0 0 2px var(--accent); }
/* an overlay's row: its colour edge, a light wash and the dot pattern in a band at the end (never under the text) */
.cal-lesson.lp {
  border-inline-start-color: rgb(var(--layer-rgb)); padding-inline-end: 26px;
  background-color: var(--bg2);
  background-image: linear-gradient(to left, rgb(var(--bg2-rgb) / 0) 0 16px, rgb(var(--bg2-rgb)) 16px),
                    radial-gradient(rgb(var(--layer-rgb) / 0.6) 1px, transparent 1.4px);
  background-size: auto, 6px 6px;
}
[dir="rtl"] .cal-lesson.lp {
  background-image: linear-gradient(to right, rgb(var(--bg2-rgb) / 0) 0 16px, rgb(var(--bg2-rgb)) 16px),
                    radial-gradient(rgb(var(--layer-rgb) / 0.6) 1px, transparent 1.4px);
}
.cal-lesson.dim { opacity: .55; background: none; border-inline-start-style: dotted;
  outline: 1.5px dotted rgb(var(--text-rgb) / 0.4); outline-offset: -2px; }
.cal-lesson.off .cal-lesson-subject { text-decoration: line-through; }
.cal-lesson.cross { box-shadow: inset 0 0 0 2px rgb(255 149 0); }
.cal-lesson.par .cal-lesson-time b::after { content: ''; }
.cal-lesson-time {
  flex: none; display: flex; flex-direction: column; align-items: flex-end; inline-size: 46px;
  font-variant-numeric: tabular-nums;
}
.cal-lesson-time b { font-size: 15px; font-weight: 700; }
.cal-lesson-time span { font-size: 13px; color: var(--hint); }
.cal-lesson-n { margin-top: auto; font-size: 11px; font-weight: 700; color: var(--subtitle); }
.cal-lesson-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.cal-lesson-title { display: flex; align-items: center; gap: 8px; min-width: 0; }
.cal-lesson-title .rv-badge { inline-size: 28px; block-size: 28px; border-radius: 8px; font-size: 12px; flex: none; }
.cal-lesson.lp .rv-badge { background: rgb(var(--layer-rgb) / 0.2); color: var(--text); }
.cal-lesson-subject { min-width: 0; font-size: 16px; font-weight: 600; line-height: 1.25; overflow-wrap: anywhere; }
.cal-lesson-sub { display: flex; align-items: center; gap: 5px; min-width: 0; font-size: 14px; color: var(--subtitle); }
.cal-lesson-sub span:last-child { min-width: 0; overflow-wrap: anywhere; }
.cal-lesson-note { font-size: 13px; color: var(--hint); overflow-wrap: anywhere; }
.cal-gap { display: flex; align-items: center; gap: 10px; padding: 0 12px 0 66px; font-size: 13px; color: var(--hint); }
.cal-gap-line { flex: none; inline-size: 2px; block-size: 18px; border-radius: 1px;
  background: repeating-linear-gradient(to bottom, rgb(var(--text-rgb) / 0.3) 0 3px, transparent 3px 6px); }
.cal-due .row-title, .cal-exam .row-title { overflow-wrap: anywhere; }
.cal-due.done .row-title { text-decoration: line-through; color: var(--hint); }

/* ---------- the month sheet and the semester ---------- */
.cal-month { padding-bottom: 8px; }
.cal-month-head { display: flex; align-items: center; gap: 8px; padding: 0 4px; }
.cal-month-head-text { flex: 1; min-width: 0; }
.cal-month-head .cal-title { font-size: 24px; line-height: 1.2; font-weight: 700; }
.cal-month-head .cal-title.fit-1 { font-size: 20px; }      /* month.js fitHead: the year never goes to «…» */
.cal-month-head .cal-title.fit-2 { font-size: 17px; }       /* a sheet title's own size (17 pt) */
.cal-term-strip {
  display: flex; gap: 4px; margin-top: 10px; padding: 2px 4px 6px; overflow-x: auto; overscroll-behavior-x: contain;
  scrollbar-width: none; -webkit-overflow-scrolling: touch;
}
.cal-term-strip::-webkit-scrollbar { display: none; }
.cal-wk {
  flex: none; min-inline-size: 44px; min-height: 44px; padding: 0 8px; border: 0; border-radius: 10px;
  background: rgb(var(--text-rgb) / 0.07); color: var(--text); font: inherit; font-size: 13px; font-weight: 600;
  font-variant-numeric: tabular-nums; cursor: pointer;
}
.cal-wk.past { color: var(--hint); }
.cal-wk.current { background: var(--accent); color: var(--accent-text); }
.cal-wk.exams { background: rgb(255 149 0 / 0.18); }
.cal-wk.break { background: rgb(52 199 89 / 0.16); }
.cal-wk.not_in_file {
  background: repeating-linear-gradient(-45deg, rgb(var(--text-rgb) / 0.09) 0 6px, transparent 6px 12px);
  color: var(--subtitle); font-weight: 500; white-space: nowrap;
}
.cal-month-nav { flex: none; display: flex; gap: 6px; }
.cal-month-nav[hidden] { display: none; }
.cal-month-nav .wk-nav { width: 44px; height: 44px; border-radius: 22px; }
.cal-mgrid-host { margin-top: 4px; touch-action: pan-y; }
.cal-mgrid { display: flex; flex-direction: column; gap: 2px; }
.cal-mgrid-wd, .cal-mgrid-row { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 2px; }
.cal-mgrid-wd span { padding-bottom: 4px; font-size: 11px; font-weight: 600; color: var(--hint); text-align: center; text-transform: uppercase; }
.cal-mday {
  display: flex; flex-direction: column; align-items: center; gap: 3px; min-width: 0; min-height: 46px;
  padding: 4px 0; border: 0; border-radius: 12px; background: none; color: var(--text); font: inherit; cursor: pointer;
}
.cal-mday.out { cursor: default; }
.cal-mday:active:not(.out) { background: rgb(var(--text-rgb) / 0.06); }
.cal-mday-n {
  display: grid; place-items: center; inline-size: 28px; block-size: 28px; border-radius: 14px;
  font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums;
}
.cal-mday.today .cal-mday-n { background: var(--accent); color: var(--accent-text); }
.cal-mday.off .cal-mday-n { color: var(--hint); }
.cal-mday.unknown { background: repeating-linear-gradient(-45deg, rgb(var(--text-rgb) / 0.05) 0 5px, transparent 5px 10px); }
.cal-mgrid.compact { gap: 1px; pointer-events: none; }
.cal-mgrid.compact .cal-mgrid-row { gap: 1px; }
.cal-mgrid.compact .cal-mday { min-height: 22px; padding: 1px 0; gap: 1px; }
.cal-mgrid.compact .cal-mday-n { inline-size: 18px; block-size: 18px; font-size: 10.5px; }
.cal-mgrid.compact .cal-dot { inline-size: 3px; block-size: 3px; }
.cal-mgrid.compact .cal-dots { block-size: 3px; gap: 1px; }
.cal-sem { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 8px; }
.cal-sem-month {
  display: flex; flex-direction: column; gap: 4px; min-width: 0; padding: 8px; border: 0; border-radius: 14px;
  background: var(--bg2); color: var(--text); font: inherit; text-align: start; cursor: pointer;
}
.cal-sem-title { font-size: 14px; font-weight: 700; }
.cal-month .group { margin-top: 12px; }

/* ---------- the pair sheet's layer lines and personal verbs ---------- */
.rv-pair-layer { margin: 10px 4px 0; font-size: 14px; font-weight: 600; color: var(--subtitle); }
.rv-pair-layer.extra, .rv-pair-layer.personal, .rv-pair-layer.peek { color: var(--text); }
.rv-pair-cross { margin: 6px 4px 0; font-size: 14px; color: rgb(201 105 0); }
:root[data-scheme="dark"] .rv-pair-cross { color: rgb(255 179 64); }
.rv-pair-notmine { display: grid; gap: 8px; margin-top: 12px; }
.rv-pair-notmine[hidden], .rv-pair-subgroup[hidden] { display: none; }
.rv-pair-why { margin: 0 4px; font-size: 14px; line-height: 1.4; color: var(--subtitle); }
.rv-pair-subgroup { display: grid; gap: 8px; margin-top: 16px; padding: 12px; border-radius: 14px; background: var(--bg2); }
.rv-pair-q { margin: 0 0 2px; font-size: 16px; font-weight: 600; }
.rv-pair-subgroup .btn, .rv-pair-notmine .btn { height: auto; min-height: 44px; white-space: normal; }

@media (max-width: 359px) {
  .cal-dn { inline-size: 26px; block-size: 26px; font-size: 15px; }
  .wk-par { display: none; }                     /* the hatching and the sheet still say it */
  .cal-lesson-time { inline-size: 40px; }
  .cal-gap { padding-inline-start: 56px; }
  .cal-month-nav { gap: 2px; }                    /* month.js fitHead steps the sheet's title down (below) */
}
@media (prefers-reduced-motion: reduce) {
  .cal-month-btn .ico, .cal-dayview { transition: none; }
}
@media (prefers-contrast: more) {
  .cal-wd, .cal-weekline, .cal-lesson-time span, .cal-lesson-note, .cal-day-note, .cal-gap { color: var(--text); }
  .wk-lesson.dim, .cal-lesson.dim { opacity: .8; outline-color: var(--text); }
  .cal-wk { box-shadow: inset 0 0 0 1px var(--sep); }
}

/* ---------- the Now river's classes of other layers (one river, spec §5.13) ---------- */
.rv-lesson.lp {
  border-inline-start-color: rgb(var(--layer-rgb)); padding-inline-end: 26px;
  background-image: linear-gradient(to left, rgb(var(--bg2-rgb) / 0) 0 16px, rgb(var(--bg2-rgb)) 16px),
                    radial-gradient(rgb(var(--layer-rgb) / 0.6) 1px, transparent 1.4px);
  background-size: auto, 6px 6px;
}
.rv-lesson.ld { opacity: .55; outline: 1.5px dotted rgb(var(--text-rgb) / 0.4); outline-offset: -2px; }
.rv-l-layer { color: var(--hint); }
.rv-pair-head.lp-head .rv-badge { background: rgb(var(--layer-rgb) / 0.22); box-shadow: inset 0 0 0 2px rgb(var(--layer-rgb)); }
.rv-pair-head.ld-head { opacity: .65; }

/* ======================================================================================================================
   Release 11 «Большой экран» (docs/telegram-bot/release-11-contract.md §7.2): the Week on medium (700–1023) and wide
   (≥ 1024). Every rule is under :root:not([data-layout="compact"]) or :root[data-layout="wide"]: the phone is exactly as
   above. The Week asks for the whole content area (week.js width: 'full', ≤ 1280).
     medium   the row header names the bell's whole time («II» over «10:00–11:20»), full names, rooms whole
     wide     + the teacher's short name in a cell, rows ≥ 72 px, today's column tinted; the Week's sections in a 320 px
              column beside the grid from a content area of 1180 (week.js .wk-cols); the Day as a timeline
   On the big screen a word of a cell's name that is wider than the cell carries soft hyphens (week.js fitNames,
   week_model.fitNames): a narrow column breaks «Ekonomet-rika», never «Ekonometrik / a»; a word that fits stays whole.
   Medium and a wide window whose content is under 900 px (1024 or 1180 with the sidebar): no teacher, the name on up to
   four lines of 13.5 px (a 60 px column needs «Moliya-/viy/menej-/ment»: the row grows, the name is never cut); wide
   with room (.wk-roomy): two lines of 14 px and the teacher. Two classes in one slot (.split): each keeps its whole
   lines — the halves never shrink below their content (the row grows instead), so no name is sliced mid-line.
   ====================================================================================================================== */

:root:not([data-layout="compact"]) .wk-grid {
  grid-template-columns: 84px repeat(var(--cols, 6), minmax(0, 1fr));
  grid-template-rows: auto repeat(var(--rows, 4), minmax(64px, auto));
  gap: 4px; padding: 8px; border-radius: 20px;
}
:root:not([data-layout="compact"]) .wk-pair { gap: 2px; padding-inline: 2px; }
:root:not([data-layout="compact"]) .wk-pair b { font-size: 14px; }
:root:not([data-layout="compact"]) .wk-pair span { font-size: 11.5px; white-space: nowrap; direction: ltr; unicode-bidi: isolate; }
:root:not([data-layout="compact"]) .wk-wd { font-size: 12px; }
:root:not([data-layout="compact"]) .wk-dn { min-width: 28px; height: 28px; border-radius: 14px; font-size: 16px; }
:root:not([data-layout="compact"]) .cal .wk-lesson { gap: 3px; padding: 6px 6px 6px 8px; border-radius: 10px; }
:root:not([data-layout="compact"]) .wk-full { font-size: 13.5px; line-height: 1.25; -webkit-line-clamp: 4; flex-shrink: 0; }
:root:not([data-layout="compact"]) .wk-cell.split .wk-lesson { flex: 1 0 auto; }
:root:not([data-layout="compact"]) .wk-room { font-size: 12px; overflow: visible; }
:root:not([data-layout="compact"]) .wk-kind .ico { width: 13px; height: 13px; }
:root:not([data-layout="compact"]) .wk-par { block-size: 14px; font-size: 10px; }
:root:not([data-layout="compact"]) .wk-cell.split .wk-room { display: inline; }      /* the big screen has room for it */

/* wide: whole names (two lines with room), the teacher, taller rows, today's column tinted top to bottom. */
:root[data-layout="wide"] .wk-grid { grid-template-rows: auto repeat(var(--rows, 4), minmax(72px, auto)); }
:root[data-layout="wide"] .wk.wk-roomy .wk-full { font-size: 14px; -webkit-line-clamp: 2; }
:root[data-layout="wide"] .wk-teacher {
  min-width: 0; font-size: 11.5px; line-height: 1.25; color: var(--subtitle);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
:root[data-layout="wide"] .wk-cell.split .wk-teacher { display: none; }               /* two classes share the slot */
:root[data-layout="wide"] button.wk-day.today { background: rgb(var(--accent-rgb) / 0.08); }
:root[data-layout="wide"] .cal-strip-row { margin-top: 12px; }

/* wide, content ≥ 1180: the Week's sections and the calendar notes beside the grid (week.js applySide). */
:root[data-layout="wide"] .wk.wk-cols {
  display: grid; grid-template-columns: minmax(0, 1fr) 320px; column-gap: 28px; align-items: start;
}
:root[data-layout="wide"] .wk-cols > .cal-head { grid-column: 1 / -1; grid-row: 1; }
:root[data-layout="wide"] .wk-cols > .wk-main { grid-column: 1; grid-row: 2; min-width: 0; }
:root[data-layout="wide"] .wk-cols > .wk-side {
  grid-column: 2; grid-row: 2; min-width: 0; margin-top: 10px;
  position: sticky; inset-block-start: calc(var(--sat) + 16px);
  max-block-size: calc(100dvh - var(--sat) - var(--sab) - 32px); overflow-y: auto; overscroll-behavior: contain;
  scrollbar-width: thin; scrollbar-color: rgb(var(--text-rgb) / 0.25) transparent;
}
:root[data-layout="wide"]:not([data-sidebar]) .wk-cols > .wk-side {
  inset-block-start: calc(var(--sat) + var(--topbar-h) + 22px);
  max-block-size: calc(100dvh - var(--sat) - var(--topbar-h) - var(--sab) - 40px);
}
:root[data-layout="wide"] .wk-side > div > .group:first-child,
:root[data-layout="wide"] .wk-side > .sections > .feature-section:first-child > .group-title { margin-top: 0; }

/* The Day view on wide: a timeline 08:00–20:00 at full width (day.js timelineNode, week_model.timeline). */
:root[data-layout="wide"] .cal-tl {
  display: grid; grid-template-columns: 52px minmax(0, 1fr); margin-top: 14px; padding-block: 8px;
  block-size: calc(var(--tl-hours, 12) * 64px + 16px); box-sizing: border-box;
}
:root[data-layout="wide"] .cal-tl-hours, :root[data-layout="wide"] .cal-tl-track { position: relative; }
:root[data-layout="wide"] .cal-tl-hour {
  position: absolute; inset-inline-end: 10px; translate: 0 -50%;
  font-size: 12px; font-weight: 600; color: var(--hint); font-variant-numeric: tabular-nums;
}
:root[data-layout="wide"] .cal-tl-rule {
  position: absolute; inset-inline: 0; block-size: 0; border-block-start: .5px solid var(--sep);
}
/* A past class and one «не моё» fade their words, never their card: the hour rules stay under it, unseen. «Не моё»
   keeps its dotted edge on the page's own colour. */
:root[data-layout="wide"] .cal-tl-item.past, :root[data-layout="wide"] .cal-tl-item.dim { opacity: 1; }
:root[data-layout="wide"] .cal-tl-item.past > *, :root[data-layout="wide"] .cal-tl-item.dim > * { opacity: .55; }
:root[data-layout="wide"] .cal-tl-item.dim { background: var(--bg); outline-color: rgb(var(--text-rgb) / 0.25); }
:root[data-layout="wide"] .cal-tl-item {
  position: absolute; z-index: 1; min-height: 0; box-sizing: border-box; overflow: hidden; padding-block: 6px; gap: 10px;
  border-radius: 12px; box-shadow: 0 0 0 1.5px var(--bg);                   /* a hairline of page between neighbours */
}
:root[data-layout="wide"] .cal-tl-item.short { padding-block: 3px; }
:root[data-layout="wide"] .cal-tl-item.short .cal-lesson-n,
:root[data-layout="wide"] .cal-tl-item.short .cal-lesson-note { display: none; }
:root[data-layout="wide"] .cal-tl-item.now { box-shadow: inset 0 0 0 2px var(--accent), 0 0 0 1.5px var(--bg); }
/* A window's words stand above the moment's line (z-index 3 over the line's 2), on the page's colour. */
:root[data-layout="wide"] .cal-tl-gap {
  position: absolute; z-index: 3; inset-inline: 0; display: flex; align-items: center; justify-content: flex-end;
  min-height: 0; padding-inline-end: 12px; font-size: 13px; color: var(--hint); pointer-events: none;
}
:root[data-layout="wide"] .cal-tl-gap span { padding: 2px 10px; border-radius: 10px; background: var(--bg); }
:root[data-layout="wide"] .cal-tl-now {
  position: absolute; inset-inline: -6px 0; z-index: 2; block-size: 0; border-block-start: 2px solid var(--accent);
  pointer-events: none;
}
:root[data-layout="wide"] .cal-tl-now::before {
  content: ""; position: absolute; inset-inline-start: -4px; inset-block-start: -6px;
  inline-size: 10px; block-size: 10px; border-radius: 5px; background: var(--accent);
}

/* The month sheet: a panel on medium / wide (the shell), a little wider at wide for its seven columns and the semester.
   Its own header (header: false) leaves the panel's ✕ its 44 pt corner: the ‹ › never sit under it. */
:root[data-layout="wide"] .sheet-wrap:not(.as-popover) .sheet:has(> .screen[data-screen="month"]) { max-width: 640px; }
:root:not([data-layout="compact"]) .sheet-wrap:not(.as-popover) .screen[data-screen="month"] .cal-month-head {
  padding-inline-end: 44px;
}
:root:not([data-layout="compact"]) .cal-mday { min-height: 52px; }

/* Pointer: cells, rows and days answer the mouse (hover only with a fine pointer, never the only carrier). */
@media (hover: hover) and (pointer: fine) {
  :root:not([data-layout="compact"]) .wk-lesson:hover { filter: brightness(.97); }
  :root[data-scheme="dark"]:not([data-layout="compact"]) .wk-lesson:hover { filter: brightness(1.15); }
  :root:not([data-layout="compact"]) :is(button.wk-day, .cal-day, .cal-mday:not(.out), .cal-wk, .cal-sem-month):hover {
    background-color: rgb(var(--text-rgb) / 0.05);
  }
  :root:not([data-layout="compact"]) .cal-lesson:not(.lp):hover {
    background-image: linear-gradient(rgb(var(--text-rgb) / 0.04), rgb(var(--text-rgb) / 0.04));
  }
  :root:not([data-layout="compact"]) .wk-nav:not(:disabled):hover { background: rgb(var(--text-rgb) / 0.1); }
}
@media (prefers-contrast: more) {
  :root[data-layout="wide"] .cal-tl-rule { border-block-start-color: var(--text); }
  :root[data-layout="wide"] .cal-tl-hour, :root[data-layout="wide"] .wk-teacher { color: var(--text); }
}
@media (hover: hover) and (pointer: fine) and (prefers-reduced-motion: reduce) {
  :root:not([data-layout="compact"]) .wk-lesson:hover { filter: none; }
}

/* Release 12 «Магнит» (docs/telegram-bot/release-12-contract.md §8.4–§8.6; week.js, magnet.js). Medium / wide only, like
   everything after the release-11 mark: the phone's grid has no chip row, no pick, no drag.
     the chips     the person's own deadlines (and, plain, a group chat's) in a row under their day's header; an own
                   one with a subject can be carried across the grid: the classes of its subject light up, the one it
                   would land on is ringed, a ghost with the live label «к семинару · пт 10:00» follows the hand
     the picks     the leaders' classes picked with Shift / ⌘ / Ctrl: ringed in the accent, one solid bar under the grid
     drag out      a class carries text and an .ics out of the window (the grab cursor says so) */
:root:not([data-layout="compact"]) .wk-grid.has-due {
  grid-template-rows: auto auto repeat(var(--rows, 4), minmax(64px, auto));
}
:root[data-layout="wide"] .wk-grid.has-due { grid-template-rows: auto auto repeat(var(--rows, 4), minmax(72px, auto)); }
:root:not([data-layout="compact"]) .wk-due { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
:root:not([data-layout="compact"]) .wk-due:empty { display: none; }
:root:not([data-layout="compact"]) .wk-chip {
  display: flex; align-items: center; gap: 4px; inline-size: 100%; min-width: 0; min-height: 28px; box-sizing: border-box;
  padding-block: 3px; padding-inline: 8px; border: 0; border-radius: 9px; background: rgb(var(--accent-rgb) / 0.12);
  color: var(--text); font: inherit; font-size: 12px; font-weight: 600; text-align: start; cursor: pointer;
  touch-action: none; -webkit-tap-highlight-color: transparent; position: relative;
}
/* the chip is 28 px tall: its touch target reaches 44 pt through a transparent band (polish 3's rule) */
:root:not([data-layout="compact"]) .wk-chip::after { content: ""; position: absolute; inset: -8px 0; }
:root:not([data-layout="compact"]) .wk-chip.group { background: rgb(var(--text-rgb) / 0.07); color: var(--subtitle); }
:root:not([data-layout="compact"]) .wk-chip.movable { cursor: grab; }
:root:not([data-layout="compact"]) .wk-chip.lifted { opacity: .35; }
:root:not([data-layout="compact"]) .wk-chip-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
:root:not([data-layout="compact"]) .wk-chip-ico { flex: none; display: inline-grid; }
:root:not([data-layout="compact"]) .wk-chip-ico .ico { inline-size: 12px; block-size: 12px; }
:root:not([data-layout="compact"]) .wk-chip:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
:root:not([data-layout="compact"]) .wk-chip-ghost {
  position: fixed; inset: 0 auto auto 0; z-index: 25; display: grid; gap: 1px; max-inline-size: 240px;
  padding-block: 6px; padding-inline: 10px; border-radius: 12px; background: var(--bg2); color: var(--text);
  box-shadow: 0 10px 30px rgb(0 0 0 / 0.2), inset 0 0 0 1.5px rgb(var(--accent-rgb) / 0.5);
  pointer-events: none; transition: transform var(--spring-micro-dur, 250ms) var(--spring-micro, ease);
}
:root:not([data-layout="compact"]) .wk-chip-ghost.on { box-shadow: 0 12px 34px rgb(var(--accent-rgb) / 0.3), inset 0 0 0 2px var(--accent); }
:root:not([data-layout="compact"]) .wk-chip-ghost-title { font-size: 13px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
:root:not([data-layout="compact"]) .wk-chip-ghost-label { font-size: 12px; color: var(--subtitle); white-space: nowrap; }
:root:not([data-layout="compact"]) .wk-chip-ghost.on .wk-chip-ghost-label { color: var(--accent); font-weight: 600; }
:root:not([data-layout="compact"]) .wk-lesson.snap-ok { box-shadow: inset 0 0 0 2px rgb(var(--accent-rgb) / 0.45); }
:root:not([data-layout="compact"]) .wk-lesson.snap-on { box-shadow: inset 0 0 0 2.5px var(--accent); transform: scale(1.03); }
:root:not([data-layout="compact"]) .wk-lesson.picked { box-shadow: inset 0 0 0 2.5px var(--accent); }
:root:not([data-layout="compact"]) .wk-lesson.picked::before {
  content: ""; position: absolute; inset-block-end: 4px; inset-inline-end: 4px; inline-size: 8px; block-size: 8px;
  border-radius: 4px; background: var(--accent);       /* the bottom corner: the top one is the correction's dot */
}
:root:not([data-layout="compact"]) .wk-lesson[draggable="true"] { -webkit-user-drag: element; }

/* The leaders' bar: solid, under the grid, sticky at the bottom of the window while the grid scrolls. */
:root:not([data-layout="compact"]) .wk-pick-host:empty { display: none; }
:root:not([data-layout="compact"]) .wk-pick {
  position: sticky; inset-block-end: calc(var(--sab) + 12px); z-index: 3; display: flex; flex-wrap: wrap; align-items: center;
  gap: 8px; margin-block-start: 10px; padding-block: 8px; padding-inline: 16px 6px; border-radius: 18px;
  background: var(--bg2); box-shadow: 0 8px 28px rgb(0 0 0 / 0.14), inset 0 0 0 1px var(--sep);
}
:root:not([data-layout="compact"]) .wk-pick-count { flex: 1; min-width: 0; font-size: 15px; font-weight: 700; }
:root:not([data-layout="compact"]) .wk-pick .btn { min-height: 44px; height: auto; white-space: normal; }
:root:not([data-layout="compact"]) .wk-pick-clear {
  display: inline-grid; place-items: center; inline-size: 44px; block-size: 44px; border: 0; border-radius: 22px;
  background: none; color: var(--hint); cursor: pointer;
}
/* Release 12 review: how to pick several, a quiet line under the grid (never a bar until something is picked) */
:root:not([data-layout="compact"]) .wk-pick-hint {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 12px;
  margin-block-start: 8px; padding-inline: 4px; color: var(--hint); font-size: 13px;
}
:root:not([data-layout="compact"]) .wk-pick-hint-text { min-width: 0; }
:root:not([data-layout="compact"]) .wk-pick-start {
  min-block-size: 44px; padding-inline: 12px; border: 0; border-radius: 22px; background: none; color: var(--accent);
  font: inherit; font-weight: 600; cursor: pointer;
}
:root:not([data-layout="compact"]) .wk-pick-start.on { background: rgb(var(--accent-rgb) / 0.12); }
@media (hover: hover) and (pointer: fine) {
  :root:not([data-layout="compact"]) .wk-chip:hover { background: rgb(var(--accent-rgb) / 0.2); }
  :root:not([data-layout="compact"]) .wk-chip.group:hover { background: rgb(var(--text-rgb) / 0.11); }
  :root:not([data-layout="compact"]) .wk-pick-clear:hover { background: rgb(var(--text-rgb) / 0.08); }
  :root:not([data-layout="compact"]) .wk-pick-start:hover { background: rgb(var(--accent-rgb) / 0.08); }
}
@media (prefers-reduced-motion: reduce) {
  :root:not([data-layout="compact"]) .wk-chip-ghost { transition: none; }
  :root:not([data-layout="compact"]) .wk-lesson.snap-on { transform: none; }
}
@media (prefers-contrast: more) {
  :root:not([data-layout="compact"]) .wk-chip.group, :root:not([data-layout="compact"]) .wk-chip-ghost-label { color: var(--text); }
  :root:not([data-layout="compact"]) .wk-pick { box-shadow: inset 0 0 0 1px var(--text); }
}
