/* Campalytics — clean, ruhig, Stake-inspiriert: geschichtetes Graphit-Grau, ein roter Akzent.
   Überschriften: Fredoka (runde, weiche, gut lesbare Display-Sans). Text/UI: Rubik. */

:root {
  --bg: #17191c;
  --surface: #1f2226;
  --surface-2: #272b30;
  --elevated: #31363d;
  --line: rgba(255, 255, 255, 0.07);
  --line-strong: rgba(255, 255, 255, 0.13);

  --text: #eceef0;
  --muted: #969ca4;
  --muted-dim: #666c73;

  --red: #ff2d3f;
  --red-hover: #ff4655;
  --red-soft: rgba(255, 45, 63, 0.14);
  --red-line: rgba(255, 45, 63, 0.42);
  --red-text: #ff8088;
  --green: #22c98a;
  --amber: #f0b429;

  --r-sm: 10px;
  --r: 14px;
  --r-lg: 18px;
  --pill: 999px;
  --shadow: 0 10px 34px rgba(0, 0, 0, 0.38);
  --font: "Rubik", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-display: "Fredoka", "Rubik", sans-serif;
}

* { box-sizing: border-box; }

html { background: var(--bg); }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  letter-spacing: -0.006em;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  padding: 0 clamp(16px, 4vw, 44px) 40px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.hidden { display: none !important; }
.view { animation: fade-up 0.35s ease both; }

/* Scrollbars */
* { scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, 0.14) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.13); border-radius: var(--pill); border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.22); background-clip: padding-box; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- Kopfzeile ---------- */
.topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 0 20px;
}
.brand { display: flex; align-items: center; gap: 13px; }
.logo {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 11px;
  background: var(--red);
  color: #fff;
}
.logo svg { width: 21px; height: 21px; }
.brand-text h1 { margin: 0; font-family: var(--font-display); font-size: 23px; font-weight: 600; letter-spacing: -0.01em; line-height: 1.1; }
.tagline { margin: 2px 0 0; color: var(--muted); font-size: 12.5px; font-weight: 400; }

.scan-controls { display: flex; gap: 9px; flex-wrap: wrap; }
body.mail-active .scan-controls,
body.globe-active .scan-controls { display: none; }

/* Segmented Tabs (Signatur) */
.tabs {
  display: flex;
  gap: 3px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--pill);
  padding: 4px;
}
.tab {
  border: none;
  background: transparent;
  color: var(--muted);
  padding: 8px 20px;
  border-radius: var(--pill);
  font-family: var(--font);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: color 0.18s ease, background 0.18s ease;
}
.tab:hover { color: var(--text); }
.tab.active { background: var(--elevated); color: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.35); }

/* ---------- Buttons ---------- */
.btn {
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--text);
  font-family: var(--font);
  padding: 10px 17px;
  border-radius: var(--r-sm);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}
.btn:hover { transform: translateY(-1px); background: var(--elevated); border-color: var(--line-strong); }
.btn:active { transform: translateY(0); }
.btn-primary { background: var(--red); border-color: transparent; color: #fff; }
.btn-primary:hover { background: var(--red-hover); border-color: transparent; box-shadow: 0 6px 18px rgba(255, 45, 63, 0.28); }
.btn-ghost { background: var(--surface-2); }
.btn-sm { padding: 7px 13px; font-size: 12.5px; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; box-shadow: none; }

.input {
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--text);
  font-family: var(--font);
  border-radius: var(--r-sm);
  padding: 10px 13px;
  font-size: 13.5px;
  outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}
.input::placeholder { color: var(--muted-dim); }
.input:focus { border-color: var(--red); box-shadow: 0 0 0 3px var(--red-soft); }
.input-search { flex: 1 1 240px; min-width: 200px; }
select.input { cursor: pointer; }

