:root {
  --hr-bg-page: #f8f9fc;
  --hr-link-color: #336991;
  --hr-link-hover-bg: rgba(51, 105, 145, 0.12);
  --hr-link-soft: rgba(51, 105, 145, 0.24);
  --hr-primary-deep: #2c3e50;
  --hr-primary-soft: #4a5b6e;
  --hr-primary-light: #eff2f8;
  --hr-neutral-100: #ffffff;
  --hr-neutral-200: #f0f2f5;
  --hr-neutral-300: #e4e9ef;
  --hr-neutral-400: #becddd;
  --hr-text-dark: #1a2c38;
  --hr-text-muted: #5c6f87;
  --hr-shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.03), 0 1px 2px rgba(0, 0, 0, 0.05);
  --hr-shadow-md: 0 8px 24px rgba(0, 0, 0, 0.05);
}

.navbar {
  background: #2f4561;
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.03), 0 8px 24px -18px rgba(16, 24, 40, 0.32);
  position: sticky;
  top: 0;
  z-index: 50;
  border-bottom: 1px solid rgba(51, 105, 145, 0.26);
}

.app-sidebar {
  width: 100%;
}

.nav-container {
  width: 100%;
  margin: 0;
  padding: 0.7rem 1.35rem;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  min-width: 0;
  padding-left: 0;
}

.nav-brand {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.15;
}

.nav-powered-by {
  display: block;
  margin-top: 2px;
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: rgba(242, 247, 255, 0.55);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-logo-kicker {
  display: none;
}

.nav-logo-name {
  font-size: 1.55rem;
  font-weight: 700;
  letter-spacing: -0.3px;
  color: #f2f7ff;
  line-height: 1.15;
  max-width: 320px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-toggle {
  width: 36px;
  height: 36px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  background: rgba(255, 255, 255, 0.14);
  border-radius: 0.7rem;
  color: #f1f6ff;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.nav-toggle .material-icons {
  font-size: 1.15rem;
}

.nav-toggle:hover {
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.46);
  background: rgba(255, 255, 255, 0.22);
  transform: translateY(-1px);
}

.nav-toggle:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.75);
  outline-offset: 2px;
}

.nav-restore-toggle {
  position: fixed;
  top: calc(env(safe-area-inset-top, 0px) + 0.8rem);
  right: 1rem;
  display: none;
  align-items: center;
  gap: 0.4rem;
  padding: 0.52rem 0.84rem;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 999px;
  background: #2f4561;
  color: #f4f8ff;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  cursor: pointer;
  box-shadow: 0 14px 28px -18px rgba(15, 23, 42, 0.72);
  z-index: 85;
}

.nav-restore-toggle .material-icons {
  font-size: 1rem;
}

.nav-restore-toggle:hover {
  background: #3a5374;
  border-color: rgba(255, 255, 255, 0.42);
}

.nav-restore-toggle:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.8);
  outline-offset: 2px;
}

body.nav-collapsed .nav-restore-toggle {
  display: inline-flex;
}

.nav-main {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  flex-wrap: wrap;
  flex: 1 1 auto;
  padding: 0.46rem 0.56rem;
  border-radius: 14px;
  background: transparent;
  border: 0;
  box-shadow: none;
}

.app-nav-item {
  text-decoration: none;
  font-weight: 600;
  color: #d7e5f4;
  font-size: 0.95rem;
  transition: background 0.16s ease, color 0.16s ease;
  padding: 0.56rem 0.9rem;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.42rem;
  position: relative;
  min-height: 42px;
  box-shadow: none;
  width: auto;
  justify-content: flex-start;
  white-space: nowrap;
  letter-spacing: 0;
}

.app-nav-item .material-icons {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.1rem;
  height: 1.1rem;
  font-size: 1rem;
  color: currentColor;
  border-radius: 0;
  background: transparent;
  flex-shrink: 0;
  opacity: 0.98;
  transition: color 0.16s ease, opacity 0.16s ease;
}

