/* =========================================================================
   Aufgabenapp – zentrales Stylesheet
   Zenkit-inspiriertes Design: linke Sidebar, helle Arbeitsfläche, weiße
   Karten, Ansichts-Umschalter (Liste/Tabelle/Board) und Slide-over-Panel.
   Markenfarbe bleibt Blau. Kein Framework, kein CDN.
   ========================================================================= */

:root {
  /* Marke / Akzent (Zenkit-Azur) */
  --primaer: #1a7ee5;
  --primaer-dunkel: #1466c4;
  --primaer-licht: #eaf4fd;

  --erfolg: #16a34a;
  --fehler: #dc2626;
  --warnung: #d97706;

  /* Flächen (Zenkit: helle, neutrale Arbeitsfläche, weiße Karten) */
  --hintergrund: #f6f7f8;   /* Arbeitsfläche (Canvas) */
  --karte: #ffffff;
  --karte-rand: #e5e7eb;
  --text: #1f2937;
  --text-dezent: #6b7280;
  --rand: #e5e7eb;
  --rand-stark: #d1d5db;

  /* Sidebar – dunkles Zenkit-To-Do-Chrome (Navy mit Azur-Akzent).
     Für eine helle Sidebar diese Werte umstellen:
     --sidebar-bg:#fff; --sidebar-bg2:#fff; --sidebar-text:#475569;
     --sidebar-text-stark:#111827; --sidebar-hover:#f1f5f9;
     --sidebar-active-bg:var(--primaer-licht); --sidebar-active-text:var(--primaer);
     --sidebar-rand:#e5e7eb; */
  --sidebar-bg: #16223c;
  --sidebar-bg2: #111b30;
  --sidebar-text: #aebbd2;
  --sidebar-text-stark: #ffffff;
  --sidebar-hover: rgba(255, 255, 255, 0.07);
  --sidebar-active-bg: rgba(26, 126, 229, 0.22);
  --sidebar-active-text: #ffffff;
  --sidebar-active-bar: var(--primaer);
  --sidebar-rand: rgba(255, 255, 255, 0.09);

  --radius: 10px;
  --radius-sm: 6px;
  --pill: 999px;
  --schatten: 0 1px 2px rgba(15, 23, 42, 0.05), 0 1px 3px rgba(15, 23, 42, 0.08);
  --schatten-mittel: 0 6px 18px rgba(15, 23, 42, 0.10);
  --schatten-gross: -10px 0 34px rgba(15, 23, 42, 0.18);

  --sidebar-breite: 250px;
  --appbar-h: 54px;
}

* { box-sizing: border-box; }

html { font-size: 15px; }  /* dichtere Zenkit-Skala; 14px = noch dichter, 16px = mehr Lesbarkeit */

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans",
    "Helvetica Neue", Arial, sans-serif;
  background: var(--hintergrund);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primaer); }
a:hover { color: var(--primaer-dunkel); }

h1 { font-size: 1.45rem; margin: 0 0 1rem; letter-spacing: -0.01em; }
h2 { font-size: 1.15rem; margin: 1.25rem 0 0.6rem; letter-spacing: -0.01em; }
h3 { font-size: 1.02rem; margin: 1rem 0 0.5rem; }

/* =========================================================================
   App-Shell: Sidebar + Content
   ========================================================================= */

.layout {
  display: flex;
  min-height: 100vh;
  align-items: stretch;
}

/* ------------------------------------------------------------- Sidebar */
.sidebar {
  flex: 0 0 var(--sidebar-breite);
  width: var(--sidebar-breite);
  background: linear-gradient(180deg, var(--sidebar-bg) 0%, var(--sidebar-bg2) 100%);
  border-right: 1px solid var(--sidebar-rand);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 60;
}

.sidebar-brand {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 1.05rem 1.15rem 0.9rem;
  border-bottom: 1px solid var(--sidebar-rand);
}

.sidebar-brand a.brand-link {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  color: var(--sidebar-text-stark);
  font-weight: 700;
  font-size: 1.1rem;
  text-decoration: none;
  letter-spacing: -0.01em;
}

.brand-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  /* Zenkit-Hexagon (pointy-top) */
  clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%);
  background: linear-gradient(135deg, #2f93f0 0%, var(--primaer) 100%);
  color: #fff;
  font-weight: 800;
  font-size: 0.95rem;
  flex: 0 0 auto;
}