/* ---------- Scan-Banner ---------- */
.scan-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 3px solid var(--red);
  border-radius: var(--r);
  padding: 13px 16px;
  margin-bottom: 18px;
  font-size: 13.5px;
  animation: fade-up 0.3s ease both;
}
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--red); flex: none; animation: calm-pulse 1.6s ease-in-out infinite; }
.progress { flex: 1; height: 5px; border-radius: var(--pill); background: var(--surface-2); overflow: hidden; }
.progress-bar { height: 100%; width: 0%; background: var(--red); border-radius: var(--pill); transition: width 0.6s ease; }

/* ---------- Kennzahlen ---------- */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}
.stat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 18px 20px;
  animation: fade-up 0.4s ease both;
}
.stat-accent { border-color: var(--red-line); background: linear-gradient(165deg, var(--surface), rgba(255, 45, 63, 0.07)); }
.stat-value { display: block; font-family: var(--font-display); font-size: 27px; font-weight: 600; letter-spacing: -0.01em; line-height: 1.1; }
.stat-accent .stat-value { color: var(--red); }
.stat-label { display: block; margin-top: 5px; color: var(--muted); font-size: 12.5px; }

/* ---------- Filter ---------- */
.filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 9px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 12px 14px;
  margin-bottom: 12px;
}
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  font-family: var(--font);
  border-radius: var(--pill);
  padding: 7px 13px;
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}
.chip:hover { color: var(--text); border-color: var(--line-strong); }
.chip.active { background: var(--red-soft); border-color: var(--red-line); color: var(--red-text); }
.toggle { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 13px; cursor: pointer; user-select: none; }
.toggle input { accent-color: var(--red); width: 15px; height: 15px; }

.meta-line { color: var(--muted); font-size: 13px; margin: 4px 2px 16px; }

