/* ==========================================================================
   KAMUI CONTROL — Admin UI Layer
   Erweitert das KAMUI-Theme (kamui-theme.css) um eine tiefere Farbwelt,
   dezente Animationen und Komponenten für die Admin-Führung.
   Nur im Admin-Portal eingebunden (base.html), vanilla CSS.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Farbveredelung — KAMUI-Referenz: warmes Tiefschwarz, Rot/Orange/Amber
   -------------------------------------------------------------------------- */
:root {
  --k-bg: #060202;
  --k-bg-elev: #0d0707;
  --k-bg-card: #120c0c;
  --k-bg-card-hover: #1a1111;
  --k-border: rgba(239, 68, 68, 0.14);
  --k-border-strong: rgba(239, 68, 68, 0.3);
  --k-text: #f3f0ef;
  --k-text-muted: #a89f9d;
  --k-text-dim: #6b6260;
  --k-red: #ef4444;
  --k-red-glow: rgba(239, 68, 68, 0.25);
  --k-amber: #fbbf24;
  --k-amber-glow: rgba(251, 191, 36, 0.22);
  --k-grad: linear-gradient(135deg, #ef4444, #f97316 40%, #fbbf24, #ef4444);
  --k-shadow-card: 0 8px 28px rgba(0, 0, 0, 0.4);
  --k-radius: 12px;
  --k-radius-sm: 8px;
  --k-transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

body {
  background: var(--k-bg);
}

/* Ambient: Grid-Textur der Referenz (sehr dezent), Orbs minimal, Vignette aus */
.kamui-vignette {
  display: none;
}

.kamui-grid {
  display: block;
  background-image:
    linear-gradient(rgba(239, 68, 68, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(239, 68, 68, 0.04) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: none;
  -webkit-mask-image: none;
  opacity: 0.9;
}

.kamui-orb {
  opacity: 0.12;
  animation: orb-drift-ui 32s ease-in-out infinite;
}

.kamui-orb-amber {
  animation-duration: 40s;
  animation-direction: reverse;
}

@keyframes orb-drift-ui {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(40px, 28px) scale(1.06); }
  66% { transform: translate(-18px, 44px) scale(0.96); }
}

.kamui-vignette {
  background: radial-gradient(circle at center, transparent 35%, rgba(7, 6, 10, 0.92) 92%);
}

/* --------------------------------------------------------------------------
   2. Seitenwechsel + gestaffeltes Einblenden
   -------------------------------------------------------------------------- */
.kamui-main {
  animation: page-fade 0.45s ease-out both;
}

@keyframes page-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes fade-slide-in {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}

.kamui-main .card,
.kamui-main .area-card,
.kamui-main .empty-state {
  animation: fade-slide-in 0.4s ease-out both;
}

.kamui-main > *:nth-child(1) { animation-delay: 0.03s; }
.kamui-main > *:nth-child(2) { animation-delay: 0.08s; }
.kamui-main > *:nth-child(3) { animation-delay: 0.13s; }
.kamui-main > *:nth-child(4) { animation-delay: 0.18s; }
.kamui-main > *:nth-child(5) { animation-delay: 0.23s; }
.kamui-main > *:nth-child(6) { animation-delay: 0.28s; }
.kamui-main > *:nth-child(7) { animation-delay: 0.33s; }
.kamui-main > *:nth-child(8) { animation-delay: 0.38s; }
.kamui-main > *:nth-child(9) { animation-delay: 0.43s; }
.kamui-main > *:nth-child(10) { animation-delay: 0.48s; }

.kamui-main .metric {
  animation: fade-slide-in 0.35s ease-out both;
}

.kamui-main .grid > *:nth-child(1) { animation-delay: 0.10s; }
.kamui-main .grid > *:nth-child(2) { animation-delay: 0.14s; }
.kamui-main .grid > *:nth-child(3) { animation-delay: 0.18s; }
.kamui-main .grid > *:nth-child(4) { animation-delay: 0.22s; }
.kamui-main .grid > *:nth-child(5) { animation-delay: 0.26s; }
.kamui-main .grid > *:nth-child(6) { animation-delay: 0.30s; }

/* --------------------------------------------------------------------------
   3. Cards — dezentes Heben, weicher Schatten, feine Borders
   -------------------------------------------------------------------------- */
.card,
.area-card {
  border-color: var(--k-border);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.18);
}

.card:hover,
.area-card:hover {
  transform: translateY(-2px);
  border-color: var(--k-border-strong);
  box-shadow: var(--k-shadow-card);
}

.card::before {
  opacity: 0;
}

/* --------------------------------------------------------------------------
   4. Buttons — primär mit Marken-Gradient, ruhig, kein Glow-Übermaß
   -------------------------------------------------------------------------- */
button,
.btn {
  position: relative;
  background: var(--k-grad);
  background-size: 160% 160%;
  border-color: transparent;
  box-shadow: none;
  font-weight: 600;
  color: #fff;
}

button::after,
.btn::after {
  content: none;
}

button:hover,
.btn:hover {
  background: var(--k-grad);
  background-size: 160% 160%;
  background-position: 60% 60%;
  box-shadow: 0 4px 16px rgba(239, 68, 68, 0.28);
  transform: none;
  color: #fff;
  text-shadow: none;
}

button:focus-visible,
.btn:focus-visible,
a:focus-visible {
  outline: 2px solid rgba(239, 68, 68, 0.4);
  outline-offset: 2px;
}

button:active,
.btn:active {
  transform: translateY(1px);
}

button.secondary,
.btn.secondary {
  background: transparent;
  color: var(--k-text);
  border-color: rgba(239, 68, 68, 0.22);
  box-shadow: none;
}

button.secondary:hover,
.btn.secondary:hover {
  background: rgba(239, 68, 68, 0.07);
  border-color: rgba(239, 68, 68, 0.4);
  box-shadow: none;
  color: var(--k-text);
}

button.danger,
.btn.danger {
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.4);
  color: #fca5a5;
}

button.danger:hover,
.btn.danger:hover {
  background: rgba(239, 68, 68, 0.2);
  box-shadow: none;
  color: #fecaca;
}

/* Fließtext-Links: warmes Rot, dezenter Hover-Underline */
.kamui-main p a:not(.btn),
.kamui-main td a:not(.btn),
.kamui-main .field-hint a,
.kamui-main .page-desc a {
  color: #f87171;
  text-decoration: none;
}

.kamui-main p a:not(.btn):hover,
.kamui-main td a:not(.btn):hover,
.kamui-main .field-hint a:hover,
.kamui-main .page-desc a:hover {
  color: #fca5a5;
  text-decoration: underline;
  text-shadow: none;
}

/* --------------------------------------------------------------------------
   5. Layout — feste linke Seitenleiste (statt Top-Nav), Mobile als Overlay
   -------------------------------------------------------------------------- */
body.has-sidebar .kamui-main {
  margin-left: 280px;
  max-width: 1180px;
  width: auto;
}

.admin-sidebar {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  width: 280px;
  z-index: 60;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  background: #0a0505;
  border-right: 1px solid rgba(239, 68, 68, 0.12);
  padding: 1.25rem 0.95rem 1rem;
}

/* Gradient-Akzent an der linken Kante der Spalte */
.admin-sidebar::before {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 3px;
  background: var(--k-grad);
  opacity: 0.55;
}

.admin-logo-block {
  padding: 0.15rem 0.5rem 0.9rem;
  border-bottom: 1px solid rgba(239, 68, 68, 0.12);
}

.admin-logo {
  display: block;
  font-size: 1.08rem;
  font-weight: 800;
  padding: 0;
  background: var(--k-grad);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: none;
  border-bottom: none;
}

.admin-logo-sub {
  margin-top: 0.2rem;
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  color: var(--k-text-dim);
}

.admin-nav {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
  padding-right: 0.15rem;
}

.admin-nav-group {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.admin-nav-heading {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--k-text-dim);
  padding: 0 0.75rem 0.4rem;
}

.admin-nav-icon {
  width: 18px;
  height: 18px;
  flex: none;
  opacity: 0.8;
}

.admin-nav-group a {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.5rem 0.75rem;
  border: 1px solid transparent;
  border-radius: 10px;
  color: var(--k-text-muted);
  font-size: 0.88rem;
  font-weight: 500;
  text-decoration: none;
  transition: background var(--k-transition), color var(--k-transition);
}

.admin-nav-group a:hover {
  background: rgba(239, 68, 68, 0.06);
  color: var(--k-text);
  text-shadow: none;
  text-decoration: none;
}

/* Aktiver Punkt: Gradient-Pill mit Glas-Border */
.admin-nav-group a.active {
  background: linear-gradient(#171010, #171010) padding-box, var(--k-grad) border-box;
  border: 1px solid transparent;
  color: #fff;
  font-weight: 600;
}

.admin-nav-group a.active .admin-nav-icon {
  color: var(--k-amber);
  opacity: 1;
}

.admin-sidebar-footer {
  border-top: 1px solid rgba(239, 68, 68, 0.12);
  padding-top: 0.9rem;
}

.admin-user-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.admin-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(#171010, #171010) padding-box, var(--k-grad) border-box;
  border: 1.5px solid transparent;
}

.admin-user-email {
  flex: 1;
  min-width: 0;
  font-size: 0.78rem;
  color: var(--k-text-dim);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-logout-btn {
  flex: none;
  width: 32px;
  height: 32px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid rgba(239, 68, 68, 0.18);
  border-radius: 8px;
  color: var(--k-text-muted);
  box-shadow: none;
}

.admin-logout-btn svg {
  width: 15px;
  height: 15px;
}

.admin-logout-btn:hover {
  background: rgba(239, 68, 68, 0.09);
  border-color: rgba(239, 68, 68, 0.35);
  box-shadow: none;
  color: #fff;
}

.admin-sidebar-backdrop {
  display: none;
}

.admin-mobile-bar {
  display: none;
}

@media (max-width: 899px) {
  body.has-sidebar .kamui-main {
    margin-left: 0;
    padding-top: calc(1.5rem + 52px);
  }

  .admin-sidebar {
    width: 280px;
    transform: translateX(-105%);
    transition: transform 0.25s ease;
    box-shadow: none;
  }

  .admin-sidebar.open {
    transform: translateX(0);
    box-shadow: 0 0 70px rgba(0, 0, 0, 0.65);
  }

  .admin-sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 55;
    background: rgba(4, 3, 8, 0.6);
    backdrop-filter: blur(2px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
  }

  .admin-sidebar-backdrop.show {
    opacity: 1;
    pointer-events: auto;
  }

  .admin-mobile-bar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 50;
    height: 52px;
    padding: 0 1rem;
    background: rgba(6, 2, 2, 0.94);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(239, 68, 68, 0.12);
  }

  .admin-mobile-logo {
    border-bottom: none;
    padding: 0;
    font-size: 0.95rem;
  }
}

/* --------------------------------------------------------------------------
   6. Seitenkopf — Gradient-Balken links vom Titel + gepflegte Beschreibung
   -------------------------------------------------------------------------- */
.kamui-main h1 {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 0.5rem;
  text-shadow: none;
}

.kamui-main h1::before {
  content: '';
  width: 4px;
  height: 1.05em;
  border-radius: 3px;
  background: var(--k-grad);
  flex: none;
}

.kamui-main h1::after {
  content: none;
}

.kamui-auth-card h1::before {
  display: none;
}

.page-desc {
  color: var(--k-text-muted);
  max-width: 760px;
  font-size: 0.95rem;
  line-height: 1.65;
  margin: 0 0 1.5rem;
}

.field-hint {
  font-size: 0.78rem;
  color: var(--k-text-dim);
  line-height: 1.5;
  margin: 0.3rem 0 0.15rem;
}

.field-hint strong,
.page-desc strong {
  color: var(--k-text-muted);
}

/* --------------------------------------------------------------------------
   7. Empty-States — gestrichelte Border, Icon, Handlungsanweisung
   -------------------------------------------------------------------------- */
.empty-state {
  border: 1.5px dashed rgba(239, 68, 68, 0.18);
  border-radius: var(--k-radius);
  background: rgba(239, 68, 68, 0.02);
  padding: 2.75rem 1.5rem;
  text-align: center;
  color: var(--k-text-muted);
}

.empty-state .es-icon {
  display: inline-flex;
  color: var(--k-red);
  opacity: 0.85;
  margin-bottom: 0.9rem;
}

.empty-state h3 {
  font-size: 1.05rem;
  margin-bottom: 0.45rem;
}

.empty-state p {
  max-width: 480px;
  margin: 0.3rem auto;
  font-size: 0.9rem;
}

.empty-state .es-cta {
  margin-top: 1.1rem;
}

/* --------------------------------------------------------------------------
   8. Bereichs-Karten (Dashboard-Kompass)
   -------------------------------------------------------------------------- */
.welcome-head {
  margin-bottom: 2rem;
}

.welcome-eyebrow {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--k-amber);
  margin-bottom: 0.45rem;
  text-shadow: 0 0 14px var(--k-amber-glow);
}

.welcome-head h1 {
  margin-bottom: 0.4rem;
}

.welcome-sub {
  color: var(--k-text-muted);
  font-size: 1rem;
  margin: 0;
}

.area-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 1rem;
  margin-bottom: 2.25rem;
}

