/* ─── Design Tokens ────────────────────────────────────────────────────────── */
:root {
  /* Farben */
  --accent:       #bad839;
  --accent-h:     #a5c230;
  --accent-light: rgba(186,216,57,.15);
  --accent-text:  #212121;   /* Text auf Accent-Hintergrund */

  --bg:       #f4f4f2;
  --surface:  #ffffff;
  --surface-2:#f9f9f7;

  --text:      #212121;
  --text-mute: #6b6b6b;
  --line:      #e4e4e0;

  --due-today: #d97706;
  --overdue:   #dc2626;
  --won:       #16a34a;

  --radius:    12px;
  --radius-sm: 8px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --space:     8px;
  --max-w:     1140px;

  --shadow-sm: 0 1px 3px rgba(33,33,33,.07), 0 1px 2px rgba(33,33,33,.04);
  --shadow:    0 4px 16px rgba(33,33,33,.09), 0 1px 4px rgba(33,33,33,.05);
  --shadow-lg: 0 12px 40px rgba(33,33,33,.13), 0 4px 12px rgba(33,33,33,.06);

  --font: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
}

/* ─── Reset ────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 15px; }

body {
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--text); text-decoration: none; }
a:hover { text-decoration: underline; }

:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; border-radius: 4px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration:.01ms !important; animation-duration:.01ms !important; }
}

/* ─── Layout ────────────────────────────────────────────────────────────────── */
.container {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 28px 20px calc(var(--space) * 10);
}

@media (min-width: 640px) { .container { padding-bottom: 40px; } }

/* ─── Navigation ────────────────────────────────────────────────────────────── */
.site-header {
  background: #212121;
  border-bottom: 1px solid #333;
  position: sticky;
  top: 0;
  z-index: 100;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 20px;
  height: 68px;
}

.nav-logo { margin-right: 12px; flex-shrink: 0; }
.nav-logo:hover { text-decoration: none; opacity: .85; }
.nav-logo-img { display: block; height: 20px; width: auto; filter: brightness(0) invert(1); }

.nav-link {
  color: rgba(255,255,255,.58);
  font-size: 14px;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  background: none;
  border: none;
  cursor: pointer;
  font-family: var(--font);
  line-height: 1.5;
  transition: background 140ms, color 140ms;
}
.nav-link:hover  { background: rgba(255,255,255,.08); color: #fff; text-decoration: none; }
.nav-link.active { background: rgba(255,255,255,.13); color: #fff; font-weight: 700; }

.nav-new {
  background: var(--accent) !important;
  color: var(--accent-text) !important;
  padding: 7px 16px !important;
  border-radius: var(--radius-lg) !important;
  font-weight: 700 !important;
  box-shadow: 0 2px 10px rgba(186,216,57,.30);
  transition: box-shadow 140ms, transform 120ms !important;
}
.nav-new:hover { background: var(--accent-h) !important; box-shadow: 0 4px 18px rgba(186,216,57,.40); transform: translateY(-1px); text-decoration: none; }

.nav-spacer { flex: 1; }

.nav-icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  color: rgba(255,255,255,.55);
  background: none;
  border: none;
  cursor: pointer;
  font-family: var(--font);
  transition: background 140ms, color 140ms;
  flex-shrink: 0;
}
.nav-icon-btn svg { width: 18px; height: 18px; }
.nav-icon-btn:hover { background: rgba(255,255,255,.10); color: #fff; text-decoration: none; }

/* Mobile Nav */
.mobile-nav { display: none; }

@media (max-width: 639px) {
  .site-nav .nav-link:not(.nav-logo),
  .nav-spacer { display: none; }

  .mobile-nav {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(255,255,255,0.96);
    backdrop-filter: blur(14px);
    border-top: 1px solid var(--line);
    z-index: 200;
    height: 60px;
    padding-bottom: env(safe-area-inset-bottom);
  }

  .mobile-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    font-size: 11px;
    color: var(--text-mute);
    font-weight: 500;
    min-height: 44px;
    text-decoration: none;
    transition: color 140ms;
  }
  .mobile-nav-item.active { color: var(--text); font-weight: 700; }
  .mobile-nav-icon { font-size: 20px; line-height: 1; }
  .mobile-nav-new { font-weight: 700; }
}

/* ─── Flash ─────────────────────────────────────────────────────────────────── */
.flash {
  max-width: var(--max-w);
  margin: 10px auto 0;
  padding: 11px 20px;
  font-size: 14px;
  font-weight: 500;
  border: 1px solid transparent;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  gap: 10px;
}
.flash::before { font-size: 15px; }
.flash-success { background: #f0fdf4; color: #15803d; border-color: #bbf7d0; }
.flash-success::before { content: "✓"; }
.flash-error   { background: #fef2f2; color: #991b1b; border-color: #fecaca; }
.flash-error::before   { content: "✕"; }

/* ─── Karten ────────────────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
}

.card-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 18px;
  letter-spacing: -.01em;
}

.card-header .card-title { margin-bottom: 0; }

/* ─── Seiten-Kopf ───────────────────────────────────────────────────────────── */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  gap: 12px;
  flex-wrap: wrap;
}

.page-header-actions { display: flex; gap: 8px; align-items: center; }

.page-title {
  font-size: 24px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -.03em;
}

h1.page-title { margin-bottom: 24px; }

/* ─── Buttons ───────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  border-radius: var(--radius-lg);
  border: 2px solid transparent;
  font-family: var(--font);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
  cursor: pointer;
  white-space: nowrap;
  transition: background 140ms, color 140ms, box-shadow 140ms, transform 120ms;
  text-decoration: none;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn-primary {
  background: var(--accent);
  color: var(--accent-text);
  box-shadow: 0 2px 10px rgba(186,216,57,.30);
}
.btn-primary:hover {
  background: var(--accent-h);
  box-shadow: 0 4px 18px rgba(186,216,57,.40);
  text-decoration: none;
  color: var(--accent-text);
}

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border-color: var(--line);
  box-shadow: var(--shadow-sm);
}
.btn-secondary:hover { background: #f0f0ec; border-color: #ccc; color: var(--text); text-decoration: none; }

.btn-ghost { background: transparent; color: var(--text-mute); border-color: var(--line); }
.btn-ghost:hover { background: #f0f0ec; color: var(--text); border-color: #ccc; text-decoration: none; }

.btn-danger {
  background: #fef2f2;
  color: #991b1b;
  border-color: #fecaca;
}
.btn-danger:hover { background: #fee2e2; border-color: #fca5a5; text-decoration: none; }

.btn-sm  { font-size: 13px; padding: 6px 14px; }
.btn-block { width: 100%; justify-content: center; }

/* ─── Formulare ─────────────────────────────────────────────────────────────── */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 20px;
}
.form-group:last-child { margin-bottom: 0; }

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 20px;
}
.form-grid .form-group { margin-bottom: 0; }
.form-grid .form-group:last-child { margin-bottom: 4px; }
.form-grid .fg-full { grid-column: 1 / -1; }
.form-grid .fg-200  { min-width: 140px; }

