/*
 * leadity-Bibliothek · kanonische App-Shell
 * Quellen: Figma 2147:1500, 2147:496, 2241:7633, 5370:14390
 * Dieser Layer wird nach den seitenspezifischen Styles geladen und hält
 * Header, Footer, Sidebar, Kontextnavigation und Breadcrumbs synchron.
 */

.app-shell {
  grid-template-rows: 50px minmax(0, 1fr) 50px;
}

.global-header {
  min-height: 50px;
  padding-inline: var(--leadity-space-6);
  gap: var(--leadity-space-5);
  background: var(--leadity-theme-main);
  color: var(--leadity-theme-on-main);
}

.global-header .header-cluster,
.global-header .header-user,
.global-header .user-context,
.global-header .company-context,
.global-header .header-actions {
  min-width: 0;
  display: flex;
  align-items: center;
}

.global-header .header-cluster,
.global-header .header-user,
.global-header .user-context { gap: var(--leadity-space-5); }
.global-header .company-context { gap: var(--leadity-space-4); }
.global-header .header-actions { gap: 0; }

.global-header .company-name,
.global-header .user-name {
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.global-header .icon-button {
  width: 48px;
  height: 48px;
  padding: 0;
  border: 0;
  border-radius: var(--leadity-radius-full);
  background: transparent;
  color: inherit;
  font-size: 20px;
  transform: none;
}

.global-header .icon-button:hover {
  background: color-mix(in srgb, var(--leadity-theme-on-main) 15%, transparent);
  transform: none;
}

.global-header :where(a, button, select, [tabindex]):focus-visible {
  outline-color: var(--leadity-white);
}

.global-header .icon-button:active { transform: none; }

.global-header .notification,
.global-header .notification-button { position: relative; }

.global-header .notification-count {
  min-width: 16px;
  height: 16px;
  top: 8px;
  right: 1px;
  padding-inline: 3px;
  border: 1px solid var(--leadity-white);
  font-size: 10px;
  font-weight: 500;
}

.sidebar {
  width: var(--leadity-shell-sidebar-width);
  max-height: calc(100dvh - 50px - 50px - var(--leadity-space-7) - var(--leadity-space-7));
  border-radius: var(--leadity-radius-xl);
  background: var(--leadity-white);
  box-shadow: var(--leadity-shadow-default);
}

.sidebar-head {
  min-height: 120px;
  position: relative;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  padding: 0;
}

.sidebar-logo {
  width: 162px;
  height: auto;
  display: block;
}

.sidebar .brand-mark { display: none; }

.sidebar-close {
  width: 40px;
  height: 40px;
  position: absolute;
  top: 8px;
  right: 8px;
  color: var(--leadity-neutral-60);
}

.sidebar-close:hover { background: var(--leadity-neutral-20); }

.nav-scroll {
  min-height: 0;
  flex: 1 1 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 0 var(--leadity-space-6) var(--leadity-space-6);
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
  scrollbar-color: var(--leadity-neutral-40) transparent;
}

.nav-group + .nav-group { margin-top: var(--leadity-space-6); }

.nav-group-title {
  min-height: 40px;
  margin-bottom: var(--leadity-space-3);
}

.nav-group-icon {
  width: 32px;
  height: 32px;
  display: block;
  flex: 0 0 32px;
  background: var(--leadity-neutral-60);
  -webkit-mask: var(--nav-group-icon) center / contain no-repeat;
  mask: var(--nav-group-icon) center / contain no-repeat;
}

.nav-item,
.nav-disclosure {
  width: 100%;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--leadity-space-1);
  padding: var(--leadity-space-1) 0;
  border: 0;
  border-radius: var(--leadity-radius-full);
  background: transparent;
  color: var(--leadity-text-default);
  font: 300 16px/20px var(--leadity-font-body);
  letter-spacing: .016px;
  text-align: left;
  cursor: pointer;
}

.nav-item:hover,
.nav-disclosure:hover {
  background: transparent;
  color: var(--leadity-text-default);
  font-weight: 400;
}

.nav-item[aria-current="page"] {
  background: transparent;
  color: var(--leadity-text-default);
  font-weight: 700;
}

.nav-item[aria-current="page"]:hover { font-weight: 700; }

.nav-item > i,
.nav-disclosure > i {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  flex: 0 0 40px;
  color: var(--leadity-neutral-60);
  font-size: 16px;
}

