/* ============================================================
   Maturitní agenda — design system
   Varianta B: moderní dashboard, tmavý sidebar, teal akcent
   ============================================================ */

/* ----------------------------------------------------------
   CSS proměnné
---------------------------------------------------------- */
:root {
  /* Sidebar */
  --sidebar-bg:       #0f172a;
  --sidebar-hover:    #1e293b;
  --sidebar-active:   #1e293b;
  --sidebar-border:   #1e293b;
  --sidebar-text:     #94a3b8;
  --sidebar-text-active: #f1f5f9;
  --sidebar-width:    260px;

  /* Obsah */
  --content-bg:       #f8fafc;
  --surface:          #ffffff;
  --border:           #e2e8f0;
  --border-subtle:    #f1f5f9;

  /* Typografie */
  --text-primary:     #0f172a;
  --text-secondary:   #475569;
  --text-muted:       #64748b;

  /* Akcent */
  --primary:          #1e607a;
  --primary-hover:    #174b60;
  --primary-light:    #e8f1f5;

  /* Stavy */
  --success:          #10b981;
  --success-bg:       #ecfdf5;
  --warning:          #f59e0b;
  --warning-bg:       #fffbeb;
  --danger:           #ef4444;
  --danger-bg:        #fef2f2;
  --info:             #3b82f6;
  --info-bg:          #eff6ff;

  /* Ostatní */
  --radius:           8px;
  --radius-sm:        4px;
  --radius-lg:        12px;
  --shadow-sm:        0 1px 3px rgba(0,0,0,.08);
  --shadow:           0 4px 16px rgba(0,0,0,.08);
  --topbar-height:    56px;
}

