/* Klassenansicht: Header, Sidebar, Karteikarte, Tabelle */

.app-shell {
  display: flex;
  flex-direction: column;
  width: 100%;
  min-height: 100vh;
}

.app-header {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 0.6rem 1rem;
  min-height: 64px;
  padding: 0.45rem 0.85rem;
  border-bottom: 1px solid var(--color-border);
  background: #fff;
}

.header-brand {
  min-width: 0;
}

.header-title {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1.1;
}

.header-subtitle {
  margin: 0;
  color: var(--color-muted);
  font-size: 0.78rem;
}

.header-motto {
  display: none;
  margin: 0.1rem 0 0;
  color: var(--color-muted);
  font-size: 0.75rem;
}

.header-levels {
  display: none;
}

.header-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.4rem;
}

.save-notice {
  margin: 0 0.25rem 0 0;
  color: var(--color-accent);
  font-size: 0.8rem;
}

.header-menu {
  position: relative;
}

.menu-panel {
  position: absolute;
  top: calc(100% + 0.2rem);
  right: 0;
  z-index: 40;
  display: grid;
  min-width: 9rem;
  padding: 0.2rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: #fff;
}

.header-menu .menu-panel {
  min-width: 12.5rem;
}

.menu-panel[hidden] {
  display: none;
}

.menu-panel button,
.menu-panel a {
  padding: 0.4rem 0.55rem;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  font-size: 0.875rem;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

.menu-panel button:hover,
.menu-panel a:hover {
  background: #f4f1ea;
}

.menu-panel-separator {
  height: 0;
  margin: 0.2rem 0.4rem;
  border: 0;
  border-top: 1px solid var(--color-border);
}

.menu-panel .menu-item--reset {
  color: #8a4038;
}

.menu-panel .menu-item--reset:hover {
  background: #f6e8e5;
  color: #7a342d;
}

.level-chip {
  min-height: 2rem;
  padding: 0.25rem 0.7rem;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  background: #fff;
  color: var(--color-text);
  font: inherit;
  font-size: 0.82rem;
  cursor: pointer;
}

.level-chip.is-active {
  border-color: var(--color-accent);
  background: var(--color-accent);
  color: #fff;
}

.app-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  flex: 1;
  min-height: 0;
}

.sidebar-toggle {
  display: inline-flex;
}

.sidebar-overlay {
  display: none;
}

.sidebar {
  position: fixed;
  inset: 64px auto 0 0;
  z-index: 25;
  width: min(18rem, 90vw);
  padding: 0.85rem 0.8rem 1rem;
  overflow: auto;
  border-right: 1px solid var(--color-border);
  background: #fffdf9;
  transform: translateX(-105%);
}

.app-shell.is-sidebar-open .sidebar {
  transform: none;
}

.app-shell.is-sidebar-open .sidebar-overlay {
  display: block;
  position: fixed;
  inset: 64px 0 0;
  z-index: 20;
  border: 0;
  background: rgb(31 28 24 / 28%);
}

.sidebar-class {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
  margin-bottom: 1rem;
}

.sidebar-class-name {
  min-width: 0;
  font-size: 1.05rem;
  font-weight: 650;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-class-form {
  display: flex;
  gap: 0.35rem;
  width: 100%;
}

.sidebar-class-form input,
.add-student-form input {
  width: 100%;
  min-height: 2rem;
  padding: 0.25rem 0.45rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font: inherit;
  font-size: 0.875rem;
}

.sidebar-heading {
  margin: 0 0 0.45rem;
  color: var(--color-muted);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.add-student {
  margin-bottom: 0.55rem;
}

.add-student-form {
  display: grid;
  gap: 0.35rem;
}

.add-student-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.35rem;
}

.student-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.student-empty {
  color: var(--color-muted);
  font-size: 0.85rem;
}

.student-row {
  display: flex;
  align-items: center;
  border-radius: 6px;
}

.student-row.is-selected {
  background: var(--color-accent-soft);
}

.student-name {
  flex: 1;
  min-width: 0;
  padding: 0.4rem 0.45rem;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  font-size: 0.92rem;
  text-align: left;
  cursor: pointer;
}

.student-name:focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: -2px;
}

.student-menu {
  position: relative;
}

.main-content {
  min-width: 0;
  width: 100%;
  padding: 1.1rem 1rem 1.5rem;
}

