/*
 * Shared module header actions.
 *
 * Use .app-header-actions for the row and .app-header-action for normal compact
 * icon/number actions in a module header. Their geometry is identical across
 * modules. .module-area-selector is the deliberate narrow visual exception while
 * preserving a full touch target.
 */
:root{
  --app-header-action-size:40px;
  --app-header-action-radius:10px;
  --app-header-action-icon-size:24px;
  --app-header-action-number-size:20px;
  --app-header-action-gap:6px;
  --module-toolbar-primary-min-height:var(--app-header-action-size);
  --module-toolbar-primary-gap:8px;
  --module-toolbar-title-size:clamp(26px,4vw,34px);
  --module-toolbar-title-line-height:1.08;
  --module-toolbar-title-weight:700;
  --module-toolbar-title-letter-spacing:-1px;
  --module-toolbar-meta-gap:3px;
}

/* Repeated class raises specificity above legacy module selectors while those
 * older rules are gradually removed. The geometry below remains the source of truth. */
.app-header-actions.app-header-actions{
  display:flex;
  align-items:center;
  gap:var(--app-header-action-gap);
  flex:0 0 auto;
}

.app-header-action.app-header-action{
  width:var(--app-header-action-size);
  height:var(--app-header-action-size);
  min-width:var(--app-header-action-size);
  min-height:var(--app-header-action-size);
  flex:0 0 var(--app-header-action-size);
  display:grid;
  place-items:center;
  margin:0;
  padding:0;
  border-radius:var(--app-header-action-radius);
  box-sizing:border-box;
}

.app-header-action{
  border:1px solid var(--line);
  background:var(--theme-surface);
  color:var(--ink);
  cursor:pointer;
  line-height:1;
  text-decoration:none;
  -webkit-tap-highlight-color:transparent;
}

.app-header-action::-webkit-details-marker{display:none}

.app-header-action--number{
  font-size:var(--app-header-action-number-size);
  font-weight:800;
}

.app-header-action.app-header-action svg{
  width:var(--app-header-action-icon-size);
  height:var(--app-header-action-icon-size);
}

.app-header-action svg{
  fill:none;
  stroke:currentColor;
  stroke-width:1.8;
  stroke-linecap:round;
  stroke-linejoin:round;
}

.app-header-action.app-header-action--primary{
  border-color:var(--theme-accent);
  background:var(--theme-accent);
  color:var(--theme-text-on-accent);
}

.app-header-action:disabled,
.app-header-action[aria-disabled="true"]{
  cursor:default;
  opacity:.55;
}

.app-header-action:active{
  background:var(--theme-surface-soft);
  color:var(--ink);
}

.app-header-action.app-header-action--primary:active{
  border-color:var(--theme-accent-hover);
  background:var(--theme-accent-hover);
  color:var(--theme-text-on-accent);
}

@media(hover:hover) and (pointer:fine){
  .app-header-action:hover{
    background:var(--theme-surface-soft);
    color:var(--ink);
  }

  .app-header-action.app-header-action--primary:hover{
    border-color:var(--theme-accent-hover);
    background:var(--theme-accent-hover);
    color:var(--theme-text-on-accent);
  }
}

@media(max-width:380px){
  .app-header-actions.app-header-actions{gap:4px}
}

/* Erlebnisse keeps descriptive labels in the markup for accessibility/tooltips,
 * while the shared module header presents the compact icon action everywhere. */
.scout-tool-link.app-header-action>span{display:none}

/* Shared module header and area selector. */
.module-toolbar.module-toolbar{
  position:sticky;
  display:block;
  top:88px;
  z-index:45;
  min-width:0;
  margin:0 0 14px;
  padding:6px 0;
  background:var(--paper);
}

.module-toolbar-primary{
  display:grid;
  grid-template-columns:24px minmax(0,1fr) auto;
  align-items:center;
  gap:var(--module-toolbar-primary-gap);
  min-width:0;
  min-height:var(--module-toolbar-primary-min-height);
}
.module-toolbar-primary--without-area{grid-template-columns:minmax(0,1fr) auto}
.module-toolbar-primary--without-actions{grid-template-columns:24px minmax(0,1fr)}
.module-toolbar-primary--without-area.module-toolbar-primary--without-actions{grid-template-columns:minmax(0,1fr)}

