/* Agent Core, Revision, and Runtime lifecycle elements */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.4;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  white-space: nowrap;
}
.badge.status-draft {
  background: var(--subtle);
  color: var(--muted);
  border-color: var(--line);
}
.badge.status-editing {
  background: var(--sprout-bg);
  color: var(--sprout-ink);
  border-color: var(--gold);
}
.badge.status-ready {
  background: var(--brand-bg);
  color: var(--brand-hover);
  border-color: var(--line-strong);
}
.badge.status-deployed {
  background: color-mix(in srgb, var(--success) 12%, transparent);
  color: var(--success);
  border-color: color-mix(in srgb, var(--success) 30%, transparent);
}
.badge.status-retired {
  background: var(--subtle);
  color: var(--muted);
  border-color: var(--line);
  text-decoration: line-through;
}
.badge.update-available {
  background: var(--sprout-bg);
  color: var(--sprout-ink);
  border-color: var(--gold);
  font-weight: 700;
}
.btn-apply-update {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 2px 10px;
  font-size: 11px;
  font-weight: 700;
  border-radius: 4px;
  border: 1px solid var(--gold);
  background: var(--gold);
  color: var(--night);
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.btn-apply-update:hover {
  background: color-mix(in srgb, var(--gold) 85%, black);
  border-color: color-mix(in srgb, var(--gold) 85%, black);
}
.runtime-update-mode {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  color: var(--muted);
}
.dialog-note {
  margin: 0;
  color: var(--muted);
}

/* Detail Slide-over Inspection Drawer */
.drawer-scrim {
  position: fixed;
  inset: 0;
  background: rgba(16, 32, 36, 0.45);
  backdrop-filter: blur(2px);
  z-index: 2500;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}
.drawer-scrim.is-open {
  opacity: 1;
  pointer-events: auto;
}
.inspect-drawer-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 480px;
  max-width: 90vw;
  background: #ffffff;
  border-left: 1px solid var(--line);
  box-shadow: -4px 0 24px rgba(0, 0, 0, 0.08);
  z-index: 2600;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
.inspect-drawer-panel.is-open {
  transform: translateX(0);
}
.drawer-top-bar {
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: #ffffff;
}
.drawer-top-identity {
  display: flex;
  gap: 12px;
  align-items: center;
  min-width: 0;
}
.drawer-top-titles {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}
.drawer-content-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.drawer-bottom-bar {
  padding: 14px 20px;
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: #fbfdfc;
}
.auth-explanation-card {
  background: #fbfdfc;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 12px;
  line-height: 1.5;
}
.auth-explanation-card.is-oauth {
  border-color: var(--amber-border);
  background: var(--amber-bg);
}
.auth-explanation-card.is-api-key {
  border-color: #f5d5c5;
  background: #fffbfa;
}
.auth-explanation-card.is-zero-auth {
  border-color: #c2e5db;
  background: #e6f4f0;
}
.auth-explanation-card strong {
  display: block;
  color: var(--ink);
  margin-bottom: 2px;
}
.auth-explanation-card span {
  color: var(--ink-soft);
}

/* External Links Cards */
.drawer-links-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  background: var(--subtle, #f4f6f8);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px;
}
.ext-link-card {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: var(--paper-light, #ffffff);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  text-decoration: none;
  font-size: 11.5px;
  font-weight: 700;
  transition: all 0.12s ease;
}
.ext-link-card:hover {
  border-color: var(--brand);
  color: var(--brand);
}
.ext-link-desc {
  display: block;
  font-size: 9.5px;
  font-weight: 400;
  color: var(--muted);
  font-family: "DM Mono", monospace;
  white-space: nowrap;
}

/* Badges */
.badge-access-mono {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: "DM Mono", monospace;
  font-size: 9.5px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  line-height: 1.2;
}
.badge-access-mono.is-oauth {
  background: #eef2ff;
  color: #4338ca;
  border: 1px solid #c7d2fe;
}
.badge-access-mono.is-api-key {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fde68a;
}
.badge-access-mono.is-zero-auth {
  background: #ecfdf5;
  color: #065f46;
  border: 1px solid #a7f3d0;
}
.badge-label-mono {
  display: inline-flex;
  align-items: center;
  font-family: "DM Mono", monospace;
  font-size: 9.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--subtle, #f0f3f5);
  color: var(--ink-soft);
  border: 1px solid var(--line);
}
.badge-label-mono.is-connector {
  background: #e0f2fe;
  color: #0369a1;
  border-color: #bae6fd;
}
.badge-label-mono.is-tool {
  background: #f3e8ff;
  color: #6b21a8;
  border-color: #e9d5ff;
}
.badge-label-mono.is-skill {
  background: #f0fdf4;
  color: #15803d;
  border-color: #bbf7d0;
}
.badge-official-mono {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-family: "DM Mono", monospace;
  font-size: 9.5px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  background: #ecfdf5;
  color: #065f46;
  border: 1px solid #a7f3d0;
}
.card-brand-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  overflow: hidden;
  flex-shrink: 0;
}
.card-brand-logo svg {
  width: 100%;
  height: 100%;
  display: block;
}

/* Detail Section Cards */
.drawer-section-card {
  background: var(--paper-light, #ffffff);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 14px 16px;
}
.drawer-section-card h4 {
  margin: 0 0 10px;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.drawer-section-card dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px 16px;
  margin: 0;
  font-size: 12px;
}
.drawer-section-card dt {
  color: var(--muted);
  font-weight: 600;
}
.drawer-section-card dd {
  margin: 0;
  color: var(--ink);
}

@media (max-width: 640px) {
  .inspect-drawer-panel {
    width: 100vw;
    max-width: 100vw;
  }
  .drawer-links-grid {
    grid-template-columns: 1fr;
  }
}

/* =========================================================================
   Capabilities Marketplace 3.0 — Enterprise Workbench Layout
   ========================================================================= */

:root {
  --font-display: "Manrope", ui-sans-serif, system-ui, sans-serif;
  --font-body: "Manrope", ui-sans-serif, system-ui, sans-serif;
  --font-mono: "DM Mono", ui-monospace, monospace;
  --radius-sm: 2px;
  --radius-md: 4px;
  --amber: #946600;
  --amber-bg: #fff8e6;
  --amber-border: #f0d599;
}

.market-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}
.market-header-title h1 {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 0;
  color: var(--ink);
}
.market-header-title p {
  display: none;
}
.market-header-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}
.btn-quiet-action {
  font-family: var(--font-body);
  font-size: 11.5px;
  font-weight: 600;
  padding: 6px 12px;
  border: 1px solid var(--line-strong, var(--line));
  border-radius: var(--radius-sm);
  background: #ffffff;
  color: var(--ink);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  letter-spacing: 0.01em;
  transition: all 0.15s ease;
}
.btn-quiet-action:hover {
  border-color: var(--brand);
  color: var(--brand);
  background: #ffffff;
}

