/* 小红书助手后台 — 设计系统
   品牌红 #FF2442 + 粉色浅底 + 白卡片 + 柔和阴影。无外部字体依赖（本地/离线可用）。 */

:root {
  --red: #ff2442;
  --red-dark: #e01030;
  --red-soft: #fff0f2;
  --red-softer: #fff7f8;
  --ink: #1f1f24;
  --ink-2: #5b5b66;
  --ink-3: #9a9aa6;
  --line: #ececed;
  --line-2: #f4f4f6;
  --bg: #fafbfc;
  --card: #ffffff;
  --ok: #1aab5b;
  --ok-soft: #e7f7ee;
  --warn: #f59e0b;
  --warn-soft: #fff4e0;
  --err: #ef4444;
  --err-soft: #fdecec;
  --info: #3b82f6;
  --info-soft: #eaf2ff;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(20, 20, 30, .04), 0 10px 30px -14px rgba(20, 20, 30, .12);
  --shadow-lg: 0 2px 6px rgba(20, 20, 30, .05), 0 24px 48px -20px rgba(20, 20, 30, .22);
  --font: "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", "Segoe UI", system-ui, sans-serif;
  --mono: "SF Mono", "JetBrains Mono", "Roboto Mono", ui-monospace, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(120% 60% at 50% -10%, var(--red-soft) 0%, rgba(255, 240, 242, 0) 55%),
    var(--bg);
  background-attachment: fixed;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

/* ---------- 顶栏导航 ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: saturate(180%) blur(12px);
  background: rgba(255, 255, 255, .82);
  border-bottom: 1px solid var(--line);
}
.topbar__inner {
  max-width: 1040px;
  margin: 0 auto;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  gap: 20px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-weight: 800;
  font-size: 17px;
  letter-spacing: -.01em;
  color: var(--ink);
  text-decoration: none;
}
.brand__mark {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--red) 0%, #ff5a72 100%);
  box-shadow: 0 4px 12px -3px rgba(255, 36, 66, .6);
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 15px;
  font-weight: 900;
}
.nav { display: flex; gap: 4px; margin-left: auto; }
.nav a {
  padding: 7px 16px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-2);
  text-decoration: none;
  transition: background .15s, color .15s;
}
.nav a:hover { background: var(--line-2); color: var(--ink); }
.nav a.active { background: var(--red); color: #fff; box-shadow: 0 6px 16px -8px rgba(255, 36, 66, .8); }

/* ---------- 布局 ---------- */
.wrap { max-width: 1040px; margin: 0 auto; padding: 28px 24px 80px; }
.page-head { margin: 4px 0 22px; }
.page-head h1 { font-size: 24px; font-weight: 800; letter-spacing: -.02em; margin: 0 0 4px; }
.page-head p { margin: 0; color: var(--ink-3); font-size: 14px; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px 24px;
  margin-bottom: 18px;
  animation: rise .5s cubic-bezier(.2, .7, .3, 1) both;
}
.card > .card__title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--red);
  margin: 0 0 16px;
}
.card > .card__title::before {
  content: "";
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--red);
}
.card > .card__hint { color: var(--ink-3); font-size: 13px; margin: -10px 0 16px; }

/* staggered reveal */
.card:nth-child(1) { animation-delay: .02s; }
.card:nth-child(2) { animation-delay: .08s; }
.card:nth-child(3) { animation-delay: .14s; }
.card:nth-child(4) { animation-delay: .20s; }
.card:nth-child(5) { animation-delay: .26s; }
.card:nth-child(6) { animation-delay: .32s; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .card { animation: none; } }

