/*
 * Elementary timetable styles. Self-contained and scoped under .el-app so the
 * secondary timetable theme is untouched. Compact, spreadsheet-like, thin
 * lines, centered text. Light/dark via CSS variables toggled by data-theme.
 */

.el-app[data-theme="dark"] {
  --el-subject-highlight: rgba(96, 165, 250, 0.2);
  --el-subject-highlight-border: rgba(96, 165, 250, 0.55);
  --el-subject-highlight-text: #bfdbfe;
  --el-search-color-0-bg: rgba(234, 179, 8, 0.2);
  --el-search-color-0-border: rgba(234, 179, 8, 0.65);
  --el-search-color-0-text: #fde047;
  --el-search-color-1-bg: rgba(96, 165, 250, 0.2);
  --el-search-color-1-border: rgba(96, 165, 250, 0.6);
  --el-search-color-1-text: #bfdbfe;
  --el-search-color-2-bg: rgba(251, 146, 60, 0.22);
  --el-search-color-2-border: rgba(251, 146, 60, 0.65);
  --el-search-color-2-text: #fdba74;
  --el-search-color-3-bg: rgba(244, 114, 182, 0.22);
  --el-search-color-3-border: rgba(244, 114, 182, 0.65);
  --el-search-color-3-text: #f9a8d4;
  --el-bg: #0a0a0a;
  --el-fg: #f2f0eb;
  --el-muted: #8a8a8a;
  --el-line: #2b2b2b;
  --el-block-sep: #5a5a5a;
  --el-header-bg: #141414;
  --el-cell-bg: #0a0a0a;
  --el-accent: #b3d0ff;
  --el-glow: rgba(179, 208, 255, 0.55);
  --el-prep-fg: #8a8a8a;
  --el-prep-bg: #181e26;
  --el-sert-fg: #9a8a6a;
  --el-custom-fg: #7a8a9a;
  --el-overlay: rgba(0, 0, 0, 0.6);
  --el-share-bg: rgba(138, 180, 248, 0.24);
  --el-share-fg: #b3d0ff;
  --el-share-hover: rgba(138, 180, 248, 0.36);
  --el-panel-glass: rgba(20, 20, 20, 0.55);
  --el-panel-shadow: 0 -1px 0 rgba(255, 255, 255, 0.08),
    0 -8px 24px rgba(0, 0, 0, 0.18);
  --el-conflict-ring: #ef4444;
  --el-conflict-fill: rgba(239, 68, 68, 0.22);
  --el-conflict-text: #fecaca;
}

.el-app[data-theme="light"] {
  --el-subject-highlight: rgba(59, 130, 246, 0.18);
  --el-subject-highlight-border: rgba(59, 130, 246, 0.45);
  --el-subject-highlight-text: #1e40af;
  --el-search-color-0-bg: rgba(234, 179, 8, 0.18);
  --el-search-color-0-border: rgba(202, 138, 4, 0.6);
  --el-search-color-0-text: #a16207;
  --el-search-color-1-bg: rgba(59, 130, 246, 0.18);
  --el-search-color-1-border: rgba(59, 130, 246, 0.5);
  --el-search-color-1-text: #1d4ed8;
  --el-search-color-2-bg: rgba(234, 88, 12, 0.16);
  --el-search-color-2-border: rgba(234, 88, 12, 0.55);
  --el-search-color-2-text: #c2410c;
  --el-search-color-3-bg: rgba(219, 39, 119, 0.14);
  --el-search-color-3-border: rgba(219, 39, 119, 0.5);
  --el-search-color-3-text: #be185d;
  --el-bg: #ffffff;
  --el-fg: #161616;
  --el-muted: #6b6b6b;
  --el-line: #d8d8d8;
  --el-block-sep: #a8a8a8;
  --el-header-bg: #f3f3f3;
  --el-cell-bg: #ffffff;
  --el-accent: #1d4ed8;
  --el-glow: rgba(29, 78, 216, 0.4);
  --el-prep-fg: #6b6b6b;
  --el-prep-bg: #eaf0f6;
  --el-sert-fg: #7a6a4a;
  --el-custom-fg: #4a6a8a;
  --el-overlay: rgba(0, 0, 0, 0.45);
  --el-share-bg: #c2e7ff;
  --el-share-fg: #001d35;
  --el-share-hover: #a8d5f5;
  --el-panel-glass: rgba(255, 255, 255, 0.62);
  --el-panel-shadow: 0 -1px 0 rgba(0, 0, 0, 0.06),
    0 -6px 20px rgba(0, 0, 0, 0.05);
  --el-conflict-ring: #dc2626;
  --el-conflict-fill: rgba(254, 202, 202, 0.92);
  --el-conflict-text: #991b1b;
}

.el-app {
  background: var(--el-bg);
  color: var(--el-fg);
  height: 100vh;
  max-height: 100vh;
  overflow: hidden;
  font-family:
    "Inter",
    system-ui,
    -apple-system,
    sans-serif;
  font-size: 12px;
  display: flex;
  flex-direction: column;
  --el-strip-height: 44px;
  --el-sidebar-width: 210px;
}

/* ---- Top strip (logo + school / timetable context) ---- */
.el-top-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 48px;
  height: var(--el-strip-height);
  padding: 0 14px;
  background: var(--el-header-bg);
  border-bottom: 1px solid var(--el-line);
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 30;
}

.el-top-strip-left {
  display: flex;
  align-items: center;
  gap: 48px;
  min-width: 0;
}

.el-top-strip-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  margin-left: auto;
}

.el-presence-avatars {
  display: flex;
  align-items: center;
  margin-right: 18px;
}

.el-presence-avatars:not(:has(.el-user-avatar)) {
  display: none;
}

.el-presence-avatar-stack {
  display: flex;
  align-items: center;
}

.el-presence-avatar-stack .el-user-avatar {
  border: 2px solid var(--el-header-bg);
  margin-left: -8px;
  position: relative;
}

.el-presence-avatar-stack .el-user-avatar:first-child {
  margin-left: 0;
  z-index: 1;
}

.el-presence-avatar-stack .el-user-avatar:nth-child(2) { z-index: 2; }
.el-presence-avatar-stack .el-user-avatar:nth-child(3) { z-index: 3; }
.el-presence-avatar-stack .el-user-avatar:nth-child(4) { z-index: 4; }
.el-presence-avatar-stack .el-user-avatar:nth-child(5) { z-index: 5; }

.el-presence-overflow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 28px;
  margin-left: -8px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--el-line);
  color: var(--el-text-muted, #666);
  font-size: 11px;
  font-weight: 600;
  flex-shrink: 0;
  z-index: 6;
}

.el-share-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 32px;
  padding: 0 18px;
  border: none;
  border-radius: 999px;
  background: var(--el-share-bg);
  color: var(--el-share-fg);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  line-height: 1;
  letter-spacing: 0.01em;
}

.el-share-btn:hover {
  background: var(--el-share-hover);
  color: var(--el-share-fg);
}

.el-top-brand {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-shrink: 0;
}

.el-top-logo {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  flex-shrink: 0;
}

.el-top-brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.el-top-brand-name {
  font-weight: 600;
  font-size: 13px;
  color: var(--el-fg);
}

.el-top-brand-sub {
  font-size: 10px;
  color: var(--el-muted);
  letter-spacing: 0.03em;
}

.el-top-context {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
  font-size: 13px;
  color: var(--el-muted);
}

