/* NAVO – Kopfleiste (kopfleiste.js): eine ruhige Zeile, gleiche Höhe/Abstände/Symbolgröße, Werkzeuge rechts gebündelt */
:root {
  --tb-h: 56px;
  --tb-ctl: 36px;
  --tb-ic: 18px;
}

/* ---------- Werkzeugbereich rechts (alle Ansichten) ---------- */
.tb-tools {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: none;
}
.tb-tools .tb-ic {
  display: inline-grid;
  place-items: center;
  width: var(--tb-ctl);
  height: var(--tb-ctl);
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  padding: 0;
}
.tb-tools .tb-ic svg {
  width: var(--tb-ic);
  height: var(--tb-ic);
}
.tb-tools .tb-ic:hover {
  background: color-mix(in srgb, var(--text) 7%, transparent);
  color: var(--text);
}
.tb-tools .ai-fab.in-top {
  height: 32px;
  margin: 0 4px;
}
.tb-prof {
  display: flex;
  align-items: center;
  margin-left: 6px;
  padding-left: 10px;
  border-left: 1px solid var(--line);
  height: 24px;
}
.tb-av-btn {
  display: inline-grid;
  place-items: center;
  width: var(--tb-ctl);
  height: var(--tb-ctl);
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
}
.tb-av {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--accent) 14%, var(--panel));
  color: var(--accent);
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.tb-av.lg {
  width: 40px;
  height: 40px;
  font-size: 14px;
  flex: none;
}
.tb-av-btn:hover .tb-av,
.tb-av-btn[aria-expanded='true'] .tb-av {
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent);
}

