.kl-command {
    position: fixed;
    inset: 0;
    z-index: 1200;
    display: grid;
    place-items: start center;
    padding: min(14vh, 136px) 24px 24px;
    visibility: hidden;
    pointer-events: none;
    transition: visibility 0s linear 220ms;
}

.kl-command.is-open {
    visibility: visible;
    pointer-events: auto;
    transition-delay: 0s;
}

.kl-command__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0);
    backdrop-filter: blur(0);
    transition: background-color 180ms ease, backdrop-filter 180ms ease;
}

.kl-command.is-open .kl-command__backdrop {
    background: rgba(15, 23, 42, 0.32);
    backdrop-filter: blur(5px);
}

.dark .kl-command.is-open .kl-command__backdrop {
    background: rgba(0, 0, 0, 0.58);
}

.kl-command__dialog {
    position: relative;
    width: min(680px, 100%);
    overflow: hidden;
    border: 1px solid rgba(226, 232, 240, 0.9);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.94);
    box-shadow: 0 24px 64px rgba(15, 23, 42, 0.18);
    backdrop-filter: blur(18px) saturate(120%);
    opacity: 0;
    transform: translateY(-10px) scale(0.985);
    transition: opacity 170ms ease, transform 210ms cubic-bezier(.2, .8, .2, 1);
}

.kl-command.is-open .kl-command__dialog {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.dark .kl-command__dialog {
    border-color: rgba(63, 63, 70, 0.9);
    background: rgba(24, 24, 27, 0.94);
    box-shadow: 0 24px 72px rgba(0, 0, 0, 0.56);
}

.kl-command__search-row {
    display: flex;
    min-height: 56px;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid #e2e8f0;
    padding: 0 16px;
}

.dark .kl-command__search-row { border-bottom-color: #27272a; }

.kl-command__search-icon {
    width: 20px;
    height: 20px;
    flex: none;
    color: #64748b;
}

.dark .kl-command__search-icon { color: #71717a; }

.kl-command__input {
    min-width: 0;
    flex: 1;
    border: 0;
    outline: 0;
    background: transparent;
    color: #0f172a;
    font-size: 14px;
    font-weight: 400;
}

.kl-command__input::placeholder { color: #94a3b8; }
.dark .kl-command__input { color: #f4f4f5; }
.dark .kl-command__input::placeholder { color: #71717a; }

.kl-command__escape,
.kl-command__footer kbd {
    display: inline-flex;
    min-width: 24px;
    height: 24px;
    align-items: center;
    justify-content: center;
    border: 1px solid #e2e8f0;
    border-radius: 5px;
    background: #f8fafc;
    padding: 0 6px;
    color: #64748b;
    font-family: inherit;
    font-size: 10px;
    font-weight: 500;
    box-shadow: none;
}

.dark .kl-command__escape,
.dark .kl-command__footer kbd {
    border-color: #3f3f46;
    background: #27272a;
    color: #a1a1aa;
}

.kl-command__results {
    max-height: min(56vh, 480px);
    min-height: 144px;
    overflow-y: auto;
    padding: 8px 8px 16px;
    overscroll-behavior: contain;
}

.kl-command__group-label {
    padding: 12px 12px 4px;
    color: #64748b;
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.dark .kl-command__group-label { color: #71717a; }

.kl-command__item {
    display: flex;
    width: 100%;
    align-items: center;
    gap: 12px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    padding: 8px 12px;
    color: #0f172a;
    text-align: left;
    cursor: pointer;
    transition: background-color 120ms ease, color 120ms ease;
}

.kl-command__item:hover,
.kl-command__item.is-active {
    background: #f1f5f9;
}

.dark .kl-command__item { color: #f4f4f5; }
.dark .kl-command__item:hover,
.dark .kl-command__item.is-active { background: #27272a; }

.kl-command__item-icon {
    display: grid;
    width: 32px;
    height: 32px;
    flex: none;
    place-items: center;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    background: rgba(255,255,255,.72);
    color: #475569;
}

.kl-command__item-icon svg { width: 16px; height: 16px; }
.dark .kl-command__item-icon {
    border-color: #3f3f46;
    background: #18181b;
    color: #a1a1aa;
}

.kl-command__item-copy { min-width: 0; flex: 1; }
.kl-command__item-title {
    display: block;
    overflow: hidden;
    color: inherit;
    font-size: 13px;
    font-weight: 500;
    line-height: 1.4;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.kl-command__item-subtitle {
    display: block;
    margin-top: 2px;
    overflow: hidden;
    color: #64748b;
    font-size: 12px;
    line-height: 1.4;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.dark .kl-command__item-subtitle { color: #71717a; }

.kl-command__item-type {
    flex: none;
    color: #94a3b8;
    font-size: 11px;
    font-weight: 400;
    letter-spacing: 0.01em;
}
.dark .kl-command__item-type { color: #71717a; }

.kl-command__empty {
    display: grid;
    min-height: 160px;
    place-items: center;
    padding: 32px;
    color: #64748b;
    font-size: 13px;
    text-align: center;
}
.dark .kl-command__empty { color: #71717a; }

.kl-command__footer {
    display: flex;
    min-height: 40px;
    align-items: center;
    gap: 16px;
    border-top: 1px solid #e2e8f0;
    padding: 0 16px;
    color: #64748b;
    font-size: 11px;
}
.dark .kl-command__footer { border-top-color: #27272a; color: #71717a; }
.kl-command__footer span { display: inline-flex; align-items: center; gap: 4px; }
.kl-command__footer-shortcut { margin-left: auto; }

@media (max-width: 640px) {
    .kl-command { padding: 64px 12px 12px; }
    .kl-command__dialog { width: 100%; }
    .kl-command__results { max-height: calc(100vh - 220px); }
    .kl-command__footer span:not(.kl-command__footer-shortcut) { display: none; }
}

@media (prefers-reduced-motion: reduce) {
    .kl-command__backdrop,
    .kl-command__dialog { transition-duration: 0.01ms; }
}
