/*
  Design-Tokens 1:1 aus den CSS-Variablen von herzstueck-schulbegleitung.de übernommen
  (Rosé-/Taupe-Palette, Quicksand als Headline-Font, Nunito als Fließtext-Font,
  großzügige Rundungen). Für die App leicht erweitert um Status-/Formularfarben.
*/

:root {
  --color-rose: #c69ba0;
  --color-rose-deep: #a97a80;
  --color-taupe: #6f5f5a;
  --color-taupe-dark: #574a46;
  --color-bg: #fbf7f4;
  --color-bg-soft: #f4e9e6;
  --color-beige: #f1e8db;
  --color-mist: #eff1f2;
  --color-surface: #ffffff;
  --color-text: #4a413e;
  --color-text-soft: #7c706b;
  --color-line: #ecdedb;

  --color-success: #5b8a5b;
  --color-error: #b05656;

  --font-heading: "Quicksand", "Nunito", "Segoe UI", system-ui, sans-serif;
  --font-body: "Nunito", "Segoe UI", system-ui, sans-serif;

  --radius: 22px;
  --radius-sm: 14px;
  --shadow: 0 18px 40px -22px rgba(111, 95, 90, 0.45);
  --shadow-soft: 0 10px 30px -18px rgba(111, 95, 90, 0.4);
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);

  color-scheme: light;
}

* , *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--color-text);
  background: var(--color-bg);
  line-height: 1.55;
  font-size: 1rem;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  min-height: 100dvh;
  padding-bottom: env(safe-area-inset-bottom);
}

h1, h2, h3, h4 {
  font-family: var(--font-heading);
  font-weight: 600;
  line-height: 1.2;
  color: var(--color-taupe-dark);
  margin: 0 0 0.5em;
}

p { margin: 0 0 1em; }
a { color: var(--color-rose-deep); text-decoration: none; }
a:hover { color: var(--color-taupe-dark); }

.container {
  width: min(100% - 2rem, 720px);
  margin-inline: auto;
}

/* ---------- App-Shell ---------- */

.app-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgb(251 247 244 / .92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--color-line);
  padding-top: env(safe-area-inset-top);
}

.app-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  padding: .75rem 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: .6rem;
  font-family: var(--font-heading);
  font-weight: 700;
  color: var(--color-taupe-dark);
  font-size: 1.05rem;
}

.brand-mark {
  width: 48px;
  height: 48px;
  flex: none;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-size: .85rem;
  color: var(--color-text-soft);
}

.role-badge {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: .72rem;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: #fff;
  background: var(--color-rose-deep);
  padding: .2rem .6rem;
  border-radius: 999px;
}

.app-nav {
  display: flex;
  gap: .3rem;
  overflow-x: auto;
  padding: 0 0 .7rem;
  -ms-overflow-style: none;
  scrollbar-width: none;
}
.app-nav::-webkit-scrollbar { display: none; }

.app-nav a {
  font-family: var(--font-heading);
  font-weight: 500;
  font-size: .92rem;
  color: var(--color-taupe);
  padding: .5rem .9rem;
  border-radius: 999px;
  white-space: nowrap;
  transition: background .2s var(--ease), color .2s var(--ease);
}
.app-nav a:hover { background: var(--color-bg-soft); color: var(--color-taupe-dark); }
.app-nav a.active { background: var(--color-rose-deep); color: #fff; }

main.container { padding: 1.5rem 1rem 3rem; }

.page-title { font-size: clamp(1.4rem, 5vw, 1.8rem); margin-bottom: .3rem; }
.page-lead { color: var(--color-text-soft); margin-bottom: 1.5rem; }

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: .95rem;
  padding: .8rem 1.5rem;
  border-radius: 999px;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform .15s var(--ease), box-shadow .2s var(--ease), background .2s var(--ease), color .2s var(--ease);
  text-align: center;
  min-height: 44px;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }

