/* TechVantage – CRM UI (shared) */
@import url("https://fonts.googleapis.com/css2?family=Open+Sans:wght@400;500;600;700&display=swap");
:root{
  color-scheme: light;

  /* Calm, professional CRM palette */
  --bg: #f8fafc;
  --panel: #ffffff;
  --panel-2: #f1f5f9;
  --border: #e5e7eb;
  --text: #000000;
  --muted: #000000;
  --muted-2: #64748b;
  --accent: #388CFD;
  --accent-2: #805CFE;
  --accent-light: #4AD0FD;
  --danger: #dc2626;
  --success: #16a34a;
  --warn: #d97706;
  --shadow: 0 14px 38px rgba(15, 23, 42, 0.10);
  --shadow-sm: 0 2px 4px rgba(15, 23, 42, 0.05);

  --radius: 14px;
  --radius-sm: 12px;
  --gap: 5px;

  --sidebar-w: 240px;
  --sidebar-w-collapsed: 84px;
  --topbar-h: 64px;

  /* Typography */
  --font: "Open Sans", ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial;
  --fw-regular: 400;
  --fw-medium: 500;
  --fw-semibold: 600;
  --fw-bold: 700;
  --fs-xs: 12px;
  --fs-sm: 13px;
  --fs-md: 14px;
  --fs-lg: 16px;
  --fs-xl: 18px;
  --fs-2xl: 22px;
}

*{ box-sizing: border-box; }
html, body{ height: 100%; }
body{
  margin: 0;
  font-family: var(--font);
  font-size: var(--fs-md);
  font-weight: var(--fw-regular);
  color: var(--text);
  background: var(--panel); /* Usually bg, but panel looks cleaner for full page apps */
  background-color: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Never heavier than 700 */
strong, b{ font-weight: var(--fw-bold); }

a{ color: inherit; text-decoration: none; }
button{ font: inherit; }

/* Utility */
.hidden{ display: none !important; }
/* Native [hidden] darf nie von Author-CSS (z.B. display:flex) überschrieben werden */
[hidden]{ display: none !important; }

/* Form validation (JS): mark invalid fields */
.edit-input.is-invalid,
.edit-select.is-invalid{
  border-color: rgba(220, 38, 38, 0.65) !important;
}
.deal-search-input.is-invalid{
  border-color: rgba(220, 38, 38, 0.65) !important;
}
.crm-modal .btn.is-invalid{
  border-color: rgba(220, 38, 38, 0.65) !important;
}


.main code{
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: var(--fs-xs);
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.06);
  border: 1px solid rgba(15, 23, 42, 0.08);
}

.app{
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
}
.sidebar-collapsed .app{
  grid-template-columns: var(--sidebar-w-collapsed) 1fr;
}

.sidebar{
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 18px 14px;
  border-right: 1px solid var(--border);
  background: #f1f5f9;
  z-index: 10;
}

.brand{
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 10px 5px 2.5px;
  position: relative;
  cursor: pointer;
  width: 100%;
  border-radius: 14px;
  transition: background 0.15s ease;
}
.brand:hover{
  background: rgba(241, 245, 249, 0.65);
}
.brand::after{
  content: "";
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: currentColor;
  opacity: 0.7;
  transition: transform 160ms ease, opacity 160ms ease;
  -webkit-mask: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%20fill='none'%20stroke='black'%20stroke-width='2.5'%20stroke-linecap='round'%20stroke-linejoin='round'%3E%3Cpath%20d='m6%209%206%206%206-6'/%3E%3C/svg%3E") no-repeat center / contain;
  mask: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%20fill='none'%20stroke='black'%20stroke-width='2.5'%20stroke-linecap='round'%20stroke-linejoin='round'%3E%3Cpath%20d='m6%209%206%206%206-6'/%3E%3C/svg%3E") no-repeat center / contain;
}
.brand[aria-expanded="true"]::after{
  transform: rotate(180deg);
}
.brand:hover::after{
  opacity: 0.9;
}
.brand-mark{
  width: 50px;
  height: 50px;
  flex: 0 0 50px; /* nicht schrumpfen in Flex-Layouts (eingeklappt/Breakpoints) */
  display: block;
  border-radius: 0;
  background: url("./assets/brand-mark.svg") center / 50px 50px no-repeat; /* Bild kleiner */
  background-color: transparent;
  box-shadow: none;
}
.brand-title{
  display: flex;
  flex-direction: column;
  gap: 5px; /* mehr Abstand zwischen "TechVantage" und Name */
  line-height: 1.1;
}
.brand-title strong{ font-size: var(--fs-md); letter-spacing: 0.2px; }
.brand-title span{ font-size: var(--fs-xs); color: var(--muted); }

/* Sidebar Brand Dropdown (Settings Quicklinks) */
.sidebar-brand-menu{
  position: absolute;
  top: calc(100%);
  left: 0px;
  right: 0px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow);
  z-index: 120;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.sidebar-brand-menu[hidden]{ display: none; }
.sidebar-brand-menu-item{
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border: none;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  font-size: var(--fs-sm);
  font-weight: 600;
  text-align: left;
  transition: background 0.15s ease;
  border-bottom: 1px solid rgba(15, 23, 42, 0.05);
}
.sidebar-brand-menu-item:last-child{ border-bottom: none; }
.sidebar-brand-menu-item:hover{ background: rgba(241, 245, 249, 0.65); }
.sidebar-brand-menu-item:active{ background: var(--panel-2); }
.sidebar-brand-menu-item:focus-visible{
  outline: 2px solid rgba(56, 140, 253, 0.55);
  outline-offset: -2px;
}
.sidebar-brand-menu-item--danger{
  color: rgba(220, 38, 38, 0.95);
}
.sidebar-brand-menu-item--danger:hover{
  background: #F7E1DF;
}
.sidebar-brand-menu-icon{
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  display: inline-flex;
  background: currentColor;
  opacity: 0.9;
}
.sidebar-brand-menu-icon[data-icon="profile"]{
  -webkit-mask: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%20fill='none'%20stroke='black'%20stroke-width='2'%20stroke-linecap='round'%20stroke-linejoin='round'%3E%3Cpath%20d='M20%2021v-2a4%204%200%200%200-4-4H8a4%204%200%200%200-4%204v2'/%3E%3Ccircle%20cx='12'%20cy='7'%20r='4'/%3E%3C/svg%3E") no-repeat center / contain;
  mask: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%20fill='none'%20stroke='black'%20stroke-width='2'%20stroke-linecap='round'%20stroke-linejoin='round'%3E%3Cpath%20d='M20%2021v-2a4%204%200%200%200-4-4H8a4%204%200%200%200-4%204v2'/%3E%3Ccircle%20cx='12'%20cy='7'%20r='4'/%3E%3C/svg%3E") no-repeat center / contain;
}
.sidebar-brand-menu-icon[data-icon="availability"]{
  -webkit-mask: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%20fill='none'%20stroke='black'%20stroke-width='2'%20stroke-linecap='round'%20stroke-linejoin='round'%3E%3Crect%20x='3'%20y='4'%20width='18'%20height='18'%20rx='2'%20ry='2'/%3E%3Cline%20x1='16'%20y1='2'%20x2='16'%20y2='6'/%3E%3Cline%20x1='8'%20y1='2'%20x2='8'%20y2='6'/%3E%3Cline%20x1='3'%20y1='10'%20x2='21'%20y2='10'/%3E%3C/svg%3E") no-repeat center / contain;
  mask: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%20fill='none'%20stroke='black'%20stroke-width='2'%20stroke-linecap='round'%20stroke-linejoin='round'%3E%3Crect%20x='3'%20y='4'%20width='18'%20height='18'%20rx='2'%20ry='2'/%3E%3Cline%20x1='16'%20y1='2'%20x2='16'%20y2='6'/%3E%3Cline%20x1='8'%20y1='2'%20x2='8'%20y2='6'/%3E%3Cline%20x1='3'%20y1='10'%20x2='21'%20y2='10'/%3E%3C/svg%3E") no-repeat center / contain;
}
.sidebar-brand-menu-icon[data-icon="support"]{
  -webkit-mask: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%20fill='none'%20stroke='black'%20stroke-width='2'%20stroke-linecap='round'%20stroke-linejoin='round'%3E%3Ccircle%20cx='12'%20cy='12'%20r='10'/%3E%3Ccircle%20cx='12'%20cy='12'%20r='4'/%3E%3Cline%20x1='4.93'%20y1='4.93'%20x2='9.17'%20y2='9.17'/%3E%3Cline%20x1='14.83'%20y1='14.83'%20x2='19.07'%20y2='19.07'/%3E%3Cline%20x1='14.83'%20y1='9.17'%20x2='19.07'%20y2='4.93'/%3E%3Cline%20x1='4.93'%20y1='19.07'%20x2='9.17'%20y2='14.83'/%3E%3C/svg%3E") no-repeat center / contain;
  mask: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%20fill='none'%20stroke='black'%20stroke-width='2'%20stroke-linecap='round'%20stroke-linejoin='round'%3E%3Ccircle%20cx='12'%20cy='12'%20r='10'/%3E%3Ccircle%20cx='12'%20cy='12'%20r='4'/%3E%3Cline%20x1='4.93'%20y1='4.93'%20x2='9.17'%20y2='9.17'/%3E%3Cline%20x1='14.83'%20y1='14.83'%20x2='19.07'%20y2='19.07'/%3E%3Cline%20x1='14.83'%20y1='9.17'%20x2='19.07'%20y2='4.93'/%3E%3Cline%20x1='4.93'%20y1='19.07'%20x2='9.17'%20y2='14.83'/%3E%3C/svg%3E") no-repeat center / contain;
}
.sidebar-brand-menu-icon[data-icon="logout"]{
  -webkit-mask: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%20fill='none'%20stroke='black'%20stroke-width='2'%20stroke-linecap='round'%20stroke-linejoin='round'%3E%3Cpath%20d='M9%2021H5a2%202%200%200%201-2-2V5a2%202%200%200%201%202-2h4'/%3E%3Cpath%20d='M16%2017l5-5-5-5'/%3E%3Cpath%20d='M21%2012H9'/%3E%3C/svg%3E") no-repeat center / contain;
  mask: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%20fill='none'%20stroke='black'%20stroke-width='2'%20stroke-linecap='round'%20stroke-linejoin='round'%3E%3Cpath%20d='M9%2021H5a2%202%200%200%201-2-2V5a2%202%200%200%201%202-2h4'/%3E%3Cpath%20d='M16%2017l5-5-5-5'/%3E%3Cpath%20d='M21%2012H9'/%3E%3C/svg%3E") no-repeat center / contain;
}

.sidebar-collapsed .brand-title{ display: none; }
.sidebar-collapsed .brand{
  justify-content: center;
  padding-left: 0;
  padding-right: 0;
  gap: 0;
}
.sidebar-collapsed .brand::after{
  display: none;
}

.nav{
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 6px;
}
.nav a{
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  color: var(--text);
  position: relative;
  transition: all 0.2s;
}
.nav a:hover{
  background: rgba(15, 23, 42, 0.06);
  color: var(--text);
}
.nav a.active{
  background: rgba(56, 140, 253, 0.14);
  color: var(--accent);
}
.nav .icon{
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  position: relative;
  flex: 0 0 auto;
  color: var(--text);
}
.nav a:hover .icon{
  color: var(--text);
}
.nav a.active .icon{
  color: var(--accent);
}
.nav .icon svg{
  width: 20px;
  height: 20px;
  display: block;
}
.nav .label{
  font-size: var(--fs-sm);
  white-space: nowrap;
  flex: 1;
}
.nav .label-new{
  font-size: var(--fs-xs);
  color: var(--accent);
  font-weight: 500;
}
.nav .badge{
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--danger);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  border-radius: 999px;
  line-height: 1;
}
.sidebar-collapsed .nav .label{ display: none; }
.sidebar-collapsed .nav .label-new{ display: none; }

