:root {
  color-scheme: light;
  --page: #f5f4f0;
  --surface: #ffffff;
  --surface-soft: #eeecea;
  --ink: #1a1a1a;
  --muted: #666666;
  --line: #e0ddd6;
  --brand: #f28d01;
  --brand-dark: #c66f00;
  --accent: #ffc46b;
  --amber: #fff0d7;
  --good: #f28d01;
  --blue: #3c3489;
  --sand: #faeeda;
  --shadow: 0 10px 24px rgba(26, 26, 26, 0.06);
}

[data-theme="dark"] {
  color-scheme: dark;
  --page: #121614;
  --surface: #1c231f;
  --surface-soft: #253128;
  --ink: #eef5ed;
  --muted: #aab7ad;
  --line: #344239;
  --brand: #f28d01;
  --brand-dark: #ffb347;
  --accent: #ffcb7a;
  --amber: #3b2a14;
  --good: #f28d01;
  --shadow: 0 18px 48px rgba(0, 0, 0, 0.28);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--page);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body::before {
  content: "";
  position: fixed;
  inset: 0 0 auto;
  height: 5px;
  background: var(--brand);
  z-index: 5;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

svg {
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.app-shell {
  width: min(1120px, 100%);
  margin: 0 auto;
  padding: 16px clamp(14px, 3vw, 32px) 42px;
}

.topbar {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  align-items: center;
  gap: 14px;
  min-height: 68px;
  margin-bottom: 14px;
  border-bottom: 0;
  background: transparent;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 58px;
  height: 48px;
  border-radius: 0;
  background: transparent;
  color: #d9a060;
  box-shadow: none;
}

.brand-mark svg {
  width: 56px;
  height: 46px;
  stroke-width: 2.4;
}

.eyebrow,
.section-kicker {
  margin: 0 0 4px;
  color: var(--brand);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 1.35rem;
  font-weight: 780;
}

h2 {
  margin-bottom: 8px;
  font-size: clamp(1.25rem, 2.3vw, 2rem);
  line-height: 1.12;
}

p {
  color: var(--muted);
  line-height: 1.55;
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
}

.icon-button svg,
.primary-button svg,
.secondary-button svg,
.search-box svg {
  width: 20px;
  height: 20px;
}

.hero-panel,
.request-panel,
.form-panel,
.status-section,
.login-panel,
.admin-tools {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
}

.login-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 0.68fr);
  gap: 20px;
  align-items: start;
  padding: clamp(20px, 4vw, 34px);
}

.login-form {
  display: grid;
  gap: 14px;
}

.login-rules {
  grid-column: 1 / -1;
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 0.86rem;
}

.session-chip {
  min-height: 36px;
  max-width: min(34vw, 360px);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--brand-dark);
  padding: 8px 12px;
  font-size: 0.82rem;
  font-weight: 850;
  cursor: pointer;
}

.hero-panel {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 20px;
  align-items: end;
  padding: clamp(20px, 4vw, 34px);
  overflow: hidden;
  position: relative;
  border: 0;
  background: var(--brand);
}

.hero-panel::after {
  content: none;
}

.hero-panel h2,
.hero-panel p,
.hero-panel .section-kicker {
  color: white;
}

.hero-panel p {
  color: #faeeda;
}

.hero-panel p {
  max-width: 64ch;
  margin-bottom: 0;
}

.quick-stats {
  display: grid;
  grid-template-columns: minmax(150px, 1fr);
  gap: 10px;
  min-width: min(190px, 100%);
}

.quick-stat-button,
.status-card {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}

.quick-stat-button {
  display: grid;
  gap: 2px;
  color: var(--ink);
  text-align: left;
}

.quick-stat-button:hover {
  border-color: var(--brand);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--brand) 16%, transparent);
}

.quick-stats strong {
  display: block;
  color: var(--brand);
  font-size: 1.55rem;
}

.quick-stats span {
  color: var(--muted);
  font-size: 0.84rem;
}

.role-tabs,
.area-tabs {
  display: grid;
  gap: 8px;
  margin: 18px 0;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}

.role-tabs {
  grid-template-columns: 1fr 1fr;
}

.area-tabs {
  position: relative;
  display: flex;
  align-items: stretch;
  width: fit-content;
  max-width: 100%;
  overflow: visible;
}

.role-tab,
.area-tab,
.area-menu-summary {
  min-height: 44px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
}