.btn-primary { background: var(--color-rose-deep); color: #fff; box-shadow: var(--shadow-soft); }
.btn-primary:hover:not(:disabled) { background: var(--color-taupe); }

.btn-ghost { background: transparent; color: var(--color-taupe-dark); border-color: var(--color-rose); }
.btn-ghost:hover:not(:disabled) { background: var(--color-bg-soft); }

.btn-danger { background: transparent; color: var(--color-error); border-color: var(--color-error); }
.btn-danger:hover:not(:disabled) { background: #fbeaea; }

.btn-sm { padding: .55rem 1.1rem; font-size: .85rem; min-height: 36px; }
.btn-block { width: 100%; }

/* ---------- Karten / Listen ---------- */

.card {
  background: var(--color-surface);
  border: 1px solid var(--color-line);
  border-radius: var(--radius);
  padding: 1.4rem;
  box-shadow: var(--shadow-soft);
  margin-bottom: 1rem;
}

.card-title { font-size: 1.1rem; margin-bottom: .3rem; }

.list-item {
  background: var(--color-surface);
  border: 1px solid var(--color-line);
  border-radius: var(--radius-sm);
  padding: 1rem 1.2rem;
  margin-bottom: .7rem;
  display: flex;
  flex-direction: column;
  gap: .35rem;
}

.list-item-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: .6rem;
  flex-wrap: wrap;
}

/* Bündelt eine variable Anzahl Badges zu einem einzigen Flex-Kind, damit
   justify-content: space-between im Elternelement immer nur zwischen Titel und
   dieser Gruppe verteilt (statt Badges einzeln je nach Anzahl unterschiedlich zu
   positionieren, sobald mehr als eins gleichzeitig sichtbar ist). */
.badge-group {
  display: flex;
  align-items: center;
  gap: .4rem;
  flex-wrap: wrap;
}

.list-item-title { font-family: var(--font-heading); font-weight: 600; color: var(--color-taupe-dark); }
.list-item-meta { font-size: .82rem; color: var(--color-text-soft); }
.list-item-body { font-size: .95rem; white-space: pre-wrap; }

.badge {
  display: inline-block;
  font-size: .75rem;
  font-weight: 600;
  padding: .25rem .65rem;
  border-radius: 999px;
  background: var(--color-bg-soft);
  color: var(--color-rose-deep);
  white-space: nowrap;
}
.badge-mist { background: var(--color-mist); color: var(--color-taupe); }
.badge-inactive { background: #f0e7e2; color: var(--color-text-soft); }

.empty-state {
  text-align: center;
  color: var(--color-text-soft);
  padding: 2.5rem 1rem;
}

/* ---------- Formulare ---------- */

.field { margin-bottom: 1.1rem; }

.field label {
  display: block;
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: .88rem;
  color: var(--color-taupe-dark);
  margin-bottom: .35rem;
}

.field .hint { font-size: .78rem; color: var(--color-text-soft); margin-top: .3rem; }

.field input,
.field select,
.field textarea {
  width: 100%;
  font-family: var(--font-body);
  font-size: 1rem;
  color: var(--color-text);
  padding: .75rem .9rem;
  border: 1.5px solid var(--color-line);
  border-radius: var(--radius-sm);
  background: var(--color-bg);
  transition: border-color .2s var(--ease), box-shadow .2s var(--ease);
}
.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--color-rose);
  box-shadow: 0 0 0 3px rgb(198 155 160 / .25);
}
.field textarea { resize: vertical; min-height: 7rem; }

.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 480px) { .field-row { grid-template-columns: 1fr; } }

.form-actions { display: flex; gap: .7rem; flex-wrap: wrap; margin-top: 1.2rem; }

/* ---------- Monats-Ordner (Berichte-Übersicht) ---------- */

.month-folders {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  margin-bottom: 1.2rem;
}
.month-folder {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: .85rem;
  padding: .5rem 1rem;
  border-radius: 999px;
  border: 1.5px solid var(--color-line);
  background: var(--color-surface);
  color: var(--color-taupe);
  cursor: pointer;
  transition: background .15s var(--ease), color .15s var(--ease), border-color .15s var(--ease);
}
.month-folder:hover { background: var(--color-bg-soft); }
.month-folder.active { background: var(--color-rose-deep); border-color: var(--color-rose-deep); color: #fff; }
.month-folder .count {
  display: inline-block;
  margin-left: .35rem;
  font-size: .75rem;
  opacity: .75;
}

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: .6rem;
  margin-bottom: 1.2rem;
}
.filter-bar select,
.filter-bar input {
  font-family: var(--font-body);
  padding: .55rem .8rem;
  border: 1.5px solid var(--color-line);
  border-radius: 999px;
  background: var(--color-surface);
  font-size: .88rem;
}

/* ---------- Meldungen ---------- */

