/* Shared Staff shell only. Domain surfaces continue to own their own layouts. */
body.staff-app.staff-shell-visible[data-staff-foundation="2a"] .staff-foundation-skip {
  position: fixed;
  z-index: var(--staff-layer-system);
  inset: var(--staff-foundation-space-3) auto auto var(--staff-foundation-space-3);
  transform: translateY(calc(-100% - 24px));
  padding: var(--staff-foundation-space-3) var(--staff-foundation-space-4);
  border-radius: var(--staff-foundation-radius-control);
  background: var(--staff-foundation-surface);
  color: var(--staff-foundation-text);
  box-shadow: var(--staff-foundation-elevation-surface);
}
body.staff-app.staff-shell-visible[data-staff-foundation="2a"] .staff-foundation-skip:focus-visible {
  transform: none;
  outline: 3px solid var(--staff-foundation-focus);
  outline-offset: 2px;
}
body.staff-app.staff-shell-visible[data-staff-foundation="2a"] .staff-foundation-route-status {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
body.staff-app.staff-shell-visible[data-staff-foundation="2a"] #main-app-container,
body.staff-app.staff-shell-visible[data-staff-foundation="2a"] .main-content {
  min-width: 0;
}
body.staff-app.staff-shell-visible[data-staff-foundation="2a"] .content-topbar {
  min-width: 0;
  column-gap: var(--staff-foundation-space-3);
  flex-wrap: nowrap;
}
body.staff-app.staff-shell-visible[data-staff-foundation="2a"] .content-topbar .topbar-section-name,
body.staff-app.staff-shell-visible[data-staff-foundation="2a"] .content-topbar .topbar-domain-name {
  min-width: 0;
  overflow-wrap: anywhere;
}
body.staff-app.staff-shell-visible[data-staff-foundation="2a"] .staff-page-frame {
  min-width: 0;
}
body.staff-app.staff-shell-visible[data-staff-foundation="2a"] .staff-page-frame .section-header {
  min-width: 0;
  gap: var(--staff-foundation-space-4);
  flex-wrap: wrap;
}
body.staff-app.staff-shell-visible[data-staff-foundation="2a"] .staff-page-frame .section-header .header-actions {
  min-width: 0;
  flex-wrap: wrap;
}
body.staff-app.staff-shell-visible[data-staff-foundation="2a"] .staff-page-frame .section-header h1 {
  overflow-wrap: anywhere;
}
body.staff-app.staff-shell-visible[data-staff-foundation="2a"] :is(.staff-foundation-page-header, .staff-foundation-section-header) {
  min-width: 0;
  display: flex;
  align-items: start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--staff-foundation-space-4);
}
body.staff-app.staff-shell-visible[data-staff-foundation="2a"] .staff-foundation-breadcrumb {
  color: var(--staff-foundation-text-muted);
  font-size: var(--staff-text-label);
}
body.staff-app.staff-shell-visible[data-staff-foundation="2a"] .staff-foundation-state {
  padding: var(--staff-foundation-space-6);
  border: 1px solid var(--staff-foundation-border);
  border-radius: var(--staff-foundation-radius-surface);
  background: var(--staff-foundation-surface);
  color: var(--staff-foundation-text);
}
body.staff-app.staff-shell-visible[data-staff-foundation="2a"] .staff-foundation-state[data-state="error"] {
  border-inline-start: 4px solid var(--staff-foundation-status-error);
}
body.staff-app.staff-shell-visible[data-staff-foundation="2a"] .staff-foundation-state[data-state="denied"],
body.staff-app.staff-shell-visible[data-staff-foundation="2a"] .staff-foundation-state[data-state="partial"] {
  border-inline-start: 4px solid var(--staff-foundation-status-warning);
}
body.staff-app.staff-shell-visible[data-staff-foundation="2a"] :is(.staff-foundation-skip, #btn-sidebar-open, #btn-sidebar-close, #btn-dark-toggle, #btn-logout):focus-visible {
  outline: 3px solid var(--staff-foundation-focus);
  outline-offset: 2px;
}
body.staff-app.staff-shell-visible[data-staff-foundation="2a"] :is(#btn-sidebar-open, #btn-sidebar-close, #btn-dark-toggle, #btn-logout) {
  min-height: var(--staff-foundation-interaction-height);
}
/* Notification presentation lives with the shell; the module owns only state and actions. */
body.staff-app .staff-bell { position: relative; display: flex; flex: 0 0 44px; align-items: center; }
body.staff-app .staff-bell-btn { position: relative; display: grid; place-items: center; width: 44px; height: 44px; padding: 0; border: 0; border-radius: var(--staff-foundation-radius-control); background: transparent; color: var(--staff-foundation-text); cursor: pointer; }
body.staff-app .staff-bell-btn:hover { background: var(--staff-accent-soft); color: var(--staff-accent-strong); }
body.staff-app :is(.staff-bell-btn, .staff-bell-close, .staff-bell-action, .staff-notif-open, .staff-notif .del):focus-visible { outline: 3px solid var(--staff-foundation-focus); outline-offset: 2px; }
body.staff-app .staff-bell-badge { position: absolute; inset: 1px 0 auto auto; display: grid; place-items: center; min-width: 18px; height: 18px; padding-inline: 4px; border-radius: var(--staff-radius-pill); background: var(--staff-foundation-status-error); color: var(--on-danger); box-shadow: 0 0 0 2px var(--staff-foundation-surface); font: 800 11px/1 var(--staff-font); }
body.staff-app .staff-bell-badge[hidden] { display: none; }
body.staff-app .staff-bell-panel { position: absolute; top: calc(100% + 6px); right: 0; display: flex; flex-direction: column; width: min(380px, calc(100vw - 24px)); max-height: min(70dvh, 640px); overflow: hidden; border: 1px solid var(--staff-foundation-border); border-radius: var(--staff-foundation-radius-surface); background: var(--staff-foundation-surface); color: var(--staff-foundation-text); box-shadow: var(--staff-foundation-elevation-overlay); }
body.staff-app .staff-bell-panel[hidden] { display: none; }
body.staff-app .staff-bell-head { display: grid; gap: var(--staff-foundation-space-2); padding: var(--staff-foundation-space-3) var(--staff-foundation-space-4); border-bottom: 1px solid var(--staff-foundation-border); }
body.staff-app .staff-bell-title { display: flex; align-items: center; justify-content: space-between; gap: var(--staff-foundation-space-3); }
body.staff-app .staff-bell-title strong { color: var(--staff-foundation-text); font-size: var(--staff-foundation-type-body); }
body.staff-app .staff-bell-close { width: 44px; height: 44px; border: 0; border-radius: var(--staff-foundation-radius-control); background: transparent; color: var(--staff-foundation-text); cursor: pointer; }
body.staff-app .staff-bell-count { color: var(--staff-foundation-text-muted); font-size: var(--staff-foundation-type-label); }
body.staff-app .staff-bell-actions { display: flex; flex-wrap: wrap; gap: var(--staff-foundation-space-2); }
body.staff-app .staff-bell-action { flex: 1 1 145px; min-height: 44px; padding: 8px 10px; border: 1px solid var(--staff-foundation-border); border-radius: var(--staff-foundation-radius-control); background: var(--staff-foundation-surface-soft); color: var(--staff-accent-strong); font: 700 var(--staff-foundation-type-label)/1.3 var(--staff-font); cursor: pointer; }
body.staff-app .staff-bell-action--danger { color: var(--staff-foundation-status-error); }
body.staff-app .staff-bell-action:disabled { opacity: .55; cursor: default; }
body.staff-app .staff-bell-list { display: flex; flex-direction: column; gap: var(--staff-foundation-space-2); min-height: 0; padding: var(--staff-foundation-space-2); overflow-y: auto; overscroll-behavior: contain; }
body.staff-app .staff-notif { position: relative; display: flex; gap: var(--staff-foundation-space-3); min-width: 0; padding: var(--staff-foundation-space-3) 48px var(--staff-foundation-space-3) var(--staff-foundation-space-3); border: 1px solid var(--staff-foundation-border); border-radius: var(--staff-foundation-radius-control); background: var(--staff-foundation-surface); }
body.staff-app .staff-notif:hover, body.staff-app .staff-notif.unread { background: var(--staff-accent-soft); }
body.staff-app .staff-notif.unread { border-color: var(--staff-accent); }
body.staff-app .staff-notif-open { display: flex; flex: 1; gap: var(--staff-foundation-space-3); min-width: 0; padding: 0; border: 0; background: transparent; color: inherit; text-align: left; font: inherit; cursor: pointer; }
body.staff-app .staff-notif .ic { display: grid; flex: 0 0 36px; place-items: center; width: 36px; height: 36px; border-radius: var(--staff-foundation-radius-control); background: var(--staff-foundation-surface-soft); color: var(--staff-foundation-text-muted); }
body.staff-app .staff-notif.unread .ic { background: var(--staff-accent); color: var(--staff-on-accent); }
body.staff-app .staff-notif .bd { flex: 1; min-width: 0; overflow-wrap: anywhere; }
body.staff-app .staff-notif .bd h5 { margin: 0 0 3px; color: var(--staff-foundation-text); font-size: var(--staff-foundation-type-label); }
body.staff-app .staff-notif .bd p { margin: 0; color: var(--staff-foundation-text-muted); font-size: var(--staff-foundation-type-label); line-height: 1.45; }
body.staff-app .staff-notif .bd time { display: block; margin-top: 4px; color: var(--staff-foundation-text-muted); font-size: var(--staff-foundation-type-meta); }
body.staff-app .staff-notif .del { position: absolute; top: 6px; right: 6px; display: grid; place-items: center; width: 44px; height: 44px; border: 0; border-radius: var(--staff-foundation-radius-control); background: transparent; color: var(--staff-foundation-text-muted); cursor: pointer; }
body.staff-app .staff-notif .del:hover { background: var(--staff-foundation-surface-soft); color: var(--staff-foundation-status-error); }
body.staff-app .staff-bell-empty { padding: var(--staff-foundation-space-8) var(--staff-foundation-space-4); color: var(--staff-foundation-text-muted); text-align: center; font-size: var(--staff-foundation-type-label); line-height: 1.5; }
body.staff-app .staff-bell-empty strong { display: block; margin-bottom: 3px; color: var(--staff-foundation-text); }
body.staff-app .staff-bell-empty .material-symbols-outlined { display: block; margin: 0 auto 8px; font-size: 40px; opacity: .65; }
@media (max-width: 768px) {
  body.staff-app.staff-shell-visible[data-staff-foundation="2a"] .content-topbar {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr) 44px;
    grid-template-rows: 18px 22px;
    align-content: center;
    column-gap: var(--staff-foundation-space-2);
    row-gap: 0;
    flex: 0 0 var(--staff-foundation-mobile-header-height);
    height: var(--staff-foundation-mobile-header-height);
    min-height: var(--staff-foundation-mobile-header-height);
    padding-inline: var(--staff-foundation-gutter);
    z-index: var(--staff-foundation-layer-header);
  }
  body.staff-app.staff-shell-visible[data-staff-foundation="2a"].staff-notifications-open .content-topbar { z-index: var(--staff-foundation-layer-popover); }
  body.staff-app.staff-shell-visible[data-staff-foundation="2a"] .topbar-hamburger { grid-column: 1; grid-row: 1 / 3; width: 44px; height: 44px; margin: 0; }
  body.staff-app.staff-shell-visible[data-staff-foundation="2a"] .topbar-domain-name { grid-column: 2; grid-row: 1; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--staff-foundation-type-meta); }
  body.staff-app.staff-shell-visible[data-staff-foundation="2a"] .topbar-section-name { grid-column: 2; grid-row: 2; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--staff-foundation-type-body); }
  body.staff-app.staff-shell-visible[data-staff-foundation="2a"] .content-topbar:has(.topbar-domain-name[hidden]) .topbar-section-name { grid-row: 1 / 3; align-self: center; }
  body.staff-app.staff-shell-visible[data-staff-foundation="2a"] :is(.topbar-spacer, .topbar-role, .topbar-user) { display: none; }
  body.staff-app.staff-shell-visible[data-staff-foundation="2a"] .staff-bell { grid-column: 3; grid-row: 1 / 3; width: 44px; height: 44px; margin: 0; }
  body.staff-app.staff-shell-visible[data-staff-foundation="2a"] .staff-bell-panel { position: fixed; top: calc(var(--staff-foundation-mobile-header-height) + env(safe-area-inset-top)); right: var(--staff-foundation-gutter); bottom: calc(var(--staff-foundation-mobile-nav-height) + env(safe-area-inset-bottom) + 8px); left: var(--staff-foundation-gutter); width: auto; max-width: none; max-height: none; }
  body.staff-app.staff-notifications-open .main-content { overflow: hidden; }
  body.staff-app.staff-notifications-open .main-content > :is(section, .content-section, .view-panel),
  body.staff-app.staff-notifications-open .teacher-bottom-nav { pointer-events: none; }
  body.staff-app.staff-notifications-open { overflow: hidden; }
  body.staff-app.staff-shell-visible[data-staff-foundation="2a"] .sidebar { max-height: 100dvh; }
  body.staff-app.staff-shell-visible[data-staff-foundation="2a"] .sidebar-nav { min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
  body.staff-app.staff-shell-visible[data-staff-foundation="2a"] .sidebar-footer { flex: 0 0 auto; padding-bottom: max(var(--staff-foundation-space-3), env(safe-area-inset-bottom)); }
  body.staff-app.staff-shell-visible[data-staff-foundation="2a"] .teacher-bottom-nav { min-height: calc(var(--staff-foundation-mobile-nav-height) + env(safe-area-inset-bottom)); }
  body.staff-app.staff-shell-visible[data-staff-foundation="2a"] .main-content > :is(section, .content-section, .view-panel) { padding-bottom: calc(var(--staff-foundation-mobile-nav-height) + env(safe-area-inset-bottom) + var(--staff-foundation-space-4)); }
  body.staff-app.staff-shell-visible[data-staff-foundation="2a"] .staff-page-frame .section-header .header-actions > * {
    max-width: 100%;
  }
  body.staff-app.staff-shell-visible[data-staff-foundation="2a"] #modal-delete-confirm .modal {
    max-width: min(400px, calc(100vw - 24px)) !important;
    max-height: calc(100dvh - 24px);
    overflow: auto;
  }
}

