/* H1: keep desktop controls available; compact mobile header with native menus. */
.header-brand { display: flex; align-items: center; gap: 10px; min-width: 0; margin-right: auto; }
.header-brand > img, .header-title { display: none; }
.header-language-menu, .header-action-menu { position: relative; }
.header-h1 .header-language-menu > summary, .header-h1 .header-action-menu > summary { display: none; }
.header-h1 .header-action-menu > .header-popover { display: flex; align-items: center; gap: 10px; }
.header-view-links { display: none; }
.header-h1 .template-picker > span { color: inherit; }
@media (max-width: 1023px) {
  #app-content .auth-toolbar.header-h1 { display: flex; align-items: center; flex-wrap: nowrap; gap: 4px; max-width: none; min-height: 64px; margin: 0 0 16px; padding: 10px 12px; border-radius: 12px; background: #163752; color: white; }
  .header-brand { gap: 8px; }
  .header-brand > img { display: block; width: 34px; height: 34px; }
  .header-identity { min-width: 0; }
  .header-title { display: block; font-size: 17px; line-height: 1.4; white-space: nowrap; }
  #app-content .header-h1 #authenticated-employee { display: block; color: #d6e5f2; margin: 0; max-width: 160px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 11px; }
  #app-content:has(#machine-list) > h1 { display: none; }
  #app-content .header-h1 .mobile-template-menu { display: none; }
  .header-h1 .header-language-menu > summary, .header-h1 .header-action-menu > summary { display: flex; align-items: center; justify-content: center; gap: 4px; min-width: 44px; min-height: 44px; border-radius: 8px; cursor: pointer; list-style: none; color: white; }
  .header-h1 summary::-webkit-details-marker { display: none; }
  .header-h1 .header-language-menu summary svg { width: 25px; height: 18px; border-radius: 2px; }
  .header-h1 .header-action-menu > summary { font-size: 28px; }
  .header-h1 summary:focus-visible { outline: 3px solid #8fc5ff; outline-offset: 2px; }
  .header-h1 .header-action-menu > .header-popover, .header-h1 .header-language-menu > .header-popover { display: none; }
  .header-h1 .header-action-menu[open] > .header-popover, .header-h1 .header-language-menu[open] > .header-popover { display: grid; }
  .header-h1 .header-popover { position: absolute; top: calc(100% + 8px); right: 0; z-index: 30; width: min(250px,calc(100vw - 32px)); max-height: 70dvh; overflow-y: auto; padding: 12px; gap: 8px; border: 1px solid #dfe6ef; border-radius: 12px; background: white; color: #243047; box-shadow: 0 12px 32px #16375226; }
  .header-h1 .header-language-menu .header-popover { width: 130px; }
  .header-h1 .header-popover .template-picker { display: grid; margin: 0; gap: 6px; }
  .header-h1 .header-popover .template-picker > span { display: block; color: #596579; }
  .header-h1 .header-popover .template-picker select { width: 100%; }
  .header-h1 .header-popover #admin-menu-link { color: #1677ff; }
  .header-h1 .header-popover #logout-button { width: 100%; text-align: left; }
  .header-h1 .header-view-links { display: grid; gap: 4px; padding-bottom: 8px; border-bottom: 1px solid #edf0f4; }
  .header-h1 .header-view-links button { text-align: left; }
  .header-h1 .language-switch { justify-content: center; }
  #app-content > header .admin-brand { display: none; }
  #app-content > header:has(.admin-brand) { padding: 0; background: transparent; }
  #app-content > header .auth-toolbar.header-h1 { margin: 0; flex-basis: auto; width: 100%; }
  #app-content > header .dashboard-return { color: #1677ff; border-color: #dfe6ef; margin: 8px 12px; }
}
@media (max-width: 1023px) { html[data-template] #app-content:has(#machine-list) > h1 { display: none; } }
.header-language-label { display: none; }
@media (max-width: 1023px) {
  .header-h1 .header-language-menu .header-popover { width: 180px; }
  .header-h1 .language-switch { display: grid; gap: 6px; }
  .header-h1 .language-switch button { display: flex; align-items: center; gap: 10px; width: 100%; font-size: 14px; }
  .header-h1 .language-switch .header-language-label { display: inline; color: #243047; font-size: 14px; }
}
@media (max-width: 1023px) { #app-content > header .header-h1 .header-popover #admin-menu-link:not([hidden]) { display: block; color: #1677ff; } }