.alert {
  border-radius: var(--radius-sm);
  padding: .8rem 1rem;
  font-size: .9rem;
  margin-bottom: 1rem;
}
.alert-error { background: #fbeaea; color: var(--color-error); border: 1px solid #f0caca; }
.alert-success { background: #eaf3ea; color: var(--color-success); border: 1px solid #cfe4cf; }
.alert-warning { background: #fbf1e2; color: #8a5a20; border: 1px solid #f0dcb8; }
.alert-warning.alert-urgent { background: #fbeaea; color: var(--color-error); border-color: #f0caca; }
.alert strong { display: block; margin-bottom: .2rem; font-family: var(--font-heading); }

/* ---------- Login ---------- */

.auth-screen {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.25rem;
  background: linear-gradient(160deg, #f7ece9 0%, #fbf7f4 70%);
}

.auth-card {
  width: 100%;
  max-width: 380px;
  background: var(--color-surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 2.2rem 1.8rem;
  text-align: center;
}

.auth-logo { width: 64px; height: 64px; margin: 0 auto 1rem; }
.auth-card h1 { font-size: 1.4rem; margin-bottom: .2rem; }
.auth-card .sub { color: var(--color-text-soft); font-size: .9rem; margin-bottom: 1.6rem; }
.auth-card form { text-align: left; }

/* ---------- Modal ---------- */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgb(58 48 45 / .45);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 100;
  padding: 0;
}
@media (min-width: 640px) {
  .modal-backdrop { align-items: center; padding: 1rem; }
}

.modal {
  background: var(--color-surface);
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 1.6rem 1.3rem calc(1.6rem + env(safe-area-inset-bottom));
  width: 100%;
  max-width: 520px;
  max-height: 92vh;
  overflow-y: auto;
  box-shadow: var(--shadow);
}
@media (min-width: 640px) {
  .modal { border-radius: var(--radius); }
}
.modal.modal-wide { max-width: 760px; }

/* ---------- Kategorie-Chips (Berichts-Editor) ---------- */

.kategorie-chips { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1.2rem; }
.kategorie-chip {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: .85rem;
  padding: .5rem 1.1rem;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  color: #fff;
  opacity: .5;
  transition: opacity .15s var(--ease), transform .15s var(--ease);
}
.kategorie-chip:hover { opacity: .78; }
.kategorie-chip.active { opacity: 1; box-shadow: 0 0 0 3px rgb(0 0 0 / .08); transform: translateY(-1px); }

.kategorie-badge {
  display: inline-block;
  font-size: .74rem;
  font-weight: 600;
  padding: .25rem .65rem;
  border-radius: 999px;
  color: #fff;
  white-space: nowrap;
}

/* ---------- Berichts-Editor: großzügigerer Textbereich + Fußzeile ---------- */

.editor-textarea { min-height: 14rem; resize: vertical; }

.editor-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-end;
  gap: 1rem;
  margin-top: 1.4rem;
  padding-top: 1.2rem;
  border-top: 1px solid var(--color-line);
}
.editor-footer .field { margin-bottom: 0; }

.textbaustein-row {
  display: flex;
  gap: .5rem;
  margin-bottom: .6rem;
}
.textbaustein-row select {
  flex: 1 1 auto;
  min-width: 0;
  font-family: var(--font-body);
  font-size: .85rem;
  padding: .55rem .7rem;
  border: 1.5px solid var(--color-line);
  border-radius: var(--radius-sm);
  background: var(--color-bg);
}

.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.icon-btn {
  background: var(--color-bg-soft);
  border: none;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
  color: var(--color-taupe-dark);
}

.fab {
  position: fixed;
  right: 1.2rem;
  bottom: calc(1.2rem + env(safe-area-inset-bottom));
  z-index: 40;
  border-radius: 999px;
  box-shadow: var(--shadow);
}

.text-soft { color: var(--color-text-soft); }
.mt-1 { margin-top: 1rem; }
.spinner-row { text-align: center; padding: 2rem; color: var(--color-text-soft); }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: .9rem;
  margin-bottom: 1.5rem;
}
.stat-card {
  background: var(--color-surface);
  border: 1px solid var(--color-line);
  border-radius: var(--radius-sm);
  padding: 1.1rem;
  box-shadow: var(--shadow-soft);
}
.stat-card strong { display: block; font-family: var(--font-heading); font-size: 1.6rem; color: var(--color-rose-deep); }
.stat-card span { font-size: .8rem; color: var(--color-text-soft); }

/* ---------- Kalender (Kachelansicht) ---------- */

/* ---------- Unternavigation (z.B. innerhalb "Mitarbeiter") ---------- */

.sub-nav {
  display: flex;
  gap: .3rem;
  overflow-x: auto;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--color-line);
  padding-bottom: .8rem;
}
.sub-nav a {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: .85rem;
  color: var(--color-taupe);
  padding: .45rem .9rem;
  border-radius: 999px;
  white-space: nowrap;
  transition: background .2s var(--ease), color .2s var(--ease);
}
.sub-nav a:hover { background: var(--color-bg-soft); color: var(--color-taupe-dark); }
.sub-nav a.active { background: var(--color-rose-deep); color: #fff; }

.cal-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .6rem;
  margin-bottom: 1rem;
}
.cal-nav h2 { margin: 0; font-size: 1.15rem; min-width: 11ch; text-align: center; }

.cal-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: .35rem;
  margin-bottom: .35rem;
}
.cal-weekdays span {
  text-align: center;
  font-size: .72rem;
  font-weight: 600;
  color: var(--color-text-soft);
  text-transform: uppercase;
}

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: .35rem;
  margin-bottom: 1.2rem;
}

