.readonly-field,
.calculated-field {
    background: #f0f0f0 !important;
    border: 1px solid #bbb !important;
    border-radius: 5px;
    color: #333;
}

td:has(.calculated-field) {
    background: #f0f0f0 !important;
}

.endnote {
    font-weight: bold;
}

.schnitt-feld {
    font-weight: bold;
}

.col-profil {
    width: 70px;
    min-width: 70px;
    max-width: 70px;
}

.col-kompetenz {
    width: 105px;
    min-width: 105px;
    max-width: 105px;
}

.sticky-profil {
    position: sticky;
    left: 360px;
    width: 70px;
    min-width: 70px;
    max-width: 70px;
    background: #f0f0f0 !important;
    z-index: 30;
    box-shadow: 4px 0 6px rgba(0,0,0,0.12);
}

/* Profil-Info ist übernommen: Sticky-Zelle bleibt grau.
   Profilfarbe gehört nur auf das kleine Profil-Feld selbst. */
td.sticky-profil.profil-friseure,
td.sticky-profil.profil-kfz,
td.sticky-profil.profil-elektro,
td.sticky-profil.profil-metall {
    background: #f0f0f0 !important;
}
th.sticky-profil {
    z-index: 45;
}

.profil-field {
    width: 58px;
    height: 40px;
    padding: 5px;
    border: 1px solid #bbb;
    border-radius: 5px;
    box-sizing: border-box;
    font-family: Arial, sans-serif;
    font-size: 12px;
    text-align: center;
    font-weight: bold;
    color: #000;
}

.profil-friseure {
    background: #C27591 !important;
}

.profil-kfz {
    background: #6DCE85 !important;
}

.profil-elektro {
    background-color: #54955C !important;
}

.profil-metall {
    background-color: #6E9EB5 !important;
}

:root {
    --left-profil: 360px;
}

.hk-button {
    cursor: pointer;
    font-weight: bold;
}

.hk-k1 {
    background: #ffffcc !important;
}

.hk-k2 {
    background: #dce6f1 !important;
}

.hk-k3 {
    background: #d9e8c5 !important;
}

.hk-k4 {
    background: #f9d2a6 !important;
}

.hk-k5 {
    background: #f4cccc !important;
}

.hk-button:hover {
    outline: 2px solid #2f6fed;
}

.hk-modal {
    display: none;
    position: fixed;
    z-index: 999999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.45);
}

.hk-modal.is-open {
    display: block !important;
}

.hk-modal-content {
    background: white;
    margin: 30px auto;
    width: fit-content;
    max-width: 520px;
    max-height: calc(100vh - 60px);
    overflow: auto;
    border-radius: 8px;
    padding: 10px;
}

.hk-raster {
    width: 405px !important;
    min-width: 405px !important;
    max-width: 405px !important;
    table-layout: fixed !important;
    border-collapse: collapse;
    margin: 0 auto;
}

.hk-raster th,
.hk-raster td {
    position: static !important;
    border: 1px solid #000;
    padding: 6px;
    font-size: 14px;
    height: auto !important;
    white-space: normal !important;
    box-sizing: border-box;
}

.hk-raster th {
    background: #ffffcc;
    font-size: 20px;
}

.hk-lfs,
.hk-punkte {
    width: 45px !important;
    min-width: 45px !important;
    max-width: 45px !important;
    text-align: center;
    font-weight: bold;
    background: #f7f7f7;
}

.hk-punkte {
    cursor: pointer;
}

.hk-text {
    width: 360px !important;
    min-width: 360px !important;
    max-width: 360px !important;
    background: #ffffcc;
    cursor: pointer;
    line-height: 1.2;
    text-align: center;
}

.hk-text:hover,
.hk-punkte:hover {
    outline: 3px solid #2f6fed;
}

.hk-close {
    float: right;
    background: #777;
}

:root {
    --w-name: 180px;
    --left-vorname: 0px;
    --left-nachname: 180px;
}

header {
    position: sticky;
    top: 0;
    z-index: 50;
    background: white;
    padding: 16px 20px 18px 20px;
    border-bottom: 1px solid #ccc;
}

.header-row {
    display: flex;
    gap: 20px;
    align-items: flex-start;
}

h1 {
    margin: 0 0 8px 0;
}

button {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    height: 35px;
    padding: 0 16px;

    background: #2f6fed;
    color: white;
    border: none;
    border-radius: 6px;
    text-decoration: none;

    font-family: Arial, sans-serif;
    font-size: 11px;
    font-weight: normal;
    line-height: 1;
    box-sizing: border-box;
    vertical-align: middle;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
}

button:hover {
    background: #2458c7;
    color: white;
    text-decoration: none;
}

.status {
    display: inline-block;
    min-width: 230px;
    margin-left: 0;
    font-size: 14px;
    font-weight: 600;
    color: #555;
}

.hinweis-box {
    border: 1px solid #bbb;
    background: #fff8dc;
    padding: 10px 12px;
    border-radius: 6px;
    font-size: 13px;
    line-height: 1.35;
    max-width: 420px;
    text-align: left;
}

.hinweis-box p {
    margin: 0 0 6px 0;
}

.hinweis-box p:last-child {
    margin-bottom: 0;
}

.table-wrapper {
    height: calc(100vh - 175px);
    overflow: auto;
    background: white;
}

table {
    border-collapse: separate;
    border-spacing: 0;
    table-layout: fixed;
    background: white;

    /* wichtig für robuste sticky-spalten:
       die tabelle soll aus den echten spaltenbreiten entstehen
       und nicht künstlich auf eine mindestbreite gestreckt werden. */
    width: max-content;
    min-width: 0;
}