.module-toolbar-area{
  position:relative;
  z-index:2;
  width:24px;
  min-width:24px;
  height:40px;
  display:grid;
  place-items:center;
}

.module-toolbar-title{
  min-width:0;
  overflow:hidden;
  align-self:stretch;
  display:flex;
  align-items:center;
}

.module-toolbar-title .module-toolbar-heading{
  min-width:0;
  max-width:100%;
  margin:0;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
  font-size:var(--module-toolbar-title-size);
  font-weight:var(--module-toolbar-title-weight);
  line-height:var(--module-toolbar-title-line-height);
  letter-spacing:var(--module-toolbar-title-letter-spacing);
}
.module-toolbar-title .module-toolbar-title-action{
  position:relative;display:inline-flex;align-items:center;gap:6px;width:auto;max-width:100%;
  min-height:0;margin:0;padding:0;border:0;border-radius:0;vertical-align:top;
  background:transparent;color:inherit;font:inherit;font-weight:inherit;line-height:inherit;text-align:left;
}
.module-toolbar-title .module-toolbar-title-action::before{
  content:"";position:absolute;top:50%;right:-4px;left:-4px;height:var(--app-header-action-size);
  transform:translateY(-50%);
}
.module-toolbar-title .module-toolbar-title-action:hover,
.module-toolbar-title .module-toolbar-title-action:active{background:transparent;color:inherit}
.module-toolbar-title-action .module-toolbar-title-text{
  min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;
  font-size:inherit;font-weight:inherit;line-height:inherit;letter-spacing:inherit;
}
.module-toolbar-title .module-toolbar-title-action .module-toolbar-title-icon{
  grid-area:auto;width:20px;height:20px;min-width:20px;min-height:20px;flex:0 0 20px;color:currentColor;
}

.module-toolbar-actions.app-header-actions{
  width:auto;
  min-width:0;
  min-height:var(--app-header-action-size);
  align-self:center;
  justify-content:flex-end;
  flex-wrap:nowrap;
}

.module-toolbar-meta{
  display:grid;
  gap:2px;
  min-width:0;
  margin-top:var(--module-toolbar-meta-gap);
  color:var(--muted);
  font-size:12px;
  line-height:1.35;
}

.module-toolbar-meta .module-toolbar-meta-line{
  grid-column:1;
  min-width:0;
  width:100%;
  margin:0;
  justify-self:stretch;
  overflow-wrap:anywhere;
  white-space:normal;
  text-align:left;
  font-size:inherit;
  line-height:inherit;
}

.module-toolbar-meta .module-toolbar-status{
  display:block;
  max-width:none;
  margin:0;
  padding:0;
  border:0;
  border-radius:0;
  background:transparent;
  color:var(--muted);
  font-size:12px;
  font-weight:500;
  line-height:1.35;
}

.module-toolbar-meta .module-toolbar-status[hidden]{
  display:none;
}

/* Subviews may use a compact back control in the same leading geometry as
 * the area selector. It is visually narrow while retaining a 40 x 40 px hit area. */