.sidebar-brand .group-name {
  align-self: flex-start;
  font-size: 0.78rem;
  color: var(--sidebar-text-stark);
  background: rgba(255, 255, 255, 0.10);
  padding: 0.15rem 0.6rem;
  border-radius: var(--pill);
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 0.6rem 0.6rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.nav-section-title {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #8295b5;
  padding: 0.9rem 0.7rem 0.35rem;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.5rem 0.7rem;
  border-radius: var(--radius-sm);
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 500;
  position: relative;
  transition: background 0.12s ease, color 0.12s ease;
}

.nav-item:hover {
  background: var(--sidebar-hover);
  color: var(--sidebar-text-stark);
}

.nav-item.active {
  background: var(--sidebar-active-bg);
  color: var(--sidebar-active-text);
  font-weight: 600;
}

.nav-item.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 6px;
  bottom: 6px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--sidebar-active-bar);
}

.nav-item .ic {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  opacity: 0.9;
}

.nav-item .ic svg { width: 18px; height: 18px; stroke: currentColor; fill: none; }

.sidebar-foot {
  border-top: 1px solid var(--sidebar-rand);
  padding: 0.7rem 0.8rem 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.sidebar-foot .user-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(255, 255, 255, 0.08);
  border-radius: var(--pill);
  padding: 0.35rem 0.7rem;
  font-size: 0.85rem;
  color: var(--sidebar-text-stark);
}

.user-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--primaer);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}

.sidebar-foot .logout {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: 0.88rem;
  padding: 0.35rem 0.7rem;
  border-radius: var(--radius-sm);
}

.sidebar-foot .logout:hover {
  background: var(--sidebar-hover);
  color: var(--sidebar-text-stark);
}

/* --------------------------------------------------------- Content-Spalte */
.content {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

/* Slim App-Bar (vor allem mobil; trägt den Menü-Button) */
.appbar {
  display: none;
  align-items: center;
  gap: 0.6rem;
  height: var(--appbar-h);
  padding: 0 0.9rem;
  background: var(--karte);
  border-bottom: 1px solid var(--rand);
  position: sticky;
  top: 0;
  z-index: 55;
}

.appbar .appbar-brand {
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.hamburger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--rand);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--text);
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
}

.sidebar-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.4);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease;
  z-index: 59;
}

body.nav-open .sidebar-backdrop { opacity: 1; visibility: visible; }

main {
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 1.6rem 1.5rem 2rem;
  flex: 1;
}

/* Auth-Seiten (nicht angemeldet): zentriertes Layout ohne Sidebar */
.auth-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(1100px 480px at 50% -120px, #e3f0fc 0%, rgba(227, 240, 252, 0) 70%),
    var(--hintergrund);
}

.auth-main {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
}

.auth-wrap {
  width: 100%;
  max-width: 440px;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--karte);
  border: 1px solid var(--karte-rand);
  border-radius: var(--radius);
  box-shadow: var(--schatten-mittel);
  padding: 1.8rem 1.7rem;
}

.auth-card h1 { font-size: 1.35rem; margin-bottom: 0.4rem; }

.auth-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  margin: 0 0 1.4rem;
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--text);
}

.auth-links {
  margin-top: 1.1rem;
  text-align: center;
  font-size: 0.9rem;
  color: var(--text-dezent);
}

/* ---------------------------------------------------------------- Footer */
.footer {
  text-align: center;
  color: var(--text-dezent);
  font-size: 0.82rem;
  padding: 1.4rem 1rem 1.8rem;
  border-top: 1px solid var(--rand);
}

.footer a { color: var(--text-dezent); }
.auth-shell .footer { border-top: none; }

/* Rechtstexte (Impressum, Datenschutz) */
.rechtstext { max-width: 760px; margin-left: auto; margin-right: auto; }
.rechtstext h3 { margin-top: 1.3rem; }
.rechtstext ul { padding-left: 1.2rem; }
.rechtstext li { margin: 0.35rem 0; }

/* ------------------------------------------- Impersonation-Banner */
.impersonation-banner {
  position: sticky;
  top: 0;
  z-index: 80;
  background: #fef3c7;
  color: #78350f;
  border-bottom: 1px solid #f59e0b;
  padding: 0.5rem 1.25rem;
  text-align: center;
  font-size: 0.95rem;
}
.impersonation-banner a { color: #92400e; font-weight: 600; }

/* =========================================================================
   Seitenkopf, Karten, Tabellen
   ========================================================================= */

.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.6rem 1rem;
  margin-bottom: 1rem;
}
.page-head h1 { margin: 0; }

.card {
  background: var(--karte);
  border: 1px solid var(--karte-rand);
  border-radius: var(--radius);
  box-shadow: var(--schatten);
  padding: 1.25rem;
  margin-bottom: 1.25rem;
}