/* Komisní fronta skutečných výjimek */
.resolution-queue { display: grid; gap: 20px; }
.resolution-queue__header { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; }
.resolution-queue__header h2 { margin: 2px 0 6px; font-size: 1.5rem; }
.resolution-queue__header > div > p:last-child { margin: 0; color: var(--text-secondary); }
.resolution-queue__eyebrow { margin: 0; color: var(--primary); font-size: .72rem; font-weight: 800; letter-spacing: .09em; text-transform: uppercase; }
.resolution-queue__count { flex: 0 0 auto; padding: 7px 12px; border-radius: 999px; background: #e8f2f7; color: var(--primary); font-size: .78rem; font-weight: 800; }
.resolution-list { display: grid; gap: 14px; }
.resolution-card { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 24px; align-items: center; padding: 20px 22px; border: 1px solid var(--border-subtle); border-radius: 14px; background: var(--surface); box-shadow: var(--card-shadow); }
.resolution-card__main { min-width: 0; }
.resolution-card__identity { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.resolution-card__identity h3 { margin: 0 0 3px; font-size: 1rem; }
.resolution-card__identity p { margin: 0; color: var(--text-muted); font-size: .8rem; }
.resolution-reason { flex: 0 0 auto; padding: 5px 9px; border-radius: 999px; background: #fff1cf; color: #765000; font-size: .72rem; font-weight: 800; }
.resolution-reason--without_preferences { background: #eef1f4; color: #53616b; }
.resolution-reason--rejected { background: #ffebeb; color: #a12c2c; }
.resolution-reason--capacity { background: #fdebd9; color: #8a4814; }
.resolution-preferences { display: grid; gap: 7px; margin-top: 16px; }
.resolution-preference { display: grid; grid-template-columns: 66px minmax(180px, 1fr) auto 72px; gap: 12px; align-items: center; padding: 9px 11px; border-radius: 9px; background: var(--content-bg); }
.resolution-preference__order { color: var(--text-muted); font-size: .75rem; font-weight: 700; }
.resolution-preference__topic { min-width: 0; }
.resolution-preference__topic strong, .resolution-preference__topic span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.resolution-preference__topic strong { font-size: .84rem; }
.resolution-preference__topic span { margin-top: 2px; color: var(--text-muted); font-size: .74rem; }
.resolution-preference__capacity { color: var(--text-muted); font-size: .75rem; text-align: right; }
.resolution-card__no-preferences { margin: 15px 0 0; color: var(--text-secondary); font-size: .86rem; }
.resolution-card__recommendation { margin: 12px 0 0; color: var(--text-secondary); font-size: .82rem; }
.resolution-card__recommendation span { margin-right: 7px; padding: 3px 7px; border-radius: 6px; background: #e8f6ee; color: #207447; font-size: .68rem; font-weight: 800; text-transform: uppercase; }
.resolution-card__action { min-width: 145px; text-align: right; }
.resolution-card__action .btn { min-width: 132px; }
.resolution-queue__empty { padding: 48px 24px; }
.resolution-queue__empty strong { font-size: 1.05rem; }
.resolution-queue__empty p { margin: 6px 0 18px; color: var(--text-secondary); }
.resolution-modal .modal { width: min(580px, calc(100vw - 32px)); }
.resolution-modal__header { display: flex; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.resolution-modal__header .modal__title { margin-top: 3px; }
.resolution-modal__header p:last-child { margin: 5px 0 0; color: var(--text-secondary); font-size: .84rem; }
.resolution-modal__close { display: grid; flex: 0 0 34px; width: 34px; height: 34px; place-items: center; padding: 0; border: 0; border-radius: 50%; background: var(--border-subtle); color: var(--text-secondary); font-size: 1.3rem; cursor: pointer; }
.resolution-modal__hint { margin: 9px 0 0; color: var(--text-secondary); font-size: .78rem; }

@media (max-width: 760px) {
  .resolution-queue__header, .resolution-card, .resolution-card__identity { align-items: stretch; grid-template-columns: 1fr; flex-direction: column; }
  .resolution-card { gap: 18px; padding: 17px; }
  .resolution-reason { align-self: flex-start; }
  .resolution-preference { grid-template-columns: 58px minmax(0, 1fr); }
  .resolution-preference > .badge, .resolution-preference__capacity { justify-self: start; grid-column: 2; text-align: left; }
  .resolution-card__action { min-width: 0; text-align: left; }
  .resolution-card__action .btn { width: 100%; }
}

/* ----------------------------------------------------------
   Reset
---------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; -webkit-text-size-adjust: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--content-bg);
  color: var(--text-primary);
  line-height: 1.5;
  min-height: 100vh;
}

body.menu-is-open { overflow: hidden; }

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

.push-settings {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 20px;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.push-settings > div { min-width: 0; flex: 1; }
.push-settings__status { color: var(--text-muted); font-size: .8125rem; margin-top: 2px; }
.push-settings .btn:disabled { opacity: .65; cursor: not-allowed; }
.push-settings__ios-help { flex-basis: 100%; color: var(--text-secondary); font-size: .8125rem; }
.push-settings__ios-help[hidden] { display: none; }
.account-push-settings { max-width: 720px; margin-top: 20px; padding: 20px 24px; }
.account-push-settings__icon { display: grid; place-items: center; width: 42px; height: 42px; flex: 0 0 42px; color: var(--primary); background: var(--primary-light); border-radius: 50%; }
.account-push-settings__icon svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
@media (max-width: 600px) {
  .push-settings { align-items: flex-start; flex-wrap: wrap; }
  .push-settings .btn { flex-shrink: 0; }
}

:where(a, button, select, input, textarea):focus-visible {
  outline: 3px solid rgba(30, 96, 122, 0.45);
  outline-offset: 2px;
}

/* ----------------------------------------------------------
   Layout
---------------------------------------------------------- */
.layout {
  display: flex;
  min-height: 100vh;
}

/* ----------------------------------------------------------
   Sidebar
---------------------------------------------------------- */
.sidebar {
  position: fixed;
  top: 0; left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  z-index: 200;
  transition: transform 0.25s ease;
}

.sidebar__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  height: var(--topbar-height);
  border-bottom: 2px solid #4b6079;
  flex-shrink: 0;
}

.sidebar__logo {
  display: flex;
  align-items: center;
  gap: 11px;
  color: #f1f5f9;
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.sidebar__app-icon {
  display: block;
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  border-radius: 9px;
  box-shadow: 0 5px 14px rgba(15, 23, 42, .16);
}

.sidebar__close {
  display: none;
  background: none;
  border: none;
  color: var(--sidebar-text);
  font-size: 1.1rem;
  cursor: pointer;
  width: 44px;
  height: 44px;
  padding: 0;
  line-height: 1;
}

.sidebar__nav {
  flex: 1;
  overflow-y: auto;
  padding: 12px 0;
}

.sidebar__link {
  display: block;
  padding: 9px 20px;
  color: var(--sidebar-text);
  font-size: 0.875rem;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
}

.sidebar__link:hover {
  background: var(--sidebar-hover);
  color: var(--sidebar-text-active);
  text-decoration: none;
}

.sidebar__link--active {
  background: var(--sidebar-active);
  color: var(--sidebar-text-active);
  border-left: 3px solid var(--primary);
  padding-left: 17px;
}

.sidebar__link--dashboard.sidebar__link--active {
  background: transparent;
  color: var(--sidebar-text);
  border-left: 0;
  padding-left: 20px;
}

.sidebar__link--dashboard.sidebar__link--active:hover {
  background: var(--sidebar-hover);
  color: var(--sidebar-text-active);
}

.sidebar__section {
  margin-top: 18px;
  padding-top: 12px;
  border-top: 1px solid #253247;
}

.sidebar__section--global {
  border-top: 2px solid #4b6079 !important;
}

.sidebar__section-label {
  padding: 0 20px 5px;
  color: #e2e8f0;
  font-size: .67rem;
  font-weight: 700;
  letter-spacing: .13em;
  line-height: 1.3;
  text-transform: uppercase;
}

.sidebar__context-label {
  display: grid;
  gap: 3px;
  margin: 9px 12px 0;
  padding: 9px 11px 10px;
  color: #7dd3c7;
  background: #153044;
  border: 1px solid #28516a;
  border-left: 4px solid #33b6a3;
  border-radius: var(--radius-sm);
  font-size: .6rem;
  font-weight: 700;
  letter-spacing: .1em;
  line-height: 1.3;
  text-transform: uppercase;
}

.sidebar__context-label strong {
  color: #f1f5f9;
  font-size: .86rem;
  letter-spacing: 0;
  white-space: nowrap;
}

.sidebar__context-label--year {
  display: block;
  padding-top: 8px;
  padding-bottom: 8px;
  color: #fff;
  font-size: .63rem;
  line-height: 1.2;
  white-space: nowrap;
}

.sidebar__context-label--year strong {
  font-size: inherit;
}

.sidebar__footer {
  padding: 16px 20px;
  border-top: 1px solid var(--sidebar-border);
  flex-shrink: 0;
}

.sidebar-push-settings {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 8px 10px;
  margin: 0 12px 12px;
  padding: 12px;
  color: var(--sidebar-text-active);
  background: var(--sidebar-hover);
  border: 1px solid #334155;
  border-left: 3px solid var(--primary);
  border-radius: var(--radius);
  box-shadow: none;
  flex-shrink: 0;
}

.sidebar-push-settings__icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  grid-row: span 2;
  color: #67e8f9;
  background: rgba(103, 232, 249, .1);
  border-radius: 50%;
}

.sidebar-push-settings__icon svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.sidebar-push-settings strong { font-size: .82rem; }
.sidebar-push-settings .push-settings__status { color: var(--sidebar-text); font-size: .72rem; line-height: 1.35; }
.sidebar-push-settings .btn { grid-column: 1 / -1; width: 100%; min-height: 34px; padding: 6px 8px; color: #ecfeff; background: var(--primary); border-color: var(--primary); font-size: .75rem; }
.sidebar-push-settings .btn:hover { filter: brightness(1.12); }
.sidebar-push-settings .btn:disabled { color: var(--sidebar-text); background: transparent; border-color: #475569; }
.sidebar-push-settings .push-settings__ios-help { grid-column: 1 / -1; color: var(--sidebar-text); font-size: .7rem; }

.sidebar__user {
  margin-bottom: 10px;
}

.sidebar__user-name {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #f1f5f9;
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 4px;
}

.sidebar__user-edit {
  display: inline-grid;
  place-items: center;
  box-sizing: border-box;
  width: 24px;
  height: 24px;
  min-width: 24px;
  min-height: 24px;
  flex: 0 0 24px;
  padding: 5px;
  overflow: hidden;
  color: #67e8f9;
  background: rgba(103, 232, 249, .08);
  border: 1px solid rgba(103, 232, 249, .2);
  border-radius: 6px;
  transition: color .15s ease, background-color .15s ease;
}

.sidebar__user-edit:hover,
.sidebar__user-edit:focus-visible {
  color: var(--sidebar-text-active);
  background: rgba(103, 232, 249, .18);
  border-color: rgba(103, 232, 249, .42);
  text-decoration: none;
}

.sidebar__user-edit svg {
  display: block;
  width: 12px !important;
  height: 12px !important;
  max-width: 12px;
  max-height: 12px;
  flex: 0 0 12px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sidebar__logout {
  font-size: 0.8rem;
  color: var(--sidebar-text);
  text-decoration: none;
  display: inline-block;
  margin-top: 4px;
}

.sidebar__logout:hover {
  color: var(--danger);
  text-decoration: none;
}

/* ----------------------------------------------------------
   Sidebar overlay (mobil)
---------------------------------------------------------- */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 199;
}

/* ----------------------------------------------------------
   Hlavní oblast
---------------------------------------------------------- */
.main {
  flex: 1;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-width: 0;
}

.topbar {
  height: var(--topbar-height);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 100;
  flex-shrink: 0;
}

.topbar__hamburger {
  display: none;
  flex-direction: column;
  gap: 4px;
  background: none;
  border: none;
  cursor: pointer;
  width: 44px;
  height: 44px;
  padding: 0;
  align-items: center;
  justify-content: center;
}

.topbar__hamburger span {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--text-secondary);
  border-radius: 2px;
}

.topbar__title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.01em;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar__context {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  color: var(--text-muted);
  font-size: .8rem;
  white-space: nowrap;
}

.topbar__datetime { text-transform: capitalize; }
.topbar__school-year strong { color: var(--text-primary); }
.topbar__class strong { color: var(--text-primary); }
.topbar__context-separator { color: var(--border); }
.topbar-notifications { position: relative; flex: 0 0 auto; }
.topbar__notification-icon {
  display: grid;
  place-items: center;
  flex: 0 0 32px;
  width: 32px;
  height: 32px;
  color: var(--text-muted);
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  position: relative;
  border-radius: 50%;
  transition: color .18s ease, background-color .18s ease, box-shadow .18s ease, transform .18s ease;
}

.topbar__notification-icon:hover {
  color: var(--text-primary);
  background: var(--border-subtle);
  box-shadow: 0 4px 12px rgba(15, 23, 42, .12);
  transform: translateY(-1px);
}

.topbar__notification-icon svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.topbar__notification-count {
  position: absolute;
  top: -4px;
  right: -5px;
  display: grid;
  place-items: center;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border: 2px solid var(--surface);
  border-radius: 999px;
  background: #dc2626;
  color: #fff;
  font-size: .62rem;
  font-weight: 800;
  line-height: 1;
}

.topbar-notification-panel {
  position: absolute;
  z-index: 120;
  top: calc(100% + 12px);
  right: 0;
  width: min(390px, calc(100vw - 24px));
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: 0 18px 45px rgba(15, 23, 42, .18);
}

.topbar-feedback {
  position: absolute;
  z-index: 130;
  top: calc(100% + 12px);
  right: 0;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) 24px;
  align-items: start;
  gap: 11px;
  width: min(360px, calc(100vw - 24px));
  padding: 15px;
  border: 1px solid #a7f3d0;
  border-radius: 14px;
  background: var(--surface);
  box-shadow: 0 18px 45px rgba(15, 23, 42, .2);
  animation: topbar-feedback-in .18s ease-out both;
}
.topbar-feedback[hidden] { display: none; }
.topbar-feedback::before {
  position: absolute;
  top: -7px;
  right: 11px;
  width: 12px;
  height: 12px;
  border-top: 1px solid #a7f3d0;
  border-left: 1px solid #a7f3d0;
  background: var(--surface);
  content: "";
  transform: rotate(45deg);
}
.topbar-feedback__icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  color: #047857;
  background: #d1fae5;
}
.topbar-feedback__icon svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.topbar-feedback__content { display: grid; gap: 5px; min-width: 0; padding-top: 1px; }
.topbar-feedback__content strong { color: var(--text-primary); font-size: .88rem; line-height: 1.3; }
.topbar-feedback__content > span { color: var(--text-secondary); font-size: .83rem; line-height: 1.45; overflow-wrap: anywhere; }
.topbar-feedback__content a { width: fit-content; margin-top: 3px; color: var(--primary); font-size: .8rem; font-weight: 700; text-decoration: none; }
.topbar-feedback__content a:hover { text-decoration: underline; }
.topbar-feedback__close {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  color: var(--text-muted);
  background: transparent;
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
}
.topbar-feedback__close:hover { color: var(--text-primary); background: var(--border-subtle); }
@keyframes topbar-feedback-in {
  from { opacity: 0; transform: translateY(-5px); }
  to { opacity: 1; transform: translateY(0); }
}

.topbar-notification-panel__header,
.topbar-notification-panel__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
}

.topbar-notification-panel__header { border-bottom: 1px solid var(--border-subtle); }
.topbar-notification-panel__header h2 { margin: 0; font-size: 1.15rem; color: var(--text-primary); }
.topbar-notification-panel__close {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--text-muted);
  font-size: 1.3rem;
  cursor: pointer;
}
.topbar-notification-panel__close:hover { background: var(--border-subtle); color: var(--text-primary); }

.topbar-notification-tabs {
  display: flex;
  gap: 4px;
  padding: 10px 14px 6px;
}
.topbar-notification-tabs button,
.topbar-notification-panel__footer button,
.topbar-notification-panel__footer a {
  border: 0;
  background: transparent;
  color: var(--primary);
  font: inherit;
  font-size: .78rem;
  cursor: pointer;
  text-decoration: none;
}
.topbar-notification-tabs button { padding: 7px 11px; border-radius: 999px; color: var(--text-secondary); font-weight: 700; }
.topbar-notification-tabs button:hover,
.topbar-notification-tabs button.is-active { background: var(--primary-light); color: var(--primary); }

.topbar-notification-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: min(440px, calc(100vh - 230px));
  overflow-y: auto;
  padding: 4px 8px 8px;
}
.topbar-notification-empty { margin: 0; padding: 34px 16px; color: var(--text-muted); text-align: center; font-size: .85rem; }
.topbar-notification-panel__footer { border-top: 1px solid var(--border-subtle); padding-top: 11px; padding-bottom: 11px; }
.topbar-notification-panel__footer button[hidden] { display: none; }

.notification-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  position: relative;
  padding: 10px 8px;
  border-radius: 10px;
  color: var(--text-primary);
  text-decoration: none;
}
.notification-item:hover { background: var(--border-subtle); }
.notification-item--unread { background: #f0f7ff; }
.notification-item[hidden] { display: none; }
.notification-item__icon {
  display: grid;
  place-items: center;
  flex: 0 0 34px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  color: var(--primary);
  background: var(--primary-light);
}
.notification-item__icon--attention { color: #b45309; background: #fef3c7; }
.notification-item__icon--success { color: #047857; background: #d1fae5; }
.notification-item__icon svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.notification-item__body { display: grid; gap: 2px; min-width: 0; padding-right: 12px; }
.notification-item__body strong { color: var(--text-primary); font-size: .83rem; line-height: 1.25; }
.notification-item__body > span { color: var(--text-secondary); font-size: .77rem; line-height: 1.35; }
.notification-item__body time { color: var(--text-muted); font-size: .7rem; }
.notification-item__dot { position: absolute; top: 23px; right: 7px; width: 8px; height: 8px; border-radius: 50%; background: #1877f2; }

.notifications-page { max-width: 900px; margin: 0 auto; }
.notifications-page__header { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 20px; }
.notifications-page__header h2 { margin: 0 0 5px; color: var(--text-primary); }
.notifications-page__eyebrow { margin: 0 0 5px; color: var(--primary); font-size: .7rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.notifications-page__header p { margin: 0; }
.notifications-page__list { padding: 8px; }
.notifications-page__list .notification-item { padding: 14px; border-bottom: 1px solid var(--border-subtle); border-radius: 0; }
.notifications-page__list .notification-item:last-child { border-bottom: 0; }

@media (max-width: 560px) {
  .topbar-notification-panel { position: fixed; top: 60px; right: 12px; left: 12px; width: auto; }
  .topbar-feedback { position: fixed; top: 60px; right: 12px; }
  .notifications-page__header { display: block; }
  .notifications-page__header form { margin-top: 14px; }
}
body:not(.student-shell) .dashboard__welcome { display: none; }

@media (max-width: 760px) {
  .topbar__datetime, .topbar__context-separator { display: none; }
  .topbar__school-year { font-size: .75rem; }
}

@media (max-width: 480px) {
  .topbar__school-year { display: none; }
}

.content {
  flex: 1;
  padding: 28px 32px;
  max-width: none;
  width: 100%;
  min-width: 0;
}

/* ----------------------------------------------------------
   Login layout
---------------------------------------------------------- */
.body--blank {
  background: var(--sidebar-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}

.login-wrap {
  width: 100%;
  max-width: 420px;
  padding: 20px;
}

.login-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 40px 36px;
  box-shadow: var(--shadow);
}

.login-card__header {
  margin-bottom: 28px;
  text-align: center;
}

.login-card__brand {
  display: grid;
  grid-template-columns: 72px 1fr;
  align-items: center;
  gap: 18px;
  width: 100%;
  margin-bottom: 14px;
}

.login-card__app-icon {
  flex: 0 0 auto;
  width: 72px;
  height: 72px;
  border-radius: 18px;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.16);
}

.login-card__title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  margin: 0;
  text-align: center;
}

.login-card__sub {
  color: var(--text-muted);
  font-size: 0.875rem;
}

.login-microsoft-btn {
  gap: 10px;
  min-height: 44px;
  padding-right: 16px;
  padding-left: 16px;
  white-space: normal;
  line-height: 1.35;
  text-align: center;
}

.login-microsoft-btn__icon {
  width: 19px;
  height: 19px;
  flex: 0 0 19px;
}

.login-auth-divider {
  margin: 16px 0 12px;
  color: var(--text-muted);
  font-size: 0.8125rem;
  line-height: 1.4;
  text-align: center;
}

@media (max-width: 420px) {
  .login-microsoft-btn {
    padding-right: 12px;
    padding-left: 12px;
    font-size: 0.8125rem;
  }
}

/* ----------------------------------------------------------
   Formuláře
---------------------------------------------------------- */
.form-group {
  margin-bottom: 18px;
}

.form-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.form-input {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.9375rem;
  color: var(--text-primary);
  background: var(--surface);
  transition: border-color 0.15s, box-shadow 0.15s;
  outline: none;
}

.form-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(30,96,122,0.12);
}

.form-input::placeholder {
  color: var(--text-muted);
}

.subject-autocomplete { position: relative; }
.subject-autocomplete__list {
  position: absolute;
  z-index: 80;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  max-height: 260px;
  overflow-y: auto;
  padding: 5px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: 0 14px 32px rgba(15, 35, 48, .18);
}
.subject-autocomplete__list[hidden] { display: none; }
.subject-autocomplete__option {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 11px;
  border: 0;
  border-radius: 8px;
  color: var(--text-primary);
  background: transparent;
  cursor: pointer;
  text-align: left;
  font: inherit;
}
.subject-autocomplete__option:hover,
.subject-autocomplete__option.is-active { background: rgba(30, 96, 122, .09); }
.subject-autocomplete__option small {
  flex: 0 0 auto;
  color: var(--text-muted);
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .035em;
}

input[type="datetime-local"] {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: textfield;
  padding-right: 0;
}

input[type="datetime-local"]::-webkit-outer-spin-button,
input[type="datetime-local"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  display: none !important;
  margin: 0;
  width: 0 !important;
  height: 0 !important;
}

input[type="datetime-local"]::-webkit-calendar-picker-indicator {
  display: none !important;
  cursor: none;
}

input[type="datetime-local"]::-moz-number-spin-up,
input[type="datetime-local"]::-moz-number-spin-down {
  display: none;
}

/* ----------------------------------------------------------
   Tlačítka
---------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 20px;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s, box-shadow 0.15s;
  white-space: nowrap;
}

.btn--primary {
  background: var(--primary);
  color: #fff;
}

.btn--primary:hover {
  background: var(--primary-hover);
  text-decoration: none;
  color: #fff;
}

.btn--full {
  width: 100%;
  margin-top: 8px;
}

.btn--ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.btn--ghost:hover {
  background: var(--border-subtle);
  text-decoration: none;
}

.btn--danger {
  background: var(--danger);
  color: #fff;
}

/* ----------------------------------------------------------
   Alerty
---------------------------------------------------------- */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 0.875rem;
  margin-bottom: 20px;
  font-weight: 500;
}

.alert--success {
  background: var(--success-bg);
  color: #065f46;
  border: 1px solid #a7f3d0;
}

.alert--error {
  background: var(--danger-bg);
  color: #991b1b;
  border: 1px solid #fecaca;
}

.alert--warning {
  background: var(--warning-bg);
  color: #92400e;
  border: 1px solid #fde68a;
}

.alert--info {
  background: var(--info-bg);
  color: #1e40af;
  border: 1px solid #bfdbfe;
}

/* ----------------------------------------------------------
   Info banner
---------------------------------------------------------- */
.info-banner {
  padding: 14px 18px;
  border-radius: var(--radius);
  font-size: 0.875rem;
  margin-bottom: 24px;
  line-height: 1.6;
}

.info-banner--blue {
  background: var(--info-bg);
  color: #1e3a8a;
  border-left: 4px solid var(--info);
}

/* ----------------------------------------------------------
   Badges
---------------------------------------------------------- */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  max-width: 100%;
  overflow-wrap: anywhere;
  line-height: 1.35;
}

.badge--purple { background: #e8f1f5; color: #1e607a; }
.badge--blue   { background: #dbeafe; color: #1d4ed8; }
.badge--teal   { background: #ccfbf1; color: #0f766e; }
.badge--green  { background: #dcfce7; color: #15803d; }
.badge--gray   { background: #f1f5f9; color: #475569; }
.badge--red    { background: #fee2e2; color: #b91c1c; }
.badge--amber  { background: #fef3c7; color: #92400e; }

/* ----------------------------------------------------------
   Dashboard
---------------------------------------------------------- */
.dashboard__welcome {
  margin-bottom: 28px;
}

.dashboard__welcome h2 {
  font-size: 1.375rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  margin-bottom: 4px;
}

.dashboard-section {
  margin-bottom: 28px;
}

.dashboard-section__title {
  margin: 0 0 12px;
  color: var(--text-primary);
  font-size: .82rem;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

/* ----------------------------------------------------------
   Karty
---------------------------------------------------------- */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  box-shadow: var(--shadow-sm);
  min-width: 0;
  overflow-wrap: anywhere;
}

.card--stat .card__label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.card--stat .card__value {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--text-primary);
  background: transparent;
  letter-spacing: -0.03em;
  margin-bottom: 8px;
  line-height: 1;
}

.card--stat .card__action a {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--primary);
}

.card--action {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.card--action .card__icon {
  font-size: 1.5rem;
  margin-bottom: 4px;
}

.card--action .card__label {
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--text-primary);
}

.card--action .card__desc {
  font-size: 0.8125rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.card__status {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
  max-width: 100%;
  overflow-wrap: anywhere;
  line-height: 1.35;
}

/* ----------------------------------------------------------
   Stavy
---------------------------------------------------------- */
.status--ok     { background: var(--success-bg); color: #065f46; }
.status--warning{ background: var(--warning-bg); color: #92400e; }
.status--danger { background: var(--danger-bg);  color: #991b1b; }
.status--closed { background: var(--border-subtle); color: var(--text-muted); }

/* ----------------------------------------------------------
   Chybové stránky
---------------------------------------------------------- */
.error-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  text-align: center;
  padding: 40px 20px;
}

.error-page__code {
  font-size: 6rem;
  font-weight: 900;
  color: var(--border);
  line-height: 1;
  margin-bottom: 16px;
  letter-spacing: -0.05em;
}

.error-page__title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 10px;
}

.error-page__message {
  color: var(--text-muted);
  margin-bottom: 24px;
  max-width: 400px;
}

/* ----------------------------------------------------------
   Pomocné třídy
---------------------------------------------------------- */
.text-muted   { color: var(--text-muted); font-size: 0.875rem; }
.section-note {
  background: var(--border-subtle);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 14px 18px;
  color: var(--text-muted);
  font-size: 0.8125rem;
}

/* ----------------------------------------------------------
   Sprint 2: Tabulky
---------------------------------------------------------- */
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.table-scroll {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.table-scroll .table {
  min-width: max-content;
}

.table th {
  padding: 10px 14px;
  text-align: left;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}

.table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: middle;
  color: var(--text-primary);
}

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

.table tbody tr:hover td { background: var(--border-subtle); }

.table__actions {
  white-space: nowrap;
  text-align: right;
}

.table__actions .btn + .btn { margin-left: 4px; }

/* Tabulka uživatelů: akce zůstávají celé a vedle sebe. */
.users-table-scroll {
  overflow-x: auto;
}

.users-table-scroll .users-table {
  width: 100%;
  min-width: 1080px;
}

.users-table__name-column {
  min-width: 235px;
  white-space: nowrap;
}

.users-table th,
.users-table td {
  white-space: nowrap;
}

.users-table th:nth-child(2),
.users-table td:nth-child(2) {
  min-width: 225px;
}

.users-table th:nth-child(3),
.users-table td:nth-child(3) {
  min-width: 165px;
}

.users-table th:nth-child(5),
.users-table td:nth-child(5) {
  min-width: 140px;
}

.users-table th:nth-child(6),
.users-table td:nth-child(6) {
  min-width: 90px;
}

.users-table__actions-column {
  width: 128px;
  min-width: 128px;
}

.users-table__actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  white-space: nowrap;
}

/* Uživatelé: dvousloupcový seznam a detail vybraného účtu. */
.users-master-detail {
  display: grid;
  grid-template-columns: minmax(330px, .75fr) minmax(440px, 1.25fr);
  gap: 20px;
  align-items: start;
}

.users-master-detail__list-column { display: grid; gap: 16px; min-width: 0; }
.school-years-year-form,
.school-years-students { padding: 28px; }
.school-years-year-form__fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.school-years-students { position: sticky; top: 88px; min-width: 0; }
.school-years-users-scroll {
  max-height: clamp(320px, 55vh, 620px);
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  border-bottom: 1px solid var(--border-subtle);
}
.school-years-users-scroll .table {
  margin: 0;
}
.school-years-users-scroll .table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--surface);
  box-shadow: 0 1px 0 var(--border);
}
.school-years-users-scroll:focus-visible {
  outline: 3px solid rgba(37, 99, 235, .2);
  outline-offset: 2px;
  border-radius: var(--radius);
}
.school-years-staff-form { display: grid; gap: 12px; margin-bottom: 28px; }
.school-years-subjects { padding: 0; border: 0; }
.school-years-subjects__list { display: flex; flex-wrap: wrap; gap: 8px 14px; }
.school-years-staff-list { display: grid; gap: 8px; margin-bottom: 28px; }
.school-years-staff-member { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 0; border-top: 1px solid var(--border-subtle); }
.school-years-staff-member strong, .school-years-staff-member span, .school-years-staff-member small { display: block; }
.school-years-staff-member span, .school-years-staff-member small { color: var(--text-muted); font-size: .76rem; }
.school-years-staff-member small { margin-top: 2px; }
.school-years-students-section { padding-top: 24px; border-top: 1px solid var(--border-subtle); }
.users-filters { padding: 16px; }
.users-filters__toolbar { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border-subtle); }
.users-filters__toolbar .btn { width: 100%; }
.users-filters__form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; align-items: end; }
.users-filters__form .form-group { min-width: 0; }
.users-filters__search { grid-column: 1 / -1; display: block; }
.users-filters__search .form-label { display: block; margin-bottom: 6px; }
.users-filters__form .form-input { width: 100%; min-width: 0; }
.users-filters__actions { grid-column: 1 / -1; display: flex; gap: 6px; }
.users-filter-control { position: relative; }
.users-filter-control .form-input { padding-right: 40px; }
.users-filter-control--search input::-webkit-search-cancel-button { display: none; }
.users-filter-control__clear { position: absolute; top: 50%; right: 8px; display: grid; place-items: center; width: 30px; height: 30px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: var(--text-muted); font-size: 1.25rem; line-height: 1; cursor: pointer; transform: translateY(-50%); }
.users-filter-control__clear:hover { color: var(--text-primary); background: var(--border-subtle); }
.users-filter-control__clear[hidden] { display: none; }
.users-filter-control__arrow { position: absolute; top: 50%; right: 14px; color: var(--text-muted); font-size: 1.1rem; line-height: 1; pointer-events: none; transform: translateY(-58%); }
.users-filter-control--select .form-select { appearance: none; }
.users-list { padding: 8px; max-height: calc(100vh - 330px); min-height: 260px; overflow-y: auto; }
.users-list__item { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 13px 14px; border: 1px solid transparent; border-radius: var(--radius); color: inherit; }
.users-list__item + .users-list__item { margin-top: 4px; }
.users-list__item:hover { background: var(--border-subtle); }
.users-list__item--active { border-color: var(--primary); background: var(--primary-light); }
.users-list__item-link { display: flex; align-items: center; flex: 1 1 auto; min-width: 0; color: inherit; text-decoration: none; }
.users-list__main { display: grid; gap: 3px; min-width: 0; }
.users-list__main strong, .users-list__main span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.users-list__main span { color: var(--text-muted); font-size: .8rem; }
.users-list__meta { display: flex; align-items: center; gap: 9px; flex-shrink: 0; }
.school-year-toggle-form { display: inline-flex; margin: 0; }
.school-year-toggle {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-width: 64px;
  justify-content: flex-end;
  color: var(--text-muted);
  font-size: .65rem;
  font-weight: 800;
  letter-spacing: .06em;
  line-height: 1;
  white-space: nowrap;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}
.school-year-toggle:disabled { cursor: not-allowed; opacity: .72; }
.school-year-toggle:not(:disabled):hover .school-year-toggle__track { box-shadow: inset 0 1px 2px rgba(15, 23, 42, .14), 0 0 0 4px rgba(15, 118, 110, .11); }
.school-year-toggle:not(:disabled):focus-visible { outline: 3px solid rgba(37, 99, 235, .25); outline-offset: 3px; border-radius: 6px; }
.school-year-toggle__track {
  position: relative;
  display: block;
  width: 36px;
  height: 20px;
  border-radius: 999px;
  background: #dbe4e9;
  box-shadow: inset 0 1px 2px rgba(15, 23, 42, .14);
  transition: background-color .18s ease, box-shadow .18s ease;
}
.school-year-toggle__thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 4px rgba(15, 23, 42, .24);
  transition: transform .18s ease;
}
.school-year-toggle--on { color: #0f766e; }
.school-year-toggle--on .school-year-toggle__track {
  background: linear-gradient(135deg, #32c7b2, #0f9d8d);
  box-shadow: inset 0 1px 2px rgba(6, 78, 59, .18), 0 0 0 3px rgba(45, 212, 191, .1);
}
.school-year-toggle--on .school-year-toggle__thumb { transform: translateX(16px); }
.school-year-toggle--off .school-year-toggle__label { color: var(--text-muted); }
.school-year-delete-button { margin-left: auto; }
.users-list__status { width: 9px; height: 9px; border-radius: 50%; background: var(--danger); }
.users-list__status--active { background: var(--success); }
.users-detail { position: sticky; top: 88px; padding: 28px; min-height: 300px; }
.users-detail__header { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; padding-bottom: 22px; border-bottom: 1px solid var(--border-subtle); }
.users-detail__header h3 { margin: 2px 0 4px; font-size: 1.25rem; }
.users-detail__eyebrow { margin: 0; color: var(--text-muted); font-size: .72rem; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; }
.users-detail__list { margin-top: 22px; }
.users-detail__actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 26px; padding-top: 20px; border-top: 1px solid var(--border-subtle); }
.users-detail__placeholder { display: grid; place-items: center; align-content: center; min-height: 240px; text-align: center; }
.users-detail__placeholder-icon { display: grid; place-items: center; width: 44px; height: 44px; margin-bottom: 12px; border-radius: 50%; background: var(--primary-light); color: var(--primary); font-size: 1.35rem; }
.users-detail__placeholder h3 { margin-bottom: 6px; }
.users-inline-form__header { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; padding-bottom: 22px; border-bottom: 1px solid var(--border-subtle); }
.users-inline-form__header h3 { margin: 2px 0 4px; font-size: 1.25rem; }
.users-inline-form__header-actions { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.users-inline-form { padding-top: 22px; }
.users-inline-form h3 { margin-top: 24px; }
.users-inline-form h3:first-of-type { margin-top: 0; }

/* Maturitní práce používají stejný master-detail vzor jako uživatelé. */
.works-master-detail {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

.works-list {
  min-height: 0;
  max-height: calc(100vh - 200px);
}

.works-filters__create { display: flex; min-width: 0; }
.works-filters__create .btn { width: 100%; min-height: 42px; }
.works-list__capacity { white-space: nowrap; }
.works-list__item-link { justify-content: space-between; gap: 12px; }
.works-list__toggle-form { flex: 0 0 auto; margin: 0; }
.works-list__toggle-form .school-year-toggle { min-height: 28px; }
.works-detail .form-textarea { min-height: 110px; resize: vertical; }
.works-submit-form, .works-review-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--border-subtle); }
.works-review-actions form { margin: 0; }

@media (max-width: 900px) {
  .users-master-detail { grid-template-columns: minmax(0, 1fr); }
  .users-list { max-height: 460px; }
  .school-years-users-scroll { max-height: 460px; }
  .users-detail,
  .school-years-students { position: static; }
}

@media (max-width: 420px) {
  .school-years-year-form__fields { grid-template-columns: minmax(0, 1fr); }
  .users-filters__form { grid-template-columns: minmax(0, 1fr); }
  .users-filters__toolbar { grid-template-columns: minmax(0, 1fr); }
  .users-filters__search { grid-column: auto; }
  .users-filters__actions { grid-column: auto; }
}

.users-table__actions form {
  display: inline-flex;
  margin: 0;
}

.users-table__deactivate {
  width: 34px;
  min-width: 34px;
  padding-inline: 0;
}

.users-table__deactivate svg {
  width: 16px;
  height: 16px;
}

.work-delete-button { margin-left: auto; }
.work-delete-button--header { margin-left: 0; flex: 0 0 34px; }

/* Na desktopu se tabulky vždy přizpůsobí šířce obsahu. Horizontální posun
   zůstává jen jako mobilní pojistka, kde by příliš úzké sloupce nebyly čitelné. */
@media (min-width: 769px) {
  .table-scroll,
  .users-table-scroll {
    overflow-x: visible;
  }

  .table-scroll .table,
  .users-table-scroll .users-table {
    min-width: 0;
    table-layout: fixed;
  }

  .table th,
  .table td,
  .users-table th,
  .users-table td,
  .users-table__name-column {
    min-width: 0;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .table__actions {
    white-space: normal;
  }

  .table td .btn {
    max-width: 100%;
    padding-inline: 10px;
    white-space: normal;
    overflow-wrap: anywhere;
    line-height: 1.2;
  }

  /* Název práce potřebuje nejvíc prostoru; provozní sloupce zůstávají
     kompaktní u sebe a tabulka se na desktopu neroztahuje do posuvníku. */
  .works-table--admin .works-table__title-column { width: 52%; }
  .works-table--admin .works-table__teacher-column { width: 21%; }
  .works-table--admin .works-table__capacity-column { width: 8%; }
  .works-table--admin .works-table__status-column { width: 8%; }
  .works-table--admin .works-table__actions-column { width: 11%; }

  .works-table--teacher .works-table__title-column { width: 64%; }
  .works-table--teacher .works-table__capacity-column { width: 10%; }
  .works-table--teacher .works-table__status-column { width: 10%; }
  .works-table--teacher .works-table__actions-column { width: 16%; }

  .applicants-table {
    width: 100%;
    table-layout: fixed;
  }

  .applicants-table__work-column { width: 34%; }
  .applicants-table__count-column { width: 11%; }
  .applicants-table__remaining-column { width: 11%; }
  .applicants-table__capacity-column { width: 15%; }
  .applicants-table__actions-column { width: 18%; }

  .applicants-table td:first-child {
    overflow-wrap: anywhere;
  }

  .applicants-table .table__actions {
    white-space: nowrap;
  }

  .capacity-table th:first-child { width: 10%; }
  .capacity-table th:nth-child(2) { width: 40%; }
  .capacity-table th:nth-child(3) { width: 23%; }
  .capacity-table th:nth-child(n+4) { width: 6.75%; }

  .capacity-table th:nth-child(n+3),
  .capacity-table td:nth-child(n+3) {
    text-align: center;
  }

  .users-table__actions-column {
    width: auto;
    min-width: 0;
  }

  .users-table__actions {
    flex-wrap: wrap;
  }
}

/* SUPER_ADMIN — student progress master-detail */
.student-progress-master-detail {
  margin-bottom: 28px;
}

.student-progress-master-detail__header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 12px;
}

.student-progress-master-detail__header h3 {
  margin: 0 0 5px;
  color: var(--text-primary);
  font-size: 1.2rem;
}

.student-progress-master-detail__header p:last-child {
  margin: 0;
  font-size: .82rem;
}

.section-eyebrow {
  margin: 0 0 5px;
  color: var(--primary);
  font-size: .7rem;
  font-weight: 800;
  letter-spacing: .09em;
  line-height: 1.3;
  text-transform: uppercase;
}

.student-progress-sort {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
  color: var(--text-muted);
  font-size: .78rem;
  font-weight: 700;
}

.student-progress-sort select {
  min-width: 172px;
  padding: 8px 30px 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text-primary);
  font: inherit;
}

.student-progress-master-detail__body {
  display: grid;
  grid-template-columns: minmax(300px, .8fr) minmax(0, 1.5fr);
  gap: 20px;
  align-items: start;
}

.student-progress-list,
.student-progress-detail {
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.student-progress-list {
  max-height: 650px;
  padding: 8px;
  overflow-y: auto;
}

.student-progress-list__item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 14px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  color: inherit;
  text-decoration: none;
}

.student-progress-list__item + .student-progress-list__item { margin-top: 4px; }
.student-progress-list__item:hover { background: var(--border-subtle); }
.student-progress-list__item[href*="student="]:focus-visible { outline: 3px solid rgba(30, 96, 122, .2); outline-offset: 1px; }
.student-progress-list__item--active { border-color: var(--primary); background: var(--primary-light); }
.student-progress-list__main { display: grid; gap: 4px; min-width: 0; }
.student-progress-list__main strong,
.student-progress-list__main span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.student-progress-list__main span { color: var(--text-muted); font-size: .78rem; }
.student-progress-list__meta { display: flex; align-items: flex-end; flex-direction: column; gap: 5px; flex: 0 0 auto; color: var(--text-muted); font-size: .7rem; }

.student-progress-detail {
  position: sticky;
  top: 88px;
  min-height: 330px;
  padding: 26px;
}

.student-progress-detail__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border-subtle);
}

.student-progress-detail__header h3 { margin: 0 0 5px; font-size: 1.35rem; }
.student-progress-detail__header p:last-child { margin: 0; font-size: .82rem; }
.student-progress-detail__section { padding-top: 20px; }
.student-progress-detail__section + .student-progress-detail__section { margin-top: 20px; border-top: 1px solid var(--border-subtle); }
.student-progress-detail__section h4 { margin: 0 0 12px; color: var(--text-primary); font-size: .88rem; }
.student-progress-detail__empty { margin: 0; color: var(--text-muted); font-size: .84rem; }

.student-progress-preferences { display: grid; gap: 10px; }
.student-progress-preference { padding: 14px 16px; border: 1px solid var(--border-subtle); border-left: 3px solid var(--border); border-radius: var(--radius); background: var(--surface-muted); }
.student-progress-preference:first-child { border-left-color: var(--primary); }
.student-progress-preference:nth-child(2) { border-left-color: var(--color-success); }
.student-progress-preference__topline { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.student-progress-preference__order { color: var(--text-muted); font-size: .7rem; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; }
.student-progress-preference h5 { margin: 0 0 4px; color: var(--text-primary); font-size: .98rem; }
.student-progress-preference p { margin: 7px 0 0; color: var(--text-secondary); font-size: .8rem; line-height: 1.45; }
.student-progress-preference__teacher { color: var(--text-muted) !important; }
.student-progress-preference__motivation { padding-top: 7px; border-top: 1px solid var(--border-subtle); }
.student-progress-detail__assignment p { margin: 0 0 6px; font-size: .86rem; }
.student-progress-detail__reason { margin-top: 12px !important; color: var(--warning) !important; }
.student-progress-detail__placeholder { display: grid; place-items: center; align-content: center; min-height: 280px; text-align: center; }
.student-progress-detail__placeholder > div { display: grid; place-items: center; width: 44px; height: 44px; margin-bottom: 12px; border-radius: 50%; background: var(--primary-light); color: var(--primary); font-size: 1.35rem; }
.student-progress-detail__placeholder h3 { margin-bottom: 6px; }
.student-progress-detail__placeholder p { max-width: 300px; margin: 0; font-size: .84rem; }

@media (max-width: 900px) {
  .student-progress-master-detail__body { grid-template-columns: minmax(0, 1fr); }
  .student-progress-list { max-height: 460px; }
  .student-progress-detail { position: static; }
}

@media (max-width: 600px) {
  .student-progress-master-detail__header { align-items: stretch; flex-direction: column; gap: 12px; }
  .student-progress-sort { justify-content: space-between; }
  .student-progress-sort select { flex: 1; }
  .student-progress-detail { padding: 20px 16px; }
}

/* ----------------------------------------------------------
   Sprint 2: Stránkové hlavičky
---------------------------------------------------------- */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}

.page-header h2 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  margin-bottom: 2px;
  min-width: 0;
  overflow-wrap: anywhere;
}

