/* CRM Neuhaus Solutions – gleiche Gestaltung wie die Website: helle Flächen, weiße Karten,
   schwarze Hauptknöpfe, ein Blau für Links und Fokus. Hell/Dunkel automatisch.
   Handy: Kopfleiste oben, Tab-Leiste unten. Ab 56.25em: Seitenleiste links. */

:root {
  color-scheme: light dark;

  --bg: #f4f4f4;
  --karte: #ffffff;
  --flaeche: #f4f4f4;
  --flaeche-2: #ebebeb;
  --tint: #ecf2fd;

  --ink: #161616;
  --ink-2: #5c5c5c;
  --linie: rgb(22 22 22 / 0.1);
  --linie-stark: rgb(22 22 22 / 0.2);

  --akzent: #1652cc;
  --akzent-ink: #ffffff;
  --fokus: #1652cc;

  --knopf-bg: #161616;
  --knopf-fg: #ffffff;
  --knopf2-bg: #ebebeb;
  --knopf2-hover: #dedede;
  --knopf2-fg: #161616;

  --ok: #13795b;
  --ok-bg: #e3f4ec;
  --warn: #8a5a00;
  --warn-bg: #fff3d6;
  --fehler: #c4231c;
  --fehler-bg: #fde8e7;
  --info-bg: #ecf2fd;

  --feld-bg: #ffffff;
  --feld-linie: #8c8c8c;

  --leiste-bg: rgb(255 255 255 / 0.9);
  --abdunkeln: rgb(0 0 0 / 0.4);
  --schatten: 0 1px 2px rgb(22 22 22 / 0.04), 0 8px 24px rgb(22 22 22 / 0.06);
  --schatten-hoch: 0 16px 48px rgb(22 22 22 / 0.18);

  --r-pill: 9999px;
  --r-klein: 12px;
  --r-mittel: 16px;
  --r-karte: 24px;

  --schrift: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --rand: 16px;
  --seitenleiste: 248px;
  --kopf: 56px;
  --tabs: 64px;
  --unten: env(safe-area-inset-bottom, 0px);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000;
    --karte: #141414;
    --flaeche: #1c1c1c;
    --flaeche-2: #262626;
    --tint: #0e1a33;

    --ink: #f5f5f5;
    --ink-2: #a8a8a8;
    --linie: rgb(255 255 255 / 0.1);
    --linie-stark: rgb(255 255 255 / 0.22);

    --akzent: #80abff;
    --akzent-ink: #000000;
    --fokus: #80abff;

    --knopf-bg: #ffffff;
    --knopf-fg: #000000;
    --knopf2-bg: #262626;
    --knopf2-hover: #333333;
    --knopf2-fg: #f5f5f5;

    --ok: #5fd3a5;
    --ok-bg: #0d2a1f;
    --warn: #f2c14e;
    --warn-bg: #2e2208;
    --fehler: #ff8a84;
    --fehler-bg: #3a1311;
    --info-bg: #0e1a33;

    --feld-bg: #0b0b0b;
    --feld-linie: #8c8c8c;

    --leiste-bg: rgb(10 10 10 / 0.86);
    --abdunkeln: rgb(0 0 0 / 0.65);
    --schatten: none;
    --schatten-hoch: 0 16px 48px rgb(0 0 0 / 0.6);
  }
}

/* ---------- Grundlagen ---------- */

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: calc(var(--kopf) + 16px);
}

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.5 var(--schrift);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

h1, h2, h3, p, ul, ol, dl, dd, figure { margin: 0; }
ul[role="list"], ol[role="list"] { list-style: none; padding: 0; }
img, svg { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--akzent); text-underline-offset: 0.18em; }
::selection { background: var(--akzent); color: var(--akzent-ink); }

:focus-visible {
  outline: 3px solid var(--fokus);
  outline-offset: 2px;
  border-radius: 6px;
}
[tabindex="-1"]:focus { outline: none; }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.icon { width: 20px; height: 20px; flex: none; }

.skip-link {
  position: fixed;
  top: 8px; left: 8px;
  z-index: 100;
  padding: 10px 16px;
  border-radius: var(--r-pill);
  background: var(--knopf-bg);
  color: var(--knopf-fg);
  font-weight: 600;
  text-decoration: none;
  transform: translateY(-200%);
}
.skip-link:focus { transform: none; }

/* ---------- Logo ---------- */

.marke-zeichen {
  display: inline-block;
  width: 28px; height: 28px;
  flex: none;
  background: currentColor;
  -webkit-mask: url("logo-mark.png") center / contain no-repeat;
  mask: url("logo-mark.png") center / contain no-repeat;
}
.marke-zeichen--start { width: 56px; height: 56px; }

