:root {
  --bg: #f5f2ec;
  --flaeche: #ffffff;
  --flaeche-2: #faf8f4;
  --tinte: #1f1d1a;
  --gedaempft: #6b665c;
  --linie: #e3ddd1;
  --gold: #8c7648;
  --gold-dunkel: #6f5d37;
  --gold-hell: #f1ebdd;
  --rot: #b3261e;
  --rot-hell: #fbeceb;
  --gruen: #256b43;
  --gruen-hell: #e7f4ec;
  --gelb: #7a5500;
  --gelb-hell: #fdf3dc;
  --blau: #2f5f8a;
  --blau-hell: #e8f0f8;
  --rand: #8f8778;
  --radius: 10px;
  --schatten: 0 1px 2px rgba(31, 29, 26, .06), 0 2px 8px rgba(31, 29, 26, .04);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--tinte);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
a { color: var(--gold-dunkel); }
h1 { font-size: 1.55rem; line-height: 1.25; margin: 0 0 .25rem; letter-spacing: -.01em; }
h2 { font-size: 1.1rem; margin: 0 0 .75rem; }
h3 { font-size: .95rem; margin: 1rem 0 .5rem; }
p { margin: 0 0 .75rem; }
.gedaempft { color: var(--gedaempft); }
.klein { font-size: .85rem; }

/* Kopf */
.kopf {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: .6rem 1rem; background: var(--flaeche); border-bottom: 1px solid var(--linie);
  position: sticky; top: 0; z-index: 5;
}
.marke { display: flex; align-items: center; gap: .75rem; text-decoration: none; color: var(--tinte); }
.marke img { height: 30px; width: auto; }
.marke span { font-size: .8rem; letter-spacing: .12em; text-transform: uppercase; color: var(--gedaempft);
  border-left: 1px solid var(--linie); padding-left: .75rem; }
.kopf-nav { display: flex; align-items: center; gap: 1rem; font-size: .9rem; }
.kopf-nav form { margin: 0; }
.wer { color: var(--gedaempft); }
@media (max-width: 560px) { .wer, .marke span { display: none; } }

.inhalt { max-width: 980px; margin: 0 auto; padding: 1.5rem 1rem 4rem; }
.schmal { max-width: 440px; margin: 0 auto; padding: 3rem 1rem; }

/* Karten & Raster */
.karte { background: var(--flaeche); border: 1px solid var(--linie); border-radius: var(--radius);
  box-shadow: var(--schatten); padding: 1.25rem; margin-bottom: 1rem; }
.karte > h2:first-child { margin-top: 0; }
.karte-kopf { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; flex-wrap: wrap; }
.raster { display: grid; grid-template-columns: 1fr 1fr; gap: .9rem 1rem; }
.raster .voll { grid-column: 1 / -1; }
.raster > p { margin: 0; }
@media (max-width: 640px) { .raster { grid-template-columns: 1fr; } }
.seitenkopf { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap;
  margin-bottom: 1.25rem; }

/* Formulare */
label, .label { display: block; font-size: .82rem; font-weight: 600; color: var(--gedaempft); margin-bottom: .3rem; }
.pflicht::after { content: " *"; color: var(--gold); }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=tel],
input[type=number], input[type=time], input[type=datetime-local], select, textarea {
  width: 100%; font: inherit; color: var(--tinte); background: var(--flaeche);
  border: 1px solid var(--rand); border-radius: 8px; padding: .6rem .7rem; min-height: 44px;
}
textarea { min-height: 90px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--gold); outline-offset: 1px; border-color: var(--gold); }
input[readonly], input:disabled, select:disabled, textarea:disabled { background: var(--flaeche-2); color: var(--gedaempft); }
.hilfe { font-size: .8rem; color: var(--gedaempft); margin-top: .25rem; }
.feldfehler { font-size: .8rem; color: var(--rot); margin-top: .25rem; }
.wahl { display: flex; gap: .5rem; flex-wrap: wrap; }
.wahl label { display: inline-flex; align-items: center; gap: .45rem; font-weight: 500; color: var(--tinte);
  font-size: .95rem; border: 1px solid var(--rand); border-radius: 8px; padding: .5rem .8rem; min-height: 44px;
  cursor: pointer; margin: 0; background: var(--flaeche); }
.wahl input { accent-color: var(--gold); width: 18px; height: 18px; margin: 0; }
.wahl label:has(input:checked) { border-color: var(--gold); background: var(--gold-hell); }
.check { display: flex; gap: .6rem; align-items: flex-start; font-weight: 500; color: var(--tinte); font-size: .95rem; }
.check input { width: 20px; height: 20px; accent-color: var(--gold); margin-top: 2px; flex: none; }
[hidden] { display: none !important; }