/* Horní lišta už obsahuje název stránky. V pracovních rolích proto v hlavním
   obsahu skrýváme jeho duplicitní kopii, ale ponecháváme filtry a akce. */
.management-shell .content > .page-header > div:first-child {
  display: none;
}

.management-shell .content > .page-header {
  justify-content: flex-end;
}

.management-shell .content > .page-header:has(> div:first-child:last-child) {
  display: none;
}

.page-bottom-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}

/* Stavové hlášky jsou už obsažené v přehledu fáze a widgetech. */
.management-shell .content > .info-banner,
.management-shell .content > .dashboard > .info-banner,
.management-shell .content > .results-overview > .results-overview__pre-publish > .info-banner {
  display: none;
}

/* ----------------------------------------------------------
   Sprint 2: Formuláře — rozšíření
---------------------------------------------------------- */
.form-card { padding: 28px 32px; max-width: 720px; }
.schedule-editor-layout--quick { display: grid; grid-template-columns: minmax(0, 720px) minmax(300px, 390px); gap: 20px; align-items: start; }
.schedule-editor-layout--quick .form-card { max-width: none; }
.schedule-quick-builder { position: sticky; top: 88px; padding: 24px; }
.schedule-quick-builder h3 { margin: 3px 0 7px; font-size: 1.1rem; }
.schedule-quick-builder > .text-muted { margin: 0 0 20px; font-size: .84rem; line-height: 1.45; }
.schedule-quick-builder__start { display: grid; grid-template-columns: minmax(0, 1fr) 104px; gap: 10px; }
.schedule-quick-builder__start label { display: grid; gap: 5px; color: var(--text-muted); font-size: .72rem; }
.schedule-quick-builder__start input { min-width: 0; }
.schedule-quick-builder__phase { display: flex; align-items: end; justify-content: space-between; gap: 12px; padding: 12px 0; border-top: 1px solid var(--border-subtle); }
.schedule-quick-builder__phase strong { font-size: .84rem; }
.schedule-quick-builder__duration { display: flex; gap: 8px; }
.schedule-quick-builder__phase label { display: grid; gap: 5px; width: 76px; color: var(--text-muted); font-size: .72rem; }
.schedule-quick-builder__phase input { padding: 8px 9px; }
.schedule-quick-builder__preview { margin: 14px 0; padding: 13px; border-radius: var(--radius); background: var(--primary-light); color: var(--text-secondary); font-size: .8rem; line-height: 1.45; }
.schedule-quick-builder__preview strong { display: block; color: var(--text-primary); }
.schedule-quick-builder__preview ol { margin: 8px 0 0 18px; padding: 0; }
.schedule-quick-builder__preview li + li { margin-top: 5px; }
.schedule-quick-builder__applied { margin: 10px 0 0; color: var(--success-dark, #047857); font-weight: 700; }
.schedule-quick-builder [data-quick-apply] { margin-top: 12px; }
@media (max-width: 1180px) { .schedule-editor-layout--quick { grid-template-columns: minmax(0, 720px); } .schedule-quick-builder { position: static; max-width: 720px; } }

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  min-width: 0;
}

.form-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border-subtle);
}

.form-hint {
  font-size: 0.775rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.form-static {
  padding: 10px 14px;
  background: var(--border-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.9375rem;
  color: var(--text-secondary);
}

.form-textarea {
  resize: vertical;
  min-height: 80px;
  display: block;
}

.form-select { appearance: none; cursor: pointer; }

.form-check {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  cursor: pointer;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.form-check input[type="checkbox"] {
  margin-top: 3px;
  flex-shrink: 0;
  accent-color: var(--primary);
  width: 15px;
  height: 15px;
}

.required { color: var(--danger); margin-left: 2px; }

/* ----------------------------------------------------------
   Sprint 2: Prázdné stavy
---------------------------------------------------------- */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted);
}

.empty-state p { margin-bottom: 16px; }

.empty-state--sm {
  padding: 24px 16px;
}

/* ----------------------------------------------------------
   Sprint 2: Detail layout (oblast)
---------------------------------------------------------- */
.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  align-items: start;
}

.detail-card { padding: 24px; }

.detail-card__title {
  font-size: 0.875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.detail-card__actions {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border-subtle);
}

.detail-list {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 10px 16px;
  font-size: 0.875rem;
}

.detail-list dt {
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.8rem;
  padding-top: 1px;
}

.detail-list dd { color: var(--text-primary); }

/* ----------------------------------------------------------
   Sprint 2: Dashboard — časová okna summary
---------------------------------------------------------- */
.card-section-title {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  padding: 16px 20px 8px;
  border-bottom: 1px solid var(--border-subtle);
}

.tw-summary { padding: 8px 0; }

.tw-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 20px;
  border-bottom: 1px solid var(--border-subtle);
}

.tw-row:last-child { border-bottom: none; }

.tw-row__label {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.tw-row__meta {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 3px;
  text-align: right;
}

.tw-row__times {
  font-size: 0.72rem;
  color: var(--text-muted);
  white-space: normal;
}

/* ----------------------------------------------------------
   Sprint 2: Malá tlačítka
---------------------------------------------------------- */
.btn--sm {
  padding: 5px 12px;
  font-size: 0.8rem;
}

/* ----------------------------------------------------------
   Sprint 3: Choice karty (studentský výběr)
---------------------------------------------------------- */
.choice-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  border: 2px solid var(--border);
  transition: border-color 0.15s;
}

.choice-card--first  { border-color: var(--primary); }
.choice-card--second { border-color: var(--border); }

.choice-card__order {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--primary);
}

.choice-card--second .choice-card__order { color: var(--text-muted); }