.el-top-school {
  font-weight: 500;
  color: var(--el-fg);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.el-top-sep {
  color: var(--el-muted);
  flex-shrink: 0;
}

.el-top-timetable {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.el-top-editable-name {
  display: inline-flex;
  max-width: 100%;
  min-width: 0;
}

.el-top-editable-name__display {
  cursor: text;
  border-radius: 4px;
  padding: 1px 4px;
  margin: -1px -4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.el-top-editable-name__display:hover {
  background: color-mix(in srgb, var(--el-fg) 8%, transparent);
}

.el-top-editable-name__input {
  font: inherit;
  color: inherit;
  font-weight: inherit;
  background: var(--el-bg);
  border: 1px solid var(--el-accent);
  border-radius: 4px;
  padding: 1px 6px;
  margin: -1px -4px;
  min-width: 8ch;
  max-width: min(280px, 40vw);
  outline: none;
}

.el-top-school .el-top-editable-name__input,
.el-top-school.el-top-editable-name__input {
  font-weight: 500;
  color: var(--el-fg);
}

/* ---- App shell: sidebar + main ---- */
.el-shell {
  display: flex;
  align-items: stretch;
  flex: 1;
  min-height: 0;
}

.el-workspace {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

.el-main {
  flex: 1 1 0%;
  min-width: 0;
  min-height: 0;
  overflow: auto;
}

/* ---- Sidebar ---- */
.el-sidebar {
  display: flex;
  flex-direction: column;
  width: 210px;
  flex-shrink: 0;
  background: var(--el-header-bg);
  border-right: 1px solid var(--el-line);
  position: sticky;
  top: var(--el-strip-height);
  align-self: flex-start;
  height: calc(100vh - var(--el-strip-height));
  transition: width 0.15s ease;
}

.el-sidebar--collapsed {
  width: 60px;
}

/* Hide every text label when collapsed; icons remain. */
.el-sidebar--collapsed .el-side-label {
  display: none;
}

.el-side-toggle-row {
  display: flex;
  justify-content: flex-end;
  padding: 8px 8px 0;
}

.el-sidebar--collapsed .el-side-toggle-row {
  justify-content: center;
}

.el-side-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  padding: 0;
  background: transparent;
  border: 1px solid var(--el-line);
  border-radius: 5px;
  color: var(--el-fg);
  cursor: pointer;
}

.el-side-toggle:hover {
  border-color: var(--el-accent);
  color: var(--el-accent);
}

.el-side-toggle svg {
  width: 15px;
  height: 15px;
  transition: transform 0.15s ease;
}

.el-sidebar--collapsed .el-side-toggle svg {
  transform: scaleX(-1);
}

.el-side-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 4px 8px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.el-side-section {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.el-side-heading {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--el-muted);
  padding: 0 4px;
}

/* Collapsed: the timetable selector has no compact form, so hide it. */
.el-sidebar--collapsed .el-side-section--timetable {
  display: none;
}

.el-side-select {
  width: 100%;
  background: var(--el-cell-bg);
  border: 1px solid var(--el-line);
  color: var(--el-fg);
  border-radius: 6px;
  padding: 6px 8px;
  font-size: 13px;
}

.el-side-select:focus {
  outline: none;
  border-color: var(--el-accent);
}

.el-side-nav {
  gap: 2px;
}

.el-side-item {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 8px;
  border-radius: 6px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--el-fg);
  font-size: 13px;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  font-family: inherit;
}

.el-side-item:hover {
  background: color-mix(in srgb, var(--el-fg) 9%, transparent);
}

.el-side-item--active {
  border-color: var(--el-accent);
  color: var(--el-accent);
}

.el-side-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.el-sidebar--collapsed .el-side-item {
  justify-content: center;
  padding: 8px 0;
  gap: 0;
}

.el-side-form {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 6px 2px 2px;
}

.el-side-form input {
  width: 100%;
  background: var(--el-cell-bg);
  border: 1px solid var(--el-line);
  color: var(--el-fg);
  border-radius: 5px;
  padding: 6px 8px;
  font-size: 12px;
}

.el-side-form input:focus {
  outline: none;
  border-color: var(--el-accent);
}

.el-sidebar--collapsed .el-side-form {
  display: none;
}

/* ---- Top bar avatar menu ---- */
.el-user {
  position: relative;
}

.el-user--topbar .el-user-trigger {
  padding: 2px;
  border-radius: 50%;
}

.el-user-toggle {
  display: none;
}

.el-user-trigger {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 6px 8px;
  border-radius: 6px;
  cursor: pointer;
}

.el-user-trigger:hover {
  background: color-mix(in srgb, var(--el-fg) 9%, transparent);
}

.el-user-avatar {
  display: inline-flex;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  background: var(--el-cell-bg);
}

.el-user--topbar .el-user-avatar {
  width: 32px;
  height: 32px;
}

.el-user-avatar img,
.el-user-avatar .avatar-backup {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.el-user-name {
  font-size: 13px;
  color: var(--el-fg);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.el-user-menu {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 200px;
  background: var(--el-bg);
  border: 1px solid var(--el-line);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
  padding: 6px;
  z-index: 60;
  flex-direction: column;
  gap: 2px;
}

.el-user-toggle:checked ~ .el-user-menu {
  display: flex;
}

.el-user-theme {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 9px;
  margin-bottom: 2px;
  border-bottom: 1px solid var(--el-line);
}

.el-user-theme-label {
  font-size: 13px;
  color: var(--el-fg);
}

.el-theme-switch {
  position: relative;
  display: inline-flex;
  flex-shrink: 0;
  cursor: pointer;
}

.el-theme-switch input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.el-theme-switch-track {
  display: block;
  width: 36px;
  height: 20px;
  border-radius: 999px;
  background: var(--el-line);
  transition: background 0.15s ease;
}

.el-theme-switch-track::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  transition: transform 0.15s ease;
}

.el-theme-switch input:checked + .el-theme-switch-track {
  background: var(--el-accent);
}

.el-theme-switch input:checked + .el-theme-switch-track::after {
  transform: translateX(16px);
}

.el-theme-switch input:focus-visible + .el-theme-switch-track {
  outline: 2px solid var(--el-accent);
  outline-offset: 2px;
}

.el-user-head {
  font-size: 11px;
  color: var(--el-muted);
  padding: 4px 9px 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.el-user-link {
  display: block;
  width: 100%;
  text-align: left;
  background: transparent;
  border: none;
  color: var(--el-fg);
  padding: 7px 9px;
  border-radius: 5px;
  font-size: 13px;
  cursor: pointer;
  text-decoration: none;
  font-family: inherit;
}

.el-user-link:hover {
  background: color-mix(in srgb, var(--el-fg) 9%, transparent);
}

.el-user-menu form {
  margin: 0;
}

.el-user-link--btn {
  margin: 0;
}

.el-user-link--danger {
  color: #c0392b;
}

.el-user-link--danger:hover {
  color: #e74c3c;
  background: rgba(192, 57, 43, 0.08);
}

.el-btn {
  appearance: none;
  border: 1px solid var(--el-line);
  background: transparent;
  color: var(--el-fg);
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 12px;
  cursor: pointer;
  text-decoration: none;
  line-height: 1.4;
}

.el-btn:hover {
  border-color: var(--el-accent);
  color: var(--el-accent);
}

.el-btn--active {
  border-color: var(--el-accent);
  color: var(--el-accent);
}

.el-grid {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.el-band {
  border-collapse: collapse;
  table-layout: fixed;
  width: max-content;
}

.el-band th,
.el-band td {
  border: 1px solid var(--el-line);
  text-align: center;
  vertical-align: middle;
  padding: 2px 4px;
}

.el-band .el-ts-label {
  width: 96px;
  background: var(--el-header-bg);
  font-weight: 500;
}

.el-band .el-ts-time {
  display: block;
  font-size: 10px;
  color: var(--el-muted);
  font-weight: 400;
}

.el-band .el-block-name {
  background: var(--el-header-bg);
  font-weight: 600;
  font-size: 12px;
}

.el-block-name--editable {
  cursor: pointer;
  vertical-align: top;
}

.el-block-name--editable:hover .el-block-name-display {
  box-shadow:
    inset 0 0 0 1.5px var(--el-accent),
    0 0 7px 1px var(--el-glow);
}

.el-block-name-display {
  padding: 2px 4px;
  white-space: normal;
}

.el-block-name-primary {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.el-block-name-stats {
  font-size: 10px;
  font-weight: 400;
  color: var(--el-muted);
  line-height: 1.35;
  margin-top: 2px;
  white-space: normal;
}

.el-block-name-form {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 4px;
  padding: 4px;
  flex-wrap: nowrap;
}

.el-block-name-fields {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 4px;
  margin: 0;
  min-width: 0;
}

.el-block-name-fields--teacher-rename .el-block-name-input {
  width: 9rem;
}

.el-block-name-fields input[type="text"] {
  box-sizing: border-box;
  background: var(--el-cell-bg);
  border: 1px solid var(--el-line);
  color: var(--el-fg);
  padding: 2px 4px;
  border-radius: 4px;
  font-size: 11px;
  min-width: 0;
}

.el-block-name-fields input[type="text"]:focus {
  outline: none;
  border-color: var(--el-accent);
}

.el-block-name-input--name {
  width: 3.25rem;
}

.el-block-name-input--teacher {
  width: 4.75rem;
}

.el-block-name-input--room {
  width: 2.5rem;
}

.el-block-name-delete-form {
  margin: 0;
  display: inline-flex;
}

.el-btn--danger {
  border-color: #c0392b;
  color: #c0392b;
}

.el-btn--danger:hover {
  border-color: #e74c3c;
  color: #e74c3c;
  background: rgba(192, 57, 43, 0.08);
}

.el-band .el-block-name:has(> .el-block-name-form:not(.el-hidden)) {
  overflow: visible;
  position: relative;
  z-index: 1;
}

.el-band .el-day-head {
  background: var(--el-header-bg);
  font-weight: 400;
  font-size: 10px;
  color: var(--el-muted);
  width: 84px;
}

.el-band .el-block-boundary {
  border-left: 3px solid var(--el-block-sep);
}

.el-cell {
  height: 34px;
  width: 84px;
  background: var(--el-cell-bg);
  overflow: hidden;
}

.el-cell-line1 {
  display: block;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.25;
}

.el-cell-line2 {
  display: block;
  font-size: 10px;
  color: var(--el-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
}

.el-cell-line2--placeholder {
  visibility: hidden;
}

.el-cell-dpa {
  color: var(--el-muted);
}

.el-cell-display--badged,
.el-cell-entry--badged {
  position: relative;
}

.el-cell-dpa-badge {
  position: absolute;
  top: 1px;
  right: 1px;
  z-index: 1;
  font-size: 8px;
  font-weight: 600;
  line-height: 1;
  color: var(--el-muted);
  pointer-events: none;
}

.el-cell-dpa-badge--stale {
  color: var(--el-conflict-ring);
}

.el-cell-display--badged:has(.el-cell-duty-badge) .el-cell-dpa-badge {
  right: 16px;
}

.el-cell-dpa-field {
  margin-top: 4px;
}

.el-cell-dpa-trigger {
  border: none;
  background: none;
  padding: 0;
  font-size: 10px;
  color: var(--el-accent);
  cursor: pointer;
}

.el-cell-dpa-trigger:hover {
  text-decoration: underline;
}

.el-cell-dpa-panel {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
}

.el-cell-dpa-input {
  width: 56px;
  background: var(--el-cell-bg);
  border: 1px solid var(--el-line);
  color: var(--el-fg);
  padding: 2px 4px;
  border-radius: 4px;
  font-size: 11px;
}

.el-cell-dpa-hint {
  font-size: 10px;
  color: var(--el-muted);
}

.el-cell-dpa-clear {
  border: none;
  background: none;
  padding: 0;
  font-size: 10px;
  color: var(--el-muted);
  cursor: pointer;
  text-decoration: underline;
}

/* Teacher-level duty cells (Prep, SERT, …). Per-type colour comes from the
   --el-duty-fg custom property set by the modifier class; new duty types fall
   back to the muted colour with no extra CSS. */
.el-cell--duty .el-cell-line1 {
  color: var(--el-duty-fg, var(--el-muted));
  font-style: italic;
  font-weight: 400;
  overflow: visible;
  padding-right: 3px;
}

.el-cell--duty-prep {
  --el-duty-fg: var(--el-prep-fg);
  background: var(--el-prep-bg);
}

.el-cell--duty-sert {
  --el-duty-fg: var(--el-sert-fg);
}

.el-cell--duty-custom {
  --el-duty-fg: var(--el-custom-fg);
}

.el-cell--duty {
  overflow: visible;
}

/* Teacher cell display: vertically center duty or homeroom + subject */
.el-cell--editable > .el-cell-display {
  display: flex;
  flex-direction: column;
  justify-content: center;
  height: 100%;
  min-height: 34px;
  box-sizing: border-box;
}

.el-cell--duty > .el-cell-display {
  align-items: center;
}

.el-cell--empty {
  background: var(--el-cell-bg);
}

.el-cell--empty.el-cell--editable {
  cursor: pointer;
}

.el-cell-homeroom-row {
  margin-bottom: 0;
  min-width: 0;
  width: 100%;
}

.el-noperiod-label {
  background: var(--el-header-bg);
  color: var(--el-muted);
  font-style: italic;
  font-size: 11px;
  text-align: center;
}

/* Transition / non-period rows: label above time, thinner padding */
.el-noperiod-row td,
.el-noperiod-teacher-row td {
  padding: 1px 4px;
}

.el-noperiod-teacher-row .el-cell {
  background: var(--el-header-bg);
  height: auto;
  min-height: 26px;
}

.el-noperiod-teacher-row .el-cell--sup .el-cell-line1 {
  color: var(--el-muted);
}

.el-band .el-ts-label--transition {
  width: 96px;
  text-align: center;
  padding: 1px 6px;
  vertical-align: middle;
}

.el-band .el-ts-label--transition .el-ts-label-display {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
  line-height: 1.15;
  min-height: 26px;
}

.el-noperiod-row .el-noperiod-fill {
  background: var(--el-header-bg);
  padding: 0;
}

.el-band .el-ts-label--transition .el-ts-name {
  display: block;
  font-size: 11px;
  font-weight: 500;
  font-style: normal;
  color: var(--el-muted);
}

.el-band .el-ts-label--transition .el-ts-time {
  display: block;
  font-size: 10px;
  color: var(--el-muted);
  font-weight: 400;
}

.el-noperiod-teacher-row .el-cell-display {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 26px;
}

/* Legacy compact layout (unused by transition rows) */
.el-band .el-ts-label--compact {
  width: auto;
  text-align: left;
  padding: 1px 6px;
  font-style: italic;
  color: var(--el-muted);
}

.el-band .el-ts-label--compact .el-ts-label-display {
  display: flex;
  align-items: center;
  gap: 8px;
  line-height: 1.3;
  min-height: 34px;
}

.el-band .el-ts-label--compact .el-ts-time {
  display: inline;
  font-size: 10px;
}

/* Supervision cells (teacher view, non-period rows) */
.el-cell--sup .el-cell-line1 {
  font-weight: 500;
  font-size: 10px;
}

.el-cell--sup.el-cell--empty {
  cursor: pointer;
}

.el-cell-form--sup {
  min-width: 132px;
  gap: 4px;
}

.el-sup-time-fields {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.el-sup-time-input {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  background: var(--el-cell-bg);
  border: 1px solid var(--el-line);
  color: var(--el-fg);
  padding: 3px 5px;
  border-radius: 4px;
  font-size: 11px;
}

.el-sup-time-input:focus {
  outline: none;
  border-color: var(--el-accent);
}

.el-sup-total-field {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  font-size: 10px;
  color: var(--el-muted);
}

.el-sup-total-label {
  flex-shrink: 0;
}

.el-sup-total-field .el-sup-time-input {
  flex: 1;
}

.el-cell--sup .el-cell-form {
  min-width: 92px;
}

/* Teacher supervision total badge in the block header */
.el-sup-total {
  font-weight: 400;
  font-size: 10px;
  color: var(--el-muted);
}

.el-sup-remove {
  margin-top: 4px;
  width: 100%;
}

.el-sup-remove form,
.el-cell--sup form {
  margin: 0;
}

.el-empty-state {
  padding: 40px;
  text-align: center;
  color: var(--el-muted);
}

.el-create-timetable {
  padding: 24px;
}

.el-create-back-link {
  display: inline-block;
  margin-bottom: 16px;
  font-size: 12px;
  color: var(--el-muted);
  text-decoration: none;
}

.el-create-back-link:hover {
  color: var(--el-accent);
}

.el-create-choice {
  border: none;
  margin: 0 0 16px;
  padding: 0;
}

.el-create-choice__legend {
  font-size: 12px;
  font-weight: 500;
  color: var(--el-muted);
  margin-bottom: 8px;
}

.el-create-choice__options {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.el-create-choice__option {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  cursor: pointer;
}

.el-create-fields {
  margin-bottom: 12px;
}

.el-create-field-label {
  display: block;
  font-size: 11px;
  font-weight: 500;
  color: var(--el-muted);
  margin-bottom: 4px;
}

.hidden {
  display: none !important;
}

.el-create-fields .el-inline-form input,
.el-create-select {
  min-width: 220px;
}

.el-create-select {
  background: var(--el-cell-bg);
  border: 1px solid var(--el-line);
  color: var(--el-fg);
  padding: 3px 6px;
  border-radius: 4px;
  font-size: 12px;
}

.el-create-select:focus {
  outline: none;
  border-color: var(--el-accent);
}

.el-create-actions {
  margin-top: 4px;
}

.el-inline-form {
  display: flex;
  align-items: center;
  gap: 6px;
}

.el-inline-form input {
  background: var(--el-cell-bg);
  border: 1px solid var(--el-line);
  color: var(--el-fg);
  padding: 3px 6px;
  border-radius: 4px;
  font-size: 12px;
  width: 92px;
}

.el-inline-form input:focus {
  outline: none;
  border-color: var(--el-accent);
}

/* Utility */
.el-hidden {
  display: none !important;
}

.el-btn--sm {
  padding: 2px 7px;
  font-size: 11px;
}

/* Editable cells: hover glow ring */
.el-cell--editable {
  cursor: pointer;
}

.el-cell--editable:hover {
  box-shadow:
    inset 0 0 0 1.5px var(--el-accent),
    0 0 7px 1px var(--el-glow);
  position: relative;
  z-index: 1;
}

.el-cell.el-subject-highlight {
  background: var(--el-subject-highlight);
  box-shadow: inset 0 0 0 1.5px var(--el-subject-highlight-border);
  position: relative;
  z-index: 1;
}

.el-cell.el-subject-highlight:hover {
  box-shadow: inset 0 0 0 1.5px var(--el-subject-highlight-border);
}

.el-cell-copy-source {
  box-shadow: inset 0 0 0 2px #f59e0b;
  background: rgba(245, 158, 11, 0.14);
  position: relative;
  z-index: 1;
}

.el-cell-swap-source {
  box-shadow: inset 0 0 0 2px #6366f1;
  background: rgba(99, 102, 241, 0.14);
  position: relative;
  z-index: 1;
}

.el-panel-subject-row {
  cursor: default;
}

.el-panel-subject-row.el-subject-highlight td {
  background: var(--el-subject-highlight);
}

.el-cell-display {
  width: 100%;
  height: 100%;
}

/* Inline edit forms inside cells */
.el-cell-form {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 132px;
  padding: 4px;
  box-sizing: border-box;
}

.el-cell-form--teacher {
  min-width: 132px;
  gap: 5px;
}

.el-cell-conflict {
  display: inline-block;
  color: var(--el-conflict-text);
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--el-conflict-fill);
  box-shadow: inset 0 0 0 1.5px var(--el-conflict-ring);
  line-height: 1.35;
}

.el-cell--conflict {
  height: auto;
  min-height: 34px;
  padding: 2px 4px;
  background: var(--el-conflict-fill);
  box-shadow: inset 0 0 0 2px var(--el-conflict-ring);
}

.el-cell--conflict:hover {
  box-shadow:
    inset 0 0 0 2px var(--el-conflict-ring),
    0 0 8px 1px rgba(220, 38, 38, 0.35);
}

.el-cell--conflict .el-cell-line1,
.el-cell--conflict .el-cell-line2 {
  color: var(--el-conflict-text);
  font-weight: 600;
}

.el-cell--duty-conflict {
  box-shadow: inset 0 0 0 2px var(--el-conflict-ring);
}

.el-cell--duty-conflict > .el-cell-display {
  position: relative;
}

.el-cell-duty-badge {
  position: absolute;
  top: 1px;
  right: 1px;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--el-conflict-ring);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  line-height: 1;
  pointer-events: none;
}

.el-cell-entries {
  display: flex;
  flex-direction: column;
  gap: 3px;
  width: 100%;
  height: 100%;
  overflow: hidden;
  padding: 4px 5px;
}

.el-cell-entry + .el-cell-entry {
  border-top: 1px solid var(--el-conflict-ring);
  padding-top: 3px;
}

.el-cell:has(> .el-cell-form:not(.el-hidden)) {
  height: auto;
  min-height: 34px;
  width: auto;
  min-width: 84px;
  overflow: visible;
  vertical-align: top;
  position: relative;
  z-index: 1;
}

.el-cell-form-row {
  display: flex;
  gap: 4px;
}

.el-cell-form input:not([type="checkbox"]),
.el-cell-select {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  background: var(--el-cell-bg);
  border: 1px solid var(--el-line);
  color: var(--el-fg);
  padding: 3px 5px;
  border-radius: 4px;
  font-size: 11px;
}

.el-cell-form input:not([type="checkbox"]):focus,
.el-cell-select:focus {
  outline: none;
  border-color: var(--el-accent);
}

.el-form-actions {
  display: flex;
  gap: 4px;
  justify-content: center;
}

/* Timeslot time inline editor */
.el-ts-label-display {
  cursor: pointer;
  position: relative;
}

/* Minutes badge: revealed on hover, pinned to the right of the label */
.el-ts-minutes {
  position: absolute;
  top: 50%;
  right: 4px;
  transform: translateY(-50%);
  font-size: 10px;
  font-weight: 500;
  color: var(--el-accent);
  background: var(--el-header-bg);
  padding: 0 4px;
  border-radius: 3px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.1s ease;
}

.el-band .el-ts-label:hover .el-ts-minutes {
  opacity: 1;
}

.el-ts-form {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 4px;
}

.el-ts-form input {
  background: var(--el-cell-bg);
  border: 1px solid var(--el-line);
  color: var(--el-fg);
  padding: 3px 5px;
  border-radius: 4px;
  font-size: 11px;
}

/* Gap-fill modal */
.el-modal-overlay {
  position: fixed;
  inset: 0;
  background: var(--el-overlay);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.el-modal {
  background: var(--el-bg);
  color: var(--el-fg);
  border: 1px solid var(--el-line);
  border-radius: 8px;
  padding: 20px;
  width: 320px;
  max-width: calc(100vw - 32px);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.el-modal h2 {
  font-size: 14px;
  font-weight: 600;
  margin: 0 0 12px;
}

.el-modal p {
  margin: 0 0 14px;
  color: var(--el-muted);
  font-size: 12px;
}

.el-modal-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.el-modal-form input[type="text"] {
  background: var(--el-cell-bg);
  border: 1px solid var(--el-line);
  color: var(--el-fg);
  padding: 6px 8px;
  border-radius: 4px;
  font-size: 12px;
  width: 100%;
}

.el-modal-form select {
  background: var(--el-cell-bg);
  border: 1px solid var(--el-line);
  color: var(--el-fg);
  padding: 6px 8px;
  border-radius: 4px;
  font-size: 12px;
  width: 100%;
}

.el-modal-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
}

.el-modal-title {
  font-size: 14px;
  font-weight: 600;
  margin: 0 0 8px;
}

.el-modal-checkbox {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
}

.el-modal-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 4px;
}

/* Manage Period Times modal */
.el-modal--wide {
  width: 560px;
}

.el-modal--class-labels {
  width: 780px;
}

.el-modal--share {
  width: 480px;
}

.el-share-invite {
  margin-bottom: 20px;
}

.el-share-invite-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.el-share-chip-field {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  border: 1px solid var(--el-line);
  border-radius: 8px;
  background: var(--el-bg);
  min-height: 40px;
}

.el-share-chip-field:focus-within {
  border-color: var(--el-accent);
}

.el-share-chips {
  display: contents;
}

.el-share-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  max-width: 100%;
  padding: 2px 4px 2px 8px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--el-accent) 18%, var(--el-line));
  font-size: 12px;
  color: var(--el-fg);
}

.el-share-chip-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.el-share-chip-remove {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--el-muted);
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
}

.el-share-chip-remove:hover {
  background: color-mix(in srgb, var(--el-fg) 12%, transparent);
  color: var(--el-fg);
}

.el-share-chip-input {
  flex: 1 1 120px;
  min-width: 120px;
  border: none;
  background: transparent;
  padding: 4px 2px;
  font-size: 13px;
  color: var(--el-fg);
  outline: none;
}

.el-share-invite-perm {
  flex-shrink: 0;
  padding: 8px 10px;
  border: 1px solid var(--el-line);
  border-radius: 8px;
  font-size: 13px;
  background: var(--el-bg);
  color: var(--el-fg);
  margin-top: 2px;
}

.el-modal-actions--share {
  justify-content: flex-end;
}

.el-share-primary-btn {
  appearance: none;
  border: none;
  border-radius: 999px;
  padding: 8px 20px;
  background: #1a73e8;
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  line-height: 1.2;
}

.el-share-primary-btn:hover {
  filter: brightness(1.08);
}

.el-app[data-theme="dark"] .el-share-primary-btn {
  background: #8ab4f8;
  color: #001d35;
}

.el-share-section {
  border-top: 1px solid var(--el-line);
  padding-top: 16px;
}

.el-share-heading {
  margin: 0 0 12px;
  font-size: 13px;
  font-weight: 600;
  color: var(--el-fg);
}

.el-share-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 280px;
  overflow-y: auto;
}

.el-share-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 4px;
  border-radius: 4px;
}

.el-share-row:hover {
  background: color-mix(in srgb, var(--el-line) 40%, transparent);
}

.el-share-row-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
}