.cal-tile {
  position: relative;
  aspect-ratio: 1;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--color-line);
  background: var(--color-surface);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .15rem;
  font-size: .82rem;
  color: var(--color-text);
  cursor: default;
  padding: .2rem;
}
.cal-tile.cal-empty { visibility: hidden; }
.cal-tile.cal-weekend { background: var(--color-mist); color: var(--color-text-soft); border-color: var(--color-mist); }
.cal-tile.cal-none { color: var(--color-text-soft); }
.cal-tile.cal-done { background: #eaf3ea; border-color: #cfe4cf; color: var(--color-success); }
.cal-tile.cal-open { background: #fbf1e2; border-color: #f0dcb8; color: #8a5a20; cursor: pointer; }
.cal-tile.cal-open.cal-urgent { background: #fbeaea; border-color: #f0caca; color: var(--color-error); }
/* Zeiten erfasst, aber unter dem Soll: eigener, echter Gelbton – bewusst anders als
   das Amber von "Bericht fehlt", damit beide Zustände unterscheidbar bleiben. */
.cal-tile.cal-under-hours { background: #fff8dd; border-color: #f0e2a3; color: #7a6a1f; cursor: pointer; }
.cal-tile.cal-open:hover, .cal-tile.cal-done:hover, .cal-tile.cal-under-hours:hover { transform: translateY(-2px); transition: transform .15s var(--ease); }
.cal-tile-num { font-family: var(--font-heading); font-weight: 600; }
.cal-tile-badge { font-size: .68rem; }
.cal-tile-client { font-size: .62rem; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0 .15rem; }
.cal-tile-hours { font-size: .68rem; font-weight: 600; font-variant-numeric: tabular-nums; }

/* Ferien-Kennzeichnung: dezenter Rahmen + kleines Icon, überlagert den normalen
   Status (Erfasst/Offen/Wochenende) statt ihn zu ersetzen – beides bleibt sichtbar. */
.cal-tile.cal-ferien { box-shadow: inset 0 0 0 2px #d9a441; cursor: pointer; }
.cal-tile-ferien-icon { position: absolute; top: 2px; right: 4px; font-size: .7rem; line-height: 1; }

/* Admin-Ansicht zeigt mehr Inhalt pro Kachel (Klient + Stunden) – dafür etwas mehr
   Platz als die reine Status-Kachel der Mitarbeiter-Ansicht. */
.cal-grid.cal-grid-detailed .cal-tile { aspect-ratio: auto; min-height: 64px; }

.cal-legend { display: flex; flex-wrap: wrap; gap: .9rem; font-size: .8rem; color: var(--color-text-soft); margin-bottom: 1.2rem; }
.cal-legend span { display: inline-flex; align-items: center; gap: .4rem; }
.cal-legend .dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.cal-legend .dot.done { background: var(--color-success); }
.cal-legend .dot.open { background: #d99a3d; }
.cal-legend .dot.under-hours { background: #d9b53d; }
.cal-legend .dot.urgent { background: var(--color-error); }
.cal-legend .dot.weekend { background: var(--color-text-soft); }

.cal-day-detail {
  background: var(--color-surface);
  border: 1px solid var(--color-line);
  border-radius: var(--radius-sm);
  padding: 1rem 1.2rem;
  margin-bottom: 1.5rem;
}

.overview-table { display: flex; flex-direction: column; gap: .6rem; margin-bottom: 1.5rem; }
.overview-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .8rem;
  background: var(--color-surface);
  border: 1px solid var(--color-line);
  border-radius: var(--radius-sm);
  padding: .8rem 1.1rem;
  flex-wrap: wrap;
}
.overview-row.overview-urgent { border-color: #f0caca; background: #fdf5f5; }
.overview-row .who { font-family: var(--font-heading); font-weight: 600; color: var(--color-taupe-dark); }
.overview-row .what { font-size: .85rem; color: var(--color-text-soft); }

/* ---------- Konten-Tabelle (Stundenkonto pro Mitarbeiter) ---------- */

.konten-wrap {
  overflow-x: auto;
  background: var(--color-surface);
  border: 1px solid var(--color-line);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-soft);
  margin-bottom: 1.5rem;
}
.konten-table { width: 100%; border-collapse: collapse; min-width: 480px; }
.konten-table th, .konten-table td { padding: .85rem 1.1rem; text-align: left; font-size: .9rem; white-space: nowrap; }
.konten-table th {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: .74rem;
  text-transform: uppercase;
  letter-spacing: .03em;
  color: var(--color-text-soft);
  border-bottom: 2px solid var(--color-line);
}
.konten-table td { border-bottom: 1px solid var(--color-line); }
.konten-table tr:last-child td { border-bottom: none; }
.konten-table td.numeric { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.konten-table td.numeric.negative { color: var(--color-error); }
.konten-table td.numeric.positive { color: var(--color-success); }
.konten-table .art-label { color: var(--color-rose-deep); font-weight: 600; }

/* ---------- Druckansicht (Bericht als PDF) ---------- */

.print-toolbar {
  max-width: 720px;
  margin: 1rem auto;
  padding: 0 1rem;
  display: flex;
  justify-content: space-between;
  gap: .8rem;
}

.print-page {
  max-width: 720px;
  margin: 0 auto 2rem;
  background: #fff;
  padding: 3rem 3.5rem;
  box-shadow: var(--shadow);
  border-radius: var(--radius-sm);
}

.print-letterhead {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding-bottom: 1.2rem;
  border-bottom: 2px solid var(--color-line);
  margin-bottom: 1.8rem;
}
.print-letterhead img { width: 56px; height: 56px; flex: none; }
.print-letterhead .org-name { font-family: var(--font-heading); font-weight: 700; font-size: 1.15rem; color: var(--color-taupe-dark); }
.print-letterhead .org-address { font-size: .85rem; color: var(--color-text-soft); line-height: 1.4; margin-top: .1rem; }
.print-letterhead .letterhead-right { margin-left: auto; text-align: right; font-size: .82rem; color: var(--color-text-soft); }

.print-title { font-size: 1.4rem; margin-bottom: 1.4rem; }

.print-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .8rem 1.5rem;
  margin-bottom: 1.6rem;
  font-size: .92rem;
}
.print-meta dt { font-family: var(--font-heading); font-weight: 600; color: var(--color-taupe-dark); font-size: .75rem; text-transform: uppercase; letter-spacing: .03em; margin: 0; }
.print-meta dd { margin: .2rem 0 0; }

.print-notes {
  white-space: pre-wrap;
  line-height: 1.65;
  font-size: .95rem;
  border-top: 1px solid var(--color-line);
  padding-top: 1.3rem;
}
.print-notes h3 { font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; color: var(--color-taupe-dark); margin-bottom: .6rem; }

.print-footer {
  margin-top: 2.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--color-line);
  font-size: .72rem;
  color: var(--color-text-soft);
}

@media print {
  body { background: #fff; }
  .no-print { display: none !important; }
  .print-page { box-shadow: none; margin: 0; padding: 0; max-width: none; border-radius: 0; }
  /* Browser lassen Hintergrundfarben beim Drucken sonst standardmäßig weg
     (Tintensparen) – das Kategorie-Badge im Briefkopf braucht seine Farbe aber. */
  .kategorie-badge {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
}

/* ---------- Buchhaltung / Rechnungen ---------- */

.container-wide { width: min(100% - 2rem, 1500px); }

.acc-toolbar { display: flex; flex-wrap: wrap; gap: .6rem; align-items: flex-end; margin-bottom: 1rem; }
.acc-toolbar .field { margin: 0; min-width: 9rem; }
.acc-toolbar .field label { font-size: .74rem; }
.acc-toolbar .field input, .acc-toolbar .field select { padding: .5rem .65rem; }
.acc-toolbar .grow { flex: 1 1 14rem; }
.acc-toolbar .spacer { margin-left: auto; display: flex; gap: .5rem; flex-wrap: wrap; }

.acc-table th, .acc-table td { padding: .6rem .8rem; }
.acc-table td.num, .acc-table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.acc-table td.center, .acc-table th.center { text-align: center; }
.acc-table tbody tr.row-click { cursor: pointer; }
.acc-table tbody tr.row-click:hover td { background: var(--color-bg-soft); }
.acc-table tfoot td { font-weight: 700; border-top: 2px solid var(--color-line); border-bottom: none; background: var(--color-bg); }
.acc-table tr.group-head td { background: var(--color-bg-soft); font-family: var(--font-heading); font-weight: 700; color: var(--color-taupe-dark); }
.acc-table tr.group-sum td { font-weight: 700; border-bottom: 2px solid var(--color-line); }
.acc-table td.clip { max-width: 22rem; overflow: hidden; text-overflow: ellipsis; }
.acc-table .neg { color: var(--color-error); }
.acc-table .pos { color: var(--color-success); }
.acc-table input[type="text"], .acc-table input[type="number"], .acc-table select { width: 100%; padding: .35rem .5rem; font-size: .88rem; }

.status-pill { display: inline-block; padding: .12rem .6rem; border-radius: 999px; font-size: .74rem; font-weight: 700; background: var(--color-mist); color: var(--color-text-soft); }
.status-pill.entwurf { background: #f3e6c8; color: #8a6420; }
.status-pill.festgeschrieben { background: #dcebdc; color: var(--color-success); }
.status-pill.storniert { background: #f0d9d9; color: var(--color-error); }
.status-pill.gutschrift { background: #e2dcef; color: #5b4c85; }
.status-pill.mahnung { background: #f0d9d9; color: var(--color-error); }

.acc-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); gap: .8rem; margin-bottom: 1rem; }
.acc-card { background: var(--color-surface); border: 1px solid var(--color-line); border-radius: var(--radius-sm); padding: .8rem 1rem; box-shadow: var(--shadow-soft); }
.acc-card span { display: block; font-size: .74rem; text-transform: uppercase; letter-spacing: .03em; color: var(--color-text-soft); }
.acc-card strong { font-size: 1.25rem; font-family: var(--font-heading); }

.modal.modal-xl { width: min(96vw, 1100px); max-width: none; }
.acc-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); gap: .8rem 1.2rem; }
.acc-kv { font-size: .9rem; }
.acc-kv dt { font-size: .72rem; text-transform: uppercase; letter-spacing: .03em; color: var(--color-text-soft); font-family: var(--font-heading); font-weight: 600; }
.acc-kv dd { margin: .1rem 0 .6rem; }
.acc-section { margin: 1.2rem 0 .5rem; font-size: 1rem; }
.acc-history { list-style: none; margin: 0; padding: 0; font-size: .86rem; }
.acc-history li { padding: .4rem 0; border-bottom: 1px solid var(--color-line); display: flex; gap: .8rem; }
.acc-history time { color: var(--color-text-soft); white-space: nowrap; min-width: 9.5rem; }
.acc-totals { margin-left: auto; width: min(100%, 22rem); font-size: .92rem; }
.acc-totals div { display: flex; justify-content: space-between; padding: .25rem 0; }
.acc-totals .total { border-top: 2px solid var(--color-line); font-weight: 700; font-size: 1.05rem; }
.form-actions.wrap { flex-wrap: wrap; }
.field-row.three { grid-template-columns: repeat(3, 1fr); }
.hint-box { font-size: .84rem; color: var(--color-text-soft); background: var(--color-bg); border: 1px dashed var(--color-line); border-radius: var(--radius-sm); padding: .6rem .8rem; margin: .6rem 0; }

/* Rechnung (Druck) */
.invoice-page { position: relative; }
.invoice-page .watermark { position: absolute; top: 40%; left: 50%; transform: translate(-50%, -50%) rotate(-25deg); font-size: 6rem; font-weight: 800; color: rgb(176 86 86 / .12); pointer-events: none; letter-spacing: .1em; }
.invoice-addr-row { display: flex; justify-content: space-between; gap: 2rem; margin-bottom: 2rem; }
.invoice-addr { font-size: .95rem; line-height: 1.45; }
.invoice-addr .sender-line { font-size: .68rem; color: var(--color-text-soft); text-decoration: underline; margin-bottom: .4rem; }
.invoice-meta { font-size: .85rem; min-width: 15rem; }
.invoice-meta div { display: flex; justify-content: space-between; gap: 1rem; padding: .12rem 0; }
.invoice-meta span:first-child { color: var(--color-text-soft); }
.invoice-items { width: 100%; border-collapse: collapse; margin: 1.2rem 0; font-size: .9rem; }
.invoice-items th { text-align: left; font-size: .72rem; text-transform: uppercase; letter-spacing: .03em; color: var(--color-text-soft); border-bottom: 2px solid var(--color-line); padding: .4rem .3rem; }
.invoice-items td { padding: .5rem .3rem; border-bottom: 1px solid var(--color-line); vertical-align: top; }
.invoice-items .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.invoice-text { white-space: pre-wrap; font-size: .92rem; line-height: 1.55; margin: .8rem 0; }

@media print {
  .invoice-page .watermark { color: rgb(176 86 86 / .15); -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* ---------- Seitenleiste (Büropersonal) ---------- */

.app-sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 250px;
  z-index: 70;
  display: flex;
  flex-direction: column;
  background: var(--color-taupe-dark);
  color: #f4ece8;
  overflow-y: auto;
  transform: translateX(-100%);
  transition: transform .25s var(--ease);
  padding-bottom: 2rem;
}
.sidebar-brand {
  display: flex; align-items: center; gap: .6rem;
  padding: 1rem 1.1rem;
  font-family: var(--font-heading); font-weight: 700; color: #fff;
  border-bottom: 1px solid rgb(255 255 255 / .12);
}
.sidebar-brand .brand-mark { width: 32px; height: 32px; }
.app-sidebar nav { padding: .6rem .5rem; display: flex; flex-direction: column; gap: .15rem; }
.app-sidebar a, .app-sidebar summary {
  display: flex; align-items: center; gap: .65rem;
  padding: .6rem .8rem;
  border-radius: 10px;
  color: #eadfda;
  font-family: var(--font-heading); font-weight: 600; font-size: .92rem;
  cursor: pointer; list-style: none;
}
.app-sidebar summary::-webkit-details-marker { display: none; }
.app-sidebar a:hover, .app-sidebar summary:hover { background: rgb(255 255 255 / .09); color: #fff; }
.app-sidebar a.active { background: var(--color-rose-deep); color: #fff; }
.nav-icon { width: 1.3rem; text-align: center; opacity: .85; }
.nav-caret { margin-left: auto; transition: transform .2s var(--ease); opacity: .7; }
.nav-group[open] > summary .nav-caret { transform: rotate(90deg); }
.nav-group[open] > summary { color: #fff; }
.nav-items { display: flex; flex-direction: column; gap: .1rem; padding: .1rem 0 .4rem 2.1rem; }
.nav-items a { font-weight: 500; font-size: .88rem; padding: .45rem .75rem; }

.sidebar-backdrop { display: none; position: fixed; inset: 0; background: rgb(0 0 0 / .4); z-index: 60; }
body.menu-open .app-sidebar { transform: none; box-shadow: var(--shadow); }
body.menu-open .sidebar-backdrop { display: block; }

.menu-btn { font-size: 1.3rem; }
.app-header-wide { padding-inline: 1rem; }
.app-header-wide .user-chip { margin-left: auto; }
.brand-mobile { margin-right: auto; margin-left: .5rem; }

@media (min-width: 1000px) {
  body.has-sidebar { padding-left: 250px; }
  .app-sidebar { transform: none; }
  .menu-btn, .brand-mobile { display: none; }
  .sidebar-backdrop { display: none !important; }
}

/* ---------- Personalakte (Mitarbeiterprofil) ---------- */

.hr-head { display: flex; align-items: center; gap: 1rem; margin-bottom: 1rem; }
.hr-avatar {
  width: 52px; height: 52px; border-radius: 50%; flex: none;
  display: grid; place-items: center;
  background: var(--color-rose); color: #fff;
  font-family: var(--font-heading); font-weight: 700; font-size: 1.3rem;
}
.hr-head h1 { margin: 0; font-size: 1.5rem; font-weight: 500; }
.hr-head .hr-actions { margin-left: auto; display: flex; gap: .5rem; flex-wrap: wrap; }
.hr-tabs { display: flex; gap: .3rem; overflow-x: auto; margin-bottom: 1.2rem; border-bottom: 1px solid var(--color-line); padding-bottom: .7rem; }
.hr-tabs a { font-family: var(--font-heading); font-weight: 600; font-size: .88rem; color: var(--color-taupe); padding: .45rem .95rem; border-radius: 999px; white-space: nowrap; }
.hr-tabs a:hover { background: var(--color-bg-soft); }
.hr-tabs a.active { background: var(--color-rose-deep); color: #fff; }
.hr-tabs a.ext::after { content: ' ↗'; opacity: .6; }
.hr-columns { display: grid; grid-template-columns: repeat(auto-fit, minmax(20rem, 1fr)); gap: 1rem; align-items: start; }
.hr-card { background: var(--color-surface); border: 1px solid var(--color-line); border-radius: var(--radius-sm); box-shadow: var(--shadow-soft); margin-bottom: 1rem; overflow: hidden; }
.hr-card > h2 { margin: 0; padding: .7rem 1rem; font-size: .88rem; letter-spacing: .06em; text-transform: uppercase; background: var(--color-taupe-dark); color: #fff; font-weight: 600; }
.hr-card-body { padding: .9rem 1rem 1rem; }
.hr-row { display: grid; grid-template-columns: 9rem 1fr; gap: .6rem; align-items: center; padding: .3rem 0; }
.hr-row > label { color: var(--color-text-soft); font-size: .92rem; }
.hr-row input, .hr-row select, .hr-row textarea { width: 100%; }
.hr-row .inline { display: flex; gap: .6rem; }
.hr-toggle { display: flex; align-items: center; gap: .5rem; font-size: .92rem; }
.hr-list-row { display: flex; align-items: center; gap: .6rem; padding: .45rem 0; border-bottom: 1px solid var(--color-line); font-size: .92rem; }
.hr-list-row:last-child { border-bottom: none; }
.hr-list-row .grow { flex: 1; }
@media (max-width: 560px) { .hr-row { grid-template-columns: 1fr; gap: .2rem; } }

/* Kilanka-ähnliche Eingabefelder mit Unterstrich in der Personalakte */
.hr-row input:not([type="checkbox"]), .hr-row select, .hr-row textarea {
  font: inherit; color: var(--color-text);
  padding: .45rem .3rem; border: 0; border-bottom: 1.5px solid var(--color-line);
  border-radius: 0; background: transparent;
}
.hr-row input:focus, .hr-row select:focus, .hr-row textarea:focus { outline: none; border-bottom-color: var(--color-rose-deep); }
.hr-row textarea { min-height: 6rem; border: 1.5px solid var(--color-line); border-radius: var(--radius-sm); padding: .5rem .6rem; resize: vertical; }
.hr-row input:disabled { color: var(--color-text-soft); }
.acc-table input:not([type="checkbox"]), .acc-table select { font: inherit; border: 1.5px solid var(--color-line); border-radius: 8px; background: var(--color-bg); }

/* Kompaktere Tabellen, damit breite Listen (z. B. Rechnungen) neben der Seitenleiste ohne Scrollen passen */
.acc-table th, .acc-table td { padding: .55rem .6rem; font-size: .86rem; }
.acc-table td.clip { max-width: 14rem; }

/* Spalten mit "nice to have"-Zusatzinfos (z. B. Personalnummer, Ort): blenden zuerst aus,
   bevor eine Tabelle horizontal scrollen muss – Name/Rolle/Status bleiben immer sichtbar. */
@media (max-width: 960px) {
  .col-low { display: none; }
}
.mitarbeiter-table .icon-btn { width: 30px; height: 30px; font-size: 1rem; vertical-align: middle; }
.mitarbeiter-table td.center { white-space: nowrap; }
.row-chevron { display: inline-block; margin-left: .3rem; color: var(--color-text-soft); opacity: .6; vertical-align: middle; }
.mitarbeiter-table tbody tr.row-click:hover .row-chevron { opacity: 1; color: var(--color-rose-deep); }

/* Abrechnungsart ist auf schmaleren Bildschirmen nachrangig (steht im Beleg-Detail) */
@media (max-width: 1599px) { .col-art { display: none; } }

.sidebar-version { margin-top: auto; padding: .8rem 1.1rem 0; font-size: .75rem; color: rgb(255 255 255 / .5); }