.role-tab.active,
.area-tab.active,
.area-menu-group.active > .area-menu-summary {
  background: var(--brand);
  color: white;
}

.area-tab.primary,
.area-menu-summary {
  padding: 0 22px;
}

.area-menu-group {
  position: relative;
}

.area-menu-group::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  height: 10px;
}

.area-menu-dropdown {
  position: absolute;
  left: 0;
  top: 100%;
  z-index: 20;
  display: grid;
  min-width: 230px;
  gap: 4px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 0 0 12px 12px;
  background: var(--surface);
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transform: translateY(0);
  transition: opacity 140ms ease, transform 140ms ease;
}

.area-menu-group:hover .area-menu-dropdown,
.area-menu-group:focus-within .area-menu-dropdown,
.area-menu-group.menu-open .area-menu-dropdown {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.area-menu-dropdown .area-tab {
  justify-content: start;
  padding: 0 14px;
  text-align: left;
}

.area-menu-dropdown .area-tab:hover {
  background: var(--amber);
  color: var(--brand-dark);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(290px, 0.9fr) minmax(0, 1.5fr);
  gap: 18px;
  align-items: start;
}

.workspace.single-form {
  grid-template-columns: minmax(0, 920px);
  justify-content: center;
}

.request-panel,
.form-panel,
.status-section {
  padding: clamp(16px, 2vw, 22px);
}

.panel-heading,
.form-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.request-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.request-title-row h2 {
  margin: 0;
}

.route-info {
  position: relative;
}

.route-info summary {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--brand-dark);
  font-size: 0.88rem;
  font-weight: 900;
  line-height: 1;
  cursor: pointer;
  list-style: none;
}

.route-info summary::-webkit-details-marker {
  display: none;
}

.route-info[open] summary {
  border-color: var(--brand);
  background: var(--amber);
}

.route-info > div {
  position: absolute;
  z-index: 8;
  top: calc(100% + 8px);
  left: 0;
  width: min(420px, calc(100vw - 42px));
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.route-info h3 {
  margin: 0 0 6px;
  font-size: 1rem;
}

.route-info p {
  margin-bottom: 12px;
  font-size: 0.86rem;
}

.search-box {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 10px;
  min-height: 46px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
}

.search-box input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
}

.category-chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 14px 0;
}

.chip {
  flex: 0 0 auto;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface);
  color: var(--muted);
  padding: 0 12px;
  font-weight: 750;
}

.chip.active {
  border-color: var(--accent);
  background: var(--amber);
  color: var(--ink);
}

.request-list {
  display: grid;
  gap: 10px;
}

.request-card {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  align-items: center;
  width: 100%;
  min-height: 78px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink);
  text-align: left;
}

.request-card.active {
  border-color: var(--brand);
  outline: 2px solid color-mix(in srgb, var(--brand) 18%, transparent);
}

.request-card.inactive {
  background: color-mix(in srgb, var(--surface-soft) 55%, var(--surface));
  color: var(--muted);
}

.request-card.inactive .request-icon {
  background: var(--surface-soft);
  color: var(--muted);
}

.request-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: var(--amber);
  color: var(--brand);
}

.request-card h3 {
  margin: 0 0 4px;
  font-size: 0.98rem;
}

.request-card p {
  margin: 0;
  font-size: 0.82rem;
}

.inactive-badge {
  display: inline-flex;
  margin-top: 8px;
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--muted);
  padding: 4px 8px;
  font-size: 0.72rem;
  font-weight: 850;
}

.request-meta {
  color: var(--muted);
  font-size: 0.78rem;
  white-space: nowrap;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  border-radius: 20px;
  background: var(--amber);
  color: var(--brand-dark);
  padding: 0 10px;
  font-size: 0.82rem;
  font-weight: 800;
  white-space: nowrap;
}

.application-form {
  display: grid;
  gap: 18px;
}

.routing-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 0.72fr);
  gap: 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-soft);
}

.routing-card h3 {
  margin: 0 0 6px;
  font-size: 1rem;
}

.routing-card p {
  margin-bottom: 0;
  font-size: 0.88rem;
}

.route-steps {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  counter-reset: route;
  list-style: none;
}

.route-steps li {
  position: relative;
  min-height: 34px;
  padding: 8px 10px 8px 42px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink);
  font-size: 0.86rem;
  font-weight: 800;
}