/* Unified Tabs & Target Core Row */
.market-tabs-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  margin-bottom: 16px;
  gap: 16px;
}
.market-view-tabs {
  display: flex;
  align-items: center;
  gap: 20px;
  border-bottom: none;
  margin-bottom: 0;
}
.market-tab-link {
  background: none;
  border: none;
  padding: 8px 0 10px;
  font-family: var(--font-body);
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink-soft);
  cursor: pointer;
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: color 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}
.market-tab-link:hover {
  color: var(--ink);
}
.market-tab-link.active {
  color: var(--brand);
  font-weight: 800;
}
.market-tab-link::after {
  content: "";
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--brand);
  transform: scaleX(0);
  transform-origin: center;
  transition: transform 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}
.market-tab-link.active::after {
  transform: scaleX(1);
}
.tab-count {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: var(--radius-sm);
  background: var(--subtle);
  color: var(--ink-soft);
  transition: background-color 0.18s ease, color 0.18s ease;
}
.market-tab-link.active .tab-count {
  background: var(--brand-bg);
  color: var(--brand);
}

/* Compact Target Context Strip */
.target-context-compact {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-bottom: 4px;
}
.target-mode-tag {
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  background: var(--brand-bg);
  color: var(--brand);
  white-space: nowrap;
}
.target-context-compact.is-unbound .target-mode-tag {
  background: #edf2f1;
  color: var(--muted);
}
.target-select-compact {
  font-family: var(--font-body);
  font-size: 11.5px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong, var(--line));
  background: #ffffff;
  color: var(--ink);
  cursor: pointer;
  height: 28px;
}
.target-select-compact:focus {
  outline: none;
  border-color: var(--brand);
}

