/* BaumApp - Baumpflege Resch */
:root {
  --green: #3d7d2a;
  --green-dark: #2f6b25;
  --green-light: #e8f2e3;
  --lime: #8bbf3f;
  --bg: #f3f5ef;
  --card: #ffffff;
  --text: #1f2a1c;
  --muted: #66725f;
  --line: #dde3d6;
  --danger: #b3261e;
  --danger-bg: #fde8e6;
  --radius: 14px;
  --shadow: 0 1px 3px rgba(30, 50, 20, .08), 0 4px 14px rgba(30, 50, 20, .05);
  --tap: 48px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.45;
  background: var(--bg);
  color: var(--text);
  -webkit-tap-highlight-color: transparent;
}
a { color: var(--green-dark); }
[hidden] { display: none !important; }

/* Topbar */
#topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 16px;
  padding: 0 16px; padding-top: env(safe-area-inset-top);
  min-height: 60px;
  background: var(--green-dark); color: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .15);
}
.brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; font-weight: 700; font-size: 18px; white-space: nowrap; }
.brand-mark { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; background: rgba(255, 255, 255, .15); color: var(--lime); }
#nav { display: flex; gap: 4px; flex: 1; }
#nav a {
  color: rgba(255, 255, 255, .85); text-decoration: none; font-weight: 600;
  padding: 0 16px; min-height: 44px; display: flex; align-items: center; border-radius: 10px;
}
#nav a.active { background: rgba(255, 255, 255, .18); color: #fff; }
.userbtn {
  border: 0; background: rgba(255, 255, 255, .15); color: #fff; font: inherit; font-weight: 600;
  min-height: 40px; padding: 0 14px; border-radius: 20px; cursor: pointer; white-space: nowrap;
  max-width: 180px; overflow: hidden; text-overflow: ellipsis;
}

main { max-width: 1100px; margin: 0 auto; padding: 20px 16px 100px; }

