/* ============================================================
 * SC2clud 首屏样式
 * 美术风格对齐既有启动器（弥音）：蓝白配色、圆角卡片、柔和投影；
 * 布局按「社区站 + 网盘」重新组织，不照搬启动器界面。
 * 预算：brotli 后 ≤ 20 KB（见 docs/BUDGETS.md）。
 * 只用系统字体栈：1.25 MB/s 的链路上，字体文件是纯负担。
 *
 * 注意：这里**只能**用 CSS 注释。曾用 # 开头写注释，导致紧随其后的
 *       :root 变量块被当成无效声明吞掉，全站 var() 失效（按钮全白、
 *       active 导航白底白字）。改注释语法时务必确认变量仍生效。
 * ============================================================ */

:root {
  --blue: #2f6fe4;
  --blue-deep: #1f57bd;
  --blue-soft: #eaf1fd;
  --ink: #1b2430;
  --muted: #7b8798;
  --line: #e6ebf2;
  --bg: #f4f7fb;
  --card: #fff;
  /* 输入控件底色：深色主题里由下面覆盖，避免夜间出现白框 */
  --field-bg: #fbfcfe;
  --ok: #2f9e6f;
  --warn: #d96a2b;
  --radius: 16px;
  --shadow: 0 8px 24px rgba(29, 60, 116, .08);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.65 system-ui, -apple-system, 'Segoe UI', 'Noto Sans SC', 'Microsoft YaHei', sans-serif;
}

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- 顶栏：与启动器同色系的蓝色渐变 ---------- */
.topbar {
  background: linear-gradient(180deg, #3f7ff0, #2a63d6);
  color: #fff;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: 0 2px 10px rgba(31, 87, 189, .25);
}
.topbar .mascot { width: 40px; height: 40px; border-radius: 50%; background: rgba(255,255,255,.9); }
.topbar .brand { font-size: 17px; font-weight: 700; color: #fff; letter-spacing: .5px; }
.topbar .brand small { display: block; font-size: 11px; font-weight: 400; opacity: .8; letter-spacing: 1px; }
.topbar nav { margin-left: auto; display: flex; gap: 8px; }
.topbar nav a {
  color: #eaf1fd; padding: 7px 16px; border-radius: 999px; font-size: 14px; font-weight: 600;
  transition: background .15s ease;
}
.topbar nav a:hover { background: rgba(255,255,255,.16); text-decoration: none; }
.topbar nav a.active { background: #fff; color: var(--blue-deep); }

/* 大屏利用率：跟随视口放宽到 1720px，窄屏仍是原来的居中单列。 */
main { max-width: min(1720px, 94vw); margin: 0 auto; padding: 22px 20px 8px; }

/* ---------- 卡片 ---------- */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px 24px;
  margin-bottom: 18px;
}
.card > h2 { font-size: 17px; margin: 0 0 14px; display: flex; align-items: center; gap: 8px; }
.card > h2 .count {
  background: var(--blue-soft); color: var(--blue-deep); border-radius: 999px;
  font-size: 12px; font-weight: 600; padding: 2px 10px;
}
.card > h2 .spacer { margin-left: auto; font-size: 12px; color: var(--muted); font-weight: 400; }

/* ---------- 首屏 hero ---------- */
.hero { display: flex; gap: 18px; align-items: center; padding: 2px 0 4px; }
.hero .copy { flex: 1 1 auto; min-width: 0; max-width: 760px; }
.hero .eyebrow { color: var(--blue); font-size: 13px; font-weight: 700; letter-spacing: .5px; }
.hero h1 { font-size: 27px; margin: 4px 0 6px; letter-spacing: -.4px; }
.hero p { color: var(--muted); margin: 0 0 16px; }
/* 大屏上把配图推到右侧：文案靠左、图靠右，中间不留一块空 */
.hero .art { flex: 0 0 auto; width: 200px; max-width: 32%; margin-left: auto; }
@media (min-width: 1400px) {
  .hero .art { width: 240px; }
  .hero h1 { font-size: 32px; }
}
.hero .art img { width: 100%; height: auto; display: block; filter: drop-shadow(0 10px 20px rgba(47,111,228,.18)); }

.actions { display: flex; flex-wrap: wrap; gap: 10px; }
/* 全站统一按钮：8px 圆角 + 固定高度，与用户管理页行内控件同一套观感 */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 36px; padding: 0 18px;
  border: 0; border-radius: 8px; box-sizing: border-box;
  font: inherit; font-size: 14px; font-weight: 600; line-height: 1;
  cursor: pointer; text-decoration: none;
  background: var(--blue); color: #fff; box-shadow: 0 3px 10px rgba(47,111,228,.22);
  transition: background .15s ease, transform .15s ease, box-shadow .15s ease;
}
.btn:hover { background: var(--blue-deep); text-decoration: none; transform: translateY(-1px); }
.btn.ghost { background: var(--card); color: var(--ink); border: 1px solid var(--line); box-shadow: none; }
.btn.ghost:hover { background: #f7f9fd; }
.btn:disabled { opacity: .55; cursor: progress; }

/* ---------- 统计条（对齐启动器的「官方战役/已导入/已切换」那排数字）---------- */
.stats { display: flex; flex-wrap: wrap; gap: 34px; border-top: 1px solid var(--line); margin-top: 12px; padding-top: 12px; }
.stats div { min-width: 84px; }
.stats .label { color: var(--muted); font-size: 13px; }
.stats .value { color: var(--blue); font-size: 24px; font-weight: 700; line-height: 1.2; }

/* ---------- 列表 ---------- */
ul.list { list-style: none; margin: 0; padding: 0; }
ul.list > li { padding: 12px 0; border-top: 1px solid var(--line); }
ul.list > li:first-child { border-top: 0; }
ul.list .title { font-weight: 600; font-size: 15px; }
ul.list .row { display: flex; align-items: center; gap: 12px; }
ul.list .row .grow { flex: 1 1 auto; min-width: 0; }
ul.list .row .name { font-weight: 600; word-break: break-all; }
.meta { color: var(--muted); font-size: 13px; }
.empty, .hint { color: var(--muted); font-size: 13px; }
.empty { padding: 6px 0; }

.tag { display: inline-block; border-radius: 999px; padding: 2px 10px; font-size: 12px; background: var(--blue-soft); color: var(--blue-deep); }
.tag.gray { background: #f1f4f9; color: var(--muted); }
.size-pill { color: var(--muted); font-size: 13px; white-space: nowrap; }

/* ---------- 上传岛 ---------- */
.uploader { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.uploader input[type='file'] {
  flex: 1 1 260px; padding: 10px 12px; background: #f7f9fd;
  border: 1px dashed #c8d6ec; border-radius: 12px; color: var(--muted); font: inherit; max-width: 100%;
}
.uploader progress { flex: 1 1 100%; height: 8px; border: 0; border-radius: 999px; overflow: hidden; }
.uploader progress::-webkit-progress-bar { background: var(--blue-soft); }
.uploader progress::-webkit-progress-value { background: var(--blue); }

/* ---------- 文件详情 ---------- */
.detail { display: flex; gap: 24px; align-items: flex-start; }
.detail .art { flex: 0 0 auto; width: 160px; max-width: 32%; }
.detail .art img { width: 100%; height: auto; display: block; }
.detail h1 { font-size: 22px; margin: 0 0 10px; word-break: break-all; }
.detail dl { display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px; margin: 0 0 18px; }
.detail dt { color: var(--muted); }
.detail dd { margin: 0; }

/* ---------- 错误页 ---------- */
.oops { max-width: 560px; margin: 8vh auto 0; text-align: center; }
.oops img { width: 120px; height: auto; margin-bottom: 6px; }
.oops h1 { font-size: 40px; margin: 0; color: var(--blue); }
code { background: #f1f4f9; padding: 1px 6px; border-radius: 6px; font-size: 13px; }

footer { color: var(--muted); font-size: 12px; text-align: center; padding: 14px 20px 22px; }

@media (max-width: 640px) {
  .hero { flex-direction: column-reverse; text-align: left; }
  .hero .art { width: 140px; max-width: 55%; align-self: flex-end; }
  .hero h1 { font-size: 24px; }
  .detail { flex-direction: column; }
  .detail .art { width: 110px; }
  .stats { gap: 20px; }
  .post-grid { grid-template-columns: 1fr; }
}

/* ============================================================
 * 社区部分：卡片式帖子、表单、提示
 * 蓝白体系延续顶栏（与启动器一致），版式按社区站重排。
 * ============================================================ */

.post-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  /* 统一尺寸：同一行卡片等高（封面高度固定，留白由摘要区吸收） */
  align-items: stretch;
  gap: 14px;
}

.post-card {
  display: flex;
  flex-direction: column;
  height: 100%;
  gap: 8px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px 16px 14px;
  box-shadow: 0 4px 14px rgba(29, 60, 116, .06);
  transition: transform .12s ease, box-shadow .12s ease;
}
.post-card:hover { transform: translateY(-2px); box-shadow: 0 10px 22px rgba(29, 60, 116, .12); }
/* 封面：贴住卡片顶部两角；内容寻址的图片可长缓存。 */
.post-cover {
  height: 132px;
  margin: -16px -16px 10px;
  border-radius: 14px 14px 0 0;
  background-color: var(--blue-soft);
  background-size: cover;
  background-position: center;
}

/* 没有配图的帖子：同高的淡色封面 + 弥音水印，保证整行卡片尺寸一致 */
.post-cover-empty {
  position: relative;
  background: linear-gradient(135deg, #eef4ff, #dce8fb);
}
.post-cover-empty::after {
  content: "";
  position: absolute;
  inset: 0;
  background: url('/static/art/miyin-chibi-80.webp') center / 56px no-repeat;
  opacity: .38;
}

.post-card .head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.post-card h3 {
  margin: 0; font-size: 15px; line-height: 1.45;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.post-card h3 a { color: var(--ink); }
.post-card h3 a:hover { color: var(--blue); text-decoration: none; }
.post-card .preview {
  margin: 0; color: var(--muted); font-size: 13px;
  /* 摘要吸收剩余高度：卡片等高时不会在底部留出一条空白 */
  flex: 1 1 auto;
  display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden;
}
.post-card .foot {
  margin-top: 4px; padding-top: 8px; border-top: 1px solid var(--line);
  display: flex; align-items: center; gap: 8px; justify-content: space-between;
  color: var(--muted); font-size: 12px;
}

.kind { border-radius: 999px; padding: 2px 10px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.kind-discussion { background: #eaf1fd; color: #1f57bd; }
.kind-resource { background: #e8f7ef; color: #1c7a52; }
.kind-repost { background: #fdf1e6; color: #a35a17; }
.state-pending { background: #fff4e5; color: #a35a17; }
.state-rejected { background: #fdeceb; color: #b3261e; }

.section-nav { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 14px; }
.section-nav a {
  padding: 6px 14px; border: 1px solid var(--line); border-radius: 999px;
  font-size: 13px; color: var(--ink); background: var(--field-bg);
}
.section-nav a:hover { border-color: var(--blue); text-decoration: none; }
.section-nav a.active { background: var(--blue); border-color: var(--blue); color: #fff; }

.sources { margin-top: 18px; border-top: 1px solid var(--line); padding-top: 14px; }
.sources h3 { margin: 0 0 10px; font-size: 15px; }
.source-item { padding: 12px 0; border-top: 1px dashed var(--line); }
.source-item:first-of-type { border-top: 0; }
.source-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.provider {
  border-radius: 8px; padding: 3px 10px; font-size: 13px; font-weight: 600;
  background: #eef2f8; color: #33415c;
}
.provider-github { background: #eef0f3; color: #24292f; }
.provider-baidu { background: #eaf1ff; color: #2b5bd7; }
.provider-quark { background: #eef7ff; color: #1a7fd4; }
.provider-aliyun { background: #fff2ec; color: #c2410c; }
.provider-lanzou { background: #eaf7ef; color: #1c7a52; }
.provider-123pan { background: #f2f0ff; color: #5b46c9; }
.provider-weiyun { background: #e9f7fb; color: #0e7490; }
.mirrors { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.mirrors .hint { flex: 1 1 100%; margin: 0; }
.mirror {
  padding: 5px 12px; border: 1px solid var(--line); border-radius: 999px;
  font-size: 13px; background: var(--field-bg); color: var(--ink);
}
.mirror:hover { border-color: var(--blue); text-decoration: none; }
.mirror-fastest { border-color: var(--blue); background: var(--blue-soft); color: var(--blue-deep); font-weight: 600; }
.source-row { display: grid; grid-template-columns: 150px 1fr 130px; gap: 8px; margin-bottom: 8px; }
.source-row select, .source-row input {
  font: inherit; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fbfcfe;
}
@media (max-width: 640px) { .source-row { grid-template-columns: 1fr; } }

.post-body { white-space: pre-wrap; line-height: 1.75; margin: 12px 0 0; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-top: 14px; }
.gallery img { display: block; width: 100%; height: 120px; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); }
.comments { margin-top: 8px; }
.comment { padding: 12px 0; border-top: 1px solid var(--line); }
.comment .who { font-weight: 600; font-size: 13px; }
.comment p { margin: 4px 0 0; }

/* 表单（登录 / 注册 / 发帖 / 回复） */
.auth-card { max-width: 460px; margin: 4vh auto 0; }
.stack { display: grid; gap: 14px; margin: 12px 0 4px; }
.stack label { display: grid; gap: 6px; font-size: 14px; font-weight: 600; }
.stack input[type='text'],
.stack input[type='email'],
.stack input[type='password'],
.stack textarea,
.stack select {
  font: inherit; font-weight: 400; padding: 10px 12px; border: 1px solid var(--line);
  border-radius: 10px; background: var(--field-bg); color: var(--ink); width: 100%;
}
.stack input:focus, .stack textarea:focus, .stack select:focus {
  outline: 2px solid var(--blue-soft); border-color: var(--blue);
}
.stack textarea { min-height: 160px; resize: vertical; }
.kind-picker { display: flex; flex-wrap: wrap; gap: 8px; }
.kind-picker label {
  display: flex; align-items: center; gap: 6px; font-weight: 400; font-size: 14px;
  border: 1px solid var(--line); border-radius: 999px; padding: 6px 14px; cursor: pointer;
}
.kind-picker input { margin: 0; }
.alert { background: #fdeceb; color: #b3261e; border-radius: 10px; padding: 10px 12px; font-size: 13px; }
.actions-inline { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.title-line { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-weight: 600; }

/* 危险 / 正向图标按钮：停用账号是红色，激活是绿色——一眼能分清账号状态 */
/* ============================================================
 * 两态按钮统一约定：**授予 / 恢复 / 通过 = 绿，撤销 / 停用 / 拒绝 / 拉黑 = 红**
 * （凡是能在两种状态间来回切的按钮，颜色必须能区分当前是哪一态）
 * ============================================================ */
.btn.ok { background: #1c7a52; color: #fff; box-shadow: 0 3px 10px rgba(28,122,82,.22); }
.btn.ok:hover { background: #14603f; }
.btn.ghost.ok { color: #1c7a52; border-color: rgba(28,122,82,.45); }
.btn.ghost.ok:hover { background: #e8f7ef; color: #14603f; border-color: #1c7a52; }
.btn.ghost.danger { color: #b3261e; border-color: rgba(179,38,30,.45); }
.btn.ghost.danger:hover { background: #fdeceb; color: #8f1e17; border-color: #b3261e; }
[data-theme='dark'] .btn.ghost.ok { color: #8ee0b8; border-color: rgba(142,224,184,.4); }
[data-theme='dark'] .btn.ghost.ok:hover { background: #17342a; }
[data-theme='dark'] .btn.ghost.danger { color: #f0a9a4; border-color: rgba(240,169,164,.4); }
[data-theme='dark'] .btn.ghost.danger:hover { background: #3a2122; }

/* ============================================================
 * 超长显示名不该把布局顶飞：统一用省略号，并保留 title 看全名
 * ============================================================ */
.ellipsis {
  display: inline-block; max-width: 16em; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; vertical-align: middle;
}
.admin-table.users .user-name {
  display: inline-block; max-width: 100%; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; vertical-align: middle;
}
/* 卡片/列表里的作者名同样收口（保留头像，只截文字） */
.byline .ellipsis, .post-row .ellipsis { max-width: 10em; }

.icon-btn.danger { color: #b3261e; border-color: rgba(179,38,30,.4); }
.icon-btn.danger:hover { color: #fff; background: #b3261e; border-color: #b3261e; }
.icon-btn.ok { color: #1c7a52; border-color: rgba(28,122,82,.4); }
.icon-btn.ok:hover { color: #fff; background: #1c7a52; border-color: #1c7a52; }
.btn.danger { background: #b3261e; color: #fff; box-shadow: 0 3px 10px rgba(179,38,30,.24); }
.btn.danger:hover { background: #8f1e17; }
.tag.warn { background: #fdf1e3; color: #9a5b06; }
[data-theme='dark'] .tag.warn { background: #3a2a12; color: #f0c084; }
[data-theme='dark'] .icon-btn.danger { color: #f0a9a4; border-color: rgba(240,169,164,.35); }
[data-theme='dark'] .icon-btn.ok { color: #8ee0b8; border-color: rgba(142,224,184,.35); }


/* 角色列：参考 Open WebUI，角色本身是个可点按钮（点开直接改等级） */
.role-cell { white-space: nowrap; }
.role-menu { position: relative; display: inline-block; }
.role-menu > summary { list-style: none; cursor: pointer; user-select: none; }
.role-menu > summary::-webkit-details-marker { display: none; }
.role-menu > summary::after { content: ' ⌄'; opacity: .55; font-size: 11px; }
.role-menu[open] > summary { outline: 2px solid var(--blue-soft); }
.role-menu-panel {
  position: absolute; z-index: 30; top: calc(100% + 6px); left: 0; min-width: 148px;
  background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 4px;
  box-shadow: 0 14px 34px rgba(8,20,40,.22); display: flex; flex-direction: column; gap: 2px;
}
.role-menu-panel form { display: block; }
.role-option {
  width: 100%; text-align: left; border: 0; background: transparent; color: var(--ink);
  font: inherit; font-size: 13px; padding: 8px 10px; border-radius: 7px; cursor: pointer;
}
.role-option:hover { background: var(--blue-soft); color: var(--blue-deep); }
.role-option.active { font-weight: 700; color: var(--blue-deep); }
/* 在线小绿点（参考里带 ping 动画） */
.dot.on::after {
  content: ''; position: absolute; inset: 0; border-radius: 50%; background: #2f9e6f;
  animation: ping 1.6s cubic-bezier(0,0,.2,1) infinite; opacity: .5;
}
.dot { position: relative; }
@keyframes ping { 75%, 100% { transform: scale(2.1); opacity: 0; } }
/* 弹窗字段：小号灰色标签在控件上方（与参考一致） */
.modal-body .field { display: flex; flex-direction: column; gap: 6px; }
.modal-body .field > span { font-size: 12px; color: var(--muted); }


/* ============================================================
 * 管理面板用户列表（参考控制台风格）+ 编辑弹窗
 * ============================================================ */
.avatar-initial {
  display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%;
  font-size: 13px; font-weight: 700; color: #fff; flex: 0 0 auto;
}
.avatar-initial.c0 { background: #4f7cf0; }
.avatar-initial.c1 { background: #3fa47a; }
.avatar-initial.c2 { background: #d98b2b; }
.avatar-initial.c3 { background: #8a6bf0; }
.avatar-initial.c4 { background: #cf5f7a; }
.avatar-initial.c5 { background: #4aa3c7; }
.avatar-sm { width: 28px; height: 28px; border-radius: 50%; }
.avatar-xl { width: 64px; height: 64px; border-radius: 50%; }
.avatar-initial.avatar-lg { width: 64px; height: 64px; font-size: 24px; }
/* 名称列：**不要**把 td 设成 flex——那会让表格单元尺寸失控（徽标被挤掉、名字重叠）。
   内层用 span 容器承载 flex 布局。 */
.admin-table.users td.name-cell { white-space: nowrap; }
.name-wrap { display: inline-flex; align-items: center; gap: 8px; vertical-align: middle; max-width: 100%; }
.admin-table.users td.name-cell { overflow: hidden; }
.admin-table.users td.name-cell .user-name { font-weight: 600; }
/* 自适应列宽（照 Open WebUI 的做法，见其 UserList.svelte：
 *   <div class="whitespace-nowrap overflow-x-auto max-w-full"><table class="w-full table-auto">
 * 思路：**不固定表格布局**，单元格给 min-width + nowrap，列宽由内容自己撑；
 * 总宽超出面板时由外层容器横向滚动，不会压缩列宽把按钮挤重叠、也不会被裁掉。 */
.table-wrap { overflow-x: auto; max-width: 100%; white-space: nowrap; }
.table-wrap::-webkit-scrollbar { height: 0; }
.admin-table.users { table-layout: auto; width: 100%; max-width: 100%; }
.admin-table.users td { padding: 12px 10px; }
.admin-table.users th { font-weight: 400; }
.admin-table.users th:last-child { text-align: right; }
/* 各列的最小宽度：装得下就自适应，装不下就滚动 */
.admin-table.users td.name-cell { min-width: 15rem; }
.admin-table.users td.role-cell { min-width: 7rem; }
.admin-table.users td.email-cell { min-width: 12rem; }
.admin-table.users td.row-actions { min-width: 12rem; }
.admin-table.users .role-badge { background: #eef2f8; color: #46536b; }
[data-theme='dark'] .admin-table.users .role-badge { background: #1e2937; color: #9fb0c8; }
[data-theme='dark'] .admin-table.users .role-badge.role-super { background: #3a2122; color: #f0a9a4; }
[data-theme='dark'] .admin-table.users .role-badge.role-admin { background: #1d2c48; color: #9dc0ff; }
[data-theme='dark'] .admin-table.users .role-badge.role-developer { background: #17342a; color: #8ee0b8; }
.admin-table.users tbody tr:hover { background: rgba(47,111,228,.05); }

/* 弹窗 */
.modal { border: 0; padding: 0; background: transparent; max-width: 92vw; }
.modal::backdrop { background: rgba(8,14,24,.55); backdrop-filter: blur(2px); }
.modal-form {
  width: 460px; max-width: 92vw; background: var(--card); color: var(--ink);
  border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 24px 60px rgba(8,20,40,.32);
  padding: 18px 20px 16px; display: flex; flex-direction: column; gap: 14px;
}
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.modal-who { display: flex; align-items: center; gap: 12px; }
.modal-head strong { font-size: 17px; }
.modal-body { display: flex; flex-direction: column; gap: 12px; }
.modal-body label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }
.modal-body label.check { flex-direction: row; align-items: center; gap: 8px; color: var(--ink); }
.modal-body input[type='text'], .modal-body input[type='number'], .modal-body input[type='password'], .modal-body select {
  height: 38px; padding: 0 10px; font: inherit; font-size: 14px; border: 1px solid var(--line);
  border-radius: 8px; background: var(--field-bg); color: var(--ink); box-sizing: border-box; width: 100%;
}
.modal-body input:disabled { opacity: .6; }
.modal-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; }


/* 帖子配图：读者视角要看得清，别做成一排小方块 */
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; margin-top: 16px; }
.gallery img { width: 100%; height: 210px; object-fit: cover; border-radius: 12px; border: 1px solid var(--line); display: block; }
.gallery a:hover img { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(16,32,64,.16); }
.gallery img { transition: transform .16s ease, box-shadow .16s ease; }

/* 编辑页的配图管理器 */
.image-manager { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.image-cell { margin: 0; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--card); }
.image-cell img { width: 100%; height: 150px; object-fit: cover; display: block; }
.image-cell figcaption { display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 6px 8px; }
.image-actions { display: inline-flex; gap: 4px; }
.image-actions form { display: inline; }
.icon-btn.danger:hover { color: #b3261e; border-color: #b3261e; }
.icon-btn[disabled] { opacity: .35; cursor: not-allowed; }


/* 管理表格：单元格只读，编辑去 /admin/users/{id} 那个页面做。
 * 别再往格子里塞输入框——固定列宽 + 行内表单会把名字挤成竖排（踩过一次）。 */
.admin-table.users { table-layout: auto; }
.admin-table.users td { vertical-align: middle; }
.admin-table.users th { white-space: nowrap; }
.admin-table.users td.name-cell { white-space: nowrap; }
.admin-table.users td.email-cell { max-width: 230px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.admin-table.users td.row-actions { white-space: nowrap; }
.row-actions { gap: 8px; align-items: center; }
.row-actions .btn { height: 32px; padding: 0 12px; font-size: 12.5px; }
.row-actions .icon-btn { width: 32px; height: 32px; }

/* 编辑用户页的「账号概览」 */
.admin-facts { list-style: none; margin: 0; padding: 0; }
.admin-facts li { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-top: 1px solid var(--line); font-size: 14px; }
.admin-facts li:first-child { border-top: 0; }
.admin-facts li > span:first-child { width: 88px; flex: 0 0 auto; color: var(--muted); font-size: 13px; }
.admin-facts code { background: transparent; padding: 0; }


/* 深色主题下的输入控件兜底：
 * 早先只写了 [data-theme=dark] input，特异性 (0,1,1) 压不过 .inline-form input[type=text] (0,2,1)，
 * 所以管理面板的改名框在夜间仍是白底。这里逐个用同等或更高特异性覆盖。 */
[data-theme='dark'] input:not([type='checkbox']):not([type='radio']):not([type='range']),
[data-theme='dark'] select,
[data-theme='dark'] textarea,
[data-theme='dark'] .inline-form input,
[data-theme='dark'] .inline-form select,
[data-theme='dark'] .quota-cell input,
[data-theme='dark'] .review-actions input,
[data-theme='dark'] .review-bar input,
[data-theme='dark'] .source-row input,
[data-theme='dark'] .source-row select,
[data-theme='dark'] .stack input,
[data-theme='dark'] .stack select,
[data-theme='dark'] .stack textarea,
[data-theme='dark'] .search input,
[data-theme='dark'] .mirror-select {
  background: var(--field-bg);
  color: var(--ink);
  border-color: var(--line);
}


/* FAB 里的主题三态选择 */
.fab-item.theme-picker { display: inline-flex; gap: 2px; background: var(--card); border: 1px solid var(--line); border-radius: 999px; padding: 3px; box-shadow: 0 10px 22px rgba(16,32,64,.18); }
.theme-picker button {
  font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer;
  border: 0; border-radius: 999px; padding: 6px 12px; background: transparent; color: var(--muted);
  transition: background .15s ease, color .15s ease;
}
.theme-picker button:hover { color: var(--blue); }
.theme-picker button.active { background: var(--blue); color: #fff; }
.fab-item { border: 0; background: transparent; cursor: pointer; font: inherit; }
.fab-item > span { box-shadow: 0 10px 22px rgba(16,32,64,.18); }


/* 镜像下拉：不要把所有镜像堆成一片按钮 */
.mirror-box { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 8px; }
.mirror-select {
  flex: 1 1 150px; min-width: 0; height: 34px; box-sizing: border-box;
  font: inherit; font-size: 13.5px; padding: 0 8px; cursor: pointer;
  border: 1px solid var(--line); border-radius: 8px; background: var(--card); color: var(--ink);
}
.mirror-box .hint { flex: 1 1 100%; margin: 0; }


/* ============================================================
 * 整卡可点：覆盖式链接 + 作者栏单独跳主页
 * ============================================================ */
.post-card, .post-row { position: relative; cursor: pointer; }
.card-link { position: absolute; inset: 0; z-index: 1; border-radius: inherit; }
.card-link:hover { text-decoration: none; }
/* 作者栏浮在覆盖层之上，点它是进作者主页，不是进帖子 */
.post-card .foot, .post-row .row-stats, .post-row .row-thumb { position: relative; z-index: 2; }
.author-link { color: inherit; }
.author-link:hover { color: var(--blue); text-decoration: none; }
.post-card h3 a, .post-row h3 a { position: relative; z-index: 2; }
/* 键盘可达：覆盖链接获得焦点时给整卡描边 */
.post-card:focus-within, .post-row:focus-within { border-color: var(--blue); box-shadow: 0 0 0 2px var(--blue-soft); }


/* ============================================================
 * 帖子页三栏（参考贴吧）：左=分区/我的，中=正文与回复，右=作者/资源/数据
 * ============================================================ */
.post-layout { display: grid; grid-template-columns: 176px minmax(0, 1fr) 292px; gap: 16px; align-items: start; }
.post-side, .post-aside { display: flex; flex-direction: column; gap: 14px; position: sticky; top: 16px; }
.side-card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px; box-shadow: 0 4px 14px rgba(29,60,116,.06); }
.side-card h3 { margin: 0 0 10px; font-size: 13px; color: var(--muted); font-weight: 700; letter-spacing: .3px; }
.side-nav { display: flex; flex-direction: column; gap: 2px; }
.side-nav a { padding: 8px 10px; border-radius: 8px; font-size: 13.5px; color: var(--ink); }
.side-nav a:hover { background: var(--blue-soft); color: var(--blue-deep); text-decoration: none; }
.side-nav a.active { background: var(--blue-soft); color: var(--blue-deep); font-weight: 600; }
.author-card { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; }
.author-card .actions-inline { margin-top: 6px; }
.side-stats { list-style: none; margin: 0; padding: 0; }
.side-stats li { display: flex; justify-content: space-between; padding: 6px 0; border-top: 1px solid var(--line); font-size: 13.5px; }
.side-stats li:first-child { border-top: 0; }
.side-stats b { color: var(--blue-deep); }
.upload-row { display: flex; align-items: center; gap: 10px; margin-top: 14px; flex-wrap: wrap; }
.side-card .source-item { padding: 10px 0; border-top: 1px dashed var(--line); }
.side-card .source-item:first-of-type { border-top: 0; }
.side-card .source-head { margin-bottom: 6px; }
/* 发布/编辑页的来源行：数量不限，可增删 */
.source-rows { display: flex; flex-direction: column; gap: 8px; }
.source-row { display: grid; grid-template-columns: 132px 1fr 96px 110px 36px; gap: 8px; align-items: center; }
.source-row input, .source-row select { height: 34px; font: inherit; font-size: 13.5px; padding: 0 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); color: var(--ink); box-sizing: border-box; }
.source-row .icon-btn { width: 34px; height: 34px; }
@media (max-width: 700px) { .source-row { grid-template-columns: 1fr 1fr; } }
/* 分区封面 */
.section-nav a.has-cover { padding-left: 6px; display: inline-flex; align-items: center; gap: 6px; }
.section-nav a img { width: 22px; height: 22px; border-radius: 6px; object-fit: cover; }
.section-banner { position: relative; border-radius: 14px; overflow: hidden; margin-bottom: 14px; min-height: 120px; background-size: cover; background-position: center; }
.section-banner .inner { position: absolute; inset: auto 0 0 0; padding: 14px 18px; background: linear-gradient(transparent, rgba(6,16,32,.72)); color: #fff; }
.section-banner h3 { margin: 0; color: #fff; font-size: 18px; }
/* 管理面板：分区封面卡片 */
.cover-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.cover-cell { border: 1px solid var(--line); border-radius: 10px; padding: 10px; display: flex; flex-direction: column; gap: 8px; }
.cover-cell .thumb { height: 70px; border-radius: 8px; background: var(--blue-soft); background-size: cover; background-position: center; }
.cover-cell input[type='file'] { font-size: 12px; }
@media (max-width: 1100px) {
  .post-layout { grid-template-columns: 1fr; }
  .post-side, .post-aside { position: static; }
  .post-aside .side-card:first-child { display: flex; }
}


/* ============================================================
 * 紧凑按钮：和用户管理页的行内控件同一套观感
 *   —— 8px 圆角（不用胶囊）、统一 34px 高度、字号一致
 * ============================================================ */
.btn.sm, .btn-ghost.sm {
  display: inline-flex; align-items: center; justify-content: center;
  height: 34px; padding: 0 16px; font-size: 13.5px; font-weight: 600;
  border-radius: 8px; line-height: 1;
}

/* 审核动作：一行对齐（通过 / 理由输入 / 拒绝 同高、同基线） */
.review-actions { display: flex; flex-direction: row; align-items: center; gap: 8px; flex-wrap: wrap; }
.review-actions .inline-form { display: inline-flex; align-items: center; gap: 8px; margin: 0; }
.review-actions input[type='text'], .review-bar input[type='text'] {
  height: 34px; box-sizing: border-box; padding: 0 10px;
  font: inherit; font-size: 13.5px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--card); color: var(--ink);
}
.review-actions input[type='text'] { width: 168px; }
.review-bar input[type='text'] { width: 150px; }
.review-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.review-bar .inline-form { display: inline-flex; align-items: center; gap: 8px; margin: 0; }
.review-actions .btn, .review-bar .btn { height: 34px; padding: 0 16px; border-radius: 8px; font-size: 13.5px; }


/* ============================================================
 * 点赞 / 收藏 / 通知 / 系统公告
 * ============================================================ */
.post-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 16px; }
.post-actions .btn { display: inline-flex; align-items: center; gap: 6px; }
.post-actions .btn.liked { background: #fdeceb; color: #b3261e; border-color: #f6cfcb; }
.post-actions .btn.marked { background: #fff6e5; color: #a35a17; border-color: #f2ddb8; }
[data-theme='dark'] .post-actions .btn.liked { background: #3a1d1b; color: #f3b4ae; border-color: #5a2b28; }
[data-theme='dark'] .post-actions .btn.marked { background: #33240f; color: #e0b47f; border-color: #5a4222; }

.announce-banner { border-left: 4px solid var(--blue); }
.announce-banner h3 { margin: 8px 0 6px; font-size: 17px; }
.announcement { padding: 14px 0; border-top: 1px solid var(--line); }
.announcement:first-of-type { border-top: 0; }
.announcement h3 { margin: 6px 0; font-size: 16px; }
.announcement-body { margin: 0; white-space: pre-wrap; color: var(--ink); line-height: 1.7; }

.notify-list { display: flex; flex-direction: column; }
.notify { display: flex; align-items: flex-start; gap: 12px; padding: 12px 8px; border-top: 1px solid var(--line); }
.notify:first-child { border-top: 0; }
.notify.unread { background: var(--blue-soft); border-radius: 12px; }
.notify-main { min-width: 0; flex: 1 1 auto; }
.notify-title { font-weight: 600; color: var(--ink); }
.notify-body { margin: 4px 0 0; color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.notify-kind { font-size: 11.5px; font-weight: 700; border-radius: 999px; padding: 3px 9px; background: #eef2f8; color: #33415c; white-space: nowrap; }
.notify-kind.kind-message { background: #eaf1fd; color: #1f57bd; }
.notify-kind.kind-like { background: #fdeceb; color: #b3261e; }
.notify-kind.kind-announcement { background: #e8f7ef; color: #1c7a52; }
.notify-kind.kind-review { background: #fff4e5; color: #a35a17; }
[data-theme='dark'] .notify-kind { background: #1b2431; color: #c7d4e6; }
.badge:not([hidden]) { margin-left: 6px; }
.usermenu-panel .badge { background: #e5484d; color: #fff; border-radius: 999px; font-size: 11px; font-weight: 700; padding: 1px 7px; }


/* ============================================================
 * 帖子列表视图（参考社区项目列表）+ 私信 + 审核 + 黑名单
 * ============================================================ */
html[data-post-view='list'] .post-grid { display: none; }
html[data-post-view='card'] .post-list { display: none; }
.list-toolbar { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 4px; }
.list-toolbar .section-nav { margin: 0; }
.view-switch { margin-left: auto; display: inline-flex; gap: 4px; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 3px; }
.view-switch button {
  width: 32px; height: 28px; border: 0; border-radius: 8px; background: transparent;
  color: var(--muted); cursor: pointer; display: grid; place-items: center;
  transition: background .15s ease, color .15s ease;
}
.view-switch button:hover { color: var(--blue); }
.view-switch button.active { background: var(--blue-soft); color: var(--blue-deep); }

.post-list { display: flex; flex-direction: column; gap: 12px; }
.post-row {
  display: flex; align-items: stretch; gap: 14px;
  background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px;
  box-shadow: 0 3px 12px rgba(29,60,116,.06);
  transition: transform .14s ease, box-shadow .14s ease, border-color .14s ease;
}
.post-row:hover { transform: translateY(-1px); box-shadow: 0 10px 22px rgba(29,60,116,.12); border-color: var(--blue); }
.row-main { min-width: 0; flex: 1 1 auto; display: flex; flex-direction: column; gap: 6px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { font-size: 12px; font-weight: 600; border-radius: 999px; padding: 3px 11px; background: #eef2f8; color: #33415c; }
.chip.warn { background: #fff4e5; color: #a35a17; }
[data-theme='dark'] .chip { background: #1b2431; color: #c7d4e6; }
[data-theme='dark'] .chip.warn { background: #33240f; color: #e0b47f; }
.post-row h3 { margin: 2px 0 0; font-size: 17px; line-height: 1.35; }
.post-row h3 a { color: var(--ink); }
.post-row h3 a:hover { color: var(--blue); text-decoration: none; }
.row-preview { margin: 0; color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-stats { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-top: 2px; color: var(--muted); font-size: 13px; }
.stat { display: inline-flex; align-items: center; gap: 5px; }
.row-thumb {
  flex: 0 0 auto; width: 132px; min-height: 74px; border-radius: 10px; align-self: center;
  background-size: cover; background-position: center; background-color: var(--blue-soft); border: 1px solid var(--line);
}
@media (max-width: 700px) { .row-thumb { display: none; } .post-row { padding: 12px; } }

/* 私信 */
.conversations { display: flex; flex-direction: column; }
.conversation {
  display: flex; align-items: center; gap: 12px; padding: 12px 8px; border-radius: 12px;
  border-bottom: 1px solid var(--line); transition: background .15s ease;
}
.conversation:hover { background: var(--blue-soft); text-decoration: none; }
.conversation-main { min-width: 0; flex: 1 1 auto; }
.conversation-head { display: flex; align-items: baseline; gap: 10px; }
.conversation-head strong { color: var(--ink); }
.conversation-preview { margin: 2px 0 0; color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conversation.unread .conversation-head strong { color: var(--blue-deep); }
.badge { background: var(--blue); color: #fff; border-radius: 999px; font-size: 12px; font-weight: 700; padding: 2px 9px; }

.thread-head { display: flex; align-items: center; gap: 12px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.thread { display: flex; flex-direction: column; gap: 10px; padding: 16px 0; }
.bubble { max-width: 74%; align-self: flex-start; background: var(--blue-soft); border-radius: 14px; padding: 10px 14px; }
.bubble.mine { align-self: flex-end; background: var(--blue); color: #fff; }
.bubble.mine .meta { color: rgba(255,255,255,.8); }
.bubble p { margin: 0; white-space: pre-wrap; }
.bubble time { display: block; margin-top: 4px; font-size: 12px; }

/* 审核 */
.review-list { display: flex; flex-direction: column; gap: 12px; }
.review-row { display: flex; gap: 14px; align-items: center; border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.review-main { min-width: 0; flex: 1 1 auto; }
.review-main h3 { margin: 4px 0; font-size: 15px; }
.review-actions { display: flex; flex-direction: row; align-items: center; gap: 8px; flex-wrap: wrap; }
.review-actions input[type='text'] { font: inherit; font-size: 13px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); color: var(--ink); width: 150px; }
.review-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 12px; padding: 10px 12px; border: 1px dashed var(--line); border-radius: 10px; background: #fffaf0; }
[data-theme='dark'] .review-bar { background: #221d12; }
.review-bar input[type='text'] { font: inherit; font-size: 13px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); color: var(--ink); width: 140px; }

/* 黑名单 */
.blocklist { list-style: none; margin: 0; padding: 0; }
.blocklist li { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.blocklist li:first-child { border-top: 0; }
.blocklist .inline-form { margin-left: auto; }


/* ============================================================
 * 管理表格对齐 + 异步提交反馈
 * ============================================================ */
.admin-table.users { table-layout: auto; }
.admin-table.users th:nth-child(1), .admin-table.users td:nth-child(1) { width: 92px; }
.admin-table.users th:nth-child(2), .admin-table.users td:nth-child(2) { width: 192px; }
.admin-table.users th:nth-child(3), .admin-table.users td:nth-child(3) { width: 200px; }
.admin-table.users th:nth-child(4), .admin-table.users td:nth-child(4) { width: 236px; }
.admin-table.users th:nth-child(5), .admin-table.users td:nth-child(5) { width: 104px; }
.admin-table.users th:nth-child(6), .admin-table.users td:nth-child(6) { width: 104px; }
.admin-table.users th:nth-child(7), .admin-table.users td:nth-child(7) { width: 210px; }
.admin-table.users td { vertical-align: middle; }
.admin-table.users td:nth-child(3) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* 预算：数值右对齐占固定宽度，编辑器紧跟其后，头尾对齐 */
.quota-cell { white-space: nowrap; }
.quota-cell .quota-value {
  display: inline-block; min-width: 78px; text-align: right;
  font-variant-numeric: tabular-nums; color: var(--muted);
}
.quota-cell .inline-form { display: inline-flex; align-items: center; gap: 6px; margin-left: 10px; vertical-align: middle; }
.quota-cell input[type='number'] {
  width: 76px; text-align: right; font-variant-numeric: tabular-nums;
  font: inherit; font-size: 13px; padding: 6px 8px;
  border: 1px solid var(--line); border-radius: 8px; background: var(--card); color: var(--ink);
}
.quota-cell input[type='number']::-webkit-outer-spin-button,
.quota-cell input[type='number']::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.row-actions .inline-form { display: inline-flex; align-items: center; gap: 6px; }

/* 异步反馈：一行小字 + 单元格闪一下，不需要整页刷新 */
.form-note { font-size: 12px; margin-left: 8px; transition: opacity .2s ease; }
.form-note.ok { color: #1c7a52; }
.form-note.err { color: #b3261e; }
[data-theme='dark'] .form-note.ok { color: #86d6ab; }
[data-theme='dark'] .form-note.err { color: #f3b4ae; }
@keyframes flashOk { 0% { background: rgba(47,158,111,.18); } 100% { background: transparent; } }
@keyframes flashErr { 0% { background: rgba(179,38,30,.16); } 100% { background: transparent; } }
.flash-ok { animation: flashOk .9s ease; }
.flash-err { animation: flashErr .9s ease; }
@media (max-width: 1100px) { .admin-table.users { table-layout: auto; } }


/* ============================================================
 * 管理页（参考云控制台的用户管理） + 夜间模式输入框收口
 * ============================================================ */
.home-btn {
  display: inline-flex; align-items: center; gap: 6px; margin-left: 14px;
  font-size: 13px; font-weight: 600; color: #fff; text-decoration: none;
  background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.24);
  border-radius: 999px; padding: 6px 14px; transition: background .18s ease, transform .18s ease;
}
.home-btn:hover { background: rgba(255,255,255,.26); transform: translateY(-1px); text-decoration: none; color: #fff; }

.admin { display: grid; grid-template-columns: 210px 1fr; gap: 18px; align-items: start; }
.admin-side { position: sticky; top: 20px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 10px; box-shadow: 0 6px 18px rgba(29,60,116,.08); }
.admin-side nav { display: flex; flex-direction: column; gap: 2px; }
.admin-side nav a { padding: 10px 12px; border-radius: 10px; font-size: 14px; color: var(--ink); transition: background .15s ease, padding-left .15s ease; }
.admin-side nav a:hover { background: var(--blue-soft); color: var(--blue-deep); padding-left: 16px; text-decoration: none; }
.admin-side nav a.active { background: var(--blue-soft); color: var(--blue-deep); font-weight: 600; }
.admin-body { display: flex; flex-direction: column; gap: 14px; }
.admin-tabs { display: flex; gap: 22px; border-bottom: 1px solid var(--line); padding: 0 4px; }
.admin-tabs a { padding: 10px 2px; font-size: 14.5px; color: var(--muted); border-bottom: 2px solid transparent; transition: color .15s ease, border-color .15s ease; }
.admin-tabs a:hover { color: var(--ink); text-decoration: none; }
.admin-tabs a.active { color: var(--ink); font-weight: 600; border-bottom-color: var(--blue); }
.admin-head { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.admin-head h1 { margin: 0; font-size: 22px; }
.search { display: flex; align-items: center; gap: 8px; margin-left: auto; background: var(--card); border: 1px solid var(--line); border-radius: 999px; padding: 7px 14px; color: var(--muted); }
.search input { border: 0; background: transparent; font: inherit; font-size: 14px; color: var(--ink); outline: none; width: 230px; }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 16px; box-shadow: 0 6px 18px rgba(29,60,116,.08); }
.panel h2 { margin: 0 0 10px; font-size: 16px; }
.role-badge { display: inline-block; border-radius: 999px; padding: 3px 12px; font-size: 12.5px; font-weight: 600; background: #eef2f8; color: #33415c; }
.role-badge.role-super { background: #fdeceb; color: #b3261e; }
.role-badge.role-admin { background: #eaf1fd; color: #1f57bd; }
.role-badge.role-developer { background: #e8f7ef; color: #1c7a52; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-left: 6px; }
.dot.on { background: #2f9e6f; box-shadow: 0 0 0 3px rgba(47,158,111,.18); }
.dot.off { background: #c9d2df; }
/* 操作列：一行排开，别换行——换行会把行高撑起来，看着就是「没对齐」 */
.row-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex-wrap: nowrap; }
.icon-btn {
  display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--card); color: var(--muted); cursor: pointer;
  transition: color .15s ease, border-color .15s ease, background .15s ease, transform .15s ease;
}
.icon-btn:hover { color: var(--blue); border-color: var(--blue); transform: translateY(-1px); text-decoration: none; }
/* 磁盘预算单元格：数值 + 行内编辑 */
.quota-cell { white-space: nowrap; }
.quota-cell .inline-form { display: inline-flex; align-items: center; gap: 6px; margin-left: 8px; }
.quota-cell input[type='number'] {
  font: inherit; font-size: 13px; width: 88px; padding: 6px 8px;
  border: 1px solid var(--line); border-radius: 8px; background: var(--card); color: var(--ink);
}

@media (max-width: 900px) { .admin { grid-template-columns: 1fr; } .admin-side { position: static; } .search { margin-left: 0; width: 100%; } .search input { width: 100%; } }

/* 夜间模式：所有输入类控件统一深色，别留白块 */
[data-theme='dark'] input, [data-theme='dark'] select, [data-theme='dark'] textarea {
  background: #131a24; color: var(--ink); border-color: var(--line);
}
[data-theme='dark'] input::placeholder, [data-theme='dark'] textarea::placeholder { color: #6b7a8d; }
[data-theme='dark'] input[type='search'] { background: transparent; }
[data-theme='dark'] input[type='checkbox'], [data-theme='dark'] input[type='radio'] { accent-color: var(--blue); }
[data-theme='dark'] input[type='range'] { accent-color: var(--blue); }
[data-theme='dark'] button, [data-theme='dark'] .btn { color: var(--ink); }
[data-theme='dark'] .btn:not(.ghost) { color: #08101c; }
[data-theme='dark'] .search { background: #131a24; }
[data-theme='dark'] .role-badge { background: #1b2431; color: #c7d4e6; }
[data-theme='dark'] .role-badge.role-super { background: #3a1d1b; color: #f3b4ae; }
[data-theme='dark'] .role-badge.role-admin { background: #1b2740; color: #9dbdf5; }
[data-theme='dark'] .role-badge.role-developer { background: #14301f; color: #86d6ab; }
[data-theme='dark'] .icon-btn { background: #1b2431; }
[data-theme='dark'] .avatar-crop canvas { background: #131a24; }


/* ============================================================
 * 顶栏用户菜单 / 右下角快捷按钮 / 账户设置
 * 形态参考云服务控制台：头像下拉 + 右下角悬浮按钮 + 左侧分栏设置页。
 * ============================================================ */
.usermenu { position: relative; }
.user-chip {
  display: flex; align-items: center; gap: 8px; color: #fff; font: inherit; font-weight: 600; font-size: 14px;
  background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.22);
  border-radius: 999px; padding: 5px 12px 5px 6px; cursor: pointer;
  transition: background .18s ease, transform .18s ease;
}
.user-chip:hover { background: rgba(255,255,255,.22); transform: translateY(-1px); }
.user-chip .chev { transition: transform .22s ease; }
.usermenu.open .user-chip .chev { transform: rotate(180deg); }
.usermenu-panel {
  position: absolute; right: 0; top: calc(100% + 10px); min-width: 208px; z-index: 60;
  background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 8px;
  box-shadow: 0 18px 40px rgba(16,32,64,.22);
  opacity: 0; transform: translateY(-8px) scale(.97); pointer-events: none;
  transition: opacity .18s ease, transform .22s cubic-bezier(.2,.9,.3,1.2);
}
.usermenu.open .usermenu-panel { opacity: 1; transform: translateY(0) scale(1); pointer-events: auto; }
.usermenu-head { display: flex; align-items: center; gap: 10px; padding: 8px 8px 12px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.usermenu-head strong { display: block; font-size: 14px; }
.usermenu-panel a, .usermenu-panel .menu-btn {
  display: block; width: 100%; text-align: left; font: inherit; font-size: 13.5px;
  padding: 9px 10px; border-radius: 9px; border: 0; background: transparent; color: var(--ink); cursor: pointer;
  transition: background .15s ease, padding-left .15s ease;
}
.usermenu-panel a:hover, .usermenu-panel .menu-btn:hover { background: var(--blue-soft); color: var(--blue-deep); padding-left: 14px; text-decoration: none; }
.menu-form { margin: 0; }

.fab { position: fixed; right: 26px; bottom: 26px; z-index: 70; display: flex; flex-direction: column; align-items: flex-end; gap: 12px; }
.fab-btn {
  width: 60px; height: 60px; border-radius: 50%; border: 0; cursor: pointer; color: #fff;
  background: linear-gradient(140deg, #4b86f5, #2a63d6);
  box-shadow: 0 12px 26px rgba(42,99,214,.42), 0 2px 6px rgba(16,32,64,.18);
  display: grid; place-items: center;
  transition: transform .26s cubic-bezier(.2,.9,.3,1.5), box-shadow .26s ease, background .26s ease;
}
.fab-btn:hover { transform: translateY(-3px) scale(1.06); box-shadow: 0 18px 34px rgba(42,99,214,.5); }
.fab-btn:active { transform: scale(.96); }
.fab.open .fab-btn { transform: rotate(45deg) scale(1.04); }
.fab-btn svg { transition: transform .26s ease; }
.fab-menu { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.fab-item {
  opacity: 0; transform: translateY(14px) scale(.86); pointer-events: none;
  transition: opacity .2s ease, transform .28s cubic-bezier(.2,.9,.3,1.4);
}
.fab.open .fab-item { opacity: 1; transform: translateY(0) scale(1); pointer-events: auto; }
.fab-item span {
  display: inline-block; background: var(--card); border: 1px solid var(--line); color: var(--ink);
  border-radius: 999px; padding: 10px 20px; font-size: 14px; font-weight: 600;
  box-shadow: 0 10px 22px rgba(16,32,64,.18);
}
.fab-item:hover span { background: var(--blue); color: #fff; border-color: var(--blue); }
@media (max-width: 640px) { .fab { right: 16px; bottom: 16px; } .fab-btn { width: 54px; height: 54px; } }

/* 账户设置：左分栏 + 右内容 */
.settings { display: grid; grid-template-columns: 260px 1fr; gap: 18px; align-items: start; }
.settings-nav { position: sticky; top: 20px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px; box-shadow: 0 6px 18px rgba(29,60,116,.08); }
.settings-user { display: flex; gap: 12px; align-items: center; padding-bottom: 12px; border-bottom: 1px solid var(--line); margin-bottom: 10px; }
.settings-nav nav { display: flex; flex-direction: column; gap: 2px; }
.settings-nav nav a { padding: 10px 12px; border-radius: 10px; font-size: 14px; color: var(--ink); transition: background .15s ease, padding-left .15s ease; }
.settings-nav nav a:hover { background: var(--blue-soft); color: var(--blue-deep); padding-left: 16px; text-decoration: none; }
.settings-body { display: flex; flex-direction: column; gap: 16px; }
.avatar-row { display: flex; align-items: center; gap: 16px; margin-bottom: 12px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.alert.ok { background: #e8f7ef; color: #1c7a52; }
[data-theme='dark'] .alert.ok { background: #14301f; color: #86d6ab; }
@media (max-width: 900px) {
  .settings { grid-template-columns: 1fr; }
  .settings-nav { position: static; }
}


/* ============================================================
 * 顶栏信息 + 右侧悬浮窗 + 头像
 * 页面顶部不再放整块 hero：概况进蓝条，动作进右侧悬浮窗。
 * ============================================================ */
.bar-stats { display: flex; gap: 18px; margin-left: 22px; flex-wrap: wrap; }
.bar-stats span { font-size: 13px; color: #dbe7ff; }
.bar-user { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.user-chip { display: flex; align-items: center; gap: 8px; color: #fff; font-weight: 600; font-size: 14px; }
.user-chip:hover { text-decoration: none; opacity: .9; }
.avatar { border-radius: 50%; object-fit: cover; background: #e9eff8; border: 1px solid rgba(0,0,0,.08); vertical-align: middle; }
[data-theme='dark'] .avatar { background: #1b2431; border-color: var(--line); }
.byline { display: inline-flex; align-items: center; gap: 6px; }

.dock {
  position: fixed; right: 16px; top: 96px; z-index: 40;
  display: flex; align-items: flex-start; gap: 6px;
}
.dock-items {
  display: flex; flex-direction: column; gap: 6px;
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  padding: 8px; box-shadow: 0 10px 26px rgba(29,60,116,.16);
}
.dock-items a, .dock-items button {
  font: inherit; font-size: 13px; text-align: left; white-space: nowrap;
  padding: 8px 12px; border-radius: 10px; border: 1px solid transparent;
  background: transparent; color: var(--ink); cursor: pointer;
}
.dock-items a:hover, .dock-items button:hover { background: var(--blue-soft); color: var(--blue-deep); text-decoration: none; }
.dock-toggle {
  width: 26px; height: 26px; border-radius: 50%; cursor: pointer;
  border: 1px solid var(--line); background: var(--card); color: var(--muted); font: inherit;
}
.dock.closed .dock-items { display: none; }
@media (max-width: 900px) {
  .dock { top: auto; bottom: 14px; right: 14px; }
  .dock-items { flex-direction: row; overflow-x: auto; max-width: 82vw; }
  .bar-stats { display: none; }
}

/* 个人主页 */
.profile-head { display: flex; align-items: center; gap: 16px; }
.profile-head h1 { margin: 0 0 4px; font-size: 22px; }
.avatar-lg { width: 72px; height: 72px; }
.avatar-editor { margin-top: 16px; border-top: 1px solid var(--line); padding-top: 14px; }
.avatar-crop { margin-top: 10px; display: grid; gap: 10px; max-width: 360px; }
.avatar-crop canvas { width: 320px; height: 320px; border-radius: 12px; border: 1px solid var(--line); touch-action: none; cursor: crosshair; }
.avatar-crop input[type='range'] { width: 320px; }


/* ============================================================
 * 夜间模式
 * 主题由 base.html 的内联脚本在首次绘制前写到 <html data-theme>，
 * 默认跟随系统（prefers-color-scheme），用户切换后记在 localStorage。
 * 这里只覆盖配色与少数写死颜色的表面，不动版式。
 * ============================================================ */
[data-theme="dark"] {
  --blue: #5b8def;
  --blue-deep: #8fb4f8;
  --blue-soft: #1b2740;
  --ink: #e7edf6;
  --muted: #93a1b5;
  --line: #26313f;
  --bg: #0e141b;
  --card: #161e28;
  --field-bg: #131a24;
}
[data-theme="dark"] body { color: var(--ink); }
[data-theme="dark"] code { background: #1e2935; color: #cfe0f5; }
[data-theme="dark"] .card,
[data-theme="dark"] .post-card,
[data-theme="dark"] .auth-card { background: var(--card); border-color: var(--line); box-shadow: 0 6px 18px rgba(0,0,0,.35); }
[data-theme="dark"] .post-card:hover { box-shadow: 0 10px 24px rgba(0,0,0,.45); }
[data-theme="dark"] .btn.ghost { background: #1b2431; color: var(--ink); border-color: var(--line); }
[data-theme="dark"] .section-nav a,
[data-theme="dark"] .mirror,
[data-theme="dark"] .size-pill,
[data-theme="dark"] .tag { background: #1b2431; color: var(--ink); border-color: var(--line); }
[data-theme="dark"] .section-nav a.active { background: var(--blue); color: #08101c; border-color: var(--blue); }
[data-theme="dark"] .mirror-fastest { background: #1b2740; color: var(--blue-deep); }
[data-theme="dark"] .stack input,
[data-theme="dark"] .stack textarea,
[data-theme="dark"] .stack select,
[data-theme="dark"] .inline-form input,
[data-theme="dark"] .inline-form select,
[data-theme="dark"] .source-row input,
[data-theme="dark"] .source-row select { background: #131a24; color: var(--ink); border-color: var(--line); }
[data-theme="dark"] .kind-picker label { border-color: var(--line); }
[data-theme="dark"] .post-cover-empty { background: linear-gradient(135deg, #1a2434, #141c27); }
[data-theme="dark"] .post-cover-empty::after { opacity: .22; }
[data-theme="dark"] .kind-discussion { background: #1b2740; color: #9dbdf5; }
[data-theme="dark"] .kind-resource { background: #14301f; color: #86d6ab; }
[data-theme="dark"] .kind-repost { background: #33240f; color: #e0b47f; }
[data-theme="dark"] .provider { background: #1b2431; color: #c7d4e6; }
[data-theme="dark"] .provider-github { background: #1f242b; color: #d8dee6; }
[data-theme="dark"] .gallery img { border-color: var(--line); }
[data-theme="dark"] .alert { background: #3a1d1b; color: #f3b4ae; }
[data-theme="dark"] .tag.ok { background: #14301f; color: #86d6ab; }
[data-theme="dark"] .tag.warn { background: #33240f; color: #e0b47f; }

.theme-toggle {
  margin-left: 6px; border: 1px solid rgba(255,255,255,.45); background: transparent;
  color: #fff; border-radius: 999px; padding: 5px 12px; font: inherit; font-size: 13px; cursor: pointer;
}
.theme-toggle:hover { background: rgba(255,255,255,.16); }


/* 管理面板 */
.admin-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.admin-table th, .admin-table td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.admin-table th { color: var(--muted); font-weight: 600; font-size: 13px; }
.inline-form { display: flex; gap: 6px; align-items: center; margin: 0; }
.inline-form input[type='text'], .inline-form select { font: inherit; padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--field-bg); color: var(--ink); }
.inline-form input[type='text'] { width: 130px; }
.tag.ok { background: #e8f7ef; color: #1c7a52; }
.tag.warn { background: #fff4e5; color: #a35a17; }
.tag { display: inline-block; border-radius: 999px; padding: 2px 10px; font-size: 12px; font-weight: 600; background: #eef2f8; color: #33415c; }

