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

:root {
  --brand: #C94A1A;
  --brand-light: #e8673a;
  --brand-dark: #a33c15;
  --bg: #f5f5f5;
  --card: #ffffff;
  --text: #1a1a1a;
  --text-muted: #6b7280;
  --border: #e5e7eb;
  --success: #16a34a;
  --warning: #f59e0b;
  --danger: #dc2626;
  --info: #2563eb;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(0,0,0,0.08);
}

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  max-width: 480px;
  margin: 0 auto;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  -webkit-tap-highlight-color: transparent;
}

/* ==================== LOGIN SCREEN ==================== */
.login-screen {
  position: fixed;
  inset: 0;
  background: linear-gradient(135deg, var(--brand-dark) 0%, var(--brand) 50%, var(--brand-light) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.login-container {
  text-align: center;
  padding: 20px;
  width: 100%;
  max-width: 320px;
}

.login-logo { font-size: 3rem; margin-bottom: 8px; }
.login-title { color: white; font-size: 1.5rem; font-weight: 700; margin-bottom: 4px; }
.login-subtitle { color: rgba(255,255,255,0.8); font-size: 0.9rem; margin-bottom: 28px; transition: all 0.3s; }

/* PIN Dots */
.pin-dots {
  display: flex;
  justify-content: center;
  gap: 14px;
  margin-bottom: 8px;
}
.pin-dot {
  width: 16px; height: 16px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.5);
  background: transparent;
  transition: background 0.15s, border-color 0.15s, transform 0.15s;
}
.pin-dot.filled {
  background: white;
  border-color: white;
  transform: scale(1.1);
}

.pin-error {
  color: #fecaca;
  font-size: 0.8rem;
  min-height: 24px;
  line-height: 24px;
  margin-bottom: 12px;
}

/* PIN Keypad */
.pin-keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  max-width: 280px;
  margin: 0 auto;
}
.pin-key {
  width: 72px; height: 72px;
  border-radius: 50%;
  border: none;
  background: rgba(255,255,255,0.15);
  color: white;
  font-family: inherit;
  font-size: 1.5rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
  transition: background 0.15s, transform 0.1s;
  -webkit-tap-highlight-color: transparent;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.pin-key:active {
  background: rgba(255,255,255,0.3);
  transform: scale(0.93);
}
.pin-key-empty {
  background: transparent !important;
  box-shadow: none !important;
  pointer-events: none;
}
.pin-key-delete {
  font-size: 1.3rem;
  background: rgba(255,255,255,0.08);
  box-shadow: none;
}

/* Shake animation */
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-10px); }
  40% { transform: translateX(10px); }
  60% { transform: translateX(-6px); }
  80% { transform: translateX(6px); }
}
.pin-shake { animation: shake 0.4s ease; }

/* ==================== HEADER ==================== */
.header {
  background: var(--brand);
  color: white;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}
.header h1 { font-size: 1.2rem; font-weight: 700; }
.header-logo { cursor: pointer; -webkit-tap-highlight-color: transparent; }
.header-logo:active { opacity: 0.7; }
.header-right {
  display: flex;
  align-items: center;
  gap: 10px;
}
.status-dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--success);
  flex-shrink: 0;
}
.status-dot.offline { background: var(--danger); }

.header-user {
  display: flex;
  align-items: center;
  gap: 4px;
  background: rgba(255,255,255,0.15);
  border: none;
  color: white;
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 500;
  padding: 6px 10px;
  border-radius: 20px;
  cursor: pointer;
  transition: background 0.2s;
}
.header-user:active { background: rgba(255,255,255,0.25); }
.header-user-arrow { font-size: 0.6rem; }

/* User Menu Dropdown */
.user-menu {
  position: fixed;
  top: 56px;
  right: max(calc((100% - 480px) / 2 + 8px), 8px);
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: 0 4px 20px rgba(0,0,0,0.15);
  z-index: 150;
  overflow: hidden;
  opacity: 0;
  transform: translateY(-8px) scale(0.95);
  pointer-events: none;
  transition: opacity 0.15s, transform 0.15s;
}
.user-menu.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}
.user-menu-item {
  display: block;
  width: 100%;
  padding: 12px 20px;
  border: none;
  background: none;
  font-family: inherit;
  font-size: 0.85rem;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s;
}
.user-menu-item:hover { background: var(--bg); }
.user-menu-danger { color: var(--danger); }

/* ==================== CONTENT ==================== */
.content {
  flex: 1;
  padding: 16px;
  padding-bottom: 80px;
  overflow-y: auto;
}

/* ==================== TAB BAR ==================== */
.tab-bar {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  background: var(--card);
  display: flex;
  border-top: 1px solid var(--border);
  padding: 6px 0 env(safe-area-inset-bottom, 8px);
  z-index: 100;
}
.tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px 4px;
  border: none;
  background: none;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.65rem;
  font-weight: 500;
  cursor: pointer;
  transition: color 0.2s;
}
.tab.active { color: var(--brand); }
.tab-icon { font-size: 1.3rem; }

/* ==================== CARDS ==================== */
.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
}
.card h3 { font-size: 0.95rem; font-weight: 600; margin-bottom: 8px; }
.card p { font-size: 0.85rem; color: var(--text-muted); }

/* ==================== BUTTONS ==================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 18px;
  border: none;
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
  min-height: 44px;
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--brand); color: white; }
.btn-primary:hover { background: var(--brand-light); }
.btn-secondary { background: var(--border); color: var(--text); }
.btn-small { padding: 6px 12px; font-size: 0.75rem; min-height: 36px; }
.btn-full { width: 100%; }
.btn-icon {
  width: 40px; height: 40px; padding: 0;
  border-radius: 50%; font-size: 1.1rem;
  border: 1px solid var(--border);
  background: var(--card);
  cursor: pointer;
}

/* ==================== FORMS ==================== */
.form-group { margin-bottom: 12px; }
.form-group label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: 4px;
  color: var(--text-muted);
}
.form-input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.9rem;
  background: var(--card);
  transition: border-color 0.2s;
}
.form-input:focus { outline: none; border-color: var(--brand); }
textarea.form-input { resize: vertical; min-height: 80px; }
select.form-input { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b7280' d='M6 8L1 3h10z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 32px; }

