/* ═══════════════════════════════════════════════════════════════════
   office-ui.css — Design-Fundament fürs Office-Cockpit (Welle 0, 03.07.2026)
   Ziel: kein Seiten-H-Scroll, Buttons ohne Textüberlauf, konsistente
   Tabellen/Chips/Toolbars. REIN ADDITIV: neue .ui-*-Klassen, dockt an die
   bestehenden --jk-*-Tokens an, überschreibt NICHTS Bestehendes.
   Anwendung erfolgt flächenweise (Welle 1: Schülerliste, Welle 2: Akte …).
   ═══════════════════════════════════════════════════════════════════ */

/* ─── Buttons: Text bricht NIE mehr aus dem Knopf ─── */
body[data-page="office"] .ui-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 14px;
  min-height: 38px;
  border-radius: 10px;
  border: 1px solid var(--jk-border);
  background: rgba(255, 255, 255, 0.05);
  color: var(--jk-text);
  font: 600 0.84rem/1.25 var(--jk-font-body);
  cursor: pointer;
  text-align: center;
  white-space: normal;          /* lange deutsche Labels: umbrechen statt überlaufen */
  overflow-wrap: anywhere;
  max-width: 100%;
  transition: background 0.15s, border-color 0.15s, transform 0.05s;
}
body[data-page="office"] .ui-btn:hover { background: rgba(255,255,255,0.09); color: var(--jk-white); }
body[data-page="office"] .ui-btn:active { transform: translateY(1px); }
body[data-page="office"] .ui-btn:disabled { opacity: 0.5; cursor: default; }

body[data-page="office"] .ui-btn--primary {
  background: linear-gradient(135deg, var(--jk-pink), #c91074);
  border-color: transparent;
  color: #fff;
}
body[data-page="office"] .ui-btn--primary:hover { filter: brightness(1.08); color: #fff; }
body[data-page="office"] .ui-btn--danger {
  background: rgba(220, 38, 38, 0.12);
  border-color: rgba(220, 38, 38, 0.45);
  color: #fca5a5;
}
body[data-page="office"] .ui-btn--ghost { background: transparent; }
body[data-page="office"] .ui-btn--sm {
  padding: 5px 10px;
  min-height: 30px;
  font-size: 0.78rem;
  border-radius: 8px;
}
/* Icon-only-Knopf (für Aktionen in Tabellenzeilen) */
body[data-page="office"] .ui-btn--icon {
  padding: 5px 8px;
  min-height: 30px;
  min-width: 32px;
  font-size: 0.9rem;
  line-height: 1;
}

/* Button-Leisten: umbrechen statt quetschen */
body[data-page="office"] .ui-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

/* ─── Toolbars (Suche/Filter/Sortierung in einer umbruchfähigen Zeile) ─── */
body[data-page="office"] .ui-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
body[data-page="office"] .ui-toolbar > input[type="search"],
body[data-page="office"] .ui-toolbar > input[type="text"] {
  flex: 1 1 160px;
  min-width: 0;
}
body[data-page="office"] .ui-toolbar > select { flex: 0 1 auto; min-width: 0; max-width: 100%; }

/* ─── Tabellen: scrollen im eigenen Kasten, nie die Seite ─── */
body[data-page="office"] .ui-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  max-width: 100%;
  border: 1px solid var(--jk-border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.02);
}
body[data-page="office"] .ui-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.84rem;
}
body[data-page="office"] .ui-table th {
  text-align: left;
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--jk-text-muted);
  padding: 10px 12px;
  border-bottom: 1px solid var(--jk-border);
  white-space: nowrap;
  background: rgba(255, 255, 255, 0.03);
}
body[data-page="office"] .ui-table td {
  padding: 9px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  vertical-align: top;
}
body[data-page="office"] .ui-table tbody tr:last-child td { border-bottom: none; }
body[data-page="office"] .ui-table tbody tr:hover td { background: rgba(231, 17, 131, 0.05); }
body[data-page="office"] .ui-table .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
/* Zweizeilige Zelle: Hauptinfo + kleine Nebeninfo (spart Spalten) */
body[data-page="office"] .ui-cell-sub {
  display: block;
  font-size: 0.74rem;
  color: var(--jk-text-muted);
  margin-top: 2px;
}
/* Sticky-Header für lange Tabellen im Scroll-Kasten */
body[data-page="office"] .ui-table--sticky th { position: sticky; top: 0; z-index: 1; }