.task-fields {
  display: flex;
  gap: 20px;
}
.task-fields .form-group { margin-bottom: 0; }
.task-field-aufgabe { flex: 7; min-width: 0; }
.task-field-user    { flex: 3; min-width: 140px; }

.form-row {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  flex-wrap: wrap;
}
.form-row .fg-grow { flex: 1; min-width: 120px; }
.form-row .fg-200  { flex: 0 0 140px; }

.form-actions {
  display: flex;
  gap: 10px;
  margin-top: 24px;
  flex-wrap: wrap;
}

label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: .01em;
  text-transform: uppercase;
}

input[type="text"],
input[type="email"],
input[type="tel"],
input[type="url"],
input[type="password"],
input[type="date"],
input[type="search"],
textarea,
select {
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  background: var(--surface);
  border: 2px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  width: 100%;
  transition: border-color 140ms, box-shadow 140ms;
}

select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b6b6b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 16px 16px;
  padding-right: 36px;
}
input:focus, textarea:focus, select:focus {
  border-color: var(--text);
  box-shadow: 0 0 0 3px rgba(33,33,33,.08);
  outline: none;
}
input::placeholder, textarea::placeholder { color: #aaa; opacity: 1; }

textarea { resize: vertical; min-height: 80px; }

.req     { color: var(--overdue); font-weight: 700; }
.req-one { color: var(--due-today); font-size: 12px; }
.field-hint { font-size: 12px; color: var(--text-mute); margin-top: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }

/* ─── Datum-Schnellbuttons ──────────────────────────────────────────────────── */
.date-row { display: flex; gap: 6px; align-items: center; flex-wrap: nowrap; overflow-x: auto; padding-bottom: 2px; }
.date-row input[type="date"] { width: auto; min-width: 140px; flex-shrink: 0; }

input[type="date"]::-webkit-inner-spin-button,
input[type="date"]::-webkit-outer-spin-button { -webkit-appearance: none; display: none; }
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; display: none; }