.sidebar-footer{
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  color: var(--muted-2);
  font-size: var(--fs-xs);
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.sidebar-footer .btn{
  width: 100%;
  justify-content: flex-start;
  min-height: 44px; /* identisch zur collapsed-Variante (44px), verhindert Höhen-Sprung */
  font-weight: 700;
  letter-spacing: 0.15px;
  gap: 12px; /* mehr Einzug + konsistent zwischen Icon und Text */
  padding-left: 45px;
}

/* Sidebar Footer Buttons: modern + konsistent */
.sidebar-footer [data-action='toggle-sidebar']{
  background: rgba(15, 23, 42, 0.03);
  border-color: rgba(15, 23, 42, 0.10);
  box-shadow: none;
}
.sidebar-footer [data-action='toggle-sidebar']:hover{
  background: rgba(56, 140, 253, 0.08);
  border-color: rgba(56, 140, 253, 0.22);
}
.sidebar-footer [data-action='toggle-sidebar']::before{
  content: "";
  width: 18px; /* fixe Icon-Spalte -> Text linksbündig untereinander */
  height: 18px;
  flex: 0 0 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%20fill='none'%20stroke='black'%20stroke-width='2.5'%20stroke-linecap='round'%20stroke-linejoin='round'%3E%3Cpath%20d='M15%2018l-6-6%206-6'/%3E%3C/svg%3E") no-repeat center / contain;
  mask: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%20fill='none'%20stroke='black'%20stroke-width='2.5'%20stroke-linecap='round'%20stroke-linejoin='round'%3E%3Cpath%20d='M15%2018l-6-6%206-6'/%3E%3C/svg%3E") no-repeat center / contain;
}
.sidebar-collapsed .sidebar-footer [data-action='toggle-sidebar']::before{
  -webkit-mask: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%20fill='none'%20stroke='black'%20stroke-width='2.5'%20stroke-linecap='round'%20stroke-linejoin='round'%3E%3Cpath%20d='M9%2018l6-6-6-6'/%3E%3C/svg%3E") no-repeat center / contain;
  mask: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%20fill='none'%20stroke='black'%20stroke-width='2.5'%20stroke-linecap='round'%20stroke-linejoin='round'%3E%3Cpath%20d='M9%2018l6-6-6-6'/%3E%3C/svg%3E") no-repeat center / contain;
}

.sidebar-footer .btn[data-action='logout']{
  border-color: rgba(15, 23, 42, 0.10);
  background: rgba(15, 23, 42, 0.03);
  color: var(--muted);
  box-shadow: none;
}
.sidebar-footer .btn[data-action='logout']:hover{
  border-color: #cbd5e1;
  background: var(--panel-2);
  color: var(--text);
}
.sidebar-footer [data-action='logout']::before{
  content: "⎋";
  font-size: var(--fs-lg);
  line-height: 1;
  width: 18px; /* fixe Icon-Spalte -> Text linksbündig untereinander */
  flex: 0 0 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Einstellungen Button (ersetzt Logout im Footer) */
.sidebar-footer .btn[data-action='settings']{
  border-color: rgba(15, 23, 42, 0.10);
  background: rgba(15, 23, 42, 0.03);
  color: var(--muted);
  box-shadow: none;
}
.sidebar-footer .btn[data-action='settings']:hover{
  border-color: #cbd5e1;
  background: var(--panel-2);
  color: var(--text);
}
.sidebar-footer [data-action='settings']::before{
  content: "";
  width: 18px;
  height: 18px;
  flex: 0 0 18px; /* fixe Icon-Spalte -> Text linksbündig untereinander */
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%20fill='none'%20stroke='black'%20stroke-width='2'%20stroke-linecap='round'%20stroke-linejoin='round'%3E%3Cpath%20d='M20%2021v-2a4%204%200%200%200-4-4H8a4%204%200%200%200-4%204v2'/%3E%3Ccircle%20cx='12'%20cy='7'%20r='4'/%3E%3C/svg%3E") no-repeat center / contain;
  mask: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%20fill='none'%20stroke='black'%20stroke-width='2'%20stroke-linecap='round'%20stroke-linejoin='round'%3E%3Cpath%20d='M20%2021v-2a4%204%200%200%200-4-4H8a4%204%200%200%200-4%204v2'/%3E%3Ccircle%20cx='12'%20cy='7'%20r='4'/%3E%3C/svg%3E") no-repeat center / contain;
  line-height: 1;
}

/* Settings Sidebar: Zurück-Button oben */
.settings-sidebar-top{
  margin-top: 10px;
  margin-bottom: 8px;
  display: flex;
}
.settings-sidebar-top .btn[data-action='settings-back']{
  width: 100%;
  border-color: transparent;
  background: transparent;
  color: var(--muted);
  box-shadow: none;
  justify-content: flex-start;
  border-radius: 14px;
}
.settings-sidebar-top .btn[data-action='settings-back']:hover{
  border-color: transparent;
  background: rgba(56, 140, 253, 0.08);
  color: var(--text);
}
.settings-sidebar-top [data-action='settings-back']::before{
  content: "";
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%20fill='none'%20stroke='black'%20stroke-width='2.5'%20stroke-linecap='round'%20stroke-linejoin='round'%3E%3Cpath%20d='m12%2019-7-7%207-7'/%3E%3Cpath%20d='M19%2012H5'/%3E%3C/svg%3E") no-repeat center / contain;
  mask: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%20fill='none'%20stroke='black'%20stroke-width='2.5'%20stroke-linecap='round'%20stroke-linejoin='round'%3E%3Cpath%20d='m12%2019-7-7%207-7'/%3E%3Cpath%20d='M19%2012H5'/%3E%3C/svg%3E") no-repeat center / contain;
}
.sidebar-collapsed .settings-sidebar-top .btn{
  width: 44px;
  height: 44px;
  min-height: 44px;
  padding: 0 13px;
  border-radius: 14px;
  justify-content: flex-start;
  gap: 0;
  border-color: transparent;
  background: transparent;
}
.sidebar-collapsed .settings-sidebar-top .label{
  display: none;
}
.sidebar-collapsed .settings-sidebar-top [data-action='settings-back']::before{
  margin-right: 0;
}

/* Availability (Verfügbarkeiten) */
.availability-head{
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.availability-head-actions{
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

/* Abwesenheit */
.absence-list{
  display: grid;
  gap: 8px;
  margin-top: 12px;
}
.absence-list:empty{
  margin-top: 0;
}
.absence-item{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(15, 23, 42, 0.08);
  background: rgba(255, 255, 255, 0.92);
}
.absence-item-title{
  font-weight: 700;
  font-size: var(--fs-sm);
}
.absence-item-sub{
  margin-top: 2px;
  color: var(--muted);
  font-size: var(--fs-xs);
  line-height: 1.35;
}
.absence-item-actions{
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}
.absence-action-btn{
  width: 40px;
  height: 40px;
  min-height: 40px;
  border-radius: 12px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.absence-action-btn::before{
  content: "";
  width: 18px;
  height: 18px;
  background: currentColor;
  display: inline-flex;
}
.absence-action-btn[data-action='absence-edit']::before{
  -webkit-mask: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%20fill='none'%20stroke='black'%20stroke-width='2'%20stroke-linecap='round'%20stroke-linejoin='round'%3E%3Cpath%20d='M12%2020h9'/%3E%3Cpath%20d='M16.5%203.5a2.121%202.121%200%200%201%203%203L7%2019l-4%201%201-4Z'/%3E%3C/svg%3E") no-repeat center / contain;
  mask: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%20fill='none'%20stroke='black'%20stroke-width='2'%20stroke-linecap='round'%20stroke-linejoin='round'%3E%3Cpath%20d='M12%2020h9'/%3E%3Cpath%20d='M16.5%203.5a2.121%202.121%200%200%201%203%203L7%2019l-4%201%201-4Z'/%3E%3C/svg%3E") no-repeat center / contain;
}
.absence-action-btn[data-action='absence-delete']::before{
  -webkit-mask: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%20fill='none'%20stroke='black'%20stroke-width='2'%20stroke-linecap='round'%20stroke-linejoin='round'%3E%3Cpath%20d='M3%206h18'/%3E%3Cpath%20d='M8%206V4h8v2'/%3E%3Cpath%20d='M6%206l1%2016h10l1-16'/%3E%3Cpath%20d='M10%2011v6'/%3E%3Cpath%20d='M14%2011v6'/%3E%3C/svg%3E") no-repeat center / contain;
  mask: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%20fill='none'%20stroke='black'%20stroke-width='2'%20stroke-linecap='round'%20stroke-linejoin='round'%3E%3Cpath%20d='M3%206h18'/%3E%3Cpath%20d='M8%206V4h8v2'/%3E%3Cpath%20d='M6%206l1%2016h10l1-16'/%3E%3Cpath%20d='M10%2011v6'/%3E%3Cpath%20d='M14%2011v6'/%3E%3C/svg%3E") no-repeat center / contain;
}
.absence-action-btn.danger:hover{
  background: #F7E1DF !important;
}

/* Abwesenheit Modal */
.crm-modal.absence-modal {
  width: min(900px, calc(100vw - 24px));
  max-width: 900px;
}
.crm-modal.absence-modal .crm-modal-foot{
  justify-content: flex-end;
}

/* Onboarding: Wait-Datum – kompakter Kalender-Modal (damit der komplette Monat sichtbar bleibt) */
.crm-modal.onboarding-wait-date-modal{
  width: min(560px, calc(100vw - 24px));
  max-width: 560px;
}
.crm-modal.onboarding-wait-date-modal .crm-modal-body{
  padding: 8px 14px;
}
.crm-modal.onboarding-wait-date-modal .absence-cal{
  padding: 10px 14px 14px 14px;
}
.absence-modal-grid{
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  min-height: 360px;
}
.absence-cal{
  padding: 10px 18px 18px 18px;
  border-right: 1px solid rgba(15, 23, 42, 0.08);
  min-width: 0;
}
.absence-cal-head{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}
.absence-cal-title{
  font-weight: 800;
}
.absence-cal-nav{
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.absence-cal-dow{
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.6px;
  margin-bottom: 8px;
}
.absence-cal-grid{
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}
.absence-cal-cell{
  aspect-ratio: 1 / 1;
  height: auto;
  min-height: 40px;
  border-radius: 12px;
  border: 1px solid transparent;
  background: rgba(15, 23, 42, 0.08);
  color: var(--text);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  display: grid;
  place-items: center;
  position: relative;
}
.absence-cal-cell.is-blank{
  background: transparent;
  border-color: transparent;
}
.absence-cal-cell.is-past{
  background: transparent;
  border-color: transparent;
  cursor: default;
  color: rgba(15, 23, 42, 0.65);
}
.absence-cal-cell.is-taken{
  background: rgba(15, 23, 42, 0.04);
  border-color: rgba(15, 23, 42, 0.06);
  color: rgba(15, 23, 42, 0.55);
  cursor: not-allowed;
  opacity: 0.85;
}
.absence-cal-cell.is-today::after{
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.95);
  position: absolute;
  left: 50%;
  bottom: 6px;
  transform: translateX(-50%);
}
.absence-cal-cell.is-day:hover{
  background: var(--panel-2);
}
.absence-cal-cell.is-selected{
  background: rgba(56, 140, 253, 0.12);
  border-color: rgba(56, 140, 253, 0.22);
}
.absence-form{
  padding: 10px 18px 18px 18px;
  min-width: 0;
}
.absence-window-row{
  display: grid;
  grid-template-columns: 112px 18px 112px 40px 40px;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
}
.absence-time{
  width: 112px;
}
.absence-mini-btn{
  width: 40px;
  height: 40px;
  min-height: 40px;
  border-radius: 12px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.absence-mini-btn.icon::before{
  content: "";
  width: 18px;
  height: 18px;
  background: currentColor;
  display: inline-flex;
  -webkit-mask: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%20fill='none'%20stroke='black'%20stroke-width='2'%20stroke-linecap='round'%20stroke-linejoin='round'%3E%3Cpath%20d='M3%206h18'/%3E%3Cpath%20d='M8%206V4h8v2'/%3E%3Cpath%20d='M6%206l1%2016h10l1-16'/%3E%3Cpath%20d='M10%2011v6'/%3E%3Cpath%20d='M14%2011v6'/%3E%3C/svg%3E") no-repeat center / contain;
  mask: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%20fill='none'%20stroke='black'%20stroke-width='2'%20stroke-linecap='round'%20stroke-linejoin='round'%3E%3Cpath%20d='M3%206h18'/%3E%3Cpath%20d='M8%206V4h8v2'/%3E%3Cpath%20d='M6%206l1%2016h10l1-16'/%3E%3Cpath%20d='M10%2011v6'/%3E%3Cpath%20d='M14%2011v6'/%3E%3C/svg%3E") no-repeat center / contain;
}

@media (max-width: 860px){
  .absence-modal-grid{
    grid-template-columns: 1fr;
  }
  .absence-cal{
    border-right: none;
    border-bottom: 1px solid rgba(15, 23, 42, 0.08);
  }
}
.availability-day{
  padding: 8px 0;
  border-top: 0;
  display: grid;
  grid-template-columns: minmax(130px, 150px) 1fr;
  column-gap: 10px;
  align-items: start;
}
.availability-day:first-child{
  border-top: 0;
  padding-top: 0;
}
.availability-day-head{
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  grid-column: 1;
  grid-row: 1;
  min-height: 40px; /* align with first time row height */
}
.availability-day-title{
  font-weight: 600;
  color: var(--text);
  font-size: var(--fs-sm);
  line-height: 1;
}
.availability-windows{
  margin-top: 0;
  display: grid;
  gap: 6px;
  grid-column: 2;
  grid-row: 1;
}
.availability-window-row{
  display: grid;
  grid-template-columns: 112px 18px 112px 40px 40px;
  align-items: center;
  gap: 8px;
}
.availability-window-row.no-remove{
  grid-template-columns: 112px 18px 112px 40px;
}
.availability-sep{
  text-align: center;
  color: var(--muted);
}
.availability-time{
  max-width: none;
  width: 112px;
  /* custom select arrow (positionable) */
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  padding-right: 34px; /* Platz für Pfeil */
  background-image: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%20fill='none'%20stroke='%2394a3b8'%20stroke-width='2.5'%20stroke-linecap='round'%20stroke-linejoin='round'%3E%3Cpath%20d='m6%209%206%206%206-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-size: 16px 16px;
  /* Pfeil bewusst etwas weiter links als default */
  background-position: calc(100% - 18px) 50%;
}
.availability-btn{
  padding: 0 10px;
  height: 40px;
  min-height: 40px;
  border-radius: 12px;
}
.availability-btn[data-action='availability-add']{
  width: 40px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  line-height: 1;
  font-weight: 700;
}
.availability-btn.icon{
  width: 40px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.availability-btn.icon::before{
  content: "";
  width: 18px;
  height: 18px;
  display: inline-flex;
  background: currentColor;
}
/* Trash icon (wie im Screenshot: Outline) */
.availability-btn[data-action='availability-remove']{
  /* gleiche Icon-Farbe wie Abwesenheiten-Delete (btn.danger) */
  color: #991b1b;
}
.availability-btn[data-action='availability-remove']::before{
  -webkit-mask: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%20fill='none'%20stroke='black'%20stroke-width='2'%20stroke-linecap='round'%20stroke-linejoin='round'%3E%3Cpath%20d='M3%206h18'/%3E%3Cpath%20d='M8%206V4h8v2'/%3E%3Cpath%20d='M6%206l1%2016h10l1-16'/%3E%3Cpath%20d='M10%2011v6'/%3E%3Cpath%20d='M14%2011v6'/%3E%3C/svg%3E") no-repeat center / contain;
  mask: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%20fill='none'%20stroke='black'%20stroke-width='2'%20stroke-linecap='round'%20stroke-linejoin='round'%3E%3Cpath%20d='M3%206h18'/%3E%3Cpath%20d='M8%206V4h8v2'/%3E%3Cpath%20d='M6%206l1%2016h10l1-16'/%3E%3Cpath%20d='M10%2011v6'/%3E%3Cpath%20d='M14%2011v6'/%3E%3C/svg%3E") no-repeat center / contain;
}
.availability-btn[data-action='availability-remove']:hover{
  background: #F7E1DF !important; /* override .btn.ghost:hover */
}
.availability-window-row.is-invalid .availability-time{
  border-color: rgba(239, 68, 68, 0.45);
}
.availability-has-errors .availability-day-hint{
  margin-top: 4px;
  color: rgba(239, 68, 68, 0.95);
}

@media (max-width: 520px){
  .availability-window-row{
    grid-template-columns: 1fr 18px 1fr 40px 40px;
  }
  .availability-window-row.no-remove{
    grid-template-columns: 1fr 18px 1fr 40px;
  }
  .availability-window-row [data-action='availability-remove']{
    grid-column: auto;
  }
}

/* Availability: small screens -> stack */
@media (max-width: 720px){
  .availability-day{
    grid-template-columns: 1fr;
    row-gap: 10px;
  }
  .availability-day-head{
    grid-column: 1;
    grid-row: 1;
  }
  .availability-windows{
    grid-column: 1;
    grid-row: 2;
    margin-top: 0; /* row-gap handles spacing */
  }
}

.sidebar-footer .btn:focus-visible{
  outline: none;
  box-shadow: none;
}
.sidebar-footer .btn[data-action='logout']:focus-visible{
  box-shadow: none;
}
.sidebar-footer .btn:active{
  transform: translateY(1px);
}

/* Eingeklappte Sidebar: Icon-only Buttons, keine Überlappungen */
.sidebar-collapsed .sidebar-footer{
  display: flex; /* override */
  align-items: center;
  gap: 5px;
}
.sidebar-collapsed .sidebar-footer .btn{
  width: 44px;
  height: 44px;
  min-height: 44px;
  /* Startposition wie "zentriert" im 44px Icon-Button:
     (44px - 18px Icon) / 2 = 13px */
  padding: 0 13px;
  border-radius: 14px;
  /* nicht zentrieren -> verhindert, dass das Icon beim Ausklappen erst ganz links startet */
  justify-content: flex-start;
  gap: 0;
}
.sidebar-collapsed .sidebar-footer .label{
  display: none;
}
.sidebar-collapsed .sidebar-footer [data-action='logout']::before,
.sidebar-collapsed .sidebar-footer [data-action='settings']::before{
  margin-right: 0;
}

.main{
  padding: 15px 12px 15px 12px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

/* Mobile Sidebar (Off-Canvas) */
.mobile-sidebar-toggle,
.mobile-sidebar-overlay{
  display: none;
}

@media (max-width: 900px){
  .app{ grid-template-columns: 1fr; }
  .sidebar-collapsed .app{ grid-template-columns: 1fr; }

  /* Drawer */
  .sidebar{
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: min(92vw, 360px);
    padding: 18px 14px;
    background: #fff;
    border-right: 1px solid var(--border);
    box-shadow: 0 18px 60px rgba(15, 23, 42, 0.22);
    transform: translateX(calc(-100% - 12px));
    transition: transform 200ms ease-out;
    z-index: 45; /* unter Modals (50+) */
  }
  body.mobile-sidebar-open .sidebar{
    transform: translateX(0);
  }

  /* Sehr kleine Screens: Drawer vollflächig (keine Überlappung rechts) */
  @media (max-width: 480px){
    .sidebar{
      width: 100vw;
      max-width: 100vw;
    }
  }

  /* Overlay */
  .mobile-sidebar-overlay{
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.35);
    opacity: 0;
    pointer-events: none;
    transition: opacity 160ms ease-out;
    z-index: 40; /* unter Sidebar, über Content */
  }
  body.mobile-sidebar-open .mobile-sidebar-overlay{
    opacity: 1;
    pointer-events: auto;
  }

  /* Toggle Button */
  .mobile-sidebar-toggle{
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    position: fixed;
    top: 12px;
    right: 12px;
    width: 44px;
    height: 44px;
    border-radius: 14px;
    border: 1px solid rgba(15, 23, 42, 0.10);
    background: rgba(255, 255, 255, 0.92);
    color: var(--text);
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    z-index: 46; /* über Overlay/Sidebar */
    -webkit-tap-highlight-color: transparent;
  }
  .mobile-sidebar-toggle:hover{
    background: var(--panel);
    border-color: rgba(56, 140, 253, 0.22);
  }
  .mobile-sidebar-toggle:active{
    transform: translateY(1px);
  }
  .mobile-sidebar-toggle:focus-visible{
    outline: 3px solid rgba(56, 140, 253, 0.35);
    outline-offset: 3px;
  }
  .mobile-sidebar-toggle svg{
    width: 18px;
    height: 18px;
    display: block;
  }

  /* Auf Mobile ist "collapsed" UX-unfreundlich -> visuell immer expanded */
  .sidebar-collapsed .brand-title{ display: flex; }
  .sidebar-collapsed .nav .label{ display: inline; }
  .sidebar-collapsed .brand{
    justify-content: flex-start;
    padding-left: 2.5px;
    padding-right: 10px;
    gap: 10px;
  }
  .sidebar-collapsed .sidebar-footer{
    align-items: stretch;
    gap: 5px;
  }
  .sidebar-collapsed .sidebar-footer .btn{
    width: 100%;
    height: auto;
    padding: 10px 12px;
    padding-left: 45px;
    justify-content: flex-start;
    gap: 12px;
    border-radius: 14px;
  }

  /* Desktop-Funktion (Einklappen) auf Mobile ausblenden */
  .sidebar-footer [data-action='toggle-sidebar']{
    display: none;
  }

  /* Platz für Hamburger (verhindert Überlappung ganz oben) */
  .main{
    padding-top: 62px;
  }

  /* Scroll-Lock wenn Drawer offen */
  body.mobile-sidebar-open{
    overflow: hidden;
  }
}


.topbar{
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  background: var(--bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  background: var(--panel);
}
.topbar-left{
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.topbar-actions{
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
}

.btn{
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  padding: 9px 12px;
  border-radius: 14px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.04);
  font-size: var(--fs-sm);
  font-weight: 600;
  transition: all 0.2s;
}
.btn:hover{ background: var(--panel-2); border-color: #cbd5e1; }
.btn.primary{
  border-color: rgba(56, 140, 253, 0.35);
  background: var(--accent);
  color: #fff;
  box-shadow: 0 2px 5px rgba(56, 140, 253, 0.2);
}
.btn.primary:hover{ filter: brightness(0.92); }
.btn.danger{
  border-color: rgba(220, 38, 38, 0.35);
  background: rgba(220, 38, 38, 0.08);
  color: #991b1b;
}
.btn.ghost{
  border-color: transparent;
  background: transparent;
  box-shadow: none;
}
.btn.ghost:hover{
  background: var(--panel-2);
}

/* Image upload (Customer Detail) */
.crm-image-dropzone{
  border: 1px dashed rgba(15, 23, 42, 0.22);
  border-radius: 14px;
  background: #EDF2FA;
  padding: 12px;
  cursor: pointer;
  user-select: none;
}
.crm-image-dropzone:hover{
  background: rgba(148, 163, 184, 0.12);
}
.crm-image-dropzone.is-dragover{
  border-color: rgba(56, 140, 253, 0.55);
  background: rgba(56, 140, 253, 0.08);
}
.crm-image-dropzone-title{
  font-weight: 700;
  color: var(--text);
}
.crm-image-dropzone-subtitle{
  margin-top: 2px;
  font-size: var(--fs-sm);
  color: var(--muted);
}
.crm-image-preview{
  margin-top: 10px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.crm-image-preview img{
  width: 56px;
  height: 56px;
  border-radius: 12px;
  object-fit: cover;
  border: 1px solid rgba(15, 23, 42, 0.12);
  background: #fff;
}
.crm-image-preview-meta{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex: 1;
  min-width: 0;
}
.crm-image-preview-name{
  font-weight: 700;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* WhatsApp: Template-Vorschau rechts im 999×650 Verhältnis */
body[data-page="customer-detail"] #customerWhatsappTemplatePreviewImg.crm-wa-template-img{
  height: auto;
  aspect-ratio: 999 / 600;
}

/* Customer Detail: Individuell AI Prompt (Expand + Panel-Editor) */
body[data-page="customer-detail"] .crm-ai-prompt-field{
  position: relative;
}
body[data-page="customer-detail"] #customerEditIndividuellAiPrompt{
  height: 140px;         /* Standardhöhe (kein Autogrow) */
  min-height: 340px;
  padding-right: 48px;  /* Platz für ↖-Button */
  resize: none;
  overflow-y: auto;     /* Override: global textarea.edit-input hat overflow:hidden */
  -webkit-overflow-scrolling: touch;
}
body[data-page="customer-detail"] .crm-ai-prompt-expand{
  position: absolute;
  right: 10px;
  bottom: 10px;
  width: 34px;
  height: 34px;
  border-radius: 12px;
  border: 1px solid rgba(15, 23, 42, 0.14);
  background: #fff;
  color: var(--muted);
  display: grid;
  place-items: center;
  cursor: pointer;
  user-select: none;
}
body[data-page="customer-detail"] .crm-ai-prompt-expand:hover{
  color: var(--text);
  border-color: rgba(15, 23, 42, 0.22);
  box-shadow: 0 10px 20px rgba(15, 23, 42, 0.10);
}
body[data-page="customer-detail"] .crm-ai-prompt-expand:active{
  transform: translateY(1px);
}

.crm-ai-prompt-modal{
  position: fixed;
  inset: 0;
  z-index: 1200; /* über Cropper (1000), unter Toast (falls 2^31) */
  pointer-events: none; /* Sidebar/Header bleiben klickbar */
}
.crm-ai-prompt-modal[hidden]{
  display: none;
}
.crm-ai-prompt-modal__backdrop{
  display: none; /* kein Fullscreen-Overlay */
}
.crm-ai-prompt-modal__panel{
  position: fixed;
  left: var(--crmAiPromptLeft, 12px);
  top: var(--crmAiPromptTop, 12px);
  width: var(--crmAiPromptWidth, 520px);
  bottom: 14px; /* wie Card-Abstand (customer-section-card margin-bottom) */
  background: #fff;
  display: flex;
  flex-direction: column;
  min-height: 0;
  pointer-events: auto;
  border-left: 1px solid rgba(15, 23, 42, 0.12);
  border-right: 1px solid rgba(15, 23, 42, 0.12);
  border-top: 1px solid rgba(15, 23, 42, 0.12);
  border-bottom: 1px solid rgba(15, 23, 42, 0.12);
  border-top-left-radius: 14px;
  border-top-right-radius: 14px;
  border-bottom-left-radius: 14px;
  border-bottom-right-radius: 14px;
  overflow: hidden; /* damit Inhalt/Scrollbar die Rundung respektiert */
}
.crm-ai-prompt-modal__textarea{
  flex: 1;
  min-height: 0;
  width: 100%;
  border: 0;
  outline: none;
  background: #fff;
  color: var(--text);
  /* Panel-Editor Padding: oben 16px, links 20px, rechts 25px, unten extra Abstand */
  padding: 16px 30px 24px 30px;
  font: inherit;
  line-height: 1.4;
  resize: none;
  overflow: auto; /* wenn viel Text -> im Feld scrollen */
  box-sizing: border-box;
}

/* Crop Modal (Quadratisches Logo) */
.crm-modal-open{
  overflow: hidden;
}
.crm-crop-modal{
  position: fixed;
  inset: 0;
  z-index: 1000;
}
.crm-crop-modal__backdrop{
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(2px);
}
.crm-crop-modal__panel{
  position: relative;
  width: min(560px, calc(100% - 24px));
  margin: 28px auto;
  background: var(--panel);
  border: 1px solid rgba(15, 23, 42, 0.18);
  border-radius: 18px;
  box-shadow: 0 18px 50px rgba(15, 23, 42, 0.28);
  overflow: hidden;
}
.crm-crop-modal__head{
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 14px 10px 14px;
  border-bottom: 1px solid rgba(15, 23, 42, 0.10);
}
.crm-crop-modal__title{
  font-weight: 800;
  color: var(--text);
}
.crm-crop-modal__hint{
  margin-top: 2px;
  font-size: var(--fs-sm);
  color: var(--muted);
}
.crm-crop-modal__close{
  padding: 6px 10px;
  line-height: 1;
}
.crm-crop-modal__body{
  padding: 14px;
}
.crm-crop-viewport{
  position: relative;
  width: 100%;
  max-width: 420px;
  margin: 0 auto;
  aspect-ratio: 1 / 1;
  border-radius: 16px;
  /* Beim Rauszoomen kann "Hintergrund" sichtbar werden -> gleiche Fläche wie Rest-UI */
  background: var(--panel-2);
  border: 1px solid rgba(15, 23, 42, 0.12);
  overflow: hidden;
  cursor: grab;
  touch-action: none;
}
.crm-crop-viewport::before,
.crm-crop-viewport::after{
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  pointer-events: none;
  z-index: 12; /* immer vor dem Bild */
  opacity: 0.95;
}
.crm-crop-viewport::before{
  width: 100%;
  height: 1px;
  transform: translate(-50%, -50%);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.28);
}
.crm-crop-viewport::after{
  width: 1px;
  height: 100%;
  transform: translate(-50%, -50%);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.28);
}
.crm-crop-viewport.is-dragging{
  cursor: grabbing;
}
.crm-crop-viewport img{
  position: absolute; /* für z-index zuverlässig */
  width: auto;
  height: auto;
  max-width: none;
  max-height: none;
  z-index: 1;
  will-change: transform;
}
.crm-crop-controls{
  max-width: 420px;
  margin: 12px auto 0 auto;
  display: grid;
  grid-template-columns: 72px 1fr;
  align-items: center;
  gap: 10px;
}
.crm-crop-controls__label{
  font-size: var(--fs-sm);
  color: var(--muted);
  font-weight: 700;
}
.crm-crop-controls__range{
  width: 100%;
}
.crm-crop-modal__actions{
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 12px 14px 14px 14px;
  border-top: 1px solid rgba(15, 23, 42, 0.10);
}

/* WhatsApp Template Preview (Customer Detail) */
.crm-wa-preview{
  border-radius: 16px;
  border: 1px solid rgba(15, 23, 42, 0.12);
  background:
    radial-gradient(circle at 12px 12px, rgba(0,0,0,0.03) 2px, transparent 2px) 0 0/28px 28px,
    radial-gradient(circle at 2px 2px, rgba(0,0,0,0.02) 2px, transparent 2px) 0 0/22px 22px,
    #eaf3ee;
  padding: 18px;
}
.crm-wa-preview-inner{
  display: grid;
  place-items: center;
}
.crm-wa-template-card{
  width: min(520px, 100%);
  background: #ffffff;
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 10px 26px rgba(15, 23, 42, 0.08);
  border: 1px solid rgba(15, 23, 42, 0.10);
}
.crm-wa-template-img{
  width: 100%;
  height: 180px;
  object-fit: cover;
  display: block;
  background: #fff;
}
.crm-wa-template-text{
  padding: 16px 16px 14px 16px;
  font-size: 14px;
  line-height: 1.35;
  color: var(--text);
  white-space: pre-wrap; /* Zeilenumbrüche aus Template übernehmen */
}
.crm-wa-template-greeting{
  padding: 16px 16px 0 16px;
  font-size: 14px;
  line-height: 1.35;
  color: var(--text);
  font-weight: 400;
}
.crm-wa-template-greeting + .crm-wa-template-text{
  padding-top: 10px;
}
.crm-wa-template-text strong{ font-weight: 800; }
.crm-wa-template-text em{ font-style: italic; }
.crm-wa-template-text s{ text-decoration: line-through; }
.crm-wa-template-text a{
  color: var(--accent);
  text-decoration: underline;
  word-break: break-word;
}
.crm-wa-template-text code.wa-code{
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 0.95em;
  background: rgba(15, 23, 42, 0.06);
  border: 1px solid rgba(15, 23, 42, 0.10);
  padding: 1px 6px;
  border-radius: 8px;
}
.crm-wa-template-text code.wa-codeblock{
  display: block;
  margin-top: 8px;
  margin-bottom: 8px;
  white-space: pre-wrap;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 0.95em;
  background: rgba(15, 23, 42, 0.06);
  border: 1px solid rgba(15, 23, 42, 0.10);
  padding: 10px 12px;
  border-radius: 12px;
}
.crm-wa-template-cta{
  border-top: 1px solid rgba(15, 23, 42, 0.10);
  padding: 14px 16px;
  text-align: center;
  font-weight: 700;
  color: var(--accent);
  background: #fff;
}

/* WhatsApp Layout Helpers */
.crm-grid-2{
  display: grid; 
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 15px;
}
.crm-grid-2 > .task-field{ margin-bottom: 0; }

.crm-grid-3{
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px;
}
.crm-grid-3 > .task-field{ margin-bottom: 0; }
.crm-wa-split{
  display: grid;
  grid-template-columns: 1fr minmax(320px, 400px);
  gap: 16px;
  align-items: start;
}
@media (max-width: 900px){
  .crm-grid-2{ grid-template-columns: 1fr; }
  .crm-grid-3{ grid-template-columns: 1fr; }
  .crm-wa-split{ grid-template-columns: 1fr; }
}

/* Textarea: Auto-Höhe, nicht resizable */
textarea.crm-autogrow-textarea{
  resize: none !important;
  overflow: hidden;
  min-height: 44px;
}

/* Customer Header Avatar (Logo als Profilbild) */
body[data-page="customer-detail"] .customer-header-avatar-wrap{
  width: 55px;
  height: 55px;
  border-radius: 50%;
  box-sizing: border-box;
  padding: 10px; /* Abstand im Kreis */
  border: 1px solid rgba(15, 23, 42, 0.12);
  background: #fff;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}
body[data-page="customer-detail"] .customer-header-avatar-wrap:hover{
  border-color: rgba(15, 23, 42, 0.25);
  background: rgba(148, 163, 184, 0.08);
}

body[data-page="customer-detail"] .customer-header-avatar-img{
  width: 100%;
  height: 100%;
  object-fit: contain; /* nicht abschneiden */
  border-radius: 0; /* nicht abrunden */
  display: block;
}

body[data-page="customer-detail"] .customer-header-avatar-placeholder{
  font-size: 1.5rem;
  font-weight: 300;
  color: var(--muted);
  line-height: 1;
  user-select: none;
}

/* Generisches Disabled-Styling (auch für <a class="btn"> via aria-disabled) */
.btn.is-disabled,
.btn[aria-disabled="true"]{
  opacity: 0.55;
  pointer-events: none;
  cursor: default;
  box-shadow: none;
  transform: none;
}

/* Customer Detail: Wizard Choice Buttons (modern) */
body[data-page="customer-detail"] .crm-wizard-choices{
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
@media (max-width: 720px){
  body[data-page="customer-detail"] .crm-wizard-choices{
    grid-template-columns: 1fr;
  }
}
body[data-page="customer-detail"] .crm-wizard-choice{
  width: 100%;
  min-height: 54px;
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid rgba(15, 23, 42, 0.12);
  background: rgba(148, 163, 184, 0.12);
  color: var(--text);
  font-size: var(--fs-md);
  font-weight: 800;
  letter-spacing: 0.01em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  cursor: pointer;
  user-select: none;
  transition: transform 140ms ease, background 140ms ease, border-color 140ms ease, box-shadow 140ms ease;
}
body[data-page="customer-detail"] .crm-wizard-choice:hover{
  transform: translateY(-1px);
  background: rgba(148, 163, 184, 0.18);
  border-color: rgba(56, 140, 253, 0.22);
  box-shadow: 0 10px 20px rgba(15, 23, 42, 0.08);
}
body[data-page="customer-detail"] .crm-wizard-choice:active{
  transform: translateY(0px);
  box-shadow: 0 6px 12px rgba(15, 23, 42, 0.08);
}
body[data-page="customer-detail"] .crm-wizard-choice:focus-visible{
  outline: none;
  box-shadow:
    0 0 0 3px rgba(56, 140, 253, 0.22),
    0 10px 20px rgba(15, 23, 42, 0.08);
}
body[data-page="customer-detail"] .crm-wizard-choice.is-selected{
  background: linear-gradient(90deg, var(--accent-light) 0%, var(--accent) 100%);
  border-color: rgba(56, 140, 253, 0.45);
  color: #fff;
  box-shadow: 0 12px 26px rgba(56, 140, 253, 0.18);
}

/* Customer Detail: Wizard interlude page (white, not a step) */
body[data-page="customer-detail"] .crm-wizard-interlude{
  padding: 6px 0 0;
}
body[data-page="customer-detail"] .crm-wizard-interlude__card{
  width: min(560px, 100%);
  margin: 0 auto;
  background: var(--panel);
  border: 1px solid rgba(15, 23, 42, 0.12);
  border-radius: 22px;
  box-shadow: var(--shadow);
  padding: 18px 18px;
}
body[data-page="customer-detail"] .crm-wizard-interlude__head{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
body[data-page="customer-detail"] .crm-wizard-interlude__head .cjg-loading-spinner{
  width: 22px;
  height: 22px;
  border-width: 3px;
}
body[data-page="customer-detail"] .crm-wizard-interlude__title{
  font-weight: 900;
  color: var(--text);
  font-size: var(--fs-md);
}
body[data-page="customer-detail"] .crm-wizard-interlude__list{
  margin: 12px 0 0 18px;
  padding: 0;
  display: grid;
  gap: 8px;
  color: var(--text);
  font-weight: 500;
}


/* Icon-Buttons im Header */
#customerGoogleChatSpaceBtn img{
  display: block;
  width: 30px;
  height: 30px;
  object-fit: contain;
}

.content{
  margin-top: 0;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow-y: auto; /* Allow main scrolling */
  gap: var(--gap);
}

/* Deal-Detail: kein Seiten-Scroll – die Tabs/Panels scrollen innen */
body[data-page="deal-detail"] .content{
  overflow: hidden;
}

/* ---------- Deal Detail (Lead View) – Layout wie Screenshot ---------- */
body.deal-detail-leadview[data-page="deal-detail"] .content{
  /* Wichtig: kein Outer-Scroll in der Lead-View.
     Scroll soll innerhalb der Spalten/Threads passieren, damit das Kommentar-Input
     rechts unten immer sichtbar bleibt. */
  overflow: hidden;
  height: 100%;
  display: flex;
  flex-direction: column;
}

/* ---------- Customer Detail (Onboarding) – gleicher Scroll-Mechanismus ---------- */
body.deal-detail-leadview[data-page="customer-detail"] .content{
  overflow: hidden;
  height: 100%;
  display: flex;
  flex-direction: column;
}

body.deal-detail-leadview[data-page="customer-detail"] .detail-container{
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

body.deal-detail-leadview[data-page="customer-detail"] .lead-detail-card{
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

body.deal-detail-leadview[data-page="customer-detail"] .lead-card-columns{
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

body.deal-detail-leadview[data-page="customer-detail"] .lead-left{
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
}

body.deal-detail-leadview[data-page="deal-detail"] .lead-state-btn{
  height: 36px;
  padding: 8px 18px;
  border-radius: 12px;
  background: var(--panel);
  border: 1px solid rgba(15, 23, 42, 0.12);
  box-shadow: none;
}

/* Deal-Detail: "Nicht erreicht" 24h deaktiviert */
body.deal-detail-leadview[data-page="deal-detail"] .lead-state-btn[disabled]{
  background: rgba(148, 163, 184, 0.18); /* grau */
  border-color: rgba(148, 163, 184, 0.35);
  color: rgba(15, 23, 42, 0.55);
  opacity: 1; /* nicht zusätzlich ausblassen */
  cursor: default; /* kein Hand-Cursor */
  box-shadow: none;
  transform: none;
}
body.deal-detail-leadview[data-page="deal-detail"] .lead-state-btn[disabled]:hover{
  background: rgba(148, 163, 184, 0.18);
  border-color: rgba(148, 163, 184, 0.35);
  box-shadow: none;
  transform: none;
}

/* Anrufen Button: identisch zu .phone-fab aus Kundendashboard/leads-detail.html */
body.deal-detail-leadview[data-page="deal-detail"] .lead-call-fab{
  width: 35px;
  height: 35px;
  border-radius: 50%;
  background: linear-gradient(90deg, var(--accent-light) 0%, var(--accent) 100%);
  color: #ffffff;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.06);
  text-decoration: none;
}
body.deal-detail-leadview[data-page="deal-detail"] .lead-call-fab:hover{
  background: linear-gradient(90deg, #45c4f3 0%, #3796f0 100%);
  transform: scale(1.05);
  box-shadow: 0 2px 8px rgba(60, 160, 251, 0.14);
}
body.deal-detail-leadview[data-page="deal-detail"] .lead-call-fab:active{
  transform: scale(0.98);
}
body.deal-detail-leadview[data-page="deal-detail"] .lead-call-fab.is-disabled,
body.deal-detail-leadview[data-page="deal-detail"] .lead-call-fab[aria-disabled="true"]{
  opacity: 0.55;
  pointer-events: none;
}
body.deal-detail-leadview[data-page="deal-detail"] .lead-call-fab svg{
  width: 18px;
  height: 18px;
  display: block;
  fill: currentColor;
}

body.deal-detail-leadview[data-page="deal-detail"] .detail-container{
  /* soll bis zum Viewport-Boden reichen, darf aber mit Content wachsen */
  display: flex;
  flex-direction: column;
  gap: 14px;
  flex: 1 1 auto;
  min-height: 0;
}

body.deal-detail-leadview[data-page="deal-detail"] .lead-detail-card{
  background: var(--panel);
  border: 1px solid rgba(15, 23, 42, 0.10);
  border-radius: 18px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  /* füllt verfügbare Höhe, wächst bei mehr Content */
  flex: 1 1 auto;
  min-height: 0;
}

/* Deal-Detail: Verlustgrund Banner (oberhalb Header) */
body.deal-detail-leadview[data-page="deal-detail"] .deal-lost-banner{
  background: var(--danger);
  color: #fff;
  padding: 10px 18px;
  font-size: 14px;
  line-height: 1.3;
  border-bottom: 1px solid rgba(0, 0, 0, 0.20);
  display: flex;
  gap: 8px;
  align-items: baseline;
  white-space: normal;
}
/* Wichtig: hidden muss IMMER gewinnen (sonst überschreibt display:flex das UA-[hidden]) */
body.deal-detail-leadview[data-page="deal-detail"] .deal-lost-banner[hidden]{
  display: none !important;
}
body.deal-detail-leadview[data-page="deal-detail"] .deal-lost-banner strong{
  font-weight: 700;
}

body.deal-detail-leadview[data-page="deal-detail"] .lead-card-header{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 18px 14px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.15);
}
body.deal-detail-leadview[data-page="deal-detail"] .lead-card-header-main{
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  flex: 1 1 auto;
}
body.deal-detail-leadview[data-page="deal-detail"] .lead-card-actions{
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
}

/* Deal-Detail: Chat Modal */
body[data-page="deal-detail"] .deal-chat-modal{
  width: min(760px, calc(100vw - 24px));
  height: calc(100vh - 28px);
  max-height: calc(100vh - 28px);
}
body[data-page="deal-detail"] .deal-chat-body{
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1 1 auto;
  min-height: 0;
}
body[data-page="deal-detail"] .deal-chat-messages{
  flex: 1 1 auto;
  min-height: 0;
  height: auto;
  overflow: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Deal-Detail: Modal-Body soll volle Höhe nutzen */
body[data-page="deal-detail"] #dealChatModal .crm-modal-body{
  flex: 1 1 auto;
  min-height: 0;
}
body[data-page="deal-detail"] .deal-chat-msg{
  max-width: 86%;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(15, 23, 42, 0.10);
  background: var(--panel);
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.06);
}
body[data-page="deal-detail"] .deal-chat-msg.is-in{
  align-self: flex-start;
  background: #f8fafc;
}
body[data-page="deal-detail"] .deal-chat-msg.is-out{
  align-self: flex-end;
  background: rgba(59, 130, 246, 0.08);
  border-color: rgba(59, 130, 246, 0.22);
}
body[data-page="deal-detail"] .deal-chat-msg-meta{
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 4px;
}
body[data-page="deal-detail"] .deal-chat-msg-text{
  font-size: 14px;
  line-height: 1.4;
  word-break: break-word;
}

/* WhatsApp-like Markup in Chat (Modal) */
body[data-page="deal-detail"] .deal-chat-msg-text .wa-paragraph{
  display: block;
  margin: 0;
}
body[data-page="deal-detail"] .deal-chat-msg-text .wa-paragraph + .wa-paragraph{
  margin-top: 6px;
}
body[data-page="deal-detail"] .deal-chat-msg-text strong,
body[data-page="deal-detail"] .deal-chat-msg-text b{
  font-weight: 600;
}
body[data-page="deal-detail"] .deal-chat-msg-text .wa-inline-code{
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 12px;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.06);
  border: 1px solid rgba(15, 23, 42, 0.08);
}
body[data-page="deal-detail"] .deal-chat-msg-text .wa-codeblock{
  margin: 8px 0 0;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.04);
  border: 1px solid rgba(15, 23, 42, 0.08);
  overflow: auto;
  white-space: pre;
}
body[data-page="deal-detail"] .deal-chat-msg-text .wa-codeblock code{
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 12px;
}
body[data-page="deal-detail"] .deal-chat-msg-text .wa-quote{
  margin: 8px 0 0;
  padding-left: 12px;
  border-left: 3px solid rgba(56, 140, 253, 0.35);
  color: rgba(15, 23, 42, 0.85);
}
body[data-page="deal-detail"] .deal-chat-msg-text .wa-list{
  margin: 8px 0 0 18px;
  padding: 0;
}
body[data-page="deal-detail"] .deal-chat-msg-text .wa-list li{
  margin: 3px 0;
}
body[data-page="deal-detail"] .deal-chat-msg-time{
  margin-top: 6px;
  font-size: 11px;
  color: var(--muted);
  text-align: right;
}

body.deal-detail-leadview[data-page="deal-detail"] .lead-card-columns{
  display: grid;
  grid-template-columns: 420px 1fr;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

body.deal-detail-leadview[data-page="deal-detail"] .lead-left{
  padding: 14px 18px 18px;
  border-right: 1px solid rgba(15, 23, 42, 0.10);
  display: flex;
  flex-direction: column;
  gap: 12px;
  /* Wenn links höher als der Viewport wird, muss es hier scrollen können */
  overflow: auto;
  min-height: 0;
}

body.deal-detail-leadview[data-page="deal-detail"] .lead-name{
  font-size: 18px;
  line-height: 1.2;
  font-weight: 700;
  letter-spacing: 0;
  padding-bottom: 5px;
}
body.deal-detail-leadview[data-page="customer-detail"] #customerName{
  font-size: 18px;
  line-height: 1.2;
  font-weight: 700;
  letter-spacing: 0;
  padding-bottom: 5px;
}
body.deal-detail-leadview[data-page="customer-detail"] #customerNumber{
  font-size: 14px;
  color: var(--muted-2);
  font-weight: 500;
}
body.deal-detail-leadview[data-page="deal-detail"] .lead-phone-header{
  font-size: 14px;
  color: var(--muted-2);
  font-weight: 500;
}

body.deal-detail-leadview[data-page="deal-detail"] .lead-meta{
  display: flex;
  flex-direction: column;
  gap: 12px;
}
body.deal-detail-leadview[data-page="deal-detail"] .lead-meta-item{
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}


body.deal-detail-leadview[data-page="deal-detail"] #dealLeadInformationsItem .lead-meta-icon{
  align-self: flex-start;
  margin-top: 2px; /* optische Feinjustierung zur ersten Textzeile */
}
body.deal-detail-leadview[data-page="deal-detail"] .lead-meta-icon{
  width: 36px;
  height: 36px;
  border-radius: 12px;
  border: 1px solid rgba(15, 23, 42, 0.10);
  background: rgba(15, 23, 42, 0.03);
  display: grid;
  place-items: center;
  color: rgba(15, 23, 42, 0.72);
  flex: 0 0 auto;
}
body.deal-detail-leadview[data-page="deal-detail"] .lead-meta-icon svg{
  width: 18px;
  height: 18px;
}

/* Dealphase (Status) soll nicht fett sein */
body.deal-detail-leadview[data-page="deal-detail"] .lead-meta-text[data-deal="stage"]{
  font-weight: 400;
}

/* Info (i): informations – gleicher Mechanismus wie Kundendashboard (<details>/<summary>) */
body.deal-detail-leadview[data-page="deal-detail"] .lead-info-wrap{
  flex: 1 1 auto;
  min-width: 0;
}
body.deal-detail-leadview[data-page="deal-detail"] .lead-info-details{
  width: 100%;
}
body.deal-detail-leadview[data-page="deal-detail"] .lead-info-details summary{
  list-style: none;
  display: flex;
  align-items: center;
  cursor: pointer;
  font-weight: 400;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  max-width: 100%;
}
body.deal-detail-leadview[data-page="deal-detail"] .lead-info-details summary::-webkit-details-marker{
  display: none;
}
body.deal-detail-leadview[data-page="deal-detail"] .lead-info-preview{
  flex: 1 1 auto;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
body.deal-detail-leadview[data-page="deal-detail"] .lead-info-details[open] summary .lead-info-preview{
  display: none;
}
body.deal-detail-leadview[data-page="deal-detail"] .lead-info-content{
  white-space: pre-wrap;
  word-break: break-word;
  color: rgba(15, 23, 42, 0.92);
}
body.deal-detail-leadview[data-page="deal-detail"] .lead-info-content.has-multiline{
  padding-top: 10px;
}

body.deal-detail-leadview[data-page="deal-detail"] .lead-kv{
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  align-items: baseline;
  margin-top: 2px;
}
body.deal-detail-leadview[data-page="deal-detail"] .lead-kv .k{
  font-weight: 700;
  color: rgba(15, 23, 42, 0.75);
}
body.deal-detail-leadview[data-page="deal-detail"] .lead-kv .v{
  font-weight: 600;
  color: var(--text);
  min-width: 0;
}

body.deal-detail-leadview[data-page="deal-detail"] .lead-meta-link{
  font-weight: 700;
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

body.deal-detail-leadview[data-page="deal-detail"] .lead-question-label{
  font-weight: 700;
  color: rgba(15, 23, 42, 0.78);
  margin-bottom: 8px;
}
body.deal-detail-leadview[data-page="deal-detail"] .lead-question-answer{
  font-weight: 600;
  color: rgba(15, 23, 42, 0.92);
  line-height: 1.45;
}

body.deal-detail-leadview[data-page="deal-detail"] .lead-right{
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: 0;
  min-width: 0; /* wichtig: Grid-Child darf schrumpfen, sonst overflow */
  overflow: hidden; /* verhindert, dass die ganze rechte Spalte scrollt */
}

body.deal-detail-leadview[data-page="deal-detail"] .lead-summary-pill{
  display: inline-flex;
  align-items: center;
  gap: 10px;
  align-self: flex-start;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid rgba(56, 140, 253, 0.18);
  background: rgba(56, 140, 253, 0.08);
  font-weight: 700;
  letter-spacing: 0.6px;
  font-size: 12px;
}
body.deal-detail-leadview[data-page="deal-detail"] .lead-summary-sparkles{
  width: 18px;
  height: 18px;
  display: block;
  color: var(--accent);
  fill: currentColor;
}

/* SUMMARY: 1 Satz + ausklappbar via <details>/<summary> */
body.deal-detail-leadview[data-page="deal-detail"] .lead-summary-details{
  width: 100%;
  min-width: 0;
  border-bottom: 1px solid rgba(15, 23, 42, 0.10);
  background: rgba(15, 23, 42, 0.01);
}
body.deal-detail-leadview[data-page="deal-detail"] .lead-summary-details summary{
  list-style: none;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  padding: 16px 18px;
  user-select: none;
}
body.deal-detail-leadview[data-page="deal-detail"] .lead-summary-details summary::-webkit-details-marker{
  display: none;
}
body.deal-detail-leadview[data-page="deal-detail"] .lead-summary-details .lead-summary-pill{
  flex: 0 0 auto;
}
body.deal-detail-leadview[data-page="deal-detail"] .lead-summary-preview{
  flex: 1 1 auto;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 500;
  color: rgba(15, 23, 42, 0.92);
}
body.deal-detail-leadview[data-page="deal-detail"] .lead-summary-details[open] summary .lead-summary-preview{
  display: none;
}
body.deal-detail-leadview[data-page="deal-detail"] .lead-summary-chevron{
  flex: 0 0 auto;
  margin-left: auto; /* Chevron bleibt rechts, auch wenn Preview ausgeblendet wird */
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  border: 1px solid rgba(15, 23, 42, 0.10);
  background: rgba(15, 23, 42, 0.03);
  color: rgba(15, 23, 42, 0.72);
}
body.deal-detail-leadview[data-page="deal-detail"] .lead-summary-chevron svg{
  width: 16px;
  height: 16px;
  transition: transform 160ms ease;
}
body.deal-detail-leadview[data-page="deal-detail"] .lead-summary-details[open] .lead-summary-chevron svg{
  transform: rotate(180deg);
}
body.deal-detail-leadview[data-page="deal-detail"] .lead-summary-content{
  padding: 0 18px 16px 18px;
  line-height: 1.6;
  font-weight: 500;
  white-space: pre-wrap;
  word-break: break-word;
  color: rgba(15, 23, 42, 0.92);
}

/* Deal-Detail: Kommentarleiste */
body.deal-detail-leadview[data-page="deal-detail"] .deal-chat-history{
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  /* Muss bei kleiner Viewport-Höhe schrumpfen dürfen, damit das Input sichtbar bleibt */
  min-height: 0;
  width: 100%;
  margin: 0;
  border: none;
  border-radius: 0;
  background: transparent;
  overflow: hidden; /* Scroll liegt im Messages-Container */
}
body.deal-detail-leadview[data-page="deal-detail"] .deal-chat-history-header{
  display: none;
}
body.deal-detail-leadview[data-page="deal-detail"] .deal-chat-history-title{
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}
body.deal-detail-leadview[data-page="deal-detail"] .deal-chat-history-messages{
  flex: 1 1 auto;
  overflow-y: auto; /* Chat soll scrollbar bleiben */
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 0; /* darf schrumpfen, sonst drückt es das Input aus dem Viewport */
  padding: 12px 20px;
}
body.deal-detail-leadview[data-page="deal-detail"] .deal-chat-history-message{
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 14px;
  border-radius: 12px;
  max-width: 75%;
}
/* Eigene Nachrichten: rechts, blaue Farbe */
body.deal-detail-leadview[data-page="deal-detail"] .deal-chat-history-message.is-own{
  align-self: flex-end;
  background: rgba(59, 130, 246, 0.1);
  border: 1px solid rgba(59, 130, 246, 0.2);
  box-shadow: 0 1px 2px rgba(59, 130, 246, 0.1);
}
/* Andere Nachrichten: links, graue Farbe */
body.deal-detail-leadview[data-page="deal-detail"] .deal-chat-history-message.is-other{
  align-self: flex-start;
  background: rgba(15, 23, 42, 0.03);
  border: 1px solid rgba(15, 23, 42, 0.08);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}
body.deal-detail-leadview[data-page="deal-detail"] .deal-chat-history-message-header{
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  font-size: 12px;
  margin-bottom: 2px;
}
body.deal-detail-leadview[data-page="deal-detail"] .deal-chat-history-message-username{
  font-weight: 600;
  font-size: 13px;
}
/* Username-Farbe für eigene Nachrichten */
body.deal-detail-leadview[data-page="deal-detail"] .deal-chat-history-message.is-own .deal-chat-history-message-username{
  color: rgba(59, 130, 246, 0.9);
}
/* Username-Farbe für andere Nachrichten */
body.deal-detail-leadview[data-page="deal-detail"] .deal-chat-history-message.is-other .deal-chat-history-message-username{
  color: var(--accent);
}
body.deal-detail-leadview[data-page="deal-detail"] .deal-chat-history-message-time{
  color: var(--muted);
  font-size: 11px;
  text-align: right;
  margin-left: auto;
}
body.deal-detail-leadview[data-page="deal-detail"] .deal-chat-history-message-delete{
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  border-radius: 4px;
  opacity: 1;
  transition: opacity 0.2s, background-color 0.2s, color 0.2s;
}
body.deal-detail-leadview[data-page="deal-detail"] .deal-chat-history-message:hover .deal-chat-history-message-delete{
  opacity: 1;
}
body.deal-detail-leadview[data-page="deal-detail"] .deal-chat-history-message-delete:hover{
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
}
body.deal-detail-leadview[data-page="deal-detail"] .deal-chat-history-message-delete:active{
  background: rgba(239, 68, 68, 0.2);
}
body.deal-detail-leadview[data-page="deal-detail"] .deal-chat-history-message-text{
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
  margin: 0;
}
body.deal-detail-leadview[data-page="deal-detail"] .deal-chat-history-message-delete{
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  border-radius: 4px;
  opacity: 1;
  transition: opacity 0.2s, background-color 0.2s, color 0.2s;
  margin-left: 4px;
}
body.deal-detail-leadview[data-page="deal-detail"] .deal-chat-history-input{
  display: flex;
  gap: 8px;
  padding: 12px 10px;
  border-top: 1px solid rgba(15, 23, 42, 0.10);
  background: transparent;
  /* Falls sich irgendwo doch ein Outer-Scroll einschleicht: Input am unteren Rand halten */
  position: sticky;
  bottom: 0;
  z-index: 2;
}
body.deal-detail-leadview[data-page="deal-detail"] .deal-chat-history-textarea{
  flex: 1 1 auto;
  padding: 8px 12px;
  border: 1px solid rgba(15, 23, 42, 0.10);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  resize: none;
  min-height: 40px;
  height: auto;
  max-height: calc(1.5em * 7 + 16px); /* 7 Zeilen + Padding */
  line-height: 1.5;
  overflow-y: hidden;
  overflow-x: hidden;
  white-space: pre-wrap;
  word-wrap: break-word;
}
body.deal-detail-leadview[data-page="deal-detail"] .deal-chat-history-textarea:focus{
  outline: none;
  border-color: var(--accent);
}
body.deal-detail-leadview[data-page="deal-detail"] .deal-chat-history-send{
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  align-self: center;
  border-radius: 8px;
}

/* Mobile: Kommentare nur im Fullscreen-Overlay zeigen */
@media (max-width: 900px){
  body.deal-detail-leadview[data-page="deal-detail"] #dealChatHistory{
    display: none;
  }
  body.deal-detail-leadview[data-page="deal-detail"] #dealCommentsModal #dealChatHistory{
    display: flex;
  }
  /* Mobile: rechte Spalte komplett ausblenden (Kommentare laufen über Fullscreen-Overlay) */
  body.deal-detail-leadview[data-page="deal-detail"] .lead-right{
    display: none;
  }
}

body.deal-detail-leadview[data-page="deal-detail"] .lead-calls-empty{
  flex: 1 1 auto;
  min-height: 220px;
  border-left: 3px solid rgba(15, 23, 42, 0.10);
  padding-left: 18px;
  margin-left: 2px;
  color: rgba(15, 23, 42, 0.50);
  display: grid;
  place-items: center;
  font-weight: 700;
}

@media (max-width: 980px){
  body.deal-detail-leadview[data-page="deal-detail"] .lead-card-header{
    flex-direction: column;
    align-items: flex-start;
    position: relative;
  }
  body.deal-detail-leadview[data-page="deal-detail"] .lead-card-header-main{
    width: 100%;
  }
  /* Mobile Menü Button (drei Punkte) */
  .lead-mobile-menu-btn{
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    border: 1px solid rgba(15, 23, 42, 0.10);
    background: var(--panel);
    color: var(--text);
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.2s ease;
  }
  .lead-mobile-menu-btn:active{
    background: var(--panel-2);
    transform: scale(0.95);
  }
  .lead-mobile-menu-btn[hidden]{
    display: none;
  }
  /* Desktop: Menü-Button ausblenden, Buttons anzeigen */
  @media (min-width: 901px){
    .lead-mobile-menu-btn{
      display: none !important;
    }
    body.deal-detail-leadview[data-page="deal-detail"] .lead-card-actions{
      display: inline-flex;
    }
  }
  /* Mobile: Buttons ausblenden, Menü-Button anzeigen */
  body.deal-detail-leadview[data-page="deal-detail"] .lead-card-actions{
    display: none;
  }
  /* Mobile Menü Dropdown */
  .lead-mobile-menu{
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: var(--shadow);
    min-width: 200px;
    z-index: 100;
    overflow: hidden;
    display: flex;
    flex-direction: column;
  }
  .lead-mobile-menu[hidden]{
    display: none;
  }
  .lead-mobile-menu-item{
    display: flex;
    align-items: center;
    padding: 14px 18px;
    border: none;
    background: transparent;
    color: var(--text);
    text-decoration: none;
    cursor: pointer;
    font-size: var(--fs-sm);
    font-weight: 500;
    text-align: left;
    transition: background 0.15s ease;
    border-bottom: 1px solid rgba(15, 23, 42, 0.05);
  }
  .lead-mobile-menu-item:last-child{
    border-bottom: none;
  }
  .lead-mobile-menu-item:active{
    background: var(--panel-2);
  }
  .lead-mobile-menu-item:disabled{
    background: rgba(15, 23, 42, 0.06);
    color: var(--muted);
    cursor: not-allowed;
    opacity: 0.8;
    pointer-events: none; /* sicher: nicht klickbar */
  }
  .lead-mobile-menu-item:disabled:active{
    background: rgba(15, 23, 42, 0.06);
    transform: none;
  }
  .lead-mobile-menu-item span{
    flex: 1;
  }
  .lead-mobile-menu-badge{
    flex: 0 0 auto;
    min-width: 22px;
    height: 20px;
    padding: 0 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.2px;
    color: rgba(56, 140, 253, 0.95);
    background: rgba(56, 140, 253, 0.12);
    border: 1px solid rgba(56, 140, 253, 0.22);
  }
  body.deal-detail-leadview[data-page="deal-detail"] .lead-card-columns{
    grid-template-columns: 1fr;
  }
  body.deal-detail-leadview[data-page="deal-detail"] .lead-left{
    border-right: none;
    border-bottom: 1px solid rgba(15, 23, 42, 0.10);
  }
  body.deal-detail-leadview[data-page="deal-detail"] .lead-calls-empty{
    border-left: none;
    border-top: 3px solid rgba(15, 23, 42, 0.10);
    padding-left: 0;
    padding-top: 16px;
    margin-left: 0;
  }
}

/* ---------- Customer Detail: Header Kebab Menu (3 Punkte) ---------- */
body[data-page="customer-detail"] .crm-kebab-wrap{
  position: relative;
  flex: 0 0 auto;
}
body[data-page="customer-detail"] .crm-kebab-btn{
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid rgba(15, 23, 42, 0.10);
  background: var(--panel);
  color: var(--text);
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.2s ease;
  font-size: 18px;
  line-height: 1;
  padding: 0;
  user-select: none;
}
body[data-page="customer-detail"] .crm-kebab-btn:hover{
  background: var(--panel-2);
}
body[data-page="customer-detail"] .crm-kebab-btn:active{
  background: var(--panel-2);
  transform: scale(0.96);
}
body[data-page="customer-detail"] .crm-kebab-btn:focus-visible{
  outline: 2px solid rgba(56, 140, 253, 0.55);
  outline-offset: 2px;
}
body[data-page="customer-detail"] .crm-kebab-menu{
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow);
  min-width: 220px;
  z-index: 100;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
body[data-page="customer-detail"] .crm-kebab-menu[hidden]{
  display: none;
}
body[data-page="customer-detail"] .crm-kebab-menu-item{
  display: flex;
  align-items: center;
  padding: 14px 18px;
  border: none;
  background: transparent;
  color: var(--text);
  text-decoration: none;
  cursor: pointer;
  font-size: var(--fs-sm);
  font-weight: 600;
  text-align: left;
  transition: background 0.15s ease;
  border-bottom: 1px solid rgba(15, 23, 42, 0.05);
}
body[data-page="customer-detail"] .crm-kebab-menu-item:last-child{
  border-bottom: none;
}
body[data-page="customer-detail"] .crm-kebab-menu-item:hover{
  background: rgba(241, 245, 249, 0.65);
}
body[data-page="customer-detail"] .crm-kebab-menu-item:active{
  background: var(--panel-2);
}
body[data-page="customer-detail"] .crm-kebab-menu-item:focus-visible{
  outline: 2px solid rgba(56, 140, 253, 0.55);
  outline-offset: -2px;
}

/* Page actions (replaces removed topbar) */
.page-actions{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

/* Deal Detail: Suche */
.page-actions-left{
  flex: 1 1 auto;
  min-width: 0; /* wichtig: erlaubt, dass das Suchfeld sauber schrumpfen/umbruchfrei bleibt */
}
.page-actions-right{
  flex: 0 0 auto;
}
.page-actions-right{
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

/* Customer-Detail: rechts etwas Luft in den Page-Actions */
body[data-page="customer-detail"] .page-actions-right{
  margin-right: 15px;
}


/* Modern: runder + Button (FAB) */
.btn.btn-fab{
  width: 35px;
  height: 35px;
  padding: 0;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 25px;
  line-height: 1;
  transition: box-shadow 140ms ease, filter 140ms ease;
}
.btn.btn-fab:hover{
  filter: brightness(1.02);
}
.btn.btn-fab:active{
  filter: brightness(0.98);
}
.btn.btn-fab:focus-visible{
  outline: 3px solid rgba(56, 140, 253, 0.35);
  outline-offset: 3px;
}
.deal-search{
  flex: 1;
  min-width: 160px;
  max-width: 640px;
  position: relative;
}
.deal-search-input{
  width: 88%;
  height: 40px;
  padding: 8px 12px;
  border-radius: 14px;
  border: 1px solid rgba(15, 23, 42, 0.10);
  background: rgba(255, 255, 255, 0.92);
  color: var(--text);
  outline: none;
  transition: box-shadow 160ms ease, border-color 160ms ease, background 160ms ease;
}
/* Angebotserstellung: Suchfeld ohne Schatten (auch im Fokus) */
body[data-page="angebotserstellung"] #angebotSearchInput.deal-search-input{
  box-shadow: none !important;
}
/* Deals/Angebotserstellung: natives "X" (Search-Clear-Button) entfernen */
.deal-search-input[type="search"]::-webkit-search-cancel-button,
.deal-search-input[type="search"]::-webkit-search-decoration,
.deal-search-input[type="search"]::-webkit-search-results-button,
.deal-search-input[type="search"]::-webkit-search-results-decoration{
  -webkit-appearance: none;
  appearance: none;
  display: none;
}
.deal-search-input:focus{
  border-color: rgba(56, 140, 253, 0.55);
  background: var(--panel);
  box-shadow: none;
}
body[data-page="angebotserstellung"] #angebotSearchInput.deal-search-input:focus{
  box-shadow: none !important;
}
.deal-search-results{
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  width: 88%;
  z-index: 30;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow);
  overflow: hidden;
  max-height: 320px;
  overflow-y: auto;
}
.deal-search-item{
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  border: none;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.deal-search-item:hover,
.deal-search-item[aria-selected="true"]{
  background: var(--panel-2);
}
.deal-search-item strong{
  font-size: var(--fs-xs);
}
.deal-search-item span{
  font-size: var(--fs-xs);
  color: var(--muted);
}
.deal-search-item > strong,
.deal-search-item > span:not(.pill){
  display: block;
  padding-left: 11px;
}
.deal-search-empty{
  padding: 10px 12px;
  color: var(--muted);
  font-size: var(--fs-sm);
}

/* Kanban: Spalten bearbeiten */
#kanbanColumnsList{
  padding-top: 0px;
  padding-bottom: 0;
  padding-left: 12px;
  padding-right: 12px;
}

/* Global Toasts (oben rechts) */
.cjg-toast-host{
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 2147483647; /* vor ALLEM (auch vor sticky/fixed Header/Buttons) */
  width: min(420px, calc(100vw - 32px));
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none; /* nur Toast selbst klickbar */
}
.cjg-toast-host.is-bottom-right{
  top: auto;
  bottom: 16px;
  right: 16px;
  flex-direction: column-reverse; /* neue Toasts unten, stapeln nach oben */
}
.cjg-toast{
  pointer-events: auto;
  position: relative;
  display: block;
  padding: 12px 44px 12px 12px; /* rechts Platz für X */
  border-radius: 14px;
  border: 1.5px solid rgba(15, 23, 42, 0.14);
  background: #ffffff; /* vollständig deckend */
  box-shadow: var(--shadow);
  transform: translateY(-6px);
  opacity: 0;
  transition: transform 180ms ease-out, opacity 180ms ease-out;
}
.cjg-toast-host.is-bottom-right .cjg-toast{
  transform: translateY(6px); /* von unten nach oben */
}
.cjg-toast.is-visible{
  transform: translateY(0);
  opacity: 1;
}
.cjg-toast-message{
  font-weight: 700;
  color: var(--text);
  line-height: 1.35;
  word-break: break-word;
}
.cjg-toast-close{
  position: absolute;
  top: 8px;
  right: 8px;
  border: none;
  background: transparent;
  color: var(--muted);
  border-radius: 10px;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  cursor: pointer;
  line-height: 1;
  padding: 0;
}
.cjg-toast-close:hover{
  color: var(--text);
}
.cjg-toast.is-success{
  border-color: rgba(22, 163, 74, 0.42);
  background: #dcfce7; /* deckend (klareres Grün) */
  border-left: 6px solid var(--success);
}
.cjg-toast.is-success .cjg-toast-message{
  color: rgb(20, 83, 45);
}
.cjg-toast.is-error{
  border-color: rgba(220, 38, 38, 0.44);
  background: #fee2e2; /* deckend (klareres Rot) */
  border-left: 6px solid var(--danger);
}
.cjg-toast.is-error .cjg-toast-message{
  color: rgb(127, 29, 29);
}
@media (max-width: 700px){
  .cjg-toast-host{
    top: 12px;
    right: 12px;
    width: min(420px, calc(100vw - 24px));
  }
  .cjg-toast-host.is-bottom-right{
    top: auto;
    bottom: 12px;
    right: 12px;
  }
}

.grid{
  display: grid;
  gap: var(--gap);
}
.grid.cols-4{ grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.cols-6{ grid-template-columns: repeat(6, minmax(0, 1fr)); }
.grid.cols-2{ grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 1100px){
  .grid.cols-4{ grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.cols-6{ grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 700px){
  .app{ grid-template-columns: 1fr; }
  .sidebar-collapsed .app{ grid-template-columns: 1fr; }
  .grid.cols-4, .grid.cols-6, .grid.cols-2{ grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.cols-2:has(#upcoming-events), .grid.cols-2:has(#top-deals){ grid-template-columns: 1fr; }
}

.card{
  border: 1px solid var(--border);
  background: var(--panel);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow-sm);
}
.card h3{
  margin: 0 0 5px 0;
  font-size: 0.9rem;
  color: var(--muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.kpi{
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 4px;
}
.kpi .value{
  font-size: var(--fs-2xl);
  font-weight: 700;
  letter-spacing: 0.2px;
  line-height: 1.1;
}
.kpi .hint{
  font-size: var(--fs-xs);
  color: var(--muted);
}

.list{
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.list-item{
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 10px;
  border-radius: 14px;
  background: var(--panel-2);
  border: 1px solid rgba(15, 23, 42, 0.06);
}
.list-item.is-clickable{
  cursor: pointer;
  transition: background 140ms ease, border-color 140ms ease, box-shadow 140ms ease;
}
.list-item.is-clickable:hover{
  background: rgba(56, 140, 253, 0.10);
  border-color: rgba(56, 140, 253, 0.22);
}
.list-item.is-clickable:focus-visible{
  outline: 2px solid rgba(56, 140, 253, 0.55);
  outline-offset: 2px;
}
.list-item.is-live{
  background: rgba(22, 163, 74, 0.12);
  border-color: rgba(22, 163, 74, 0.28);
  box-shadow: 0 0 0 2px rgba(22, 163, 74, 0.10) inset;
}
.list-item strong{ font-size: var(--fs-sm); }
.list-item span{ font-size: var(--fs-xs); color: var(--muted); }

/* Dashboard: Info Banner (Early Access) */
body[data-page="dashboard"] .dash-info-banner{
  background: rgba(56, 140, 253, 0.10);
  border: 1px solid rgba(56, 140, 253, 0.22);
  border-radius: var(--radius);
  padding: 14px 14px;
  margin: 0 0 14px 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  box-shadow: var(--shadow-sm);
}
body[data-page="dashboard"] .dash-info-banner-text{
  min-width: 0;
}
body[data-page="dashboard"] .dash-info-banner-body{
  margin: 6px 0 0 0;
  color: var(--muted-2);
  line-height: 1.45;
}
body[data-page="dashboard"] .dash-info-banner-body:first-child{ margin-top: 0; }
body[data-page="dashboard"] .dash-info-banner-close{
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid rgba(56, 140, 253, 0.30);
  background: rgba(255, 255, 255, 0.65);
  color: rgba(15, 23, 42, 0.80);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
body[data-page="dashboard"] .dash-info-banner-close:hover{
  background: rgba(255, 255, 255, 0.92);
  border-color: rgba(56, 140, 253, 0.45);
}
@media (max-width: 700px){
  body[data-page="dashboard"] .dash-info-banner{
    padding: 12px 12px;
  }
}

/* Dashboard: Zeitraum + Mini-Charts */
body[data-page="dashboard"] .card h3{
  text-transform: none;
  letter-spacing: 0.15px;
}
body[data-page="dashboard"] .kpi-inline{
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
body[data-page="dashboard"] .kpi-trend{
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  font-size: var(--fs-sm);
  font-weight: 700;
  color: var(--success);
  letter-spacing: 0.1px;
}
body[data-page="dashboard"] .kpi-trend-arrow{
  font-size: 14px;
  line-height: 1;
  transform: translateY(0);
}
@media (max-width: 700px){
  body[data-page="dashboard"] .kpi-trend{
    font-size: var(--fs-md);
  }
}
body[data-page="dashboard"] .kpi .hint{
  color: var(--muted-2);
}
body[data-page="dashboard"] .list-item span{
  color: var(--muted-2);
}
body[data-page="dashboard"] .dash-card-head .pill{
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
body[data-page="dashboard"] .dash-card-head .pill .pill-success{
  color: var(--success);
  font-weight: 800;
}
body[data-page="dashboard"] .dash-card-head{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 15px;
}
body[data-page="dashboard"] .dash-controls{
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
body[data-page="dashboard"] .dash-controls-label{
  font-size: var(--fs-xs);
  color: var(--muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
}
body[data-page="dashboard"] .dash-controls-select{
  width: auto;
  min-width: 190px;
}
@media (max-width: 700px){
  body[data-page="dashboard"] .dash-card-head{
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  body[data-page="dashboard"] .dash-controls{
    justify-content: space-between;
  }
  body[data-page="dashboard"] .dash-controls-select{
    min-width: 0;
    width: 100%;
  }
}

body[data-page="dashboard"] .dash-bar-chart{
  height: 220px;
  padding: 10px;
  border-radius: 14px;
  background: var(--panel-2);
  border: 1px solid rgba(15, 23, 42, 0.06);
  display: flex;
  align-items: flex-end;
  gap: 6px;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: thin;
}
body[data-page="dashboard"] .dash-bar{
  width: 10px;
  min-width: 10px;
  border-radius: 10px 10px 6px 6px;
  background: rgba(56, 140, 253, 0.82);
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.08);
}
body[data-page="dashboard"] .dash-bar.is-zero{
  opacity: 0.18;
}
body[data-page="dashboard"] .dash-chart-hint{
  margin-top: 8px;
  font-size: var(--fs-xs);
  color: var(--muted);
}

body[data-page="dashboard"] .dash-donut-wrap{
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 150px;
}
@media (max-width: 700px){
  body[data-page="dashboard"] .dash-donut-wrap{
    flex-direction: column;
    align-items: stretch;
  }
}
body[data-page="dashboard"] .dash-donut{
  width: 148px;
  height: 148px;
  border-radius: 999px;
  background: conic-gradient(#e5e7eb 0 100%);
  position: relative;
  border: 1px solid rgba(15, 23, 42, 0.06);
  flex: 0 0 auto;
}
body[data-page="dashboard"] .dash-donut::after{
  content: "";
  position: absolute;
  inset: 18px;
  border-radius: 999px;
  background: var(--panel);
  border: 1px solid rgba(15, 23, 42, 0.06);
}
body[data-page="dashboard"] .dash-legend{
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  width: 100%;
}
body[data-page="dashboard"] .dash-legend-item{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
body[data-page="dashboard"] .dash-legend-left{
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
body[data-page="dashboard"] .dash-dot{
  width: 10px;
  height: 10px;
  border-radius: 999px;
  flex: 0 0 auto;
}
body[data-page="dashboard"] .dash-legend-label{
  font-size: var(--fs-sm);
  color: var(--text);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
body[data-page="dashboard"] .dash-legend-value{
  font-size: var(--fs-sm);
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* Tasks (Aufgaben) */
.pill{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 30px;
  height: 24px;
  padding: 0 10px;
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.1px;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  background: rgba(255,255,255,0.65);
  box-shadow: none;
  user-select: none;
}

/* Tasks: modernes Split-Layout (Liste links, Formular rechts) */
body[data-page="tasks"] .tasks-split{
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 0.75fr);
  gap: var(--gap);
}
@media (max-width: 900px){
  body[data-page="tasks"] .tasks-split{
    grid-template-columns: 1fr;
  }
}

body[data-page="tasks"] .tasks-list-card,
body[data-page="tasks"] .tasks-form-card{
  display: flex;
  flex-direction: column;
  min-height: 0;
}

body[data-page="tasks"] .tasks-card-head{
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
  margin-bottom: 12px;
}
body[data-page="tasks"] .tasks-card-head h3{
  margin: 0;
}

body[data-page="tasks"] .tasks-list-wrap{
  min-height: 0;
  flex: 1;
}

/* Desktop: Liste/Formular jeweils intern scrollen (KPI oben bleibt sichtbar) */
@media (min-width: 901px){
  body[data-page="tasks"] .content{
    overflow: hidden;
  }
  body[data-page="tasks"] .tasks-split{
    flex: 1;
    min-height: 0;
  }
  body[data-page="tasks"] .tasks-list-wrap{
    overflow: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    padding-right: 4px;
  }
  body[data-page="tasks"] .tasks-form{
    overflow: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    padding-right: 4px;
  }
}

body[data-page="tasks"] .tasks-form-actions{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
  margin-top:10px;
}

/* Task-Items: Styles passend zu app.js-Markup (.task-item/.task-main/...) */
.task-item{
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border-radius: 14px;
  background: var(--panel-2);
  border: 1px solid rgba(15, 23, 42, 0.06);
}
.task-item.done{
  opacity: 0.82;
}
.task-main{
  display: flex;
  gap: 10px;
  min-width: 0;
  flex: 1;
}
.task-check{
  display: inline-flex;
  align-items: flex-start;
  padding-top: 2px;
  flex: 0 0 auto;
}
.task-check input{
  width: 18px;
  height: 18px;
}
.task-text{
  min-width: 0;
}
.task-title{
  font-size: var(--fs-md);
  font-weight: 700;
  color: var(--text);
  line-height: 1.25;
}
.task-item.done .task-title{
  text-decoration: line-through;
}
.task-desc{
  margin-top: 6px;
  font-size: var(--fs-xs);
  color: var(--muted);
  line-height: 1.35;
  max-width: 70ch;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  line-clamp: 3;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
}
.task-side{
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
  flex: 0 0 auto;
}
.task-meta{
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.task-actions{
  display: flex;
  gap: 8px;
}
.task-due{
  font-size: var(--fs-xs);
  color: var(--muted);
  font-weight: 700;
}
.task-due.overdue{
  color: var(--danger);
}

@media (max-width: 900px){
  .task-item{
    flex-direction: column;
    align-items: stretch;
  }
  .task-side{
    align-items: flex-start;
  }
  .task-meta{
    justify-content: flex-start;
  }
  .task-desc{
    max-width: 100%;
  }
}
.tasks-form .edit-input,
.tasks-form .edit-select{
  width: 100%;
  max-width: none;
  border-radius: 14px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  background: var(--panel);
}
.tasks-form textarea.edit-input{
  max-width: none;
}
.tasks-form-grid{
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.task-field{
  margin-bottom: 12px;
}
.task-field label{
  display: block;
  font-size: var(--fs-xs);
  color: var(--muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-bottom: 6px;
  margin-left: 4px;
}
.task-help{
  margin-top: 6px;
  font-size: var(--fs-xs);
  color: var(--muted);
}
.tasks-filters{
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.tasks-checkbox{
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: var(--fs-sm);
  color: var(--muted);
  user-select: none;
}
.tasks-checkbox input{
  width: 16px; height: 16px;
}
.tasks-list{
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.task-row{
  align-items: flex-start;
}
.task-row.done{
  opacity: 0.78;
}
.task-left{
  display: flex;
  gap: 10px;
  min-width: 0;
  flex: 1;
}
.task-check{
  display: inline-flex;
  align-items: flex-start;
  padding-top: 2px;
}
.task-check input{
  width: 18px;
  height: 18px;
}
.task-left-text{
  min-width: 0;
}
.task-title{
  font-size: var(--fs-md);
  font-weight: 700;
  color: var(--text);
}
.task-row.done .task-title{
  text-decoration: line-through;
}
.task-sub{
  display: inline-block;
  font-size: var(--fs-xs);
  color: var(--muted);
  max-width: 58ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.task-tags-inline{
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.task-tags-inline .tag{
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: var(--fs-xs);
  font-weight: 700;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(15, 23, 42, 0.08);
}
.task-right{
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
  flex: 0 0 auto;
}
.task-badges{
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.task-actions{
  display: flex;
  gap: 8px;
}
.task-due{
  font-size: var(--fs-xs);
  color: var(--muted);
  font-weight: 700;
}
.task-due.overdue{
  color: var(--danger);
}
.pill.priority-high{
  background: rgba(220, 38, 38, 0.08);
  border-color: rgba(220, 38, 38, 0.18);
  color: #991b1b;
}
.pill.priority-medium{
  background: rgba(217, 119, 6, 0.08);
  border-color: rgba(217, 119, 6, 0.18);
  color: #92400e;
}
.pill.priority-low{
  background: rgba(56, 140, 253, 0.10);
  border-color: rgba(56, 140, 253, 0.22);
  color: var(--text);
}
.pill.status-open{
  background: rgba(56, 140, 253, 0.10);
  border-color: rgba(56, 140, 253, 0.22);
}
.pill.status-in_progress{
  background: rgba(217, 119, 6, 0.08);
  border-color: rgba(217, 119, 6, 0.18);
}
.pill.status-done{
  background: rgba(22, 163, 74, 0.10);
  border-color: rgba(22, 163, 74, 0.22);
}
.task-empty{
  color: var(--muted);
}
@media (max-width: 900px){
  .tasks-form-grid{ grid-template-columns: 1fr; }
  .task-row{ flex-direction: column; align-items: stretch; }
  .task-right{ align-items: flex-start; }
  .task-badges{ justify-content: flex-start; }
  .task-sub{ max-width: 100%; }
}

/* Kanban */
/* Kanban: Content-Bereich als Card (analog Kalender) */
body[data-page="kanban"] #kanbanCard.card.kanban-card{
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
body[data-page="kanban"] #kanbanCard .page-actions{
  flex: 0 auto;
  padding-bottom: 12px;
}

body[data-page="onboarding"] #onboardingCard .page-actions{
  flex: 0 auto;
  padding-bottom: 12px;
}

/* Onboarding: Filter + Button rechts */
body[data-page="onboarding"] #onboardingCard .page-actions-right{
  gap: 12px; /* Abstand zwischen Dropdown und Button */
}
body[data-page="onboarding"] #addCustomerBtn{
  white-space: nowrap; /* immer eine Zeile */
  flex: 0 0 auto;
}
body[data-page="onboarding"] #onboardingCard.card.kanban-card{
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
body[data-page="kanban"] #kanbanCard #kanban.kanban{
  flex: 1;
  min-height: 0;
  height: auto; /* überschreibt .kanban{height:100%} – Parent ist jetzt die Card */
}
body[data-page="onboarding"] #onboardingCard #kanban.kanban{
  flex: 1;
  min-height: 0;
  height: auto; /* überschreibt .kanban{height:100%} – Parent ist jetzt die Card */
}

/* Telefonnummern (Onboarding) */
body[data-page="phonenumber"] #phoneNumberCard{
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
body[data-page="phonenumber"] #phoneNumberCard .page-actions{
  padding-bottom: 0;
}
body[data-page="phonenumber"] #phoneNumberCard .page-actions-right{
  gap: 10px;
  flex-wrap: wrap;
}

body[data-page="phonenumber"] .pn-title{
  display: grid;
  gap: 4px;
}
body[data-page="phonenumber"] .pn-h1{
  font-weight: 800;
  color: var(--text);
  font-size: 1.15rem;
  letter-spacing: 0.2px;
}
body[data-page="phonenumber"] .pn-sub{
  color: var(--muted);
  font-weight: 600;
  font-size: var(--fs-sm);
  line-height: 1.35;
}

body[data-page="phonenumber"] .pn-statusline{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(15, 23, 42, 0.10);
  background: rgba(241, 245, 249, 0.65);
}
body[data-page="phonenumber"] .pn-statusleft{
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  color: var(--muted);
  font-weight: 700;
  font-size: var(--fs-sm);
}
body[data-page="phonenumber"] .pn-lastupdated{
  color: var(--muted);
  font-weight: 700;
  font-size: var(--fs-sm);
}
body[data-page="phonenumber"] .pn-dot{
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.22);
}
body[data-page="phonenumber"] .pn-dot.loading{
  background: rgba(56, 140, 253, 1);
  animation: pnPulse 1s ease-in-out infinite;
}
@keyframes pnPulse{
  0%{ transform: scale(1); opacity: 0.75; }
  50%{ transform: scale(1.25); opacity: 1; }
  100%{ transform: scale(1); opacity: 0.75; }
}

body[data-page="phonenumber"] .pn-error{
  border: 1px solid rgba(239, 68, 68, 0.35);
  background: rgba(239, 68, 68, 0.10);
  color: var(--text);
  border-radius: 12px;
  padding: 10px 12px;
  font-weight: 700;
  white-space: pre-line;
}

body[data-page="phonenumber"] .pn-hint{
  color: var(--muted);
  font-weight: 600;
  font-size: var(--fs-sm);
  line-height: 1.45;
}

body[data-page="phonenumber"] .pn-tablewrap{
  border: 1px solid rgba(15, 23, 42, 0.10);
  border-radius: 18px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.72);
}
body[data-page="phonenumber"] .pn-table{
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-sm);
}
body[data-page="phonenumber"] .pn-table thead th{
  text-align: left;
  padding: 12px 14px;
  font-size: var(--fs-xs);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  background: rgba(241, 245, 249, 0.85);
  border-bottom: 1px solid rgba(15, 23, 42, 0.10);
  white-space: nowrap;
}
body[data-page="phonenumber"] .pn-table tbody td{
  padding: 12px 14px;
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
  vertical-align: top;
}
body[data-page="phonenumber"] .pn-table tbody tr:last-child td{
  border-bottom: none;
}
body[data-page="phonenumber"] .pn-empty{
  color: var(--muted);
  font-weight: 700;
}

body[data-page="phonenumber"] .pn-mono{
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  letter-spacing: 0.1px;
}

body[data-page="phonenumber"] .pn-badge{
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: 999px;
  padding: 6px 10px;
  border: 1px solid rgba(15, 23, 42, 0.12);
  background: rgba(15, 23, 42, 0.04);
  font-weight: 800;
  font-size: var(--fs-xs);
  white-space: nowrap;
}
body[data-page="phonenumber"] .pn-badge::before{
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.35);
}
body[data-page="phonenumber"] .pn-badge.verified{
  border-color: rgba(22, 163, 74, 0.22);
  background: rgba(22, 163, 74, 0.10);
}
body[data-page="phonenumber"] .pn-badge.verified::before{
  background: rgba(22, 163, 74, 1);
}
body[data-page="phonenumber"] .pn-badge.notVerified{
  border-color: rgba(245, 158, 11, 0.30);
  background: rgba(245, 158, 11, 0.12);
}
body[data-page="phonenumber"] .pn-badge.notVerified::before{
  background: rgba(245, 158, 11, 1);
}
body[data-page="phonenumber"] .pn-badge.unknown{
  border-color: rgba(148, 163, 184, 0.32);
  background: rgba(148, 163, 184, 0.12);
}
body[data-page="phonenumber"] .pn-badge.unknown::before{
  background: rgba(148, 163, 184, 1);
}

body[data-page="phonenumber"] .pn-footnote{
  color: var(--muted);
  font-weight: 600;
  font-size: var(--fs-xs);
  line-height: 1.45;
}

body[data-page="phonenumber"] .pn-sronly{
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

body[data-page="phonenumber"] .pn-smallbtn{
  padding: 7px 10px;
  font-size: var(--fs-xs);
  font-weight: 800;
  border-radius: 12px;
}

/* Modal helpers */
body[data-page="phonenumber"] .pn-modal-sub{
  color: var(--muted);
  font-weight: 700;
  font-size: var(--fs-sm);
  line-height: 1.45;
}
body[data-page="phonenumber"] .pn-step{
  margin-top: 12px;
}
body[data-page="phonenumber"] .pn-method-row{
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 8px;
}
body[data-page="phonenumber"] .pn-method-pill{
  display: inline-flex;
  align-items: center;
  gap: 10px;
  border: 1px solid rgba(15, 23, 42, 0.10);
  border-radius: 999px;
  padding: 10px 12px;
  background: rgba(15, 23, 42, 0.03);
  cursor: pointer;
  user-select: none;
  font-weight: 800;
  font-size: var(--fs-sm);
}
body[data-page="phonenumber"] .pn-method-pill input{
  margin: 0;
}
body[data-page="phonenumber"] .pn-method-pill.disabled{
  opacity: 0.55;
  cursor: not-allowed;
}
body[data-page="phonenumber"] .pn-method-pill.disabled *{
  cursor: not-allowed;
}
body[data-page="phonenumber"] .pn-modal-actions{
  margin-top: 12px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}
body[data-page="phonenumber"] .pn-otp{
  width: min(360px, 100%);
  margin-top: 10px;
  text-align: center;
  font-size: 18px;
  letter-spacing: 10px;
  font-variant-numeric: tabular-nums;
}
body[data-page="phonenumber"] .pn-loading-row{
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 8px;
}
body[data-page="phonenumber"] .pn-spinner{
  width: 18px;
  height: 18px;
  border-radius: 999px;
  border: 2px solid rgba(56, 140, 253, 0.22);
  border-top-color: rgba(56, 140, 253, 1);
  animation: pnSpin 900ms linear infinite;
}
@keyframes pnSpin{
  to{ transform: rotate(360deg); }
}
.kanban{
  /* Wichtig: STAGES werden in JS dynamisch gerendert (aktuell 8).
     Ein fixes grid-template-columns (z.B. repeat(7, ...)) führt dazu,
     dass die letzte Spalte in eine zweite Zeile umbricht.
     Daher: Flexbox ohne Umbruch + horizontales Scrollen. */
  display: flex;
  flex-wrap: nowrap;
  gap: 6px;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 10px;
  height: 100%;
}

/* Deal-Kanban: NUR Header-Farbkodierung (nur Deals-Seite) */
body[data-page="kanban"] .kanban-col.stage-good .kanban-col-header{
  border-bottom-color: rgba(22, 163, 74, 0.14);
}

.kanban::-webkit-scrollbar{ height: 10px; }
.kanban::-webkit-scrollbar-thumb{
  background: rgba(15, 23, 42, 0.14);
  border-radius: 999px;
}
.kanban::-webkit-scrollbar-track{ background: transparent; }
.kanban-col{
  border: 1px solid var(--border);
  background: var(--panel);
  border-radius: var(--radius);
  height: 100%;
  /* Fixe/flexible Spaltenbreite, damit alle Spalten nebeneinander bleiben */
  flex: 0 0 280px;
  min-width: 280px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.kanban-col-header{
  padding: 12px 20px 10px 20px;
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex-shrink: 0;
  background: var(--panel);
  z-index: 1;
  position: relative;
}
.kanban-col-header .row{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.kanban .badge{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: 0.1px;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  background: var(--panel-2);
  border: 1px solid rgba(15, 23, 42, 0.10);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
  user-select: none;
}
.kanban-col-title{
  font-size: var(--fs-sm);
  font-weight: 700;
  letter-spacing: 0.2px;
}
.kanban-col-meta{
  font-size: var(--fs-xs);
  color: var(--muted);
}
.kanban-col-body{
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px; /* Mehr Abstand */
  flex: 1;
  min-height: 0;
  background: var(--bg); /* Spalte leicht abgedunkelt */
  overflow-y: auto;
  overflow-x: hidden;
}

/* Mobile Kanban: Eine Spalte pro Seite mit Scroll-Snap */
@media (max-width: 900px){
  body[data-page="kanban"] .main{
    padding-left: 0;
    padding-right: 0;
  }
  body[data-page="kanban"] #kanbanCard.card.kanban-card{
    padding: 0;
    border-radius: 0;
    border-left: none;
    border-right: none;
  }
  body[data-page="kanban"] #kanbanCard #kanban.kanban{
    gap: 0;
    padding: 0;
  }
  body[data-page="kanban"] #kanbanCard .page-actions{
    padding: 12px;
  }
  .kanban{
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
  }
  .kanban-col{
    flex: 0 0 100vw;
    min-width: 100vw;
    scroll-snap-align: start;
    scroll-snap-stop: always;
    border-radius: 0;
    border-left: none;
    border-right: none;
  }
  .kanban-col:first-child{
    border-left: 1px solid var(--border);
  }
  .kanban-col:last-child{
    border-right: 1px solid var(--border);
  }
  /* Drag & Drop auf mobilen Geräten deaktivieren */
  .kanban .deal{
    -webkit-user-drag: none;
    user-select: none;
    -webkit-touch-callout: none;
  }
  .kanban-col-body{
    -webkit-user-drag: none;
  }
  /* Hover-Effekte auf mobilen Geräten deaktivieren */
  .kanban .deal:hover{
    transform: none;
    border-color: rgba(15, 23, 42, 0.08);
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  }
  .deal-search-item:hover{
    background: transparent;
  }
  /* aria-selected bleibt aktiv (für Tastatur-Navigation) */
  .deal-search-item[aria-selected="true"]{
    background: var(--panel-2);
  }
}

/* Modern Deal Card */
.deal {
  border: 1px solid rgba(15, 23, 42, 0.08);
  background: var(--panel);
  border-radius: 12px;
  padding: 12px;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.deal:hover {
  transform: translateY(-2px);
  border-color: rgba(56, 140, 253, 0.4);
  box-shadow: 0 8px 16px rgba(15, 23, 42, 0.08);
}
.deal[draggable="true"] { user-select: none; }

.deal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}
.deal-company {
  font-size: var(--fs-xs);
  text-transform: none;
  letter-spacing: 0.5px;
  font-weight: 600;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.deal-amount {
  font-size: var(--fs-sm);
  font-weight: 700;
  color: var(--text);
  background: rgba(15, 23, 42, 0.04);
  padding: 2px 6px;
  border-radius: 6px;
  white-space: nowrap;
}

.deal-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.deal-name {
  font-size: var(--fs-md);
  font-weight: 600;
  line-height: 1.3;
  color: var(--text);
}
.deal-contact {
  font-size: var(--fs-xs);
  color: var(--muted-2);
}

.deal-footer {
  margin-top: 4px;
  padding-top: 8px;
  border-top: 1px solid rgba(15, 23, 42, 0.05);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.meta-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: var(--fs-xs);
  color: var(--muted);
  font-weight: 500;
}

.deal-reminder{
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: var(--fs-xs);
  color: var(--warn);
  background: rgba(217, 119, 6, 0.08);
  border: 1px solid rgba(217, 119, 6, 0.18);
  padding: 6px 8px;
  border-radius: 10px;
}

.drop-hint {
  border: 1px dashed rgba(56, 140, 253, 0.35);
  background: rgba(56, 140, 253, 0.06);
}

/* Dialog */
dialog{
  border: 1px solid var(--border);
  border-radius: 18px;
  background: rgba(255,255,255,0.96);
  color: var(--text);
  box-shadow: var(--shadow);
  padding: 0;
  max-width: 640px;
  width: min(640px, calc(100vw - 24px));
}
dialog::backdrop{
  background: rgba(15, 23, 42, 0.35);
}

/* CRM Modal (Overlay) */
.crm-modal-overlay{
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(15, 23, 42, 0.42);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px;
}
.crm-modal-overlay[hidden]{
  display: none;
}

/* Global: Scroll-Lock bei Fullscreen-Modals */
body.is-modal-open{
  overflow: hidden;
}

/* Deal-Detail: Kommentare Fullscreen (Mobile) */
@media (max-width: 900px){
  .crm-modal-overlay#dealCommentsModal{
    padding: 0;
    align-items: stretch;
    justify-content: stretch;
  }
  .crm-modal-overlay#dealCommentsModal .crm-modal{
    width: 100%;
    height: 100%;
    max-height: none;
    border-radius: 0;
  }
  /* Body-Container: Inhalt soll als Flex-Column laufen, ohne Doppel-Scroll */
  #dealCommentsModalBody{
    padding: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: 0;
  }
  #dealCommentsModalBody #dealChatHistory{
    flex: 1 1 auto;
    min-height: 0;
  }
}

/* Global: Loading Overlay (blockiert Klicks während Webhook wartet) */
.cjg-loading-overlay{
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(15, 23, 42, 0.42);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px;
}
.cjg-loading-overlay[hidden]{
  display: none;
}
.cjg-loading-card{
  width: min(420px, calc(100vw - 24px));
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 22px;
  box-shadow: var(--shadow);
  padding: 18px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.cjg-loading-spinner{
  width: 28px;
  height: 28px;
  border-radius: 999px;
  border: 3px solid rgba(56, 140, 253, 0.20);
  border-top-color: rgba(56, 140, 253, 1);
  animation: cjgSpin 900ms linear infinite;
  flex: 0 0 auto;
}
.cjg-loading-text{
  display: grid;
  gap: 2px;
  min-width: 0;
}
.cjg-loading-title{
  font-weight: 700;
  color: var(--text);
}
.cjg-loading-sub{
  color: var(--muted);
  font-weight: 700;
  font-size: var(--fs-sm);
}
@keyframes cjgSpin{
  to{ transform: rotate(360deg); }
}
.crm-modal{
  width: min(720px, calc(100vw - 24px));
  max-height: 85vh;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 22px;
  box-shadow: var(--shadow);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transform: translateY(6px);
  opacity: 0;
  animation: crmModalIn 180ms ease-out forwards;
}
.crm-modal-overlay#newDealModal .crm-modal{
  /* Neuer Deal: etwas höher, damit mehr Inhalte sichtbar sind */
  max-height: 92vh;
  min-height: min(640px, 92vh);
}
.crm-modal-overlay[hidden] .crm-modal{
  animation: none;
}
@keyframes crmModalIn{
  to{
    transform: translateY(0);
    opacity: 1;
  }
}
.crm-modal-head{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 20px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(241, 245, 249, 0.85), rgba(255, 255, 255, 0));
}
.crm-modal-title{
  font-weight: 700;
  color: var(--text);
  font-size: 1.2rem;
  letter-spacing: 0.2px;
}
.crm-modal-body{
  padding: 8px 20px;
  flex: 1;
  min-height: 0; /* wichtig für korrektes Scrollen in Flex-Layouts */
  overflow: auto;
}
.crm-modal-form{
  display: grid;
  gap: 14px;
}
.crm-modal-grid{
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.crm-modal-grid--3{
  grid-template-columns: 1fr 1fr 220px;
  align-items: center;
}
.task-field--toggle .toggle-switch
.toggle-switch{
  display: inline-flex;
  align-items: center;
  height: 42px;
  position: relative;
}

/* Availability: kleinere Toggles vorm Wochentag */
.availability-day-head .toggle-switch{
  height: 34px;
  transform: translateY(3px);
}
.availability-day-head .toggle-switch input{
  width: 44px;
  height: 24px;
}
.availability-day-head .toggle-track{
  width: 44px;
  height: 24px;
}
.availability-day-head .toggle-track::after{
  width: 20px;
  height: 20px;
  left: 3px;
}
.availability-day-head .toggle-switch input:checked + .toggle-track::after{
  left: 21px;
}
.toggle-switch input{
  position: absolute;
  top: 50%;
  left: 0;
  transform: translateY(-50%);
  margin: 0;
  opacity: 0;
  width: 54px;  /* Track-Breite */
  height: 28px; /* Track-Höhe */
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  outline: none;
}
.toggle-track{
  display: block;
  width: 54px;
  height: 28px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.10);
  border: 1px solid rgba(15, 23, 42, 0.10);
  position: relative;
  transition: background 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}
.toggle-track::after{
  content: "";
  position: absolute;
  top: 50%;
  left: 4px;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 8px 14px rgba(15, 23, 42, 0.20);
  transform: translateY(-50%);
  transition: left 160ms ease;
}
.toggle-switch input:checked + .toggle-track{
  background: #79c43a;
  border-color: rgba(16, 122, 36, 0.28);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.25),
    inset 0 -2px 6px rgba(0, 0, 0, 0.12);
}
.toggle-switch input:checked + .toggle-track::after{
  left: 28px;
}
.toggle-switch input:focus-visible + .toggle-track{
  box-shadow: none;
}
.crm-modal .task-field > label{
  font-size: var(--fs-xs);
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding-bottom: 8px;
}

/* Readonly/Anzeige-Feld (z.B. Kalender Remote-Termin Details): nur Text, keine Ränder */
.crm-modal .crm-view-text{
  width: 100%;
  max-width: none;
  padding: 4px 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  min-height: 0;
  height: auto;
  line-height: 1.5;
  overflow-wrap: anywhere;
  user-select: text;
}
.crm-modal .edit-input,
.crm-modal .edit-select{
  height: 42px;
  border-radius: 14px;
  padding: 10px 12px;
  border-color: rgba(15, 23, 42, 0.10);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.04);
  transition: box-shadow 160ms ease, border-color 160ms ease, background 160ms ease;
}
.crm-modal .edit-select{
  border-radius: 18px;
}
.crm-modal .edit-select:disabled,
.crm-modal .edit-input:disabled{
  opacity: 0.55;
  cursor: not-allowed;
}
.crm-modal .deal-search{
  max-width: none;
}
.crm-modal .deal-search-input{
  height: 42px;
  border-radius: 18px;
}
.cal-selected-card{
  border-radius: 18px;
  border: 1px solid rgba(15, 23, 42, 0.08);
  background: rgba(241, 245, 249, 0.65);
  padding: 14px 16px;
  display: grid;
  gap: 6px;
}
.cal-selected-card > strong,
.cal-selected-card > .sub{
  padding-left: 10px;
}
.cal-selected-card strong{
  font-size: var(--fs-xs);
  font-weight: 700;
  color: var(--text);
  line-height: 1.15;
}
.cal-selected-card .sub{
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--muted);
  line-height: 1.5;
}
.cal-selected-card .pill{
  display: inline-flex;
  max-width: max-content;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid rgba(15, 23, 42, 0.10);
  background: rgba(255,255,255,0.7);
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--text);
}
.cal-multi-previews{
  display: grid;
  gap: 10px;
}
.cal-preview-item{
  position: relative;
}
.cal-preview-remove {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  border: 0;
  background: 0;
  color: var(--muted);
  cursor: pointer;
  font-weight: 700;
  line-height: 1;
}
.cal-preview-remove:hover{
  color: var(--text);
  border-color: rgba(15, 23, 42, 0.18);
}
.cal-picker-panel{
  margin-top: 8px;
}
.cal-picker-panel .deal-search-results{
  max-height: 340px; /* mehr Platz wie in deinem Screenshot */
}
.add-btn{
  justify-content: flex-start;
  padding-left: 0;
  padding-right: 0;
  color: var(--accent);
  font-weight: 700;
}
.add-btn:hover{
  background: transparent;
  border-color: transparent;
  color: var(--accent-2);
}
.add-btn:disabled{
  opacity: 0.45;
  cursor: not-allowed;
  color: var(--muted);
}
.crm-modal textarea.edit-input{
  height: auto;
  min-height: 120px;
  resize: none;
}
.crm-modal .edit-input:focus,
.crm-modal .edit-select:focus{
  border-color: rgba(56, 140, 253, 0.55);
  box-shadow: none;
  background: var(--panel);
}
.crm-modal-form .hint{
  font-size: var(--fs-xs);
  color: var(--muted);
  font-weight: 600;
}
.crm-modal-error{
  border: 1px solid rgba(239, 68, 68, 0.35);
  background: rgba(239, 68, 68, 0.10);
  color: var(--text);
  border-radius: 12px;
  padding: 10px 12px;
  font-weight: 700;
  margin-bottom: 10px;
  white-space: pre-line; /* Zeilenumbrüche aus JS-Text anzeigen */
}
.crm-modal-foot{
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  background: linear-gradient(0deg, rgba(241, 245, 249, 0.75), rgba(255, 255, 255, 0));
}
.crm-modal-foot .spacer{
  flex: 1;
}

/* Deal-Detail: "Nicht erreicht" Confirm – Cal-like Optik (Screenshot) */
.crm-modal-overlay#dealNotReachedConfirmModal{
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
#dealNotReachedConfirmModal .crm-modal{
  width: min(880px, calc(100vw - 32px));
  max-height: 80vh;
  border-radius: 26px;
  border-color: rgba(15, 23, 42, 0.10);
  box-shadow: 0 32px 92px rgba(0, 0, 0, 0.22);
}
#dealNotReachedConfirmModal .crm-modal-head{
  padding: 26px 32px 18px;
  border-bottom: 0;
  background: transparent;
}
/* kein X im Header (wie im Screenshot) */
#dealNotReachedConfirmModal .crm-modal-head button[data-action='deal-notreached-confirm-cancel']{
  display: none;
}
#dealNotReachedConfirmModal .crm-modal-body{
  padding: 0 32px 22px;
  overflow: visible;
}
#dealNotReachedConfirmModal .crm-modal-confirm-text{
  font-size: 1rem;
  color: rgba(15, 23, 42, 0.74);
}
#dealNotReachedConfirmModal .crm-modal-confirm-text strong{
  font-weight: 600; /* hervorgehobener Text: 600 statt 700 */
}
#dealNotReachedConfirmModal .crm-modal-foot{
  padding: 10px 32px 14px;
  background: #F6F7F9;
  border-top: 1px solid rgba(15, 23, 42, 0.10);
  justify-content: flex-end; /* Abbrechen links neben Speichern */
  gap: 10px; /* kleiner Abstand */
}
#dealNotReachedConfirmModal .crm-modal-foot .spacer{
  display: none;
}

.cal-deal-info{
  border: 1px solid rgba(56, 140, 253, 0.16);
  background: linear-gradient(180deg, rgba(56, 140, 253, 0.06), rgba(255,255,255,0));
  border-radius: 18px;
  padding: 14px;
}
.cal-deal-info-grid{
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 12px;
}
.cal-deal-info-item{
  min-width: 0;
}
.cal-deal-info-k{
  font-size: var(--fs-xs);
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.02em;
  text-transform: uppercase;
  margin-bottom: 4px;
}
.cal-deal-info-v{
  font-size: var(--fs-sm);
  font-weight: 700;
  color: var(--text);
  line-height: 1.25;
  white-space: pre-line;
  word-break: break-word;
}

.cal-participants-list{
  display: grid;
  gap: 10px;
  margin-top: 10px;
}

/* Kalender: Mitarbeiter-Auswahl nutzt jetzt denselben Multi-Preview-Container wie Ansprechpartner */
body[data-page="calendar"] #calParticipantsList{
  margin-top: 10px;
}

@media (max-width: 560px){
  .crm-modal-grid{
    grid-template-columns: 1fr;
  }
  .crm-modal-grid--3{
    grid-template-columns: 1fr;
  }
  .cal-deal-info-grid{
    grid-template-columns: 1fr;
  }
  .cal-participant-pill span{
    max-width: 220px;
  }
}
/* Kalender */
.calendar{
  display: grid;
  gap: 12px;
}

/* Kalender: volle Höhe bis nach unten (nur Kalender-Seite) */
body[data-page="calendar"] .content{
  overflow: hidden; /* verhindert Doppel-Scroll (Content + Kalender) */
}
body[data-page="calendar"] #calendar.card.calendar{
  flex: 1;
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden; /* damit nur der innere .week-scroll scrollt */
}
body[data-page="calendar"] #calendar .calendar-toolbar{
  flex: 0 0 auto; /* Toolbar bleibt fix, Scrollbereich nimmt Resthöhe */
}
body[data-page="calendar"] #calendar .week-grid{
  flex: 1;
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
body[data-page="calendar"] #calendar .week-scroll{
  flex: 1;
  height: 100%;
  min-height: 0;
  overflow: auto; /* EIN Scrollcontainer für Header + Body (saubere Ausrichtung) */
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}
body[data-page="calendar"] #calendar .time-col,
body[data-page="calendar"] #calendar .day-col{
  height: var(--day-height, 520px);
}

