/* ==============================================================================
   SecTepe.Comm - Unified Web UI
   ============================================================================== */

/* --- CSS Variables (Light Theme) --- */
:root {
  --bg-primary: #f8f9fb;
  --bg-secondary: #ffffff;
  --bg-sidebar: #1a1d23;
  --bg-sidebar-hover: #2a2d35;
  --bg-sidebar-active: #3a3d45;
  --bg-card: #ffffff;
  --bg-card-hover: #f0f2f5;

  --text-primary: #1a1d23;
  --text-secondary: #5f6368;
  --text-sidebar: #a0a4ab;
  --text-sidebar-active: #ffffff;

  --accent-chat: #2196f3;
  --accent-email: #4caf50;
  --accent-video: #ff9800;
  --accent-phone: #9c27b0;
  --accent-warmup: #e91e63;
  --accent-outreach: #00bcd4;
  --accent-remote: #795548;
  --accent-primary: #2196f3;

  --border-color: #e0e3e8;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);

  --sidebar-width: 240px;
  --sidebar-collapsed-width: 64px;
  --transition: 0.2s ease;
  --radius: 8px;
  --radius-lg: 12px;
}

/* --- Dark Theme --- */
[data-theme="dark"] {
  --bg-primary: #0f1117;
  --bg-secondary: #1a1d25;
  --bg-sidebar: #0a0c10;
  --bg-sidebar-hover: #1a1d25;
  --bg-sidebar-active: #252830;
  --bg-card: #1a1d25;
  --bg-card-hover: #252830;

  --text-primary: #e8eaed;
  --text-secondary: #9aa0a6;
  --text-sidebar: #7a7e85;
  --text-sidebar-active: #ffffff;

  --border-color: #2a2d35;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.5);
}

/* --- Reset & Base --- */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  height: 100%;
  overflow: hidden;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  display: flex;
}

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

/* --- Sidebar --- */
.sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  height: 100vh;
  background: var(--bg-sidebar);
  display: flex;
  flex-direction: column;
  transition: width var(--transition), min-width var(--transition);
  z-index: 100;
  overflow: hidden;
}

/* --- Scrollable nav area --- */
.sidebar-nav-scroll {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  min-height: 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.1) transparent;
}

.sidebar-nav-scroll::-webkit-scrollbar {
  width: 4px;
}

.sidebar-nav-scroll::-webkit-scrollbar-track {
  background: transparent;
}

.sidebar-nav-scroll::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
}

.sidebar-nav-scroll::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}

.sidebar.collapsed {
  width: var(--sidebar-collapsed-width);
  min-width: var(--sidebar-collapsed-width);
  overflow: visible;
}

.sidebar-header {
  padding: 20px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
  overflow: hidden;
}

.logo-icon {
  width: 32px;
  height: 32px;
  min-width: 32px;
  background: var(--accent-primary);
  color: white;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 16px;
}

.logo-text {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-sidebar-active);
}

.logo-accent {
  color: var(--accent-primary);
}

.sidebar.collapsed .logo-text {
  opacity: 0;
  visibility: hidden;
}

/* --- Navigation --- */
.nav-section {
  padding: 12px 8px;
}

.nav-section-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-sidebar);
  padding: 4px 12px 8px;
  white-space: nowrap;
  overflow: hidden;
}

.sidebar.collapsed .nav-section-title {
  opacity: 0;
  height: 0;
  padding: 0;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius);
  color: var(--text-sidebar);
  transition: all var(--transition);
  cursor: pointer;
  position: relative;
  white-space: nowrap;
  overflow: hidden;
}

.nav-item:hover {
  background: var(--bg-sidebar-hover);
  color: var(--text-sidebar-active);
}

.nav-item.active {
  background: var(--bg-sidebar-active);
  color: var(--text-sidebar-active);
}

.nav-icon {
  width: 20px;
  height: 20px;
  min-width: 20px;
}

.nav-label {
  font-size: 14px;
  font-weight: 500;
}

.sidebar.collapsed .nav-label {
  opacity: 0;
  visibility: hidden;
}

.nav-badge {
  background: #ef4444;
  color: white;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 10px;
  margin-left: auto;
  min-width: 20px;
  text-align: center;
}

.sidebar.collapsed .nav-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  margin: 0;
  padding: 1px 4px;
  font-size: 10px;
}