.el-share-row-avatar img,
.el-share-row-avatar .avatar-backup {
  width: 32px;
  height: 32px;
}

.el-share-row-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.el-share-row-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--el-fg);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.el-share-row-email {
  font-size: 12px;
  color: var(--el-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.el-share-row-unverified {
  font-size: 11px;
  color: var(--el-muted);
}

.el-share-row-access {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.el-share-owner {
  font-size: 12px;
  color: var(--el-muted);
  padding: 4px 8px;
}

.el-share-perm-form {
  margin: 0;
}

.el-share-perm-select {
  padding: 4px 8px;
  border: 1px solid transparent;
  border-radius: 4px;
  font-size: 12px;
  background: transparent;
  color: var(--el-fg);
  cursor: pointer;
}

.el-share-perm-select:hover,
.el-share-perm-select:focus {
  border-color: var(--el-line);
  background: var(--el-bg);
  outline: none;
}

.el-share-remove-form {
  margin: 0;
  display: inline;
}

.el-share-remove {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: var(--el-muted);
  cursor: pointer;
}

.el-share-remove:hover {
  background: color-mix(in srgb, var(--el-line) 60%, transparent);
  color: var(--el-fg);
}

.el-share-remove svg {
  width: 14px;
  height: 14px;
}

.el-modal-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 12px;
}

.el-modal-head h2 {
  margin: 0;
}

.el-modal-total {
  font-size: 12px;
  color: var(--el-muted);
}

.el-modal-totals {
  display: flex;
  gap: 12px;
  font-size: 12px;
  color: var(--el-muted);
}

.el-modal-total span {
  color: var(--el-accent);
  font-weight: 600;
}

.el-modal-actions--manage {
  justify-content: space-between;
  align-items: center;
}

.el-modal-actions-right {
  display: flex;
  gap: 8px;
}

.el-manage-add-trigger {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--el-muted);
  font-size: 12px;
  cursor: pointer;
  padding: 4px 0;
}

.el-manage-add-trigger:hover {
  color: var(--el-fg);
}

.el-manage-add-panel {
  margin: 12px 0;
  padding: 10px;
  border: 1px solid var(--el-line);
  border-radius: 6px;
  background: var(--el-cell-bg);
}

.el-ts-time-pickers {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.el-ts-time-picker-trigger {
  width: 100%;
}

.el-manage-table .time-picker-trigger {
  width: auto;
  min-width: 84px;
}

.el-manage-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0 4px;
  margin-bottom: 12px;
  table-layout: auto;
}

.el-manage-table th {
  text-align: left;
  font-size: 10px;
  font-weight: 500;
  color: var(--el-muted);
  padding: 2px 4px 6px;
  border-bottom: 1px solid var(--el-line);
}

.el-manage-table td {
  padding: 3px 4px;
  border-bottom: 1px solid var(--el-line);
  vertical-align: middle;
}

.el-manage-name {
  font-size: 12px;
}

.el-manage-name--period {
  color: var(--el-fg);
}

.el-manage-name-edit {
  min-width: 0;
}

.el-manage-name-display {
  color: var(--el-muted);
  cursor: pointer;
  text-decoration: none;
}

.el-manage-name-display:hover {
  color: var(--el-fg);
  text-decoration: none;
}

.el-manage-name-form {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
}

.el-manage-name-form input[type="text"] {
  flex: 1;
  min-width: 0;
  background: var(--el-cell-bg);
  border: 1px solid var(--el-line);
  color: var(--el-fg);
  padding: 3px 5px;
  border-radius: 4px;
  font-size: 11px;
}

.el-manage-table input[type="number"] {
  background: var(--el-cell-bg);
  border: 1px solid var(--el-line);
  color: var(--el-fg);
  padding: 3px 5px;
  border-radius: 4px;
  font-size: 11px;
}

.el-manage-table th.el-manage-time,
.el-manage-table td.el-manage-time,
.el-manage-table th.el-manage-minutes,
.el-manage-table td.el-manage-minutes {
  width: 1%;
  white-space: nowrap;
}

.el-manage-min {
  width: 52px !important;
  max-width: 52px;
  box-sizing: border-box;
}

.el-manage-table th.el-manage-delete,
.el-manage-table td.el-manage-delete {
  width: 1%;
  white-space: nowrap;
  padding-left: 4px;
  padding-right: 0;
  text-align: center;
}

.el-manage-delete .el-btn--sm {
  padding: 2px 6px;
  min-width: 0;
}

.el-manage-table form {
  margin: 0;
}

.el-modal-divider {
  border: none;
  border-top: 1px solid var(--el-line);
  margin: 16px 0;
}

.el-manage-add-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.el-manage-add-row input[type="time"],
.el-manage-add-row input[type="text"] {
  background: var(--el-cell-bg);
  border: 1px solid var(--el-line);
  color: var(--el-fg);
  padding: 4px 6px;
  border-radius: 4px;
  font-size: 11px;
}

.el-manage-add-row input[type="text"] {
  flex: 1;
  min-width: 120px;
}

/* Period type radios in teacher-view cell edit */
.el-cell-form--teacher .el-cell-duty-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 10px;
  width: 100%;
  margin: 0;
  padding: 0;
  border: 0;
}

