/* =====================================================================
   Visitenkarten-Scanner (vs-) und Kontaktfelder (cf-) — docs/visitenkarten-mappe.md
   Partials partials/_card_scanner.php und partials/_contact_fields.php.
   Mobil zuerst (Messe!), große Tippflächen. Läuft im Dashboard-Layout (app.css)
   und im Landing-Layout (app.css + landing.css): Farben über die app.css-Variablen
   mit Rückfallwerten, Dunkelmodus über :root[data-theme="dark"] wie app.css.
   Spalten richten sich nach der Breite des Scanners bzw. Formulars (Container-
   Abfragen) — im Dashboard nimmt die Seitenleiste Platz weg. Ohne Unterstützung
   bleibt es bei der einspaltigen Handy-Ansicht.
   ===================================================================== */

.vs,
.cf,
.vs-live {
  --vs-primary: var(--primary, #1d4ed8);
  --vs-on-primary: var(--on-primary, #fff);
  --vs-text: var(--text, #18181b);
  --vs-muted: var(--muted, #6b7280);
  --vs-border: var(--border, #e5e7eb);
  --vs-surface: var(--surface, #fff);
  --vs-bg: var(--bg, #f7f7f9);
  --vs-danger: var(--danger, #dc2626);
  --vs-radius: var(--radius, 14px);
  --vs-shadow: var(--shadow, 0 1px 3px rgba(0, 0, 0, .06), 0 8px 24px rgba(0, 0, 0, .05));
  --vs-soft: #eff6ff;          /* Hintergrund der Symbol-Kacheln */
  --vs-ok-bg: #ecfdf5;
  --vs-ok-text: #065f46;
  --vs-ok-border: #a7f3d0;
}
@supports (color: color-mix(in srgb, red 50%, blue)) {
  .vs,
  .cf,
  .vs-live { --vs-soft: color-mix(in srgb, var(--vs-primary) 10%, var(--vs-surface)); }
}
:root[data-theme="dark"] .vs,
:root[data-theme="dark"] .cf,
:root[data-theme="dark"] .vs-live {
  --vs-soft: #0e1f38;
  --vs-ok-bg: #0e2a1f;
  --vs-ok-text: #6ee7b7;
  --vs-ok-border: #14532d;
}

/* Gesteuert über das hidden-Attribut — Klassen mit display dürfen es nicht aushebeln */
.vs [hidden],
.cf [hidden],
.vs-live[hidden],
.vs-live [hidden] { display: none !important; }

/* Nur für Bildschirmleser */
.cf-sr,
.vs-sr {
  position: absolute !important;
  width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* ---------------------------------------------------------------- Scanner */

.vs {
  max-width: 1120px;
  margin: 0 auto;
  color: var(--vs-text);
  text-align: left;
  container: vs / inline-size;
}
.vs *,
.vs *::before,
.vs *::after { box-sizing: border-box; }

.vs-boot { margin: 0 0 1rem; }
/* Ohne JavaScript steht der <noscript>-Hinweis da — „Der Scanner startet …" wäre dann falsch */
@media (scripting: none) {
  .vs-boot { display: none; }
}
.vs-noscript { margin-bottom: 1rem; }
.vs-noscript a { font-weight: 600; margin-left: .25rem; }

.vs-panel {
  background: var(--vs-surface);
  border: 1px solid var(--vs-border);
  border-radius: var(--vs-radius);
  box-shadow: var(--vs-shadow);
  padding: 1rem;
  margin: 0 0 1rem;
  min-width: 0;
}
@container vs (width >= 600px) {
  .vs-panel { padding: 1.25rem 1.4rem; }
}

.vs-h {
  display: flex;
  align-items: center;
  gap: .55rem;
  margin: 0 0 .9rem;
  font-size: 1.12rem;
  line-height: 1.3;
  letter-spacing: -.01em;
  color: var(--vs-text);
}
.vs-h > i { color: var(--vs-primary); }

.vs-hint {
  margin: .4rem 0 0;
  font-size: .82rem;
  line-height: 1.45;
  color: var(--vs-muted);
}

.vs-row {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  margin-top: .8rem;
}
.vs-row .btn { min-height: 44px; }

/* Meldung oben (Fehler) mit optionalem Knopf „Erneut versuchen" */
.vs-msg {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .6rem;
}
.vs-msg .vs-msg-text { flex: 1 1 16rem; }

/* Aufnahme: ein großer Start (Live-Scan) mit stilisiertem Sucher, darunter Foto/Bild */
.vs-start {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .35rem;
  width: 100%;
  margin: 0;
  padding: 1.4rem 1.1rem 1.25rem;
  border: 0;
  border-radius: 18px;
  background: var(--vs-primary);
  background-image: radial-gradient(120% 90% at 50% 0%, rgba(255, 255, 255, .18), transparent 60%);
  color: var(--vs-on-primary);
  font: inherit;
  text-align: center;
  cursor: pointer;
  box-shadow: 0 14px 32px -18px rgba(29, 78, 216, .9);
  transition: transform .06s, box-shadow .15s;
  -webkit-tap-highlight-color: transparent;
}
.vs-start:hover { box-shadow: 0 18px 36px -16px rgba(29, 78, 216, .95); }
.vs-start:active { transform: translateY(1px) scale(.995); }
.vs-start:focus-visible { outline: 3px solid var(--vs-primary); outline-offset: 3px; }
.vs-start-vf {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 7.2rem;
  height: 4.8rem;
  margin-bottom: .45rem;
  border-radius: 12px;
  /* Sucher-Ecken als vier Verläufe */
  background:
    linear-gradient(currentColor, currentColor) top left / 1.1rem 3px no-repeat,
    linear-gradient(currentColor, currentColor) top left / 3px 1.1rem no-repeat,
    linear-gradient(currentColor, currentColor) top right / 1.1rem 3px no-repeat,
    linear-gradient(currentColor, currentColor) top right / 3px 1.1rem no-repeat,
    linear-gradient(currentColor, currentColor) bottom left / 1.1rem 3px no-repeat,
    linear-gradient(currentColor, currentColor) bottom left / 3px 1.1rem no-repeat,
    linear-gradient(currentColor, currentColor) bottom right / 1.1rem 3px no-repeat,
    linear-gradient(currentColor, currentColor) bottom right / 3px 1.1rem no-repeat;
}
.vs-start-card { font-size: 2.3rem; line-height: 1; opacity: .95; }
.vs-start-line {
  position: absolute;
  left: 12%;
  right: 12%;
  top: 50%;
  height: 2px;
  border-radius: 2px;
  background: #86efac;
  box-shadow: 0 0 10px 2px rgba(134, 239, 172, .7);
  animation: vs-sweep 2.4s ease-in-out infinite alternate;
}
@keyframes vs-sweep { from { top: 18%; } to { top: 82%; } }
.vs-start-t { font-size: 1.25rem; font-weight: 800; letter-spacing: -.01em; line-height: 1.25; }
.vs-start-s { max-width: 30rem; font-size: .9rem; line-height: 1.4; opacity: .9; }

.vs-alts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .6rem;
  margin-top: .7rem;
}
.vs-alt {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  min-height: 50px;
  margin: 0;
  padding: .55rem .8rem;
  border: 1px solid var(--vs-border);
  border-radius: 12px;
  background: var(--vs-surface);
  color: var(--vs-text);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.vs-alt > i { color: var(--vs-primary); }
.vs-alt:hover { border-color: var(--vs-primary); background: var(--vs-soft); }
.vs-alt:focus-visible { outline: 3px solid var(--vs-primary); outline-offset: 2px; }

/* Sprache der Karte und Tipps — eingeklappt, die Vorgabe passt meist */
.vs-more {
  margin-top: .9rem;
  border: 1px solid var(--vs-border);
  border-radius: 12px;
  padding: 0 .9rem;
}
.vs-more > summary {
  display: flex;
  align-items: center;
  gap: .55rem;
  min-height: 46px;
  font-size: .92rem;
  cursor: pointer;
  list-style: none;
}
.vs-more > summary::-webkit-details-marker { display: none; }
.vs-more > summary > i { color: var(--vs-muted); }
.vs-more > summary::after {
  content: "";
  flex: none;
  width: .45rem;
  height: .45rem;
  margin-left: auto;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
  opacity: .6;
}
.vs-more[open] > summary::after { transform: rotate(-135deg); }
.vs-more[open] > summary { border-bottom: 1px solid var(--vs-border); }
.vs-more .vs-opts { margin: .9rem 0; }

/* Unsichtbare Dateifelder (die Knöpfe öffnen sie) */
.vs-capture { position: relative; }
.vs-file {
  position: absolute !important;
  width: 1px; height: 1px;
  opacity: 0;
  overflow: hidden;
  pointer-events: none;
  clip: rect(0, 0, 0, 0);
}

/* Ziehen & Ablegen nur am Computer anbieten */
.vs-drop-hint { display: none; margin: .7rem 0 0; }
@media (hover: hover) and (pointer: fine) {
  .vs-drop-hint { display: block; }
}
.vs-capture.is-drop {
  outline: 2px dashed var(--vs-primary);
  outline-offset: 4px;
  background: var(--vs-soft);
}

.vs-opts {
  display: grid;
  gap: 1rem;
}
@container vs (width >= 720px) {
  .vs-opts { grid-template-columns: minmax(220px, 320px) minmax(0, 1fr); align-items: start; }
}
.vs-lang label {
  display: block;
  font-weight: 600;
  font-size: .9rem;
  margin: 0 0 .35rem;
}
.vs-lang select { min-height: 44px; font-size: 1rem; }
.vs-tips {
  background: var(--vs-bg);
  border-radius: 12px;
  padding: .75rem .9rem;
  font-size: .9rem;
}
.vs-tips-h { margin: 0; font-weight: 700; }
.vs-tips-h > i { color: #d97706; margin-right: .25rem; }
.vs-tips ul { margin: .35rem 0 0; padding-left: 1.15rem; }
.vs-tips li { margin: .15rem 0; }

.vs-privacy {
  display: flex;
  align-items: flex-start;
  gap: .6rem;
  margin: 1rem 0 0;
  padding: .75rem .9rem;
  border-radius: 12px;
  border: 1px solid var(--vs-ok-border);
  background: var(--vs-ok-bg);
  color: var(--vs-ok-text);
  font-size: .92rem;
  font-weight: 600;
  line-height: 1.45;
}
.vs-privacy > i { margin-top: .15rem; flex: none; }
/* Mappe: Hinweis zur eigenen Verantwortung (Text in einem <span>, sonst zerfiele er in Flex-Teile) */
.vs-duty {
  display: flex;
  align-items: flex-start;
  gap: .55rem;
  margin: .7rem 0 0;
}
.vs-duty > i { flex: none; margin-top: .2rem; }
.vs-duty a { font-weight: 600; }

/* ------------------------------------------------------------ Live-Scan
   Kamerabild mit Kartenrahmen (85 : 55), Hinweis oben, Chips der erkannten Angaben
   und Auslöser unten. Im Fluss der Seite als Kasten; am Handy (.is-full, das Panel
   hängt dann am <body>) als Vollbild über allem — auch über Support-Blase und Chat. */
.vs-live { padding: 0; overflow: hidden; background: #000; border-color: #000; }
/* Im Vollbild hängt das Panel außerhalb von .vs — Maße deshalb hier selbst festlegen */
.vs-live,
.vs-live *,
.vs-live *::before,
.vs-live *::after { box-sizing: border-box; }
.vs-cam {
  position: relative;
  overflow: hidden;
  background: #000;
  aspect-ratio: 4 / 3;
  max-height: 74vh;
  width: 100%;
  margin: 0 auto;
  color: #fff;
}
@media (min-width: 900px) {
  .vs-cam { aspect-ratio: 16 / 10; }
}
.vs-cam video {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.vs-frame {
  position: absolute;
  top: 44%;
  left: 50%;
  width: min(84%, 560px);
  aspect-ratio: 85 / 55;
  transform: translate(-50%, -50%);
  border-radius: 16px;
  box-shadow: 0 0 0 100vmax rgba(0, 0, 0, .42);
  pointer-events: none;
  transition: box-shadow .25s;
}
@media (min-width: 900px) {
  .vs-frame { width: min(62%, 560px); }
}
.vs-corner {
  position: absolute;
  width: 2.1rem;
  height: 2.1rem;
  border: 4px solid #fff;
  transition: border-color .2s;
}
.vs-corner--tl { top: -2px; left: -2px; border-right: 0; border-bottom: 0; border-top-left-radius: 16px; }
.vs-corner--tr { top: -2px; right: -2px; border-left: 0; border-bottom: 0; border-top-right-radius: 16px; }
.vs-corner--bl { bottom: -2px; left: -2px; border-right: 0; border-top: 0; border-bottom-left-radius: 16px; }
.vs-corner--br { bottom: -2px; right: -2px; border-left: 0; border-top: 0; border-bottom-right-radius: 16px; }
.vs-scanline {
  position: absolute;
  left: 4%;
  right: 4%;
  top: 50%;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, transparent, #4ade80 20%, #4ade80 80%, transparent);
  box-shadow: 0 0 12px 2px rgba(74, 222, 128, .6);
  animation: vs-sweep 2.2s ease-in-out infinite alternate;
}
/* Etwas erkannt: Ecken grün; ausgelöst: Rahmen leuchtet, die Linie steht */
.vs-cam.is-seen .vs-corner { border-color: #86efac; }
.vs-cam.is-lock .vs-corner { border-color: #22c55e; }
.vs-cam.is-lock .vs-frame { box-shadow: 0 0 0 4px rgba(34, 197, 94, .55), 0 0 0 100vmax rgba(0, 0, 0, .55); }
.vs-cam.is-lock .vs-scanline { animation: none; opacity: 0; }

.vs-cam-top {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: flex-start;
  gap: .6rem;
  padding: .7rem;
  background: linear-gradient(rgba(0, 0, 0, .55), transparent);
}
.vs-live-hint {
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
  padding: .55rem .8rem;
  border-radius: 12px;
  background: rgba(0, 0, 0, .45);
  color: #fff;
  font-size: .92rem;
  font-weight: 600;
  line-height: 1.35;
  text-align: center;
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}
.vs-live-hint:empty { visibility: hidden; }
.vs-cam-btn {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, .45);
  color: #fff;
  font: inherit;
  font-size: 1.15rem;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.vs-cam-btn:hover { background: rgba(0, 0, 0, .65); }
.vs-cam-btn:focus-visible,
.vs-shutter:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }
.vs-cam-btn[aria-pressed="true"] { background: #fff; color: #111827; }
.vs-auto { font-size: .72rem; font-weight: 800; letter-spacing: .04em; }

.vs-live-note {
  position: absolute;
  left: 50%;
  top: 4.4rem;
  transform: translateX(-50%);
  max-width: calc(100% - 2rem);
  padding: .55rem .9rem;
  border-radius: 999px;
  background: #15803d;
  color: #fff;
  font-size: .9rem;
  font-weight: 700;
  box-shadow: 0 10px 24px -10px rgba(0, 0, 0, .6);
  animation: vs-pop .25s ease-out;
}
.vs-live-note.is-warn { background: #b45309; }
@keyframes vs-pop { from { opacity: 0; transform: translate(-50%, -6px); } to { opacity: 1; transform: translate(-50%, 0); } }

.vs-cam-bottom {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 2.2rem .8rem .7rem;
  background: linear-gradient(transparent, rgba(0, 0, 0, .72) 45%);
}
.vs-found {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: .35rem;
  margin: 0 0 .7rem;
  padding: 0;
  list-style: none;
}
.vs-fd {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  max-width: 100%;
  min-height: 32px;
  padding: .25rem .7rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, .14);
  color: rgba(255, 255, 255, .72);
  font-size: .82rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  transition: background .2s, color .2s;
}
.vs-fd-t { overflow: hidden; text-overflow: ellipsis; }
.vs-fd.is-seen { background: rgba(255, 255, 255, .3); color: #fff; }
.vs-fd.is-ok { background: #16a34a; color: #fff; }
.vs-cam-ctrl {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  justify-items: center;
}
/* Auslöser; der Ring zeigt den Fortschritt bis zum automatischen Aufnehmen (--vs-p 0–1) */
.vs-shutter {
  --vs-p: 0;
  position: relative;
  width: 76px;
  height: 76px;
  margin: 0;
  padding: 5px;
  border: 0;
  border-radius: 50%;
  background: conic-gradient(#22c55e calc(var(--vs-p) * 360deg), rgba(255, 255, 255, .45) 0);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform .06s;
}
.vs-shutter > span {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: #fff;
  border: 3px solid rgba(0, 0, 0, .55);
}
.vs-shutter:active { transform: scale(.94); }
.vs-cam-note {
  margin: .55rem 0 0;
  text-align: center;
  font-size: .74rem;
  color: rgba(255, 255, 255, .7);
}

/* Vollbild am Handy */
html.vs-noscroll,
html.vs-noscroll body { overflow: hidden; }
.vs-live.is-full {
  position: fixed;
  inset: 0;
  z-index: 100050;
  margin: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}
.vs-live.is-full .vs-cam {
  position: absolute;
  inset: 0;
  aspect-ratio: auto;
  max-height: none;
  height: 100%;
}
.vs-live.is-full .vs-cam-top { padding-top: calc(.7rem + env(safe-area-inset-top, 0px)); }
.vs-live.is-full .vs-cam-bottom { padding-bottom: calc(.8rem + env(safe-area-inset-bottom, 0px)); }
.vs-live.is-full .vs-frame { top: 42%; width: min(88%, 560px); }
@media (orientation: landscape) and (max-height: 500px) {
  .vs-live.is-full .vs-frame { top: 46%; width: auto; height: 62%; }
  .vs-live.is-full .vs-cam-bottom { padding-top: 1rem; }
}

@media (prefers-reduced-motion: reduce) {
  .vs-scanline,
  .vs-start-line { animation: none; }
  .vs-live-note { animation: none; }
}

/* Erkennung und Ergebnis */
.vs-work {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1rem;
  margin-bottom: 1rem;
}
.vs-work > .vs-panel { margin: 0; }
@container vs (width >= 900px) {
  .vs-work {
    grid-template-columns: minmax(300px, 380px) minmax(0, 1fr);
    align-items: start;
  }
  /* Vorschau bleibt beim Scrollen durch das Formular sichtbar (Kopfleiste ≈ 76 px) */
  .vs-recog { position: sticky; top: 92px; }
}

.vs-sides {
  display: flex;
  gap: .35rem;
  margin: 0 0 .6rem;
}
.vs-side {
  flex: 1;
  min-height: 42px;
  padding: .4rem .6rem;
  border: 1px solid var(--vs-border);
  border-radius: 10px;
  background: var(--vs-surface);
  color: var(--vs-muted);
  font: inherit;
  font-size: .88rem;
  font-weight: 600;
  cursor: pointer;
}
.vs-side[aria-pressed="true"] {
  background: var(--vs-primary);
  border-color: var(--vs-primary);
  color: var(--vs-on-primary);
}
.vs-side:focus-visible { outline: 2px solid var(--vs-primary); outline-offset: 2px; }

.vs-preview {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 120px;
  overflow: hidden;
  border-radius: 12px;
  background: var(--vs-bg);
  border: 1px solid var(--vs-border);
}
.vs-shot {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 38vh;
}
@container vs (width >= 900px) {
  .vs-shot { max-height: 52vh; }
}

.vs-progress { margin-top: .75rem; }
.vs-progress progress {
  display: block;
  width: 100%;
  height: 8px;
  accent-color: var(--vs-primary);
}
.vs:not(.is-busy) .vs-progress progress { display: none; }
.vs-status {
  margin: .45rem 0 0;
  min-height: 1.35em;
  font-size: .92rem;
  line-height: 1.4;
  color: var(--vs-muted);
}
.vs.is-busy .vs-status { color: var(--vs-text); }
.vs.is-busy .vs-status::before {
  content: "";
  display: inline-block;
  width: .9em;
  height: .9em;
  margin-right: .45rem;
  vertical-align: -.12em;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: vs-spin .8s linear infinite;
}
@keyframes vs-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .vs.is-busy .vs-status::before { animation: none; border-right-color: currentColor; opacity: .5; }
}
.vs .btn[disabled] { opacity: .5; cursor: not-allowed; }

.vs-result { scroll-margin-top: 92px; }
.vs-source {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: .45rem;
}
.vs-source p { margin: 0; }
.vs-form { margin: 0; }

.vs-keep {
  margin: .4rem 0 0;
  padding: .8rem .9rem;
  border: 1px dashed var(--vs-border);
  border-radius: 12px;
}

/* Erkannter Text */
.vs-raw {
  margin-top: 1rem;
  border: 1px solid var(--vs-border);
  border-radius: 12px;
  padding: 0 .9rem;
  background: var(--vs-surface);
}
.vs-raw > summary {
  display: flex;
  align-items: center;
  gap: .5rem;
  min-height: 46px;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
}
.vs-raw > summary::-webkit-details-marker { display: none; }
.vs-raw > summary::after {
  content: "";
  width: .45rem;
  height: .45rem;
  margin-left: auto;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
  opacity: .6;
}
.vs-raw[open] > summary::after { transform: rotate(-135deg); }
.vs-raw > summary > i { color: var(--vs-muted); }
.vs-raw[open] > summary { border-bottom: 1px solid var(--vs-border); margin-bottom: .7rem; }
.vs-raw-body { padding-bottom: .8rem; }
.vs-raw-h {
  margin: .4rem 0 .3rem;
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--vs-muted);
}
.vs-raw-none { margin: 0 0 .6rem; font-size: .88rem; color: var(--vs-muted); }
.vs-lines {
  margin: 0 0 .8rem;
  padding-left: 1.6rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .82rem;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  user-select: text;
}
.vs-lines li::marker { color: var(--vs-muted); }
.vs-rest-h { margin: 0 0 .4rem; font-size: .85rem; font-weight: 600; }
.vs-chips {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  margin: 0 0 .6rem;
}
.vs-chip {
  display: inline-flex;
  align-items: stretch;
  max-width: 100%;
  overflow: hidden;
  border: 1px solid var(--vs-border);
  border-radius: 999px;
  background: var(--vs-bg);
}
.vs-chip button {
  margin: 0;
  border: 0;
  background: none;
  color: var(--vs-text);
  font: inherit;
  font-size: .86rem;
  cursor: pointer;
  min-height: 38px;
}
.vs-chip-add {
  padding: .35rem .75rem;
  text-align: left;
  overflow-wrap: anywhere;
}
.vs-chip .vs-chip-copy {
  flex: none;
  padding: .35rem .65rem;
  border-left: 1px solid var(--vs-border);
  color: var(--vs-muted);
}
.vs-chip button:hover { background: var(--vs-soft); }
.vs-chip button:focus-visible { outline: 2px solid var(--vs-primary); outline-offset: -2px; }
.vs-chip.is-used { opacity: .6; }
.vs-chip.is-used .vs-chip-add::before { content: "✓ "; font-weight: 700; color: var(--success, #16a34a); }

.vs-errors { margin: 1rem 0 0; }
.vs-errors p, .vs-errors ul { margin: 0; }
.vs-errors ul { padding-left: 1.1rem; }
/* Knopf „neuer Tab" (Sitzung abgelaufen bzw. Sperre) — die Angaben bleiben hier stehen */
.vs-errors .vs-err-link { margin: .6rem 0 0; }
.vs .vs-tablink { min-height: 40px; }

/* Aktionen. Mappe: unter 900 px am unteren Rand angeheftet, damit „Speichern" immer
   greifbar ist — drei Knöpfe, höchstens zwei Zeilen (Raster unten). Öffentlich: vier
   Knöpfe am Formularende. */
.vs-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .6rem;
  margin-top: 1rem;
}
.vs-actions .btn {
  flex: 1 1 auto;
  min-height: 48px;
}
.vs-actions .vs-main { flex-basis: 100%; font-size: 1rem; }
.vs[data-mode="mappe"] .vs-actions .vs-main { flex: 2 1 12rem; }
.vs[data-mode="mappe"] .vs-actions .btn:not(.vs-main) { flex: 1 1 8rem; }
.vs-save-status {
  flex-basis: 100%;
  margin: 0;
  min-height: 1.3em;
  font-size: .88rem;
  line-height: 1.4;
  color: var(--vs-muted);
}
.vs-save-status:empty { display: none; }
.vs-save-status.is-warn { color: #92400e; font-weight: 600; }
:root[data-theme="dark"] .vs-save-status.is-warn { color: #fcd34d; }
@container vs (width < 900px) {
  /* Angeheftet als Raster statt Umbruch — mit drei Knöpfen und Support-Blase brach die Leiste
     am Handy in drei Zeilen um (rund 190 px über dem Formular). Unter 600 px zwei Zeilen: oben
     „In der Mappe speichern", darunter „Speichern & nächste Karte" und „Nächste Karte" nur als
     Symbol (der Name bleibt für Screenreader, .vs-act-t); ab 600 px eine Zeile. Die Statuszeile
     bekommt erst gefüllt eine eigene Zeile (leer: display none, keine Rasterzeile). */
  .vs[data-mode="mappe"] .vs-actions {
    position: sticky;
    bottom: 0;
    z-index: 5;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "main main" "savenext next";
    gap: .8rem .6rem;
    margin: 1rem -1rem -1rem;
    padding: .7rem 1rem calc(.7rem + env(safe-area-inset-bottom, 0px));
    background: var(--vs-surface);
    border-top: 1px solid var(--vs-border);
    border-radius: 0 0 var(--vs-radius) var(--vs-radius);
    box-shadow: 0 -8px 18px -14px rgba(0, 0, 0, .35);
  }
  .vs[data-mode="mappe"] .vs-actions .vs-main { grid-area: main; }
  .vs[data-mode="mappe"] .vs-actions [data-vs-act="savenext"] { grid-area: savenext; text-align: center; }
  .vs[data-mode="mappe"] .vs-actions [data-vs-act="next"] {
    grid-area: next;
    min-width: 48px;
    padding-left: .85rem;
    padding-right: .85rem;
    border-color: var(--vs-border); /* als Symbol sonst kaum als Knopf erkennbar */
  }
  .vs[data-mode="mappe"] .vs-actions .vs-save-status { grid-column: 1 / -1; }
  .vs[data-mode="mappe"] .vs-actions .vs-act-t {
    position: absolute;
    width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
  }
}
@container vs (600px <= width < 900px) {
  .vs[data-mode="mappe"] .vs-actions {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
    grid-template-areas: "main savenext next";
    margin: 1rem -1.4rem -1.25rem;
    padding-left: 1.4rem;
    padding-right: 1.4rem;
  }
}
/* Feste Knöpfe des Layouts nicht überdecken: Support-Blase unten rechts (_support.php) — Abstand
   hält nur die unterste Zeile („Nächste Karte" bzw. die Statuszeile), „Speichern" darüber bleibt
   breit (der Zeilenabstand hebt es über die Blase); „Cookie-Einstellungen" unten links
   (_consent.php, nur wenn die Seite keinen eigenen hat) */
@container vs (width < 900px) {
  body:has(#vc-support) .vs[data-mode="mappe"] .vs-actions [data-vs-act="next"] { margin-right: 4rem; }
  body:has(#vc-support) .vs[data-mode="mappe"] .vs-actions .vs-save-status { padding-right: 4rem; }
  body:has(> a[data-cc="show-preferencesModal"]) .vs[data-mode="mappe"] .vs-actions {
    padding-bottom: calc(2.1rem + env(safe-area-inset-bottom, 0px));
  }
}
@container vs (width >= 900px) {
  .vs-actions .btn,
  .vs-actions .vs-main,
  .vs[data-mode="mappe"] .vs-actions .vs-main,
  .vs[data-mode="mappe"] .vs-actions .btn:not(.vs-main) { flex: 0 1 auto; }
}

/* QR-Code fürs Handy (immer dunkel auf weiß, auch im Dunkelmodus) */
.vs-qrbox {
  margin-top: 1rem;
  padding: 1rem;
  border: 1px solid var(--vs-border);
  border-radius: 12px;
  text-align: center;
}
.vs-qrcode { display: flex; justify-content: center; }
.vs-qr-svg {
  display: block;
  width: min(100%, 320px);
  height: auto;
  background: #fff;
  border-radius: 8px;
}
.vs-qrmsg {
  max-width: 34rem;
  margin: .75rem auto 0;
  font-size: .9rem;
  line-height: 1.45;
  color: var(--vs-muted);
}

/* ---------------------------------------------------------- Kontaktfelder */

.cf {
  color: var(--vs-text);
  container: cf / inline-size;
}
.cf-group {
  min-width: 0;
  margin: 0 0 1.2rem;
  padding: 0;
  border: 0;
}
.cf-legend {
  margin: 0 0 .55rem;
  padding: 0;
  font-size: .95rem;
  font-weight: 700;
  color: var(--vs-text);
}
.cf-legend > i { width: 1.15rem; margin-right: .3rem; text-align: center; color: var(--vs-primary); }

.cf-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: .7rem;
}
.cf-grid--2,
.cf-grid--extra,
.cf-grid--meta { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@container cf (width >= 440px) {
  .cf-grid--company { grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); }
}
.cf-grid--extra .cf-f--dept { grid-column: 1 / -1; }
.cf-grid--meta .cf-f--check { grid-column: 1 / -1; }
@container cf (width >= 600px) {
  .cf-grid--extra { grid-template-columns: minmax(0, .8fr) minmax(0, .8fr) minmax(0, 1.4fr); }
  .cf-grid--extra .cf-f--dept { grid-column: auto; }
  .cf-grid--meta { grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr) auto; align-items: end; }
  .cf-grid--meta .cf-f--check { grid-column: auto; }
}
@container cf (width < 330px) {
  .cf-grid--2,
  .cf-grid--extra,
  .cf-grid--meta { grid-template-columns: minmax(0, 1fr); }
}

/* „Weitere Angaben": Seltenes eingeklappt — offen, sobald dort etwas steht */
.cf-more {
  margin: 0 0 1rem;
  border: 1px solid var(--vs-border);
  border-radius: 12px;
  background: var(--vs-surface);
}
.cf-more > summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .2rem .55rem;
  min-height: 48px;
  padding: .55rem .9rem;
  cursor: pointer;
  list-style: none;
}
.cf-more > summary::-webkit-details-marker { display: none; }
.cf-more > summary > i { color: var(--vs-primary); transition: transform .15s; }
.cf-more[open] > summary > i { transform: rotate(45deg); }
.cf-more > summary:focus-visible { outline: 2px solid var(--vs-primary); outline-offset: 2px; border-radius: 12px; }
.cf-more-t { font-weight: 700; font-size: .95rem; }
.cf-more-s { color: var(--vs-muted); font-size: .82rem; }
.cf-more[open] .cf-more-s { display: none; }
.cf-more-body { padding: .3rem .9rem .2rem; border-top: 1px solid var(--vs-border); }
.cf-more-body > .cf-grid--extra { margin: .7rem 0 1.2rem; }
.cf-group--last { margin-bottom: .8rem; }

.cf-f { min-width: 0; margin: 0; }
.cf-f > label {
  display: block;
  margin: 0 0 .3rem;
  font-size: .85rem;
  font-weight: 600;
}
/* 16 px: iOS vergrößert sonst beim Antippen jedes Feld */
.cf input,
.cf select,
.cf textarea {
  font-size: 1rem;
  min-height: 44px;
  margin: 0;
}
.cf textarea { min-height: 84px; line-height: 1.45; }
.cf input[type="checkbox"] { min-height: 0; }
.cf-hint {
  margin: .3rem 0 0;
  font-size: .8rem;
  line-height: 1.4;
  color: var(--vs-muted);
}

/* Wiederholbare Zeilen */
.cf-rows {
  display: flex;
  flex-direction: column;
  gap: .5rem;
}
.cf-row {
  display: grid;
  grid-template-columns: minmax(6.5rem, 8.5rem) minmax(0, 1fr) auto;
  gap: .45rem;
  align-items: center;
}
.cf-type,
.cf-val,
.cf-mini {
  display: block;
  min-width: 0;
  margin: 0;
  font-weight: 400;
}
.cf-type select { padding-right: .4rem; }
.cf-del {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  margin: 0;
  padding: 0;
  border: 1px solid var(--vs-border);
  border-radius: 10px;
  background: var(--vs-surface);
  color: var(--vs-muted);
  font: inherit;
  font-size: 1rem;
  cursor: pointer;
}
.cf-del:hover { color: var(--vs-danger); border-color: var(--vs-danger); }
.cf-del:focus-visible,
.cf-add:focus-visible { outline: 2px solid var(--vs-primary); outline-offset: 2px; }
.cf-add {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  min-height: 44px;
  margin: .5rem 0 0;
  padding: .5rem .85rem;
  border: 1px dashed var(--vs-border);
  border-radius: 10px;
  background: none;
  color: var(--vs-primary);
  font: inherit;
  font-size: .9rem;
  font-weight: 600;
  cursor: pointer;
}
.cf-add:hover { border-color: var(--vs-primary); background: var(--vs-soft); }

/* Anschrift: eigene Kachel je Anschrift */
.cf-row--addr {
  display: block;
  padding: .7rem;
  border: 1px solid var(--vs-border);
  border-radius: 12px;
  background: var(--vs-bg);
}
.cf-addr-top {
  display: flex;
  align-items: center;
  gap: .45rem;
  margin-bottom: .55rem;
}
.cf-addr-top .cf-type { flex: 1 1 auto; max-width: 15rem; }
.cf-addr-top .cf-del { margin-left: auto; }
/* Handy: Straße | PLZ + Ort | Region + Land; breit: alles in einer Zeile */
.cf-addr {
  display: grid;
  grid-template-columns: minmax(5.5rem, 7rem) minmax(0, 1fr);
  gap: .55rem;
}
.cf-addr-street { grid-column: 1 / -1; }
@container cf (width >= 720px) {
  .cf-addr { grid-template-columns: minmax(0, 2fr) minmax(5.5rem, 7rem) minmax(0, 1.5fr) minmax(4.5rem, 6.5rem) minmax(0, 1.1fr); }
  .cf-addr-street { grid-column: auto; }
}
.cf-mini > span {
  display: block;
  margin-bottom: .2rem;
  font-size: .78rem;
  font-weight: 600;
  color: var(--vs-muted);
}

/* Häkchen (Favorit, Foto aufbewahren) */
.cf-check {
  display: flex;
  align-items: center;
  gap: .6rem;
  min-height: 44px;
  margin: 0;
  font-weight: 600;
  cursor: pointer;
}
.cf-check input {
  flex: none;
  width: 1.3rem;
  height: 1.3rem;
  margin: 0;
  accent-color: var(--vs-primary);
}
.cf-check .fa-star { color: #f59e0b; }