.card-empty {
  margin: 2.5rem auto 0;
  color: var(--color-muted);
  text-align: center;
}

.student-sheet {
  width: 100%;
}

.student-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.4rem 1rem;
  margin: 0 0 1.25rem;
  padding: 0 0 0.85rem;
  border-bottom: 1px solid var(--color-border);
}

.student-title {
  margin: 0 0 0.2rem;
  font-size: 1.4rem;
  font-weight: 700;
}

.student-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.15rem 0.35rem;
  margin: 0;
  padding: 0;
  list-style: none;
  color: var(--color-muted);
  font-size: 0.85rem;
}

.student-meta li:not(:last-child)::after {
  content: "|";
  margin-left: 0.35rem;
  color: #c9c2b6;
}

.student-meta strong {
  margin-left: 0.2rem;
  color: var(--color-text);
  font-weight: 650;
}

.total-progress {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 650;
}

.competency-register {
  min-width: 0;
  --tone-green-fill: #dceee0;
  --tone-green-line: #9fc6a6;
  --tone-green-wash: #f6fbf7;
  --tone-blue-fill: #dde7f4;
  --tone-blue-line: #9eb4d2;
  --tone-blue-wash: #f6f9fd;
  --tone-yellow-fill: #f3e9c8;
  --tone-yellow-line: #d2bf86;
  --tone-yellow-wash: #fdfbf3;
  --tone-rose-fill: #f3dee2;
  --tone-rose-line: #d3a8af;
  --tone-rose-wash: #fdf7f8;
  --tone-violet-fill: #e8def2;
  --tone-violet-line: #c0a8d2;
  --tone-violet-wash: #faf7fd;
  --tone-teal-fill: #d5eeea;
  --tone-teal-line: #8fc4bc;
  --tone-teal-wash: #f4fbfa;
  --section-fill: var(--tone-green-fill);
  --section-line: var(--tone-green-line);
  --section-wash: var(--tone-green-wash);
}

.competency-register__tabs {
  display: flex;
  align-items: flex-end;
  gap: 0;
  padding: 0 2px 0 0;
}

.competency-register__tab {
  display: grid;
  gap: 0.05rem;
  flex: 0 1 auto;
  position: relative;
  z-index: var(--tab-z, 1);
  min-height: 2.7rem;
  margin-left: -10px;
  padding: 0.35rem 0.7rem 0.4rem;
  border: 1px solid var(--tone-green-line);
  border-bottom: 0;
  border-radius: 10px 10px 0 0;
  background: var(--tone-green-fill);
  color: inherit;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 550;
  line-height: 1.2;
  text-align: left;
  cursor: pointer;
}

.competency-register__tab:first-child {
  margin-left: 0;
}

.competency-register__tab--blue {
  border-color: var(--tone-blue-line);
  background: var(--tone-blue-fill);
}

.competency-register__tab--yellow {
  border-color: var(--tone-yellow-line);
  background: var(--tone-yellow-fill);
}

.competency-register__tab--rose {
  border-color: var(--tone-rose-line);
  background: var(--tone-rose-fill);
}

.competency-register__tab--violet {
  border-color: var(--tone-violet-line);
  background: var(--tone-violet-fill);
}

.competency-register__tab--teal {
  border-color: var(--tone-teal-line);
  background: var(--tone-teal-fill);
}

.competency-register__tab:not(.competency-register__tab--active) {
  filter: saturate(0.78);
  opacity: 0.88;
}

.competency-register__tab--active {
  z-index: 20;
  min-height: 3.15rem;
  padding-top: 0.5rem;
  padding-bottom: 0.55rem;
  border-bottom: 0;
  font-weight: 700;
  filter: none;
  opacity: 1;
  transform: translateY(-5px);
}

.competency-register__tab:focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: 2px;
  z-index: 30;
}

.competency-register__tab-title {
  white-space: nowrap;
}

.competency-register__tab-progress {
  color: var(--color-muted);
  font-size: 0.7rem;
  font-weight: 500;
}

.competency-register__panel {
  position: relative;
  z-index: 21;
  width: 100%;
  border: 1px solid var(--section-line);
  border-top: 3px solid var(--section-line);
  border-radius: 0 12px 12px 12px;
  background: var(--section-wash);
}

.competency-register__caption {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.75rem;
  padding: 0.65rem 0.85rem 0.35rem;
}