.area-card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--k-bg-card);
  border: 1px solid var(--k-border);
  border-radius: var(--k-radius);
  padding: 1.25rem;
  overflow: hidden;
  text-decoration: none;
  transition: all var(--k-transition);
}

.area-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 11px;
  background: rgba(255, 59, 78, 0.1);
  border: 1px solid rgba(255, 59, 78, 0.22);
  color: var(--k-red);
  margin-bottom: 0.9rem;
  transition: all var(--k-transition);
}

.area-card:hover .area-icon {
  background: rgba(255, 176, 32, 0.12);
  border-color: rgba(255, 176, 32, 0.35);
  color: var(--k-amber);
  box-shadow: 0 0 16px var(--k-amber-glow);
}

.area-card h3 {
  font-size: 0.95rem;
  margin-bottom: 0.35rem;
}

.area-card p {
  flex: 1;
  font-size: 0.84rem;
  color: var(--k-text-muted);
  line-height: 1.55;
  margin: 0 0 0.9rem;
}

.area-link {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--k-amber);
  transition: all var(--k-transition);
}

.area-card:hover .area-link {
  text-shadow: 0 0 10px var(--k-amber-glow);
  letter-spacing: 0.02em;
}

.section-title {
  font-size: 1.15rem;
  margin-bottom: 1rem;
}

