/* 笔记搜索 · 全宽布局 */
#bdNoteSearch,
#bdNoteRank {
  width: 100%;
  min-height: calc(100vh - var(--bd-topbar-h, 56px));
}

.bd-main:has(> #bdNoteSearch:not([hidden])),
.bd-main:has(> #bdNoteRank:not([hidden])) {
  padding: 12px 16px 24px;
}

.ns-root,
.nr-root {
  padding: 0;
  width: 100%;
  max-width: none;
  font-size: 12px;
}

.ns-head,
.nr-head {
  margin-bottom: 12px;
}

.ns-head h1,
.nr-head h1 {
  font-size: 15px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
}

.ns-head p,
.nr-head p {
  margin-top: 4px;
  color: var(--bd-text-secondary);
  font-size: 12px;
}

.ns-filters,
.nr-filters {
  background: var(--bd-card);
  border: 1px solid var(--bd-border);
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 10px;
}

.ns-search-scope-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 12px;
  margin-bottom: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--bd-border);
}

.ns-search-scope-label,
.ns-filter-label,
.nc-filter-label {
  flex: 0 0 auto;
  font-size: 12px;
  color: var(--bd-text-secondary);
  white-space: nowrap;
}

.ns-search-scope-list {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 14px;
}

.ns-scope-check {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  cursor: pointer;
  color: var(--bd-text);
}

.ns-scope-hint {
  font-size: 11px;
  color: var(--bd-text-muted);
}

/* 参考图2：搜索框固定宽度 + 图标按钮 + 精准匹配 */
.ns-search-bar-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 14px;
  margin-bottom: 10px;
}

.ns-search-bar {
  display: inline-flex;
  align-items: stretch;
  flex: 0 0 auto;
  width: auto;
  max-width: 100%;
}

.ns-search-input {
  box-sizing: border-box;
  width: 280px;
  max-width: min(280px, calc(100vw - 160px));
  height: 36px;
  padding: 0 12px;
  border: 1px solid #d1d5db;
  border-right: none;
  border-radius: 6px 0 0 6px;
  font-size: 13px;
  background: #fff;
  flex: 0 0 auto;
}

.ns-search-input:focus {
  outline: none;
  border-color: #7c3aed;
  box-shadow: inset 0 0 0 1px #7c3aed;
  z-index: 1;
}

.ns-btn-search {
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 36px;
  min-width: 72px;
  padding: 0 14px;
  margin: 0;
  border: 1px solid #7c3aed;
  border-radius: 0 6px 6px 0;
  background: #7c3aed !important;
  color: #fff !important;
  cursor: pointer;
  flex-shrink: 0;
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.ns-btn-search:hover {
  background: #6d28d9 !important;
  border-color: #6d28d9;
  color: #fff !important;
}

.ns-btn-search:active {
  background: #5b21b6 !important;
}

.ns-search-icon {
  display: block;
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  color: #fff;
  fill: currentColor;
}

.ns-btn-search-text {
  color: #fff;
  letter-spacing: 0.04em;
}

.ns-exact-check {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--bd-text);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

.ns-match-help {
  width: 18px;
  height: 18px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: #e5e7eb;
  color: var(--bd-text-secondary);
  font-size: 11px;
  line-height: 18px;
  text-align: center;
  cursor: help;
}

.ns-btn {
  height: 32px;
  padding: 0 14px;
  border-radius: 6px;
  border: 1px solid var(--bd-border);
  background: #fff;
  cursor: pointer;
  font-size: 13px;
}

.ns-btn-primary {
  background: var(--bd-primary);
  border-color: var(--bd-primary);
  color: #fff;
}

.ns-btn-primary:hover {
  background: var(--bd-primary-dark);
}

.nc-filter-row,
.ns-sort-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 8px;
}

.nc-filter-row:last-child,
.ns-sort-row:last-child {
  margin-bottom: 0;
}

.nc-filter-body {
  flex: 1;
  min-width: 0;
}