.marke {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  text-decoration: none;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.marke-text { line-height: 1.2; }
.marke-crm {
  display: inline-block;
  margin-left: 4px;
  padding: 2px 8px;
  border-radius: var(--r-pill);
  background: var(--ink);
  color: var(--bg);
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  vertical-align: 2px;
}

/* ---------- Startbildschirm ---------- */

.start {
  min-height: 100dvh;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 16px;
  padding: var(--rand);
  text-align: center;
}
.start-text { color: var(--ink-2); }
.start-fehler { display: grid; gap: 16px; justify-items: start; max-width: 28rem; }

/* ---------- Knöpfe ---------- */

.knopf {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 20px;
  border: 0;
  border-radius: var(--r-pill);
  background: var(--knopf2-bg);
  color: var(--knopf2-fg);
  font-weight: 600;
  font-size: 0.9375rem;
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 0.15s, opacity 0.15s, transform 0.1s;
  -webkit-tap-highlight-color: transparent;
}
.knopf:hover { background: var(--knopf2-hover); }
.knopf:active { transform: scale(0.98); }
.knopf .icon { width: 18px; height: 18px; }

.knopf--primaer { background: var(--knopf-bg); color: var(--knopf-fg); }
.knopf--primaer:hover { background: var(--knopf-bg); opacity: 0.86; }
.knopf--zweit { background: var(--knopf2-bg); }
.knopf--still { background: transparent; }
.knopf--still:hover { background: var(--flaeche-2); }
.knopf--gefahr { background: var(--fehler-bg); color: var(--fehler); }
.knopf--gefahr:hover { background: var(--fehler-bg); opacity: 0.85; }
.knopf--klein { min-height: 36px; padding: 6px 14px; font-size: 0.875rem; }
.knopf--links { justify-content: flex-start; }
.knopf--rund { width: 44px; padding: 0; }
.knopf--klein.knopf--rund { width: 36px; }
.knopf--breit { width: 100%; }

.knopf[disabled], .knopf[aria-disabled="true"] { opacity: 0.45; cursor: not-allowed; transform: none; }

.knopf[aria-busy="true"] { position: relative; color: transparent !important; pointer-events: none; }
.knopf[aria-busy="true"]::after {
  content: "";
  position: absolute;
  width: 18px; height: 18px;
  border: 2px solid currentColor;
  border-color: var(--knopf2-fg) transparent var(--knopf2-fg) transparent;
  border-radius: 50%;
  animation: drehen 0.8s linear infinite;
}
.knopf--primaer[aria-busy="true"]::after { border-color: var(--knopf-fg) transparent var(--knopf-fg) transparent; }
@keyframes drehen { to { transform: rotate(360deg); } }

.knopf-gruppe { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.karte > p + .knopf-gruppe, .karte > p + p { margin-top: 12px; }
.fussnote { margin-top: 16px; }

/* Textlink im Stil eines Knopfs, z. B. „Alle anzeigen" */
.link-pfeil {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-weight: 600;
  font-size: 0.9375rem;
  text-decoration: none;
}
.link-pfeil .icon { width: 16px; height: 16px; }
.link-pfeil:hover { text-decoration: underline; }

/* ---------- Layout ---------- */

.app { min-height: 100dvh; }

.kopfleiste {
  position: sticky;
  top: 0;
  z-index: 20;
  height: calc(var(--kopf) + env(safe-area-inset-top, 0px));
  padding: env(safe-area-inset-top, 0px) var(--rand) 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--leiste-bg);
  -webkit-backdrop-filter: saturate(1.8) blur(20px);
  backdrop-filter: saturate(1.8) blur(20px);
  border-bottom: 1px solid var(--linie);
}
.kopfleiste-profil {
  display: grid;
  place-items: center;
  width: 44px; height: 44px;
  margin-right: -10px;
  border-radius: 50%;
  color: var(--ink);
}
.kopfleiste-profil[aria-current="page"] { background: var(--flaeche-2); }

.seitenleiste { display: none; }

.inhalt {
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 20px var(--rand) calc(var(--tabs) + var(--unten) + 32px);
}
.inhalt:focus { outline: none; }

.tableiste {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 20;
  padding-bottom: var(--unten);
  background: var(--leiste-bg);
  -webkit-backdrop-filter: saturate(1.8) blur(20px);
  backdrop-filter: saturate(1.8) blur(20px);
  border-top: 1px solid var(--linie);
}
.tabs {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  height: var(--tabs);
  margin: 0;
}
.tabs-eintrag {
  position: relative;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--ink-2);
  font-size: 0.6875rem;
  font-weight: 600;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}
.tabs-eintrag .icon { width: 24px; height: 24px; }
.tabs-eintrag[aria-current="page"] { color: var(--ink); }
.tabs-eintrag[aria-current="page"] .icon { stroke-width: 2.2; }
.tabs-eintrag .zaehler { position: absolute; top: 6px; left: calc(50% + 6px); }

.zaehler {
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  display: inline-grid;
  place-items: center;
  border-radius: var(--r-pill);
  background: var(--akzent);
  color: var(--akzent-ink);
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1;
}