/* ─── Chips & Status-Badges ─── */
body[data-page="office"] .ui-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.3px;
  background: rgba(255, 255, 255, 0.07);
  color: var(--jk-text);
  border: 1px solid transparent;
  white-space: nowrap;
}
body[data-page="office"] .ui-chip--pink   { background: rgba(231,17,131,0.14);  color: #ff7ab8; }
body[data-page="office"] .ui-chip--cyan   { background: rgba(0,212,255,0.12);   color: #7fe3ff; }
body[data-page="office"] .ui-chip--green  { background: rgba(57,255,122,0.12);  color: #7dffab; }
body[data-page="office"] .ui-chip--yellow { background: rgba(255,212,0,0.12);   color: #ffe27a; }
body[data-page="office"] .ui-chip--red    { background: rgba(220,38,38,0.14);   color: #fca5a5; }

/* ─── Karten & Leerzustände ─── */
body[data-page="office"] .ui-card {
  background: linear-gradient(180deg, rgba(255,255,255,0.035), rgba(255,255,255,0.02));
  border: 1px solid var(--jk-border);
  border-radius: 14px;
  padding: 16px;
}
body[data-page="office"] .ui-empty {
  padding: 34px 20px;
  text-align: center;
  color: var(--jk-text-muted);
  font-size: 0.88rem;
}

/* ─── Formular-Raster (Welle 3: Modals/Stammdaten) ─── */
body[data-page="office"] .ui-form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px 14px;
}
body[data-page="office"] .ui-form-grid label { display: block; min-width: 0; }
/* Welle 3 Teil 2 (05.07.): Felder im Raster stapeln (Label über Feld) + volle
   Breite via .span-2. Trägt Stammdaten- und Neuer-Schüler-Formular. */
body[data-page="office"] .ui-form-grid > div {
  display: flex; flex-direction: column; gap: 6px; min-width: 0;
}
body[data-page="office"] .ui-form-grid .span-2 { grid-column: 1 / -1; }

/* Sektionskopf in Formularen — Dark-tauglich (ersetzt hartes #475569). */
body[data-page="office"] .form-section-head {
  margin: 16px 0 8px;
  font-size: 12px; font-weight: 700;
  letter-spacing: .6px; text-transform: uppercase;
  color: var(--jk-text-muted);
}
body[data-page="office"] .form-section-head:first-child { margin-top: 0; }

/* Einheitliche Formular-Modals: gleiche Breite; Body scrollt, Kopf + Fuß
   bleiben stehen (Sticky-Footer über Flex, nicht position:sticky). */
body[data-page="office"] #new-student-modal .modal-card,
body[data-page="office"] #student-modal .modal-card { max-width: 640px; }
body[data-page="office"] #new-student-modal .modal-body,
body[data-page="office"] #student-modal .modal-body { flex: 1 1 auto; min-height: 0; }

/* ═══ Welle 1 — Schülerliste ═══ */

/* Kern-Fix gegen Seiten-H-Scroll: minmax(0,1fr) statt 1fr — breite Inhalte
   (Tabellen in der Akte) können das Grid nicht mehr aufsprengen. */
body[data-page="office"] .students-layout {
  grid-template-columns: minmax(380px, 440px) minmax(0, 1fr);
}
body[data-page="office"] #panel-students .ui-toolbar > input[type="search"] {
  min-width: 320px;
  min-height: 44px;
  font-size: 0.94rem;
}
body[data-page="office"] .students-detail {
  min-width: 0;
  scroll-margin-top: 190px;
  overflow-x: auto; /* Übergangslösung Welle 1: Akte scrollt ggf. im Kasten,
                       nie die Seite. Welle 2 baut die Tabellen selbst um. */
}

/* Listenzeilen als Karten: Initialen-Punkt, Name + Chips, Nebenzeile */
body[data-page="office"] .students-list li[data-sid] {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 9px 10px;
}
body[data-page="office"] .stu-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font: 800 0.72rem/1 var(--jk-font-body);
  letter-spacing: 0.5px;
  color: #fff;
  background: linear-gradient(135deg, rgba(231,17,131,0.75), rgba(0,212,255,0.55));
  flex: none;
}
body[data-page="office"] .stu-main { min-width: 0; }
body[data-page="office"] .stu-name-row {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}
body[data-page="office"] .stu-name-row strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
body[data-page="office"] .stu-sub {
  display: block;
  color: var(--jk-text-muted);
  font-size: 0.74rem;
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
body[data-page="office"] .students-list .ui-chip { padding: 1px 7px; font-size: 0.64rem; }

/* Kopf über der Liste: Titelzeile mit Zähler */
body[data-page="office"] .students-count {
  color: var(--jk-text-muted);
  font-size: 0.74rem;
  padding: 6px 2px 2px;
}

/* Zurück-Leiste im Detail — nur im schmalen Ein-Spalten-Modus sichtbar */
body[data-page="office"] .students-back { display: none; margin-bottom: 10px; }

body[data-page="office"] .topbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-rows: auto 44px;
  gap: 10px 20px;
  align-items: center;
}
body[data-page="office"] .topbar-title { grid-column: 1; grid-row: 1; }
body[data-page="office"] .topbar-actions { grid-column: 2; grid-row: 1; justify-self: end; }
body[data-page="office"] .office-nav-mode {
  display: inline-flex;
  flex: none;
  min-height: 36px;
  padding: 3px;
  border: 1px solid var(--jk-border);
  border-radius: 8px;
  background: var(--surface, rgba(255,255,255,.025));
}
body[data-page="office"] .office-nav-mode button {
  min-height: 28px;
  padding: 4px 9px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--jk-text-muted);
  font: inherit;
  font-size: .72rem;
  font-weight: 700;
  cursor: pointer;
}
body[data-page="office"] .office-nav-mode button[aria-pressed="true"] {
  background: var(--jk-purple, #635bff);
  color: #fff;
}
body[data-page="office"] .office-global-search {
  grid-column: 1 / -1;
  grid-row: 2;
  width: 100%;
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  border: 1px solid var(--jk-border);
  border-radius: 8px;
  background: var(--surface-2, rgba(255,255,255,.04));
  color: var(--jk-text-muted);
  font: inherit;
  text-align: left;
  cursor: text;
}
body[data-page="office"] .office-global-search:hover,
body[data-page="office"] .office-global-search:focus-visible {
  border-color: var(--jk-cyan);
  color: var(--jk-text);
  outline: none;
}
body[data-page="office"] .office-global-search-icon { color: var(--jk-cyan); font-size: 1.25rem; }
body[data-page="office"] .office-tabs { top: 123px; }

body[data-page="office"] .dashboard-quicklinks {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 8px;
  margin: 10px 0 2px;
}
body[data-page="office"] .dashboard-quicklink {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--jk-border);
  border-radius: 8px;
  background: var(--surface, rgba(255,255,255,.025));
  color: inherit;
  text-decoration: none;
}
body[data-page="office"] .dashboard-quicklink:hover { border-color: var(--jk-cyan); }
body[data-page="office"] .dashboard-quicklink-icon { flex: none; font-size: 1rem; }
body[data-page="office"] .dashboard-quicklink strong,
body[data-page="office"] .dashboard-quicklink small { display: block; }
body[data-page="office"] .dashboard-quicklink small { margin-top: 2px; color: var(--jk-text-muted); font-size: .72rem; }

body[data-page="office"] .dashboard-kpi-button {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
  color: inherit;
  cursor: pointer;
}
body[data-page="office"] .dash-queue-row {
  width: 100%;
  min-height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 2px;
  border: 0;
  border-bottom: 1px solid var(--jk-border);
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
}
body[data-page="office"] .dash-queue-row > span:first-child { min-width: 0; }
body[data-page="office"] .dash-queue-row strong,
body[data-page="office"] .dash-queue-row small { display: block; }
body[data-page="office"] .dash-queue-row small,
body[data-page="office"] .dash-simple-row small { color: var(--jk-text-muted); margin-top: 2px; }
body[data-page="office"] .dash-simple-row { padding: 8px 0; border-bottom: 1px solid var(--jk-border); }
body[data-page="office"] .dash-simple-row > span { margin-left: 8px; }
body[data-page="office"] .dash-simple-row small { display: block; }

body[data-page="office"] .payroll-period-state,
body[data-page="office"] .payroll-warnings { margin: 10px 0; }
body[data-page="office"] .payroll-state-line {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--jk-border);
  border-radius: 8px;
}
body[data-page="office"] .payroll-state-line strong { flex: none; }
body[data-page="office"] .payroll-state-line span { color: var(--jk-text-muted); }
body[data-page="office"] .payroll-state-line.state-approved { border-color: rgba(0, 212, 255, 0.4); }
body[data-page="office"] .payroll-state-line.state-locked { border-color: rgba(76, 219, 106, 0.45); }
body[data-page="office"] #payroll-lock-btn:disabled { opacity: .45; cursor: not-allowed; }
body[data-page="office"] .payroll-warning-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 8px; }
body[data-page="office"] .payroll-warning { padding: 10px 12px; border: 1px solid var(--jk-border); border-radius: 8px; }
body[data-page="office"] .payroll-warning strong,
body[data-page="office"] .payroll-warning span,
body[data-page="office"] .payroll-warning small { display: block; }
body[data-page="office"] .payroll-warning span { margin-top: 3px; color: var(--jk-text-muted); font-size: 0.76rem; }
body[data-page="office"] .payroll-warning small { margin-top: 7px; color: var(--jk-text); line-height: 1.45; }
body[data-page="office"] .payroll-warning.severity-high { border-color: rgba(239, 68, 68, 0.6); }
body[data-page="office"] .payroll-warning.severity-medium { border-color: rgba(245, 158, 11, 0.55); }
body[data-page="office"] .payroll-check-ok { color: var(--jk-green); padding: 8px 0; }
body[data-page="office"] .payroll-change-alert { display: grid; gap: 4px; margin-top: 8px; padding: 10px 12px; border: 1px solid rgba(245, 158, 11, 0.6); border-radius: 8px; }
body[data-page="office"] .payroll-change-alert span { color: var(--jk-text-muted); font-size: 0.76rem; }
body[data-page="office"] .payroll-row-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 4px; }
body[data-page="office"] .payroll-detail-summary { margin-bottom: 10px; color: var(--jk-text-muted); }
body[data-page="office"] .payroll-detail-table { min-width: 920px; }
body[data-page="office"] .payroll-source-row { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; border-bottom: 1px solid var(--jk-border); }
body[data-page="office"] .payroll-readiness { padding: 3px 8px; border-radius: 6px; font-size: 0.7rem; font-weight: 800; }
body[data-page="office"] .payroll-readiness.readiness-red { color: #fecaca; background: rgba(239,68,68,.16); }
body[data-page="office"] .payroll-readiness.readiness-yellow { color: #fde68a; background: rgba(245,158,11,.16); }
body[data-page="office"] .payroll-readiness.readiness-green { color: #bbf7d0; background: rgba(34,197,94,.16); }
body[data-page="office"] .payroll-cleanup-summary { display: flex; justify-content: space-between; gap: 12px; padding: 10px 12px; border: 1px solid var(--jk-border); border-radius: 8px; }
body[data-page="office"] .payroll-cleanup-summary span { color: var(--jk-text-muted); }
body[data-page="office"] .payroll-cleanup-table { min-width: 860px; }
body[data-page="office"] .payroll-cleanup-table select { min-width: 250px; }
body[data-page="office"] .payroll-confidence-exact { color: var(--jk-green); }
body[data-page="office"] .payroll-cleanup-list { display: grid; gap: 6px; }
body[data-page="office"] .payroll-cleanup-check { display: flex; gap: 10px; align-items: flex-start; padding: 9px 10px; border: 1px solid var(--jk-border); border-radius: 8px; }
body[data-page="office"] .payroll-cleanup-check span,
body[data-page="office"] .payroll-cleanup-check small { display: block; }
body[data-page="office"] .payroll-cleanup-check small { color: var(--jk-text-muted); margin-top: 2px; }
body[data-page="office"] .tuv-followup-summary { display: flex; align-items: stretch; gap: 8px; flex-wrap: wrap; margin: 8px 0 14px; }
body[data-page="office"] .tuv-followup-summary > div { min-width: 150px; padding: 8px 10px; border: 1px solid var(--jk-border); border-radius: 8px; }
body[data-page="office"] .tuv-followup-summary strong,
body[data-page="office"] .tuv-followup-summary span { display: block; }
body[data-page="office"] .tuv-followup-summary span { color: var(--jk-text-muted); font-size: .72rem; }
body[data-page="office"] .tuv-followup-items { display: grid; margin: 0 0 14px; border-top: 1px solid var(--jk-border); }
body[data-page="office"] .tuv-followup-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 2px; border-bottom: 1px solid var(--jk-border); }
body[data-page="office"] .tuv-followup-row strong,
body[data-page="office"] .tuv-followup-row span { display: block; }
body[data-page="office"] .tuv-followup-row span { margin-top: 2px; color: var(--jk-text-muted); font-size: .74rem; }
body[data-page="office"] .tuv-followup-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
@media (max-width: 700px) {
  body[data-page="office"] .tuv-followup-row { align-items: stretch; flex-direction: column; }
  body[data-page="office"] .tuv-followup-actions { justify-content: flex-start; }
}

/* Schmale Fenster: Liste ODER Akte, nie gequetscht nebeneinander */
@media (max-width: 1100px) {
  body[data-page="office"] .students-layout { grid-template-columns: minmax(0, 1fr); }
  body[data-page="office"] .students-layout.show-detail .students-sidebar { display: none; }
  body[data-page="office"] .students-layout:not(.show-detail) .students-detail { display: none; }
  body[data-page="office"] .students-layout.show-detail .students-back { display: inline-flex; }
}

/* ═══ Welle 2 — Schüler-Akte ═══ */

body[data-page="office"] .student-file-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 0.75fr);
  gap: 18px;
  align-items: stretch;
  padding: 0 0 18px;
  border-bottom: 1px solid var(--jk-border);
  background: transparent;
}
body[data-page="office"] .student-file-identity { min-width: 0; }
body[data-page="office"] .student-file-identity h2 {
  margin: 0;
  font: 700 1.5rem/1.3 var(--jk-font-body);
  text-transform: none;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}
