/* Dashboard Sidebar — Cascade-Hub 1:1 (content/shell.md), Hue Teal. View-Nav (kein App-Switcher). */
.sidebar {
  background: linear-gradient(180deg, var(--bg-elev-1) 0%, var(--bg-base) 100%);
  border-right: 1px solid var(--border-subtle);
  padding: calc(18px + env(safe-area-inset-top, 0px)) 14px calc(18px + env(safe-area-inset-bottom, 0px));
  display: flex;
  flex-direction: column;
  gap: 7px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  transition: padding 0.2s ease;
}
html[data-theme='light'] .sidebar {
  background: linear-gradient(180deg, #ffffff 0%, #f5faf9 100%);
  border-right: 1px solid rgba(13, 80, 74, 0.1);
  box-shadow: 1px 0 12px -6px rgba(13, 80, 74, 0.12);
}

/* Brand */
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 8px 18px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 12px;
}
html[data-theme='light'] .brand {
  border-bottom: 1px solid rgba(13, 80, 74, 0.18);
}
.brand-mark {
  width: 50px;
  height: 50px;
  flex-shrink: 0;
  --c1: #5eead4;
  --c2: #2dd4bf;
  --c3: #06b6d4;
  filter: drop-shadow(0 0 12px rgba(45, 212, 191, 0.22));
}
html[data-theme='light'] .brand-mark {
  --c1: #0f766e;
  --c2: #0d9488;
  --c3: #0891b2;
  filter: none;
}
.brand-name {
  flex: 1;
  min-width: 0;
  position: relative;
  padding-right: 40px;
  font-size: 16.5px;
  font-weight: 700;
  letter-spacing: -0.2px;
  line-height: 1.15;
  color: var(--t-bright);
}
.brand-name > .brand-badge {
  position: absolute;
  top: 0;
  right: 0;
}
.brand-badge {
  font-size: 9px;
  font-weight: 800;
  padding: 2px 6px;
  letter-spacing: 0.6px;
  border-radius: var(--r-sm);
  background: var(--accent-soft-bg);
  color: var(--accent);
  border: 1px solid var(--accent-line);
}
.brand-name small {
  display: block;
  margin-top: 3px;
  margin-right: -40px;
  font-family: 'Cormorant Garamond', 'Times New Roman', serif;
  font-style: italic;
  font-weight: 400;
  font-size: 13.5px;
  letter-spacing: 0.2px;
  color: var(--t-secondary);
}
.brand-toggle {
  margin-left: auto;
  appearance: none;
  background: transparent;
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  color: var(--t-muted);
  cursor: pointer;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.brand-toggle:hover {
  background: var(--accent-soft-bg);
  color: var(--t-bright);
  border-color: var(--border-strong);
}
.brand-toggle svg {
  width: 14px;
  height: 14px;
}
.brand-toggle .ico-close {
  display: none;
}
html[data-sidebar='collapsed'] .brand-toggle .ico-close {
  display: block;
}
html[data-sidebar='collapsed'] .brand-toggle .ico-open {
  display: none;
}

/* Nav-Section + Item */
.nav-section {
  padding: 16px 8px 8px;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--t-muted);
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 10px 12px;
  border-radius: var(--r-md);
  color: var(--t-secondary);
  font-size: 14.5px;
  font-weight: 500;
  cursor: pointer;
  position: relative;
  border: 1px solid transparent;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
  background: transparent;
  font-family: inherit;
  width: 100%;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
}
.nav-item:hover {
  background: var(--accent-soft-bg);
  color: var(--t-bright);
}
.nav-item:hover .nav-icon {
  color: var(--accent);
}

