/* Emergency UI stabilization: readable chat/management, stable native dropdowns, true rounded clipping */
:root {
  --sai-glass-bg: rgba(255,255,255,.78);
  --sai-glass-bg-strong: rgba(255,255,255,.94);
  --sai-ink: #142238;
  --sai-muted: #5f6f86;
  --sai-border: rgba(120,142,170,.22);
  --sai-shadow-soft: 0 20px 54px rgba(15, 23, 42, .10);
  --sai-green-touch: rgba(219, 252, 231, .96);
  --sai-lila-touch: rgba(245, 240, 255, .96);
}

/* Keine blassen/eckigen Artefakte neben Rundungen */
.portal-card,
.dashboard-card,
.module-card,
.stat-card,
.shared-card,
.team-user-card,
.recommendation-card,
.files-entry,
.file-card,
.admin-container,
.modal-content,
.dropdown-menu,
.popover,
.notification-menu,
.profile-menu,
.unified-shell,
.unified-sidebar,
.unified-chat,
.unified-info,
.auth-card,
.table-wrap,
.admin-table,
.stats-plus-chart-card,
.stats-plus-controls-card {
  border-radius: 24px !important;
  overflow: hidden !important;
  background-clip: padding-box !important;
  isolation: isolate !important;
}
.dashboard-card::before,
.dashboard-card::after,
.module-card::before,
.module-card::after,
.portal-card::before,
.portal-card::after,
.nav-pill::before,
.nav-pill::after,
.top-icon-btn::before,
.top-icon-btn::after,
.icon-btn::before,
.icon-btn::after {
  content: none !important;
  display: none !important;
}

/* Native Dropdowns statt kaputter Fake-Dropdowns */
select.sai-stable-native-select,
.stats-plus-modern-panel select,
.auth-modern-page select {
  display: block !important;
  position: relative !important;
  opacity: 1 !important;
  visibility: visible !important;
  pointer-events: auto !important;
  width: 100% !important;
  min-height: 50px !important;
  padding: 0 46px 0 16px !important;
  border-radius: 18px !important;
  border: 1px solid rgba(120,142,170,.30) !important;
  color: #142238 !important;
  font-weight: 800 !important;
  background:
    linear-gradient(135deg, rgba(255,255,255,.96), rgba(248,250,252,.90)) padding-box,
    linear-gradient(135deg, rgba(125,211,252,.55), rgba(196,181,253,.48)) border-box !important;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.85), 0 10px 28px rgba(15,23,42,.08) !important;
  appearance: auto !important;
  -webkit-appearance: menulist !important;
}
.auth-modern-page select.sai-stable-native-select,
.auth-modern-page select {
  color: #f6fbff !important;
  border-color: rgba(222,236,255,.18) !important;
  background: rgba(255,255,255,.095) !important;
}
.auth-modern-page select option,
.stats-plus-modern-panel select option,
select.sai-stable-native-select option {
  color: #142238 !important;
  background: #ffffff !important;
}
.sai-native-select-hidden.sai-stable-native-select {
  clip: auto !important;
  clip-path: none !important;
  height: auto !important;
  margin: 0 !important;
}
.stats-plus-modern-panel .sai-custom-select,
.auth-modern-page .sai-custom-select {
  display: none !important;
}
.stats-plus-modern-panel .modern-select-label,
.auth-modern-page .auth-grid {
  overflow: visible !important;
}

/* Chat: lesbare Nachrichten mit leichtem Farb-Touch, kein blasses Glas */
.unified-message-row {
  display: flex !important;
  align-items: flex-end !important;
  gap: 10px !important;
  margin: 8px 0 !important;
}
.unified-message-row.mine { justify-content: flex-end !important; }
.unified-message-row.theirs { justify-content: flex-start !important; }
.unified-message-avatar {
  flex: 0 0 32px !important;
  width: 32px !important;
  height: 32px !important;
  border-radius: 50% !important;
  border: 1px solid rgba(148,163,184,.35) !important;
  overflow: hidden !important;
  box-shadow: 0 8px 18px rgba(15,23,42,.10) !important;
}
.unified-message,
.sai-chat-message,
.sai2-chat-msg,
.message-bubble {
  color: #132238 !important;
  opacity: 1 !important;
  text-shadow: none !important;
  font-weight: 650 !important;
  line-height: 1.45 !important;
  border: 1px solid rgba(120,142,170,.20) !important;
  box-shadow: 0 12px 28px rgba(15,23,42,.09) !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}
