.commands-app {
    display: grid;
    gap: 1rem;
}

.commands-toolbar {
    display: grid;
    grid-template-rows: auto auto auto;
    gap: 0.75rem;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.10);
    border-radius: 14px;
}

.commands-toolbar > * {
    min-width: 0;
}

.commands-toolbar-row {
    display: grid;
    grid-template-columns: minmax(220px, 2fr) repeat(2, minmax(180px, 1fr));
    gap: 0.75rem;
    align-items: stretch;
}

.commands-toolbar input,
.commands-toolbar button {
    color: inherit;
    font: inherit;
    box-sizing: border-box;
}

#command-search,
#bot-filter-input {
    width: 100%;
    padding: 0.75rem 2.6rem 0.75rem 0.9rem;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.18);
    color: inherit;
}

#command-search {
    padding-right: 0.9rem;
}

#command-search::placeholder,
#bot-filter-input::placeholder,
.multi-combo-input::placeholder {
    color: inherit;
    opacity: 0.7;
}

#command-search:focus,
#bot-filter-input:focus,
.multi-combo:focus-within {
    outline: none;
    border-color: rgba(255, 255, 255, 0.22);
}

.combo-wrap,
.multi-combo-wrap {
    position: relative;
    width: 100%;
    min-width: 0;
}

.combo,
.multi-combo {
    position: relative;
}

.multi-combo {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem;
    width: 100%;
    min-height: 48px;
    padding: 0.45rem 2.6rem 0.45rem 0.55rem;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.18);
    color: inherit;
    box-sizing: border-box;
}

.multi-combo-input {
    flex: 1 1 120px;
    min-width: 120px;
    border: 0;
    outline: none;
    background: transparent;
    color: inherit;
    font: inherit;
    padding: 0;
    margin: 0;
}

.combo-clear {
    position: absolute;
    top: 50%;
    right: 0.75rem;
    transform: translateY(-50%);
    border: 0;
    background: transparent;
    color: inherit;
    opacity: 0.7;
    font: inherit;
    font-size: 1.1rem;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    width: auto;
    min-width: 0;
}

.combo-clear:hover {
    opacity: 1;
}

.combo-list {
    position: absolute;
    top: calc(100% + 0.35rem);
    left: 0;
    right: 0;
    z-index: 20;
    max-height: 260px;
    overflow-y: auto;
    padding: 0.35rem 0;
    box-sizing: border-box;
    background: #1e1e24;
    border: 1px solid rgba(255, 255, 255, 0.10);
    border-radius: 14px;
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.35);
}

.combo-option,
.combo-empty {
    padding: 0.7rem 0.9rem;
    color: inherit;
}

.combo-option {
    cursor: pointer;
}

.combo-option:hover,
.combo-option.is-active {
    background: rgba(255, 255, 255, 0.08);
}

.combo-option.is-selected {
    font-weight: 600;
    background: rgba(255, 255, 255, 0.06);
}

.combo-empty {
    opacity: 0.8;
}

.multi-chip,
.command-chip,
.bot-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    white-space: nowrap;
    border-radius: 999px;
}

.multi-chip {
    padding: 0.22rem 0.55rem;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
}

.command-chip,
.bot-chip {
    padding: 0.2rem 0.55rem;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.10);
    font-size: 0.9rem;
}

.multi-chip-remove {
    border: 0;
    background: transparent;
    color: inherit;
    opacity: 0.75;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    font-size: 1rem;
    width: auto;
    min-width: 0;
}

.multi-chip-remove:hover {
    opacity: 1;
}

.summary-line {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
}

.table-note,
.muted {
    opacity: 0.74;
}

.table-note {
    margin: 0;
}

.legend-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0.75rem;
}

.legend-card {
    padding: 0.75rem 0.9rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.10);
    border-radius: 12px;
}

.legend-card strong {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.filter-row {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    margin-top: 0.25rem;
}

.filter-row input[type="checkbox"] {
    flex: 0 0 auto;
    margin-top: 0.2rem;
}

.filter-row label {
    display: inline-block;
    line-height: 1.4;
    cursor: pointer;
}

.command-table-wrap {
    overflow-x: auto;
    border: 1px solid rgba(255, 255, 255, 0.10);
    border-radius: 14px;
}

table.command-table {
    width: 100%;
    min-width: 980px;
    border-collapse: collapse;
}

.command-table th,
.command-table td {
    padding: 0.9rem 0.85rem;
    vertical-align: top;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    text-align: left;
}

.command-table th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: #1e1e24;
}

.command-table th button {
    all: unset;
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    cursor: pointer;
    font-weight: 700;
}

.sort-indicator {
    opacity: 0.55;
    font-size: 0.9em;
}

.category-tag {
    font-weight: 600;
}

.aliases,
.bot-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.bot-tags {
    margin-top: 0.6rem;
}

.empty-state {
    padding: 1.25rem;
    text-align: center;
    opacity: 0.85;
}

.command,
.command2 {
    display: inline-block;
    padding: 0.08rem 0.42rem;
    margin: 0 0.08rem;
    border-radius: 8px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
    font-size: 0.92em;
    line-height: 1.35;
    white-space: nowrap;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
}

.command2 {
    background: rgba(255, 255, 255, 0.05);
}

.command-table td ul,
.command-table td ol {
    margin: 0.5rem 0 0.5rem 1.2rem;
    padding: 0;
}

.command-table td p,
.command-table td blockquote {
    margin: 0.5rem 0;
}

.command-table td blockquote {
    margin-left: 0;
    padding-left: 0.9rem;
    border-left: 3px solid rgba(255, 255, 255, 0.14);
    opacity: 0.95;
}

.command-table td small {
    opacity: 0.82;
}

@media (max-width: 900px) {
    .commands-toolbar-row {
        grid-template-columns: 1fr;
    }

    table.command-table {
        min-width: 760px;
    }

    .summary-line {
        align-items: flex-start;
    }
}