/* Shared role-aware top and bottom navigation. */
.home-header,
.topbar {
  background: linear-gradient(180deg, #ffffff 0%, #f8fcfa 100%);
  border-bottom-color: #dcece5;
  box-shadow: 0 4px 20px rgba(20, 65, 54, 0.05);
}

.home-header {
  position: sticky;
  top: 0;
  z-index: 30;
}

.home-brand,
.brand {
  color: #173b36;
}

.home-brand small,
.brand-sub {
  color: #78938a;
}

.home-actions,
.top-actions {
  gap: 10px;
}

.signed-user,
.db-state {
  color: #69847b;
}

.role-superadmin .role-switcher-form select,
.role-superadmin .top-role-switcher select {
  border-color: #b8dfd1;
  background: #e5f7ef;
  color: #076b59;
}

.role-activity_head .role-switcher-form select,
.role-activity_head .top-role-switcher select {
  border-color: #c8d8f2;
  background: #eef4ff;
  color: #355b96;
}

.role-teacher .role-switcher-form select,
.role-teacher .top-role-switcher select {
  border-color: #b8dfd1;
  background: #e8f7f1;
  color: #087d68;
}

.role-executive .role-switcher-form select,
.role-executive .top-role-switcher select {
  border-color: #ead8b3;
  background: #fff8e8;
  color: #8b681c;
}

.topbar .crumb a {
  color: #648078;
}

.topbar .crumb b {
  color: #173b36;
}

/* Desktop navigation keeps only the areas relevant to each role. */
.role-activity_head .sidebar nav > .nav-label:last-of-type,
.role-activity_head .sidebar nav a[href*="type=teacher"],
.role-activity_head .sidebar nav a[href*="type=student"],
.role-executive .sidebar nav > .nav-label:last-of-type,
.role-executive .sidebar nav a[href*="type=teacher"],
.role-executive .sidebar nav a[href*="type=student"] {
  display: none !important;
}

.role-teacher .sidebar nav > .nav-label,
.role-teacher .sidebar nav a[href*="/activities"],
.role-teacher .sidebar nav a[href*="type=teacher"],
.role-teacher .sidebar nav a[href*="type=student"] {
  display: none !important;
}

.role-teacher .sidebar nav .nav-item,
.role-activity_head .sidebar nav .nav-item,
.role-executive .sidebar nav .nav-item {
  transition: background 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.role-teacher .sidebar nav .nav-item:hover,
.role-activity_head .sidebar nav .nav-item:hover,
.role-executive .sidebar nav .nav-item:hover {
  transform: translateX(2px);
}

.home-bottom-nav {
  background: rgba(255, 255, 255, 0.96);
  border-top-color: #dcece5;
  box-shadow: 0 -8px 24px rgba(20, 65, 54, 0.09);
}

.home-bottom-nav a,
.home-bottom-nav button {
  transition: background 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.home-bottom-nav a:active,
.home-bottom-nav button:active {
  transform: scale(0.96);
}

.nav-icon {
  display: inline-grid !important;
  place-items: center;
  width: 20px !important;
  height: 20px;
  flex: 0 0 20px;
  font-size: 0 !important;
  line-height: 1;
}

.nav-icon svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.home-bottom-nav .nav-icon {
  width: 21px !important;
  height: 21px;
  flex-basis: 21px;
}

.role-activity_head .home-bottom-nav a[href*="/activities"],
.role-executive .home-bottom-nav a[href*="/activities"] {
  background: #eef4ff;
  color: #355b96;
}

.role-superadmin .home-bottom-nav a[href*="/activities"] {
  background: #e5f7ef;
  color: #076b59;
}

@media (max-width: 760px) {
  body[class*="role-"] {
    padding-bottom: calc(94px + env(safe-area-inset-bottom));
  }

  .home-header {
    min-height: 68px;
    padding: 10px 14px;
    gap: 8px;
  }

  .home-brand {
    flex: 1 1 auto;
    min-width: 0;
  }

  .home-actions {
    width: auto;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 6px;
  }

  .home-actions .signed-user {
    display: none;
  }

  .home-actions .button,
  .role-switcher-form select {
    min-height: 38px;
    padding: 7px 10px;
    font-size: 11px;
  }

  .topbar {
    box-shadow: 0 3px 16px rgba(20, 65, 54, 0.06);
  }

  main {
    padding-bottom: calc(94px + env(safe-area-inset-bottom)) !important;
  }

  .sidebar {
    height: calc(78px + env(safe-area-inset-bottom)) !important;
    padding: 5px 10px env(safe-area-inset-bottom) !important;
    background: rgba(255, 255, 255, 0.98) !important;
    border-top: 1px solid #dcece5;
    box-shadow: 0 -8px 24px rgba(20, 65, 54, 0.12) !important;
  }

  .sidebar nav {
    height: 100% !important;
  }

  .sidebar nav .nav-item,
  .sidebar nav .nav-item:not(.active) {
    min-height: 66px !important;
    padding: 7px 4px 9px !important;
    gap: 4px !important;
    font-size: 11px !important;
    line-height: 1.2 !important;
  }

  .sidebar nav .nav-item span {
    width: auto;
    height: 22px;
    font-size: 19px !important;
    line-height: 1 !important;
  }

  .sidebar nav .nav-item .nav-icon {
    width: 21px !important;
    height: 21px;
    flex-basis: 21px;
  }

  .home-bottom-nav {
    height: calc(78px + env(safe-area-inset-bottom));
    padding: 6px 10px env(safe-area-inset-bottom);
  }

  .home-bottom-nav a,
  .home-bottom-nav button {
    min-height: 64px;
    gap: 4px;
    font-size: 11px;
    line-height: 1.2;
  }

  .home-bottom-nav a span,
  .home-bottom-nav button span {
    font-size: 19px;
  }

  .role-superadmin .sidebar nav {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }

  .role-activity_head .sidebar nav,
  .role-executive .sidebar nav {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .role-teacher .sidebar nav {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .role-activity_head .sidebar nav {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }

  .role-teacher .home-bottom-nav {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .role-activity_head .home-bottom-nav {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }

  .role-superadmin .home-bottom-nav,
  .role-executive .home-bottom-nav {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .role-teacher .home-bottom-nav a[href*="/activities"] {
    display: none;
  }

}

/* Tighter mobile navigation: compact single-row header and correctly sized role tabs. */
@media(max-width:760px){
  body[class*="role-"]{padding-bottom:calc(70px + env(safe-area-inset-bottom))!important}
  main{padding-bottom:calc(70px + env(safe-area-inset-bottom))!important}
  .topbar{min-height:50px!important;padding:5px 10px!important;gap:5px!important;flex-wrap:nowrap!important}
  .home-header{min-height:54px!important;padding:6px 10px!important;gap:6px!important;flex-wrap:nowrap!important}
  .home-brand{gap:7px!important;font-size:13px!important;line-height:1.1!important}
  .home-brand img,.home-brand .brand-mark{width:32px!important;height:32px!important;flex:0 0 32px!important}
  .home-brand small{font-size:9px!important}
  .home-actions{flex:0 0 auto!important;gap:5px!important}
  .home-actions .button,.role-switcher-form select{min-height:34px!important;padding:5px 8px!important;font-size:10px!important}
  .sidebar{height:calc(62px + env(safe-area-inset-bottom))!important;min-height:0!important;padding:3px 7px env(safe-area-inset-bottom)!important}
  .sidebar nav{padding:0!important;grid-template-columns:repeat(4,minmax(0,1fr))!important;align-items:center!important}
  .sidebar nav>.nav-label{display:none!important}
  .sidebar nav .nav-item,.sidebar nav .nav-item:not(.active){min-height:52px!important;padding:4px 2px!important;gap:3px!important;border-radius:9px!important;font-size:9px!important;line-height:1.1!important}
  .sidebar nav .nav-item span{width:20px!important;height:20px!important;font-size:18px!important}
  .sidebar nav .nav-item .nav-icon{width:19px!important;height:19px!important;flex-basis:19px!important}
  .sidebar nav .nav-item.active{box-shadow:none!important}
  .sidebar nav .nav-logout-button{min-height:0!important;padding:0!important;gap:3px!important;font-size:inherit!important}
  .sidebar nav .nav-logout-button span{width:20px!important;height:20px!important;font-size:18px!important}
  .sidebar nav .nav-item,.sidebar nav .nav-logout-button{overflow:hidden}
  .role-superadmin .sidebar nav{grid-template-columns:repeat(6,minmax(0,1fr))!important}
  .role-activity_head .sidebar nav{grid-template-columns:repeat(6,minmax(0,1fr))!important}
  .role-executive .sidebar nav{grid-template-columns:repeat(5,minmax(0,1fr))!important}
  .role-teacher .sidebar nav{grid-template-columns:repeat(5,minmax(0,1fr))!important}
  .home-bottom-nav{height:calc(62px + env(safe-area-inset-bottom))!important;padding:3px 7px env(safe-area-inset-bottom)!important}
  .home-bottom-nav a,.home-bottom-nav button{min-height:52px!important;gap:3px!important;font-size:9px!important;line-height:1.1!important}
  .home-bottom-nav .nav-icon{width:19px!important;height:19px!important;flex-basis:19px!important}
}
