#app:has(.teacher-week) { max-width: 1800px; }
.new-year #app:has(.teacher-week) { width: 100%; z-index: 6; }
.teacher-week-page { grid-template-columns: minmax(0, 1fr); }
.teacher-week-page > :not(.teacher-week) { width: min(100%, 728px); justify-self: center; min-width: 0; }
.teacher-week {
  --week-bg: #14272a;
  --week-text: #f0f3f1;
  --week-secondary: #b6c8c9;
  min-width: 0;
  padding: clamp(10px, 2vw, 26px);
  border: 1px solid #485c55;
  border-radius: 22px;
  color: var(--week-text);
  background: radial-gradient(ellipse at 92% 0%, #373c30, transparent 47%), var(--week-bg);
}
.week-toolbar, .week-nav, .week-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.week-toolbar { justify-content: space-between; gap: 12px; }
.week-toolbar h1 { margin: 0; font-size: clamp(24px, 3vw, 36px); line-height: 1.15; }
.week-range { margin: 4px 0 0; color: var(--week-secondary); }
.week-nav button, .week-day-tabs button {
  min-height: 42px;
  padding: 6px 12px;
  border: 1px solid #566e68;
  border-radius: 10px;
  background: #243a3a;
  color: inherit;
  font: inherit;
  font-size: 14px;
  cursor: pointer;
}
.week-nav button:hover, .week-day-tabs button:hover { background: #38524c; }
.week-legend { margin: 14px 0 8px; padding: 0; list-style: none; color: var(--week-secondary); font-size: 13px; gap: 6px 16px; }
.week-legend li { display: flex; align-items: center; gap: 6px; }
.week-legend i { width: 12px; height: 12px; border: 1px solid #778f70; border-radius: 4px; background: #2b4137; }
.week-legend .week-key-regular { background: #254a78; border-color: #577bab; }
.week-legend .week-key-moved { background: #49412a; border: 1px dashed #e2b04a; }
.week-legend .week-key-closed { background: #223336; border-color: #607575; }
.week-grid { overflow-x: auto; margin-inline: -4px; }
.week-grid table { width: 100%; min-width: 910px; table-layout: fixed; border-collapse: separate; border-spacing: 6px; }
.week-grid .week-clock { width: 76px; }
.week-grid th { border: 0; font-weight: 600; }
.week-grid th[scope=col] {
  border-radius: 13px;
  padding: 6px;
  border: 1px solid #49635e;
  background: #2a3d3e;
}
.week-grid th[aria-current=date] { border-color: #c4aa65; background: #374c41; }
.week-grid th span { display: block; color: var(--week-secondary); font-size: 13px; }
.week-grid th[scope=row] { text-align: right; vertical-align: top; padding: 8px 3px 0 0; font-size: 12px; color: var(--week-secondary); }
.week-grid td { height: 69px; padding: 0; border: 0; vertical-align: top; text-align: start; border-radius: 13px; }
.week-grid .week-cell-open { border: 1px dashed #5e775f; background: #273f35; }
.week-cell-open .week-plus { display: block; width: 100%; min-height: 67px; padding: 6px 10px; text-align: left; border: 0; border-radius: inherit; background: transparent; color: #b7c8b3; font: inherit; font-size: 19px; cursor: pointer; }
.week-cell-open .week-plus:hover { background: #395747; color: #fff; }
.week-grid .week-cell-off { border: 1px solid #3b5555; background: #1d3133; }
.week-grid .week-cell-off > span { display: block; padding: 8px; font-size: 12px; color: #a6babd; }
.week-lesson { border: 1px solid #506e94; border-radius: 13px; background: #1d385c; overflow: hidden; }
.week-lesson + .week-lesson { margin-top: 5px; }
.week-lesson.week-moved { border: 1px dashed #c9a259; background: #423c2c; }
.week-lesson.week-past { background: #263d4c; border-color: #51666b; }
.week-lesson.week-past.week-moved { background: #3b382e; border-color: #ae8e57; }
.week-lesson a, .week-lesson > span { display: grid; gap: 2px; padding: 7px 8px; color: inherit; text-decoration: none; line-height: 1.25; overflow-wrap: anywhere; }
.week-lesson a:hover { background: #ffffff10; }
.week-lesson strong { font-size: 14px; }
.week-lesson-time, .week-lesson-meta { color: var(--week-secondary); font-size: 12px; }
.week-lesson-time { font-variant-numeric: tabular-nums; font-weight: 600; }
.week-lesson-status { color: #f1d89a; }
.week-lesson .week-move-button {
  display: block;
  width: 100%;
  min-height: 26px;
  border: 0;
  padding: 3px 8px;
  background: #101b2863;
  color: #e3eaf1;
  font: inherit;
  font-size: 12px;
  text-align: start;
  cursor: pointer;
}
.week-move-button:hover { background: #101b28a1; }
.week-continuation { padding: 7px 8px; color: var(--week-secondary); font-size: 12px; overflow-wrap: anywhere; }
.teacher-week :focus-visible { outline: 2px solid #efcb76; outline-offset: -2px; }
.week-grid .week-totals th, .week-grid .week-totals td {
  height: auto;
  padding: 8px 4px;
  border: 1px solid #547168;
  border-radius: 12px;
  background: #2a433e;
  color: var(--week-text);
  text-align: center;
  vertical-align: middle;
  font-weight: 700;
}
.week-grid .week-totals th span { font-size: 11px; }
.week-grid .week-totals td { font-size: 16px; }
.week-day-tabs { display: none; }
@media (max-width: 700px) {
  .week-day-tabs { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; margin-block: 10px 4px; }
  .week-day-tabs button { padding: 4px 1px; line-height: 1.15; }
  .week-day-tabs button[aria-pressed=true] { border-color: #e2b04a; background: #3a5044; }
  .week-grid table { min-width: 0; }
  .week-grid [data-week-day]:not(.week-selected) { display: none; }
  .week-grid td { height: 60px; }
  .week-cell-open .week-plus { min-height: 58px; }
  .week-lesson .week-move-button { min-height: 44px; }
  /* The teacher needs to compare several days while retaining readable names. */
  #teacher-week .week-grid table { min-width: 770px; border-spacing: 4px; }
  #teacher-week .week-grid .week-clock { width: 48px; }
  #teacher-week .week-grid [data-week-day]:not(.week-selected) { display: table-cell; }
  #teacher-week .week-grid tr > th:first-child {
    position: sticky; left: 0; z-index: 2; background: #162a27;
  }
  #teacher-week .week-grid td { height: 55px; }
  #teacher-week .week-lesson a, #teacher-week .week-lesson > span { padding: 5px; }
}
.week-legend .week-key-personal { background: #593e5d; border-color: #aa7fb0; }
.week-lesson.week-done { border-color: #739c79; }
.week-lesson.week-cancelled { border-color: #925f65; background: #4a2d37; }
.week-lesson.week-done .week-lesson-status { color: #b5dfb9; }
.week-lesson.week-cancelled .week-lesson-status { color: #ffd2d4; }
.week-lesson-actions { display: flex; flex-wrap: wrap; }
.week-lesson-actions .week-move-button { flex: 1 1 auto; width: auto; }
.week-grid .week-plus { display: block; width: 100%; min-height: 48px; color: #adbfaf; background: transparent; border: 0; border-radius: 12px; text-align: start; padding: 6px 10px; font-size: 19px; }
.week-cell-off .week-plus { color: #839d9c; }
.week-grid .week-plus:hover { background: #395747; color: #fff; }
.week-personal { display: grid; width: 100%; min-height: 54px; align-content: center; gap: 2px; padding: 6px 8px; border: 1px solid #97769c; border-radius: 12px; background: #4d3651; color: #f5e8f5; text-align: start; overflow-wrap: anywhere; }
.week-personal span { font-size: 12px; color: #e0c9df; }
.week-personal:hover { background: #644569; }

.week-legend .week-key-closed { background: #59303a; border-color: #c26e77; }
.week-legend .week-key-extra { background: #194f50; border-color: #78c8bb; }
.week-lesson.week-extra:not(.week-cancelled) { background: #194647; border-color: #71ac9d; }
.week-lesson.week-extra:not(.week-cancelled) .week-lesson-status { color: #b7eee2; }
.week-personal.week-blocked { background: #582d38; border-color: #c26e77; color: #fff0ef; }
.week-personal.week-blocked span { color: #eab9be; }
.week-personal.week-blocked:hover { background: #723c47; }

.week-legend .week-key-opening { background: #204e42; border-color: #83c7a6; }
.week-personal.week-opening { background: #204e42; border-color: #83c7a6; color: #e2fbec; }
.week-personal.week-opening span { color: #bce3d0; white-space: nowrap; }
.week-personal.week-opening:hover { background: #2b6253; }
