/* Shared top menu — appears on every page just under the top of <main>.
   Provides: breadcrumb | notification bell with badge + dropdown | profile chip with dropdown.
   Renders into the <header id="topmenu-slot"> placeholder. */

.topmenu {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: 60px;
  padding: 0 32px;
  background: var(--surface, #fff);
  border-bottom: 1px solid var(--border, #eadfba);
}

/* ── Breadcrumb ─────────────────────────────────────────────── */
.topmenu-crumbs {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--muted, #796f91);
  min-width: 0;
  flex: 1;
}
.topmenu-crumbs a {
  color: var(--muted, #796f91);
  text-decoration: none;
  font-weight: 500;
  transition: color 150ms;
}
.topmenu-crumbs a:hover { color: var(--fg, #1d1836); }
.topmenu-crumbs .current {
  color: var(--fg, #1d1836);
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -0.01em;
}
.topmenu-crumbs .sep {
  color: var(--muted, #796f91);
  opacity: 0.5;
  font-size: 14px;
  margin: 0 2px;
}

/* ── Hamburger (narrow screens only) ────────────────────────── */
/* Hidden on wide screens — the sidebar is always visible there. */
.topmenu-hamburger {
  display: none;
  align-items: center; justify-content: center;
  width: 36px; height: 36px;
  border: 1px solid var(--border, #eadfba);
  border-radius: 8px;
  background: var(--surface, #fff);
  color: var(--fg, #1d1836);
  cursor: pointer;
  flex-shrink: 0;
  margin-right: 4px;
  transition: background 150ms, border-color 150ms;
}
.topmenu-hamburger:hover { background: var(--bg, #fff8d7); border-color: var(--accent, #ff6b00); }
.topmenu-hamburger svg { width: 18px; height: 18px; }
@media (max-width: 900px) {
  .topmenu-hamburger { display: inline-flex; }
}

/* ── Right side: notifications + profile ────────────────────── */
.topmenu-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

/* Notification bell */
.notif-wrap { position: relative; }
.notif-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: none;
  border: 1px solid var(--border, #eadfba);
  border-radius: 10px;
  color: var(--fg-2, #4c426c);
  cursor: pointer;
  transition: all 150ms;
  font-family: inherit;
}
.notif-btn:hover { background: var(--bg, #fff8d7); border-color: var(--fg-2, #4c426c); }
.notif-btn svg { width: 16px; height: 16px; }
.notif-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  background: var(--danger, #e5484d);
  color: white;
  font-size: 10px;
  font-weight: 800;
  padding: 1px 5px;
  border-radius: 9999px;
  min-width: 16px;
  text-align: center;
  line-height: 1.4;
  border: 2px solid var(--surface, #fff);
}

.notif-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 380px;
  /* Phase 4.41 — Ali 13:18: cap the panel to 80vh so it
     never escapes the viewport when the unread queue is
     long or the user has a short browser window. 80vh is
     generous on a normal screen and tight on a small one.
     The inner .notif-list scrolls (see line 142). */
  max-height: 80vh;
  background: var(--surface, #fff);
  border: 1px solid var(--border, #eadfba);
  border-radius: 14px;
  box-shadow: 0 16px 48px rgba(29, 24, 54, 0.18);
  z-index: 110;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.notif-panel[hidden] { display: none; }
.notif-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-soft, #f5eccd);
}
.notif-panel-title { font-weight: 700; font-size: 14px; color: var(--fg, #1d1836); }
.notif-mark-read {
  background: none; border: none; color: var(--accent, #ff6b00);
  font-size: 12px; font-weight: 600; cursor: pointer; font-family: inherit;
}
.notif-mark-read:hover { text-decoration: underline; }
.notif-list {
  /* Phase 4.41: let the list grow to fill the parent
     (.notif-panel max-height: 80vh) and scroll within
     that. The 360px cap was a hard ceiling that didn't
     shrink on small viewports. */
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
}
.notif-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border-soft, #f5eccd);
  transition: background 150ms;
  cursor: pointer;
}
.notif-item:hover { background: var(--bg, #fff8d7); }
.notif-item:last-child { border-bottom: none; }
.notif-dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  margin-top: 5px;
  flex-shrink: 0;
}
.notif-content { flex: 1; min-width: 0; }
.notif-text { font-size: 12px; color: var(--fg, #1d1836); line-height: 1.4; word-wrap: break-word; }
.notif-time { font-size: 11px; color: var(--muted, #796f91); margin-top: 3px; }
.notif-empty {
  padding: 32px 16px; text-align: center; color: var(--muted, #796f91); font-size: 13px;
}
.notif-view-all {
  display: block;
  padding: 12px 16px;
  text-align: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--accent, #ff6b00);
  background: var(--bg, #fff8d7);
  text-decoration: none;
  border-top: 1px solid var(--border-soft, #f5eccd);
}
.notif-view-all:hover { background: color-mix(in oklab, var(--accent, #ff6b00), transparent 90%); }

/* Profile chip */
.profile-wrap { position: relative; }
.profile-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px 4px 4px;
  background: var(--surface, #fff);
  border: 1px solid var(--border, #eadfba);
  border-radius: 9999px;
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  color: var(--fg, #1d1836);
  transition: all 150ms;
}
.profile-chip:hover { background: var(--bg, #fff8d7); border-color: var(--fg-2, #4c426c); }
.profile-avatar {
  width: 28px; height: 28px;
  background: var(--accent, #ff6b00);
  color: white;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 800;
  flex-shrink: 0;
}
.profile-name {
  font-weight: 600;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.profile-caret { width: 12px; height: 12px; color: var(--muted, #796f91); flex-shrink: 0; }

.profile-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 280px;
  background: var(--surface, #fff);
  border: 1px solid var(--border, #eadfba);
  border-radius: 14px;
  box-shadow: 0 16px 48px rgba(29, 24, 54, 0.18);
  z-index: 110;
  overflow: hidden;
  padding: 6px;
}
.profile-panel[hidden] { display: none; }
.profile-panel-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-bottom: 1px solid var(--border-soft, #f5eccd);
}
.profile-panel-avatar {
  width: 40px; height: 40px;
  background: var(--accent, #ff6b00);
  color: white;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 800;
  flex-shrink: 0;
}
.profile-panel-name { font-weight: 800; font-size: 14px; color: var(--fg, #1d1836); }
.profile-panel-email { font-size: 11px; color: var(--muted, #796f91); margin-top: 1px; }
.profile-panel-role { font-size: 10px; color: var(--accent, #ff6b00); font-weight: 700; margin-top: 3px; text-transform: uppercase; letter-spacing: 0.05em; }
.profile-link {
  display: block;
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  border-radius: 8px;
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  color: var(--fg, #1d1836);
  text-decoration: none;
  margin-top: 4px;
}
.profile-link:hover { background: var(--bg, #fff8d7); }
.profile-link-danger { color: var(--danger, #e5484d); }
.profile-link-danger:hover { background: color-mix(in oklab, var(--danger, #e5484d), transparent 92%); }

@media (max-width: 600px) {
  .topmenu { padding: 0 16px; }
  .topmenu-crumbs .current { font-size: 14px; }
  .profile-name { display: none; }
  .notif-panel { width: 320px; }
  /* Phase 4.41: on small screens the panel is narrower
     and the 80vh cap keeps it inside the viewport even
     on a 480px-tall mobile browser. */
  .notif-panel { max-height: 75vh; }
}