/* ==================== STATUS BADGES ==================== */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
}
.badge-offen { background: #dbeafe; color: #1d4ed8; }
.badge-beworben { background: #fef3c7; color: #92400e; }
.badge-bestaetigt { background: #d1fae5; color: #065f46; }
.badge-abgelehnt { background: #fee2e2; color: #991b1b; }
.badge-abgeschlossen { background: #e5e7eb; color: #374151; }
.badge-vormerken_naechstes_jahr { background: #ede9fe; color: #6d28d9; }

/* ==================== CONTACT BUTTONS ==================== */
.contact-btns { display: flex; gap: 8px; margin-top: 8px; }
.contact-btns a {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 500;
  text-decoration: none;
  color: white;
}
.contact-mail { background: var(--info); }
.contact-tel { background: var(--success); }
.contact-wa { background: #25d366; }

/* ==================== SEARCH ==================== */
.search-row { display: flex; gap: 8px; margin-bottom: 16px; }
.search-row .form-input { flex: 1; }

/* ==================== KI CHAT ==================== */
.ki-messages {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
  max-height: 55vh;
  overflow-y: auto;
}
.ki-msg {
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 0.85rem;
  line-height: 1.5;
  max-width: 85%;
  word-break: break-word;
  white-space: pre-wrap;
}
.ki-msg.user {
  background: var(--brand);
  color: white;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}
.ki-msg.assistant {
  background: var(--card);
  border: 1px solid var(--border);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}
.ki-input-row {
  display: flex;
  gap: 8px;
  position: sticky;
  bottom: 0;
  background: var(--bg);
  padding: 8px 0;
}
.ki-input-row .form-input { flex: 1; }
.ki-quick-btns { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }

/* ==================== TIMELINE ==================== */
.timeline { margin-top: 12px; }
.timeline-item {
  display: flex;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.8rem;
  align-items: baseline;
}
.timeline-item:last-child { border-bottom: none; }
.timeline-type { font-weight: 600; min-width: 60px; color: var(--brand); }
.timeline-date { color: var(--text-muted); min-width: 70px; }

/* ==================== STATS ==================== */
.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 16px;
}
.stat-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 14px;
  text-align: center;
  box-shadow: var(--shadow);
}
.stat-value { font-size: 1.5rem; font-weight: 700; color: var(--brand); }
.stat-label { font-size: 0.7rem; color: var(--text-muted); margin-top: 2px; }

/* ==================== STARS ==================== */
.stars { display: inline-flex; gap: 2px; cursor: pointer; }
.stars span { font-size: 1.2rem; opacity: 0.3; }
.stars span.active { opacity: 1; }

/* ==================== MODAL ==================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 200;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.modal {
  background: var(--card);
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  border-radius: 16px 16px 0 0;
  padding: 20px;
  overflow-y: auto;
  animation: slideUp 0.25s ease;
}
@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}
.modal-header h2 { font-size: 1.1rem; }
.modal-close {
  width: 32px; height: 32px;
  border: none; background: var(--border);
  border-radius: 50%; font-size: 1.1rem;
  cursor: pointer; display: flex;
  align-items: center; justify-content: center;
}

/* ==================== BEWERBUNG MODAL ==================== */
.bewerbung-modal { max-width: 540px; }
.bew-status-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.bew-status-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
  color: white;
  text-transform: capitalize;
}
.bew-frist-badge {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
  background: var(--border);
  color: var(--text-muted);
}
.bew-frist-badge--ok { background: #dcfce7; color: #166534; }
.bew-frist-badge--warn { background: #fef3c7; color: #92400e; }
.bew-frist-badge--urgent { background: #fee2e2; color: #991b1b; }
.bew-frist-badge--expired { background: #dc2626; color: white; }

.bew-tab-bar {
  display: flex;
  border-bottom: 2px solid var(--border);
  margin-bottom: 12px;
  gap: 0;
}
.bew-tab {
  flex: 1;
  padding: 8px 4px;
  border: none;
  background: none;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: color 0.15s, border-color 0.15s;
  text-align: center;
}
.bew-tab.active {
  color: var(--brand);
  border-bottom-color: var(--brand);
  font-weight: 600;
}

#bewerbungTabContent {
  max-height: 55vh;
  overflow-y: auto;
  padding: 4px 0;
}

.bew-contact-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}
.bew-contact-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 500;
  text-decoration: none;
  transition: transform 0.1s, box-shadow 0.15s;
}
.bew-contact-btn:active { transform: scale(0.96); }
.bew-contact-btn--tel { background: #dcfce7; color: #166534; }
.bew-contact-btn--email { background: #dbeafe; color: #1e40af; }
.bew-contact-btn--wa { background: #d1fae5; color: #065f46; }
.bew-contact-btn--web { background: #f3e8ff; color: #6b21a8; }

.bew-ki-quick-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}

.bew-ki-messages {
  max-height: 40vh;
  overflow-y: auto;
  padding: 8px 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.bew-ki-msg {
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 0.85rem;
  line-height: 1.5;
  max-width: 90%;
  white-space: pre-wrap;
  word-break: break-word;
}
.bew-ki-msg.user {
  background: var(--brand);
  color: white;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}
.bew-ki-msg.assistant {
  background: var(--card);
  border: 1px solid var(--border);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}

.bew-mail-card {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  margin-top: 8px;
  max-width: 90%;
}
.bew-mail-card.sent {
  opacity: 0.7;
  border-color: var(--success);
}

.bew-timeline-item {
  display: flex;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.82rem;
  align-items: baseline;
  flex-wrap: wrap;
}
.bew-timeline-item:last-child { border-bottom: none; }

.bew-footer {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

/* ==================== LOADING ==================== */
.loading {
  display: inline-block;
  width: 18px; height: 18px;
  border: 2px solid var(--border);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ==================== EMPTY STATE ==================== */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
}
.empty-state .icon { font-size: 2.5rem; margin-bottom: 12px; }

/* ==================== SETTINGS ==================== */
.settings-section { margin-bottom: 8px; }
.settings-section h3 { font-size: 1rem; font-weight: 600; }

/* --- Anlagen --- */
.anl-thumb { width: 48px; height: 48px; border-radius: 6px; overflow: hidden; flex-shrink: 0; display: flex; align-items: center; justify-content: center; background: var(--bg-card); }
.anl-icon { font-size: 1.6rem; line-height: 1; }
.anl-card .btn-small { min-width: 32px; padding: 4px 6px; font-size: 0.8rem; }

/* --- Bewerbung Anlagen Zuordnung --- */
.bew-anlagen-section { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); }
.bew-anlagen-list { display: flex; flex-direction: column; gap: 4px; }
.bew-anlage-item { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 8px; background: var(--bg-secondary); border-radius: 6px; font-size: 0.85rem; }
.bew-anlage-item .btn-small { min-width: 28px; padding: 2px 6px; font-size: 0.8rem; flex-shrink: 0; }

/* --- Business-Profil bigger fields --- */
.bp-label { font-size: 0.95rem !important; font-weight: 700 !important; color: var(--text) !important; }
.bp-field { margin-bottom: 20px !important; }
.bp-input { padding: 12px !important; font-size: 1rem !important; }
.bp-textarea { min-height: 80px; resize: vertical; line-height: 1.5; }
.bp-row-2col { display: flex; gap: 16px; }
.bp-row-2col > .form-group { flex: 1; }

.user-card { padding: 12px 16px; }

/* ==================== AUDIT LOG ==================== */
.audit-list { max-height: 50vh; overflow-y: auto; }
.audit-entry {
  display: flex;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.75rem;
  font-family: 'DM Sans', monospace;
  line-height: 1.4;
  align-items: baseline;
}
.audit-entry:last-child { border-bottom: none; }
.audit-ts { color: var(--text-muted); min-width: 110px; flex-shrink: 0; }
.audit-user { color: var(--brand); font-weight: 600; min-width: 70px; flex-shrink: 0; }
.audit-detail { color: var(--text); }

/* ==================== EVENT CARDS ==================== */
.event-card-header {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 8px;
}

/* Event three-dot menu */
.event-menu-wrap { position: relative; flex-shrink: 0; }
.event-menu-btn {
  width: 32px; height: 32px;
  border: none; background: none;
  font-size: 1.2rem; color: var(--text-muted);
  cursor: pointer; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s;
}
.event-menu-btn:active { background: var(--border); }
.event-menu {
  position: absolute; right: 0; top: 100%;
  background: var(--card); border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.15);
  overflow: hidden; z-index: 50;
  opacity: 0; transform: scale(0.9);
  pointer-events: none;
  transition: opacity 0.12s, transform 0.12s;
  min-width: 140px;
}
.event-menu.open {
  opacity: 1; transform: scale(1);
  pointer-events: auto;
}
.event-menu button {
  display: block; width: 100%;
  padding: 10px 16px; border: none; background: none;
  font-family: inherit; font-size: 0.85rem;
  text-align: left; cursor: pointer;
  transition: background 0.12s;
}
.event-menu button:hover { background: var(--bg); }
.event-menu button.danger { color: var(--danger); }

/* Source badges */
.quelle-badge {
  display: inline-block;
  padding: 2px 8px; border-radius: 12px;
  font-size: 0.65rem; font-weight: 600;
  text-transform: uppercase;
}
.quelle-stamm { background: var(--border); color: var(--text-muted); }
.quelle-manuell { background: #dbeafe; color: #1d4ed8; }
.quelle-ki { background: #ede9fe; color: #6d28d9; }

/* Tag chips (edit modal) */
.tag-chips {
  display: flex; flex-wrap: wrap; gap: 6px;
}
.tag-chip {
  display: inline-flex; align-items: center;
  padding: 4px 10px; border-radius: 16px;
  font-size: 0.75rem; font-weight: 500;
  background: var(--border); color: var(--text-muted);
  cursor: pointer; user-select: none;
  transition: background 0.15s, color 0.15s;
}
.tag-chip input { display: none; }
.tag-chip.active { background: var(--brand); color: white; }

/* KI event suggestion cards */
.ki-event-card { border-left: 3px solid #6d28d9; }

/* KI Action Cards */
.ki-action-card { border-left: 4px solid var(--brand); background: var(--card); border-radius: var(--radius); padding: 12px; margin-top: 8px; max-width: 85%; box-shadow: var(--shadow); }
.ki-action-header { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 0.85rem; margin-bottom: 6px; }
.ki-action-body { font-size: 0.8rem; color: var(--text-muted); line-height: 1.4; margin-bottom: 10px; }
.ki-action-body strong { color: var(--text); }
.ki-action-btns { display: flex; gap: 8px; }
.ki-action-card[data-action-type="create_event"] { border-left-color: #6d28d9; }
.ki-action-card[data-action-type="create_bewerbung"] { border-left-color: var(--info); }
.ki-action-card[data-action-type="update_bewerbung_status"] { border-left-color: var(--warning); }
.ki-action-card[data-action-type="add_note"] { border-left-color: var(--success); }
.ki-action-card[data-action-type="add_communication"] { border-left-color: #0891b2; }
.ki-action-card[data-action-type="compose_message"] { border-left-color: #db2777; }
.ki-action-done { opacity: 0.7; border-left-color: var(--success) !important; }
.ki-action-error { border-left-color: var(--danger) !important; }
.ki-action-dismissed { opacity: 0; transition: opacity 0.3s; }
.ki-action-duplicate { opacity: 0.6; border-left-color: var(--warning) !important; }
/* Card content rows */
.ki-card-meta { font-size: 0.8rem; margin: 4px 0; }
.ki-card-row { font-size: 0.78rem; margin: 3px 0; line-height: 1.4; }
.ki-card-row a { color: var(--info); text-decoration: none; }
.ki-card-row a:hover { text-decoration: underline; }
.ki-card-dim { color: var(--text-muted); font-style: italic; }
.ki-card-tip { color: #6d28d9; font-weight: 500; }
.ki-card-warn { color: var(--warning); }
.ki-card-expired { color: var(--danger); text-decoration: line-through; }
.ki-action-bulk { margin: 8px 0; max-width: 85%; }
/* KI Action Score Badge (top-right style) */
.ki-score-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.7rem;
  font-weight: 700;
  margin-left: auto;
  flex-shrink: 0;
}
.ki-score-badge.score-unknown { background: #e5e7eb; color: #6b7280; }
/* Sorting toolbar */
.ki-action-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: var(--card);
  border-radius: var(--radius);
  margin: 8px 0;
  max-width: 85%;
  box-shadow: var(--shadow);
}
.ki-action-toolbar-info {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text);
}
.ki-action-toolbar-btns { display: flex; gap: 4px; }
.ki-sort-btn.active { background: var(--brand); color: white; }
.ki-bulk-top { margin-left: auto; }
.ki-action-body pre { white-space: pre-wrap; font-size: 0.75rem; background: var(--bg); padding: 8px; border-radius: 6px; margin-top: 6px; max-height: 120px; overflow-y: auto; }

/* Toast notifications */
.toast {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 500;
  color: white;
  z-index: 10000;
  opacity: 0;
  transition: opacity 0.3s, transform 0.3s;
  pointer-events: none;
  max-width: 90vw;
  text-align: center;
}
.toast-visible { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast-success { background: var(--success); }
.toast-error { background: var(--danger); }
.toast-info { background: var(--info); }
.toast-warning { background: var(--warning); color: #1a1a1a; }

/* ==================== EVENT BEWERBUNG BADGES ==================== */
.event-badges-col {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  flex-shrink: 0;
}
.event-bewerbung-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 0.7rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.1s, box-shadow 0.15s;
}
.event-bewerbung-badge:active { transform: scale(0.95); }
.event-bewerbung-badge--offen { background: #dbeafe; color: #1e40af; }
.event-bewerbung-badge--beworben { background: #fef3c7; color: #92400e; }
.event-bewerbung-badge--bestaetigt { background: #d1fae5; color: #065f46; }
.event-bewerbung-badge--abgelehnt { background: #fee2e2; color: #991b1b; }
.event-bewerbung-badge--abgeschlossen { background: #e5e7eb; color: #4b5563; }

/* ==================== SCORE BADGES ==================== */
.score-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.7rem;
  font-weight: 700;
  vertical-align: middle;
  margin-left: 6px;
}
.score-high { background: #d1fae5; color: #065f46; }
.score-mid { background: #fef3c7; color: #92400e; }
.score-low { background: #fee2e2; color: #991b1b; }

/* ==================== RESEARCH DETAIL ==================== */
.event-research-info {
  font-size: 0.7rem !important;
  color: var(--info) !important;
  margin-top: 2px;
}

.research-score-grid { margin: 12px 0; }
.research-score-dim {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  font-size: 0.8rem;
}
.research-score-dim > span:first-child { min-width: 90px; font-weight: 500; }
.research-score-dim > span:last-child { min-width: 35px; text-align: right; font-weight: 600; }
.research-score-bar {
  flex: 1;
  height: 8px;
  background: var(--border);
  border-radius: 4px;
  overflow: hidden;
}
.research-score-bar > div {
  height: 100%;
  border-radius: 4px;
  transition: width 0.3s;
}

.research-field {
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}
.research-field:last-child { border-bottom: none; }
.research-field-label {
  display: block;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 2px;
}
.research-field-value {
  display: block;
  font-size: 0.85rem;
}
.research-field-source {
  display: block;
  font-size: 0.65rem;
  color: var(--info);
  margin-top: 2px;
  word-break: break-all;
}
.research-unknown {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-style: italic;
}

/* ==================== KI CONFIG & USAGE ==================== */
.ki-config-row { margin-bottom: 16px; }
.ki-config-row label.bp-label { margin-bottom: 6px; }

.ki-budget-section { margin-bottom: 4px; }
.ki-budget-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.ki-budget-label { font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted); }
.ki-budget-value { font-size: 0.85rem; font-weight: 600; }
.ki-budget-pct { font-size: 0.75rem; font-weight: 700; text-align: right; margin-top: 2px; }

.ki-usage-bar { width: 100%; height: 10px; background: var(--border); border-radius: 5px; overflow: hidden; }
.ki-usage-bar-fill { height: 100%; border-radius: 5px; transition: width 0.4s ease; min-width: 2px; }

.ki-usage-list { max-height: 40vh; overflow-y: auto; }
.ki-usage-item {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px;
  padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 0.8rem;
}
.ki-usage-item:last-child { border-bottom: none; }
.ki-usage-date { color: var(--text-muted); min-width: 100px; font-size: 0.75rem; }
.ki-usage-user { color: var(--brand); font-weight: 600; min-width: 60px; }
.ki-usage-endpoint { background: var(--bg); padding: 1px 6px; border-radius: 4px; font-size: 0.7rem; font-weight: 500; }
.ki-usage-model { color: var(--text-muted); font-size: 0.7rem; }
.ki-usage-tokens { font-size: 0.7rem; color: var(--text-muted); }
.ki-usage-extras { color: var(--success); font-weight: 500; }
.ki-usage-cost { margin-left: auto; font-weight: 600; font-variant-numeric: tabular-nums; }
.ki-usage-context { width: 100%; font-size: 0.72rem; color: var(--text-muted); font-style: italic; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cost-toast { z-index: 100001; }

/* ==================== KALENDER ==================== */
.cal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 20px;
}
.cal-nav {
  display: flex;
  align-items: center;
  gap: 12px;
}
.cal-title {
  font-size: 1.1rem;
  font-weight: 700;
  min-width: 140px;
  text-align: center;
}
.cal-zoom {
  display: flex;
  gap: 4px;
}
.cal-zoom-btn {
  background: var(--border);
  color: var(--text-muted);
  border: none;
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.cal-zoom-btn.active {
  background: var(--brand);
  color: white;
}
.cal-nav-btn {
  white-space: nowrap;
}

/* --- Year Grid --- */
.cal-year-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.cal-mini-month {
  background: var(--card);
  border-radius: var(--radius);
  padding: 12px;
  box-shadow: var(--shadow);
}
.cal-mini-month-name {
  font-size: 0.85rem;
  font-weight: 700;
  margin-bottom: 6px;
  cursor: pointer;
  color: var(--text);
  transition: color 0.15s;
}
.cal-mini-month-name:hover {
  color: var(--brand);
}
.cal-mini-header {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
  margin-bottom: 2px;
}
.cal-mini-hd {
  font-size: 0.55rem;
  font-weight: 600;
  color: var(--text-muted);
  text-align: center;
}
.cal-mini-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
}
.cal-mini-day {
  width: 100%;
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.55rem;
  border-radius: 3px;
  cursor: pointer;
  transition: transform 0.1s;
  position: relative;
  color: var(--text);
}
.cal-mini-day:hover { transform: scale(1.3); z-index: 2; }
.cal-mini-empty { cursor: default; }
.cal-mini-empty:hover { transform: none; }
.cal-mini-weekend {
  background: rgba(0,0,0,0.03);
}
.cal-mini-friday {
  background: rgba(245,158,11,0.06);
}
.cal-mini-today {
  font-weight: 700;
  box-shadow: inset 0 0 0 1.5px var(--brand);
}
.cal-mini-status {
  color: white;
  font-weight: 700;
}
.cal-mini-bestaetigt { background: #10b981; }
.cal-mini-beworben { background: #f59e0b; color: #1a1a1a; }
.cal-mini-offen { background: #3b82f6; }
.cal-mini-no-bewerbung { background: #8b5cf6; }
.cal-mini-abgelehnt { background: #ef4444; }
.cal-mini-abgeschlossen { background: #6b7280; }
.cal-mini-vormerken_naechstes_jahr { background: #8b5cf6; }

/* Multi-event indicator on mini-day */
.cal-mini-multi::before {
  content: '';
  position: absolute;
  bottom: 1px;
  right: 1px;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: white;
  box-shadow: 0 0 1px rgba(0,0,0,0.5);
}

/* --- Month Grid --- */
.cal-month-grid {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  margin-bottom: 20px;
}
.cal-month-header {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.cal-month-hd {
  padding: 8px 4px;
  font-size: 0.75rem;
  font-weight: 700;
  text-align: center;
  color: var(--text-muted);
}
.cal-month-row {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
}
.cal-month-cell {
  min-height: 70px;
  border-bottom: 1px solid var(--border);
  border-right: 1px solid var(--border);
  padding: 4px;
  position: relative;
  overflow: hidden;
}
.cal-month-cell:nth-child(7n) { border-right: none; }
.cal-month-row:last-child .cal-month-cell { border-bottom: none; }
.cal-month-empty { background: var(--bg); opacity: 0.5; }
.cal-month-weekend { background: rgba(0,0,0,0.02); }
.cal-month-friday { background: rgba(245,158,11,0.04); }
.cal-month-today { box-shadow: inset 0 0 0 2px var(--brand); }
.cal-month-day-num {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  display: block;
  margin-bottom: 2px;
}

/* --- Event blocks in month view --- */
.cal-event-block {
  padding: 4px 6px;
  border-radius: 4px;
  margin-bottom: 2px;
  cursor: pointer;
  transition: transform 0.1s, box-shadow 0.1s;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  white-space: normal;
  word-wrap: break-word;
  max-height: 36px;
  line-height: 1.2;
}
.cal-event-block:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}
.cal-event-name {
  font-size: 0.7rem;
  font-weight: 600;
  display: inline;
  color: var(--text);
}
.cal-event-star {
  color: #f59e0b;
  margin-right: 2px;
}
.cal-event-day {
  font-weight: 400;
  opacity: 0.7;
  font-size: 0.6rem;
}

/* --- Tooltip --- */
.cal-tooltip {
  position: absolute;
  background: var(--card);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.15);
  padding: 12px;
  min-width: 240px;
  max-width: 320px;
  font-size: 0.8rem;
  line-height: 1.4;
  z-index: 1000;
  pointer-events: none;
  border: 1px solid var(--border);
}
.cal-tooltip-title {
  font-weight: 700;
  margin-bottom: 6px;
}
.cal-tooltip-row {
  display: flex;
  justify-content: space-between;
  margin: 3px 0;
  gap: 12px;
}
.cal-tooltip-row-label {
  color: var(--text-muted);
  white-space: nowrap;
}

/* --- Legend --- */
.cal-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 20px;
  padding: 12px;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.cal-legend-item {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.75rem;
  color: var(--text-muted);
}
.cal-legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  flex-shrink: 0;
}

/* --- Gap warnings --- */
.cal-gaps-section {
  background: var(--card);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  border-left: 4px solid var(--warning);
}
.cal-gaps-title {
  font-size: 0.9rem;
  font-weight: 700;
  margin-bottom: 12px;
  color: var(--text);
}
.cal-gap-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  gap: 8px;
  flex-wrap: wrap;
}
.cal-gap-item:last-child { border-bottom: none; }
.cal-gap-dates {
  font-size: 0.85rem;
  font-weight: 500;
}

/* ==================== BLOCKER BLOCKS ==================== */
.calendar-blocker-block {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  padding: 4px 6px;
  border-radius: 4px;
  font-size: 0.7rem;
  line-height: 1.2;
  cursor: pointer;
  margin-top: 2px;
  background: repeating-linear-gradient(
    45deg,
    rgba(239, 68, 68, 0.15),
    rgba(239, 68, 68, 0.15) 4px,
    rgba(239, 68, 68, 0.08) 4px,
    rgba(239, 68, 68, 0.08) 8px
  );
  color: var(--danger);
  border-left: 3px solid var(--danger);
  font-weight: 500;
}
.calendar-blocker-block:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}
.calendar-blocker-block[data-typ="krankheit"] {
  background: repeating-linear-gradient(45deg,
    rgba(239,68,68,0.25), rgba(239,68,68,0.25) 4px,
    rgba(239,68,68,0.12) 4px, rgba(239,68,68,0.12) 8px);
}
.calendar-blocker-block[data-typ="lager_geschlossen"] {
  background: repeating-linear-gradient(45deg,
    rgba(107,114,128,0.2), rgba(107,114,128,0.2) 4px,
    rgba(107,114,128,0.1) 4px, rgba(107,114,128,0.1) 8px);
  color: var(--text-muted);
  border-left-color: var(--text-muted);
}

/* Mini-Tag in Jahresansicht: diagonal stripes overlay */
.cal-mini-day.is-blocked {
  position: relative;
}
.cal-mini-day.is-blocked::after {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(45deg,
    rgba(0,0,0,0.15), rgba(0,0,0,0.15) 2px,
    transparent 2px, transparent 4px);
  pointer-events: none;
  border-radius: 3px;
}

/* Tag-Action-Popup (appended to body, positioned via JS) */
.day-action-popup {
  position: absolute;
  top: 0;
  left: 0;
  background: white;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.15);
  padding: 4px;
  z-index: 10000;
  min-width: 200px;
}
.day-action-popup button {
  display: block;
  width: 100%;
  text-align: left;
  padding: 10px 16px;
  border: none;
  background: none;
  cursor: pointer;
  font-size: 0.85rem;
  font-family: inherit;
  border-radius: 4px;
}
.day-action-popup button:hover { background: var(--bg); }

/* ==================== CALENDAR EVENT BLOCK VARIANTS ==================== */
.calendar-event-block--vormerken {
  border: 1.5px dashed #8b5cf6 !important;
  border-left: 3px dashed #8b5cf6 !important;
  background: rgba(139,92,246,0.08) !important;
}
.calendar-event-block--vormerken .cal-event-name { color: #6d28d9; }
.calendar-event-block--rejected {
  opacity: 0.5;
}
.calendar-event-block--rejected .cal-event-name { text-decoration: line-through; }

/* "+N mehr" indicator */
.calendar-more-indicator {
  padding: 2px 6px;
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--brand);
  cursor: pointer;
  border-radius: 4px;
  text-align: center;
  background: rgba(99,102,241,0.06);
  transition: background 0.15s;
}
.calendar-more-indicator:hover {
  background: rgba(99,102,241,0.15);
}

/* Rejected toggle */
.cal-rejected-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  color: var(--text-muted);
  cursor: pointer;
  white-space: nowrap;
  user-select: none;
}
.cal-rejected-toggle input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: var(--brand);
}

/* Day-detail-popup */
.day-detail-popup {
  position: absolute;
  top: 0;
  left: 0;
  background: var(--card);
  border-radius: 10px;
  box-shadow: 0 8px 28px rgba(0,0,0,0.18);
  z-index: 10000;
  min-width: 260px;
  max-width: 360px;
  border: 1px solid var(--border);
  overflow: hidden;
}
.day-detail-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  font-weight: 700;
  font-size: 0.85rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}
.day-detail-close {
  border: none;
  background: none;
  cursor: pointer;
  font-size: 1.1rem;
  color: var(--text-muted);
  padding: 0 4px;
  line-height: 1;
}
.day-detail-close:hover { color: var(--text); }
.day-detail-list {
  max-height: 300px;
  overflow-y: auto;
}
.day-detail-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 14px;
  cursor: pointer;
  transition: background 0.12s;
  border-bottom: 1px solid var(--border);
}
.day-detail-row:last-child { border-bottom: none; }
.day-detail-row:hover { background: var(--bg); }
.day-detail-row--rejected {
  opacity: 0.5;
}
.day-detail-row--rejected .day-detail-name { text-decoration: line-through; }
.day-detail-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 4px;
}
.day-detail-info { flex: 1; min-width: 0; }
.day-detail-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.day-detail-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 2px;
}
.day-detail-actions {
  display: flex;
  gap: 6px;
  padding: 8px 14px;
  border-top: 1px solid var(--border);
  background: var(--bg);
}
.day-detail-actions .btn { font-size: 0.75rem; }

/* ==================== EVENTS FILTER BAR ==================== */
.events-filter-bar {
  margin-bottom: 16px;
}

.quick-filter-pills {
  display: flex;
  gap: 6px;
  margin-bottom: 10px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding-bottom: 2px;
}
.quick-filter-pills::-webkit-scrollbar { display: none; }

.filter-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 14px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--card);
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.filter-pill:active { transform: scale(0.96); }
.filter-pill--active {
  background: var(--brand);
  color: white;
  border-color: var(--brand);
}

.filter-search-row {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}
.filter-search-row .form-input { flex: 1; }

/* Collapsible filter panel */
.events-filter-panel {
  display: none;
  background: var(--card);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 10px;
  box-shadow: var(--shadow);
}
.events-filter-panel--open { display: block; }

.filter-section {
  margin-bottom: 12px;
}
.filter-section-label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.filter-chip {
  padding: 5px 12px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: var(--card);
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.filter-chip:active { transform: scale(0.96); }
.filter-chip--active {
  background: var(--brand);
  color: white;
  border-color: var(--brand);
}

.filter-range-row {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.filter-range-group {
  flex: 1;
}
.filter-range-inputs {
  display: flex;
  gap: 8px;
}
.filter-range-inputs input[type="range"],
.filter-range-group > input[type="range"] {
  flex: 1;
  accent-color: var(--brand);
}

.filter-checks {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.filter-checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  cursor: pointer;
  color: var(--text);
}
.filter-checkbox input { accent-color: var(--brand); }

/* Sort buttons */
.sort-buttons {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.sort-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-right: 2px;
}
.sort-btn {
  padding: 5px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--card);
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.sort-btn:active { transform: scale(0.96); }
.sort-btn--active {
  background: var(--brand);
  color: white;
  border-color: var(--brand);
}

/* Events counter */
.events-counter {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin: 10px 0 8px;
  font-weight: 500;
}

/* Archiv link bar */
.archiv-link-bar {
  text-align: center;
  padding: 16px 0 8px;
}
.archiv-link-bar a {
  color: var(--brand);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 500;
}
.archiv-link-bar a:hover { text-decoration: underline; }

/* Archived event cards */
.event-card--archived {
  background: #f8f8f8;
  opacity: 0.85;
}
.archiv-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.65rem;
  font-weight: 600;
  background: #e5e7eb;
  color: #6b7280;
}

/* Empty state for filter results */
.events-empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
  grid-column: 1 / -1;
}
.events-empty-state .icon { font-size: 2.5rem; margin-bottom: 12px; }
.events-empty-state a {
  color: var(--brand);
  text-decoration: none;
  font-weight: 500;
}
.events-empty-state a:hover { text-decoration: underline; }

/* ==================== DASHBOARD (mobile-first) ==================== */
.dashboard-welcome {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--text);
}
.dashboard-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 20px;
}
.dashboard-stat {
  background: var(--card);
  border-radius: var(--radius);
  padding: 14px 10px;
  text-align: center;
  box-shadow: var(--shadow);
}
.dashboard-stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--brand);
}
.dashboard-stat-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 4px;
}
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}
.dashboard-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}
.dashboard-card h3 {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.dashboard-card p {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.5;
}
.dashboard-card .btn {
  margin-top: 12px;
}
.dashboard-card-item {
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.85rem;
}
.dashboard-card-item:last-child { border-bottom: none; }

/* ==================== DESKTOP LAYOUT (hidden on mobile) ==================== */
.desktop-sidebar,
.desktop-topbar { display: none; }
.desktop-content-wrapper { display: contents; }

/* ==================== DESKTOP MEDIA QUERY ==================== */
@media (min-width: 900px) {
  /* --- Body: remove mobile constraint --- */
  body {
    max-width: none;
    margin: 0;
  }

  /* --- Hide mobile header + tab-bar --- */
  .header { display: none !important; }
  .tab-bar { display: none !important; }

  /* --- App wrapper: desktop grid --- */
  #app {
    display: grid !important;
    grid-template-columns: 240px 1fr;
    grid-template-rows: 60px 1fr;
    grid-template-areas:
      "sidebar topbar"
      "sidebar main";
    min-height: 100dvh;
  }

  /* --- Desktop Sidebar --- */
  .desktop-sidebar {
    display: flex;
    flex-direction: column;
    grid-area: sidebar;
    background: var(--card);
    border-right: 1px solid var(--border);
    overflow-y: auto;
    position: sticky;
    top: 0;
    height: 100dvh;
    z-index: 50;
  }
  .sidebar-logo {
    padding: 16px 20px;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--brand);
    border-bottom: 1px solid var(--border);
    cursor: pointer;
  }
  .sidebar-logo:active { opacity: 0.7; }
  .sidebar-nav {
    display: flex;
    flex-direction: column;
    padding: 8px 0;
    flex: 1;
  }
  .sidebar-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    border: none;
    background: none;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    text-align: left;
  }
  .sidebar-item:hover {
    background: var(--bg);
    color: var(--text);
  }
  .sidebar-item.active {
    color: var(--brand);
    background: rgba(201, 74, 26, 0.08);
    font-weight: 600;
  }
  .sidebar-icon { font-size: 1.2rem; width: 24px; text-align: center; }

  /* --- Desktop Top Bar --- */
  .desktop-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    grid-area: topbar;
    background: var(--card);
    border-bottom: 1px solid var(--border);
    padding: 0 32px;
    position: sticky;
    top: 0;
    z-index: 40;
  }
  .topbar-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text);
  }
  .topbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
  }
  .desktop-header-user {
    background: var(--bg);
    color: var(--text);
    border: 1px solid var(--border);
  }
  .desktop-header-user:hover { background: var(--border); }

  /* --- User Menu on desktop: position relative to topbar --- */
  .user-menu {
    top: 60px;
    right: 32px;
  }

  /* --- Desktop Content Wrapper --- */
  .desktop-content-wrapper {
    display: block;
    grid-area: main;
    overflow-y: auto;
    height: calc(100dvh - 60px);
    background: var(--bg);
  }
  .content {
    padding: 32px;
    padding-bottom: 32px;
    max-width: 1400px;
    margin: 0 auto;
  }

  /* --- Modals: centered on desktop --- */
  .modal-overlay {
    align-items: center;
  }
  .modal {
    max-width: 600px;
    border-radius: 16px;
    animation: fadeScale 0.2s ease;
  }
  .bewerbung-modal {
    max-width: 700px;
  }
  #bewerbungTabContent {
    max-height: 60vh;
  }
  @keyframes fadeScale {
    from { transform: scale(0.95); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
  }

  /* --- Stats grid: 4 columns on desktop --- */
  .stats-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  /* --- Event cards: multi-column grid --- */
  #eventList {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 12px;
  }
  #eventList .card { margin-bottom: 0; }
  #eventList .empty-state {
    grid-column: 1 / -1;
  }

  /* --- Bewerbung cards: 2-column grid --- */
  #bewerbungList {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 12px;
  }
  #bewerbungList .card { margin-bottom: 0; }

  /* --- KI chat: limit width --- */
  .ki-messages { max-width: 800px; max-height: 65vh; }
  .ki-input-row { max-width: 800px; }
  .ki-quick-btns { max-width: 800px; }
  .ki-action-card { max-width: 600px; }
  .ki-action-toolbar { max-width: 600px; }
  .ki-action-bulk { max-width: 600px; }

  /* --- Toast on desktop: centered bottom --- */
  .toast {
    bottom: 32px;
  }

  /* --- Dashboard: desktop overrides --- */
  .dashboard-stats {
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
  }
  .dashboard-stat {
    padding: 20px;
  }
  .dashboard-stat-value {
    font-size: 2rem;
  }
  .dashboard-grid {
    grid-template-columns: 1fr 1fr;
  }
  .dashboard-card {
    padding: 20px;
  }

  /* --- Calendar: 4-column year grid on desktop --- */
  .cal-year-grid {
    grid-template-columns: repeat(4, 1fr);
  }
  .cal-month-grid {
    max-width: 1000px;
  }
  .cal-month-cell {
    min-height: 90px;
    padding: 6px;
  }
  .cal-month-day-num {
    font-size: 0.8rem;
  }
  .cal-event-name {
    font-size: 0.7rem;
  }
  .cal-mini-day {
    font-size: 0.6rem;
  }
  .cal-mini-hd {
    font-size: 0.6rem;
  }

  /* --- Filter bar: horizontal on desktop --- */
  .filter-range-row {
    flex-direction: row;
    gap: 24px;
  }
  .events-filter-panel {
    max-width: 800px;
  }
  .sort-buttons {
    flex-wrap: nowrap;
  }

  /* --- Archiv: same grid as events --- */
  #eventList .events-empty-state {
    grid-column: 1 / -1;
  }
  #bewerbungList {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 12px;
  }
}