/* Tooltip for collapsed sidebar */
.sidebar.collapsed .nav-item:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  left: calc(var(--sidebar-collapsed-width) + 8px);
  background: var(--bg-sidebar);
  color: var(--text-sidebar-active);
  padding: 6px 12px;
  border-radius: var(--radius);
  font-size: 13px;
  white-space: nowrap;
  box-shadow: var(--shadow-md);
  z-index: 200;
}

/* --- Sidebar Footer --- */
.sidebar-footer {
  margin-top: auto;
  padding: 12px 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* --- Intercom: Benutzer-Info-Widget --- */
.user-info-widget {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: var(--radius);
  color: var(--text-sidebar);
  overflow: hidden;
}

.user-info-widget .nav-icon {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  opacity: 0.75;
}

.user-name {
  font-size: 0.82rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  opacity: 0.85;
}

.sidebar.collapsed .user-name {
  display: none;
}

.sidebar-footer > .theme-toggle,
.sidebar-footer > .sidebar-collapse-btn {
  /* keep buttons in a row */
  flex-direction: row;
}

/* Row of buttons within footer */
.sidebar-footer-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.sidebar.collapsed .sidebar-footer-buttons {
  display: none;
}

.theme-toggle,
.sidebar-collapse-btn {
  background: none;
  border: none;
  color: var(--text-sidebar);
  cursor: pointer;
  padding: 10px;
  border-radius: var(--radius);
  transition: all var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}

.theme-toggle:hover,
.sidebar-collapse-btn:hover {
  background: var(--bg-sidebar-hover);
  color: var(--text-sidebar-active);
}

[data-theme="dark"] .sun-icon { display: block; }
[data-theme="dark"] .moon-icon { display: none; }
.sun-icon { display: none; }
.moon-icon { display: block; }

.sidebar.collapsed .sidebar-collapse-btn {
  align-self: center;
}

.sidebar.collapsed .sidebar-collapse-btn svg {
  transform: rotate(180deg);
}

.sidebar.collapsed .nav-item {
  overflow: visible;
}

/* --- Main Content --- */
.content {
  flex: 1;
  height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
  transition: margin-left var(--transition);
}

/* --- Views --- */
.view {
  display: none;
  height: 100%;
}

.view.active {
  display: block;
}

/* --- Dashboard --- */
#view-dashboard {
  padding: 32px;
  overflow-y: auto;
}

.view-header {
  margin-bottom: 32px;
}

.view-header h1 {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.view-subtitle {
  font-size: 16px;
  color: var(--text-secondary);
}

/* --- Dashboard Grid --- */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  margin-bottom: 40px;
}

.dashboard-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  cursor: pointer;
  transition: all var(--transition);
  display: flex;
  flex-direction: column;
  gap: 16px;
  position: relative;
  overflow: hidden;
}

.dashboard-card:hover {
  background: var(--bg-card-hover);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.card-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px;
}

.card-icon svg {
  width: 28px;
  height: 28px;
}

