/* ============================================================
   小红书智能工作台 · 云端版
   设计语言：深色导航 + 冷色浅底 + 珊瑚红品牌点缀
   ============================================================ */

:root {
  --bg: #eef2f7;
  --bg-2: #f7f9fc;
  --surface: #ffffff;
  --line: #e4e9f2;
  --line-soft: #eef2f7;
  --ink: #0f172a;
  --ink-2: #49566b;
  --ink-3: #8b98ad;
  --brand: #ff2e55;
  --brand-2: #ff6b87;
  --brand-soft: #fff0f4;
  --brand-line: #ffd3dd;
  --indigo: #5a6bf0;
  --indigo-soft: #eef1ff;
  --teal: #0d9488;
  --teal-soft: #e6f7f5;
  --amber: #b45309;
  --amber-soft: #fff5e6;
  --ok: #0f9f6e;
  --ok-soft: #e8f8f0;
  --danger: #e11d48;
  --danger-soft: #fff0f3;
  --shadow-sm: 0 2px 8px rgba(15, 23, 42, .04);
  --shadow-md: 0 10px 30px rgba(15, 23, 42, .06);
  --shadow-lg: 0 24px 60px rgba(15, 23, 42, .10);
  --radius: 16px;
  --sidebar-w: 292px;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: var(--bg);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0;
  overflow: hidden;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
a:hover { text-decoration: none; }
.muted { color: var(--ink-3); font-weight: 400; font-size: 12px; }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: #cfd8e5;
  border-radius: 99px;
  border: 2px solid transparent;
  background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover { background: #b6c2d4; background-clip: content-box; }

.icon {
  width: 19px;
  height: 19px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ------------------------------------------------------------ 启动 */
.boot-screen {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  color: var(--ink-2);
  background:
    radial-gradient(720px 420px at 10% -10%, rgba(255, 46, 85, .08), transparent 60%),
    var(--bg);
}
.spinner {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 3px solid var(--line);
  border-top-color: var(--brand);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================
   登录页
   ============================================================ */
.login {
  height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  overflow: auto;
  background: #f4f7fb;
}
.login.single { grid-template-columns: minmax(0, 1fr); }
.login-brand {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 100vh;
  padding: 44px 56px 40px;
  color: #dfe8f6;
  background:
    radial-gradient(720px 460px at 8% 0%, rgba(255, 46, 85, .24), transparent 60%),
    radial-gradient(620px 440px at 100% 92%, rgba(90, 107, 240, .24), transparent 62%),
    linear-gradient(160deg, #0b1424 0%, #0a1220 55%, #070c16 100%);
}
.login-brand::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(255, 255, 255, .06) 1px, transparent 1px);
  background-size: 26px 26px;
  mask-image: radial-gradient(700px 600px at 20% 15%, rgba(0, 0, 0, .55), transparent 75%);
  pointer-events: none;
}
.login-brand > * { position: relative; z-index: 1; }
.login-copy { max-width: 520px; margin-top: 34px; }
.login-copy .eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 10px;
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 99px;
  background: rgba(255, 255, 255, .05);
  font-size: 10px;
  font-weight: 650;
  letter-spacing: .08em;
  color: #b7c5da;
}
.login-copy .eyebrow i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #ff5c7a;
  box-shadow: 0 0 8px #ff5c7a;
}
.login-copy h1 {
  margin: 20px 0 16px;
  font-size: 38px;
  line-height: 1.32;
  font-weight: 750;
  letter-spacing: -.02em;
  color: #fff;
}
.login-copy h1 em { font-style: normal; color: #ff8aa0; }
.login-copy p {
  margin: 0;
  max-width: 430px;
  font-size: 13px;
  line-height: 1.9;
  color: #93a3ba;
}
.feature-list { display: flex; flex-direction: column; gap: 14px; margin-top: 36px; }
.feature { display: flex; align-items: center; gap: 12px; }
.feature .f-icon {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, .10);
  border-radius: 12px;
  background: rgba(255, 255, 255, .055);
  color: #ff9daf;
}
.feature .f-icon .icon { width: 18px; height: 18px; }
.feature b { display: block; font-size: 12px; font-weight: 650; color: #e7edf7; }
.feature span { display: block; margin-top: 2px; font-size: 10.5px; color: #8495ae; }
.login-brand .foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 10px;
  color: #64748b;
}
.login-brand .foot .chips { display: flex; gap: 7px; }
.login-brand .foot .chips span {
  padding: 4px 8px;
  border: 1px solid rgba(255, 255, 255, .09);
  border-radius: 99px;
  background: rgba(255, 255, 255, .035);
}

.login-main {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 40px 32px;
  background: linear-gradient(150deg, #f7f9fc, #eef2f8 65%, #f6f8fb);
}
.login-card { width: min(408px, 100%); }
.login-card .welcome { margin-bottom: 24px; }
.login-card .welcome h2 {
  margin: 0;
  font-size: 25px;
  font-weight: 750;
  letter-spacing: -.02em;
}
.login-card .welcome p { margin: 7px 0 0; font-size: 12px; color: var(--ink-3); }
.login-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 20px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}
.login-tabs button {
  flex: 1;
  padding: 9px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink-3);
  font-size: 12px;
}
.login-tabs button.active {
  background: var(--ink);
  color: #fff;
  box-shadow: 0 6px 16px rgba(15, 23, 42, .16);
  font-weight: 650;
}
.auth-form { display: flex; flex-direction: column; gap: 14px; }
.field { display: block; }
.field label,
.field > span:first-child {
  display: block;
  margin-bottom: 6px;
  font-size: 11px;
  font-weight: 650;
  color: var(--ink-2);
}
.field label span,
.field > span:first-child span { margin-left: 5px; font-weight: 400; color: var(--ink-3); }
.field .input {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #fff;
  transition: border-color .15s, box-shadow .15s;
}
.field .input:focus-within {
  border-color: #ffb3c2;
  box-shadow: 0 0 0 3px rgba(255, 46, 85, .08);
}
.field .input .icon { width: 16px; height: 16px; color: var(--ink-3); }
.field .input input {
  width: 100%;
  border: 0;
  outline: none;
  background: transparent;
  font-size: 12.5px;
  color: var(--ink);
}
.field .input input::placeholder { color: #a6b1c2; }
.login-submit {
  margin-top: 2px;
  padding: 12px 16px;
  border: 0;
  border-radius: 11px;
  background: linear-gradient(135deg, #ff2e55, #ff6b87);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .02em;
  box-shadow: 0 12px 26px rgba(255, 46, 85, .26);
}
.login-submit:hover { filter: brightness(1.04); }
.login-submit:disabled { opacity: .55; cursor: not-allowed; box-shadow: none; }
.login-hint {
  margin: 2px 0 0;
  font-size: 10.5px;
  line-height: 1.6;
  color: var(--ink-3);
  text-align: center;
}
.login-note {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-top: 20px;
  padding: 11px 12px;
  border: 1px solid #e6ebf3;
  border-radius: 11px;
  background: #f8fafd;
  font-size: 10px;
  line-height: 1.7;
  color: var(--ink-3);
}
.login-note .icon { width: 14px; height: 14px; margin-top: 1px; color: var(--teal); }
.login-card .foot {
  margin-top: 22px;
  display: flex;
  justify-content: space-between;
  font-size: 9.5px;
  color: #a2aec0;
}
.form-error { min-height: 18px; margin: 2px 0 0; color: var(--danger); font-size: 12px; line-height: 1.5; }
.form-hint { min-height: 18px; margin: 2px 0 0; color: var(--ink-3); font-size: 12px; line-height: 1.5; }

/* ============================================================
   工作台框架
   ============================================================ */
.app-shell {
  height: 100vh;
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  overflow: hidden;
  background: var(--bg);
}

/* ---------------------------- 侧边栏 ---------------------------- */
.sidebar {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
  min-height: 0;
  padding: 22px 16px 16px;
  overflow: hidden;
  color: #c5d1e3;
  background:
    radial-gradient(620px 320px at -10% -8%, rgba(255, 46, 85, .20), transparent 62%),
    radial-gradient(480px 300px at 120% 42%, rgba(90, 107, 240, .16), transparent 60%),
    linear-gradient(180deg, #0d1729 0%, #0a1220 58%, #080e19 100%);
}
.sidebar::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(255, 255, 255, .045) 1px, transparent 1px);
  background-size: 22px 22px;
  pointer-events: none;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, .55), transparent 70%);
}
.sidebar > * { position: relative; z-index: 1; }

