/* Pipedrive / HubSpot – linke Sidebar, helles Arbeitsfeld */

:root {
  color-scheme: light;
  --sidebar-w: 220px;
  --sidebar-bg: #1d2128;
  --sidebar-border: rgba(255, 255, 255, 0.06);
  --sidebar-text: #9aa3b2;
  --sidebar-text-hover: #e8ecf1;
  --sidebar-active-bg: rgba(255, 255, 255, 0.08);
  --sidebar-accent: #3bcc9d;
  --main-bg: #eceef1;
  --surface: #ffffff;
  --surface-raised: #ffffff;
  --text: #2c3845;
  --text-soft: #516f90;
  --muted: #7c98b6;
  --line: #dfe3eb;
  --line-strong: #cbd6e2;
  --primary: #0091ae;
  --primary-hover: #007a94;
  --primary-soft: #e5f5f8;
  --primary-bright: #0091ae;
  --success: #00bda5;
  --warning: #f5a623;
  --danger: #f2545b;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 4px 12px rgba(0, 0, 0, 0.06);
  --shadow-soft: 0 1px 2px rgba(0, 0, 0, 0.06);
  --radius-lg: 8px;
  --radius-md: 6px;
  --radius-sm: 4px;
  --input-bg: #ffffff;
  --input-bg-focus: #ffffff;
  --glass-blur: 0;
  --glass-saturate: 1;
  --glass-inset: none;
}

body.crm-body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--text);
  background: var(--main-bg);
}

body.crm-body:has(.crm-shell) {
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

/* —— Shell —— */
.crm-shell {
  display: flex;
  height: 100%;
  min-height: 100dvh;
  width: 100%;
}

.crm-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--main-bg);
}

.crm-page-header {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 1.25rem;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  min-height: 56px;
}

.crm-page-title {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text);
}

.crm-page-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.crm-page-actions-group {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.crm-view {
  flex: 1;
  min-height: 0;
  overflow: auto;
}

.crm-view--fill {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.crm-view--fill > .crm-layout {
  flex: 1;
  min-height: 0;
}

/* —— Sidebar (Pipedrive-Stil) —— */
.crm-sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--sidebar-border);
  color: var(--sidebar-text);
}

.crm-sidebar-brand {
  padding: 1rem 1rem 0.75rem;
  flex-shrink: 0;
}

.crm-sidebar-logo {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  text-decoration: none;
  color: #fff;
}

.crm-sidebar-logo-mark {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--sidebar-accent), #2aa87a);
  color: #0d1a14;
  font-weight: 800;
  font-size: 0.95rem;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.crm-sidebar-logo-text {
  font-weight: 700;
  font-size: 0.92rem;
  letter-spacing: 0.04em;
}

.crm-sidebar-logo-img {
  display: block;
  height: 38px;
  width: auto;
  max-width: 100%;
  object-fit: contain;
}

.crm-global-search {
  position: relative;
  z-index: 20;
  padding: 0.5rem 0.75rem 0.35rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
}

.crm-global-search__field {
  position: relative;
}

.crm-global-search__label {
  display: block;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.55);
  margin-bottom: 0.35rem;
}

.crm-global-search__input {
  width: 100%;
  box-sizing: border-box;
  padding: 0.45rem 0.55rem;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: var(--radius-md);
  background: #ffffff;
  color: #1a1a1a;
  -webkit-text-fill-color: #1a1a1a;
  font: inherit;
  font-size: 0.8125rem;
  appearance: none;
  -webkit-appearance: none;
}

.crm-global-search__input::placeholder {
  color: #6b7280;
  opacity: 1;
}

.crm-global-search__input:focus {
  outline: none;
  border-color: rgba(0, 145, 174, 0.65);
  box-shadow: 0 0 0 2px rgba(0, 145, 174, 0.2);
}

.crm-global-search__results {
  position: absolute;
  left: 0.75rem;
  right: 0.75rem;
  top: calc(100% - 2px);
  z-index: 5;
  max-height: min(11rem, 40vh);
  overflow: auto;
  border-radius: var(--radius-md);
  background: #fff;
  border: 1px solid var(--border, #e2e8f0);
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.18);
  padding: 0.35rem 0;
}

.crm-global-search__empty {
  margin: 0;
  padding: 0.65rem 0.75rem;
  font-size: 0.8125rem;
}

.crm-global-search__section {
  padding: 0.15rem 0;
}