/* ==================== BEWERBUNGEN CARDS ==================== */
.bewerbung-card { position: relative; }
.bewerbung-card--abgelehnt { opacity: 0.6; }
.bewerbung-card-header { display: flex; justify-content: space-between; align-items: flex-start; }
.bewerbung-card-title { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; width: 100%; }
.bewerbung-card-title h3 { margin: 0; font-size: 0.95rem; flex: 1; }
.bewerbung-card-badges { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.bewerbung-card-meta { font-size: 0.8rem; color: var(--text-muted); margin: 4px 0 2px; }
.bewerbung-card-typ { font-size: 0.75rem; color: var(--text-muted); margin: 2px 0 6px; }
.bewerbung-card-lk { font-size: 0.75rem; color: var(--text-muted); margin: 4px 0; cursor: pointer; }
.bewerbung-card-lk:hover { color: var(--brand); text-decoration: underline; }
.bewerbung-card-frist { margin: 4px 0; }
.bewerbung-card-actions { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }

.bewerbung-quick-actions {
  display: flex; gap: 6px; margin: 8px 0 4px;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 6px 0;
}

.bewerbung-quick-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--bg); border: 1px solid var(--border);
  font-size: 1.1rem; text-decoration: none; color: inherit;
  transition: background 0.15s, transform 0.1s;
}
.bewerbung-quick-btn:hover { background: var(--brand); color: white; transform: scale(1.1); }

