/**
 * SCOP — üst app bar
 */

.app-main-column {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.app-topbar {
  flex-shrink: 0;
  height: var(--header-height);
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border-light);
}

.app-topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  height: 100%;
  padding: 0 var(--space-8);
}

.app-topbar-search-wrap {
  position: relative;
  flex: 1;
  min-width: 0;
  max-width: 42rem;
}

.app-topbar-search {
  width: 100%;
  height: 42px;
  padding: 0 var(--space-12) 0 var(--space-12);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  font-family: inherit;
  font-size: var(--font-size-sm);
  color: var(--color-text-primary);
  box-shadow: none;
}

.app-topbar-search::placeholder {
  color: var(--color-text-muted);
}

.app-topbar-search:disabled {
  cursor: not-allowed;
  opacity: 0.92;
}

.app-topbar-search-icon {
  position: absolute;
  left: 0.875rem;
  top: 50%;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  color: var(--color-text-muted);
  pointer-events: none;
}

.app-topbar-search-icon svg {
  width: 100%;
  height: 100%;
}

.app-topbar-search-kbd {
  position: absolute;
  right: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  padding: var(--space-0-5) var(--space-2);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-xs);
  background: var(--color-surface-muted);
  font-size: var(--fs-12);
  font-family: var(--font-mono);
  color: var(--color-text-secondary);
  line-height: 1.2;
}

.app-topbar-actions {
  display: flex;
  align-items: center;
  gap: var(--space-1-5);
  flex-shrink: 0;
}

.app-topbar-icon-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: none;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--color-text-muted);
  cursor: pointer;
  transition: background 160ms ease, color 160ms ease;
}

.app-topbar-icon-btn:hover:not(:disabled) {
  background: light-dark(rgba(12, 18, 32, 0.05), rgba(206, 230, 246, 0.05));
  color: var(--color-text-secondary);
}

.app-topbar-icon-btn:disabled {
  cursor: default;
}

.app-topbar-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
}

.app-topbar-icon svg {
  width: 100%;
  height: 100%;
}

.app-topbar-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 16px;
  height: 16px;
  padding: 0 var(--space-1);
  border-radius: var(--radius-pill);
  font-size: var(--fs-12);
  font-weight: var(--font-weight-bold);
  line-height: 1;
  color: #fff;
  pointer-events: none;
}

.app-topbar-badge--red {
  background: #ef4444;
}

.app-topbar-badge--blue {
  background: #3b82f6;
}

.app-topbar-icon-btn.is-active {
  background: rgba(37, 99, 235, 0.1);
  color: light-dark(var(--color-brand-primary), var(--color-info-text));
}

#app-topbar-panel-root {
  position: fixed;
  inset: 0;
  z-index: 1200;
  pointer-events: none;
}

.app-topbar-panel {
  position: fixed;
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  max-height: min(70vh, 560px);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  box-shadow: 0 18px 40px rgba(12, 18, 32, 0.14);
  overflow: hidden;
}

.app-topbar-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--color-border-light);
  background: var(--color-surface-muted);
}

.app-topbar-panel-header h3 {
  margin: 0;
  font-size: var(--fs-14);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-primary);
}

.app-topbar-panel-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--color-text-muted);
  font-size: var(--fs-20);
  line-height: 1;
  cursor: pointer;
}

.app-topbar-panel-close:hover {
  background: light-dark(rgba(12, 18, 32, 0.06), rgba(206, 230, 246, 0.06));
  color: var(--color-text-primary);
}

.app-topbar-panel-body {
  flex: 1;
  min-height: 0;
  overflow: auto;
}

.app-topbar-panel-empty {
  margin: 0;
  padding: var(--space-5) var(--space-4);
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
}

.app-topbar-panel-item {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  width: 100%;
  padding: var(--space-3) var(--space-4);
  border: none;
  border-bottom: 1px solid var(--color-border-light);
  background: transparent;
  text-align: left;
  font: inherit;
  cursor: pointer;
  transition: background 140ms ease;
}

.app-topbar-panel-item:hover {
  background: light-dark(rgba(12, 18, 32, 0.03), rgba(206, 230, 246, 0.03));
}

.app-topbar-panel-item.is-unread {
  background: rgba(37, 99, 235, 0.04);
}

.app-topbar-panel-item-dot {
  width: 8px;
  height: 8px;
  margin-top: var(--space-2);
  border-radius: 50%;
  background: light-dark(#cbd5e1, var(--color-surface-muted));
  flex-shrink: 0;
}

.app-topbar-panel-item.is-unread .app-topbar-panel-item-dot {
  background: var(--color-action-primary);
}

.app-topbar-panel-item-body {
  min-width: 0;
  flex: 1;
}

.app-topbar-panel-item-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
}