.crm-global-search__section + .crm-global-search__section {
  border-top: 1px solid var(--border, #e2e8f0);
}

.crm-global-search__section-title {
  margin: 0;
  padding: 0.4rem 0.75rem 0.25rem;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted, #64748b);
}

.crm-global-search__list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.crm-global-search__item {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  padding: 0.45rem 0.75rem;
  text-decoration: none;
  color: var(--text, #0f172a);
  transition: background 0.1s ease;
}

.crm-global-search__item:hover {
  background: rgba(0, 145, 174, 0.08);
}

.crm-global-search__item-type {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent, #0091ae);
}

.crm-global-search__item-sub {
  font-size: 0.75rem;
  color: var(--muted, #64748b);
}

.crm-sidebar-nav {
  position: relative;
  z-index: 6;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 0.35rem 0.65rem;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.crm-sidebar-group {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.crm-sidebar-group + .crm-sidebar-group {
  margin-top: 0.65rem;
  padding-top: 0.55rem;
  border-top: 1px solid var(--sidebar-border, rgba(255, 255, 255, 0.08));
}

.crm-sidebar-section-title {
  margin: 0.1rem 0 0.25rem;
  padding: 0 0.65rem;
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--sidebar-text, rgba(255, 255, 255, 0.55));
}

.crm-sidebar-bottom {
  flex-shrink: 0;
  position: relative;
  z-index: 6;
  padding: 0.4rem 0.65rem;
  border-top: 1px solid var(--sidebar-border, rgba(255, 255, 255, 0.08));
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.crm-sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  width: 100%;
  padding: 0.55rem 0.65rem;
  border: none;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--sidebar-text);
  font: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
  position: relative;
}

.crm-sidebar-link:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--sidebar-text-hover);
}

.crm-sidebar-link.is-active {
  background: var(--sidebar-active-bg);
  color: #fff;
}

.crm-sidebar-link.is-active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.35rem;
  bottom: 0.35rem;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--sidebar-accent);
}

.crm-sidebar-icon {
  width: 1.25rem;
  height: 1.25rem;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.85;
}

.crm-sidebar-icon svg {
  width: 100%;
  height: 100%;
}

.crm-sidebar-link.is-active .crm-sidebar-icon {
  opacity: 1;
  color: var(--sidebar-accent);
}

.crm-sidebar-footer {
  flex-shrink: 0;
  padding: 0.75rem 0.65rem 1rem;
  border-top: 1px solid var(--sidebar-border);
  display: grid;
  gap: 0.5rem;
}

.crm-sidebar-user {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  min-width: 0;
  padding: 0.35rem 0.25rem;
}

.crm-sidebar-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.crm-sidebar-user-text {
  display: grid;
  gap: 0.1rem;
  min-width: 0;
  overflow: hidden;
}

.crm-sidebar-user-text strong {
  font-size: 0.8rem;
  font-weight: 600;
  color: #fff;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.crm-sidebar-user-text small {
  font-size: 0.68rem;
  color: var(--sidebar-text);
}

.crm-sidebar-footer-btn {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.05);
  color: var(--sidebar-text-hover);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 500;
  padding: 0.45rem 0.6rem;
  cursor: pointer;
  transition: background 0.12s ease;
}

.crm-sidebar-footer-btn:hover {
  background: rgba(255, 255, 255, 0.1);
}

.crm-sidebar-footer-btn--logout {
  color: #f5a0a5;
  border-color: rgba(242, 84, 91, 0.25);
}

.crm-sidebar-logout {
  margin: 0;
}

/* —— Buttons (HubSpot-ähnlich) —— */
.btn-primary,
button[type="submit"] {
  background: var(--primary);
  color: #fff;
  border: 1px solid var(--primary);
  box-shadow: none;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.875rem;
}

.btn-primary:hover,
button[type="submit"]:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
  filter: none;
}

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--line-strong);
  box-shadow: none;
}

.btn-secondary:hover {
  background: #f5f8fa;
}

.btn-ghost {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--text-soft);
}

.btn-ghost:hover {
  background: #f5f8fa;
}

/* —— Panels & Karten —— */
.panel,
.board-section,
.stat-card,
.filter-bar,
.pipeline-topbar-details,
.modal-card,
.deal-card,
.phase-column,
.active-project-card,
.leads-sidebar,
.leads-workspace {
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-soft);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.panel {
  border-radius: var(--radius-lg);
}

.board-section {
  border-radius: var(--radius-lg);
}

.pipeline-topbar-details {
  background: var(--surface);
  border-color: var(--line);
}

.pipeline-topbar-details > summary:hover {
  background: #f5f8fa;
}