.btn-date {
  font-family: var(--font);
  font-size: 12px;
  font-weight: 600;
  padding: 5px 10px;
  background: var(--surface-2);
  border: 2px solid var(--line);
  border-radius: 20px;
  cursor: pointer;
  white-space: nowrap;
  color: var(--text-mute);
  transition: background 120ms, transform 100ms;
}
.btn-date:hover { background: #e8e8e4; color: var(--text); transform: translateY(-1px); }

/* ─── Formular-Reihen ───────────────────────────────────────────────────────── */
.form-row-2    { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 20px; margin-bottom: 20px; }
.form-row-3    { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px 20px; margin-bottom: 20px; }
.form-row-addr { display: grid; grid-template-columns: 110px 1fr 1.5fr; gap: 12px 20px; margin-bottom: 20px; }
.form-row-2 .form-group,
.form-row-3 .form-group,
.form-row-addr .form-group { margin-bottom: 0; }

@media (max-width: 540px) {
  .form-row-2, .form-row-3, .form-row-addr { grid-template-columns: 1fr; }
}

/* ─── Suche & Filter ────────────────────────────────────────────────────────── */
.filter-bar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 24px;
}
.search-input { flex: 1; min-width: 180px; }
.filter-select { width: auto; }

/* ─── Tabellen ──────────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; border-radius: var(--radius); }

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.data-table th,
.data-table td {
  padding: 13px 14px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.data-table th {
  font-weight: 700;
  font-size: 12px;
  color: var(--text-mute);
  white-space: nowrap;
  background: var(--surface-2);
  text-transform: uppercase;
  letter-spacing: .06em;
}
.data-table th a { color: var(--text-mute); }
.data-table th a:hover { color: var(--text); text-decoration: none; }
.data-table tbody tr:hover { background: #FAF8FF; }
.data-table tbody tr:last-child td { border-bottom: none; }
.table-actions { white-space: nowrap; }
.table-actions .btn + .btn { margin-left: 4px; }

.table-lead-link { font-weight: 700; color: var(--text); font-size: 15px; }
.table-lead-link:hover { color: var(--text-mute); text-decoration: none; }

/* ─── Lead-Liste (Karten) ────────────────────────────────────────────────────── */
.lead-list { display: flex; flex-direction: column; gap: 6px; }

.lead-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 13px 16px;
  text-decoration: none;
  color: var(--text);
  transition: box-shadow .15s, border-color .15s;
}
.lead-card:hover {
  box-shadow: var(--shadow);
  border-color: #aaaaaa;
  text-decoration: none;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
  min-width: 110px;
  justify-content: center;
}
.status-badge svg { width: 13px; height: 13px; flex-shrink: 0; }