.unified-message.mine,
.sai-chat-message.mine,
.sai2-chat-msg.mine,
.message-bubble.own,
.message-bubble.mine {
  background: linear-gradient(135deg, var(--sai-green-touch), rgba(237,233,254,.96)) !important;
  color: #102033 !important;
}
.unified-message.theirs,
.sai-chat-message.theirs,
.sai2-chat-msg.theirs,
.message-bubble.theirs {
  background: linear-gradient(135deg, #ffffff, var(--sai-lila-touch)) !important;
  color: #132238 !important;
}
.unified-message small,
.sai-chat-message small,
.sai2-chat-msg small,
.message-bubble small {
  color: #5b677a !important;
  opacity: 1 !important;
  font-weight: 700 !important;
}
.unified-chat-title,
#unifiedTitle,
#unifiedSubtitle,
#unifiedInfoHint,
.unified-info strong,
.unified-info h3,
.unified-group-info strong,
.unified-member-name,
.group-info-name,
.group-member-name {
  color: #142238 !important;
  opacity: 1 !important;
}
.unified-entry,
.unified-chat-item,
.unified-info,
.unified-sidebar,
.unified-header {
  color: #142238 !important;
}
.unified-entry.active,
.unified-chat-item.active {
  background: linear-gradient(135deg, rgba(236,253,245,.82), rgba(245,243,255,.78)) !important;
  border-color: rgba(125,211,252,.20) !important;
  color: #142238 !important;
}

/* Verwaltung: oben und in Karten immer gut lesbar */
.team-management-panel,
.team-management-panel .portal-card,
.team-management-panel .team-user-card,
.team-management-panel .empty-state,
.team-management-panel .shared-head,
.team-management-panel .team-user-fields label,
.team-management-panel .team-user-meta,
.team-management-panel h3,
.team-management-panel h4,
#teamUsersBox,
#teamPendingBox {
  color: #142238 !important;
  opacity: 1 !important;
}
.team-management-panel .subtle,
.team-user-search-info,
.team-user-meta,
.team-user-card .subtle {
  color: #54657c !important;
  opacity: 1 !important;
}
.team-user-card {
  background: rgba(255,255,255,.94) !important;
  border: 1px solid rgba(120,142,170,.22) !important;
  box-shadow: var(--sai-shadow-soft) !important;
}
.team-user-card .shared-head strong {
  color: #142238 !important;
  font-weight: 950 !important;
}
.team-user-fields input,
.team-user-fields select,
.team-user-card input,
.team-user-card select {
  color: #142238 !important;
  background: rgba(255,255,255,.98) !important;
  border: 1px solid rgba(120,142,170,.25) !important;
}
.team-user-fields input::placeholder,
.team-user-card input::placeholder { color: #64748b !important; opacity: 1 !important; }

/* Header-Icons nicht stretchen/überlappen */
.header-actions,
.top-icon-bar,
.portal-top-actions,
.icon-actions {
  display: flex !important;
  align-items: center !important;
  justify-content: flex-end !important;
  gap: 10px !important;
  flex-wrap: nowrap !important;
  overflow: visible !important;
}
.top-icon-btn,
.icon-btn,
#notificationBtn,
#profileBtn,
#settingsBtn,
#adminBtn,
button[title*="Profil"],
button[title*="Benachrichtigung"],
button[title*="Einstellung"] {
  width: 42px !important;
  height: 42px !important;
  min-width: 42px !important;
  min-height: 42px !important;
  max-width: 42px !important;
  max-height: 42px !important;
  padding: 0 !important;
  border-radius: 15px !important;
  flex: 0 0 42px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  overflow: hidden !important;
}
.notification-popover,
.profile-popover,
.settings-popover,
.dropdown-panel {
  z-index: 9999 !important;
  background: rgba(255,255,255,.96) !important;
  color: #142238 !important;
}

/* Admin/Login/Register sichere Ladeoptik */
.auth-modern-page .auth-copy { max-width: 38ch !important; }
.admin-container .header-row { margin-bottom: 22px !important; gap: 18px !important; }
