/* Daumann CRM — Branding:
   Bitcoin Orange #F7931A · Anthrazit #1E1E1E · Teal #0D3D4E · Stahlblau #156082 */

@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@400;600;700;800&display=swap');

:root {
  --orange: #f7931a;
  --anthracite: #1e1e1e;
  --anthracite-2: #262626;
  --anthracite-3: #2f2f2f;
  --teal: #0d3d4e;
  --steel: #156082;
  --white: #ffffff;
  --text: #ececec;
  --text-muted: #9b9b9b;
  --border: #3a3a3a;
  --danger: #e05252;
  --radius: 10px;
  --font-head: "Montserrat", "Segoe UI", sans-serif;
  --font-body: "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--font-body);
  background: var(--anthracite);
  color: var(--text);
  font-size: 15px;
}

.layout { display: flex; min-height: 100vh; }

/* ---------------- Sidebar ---------------- */

.sidebar {
  width: 250px;
  flex-shrink: 0;
  background: linear-gradient(180deg, #181818 0%, var(--teal) 160%);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 22px 16px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand { display: flex; align-items: center; gap: 12px; margin-bottom: 34px; }

.brand-logo { width: 46px; height: 46px; color: var(--white); }

.brand-text { display: flex; flex-direction: column; }

.brand-name {
  font-family: var(--font-head);
  font-weight: 800;
  font-size: 15px;
  color: var(--white);
  line-height: 1.2;
}
.brand-name em { color: var(--orange); font-style: normal; }

.brand-claim { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

.demo-banner {
  background: repeating-linear-gradient(45deg, var(--orange), var(--orange) 12px, #e08312 12px, #e08312 24px);
  color: var(--anthracite);
  font-family: var(--font-head);
  font-weight: 800;
  font-size: 13px;
  text-align: center;
  border-radius: 8px;
  padding: 8px 10px;
  margin-bottom: 14px;
  letter-spacing: 0.05em;
}
.demo-banner span { font-weight: 600; font-size: 10px; letter-spacing: 0; }
.demo-reset {
  display: block;
  width: 100%;
  margin-top: 8px;
  padding: 5px 8px;
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0;
  color: var(--anthracite);
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid rgba(0, 0, 0, 0.25);
  border-radius: 6px;
  cursor: pointer;
}
.demo-reset:hover { background: #fff; }
.demo-reset:disabled { opacity: 0.6; cursor: default; }

.suche-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  background: var(--anthracite-3);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-muted);
  padding: 8px 12px;
  font-size: 13px;
  cursor: pointer;
  margin-bottom: 14px;
  font-family: var(--font-body);
}
.suche-btn:hover { border-color: var(--orange); color: var(--text); }
.suche-btn kbd {
  margin-left: auto;
  font-size: 10px;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 5px;
  color: var(--text-faint);
}

.woche-tag {
  background: var(--anthracite-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 12px;
}
.woche-tag.ist-heute { border-left: 3px solid var(--orange); }
.woche-tag-titel {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 14px;
  color: var(--white);
  margin-bottom: 6px;
}
.woche-tag.ist-heute .woche-tag-titel { color: var(--orange); }

.nav { display: flex; flex-direction: column; gap: 4px; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--text-muted);
  text-decoration: none;
  font-family: var(--font-head);
  font-weight: 600;
  font-size: 14px;
  transition: background 0.15s, color 0.15s;
}
.nav-item:hover { background: rgba(255, 255, 255, 0.06); color: var(--text); }
.nav-item.active { background: var(--orange); color: var(--anthracite); }

.nav-icon { display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; flex-shrink: 0; }
.nav-icon svg { width: 100%; height: 100%; }

.sidebar-footer { margin-top: auto; font-size: 11px; color: var(--text-muted); padding: 8px 12px; }

/* ---------------- Main ---------------- */

.main { flex: 1; padding: 28px 36px; min-width: 0; }

.page-head {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 22px;
}

.page-title {
  font-family: var(--font-head);
  font-weight: 800;
  font-size: 26px;
  color: var(--white);
  border-bottom: 3px solid var(--orange);
  padding-bottom: 4px;
}

.spacer { flex: 1; }

/* ---------------- Stats cards ---------------- */

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; margin-bottom: 24px; }

.stat-card {
  background: var(--anthracite-2);
  border: 1px solid var(--border);
  border-top: 3px solid var(--steel);
  border-radius: var(--radius);
  padding: 16px;
}
.stat-card.accent { border-top-color: var(--orange); }
.stat-card.is-clickable { cursor: pointer; transition: border-color 0.15s, background 0.15s; }
.stat-card.is-clickable:hover { border-color: var(--orange); background: var(--anthracite-3); }

.stat-value { font-family: var(--font-head); font-weight: 800; font-size: 28px; color: var(--white); }
.stat-label { font-size: 12px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; margin-top: 2px; }

/* ---------------- Controls ---------------- */

.controls { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; }

input, select, textarea {
  background: var(--anthracite-3);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  padding: 9px 12px;
  font-size: 14px;
  font-family: var(--font-body);
  outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--orange); }

input[type="search"] { min-width: 260px; }

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

/* Zentrales Icon-Set (ersetzt Emoji): erbt Textfarbe via currentColor,
   Größe folgt dem umgebenden Schriftgrad (1em), leichter optischer Ausgleich mittig. */
.icon { display: inline-flex; width: 1em; height: 1em; vertical-align: -0.15em; flex-shrink: 0; }
.icon svg { width: 100%; height: 100%; }
.icon-obsidian { color: #a259ff; }

.btn {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 13px;
  padding: 9px 16px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  transition: filter 0.15s;
}
.btn:hover { filter: brightness(1.12); }

.btn-primary { background: var(--orange); color: var(--anthracite); }
.btn-ghost { background: transparent; color: var(--text-muted); border: 1px solid var(--border); }
.btn-ghost:hover { color: var(--text); }
.btn-danger { background: transparent; color: var(--danger); border: 1px solid var(--danger); }
.btn-sm { padding: 5px 10px; font-size: 12px; }

/* ---------------- Filter chips ---------------- */

.chips { display: flex; gap: 6px; }

.chip {
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  font-size: 13px;
  cursor: pointer;
  font-family: var(--font-head);
  font-weight: 600;
}
.chip.active { background: var(--steel); border-color: var(--steel); color: var(--white); }

.chip-label {
  align-self: center;
  font-size: 12px;
  color: var(--text-muted);
  font-family: var(--font-head);
  font-weight: 600;
  min-width: 70px;
}

/* ---------------- Table ---------------- */

.table-wrap { overflow-x: auto; background: var(--anthracite-2); border: 1px solid var(--border); border-radius: var(--radius); }

table { width: 100%; border-collapse: collapse; }

th {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  text-align: left;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}

td { padding: 12px 16px; border-bottom: 1px solid #2a2a2a; }

tbody tr { cursor: pointer; transition: background 0.1s; }
tbody tr:hover { background: rgba(247, 147, 26, 0.07); }
tbody tr:last-child td { border-bottom: none; }

.cell-name { font-weight: 600; color: var(--white); }

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-family: var(--font-head);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.badge-lead { background: rgba(247, 147, 26, 0.18); color: var(--orange); }
.badge-kunde { background: rgba(21, 96, 130, 0.35); color: #7fc1e8; }
.badge-inaktiv { background: #333; color: var(--text-muted); }
.badge-akquise { background: rgba(92, 159, 196, 0.18); color: #9fc9e3; border: 1px dashed rgba(92, 159, 196, 0.5); }
.badge-blacklist { background: rgba(224, 82, 82, 0.18); color: var(--danger); }
.badge-partner { background: rgba(95, 191, 122, 0.18); color: #7bd696; }

.empty {
  text-align: center;
  color: var(--text-muted);
  padding: 48px 20px;
  font-style: italic;
}

/* ---------------- Detail view ---------------- */

.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 18px; margin-bottom: 8px; }
.detail-grid .full { grid-column: 1 / -1; }

/* Firmen-Detail: feste Spalten (links Stammdaten, rechts Links) statt Fluss-Platzierung,
   damit die Struktur firmenübergreifend identisch bleibt. */
.detail-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 32px; margin-bottom: 8px; align-items: start; }
.detail-col { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
@media (max-width: 640px) { .detail-cols { grid-template-columns: 1fr; } }

.field label {
  display: block;
  font-size: 12px;
  font-family: var(--font-head);
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.field input, .field select { width: 100%; }

.hint { font-size: 12px; color: var(--text-faint); margin-top: 5px; line-height: 1.4; }

.section-title {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 16px;
  color: var(--steel);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 28px 0 12px;
  color: #5c9fc4;
}

.person-card {
  background: var(--anthracite-2);
  border: 1px solid var(--border);
  border-left: 3px solid var(--steel);
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}
.person-name { font-weight: 600; color: var(--white); min-width: 160px; }
.person-meta { color: var(--text-muted); font-size: 13px; }
.person-actions { margin-left: auto; display: flex; gap: 6px; }

.back-link { color: var(--text-muted); text-decoration: none; font-size: 13px; }
.back-link:hover { color: var(--orange); }

/* ---------------- Dashboard ---------------- */

.banner {
  background: var(--orange);
  color: var(--anthracite);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 20px;
}

.banner-head {
  font-family: var(--font-head);
  font-weight: 800;
  font-size: 15px;
  margin-bottom: 8px;
}

.dash-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.dash-box {
  background: var(--anthracite-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}
.dash-box-wide { grid-column: 1 / -1; }

.dash-box-title {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #5c9fc4;
  margin-bottom: 10px;
}

.dash-sub {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin: 10px 0 4px;
}

.wv-row, .akt-row, .phase-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 8px;
  border-radius: 7px;
  cursor: pointer;
}
.wv-row:hover, .akt-row:hover, .phase-row:hover { background: rgba(255, 255, 255, 0.05); }
.wv-row.in-banner:hover { background: rgba(30, 30, 30, 0.12); }

.wv-check {
  width: 22px; height: 22px;
  border-radius: 6px;
  border: 1.5px solid currentColor;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font-size: 12px;
  line-height: 1;
  opacity: 0.5;
  flex-shrink: 0;
}
.wv-check:hover { opacity: 1; background: rgba(76, 175, 125, 0.25); }
.wv-row.in-banner .wv-check { color: var(--danger); opacity: 0.9; border-color: var(--danger); }
.wv-row.in-banner .wv-check:hover { opacity: 1; background: rgba(224, 82, 82, 0.2); }

.wv-text, .akt-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wv-firma, .akt-firma { font-size: 12px; opacity: 0.7; white-space: nowrap; }
.wv-datum, .akt-datum { font-size: 12px; font-weight: 700; font-family: var(--font-head); white-space: nowrap; }
.in-banner .wv-datum { color: var(--anthracite); }
.dash-box .wv-datum { color: var(--orange); }

.akt-icon { flex-shrink: 0; }

.phase-name { flex: 1; font-weight: 600; color: var(--white); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.phase-count { font-size: 12px; color: var(--text-muted); white-space: nowrap; }
.phase-wert { font-family: var(--font-head); font-weight: 700; font-size: 13px; color: var(--orange); white-space: nowrap; }

/* ---------------- Aktivitäten (Firma-Detail) ---------------- */

.akt-add {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.akt-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: var(--anthracite-2);
  border: 1px solid var(--border);
  border-left: 3px solid var(--steel);
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 6px;
}
.akt-item.is-overdue { border-left-color: var(--orange); }
.akt-item.is-overdue .akt-icon { color: var(--danger); }
.akt-item.is-done { opacity: 0.55; }
.akt-item.is-done .akt-text { text-decoration: line-through; }

.akt-body { flex: 1; min-width: 0; }
.akt-item .akt-text { white-space: normal; }
.akt-meta { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* Ausklappbares Anruf-Transkript (Fonio) */
.akt-transkript { margin-top: 6px; font-size: 13px; }
.akt-transkript > summary { cursor: pointer; color: var(--steel); font-weight: 600; user-select: none; list-style: none; display: inline-flex; align-items: center; gap: 5px; }
.akt-transkript > summary svg { width: 15px; height: 15px; }
.akt-transkript > summary::-webkit-details-marker { display: none; }
.akt-transkript[open] > summary { margin-bottom: 6px; }
.akt-transkript-body { white-space: pre-wrap; word-break: break-word; max-height: 320px; overflow-y: auto; padding: 10px 12px; background: rgba(255,255,255,0.05); border-left: 3px solid var(--steel); border-radius: 4px; color: var(--text); line-height: 1.5; }

/* Dashboard „Letzte Aktivitäten": klare Spalten Datum · Firma · Aktivität.
   Firma gedeckelt (max 180px), Text mit Mindestbreite, damit die Text-Spalte in
   schmalen (halbbreiten) Boxen nicht auf 0 kollabiert. */
.akt-row-cols { display: grid; grid-template-columns: 86px minmax(70px, 180px) minmax(90px, 1fr); align-items: baseline; gap: 12px; }
.akt-row-cols .akt-datum { color: var(--text); }
.akt-row-cols .akt-firma { opacity: 1; font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.akt-haupt { min-width: 0; display: flex; align-items: baseline; gap: 7px; flex-wrap: wrap; }
.akt-haupt .akt-icon { flex-shrink: 0; }
.akt-haupt .akt-text { flex: 1 1 auto; min-width: 0; }
.akt-haupt .akt-transkript { flex-basis: 100%; margin-top: 4px; }
@media (max-width: 640px) {
  .akt-row-cols { grid-template-columns: 74px 1fr; }
  .akt-row-cols .akt-haupt { grid-column: 1 / -1; }
}

/* Dashboard-Wiedervorlagen: gleiche Spalten wie „Letzte Aktivitäten", damit beide
   Bereiche exakt fluchten. Firma per minmax gedeckelt (max 180px) — bläht sich in der
   vollbreiten Box nicht auf, kann in der halbbreiten Box aber schrumpfen. */
.wv-row-cols { display: grid; grid-template-columns: 86px minmax(70px, 180px) minmax(90px, 1fr); align-items: center; gap: 12px; }
.wv-row-cols .wv-firma { opacity: 1; font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.wv-row-cols .wv-datum { white-space: nowrap; }
.wv-haupt { min-width: 0; display: flex; align-items: center; gap: 8px; }
.wv-haupt .wv-check { flex-shrink: 0; }
.wv-haupt .wv-text { flex: 1 1 auto; min-width: 0; }
@media (max-width: 640px) {
  .wv-row-cols { grid-template-columns: 74px 1fr; }
  .wv-row-cols .wv-haupt { grid-column: 1 / -1; }
}

/* ---------------- Kanban (Pipeline) ---------------- */

.kanban {
  display: grid;
  grid-template-columns: repeat(6, minmax(180px, 1fr));
  gap: 12px;
  align-items: start;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.kanban::-webkit-scrollbar { display: none; }

/* Kachel-Zeile der Pipeline: gleiches 6-Spalten-Raster wie das Kanban,
   damit Gewonnen/Verloren exakt über ihren Spalten liegen */
.pipeline-stats {
  grid-template-columns: repeat(6, minmax(180px, 1fr));
  gap: 12px;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.pipeline-stats::-webkit-scrollbar { display: none; }
.pipeline-stats .span-2 { grid-column: span 2; }
.pipeline-stats .is-won-card { border-top-color: #4caf7d; }
.pipeline-stats .is-lost-card { border-top-color: #555; }
.pipeline-stats .is-forecast-card { border-top-color: var(--orange); border-top-style: dashed; }

/* Gewichteter Wert unter dem Spaltenkopf (nur offene Phasen) */
.kanban-col-forecast {
  font-size: 11px;
  font-weight: 700;
  color: var(--orange);
  opacity: 0.85;
  margin: -4px 0 8px;
}
.kanban-col-forecast .fc-prozent { color: var(--text-muted); font-weight: 400; }

.kanban-col {
  background: var(--anthracite-2);
  border: 1px solid var(--border);
  border-top: 3px solid var(--steel);
  border-radius: var(--radius);
  padding: 10px;
  min-height: 180px;
}
.kanban-col.is-won { border-top-color: #4caf7d; }
.kanban-col.is-lost { border-top-color: #555; opacity: 0.85; }
.kanban-col.drag-over { background: rgba(247, 147, 26, 0.08); border-color: var(--orange); }

.kanban-col-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 6px;
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 13px;
  color: var(--white);
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.kanban-col-sum { font-size: 11px; color: var(--orange); font-weight: 700; }

.kanban-cards { display: flex; flex-direction: column; gap: 8px; min-height: 40px; }

.deal-card {
  background: var(--anthracite-3);
  border: 1px solid var(--border);
  border-left: 3px solid var(--orange);
  border-radius: 8px;
  padding: 10px 12px;
  cursor: grab;
  transition: transform 0.1s, border-color 0.15s;
}
.deal-card:hover { border-color: var(--orange); }
.deal-card.dragging { opacity: 0.5; transform: rotate(2deg); }

.is-won .deal-card { border-left-color: #4caf7d; }
.is-lost .deal-card { border-left-color: #555; }

.deal-title { font-weight: 600; color: var(--white); font-size: 14px; }
.deal-firma { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.deal-foot { display: flex; justify-content: space-between; margin-top: 8px; }
.deal-wert { font-family: var(--font-head); font-weight: 700; font-size: 13px; color: var(--orange); }
.is-won .deal-wert { color: #4caf7d; }
.deal-datum { font-size: 11px; color: var(--text-muted); }
.deal-angebot { display: inline-flex; align-items: center; gap: 4px; margin-top: 8px; cursor: pointer; }
.deal-angebot:hover { text-decoration: underline; }

/* Phase badges (Firma-Detail) */
.badge-phase-erstkontakt, .badge-phase-qualifiziert { background: rgba(21, 96, 130, 0.35); color: #7fc1e8; }
.badge-phase-angebot, .badge-phase-verhandlung { background: rgba(247, 147, 26, 0.18); color: var(--orange); }
.badge-phase-gewonnen { background: rgba(76, 175, 125, 0.2); color: #4caf7d; }
.badge-phase-verloren { background: #333; color: var(--text-muted); }

/* ---------------- DSGVO ---------------- */

.einw-widerrufen { opacity: 0.55; }
.einw-widerrufen .person-name { text-decoration: line-through; }

/* ---------------- E-Mails ---------------- */

.email-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 7px 10px;
  border-radius: 7px;
  text-decoration: none;
  color: var(--text);
  background: var(--anthracite-2);
  border: 1px solid var(--border);
  margin-bottom: 5px;
}
.email-row:hover { border-color: var(--orange); }

.email-row { cursor: pointer; }

.email-gmail {
  font-size: 11px;
  color: var(--text-faint);
  text-decoration: none;
  white-space: nowrap;
  padding: 2px 6px;
  border: 1px solid var(--border);
  border-radius: 6px;
}
.email-gmail:hover { color: var(--orange); border-color: var(--orange); }

.email-inhalt {
  white-space: pre-wrap;
  background: var(--anthracite-3);
  border: 1px solid var(--border);
  border-left: 3px solid var(--steel);
  border-radius: 8px;
  padding: 12px 14px;
  margin: -2px 0 8px 26px;
  font-size: 13px;
  color: var(--text-muted);
  max-height: 400px;
  overflow-y: auto;
}

.email-dir { color: var(--steel); font-weight: 700; flex-shrink: 0; }
.email-betreff { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.email-von { font-size: 12px; color: var(--text-muted); max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.email-datum { font-size: 12px; font-family: var(--font-head); font-weight: 700; color: var(--crm-teal, #5c9fc4); color: #5c9fc4; white-space: nowrap; }

/* ---------------- KI ---------------- */

.briefing-text {
  white-space: pre-wrap;
  line-height: 1.6;
  background: var(--anthracite-3);
  border-left: 3px solid var(--orange);
  border-radius: 8px;
  padding: 12px 14px;
}
.briefing-text:empty { display: none; }

/* ---------------- Angebote ---------------- */

.badge-an-entwurf { background: #333; color: var(--text-muted); }
.badge-an-verschickt { background: rgba(247, 147, 26, 0.18); color: var(--orange); }
.badge-an-angenommen { background: rgba(76, 175, 125, 0.2); color: #4caf7d; }
.badge-an-abgelehnt { background: rgba(224, 82, 82, 0.15); color: var(--danger); }
.badge-re-gestellt { background: rgba(21, 96, 130, 0.35); color: #7fc1e8; }
.badge-re-bezahlt { background: rgba(76, 175, 125, 0.2); color: #4caf7d; }

.badge-pa-fertig { background: rgba(76, 175, 125, 0.2); color: #4caf7d; }
.badge-pa-verarbeitung { background: rgba(247, 147, 26, 0.18); color: var(--orange); }
.badge-pa-fehler { background: rgba(224, 82, 82, 0.15); color: var(--danger); }

.pa-meeting { margin-bottom: 8px; }
.pa-meeting-head {
  background: var(--anthracite-2);
  border: 1px solid var(--border);
  border-left: 3px solid var(--steel);
  border-radius: 8px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.pa-meeting-head-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.pa-meeting-teilnehmer { font-size: 13px; color: var(--text-muted); }
.pa-meeting-body {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border, #333);
  border-top: none;
  border-radius: 0 0 8px 8px;
  padding: 14px 18px;
  margin-top: -4px;
}
.pa-summary-h { font-weight: 600; color: var(--orange); margin: 12px 0 6px; }
.pa-summary-h:first-child { margin-top: 0; }
.pa-summary ul { margin: 0 0 10px; padding-left: 20px; }
.pa-summary li { margin-bottom: 4px; line-height: 1.5; }
.pa-summary p { line-height: 1.5; margin: 0 0 8px; }

.pa-action-items { margin-top: 14px; display: flex; flex-direction: column; gap: 6px; }
.pa-action-item { display: flex; gap: 8px; align-items: flex-start; font-size: 14px; }
.pa-action-item.done { opacity: 0.55; text-decoration: line-through; }
.pa-action-speaker { font-weight: 600; color: var(--orange); }
.pa-action-speaker.unklar { font-weight: 400; font-style: italic; color: var(--text-muted); }

.pa-transcript {
  margin-top: 10px;
  max-height: 400px;
  overflow-y: auto;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border, #333);
  border-radius: 8px;
  padding: 12px 14px;
}
.pa-transcript p { line-height: 1.5; margin: 0 0 8px; font-size: 14px; }

.pos-table th { background: transparent; }
.pos-table td { padding: 6px 6px 6px 0; border-bottom: none; }
.pos-table input, .pos-table textarea { width: 100%; }
.pos-table textarea { resize: vertical; }

.an-summen {
  margin-top: 14px;
  text-align: right;
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 14px;
}
.an-brutto {
  font-family: var(--font-head);
  font-weight: 800;
  font-size: 19px;
  color: var(--orange);
  border-top: 2px solid var(--orange);
  padding-top: 6px;
  margin-top: 4px;
}

/* ---------------- Modal ---------------- */

.modal-backdrop[hidden],
.toast[hidden] { display: none; }

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.modal {
  background: var(--anthracite-2);
  border: 1px solid var(--border);
  border-top: 4px solid var(--orange);
  border-radius: var(--radius);
  padding: 24px;
  width: min(560px, 92vw);
  max-height: 88vh;
  overflow-y: auto;
}

.modal h2 {
  font-family: var(--font-head);
  font-weight: 800;
  font-size: 20px;
  color: var(--white);
  margin-bottom: 18px;
}

.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }

/* ---------------- Toast ---------------- */

.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--teal);
  color: var(--white);
  border-left: 4px solid var(--orange);
  border-radius: 8px;
  padding: 12px 18px;
  font-size: 14px;
  z-index: 200;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.4);
}
.toast.error { background: #4a1f1f; border-left-color: var(--danger); }

/* ---------------- Zahlen (Auswertung) ---------------- */

.chart {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 10px 4px 0;
  min-height: 220px;
}
.chart-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  min-width: 0;
}
.chart-bar {
  width: 100%;
  max-width: 46px;
  background: linear-gradient(180deg, var(--orange), #c9770f);
  border-radius: 5px 5px 2px 2px;
  transition: height 0.3s ease;
}
.chart-bar.ist-leer { background: var(--anthracite-3); }
.chart-wert {
  font-size: 10px;
  font-weight: 700;
  color: var(--orange);
  white-space: nowrap;
}
.chart-label {
  font-size: 10px;
  color: var(--text-muted);
  white-space: nowrap;
}
.ist-klickbar { cursor: pointer; }
.ist-klickbar:hover td { background: rgba(247, 147, 26, 0.06); }

/* ---------------- Mobile (Fernzugriff via Tailscale) ---------------- */

@media (max-width: 768px) {
  .layout { flex-direction: column; }

  .sidebar {
    width: 100%;
    height: auto;
    position: static;
    padding: 12px 14px;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  .brand { margin-bottom: 12px; }
  .brand-logo { width: 34px; height: 34px; }
  .brand-claim { display: none; }

  .nav {
    flex-direction: row;
    overflow-x: auto;
    gap: 6px;
    padding-bottom: 2px;
    -webkit-overflow-scrolling: touch;
  }
  .nav-item { padding: 8px 12px; white-space: nowrap; flex-shrink: 0; }
  .nav-icon { display: none; }

  .sidebar-footer { display: none; }
  .suche-btn { margin-bottom: 10px; }
  .suche-btn kbd { display: none; }
  .demo-banner { margin-bottom: 10px; }

  .main { padding: 16px 14px 60px; }
  .page-title { font-size: 21px; }

  .detail-grid { grid-template-columns: 1fr; }
  .dash-grid { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .stat-value { font-size: 22px; }

  .kanban { grid-template-columns: repeat(6, 80vw); }
  /* Mobile: Kachel-Ausrichtung über den Spalten entfällt, normale 2er-Reihen */
  .pipeline-stats { grid-template-columns: repeat(2, 1fr); }
  .pipeline-stats .span-2 { grid-column: span 2; }

  .email-von, .akt-firma, .wv-firma { display: none; }
  .crm-task-src { display: none; }

  input[type="search"] { min-width: 0; width: 100%; }
  .controls { flex-direction: column; }
  .chips { overflow-x: auto; padding-bottom: 2px; }
  .chip { white-space: nowrap; flex-shrink: 0; }

  .modal { width: 94vw; padding: 16px; max-height: 92vh; }
  .person-card { flex-wrap: wrap; }
  .person-actions { margin-left: 0; width: 100%; justify-content: flex-end; }
}

/* ---------------- Dashboard placeholder ---------------- */

.placeholder-box {
  background: var(--anthracite-2);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 40px;
  text-align: center;
  color: var(--text-muted);
}
.placeholder-box strong { color: var(--orange); font-family: var(--font-head); }