/* Kalender Toolbar */
.calendar-toolbar{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  flex-wrap:wrap;
}
.calendar-toolbar .left,
.calendar-toolbar .right{
  display:flex;
  align-items:center;
  gap:8px;
}
.calendar-toolbar .left{
  flex: 1 1 auto;
  flex-wrap: wrap;
  min-width: 0;
}
.calendar-toolbar .right{
  flex: 0 0 auto;
  margin-left: auto;
}
.calendar-search{
  position: relative;
  min-width: 240px;
  max-width: 420px;
  flex: 1 1 280px;
  margin-left: 10px;
}
.calendar-search-input{
  width: 100%;
  height: 40px;
  padding: 8px 36px 8px 12px;
  border-radius: 14px;
  border: 1px solid rgba(15, 23, 42, 0.10);
  background: rgba(255, 255, 255, 0.92);
  color: var(--text);
  outline: none;
  transition: box-shadow 160ms ease, border-color 160ms ease, background 160ms ease;
}
/* Kalender: natives "X" (Search-Clear-Button) entfernen */
.calendar-search-input[type="search"]::-webkit-search-cancel-button,
.calendar-search-input[type="search"]::-webkit-search-decoration,
.calendar-search-input[type="search"]::-webkit-search-results-button,
.calendar-search-input[type="search"]::-webkit-search-results-decoration{
  -webkit-appearance: none;
  appearance: none;
  display: none;
}
.calendar-search-input:focus{
  border-color: rgba(56, 140, 253, 0.55);
  background: var(--panel);
  box-shadow: none;
}
.calendar-search-clear{
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 28px;
  height: 28px;
  border-radius: 999px;
  border: 1px solid rgba(15, 23, 42, 0.10);
  background: rgba(255,255,255,0.65);
  color: var(--muted);
  cursor: pointer;
  font-weight: 700;
  line-height: 1;
}
.calendar-search-clear:hover{
  color: var(--text);
  background: var(--panel-2);
}
.calendar-search-clear[hidden]{
  display: none;
}
.calendar-title{
  font-weight:700;
  color: var(--text);
  font-size: var(--fs-xl);
}

