* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
  --primary: #059669;
  --primary-dark: #047857;
  --primary-light: #a7f3d0;
  --primary-bg: #ecfdf5;
  --primary-border: #6ee7b7;

  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-tertiary: #94a3b8;

  --bg-page: #f8fafc;
  --bg-card: #ffffff;
  --bg-soft: #f1f5f9;
  --bg-hover: #f8fafc;

  --border: #e2e8f0;
  --border-light: #f1f5f9;

  --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 4px 6px -1px rgba(15, 23, 42, 0.07), 0 2px 4px -2px rgba(15, 23, 42, 0.04);

  --r-sm: 4px;
  --r-md: 6px;
  --r-lg: 8px;
  --r-xl: 12px;

  --t-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --t-base: 200ms cubic-bezier(0.4, 0, 0.2, 1);
}

body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI",
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg-page);
  color: var(--text-primary);
  font-size: 13px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.header {
  background: var(--primary-dark);
  color: white;
  padding: 0;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.header-content {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 48px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-icon {
  width: 28px;
  height: 28px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: var(--r-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.logo-text {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.logo-text h1 {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.logo-text p {
  font-size: 11px;
  opacity: 0.7;
  font-weight: 400;
}

.header-stats {
  display: flex;
  align-items: center;
  gap: 12px;
}

.stat-item {
  display: flex;
  align-items: baseline;
  gap: 4px;
  padding: 0 12px;
  border-right: 1px solid rgba(255, 255, 255, 0.15);
}

.stat-value {
  font-size: 18px;
  font-weight: 700;
  line-height: 1;
}

.stat-label {
  font-size: 11px;
  opacity: 0.7;
}

.main {
  max-width: 1280px;
  margin: 0 auto;
  padding: 12px 20px;
}

.container {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.filter-section {
  background: var(--bg-card);
  border-radius: var(--r-lg);
  padding: 12px 16px;
  box-shadow: var(--shadow-xs);
  border: 1px solid var(--border);
}

.search-box {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}

.search-input {
  flex: 1;
  padding: 7px 12px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  font-size: 13px;
  transition: all var(--t-fast);
  outline: none;
  background: var(--bg-page);
  font-family: inherit;
}

.search-input:focus {
  border-color: var(--primary);
  background: white;
  box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.1);
}

.search-btn {
  padding: 7px 16px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: var(--r-md);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all var(--t-fast);
  font-family: inherit;
}

.search-btn:hover {
  background: var(--primary-dark);
}

.search-btn svg {
  width: 14px;
  height: 14px;
}

.filter-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: flex-end;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 1;
  min-width: 120px;
}

.filter-group label {
  font-size: 11px;
  color: var(--text-tertiary);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.filter-group select,
.filter-group input[type="date"] {
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  font-size: 12px;
  background: white;
  cursor: pointer;
  outline: none;
  transition: all var(--t-fast);
  font-family: inherit;
  color: var(--text-primary);
}

.filter-group select:focus,
.filter-group input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(5, 150, 105, 0.1);
}

.reset-btn {
  padding: 6px 12px;
  background: var(--bg-soft);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  font-size: 12px;
  cursor: pointer;
  transition: all var(--t-fast);
  white-space: nowrap;
  font-family: inherit;
}

.reset-btn:hover {
  background: var(--border);
  color: var(--text-primary);
}

.results-section {
  background: var(--bg-card);
  border-radius: var(--r-lg);
  padding: 12px 16px;
  box-shadow: var(--shadow-xs);
  border: 1px solid var(--border);
  min-height: 400px;
}

.results-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-light);
}

.results-header h2 {
  font-size: 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
}

.result-count {
  background: var(--primary-bg);
  color: var(--primary-dark);
  padding: 1px 8px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 600;
}

.sort-group {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-secondary);
}

.sort-group select {
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  font-size: 12px;
  background: white;
  cursor: pointer;
  outline: none;
  font-family: inherit;
  color: var(--text-primary);
}

.results-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.result-item {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  cursor: pointer;
  transition: all var(--t-fast);
  background: white;
}

.result-item:hover {
  border-color: var(--primary-border);
  background: var(--bg-hover);
  box-shadow: var(--shadow-sm);
}

.result-item-main {
  flex: 1;
  min-width: 0;
}

.result-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 5px;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.result-item:hover .result-title {
  color: var(--primary-dark);
}

.result-meta {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 11px;
  color: var(--text-tertiary);
  align-items: center;
}

.meta-item {
  display: flex;
  align-items: center;
  gap: 3px;
}

.meta-badge {
  display: inline-block;
  padding: 1px 6px;
  border-radius: var(--r-sm);
  font-size: 10px;
  font-weight: 600;
}

.meta-badge.site {
  background: #eff6ff;
  color: #2563eb;
}

.keyword-tags {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.keyword-tag {
  padding: 1px 6px;
  background: #fef3c7;
  color: #92400e;
  border-radius: var(--r-sm);
  font-size: 10px;
  font-weight: 600;
}

.click-count {
  color: var(--primary);
  font-weight: 600;
}

.result-item-actions {
  flex-shrink: 0;
  display: flex;
  align-items: center;
}

.mark-select {
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  font-size: 11px;
  background: white;
  color: var(--text-secondary);
  cursor: pointer;
  outline: none;
  transition: all var(--t-fast);
  font-family: inherit;
}

.mark-select:hover {
  border-color: var(--primary);
}

.mark-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(5, 150, 105, 0.1);
}

.mark-badge {
  display: inline-block;
  padding: 1px 6px;
  border: 1px solid;
  border-radius: var(--r-sm);
  font-size: 10px;
  font-weight: 600;
  margin-left: 6px;
  vertical-align: middle;
}

.result-item.is-important {
  border-color: #fca5a5;
  border-width: 1px;
  background: #fffbeb;
}

.result-item.is-ignore {
  opacity: 0.55;
  background: #f9fafb;
  border-color: #e5e7eb;
}

.result-note {
  width: 100%;
  margin-top: 4px;
  padding: 8px 12px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 6px;
  font-size: 12px;
  color: #dc2626;
  line-height: 1.5;
  cursor: pointer;
  display: flex;
  gap: 6px;
  align-items: flex-start;
  box-sizing: border-box;
}

.result-note:hover {
  background: #fee2e2;
}

.note-label {
  flex-shrink: 0;
  font-weight: 600;
  color: #b91c1c;
}

.note-text {
  flex: 1;
  white-space: pre-wrap;
  word-break: break-all;
}

.result-note-edit {
  width: 100%;
  margin-top: 4px;
  padding: 8px;
  background: #fff5f5;
  border: 1px solid #fecaca;
  border-radius: 6px;
  box-sizing: border-box;
}

.note-textarea {
  width: 100%;
  min-height: 60px;
  padding: 8px;
  border: 1px solid #fecaca;
  border-radius: 4px;
  font-size: 12px;
  font-family: inherit;
  resize: vertical;
  outline: none;
  box-sizing: border-box;
  background: white;
}

.note-textarea:focus {
  border-color: #dc2626;
  box-shadow: 0 0 0 2px rgba(220, 38, 38, 0.1);
}

.note-edit-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  justify-content: flex-end;
}

.note-save-btn {
  padding: 5px 14px;
  background: #dc2626;
  color: white;
  border: none;
  border-radius: 4px;
  font-size: 12px;
  cursor: pointer;
  font-weight: 500;
}

.note-save-btn:hover {
  background: #b91c1c;
}

.note-cancel-btn {
  padding: 5px 14px;
  background: #f3f4f6;
  color: #4b5563;
  border: 1px solid #e5e7eb;
  border-radius: 4px;
  font-size: 12px;
  cursor: pointer;
}

.note-cancel-btn:hover {
  background: #e5e7eb;
}

.note-edit-btn {
  padding: 4px 8px;
  background: transparent;
  border: 1px solid #e5e7eb;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  margin-left: 4px;
}

.note-edit-btn:hover {
  background: #fef2f2;
  border-color: #fecaca;
}

.detail-note {
  font-size: 13px;
  line-height: 1.7;
  color: #dc2626;
  white-space: pre-wrap;
  word-break: break-word;
  background: #fef2f2;
  padding: 12px 14px;
  border-radius: var(--r-md);
  border: 1px solid #fecaca;
}

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-tertiary);
}