.bew-quick-note-area {
  margin-top: 8px; padding-top: 8px;
  border-top: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 6px;
}
.bew-quick-note-input { min-height: 50px; font-size: 0.85rem; }

.bew-filter-bar .bew-typ-chips { flex-wrap: wrap; }
.bew-filter-bar .filter-chip { font-size: 0.7rem; padding: 3px 8px; }

/* Dashboard vormerken urgent item */
.dashboard-item--urgent { background: #fef2f2; border-radius: 6px; padding: 6px 8px !important; }

/* ==================== MARKT-FINDER ==================== */
.marktfinder-header { text-align: center; margin-bottom: 16px; }
.marktfinder-header h2 { margin: 0 0 4px; font-size: 1.3rem; }
.marktfinder-subtitle { color: var(--text-muted); font-size: 0.85rem; margin: 0; }

.marktfinder-quick-templates {
  display: flex; flex-wrap: wrap; gap: 6px;
  margin-bottom: 16px; justify-content: center;
}
.marktfinder-vorlage-pill { font-size: 0.8rem; }
.marktfinder-vorlage-del {
  background: none; border: none; color: var(--danger);
  font-size: 0.9rem; cursor: pointer; padding: 0 2px;
  margin-left: -4px;
}

.marktfinder-form {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px;
  margin-bottom: 16px;
}

.marktfinder-section {
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.marktfinder-section:last-of-type { border-bottom: none; }

.marktfinder-label {
  display: block; font-size: 0.75rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.5px;
  color: var(--text-muted); margin-bottom: 8px;
}

.marktfinder-actions {
  display: flex; gap: 8px; margin-top: 12px;
}
.marktfinder-actions .btn { flex: 1; }

@media (min-width: 900px) {
  .marktfinder-form { max-width: 800px; }
}

/* ==================== EMAIL INTEGRATION ==================== */

/* Tab badge (unread count in tab bar) */
.bew-tab-badge {
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--danger); color: white; font-size: 0.65rem; font-weight: 700;
  min-width: 16px; height: 16px; border-radius: 8px; padding: 0 4px;
  margin-left: 4px; vertical-align: middle;
}

/* Sidebar / mobile tab unread badge */
.sidebar-badge, .tab-badge {
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--danger); color: white; font-size: 0.65rem; font-weight: 700;
  min-width: 18px; height: 18px; border-radius: 9px; padding: 0 5px;
  margin-left: 6px;
}