.el-cell-form--teacher .el-cell-radio {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  line-height: 1;
  color: var(--el-muted);
  cursor: pointer;
  margin: 0;
}

.el-cell-form--teacher .el-cell-radio input[type="radio"] {
  margin: 0;
  flex-shrink: 0;
  width: 14px;
  height: 14px;
  accent-color: var(--el-accent);
  vertical-align: middle;
}

.el-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;
}

/* ---- Bottom report panel (main column only, not over sidebar) ---- */
.el-bottom-panel {
  flex: 0 0 auto;
  position: relative;
  height: 0;
  min-height: 0;
  overflow: hidden;
  transition: height 0.28s ease;
  pointer-events: none;
}

.el-bottom-panel--resizing {
  transition: none;
}

.el-bottom-panel-surface {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  transform: translateY(100%);
  transition: transform 0.28s ease;
  border-top: 1px solid color-mix(in srgb, var(--el-line) 55%, var(--el-accent) 45%);
  background: var(--el-bg);
  box-shadow: var(--el-panel-shadow);
  color: var(--el-fg);
  pointer-events: none;
}

.el-bottom-panel--open .el-bottom-panel-surface {
  transform: translateY(0);
  pointer-events: auto;
}

.el-bottom-panel--resizing .el-bottom-panel-surface {
  transition: none;
}