.route-steps li::before {
  counter-increment: route;
  content: counter(route);
  position: absolute;
  left: 9px;
  top: 7px;
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: var(--brand);
  color: white;
  font-size: 0.74rem;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.field {
  display: grid;
  gap: 7px;
}

.field.full {
  grid-column: 1 / -1;
}

.notice-box {
  grid-column: 1 / -1;
  padding: 14px;
  border: 1px solid color-mix(in srgb, var(--amber) 55%, var(--line));
  border-radius: 12px;
  background: var(--amber);
  background: color-mix(in srgb, var(--amber) 18%, var(--surface));
  color: var(--ink);
  font-size: 0.9rem;
  line-height: 1.55;
}

.notice-box a {
  color: var(--brand-dark);
  font-weight: 850;
}

.inactive-form-notice {
  border-color: color-mix(in srgb, #b91c1c 35%, var(--line));
  background: color-mix(in srgb, #fee2e2 62%, var(--surface));
}


.field label {
  color: var(--ink);
  font-size: 0.88rem;
  font-weight: 800;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  padding: 10px 12px;
  outline: 0;
}

.field textarea {
  min-height: 116px;
  resize: vertical;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 16%, transparent);
}

.conflict-warning {
  border: 1px solid color-mix(in srgb, var(--brand) 42%, var(--line));
  border-radius: 8px;
  background: color-mix(in srgb, var(--brand) 12%, var(--surface));
  color: var(--ink);
  padding: 12px 14px;
  font-size: 0.9rem;
  line-height: 1.45;
}

.conflict-warning strong {
  display: block;
  margin-bottom: 4px;
}

.conflict-warning p {
  margin: 0 0 8px;
  color: var(--muted);
}

.conflict-warning ul {
  margin: 0;
  padding-left: 18px;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.primary-button,
.secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  border-radius: 8px;
  padding: 0 16px;
  font-weight: 850;
}

.primary-button {
  border: 1px solid var(--brand);
  background: var(--brand);
  color: white;
}

.secondary-button {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
}

.secondary-button.danger {
  border-color: color-mix(in srgb, #b00020 55%, var(--line));
  color: #b00020;
}

.secondary-button.small {
  min-height: 38px;
  padding: 0 12px;
  font-size: 0.86rem;
}

.status-section {
  margin-top: 18px;
}

.admin-tools {
  margin-top: 18px;
  padding: clamp(16px, 2vw, 22px);
}

.class-records {
  margin-top: 18px;
  padding: clamp(16px, 2vw, 22px);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
}

.year-rollover {
  display: grid;
  gap: 14px;
  margin-bottom: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  padding: 14px;
}

.year-rollover h3 {
  margin: 0 0 6px;
}

.year-rollover-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(150px, 1fr)) minmax(180px, auto) auto auto;
  gap: 10px;
  align-items: end;
}

.rollover-preview {
  display: grid;
  gap: 10px;
}

.rollover-summary {
  display: flex;
  align-items: baseline;
  gap: 8px;
  color: var(--muted);
}

.rollover-summary strong {
  color: var(--brand-dark);
  font-size: 1.5rem;
}

.rollover-list {
  display: grid;
  gap: 7px;
}

.rollover-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 9px 10px;
}

.rollover-row span {
  overflow-wrap: anywhere;
}

.rollover-row em {
  color: var(--brand-dark);
  font-size: 0.78rem;
  font-style: normal;
  font-weight: 850;
}

.rollover-row.muted-row {
  opacity: 0.65;
}

.class-record-layout {
  display: grid;
  grid-template-columns: minmax(240px, 0.38fr) minmax(0, 1fr);
  gap: 14px;
}

.class-list-panel,
.class-detail-panel {
  display: grid;
  align-content: start;
  gap: 12px;
}

.class-record-list {
  display: grid;
  max-height: 640px;
  overflow: auto;
  gap: 12px;
  padding-right: 4px;
}

.class-folder-grid,
.class-student-group {
  display: grid;
  gap: 8px;
}

.class-folder-block {
  display: grid;
  gap: 8px;
}

.class-folder-block.open {
  padding-bottom: 6px;
  border-bottom: 1px solid var(--line);
}

.class-folder {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--ink);
  padding: 10px;
  text-align: left;
}

.class-folder strong {
  flex: 1;
}

.folder-chevron {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 8px;
  background: color-mix(in srgb, var(--surface) 68%, transparent);
  font-weight: 900;
}