/* --------------------------------------------------------------------------
   9. Badges — dezenter Puls für offene Verifikationen
   -------------------------------------------------------------------------- */
@keyframes badge-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 176, 32, 0.35); }
  50% { box-shadow: 0 0 0 5px rgba(255, 176, 32, 0); }
}

.badge.pulse {
  animation: badge-pulse 2.2s ease-in-out infinite;
}

/* --------------------------------------------------------------------------
   10. Tabellen + Metriken — warme Töne, großzügige Abstände
   -------------------------------------------------------------------------- */
tbody tr:hover {
  background: rgba(239, 68, 68, 0.045);
}

/* Tabellenköpfe: Inter, mittelfett, warm-muted, dezent getönt */
th {
  background: rgba(239, 68, 68, 0.06);
  font-weight: 600;
  font-size: 0.78rem;
  letter-spacing: 0.03em;
  color: var(--k-text-muted);
}

th, td {
  padding: 0.75rem 0.9rem;
}

.metric {
  background: var(--k-bg-elev);
  border-color: rgba(239, 68, 68, 0.1);
}

.metric .value {
  font-variant-numeric: tabular-nums;
}

/* Formularfelder: warmer Dunkelton, rot-warme Borders, klarer Fokus-Ring */
input, select, textarea {
  background: #0d0606;
  border-color: rgba(239, 68, 68, 0.18);
}

