:root {
  --bg: #f6f7fb;
  --surface: #ffffff;
  --border: #e6e9f0;
  --border-strong: #d8dde8;
  --text: #1b2030;
  --text-2: #454d61;
  --muted: #798196;
  --primary: #2f5bea;
  --primary-hover: #2449c9;
  --primary-soft: #eef2ff;
  --danger: #d94b45;
  --danger-soft: #fff1f0;
  --ok: #0e9f8c;
  --radius: 14px;
  --shadow-sm: 0 1px 2px rgba(27, 32, 48, .04), 0 4px 14px rgba(27, 32, 48, .035);
  --shadow-md: 0 6px 14px rgba(27, 32, 48, .07), 0 18px 44px rgba(27, 32, 48, .08);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", sans-serif;
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
.hidden { display: none !important; }
.wrap { width: min(1180px, calc(100% - 48px)); margin: 0 auto; }

/* ---------- header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 30;
  background: rgba(255, 255, 255, .86);
  backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--border);
}
.header-inner { height: 68px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.brand { display: flex; align-items: center; gap: 11px; }
.brand-mark {
  width: 34px; height: 34px; display: grid; place-items: center;
  border-radius: 10px; background: linear-gradient(135deg, #3a63ef, #6f8bff);
  color: #fff; font-size: 18px; line-height: 1;
  box-shadow: 0 4px 12px rgba(47, 91, 234, .25);
}
.brand-text { font-size: 16px; font-weight: 700; letter-spacing: .2px; display: flex; align-items: baseline; gap: 10px; }
.brand-text small { font-size: 10px; font-weight: 600; letter-spacing: 1.4px; color: var(--muted); }
.header-actions { display: flex; align-items: center; gap: 12px; }
.admin-badge {
  font-size: 12px; color: var(--ok); background: #e9f8f5;
  border: 1px solid #c9ede7; padding: 4px 10px; border-radius: 999px;
}

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  border: 1px solid transparent; border-radius: 10px;
  padding: 9px 16px; font-size: 13px; font-weight: 600;
  transition: background .16s, border-color .16s, transform .16s, box-shadow .16s;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 3px 10px rgba(47, 91, 234, .2); }
.btn-primary:hover { background: var(--primary-hover); }
.btn-primary:disabled { opacity: .55; cursor: not-allowed; box-shadow: none; }
.plus { font-size: 17px; font-weight: 400; line-height: 1; margin-top: -1px; }
.btn-ghost { background: #fff; border-color: var(--border-strong); color: var(--text-2); }
.btn-ghost:hover { background: #f7f8fc; }
.btn-ai {
  background: linear-gradient(135deg, #f3efff, #eaf1ff);
  color: #5b46c9; border-color: #ddd5fb;
}
.btn-ai:hover { background: linear-gradient(135deg, #ece5ff, #e2ecff); }
.btn-ai:disabled { opacity: .6; cursor: progress; }
.spark { font-size: 14px; }
.btn-block { width: 100%; padding: 11px 16px; }

/* ---------- hero ---------- */
.hero {
  position: relative; padding: 62px 0 30px; overflow: hidden;
}
.hero::before {
  content: ""; position: absolute; z-index: -1; pointer-events: none;
  width: 620px; height: 420px; right: -120px; top: -190px;
  background: radial-gradient(ellipse at center, rgba(112, 137, 255, .17), rgba(112, 137, 255, 0) 68%);
}
.hero::after {
  content: ""; position: absolute; z-index: -1; pointer-events: none;
  width: 420px; height: 320px; left: -180px; top: 20px;
  background: radial-gradient(ellipse at center, rgba(14, 159, 140, .10), rgba(14, 159, 140, 0) 70%);
}
.hero-eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 12px; font-weight: 600; letter-spacing: .6px; color: var(--primary);
  background: var(--primary-soft); border: 1px solid #dbe3ff;
  padding: 5px 12px; border-radius: 999px;
}
.dot { width: 6px; height: 6px; border-radius: 50%; background: var(--primary); }
.hero h1 { margin: 20px 0 12px; font-size: clamp(30px, 4vw, 44px); line-height: 1.25; letter-spacing: -.6px; font-weight: 750; }
.hero h1 em { font-style: normal; color: var(--primary); }
.hero-desc { margin: 0; max-width: 660px; color: var(--text-2); font-size: 15px; }