/* Typo & Layout */
h1 { font-size: 24px; margin: 0; }
h2 { font-size: 18px; margin: 0 0 12px; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.page-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.page-head h1 { flex: 1; min-width: 200px; }
.back { display: inline-flex; align-items: center; gap: 4px; text-decoration: none; font-weight: 600; margin-bottom: 8px; min-height: 36px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.stack > * + * { margin-top: 16px; }

.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; }
.card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.card-head h2 { flex: 1; margin: 0; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: var(--tap); padding: 0 18px;
  border: 1px solid var(--line); border-radius: 12px;
  background: #fff; color: var(--text); font: inherit; font-weight: 600;
  cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background .15s, transform .05s;
}
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .55; cursor: default; }
.btn-primary { background: var(--green); border-color: var(--green); color: #fff; }
.btn-primary:hover { background: var(--green-dark); }
.btn-danger { color: var(--danger); border-color: #efc4bf; }
.btn-danger-solid { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-sm { min-height: 38px; padding: 0 12px; font-size: 14px; border-radius: 10px; }
.btn-block { width: 100%; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }

/* Toolbar / Suche */
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; align-items: center; }
.search { flex: 1; min-width: 220px; position: relative; }
.search input[type=search] { padding-left: 44px; }
.search svg { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--muted); }

.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.chip {
  border: 1px solid var(--line); background: #fff; color: var(--text);
  min-height: 40px; padding: 0 14px; border-radius: 20px; font: inherit; font-size: 15px; font-weight: 600; cursor: pointer;
}
.chip.active, .chip[aria-pressed="true"] { background: var(--green); border-color: var(--green); color: #fff; }
.chip-toggle { min-height: var(--tap); padding: 0 16px; border-radius: 12px; }
.chip-toggle[aria-pressed="true"]::before { content: "\2713  "; }

/* Listen */
.list { display: flex; flex-direction: column; gap: 10px; }
.item {
  display: flex; align-items: center; gap: 14px;
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 14px 16px; min-height: 72px; text-decoration: none; color: inherit;
}
.item:active { background: var(--green-light); }
.item-main { flex: 1; min-width: 0; }
.item-title { font-weight: 700; font-size: 17px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item-sub { color: var(--muted); font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item-side { text-align: right; flex-shrink: 0; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.nr { font-variant-numeric: tabular-nums; color: var(--muted); font-size: 13px; font-weight: 600; }
.empty { text-align: center; padding: 40px 16px; color: var(--muted); }

/* Status */
.badge { display: inline-block; padding: 3px 10px; border-radius: 12px; font-size: 13px; font-weight: 700; white-space: nowrap; }
.st-besichtigt { background: #e3eefb; color: #1f4f8a; }
.st-angebot { background: #fff1d6; color: #8a5a00; }
.st-beauftragt { background: #e8f2e3; color: #2f6b25; }
.st-erledigt { background: #d8efe9; color: #17614f; }
.st-abgerechnet { background: #ececec; color: #4a4a4a; }
.st-storniert { background: var(--danger-bg); color: var(--danger); }
.status-bar { display: flex; gap: 8px; flex-wrap: wrap; }
.status-bar .chip.active { box-shadow: 0 0 0 2px rgba(61, 125, 42, .25); }

/* Detail-Felder */
.fields { display: grid; grid-template-columns: max-content 1fr; gap: 8px 16px; margin: 0; }
.fields dt { color: var(--muted); font-size: 14px; padding-top: 1px; }
.fields dd { margin: 0; overflow-wrap: anywhere; }
.text-block { white-space: pre-wrap; overflow-wrap: anywhere; }
.text-label { font-size: 14px; color: var(--muted); font-weight: 600; margin: 14px 0 4px; }
.contact-links { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }

/* Massnahmen */
.mass { border: 1px solid var(--line); border-radius: 12px; padding: 14px; background: #fcfdfb; }
.mass + .mass { margin-top: 12px; }
.mass-head { display: flex; align-items: flex-start; gap: 10px; }
.mass-pos { flex-shrink: 0; width: 34px; height: 34px; border-radius: 50%; background: var(--green); color: #fff; display: grid; place-items: center; font-weight: 700; }
.mass-title { flex: 1; min-width: 0; }
.mass-title b { font-size: 17px; }
.tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.tag { background: var(--green-light); color: var(--green-dark); padding: 4px 10px; border-radius: 10px; font-size: 14px; font-weight: 600; }
.tag-z { background: #f0f0ea; color: #4f5649; font-weight: 500; }

/* Formulare */
label { display: block; font-size: 14px; font-weight: 600; margin-bottom: 6px; color: #3b4636; }
input[type=text], input[type=email], input[type=tel], input[type=password], input[type=date], input[type=number], input[type=search], select, textarea {
  width: 100%; font: inherit; font-size: 16px; color: var(--text);
  min-height: var(--tap); padding: 10px 12px;
  border: 1px solid #c9d1c3; border-radius: 10px; background: #fff;
  -webkit-appearance: none; appearance: none;
}
textarea { min-height: 110px; resize: vertical; line-height: 1.4; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--green); box-shadow: 0 0 0 3px rgba(61, 125, 42, .18); }
.form-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 14px; }
.f-6 { grid-column: span 6; } .f-4 { grid-column: span 4; } .f-3 { grid-column: span 3; } .f-2 { grid-column: span 2; }
.form-section { font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; margin: 6px 0 -4px; grid-column: span 6; }
.check { display: flex; align-items: center; gap: 10px; min-height: var(--tap); font-weight: 600; cursor: pointer; }
.check input { width: 22px; height: 22px; accent-color: var(--green); }

/* Modal */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 50; background: rgba(20, 30, 15, .45);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 24px 12px; overflow-y: auto; animation: fade .15s;
}
.modal {
  width: 100%; max-width: 720px; background: #fff; border-radius: 18px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .25); animation: pop .18s; margin: auto 0;
}
.modal-sm { max-width: 460px; }
.modal-head { display: flex; align-items: center; gap: 10px; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.modal-head h2 { flex: 1; margin: 0; }
.modal-close { border: 0; background: transparent; font-size: 28px; line-height: 1; width: 44px; height: 44px; border-radius: 10px; cursor: pointer; color: var(--muted); }
.modal-body { padding: 18px; }
.modal-foot { display: flex; gap: 10px; justify-content: flex-end; padding: 14px 18px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.modal-foot .spacer { flex: 1; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(.98); } }

/* Menue */
.menu { position: fixed; z-index: 40; top: 64px; right: 12px; background: #fff; border-radius: 12px; box-shadow: 0 10px 30px rgba(0, 0, 0, .2); min-width: 220px; overflow: hidden; }
.menu .menu-head { padding: 12px 16px; border-bottom: 1px solid var(--line); font-size: 14px; color: var(--muted); }
.menu button { display: block; width: 100%; text-align: left; border: 0; background: #fff; font: inherit; padding: 0 16px; min-height: 48px; cursor: pointer; }
.menu button:hover { background: var(--green-light); }

/* Toast */
#toast-root { position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 60; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { background: #253021; color: #fff; padding: 12px 18px; border-radius: 12px; box-shadow: 0 6px 20px rgba(0, 0, 0, .25); font-weight: 600; animation: pop .2s; max-width: 90vw; }
.toast.err { background: var(--danger); }

/* Login */
.login-wrap { min-height: 80vh; display: grid; place-items: center; }
.login { width: 100%; max-width: 400px; }
.login .logo { width: 72px; height: 72px; border-radius: 50%; background: var(--green-dark); color: var(--lime); display: grid; place-items: center; margin: 0 auto 12px; }
.login h1 { text-align: center; margin-bottom: 4px; }
.login p { text-align: center; margin-top: 0; }
.err-box { background: var(--danger-bg); color: var(--danger); padding: 12px 14px; border-radius: 10px; font-weight: 600; }

.loading { padding: 40px; text-align: center; color: var(--muted); }
.spinner { width: 32px; height: 32px; border: 3px solid var(--line); border-top-color: var(--green); border-radius: 50%; animation: spin .8s linear infinite; margin: 0 auto 10px; }
@keyframes spin { to { transform: rotate(360deg); } }

table.tbl { width: 100%; border-collapse: collapse; }
.tbl th, .tbl td { text-align: left; padding: 12px 10px; border-bottom: 1px solid var(--line); }
.tbl th { font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.tbl tr.inactive td { color: var(--muted); }

/* Floating Action Button (Tablet/Handy) */
.fab {
  position: fixed; right: 20px; bottom: calc(20px + env(safe-area-inset-bottom)); z-index: 15;
  width: 64px; height: 64px; border-radius: 50%; border: 0;
  background: var(--green); color: #fff; font-size: 34px; line-height: 1;
  box-shadow: 0 6px 18px rgba(47, 107, 37, .45); cursor: pointer; display: none;
}

/* Responsive */
@media (max-width: 860px) {
  .grid-2 { grid-template-columns: 1fr; }
  .brand-text { display: none; }
}
@media (max-width: 640px) {
  #topbar { gap: 8px; padding: 0 10px; }
  #nav a { padding: 0 10px; }
  .userbtn { max-width: 110px; }
  main { padding: 14px 12px 100px; }
  .form-grid { grid-template-columns: 1fr 1fr; }
  .f-6, .f-4, .form-section { grid-column: span 2; }
  .f-3, .f-2 { grid-column: span 1; }
  .fields { grid-template-columns: 1fr; gap: 2px; }
  .fields dd { margin-bottom: 8px; }
  .page-head .btn-hide-sm { display: none; }
  .fab { display: block; }
  .modal-backdrop { padding: 0; }
  .modal { border-radius: 0; min-height: 100%; max-width: none; }
}
@media (hover: hover) {
  .item:hover { box-shadow: 0 2px 6px rgba(30, 50, 20, .12), 0 8px 20px rgba(30, 50, 20, .08); }
  .btn:hover:not(.btn-primary):not(.btn-danger-solid) { background: #f6f8f3; }
}

/* ===== Update 003: Fotos ===== */
.vh { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; pointer-events: none; }
.fotos { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.foto {
  position: relative; width: 96px; height: 96px; border-radius: 10px; overflow: hidden;
  border: 1px solid var(--line); background: #eef1ea; padding: 0; cursor: pointer; flex-shrink: 0;
}
.foto img { width: 100%; height: 100%; object-fit: cover; display: block; }
span.foto { cursor: default; }
.foto-pending { outline: 2px dashed var(--lime); outline-offset: -2px; }
.foto-x {
  position: absolute; top: 4px; right: 4px; width: 30px; height: 30px; border-radius: 50%;
  border: 0; background: rgba(0, 0, 0, .65); color: #fff; font-size: 20px; line-height: 1; cursor: pointer;
}
.foto-add {
  width: 96px; height: 96px; border-radius: 10px; border: 2px dashed #b9c6b1; background: #fff;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  color: var(--green-dark); font-size: 13px; font-weight: 700; cursor: pointer; margin: 0; position: relative;
}
.foto-add:active { background: var(--green-light); }

.lightbox { position: fixed; inset: 0; z-index: 45; background: rgba(10, 14, 8, .96); display: flex; flex-direction: column; animation: fade .15s; }
.lb-top { display: flex; align-items: center; gap: 8px; padding: 10px 12px; padding-top: calc(10px + env(safe-area-inset-top)); color: #fff; }
.lb-count { font-weight: 700; }
.lb-meta { flex: 1; color: rgba(255, 255, 255, .7); font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-btn {
  width: 48px; height: 48px; border-radius: 12px; border: 0; background: rgba(255, 255, 255, .12); color: #fff;
  font-size: 24px; display: grid; place-items: center; cursor: pointer; text-decoration: none;
}
.lb-del:hover { background: var(--danger); }
.lb-stage { flex: 1; position: relative; display: flex; align-items: center; justify-content: center; min-height: 0; padding: 0 8px 12px; }
.lb-stage img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 6px; user-select: none; }
.lb-nav {
  position: absolute; top: 50%; transform: translateY(-50%); width: 56px; height: 80px; border: 0; border-radius: 14px;
  background: rgba(255, 255, 255, .14); color: #fff; font-size: 44px; line-height: 1; cursor: pointer;
}
.lb-prev { left: 10px; } .lb-next { right: 10px; }

/* ===== Update 003: Druckansicht ===== */
.print-toolbar {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 16px;
  background: var(--card); padding: 12px 16px; border-radius: var(--radius); box-shadow: var(--shadow);
}
.print-toolbar .spacer { flex: 1; }
.print-toolbar .check { min-height: 40px; }
.sheet {
  background: #fff; color: #000; max-width: 210mm; margin: 0 auto; padding: 14mm 14mm 10mm;
  box-shadow: var(--shadow); font-family: "Times New Roman", Times, serif; font-size: 11.5pt; line-height: 1.35;
}
.rope { display: block; width: 100%; height: auto; max-height: 14px; object-fit: fill; }
.sheet-head { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px; padding: 8px 2px; }
.sheet-head .firm { font-family: Calibri, Arial, sans-serif; font-size: 8.5pt; line-height: 1.3; }
.sheet-head .firm b { font-size: 10pt; font-weight: 400; }
.sheet-head h1 { font-family: Arial, Helvetica, sans-serif; font-size: 20pt; font-weight: 400; margin: 0; text-align: center; letter-spacing: .01em; }
.seal {
  justify-self: end; width: 84px; height: 84px; border-radius: 50%; border: 4px solid #111; color: #4a9a2a;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  -webkit-print-color-adjust: exact; print-color-adjust: exact;
}
.seal small { font-family: Arial, sans-serif; font-size: 7pt; font-weight: 700; color: #111; margin-top: -2px; }
.pgrid { display: grid; grid-template-columns: 1.15fr 1.15fr 1fr; gap: 3px 14px; margin: 12px 0 6px; }
.kv { display: flex; gap: 6px; min-width: 0; }
.kv span { white-space: nowrap; }
.kv b { font-weight: 400; overflow-wrap: anywhere; font-family: Arial, sans-serif; font-size: 10.5pt; }
.pline { margin: 6px 0; }
.pline b { font-weight: 400; font-family: Arial, sans-serif; }
.p-mass { border-top: 1px solid #999; padding-top: 8px; margin-top: 10px; }
.p-mass h2 { font-size: 12.5pt; margin: 0 0 4px; font-weight: 700; }
.pmeta { margin: 0 0 4px; font-family: Arial, sans-serif; font-size: 10pt; }
.prow { display: grid; grid-template-columns: 92px 1fr; gap: 8px; margin: 4px 0; }
.plabel { white-space: nowrap; }
.pchecks { display: flex; flex-wrap: wrap; gap: 3px 16px; }
.pcheck { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.pbox {
  width: 13px; height: 13px; border: 1.3px solid #000; display: inline-grid; place-items: center;
  font-size: 11px; font-weight: 700; line-height: 1; font-family: Arial, sans-serif;
}
.sheet .text-block { font-family: Arial, sans-serif; font-size: 10.5pt; }
.p-fotos { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 8px; }
.p-fotos img { width: 100%; max-height: 80mm; object-fit: contain; background: #f4f4f4; break-inside: avoid; }
.sheet.no-fotos .p-fotos { display: none; }
.p-intern { display: none; }
.sheet.show-intern .p-intern { display: block; }
.p-text { margin-top: 12px; break-inside: avoid; }
.p-text h3 { font-size: 11.5pt; font-weight: 400; margin: 0 0 3px; }
.p-text .text-block { min-height: 16mm; }
.sheet-foot { margin-top: 14px; border-top: 1px solid #bbb; padding-top: 4px; font-family: Arial, sans-serif; font-size: 8pt; color: #555; text-align: right; }

@media (max-width: 640px) {
  .sheet { padding: 12px; font-size: 10.5pt; }
  .sheet-head { grid-template-columns: 1fr; text-align: center; }
  .sheet-head .firm { order: 3; }
  .seal { justify-self: center; }
  .pgrid { grid-template-columns: 1fr; }
  .p-fotos { grid-template-columns: 1fr; }
  .prow { grid-template-columns: 1fr; gap: 2px; }
}

@media print {
  @page { size: A4; margin: 10mm 11mm; }
  html, body { background: #fff !important; }
  #topbar, .no-print, .fab, #toast-root, #modal-root, .lightbox { display: none !important; }
  main { max-width: none; padding: 0; margin: 0; }
  .sheet { box-shadow: none; padding: 0; max-width: none; font-size: 11pt; }
  .sheet-head { grid-template-columns: 1fr auto 1fr !important; text-align: left !important; }
  .pgrid { grid-template-columns: 1.15fr 1.15fr 1fr !important; }
  .p-fotos { grid-template-columns: 1fr 1fr !important; }
  .p-mass { break-inside: auto; }
  .p-mass h2, .prow { break-inside: avoid; break-after: avoid; }
}
.p-fototeil { margin-top: 16px; }
.p-fotohead { font-size: 13pt; margin: 0 0 6px; border-top: 1px solid #999; padding-top: 8px; }
.p-fotogruppe { margin-bottom: 10px; }
.p-fotogruppe h3 { font-size: 11pt; margin: 6px 0 4px; font-weight: 700; break-after: avoid; }
.sheet.no-fotos .p-fototeil { display: none; }
@media print {
  .p-fototeil { break-before: page; margin-top: 0; }
  .p-fotohead { border-top: 0; padding-top: 0; }
}

/* ===== Update 004: Offline / Sync ===== */
.syncbtn {
  display: inline-flex; align-items: center; gap: 6px; flex-shrink: 0;
  border: 0; background: rgba(255, 255, 255, .15); color: #fff; font: inherit; font-weight: 700; font-size: 14px;
  min-height: 40px; min-width: 44px; padding: 0 12px; border-radius: 20px; cursor: pointer; white-space: nowrap;
}
.syncbtn svg { display: block; flex-shrink: 0; }
.syncbtn .spin { animation: spin 1s linear infinite; }
.sync-ok { color: #cfe8b4; }
.sync-pending { background: #f0b429; color: #3a2a00; }
.sync-offline { background: #5b6157; color: #fff; }
.sync-error { background: var(--danger); color: #fff; }
.pend {
  display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: #f0b429;
  box-shadow: 0 0 0 2px #fff; margin: 0 6px; vertical-align: middle; flex-shrink: 0;
}
.pend-txt { color: #a06b00; }
.foto-local { outline: 2px dashed #f0b429; outline-offset: -2px; }
.sync-ops { display: flex; flex-direction: column; gap: 8px; }
.sync-op {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px;
  border: 1px solid var(--line); border-radius: 10px; background: #fafbf8;
}
.sync-op-main { flex: 1; min-width: 0; overflow-wrap: anywhere; }
@media (max-width: 640px) {
  .syncbtn { padding: 0 10px; font-size: 13px; }
  .userbtn { max-width: 110px; padding: 0 10px; }
}
@media print {
  .syncbtn { display: none !important; }
}

/* ===== Update 005: Einstellungen ===== */
.changelog { display: flex; flex-direction: column; gap: 14px; }
.cl-entry { border-left: 3px solid var(--line); padding: 2px 0 2px 14px; }
.cl-entry.cl-current { border-left-color: var(--green); }
.cl-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.cl-entry ul { margin: 6px 0 0; padding-left: 20px; }
.cl-entry li { margin: 3px 0; }

/* ===== Update 006 ===== */
.f-1 { grid-column: span 1; }
.brand-mark { display: none; }
.brand-logo { width: 42px; height: 42px; border-radius: 50%; background: #fff; flex-shrink: 0; display: block; }
.login-logo { display: block; width: 150px; height: 150px; margin: 0 auto 10px; }
.linkbtn { border: 0; background: none; color: var(--green-dark); text-decoration: underline; font: inherit; font-size: 14px; cursor: pointer; padding: 0 4px; }

/* Navigation: Desktop = Text, Zahnrad nur als Symbol */
#nav a svg { display: none; flex-shrink: 0; }
#nav .nav-settings { margin-left: auto; padding: 0 12px; }
#nav .nav-settings svg { display: block; }
#nav .nav-settings span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
@media (max-width: 860px) {
  #nav a { padding: 0 10px; }
}
/* Handy: Navigation als Leiste unten */
@media (max-width: 640px) {
  #nav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; gap: 0;
    background: var(--green-dark); box-shadow: 0 -2px 10px rgba(0, 0, 0, .18);
    padding: 4px 4px calc(4px + env(safe-area-inset-bottom));
  }
  #nav a, #nav .nav-settings {
    flex: 1; flex-direction: column; justify-content: center; gap: 2px; margin: 0;
    padding: 4px 2px; min-height: 54px; font-size: 11px; font-weight: 600; border-radius: 10px;
  }
  #nav a svg, #nav .nav-settings svg { display: block; }
  #nav .nav-settings span { position: static; width: auto; height: auto; clip: auto; overflow: visible; }
  #nav a[data-nav=benutzer] { display: none; }
  .brand-text { display: inline; font-size: 16px; }
  #topbar { justify-content: space-between; }
  .brand { flex: 1; min-width: 0; }
  .brand-text { overflow: hidden; text-overflow: ellipsis; }
  .userbtn { flex-shrink: 0; max-width: 110px; }
  main { padding-bottom: calc(150px + env(safe-area-inset-bottom)); }
  .fab { bottom: calc(80px + env(safe-area-inset-bottom)); }
  #toast-root { bottom: calc(84px + env(safe-area-inset-bottom)); }
  .print-mode #nav { display: none; }
}
@media (max-width: 380px) {
  .brand-text { display: none; }
}

/* Massnahmen-Werkzeuge, Fotos */
.mass-tools { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; }
.mass-tools .btn { display: inline-flex; align-items: center; gap: 6px; }
.mass-tools .btn:disabled { opacity: .35; }
.foto-cap { position: absolute; right: 4px; bottom: 4px; background: rgba(0, 0, 0, .6); color: #fff; border-radius: 6px; font-size: 12px; padding: 1px 5px; }
.lb-cap { color: #fff; text-align: center; padding: 0 16px calc(14px + env(safe-area-inset-bottom)); font-size: 15px; }

/* Arbeitszeit & Material */
.aw-list { display: flex; flex-direction: column; gap: 6px; }
.aw-row {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; font: inherit; cursor: pointer;
  border: 1px solid var(--line); background: #fafbf8; border-radius: 10px; padding: 10px 12px; min-height: 52px;
}
.aw-date { width: 86px; flex-shrink: 0; color: var(--muted); font-size: 14px; }
.aw-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.aw-qty { font-weight: 700; white-space: nowrap; }
.aw-sum { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); font-size: 14px; }
@media (max-width: 640px) { .aw-date { width: 70px; font-size: 13px; } }

/* Unterschriften */
.sign-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.sign-slot { border: 1px solid var(--line); border-radius: 12px; padding: 12px; background: #fafbf8; }
.sign-empty { display: flex; flex-direction: column; justify-content: space-between; gap: 10px; }
.sign-img { display: block; max-width: 100%; max-height: 90px; background: #fff; border-radius: 6px; margin: 4px 0; }
.sign-pad-wrap { position: relative; border: 2px dashed #b9c6b1; border-radius: 12px; background: #fff; }
.sign-pad { display: block; width: 100%; height: 220px; touch-action: none; cursor: crosshair; }
.sign-hint { position: absolute; left: 0; right: 0; bottom: 30px; text-align: center; color: #b9c6b1; pointer-events: none; border-top: 1px solid #dde3d6; margin: 0 24px; padding-top: 4px; }
@media (max-width: 640px) { .sign-grid { grid-template-columns: 1fr; } .sign-pad { height: 200px; } }

/* Verlauf */
.verlauf { display: flex; flex-direction: column; gap: 10px; }
.vl-entry { border-left: 3px solid var(--line); padding: 2px 0 2px 12px; }
.vl-head { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; }
.vl-felder { margin: 4px 0 0; padding-left: 18px; font-size: 14px; }
.vl-felder li { overflow-wrap: anywhere; }

/* Termine */
.termin-gruppe { margin-top: 18px; }
.termin-gruppe h2 { font-size: 17px; }
.termin-gruppe.today h2 { color: var(--green-dark); }
.termin-gruppe.late h2 { color: var(--danger); }
.termin { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.termin-main { display: flex; align-items: center; gap: 14px; padding: 12px 14px; color: inherit; text-decoration: none; }
.termin-zeit { width: 64px; flex-shrink: 0; display: flex; flex-direction: column; font-size: 14px; }
.termin-zeit span { color: var(--green-dark); font-weight: 700; font-size: 16px; }
.termin-actions { display: flex; gap: 8px; padding: 0 14px 12px 92px; }
.termin-actions:empty { display: none; }
@media (max-width: 640px) { .termin-actions { padding-left: 14px; } }

/* Papierkorb */
.pk-list { display: flex; flex-direction: column; gap: 8px; }
.pk-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.pk-row .item-main { flex: 1; min-width: 200px; }

/* Einstellungen */
.nr-grid { grid-template-columns: repeat(6, 1fr) !important; gap: 10px; }
.nr-grid .f-3 { grid-column: span 3 !important; } .nr-grid .f-2 { grid-column: span 2 !important; } .nr-grid .f-1 { grid-column: span 1 !important; }
.tbl.rights td:nth-child(n+2), .tbl.rights th:nth-child(n+2) { text-align: center; width: 90px; }

/* Foto markieren */
.marker { position: fixed; inset: 0; z-index: 48; background: #111; display: flex; flex-direction: column; }
.mk-top { display: flex; align-items: center; gap: 8px; padding: 8px 10px; padding-top: calc(8px + env(safe-area-inset-top)); flex-wrap: wrap; }
.mk-tools { display: flex; gap: 6px; flex: 1; flex-wrap: wrap; align-items: center; }
.mk-tool { border: 0; border-radius: 18px; min-height: 40px; padding: 0 14px; background: rgba(255, 255, 255, .15); color: #fff; font: inherit; font-weight: 600; cursor: pointer; }
.mk-tool.active { background: #fff; color: #111; }
.mk-color { width: 34px; height: 34px; border-radius: 50%; border: 3px solid rgba(255, 255, 255, .3); cursor: pointer; }
.mk-color.active { border-color: #fff; box-shadow: 0 0 0 2px #4a9a2a; }
.mk-stage { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; padding: 8px; }
.mk-stage canvas { max-width: 100%; max-height: 100%; touch-action: none; background: #222; }

/* Druck: Logo, Unterschriften, Aufwand, Bildunterschriften */
.seal-logo { justify-self: end; width: 30mm; height: 30mm; display: block; }
.sheet .p-aufwand { display: none; }
.sheet.show-aufwand .p-aufwand { display: block; }
.p-table { width: 100%; border-collapse: collapse; font-family: Arial, sans-serif; font-size: 9.5pt; }
.p-table th, .p-table td { border-bottom: 1px solid #ccc; padding: 3px 4px; text-align: left; vertical-align: top; }
.p-table .r { text-align: right; white-space: nowrap; }
.p-signs { display: grid; grid-template-columns: 1fr 1fr; gap: 14mm; margin-top: 14px; break-inside: avoid; }
.sheet.no-sign .p-signs { display: none; }
.p-sign-line { height: 18mm; border-bottom: 1px solid #000; display: flex; align-items: flex-end; }
.p-sign-line img { max-height: 17mm; max-width: 100%; }
.p-sign-label { font-family: Arial, sans-serif; font-size: 8.5pt; padding-top: 2px; }
.p-fotos figure { margin: 0; break-inside: avoid; }
.p-fotos figcaption { font-family: Arial, sans-serif; font-size: 8.5pt; margin-top: 2px; }
@media (max-width: 640px) {
  .seal-logo { justify-self: center; }
  .p-signs { grid-template-columns: 1fr; gap: 8px; }
}
@media print {
  .seal-logo { justify-self: end !important; }
  .p-signs { grid-template-columns: 1fr 1fr !important; }
}
/* PDF: unsichtbar in fester A4-Breite rendern (190 mm Inhalt) */
.pdf-render { position: fixed; left: -10000px; top: 0; width: 718px; background: #fff; }
.pdf-sheet { width: 718px !important; max-width: none !important; padding: 0 !important; box-shadow: none !important; font-size: 11pt !important; margin: 0 !important; }
.pdf-sheet .sheet-head { grid-template-columns: 1fr auto 1fr !important; text-align: left !important; }
.pdf-sheet .sheet-head .firm { order: 0 !important; }
.pdf-sheet .seal-logo { justify-self: end !important; }
.pdf-sheet .pgrid { grid-template-columns: 1.15fr 1.15fr 1fr !important; }
.pdf-sheet .p-fotos { grid-template-columns: 1fr 1fr !important; }
.pdf-sheet .prow { grid-template-columns: 92px 1fr !important; gap: 8px !important; }
.pdf-sheet .p-signs { grid-template-columns: 1fr 1fr !important; gap: 14mm !important; }
.pdf-sheet .p-fototeil { margin-top: 0; }
.pdf-sheet .p-fotohead { border-top: 0; padding-top: 0; }