/* One measured mobile bar geometry for Admin and Teacher. The older Teacher
   override made the bar 82px tall while the shared shell reserved only 60px. */
@media (max-width: 768px) {
  body.staff-app.staff-shell-visible[data-staff-foundation="2a"] {
    --staff-foundation-mobile-nav-height: 64px;
  }
  body.staff-app.staff-shell-visible[data-staff-foundation="2a"] #teacher-bottom-nav {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    align-items: stretch;
    width: 100%;
    height: calc(var(--staff-foundation-mobile-nav-height) + env(safe-area-inset-bottom, 0px));
    min-height: 0;
    padding-bottom: env(safe-area-inset-bottom, 0px);
    box-sizing: border-box;
    overflow: hidden;
  }
  body.staff-app.staff-shell-visible[data-staff-foundation="2a"] #teacher-bottom-nav .teacher-nav-tab {
    min-width: 0;
    min-height: 44px;
    max-width: none;
    height: 100%;
    padding: 4px 2px;
    gap: 2px;
    box-sizing: border-box;
    font: 600 0.66rem/1.1 var(--staff-font);
    text-align: center;
  }
  body.staff-app.staff-shell-visible[data-staff-foundation="2a"] #teacher-bottom-nav .teacher-nav-tab .material-symbols-outlined {
    flex: 0 0 auto;
    font-size: 1.4rem;
    line-height: 1;
  }
  body.staff-app.staff-shell-visible[data-staff-foundation="2a"] #teacher-bottom-nav .teacher-nav-tab > span:not(.material-symbols-outlined) {
    display: block;
    max-width: 100%;
    overflow-wrap: normal;
    line-height: 1.1;
  }
  body.staff-app.staff-shell-visible[data-staff-foundation="2a"] #main-app-container .main-content {
    padding-bottom: calc(var(--staff-foundation-mobile-nav-height) + env(safe-area-inset-bottom, 0px) + 1rem);
  }
}
@media (max-width: 360px) {
  body.staff-app .staff-bell-head { padding: var(--staff-foundation-space-2); }
  body.staff-app .staff-bell-action { flex-basis: 120px; }
}
@media (prefers-reduced-motion: reduce) {
  body.staff-app.staff-shell-visible[data-staff-foundation="2a"] .staff-foundation-skip {
    transition: none;
  }
}