.card-icon-chat { background: rgba(33, 150, 243, 0.1); color: var(--accent-chat); }
.card-icon-email { background: rgba(76, 175, 80, 0.1); color: var(--accent-email); }
.card-icon-video { background: rgba(255, 152, 0, 0.1); color: var(--accent-video); }
.card-icon-phone { background: rgba(156, 39, 176, 0.1); color: var(--accent-phone); }
.card-icon-erp { background: rgba(124, 58, 237, 0.1); color: #7c3aed; }
.card-icon-files { background: rgba(0, 150, 136, 0.1); color: #009688; }
.card-icon-wiki { background: rgba(96, 125, 139, 0.1); color: #607d8b; }
.card-icon-dms { background: rgba(121, 85, 72, 0.1); color: #795548; }
.card-icon-vault   { background: rgba(103, 58, 183, 0.1); color: #673ab7; }
.card-icon-monitoring { background: rgba(255, 152, 0, 0.1); color: #ff9800; }
.card-icon-security { background: rgba(76, 175, 80, 0.1); color: #4caf50; }
.card-icon-warmup { background: rgba(233, 30, 99, 0.1); color: var(--accent-warmup); }
.card-icon-outreach { background: rgba(0, 188, 212, 0.1); color: var(--accent-outreach); }
.card-icon-remote { background: rgba(121, 85, 72, 0.1); color: var(--accent-remote); }

.card-content h3 {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 4px;
}

.card-content p {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.card-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #9aa0a6;
}

.status-dot.online { background: #4caf50; }
.status-dot.offline { background: #ef4444; }
.status-dot.checking { background: #ff9800; animation: pulse 1.5s infinite; }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.status-text {
  color: var(--text-secondary);
}

.card-action {
  font-size: 14px;
  font-weight: 600;
  color: var(--accent-primary);
  margin-top: auto;
}

/* --- Quick Actions --- */
.quick-actions {
  margin-bottom: 40px;
}

.quick-actions h2,
.system-info h2 {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--text-primary);
}

.quick-actions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.quick-action-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  transition: all var(--transition);
  font-family: inherit;
}

.quick-action-btn:hover {
  background: var(--bg-card-hover);
  box-shadow: var(--shadow-sm);
}

.quick-action-btn svg {
  width: 20px;
  height: 20px;
  min-width: 20px;
  color: var(--accent-primary);
}

/* --- System Info --- */
.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
}

.info-item {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 14px 18px;
}

.info-label {
  display: block;
  font-size: 12px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  margin-bottom: 4px;
}

.info-value {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

/* --- iFrame Container --- */
.iframe-container {
  width: 100%;
  height: 100%;
  position: relative;
}

.iframe-container iframe {
  width: 100%;
  height: 100%;
  border: none;
  background: var(--bg-secondary);
}

.iframe-loading {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  background: var(--bg-primary);
  z-index: 10;
  transition: opacity 0.3s ease;
}

.iframe-loading.hidden {
  opacity: 0;
  pointer-events: none;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border-color);
  border-top-color: var(--accent-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.iframe-loading p {
  font-size: 14px;
  color: var(--text-secondary);
}

/* --- Mobile Navigation --- */
.mobile-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg-sidebar);
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  z-index: 100;
  padding: 4px 0;
  padding-bottom: env(safe-area-inset-bottom, 4px);
}

.mobile-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px 0;
  color: var(--text-sidebar);
  font-size: 11px;
  transition: color var(--transition);
}

.mobile-nav-item.active {
  color: var(--accent-primary);
}

.mobile-nav-item svg {
  width: 22px;
  height: 22px;
}

/* --- Responsive --- */
@media (max-width: 768px) {
  .sidebar {
    display: none;
  }

  .mobile-nav {
    display: flex;
    justify-content: space-around;
  }

  .content {
    padding-bottom: 60px;
  }

  #view-dashboard {
    padding: 20px 16px;
  }

  .view-header h1 {
    font-size: 22px;
  }

  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .quick-actions-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 480px) {
  .quick-actions-grid {
    grid-template-columns: 1fr;
  }
}

/* --- Scrollbar --- */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-secondary);
}

/* --- Focus visible --- */
:focus-visible {
  outline: 2px solid var(--accent-primary);
  outline-offset: 2px;
}

/* --- Selection --- */
::selection {
  background: rgba(33, 150, 243, 0.2);
  color: var(--text-primary);
}

/* ==============================================================================
   SecTepe.Comm - Native View Component Styles
   ============================================================================== */

/* --- Native View Container --- */
.native-view {
  padding: 24px 32px;
  max-width: 1400px;
  margin: 0 auto;
  height: 100%;
  overflow-y: auto;
}

/* --- Loading --- */
.sc-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px;
  gap: 16px;
  color: var(--text-secondary);
}

/* --- Empty State --- */
.sc-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px;
  gap: 12px;
  color: var(--text-secondary);
}

.sc-empty svg { opacity: 0.4; }

/* --- Error --- */
.sc-error {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  background: rgba(244, 67, 54, 0.08);
  color: #f44336;
  border-radius: var(--radius);
  border: 1px solid rgba(244, 67, 54, 0.2);
  margin: 8px 0;
}

/* --- Alert --- */
.sc-alert {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 12px 16px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  margin: 8px 0;
}

.sc-alert--success {
  background: rgba(76, 175, 80, 0.08);
  color: #2e7d32;
  border-color: rgba(76, 175, 80, 0.2);
}

[data-theme="dark"] .sc-alert--success {
  color: #81c784;
}

.sc-alert--danger {
  background: rgba(244, 67, 54, 0.08);
  color: #c62828;
  border-color: rgba(244, 67, 54, 0.2);
}

[data-theme="dark"] .sc-alert--danger {
  color: #ef9a9a;
}

/* --- Badge --- */
.sc-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}

