/**
 * 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-workspace);
  border-bottom: 1px solid var(--color-border-light);
}

.app-topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  height: 100%;
  padding: 0 1.75rem;
}

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

.app-topbar-search {
  width: 100%;
  height: 42px;
  padding: 0 3.25rem 0 2.75rem;
  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: 2px 8px;
  border: 1px solid var(--color-border-light);
  border-radius: 6px;
  background: var(--color-surface-muted);
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--color-text-secondary);
  line-height: 1.2;
}

.app-topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  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: #64748b;
  cursor: pointer;
  transition: background 160ms ease, color 160ms ease;
}

.app-topbar-icon-btn:hover:not(:disabled) {
  background: rgba(15, 23, 42, 0.05);
  color: #334155;
}

.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 4px;
  border-radius: var(--radius-pill);
  font-size: 10px;
  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: #2563eb;
}

#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: 14px;
  background: var(--color-surface);
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.14);
  overflow: hidden;
}

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

.app-topbar-panel-header h3 {
  margin: 0;
  font-size: 0.9375rem;
  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: 8px;
  background: transparent;
  color: var(--color-text-muted);
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
}

.app-topbar-panel-close:hover {
  background: rgba(15, 23, 42, 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: 1.25rem 1rem;
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
}

.app-topbar-panel-item {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  width: 100%;
  padding: 0.85rem 1rem;
  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: rgba(15, 23, 42, 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: 0.45rem;
  border-radius: 50%;
  background: #cbd5e1;
  flex-shrink: 0;
}

.app-topbar-panel-item.is-unread .app-topbar-panel-item-dot {
  background: #2563eb;
}

.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: 0.5rem;
}

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

.app-topbar-panel-item-channel {
  flex-shrink: 0;
  font-size: 0.6875rem;
  font-weight: var(--font-weight-medium);
  color: #2563eb;
  background: rgba(37, 99, 235, 0.08);
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
}

.app-topbar-panel-item-subject {
  display: block;
  margin-top: 0.15rem;
  font-size: 0.8125rem;
  font-weight: var(--font-weight-medium);
  color: var(--color-text-primary);
}

.app-topbar-panel-item-text {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.8125rem;
  line-height: 1.45;
  color: var(--color-text-secondary);
}

.app-topbar-panel-item-time {
  display: block;
  margin-top: 0.35rem;
  font-size: 0.6875rem;
  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: 0.25rem;
  padding: 0.9rem 1rem;
  font-size: 0.8125rem;
  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: 0.6875rem;
  font-weight: var(--font-weight-medium);
  color: #2563eb;
}

.app-topbar-panel-faq-a {
  margin: 0;
  padding: 0 1rem 0.95rem;
  font-size: 0.8125rem;
  line-height: 1.55;
  color: var(--color-text-secondary);
}

.app-topbar-panel-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.65rem 1rem;
  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: 0.75rem;
  font-weight: var(--font-weight-medium);
  color: #2563eb;
  cursor: pointer;
}

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

.app-topbar-panel-footer-note {
  font-size: 0.6875rem;
  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: 0.5rem;
  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: 0.2rem;
  width: 100%;
  padding: 0.875rem 1rem;
  border: 1px solid #bfdbfe;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 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: #93c5fd;
}

.scop-notif-toast-title {
  font-size: 0.875rem;
  font-weight: 700;
  color: #1e3a8a;
}

.scop-notif-toast-body {
  font-size: 0.8125rem;
  color: #334155;
  line-height: 1.35;
}

.scop-notif-toast-ref {
  margin-top: 0.15rem;
  font-size: 0.75rem;
  color: #64748b;
}
