.dafa-search-modal-host { display: contents; }

/* Mobile keeps the original header; rail-only labels are progressive enhancement. */
.dafa-rail-tool-label,
.dafa-rail-login-icon { display: none; }

@media (min-width: 1024px) {
  html[data-dafa-sidebar-tools] body { --dafa-header-height: 0px; }
  html[data-dafa-sidebar-tools] body .site-header {
    position: static;
    height: 0;
    min-height: 0;
    border: 0;
    padding: 0;
    background: transparent;
    box-shadow: none;
    transform: none;
  }
  html[data-dafa-sidebar-tools] .site-topbar { display: none; }
  html[data-dafa-sidebar-tools] .site-header .header-row { height: 0; min-height: 0; padding-block: 0; }
  html[data-dafa-sidebar-tools] .site-header .dafa-navigation-rail {
    top: var(--wp-admin--admin-bar--height, 0px);
    bottom: 0;
  }
  html[data-dafa-sidebar-tools] .dafa-navigation-rail > .header-search {
    order: 0;
    flex: 0 0 auto;
    width: auto;
    margin: 0 12px 12px;
  }
  html[data-dafa-sidebar-tools] .header-search__toggle {
    width: 100%;
    min-height: 44px;
    padding: 10px 12px;
    gap: 12px;
    border: 0;
    background: var(--dafa-surface-muted);
    color: var(--dafa-text-soft);
  }
  html[data-dafa-sidebar-tools] .header-search__toggle svg { flex: 0 0 20px; }
  html[data-dafa-sidebar-tools] #site-navigation { padding-bottom: 12px; }
  html[data-dafa-sidebar-tools] .dafa-navigation-rail > .header-actions {
    flex: 0 0 auto;
    flex-direction: column;
    align-items: stretch;
    width: auto;
    gap: 4px;
    margin: 0 12px;
    padding: 8px 0;
  }
  html[data-dafa-sidebar-tools] .header-auth-controls { flex-direction: column; align-items: stretch; gap: 4px; }
  html[data-dafa-sidebar-tools] .header-auth-controls > :is(.header-user, .header-notice) { display: block; }
  html[data-dafa-sidebar-tools] body .dafa-navigation-rail .header-actions > .header-ai,
  html[data-dafa-sidebar-tools] .header-auth-controls > .header-login-link,
  html[data-dafa-sidebar-tools] .header-auth-controls > .header-user > .header-user__toggle,
  html[data-dafa-sidebar-tools] .header-auth-controls > .header-notice > .header-notice__toggle {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    flex: 0 0 auto;
    width: 100%;
    height: 44px;
    min-height: 44px;
    padding: 10px 12px;
    gap: 12px;
    border: 0;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    color: var(--dafa-text);
    background: transparent;
  }
  html[data-dafa-sidebar-tools] .header-actions > .header-ai svg,
  html[data-dafa-sidebar-tools] .dafa-rail-login-icon,
  html[data-dafa-sidebar-tools] .header-notice__toggle > svg { display: block; flex: 0 0 20px; width: 20px; height: 20px; }
  html[data-dafa-sidebar-tools] .header-user__toggle .header-user__avatar { width: 20px; height: 20px; }
  html[data-dafa-sidebar-tools] .dafa-rail-tool-label { display: inline; }
  html[data-dafa-sidebar-tools] .header-user__crown { left: 25px; right: auto; top: 5px; }
  html[data-dafa-sidebar-tools] body .dafa-navigation-rail :is(.header-ai, .header-login-link, .header-user__toggle, .header-notice__toggle):hover {
    background: var(--dafa-surface-muted);
    color: var(--dafa-accent-strong);
  }
  html[data-dafa-sidebar-tools] .dafa-navigation-rail :is(button, a):focus-visible { outline: 2px solid var(--dafa-accent); outline-offset: -2px; }
  html[data-dafa-sidebar-tools] body .dafa-navigation-rail :is(.header-user__panel, .header-notice__panel) {
    position: fixed;
    top: auto !important;
    bottom: 12px;
    left: calc(var(--dafa-rail-width) + 8px) !important;
    right: auto !important;
    width: min(360px, calc(100vw - var(--dafa-rail-width) - 32px));
    max-height: calc(100dvh - var(--wp-admin--admin-bar--height, 0px) - 24px) !important;
  }
  html[data-dafa-sidebar-tools].dafa-nav-collapsed .header-search__toggle { justify-content: center; padding-inline: 0; }
  html[data-dafa-sidebar-tools].dafa-nav-collapsed .dafa-desktop-search-label,
  html[data-dafa-sidebar-tools].dafa-nav-collapsed .dafa-rail-tool-label { display: none; }
  html[data-dafa-sidebar-tools].dafa-nav-collapsed body .dafa-navigation-rail .header-actions > .header-ai,
  html[data-dafa-sidebar-tools].dafa-nav-collapsed .header-auth-controls > .header-login-link,
  html[data-dafa-sidebar-tools].dafa-nav-collapsed .header-auth-controls > .header-user > .header-user__toggle,
  html[data-dafa-sidebar-tools].dafa-nav-collapsed .header-auth-controls > .header-notice > .header-notice__toggle {
    justify-content: center;
    gap: 0;
    padding-inline: 0;
    font-size: 0;
  }
}