.sc-badge--default { background: var(--bg-primary); color: var(--text-secondary); border: 1px solid var(--border-color); }
.sc-badge--success { background: rgba(76, 175, 80, 0.1); color: #4caf50; }
.sc-badge--warning { background: rgba(255, 152, 0, 0.1); color: #ff9800; }
.sc-badge--danger { background: rgba(244, 67, 54, 0.1); color: #f44336; }
.sc-badge--info { background: rgba(33, 150, 243, 0.1); color: #2196f3; }
.sc-badge--primary { background: rgba(33, 150, 243, 0.1); color: var(--accent-primary); }

/* --- Card --- */
.sc-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.sc-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
}

.sc-card__title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}

.sc-card__actions { display: flex; gap: 8px; }
.sc-card__body { padding: 20px; }

/* --- Stat Card --- */
.sc-stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.sc-stat__icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  background: currentColor;
  opacity: 0.1;
}

.sc-stat__icon svg { width: 24px; height: 24px; opacity: 10; }
.sc-stat__content { display: flex; flex-direction: column; gap: 2px; }
.sc-stat__value { font-size: 28px; font-weight: 700; color: var(--text-primary); line-height: 1.2; }
.sc-stat__suffix { font-size: 16px; font-weight: 400; color: var(--text-secondary); margin-left: 2px; }
.sc-stat__label { font-size: 13px; color: var(--text-secondary); }
.sc-stat__trend { font-size: 12px; font-weight: 500; }
.sc-stat__trend--up { color: #4caf50; }
.sc-stat__trend--down { color: #f44336; }

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

/* --- Table --- */
.sc-table-wrapper {
  overflow-x: auto;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
}

.sc-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.sc-table th {
  padding: 12px 16px;
  text-align: left;
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}

.sc-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-primary);
}

.sc-table tbody tr:last-child td { border-bottom: none; }

.sc-table tbody tr:hover {
  background: var(--bg-card-hover);
}

.sc-table__clickable { cursor: pointer; }

/* --- Pagination --- */
.sc-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  font-size: 13px;
  color: var(--text-secondary);
}

.sc-pagination__buttons { display: flex; align-items: center; gap: 8px; }
.sc-pagination__current { font-weight: 500; color: var(--text-primary); }

/* --- Tabs --- */
.sc-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 2px solid var(--border-color);
  margin-bottom: 24px;
  overflow-x: auto;
}

.sc-tab {
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  background: none;
  border: none;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  white-space: nowrap;
  transition: color var(--transition), border-color var(--transition);
}

.sc-tab:hover { color: var(--text-primary); }
.sc-tab--active { color: var(--accent-primary); border-bottom-color: var(--accent-primary); }
.sc-tab__count { background: var(--bg-primary); padding: 1px 6px; border-radius: 10px; font-size: 11px; margin-left: 4px; }

/* --- Button --- */
.sc-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-primary);
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}

.sc-btn:hover { background: var(--bg-card-hover); }
.sc-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.sc-btn--primary { background: var(--accent-primary); color: white; border-color: var(--accent-primary); }
.sc-btn--primary:hover { opacity: 0.9; }
.sc-btn--danger { background: #f44336; color: white; border-color: #f44336; }
.sc-btn--danger:hover { opacity: 0.9; }
.sc-btn--success { background: #4caf50; color: white; border-color: #4caf50; }
.sc-btn--success:hover { opacity: 0.9; }
.sc-btn--sm { padding: 4px 10px; font-size: 12px; }
.sc-btn--lg { padding: 12px 24px; font-size: 16px; }

.sc-btn svg { width: 16px; height: 16px; }

/* --- Form Fields --- */
.sc-field {
  margin-bottom: 16px;
}

.sc-field__label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.sc-input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 14px;
  transition: border-color var(--transition);
}

.sc-input:focus {
  border-color: var(--accent-primary);
  outline: none;
  box-shadow: 0 0 0 3px rgba(33, 150, 243, 0.1);
}

.sc-textarea { resize: vertical; min-height: 80px; font-family: inherit; }
.sc-field__help { display: block; font-size: 12px; color: var(--text-secondary); margin-top: 4px; }

/* --- Modal --- */
.sc-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 24px;
}

.sc-modal-overlay--visible { display: flex; }

.sc-modal {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 600px;
  max-height: 80vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
}

.sc-modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
}

.sc-modal__header h3 { font-size: 18px; font-weight: 600; }

.sc-modal__close {
  background: none;
  border: none;
  font-size: 24px;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 0 4px;
}