.choice-card__name {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.choice-card__teacher {
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.choice-card__desc {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.choice-card__meta {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: auto;
  padding-top: 8px;
}

.card-grid > .card {
  min-width: 0;
  overflow-wrap: anywhere;
}

@media (max-width: 600px) {
  .card-grid > .card {
    padding-left: 14px !important;
    padding-right: 14px !important;
  }
}

/* disabled button */
button[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

.work-edit-save:disabled {
  color: var(--text-muted);
  background: var(--border-subtle);
  border-color: var(--border);
  box-shadow: none;
  opacity: 1;
}

/* ----------------------------------------------------------
   Modální okno (vlastní, ne browser alert)
---------------------------------------------------------- */
.modal-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  z-index: 500;
  /* Flexbox = spolehlivé středování bez kalkulací */
  align-items: center;
  justify-content: center;
  padding: 20px;
  overflow-y: auto;
}

.modal-backdrop.is-open {
  display: flex;
}

.modal {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 28px 32px;
  width: calc(100% - 40px);
  max-width: 400px;
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  box-shadow: 0 8px 40px rgba(0,0,0,.18);
  animation: modal-in .18s ease;
}

@keyframes modal-in {
  from { opacity: 0; transform: scale(.96) translateY(6px); }
  to   { opacity: 1; transform: scale(1)  translateY(0);    }
}

.modal__title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 10px;
  letter-spacing: -0.01em;
}

.modal__body {
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 22px;
}

.modal__footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.modal--danger { border-top: 4px solid var(--danger); }

.teacher-returned-alert {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border-left: 4px solid var(--danger);
}

.teacher-returned-alert p { margin: 4px 0 0; }
.teacher-returned-alert .btn { flex: 0 0 auto; }
.teacher-returned-modal__list { margin: 8px 0 16px 20px; }
.teacher-returned-modal__list li + li { margin-top: 5px; }

@media (max-width: 640px) {
  .teacher-returned-alert { align-items: flex-start; flex-direction: column; }
  .teacher-returned-alert .btn { width: 100%; }
  #teacher-returned-modal .modal__footer { align-items: stretch; flex-direction: column-reverse; }
  #teacher-returned-modal .modal__footer .btn { width: 100%; }
}

/* ----------------------------------------------------------
   Filtr školního roku (admin / super admin přehledy)
---------------------------------------------------------- */
.year-filter {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.year-filter__label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.year-filter__select {
  appearance: none;
  padding: 6px 28px 6px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%2394a3b8' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat right 10px center;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
  cursor: pointer;
  min-width: 150px;
}

.year-filter__select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(30,96,122,.12);
}

.sidebar__year-switcher {
  flex-shrink: 0;
  margin: 0 12px 12px;
  padding: 0;
  max-width: calc(100% - 24px);
}

.sidebar__year-switcher .year-filter {
  display: block;
  width: 100%;
}

.sidebar__year-switcher .year-filter__select {
  width: 100%;
  min-width: 0;
  height: 36px;
  padding: 7px 23px 7px 8px;
  border-color: #334155;
  border-left: 3px solid var(--primary);
  background: var(--sidebar-hover) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%2394a3b8' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat right 10px center;
  color: var(--sidebar-text-active);
  font-size: .7rem;
  letter-spacing: -.01em;
}

.sidebar__year-switcher .year-filter__select:hover {
  border-color: #475569;
  background-color: #243247;
}

.sidebar__year-switcher .year-filter__select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(34, 211, 238, .12);
}

.sidebar__year-switcher .year-filter__select option {
  color: var(--sidebar-text-active);
  background: var(--sidebar-bg);
}

/* ----------------------------------------------------------
   Sdílená časová osa maturitního procesu
---------------------------------------------------------- */
.timeline-card {
  margin-bottom: 24px;
}

.timeline-card--before .timeline-track,
.timeline-card--before .timeline-legend {
  opacity: 0.48;
}

.timeline-card--before .timeline-context {
  color: var(--text-muted);
}

.timeline-card--before .timeline-indicator,
.timeline-card--before .timeline-today {
  opacity: 1;
}

.timeline-card__title {
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.timeline-card__sub {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-bottom: 20px;
}

.timeline-wrap {
  position: relative;
  padding-top: 28px;
  padding-bottom: 16px;
}

.timeline-today {
  position: absolute;
  top: -26px;
  left: 0;
  transform: translateX(-50%);
  font-size: 0.8125rem;
  font-weight: 500;
  color: #374151;
  background: #f3f4f6;
  border: 1px solid #d1d5db;
  padding: 4px 10px;
  border-radius: 3px;
  white-space: nowrap;
  transition: left 0.3s ease;
  max-width: 85vw;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.4;
}

.timeline-today--start { transform: translateX(0); }
.timeline-today--end   { transform: translateX(-100%); }

.timeline-track {
  position: relative;
  display: flex;
  width: 100%;
  height: 14px;
  border-radius: 999px;
  overflow: hidden;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  transition: opacity 0.2s ease;
}

.timeline-segment {
  height: 100%;
  min-width: 3px;
  background: var(--border);
  transition: background 0.2s;
}

.timeline-segment--future { background: var(--border-subtle); }
.timeline-segment--done   { background: #cbd5e1; }
.timeline-segment--active { background: #06b6d4; }
.timeline-segment--empty  { background: #e2e8f0; }

.timeline-indicator {
  position: absolute;
  top: 8px;
  height: 40px;
  width: 1px;
  background: #0f172a;
  transition: left 0.3s ease;
  z-index: 100;
  pointer-events: none;
}

.timeline-milestone {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #e2e8f0;
  border: 2px solid var(--surface);
  transition: background 0.2s;
}

.timeline-milestone--done { background: #06b6d4; box-shadow: 0 0 4px rgba(6, 182, 212, 0.5); }
.timeline-milestone--empty { background: #cbd5e1; box-shadow: none; }

.timeline-legend {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  margin-top: 18px;
  gap: 12px;
  transition: opacity 0.2s ease;
}

.timeline-legend__item {
  position: relative;
  font-size: 0.75rem;
  color: var(--text-muted);
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-top: 3px solid #cbd5e1;
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.timeline-legend__item--done { border-top-color: #94a3b8; }
.timeline-legend__item--active {
  border-color: rgba(6, 182, 212, 0.35);
  border-top-color: #06b6d4;
  background: rgba(6, 182, 212, 0.06);
}

.timeline-legend__name {
  display: block;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: normal;
  overflow-wrap: normal;
  word-break: normal;
  line-height: 1.3;
}

.timeline-legend__item--active .timeline-legend__name::before {
  content: '● ';
  color: #06b6d4;
  font-size: 0.7rem;
  margin-right: 2px;
}

.timeline-legend__item--active .timeline-legend__name {
  font-weight: 700;
  color: var(--text-primary);
}

.timeline-legend__range {
  display: block;
  font-size: 0.7rem;
  color: var(--text-muted);
  white-space: normal;
  overflow-wrap: normal;
  word-break: normal;
}

.timeline-legend__status { display: none; }

.timeline-legend__item--milestone {
  min-width: 0;
  text-align: left;
  border-top-color: var(--primary);
}

@media (max-width: 1100px) {
  .timeline-legend {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.timeline-context {
  margin-top: 20px;
  font-size: 0.8125rem;
  color: var(--text-secondary);
  background: var(--border-subtle);
  border-radius: var(--radius);
  padding: 10px 14px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.timeline-card--empty .timeline-track,
.timeline-card--empty .timeline-legend {
  opacity: 0.72;
}

.timeline-card--empty .timeline-legend__name,
.timeline-card--empty .timeline-legend__range {
  color: var(--text-muted);
}

.timeline-context--empty {
  border-left-color: #cbd5e1;
  background: var(--border-subtle);
  color: var(--text-secondary);
}

/* Fragmentové odkazy z dashboardu zůstávají čitelné pod sticky horní lištou. */
#push-settings,
#maturita-timeline {
  scroll-margin-top: calc(var(--topbar-height) + 20px);
}

/* ----------------------------------------------------------
   Responzivita — mobil-first breakpoint
---------------------------------------------------------- */
@media (max-width: 768px) {
  :root {
    --topbar-height: 52px;
  }

  .sidebar {
    transform: translateX(calc(-1 * var(--sidebar-width)));
  }

  .sidebar.is-open {
    transform: translateX(0);
    box-shadow: 4px 0 20px rgba(0,0,0,0.4);
  }

  /* Anchor z dashboardu musí zpřístupnit nastavení i v zavřeném mobilním panelu. */
  .layout:has(#push-settings:target) .sidebar {
    transform: translateX(0);
    box-shadow: 4px 0 20px rgba(0,0,0,0.4);
  }

  .sidebar__close { display: block; }

  .sidebar__link { min-height: 44px; }

  .sidebar__logout {
    min-height: 44px;
    line-height: 44px;
  }

  .sidebar-overlay.is-visible { display: block; }

  .main { margin-left: 0; }

  .topbar { padding: 0 16px; }
  .topbar__hamburger { display: flex; }

  .btn { min-height: 44px; }
  .btn--sm { min-height: 40px; }

  .content { padding: 20px 16px; }

  .form-input { font-size: 16px; }

  .card-grid { grid-template-columns: 1fr 1fr; }

  .login-card { padding: 28px 20px; }

  .timeline-legend__name  { font-size: 0.75rem; }
  .timeline-today         { font-size: 0.65rem; padding: 2px 7px; max-width: 60vw; }
  .timeline-legend { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  /* Učitelské a administrátorské termíny se na mobilu neskládají do
     stísněných sloupců; každý krok dostane vlastní řádek. */
  body:not(.student-shell) .timeline-legend {
    grid-template-columns: minmax(0, 1fr);
  }

  body:not(.student-shell) .timeline-legend__status {
    display: inline-block;
    margin-top: 6px;
    padding: 3px 8px;
    border-radius: 999px;
    background: #f1f5f9;
    color: var(--text-muted);
    font-size: .66rem;
    font-style: normal;
    font-weight: 750;
    line-height: 1.35;
  }

  body:not(.student-shell) .timeline-legend__item--active {
    border-top-color: #06b6d4;
    background: rgba(6, 182, 212, 0.08);
  }

  body:not(.student-shell) .timeline-legend__item--active .timeline-legend__status {
    background: #cffafe;
    color: #0e7490;
  }

  .card--stat .card__label,
  .card--stat .card__action {
    min-width: 0;
    overflow-wrap: anywhere;
  }

  .card--stat .card__action a,
  .card .btn {
    max-width: 100%;
    overflow-wrap: anywhere;
    white-space: normal;
  }
}

/* Timeline gets a readable stacked legend on narrow phones. The track and
   the live "Dnes" marker remain visible above it. */
@media (max-width: 600px) {
  .timeline-wrap {
    padding-top: 42px;
  }

  .timeline-today {
    top: 0;
    max-width: 70vw;
    white-space: normal;
    text-align: center;
  }

  .timeline-track {
    margin-top: 8px;
  }

  .timeline-legend {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
    margin-top: 16px;
  }

  .timeline-legend__item,
  .timeline-legend__item--milestone {
    display: block;
    width: 100%;
    min-width: 0;
    padding: 9px 12px 9px 16px;
    border-left: 3px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--border-subtle);
    text-align: left;
  }

  .timeline-legend__item--active {
    border-left-color: #06b6d4;
  }

  .timeline-legend__item--milestone {
    border-left-color: var(--primary);
  }

  .timeline-legend__name {
    font-size: 0.875rem;
    max-width: 100%;
  }

  .timeline-legend__range {
    display: block;
    margin-top: 2px;
  }

  .tw-row {
    align-items: flex-start;
    flex-direction: column;
    gap: 6px;
    padding: 10px 14px;
  }

  .tw-row__label,
  .tw-row__meta {
    min-width: 0;
    width: 100%;
  }

  .tw-row__label {
    font-weight: 700;
  }

  .tw-row__meta {
    align-items: flex-start;
    text-align: left;
  }

  .tw-row__meta .badge {
    white-space: normal;
    text-align: left;
  }

  .tw-row__times {
    overflow-wrap: anywhere;
  }

  .card--stat .card__label,
  .card--stat .card__action {
    min-width: 0;
    overflow-wrap: anywhere;
  }

  .card--stat .card__action a,
  .card .btn {
    max-width: 100%;
    overflow-wrap: anywhere;
    white-space: normal;
  }
}

@media (max-width: 480px) {
  .card-grid { grid-template-columns: 1fr; }
  .form-row  { grid-template-columns: 1fr; }
  .detail-grid { grid-template-columns: 1fr; }
  .detail-list { grid-template-columns: 1fr; gap: 4px; }
  .form-card { padding: 20px 16px; }
  .page-header { flex-direction: column; }
  .table th, .table td { padding: 8px 10px; }
  .alert, .info-banner, .section-note { overflow-wrap: anywhere; }
  .page-header__actions { width: 100%; }
  .page-header__actions .btn { flex: 1 1 auto; }
  .year-filter { width: 100%; }
  .year-filter__select { min-width: 0; width: 100%; }
}

/* ----------------------------------------------------------
   Studentský shell — izolovaný redesign
---------------------------------------------------------- */
.student-shell {
  --color-primary: #0F4C5C;
  --color-accent: #FFB703;
  --color-info: #6C757D;
  --color-success: #8EA604;
  --color-warning: #FF6600;
  --color-danger: #C9184A;
  --color-accent-text: #7A5400;
  --color-success-text: #4C5803;
  --color-warning-text: #A34700;
  --color-danger-text: #A11340;
  --color-text: #17242b;
  --color-text-secondary: #5d6970;
  --color-background: #f8faf9;
  --color-surface: #ffffff;
  --color-border: #dfe7e8;
  --card-radius: 18px;
  --button-radius: 12px;
  --card-shadow: 0 1px 2px rgba(15, 76, 92, .04), 0 10px 28px rgba(23, 36, 43, .06);
  --button-shadow: 0 4px 12px rgba(15, 76, 92, .14);
  --focus-ring: 0 0 0 4px rgba(255, 183, 3, .38);
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;

  --content-bg: var(--color-background);
  --surface: var(--color-surface);
  --border: var(--color-border);
  --border-subtle: #eef2f2;
  --text-primary: var(--color-text);
  --text-secondary: var(--color-text-secondary);
  --text-muted: var(--color-text-secondary);
  --primary: var(--color-primary);
  --primary-hover: #0b3d4a;
  --primary-light: #e9f2f4;
  --success: var(--color-success);
  --warning: var(--color-warning);
  --danger: var(--color-danger);
  --info: var(--color-info);
  --radius: var(--button-radius);
  --radius-lg: var(--card-radius);
  --shadow-sm: var(--card-shadow);
  --shadow: var(--card-shadow);

  background: var(--color-background);
  color: var(--color-text);
}

.student-shell :where(a, button, select, input, textarea):focus-visible {
  outline: 3px solid var(--color-primary);
  outline-offset: 3px;
  box-shadow: var(--focus-ring);
}

.student-shell .sidebar {
  width: var(--sidebar-width);
  background: var(--color-surface);
  border-right: 1px solid var(--color-border);
  box-shadow: 8px 0 28px rgba(23, 36, 43, .035);
}

.student-shell .sidebar__header {
  height: 82px;
  border-bottom: 0;
  padding-inline: 28px;
}

.student-shell .sidebar__logo {
  color: var(--color-primary);
  font-size: 1.1rem;
}

.student-shell .sidebar__nav {
  padding: var(--space-3) var(--space-4);
}

.student-shell .sidebar__link {
  gap: var(--space-3);
  min-height: 50px;
  margin-bottom: var(--space-2);
  padding: 11px 14px;
  border: 1px solid transparent;
  border-radius: 12px;
  color: var(--color-text-secondary);
  font-size: .9rem;
}

.student-shell .sidebar__link:hover {
  background: #f3f7f7;
  color: var(--color-primary);
}

.student-shell .sidebar__link--active {
  position: relative;
  padding-left: 14px;
  border-color: #dce9eb;
  background: var(--primary-light);
  color: var(--color-primary);
  font-weight: 750;
}

.student-shell .sidebar__link--active::before {
  content: "";
  position: absolute;
  inset: 8px auto 8px -17px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--color-primary);
}

.student-nav__icon {
  display: grid;
  place-items: center;
  flex: 0 0 22px;
  width: 22px;
  height: 22px;
}

.student-nav__icon svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.student-shell .sidebar__footer {
  margin: var(--space-4);
  padding: var(--space-4);
  border: 1px solid var(--color-border);
  border-radius: 14px;
  background: var(--color-surface);
}

.student-shell .sidebar__user-name { color: var(--color-text); }
.student-shell .sidebar__logout { color: var(--color-primary); }
.student-shell .topbar { display: none; }

.student-shell .content {
  width: min(100%, 1240px);
  margin-left: 0;
  margin-right: auto;
  padding: 38px 42px 56px;
}

.student-dashboard-page .content {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: none;
}

.student-dashboard-page .student-dashboard { order: -2; }
.student-dashboard-page .alert { order: -3; }

.student-shell .card { box-shadow: var(--card-shadow); }
.student-shell .btn { border-radius: var(--button-radius); }
.student-shell .btn--primary { box-shadow: var(--button-shadow); }
.student-bottom-nav { display: none; }

.student-dashboard__welcome {
  margin-bottom: var(--space-5);
}

.student-dashboard__welcome h2 {
  margin-bottom: var(--space-1);
  font-size: clamp(1.65rem, 2.3vw, 2rem);
  line-height: 1.2;
}

.student-dashboard__welcome .text-muted { font-size: .92rem; }

.student-phase {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(300px, .95fr);
  align-items: center;
  gap: var(--space-7);
  margin-bottom: var(--space-5);
  padding: 30px 32px;
  border: 1px solid var(--color-primary);
  border-radius: 20px;
  background: var(--color-primary);
  color: #fff;
  box-shadow: var(--card-shadow);
}

.student-phase__eyebrow {
  margin-bottom: var(--space-2);
  font-size: .75rem;
  font-weight: 800;
  letter-spacing: .07em;
  text-transform: uppercase;
}

.student-phase h3 {
  max-width: 720px;
  font-size: clamp(1.65rem, 3vw, 2.25rem);
  line-height: 1.16;
  letter-spacing: -.025em;
  overflow-wrap: anywhere;
}

.student-phase__deadline {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-4);
  align-items: baseline;
  margin-top: var(--space-4);
}

.student-phase__deadline span { color: rgba(255, 255, 255, .78); }
.student-phase__deadline strong { color: var(--color-accent); font-size: 1.05rem; }

.student-phase__action {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-5);
  min-height: 44px;
  margin-top: var(--space-5);
  border-color: #fff;
  background: #fff;
  color: var(--color-primary);
  font-weight: 750;
  box-shadow: var(--button-shadow);
}

.student-phase__action:hover {
  border-color: #fff;
  background: #f5f8f8;
  color: var(--color-primary);
  text-decoration: none;
}

.student-phase__description {
  align-self: stretch;
  display: flex;
  align-items: center;
  padding-left: var(--space-7);
  border-left: 1px solid rgba(255, 255, 255, .24);
  color: rgba(255, 255, 255, .92);
  line-height: 1.65;
}

html[data-contrast="high"] .student-shell {
  --color-text: #000000;
  --color-text-secondary: #263238;
  --color-background: #ffffff;
  --color-border: #263238;
  --card-shadow: none;
  --button-shadow: none;
  --focus-ring: 0 0 0 5px #FFB703;
}

html[data-contrast="high"] .student-shell .card,
html[data-contrast="high"] .student-shell .student-phase,
html[data-contrast="high"] .student-shell .sidebar__footer {
  border-width: 2px;
}

@media (max-width: 768px) {
  .student-shell { --card-radius: 16px; }
  .student-shell .sidebar,
  .student-shell .sidebar-overlay,
  .student-shell .topbar { display: none; }

  .student-shell .main { margin-left: 0; }

  /* Fragment #push-settings otevře na mobilu skutečný informační panel. */
  .student-shell .sidebar.is-open {
    display: flex;
    transform: translateX(0);
    box-shadow: 4px 0 20px rgba(23, 36, 43, .18);
  }

  .student-shell .sidebar-overlay.is-visible {
    display: block;
  }

  .student-shell .content {
    width: 100%;
    padding: 24px 16px calc(92px + env(safe-area-inset-bottom));
  }

  .student-bottom-nav {
    position: fixed;
    inset: auto 0 0;
    z-index: 250;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    min-height: calc(68px + env(safe-area-inset-bottom));
    padding: 5px 8px env(safe-area-inset-bottom);
    border-top: 1px solid var(--color-border);
    background: rgba(255, 255, 255, .97);
    box-shadow: 0 -8px 24px rgba(23, 36, 43, .07);
  }

  .student-bottom-nav__link {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    min-width: 0;
    min-height: 54px;
    padding: 5px 3px;
    border-radius: 10px;
    color: var(--color-text-secondary);
    font-size: clamp(.6rem, 2.35vw, .71rem);
    font-weight: 600;
    line-height: 1.15;
    text-align: center;
    text-decoration: none;
  }

  .student-bottom-nav__link.sidebar__link--active {
    background: var(--primary-light);
    color: var(--color-primary);
    font-weight: 800;
  }

  .student-dashboard__welcome { margin-bottom: 20px; }
  .student-dashboard__welcome h2 { font-size: 1.5rem; }

  .student-phase {
    display: block;
    margin-bottom: 20px;
    padding: 22px 20px 22px 21px;
    border: 1px solid var(--color-border);
    border-left: 4px solid var(--color-primary);
    border-radius: var(--card-radius);
    background: var(--color-surface);
    color: var(--color-text);
  }

  .student-phase__eyebrow { color: var(--color-primary); }
  .student-phase h3 { font-size: 1.55rem; }
  .student-phase__deadline span { color: var(--color-text-secondary); }
  .student-phase__deadline strong { color: var(--color-warning-text); }

  .student-phase__action {
    width: 100%;
    border-color: var(--color-primary);
    background: var(--color-primary);
    color: #fff;
  }

  .student-phase__action:hover {
    border-color: var(--primary-hover);
    background: var(--primary-hover);
    color: #fff;
  }

  .student-phase__description {
    display: block;
    margin-top: var(--space-5);
    padding: var(--space-4) 0 0;
    border-top: 1px solid var(--color-border);
    border-left: 0;
    color: var(--color-text-secondary);
    line-height: 1.55;
  }
}

@media (min-width: 769px) and (max-width: 1050px) {
  .student-phase { gap: var(--space-5); }
  .student-phase__description { padding-left: var(--space-5); }
}

/* ----------------------------------------------------------
   Studentský přehled — přesná kompozice podle UI návrhu
---------------------------------------------------------- */
.student-shell { --sidebar-width: 272px; }

.student-shell .sidebar__footer {
  display: block;
  box-shadow: 0 4px 16px rgba(23, 36, 43, .04);
}

.student-shell .sidebar__user {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 11px;
  align-items: center;
  min-width: 0;
  margin: 0;
}

.student-user-avatar {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--color-primary);
  color: #fff;
}

.student-user-avatar svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
}

.student-shell .sidebar__user-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.student-shell .sidebar__user-meta { min-width: 0; }

.student-shell .sidebar__user .badge {
  padding: 0;
  background: transparent;
  color: var(--color-text-secondary);
  font-size: .67rem;
  font-weight: 500;
  text-transform: none;
}

.student-shell .sidebar__logout {
  margin: 10px 0 0 49px;
}

.student-dashboard {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr)) minmax(220px, 1fr);
  grid-auto-flow: row;
  gap: 24px 20px;
}

.student-dashboard__welcome { grid-column: 1 / -1; }
.student-phase { grid-column: 4; grid-row: 2 / span 2; }
.student-dashboard__timeline { grid-column: 1 / span 3; grid-row: 2; }
.student-dashboard__lower { grid-column: 1 / span 3; grid-row: 3; }

@media (min-width: 769px) {
  .student-phase {
    display: block;
    align-self: start;
    min-width: 0;
    padding: 24px;
  }

  .student-phase__description {
    margin-top: 18px;
    padding: 18px 0 0;
    border-top: 1px solid rgba(255, 255, 255, .24);
    border-left: 0;
  }
}

.student-quick-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
  margin-bottom: 24px;
}

.student-quick-card {
  position: relative;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) 34px;
  align-items: center;
  gap: 14px;
  min-width: 0;
  min-height: 126px;
  padding: 20px 18px 20px 22px;
  border: 1px solid var(--color-border);
  border-left: 4px solid var(--color-primary);
  border-radius: var(--card-radius);
  background: var(--color-surface);
  box-shadow: var(--card-shadow);
}

.student-quick-card--success { border-left-color: var(--color-success); }
.student-quick-card--warning { border-left-color: var(--color-warning); }

.student-quick-card__icon {
  display: grid;
  place-items: center;
  align-self: start;
  width: 34px;
  height: 34px;
  color: var(--color-primary);
}

.student-quick-card--success .student-quick-card__icon { color: var(--color-success-text); }
.student-quick-card--warning .student-quick-card__icon { color: var(--color-warning-text); }

.student-quick-card svg,
.student-panel__header-icon svg {
  width: 23px;
  height: 23px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.student-quick-card h3 {
  margin-bottom: 7px;
  color: var(--color-text);
  font-size: .98rem;
}

.student-quick-card p {
  color: var(--color-text-secondary);
  font-size: .8rem;
  line-height: 1.4;
}

.student-quick-card p strong {
  margin-right: 3px;
  color: var(--color-text);
  font-size: 1.5rem;
  line-height: 1;
}

.student-quick-card__mobile-label { display: none; }

.student-quick-card > a {
  display: grid;
  place-items: center;
  width: 34px;
  height: 44px;
  border-radius: 10px;
  color: var(--color-primary);
}

.student-quick-card > a:hover {
  background: var(--primary-light);
  text-decoration: none;
}

.student-dashboard__timeline .timeline-card {
  margin-bottom: 24px;
  padding: 22px 28px 24px;
  border-radius: var(--card-radius);
}

.student-dashboard__timeline .timeline-card__title {
  font-size: 1rem;
}

.student-dashboard__timeline .timeline-card__sub {
  margin-bottom: 8px;
}

.student-dashboard__timeline .timeline-wrap {
  padding: 28px 12px 0;
}

.student-dashboard__timeline .timeline-track,
.student-dashboard__timeline .timeline-today,
.student-dashboard__timeline .timeline-indicator {
  display: none;
}

.student-dashboard__timeline .timeline-legend {
  position: relative;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0;
  margin: 0;
  counter-reset: student-timeline;
}

.student-dashboard__timeline .timeline-legend::before {
  content: "";
  position: absolute;
  top: 18px;
  right: 12.5%;
  left: 12.5%;
  border-top: 2px dashed #c9d2d4;
}

.student-dashboard__timeline .timeline-legend__item {
  position: relative;
  z-index: 1;
  display: block;
  min-width: 0;
  padding: 48px 10px 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  text-align: center;
  flex-basis: auto !important;
  counter-increment: student-timeline;
}

.student-dashboard__timeline [data-legend-key="processing"] {
  display: none;
}

.student-dashboard__timeline .timeline-legend__item::before {
  content: counter(student-timeline);
  position: absolute;
  top: 0;
  left: 50%;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 2px solid #c9d2d4;
  border-radius: 50%;
  background: var(--color-surface);
  color: var(--color-info);
  font-size: .85rem;
  font-weight: 800;
  transform: translateX(-50%);
}

.student-dashboard__timeline [data-legend-key="student"]::before { content: "1"; }
.student-dashboard__timeline [data-legend-key="teacher"]::before { content: "2"; }
.student-dashboard__timeline [data-legend-key="admin"]::before { content: "3"; }
.student-dashboard__timeline .timeline-legend__item--milestone::before { content: "4"; }

.student-dashboard__timeline .timeline-legend__item--active::before {
  border-color: var(--color-primary);
  background: var(--color-primary);
  color: #fff;
  box-shadow: 0 0 0 5px var(--primary-light);
}

.student-dashboard__timeline .timeline-legend__item--done::before {
  content: "✓";
  border-color: var(--color-success);
  background: var(--color-success);
  color: #fff;
}

.student-dashboard__timeline .timeline-legend__item--milestone {
  min-width: 0;
  padding-left: 10px;
  text-align: center;
}

.student-dashboard__timeline .timeline-legend__name {
  font-size: .83rem;
  font-weight: 750;
}

.student-dashboard__timeline .timeline-legend__item--active .timeline-legend__name::before { content: none; }

.student-dashboard__timeline .timeline-legend__range {
  display: block;
  margin-top: 4px;
  font-size: .72rem;
}

.student-dashboard__timeline .timeline-legend__status {
  display: inline-block;
  margin-top: 7px;
  padding: 3px 8px;
  border-radius: 999px;
  background: #f0f2f2;
  color: var(--color-text-secondary);
  font-size: .66rem;
  font-style: normal;
  font-weight: 750;
}

.student-dashboard__timeline .timeline-legend__item--active .timeline-legend__status {
  background: var(--primary-light);
  color: var(--color-primary);
}

.student-dashboard__timeline .timeline-legend__item--done .timeline-legend__status {
  background: #f0f5df;
  color: var(--color-success-text);
}

.student-dashboard__timeline .timeline-context { display: none; }

.student-dashboard__lower {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 24px;
}

.student-panel {
  min-width: 0;
  padding: 24px;
  border: 1px solid var(--color-border);
  border-radius: var(--card-radius);
  background: var(--color-surface);
  box-shadow: var(--card-shadow);
}

.student-panel__header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.student-panel__header h3 {
  margin-bottom: 3px;
  color: var(--color-text);
  font-size: 1.04rem;
}

.student-panel__header p {
  color: var(--color-text-secondary);
  font-size: .78rem;
}

.student-panel__header-icon { color: var(--color-primary); }
.student-choice-list { display: grid; gap: 10px; }

.student-choice {
  padding: 14px 16px;
  border: 1px solid var(--color-border);
  border-left: 3px solid var(--color-primary);
  border-radius: 12px;
  background: #fff;
}

.student-choice--second { border-left-color: var(--color-success); }

.student-choice__rank {
  display: inline-block;
  margin-bottom: 6px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--primary-light);
  color: var(--color-primary);
  font-size: .68rem;
  font-weight: 800;
}

.student-choice--second .student-choice__rank {
  background: #f0f5df;
  color: var(--color-success-text);
}

.student-choice h4 {
  margin-bottom: 3px;
  color: var(--color-text);
  font-size: .93rem;
}

.student-choice p {
  color: var(--color-text-secondary);
  font-size: .76rem;
  overflow-wrap: anywhere;
}

.student-panel__empty {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 92px;
  padding: 16px;
  border: 1px dashed var(--color-border);
  border-radius: 12px;
  color: var(--color-text-secondary);
}

.student-assignment {
  display: grid;
  gap: 3px;
  margin-top: 14px;
  padding: 14px 16px;
  border-left: 3px solid var(--color-success);
  border-radius: 10px;
  background: #f5f8ea;
  font-size: .8rem;
}

.student-assignment--final {
  margin-top: 18px;
  padding: 18px 20px;
  border-left-width: 4px;
  background: #f2f8ed;
  font-size: .84rem;
}

.student-assignment--final strong { font-size: 1rem; }

.student-assignment__status {
  color: var(--color-success-text);
  font-size: .7rem;
  font-weight: 800;
  text-transform: uppercase;
}

.student-choices__notice {
  margin-top: 12px;
  color: var(--color-success-text);
  font-size: .76rem;
}

.student-panel__action { margin-top: 16px; }
.student-next__list { list-style: none; }

.student-next__item {
  position: relative;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 12px;
  padding-bottom: 16px;
}

.student-next__item:last-child { padding-bottom: 0; }

.student-next__item:not(:last-child)::after {
  content: "";
  position: absolute;
  top: 33px;
  bottom: 1px;
  left: 17px;
  border-left: 1px dashed var(--color-border);
}

.student-next__number {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--color-border);
  border-radius: 50%;
  background: #f2f4f4;
  color: var(--color-text-secondary);
  font-size: .75rem;
  font-weight: 800;
}

.student-next__item--active .student-next__number {
  border-color: var(--color-primary);
  background: var(--color-primary);
  color: #fff;
}

.student-next__item--done .student-next__number {
  border-color: var(--color-success);
  background: var(--color-success);
  color: #fff;
}

.student-next__item strong,
.student-next__item em { display: block; }

.student-next__item strong {
  margin-top: 1px;
  color: var(--color-text);
  font-size: .86rem;
}

.student-next__item div > span {
  margin-top: 2px;
  color: var(--color-text-secondary);
  font-size: .72rem;
}

.student-next__item em {
  width: fit-content;
  margin-top: 4px;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--primary-light);
  color: var(--color-primary);
  font-size: .65rem;
  font-style: normal;
  font-weight: 800;
}