.brand { display: flex; align-items: center; gap: 12px; min-width: 0; padding: 0 6px; }
.brand img {
  width: 42px;
  height: 42px;
  border-radius: 13px;
  object-fit: cover;
  box-shadow: 0 8px 22px rgba(255, 46, 85, .28), 0 0 0 1px rgba(255, 255, 255, .08);
  background: #fff;
  flex: 0 0 auto;
}
.brand .name {
  display: block;
  font-size: 14.5px;
  font-weight: 700;
  color: #fff;
  letter-spacing: .01em;
}
.brand .sub {
  display: block;
  margin-top: 3px;
  font-size: 9.5px;
  font-weight: 650;
  letter-spacing: .18em;
  color: #7688a4;
  text-transform: uppercase;
}

.user-card {
  margin-top: 2px;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, .09);
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(255, 255, 255, .07), rgba(255, 255, 255, .035));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .06);
}
.user-row { display: flex; align-items: center; gap: 11px; }
.avatar {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  display: grid;
  place-items: center;
  border-radius: 13px;
  overflow: hidden;
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(140deg, #ff3d60, #ff8aa0);
  box-shadow: 0 6px 16px rgba(255, 46, 85, .30);
}
.avatar-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
}
.avatar.has-image,
.msg-avatar.has-image { background: #eef2f7; box-shadow: none; }
.user-meta { min-width: 0; }
.user-meta strong { display: block; font-size: 13px; font-weight: 650; color: #fff; }
.user-meta span {
  display: block;
  margin-top: 2px;
  font-size: 10.5px;
  color: #8fa0ba;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.quota-row { display: flex; align-items: flex-end; justify-content: space-between; margin-top: 13px; }
.quota-row .k { font-size: 10.5px; color: #8fa0ba; }
.quota-row .v { font-size: 13px; font-weight: 700; color: #fff; }
.quota-row .v small { font-size: 10px; font-weight: 500; color: #8fa0ba; }
.quota-bar {
  height: 5px;
  margin-top: 8px;
  border-radius: 99px;
  background: rgba(255, 255, 255, .10);
  overflow: hidden;
}
.quota-bar i {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 99px;
  background: linear-gradient(90deg, #ff2e55, #ff8aa0);
  box-shadow: 0 0 12px rgba(255, 46, 85, .55);
  transition: width .25s ease;
}

.nav-label {
  padding: 2px 9px 0;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: .17em;
  color: #6d7e99;
  text-transform: uppercase;
}
.persona-list {
  display: flex;
  flex-direction: column;
  gap: 3px;
  overflow-y: auto;
  min-height: 0;
  padding-right: 2px;
}
.persona-list::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .12); background-clip: content-box; }
.persona-item {
  position: relative;
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  color: #a3b1c7;
  text-align: left;
  transition: background .16s, color .16s, border-color .16s;
}
.persona-item:hover { background: rgba(255, 255, 255, .045); color: #fff; }
.persona-item.active {
  color: #fff;
  border-color: rgba(255, 255, 255, .10);
  background: linear-gradient(90deg, rgba(255, 46, 85, .18), rgba(255, 255, 255, .055));
  box-shadow: 0 10px 26px rgba(0, 0, 0, .22), inset 0 1px 0 rgba(255, 255, 255, .06);
}
.persona-item.active::before {
  content: "";
  position: absolute;
  left: -17px;
  top: 9px;
  bottom: 9px;
  width: 3px;
  border-radius: 0 4px 4px 0;
  background: linear-gradient(180deg, #ff5c7a, #ff2e55);
  box-shadow: 0 0 14px rgba(255, 46, 85, .8);
}
.p-icon {
  width: 33px;
  height: 33px;
  flex: 0 0 33px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  color: #93a5be;
  background: rgba(255, 255, 255, .055);
  transition: background .16s, color .16s;
}
.p-icon .icon { width: 17px; height: 17px; }
.persona-item.active .p-icon { color: #ff9daf; background: rgba(255, 46, 85, .18); }
.persona-item .p-text { min-width: 0; }
.persona-item .p-name { display: block; font-size: 12.5px; font-weight: 600; line-height: 1.4; }
.persona-item .p-tag {
  display: block;
  margin-top: 2px;
  font-size: 10px;
  line-height: 1.4;
  color: #7889a3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.persona-item.active .p-tag { color: #a9b8ce; }

.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 3px; padding-top: 6px; }
.side-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 10px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: #93a4bc;
  font-size: 12px;
  text-align: left;
}
.side-btn:hover { background: rgba(255, 255, 255, .045); color: #fff; }
.side-btn.is-admin { color: #ff9daf; }
.side-btn.danger:hover { color: #ff8aa0; }
.side-btn .icon { width: 17px; height: 17px; }
.side-btn .badge {
  margin-left: auto;
  padding: 2px 7px;
  border-radius: 99px;
  font-size: 9px;
  font-weight: 700;
  color: #ffb3c2;
  background: rgba(255, 46, 85, .16);
}

/* ---------------------------- 顶栏 ---------------------------- */
.main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  height: 100vh;
  overflow: hidden;
}
.topbar {
  flex: 0 0 78px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 0 30px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, .76);
  backdrop-filter: blur(14px);
  z-index: 5;
}
.persona-hero { display: flex; align-items: center; gap: 14px; min-width: 0; }
.hero-icon {
  width: 46px;
  height: 46px;
  flex: 0 0 46px;
  display: grid;
  place-items: center;
  border: 1px solid var(--brand-line);
  border-radius: 15px;
  color: #e11d48;
  background: linear-gradient(145deg, #fff, #ffe9ee);
  box-shadow: 0 8px 22px rgba(255, 46, 85, .10);
}
.hero-icon .icon { width: 22px; height: 22px; }
.persona-hero h1 { margin: 0; font-size: 16.5px; font-weight: 700; letter-spacing: -.01em; line-height: 1.35; }
.persona-hero p {
  margin: 3px 0 0;
  font-size: 11.5px;
  color: var(--ink-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.top-actions { display: flex; align-items: center; gap: 10px; flex: 0 0 auto; }
.pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: 99px;
  background: #fff;
  font-size: 11.5px;
  color: var(--ink-2);
  white-space: nowrap;
  box-shadow: var(--shadow-sm);
}
.pill .icon { width: 14px; height: 14px; color: var(--brand); }
.pill b { color: var(--ink); font-weight: 700; }
.pill.warn { color: var(--danger); border-color: #ffd5d5; background: #fff5f5; }
.ghost-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px 13px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #fff;
  color: var(--ink-2);
  font-size: 12px;
  line-height: 1.3;
  box-shadow: var(--shadow-sm);
}
.ghost-btn:hover { border-color: #cfd8e5; color: var(--ink); background: #fff; }
.ghost-btn .icon { width: 15px; height: 15px; }
.ghost-btn.danger { color: var(--danger); }
.ghost-btn.wide { width: 100%; }

/* ---------------------------- 主体 ---------------------------- */
.stage {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 302px;
  overflow: hidden;
}
.chat-col { min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.chat-scroll { flex: 1; min-height: 0; overflow-y: auto; padding: 30px 42px 6px; }
.intro-card {
  max-width: 850px;
  margin: 0 auto 20px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: linear-gradient(180deg, #fff, #fbfcfe);
  box-shadow: var(--shadow-sm);
  color: var(--ink-2);
  font-size: 12.5px;
  line-height: 1.8;
}
.intro-card:empty { display: none; }
.intro-card p:first-child { margin-top: 0; }
.intro-card p:last-child { margin-bottom: 0; }
.messages {
  max-width: 850px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding-bottom: 12px;
}

.msg { display: flex; align-items: flex-start; gap: 12px; animation: rise .2s ease-out; }
@keyframes rise { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }
.msg.user { flex-direction: row-reverse; }
.msg-avatar {
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  overflow: hidden;
  font-size: 12px;
  font-weight: 700;
}
.msg.user .msg-avatar {
  color: #fff;
  background: linear-gradient(140deg, #ff3d60, #ff8aa0);
  box-shadow: 0 6px 16px rgba(255, 46, 85, .24);
}
.msg.assistant .msg-avatar {
  color: #e11d48;
  border: 1px solid var(--brand-line);
  background: linear-gradient(145deg, #fff, #ffe9ee);
}
.msg.assistant .msg-avatar .icon { width: 18px; height: 18px; }
.msg-body { min-width: 0; max-width: 760px; }
.msg.user .msg-body { display: flex; flex-direction: column; align-items: flex-end; max-width: 72%; }
.msg-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 2px 7px;
  font-size: 10.5px;
  color: var(--ink-3);
}
.msg.user .msg-meta { flex-direction: row-reverse; }
.msg-meta .who { font-size: 11.5px; font-weight: 650; color: var(--ink-2); }
.msg-meta .dot { width: 3px; height: 3px; border-radius: 50%; background: #cbd5e1; }
.msg-meta .ai-tag {
  padding: 2px 7px;
  border-radius: 99px;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: .04em;
  color: #e11d48;
  background: var(--brand-soft);
}

.bubble-user {
  padding: 12px 16px;
  border-radius: 18px 18px 5px 18px;
  color: #fff;
  font-size: 13.5px;
  line-height: 1.75;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  background: linear-gradient(135deg, #ff3a5e, #ff6b87);
  box-shadow: 0 12px 28px rgba(255, 46, 85, .20);
}
.msg-attachments { display: flex; flex-direction: column; align-items: flex-end; gap: 7px; margin-top: 8px; }
.msg-attach {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  max-width: 300px;
  padding: 7px 10px 7px 7px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #fff;
  box-shadow: var(--shadow-sm);
}
.attach-thumb {
  width: 46px;
  height: 46px;
  flex: 0 0 46px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: 9px;
  color: #7c4a2e;
  font-size: 7.5px;
  font-weight: 800;
  letter-spacing: .12em;
  line-height: 1.35;
  background: linear-gradient(145deg, #f6e7d4, #e9c9a8);
  text-align: center;
}
.attach-thumb b { font-size: 11px; letter-spacing: .02em; }
.msg-attach .attach-name { font-size: 11.5px; font-weight: 600; color: var(--ink); }
.msg-attach .attach-size { display: block; margin-top: 1px; font-size: 9.5px; color: var(--ink-3); }
.attach-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 240px;
  padding: 4px 7px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink-2);
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.attach-chip .remove {
  border: 0;
  background: transparent;
  color: var(--ink-3);
  padding: 0 2px;
  font-size: 14px;
  line-height: 1;
}
.attach-chip .remove:hover { color: var(--danger); }

.ai-card {
  padding: 18px 20px 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: 0 10px 30px rgba(15, 23, 42, .045);
  white-space: normal;
  overflow-wrap: anywhere;
}
.ai-card.error { border-color: #ffd3dd; background: #fffafb; }
.msg.user .msg-tools { justify-content: flex-end; border-top: 0; padding-top: 6px; margin-top: 6px; }
.msg-tools {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line-soft);
  opacity: 1;
}
.tool-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 8px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink-3);
  font-size: 10.5px;
}
.tool-btn:hover { background: var(--bg-2); color: var(--ink-2); }
.tool-btn.danger:hover { background: var(--danger-soft); color: var(--danger); }
.tool-btn .icon { width: 13px; height: 13px; }
.tool-spacer { flex: 1; }
.thinking {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--ink-3);
  font-size: 12px;
  padding: 3px 2px;
}
.thinking::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--brand);
  animation: pulse 1.1s infinite;
}
@keyframes pulse { 0%, 100% { opacity: .25; transform: scale(.8); } 50% { opacity: 1; transform: scale(1); } }

/* Markdown */
.md > :first-child { margin-top: 0; }
.md > :last-child { margin-bottom: 0; }
.md p { margin: 0 0 10px; font-size: 13px; line-height: 1.8; color: var(--ink-2); }
.md p:last-child { margin-bottom: 0; }
.md strong { color: var(--ink); font-weight: 650; }
.md h1, .md h2 { margin: 18px 0 9px; font-size: 15px; font-weight: 700; color: var(--ink); }
.md h3 { margin: 18px 0 9px; font-size: 13px; font-weight: 700; color: var(--ink); }
.md h4 { margin: 14px 0 8px; font-size: 12.5px; font-weight: 700; color: var(--ink); }
.md h1:first-child, .md h2:first-child, .md h3:first-child { margin-top: 0; }
.md ul, .md ol { margin: 6px 0 10px; padding-left: 22px; }
.md li { margin: 3px 0; font-size: 13px; line-height: 1.75; color: var(--ink-2); }
.md blockquote {
  margin: 10px 0;
  padding: 8px 12px;
  border-left: 3px solid var(--brand);
  border-radius: 0 8px 8px 0;
  background: var(--bg-2);
  color: var(--ink-2);
}
.md code {
  background: #f1f5f9;
  border-radius: 5px;
  padding: 1px 5px;
  font-size: 11.5px;
  font-family: "SFMono-Regular", Consolas, "Microsoft YaHei", monospace;
  color: #334155;
}
.md pre {
  margin: 9px 0 14px;
  padding: 14px 16px;
  border: 1px solid #e2e8f4;
  border-radius: 13px;
  background: linear-gradient(180deg, #f9fbff, #f4f7fc);
  overflow: auto;
}
.md pre code {
  background: transparent;
  border-radius: 0;
  padding: 0;
  font-size: 11.5px;
  line-height: 1.85;
  color: #334155;
}
.md table {
  width: 100%;
  margin: 4px 0 16px;
  border-collapse: collapse;
  font-size: 12px;
  display: block;
  overflow-x: auto;
}
.md th, .md td {
  padding: 9px 11px;
  border-bottom: 1px solid var(--line-soft);
  text-align: left;
  vertical-align: top;
  min-width: 80px;
}
.md th {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .04em;
  color: var(--ink-3);
  background: #f8fafc;
  white-space: nowrap;
}
.md th:first-child { border-radius: 8px 0 0 8px; }
.md th:last-child { border-radius: 0 8px 8px 0; }
.md td { color: var(--ink-2); line-height: 1.65; }
.md td:first-child { font-weight: 650; color: var(--ink); }
.md a { color: #c81e42; text-decoration: underline; }
.md hr { border: 0; border-top: 1px solid var(--line); margin: 14px 0; }
.md .form-error { margin-top: 10px; }

/* ---------------------------- 输入区 ---------------------------- */
.composer-wrap {
  flex: 0 0 auto;
  padding: 8px 42px 18px;
  background: linear-gradient(180deg, rgba(238, 242, 247, 0), var(--bg) 38%);
}
.attachment-list {
  max-width: 850px;
  margin: 0 auto 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.attach-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 280px;
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  font-size: 11px;
  color: var(--ink-2);
  box-shadow: var(--shadow-sm);
}
.attach-item img { width: 24px; height: 24px; border-radius: 6px; object-fit: cover; }
.attach-item .name { max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attach-item .remove {
  border: 0;
  background: transparent;
  color: var(--ink-3);
  padding: 0 2px;
  font-size: 14px;
  line-height: 1;
}
.attach-item .remove:hover { color: var(--danger); }
.attach-item.uploading { opacity: .6; }

.note-link-state {
  max-width: 850px;
  margin: 0 auto 8px;
}
.note-link-inner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  box-shadow: var(--shadow-sm);
  font-size: 12px;
  color: var(--ink-2);
}
.note-link-state.loading .note-link-inner {
  border-color: var(--brand-line);
  background: #fff9fb;
}
.note-link-state.error .note-link-inner {
  border-color: #ffd9d6;
  background: #fff7f6;
}
.note-cover {
  width: 42px;
  height: 56px;
  flex: 0 0 auto;
  border-radius: 8px;
  object-fit: cover;
  background: #f3f5f9;
}
.note-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  flex: 0 0 auto;
  border-radius: 9px;
  background: var(--brand-soft);
  color: var(--brand);
  font-size: 15px;
  font-weight: 700;
}
.note-link-state.error .note-icon {
  background: #fff1f0;
  color: var(--danger);
}
.note-spinner {
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
  border: 2px solid var(--brand-line);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: note-spin .8s linear infinite;
}
@keyframes note-spin { to { transform: rotate(360deg); } }
.note-main {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1 1 auto;
}
.note-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink);
}
.note-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 10.5px;
  color: var(--ink-3);
}
.note-meta b { color: var(--ink-2); font-weight: 600; }
.note-sub { font-size: 10.5px; color: var(--ink-3); }
.note-actions {
  display: flex;
  flex: 0 0 auto;
  gap: 4px;
}
.note-action {
  padding: 3px 5px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--ink-3);
  font-size: 11px;
  white-space: nowrap;
}
.note-action:hover { background: var(--brand-soft); color: var(--brand); }
.note-action.danger:hover { background: #fff1f0; color: var(--danger); }

.composer {
  max-width: 850px;
  margin: 0 auto;
  padding: 14px 16px 10px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: #fff;
  box-shadow: 0 18px 46px rgba(15, 23, 42, .075);
  transition: border-color .16s, box-shadow .16s;
}
.composer:focus-within {
  border-color: #ffb3c2;
  box-shadow: 0 18px 46px rgba(255, 46, 85, .10);
}
.composer textarea {
  width: 100%;
  min-height: 52px;
  max-height: 180px;
  padding: 2px 3px 10px;
  border: 0;
  outline: none;
  resize: none;
  background: transparent;
  font-size: 13.5px;
  line-height: 1.7;
  color: var(--ink);
}
.composer textarea::placeholder { color: #a6b1c2; }
.composer-foot { display: flex; align-items: center; gap: 6px; min-height: 34px; }
.attach-buttons { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.chip-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: var(--ink-3);
  font-size: 11.5px;
}
.chip-btn:hover { border-color: var(--line); background: var(--bg-2); color: var(--ink-2); }
.chip-btn .icon { width: 15px; height: 15px; }
.composer-meta { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.cost-hint { font-size: 10.5px; color: var(--ink-3); white-space: nowrap; }
.stream-status {
  color: var(--ink-3);
  font-size: 10.5px;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.stop-btn {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  color: var(--ink-2);
  font-size: 11px;
}
.stop-btn:hover { border-color: #cfd8e5; color: var(--ink); }
.send-btn {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 14px;
  color: #fff;
  background: linear-gradient(140deg, #ff2e55, #ff6b87);
  box-shadow: 0 10px 22px rgba(255, 46, 85, .30);
}
.send-btn:hover { filter: brightness(1.04); }
.send-btn:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; }
.send-btn .icon { width: 20px; height: 20px; stroke-width: 2; }
.composer-note {
  max-width: 850px;
  margin: 8px auto 0;
  font-size: 10px;
  color: #9aa7b9;
  text-align: center;
}
.composer-note b { color: var(--ink-3); font-weight: 600; }

/* ---------------------------- 右侧栏 ---------------------------- */
.rail {
  min-height: 0;
  overflow-y: auto;
  padding: 24px 18px 26px;
  border-left: 1px solid var(--line);
  background: linear-gradient(180deg, #f8fafd, #f4f7fb);
}
.rail-card {
  margin-bottom: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 6px 20px rgba(15, 23, 42, .035);
}
.rail-title { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 13px; }
.rail-title span { font-size: 11.5px; font-weight: 700; letter-spacing: .02em; color: var(--ink-2); }
.rail-title .tiny { font-size: 9.5px; font-weight: 600; color: var(--ink-3); }
.step { position: relative; display: flex; gap: 10px; padding-bottom: 15px; }
.step:last-child { padding-bottom: 0; }
.step:not(:last-child)::before {
  content: "";
  position: absolute;
  left: 10px;
  top: 22px;
  bottom: 1px;
  width: 1.5px;
  background: var(--line);
}
.step-dot {
  width: 21px;
  height: 21px;
  flex: 0 0 21px;
  display: grid;
  place-items: center;
  border: 1.5px solid var(--line);
  border-radius: 50%;
  background: #fff;
  color: var(--ink-3);
  font-size: 9px;
  font-weight: 700;
  z-index: 1;
}
.step.done .step-dot { color: var(--brand); border-color: var(--brand-line); background: var(--brand-soft); }
.step.current .step-dot {
  color: #fff;
  border-color: var(--brand);
  background: var(--brand);
  box-shadow: 0 0 0 4px rgba(255, 46, 85, .10);
}
.step .step-body { padding-top: 1px; }
.step .step-name { display: block; font-size: 11.5px; font-weight: 600; color: var(--ink-2); line-height: 1.4; }
.step.current .step-name { color: var(--ink); }
.step .step-desc { display: block; margin-top: 2px; font-size: 10px; color: var(--ink-3); line-height: 1.5; }
.quick-list { display: flex; flex-wrap: wrap; gap: 6px; }
.quick-list button {
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 99px;
  background: var(--bg-2);
  color: var(--ink-2);
  font-size: 10.5px;
}
.quick-list button:hover { border-color: var(--brand-line); background: var(--brand-soft); color: #c81e42; }
.tips { display: flex; flex-direction: column; gap: 9px; }
.tip { display: flex; gap: 8px; font-size: 10.5px; line-height: 1.65; color: var(--ink-3); }
.tip .icon { width: 14px; height: 14px; margin-top: 1px; color: var(--brand); flex: 0 0 14px; }
.rail-foot { padding: 4px 4px 0; font-size: 9.5px; line-height: 1.6; color: #a2aec0; }

/* ============================================================
   弹层与提示
   ============================================================ */
.modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(20, 26, 38, .32);
  backdrop-filter: blur(2px);
}
.modal-card {
  width: min(440px, 100%);
  max-height: 88vh;
  overflow: auto;
  padding: 20px;
  border-radius: 18px;
  background: #fff;
  box-shadow: var(--shadow-lg);
}
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.modal-head h2 { margin: 0; font-size: 16px; }
.icon-btn {
  border: 0;
  background: transparent;
  color: var(--ink-3);
  font-size: 23px;
  line-height: 1;
  padding: 0 4px;
}
.icon-btn:hover { color: var(--ink); }
.avatar-editor {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 2px 0 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--bg-2);
}
.avatar-preview {
  width: 64px;
  height: 64px;
  flex: 0 0 64px;
  display: grid;
  place-items: center;
  border-radius: 20px;
  overflow: hidden;
  font-size: 24px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(140deg, #ff3d60, #ff8aa0);
  box-shadow: 0 8px 20px rgba(255, 46, 85, .22);
}
.avatar-preview.has-image { background: #eef2f7; box-shadow: none; }
.avatar-editor-main { min-width: 0; }
.avatar-editor-title { font-size: 12.5px; font-weight: 700; color: var(--ink); }
.avatar-editor-hint { margin: 4px 0 9px; font-size: 10.5px; line-height: 1.55; color: var(--ink-3); }
.avatar-editor-actions { display: flex; align-items: center; gap: 8px; }
.avatar-editor-actions .ghost-btn { padding: 6px 10px; font-size: 11.5px; }
.stack-form { display: flex; flex-direction: column; gap: 12px; }
.stack-form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 11px;
  font-weight: 650;
  color: var(--ink-2);
}
.stack-form input, .stack-form select, .stack-form textarea {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  font-size: 13px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.stack-form input:focus, .stack-form select:focus, .stack-form textarea:focus {
  border-color: #ffb3c2;
  box-shadow: 0 0 0 3px rgba(255, 46, 85, .08);
}
.stack-form select { appearance: auto; }
.stack-form textarea { resize: vertical; min-height: 72px; line-height: 1.55; }
.modal-card hr { border: 0; border-top: 1px solid var(--line); margin: 18px 0; }

/* ---------------------------- 聊天存档 ---------------------------- */
.chat-archive-card {
  width: min(860px, 100%);
  padding: 20px 22px 14px;
  display: flex;
  flex-direction: column;
  max-height: 88vh;
  overflow: hidden;
}
.modal-head-copy { min-width: 0; }
.modal-sub {
  margin: 5px 0 0;
  font-size: 11px;
  line-height: 1.6;
  color: var(--ink-3);
}
.chat-archive-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line-soft);
}
.chat-archive-tabs {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  background: var(--bg-2);
}
.chat-archive-tabs button {
  border: 0;
  border-radius: 8px;
  padding: 6px 12px;
  background: transparent;
  color: var(--ink-3);
  font-size: 11.5px;
  font-weight: 600;
}
.chat-archive-tabs button.active {
  background: #fff;
  color: var(--ink);
  box-shadow: var(--shadow-sm);
}
.chat-archive-toolbar select {
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  color: var(--ink-2);
  font-size: 11.5px;
}
.chat-archive-tip { margin-left: auto; font-size: 10px; color: var(--ink-3); }
.chat-archive-selection {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 2px;
  border-bottom: 1px solid var(--line-soft);
}
.chat-archive-selection .spacer { flex: 1; }
.chat-archive-selection .ghost-btn { padding: 6px 11px; font-size: 11.5px; }
.chat-archive-selection .ghost-btn:disabled { opacity: .5; cursor: not-allowed; }
.chat-archive-selection .tiny { font-size: 10.5px; color: var(--ink-3); }
.check-line { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--ink-2); }
.check-line input { accent-color: var(--brand); }
.chat-archive-note {
  margin: 10px 2px 0;
  padding: 8px 11px;
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  background: var(--bg-2);
  font-size: 10.5px;
  line-height: 1.6;
  color: var(--ink-3);
}
.chat-archive-list {
  flex: 1;
  min-height: 120px;
  overflow-y: auto;
  padding: 14px 4px 6px 30px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.archive-entry { position: relative; }
.archive-check {
  position: absolute;
  left: -28px;
  top: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.archive-check input { width: 14px; height: 14px; accent-color: var(--brand); }
.archive-status {
  padding: 1px 7px;
  border-radius: 99px;
  font-size: 9px;
  font-weight: 700;
  color: #b45309;
  background: #fef3c7;
}
.archive-status.error { color: #b91c1c; background: #fee2e2; }
.archive-attachments { margin-top: 7px; }
.msg.assistant .archive-attachments { align-items: flex-start; }
.chat-archive-foot { padding-top: 10px; text-align: center; }
.chat-archive-foot .ghost-btn { padding: 7px 14px; font-size: 11.5px; }
.modal-card form.stack-form { margin-top: 12px; }
.primary-btn {
  border: 0;
  border-radius: 11px;
  padding: 11px 16px;
  background: linear-gradient(135deg, #ff2e55, #ff6b87);
  color: #fff;
  font-weight: 650;
  font-size: 13px;
  letter-spacing: .2px;
  box-shadow: 0 8px 18px rgba(255, 46, 85, .20);
}
.primary-btn:hover { filter: brightness(1.04); }
.primary-btn:disabled { opacity: .55; cursor: not-allowed; box-shadow: none; }
.primary-btn.as-link { display: block; text-align: center; text-decoration: none; }
.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  z-index: 80;
  transform: translateX(-50%);
  max-width: min(560px, calc(100vw - 32px));
  padding: 10px 15px;
  border-radius: 10px;
  background: #0f172a;
  color: #fff;
  font-size: 12.5px;
  line-height: 1.55;
  box-shadow: 0 12px 30px rgba(0, 0, 0, .2);
}
.toast.error { background: #9f1d2b; }

/* ============================================================
   管理后台
   ============================================================ */
.admin-shell {
  height: 100vh;
  display: grid;
  grid-template-columns: 256px minmax(0, 1fr);
  overflow: hidden;
  background: var(--bg);
}
.admin-side { padding: 22px 14px 16px; gap: 14px; }
.admin-side .brand img { width: 40px; height: 40px; border-radius: 12px; }
.admin-side .spacer { flex: 1; }
.admin-nav { display: flex; flex-direction: column; gap: 3px; }
.admin-nav button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 10px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: #93a4bc;
  font-size: 12.5px;
  text-align: left;
}
.admin-nav button .icon { width: 17px; height: 17px; }
.admin-nav button:hover { background: rgba(255, 255, 255, .045); color: #fff; }
.admin-nav button.active {
  color: #fff;
  border-color: rgba(255, 255, 255, .10);
  background: linear-gradient(90deg, rgba(255, 46, 85, .16), rgba(255, 255, 255, .05));
  box-shadow: 0 8px 22px rgba(0, 0, 0, .18);
}
.admin-nav button.active .icon { color: #ff9daf; }
.admin-nav .badge {
  margin-left: auto;
  padding: 2px 7px;
  border-radius: 99px;
  font-size: 9px;
  font-weight: 700;
  color: #ffb3c2;
  background: rgba(255, 46, 85, .16);
}
.admin-user {
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, .09);
  border-radius: 14px;
  background: rgba(255, 255, 255, .045);
}
.admin-user .avatar {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  border-radius: 11px;
  font-size: 13px;
  background: linear-gradient(140deg, #5b6cf9, #8b9bff);
  box-shadow: 0 6px 16px rgba(90, 107, 240, .28);
}
.admin-user .user-meta strong { font-size: 12.5px; }
.admin-user .user-meta span { font-size: 10px; }
.admin-side .side-btn { border: 0; }

.admin-main {
  min-width: 0;
  height: 100vh;
  overflow-y: auto;
  padding: 30px 36px 44px;
  background: var(--bg);
}
.admin-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
}
.admin-head h1 { margin: 0; font-size: 23px; font-weight: 750; letter-spacing: -.02em; }
.admin-head p { margin: 6px 0 0; font-size: 11.5px; color: var(--ink-3); }
.head-actions { display: flex; align-items: center; gap: 9px; flex: 0 0 auto; }
.date-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #fff;
  color: var(--ink-2);
  font-size: 11.5px;
  box-shadow: var(--shadow-sm);
  white-space: nowrap;
}
.date-pill .icon { width: 14px; height: 14px; color: var(--ink-3); }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}
.stat-card {
  position: relative;
  overflow: hidden;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 6px 20px rgba(15, 23, 42, .035);
}
.stat-card::after {
  content: "";
  position: absolute;
  right: -24px;
  top: -34px;
  width: 96px;
  height: 96px;
  border-radius: 50%;
  background: rgba(90, 107, 240, .07);
}
.stat-card .stat-icon {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  color: var(--indigo);
  background: var(--indigo-soft);
}
.stat-card .stat-icon .icon { width: 18px; height: 18px; fill: none; stroke: currentColor; }
.stat-card .stat-label {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 9px;
  font-size: 11px;
  color: var(--ink-3);
}
.stat-card .stat-label em {
  font-style: normal;
  font-size: 9.5px;
  font-weight: 650;
  color: var(--ok);
}
.stat-card strong {
  display: block;
  margin-top: 13px;
  font-size: 28px;
  font-weight: 760;
  letter-spacing: -.03em;
  line-height: 1;
  color: var(--ink);
}
.stat-card.alert .stat-icon { color: var(--amber); background: var(--amber-soft); }
.stat-card.alert::after { background: rgba(180, 83, 9, .07); }
.stat-card.alert strong { color: var(--amber); }
.stat-card.alert .stat-label em { color: var(--amber); }
.stat-card:nth-child(2) .stat-icon { color: var(--teal); background: var(--teal-soft); }
.stat-card:nth-child(2)::after { background: rgba(13, 148, 136, .07); }
.stat-card:nth-child(4) .stat-icon { color: var(--brand); background: var(--brand-soft); }
.stat-card:nth-child(4)::after { background: rgba(255, 46, 85, .07); }

.grid-2 {
  display: grid;
  grid-template-columns: minmax(0, 1.9fr) minmax(0, 1fr);
  align-items: start;
  gap: 16px;
  margin-bottom: 18px;
}
.admin-panel {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 6px 20px rgba(15, 23, 42, .035);
}
.admin-panel.mt-14 { margin-top: 14px; }
.panel-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line-soft);
}
.panel-title h2 { margin: 0; font-size: 13.5px; font-weight: 700; }
.panel-title .help { font-size: 10.5px; }
.panel-body { padding: 16px 18px; }
.panel-title + .table-wrap { border: 0; border-radius: 0; }
.panel-title + .help { padding: 14px 18px; margin: 0; }
.admin-panel > .help { padding: 14px 18px; margin: 0; }
.admin-panel > .help:last-child { padding-bottom: 16px; }
.admin-panel > .help-list, .admin-panel > .row-actions { margin: 14px 18px; }
.admin-panel > .help-list:last-child, .admin-panel > .row-actions:last-child { margin-bottom: 18px; }

.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.admin-panel .table-wrap { border: 0; border-radius: 0; }
table.data { width: 100%; border-collapse: collapse; font-size: 12px; min-width: 720px; }
table.data th {
  padding: 10px 18px;
  background: #f8fafc;
  border-bottom: 1px solid var(--line-soft);
  color: var(--ink-3);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .04em;
  text-align: left;
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 1;
}
table.data td {
  padding: 12px 18px;
  border-bottom: 1px solid var(--line-soft);
  color: var(--ink-2);
  vertical-align: middle;
  white-space: nowrap;
}
table.data tr:last-child td { border-bottom: 0; }
table.data tr:hover td { background: #fbfcfe; }
table.data td strong { color: var(--ink); font-weight: 650; }
table.data .help { margin-top: 2px; font-size: 9.5px; line-height: 1.5; }

.member { display: flex; align-items: center; gap: 9px; }
.member .m-avatar {
  width: 29px;
  height: 29px;
  flex: 0 0 29px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  font-size: 10.5px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(140deg, #7c8cff, #a7b3ff);
}
.member .m-avatar.t2 { background: linear-gradient(140deg, #ff8ba0, #ffb7c4); }
.member .m-avatar.t3 { background: linear-gradient(140deg, #2dd4bf, #7ce7d9); }
.member .m-avatar.t4 { background: linear-gradient(140deg, #f4b860, #ffd79a); }
.member .m-meta b { display: block; font-size: 11.5px; font-weight: 650; color: var(--ink); }
.member .m-meta span { display: block; margin-top: 1px; font-size: 9.5px; color: var(--ink-3); }

.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border: 0;
  border-radius: 99px;
  background: #f1f5f9;
  color: #64748b;
  font-size: 9.5px;
  font-weight: 650;
  white-space: nowrap;
}
.tag::before { content: ""; width: 4px; height: 4px; border-radius: 50%; background: currentColor; }
.tag.ok { color: #0f9f6e; background: #e8f8f0; }
.tag.warn { color: #b45309; background: #fff5e6; }
.tag.danger { color: #dc2626; background: #fff0f0; }
.tag.info { color: #4f5fe8; background: #eef1ff; }
.tag.plain::before { display: none; }

.row-actions { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.mini-btn {
  padding: 5px 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink-2);
  font-size: 10px;
  white-space: nowrap;
}
.mini-btn:hover { border-color: #cfd8e5; color: var(--ink); }
.mini-btn.primary {
  border-color: transparent;
  background: linear-gradient(135deg, #ff2e55, #ff6b87);
  color: #fff;
  box-shadow: 0 4px 12px rgba(255, 46, 85, .22);
}
.mini-btn.danger { color: #dc2626; }
.mini-btn.soft { border-color: var(--brand-line); background: var(--brand-soft); color: #c81e42; }
.mini-btn:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; }

.toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line-soft);
}
.toolbar input, .toolbar select {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  padding: 7px 10px;
  font-size: 11px;
  color: var(--ink);
  outline: none;
}
.toolbar input:focus, .toolbar select:focus { border-color: #ffb3c2; box-shadow: 0 0 0 3px rgba(255, 46, 85, .08); }
.toolbar input { min-width: 200px; }
.toolbar select { color: var(--ink-2); }
.toolbar .spacer { flex: 1; }
.search-box {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 220px;
  padding: 8px 11px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}
.search-box .icon { width: 14px; height: 14px; color: var(--ink-3); }
.search-box input {
  width: 100%;
  min-width: 0;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  font-size: 11px;
}
.search-box input:focus { box-shadow: none; }
.search-box input::placeholder { color: #a6b1c2; }
.select-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 11px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--ink-2);
  font-size: 11px;
}
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 13px;
  border: 0;
  border-radius: 10px;
  background: linear-gradient(135deg, #ff2e55, #ff6b87);
  color: #fff;
  font-size: 11px;
  font-weight: 650;
  box-shadow: 0 6px 16px rgba(255, 46, 85, .24);
}
.btn-primary .icon { width: 14px; height: 14px; }
.btn-primary:hover { filter: brightness(1.04); }

.quota-cell { display: flex; align-items: center; gap: 9px; }
.quota-cell .bar { width: 56px; height: 5px; border-radius: 99px; background: #f1f5f9; overflow: hidden; }
.quota-cell .bar i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, #ff2e55, #ff8aa0); }
.quota-cell b { font-size: 11px; font-weight: 650; color: var(--ink); }
.quota-cell span { font-size: 9.5px; color: var(--ink-3); }

.rank-row { display: flex; align-items: center; gap: 10px; padding: 9px 0; }
.rank-row:not(:last-child) { border-bottom: 1px solid var(--line-soft); }
.rank-dot {
  width: 22px;
  height: 22px;
  flex: 0 0 22px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  font-size: 9px;
  font-weight: 750;
  color: var(--ink-3);
  background: #f1f5f9;
}
.rank-row:nth-child(1) .rank-dot { color: #b45309; background: #fff5e6; }
.rank-row:nth-child(2) .rank-dot { color: #64748b; background: #f1f5f9; }
.rank-row:nth-child(3) .rank-dot { color: #92400e; background: #fdf1e4; }
.rank-name { width: 62px; flex: 0 0 62px; font-size: 11px; font-weight: 600; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-bar { flex: 1; height: 6px; border-radius: 99px; background: #f1f5f9; overflow: hidden; }
.rank-bar i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, #5a6bf0, #9aa6ff); }
.rank-row:nth-child(1) .rank-bar i { background: linear-gradient(90deg, #ff2e55, #ff8aa0); }
.rank-val { width: 46px; text-align: right; font-size: 10.5px; font-weight: 700; color: var(--ink-2); }

.status-list { display: flex; flex-direction: column; gap: 12px; }
.status-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 11px; color: var(--ink-2); }
.status-name { display: flex; align-items: center; gap: 8px; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: #22c55e; box-shadow: 0 0 0 3px rgba(34, 197, 94, .12); }
.status-dot.warn { background: #f59e0b; box-shadow: 0 0 0 3px rgba(245, 158, 11, .14); }
.status-val { font-size: 9.5px; font-weight: 650; color: var(--ink-3); }

.empty { padding: 26px 12px; text-align: center; color: var(--ink-3); font-size: 12.5px; }
.mono { font-family: "SFMono-Regular", Consolas, monospace; font-size: 11px; overflow-wrap: anywhere; }
.secret-box {
  margin: 10px 0;
  padding: 10px;
  border: 1px dashed var(--brand-line);
  border-radius: 9px;
  background: var(--brand-soft);
  word-break: break-all;
}
.admin-message { min-height: 18px; color: var(--ink-3); font-size: 12px; line-height: 1.5; }
.help { color: var(--ink-3); font-size: 11.5px; line-height: 1.7; }
.help-list { margin: 0; padding-left: 18px; color: var(--ink-3); font-size: 11.5px; line-height: 1.8; }
.help-list li { margin: 2px 0; }
.chat-usage-note {
  margin: 14px 18px 0;
  padding: 9px 12px;
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  background: var(--bg-2);
  font-size: 11px;
  line-height: 1.65;
  color: var(--ink-3);
}
.pager { display: flex; align-items: center; gap: 8px; margin-top: 12px; padding: 0 18px 14px; }
.pager .spacer { flex: 1; }
.modal-actions { margin-top: 12px; flex-wrap: nowrap; }
.modal-actions .primary-btn { flex: 1; padding: 9px 12px; font-size: 13px; }
.mt-10 { margin-top: 10px; }
.mt-14 { margin-top: 14px; }
.user-card.compact { padding: 9px 10px; box-shadow: none; }

.pending-row { display: flex; align-items: center; gap: 11px; padding: 13px 18px; border-bottom: 1px solid var(--line-soft); }
.pending-row:last-child { border-bottom: 0; }
.pending-row .grow { flex: 1; min-width: 0; }
.pending-row .pending-name { font-size: 11.5px; font-weight: 650; color: var(--ink); }
.pending-row .pending-sub { margin-top: 2px; font-size: 9.5px; color: var(--ink-3); }

/* ============================================================
   响应式
   ============================================================ */
@media (max-width: 1320px) {
  .stage { grid-template-columns: minmax(0, 1fr); }
  .rail { display: none; }
  .chat-scroll, .composer-wrap { padding-left: 34px; padding-right: 34px; }
}
@media (max-width: 1180px) {
  .stats-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .grid-2 { grid-template-columns: minmax(0, 1fr); }
  .admin-main { padding: 26px 26px 38px; }
}
@media (max-width: 980px) {
  :root { --sidebar-w: 246px; }
  .topbar { padding: 0 20px; }
  .chat-scroll, .composer-wrap { padding-left: 22px; padding-right: 22px; }
  .login { grid-template-columns: 1fr; }
  .login-brand { display: none; }
  .login-main { min-height: 100vh; }
}
@media (max-width: 780px) {
  body { overflow: auto; }
  .app-shell { height: auto; min-height: 100vh; grid-template-columns: 1fr; }
  .sidebar { flex-direction: row; align-items: center; height: auto; padding: 12px; overflow-x: auto; gap: 12px; }
  .sidebar::after { display: none; }
  .brand { padding: 0; }
  .brand .sub, .user-card, .nav-label, .sidebar-foot { display: none; }
  .persona-list { flex-direction: row; overflow-x: auto; }
  .persona-item { min-width: 170px; }
  .persona-item.active::before { display: none; }
  .main { height: auto; min-height: calc(100vh - 66px); }
  .topbar { min-height: 64px; flex-wrap: wrap; padding: 10px 16px; gap: 10px; }
  .persona-hero p { display: none; }
  .top-actions { flex-wrap: wrap; }
  .stage { display: block; }
  .chat-scroll { max-height: calc(100vh - 300px); }
  .msg.user .msg-body { max-width: 88%; }
  .admin-shell { grid-template-columns: 1fr; height: auto; }
  .admin-side { height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; }
  .admin-side .brand .sub, .admin-side .admin-user, .admin-side .sidebar-foot, .admin-side .side-btn { display: none; }
  .admin-nav { flex-direction: row; overflow-x: auto; }
  .admin-nav button { white-space: nowrap; }
  .admin-main { height: auto; padding: 20px 16px 32px; }
  .admin-head { flex-direction: column; align-items: flex-start; }
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .login-main { padding: 24px 16px; }
}

/* ============================================================
   共享笔记库
   ============================================================ */
.modal-card.wide { width: min(980px, 100%); }
.library-card { padding: 18px 20px 6px; }
.library-toolbar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.library-toolbar input,
.library-toolbar select {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 11px;
  font-size: 13px;
  color: var(--ink);
  background: #fff;
  outline: none;
}
.library-toolbar input { flex: 1 1 280px; min-width: 0; }
.library-toolbar input:focus,
.library-toolbar select:focus { border-color: #ffb3c2; box-shadow: 0 0 0 3px rgba(255, 46, 85, .08); }
.library-toolbar .primary-btn { padding: 9px 16px; }
.library-meta { font-size: 11.5px; color: var(--ink-3); margin: 4px 2px 10px; min-height: 16px; }
.library-items { display: flex; flex-direction: column; gap: 8px; max-height: 58vh; overflow: auto; padding-right: 2px; }
.library-item {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  cursor: pointer;
  text-align: left;
  width: 100%;
}
.library-item:hover { border-color: var(--brand-line); background: #fffafb; }
.library-thumb {
  width: 52px;
  height: 66px;
  flex: 0 0 auto;
  border-radius: 8px;
  object-fit: cover;
  background: #f3f5f9;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  color: var(--ink-3);
}
.library-item-main { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 3px; }
.library-item-title { font-size: 13px; font-weight: 650; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.library-item-sub { font-size: 11px; color: var(--ink-3); display: flex; flex-wrap: wrap; gap: 8px; }
.library-badge { font-size: 10px; padding: 1px 6px; border-radius: 999px; background: var(--brand-soft); color: var(--brand); }
.library-empty { padding: 32px 12px; text-align: center; color: var(--ink-3); font-size: 12.5px; }
.library-pager { display: flex; align-items: center; gap: 8px; padding: 10px 2px 6px; font-size: 11.5px; color: var(--ink-3); }
.library-pager .spacer { flex: 1; }
.library-pager button {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink-2);
  padding: 5px 10px;
  font-size: 11.5px;
}
.library-pager button:hover:not(:disabled) { border-color: var(--brand-line); color: var(--brand); }
.library-pager button:disabled { opacity: .45; cursor: not-allowed; }
.library-back {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink-2);
  padding: 5px 10px;
  font-size: 11.5px;
  margin-bottom: 10px;
}
.library-back:hover { border-color: var(--brand-line); color: var(--brand); }
.library-detail { max-height: 66vh; overflow: auto; padding-right: 2px; }
.library-detail h3 { margin: 2px 0 8px; font-size: 16px; line-height: 1.45; }
.detail-meta { display: flex; flex-wrap: wrap; gap: 8px 14px; font-size: 11.5px; color: var(--ink-3); margin-bottom: 10px; }
.detail-meta b { color: var(--ink-2); font-weight: 650; }
.library-desc {
  white-space: pre-wrap;
  font-size: 13px;
  line-height: 1.7;
  color: var(--ink-2);
  background: #f8f9fc;
  border-radius: 10px;
  padding: 12px;
  margin: 8px 0 12px;
  word-break: break-word;
}
.library-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.library-tag { font-size: 11px; color: var(--brand); background: var(--brand-soft); padding: 2px 8px; border-radius: 999px; }
.library-images { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; margin: 8px 0 14px; }
.library-images img { width: 100%; border-radius: 10px; border: 1px solid var(--line); display: block; background: #f3f5f9; }
.library-section-title { font-size: 12px; font-weight: 700; color: var(--ink-2); margin: 14px 0 8px; display: flex; align-items: center; gap: 8px; }
.library-comments { display: flex; flex-direction: column; gap: 8px; }
.library-comment { border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; font-size: 12px; }
.library-comment .c-head { display: flex; gap: 8px; color: var(--ink-3); font-size: 11px; margin-bottom: 3px; }
.library-comment .c-head b { color: var(--ink-2); }
.library-comment p { margin: 0; color: var(--ink-2); line-height: 1.6; white-space: pre-wrap; word-break: break-word; }
.library-sub-comments { margin: 6px 0 0 12px; padding-left: 8px; border-left: 2px solid var(--line); display: flex; flex-direction: column; gap: 4px; }
.library-sub-comments p { font-size: 11.5px; color: var(--ink-3); }
.library-video { border: 1px solid var(--line); border-radius: 10px; padding: 10px; font-size: 12px; color: var(--ink-2); display: flex; flex-direction: column; gap: 8px; }
.library-video .url { word-break: break-all; font-size: 11px; color: var(--ink-3); }
.library-video .row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.library-detail a { color: var(--brand); }
.note-action.primary { color: var(--brand); font-weight: 650; }
.note-action.primary:hover { background: var(--brand-soft); }
.note-action:disabled { opacity: .5; cursor: not-allowed; }
.note-sub.error { color: var(--danger); }

@media (max-width: 780px) {
  .library-items { max-height: 52vh; }
  .library-detail { max-height: 60vh; }
}

/* 管理员 · 数据库管理 */
.panel-tabs {
  display: inline-flex;
  gap: 3px;
  padding: 3px;
  border: 1px solid #e6ecf5;
  border-radius: 10px;
  background: #f1f4f9;
}
.panel-tab {
  padding: 6px 16px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--ink-3);
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  transition: background .15s ease, color .15s ease, box-shadow .15s ease;
}
.panel-tab:hover { color: var(--ink); }
.panel-tab.active {
  background: #fff;
  color: #ff2e55;
  box-shadow: 0 1px 3px rgba(15, 23, 42, .12);
}
.panel-tab:focus-visible {
  outline: 2px solid rgba(255, 46, 85, .38);
  outline-offset: 1px;
}
.panel-tabs + .panel-title-actions { margin-left: auto; }
.panel-title-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
  min-width: 0;
}
table.data th.note-select-cell,
table.data td.note-select-cell {
  width: 38px;
  padding-left: 12px;
  padding-right: 4px;
  text-align: center;
}
.note-select-cell input {
  width: 15px;
  height: 15px;
  margin: 0;
  accent-color: #ff2e55;
  cursor: pointer;
  vertical-align: middle;
}
.note-filters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 10px 12px;
  /* 左右内边距与 .panel-title / .toolbar / .pager 的 18px 对齐，筛选框不再贴卡片边框 */
  padding: 14px 18px;
  margin: 0;
  border-bottom: 1px solid var(--line-soft);
}
.note-filters label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  font-size: 11px;
  color: var(--ink-3);
}
.note-filters input,
.note-filters select {
  /* 日期框和下拉框有自身最小宽度，不锁死会被 .admin-panel 的 overflow:hidden 裁掉右侧 */
  width: 100%;
  min-width: 0;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 8px 10px;
  font-size: 12.5px;
  background: #fff;
  color: var(--ink);
  outline: none;
}
.note-filters input:focus,
.note-filters select:focus { border-color: #ffb3c2; box-shadow: 0 0 0 3px rgba(255, 46, 85, .08); }
.note-filter-actions { display: flex; gap: 8px; align-items: flex-end; }
.note-thumb { width: 46px; height: 46px; border-radius: 8px; object-fit: cover; display: block; background: #f3f5f9; }
.note-db-block { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin-bottom: 12px; }
.note-db-block p { margin: 4px 0; word-break: break-all; }
.note-db-comments { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.note-db-comment { border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; font-size: 12px; color: var(--ink-2); }
.note-db-comment p { margin: 4px 0 0; line-height: 1.6; white-space: pre-wrap; word-break: break-word; }

/* ============================================================
   管理端弹层：笔记详情 / 删除确认
   ============================================================ */
#admin-modal .modal-card {
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
  border: 1px solid #e4eaf3;
  background: #fff;
  box-shadow: 0 30px 80px rgba(15, 23, 42, .18), 0 1px 0 rgba(255, 255, 255, .8) inset;
}
#admin-modal .modal-card.wide { width: min(1040px, 100%); }
#admin-modal .modal-card.danger-dialog { width: min(500px, 100%); }
#admin-modal .modal-head {
  flex: 0 0 auto;
  margin: 0;
  padding: 17px 22px;
  border-bottom: 1px solid var(--line-soft);
  background: linear-gradient(180deg, #fcfdff, #f9fbff);
}
#admin-modal .modal-head h2 { font-size: 16.5px; letter-spacing: .2px; }
#admin-modal #modal-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding: 18px 22px 22px;
  scrollbar-gutter: stable;
}
#admin-modal #modal-body::-webkit-scrollbar { width: 10px; }
#admin-modal #modal-body::-webkit-scrollbar-thumb {
  background: #cfd8e5;
  border: 3px solid #fff;
  border-radius: 99px;
  background-clip: padding-box;
}
#admin-modal #modal-body::-webkit-scrollbar-thumb:hover { background: #b6c2d4; background-clip: padding-box; }
#admin-modal .form-error { min-height: 0; margin: 0; padding: 0 22px; }
#admin-modal .form-error:not(:empty) { padding: 0 22px 16px; }
#admin-modal:not([hidden]) .modal-card { animation: admin-modal-in .2s ease-out; }
@keyframes admin-modal-in {
  from { opacity: 0; transform: translateY(10px) scale(.985); }
  to { opacity: 1; transform: none; }
}

/* 笔记详情 */
.note-detail-hero { padding-bottom: 15px; border-bottom: 1px dashed var(--line); }
.note-detail-title-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 12px; }
.note-detail-title { margin: 0; font-size: 18px; line-height: 1.45; font-weight: 750; color: var(--ink); word-break: break-word; }
.note-type-badge {
  flex: 0 0 auto;
  margin-top: 3px;
  padding: 3px 10px;
  border: 1px solid #ffd9e2;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand);
  font-size: 11px;
  font-weight: 700;
}
.note-type-badge.video { color: #7c3aed; background: #f5f0ff; border-color: #e6d8ff; }
.note-detail .detail-meta { margin: 0; gap: 7px 8px; }
.note-detail .detail-meta span {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  padding: 4px 9px;
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  background: #f7f9fc;
  font-size: 11px;
  line-height: 1.4;
  color: var(--ink-3);
}
.note-detail .detail-meta b { color: var(--ink-2); font-weight: 650; }
.note-detail-link { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 11px; font-size: 12px; }
.note-detail-link a { color: var(--brand); font-weight: 600; text-decoration: none; }
.note-detail-link a:hover { text-decoration: underline; }
.note-detail-section { margin-top: 18px; }
.note-detail-section h4 { display: flex; align-items: center; gap: 8px; margin: 0 0 9px; font-size: 12.5px; font-weight: 700; color: var(--ink-2); }
.note-detail-section h4::before { content: ""; width: 3px; height: 13px; border-radius: 2px; background: linear-gradient(180deg, #ff2e55, #ff8aa0); }
.note-count { padding: 1px 7px; border-radius: 999px; background: #f3f5f9; color: var(--ink-3); font-size: 11px; font-weight: 500; }
.note-detail .library-desc { margin: 0; border: 1px solid var(--line-soft); background: #f8f9fc; }
.note-detail .library-tags { margin: 9px 0 0; }
.note-detail .library-images { margin: 0; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
.note-detail .library-images img { box-shadow: 0 2px 8px rgba(15, 23, 42, .04); transition: transform .18s ease, box-shadow .18s ease; }
.note-detail .library-images a:hover img { transform: translateY(-2px); box-shadow: 0 10px 22px rgba(15, 23, 42, .14); }
.note-db-disclosure { padding: 12px 14px; border: 1px solid var(--line-soft); border-radius: 12px; background: #fbfcfe; }
.note-db-disclosure > summary { display: flex; align-items: center; gap: 8px; margin: 0; color: var(--ink-2); font-size: 12.5px; font-weight: 700; cursor: pointer; list-style: none; }
.note-db-disclosure > summary::-webkit-details-marker { display: none; }
.note-db-disclosure > summary::before { content: ""; width: 3px; height: 13px; border-radius: 2px; background: linear-gradient(180deg, #ff2e55, #ff8aa0); }
.note-db-disclosure > summary::after { content: "展开"; margin-left: auto; color: var(--ink-3); font-size: 11px; font-weight: 500; }
.note-db-disclosure[open] > summary::after { content: "收起"; }
.note-db-disclosure .note-db-comments { margin-top: 12px; }
.note-detail .note-db-block { margin-bottom: 0; border-color: var(--line-soft); background: #fbfcfe; }

/* 删除确认 */
#admin-modal.danger-mode { background: rgba(20, 26, 38, .46); }
#admin-modal.danger-mode .modal-card {
  border-color: #ffd9e2;
  box-shadow: 0 30px 80px rgba(20, 26, 38, .28), 0 0 0 4px rgba(255, 46, 85, .06);
}
.danger-dialog .modal-head { border-bottom-color: #ffe1e8; background: linear-gradient(180deg, #fff6f8, #fffafb); }
.danger-dialog .modal-head h2 { color: #b3133a; }
.danger-dialog-body { display: flex; flex-direction: column; gap: 14px; }
.danger-hero { display: flex; align-items: flex-start; gap: 14px; }
.danger-icon {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  color: #fff;
  background: linear-gradient(135deg, #e11d48, #ff5d7a);
  box-shadow: 0 8px 20px rgba(225, 29, 72, .28);
}
.danger-icon .icon { width: 24px; height: 24px; stroke-width: 1.9; }
.danger-lead { margin: 2px 0 4px; color: var(--ink); font-size: 15px; font-weight: 750; line-height: 1.5; }
.danger-sub { margin: 0; color: var(--ink-3); font-size: 12px; }
.danger-items {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 148px;
  overflow: auto;
  margin: 0;
  padding: 10px 12px;
  border: 1px solid #ffe1e8;
  border-radius: 12px;
  background: #fffafb;
  list-style: none;
}
.danger-items li { overflow: hidden; color: var(--ink-2); font-size: 12.5px; line-height: 1.5; text-overflow: ellipsis; white-space: nowrap; }
.danger-items li::before { content: "·"; margin-right: 7px; color: var(--danger); font-weight: 900; }
.danger-items .danger-more { color: var(--ink-3); font-size: 12px; }
.danger-warning { padding: 10px 12px; border: 1px solid #ffdce4; border-radius: 12px; background: var(--danger-soft); color: #9f1239; font-size: 11.5px; line-height: 1.7; }
.danger-actions { display: flex; justify-content: flex-end; gap: 10px; padding-top: 2px; }
.danger-actions .ghost-btn { min-width: 96px; }
.danger-confirm {
  min-width: 120px;
  padding: 11px 18px;
  border: 0;
  border-radius: 11px;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .2px;
  cursor: pointer;
  background: linear-gradient(135deg, #e11d48, #ff5d7a);
  box-shadow: 0 10px 22px rgba(225, 29, 72, .26);
  transition: transform .12s, box-shadow .12s, filter .12s;
}
.danger-confirm:hover { filter: brightness(1.05); box-shadow: 0 12px 26px rgba(225, 29, 72, .32); }
.danger-confirm:active { transform: translateY(1px); }
.danger-actions .ghost-btn:focus-visible, .danger-confirm:focus-visible { outline: 3px solid rgba(225, 29, 72, .18); outline-offset: 2px; }

/* 员工端删除确认：与数据库管理的危险操作弹层共用同一套视觉 */
#confirm-modal.danger-mode { background: rgba(20, 26, 38, .46); }
#confirm-modal .modal-card {
  width: min(500px, 100%);
  padding: 0;
  overflow: hidden;
  border: 1px solid #ffd9e2;
  border-radius: 18px;
  box-shadow: 0 30px 80px rgba(20, 26, 38, .28), 0 0 0 4px rgba(255, 46, 85, .06);
}
#confirm-modal .modal-head {
  margin: 0;
  padding: 17px 22px;
  border-bottom: 1px solid #ffe1e8;
  background: linear-gradient(180deg, #fff6f8, #fffafb);
}
#confirm-modal .modal-head h2 { color: #b3133a; font-size: 16.5px; letter-spacing: .2px; }
#confirm-modal .danger-dialog-body { padding: 20px 22px 18px; }
#confirm-modal:not([hidden]) .modal-card { animation: admin-modal-in .2s ease-out; }
@media (max-width: 480px) {
  #confirm-modal { padding: 14px; }
  #confirm-modal .modal-head { padding: 14px 16px; }
  #confirm-modal .danger-dialog-body { padding: 16px; }
}