/* Email tab header */
.email-tab-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 12px; font-size: 0.85rem; font-weight: 600;
}

/* Email card in list */
.email-card {
  background: var(--card); border: 1px solid var(--border); border-radius: 10px;
  padding: 12px; margin-bottom: 8px; transition: box-shadow 0.15s;
}
.email-card:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.08); }
.email-card--unread {
  border-left: 3px solid var(--danger); background: #fef2f2;
}

.email-card-header {
  display: flex; align-items: center; gap: 8px; margin-bottom: 4px;
  font-size: 0.75rem;
}
.email-card-dir { font-weight: 600; }
.email-card-time { color: var(--text-muted); }
.email-card-unread-badge {
  background: var(--danger); color: white; font-size: 0.6rem; font-weight: 700;
  padding: 1px 6px; border-radius: 4px; text-transform: uppercase;
}
.email-card-addr { font-size: 0.8rem; color: var(--text-muted); }
.email-card-subject { font-weight: 600; font-size: 0.85rem; margin: 4px 0; }
.email-card-preview {
  font-size: 0.82rem; color: var(--text-muted); line-height: 1.4;
  overflow: hidden; text-overflow: ellipsis;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.email-card-attachments {
  font-size: 0.75rem; color: var(--text-muted); margin-top: 6px;
}
.email-card-actions {
  display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap;
}

/* Email compose modal */
.email-compose-modal { max-width: 560px; }
.email-compose-body { min-height: 180px; font-family: inherit; resize: vertical; }
.email-compose-templates {
  display: flex; gap: 6px; align-items: center; margin: 8px 0;
}
.email-compose-actions {
  display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap;
}

/* Email read modal */
.email-read-modal { max-width: 600px; }
.email-read-meta {
  font-size: 0.82rem; line-height: 1.6; padding: 8px 0;
  border-bottom: 1px solid var(--border); margin-bottom: 12px;
}
.email-read-body { max-height: 400px; overflow-y: auto; }
.email-html-frame {
  width: 100%; min-height: 200px; border: none; border-radius: 4px;
  background: white;
}
.email-text-body {
  font-size: 0.85rem; white-space: pre-wrap; word-break: break-word;
  line-height: 1.5; background: var(--bg); padding: 12px; border-radius: 8px;
  margin: 0;
}
.email-attachments {
  font-size: 0.8rem; color: var(--text-muted); margin-top: 8px;
  padding-top: 8px; border-top: 1px solid var(--border);
}
.email-read-actions {
  display: flex; gap: 8px; margin-top: 16px;
}

/* Email modal overlay (higher z-index to overlay bewerbung modal) */
.email-modal-overlay {
  z-index: 300;
}

/* Email status section in settings */
.email-status-grid {
  display: grid; grid-template-columns: 1fr; gap: 12px;
}
.email-status-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; background: var(--bg); border-radius: 8px;
}
.email-status-indicator {
  width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0;
}
.email-status--ok { background: var(--success); }
.email-status--error { background: var(--danger); }