.student-next__item--done em {
  background: #f0f5df;
  color: var(--color-success-text);
}

.student-dashboard-page .push-settings {
  order: 6;
  margin: 24px 0 0;
  padding: 18px 22px;
  border-radius: var(--card-radius);
  box-shadow: var(--card-shadow);
}

.student-dashboard-page .push-settings__icon {
  display: grid;
  place-items: center;
  flex: 0 0 40px;
  width: 40px;
  height: 40px;
  border: 1px solid var(--color-border);
  border-radius: 50%;
  background: var(--primary-light);
  color: var(--color-primary);
}

.student-dashboard-page .push-settings__icon svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

html[data-contrast="high"] .student-shell .student-quick-card,
html[data-contrast="high"] .student-shell .student-panel,
html[data-contrast="high"] .student-shell .student-choice,
html[data-contrast="high"] .student-shell .push-settings,
html[data-contrast="high"] .student-shell .student-bottom-nav,
html[data-contrast="high"] .student-shell .sidebar {
  border-width: 2px;
  box-shadow: none;
}

html[data-contrast="high"] .student-shell .timeline-legend::before,
html[data-contrast="high"] .student-shell .student-next__item::after {
  border-color: #000;
}

@media (max-width: 768px) {
  .student-dashboard__welcome { order: 1; }
  .student-phase { order: 2; }
  .student-quick-grid { order: 3; }
  .student-dashboard__timeline { order: 3; }
  .student-dashboard__lower { order: 4; }

  .student-shell .content { padding-top: 22px; }

  .student-quick-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
    margin-bottom: 20px;
  }

  .student-quick-card {
    display: grid;
    grid-template-columns: 32px minmax(0, 1fr) 32px;
    grid-template-rows: minmax(0, 1fr);
    align-items: center;
    gap: 12px;
    width: 100%;
    height: auto;
    min-height: 78px;
    padding: 13px 12px 13px 16px;
    border-left-width: 3px;
    border-radius: 14px;
  }

  .student-quick-card__icon {
    align-self: center;
    width: 32px;
    height: 32px;
  }

  .student-quick-card svg { width: 20px; height: 20px; }

  .student-quick-card > div {
    display: block;
    width: 100%;
    min-width: 0;
  }

  .student-quick-card__desktop-label { display: none; }
  .student-quick-card__mobile-label { display: inline; }

  .student-quick-card h3 {
    margin: 0 0 4px;
    font-size: .84rem;
    line-height: 1.2;
  }

  .student-quick-card p {
    font-size: .74rem;
    line-height: 1.3;
  }

  .student-quick-card p strong {
    display: inline;
    margin: 0 2px 0 0;
    font-size: 1rem;
  }

  .student-quick-card > a {
    position: absolute;
    inset: 0;
    width: auto;
    height: auto;
    background: transparent;
  }

  .student-quick-card > a:hover { background: transparent; }
  .student-quick-card > a svg {
    position: absolute;
    top: 50%;
    right: 14px;
    display: block;
    width: 18px;
    height: 18px;
    transform: translateY(-50%);
  }

  .student-dashboard__timeline .timeline-card {
    padding: 16px;
    border-radius: 16px;
  }

  .student-dashboard__timeline .timeline-card__sub { margin-bottom: 12px; }
  .student-dashboard__timeline .timeline-wrap { padding: 0; }

  .student-dashboard__timeline .timeline-legend {
    grid-template-columns: minmax(0, 1fr);
    gap: 7px;
  }

  .student-dashboard__timeline .timeline-legend::before {
    top: 24px;
    right: auto;
    bottom: 24px;
    left: 25px;
    border-top: 0;
    border-left: 2px dashed #c9d2d4;
  }

  .student-dashboard__timeline .timeline-legend__item,
  .student-dashboard__timeline .timeline-legend__item--milestone {
    display: grid;
    grid-template-columns: 36px minmax(0, 1fr) auto;
    grid-template-rows: auto auto;
    gap: 2px 12px;
    align-items: center;
    padding: 7px 10px 7px 8px;
    border: 1px solid var(--color-border);
    border-radius: 12px;
    background: var(--color-surface);
    text-align: left;
  }

  .student-dashboard__timeline [data-legend-key="processing"] { display: none; }

  .student-dashboard__timeline .timeline-legend__item::before {
    position: relative;
    top: auto;
    left: auto;
    grid-row: 1 / span 2;
    width: 34px;
    height: 34px;
    transform: none;
  }

  .student-dashboard__timeline .timeline-legend__name {
    grid-column: 2;
    max-width: none;
    font-size: .8rem;
  }

  .student-dashboard__timeline .timeline-legend__range {
    grid-column: 2;
    margin: 0;
    font-size: .68rem;
  }

  .student-dashboard__timeline .timeline-legend__status {
    grid-column: 3;
    grid-row: 1 / span 2;
    margin: 0;
    white-space: nowrap;
  }

  .student-dashboard__lower {
    grid-template-columns: minmax(0, 1fr);
    gap: 20px;
  }

  .student-panel { padding: 19px 16px; }
  .student-choice p { line-height: 1.45; }

  .student-dashboard-page .push-settings {
    align-items: center;
    margin-top: 20px;
    padding: 16px;
  }

  .student-dashboard-page .push-settings__icon { display: none; }

  .student-bottom-nav { min-height: calc(72px + env(safe-area-inset-bottom)); }

  .student-bottom-nav__link {
    display: grid;
    grid-template-rows: 27px 16px;
    align-content: center;
    justify-items: center;
    gap: 4px;
    min-height: 60px;
    padding: 5px 2px;
    background: transparent;
  }

  .student-bottom-nav__link .student-nav__icon {
    align-self: center;
    width: 27px;
    height: 27px;
  }

  .student-bottom-nav__link .student-nav__icon svg {
    width: 23px;
    height: 23px;
  }

  .student-bottom-nav__link > span:last-child {
    align-self: start;
    line-height: 16px;
    white-space: nowrap;
  }

  .student-bottom-nav__status-dot {
    display: inline-block;
    width: 6px;
    height: 6px;
    margin: 0 0 2px 3px;
    border-radius: 50%;
    background: var(--warning);
    vertical-align: middle;
  }

  .student-bottom-nav__link.sidebar__link--active {
    position: relative;
    padding: 5px 2px;
    border: 0;
    background: transparent;
    box-shadow: none;
    font-weight: 800;
  }

  .student-bottom-nav__link.sidebar__link--active .student-nav__icon {
    border-radius: 8px;
    background: var(--primary-light);
  }

  .student-bottom-nav__link.sidebar__link--active .student-nav__icon svg {
    stroke-width: 2.35;
  }

  .student-bottom-nav__link.sidebar__link--active::before {
    content: none;
  }
}