th,
td {
    border-right: 1px solid #ccc;
    border-bottom: 1px solid #ccc;
    padding: 4px;
    vertical-align: middle;
    text-align: center;
    box-sizing: border-box;
    background: white;
}

th:first-child,
td:first-child {
    border-left: 1px solid #ccc;
}

th {
    position: sticky;
    top: 0;
    background: #e9e9e9;
    z-index: 20;
    font-size: 13px;
    line-height: 1.1;
    white-space: normal;
    height: 48px;
}

.head2 th {
    top: 48px;
}

.group-ln {
    background: #dce6f1;
    font-size: 13px;
}

.group-mn {
    background: #e2f0d9;
    font-size: 13px;
}

.group-end {
    background: #fce4d6;
    font-size: 13px;
}

.group-hk {
    background: #f4cccc;
    font-size: 13px;
}

.group-bfk {
    background: #dce6f1;
    font-size: 13px;
}

.group-bpk {
    background: #e2f0d9;
    font-size: 13px;
}

.group-theorie {
    background: #dce6f1;
    font-size: 13px;
}

.group-lfp-mn {
    background: #cfe2f3;
    font-size: 13px;
}

.group-praxis {
    background: #e2f0d9;
    font-size: 13px;
}

.group-lfp-pn {
    background: #d9ead3;
    font-size: 13px;
}

.col-name {
    width: var(--w-name);
    min-width: var(--w-name);
    max-width: var(--w-name);
}

.col-note {
    width: 52px;
}

.col-hk {
    width: 52px;
    min-width: 52px;
    max-width: 52px;
}

.table-nur-hk {
    width: auto !important;
    min-width: 0 !important;
}

.table-nur-hk th,
.table-nur-hk td {
    width: 52px;
    min-width: 52px;
    max-width: 52px;
}

.table-nur-hk .col-name,
.table-nur-hk .sticky-vorname,
.table-nur-hk .sticky-nachname {
    width: var(--w-name);
    min-width: var(--w-name);
    max-width: var(--w-name);
}

.sticky-vorname,
.sticky-nachname {
    position: sticky;
    background: #f0f0f0 !important;
    z-index: 30;
}

.sticky-vorname {
    left: var(--left-vorname);
    width: var(--w-name);
    min-width: var(--w-name);
    max-width: var(--w-name);
}

.sticky-nachname {
    left: var(--left-nachname);
    width: var(--w-name);
    min-width: var(--w-name);
    max-width: var(--w-name);
    box-shadow: 4px 0 6px rgba(0,0,0,0.12);
}

th.sticky-vorname,
th.sticky-nachname {
    z-index: 45;
}

.field {
    height: 40px;
    padding: 5px;
    border: 1px solid #bbb;
    border-radius: 5px;
    box-sizing: border-box;
    font-family: Arial, sans-serif;
    font-size: 14px;
    text-align: center;
}

.name-field {
    width: 165px;
}

.note-field {
    width: 40px;
}

.schnitt-row td {
    background: #f0f0f0 !important;
    font-weight: bold;
}

.schnitt-label {
    text-align: center;
    font-weight: bold;
}

.abgemeldet td {
    background-color: #D9D9D9 !important;
    color: #555;
    text-decoration: line-through;
}

.abgemeldet input {
    background-color: #D9D9D9 !important;
    color: #555;
    text-decoration: line-through !important;
}

.saved {
    color: #238636;
}

.saving {
    color: #b26a00;
}

.error {
    color: #c0392b;
}

.error-field {
    background-color: #f8c7c7 !important;
    border-color: #c0392b !important;
}

.checkbox-cell input {
    width: 20px;
    height: 20px;
}

.status,
.save-status {
  display: inline-block;
  min-width: 230px;
  margin-left: 0;
  font-size: 14px;
  font-weight: 600;
}

.status.saving,
.save-status.saving {
  color: #b91c1c;
}

.status.saved,
.save-status.saved {
  color: #15803d;
}

.status.error,
.save-status.error {
  color: #b91c1c;
}

.header-row {
  display: flex;
  align-items: flex-start;
  gap: 28px;
}

.header-main {
  flex: 0 0 auto;
}

.schuelerdaten-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: nowrap;
  margin-top: 8px;
}
.status,
.save-status {
  display: inline-block;
  min-width: 230px;
  margin-left: 0;
  font-size: 14px;
  font-weight: 600;
}

.schuelerdaten-toolbar .leitung-field {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 11px;
  font-weight: 600;
}

.schuelerdaten-toolbar .leitung-field input {
  width: 145px;
  height: 28px;
  padding: 3px 8px;
  box-sizing: border-box;
  font-size: 13px;
  text-align: center;
}

.hinweis-box {
  align-self: flex-start;
  border: 1px solid #bbb;
  background: #fff8dc;
  padding: 10px 12px;
  border-radius: 6px;
  font-size: 13px;
  line-height: 1.35;
  max-width: 520px;
  text-align: left;
  margin-top: 0;
}

body.schuelerdaten-page header {
  padding-bottom: 10px;
}

body.schuelerdaten-page .subtitle {
  margin-bottom: 0;
}

body.schuelerdaten-page .schuelerdaten-toolbar {
  margin-top: 6px;
}

/* Schlechte Zeugnisnoten bleiben auch in grauen, abgemeldeten Zeilen rot.
   Die Warnung überstimmt Readonly-/HK-Farben, ohne die Durchstreichung zu ändern. */
.page-content table:is(
    .halbjahr-table,
    .pruefung-table,
    .abschluss-table,
    .abschluss1-table,
    .abschluss2-table,
    .versetzung-table
) input.note-schlechter-als-vier {
    background-color: #f8c7c7 !important;
    border-color: #c0392b !important;
    color: #8a0000 !important;
    font-weight: bold !important;
}