/* ---------- 状态 Hero ---------- */
.hero {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 14px;
}
.stat {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px 18px;
  background: linear-gradient(180deg, #fff, #fcfcfd);
}
.stat__label { font-size: 12px; color: var(--ink-3); font-weight: 600; margin-bottom: 6px; }
.stat__value { font-size: 26px; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat__value small { font-size: 14px; font-weight: 600; color: var(--ink-3); }
.stat--accent { background: linear-gradient(160deg, var(--red-soft), #fff); border-color: #ffd9df; }

/* ---------- 徽章 ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 11px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.6;
}
.badge .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge--ok { background: var(--ok-soft); color: #128a47; }
.badge--warn { background: var(--warn-soft); color: #b46a00; }
.badge--err { background: var(--err-soft); color: #c42b2b; }
.badge--info { background: var(--info-soft); color: #2563c9; }
.badge--muted { background: var(--line-2); color: var(--ink-2); }
.badge--run { background: var(--info-soft); color: #2563c9; }
.badge--run .dot { animation: pulse 1.3s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: .35; transform: scale(1.5); } }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: transform .08s, box-shadow .15s, background .15s, border-color .15s;
}
.btn:active { transform: translateY(1px); }
.btn--primary { background: var(--red); color: #fff; box-shadow: 0 8px 20px -10px rgba(255, 36, 66, .9); }
.btn--primary:hover { background: var(--red-dark); }
.btn--ghost { background: #fff; color: var(--ink); border-color: var(--line); }
.btn--ghost:hover { border-color: var(--ink-3); }
.btn:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* ---------- 表单 ---------- */
.field { margin-bottom: 18px; }
.field:last-child { margin-bottom: 0; }
.field > label { display: block; font-size: 13.5px; font-weight: 600; margin-bottom: 7px; }
.field .help { color: var(--ink-3); font-size: 12.5px; font-weight: 400; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 640px) { .grid-2 { grid-template-columns: 1fr; } }

input[type=text], input[type=number], input[type=time], input[type=url], select, textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 14px;
  color: var(--ink);
  background: #fff;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(255, 36, 66, .12);
}
.range-grid input { width: auto; }

/* 滑块 */
input[type=range] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 999px;
  background: var(--line);
  accent-color: var(--red);
  cursor: pointer;
}
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--red);
  border: 3px solid #fff;
  box-shadow: 0 2px 6px rgba(255, 36, 66, .5);
}
input[type=range]::-moz-range-thumb {
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--red); border: 3px solid #fff;
  box-shadow: 0 2px 6px rgba(255, 36, 66, .5);
}

/* 滑块 + 数值 行 */
.slider {
  display: grid;
  grid-template-columns: 1fr 58px;
  align-items: center;
  gap: 14px;
}
.slider output {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  font-size: 14px;
  color: var(--red);
  text-align: right;
  background: var(--red-soft);
  padding: 3px 8px;
  border-radius: 8px;
}

/* 范围 min~max */
.minmax { display: inline-flex; align-items: center; gap: 10px; }
.minmax input { width: 84px; text-align: center; }
.minmax .tilde { color: var(--ink-3); font-weight: 600; }
.minmax .unit { color: var(--ink-2); font-size: 13px; }

/* 动态行（兴趣词 / 时段） */
.rows { display: flex; flex-direction: column; gap: 10px; }
.row-item {
  display: grid;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fcfcfd;
}
.row-item.interest { grid-template-columns: 1.4fr 2fr auto; }
.row-item.window { grid-template-columns: auto auto 2fr auto; }
.row-item .mini { display: flex; align-items: center; gap: 8px; }
.row-item .mini output {
  font-variant-numeric: tabular-nums; font-weight: 700; color: var(--red);
  min-width: 34px; text-align: right; font-size: 13px;
}
.icon-btn {
  border: none; background: transparent; cursor: pointer;
  width: 30px; height: 30px; border-radius: 8px;
  color: var(--ink-3); font-size: 17px; line-height: 1;
  display: grid; place-items: center;
  transition: background .15s, color .15s;
}
.icon-btn:hover { background: var(--err-soft); color: var(--err); }
.add-btn {
  align-self: flex-start;
  border: 1px dashed #ffc2cb;
  background: var(--red-softer);
  color: var(--red);
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-weight: 600; font-size: 13.5px; cursor: pointer;
  transition: background .15s;
}
.add-btn:hover { background: var(--red-soft); }