/* ---------- Profilmenü ---------- */
.tb-pm {
  position: fixed;
  z-index: 120;
  width: 288px;
  max-height: calc(100vh - 80px);
  overflow: auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow:
    0 18px 50px -12px rgba(0, 0, 0, 0.28),
    0 2px 6px rgba(0, 0, 0, 0.06);
  padding: 6px;
}
.tb-ph {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 10px 10px 12px;
}
.tb-ph > div {
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.tb-ph b {
  font-size: 14.5px;
  font-weight: 650;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tb-ph span {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tb-psec {
  border-top: 1px solid var(--line);
  padding: 6px 0;
}
.tb-psec:last-child {
  padding-bottom: 0;
}
.tb-plabel {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 4px 10px 6px;
}
.tb-pi {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--text);
  font: inherit;
  font-size: 14px;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}
.tb-pi svg {
  width: var(--tb-ic);
  height: var(--tb-ic);
  color: var(--muted);
  flex: none;
}
.tb-pi:hover {
  background: color-mix(in srgb, var(--accent) 8%, transparent);
}
.tb-pi:hover svg {
  color: var(--accent);
}
.tb-seg {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2px;
  margin: 0 8px 4px;
  padding: 3px;
  border-radius: 10px;
  background: color-mix(in srgb, var(--text) 6%, transparent);
}
.tb-seg button {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 7px 4px 6px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}
.tb-seg button svg {
  width: 17px;
  height: 17px;
}
.tb-seg button.on {
  background: var(--panel);
  color: var(--text);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
  font-weight: 600;
}
.tb-seg button.on svg {
  color: var(--accent);
}

/* Standard (Menü links, Leiste oben) und schmaleres Fenster: dieselbe Höhe wie „Alles oben“ */
@media (min-width: 721px) {
  .app:not(.layout-left) .main > .top {
    height: var(--tb-h);
    min-height: var(--tb-h);
    padding-top: 0;
    padding-bottom: 0;
    box-sizing: border-box;
  }
}
/* Tablet/kleines Fenster (Seitenleiste ausklappbar): Hilfe und Profil bleiben oben – nur am Handy wandern sie ins Menü */
@media (min-width: 721px) and (max-width: 1100px) {
  html:not(.ios-app) .top .tb-tools .top-x {
    display: inline-grid !important;
  }
  html:not(.ios-app) .side-acts {
    display: none;
  }
}

/* ---------- Ansicht „Alles oben“ ---------- */
@media (min-width: 1101px) {
  .app.layout-top .top {
    height: var(--tb-h);
    min-height: var(--tb-h);
    padding: 0 16px 0 20px;
    gap: 6px;
    background: var(--panel) !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    border-bottom: 1px solid var(--line);
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.02);
  }
  .app.layout-top .top .spacer {
    display: none;
  }

  /* Logo + Firma */
  .app.layout-top .tn-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 10px 0 0;
    padding-right: 14px;
    border-right: 1px solid var(--line);
    height: 28px;
    flex: none;
  }
  .tn-brand .tb-home {
    display: flex;
    align-items: center;
  }
  .app.layout-top .tn-brand img {
    max-height: 26px;
    max-width: 110px;
    width: auto;
  }
  .app.layout-top .tn-brand .logo.tb-navo {
    height: 24px;
  }
  .tb-co {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    max-width: 200px;
    padding: 4px 6px;
    margin-left: -6px;
    border: 0;
    border-radius: 8px;
    background: none;
    color: var(--text);
    font: inherit;
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
  }
  .tb-co.static {
    cursor: default;
  }
  .tb-co:not(.static):hover {
    background: color-mix(in srgb, var(--text) 6%, transparent);
  }
  .tb-co-n {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .tb-car svg {
    width: 14px;
    height: 14px;
    color: var(--muted);
  }

  /* Hauptbereiche */
  .app.layout-top .topnav {
    display: flex;
    align-items: center;
    gap: 2px;
    flex: 1 1 auto;
    min-width: 0;
    flex-wrap: nowrap;
    overflow: hidden;
    height: var(--tb-h);
  }
  .app.layout-top .topnav:has(.tn-grp.open) {
    overflow: visible;
  }
  .app.layout-top .topnav[hidden] {
    display: none;
  }
  .tn-grp {
    position: relative;
    height: 100%;
    display: flex;
    align-items: center;
    flex: none;
  }
  .tn-grp[hidden] {
    display: none;
  }
  .tn-btn,
  .tn-grp.single > a {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    height: var(--tb-ctl);
    padding: 0 10px;
    border-radius: 9px;
    border: 0;
    background: transparent;
    color: var(--text);
    font: inherit;
    font-size: 14px;
    font-weight: 550;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
  }
  .tn-btn > svg,
  .tn-grp.single > a > svg {
    width: var(--tb-ic);
    height: var(--tb-ic);
    color: var(--muted);
  }
  .tn-car {
    display: inline-flex;
    margin-left: -2px;
  }
  .tn-car svg {
    width: 14px;
    height: 14px;
    color: var(--faint);
    transition: transform 0.15s;
  }
  .tn-grp.open .tn-car svg {
    transform: rotate(180deg);
  }
  .tn-btn:hover,
  .tn-grp.open > .tn-btn,
  .tn-grp.single > a:hover {
    background: color-mix(in srgb, var(--text) 6%, transparent);
  }
  .tn-grp.has-active > .tn-btn,
  .tn-grp.single > a.active {
    color: var(--accent);
    background: transparent;
  }
  .tn-grp.has-active > .tn-btn > svg,
  .tn-grp.single > a.active > svg {
    color: var(--accent);
  }
  .tn-grp.has-active > .tn-btn::after,
  .tn-grp.single > a.active::after {
    content: '';
    position: absolute;
    left: 10px;
    right: 10px;
    bottom: calc((var(--tb-ctl) - var(--tb-h)) / 2);
    height: 2px;
    border-radius: 2px 2px 0 0;
    background: var(--accent);
  }
  .tn-grp.has-cnt > .tn-btn > svg:first-child {
    overflow: visible;
  }
  .tn-grp.has-cnt > .tn-btn::before {
    content: '';
    position: absolute;
    left: 22px;
    top: 6px;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 0 2px var(--panel);
  }

  /* Aufklappmenü als Panel */
  .tn-menu {
    display: none;
    position: absolute;
    top: calc(100% - 1px);
    left: -4px;
    min-width: 260px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 0 0 14px 14px;
    border-top-color: transparent;
    box-shadow:
      0 22px 48px -18px rgba(0, 0, 0, 0.3),
      0 2px 6px rgba(0, 0, 0, 0.05);
    padding: 8px;
    z-index: 60;
  }
  .tn-menu.right {
    left: auto;
    right: -4px;
  }
  .tn-grp.open > .tn-menu {
    display: block;
  }
  .tn-mh {
    font-size: 11.5px;
    font-weight: 600;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 6px 10px 6px;
  }
  .tn-mi + .tn-mh {
    margin-top: 6px;
    border-top: 1px solid var(--line);
    padding-top: 12px;
  }
  .tn-menu.cols2 {
    min-width: 500px;
  }
  .tn-menu.cols2 .tn-mi {
    display: grid;
    grid-template-columns: 1fr 1fr;
    column-gap: 4px;
  }
  .tn-menu a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 6px 10px 6px 6px;
    border-radius: 10px;
    color: var(--text);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
  }
  .tn-ic {
    display: inline-grid;
    place-items: center;
    width: 32px;
    height: 32px;
    border-radius: 9px;
    background: color-mix(in srgb, var(--accent) 8%, var(--panel));
    color: var(--accent);
    flex: none;
  }
  .tn-menu a .tn-ic svg {
    width: var(--tb-ic);
    height: var(--tb-ic);
    opacity: 1;
  }
  .tn-l {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .tn-menu a:hover {
    background: color-mix(in srgb, var(--text) 5%, transparent);
    color: var(--text);
  }
  .tn-menu a.active {
    background: color-mix(in srgb, var(--accent) 9%, transparent);
    color: var(--accent);
    font-weight: 600;
  }
  .tn-menu a.active .tn-ic {
    background: var(--accent);
    color: var(--on-accent);
  }
  .tn-menu a .nav-badge,
  .tn-menu a .nav-work {
    display: none;
  } /* Kopie aus dem Seitenmenü – Zähler kommt als .tn-cnt */
  .tn-cnt {
    margin-left: auto;
    min-width: 22px;
    height: 20px;
    padding: 0 7px;
    border-radius: 10px;
    background: var(--accent);
    color: var(--on-accent);
    font-size: 11.5px;
    font-weight: 650;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
  .tn-cnt.soft {
    background: color-mix(in srgb, var(--text) 9%, transparent);
    color: var(--text);
  }

  /* Suche rechts */
  .app.layout-top .top .gsearch {
    order: 0;
    flex: 0 1 230px;
    min-width: 160px;
    max-width: 240px;
    margin-left: 8px;
  }
  .app.layout-top .top .gsearch input {
    height: var(--tb-ctl);
    min-height: var(--tb-ctl);
    border-radius: 10px;
    background: color-mix(in srgb, var(--text) 5%, transparent);
    border-color: transparent;
    font-size: 13.5px;
  }
  .app.layout-top .top .gsearch input:focus {
    background: var(--panel);
    border-color: var(--accent);
  }
  .app.layout-top .top .gsearch kbd {
    display: inline-block;
  }
  .app.layout-top .top .gs-results {
    left: auto;
    right: 0;
    width: 440px;
  }

  /* Schmaleres Fenster: Werkzeug-Texte weg – Suche als Lupe (öffnet sich beim Anklicken), NAVO AI als Symbol, Firmenname aus */
  .app.layout-top .top.tb-compact2 .tb-co {
    display: none;
  }
  .app.layout-top .top.tb-compact2 .tn-brand {
    padding-right: 10px;
    margin-right: 6px;
  }
  .app.layout-top .top.tb-compact .gsearch {
    flex: 0 0 72px;
    min-width: 72px;
    width: 72px;
    margin-left: 4px;
  }
  .app.layout-top .top.tb-compact .gsearch input {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 72px;
    padding-right: 0;
    cursor: pointer;
    transition: width 0.18s ease;
    z-index: 2;
    border: 1px solid var(--line);
  }
  .app.layout-top .top.tb-compact .gsearch input::placeholder {
    color: transparent;
  }
  .app.layout-top .top.tb-compact .gsearch input:not(:focus) {
    background: transparent;
  }
  .app.layout-top .top.tb-compact .gsearch input:focus {
    box-shadow: 0 10px 30px -12px rgba(0, 0, 0, 0.25);
  }
  .app.layout-top .top.tb-compact .gsearch input:not(:focus):hover {
    background: color-mix(in srgb, var(--text) 7%, transparent);
  }
  .app.layout-top .top.tb-compact .gsearch input:focus {
    width: 340px;
    cursor: text;
    padding-right: 10px;
  }
  .app.layout-top .top.tb-compact .gsearch input:focus::placeholder {
    color: var(--faint);
  }
  .app.layout-top .top.tb-compact .gsearch .gs-icon {
    z-index: 3;
    pointer-events: auto;
    cursor: pointer;
  }
  .app.layout-top .top.tb-compact .gsearch kbd {
    z-index: 3;
    pointer-events: none;
  }
  .app.layout-top .top.tb-compact .gsearch:focus-within kbd {
    display: none;
  }
  .app.layout-top .top.tb-compact .ai-fab.in-top {
    width: var(--tb-ctl);
    padding: 0;
  }
  .app.layout-top .top.tb-compact .ai-fab.in-top b {
    display: none;
  }

  /* Alles links: Werkzeuge in der Seitenleiste in einer Zeile */
  .app.layout-left .side .top .tb-tools {
    margin-left: auto;
  }
  .app.layout-left .side .top .tb-prof {
    margin-left: 2px;
    padding-left: 6px;
  }
}
@media (min-width: 1101px) {
  .app.layout-top .top.tb-compact .gsearch:focus-within .gs-icon {
    display: none;
  }
  .app.layout-top .top.tb-compact .gsearch input:focus {
    padding-left: 14px;
  }
  /* Alles links: fester Kopf der Seitenleiste – Firma + Profil, Suche, Werkzeugzeile (Zurück/Vor · NAVO AI · Hilfe);
     nur das Menü darunter scrollt, damit die Werkzeuge nie lose ohne Firma/Suche oben stehen */
  .app.layout-left .side {
    overflow: hidden;
    padding-bottom: 0;
  }
  .app.layout-left .side .nav {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    margin: 0 -12px;
    padding: 4px 12px 14px;
    align-content: start;
  }
  .app.layout-left .side .side-foot {
    display: none;
  }
  .app.layout-left .side .brand {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center !important;
    column-gap: 8px;
    row-gap: 6px !important;
    padding: 0 2px 12px 10px;
  }
  .app.layout-left .side .brand > :not(.tb-prof) {
    grid-column: 1;
    min-width: 0;
  }
  .app.layout-left .side .brand > .tb-prof {
    grid-column: 2;
    grid-row: 1 / span 2;
    margin: 0;
    padding: 0;
    border: 0;
    height: auto;
  }
  .app.layout-left .side .brand .brand-name {
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
  }
  .app.layout-left .side .top {
    padding: 0 0 12px;
    margin: 0 0 4px;
    gap: 4px;
    row-gap: 8px;
  }
  .app.layout-left .side .top .gsearch input {
    height: var(--tb-ctl);
    min-height: var(--tb-ctl);
    border-radius: 10px;
    background: color-mix(in srgb, var(--text) 5%, transparent);
    border-color: transparent;
  }
  .app.layout-left .side .top .gsearch input:focus {
    background: var(--panel);
    border-color: var(--accent);
  }
  .app.layout-left .side .top .navbtns {
    margin-right: 0;
    gap: 0;
  }
  .app.layout-left .side .top .navbtns .btn {
    width: 32px;
    padding: 0;
    justify-content: center;
    color: var(--muted);
  }
  .app.layout-left .side .top .tb-tools {
    flex: 1 1 auto;
    min-width: 0;
    margin-left: 0;
    gap: 4px;
  }
  .app.layout-left .side .top .tb-tools .ai-fab.in-top {
    order: 0;
    flex: 1 1 auto;
    min-width: 0;
    width: auto;
    height: 32px;
    margin: 0;
    padding: 0 10px;
    justify-content: center;
  }
  .app.layout-left .side .top .tb-tools .ai-fab.in-top b {
    display: inline;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .app.layout-left .side .top .tb-tools .tb-ic {
    width: 32px;
    height: 32px;
    margin-left: auto;
    flex: none;
  }
  .app.layout-left .side .top .tb-tools .ai-fab.in-top ~ .tb-ic {
    margin-left: 0;
  }
  .app.layout-left .side .top .gsearch[style*='hidden'] {
    display: none;
  } /* Stempeluhr/Steuerberater: keine Suche */
}

/* Kopfleiste immer über klebenden Inhaltselementen (z. B. Einsatzplanung „Mitarbeiter, die stempeln“ mit z-index 5) – sonst werden die Aufklappmenüs abgeschnitten */
@media (min-width: 1101px) {
  .app .main > .top,
  .app .top.tb-top {
    z-index: 30;
  }
}
/* klebende Inhaltskarten unter der Kopfleiste andocken statt dahinter zu verschwinden */
@media (min-width: 1101px) {
  .app .plan-staff {
    top: 57px;
  }
}
