/* ============================================================
   ОБЩИЙ ПОИСК v509 (24.10.2026): кнопка в шапке и окно Ctrl K
   (классы ps-, top-search). Подключается до слоя стекла.
   ============================================================ */
.top-search {
  display: inline-flex; align-items: center; gap: 8px; height: 40px; min-width: 220px; padding: 0 8px 0 12px;
  border: 1px solid var(--line); border-radius: 999px; background: var(--surface-card); color: var(--muted);
  font: inherit; font-size: 14px; cursor: pointer; transition: border-color .12s, color .12s;
}
.top-search:hover { border-color: var(--accent); color: var(--text); }
.top-search svg { width: 17px; height: 17px; flex: none; }
.top-search span { flex: 1; text-align: left; }
.top-search kbd, .ps-bar kbd {
  font: 600 11px/1 inherit; padding: 4px 7px; border-radius: 7px; border: 1px solid var(--line);
  background: var(--surface-card-2, transparent); color: var(--muted);
}
@media (max-width: 900px) {
  .top-search { min-width: 0; width: 40px; padding: 0; justify-content: center; }
  .top-search span, .top-search kbd { display: none; }
}

dialog.ps-dialog {
  width: min(680px, calc(100% - 24px)); max-height: min(78vh, 720px); margin-top: 9vh; padding: 0;
  border-radius: 20px; overflow: hidden;
}
dialog.ps-dialog::backdrop { background: rgba(15, 23, 42, .35); }
.ps { display: flex; flex-direction: column; max-height: min(78vh, 720px); margin: 0; }
.ps-bar {
  display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line);
  color: var(--muted); margin: 0;
}
.ps-bar svg { width: 20px; height: 20px; flex: none; }
.ps-bar input {
  flex: 1; min-width: 0; border: 0; outline: none; background: transparent; box-shadow: none; padding: 4px 0;
  font: inherit; font-size: 17px; color: var(--text);
}
.ps-bar input::-webkit-search-cancel-button { display: none; }
.ps-results { flex: 1; overflow-y: auto; padding: 6px 8px 10px; overscroll-behavior: contain; }
.ps-group h3 {
  display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin: 10px 8px 4px;
  font-size: 12px; font-weight: 700; letter-spacing: .02em; text-transform: uppercase; color: var(--muted);
}
.ps-group h3 em { font-style: normal; font-weight: 500; text-transform: none; letter-spacing: 0; }
.ps-item {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 9px 10px; border: 0; border-radius: 12px;
  background: transparent; color: var(--text); text-align: left; font: inherit; cursor: pointer;
}
.ps-item.is-active { background: var(--surface-selected, rgba(127, 20, 56, .08)); }
.ps-ico {
  display: grid; place-items: center; width: 34px; height: 34px; flex: none; border-radius: 10px;
  background: var(--surface-card-2, rgba(127, 127, 127, .1)); color: var(--accent);
}
.ps-ico svg { width: 18px; height: 18px; }
.ps-text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.ps-text b, .ps-text small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ps-text b { font-weight: 600; font-size: 14.5px; }
.ps-text small { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.ps-text mark { background: rgba(240, 180, 40, .32); color: inherit; border-radius: 3px; padding: 0 1px; }
.ps-go { font-style: normal; color: var(--muted); }
.ps-hint { margin: 18px 12px; color: var(--muted); font-size: 14px; }
.ps-hint.is-error { color: var(--danger, #b02a3d); }
.ps-empty { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; padding: 18px 14px; }
.ps-empty p { margin: 0; font-size: 15px; }
.ps-empty button { display: inline-flex; align-items: center; gap: 8px; max-width: 100%; }
.ps-empty button svg { width: 17px; height: 17px; flex: none; }
.ps-empty small { color: var(--muted); }
.ps-foot {
  display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 0; padding: 9px 16px; border-top: 1px solid var(--line);
  color: var(--muted); font-size: 12px;
}
@media (max-width: 720px) {
  dialog.ps-dialog { margin-top: 12px; max-height: calc(100vh - 24px); }
  .ps { max-height: calc(100vh - 24px); }
  .ps-foot { display: none; }
}
.ps-info-text { white-space: pre-wrap; max-height: 60vh; overflow-y: auto; line-height: 1.5; margin: 6px 0 14px; }
[data-theme=dark] .ps-text mark { background: rgba(240, 190, 80, .28); }
[data-theme=dark] dialog.ps-dialog::backdrop { background: rgba(0, 0, 0, .5); }