@media (max-width: 390px) {
  .student-quick-card { min-height: 74px; padding-inline: 12px; }
  .student-quick-card h3 { font-size: .8rem; }
  .student-dashboard__timeline .timeline-legend__status { font-size: .6rem; }
}

/* PWA installation prompt */
.install-modal[hidden] { display: none; }
.install-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 20px;
}
.install-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgb(15 23 42 / 0.58);
  backdrop-filter: blur(4px);
}
.install-modal__dialog {
  position: relative;
  width: min(100%, 470px);
  padding: 38px 36px 30px;
  border: 1px solid rgb(255 255 255 / 0.65);
  border-radius: 20px;
  background: var(--surface);
  box-shadow: 0 28px 80px rgb(15 23 42 / 0.32);
}
.install-modal__icon {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  margin-bottom: 24px;
  border-radius: 16px;
  background: var(--primary-light);
  color: var(--primary);
}
.install-modal__dialog h2 {
  margin: 0;
  color: var(--text-primary);
  max-width: 350px;
  font-size: 1.55rem;
  line-height: 1.3;
}
.install-modal__description,
.install-modal__ios-help {
  margin: 14px 0 0;
  max-width: 380px;
  color: var(--text-secondary);
  line-height: 1.55;
}
.install-modal__actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-top: 32px;
}
.install-modal__actions .btn { width: 100%; min-height: 50px; }
.install-modal__confirm {
  padding-inline: 24px;
  box-shadow: 0 8px 20px rgb(30 96 122 / 0.24);
}
.install-modal__confirm:hover { box-shadow: 0 10px 24px rgb(30 96 122 / 0.3); }
.install-modal__dismiss {
  padding-inline: 16px;
  border: 0;
  background: transparent;
  color: var(--text-muted);
}
.install-modal__dismiss:hover { background: var(--border-subtle); color: var(--text-primary); }
.install-modal__dismiss:focus-visible,
.install-modal__confirm:focus-visible { outline: 3px solid rgb(30 96 122 / 0.3); outline-offset: 2px; }
body.install-modal-is-open { overflow: hidden; }

@media (max-width: 600px) {
  .install-modal { align-items: end; padding: 14px; }
  .install-modal__dialog {
    width: 100%;
    padding: 32px 24px 24px;
    border-radius: 24px;
  }
  .install-modal__icon { margin-bottom: 22px; }
  .install-modal__dialog h2 { font-size: 1.4rem; }
  .install-modal__description,
  .install-modal__ios-help { margin-top: 12px; }
  .install-modal__actions { margin-top: 28px; gap: 14px; }
  .install-modal__dismiss { min-height: 42px; }
}

/* ----------------------------------------------------------
   Student — výběr témat
---------------------------------------------------------- */
.student-selection-page .push-settings { display: none; }
.student-selection-page .content { width: 100%; max-width: none; }
.student-selection { width: 100%; min-width: 0; }
.student-selection__header { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; margin-bottom: 22px; }
.student-selection__eyebrow { margin: 0 0 5px; color: var(--color-primary); font-size: .72rem; font-weight: 800; letter-spacing: .075em; text-transform: uppercase; }
.student-selection__header h2 { margin: 0; color: var(--color-text); font-size: clamp(1.7rem, 2.4vw, 2.15rem); line-height: 1.16; letter-spacing: -.025em; }
.student-selection__header p:last-child { margin: 7px 0 0; color: var(--color-text-secondary); font-size: .92rem; }
.student-selection__back { flex: 0 0 auto; min-height: 44px; }

.selection-rules,
.selection-message { display: grid; grid-template-columns: 38px minmax(0, 1fr); gap: 14px; margin-bottom: 30px; padding: 18px 20px; border: 1px solid #cbdcdf; border-left: 4px solid var(--color-primary); border-radius: 14px; background: var(--primary-light); color: var(--color-text); }
.selection-message--plain { grid-template-columns: minmax(0, 1fr); }
.selection-rules__icon,
.selection-message__symbol { display: grid; place-items: center; width: 34px; height: 34px; border: 2px solid var(--color-primary); border-radius: 50%; color: var(--color-primary); font-weight: 850; }
.selection-rules h3 { margin: 0 0 7px; font-size: .96rem; }
.selection-rules ul { display: grid; gap: 4px; margin: 0; padding-left: 18px; }
.selection-rules li,
.selection-message p { color: var(--color-text-secondary); font-size: .8rem; line-height: 1.48; }
.selection-message strong { display: block; margin-bottom: 4px; }
.selection-message p { margin: 0; }
.selection-rules--collapsible { display: block; }
.selection-rules__summary { display: grid; grid-template-columns: 34px minmax(0, 1fr) 24px; align-items: center; gap: 14px; list-style: none; cursor: default; }
.selection-rules__summary::-webkit-details-marker { display: none; }
.selection-rules__summary strong { font-size: .96rem; }
.selection-rules__chevron { display: none; place-items: center; width: 24px; height: 24px; }
.selection-rules__chevron svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; transform-origin: center; transition: transform .32s ease; }
.selection-rules__body { display: block; margin: 8px 0 0 48px; }
.selection-empty { border: 1px dashed var(--color-border); border-radius: var(--card-radius); background: var(--color-surface); }
.selection-empty strong { display: block; margin-bottom: 4px; color: var(--color-text); }

.selection-section-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 15px; }
.selection-section-heading h3 { margin: 0; color: var(--color-text); font-size: 1.18rem; }
.selection-section-heading > p { margin: 0 0 1px; color: var(--color-text-secondary); font-size: .76rem; }
#selection-count { color: var(--color-primary); font-size: 1rem; font-weight: 850; }
.topic-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.topic-card { position: relative; min-width: 0; overflow: hidden; border: 1px solid var(--color-border); border-radius: var(--card-radius); background: var(--color-surface); box-shadow: var(--card-shadow); transition: border-color .16s ease; }
.topic-card__accent { position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--color-primary); }
.topic-card.is-second-choice:not(.is-first-choice) .topic-card__accent { background: var(--color-success); }
.topic-card.is-first-choice { border-color: var(--color-primary); }
.topic-card.is-second-choice { border-color: var(--color-success); }
.topic-card.is-first-choice.is-second-choice { border-color: var(--color-danger); }
.topic-card.is-first-choice.is-second-choice .topic-card__accent { background: var(--color-danger); }
.topic-card__body { padding: 20px 20px 18px 24px; }
.topic-card__topline { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 25px; margin-bottom: 8px; }
.topic-card__subject { min-width: 0; color: var(--color-primary); font-size: .7rem; font-weight: 800; letter-spacing: .045em; line-height: 1.45; overflow-wrap: anywhere; text-transform: uppercase; white-space: normal; }
.topic-card__badges { display: flex; flex: 0 0 auto; gap: 5px; }
.preference-badge { display: none; padding: 4px 8px; border: 1px solid currentColor; border-radius: 999px; font-size: .66rem; font-weight: 850; line-height: 1; white-space: nowrap; }
.preference-badge--first { background: var(--primary-light); color: var(--color-primary); }
.preference-badge--second { background: #f0f5df; color: var(--color-success-text); }
.is-first-choice .preference-badge--first,
.is-second-choice .preference-badge--second { display: inline-flex; }
.topic-card h4 { margin: 0 0 13px; color: var(--color-text); font-size: 1rem; line-height: 1.35; overflow-wrap: anywhere; }
.topic-card__meta { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 14px; margin: 0 0 14px; padding: 11px 0; border-block: 1px solid var(--border-subtle); }
.topic-card__meta div { min-width: 0; }
.topic-card__meta dt { margin-bottom: 2px; color: var(--color-text-secondary); font-size: .65rem; text-transform: uppercase; }
.topic-card__meta dd { margin: 0; color: var(--color-text); font-size: .76rem; font-weight: 650; overflow-wrap: anywhere; }
.topic-card__annotation { margin: 0 0 15px; color: var(--color-text-secondary); }
.topic-card__annotation summary { color: var(--color-primary); font-size: .76rem; font-weight: 750; cursor: pointer; }
.topic-card__annotation summary::marker { content: ""; }
.topic-card__annotation summary span { display: inline-block; margin-left: 4px; transition: transform .16s ease; }
.topic-card__annotation[open] summary span { transform: rotate(180deg); }
.topic-card__annotation p { margin: 9px 0 0; font-size: .78rem; line-height: 1.52; overflow-wrap: anywhere; }
.topic-card__annotation-list { margin: 8px 0 0; padding-left: 19px; font-size: .78rem; line-height: 1.52; }
.topic-card__annotation-list li + li { margin-top: 4px; }

.topic-card__actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.preference-button { display: flex; align-items: center; justify-content: center; gap: 7px; min-width: 0; min-height: 44px; padding: 7px 9px; border: 1px solid var(--color-border); border-radius: 10px; background: #fff; color: var(--color-text-secondary); font: inherit; font-size: .73rem; font-weight: 750; cursor: pointer; }
.preference-button:hover { border-color: var(--color-primary); color: var(--color-primary); }
.preference-button__mark { display: grid; place-items: center; flex: 0 0 23px; width: 23px; height: 23px; border: 1px solid currentColor; border-radius: 50%; }
.preference-button__selected { display: none; }
.preference-button[aria-pressed="true"] .preference-button__default { display: none; }
.preference-button[aria-pressed="true"] .preference-button__selected { display: inline; }
.preference-button--first[aria-pressed="true"] { border-color: var(--color-primary); background: var(--primary-light); color: var(--color-primary); }
.preference-button--second[aria-pressed="true"] { border-color: var(--color-success); background: #f0f5df; color: var(--color-success-text); }
.is-first-choice.is-second-choice .preference-button[aria-pressed="true"] { border-color: var(--color-danger); background: #fff0f4; color: var(--color-danger-text); }

.selection-preferences { margin-top: 34px; }
.preference-slots { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.preference-slot { min-width: 0; padding: 21px; border: 1px solid var(--color-border); border-top: 4px solid var(--color-primary); border-radius: var(--card-radius); background: var(--color-surface); box-shadow: var(--card-shadow); }
.preference-slot--second { border-top-color: var(--color-success); }
.preference-slot__heading { display: flex; align-items: center; gap: 11px; margin-bottom: 18px; }
.preference-slot__number { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: var(--color-primary); color: #fff; font-weight: 850; }
.preference-slot--second .preference-slot__number { background: var(--color-success); color: #172006; }
.preference-slot__heading h4 { margin: 0 0 1px; color: var(--color-text); font-size: 1rem; }
.preference-slot__heading p { margin: 0; color: var(--color-text-secondary); font-size: .72rem; }
.preference-slot .form-group:last-child { margin-bottom: 0; }
.preference-slot .form-input { width: 100%; border-color: var(--color-border); background-color: #fff; }
.preference-slot textarea { min-height: 126px; resize: vertical; }
.annotation-example { margin-top: 18px; padding: 16px 18px; border: 1px solid var(--color-border); border-left: 4px solid var(--color-accent); border-radius: 12px; background: #fffaf0; }
.annotation-example--desktop { display: none; }
.annotation-example strong { color: var(--color-text); font-size: .82rem; }
.annotation-example > p { margin: 2px 0 8px; color: var(--color-text-secondary); font-size: .72rem; }
.annotation-example blockquote { margin: 0; color: var(--color-text-secondary); font-size: .76rem; line-height: 1.5; }
.selection-submit { display: flex; align-items: center; justify-content: space-between; gap: 22px; margin-top: 22px; padding: 18px 20px; border: 1px solid var(--color-border); border-radius: var(--card-radius); background: var(--color-surface); box-shadow: var(--card-shadow); }
.selection-submit > p { margin: 0; color: var(--color-text-secondary); font-size: .76rem; }
.selection-submit > p span { display: inline-grid; place-items: center; width: 20px; height: 20px; margin-right: 5px; border: 1px solid var(--color-warning); border-radius: 50%; color: var(--color-warning-text); font-weight: 850; }
.selection-submit__actions { display: flex; flex: 0 0 auto; gap: 10px; }
.selection-submit__actions .btn { min-height: 46px; }
.selection-submit__actions .btn--primary { min-width: 168px; }
.selection-submit--desktop { display: none; }

@media (min-width: 769px) {
  #student-selection-form {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr);
    column-gap: 24px;
    align-items: start;
  }

  #student-selection-form .selection-preferences {
    grid-column: 1;
    grid-row: 1;
    margin-top: 0;
  }

  #student-selection-form .selection-topics {
    grid-column: 1;
    grid-row: 2;
    margin-top: 34px;
  }

  #student-selection-form > .selection-submit {
    grid-column: 1;
    grid-row: 3;
  }

  #student-selection-form .selection-active-guidance {
    position: sticky;
    top: 86px;
    grid-column: 2;
    grid-row: 1 / span 3;
    display: grid;
    gap: 18px;
    transform: translateY(-112px);
  }

  #student-selection-form .selection-active-guidance .selection-message,
  #student-selection-form .selection-active-guidance .selection-rules,
  #student-selection-form .selection-active-guidance .annotation-example { margin: 0; }

  #student-selection-form .annotation-example--desktop {
    display: block;
    min-height: 220px;
    padding: 24px 26px;
  }

  #student-selection-form .annotation-example--desktop strong { font-size: 1rem; }

  #student-selection-form .annotation-example--desktop > p {
    margin: 6px 0 16px;
    font-size: .8rem;
  }

  #student-selection-form .annotation-example--desktop blockquote {
    font-size: .88rem;
    line-height: 1.65;
  }

  #student-selection-form .annotation-example--mobile { display: none; }

  #student-selection-form .selection-submit--desktop {
    display: flex;
    align-items: stretch;
    flex-direction: column;
    margin: 0;
  }

  #student-selection-form .selection-submit--desktop .selection-submit__actions {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
  }

  #student-selection-form > .selection-submit--mobile { display: none; }
}

.student-selection-page .alert { position: relative; padding-left: 48px; border-width: 1px 1px 1px 4px; border-radius: 12px; }
.student-selection-page .alert::before { position: absolute; top: 50%; left: 17px; font-size: 1.2rem; font-weight: 900; transform: translateY(-50%); }
.student-selection-page .alert--error::before { content: "×"; }
.student-selection-page .alert--success::before { content: "✓"; }
.student-selection-page .alert--warning::before { content: "!"; }
.selection-modal__symbol { display: grid; place-items: center; width: 42px; height: 42px; margin-bottom: 13px; border: 2px solid var(--color-danger); border-radius: 50%; color: var(--color-danger-text); font-size: 1.45rem; font-weight: 850; }
.selection-modal .modal { border-top: 4px solid var(--color-danger); }

