/* =========================================================
   DeepSeek 助手 · 海量优品定制主题
   柔和绿 · 浅色常驻（不跟随系统深色）
   ========================================================= */

:root {
  /* 品牌：低饱和绿，久看不累 */
  --brand: #3d9970;
  --brand-strong: #2f7f5c;
  --brand-soft: #e9f6ef;
  --brand-line: #cfe9dd;
  --accent: #5aa88c;

  /* 背景 */
  --bg: #f3f8f5;
  --bg-2: #eef5f1;
  --glow-1: rgba(61, 153, 112, .07);
  --glow-2: rgba(90, 168, 140, .06);
  --panel: #ffffff;
  --panel-soft: #f7fbf9;
  --panel-hover: #eff7f3;

  /* 文字 */
  --text: #1e2f28;
  --text-2: #41574d;
  --muted: #778a81;
  --muted-2: #9aaca4;

  /* 线条 */
  --border: #e4efe9;
  --border-strong: #d3e4dc;

  /* 状态 */
  --danger: #c2503f;
  --danger-soft: #fdf0ed;
  --success: #3d9970;
  --success-soft: #e9f6ef;
  --warn: #9a7326;
  --warn-soft: #fdf7e8;

  /* 圆角 */
  --r-xl: 20px;
  --r-lg: 15px;
  --r-md: 11px;
  --r-sm: 8px;

  /* 阴影：带绿调，很浅 */
  --sh-xs: 0 1px 2px rgba(31, 61, 48, .04);
  --sh-sm: 0 2px 8px rgba(31, 61, 48, .045);
  --sh-md: 0 10px 26px rgba(31, 61, 48, .07);
  --sh-lg: 0 20px 48px rgba(31, 61, 48, .09);
  --ring: 0 0 0 3px rgba(61, 153, 112, .16);

  --topbar-h: 60px;
  --footer-h: 48px;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", sans-serif;
  font-size: 15px;
  line-height: 1.65;
  color: var(--text);
  background-color: var(--bg);
  background-image:
    radial-gradient(820px 460px at 10% -10%, var(--glow-1), transparent 68%),
    radial-gradient(700px 420px at 94% 4%, var(--glow-2), transparent 70%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}

button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; border: none; background: none; }
a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-strong); }
h1, h2, h3, h4 { line-height: 1.35; letter-spacing: -.01em; margin: 0; }
::selection { background: rgba(61, 153, 112, .18); }

* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
*::-webkit-scrollbar { width: 7px; height: 7px; }
*::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 7px; }
*::-webkit-scrollbar-thumb:hover { background: var(--muted-2); }
*::-webkit-scrollbar-track { background: transparent; }

:focus-visible { outline: none; box-shadow: var(--ring); }

.icon { width: 18px; height: 18px; flex-shrink: 0; }
.icon-sm { width: 15px; height: 15px; flex-shrink: 0; }

/* ================= 顶栏 ================= */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  flex-shrink: 0;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 clamp(14px, 3.5vw, 28px);
  background: rgba(255, 255, 255, .86);
  border-bottom: 1px solid var(--border);
  backdrop-filter: saturate(160%) blur(12px);
  -webkit-backdrop-filter: saturate(160%) blur(12px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-weight: 650;
  font-size: 15.5px;
  color: var(--text);
  letter-spacing: -.01em;
}
.brand:hover { color: var(--text); }
.brand-mark {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  color: #fff;
  background: linear-gradient(135deg, #4faa82, var(--brand-strong));
  box-shadow: 0 4px 10px -3px rgba(61, 153, 112, .45);
}
.brand-mark svg { width: 17px; height: 17px; }
.brand-text { display: inline-flex; align-items: baseline; gap: 6px; }
.brand-sub {
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
  padding: 1px 7px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--panel-soft);
}
.topbar .right { display: flex; align-items: center; gap: 8px; font-size: 13.5px; }
.topbar .right a { color: var(--muted); }
.topbar .right a:hover { color: var(--brand); }

