* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
/* 键盘焦点、链接和主要操作统一使用蓝色，不随装饰主题改变含义。 */
:focus-visible { outline: 3px solid var(--interactive); outline-offset: 3px; }
a { color: var(--interactive); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.navigation-tools { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; }
.navigation-tools { padding: 12px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; }
.navigation-tools select { max-width: 230px; }
.navigation-tools input[type=checkbox], .manage-item .select-link { width: 16px; height: 16px; flex: 0 0 16px; padding: 0; accent-color: var(--interactive); }
.help-tip { display: inline-flex; justify-content: center; align-items: center; width: 18px; height: 18px; border: 1px solid var(--muted); border-radius: 50%; font-size: 12px; cursor: help; }
.page-progress { position: fixed; top: 86px; left: 50%; transform: translateX(-50%); z-index: 90; padding: 8px 16px; background: var(--card); border: 1px solid var(--interactive); border-radius: 99px; color: var(--interactive); box-shadow: 0 3px 12px var(--shade-1); pointer-events: none; }
.data-dialog { width: min(680px, 94vw); max-height: 85vh; overflow: auto; }
.trash-list { margin: 14px 0; }
.trash-row { display: flex; gap: 12px; justify-content: space-between; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); }
.trash-row > div { min-width: 0; overflow-wrap: anywhere; }
.backup-card { margin-top: 18px; }
.backup-card p { margin: 10px 0; }
.toast.error { background: #b42318; color: #fff; }
.toast.success { background: #18794e; color: #fff; }
.toast button { margin-left: 12px; color: var(--interactive); }
.theme-card { color: var(--ink); box-shadow: none; text-align: left; }
.link-card.disabled, .icon-tile.disabled, .link-table tr.disabled { cursor: default; }
/*
  主题系统：只改上面 9 个基础变量（--bg/--card/--card-2/--ink/--muted/--line/--accent/--accent-deep/--blue）
  即可整套换肤，其余都是自动派生的同色系深浅色。前端「设置 → 主题」通过内联样式覆盖这几个变量。
*/
:root {
  --bg: #fdf4e7;
  --card: #ffffff;
  --card-2: #fffdfa;
  --ink: #4a3b32;
  --muted: #a89788;
  --line: #f0e4d7;
  --accent: #ff9a62;
  --accent-deep: #f07b3f;
  --blue: #7ec8e3;
  --radius: 18px;
  --interactive: #2563eb;
  --interactive-deep: #1d4ed8;

  /* ---- 以下为派生色（跟随基础色自动变化，一般不用改） ---- */
  --soft: color-mix(in srgb, var(--accent-deep) 6%, var(--card));
  --soft-2: color-mix(in srgb, var(--accent-deep) 11%, var(--card));
  --hover: color-mix(in srgb, var(--accent-deep) 15%, var(--card));
  --hover-2: color-mix(in srgb, var(--accent-deep) 28%, var(--card));
  --chip: color-mix(in srgb, var(--accent-deep) 8%, var(--card));
  --chip-line: color-mix(in srgb, var(--accent-deep) 28%, var(--card));
  --tint-weak: color-mix(in srgb, var(--accent-deep) 14%, transparent);
  --tint: color-mix(in srgb, var(--accent-deep) 22%, transparent);
  --tint-strong: color-mix(in srgb, var(--accent-deep) 34%, transparent);
  --shade-1: color-mix(in srgb, var(--ink) 6%, transparent);
  --shade-2: color-mix(in srgb, var(--ink) 18%, transparent);
  --shade-3: color-mix(in srgb, var(--ink) 25%, transparent);
  --shade-4: color-mix(in srgb, var(--ink) 32%, transparent);
  --shade-5: color-mix(in srgb, var(--ink) 66%, transparent);
  --header-bg: color-mix(in srgb, var(--card) 90%, transparent);
  --glow1: color-mix(in srgb, var(--accent) 28%, transparent);
  --glow2: color-mix(in srgb, var(--blue) 26%, transparent);
  --hero-a: var(--accent);
  --hero-b: color-mix(in srgb, var(--accent) 35%, var(--card));
  --hero-c: var(--blue);
  --sw-track: color-mix(in srgb, var(--ink) 24%, var(--card));
  --on-accent: #fff;
}
body {
  font-family: "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  background:
    radial-gradient(800px 400px at 90% -10%, var(--glow1), transparent),
    radial-gradient(700px 400px at -10% 20%, var(--glow2), transparent),
    var(--bg);
  color: var(--ink); min-height: 100vh;
  display: flex; flex-direction: column;
}
.center { text-align: center; }
.hidden { display: none !important; }
.muted { color: var(--muted); font-size: 13px; }

/* ---------- 头部 ---------- */
header {
  position: sticky; top: 0; z-index: 8;
  display: flex; align-items: center; gap: 18px;
  padding: 10px 28px;
  background: var(--header-bg); backdrop-filter: blur(8px);
  border-bottom: 2px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; flex-shrink: 0; }
.brand:hover { opacity: .85; }
.brand img { width: 42px; height: 42px; border-radius: 12px; -webkit-user-drag: none; }
.brand span { font-size: 20px; font-weight: 800; letter-spacing: 1px; }
/* 导航按钮统一靠左排列，铃铛 + 用户信息靠右 */
nav#userbar { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; flex-wrap: wrap; }
.nav-links { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; min-width: 0; }

/* 用户信息胶囊（突出个人信息） */
.user-chip {
  display: inline-flex; align-items: center; gap: 8px;
  background: linear-gradient(135deg, var(--soft), var(--card)); border: 1.5px solid var(--chip-line);
  border-radius: 999px; padding: 4px 6px 4px 10px; box-shadow: 0 2px 8px var(--tint-weak);
}
.user-chip .avatar {
  width: 30px; height: 30px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 800; color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-deep));
  box-shadow: 0 2px 6px var(--tint-strong);
}
.user-chip .uc-name { font-weight: 700; font-size: 14px; color: var(--ink); }
.user-chip .uc-badge { font-size: 11px; background: var(--ink); color: #fff; padding: 1px 8px; border-radius: 999px; }
.user-chip .uc-logout { padding: 4px 12px; font-size: 12px; }

button {
  cursor: pointer; border: none; background: var(--card); color: var(--ink);
  border-radius: 999px; padding: 7px 16px; font-size: 14px;
  box-shadow: 0 1px 4px var(--shade-1); transition: all .15s;
  user-select: none; -webkit-user-drag: none;
}
button.block { display: block; width: 100%; }
button:hover { transform: translateY(-1px); box-shadow: 0 3px 10px var(--tint-weak); }
button.primary { background: linear-gradient(135deg, var(--interactive), var(--interactive-deep)); color: #fff; font-weight: 600; }
button.ghost { background: var(--card); color: var(--interactive); border: 1.5px solid var(--line); }
button.danger { color: #b42318; background: #fee4e2; }
button.small { padding: 3px 10px; font-size: 12px; }
button:disabled { cursor: default; opacity: .55; transform: none; }
button.tab.active { background: var(--ink); color: #fff; }

input, textarea {
  border: 1.5px solid var(--line); border-radius: 12px; padding: 8px 12px;
  font-size: 14px; width: 100%; background: var(--card-2); color: var(--ink);
}
input:focus, textarea:focus { outline: none; border-color: var(--accent); }
select { border: 1.5px solid var(--line); border-radius: 12px; padding: 8px; background: var(--card-2); color: var(--ink); }

main { flex: 1; max-width: 1080px; width: 100%; margin: 24px auto 60px; padding: 0 20px; }

/* 页脚备案号：刻意做得非常克制，滚到底部才注意到 */
.site-footer {
  text-align: center; font-size: 11px; color: var(--muted); opacity: .62;
  padding: 2px 16px 20px; line-height: 1.6; user-select: none;
  transition: opacity .2s;
}
.site-footer:hover { opacity: .85; }
.site-footer[hidden] { display: none; }
.site-footer a { color: inherit; text-decoration: none; }
.site-footer a:hover { color: var(--accent-deep); text-decoration: underline; }

/* ---------- 卡片 ---------- */
.card {
  background: var(--card); border-radius: var(--radius);
  box-shadow: 0 4px 20px var(--shade-1); padding: 24px;
}
.auth-box { max-width: 380px; margin: 70px auto; }
.auth-box h2 { margin-bottom: 4px; }
.auth-box .sub { margin-bottom: 18px; }
.auth-box form { display: flex; flex-direction: column; gap: 12px; }
.error { color: #e5484d; font-size: 13px; min-height: 18px; }

/* 登录/注册切换 */
.auth-tabs { display: flex; gap: 6px; margin-bottom: 14px; background: var(--chip); border-radius: 12px; padding: 4px; }
.auth-tabs .at { flex: 1; background: transparent; box-shadow: none; color: var(--muted); font-weight: 600; }
.auth-tabs .at.active { background: var(--card); color: var(--accent-deep); box-shadow: 0 2px 6px var(--tint-weak); }
.pw-wrap { display: flex; flex-direction: column; gap: 6px; }
.pw-meter { height: 5px; background: var(--line); border-radius: 999px; overflow: hidden; }
.pw-meter i { display: block; width: 0; height: 100%; border-radius: 999px; transition: all .2s; }
.pw-meter i.w { width: 33%; background: #e5484d; }
.pw-meter i.m { width: 66%; background: #f0a93f; }
.pw-meter i.s { width: 100%; background: #1a7f37; }
.link-btn { align-self: flex-end; background: transparent; box-shadow: none; color: var(--accent-deep); font-size: 13px; padding: 2px 8px; }
.link-btn:hover { text-decoration: underline; transform: none; }
.fg-result input { margin: 6px 0; }
.fg-result a.primary { display: inline-block; text-decoration: none; color: #fff; padding: 7px 16px; border-radius: 999px; }

/* ---------- 首页 ---------- */
.section { margin-bottom: 34px; }
.section-title { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.section-title h2 { font-size: 19px; }
.section-title .line { flex: 1; height: 2px; background: var(--line); border-radius: 2px; }
.home-action-short { display: none; }
.open-all-links { flex-shrink: 0; white-space: nowrap; }
/* 首页排列方式快捷切换 */
.layout-switch { display: flex; gap: 2px; background: var(--chip); border-radius: 999px; padding: 3px; }
.layout-switch button { background: transparent; box-shadow: none; padding: 4px 10px; border-radius: 999px; font-size: 14px; color: var(--muted); }
.layout-switch button:hover { transform: none; box-shadow: none; background: var(--soft-2); }
.layout-switch button.on { background: var(--card); color: var(--interactive); box-shadow: 0 1px 4px var(--shade-1); }

.folder-block { margin-bottom: 10px; }
.folder-head {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 14px; border-radius: 14px 14px 0 0;
  background: linear-gradient(135deg, var(--hover), var(--soft));
  border: 1.5px solid var(--line); border-bottom: none;
  cursor: pointer; transition: background .15s;
}
.folder-head:hover { background: linear-gradient(135deg, var(--hover-2), var(--hover)); }
/* 折叠箭头：固定 14px 方框居中，避免字形自带留白把后面的图标推远 */
.folder-head .fb-chev {
  width: 14px; height: 20px; flex: 0 0 14px; overflow: hidden;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 10px; line-height: 1; color: var(--muted);
}
.folder-head .f-icon { display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; font-size: 16px; line-height: 1; }
.folder-head .f-name { font-weight: 700; font-size: 14.5px; line-height: 20px; }
.folder-head .f-count { display: inline-flex; align-items: center; justify-content: center; height: 16px; font-size: 11px; line-height: 1; color: var(--muted); background: var(--card); border-radius: 999px; padding: 0 7px; }
.folder-head .fb-open { margin-left: auto; }
/* 收起时在标题栏里显示前几个图标，展开状态才显示描述 */
.folder-head .fb-mini { display: flex; align-items: center; align-self: center; gap: 5px; height: 20px; overflow: hidden; flex: 1; min-width: 0; line-height: 1; opacity: .9; }
/* 图标外层也居中，消除内联图片的基线留白；图片失败换成字块时保持相同尺寸。 */
.folder-head .fb-mini > span { display: grid; place-items: center; align-self: center; width: 17px; height: 17px; flex: 0 0 17px; line-height: 0; }
.folder-head .fb-mini .ico, .folder-head .fb-mini .glyph { width: 17px; height: 17px; font-size: 12px; line-height: 1; border-radius: 5px; }
.folder-head .fb-mini img { display: block; width: 17px; height: 17px; margin: 0; align-self: center; justify-self: center; object-fit: contain; border-radius: 5px; }
.folder-head .f-desc { color: var(--muted); font-size: 12px; line-height: 20px; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.section-title .expand-all { margin-right: 4px; white-space: nowrap; align-self: center; }

/* 展开/收起：用 grid-template-rows 0fr→1fr 做高度动画，不需要整页重绘 */
.fb-body { display: grid; grid-template-rows: 1fr; transition: grid-template-rows .24s ease, opacity .18s ease; opacity: 1; }
.fb-body > .fb-inner { overflow: hidden; min-height: 0; }
.folder-block[data-open="0"] .fb-body { grid-template-rows: 0fr; opacity: 0; }
.folder-block[data-open="0"] .folder-block { border-bottom: 1.5px solid var(--line); border-radius: 14px; }
.folder-block[data-open="0"] .folder-head { border-bottom: 1.5px solid var(--line); border-radius: 14px; }
.folder-block .grid {
  border: 1.5px solid var(--line); border-top: none;
  border-radius: 0 0 14px 14px; padding: 16px; background: color-mix(in srgb, var(--card) 96%, transparent);
}
/* 未分组：不套外框的平铺内容，靠 .none-block 只负责上下间距（详见 app.js folderBlockHtml 的注释）
   ⚠️ 这条必须放在 .folder-block .grid 之后、并用两级类名提高优先级，
      否则同等优先级下会被上面的规则覆盖，框和圆角又冒出来（别删）。 */
.folder-block.none-block { margin-bottom: 10px; }
.folder-block.none-block .grid,
.folder-block.none-block .grid.icon-mode,
.folder-block.none-block .grid.list-mode {
  border: none; border-radius: 0; background: transparent; padding: 0;
}

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.link-card {
  background: var(--card); border: 1.5px solid var(--line); border-radius: 14px;
  padding: 13px 15px; cursor: pointer; transition: all .15s;
  display: flex; flex-direction: column; gap: 5px; position: relative;
}
.link-card:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: 0 6px 16px var(--tint-weak); }
.link-card .t { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.link-card .t img { width: 16px; height: 16px; border-radius: 4px; vertical-align: -3px; margin-right: 5px; }
.link-card .u { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.link-card.disabled { opacity: .45; }
.link-card.disabled::after { content: '已禁用'; position: absolute; top: 6px; right: 8px; font-size: 10px; color: var(--muted); }
.link-card .t img { width: 16px; height: 16px; }
/* 无名称的链接：只显示图标 */
.link-card .t .ico, .link-card .t img { flex-shrink: 0; }

/* ---- 排列方式②：图标宫格 ---- */
.grid.icon-mode { grid-template-columns: repeat(auto-fill, minmax(98px, 1fr)); gap: 10px; }
.icon-tile {
  background: var(--card); border: 1.5px solid var(--line); border-radius: 14px;
  padding: 14px 8px; cursor: pointer; transition: all .15s; position: relative;
  display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center;
}
.icon-tile:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: 0 6px 16px var(--tint-weak); }
.icon-tile .it-img { width: 40px; height: 40px; display: flex; align-items: center; justify-content: center; font-size: 30px; }
.icon-tile .it-img img { width: 40px; height: 40px; border-radius: 10px; object-fit: cover; }
.icon-tile .it-name { font-size: 12px; font-weight: 600; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.icon-tile .it-name .fav-mark { font-size: 10px; }
.icon-tile.no-name { padding: 18px 8px; }
.icon-tile.no-name .it-img { width: 46px; height: 46px; font-size: 36px; }
.icon-tile.no-name .it-img img { width: 46px; height: 46px; }
.icon-tile.disabled { opacity: .45; }

/* ---- 排列方式③：列式表格 ---- */
.grid.list-mode { display: block; }
.folder-block .grid.list-mode { padding: 0; background: transparent; border: none; }
.link-table { width: 100%; border-collapse: separate; border-spacing: 0; background: var(--card);
  border: 1.5px solid var(--line); border-radius: 14px; overflow: hidden; table-layout: fixed; }
.link-table th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600;
  padding: 9px 14px; background: var(--soft); }
.link-table td { padding: 9px 14px; border-top: 1.5px solid var(--line); font-size: 13.5px; }
.link-table tbody tr { cursor: pointer; }
.link-table tbody tr:hover td { background: var(--soft); }
.link-table .lt-name { display: flex; align-items: center; gap: 7px; font-weight: 600; }
.link-table .lt-name > :not(.lt-title) { flex-shrink: 0; }
.link-table .lt-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.link-table .lt-name img { width: 16px; height: 16px; border-radius: 4px; }
.link-table .lt-url { color: var(--muted); font-size: 12px; max-width: 420px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.link-table tr.disabled td { opacity: .5; }

/* ---------- 管理页 ---------- */
.admin-layout { display: flex; gap: 18px; align-items: flex-start; }
.side {
  width: 240px; flex-shrink: 0; background: var(--card);
  border-radius: var(--radius); box-shadow: 0 4px 20px var(--shade-1); padding: 16px;
}
.side h3 { font-size: 14px; margin-bottom: 10px; color: var(--muted); }
.directory-toggle { display: none; }
.tree-item {
  display: grid; grid-template-columns: 20px minmax(0, 1fr) auto auto;
  align-items: center; gap: 6px; min-width: 0; min-height: 36px; padding: 6px 10px;
  border-radius: 10px; cursor: pointer; font-size: 14px; margin-bottom: 2px;
  user-select: none;
}
.tree-item .ti-icon { grid-column: 1; grid-row: 1; font-size: 15px; }
.tree-item .ti-name { grid-column: 2; grid-row: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tree-item:hover { background: var(--hover); }
.tree-item.active { background: color-mix(in srgb, var(--interactive) 12%, var(--card)); font-weight: 700; }
.tree-item .cnt { grid-column: 4; grid-row: 1; color: var(--muted); font-size: 12px; }
/* 每个目录只保留一个更多入口，菜单浮出显示，不占目录行的高度。 */
.tree-item .folder-actions { grid-column: 3; grid-row: 1; }
.tree-item .folder-more {
  display: flex; align-items: center; justify-content: center;
  width: 24px; height: 24px; padding: 0; background: transparent;
  color: var(--ink); font-size: 20px; line-height: 1; box-shadow: none;
}
.tree-item .folder-more:hover, .tree-item .folder-more[aria-expanded=true] {
  background: color-mix(in srgb, var(--interactive) 12%, var(--card));
  color: var(--interactive); transform: none;
}
.folder-action-menu {
  position: fixed; z-index: 12; width: 176px; max-width: calc(100vw - 16px);
  max-height: calc(100vh - 16px); overflow-y: auto; padding: 6px;
  background: var(--card); color: var(--ink); border: 1px solid var(--line);
  border-radius: 12px; box-shadow: 0 8px 24px var(--shade-2);
}
.folder-action-menu button {
  display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 8px 10px; border-radius: 7px; text-align: left;
  font-size: 13px; box-shadow: none; background: transparent;
}
.folder-action-menu button:hover, .folder-action-menu button:focus-visible {
  background: color-mix(in srgb, var(--interactive) 10%, var(--card));
  transform: none; box-shadow: none;
}
.folder-action-menu button.danger { color: #b42318; }
.folder-action-menu button.danger:hover, .folder-action-menu button.danger:focus-visible { background: #fee4e2; }
/* 停用目录：置灰 + 名字加删除线 */
.tree-item.off { opacity: .55; }
.tree-item.off .ti-name { text-decoration: line-through; }
.tree-item.off .ti-icon { filter: grayscale(1); }
/* 目录弹窗内「启用」一行 */
.fld-row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 12px 0; }
.side .block { margin-top: 10px; }

/* 收藏标记 / 打开次数 / 无图标占位 */
.fav-mark { color: var(--accent-deep); font-size: 12px; }
.ico { display: inline-flex; width: 16px; height: 16px; align-items: center; justify-content: center; font-size: 13px; opacity: .85; }
/* 无图标时的彩色首字母块（站点 favicon 也加载失败时用它兜底，不会留白） */
.glyph {
  display: inline-flex; width: 16px; height: 16px; border-radius: 5px; flex-shrink: 0;
  align-items: center; justify-content: center; font-size: 10px; font-weight: 800; color: #fff;
  background: linear-gradient(135deg, hsl(var(--h, 24) 68% 62%), hsl(var(--h, 24) 62% 48%));
  text-transform: uppercase; letter-spacing: .2px; user-select: none;
}
.glyph.big { width: 42px; height: 42px; border-radius: 12px; font-size: 21px; }
.icon-tile.no-name .glyph.big { width: 48px; height: 48px; }
.icon-tile .it-img .ico { width: 42px; height: 42px; font-size: 30px; }
.icon-tile.no-name .it-img .ico { width: 48px; height: 48px; font-size: 36px; }
.open-cnt { font-size: 12px; color: var(--muted); min-width: 28px; text-align: center; padding: 2px 6px; background: var(--chip); border-radius: 999px; }

.content { flex: 1; min-width: 0; }

/* ---------- 管理页：快速添加卡片 ---------- */
.add-card {
  background: var(--card); border: 1.5px solid var(--line); border-radius: 16px;
  padding: 14px 16px 12px; box-shadow: 0 4px 18px var(--shade-1); margin-bottom: 12px;
}
.ac-row { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.ac-field { display: flex; flex-direction: column; gap: 5px; width: 200px; }
.ac-field.grow { flex: 1; min-width: 240px; }
.ac-label { font-size: 11.5px; font-weight: 700; color: var(--muted); letter-spacing: .4px; }
.ac-field input { border-radius: 12px; background: var(--card-2); padding: 9px 13px; font-size: 14px;
  border: 1.5px solid var(--line); transition: border-color .15s, box-shadow .15s, background .15s; }
.ac-field input::placeholder { color: var(--muted); opacity: .72; }
.ac-field input:focus { outline: none; border-color: var(--accent-deep); box-shadow: 0 0 0 4px var(--tint-weak); background: var(--card); }
.ac-btn { height: 39px; padding: 0 18px; border-radius: 12px; white-space: nowrap; }
.ac-foot { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: 11px;
  padding-top: 10px; border-top: 1.5px dashed var(--line); }
.ac-tip { font-size: 11.5px; color: var(--muted); }
.mg-tip { font-size: 12px; margin: 0 2px 12px; line-height: 1.7; color: var(--muted); }
/* 勾选框统一尺寸（避免被 input 的 width:100% 撑开） */
.switch input[type=checkbox] { width: 16px; height: 16px; padding: 0; flex-shrink: 0; accent-color: var(--accent-deep); }

/* ---------- 系统分组（收藏 / 常用）提示 ---------- */
.sys-note { display: flex; gap: 12px; align-items: flex-start; background: var(--soft);
  border: 1.5px dashed var(--chip-line); border-radius: 16px; padding: 16px; margin-bottom: 12px; }
.sys-note .sn-icon { font-size: 22px; line-height: 1.2; }
.sys-note .sn-title { font-weight: 700; font-size: 14px; }
.sys-note .sn-desc { font-size: 12.5px; color: var(--muted); margin-top: 3px; line-height: 1.6; }

.manage-list { display: flex; flex-direction: column; gap: 8px; }
.manage-item {
  display: flex; align-items: center; gap: 12px; background: var(--card);
  border: 1.5px solid var(--line); border-radius: 14px; padding: 10px 14px;
}
.manage-item .drag { cursor: grab; color: var(--sw-track); user-select: none; font-size: 16px; }
.manage-item .info { flex: 1; min-width: 0; }
.manage-item .info .t { font-weight: 600; font-size: 14px; overflow-wrap: anywhere; }
.item-actions { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.manage-item .info .t img { width: 15px; height: 15px; border-radius: 4px; vertical-align: -2px; margin-right: 5px; }
.manage-item .info .u { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.manage-item.off { opacity: .5; }
.manage-item.dragover { border-color: var(--accent); background: var(--soft-2); }
.switch { display: flex; align-items: center; gap: 4px; font-size: 12px; color: var(--muted); cursor: pointer; white-space: nowrap; }

/* 设置开关 */
.switch-row { display: flex; align-items: center; justify-content: space-between; font-weight: 600; }
.switch-row input[type=checkbox] { width: 18px; height: 18px; }

/* 目录树拖放高亮：上/下边缘=同级插入，中间=成为子目录 */
.tree-item.dragover { border: 1.5px dashed var(--accent); background: var(--soft-2); }
.tree-item.drop-before { box-shadow: inset 0 3px 0 var(--accent-deep); }
.tree-item.drop-after { box-shadow: inset 0 -3px 0 var(--accent-deep); }
.tree-item.drop-child { outline: 2px dashed var(--accent-deep); outline-offset: -2px; background: var(--soft-2); }
/* 系统分组（收藏 / 常用）节点 */
.tree-item.sys { background: color-mix(in srgb, var(--accent-deep) 5%, transparent); }
.tree-item.sys .ti-name { font-size: 13px; }
.tree-item .sys-tag { grid-column: 3; grid-row: 1; font-size: 10px; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 0 5px; }

/* ---------- 站点信息页 ---------- */
.site-card { padding-bottom: 18px; }
.site-preview { margin-bottom: 18px; }
.sp-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.sp-title { font-size: 12px; color: var(--muted); }
.sp-tag { font-size: 10px; color: var(--accent-deep); background: var(--chip); border-radius: 999px; padding: 1px 8px; }
.sp-bar {
  display: flex; align-items: center; gap: 10px; padding: 10px 14px;
  background: var(--header-bg); border: 1.5px solid var(--line); border-bottom-width: 2px; border-radius: 14px;
}
.sp-logo { width: 34px; height: 34px; flex-shrink: 0; }
.sp-logo img { width: 34px; height: 34px; border-radius: 10px; }
.sp-name { font-size: 17px; font-weight: 800; letter-spacing: 1px; }
.sp-nav { display: flex; gap: 6px; margin-left: 6px; }
.sp-nav i { font-style: normal; font-size: 12px; color: var(--muted); background: var(--soft);
  border-radius: 999px; padding: 3px 10px; }
.sp-user { margin-left: auto; display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.sp-avatar { width: 24px; height: 24px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--accent), var(--accent-deep)); color: #fff; font-size: 12px; font-weight: 700; }
.site-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr)); gap: 16px; }
.site-field, .pc-block { min-width: 0; }
.site-field { background: var(--soft); border: 1.5px solid var(--line); border-radius: 14px; padding: 14px; }
.sf-label { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; margin-bottom: 8px; }
.sf-desc { font-size: 11.5px; color: var(--muted); margin-top: 8px; line-height: 1.6; }
.sf-actions { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.site-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 18px; flex-wrap: wrap; }
/* 个人设置里的「打开最多的链接」 */
.top-used { margin-top: 14px; border-top: 1.5px dashed var(--line); padding-top: 12px; }
.top-used .tu-title { font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.top-used .tu-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 6px 8px; border-radius: 8px; font-size: 13px; }
.top-used .tu-row:hover { background: var(--soft); }
.top-used .tu-row span { display: flex; align-items: center; gap: 7px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top-used .tu-row b { flex-shrink: 0; font-size: 12px; color: var(--accent-deep); background: var(--chip); border-radius: 999px; padding: 1px 9px; }

/* ---------- 个人设置：页签 + 紧凑行 ---------- */
.pref-tip { font-size: 12px; margin: 0 2px 12px; }
.pref-card { padding: 4px 20px 16px; }
.pref-card + .pref-card { margin-top: 16px; }
.pref-card .setting-item { padding: 12px 2px; }
.pref-card .setting-item.last { border-bottom: none; }
.pref-card .si-icon { font-size: 18px; width: 32px; }
.pref-card .si-title { font-size: 14px; }
.pref-card .si-desc { font-size: 11.5px; }
/* 自定义配色折叠区 */
.theme-more { margin-top: 12px; }
.theme-more summary { cursor: pointer; font-size: 12.5px; color: var(--muted); padding: 6px 10px;
  border: 1.5px dashed var(--line); border-radius: 10px; list-style: none; user-select: none; }
.theme-more summary::-webkit-details-marker { display: none; }
.theme-more summary::before { content: '🎨 '; }
.theme-more summary:hover { color: var(--accent-deep); border-color: var(--accent); }
.theme-more[open] summary { margin-bottom: 10px; }
.pref-card .my-stats { margin-top: 14px; }

/* 链接自定义图标编辑行 */
.icon-edit { display: flex; align-items: center; gap: 6px; }
.icon-edit .ie-prev { width: 34px; height: 34px; flex-shrink: 0; display: flex; align-items: center; justify-content: center;
  border: 1.5px solid var(--line); border-radius: 9px; background: var(--card-2); font-size: 18px; }
.icon-edit .ie-prev img { width: 22px; height: 22px; border-radius: 5px; }
.icon-edit input[type=text], .icon-edit input:not([type]) { flex: 1; min-width: 0; }
.icon-edit .ie-upload { display: inline-flex; align-items: center; cursor: pointer; white-space: nowrap; }

/* ---------- 主题选择器 ---------- */
.theme-grid { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 4px; }
.theme-card { width: 108px; border: 2px solid var(--line); border-radius: 14px; padding: 8px; cursor: pointer; background: var(--card); transition: all .15s; }
.theme-card:hover { transform: translateY(-2px); }
.theme-card.sel { border-color: var(--interactive); box-shadow: 0 0 0 3px color-mix(in srgb, var(--interactive) 16%, transparent); }
.theme-card .tc-prev { height: 44px; border-radius: 9px; display: flex; align-items: center; justify-content: center; gap: 5px; }
.theme-card .tc-dot { width: 15px; height: 15px; border-radius: 50%; box-shadow: 0 1px 3px var(--shade-2); }
.theme-card .tc-name { font-size: 12px; text-align: center; margin-top: 6px; color: var(--ink); }
.theme-custom { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin-top: 12px; }
.theme-custom .fld-label { margin-bottom: 4px; }
.theme-custom input[type=color] { width: 100%; height: 34px; padding: 2px 3px; border: 1.5px solid var(--line); border-radius: 10px; background: var(--card); cursor: pointer; }
.theme-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
/* 用户表格里「你」的小徽章 */
.me-badge { font-size: 10px; color: var(--accent-deep); background: var(--chip); border-radius: 999px; padding: 0 6px; margin-left: 5px; vertical-align: 1px; }

/* 通知铃铛 + 下拉 */
.bell {
  position: relative; cursor: pointer; font-size: 17px; user-select: none;
  padding: 5px 9px; border-radius: 999px; margin-left: auto;
  transition: background .15s, transform .15s;
}
.bell:hover { background: var(--chip); transform: translateY(-1px); }
.bell:active { transform: translateY(0); }
.bell .bell-cnt {
  position: absolute; top: -3px; right: -3px; background: #e5484d; color: #fff;
  font-size: 10px; border-radius: 999px; padding: 0 5px; min-width: 16px; text-align: center;
  box-shadow: 0 0 0 2px var(--card); font-weight: 700;
}
.bell.has-unread { animation: bellShake 2.6s ease-in-out infinite; }
/* 未登录时的「登录 / 注册」属于账号操作，排在右侧 */
.user-right { margin-left: auto; }
.bell .bell-dot { position: absolute; top: 4px; right: 6px; width: 8px; height: 8px; border-radius: 50%; background: #e5484d; box-shadow: 0 0 0 2px var(--card); }
@keyframes bellShake {
  0%, 82%, 100% { transform: rotate(0); }
  85% { transform: rotate(11deg); }
  88% { transform: rotate(-9deg); }
  91% { transform: rotate(7deg); }
  94% { transform: rotate(-4deg); }
}
.notif-box {
  position: fixed; top: 58px; right: 18px; width: 348px; max-width: 90vw; max-height: 70vh; overflow: auto;
  z-index: 20; padding: 6px 12px 10px; box-shadow: 0 16px 46px var(--shade-3);
  animation: nbIn .16s ease-out;
}
@keyframes nbIn { from { opacity: 0; transform: translateY(-8px) scale(.98); } to { opacity: 1; transform: none; } }
.notif-box .nb-head { display: flex; justify-content: space-between; align-items: center; padding: 8px 0 6px; position: sticky; top: 0; background: var(--card); z-index: 1; }
.notif-box .nb-unread { font-size: 11px; color: var(--accent-deep); background: var(--chip); border-radius: 999px; padding: 1px 8px; margin-left: 4px; }
.notif-box .nb-actions { display: flex; gap: 4px; }
.notif-box button[disabled] { opacity: .45; }
.notif-box .nb-item { padding: 10px; border-bottom: 1.5px solid var(--line); border-radius: 10px; transition: background .15s; }
.notif-box .nb-item:hover { background: var(--soft); }
.notif-box .nb-item.unread { background: var(--soft); cursor: pointer; }
.notif-box .nb-title { font-weight: 600; font-size: 13px; }
.notif-box .nb-title .dot { color: var(--accent-deep); }
.notif-box .nb-body { font-size: 12px; color: var(--muted); margin: 4px 0; line-height: 1.6; }
.notif-box .nb-meta { display: flex; justify-content: space-between; align-items: center; }
.notif-box .nb-foot { padding-top: 8px; text-align: right; }

/* 自定义确认弹窗 */
.confirm-card { width: 360px; max-width: 92vw; }
.confirm-card .confirm-msg { font-size: 14px; line-height: 1.6; margin: 6px 0 10px; }

/* 密码字段 + 小眼睛 */
.pw-field { position: relative; }
.pw-field input { padding-right: 38px; }
.pw-field .eye { position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  background: transparent; box-shadow: none; padding: 4px 8px; font-size: 15px; cursor: pointer; }
.pw-field .eye:hover { background: var(--soft-2); }

/* 个人中心 */
.profile-card { padding: 22px; }
.profile-top { display: flex; gap: 18px; align-items: center; margin-bottom: 20px; }
.avatar-lg { border: 4px solid var(--card); border-radius: 50%; box-shadow: 0 6px 18px var(--tint); flex-shrink: 0; background: linear-gradient(135deg, var(--accent), var(--accent-deep)); }
.avatar-lg img, .avatar-lg span { width: 84px; height: 84px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 36px; font-weight: 800; color: #fff; object-fit: cover; }
.profile-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.pc-block { display: flex; flex-direction: column; gap: 8px; }
.pc-block h3 { margin-bottom: 4px; }

/* 单元格保留表格布局，头像和文字只在内部容器中横向排列。 */
table.users .u-cell { display: flex; align-items: center; gap: 10px; }
table.users .u-av { flex-shrink: 0; }
table.users .u-av img, table.users .u-av span { width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 800; color: #fff; background: linear-gradient(135deg, var(--accent), var(--accent-deep)); object-fit: cover; }

@media (max-width: 720px) {
  .profile-grid { grid-template-columns: 1fr; }
  .notif-box { right: 8px; }
}

/* 系统管理：页签 + 设置卡 + 统计卡 */
.admin-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.admin-head h2 { font-size: 20px; }
.admin-tabs { display: flex; gap: 4px; background: var(--chip); border-radius: 14px; padding: 4px; flex-wrap: wrap; }
.atab { background: transparent; box-shadow: none; color: var(--muted); font-weight: 600; padding: 7px 16px; }
.atab.active { background: var(--card); color: var(--accent-deep); box-shadow: 0 2px 6px var(--tint-weak); }
.admin-body { min-height: 200px; }

.setting-item { display: flex; align-items: center; gap: 14px; padding: 16px 4px; border-bottom: 1.5px solid var(--line); }
.setting-item:last-child { border-bottom: none; }
.setting-item.disabled { opacity: .5; }
.si-icon { font-size: 22px; width: 40px; text-align: center; flex-shrink: 0; }
.si-text { flex: 1; min-width: 0; }
.si-title { font-weight: 700; font-size: 15px; }
.si-desc { font-size: 12px; color: var(--muted); margin-top: 2px; line-height: 1.5; }
/* 需要整块布局的设置项（如排列方式选择） */
.setting-item.col { display: block; padding: 14px 4px; }
.setting-item.col .si-head { display: flex; gap: 14px; align-items: flex-start; }
.setting-item.col .si-head .si-text { margin-bottom: 10px; }
.seg-row { display: flex; gap: 8px; flex-wrap: wrap; }
.seg { background: var(--card-2); border: 1.5px solid var(--line); color: var(--ink); font-weight: 600; }
.seg:hover { transform: none; }
.seg.on { background: var(--accent-deep); border-color: var(--accent-deep); color: #fff; }

/* 自定义开关 */
.toggle { position: relative; display: inline-block; width: 44px; height: 24px; flex-shrink: 0; cursor: pointer; }
.toggle input { opacity: 0; width: 0; height: 0; position: absolute; }
.toggle .ts { position: absolute; inset: 0; background: var(--sw-track); border-radius: 999px; transition: .2s; }
.toggle .ts::before { content: ''; position: absolute; width: 18px; height: 18px; left: 3px; top: 3px; background: var(--card); border-radius: 50%; transition: .2s; box-shadow: 0 1px 3px #0003; }
.toggle input:checked + .ts { background: linear-gradient(135deg, var(--accent), var(--accent-deep)); }
.toggle input:checked + .ts::before { transform: translateX(20px); }

.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
.stat-card { background: var(--card); border: 1.5px solid var(--line); border-radius: 16px; padding: 20px; text-align: center; box-shadow: 0 4px 14px var(--shade-1); }
.stat-card .sc-icon { font-size: 26px; }
.stat-card .sc-val { font-size: 30px; font-weight: 800; color: var(--accent-deep); margin: 4px 0; }
.stat-card .sc-title { font-size: 13px; color: var(--muted); }

/* 个人中心 hero */
.profile-hero { position: relative; overflow: hidden; padding: 0; margin-bottom: 18px; }
.profile-hero::before { content: ''; display: block; height: 64px; background: linear-gradient(120deg, var(--hero-a), var(--hero-b) 55%, var(--hero-c)); }
.ph-row { display: flex; align-items: flex-end; gap: 18px; padding: 0 24px 20px; margin-top: -34px; }
.ph-info { flex: 1; min-width: 0; padding-bottom: 4px; }
/* 层次：第一行 昵称(大) + 徽章；第二行 @用户名(小灰)；第三行 标签胶囊 */
.ph-line1 { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ph-nick { font-size: 24px; font-weight: 800; letter-spacing: .5px; }
.ph-at { color: var(--muted); font-weight: 600; font-size: 14px; margin: 2px 0 8px; }
.ph-tags { display: flex; flex-wrap: wrap; gap: 8px; }
.ph-tags .tag { background: var(--soft); border: 1px solid var(--chip-line); color: var(--ink); font-size: 12px; padding: 3px 10px; border-radius: 999px; }
.ph-tags .tag-dim { color: var(--muted); background: var(--soft); border-color: var(--line); }

/* 头像点击更换（hover 遮罩） */
.avatar-wrap { position: relative; cursor: pointer; border-radius: 50%; flex-shrink: 0; }
.avatar-wrap .av-overlay {
  position: absolute; inset: 0; border-radius: 50%;
  background: var(--shade-5); color: #fff; font-size: 13px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: opacity .18s;
}
.avatar-wrap:hover .av-overlay { opacity: 1; }

/* 头像裁剪器 */
.crop-card { width: 320px; }
.crop-stage { position: relative; width: 220px; height: 220px; overflow: hidden; background: #2a241f; border-radius: 14px; margin: 10px auto; cursor: grab; touch-action: none; }
.crop-stage:active { cursor: grabbing; }
.crop-stage img { position: absolute; user-select: none; -webkit-user-drag: none; transform-origin: 0 0; }
.crop-card input[type=range] { width: 100%; }

.my-stats { display: flex; gap: 10px; }
.ms-tile { flex: 1; background: var(--soft); border-radius: 12px; padding: 12px; text-align: center; }
.ms-v { font-size: 26px; font-weight: 800; color: var(--accent-deep); }
.ms-l { font-size: 11px; color: var(--muted); }

@media (max-width: 720px) {
  .ph-row { flex-direction: column; align-items: center; text-align: center; }
  .ph-name, .ph-tags, .ph-actions { justify-content: center; }
}

/* 重置申请跟踪页 */
.track-card { max-width: 460px; margin: 60px auto; text-align: center; padding: 30px 34px; }
.track-logo { width: 72px; height: 72px; border-radius: 20px; box-shadow: 0 6px 16px var(--tint); margin-bottom: 8px; }
.stepper { display: flex; align-items: flex-start; justify-content: center; margin: 18px 0 20px; }
.step { display: flex; flex-direction: column; align-items: center; gap: 5px; min-width: 74px; }
.step i { width: 30px; height: 30px; border-radius: 50%; background: var(--line); color: #a89788; font-style: normal; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; transition: all .3s; }
.step span { font-size: 12px; color: var(--muted); }
.step.active i { background: linear-gradient(135deg, var(--accent), var(--accent-deep)); color: #fff; box-shadow: 0 0 0 4px var(--tint-weak); }
.step.active span { color: var(--accent-deep); font-weight: 700; }
.step.done i { background: #1a7f37; color: #fff; }
.step.done span { color: #1a7f37; }
.s-line { width: 44px; height: 2.5px; background: var(--line); border-radius: 2px; margin: 14px 2px 0; }
.track-state { padding: 14px 10px 4px; }
.track-state .ts-icon { font-size: 36px; display: inline-block; }
.track-state .ts-icon.spin { animation: slowspin 1.8s linear infinite; }
@keyframes slowspin { to { transform: rotate(360deg); } }
.track-state .ts-title { font-size: 17px; font-weight: 800; margin: 6px 0; }
.track-state .ts-desc { font-size: 13px; color: var(--muted); line-height: 1.6; margin-bottom: 12px; }
.track-state.ok .ts-title { color: #1a7f37; }
.track-state.bad .ts-title { color: #e5484d; }

/* 铃铛下拉底部入口 */
.nb-foot { border-top: 1.5px solid var(--line); margin-top: 8px; padding: 8px 0 2px; text-align: center; }

/* 通知中心 */
.notif-center .nc-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.notif-center .nc-head h2 { font-size: 20px; }
.nc-toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.nc-toolbar select { width: auto; }
.nc-list .nc-item { background: var(--card); border: 1.5px solid var(--line); border-radius: 14px; padding: 14px 16px; margin-bottom: 10px; }
.nc-list .nc-item.unread { border-color: var(--accent); background: var(--soft); }
.nc-item .nc-title { font-weight: 700; font-size: 14px; }
.nc-item .nc-title .dot { color: var(--accent-deep); }
.nc-item .nc-type { font-size: 11px; color: var(--muted); background: var(--soft-2); padding: 1px 8px; border-radius: 999px; margin-left: 6px; font-weight: 400; }
.nc-item .nc-body { font-size: 13px; color: var(--muted); margin: 6px 0; line-height: 1.5; }
.nc-item .nc-meta { display: flex; justify-content: space-between; align-items: center; }
.nc-actions { display: flex; gap: 6px; }
.req-row { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; border-bottom: 1.5px solid var(--line); }
.req-row:last-child { border-bottom: none; }

.mute-list { display: flex; flex-direction: column; gap: 8px; max-height: 280px; overflow: auto; }

/* 状态消息 */
.ok-msg { color: #1a7f37; font-weight: 700; font-size: 16px; }
.err-msg { color: #e5484d; font-weight: 700; font-size: 16px; }

/* ---------- 全局交互动效 ---------- */
@keyframes fadeUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
#app > * { animation: fadeUp .28s ease both; }

button:active { transform: translateY(0) scale(.96); }

/* 铃铛有未读时摇摆 */
.bell.has-unread { animation: ring 2.6s ease-in-out infinite; transform-origin: 50% 4px; }
@keyframes ring {
  0%, 78%, 100% { transform: rotate(0); }
  82% { transform: rotate(14deg); }
  87% { transform: rotate(-11deg); }
  92% { transform: rotate(7deg); }
  96% { transform: rotate(-4deg); }
}

/* 卡片悬浮反馈 */
.stat-card, .nc-item, .manage-item, .tree-item { transition: transform .15s, box-shadow .15s, background .15s, border-color .15s; }
.stat-card:hover { transform: translateY(-3px); box-shadow: 0 8px 22px var(--tint-weak); border-color: var(--accent); }
.nc-item:hover { border-color: var(--accent); }

/* ---------- 用户管理 ---------- */
table.users { width: 100%; border-collapse: collapse; }
table.users { table-layout: fixed; }
table.users th:first-child { width: 20%; }
table.users th:last-child { width: 28%; }
table.users th, table.users td { overflow-wrap: anywhere; }
table.users .u-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
table.users .u-actions button { white-space: nowrap; }
table.users .u-cell { min-width: 0; }
table.users .u-cell > :last-child { min-width: 0; }
table.users th, table.users td { text-align: left; vertical-align: middle; padding: 10px 12px; border-bottom: 1.5px solid var(--line); font-size: 14px; }
table.users th { color: var(--muted); font-size: 12px; font-weight: 600; }
.badge { display: inline-block; padding: 1px 10px; border-radius: 999px; font-size: 12px; }
.badge.on { background: #e3f7e8; color: #1a7f37; }
.badge.off { background: #ffe5e5; color: #e5484d; }

/* ---------- 编辑弹窗 ---------- */
.edit-dialog {
  position: fixed; inset: var(--dialog-top, 0px) 0 auto; height: var(--dialog-height, 100%); background: var(--shade-4); backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center; z-index: 10;
}
.edit-dialog .card { width: 400px; max-width: 92vw; max-height: min(90vh, calc(var(--dialog-height, 100vh) - 24px)); overflow-y: auto; display: flex; flex-direction: column; gap: 10px; }
.edit-dialog .folder-dialog { width: 440px; }
.edit-dialog .data-dialog { width: 680px; }
.edit-dialog .crop-card { width: 320px; }
.edit-dialog h3 { margin-bottom: 2px; }
.edit-dialog .row { display: flex; gap: 8px; justify-content: flex-end; margin-top: 4px; }
.edit-dialog label.fld-label { font-size: 12px; font-weight: 700; color: var(--muted); margin-top: 4px; }
.edit-dialog label.fld-label .muted { font-weight: 400; }
.fld-info { font-size: 12px; color: var(--muted); background: var(--soft); border-radius: 10px; padding: 8px 12px; }

/* emoji 图标选择器 */
.emoji-row { display: flex; flex-wrap: wrap; gap: 4px; max-height: 92px; overflow-y: auto; }
.emoji-opt {
  width: 32px; height: 32px; font-size: 18px; padding: 0; background: var(--card-2);
  border: 1.5px solid var(--line); box-shadow: none; border-radius: 9px;
}
.emoji-opt:hover { border-color: var(--accent); }
.emoji-opt.sel { border-color: var(--accent-deep); background: var(--soft-2); box-shadow: 0 0 0 2px var(--tint-weak); }

/* ---------- 拖放浮层（居中） ---------- */
#dropzone {
  position: fixed; inset: 0; z-index: 30;
  background: var(--shade-3); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  pointer-events: none;
}
.dz-card {
  position: relative; pointer-events: auto;
  background: var(--card); border: 3px dashed var(--accent); border-radius: 28px;
  padding: 40px 60px; text-align: center;
  box-shadow: 0 20px 60px var(--shade-2);
  animation: pop .18s ease-out;
}
.dz-card .dz-close {
  position: absolute; top: 10px; right: 14px;
  width: 30px; height: 30px; border-radius: 50%; padding: 0;
  font-size: 18px; line-height: 1; background: var(--chip); color: var(--accent-deep);
  box-shadow: 0 2px 6px var(--tint);
}
.dz-card .dz-close:hover { background: var(--hover-2); }
.dz-card img { width: 84px; height: 84px; border-radius: 22px; margin-bottom: 12px; -webkit-user-drag: none; }
.dz-main { font-size: 18px; font-weight: 700; }
.dz-sub { color: var(--muted); font-size: 13px; margin-top: 6px; }
@keyframes pop { from { transform: scale(.85); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* ---------- 提示 ---------- */
.toast {
  position: fixed; top: 20px; left: 50%; transform: translateX(-50%);
  background: #243247; color: #fff; padding: 9px 22px; border-radius: 999px;
  font-size: 13px; z-index: 40; box-shadow: 0 6px 20px #0003;
}

/* 首页保留轻量搜索入口，输入和结果集中在面板内，不占用导航内容的首行。 */
.home-search-launcher {
  position: fixed; z-index: 7; right: max(20px, calc((100vw - 1040px) / 2));
  bottom: max(24px, env(safe-area-inset-bottom)); display: flex; align-items: center; gap: 10px;
  min-height: 48px; padding: 10px 14px; border: 1px solid var(--line);
  background: var(--card); color: var(--interactive); font-weight: 600;
  box-shadow: 0 4px 18px var(--shade-2);
}
.home-search-launcher svg { width: 20px; height: 20px; }
.home-search-launcher kbd { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; border: 1px solid var(--line); border-radius: 6px; color: var(--muted); background: var(--card-2); font-family: inherit; font-size: 12px; line-height: 1; }
#app:has(.home-search-launcher) { padding-bottom: 52px; }
.home-search-dialog { padding: 24px 16px; }
.edit-dialog .home-search-card { width: 640px; max-height: calc(var(--dialog-height, 100vh) - 48px); padding: 0; gap: 0; overflow: hidden; border: 1px solid var(--line); box-shadow: 0 20px 60px var(--shade-3); }
.search-input-row { display: flex; align-items: center; gap: 12px; flex-shrink: 0; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.search-input-row:focus-within { border-bottom-color: var(--interactive); }
.search-input-row > svg { width: 22px; height: 22px; color: var(--interactive); flex-shrink: 0; }
.search-input-row input { flex: 1; min-width: 0; padding: 8px 0; border: 0; border-radius: 0; background: transparent; font-size: 18px; }
.search-input-row input:focus { outline: 0; border: 0; box-shadow: none; }
.search-input-row input::-webkit-search-cancel-button { -webkit-appearance: none; }
.search-clear, .search-close { flex-shrink: 0; min-height: 36px; box-shadow: none; border-radius: 8px; }
.search-clear { width: 32px; padding: 0; font-size: 24px; color: var(--muted); }
.search-close { padding: 6px 10px; font-size: 12px; background: var(--card-2); border: 1px solid var(--line); }
.search-clear:hover, .search-close:hover { background: var(--soft); transform: none; box-shadow: none; }
.search-results { min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 8px; }
.search-result { display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px; border-radius: 10px; background: transparent; text-align: left; box-shadow: none; }
.search-result:hover, .search-result:focus-visible { background: var(--soft); box-shadow: none; transform: none; outline-offset: -3px; }
.search-result-icon { display: flex; align-items: center; justify-content: center; width: 36px; height: 36px; flex-shrink: 0; }
.search-result-icon img, .search-result-icon .glyph, .search-result-icon .ico { width: 32px; height: 32px; border-radius: 9px; }
.search-result-icon .glyph { font-size: 16px; }
.search-result-icon .ico { font-size: 24px; }
.search-result-text { display: flex; flex-direction: column; gap: 5px; flex: 1; min-width: 0; }
.search-result-heading { display: flex; align-items: center; gap: 10px; }
.search-result-heading strong { min-width: 0; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; font-weight: 600; }
.search-result-heading > span { flex-shrink: 0; font-size: 11px; color: var(--muted); }
.search-result-address { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; color: var(--muted); }
.search-panel-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-shrink: 0; padding: 12px 18px; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); }
.search-keyboard-hint { flex-shrink: 0; font-size: 11px; }
.search-empty { padding: 36px 16px; text-align: center; line-height: 1.8; }
.search-empty > p:first-child { font-size: 14px; font-weight: 600; }

/* 中等宽度先让管理操作换区，避免目录挤压链接名称。 */
@media (max-width: 960px) {
  header { gap: 12px; padding-inline: 20px; flex-wrap: wrap; }
  nav#userbar { flex-basis: 100%; }
  .manage-item { display: grid; grid-template-columns: 20px 14px minmax(0, 1fr); gap: 8px; }
  .manage-item .info { grid-column: 3; }
  .item-actions { grid-column: 1 / -1; justify-content: flex-end; flex-wrap: wrap; padding-top: 8px; border-top: 1px solid var(--line); }
  .ac-field, .ac-field.grow { flex: 1 1 200px; width: auto; min-width: 0; max-width: 100%; }
  .ac-btn { max-width: 100%; height: auto; min-height: 40px; white-space: normal; overflow-wrap: anywhere; }
  .section-title { flex-wrap: wrap; }
  .section-title h2 { margin-right: auto; }
  .section-title .line { display: none; }
}

/* 手机端按内容排版，不靠隐藏页面溢出来遮挡控件。 */
@media (max-width: 720px) {
  body { min-height: 100dvh; }
  header { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 8px; padding: 8px 12px; }
  .brand { grid-column: 1; grid-row: 1; min-width: 0; gap: 6px; }
  .brand img { width: 32px; height: 32px; border-radius: 9px; flex-shrink: 0; }
  .brand span { min-width: 0; font-size: 16px; letter-spacing: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  nav#userbar { display: contents; }
  .nav-links { grid-column: 1 / -1; grid-row: 2; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; }
  .nav-links:has(> :last-child:nth-child(2)) { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .nav-links button { min-width: 0; padding: 8px 2px; font-size: 13px; border-radius: 10px; }
  .nav-links .nav-icon { display: none; }
  .bell { grid-column: 2; grid-row: 1; display: flex; align-items: center; justify-content: center; margin: 0; width: 40px; min-height: 44px; }
  .user-chip { grid-column: 3; grid-row: 1; min-width: 0; gap: 4px; padding: 0 3px 0 8px; box-shadow: none; }
  .user-chip .avatar, .user-chip .uc-badge { display: none; }
  .user-chip .uc-name { max-width: 64px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
  .user-chip .uc-logout { min-height: 40px; padding: 4px 8px; }
  .user-right { grid-column: 2 / -1; grid-row: 1; margin: 0; }
  main { min-width: 0; margin: 16px auto 32px; padding: 0 12px; }
  .card { padding: 16px; }
  .auth-box { margin: 28px auto; }
  button, button.small { min-height: 40px; }
  input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=color]), textarea, select, .ac-field input { font-size: 16px; min-height: 44px; min-width: 0; max-width: 100%; }
  .section { margin-bottom: 26px; }
  .section-title { gap: 8px; }
  .section-title h2 { font-size: 17px; }
  .layout-switch { margin-left: auto; flex-shrink: 0; }
  .layout-switch button { width: 36px; padding: 4px; }
  .section-title .expand-all { margin-right: 0; }
  /* 标题栏分配固定的操作宽度，短文案保持单行，不再把按钮撑成竖向胶囊。 */
  .home-section-title { display: grid; grid-template-columns: minmax(0, 1fr) auto auto auto; gap: 6px; min-height: 40px; }
  .home-section-title h2 { min-width: 0; margin: 0; font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .home-section-title .home-action-full { display: none; }
  .home-section-title .home-action-short { display: inline; }
  .home-section-title > button { display: inline-flex; align-items: center; justify-content: center; white-space: nowrap; }
  .home-section-title .layout-switch { margin: 0; }
  .home-section-title .layout-switch button { width: 32px; height: 34px; min-height: 34px; padding: 0; line-height: 1; }
  .home-section-title .expand-all { height: 40px; margin: 0; padding: 0 6px; font-size: 12px; line-height: 1; }
  .home-section-title .open-all-links { height: 40px; min-width: 42px; padding: 0 8px; font-size: 13px; line-height: 1; }
  .folder-head { padding: 8px 10px; gap: 6px; min-height: 44px; }
  .folder-head .f-name { min-width: 0; max-width: 50%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .folder-head .f-count, .folder-head .f-icon { flex-shrink: 0; }
  .folder-head .f-desc { display: none; }
  .folder-block .grid { padding: 10px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(min(150px, 100%), 1fr)); gap: 8px; }
  .link-card { min-width: 0; padding: 12px; }
  .grid.icon-mode { grid-template-columns: repeat(auto-fill, minmax(min(76px, 100%), 1fr)); gap: 8px; }
  .icon-tile { min-width: 0; padding: 12px 6px; }
  .link-table th, .link-table td { padding: 10px 8px; }
  .link-table .lt-name { gap: 5px; }
  .link-table .lt-title { white-space: normal; overflow-wrap: anywhere; }
  .link-table .lt-url { white-space: normal; overflow-wrap: anywhere; }
  .admin-layout { flex-direction: column; align-items: stretch; gap: 12px; }
  .side, .content { width: 100%; min-width: 0; }
  .side { padding: 8px 12px; }
  .directory-heading { display: none; }
  .directory-toggle { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; padding: 4px 0; text-align: left; background: transparent; box-shadow: none; }
  .directory-toggle > :first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; }
  .directory-toggle-hint { flex-shrink: 0; color: var(--interactive); font-size: 12px; }
  .directories-open .directory-chevron { display: inline-block; transform: rotate(180deg); }
  .side:not(.directories-open) #directory-panel { display: none; }
  #directory-panel { padding: 8px 0 4px; }
  #tree { max-height: 45vh; max-height: 45dvh; overflow-y: auto; overscroll-behavior: contain; }
  .tree-item { min-height: 44px; }
  .tree-item .folder-more { width: 36px; height: 36px; min-height: 36px; }
  .folder-action-menu button { min-height: 44px; }
  .add-card { padding: 12px; }
  .ac-row { flex-direction: column; align-items: stretch; }
  .ac-field, .ac-field.grow { flex: auto; width: 100%; }
  .ac-btn { width: 100%; min-height: 44px; }
  .ac-foot { gap: 8px; }
  .ac-fetch { white-space: normal; line-height: 1.5; }
  .ac-tip { display: none; }
  .navigation-tools { gap: 8px; padding: 10px; }
  .navigation-tools input[type=checkbox], .manage-item .select-link, .switch input[type=checkbox] { width: 20px; height: 20px; flex-basis: 20px; }
  .navigation-tools select { width: 100%; max-width: 100%; }
  .navigation-tools > button { flex: 1 0 auto; }
  .manage-item { padding: 10px; }
  .item-actions { justify-content: space-between; gap: 6px; }
  .item-actions .switch { min-height: 40px; }
  .item-actions button { padding-inline: 10px; }
  .sys-note { gap: 8px; padding: 12px; }
  .sys-note > div { min-width: 0; overflow-wrap: anywhere; }
  .admin-tabs { width: 100%; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .atab { padding: 8px 4px; font-size: 13px; }
  table.users, table.users tbody { display: block; }
  table.users thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  table.users tbody { display: flex; flex-direction: column; gap: 12px; }
  table.users tbody tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; }
  table.users td { min-width: 0; padding: 0; border: 0; font-size: 13px; }
  table.users td[data-label] { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
  table.users td[data-label]::before { content: attr(data-label); font-size: 11px; color: var(--muted); }
  table.users .u-identity, table.users td:nth-child(2), table.users td:nth-child(3), table.users .ops-cell { grid-column: 1 / -1; }
  table.users .switch { min-height: 36px; }
  table.users .ops-cell { padding-top: 8px; border-top: 1px solid var(--line); }
  table.users .u-actions button { flex: 1 0 auto; }
  .site-grid, .profile-grid { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .sp-bar { flex-wrap: wrap; gap: 8px; padding: 10px; }
  .sp-name { min-width: 0; max-width: 100%; overflow-wrap: anywhere; }
  .sp-nav { flex-wrap: wrap; margin: 0; }
  .sp-user { margin-left: 0; }
  .site-field { padding: 12px; }
  .pref-card { padding: 4px 12px 12px; }
  .setting-item, .setting-item.col .si-head { gap: 8px; }
  .si-desc, .sf-desc, .nc-body, .nb-body, .ph-nick, .ph-at { overflow-wrap: anywhere; }
  .theme-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .theme-card { width: 100%; min-width: 0; padding: 6px; }
  .theme-card .tc-dot { width: 12px; height: 12px; }
  .theme-custom { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .theme-custom input[type=color] { height: 44px; }
  .ph-row { padding-inline: 16px; gap: 10px; }
  .ph-info { width: 100%; }
  .ph-line1 { justify-content: center; }
  .ph-nick { font-size: 21px; }
  .my-stats { flex-wrap: wrap; gap: 6px; }
  .ms-tile { min-width: 76px; padding: 10px 6px; }
  .ms-v { font-size: 22px; }
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .stat-card { padding: 14px 8px; }
  .notif-center .nc-head, .nc-item .nc-meta, .req-row, .notif-box .nb-head, .notif-box .nb-meta { flex-wrap: wrap; gap: 8px; }
  .req-row > div { min-width: 0; overflow-wrap: anywhere; }
  .nc-actions { flex-wrap: wrap; }
  .notif-box { top: 60px; right: 12px; width: calc(100% - 24px); max-width: 400px; max-height: calc(100dvh - 80px); padding: 8px 12px; }
  .edit-dialog { padding: 12px; }
  .edit-dialog .card { max-width: 100%; max-height: calc(var(--dialog-height, 100vh) - 24px); padding: 16px; overscroll-behavior: contain; }
  .edit-dialog .row { flex-wrap: wrap; }
  .edit-dialog .row button { flex: 1; min-height: 44px; }
  .emoji-opt { width: 36px; height: 36px; min-height: 36px; }
  .fld-row-between { align-items: flex-start; }
  .fld-row-between > div { min-width: 0; }
  .icon-edit { flex-wrap: wrap; }
  .icon-edit input:not([type=file]) { flex: 1 1 140px; }
  .icon-edit .ie-upload { min-height: 40px; }
  .track-card { margin: 28px auto; padding: 20px 12px; }
  .step { min-width: 0; flex: 1; }
  .s-line { width: auto; flex: .5; }
  .trash-row { flex-wrap: wrap; gap: 8px; }
  .trash-row > div { flex: 1 1 180px; }
  .dz-card { width: calc(100% - 24px); padding: 32px 16px; }
  .toast { width: max-content; max-width: calc(100% - 24px); padding: 10px 14px; border-radius: 14px; overflow-wrap: anywhere; }
  .page-progress { top: auto; bottom: max(16px, env(safe-area-inset-bottom)); white-space: nowrap; }
  .home-search-launcher { right: 16px; bottom: max(16px, env(safe-area-inset-bottom)); gap: 8px; padding: 10px 16px; }
  .home-search-launcher kbd { display: none; }
  .home-search-dialog { padding: 12px; }
  .edit-dialog .home-search-card { max-height: calc(var(--dialog-height, 100vh) - 24px); padding: 0; }
  .search-input-row { gap: 8px; padding: 10px 12px; }
  .search-input-row > svg { width: 18px; height: 18px; }
  .search-input-row input { font-size: 16px; }
  .search-clear { width: 28px; min-width: 28px; }
  .search-close { padding: 6px 8px; }
  .search-results { padding: 6px; }
  .search-result { gap: 8px; padding: 10px 8px; }
  .search-panel-foot { padding: 10px 12px; }
  .search-keyboard-hint { display: none; }
}

@media (pointer: coarse) {
  .drag-tip, .manage-item .drag { display: none; }
  .manage-item { display: grid; grid-template-columns: 20px minmax(0, 1fr); }
  .manage-item .info { grid-column: 2; }
  .item-actions { grid-column: 1 / -1; flex-wrap: wrap; }
  .switch { min-height: 40px; }
  .avatar-wrap .av-overlay { opacity: 1; inset: auto 0 -4px; padding: 4px; border-radius: 999px; font-size: 11px; }
}