/* chips（负向词） */
.chips { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 6px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: #fff; }
.chips:focus-within { border-color: var(--red); box-shadow: 0 0 0 3px rgba(255, 36, 66, .12); }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--red-soft); color: var(--red-dark);
  padding: 4px 6px 4px 12px; border-radius: 999px;
  font-size: 13px; font-weight: 600;
}
.chip button { border: none; background: transparent; color: var(--red-dark); cursor: pointer; font-size: 15px; line-height: 1; opacity: .6; }
.chip button:hover { opacity: 1; }
.chips input { border: none; box-shadow: none; flex: 1; min-width: 120px; padding: 6px; }
.chips input:focus { box-shadow: none; }

/* toggle 开关 */
.switch,
.field > label.switch { position: relative; display: inline-flex; align-items: center; gap: 10px; margin-bottom: 0; cursor: pointer; user-select: none; font-weight: 600; font-size: 14px; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch .track { display: inline-block; width: 44px; height: 25px; border-radius: 999px; background: var(--line); transition: background .2s; position: relative; flex: none; }
.switch .track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 19px; height: 19px; border-radius: 50%; background: #fff; box-shadow: 0 2px 5px rgba(0,0,0,.2); transition: transform .2s; }
.switch input:checked + .track { background: var(--red); }
.switch input:checked + .track::after { transform: translateX(19px); }

/* ---------- 表格 ---------- */
.table-wrap { overflow-x: auto; margin: 0 -4px; }
table.data { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
table.data th {
  text-align: left; font-weight: 600; color: var(--ink-3);
  font-size: 12px; letter-spacing: .02em; padding: 8px 12px;
  border-bottom: 1px solid var(--line); white-space: nowrap;
}
table.data td { padding: 11px 12px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
table.data tr:last-child td { border-bottom: none; }
table.data tbody tr { transition: background .12s; }
table.data tbody tr:hover { background: var(--red-softer); }
table.data .num { font-variant-numeric: tabular-nums; }
table.data a.link { color: var(--ink); text-decoration: none; font-weight: 600; }
table.data a.link:hover { color: var(--red); }
.t-muted { color: var(--ink-3); }
.t-time { font-variant-numeric: tabular-nums; color: var(--ink-2); white-space: nowrap; font-size: 12.5px; }
.sid-link { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--red); text-decoration: none; }
.sid-link:hover { text-decoration: underline; }

.empty { text-align: center; color: var(--ink-3); padding: 36px 0; font-size: 14px; }
.empty .big { font-size: 32px; margin-bottom: 8px; }

/* 兴趣分色条 */
.scorebar { display: inline-flex; align-items: center; gap: 8px; }
.scorebar .bar { width: 52px; height: 6px; border-radius: 999px; background: var(--line); overflow: hidden; }
.scorebar .bar i { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, #ffb3bf, var(--red)); }
.scorebar .v { font-variant-numeric: tabular-nums; font-size: 12.5px; color: var(--ink-2); }

/* 保存横幅 toast */
.toast {
  display: flex; align-items: center; gap: 10px;
  background: var(--ok-soft); color: #0f7a3d;
  border: 1px solid #b6e9cb; border-radius: 12px;
  padding: 12px 16px; margin-bottom: 18px; font-weight: 600; font-size: 14px;
  animation: rise .4s both;
}
.toast .x { width: 22px; height: 22px; border-radius: 50%; background: var(--ok); color: #fff; display: grid; place-items: center; font-size: 13px; }

/* 选择行（浏览数据） */
.picker { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.picker .field { margin: 0; }
.picker select { min-width: 280px; }

.updated { font-size: 12px; color: var(--ink-3); }
.updated .live { color: var(--ok); font-weight: 600; }