/* ---------- Karten ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 13px; }
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 17px 17px 15px;
  display: flex;
  flex-direction: column;
  gap: 11px;
  animation: fade-up 0.4s ease both;
  transition: transform 0.18s ease, border-color 0.2s ease, box-shadow 0.22s ease;
}
.card:hover { transform: translateY(-2px); border-color: var(--red-line); box-shadow: var(--shadow); }
.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.card-title { margin: 0; font-family: var(--font-display); font-size: 16.5px; font-weight: 600; line-height: 1.3; letter-spacing: -0.005em; }
.card-sub { color: var(--muted); font-size: 12.5px; margin-top: 3px; }

.badge { border-radius: 8px; padding: 4px 9px; font-size: 11.5px; font-weight: 700; white-space: nowrap; }
.badge-size { background: var(--surface-2); color: #c4c8ce; border: 1px solid var(--line); }
.badge-XL, .badge-L { background: var(--red-soft); color: var(--red-text); border: 1px solid var(--red-line); }

.figures { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.figure { background: var(--surface-2); border-radius: var(--r-sm); padding: 9px 10px; }
.figure b { display: block; font-size: 15px; font-weight: 700; }
.figure span { color: var(--muted); font-size: 10.5px; }
.figure-accent b { color: var(--red); }

.card-links { display: flex; flex-wrap: wrap; gap: 10px; font-size: 13px; }
.card-links a { color: var(--red-text); text-decoration: none; transition: color 0.15s ease; }
.card-links a:hover { color: #fff; }
.card-links .no-web { color: var(--muted-dim); }

.card-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.status-select {
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--text);
  font-family: var(--font);
  border-radius: var(--r-sm);
  padding: 7px 9px;
  font-size: 12.5px;
  cursor: pointer;
}
.status-KONTAKTIERT { border-color: rgba(240, 180, 41, 0.5); color: var(--amber); }
.status-INTERESSIERT { border-color: var(--red-line); color: var(--red-text); }
.status-KUNDE { border-color: rgba(34, 201, 138, 0.5); color: var(--green); }
.status-ABGELEHNT { opacity: 0.5; }

.btn-mini {
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--muted);
  font-family: var(--font);
  border-radius: var(--r-sm);
  padding: 7px 11px;
  font-size: 12.5px;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.btn-mini:hover { color: #fff; border-color: var(--line-strong); }
.btn-mini:disabled { opacity: 0.4; cursor: wait; }

.note-input {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  color: var(--text);
  font-family: var(--font);
  font-size: 12.5px;
  padding: 8px 10px;
  outline: none;
  transition: border-color 0.18s ease;
}
.note-input:focus { border-color: var(--red); }

.prices { background: var(--surface-2); border-radius: var(--r-sm); padding: 9px 11px; font-size: 12.5px; }
.prices b { font-weight: 700; }
.prices ul { margin: 5px 0 0; padding-left: 16px; color: var(--muted); }
.prices li b { color: var(--text); }
.prices .empty { color: var(--muted); }

.load-more-wrap { display: flex; justify-content: center; margin: 22px 0; }
.foot { color: var(--muted-dim); font-size: 12px; max-width: 780px; margin: 34px auto 0; text-align: center; line-height: 1.7; }

/* ===================== Globus ===================== */
.globe-scanbar {
  display: flex; align-items: center; flex-wrap: wrap; gap: 10px;
  background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--red);
  border-radius: var(--r); padding: 11px 14px; margin-bottom: 14px; font-size: 13.5px; color: var(--muted);
}
.globe-stage { position: relative; }
.globe-canvas {
  width: 100%; height: min(62vh, 640px); min-height: 380px;
  border: 1px solid var(--line); border-radius: var(--r-lg);
  background: radial-gradient(circle at 50% 38%, #1d2024, #131518 70%);
  overflow: hidden; cursor: grab;
}
.globe-canvas:active { cursor: grabbing; }
.globe-ctrl {
  position: absolute; top: 12px; right: 12px; z-index: 2;
  border: 1px solid var(--line-strong); background: rgba(18, 20, 23, 0.82); backdrop-filter: blur(5px);
  color: var(--text); font-family: var(--font); font-size: 12.5px; font-weight: 600;
  padding: 8px 14px; border-radius: var(--pill); cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}
.globe-ctrl:hover { border-color: var(--red-line); color: var(--red-text); }
.globe-error { display: grid; place-items: center; height: 100%; color: var(--muted); padding: 20px; text-align: center; }
.globe-legendline { color: var(--muted); font-size: 12.5px; text-align: center; margin: 12px 0 4px; }
.globe-legendline b { color: var(--text); font-weight: 600; }

/* Hover-Tooltip (globe.gl Label) */
.globe-tip {
  background: #0e0f11; border: 1px solid var(--line-strong); border-left: 3px solid var(--red);
  border-radius: 10px; padding: 9px 12px; display: flex; flex-direction: column; gap: 2px;
  font-family: var(--font); box-shadow: var(--shadow);
}
.globe-tip b { font-family: var(--font-display); font-weight: 600; font-size: 15px; color: var(--text); }
.globe-tip span { color: var(--muted); font-size: 12px; }
.globe-tip .tip-accent { color: var(--red-text); font-weight: 600; }
.globe-tip .tip-sel { color: #fff; font-size: 11px; margin-top: 2px; }

.globe-detail { margin-top: 18px; min-height: 60px; }
.globe-hint { text-align: center; color: var(--muted-dim); padding: 26px 0; }
.globe-hint b { color: var(--muted); }
.globe-detailhead h2 { font-family: var(--font-display); font-weight: 600; font-size: 22px; margin: 0 0 12px; }
.globe-combinfo { color: var(--muted); font-size: 12.5px; margin: -6px 0 14px; }
.globe-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 18px; }
.gcard { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 14px 16px; }
.gcard b { display: block; font-family: var(--font-display); font-weight: 600; font-size: 22px; letter-spacing: -0.01em; }
.gcard span { color: var(--muted); font-size: 12px; }
.gcard-accent { border-color: var(--red-line); background: linear-gradient(165deg, var(--surface), rgba(255, 45, 63, 0.07)); }
.gcard-accent b { color: var(--red); }
.globe-empty { display: flex; flex-direction: column; align-items: flex-start; gap: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 22px; color: var(--muted); }

.globe-charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 14px; }
.ch-fig { margin: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 14px 16px; }
.ch-fig figcaption { font-family: var(--font-display); font-weight: 500; font-size: 14px; color: var(--text); margin-bottom: 6px; }