/* Active + Teal-Rail */
.nav-item.active::before {
  content: '';
  position: absolute;
  left: -14px;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 22px;
  background: var(--accent-grad);
  border-radius: 0 2px 2px 0;
}
html:not([data-theme='light']) .nav-item.active {
  background: #e8efed;
  color: #0e1715;
  border-color: rgba(255, 255, 255, 0.18);
}
html:not([data-theme='light']) .nav-item.active .nav-icon {
  color: #0e1715;
}
html:not([data-theme='light']) .nav-item.active::before {
  box-shadow: 0 0 14px rgba(45, 212, 191, 0.6), 0 0 2px #ffffff;
}
html[data-theme='light'] .nav-item.active {
  background: var(--accent-soft-bg);
  color: var(--t-bright);
  border-color: var(--accent-line);
}
html[data-theme='light'] .nav-item.active .nav-icon {
  color: var(--accent);
}
html[data-theme='light'] .nav-item.active::before {
  box-shadow: 0 0 12px rgba(15, 118, 110, 0.45);
}

.nav-icon {
  width: 20px;
  height: 20px;
  color: var(--t-muted);
  flex-shrink: 0;
  transition: color 0.15s ease;
}

/* User-Tile (invertierte Kachel) */
.user-tile {
  margin-top: 6px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  border-radius: var(--r-md);
  background: #e6f1f0;
  border: 1px solid rgba(255, 255, 255, 0.16);
  cursor: pointer;
  transition: border-color 0.15s ease;
  width: 100%;
  text-align: left;
}
.user-tile:hover {
  border-color: var(--border-strong);
}
html[data-theme='light'] .user-tile {
  background: #16212b;
  border-color: rgba(0, 0, 0, 0.4);
}
.user-avatar {
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12.5px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
  position: relative;
  isolation: isolate;
}
.user-avatar::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: var(--r-md);
  transform: skewX(-6deg);
  background: linear-gradient(
    140deg,
    color-mix(in oklab, var(--avatar-bg, #2dd4bf) 80%, #ffffff) 0%,
    var(--avatar-bg, #2dd4bf) 50%,
    color-mix(in oklab, var(--avatar-bg, #2dd4bf) 82%, #000000) 100%
  );
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.28) inset, 0 -1px 0 rgba(0, 0, 0, 0.2) inset,
    0 4px 12px -4px rgba(45, 212, 191, 0.5);
}
.user-info {
  flex: 1;
  min-width: 0;
}
.user-name {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.15;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #0e1715;
}
.user-role {
  font-size: 12px;
  margin-top: 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  color: rgba(14, 23, 21, 0.6);
}
html[data-theme='light'] .user-name {
  color: #ffffff;
}
html[data-theme='light'] .user-role {
  color: rgba(255, 255, 255, 0.6);
}
.user-action {
  color: rgba(14, 23, 21, 0.55);
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s ease, background 0.15s ease;
}
.user-action:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #0e1715;
}
html[data-theme='light'] .user-action {
  color: rgba(255, 255, 255, 0.55);
}
html[data-theme='light'] .user-action:hover {
  color: #ffffff;
}
.user-action svg {
  width: 16px;
  height: 16px;
}

/* sb-settings / Theme-Toggle */
.sb-settings {
  margin-top: 6px;
  padding: 10px 12px;
  border-radius: var(--r-md);
  color: var(--t-muted);
  font-size: 14px;
  background: transparent;
  border: 1px solid transparent;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  font-family: inherit;
  width: 100%;
  text-align: left;
}
.sb-settings:hover {
  background: var(--accent-soft-bg);
  color: var(--t-secondary);
}
.sb-settings svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

/* Collapsed (Desktop-Rail) */
html[data-sidebar='collapsed'] .sidebar {
  padding: 14px 10px;
}
html[data-sidebar='collapsed'] .sidebar .nav-section,
html[data-sidebar='collapsed'] .sidebar .nav-item span:not(.nav-icon),
html[data-sidebar='collapsed'] .sidebar .brand-name,
html[data-sidebar='collapsed'] .sidebar .user-info,
html[data-sidebar='collapsed'] .sidebar .sb-settings span {
  display: none;
}
html[data-sidebar='collapsed'] .sidebar .nav-item {
  justify-content: center;
  padding: 10px;
}
html[data-sidebar='collapsed'] .sidebar .brand {
  flex-direction: column;
  padding: 4px 0 14px;
  gap: 10px;
  align-items: center;
}
html[data-sidebar='collapsed'] .sidebar .brand-toggle {
  margin-left: 0;
}
html[data-sidebar='collapsed'] .sidebar .user-tile {
  padding: 6px;
  justify-content: center;
  overflow: hidden;
}
html[data-sidebar='collapsed'] .sidebar .user-action {
  display: none;
}
html[data-sidebar='collapsed'] .sidebar .nav-item.active::before {
  left: -10px;
}
html[data-sidebar='collapsed'] .sidebar .sb-settings {
  justify-content: center;
  padding: 7px 6px;
}

/* Mobile-Drawer (≤720) */
@media (max-width: 720px) {
  .sidebar {
    position: fixed;
    top: 0;
    left: -300px; /* off-canvas: Breite 280 + Shadow-Spielraum */
    bottom: 0;
    width: 280px;
    z-index: 1100;
    /* §8f.3: `left`-Transition statt `transform` — transform auf position:fixed bricht auf iOS
       das innere overflow:auto-Scrollen. + Inner-Scroller-Härtung (touch-momentum, kein Body-Bleed). */
    transition: left 0.28s cubic-bezier(0.2, 0.7, 0.2, 1);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    box-shadow: 4px 0 24px -8px rgba(0, 0, 0, 0.5);
  }
  html[data-sidebar='open'] .sidebar {
    left: 0;
  }
}

/* ── App-Switcher + Shell-Globals (PB1 Parity) ── */
.user-main {
  display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0;
  background: none; border: 0; padding: 0; margin: 0; cursor: pointer;
  font: inherit; text-align: left; color: inherit;
}
/* App-Switcher-Icons: gedämpft im Ruhezustand, Markenfarbe erst beim Hover (CRM-Muster). */
.app-link .nav-icon { color: var(--t-muted); }
.app-link:hover .nav-icon { color: var(--app-color, var(--t-bright)); }
/* Beim Hover leuchtet auch die Schrift in der Markenfarbe (nicht nur das Logo). */
.app-link:hover { color: var(--app-color, var(--t-bright)); }

.live-call {
  margin-top: 6px; display: flex; flex-direction: column; align-items: flex-start; gap: 3px; width: 100%;
  padding: 8px 12px; border-radius: var(--r-md); font-family: inherit; cursor: pointer; text-align: left;
  color: var(--danger);
  background: color-mix(in oklab, var(--danger) 14%, transparent);
  border: 1px solid color-mix(in oklab, var(--danger) 40%, transparent);
}
.live-head { display: flex; align-items: center; gap: 7px; font-size: 11px; font-weight: 700; letter-spacing: 0.5px; }
.live-extra { font-size: 10px; font-weight: 600; opacity: 0.7; }
.live-meta {
  font-size: 12px; font-weight: 500; color: var(--t-secondary);
  line-height: 1.35; overflow-wrap: anywhere; max-width: 100%;
}
.live-rep { font-weight: 600; }
/* Dauer immer auf eigener Zeile → bleibt auch bei langen Lead-Namen sichtbar (kein Abschneiden). */
.live-dur { display: block; color: var(--t-muted); font-variant-numeric: tabular-nums; margin-top: 1px; }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--danger); flex-shrink: 0; animation: livePulse 1.4s ease-in-out infinite; }
@keyframes livePulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }
@media (prefers-reduced-motion: reduce) { .live-dot { animation: none; } }
html[data-sidebar='collapsed'] .sidebar .live-lbl,
html[data-sidebar='collapsed'] .sidebar .live-extra,
html[data-sidebar='collapsed'] .sidebar .live-meta { display: none; }

/* P0.5: powered-by-V-Herz (bleibende Produkt-Attribution; VH-Rot wirkt in beiden Themes) */
.vh-pb-logo { height: 10px; width: auto; vertical-align: -1px; }