.app-topbar-panel-item-title {
  display: block;
  font-size: var(--fs-13);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-primary);
}

.app-topbar-panel-item-channel {
  flex-shrink: 0;
  font-size: var(--fs-12);
  font-weight: var(--font-weight-medium);
  color: light-dark(var(--color-brand-primary), var(--color-info-text));
  background: rgba(37, 99, 235, 0.08);
  padding: var(--space-0-5) var(--space-2);
  border-radius: var(--radius-pill);
}

.app-topbar-panel-item-subject {
  display: block;
  margin-top: var(--space-0-5);
  font-size: var(--fs-13);
  font-weight: var(--font-weight-medium);
  color: var(--color-text-primary);
}

.app-topbar-panel-item-text {
  display: block;
  margin-top: var(--space-1);
  font-size: var(--fs-13);
  line-height: 1.45;
  color: var(--color-text-secondary);
}

.app-topbar-panel-item-time {
  display: block;
  margin-top: var(--space-1-5);
  font-size: var(--fs-12);
  color: var(--color-text-muted);
}

.app-topbar-panel-item--warning .app-topbar-panel-item-dot {
  background: #f59e0b;
}

.app-topbar-panel-item--success .app-topbar-panel-item-dot {
  background: #10b981;
}

.app-topbar-panel-faq {
  border-bottom: 1px solid var(--color-border-light);
}

.app-topbar-panel-faq:last-child {
  border-bottom: none;
}

.app-topbar-panel-faq-q {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  padding: var(--space-4) var(--space-4);
  font-size: var(--fs-13);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-primary);
  cursor: pointer;
  list-style: none;
}

.app-topbar-panel-faq-q::-webkit-details-marker {
  display: none;
}

.app-topbar-panel-faq-category {
  font-size: var(--fs-12);
  font-weight: var(--font-weight-medium);
  color: light-dark(var(--color-brand-primary), var(--color-info-text));
}

.app-topbar-panel-faq-a {
  margin: 0;
  padding: 0 var(--space-4) var(--space-4);
  font-size: var(--fs-13);
  line-height: 1.55;
  color: var(--color-text-secondary);
}

.app-topbar-panel-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-top: 1px solid var(--color-border-light);
  background: var(--color-surface-muted);
}

.app-topbar-panel-footer-link {
  border: none;
  background: transparent;
  padding: 0;
  font: inherit;
  font-size: var(--fs-12);
  font-weight: var(--font-weight-medium);
  color: light-dark(var(--color-brand-primary), var(--color-info-text));
  cursor: pointer;
}

.app-topbar-panel-footer-link:hover {
  text-decoration: underline;
}

.app-topbar-panel-footer-note {
  font-size: var(--fs-12);
  color: var(--color-text-muted);
}

.app-topbar-icon-btn.has-new-notification {
  animation: app-topbar-bell-pulse 0.7s ease 3;
}

.app-topbar-icon-btn.has-new-notification .app-topbar-badge--red {
  animation: app-topbar-badge-pop 0.7s ease 3;
}

@keyframes app-topbar-bell-pulse {
  0%,
  100% {
    transform: scale(1);
  }
  35% {
    transform: scale(1.08);
  }
  55% {
    transform: scale(1);
  }
}

@keyframes app-topbar-badge-pop {
  0%,
  100% {
    transform: scale(1);
  }
  40% {
    transform: scale(1.25);
  }
}

.scop-notif-toast-root {
  position: fixed;
  top: calc(var(--header-height, 64px) + 0.75rem);
  right: 1rem;
  z-index: 12060;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  max-width: min(360px, calc(100vw - 2rem));
  pointer-events: none;
}

.scop-notif-toast {
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-1);
  width: 100%;
  padding: var(--space-4) var(--space-4);
  border: 1px solid var(--color-info-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  box-shadow: 0 12px 32px rgba(12, 18, 32, 0.14);
  text-align: left;
  cursor: pointer;
  opacity: 0;
  transform: translateY(-8px);
  transition: opacity 180ms ease, transform 180ms ease;
  font: inherit;
  color: inherit;
}

.scop-notif-toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.scop-notif-toast:hover {
  border-color: var(--color-info-border);
}

.scop-notif-toast-title {
  font-size: var(--fs-14);
  font-weight: var(--fw-semibold);
  color: light-dark(var(--color-brand-deep), var(--color-info-text));
}

.scop-notif-toast-body {
  font-size: var(--fs-13);
  color: var(--color-text-secondary);
  line-height: 1.35;
}

.scop-notif-toast-ref {
  margin-top: var(--space-0-5);
  font-size: var(--fs-12);
  color: var(--color-text-muted);
}