.empty-state svg {
  width: 40px;
  height: 40px;
  margin: 0 auto 12px;
  opacity: 0.4;
}

.empty-state p {
  font-size: 13px;
  margin-bottom: 4px;
}

.empty-hint {
  font-size: 12px;
  color: var(--text-tertiary);
}

.pagination {
  display: flex;
  justify-content: center;
  gap: 4px;
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--border-light);
}

.page-btn {
  min-width: 28px;
  height: 28px;
  padding: 0 8px;
  border: 1px solid var(--border);
  background: white;
  border-radius: var(--r-sm);
  font-size: 12px;
  cursor: pointer;
  transition: all var(--t-fast);
  color: var(--text-secondary);
  font-family: inherit;
}

.page-btn:hover:not(:disabled):not(.active) {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-bg);
}

.page-btn.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.page-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1000;
  display: none;
}

.modal.show {
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(4px);
}

.modal-content {
  position: relative;
  background: white;
  border-radius: var(--r-xl);
  width: 90%;
  max-width: 760px;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: var(--shadow-md);
  animation: modalIn 200ms cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes modalIn {
  from { opacity: 0; transform: translateY(-12px); }
  to { opacity: 1; transform: translateY(0); }
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 28px;
  height: 28px;
  border: none;
  background: var(--bg-soft);
  border-radius: 50%;
  font-size: 18px;
  cursor: pointer;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--t-fast);
  z-index: 10;
  line-height: 1;
}

