:root {
  --bg: #f6f7f9; --card: #fff; --text: #0f172a; --muted: #64748b; --faint: #94a3b8; --line: #eceef2;
  --blue: #2563eb; --blue-d: #1d4ed8; --blue-soft: #eff4ff;
  --green: #16a34a; --green-soft: #ecfdf3; --orange: #d97706; --orange-soft: #fff7ea;
  --red: #dc2626; --red-soft: #fef1f1;
  --r: 16px; --r-sm: 12px;
  --shadow: 0 1px 2px rgba(15,23,42,.04);
  --shadow-lg: 0 12px 40px rgba(15,23,42,.14);
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.5 "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; }
a { color: var(--blue); text-decoration: none; }
h1, h2, h3, p { margin: 0; }
h1, h2 { letter-spacing: -.02em; }
button, input, select, textarea { font: inherit; color: inherit; }
.grow { flex: 1; min-width: 0; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }

/* ---------- Icons & Farbtöne ---------- */
.i { width: 20px; height: 20px; flex-shrink: 0; display: inline-block; vertical-align: middle; }
.i.chev { width: 18px; height: 18px; color: #c4cad4; }
.i.muted-i { color: var(--muted); }
.logo-mark { width: 32px; height: 32px; flex-shrink: 0; }
.tone-blue { background: #eff4ff; color: #2563eb; }
.tone-amber { background: #fff5e6; color: #c2680a; }
.tone-sky { background: #e9f6fd; color: #0284c7; }
.tone-slate { background: #f1f3f6; color: #475569; }
.tone-green { background: #eaf8ef; color: #16a34a; }
.tone-cyan { background: #e6f8f9; color: #0e9aa7; }
.tone-violet { background: #f3effe; color: #7c3aed; }
.tone-yellow { background: #fef9e3; color: #b45309; }
.tone-red { background: #fef1f1; color: #dc2626; }
.tone-gray { background: #f1f3f6; color: #64748b; }
.ic { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; flex-shrink: 0; }
.ic.lg { width: 56px; height: 56px; border-radius: 16px; }
.ic.lg .i { width: 28px; height: 28px; }
.avatar { width: 40px; height: 40px; border-radius: 50%; background: #e8edf7; color: #334155; font-weight: 600; font-size: 14px; display: grid; place-items: center; flex-shrink: 0; }
.avatar.sm { width: 34px; height: 34px; font-size: 12.5px; }

/* ---------- Buttons & Formulare ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: 12px;
  padding: 0 16px; height: 42px; background: var(--blue); color: #fff; font-weight: 600; font-size: 14.5px; cursor: pointer; white-space: nowrap; transition: background .15s, transform .1s; }
.btn:hover { background: var(--blue-d); }
.btn:active { transform: scale(.98); }
.btn .i { width: 18px; height: 18px; }
.btn.block { width: 100%; }
.btn.lg { height: 54px; font-size: 16.5px; border-radius: 14px; }
.btn.lg .i { width: 22px; height: 22px; }
.btn.sm { height: 34px; padding: 0 12px; font-size: 13.5px; border-radius: 10px; }
.btn.green { background: var(--green); }
.btn.green:hover { background: #15803d; }
.btn.light { background: var(--blue-soft); color: var(--blue); }
.btn.ghost { background: #fff; color: var(--text); box-shadow: inset 0 0 0 1px var(--line); }
.btn.ghost:hover { background: #fafbfc; }
.btn.danger { background: var(--red-soft); color: var(--red); }
.btn:disabled { opacity: .6; }
.icon-btn { width: 40px; height: 40px; border-radius: 12px; border: 0; background: transparent; color: var(--muted); display: grid; place-items: center; cursor: pointer; flex-shrink: 0; }
.icon-btn:hover { background: #f1f3f6; color: var(--text); }
.icon-btn.danger:hover { background: var(--red-soft); color: var(--red); }
label { display: block; font-size: 13px; font-weight: 500; color: var(--muted); margin: 14px 0 6px; }
input, select, textarea { width: 100%; border: 0; box-shadow: inset 0 0 0 1px #e2e6ec; border-radius: 12px; padding: 0 14px; height: 46px; background: #fff; }
textarea { height: auto; min-height: 96px; padding: 12px 14px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; box-shadow: inset 0 0 0 2px var(--blue); }
.check { display: flex; align-items: center; gap: 10px; color: var(--text); font-size: 14.5px; margin: 16px 0; font-weight: 400; }
.check input { width: 18px; height: 18px; box-shadow: none; accent-color: var(--blue); }
.err { color: var(--red); font-size: 14px; min-height: 20px; margin-top: 10px; text-align: center; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }

/* ---------- Status-Pills & Fortschritt ---------- */
.pill { display: inline-flex; align-items: center; height: 24px; padding: 0 10px; border-radius: 99px; font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.p-offen { background: var(--orange-soft); color: var(--orange); }
.p-ueberfaellig { background: var(--red-soft); color: var(--red); }
.p-erledigt { background: var(--green-soft); color: var(--green); }
.progress { height: 6px; background: #edf0f4; border-radius: 99px; overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--blue); border-radius: 99px; transition: width .4s; }
.progress.full i { background: var(--green); }
.done-dot { width: 24px; height: 24px; border-radius: 50%; background: var(--green); color: #fff; display: grid; place-items: center; flex-shrink: 0; }
.done-dot .i { width: 14px; height: 14px; stroke-width: 3; }
.done-dot.lg { width: 36px; height: 36px; }
.done-dot.lg .i { width: 20px; height: 20px; }

/* ---------- Bausteine: Gruppen, Zeilen, Karten ---------- */
.label { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: var(--muted); margin: 24px 4px 10px; }
.label em { font-style: normal; background: #e9ecf1; color: var(--muted); border-radius: 99px; padding: 0 8px; font-size: 12px; line-height: 20px; }
.group { background: var(--card); border-radius: var(--r); box-shadow: var(--shadow); border: 1px solid var(--line); overflow: hidden; }
.group.pad-in { padding: 4px 16px; }
.stack { display: grid; gap: 12px; }
.trow, .hrow { display: flex; align-items: center; gap: 14px; padding: 14px 16px; color: inherit; }
.trow + .trow, .hrow + .hrow { border-top: 1px solid var(--line); }
a.trow, .trow[data-t] { cursor: pointer; transition: background .12s; }
a.trow:hover, .trow[data-t]:hover { background: #fafbfc; }
.trow .grow > b, .hrow .grow > b { display: block; font-weight: 600; font-size: 15px; }
.trow .grow > span, .hrow .grow > span { display: block; color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.trow.is-done .grow > b { color: var(--muted); }
.trow.is-done .ic { filter: grayscale(1); opacity: .55; }
.hrow { align-items: flex-start; }
.hrow p { font-size: 14px; margin-top: 4px; }
.empty { text-align: center; padding: 40px 16px; color: var(--muted); }
.empty-sm { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 22px 16px; color: var(--muted); font-size: 14px; }
.empty-sm .i { color: var(--green); }
.thumbs { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.thumbs img { width: 56px; height: 56px; object-fit: cover; border-radius: 10px; cursor: pointer; }
.hint { display: flex; align-items: center; justify-content: center; gap: 8px; color: var(--faint); font-size: 13px; margin-top: 20px; text-align: center; }

.ocard { display: block; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; color: inherit; box-shadow: var(--shadow); transition: border-color .15s, box-shadow .15s; }
a.ocard:hover { border-color: #d6dbe3; box-shadow: 0 4px 14px rgba(15,23,42,.06); }
.ocard-top { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.ocard-top b { display: block; font-weight: 600; }
.ocard-top span { display: block; font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ocard-meta { display: flex; justify-content: space-between; align-items: center; margin-top: 10px; font-size: 13px; color: var(--muted); }
.add-card { border: 1.5px dashed #d3d9e2; background: transparent; box-shadow: none; display: flex; align-items: center; justify-content: center; gap: 8px; color: var(--muted); font-weight: 500; cursor: pointer; min-height: 120px; }
.add-card:hover { color: var(--blue); border-color: var(--blue); }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }

.summary { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; box-shadow: var(--shadow); }
.summary-t { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.summary-t span { display: block; font-size: 13px; color: var(--muted); }
.summary-t b { font-size: 18px; letter-spacing: -.01em; }
.summary-pills { display: flex; gap: 6px; }

/* ---------- Login ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: radial-gradient(80% 50% at 50% 0%, #e7eefc 0%, var(--bg) 70%); }
.login-card { width: 100%; max-width: 400px; background: #fff; border-radius: 24px; padding: 28px 24px; box-shadow: 0 1px 2px rgba(15,23,42,.04), 0 20px 50px rgba(15,23,42,.08); }
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 28px; }
.login-brand .logo-mark { width: 44px; height: 44px; }
.login-brand b { display: block; font-size: 16px; }
.login-brand span { display: block; font-size: 13px; color: var(--muted); }
.login h1 { font-size: 24px; margin-bottom: 2px; }
.login-obj { display: flex; gap: 12px; align-items: center; background: var(--bg); border-radius: var(--r-sm); padding: 12px 14px; margin-bottom: 22px; }
.login-obj .i { color: var(--blue); }
.login-obj b { display: block; font-size: 14px; }
.login-obj span { display: block; font-size: 13px; color: var(--muted); }

/* ---------- Mitarbeiter-App ---------- */
.phone { max-width: 600px; margin: 0 auto; min-height: 100vh; padding-bottom: 32px; }
.phone.has-bottom { padding-bottom: 110px; }
.appbar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 10px; padding: 10px 12px 10px 16px; min-height: 64px;
  background: rgba(246,247,249,.85); backdrop-filter: saturate(1.8) blur(14px); -webkit-backdrop-filter: saturate(1.8) blur(14px); }
.appbar .icon-btn:first-child { margin-left: -8px; color: var(--text); }
.appbar .icon-btn:first-child .i { width: 24px; height: 24px; }
.appbar-t { flex: 1; min-width: 0; }
.appbar-t b { display: block; font-size: 17px; font-weight: 700; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.appbar-t span { display: block; font-size: 13px; color: var(--muted); }
.pad { padding: 4px 16px 16px; }
.pad > .label:first-child { margin-top: 12px; }
.task-head { display: flex; align-items: center; gap: 14px; margin: 8px 0 14px; }
.task-head p { color: var(--muted); font-size: 14px; margin-top: 4px; }
.note-ok { display: flex; align-items: center; gap: 10px; background: var(--green-soft); color: #166534; border-radius: var(--r-sm); padding: 12px 14px; font-size: 14px; }
.note-ok .i { color: var(--green); }
.desc { padding: 12px 0; font-size: 15px; border-bottom: 1px solid var(--line); }
.fact { display: flex; gap: 12px; padding: 12px 0; }
.fact + .fact { border-top: 1px solid var(--line); }
.fact > .i { color: var(--faint); width: 18px; height: 18px; margin-top: 2px; }
.fact span { display: block; font-size: 12.5px; color: var(--muted); font-weight: 500; }
.fact p { font-size: 15px; }
.shot { width: 100%; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 26px 16px; margin-bottom: 12px;
  background: var(--blue-soft); border: 1.5px dashed #bcd0fb; border-radius: var(--r); color: var(--blue); cursor: pointer; }
.shot .i { width: 30px; height: 30px; margin-bottom: 4px; }
.shot b { font-size: 16px; }
.shot span { font-size: 13px; color: #6b8fd9; }
.photos { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 12px; }
.ph { aspect-ratio: 1; border-radius: var(--r-sm); overflow: hidden; position: relative; background: var(--line); }
.ph img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ph button { position: absolute; top: 6px; right: 6px; width: 26px; height: 26px; border-radius: 50%; border: 0; background: rgba(15,23,42,.55); color: #fff; cursor: pointer; display: grid; place-items: center; }
.ph button .i { width: 14px; height: 14px; stroke-width: 2.6; }
.ph-add { aspect-ratio: 1; border: 1.5px dashed #bcd0fb; border-radius: var(--r-sm); display: grid; place-items: center; color: var(--blue); background: var(--blue-soft); cursor: pointer; }
.bottom-bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 5; padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: rgba(255,255,255,.9); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-top: 1px solid var(--line); }
.bottom-bar .btn { max-width: 568px; margin: 0 auto; display: flex; }

/* ---------- Chef ---------- */
.topbar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 24px; height: 64px; padding: 0 24px;
  background: rgba(255,255,255,.88); backdrop-filter: saturate(1.8) blur(14px); -webkit-backdrop-filter: saturate(1.8) blur(14px); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-size: 15.5px; }
.topnav { flex: 1; display: flex; gap: 4px; justify-content: center; }
.topnav a { display: flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 10px; color: var(--muted); font-weight: 500; font-size: 14.5px; }
.topnav a .i { width: 18px; height: 18px; }
.topnav a:hover { color: var(--text); background: #f3f5f8; }
.topnav a.on { color: var(--text); background: #eef1f5; }
.me { display: flex; align-items: center; gap: 4px; }
.me .avatar { width: 34px; height: 34px; font-size: 13px; background: var(--blue); color: #fff; }
.tabbar { display: none; }
.page { max-width: 1160px; margin: 0 auto; padding: 32px 24px 48px; }
.page-head { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.page-head h1 { font-size: 28px; font-weight: 700; }
.page-head p { color: var(--muted); margin-top: 2px; }
.page-head .back { flex-basis: 100%; display: flex; align-items: center; gap: 4px; color: var(--muted); font-size: 14px; font-weight: 500; margin-bottom: -6px; }
.page-head .back .i { width: 16px; height: 16px; }
.head-actions { display: flex; gap: 8px; align-items: center; }
.head-actions select { width: auto; min-width: 200px; height: 42px; }
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 8px; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 16px 18px; color: inherit; box-shadow: var(--shadow); transition: border-color .15s; }
.kpi:hover { border-color: #d6dbe3; }
.kpi-top { display: flex; justify-content: space-between; align-items: center; }
.kpi-top span { color: var(--muted); font-size: 13.5px; font-weight: 500; }
.ki { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; }
.ki .i { width: 18px; height: 18px; }
.kpi b { display: block; font-size: 32px; font-weight: 700; letter-spacing: -.03em; line-height: 1.1; margin-top: 6px; }
section { margin-top: 28px; }
.sec-head { display: flex; align-items: center; justify-content: space-between; margin: 0 4px 12px; }
.sec-head h2 { font-size: 17px; font-weight: 600; }
.sec-head a { font-size: 14px; font-weight: 500; }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 0 20px; align-items: start; }
.split.wide-left { grid-template-columns: 3fr 2fr; }
.split > section { min-width: 0; }
.summary.wide { margin-bottom: 0; }
.narrow { }
.narrow > .label:first-child { margin-top: 0; }

/* ---------- Modal (Bottom-Sheet auf dem Handy) ---------- */
.modal { position: fixed; inset: 0; z-index: 20; background: rgba(15,23,42,.4); display: grid; place-items: center; padding: 16px; animation: fade .15s; }
.sheet { width: 100%; max-width: 540px; max-height: 92vh; overflow: auto; background: #fff; border-radius: 20px; padding: 20px 22px 22px; box-shadow: var(--shadow-lg); animation: rise .2s; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.sheet-head h2 { font-size: 19px; }
.sheet-head .icon-btn { margin-right: -8px; }
.sheet-actions { display: flex; gap: 8px; align-items: center; margin-top: 22px; }
.sheet img.full { max-width: 100%; max-height: 75vh; display: block; margin: 8px auto 0; border-radius: 12px; }
.qr { text-align: center; padding: 12px 0; }
.qr img { width: 220px; height: 220px; }
.qr p { font-size: 12.5px; color: var(--muted); word-break: break-all; margin-top: 8px; }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { transform: translateY(12px); opacity: 0; } }

/* ---------- QR-Schild ---------- */
.sign-wrap { max-width: 520px; margin: 24px auto; padding: 16px; }
.sign-wrap .sheet-actions { margin: 0 0 20px; }
.sign { background: #fff; border: 2px solid var(--text); border-radius: 28px; padding: 40px 32px; text-align: center; }
.sign-brand { display: flex; align-items: center; justify-content: center; gap: 12px; font-size: 24px; }
.sign-brand .logo-mark { width: 44px; height: 44px; }
.sign-obj { font-size: 19px; color: var(--muted); margin: 6px 0 24px; }
.sign img { width: 300px; height: 300px; }
.sign-cta { display: flex; align-items: center; justify-content: center; gap: 10px; background: var(--text); color: #fff; border-radius: 16px; padding: 16px; margin-top: 24px; font-size: 18px; font-weight: 600; }
.sign-foot { color: var(--faint); font-size: 13px; margin-top: 14px; }

#toast { position: fixed; left: 50%; bottom: 96px; transform: translate(-50%, 8px); background: var(--text); color: #fff; padding: 12px 20px; border-radius: 14px; opacity: 0; transition: .2s; pointer-events: none; z-index: 30; font-weight: 500; box-shadow: var(--shadow-lg); }
#toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .topnav, .brand b { display: none; }
  .topbar { justify-content: space-between; padding: 0 12px 0 16px; }
  .tabbar { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
    background: rgba(255,255,255,.92); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-top: 1px solid var(--line); }
  .tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 0; color: var(--faint); font-size: 11.5px; font-weight: 500; }
  .tabbar a .i { width: 22px; height: 22px; }
  .tabbar a.on { color: var(--blue); }
  .page { padding: 20px 16px 100px; }
  .page-head { margin-bottom: 16px; align-items: center; }
  .page-head h1 { font-size: 24px; }
  .kpis { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kpi b { font-size: 28px; }
  .split, .split.wide-left { grid-template-columns: 1fr; }
  .hide-s { display: none; }
  .head-actions { width: 100%; }
  .head-actions > .btn { flex: 1; padding: 0 10px; font-size: 13.5px; }
  .head-actions select { flex: 1; min-width: 0; }
  .modal { place-items: end center; padding: 0; }
  .sheet { border-radius: 22px 22px 0 0; max-width: none; padding-bottom: calc(22px + env(safe-area-inset-bottom)); }
}
@media (max-width: 520px) { .grid2 { grid-template-columns: 1fr; } }
@media print {
  .topbar, .tabbar, .no-print, .head-actions { display: none !important; }
  .page { padding: 0; }
  body { background: #fff; }
}
