/* KMU Eigenwerk 6.3.3 — scalable icon navigation.
   Desktop: compact icons + hover labels. Mobile: icon + text and grouped workflow. */
:root{--ew-nav-green:#17684a;--ew-nav-green-soft:#edf7f2;--ew-nav-text:#24332d;--ew-nav-muted:#66736d;--ew-nav-line:#dfe6e2;--ew-nav-shadow:0 12px 34px rgba(20,43,34,.13)}
.ew-icon,.ew-sub-icon{fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round;display:block}
.ew-icon{width:22px;height:22px}.ew-sub-icon{width:18px;height:18px;flex:0 0 18px}

/* Header tools become one visual family instead of mixed emoji controls. */
.primary-header-tools{display:flex!important;align-items:center!important;gap:6px!important;flex:0 0 auto!important}
.idea-lamp.ew-header-icon,.ew-voice-button.ew-header-icon,.ew-voice-info.ew-header-icon{width:42px!important;min-width:42px!important;height:42px!important;padding:0!important;margin:0!important;border:1px solid transparent!important;border-radius:12px!important;background:transparent!important;color:#24463a!important;box-shadow:none!important;display:inline-flex!important;align-items:center!important;justify-content:center!important;position:relative!important}
.idea-lamp.ew-header-icon:hover,.ew-voice-button.ew-header-icon:hover,.ew-voice-info.ew-header-icon:hover{background:#f2f7f4!important;border-color:#d9e5df!important;color:var(--ew-nav-green)!important;transform:none!important}
.idea-lamp.ew-header-icon b{right:-3px!important;top:-4px!important}
.ew-voice-tools-primary{width:auto!important;margin:0!important;gap:6px!important}

/* The whole desktop strip stays compact even as more modules arrive. */
#topnavWrap.topnav-wrap{min-width:0!important;gap:8px!important;align-items:center!important}
.ew-main-nav{display:flex!important;align-items:center!important;gap:4px!important;min-width:0!important;flex:0 0 auto!important;overflow:visible!important}
.ew-nav-item,.ew-settings-button{position:relative;box-sizing:border-box;width:44px;height:44px;min-width:44px;padding:0!important;margin:0!important;border:1px solid transparent!important;border-radius:12px!important;background:transparent!important;color:var(--ew-nav-text)!important;text-decoration:none!important;display:flex!important;align-items:center!important;justify-content:center!important;gap:8px!important;font:inherit!important;font-weight:700!important;line-height:1!important;cursor:pointer!important;transition:background .14s,border-color .14s,color .14s,box-shadow .14s!important}
.ew-nav-item:hover,.ew-settings-button:hover,.ew-nav-item:focus-visible,.ew-settings-button:focus-visible{background:#f4f8f6!important;border-color:#dce7e1!important;color:var(--ew-nav-green)!important;outline:none!important}
.ew-nav-item.active,.ew-nav-group.active>.ew-nav-item,.settings-menu.active>.ew-settings-button{background:var(--ew-nav-green-soft)!important;border-color:#c7ded3!important;color:var(--ew-nav-green)!important}
.ew-nav-label{display:none}

/* Fast custom tooltip; title remains as accessible/browser fallback. */
@media (min-width:821px){
  [data-nav-label]::after{content:attr(data-nav-label);position:absolute;z-index:1400;top:calc(100% + 8px);left:50%;transform:translateX(-50%) translateY(-3px);padding:6px 9px;border-radius:8px;background:#1e2b26;color:#fff;font-size:12px;font-weight:700;line-height:1;white-space:nowrap;pointer-events:none;opacity:0;visibility:hidden;transition:.12s;box-shadow:0 7px 20px rgba(0,0,0,.18)}
  [data-nav-label]:hover::after,[data-nav-label]:focus-visible::after{opacity:1;visibility:visible;transform:translateX(-50%) translateY(0)}
}

/* Auftrag is a workflow group: Offerte -> Auftrag -> Lieferschein -> Rechnung. */
.ew-nav-group{position:relative;margin:0;padding:0}
.ew-nav-group>summary{list-style:none}.ew-nav-group>summary::-webkit-details-marker{display:none}
.ew-nav-group .ew-chevron{display:none;color:currentColor;font-size:14px}
.ew-nav-submenu{display:none;position:absolute;z-index:1350;top:calc(100% + 8px);left:0;min-width:218px;padding:7px;background:#fff;border:1px solid var(--ew-nav-line);border-radius:14px;box-shadow:var(--ew-nav-shadow)}
.ew-nav-group[open]>.ew-nav-submenu,.ew-nav-group:hover>.ew-nav-submenu{display:block}
.ew-nav-submenu a{display:flex!important;align-items:center!important;gap:10px!important;padding:10px 11px!important;border-radius:9px!important;color:var(--ew-nav-text)!important;text-decoration:none!important;font-weight:650!important;white-space:nowrap!important}
.ew-nav-submenu a:hover,.ew-nav-submenu a.active{background:var(--ew-nav-green-soft)!important;color:var(--ew-nav-green)!important}

/* Search is an icon until it is used, then expands. */
.global-search-box.ew-search-box{margin:0!important;min-width:44px!important;flex:0 1 auto!important}
.ew-search-shell{height:44px;display:flex;align-items:center;box-sizing:border-box;position:relative;border:1px solid transparent;border-radius:12px;background:transparent;color:var(--ew-nav-text);transition:.16s;cursor:text}
.ew-search-shell>.ew-icon{position:absolute;left:10px;pointer-events:none;z-index:1}
.ew-search-shell input{box-sizing:border-box!important;width:44px!important;min-width:44px!important;height:42px!important;border:0!important;outline:0!important;background:transparent!important;padding:0 9px 0 38px!important;color:transparent!important;caret-color:var(--ew-nav-text)!important;font:inherit!important;transition:width .18s,color .12s!important;cursor:pointer!important}
.ew-search-shell:hover{background:#f4f8f6;border-color:#dce7e1;color:var(--ew-nav-green)}
.ew-search-shell:focus-within{background:#fff;border-color:#a8cbbb;color:var(--ew-nav-green);box-shadow:0 0 0 3px rgba(23,104,74,.08)}
.ew-search-shell:focus-within input,.ew-search-shell input:not(:placeholder-shown){width:min(240px,19vw)!important;color:var(--ew-nav-text)!important;cursor:text!important}

/* Mandant remains text because its selected value is important context, but gets a bounded width. */
#topnavWrap .tenant-switcher{margin:0!important;flex:0 1 230px!important;min-width:145px!important;max-width:230px!important}
#topnavWrap .tenant-switcher select{max-width:100%!important;height:44px!important;border-radius:12px!important;text-overflow:ellipsis!important}

/* Settings is never allowed to disappear behind overflow. */
.settings-menu{position:relative!important;flex:0 0 44px!important;min-width:44px!important;margin:0!important}
.ew-settings-button{appearance:none!important}
.settings-dropdown{max-height:min(72vh,650px);overflow-y:auto;overscroll-behavior:contain}
.ew-settings-section-label{padding:10px 12px 5px;color:#718078;font-size:10px;font-weight:800;letter-spacing:.08em;text-transform:uppercase;pointer-events:none}
.ew-settings-section-label:not(:first-child){margin-top:4px;border-top:1px solid #edf1ef}

/* Mid-sized desktops: preserve navigation before allowing context controls to consume width. */
@media (max-width:1180px) and (min-width:821px){
  #topnavWrap .tenant-switcher{flex-basis:175px!important;max-width:175px!important}
  .ew-search-shell:focus-within input,.ew-search-shell input:not(:placeholder-shown){width:180px!important}
  .brand-context{display:none!important}
  .product-brand img{width:125px!important}
}

/* Mobile drawer: labels return, workflow is visibly nested, settings stays a first-class item. */
@media (max-width:820px){
  .primary-header-tools{margin-left:auto!important;gap:3px!important}
  .idea-lamp.ew-header-icon,.ew-voice-button.ew-header-icon,.ew-voice-info.ew-header-icon{width:38px!important;min-width:38px!important;height:38px!important;border-radius:10px!important}
  .ew-voice-tools-primary{width:auto!important;margin:0!important;gap:3px!important}
  .ew-voice-tools-primary .ew-voice-button{flex:0 0 38px!important}
  .ew-voice-tools-primary .ew-voice-button:after{content:none!important}

  #topnavWrap.topnav-wrap.mobile-open{display:flex!important;flex-direction:column!important;align-items:stretch!important;gap:10px!important}
  .ew-main-nav{display:flex!important;flex-direction:column!important;align-items:stretch!important;gap:6px!important;width:100%!important;overflow:visible!important}
  .ew-nav-item,.ew-settings-button{width:100%!important;min-width:0!important;height:auto!important;min-height:48px!important;padding:11px 13px!important;justify-content:flex-start!important;border-color:#e1e6e3!important;background:#fff!important;border-radius:12px!important}
  .ew-nav-label{display:inline!important;line-height:1.2!important}
  .ew-nav-item.active,.ew-nav-group.active>.ew-nav-item,.settings-menu.active>.ew-settings-button{background:var(--ew-nav-green-soft)!important;border-color:#c7ded3!important}
  .ew-nav-group{width:100%!important}
  .ew-nav-group .ew-chevron{display:block;margin-left:auto;transition:transform .15s}
  .ew-nav-group[open] .ew-chevron{transform:rotate(180deg)}
  .ew-nav-submenu,.ew-nav-group:hover>.ew-nav-submenu{position:static!important;display:none!important;width:auto!important;min-width:0!important;margin:6px 0 0 18px!important;padding:5px!important;box-shadow:none!important;border-radius:12px!important;background:#f7f9f8!important;border:1px solid #e4e9e6!important}
  .ew-nav-group[open]>.ew-nav-submenu{display:block!important}
  .ew-nav-submenu a{min-height:42px!important;padding:9px 10px!important}

  #topnavWrap .tenant-switcher{order:2;flex:0 0 auto!important;max-width:none!important;width:100%!important}
  #topnavWrap .tenant-switcher select{width:100%!important;max-width:none!important;height:48px!important}
  .global-search-box.ew-search-box{order:3;width:100%!important;min-width:0!important}
  .ew-search-shell{width:100%!important;height:48px!important;border-color:#e1e6e3!important;background:#fff!important}
  .ew-search-shell input,.ew-search-shell:focus-within input,.ew-search-shell input:not(:placeholder-shown){width:100%!important;min-width:0!important;height:46px!important;color:var(--ew-nav-text)!important;cursor:text!important}
  .settings-menu{order:4;flex:0 0 auto!important;min-width:0!important;width:100%!important}
  .settings-menu .settings-dropdown.open{margin-top:6px!important}
  .ew-settings-section-label{padding-left:10px}
}