.el-panel-resize {
  position: absolute;
  inset: 0 0 auto;
  height: 10px;
  cursor: row-resize;
  z-index: 5;
}

.el-panel-resize-handle {
  width: 48px;
  height: 3px;
  margin: 4px auto 0;
  border-radius: 999px;
  background: color-mix(in srgb, var(--el-accent) 45%, var(--el-line));
}

.el-panel-close {
  position: absolute;
  top: 10px;
  right: 12px;
  z-index: 6;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid var(--el-line);
  border-radius: 999px;
  background: color-mix(in srgb, var(--el-bg) 80%, transparent);
  color: var(--el-fg);
  cursor: pointer;
}

.el-panel-close:hover {
  border-color: var(--el-accent);
  color: var(--el-accent);
}

.el-panel-close svg {
  width: 16px;
  height: 16px;
}

.el-panel-body {
  flex: 1 1 auto;
  min-height: 0;
  padding: 14px 16px 12px;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.el-panel-frame,
turbo-frame#el_panel_content {
  display: block;
  min-height: 0;
}

.el-panel-content {
  padding-right: 36px;
  padding-bottom: 4px;
}

.el-panel-title {
  font-size: 14px;
  font-weight: 600;
  margin: 0 0 10px;
  color: var(--el-fg);
}

