body.command-palette-open {
  overflow: hidden;
}

.command-palette {
  background: transparent;
  border: 0;
  border-radius: 1.1rem;
  margin: auto;
  max-height: min(80vh, 44rem);
  max-width: min(40rem, 94vw);
  padding: 0;
  width: min(40rem, 94vw);
}

.command-palette::backdrop {
  background: rgba(4, 14, 30, .58);
  backdrop-filter: blur(3px);
}

.command-palette__surface {
  background: #fff;
  border: 1px solid var(--ictus-border, #d8dee6);
  border-radius: 1.1rem;
  box-shadow: 0 24px 60px rgba(4, 20, 44, .28);
  color: var(--ictus-graphite, #1c2430);
  display: flex;
  flex-direction: column;
  max-height: min(80vh, 44rem);
  overflow: hidden;
}

.command-palette__header {
  align-items: center;
  border-bottom: 1px solid var(--ictus-border, #d8dee6);
  display: flex;
  gap: .75rem;
  padding: .9rem 1rem;
}

.command-palette__search-icon {
  align-items: center;
  color: var(--ictus-blue, #002a5c);
  display: inline-flex;
  flex: 0 0 auto;
  font-size: 1.05rem;
}

.command-palette__input {
  background: transparent;
  border: 0;
  color: inherit;
  flex: 1 1 auto;
  font-size: 1.05rem;
  min-width: 0;
  outline: none;
  padding: .15rem 0;
}

.command-palette__input::placeholder {
  color: #8a99ab;
}

.command-palette__esc {
  background: transparent;
  border: 1px solid var(--ictus-border, #d8dee6);
  border-radius: .55rem;
  color: #6b7a8d;
  cursor: pointer;
  flex: 0 0 auto;
  line-height: 1;
  padding: .3rem .45rem;
}

.command-palette__esc:hover {
  border-color: var(--ictus-blue, #002a5c);
  color: var(--ictus-blue, #002a5c);
}

.command-palette__esc kbd,
.command-palette__footer kbd {
  font-size: .72rem;
}

.command-palette__body {
  flex: 1 1 auto;
  min-height: 3rem;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: .5rem;
}

.command-palette__empty {
  color: #6b7a8d;
  margin: 0;
  padding: 2.25rem 1rem;
  text-align: center;
}

.command-palette__list {
  display: flex;
  flex-direction: column;
  gap: .15rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.command-palette__option {
  align-items: center;
  border-radius: .7rem;
  cursor: pointer;
  display: flex;
  gap: .75rem;
  min-height: 3rem;
  padding: .55rem .7rem;
}

.command-palette__option.is-active {
  background: var(--ictus-cyan-mist, #e3f5fa);
  color: var(--ictus-blue, #002a5c);
}

.command-palette__option-icon {
  align-items: center;
  background: rgba(var(--ictus-blue-rgb, 0, 42, 92), .07);
  border-radius: .6rem;
  color: var(--ictus-blue, #002a5c);
  display: inline-flex;
  flex: 0 0 2.25rem;
  font-size: 1.05rem;
  height: 2.25rem;
  justify-content: center;
  width: 2.25rem;
}

.command-palette__option-text {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-width: 0;
}

.command-palette__option-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.command-palette__option-meta {
  color: #7c8a9c;
  font-size: .76rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.command-palette__match {
  color: var(--ictus-blue, #002a5c);
  font-weight: 700;
}

.command-palette__option-badge {
  border: 1px solid var(--ictus-border, #d8dee6);
  border-radius: 999px;
  color: #7c8a9c;
  flex: 0 0 auto;
  font-size: .62rem;
  font-weight: 700;
  letter-spacing: .04em;
  padding: .12rem .45rem;
}

.command-palette__option-enter {
  color: var(--ictus-blue, #002a5c);
  flex: 0 0 auto;
  font-size: .95rem;
  opacity: 0;
}

.command-palette__option.is-active .command-palette__option-enter {
  opacity: .6;
}

.command-palette__footer {
  align-items: center;
  border-top: 1px solid var(--ictus-border, #d8dee6);
  color: #7c8a9c;
  display: flex;
  flex-wrap: wrap;
  font-size: .74rem;
  gap: 1rem;
  padding: .6rem 1rem;
}

.command-palette__hint {
  align-items: center;
  display: inline-flex;
  gap: .3rem;
}

.command-palette__total {
  margin-left: auto;
}

.command-palette__footer kbd {
  background: rgba(var(--ictus-blue-rgb, 0, 42, 92), .07);
  border-radius: .3rem;
  color: inherit;
  padding: .1rem .35rem;
}

body.theme-dark .command-palette__surface {
  background: var(--ictus-dark-surface, #062548);
  border-color: var(--ictus-dark-border, rgba(216, 222, 230, .22));
  color: #e7eef8;
}

body.theme-dark .command-palette__header,
body.theme-dark .command-palette__footer {
  border-color: rgba(184, 197, 211, .18);
}

body.theme-dark .command-palette__input {
  color: #e7eef8;
}

body.theme-dark .command-palette__input::placeholder,
body.theme-dark .command-palette__option-meta,
body.theme-dark .command-palette__empty,
body.theme-dark .command-palette__footer {
  color: var(--ictus-dark-muted, #b9c5d3);
}

body.theme-dark .command-palette__option.is-active {
  background: var(--ictus-dark-surface-hover, #0a3158);
  color: #fff;
}

body.theme-dark .command-palette__option-icon,
body.theme-dark .command-palette__footer kbd {
  background: rgba(255, 255, 255, .08);
  color: #cfe0f5;
}

body.theme-dark .command-palette__match,
body.theme-dark .command-palette__option.is-active .command-palette__match {
  color: var(--ictus-cyan, #3cbddd);
}

body.theme-dark .command-palette__esc {
  border-color: rgba(184, 197, 211, .28);
  color: var(--ictus-dark-muted, #b9c5d3);
}

@media screen and (min-width: 1200px) {
  body.sidebar-collapsed .sidebar-search-control {
    display: none !important;
  }
}

@media (max-width: 576px) {
  .command-palette {
    max-height: 78vh;
    width: 92vw;
  }

  .command-palette__option-meta {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .command-palette__option,
  .command-palette__esc {
    transition: none;
  }
}