.card h2:first-child,
.card h3:first-child { margin-top: 0; }

/* ------------------------------------------------------------ Tabellen */
.table-wrap {
  overflow-x: auto;
  background: var(--karte);
  border: 1px solid var(--karte-rand);
  border-radius: var(--radius);
  box-shadow: var(--schatten);
}

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--karte);
}

/* Freistehende Tabellen (ohne .table-wrap / nicht in Karte) bekommen Rahmen */
main > table,
main > .table,
main > .tabelle,
main > .rangliste,
.view-pane > table {
  border: 1px solid var(--karte-rand);
  border-radius: var(--radius);
  box-shadow: var(--schatten);
  overflow: hidden;
}

th {
  text-align: left;
  font-weight: 600;
  color: var(--text-dezent);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  background: #f8fafc;
}

th, td {
  padding: 0.62rem 0.8rem;
  border-bottom: 1px solid var(--rand);
  vertical-align: middle;
}

tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--primaer-licht); }

.card table { box-shadow: none; border: none; }
.card table th { background: #f8fafc; }

/* Wochenmatrix */
.matrix td { text-align: center; }
.matrix td:first-child { text-align: left; }
.matrix-kopf { text-align: center; }

/* Rangliste: eigene Zeile hervorheben (Template nutzt tr.me) */
.rangliste tr.me,
.rangliste tr.me:hover,
tr.rang-ich,
tr.rang-ich:hover {
  background: #dbeafe;
  font-weight: 600;
}

/* Archivierte Zeilen (Superadmin) */
tr.zeile-archiviert { color: var(--text-dezent); background: #f8fafc; }
tr.zeile-archiviert:hover { background: #f1f5f9; }

.muted { color: var(--text-dezent); }

/* =========================================================================
   Formulare
   ========================================================================= */

form { margin: 0; }

label {
  display: block;
  font-weight: 600;
  margin: 0.8rem 0 0.25rem;
  font-size: 0.92rem;
}

input, select, textarea {
  width: 100%;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--rand-stark);
  border-radius: var(--radius-sm);
  font: inherit;
  background: #fff;
  color: var(--text);
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primaer);
  box-shadow: 0 0 0 3px rgba(26, 126, 229, 0.20);
}

textarea { min-height: 6rem; resize: vertical; }

input[type="checkbox"], input[type="radio"] {
  width: auto;
  margin-right: 0.4rem;
}

input[type="file"] { border: 1px dashed var(--rand-stark); background: #f8fafc; }

/* Karten-/Formular-Wrapper, die Templates verwenden */
.form, .formular { max-width: 720px; }
.form-field, .form-row, .form-feld, .feld { margin-bottom: 0.2rem; }
.form .form-field input, .form .form-row input { margin-bottom: 0.2rem; }

.form-actions, .formular-aktionen, .weitere-aktionen {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1.2rem;
}

.fester-wert {
  display: inline-block;
  padding: 0.4rem 0;
  color: var(--text-dezent);
}

.checkbox-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 0.25rem 1rem;
}
.checkbox-list label { font-weight: 400; margin: 0.25rem 0; }

.versteckt { /* sichtbar verborgenes Label */
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0);
  border: 0;
}

/* Hinweise (drei historische Klassennamen – einheitlich gestaltet) */
.hint, .hinweis, .form-hinweis {
  color: var(--text-dezent);
  font-size: 0.88rem;
  margin: 0.4rem 0;
}

/* Foto-Upload */
.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0);
  border: 0;
}
.foto-label { margin-bottom: 0.25rem; }
.foto-feld {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem 0.75rem;
  margin-bottom: 0.6rem;
}
.foto-btn { margin-top: 0; cursor: pointer; }
.foto-name { color: var(--text-dezent); font-size: 0.9rem; }
.foto-name.gewaehlt { color: var(--erfolg); font-weight: 600; }
.foto-feld #foto-vorschau { flex-basis: 100%; }

fieldset {
  border: 1px solid var(--rand);
  border-radius: var(--radius-sm);
  margin: 1rem 0;
  padding: 0.4rem 1rem 1rem;
  background: #fcfdff;
}
legend {
  font-weight: 600;
  font-size: 0.92rem;
  padding: 0 0.4rem;
  color: var(--text);
}

.gps-hinweis { color: var(--warnung); font-size: 0.9rem; margin: 0.5rem 0 0; }

#foto-vorschau {
  max-width: 100%;
  max-height: 320px;
  margin-top: 0.6rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--rand);
}