body[data-page="office"] .student-file-tags { margin-top: 8px; }
body[data-page="office"] .student-file-balances {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-left: 1px solid var(--jk-border);
}
body[data-page="office"] .student-file-balances > div {
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 8px 14px;
  border-right: 1px solid var(--jk-border);
}
body[data-page="office"] .student-file-balances > div:last-child { border-right: 0; }
body[data-page="office"] .student-file-balances span {
  color: var(--jk-text-muted);
  font-size: 0.75rem;
  letter-spacing: 0;
}
body[data-page="office"] .student-file-balances strong {
  margin-top: 5px;
  font-size: 1.2rem;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}
body[data-page="office"] .student-file-balances .net strong { color: var(--jk-cyan); }

body[data-page="office"] #student-subtabs {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 14px;
  padding: 12px 0 10px;
  overflow: visible;
}
body[data-page="office"] .student-tab-group {
  display: flex;
  gap: 3px;
  position: relative;
  padding-top: 15px;
  flex: none;
}
body[data-page="office"] .student-tab-label {
  position: absolute;
  top: 0;
  left: 8px;
  color: var(--jk-text-muted);
  font-size: 0.57rem;
  font-weight: 800;
  text-transform: uppercase;
}
body[data-page="office"] .student-overview { margin-top: 16px; }
body[data-page="office"] .student-overview-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border: 1px solid var(--jk-border);
  border-radius: 8px;
}
body[data-page="office"] .student-overview-grid > div { padding: 14px; border-right: 1px solid var(--jk-border); }
body[data-page="office"] .student-overview-grid > div:last-child { border-right: 0; }
body[data-page="office"] .student-overview-grid span,
body[data-page="office"] .student-overview-grid small { display: block; color: var(--jk-text-muted); }
body[data-page="office"] .student-overview-grid strong { display: block; margin-top: 4px; font-size: 1.2rem; }
body[data-page="office"] .student-overview-grid small { font-size: 0.65rem; margin-top: 2px; }
body[data-page="office"] .student-overview-details {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border: 1px solid var(--jk-border);
  border-top: 0;
  border-radius: 0 0 8px 8px;
}
body[data-page="office"] .student-overview-details section { min-width: 0; padding: 14px; border-right: 1px solid var(--jk-border); }
body[data-page="office"] .student-overview-details section:last-child { border-right: 0; }
body[data-page="office"] .student-overview-details h4 { margin: 0 0 9px; font-size: .78rem; }
body[data-page="office"] .student-overview-details dl { display: grid; grid-template-columns: 78px minmax(0, 1fr); gap: 6px 8px; margin: 0; }
body[data-page="office"] .student-overview-details dt { color: var(--jk-text-muted); font-size: .69rem; }
body[data-page="office"] .student-overview-details dd { min-width: 0; margin: 0; overflow-wrap: anywhere; font-size: .76rem; }
body[data-page="office"] .student-overview-details a { color: var(--jk-cyan); }
body[data-page="office"] .student-overview-details section > strong,
body[data-page="office"] .student-overview-details section > small { display: block; }
body[data-page="office"] .student-overview-details section > small { margin-top: 4px; color: var(--jk-text-muted); }

