/* Quick search (4.8.0): a dialog at the top of the window, one field, results grouped by kind. */
html:root .command-palette {
  width: min(640px, calc(100vw - 32px));
  max-height: min(560px, calc(100vh - 120px));
  margin: 12vh auto auto;
  padding: 0;
  display: none;
  flex-direction: column;
  border: 1px solid var(--scs-line-strong);
  border-radius: var(--scs-radius-m);
  background: var(--scs-surface);
  color: var(--scs-ink);
  box-shadow: var(--scs-shadow-pop);
  overflow: hidden;
}
html:root .command-palette[open] {
  display: flex;
}
html:root .command-palette::backdrop {
  background: var(--scs-overlay);
}
.command-palette .command-search {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--scs-line);
  color: var(--scs-ink-3);
}
.command-palette .command-search input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: none;
  color: var(--scs-ink);
  font: var(--scs-text-l) / 1.4 var(--scs-font);
  padding: 4px 0;
}
html:root .command-palette .command-search input,
html:root .command-palette .command-search input:focus-visible {
  border: 0;
  outline: 0;
  box-shadow: none;
  background: none;
  height: auto;
}
.command-palette .command-search input::-webkit-search-cancel-button {
  display: none;
}
.command-palette kbd,
.command-palette-open kbd {
  font: var(--scs-text-xs) / 1.6 var(--scs-font-mono);
  color: var(--scs-ink-3);
  border: 1px solid var(--scs-line);
  border-radius: var(--scs-radius-s);
  padding: 0 5px;
  background: var(--scs-surface-2);
  white-space: nowrap;
}
.command-palette ul {
  list-style: none;
  margin: 0;
  padding: 6px;
  overflow-y: auto;
  flex: 1;
}
.command-palette .command-group {
  padding: 8px 8px 4px;
  font: 600 var(--scs-text-xs) / 1.4 var(--scs-font);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--scs-ink-3);
}
.command-palette [role='option'] {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  border-radius: var(--scs-radius-s);
  cursor: pointer;
}
.command-palette [role='option'][aria-selected='true'] {
  background: var(--scs-accent-soft);
  box-shadow: inset 2px 0 0 var(--scs-accent);
}
.command-palette .command-icon {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  flex: none;
  border: 1px solid var(--scs-line);
  border-radius: var(--scs-radius-s);
  background: var(--scs-surface-2);
  color: var(--scs-ink-2);
}
.command-palette .command-icon svg {
  width: 16px;
  height: 16px;
}
.command-palette .command-text {
  display: grid;
  min-width: 0;
  flex: 1;
}
.command-palette .command-text strong,
.command-palette .command-text small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.command-palette .command-text strong {
  font-weight: 500;
}
.command-palette .command-text small {
  color: var(--scs-ink-3);
  font-size: var(--scs-text-xs);
}
.command-palette .command-count {
  flex: none;
  min-width: 22px;
  padding: 1px 7px;
  border: 1px solid var(--scs-line-2);
  border-radius: 999px;
  background: var(--scs-surface-2);
  color: var(--scs-ink-2);
  font-size: var(--scs-text-xs);
  font-variant-numeric: tabular-nums;
  text-align: center;
}
.command-palette .command-full {
  margin-top: 4px;
  border-top: 1px solid var(--scs-line-2);
  border-radius: 0;
  color: var(--scs-ink-2);
}
.command-palette .command-empty {
  margin: 0;
  padding: 4px 16px 10px;
  color: var(--scs-ink-3);
}
.command-palette footer {
  padding: 6px 14px;
  border-top: 1px solid var(--scs-line);
  font-size: var(--scs-text-xs);
  color: var(--scs-ink-3);
  background: var(--scs-surface-2);
}
html:root .command-palette-open {
  gap: 6px;
}
html:root .command-palette-open kbd {
  margin-left: 4px;
}

/* Counts that open their list (4.8.0): a figure reads like a link and keeps the table's rhythm. */
html:root button.count-link {
  min-height: 0;
  height: auto;
  padding: 0 2px;
  border: 0;
  background: none;
  /* Link colour of the theme; accent-ink is the text on filled accent buttons (white). */
  color: var(--scs-accent-hover);
  font: inherit;
  font-variant-numeric: tabular-nums;
  text-decoration: underline;
  text-decoration-color: var(--scs-accent-line);
  text-underline-offset: 3px;
  cursor: pointer;
}
html:root button.count-link:hover {
  text-decoration-color: currentColor;
  background: none;
}
html:root button.count-link strong {
  font-weight: inherit;
}

/* The quick search is the one search field of the top bar (4.12.1). */
html:root #model-search-view[hidden] {
  display: none;
}