.phase-column {
  background: #f5f8fa;
  border-color: var(--line);
  box-shadow: none;
}

.deal-card {
  background: var(--surface);
  border-color: var(--line);
  box-shadow: var(--shadow-soft);
}

.deal-card:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow);
}

.link-btn {
  background: var(--primary-soft);
  border-color: transparent;
  color: var(--primary);
}

.link-btn:hover {
  background: #d0eef3;
}

.tag {
  background: var(--primary-soft);
  color: var(--primary);
  border-color: transparent;
}

.priority-hoch {
  background: #fde8e9;
  color: #c93b42;
}

.priority-mittel {
  background: #fff4e5;
  color: #b86e00;
}

.priority-niedrig {
  background: #e5f8f4;
  color: #008f7a;
}

.stat-card:hover {
  border-color: var(--line-strong);
  background: var(--surface);
}

/* Tabellen */
.customers-table th,
.products-table th,
.projects-table th,
.lead-sheet-table thead th {
  background: #f5f8fa;
  color: var(--muted);
}

.activity-feed li {
  background: #f5f8fa;
  border-color: var(--line);
}

.modal::backdrop {
  background: rgba(45, 62, 80, 0.45);
}

.modal-card {
  background: var(--surface);
  border-color: var(--line);
}

/* Pipeline viewport (:has + Klasse für ältere Browser / zuverlässiges SPA-Umschalten) */
body.crm-body:has(#viewPipeline:not(.hidden)),
body.crm-body.crm-pipeline-active {
  overflow: hidden;
}

body.crm-body:has(#viewPipeline:not(.hidden)) .crm-shell,
body.crm-body.crm-pipeline-active .crm-shell {
  height: 100dvh;
}

body.crm-body:has(#viewPipeline:not(.hidden)) #viewPipeline,
body.crm-body.crm-pipeline-active #viewPipeline {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#viewPipeline #crmApp.crm-layout {
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

/* Login */
.login-page {
  background: var(--main-bg);
}

.login-card {
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.brand-pill {
  background: var(--primary-soft);
  color: var(--primary);
  border: none;
}

/* Leads in Shell */
.leads-page-body .crm-shell .crm-main {
  overflow: hidden;
}

.leads-page-body .leads-app {
  flex: 1;
  min-height: 0;
  padding: 1rem 1.25rem;
}

.leads-page-body .leads-sidebar,
.leads-page-body .leads-workspace {
  max-height: none;
  border-radius: var(--radius-lg);
}

.lead-sheet-table tbody tr:nth-child(even) td {
  background: #fafbfc;
}

.lead-sheet-table tbody tr:hover td {
  background: var(--primary-soft);
}

.leads-list-menu-btn {
  background: var(--surface);
}

.leads-list-menu-btn.is-active {
  background: var(--primary-soft);
  color: var(--primary);
  border-color: var(--primary);
}

.leads-sheet-scroll {
  background: var(--surface);
}

.leads-page-body .lead-sheet-table thead th {
  background: #f5f8fa;
}

.leads-col-actions {
  background: var(--surface);
  box-shadow: -4px 0 8px rgba(0, 0, 0, 0.06);
}

.crm-app-toast {
  background: var(--text);
  color: #fff;
  border: none;
}

/* Alte Top-Nav ausblenden */
.topbar,
.crm-subnav {
  display: none !important;
}

@media (max-width: 900px) {
  :root {
    --sidebar-w: 64px;
  }

  .crm-sidebar-logo-text,
  .crm-sidebar-label,
  .crm-sidebar-user-text,
  .crm-sidebar-footer-btn {
    display: none;
  }

  .crm-sidebar-brand {
    padding: 0.75rem 0.5rem;
  }

  .crm-sidebar-logo {
    justify-content: center;
  }

  .crm-sidebar-link {
    justify-content: center;
    padding: 0.65rem;
  }

  .crm-sidebar-link.is-active::before {
    display: none;
  }

  .crm-sidebar-user {
    justify-content: center;
  }
}

.customer-products-panel {
  border-top: 1px solid var(--line);
  padding-top: 1rem;
  margin-top: 0.25rem;
}

.customer-process-panel {
  border-top: 1px solid var(--line);
  padding-top: 1rem;
  margin-top: 0.25rem;
}

.customer-process-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.customer-process-progress {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: var(--muted, #64748b);
  white-space: nowrap;
}

.customer-process-steps {
  list-style: none;
  margin: 0.35rem 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.customer-process-step {
  border: 1px solid var(--line, #e2e8f0);
  border-radius: var(--radius-sm);
  background: #fffdf3;
  transition: background 0.12s ease, border-color 0.12s ease;
}

.customer-process-step.is-done {
  background: #e7f6e3;
  border-color: #93d986;
}

.customer-process-step__label {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.55rem 0.7rem;
  cursor: pointer;
}

.customer-process-step__label input {
  width: 1.05rem;
  height: 1.05rem;
  flex-shrink: 0;
  accent-color: #5cb85c;
  cursor: pointer;
}

.customer-process-step__text {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.customer-process-step__text strong {
  font-size: 0.92rem;
  color: var(--text, #0f172a);
}

.customer-process-step.is-done .customer-process-step__text strong {
  text-decoration: line-through;
  text-decoration-color: rgba(15, 23, 42, 0.35);
}

.customer-process-step__duration {
  font-size: 0.75rem;
  color: var(--muted, #64748b);
}

.customer-products-hint {
  margin: 0.35rem 0 0.85rem;
  font-size: 0.88rem;
}

.customer-product-assign {
  margin-bottom: 1rem;
}

.customer-product-assign__label {
  margin: 0 0 0.5rem;
  font-weight: 600;
  font-size: 0.9rem;
}

.customer-product-checkboxes {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  max-height: 11rem;
  overflow: auto;
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #f8fafb;
}

.customer-product-checkbox {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  font-size: 0.9rem;
  cursor: pointer;
}

.customer-product-checkbox input {
  margin-top: 0.2rem;
}

.products-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.products-list-item__btn {
  width: 100%;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  text-align: left;
  cursor: pointer;
  font: inherit;
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.products-list-item__btn:hover {
  border-color: var(--line-strong);
  box-shadow: 0 2px 8px rgba(45, 62, 80, 0.06);
}

.products-list-item__main {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
}

.products-list-item__name {
  font-size: 1rem;
}

.products-list-item__meta {
  font-size: 0.88rem;
  color: var(--text-soft);
}

.products-list-item__desc {
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.4;
}

.products-list-item__side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.35rem;
  flex-shrink: 0;
}

.products-list-item__stat {
  font-size: 0.82rem;
  color: var(--text-soft);
  white-space: nowrap;
}

.product-detail-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 0.75rem 1rem;
}

.product-detail-back {
  flex-shrink: 0;
}

.product-detail-head__main {
  flex: 1;
  min-width: 12rem;
}

.product-detail-head__actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.danger-text {
  color: #c93b42;
}

.product-detail-toolbar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--line);
}

.product-detail-period-label {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-soft);
}

.product-detail-period-select {
  min-width: 11rem;
  padding: 0.4rem 0.55rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font: inherit;
  background: var(--surface);
}

.product-detail-section {
  margin-bottom: 1.75rem;
}

.product-detail-section__title {
  margin: 0 0 0.75rem;
  font-size: 1rem;
}

.product-detail-description {
  line-height: 1.55;
  color: var(--text);
  white-space: pre-wrap;
}

.product-detail-description.is-empty {
  color: var(--muted);
  font-style: italic;
}

.product-detail-stats {
  margin-bottom: 1rem;
}

.product-revenue-form {
  margin-top: 1.25rem;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: #f8fafb;
}

.product-revenue-form__title {
  margin: 0 0 0.75rem;
  font-size: 0.95rem;
}

.product-revenue-form__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr));
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.product-detail-customers-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
  gap: 1.25rem;
}

.product-detail-customers-col h4 {
  margin: 0 0 0.5rem;
  font-size: 0.9rem;
}

.product-detail-customer-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.product-detail-customer-link {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.45rem 0.6rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font: inherit;
  cursor: pointer;
  color: var(--primary);
}

.product-detail-customer-link:hover {
  background: var(--primary-soft);
  border-color: var(--primary);
}

/* Durchsuchbare Kundenauswahl */
.customer-search-picker-label > .customer-search-picker,
.customer-search-picker-label .customer-search-picker {
  display: block;
  width: 100%;
  margin-top: 0.25rem;
}

.customer-search-picker {
  position: relative;
}

.customer-search-picker__native {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.customer-search-picker__input {
  width: 100%;
  padding: 0.45rem 0.55rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font: inherit;
  color: #111;
  background: var(--surface);
}

.customer-search-picker__input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-soft);
}

.customer-search-picker__list {
  position: absolute;
  z-index: 40;
  left: 0;
  right: 0;
  top: calc(100% + 2px);
  max-height: 14rem;
  overflow-y: auto;
  margin: 0;
  padding: 0.25rem 0;
  list-style: none;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
}

.customer-search-picker__option {
  padding: 0.45rem 0.65rem;
  font-size: 0.9rem;
  cursor: pointer;
  color: var(--text);
}

.customer-search-picker__option:hover,
.customer-search-picker__option--active {
  background: var(--primary-soft);
  color: var(--primary);
}

.revenue-tracking-add-form .customer-search-picker__input,
.product-revenue-form__grid .customer-search-picker__input {
  min-width: 0;
}

/* Suchfelder in Reitern (Deals, Kunden, Produkte, Projekte, Leads) */
.pipeline-topbar-body .filter-group input[type="search"],
#searchInput,
#customerSearchInput,
#productSearchInput,
#projectSearchInput,
.leads-search-input,
.leads-filter-select {
  color: var(--text);
  background-color: #ffffff;
  -webkit-text-fill-color: var(--text);
}

.pipeline-topbar-body .filter-group input[type="search"]::placeholder,
#searchInput::placeholder,
#customerSearchInput::placeholder,
#productSearchInput::placeholder,
#projectSearchInput::placeholder,
.leads-search-input::placeholder {
  color: var(--muted);
  opacity: 1;
}

.crm-global-search__item strong {
  color: var(--text, #0f172a);
  font-weight: 600;
}

/* Termin vereinbaren: assets/appointments.css */

/* —— Aufgaben, Win/Loss, Sidebar-Badge —— */
.crm-sidebar-link {
  position: relative;
}

.crm-sidebar-badge {
  margin-left: auto;
  min-width: 1.25rem;
  padding: 0.1rem 0.4rem;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 1.3;
  text-align: center;
}

.tasks-panel-full {
  max-width: 880px;
}

.tasks-filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.tasks-filter-btn.is-active {
  background: var(--primary-soft);
  border-color: var(--primary);
  color: var(--primary);
}

.tasks-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.75rem;
}

.tasks-list__item {
  padding: 1rem 1.1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: #fafbfc;
}

.tasks-list__item--overdue {
  border-color: #f5b8bb;
  background: #fff5f5;
}

.tasks-list__head {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  margin-bottom: 0.5rem;
}

.tasks-list__head strong {
  font-size: 1rem;
}

.tasks-list__step {
  margin: 0 0 0.25rem;
  font-size: 0.92rem;
}

.tasks-list__due {
  margin: 0 0 0.65rem;
  font-size: 0.85rem;
  color: var(--text-soft);
}

.tasks-list__item--overdue .tasks-list__due {
  color: var(--danger);
  font-weight: 600;
}

.tasks-list__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.pipeline-winloss {
  padding: 1rem 1.1rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background: #fafbfc;
}

.pipeline-winloss__title {
  margin: 0 0 0.75rem;
  font-size: 0.95rem;
  font-weight: 700;
}

.pipeline-winloss__stats {
  margin-bottom: 1rem;
}

.pipeline-winloss__chart-label {
  margin: 0 0 0.5rem;
  font-size: 0.82rem;
}

.pipeline-winloss__bars {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.45rem;
}

.pipeline-winloss__bar-row {
  display: grid;
  grid-template-columns: minmax(8rem, 1fr) 2fr auto;
  gap: 0.5rem;
  align-items: center;
  font-size: 0.85rem;
}

.pipeline-winloss__bar-track {
  height: 8px;
  border-radius: 4px;
  background: var(--line);
  overflow: hidden;
}

.pipeline-winloss__bar-fill {
  height: 100%;
  border-radius: 4px;
  background: var(--primary);
  min-width: 2px;
}

.pipeline-winloss__bar-value {
  font-weight: 600;
  color: var(--text-soft);
}

.deal-phase-probability-hint {
  grid-column: 1 / -1;
  margin: -0.25rem 0 0;
  font-size: 0.82rem;
}

.deal-probability-row {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0.35rem 0 0.15rem;
}

.deal-probability-label {
  font-size: 0.72rem;
  color: var(--muted);
  white-space: nowrap;
}

.deal-probability-select {
  flex: 1;
  min-width: 0;
  max-width: 100%;
  padding: 0.2rem 0.45rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
}

.deal-card--overdue {
  border-color: #f5b8bb !important;
  box-shadow: 0 0 0 1px rgba(242, 84, 91, 0.15);
}

.tag--lost-reason {
  background: #fde8e9;
  color: #c93b42;
}