/* Kalenderansicht (Grid) - Desktop: Woche, Mobile: Tag */
.week-head{
  display:grid;
  grid-template-columns: var(--time-col-w, 72px) repeat(7, minmax(var(--day-min-w, 140px), 1fr));
  border-bottom: 1px solid var(--border);
  background: var(--panel);
  position: sticky;
  top: 0;
  z-index: 5;
}
.week-head .cell{
  padding: 10px 12px;
  font-size: var(--fs-xs);
  color: var(--muted);
  font-weight: 700;
  border-left: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}
.week-head .cell.is-today{
  color: var(--text);
  background: rgba(56, 140, 253, 0.10);
}
.week-head .cell:first-child{
  border-left: none;
}

.week-body{
  display:grid;
  grid-template-columns: var(--time-col-w, 72px) repeat(7, minmax(var(--day-min-w, 140px), 1fr));
  background: var(--bg);
}

.time-col{
  position: relative;
  border-right: 1px solid var(--border);
  background: var(--panel);
}
.time-ticks{
  position: relative;
  height: 100%;
}
.time-tick{
  position: absolute;
  left: 0;
  right: 0;
  transform: translateY(-50%);
  padding: 0;
  font-size: var(--fs-xs);
  color: var(--muted);
  white-space: nowrap;
  text-align: center;
}

