/* Commands & Interaction - Flat Minimalist UI (No Cards) */

.commands-table-wrap {
  margin-top: 16px;
  background: #ffffff;
}

.commands-list-header {
  display: grid;
  grid-template-columns: 2.4fr 2fr 2fr 90px 80px;
  gap: 16px;
  align-items: center;
  padding: 10px 16px;
  border-bottom: 1px solid #e2e8f0;
  font-size: 12px;
  font-weight: 600;
  color: #64748b;
  letter-spacing: 0.02em;
}

.commands-flat-list {
  display: flex;
  flex-direction: column;
}

.command-row {
  display: grid;
  grid-template-columns: 2.4fr 2fr 2fr 90px 80px;
  gap: 16px;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid #f1f5f9;
  cursor: pointer;
  transition: background-color 0.15s ease;
  user-select: none;
}

.command-row:hover {
  background-color: #f8fafc;
}

.command-row.disabled {
  opacity: 0.6;
}

.command-col-name,
.command-col-trigger,
.command-col-response,
.command-status-cell,
.command-col-action {
  min-width: 0;
}

.command-col-name {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.command-row-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.command-row-title {
  font-size: 14px;
  font-weight: 600;
  color: #0f172a;
}

.command-id-badge {
  display: inline-flex;
  align-items: center;
  padding: 1px 6px;
  font-size: 11px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-weight: 500;
  border-radius: 4px;
  background: #f1f5f9;
  color: #475569;
}

.command-row-desc {
  font-size: 12px;
  color: #64748b;
  margin: 0;
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

.command-col-trigger,
.command-col-response {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
  color: #334155;
}

.command-col-response span,
.command-col-trigger span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

.command-inline-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: #64748b;
}

.command-mention-tag {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  font-size: 11px;
  font-weight: 500;
  color: #475569;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  padding: 1px 6px;
  border-radius: 4px;
}

.command-mention-tag.required {
  color: #0f172a;
  background: #f1f5f9;
  border-color: #cbd5e1;
}

.command-prefixes-summary {
  font-size: 12px;
  color: #475569;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

.command-status-cell {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
}

.command-status-cell.enabled {
  color: #16a34a;
}

.command-status-cell.disabled {
  color: #94a3b8;
}

.command-status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: currentColor;
}

.command-col-action {
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

.command-edit-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 500;
  color: #334155;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.command-edit-btn:hover {
  background: #f8fafc;
  border-color: #94a3b8;
  color: #0f172a;
}

/* Detail View Layout */

.commands-detail-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid #f1f5f9;
}

.commands-back-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 500;
  color: #475569;
  cursor: pointer;
  transition: all 0.15s ease;
}

.commands-back-button svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
}

.commands-back-button:hover {
  background: #f8fafc;
  color: #0f172a;
  border-color: #cbd5e1;
}

.commands-detail-heading {
  margin-bottom: 24px;
}

.commands-detail-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.commands-detail-title-row h2 {
  font-size: 20px;
  font-weight: 600;
  color: #0f172a;
  margin: 0;
}

.command-switch-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
  font-size: 13px;
  font-weight: 500;
  color: #0f172a;
}

/* Detail Form Groups */

.command-form-group {
  margin-top: 28px;
  padding-top: 24px;
  border-top: 1px solid #f1f5f9;
}

.command-group-header {
  margin-bottom: 18px;
}

.command-group-header h3 {
  font-size: 15px;
  font-weight: 600;
  color: #0f172a;
  margin: 0 0 4px 0;
}

.command-group-header p {
  font-size: 13px;
  color: #64748b;
  margin: 0;
}

.command-group-body {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.setting-row-box {
  display: flex;
  align-items: center;
}

.command-tags-container {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 36px;
  align-items: center;
  padding: 6px 10px;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
}

.command-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 4px;
  padding: 2px 8px;
  font-size: 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  color: #1e293b;
  font-weight: 500;
}

.command-tag-remove {
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  color: #94a3b8;
  font-size: 13px;
  line-height: 1;
  transition: color 0.15s;
}

.command-tag-remove:hover {
  color: #ef4444;
}

.command-tag-empty {
  font-size: 12px;
  color: #94a3b8;
  font-style: italic;
}

.command-tag-input-row {
  display: flex;
  gap: 8px;
  margin-top: 6px;
}

.command-tag-input-row input {
  flex: 1;
}

.command-hint {
  font-size: 12px;
  color: #64748b;
  line-height: 1.4;
  margin-top: 4px;
}

.commands-detail-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 16px;
  margin-top: 32px;
  padding-top: 20px;
  border-top: 1px solid #f1f5f9;
}

.command-footer-status {
  font-size: 13px;
  color: #64748b;
}

.command-footer-status.success {
  color: #16a34a;
  font-weight: 500;
}

.command-footer-status.error {
  color: #dc2626;
  font-weight: 500;
}

.command-markdown-section {
  margin-top: 18px;
  padding: 16px 18px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
}

.command-section-subhead {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 14px;
}

.command-section-subhead h4 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: #0f172a;
}

.command-section-subhead p {
  margin: 2px 0 0;
  font-size: 12px;
  color: #64748b;
}

.command-switch-label-sub {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 500;
  color: #334155;
  cursor: pointer;
  white-space: nowrap;
}

.command-markdown-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 12px;
  padding-top: 14px;
  border-top: 1px dashed #cbd5e1;
}

.command-markdown-body.disabled-dim {
  opacity: 0.5;
  pointer-events: none;
}

.command-markdown-body textarea {
  width: 100%;
  box-sizing: border-box;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
  line-height: 1.5;
  padding: 8px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #ffffff;
  color: #1e293b;
  resize: vertical;
}

.command-keyboard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.command-keyboard-header > span {
  font-size: 13px;
  font-weight: 500;
  color: #334155;
}

.small-btn {
  padding: 3px 10px;
  font-size: 11px;
  height: 26px;
  line-height: 1;
}

.command-keyboard-preview {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
}

.command-kb-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 8px;
}

.command-kb-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 9px 12px;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  text-align: center;
  transition: all 0.15s ease;
  user-select: none;
}

.command-kb-btn.primary {
  background: #eff6ff;
  border-color: #93c5fd;
}

.command-kb-btn-label {
  font-size: 13px;
  font-weight: 600;
  color: #1e293b;
}

.command-kb-btn.primary .command-kb-btn-label {
  color: #1d4ed8;
}

.command-kb-btn-data {
  font-size: 11px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  color: #64748b;
}

.command-kb-btn.primary .command-kb-btn-data {
  color: #3b82f6;
}

@media (max-width: 900px) {
  .commands-list-header {
    display: none;
  }

  .command-row {
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 14px 0;
  }

  .command-col-action {
    justify-content: flex-start;
  }
}