@media (max-width: 980px) {
  body[data-page="office"] .shell { display: block; }
  body[data-page="office"] .sidebar {
    position: static;
    width: 100%;
    height: auto;
    max-height: none;
    padding: 10px 14px;
    overflow: hidden;
    border-right: 0;
    border-bottom: 1px solid var(--jk-border);
  }
  body[data-page="office"] .sidebar .brand { padding: 2px 4px 10px; }
  body[data-page="office"] .sidebar-group {
    display: flex;
    gap: 4px;
    padding-top: 8px;
    overflow-x: auto;
    overscroll-behavior-x: contain;
  }
  body[data-page="office"] .sidebar-label { display: none; }
  body[data-page="office"] .sidebar .nav-link { flex: none; min-height: 36px; padding: 8px 10px; }
  body[data-page="office"] .main { width: 100%; margin-left: 0; padding: 0; }
  body[data-page="office"] .topbar { position: static; }
  body[data-page="office"] .office-tabs { top: 0; }
}

@media (max-width: 700px) {
  body[data-page="office"] .topbar {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto;
    padding: 12px 14px;
  }
  body[data-page="office"] .topbar-title,
  body[data-page="office"] .topbar-actions,
  body[data-page="office"] .office-global-search {
    grid-column: 1;
    grid-row: auto;
  }
  body[data-page="office"] .topbar-actions {
    width: 100%;
    justify-self: stretch;
    justify-content: flex-start;
    flex-wrap: wrap;
  }
  body[data-page="office"] .office-nav-mode { order: -1; }
  body[data-page="office"] #office-calendar-export { display: none; }
  body[data-page="office"] .office-tabs { flex-wrap: wrap; overflow: visible; }
  body[data-page="office"] .office-panel { padding-left: 14px; padding-right: 14px; }
  body[data-page="office"] #panel-students .ui-toolbar > input[type="search"] { min-width: 0; }
}