.nc-chip-group {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.nc-chip {
  height: 28px;
  padding: 0 10px;
  border: 1px solid var(--bd-border);
  border-radius: 6px;
  background: #fff;
  font-size: 12px;
  color: var(--bd-text-secondary);
  cursor: pointer;
}

.nc-chip.is-active {
  border-color: #c4b5fd;
  background: #f5f3ff;
  color: #6d28d9;
}

.ns-sort-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.ns-sort-tab {
  height: 28px;
  padding: 0 12px;
  border: none;
  border-radius: 6px;
  background: transparent;
  font-size: 12px;
  color: var(--bd-text-secondary);
  cursor: pointer;
}

.ns-sort-tab.is-active {
  background: #ede9fe;
  color: #6d28d9;
  font-weight: 600;
}

.ns-meta-bar,
.nr-meta-bar {
  margin-bottom: 8px;
  font-size: 12px;
  color: var(--bd-text-secondary);
}

/* 共享表格 */
.nc-table-wrap {
  background: var(--bd-card);
  border: 1px solid var(--bd-border);
  border-radius: 8px;
  overflow-x: auto;
}

.nc-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 1100px;
}

.nc-table th,
.nc-table td {
  padding: 10px 8px;
  border-bottom: 1px solid var(--bd-border);
  vertical-align: top;
  text-align: left;
}

.nc-table th {
  background: #fafbfc;
  font-weight: 600;
  font-size: 12px;
  color: var(--bd-text-secondary);
  white-space: nowrap;
}

.nc-th-basic,
.nc-td-basic {
  min-width: 320px;
}

.nc-th-cat,
.nc-td-cat {
  min-width: 72px;
  max-width: 100px;
  font-size: 11px;
  color: var(--bd-text-secondary);
}

.nc-th-num,
.nc-td-num {
  min-width: 56px;
  text-align: right;
  white-space: nowrap;
}

.nc-th-sort {
  cursor: pointer;
  user-select: none;
}

.nc-th-sort:hover {
  color: #7c3aed;
}

.nc-th-sort.is-active {
  color: #7c3aed;
}

.nc-sort-ico {
  display: inline-block;
  margin-left: 2px;
  font-size: 9px;
  line-height: 1;
  color: #94a3b8;
  vertical-align: middle;
}

.nc-sort-ico.is-active {
  color: #7c3aed;
}

.nc-th-tip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  margin: 0 2px;
  border-radius: 50%;
  background: #e2e8f0;
  color: #64748b;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  vertical-align: middle;
  cursor: help;
}

.nc-read-estimated {
  color: #64748b;
}

.nc-num-strong {
  font-weight: 600;
  color: var(--bd-text);
}

.nc-th-actions,
.nc-td-actions {
  min-width: 56px;
  white-space: nowrap;
}

.nc-th-rank,
.nc-td-rank {
  width: 48px;
  text-align: center;
}

.nc-rank-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  background: #f5f3ff;
  color: #6d28d9;
  font-weight: 700;
  font-size: 12px;
}

.nc-basic {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.nc-cover {
  width: 56px;
  height: 74px;
  border-radius: 6px;
  object-fit: cover;
  flex: 0 0 56px;
  background: #f3f4f6;
}

.nc-cover-wrap {
  position: relative;
  flex: 0 0 56px;
  width: 56px;
  height: 74px;
}

.nc-cover-wrap .nc-cover,
.nc-cover-wrap .nc-cover-ph {
  width: 100%;
  height: 100%;
  flex: none;
}

.nc-video-badge {
  position: absolute;
  left: 4px;
  bottom: 4px;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 1px 5px 1px 3px;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.62);
  color: #fff;
  font-size: 10px;
  line-height: 1.2;
  pointer-events: none;
}

.nc-video-icon {
  display: block;
  flex: 0 0 auto;
}

.nc-video-dur {
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}

.nc-cover-ph {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--bd-text-muted);
  font-size: 11px;
}

.nc-basic-body {
  flex: 1;
  min-width: 0;
}

.nc-title-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 4px;
}

.nc-brand-tag {
  display: inline-flex;
  align-items: center;
  max-width: 108px;
  padding: 0 7px;
  border: 1px solid #fb923c;
  border-radius: 4px;
  color: #ea580c;
  font-family: "Barlow Condensed", "DIN Alternate", "Arial Narrow", "PingFang SC", sans-serif;
  font-size: 11px;
  font-weight: 600;
  font-stretch: condensed;
  letter-spacing: 0.03em;
  line-height: 18px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex-shrink: 0;
}