.day-col{
  position: relative;
  border-left: 1px solid var(--border);
  background:
    repeating-linear-gradient(
      to bottom,
      transparent 0,
      transparent calc(var(--slot-px, 26px) - 1px),
      rgba(15, 23, 42, 0.06) calc(var(--slot-px, 26px) - 1px),
      rgba(15, 23, 42, 0.06) var(--slot-px, 26px)
    );
}
.day-col.is-today::after{
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: rgba(56, 140, 253, 0.04);
}

/* "Jetzt"-Indikator (Kalender, Europe/Berlin) */
.day-col .now-indicator{
  position: absolute;
  left: 0;
  right: 0;
  pointer-events: none;
  z-index: 4;
}
.day-col .now-indicator .now-line{
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  border-top: 2px solid rgba(220, 38, 38, 0.92);
  box-shadow: 0 0 0 1px rgba(220, 38, 38, 0.10);
}
.day-col .now-indicator .now-badge{
  position: absolute;
  left: 8px;
  top: -12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(220, 38, 38, 0.95);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.2;
  box-shadow: var(--shadow-sm);
}
.day-col .now-indicator .now-badge::before{
  content: "Jetzt";
  opacity: 0.92;
  font-weight: 700;
}

.event{
  position: absolute;
  left: 8px;
  right: 8px;
  border-radius: 12px;
  padding-left: 10px;
  padding-right: 10px;
  display: flex;
  flex-direction: column;
  justify-content: center; /* Titel/Zeile vertikal mittig */
  background: rgba(56, 140, 253, 0.12);
  border: 1px solid rgba(56, 140, 253, 0.25);
  color: var(--text);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.event.is-highlighted{
  border-color: rgba(56, 140, 253, 0.95);
  box-shadow:
    0 0 0 3px rgba(56, 140, 253, 0.18),
    var(--shadow-sm);
  background: rgba(56, 140, 253, 0.20);
}
.event strong{
  display:block;
  font-size: var(--fs-xs);
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.event.is-short strong{
  display: none;
}
.event span{
  display:block;
  font-size: var(--fs-xs);
  color: var(--muted);
  font-weight: 600;
  line-height: 1.2;
}

@media (max-width: 900px){
  .week-grid{
    /* Header+Body scrollen gemeinsam in .week-scroll; .week-grid bleibt "frame" */
    border-radius: var(--radius);
  }
  body[data-page="calendar"] #calendar{
    --time-col-w: 64px;
    --day-min-w: 120px;
  }
  body[data-page="calendar"] .calendar-title{
    display: none;
  }
  /* Kalender (Mobile): Suche über volle Breite + "Termin buchen" rechts */
  body[data-page="calendar"] #calendar .calendar-toolbar .left{
    width: 100%;
  }
  body[data-page="calendar"] #calendar .calendar-toolbar .left [data-action="cal-new"]{
    margin-left: auto; /* rechts ausrichten (erste Zeile) */
  }
  body[data-page="calendar"] #calendar .calendar-search{
    flex: 0 0 100%;
    min-width: 0;
    max-width: none;
    width: 100%;
    margin-left: 0;
    order: 99; /* unter die Buttons, volle Zeile */
  }
  .week-head,
  .week-body{
    grid-template-columns: var(--time-col-w, 64px) repeat(1, minmax(var(--day-min-w, 120px), 1fr));
  }
}
.week-grid{
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  overflow: hidden;
}
/* Utilities */
.sr-only{
  position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip:rect(0,0,0,0); white-space:nowrap; border:0;
}