input:focus, select:focus, textarea:focus {
  border-color: var(--k-red);
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.4);
  background: #120808;
}

input::placeholder, textarea::placeholder {
  color: var(--k-text-dim);
}

/* Login zentriert über volle Höhe (kein Platz für die alte Topbar mehr nötig) */
.kamui-auth-page {
  min-height: 100vh;
}

/* --------------------------------------------------------------------------
   11. Reduzierte Bewegung respektieren
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* --------------------------------------------------------------------------
   12. Nachrichten-Studio (Messages-Editor)
   -------------------------------------------------------------------------- */
.msg-studio {
  display: grid;
  grid-template-columns: 250px minmax(260px, 1fr) minmax(320px, 1.25fr);
  gap: 1rem;
  align-items: start;
}

.msg-steps,
.msg-list,
.msg-editor {
  min-width: 0;
}

.msg-step-nav {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  max-height: 65vh;
  overflow-y: auto;
}

.msg-step-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.65rem;
  border-radius: var(--k-radius-sm, 8px);
  border: 1px solid transparent;
  color: var(--k-text-muted);
  text-decoration: none;
  font-size: 0.88rem;
}

.msg-step-item:hover {
  background: var(--k-bg-card-hover);
  color: var(--k-text);
}

.msg-step-item.active {
  background: linear-gradient(135deg, rgba(255, 59, 78, 0.14), rgba(255, 176, 32, 0.10));
  border-color: rgba(255, 59, 78, 0.35);
  color: var(--k-text);
  font-weight: 600;
}

.msg-step-count {
  background: var(--k-bg-elev);
  border-radius: 999px;
  padding: 0.05rem 0.5rem;
  font-size: 0.75rem;
  color: var(--k-text-dim);
  font-variant-numeric: tabular-nums;
}

.msg-key-item {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  padding: 0.5rem 0.6rem;
  border-radius: var(--k-radius-sm, 8px);
  border: 1px solid transparent;
  text-decoration: none;
  color: var(--k-text);
}

.msg-key-item:hover {
  background: var(--k-bg-card-hover);
}

.msg-key-item.active {
  background: linear-gradient(135deg, rgba(255, 59, 78, 0.12), rgba(255, 176, 32, 0.08));
  border-color: rgba(255, 59, 78, 0.3);
}

.msg-key-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  margin-top: 0.35rem;
  flex: none;
}