/* Two-Column Marketplace Layout */
.marketplace-workbench {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 24px;
  align-items: flex-start;
}

/* Left Filter Tree Navigation */
.catalog-nav-tree {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.tree-section {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.tree-section-title {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  padding: 4px 8px 6px;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.tree-nav-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 8px;
  font-family: var(--font-body);
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.12s ease;
  background: none;
  border: none;
  width: 100%;
  text-align: left;
}
.tree-nav-item:hover {
  background: var(--subtle);
  color: var(--ink);
}
.tree-nav-item.is-active {
  background: var(--brand-bg);
  color: var(--brand);
  font-weight: 700;
}
.tree-nav-label {
  display: flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  flex: 1;
}
.tree-nav-text {
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.tree-nav-label svg {
  flex-shrink: 0;
}
.tree-nav-count {
  flex-shrink: 0;
  margin-inline-start: 8px;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--muted);
}
.tree-nav-item.is-active .tree-nav-count {
  color: var(--brand);
  font-weight: 700;
}
.tree-divider {
  height: 1px;
  background: var(--subtle);
  margin: 2px 0;
}

/* Right Main Catalog Viewport */
.catalog-content-pane {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
  width: 100%;
}

/* Search Header Bar (Clean, borderless container) */
.catalog-search-header {
  background: transparent;
  border: none;
  padding: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
}
.btn-mobile-filter {
  display: none;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  min-width: 44px;
  padding: 0 12px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
  white-space: nowrap;
}
.mobile-filter-badge {
  background: var(--brand);
  color: #ffffff;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 10px;
}
.search-box-wrap {
  position: relative;
  flex: 1;
  min-width: 220px;
}
.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}
.market-search-box {
  width: 100%;
  padding: 8px 56px 8px 36px;
  font-family: var(--font-body);
  font-size: 12.5px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #ffffff;
  color: var(--ink);
  box-sizing: border-box;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.market-search-box:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 2px rgba(22, 128, 63, 0.12);
}
.search-kbd {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-family: var(--font-mono);
  font-size: 9.5px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: #edf3f2;
  color: var(--muted);
  padding: 1px 5px;
  line-height: 1.2;
}
.header-right-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.search-sort-select {
  font-family: var(--font-body);
  font-size: 11.5px;
  font-weight: 600;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #ffffff;
  color: var(--ink);
  cursor: pointer;
  outline: none;
}
.search-sort-select:focus {
  border-color: var(--brand);
}

/* Subcategory Horizontal Pills Row (Single Row Native Momentum Scroll) */
.subcat-pills-row {
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  -ms-overflow-style: none;
  height: 38px;
  min-height: 38px;
  padding: 4px 2px;
  min-width: 0;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  mask-image: linear-gradient(to right, black calc(100% - 32px), transparent 100%);
  -webkit-mask-image: linear-gradient(to right, black calc(100% - 32px), transparent 100%);
}
.subcat-pills-row::-webkit-scrollbar {
  display: none;
}
.subcat-pill {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0 11px;
  font-family: var(--font-body);
  font-size: 11.5px;
  font-weight: 500;
  color: var(--ink);
  cursor: pointer;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.12s ease;
  white-space: nowrap;
  min-height: 26px !important;
  height: 26px;
  box-sizing: border-box;
  line-height: 1;
}
.subcat-pill:hover {
  border-color: var(--brand);
  background: var(--subtle);
}
.subcat-pill.is-active {
  background: var(--brand-bg);
  border-color: var(--brand);
  color: var(--brand);
  font-weight: 700;
}
.subcat-pill:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 1px;
}
.subcat-pill-count {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--muted);
  line-height: 1;
}
.subcat-pill.is-active .subcat-pill-count {
  color: var(--brand);
  font-weight: 700;
}

/* Active Filter Badges Bar */
.active-filters-bar {
  display: none !important;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--muted);
}
.filter-badge-chip {
  font-family: "DM Mono", monospace;
  font-size: 10.5px;
  background: #ffffff;
  border: 1px solid var(--line-strong, var(--line));
  padding: 2px 8px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--ink);
}
.filter-badge-chip button {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  color: var(--muted);
  font-weight: 800;
  font-size: 12px;
  min-height: auto;
}
.filter-badge-chip button:hover {
  color: var(--ink);
}
.clear-all-link {
  font-size: 11.5px;
  color: var(--brand);
  background: none;
  border: none;
  cursor: pointer;
  text-decoration: underline;
  padding: 0;
  min-height: auto;
}