/* NEW: Deal Detail Styles */
.detail-container {
  /* max-width: 1000px;  <-- Entfernt, damit es so breit ist wie Topbar */
  margin: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.detail-header-card,
.order-header-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  display: flex;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}

.dh-main h1 {
  margin: 0 0 8px 0;
  font-size: var(--fs-2xl);
  font-weight: 700;
  line-height: 1.2;
}
.dh-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: var(--fs-md);
}
.dh-company {
  font-weight: 600;
  color: var(--muted-2);
  text-transform: uppercase;
  font-size: var(--fs-sm);
  letter-spacing: 0.5px;
}
.dh-date {
  font-size: var(--fs-sm);
  color: var(--muted-2);
  font-weight: 600;
}

.dh-status {
  display: flex;
  gap: 10px;
  align-items: center;
}

.status-badge {
  padding: 6px 12px;
  border-radius: 99px;
  font-size: var(--fs-sm);
  font-weight: 600;
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid rgba(15,23,42,0.1);
}
.amount-badge {
  padding: 6px 12px;
  border-radius: 99px; /* wie .status-badge (Dealphase) */
  font-size: var(--fs-md);
  font-weight: 700;
  background: rgba(56, 140, 253, 0.1);
  color: var(--accent);
}

/* Deal-Detail: Dealphase + Betrag größer & mittig */
body[data-page="deal-detail"] .dh-status{
  justify-content: center;
  flex-wrap: wrap;
}
body[data-page="deal-detail"] .status-badge,
body[data-page="deal-detail"] .amount-badge{
  text-align: center;
  padding: 10px 16px;
  font-size: var(--fs-lg);
  font-weight: 700;
}
body[data-page="deal-detail"] .amount-badge{
  font-size: var(--fs-xl);
}

/* Deal-Detail: CTA im Header (rechts neben Betrag) */
body[data-page="deal-detail"] .dh-status .deal-create-offer-btn{
  padding: 10px 16px;
  border-radius: 99px;
  font-weight: 700;
  white-space: nowrap;
}

/* Deal-Detail: Header Edit (Stift-Icon) */
body[data-page="deal-detail"] .dh-status .deal-header-edit-btn{
  width: 42px;
  height: 42px;
  padding: 0;
  border-radius: 99px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(15, 23, 42, 0.12);
  background: var(--panel-2);
}
body[data-page="deal-detail"] .dh-status .deal-header-edit-btn:hover{
  border-color: rgba(15, 23, 42, 0.18);
  background: rgba(56, 140, 253, 0.08);
}
body[data-page="deal-detail"] .dh-status .deal-header-edit-btn.is-active{
  background: rgba(56, 140, 253, 0.14);
  border-color: rgba(56, 140, 253, 0.35);
}

/* Bestell-Detail: Header-Layout (Status + Summe links von Adresse) */
body[data-page="bestellung-detail"] .order-header-card{
  display: grid;
  grid-template-columns: auto auto minmax(260px, 1fr);
  align-items: start;
  gap: 16px;
}

body[data-page="bestellung-detail"] .dh-address{
  text-align: center;
  white-space: pre-wrap;
  line-height: 1.35;
  font-size: var(--fs-sm);
  color: var(--muted);
  font-weight: 700;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--panel-2);
  border: 1px solid rgba(15, 23, 42, 0.08);
  min-width: 0;
}

@media (max-width: 900px){
  body[data-page="bestellung-detail"] .order-header-card{
    grid-template-columns: 1fr;
  }
  body[data-page="bestellung-detail"] .dh-address{
    text-align: left;
  }
}

.detail-layout {
  display: grid;
  grid-template-columns: 1fr 1.5fr;
  gap: 20px;
  align-items: start;
}

.detail-main-col {
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.detail-sidebar-col {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Deal-Detail: kompaktere Abstände */
body[data-page="deal-detail"] .detail-container{ gap: 5px; }
body[data-page="deal-detail"] .detail-layout{ gap: 5px; }
body[data-page="deal-detail"] .detail-main-col{ gap: 5px; }
body[data-page="deal-detail"] .detail-sidebar-col{ gap: 5px; }

/* Customer-Detail: kein Abstand zwischen Header und Card */
body[data-page="customer-detail"] .detail-container{ gap: 0; }

/* Customer-Detail: oberer Header mit Abstand nach unten */
body[data-page="customer-detail"] #customerTopHeader{
  margin-right: 15px;
  margin-bottom: 12px;
}


/* Customer-Detail: Body-Card oben ohne Abrundung + ohne doppelte Kante */
body[data-page="customer-detail"] .lead-detail-card{
  border-top-left-radius: 0;
  border-top-right-radius: 0;
  border-top: 0;
}

/* Customer-Detail (Onboarding): Sektionen als 3 Karten */
body[data-page="customer-detail"] #customerEditForm > .customer-section-card{
  margin-bottom: 14px;
}



body[data-page="customer-detail"] #customerEditForm > .customer-section-card:last-child{
  margin-bottom: 14px;
}

body[data-page="customer-detail"] .customer-section-header{
  padding-bottom: 12px;
  margin-bottom: 12px;
  border-bottom: 1px solid rgba(15, 23, 42, 0.10);
}

body[data-page="customer-detail"] .customer-section-header h3{
  margin: 0;
}

/* Deal-Detail: Container soll die verfügbare Höhe nutzen (Tabs füllen den Rest) */
body[data-page="deal-detail"] .detail-container{
  flex: 1 1 auto;
  min-height: 0;
}

/* Deal-Detail: neue Tabs-Card füllt die Seite (statt fixed 544px) */
body[data-page="deal-detail"] #deal-contact-address-tabs{
  height: auto;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

/* Innerhalb der Tabs-Card dürfen verschachtelte Cards NICHT fixed-height sein */
body[data-page="deal-detail"] #deal-contact-address-tabs .content-card{
  height: auto;
}

/* Tabs mit 7 Items: auf kleineren Screens horizontal scrollen, auf großen gleich breit */
body[data-page="deal-detail"] #deal-contact-address-tabs .tabs{
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-gutter: stable;
  -webkit-overflow-scrolling: touch;
  /* Hinweis: In deal-detail scrollt der Content in .tab-panels (innerer Scroll-Container).
     Dadurch bleibt die Tab-Leiste ohnehin sichtbar; sticky würde hier nur überdecken/ungewollt „kleben“. */
  position: relative;
}
body[data-page="deal-detail"] #deal-contact-address-tabs .tab-btn{
  flex: 0 0 auto;
}
@media (min-width: 1100px){
  body[data-page="deal-detail"] #deal-contact-address-tabs .tabs{
    overflow-x: hidden;
  }
  body[data-page="deal-detail"] #deal-contact-address-tabs .tab-btn{
    flex: 1 1 0;
  }
}

/* Info-Tab Layout: Deal Infos links, Stammdaten-Kurz rechts (responsive) */
body[data-page="deal-detail"] .deal-info-layout{
  display: grid;
  grid-template-columns: 1fr;
  align-items: stretch;
  min-height: 0;
}
body[data-page="deal-detail"] .deal-info-layout > .content-card{
  min-height: 0;
}
@media (max-width: 900px){
  body[data-page="deal-detail"] .deal-info-layout{
    grid-template-columns: 1fr;
  }
}

/* Deal-Detail: Deal Infos in 2 Zeilen (3 Spalten) */
body[data-page="deal-detail"] .deal-info-row{
  display: grid;
  /* Alles in einer Zeile (horizontal scroll, falls nötig) */
  grid-template-columns: repeat(5, minmax(150px, 1fr));
  gap: 12px;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-gutter: stable;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 4px; /* Platz für Scrollbar ohne „kleben“ */
}

/* Deal-Detail: KI Zusammenfassung (auffällig, aber clean) */
body[data-page="deal-detail"] .deal-info-layout .ai-summary-card{
  border-radius: 18px;
  border: 1px solid rgba(128, 92, 254, 0.22);
  background: linear-gradient(135deg, rgba(128, 92, 254, 0.12), rgba(56, 140, 253, 0.08));
  box-shadow: 0 10px 26px rgba(15, 23, 42, 0.06);
  padding: 14px 16px;
  margin-bottom: 20px;
}
body[data-page="deal-detail"] .deal-info-layout .ai-summary-row{
  display: flex;
  align-items: flex-start;
  gap: 12px;
}
body[data-page="deal-detail"] .deal-info-layout .ai-summary-icon{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 999px;
  background: transparent;
  border: none;
  flex: 0 0 auto;
  /* vertikal zentriert, margin-top entfernen */
  margin-top: 0;
  align-self: center;
}
body[data-page="deal-detail"] .deal-info-layout .ai-summary-body{
  line-height: 1.45;
  white-space: pre-line;
  flex: 1 1 auto;
  min-width: 0;
}
body[data-page="deal-detail"] .deal-info-row .sidebar-field{
  margin: 0;
  min-width: 150px;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid rgba(15, 23, 42, 0.10);
  background: var(--panel);
  text-align: center;
}
body[data-page="deal-detail"] .deal-info-row .sidebar-field label{
  text-align: center;
}
body[data-page="deal-detail"] .deal-info-row .sidebar-field .date-display{
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: center;
}

@media (max-width: 900px){
  body[data-page="deal-detail"] .deal-info-row{
    grid-template-columns: repeat(5, minmax(150px, 1fr));
    gap: 10px;
  }
}

/* Deal-Detail: Notizen im Info-Tab als moderne Card */
body[data-page="deal-detail"] .deal-info-layout .notes-field{
  margin-top: 14px !important; /* überschreibt inline spacing, falls vorhanden */
}
body[data-page="deal-detail"] .deal-info-layout .notes-box{
  background: var(--panel);
  border: 1px solid rgba(15, 23, 42, 0.10);
  border-radius: 16px;
  padding: 14px;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.04);
  min-height: 140px;
}

/* Falls Notizen im Edit-Modus ein textarea.edit-input sind: Hover neutralisieren */
body[data-page="deal-detail"] .deal-info-layout .notes-box .edit-input:hover:not(:focus):not(:focus-visible){
  border-color: rgba(15, 23, 42, 0.10);
  box-shadow: none;
}