.msg-key-dot.amber {
  background: var(--k-amber);
  box-shadow: 0 0 6px var(--k-amber-glow);
}

.msg-key-dot.gray {
  background: var(--k-text-dim);
  opacity: 0.55;
}

.msg-key-body {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}

.msg-key-name {
  font-size: 0.78rem;
  color: var(--k-amber);
  word-break: break-all;
}

.msg-key-preview {
  font-size: 0.82rem;
  color: var(--k-text-muted);
  line-height: 1.4;
}

.msg-editor-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.msg-lang-toggle {
  display: flex;
  gap: 0.3rem;
}

.msg-lang-toggle .btn.active {
  border-color: rgba(255, 59, 78, 0.5);
  font-weight: 700;
}

.tg-chat {
  background: #0e1621;
  border: 1px solid var(--k-border-strong);
  border-radius: 10px;
  padding: 0.85rem;
  margin-bottom: 0.75rem;
  min-height: 3.5rem;
}

.tg-bubble {
  background: #182533;
  color: #f4f2f5;
  border-radius: 12px 12px 12px 4px;
  padding: 0.55rem 0.75rem;
  font-size: 0.88rem;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
  max-width: 95%;
}

.msg-editor-meta {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  margin: 0.3rem 0 0.6rem;
}

.msg-editor-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.msg-editor-nav {
  margin-left: auto;
  display: flex;
  gap: 0.35rem;
}

@media (max-width: 1100px) {
  .msg-studio {
    grid-template-columns: 1fr;
  }

  .msg-step-nav {
    max-height: none;
    flex-direction: row;
    flex-wrap: wrap;
  }
}

/* ============================================================== Funnel-Map */
.fm-guide summary { cursor: pointer; }
.fm-guide-steps { margin: .75rem 0 .5rem; padding-left: 1.25rem; }
.fm-guide-steps li { margin: .35rem 0; }

.fm-studio {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 1.25rem;
  align-items: start;
}
@media (max-width: 1100px) {
  .fm-studio { grid-template-columns: 1fr; }
  .fm-detail { position: static !important; }
}

/* Verlaufs-Karten */
.fm-map { position: relative; padding-left: 1.75rem; }
.fm-map::before {
  content: "";
  position: absolute;
  left: 17px; top: 12px; bottom: 12px;
  width: 2px;
  background: linear-gradient(var(--k-red), var(--k-border));
  opacity: .55;
}
.fm-node {
  position: relative;
  margin: 0 0 1.1rem;
  padding: 1rem 1.1rem;
  border: 1px solid var(--k-border);
  border-radius: var(--k-radius);
  background: var(--k-bg-card);
}
.fm-node::before {
  content: "";
  position: absolute;
  left: -1.75rem; top: 1.35rem;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--k-red);
  box-shadow: 0 0 8px var(--k-red-glow, rgba(239, 68, 68, .5));
}
.fm-node-extra::before { background: var(--k-amber); box-shadow: none; }
.fm-highlight { animation: fmPulse 1.6s ease; border-color: var(--k-amber); }
@keyframes fmPulse {
  0%, 60% { box-shadow: 0 0 0 3px rgba(245, 158, 11, .35); }
  100% { box-shadow: none; }
}
.fm-node-head { display: flex; align-items: baseline; gap: .6rem; flex-wrap: wrap; }
.fm-node-num {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 26px; height: 26px; padding: 0 4px;
  border-radius: var(--k-radius-sm);
  background: rgba(239, 68, 68, .15);
  color: var(--k-red);
  font-weight: 700; font-size: .85rem;
}
.fm-node-num-extra { background: rgba(245, 158, 11, .15); color: var(--k-amber); }
.fm-node-title { margin: 0; font-size: 1.05rem; }
.fm-state {
  font-size: .68rem; padding: 2px 6px;
  border: 1px solid var(--k-border); border-radius: var(--k-radius-sm);
  color: var(--k-text-dim);
}
.fm-node-note { margin: .5rem 0 0; color: var(--k-text-muted); font-size: .85rem; }
.fm-extra-head { margin: 1.5rem 0 .8rem; font-size: 1rem; }

/* Text-Blöcke */
.fm-text { margin-top: .8rem; }
.fm-condition {
  margin: 0 0 .4rem; font-size: .82rem;
  color: var(--k-text-muted);
}
.fm-key { margin-bottom: .6rem; }
.fm-key-meta { display: flex; align-items: center; gap: .5rem; margin-bottom: .25rem; flex-wrap: wrap; }
.fm-placeholders { margin: .3rem 0 0; font-size: .78rem; color: var(--k-text-dim); }