@media (max-width: 850px) {
  body[data-page="office"] .student-file-hero { grid-template-columns: minmax(0, 1fr); }
  body[data-page="office"] .student-file-balances { border-left: 0; border-top: 1px solid var(--jk-border); }
  body[data-page="office"] .student-overview-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  body[data-page="office"] .student-overview-grid > div:nth-child(2) { border-right: 0; }
  body[data-page="office"] .student-overview-grid > div:nth-child(-n+2) { border-bottom: 1px solid var(--jk-border); }
  body[data-page="office"] .student-overview-details { grid-template-columns: 1fr; }
  body[data-page="office"] .student-overview-details section { border-right: 0; border-bottom: 1px solid var(--jk-border); }
  body[data-page="office"] .student-overview-details section:last-child { border-bottom: 0; }
}

/* Kopfbereich: Name + Chips + Status-Badges + Saldo-Karten immer sichtbar */
body[data-page="office"] .acc-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
}
body[data-page="office"] .acc-head h2 {
  margin: 0;
  font-size: 1.35rem;
  letter-spacing: 0.4px;
}
body[data-page="office"] .acc-status-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  align-items: center;
  margin-top: 8px;
  min-height: 20px;
}
body[data-page="office"] .acc-head-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  margin-top: 12px;
}
body[data-page="office"] .acc-head-cards .acc-card { margin: 0; }

/* Aktionsleiste der Akte: wenige sichtbare Aktionen + „⋯ Aktionen"-Menü */
body[data-page="office"] .acc-actionbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-top: 14px;
  position: relative;
}
body[data-page="office"] .acc-actionbar .ui-btn,
body[data-page="office"] #student-subtabs button {
  min-height: 44px;
  border-radius: 6px;
  letter-spacing: 0;
}

/* „Nächste Schritte"-Leiste (Codex-Batch 04.07.): zustandsabhängige Sofort-
   Aktionen ganz oben in der Akte. Erscheint NUR, wenn wirklich etwas ansteht
   (sonst .hidden). Macht die Akte zum Cockpit statt zur Karteikarte. */
body[data-page="office"] .acc-nextbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin: 14px 0 2px;
  padding: 10px 14px;
  border-left: 3px solid var(--jk-cyan);
  background: transparent;
}
body[data-page="office"] .acc-nextbar.hidden { display: none; }
body[data-page="office"] .acc-nextbar-label {
  font: 800 0.64rem/1 var(--jk-font-body);
  letter-spacing: 0;
  text-transform: uppercase;
  color: var(--jk-pink);
  margin-right: 2px;
}
body[data-page="office"] .ui-btn--warn {
  background: rgba(245, 158, 11, 0.16);
  border-color: rgba(245, 158, 11, 0.45);
  color: #fbbf24;
}
body[data-page="office"] .ui-btn--warn:hover { background: rgba(245, 158, 11, 0.26); color: #fde68a; }

/* Dropdown-Menü (⋯ Aktionen) */
body[data-page="office"] .ui-menu-wrap { position: relative; display: inline-flex; }
body[data-page="office"] .ui-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 60;
  min-width: 265px;
  max-width: 92vw;
  max-height: 70vh;
  overflow-y: auto;
  padding: 8px;
  border-radius: 14px;
  border: 1px solid var(--jk-border);
  background: linear-gradient(180deg, rgba(18, 22, 30, 0.99), rgba(12, 15, 22, 0.99));
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.5);
  display: none;
}
body[data-page="office"] .ui-menu.open { display: block; }
body[data-page="office"] .ui-menu .ui-menu-label {
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 1.6px;
  text-transform: uppercase;
  color: var(--jk-text-muted);
  padding: 8px 10px 4px;
}
body[data-page="office"] .ui-menu .ghost-button,
body[data-page="office"] .ui-menu a.ghost-button,
body[data-page="office"] .ui-menu .ui-btn {
  display: flex;
  width: 100%;
  justify-content: flex-start;
  text-align: left;
  border: none;
  background: transparent;
  padding: 8px 10px;
  border-radius: 9px;
  font-size: 0.84rem;
  white-space: normal;
}
body[data-page="office"] .ui-menu .ghost-button:hover,
body[data-page="office"] .ui-menu .ui-btn:hover {
  background: rgba(231, 17, 131, 0.12);
}
/* Kritische Aktionen im Menü optisch als Warnung abheben (Codex-Batch 04.07.:
   Archivieren, DSGVO) — damit sie nicht versehentlich wie Routine wirken. */