/* Results Count Row (Hidden per user request) */
.results-count-row {
  display: none !important;
}

/* Quiet, Crisp Cards Grid */
.workbench-cards-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.workbench-card {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 180px;
  box-sizing: border-box;
  position: relative;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 1px 2px rgba(16, 32, 36, 0.02);
  animation: card-appear 0.22s cubic-bezier(0.16, 1, 0.3, 1) backwards;
}
@keyframes card-appear {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
@media (hover: hover) and (pointer: fine) {
  .workbench-card:hover {
    border-color: var(--line-strong);
    transform: translateY(-2px);
    box-shadow: 0 6px 18px -2px rgba(16, 32, 36, 0.07), 0 1px 3px rgba(16, 32, 36, 0.03);
  }
  .workbench-card:hover .card-brand-logo {
    transform: scale(1.04);
  }
}
@media (prefers-reduced-motion: reduce) {
  .workbench-card,
  .subcat-pill,
  .btn-quiet-action,
  .market-tab-link {
    transition: none !important;
    transform: none !important;
  }
}

.card-identity-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 8px;
}
.card-brand-logo {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  display: grid;
  place-items: center;
  flex-shrink: 0;
  background: #ffffff;
  border: 1px solid var(--line);
  box-shadow: 0 1px 2px rgba(0,0,0,0.03);
  padding: 4px;
  transition: transform 0.2s ease;
  box-sizing: border-box;
}
.card-brand-logo svg {
  width: 100%;
  height: 100%;
  display: block;
  border-radius: 2px;
}
.card-brand-logo .brand-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.card-brand-logo:has(.brand-img:not([hidden])) {
  background: transparent;
  border: 0;
  box-shadow: none;
  padding: 0;
}
.card-brand-logo .brand-img:not([hidden]),
.card-brand-logo > span:not([hidden]) {
  display: block;
}
.card-brand-logo > span:not([hidden]) {
  width: 100%;
  height: 100%;
}
.card-header-meta {
  flex: 1;
  min-width: 0;
}
.card-badge-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 3px;
  flex-wrap: wrap;
}

.badge-label-mono {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 1px 5px;
  border-radius: 2px;
  line-height: normal;
}
.badge-label-mono.is-connector {
  background: #e3f2e8;
  color: #0d6b35;
}
.badge-label-mono.is-tool {
  background: #e0edf9;
  color: #125596;
}
.badge-label-mono.is-skill {
  background: #f1f6d9;
  color: #536f06;
}

.badge-official-mono {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 1px 5px;
  border-radius: 2px;
  background: #eef7f2;
  color: #0d6b35;
  border: 1px solid #bde2ca;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  line-height: normal;
}
.badge-community-mono {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 1px 5px;
  border-radius: 2px;
  background: var(--subtle);
  color: var(--muted);
  border: 1px solid var(--line);
  line-height: normal;
}

.badge-access-mono {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 600;
  padding: 1px 5px;
  border-radius: 2px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  line-height: normal;
}
.badge-access-mono.is-oauth {
  background: var(--amber-bg);
  color: var(--amber);
  border: 1px solid var(--amber-border);
}
.badge-access-mono.is-api-key {
  background: #fcf1eb;
  color: #a34614;
  border: 1px solid #f9d5c4;
}
.badge-access-mono.is-zero-auth {
  background: #e6f4f0;
  color: #0d6b54;
  border: 1px solid #c2e5db;
}