.modal-close:hover {
  background: var(--border);
  color: var(--text-primary);
}

.modal-body {
  padding: 20px 24px;
}

.detail-title {
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 10px;
  line-height: 1.4;
  color: var(--text-primary);
}

.detail-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-light);
  align-items: center;
}

.detail-section {
  margin-top: 16px;
}

.detail-section h3 {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
  padding-left: 8px;
  border-left: 3px solid var(--primary);
}

.detail-content {
  font-size: 13px;
  line-height: 1.7;
  color: var(--text-secondary);
  white-space: pre-wrap;
  word-break: break-word;
  background: var(--bg-page);
  padding: 12px 14px;
  border-radius: var(--r-md);
  max-height: 280px;
  overflow-y: auto;
  border: 1px solid var(--border-light);
}

.detail-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 14px;
  padding: 7px 16px;
  background: var(--primary);
  color: white;
  text-decoration: none;
  border-radius: var(--r-md);
  font-size: 12px;
  font-weight: 500;
  transition: all var(--t-fast);
}

.detail-link:hover {
  background: var(--primary-dark);
}

.detail-link svg {
  width: 13px;
  height: 13px;
}

.highlight {
  background: #fef08a;
  padding: 0 2px;
  border-radius: 2px;
  font-weight: 500;
}

::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-tertiary);
}

@media (max-width: 768px) {
  .header-content {
    height: auto;
    padding: 10px 16px;
    flex-direction: column;
    gap: 8px;
    align-items: stretch;
  }

  .header-stats {
    justify-content: center;
    flex-wrap: wrap;
  }

  .stat-item {
    border-right: none;
    padding: 0 8px;
  }

  .main {
    padding: 10px 12px;
  }

  .filter-row {
    flex-direction: column;
  }

  .filter-group {
    min-width: 100%;
  }

  .modal-content {
    width: 95%;
    max-height: 90vh;
  }

  .modal-body {
    padding: 16px;
  }
}