body[data-page="office"] .ui-menu .ghost-button.danger-item { color: #f87171; }
body[data-page="office"] .ui-menu .ghost-button.danger-item:hover {
  background: rgba(239, 68, 68, 0.14);
  color: #fca5a5;
}

/* Sub-Reiter der Akte: moderne Pills, UMBRECHEN statt seitlich scrollen
   (Owner 04.07.: „nach rechts/links scrollbar verwirrt das Büro"). */
body[data-page="office"] .subtabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 16px;
  padding-bottom: 2px;
  border-bottom: 1px solid var(--jk-border);
}
body[data-page="office"] .subtabs .subtab {
  flex: none;
  border: none;
  background: transparent;
  color: var(--jk-text-muted);
  font: 600 0.82rem/1 var(--jk-font-body);
  padding: 10px 12px;
  border-radius: 9px 9px 0 0;
  cursor: pointer;
  white-space: nowrap;
  border-bottom: 2px solid transparent;
  transition: color 0.15s, background 0.15s;
}
body[data-page="office"] .subtabs .subtab:hover { color: var(--jk-white); background: rgba(255,255,255,0.04); }
body[data-page="office"] .subtabs .subtab.active {
  color: var(--jk-white);
  border-bottom-color: var(--jk-pink);
  background: rgba(231, 17, 131, 0.08);
}

/* Kontrollierter Owner-Entscheidungsblock fuer Zahlungs-Klaerfaelle. */
body[data-page="office"] .task-modal-overlay { z-index: 9999; }
body[data-page="office"] .task-modal-card {
  max-width: 720px;
  border-radius: 8px;
}
body[data-page="office"] .task-modal-head { align-items: flex-start; }
body[data-page="office"] .task-modal-priority,
body[data-page="office"] .payment-help-eyebrow {
  margin-bottom: 5px;
  color: #f59e0b;
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
}
body[data-page="office"] .task-modal-action {
  color: var(--jk-white);
  font-size: 1rem;
  font-weight: 750;
}
body[data-page="office"] .task-modal-meta {
  margin: 5px 0 16px;
  color: var(--jk-text-muted);
  font-size: 0.82rem;
}
body[data-page="office"] .task-modal-todo {
  margin-bottom: 14px;
  padding: 10px 12px;
  border-left: 3px solid var(--jk-cyan);
  background: rgba(0, 224, 255, 0.07);
}
body[data-page="office"] .task-modal-note-label {
  display: block;
  margin-bottom: 5px;
  color: var(--jk-text-muted);
  font-size: 0.76rem;
  font-weight: 700;
}
body[data-page="office"] .task-modal-note {
  box-sizing: border-box;
  width: 100%;
  padding: 9px 10px;
  border: 1px solid var(--jk-border);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--jk-text);
  font: inherit;
}
body[data-page="office"] textarea.task-modal-note { resize: vertical; min-height: 76px; }
body[data-page="office"] .task-modal-foot #task-modal-cancel { margin-left: auto; }
body[data-page="office"] .payment-help-loading,
body[data-page="office"] .payment-help-error,
body[data-page="office"] .payment-help-access {
  display: grid;
  gap: 5px;
  padding: 16px 0;
  color: var(--jk-text-muted);
}
body[data-page="office"] .payment-help-facts {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0;
  margin: 0 0 16px;
  border-block: 1px solid var(--jk-border);
}
body[data-page="office"] .payment-help-facts > div {
  min-width: 0;
  padding: 12px 10px;
  border-right: 1px solid var(--jk-border);
}
body[data-page="office"] .payment-help-facts > div:first-child { padding-left: 0; }
body[data-page="office"] .payment-help-facts > div:last-child { border-right: 0; }
body[data-page="office"] .payment-help-facts span,
body[data-page="office"] .payment-help-facts strong { display: block; }
body[data-page="office"] .payment-help-facts span {
  margin-bottom: 4px;
  color: var(--jk-text-muted);
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
}
body[data-page="office"] .payment-help-facts strong {
  overflow-wrap: anywhere;
  color: var(--jk-white);
  font-size: 0.82rem;
}
body[data-page="office"] .payment-help-ai {
  margin: 0 0 14px;
  padding: 2px 0 2px 13px;
  border-left: 3px solid #f59e0b;
}
body[data-page="office"] .payment-help-ai strong {
  display: block;
  color: var(--jk-text);
  font-size: 0.86rem;
}
body[data-page="office"] .payment-help-ai ul {
  margin: 7px 0;
  padding-left: 18px;
  color: var(--jk-text-muted);
  font-size: 0.8rem;
}
body[data-page="office"] .payment-help-ai p {
  margin: 7px 0 0;
  color: var(--jk-text-muted);
  font-size: 0.8rem;
}
body[data-page="office"] .payment-help-rule-result {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 14px;
  padding: 9px 0;
  border-block: 1px solid rgba(57, 255, 122, 0.24);
  color: var(--jk-green);
  font-size: 0.8rem;
}
body[data-page="office"] .payment-help-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 13px;
}
body[data-page="office"] .payment-help-action-row {
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 6px;
  align-content: start;
  padding: 8px 0 0;
  border-top: 1px solid var(--jk-border);
}
body[data-page="office"] .payment-help-action-row > span {
  color: var(--jk-text-muted);
  font-size: 0.75rem;
  line-height: 1.35;
}
body[data-page="office"] .payment-help-action {
  min-height: 38px;
  padding: 8px 11px;
  border: 1px solid var(--jk-border);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--jk-white);
  font: 700 0.8rem/1.2 var(--jk-font-body);
  text-align: left;
  cursor: pointer;
}
body[data-page="office"] .payment-help-action-row .payment-help-action { width: 100%; }
body[data-page="office"] .payment-help-note-label { margin-top: 12px; }
body[data-page="office"] textarea.payment-help-note { min-height: 42px; }
body[data-page="office"] .payment-help-action-row[data-kind="credit"] .payment-help-action {
  border-color: rgba(57, 255, 122, 0.4);
  color: var(--jk-green);
}
body[data-page="office"] .payment-help-action-row[data-kind="invoice"] .payment-help-action {
  border-color: rgba(0, 224, 255, 0.4);
  color: var(--jk-cyan);
}
body[data-page="office"] .payment-help-action-row[data-kind="return"] .payment-help-action {
  border-color: rgba(245, 158, 11, 0.42);
  color: #fbbf24;
}
body[data-page="office"] .payment-help-action:hover:not(:disabled) { background: rgba(255, 255, 255, 0.1); }
body[data-page="office"] .payment-help-action:disabled { cursor: not-allowed; opacity: 0.42; }
body[data-page="office"] .payment-help-status {
  min-height: 20px;
  margin-top: 9px;
  color: #fbbf24;
  font-size: 0.78rem;
}
@media (max-width: 680px) {
  body[data-page="office"] .payment-help-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  body[data-page="office"] .payment-help-facts > div:nth-child(2) { border-right: 0; }
  body[data-page="office"] .payment-help-facts > div:nth-child(-n+2) { border-bottom: 1px solid var(--jk-border); }
  body[data-page="office"] .payment-help-actions { grid-template-columns: 1fr; }
  body[data-page="office"] .payment-help-action-row { grid-template-rows: auto; gap: 5px; }
}