.sc-modal__body { padding: 20px; overflow-y: auto; }
.sc-modal__footer { padding: 16px 20px; border-top: 1px solid var(--border-color); display: flex; gap: 8px; justify-content: flex-end; }

/* --- Progress Bar --- */
.sc-progress {
  width: 100%;
  height: 8px;
  background: var(--bg-primary);
  border-radius: 4px;
  overflow: hidden;
  position: relative;
}

.sc-progress__bar {
  height: 100%;
  border-radius: 4px;
  transition: width 0.3s ease;
}

.sc-progress__label {
  position: absolute;
  right: 0;
  top: -20px;
  font-size: 12px;
  color: var(--text-secondary);
}

/* --- Charts --- */
.sc-chart-container {
  padding: 16px 0;
}

.sc-chart-container--donut {
  display: flex;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
}

.sc-chart__title {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--text-primary);
}

.sc-chart__label {
  font-size: 11px;
  fill: var(--text-secondary);
}

.sc-chart__value {
  font-size: 11px;
  fill: var(--text-primary);
  font-weight: 500;
}

.sc-chart__center {
  font-size: 20px;
  font-weight: 700;
  fill: var(--text-primary);
}

.sc-chart__legend {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sc-chart__legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-secondary);
}

.sc-chart__legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* --- Login --- */
.sc-login {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  padding: 24px;
}

.sc-login__card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 32px;
  width: 100%;
  max-width: 400px;
}

.sc-login__title {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 4px;
  color: var(--text-primary);
}

.sc-login__subtitle {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 24px;
}

.sc-login__form { display: flex; flex-direction: column; }
.sc-login__form .sc-btn { margin-top: 8px; justify-content: center; }
.sc-login__error { color: #f44336; font-size: 13px; margin-bottom: 8px; padding: 8px; background: rgba(244,67,54,0.08); border-radius: var(--radius); }

/* --- View Header --- */
.sc-view-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}

.sc-view-header__title {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
}

.sc-view-header__subtitle {
  font-size: 14px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.sc-view-header__actions { display: flex; gap: 8px; }

/* --- Search Bar --- */
.sc-search {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
}

.sc-search .sc-input { max-width: 400px; }

/* --- Chat Layout --- */
.sc-chat-layout {
  display: flex;
  height: calc(100vh - 150px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.sc-chat-sidebar {
  width: 260px;
  min-width: 260px;
  border-right: 1px solid var(--border-color);
  background: var(--bg-secondary);
  overflow-y: auto;
}

.sc-chat-sidebar__title {
  padding: 16px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border-color);
}

.sc-chat-channel {
  padding: 12px 16px;
  cursor: pointer;
  border-bottom: 1px solid var(--border-color);
  transition: background var(--transition);
}

.sc-chat-channel:hover { background: var(--bg-card-hover); }
.sc-chat-channel--active { background: rgba(33, 150, 243, 0.08); border-left: 3px solid var(--accent-primary); }

.sc-chat-channel__name { font-weight: 500; color: var(--text-primary); font-size: 14px; }
.sc-chat-channel__desc { font-size: 12px; color: var(--text-secondary); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.sc-chat-main { flex: 1; display: flex; flex-direction: column; }

.sc-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
}

.sc-chat-message {
  margin-bottom: 16px;
}

.sc-chat-message__header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.sc-chat-message__author { font-weight: 600; font-size: 14px; color: var(--text-primary); }
.sc-chat-message__time { font-size: 12px; color: var(--text-secondary); }
.sc-chat-message__body { font-size: 14px; color: var(--text-primary); line-height: 1.5; }

.sc-chat-input {
  padding: 12px 16px;
  border-top: 1px solid var(--border-color);
  background: var(--bg-secondary);
}

.sc-chat-input__note {
  font-size: 12px;
  color: var(--text-secondary);
  text-align: center;
  padding: 8px;
}

.sc-chat-input__note a { color: var(--accent-primary); text-decoration: underline; }

/* --- Service Info Fallback --- */
.sc-service-fallback {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px;
  gap: 16px;
  text-align: center;
}

.sc-service-fallback__icon svg { width: 64px; height: 64px; color: var(--text-secondary); opacity: 0.3; }
.sc-service-fallback__title { font-size: 18px; font-weight: 600; color: var(--text-primary); }
.sc-service-fallback__desc { font-size: 14px; color: var(--text-secondary); max-width: 500px; }
.sc-service-fallback .sc-btn { margin-top: 8px; }

/* --- Wiki Content --- */
.sc-wiki-content {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 32px;
  line-height: 1.8;
  font-size: 15px;
}

.sc-wiki-content h1, .sc-wiki-content h2, .sc-wiki-content h3 {
  margin-top: 24px;
  margin-bottom: 12px;
  color: var(--text-primary);
}

.sc-wiki-content p { margin-bottom: 12px; }
.sc-wiki-content code { background: var(--bg-primary); padding: 2px 6px; border-radius: 4px; font-size: 13px; }
.sc-wiki-content pre { background: var(--bg-primary); padding: 16px; border-radius: var(--radius); overflow-x: auto; margin: 12px 0; }
.sc-wiki-content img { max-width: 100%; border-radius: var(--radius); }
.sc-wiki-content a { color: var(--accent-primary); }

/* --- Grid Layouts --- */
.sc-grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.sc-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.sc-grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }

@media (max-width: 1024px) {
  .sc-grid-4 { grid-template-columns: repeat(2, 1fr); }
  .sc-grid-3 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  .native-view { padding: 16px; }
  .sc-grid-2, .sc-grid-3, .sc-grid-4 { grid-template-columns: 1fr; }
  .sc-chat-layout { flex-direction: column; height: calc(100vh - 200px); }
  .sc-chat-sidebar { width: 100%; min-width: 100%; max-height: 200px; border-right: none; border-bottom: 1px solid var(--border-color); }
  .sc-view-header { flex-direction: column; align-items: flex-start; }
  .sc-stats-grid { grid-template-columns: 1fr; }
  .sc-chart-container--donut { flex-direction: column; }
}
}