.el-panel-note,
.el-panel-empty {
  font-size: 12px;
  color: var(--el-muted);
  margin: 0 0 12px;
}

.el-panel-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}

.el-panel-grid--homerooms {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 12px;
}

.el-panel-grid--homerooms .el-panel-card {
  flex: 0 0 300px;
  max-width: 300px;
}

.el-panel-prep-layout {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: flex-start;
  width: fit-content;
  max-width: 100%;
}

.el-panel-prep-schedule {
  flex: 0 1 auto;
  width: max-content;
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
}

.el-panel-prep-totals {
  flex: 0 0 auto;
  width: max-content;
  min-width: 200px;
  max-width: 100%;
}

.el-band--readonly .el-ts-label-display {
  cursor: default;
}

.el-duty-cell {
  font-size: 11px;
  line-height: 1.35;
  vertical-align: top;
  color: var(--el-muted);
}

.el-duty-cell--filled {
  color: var(--el-fg);
  font-weight: 500;
}

.el-panel-teacher-name {
  display: inline-block;
  border-radius: 4px;
  padding: 2px 6px;
  line-height: 1.35;
  cursor: default;
}

.el-panel-teacher-name.el-panel-teacher-highlight {
  color: var(--el-subject-highlight-text);
  font-weight: 600;
  background: var(--el-subject-highlight);
  box-shadow: inset 0 0 0 1.5px var(--el-subject-highlight-border);
}

.el-sup-cell {
  font-size: 11px;
  line-height: 1.35;
  vertical-align: top;
  color: var(--el-muted);
}

.el-sup-cell--filled {
  color: var(--el-fg);
  font-weight: 500;
}

.el-sup-cell-entry {
  display: block;
}

.el-sup-cell-entry + .el-sup-cell-entry {
  margin-top: 4px;
  padding-top: 4px;
  border-top: 1px solid var(--el-line);
}

.el-sup-entry-time {
  display: block;
  margin-top: 1px;
  font-size: 10px;
  color: var(--el-muted);
  font-weight: 400;
  white-space: nowrap;
}

.el-panel-empty--card {
  margin: 0;
  padding: 10px;
}

.el-panel-card {
  border: 1px solid color-mix(in srgb, var(--el-line) 80%, transparent);
  border-radius: 8px;
  background: color-mix(in srgb, var(--el-cell-bg) 72%, transparent);
  overflow: hidden;
}

.el-panel-card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--el-line);
  background: color-mix(in srgb, var(--el-header-bg) 90%, transparent);
}

.el-panel-card-head h3 {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
}

.el-panel-card-met {
  color: #2e7d32;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}

.el-panel-card-total {
  font-size: 12px;
  color: var(--el-accent);
  font-weight: 600;
}

.el-panel-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.el-panel-table th,
.el-panel-table td {
  padding: 6px 10px;
  border-bottom: 1px solid var(--el-line);
  text-align: left;
}

.el-panel-table th {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--el-muted);
  font-weight: 500;
}

.el-panel-table tbody tr:last-child td {
  border-bottom: none;
}

.el-panel-table--wide {
  min-width: 480px;
}

.el-panel-table--departments {
  width: 100%;
  table-layout: fixed;
}

.el-panel-table--departments th:first-child,
.el-panel-table--departments td:first-child {
  width: 52%;
  word-wrap: break-word;
}

.el-panel-table--departments .el-panel-num {
  width: 24%;
  white-space: nowrap;
  text-align: center;
}

.el-panel-num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.el-panel-ok {
  color: var(--el-accent);
}

.el-panel-remaining-short {
  color: #c0392b;
}

.el-panel-remaining-over {
  color: #2e7d32;
}

.el-panel-remaining-met {
  color: #2e7d32;
  font-size: 11px;
  font-weight: 700;
}