/* Editierbare Bubble */
.fm-editable { cursor: pointer; transition: outline-color var(--k-transition); outline: 1px dashed transparent; outline-offset: 3px; }
.fm-editable:hover { outline-color: var(--k-amber); }
.fm-flash { animation: fmSaved 1.4s ease; }
@keyframes fmSaved {
  0%, 55% { box-shadow: 0 0 0 3px rgba(16, 185, 129, .45); }
  100% { box-shadow: none; }
}

/* Button-Chips */
.fm-buttons { display: flex; flex-direction: column; gap: .4rem; margin-top: .9rem; }
.fm-btn-chip {
  display: flex; align-items: center; justify-content: space-between; gap: .75rem;
  padding: .35rem .5rem .35rem .8rem;
  border: 1px solid var(--k-border); border-radius: var(--k-radius-sm);
  background: rgba(59, 130, 246, .06);
}
.fm-btn-chip.overridden { border-left: 3px solid var(--k-amber); }
.fm-chip-edit {
  background: none; border: none; padding: .25rem .3rem; cursor: pointer;
  color: var(--k-text); font-weight: 600; font-size: .92rem; text-align: left;
  border-radius: var(--k-radius-sm);
}
.fm-chip-edit:hover { background: rgba(245, 158, 11, .12); }
.fm-chip-label { font-weight: 600; padding: .25rem .3rem; }
.fm-chip-goto {
  background: none; border: none; padding: .3rem .6rem; cursor: pointer;
  color: var(--k-text-muted); font-size: .82rem; white-space: nowrap;
  border-radius: var(--k-radius-sm);
}
.fm-chip-goto:hover { color: var(--k-blue); background: rgba(59, 130, 246, .12); }
.fm-chip-note { color: var(--k-text-muted); font-size: .8rem; padding: .3rem .6rem; }

/* Inline-Editor */
.fm-editor {
  margin: .35rem 0 .6rem; padding: .8rem;
  border: 1px solid var(--k-amber); border-radius: var(--k-radius-sm);
  background: rgba(245, 158, 11, .06);
}
.fm-editor-meta { display: flex; justify-content: space-between; align-items: center; margin-bottom: .4rem; }
.fm-editor-count { font-size: .78rem; color: var(--k-text-dim); }
.fm-editor-text {
  width: 100%; min-height: 120px; resize: vertical;
  background: var(--k-bg); color: var(--k-text);
  border: 1px solid var(--k-border); border-radius: var(--k-radius-sm);
  padding: .6rem; font-family: inherit; line-height: 1.5;
}
.fm-editor-actions { display: flex; gap: .5rem; align-items: center; margin-top: .5rem; flex-wrap: wrap; }
.fm-editor-status { font-size: .82rem; color: var(--k-text-muted); }
.fm-editor-error { color: var(--k-red); }

/* Rechtes Detail-Panel */
.fm-detail { position: sticky; top: 1rem; }
.fm-detail-inner {
  padding: 1rem 1.1rem;
  border: 1px solid var(--k-border); border-radius: var(--k-radius);
  background: var(--k-bg-card);
  max-height: calc(100vh - 2rem);
  overflow-y: auto;
}
.fm-detail-inner h3 { margin: 0 0 .5rem; }
.fm-detail-crumb { margin: 0 0 .8rem; font-size: .9rem; color: var(--k-text-muted); }
.fm-detail-label { font-weight: 700; color: var(--k-text); }
.fm-detail-facts { margin: 0 0 .9rem; font-size: .84rem; }
.fm-detail-facts dt { color: var(--k-text-dim); margin-top: .4rem; }
.fm-detail-facts dd { margin: .1rem 0 0; }
.fm-detail-next { margin: 0 0 .5rem; font-weight: 600; color: var(--k-emerald); }
.fm-target-card {
  padding: .8rem; margin-bottom: .7rem;
  border: 1px dashed var(--k-emerald); border-radius: var(--k-radius-sm);
}
.fm-target-card h4 { margin: 0 0 .5rem; }

/* Toast (gespeichert-Hinweis ohne Neuladen) */
.fm-toast {
  position: fixed;
  left: 50%;
  bottom: 1.5rem;
  transform: translate(-50%, 1rem);
  padding: .6rem 1.2rem;
  border-radius: 999px;
  background: rgba(16, 185, 129, .15);
  border: 1px solid var(--k-emerald);
  color: var(--k-emerald);
  font-weight: 600;
  font-size: .9rem;
  opacity: 0;
  transition: opacity .3s ease, transform .3s ease;
  z-index: 100;
  pointer-events: none;
}
.fm-toast.show { opacity: 1; transform: translate(-50%, 0); }