/* =============================================================================
   Web UI v2 – Neue Komponenten (Benachrichtigungen, Suche, Favoriten, i18n)
   ============================================================================= */

/* --- Neue Accent-Farben fuer AI & Automatisierung --- */
:root {
  --accent-ai: #7c3aed;
  --accent-automation: #0ea5e9;
  --accent-ats: #16a34a;
}

/* --- Icon-Button (generisch) --- */
.icon-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-sidebar);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius);
  transition: background var(--transition), color var(--transition);
  position: relative;
}

.icon-btn:hover {
  background: var(--bg-sidebar-hover);
  color: var(--text-sidebar-active);
}

/* --- Benachrichtigungs-Wrapper --- */
.notification-wrapper {
  position: relative;
}

.notification-btn {
  position: relative;
}

.notification-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  background: #ef4444;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  border-radius: 9999px;
  min-width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 3px;
  pointer-events: none;
}

/* --- Benachrichtigungs-Panel --- */
.notification-panel {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 0;
  width: 300px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  z-index: 1000;
  display: none;
  flex-direction: column;
  max-height: 400px;
  overflow: hidden;
}

.notification-panel.open {
  display: flex;
}

.notification-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.notifications-clear-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  padding: 4px;
  border-radius: var(--radius);
}

.notifications-clear-btn:hover { color: var(--text-primary); background: var(--bg-card-hover); }

.notification-list {
  list-style: none;
  overflow-y: auto;
  flex: 1;
}

.notification-item {
  padding: 10px 16px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.notification-item:last-child { border-bottom: none; }
.notification-text { font-size: 13px; color: var(--text-primary); }
.notification-time { font-size: 11px; color: var(--text-secondary); }
.notification-empty { padding: 16px; text-align: center; color: var(--text-secondary); font-size: 13px; }
.notification-info .notification-text::before { content: 'ℹ '; }
.notification-warning .notification-text::before { content: '⚠ '; color: #f59e0b; }
.notification-error .notification-text::before { content: '✗ '; color: #ef4444; }
.notification-success .notification-text::before { content: '✓ '; color: #22c55e; }

/* --- Globale Suche Overlay --- */
.search-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 2000;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding-top: 80px;
}

.search-overlay.open {
  display: flex;
}

.search-modal {
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 560px;
  overflow: hidden;
  border: 1px solid var(--border-color);
}

.search-input-wrapper {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
  gap: 12px;
}

.search-icon { width: 20px; height: 20px; color: var(--text-secondary); flex-shrink: 0; }

.search-input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-size: 16px;
  color: var(--text-primary);
}

.search-input::placeholder { color: var(--text-secondary); }

.search-results {
  list-style: none;
  max-height: 360px;
  overflow-y: auto;
}

.search-result-item {
  padding: 12px 16px;
  cursor: pointer;
  font-size: 14px;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border-color);
  transition: background var(--transition);
}

.search-result-item:last-child { border-bottom: none; }
.search-result-item:hover { background: var(--bg-card-hover); }
.search-no-results { padding: 16px; text-align: center; color: var(--text-secondary); font-size: 13px; }

/* --- Favoriten-Bereich --- */
.favorites-section {
  margin-top: 32px;
}

.favorites-section h2 {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--text-primary);
}