.workbench-card h4, .workbench-card h3, .workbench-card h2 {
  margin: 0;
  font-family: var(--font-body);
  font-size: 14.5px;
  font-weight: 700;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.card-publisher-line {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--muted);
  margin-top: 1px;
}
.card-summary-text {
  font-family: var(--font-body);
  font-size: 12px;
  color: var(--ink-soft);
  line-height: 1.5;
  margin: 0 0 12px 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  height: 36px;
}
.card-bottom-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 10px;
  border-top: 1px solid var(--subtle);
  min-height: 38px;
  box-sizing: border-box;
}
.card-category-pill {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--muted);
  background: var(--subtle);
  padding: 2px 6px;
  border-radius: 2px;
  line-height: normal;
}
.card-btn-cluster {
  display: flex;
  align-items: center;
  gap: 6px;
}
.btn-inspect-subtle {
  font-family: var(--font-body);
  font-size: 11.5px;
  font-weight: 600;
  color: var(--ink-soft);
  background: none;
  border: 1px solid transparent;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  letter-spacing: 0.01em;
  transition: all 0.15s ease;
  min-height: 26px !important;
  height: 26px;
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.btn-inspect-subtle:hover {
  color: var(--ink);
  background: var(--subtle);
  border-color: var(--line);
}
.btn-inspect-subtle:active {
  transform: scale(0.96);
}
.btn-card-add {
  font-family: var(--font-body);
  font-size: 11.5px;
  font-weight: 700;
  padding: 0 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--brand);
  background: var(--brand);
  color: #ffffff;
  cursor: pointer;
  letter-spacing: 0.01em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 28px !important;
  height: 28px;
  box-sizing: border-box;
  line-height: 1;
  transition: all 0.15s cubic-bezier(0.16, 1, 0.3, 1);
}
.btn-card-add:hover {
  background: var(--brand-hover);
  color: #ffffff !important;
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(22, 128, 63, 0.25);
}
.btn-card-add:active {
  transform: scale(0.96);
}
.btn-card-add.is-added,
.catalog-installed {
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 700;
  padding: 0 10px;
  min-height: 28px !important;
  height: 28px;
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #eef7f2;
  color: #0d6b35;
  border: 1px solid #bde2ca;
  border-radius: var(--radius-sm);
  line-height: 1;
}
.btn-card-danger {
  font-family: var(--font-body);
  font-size: 11.5px;
  font-weight: 700;
  padding: 0 10px;
  min-height: 28px !important;
  height: 28px;
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  border: 1px solid #ef4444;
  background: #fee2e2;
  color: #b91c1c;
  cursor: pointer;
  line-height: 1;
}
.btn-card-danger:hover {
  background: #fecaca;
  color: #991b1b;
}

/* Modal Overlays for Quick Creation */
.modal-scrim {
  position: fixed;
  inset: 0;
  background: rgba(14, 25, 31, 0.5);
  backdrop-filter: blur(2px);
  z-index: 1000;
}
.modal-dialog-panel {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 4px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.16);
  width: 90%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 24px;
  z-index: 1001;
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.modal-header h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  color: var(--ink);
}
.modal-desc {
  margin: 0 0 16px 0;
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.4;
}
.modal-dialog-panel form {
  display: grid;
  gap: 12px;
}
.modal-dialog-panel label {
  display: grid;
  gap: 4px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--ink-soft);
}

#quick-mcp-form [hidden],
#mcp-form [hidden] {
  display: none !important;
}
.modal-dialog-panel input,
.modal-dialog-panel select,
.modal-dialog-panel textarea {
  font-size: 12.5px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 4px;
}
.modal-dialog-panel textarea {
  min-height: 70px;
  font-family: var(--font-body, system-ui, sans-serif);
}
.modal-dialog-panel fieldset {
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 8px 12px;
}
.modal-dialog-panel fieldset legend {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  padding: 0 4px;
}
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--subtle);
}

/* Responsive Workbench & Mobile Bottom Sheet */
.mobile-sheet-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(17, 24, 39, 0.45);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  z-index: 1040;
}
.mobile-sheet-header {
  display: none;
}
.btn-mobile-filter {
  display: none;
}

/* Installed Card List & Table Styles */
.installed-table tr.capability-installed-item,
.capability-installed-item {
  transition: background-color 0.12s ease;
}
.installed-item-info {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 1 1 auto;
}
.installed-item-meta {
  min-width: 0;
}
.installed-item-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