/* Heute-Board */
.today-board { padding: .4rem; }
.today-row {
  display: flex; align-items: center; gap: 1rem;
  padding: .8rem .9rem;
  border-radius: var(--k-radius-sm);
  color: var(--k-text); text-decoration: none;
  transition: background var(--k-transition);
}
.today-row + .today-row { border-top: 1px solid var(--k-border); border-radius: 0; }
.today-row:first-child { border-radius: var(--k-radius-sm) var(--k-radius-sm) 0 0; }
.today-row:last-child { border-radius: 0 0 var(--k-radius-sm) var(--k-radius-sm); }
.today-row:hover { background: rgba(239, 68, 68, .07); }
.today-num {
  min-width: 2.2rem; height: 2.2rem;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: rgba(239, 68, 68, .15); color: var(--k-red);
  font-weight: 700;
}
.today-num.amber { background: rgba(245, 158, 11, .15); color: var(--k-amber); }
.today-num.blue { background: rgba(59, 130, 246, .15); color: var(--k-blue); }
.today-dot { width: .9rem; height: .9rem; border-radius: 50%; margin: 0 .65rem; flex-shrink: 0; }
.today-dot.on { background: var(--k-emerald); box-shadow: 0 0 8px rgba(16, 185, 129, .6); }
.today-dot.off { background: var(--k-red); box-shadow: 0 0 8px rgba(239, 68, 68, .6); }
.today-text { flex: 1; }
.today-go { color: var(--k-text-muted); font-size: .85rem; white-space: nowrap; }
.today-row:hover .today-go { color: var(--k-red); }
.today-all-clear { margin: .6rem .9rem; color: var(--k-emerald); }

/* Globaler Bot-Status (Sidebar) */
.bot-status-row {
  display: flex; align-items: center; gap: .5rem;
  margin: .35rem .9rem .55rem;
  padding: .45rem .7rem;
  border: 1px solid var(--k-border); border-radius: var(--k-radius-sm);
  color: var(--k-text-muted); text-decoration: none; font-size: .82rem;
  transition: border-color var(--k-transition), color var(--k-transition);
}
.bot-status-row:hover { border-color: var(--k-blue); color: var(--k-text); }
.bot-status-dot { width: .6rem; height: .6rem; border-radius: 50%; flex-shrink: 0; }
.bot-status-row.on .bot-status-dot { background: var(--k-emerald); box-shadow: 0 0 6px rgba(16, 185, 129, .7); }
.bot-status-row.off .bot-status-dot { background: var(--k-red); box-shadow: 0 0 6px rgba(239, 68, 68, .7); }
.bot-status-row.off { border-color: rgba(239, 68, 68, .4); color: var(--k-text); }
.bot-status-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Filter-Chips (Leads) */
.chip-row { display: flex; gap: .4rem; flex-wrap: wrap; }
.chip {
  padding: .3rem .9rem;
  border: 1px solid var(--k-border); border-radius: 999px;
  color: var(--k-text-muted); text-decoration: none; font-size: .85rem;
  transition: border-color var(--k-transition), color var(--k-transition);
}
.chip:hover { border-color: var(--k-red); color: var(--k-text); }
.chip.active { border-color: var(--k-red); background: rgba(239, 68, 68, .12); color: var(--k-text); font-weight: 600; }

/* Hilfe-Tooltips */
.hint {
  display: inline-flex; align-items: center; justify-content: center;
  width: 1rem; height: 1rem; margin-left: .15rem;
  border: 1px solid var(--k-border); border-radius: 50%;
  color: var(--k-text-dim); font-size: .68rem; cursor: help;
  position: relative; vertical-align: middle;
}
.hint:hover { border-color: var(--k-blue); color: var(--k-blue); }
.hint::after {
  content: attr(data-tip);
  position: absolute;
  left: 50%; bottom: 1.4rem;
  transform: translateX(-50%);
  width: 240px;
  padding: .55rem .7rem;
  border: 1px solid var(--k-border); border-radius: var(--k-radius-sm);
  background: var(--k-bg-card);
  color: var(--k-text); font-size: .8rem; font-weight: 400; line-height: 1.45;
  white-space: normal; text-align: left;
  opacity: 0; pointer-events: none;
  transition: opacity .15s ease;
  z-index: 60;
}
.hint:hover::after { opacity: 1; }

/* Einrichtungs-Assistent */
.setup-card { padding: .4rem; }
.setup-card .today-row { border-top: none; }
.setup-done { margin: 0 0 1rem; }

/* Partner-Switcher (Sidebar, Super-Admin) */
.partner-switch { margin: .35rem .9rem .55rem; }
.partner-switch select {
  width: 100%;
  background: var(--k-bg); color: var(--k-text);
  border: 1px solid var(--k-border); border-radius: var(--k-radius-sm);
  padding: .45rem .6rem; font-size: .85rem;
}
.partner-switch select:hover { border-color: var(--k-blue); }