/* =========================================================================
   Buttons & Aktionszeilen
   ========================================================================= */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 0.95rem;
  border: 1px solid var(--rand-stark);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--text);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  margin-top: 0;
  line-height: 1.2;
  transition: background 0.12s ease, border-color 0.12s ease,
    box-shadow 0.12s ease, transform 0.06s ease;
}
.btn:hover { background: #f1f5f9; border-color: var(--rand-stark); }
.btn:active { transform: translateY(1px); }

.btn-primary {
  background: var(--primaer);
  border-color: var(--primaer);
  color: #fff;
  box-shadow: 0 1px 2px rgba(26, 126, 229, 0.35);
}
.btn-primary:hover { background: var(--primaer-dunkel); border-color: var(--primaer-dunkel); color: #fff; }

.btn-danger { background: var(--fehler); border-color: var(--fehler); color: #fff; }
.btn-danger:hover { background: #b91c1c; border-color: #b91c1c; color: #fff; }

.btn-success { background: var(--erfolg); border-color: var(--erfolg); color: #fff; }
.btn-success:hover { background: #15803d; border-color: #15803d; color: #fff; }

.btn-sm { padding: 0.3rem 0.65rem; font-size: 0.85rem; }

.inline-form { display: inline-flex; margin: 0; gap: 0.3rem; align-items: center; }

.zeilen-aktionen { display: flex; align-items: center; flex-wrap: wrap; gap: 0.35rem; }

.aktionen {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
  margin: 0 0 1rem;
}
.aktionen .btn { margin-top: 0; }

/* Sekundär-Navigation (Chef-Bereich) */
.subnav {
  background: var(--karte);
  border: 1px solid var(--karte-rand);
  border-radius: var(--radius);
  padding: 0.4rem;
  box-shadow: var(--schatten);
  margin-bottom: 1.2rem;
}

/* Filter-/Tab-Buttons (Rangliste, Statistik, Zeitraum, Subnav) */
.btn-tab {
  background: transparent;
  border-color: transparent;
  color: var(--text-dezent);
  font-weight: 600;
}
.btn-tab:hover { background: #f1f5f9; border-color: transparent; }
.btn-tab.aktiv {
  background: var(--primaer-licht);
  border-color: transparent;
  color: var(--primaer);
}

/* Sichtbarer Tastatur-Fokus für interaktive Elemente */
.btn:focus-visible,
.view-tab:focus-visible,
.nav-item:focus-visible,
.board-card-link:focus-visible,
.hk-link:focus-visible,
.btn-check:focus-visible,
.hamburger:focus-visible,
.slideover-close:focus-visible,
.chip:focus-visible {
  outline: 2px solid var(--primaer);
  outline-offset: 2px;
}

/* =========================================================================
   Ansichts-Umschalter + Kanban-Board (Zenkit-Views)
   ========================================================================= */

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.6rem 1rem;
  margin-bottom: 1rem;
}

.view-switch {
  display: inline-flex;
  gap: 3px;
  background: #e9edf3;
  border-radius: var(--radius-sm);
  padding: 3px;
}
.view-tab {
  border: none;
  background: transparent;
  font: inherit;
  font-weight: 500;
  font-size: 0.86rem;
  color: #4b5563;
  padding: 0.4rem 0.85rem;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  text-decoration: none;
}
.view-tab:hover { color: var(--text); }
.view-tab.active {
  background: #fff;
  color: var(--primaer);
  box-shadow: var(--schatten);
}
.view-pane[hidden] { display: none; }

.board {
  display: flex;
  gap: 0.9rem;
  align-items: flex-start;
  overflow-x: auto;
  padding-bottom: 0.6rem;
}
.board-col {
  flex: 0 0 300px;
  max-width: 300px;
  background: #eaeef4;
  border-radius: var(--radius);
  padding: 0.6rem 0.6rem 0.7rem;
}
.board-col-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-dezent);
  padding: 0.3rem 0.45rem 0.6rem;
}
.board-col-count {
  background: #fff;
  border-radius: var(--pill);
  padding: 0.05rem 0.55rem;
  font-size: 0.76rem;
  color: var(--text-dezent);
  font-weight: 700;
}
.board-card {
  display: block;
  background: #fff;
  border-radius: var(--radius-sm);
  box-shadow: var(--schatten);
  padding: 0.6rem 0.7rem;
  margin-bottom: 0.5rem;
  text-decoration: none;
  color: var(--text);
  border-left: 3px solid var(--rand-stark);
  transition: box-shadow 0.12s ease, transform 0.06s ease;
}
.board-card:hover { box-shadow: var(--schatten-mittel); transform: translateY(-1px); color: var(--text); }
.board-card-title { font-weight: 600; font-size: 0.94rem; }
.board-card-link { display: block; text-decoration: none; color: var(--text); }
.board-card-link:hover { color: var(--primaer); }
.board-card-meta { display: flex; flex-wrap: wrap; gap: 0.3rem; margin-top: 0.45rem; }
.board-card.st-open { border-left-color: var(--primaer); }
.board-card.st-pending { border-left-color: #f59e0b; }
.board-card.st-done { border-left-color: var(--erfolg); }
.board-card.st-missed { border-left-color: var(--fehler); }
.board-card.st-overdue { border-left-color: #ea580c; }
.board-empty { color: var(--text-dezent); font-size: 0.85rem; padding: 0.3rem 0.45rem 0.6rem; }

/* =========================================================================
   Slide-over-Panel (Detailansicht)
   ========================================================================= */

.slideover-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.4);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease;
  z-index: 200;
}
.slideover {
  position: fixed;
  top: 0;
  right: 0;
  height: 100%;
  width: min(620px, 95vw);
  background: var(--karte);
  box-shadow: var(--schatten-gross);
  transform: translateX(100%);
  transition: transform 0.25s ease;
  z-index: 201;
  display: flex;
  flex-direction: column;
}
body.slideover-open .slideover { transform: none; }
body.slideover-open .slideover-backdrop { opacity: 1; visibility: visible; }

.slideover-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  padding: 0.85rem 1.1rem;
  border-bottom: 1px solid var(--rand);
}
.slideover-head .so-titel { font-weight: 700; font-size: 1rem; }
.slideover-close {
  border: none;
  background: #f1f5f9;
  color: var(--text);
  width: 34px; height: 34px;
  border-radius: var(--radius-sm);
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
}
.slideover-close:hover { background: #e2e8f0; }
.slideover-body { overflow: auto; padding: 1.1rem 1.25rem 1.6rem; flex: 1; }
.slideover-body h1:first-child { font-size: 1.2rem; }
.so-spinner { color: var(--text-dezent); text-align: center; padding: 2rem 0; }

/* =========================================================================
   Flash-Meldungen
   ========================================================================= */

.flash {
  border-radius: var(--radius-sm);
  padding: 0.7rem 1rem;
  margin: 0 0 1rem;
  border: 1px solid transparent;
  font-size: 0.95rem;
}
.flash-success { background: #dcfce7; border-color: #86efac; color: #14532d; }
.flash-error { background: #fee2e2; border-color: #fca5a5; color: #7f1d1d; }
.flash-info { background: #dbeafe; border-color: #93c5fd; color: #1e3a8a; }

/* =========================================================================
   Status-Badges
   ========================================================================= */

.badge {
  display: inline-block;
  padding: 0.12rem 0.55rem;
  border-radius: var(--pill);
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
  vertical-align: middle;
}
.badge-open { background: #e0e7ff; color: #3730a3; }
.badge-pending { background: #fef3c7; color: #92400e; }
.badge-done, .badge-ok { background: #dcfce7; color: #166534; }
.badge-missed, .badge-error { background: #fee2e2; color: #991b1b; }
.badge-overdue, .badge-warn { background: #ffedd5; color: #9a3412; }
.badge-phase { background: #ede9fe; color: #5b21b6; }
.badge-team { background: #cffafe; color: #155e75; }
.badge-personal { background: #f1f5f9; color: #475569; }
.badge-points { background: #fef9c3; color: #854d0e; }
.badge-status { font-size: 0.8rem; }

/* =========================================================================
   Heute-Ansicht / Tagesphasen
   ========================================================================= */

.heute-titel { margin-bottom: 0.4rem; }
.heute-datum {
  font-size: 0.95rem;
  font-weight: 400;
  color: var(--text-dezent);
  margin-left: 0.4rem;
}

.phase-block { margin-bottom: 1.5rem; }
.phase-block h2 {
  font-size: 1.05rem;
  color: var(--text-dezent);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--rand);
  padding-bottom: 0.3rem;
  margin-bottom: 0.6rem;
}

.phase-section {
  background: var(--karte);
  border: 1px solid var(--karte-rand);
  border-radius: var(--radius);
  box-shadow: var(--schatten);
  overflow: hidden;
  margin-bottom: 1rem;
}
.phase-h {
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--text-dezent);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin: 0;
  padding: 0.55rem 0.9rem;
  background: #f8fafc;
  border-bottom: 1px solid var(--rand);
}
.phase-h.ph-rot { color: #c2410c; background: #fff5ef; }
.phase-window {
  font-weight: 400;
  letter-spacing: normal;
  text-transform: none;
  margin-left: 0.35rem;
}

.hk {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.6rem 0.9rem;
  margin: 0;
  background: var(--karte);
  border: none;
  border-bottom: 1px solid var(--rand);
  border-radius: 0;
  box-shadow: none;
  transition: background 0.12s ease;
}
.phase-section .hk:last-child { border-bottom: none; }
.hk:hover { background: #f8fbff; }
.hk-link {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.2rem 0.5rem;
  text-decoration: none;
  color: var(--text);
}
.hk-titel { font-weight: 600; font-size: 0.98rem; }
.hk-tags { display: inline-flex; flex-wrap: wrap; gap: 0.25rem; }

.tag {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.05rem 0.45rem;
  border-radius: var(--pill);
  background: #f1f5f9;
  border: 1px solid var(--rand);
  color: var(--text-dezent);
  white-space: nowrap;
}
.tag-rot { background: #fee2e2; color: #991b1b; border-color: #fecaca; }
.tag-gelb { background: #fef3c7; color: #92400e; border-color: #fde68a; }

.hk-pending { background: #fffdf5; }
.hk-pending:hover { background: #fffaeb; }
.hk-done { background: #f7fcf9; }
.hk-done:hover { background: #eefaf2; }
.hk-done .hk-titel {
  color: #15803d;
  text-decoration: line-through;
  text-decoration-thickness: 1.5px;
}
.hk-missed { background: #fdf6f6; }
.hk-missed .hk-titel { color: #991b1b; }
.hk-ueberfaellig { background: #fffaf4; }

/* Runde Checkbox links (Zenkit-To-Do-Signatur) */
.hk-check-form { margin: 0; display: flex; flex: 0 0 auto; }
.hk-check {
  appearance: none;
  -webkit-appearance: none;
  width: 22px;
  height: 22px;
  flex: 0 0 auto;
  border: 2px solid var(--rand-stark);
  border-radius: 50%;
  background: #fff;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 0.8rem;
  line-height: 1;
  padding: 0;
  transition: border-color 0.12s ease, background 0.12s ease, box-shadow 0.12s ease;
}
.hk-check::before { content: "✓"; opacity: 0; transition: opacity 0.12s ease; }
button.hk-check:hover {
  border-color: var(--erfolg);
  background: var(--erfolg);
  box-shadow: 0 0 0 4px rgba(22, 163, 74, 0.15);
}
button.hk-check:hover::before { opacity: 1; }
.hk-check.is-done { border-color: var(--erfolg); background: var(--erfolg); }
.hk-check.is-done::before { opacity: 1; }
.hk-check.is-locked { cursor: default; border-style: dashed; }
.hk-ueberfaellig .hk-check.is-locked { border-color: #ea580c; }
.hk-pending .hk-check.is-locked { border-color: #f59e0b; }
.hk-missed .hk-check.is-locked { border-color: #dc2626; }

.hk-haken { color: var(--erfolg); font-size: 1.3rem; font-weight: 700; padding: 0 0.4rem; }
.hk-form { flex-shrink: 0; }

/* "Rückgängig" – dezenter Button für eben abgehakte Aufgaben (Listenzeile) */
.hk-undo-form { margin: 0; flex: 0 0 auto; }
.hk-undo {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  border: 1px solid var(--rand-stark);
  background: #fff;
  color: var(--text-dezent);
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1.2;
  padding: 0.2rem 0.6rem;
  border-radius: var(--pill);
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease;
}
.hk-undo:hover { background: #f1f5f9; color: var(--text); border-color: var(--rand-stark); }

.btn-check {
  display: inline-block;
  background: var(--erfolg);
  color: #fff;
  border: none;
  border-radius: var(--pill);
  font: inherit;
  font-weight: 700;
  font-size: 0.95rem;
  padding: 0.5rem 1.1rem;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 1px 2px rgba(22, 163, 74, 0.4);
  transition: background 0.12s ease, transform 0.08s ease;
}
.btn-check:hover { background: #15803d; }
.btn-check:active { transform: scale(0.97); }

.empty {
  text-align: center;
  color: var(--text-dezent);
  font-size: 1.02rem;
  padding: 2rem 0;
}

.task-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.4rem 0.9rem;
  background: var(--karte);
  border: 1px solid var(--karte-rand);
  border-radius: var(--radius);
  box-shadow: var(--schatten);
  padding: 0.75rem 1rem;
  margin-bottom: 0.6rem;
}
.task-card .titel { font-weight: 600; }
.task-card .titel a { text-decoration: none; color: var(--text); }
.task-card .titel a:hover { color: var(--primaer); }
.task-card .punkte { color: var(--text-dezent); font-size: 0.88rem; white-space: nowrap; }

/* =========================================================================
   Aufgaben-Detail (Slide-over & Vollseite)
   ========================================================================= */

.task-detail { max-width: 760px; }
.task-detail-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem 0.8rem;
  margin-bottom: 0.6rem;
}
.task-detail-head h1 { margin: 0; }
.card-meta { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-bottom: 1rem; }

.detail-section {
  background: var(--karte);
  border: 1px solid var(--karte-rand);
  border-radius: var(--radius);
  box-shadow: var(--schatten);
  padding: 1rem 1.15rem;
  margin-bottom: 1rem;
}
.detail-section > h2:first-child { margin-top: 0; font-size: 1.02rem; }
.beschreibung { white-space: pre-line; }

.checklist { list-style: none; padding: 0; margin: 0; }
.checklist-item {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.35rem 0;
  border-bottom: 1px solid var(--rand);
}
.checklist-item:last-child { border-bottom: none; }
.checklist-item.checked .check-text { color: var(--text-dezent); text-decoration: line-through; }
.check-state { font-size: 0.85rem; color: var(--text-dezent); }
.check-text { flex: 1; }

.proof-list, .nachweise { list-style: none; padding: 0; margin: 0; }
.proof-list li, .nachweise li {
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--rand);
}
.proof-list li:last-child, .nachweise li:last-child { border-bottom: none; }

.comments, .kommentare { list-style: none; padding: 0; margin: 0 0 1rem; }
.comment, .kommentare li {
  background: #f8fafc;
  border: 1px solid var(--rand);
  border-radius: var(--radius-sm);
  padding: 0.55rem 0.7rem;
  margin-bottom: 0.5rem;
}
.comment p { margin: 0.3rem 0 0; }
.comment-time { color: var(--text-dezent); font-size: 0.8rem; margin-left: 0.4rem; }
.rejected { color: var(--fehler); font-weight: 600; }

.zeit-status { font-size: 1.05rem; }
.zeit-anzeige {
  font-variant-numeric: tabular-nums;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--primaer);
}
.zeit-aktionen { margin-top: 0.6rem; }

/* Bestätigungen */
.bestaetigung-aktionen {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 0.6rem;
  margin-top: 0.8rem;
}
.bestaetigung-aktionen form { display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: center; }
.bestaetigung-aktionen input[type="text"] { width: auto; min-width: 220px; }

/* =========================================================================
   Vorschau
   ========================================================================= */

.preview-day {
  background: var(--karte);
  border: 1px solid var(--karte-rand);
  border-radius: var(--radius);
  box-shadow: var(--schatten);
  padding: 0.9rem 1.1rem;
  margin-bottom: 0.9rem;
}
.preview-day h2 { margin-top: 0; font-size: 1rem; }
.preview-list { list-style: none; padding: 0; margin: 0; }
.preview-list li {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.35rem;
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--rand);
}
.preview-list li:last-child { border-bottom: none; }
.preview-list .task-title { font-weight: 600; margin-right: 0.3rem; }

/* =========================================================================
   Aufgaben-Formular: aufklappbare Abschnitte
   ========================================================================= */

details.formular-abschnitt {
  background: var(--karte);
  border: 1px solid var(--karte-rand);
  border-radius: var(--radius-sm);
  margin: 0.75rem 0;
  box-shadow: var(--schatten);
}
details.formular-abschnitt > summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 0.95rem;
  padding: 0.7rem 1rem;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
details.formular-abschnitt > summary::-webkit-details-marker { display: none; }
details.formular-abschnitt > summary::before {
  content: "▸";
  color: var(--text-dezent);
  transition: transform 0.12s ease;
}
details.formular-abschnitt[open] > summary::before { transform: rotate(90deg); }
details.formular-abschnitt[open] > summary { border-bottom: 1px solid var(--rand); }
.summary-info { margin-left: auto; font-weight: 400; font-size: 0.82rem; color: var(--text-dezent); }
.abschnitt-inhalt { padding: 0.5rem 1rem 0.9rem; }

.radio-zeile { display: block; font-weight: 400; margin: 0.35rem 0; }
.radio-zeile.eingerueckt { margin-left: 1.6rem; }
.wiederholung-wahl label { display: block; font-weight: 400; margin: 0.3rem 0; }

/* Wochentage als Pills */
.wochentag-pills { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.wochentag-pills label { margin: 0; }
.wochentag-pills input { position: absolute; opacity: 0; pointer-events: none; }
.wochentag-pills span {
  display: inline-block;
  padding: 0.4rem 0.75rem;
  border: 1px solid var(--rand-stark);
  border-radius: var(--pill);
  background: #fff;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
}
.wochentag-pills input:checked + span { background: var(--primaer); border-color: var(--primaer); color: #fff; }
.wochentag-pills input:focus-visible + span { outline: 2px solid var(--primaer); outline-offset: 1px; }

/* =========================================================================
   Wochenmatrix: Zuweisungs-Zellen
   ========================================================================= */

.matrix-zelle { min-width: 96px; vertical-align: top; }
.chip-form { display: block; margin: 0 0 0.2rem; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  max-width: 100%;
  background: #e0e7ff;
  color: #3730a3;
  border: 1px solid #c7d2fe;
  border-radius: var(--pill);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.1rem 0.55rem;
  cursor: pointer;
  white-space: nowrap;
}
.chip:hover { background: #fee2e2; border-color: #fca5a5; color: #991b1b; }
.chip-x { font-weight: 700; opacity: 0.6; }
.chip-team { background: #cffafe; color: #155e75; border-color: #a5f3fc; }
.zelle-add { margin-bottom: 0.25rem; }
.zelle-add select {
  width: auto;
  min-width: 3.2rem;
  max-width: 110px;
  padding: 0.15rem 0.3rem;
  font-size: 0.8rem;
  border-radius: 6px;
  color: var(--text-dezent);
}
tr.matrix-leer, tr.matrix-leer:hover { background: #fee2e2; }
tr.matrix-leer td:first-child { color: #991b1b; font-weight: 600; }

/* =========================================================================
   Statistik
   ========================================================================= */

.filter-leiste { display: flex; align-items: center; flex-wrap: wrap; gap: 0.5rem; }
.filter-leiste > span { font-weight: 600; margin-right: 0.3rem; }

.verlauf-tabelle th.verlauf-woche {
  width: 150px;
  white-space: nowrap;
  font-weight: 600;
  color: var(--text);
  text-transform: none;
  letter-spacing: normal;
  background: transparent;
  vertical-align: top;
}
.verlauf-woche small { color: var(--text-dezent); font-weight: 400; }
.balken-zeile { display: flex; align-items: center; gap: 0.6rem; margin: 0.25rem 0; }
.balken-spur {
  flex: 1;
  background: var(--rand);
  border-radius: var(--pill);
  height: 14px;
  overflow: hidden;
  min-width: 80px;
}
.balken { height: 100%; border-radius: var(--pill); background: var(--primaer); }
.balken-erledigt { background: var(--erfolg); }
.balken-versaeumt { background: var(--fehler); }
.balken-wert { font-size: 0.82rem; color: var(--text-dezent); white-space: nowrap; min-width: 90px; }

/* =========================================================================
   QR-Druckseite + Druck
   ========================================================================= */

.qr-print { text-align: center; }
.qr-print img { max-width: 320px; width: 100%; }

@media print {
  body * { visibility: hidden; }
  .qr-print, .qr-print *,
  .qr-druckseite, .qr-druckseite * { visibility: visible; }
  .qr-print, .qr-druckseite {
    position: absolute;
    left: 0; top: 0;
    width: 100%;
    box-shadow: none;
  }
  .sidebar, .appbar, .footer, .impersonation-banner, .flash, .btn,
  .sidebar-backdrop, .slideover, .slideover-backdrop, .kein-druck {
    display: none !important;
  }
  main { max-width: none; padding: 0; }
}

/* =========================================================================
   Responsive: Sidebar wird unter 900px zum Off-Canvas-Overlay
   ========================================================================= */

@media (max-width: 900px) {
  .appbar { display: flex; }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    box-shadow: var(--schatten-gross);
  }
  body.nav-open .sidebar { transform: none; }

  main { padding: 1.1rem 1rem 1.6rem; }

  /* Breite Tabellen werden auf schmalen Viewports horizontal scrollbar
     (deckt auch freistehende/geerbte Tabellen ohne .table-wrap ab) */
  table { display: block; overflow-x: auto; }
}

@media (max-width: 700px) {
  h1 { font-size: 1.25rem; }
  .card { padding: 1rem; }
  table { font-size: 0.92rem; }
  th, td { padding: 0.5rem 0.55rem; }

  .hk { padding: 0.4rem 0.45rem 0.4rem 0.6rem; }
  .hk-titel { font-size: 0.93rem; }
  .btn-check { padding: 0.45rem 0.85rem; font-size: 0.9rem; }

  .board-col { flex-basis: 82vw; max-width: 82vw; }
  .bestaetigung-aktionen input[type="text"] { min-width: 0; flex: 1; }
}
