/* Top navigation — aligned with Photos / Review apps */
.app-nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--nav-bg, rgba(255, 255, 255, 0.88));
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--nav-border, #e5e7eb);
  padding: 0 max(1.25rem, env(safe-area-inset-right, 0px)) 0 max(1.25rem, env(safe-area-inset-left, 0px));
  max-width: 100%;
  overflow-x: hidden;
}
.app-nav-inner {
  max-width: 80rem;
  margin: 0 auto;
  padding: 0.55rem 0;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
  max-width: 100%;
}
.app-brand {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--nav-text-strong, #111827);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}
.app-brand i { color: #2563eb; }
.app-nav-links {
  display: none;
  align-items: center;
  gap: 0.2rem;
  margin-left: auto;
}
@media (min-width: 900px) {
  .app-nav-links { display: flex; }
  .app-nav-inner .app-nav-right { margin-left: 0; }
}
.app-nav-link {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.45rem 0.7rem;
  border-radius: 0.55rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--nav-text, #4b5563);
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}
.app-nav-link:hover { background: var(--surface-hover); color: var(--nav-text-strong, #111827); text-decoration: none; }
.app-nav-link.active { background: var(--surface-active); color: var(--nav-active-text, #1d4ed8); }
.app-nav-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: nowrap;
  min-width: 0;
  justify-content: flex-end;
  flex-shrink: 0;
}
.app-nav-desktop-actions {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}
.app-nav-mobile-only { display: none; }
@media (max-width: 899px) {
  .app-nav-desktop-actions { display: none; }
  .app-nav-mobile-only { display: block; }
  .app-nav-right { gap: 0.35rem; }
  .app-mobile-actions {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    padding: 0.35rem 0.5rem 0.55rem;
  }
  .mac-toggle--block { width: 100%; justify-content: space-between; }
  .app-mobile-actions .js-run-all-btn { width: 100%; justify-content: center; }
}
.app-burger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.35rem;
  height: 2.35rem;
  border-radius: 0.55rem;
  border: 1px solid var(--nav-border, #e5e7eb);
  background: transparent;
  color: var(--nav-text-strong, #374151);
  cursor: pointer;
}
@media (min-width: 900px) { .app-burger { display: none; } }
.app-mobile-panel {
  display: none;
  border-top: 1px solid var(--nav-border, #e5e7eb);
  padding: 0.5rem 0.75rem 0.75rem;
  background: var(--nav-panel-bg, rgba(255, 255, 255, 0.97));
}
.app-mobile-panel.open { display: block; }
.app-mobile-link {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.6rem 0.5rem;
  color: var(--nav-text-strong, #374151);
  text-decoration: none;
  border-radius: 0.5rem;
  font-size: 0.9rem;
}
.app-mobile-link:hover { background: var(--surface-hover); }
.app-mobile-link.active { background: var(--surface-active); color: var(--nav-active-text, #1d4ed8); }
.app-user {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.3rem 0.55rem 0.3rem 0.35rem;
  border-radius: 999px;
  background: transparent;
  border: 1px solid transparent;
  cursor: pointer;
  color: var(--nav-text-strong, #374151);
  font-size: 0.875rem;
  font-weight: 500;
}
.app-user:hover { background: var(--surface-hover); }
.app-user-avatar {
  width: 1.85rem;
  height: 1.85rem;
  border-radius: 999px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #2563eb;
  color: #fff;
  font-size: 0.8rem;
  font-weight: 600;
  overflow: hidden;
}
.app-user-avatar-img {
  width: 100%;
  height: 100%;
  border-radius: 999px;
  object-fit: cover;
  display: block;
}
.app-user-name {
  max-width: 10rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.app-user-caret { font-size: 0.7rem; color: var(--muted); }
.app-user-menu { display: none; position: relative; }
@media (min-width: 900px) { .app-user-menu { display: block; } }
.app-pop {
  min-width: 200px;
  padding: 0.3rem;
  border: 1px solid var(--nav-border, #e5e7eb);
  border-radius: 0.8rem;
  background: var(--popover-bg, #fff);
  box-shadow: 0 20px 45px -15px rgba(0, 0, 0, 0.35);
}
.app-pop-head { padding: 0.5rem 0.65rem; font-size: 0.75rem; color: var(--muted); }
.app-pop-item {
  width: 100%;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.55rem 0.65rem;
  border-radius: 0.55rem;
  font-size: 0.875rem;
  color: var(--nav-text-strong, #374151);
  background: transparent;
  border: none;
  cursor: pointer;
  text-decoration: none;
}
.app-pop-item i { width: 1.1rem; text-align: center; color: var(--muted); }
.app-pop-item:hover { background: var(--surface-hover); }
.app-pop-item.danger { color: var(--danger); }
.app-pop-item.danger i { color: var(--danger); }
.app-pop-sep { height: 1px; background: var(--surface-hover); margin: 0.3rem 0.2rem; }
.app-mobile-user { display: flex; align-items: center; gap: 0.65rem; padding: 0.55rem 0.65rem; }
.app-mobile-user .app-user-avatar { width: 2.2rem; height: 2.2rem; }
.app-mobile-user-meta { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.app-mobile-user-name { font-weight: 600; font-size: 0.9rem; color: var(--nav-text-strong, #111827); }
.app-mobile-user-email { font-size: 0.8rem; color: var(--muted); }
.relative { position: relative; }
.absolute { position: absolute; }
.right-0 { right: 0; }
.mt-2 { margin-top: 0.5rem; }
.z-50 { z-index: 50; }
@media (min-width: 900px) {
  .app-mobile-panel, .app-mobile-panel.open { display: none; }
}
.app-mobile-link.danger { color: var(--danger); background: transparent; border: none; width: 100%; cursor: pointer; font: inherit; }

.app-pop-backdrop {
  position: fixed;
  inset: 0;
  z-index: 55;
  background: transparent;
}

/* Activity bell */
.app-notif-trigger {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 0.5rem;
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.app-notif-trigger:hover { background: var(--surface-hover); color: var(--nav-text-strong, #111827); }
.app-notif-badge {
  position: absolute;
  top: 0.15rem;
  right: 0.15rem;
  min-width: 1rem;
  height: 1rem;
  padding: 0 0.25rem;
  border-radius: 999px;
  background: #dc2626;
  color: #fff;
  font-size: 0.6rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.app-notif-badge[hidden] { display: none !important; }
.app-notif-pop {
  width: min(22rem, calc(100vw - 1rem));
  max-height: min(24rem, 70dvh);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 0;
}
.app-notif-head {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.55rem 0.65rem;
  font-size: 0.8rem;
  border-bottom: 1px solid var(--border);
}
.app-notif-head-actions { display: flex; align-items: center; gap: 0.65rem; flex-shrink: 0; }
.app-notif-mark-all, .app-notif-clear-all {
  border: none;
  background: none;
  color: var(--nav-active-text, #2563eb);
  font-size: 0.75rem;
  cursor: pointer;
  white-space: nowrap;
}
.app-notif-clear-all { color: var(--muted); }
.app-notif-clear-all:hover { color: var(--danger); }
.app-notif-push-prompt {
  padding: 0.5rem 0.65rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface-subtle);
}
.app-notif-push-hint { font-size: 0.72rem; color: var(--muted); margin: 0 0 0.45rem; line-height: 1.35; }
.app-notif-enable-push {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  width: 100%;
  justify-content: center;
  border: 1px solid #bfdbfe;
  background: var(--surface-active);
  color: var(--nav-active-text, #1d4ed8);
  border-radius: 0.45rem;
  padding: 0.4rem 0.55rem;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
}
.app-notif-enable-push:hover { background: var(--surface-hover); }
.app-notif-list {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.app-notif-item {
  display: block;
  width: 100%;
  text-align: left;
  border: none;
  background: transparent;
  padding: 0.55rem 0.65rem;
  border-top: 1px solid var(--border);
  cursor: pointer;
}
.app-notif-item-inner { display: flex; align-items: flex-start; gap: 0.55rem; }
.app-notif-icon {
  flex-shrink: 0;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
}
.app-notif-icon--info { background: #dbeafe; color: #1d4ed8; }
.app-notif-icon--success { background: #dcfce7; color: #15803d; }
.app-notif-icon--warning { background: #ffedd5; color: #c2410c; }
.app-notif-icon--error { background: #fee2e2; color: #b91c1c; }
.app-notif-content { min-width: 0; flex: 1; }
.app-notif-item:hover { background: var(--surface-subtle); }
.app-notif-item.unread { background: var(--surface-active); }
.app-notif-title { font-size: 0.82rem; font-weight: 600; color: var(--nav-text-strong, #111827); }
.app-notif-body {
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 0.15rem;
  line-height: 1.35;
}
.app-notif-time { font-size: 0.7rem; color: var(--muted); margin-top: 0.2rem; }

@media (prefers-color-scheme: dark) {
  .app-notif-icon--info { background: #1e3a8a; color: #93c5fd; }
  .app-notif-icon--success { background: #14532d; color: #86efac; }
  .app-notif-icon--warning { background: #7c2d12; color: #fdba74; }
  .app-notif-icon--error { background: #7f1d1d; color: #fca5a5; }
  .app-notif-enable-push { border-color: #1e40af; }
}

.js-run-all-btn.is-busy {
  opacity: 0.92;
  cursor: wait;
  pointer-events: none;
}
.js-run-all-btn .fa-spin { margin-right: 0.35rem; }