html[data-contrast="high"] .student-shell .topic-card,
html[data-contrast="high"] .student-shell .preference-slot,
html[data-contrast="high"] .student-shell .selection-rules,
html[data-contrast="high"] .student-shell .selection-message,
html[data-contrast="high"] .student-shell .selection-submit,
html[data-contrast="high"] .student-shell .annotation-example,
html[data-contrast="high"] .student-shell .preference-button,
html[data-contrast="high"] .student-shell .preference-slot .form-input,
html[data-contrast="high"] .student-shell .preference-badge,
html[data-contrast="high"] .student-shell .selection-modal .modal,
html[data-contrast="high"] .student-selection-page .alert { border-width: 2px; border-color: #000; box-shadow: none; }

/* Studentské upozornění patří nad profil v postranním panelu. */
.student-shell .sidebar .sidebar-push-settings {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 8px 10px;
  order: initial;
  margin: 0 18px 12px;
  padding: 12px;
  color: var(--color-text);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-left: 3px solid var(--color-primary);
  border-radius: 14px;
  box-shadow: none;
}
.student-shell .sidebar .sidebar-push-settings__icon { color: var(--color-primary); background: var(--primary-light); }
.student-shell .sidebar .sidebar-push-settings .push-settings__status { color: var(--color-text-muted); }
.student-shell .sidebar .sidebar-push-settings .btn { color: #fff; background: var(--color-primary); border-color: var(--color-primary); }
.student-shell .sidebar .sidebar-push-settings .btn:disabled { color: var(--color-text-muted); background: transparent; border-color: var(--color-border); }
.student-shell .sidebar .sidebar-push-settings .push-settings__ios-help { color: var(--color-text-muted); }
html[data-contrast="high"] .student-shell .topic-card__accent { width: 7px; }
html[data-contrast="high"] .student-shell .preference-button[aria-pressed="true"] { outline: 3px solid #000; outline-offset: -4px; }
html[data-contrast="high"] .student-shell .preference-badge { background: #fff; color: #000; }

@media (min-width: 769px) {
  .topic-card__annotation:not([open]) > :not(summary) { display: block; }
  .topic-card__annotation summary { display: none; }
}

@media (max-width: 768px) {
  .student-selection-page .content { padding-top: 18px; }
  #student-selection-form { display: flex; flex-direction: column; }
  #student-selection-form .selection-active-guidance { order: 1; }
  #student-selection-form .annotation-example--mobile { order: 2; }
  #student-selection-form .selection-preferences { order: 3; }
  #student-selection-form .selection-topics { order: 4; margin-top: 29px; }
  #student-selection-form > .selection-submit--mobile { order: 5; }
  .selection-rules--collapsible { transition: box-shadow .35s ease, border-color .35s ease; }
  .selection-rules__summary { cursor: pointer; }
  .selection-rules__chevron { display: grid; }
  .selection-rules__body { display: grid !important; grid-template-rows: 0fr; margin: 0 0 0 48px; opacity: 0; transition: grid-template-rows .38s ease, margin-top .38s ease, opacity .28s ease; }
  .selection-rules__body > div { min-height: 0; overflow: hidden; }
  .selection-rules--collapsible[open] .selection-rules__body { grid-template-rows: 1fr; margin-top: 9px; opacity: 1; }
  .selection-rules--collapsible[open] .selection-rules__chevron svg { transform: scaleY(-1); }
  .selection-rules--collapsible:not([open]) { animation: selectionHintPulse 6s ease-in-out infinite; }
  .student-selection__header { align-items: center; margin-bottom: 18px; }
  .student-selection__header h2 { font-size: 1.65rem; }
  .student-selection__header p:last-child { font-size: .82rem; }
  .student-selection__back { width: 44px; padding: 0; border: 0; font-size: 0; }
  .student-selection__back span { font-size: 1.35rem; }
  .selection-rules { margin-bottom: 25px; padding: 15px 14px; }
  .selection-section-heading { align-items: flex-start; }
  .selection-section-heading > p { max-width: 145px; text-align: right; }
  .topic-grid,
  .preference-slots { grid-template-columns: minmax(0, 1fr); }
  .topic-grid { gap: 14px; }
  .topic-card__body { padding: 17px 15px 15px 19px; }
  .topic-card h4 { font-size: .96rem; }
  .selection-preferences { margin-top: 29px; }
  .preference-slot { padding: 18px 15px; }
  .selection-submit { align-items: stretch; flex-direction: column; padding: 16px; }
  .selection-submit__actions { display: grid; grid-template-columns: auto minmax(0, 1fr); }
  .selection-submit__actions .btn--primary { min-width: 0; }
}

@keyframes selectionHintPulse {
  0%, 78%, 100% { box-shadow: none; }
  84% { box-shadow: 0 0 0 4px rgba(15, 91, 107, .12), 0 7px 20px rgba(15, 91, 107, .1); }
}

@media (prefers-reduced-motion: reduce) {
  .selection-rules--collapsible,
  .selection-rules__body,
  .selection-rules__chevron svg { animation: none !important; transition: none !important; }
}

@media (max-width: 430px) {
  .student-selection__header { gap: 10px; }
  .student-selection__header p:last-child { max-width: 270px; }
  .selection-rules { grid-template-columns: 30px minmax(0, 1fr); gap: 10px; }
  .selection-rules__icon { width: 28px; height: 28px; }
  .selection-section-heading h3 { font-size: 1.06rem; }
  .topic-card__meta { grid-template-columns: minmax(0, 1fr); gap: 9px; }
  .topic-card__actions { grid-template-columns: minmax(0, 1fr); }
  .preference-button { justify-content: flex-start; padding-inline: 13px; }
  .selection-submit__actions { grid-template-columns: minmax(0, 1fr); }
  .selection-submit__actions .btn { width: 100%; }
  .selection-submit__actions .btn--primary { order: -1; min-height: 48px; }
}

@media (prefers-reduced-motion: reduce) {
  .topic-card,
  .topic-card__annotation summary span { transition: none; }
}

/* Finální stav po zveřejnění výsledků */
.results-published-banner {
  margin-bottom: 24px;
  padding: 16px 20px;
  border: 1px solid #b8d6b7;
  border-left: 4px solid var(--color-success);
  border-radius: 12px;
  background: #f2f8ed;
  color: var(--color-text);
  font-size: .82rem;
  line-height: 1.5;
}

.results-published-banner strong { color: var(--color-success-text); }

.final-results-section {
  margin-bottom: 28px;
  padding: 22px 24px 24px;
  border: 1px solid #b8d6b7;
  border-top: 4px solid var(--color-success);
  border-radius: var(--card-radius);
  background: var(--color-surface);
  box-shadow: var(--card-shadow);
}

.final-results-section__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 16px;
}

.final-results-section__eyebrow {
  margin: 0 0 4px;
  color: var(--color-success-text);
  font-size: .7rem;
  font-weight: 850;
  letter-spacing: .07em;
  text-transform: uppercase;
}

.final-results-section h3 { margin: 0 0 4px; font-size: 1.25rem; }
.final-results-section__header .text-muted { margin: 0; font-size: .8rem; }
.final-students-card { margin: 0; box-shadow: none; }
.final-students-card__empty { margin: 0; min-height: 64px; }
.final-students-card td:last-child strong { color: var(--color-success-text); }

.student-final-assignment-card {
  border-color: #b8d6b7;
  background: #f2f8ed;
  box-shadow: var(--card-shadow);
}

.student-final-assignment-card__label {
  margin: 0 0 3px;
  color: var(--color-text-secondary);
  font-size: .68rem;
  font-weight: 800;
  text-transform: uppercase;
}

.progress-overview--published .progress-overview__choice {
  color: var(--color-text-secondary);
  background: #fafafa;
  font-size: .82rem;
}

.progress-overview--published .progress-overview__choice small {
  color: var(--color-text-muted) !important;
}

.progress-overview--published .progress-overview__final {
  min-width: 190px;
  border-left: 3px solid var(--color-success);
  background: #f2f8ed;
  color: var(--color-text);
}

.progress-overview--published .progress-overview__final .badge {
  display: block;
  width: max-content;
  margin-top: 5px;
}

.table-scroll .progress-overview-table {
  table-layout: auto;
  width: 100%;
  min-width: 1180px;
}

/* Třída je pro tento přehled vždy stejná, proto ji nezabíráme místem. */
.progress-overview-table th:nth-child(2),
.progress-overview-table td:nth-child(2) { display: none; }

.progress-overview-table th:nth-child(1),
.progress-overview-table td:nth-child(1) { width: 190px; min-width: 190px; }
.progress-overview-table th:nth-child(3),
.progress-overview-table td:nth-child(3) { width: 24%; min-width: 230px; }
.progress-overview-table th:nth-child(4),
.progress-overview-table td:nth-child(4) { width: 24%; min-width: 230px; }
.progress-overview-table th:nth-child(5),
.progress-overview-table td:nth-child(5) { width: 190px; min-width: 190px; }
.progress-overview-table th:nth-child(6),
.progress-overview-table td:nth-child(6) { width: 205px; min-width: 205px; }
.progress-overview-table th:nth-child(7),
.progress-overview-table td:nth-child(7) { width: 220px; min-width: 220px; }

.progress-overview-table td { overflow-wrap: anywhere; }
.progress-overview__status { min-width: 0; vertical-align: top; }
.progress-overview__status .badge { white-space: normal; }
.progress-overview__action { min-width: 0; vertical-align: top; }
.forced-assignment { min-width: 0; max-width: 100%; }
.forced-assignment summary { cursor: pointer; list-style: none; }
.forced-assignment summary::-webkit-details-marker { display: none; }
.forced-assignment__form { display: grid; gap: 8px; width: 100%; min-width: 0; margin-top: 10px; }
.forced-assignment__notice { display: block; margin-bottom: 8px; line-height: 1.35; }
.forced-assignment__form label { min-width: 0; }
.forced-assignment__form .form-input { width: 100%; min-width: 0; }

.applicants-table--history tbody td { background: #fafafa; color: var(--color-text-secondary); }
.applicants-table--history tbody td:first-child strong { color: var(--color-text); }

/* Žadatelé: karty prací a dvousloupcový seznam/detail bez změny workflow. */
.applicants-work-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.applicant-work-card {
  display: flex;
  flex-direction: column;
  min-height: 250px;
  padding: 22px;
  color: inherit;
  text-decoration: none;
  transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;
}

.applicant-work-card:hover {
  border-color: var(--primary);
  box-shadow: 0 12px 30px rgba(22, 63, 92, .11);
  transform: translateY(-2px);
}

.applicant-work-card--history { background: #fafafa; }
.applicant-work-card__header { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.applicant-work-card__header > span:first-child { display: grid; gap: 4px; min-width: 0; }
.applicant-work-card__eyebrow,
.applicants-detail__eyebrow { color: var(--text-muted); font-size: .7rem; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; }
.applicant-work-card__title { font-size: 1.05rem; overflow-wrap: anywhere; }
.applicant-work-card__meta { display: grid; gap: 5px; margin-top: 18px; color: var(--text-muted); font-size: .8rem; }
.applicant-work-card__meta strong { color: var(--text-primary); font-weight: 650; }
.applicant-work-card__stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 20px; }
.applicant-work-card__stats > span { display: grid; gap: 4px; padding: 10px; border-radius: var(--radius); background: var(--border-subtle); }
.applicant-work-card__stats small { color: var(--text-muted); font-size: .68rem; }
.applicant-work-card__stats strong { font-size: .95rem; }
.applicant-work-card__action { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: auto; padding-top: 20px; color: var(--primary); font-size: .82rem; }
.applicant-work-card__action > span { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--primary-light); font-size: 1rem; }

.applicants-master-detail {
  display: grid;
  /* Desktop: master cca 1/3, detail cca 2/3. */
  grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
  gap: 20px;
  align-items: start;
}

.applicants-phase-banner { margin-bottom: 16px; }
.applicants-topic-summary { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 16px; }
.applicants-topic-summary > span { display: inline-flex; align-items: center; gap: 8px; max-width: 100%; padding: 7px 10px; border: 1px solid var(--border-subtle); border-radius: 999px; background: var(--surface); color: var(--text-muted); font-size: .78rem; overflow-wrap: anywhere; }
.applicants-topic-summary strong { display: grid; flex: 0 0 auto; min-width: 24px; height: 24px; place-items: center; border-radius: 50%; background: var(--primary-light); color: var(--primary); }

.applicants-list-column { display: flex; min-width: 0; height: calc(100vh - 300px); min-height: 310px; max-height: calc(100vh - 300px); flex-direction: column; gap: 10px; }
.applicants-topic-tabs { display: flex; flex: 0 0 auto; gap: 8px; min-width: 0; padding: 2px; overflow-x: auto; scrollbar-width: thin; }
.applicants-topic-tab { display: inline-flex; min-width: 118px; flex: 1 0 auto; justify-content: center; align-items: center; gap: 7px; padding: 10px 12px; border: 1px solid var(--border-subtle); border-radius: var(--radius); background: var(--surface); color: var(--text-muted); font: inherit; font-size: .76rem; cursor: pointer; white-space: nowrap; }
.applicants-topic-tab strong { color: var(--text); font-size: .8rem; }
.applicants-topic-tab:hover { border-color: var(--primary); color: var(--primary); }
.applicants-topic-tab--active { border-color: var(--primary); background: var(--primary-light); color: var(--primary); box-shadow: inset 0 -2px 0 var(--primary); }
.applicants-topic-tab--active strong { color: var(--primary); }
.applicants-list { max-height: calc(100vh - 300px); min-height: 310px; padding: 8px; overflow-y: auto; }
.applicants-list-column .applicants-list { display: flex; min-height: 0; max-height: none; flex: 1 1 0; flex-direction: column; overflow: hidden; }
.applicants-list--topic[hidden] { display: none !important; }
.applicants-list__items { min-height: 0; overflow-y: auto; scrollbar-gutter: stable; }
.applicants-list__heading { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 0 6px 6px; padding: 12px 8px 16px; border-bottom: 1px solid var(--border-subtle); }
.applicants-list__heading > span:first-child { display: grid; gap: 3px; }
.applicants-list__heading strong { line-height: 1.3; overflow-wrap: anywhere; }
.applicants-list__heading .text-muted { font-size: .75rem; }
.applicants-list__count { flex: 0 0 auto; padding: 5px 9px; border-radius: 999px; background: var(--primary-light); color: var(--primary); font-size: .72rem; font-weight: 750; white-space: nowrap; }
.applicants-list__empty { margin: 0; padding: 24px 14px; color: var(--text-muted); font-size: .8rem; text-align: center; }
.applicants-list__item { display: flex; width: 100%; justify-content: space-between; align-items: center; gap: 12px; padding: 14px; border: 1px solid transparent; border-radius: var(--radius); background: transparent; color: inherit; text-align: left; cursor: pointer; }
.applicants-list__item + .applicants-list__item { margin-top: 4px; }
.applicants-list__item:hover { background: var(--border-subtle); }
.applicants-list__item:focus-visible { outline: 3px solid color-mix(in srgb, var(--primary) 28%, transparent); outline-offset: 1px; }
.applicants-list__item--active { border-color: var(--primary); background: var(--primary-light); }
.applicants-list__main { display: grid; gap: 4px; min-width: 0; }
.applicants-list__main strong,
.applicants-list__main span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.applicants-list__main span { color: var(--text-muted); font-size: .78rem; }
.applicants-list__main .applicants-list__work { color: var(--text-primary); font-weight: 650; }
.applicants-list__meta { display: flex; align-items: center; gap: 9px; flex-shrink: 0; }
.applicants-list__arrow { color: var(--primary); font-size: 1rem; }

.applicants-detail { position: sticky; top: 88px; min-height: 310px; padding: 28px; }
.applicants-detail__placeholder { display: grid; min-height: 250px; place-items: center; align-content: center; text-align: center; }
.applicants-detail__placeholder-icon { display: grid; place-items: center; width: 44px; height: 44px; margin-bottom: 12px; border-radius: 50%; background: var(--primary-light); color: var(--primary); font-size: 1.35rem; }
.applicants-detail__placeholder h3 { margin-bottom: 6px; }
.applicants-detail__panel[hidden],
.applicants-detail__placeholder[hidden] { display: none; }
.applicants-detail__header { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; padding-bottom: 22px; border-bottom: 1px solid var(--border-subtle); }
.applicants-detail__header > span:first-child { min-width: 0; }
.applicants-detail__header h3 { margin: 3px 0 0; font-size: 1.3rem; }
.applicants-detail__header p { margin: 5px 0 0; font-size: .82rem; }
.applicants-detail__list { margin-top: 22px; }
.applicants-detail__motivation { align-items: start !important; }
.applicants-detail__motivation dd { max-width: 560px; line-height: 1.55; overflow-wrap: anywhere; text-align: left; }
.applicants-detail__actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 26px; padding-top: 20px; border-top: 1px solid var(--border-subtle); }
.applicants-detail__actions form { margin: 0; }
.applicants-detail__phase-note { margin: 24px 0 0; padding: 14px 16px; border-radius: var(--radius); background: var(--border-subtle); color: var(--text-muted); }
.applicants-detail__mobile-back { display: none; }

@media (max-width: 900px) {
  .student-dashboard { display: flex; flex-direction: column; gap: 0; }
  .student-dashboard__welcome,
  .student-phase,
  .student-dashboard__timeline,
  .student-quick-grid,
  .student-dashboard__lower { grid-column: auto; grid-row: auto; }
  .teacher-shell .content { padding-bottom: 92px; }
  .teacher-shell .topbar__hamburger { display: none; }
  .teacher-shell .student-bottom-nav { display: grid; }
  .applicants-work-grid,
  .applicants-master-detail { grid-template-columns: minmax(0, 1fr); }
  .applicants-list-column { max-height: 430px; }
  .applicants-list { max-height: 430px; }
  .applicants-detail { position: static; }
}

@media (max-width: 560px) {
  .applicant-work-card__header { flex-direction: column; }
  .applicant-work-card__stats { grid-template-columns: minmax(0, 1fr); }
  .applicants-detail { padding: 20px; }
  .applicants-detail__header { flex-direction: column; }
  .applicants-detail__actions,
  .applicants-detail__actions form,
  .applicants-detail__actions .btn { width: 100%; }
  .applicants-master-detail { display: block; min-width: 0; overflow-x: hidden; }
  .applicants-list-column { height: auto; min-height: 0; max-height: none; gap: 14px; overflow: visible; }
  .applicants-list-column .applicants-list { display: block; overflow: visible; }
  .applicants-list__items { overflow: visible; }
  .applicants-list { max-height: none; min-height: 0; padding: 6px; overflow: visible; }
  .applicants-list__item { width: 100%; min-width: 0; margin-top: 8px; padding: 16px 14px; border-color: var(--border-subtle); background: var(--surface); box-shadow: 0 5px 16px rgba(15, 23, 42, .05); }
  .applicants-detail { display: none; min-width: 0; min-height: 0; overflow-wrap: anywhere; border-left: 4px solid var(--primary); }
  .applicants-master-detail--detail-open .applicants-list-column,
  .applicants-master-detail--detail-open > .applicants-list { display: none; }
  .applicants-master-detail--detail-open .applicants-detail { display: block; }
  .applicants-detail__mobile-back { display: inline-flex; margin: 0 0 18px; padding: 0; border: 0; background: transparent; color: var(--primary); font: inherit; font-weight: 700; cursor: pointer; }
}

.results-overview--published .results-overview__pre-publish { display: none; }
.results-overview--published .final-assignment-heading { color: var(--color-success-text); }
.results-overview--published .final-assignment-card { border-top: 4px solid var(--color-success); }

@media (max-width: 600px) {
  .final-results-section { padding: 18px 15px 20px; }
  .final-results-section__header { align-items: stretch; flex-direction: column; }
  .final-results-section__header .btn { width: 100%; }
}

/* Datum, čas a školní rok také ve studentské horní liště. */
.student-shell .topbar {
  display: flex;
  background: var(--color-surface);
  border-color: var(--color-border);
}

@media (max-width: 760px) {
  .student-shell .topbar { height: 48px; padding: 0 16px; }
  .student-shell .topbar-notifications { display: none; }
  .student-shell .topbar__hamburger { display: none; }
  .student-shell .topbar__title { font-size: .9rem; }
  .student-shell .topbar__datetime { display: inline; font-size: .78rem; }
  .student-shell .topbar__class { display: inline; font-size: .75rem; }
  .student-shell .topbar__class-separator { display: inline; }
  .student-shell .topbar__school-year,
  .student-shell .topbar__context-separator { display: none; }

  .student-bottom-nav__link .student-nav__icon { position: relative; }
  .student-bottom-nav__notification-count {
    position: absolute;
    top: -5px;
    right: -9px;
    display: grid;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    place-items: center;
    border: 2px solid var(--color-surface);
    border-radius: 999px;
    background: var(--danger);
    color: #fff;
    font-size: .58rem;
    font-weight: 800;
    line-height: 1;
  }
}

/* ----------------------------------------------------------
   SUPER_ADMIN — globální přehled
---------------------------------------------------------- */
.super-dashboard__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
}

.super-dashboard__header h2 {
  margin: 0 0 6px;
  color: var(--text-primary);
  font-size: clamp(1.45rem, 2.2vw, 1.85rem);
  letter-spacing: -0.025em;
}

.super-dashboard__eyebrow {
  margin: 0 0 6px;
  color: var(--primary);
  font-size: .7rem;
  font-weight: 800;
  letter-spacing: .1em;
  line-height: 1.3;
  text-transform: uppercase;
}

.super-dashboard__subtitle {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--text-muted);
  font-size: .85rem;
}

.super-dashboard__year {
  display: flex;
  flex-direction: column;
  flex: 0 0 auto;
  gap: 2px;
  min-width: 170px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  color: var(--text-muted);
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.super-dashboard__year strong {
  color: var(--text-primary);
  font-size: 1rem;
  letter-spacing: 0;
}

.super-dashboard__status {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 24px;
  margin-bottom: 28px;
  padding: 22px 24px;
  border: 1px solid var(--border);
  border-left: 4px solid var(--primary);
  border-radius: var(--radius-lg);
  background: linear-gradient(110deg, var(--primary-light), var(--surface) 70%);
  box-shadow: var(--shadow-sm);
}

.super-dashboard__status h3 {
  margin: 0 0 6px;
  color: var(--text-primary);
  font-size: clamp(1.25rem, 2vw, 1.65rem);
  letter-spacing: -0.02em;
}

.super-dashboard__status-main > p:last-child {
  max-width: 760px;
  color: var(--text-secondary);
  font-size: .875rem;
}

.super-dashboard__status-side {
  display: flex;
  align-items: flex-end;
  flex-direction: column;
  gap: 12px;
}

.dashboard-section__heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.dashboard-section__heading .dashboard-section__title {
  margin-bottom: 3px;
}

.dashboard-section__subtitle {
  color: var(--text-muted);
  font-size: .8125rem;
}

.super-dashboard__process .timeline-card {
  margin-bottom: 0;
}

.super-dashboard__legacy-metrics { display: none; }

.super-dashboard__overview {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.super-dashboard__group { min-width: 0; margin-bottom: 0; }
.super-dashboard__group .dashboard-section__heading { min-height: 54px; }
.super-dashboard__group-card { height: calc(100% - 66px); margin-bottom: 0; padding: 6px 18px; }
.super-dashboard__summary-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 67px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.super-dashboard__summary-row:last-child { border-bottom: 0; }
.super-dashboard__summary-row > div { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.super-dashboard__summary-label { color: var(--text-secondary); font-size: .82rem; }
.super-dashboard__summary-row strong { color: var(--text-primary); font-size: 1.45rem; line-height: 1; }
.super-dashboard__summary-row a, .super-dashboard__work-summary a { flex: 0 0 auto; font-size: .78rem; font-weight: 700; }
.super-dashboard__summary-note { flex: 0 0 auto; color: var(--text-muted); font-size: .76rem; }
.super-dashboard__summary-row--attention { margin: 0 -18px; padding-right: 18px; padding-left: 18px; border-left: 3px solid var(--warning); background: color-mix(in srgb, var(--warning) 7%, transparent); }
.super-dashboard__summary-row--attention strong { color: var(--warning); }
.super-dashboard__calm-state { display: flex; flex-direction: column; justify-content: center; gap: 5px; min-height: 180px; color: var(--text-muted); }
.super-dashboard__calm-state strong { color: var(--text-primary); }
.super-dashboard__work-summary { display: flex; flex-direction: column; justify-content: center; min-height: 180px; gap: 5px; }
.super-dashboard__work-summary strong { color: var(--text-primary); font-size: 2rem; line-height: 1; }
.super-dashboard__work-summary span { color: var(--text-muted); font-size: .82rem; }
.super-dashboard__work-summary a { margin-top: 8px; }

.super-dashboard__metrics {
  margin-bottom: 0;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.super-dashboard__metrics .card {
  min-height: 0;
  padding: 14px 16px;
}

.super-dashboard__metrics .card__label { margin-bottom: 5px; }
.super-dashboard__metrics .card__value { font-size: 1.55rem; }
.super-dashboard__metrics .card__action { margin-top: 8px; }

.super-admin-shell .sidebar__nav { padding: 8px 0; }

.super-admin-shell .sidebar__section {
  margin-top: 12px;
  padding-top: 8px;
}

.super-admin-shell .sidebar__section-label {
  padding-bottom: 3px;
}

.super-admin-shell .sidebar__link {
  padding-top: 7px;
  padding-bottom: 7px;
}

.super-dashboard__attention-card {
  border-top: 3px solid var(--warning);
}

.super-dashboard__value-suffix {
  margin-left: 3px;
  color: var(--text-muted);
  font-size: .95rem;
  font-weight: 700;
  letter-spacing: 0;
}

.super-dashboard__schedule .card {
  margin-bottom: 0;
}

.teacher-admin-dashboard__agenda {
  grid-column: span 2;
}

@media (max-width: 768px) {
  .super-dashboard__overview { grid-template-columns: 1fr; gap: 22px; }
  .super-dashboard__group-card { height: auto; }

  .teacher-admin-dashboard__agenda { grid-column: auto; }

  .super-dashboard__header {
    gap: 16px;
    margin-bottom: 20px;
  }

  .super-dashboard__year {
    min-width: 145px;
  }

  .super-dashboard__status {
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
    margin-bottom: 22px;
    padding: 18px 18px 20px;
  }

  .super-dashboard__status-side {
    align-items: flex-start;
    flex-direction: row;
    flex-wrap: wrap;
  }

  .dashboard-section__heading {
    align-items: stretch;
    flex-direction: column;
    gap: 8px;
  }

  .dashboard-section__heading > .btn {
    align-self: flex-start;
  }
}

@media (max-width: 480px) {
  .super-dashboard__header {
    flex-direction: column;
  }

  .super-dashboard__year {
    width: 100%;
  }

  .super-dashboard__status-side {
    align-items: stretch;
    flex-direction: column;
  }

  .super-dashboard__status-side .btn,
  .super-dashboard__schedule .dashboard-section__heading .btn {
    width: 100%;
  }
}

@media (max-width: 768px) {
  .student-shell .student-bottom-nav {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

/* Admin timeline: časová proporce patří pouze ose, ne informačním štítkům. */
body:not(.student-shell) #maturita-timeline .timeline-segment {
  border-right: 2px solid var(--surface);
}

body:not(.student-shell) #maturita-timeline .timeline-segment:last-of-type {
  border-right: 0;
}

body:not(.student-shell) #maturita-timeline .timeline-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 10px;
  margin-top: 20px;
}

body:not(.student-shell) #maturita-timeline .timeline-legend__item {
  flex: 1 1 175px;
  width: auto;
  min-width: 160px;
  padding: 9px 12px 10px;
  border-top-width: 3px;
}

body:not(.student-shell) #maturita-timeline .timeline-legend__status {
  display: inline-block;
  margin-top: 6px;
  padding: 3px 7px;
  border-radius: 999px;
  background: var(--border-subtle);
  color: var(--text-secondary);
  font-size: .66rem;
  font-weight: 700;
}

body:not(.student-shell) #maturita-timeline .timeline-legend__status::after {
  content: 'Následuje';
}

body:not(.student-shell) #maturita-timeline .timeline-legend__item--active .timeline-legend__status {
  font-size: 0;
}