.el-panel-remaining-surplus {
  font-size: 0.85em;
  opacity: 0.85;
}

.el-panel-warn {
  color: #e57373;
}

.el-panel-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.el-panel-chip {
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--el-line);
  background: color-mix(in srgb, var(--el-cell-bg) 85%, transparent);
  color: var(--el-muted);
}

.el-panel-chip strong {
  color: var(--el-fg);
  font-weight: 600;
}

.el-modal-close {
  border: none;
  background: none;
  color: var(--el-muted);
  cursor: pointer;
  padding: 4px;
  line-height: 0;
}

.el-modal-close svg {
  width: 16px;
  height: 16px;
}

.el-modal-notice {
  margin: 0 0 10px;
  font-size: 12px;
  color: #5cb85c;
}

.el-modal-error {
  margin: 0 0 10px;
  font-size: 12px;
  color: #e07070;
}

.el-class-labels {
  display: flex;
  flex-direction: column;
  gap: 0;
  max-height: 60vh;
  overflow-y: auto;
  margin-bottom: 12px;
}

.el-class-labels-row {
  display: grid;
  grid-template-columns: 148px 1fr;
  gap: 8px 12px;
  align-items: start;
  padding: 8px 0;
  border-bottom: 1px solid var(--el-line);
}

.el-class-labels-dept-name {
  font-size: 12px;
  font-weight: 600;
  line-height: 1.6;
  padding-top: 2px;
}

.el-class-labels-chips {
  display: grid;
  grid-template-columns: repeat(8, max-content);
  gap: 6px;
}

.el-class-labels-empty {
  font-size: 11px;
  color: var(--el-muted);
  font-style: italic;
  line-height: 1.6;
}

.el-class-labels-add {
  padding-top: 10px;
}

.el-class-labels-add-trigger {
  border: none;
  background: none;
  padding: 0;
  font-size: 12px;
  color: var(--el-accent);
  cursor: pointer;
  text-decoration: none;
}

.el-class-labels-add-trigger:hover {
  text-decoration: underline;
}

.el-class-labels-add-panel {
  margin-top: 8px;
  padding: 10px;
  border: 1px solid var(--el-line);
  border-radius: 6px;
  background: color-mix(in srgb, var(--el-cell-bg) 72%, transparent);
}

.el-class-labels-add-form {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 8px 12px;
}

.el-class-labels-add-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex-shrink: 0;
}

.el-class-labels-add-field--subject {
  width: 200px;
}

.el-class-labels-add-field--label {
  width: 130px;
}

.el-class-labels-add-field label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--el-muted);
}

.el-class-labels-add-form input[type="text"],
.el-class-labels-add-form select {
  width: 100%;
  box-sizing: border-box;
  background: var(--el-cell-bg);
  border: 1px solid var(--el-line);
  color: var(--el-fg);
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
}

.el-class-labels-add-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-shrink: 0;
}

.el-class-labels-dpa-check {
  margin: 0;
  font-size: 11px;
}

.el-class-labels-add-field--full {
  flex: 1 1 100%;
  width: 100%;
}

.el-label-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 6px;
  border-radius: 999px;
  border: 1px solid var(--el-line);
  background: var(--el-cell-bg);
  font-size: 11px;
  line-height: 1.3;
}

.el-label-chip-badge {
  font-size: 9px;
  font-weight: 600;
  color: #5a9fd4;
  text-transform: uppercase;
}

.el-label-chip-delete {
  border: none;
  background: none;
  color: var(--el-muted);
  cursor: pointer;
  padding: 0 2px;
  font-size: 14px;
  line-height: 1;
}

.el-label-chip-delete:hover {
  color: #e07070;
}

/* ---- Timetable search (chip bar + highlight) ---- */

/* Sticky chrome that holds the search bar at the top of the scroll area. */
.el-search-chrome {
  position: sticky;
  top: 0;
  z-index: 25;
}

.el-search {
  position: relative;
  width: 100%;
  flex-shrink: 0;
}

/* Collapsed: a small magnifying-glass tab on the right edge of the sidebar. */
.el-search:not(.is-open) {
  height: 0;
  overflow: visible;
}

.el-search:not(.is-open) .el-search__inner {
  position: fixed;
  left: var(--el-sidebar-width, 210px);
  top: calc(var(--el-strip-height) + 8px);
  z-index: 40;
  display: flex;
  align-items: center;
  height: 28px;
  width: 28px;
  overflow: hidden;
  border: 1px solid var(--el-line);
  border-left: 0;
  border-radius: 0 6px 6px 0;
  background: var(--el-header-bg);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  cursor: pointer;
  transition: width 200ms ease-out;
}

.el-shell:has(.el-sidebar--collapsed) .el-search:not(.is-open) .el-search__inner {
  left: 60px;
}

.el-search:not(.is-open) .el-search__inner:hover {
  width: 8rem;
}

.el-search:not(.is-open) .el-search__trigger {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding-left: 6px;
}

.el-search:not(.is-open) .el-search__label-group,
.el-search:not(.is-open) .el-search__field,
.el-search:not(.is-open) .el-search__clear {
  display: none;
}

/* Expanded: full-width bar pinned at the top of the grid. */
.el-search.is-open {
  width: 100%;
  background: var(--el-header-bg);
  border-bottom: 1px solid var(--el-line);
}

.el-search.is-open .el-search__inner {
  position: relative;
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 8px;
  min-height: 2rem;
  padding: 6px 64px 6px 12px;
  overflow-x: auto;
}

.el-search__trigger {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  padding: 0;
  color: var(--el-muted);
  background: transparent;
  border: 0;
  cursor: pointer;
}

.el-search__trigger:hover {
  color: var(--el-fg);
}

.el-search.is-open .el-search__trigger {
  height: 2rem;
  width: 2rem;
}

.el-search__icon {
  width: 14px;
  height: 14px;
}

.el-search__label-group {
  display: none;
  flex-shrink: 0;
  align-items: center;
  gap: 8px;
}

.el-search.is-open .el-search__label-group {
  display: inline-flex;
}

.el-search__label {
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--el-muted);
}

.el-search__help {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 4px;
  font-size: 11px;
  color: var(--el-muted);
  text-decoration: none;
  border-radius: 4px;
}

.el-search__help:hover {
  background: rgba(127, 127, 127, 0.12);
  color: var(--el-fg);
}

.el-search__help-icon {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.el-search__field {
  display: none;
  min-width: 0;
  flex: 1;
  align-items: center;
  gap: 6px;
  overflow: hidden;
}

.el-search.is-open .el-search__field {
  display: flex;
}

.el-search__chips {
  flex-shrink: 0;
  display: inline-flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
}

.el-search__input {
  min-width: 8rem;
  flex: 1;
  font-size: 13px;
  color: var(--el-fg);
  background: transparent;
  border: 0;
}

.el-search__input:focus {
  outline: none;
}

.el-search__input::placeholder {
  color: var(--el-muted);
}

.el-search__clear {
  display: none;
}

.el-search.is-open .el-search__clear {
  position: absolute;
  right: 12px;
  top: 6px;
  display: inline-flex;
  padding: 3px 8px;
  font-size: 11px;
  color: var(--el-muted);
  background: var(--el-header-bg);
  border: 1px solid var(--el-line);
  border-radius: 6px;
  cursor: pointer;
}

.el-search.is-open .el-search__clear:hover {
  color: var(--el-fg);
}

/* Chips */
.el-search-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  font-size: 11px;
  white-space: nowrap;
  border-radius: 6px;
  flex-shrink: 0;
  color: var(--el-fg);
  background: var(--el-cell-bg);
  border: 1px solid var(--el-line);
}