.module-toolbar-back{
  position:relative;
  width:22px;
  height:40px;
  min-width:22px;
  min-height:40px;
  display:grid;
  place-items:center;
  margin:0;
  padding:0;
  overflow:visible;
  border:0;
  border-radius:8px;
  background:transparent;
  color:var(--muted);
  text-decoration:none;
  box-shadow:none;
  touch-action:manipulation;
}
.module-toolbar-back::before{
  content:"";
  position:absolute;
  top:50%;
  left:50%;
  width:40px;
  height:40px;
  border-radius:10px;
  transform:translate(-50%,-50%);
}
.module-toolbar-back svg{
  position:relative;
  z-index:1;
  width:18px;
  height:18px;
  fill:none;
  stroke:currentColor;
  stroke-width:1.8;
  stroke-linecap:round;
  stroke-linejoin:round;
  pointer-events:none;
}
.module-toolbar-back:hover,
.module-toolbar-back:active{
  background:transparent;
  color:var(--ink);
}
.module-toolbar-back:focus-visible{
  outline:3px solid var(--theme-focus,#b97612);
  outline-offset:4px;
}

.module-area-selector.module-area-selector{
  position:relative;
  width:22px;
  height:40px;
  min-width:22px;
  min-height:40px;
  flex:0 0 22px;
  display:grid;
  place-items:center;
  margin:0;
  padding:0;
  overflow:visible;
  list-style:none;
  border:0!important;
  border-radius:8px;
  background:transparent!important;
  color:var(--muted)!important;
  box-shadow:none!important;
}

.module-area-selector.module-area-selector::before{
  content:"";
  position:absolute;
  top:50%;
  left:50%;
  width:40px;
  height:40px;
  border-radius:10px;
  transform:translate(-50%,-50%);
}

.module-area-selector::-webkit-details-marker{display:none}

.module-area-selector-icon{
  position:relative;
  z-index:1;
  width:14px!important;
  height:18px!important;
  fill:none;
  stroke:currentColor;
  stroke-width:1.35!important;
  stroke-linecap:round;
  stroke-linejoin:round;
  pointer-events:none;
}

.module-area-selector.module-area-selector:hover,
.module-area-selector.module-area-selector:active,
.module-area-selector.module-area-selector:focus,
.module-area-details[open]>.module-area-selector.module-area-selector,
.module-area-selector.module-area-selector.is-active,
.module-area-selector.module-area-selector.is-filtered{
  border-color:transparent!important;
  background:transparent!important;
  color:var(--muted)!important;
  box-shadow:none!important;
}

.module-area-selector.module-area-selector:focus-visible{
  outline:3px solid var(--theme-focus,#b97612);
  outline-offset:4px;
}

.module-area-details{
  position:relative;
  margin:0;
}

.module-area-menu{
  position:absolute;
  z-index:80;
  top:calc(100% + 6px);
  right:auto;
  left:0;
  width:min(320px,calc(100vw - 16px));
  max-width:calc(100vw - 16px);
  min-width:min(280px,calc(100vw - 16px));
  max-height:min(70vh,440px);
  margin:0;
  padding:6px;
  overflow:hidden;
  border:1px solid var(--line);
  border-radius:12px;
  background:var(--theme-surface);
  color:var(--ink);
  box-shadow:0 12px 30px rgba(23,59,52,.12);
  box-sizing:border-box;
  font-size:16px;
  line-height:1.35;
}

.module-area-menu-scroll{
  display:grid;
  gap:2px;
  min-width:0;
  max-height:min(55vh,360px);
  overflow-x:hidden;
  overflow-y:auto;
  overscroll-behavior:contain;
  scrollbar-gutter:stable;
}

.module-area-option{
  display:flex;
  align-items:center;
  gap:10px;
  width:100%;
  min-width:0;
  min-height:48px;
  margin:0;
  padding:11px 12px;
  border:0;
  border-radius:9px;
  background:transparent;
  color:var(--ink);
  font:inherit;
  font-weight:600;
  line-height:1.35;
  text-align:left;
  text-decoration:none;
  overflow-wrap:anywhere;
  box-sizing:border-box;
  cursor:pointer;
}

.module-area-option:hover,
.module-area-option:focus-visible{
  background:var(--theme-surface-soft);
  color:var(--ink);
}

.module-area-option[aria-current="page"],
.module-area-option.is-active,
.module-area-option.is-selected,
.module-area-option:has(.module-area-checkbox:checked){
  background:var(--theme-selected);
  color:var(--theme-selected-text);
  font-weight:750;
}

.module-area-option--check{
  position:relative;
  display:grid;
  grid-template-columns:24px minmax(0,1fr);
  align-items:center;
}

.module-area-checkbox{
  position:absolute!important;
  width:1px!important;
  height:1px!important;
  min-height:0!important;
  margin:0!important;
  padding:0!important;
  opacity:0;
  pointer-events:none;
}

.module-area-check-control{
  display:inline-grid;
  place-items:center;
  width:22px;
  height:22px;
  border:1.5px solid var(--theme-control-border);
  border-radius:7px;
  background:var(--theme-surface);
  color:var(--theme-selected-text);
  box-sizing:border-box;
}

.module-area-check-control svg{
  width:15px!important;
  height:15px!important;
  fill:none;
  stroke:currentColor;
  stroke-width:2.2!important;
  stroke-linecap:round;
  stroke-linejoin:round;
  opacity:0;
}

.module-area-checkbox:checked+.module-area-check-control{
  border-color:var(--theme-selected-border);
  background:var(--theme-selected);
}

.module-area-checkbox:checked+.module-area-check-control svg{
  opacity:1;
}

.module-area-option:has(.module-area-checkbox:focus-visible){
  outline:3px solid var(--theme-focus,#b97612);
  outline-offset:-2px;
}

.module-area-option-label{
  min-width:0;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}

.module-area-menu-footer{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:8px;
  min-width:0;
  margin-top:6px;
  padding:6px 2px 0;
  border-top:1px solid var(--line);
}

.module-area-menu-footer .module-area-option{
  flex:1 1 auto;
  min-height:44px;
}

.module-area-menu-footer button{
  flex:0 0 auto;
  min-height:44px;
  margin:0;
  padding:8px 12px;
}

.module-area-manage{
  margin:0;
  border-radius:9px;
}

.module-area-form{
  display:grid;
  gap:2px;
  min-width:0;
  margin:0;
}

.module-toolbar-actions>.scout-filters{
  position:relative;
  margin:0;
  border:0;
  background:transparent;
}

.module-toolbar-actions>.scout-filters>.scout-filter-summary.app-header-action{
  position:relative;
  width:var(--app-header-action-size);
  height:var(--app-header-action-size);
  min-width:var(--app-header-action-size);
  min-height:var(--app-header-action-size);
  display:grid;
  place-items:center;
  margin:0;
  padding:0;
  border:1px solid var(--line);
  border-radius:var(--app-header-action-radius);
  background:var(--theme-surface);
}

.module-toolbar-actions>.scout-filters[open]>.scout-filter-summary.app-header-action{
  background:var(--theme-surface-soft);
}

.module-toolbar-actions>.scout-filters .scout-filter-label{
  display:grid;
  place-items:center;
}

.module-toolbar-actions>.scout-filters .app-filter-icon{
  width:20px;
  height:20px;
}

.module-toolbar-actions>.scout-filters .app-filter-text,
.module-toolbar-actions>.scout-filters .app-filter-chevron,
.module-toolbar-actions>.scout-filters .app-filter-count-word{
  display:none;
}

.module-toolbar-actions>.scout-filters .app-filter-count{
  position:absolute;
  top:-5px;
  right:-5px;
  display:grid;
  place-items:center;
  min-width:18px;
  height:18px;
  margin:0;
  padding:0 4px;
  border:2px solid var(--paper);
  border-radius:999px;
  background:var(--green);
  color:#fff;
  font-size:9px;
  font-weight:850;
  line-height:1;
}

.module-toolbar-actions>.scout-filters>.app-filter-popover{
  position:absolute;
  z-index:70;
  top:calc(100% + 6px);
  right:0;
  left:auto;
  width:min(340px,calc(100vw - 16px));
  max-width:calc(100vw - 16px);
  min-width:0;
  margin:0;
  padding:12px;
  display:grid;
  grid-template-columns:minmax(0,1fr);
  gap:10px;
  border:1px solid var(--line);
  border-radius:12px;
  background:var(--theme-surface);
  box-shadow:0 12px 30px rgba(23,59,52,.12);
}

.module-toolbar-actions>.scout-filters>.app-filter-popover>div{
  min-width:0;
}

.module-toolbar-actions>.scout-filters>.app-filter-popover input,
.module-toolbar-actions>.scout-filters>.app-filter-popover select,
.module-toolbar-actions>.scout-filters>.app-filter-popover button{
  width:100%;
  min-width:0;
  max-width:100%;
}

.messages-context-row{
  justify-content:flex-start;
}

@media(max-width:700px){
  .module-toolbar.module-toolbar{
    --module-toolbar-primary-gap:6px;
    --module-toolbar-title-size:clamp(24px,8vw,30px);
    top:0;
    padding:4px 0;
  }

  body[data-authenticated-app][data-topbar-pinned] .module-toolbar.module-toolbar{
    top:72px;
  }

  .module-area-menu{
    min-width:0;
  }
}

@media(max-width:600px){
  .module-toolbar.module-toolbar{
    margin-top:calc(0px - var(--mobile-content-top-gap));
  }
}

@media(max-width:380px){
  .module-toolbar.module-toolbar{--module-toolbar-primary-gap:4px}
  .module-toolbar-actions.app-header-actions{gap:4px}
}