/* SVG-Charts */
.chart { width: 100%; height: auto; display: block; }
.ch-grid { stroke: rgba(255, 255, 255, 0.06); stroke-width: 1; }
.ch-line { fill: none; stroke: var(--red); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.ch-dot { fill: var(--red); stroke: #111316; stroke-width: 1; }
.ch-ylab { fill: var(--muted-dim); font-size: 11px; text-anchor: end; font-family: var(--font); }
.ch-xlab { fill: var(--muted); font-size: 11px; text-anchor: middle; font-family: var(--font); }

/* ===================== Mail ===================== */
.mail-setup {
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 3px solid var(--red);
  border-radius: var(--r-lg);
  padding: 22px 26px;
  max-width: 720px;
  line-height: 1.65;
}
.mail-setup h2 { margin: 0 0 10px; font-family: var(--font-display); font-size: 20px; font-weight: 600; }
.mail-setup code { background: var(--surface-2); padding: 2px 6px; border-radius: 6px; font-size: 12.5px; color: var(--red-text); }

.mail-layout { display: grid; grid-template-columns: 240px 360px 1fr; gap: 14px; height: calc(100vh - 150px); }

/* Seitenleiste */
.mail-side { display: flex; flex-direction: column; gap: 10px; min-height: 0; }
.mail-compose { width: 100%; }
.mail-folders { display: flex; flex-direction: column; gap: 3px; margin-top: 4px; }
.mail-folder {
  text-align: left;
  border: none;
  background: transparent;
  color: var(--muted);
  font-family: var(--font);
  padding: 10px 13px;
  border-radius: var(--r-sm);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease;
}
.mail-folder:hover { color: var(--text); background: var(--surface); }
.mail-folder.active { background: var(--surface-2); color: #fff; box-shadow: inset 2px 0 0 var(--red); }

.mail-acc-head { display: flex; align-items: center; justify-content: space-between; color: var(--muted-dim); font-size: 11.5px; font-weight: 600; letter-spacing: 0.02em; margin: 8px 4px 2px; }
.mail-add { border: 1px solid var(--line); background: var(--surface-2); color: var(--text); width: 24px; height: 24px; border-radius: 7px; cursor: pointer; font-size: 15px; line-height: 1; transition: border-color 0.15s ease, color 0.15s ease; }
.mail-add:hover { border-color: var(--red-line); color: var(--red-text); }

.mail-accounts { display: flex; flex-direction: column; gap: 2px; overflow-y: auto; min-height: 0; }
.mail-acc {
  display: flex;
  align-items: center;
  gap: 6px;
  text-align: left;
  border: none;
  background: transparent;
  color: var(--muted);
  font-family: var(--font);
  padding: 9px 11px;
  border-radius: var(--r-sm);
  font-size: 13px;
  cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease;
}
.mail-acc:hover { color: var(--text); background: var(--surface); }
.mail-acc.active { background: var(--surface-2); color: #fff; }
.mail-acc-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mail-badge { background: var(--red); color: #fff; font-size: 11px; font-weight: 700; border-radius: var(--pill); padding: 1px 7px; }
.mail-acc-del { color: var(--muted-dim); font-size: 11px; opacity: 0; transition: opacity 0.15s ease, color 0.15s ease; }
.mail-acc:hover .mail-acc-del { opacity: 1; }
.mail-acc-del:hover { color: var(--red); }

/* Liste */
.mail-listcol { display: flex; flex-direction: column; gap: 10px; min-height: 0; }
.mail-search { display: flex; gap: 8px; }
.mail-search .input { flex: 1; }
.mail-list { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); overflow-y: auto; min-height: 0; flex: 1; }
.mail-item {
  display: block;
  width: 100%;
  text-align: left;
  border: none;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: var(--text);
  font-family: var(--font);
  padding: 12px 15px;
  cursor: pointer;
  transition: background 0.13s ease;
}
.mail-item:hover { background: var(--surface-2); }
.mail-item.active { background: var(--red-soft); box-shadow: inset 2px 0 0 var(--red); }
.mail-item.unread .mail-item-who, .mail-item.unread .mail-item-subj { font-weight: 700; color: #fff; }
.mail-item-row { display: flex; justify-content: space-between; gap: 8px; }
.mail-item-who { font-size: 13px; color: #cdd1d6; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mail-item-date { color: var(--muted-dim); white-space: nowrap; font-size: 11.5px; }
.mail-item-subj { font-size: 13.5px; margin: 3px 0 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mail-item-snip { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Lesebereich */
.mail-reader { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); overflow-y: auto; min-height: 0; padding: 22px 24px; display: flex; flex-direction: column; }
.mail-empty { color: var(--muted); font-size: 14px; margin: auto; }
.mail-read-head { border-bottom: 1px solid var(--line); padding-bottom: 14px; margin-bottom: 14px; }
.mail-read-subj { margin: 0 0 8px; font-family: var(--font-display); font-size: 20px; font-weight: 600; letter-spacing: -0.01em; line-height: 1.25; }
.mail-read-meta { color: var(--muted); font-size: 13px; line-height: 1.55; }
.mail-read-meta b { color: var(--text); font-weight: 600; }
.mail-read-actions { display: flex; gap: 8px; margin-top: 13px; }
.mail-atts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 13px; }
.mail-att { display: inline-flex; align-items: center; gap: 5px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 6px 11px; font-size: 12.5px; color: var(--red-text); text-decoration: none; transition: border-color 0.15s ease, color 0.15s ease; }
.mail-att:hover { border-color: var(--red-line); color: #fff; }
.mail-att-off { color: var(--muted-dim); cursor: default; }
.mail-read-body { flex: 1; min-height: 0; }
.mail-html { width: 100%; height: 100%; min-height: 420px; border: none; background: #fff; border-radius: var(--r-sm); }
.mail-text { white-space: pre-wrap; word-wrap: break-word; font-family: var(--font); font-size: 14px; line-height: 1.65; margin: 0; color: var(--text); }

/* ---------- Mail auf dem Handy: eine Ansicht nach der anderen ---------- */
/* MUSS nach den Basis-Mail-Regeln stehen — Media-Queries erhöhen die Spezifität
   nicht, also entscheidet die Quell-Reihenfolge. */
.mail-back { display: none; }
@media (max-width: 1080px) {
  .mail-layout { display: flex; flex-direction: column; height: calc(100dvh - 120px); gap: 10px; }
  /* Seitenleiste wird zur kompakten Kopfzeile statt einer Spalte. */
  .mail-side { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 8px; min-height: 0; }
  .mail-compose { order: -1; flex: 0 0 auto; width: auto; padding: 8px 14px; }
  .mail-folders { flex-direction: row; gap: 6px; margin-top: 0; }
  .mail-folder { padding: 7px 12px; }
  .mail-acc-head { width: auto; margin: 0; }
  .mail-accounts { flex: 1 1 100%; flex-direction: row; flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden; gap: 6px; -webkit-overflow-scrolling: touch; }
  .mail-acc { white-space: nowrap; flex: 0 0 auto; }
  .mail-listcol { flex: 1 1 auto; min-height: 0; }
  /* Leser standardmäßig aus; beim Lesen füllt er die Fläche, Liste/Seitenleiste aus. */
  .mail-reader { display: none; }
  body.mail-reading .mail-side, body.mail-reading .mail-listcol { display: none; }
  body.mail-reading .mail-reader { display: flex; flex: 1 1 auto; }
  .mail-back { display: inline-flex; align-self: flex-start; margin-bottom: 10px; }
}

/* Compose-Dialog */
.mail-overlay { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.55); backdrop-filter: blur(4px); display: flex; align-items: center; justify-content: center; z-index: 50; padding: 20px; animation: fade-in 0.15s ease both; }
.mail-dialog { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); width: min(680px, 100%); max-height: 90vh; overflow-y: auto; padding: 22px; display: flex; flex-direction: column; gap: 12px; box-shadow: var(--shadow); animation: fade-up 0.2s ease both; }
.mail-dialog-head { display: flex; align-items: center; justify-content: space-between; }
.mail-dialog-head b { font-family: var(--font-display); font-size: 18px; font-weight: 600; }
.mail-x { border: none; background: transparent; color: var(--muted); font-size: 17px; cursor: pointer; transition: color 0.15s ease; }
.mail-x:hover { color: var(--red); }
.mail-field, .mail-field-file { display: flex; flex-direction: column; gap: 5px; color: var(--muted); font-size: 12.5px; }
.mail-body { min-height: 220px; resize: vertical; font-family: var(--font); line-height: 1.55; }
.mail-files { color: var(--muted); font-size: 12.5px; }
.mail-dialog-foot { display: flex; align-items: center; justify-content: flex-end; gap: 14px; margin-top: 2px; }
.mail-status { color: var(--muted); font-size: 13px; margin-right: auto; }

/* ---------- Motion ---------- */
@keyframes fade-up { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes calm-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* ---------- Pipeline (angefragte Unternehmen als Kanban-Board) ---------- */
body.pipeline-active .scan-controls { display: none; }

#pipeStats { margin-bottom: 6px; }

.pipe-toolbar {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin: 4px 0 18px;
}
.pipe-toolbar .input-search { flex: 1 1 280px; min-width: 220px; }
.pipe-hint { color: var(--muted); font-size: 12.5px; }

.pipe-board {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  overflow-x: auto;
  padding-bottom: 10px;
}
.pipe-col {
  flex: 1 1 0;
  min-width: 250px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-top: 2px solid var(--line-strong);
  border-radius: var(--r);
  padding: 13px 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: border-color 0.18s ease, background 0.18s ease;
}
.pipe-col-KONTAKTIERT { border-top-color: var(--amber); }
.pipe-col-INTERESSIERT { border-top-color: var(--red); }
.pipe-col-KUNDE { border-top-color: var(--green); }
.pipe-col-ABGELEHNT { border-top-color: var(--muted-dim); }

.pipe-col.drop-target { border-color: var(--red-line); background: var(--red-soft); }

.pipe-col-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.pipe-col-title { font-family: var(--font-display); font-size: 14.5px; font-weight: 600; letter-spacing: -0.005em; }
.pipe-col-count {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--pill);
  min-width: 22px;
  text-align: center;
  padding: 1px 8px;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
}
.pipe-col-sum { color: var(--red-text); font-size: 12px; font-weight: 600; margin-bottom: 6px; }

.pipe-col-body { display: flex; flex-direction: column; gap: 10px; min-height: 60px; }
.pipe-col-empty {
  color: var(--muted-dim);
  font-size: 12.5px;
  text-align: center;
  padding: 18px 8px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--r-sm);
}

.pcard {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 12px 12px 11px;
  display: flex;
  flex-direction: column;
  gap: 7px;
  cursor: grab;
  animation: fade-up 0.3s ease both;
  transition: transform 0.16s ease, border-color 0.18s ease, box-shadow 0.2s ease;
}
.pcard:hover { transform: translateY(-2px); border-color: var(--red-line); box-shadow: var(--shadow); }
.pcard:active { cursor: grabbing; }
.pcard.dragging { opacity: 0.45; }

.pcard-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.pcard-title { margin: 0; font-family: var(--font-display); font-size: 14.5px; font-weight: 600; line-height: 1.25; }
.pcard-sub { color: var(--muted); font-size: 12px; }
.pcard-figure { color: var(--red); font-size: 13px; font-weight: 700; }
.pcard-links { display: flex; flex-wrap: wrap; gap: 9px; font-size: 12px; }
.pcard-links a { color: var(--red-text); text-decoration: none; transition: color 0.15s ease; }
.pcard-links a:hover { color: #fff; }
.pcard-note {
  color: var(--muted);
  font-size: 12px;
  background: var(--surface);
  border-radius: var(--r-sm);
  padding: 6px 8px;
  border: 1px solid var(--line);
}
.pcard-status { width: 100%; margin-top: 2px; }

.pipe-empty {
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.6;
  background: var(--surface);
  border: 1px dashed var(--line-strong);
  border-radius: var(--r);
  padding: 26px 22px;
  max-width: 640px;
}

/* KI-Mail-Button (Akquise-Karte): rote Signatur-Aktion */
.gen-mail-btn { color: var(--red-text); border-color: var(--red-line); font-weight: 600; }
.gen-mail-btn:hover { color: #fff; background: var(--red-soft); border-color: var(--red); }
.gen-mail-btn:disabled { opacity: 0.7; cursor: wait; color: var(--muted); border-color: var(--line); background: var(--surface-2); }

/* ---------- Nutzer / Logout im Header ---------- */
.userbox { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.userchip { font-size: 13px; color: var(--muted); white-space: nowrap; }
.tab-admin.hidden { display: none; }

/* ---------- Accounts-Tab (Nutzerverwaltung) ---------- */
.acc-wrap { max-width: 760px; margin: 0 auto; padding: 8px 4px 40px; }
.acc-wrap h2 { margin: 6px 0 4px; }
.acc-intro { color: var(--muted); font-size: 14px; line-height: 1.5; margin: 0 0 18px; }
.acc-form { background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 16px; margin-bottom: 22px; }
.acc-row { display: flex; gap: 10px; flex-wrap: wrap; }
.acc-row .input { flex: 1 1 160px; }
.acc-bind { margin-top: 14px; }
.acc-bind-label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.acc-accounts { display: flex; flex-wrap: wrap; gap: 8px 16px; }
.acc-check { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; }
.acc-formfoot { display: flex; align-items: center; gap: 12px; margin-top: 16px; }
.acc-list { display: flex; flex-direction: column; gap: 12px; }
.acc-card { background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; }
.acc-card-head { display: flex; align-items: center; gap: 10px; }
.acc-badge { font-size: 11px; padding: 2px 8px; border-radius: 20px; background: var(--line); color: var(--muted); }
.acc-badge.admin { background: var(--red-soft); color: #fff; }
.acc-card-bound { font-size: 13px; color: var(--muted); margin-top: 6px; }
.acc-card .acc-accounts { margin-top: 12px; }
.acc-card-foot { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.btn-mini2 { padding: 5px 12px; font-size: 12px; }
.btn-mini2.danger { color: var(--red); border-color: var(--red); }
.acc-empty { color: var(--muted); font-size: 13px; }
.acc-pipeline { margin-top: 12px; display: flex; flex-direction: column; gap: 6px; }
.acc-pipeline.hidden { display: none; }
.acc-pipe-row { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; font-size: 13px; }
.acc-pipe-note { color: var(--muted); font-size: 12px; margin-top: 4px; white-space: pre-wrap; }

/* "schon kontaktiert"-Badge in der Akquise-Karte */
.card-badges { display: inline-flex; align-items: center; gap: 6px; }
.badge-contacted { background: var(--red-soft); color: #fff; font-size: 10px; padding: 2px 7px; border-radius: 20px; white-space: nowrap; }