.sb-neu         { background: #e0f2fe; color: #0369a1; }
.sb-kontaktiert { background: #fef3c7; color: #b45309; }
.sb-angebot     { background: #ede9fe; color: #6d28d9; }
.sb-gewonnen    { background: #dcfce7; color: #15803d; }
.sb-verloren    { background: #f1f5f9; color: #475569; }

.lead-card-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.lead-card-name { font-weight: 700; font-size: 15px; }
.lead-card-firma { font-size: 13px; color: var(--text-mute); }

.lead-card-task {
  flex: 1.2;
  min-width: 0;
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 13px;
  color: var(--text-mute);
}
.lead-card-due {
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  color: var(--text-mute);
}
.lead-card-due.overdue   { color: var(--overdue); }
.lead-card-due.due-today { color: var(--due-today); }
.lead-card-task-titel {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.lead-card-no-task { font-size: 13px; color: #ccc; }

.lead-card-activity {
  font-size: 12px;
  white-space: nowrap;
  flex-shrink: 0;
}

@media (max-width: 639px) {
  .lead-card { flex-wrap: wrap; gap: 8px; }
  .lead-card-task { flex-basis: 100%; order: 3; }
  .lead-card-activity { display: none; }
}

@media (max-width: 639px) {
  .data-table thead { display: none; }
  .data-table tbody tr {
    display: block;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    margin-bottom: 10px;
    padding: 12px;
    box-shadow: var(--shadow-sm);
  }
  .data-table td {
    display: flex;
    gap: 8px;
    border-bottom: none;
    padding: 5px 0;
  }
  .data-table td::before {
    content: attr(data-label);
    font-weight: 700;
    min-width: 80px;
    color: var(--text-mute);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .04em;
    padding-top: 2px;
  }
}

/* ─── Status-Dots / Badges ──────────────────────────────────────────────────── */
.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  vertical-align: middle;
  margin-right: 5px;
}
.status-active { background: var(--accent); }
.status-won    { background: var(--won); }
.status-lost   { background: var(--text-mute); }
.status-label  { font-size: 14px; }

/* ─── Nächster-Schritt-Leiste ────────────────────────────────────────────────── */
.next-step-bar {
  background: var(--surface);
  border: 2px solid var(--line);
  border-radius: var(--radius);
  margin-bottom: 20px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: border-color 140ms;
}
.next-step-bar:hover { border-color: #aaaaaa; }

.next-step-bar-inner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  flex-wrap: wrap;
}

.ns-bar-mark {
  display: block;
  width: 4px;
  height: 38px;
  border-radius: 3px;
  background: var(--line);
  flex-shrink: 0;
}
.next-step-bar.overdue   .ns-bar-mark { background: var(--overdue); }
.next-step-bar.due-today .ns-bar-mark { background: var(--due-today); }
.next-step-bar.overdue   { border-color: #FECACA; }
.next-step-bar.due-today { border-color: #FDE68A; }

.ns-bar-text { flex: 1; font-size: 14px; min-width: 0; font-weight: 500; }
.ns-notiz-preview { color: var(--text-mute); font-size: 13px; display: block; margin-top: 3px; }

.next-step-missing { border-style: dashed; background: var(--surface-2); }

.next-step-cell {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
}
.task-step-bar-inline {
  display: inline-block;
  width: 3px;
  height: 16px;
  border-radius: 2px;
  background: var(--line);
  flex-shrink: 0;
}
.task-step-bar-inline.overdue   { background: var(--overdue); }
.task-step-bar-inline.due-today { background: var(--due-today); }

.ns-user  { color: var(--text-mute); }
.ns-date  { color: var(--text-mute); font-weight: 500; }
.ns-date.overdue   { color: var(--overdue); font-weight: 700; }
.ns-date.due-today { color: var(--due-today); font-weight: 700; }

/* ─── Aufgaben-Liste ────────────────────────────────────────────────────────── */
.task-list { display: flex; flex-direction: column; gap: 10px; }
.task-list-compact .task-row { padding: 8px 14px; }

.task-row {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface);
  border: 2px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 18px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: border-color 140ms, box-shadow 140ms, transform 120ms;
}
.task-row:hover { border-color: #aaaaaa; box-shadow: var(--shadow); transform: translateY(-1px); }

.task-step-bar {
  width: 4px;
  min-height: 44px;
  align-self: stretch;
  border-radius: 3px;
  background: var(--line);
  flex-shrink: 0;
}
.task-step-bar.overdue   { background: var(--overdue); }
.task-step-bar.due-today { background: var(--due-today); }

.task-main { flex: 1; min-width: 0; }
.task-header { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 3px; }
.task-title  { font-size: 14px; font-weight: 700; color: var(--text); }
.task-notiz  { font-size: 13px; color: var(--text-mute); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.task-lead-link { font-size: 13px; color: var(--text-mute); font-weight: 500; }
.task-lead-link:hover { color: var(--text); text-decoration: none; }
.task-actions { display: flex; gap: 6px; flex-shrink: 0; }

.task-due { font-size: 12px; font-variant-numeric: tabular-nums; white-space: nowrap; font-weight: 600; }
.task-due.overdue   { color: var(--overdue); }
.task-due.due-today { color: var(--due-today); }

.task-row-compact .task-main { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.task-row-compact .task-title { font-weight: 500; font-size: 13px; }

.task-row-link {
  display: flex;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  transition: background 140ms;
}
.task-row-link:hover { background: var(--bg); text-decoration: none; }

/* ─── Dashboard-Sektionen ────────────────────────────────────────────────────── */
.dashboard-section { margin-bottom: 36px; }

.section-title {
  font-size: 16px;
  font-weight: 800;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  letter-spacing: -.02em;
}

.section-hint { font-size: 13px; color: var(--text-mute); margin-bottom: 12px; }

.dashboard-warning .section-title { color: var(--overdue); }
.dashboard-warning .task-row { border-color: #FECACA; }
.dashboard-warning .task-row:hover { border-color: #F87171; }

.user-group { margin-bottom: 24px; }
.user-group-name {
  font-size: 11px;
  font-weight: 800;
  color: var(--text-mute);
  text-transform: uppercase;
  letter-spacing: .08em;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.collapsible-toggle { cursor: pointer; user-select: none; }
.collapse-arrow { font-size: 12px; transition: transform 140ms; display: inline-block; }
.collapsible-toggle[aria-expanded="true"] .collapse-arrow { transform: rotate(180deg); }
[hidden] { display: none !important; }

/* ─── Badges ────────────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 7px;
  border-radius: 11px;
  background: #e4e4e0;
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.badge-sm { min-width: 18px; height: 18px; font-size: 11px; padding: 0 5px; }
.badge-warn { background: #fef3c7; color: var(--due-today); }

/* ─── Pipeline ──────────────────────────────────────────────────────────────── */
.pipeline {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 8px;
}

@media (max-width: 900px)  { .pipeline { grid-template-columns: repeat(3, minmax(180px, 1fr)); } }
@media (max-width: 639px)  { .pipeline { grid-template-columns: repeat(2, minmax(160px, 1fr)); } }

.pipeline-col {
  background: var(--surface-2);
  border: 2px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
}
.pipeline-col-head {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 800;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-mute);
  padding-bottom: 10px;
  border-bottom: 2px solid var(--line);
  margin-bottom: 10px;
}

.pipeline-card {
  display: block;
  background: var(--surface);
  border: 2px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  margin-bottom: 8px;
  color: var(--text);
  text-decoration: none;
  transition: border-color 140ms, box-shadow 140ms, transform 120ms;
  box-shadow: var(--shadow-sm);
}
.pipeline-card:hover {
  border-color: #aaaaaa;
  box-shadow: var(--shadow);
  transform: translateY(-2px);
  text-decoration: none;
  color: var(--text);
}
.pipeline-card-name  { font-weight: 700; font-size: 14px; }
.pipeline-card-firma { font-size: 12px; color: var(--text-mute); margin-top: 2px; }
.pipeline-card-task  { font-size: 12px; color: var(--text-mute); margin-top: 6px; display: flex; align-items: center; gap: 4px; }
.pipeline-card-task.overdue   { color: var(--overdue); font-weight: 600; }
.pipeline-card-task.due-today { color: var(--due-today); font-weight: 600; }
.pipeline-empty { font-size: 13px; color: var(--text-mute); padding: 10px 0; text-align: center; }

/* ─── Lead-Detail ────────────────────────────────────────────────────────────── */
.lead-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  flex-wrap: wrap;
}
.lead-head-main { flex: 1; min-width: 0; }
.lead-head-meta {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-end;
  min-width: 160px;
}
.lead-name  { font-size: 26px; font-weight: 800; margin-bottom: 4px; letter-spacing: -.03em; }
.lead-firma { font-size: 17px; color: var(--text-mute); }
.lead-status { display: flex; align-items: center; }

.inline-form { display: inline-flex; align-items: center; gap: 6px; }
.select-inline {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b6b6b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  background-size: 14px 14px;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  padding: 5px 30px 5px 10px;
  border: 2px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}
.select-inline:focus { border-color: var(--text); box-shadow: 0 0 0 3px rgba(33,33,33,.08); outline: none; }

.status-select {
  font-weight: 700; border-radius: 20px; border: none;
  min-width: 130px; width: 130px;
  text-align: center; text-align-last: center;
  padding-left: 24px;
}
.status-select.sb-neu         { background: #e0f2fe; color: #0369a1; }
.status-select.sb-kontaktiert { background: #fef3c7; color: #b45309; }
.status-select.sb-angebot     { background: #ede9fe; color: #6d28d9; }
.status-select.sb-gewonnen    { background: #dcfce7; color: #15803d; }
.status-select.sb-verloren    { background: #f1f5f9; color: #475569; }

.tags-display { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.tags-form { width: 100%; }
.tag {
  background: #e4e4e0;
  border: none;
  border-radius: 20px;
  padding: 3px 10px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
}
.tags-placeholder { font-size: 13px; color: var(--text-mute); }
.btn-tag-edit {
  background: none; border: none; cursor: pointer;
  color: var(--text-mute); font-size: 16px; padding: 2px;
}
.btn-tag-edit:hover { color: var(--text); }
.tags-input { width: 100%; margin-bottom: 8px; }

.contact-dl { display: flex; flex-direction: column; gap: 10px; }
.contact-dl-row { display: flex; align-items: flex-start; gap: 10px; }
.contact-dl-icon {
  display: flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; flex-shrink: 0;
  background: var(--surface-2); border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  color: var(--text-mute);
}
.contact-dl-icon svg { width: 15px; height: 15px; }
.contact-dl-body { display: flex; flex-direction: column; justify-content: center; }
.contact-dl-label { font-weight: 700; font-size: 11px; color: var(--text-mute); text-transform: uppercase; letter-spacing: .05em; line-height: 1.2; }
.contact-dl-value { font-size: 14px; color: var(--text); line-height: 1.4; }

.lead-danger-zone { text-align: right; padding-top: 10px; }

/* ─── Timeline ──────────────────────────────────────────────────────────────── */
.notiz-form { margin-bottom: 24px; }
.notiz-row {
  display: flex;
  gap: 10px;
  align-items: stretch;
}
.notiz-row .notiz-textarea {
  flex: 1;
  min-height: 0;
  height: 46px;
  resize: none;
  padding-top: 12px;
  padding-bottom: 12px;
}
.notiz-row .btn { flex-shrink: 0; align-self: stretch; }

.input-row { display: flex; gap: 10px; align-items: flex-start; }
.input-row .select-typ { width: auto; }
.input-row textarea    { flex: 1; }

.select-typ {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b6b6b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  background-size: 14px 14px;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  padding: 8px 30px 8px 10px;
  border: 2px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text);
  height: fit-content;
}
.select-typ:focus { border-color: var(--text); box-shadow: 0 0 0 3px rgba(33,33,33,.08); outline: none; }

.timeline { list-style: none; padding: 0; }

.timeline-item {
  display: flex;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}
.timeline-item:last-child { border-bottom: none; }

.tl-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
  margin-top: 5px;
}
.tl-dot-dim { background: var(--line); }

.timeline-body { flex: 1; min-width: 0; }
.timeline-meta {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 4px;
  flex-wrap: wrap;
}
.timeline-meta strong { font-size: 14px; font-weight: 700; }
.timeline-meta .text-mute { font-size: 12px; font-variant-numeric: tabular-nums; }
.timeline-inhalt { font-size: 14px; white-space: pre-wrap; word-break: break-word; line-height: 1.5; }
.timeline-kontext { font-size: 12px; color: var(--text-mute); margin-top: 3px; }

.tl-date-wrap { display: inline-flex; align-items: center; gap: 4px; }
.btn-tl-date-edit {
  background: none; border: none; cursor: pointer;
  color: var(--line); font-size: 12px; padding: 0 2px;
  line-height: 1; opacity: 0;
  transition: opacity 120ms;
}
.timeline-item:hover .btn-tl-date-edit { opacity: 1; }
.btn-tl-date-edit:hover { color: var(--text-mute); }
.tl-date-form { display: inline-flex; align-items: center; gap: 4px; flex-wrap: nowrap; }
.tl-date-input { font-size: 12px; padding: 3px 6px; border: 1px solid var(--line); border-radius: 4px; }
.timeline-inhalt-row { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.tl-status-badge {
  display: inline-block;
  font-size: 11px; font-weight: 700;
  padding: 2px 9px; border-radius: 20px;
  margin-bottom: 4px;
}
.tl-status-badge.sb-neu         { background: #e0f2fe; color: #0369a1; }
.tl-status-badge.sb-kontaktiert { background: #fef3c7; color: #b45309; }
.tl-status-badge.sb-angebot     { background: #ede9fe; color: #6d28d9; }
.tl-status-badge.sb-gewonnen    { background: #dcfce7; color: #15803d; }
.tl-status-badge.sb-verloren    { background: #f1f5f9; color: #475569; }
.tl-delete-form { display: inline-flex; align-items: center; margin: 0; }
.btn-tl-delete {
  background: none; border: none; cursor: pointer;
  color: var(--line); font-size: 12px; padding: 0 2px;
  line-height: 1; opacity: 0;
  transition: opacity 120ms;
}
.timeline-item:hover .btn-tl-delete { opacity: 1; }
.btn-tl-delete:hover { color: #e53e3e; }

/* ─── Modal ─────────────────────────────────────────────────────────────────── */
dialog.modal {
  border: none;
  border-radius: var(--radius);
  padding: 0;
  max-width: 660px;
  width: calc(100% - 32px);
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}
dialog.modal::backdrop { background: rgba(33,33,33,.5); backdrop-filter: blur(4px); }

.modal-content {
  padding: 28px;
  position: relative;
}

.modal-heading {
  font-size: 20px;
  font-weight: 800;
  margin-bottom: 20px;
  letter-spacing: -.02em;
}

.modal-task-info {
  font-size: 13px;
  color: var(--text-mute);
  margin-bottom: 18px;
  padding: 12px 14px;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--line);
  font-weight: 500;
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: var(--line);
  border: none;
  font-size: 18px;
  cursor: pointer;
  color: var(--text-mute);
  line-height: 1;
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background 120ms, color 120ms;
}
.modal-close:hover { background: #d4d4d0; color: var(--text); }


.modal-section { margin-bottom: 18px; }
.modal-section fieldset {
  border: 2px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
}
.modal-section legend { font-weight: 700; font-size: 13px; padding: 0 6px; color: var(--text-mute); text-transform: uppercase; letter-spacing: .06em; }

.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  padding-top: 18px;
  border-top: 2px solid var(--line);
  margin-top: 18px;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-weight: 500;
  font-size: 14px;
  text-transform: none;
  letter-spacing: 0;
}
.checkbox-label input { width: auto; cursor: pointer; accent-color: var(--accent); width: 16px; height: 16px; }

/* ─── Login ──────────────────────────────────────────────────────────────────── */
.login-body {
  background: radial-gradient(ellipse at 60% 0%, rgba(186,216,57,.25) 0%, transparent 60%),
              var(--bg);
  display: flex;
  min-height: 100vh;
  align-items: center;
}
.login-wrap { width: 100%; padding: 20px; }
.login-box {
  max-width: 400px;
  margin: 0 auto;
  background: var(--surface);
  border-radius: var(--radius-xl);
  padding: 44px 40px;
  box-shadow: var(--shadow-lg);
}
.login-logo { margin-bottom: 32px; }
.login-logo-img { display: block; width: 140px; max-width: 100%; height: auto; margin: 0 auto; }
.login-box .btn-block {
  margin-top: 10px;
  padding: 14px 20px;
  font-size: 15px;
  border-radius: var(--radius-xl);
}

/* ─── Erledigen-Seite ────────────────────────────────────────────────────────── */
.task-info-card {
  background: linear-gradient(135deg, var(--accent-light), var(--surface-2));
  border-color: rgba(186,216,57,.4) !important;
}
.task-info-lead  { font-weight: 700; font-size: 15px; color: var(--text-mute); }
.task-info-titel { font-size: 22px; font-weight: 800; margin-top: 6px; letter-spacing: -.02em; }
.task-info-notiz { font-size: 13px; color: var(--text-mute); margin-top: 10px; white-space: pre-wrap; }
.task-info-due   { font-size: 13px; margin-top: 10px; font-weight: 600; }
.task-info-due.overdue   { color: var(--overdue); }
.task-info-due.due-today { color: var(--due-today); }

.neue-anfrage-card { border-style: dashed; border-color: rgba(186,216,57,.35); }

/* ─── Autocomplete-Dropdown ──────────────────────────────────────────────────── */
.ac-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 200;
  background: var(--surface);
  border: 2px solid var(--line);
  border-top: none;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  list-style: none;
  margin: 0;
  padding: 4px 0;
  box-shadow: var(--shadow);
  max-height: 220px;
  overflow-y: auto;
}
.ac-dropdown li {
  padding: 9px 14px;
  font-size: 14px;
  cursor: pointer;
  color: var(--text);
}
.ac-dropdown li:hover,
.ac-dropdown li.ac-active { background: var(--bg); }

/* ─── Zusatzinfos ────────────────────────────────────────────────────────────── */
.zusatz-block { margin-bottom: 20px; }
.zusatz-block:last-child { margin-bottom: 0; }
.zusatz-block + .zusatz-block { padding-top: 18px; border-top: 1px solid var(--border); }
.zusatz-block-label {
  font-size: 14px; font-weight: 600; color: var(--text);
  margin-bottom: 12px; padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

/* File list */
.file-list { list-style: none; display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }
.file-item {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 10px; border-radius: var(--radius);
  background: var(--surface); font-size: 13px;
}
.file-item-link {
  display: flex; align-items: center; gap: 7px;
  color: var(--text); text-decoration: none; flex: 1; min-width: 0;
}
.file-item-link:hover .file-item-name { text-decoration: underline; }
.file-item-icon { width: 14px; height: 14px; flex-shrink: 0; color: var(--text-mute); }
.file-item-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-item-size { font-size: 11px; color: var(--text-mute); flex-shrink: 0; margin-left: auto; margin-right: 6px; }
.file-delete-form { flex-shrink: 0; }
.btn-file-delete {
  background: none; border: none; cursor: pointer;
  color: var(--text-mute); font-size: 12px; padding: 2px 4px; line-height: 1;
}
.btn-file-delete:hover { color: #e53e3e; }

/* Notiz – stacked variant */
.notiz-form-stack { display: flex; flex-direction: column; gap: 8px; }
.notiz-textarea-full { width: 100%; resize: vertical; }
.notiz-actions { display: flex; justify-content: flex-end; }

/* Upload form */
.file-upload-form {
  display: flex; align-items: center; gap: 10px;
  margin-top: 12px; padding-top: 12px;
  border-top: 1px solid var(--border);
}
.file-upload-label {
  flex: 1;
  display: flex; align-items: center; gap: 8px;
  padding: 9px 14px; border: 1.5px dashed var(--accent); border-radius: var(--radius);
  cursor: pointer; font-size: 13px; color: var(--text-mute);
  background: var(--bg); transition: border-color 150ms, background 150ms, color 150ms;
  min-width: 0;
}
.file-upload-label:hover { background: var(--surface); color: var(--accent); }
.file-upload-icon { width: 14px; height: 14px; flex-shrink: 0; color: var(--accent); }
.file-upload-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-upload-text.file-selected { color: var(--text); font-weight: 500; }
.file-upload-input { display: none; }

/* Lead-Karte: Paperclip-Indikator */
.lead-card-files { display: flex; align-items: center; flex-shrink: 0; }
.lead-files-icon { width: 13px; height: 13px; color: var(--text-mute); }

/* Umsatz-Tabelle */
.umsatz-table {
  width: 100%; border-collapse: collapse; font-size: 13px; margin-bottom: 14px;
}
.umsatz-table th {
  text-align: left; font-size: 11px; font-weight: 600; letter-spacing: 0.05em;
  text-transform: uppercase; color: var(--text-mute);
  padding: 0 8px 6px; border-bottom: 1px solid var(--border);
}
.umsatz-table th.umsatz-betrag,
.umsatz-table td.umsatz-betrag { text-align: right; }
.umsatz-table tbody tr:hover { background: var(--surface-2); }
.umsatz-table tbody td { padding: 7px 8px; border-bottom: 1px solid var(--line); }
.umsatz-datum { color: var(--text-mute); white-space: nowrap; }
.umsatz-actions { width: 28px; text-align: center; }
.umsatz-delete-form { margin: 0; }
.umsatz-total-row td {
  padding: 8px 8px 2px; border-top: 2px solid var(--border); border-bottom: none;
}

/* Umsatz Hinzufügen-Formular */
.umsatz-add-form {
  padding-top: 12px; border-top: 1px solid var(--border);
}
.umsatz-form-row {
  display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
}
.umsatz-input-bezeichnung { flex: 2; min-width: 140px; }
.umsatz-input-datum        { flex: 1; min-width: 130px; }
.umsatz-input-betrag       { flex: 1; min-width: 90px; max-width: 120px; text-align: right; }

/* ─── Papierkorb ─────────────────────────────────────────────────────────────── */
.papierkorb-hint { margin-top: 20px; font-size: 13px; }
.papierkorb-hint a { color: var(--text-mute); }

/* ─── Hilfselemente ──────────────────────────────────────────────────────────── */
.sep { border: none; border-top: 2px solid var(--line); margin: 18px 0; }

.text-mute { color: var(--text-mute); }
.tabnum    { font-variant-numeric: tabular-nums; }

.empty-state {
  color: var(--text-mute);
  font-size: 15px;
  padding: 40px 0;
  text-align: center;
}
.empty-state a { color: var(--text); font-weight: 600; text-decoration: underline; }

.overdue   { color: var(--overdue); }
.due-today { color: var(--due-today); }

.alert { padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: 12px; font-size: 14px; font-weight: 500; }
.alert-warn { background: #fef9c3; color: #854d0e; border: 2px solid #fde68a; }

.js-hide { display: none; }

/* ─── Kunden ─────────────────────────────────────────────────────────────────── */
.kunden-overdue-section {
  background: #fff1f2;
  border: 1px solid #fca5a5;
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 32px;
}
.kunden-recontact-section {
  border: 1px solid #fcd34d;
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 32px;
}
@media (prefers-color-scheme: dark) {
  .kunden-overdue-section  { background: #200000; border-color: #7f1d1d; }
  .kunden-card-overdue     { background: #3d0000 !important; }
  .kunden-recontact-section { background: #1c1600; border-color: #6b4f00; }
  .kunden-card-alert { background: #2e2200 !important; }
}
.kunden-section { margin-bottom: 32px; }
.kunden-month-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-mute);
  text-transform: uppercase;
  letter-spacing: .08em;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.kunden-grid { display: flex; flex-direction: column; gap: 6px; }
.kunden-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 16px;
  text-decoration: none;
  color: var(--text);
  transition: border-color 150ms, box-shadow 150ms;
}
.kunden-card:hover { border-color: #aaaaaa; box-shadow: var(--shadow); text-decoration: none; }
.kunden-card-alert   { background: #fef3c7; }
.kunden-card-overdue { background: #ffe4e6; }
.kunden-card-top { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.kunden-card-name { font-weight: 700; font-size: 15px; }
.kunden-card-firma { font-size: 13px; color: var(--text-mute); }
.kunden-card-bottom { display: flex; align-items: center; gap: 16px; flex-shrink: 0; font-size: 12px; }
.kc-meta { display: inline-flex; align-items: center; gap: 3px; color: var(--text-mute); }
.kc-icon { width: 12px; height: 12px; flex-shrink: 0; }
.kc-owner { color: var(--text-mute); }

/* ─── Responsive Fine-Tuning ─────────────────────────────────────────────────── */
@media (max-width: 480px) {
  .next-step-bar-inner { gap: 8px; }
  .lead-head { flex-direction: column; }
  .lead-head-meta { align-items: flex-start; }
  .login-box { padding: 28px 20px; }
  .modal-content { padding: 20px; }
}