.app-nav-item::before {
  content: none;
}

.app-nav-item::after {
  content: none;
}

.app-nav-item:hover:not(.is-active) {
  background: rgba(255, 255, 255, 0.14);
  color: #ffffff;
}

.app-nav-item:hover:not(.is-active) .material-icons {
  opacity: 1;
}

.app-nav-item:hover:not(.is-active)::before {
  content: none;
}

.app-nav-item.is-active {
  background: #3e7aa7;
  color: #f3f8ff;
  font-weight: 600;
  border-color: #376e97;
  box-shadow: 0 8px 18px -16px rgba(20, 46, 71, 0.92);
}

.app-nav-item.is-active .material-icons {
  color: #f3f8ff;
  background: transparent;
  opacity: 1;
}

.app-nav-item.is-active::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -7px;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 7px solid transparent;
  border-right: 7px solid transparent;
  border-top: 7px solid #3e7aa7;
  pointer-events: none;
}

.nav-spacer {
  display: none;
}

.nav-footer {
  display: flex;
  align-items: center;
  gap: 1.4rem;
  margin-left: auto;
}

.nav-quick-icons {
  display: flex;
  align-items: center;
  gap: 1.1rem;
}

.nav-quick-icons i {
  font-size: 1.2rem;
  color: #e2ecf9;
  transition: color 0.2s;
  cursor: default;
  user-select: none;
}

.nav-quick-icons i:hover {
  color: #ffffff;
}

.nav-user-card {
  position: relative;
}

.nav-user-trigger {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  border-radius: 999px;
  transition: background 0.18s ease, box-shadow 0.18s ease;
}

.nav-user-trigger:focus-visible {
  outline: 2px solid var(--hr-link-color);
  outline-offset: 3px;
}

.nav-user-avatar {
  width: 40px;
  height: 40px;
  background: #ffffff;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  color: var(--hr-primary-deep);
  font-size: 1rem;
  border: 1px solid #d6dde9;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
  transition: box-shadow 0.18s ease, border-color 0.18s ease;
  flex-shrink: 0;
}

.nav-user-trigger:hover .nav-user-avatar,
.nav-user-trigger.is-open .nav-user-avatar {
  border-color: var(--hr-link-color);
  box-shadow: 0 2px 8px rgba(51, 105, 145, 0.22);
}

.nav-user-initials {
  color: inherit;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0;
}

.nav-user-status {
  display: none;
}

.nav-user-meta {
  display: none;
}

/* ── User-Dropdown ────────────────────────────────────────── */
.user-menu {
  position: absolute;
  top: calc(100% + 12px);
  right: 0;
  min-width: 260px;
  background: var(--hr-neutral-100);
  border: 1px solid var(--hr-neutral-300);
  border-radius: 14px;
  box-shadow: 0 16px 40px -16px rgba(15, 23, 42, 0.28), 0 4px 12px rgba(15, 23, 42, 0.06);
  padding: 0.5rem 0;
  z-index: 200;
  opacity: 0;
  transform: translateY(-4px);
  pointer-events: none;
  transition: opacity 0.16s ease, transform 0.16s ease;
}

