:root {
  --brand: #c8102e; --dark: #1f2328; --bg: #f3f4f6; --card: #fff; --line: #d9dde3; --text: #1f2328; --muted: #6b7280;
  --ok: #1a7f37; --warn: #c8102e;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.4 -apple-system, system-ui, "Segoe UI", Roboto, sans-serif; -webkit-text-size-adjust: 100%; }
.topbar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 8px; background: var(--brand); color: #fff; padding: calc(env(safe-area-inset-top) + 10px) 14px 10px; }
.topbar h1 { flex: 1; font-size: 17px; margin: 0; font-weight: 600; }
.iconbtn { background: none; border: 0; color: #fff; font-size: 30px; line-height: 1; padding: 0 6px; }
.netdot { width: 12px; height: 12px; border-radius: 50%; background: #9ca3af; }
.netdot.on { background: #4ade80; }
main { max-width: 720px; margin: 0 auto; padding: 12px 12px calc(env(safe-area-inset-bottom) + 40px); }
.view[hidden] { display: none; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px; margin-bottom: 12px; }
.card h3 { margin: 0 0 10px; font-size: 15px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.card h3 + h3 { margin-top: 14px; }
h2 { margin: 0 0 12px; }
label { display: block; font-size: 13px; color: var(--muted); margin: 8px 0 2px; }
input, select, textarea { width: 100%; font: inherit; font-size: 16px; padding: 11px 12px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--text); margin-top: 3px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand); border-color: transparent; }
textarea { resize: vertical; }
input[type="datetime-local"], input[type="date"], input[type="time"] { min-width: 0; max-width: 100%; display: block; -webkit-appearance: none; appearance: none; min-height: 46px; text-align: left; }
.grid2 > * { min-width: 0; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
#view-home > .grid2 { margin: 4px 0 16px; }
#view-home .btn.big { margin-top: 0; }
@media (max-width: 420px) { .grid2 { grid-template-columns: 1fr; } .grid2.keep { grid-template-columns: 1fr 1fr; } }
.btn { display: inline-block; width: 100%; text-align: center; font: inherit; font-weight: 600; padding: 13px 16px; border-radius: 10px; border: 1px solid var(--line); background: #fff; color: var(--text); margin-top: 10px; cursor: pointer; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.dark { background: var(--dark); border-color: var(--dark); color: #fff; }
.btn.big { padding: 22px 16px; font-size: 18px; }
.btn.big small { display: block; font-weight: 400; font-size: 13px; opacity: .85; margin-top: 4px; }
.btn.small { width: auto; padding: 8px 12px; font-size: 14px; font-weight: 500; }
.btn:disabled { opacity: .5; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row .muted { flex: 1; }
.muted { color: var(--muted); }
.err { color: var(--warn); font-weight: 600; }
.pill { display: inline-block; background: var(--brand); color: #fff; border-radius: 999px; padding: 1px 8px; font-size: 12px; margin-left: 4px; }
.hint { font-size: 12px; color: var(--muted); margin: 4px 0 8px; }
.hint .ok { color: var(--ok); } .hint .mangel { color: var(--warn); }
.list { list-style: none; margin: 0; padding: 0; }
.list li { padding: 10px 0; border-top: 1px solid var(--line); display: flex; gap: 10px; align-items: center; }
.list li:first-child { border-top: 0; }
.list li .info { flex: 1; min-width: 0; }
.list li .info b { display: block; }
.list li .info span { font-size: 13px; color: var(--muted); }
.status { font-size: 12px; padding: 2px 8px; border-radius: 6px; background: #e5e7eb; white-space: nowrap; }
.status.sent { background: #dcfce7; color: var(--ok); }
.status.failed, .status.error { background: #fee2e2; color: var(--warn); }
.status.pending { background: #fef3c7; color: #92400e; }

/* Segmented (Tank/AdBlue) */
.seg { display: flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; margin-top: 4px; }
.seg button { flex: 1; font: inherit; padding: 11px 0; border: 0; border-left: 1px solid var(--line); background: #fff; color: var(--text); }
.seg button:first-child { border-left: 0; }
.seg button.on { background: var(--dark); color: #fff; }

/* Checkliste */
.chk { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-top: 1px solid var(--line); }
.chk:first-child { border-top: 0; }
.chk span { flex: 1; font-size: 15px; }
.chk .seg { width: 176px; margin: 0; flex: none; }
.chk .seg button { padding: 9px 0; font-size: 13px; }
.chk .seg button.on[data-v="ok"] { background: var(--ok); }
.chk .seg button.on[data-v="mangel"] { background: var(--warn); }
.chk .seg button.on[data-v="na"] { background: #9ca3af; }

/* Zubehör */
.eq { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-top: 1px solid var(--line); }
.eq:first-child { border-top: 0; }
.eq span { flex: 1; font-size: 15px; }
.eq .step { display: flex; align-items: center; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.eq .step button { width: 42px; height: 40px; border: 0; background: #fff; font-size: 20px; }
.eq .step input { width: 48px; text-align: center; border: 0; border-left: 1px solid var(--line); border-right: 1px solid var(--line); border-radius: 0; margin: 0; padding: 8px 0; }

/* Fotos */
.photos { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 8px; }
.photo { position: relative; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: #fff; }
.photo img { width: 100%; aspect-ratio: 4/3; object-fit: cover; display: block; }
.photo input { border: 0; border-top: 1px solid var(--line); border-radius: 0; font-size: 16px; padding: 6px 8px; margin: 0; }
.photo .del { position: absolute; top: 4px; right: 4px; width: 26px; height: 26px; border-radius: 50%; border: 0; background: rgba(0,0,0,.6); color: #fff; font-size: 16px; line-height: 26px; padding: 0; }

/* Unterschrift */
.sigslot { border: 1px dashed #9ca3af; border-radius: 10px; height: 110px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; cursor: pointer; background: #fff; }
.sigslot img { max-height: 70px; max-width: 90%; display: none; }
.sigslot.done img { display: block; }
.sigslot.done span { font-size: 12px; color: var(--ok); }
.sigslot span { font-size: 14px; color: var(--muted); }
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 50; display: flex; align-items: center; justify-content: center; padding: 12px; }
.modal[hidden] { display: none; }
.modalbox { background: #fff; border-radius: 12px; padding: 14px; width: 100%; max-width: 640px; }
.modalbox h3 { margin: 0 0 8px; }
#sigCanvas { width: 100%; height: 220px; border: 1px solid var(--line); border-radius: 8px; background: #fff; touch-action: none; display: block; }
.modalbox .row { justify-content: flex-end; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--dark); color: #fff; padding: 10px 16px; border-radius: 8px; font-size: 14px; z-index: 60; max-width: 90%; }
