:root {
  --navy: #0E2A5A;
  --blue: #0B4B9C;
  --teal: #12A88F;
  --teal-ink: #04241E;
  --bg: #F3F6FB;
  --surface: #FFFFFF;
  --surface-2: #EEF3FA;
  --surface-3: #E3EBF6;
  --text: #101F3A;
  --muted: #4C5E7C;
  --border: #D9E3F1;
  --border-strong: #B9C9E0;
  --error: #C0392B;
  --error-bg: #FDECEA;
  --heading: #0E2A5A;
  --wm-opacity: .07;
  --shadow: 0 1px 2px rgba(16, 31, 58, .05), 0 24px 56px -28px rgba(16, 31, 58, .30);
}
@media not all {
  :root {
    --teal: #2ED2B4;
    --bg: #081328;
    --surface: #10244A;
    --surface-2: #16305C;
    --surface-3: #1C3A6B;
    --text: #E7EEFA;
    --muted: #A5B7D4;
    --border: #22406F;
    --border-strong: #33558A;
    --error: #F1707E;
    --error-bg: #3A1A26;
    --heading: #CFE0FA;
    --wm-opacity: .05;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 24px 56px -28px rgba(0, 0, 0, .75);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: "Source Sans 3", -apple-system, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.6;
  overflow-x: hidden;
}
button { font: inherit; }
[hidden] { display: none !important; }

/* Wasserzeichen: blasses Logo im Hintergrund, füllt große Bildschirme */
.wm {
  position: fixed;
  right: -6vw;
  bottom: -4vh;
  width: min(1000px, 78vw);
  opacity: var(--wm-opacity);
  pointer-events: none;
  user-select: none;
  z-index: 0;
}
.page { position: relative; z-index: 1; }

/* Kopfzeile */
.topbar {
  max-width: 1200px;
  margin: 0 auto;
  padding: 22px 24px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.brand img { width: 48px; height: 48px; border-radius: 12px; flex: none; box-shadow: 0 2px 8px rgba(16, 31, 58, .15); }
.brand b { display: block; font-family: Outfit, sans-serif; font-weight: 700; font-size: 1.2rem; letter-spacing: .01em; color: var(--heading); line-height: 1.1; }
.brand span { display: block; font-size: .82rem; color: var(--muted); }
.langs { display: inline-flex; background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 3px; }
.langs button {
  border: 0; background: transparent; color: var(--muted);
  font-family: Outfit, sans-serif; font-weight: 600; font-size: .8rem;
  padding: 6px 12px; border-radius: 999px; cursor: pointer; min-width: 44px; min-height: 44px;
}
.langs button[aria-pressed="true"] { background: var(--navy); color: #fff; }
@media not all { .langs button[aria-pressed="true"] { background: var(--teal); color: var(--teal-ink); } }

/* Zweispaltiges Layout: links Dokumente, rechts Checkliste */
.layout {
  max-width: 1200px;
  margin: 0 auto;
  padding: 6px 24px 56px;
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(320px, 1fr);
  gap: 28px;
  align-items: start;
}
@media (max-width: 960px) {
  .layout { grid-template-columns: minmax(0, 1fr); gap: 20px; padding: 4px 16px 40px; }
  .topbar { padding: 16px 16px 14px; }
}
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 34px;
  box-shadow: var(--shadow);
  min-width: 0;
}
@media (max-width: 600px) { .card { padding: 22px 18px; border-radius: 16px; } }

h1, h2 { font-family: Outfit, sans-serif; color: var(--heading); letter-spacing: -.01em; }
h1 { font-size: 1.75rem; font-weight: 600; margin: 0 0 6px; line-height: 1.25; }
h2 { font-size: 1.08rem; font-weight: 600; margin: 0; }
.intro { color: var(--muted); margin: 0 0 6px; font-size: 1.02rem; }
.intro strong { color: var(--text); font-weight: 600; white-space: nowrap; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 26px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--surface-2); border: 1px solid var(--border);
  color: var(--text); border-radius: 999px; padding: 4px 12px; font-size: .86rem;
}
.chip b { font-family: Outfit, sans-serif; font-weight: 600; color: var(--heading); }

/* Upload-Feld */
.dropzone {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; gap: 6px; min-height: 230px; padding: 32px 20px;
  border: 2px dashed var(--border-strong); border-radius: 16px;
  background: var(--surface-2); cursor: pointer;
  transition: border-color .15s ease, background .15s ease;
}
.dropzone:hover, .dropzone.drag { border-color: var(--teal); background: var(--surface-3); }
.dropzone:focus-within { outline: 3px solid color-mix(in srgb, var(--teal) 45%, transparent); outline-offset: 2px; }
.dz-icon {
  width: 56px; height: 56px; border-radius: 50%;
  background: var(--surface); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center; margin-bottom: 6px;
}
.dz-icon svg { width: 26px; height: 26px; stroke: var(--teal); stroke-width: 1.9; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.dz-title { font-family: Outfit, sans-serif; font-weight: 600; font-size: 1.1rem; color: var(--heading); }
.dz-or { color: var(--muted); font-size: .9rem; }
.dz-hint { color: var(--muted); font-size: .84rem; margin-top: 6px; }
.dropzone input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.btn {
  font-family: Outfit, sans-serif; font-weight: 600; font-size: .95rem;
  background: var(--teal); color: var(--teal-ink); border: 0; border-radius: 11px;
  padding: 11px 22px; cursor: pointer;
}
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-ghost { background: transparent; color: var(--text); border: 1px solid var(--border-strong); }
.btn-danger { background: var(--error); color: #fff; }

.errors { margin-top: 14px; display: flex; flex-direction: column; gap: 8px; }
.error {
  background: var(--error-bg); color: var(--error);
  border-radius: 10px; padding: 10px 14px; font-size: .9rem;
  display: flex; gap: 10px; align-items: flex-start;
}
.error button { margin-left: auto; background: none; border: 0; color: inherit; cursor: pointer; font-size: 1.1rem; line-height: 1; padding: 0 2px; }

/* Laufende Uploads */
.progress-list { margin-top: 16px; display: flex; flex-direction: column; gap: 10px; }
.up-item { background: var(--surface-2); border-radius: 12px; padding: 10px 14px; }
.up-row { display: flex; justify-content: space-between; gap: 12px; font-size: .88rem; }
.up-row .n { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.up-row .s { color: var(--muted); flex: none; }
.bar { height: 6px; background: var(--surface-3); border-radius: 99px; overflow: hidden; margin-top: 8px; }
.bar i { display: block; height: 100%; width: 0; background: var(--teal); border-radius: 99px; transition: width .2s ease; }
.bar.indet i { width: 35%; animation: indet 1.1s ease-in-out infinite; }
@keyframes indet { 0% { transform: translateX(-100%); } 100% { transform: translateX(300%); } }

/* Ausgewählt, noch nicht hochgeladen */
.pending { margin-top: 18px; border: 1px solid var(--teal); border-radius: 16px; padding: 16px; background: var(--surface); }
.pending-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.pending-list { display: flex; flex-direction: column; gap: 8px; }
.pending-item {
  display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; align-items: center; gap: 12px;
  background: var(--surface-2); border-radius: 12px; padding: 8px 10px;
}
.pending-item .ico {
  width: 44px; height: 44px; border-radius: 10px; background: var(--surface-3); color: var(--heading);
  display: flex; align-items: center; justify-content: center; font-family: Outfit, sans-serif; font-weight: 600; font-size: .7rem;
}
.pending-item .meta { min-width: 0; }
.pending-item .name { font-size: .92rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pending-item .sub { font-size: .8rem; color: var(--muted); }
.photo-hint { font-size: .78rem; color: #A8620A; margin-top: 3px; }
@media not all { .photo-hint { color: #E8A94D; } }
.pending-item .icon-btn { font-size: 1.3rem; line-height: 1; }
.pending-foot { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-top: 14px; flex-wrap: wrap; }
.pending-hint { font-size: .84rem; color: var(--muted); flex: 1 1 200px; }
.btn-upload { padding: 12px 26px; font-size: 1rem; }
@media (max-width: 600px) { .btn-upload { width: 100%; } }
.link-btn { background: none; border: 0; color: var(--muted); font-size: .86rem; cursor: pointer; text-decoration: underline; padding: 0; }

/* Hochgeladene Dateien */
.files-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 32px 0 12px; flex-wrap: wrap; }
.select-all { display: inline-flex; align-items: center; gap: 8px; font-size: .88rem; color: var(--muted); cursor: pointer; }
.files { display: flex; flex-direction: column; gap: 8px; }
.empty { color: var(--muted); font-size: .92rem; background: var(--surface-2); border-radius: 12px; padding: 16px; text-align: center; }
.file {
  display: grid; grid-template-columns: auto 52px minmax(0, 1fr) auto; align-items: center; gap: 14px;
  background: var(--surface-2); border: 1px solid transparent; border-radius: 14px; padding: 10px 12px;
}
.file.sel { border-color: var(--teal); background: var(--surface-3); }
.file img, .file .ico { width: 52px; height: 52px; border-radius: 10px; object-fit: cover; }
.file .ico {
  background: var(--navy); color: #fff; display: flex; align-items: center; justify-content: center;
  font-family: Outfit, sans-serif; font-weight: 600; font-size: .72rem;
}
.file { align-items: start; padding-top: 12px; padding-bottom: 12px; }
.file .meta { min-width: 0; padding-top: 2px; }
.file .name { font-size: .94rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }
.file .sub { font-size: .8rem; color: var(--muted); }
.typ-auswahl { display: flex; align-items: center; gap: 8px; margin-top: 6px; flex-wrap: wrap; }
.typ-label { font-size: .78rem; color: var(--muted); }
.typ-auswahl select {
  font-size: .82rem; padding: 4px 8px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); max-width: 200px;
}
.typ-erkannt { font-size: .8rem; color: var(--teal-ink, var(--teal)); background: color-mix(in srgb, var(--teal) 18%, transparent); border-radius: 8px; padding: 3px 9px; }
.typ-final { font-size: .8rem; color: var(--muted); background: var(--surface-2); border-radius: 8px; padding: 3px 9px; }
.typ-fehlgeschlagen { border: 1.5px solid var(--error); border-radius: 10px; padding: 8px; background: var(--error-bg); }
.typ-hinweis { margin: 0 0 6px; font-size: .8rem; color: var(--error); font-weight: 600; }
.icon-btn {
  width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface); color: var(--muted); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.icon-btn:hover { color: var(--error); border-color: var(--error); }
.icon-btn svg { width: 18px; height: 18px; stroke: currentColor; stroke-width: 1.9; fill: none; stroke-linecap: round; stroke-linejoin: round; }
input[type="checkbox"] { width: 20px; height: 20px; accent-color: var(--teal); cursor: pointer; margin: 0; flex: none; }

.selbar {
  position: sticky; bottom: 16px; margin-top: 14px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: var(--navy); color: #fff; border-radius: 14px; padding: 10px 12px 10px 18px;
  box-shadow: var(--shadow);
}
@media not all { .selbar { background: var(--surface-3); } }
.privacy {
  display: flex; gap: 10px; align-items: flex-start; margin-top: 28px;
  color: var(--muted); font-size: .84rem;
}
.privacy svg { width: 18px; height: 18px; flex: none; margin-top: 2px; stroke: var(--teal); stroke-width: 2; fill: none; stroke-linecap: round; stroke-linejoin: round; }

/* Checkliste (Seitenleiste) */
.aside { position: sticky; top: 20px; max-height: calc(100vh - 40px); overflow: auto; padding: 28px; }
@media (max-width: 960px) { .aside { position: static; max-height: none; } }
.cl-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.cl-title { color: var(--muted); font-size: .86rem; margin: 4px 0 14px; }
.cl-count { font-size: .82rem; color: var(--muted); white-space: nowrap; }
.cl-bar { height: 8px; background: var(--surface-3); border-radius: 99px; overflow: hidden; margin-bottom: 18px; }
.cl-bar i { display: block; height: 100%; background: var(--teal); border-radius: 99px; transition: width .25s ease; }
.cl-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.cl-item label {
  display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 12px; align-items: start;
  padding: 10px 10px; border-radius: 10px; cursor: pointer;
}
.cl-item label:hover { background: var(--surface-2); }
.cl-item input { margin-top: 2px; }
.cl-doc { font-size: .95rem; color: var(--text); line-height: 1.4; }
.cl-note { font-size: .8rem; color: var(--muted); line-height: 1.4; margin-top: 2px; }
.cl-item.done .cl-doc { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--border-strong); }
.cl-hint { margin-top: 18px; font-size: .8rem; color: var(--muted); background: var(--surface-2); border-radius: 12px; padding: 12px 14px; }
.cl-empty { color: var(--muted); font-size: .94rem; margin: 10px 0 0; }
.muster-link {
  background: none; border: 0; color: var(--blue, var(--teal)); font-size: .8rem; margin-top: 4px;
  cursor: pointer; text-decoration: underline; padding: 0; display: block;
}

/* Foto-Tipps (aufklappbar über dem Upload-Feld) */
.photo-tips { margin: -6px 0 14px; font-size: .86rem; }
.photo-tips summary { cursor: pointer; color: var(--muted); font-weight: 600; }
.photo-tips p { margin: 8px 0 0; color: var(--muted); line-height: 1.5; }

/* Bestätigungsdialog */
.modal-bg {
  position: fixed; inset: 0; background: rgba(8, 19, 40, .55); z-index: 50;
  display: flex; align-items: center; justify-content: center; padding: 16px;
}
.modal {
  background: var(--surface); color: var(--text); border-radius: 18px; padding: 26px;
  width: 100%; max-width: 460px; box-shadow: var(--shadow); border: 1px solid var(--border);
}
.modal h2 { font-size: 1.25rem; margin-bottom: 8px; }
.modal p { margin: 0 0 10px; color: var(--muted); font-size: .94rem; }
.modal ul { margin: 0 0 20px; padding-left: 20px; font-size: .92rem; max-height: 180px; overflow: auto; word-break: break-word; }
.modal .actions { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.muster-modal { max-width: 520px; }
.muster-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.muster-head .icon-btn { font-size: 1.3rem; line-height: 1; flex-shrink: 0; }
.muster-img { width: 100%; height: auto; border-radius: 10px; border: 1px solid var(--border); margin: 10px 0; }
.muster-text { margin: 0; }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 60;
  background: var(--navy); color: #fff; padding: 10px 18px; border-radius: 12px; font-size: .92rem;
  box-shadow: var(--shadow);
}
@media not all { .toast { background: var(--surface-3); } }

/* Einfache Status-Seiten (ungültig / abgelaufen / Fehler) */
.center { max-width: 520px; margin: 8vh auto 0; padding: 0 16px; text-align: center; }
.center p { color: var(--muted); }
.loading { color: var(--muted); text-align: center; padding: 60px 0; }

/* Rechtliche Links */
.legal-links { position: relative; z-index: 1; text-align: center; font-size: .82rem; color: var(--muted); padding: 0 16px 28px; }
.legal-links a { color: var(--muted); }

/* Kundenseiten: Hell ist Standard; Dark-Regeln bleiben im Code, sind aber abgeschaltet (@media not all). */
:root{color-scheme:light}

/* Dokumenterkennung je Datei (datei-info.js): Rückfrage "Stimmt das?", Bearbeiten, Hinweise des Servers */
.erkennung-karte { flex: 1 1 100%; border: 1px solid color-mix(in srgb, var(--teal) 40%, transparent); background: color-mix(in srgb, var(--teal) 8%, transparent); border-radius: 10px; padding: 8px 12px; }
.erkennung-karte p { margin: 0 0 4px; }
.erkennung-titel { font-size: .78rem; color: var(--muted); }
.erkennung-text { font-size: .95rem; }
.erkennung-frage { font-size: .86rem; font-weight: 600; margin-top: 6px !important; }
.erkennung-abgelaufen { font-size: .82rem; color: var(--error); font-weight: 600; }
.erkennung-knoepfe { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.typ-editor { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; margin-top: 8px; }
.typ-editor .typ-label { font-size: .78rem; color: var(--muted); }
.typ-editor input[type="date"] { font-size: .85rem; padding: 4px 8px; border-radius: 8px; max-width: 180px; }
.server-hint { font-weight: 600; flex: 1 1 100%; }

/* Foto aufnehmen: nur auf Geräten mit Touch-Bedienung (Handy/Tablet) sichtbar, öffnet direkt die Kamera */
.cam-row { display: none; margin: 8px 0 4px; }
.cam-input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
@media (pointer: coarse) { .cam-row { display: block; } .cam-btn { width: 100%; } }

/* Vom Büro nachgefordert */
.cl-requested { display: inline-block; margin-top: 3px; padding: 2px 8px; border-radius: 8px; font-size: .76rem; font-weight: 600; background: rgba(225, 140, 20, .16); color: #8A4B00; }
.cl-requested[hidden] { display: none; }
.cl-by { display: inline-block; margin-top: 3px; padding: 2px 8px; border-radius: 8px; font-size: .76rem; font-weight: 600; background: rgba(11, 75, 156, .1); color: #0B4B9C; }
.cl-item input:disabled { cursor: not-allowed; }