/* Timeline icon */
.timeline-icon { font-size: 1rem; flex-shrink: 0; }
.bew-timeline-email { background: #f0f9ff; border-radius: 6px; padding: 6px 8px; }
.timeline-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }

/* Attachment UI */
.attachment-section { margin-bottom: 12px; }
.attachment-drop-zone {
  border: 2px dashed var(--border);
  border-radius: 8px;
  padding: 16px;
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-muted);
  transition: border-color 0.2s, background 0.2s;
  cursor: pointer;
}
.attachment-drop-zone.drag-over {
  border-color: var(--primary);
  background: rgba(59, 130, 246, 0.05);
}
.attachment-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px;
  background: var(--bg);
  border-radius: 6px;
  margin-top: 6px;
  font-size: 0.8rem;
}
.attachment-item span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.attachment-total {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-align: right;
  margin-top: 4px;
}

/* KI Draft Mail Section */
.draft-mail-section {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px;
  margin-bottom: 8px;
  background: var(--bg);
}
.draft-mail-header {
  margin-bottom: 8px;
}
.draft-mail-variants {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* KI Refine Section */
.email-refine-section {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px;
  margin-bottom: 12px;
  background: var(--bg);
}
.refine-quick-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin-bottom: 8px;
}
.refine-chat {
  max-height: 120px;
  overflow-y: auto;
  margin-bottom: 8px;
}
.refine-msg {
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 0.8rem;
  margin-bottom: 4px;
}
.refine-user {
  background: var(--primary);
  color: white;
  text-align: right;
  margin-left: 20%;
}
.refine-confirm {
  color: var(--success);
  font-size: 0.75rem;
}
.refine-error {
  color: var(--danger);
  font-size: 0.75rem;
}
.refine-loading {
  display: flex;
  justify-content: center;
  padding: 6px;
}
.refine-input-row {
  display: flex;
  gap: 6px;
}
.refine-input-row .form-input { flex: 1; font-size: 0.85rem; }