@media (max-width: 1024px) {
  .marketplace-workbench {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .workbench-cards-grid {
    grid-template-columns: 1fr;
  }
  .market-header-row {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }
  .market-tabs-row {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }
  .target-context-compact {
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 8px;
  }
  .catalog-search-header {
    flex-wrap: wrap;
    gap: 8px;
  }
  .search-box-wrap {
    min-width: 0;
    flex: 1 1 180px;
  }
  .header-right-controls {
    width: 100%;
  }
  .search-sort-select {
    width: 100%;
  }
  .inspect-drawer-panel {
    width: 100vw;
    max-width: 100vw;
  }
  .market-tab-link,
  .btn-mobile-filter {
    min-height: 44px;
  }

  /* Mobile Filter Trigger Button */
  .btn-mobile-filter {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0 12px;
    background: #ffffff;
    border: 1px solid var(--line);
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    color: var(--ink);
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
  }
  .btn-mobile-filter:hover {
    border-color: var(--brand);
    background: var(--subtle);
  }
  .mobile-filter-badge {
    font-family: var(--font-mono, monospace);
    font-size: 10px;
    background: var(--brand-bg, #f0fdf4);
    color: var(--brand, #166534);
    padding: 1px 5px;
    border-radius: 3px;
    font-weight: 700;
  }

  /* Catalog Nav Tree as Mobile Bottom Sheet */
  .catalog-nav-tree {
    display: none;
  }
  .catalog-nav-tree.is-sheet-open {
    display: flex;
    flex-direction: column;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    max-height: 85vh;
    z-index: 1050;
    background: #ffffff;
    border-radius: 12px 12px 0 0;
    box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.2);
    padding: 16px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    animation: slideUpSheet 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  }
  .mobile-sheet-backdrop.is-active,
  .mobile-sheet-backdrop.is-open {
    display: block;
  }
  .mobile-sheet-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--line);
  }
  .sheet-drag-handle {
    width: 36px;
    height: 4px;
    background: var(--line, #e5e7eb);
    border-radius: 2px;
  }
  .sheet-title-row {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
  }
  .sheet-title-row h4 {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
    color: var(--ink);
  }
  .sheet-close-btn {
    background: none;
    border: 1px solid var(--line);
    border-radius: 4px;
    padding: 10px 14px;
    font-size: 13px;
    font-weight: 600;
    color: var(--ink);
    cursor: pointer;
    min-height: 44px;
    min-width: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
  .sheet-close-btn:hover {
    background: var(--subtle);
    border-color: var(--brand);
  }

  /* Mobile Table Handling */
  .installed-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}

@keyframes slideUpSheet {
  from {
    transform: translateY(100%);
  }
  to {
    transform: translateY(0);
  }
}

/* Real-time Attachment Toast with Test Verification Prompt */
.market-feedback-banner {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #102024;
  color: #ffffff;
  border: 1px solid rgba(255,255,255,0.15);
  box-shadow: 0 16px 36px -4px rgba(16, 32, 36, 0.4), 0 2px 6px rgba(0,0,0,0.15);
  border-radius: 2px;
  padding: 16px 20px;
  width: 420px;
  max-width: calc(100vw - 48px);
  z-index: 2000;
  display: none;
  flex-direction: column;
  gap: 10px;
  transform-origin: bottom right;
}
.market-feedback-banner.is-animating-in {
  display: flex;
  animation: toast-in 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
.market-feedback-banner.is-animating-out {
  animation: toast-out 0.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
@keyframes toast-in {
  from { opacity: 0; transform: translateY(16px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes toast-out {
  from { opacity: 1; transform: translateY(0) scale(1); }
  to { opacity: 0; transform: translateY(12px) scale(0.96); }
}
.feedback-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.feedback-title {
  font-size: 13px;
  font-weight: 700;
  color: #b8e23a;
  display: flex;
  align-items: center;
  gap: 8px;
}
.feedback-prompt-quote {
  font-family: var(--font-mono, "DM Mono", monospace);
  font-size: 11px;
  color: #ffffff;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.1);
  padding: 6px 10px;
  border-radius: 2px;
  word-break: break-word;
  line-height: 1.5;
}
.btn-test-action {
  font-family: var(--font-body, "Manrope", sans-serif);
  font-size: 12px;
  font-weight: 800;
  padding: 6px 14px;
  min-height: 36px;
  border-radius: 2px;
  border: none;
  background: #b8e23a;
  color: #162b31;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s cubic-bezier(0.16, 1, 0.3, 1);
}
.btn-test-action:hover {
  background: #c8ed4a;
  color: #162b31 !important;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(184, 226, 58, 0.3);
}

/* Modal Radio Option for Target Core Picker */
.modal-radio-option {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 2px;
  cursor: pointer;
  font-size: 12.5px;
  transition: background-color 0.12s ease;
}
.modal-radio-option:hover {
  background: var(--subtle);
}
.modal-radio-option input {
  margin-top: 3px;
}

/* Partial Success Banner & Retry */
.partial-success-banner {
  background: #fff8e6;
  border: 1px solid #f0d599;
  border-radius: 2px;
  padding: 10px 12px;
  margin: 10px 0;
  font-size: 12px;
  color: #946600;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.partial-success-banner strong {
  color: #162b31;
}
.btn-retry-attach {
  align-self: flex-start;
  background: #16803f;
  color: #ffffff;
  border: none;
  border-radius: 2px;
  padding: 6px 12px;
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
}
.btn-retry-attach:hover {
  background: #116632;
}

/* Workflow Protocol Card and Sandboxing Card for Detail Drawer */
.workflow-protocol-card {
  display: grid;
  gap: 6px;
  background: #fbfdfc;
  border: 1px solid var(--line);
  border-radius: 2px;
  padding: 10px 12px;
}
.protocol-step {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 12px;
  color: var(--ink);
  line-height: 1.5;
}
.step-num {
  font-family: var(--font-mono, "DM Mono", monospace);
  font-size: 10px;
  font-weight: 700;
  color: var(--brand);
  background: var(--brand-bg);
  padding: 1px 5px;
  border-radius: 2px;
}
.drawer-security-card {
  font-family: var(--font-mono, "DM Mono", monospace);
  font-size: 10.5px;
  color: var(--muted);
  background: #fbfdfc;
  border: 1px solid var(--line);
  padding: 8px 10px;
  border-radius: 2px;
  line-height: 1.6;
}

/* Installed Enterprise Data Table */
.installed-table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm, 2px);
  background: #ffffff;
  margin-bottom: 24px;
}
.installed-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
  text-align: left;
  background: #ffffff;
}
.installed-table thead tr {
  background: var(--subtle);
  font-family: var(--font-mono, "DM Mono", monospace);
  font-size: 10px;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
}
.installed-table th {
  padding: 10px 14px;
  font-weight: 700;
  letter-spacing: 0.06em;
  white-space: nowrap;
}
.installed-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--subtle);
  vertical-align: middle;
}
.installed-table tr.capability-installed-item {
  display: table-row !important;
  border: none !important;
  border-bottom: 1px solid var(--subtle) !important;
  background: transparent !important;
  margin: 0 !important;
  border-radius: 0 !important;
}
.installed-table tbody tr:hover,
.installed-table tr.capability-installed-item:hover {
  background: #fafdfb !important;
}

.installed-card-list {
  display: grid;
  gap: 10px;
  margin: 0 0 24px;
  padding: 0;
  list-style: none;
}
.installed-card-list .capability-installed-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #ffffff;
}
.installed-item-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  margin-top: 4px;
  font-size: 11px;
  color: var(--muted);
}
.target-core-search-label {
  display: grid;
  gap: 5px;
  margin-top: 12px;
  font-size: 11px;
  font-weight: 700;
  color: var(--ink-soft);
}
.target-core-search-label input {
  min-height: 40px;
}

@media (max-width: 768px) {
  .installed-card-list .capability-installed-item {
    align-items: stretch;
    flex-direction: column;
  }
  .installed-item-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 100%;
  }
  .installed-item-actions button,
  .tree-nav-item,
  .subcat-pill,
  .btn-inspect-subtle,
  .btn-card-add,
  .search-sort-select,
  .target-select-compact,
  .market-search-box,
  .market-feedback-banner button {
    min-height: 44px !important;
    height: auto;
  }
  .market-feedback-banner {
    right: 12px;
    bottom: 12px;
    width: auto;
    max-width: calc(100vw - 24px);
    padding: 12px;
    gap: 8px;
  }
  .feedback-prompt-quote {
    display: none;
  }
  .market-feedback-banner > div:nth-child(2),
  #btn-stay-market {
    display: none;
  }
  .market-feedback-banner > div:last-child {
    margin-top: 0 !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  .catalog-nav-tree,
  .mobile-sheet-backdrop,
  .market-feedback-banner,
  .workbench-card,
  .btn-test-action,
  .btn-card-add {
    animation: none !important;
    transition: none !important;
    transform: none !important;
  }
}