.class-folder.active {
  border-color: var(--brand);
  background: var(--brand);
  color: white;
}

.class-folder span {
  font-size: 0.78rem;
  font-weight: 800;
}

.class-record-item {
  display: grid;
  gap: 4px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  padding: 10px;
  text-align: left;
}

.class-record-item.active {
  border-color: var(--brand);
  background: var(--amber);
}

.class-record-item span {
  color: var(--muted);
  font-size: 0.78rem;
}

.student-summary,
.measure-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  padding: 14px;
}

.student-summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(200px, 0.42fr);
  gap: 12px;
}

.student-summary h3,
.measure-card h4,
.compact-form h3 {
  margin: 0 0 6px;
}

.student-summary dl,
.measure-card dl {
  display: grid;
  gap: 8px;
  margin: 0;
}

.student-summary dt,
.measure-card dt {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
}

.student-summary dd,
.measure-card dd {
  margin: 0;
  overflow-wrap: anywhere;
  font-size: 0.86rem;
}

.measure-list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.measure-card p {
  margin-bottom: 8px;
}

.compact-form {
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 14px;
}

.csv-grid {
  display: grid;
  gap: 12px;
}

.csv-grid + .csv-grid {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.role-admin {
  display: grid;
  gap: 12px;
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.role-admin h3 {
  margin: 0 0 6px;
}

.role-list {
  display: grid;
  gap: 8px;
}

.role-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  padding: 10px;
}

.role-row span {
  overflow-wrap: anywhere;
  font-weight: 750;
}

.role-add {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: end;
}

.status-board {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.status-board.year-mode,
.status-board.orga-mode,
.status-board.sl-mode,
.status-board.secretariat-mode {
  grid-template-columns: 1fr;
}

.central-list-panel,
.orga-regular-panel {
  display: grid;
  gap: 12px;
}

.central-list-panel {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.central-list-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
}

.central-list-toggle {
  display: inline-flex;
  gap: 10px;
  align-items: center;
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.central-list-toggle.compact {
  width: auto;
}

.central-list-head h3 {
  margin: 2px 0 0;
}

.central-list-head > span {
  color: var(--muted);
  font-weight: 850;
  font-size: 0.82rem;
}

.nachschreiber-group {
  display: grid;
  gap: 10px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.nachschreiber-appointment-panel {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.nachschreiber-appointment-panel h3 {
  margin: 2px 0 0;
}

.nachschreiber-appointment-form {
  display: grid;
  gap: 12px;
}

.nachschreiber-appointment-base,
.nachschreiber-appointment-row {
  display: grid;
  gap: 10px;
}

.nachschreiber-appointment-base {
  grid-template-columns: minmax(160px, 1fr) minmax(160px, 1fr);
}

.nachschreiber-appointment-row {
  grid-template-columns: minmax(110px, 0.6fr) minmax(160px, 1fr) minmax(160px, 1fr);
  align-items: end;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.nachschreiber-appointment-row strong {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
}

.nachschreiber-appointment-form[data-selected-level="Sek I"] [data-appointment-level-row="Sek II"],
.nachschreiber-appointment-form[data-selected-level="Sek II"] [data-appointment-level-row="Sek I"] {
  display: none;
}

.nachschreiber-appointment-form label {
  display: grid;
  gap: 6px;
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 850;
}

.nachschreiber-appointment-form input,
.nachschreiber-appointment-form select {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  padding: 8px 10px;
}

.nachschreiber-appointment-list {
  display: grid;
  gap: 8px;
}

.nachschreiber-appointment-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.nachschreiber-appointment-item div {
  display: grid;
  gap: 2px;
}

.nachschreiber-appointment-item span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.nachschreiber-group-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.nachschreiber-group-head h4 {
  margin: 0;
}

.nachschreiber-group-head span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.download-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.mini-button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.central-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.central-table {
  width: 100%;
  min-width: 980px;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.fahrten-table {
  min-width: 1280px;
}

.distribution-table {
  min-width: 1320px;
}

.project-table {
  min-width: 1080px;
}

.fahrten-table td {
  min-width: 150px;
}

.class-approval-cell {
  display: grid;
  gap: 8px;
  align-items: start;
}

.fahrten-entry {
  display: grid;
  gap: 6px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}

.fahrten-entry:last-child {
  border-bottom: 0;
}

.fahrten-entry.is-focused {
  border-radius: 8px;
  outline: 2px solid color-mix(in srgb, var(--brand) 55%, transparent);
  outline-offset: 3px;
}

.springer-form {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) repeat(5, minmax(105px, 1fr)) minmax(140px, 1.2fr) auto;
  gap: 8px;
}

.springer-form input {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
}

.springer-table {
  min-width: 760px;
}

.central-table th,
.central-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

.central-table th {
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0;
}

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

.list-status,
.done-label {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border-radius: 999px;
  padding: 3px 8px;
  background: var(--surface-soft);
  color: var(--muted);
  font-weight: 850;
  white-space: nowrap;
}

.done-label {
  color: var(--ok);
}

.status-filters {
  display: grid;
  grid-template-columns: 1.4fr repeat(3, minmax(130px, 1fr)) auto;
  gap: 10px;
  margin-bottom: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.status-filters label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 850;
}

.status-filters input,
.status-filters select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  padding: 9px 10px;
  font: inherit;
}

.status-filters .status-filter-check {
  align-items: center;
  align-self: end;
  display: flex;
  min-height: 40px;
  gap: 8px;
  padding: 0 6px;
  color: var(--ink);
}

.status-filter-check input {
  width: 18px;
  height: 18px;
  accent-color: var(--brand);
}

.orga-activity {
  margin-bottom: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.orga-activity-section + .orga-activity-section {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.orga-activity-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 12px;
}

.orga-activity-head h3 {
  margin: 0;
  font-size: 1.05rem;
}

.orga-activity-head span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.orga-activity-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.orga-activity-item {
  display: grid;
  gap: 5px;
  min-height: 92px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--ink);
  padding: 10px;
  text-align: left;
}

.orga-activity-item.unread {
  border-color: var(--brand);
  background: var(--amber);
}

.orga-activity-item strong {
  font-size: 0.92rem;
}

.orga-activity-item span:last-child {
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.35;
}

.activity-badge {
  justify-self: start;
  border-radius: 999px;
  background: var(--brand);
  color: white;
  padding: 3px 8px;
  font-size: 0.68rem;
  font-weight: 850;
}

.activity-badge-approved {
  background: #15803d;
}

.activity-badge-rejected {
  background: #b91c1c;
}

.status-year-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.status-board.nachschreiber-mode .status-year-cards {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
}

.status-board.nachschreiber-mode {
  max-width: 1280px;
}

.orga-year-list {
  display: grid;
  gap: 8px;
  padding: 8px 0 0 30px;
}

.class-folder-block.nested {
  border-bottom: 0;
}

.status-card {
  background: var(--surface);
}

.status-card.is-updating {
  border-color: var(--brand);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--brand) 18%, transparent), var(--shadow);
}

.status-card.is-focused {
  border-color: var(--brand);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--brand) 18%, transparent), var(--shadow);
}

.status-card h3 {
  margin: 0 0 6px;
  font-size: 1rem;
}

.status-card p {
  margin-bottom: 12px;
  font-size: 0.88rem;
}

.status-pill {
  font-weight: 800;
}

.status-pill-orga {
  color: #b45309;
}

.status-pill-sl {
  color: #1d4ed8;
}

.status-pill-approved {
  color: #15803d;
}

.status-pill-rejected {
  color: #b91c1c;
}

.status-owner {
  color: var(--muted);
  font-size: 0.78rem;
}

.status-date {
  margin-top: -4px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 750;
}

.request-details {
  margin: 10px 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.request-details summary {
  cursor: pointer;
  padding: 10px 12px;
  font-size: 0.82rem;
  font-weight: 850;
}

.request-details dl {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0 12px 12px;
}

.request-details div {
  display: grid;
  gap: 2px;
}

.request-details dt {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
}

.request-details dd {
  margin: 0;
  overflow-wrap: anywhere;
  font-size: 0.84rem;
}

.request-details dd p {
  margin: 0 0 8px;
}

.request-details a {
  color: var(--accent);
  font-weight: 800;
}

.attachment-links {
  display: grid;
  gap: 4px;
  margin: 0;
  padding-left: 18px;
}

.progress {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(34px, 1fr));
  gap: 5px;
}

.progress span {
  height: 7px;
  border-radius: 999px;
  background: var(--line);
}

.progress span.done {
  background: var(--good);
}

.progress.progress-approved span.done {
  background: #15803d;
}

.progress.progress-rejected span.done {
  background: #b91c1c;
}

.action-note {
  display: grid;
  gap: 6px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
}

.action-note textarea {
  min-height: 74px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  padding: 10px;
  font: inherit;
  font-weight: 500;
}

.status-actions {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.mini-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--ink);
  padding: 0 10px;
  font-size: 0.8rem;
  font-weight: 850;
}