/* Event card compose button */
button.contact-mail {
  background: none;
  border: none;
  color: var(--primary);
  cursor: pointer;
  font-size: inherit;
  padding: 4px 8px;
  border-radius: 4px;
  text-decoration: none;
}
button.contact-mail:hover { background: rgba(59, 130, 246, 0.1); }

/* Bewerbung compose quick button */
button.bew-compose-btn {
  background: none;
  border: 1px solid var(--border);
  cursor: pointer;
}

@media (min-width: 900px) {
  .email-status-grid { grid-template-columns: repeat(3, 1fr); }
  .email-compose-modal { max-width: 640px; }
  .email-read-modal { max-width: 700px; }
  .email-list { max-height: 500px; overflow-y: auto; }
  .refine-chat { max-height: 160px; }
  .attachment-drop-zone { padding: 20px; }
}

/* ==================== VIEW TOGGLE ==================== */
.view-toggle {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  flex-shrink: 0;
}
.view-toggle-btn {
  background: var(--card);
  border: none;
  padding: 6px 10px;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  color: var(--text-muted);
  transition: background 0.15s, color 0.15s;
}
.view-toggle-btn:hover { background: var(--bg); }
.view-toggle-btn--active {
  background: var(--brand);
  color: white;
}
.view-toggle-btn + .view-toggle-btn { border-left: 1px solid var(--border); }