/* Funnel-Konfigurator */
.fm-config-form { display: flex; align-items: flex-end; gap: 1.25rem; flex-wrap: wrap; }
.fm-config-form label { font-size: .85rem; }
.fm-toggle {
  display: inline-flex; align-items: center; gap: .45rem;
  padding: .5rem .7rem;
  border: 1px solid var(--k-border); border-radius: var(--k-radius-sm);
  cursor: pointer; font-size: .88rem;
}
.fm-toggle:hover { border-color: var(--k-blue); }
.fm-toggle input { accent-color: var(--k-red); width: 1rem; height: 1rem; }

/* Globale Suche (Sidebar) */
.sidebar-search { margin: .2rem .9rem .6rem; }
.sidebar-search input {
  width: 100%;
  background: var(--k-bg); color: var(--k-text);
  border: 1px solid var(--k-border); border-radius: var(--k-radius-sm);
  padding: .5rem .7rem; font-size: .85rem;
}
.sidebar-search input:focus { border-color: var(--k-red); outline: none; }

/* ============================================================ Mobile-Pass */
@media (max-width: 768px) {
  /* Tabellen horizontal wischbar statt gequetscht */
  .card:has(> table) { overflow-x: auto; }
  .card table { min-width: 640px; }

  /* Grosse Touch-Ziele */
  .chip { padding: .55rem 1.1rem; }
  .today-row { padding: 1rem .9rem; }
  .fm-btn-chip { padding: .6rem .7rem; }
  .fm-chip-edit, .fm-chip-goto { padding: .5rem .6rem; }
  .fm-editable { min-height: 2.4rem; }
  .btn, button[type="submit"] { min-height: 2.6rem; }

  /* Sidebar-Suche und Switcher kompakt */
  .sidebar-search input, .partner-switch select { font-size: 1rem; }

  /* Bot-Texte: Editor ueber volle Breite */
  .fm-editor-text { min-height: 9rem; }
  .fm-editor-actions .btn { flex: 1 1 auto; }
}

/* Bot-Assistent */
.pairing-code {
  display: inline-block;
  padding: .7rem 1.2rem; margin: .5rem 0;
  border: 1px dashed var(--k-amber); border-radius: var(--k-radius-sm);
  font-size: 1.15rem; font-weight: 700;
  background: rgba(245, 158, 11, .07);
}
.setup-finished { border-color: var(--k-emerald); }

/* Button-Verwaltung (＋ / − / ausgeblendet) */
.fm-chip-minus {
  background: none; border: 1px solid var(--k-border); border-radius: 50%;
  width: 1.35rem; height: 1.35rem; flex-shrink: 0;
  color: var(--k-text-muted); cursor: pointer; font-size: .95rem; line-height: 1;
}
.fm-chip-minus:hover { border-color: var(--k-red); color: var(--k-red); }
.fm-chip-addrow { background: none; border-style: dashed; justify-content: center; padding: .3rem; }
.fm-chip-add {
  background: none; border: none; cursor: pointer;
  color: var(--k-text-muted); font-size: .85rem; padding: .35rem .8rem;
}
.fm-chip-addrow:hover { border-color: var(--k-emerald); }
.fm-chip-addrow:hover .fm-chip-add { color: var(--k-emerald); }
.fm-btn-chip.custom { border-left: 3px solid var(--k-emerald); }
.fm-hidden { display: flex; gap: .5rem; flex-wrap: wrap; margin: .3rem 0 .6rem; }
.fm-hidden-chip {
  font-size: .78rem; color: var(--k-text-dim);
  border: 1px dashed var(--k-border); border-radius: 999px;
  padding: .2rem .6rem; display: inline-flex; align-items: center; gap: .4rem;
}
.fm-chip-restore {
  background: none; border: none; cursor: pointer;
  color: var(--k-emerald); font-size: .95rem; line-height: 1; padding: 0;
}
.fm-addform {
  display: flex; gap: .5rem; align-items: center; flex-wrap: wrap;
  padding: .7rem .8rem; margin: .3rem 0 .6rem;
  border: 1px dashed var(--k-emerald); border-radius: var(--k-radius-sm);
  background: rgba(16, 185, 129, .05);
}
.fm-addform input, .fm-addform select {
  background: var(--k-bg); color: var(--k-text);
  border: 1px solid var(--k-border); border-radius: var(--k-radius-sm);
  padding: .45rem .6rem; font-size: .88rem;
}
.fm-add-label { min-width: 14rem; }
