/* ==========================================================================
   AppDesigns · Marketing-System
   Werte aus den AppDesigns-Design-Richtlinien (Farben gemessen am Live-Design)
   ========================================================================== */

/* Poppins selbst gehostet (assets/fonts, Lizenz: OFL) – keine externen Server */
@font-face { font-family: "Poppins"; font-weight: 400; font-style: normal; font-display: swap; src: url("../fonts/poppins-400.woff2") format("woff2"); }
@font-face { font-family: "Poppins"; font-weight: 600; font-style: normal; font-display: swap; src: url("../fonts/poppins-600.woff2") format("woff2"); }
@font-face { font-family: "Poppins"; font-weight: 800; font-style: normal; font-display: swap; src: url("../fonts/poppins-800.woff2") format("woff2"); }

:root {
  /* Basis */
  --black: #000000;
  --white: #ffffff;
  --ink:   #0c111e;   /* Überschriften, Text stark */
  --text:  #4d5769;   /* Fließtext */
  --muted: #6b7486;
  --line:  #e2e7ef;
  --soft:  #f3f6fa;
  --brand: #4171b3;   /* einzige Aktionsfarbe */
  --brand-dark: #34609c;
  --danger: #d52f29;

  /* Spektrum aus dem Logo – feste Reihenfolge */
  --s1: #a82475; --s2: #3f76b3; --s3: #4ba5e2; --s4: #449550;
  --s5: #f3d949; --s6: #eb9c39; --s7: #d52f29;

  --radius: 20px;
  --radius-sm: 14px;
  --wrap: 1180px;
  --gutter: 28px;
  --font: "Poppins", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 120px; }