/* Panels: eigener Scroll-Kasten (fixt ALLE Akte-Tabellen auf einmal) + Tabellen-Polish */
body[data-page="office"] .subtab-panel { overflow-x: auto; min-width: 0; margin-top: 12px; padding-top: 4px; }
body[data-page="office"] .subtab-panel .data-table { width: 100%; border-collapse: collapse; font-size: 0.84rem; }
body[data-page="office"] .subtab-panel .data-table th {
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--jk-text-muted);
  padding: 9px 10px;
  border-bottom: 1px solid var(--jk-border);
  background: rgba(255, 255, 255, 0.03);
  text-align: left;
  white-space: nowrap;
}
body[data-page="office"] .subtab-panel .data-table td {
  padding: 8px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  vertical-align: top;
}
body[data-page="office"] .subtab-panel .data-table tbody tr:hover td { background: rgba(231, 17, 131, 0.05); }
body[data-page="office"] .subtab-panel .data-table .num,
body[data-page="office"] .subtab-panel .data-table td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
/* Buttons in Tabellenzellen: kompakt, ohne Zeilensprengung */
body[data-page="office"] .subtab-panel .data-table .ghost-button,
body[data-page="office"] .subtab-panel .data-table .primary-button {
  padding: 4px 9px;
  font-size: 0.74rem;
  white-space: normal;
}

/* ═══ Welle 3 — Ausbildungs-Fortschritt im Schülerinfo-Popup ═══ */

