/* Leaderfassung – Meesenburg Design System.
   Farben und Typografie aus dem CI-Farbsystem (Meesenburg Blau, Grauer Grund).
   Bewusst nur hell: das Markenhandbuch gibt keine dunkle Palette vor. */

/* ---------- Schriften (selbst gehostet, nur die genutzten Schnitte) ---------- */

@font-face {
  font-family: "Roboto"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("../fonts/Roboto-Regular.ttf") format("truetype");
}
@font-face {
  font-family: "Roboto"; font-style: normal; font-weight: 500; font-display: swap;
  src: url("../fonts/Roboto-Medium.ttf") format("truetype");
}
@font-face {
  font-family: "Roboto"; font-style: normal; font-weight: 700; font-display: swap;
  src: url("../fonts/Roboto-Bold.ttf") format("truetype");
}
@font-face {
  font-family: "Roboto Condensed"; font-style: normal; font-weight: 700; font-display: swap;
  src: url("../fonts/Roboto_Condensed-Bold.ttf") format("truetype");
}

:root {
  /* Marke */
  --blau: #24366E;
  --blau-dark: #1B2855;
  --blau-darker: #131E40;
  --weiss: #FFFFFF;
  --grund: #ECF2F6;
  --grau: #99999B;
  --grau-light: #C8CDD2;
  --grau-dark: #5C6470;
  --schwarz: #000000;
  --border: #DDE3E8;
  --rot: #E74011;

  --font: "Roboto", -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  --font-cond: "Roboto Condensed", "Roboto", "Arial Narrow", Arial, sans-serif;

  --r: 4px;
  --pill: 999px;

  color-scheme: light;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--weiss);
  color: var(--schwarz);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.55;
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
}

body {
  display: flex;
  flex-direction: column;
}

button, input, select, textarea { font: inherit; color: inherit; }

:where(button, input, select, textarea, a, [tabindex]):focus-visible {
  outline: 2px solid var(--blau);
  outline-offset: 2px;
}

/* ---------- Kopfbereich ---------- */

#statusStrip {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 22px;
  padding: max(env(safe-area-inset-top), 4px) 14px 4px;
  background: var(--blau);
  color: rgba(255,255,255,.75);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: .02em;
}

#stripEvent {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#stripNet { flex: none; }
#stripNet.off { color: #FFED00; }

#topbar {
  flex: none;
  display: flex;
  align-items: center;
  min-height: 56px;
  padding: 0 8px 0 8px;
  background: var(--blau);
  color: var(--weiss);
}

