/* Phone/tablet overrides only. Desktop rules remain owned by each page. */
@media (max-width:768px) {
  body .site-header .header-shell { column-gap:8px; }
  body .site-header .header-shell .brand { flex:none; }
  body .site-header .header-shell .header-actions { flex:1 1 0; min-width:0; gap:5px; justify-content:flex-end; }
  body .site-header .header-actions .language { width:34px; min-width:34px; flex:0 0 34px; padding:6px; justify-content:center; }
  body .site-header .header-actions .language-code { display:none; }
  body .site-header .header-actions .nav-account { max-width:94px; min-width:0; }
  body .site-header .header-actions :is(.global-search-trigger,.checkin-trigger) { flex:none; }
  body .site-header nav { scroll-padding-inline:8px; }

  body main :is(.portal-heading,.portal-actions,.portal-toolbar) { min-width:0; max-width:100%; }
  body main :is(.portal-heading,.portal-actions) { flex-wrap:wrap; }
  body main .portal-heading>div { min-width:0; }
  body main :is(h1,h2,h3,.portal-prose) { overflow-wrap:anywhere; }
  body main :is(input,select,textarea) { max-width:100%; }
  body .plugin-directory-sidebar { border:1px solid var(--line); border-radius:10px; gap:12px; }
  body .plugin-directory-sidebar .plugin-directory-navigation { grid-template-columns:repeat(3,minmax(0,1fr)); gap:8px; }
  body .plugin-directory-sidebar .plugin-directory-navigation>:is(a,button,span) { padding:8px 4px; min-height:40px; }
  body .plugin-directory-sidebar .plugin-directory-description { padding-top:12px; }
  body .plugin-directory-sidebar .portal-toolbar { grid-template-columns:repeat(2,minmax(0,1fr)); }
  body .plugin-directory-sidebar .portal-toolbar>.portal-field:has(input[type=search]) { grid-column:1/-1; }
  body .portal-notice .plugin-handoff-actions { flex-wrap:wrap; }
  body .portal-notice .plugin-handoff-actions>button { flex-basis:140px; }

  body>main.help-layout { padding-inline:16px; grid-template-columns:minmax(0,1fr); }
  body .help-layout .help-content { width:100%; min-width:0; max-width:100%; }
  body .help-layout :is(.help-sidebar,.help-chapter,.help-table-wrap,.help-figure) { min-width:0; max-width:100%; }
  body .help-layout .help-sidebar { border:1px solid var(--line); border-radius:10px; padding:16px; }
  body .help-layout .help-toc { max-height:160px; }
  body .help-layout .help-quicklinks { grid-template-columns:repeat(2,minmax(0,1fr)); }
  body .help-layout .help-overview { gap:10px 16px; }
  body .help-layout .help-table-wrap { overflow-x:auto; overscroll-behavior-x:contain; }
  body .home-promo-stage { clip-path:inset(-20px 0 -80px); }

  body dialog { max-width:calc(100vw - 24px); max-height:calc(100dvh - 24px); }
  body dialog :is(.hh-frame-heading,.hh-frame-footer,.portal-actions) { min-width:0; }
  body dialog .hh-frame-heading h2 { min-width:0; overflow-wrap:anywhere; }
  body dialog .hh-frame-body { min-width:0; overflow:auto; overscroll-behavior:contain; }
  body dialog .hh-frame-footer { flex-wrap:wrap; gap:8px; padding-bottom:max(12px,env(safe-area-inset-bottom)); }
  body dialog :is(input,textarea,select) { max-width:100%; }
  body .site-footer { gap:16px; padding-bottom:max(20px,env(safe-area-inset-bottom)); }
}
@media (max-width:360px) {
  body .site-header .header-shell .brand>span:last-child { display:none; }
  body .site-header .header-actions .nav-account { max-width:88px; }
  body .help-layout .help-quicklinks { grid-template-columns:minmax(0,1fr); }
}

/* Keep the phone layout dense enough to reach content without changing desktop. */
@media (max-width:768px) {
  body .portal-main { padding-block:20px 36px; }
  body .portal-heading { gap:12px; margin-bottom:18px; }
  body .account-workspace-toolbar { margin-bottom:10px; }
  body .portal-card { padding:16px; }
  body .plugin-directory-sidebar { gap:10px; padding:12px 14px; }
  body .plugin-directory-sidebar>.portal-heading { margin:0; }
  body .plugin-directory-sidebar>.portal-heading h1 { margin:0; }
  body .plugin-directory-sidebar>.portal-heading .eyebrow,
  body .plugin-directory-navigation>.plugin-directory-group-title { display:none; }
  body .plugin-directory-sidebar .plugin-directory-filters { padding-top:8px; }
  body .plugin-directory-sidebar .plugin-directory-description { padding-top:8px; font-size:11px; }
  body .plugin-directory-display>legend { margin-bottom:5px; }
  body .plugin-directory-sidebar .portal-toolbar { gap:10px 8px; }
  body .plugin-directory-sidebar .portal-toolbar>.portal-field:has(input[type=search],.hh-search-field) { grid-column:1/-1; }

  body .productivity-overview>.productivity-actions { width:100%; }
  body .productivity-overview>.productivity-actions>button { flex:1; }
  body :is(.plugin-detail-page,.request-detail-page) .plugin-detail-navigation { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px; }
  body :is(.plugin-detail-page,.request-detail-page) .plugin-detail-navigation>:is(a,button) { width:100%; min-width:0; max-width:none; justify-content:center; text-align:center; }
  body :is(.plugin-detail-page,.request-detail-page) .plugin-detail-navigation>:only-child { grid-column:1/-1; }

  /* Native mobile selects avoid multi-line selected values in base-select. */
  body:not(.native-controls):not(.unstyled-controls) :is(main,dialog,.auth-card,.login-card) select:not([multiple]):not([size]) { appearance:none; white-space:nowrap; text-overflow:ellipsis; }
  body:not(.native-controls):not(.unstyled-controls) :is(main,dialog,.auth-card,.login-card) :is(input:not([type=checkbox],[type=radio],[type=range],[type=hidden],[type=submit],[type=button]),textarea) { font-size:16px; }
  body:not(.native-controls):not(.unstyled-controls) :is(main,dialog) input:is([type=date],[type=datetime-local],[type=month]) { appearance:none; min-width:0; width:100%; min-height:40px; color-scheme:dark; }
  body :is(main,dialog) input::-webkit-date-and-time-value { text-align:left; }
  body :is(main,dialog) input::-webkit-datetime-edit { padding:0; }


  body dialog .hh-frame-footer>.portal-actions,
  body dialog .hh-frame-footer>.productivity-actions { width:100%; gap:8px; }
  body dialog .hh-frame-footer>button,
  body dialog .hh-frame-footer>:is(.portal-actions,.productivity-actions)>button { flex:1 1 0; min-width:0; white-space:normal; }
  body .help-layout .help-sidebar { padding:12px; }
  body .help-layout .help-toc { max-height:120px; }
  body .help-layout .help-chapter { scroll-margin-top:calc(var(--site-header-height,106px) + 12px); }
  body .portal-table-wrap { max-width:100%; overflow-x:auto; overscroll-behavior-x:contain; }
}