.mini-button.danger {
  border-color: color-mix(in srgb, #b91c1c 45%, var(--line));
  color: #b91c1c;
}

.primary-button.is-pending,
.secondary-button.is-pending,
.mini-button.is-pending {
  border-color: var(--brand);
  background: var(--brand);
  color: #fff;
  opacity: 1;
}

.primary-button.is-pending::before,
.secondary-button.is-pending::before,
.mini-button.is-pending::before {
  content: "";
  width: 12px;
  height: 12px;
  margin-right: 7px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 999px;
  animation: spin 700ms linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.empty,
.import-result {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  max-width: min(360px, calc(100vw - 36px));
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--ink);
  color: var(--surface);
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 880px) {
  .hero-panel,
  .workspace,
  .routing-card,
  .login-panel,
  .class-record-layout,
  .year-rollover-form,
  .student-summary {
    grid-template-columns: 1fr;
  }

  .quick-stats,
  .status-board,
  .status-filters,
  .status-year-cards,
  .orga-activity-list {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 620px) {
  html,
  body {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
  }

  .app-shell {
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: 12px 12px 24px;
  }

  .topbar {
    grid-template-columns: auto 1fr auto;
    gap: 8px;
    min-width: 0;
  }

  .session-chip {
    grid-column: 1 / -1;
    max-width: 100%;
  }

  .brand-mark {
    width: 42px;
    height: 38px;
  }

  .brand-mark svg {
    width: 40px;
    height: 34px;
  }

  h1 {
    font-size: 1.1rem;
  }

  h2 {
    font-size: 1.45rem;
  }

  .eyebrow,
  .section-kicker {
    font-size: 0.66rem;
  }

  .hero-panel {
    gap: 14px;
    padding: 16px;
    border-radius: 10px;
  }

  .hero-panel h2 {
    font-size: 1.65rem;
    line-height: 1.12;
  }

  .hero-panel p {
    font-size: 1rem;
    line-height: 1.42;
  }

  .quick-stats,
  .status-board,
  .status-filters,
  .status-year-cards,
  .orga-activity-list,
  .field-grid,
  .nachschreiber-appointment-form,
  .nachschreiber-appointment-base,
  .nachschreiber-appointment-row,
  .role-add,
  .rollover-row {
    grid-template-columns: 1fr;
  }

  .status-board,
  .status-year-cards,
  .status-board.nachschreiber-mode,
  .status-board.nachschreiber-mode .status-year-cards,
  .workspace,
  .workspace.single-form,
  .hero-panel,
  .status-section,
  .form-panel,
  .request-panel {
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }

  .quick-stats {
    gap: 8px;
  }

  .area-tabs {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: stretch;
    overflow: visible;
  }

  .area-tab.primary,
  .area-menu-group {
    min-width: 0;
  }

  .area-tab.primary,
  .area-menu-summary {
    min-height: 52px;
    padding: 0 10px;
    text-align: center;
    white-space: normal;
    line-height: 1.15;
  }

  .area-menu-group {
    display: grid;
    grid-column: 1 / -1;
    position: static;
  }

  .area-menu-group::after {
    content: none;
  }

  .area-menu-summary {
    width: 100%;
  }

  .area-menu-dropdown {
    position: static;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    margin-top: 6px;
    border-radius: 8px;
    box-shadow: none;
    opacity: 1;
    pointer-events: auto;
    transform: none;
  }

  .area-menu-group:not(.menu-open):not(:focus-within) .area-menu-dropdown {
    display: none;
  }

  .area-menu-group:focus-within:not(.menu-open) .area-menu-dropdown {
    display: none;
  }

  .area-menu-dropdown .area-tab {
    width: 100%;
    justify-content: center;
    min-height: 46px;
    padding: 0 10px;
    text-align: center;
    white-space: normal;
  }

  .orga-year-list {
    padding-left: 0;
  }

  .panel-heading,
  .form-header,
  .form-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .primary-button,
  .secondary-button,
  .nachschreiber-appointment-form .mini-button {
    width: 100%;
  }

  .nachschreiber-appointment-item {
    align-items: stretch;
    flex-direction: column;
  }
}