.hd-slot {
  flex: none;
  width: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.hd-title {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 4px 0;
}

.hd-title h1 {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

.hd-step {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: rgba(255,255,255,.7);
}

.icon-btn {
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: var(--r);
  background: rgba(255,255,255,.12);
  color: var(--weiss);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
}

.icon-btn.plain { background: none; }
.icon-btn svg { display: block; }

.txt-btn {
  border: 0;
  background: none;
  color: var(--weiss);
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  padding: 8px 4px;
}

[hidden] { display: none !important; }

/* Fortschritt der zweistufigen Prüfung */
#stepBar {
  flex: none;
  display: flex;
  height: 3px;
}
#stepBar i { flex: 1; background: var(--border); }
#stepBar i.on { background: var(--blau); }

/* ---------- Grundgerüst ---------- */

main {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

/* .screen = Top-Level-Bildschirm (wird von der Navigation umgeschaltet).
   .pane   = innerer Flex-Container, den die Navigation nicht anfassen darf. */
.screen, .pane {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.foot {
  flex: none;
  padding: 12px 16px max(env(safe-area-inset-bottom), 16px);
  border-top: 1px solid var(--border);
  background: var(--weiss);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.spacer { margin-top: auto; }

/* ---------- Typografie-Bausteine ---------- */

.ey {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--grau);
}

.ey.brand { color: var(--blau); }

.cap {
  font-size: 12px;
  line-height: 1.4;
  color: var(--grau);
}

.num {
  font-family: var(--font-cond);
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  color: var(--blau);
}

.tab { font-variant-numeric: tabular-nums; }

.panel { background: var(--grund); padding: 16px; }

.rule { border: 0; border-top: 1px solid var(--border); margin: 0; }

/* ---------- Schaltflächen ---------- */

.primary, .secondary, .ghost, .linkbtn {
  border-radius: var(--r);
  cursor: pointer;
  font-family: inherit;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  text-align: center;
}

.primary {
  border: 0;
  background: var(--blau);
  color: var(--weiss);
  font-size: 19px;
  font-weight: 700;
  min-height: 60px;
  padding: 0 16px;
}
.primary:active { background: var(--blau-dark); }
.primary.xl { min-height: 80px; font-size: 21px; }
.primary.sm { min-height: 52px; font-size: 17px; }

.secondary {
  border: 1.5px solid var(--blau);
  background: var(--weiss);
  color: var(--blau);
  font-size: 18px;
  font-weight: 500;
  min-height: 60px;
  padding: 0 16px;
}
.secondary:active { background: var(--grund); }
.secondary.sm { min-height: 52px; font-size: 16px; }

.ghost {
  border: 0;
  background: var(--grund);
  color: var(--blau);
  font-size: 15px;
  font-weight: 500;
  min-height: 48px;
  padding: 0 12px;
}

.linkbtn {
  border: 0;
  background: none;
  color: var(--blau);
  font-size: 15px;
  font-weight: 500;
  min-height: 44px;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.primary:disabled, .secondary:disabled, .ghost:disabled {
  opacity: .45;
  cursor: default;
}

.icon-square {
  flex: none;
  width: 52px;
  height: 52px;
  border: 0;
  border-radius: var(--r);
  background: var(--grund);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.row-btns { display: flex; gap: 10px; }
.row-btns > * { flex: 1; }

/* ---------- Startseite ---------- */

.counter {
  background: var(--grund);
  padding: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.counter-big {
  font-family: var(--font-cond);
  font-variant-numeric: tabular-nums;
  font-size: 88px;
  line-height: .95;
  font-weight: 700;
  color: var(--blau);
  margin: 6px 0 10px;
}

.counter-split {
  display: flex;
  width: 100%;
  border-top: 1px solid var(--border);
  padding-top: 14px;
}

.counter-split > div {
  flex: 1;
  text-align: center;
}

.counter-split .num { font-size: 24px; }
.counter-split .divider { flex: none; width: 1px; background: var(--border); }

.home-foot {
  margin-top: auto;
  border-top: 1px solid var(--border);
  padding-top: 12px;
}

/* ---------- Scan ---------- */

#screen-scan .body { padding: 0; gap: 0; overflow: hidden; }

.cam {
  flex: 1;
  min-height: 0;
  position: relative;
  background: var(--blau-darker);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.cam video, .cam img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cam-frame {
  position: relative;
  width: min(300px, 84%);
  aspect-ratio: 5 / 3;
}

.cam-frame i {
  position: absolute;
  width: 34px;
  height: 34px;
}
.cam-frame i:nth-child(1) { top: 0; left: 0; border-top: 3px solid #fff; border-left: 3px solid #fff; }
.cam-frame i:nth-child(2) { top: 0; right: 0; border-top: 3px solid #fff; border-right: 3px solid #fff; }
.cam-frame i:nth-child(3) { bottom: 0; left: 0; border-bottom: 3px solid #fff; border-left: 3px solid #fff; }
.cam-frame i:nth-child(4) { bottom: 0; right: 0; border-bottom: 3px solid #fff; border-right: 3px solid #fff; }

.cam-hint {
  position: absolute;
  top: 24px;
  left: 16px;
  right: 16px;
  text-align: center;
  color: rgba(255,255,255,.85);
  font-size: 15px;
  font-weight: 500;
}

.cam-note {
  position: absolute;
  bottom: 20px;
  left: 16px;
  right: 16px;
  background: rgba(36,54,110,.75);
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--weiss);
  font-size: 14px;
}

.cam-note i {
  flex: none;
  width: 10px;
  height: 10px;
  background: var(--weiss);
}

/* Rückfallebene ohne Kamerafreigabe: Fläche zum Auslösen der iOS-Kamera */
.cam-fallback {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: rgba(255,255,255,.85);
  font-size: 15px;
  font-weight: 500;
  text-align: center;
  padding: 24px;
  cursor: pointer;
}

/* ---------- Formular ---------- */

.recap {
  flex: none;
  background: var(--grund);
  border-bottom: 1px solid var(--border);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.recap-count { font-size: 22px; line-height: 1.1; }

.badge {
  flex: none;
  background: var(--blau);
  color: var(--weiss);
  font-size: 13px;
  font-weight: 500;
  padding: 8px 12px;
  border-radius: var(--r);
}

.badge.ok { background: var(--weiss); color: var(--blau); border: 1px solid var(--border); }

.recap-name { font-size: 16px; font-weight: 700; color: var(--blau); }

label { display: block; }

.lbl {
  display: block;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--grau-dark);
  margin-bottom: 4px;
}

input[type="text"], input[type="email"], input[type="tel"], input[type="password"],
input[type="search"], select, textarea {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: var(--weiss);
  padding: 0 12px;
  font-size: 16px;
}

textarea {
  min-height: 132px;
  padding: 12px;
  line-height: 1.5;
  resize: vertical;
}

select {
  appearance: none;
  padding-right: 40px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%2324366E' stroke-width='1.75' stroke-linecap='square'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}

/* Feld, das geprüft werden soll */
.check input, .check textarea {
  border: 2px solid var(--blau);
  background: var(--grund);
  font-weight: 500;
}

.check .lbl::after {
  content: "· prüfen";
  color: var(--blau);
  margin-left: 4px;
}

.grid2, .grid-street, .grid-city { display: flex; gap: 10px; }
.grid2 > * { flex: 1; min-width: 0; }
.grid-street > *:first-child { flex: 2; min-width: 0; }
.grid-street > *:last-child { flex: 1; min-width: 0; }
.grid-city > *:first-child { flex: 1; min-width: 0; }
.grid-city > *:last-child { flex: 2; min-width: 0; }

/* Aufklappbarer Rest der Kontaktdaten */
.more { border-top: 1px solid var(--border); padding-top: 12px; }

.more > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  list-style: none;
  cursor: pointer;
  min-height: 32px;
  font-size: 12px;
  color: var(--grau);
}
.more > summary::-webkit-details-marker { display: none; }
.more > summary svg { flex: none; transition: transform 180ms cubic-bezier(.16,1,.3,1); }
.more[open] > summary svg { transform: rotate(180deg); }

.more-fields { display: flex; flex-direction: column; gap: 14px; padding-top: 14px; }

/* Interesse-Chips */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }

.chip {
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: var(--weiss);
  color: var(--blau);
  padding: 9px 12px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
}

.chip[aria-pressed="true"] {
  border-color: var(--blau);
  background: var(--blau);
  color: var(--weiss);
}

.kv { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.kv .lbl { margin: 0; }
.kv span:last-child { font-size: 14px; text-align: right; }

.form-thumb {
  width: 100%;
  max-height: 150px;
  object-fit: contain;
  background: var(--grund);
  border: 1px solid var(--border);
}

/* ---------- Liste ---------- */

.list-head {
  flex: none;
  background: var(--grund);
  border-bottom: 1px solid var(--border);
  padding: 12px 16px;
}

.search-wrap { position: relative; }
.search-wrap svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); }
.search-wrap input { min-height: 44px; padding-left: 38px; }

.list-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 10px;
}

#screen-list .body { padding: 0 16px; gap: 0; }

.lead-list { list-style: none; margin: 0; padding: 0; }

.lead-list .group {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--grau);
  padding: 16px 0 6px;
}

.lead-list .item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  background: none;
  padding: 14px 0;
  text-align: left;
  cursor: pointer;
}

.lead-list .item.flagged {
  background: var(--grund);
  padding: 14px 12px;
  margin: 0 -12px;
}

.lead-list .name { font-size: 17px; font-weight: 700; color: var(--blau); }
.lead-list .firma { font-size: 14px; margin-top: 2px; }
.lead-list .item .cap { margin-top: 2px; }

.flag {
  display: inline-flex;
  align-items: center;
  margin-top: 6px;
  border: 1px solid var(--blau);
  border-radius: var(--pill);
  padding: 2px 10px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--blau);
}

.empty { padding: 32px 0; text-align: center; color: var(--grau); font-size: 14px; }

/* ---------- Detail ---------- */

.detail-head { padding-bottom: 14px; border-bottom: 1px solid var(--border); }
.detail-name { font-size: 26px; font-weight: 700; color: var(--blau); line-height: 1.2; }
.detail-role { font-size: 16px; margin-top: 2px; }

.detail-rows { display: flex; flex-direction: column; }

.detail-rows > div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 0;
  border-bottom: 1px solid var(--border);
}

.detail-rows .lbl { margin: 0; flex: none; }
.detail-rows span:last-child { font-size: 15px; text-align: right; overflow-wrap: anywhere; }

.photo-empty {
  height: 132px;
  background: var(--grund);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

/* ---------- Export ---------- */

.export-count { font-size: 56px; line-height: 1; margin: 6px 0 0; }

.note {
  border: 2px solid var(--blau);
  padding: 12px 14px;
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.note svg { flex: none; margin-top: 2px; }
.note-title { font-size: 14px; font-weight: 500; color: var(--blau); }

/* ---------- Einstellungen ---------- */

.section-head {
  border-top: 1px solid var(--border);
  padding-top: 14px;
  margin-top: 4px;
}

.section-head:first-child { border-top: 0; padding-top: 0; margin-top: 0; }

.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--grund);
  padding: 14px;
}

.switch {
  flex: none;
  width: 52px;
  height: 30px;
  border: 0;
  border-radius: var(--pill);
  background: var(--grau-light);
  display: flex;
  align-items: center;
  padding: 0 3px;
  cursor: pointer;
}

.switch i {
  width: 24px;
  height: 24px;
  border-radius: var(--pill);
  background: var(--weiss);
  transition: transform 180ms cubic-bezier(.16,1,.3,1);
}

.switch[aria-checked="true"] { background: var(--blau); }
.switch[aria-checked="true"] i { transform: translateX(22px); }

.settings-foot {
  margin-top: auto;
  border-top: 1px solid var(--border);
  padding-top: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

/* ---------- Status und Hinweise ---------- */

.status {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--grund);
  padding: 12px 14px;
  font-size: 14px;
  font-weight: 500;
  color: var(--blau);
}

.status.error {
  background: var(--weiss);
  border: 2px solid var(--rot);
  color: var(--rot);
}

.status.ok { color: var(--blau); }

.spinner {
  flex: none;
  width: 16px;
  height: 16px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: var(--pill);
  animation: spin .7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.toast {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: max(env(safe-area-inset-bottom), 16px);
  z-index: 300;
  background: var(--blau);
  color: var(--weiss);
  padding: 14px 16px;
  border-radius: var(--r);
  font-size: 15px;
  font-weight: 500;
  text-align: center;
  box-shadow: 0 12px 32px rgba(0,0,0,.12);
}

@media (prefers-reduced-motion: reduce) {
  .spinner { animation-duration: 2s; }
  .switch i, .more > summary svg { transition: none; }
}