.search-box {
  position: relative; margin-top: 30px; max-width: 560px;
  display: flex; align-items: center;
  background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: 12px; box-shadow: var(--shadow-sm);
  transition: border-color .18s, box-shadow .18s;
}
.search-box:focus-within { border-color: #9db2f7; box-shadow: 0 0 0 3px rgba(47, 91, 234, .1), var(--shadow-sm); }
.search-icon { width: 18px; height: 18px; margin-left: 16px; color: var(--muted); flex: none; }
.search-box input {
  flex: 1; min-width: 0; border: none; outline: none; background: transparent;
  padding: 13px 12px; font-size: 14px;
}
.search-box input::placeholder { color: #9aa2b5; }
.search-box kbd {
  margin-right: 14px; font-size: 11px; color: var(--muted);
  border: 1px solid var(--border); border-bottom-width: 2px;
  border-radius: 5px; padding: 1px 6px; background: #fafbfe;
}
.hero-stats { display: flex; gap: 26px; margin-top: 22px; color: var(--muted); font-size: 13px; }
.hero-stats b { color: var(--text); font-size: 16px; font-weight: 700; margin-right: 4px; }

/* ---------- filters ---------- */
.filters {
  display: flex; align-items: center; justify-content: space-between;
  gap: 18px; flex-wrap: wrap;
  padding: 20px 0 18px; margin-top: 18px;
  border-bottom: 1px solid var(--border);
}
.kind-tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.kind-tab {
  border: 1px solid transparent; background: transparent;
  padding: 7px 15px; border-radius: 999px; font-size: 13px; font-weight: 600; color: var(--text-2);
  transition: background .16s, color .16s, border-color .16s;
}
.kind-tab:hover { background: #eef0f7; }
.kind-tab.active { background: var(--text); color: #fff; }
.kind-tab .cnt { opacity: .55; font-size: 11px; margin-left: 5px; }
.filter-right { display: flex; align-items: center; gap: 16px; }
.select {
  appearance: none; background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23798196' stroke-width='3'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat right 11px center;
  border: 1px solid var(--border-strong); border-radius: 9px;
  padding: 8px 32px 8px 12px; font-size: 13px; outline: none; min-width: 130px;
}
.select:focus { border-color: #9db2f7; box-shadow: 0 0 0 3px rgba(47, 91, 234, .1); }
.toggle { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; color: var(--text-2); cursor: pointer; white-space: nowrap; }
.toggle input { accent-color: var(--primary); width: 15px; height: 15px; }

/* ---------- status ---------- */
.status-bar {
  margin-top: 22px; padding: 11px 15px; border-radius: 10px;
  font-size: 13px; border: 1px solid var(--border); background: #fff; color: var(--text-2);
}
.status-bar.error { background: var(--danger-soft); border-color: #f4c9c6; color: #a5322d; }
.status-bar.info { background: var(--primary-soft); border-color: #dbe3ff; color: #2b4bb8; }

/* ---------- grid / card ---------- */
.grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(292px, 1fr));
  gap: 16px; padding: 24px 0 56px;
}
.card {
  position: relative; display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px;
  box-shadow: var(--shadow-sm);
  transition: transform .18s, box-shadow .18s, border-color .18s;
  min-height: 176px;
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: #d5dcf0; }
.card-top { display: flex; align-items: flex-start; gap: 12px; }
.card-icon {
  width: 44px; height: 44px; flex: none; border-radius: 11px;
  display: grid; place-items: center; color: #fff;
  font-size: 14px; font-weight: 700; letter-spacing: .3px;
  box-shadow: 0 3px 9px rgba(27, 32, 48, .12);
  overflow: hidden;
}
.card-heading { min-width: 0; flex: 1; }
.card-title {
  margin: 1px 0 0; font-size: 15px; font-weight: 700; line-height: 1.4;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.card-meta { display: flex; align-items: center; gap: 7px; margin-top: 5px; flex-wrap: wrap; }
.badge {
  font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 6px;
  background: #f1f3f9; color: var(--text-2); border: 1px solid var(--border);
}
.badge.featured { background: #fff5e5; color: #a86a12; border-color: #f6e2bd; }
.card-desc {
  margin: 13px 0 0; color: var(--text-2); font-size: 13px; line-height: 1.65;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  min-height: 42px;
}
.card-bottom { margin-top: auto; padding-top: 15px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.tag-list { display: flex; gap: 5px; flex-wrap: wrap; min-width: 0; }
.tag {
  font-size: 11px; color: var(--muted); background: #f6f7fb;
  border: 1px solid var(--border); border-radius: 5px; padding: 2px 7px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 96px;
}
.card-actions { display: flex; align-items: center; gap: 6px; flex: none; }
.open-link {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12px; font-weight: 600; color: var(--primary);
  padding: 5px 9px; border-radius: 8px; border: 1px solid #dbe3ff; background: var(--primary-soft);
  transition: background .16s;
}
.open-link:hover { background: #e0e8ff; }
.open-link svg { width: 12px; height: 12px; }
.delete-btn {
  width: 26px; height: 26px; border-radius: 7px; border: 1px solid var(--border);
  background: #fff; color: var(--muted); font-size: 13px; line-height: 1;
  display: grid; place-items: center;
}
.delete-btn:hover { color: var(--danger); border-color: #f0c3c0; background: var(--danger-soft); }

.skeleton {
  height: 176px; border-radius: var(--radius); border: 1px solid var(--border);
  background: linear-gradient(100deg, #fff 30%, #f0f2f8 50%, #fff 70%) 0 0 / 220% 100%;
  animation: shimmer 1.25s infinite linear;
}
@keyframes shimmer { to { background-position: -220% 0; } }

.empty { text-align: center; padding: 70px 20px 90px; color: var(--muted); }
.empty-icon { font-size: 34px; color: #c3c9d8; }
.empty h3 { margin: 12px 0 4px; color: var(--text); font-size: 16px; }
.empty p { margin: 0; font-size: 13px; }

/* ---------- footer ---------- */
.site-footer { border-top: 1px solid var(--border); background: #fff; }
.footer-inner {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 22px 0; font-size: 12px; color: var(--muted); flex-wrap: wrap;
}

/* ---------- modal ---------- */
.modal { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 20px; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(20, 25, 40, .42); backdrop-filter: blur(3px); }
.modal-panel {
  position: relative; width: min(590px, 100%); max-height: calc(100vh - 40px); overflow-y: auto;
  background: #fff; border-radius: 18px; border: 1px solid var(--border);
  box-shadow: 0 24px 70px rgba(20, 25, 40, .22);
  padding: 24px 26px 22px;
  animation: pop .18s ease-out;
}
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(.985); } }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 20px; }
.modal-kicker { font-size: 10px; font-weight: 700; letter-spacing: 1.4px; color: var(--primary); }
.modal-head h2 { margin: 4px 0 0; font-size: 20px; font-weight: 700; }
.icon-btn {
  width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--border);
  background: #fff; color: var(--muted); font-size: 13px;
}
.icon-btn:hover { background: #f5f6fa; color: var(--text); }
.step-hint { margin: 0 0 18px; color: var(--text-2); font-size: 13px; }
.field { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.field > span { font-size: 12px; font-weight: 600; color: var(--text-2); }
.field > span b { color: var(--danger); }
.field input, .field textarea {
  width: 100%; border: 1px solid var(--border-strong); border-radius: 9px;
  padding: 9px 11px; font-size: 13px; outline: none; background: #fff;
  transition: border-color .16s, box-shadow .16s; resize: vertical;
}
.field input:focus, .field textarea:focus { border-color: #9db2f7; box-shadow: 0 0 0 3px rgba(47, 91, 234, .1); }
.field input::placeholder, .field textarea::placeholder { color: #a4abc0; }
.field select { width: 100%; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid .span-2 { grid-column: 1 / -1; }
.ai-row {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  margin: 16px 0; padding: 12px 14px;
  background: linear-gradient(135deg, #f8f6ff, #f2f6ff);
  border: 1px dashed #d6d0f6; border-radius: 11px;
}
.ai-status { font-size: 12px; color: #6b6396; flex: 1; min-width: 180px; }
.ai-status.ok { color: var(--ok); }
.ai-status.warn { color: #b4771b; }
.form-error {
  margin-top: 12px; padding: 9px 12px; border-radius: 8px;
  background: var(--danger-soft); border: 1px solid #f4c9c6; color: #a5322d; font-size: 12px;
}
.modal-foot { display: flex; justify-content: flex-end; gap: 9px; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--border); }

/* ---------- toast ---------- */
.toast {
  position: fixed; z-index: 90; left: 50%; bottom: 30px; transform: translateX(-50%);
  background: #1f2434; color: #fff; font-size: 13px;
  padding: 10px 18px; border-radius: 10px; box-shadow: 0 10px 30px rgba(20, 25, 40, .25);
  animation: toastIn .18s ease-out;
}
.toast.error { background: #b43c37; }
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 8px); } }

/* ---------- 两级分类 / 编辑 / 识别来源 ---------- */
.badge.sub { background: #f0f3ff; color: #3b55b8; border-color: #dbe3ff; }
.btn-quiet { background: #fff; border-color: var(--border-strong); color: var(--muted); padding: 8px 12px; }
.btn-quiet:hover { color: var(--text); background: #f7f8fc; }
.edit-btn {
  width: 26px; height: 26px; border-radius: 7px; border: 1px solid var(--border);
  background: #fff; color: var(--muted); font-size: 14px; line-height: 1;
  display: grid; place-items: center;
}
.edit-btn:hover { color: var(--primary); border-color: #c9d5fb; background: var(--primary-soft); }
.tag-list { flex: 1; overflow: hidden; }
.source-note {
  margin-top: 14px; padding: 9px 12px; border-radius: 8px;
  background: #f6f8ff; border: 1px solid #e0e7ff; color: #4a5a8c; font-size: 12px; line-height: 1.6;
}
.field-toggle { justify-content: flex-end; }
.field-toggle > .toggle { padding: 9px 0; }
.field input[type="color"] { padding: 4px; height: 38px; cursor: pointer; }
.filter-right .select:disabled { background-color: #f6f7fb; color: #a4abc0; cursor: not-allowed; }

@media (max-width: 720px) {
  .wrap { width: min(100% - 32px, 1180px); }
  .filter-right { flex-wrap: wrap; gap: 10px; }
  .filter-right .select { flex: 1; min-width: 0; }
  .hero { padding-top: 40px; }
  .brand-text small { display: none; }
  .filters { align-items: flex-start; flex-direction: column; gap: 12px; }
  .filter-right { width: 100%; justify-content: space-between; }
  .grid { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .span-2 { grid-column: auto; }
  .modal-panel { padding: 20px 18px; }
  .hero-stats { gap: 16px; flex-wrap: wrap; }
}