.nav-disclosure > i { transition: transform 160ms ease; }
.nav-disclosure:hover > i {
  border-radius: var(--leadity-radius-full);
  background: var(--leadity-neutral-20);
}
.nav-disclosure[aria-expanded="true"] > i { transform: rotate(180deg); }

.nav-submenu .nav-item { padding-left: var(--leadity-space-6); }
.nav-submenu .nav-submenu .nav-item { padding-left: var(--leadity-space-8); }

.context-rail {
  width: 48px;
  align-self: start;
  gap: var(--leadity-space-4);
}

.context-action {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  padding: 0;
}

.breadcrumbs {
  min-width: 0;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--leadity-space-4);
  padding-block: var(--leadity-space-3);
  color: var(--leadity-text-default);
  font: 400 14px/21px var(--leadity-font-body);
}

.breadcrumbs a,
.breadcrumbs [aria-current="page"] {
  min-width: 0;
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.breadcrumbs a {
  min-height: 21px;
  display: inline-flex;
  align-items: center;
  color: var(--leadity-text-default);
}

.breadcrumbs a:hover {
  color: inherit;
  font-weight: 400;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.breadcrumbs [aria-current="page"] { color: var(--leadity-text-default); }
.breadcrumb-chevron { width: 16px; font-size: 16px; color: var(--leadity-neutral-50); }

.global-footer {
  min-height: 50px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--leadity-space-6);
  padding-inline: var(--leadity-space-6);
  background: var(--leadity-neutral-80);
  color: var(--leadity-white);
  font: 400 16px/24px var(--leadity-font-body);
}

.footer-brand,
.footer-links,
.footer-link,
.footer-links a {
  display: flex;
  align-items: center;
}

.footer-brand { gap: var(--leadity-space-8); }
.footer-logo { width: 69px; height: auto; display: block; }
.footer-tagline { color: var(--leadity-neutral-20); opacity: 1; }
.footer-links { gap: var(--leadity-space-6); }
.footer-link,
.footer-links a {
  min-height: 40px;
  gap: var(--leadity-space-3);
  padding-inline: var(--leadity-space-4);
  border-radius: var(--leadity-radius-full);
  white-space: nowrap;
}

.footer-link:hover,
.footer-links a:hover {
  background: color-mix(in srgb, var(--leadity-white) 15%, transparent);
  text-decoration: none;
}

@media (max-width: 1279px) {
  .global-header,
  .global-footer { padding-inline: var(--leadity-space-5); }
  .footer-tagline { display: none; }
}

@media (max-width: 767px) {
  body { overflow: auto; }

  .app-shell {
    height: auto;
    min-height: 100dvh;
    grid-template-rows: 50px minmax(0, auto) 256px;
  }

  .global-header { padding-inline: var(--leadity-space-4); }
  .global-header .company-name {
    max-width: 132px;
    display: block !important;
  }
  .global-header .header-separator,
  .global-header .leadity-header-year-picker,
  .global-header .user-name { display: none !important; }
  .global-header .header-actions .header-optional { display: inline-grid !important; }
  .sidebar { width: min(344px, calc(100vw - 32px)); }

  .global-footer {
    min-height: 256px;
    align-items: flex-start;
    justify-content: flex-start;
    flex-direction: column;
    gap: var(--leadity-space-7);
    padding: var(--leadity-space-7) var(--leadity-space-4);
  }

  .global-footer .footer-links {
    order: 1;
    width: 100%;
    display: flex !important;
    align-items: flex-start;
    flex-direction: column;
    gap: var(--leadity-space-3);
  }

  .global-footer .footer-brand { order: 2; }
  .footer-link,
  .footer-links a { padding-inline: 0; }
  .footer-link:hover,
  .footer-links a:hover { background: transparent; text-decoration: underline; }
}

@media (max-width: 560px) {
  .global-header { padding-inline: var(--leadity-space-1); }
  .global-header .header-cluster > a.icon-button { display: none; }
  .global-header .company-name { max-width: 72px; }
  .global-header .header-cluster,
  .global-header .header-user,
  .global-header .user-context { gap: var(--leadity-space-2); }
}

@media (prefers-reduced-motion: reduce) {
  .nav-disclosure > i { transition: none; }
}