@media (min-width: 56.25em) {
  .kopfleiste, .tableiste { display: none; }

  .seitenleiste {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 20;
    width: var(--seitenleiste);
    display: flex;
    flex-direction: column;
    gap: 24px;
    padding: 24px 16px 16px;
    background: var(--karte);
    border-right: 1px solid var(--linie);
    overflow-y: auto;
  }
  .seitenleiste > .marke { padding: 0 8px; }
  .seitenleiste-nav { flex: 1; }
  .nav { display: grid; gap: 2px; margin: 0; }
  .nav-eintrag {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 44px;
    padding: 10px 12px;
    border-radius: var(--r-klein);
    color: var(--ink-2);
    font-weight: 600;
    text-decoration: none;
  }
  .nav-eintrag:hover { background: var(--flaeche); color: var(--ink); }
  .nav-eintrag[aria-current="page"] { background: var(--flaeche-2); color: var(--ink); }
  .nav-text { flex: 1; }

  .seitenleiste-fuss { display: grid; gap: 8px; padding-top: 16px; border-top: 1px solid var(--linie); }
  .benutzer { display: flex; align-items: center; gap: 10px; padding: 4px 8px; min-width: 0; }
  .benutzer-mail { font-size: 0.8125rem; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

  .inhalt {
    padding: 40px 40px 64px calc(var(--seitenleiste) + 40px);
    max-width: calc(1180px + var(--seitenleiste));
  }
}

/* ---------- Seitenkopf ---------- */

.seitenkopf { display: grid; gap: 12px; margin-bottom: 24px; }
.zurueck {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  width: fit-content;
  margin-left: -6px;
  padding: 4px 6px;
  color: var(--ink-2);
  font-weight: 600;
  font-size: 0.9375rem;
  text-decoration: none;
  border-radius: var(--r-klein);
}
.zurueck:hover { color: var(--ink); }
.zurueck .icon { width: 18px; height: 18px; }
.seitenkopf-zeile { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; }
.seitenkopf-text { min-width: 0; flex: 1 1 16rem; }
.seitentitel {
  font-size: clamp(1.75rem, 1.4rem + 1.4vw, 2.5rem);
  line-height: 1.1;
  font-weight: 700;
  letter-spacing: -0.025em;
  overflow-wrap: anywhere;
}
.seitenkopf-unter { margin-top: 6px; color: var(--ink-2); }
.seitenkopf-aktionen { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---------- Karten und Abschnitte ---------- */

.karte {
  background: var(--karte);
  border-radius: var(--r-karte);
  box-shadow: var(--schatten);
  padding: 20px;
  min-width: 0;
}
.karte + .karte, .karte + .abschnitt, .abschnitt + .abschnitt, .abschnitt + .karte { margin-top: 16px; }
.karte--flach { padding: 0; overflow: hidden; }
.karte-kopf {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.karte--flach > .karte-kopf { padding: 20px 20px 0; }
.karte-titel { font-size: 1.125rem; font-weight: 700; letter-spacing: -0.01em; }
.karte-unter { color: var(--ink-2); font-size: 0.875rem; }
.abschnitt-titel { font-size: 1.25rem; font-weight: 700; letter-spacing: -0.015em; margin-bottom: 12px; }

.raster { display: grid; gap: 16px; }
.karte + .raster, .raster + .karte, .raster + .raster { margin-top: 16px; }
.raster > .karte + .karte { margin-top: 0; }
@media (min-width: 56.25em) {
  .raster--2 { grid-template-columns: 1fr 1fr; align-items: start; }
  .raster--seite { grid-template-columns: minmax(0, 1fr) 340px; align-items: start; }
}
@media (min-width: 75em) {
  .raster--seite { grid-template-columns: minmax(0, 1fr) 380px; }
}
.spalte { display: grid; gap: 16px; min-width: 0; }
.spalte > .karte + .karte { margin-top: 0; }

/* ---------- Kennzahlen ---------- */

.kennzahlen > .karte, .vorlagen-raster > .karte { margin-top: 0; }
.kennzahlen { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
@media (min-width: 56.25em) { .kennzahlen { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; } }
.kennzahl {
  display: grid;
  gap: 4px;
  align-content: start;
  min-height: 116px;
  color: var(--ink);
  text-decoration: none;
  transition: transform 0.15s;
}
a.kennzahl:hover { transform: translateY(-2px); }
.kennzahl-name { display: flex; align-items: center; gap: 8px; color: var(--ink-2); font-size: 0.875rem; font-weight: 600; }
.kennzahl-name .icon { width: 18px; height: 18px; }
.kennzahl-wert { font-size: 2.25rem; line-height: 1.1; font-weight: 700; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.kennzahl-zusatz { color: var(--ink-2); font-size: 0.8125rem; }
.kennzahl--achtung .kennzahl-wert { color: var(--fehler); }

/* ---------- Listen ---------- */

.liste { margin: 0; padding: 0; list-style: none; }
.liste > li + li { border-top: 1px solid var(--linie); }
.karte--flach .liste > li + li { border-top: 0; }
.karte--flach .liste > li + li > .zeile { border-top: 1px solid var(--linie); }

.zeile {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  color: var(--ink);
  text-decoration: none;
  min-width: 0;
}
a.zeile:hover, button.zeile:hover { background: var(--flaeche); }
.karte:not(.karte--flach) .zeile { padding: 12px 0; }
.karte:not(.karte--flach) a.zeile:hover { background: none; }
.karte:not(.karte--flach) a.zeile:hover .zeile-titel { text-decoration: underline; }
.zeile-inhalt { flex: 1; min-width: 0; display: grid; gap: 2px; }
.zeile-titel {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.zeile-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 10px;
  color: var(--ink-2);
  font-size: 0.875rem;
  min-width: 0;
}
.zeile-meta > span { display: inline-flex; align-items: center; gap: 4px; min-width: 0; }
.zeile-meta .icon { width: 15px; height: 15px; }
.zeile-text { color: var(--ink-2); font-size: 0.875rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.zeile-rechts { flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; text-align: right; font-size: 0.8125rem; color: var(--ink-2); }
.zeile-rechts > span { display: inline-flex; align-items: center; gap: 4px; }
.zeile-rechts .icon { width: 15px; height: 15px; }
.zeile .weiter { color: var(--ink-2); width: 18px; height: 18px; }

.trennzeile {
  padding: 16px 20px 6px;
  color: var(--ink-2);
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.mehr-laden { display: flex; justify-content: center; padding: 16px; }

/* Leads-Liste: auf breiten Bildschirmen wie eine Tabelle */
@media (min-width: 56.25em) {
  .lead-zeile { display: grid; grid-template-columns: 40px minmax(0, 2.2fr) minmax(0, 1fr) minmax(0, 1.2fr) 18px; gap: 16px; }
  .lead-zeile .zeile-rechts { align-items: flex-start; text-align: left; }
}
.lead-spalte-status { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.lead-zeile .lead-spalte-status { display: none; }
@media (min-width: 56.25em) { .lead-zeile .lead-spalte-status { display: flex; } .lead-zeile .zeile-meta .chip { display: none; } }

/* ---------- Avatar, Chips, Punkte ---------- */

.avatar {
  flex: none;
  width: 40px; height: 40px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--flaeche-2);
  color: var(--ink);
  font-size: 0.875rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.avatar--klein { width: 32px; height: 32px; font-size: 0.75rem; }
.avatar--gross { width: 64px; height: 64px; font-size: 1.25rem; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 26px;
  padding: 0 10px;
  border-radius: var(--r-pill);
  background: var(--flaeche-2);
  color: var(--ink);
  font-size: 0.8125rem;
  font-weight: 600;
  white-space: nowrap;
}
.chip-icon { width: 14px; height: 14px; stroke-width: 2.4; }
.chip--neu { background: var(--info-bg); color: var(--akzent); }
.chip--gewonnen { background: var(--ok-bg); color: var(--ok); }
.chip--verloren { color: var(--ink-2); }
.chip--quelle { background: transparent; box-shadow: inset 0 0 0 1px var(--linie-stark); color: var(--ink-2); }
.chip--termin-bestaetigt { background: var(--info-bg); color: var(--akzent); }
.chip--termin-abgesagt { background: var(--fehler-bg); color: var(--fehler); }
.chip--termin-erledigt { background: var(--ok-bg); color: var(--ok); }
.chip--termin-nicht_erschienen { background: var(--warn-bg); color: var(--warn); }
.chip--warn { background: var(--warn-bg); color: var(--warn); }
.chip--fehler { background: var(--fehler-bg); color: var(--fehler); }
.chip--ok { background: var(--ok-bg); color: var(--ok); }
a.chip { text-decoration: none; }
a.chip:hover { text-decoration: underline; }

/* Fortschritt im Verkaufsprozess: vier Striche */
.stufen { display: inline-flex; gap: 2px; }
.stufen i { width: 4px; height: 10px; border-radius: 2px; background: currentColor; opacity: 0.22; }
.stufen[data-stufe="1"] i:nth-child(-n+1),
.stufen[data-stufe="2"] i:nth-child(-n+2),
.stufen[data-stufe="3"] i:nth-child(-n+3),
.stufen[data-stufe="4"] i:nth-child(-n+4) { opacity: 1; }

.punkt { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--ink-2); flex: none; }
.punkt--ok { background: var(--ok); }
.punkt--fehler { background: var(--fehler); }
.punkt--aus { background: var(--linie-stark); }
.punkt--neu { background: var(--akzent); }

.faellig { font-weight: 600; color: var(--ink-2); }
.faellig--ueber { color: var(--fehler); }

/* ---------- Hinweise, leere Zustände ---------- */

.hinweis {
  display: flex;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--r-mittel);
  background: var(--info-bg);
  color: var(--ink);
  margin-bottom: 16px;
}
.hinweis-icon { margin-top: 2px; color: var(--akzent); }
.hinweis--fehler { background: var(--fehler-bg); }
.hinweis--fehler .hinweis-icon { color: var(--fehler); }
.hinweis--warnung { background: var(--warn-bg); }
.hinweis--warnung .hinweis-icon { color: var(--warn); }
.hinweis--ok { background: var(--ok-bg); }
.hinweis--ok .hinweis-icon { color: var(--ok); }
.hinweis-text { display: grid; gap: 6px; justify-items: start; min-width: 0; }
.hinweis-titel { font-weight: 700; }
.hinweis-text code { font-family: var(--mono); font-size: 0.875em; overflow-wrap: anywhere; }
.hinweis:focus { outline: none; }

.leer {
  display: grid;
  justify-items: center;
  gap: 8px;
  padding: 40px 16px;
  text-align: center;
}
.leer-symbol {
  display: grid;
  place-items: center;
  width: 56px; height: 56px;
  margin-bottom: 4px;
  border-radius: 50%;
  background: var(--flaeche);
  color: var(--ink-2);
}
.leer-symbol .icon { width: 26px; height: 26px; }
.leer-titel { font-weight: 700; font-size: 1.0625rem; }
.leer-text { color: var(--ink-2); max-width: 30rem; }
.leer .knopf { margin-top: 8px; }

/* ---------- Ladezustand ---------- */

.skelett {
  display: block;
  border-radius: 8px;
  background: linear-gradient(90deg, var(--flaeche) 25%, var(--flaeche-2) 50%, var(--flaeche) 75%);
  background-size: 200% 100%;
  animation: schimmern 1.4s ease-in-out infinite;
}
@keyframes schimmern { to { background-position: -200% 0; } }
.skelett-zeile { display: flex; align-items: center; gap: 12px; padding: 12px 0; }
.skelett--rund { width: 40px; height: 40px; border-radius: 50%; flex: none; }
.skelett-block { flex: 1; display: grid; gap: 8px; }
.skelett--text { height: 12px; width: 70%; }
.skelett--kurz { width: 40%; }
.skelett--zahl { height: 32px; width: 50%; margin-top: 12px; }
.skelett-kachel { min-height: 116px; }

/* ---------- Formulare ---------- */

.formular { display: grid; gap: 16px; }
.formular-raster { display: grid; gap: 16px; }
@media (min-width: 40em) {
  .formular-raster { grid-template-columns: 1fr 1fr; }
  .formular-raster .feld--breit { grid-column: 1 / -1; }
}
.formular-fuss { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: flex-end; }
.formular-fuss--links { justify-content: flex-start; }
.formular-fuss .abstand { flex: 1; }

.feld { display: grid; gap: 6px; min-width: 0; }
.feld > label, .feld-label { font-weight: 600; font-size: 0.875rem; }
.pflicht { color: var(--fehler); }
.feld-hinweis { color: var(--ink-2); font-size: 0.8125rem; }

.eingabe {
  width: 100%;
  min-height: 48px;
  padding: 11px 14px;
  border: 1px solid var(--feld-linie);
  border-radius: var(--r-klein);
  background: var(--feld-bg);
  color: var(--ink);
  font-size: 1rem; /* verhindert Zoom auf dem iPhone */
  line-height: 1.4;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.eingabe:hover { border-color: var(--ink-2); }
.eingabe:focus { outline: none; border-color: var(--fokus); box-shadow: 0 0 0 3px color-mix(in srgb, var(--fokus) 28%, transparent); }
.eingabe[aria-invalid="true"] { border-color: var(--fehler); }
textarea.eingabe { min-height: 96px; resize: vertical; }
select.eingabe {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 40px;
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: calc(100% - 20px) 52%, calc(100% - 15px) 52%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}
.eingabe--code { font-family: var(--mono); font-size: 0.875rem; line-height: 1.55; tab-size: 2; }
.eingabe--gross { min-height: 280px; }
input[type="date"].eingabe { min-width: 0; }

.suche { position: relative; flex: 1 1 16rem; min-width: 0; }
.suche .icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--ink-2); pointer-events: none; }
.suche .eingabe { padding-left: 44px; border-radius: var(--r-pill); border-color: transparent; background: var(--karte); box-shadow: var(--schatten); }
.suche .eingabe:hover { border-color: var(--linie-stark); }
.suche .eingabe:focus { border-color: var(--fokus); }

.filter { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 16px; }
.filter select.eingabe { width: auto; min-height: 44px; border-radius: var(--r-pill); border-color: transparent; background-color: var(--karte); box-shadow: var(--schatten); font-size: 0.9375rem; font-weight: 600; padding-top: 8px; padding-bottom: 8px; }
.filter-anzahl { color: var(--ink-2); font-size: 0.875rem; margin-left: auto; }

/* Umschalter wie in Apps */
.segment {
  display: inline-flex;
  gap: 2px;
  padding: 4px;
  border-radius: var(--r-pill);
  background: var(--flaeche-2);
  max-width: 100%;
  overflow-x: auto;
  scrollbar-width: none;
}
.segment::-webkit-scrollbar { display: none; }
.segment-teil, .segment button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 6px 16px;
  border: 0;
  border-radius: var(--r-pill);
  background: transparent;
  color: var(--ink-2);
  font-weight: 600;
  font-size: 0.9375rem;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}
.segment-teil:hover, .segment button:hover { color: var(--ink); }
.segment-teil[aria-current="page"], .segment button[aria-pressed="true"] { background: var(--karte); color: var(--ink); box-shadow: 0 1px 3px rgb(0 0 0 / 0.12); }
.segment-zahl { font-size: 0.75rem; padding: 1px 7px; border-radius: var(--r-pill); background: var(--akzent); color: var(--akzent-ink); }

/* ---------- Rückfrage (dialog) ---------- */

.dialog {
  width: min(440px, calc(100vw - 32px));
  padding: 0;
  border: 0;
  border-radius: var(--r-karte);
  background: var(--karte);
  color: var(--ink);
  box-shadow: var(--schatten-hoch);
}
.dialog::backdrop { background: var(--abdunkeln); }
.dialog-inhalt { display: grid; gap: 12px; padding: 24px; }
.dialog-titel { font-size: 1.25rem; font-weight: 700; letter-spacing: -0.01em; }
.dialog-text { color: var(--ink-2); }
.dialog-knoepfe { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin-top: 8px; }

/* ---------- Meldungen (Toasts) ---------- */

.toasts {
  position: fixed;
  left: 50%;
  bottom: calc(var(--tabs) + var(--unten) + 12px);
  z-index: 60;
  width: min(420px, calc(100vw - 32px));
  transform: translateX(-50%);
  display: grid;
  gap: 8px;
  pointer-events: none;
}
.toasts--fehler { bottom: auto; top: calc(var(--kopf) + env(safe-area-inset-top, 0px) + 12px); }
@media (min-width: 56.25em) {
  .toasts { left: auto; right: 24px; bottom: 24px; transform: none; }
  .toasts--fehler { top: 24px; bottom: auto; }
}
.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--r-mittel);
  background: var(--knopf-bg);
  color: var(--knopf-fg);
  box-shadow: var(--schatten-hoch);
  font-weight: 600;
  font-size: 0.9375rem;
  pointer-events: auto;
  cursor: pointer;
  animation: toast-rein 0.25s ease-out;
  transition: opacity 0.25s, transform 0.25s;
}
.toast--fehler { background: var(--fehler); color: #fff; }
.toast--weg { opacity: 0; transform: translateY(8px); }
@keyframes toast-rein { from { opacity: 0; transform: translateY(8px); } }

/* ---------- Anmeldung ---------- */

.anmeldung-bereich {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px var(--rand);
}
.anmeldung { width: min(420px, 100%); display: grid; gap: 24px; }
.anmeldung .marke { justify-content: center; font-size: 1.0625rem; }
.anmeldung-karte { display: grid; gap: 16px; padding: 28px 24px; }
.anmeldung-titel { font-size: 1.75rem; line-height: 1.15; font-weight: 700; letter-spacing: -0.025em; }
.anmeldung-text { color: var(--ink-2); }
.anmeldung-fuss { text-align: center; color: var(--ink-2); font-size: 0.8125rem; }
.anmeldung .hinweis { margin-bottom: 0; }
.anmeldung-symbol { display: grid; place-items: center; width: 56px; height: 56px; border-radius: 50%; background: var(--tint); color: var(--akzent); }
.anmeldung-symbol .icon { width: 26px; height: 26px; }

/* ---------- Übersicht ---------- */

.termin-mini { display: flex; align-items: center; gap: 12px; }
.datum-block {
  flex: none;
  min-width: 60px;
  padding: 6px 8px;
  border-radius: var(--r-klein);
  background: var(--flaeche);
  text-align: center;
  line-height: 1.15;
}
.datum-block-tag { display: block; font-size: 0.6875rem; font-weight: 700; color: var(--ink-2); text-transform: uppercase; letter-spacing: 0.04em; }
.datum-block-zeit { display: block; font-weight: 700; font-variant-numeric: tabular-nums; }
.datum-block--heute { background: var(--tint); }
.datum-block--heute .datum-block-tag { color: var(--akzent); }

.anbindungen { display: flex; flex-wrap: wrap; gap: 8px 20px; }
.anbindung { display: inline-flex; align-items: center; gap: 8px; color: var(--ink); text-decoration: none; font-size: 0.9375rem; font-weight: 600; }
.anbindung small { color: var(--ink-2); font-weight: 400; font-size: 0.8125rem; }

/* ---------- Verlauf ---------- */

.verlauf { list-style: none; margin: 0; padding: 0; display: grid; }
.verlauf-eintrag { position: relative; display: flex; gap: 12px; padding-bottom: 18px; }
.verlauf-eintrag:last-child { padding-bottom: 0; }
.verlauf-eintrag::before {
  content: "";
  position: absolute;
  left: 17px; top: 40px; bottom: 4px;
  width: 2px;
  border-radius: 1px;
  background: var(--linie);
}
.verlauf-eintrag:last-child::before { display: none; }
.verlauf-symbol {
  flex: none;
  display: grid;
  place-items: center;
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--flaeche);
  color: var(--ink-2);
}
.verlauf-symbol .icon { width: 18px; height: 18px; }
.verlauf-eintrag--mail_ein .verlauf-symbol, .verlauf-eintrag--mail_aus .verlauf-symbol { background: var(--tint); color: var(--akzent); }
.verlauf-eintrag--termin .verlauf-symbol { background: var(--ok-bg); color: var(--ok); }
.verlauf-eintrag--anruf .verlauf-symbol { background: var(--warn-bg); color: var(--warn); }
.verlauf-inhalt { flex: 1; min-width: 0; padding-top: 6px; display: grid; gap: 2px; }
.verlauf-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.verlauf-eintrag--notiz .verlauf-text, .verlauf-eintrag--anruf .verlauf-text {
  padding: 10px 14px;
  margin-top: 4px;
  border-radius: var(--r-mittel);
  background: var(--flaeche);
}
.verlauf-meta { color: var(--ink-2); font-size: 0.8125rem; }
.verlauf-meta a { color: inherit; }

.notiz-eingabe { display: grid; gap: 10px; margin-bottom: 20px; }
.notiz-eingabe textarea.eingabe { min-height: 80px; }
.notiz-eingabe .formular-fuss { justify-content: space-between; }

/* ---------- Lead ---------- */

.lead-kopf { display: flex; align-items: center; gap: 16px; }
.status-leiste { display: flex; flex-wrap: wrap; gap: 6px; }
.status-leiste button {
  min-height: 36px;
  padding: 6px 14px;
  border: 0;
  border-radius: var(--r-pill);
  background: var(--flaeche);
  color: var(--ink-2);
  font-weight: 600;
  font-size: 0.875rem;
  cursor: pointer;
}
.status-leiste button:hover { background: var(--flaeche-2); color: var(--ink); }
.status-leiste button[aria-pressed="true"] { background: var(--knopf-bg); color: var(--knopf-fg); }
.status-leiste button[data-wert="verloren"][aria-pressed="true"] { background: var(--ink-2); }
.status-leiste button[data-wert="gewonnen"][aria-pressed="true"] { background: var(--ok); color: #fff; }

.angaben { display: grid; gap: 14px; margin: 0; }
.angabe { display: grid; grid-template-columns: 24px minmax(0, 1fr); gap: 2px 12px; align-items: start; }
.angabe .icon { color: var(--ink-2); margin-top: 1px; }
.angabe dt { color: var(--ink-2); font-size: 0.8125rem; grid-column: 2; }
.angabe dd { grid-column: 2; overflow-wrap: anywhere; }
.angabe dt + dd { margin-top: -2px; }
.angabe > .icon { grid-row: 1 / span 2; }

.schritt { display: grid; gap: 4px; }
.schritt-text { font-size: 1.0625rem; font-weight: 600; }
.schritt-leer { color: var(--ink-2); }

.notiz-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.notiz-text--leer { color: var(--ink-2); }

/* ---------- Postfach ---------- */

.postfach-kopf { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.abgleich-stand { color: var(--ink-2); font-size: 0.8125rem; }

.mail-zeile { align-items: flex-start; }
.mail-zeile .avatar { margin-top: 2px; }
.mail-zeile .zeile-titel { font-weight: 500; }
.mail-zeile--ungelesen .zeile-titel, .mail-zeile--ungelesen .mail-betreff { font-weight: 700; }
.mail-betreff { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mail-zeile .zeile-rechts { flex-direction: row; align-items: center; gap: 6px; }
.mail-zeile .punkt { margin-top: 0; }

.mail-kopf { display: grid; gap: 12px; }
.mail-absender { display: flex; gap: 12px; align-items: flex-start; }
.mail-adressen { display: grid; gap: 2px; min-width: 0; font-size: 0.9375rem; }
.mail-adressen .rolle { color: var(--ink-2); }
.mail-adressen span { overflow-wrap: anywhere; }
.mail-datum { color: var(--ink-2); font-size: 0.875rem; }
.anhaenge { display: flex; flex-wrap: wrap; gap: 8px; }
.anhang { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: var(--r-pill); background: var(--flaeche); font-size: 0.875rem; }
.anhang .icon { width: 16px; height: 16px; color: var(--ink-2); }

.mail-koerper { margin-top: 16px; border-radius: var(--r-mittel); overflow: hidden; background: #fff; box-shadow: inset 0 0 0 1px var(--linie); }
.mail-rahmen { display: block; width: 100%; height: 360px; border: 0; background: #fff; color-scheme: light; }
.mail-text { margin: 0; padding: 20px; white-space: pre-wrap; overflow-wrap: anywhere; font: 0.9375rem/1.6 var(--schrift); color: #161616; background: #fff; }
.bilder-hinweis > span { display: inline-flex; align-items: center; gap: 8px; }
.bilder-hinweis .icon { width: 18px; height: 18px; }
.bilder-hinweis { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; justify-content: space-between; padding: 10px 14px; margin-top: 16px; border-radius: var(--r-mittel); background: var(--flaeche); font-size: 0.875rem; color: var(--ink-2); }

/* ---------- Schreiben und Vorlagen ---------- */

.schreiben { display: grid; gap: 16px; }
.empfaenger-zeile { display: flex; gap: 8px; align-items: flex-end; }
.empfaenger-zeile .feld { flex: 1; }
.editor-kopf { display: flex; flex-wrap: wrap; gap: 8px; justify-content: space-between; align-items: center; }
.platzhalter-leiste { display: flex; flex-wrap: wrap; gap: 6px; }
.platzhalter-leiste button {
  min-height: 32px;
  padding: 4px 10px;
  border: 1px dashed var(--linie-stark);
  border-radius: var(--r-pill);
  background: transparent;
  color: var(--ink);
  font-family: var(--mono);
  font-size: 0.8125rem;
  cursor: pointer;
}
.platzhalter-leiste button:hover { background: var(--flaeche); border-style: solid; }
.vorschau-innen { padding: 0 20px 20px; }
.code-bereich summary { cursor: pointer; width: fit-content; padding: 6px 0; color: var(--akzent); font-weight: 600; font-size: 0.9375rem; }
.code-bereich[open] summary { margin-bottom: 8px; }
.vorschau-betreff { padding: 12px 16px; border-bottom: 1px solid #e6e6e6; background: #fafafa; color: #161616; font-size: 0.9375rem; }
.vorschau-betreff b { font-weight: 700; }
.lead-bezug { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: var(--r-mittel); background: var(--flaeche); font-size: 0.9375rem; }
.lead-bezug .icon { color: var(--ink-2); }
.lead-bezug .abstand { flex: 1; }

.vorlagen-raster { display: grid; gap: 12px; }
@media (min-width: 40em) { .vorlagen-raster { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 75em) { .vorlagen-raster { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.vorlage-karte { display: grid; gap: 8px; align-content: start; }
.vorlage-karte + .vorlage-karte { margin-top: 0; }
.vorlage-karte .karte-titel a { color: var(--ink); text-decoration: none; }
.vorlage-karte .karte-titel a:hover { text-decoration: underline; }
.vorlage-karte .zeile-text { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.vorlage-karte .knopf-gruppe { margin-top: 8px; }

@media (min-width: 75em) {
  .editor-raster { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
  .editor-raster > .karte + .karte { margin-top: 0; }
  .editor-raster .vorschau-karte { position: sticky; top: 24px; }
}

/* ---------- Termine ---------- */

.termin-karte { display: grid; gap: 12px; }
.termin-karte + .termin-karte { margin-top: 12px; }
.termin-oben { display: flex; gap: 14px; align-items: flex-start; }
.termin-zeit { flex: none; min-width: 64px; font-weight: 700; font-size: 1.125rem; font-variant-numeric: tabular-nums; line-height: 1.2; }
.termin-zeit small { display: block; color: var(--ink-2); font-weight: 500; font-size: 0.8125rem; }
.termin-haupt { flex: 1; min-width: 0; display: grid; gap: 4px; }
.termin-name { font-weight: 700; font-size: 1.0625rem; color: var(--ink); text-decoration: none; }
.termin-name:hover { text-decoration: underline; }
.termin-nachricht { padding: 10px 14px; border-radius: var(--r-mittel); background: var(--flaeche); white-space: pre-wrap; overflow-wrap: anywhere; font-size: 0.9375rem; }
.termin-tag { margin: 24px 0 10px; font-size: 1rem; font-weight: 700; color: var(--ink-2); }
.termin-tag:first-of-type { margin-top: 0; }
.termin-karte--vorbei { opacity: 0.85; }
.termin-karte details summary { cursor: pointer; color: var(--akzent); font-weight: 600; font-size: 0.9375rem; width: fit-content; }
.termin-karte details[open] summary { margin-bottom: 8px; }

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

.anbindung-karte { display: grid; gap: 10px; }
.anbindung-kopf { display: flex; align-items: center; gap: 12px; }
.anbindung-kopf .verlauf-symbol { width: 44px; height: 44px; }
.anbindung-kopf .verlauf-symbol .icon { width: 22px; height: 22px; }
.anbindung-titel { font-weight: 700; font-size: 1.0625rem; }
.anbindung-status { display: inline-flex; align-items: center; gap: 6px; font-size: 0.875rem; color: var(--ink-2); }
.code-liste { margin: 0; padding: 0; list-style: none; display: grid; gap: 6px; }
.code-liste code { font-family: var(--mono); font-size: 0.8125rem; padding: 2px 6px; border-radius: 6px; background: var(--flaeche); overflow-wrap: anywhere; }
.schritte { margin: 0; padding-left: 1.25rem; display: grid; gap: 6px; color: var(--ink-2); }
.schritte strong { color: var(--ink); }
.kalender-liste { display: flex; flex-wrap: wrap; gap: 6px; }

/* ---------- Bewegung reduzieren ---------- */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}

/* ---------- Druck ---------- */

@media print {
  .seitenleiste, .kopfleiste, .tableiste, .toasts, .seitenkopf-aktionen { display: none !important; }
  .inhalt { padding: 0 !important; }
  .karte { box-shadow: none; border: 1px solid #ddd; }
}
