/* 匿语 · 样式表
   设计基调：紫靛主色 + 极浅冷灰底 + 大圆角 + 轻投影，克制但精致。 */

:root {
  --bg: #f4f5fa;
  --surface: #ffffff;
  --surface-2: #f8f9fc;
  --surface-3: #eef0f7;
  --line: #e9ebf3;
  --line-strong: #dbdfeb;
  --text: #131620;
  --text-2: #454b5c;
  --muted: #868da1;
  --accent: #5b4ee6;
  --accent-2: #7d6dfb;
  --accent-deep: #4a3dd0;
  --accent-soft: #efefff;
  --accent-softer: #f7f6ff;
  --danger: #d92d20;
  --danger-soft: #fef3f2;
  --warn: #b45309;
  --warn-soft: #fffaeb;
  --ok: #067647;
  --radius: 16px;
  --shadow-sm: 0 1px 2px rgba(19, 22, 32, .04), 0 1px 3px rgba(19, 22, 32, .05);
  --shadow-md: 0 12px 32px -14px rgba(19, 22, 32, .22), 0 2px 6px rgba(19, 22, 32, .04);
  --shadow-lg: 0 26px 64px -22px rgba(19, 22, 32, .34);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB",
          "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}
h1, h2, h3, p { margin: 0; }
button { font-family: inherit; font-size: inherit; cursor: pointer; }
textarea, input, select { font-family: inherit; font-size: inherit; }
[hidden] { display: none !important; }
.hidden { display: none !important; }
::selection { background: rgba(91, 78, 230, .16); }
:focus-visible { outline: 2px solid rgba(91, 78, 230, .5); outline-offset: 2px; }

/* 细滚动条，避免默认粗条破坏观感 */
* { scrollbar-width: thin; scrollbar-color: #d3d8e6 transparent; }
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: #d3d8e6; border-radius: 999px;
  border: 2px solid transparent; background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover { background: #bcc3d6; background-clip: content-box; }

/* ---------- 通用控件 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--text);
  padding: 8px 14px;
  border-radius: 11px;
  font-weight: 500;
  transition: background .16s ease, border-color .16s ease, box-shadow .16s ease, transform .12s ease;
  white-space: nowrap;
}
.btn:hover { background: var(--surface-2); border-color: #c9cde0; }
.btn:active { transform: scale(.985); }
.btn.primary {
  background: linear-gradient(135deg, var(--accent-2), var(--accent));
  color: #fff;
  border-color: transparent;
  box-shadow: 0 6px 16px -8px rgba(91, 78, 230, .75), inset 0 1px 0 rgba(255, 255, 255, .18);
}
.btn.primary:hover { filter: brightness(1.05); box-shadow: 0 10px 22px -10px rgba(91, 78, 230, .8); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--surface-3); color: var(--text); }
.btn.danger { color: var(--danger); border-color: #f5cdc8; background: #fff; }
.btn.danger:hover { background: var(--danger-soft); }
.btn.sm { padding: 5px 11px; font-size: 12.5px; border-radius: 9px; }
.btn:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; filter: none; transform: none; }

.icon-btn {
  width: 34px; height: 34px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid transparent;
  background: transparent;
  border-radius: 10px;
  color: var(--text-2);
  font-size: 16px;
  line-height: 1;
  transition: background .16s, color .16s, transform .12s;
}
.icon-btn svg { width: 18px; height: 18px; display: block; }
.icon-btn:hover { background: var(--surface-3); color: var(--text); }
.icon-btn:active { transform: scale(.94); }
.icon-btn:disabled { opacity: .32; cursor: not-allowed; }
.icon-btn:disabled:hover { background: transparent; }

.tag {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  background: var(--accent-soft);
  color: var(--accent);
  vertical-align: middle;
}
.tag.mini { padding: 0 6px; font-size: 10px; font-weight: 600; vertical-align: 1px; margin-left: 5px; }
.tag.gray { background: var(--surface-3); color: var(--muted); }
.tag.red { background: var(--danger-soft); color: var(--danger); }
.tag.green { background: #ecfdf3; color: var(--ok); }

/* 隐藏的文件选择框（不能用 hidden/display:none，部分手机浏览器点不动） */
.file-input {
  position: absolute; width: 1px; height: 1px;
  opacity: 0; pointer-events: none; left: -9999px;
}

/* ---------- 启动 ---------- */
.boot {
  position: fixed; inset: 0;
  display: flex; flex-direction: column; gap: 16px;
  align-items: center; justify-content: center;
  background:
    radial-gradient(800px 400px at 50% -10%, #eae9ff 0%, transparent 65%),
    var(--bg);
  color: var(--muted);
  font-size: 13px;
}
.boot-logo {
  width: 46px; height: 46px; border-radius: 15px;
  background: linear-gradient(135deg, var(--accent-2), var(--accent));
  box-shadow: 0 12px 26px -12px rgba(91, 78, 230, .8);
  animation: pulse 1.6s ease-in-out infinite;
}
@keyframes pulse { 0%, 100% { opacity: .5; transform: scale(.94); } 50% { opacity: 1; transform: scale(1); } }

/* ---------- 登录页 ---------- */
.auth {
  min-height: 100%;
  display: flex; align-items: center; justify-content: center;
  padding: 28px 16px;
  background:
    radial-gradient(760px 420px at 12% -8%, #e7e6ff 0%, transparent 62%),
    radial-gradient(680px 380px at 100% 4%, #e4f4ff 0%, transparent 58%),
    var(--bg);
}
.auth-card {
  width: 100%; max-width: 404px;
  background: var(--surface);
  border: 1px solid rgba(255, 255, 255, .8);
  border-radius: 24px;
  padding: 30px 26px 26px;
  box-shadow: var(--shadow-lg);
  animation: rise .28s ease both;
}
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.auth-brand { display: flex; gap: 13px; align-items: center; margin-bottom: 24px; }
.logo {
  width: 46px; height: 46px; flex: none;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--accent-2), var(--accent));
  color: #fff; font-size: 20px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 10px 22px -12px rgba(91, 78, 230, .9), inset 0 1px 0 rgba(255, 255, 255, .25);
}
.auth-brand h1 { font-size: 19px; letter-spacing: .4px; }
.auth-brand p { font-size: 12.5px; color: var(--muted); margin-top: 3px; }

.tabs {
  display: flex; gap: 4px; padding: 4px;
  background: var(--surface-3); border-radius: 12px; margin-bottom: 20px;
}
.tab {
  flex: 1; border: 0; background: transparent; padding: 8px;
  border-radius: 9px; color: var(--muted); font-weight: 500;
  transition: .16s;
}
.tab:hover { color: var(--text-2); }
.tab.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }

.auth-form { display: flex; flex-direction: column; gap: 13px; }
.auth-form label { display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; color: var(--text-2); font-weight: 500; }
.auth-form input {
  border: 1px solid var(--line-strong); border-radius: 11px;
  padding: 11px 12px; outline: none; transition: .16s; background: #fff;
}
.auth-form input::placeholder { color: #a9aebe; }
.auth-form input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(91, 78, 230, .11); }
.auth-form .btn { margin-top: 8px; padding: 11px; border-radius: 12px; }
.hint { font-size: 11.5px; color: var(--muted); line-height: 1.65; }
.notice {
  margin-top: 16px; padding: 10px 12px; border-radius: 11px;
  background: var(--warn-soft); color: var(--warn);
  border: 1px solid #f7e3b5; font-size: 12.5px;
}

/* ---------- 应用框架 ---------- */
.app {
  display: grid;
  grid-template-columns: 292px 1fr;
  grid-template-rows: 100%;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}
.sidebar {
  display: flex; flex-direction: column;
  background: linear-gradient(180deg, #fcfdff 0%, #f6f7fc 100%);
  border-right: 1px solid var(--line);
  min-height: 0;
}
.side-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 12px 12px 18px;
}
.brand {
  display: flex; align-items: center; gap: 8px;
  font-weight: 650; letter-spacing: .5px; font-size: 15px;
}
.brand .dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-2), var(--accent));
  box-shadow: 0 0 0 4px rgba(91, 78, 230, .12);
}
.side-head-actions { display: flex; gap: 2px; }