/* Deal-Detail: Edit-Modus (Bearbeiten) – gestapelte Items mit Abstand */
body[data-page="deal-detail"] #dealContactsEditor,
body[data-page="deal-detail"] #dealAddressesEditor{
  display: grid;
  gap: 12px;
}


/* Deal-Detail: Angebote/Dokumente Übersicht */
body[data-page="deal-detail"] .deal-docs-card{
  min-height: auto;
}
body[data-page="deal-detail"] .deal-docs-table{
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  background: var(--panel-2);
}
body[data-page="deal-detail"] .deal-docs-head,
body[data-page="deal-detail"] .deal-docs-row{
  display: grid;
  grid-template-columns: 1.1fr 0.8fr 1fr;
  gap: 12px;
  padding: 10px 12px;
  align-items: center;
}
body[data-page="deal-detail"] .deal-docs-head{
  font-size: var(--fs-xs);
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border);
  background: rgba(15, 23, 42, 0.03);
}
body[data-page="deal-detail"] .deal-docs-row{
  border-top: 1px solid rgba(15, 23, 42, 0.08);
  background: transparent;
}
body[data-page="deal-detail"] .deal-docs-row:first-of-type{
  border-top: none;
}
body[data-page="deal-detail"] .deal-docs-cell{
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: var(--fs-sm);
}
body[data-page="deal-detail"] .deal-docs-num{
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}
body[data-page="deal-detail"] .deal-docs-date{
  text-align: right;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
body[data-page="deal-detail"] .deal-docs-muted{
  color: var(--muted);
  font-size: var(--fs-sm);
}
@media (max-width: 900px){
  body[data-page="deal-detail"] .deal-docs-head{
    display: none;
  }
  body[data-page="deal-detail"] .deal-docs-row{
    grid-template-columns: 1fr 1fr;
    grid-template-areas:
      "nr nr"
      "net net"
      "date date";
    row-gap: 6px;
  }
  body[data-page="deal-detail"] .deal-docs-row .deal-docs-cell:nth-child(1){ grid-area: nr; font-weight: 700; }
  body[data-page="deal-detail"] .deal-docs-row .deal-docs-cell:nth-child(2){ grid-area: net; justify-self: start; }
  body[data-page="deal-detail"] .deal-docs-row .deal-docs-cell:nth-child(3){ grid-area: date; justify-self: start; }
}

/* Deal-Detail: Angebote/Rechnungen/Termine-Tab (Mini-Cards) */
body[data-page="deal-detail"] #deal-offers-panel .deal-offer-card,
body[data-page="deal-detail"] #deal-invoices-panel .deal-offer-card,
body[data-page="deal-detail"] #deal-appointments-panel .deal-offer-card{
  padding: 18px 18px;
}

/* Deal-Detail: Cursor-Verhalten
   - Angebote/Rechnungen: normaler Cursor (nur Download-Button ist klickbar)
   - Termine: Card ist klickbar (öffnet Kalender) */
body[data-page="deal-detail"] #deal-offers-panel .deal-offer-card,
body[data-page="deal-detail"] #deal-invoices-panel .deal-offer-card{
  cursor: default;
}
body[data-page="deal-detail"] #deal-appointments-panel .deal-offer-card{
  cursor: pointer;
}
body[data-page="deal-detail"] #deal-offers-panel .deal-offer-card .contact-card-head,
body[data-page="deal-detail"] #deal-invoices-panel .deal-offer-card .contact-card-head,
body[data-page="deal-detail"] #deal-appointments-panel .deal-offer-card .contact-card-head{
  align-items: flex-start;
  gap: 14px;
}
body[data-page="deal-detail"] #deal-offers-panel .deal-offer-head-left,
body[data-page="deal-detail"] #deal-invoices-panel .deal-offer-head-left,
body[data-page="deal-detail"] #deal-appointments-panel .deal-offer-head-left{
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  min-width: 0;
}
body[data-page="deal-detail"] #deal-offers-panel .deal-offer-head-right,
body[data-page="deal-detail"] #deal-invoices-panel .deal-offer-head-right,
body[data-page="deal-detail"] #deal-appointments-panel .deal-offer-head-right{
  display: inline-flex;
  align-items: flex-start;
  gap: 20px;
}
body[data-page="deal-detail"] #deal-offers-panel .deal-offer-meta,
body[data-page="deal-detail"] #deal-invoices-panel .deal-offer-meta,
body[data-page="deal-detail"] #deal-appointments-panel .deal-offer-meta{
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}
body[data-page="deal-detail"] #deal-offers-panel .deal-offer-date-inline,
body[data-page="deal-detail"] #deal-invoices-panel .deal-offer-date-inline,
body[data-page="deal-detail"] #deal-appointments-panel .deal-offer-date-inline{
  text-align: right;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  font-weight: 700;
  font-size: var(--fs-sm);
}

/* Deal-Detail: Termine – Datum/Uhrzeit rechts (zweizeilig) */
body[data-page="deal-detail"] #deal-appointments-panel .deal-appointment-datetime{
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
body[data-page="deal-detail"] #deal-appointments-panel .deal-appointment-date{
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(15, 23, 42, 0.10);
  background: rgba(56, 140, 253, 0.14);
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.05);
  font-weight: 750;
  font-size: var(--fs-sm);
  color: var(--text);
  white-space: nowrap;
  line-height: 1;
}
body[data-page="deal-detail"] #deal-appointments-panel .deal-appointment-time{
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(15, 23, 42, 0.10);
  background: rgba(255, 255, 255, 0.78);
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.05);
  font-weight: 650;
  font-size: var(--fs-sm);
  color: var(--muted);
  white-space: nowrap;
  line-height: 1;
}
body[data-page="deal-detail"] #deal-offers-panel .deal-offer-head-addr,
body[data-page="deal-detail"] #deal-invoices-panel .deal-offer-head-addr,
body[data-page="deal-detail"] #deal-appointments-panel .deal-offer-head-addr{
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: normal;
  color: var(--muted);
  font-size: var(--fs-sm);
  line-height: 1.25;
}
body[data-page="deal-detail"] #deal-offers-panel .deal-offer-download,
body[data-page="deal-detail"] #deal-invoices-panel .deal-offer-download,
body[data-page="deal-detail"] #deal-appointments-panel .deal-offer-download{
  width: 46px;
  height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  border: 1px solid rgba(15, 23, 42, 0.12);
  background: rgba(56, 140, 253, 0.10);
  color: var(--text);
  text-decoration: none;
  padding: 0;
  cursor: pointer;
}
body[data-page="deal-detail"] #deal-offers-panel .deal-offer-download svg,
body[data-page="deal-detail"] #deal-invoices-panel .deal-offer-download svg,
body[data-page="deal-detail"] #deal-appointments-panel .deal-offer-download svg{
  width: 22px;
  height: 22px;
}
body[data-page="deal-detail"] #deal-offers-panel .deal-offer-download:hover,
body[data-page="deal-detail"] #deal-invoices-panel .deal-offer-download:hover,
body[data-page="deal-detail"] #deal-appointments-panel .deal-offer-download:hover{
  border-color: rgba(56, 140, 253, 0.45);
  color: var(--accent);
}
body[data-page="deal-detail"] #deal-offers-panel .deal-offer-download.is-disabled,
body[data-page="deal-detail"] #deal-invoices-panel .deal-offer-download.is-disabled,
body[data-page="deal-detail"] #deal-appointments-panel .deal-offer-download.is-disabled{
  opacity: 0.45;
  color: var(--muted);
  cursor: not-allowed;
  background: var(--panel-2);
}
body[data-page="deal-detail"] #deal-offers-panel .deal-offer-download.is-loading,
body[data-page="deal-detail"] #deal-invoices-panel .deal-offer-download.is-loading,
body[data-page="deal-detail"] #deal-appointments-panel .deal-offer-download.is-loading{
  opacity: 0.7;
  pointer-events: none;
}
body[data-page="deal-detail"] #deal-offers-panel .deal-offer-date-sub,
body[data-page="deal-detail"] #deal-invoices-panel .deal-offer-date-sub,
body[data-page="deal-detail"] #deal-appointments-panel .deal-offer-date-sub{
  text-align: right;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  margin-top: 10px;
  font-weight: 700;
}

/* Deal-Detail: Angebote/Rechnungen-Tab – Abstand zwischen Cards wie in den anderen Tabs */
body[data-page="deal-detail"] #deal-offers-panel,
body[data-page="deal-detail"] #deal-invoices-panel,
body[data-page="deal-detail"] #deal-appointments-panel{
  display: flex;
  flex-direction: column;
  gap: 12px;
}
@media (max-width: 900px){
  body[data-page="deal-detail"] #deal-offers-panel .deal-offer-date-sub,
  body[data-page="deal-detail"] #deal-invoices-panel .deal-offer-date-sub,
  body[data-page="deal-detail"] #deal-appointments-panel .deal-offer-date-sub{
    text-align: left;
  }
}

.content-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  height: 544px;
}

/* -----------------------------
   Modern: Sidebar-Card Variante
   (gezielt, ohne andere Cards)
------------------------------ */
.content-card.sidebar-card{
  /* Sidebar-Cards sollten i.d.R. nicht künstlich groß werden */
  min-height: auto;

  /* Neutral/clean (ohne farbigen Hintergrundverlauf) */
  padding: 18px;
  border-color: rgba(15, 23, 42, 0.10);
  background: var(--panel);
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.06);
}

/* Titelbereich moderner (weniger harte Trenner, mehr Hierarchie) */
.content-card.sidebar-card .card-titlebar{
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
  padding-bottom: 10px;
  margin-bottom: 14px;
}
.content-card.sidebar-card .card-titlebar h3,
.content-card.sidebar-card > h3{
  font-size: var(--fs-lg);
  font-weight: 700;
  letter-spacing: 0.2px;
  text-transform: none;
  color: var(--text);
  border-bottom: none;
  padding-bottom: 0;
  margin-bottom: 0;
}

/* "Bearbeiten" Button: wieder neutral wie zuvor (Ghost-Default) */
.content-card.sidebar-card .card-titlebar .btn.ghost{
  background: transparent;
  border-color: transparent;
  box-shadow: none;
}

/* Deal-Infos: Felder als „Tiles“ (NICHT für Bestellinformationen) */
.content-card.sidebar-card:not(.order-info-card) .sidebar-field{
  margin: 0;
  padding: 10px 12px;
  border-radius: 14px;
  background: var(--panel-2);
  border: 1px solid rgba(15, 23, 42, 0.08);
}
.content-card.sidebar-card:not(.order-info-card) .sidebar-field label{
  font-size: var(--fs-xs);
  margin-bottom: 10px;
  font-weight: 700;
  letter-spacing: 0.35px;
  text-transform: uppercase;
  color: var(--muted-2);
  text-align: center;
}
.content-card.sidebar-card:not(.order-info-card) .sidebar-field.notes-field label{
  text-align: left; /* Notizen ausdrücklich nicht mittig */
}
.content-card.sidebar-card:not(.order-info-card) .date-display{
  font-weight: 700;
  color: var(--text);
  text-align: center; /* Ergebnis mittig */
}
.content-card.sidebar-card:not(.order-info-card) .sidebar-field .edit-input,
.content-card.sidebar-card:not(.order-info-card) .sidebar-field .edit-select{
  text-align: center; /* Ergebnis mittig (Bearbeiten-Modus) */
}

/* Notizenbox in Sidebar-Card etwas „cleaner“ */
.content-card.sidebar-card .notes-box{
  background: var(--panel); /* Notizen-Feld bewusst weiß */
  border: 1px solid rgba(15, 23, 42, 0.10);
  height: auto; /* Notizen immer vollständig anzeigen */
  max-height: none;
  overflow: visible;
  position: relative;
}
.content-card.sidebar-card .notes-box .edit-input{
  background: var(--panel); /* textarea/input im Edit-Modus ebenfalls weiß */
  border-radius: 14px;
}
.content-card.sidebar-card .notes-box .notes-content{
  white-space: pre-wrap; /* Absätze/Zeilenumbrüche anzeigen */
  overflow-wrap: anywhere;
}
.content-card.sidebar-card .notes-box.is-expanded{
  max-height: none;
  overflow: visible;
}
.content-card.sidebar-card .notes-box.is-editing{
  max-height: none; /* Bearbeiten: immer offen */
  overflow: visible;
}
.content-card.sidebar-card .notes-box.is-collapsed::after{
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 54px;
  pointer-events: none;
  background: linear-gradient(to bottom, rgba(255,255,255,0), rgba(255,255,255,1));
}
.content-card.sidebar-card .notes-toggle{
  margin-top: 10px;
  padding: 6px 10px;
  font-size: var(--fs-xs);
  display: none; /* Notizen haben kein Expand/Collapse mehr */
}
.content-card .card-titlebar{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 0;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 12px;
}
.content-card .card-titlebar h3{
  margin: 0;
  border-bottom: none;
  padding-bottom: 0;
}
.content-card .card-titlebar .btn{
  flex: 0 0 auto;
  white-space: nowrap;
}
.content-card h3 {
  margin-top: 0;
  margin-bottom: 16px;
  font-size: var(--fs-md);
  text-transform: uppercase;
  color: var(--muted);
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 12px;
}



/* Deal-Detail: Notizen sollen Absätze/Zeilenumbrüche anzeigen */
body[data-page="deal-detail"] .notes-box .notes-content{
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.contact-row {
  display: flex;
  gap: 16px;
  align-items: center;
}
.avatar-placeholder {
  width: 56px; height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: var(--fs-xl);
  flex-shrink: 0;
}
.contact-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.contact-name {
  font-size: var(--fs-lg);
  font-weight: 600;
}
.contact-details {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.cd-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: var(--fs-sm);
  color: var(--muted);
}
.cd-item svg {
  color: var(--muted-2);
}

.sidebar-field {
  margin-bottom: 16px;
}
.sidebar-field:last-child { margin-bottom: 0; }
.sidebar-field label {
  display: block;
  font-size: var(--fs-md);
  margin-bottom: 6px;
  font-weight: 600;
}

.user-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: var(--fs-md);
  font-weight: 500;
}
.user-avatar-sm {
  width: 24px; height: 24px;
  background: #cbd5e1;
  border-radius: 50%;
}

.date-display {
  font-size: var(--fs-md);
  font-variant-numeric: tabular-nums;
}
.date-display.highlight {
  color: var(--warn);
  font-weight: 600;
}
.date-display.warn{
  color: var(--warn);
  font-weight: 600;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: var(--fs-sm);
  font-weight: 500;
  padding: 6px 10px;
  border-radius: 8px;
  transition: all 0.2s;
  text-decoration: none;
  border: none;
  background: transparent;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
}
.back-link:hover {
  background: var(--panel-2);
  color: var(--text);
  text-decoration: none;
}

/* Edit Mode Inputs */
.edit-input, .edit-select {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  width: 100%;
  max-width: none;
  min-height: 38px;
  border-radius: 14px;
  padding: 8px 12px;
  border: 1px solid rgba(15, 23, 42, 0.10);
  background: rgba(255, 255, 255, 0.92);
  transition: box-shadow 160ms ease, border-color 160ms ease, background 160ms ease, transform 120ms ease;
  outline: none;
}
.edit-input:focus, .edit-select:focus {
  border-color: rgba(56, 140, 253, 0.55);
  background: var(--panel);
  box-shadow: none;
}

.edit-input:focus-visible,
.edit-select:focus-visible{
  border-color: rgba(56, 140, 253, 0.60);
  box-shadow: none;
}

.edit-input::placeholder{
  color: var(--muted-2);
  opacity: 0.85;
}

.edit-input:hover:not(:focus):not(:focus-visible),
.edit-select:hover:not(:focus):not(:focus-visible){
  border-color: rgba(15, 23, 42, 0.14);
  box-shadow: none;
}

.edit-input:disabled,
.edit-select:disabled{
  opacity: 0.60;
  cursor: not-allowed;
  box-shadow: none;
}

.edit-input[readonly],
.edit-select[readonly]{
  background: rgba(241, 245, 249, 0.70);
  border-color: rgba(15, 23, 42, 0.10);
  box-shadow: none;
}

textarea.edit-input{
  height: auto;
  min-height: 110px;
  padding: 10px 12px;
  resize: none;
  overflow: hidden;
  line-height: 1.55;
}

/* Native Select modernisieren (Chevron + appearance reset) */
select.edit-select{
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  padding-right: 40px; /* Platz für Chevron */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2364758b' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 18px 18px;
}

/* Availability: Select-Chevron sichtbar halten (wird sonst vom `.edit-input` background überschrieben) */
select.edit-input.availability-time{
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  padding-right: 34px; /* Platz für Pfeil */
  background-color: rgba(255, 255, 255, 0.92);
  background-image: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%20fill='none'%20stroke='%2394a3b8'%20stroke-width='2.5'%20stroke-linecap='round'%20stroke-linejoin='round'%3E%3Cpath%20d='m6%209%206%206%206-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-size: 16px 16px;
  /* Pfeil etwas weiter links als default */
  background-position: calc(100% - 18px) 50%;
}

/* Pfeile/Spinner bei number-Inputs entfernen */
input[type="number"].edit-input{
  -moz-appearance: textfield;
  appearance: textfield;
}
input[type="number"].edit-input::-webkit-outer-spin-button,
input[type="number"].edit-input::-webkit-inner-spin-button{
  -webkit-appearance: none;
  margin: 0;
}

/* Autofill (Chrome/Safari) optisch anpassen */
input.edit-input:-webkit-autofill,
textarea.edit-input:-webkit-autofill,
select.edit-select:-webkit-autofill{
  -webkit-text-fill-color: var(--text);
  box-shadow: 0 0 0 999px rgba(255, 255, 255, 0.92) inset;
}

/* Angebot-Vorschau: E-Mail Body Textfeld moderner */
body[data-page="angebot-vorschau"] #angebotEmailBody.edit-input{
  max-width: none;
  padding: 12px 14px;
  border-radius: var(--radius);
  border: 1px solid rgba(15, 23, 42, 0.10);
  background: var(--panel);
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.04), 0 10px 28px rgba(15, 23, 42, 0.06);
  line-height: 1.55;
  resize: none;
  transition: box-shadow 160ms ease, border-color 160ms ease, transform 160ms ease;
}
body[data-page="angebot-vorschau"] #angebotEmailBody.edit-input:hover{
  border-color: rgba(15, 23, 42, 0.16);
  box-shadow: none;
}
body[data-page="angebot-vorschau"] #angebotEmailBody.edit-input:focus{
  outline: none;
  border-color: rgba(56, 140, 253, 0.70);
  box-shadow: none;
}
/* Adjust styles for specific locations */
.dh-meta .edit-input {
  font-weight: 600;
  text-transform: uppercase;
  font-size: var(--fs-xs);
  padding: 2px 4px;
}
.dh-status .edit-input { /* Amount */
  font-weight: 700;
  font-size: var(--fs-md);
  width: 100px;
}
.dh-status .edit-select { /* Stage */
  font-size: var(--fs-sm);
  font-weight: 600;
  padding: 2px 4px;
}
.date-display .edit-input {
  font-size: var(--fs-sm);
  width: 140px;
}

@media (max-width: 850px) {
  .detail-layout {
    grid-template-columns: 1fr;
  }
}