/* ==================== DATA TABLE ==================== */
.data-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  width: 100%;
}
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  table-layout: auto;
}
.data-table th {
  position: sticky;
  top: 0;
  background: var(--bg);
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-muted);
  padding: 8px 10px;
  text-align: left;
  white-space: nowrap;
  border-bottom: 2px solid var(--border);
  z-index: 1;
  user-select: none;
}
.data-table th.dt-sortable { cursor: pointer; }
.data-table th.dt-sortable:hover { color: var(--brand); }
.data-table td {
  padding: 6px 10px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.data-table td.dt-name {
  max-width: 300px;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
}
.data-table td.dt-ort {
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.data-table td.dt-typ {
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.data-table td.dt-datum { width: 90px; }
.data-table td.dt-km { width: 55px; text-align: center; }
.data-table td.dt-score { width: 60px; text-align: center; }
.data-table td.dt-status { width: 120px; }
.data-table td.dt-kontakt { width: 110px; }
.data-table tbody tr { cursor: pointer; transition: background 0.1s; }
.data-table tbody tr:nth-child(even) { background: rgba(0,0,0,0.015); }
.data-table tbody tr:hover { background: rgba(201,74,26,0.04); }
.dt-row--selected { background: rgba(201,74,26,0.08) !important; }
.dt-row--archived { opacity: 0.7; }
.row-checkbox-col { width: 40px; text-align: center; }
.row-checkbox { width: 16px; height: 16px; cursor: pointer; accent-color: var(--brand); }
.dt-actions { position: relative; width: 40px; }
.bew-status-badge--small { font-size: 0.7rem; padding: 2px 8px; border-radius: 10px; color: white; white-space: nowrap; }

@media (max-width: 899px) {
  .dt-hide-mobile { display: none; }
  .data-table td.dt-name { max-width: 140px; }
  .data-table td.dt-ort { max-width: 100px; }
}
@media (min-width: 900px) {
  .data-table-wrap {
    overflow-x: visible;
  }
}

/* ==================== BULK ACTION BAR ==================== */
.bulk-action-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--brand);
  color: white;
  border-radius: var(--radius);
  margin-bottom: 8px;
  flex-wrap: wrap;
  position: sticky;
  top: 0;
  z-index: 10;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.bulk-action-bar .btn { color: white; border-color: rgba(255,255,255,0.3); font-size: 0.8rem; }
.bulk-action-bar .btn:hover { background: rgba(255,255,255,0.15); }
.bulk-count { font-weight: 600; font-size: 0.85rem; margin-right: 4px; }
.bulk-status-wrap { display: flex; }
.bulk-status-select { font-size: 0.8rem; padding: 4px 8px; border-radius: 6px; border: 1px solid rgba(255,255,255,0.3); background: rgba(255,255,255,0.1); color: white; cursor: pointer; }
.bulk-status-select option { color: var(--text); background: var(--card); }
.bulk-delete-btn { color: #fca5a5 !important; border-color: #fca5a5 !important; }
.bulk-delete-btn:hover { background: rgba(252,165,165,0.2) !important; }
.bulk-action-bar .btn-primary { background: rgba(255,255,255,0.2); border-color: rgba(255,255,255,0.5); font-weight: 600; }
.card-checkbox { position: absolute; top: 8px; left: 8px; width: 18px; height: 18px; cursor: pointer; accent-color: var(--brand); z-index: 2; opacity: 0.4; margin: 0; -webkit-tap-highlight-color: transparent; }
.card-checkbox:checked { opacity: 1; }
.event-card, .bewerbung-card { position: relative; padding-left: 36px !important; }

/* Kontakt-Status-Icons */
.kontakt-icons { display: inline-flex; gap: 6px; align-items: center; }
.kontakt-icon { font-size: 0.9rem; position: relative; display: inline-block; }
.kontakt-icon--has { opacity: 1; }
.kontakt-icon--missing { opacity: 0.35; position: relative; }
.kontakt-icon--missing::after { content: ''; position: absolute; left: 0; right: 0; top: 50%; border-top: 1.5px solid var(--danger); transform: rotate(-12deg); }
.kontakt-warning { color: var(--danger); font-size: 0.7rem; font-weight: 600; }
.event-card-kontakt-row, .bewerbung-card-kontakt-row { margin-top: 4px; }
.dt-kontakt-icons { white-space: nowrap; }

/* Contact Research Dialog */
.contact-research-result { background: var(--bg-primary); border-radius: 16px; padding: 24px; max-width: 420px; width: 90vw; margin: auto; position: relative; top: 50%; transform: translateY(-50%); }
.contact-research-result h3 { margin: 0 0 16px 0; font-size: 1.1rem; }
.cr-results { display: flex; flex-direction: column; gap: 12px; margin-bottom: 20px; }
.cr-result-row { display: flex; gap: 10px; align-items: flex-start; padding: 8px 10px; background: var(--bg-secondary); border-radius: 8px; }
.cr-icon { font-size: 1.2rem; flex-shrink: 0; margin-top: 2px; }
.cr-result-row strong { word-break: break-all; }
.contact-research-source { font-size: 0.65rem; color: var(--info); word-break: break-all; margin-top: 2px; }
.cr-conflict { font-size: 0.7rem; color: var(--warning); margin-top: 2px; }
.cr-actions { display: flex; gap: 8px; justify-content: flex-end; }

/* Bulk Progress */
.bulk-progress { width: 100%; height: 8px; background: var(--bg-secondary); border-radius: 4px; overflow: hidden; margin-bottom: 6px; }
.bulk-progress-bar { height: 100%; background: var(--primary); border-radius: 4px; transition: width 0.3s; }
.bulk-progress-fill { height: 100%; background: var(--primary); border-radius: 4px; transition: width 0.3s; }
.bulk-progress p { font-size: 0.85rem; color: var(--text-muted); text-align: center; }

/* Status Multi-Select Pills */
.status-multi-pills {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  padding: 4px 0 8px;
}
.status-pill {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 0.72rem;
  font-weight: 500;
  background: var(--bg-secondary);
  color: var(--text-secondary);
  border: 1.5px solid var(--border);
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.status-pill:hover {
  border-color: var(--sp-color, var(--primary));
}
.status-pill--active {
  background: var(--sp-color, var(--primary));
  color: white;
  border-color: var(--sp-color, var(--primary));
}

/* nicht_geeignet badge */
.badge-nicht_geeignet { background: #f5f0eb; color: #78716c; }
.event-bewerbung-badge--nicht_geeignet { background: #f5f0eb; color: #78716c; }
.event-bewerbung-badge--vormerken_naechstes_jahr { background: #ede9fe; color: #6d28d9; border: 1px dashed #8b5cf6; }
.cal-mini-nicht_geeignet { background: #78716c; }
.calendar-event-block--nicht_geeignet {
  opacity: 0.5;
}
.calendar-event-block--nicht_geeignet .cal-event-name { text-decoration: line-through; }

/* Highlight flash for goToEvent/goToBewerbung */
@keyframes highlight-flash {
  0% { box-shadow: 0 0 0 3px var(--primary); }
  100% { box-shadow: 0 0 0 0 transparent; }
}
.highlight-flash {
  animation: highlight-flash 2s ease-out;
}

/* Signatur Preview in Compose */
.signatur-preview { border-top: 1px solid var(--border); padding-top: 8px; }

/* ==================== LIST CONTEXT MENU (body-attached) ==================== */
.list-context-menu {
  position: absolute;
  background: var(--card);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.15);
  z-index: 10000;
  min-width: 200px;
  padding: 4px;
  border: 1px solid var(--border);
}
.list-context-menu button {
  display: block;
  width: 100%;
  text-align: left;
  padding: 10px 16px;
  border: none;
  background: none;
  cursor: pointer;
  font-size: 0.85rem;
  font-family: inherit;
  border-radius: 4px;
  color: var(--text);
}
.list-context-menu button:hover { background: var(--bg); }
.list-context-menu button.danger { color: var(--danger); }
.list-context-menu button.danger:hover { background: rgba(239,68,68,0.06); }

/* ==================== GLOBAL MAIL NOTIFICATION BAR ==================== */
.global-mail-bar {
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  color: white;
  padding: 8px 16px;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  position: relative;
  z-index: 50;
}
.global-mail-bar:hover { background: linear-gradient(135deg, #2563eb, #1d4ed8); }
.global-mail-bar-icon { font-size: 1.1rem; flex-shrink: 0; }
.global-mail-bar-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.global-mail-bar-text a { color: white; text-decoration: underline; cursor: pointer; font-weight: 600; }
.global-mail-bar-text a:hover { text-decoration: none; }
.global-mail-bar-close {
  border: none;
  background: none;
  color: rgba(255,255,255,0.7);
  cursor: pointer;
  font-size: 1.1rem;
  padding: 0 4px;
  flex-shrink: 0;
}
.global-mail-bar-close:hover { color: white; }
.global-mail-bar--hidden { display: none; }

.global-mail-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 0 0 8px 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.15);
  z-index: 10001;
  max-height: 300px;
  overflow-y: auto;
}
.global-mail-dropdown-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.1s;
}
.global-mail-dropdown-item:last-child { border-bottom: none; }
.global-mail-dropdown-item:hover { background: var(--bg); }
.global-mail-dropdown-name { font-weight: 600; font-size: 0.85rem; color: var(--text); }
.global-mail-dropdown-subject { font-size: 0.75rem; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 300px; }
.global-mail-dropdown-time { font-size: 0.7rem; color: var(--text-muted); white-space: nowrap; margin-left: auto; flex-shrink: 0; }
.global-mail-dropdown-header {
  padding: 10px 16px;
  font-weight: 700;
  font-size: 0.85rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
}

/* ==================== SERIEN-MAIL PLACEHOLDER CHIPS ==================== */
.placeholder-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}
.placeholder-chip {
  display: inline-block;
  padding: 4px 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  font-size: 0.75rem;
  font-family: monospace;
  cursor: pointer;
  transition: all 0.15s;
  color: var(--text);
  user-select: none;
}
.placeholder-chip:hover {
  background: var(--brand);
  color: white;
  border-color: var(--brand);
}
.bulk-mail-recipients {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 8px;
  padding: 6px 10px;
  background: var(--bg);
  border-radius: 6px;
}

@media (max-width: 899px) {
  .global-mail-bar { font-size: 0.8rem; padding: 6px 12px; }
  .global-mail-dropdown-item { padding: 8px 12px; }
}

/* === Datum-Belegpflicht (v1.28.0) === */
.datum-unbestaetigt-badge {
  background: #fef2f2;
  color: #dc2626;
  border: 1px solid #fca5a5;
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 0.75rem;
  font-weight: 600;
  margin-top: 2px;
}
.datum-unbestaetigt-icon {
  color: #dc2626;
  font-size: 0.85rem;
  cursor: help;
}
.datum-unbekannt {
  color: var(--text-muted, #6b7280);
  font-style: italic;
  font-size: 0.8rem;
}
.datum-quelle-link {
  font-size: 0.7rem;
  color: var(--primary, #C94A1A);
  text-decoration: underline;
  margin-left: 4px;
}
/* Kalender: tentative (unbestaetigte) Events */
.cal-event-tentativ {
  border-style: dashed !important;
  border-left-style: dashed !important;
  opacity: 0.65;
  background: rgba(220, 38, 38, 0.06) !important;
}
.cal-mini-tentativ {
  border: 1.5px dashed #dc2626 !important;
  opacity: 0.6;
}
