/* ── Source chips (dropdown) ── */
.sources-btn { position: relative; }
.sources-btn > button {
  padding: 5px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #f8fafc;
  font-size: 12px;
  cursor: pointer;
  color: #4a5568;
  display: flex; align-items: center; gap: 5px;
  height: 30px;
}
.sources-btn > button.filtered { border-color: var(--accent); background: var(--io-bg); color: var(--io-fg); }
.sources-btn > button .src-count { background: var(--accent-dark); color: #fff; border-radius: 8px; padding: 0 5px; font-size: 10px; font-weight: 700; }

.sources-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  width: 400px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 4px 24px rgba(0,0,0,.10);
  z-index: 200;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.src-group-label { font-size: 10px; text-transform: uppercase; letter-spacing: .8px; color: var(--text-dim); font-weight: 700; margin-bottom: 5px; }
.src-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.src-chip {
  padding: 3px 9px;
  border-radius: 4px;
  border: 1.5px solid transparent;
  font-size: 11px;
  cursor: pointer;
  font-weight: 600;
  user-select: none;
  /* deselected: grey */
  background: #edf2f7;
  color: #a0aec0;
  text-decoration: line-through;
  text-decoration-color: #a0aec0;
}
.src-chip.active {
  text-decoration: none;
}
.src-chip.io.active  { background: var(--io-bg);  color: var(--io-fg);  border-color: rgba(44,82,130,.25); }
.src-chip.nso.active { background: var(--nso-bg); color: var(--nso-fg); border-color: rgba(123,74,30,.2); }

.sources-divider { border: none; border-top: 1px solid #f0f0f0; }
.sources-actions { display: flex; gap: 8px; justify-content: flex-end; }
.src-action-btn { font-size: 11px; color: var(--accent); background: none; border: none; cursor: pointer; }

/* ── MCP pill + popover ── */
.mcp-pill {
  display: flex; align-items: center; gap: 6px;
  padding: 4px 10px;
  border: 1px solid #c6d8f5;
  border-radius: 6px;
  background: #eef4fd;
  cursor: pointer;
  position: relative;
}
.mcp-dot   { width: 6px; height: 6px; border-radius: 50%; background: #48bb78; }
.mcp-label { font-size: 11px; font-weight: 600; color: var(--accent-dark); white-space: nowrap; }

.mcp-popover {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 340px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 4px 24px rgba(0,0,0,.10);
  z-index: 200;
  padding: 14px;
  display: flex; flex-direction: column; gap: 10px;
}
.mcp-popover h3   { font-size: 13px; font-weight: 700; }
.mcp-popover p    { font-size: 12px; color: #4a5568; line-height: 1.5; }
.mcp-section-label { font-size: 11px; color: var(--text-muted); }
.mcp-divider { border: none; border-top: 1px solid #f0f0f0; }
.mcp-code {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 7px 10px;
  font-family: var(--mono);
  font-size: 11px;
  color: #2d3748;
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
}
.mcp-copy { font-size: 10px; color: var(--accent); cursor: pointer; border: none; background: none; }
.mcp-tools { display: flex; flex-wrap: wrap; gap: 4px; }
.mcp-tool-chip { font-size: 10px; background: #f0f4f8; border-radius: 4px; padding: 2px 7px; color: #4a5568; font-family: var(--mono); }

/* ── Hero source badges strip ── */
.hero-sources-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  justify-content: center;
  max-width: 480px;
  opacity: 0;
  animation: strip-fadein .5s .25s ease both;
}
@keyframes strip-fadein {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}
.hero-src-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 4px;
  opacity: .75;
  cursor: default;
  transition: opacity .15s;
}
.hero-src-badge:hover { opacity: 1; }

/* ── MCP docs link ── */
.mcp-docs-link { font-size: 11px; color: var(--accent); text-decoration: none; align-self: flex-end; }
.mcp-docs-link:hover { text-decoration: underline; }

/* ── Example chips (hero) ── */
.example-chips { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.ex-chip {
  font-size: 11px;
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 4px 11px;
  color: #4a5568;
  background: var(--surface);
  cursor: pointer;
  user-select: none;
}
.ex-chip:hover { border-color: var(--accent); color: var(--accent-dark); }

/* ── Result cards ── */
.result-item {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: start;
  border-bottom: 1px solid #f7f7f7;
  cursor: pointer;
}
.result-item:hover { background: #f8fafc; }
.result-item.active { background: #eef4fd; border-left: 2px solid var(--accent); }

.result-badge-cell { display: flex; justify-content: center; padding-top: 11px; padding-left: 12px; padding-right: 8px; min-width: 68px; }
.result-src-badge  { font-size: 10px; font-weight: 700; padding: 2px 6px; border-radius: 4px; white-space: nowrap; }
.result-name-cell  { padding: 10px 14px 10px 0; display: flex; flex-direction: column; gap: 5px; position: relative; overflow: hidden; }
.result-name       { font-size: 13px; color: #2d3748; line-height: 1.35; }
.result-dims       { display: flex; flex-wrap: nowrap; gap: 3px; overflow: hidden; max-width: 100%; position: relative; }
.result-dim-tag    { font-size: 10px; font-family: var(--mono); color: var(--text-dim); background: #f0f4f8; border-radius: 3px; padding: 1px 5px; white-space: nowrap; flex-shrink: 0; }

/* Fade-out overlay on the right edge of the dims row */
.result-name-cell::after {
  content: '';
  position: absolute;
  right: 14px; bottom: 10px;
  width: 48px; height: 18px;
  background: linear-gradient(to right, transparent, #fff);
  pointer-events: none;
}
.result-item:hover  .result-name-cell::after { background: linear-gradient(to right, transparent, #f8fafc); }
.result-item.active .result-name-cell::after { background: linear-gradient(to right, transparent, #eef4fd); }

/* Skeleton loading cards */
.result-skeleton { padding: 12px 14px; border-bottom: 1px solid #f7f7f7; display: flex; flex-direction: column; gap: 6px; }
.skel { background: #edf2f7; border-radius: 3px; animation: pulse 1.2s ease-in-out infinite; }
.skel-title { height: 13px; width: 75%; }
.skel-sub   { height: 10px; width: 40%; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .5; } }

/* Load more button (last item in results list) */
.load-more-wrap { padding: 10px 14px 14px; }
.btn-load-more  {
  width: 100%;
  padding: 7px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: #f8fafc;
  font-size: 12px;
  color: #4a5568;
  cursor: pointer;
}
.btn-load-more:hover { background: #eef4fd; border-color: #c6d8f5; color: var(--accent-dark); }

/* ── Detail panel ── */
.detail-header {
  padding: 12px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  display: flex; align-items: center; gap: 8px;
}
.detail-src-badge { border-radius: 4px; padding: 2px 8px; font-size: 11px; font-weight: 700; flex-shrink: 0; }
.detail-name      { font-size: 15px; font-weight: 600; flex: 1; }

.filters-body { flex: 1; display: flex; overflow: hidden; background: var(--surface); }

/* Dimension list */
.dim-list {
  width: 170px; flex-shrink: 0;
  border-right: 1px solid #f0f0f0;
  overflow-y: auto;
  padding: 8px;
  display: flex; flex-direction: column; gap: 3px;
  background: #fafafa;
}
.dim-pill {
  display: flex; align-items: center; justify-content: space-between;
  padding: 6px 9px;
  border-radius: 5px;
  border: 1px solid transparent;
  cursor: pointer; gap: 5px;
}
.dim-pill:hover  { background: #f0f4f8; border-color: var(--border); }
.dim-pill.active { background: #eef4fd; border-color: #c6d8f5; }
.dim-pill-name   { flex: 1; font-size: 11px; font-weight: 500; color: #2d3748; font-family: var(--mono); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dim-badges      { display: flex; gap: 2px; flex-shrink: 0; }
.badge           { font-size: 9px; border-radius: 3px; padding: 1px 5px; font-weight: 700; }
.badge-sel       { background: var(--accent-dark); color: #fff; }
.badge-total     { background: var(--border); color: var(--text-muted); }

/* Value picker */
.value-picker { flex: 1; display: flex; flex-direction: column; min-width: 0; overflow: hidden; }
.value-picker-head {
  padding: 10px 14px 8px;
  border-bottom: 1px solid #f0f0f0;
  display: flex; align-items: center; gap: 8px; flex-shrink: 0;
}
.dim-label { font-size: 12px; font-weight: 700; flex: 1; color: #2d3748; font-family: var(--mono); }
.btn-sm {
  padding: 3px 9px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface);
  font-size: 11px;
  cursor: pointer;
  color: #4a5568;
  white-space: nowrap;
}
.btn-sm:hover { background: #f0f4f8; }

.value-search-wrap {
  position: relative;
  padding: 8px 14px;
  border-bottom: 1px solid #f0f0f0;
  flex-shrink: 0;
}
.value-search-wrap input {
  width: 100%;
  padding: 6px 10px 6px 28px;
  border: 1px solid var(--border);
  border-radius: 5px;
  font-size: 12px;
  background: #f8fafc;
  outline: none;
}
.value-search-wrap input:focus { border-color: var(--accent); background: var(--surface); }
.vsearch-icon { position: absolute; left: 22px; top: 50%; transform: translateY(-50%); color: var(--text-dim); font-size: 11px; pointer-events: none; }

.value-list { flex: 1; overflow-y: auto; padding: 4px; display: flex; flex-direction: column; gap: 1px; }
.value-row  { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 4px; cursor: pointer; }
.value-row:hover   { background: #f8fafc; }
.value-row.checked { background: #eef4fd; }
.value-row input[type=checkbox] { accent-color: var(--accent-dark); flex-shrink: 0; width: 13px; height: 13px; cursor: pointer; }
.value-text      { font-size: 12px; color: #2d3748; line-height: 1.3; }
.value-text .code  { font-family: var(--mono); font-weight: 700; color: var(--accent-dark); }
.value-text .label { color: var(--text-muted); }

/* Detail footer */
.detail-footer {
  padding: 10px 16px;
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: flex; justify-content: flex-end; gap: 8px; align-items: center; flex-shrink: 0;
}

.btn-secondary {
  padding: 7px 14px;
  background: var(--surface);
  color: #4a5568;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex; align-items: center;
  transition: background .1s, border-color .1s, color .1s;
}
.btn-secondary:hover { background: #f0f4f8; border-color: #cbd5e0; color: #2d3748; }
.btn-secondary.btn-copied { background: #f0fff4; border-color: #9ae6b4; color: #276749; }

/* Loading state for action buttons (Copy URL, Download) */
.btn-loading { opacity: .75; cursor: default; pointer-events: none; }
.btn-spinner {
  display: inline-block;
  width: 11px; height: 11px;
  margin-right: 6px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: btn-spin .6s linear infinite;
}
@keyframes btn-spin { to { transform: rotate(360deg); } }

.btn-primary {
  padding: 7px 18px;
  background: var(--accent-dark);
  color: #fff;
  border: 1px solid transparent;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background .1s;
}
.btn-primary:hover    { background: #1a365d; }
.btn-primary:disabled { opacity: 0.5; cursor: default; }

/* Toast */
.toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: #1a202c;
  color: #fff;
  font-size: 12px;
  padding: 8px 16px;
  border-radius: 6px;
  z-index: 999;
  pointer-events: none;
  opacity: 0;
  transition: opacity .2s;
}
.toast.show { opacity: 1; }