/* ---------------------------------------
   Mitarbeiter (Master/Detail) – modern UI
---------------------------------------- */
.emp-layout{
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  gap: var(--gap);
  align-items: stretch;
  min-height: 0;
}
.emp-master,
.emp-detail{
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.emp-master-head{
  background: var(--panel);
  padding-bottom: 10px;
  border-bottom: none;
  margin-bottom: 0;
}
.emp-master-top{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}
.emp-master-title{
  font-size: var(--fs-sm);
  font-weight: 700;
  color: var(--text);
  margin: 0;
  letter-spacing: 0.2px;
}
.emp-toolbar{
  display: flex;
  align-items: center;
  gap: 10px;
}
.emp-list{
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-gutter: stable;
  padding-right: 4px;
  min-height: 0;
  flex: 1;
}

.emp-group{
  /* Rahmen/Radius werden je nach Zustand (open/closed) über summary + body gesetzt,
     damit der sticky Header beim Scrollen auch links/rechts "mitrundet". */
  border: none;
  border-radius: 0;
  background: transparent;
  /* Wichtig für "sticky" Gruppen-Header:
     Overflow auf einem Vorfahren kann position: sticky verhindern/kaputt machen. */
  overflow: visible;
  flex-shrink: 0;
  position: relative; /* Sticky-Header: Begrenzungsbox für "wegschieben" */
}
.emp-group summary{
  list-style: none;
  cursor: pointer;
  padding: 10px 12px;
  display: block;
  font-size: var(--fs-xs);
  font-weight: 700;
  color: var(--muted);
  user-select: none;
  background: var(--panel);
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
  position: sticky;
  top: 0;
  z-index: 3; /* über den Items, damit der Header beim Scrollen oben bleibt */
}

/* Ausgeklappt: kompletter Rahmen läuft über sticky Header + Body (saubere runde Ecken). */
.emp-group[open] summary{
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-top-left-radius: 14px;
  border-top-right-radius: 14px;
  background: #F5F6FA; /* helles grau */
  color: var(--text);
}
.emp-group[open] .emp-group-body{
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-top: none;
  border-radius: 0 0 14px 14px;
  background: var(--panel);
}

/* Eingeklappt: nur ein einfacher Rand um den Standort-Header */
.emp-group:not([open]){
  border: none;
  background: transparent;
}
.emp-group:not([open]) summary{
  border: 1px solid rgba(15, 23, 42, 0.12);
  border-radius: 14px;
  border-bottom: 1px solid rgba(15, 23, 42, 0.12); /* überschreibt offene Variante */
  background: #F1F7FF; /* voll deckend */
  color: var(--text);
}
.emp-group-summary-row{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.emp-group-label{
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.emp-group summary::-webkit-details-marker{ display:none; }
.emp-group .count{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 26px;
  height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  background: rgba(56, 140, 253, 0.10);
  border: 1px solid rgba(56, 140, 253, 0.22);
  color: var(--text);
  font-size: var(--fs-xs);
  font-weight: 700;
}
.emp-group-body{
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px;
}

.emp-item{
  width: 100%;
  text-align: left;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 14px;
  background: var(--panel);
  border: 1px solid rgba(15, 23, 42, 0.08);
  cursor: pointer;
  transition: all 0.2s;
}
.emp-item:hover{
  background: rgba(56, 140, 253, 0.08);
  border-color: rgba(56, 140, 253, 0.18);
}
.emp-item.active{
  background: #F1F7FF; /* gleiche Farbe wie Standort-Header */
  border-color: rgba(56, 140, 253, 0.22);
}
.emp-item:focus{
  outline: none;
  box-shadow: none;
}
.emp-item strong{ font-size: var(--fs-sm); }
.emp-item span{ font-size: var(--fs-xs); color: var(--muted); }
.emp-item-pos{
  margin-top: 6px;
  font-size: var(--fs-xs);
  color: var(--muted);
  font-weight: 700;
  line-height: 1.2;
}
.emp-item .right{
  text-align: right;
  white-space: nowrap;
  color: var(--muted);
  font-size: var(--fs-xs);
  font-weight: 700;
}
.emp-row{
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 6px;
}
.emp-chip{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 22px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: var(--fs-xs);
  font-weight: 700;
  /* Aktiv (Default): grün */
  background: rgba(22, 163, 74, 0.10);
  border: 1px solid rgba(22, 163, 74, 0.22);
  color: #166534;
}
.emp-chip.inactive{
  /* Inaktiv: neutral-grau (wie zuvor "Aktiv") */
  background: rgba(15, 23, 42, 0.05);
  border-color: rgba(15, 23, 42, 0.08);
  color: var(--text);
}

.emp-detail-head{
  background: var(--panel);
  padding-bottom: 12px;
  margin-bottom: 0;
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
}
.emp-detail-head-row{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.emp-detail-actions{
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
}
@media (max-width: 700px){
  .emp-detail-head-row{
    align-items: flex-start;
    flex-direction: column;
  }
  .emp-detail-actions{
    width: 100%;
  }
  .emp-detail-actions .btn{
    width: 100%;
    justify-content: center;
  }
}
.emp-form{
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding-right: 4px;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}
.emp-profile{
  display: flex;
  align-items: center;
  gap: 12px;
}
.emp-avatar{
  width: 46px;
  height: 46px;
  border-radius: 14px;
  background:
    radial-gradient(1200px 400px at 0% 0%, rgba(56,140,253,0.16) 0%, rgba(74,208,253,0.16) 40%, transparent 70%),
    var(--panel-2);
  border: 1px solid rgba(56, 140, 253, 0.22);
  display: grid;
  place-items: center;
  font-weight: 700;
  color: var(--text);
}
.emp-profile-name{
  font-size: var(--fs-lg);
  font-weight: 700;
}
.emp-profile-sub{
  margin-top: 2px;
  font-size: var(--fs-sm);
  color: var(--muted);
  font-weight: 700;
}

.emp-form .edit-input,
.emp-form .edit-select{
  width: 100%;
  max-width: none;
  border-radius: 14px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  background: var(--panel);
}

/* Mitarbeiter: klare Abgrenzung View vs Edit
   - View (default): Felder wirken wie "Read-only Tiles" (keine Input-Ränder)
   - Edit: bleibt wie aktuell (Inputs mit Rand) */
body[data-page="mitarbeiter"] .emp-form:not(.is-editing) .task-field{
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(15, 23, 42, 0.03);
  border: 1px solid rgba(15, 23, 42, 0.06);
}

body[data-page="mitarbeiter"] .emp-form:not(.is-editing) .edit-input,
body[data-page="mitarbeiter"] .emp-form:not(.is-editing) .edit-select{
  border: none;
  background: transparent;
  padding: 0;
  border-radius: 0;
  box-shadow: none;
  font-weight: 700;
  color: var(--text);
}
body[data-page="mitarbeiter"] .emp-form:not(.is-editing) .edit-input:focus,
body[data-page="mitarbeiter"] .emp-form:not(.is-editing) .edit-select:focus{
  outline: none;
  box-shadow: none;
}
/* Disabled Selects sollen im View-Modus nicht "ausgegraut" wirken */
body[data-page="mitarbeiter"] .emp-form:not(.is-editing) .edit-select:disabled{
  opacity: 1;
  color: var(--text);
  -webkit-text-fill-color: var(--text);
}
body[data-page="mitarbeiter"] .emp-form:not(.is-editing) textarea.edit-input{
  resize: none;
}
.emp-section{
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid rgba(15, 23, 42, 0.08);
}
.emp-section:first-child{
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}
.emp-section-title{
  font-size: var(--fs-xs);
  color: var(--muted);
  margin-bottom: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.emp-grid{
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.emp-grid .task-field{ margin-bottom: 0; }

@media (max-width: 900px){
  .emp-layout{ grid-template-columns: 1fr; }
  .emp-grid{ grid-template-columns: 1fr; }

  /* Mobile/kleine Fenster: linke Mitarbeiterliste begrenzen und innerhalb scrollen */
  body[data-page="mitarbeiter"] .emp-master{
    max-height: 55vh;
    overflow: hidden; /* Scroll liegt in .emp-list */
  }
}

/* Mitarbeiter: Master & Detail sollen EINZELN scrollen (Desktop) */
@media (min-width: 901px){
  body[data-page="mitarbeiter"] .content{
    overflow: hidden; /* verhindert Seiten-Scroll, damit nur die Cards scrollen */
    height: 100%;
  }

  body[data-page="mitarbeiter"] .emp-layout{
    flex: 1;
    min-height: 0;
    height: 100%;
  }

  body[data-page="mitarbeiter"] .emp-master,
  body[data-page="mitarbeiter"] .emp-detail{
    height: 100%;
    min-height: 0;
    overflow: hidden; /* Scroll liegt in der Liste / im Formular */
  }
}

/* ---------------------------------------
   Bestellmanagement (Dialog + Artikel)
---------------------------------------- */
.dialog-header{
  padding: 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.dialog-body{
  padding: 24px;
}
.dialog-footer{
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  background: var(--panel-2);
  border-bottom-left-radius: 18px;
  border-bottom-right-radius: 18px;
}

.order-detail-title{
  margin: 0;
  font-size: var(--fs-xl);
}
.order-detail-meta{
  font-size: var(--fs-xs);
  color: var(--muted);
  margin-bottom: 14px;
  line-height: 1.4;
}
.order-detail-section-title{
  font-size: var(--fs-xs);
  color: var(--muted);
  margin-bottom: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.order-items{
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Bestell-Detail: Bestellinfos über Artikel, beide volle Breite */
body[data-page="bestellung-detail"] .content{
  overflow: hidden; /* nur die Artikelliste scrollt */
}
body[data-page="bestellung-detail"] .detail-container{
  flex: 1;
  min-height: 0;
}
body[data-page="bestellung-detail"] .detail-layout{
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: stretch; /* wichtig: sonst bleiben Cards schmal (inherit von .detail-layout: align-items:start) */
}
body[data-page="bestellung-detail"] .detail-layout > .content-card{
  width: 100%;
}
body[data-page="bestellung-detail"] .order-items-card{
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
body[data-page="bestellung-detail"] .order-items-card .order-items-head{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
body[data-page="bestellung-detail"] .order-items-card .order-items-head h3{
  margin: 0;
}
body[data-page="bestellung-detail"] .order-items-card .sum-badge{
  flex: 0 0 auto;
  text-align: right;
  padding: 6px 12px;
  border-radius: 99px;
  font-size: var(--fs-sm);
  font-weight: 600;
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid rgba(15,23,42,0.1);
  white-space: nowrap;
}
body[data-page="bestellung-detail"] .order-items-card .order-items{
  flex: 1;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding-right: 4px;
}

/* Bestell-Detail: Bestellinformationen optisch aufräumen */
body[data-page="bestellung-detail"] .order-info-card h3{
  margin-bottom: 6px;
}

/* Bestellinfos: Erstellt von / Standort / Status in einer Zeile */
body[data-page="bestellung-detail"] .order-info-card .order-info-row{
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  padding-top: 4px;
}
body[data-page="bestellung-detail"] .order-info-card .order-info-row .sidebar-field{
  border-bottom: none;
  padding: 0;
}
body[data-page="bestellung-detail"] .order-info-card .order-info-row + .sidebar-field{
  margin-top: 12px;
}

@media (max-width: 900px){
  body[data-page="bestellung-detail"] .order-info-card .order-info-row{
    grid-template-columns: 1fr;
    gap: 10px;
  }
}

/* Bestellinfos: links Standort/Mitarbeiter/Status untereinander, rechts Adresse (rechtsbündig) */
body[data-page="bestellung-detail"] .order-info-card .order-info-grid{
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
  padding-top: 4px;
}
body[data-page="bestellung-detail"] .order-info-card .order-info-left{
  display: flex;
  flex-direction: column;
}
body[data-page="bestellung-detail"] .order-info-card .order-info-left .sidebar-field{
  margin: 0;
  display: grid;
  grid-template-columns: 140px minmax(0, 1fr);
  align-items: baseline;
  justify-content: start;
  gap: 16px;
  border-bottom: none; /* keine Linien zwischen Standort/Mitarbeiter/Status */
  padding: 6px 0;      /* näher zueinander */
}
body[data-page="bestellung-detail"] .order-info-card .order-info-left .sidebar-field label{
  margin-bottom: 0; /* Label + Wert in einer Zeile */
}
body[data-page="bestellung-detail"] .order-info-card .order-info-left .sidebar-field .date-display{
  text-align: left;
  font-weight: 700;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 900px){
  body[data-page="bestellung-detail"] .order-info-card .order-info-left .sidebar-field{
    grid-template-columns: 1fr;
    gap: 6px;
  }
  body[data-page="bestellung-detail"] .order-info-card .order-info-left .sidebar-field .date-display{
    white-space: normal;
  }
}
body[data-page="bestellung-detail"] .order-info-card .order-info-right{
  display: flex;
  justify-content: flex-start; /* rechter Bereich: Inhalt links ausrichten */
}
body[data-page="bestellung-detail"] .order-info-card .order-info-right .sidebar-field{
  margin: 0;
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 50px;
}
body[data-page="bestellung-detail"] .order-info-card .order-info-right #orderAdresse{
  /* blaues Feld nur so breit wie Inhalt, Label steht links daneben */
  display: inline-block;
  width: fit-content;
  max-width: 100%;
  text-align: left;
}

/* Adresse-Label nicht mehr "drüber", sondern links neben dem Feld */
body[data-page="bestellung-detail"] .order-info-card .order-info-right .sidebar-field label{
  margin-bottom: 0;
  padding-top: 2px;
  white-space: nowrap;
}

@media (max-width: 900px){
  body[data-page="bestellung-detail"] .order-info-card .order-info-grid{
    grid-template-columns: 1fr;
  }
  body[data-page="bestellung-detail"] .order-info-card .order-info-right{
    justify-content: flex-start;
  }
  body[data-page="bestellung-detail"] .order-info-card .order-info-right #orderAdresse{
    text-align: left;
  }
}
body[data-page="bestellung-detail"] .order-info-card .sidebar-field{
  margin: 0;
  padding: 12px 0;
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
}
body[data-page="bestellung-detail"] .order-info-card .sidebar-field:last-child{
  border-bottom: none;
  padding-bottom: 0;
}
body[data-page="bestellung-detail"] .order-info-card .sidebar-field:first-of-type{
  padding-top: 4px;
}
body[data-page="bestellung-detail"] .order-info-card .sidebar-field label{
  margin-bottom: 6px;
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: 0.4px;
  text-transform: uppercase;
}
body[data-page="bestellung-detail"] .order-info-card .date-display{
  font-weight: 700;
  color: var(--text);
}
body[data-page="bestellung-detail"] .order-info-card #orderAdresse{
  margin-top: 0;
  padding: 10px 25px;
  border-radius: 12px;
  background: var(--panel-2);
  border: 1px solid rgba(15, 23, 42, 0.08);
  font-weight: 700;
  color: var(--text);
}
body[data-page="bestellung-detail"] .order-info-card #orderSumInfo{
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  border-radius: 99px;
  font-size: var(--fs-sm);
  font-weight: 600;
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid rgba(15,23,42,0.1);
}
.order-items-empty{
  font-size: var(--fs-sm);
  color: var(--muted);
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px dashed rgba(15, 23, 42, 0.18);
  background: rgba(15, 23, 42, 0.03);
}
.order-item{
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr);
  gap: 12px;
  padding: 12px;
  border-radius: 14px;
  background: var(--panel);
  border: 1px solid rgba(15, 23, 42, 0.08);
}
.order-item-img{
  width: 56px;
  height: 56px;
  border-radius: 12px;
  object-fit: cover;
  border: 1px solid rgba(15, 23, 42, 0.08);
  background: var(--panel-2);
}
.order-item-img.placeholder{
  display: block;
}
.order-item-title{
  font-size: var(--fs-sm);
  font-weight: 700;
  color: var(--text);
  line-height: 1.25;
}
.order-item-row{
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}
.order-item-right{
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  justify-items: end;
  align-content: start;
}
.order-item-kv{
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.order-item-kv .k{
  display: block;
  font-size: var(--fs-xs);
  color: var(--muted-2);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.order-item-kv .v{
  display: block;
  margin-top: 2px;
  font-size: var(--fs-xs);
  color: var(--muted);
  font-weight: 700;
}

@media (max-width: 900px){
  .order-item-row{
    grid-template-columns: 1fr;
  }
  .order-item-right{
    justify-items: start;
  }
  .order-item-kv{
    text-align: left;
  }
}
.order-item-options{
  margin-top: 6px;
  font-size: var(--fs-xs);
  color: var(--muted-2);
  font-weight: 600;
}

.order-address{
  white-space: pre-wrap;
}

/* ---------- Deal Detail: "Alle Daten" (Key/Value Liste) ---------- */
/* ---------- Deal Detail: Tabs (Ansprechpartner / Adressen) ---------- */
.tabs{
  display: flex;
  gap: 0;
  padding: 1px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--panel-2);
  width: 100%;
}
.tab-btn{
  appearance: none;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  font-weight: 600;
  font-size: var(--fs-md);
  padding: 8px 12px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.2s;
  flex: 1 1 0;
  text-align: center;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.1;
  min-height: 34px;
}
.tab-btn:hover{
  background: rgba(56, 140, 253, 0.08);
  color: var(--text);
}
.tab-btn.active{
  background: var(--panel);
  color: var(--text);
  border-color: rgba(56, 140, 253, 0.22);
  box-shadow: 0 6px 16px rgba(15,23,42,0.06);
}
.tab-panels{ margin-top: 12px; }
.tab-panel[hidden]{ display:none !important; }

.mini-card{
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--panel-2);
  padding: 12px;
}
.mini-card-title{
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--text);
}
.mini-card-head{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.mini-card-head .mini-card-title{
  margin: 0;
}
.mini-card-head .mini-remove{
  margin-left: auto;
}
.mini-card-sub{
  white-space: pre-wrap;
}
.mini-grid{
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 10px;
}
.mini-grid .edit-input{
  width: 100%;
  max-width: none;
}
.mini-actions{
  display:flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
}
.crm-user-mini-card{
  padding: 10px;
  border-radius: 16px;
}
.crm-user-mini-card .mini-card-head{
  gap: 10px;
}
.crm-user-mini-card .mini-card-title{
  font-weight: 600;
  letter-spacing: 0.2px;
  font-size: 0.9rem;
  margin-left: 4px;
}
.crm-user-mini-card .crm-user-actions{
  display:flex;
  align-items:center;
  gap: 8px;
}
.crm-user-mini-card .crm-user-active{
  display:flex;
  align-items:center;
  gap: 8px;
}
.crm-user-mini-card .crm-user-active .mini-card-sub{
  color: var(--muted);
}
.crm-user-mini-card .crm-user-active .toggle-switch{
  height: 28px;
}
.crm-user-mini-card .crm-user-copy-btn{
  padding: 6px 10px;
  font-size: var(--fs-xs);
  font-weight: 800;
}
.crm-user-mini-card .mini-remove{
  padding: 6px 10px;
}
.crm-user-mini-card .mini-grid{
  gap: 8px;
  margin-top: 10px;
}
.crm-user-mini-card .edit-input{
  height: 36px;
  min-height: 36px;
  padding: 8px 10px;
  font-size: var(--fs-sm);
}
.crm-user-mini-card .task-field--toggle .toggle-switch{
  height: 36px;
}

/* ---------- Customer Detail: Users (one-line rows) ---------- */
.crm-user-row{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 8px 0;
  padding: 10px 12px;
  border: 1px solid rgba(15, 23, 42, 0.08);
  background: rgba(241, 245, 249, 0.55);
  border-radius: 16px;
  cursor: pointer;
}
.crm-user-row:hover{
  background: rgba(241, 245, 249, 0.75);
}
.crm-user-row:focus-visible{
  outline: 2px solid rgba(56, 140, 253, 0.55);
  outline-offset: 2px;
}
.crm-user-row-title{
  flex: 1 1 auto;
  min-width: 0;
  font-weight: 700;
  font-size: var(--fs-sm);
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.crm-user-row-actions{
  display:flex;
  align-items:center;
  gap: 8px;
  flex: 0 0 auto;
}
.crm-user-password{
  border: 1px solid rgba(15, 23, 42, 0.10);
  background: rgba(255, 255, 255, 0.7);
  color: var(--text);
  border-radius: 12px;
  padding: 6px 10px;
  font-size: var(--fs-xs);
  font-weight: 800;
  cursor: pointer;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  white-space: nowrap;
  cursor: pointer;
}
.crm-user-password:hover{
  background: rgba(255, 255, 255, 0.9);
}
.crm-user-password:focus-visible{
  outline: 2px solid rgba(56, 140, 253, 0.55);
  outline-offset: 2px;
}
.mini-remove{
  border: 1px solid rgba(239,68,68,0.25);
  background: rgba(239,68,68,0.08);
  color: #991b1b;
  border-radius: 12px;
  padding: 4px 10px;
  font-size: var(--fs-xs);
  font-weight: 700;
  cursor: pointer;
}
.mini-remove:hover{
  background: rgba(239,68,68,0.12);
}

@media (max-width: 900px){
  .mini-grid{ grid-template-columns: 1fr; }
}

/* ---------- Deal Detail: Tabs – modernere Abstände (scoped) ---------- */
body[data-page="deal-detail"] #deal-contact-address-tabs .tab-panels{
  margin-top: 14px;
}
body[data-page="deal-detail"] #deal-contact-address-tabs .tab-panel{
  display: grid;
  gap: 12px;
}

/* Deal-Detail: Tabs-Inhalte sollen bei vielen Einträgen intern scrollbar sein */
body[data-page="deal-detail"] #deal-contact-address-tabs{
  display: flex;
  flex-direction: column;
  min-height: 0; /* wichtig für inneres Overflow in Flex-Child */
}
body[data-page="deal-detail"] #deal-contact-address-tabs .tabs{
  flex: 0 0 auto;
}
body[data-page="deal-detail"] #deal-contact-address-tabs .tab-panels{
  flex: 1 1 auto;
  min-height: 0; /* wichtig, damit overflow: auto greift */
  overflow: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding-right: 4px; /* Platz für Scrollbar, ohne Layout-Jumps */
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding-top: 12px;
  padding-bottom: 12px;
}
body[data-page="deal-detail"] #deal-contact-address-tabs .tab-panel{
  /* Wichtig: .tab-panels ist ein Flex-Container (column). Wenn Children schrumpfen dürfen,
     kann der Inhalt in den nächsten Abschnitt „reinmalen“ (Überlappung).
     -> daher: kein Shrink, Höhe ergibt sich aus Content. */
  flex: 0 0 auto;
  min-height: auto;
  display: block; /* override alte Grid-Styles: Sections sollen volle Breite haben */
}

/* Deal-Detail: einheitliche Section-Container */
body[data-page="deal-detail"] #deal-contact-address-tabs .deal-section{
  border: 1px solid rgba(15, 23, 42, 0.10);
  border-radius: 16px;
  padding: 14px;
  background: var(--bg);
}
body[data-page="deal-detail"] #deal-contact-address-tabs .deal-section-head{
  display: flex;
  justify-content: space-between; /* Titel links, Aktion rechts */
  align-items: center;
  gap: 10px;
  padding-bottom: 10px;
  margin-bottom: 12px;
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
}
body[data-page="deal-detail"] #deal-contact-address-tabs .deal-section-title{
  font-weight: 700;
  letter-spacing: 0.3px;
  font-size: var(--fs-lg);
}
body[data-page="deal-detail"] #deal-contact-address-tabs .deal-section-body{
  min-height: 0;
}

/* Deal-Detail Tabs: Cards innerhalb der Panel-Container mit Gap stapeln */
body[data-page="deal-detail"] #deal-contacts-panel,
body[data-page="deal-detail"] #deal-employees-panel,
body[data-page="deal-detail"] #deal-addresses-panel{
  display: grid;
  gap: 12px;
}

/* Mini-Cards in den Tabs etwas cleaner (weiß + subtiler shadow) */
body[data-page="deal-detail"] #deal-contact-address-tabs .mini-card{
  background: var(--panel);
  border-color: rgba(15, 23, 42, 0.10);
  border-radius: 16px;
  padding: 14px;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.04);
}
body[data-page="deal-detail"] #deal-contact-address-tabs .mini-card-title{
  font-size: var(--fs-md);
}


/* Ansprechpartner: Kopfzeile (Name links, Haupt/Weitere rechts) */
body[data-page="deal-detail"] #deal-contact-address-tabs .contact-card-head{
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}
body[data-page="deal-detail"] #deal-contact-address-tabs .contact-card-kind{
  flex: 0 0 auto;
  margin-left: auto;
  font-size: var(--fs-xs);
  font-weight: 700;
  color: var(--muted);
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid rgba(15, 23, 42, 0.10);
  background: rgba(15, 23, 42, 0.03);
}

/* Ansprechpartner: Kontakt-Daten (E-Mail/Telefon) */
body[data-page="deal-detail"] #deal-contact-address-tabs .contact-card-meta{
  margin-top: 10px;
  display: grid;
  gap: 8px;
}
body[data-page="deal-detail"] #deal-contact-address-tabs .contact-meta-row{
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
}
body[data-page="deal-detail"] #deal-contact-address-tabs .contact-meta-k{
  display: block;
  font-size: var(--fs-md);
  color: var(--muted);
  margin-bottom: 6px;
  font-weight: 600;
}
body[data-page="deal-detail"] #deal-contact-address-tabs .contact-meta-link{
  color: var(--text);
  text-decoration: none;
  border-bottom: 1px solid rgba(56, 140, 253, 0.22);
  padding-bottom: 1px;
  overflow-wrap: anywhere;
}
body[data-page="deal-detail"] #deal-contact-address-tabs .contact-meta-link:hover{
  color: var(--accent);
  border-bottom-color: rgba(56, 140, 253, 0.45);
}
body[data-page="deal-detail"] #deal-contact-address-tabs .contact-meta-empty{
  color: var(--muted);
  font-weight: 700;
}
@media (max-width: 900px){
  body[data-page="deal-detail"] #deal-contact-address-tabs .contact-meta-row{
    grid-template-columns: 1fr;
    gap: 4px;
  }
}

/* Mitarbeiter-Tab: Picker kompakter (Select nicht volle Breite, Button näher) */
body[data-page="deal-detail"] #deal-employees-panel .employees-picker-grid{
  grid-template-columns: minmax(240px, 420px) auto;
  gap: 12px;
  align-items: center;
  justify-content: start;
}
body[data-page="deal-detail"] #deal-employees-panel .employees-picker{
  margin-top: 10px;
}
body[data-page="deal-detail"] #deal-employees-panel .employees-selected-list{
  display: grid;
  gap: 12px;
}
@media (max-width: 900px){
  body[data-page="deal-detail"] #deal-employees-panel .employees-picker-grid{
    grid-template-columns: 1fr;
  }
  body[data-page="deal-detail"] #deal-employees-panel .employees-picker-grid .btn{
    width: 100%;
  }
}