.el-search-chip--exclude {
  color: var(--el-conflict-text);
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.6);
}

.el-search-chip--invalid-field {
  background: rgba(239, 68, 68, 0.08);
  border-color: rgba(239, 68, 68, 0.5);
}

.el-search-chip--color-0 {
  color: var(--el-search-color-0-text);
  background: var(--el-search-color-0-bg);
  border-color: var(--el-search-color-0-border);
}

.el-search-chip--color-1 {
  color: var(--el-search-color-1-text);
  background: var(--el-search-color-1-bg);
  border-color: var(--el-search-color-1-border);
}

.el-search-chip--color-2 {
  color: var(--el-search-color-2-text);
  background: var(--el-search-color-2-bg);
  border-color: var(--el-search-color-2-border);
}

.el-search-chip--color-3 {
  color: var(--el-search-color-3-text);
  background: var(--el-search-color-3-bg);
  border-color: var(--el-search-color-3-border);
}

.el-search-chip__warning {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  font-size: 9px;
  font-weight: 700;
  line-height: 1;
  color: #fff;
  background: #dc2626;
  border-radius: 9999px;
  cursor: help;
}

.el-search-chip__remove {
  padding: 0;
  font-size: 13px;
  line-height: 1;
  color: inherit;
  background: transparent;
  border: 0;
  cursor: pointer;
  opacity: 0.7;
}

.el-search-chip__remove:hover {
  opacity: 1;
}

/* Help modal */
.el-search-help {
  max-height: calc(100vh - 16rem);
  overflow-y: auto;
  font-size: 12px;
  line-height: 1.55;
  color: var(--el-fg);
}

.el-search-help-section {
  margin-bottom: 16px;
}

.el-search-help-section h3 {
  margin: 0 0 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--el-accent);
}

.el-search-help-section p {
  margin: 0 0 8px;
  color: var(--el-fg);
}

.el-search-help-section ul {
  margin: 0;
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.el-search-help-muted {
  color: var(--el-muted) !important;
}

.el-search-help-inline {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  vertical-align: middle;
}

.el-search-help-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px;
  border: 1px solid var(--el-line);
  border-radius: 6px;
  background: var(--el-cell-bg);
}

/* Match highlight on cells and grid headers (one palette slot per search chip). */
.el-cell[class*="el-search-highlight--"] {
  position: relative;
  z-index: 1;
}

.el-cell.el-search-highlight--0 {
  background: var(--el-search-color-0-bg);
  box-shadow: inset 0 0 0 1.5px var(--el-search-color-0-border);
}

.el-cell.el-search-highlight--1 {
  background: var(--el-search-color-1-bg);
  box-shadow: inset 0 0 0 1.5px var(--el-search-color-1-border);
}

.el-cell.el-search-highlight--2 {
  background: var(--el-search-color-2-bg);
  box-shadow: inset 0 0 0 1.5px var(--el-search-color-2-border);
}

.el-cell.el-search-highlight--3 {
  background: var(--el-search-color-3-bg);
  box-shadow: inset 0 0 0 1.5px var(--el-search-color-3-border);
}

.el-cell[class*="el-search-highlight--"]:hover {
  filter: brightness(1.05);
}

.el-block-name.el-search-highlight--0,
.el-day-head.el-search-highlight--0,
.el-ts-label.el-search-highlight--0 {
  background: var(--el-search-color-0-bg);
  box-shadow: inset 0 0 0 1.5px var(--el-search-color-0-border);
  color: var(--el-search-color-0-text);
  position: relative;
  z-index: 2;
}

.el-block-name.el-search-highlight--1,
.el-day-head.el-search-highlight--1,
.el-ts-label.el-search-highlight--1 {
  background: var(--el-search-color-1-bg);
  box-shadow: inset 0 0 0 1.5px var(--el-search-color-1-border);
  color: var(--el-search-color-1-text);
  position: relative;
  z-index: 2;
}

.el-block-name.el-search-highlight--2,
.el-day-head.el-search-highlight--2,
.el-ts-label.el-search-highlight--2 {
  background: var(--el-search-color-2-bg);
  box-shadow: inset 0 0 0 1.5px var(--el-search-color-2-border);
  color: var(--el-search-color-2-text);
  position: relative;
  z-index: 2;
}

.el-block-name.el-search-highlight--3,
.el-day-head.el-search-highlight--3,
.el-ts-label.el-search-highlight--3 {
  background: var(--el-search-color-3-bg);
  box-shadow: inset 0 0 0 1.5px var(--el-search-color-3-border);
  color: var(--el-search-color-3-text);
  position: relative;
  z-index: 2;
}

@media (prefers-reduced-motion: reduce) {
  .el-search:not(.is-open) .el-search__inner {
    transition: none;
  }
}

.el-access-denied--frame {
  margin: 16px;
  padding: 20px 22px;
  border: 1px solid var(--el-line);
  border-radius: 10px;
  background: var(--el-header-bg);
  max-width: 420px;
}

.el-access-denied--page {
  min-height: calc(100vh - 56px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 20px 48px;
}

.el-access-denied__card {
  width: min(100%, 480px);
  padding: 36px 32px 32px;
  border: 1px solid var(--el-line);
  border-radius: 16px;
  background: var(--el-header-bg);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.12);
  text-align: center;
}

.el-app[data-theme="light"] .el-access-denied__card {
  box-shadow: 0 14px 32px rgba(15, 23, 42, 0.08);
}

.el-access-denied__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  margin: 0 auto 18px;
  border-radius: 14px;
  background: rgba(179, 208, 255, 0.12);
  color: var(--el-accent);
}

.el-app[data-theme="light"] .el-access-denied__icon {
  background: rgba(29, 78, 216, 0.08);
}

.el-access-denied__icon svg {
  width: 28px;
  height: 28px;
}

.el-access-denied__eyebrow {
  margin: 0 0 8px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--el-muted);
}

.el-access-denied__title {
  margin: 0 0 12px;
  font-size: 24px;
  line-height: 1.25;
  font-weight: 600;
  color: var(--el-fg);
}

.el-access-denied--frame .el-access-denied__title {
  font-size: 18px;
}

.el-access-denied__message {
  margin: 0 auto 18px;
  max-width: 38ch;
  font-size: 15px;
  line-height: 1.55;
  color: var(--el-muted);
}

.el-access-denied__tips {
  margin: 0 auto 24px;
  padding: 0;
  list-style: none;
  text-align: left;
  max-width: 38ch;
}

.el-access-denied__tips li {
  position: relative;
  padding-left: 18px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--el-muted);
}

.el-access-denied__tips li + li {
  margin-top: 10px;
}

.el-access-denied__tips li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.62em;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--el-accent);
}

.el-access-denied__actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.el-access-denied__cta {
  min-width: 210px;
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 500;
}

.el-access-denied__secondary {
  font-size: 13px;
  color: var(--el-muted);
  text-decoration: none;
}

.el-access-denied__secondary:hover {
  color: var(--el-accent);
}

.el-app--minimal {
  min-height: 100vh;
  background: var(--el-bg);
  color: var(--el-fg);
}

.el-minimal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 56px;
  padding: 0 20px;
  border-bottom: 1px solid var(--el-line);
  background: var(--el-header-bg);
}

.el-minimal-header__brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.el-minimal-header__actions {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-shrink: 0;
}

.el-minimal-header__link {
  font-size: 13px;
  color: var(--el-fg);
  text-decoration: none;
}

.el-minimal-header__link:hover {
  color: var(--el-accent);
}

.el-minimal-header__link--muted {
  color: var(--el-muted);
}

.el-minimal-main {
  display: block;
}