.nc-brand-at {
  margin-right: 1px;
  font-weight: 700;
}

.nc-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--bd-text);
  text-decoration: none;
  line-height: 1.4;
}

.nc-title:hover {
  color: var(--bd-primary);
}

.nc-title-btn {
  border: none;
  background: none;
  padding: 0;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--bd-text);
  text-align: left;
  line-height: 1.4;
  cursor: pointer;
}

.nc-title-btn:hover {
  color: var(--bd-primary);
  text-decoration: underline;
}

.nc-attr,
.nc-media {
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 4px;
  background: #f3f4f6;
  color: var(--bd-text-secondary);
}

.nc-meta {
  font-size: 11px;
  color: var(--bd-text-muted);
  margin-bottom: 4px;
}

.nc-meta-dot {
  margin: 0 4px;
}

.nc-meta-times {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.nc-meta-times-inline {
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  margin-top: 2px;
}

.nc-meta-label {
  color: var(--bd-text-secondary);
  margin-right: 4px;
}

.nc-meta-sep {
  margin: 0 6px;
  color: #d1d5db;
}

.nc-author {
  color: var(--bd-text-secondary);
  text-decoration: none;
}

.nc-author:hover {
  color: var(--bd-primary);
}

.nc-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.nc-tag {
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 4px;
  background: #eef2ff;
  color: #4338ca;
}

.nc-link {
  font-size: 12px;
  color: var(--bd-primary);
  text-decoration: none;
}

.nc-link:hover {
  text-decoration: underline;
}

.nc-status {
  text-align: center;
  padding: 16px;
  color: var(--bd-text-muted);
  font-size: 12px;
}

.nc-status-error {
  color: var(--bd-down);
}

.nc-sentinel {
  height: 40px;
}

.nc-load-more {
  display: flex;
  justify-content: center;
  padding: 8px 0 0;
}

.nc-load-more-btn {
  height: 34px;
  padding: 0 18px;
  border: 1px solid #d8b4fe;
  border-radius: 8px;
  background: #fff;
  color: #7c3aed;
  font-size: 13px;
  cursor: pointer;
}

.ns-empty,
.nr-empty {
  background: var(--bd-card);
  border: 1px dashed var(--bd-border);
  border-radius: 8px;
  padding: 48px 24px;
  text-align: center;
}

.ns-empty h3,
.nr-empty h3 {
  margin-bottom: 8px;
}

.ns-empty p,
.nr-empty p {
  color: var(--bd-text-secondary);
}

/* —— 高级搜索 —— */
.ns-adv-open {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 12px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  background: #fff;
  color: var(--bd-text, #374151);
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
}

.ns-adv-open:hover {
  border-color: #7c3aed;
  color: #7c3aed;
}

.ns-adv-open.is-active {
  border-color: #7c3aed;
  color: #7c3aed;
  background: #f5f3ff;
}

.ns-adv-btn-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: #7c3aed;
  color: #fff;
  font-size: 11px;
  font-weight: 600;
}

.ns-adv-summary {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: -2px 0 10px;
  padding: 6px 10px;
  background: #f5f3ff;
  border: 1px solid #e9e0ff;
  border-radius: 6px;
  font-size: 12px;
  color: #5b21b6;
}

.ns-brand-filter {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 8px 0 0;
  padding: 6px 10px;
  border-radius: 999px;
  background: #fff1f2;
  border: 1px solid #fecdd3;
  font-size: 12px;
  color: #be123c;
}

.ns-brand-clear {
  border: none;
  background: transparent;
  color: #be123c;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  padding: 0 2px;
}
  display: flex;
  align-items: center;
  gap: 10px;
  margin: -2px 0 10px;
  padding: 6px 10px;
  background: #f5f3ff;
  border: 1px solid #e9e0ff;
  border-radius: 6px;
  font-size: 12px;
  color: #5b21b6;
}