/* Buttons */
.knopf, button.knopf {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem; font: inherit; font-weight: 600;
  background: var(--gold-dunkel); color: #fff; border: 1px solid var(--gold-dunkel); border-radius: 8px; padding: .6rem 1.1rem;
  min-height: 44px; text-decoration: none; cursor: pointer;
}
.knopf:hover { background: #5a4b2c; border-color: #5a4b2c; }
.knopf.zweit { background: var(--flaeche); color: var(--tinte); border-color: var(--rand); }
.knopf.zweit:hover { background: var(--flaeche-2); }
.knopf.gefahr { background: var(--rot); border-color: var(--rot); }
.knopf.klein { min-height: 34px; padding: .3rem .7rem; font-size: .85rem; }
.knopf:disabled { opacity: .5; cursor: not-allowed; }
button.link { background: none; border: 0; padding: 0; font: inherit; color: var(--gold-dunkel); cursor: pointer;
  text-decoration: underline; }
.aktionen { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; margin-top: 1rem; }
.aktionsleiste { position: sticky; bottom: 0; background: rgba(245, 242, 236, .95); backdrop-filter: blur(6px);
  border-top: 1px solid var(--linie); padding: .8rem 1rem; margin: 1rem -1rem 0; display: flex; gap: .6rem;
  flex-wrap: wrap; justify-content: flex-end; }

/* Hinweise & Status */
.hinweis { border-radius: 8px; padding: .75rem 1rem; margin-bottom: 1rem; border: 1px solid; }
.hinweis.ok { background: var(--gruen-hell); border-color: #bfe0cc; color: #1d5234; }
.hinweis.fehler { background: var(--rot-hell); border-color: #f0c6c3; color: #7d1a15; }
.hinweis.info { background: var(--gold-hell); border-color: #e4d8bd; color: #4f4226; }
.hinweis ul { margin: .4rem 0 0; padding-left: 1.2rem; }
.badge { display: inline-block; font-size: .75rem; font-weight: 600; padding: .15rem .55rem; border-radius: 99px;
  white-space: nowrap; }
.badge.grau { background: #eeebe5; color: #57524a; }
.badge.gelb { background: var(--gelb-hell); color: var(--gelb); }
.badge.blau { background: var(--blau-hell); color: var(--blau); }
.badge.gruen { background: var(--gruen-hell); color: var(--gruen); }
.badge.rot { background: var(--rot-hell); color: var(--rot); }

/* Schritte (Mitarbeiterbereich) */
.schritte { list-style: none; padding: 0; margin: 0; display: grid; gap: .75rem; }
.schritt { display: grid; grid-template-columns: 36px 1fr auto; gap: .9rem; align-items: center;
  background: var(--flaeche); border: 1px solid var(--linie); border-radius: var(--radius); padding: 1rem; }
.schritt .nr { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font-weight: 700;
  background: var(--gold-hell); color: var(--gold-dunkel); }
.schritt.erledigt .nr { background: var(--gruen-hell); color: var(--gruen); }
.schritt h3 { margin: 0; font-size: 1rem; }
.schritt p { margin: 0; font-size: .88rem; color: var(--gedaempft); }
@media (max-width: 560px) { .schritt { grid-template-columns: 36px 1fr; } .schritt > :last-child { grid-column: 2; } }

/* Tabellen */
.tabelle { width: 100%; border-collapse: collapse; font-size: .92rem; }
.tabelle th { text-align: left; font-size: .75rem; text-transform: uppercase; letter-spacing: .05em;
  color: var(--gedaempft); font-weight: 600; border-bottom: 1px solid var(--linie); padding: .5rem; }
.tabelle td { border-bottom: 1px solid var(--linie); padding: .65rem .5rem; vertical-align: middle; }
.tabelle tr:last-child td { border-bottom: 0; }
.tabelle a.zeile { color: var(--tinte); font-weight: 600; text-decoration: none; }
.tabelle a.zeile:hover { text-decoration: underline; }
.tabelle-scroll { overflow-x: auto; }
@media (max-width: 640px) {
  .tabelle.stapel thead { display: none; }
  .tabelle.stapel tr { display: block; border-bottom: 1px solid var(--linie); padding: .5rem 0; }
  .tabelle.stapel td { display: block; border: 0; padding: .15rem .25rem; }
}
.zahl { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* Profil-Anzeige */
.daten { display: grid; grid-template-columns: repeat(2, 1fr); gap: .1rem 1.5rem; margin: 0; }
.daten div { display: grid; grid-template-columns: 11rem 1fr; gap: .5rem; padding: .4rem 0;
  border-bottom: 1px dashed var(--linie); font-size: .92rem; }
.daten dt { color: var(--gedaempft); }
.daten dd { margin: 0; font-weight: 500; overflow-wrap: anywhere; }
@media (max-width: 720px) { .daten { grid-template-columns: 1fr; } .daten div { grid-template-columns: 9.5rem 1fr; } }

/* Lohnrechner */
.lohn-layout { display: grid; grid-template-columns: 1.3fr 1fr; gap: 1.25rem; align-items: start; }
@media (max-width: 820px) { .lohn-layout { grid-template-columns: 1fr; } }
.lohnvorschau { position: sticky; top: 70px; background: var(--flaeche-2); border: 1px solid var(--linie);
  border-radius: var(--radius); padding: 1rem; }
.lohnvorschau table { width: 100%; border-collapse: collapse; font-size: .85rem; }
.lohnvorschau td { padding: .22rem .2rem; }
.lohnvorschau tr.sub td, .lohnvorschau tr.total td, .lohnvorschau tr.head td { font-weight: 700; }
.lohnvorschau tr.total td:last-child, .lohnvorschau tr.sub td:last-child { border-top: 1px solid var(--tinte); }
.lohnvorschau tr.grand td { font-weight: 700; font-size: .98rem; border-top: 2px solid var(--tinte);
  border-bottom: 2px solid var(--tinte); padding: .4rem .2rem; }
.lohnvorschau tr.head td { padding-top: .6rem; }
.gruppe { border: 1px solid var(--linie); border-radius: var(--radius); padding: 1rem; margin-bottom: 1rem; }
.gruppe legend { font-weight: 700; font-size: .9rem; padding: 0 .4rem; }
.zeile-2 { display: grid; grid-template-columns: 1.6fr 1fr; gap: .6rem; }

/* Upload */
.upload { border: 1.5px dashed var(--rand); border-radius: var(--radius); padding: .9rem 1rem; background: var(--flaeche-2); }
.upload .kopfzeile { display: flex; justify-content: space-between; align-items: center; gap: .75rem; flex-wrap: wrap; }
.upload ul { list-style: none; padding: 0; margin: .5rem 0 0; font-size: .88rem; }
.upload li { display: flex; justify-content: space-between; gap: .5rem; padding: .25rem 0; }
.upload input[type=file] { position: absolute; width: 1px; height: 1px; opacity: 0; }

/* Unterschrift */
.sigpad { border: 1.5px solid var(--rand); border-radius: var(--radius); background: #fff; position: relative;
  touch-action: none; }
.sigpad canvas { width: 100%; height: 180px; display: block; cursor: crosshair; }
.sigpad .linie { position: absolute; left: 1.25rem; right: 1.25rem; bottom: 40px; border-bottom: 1px solid var(--linie);
  pointer-events: none; }
.sigpad .platzhalter { position: absolute; left: 1.25rem; bottom: 14px; font-size: .8rem; color: var(--gedaempft);
  pointer-events: none; }
.pdfrahmen { width: 100%; height: 70vh; min-height: 420px; border: 1px solid var(--linie); border-radius: var(--radius);
  background: #fff; }
@media (max-width: 640px) { .pdfrahmen { display: none; } }

.linkbox { display: flex; gap: .5rem; }
.linkbox input { font-family: ui-monospace, Menlo, monospace; font-size: .85rem; }
.tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--linie); margin-bottom: 1rem; overflow-x: auto; }
.tabs a { padding: .6rem .9rem; text-decoration: none; color: var(--gedaempft); font-weight: 600; font-size: .92rem;
  border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs a:hover { color: var(--tinte); }
.verlauf { list-style: none; margin: 0; padding: 0; font-size: .88rem; }
.verlauf li { padding: .4rem 0; border-bottom: 1px dashed var(--linie); display: grid; grid-template-columns: 9.5rem 1fr; gap: .5rem; }
details.gefahr summary { cursor: pointer; color: var(--rot); font-weight: 600; }
.abstand-oben { margin-top: 1rem; }
.ohne-rahmen { border: 0; padding: 0; margin: 0; min-width: 0; }
form.inline { display: inline; margin: 0; }
@media (max-width: 560px) { .aktionsleiste .knopf { flex: 1; } }
.umbruch { white-space: pre-wrap; }
/* Grössere Tippflächen am Handy (min. 44 px) */
@media (pointer: coarse) {
  .knopf.klein, button.link { min-height: 44px; }
  button.link { padding: .5rem .2rem; }
}
/* Handy: Kopf nicht fixieren (spart Platz), Navigation seitlich wischbar statt mehrzeilig */
@media (max-width: 600px) {
  .kopf { position: static; }
  .kopf-nav { flex-wrap: nowrap; overflow-x: auto; max-width: 100%; }
}
.hinweis.aufgabe { background: var(--gelb-hell); border-color: #e8d39d; border-left: 4px solid #b8860b; color: #4a3500; }
input[type=file] { font: inherit; max-width: 100%; }
.meldeknoepfe { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
.meldeknoepfe .knopf { min-height: 56px; }
@media (max-width: 420px) { .meldeknoepfe { grid-template-columns: 1fr; } }
#mindestlohn ul:empty { display: none; }
.tabelle tr.zeile-warnung td { background: var(--gelb-hell); }
.warn-text { color: var(--gelb); font-weight: 600; }
.vorlagen { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: .75rem; margin-bottom: 1rem; }
.vorlage { border: 1px solid var(--linie); border-radius: var(--radius); padding: .8rem 1rem; background: var(--flaeche-2); }
.vorlage .aktionen { margin-top: .5rem; }
.wahl-spalten { flex-direction: column; align-items: stretch; }

/* Startseite: Bereichswahl */
.bereiche { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1.25rem; }
.bereich-kachel { display: flex; flex-direction: column; gap: .6rem; min-height: 220px; padding: 1.6rem 1.5rem;
  background: var(--flaeche); border: 1px solid var(--linie); border-top: 4px solid var(--gold); border-radius: var(--radius);
  box-shadow: var(--schatten); color: var(--tinte); text-decoration: none; transition: transform .12s, box-shadow .12s; }
.bereich-kachel.bankett { border-top-color: var(--blau); }
.bereich-kachel:hover, .bereich-kachel:focus-visible { transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(31, 29, 26, .10); }
.bereich-titel { font-size: 1.35rem; font-weight: 700; letter-spacing: -.01em; }
.bereich-text { color: var(--gedaempft); font-size: .92rem; }
.bereich-zahlen { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: auto; }
.bereich-los { font-weight: 600; color: var(--gold-dunkel); }
.bereich-kachel.bankett .bereich-los { color: var(--blau); }

/* Feldgruppen ohne Browser-Rahmen */
fieldset.feldgruppe { border: 0; padding: 0; margin: 0 0 .75rem; min-width: 0; }
fieldset.feldgruppe > legend { padding: 0; margin-bottom: .45rem; }

/* Zwei-Faktor-Anmeldung */
.klein-titel { font-size: 1rem; margin: 1.25rem 0 .5rem; }
.qr-rahmen img { display: block; background: #fff; padding: .5rem; border: 1px solid var(--linie); border-radius: 8px; }
.notfall-codes { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .4rem .8rem;
  font-size: 1.05rem; margin: 0 0 1rem; }
.notfall-codes code { font-family: ui-monospace, Menlo, Consolas, monospace; letter-spacing: .06em; }
.nur-handy { display: none; }
@media (max-width: 700px), (pointer: coarse) { .nur-handy { display: block; } .nur-gross, .qr-rahmen { display: none; } }

/* Konten ohne Personalakte */
.konto-liste { list-style: none; padding: 0; margin: 0; }
.konto-liste li { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .5rem;
  padding: .6rem 0; border-bottom: 1px solid var(--linie); }
.konto-liste .aktionen { margin: 0; }

/* Kader-Häkchen im Kopf der Personalakte */
.kader-form { margin-top: .5rem; }

/* Bankett: Vorschau der persönlichen Signatur */
.signatur-vorschau { font: inherit; white-space: pre-wrap; background: var(--flaeche); border: 1px solid var(--rand); border-radius: 8px; padding: .8rem 1rem; margin: 0; }

/* Bankett: automatisch zugeordnete Mail prüfen */
.zuordnung { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; margin-top: .5rem; }
.zuordnung input.kurz { width: 9rem; }

/* Ein-/Austritts-Checkliste */
.checkliste { list-style: none; margin: 0; padding: 0; }
.checkliste li { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; padding: .45rem 0; border-bottom: 1px solid var(--linie); }
.checkliste li:last-child { border-bottom: 0; }
.checkliste .ck-zeichen { width: 1.4rem; text-align: center; font-weight: 700; color: var(--gedaempft); }
.checkliste li.erledigt .ck-zeichen { color: var(--gruen); }
.checkliste .ck-text { flex: 1 1 16rem; }
.checkliste li.erledigt .ck-text { color: var(--gedaempft); }
.checkliste .ck-aktionen { display: flex; gap: .35rem; }
