/* Personnel portal navigation is independent of Porto and MEOS chrome. */
.portal-top-navigation { --portal-header-height: 72px; }
.portal-top-navigation .portal-header {
  position: sticky;
  top: 0;
  z-index: 60;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 24px;
  min-height: 72px;
  padding: 10px 24px;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  color: var(--text);
  letter-spacing: 0;
}

body.locked .portal-header,
body.locked .portal-nav-backdrop,
.portal-nav-toggle,
.portal-nav-backdrop {
  display: none;
}

.portal-brand {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--text);
  text-decoration: none;
  min-width: 0;
}

.portal-brand img { flex: none; width: 32px; height: 36px; object-fit: contain; }
body[data-organization="defensie"] .portal-brand img { width: 56px; height: 40px; }
.portal-brand > span { display: grid; gap: 1px; }
.portal-brand strong { font-size: 15px; font-weight: 750; }
.portal-brand > span > span { color: var(--muted); font-size: 10px; }
.portal-navigation { display: flex; align-items: center; gap: 3px; min-width: 0; }
.portal-nav-group { position: relative; min-width: 0; border: 0; padding: 0; }
.portal-nav-group[hidden], .portal-group-count[hidden] { display: none; }
.portal-nav-group > summary {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 38px;
  padding: 8px 9px;
  border-radius: 4px;
  color: var(--muted);
  cursor: pointer;
  list-style: none;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 650;
}
.portal-nav-group > summary::-webkit-details-marker { display: none; }
.portal-nav-group > summary::after {
  content: "";
  width: 5px;
  height: 5px;
  margin: -3px 1px 0 2px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg);
}
.portal-nav-group[open] > summary,
.portal-nav-group > summary:hover { color: var(--text); background: var(--surface); }
.portal-nav-group.is-active > summary { color: #ffac45; }
.portal-nav-group > summary:focus-visible,
.portal-brand:focus-visible,
.portal-nav-toggle:focus-visible { outline: 2px solid #ffac45; outline-offset: 3px; }
.portal-group-count {
  display: inline-grid;
  place-items: center;
  min-width: 19px;
  height: 19px;
  padding: 0 5px;
  border-radius: 4px;
  background: #3c301e;
  color: #ffc36b;
  font-size: 11px;
  font-weight: 750;
}
.portal-nav-dropdown {
  position: absolute;
  top: calc(100% + 10px);
  left: 0;
  z-index: 2;
  width: 268px;
  max-width: calc(100vw - 32px);
  max-height: calc(100dvh - 110px);
  padding: 6px;
  overflow-y: auto;
  overscroll-behavior: contain;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  box-shadow: 0 14px 32px #0007;
}
.portal-top-navigation .portal-nav-dropdown .nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 42px;
  margin: 0;
  padding: 9px 10px;
  border-radius: 4px;
  color: var(--text);
  line-height: 1.3;
  white-space: normal;
  font-size: 13px;
}
.portal-top-navigation .portal-nav-dropdown .nav-item[hidden] { display: none; }
.portal-top-navigation .portal-nav-dropdown .nav-item.active { color: #ffb14c; background: #382d1f; }
.portal-nav-dropdown .nav-icon { flex: 0 0 18px; width: 18px; height: 18px; }
.portal-nav-dropdown .nav-icon-svg { width: 18px; height: 18px; }
.portal-top-navigation .portal-header .topbar-actions {
  display: flex;
  flex: none;
  flex-wrap: nowrap;
  align-items: center;
  gap: 9px;
  width: auto;
  max-width: 100%;
}
.portal-shortcuts { display: flex; align-items: center; gap: 1px; }
.portal-top-navigation .portal-header .portal-shortcuts .nav-item {
  min-height: 34px;
  padding: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}
.portal-shortcuts .nav-icon { display: none; }
.portal-top-navigation .portal-header .portal-connection-status {
  min-height: 34px;
  padding: 7px 9px;
  border-radius: 4px;
  background: var(--surface-2);
  font-size: 11px;
  white-space: nowrap;
}
.portal-top-navigation .portal-header .portal-connection-status strong { display: block; }
.portal-top-navigation .portal-header .notification-bell { width: 34px; height: 34px; min-height: 34px; border-radius: 4px; }
.portal-top-navigation .portal-header .profile-chip {
  display: flex;
  flex: none;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  max-width: 266px;
  width: auto;
  min-height: 38px;
  margin: 0;
  padding: 0 0 0 4px;
  border: 0;
  border-radius: 0;
  background: transparent;
  overflow: visible;
}
.portal-top-navigation .portal-header .profile-chip .profile-open:not([hidden]) { width: 32px; height: 32px; flex: 0 0 32px; }
.portal-top-navigation .portal-header .profile-chip img { width: 30px; height: 30px; border-radius: 4px; }
.portal-top-navigation .portal-header .profile-chip .profile-open-text:not([hidden]) { display: flex; flex: 0 1 120px; min-width: 0; }
.portal-top-navigation .portal-header .profile-chip .profile-open-text strong { max-width: 120px; font-size: 12px; }
.portal-top-navigation .portal-header .profile-chip .profile-open-text span { color: var(--muted); font-size: 10px; }
.portal-top-navigation .portal-header .profile-chip .small { min-height: 34px; padding: 7px 10px; border: 1px solid #343b43; border-radius: 4px; font-size: 11px; }
.portal-top-navigation .portal-header .notification-panel { top: calc(100% + 14px); color: var(--text); }
.portal-top-navigation .shell,
html[data-ui-mode="calm"] body.portal-top-navigation .shell {
  width: 100%;
  max-width: 100%;
  margin-left: 0;
  padding: 26px 28px 40px;
}
.portal-top-navigation .shell > .topbar { min-height: 58px; margin-bottom: 24px; align-items: center; flex-direction: row; flex-wrap: wrap; justify-content: space-between; }
.portal-top-navigation .shell > .topbar h1 { font-size: 30px; letter-spacing: 0; }
.portal-top-navigation .shell > .topbar > .topbar-heading-copy { flex: 1 1 240px; }
#portalDisplaySettings { flex: 0 0 auto; }
body.portal-top-navigation .shell :is(#personeel, #medewerkers, #mentor-overzicht, #urencontrole, #archief) .sticky-toolbar {
  top: var(--portal-header-height);
  max-width: 100%;
  margin: 0 0 20px !important;
  padding: 12px 0 16px !important;
}

@media (max-width: 1279px) {
  .portal-top-navigation { --portal-header-height: 64px; }
  .portal-top-navigation .portal-header { grid-template-columns: auto auto minmax(0, 1fr); gap: 12px; min-height: 64px; padding: 10px 18px; }
  .portal-top-navigation .portal-header .topbar-actions { justify-self: end; }
  .portal-nav-toggle { display: grid; place-items: center; width: 36px; height: 36px; padding: 0; border: 1px solid var(--line); border-radius: 4px; background: var(--surface); color: var(--text); }
  .portal-nav-toggle > span { display: grid; gap: 4px; }
  .portal-nav-toggle i { display: block; width: 16px; height: 1.5px; background: currentColor; }
  .portal-top-navigation .portal-navigation { position: fixed; inset: calc(var(--portal-header-height) + 6px) 16px auto; display: none; max-height: calc(100dvh - var(--portal-header-height) - 24px); padding: 8px; overflow-y: auto; overscroll-behavior: contain; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); box-shadow: 0 16px 40px #0008; }
  .portal-top-navigation.portal-nav-open .portal-navigation { display: block; }
  .portal-nav-group > summary { min-height: 44px; padding: 10px 12px; font-size: 14px; }
  .portal-nav-group > summary::after { margin-left: auto; }
  .portal-nav-dropdown { position: static; width: auto; max-width: none; max-height: none; margin: 3px 0 8px; border: 0; background: var(--surface); box-shadow: none; }
  .portal-nav-backdrop:not([hidden]) { position: fixed; inset: var(--portal-header-height) 0 0; z-index: 50; display: block; width: 100%; height: calc(100dvh - var(--portal-header-height)); margin: 0; padding: 0; border: 0; border-radius: 0; background: #0008; }
  body.portal-nav-open { overflow: hidden; }
}

@media (max-width: 1023px) {
  .portal-top-navigation .portal-header { grid-template-columns: minmax(0, 1fr) auto; row-gap: 8px; }
  .portal-top-navigation .portal-header .topbar-actions { grid-column: 1 / -1; width: 100%; flex-wrap: wrap; justify-content: flex-end; }
  .portal-top-navigation .portal-header .profile-chip { max-width: 100%; }
  .portal-top-navigation .portal-header .notification-panel { position: fixed; top: calc(var(--portal-header-height) + 8px); right: 12px; width: min(360px, calc(100vw - 24px)); max-height: calc(100dvh - var(--portal-header-height) - 20px); overflow-y: auto; }
}

@media (max-width: 600px) {
  .portal-top-navigation .portal-header { gap: 8px; padding: 10px 12px; }
  .portal-brand { gap: 6px; }
  .portal-brand img { width: 26px; height: 32px; }
  body[data-organization="defensie"] .portal-brand img { width: 40px; height: 32px; }
  .portal-brand strong { font-size: 13px; }
  .portal-brand > span > span { font-size: 9px; }
  .portal-top-navigation .portal-header .topbar-actions { gap: 6px; }
  .portal-top-navigation .portal-header .portal-connection-status { min-height: 34px; padding: 7px 9px; }
  .portal-top-navigation .portal-header .profile-chip { padding: 0; gap: 8px; }
  .portal-top-navigation .shell,
  html[data-ui-mode="calm"] body.portal-top-navigation .shell { padding: 18px 14px 28px; }
  .portal-top-navigation .shell > .topbar { gap: 14px; min-height: 0; margin-bottom: 20px; }
  .portal-top-navigation .shell > .topbar h1 { font-size: 26px; }
  .portal-top-navigation .rank-legend,
  html[data-ui-mode="calm"] .portal-top-navigation .rank-legend { grid-template-columns: minmax(0, 1fr); }
  .portal-top-navigation .rank-legend-item,
  html[data-ui-mode="calm"] .portal-top-navigation .rank-legend-item { grid-template-columns: 12px minmax(0, 1fr) minmax(32px, 0.5fr) 32px; gap: 8px; }
  .portal-top-navigation .rank-name { min-width: 0; overflow-wrap: anywhere; }
}