.competency-register__caption h2 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 650;
}

.competency-register__caption p {
  margin: 0;
  color: var(--color-muted);
  font-size: 0.85rem;
}

.table-wrap {
  width: 100%;
}

.competency-table {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
}

.competency-table th,
.competency-table td {
  padding: 0;
  border-bottom: 1px solid #ece7dc;
  vertical-align: middle;
}

.competency-table thead th {
  padding: 0.45rem 0.4rem;
  background: #faf7f1;
  font-size: 0.78rem;
  font-weight: 650;
  line-height: 1.25;
}

.col-nr,
.competency-table .col-nr {
  width: 56px;
  padding: 0.45rem 0.4rem;
  color: var(--color-muted);
  font-size: 0.88rem;
  font-variant-numeric: tabular-nums;
  font-weight: 550;
  text-align: left;
}

.col-label {
  padding: 0.45rem 0.55rem;
  font-size: 0.92rem;
  overflow-wrap: break-word;
}

.rating-col,
.rating-cell {
  width: 7rem;
  text-align: center;
}

.rating-cell {
  padding: 0;
}

.rating-hit {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 48px;
  cursor: pointer;
}

.rating-hit:hover {
  background: #f7f4ee;
}

.rating-hit input {
  width: 0.95rem;
  height: 0.95rem;
  margin: 0;
  accent-color: var(--color-accent);
}

.rating-cell:has(:checked) {
  background: var(--color-accent-soft);
}

.competency-table tbody tr:hover {
  background: #fcfaf6;
}

@media (max-width: 767px) {
  .app-header {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .header-actions {
    justify-content: flex-start;
  }

  .competency-register__tabs {
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
  }

  .competency-register__tab {
    flex: 0 0 auto;
  }

  .competency-register__panel {
    border-radius: 0 0 12px 12px;
  }

  .table-wrap {
    overflow-x: auto;
  }

  .competency-table {
    min-width: 46rem;
  }
}

@media (min-width: 768px) and (max-width: 1099px) {
  .app-header {
    grid-template-columns: minmax(0, 1fr) auto auto;
    min-height: 68px;
  }

  .header-levels {
    display: flex;
    gap: 0.4rem;
  }

  .app-body {
    grid-template-columns: 220px minmax(0, 1fr);
  }

  .sidebar-toggle,
  .sidebar-overlay,
  .app-shell.is-sidebar-open .sidebar-overlay {
    display: none;
  }

  .sidebar,
  .app-shell.is-sidebar-open .sidebar {
    position: sticky;
    top: 0;
    z-index: 1;
    inset: auto;
    width: auto;
    height: calc(100vh - 68px);
    transform: none;
  }

  .main-content {
    padding: 1.1rem 1rem 1.5rem;
  }

  .competency-register__tabs {
    overflow-x: auto;
  }

  .competency-register__tab {
    margin-left: -8px;
    padding-inline: 0.55rem;
    font-size: 0.72rem;
  }

  .rating-col,
  .rating-cell {
    width: 6.1rem;
  }
}

@media (min-width: 1100px) {
  .app-header {
    grid-template-columns: minmax(16rem, 1.1fr) auto minmax(16rem, 1fr);
    min-height: 70px;
    padding: 0.4rem 1.1rem;
  }

  .header-title {
    font-size: 1.7rem;
  }

  .header-motto,
  .header-levels {
    display: flex;
    gap: 0.45rem;
  }

  .header-levels {
    justify-content: center;
  }

  .sidebar-toggle,
  .sidebar-overlay,
  .app-shell.is-sidebar-open .sidebar-overlay {
    display: none;
  }

  .app-body {
    grid-template-columns: 280px minmax(0, 1fr);
  }

  .sidebar,
  .app-shell.is-sidebar-open .sidebar {
    position: sticky;
    top: 0;
    z-index: 1;
    inset: auto;
    width: auto;
    height: calc(100vh - 70px);
    padding: 0.95rem 0.9rem 1rem;
    transform: none;
  }

  .main-content {
    padding: 1.15rem 1.25rem 1.75rem;
  }

  .student-title {
    font-size: 1.55rem;
  }

  .competency-register__tab {
    font-size: 0.82rem;
    padding-inline: 0.8rem;
  }

  .rating-col,
  .rating-cell {
    width: 7.15rem;
  }
}
