:root {
  --ink: #14213d;
  --muted: #5b6475;
  --line: #d9dde5;
  --bg: #f3f4f1;
  --card: #ffffff;
  --accent: #1f5f8b;
  --accent-ink: #ffffff;
  --danger: #b42318;
  --ok: #2f7d4f;
  --radius: 14px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100dvh; }
button, input { font: inherit; color: inherit; }
[hidden] { display: none !important; }

.shell { max-width: 760px; margin: 0 auto; padding: 32px 20px 48px; }

.top { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 24px; }
.eyebrow { margin: 0 0 4px; color: var(--muted); font-size: 0.95rem; letter-spacing: 0.04em; text-transform: uppercase; }
h1 { margin: 0; font-size: clamp(1.8rem, 4vw, 2.4rem); line-height: 1.1; }
.clock { text-align: right; display: flex; flex-direction: column; }
#clock-time { font-size: 2rem; font-weight: 600; font-variant-numeric: tabular-nums; }
#clock-date { color: var(--muted); font-size: 0.95rem; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; margin-bottom: 16px; }
.card h2 { margin: 0 0 16px; font-size: 1.15rem; display: flex; align-items: center; gap: 10px; }
.step { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--ink); color: #fff; font-size: 0.9rem; }

.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid .full { grid-column: 1 / -1; }
label { display: flex; flex-direction: column; gap: 6px; font-weight: 500; }
input[type="text"], input:not([type]) {
  font-size: 1.1rem; /* >= 16px verhindert Zoom auf iOS */
  padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; background: #fff; font-weight: 400;
}
input:focus-visible, .privacy:focus-visible, button:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 45%, transparent); outline-offset: 2px; }
.hint { margin: 12px 0 0; color: var(--muted); font-size: 0.9rem; }

.privacy {
  max-height: 240px; overflow-y: auto; padding: 14px 16px; border: 1px solid var(--line); border-radius: 10px;
  background: #fafafa; font-size: 0.92rem; line-height: 1.5; overscroll-behavior: contain;
}
.privacy h3 { margin: 0 0 8px; font-size: 1rem; }
.privacy p { margin: 0 0 10px; }
.check { flex-direction: row; align-items: flex-start; gap: 12px; margin-top: 14px; font-weight: 400; cursor: pointer; }
.check input { width: 24px; height: 24px; margin: 0; flex: none; accent-color: var(--accent); }

.sig-wrap { position: relative; padding: 8px; border: 2px dashed var(--line); border-radius: 10px; background: #fff; }
.sig-wrap.signed { border-style: solid; border-color: var(--accent); }
#sig { display: block; width: 100%; height: 200px; touch-action: none; cursor: crosshair; }
.sig-line {
  position: absolute; left: 24px; right: 24px; bottom: 36px; border-top: 1px solid var(--line);
  padding-top: 6px; color: #6b7280; font-size: 0.85rem; pointer-events: none;
}
.sig-wrap.signed .sig-line { color: transparent; }

button { cursor: pointer; border-radius: 10px; border: 1px solid transparent; transition: background-color 150ms ease, transform 100ms ease; }
button:active { transform: scale(0.98); }
.primary { width: 100%; padding: 16px; font-size: 1.15rem; font-weight: 600; background: var(--accent); color: var(--accent-ink); }
.primary:hover { background: color-mix(in srgb, var(--accent) 88%, black); }
.primary:disabled { opacity: 0.6; cursor: progress; }
.ghost { margin-top: 10px; padding: 8px 14px; background: transparent; border-color: var(--line); }
.ghost:hover { background: #f0f1f4; }

.error { margin: 0 0 14px; padding: 12px 14px; border-radius: 10px; background: #fdecea; color: var(--danger); font-weight: 500; }

.done { text-align: center; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 48px 24px; }
.check-badge { width: 64px; height: 64px; margin: 0 auto 16px; border-radius: 50%; background: var(--ok); color: #fff; display: grid; place-items: center; font-size: 2rem; }
.done h2 { margin: 0 0 12px; }
.done p { color: var(--muted); line-height: 1.6; }

@media (max-width: 560px) {
  .grid { grid-template-columns: 1fr; }
  .top { flex-direction: column; align-items: flex-start; }
  .clock { text-align: left; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

/* --- Verwaltung -------------------------------------------------------- */
.admin .shell { max-width: 1100px; }
.toolbar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar input[type="date"] { padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; }
.toolbar .count { color: var(--muted); margin-left: auto; }
table { width: 100%; border-collapse: collapse; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { background: #f7f8fa; font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.03em; color: var(--muted); }
td.time { font-variant-numeric: tabular-nums; font-weight: 600; }
td img { height: 56px; max-width: 220px; object-fit: contain; display: block; }
.del { padding: 6px 10px; background: transparent; border-color: var(--line); color: var(--danger); }
.empty { text-align: center; color: var(--muted); padding: 32px; }

@media print {
  body { background: #fff; }
  .toolbar button, .del, .no-print { display: none !important; }
  table { border: 1px solid #999; }
}
.toolbar .inline { flex-direction: row; align-items: center; gap: 8px; }
.toolbar .ghost { margin: 0; }

/* Vollbild: Abstand zu Kamera-Aussparung und Systemleisten */
.shell {
  padding-top: max(32px, env(safe-area-inset-top));
  padding-left: max(20px, env(safe-area-inset-left));
  padding-right: max(20px, env(safe-area-inset-right));
  padding-bottom: max(48px, env(safe-area-inset-bottom));
}
@media (display-mode: fullscreen), (display-mode: standalone) {
  body { overscroll-behavior-y: none; user-select: none; -webkit-user-select: none; }
  input, .privacy { user-select: text; -webkit-user-select: text; }
}