.favorites-hint {
  color: var(--text-secondary);
  font-size: 13px;
  padding: 8px 0;
}

.favorite-btn.is-favorite {
  color: #f59e0b;
}

.favorite-btn.is-favorite svg {
  fill: #f59e0b;
  stroke: #f59e0b;
}

/* --- Admin-Bereich --- */
.admin-section {
  margin-top: 32px;
  padding: 20px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-left: 4px solid #9c27b0;
  border-radius: var(--radius-lg);
}

.admin-section h2 {
  font-size: 18px;
  font-weight: 600;
  margin: 0 0 4px;
  color: var(--text-primary);
}

.admin-section-hint {
  color: var(--text-secondary);
  font-size: 13px;
  margin: 0 0 16px;
}

.admin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
}

.admin-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--text-primary);
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}

.admin-card:hover {
  transform: translateY(-1px);
  border-color: #9c27b0;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.admin-card-icon {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: rgba(156, 39, 176, 0.12);
  color: #9c27b0;
  flex-shrink: 0;
}

.admin-card-body {
  flex: 1;
  min-width: 0;
}

.admin-card-body h3 {
  font-size: 14px;
  font-weight: 600;
  margin: 0 0 2px;
  color: var(--text-primary);
}

.admin-card-body p {
  font-size: 12px;
  color: var(--text-secondary);
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.admin-card-action {
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
}

/* --- Dashboard Card Farben fuer neue Dienste --- */
.card-icon-ai {
  background: linear-gradient(135deg, var(--accent-ai), #a855f7);
  color: #fff;
}

.card-icon-automation {
  background: linear-gradient(135deg, var(--accent-automation), #38bdf8);
  color: #fff;
}

.card-icon-ats {
  background: linear-gradient(135deg, var(--accent-ats), #4ade80);
  color: #fff;
}

/* --- Responsive: Benachrichtigungs-Panel --- */
@media (max-width: 480px) {
  .notification-panel { width: 260px; }
  .search-modal { max-width: calc(100vw - 32px); }
}

/* =============================================================================
   Dashboard v2 – Service-Tiles, Stat-Row, Schnellzugriff-Grid
   ============================================================================= */

/* --- Stat Row --- */
.dash-stats-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 8px;
}

.dash-stats-row .sc-stat-card {
  flex: 1 1 160px;
  min-width: 140px;
}

/* --- Gruppen-Label --- */
.dash-group-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-secondary);
  margin: 16px 0 8px;
}

/* --- Service Tile Grid --- */
.dash-tile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 10px;
}

/* --- Service Tile --- */
.dash-tile {
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 12px 14px;
  cursor: pointer;
  transition: background var(--transition), box-shadow var(--transition), border-color var(--transition);
}

.dash-tile:hover {
  background: var(--bg-card-hover);
  box-shadow: var(--shadow-sm);
  border-color: var(--accent-primary);
}

.dash-tile__name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dash-tile__status-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.dash-tile__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.dash-tile__dot--online   { background: #22c55e; }
.dash-tile__dot--offline  { background: #ef4444; }
.dash-tile__dot--checking {
  background: var(--border-color);
  animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.3; }
}

.dash-tile__status {
  font-size: 12px;
  color: var(--text-secondary);
}

/* --- Schnellzugriff Grid (Dashboard v2) --- */
.dash-actions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
}

.dash-action {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 10px 14px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  transition: all var(--transition);
  font-family: inherit;
  text-align: left;
}

.dash-action:hover {
  background: var(--bg-card-hover);
  border-color: var(--accent-primary);
  box-shadow: var(--shadow-sm);
}

.dash-action svg {
  flex-shrink: 0;
  color: var(--accent-primary);
}

/* --- Responsive --- */
@media (max-width: 768px) {
  .dash-tile-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
  .dash-actions-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
  .dash-stats-row .sc-stat-card { flex: 1 1 120px; }
}