.user-menu[data-open="true"] {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.user-menu[hidden] {
  display: none;
}

.user-menu-header {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 0.65rem 1rem 0.85rem;
  border-bottom: 1px solid var(--hr-neutral-200);
}

.user-menu-name {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--hr-text-dark);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-menu-role {
  font-size: 0.72rem;
  color: var(--hr-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-menu-list {
  display: flex;
  flex-direction: column;
  padding: 0.35rem 0;
}

.user-menu-item {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.55rem 1rem;
  background: transparent;
  border: 0;
  width: 100%;
  font-family: inherit;
  font-size: 0.86rem;
  font-weight: 500;
  color: var(--hr-text-dark);
  text-align: left;
  cursor: pointer;
  transition: background 0.14s ease, color 0.14s ease;
}

.user-menu-item .material-icons {
  font-size: 1.1rem;
  color: var(--hr-text-muted);
  transition: color 0.14s ease;
}

.user-menu-item:hover {
  background: var(--hr-primary-light);
}

.user-menu-item:hover .material-icons {
  color: var(--hr-primary-deep);
}

.user-menu-item.is-danger {
  color: var(--hr-signal-red);
}

.user-menu-item.is-danger .material-icons {
  color: var(--hr-signal-red);
}

.user-menu-item.is-danger:hover {
  background: var(--hr-signal-red-light);
}

.user-menu-item[hidden] {
  display: none;
}

.user-menu-divider {
  height: 1px;
  background: var(--hr-neutral-200);
  margin: 0.35rem 0;
}

.app-sidebar.collapsed {
  display: none;
}

/* ── Firma-Switch-Modal ───────────────────────────────────── */
.firma-switch-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.firma-switch-modal[hidden] {
  display: none;
}

.firma-switch-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.46);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.firma-switch-card {
  position: relative;
  width: 100%;
  max-width: 560px;
  max-height: calc(100vh - 48px);
  display: flex;
  flex-direction: column;
  background: var(--preview-content-bg);
  border: 1px solid #dbe3ee;
  border-radius: 22px;
  box-shadow: 0 44px 80px -44px rgba(15, 23, 42, 0.56);
  overflow: hidden;
}

.firma-switch-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px;
  background: var(--preview-card-bg);
  border-bottom: 1px solid #dbe3ee;
}

.firma-switch-header h2 {
  margin: 0;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 20px;
  font-weight: 700;
  color: #0f172a;
}

.firma-switch-close-btn {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #eef2f7;
  border: 1px solid #d2dbe8;
  border-radius: 10px;
  color: #334155;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.16s ease, color 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}

.firma-switch-close-btn:hover {
  background: #e2e8f0;
  color: #0f172a;
  border-color: #c5d1e1;
  box-shadow: 0 8px 14px -10px rgba(62, 107, 140, 0.58);
}

.firma-switch-close-btn .material-icons {
  font-size: 20px;
}

.firma-switch-list {
  flex: 1 1 auto;
  min-height: 0;
  max-height: 60vh;
  overflow-y: auto;
  padding: 12px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.firma-switch-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 14px;
  background: var(--preview-card-bg);
  border: 1px solid #dbe3ee;
  border-radius: 14px;
  color: #0f172a;
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

.firma-switch-item:hover:not(.is-current):not(:disabled) {
  border-color: rgba(62, 107, 140, 0.38);
  box-shadow: 0 14px 24px -22px rgba(62, 107, 140, 0.45);
  background: #ffffff;
}

.firma-switch-item.is-current {
  background: rgba(62, 107, 140, 0.12);
  border-color: rgba(62, 107, 140, 0.46);
  color: #284b63;
  cursor: default;
}

.firma-switch-item-main {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  flex: 1 1 auto;
}

.firma-switch-item-name {
  font-size: 15px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.firma-switch-item-meta {
  font-size: 12px;
  font-weight: 500;
  color: #64748b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.firma-switch-item.is-current .firma-switch-item-meta {
  color: #3e6b8c;
}

.firma-switch-item-current-badge {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(62, 107, 140, 0.14);
  color: #3e6b8c;
  border: 1px solid rgba(62, 107, 140, 0.32);
  flex-shrink: 0;
}

body.modal-open {
  overflow: hidden;
}

/* Mobile: klassische obere Navbar mit Umbruch */
.app-sidebar-backdrop {
  display: none !important;
}

/* ── Sprachpicker (Flagge) im Nav ────────────────────────── */
.nav-lang {
  position: relative;
  display: inline-block;
}

.nav-lang-trigger {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.55rem;
  border: 1px solid #d6dde9;
  background: #ffffff;
  border-radius: 10px;
  cursor: pointer;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
  font-family: inherit;
}

.nav-lang-trigger:hover,
.nav-lang-trigger[aria-expanded="true"] {
  border-color: var(--hr-link-color);
  box-shadow: 0 2px 8px rgba(51, 105, 145, 0.18);
}

.nav-lang-flag {
  width: 22px;
  height: 16px;
  border-radius: 2px;
  display: block;
  object-fit: cover;
  box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.08);
}

.lang-dropdown .lang-flag-wrap {
  display: inline-flex;
  align-items: center;
}

.nav-lang-chevron {
  font-size: 1rem;
  color: #94a3b8;
  transition: transform 0.18s ease;
}

.nav-lang-trigger[aria-expanded="true"] .nav-lang-chevron {
  transform: rotate(180deg);
}

.nav-lang-list {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 160px;
  background: var(--hr-neutral-100);
  border: 1px solid var(--hr-neutral-300);
  border-radius: 12px;
  box-shadow: 0 16px 40px -16px rgba(15, 23, 42, 0.28), 0 4px 12px rgba(15, 23, 42, 0.06);
  list-style: none;
  padding: 0.35rem;
  margin: 0;
  z-index: 200;
  display: none;
}

.nav-lang-list.open {
  display: block;
}

.nav-lang-list li {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.5rem 0.65rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.88rem;
  color: var(--hr-text-dark);
  transition: background 0.12s ease, color 0.12s ease;
}

.nav-lang-list li:hover {
  background: var(--hr-link-hover-bg);
  color: var(--hr-link-color);
}

.nav-lang-list li.active {
  background: var(--hr-link-hover-bg);
  color: var(--hr-link-color);
  font-weight: 600;
}

.nav-lang-list li .lang-check {
  margin-left: auto;
  font-size: 1rem;
  color: var(--hr-link-color);
}

.nav-lang-list li img {
  width: 22px;
  height: 16px;
  border-radius: 2px;
  display: block;
  object-fit: cover;
  box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.08);
  flex-shrink: 0;
}

@media (max-width: 980px) {
  .nav-container {
    padding: 0.7rem 1rem;
  }

  .nav-main {
    gap: 0.4rem;
  }
}

@media (max-width: 860px) {
  .app-mobile-bar {
    display: none !important;
  }

  .app-sidebar {
    position: sticky;
    top: 0;
    z-index: 50;
  }

  .nav-container {
    gap: 0.75rem;
  }

  .nav-main {
    order: 3;
    width: 100%;
    border-top: 0;
    padding-top: 0.7rem;
    padding-left: 0;
    padding-right: 0;
    border-radius: 0;
    border-inline: 0;
    border-bottom: 0;
    background: transparent;
    box-shadow: none;
    justify-content: center;
    gap: 0.45rem;
  }

  .nav-footer {
    order: 2;
    margin-left: auto;
  }

  .nav-logo {
    order: 1;
  }

  .nav-toggle {
    display: none;
  }
}

@media (max-width: 600px) {
  .nav-container {
    padding: 0.68rem 0.85rem;
  }

  .nav-main {
    gap: 0.34rem;
  }

  .app-nav-item {
    font-size: 0.9rem;
    min-height: 39px;
    padding: 0.48rem 0.78rem;
  }

  .nav-logo-name {
    font-size: 1.45rem;
    max-width: 180px;
  }

  .nav-quick-icons {
    gap: 0.75rem;
  }

  .nav-quick-icons i {
    font-size: 1.12rem;
  }
}

@media (max-width: 480px) {
  .firma-switch-modal {
    padding: 0;
    align-items: stretch;
  }

  .firma-switch-card {
    border-radius: 0;
    max-width: 100%;
    max-height: 100dvh;
  }

  .firma-switch-list {
    max-height: none;
    flex: 1;
  }
}
