/* Scope stays visible; the existing count/controls share their original toolbar row. */
.dafa-scoped-search-summary { display:flex; flex:1 1 160px; min-width:0; align-items:center; gap:8px; }
body .has-scoped-search .dafa-scoped-search-summary > .classification-status { flex:1 1 auto; min-width:0; min-height:0; line-height:1.4; white-space:normal; }
.dafa-scoped-search-controls { display:inline-flex; flex:0 0 auto; align-items:center; max-width:160px; }
body .dafa-scoped-search-trigger, body .dafa-scoped-search-clear {
  display:inline-flex; align-items:center; justify-content:center; gap:6px; min-height:var(--toolbar-control, 40px);
  padding:6px 8px; border:0; border-radius:6px; background:transparent; color:var(--dafa-text); font:inherit; font-size:13px; cursor:pointer;
}
body .dafa-scoped-search-trigger { min-width:0; }
.dafa-scoped-search-label { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.dafa-scoped-search-label--short { display:none; }
.dafa-scoped-search-icon { flex:0 0 16px; width:16px; height:16px; }
body .dafa-scoped-search-clear { flex:0 0 28px; width:28px; padding-inline:4px; }
.dafa-scoped-search-clear svg { width:16px; height:16px; }
.dafa-scoped-search-clear[hidden] { display:none; }
.dafa-scoped-search-controls.has-keyword { border-radius:6px; background:var(--dafa-accent-soft); }
body .dafa-scoped-search-controls.has-keyword button { color:var(--dafa-accent-strong); }
body :is(.dafa-scoped-search-trigger, .dafa-scoped-search-clear):hover { background:var(--dafa-bg); }
body :is(.dafa-scoped-search-trigger, .dafa-scoped-search-clear):focus-visible { outline:2px solid var(--dafa-accent); outline-offset:2px; }
body .archive-search.dafa-scoped-search-panel {
  display:none; position:fixed; inset:auto; z-index:90; box-sizing:border-box; width:min(380px, calc(100vw - 24px));
  max-width:none; margin:0; padding:18px; border:0; border-radius:10px; overflow:auto; overscroll-behavior:contain;
  background:var(--dafa-surface); color:var(--dafa-text); box-shadow:0 8px 32px color-mix(in srgb, var(--dafa-text) 18%, transparent);
}
body .archive-search.dafa-scoped-search-panel:popover-open { display:block; }
body .archive-search.dafa-scoped-search-panel.is-open { display:block; }
.dafa-scoped-search-heading { display:flex; align-items:center; justify-content:space-between; gap:12px; }
.dafa-scoped-search-heading strong { font-size:16px; line-height:1.5; }
body .dafa-scoped-search-dismiss { min-height:36px; padding:4px 6px; border:0; background:transparent; color:var(--dafa-text-soft); font:inherit; font-size:12px; cursor:pointer; }
.dafa-scoped-search-hint { margin:4px 0 14px; color:var(--dafa-text-soft); font-size:12px; line-height:1.6; }
body .dafa-scoped-search-panel .archive-hero__search { display:grid; grid-template-columns:minmax(0,1fr) auto; width:100%; max-width:none; margin:0; gap:8px; border:0; padding:0; background:transparent; }
body .dafa-scoped-search-panel .archive-hero__search label { min-width:0; }
body .dafa-scoped-search-panel input[type=search] { width:100%; min-height:44px; padding:10px 12px; border:1px solid var(--dafa-border); border-radius:6px; background:var(--dafa-bg); color:var(--dafa-text); font:inherit; font-size:14px; }
body .dafa-scoped-search-panel .archive-hero__search-submit { position:static; width:auto; min-width:64px; min-height:44px; padding:8px 12px; border:0; border-radius:6px; background:var(--dafa-accent); color:var(--dafa-on-accent); font:inherit; font-size:14px; cursor:pointer; }
body .dafa-scoped-search-panel .archive-hero__search-submit:is(:hover,:focus-visible) { background:var(--dafa-accent-strong); color:var(--dafa-on-accent); }
.dafa-scoped-search-panel :is(input,button):focus-visible { outline:2px solid var(--dafa-accent); outline-offset:2px; }
body .classification-selected.dafa-search-only, body [data-scoped-keyword-chip] { display:none !important; }
@container (max-width:699px) {
  body .has-scoped-search .dafa-scoped-search-summary { grid-area:status; min-width:0; min-height:44px; gap:4px; }
  body .has-scoped-search .dafa-scoped-search-summary > .classification-status { font-size:12px; line-height:14px; }
  .has-scoped-search .dafa-scoped-search-controls { width:68px; max-width:68px; }
  body .has-scoped-search .dafa-scoped-search-trigger { flex:1 1 auto; gap:3px; min-height:44px; padding-inline:3px; font-size:12px; }
  .has-scoped-search .dafa-scoped-search-label { display:none; }
  .has-scoped-search .dafa-scoped-search-label--short { display:inline; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
  .has-scoped-search .has-keyword .dafa-scoped-search-icon { display:none; }
  body .has-scoped-search .dafa-scoped-search-clear { min-height:44px; }
}
@media (max-width:640px) {
  body .news-filter-form:not([data-news-unified]) > .news-filter-controls.has-scoped-search { display:grid; grid-template-columns:68px minmax(0,1fr) minmax(0,.7fr) 36px; align-items:center; gap:4px; }
  .news-filter-form:not([data-news-unified]) .dafa-scoped-search-controls { width:68px; max-width:68px; }
  body .news-filter-form:not([data-news-unified]) .dafa-scoped-search-trigger { flex:1 1 auto; min-height:44px; padding-inline:3px; gap:3px; font-size:12px; }
  .news-filter-form:not([data-news-unified]) .dafa-scoped-search-label { display:none; }
  .news-filter-form:not([data-news-unified]) .dafa-scoped-search-label--short { display:inline; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
  .news-filter-form:not([data-news-unified]) .has-keyword .dafa-scoped-search-icon { display:none; }
  body .news-filter-form:not([data-news-unified]) .has-scoped-search .news-filter-select__toggle { width:100%; min-height:44px; padding-inline:6px; gap:4px; font-size:12px; }
  .news-filter-form:not([data-news-unified]) .has-scoped-search .news-filter-select__label { display:none; }
  body .news-filter-form:not([data-news-unified]) .has-scoped-search > .archive-view-toolbar { width:36px; min-width:0; padding:0; margin:0; }
}