.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 4px 12px 4px 10px;
  border-radius: 999px;
  background: var(--brand-soft);
  border: 1px solid var(--brand-line);
  color: var(--brand-strong);
  font-size: 12.5px;
  font-weight: 500;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ================= 按钮 ================= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 15px;
  border-radius: var(--r-md);
  border: 1px solid var(--border-strong);
  background: var(--panel);
  color: var(--text-2);
  font-size: 13.5px;
  font-weight: 500;
  white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s, box-shadow .15s;
}
.btn:hover { border-color: var(--brand-line); color: var(--brand-strong); background: var(--brand-soft); }
.btn:active { transform: translateY(.5px); }

.btn-primary {
  border-color: transparent;
  color: #fff;
  background: linear-gradient(135deg, #4faa82, var(--brand-strong));
  box-shadow: 0 6px 14px -6px rgba(61, 153, 112, .55);
}
.btn-primary:hover {
  color: #fff;
  border-color: transparent;
  background: linear-gradient(135deg, var(--brand-strong), #276a4d);
  box-shadow: 0 8px 18px -6px rgba(61, 153, 112, .6);
}

.btn-danger { color: var(--danger); border-color: #f0d6d0; background: var(--panel); }
.btn-danger:hover { color: #fff; border-color: var(--danger); background: var(--danger); }

.btn-sm { padding: 4px 10px; font-size: 12.5px; border-radius: var(--r-sm); }
.btn-ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--panel-hover); border-color: transparent; color: var(--text); }
.btn:disabled { opacity: .5; cursor: not-allowed; box-shadow: none; }
.full-btn { width: 100%; padding: 11px 18px; font-size: 14.5px; font-weight: 600; }

/* ================= 公告 ================= */
.notice {
  max-width: 1240px;
  margin: 14px auto 0;
  padding: 10px 16px;
  border-radius: var(--r-md);
  font-size: 13.5px;
  background: var(--warn-soft);
  border: 1px solid #f0e5c8;
  color: var(--warn);
}
.notice.error { background: var(--danger-soft); border-color: #f0d6d0; color: var(--danger); }
.notice.hidden { display: none !important; }

/* =========================================================
   登录 / 注册
   ========================================================= */
#authView { flex: 1; }

.auth-card {
  max-width: 880px;
  margin: clamp(20px, 5vh, 56px) auto;
  display: grid;
  grid-template-columns: 1fr .92fr;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  box-shadow: var(--sh-md);
  overflow: hidden;
}

.auth-hero {
  position: relative;
  padding: 42px 36px;
  background: linear-gradient(160deg, #eef8f3 0%, #f7fbf9 55%, #eaf5f0 100%);
  display: flex;
  flex-direction: column;
  justify-content: center;
  overflow: hidden;
}
.auth-hero::before {
  content: "";
  position: absolute;
  width: 240px; height: 240px;
  border-radius: 50%;
  top: -90px; right: -80px;
  background: radial-gradient(circle, rgba(61, 153, 112, .14), transparent 70%);
}
.auth-hero::after {
  content: "";
  position: absolute;
  width: 200px; height: 200px;
  border-radius: 50%;
  bottom: -80px; left: -60px;
  background: radial-gradient(circle, rgba(90, 168, 140, .12), transparent 70%);
}
.auth-hero > * { position: relative; z-index: 1; }

.hero-badge {
  align-self: flex-start;
  font-size: 11.5px;
  letter-spacing: .06em;
  padding: 4px 11px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid var(--brand-line);
  color: var(--brand-strong);
  font-weight: 500;
  margin-bottom: 20px;
}
.auth-hero h1 {
  font-size: clamp(21px, 2.2vw, 26px);
  font-weight: 650;
  color: #1b3a2d;
  margin-bottom: 12px;
  line-height: 1.45;
}
.auth-hero p { margin: 0 0 24px; color: #55705f; font-size: 13.5px; line-height: 1.75; }
.hero-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 11px; }
.hero-list li { display: flex; align-items: flex-start; gap: 9px; font-size: 13.5px; color: #3f5c4e; }
.hero-list .ico {
  flex-shrink: 0;
  width: 18px; height: 18px;
  margin-top: 2px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: #fff;
  border: 1px solid var(--brand-line);
  color: var(--brand);
  font-size: 10px;
}

.auth-form { padding: 42px 36px; display: flex; flex-direction: column; justify-content: center; }
.auth-form h2 { font-size: 20px; margin-bottom: 5px; }
.auth-form .sub { margin: 0 0 22px; color: var(--muted); font-size: 13.5px; }

.tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3px;
  padding: 3px;
  background: var(--panel-soft);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  margin-bottom: 20px;
}
.tabs button {
  padding: 8px 12px;
  border-radius: var(--r-sm);
  color: var(--muted);
  font-size: 13.5px;
  font-weight: 500;
  transition: .15s;
}
.tabs button:hover { color: var(--text-2); }
.tabs button.active { background: #fff; color: var(--brand-strong); box-shadow: var(--sh-xs); }

/* ================= 表单 ================= */
.field { margin-bottom: 15px; }
.field label { display: block; font-size: 12.5px; font-weight: 500; color: var(--muted); margin-bottom: 6px; }
.field input,
.field textarea,
.field select {
  width: 100%;
  padding: 10px 13px;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  background: var(--panel);
  color: var(--text);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.field input::placeholder,
.field textarea::placeholder { color: var(--muted-2); }
.field input:hover,
.field textarea:hover { border-color: var(--brand-line); }
.field input:focus,
.field textarea:focus { border-color: var(--brand); box-shadow: var(--ring); }
.field textarea { resize: vertical; min-height: 78px; line-height: 1.65; }

.hint { font-size: 12.5px; color: var(--muted); text-align: center; margin-top: 14px; }
.msg { min-height: 19px; font-size: 13px; margin-top: 10px; }
.msg.err { color: var(--danger); }
.msg.ok { color: var(--success); }

/* =========================================================
   用户端主界面：左历史 / 右对话
   ========================================================= */
#mainView { display: block; }

.app-shell {
  display: grid;
  grid-template-columns: 264px minmax(0, 1fr);
  height: calc(100vh - var(--topbar-h) - var(--footer-h));
  height: calc(100dvh - var(--topbar-h) - var(--footer-h));
  max-width: 1420px;
  margin: 0 auto;
  width: 100%;
  min-height: 0;
}

/* ---- 左侧栏 ---- */
.app-sidebar {
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 14px 12px 10px;
  border-right: 1px solid var(--border);
  background: rgba(255, 255, 255, .5);
  gap: 12px;
}

.side-new {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  padding: 10px 14px;
  border-radius: var(--r-md);
  font-size: 13.5px;
  font-weight: 600;
  color: #fff;
  background: linear-gradient(135deg, #4faa82, var(--brand-strong));
  box-shadow: 0 6px 14px -7px rgba(61, 153, 112, .7);
  transition: filter .15s, box-shadow .15s;
}
.side-new:hover { filter: brightness(1.04); box-shadow: 0 8px 18px -7px rgba(61, 153, 112, .8); }

.side-nav { display: grid; gap: 2px; }
.side-nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 8px 11px;
  border-radius: var(--r-sm);
  font-size: 13.5px;
  color: var(--text-2);
  text-align: left;
  transition: background .14s, color .14s;
}
.side-nav-item:hover { background: var(--panel-hover); }
.side-nav-item.active { background: var(--brand-soft); color: var(--brand-strong); font-weight: 550; }
.side-nav-item .icon { color: currentColor; opacity: .85; }

.side-label {
  padding: 4px 11px 2px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: .05em;
  color: var(--muted-2);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.side-label span.count { font-weight: 500; letter-spacing: 0; }

.conv-list { flex: 1; min-height: 0; overflow-y: auto; padding: 2px; }
.conv-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: var(--r-sm);
  cursor: pointer;
  color: var(--text-2);
  transition: background .14s, color .14s;
}
.conv-item:hover { background: var(--panel-hover); }
.conv-item.active { background: var(--brand-soft); color: var(--brand-strong); }
.conv-item .title {
  flex: 1;
  font-size: 13.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.conv-item .del {
  flex-shrink: 0;
  width: 20px; height: 20px;
  display: grid; place-items: center;
  border-radius: 5px;
  color: var(--muted-2);
  font-size: 10px;
  opacity: 0;
  transition: .14s;
}
.conv-item:hover .del { opacity: 1; }
.conv-item .del:hover { background: var(--danger-soft); color: var(--danger); }

.side-foot {
  padding: 10px 11px 2px;
  border-top: 1px solid var(--border);
  font-size: 11.5px;
  color: var(--muted-2);
  display: flex;
  align-items: center;
  gap: 6px;
}
.side-foot .dot-live {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 3px var(--success-soft);
}

/* ---- 右侧主区 ---- */
.app-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  background: var(--panel);
}

#chatView {
  display: grid;
  flex: 1;
  min-height: 0;
  grid-template-rows: auto minmax(0, 1fr) auto;
}

.chat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 24px;
  border-bottom: 1px solid var(--border);
  background: rgba(247, 251, 249, .8);
  backdrop-filter: blur(8px);
}
.chat-head strong { font-size: 14.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.model-tag {
  flex-shrink: 0;
  font-size: 11.5px;
  color: var(--brand-strong);
  background: var(--brand-soft);
  border: 1px solid var(--brand-line);
  border-radius: 999px;
  padding: 2px 10px;
  font-weight: 500;
}

.messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 26px 24px 10px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  scroll-behavior: smooth;
}
.messages > .msg-row,
.messages > .empty { width: 100%; max-width: 780px; margin-left: auto; margin-right: auto; }

.msg-row { display: flex; align-items: flex-start; gap: 11px; }
.msg-row.user { flex-direction: row-reverse; }

.avatar {
  flex-shrink: 0;
  width: 30px; height: 30px;
  border-radius: 9px;
  display: grid; place-items: center;
  font-size: 11.5px;
  font-weight: 600;
  color: #fff;
  background: linear-gradient(135deg, #57ae88, var(--brand-strong));
  margin-top: 2px;
}
.msg-row.user .avatar {
  background: var(--panel-soft);
  color: var(--muted);
  border: 1px solid var(--border);
}

.bubble {
  max-width: min(82%, 640px);
  padding: 11px 15px;
  border-radius: 13px;
  background: var(--panel-soft);
  border: 1px solid var(--border);
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: anywhere;
  font-size: 14.5px;
  line-height: 1.78;
}
.msg-row.user .bubble {
  background: var(--brand-soft);
  border-color: var(--brand-line);
  color: #1f4736;
  border-bottom-right-radius: 5px;
}
.msg-row:not(.user) .bubble { border-bottom-left-radius: 5px; }

.reasoning {
  margin: 0 0 9px;
  padding: 8px 11px;
  border-left: 2px solid var(--brand-line);
  border-radius: 0 7px 7px 0;
  background: #f4f9f6;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.7;
  white-space: pre-wrap;
}
.msg-row.user .reasoning { display: none; }

.composer {
  display: flex;
  justify-content: center;
  padding: 10px 24px 16px;
  border-top: 1px solid var(--border);
  background: var(--panel);
}
.composer-inner {
  display: flex;
  align-items: flex-end;
  gap: 9px;
  width: 100%;
  max-width: 780px;
}
.composer textarea {
  flex: 1;
  height: 50px;
  padding: 13px 15px;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  background: var(--panel-soft);
  color: var(--text);
  resize: none;
  outline: none;
  line-height: 1.5;
  font-size: 14.5px;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.composer textarea::placeholder { color: var(--muted-2); }
.composer textarea:focus { border-color: var(--brand); background: #fff; box-shadow: var(--ring); }
.composer .btn { height: 50px; padding: 0 22px; border-radius: var(--r-md); font-weight: 600; }

.empty {
  margin: auto;
  padding: 40px 20px;
  color: var(--muted);
  text-align: center;
  font-size: 13.5px;
}

/* ================= 历史记录 ================= */
.history-view {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 24px;
  background: var(--panel);
}
.history-inner { max-width: 860px; margin: 0 auto; }

.history-toolbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}
.history-toolbar h3 { font-size: 16px; }
.history-toolbar .desc { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.history-actions { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }

.search-input {
  min-width: 220px;
  padding: 8px 13px;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  background: var(--panel-soft);
  outline: none;
  font-size: 13.5px;
  transition: .15s;
}
.search-input::placeholder { color: var(--muted-2); }
.search-input:focus { border-color: var(--brand); background: #fff; box-shadow: var(--ring); }

.history-list { display: flex; flex-direction: column; gap: 9px; }
.history-day {
  margin: 14px 0 1px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: .05em;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 10px;
}
.history-day::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.history-day:first-child { margin-top: 0; }

.history-item {
  padding: 11px 14px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--panel-soft);
}
.history-item.assistant { background: #f5faf7; border-color: var(--brand-line); }
.history-meta { font-size: 11.5px; color: var(--muted); margin-bottom: 4px; }
.history-content { font-size: 13.5px; line-height: 1.75; white-space: pre-wrap; word-break: break-word; overflow-wrap: anywhere; }
.history-more { text-align: center; margin-top: 16px; }

/* ================= 页脚 ================= */
.site-footer {
  flex-shrink: 0;
  height: var(--footer-h);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 0 16px;
  font-size: 12px;
  color: var(--muted-2);
  border-top: 1px solid var(--border);
  background: rgba(255, 255, 255, .6);
  text-align: center;
}
.site-footer strong { color: var(--muted); font-weight: 500; }

/* =========================================================
   管理后台：左导航 / 右内容
   ========================================================= */
.admin-shell {
  display: grid;
  grid-template-columns: 216px minmax(0, 1fr);
  height: calc(100vh - var(--topbar-h));
  height: calc(100dvh - var(--topbar-h));
  max-width: 1440px;
  margin: 0 auto;
  width: 100%;
  min-height: 0;
}

.admin-nav {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 16px 12px;
  border-right: 1px solid var(--border);
  background: rgba(255, 255, 255, .5);
  min-height: 0;
}
.admin-nav .nav-title {
  padding: 0 10px 8px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: .06em;
  color: var(--muted-2);
}
.admin-nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 11px;
  border-radius: var(--r-sm);
  font-size: 13.5px;
  color: var(--text-2);
  text-align: left;
  transition: background .14s, color .14s;
}
.admin-nav-item:hover { background: var(--panel-hover); }
.admin-nav-item.active { background: var(--brand-soft); color: var(--brand-strong); font-weight: 550; }
.admin-nav-item .icon { opacity: .85; }
.admin-nav .nav-spacer { flex: 1; }
.admin-nav .nav-foot { border-top: 1px solid var(--border); padding-top: 10px; margin-top: 6px; }

.admin-main {
  min-width: 0;
  min-height: 0;
  overflow-y: auto;
  padding: 24px;
  background: var(--panel);
}
.admin-panel-wrap { max-width: 1000px; margin: 0 auto; }
.admin-panel-section { display: none; }
.admin-panel-section.active { display: block; }

.admin-foot {
  max-width: 1000px;
  margin: 30px auto 6px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  font-size: 11.5px;
  color: var(--muted-2);
  text-align: center;
}

.admin-page-head { margin-bottom: 18px; }
.admin-page-head h2 { font-size: 18px; margin-bottom: 3px; }
.admin-page-head .desc { font-size: 13px; color: var(--muted); }

/* ---- 统计卡 ---- */
.cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 18px; }

.stat-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  transition: border-color .16s, box-shadow .16s;
}
.stat-card:hover { border-color: var(--brand-line); box-shadow: var(--sh-sm); }
.stat-icon {
  flex-shrink: 0;
  width: 38px; height: 38px;
  border-radius: 10px;
  display: grid; place-items: center;
  background: var(--brand-soft);
  color: var(--brand);
}
.stat-icon svg { width: 18px; height: 18px; }
.stat-card .label { font-size: 12px; color: var(--muted); font-weight: 500; }
.stat-card .value {
  font-size: 22px;
  font-weight: 650;
  letter-spacing: -.02em;
  margin-top: 1px;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

/* ---- 卡片 ---- */
.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 20px;
}
.card h3 { font-size: 14.5px; margin-bottom: 14px; display: flex; align-items: center; gap: 8px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 13px 0;
  border-bottom: 1px solid var(--border);
}
.switch-row:last-of-type { border-bottom: 0; }
.switch-row strong { font-size: 13.5px; font-weight: 600; }
.switch-row .desc { font-size: 12px; color: var(--muted); margin-top: 2px; line-height: 1.55; }

.switch {
  position: relative;
  flex-shrink: 0;
  width: 44px; height: 25px;
  border-radius: 999px;
  background: var(--border-strong);
  transition: background .2s;
}
.switch::after {
  content: "";
  position: absolute;
  top: 3px; left: 3px;
  width: 19px; height: 19px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .22);
  transition: transform .2s;
}
.switch.on { background: linear-gradient(135deg, #57ae88, var(--brand-strong)); }
.switch.on::after { transform: translateX(19px); }

table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th, td { text-align: left; padding: 10px 9px; border-bottom: 1px solid var(--border); }
th { font-size: 11.5px; font-weight: 600; letter-spacing: .04em; color: var(--muted); }
tbody tr:hover { background: var(--panel-soft); }
tr:last-child td { border-bottom: 0; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  font-weight: 500;
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--panel-soft);
  border: 1px solid var(--border);
  color: var(--muted);
}
.badge::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.badge.ok { background: var(--success-soft); border-color: var(--brand-line); color: var(--success); }
.badge.off { background: var(--danger-soft); border-color: #f0d6d0; color: var(--danger); }

/* ---- 后台登录 ---- */
.admin-login-card {
  max-width: 400px;
  margin: clamp(30px, 9vh, 90px) auto;
  padding: 34px 30px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  box-shadow: var(--sh-md);
}
.admin-login-card .lock {
  width: 42px; height: 42px;
  margin: 0 auto 16px;
  border-radius: 12px;
  display: grid; place-items: center;
  color: #fff;
  background: linear-gradient(135deg, #4faa82, var(--brand-strong));
  box-shadow: 0 8px 18px -8px rgba(61, 153, 112, .8);
}
.admin-login-card .lock svg { width: 20px; height: 20px; }
.admin-login-card h2 { font-size: 18px; text-align: center; margin-bottom: 5px; }
.admin-login-card .sub { margin: 0 0 22px; text-align: center; color: var(--muted); font-size: 12.5px; }

/* ================= Toast ================= */
.toast {
  position: fixed;
  left: 50%;
  bottom: 62px;
  transform: translate(-50%, 10px);
  z-index: 200;
  max-width: min(90vw, 420px);
  padding: 10px 18px;
  border-radius: 999px;
  background: rgba(30, 47, 40, .94);
  color: #eef7f2;
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--sh-md);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s, transform .2s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.hidden { display: none !important; }

/* =========================================================
   响应式
   ========================================================= */
@media (max-width: 1000px) {
  .auth-card { grid-template-columns: 1fr; max-width: 460px; }
  .auth-hero { padding: 30px 28px 26px; }
  .hero-list { display: none; }
  .auth-form { padding: 30px 28px; }
  .cards { grid-template-columns: repeat(2, 1fr); }
  .grid-2 { grid-template-columns: 1fr; }
}

@media (max-width: 820px) {
  .app-shell {
    grid-template-columns: 1fr;
    height: auto;
    min-height: calc(100dvh - var(--topbar-h) - var(--footer-h));
  }
  .app-sidebar {
    flex-direction: column;
    max-height: 232px;
    border-right: 0;
    border-bottom: 1px solid var(--border);
    padding: 10px 12px;
  }
  .side-new { padding: 8px 14px; }
  .app-main { min-height: calc(100dvh - 300px); }
  #chatView { min-height: 60vh; }
  .admin-shell { grid-template-columns: 1fr; height: auto; }
  .admin-nav {
    flex-direction: row;
    overflow-x: auto;
    border-right: 0;
    border-bottom: 1px solid var(--border);
    padding: 10px 12px;
    gap: 4px;
  }
  .admin-nav .nav-title,
  .admin-nav .nav-spacer,
  .admin-nav .nav-foot { display: none; }
  .admin-nav-item { white-space: nowrap; padding: 7px 12px; }
  .admin-main { padding: 16px; }
  .messages { padding: 18px 14px 6px; }
  .composer { padding: 8px 14px 14px; }
  .chat-head { padding: 12px 14px; }
  .bubble { max-width: 88%; }
}

@media (max-width: 560px) {
  .brand-sub { display: none; }
  .cards { grid-template-columns: 1fr; }
  .auth-form, .auth-hero { padding: 26px 20px; }
  .admin-login-card { padding: 26px 20px; margin: 24px 12px; }
  .history-view { padding: 16px 12px; }
  .history-actions { width: 100%; }
  .search-input { flex: 1; min-width: 0; }
  .site-footer { font-size: 11px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