.side-notice {
  margin: 0 12px 10px;
  padding: 9px 11px;
  border-radius: 12px;
  font-size: 12.5px;
  line-height: 1.5;
  background: #eff3ff;
  border: 1px solid #dfe6fb;
  color: #2a3f7a;
  display: flex;
  gap: 7px;
  align-items: flex-start;
}
.side-notice.warn { background: var(--warn-soft); border-color: #f7e3b5; color: var(--warn); }
.side-notice .ic { flex: none; }
.side-notice .txt { flex: 1; min-width: 0; }
.side-notice time { display: block; font-size: 11px; opacity: .62; margin-top: 2px; }

.room-list { flex: 1; overflow-y: auto; padding: 2px 10px 10px; }
.room-item {
  position: relative;
  display: flex; gap: 10px; align-items: center;
  padding: 9px 10px; border-radius: 13px; cursor: pointer;
  transition: background .15s, border-color .15s, box-shadow .15s;
  border: 1px solid transparent;
}
.room-item:hover { background: rgba(255, 255, 255, .9); }
.room-item.active {
  background: var(--surface);
  border-color: #e4e2fb;
  box-shadow: 0 8px 20px -16px rgba(19, 22, 32, .5);
}
.room-item.active::before {
  content: ''; position: absolute; left: -10px; top: 14px; bottom: 14px;
  width: 3px; border-radius: 0 3px 3px 0;
  background: linear-gradient(180deg, var(--accent-2), var(--accent));
}
.room-avatar {
  width: 38px; height: 38px; flex: none; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(140deg, #f1f2f8, #e7e9f5);
  color: #5c6273; font-weight: 600; font-size: 15px;
  transition: .16s;
}
.room-item.active .room-avatar {
  background: linear-gradient(140deg, var(--accent-2), var(--accent));
  color: #fff;
  box-shadow: 0 8px 18px -12px rgba(91, 78, 230, .9);
}
.room-meta { flex: 1; min-width: 0; }
.room-meta .top { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.room-name { font-weight: 550; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.room-time { font-size: 10.5px; color: var(--muted); flex: none; }
.room-preview { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 1px; }
.badge {
  flex: none; min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 9px; background: linear-gradient(135deg, var(--accent-2), var(--accent)); color: #fff;
  font-size: 11px; font-weight: 600;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 3px 8px -4px rgba(91, 78, 230, .9);
}
.room-empty { padding: 34px 18px; text-align: center; color: var(--muted); font-size: 12.5px; line-height: 1.9; }

/* 免费额度用量条（侧栏底部，点开看详情） */
.quota-bar {
  flex: none;
  display: flex; flex-direction: column; gap: 5px;
  margin: 0 12px 8px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, .7);
  text-align: left;
  transition: border-color .16s, background .16s;
}
.quota-bar:hover { background: #fff; border-color: #dcd8fb; }
.quota-top { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.quota-top > span { font-size: 11px; color: var(--muted); letter-spacing: .2px; }
.quota-top b { font-size: 11.5px; font-weight: 650; color: var(--text-2); font-variant-numeric: tabular-nums; }
.quota-track {
  display: block; height: 4px; border-radius: 999px;
  background: var(--surface-3); overflow: hidden;
}
.quota-track i {
  display: block; height: 100%; width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, #34d399, #10b981);
  transition: width .4s ease, background .3s;
}
.quota-bar.warn .quota-track i { background: linear-gradient(90deg, #fbbf24, #f59e0b); }
.quota-bar.warn .quota-top b { color: #b45309; }
.quota-bar.danger .quota-track i { background: linear-gradient(90deg, #f87171, #dc2626); }
.quota-bar.danger .quota-top b { color: var(--danger); }

.side-foot {
  border-top: 1px solid var(--line);
  padding: 10px 12px;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  background: rgba(255, 255, 255, .6);
}
.me { display: flex; align-items: center; gap: 9px; min-width: 0; }
.avatar {
  width: 32px; height: 32px; border-radius: 10px; flex: none;
  background: linear-gradient(140deg, #e9e8ff, #dcdcff);
  color: var(--accent-deep); font-weight: 600;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px;
}
.me-info { min-width: 0; display: flex; flex-direction: column; line-height: 1.32; }
.me-info strong { font-size: 13px; font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me-info span { font-size: 11px; color: var(--muted); }
.foot-actions { display: flex; gap: 2px; }

/* ---------- 主区域 ---------- */
.main { min-width: 0; min-height: 0; display: flex; flex-direction: column; background: var(--bg); }

.empty {
  margin: auto; text-align: center; padding: 32px 24px;
  max-width: 440px;
  animation: rise .3s ease both;
}
.empty-art { width: 168px; max-width: 62%; margin: 0 auto 18px; }
.empty-art svg { width: 100%; height: auto; display: block; }
.empty h2 { font-size: 18px; margin-bottom: 8px; letter-spacing: .2px; }
.empty p { color: var(--muted); font-size: 13px; line-height: 1.75; margin-bottom: 22px; }
.empty-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

.chat { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.chat-head {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 16px;
  background: rgba(255, 255, 255, .82);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--line);
  flex: none;
  z-index: 2;
}
.chat-title { flex: 1; min-width: 0; }
.chat-title h2 { font-size: 14.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-title p { font-size: 11.5px; color: var(--muted); margin-top: 1px; }
.chat-actions { display: flex; align-items: center; gap: 6px; }
.chat-head .back { display: none; }

.notice-bar {
  margin: 10px 16px 0;
  padding: 10px 13px;
  border-radius: 12px;
  background: #eff3ff; border: 1px solid #dfe6fb; color: #24386e;
  font-size: 12.5px; line-height: 1.6;
  display: flex; gap: 8px; align-items: flex-start;
  flex: none;
}
.notice-bar.warn { background: var(--warn-soft); border-color: #f5e0b5; color: #8a4b06; }
.notice-bar .ic { flex: none; }
.notice-bar .txt { flex: 1; }
.notice-bar time { display: block; font-size: 11px; opacity: .6; margin-top: 2px; }

.muted-bar {
  margin: 8px 16px 0; padding: 8px 12px; border-radius: 11px;
  background: #fff4f3; border: 1px solid #f7d4d0; color: #a02a2a;
  font-size: 12.5px; flex: none;
}

.messages {
  flex: 1; min-height: 0; overflow-y: auto;
  padding: 18px 16px 8px;
  display: flex; flex-direction: column; gap: 2px;
  overscroll-behavior-y: contain;
  background:
    radial-gradient(1100px 380px at 50% -8%, #f0f0ff 0%, transparent 62%),
    radial-gradient(700px 320px at 100% 108%, #eaf5ff 0%, transparent 60%),
    var(--bg);
}
.msg-wrap { max-width: 860px; width: 100%; margin: 0 auto; display: flex; flex-direction: column; }
.messages .msg-wrap:last-child { animation: msgIn .22s ease both; }
@keyframes msgIn { from { opacity: 0; transform: translateY(7px); } to { opacity: 1; transform: none; } }

.day-sep {
  align-self: center; margin: 16px 0 10px;
  font-size: 10.5px; color: var(--muted);
  background: rgba(19, 22, 32, .05);
  padding: 2px 11px; border-radius: 999px;
  backdrop-filter: blur(4px);
}
.sys-line {
  align-self: center; margin: 7px 0;
  font-size: 11.5px; color: var(--muted);
  background: rgba(19, 22, 32, .045);
  padding: 4px 13px; border-radius: 999px;
  max-width: 80%; text-align: center;
}
.row { display: flex; gap: 9px; margin: 3px 0; align-items: flex-end; }
.row.mine { flex-direction: row-reverse; }
.row .avatar { width: 28px; height: 28px; border-radius: 9px; font-size: 12px; margin-bottom: 16px; }
.bubble-col { display: flex; flex-direction: column; max-width: min(74%, 540px); min-width: 0; }
.row.mine .bubble-col { align-items: flex-end; }
.sender { font-size: 11px; color: var(--muted); margin: 0 4px 3px; }
.bubble {
  padding: 8px 13px; border-radius: 17px;
  background: var(--surface); border: 1px solid var(--line);
  white-space: pre-wrap; word-break: break-word;
  font-size: 13.5px; line-height: 1.62;
  box-shadow: 0 1px 2px rgba(19, 22, 32, .035);
}
.row.mine .bubble {
  background: linear-gradient(135deg, var(--accent-2), var(--accent));
  color: #fff; border-color: transparent;
  border-bottom-right-radius: 6px;
  box-shadow: 0 6px 18px -12px rgba(91, 78, 230, .95);
}
.row.mine .bubble .sender { color: rgba(255, 255, 255, .72); }
.row:not(.mine) .bubble { border-bottom-left-radius: 6px; }
.bubble.media { padding: 4px; background: var(--surface); overflow: hidden; position: relative; }
.row.mine .bubble.media { background: var(--surface); border-color: var(--line); }
.bubble.media img, .bubble.media video {
  display: block; max-width: 100%; max-height: 340px;
  border-radius: 13px; background: #000;
}
.bubble.media img { cursor: zoom-in; background: var(--surface-2); }
.bubble.media video { min-width: 220px; }
.ext-badge {
  position: absolute; right: 10px; bottom: 10px;
  font-size: 10px; line-height: 1; padding: 3px 7px; border-radius: 999px;
  background: rgba(19, 22, 32, .55); color: #fff; pointer-events: none;
  backdrop-filter: blur(3px);
}
/* 视频卡片右下角是文案，角标挪到右上角（播放后又会让位给放大按钮） */
.ext-badge.top { top: 10px; bottom: auto; }
.media-placeholder {
  display: flex; align-items: center; gap: 10px; text-align: left;
  border: 1px dashed var(--line-strong); background: var(--surface-2);
  color: var(--text-2); font: inherit; font-size: 12.5px;
  padding: 14px 16px; border-radius: 13px; cursor: pointer; min-width: 200px;
  transition: .16s;
}
.media-placeholder:hover { border-color: #c3c0f5; background: var(--accent-softer); }
.media-placeholder .ic { font-size: 19px; }
.media-placeholder em {
  display: block; font-style: normal; font-size: 10.5px; color: var(--muted); margin-top: 3px;
}
.bubble.media-broken, .row.mine .bubble.media-broken {
  background: var(--surface-2); padding: 10px 14px; color: var(--text-2);
  border-color: var(--line); box-shadow: none;
}
.bubble.media-broken a { font-size: 12.5px; color: var(--accent); text-decoration: none; }
.bubble.media-broken a:hover { text-decoration: underline; }
.msg-time { font-size: 10.5px; color: var(--muted); margin: 4px 5px 0; opacity: .85; }
.media-loading { padding: 26px 40px; text-align: center; color: var(--muted); font-size: 12.5px; }

.bubble-text a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
  word-break: break-all;
}
.row.mine .bubble-text a { color: #fff; text-decoration-color: rgba(255, 255, 255, .6); }

/* ---------- 视频卡片：点了才去取流，永不自动下载 ---------- */
.bubble.media.video-card { padding: 0; overflow: hidden; }
.video-ph {
  display: flex; align-items: center; gap: 11px;
  width: 100%; min-width: 208px; max-width: 330px;
  padding: 14px 16px; border: 0; background: transparent;
  text-align: left; color: var(--text); border-radius: 13px;
}
.video-ph:hover { background: var(--surface-2); }
.vp-play {
  flex: none; width: 40px; height: 40px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--accent-2), var(--accent));
  color: #fff;
  box-shadow: 0 8px 18px -12px rgba(91, 78, 230, .95);
}
.vp-play svg { width: 21px; height: 21px; margin-left: 1px; }
.vp-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.vp-text b { font-size: 13px; font-weight: 600; }
.vp-text em { font-style: normal; font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bubble.media.playing { padding: 4px; background: #000; }
.bubble.media.playing video { max-height: 360px; }
.pc-full {
  position: absolute; right: 9px; top: 9px; z-index: 2;
  width: 28px; height: 28px; border: 0; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(19, 22, 32, .55); color: #fff; cursor: pointer;
  backdrop-filter: blur(4px);
}
.pc-full svg { width: 15px; height: 15px; }
.pc-full:hover { background: rgba(19, 22, 32, .78); }

.row .avatar.av-click { cursor: pointer; }
.row .avatar.av-click:hover { box-shadow: 0 0 0 2px rgba(91, 78, 230, .35); }

/* ---------- 全屏查看（图片可双指/滚轮/双击放大，放大后可拖动） ---------- */
html.lb-open, html.lb-open body { overflow: hidden; }
.lightbox {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(9, 10, 16, .95);
  display: flex; align-items: center; justify-content: center;
  animation: fade .14s ease both;
}
.lb-tools { position: absolute; top: 14px; right: 14px; z-index: 3; display: flex; gap: 8px; }
.lb-btn {
  padding: 6px 13px; border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, .24);
  background: rgba(255, 255, 255, .1); color: #fff;
  font-size: 12.5px; line-height: 1.5; text-decoration: none; cursor: pointer;
  backdrop-filter: blur(6px);
}
.lb-btn:hover { background: rgba(255, 255, 255, .22); }
.lb-stage { display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; }
.lb-media {
  max-width: 100vw; max-height: 100vh;
  object-fit: contain; user-select: none;
  touch-action: none;
  transition: transform .13s ease-out;
  cursor: zoom-in;
}
.lb-media.grabbing { cursor: grabbing; transition: none; }
.lightbox video.lb-media { cursor: default; max-height: 92vh; max-width: 96vw; background: #000; }
.lightbox.zoomed .lb-media { cursor: grab; }

/* 引用回复：输入框上方的引用条 */
.reply-bar {
  display: flex; align-items: center; gap: 9px;
  max-width: 860px; width: calc(100% - 32px);
  margin: 8px auto 0;
  padding: 7px 8px 7px 11px;
  border-radius: 14px;
  background: var(--accent-softer);
  border: 1px solid #e2defb;
  flex: none;
  animation: rise .16s ease both;
}
.reply-ic { flex: none; color: var(--accent); display: flex; }
.reply-ic svg { width: 17px; height: 17px; }
.reply-body { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.35; }
.reply-body strong { font-size: 11.5px; color: var(--accent-deep); font-weight: 600; }
.reply-body span {
  font-size: 11.5px; color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.reply-bar .icon-btn { width: 26px; height: 26px; flex: none; }
.reply-bar .icon-btn svg { width: 14px; height: 14px; }

/* 气泡里的引用块 */
.quote {
  display: flex; flex-direction: column; gap: 1px;
  width: 100%; text-align: left;
  margin: 0 0 6px;
  padding: 5px 9px;
  border: 0; border-left: 3px solid rgba(91, 78, 230, .55);
  border-radius: 8px;
  background: rgba(91, 78, 230, .07);
  color: var(--text-2);
  font: inherit; font-size: 11.5px; line-height: 1.45;
  white-space: normal; cursor: pointer;
  transition: background .15s;
}
.quote:hover { background: rgba(91, 78, 230, .12); }
.quote b { font-size: 11px; color: var(--accent-deep); font-weight: 600; }
.quote span { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row.mine .quote {
  background: rgba(255, 255, 255, .18);
  border-left-color: rgba(255, 255, 255, .75);
}
.row.mine .quote b { color: #fff; }
.row.mine .quote span { color: rgba(255, 255, 255, .82); }
.bubble.media.has-quote { padding: 6px; }
.bubble.media.has-quote .quote { margin: 0 0 6px; }
.bubble-text { white-space: pre-wrap; word-break: break-word; }

/* 悬停才出现的「回复」按钮（触屏用长按，见 JS） */
.msg-act {
  flex: none; align-self: center;
  width: 26px; height: 26px; margin-bottom: 14px;
  display: flex; align-items: center; justify-content: center;
  border: 0; border-radius: 8px; background: transparent;
  color: var(--muted); opacity: 0;
  transition: opacity .15s, background .15s, color .15s;
}
.msg-act svg { width: 15px; height: 15px; }
.row:hover .msg-act, .msg-act:focus-visible { opacity: 1; }
.msg-act:hover { background: var(--surface-3); color: var(--accent); }
.msg-flash { animation: flash 1s ease; }
@keyframes flash {
  0%, 100% { background: transparent; }
  30% { background: rgba(91, 78, 230, .12); border-radius: 12px; }
}

.composer {
  margin: 10px auto 0;
  display: flex; align-items: flex-end; gap: 4px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 22px;
  padding: 6px;
  box-shadow: 0 8px 24px -18px rgba(19, 22, 32, .65);
  max-width: 860px; width: calc(100% - 32px);
  margin-left: auto; margin-right: auto;
  flex: none;
  transition: border-color .18s, box-shadow .18s;
}
.composer:focus-within {
  border-color: #c6c2f6;
  box-shadow: 0 0 0 4px rgba(91, 78, 230, .1), 0 10px 26px -18px rgba(91, 78, 230, .55);
}
.composer .icon-btn { width: 36px; height: 36px; border-radius: 50%; flex: none; }
.composer .icon-btn:hover { background: var(--accent-softer); color: var(--accent); }
.composer textarea {
  flex: 1; min-width: 0; border: 0; outline: none; resize: none;
  padding: 8px 4px; max-height: 140px; background: transparent;
  line-height: 1.5; font-size: 14px; color: var(--text);
}
.composer textarea::placeholder { color: #a9aebe; }
.composer .send { padding: 8px 15px; border-radius: 16px; flex: none; }
.composer .send svg { width: 16px; height: 16px; }
.composer-tip {
  text-align: center; font-size: 11px; color: var(--muted);
  padding: 7px 16px 10px; flex: none;
}

/* ---------- 拖拽投放层 ---------- */
.drop-mask {
  position: fixed; inset: 0; z-index: 70;
  display: flex; align-items: center; justify-content: center;
  background: rgba(240, 240, 255, .72);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  animation: fade .12s ease both;
  padding: 20px;
  pointer-events: none;
}
.drop-mask::before {
  content: ''; position: absolute; inset: 14px;
  border: 2px dashed rgba(91, 78, 230, .55);
  border-radius: 20px;
  pointer-events: none;
}
.drop-card {
  position: relative;
  text-align: center; padding: 28px 30px;
  background: rgba(255, 255, 255, .96);
  border-radius: 20px;
  box-shadow: var(--shadow-md);
  max-width: 380px;
  animation: pop .18s ease both;
}
.drop-ic {
  width: 52px; height: 52px; margin: 0 auto 12px;
  border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  background: linear-gradient(135deg, var(--accent-2), var(--accent));
  box-shadow: 0 12px 24px -14px rgba(91, 78, 230, .95);
}
.drop-ic svg { width: 24px; height: 24px; }
.drop-card strong { display: block; font-size: 15px; margin-bottom: 5px; }
.drop-card p { font-size: 12px; color: var(--muted); line-height: 1.6; }

/* ---------- 管理后台 ---------- */
.admin {
  position: fixed; inset: 0; z-index: 40;
  display: flex; flex-direction: column;
  background: var(--bg);
}
.admin-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 18px; background: var(--surface); border-bottom: 1px solid var(--line);
  flex: none;
}
.admin-title { display: flex; align-items: center; gap: 10px; }
.admin-title h1 { font-size: 16px; font-weight: 650; }
.admin-tabs {
  display: flex; gap: 4px; padding: 8px 16px 0;
  background: var(--surface); border-bottom: 1px solid var(--line);
  flex: none; overflow-x: auto;
}
.atab {
  border: 0; background: transparent; padding: 9px 14px;
  border-radius: 9px 9px 0 0; color: var(--muted); font-weight: 500;
  border-bottom: 2px solid transparent; white-space: nowrap;
  transition: .16s;
}
.atab:hover { color: var(--text-2); }
.atab.active { color: var(--accent); border-bottom-color: var(--accent); background: var(--accent-softer); }
.admin-body { flex: 1; overflow-y: auto; padding: 18px; }
.apanel { display: none; max-width: 1080px; margin: 0 auto; }
.apanel.active { display: block; animation: rise .2s ease both; }
.loading { color: var(--muted); text-align: center; padding: 40px; }

.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.stat {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 14px; padding: 14px 16px;
  box-shadow: var(--shadow-sm);
  transition: .16s;
}
.stat:hover { border-color: #e0defa; box-shadow: var(--shadow-md); }
.stat b { display: block; font-size: 22px; font-weight: 650; letter-spacing: -.5px; }
.stat span { font-size: 12px; color: var(--muted); }
.stat.accent b { color: var(--accent); }

.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 16px; padding: 16px; margin-top: 14px;
  box-shadow: var(--shadow-sm);
}
.card h3 { font-size: 13.5px; font-weight: 600; margin-bottom: 4px; }
.card .desc { font-size: 12px; color: var(--muted); margin-bottom: 14px; line-height: 1.6; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.head-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.warn-box {
  font-size: 12.5px; line-height: 1.6; color: #8a5b00;
  background: var(--warn-soft); border: 1px solid #f7e3b5; border-radius: 11px;
  padding: 9px 11px; margin-bottom: 12px;
}
.warn-box code { background: #f6ecd4; padding: 0 4px; border-radius: 4px; font-size: 11.5px; }
.switch-row.is-off { opacity: .55; }
.switch-row.is-off .switch input { cursor: not-allowed; }

.menu-note { font-size: 12px; line-height: 1.5; color: var(--muted); background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; }
.muted { color: var(--muted); }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.field > label { font-size: 12.5px; font-weight: 500; color: var(--text-2); }
.field input[type="text"], .field input[type="number"], .field input[type="password"], .field input[type="url"], .field textarea, .field select, .search {
  border: 1px solid var(--line-strong); border-radius: 10px;
  padding: 9px 11px; outline: none; background: #fff; transition: .16s;
  color: var(--text);
}
.field input:focus, .field textarea:focus, .search:focus { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(91, 78, 230, .1); }
.field textarea { resize: vertical; min-height: 68px; line-height: 1.6; }
.row-inline { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.row-inline .field { flex: 1; min-width: 140px; margin-bottom: 0; }
select.mini { padding: 4px 6px; font-size: 12px; min-width: 90px; border-radius: 7px; }

.switch-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 11px 0; border-bottom: 1px solid var(--line); gap: 16px;
}
.switch-row:last-child { border-bottom: 0; }
.switch-row .label strong { font-size: 13px; font-weight: 550; display: block; }
.switch-row .label span { font-size: 11.5px; color: var(--muted); }
.switch { position: relative; width: 42px; height: 24px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch i {
  position: absolute; inset: 0; background: #d8dbe7; border-radius: 999px;
  transition: .2s; cursor: pointer;
}
.switch i::after {
  content: ''; position: absolute; top: 3px; left: 3px;
  width: 18px; height: 18px; border-radius: 50%; background: #fff;
  transition: .2s; box-shadow: 0 1px 2px rgba(0, 0, 0, .2);
}
.switch input:checked + i { background: var(--accent); }
.switch input:checked + i::after { transform: translateX(18px); }

.table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.table th {
  text-align: left; font-weight: 500; color: var(--muted);
  padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap;
  font-size: 11.5px; letter-spacing: .3px;
}
.table td { padding: 9px 10px; border-bottom: 1px solid #f3f4f8; vertical-align: middle; }
.table tbody tr:hover { background: var(--surface-2); }
.table tr:last-child td { border-bottom: 0; }
.table .acts { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.tbl-wrap { overflow-x: auto; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11.5px; color: var(--muted); }

/* ---------- 弹窗 / Toast ---------- */
.modal-mask {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(19, 22, 32, .42);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  animation: fade .16s ease;
}
@keyframes fade { from { opacity: 0 } to { opacity: 1 } }
.modal {
  width: 100%; max-width: 440px;
  max-height: calc(100vh - 40px); overflow-y: auto;
  background: var(--surface); border-radius: 20px;
  padding: 22px; box-shadow: var(--shadow-lg);
  animation: pop .18s ease;
}
@keyframes pop { from { transform: scale(.96); opacity: 0 } to { transform: scale(1); opacity: 1 } }
.modal h3 { font-size: 15.5px; margin-bottom: 6px; }
.modal p { font-size: 12.5px; color: var(--muted); line-height: 1.65; margin-bottom: 14px; }
.modal .modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; }
.link-box { display: flex; gap: 8px; margin: 10px 0; }
.link-box input {
  flex: 1; border: 1px solid var(--line-strong); border-radius: 10px;
  padding: 8px 10px; font-size: 12px; color: var(--text-2); background: var(--surface-2);
}

/* 外链预览 */
.link-preview {
  margin: 10px 0 4px; border-radius: 12px; overflow: hidden;
  background: var(--surface-2); border: 1px solid var(--line);
  max-height: 220px; display: flex; justify-content: center; align-items: center;
}
.link-preview img, .link-preview video { display: block; max-width: 100%; max-height: 218px; }
.link-preview img { background: var(--surface-2); }
.link-preview video { background: #000; }
.link-preview.err {
  padding: 10px 12px; font-size: 12px; color: var(--danger); background: var(--danger-soft);
  border-color: #f5cdc8; justify-content: flex-start;
}
.mini-note { font-size: 11px !important; color: var(--muted); line-height: 1.6; margin: 6px 0 0 !important; }

.menu-list { display: flex; flex-direction: column; gap: 8px; margin: 12px 0 4px; }
.menu-list .btn { justify-content: flex-start; text-align: left; padding: 11px 14px; }

/* 额度详情 */
.quota-grid { display: flex; flex-direction: column; gap: 8px; margin: 6px 0 4px; }
.quota-row {
  display: flex; align-items: baseline; justify-content: space-between; gap: 10px;
  font-size: 12.5px; padding-bottom: 7px; border-bottom: 1px dashed var(--line);
}
.quota-row:last-child { border-bottom: 0; }
.quota-row .k { color: var(--muted); }
.quota-row .v { font-weight: 600; font-variant-numeric: tabular-nums; text-align: right; }
.quota-meter { height: 6px; border-radius: 999px; background: var(--surface-3); overflow: hidden; margin: 8px 0 2px; }
.quota-meter i { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, #34d399, #10b981); }
.quota-meter.warn i { background: linear-gradient(90deg, #fbbf24, #f59e0b); }
.quota-meter.danger i { background: linear-gradient(90deg, #f87171, #dc2626); }

/* 选项按钮（一对一房间的销毁时长） */
.menu-list .opt-btn {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  border-color: var(--line); background: var(--surface); padding: 10px 14px;
}
.menu-list .opt-btn:hover { border-color: #d5cffb; background: var(--accent-softer); }
.opt-btn .opt-check { font-size: 13px; color: var(--accent); opacity: 0; flex: none; }
.menu-list .opt-btn.sel {
  border-color: #c9c4f8; background: var(--accent-softer); color: var(--accent-deep);
  font-weight: 550; box-shadow: inset 0 0 0 1px #ded9fc;
}
.opt-btn.sel .opt-check { opacity: 1; }

.avatar.sm { width: 26px; height: 26px; border-radius: 8px; font-size: 12px; }
.avatar.lg { width: 46px; height: 46px; border-radius: 14px; font-size: 18px; }
.member-list { display: flex; flex-direction: column; gap: 6px; margin: 12px 0 4px; max-height: 320px; overflow: auto; }
.member-row {
  display: flex; align-items: center; gap: 9px;
  width: 100%; text-align: left; font: inherit; color: var(--text); cursor: pointer;
  padding: 7px 9px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface-2);
  transition: border-color .15s, background .15s;
}
.member-row:hover { border-color: #d5cffb; background: var(--accent-softer); }
.member-row .member-name {
  flex: 1; min-width: 0; font-size: 13px;
  display: flex; align-items: center; gap: 6px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.member-more { flex: none; color: var(--muted); font-size: 15px; padding-right: 2px; }

.member-card {
  display: flex; gap: 12px; align-items: center;
  padding: 12px; margin: 10px 0 4px;
  border: 1px solid var(--line); border-radius: 14px; background: var(--surface-2);
}
.member-card-main { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.member-card-main strong { font-size: 14px; font-weight: 600; }
.member-card-main > span { font-size: 11.5px; color: var(--muted); }
.member-card-tags { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 4px; }

/* 成员操作按钮列表 */
.act-list { display: flex; flex-direction: column; gap: 6px; margin: 12px 0 4px; }
.act-btn {
  display: flex; align-items: center; gap: 6px;
  width: 100%; text-align: left;
  padding: 10px 12px; border-radius: 11px;
  border: 1px solid var(--line); background: var(--surface);
  color: var(--text-2); font: inherit; font-size: 13px; cursor: pointer;
  transition: border-color .15s, background .15s, color .15s;
}
.act-btn:hover { border-color: #d5cffb; background: var(--accent-softer); color: var(--text); }
.act-btn.warn { color: var(--warn); }
.act-btn.warn:hover { background: var(--warn-soft); border-color: #f7e3b5; }
.act-btn.danger { color: var(--danger); }
.act-btn.danger:hover { background: var(--danger-soft); border-color: #f5cdc8; }

/* 视频发送引导 */
.modal .guide-box {
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: 12px; padding: 11px 13px; margin: 8px 0 14px;
}
.modal .guide-box p { margin: 0 0 7px; font-size: 12.5px; color: var(--text-2); line-height: 1.65; }
.modal .guide-box p:last-child { margin-bottom: 0; }
.modal .guide-box .guide-t { font-weight: 600; color: var(--text); font-size: 13px; }
.modal .guide-box .guide-sub { color: var(--muted); }
.guide-ol { margin: 0 0 8px; padding-left: 18px; font-size: 12.5px; color: var(--text-2); line-height: 1.7; }
.guide-ol li { margin-bottom: 6px; }
.guide-box a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }

.toast {
  position: fixed; left: 50%; bottom: 96px; transform: translate(-50%, 16px);
  background: rgba(23, 26, 38, .94); color: #fff;
  padding: 10px 17px; border-radius: 12px; font-size: 12.5px;
  opacity: 0; pointer-events: none; transition: .22s;
  z-index: 90; max-width: 84vw; text-align: center;
  box-shadow: 0 12px 32px -12px rgba(0, 0, 0, .5);
  backdrop-filter: blur(8px);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.err { background: rgba(180, 35, 24, .96); }

/* ---------- 移动端 ---------- */
@media (max-width: 780px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { border-right: 0; }
  .app.has-room .sidebar { display: none; }
  .chat-head { padding: 8px 10px; }
  .chat-head .back { display: inline-flex; }
  .chat-title h2 { font-size: 14px; }
  .bubble-col { max-width: 84%; }
  .bubble { border-radius: 16px; }
  .notice-bar, .muted-bar { margin-left: 10px; margin-right: 10px; }
  .messages { padding: 12px 10px 2px; }
  .reply-bar { width: calc(100% - 16px); }
  .msg-act { display: none; }   /* 触屏没有 hover，改用长按引用 */
  .composer { width: calc(100% - 16px); margin-top: 8px; border-radius: 21px; }
  .composer textarea { font-size: 16px; }  /* 防止 iOS 聚焦时整页放大 */
  .composer-tip { padding: 5px 12px calc(7px + env(safe-area-inset-bottom)); font-size: 10.5px; }
  .toast { bottom: calc(104px + env(safe-area-inset-bottom)); }
  .composer .send { padding: 8px 13px; }
  .admin-body { padding: 12px; }
  .side-foot { padding-bottom: calc(10px + env(safe-area-inset-bottom)); }
  .auth-form input { font-size: 16px; }
  .field input, .field textarea, .field select, .search { font-size: 16px; }
  .modal { border-radius: 18px; padding: 20px 18px; }
  .drop-card { padding: 26px 24px; }
}

@media (max-width: 430px) {
  .composer .send span { display: none; }
  .composer .send { padding: 9px; border-radius: 14px; width: 38px; height: 38px; }
  .composer .icon-btn { width: 34px; height: 34px; }
  .empty-actions .btn { flex: 1 1 100%; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

/* ================= 日夜主题 ================= */
/* 深色不是把浅色反相：底色压低、图标/文字提亮，紫靛主色稍微提亮保证对比度 */
[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b0d13;
  --surface: #14161f;
  --surface-2: #1a1d27;
  --surface-3: #222633;
  --line: #262b38;
  --line-strong: #343b4c;
  --text: #e9ebf3;
  --text-2: #b9bfd0;
  --muted: #8b93a7;
  --accent: #7c6cf7;
  --accent-2: #8f81ff;
  --accent-deep: #b3a8ff;
  --accent-soft: #232045;
  --accent-softer: #1b1934;
  --danger: #ff7b6d;
  --danger-soft: #2b1715;
  --warn: #f2b544;
  --warn-soft: #2b2312;
  --ok: #4ade80;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .45);
  --shadow-md: 0 12px 32px -14px rgba(0, 0, 0, .75), 0 2px 6px rgba(0, 0, 0, .35);
  --shadow-lg: 0 26px 64px -22px rgba(0, 0, 0, .85);
}

[data-theme="dark"] .boot {
  background: radial-gradient(800px 400px at 50% -10%, #1b1a3a 0%, transparent 65%), var(--bg);
}
[data-theme="dark"] .auth {
  background:
    radial-gradient(760px 420px at 12% -8%, #1c1a3c 0%, transparent 62%),
    radial-gradient(680px 380px at 100% 4%, #10222e 0%, transparent 58%),
    var(--bg);
}
[data-theme="dark"] .auth-card { border-color: rgba(255, 255, 255, .06); }
[data-theme="dark"] .auth-form input { background: var(--surface-2); }
[data-theme="dark"] .auth-form input::placeholder,
[data-theme="dark"] .composer textarea::placeholder { color: #6f7789; }
[data-theme="dark"] .notice { border-color: rgba(242, 181, 68, .26); }
[data-theme="dark"] .sidebar { background: linear-gradient(180deg, #10121a 0%, #0b0d13 100%); }
[data-theme="dark"] .side-notice,
[data-theme="dark"] .notice-bar { background: #16203a; border-color: #22304f; color: #bbcbf5; }
[data-theme="dark"] .side-notice.warn,
[data-theme="dark"] .notice-bar.warn { background: var(--warn-soft); border-color: rgba(242, 181, 68, .24); color: var(--warn); }
[data-theme="dark"] .room-item:hover { background: rgba(255, 255, 255, .04); }
[data-theme="dark"] .room-item.active { border-color: #302b58; box-shadow: none; }
[data-theme="dark"] .room-avatar { background: linear-gradient(140deg, #232838, #1a1e2b); color: #aeb6c9; }
[data-theme="dark"] .quota-bar { background: rgba(255, 255, 255, .03); }
[data-theme="dark"] .quota-bar:hover { background: rgba(255, 255, 255, .06); border-color: #3d356f; }
[data-theme="dark"] .quota-bar.warn .quota-top b { color: var(--warn); }
[data-theme="dark"] .side-foot { background: rgba(255, 255, 255, .02); }
[data-theme="dark"] .avatar { background: linear-gradient(140deg, #2a2650, #221f42); color: var(--accent-deep); }
[data-theme="dark"] .chat-head { background: rgba(15, 17, 24, .84); }
[data-theme="dark"] .muted-bar { background: #2b1715; border-color: #4a2521; color: #ffb3a9; }
[data-theme="dark"] .messages {
  background:
    radial-gradient(1100px 380px at 50% -8%, #191735 0%, transparent 62%),
    radial-gradient(700px 320px at 100% 108%, #10222e 0%, transparent 60%),
    var(--bg);
}
[data-theme="dark"] .day-sep,
[data-theme="dark"] .sys-line { background: rgba(255, 255, 255, .06); }
[data-theme="dark"] .bubble,
[data-theme="dark"] .composer { box-shadow: none; }
[data-theme="dark"] .media-placeholder:hover { border-color: #4a4285; }
[data-theme="dark"] .reply-bar { border-color: #2f2b56; }
[data-theme="dark"] .composer:focus-within { border-color: #554aa8; }
[data-theme="dark"] .drop-mask { background: rgba(9, 10, 16, .74); }
[data-theme="dark"] .drop-card { background: rgba(22, 24, 33, .97); }
[data-theme="dark"] .stat:hover { border-color: #302b58; }
[data-theme="dark"] .warn-box { border-color: rgba(242, 181, 68, .24); color: #e8bb63; }
[data-theme="dark"] .warn-box code { background: #3a2f16; }
[data-theme="dark"] .field input[type="text"],
[data-theme="dark"] .field input[type="number"],
[data-theme="dark"] .field input[type="password"],
[data-theme="dark"] .field input[type="url"],
[data-theme="dark"] .field textarea,
[data-theme="dark"] .field select,
[data-theme="dark"] .search,
[data-theme="dark"] .link-box input,
[data-theme="dark"] .auth-form input { background: var(--surface-2); }
[data-theme="dark"] .switch i { background: #39404f; }
[data-theme="dark"] .switch i::after { background: #e6e9f2; }
[data-theme="dark"] .table td { border-bottom-color: var(--line); }
[data-theme="dark"] .modal-mask { background: rgba(0, 0, 0, .64); }
[data-theme="dark"] .link-preview.err { border-color: #4a2521; }
[data-theme="dark"] .menu-list .opt-btn.sel { border-color: #4a4285; box-shadow: inset 0 0 0 1px #38306a; }
[data-theme="dark"] .member-row:hover,
[data-theme="dark"] .act-btn:hover,
[data-theme="dark"] .menu-list .opt-btn:hover { border-color: #4a4285; }
[data-theme="dark"] .act-btn.warn:hover { border-color: rgba(242, 181, 68, .3); }
[data-theme="dark"] .act-btn.danger:hover { border-color: rgba(255, 123, 109, .32); }
[data-theme="dark"] .btn.danger { border-color: rgba(255, 123, 109, .32); background: var(--surface); }
[data-theme="dark"] .tag.green { background: rgba(74, 222, 128, .12); }
[data-theme="dark"] .btn:hover { border-color: #3d4557; }
[data-theme="dark"] * { scrollbar-color: #39404f transparent; }
[data-theme="dark"] ::-webkit-scrollbar-thumb { background: #39404f; background-clip: content-box; }
[data-theme="dark"] ::-webkit-scrollbar-thumb:hover { background: #4b5468; background-clip: content-box; }

/* ---------- 主题切换按钮 ---------- */
.theme-fab {
  position: fixed; top: 18px; right: 18px; z-index: 5;
  width: 40px; height: 40px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--surface);
  color: var(--text-2);
  display: inline-flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow-sm);
  transition: color .16s, border-color .16s, transform .12s;
}
.theme-fab:hover { color: var(--accent); border-color: var(--line-strong); }
.theme-fab:active { transform: scale(.95); }
.theme-fab svg { width: 19px; height: 19px; }

/* ---------- 分段选择（主题三档） ---------- */
.seg { display: flex; gap: 4px; padding: 4px; background: var(--surface-3); border-radius: 11px; }
.seg button {
  flex: 1; border: 0; background: transparent; color: var(--muted);
  padding: 7px 6px; border-radius: 8px; font-size: 12.5px; font-weight: 500;
  transition: background .15s, color .15s;
}
.seg button:hover { color: var(--text-2); }
.seg button.sel { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }

/* ---------- 我的账号 ---------- */
.acct {
  display: flex; gap: 12px; align-items: center;
  padding: 12px; margin: 10px 0 14px;
  border: 1px solid var(--line); border-radius: 14px; background: var(--surface-2);
}
.acct-main { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.acct-main strong { font-size: 14.5px; font-weight: 600; }
.acct-main span { font-size: 11.5px; color: var(--muted); }
.del-list { margin: 0 0 14px; padding-left: 18px; font-size: 12.5px; color: var(--text-2); line-height: 1.75; }
.del-list li { margin-bottom: 4px; }
.check {
  display: flex; align-items: flex-start; gap: 8px;
  font-size: 12.5px; color: var(--text-2); line-height: 1.5;
  margin: 2px 0 4px; cursor: pointer;
}
.check input { margin: 2px 0 0; flex: none; }

/* 侧栏账号块可点（进「我的账号」） */
.me { border-radius: 12px; padding: 4px 6px; margin: -4px -6px; transition: background .15s; }
.me:hover { background: var(--accent-softer); }
.me:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

/* 卡片底部按钮组 */
.card-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
