:root {
  --bg: #f6f7f9;
  --panel: #ffffff;
  --text: #111827;
  --muted: #6b7280;
  --line: #e5e7eb;
  --primary: #111827;
  --primary-hover: #374151;
  --accent: #2563eb;
  --warning: #fff7ed;
  --warning-border: #fed7aa;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; color: var(--text); background: var(--bg); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.topnav { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 16px 28px; background: #111827; color: #fff; position: sticky; top: 0; z-index: 10; }
.brand { font-weight: 800; letter-spacing: -0.03em; }
.navlinks { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.navlinks a { color: #e5e7eb; font-weight: 600; font-size: 14px; }
.navlinks a:hover { color: #fff; }
.container { max-width: 1220px; margin: 0 auto; padding: 28px; }
h1 { font-size: 34px; letter-spacing: -0.04em; margin: 0 0 18px; }
h2 { font-size: 22px; margin: 0 0 16px; }
p { line-height: 1.6; }
.muted { color: var(--muted); font-size: 14px; }
.panel, .auth-card { background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 22px; margin: 18px 0; box-shadow: 0 1px 2px rgba(17,24,39,0.04); }
.auth-card { max-width: 420px; margin: 72px auto; }
.stack { display: grid; gap: 14px; }
.inline { display: flex; gap: 12px; align-items: end; flex-wrap: wrap; }
label { font-weight: 700; font-size: 14px; display: grid; gap: 8px; }
input, select, textarea { width: 100%; border: 1px solid var(--line); border-radius: 12px; padding: 11px 12px; font: inherit; background: #fff; }
textarea { resize: vertical; }
button, .button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: 12px; background: var(--primary); color: #fff; padding: 11px 16px; font-weight: 800; cursor: pointer; text-decoration: none; font-size: 14px; }
button:hover, .button:hover { background: var(--primary-hover); text-decoration: none; }
.button.secondary { background: #e5e7eb; color: #111827; }
.button.secondary:hover { background: #d1d5db; }
.button.small { padding: 8px 10px; font-size: 13px; }
.actions { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin: 16px 0; }
.cards { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin: 18px 0; }
.cards.compact { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.card { background: #fff; border: 1px solid var(--line); border-radius: 18px; padding: 18px; box-shadow: 0 1px 2px rgba(17,24,39,0.04); }
.card span { color: var(--muted); display: block; margin-bottom: 10px; font-size: 13px; font-weight: 700; }
.card strong { font-size: 30px; letter-spacing: -0.04em; }
.table-wrap { background: #fff; border: 1px solid var(--line); border-radius: 18px; overflow: auto; box-shadow: 0 1px 2px rgba(17,24,39,0.04); }
table { width: 100%; border-collapse: collapse; min-width: 950px; }
th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); background: #f9fafb; padding: 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 14px 12px; border-bottom: 1px solid var(--line); vertical-align: top; font-size: 14px; }
tr:last-child td { border-bottom: 0; }
.empty { text-align: center; color: var(--muted); padding: 40px; }
.badge, .tag { display: inline-flex; align-items: center; border-radius: 999px; padding: 5px 9px; font-size: 12px; font-weight: 800; background: #eef2ff; color: #3730a3; margin-right: 6px; }
.badge-neu { background: #ecfeff; color: #155e75; }
.badge-eingeplant { background: #f0fdf4; color: #166534; }
.badge-rueckruf { background: #fff7ed; color: #9a3412; }
.badge-abgeschlossen { background: #f3f4f6; color: #374151; }
.badge-nicht_erreicht { background: #fef2f2; color: #991b1b; }
.badge-in_bearbeitung { background: #eff6ff; color: #1d4ed8; }
.flash, .warning { border: 1px solid var(--warning-border); background: var(--warning); padding: 12px 14px; border-radius: 14px; margin-bottom: 18px; font-weight: 700; }
.errors { color: #991b1b; }
.hint { margin-top: 18px; padding: 14px; background: #f9fafb; border: 1px solid var(--line); border-radius: 14px; color: var(--muted); line-height: 1.6; }
code { background: #f3f4f6; border-radius: 6px; padding: 2px 6px; color: #111827; }
.steps { line-height: 1.9; }
.grid.two { display: grid; grid-template-columns: minmax(0, 1fr) minmax(380px, 0.85fr); gap: 18px; align-items: start; }
.lead-hero { display: flex; justify-content: space-between; align-items: start; gap: 18px; background: #fff; border: 1px solid var(--line); border-radius: 18px; padding: 22px; margin-bottom: 18px; }
.quick-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.details { display: grid; grid-template-columns: 160px 1fr; gap: 10px 16px; }
.details dt { font-weight: 800; color: var(--muted); }
.details dd { margin: 0; overflow-wrap: anywhere; }
@media (max-width: 850px) {
  .container { padding: 18px; }
  .topnav { align-items: start; flex-direction: column; }
  .cards, .cards.compact { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.two { grid-template-columns: 1fr; }
  .lead-hero { flex-direction: column; }
}
@media (max-width: 560px) {
  .cards, .cards.compact { grid-template-columns: 1fr; }
  h1 { font-size: 28px; }
}
.card small { display: block; margin-top: 8px; color: var(--muted); font-weight: 600; line-height: 1.35; }
.dashboard-cards { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.bar { width: 150px; max-width: 100%; height: 10px; border-radius: 999px; background: #eef2f7; overflow: hidden; }
.bar span { display: block; height: 100%; min-width: 2px; background: #111827; border-radius: 999px; }
.settings-form { max-width: 520px; }
.table-wrap table .empty { text-align: center; }
@media (max-width: 850px) { .dashboard-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .dashboard-cards { grid-template-columns: 1fr; } }

.badge-geloescht { background: #111827; color: #ffffff; }
.actions.vertical { align-items: flex-start; flex-direction: column; }
.narrow { max-width: 560px; }

.badge-interessiert { background: #ecfdf5; color: #047857; }
.badge-nicht_interessiert { background: #fef2f2; color: #991b1b; }
.badge-termin { background: #eef2ff; color: #4338ca; }
.badge-nicht_qualifiziert { background: #f3f4f6; color: #374151; }
.badge-falsche_nummer { background: #fef2f2; color: #7f1d1d; }
.badge-entfernt { background: #111827; color: #ffffff; }

/* v4: stabile Tagesliste und manuelles Zuruecksetzen */
.today-cards { grid-template-columns: repeat(3, minmax(0, 1fr)); max-width: 760px; }
.badge-called { background: #ecfdf5; color: #047857; white-space: nowrap; }
.badge-open { background: #f3f4f6; color: #4b5563; white-space: nowrap; }
.called-row td { background: #f8fffb; }
.called-row:hover td { background: #f1fbf5; }
.row-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.mini-form { display: inline-flex; margin: 0; }
.mini-form button { white-space: nowrap; }
@media (max-width: 850px) { .today-cards { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 640px) { .today-cards { grid-template-columns: 1fr; } }


/* v5: kompakte Heute-Tabelle und Ansprechpartner in der Historie */
.button.tiny { padding: 5px 7px; border-radius: 8px; font-size: 11px; }
.today-table table { min-width: 820px; table-layout: fixed; }
.today-table th, .today-table td { padding: 10px 9px; }
.today-table th:nth-child(1) { width: 25%; }
.today-table th:nth-child(2) { width: 13%; }
.today-table th:nth-child(3) { width: 12%; }
.today-table th:nth-child(4) { width: 11%; }
.today-table th:nth-child(5) { width: 17%; }
.today-table th:nth-child(6) { width: 11%; }
.today-table th:nth-child(7) { width: 11%; }
.today-lead-cell { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.today-lead-copy { min-width: 0; overflow-wrap: anywhere; }
.today-lead-meta { display: block; margin-top: 3px; line-height: 1.35; }
.today-call-kind { margin-top: 6px; }
.today-state-tag { margin-top: 6px; background: #e0f2fe; color: #075985; }
.today-state-missing { background: #fff7ed; color: #9a3412; }
.today-open-button { flex: 0 0 auto; padding: 7px 9px; font-size: 12px; }
.attempt-stack { display: grid; gap: 4px; align-items: start; justify-items: start; }
.today-note { overflow-wrap: anywhere; line-height: 1.4; }
.today-table .badge { margin-right: 0; }
@media (max-width: 900px) {
  .today-table table { min-width: 760px; }
  .today-open-button { padding: 6px 8px; }
}

/* Live-Version */
.app-footer {
  max-width: 1220px;
  margin: 0 auto;
  padding: 4px 28px 28px;
  color: var(--muted);
  font-size: 12px;
  text-align: right;
}
.account-panel { max-width: 620px; }
.detail-grid {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 10px 16px;
  margin: 0;
}
.detail-grid dt { font-weight: 800; color: var(--muted); }
.detail-grid dd { margin: 0; overflow-wrap: anywhere; }
.system-info { max-width: 620px; }
@media (max-width: 560px) {
  .detail-grid { grid-template-columns: 1fr; gap: 4px; }
  .detail-grid dd { margin-bottom: 10px; }
  .app-footer { padding: 4px 18px 20px; text-align: left; }
}


/* v1.0.1: dynamische Folgeaktion, Pflicht-Rueckruf und sicheres Loeschen */
.callback-field[hidden] { display: none; }
.field-help { color: var(--muted); font-size: 12px; font-weight: 600; }
.status-action-preview {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 11px 12px;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.45;
}
.status-action-preview.tone-info { background: #eff6ff; border-color: #bfdbfe; color: #1e40af; }
.status-action-preview.tone-positive { background: #ecfdf5; border-color: #a7f3d0; color: #047857; }
.status-action-preview.tone-negative { background: #fef2f2; border-color: #fecaca; color: #991b1b; }
.status-action-preview.tone-warning { background: #fff7ed; border-color: #fed7aa; color: #9a3412; }
.button.danger, button.danger { background: #b91c1c; color: #ffffff; }
.button.danger:hover, button.danger:hover { background: #991b1b; }
.danger-zone { border-color: #fecaca; background: #fffafa; }
.danger-zone h2 { color: #991b1b; }

/* v1.0.3: Provisionen und erfolgreiches Erstgespraech */
.badge-commission-paid { background: #ecfdf5; color: #047857; white-space: nowrap; }
.badge-commission-open { background: #fff7ed; color: #9a3412; white-space: nowrap; }
.commission-cards { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.commission-inline-form { display: flex; gap: 8px; align-items: end; flex-wrap: wrap; margin: 0; }
.commission-inline-form label { min-width: 180px; }
.commission-inline-form input[type="date"] { min-width: 150px; }
.commission-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.commission-note { max-width: 320px; overflow-wrap: anywhere; }
.commission-panel { border-color: #fed7aa; }
.commission-paid-panel { border-color: #a7f3d0; background: #fbfffd; }
.commission-panel-head { display: flex; justify-content: space-between; gap: 18px; align-items: flex-start; }
.commission-panel-head p { margin: 0; }
.commission-success-flag { border: 1px solid #a7f3d0; background: #ecfdf5; color: #047857; border-radius: 12px; padding: 10px 12px; font-size: 13px; }
.commission-success-flag.muted { border-color: var(--line); background: #f9fafb; color: var(--muted); }
@media (max-width: 850px) {
  .commission-cards { grid-template-columns: 1fr; }
  .commission-panel-head { flex-direction: column; }
}