.ns-adv-clear {
  border: none;
  background: transparent;
  color: #7c3aed;
  font-size: 12px;
  cursor: pointer;
  text-decoration: underline;
  padding: 0;
}

body.ns-modal-open {
  overflow: hidden;
}

.ns-adv-modal[hidden] {
  display: none !important;
}

.ns-adv-modal {
  position: fixed;
  inset: 0;
  z-index: 1300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}

.ns-adv-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
}

.ns-adv-panel {
  position: relative;
  width: min(640px, 100%);
  max-height: min(88vh, 820px);
  background: #fff;
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.18);
}

.ns-adv-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px 12px;
  border-bottom: 1px solid var(--bd-border, #e5e7eb);
}

.ns-adv-head h3 {
  font-size: 16px;
  font-weight: 600;
  margin: 0;
}

.ns-adv-head-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.ns-adv-pro-tip {
  font-size: 12px;
  color: #7c3aed;
  background: #f5f3ff;
  border: 1px solid #e9e0ff;
  border-radius: 4px;
  padding: 3px 8px;
  white-space: nowrap;
}

.ns-adv-close {
  border: none;
  background: transparent;
  font-size: 22px;
  color: #9ca3af;
  cursor: pointer;
  line-height: 1;
  padding: 0 2px;
}

.ns-adv-body {
  flex: 1;
  overflow: auto;
  padding: 14px 18px 8px;
  background: #f8fafc;
}

.ns-adv-section-label {
  font-size: 13px;
  font-weight: 600;
  color: #374151;
  margin-bottom: 10px;
  padding-left: 8px;
  border-left: 3px solid #7c3aed;
}

.ns-adv-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 10px;
}

.ns-adv-card-head h4 {
  margin: 0 0 4px;
  font-size: 13px;
  font-weight: 600;
  color: #111827;
}

.ns-adv-count {
  font-weight: 500;
  color: #6b7280;
}

.ns-adv-card-head p {
  margin: 0 0 10px;
  font-size: 12px;
  color: #6b7280;
  line-height: 1.45;
}

.ns-adv-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 0;
  margin-bottom: 8px;
}

.ns-adv-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 4px;
  background: #f5f3ff;
  border: 1px solid #ddd6fe;
  color: #5b21b6;
  font-size: 12px;
}

.ns-adv-chip-x {
  border: none;
  background: transparent;
  color: #9ca3af;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  padding: 0 0 0 2px;
}

.ns-adv-chip-x:hover {
  color: #7c3aed;
}

.ns-adv-add-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.ns-adv-input {
  flex: 1;
  min-width: 0;
  height: 32px;
  padding: 0 10px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 12px;
}

.ns-adv-input:focus {
  outline: none;
  border-color: #7c3aed;
}

.ns-adv-input:disabled {
  background: #f3f4f6;
  cursor: not-allowed;
}

.ns-adv-add-btn {
  flex: 0 0 auto;
  height: 32px;
  padding: 0 12px;
  border: 1px dashed #c4b5fd;
  border-radius: 6px;
  background: #faf5ff;
  color: #7c3aed;
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
}

.ns-adv-add-btn:hover:not(:disabled) {
  background: #f5f3ff;
  border-style: solid;
}

.ns-adv-add-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.ns-adv-foot {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 12px 18px;
  border-top: 1px solid var(--bd-border, #e5e7eb);
  background: #fff;
}

.ns-adv-btn {
  height: 34px;
  padding: 0 18px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  background: #fff;
  color: #374151;
  font-size: 13px;
  cursor: pointer;
}

.ns-adv-btn-primary {
  border-color: #7c3aed;
  background: #7c3aed;
  color: #fff;
  font-weight: 600;
}

.ns-adv-btn-primary:hover {
  background: #6d28d9;
}

@media (max-width: 768px) {
  .bd-main:has(> #bdNoteSearch:not([hidden])),
  .bd-main:has(> #bdNoteRank:not([hidden])) {
    padding: 8px 10px 16px;
  }

  .ns-adv-panel {
    width: 100%;
    max-height: 92vh;
  }

  .ns-adv-pro-tip {
    display: none;
  }

  .ns-adv-add-row {
    flex-direction: column;
    align-items: stretch;
  }
}