body {
  margin: 0;
  font: 400 17px/1.6 var(--font);
  color: var(--text);
  background: var(--white);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
main { flex: 1; padding-bottom: 72px; }
h1, h2, h3 { color: var(--ink); font-weight: 600; letter-spacing: -0.025em; line-height: 1.12; margin: 0 0 16px; }
h1 { font-size: clamp(36px, 5.4vw, 60px); }
h2 { font-size: clamp(22px, 2.4vw, 26px); letter-spacing: -0.02em; }
p { margin: 0 0 12px; }
a { color: var(--brand); text-underline-offset: 3px; }
a:hover { color: var(--brand-dark); }
strong, b { color: var(--ink); font-weight: 600; }
mark { background: #f3d94966; color: var(--ink); border-radius: 4px; padding: 0 2px; }
:focus-visible { outline: 3px solid var(--brand); outline-offset: 3px; border-radius: 6px; }

.wrap { max-width: calc(var(--wrap) + 2 * var(--gutter)); margin: 0 auto; padding: 0 var(--gutter); }
.muted { color: var(--muted); }
.klein { font-size: 14px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 16px; top: -60px; z-index: 100; background: var(--brand); color: var(--white); padding: 10px 18px; border-radius: 999px; }
.skip:focus { top: 16px; }

/* Icons */
.i { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vertical-align: -4px; }

/* ---------- Spektrum-Leiste (Erkennungszeichen) ---------- */
.rb {
  display: block; height: 6px;
  background: linear-gradient(90deg,
    var(--s1) 0 14.285%, var(--s2) 0 28.57%, var(--s3) 0 42.855%, var(--s4) 0 57.14%,
    var(--s5) 0 71.425%, var(--s6) 0 85.71%, var(--s7) 0 100%);
}

/* ---------- Kopfleiste: schwarz, schwebend, Spektrum unten ---------- */
.topbar { position: sticky; top: 0; z-index: 50; padding: 14px var(--gutter) 0; }
.topbar-in {
  position: relative;
  max-width: var(--wrap); margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  background: var(--black); color: var(--white);
  border-radius: 28px;
  padding: 16px 20px 22px 28px;
  box-shadow: 0 18px 40px rgba(12, 17, 30, 0.18);
}
.topbar-in > .rb { position: absolute; left: 28px; right: 28px; bottom: 0; border-radius: 6px 6px 0 0; }
.brand { display: flex; align-items: center; gap: 14px; text-decoration: none; color: var(--white); min-height: 44px; }
.logo-img { display: block; height: 34px; width: auto; }
.brand-sub { font-size: 13px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: #9aa3b5; padding-left: 14px; border-left: 1px solid #2a2f3a; }
.topnav { display: flex; align-items: center; gap: 10px; }
.topnav form { margin: 0; }
.tb-btn {
  display: inline-flex; align-items: center; gap: 10px;
  min-height: 48px; min-width: 48px; padding: 0 16px;
  border: 1.5px solid #2a2f3a; border-radius: 16px;
  background: transparent; color: var(--white);
  font: 600 15px var(--font); text-decoration: none; cursor: pointer;
}
.tb-btn:hover, .tb-btn.is-aktiv { border-color: var(--white); color: var(--white); }
.tb-icon { padding: 0; justify-content: center; }

/* ---------- Meldungen ---------- */
.toasts { position: fixed; top: 112px; left: 50%; transform: translateX(-50%); z-index: 60; display: grid; gap: 8px; width: min(560px, calc(100% - 32px)); }
.toast {
  display: flex; gap: 12px; align-items: flex-start;
  background: var(--ink); color: var(--white);
  padding: 14px 20px; border-radius: 16px; font-size: 15px;
  box-shadow: 0 12px 30px rgba(12, 17, 30, 0.25);
  transition: opacity .3s, transform .3s;
}
.toast .i { color: var(--s4); margin-top: 2px; }
.toast-fehler .i { color: #ff7a74; }
.toast.weg { opacity: 0; transform: translateY(-8px); }

/* ---------- Seitenkopf ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; flex-wrap: wrap; padding-top: 48px; padding-bottom: 28px; }
.page-head h1 { margin: 0; }
.page-head .lead { margin: 14px 0 0; }
.lead { font-size: 19px; max-width: 62ch; }
.label {
  display: flex; align-items: center; gap: 14px;
  margin: 0 0 14px;
  font-size: 15px; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--brand);
}
.label::before { content: ""; width: 14px; height: 14px; border-radius: 4px; background: var(--dot, var(--s1)); }
.chip {
  display: inline-block; padding: 8px 18px; border-radius: 999px;
  background: var(--soft); color: var(--ink);
  font-size: 14px; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase;
  margin-bottom: 20px;
}

/* ---------- Karten ---------- */
.card { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 28px; }
.card + .card { margin-top: 24px; }
.card h2 { margin-bottom: 18px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 48px; padding: 0 24px;
  border: 1.5px solid transparent; border-radius: 999px;
  font: 600 16px var(--font); text-decoration: none; cursor: pointer; white-space: nowrap;
}
.btn-brand { background: var(--brand); color: var(--white); box-shadow: 0 10px 24px rgba(65, 113, 179, 0.28); }
.btn-brand:hover { background: var(--brand-dark); color: var(--white); }
.btn-outline { background: var(--white); color: var(--ink); border-color: var(--line); }
.btn-outline:hover { border-color: var(--ink); color: var(--ink); }
.btn-block { width: 100%; min-height: 56px; font-size: 18px; font-weight: 800; }
.btn[disabled] { opacity: .6; cursor: progress; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; border: 0; border-radius: 12px; background: transparent; color: var(--muted); cursor: pointer; }
.icon-btn:hover { background: var(--soft); color: var(--danger); }
.aktionen { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 12px; margin-top: 20px; }

/* ---------- Auswahl-Chips ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 10px; }
.opt {
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 44px; padding: 0 18px;
  border: 1.5px solid var(--line); border-radius: 999px;
  background: var(--white); color: var(--ink);
  font: 600 15px var(--font); text-decoration: none; cursor: pointer;
}
.opt .i { color: var(--kat, var(--muted)); width: 18px; height: 18px; }
.opt b { font-weight: 600; font-size: 13px; color: var(--muted); background: var(--soft); border-radius: 999px; padding: 1px 9px; }
.opt:hover { border-color: var(--ink); color: var(--ink); }
.opt[aria-current="page"], .opt-radio:has(input:checked) { background: var(--ink); border-color: var(--ink); color: var(--white); }
.opt[aria-current="page"] .i, .opt-radio:has(input:checked) .i { color: var(--white); }
.opt[aria-current="page"] b { background: #ffffff22; color: var(--white); }
.opt-radio input { position: absolute; opacity: 0; pointer-events: none; }
.opt-radio:has(input:focus-visible) { outline: 3px solid var(--brand); outline-offset: 2px; }

/* ---------- Formulare ---------- */
.feld { margin-bottom: 18px; }
label, legend { display: block; color: var(--ink); font-weight: 600; font-size: 15px; margin-bottom: 8px; padding: 0; }
label .muted, legend .muted { font-weight: 400; }
.pflicht { font-size: 12px; font-weight: 600; color: var(--muted); background: var(--soft); border-radius: 999px; padding: 1px 8px; margin-left: 6px; }
fieldset { border: 0; margin: 0 0 18px; padding: 0; min-width: 0; }
input, select, textarea {
  width: 100%;
  font: 400 16px/1.5 var(--font); color: var(--ink);
  background: var(--white);
  border: 2px solid var(--line); border-radius: var(--radius-sm);
  padding: 12px 16px; min-height: 52px;
}
textarea { resize: vertical; min-height: 96px; }
select { appearance: none; padding-right: 44px; background: var(--white) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%230c111e' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") right 14px center / 20px no-repeat; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px rgba(65, 113, 179, 0.15); }
small { display: block; margin-top: 6px; font-size: 13px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 20px; }
.feld-voll { grid-column: 1 / -1; }

.hinweis { display: flex; gap: 12px; align-items: flex-start; background: var(--soft); color: var(--ink); border-radius: var(--radius-sm); padding: 14px 18px; margin: 0 0 18px; font-size: 15px; }
.hinweis p { margin: 0; }
.hinweis p + p { margin-top: 4px; }
.hinweis .i { color: var(--brand); margin-top: 2px; }
.hinweis-fehler { background: #fdeceb; }
.hinweis-fehler .i { color: var(--danger); }

/* ---------- Login / Einzelkarte ---------- */
.seite-login main { display: flex; align-items: flex-start; }
.seite-login main > .wrap { width: 100%; }
.login-card { max-width: 520px; margin: 56px auto 0; padding: 44px; }
.login-card h1 { font-size: clamp(40px, 6vw, 56px); margin-bottom: 28px; }
.login-card .btn-block { margin-top: 8px; }
.login-card .klein { margin: 22px 0 0; }

/* ---------- Kundenliste ---------- */
.filter { display: flex; gap: 12px; flex-wrap: wrap; margin: 24px 0 8px; }
.suche { position: relative; flex: 1 1 320px; }
.suche > .i { position: absolute; left: 18px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.suche input { padding-left: 50px; padding-right: 48px; border-radius: 999px; }
.suche-leeren { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); display: grid; place-items: center; width: 40px; height: 40px; border-radius: 999px; color: var(--muted); }
.filter select { flex: 0 1 220px; border-radius: 999px; }
.treffer { font-size: 15px; margin: 12px 0 16px; }

.tabelle-rahmen { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.tabelle { width: 100%; border-collapse: collapse; font-size: 15px; }
.tabelle th { text-align: left; font-size: 13px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); background: var(--soft); padding: 14px 16px; }
.tabelle td { padding: 14px 16px; border-top: 1px solid var(--line); vertical-align: top; color: var(--ink); }
.tabelle td .muted { display: block; font-size: 14px; }
.tabelle tbody tr { cursor: pointer; }
.tabelle tbody tr:hover td { background: #f9fbfd; }
.tabelle td.nowrap { white-space: nowrap; }
.tabelle td { overflow-wrap: anywhere; }
.zeile-link { color: var(--ink); font-weight: 600; text-decoration: none; }
.zeile-link:hover { color: var(--brand); text-decoration: underline; }
.geoeffnet { display: block; color: var(--s4); font-size: 14px; }
.geoeffnet .i { width: 16px; height: 16px; margin-right: 4px; vertical-align: -3px; }

.status { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; color: var(--ink); font-weight: 600; font-size: 14px; }
.status i { width: 10px; height: 10px; border-radius: 999px; background: var(--c); }
.tag { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; border-radius: 999px; padding: 3px 10px; background: var(--soft); color: var(--ink); }
.tag .i { width: 14px; height: 14px; vertical-align: -2px; }
.tag-sperre { background: #fdeceb; color: #a5221d; }

.leer { text-align: center; padding: 56px 28px; }
.leer p { max-width: 46ch; margin: 0 auto 20px; }
.seiten { display: flex; align-items: center; justify-content: center; gap: 16px; margin-top: 28px; }

/* ---------- Kunde ---------- */
.kunde-meta { display: flex; flex-wrap: wrap; gap: 8px 24px; align-items: center; margin: -8px 0 28px; font-size: 15px; }
.kunde-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 24px; align-items: start; }
.kunde-haupt, .kunde-seite { display: grid; gap: 24px; }
.kunde-haupt .card + .card, .kunde-seite .card + .card { margin-top: 0; }
.kunde-seite .grid-2 { grid-template-columns: 1fr; }

.mailvorschau {
  font: 15px/1.55 Arial, Helvetica, sans-serif; color: var(--ink);
  background: var(--soft); border-radius: var(--radius-sm);
  padding: 24px; margin-top: 8px;
  max-height: 560px; overflow: auto;
}
.mailvorschau p { margin: 0 0 14px; }
.mailvorschau img { max-width: 100%; height: auto; }
.eigener-text { background: var(--white); border: 2px dashed var(--brand); border-radius: var(--radius-sm); padding: 14px; margin: 0 0 14px; font-family: var(--font); }
.eigener-text textarea { min-height: 88px; }

.verlauf, .notizen { list-style: none; margin: 0; padding: 0; }
.verlauf-eintrag, .notizen li { border-top: 1px solid var(--line); padding: 16px 0; }
.verlauf-eintrag:first-child, .notizen li:first-child { border-top: 0; padding-top: 4px; }
.verlauf-kopf { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; color: var(--ink); }
.verlauf-kopf .geoeffnet { display: inline; }
.verlauf-eintrag p { margin: 4px 0 0; }
.fehlertext { color: #a5221d; }
.notizen { margin-top: 20px; }
.notizen li { position: relative; padding-right: 48px; color: var(--ink); }
.notizen li form { position: absolute; right: 0; top: 10px; margin: 0; }
.notizen li:first-child form { top: 0; }

.profil-grid { display: grid; grid-template-columns: 1.3fr 1fr; gap: 24px; align-items: start; }
.profil-grid .card + .card { margin-top: 0; }

/* ---------- Fußzeile ---------- */
.rb-foot { border-radius: 6px 6px 0 0; }
.foot { background: var(--black); color: #9aa3b5; font-size: 14px; padding: 28px 0 calc(28px + env(safe-area-inset-bottom)); }
.totop {
  position: fixed; right: 20px; bottom: 20px; z-index: 40;
  width: 56px; height: 56px; border-radius: 999px; border: 0;
  background: var(--black); color: var(--white); cursor: pointer;
  display: grid; place-items: center;
  box-shadow: 0 10px 24px rgba(12, 17, 30, 0.25);
}
.totop[hidden] { display: none; }

/* ---------- Responsiv ---------- */
@media (max-width: 960px) {
  .kunde-grid, .profil-grid { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  :root { --gutter: 18px; }
  body { font-size: 16px; }
  .topbar { padding-top: 10px; }
  .topbar-in { padding: 12px 12px 20px 20px; border-radius: 24px; }
  .topbar-in > .rb { left: 20px; right: 20px; }
  .logo-img { height: 28px; }
  .brand-sub { display: none; }
  .tb-btn span { display: none; }
  .tb-btn { padding: 0; justify-content: center; }
  .toasts { top: 96px; }
  .page-head { padding-top: 36px; }
  .page-head-aktionen { width: 100%; }
  .page-head-aktionen .btn { width: 100%; }
  .grid-2 { grid-template-columns: 1fr; }
  .card { padding: 22px; }
  .login-card { padding: 28px 22px; margin-top: 28px; }
  .chips { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
  form .chips, fieldset .chips { flex-wrap: wrap; }

  /* Tabelle wird zu Karten */
  .tabelle-rahmen { border: 0; border-radius: 0; overflow: visible; }
  .tabelle thead { display: none; }
  .tabelle, .tabelle tbody, .tabelle tr, .tabelle td { display: block; width: 100%; }
  .tabelle tr { border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 18px; margin-bottom: 12px; }
  .tabelle td { border: 0; padding: 8px 0; display: grid; grid-template-columns: 110px 1fr; gap: 12px; }
  .tabelle td::before { content: attr(data-label); font-size: 13px; font-weight: 600; color: var(--muted); }
  .tabelle td:first-child { display: block; font-size: 17px; }
  .tabelle td:first-child::before { display: none; }
  .tabelle td.ist-leer { display: none; }
  .filter select { flex: 1 1 100%; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; scroll-behavior: auto !important; }
}


/* Schmale Handys: Platz für vier Buttons in der Kopfleiste */
@media (max-width: 420px) {
  .topbar-in { gap: 8px; padding-left: 16px; padding-right: 10px; }
  .topbar-in > .rb { left: 16px; right: 16px; }
  .brand { min-width: 0; }
  .logo-img { height: 24px; max-width: 100%; }
  .topnav { gap: 6px; }
  .tb-btn { min-width: 44px; min-height: 44px; border-radius: 14px; }
}