:root {
  --blau: #c4141c; --blau-hell: #fcebec; --marke: #d2121a; --text: #1b1f24; --grau: #5f6b7a; --linie: #d5dbe3;
  --hinter: #f4f6f9; --weiss: #fff; --gruen: #1e7a46; --gruen-hell: #e3f4ea; --rot: #7a1014; --gelb: #fff4d6;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--text); background: var(--hinter); }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--blau); }
h1 { font-size: 1.3rem; margin: 0 0 .6rem; }
h2 { font-size: 1.1rem; margin: 1.2rem 0 .5rem; }
.klein { font-size: .85rem; color: var(--grau); }
.fehler { background: #fde8e7; color: var(--rot); padding: .6rem .8rem; border-radius: 8px; margin: .5rem 0; }
.hinweis { background: var(--gelb); padding: .6rem .8rem; border-radius: 8px; margin: .5rem 0; }
.ok { background: var(--gruen-hell); color: var(--gruen); padding: .6rem .8rem; border-radius: 8px; margin: .5rem 0; }

input[type=text], input[type=password], input[type=date], input[type=time], input[type=number], input[type=search], select, textarea {
  width: 100%; padding: .7rem .75rem; border: 1px solid var(--linie); border-radius: 10px; background: var(--weiss); min-height: 48px;
}
textarea { min-height: 9rem; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--blau); outline-offset: 0; border-color: var(--blau); }
label { display: block; font-weight: 600; margin: .8rem 0 .3rem; }

.knopf { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; min-height: 48px; padding: .6rem 1.1rem;
  border: 1px solid var(--blau); background: var(--blau); color: #fff; border-radius: 10px; font-weight: 600; cursor: pointer; text-decoration: none; }
.knopf.hell { background: var(--weiss); color: var(--blau); }
.knopf.rot { background: var(--weiss); color: var(--rot); border-color: var(--rot); }
.knopf.klein-k { min-height: 36px; padding: .3rem .7rem; font-size: .9rem; }
.knopf:disabled { opacity: .5; cursor: default; }
.knopf.breit { width: 100%; }

/* ---------- Handy ---------- */
.kopf { position: sticky; top: 0; z-index: 5; background: var(--weiss); color: var(--text); padding: .55rem 1rem .5rem; border-bottom: 3px solid var(--marke); }
.kopf .zeile { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.kopf-knoepfe { display: flex; gap: .4rem; }
.kopf-knopf { background: var(--weiss); border: 1px solid var(--linie); color: var(--text); border-radius: 8px; padding: .3rem .6rem; min-height: 36px; font-size: .9rem; text-decoration: none; display: inline-flex; align-items: center; cursor: pointer; }
.kopf-titel { font-weight: 700; margin-top: .35rem; font-size: .95rem; }
.logo { display: inline-flex; align-items: center; gap: .5rem; }
.logo-signet { height: 38px; width: auto; display: block; }
.logo-schrift { height: 30px; width: auto; display: block; }
.fortschritt { display: flex; gap: 4px; margin-top: .4rem; }
.fortschritt span { flex: 1; height: 5px; border-radius: 3px; background: var(--linie); }
.fortschritt span.an { background: var(--marke); }
main.handy { padding: 1rem 1rem 7rem; max-width: 640px; margin: 0 auto; }
.fuss { position: fixed; left: 0; right: 0; bottom: 0; background: var(--weiss); border-top: 1px solid var(--linie);
  padding: .6rem 1rem calc(.6rem + env(safe-area-inset-bottom)); display: flex; gap: .6rem; z-index: 5; }
.fuss .knopf { flex: 1; }
.schritt-titel { font-size: 1.35rem; font-weight: 700; margin: .2rem 0 .8rem; }

.chips { display: flex; flex-wrap: wrap; gap: .5rem; margin: .3rem 0 .8rem; }
.chip { border: 1px solid var(--linie); background: var(--weiss); border-radius: 999px; padding: .55rem .9rem; min-height: 44px; cursor: pointer; text-align: left; }
.chip.an { background: var(--blau); border-color: var(--blau); color: #fff; }
.chip .nr { opacity: .7; font-size: .85em; margin-right: .3rem; }
.liste { background: var(--weiss); border: 1px solid var(--linie); border-radius: 10px; overflow: hidden; margin-top: .4rem; max-height: 50vh; overflow-y: auto; }
.liste button { display: flex; width: 100%; text-align: left; gap: .6rem; padding: .75rem .9rem; border: 0; border-bottom: 1px solid var(--linie); background: none; min-height: 48px; cursor: pointer; }
.liste button:last-child { border-bottom: 0; }
.liste button.an { background: var(--blau-hell); font-weight: 600; }
.liste .nr { color: var(--grau); min-width: 3.5rem; }
.aufklapp { margin-top: .6rem; }
.aufklapp > summary { cursor: pointer; padding: .7rem .9rem; border: 1px dashed var(--blau); border-radius: 10px; color: var(--blau); font-weight: 600; list-style: none; }
.aufklapp[open] > summary { margin-bottom: .5rem; }

.karte { background: var(--weiss); border: 1px solid var(--linie); border-radius: 12px; padding: .8rem .9rem; margin: .6rem 0; }
.karte .titel { display: flex; justify-content: space-between; align-items: center; gap: .5rem; font-weight: 600; }
.karte .x { border: 0; background: none; color: var(--rot); font-size: 1.4rem; line-height: 1; min-width: 40px; min-height: 40px; cursor: pointer; }
.segment { display: flex; border: 1px solid var(--blau); border-radius: 10px; overflow: hidden; margin-top: .5rem; }
.segment button { flex: 1; border: 0; background: var(--weiss); color: var(--blau); padding: .5rem 0; min-height: 42px; font-weight: 600; cursor: pointer; }
.segment button + button { border-left: 1px solid var(--blau); }
.segment button.an { background: var(--blau); color: #fff; }
.zwei { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
.drei { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: .5rem; align-items: end; }
.menge { display: flex; align-items: center; gap: .4rem; margin-top: .5rem; }
.menge button { width: 48px; height: 48px; border-radius: 10px; border: 1px solid var(--linie); background: var(--hinter); font-size: 1.3rem; cursor: pointer; }
.menge input { text-align: center; max-width: 7rem; }
.menge .einheit { color: var(--grau); }
.diktat { margin: .5rem 0; }
.diktat.laeuft { background: var(--rot); border-color: var(--rot); color: #fff; }
.fotos { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: .5rem; margin-top: .6rem; }
.fotos figure { margin: 0; position: relative; }
.fotos img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; display: block; border: 1px solid var(--linie); }
.fotos button { position: absolute; top: 4px; right: 4px; background: rgba(0,0,0,.6); color: #fff; border: 0; border-radius: 50%; width: 30px; height: 30px; cursor: pointer; }
.uebersicht dt { font-weight: 600; margin-top: .6rem; color: var(--grau); font-size: .9rem; }
.uebersicht dd { margin: .1rem 0 0; white-space: pre-wrap; }
.mitte { text-align: center; }
.gross-ok { font-size: 3rem; color: var(--gruen); }

/* ---------- Büro ---------- */
.leiste { background: var(--weiss); color: var(--text); display: flex; align-items: center; gap: 1.1rem; padding: .5rem 1.2rem; flex-wrap: wrap; border-bottom: 3px solid var(--marke); }
.leiste a, .leiste button { color: var(--text); text-decoration: none; background: none; border: 0; cursor: pointer; padding: .3rem .2rem; font-weight: 600; }
.leiste a:hover, .leiste button:hover { color: var(--blau); }
.leiste .name { margin-left: auto; color: var(--grau); font-size: .9rem; }
.leiste .logo { margin-right: .4rem; }
.leiste .logo-signet { height: 42px; } .leiste .logo-schrift { height: 32px; }
.leiste .app-name { font-weight: 700; font-size: 1.05rem; color: var(--grau); margin-right: .8rem; padding-left: .8rem; border-left: 1px solid var(--linie); }
main.buero { padding: 1rem 1.2rem 3rem; max-width: 1200px; margin: 0 auto; }
.filter { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .6rem; align-items: end; background: var(--weiss); padding: .8rem; border-radius: 12px; border: 1px solid var(--linie); }
.filter label { margin: 0 0 .2rem; font-size: .85rem; }
.projekt { background: var(--weiss); border: 1px solid var(--linie); border-radius: 12px; margin: 1rem 0; overflow: hidden; }
.projekt > header { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: .7rem 1rem; background: var(--blau-hell); flex-wrap: wrap; }
.projekt > header h2 { margin: 0; font-size: 1.05rem; }
table.tab { width: 100%; border-collapse: collapse; }
table.tab th, table.tab td { text-align: left; padding: .5rem .7rem; border-bottom: 1px solid var(--linie); vertical-align: top; }
table.tab th { font-size: .82rem; color: var(--grau); font-weight: 600; }
table.tab tr:last-child td { border-bottom: 0; }
td.zahl, th.zahl { text-align: right; white-space: nowrap; }
.marke { display: inline-block; padding: .1rem .5rem; border-radius: 999px; font-size: .8rem; font-weight: 600; }
.marke.neu { background: var(--gelb); color: #7a5b00; }
.marke.geprueft { background: #e8f0fb; color: #1d4f91; }
.marke.abgerechnet { background: var(--gruen-hell); color: var(--gruen); }
.kurz { color: var(--grau); font-size: .88rem; max-width: 34rem; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.raster { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.feld { background: var(--weiss); border: 1px solid var(--linie); border-radius: 12px; padding: .9rem 1rem; margin: 1rem 0; }
.feld h2 { margin-top: 0; }
.feld.buero-feld { border-color: #c9a227; background: #fffbea; }
table.edit { width: 100%; border-collapse: collapse; }
table.edit td, table.edit th { padding: .25rem .3rem; text-align: left; font-size: .9rem; }
table.edit input, table.edit select { min-height: 40px; padding: .4rem .5rem; }
.knoepfe { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; }
.favwahl { columns: 3 220px; }
.favwahl label { font-weight: 400; margin: .15rem 0; display: flex; gap: .4rem; align-items: flex-start; break-inside: avoid; }
.favwahl input { width: auto; min-height: 0; margin-top: .25rem; }
@media (max-width: 760px) {
  .raster { grid-template-columns: 1fr; }
  main.buero { padding: .8rem; }
  table.tab .weg { display: none; }
}

/* Stammdaten */
.reiter { display: flex; gap: .4rem; flex-wrap: wrap; margin: .5rem 0 0; }
.reiter a { padding: .55rem 1rem; border: 1px solid var(--linie); border-bottom: 0; border-radius: 10px 10px 0 0; background: var(--hinter); color: var(--text); text-decoration: none; font-weight: 600; }
.reiter a.an { background: var(--weiss); color: var(--blau); border-color: var(--blau); }
.reiter a .klein { font-weight: 400; margin-left: .3rem; }
.reiter + .feld { margin-top: 0; border-top-left-radius: 0; }
table.stamm td { vertical-align: middle; }
table.stamm input[type=text], table.stamm select { min-height: 38px; padding: .35rem .5rem; }
table.stamm input[type=checkbox] { width: 22px; height: 22px; }
table.stamm tr.aus td { background: #f6f6f6; color: var(--grau); }

.sammelleiste { position: sticky; bottom: 0; background: var(--weiss); border: 1px solid var(--linie); border-radius: 12px; padding: .6rem .9rem; display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; box-shadow: 0 -2px 10px rgba(0,0,0,.06); }
.sammelleiste .klein { margin-right: auto; }

.wahl input[type=text] { margin-top: .35rem; }
label.haken { display: flex; align-items: center; gap: .5rem; font-weight: 600; margin-top: .9rem; cursor: pointer; }
label.haken input { width: 22px; height: 22px; min-height: 0; }
.wahl select { min-width: 12rem; }

/* Suchfeld mit Vorschlagsliste (Büro) */
.kombi { position: relative; }
.kombi-feld { background-image: linear-gradient(45deg, transparent 50%, var(--grau) 50%), linear-gradient(135deg, var(--grau) 50%, transparent 50%);
  background-position: calc(100% - 16px) 52%, calc(100% - 11px) 52%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 2rem !important; }
.kombi.frei .kombi-feld { border-style: dashed; border-color: #c9a227; }
.kombi-liste { position: absolute; z-index: 20; left: 0; right: 0; top: calc(100% + 2px); min-width: 18rem; max-height: 320px; overflow-y: auto;
  background: var(--weiss); border: 1px solid var(--linie); border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.12); }
.kombi-eintrag { display: flex; gap: .6rem; padding: .5rem .7rem; cursor: pointer; border-bottom: 1px solid #eef1f4; font-size: .92rem; }
.kombi-eintrag:hover, .kombi-eintrag.an { background: var(--blau-hell); }
.kombi-eintrag .nr { color: var(--grau); min-width: 3.2rem; }
.kombi-kopf { padding: .35rem .7rem; font-size: .75rem; font-weight: 700; color: var(--grau); background: var(--hinter); text-transform: uppercase; letter-spacing: .03em; }
.kombi-frei { padding: .5rem .7rem; font-size: .88rem; color: #7a5b00; background: #fffbea; cursor: pointer; }

.janein { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; margin: 1rem 0; }
.janein button { min-height: 96px; font-size: 1.4rem; font-weight: 700; border-radius: 14px; border: 2px solid var(--linie); background: var(--weiss); cursor: pointer; }
.janein button.an { background: var(--blau); border-color: var(--blau); color: #fff; }