/* Sektion über die volle Popup-Breite (das Popup ist ein auto-fit-Grid) */
body[data-page="office"] .student-info-popup .tsum-section {
  grid-column: 1 / -1;
  background: linear-gradient(180deg, rgba(231,17,131,0.06), rgba(255,255,255,0.02));
}
body[data-page="office"] .tsum-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
}
body[data-page="office"] .tsum-card {
  border: 1px solid var(--jk-border);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.18);
  padding: 12px 14px;
}
body[data-page="office"] .tsum-card-head {
  font-weight: 800;
  font-size: 0.9rem;
  color: var(--jk-white);
  margin-bottom: 8px;
  letter-spacing: 0.3px;
}
body[data-page="office"] .tsum-group-label {
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: var(--jk-text-muted);
  margin: 10px 0 4px;
}
body[data-page="office"] .tsum-group-label:first-of-type { margin-top: 0; }
body[data-page="office"] .tsum-row {
  display: grid;
  grid-template-columns: minmax(96px, 1.1fr) minmax(48px, 1.4fr) auto;
  align-items: center;
  gap: 9px;
  padding: 3px 0;
}
body[data-page="office"] .tsum-label {
  font-size: 0.8rem;
  color: var(--jk-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
body[data-page="office"] .tsum-bar {
  height: 6px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.09);
  overflow: hidden;
}
body[data-page="office"] .tsum-bar-fill {
  display: block;
  height: 100%;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--jk-pink), #ff7ab8);
}
body[data-page="office"] .tsum-bar-fill.done {
  background: linear-gradient(90deg, #22c55e, #7dffab);
}
body[data-page="office"] .tsum-val {
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
  color: var(--jk-text-muted);
  white-space: nowrap;
  text-align: right;
}
body[data-page="office"] .tsum-val.done { color: #7dffab; font-weight: 700; }
body[data-page="office"] .tsum-exams {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}
body[data-page="office"] .tsum-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 22px;
  align-items: center;
  margin-top: 12px;
  font-size: 0.85rem;
}
body[data-page="office"] .tsum-meta strong { color: var(--jk-text-muted); font-weight: 700; margin-right: 4px; }

/* ═══ Welle 3 Teil 2 — Schülerinfo-Popup: nichts läuft mehr aus dem Kasten ═══ */
/* Owner 04.07.: „Vertrags-Link senden"-Button lief rechts aus dem Popup.
   dd-Inhalte (Buttons/Selects/Text) werden hart auf die Spaltenbreite begrenzt. */
body[data-page="office"] .student-info-popup { min-width: 0; }
body[data-page="office"] .student-info-popup section { min-width: 0; }
body[data-page="office"] .student-info-popup dd { min-width: 0; }
body[data-page="office"] .student-info-popup dd > button,
body[data-page="office"] .student-info-popup dd > .ghost-button,
body[data-page="office"] .student-info-popup dd > a,
body[data-page="office"] .student-info-popup dd > select,
body[data-page="office"] .student-info-popup dd > input {
  max-width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
  box-sizing: border-box;
}
/* dd mit Button + Hilfetext: untereinander statt nebeneinander drängeln */
body[data-page="office"] .student-info-popup dd {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
}
body[data-page="office"] .student-info-popup dd .muted { flex-basis: 100%; }

/* ═══ Welle 4 (06.07.2026) — Politur: Druck, Lade-, Leerzustände ═══ */

/* Lade-Puls: sanftes Atmen statt statischem "Lade …" */
@keyframes ui-loading-pulse { 0%, 100% { opacity: .45; } 50% { opacity: 1; } }
body[data-page="office"] .ui-loading { animation: ui-loading-pulse 1.4s ease-in-out infinite; }
@media (prefers-reduced-motion: reduce) {
  body[data-page="office"] .ui-loading { animation: none; }
}

/* Leerzustände in Akte-Tabellen: zentriert + Luft statt lose linksbündig */
body[data-page="office"] .subtab-panel td.muted {
  text-align: center;
  padding: 18px 12px;
}

/* ── Akte drucken (Muster wie print-weekly-form; Marker setzt der
   "Akte drucken"-Menüpunkt in office-student-file.js). Office ist DARK →
   Druck erzwingt Schwarz-auf-Weiß, App-Chrome und Aktions-Elemente weg. ── */
@media print {
  body.print-student-file * { visibility: hidden !important; }
  body.print-student-file .print-target,
  body.print-student-file .print-target * { visibility: visible !important; }
  body.print-student-file .print-target {
    position: absolute; left: 0; top: 0; width: 100%;
    margin: 0; padding: 0;
    overflow: visible !important;
  }
  /* Dark-Theme → Papier: Farben hart auf schwarz/weiß */
  body.print-student-file .print-target,
  body.print-student-file .print-target * {
    color: #000 !important;
    background: transparent !important;
    box-shadow: none !important;
    border-color: #999 !important;
    text-shadow: none !important;
  }
  /* Interaktives bringt auf Papier nichts */
  body.print-student-file .print-target button,
  body.print-student-file .print-target .ui-btn,
  body.print-student-file .print-target .ghost-button,
  body.print-student-file .print-target .ui-menu,
  body.print-student-file .print-target .acc-nextbar,
  body.print-student-file .print-target .subtabs,
  body.print-student-file .print-target input,
  body.print-student-file .print-target select,
  body.print-student-file .print-target a.ghost-button {
    display: none !important;
  }
  /* Tabellen: sichtbare Linien, kein Abschneiden durch Scroll-Container */
  body.print-student-file .print-target .ui-table-wrap,
  body.print-student-file .print-target .subtab-panel { overflow: visible !important; }
  body.print-student-file .print-target table { width: 100% !important; border-collapse: collapse !important; }
  body.print-student-file .print-target th,
  body.print-student-file .print-target td {
    border-bottom: 1px solid #bbb !important;
    padding: 5px 7px !important;
    white-space: normal !important;
  }
  /* Chips als dezente Rahmen statt Farbe */
  body.print-student-file .print-target .ui-chip,
  body.print-student-file .print-target [class*="chip"] {
    border: 1px solid #999 !important;
    padding: 0 6px !important;
  }
}

.student-list-pages {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 0;
}
.student-list-pages button { min-width: 44px; min-height: 44px; }
#students-list [role="button"]:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: -2px;
}
#admin-modal [data-dialog-error] {
  padding: 12px;
  border: 1px solid currentColor;
  border-radius: 4px;
  overflow-wrap: anywhere;
}
