/* =====================================================================
   Paket 11 — Vorgänge / Kanban
   ===================================================================== */

.vorgaenge-root {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 600px;
  padding: 12px 16px 0;
  box-sizing: border-box;
  color: #111827;
}

.vorgaenge-loading {
  text-align: center;
  padding: 48px;
  color: #6b7280;
}

/* ─── Header mit Filtern ─────────────────────────────────────────────── */
.vg-header {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  padding-bottom: 12px;
  border-bottom: 1px solid #e5e7eb;
  margin-bottom: 12px;
}

.vg-header h2 {
  margin: 0 12px 0 0;
  font-size: 18px;
  font-weight: 700;
  color: #111827;
}

.vg-kpis {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
@media (max-width: 900px) {
  .vg-kpis { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 520px) {
  .vg-kpis { grid-template-columns: 1fr; }
}

.vg-kpi {
  background: #f3f4f6;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 12px;
  line-height: 1.2;
  min-width: 0;
}
.vg-kpi strong { display:block; font-size: 18px; font-weight: 700; color: #111827; }
.vg-kpi.highlight { background: #dbeafe; border-color: #93c5fd; }
.vg-kpi.highlight strong { color: #1d4ed8; }
.vg-kpi.win { background: #dcfce7; border-color: #86efac; }
.vg-kpi.win strong { color: #15803d; }

.vg-filters {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-left: auto;
  flex-wrap: wrap;
}

.vg-filters input,
.vg-filters select {
  padding: 6px 10px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 13px;
  background: white;
}
.vg-filters input[type="search"] { width: 220px; }

.vg-filters .vg-toggle {
  display: inline-flex;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  overflow: hidden;
}
.vg-filters .vg-toggle button {
  background: white;
  border: none;
  padding: 6px 12px;
  font-size: 13px;
  cursor: pointer;
  color: #374151;
}
.vg-filters .vg-toggle button.active {
  background: #2563eb;
  color: white;
}

/* ─── Kanban ─────────────────────────────────────────────────────────── */
.vg-board {
  display: grid;
  grid-template-columns: repeat(7, minmax(220px, 1fr));
  gap: 10px;
  overflow-x: auto;
  overflow-y: auto;
  padding-bottom: 16px;
  flex: 1;
  min-height: 400px;
}

.vg-col {
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  min-height: 240px;
  max-height: 100%;
}

.vg-col.drop-target {
  background: #eff6ff;
  border-color: #60a5fa;
}

.vg-col-header {
  padding: 8px 10px;
  border-bottom: 1px solid #e5e7eb;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #fff;
  border-radius: 10px 10px 0 0;
  position: sticky;
  top: 0;
  z-index: 2;
}
.vg-col-header .t { font-weight: 600; font-size: 13px; }
.vg-col-header .c { font-size: 12px; color: #6b7280; background: #e5e7eb; padding: 2px 8px; border-radius: 9999px; }

/* Statuspunkt-Farben */
.vg-col[data-status="Gesendet"]       .vg-col-header { border-top: 3px solid #64748b; border-radius: 10px 10px 0 0; }
.vg-col[data-status="Nachgefasst"]    .vg-col-header { border-top: 3px solid #d97706; }
.vg-col[data-status="Rückmeldung"]    .vg-col-header { border-top: 3px solid #2563eb; }
.vg-col[data-status="Termin"]         .vg-col-header { border-top: 3px solid #7c3aed; }
.vg-col[data-status="Angebot"]        .vg-col-header { border-top: 3px solid #db2777; }
.vg-col[data-status="Gewonnen"]       .vg-col-header { border-top: 3px solid #16a34a; }
.vg-col[data-status="Verloren"]       .vg-col-header { border-top: 3px solid #dc2626; }
.vg-col[data-status="Kein Interesse"] .vg-col-header { border-top: 3px solid #9ca3af; }

.vg-col-body {
  padding: 8px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}

.vg-card {
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 8px 10px;
  cursor: grab;
  user-select: none;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
  transition: box-shadow 0.15s, transform 0.1s;
}
.vg-card:hover { box-shadow: 0 4px 10px rgba(0,0,0,0.08); }
.vg-card.dragging { opacity: 0.45; }

.vg-card .firma {
  font-weight: 600;
  font-size: 13px;
  margin-bottom: 4px;
  color: #111827;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.vg-card .titel {
  font-size: 12px;
  color: #4b5563;
  margin-bottom: 4px;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.vg-card .meta {
  font-size: 11px;
  color: #6b7280;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}
.vg-card .badge {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 6px;
  font-weight: 600;
  background: #eef2ff;
  color: #4338ca;
}
.vg-card .badge.ow-none { background: #fef3c7; color: #92400e; }
.vg-card .badge.due {
  background: #fee2e2;
  color: #b91c1c;
}
.vg-card .badge.due.future { background: #dbeafe; color: #1d4ed8; }

.vg-col-empty {
  padding: 16px 8px;
  text-align: center;
  color: #9ca3af;
  font-size: 12px;
  font-style: italic;
}

/* ─── Listenansicht ─────────────────────────────────────────────────── */
.vg-list-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.vg-list-table th,
.vg-list-table td {
  padding: 8px 10px;
  border-bottom: 1px solid #e5e7eb;
  text-align: left;
}
.vg-list-table th {
  background: #f9fafb;
  font-weight: 600;
  color: #374151;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  position: sticky;
  top: 0;
  z-index: 1;
}
.vg-list-table tr { cursor: pointer; }
.vg-list-table tr:hover td { background: #f3f4f6; }

.vg-status-chip {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 9999px;
  font-size: 11px;
  font-weight: 600;
}
.vg-status-chip[data-s="Gesendet"]       { background: #e2e8f0; color: #334155; }
.vg-status-chip[data-s="Nachgefasst"]    { background: #fef3c7; color: #92400e; }
.vg-status-chip[data-s="Rückmeldung"]    { background: #dbeafe; color: #1d4ed8; }
.vg-status-chip[data-s="Termin"]         { background: #ede9fe; color: #6d28d9; }
.vg-status-chip[data-s="Angebot"]        { background: #fce7f3; color: #9d174d; }
.vg-status-chip[data-s="Gewonnen"]       { background: #dcfce7; color: #15803d; }
.vg-status-chip[data-s="Verloren"]       { background: #fee2e2; color: #b91c1c; }
.vg-status-chip[data-s="Kein Interesse"] { background: #f3f4f6; color: #6b7280; }

/* ─── Edit-Modal ─────────────────────────────────────────────────────── */
.vg-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(17, 24, 39, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1200;
  padding: 16px;
}

.vg-modal {
  background: white;
  border-radius: 12px;
  max-width: 780px;
  width: 100%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 20px 50px rgba(0,0,0,0.25);
}

.vg-modal-header {
  padding: 14px 18px;
  border-bottom: 1px solid #e5e7eb;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.vg-modal-header h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.vg-modal-close {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 22px;
  color: #6b7280;
  padding: 0 6px;
}

.vg-modal-body {
  padding: 14px 18px;
  overflow-y: auto;
  flex: 1;
}

.vg-modal-section { margin-bottom: 18px; }
.vg-modal-section h3 {
  font-size: 13px;
  font-weight: 700;
  color: #374151;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin: 0 0 8px;
}

.vg-field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 14px;
}
.vg-field-grid label {
  display: flex;
  flex-direction: column;
  font-size: 12px;
  color: #374151;
  font-weight: 500;
  gap: 4px;
}
.vg-field-grid input,
.vg-field-grid select,
.vg-field-grid textarea {
  padding: 6px 10px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 13px;
  background: white;
  font-family: inherit;
}
.vg-field-grid textarea {
  resize: vertical;
  min-height: 60px;
}
.vg-field-grid label.full { grid-column: 1 / -1; }

.vg-status-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.vg-status-actions button {
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  background: white;
  cursor: pointer;
  color: #374151;
}
.vg-status-actions button:hover { background: #f3f4f6; }
.vg-status-actions button.primary { background: #2563eb; color: white; border-color: #2563eb; }
.vg-status-actions button.primary:hover { background: #1d4ed8; }
.vg-status-actions button.win { background: #16a34a; color: white; border-color: #16a34a; }
.vg-status-actions button.win:hover { background: #15803d; }
.vg-status-actions button.lose { background: #dc2626; color: white; border-color: #dc2626; }
.vg-status-actions button.lose:hover { background: #b91c1c; }

.vg-notizen-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 200px;
  overflow-y: auto;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 8px;
}
.vg-notiz-item {
  background: white;
  border-radius: 6px;
  padding: 6px 8px;
  font-size: 12px;
  border-left: 3px solid #60a5fa;
}
.vg-notiz-item .head {
  font-size: 11px;
  color: #6b7280;
  margin-bottom: 2px;
}
.vg-notiz-item .text { color: #111827; white-space: pre-wrap; }

.vg-notiz-add {
  display: flex;
  gap: 6px;
  margin-top: 8px;
}
.vg-notiz-add textarea {
  flex: 1;
  padding: 6px 10px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 13px;
  resize: vertical;
  min-height: 40px;
  font-family: inherit;
}

.vg-inbox-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 200px;
  overflow-y: auto;
}
.vg-inbox-item {
  background: #eff6ff;
  border-left: 3px solid #2563eb;
  border-radius: 6px;
  padding: 6px 8px;
  font-size: 12px;
}
.vg-inbox-item .from { font-weight: 600; color: #1e40af; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.vg-inbox-item .subject { color: #1e3a8a; margin: 2px 0; }
.vg-inbox-item .body { color: #374151; white-space: pre-wrap; max-height: 80px; overflow: auto; }

/* Watcher 1.2 — Match-Methode-Badge im Vorgangs-Modal */
.vg-match-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 10px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  vertical-align: middle;
  border: 1px solid transparent;
}
.vg-match-badge.mm-thread { background: #dcfce7; color: #166534; border-color: #86efac; }
.vg-match-badge.mm-sender { background: #dbeafe; color: #1e40af; border-color: #93c5fd; }
.vg-match-badge.mm-manual { background: #e9d5ff; color: #6b21a8; border-color: #c4b5fd; }
.vg-match-badge.mm-domain { background: #fef3c7; color: #92400e; border-color: #fcd34d; }

/* Watcher 1.2 — „Rückmeldungen zuordnen"-Bereich (Dashboard-Card) */
.unclear-matches-card {
  background: #fff;
  border: 1px solid #fcd34d;
  border-radius: 10px;
  padding: 12px 14px;
  margin: 12px 0;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}
.unclear-matches-card h3 {
  margin: 0 0 8px 0;
  font-size: 15px;
  color: #92400e;
  display: flex;
  align-items: center;
  gap: 8px;
}
.unclear-matches-card h3 .count {
  background: #f59e0b;
  color: #fff;
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 10px;
}
.unclear-matches-card .um-empty { color: #9ca3af; font-size: 12px; padding: 6px 0; }
.unclear-item {
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 8px;
  background: #fafafa;
}
.unclear-item .um-head {
  font-weight: 600;
  color: #111827;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.unclear-item .um-subject { font-size: 12px; color: #374151; margin: 4px 0; }
.unclear-item .um-body {
  font-size: 11px;
  color: #6b7280;
  white-space: pre-wrap;
  max-height: 60px;
  overflow: auto;
  background: #fff;
  padding: 6px;
  border-radius: 4px;
  border: 1px solid #e5e7eb;
  margin: 4px 0 6px;
}
.unclear-item .um-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
  margin-top: 6px;
}
.unclear-item .um-actions select {
  flex: 1 1 220px;
  padding: 4px 6px;
  font-size: 12px;
  border: 1px solid #d1d5db;
  border-radius: 4px;
}
.unclear-item .um-actions button {
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 4px;
  cursor: pointer;
  border: 1px solid transparent;
}
.unclear-item .um-actions .assign { background: #2563eb; color: #fff; }
.unclear-item .um-actions .assign:hover { background: #1d4ed8; }
.unclear-item .um-actions .dismiss { background: #fff; color: #b91c1c; border-color: #fca5a5; }
.unclear-item .um-actions .dismiss:hover { background: #fef2f2; }

.vg-modal-footer {
  padding: 12px 18px;
  border-top: 1px solid #e5e7eb;
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  background: #f9fafb;
}
.vg-modal-footer button {
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  border: 1px solid transparent;
}
.vg-modal-footer .save { background: #2563eb; color: white; }
.vg-modal-footer .save:hover { background: #1d4ed8; }
.vg-modal-footer .cancel { background: white; color: #374151; border-color: #d1d5db; }
.vg-modal-footer .delete { background: white; color: #b91c1c; border-color: #fca5a5; margin-right: auto; }

/* Responsive: Kanban auf kleinen Screens scrollbar */
@media (max-width: 1400px) {
  .vg-board { grid-template-columns: repeat(7, 220px); }
}