body:not(.student-shell) #maturita-timeline .timeline-legend__item--active .timeline-legend__status::after {
  content: 'Probíhá';
  font-size: .66rem;
}

body:not(.student-shell) #maturita-timeline .timeline-legend__item--done .timeline-legend__status {
  font-size: 0;
}

body:not(.student-shell) #maturita-timeline .timeline-legend__item--done .timeline-legend__status::after {
  content: 'Skončilo';
  font-size: .66rem;
}

body:not(.student-shell) #maturita-timeline .timeline-legend__item--active .timeline-legend__status {
  background: var(--primary-light);
  color: var(--primary);
}

body:not(.student-shell) #maturita-timeline .timeline-legend__item--done .timeline-legend__status {
  background: #f0f5df;
  color: var(--color-success-text);
}

@media (max-width: 600px) {
  body:not(.student-shell) #maturita-timeline .timeline-legend {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
  }

  body:not(.student-shell) #maturita-timeline .timeline-legend__item {
    width: 100%;
    min-width: 0;
  }
}

/* Jednoduchý lokální přehled pro třetí položku studentského mobilního menu. */
.student-notifications { display: none; }

@media (max-width: 768px) {
  .student-shell .student-notifications {
    position: fixed;
    inset: 0;
    z-index: 300;
    display: grid;
    align-items: end;
    padding-bottom: calc(76px + env(safe-area-inset-bottom));
  }

  .student-shell .student-notifications[hidden] { display: none; }

  .student-notifications__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, .42);
  }

  .student-notifications__dialog {
    position: relative;
    width: 100%;
    padding: 20px 18px 22px;
    border: 1px solid var(--color-border);
    border-radius: 18px 18px 0 0;
    background: var(--color-surface);
    box-shadow: 0 -10px 30px rgba(23, 36, 43, .16);
  }

  .student-notifications__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 10px;
  }

  .student-notifications__header h2 {
    margin: 0;
    color: var(--color-text);
    font-size: 1.05rem;
  }

  .student-notifications__close {
    display: grid;
    width: 32px;
    height: 32px;
    place-items: center;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: var(--border-subtle);
    color: var(--color-text-secondary);
    font-size: 1.35rem;
    line-height: 1;
    cursor: pointer;
  }

  .student-notifications__dialog p {
    margin: 0;
    color: var(--color-text-secondary);
    font-size: .9rem;
    line-height: 1.5;
  }

  .student-notifications__dialog .topbar-notification-list {
    max-height: min(52vh, 430px);
    margin: 0 -8px;
  }

  .student-notifications__dialog .topbar-notification-tabs {
    padding-left: 0;
    padding-right: 0;
  }
}

/* Učitelský mobil používá stejný kompaktní rytmus jako studentská část. */
@media (max-width: 768px) {
  .teacher-shell .content {
    width: 100%;
    padding: 24px 16px calc(92px + env(safe-area-inset-bottom));
    overflow-x: hidden;
  }

  .teacher-shell .dashboard {
    display: flex;
    flex-direction: column;
    gap: 0;
    min-width: 0;
  }

  .teacher-shell .dashboard__welcome,
  .teacher-shell .page-header {
    margin-top: 0;
    margin-bottom: 20px;
  }

  .teacher-shell .dashboard__welcome h2,
  .teacher-shell .page-header h2 {
    font-size: 1.5rem;
    line-height: 1.2;
  }

  .teacher-shell .page-header {
    align-items: stretch;
    flex-direction: column;
    gap: 12px;
  }

  .teacher-shell .page-header > .btn,
  .teacher-shell .page-header > div:last-child .btn {
    width: 100%;
  }

  .teacher-shell .card,
  .teacher-shell .final-results-section,
  .teacher-shell .timeline-card {
    border-radius: 16px;
    box-shadow: var(--card-shadow);
  }

  .teacher-shell .card-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 14px;
    margin-bottom: 20px;
  }

  .teacher-shell .card--stat {
    min-height: 0;
    padding: 18px;
  }

  .teacher-shell .timeline-card {
    margin-bottom: 20px;
    padding: 18px 16px 20px;
  }

  .teacher-shell .timeline-card__sub { margin-bottom: 14px; }
  .teacher-shell .timeline-wrap { padding-right: 0; padding-left: 0; }
  .teacher-shell .timeline-track { width: 100%; }
  .teacher-shell .timeline-legend {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
    margin-top: 16px;
  }

  .teacher-shell .timeline-legend__item,
  .teacher-shell .timeline-legend__item--milestone {
    width: 100%;
    min-width: 0;
    padding: 10px 12px;
  }

  .teacher-shell .timeline-legend__name,
  .teacher-shell .timeline-legend__range {
    overflow-wrap: anywhere;
  }

  .teacher-shell .btn {
    min-height: 44px;
  }

  .teacher-shell .applicants-work-grid { gap: 14px; }
  .teacher-shell .applicant-work-card {
    min-height: 0;
    padding: 18px;
    border-radius: 16px;
  }

  .teacher-shell .applicant-work-card__header {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
  }

  .teacher-shell .applicant-work-card__stats {
    gap: 6px;
    margin-top: 16px;
  }

  .teacher-shell .applicants-list,
  .teacher-shell .applicants-detail,
  .teacher-shell .users-filters,
  .teacher-shell .users-list,
  .teacher-shell .users-detail {
    border-radius: 16px;
    box-shadow: var(--card-shadow);
  }

  .teacher-shell .users-filters,
  .teacher-shell .users-list,
  .teacher-shell .users-detail,
  .teacher-shell .applicants-list,
  .teacher-shell .applicants-detail {
    padding: 16px;
  }

  .teacher-shell .users-filters__form { grid-template-columns: minmax(0, 1fr); }
  .teacher-shell .users-filters__search,
  .teacher-shell .users-filters__actions { grid-column: auto; }
  .teacher-shell .users-filters__toolbar { grid-template-columns: minmax(0, 1fr); }
  .teacher-shell .users-filters__toolbar .btn { min-height: 46px; }

  .teacher-shell .users-list__item {
    align-items: flex-start;
    padding: 14px 12px;
    border-color: var(--border-subtle);
    background: var(--surface);
  }

  .teacher-shell .users-list__meta {
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  .teacher-shell .final-results-section {
    margin-bottom: 20px;
    padding: 18px 16px 20px;
  }

  .teacher-shell .final-results-section__header {
    align-items: stretch;
    flex-direction: column;
    gap: 12px;
  }

  .teacher-shell .final-results-section__header .btn { width: 100%; }

  .teacher-shell .teacher-final-students-card {
    padding: 10px;
    overflow: hidden;
  }

  .teacher-shell .teacher-final-students-card .table-scroll { overflow: visible; }
  .teacher-shell .teacher-final-students-card table,
  .teacher-shell .teacher-final-students-card tbody,
  .teacher-shell .teacher-final-students-card tr,
  .teacher-shell .teacher-final-students-card td { display: block; }
  .teacher-shell .teacher-final-students-card thead { display: none; }

  .teacher-shell .teacher-final-students-card tr {
    padding: 12px;
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    background: var(--surface);
  }

  .teacher-shell .teacher-final-students-card tr + tr { margin-top: 8px; }
  .teacher-shell .teacher-final-students-card td { padding: 4px 0; border: 0; }
  .teacher-shell .teacher-final-students-card td:first-child { font-size: .95rem; }
  .teacher-shell .teacher-final-students-card td:nth-child(2),
  .teacher-shell .teacher-final-students-card td:nth-child(3) { color: var(--text-secondary); font-size: .82rem; }

  .teacher-shell .dashboard > .card > .table-scroll { overflow: visible; }
  .teacher-shell .dashboard > .card > .table-scroll table,
  .teacher-shell .dashboard > .card > .table-scroll tbody,
  .teacher-shell .dashboard > .card > .table-scroll tr,
  .teacher-shell .dashboard > .card > .table-scroll td { display: block; }
  .teacher-shell .dashboard > .card > .table-scroll thead { display: none; }
  .teacher-shell .dashboard > .card > .table-scroll tr {
    padding: 12px;
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    background: var(--surface);
  }
  .teacher-shell .dashboard > .card > .table-scroll tr + tr { margin-top: 8px; }
  .teacher-shell .dashboard > .card > .table-scroll td {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 4px 0;
    border: 0;
  }
  .teacher-shell .dashboard > .card > .table-scroll td::before {
    flex: 0 0 auto;
    color: var(--text-muted);
    font-size: .72rem;
    font-weight: 700;
  }
  .teacher-shell .dashboard > .card > .table-scroll td:nth-child(1)::before { content: 'Práce'; }
  .teacher-shell .dashboard > .card > .table-scroll td:nth-child(2)::before { content: 'Max. studentů'; }
  .teacher-shell .dashboard > .card > .table-scroll td:nth-child(3)::before { content: 'Stav'; }
.teacher-shell .dashboard > .card > .table-scroll td:nth-child(4)::before { content: 'Akce'; }
}

/* Superadmin audit log */
.audit-page { padding: 24px; }
.audit-page__intro { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; margin-bottom: 22px; }
.audit-page__intro h2 { margin: 0 0 6px; }
.audit-page__intro p { margin: 0; max-width: 760px; }
.audit-filters { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; align-items: end; margin-bottom: 22px; }
.audit-filters .form-label { margin: 0; }
.audit-filters__actions { display: flex; grid-column: 1 / -1; justify-content: flex-end; gap: 8px; }
.audit-results-count { margin: 8px 0 10px; color: var(--text-muted); font-size: .8rem; text-align: right; }
.audit-table-wrap { overflow-x: auto; }
.audit-table { width: 100%; min-width: 1120px; table-layout: fixed; }
.audit-column-time { width: 15%; }
.audit-column-actor { width: 21%; }
.audit-column-action { width: 23%; }
.audit-column-entity { width: 16%; }
.audit-column-details { width: 13%; }
.audit-column-ip { width: 12%; }
.audit-table th { white-space: normal; }
.audit-table td { vertical-align: top; overflow-wrap: anywhere; line-height: 1.4; }
.audit-table td small { display: block; color: var(--text-muted); margin-top: 4px; }
.audit-time { white-space: nowrap; }
.audit-actor small { font-size: .72rem; }
.audit-action > span { display: block; }
.audit-action code { white-space: normal; overflow-wrap: anywhere; font-size: .68rem; }
.audit-table td:last-child code { white-space: nowrap; }
.audit-detail pre { white-space: pre-wrap; max-width: 300px; max-height: 220px; overflow: auto; font-size: 12px; }
.audit-empty { text-align: center; padding: 36px !important; color: var(--text-muted); }
.audit-pagination { display: flex; justify-content: space-between; align-items: center; margin-top: 18px; }
.audit-pagination > div { display: flex; gap: 8px; }
@media (max-width: 900px) {
  .audit-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .audit-filters__actions { grid-column: 1 / -1; }
}
@media (max-width: 560px) {
  .audit-page { padding: 16px; }
  .audit-filters { grid-template-columns: 1fr; }
  .audit-pagination { align-items: flex-start; gap: 12px; flex-direction: column; }
}
