/* =========================================================
  ctfile 网盘控制台 —— iOS 风格主题（亮/暗双主题）
  通过 <html data-theme="light|dark"> 切换
  设计语言：系统灰底、毛玻璃、大圆角、系统色、弹簧动画
  ========================================================= */

:root {
  --primary: #007aff;
  --primary-hover: #0062d6;
  --primary-2: #0a84ff;
  --primary-soft: rgba(0, 122, 255, .12);
  --bg: #f2f2f7;
  --panel: #ffffff;
  --panel-2: #f7f7f9;
  --border: rgba(60, 60, 67, .12);
  --border-strong: rgba(60, 60, 67, .22);
  --text: #000000;
  --text-sub: rgba(60, 60, 67, .82);
  --text-muted: rgba(60, 60, 67, .5);
  --danger: #ff3b30;
  --success: #34c759;
  --radius: 18px;
  --shadow: 0 1px 2px rgba(0, 0, 0, .05), 0 10px 28px rgba(0, 0, 0, .06);
  --shadow-lg: 0 24px 70px rgba(0, 0, 0, .22);
  --glass: rgba(255, 255, 255, .7);
  --glass-border: rgba(255, 255, 255, .55);
  --input-bg: rgba(118, 118, 128, .12);
  --hover-row: rgba(0, 0, 0, .045);
  --scrollbar: rgba(60, 60, 67, .3);
  --code-bg: rgba(118, 118, 128, .12);
  --grad-bg: linear-gradient(180deg, #f7f7fb 0%, #f2f2f7 100%);
  --spring: cubic-bezier(.34, 1.56, .64, 1);
  --ease-ios: cubic-bezier(.25, .1, .25, 1);
}

[data-theme="dark"] {
  --primary: #0a84ff;
  --primary-hover: #3b9bff;
  --primary-2: #5ac8fa;
  --primary-soft: rgba(10, 132, 255, .2);
  --bg: #000000;
  --panel: #1c1c1e;
  --panel-2: #2c2c2e;
  --border: rgba(84, 84, 88, .45);
  --border-strong: rgba(84, 84, 88, .65);
  --text: #ffffff;
  --text-sub: rgba(235, 235, 245, .78);
  --text-muted: rgba(235, 235, 245, .45);
  --danger: #ff453a;
  --success: #32d74b;
  --shadow: 0 1px 2px rgba(0, 0, 0, .5), 0 12px 32px rgba(0, 0, 0, .42);
  --shadow-lg: 0 24px 70px rgba(0, 0, 0, .6);
  --glass: rgba(28, 28, 30, .7);
  --glass-border: rgba(255, 255, 255, .1);
  --input-bg: rgba(118, 118, 128, .24);
  --hover-row: rgba(255, 255, 255, .06);
  --scrollbar: rgba(235, 235, 245, .25);
  --code-bg: rgba(118, 118, 128, .24);
  --grad-bg: linear-gradient(180deg, #0a0a0c 0%, #000000 100%);
}

* { box-sizing: border-box; }

/* 必须强于类选择器：下面多处元素同时带 hidden 属性和 display 规则
   （如 .modal-mask{display:grid}、.link-info{display:flex}），
   而 UA 样式表的 [hidden]{display:none} 优先级低于类选择器，
   不加强制规则会导致 hidden 失效——蒙版盖满全屏并吞掉所有点击。 */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.55 -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  transition: background .3s var(--ease-ios), color .3s var(--ease-ios);
}

::selection { background: rgba(0, 122, 255, .22); }

/* 滚动条 */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: var(--scrollbar); border-radius: 6px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }
::-webkit-scrollbar-track { background: transparent; }

#app { display: flex; flex-direction: column; height: 100vh; }

/* ---------- 顶部栏（iOS 毛玻璃导航栏） ---------- */
.topbar {
  flex: none;
  height: 58px;
  background: var(--glass);
  -webkit-backdrop-filter: blur(30px) saturate(180%);
  backdrop-filter: blur(30px) saturate(180%);
  border-bottom: 1px solid var(--glass-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 22px;
  z-index: 20;
  position: sticky;
  top: 0;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 16.5px;
  font-weight: 700;
  letter-spacing: .2px;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.logo { width: 26px; height: 26px; border-radius: 8px; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 15px;
  border: 1px solid transparent;
  border-radius: 11px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: transform .18s var(--spring), background .18s var(--ease-ios), box-shadow .18s var(--ease-ios), border-color .18s var(--ease-ios), color .18s var(--ease-ios);
  white-space: nowrap;
  background: transparent;
  color: var(--text);
  font-family: inherit;
}
.btn:active { transform: scale(.96); }
.btn-primary {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 5px 14px rgba(0, 122, 255, .32);
}
.btn-primary:hover {
  background: var(--primary-hover);
  box-shadow: 0 7px 18px rgba(0, 122, 255, .4);
}
.btn-outline {
  border-color: var(--border-strong);
  background: var(--panel);
  color: var(--text-sub);
}
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-ghost { padding: 0 9px; color: var(--text-sub); }
.btn-ghost:hover { background: var(--primary-soft); color: var(--primary); }
.btn-danger { background: var(--danger); color: #fff; box-shadow: 0 5px 14px rgba(255, 59, 48, .3); }
.btn-danger:hover { background: #e03027; }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none !important; box-shadow: none !important; }
.ico { width: 16px; height: 16px; flex: none; }

.icon-btn-t { width: 34px; height: 34px; padding: 0; display: inline-flex; align-items: center; justify-content: center; }

.input {
  height: 38px;
  padding: 0 14px;
  border: 1px solid var(--border-strong);
  border-radius: 11px;
  font-size: 14px;
  outline: none;
  background: var(--input-bg);
  color: var(--text);
  width: 100%;
  transition: border-color .18s var(--ease-ios), box-shadow .18s var(--ease-ios), background .18s var(--ease-ios);
}
.input:focus { border-color: var(--primary); background: var(--panel); box-shadow: 0 0 0 4px var(--primary-soft); }
.select-sm { width: auto; min-width: 120px; height: 38px; cursor: pointer; border-radius: 11px; }
textarea.input { height: auto; padding: 10px 14px; resize: vertical; font-family: inherit; }

/* ---------- 布局 ---------- */
.layout { flex: 1; display: flex; min-height: 0; }

.sidebar {
  flex: none;
  width: 212px;
  background: var(--glass);
  -webkit-backdrop-filter: blur(30px) saturate(180%);
  backdrop-filter: blur(30px) saturate(180%);
  border-right: 1px solid var(--glass-border);
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  overflow-y: auto;
}
.side-nav { display: flex; flex-direction: column; gap: 3px; }
.side-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 13px;
  border-radius: 12px;
  font-size: 14px;
  color: var(--text-sub);
  cursor: pointer;
  transition: all .2s var(--ease-ios);
  user-select: none;
}
.side-item:hover { background: var(--hover-row); color: var(--text); }
.side-item.active {
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 600;
}
.side-item.active svg { color: var(--primary); }

.quota-card {
  margin-top: auto;
  padding: 15px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--panel);
  box-shadow: 0 1px 2px rgba(0,0,0,.03);
}
.quota-title { font-size: 12px; color: var(--text-sub); margin-bottom: 9px; font-weight: 600; }
.quota-bar { height: 6px; background: var(--border); border-radius: 4px; overflow: hidden; }
.quota-fill { height: 100%; background: var(--primary); border-radius: 4px; transition: width .5s var(--ease-ios); }
.quota-fill.warn { background: #ff9500; }
.quota-fill.danger { background: var(--danger); }
.quota-text { margin-top: 8px; font-size: 12px; color: var(--text-muted); line-height: 1.7; }

.content { flex: 1; min-width: 0; padding: 20px 24px; overflow-y: auto; background: var(--grad-bg); }
.view { animation: fadeIn .28s var(--ease-ios); }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 16px; flex-wrap: wrap; }
.toolbar-title { font-size: 20px; font-weight: 700; color: var(--text); letter-spacing: -.2px; }
.toolbar-right { display: flex; align-items: center; gap: 8px; }

/* 视图切换按钮组（iOS 分段控件） */
.view-toggle { display: inline-flex; background: var(--input-bg); border-radius: 11px; padding: 3px; gap: 2px; }
.vt-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 30px; border: 0; border-radius: 9px;
  background: transparent; color: var(--text-muted); cursor: pointer;
  transition: all .2s var(--spring);
}
.vt-btn:hover { color: var(--text-sub); }
.vt-btn.active {
  background: var(--panel);
  color: var(--primary);
  box-shadow: 0 2px 8px rgba(0, 0, 0, .12);
}

.breadcrumb { display: flex; align-items: center; gap: 4px; font-size: 14px; flex-wrap: wrap; min-height: 34px; }
.crumb { cursor: pointer; color: var(--text-sub); padding: 4px 8px; border-radius: 8px; transition: all .15s var(--ease-ios); }
.crumb:hover { background: var(--primary-soft); color: var(--primary); }
.crumb.current { color: var(--text); font-weight: 600; cursor: default; }
.crumb.current:hover { background: transparent; color: var(--text); }
.crumb-sep { color: var(--text-muted); user-select: none; }

/* ---------- 文件表格（iOS 分组列表卡片） ---------- */
.file-table-wrap {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow-x: auto;
  box-shadow: var(--shadow);
}
.file-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.file-table th {
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: transparent;
  user-select: none;
  letter-spacing: .4px;
  text-transform: uppercase;
}
.file-table td { padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; transition: background .15s var(--ease-ios); }
.file-table tbody tr:last-child td { border-bottom: none; }
.file-table tbody tr { transition: background .15s var(--ease-ios); }
.file-table tbody tr:hover { background: var(--hover-row); }
.file-table tbody tr.selected { background: var(--primary-soft); }

.col-name { width: auto; }
.col-size { width: 110px; }
.col-date { width: 150px; }
.col-act { width: 280px; white-space: nowrap; }

.cell-name { display: flex; align-items: center; gap: 12px; min-width: 0; }
/* iOS 文件夹图标：双层浅蓝圆角片 */
.file-ico {
  width: 36px; height: 36px; flex: none; border-radius: 10px;
  display: grid; place-items: center; font-size: 10px; font-weight: 700;
  color: #fff; letter-spacing: -.3px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .14);
}
.file-ico.folder {
  background: transparent;
  box-shadow: none;
  position: relative;
}
.file-ico.folder .fld-f,
.file-ico.folder .fld-b {
  position: absolute;
  display: block;
}
.file-ico.folder .fld-b {
  right: 3%; bottom: 3%;
  width: 62%; height: 62%;
  border-radius: 22%;
  background: linear-gradient(145deg, #63a5f6 0%, #2e7ce0 100%);
  box-shadow: 0 2px 5px rgba(0, 122, 255, .35), inset 0 -2px 4px rgba(0, 0, 0, .12);
}
.file-ico.folder .fld-f {
  left: 3%; top: 3%;
  width: 70%; height: 70%;
  border-radius: 22%;
  background: linear-gradient(145deg, #a2cdff 0%, #4e93ee 100%);
  box-shadow: inset 0 -2px 4px rgba(0, 0, 0, .08), 0 2px 6px rgba(0, 122, 255, .3);
}
.file-name-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
  font-size: 13.5px;
}
.file-name-text:hover { color: var(--primary); }
.cell-size, .cell-date { font-size: 12.5px; color: var(--text-sub); white-space: nowrap; }
.cell-act { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: nowrap; overflow: hidden; }

.act-btn {
  flex: none;
  border: none;
  background: transparent;
  color: var(--text-sub);
  font-size: 12.5px;
  padding: 5px 10px;
  border-radius: 8px;
  cursor: pointer;
  transition: all .15s var(--ease-ios);
  white-space: nowrap;
}
.act-btn:hover { background: var(--primary-soft); color: var(--primary); }
.act-btn.danger:hover { background: rgba(255, 59, 48, .12); color: var(--danger); }

/* ---------- 网格视图（文件夹模式） ---------- */
.file-table-wrap.grid-mode .file-table { display: none; }
.file-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
  padding: 18px;
}
.grid-card {
  position: relative;
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 20px 14px 14px;
  background: var(--panel);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 9px;
  cursor: default;
  transition: transform .25s var(--spring), border-color .2s var(--ease-ios), box-shadow .25s var(--ease-ios);
  overflow: hidden;
}
.grid-card:hover {
  transform: translateY(-4px);
  border-color: rgba(0, 122, 255, .35);
  box-shadow: 0 14px 32px rgba(0, 122, 255, .14);
}
/* 文件夹卡片轻微漂浮，文件卡片 hover 图标上浮 */
.grid-card.folder-card:hover { transform: translateY(-4px) scale(1.015); }
.grid-ico { width: 76px; height: 76px; display: grid; place-items: center; transition: transform .25s var(--spring); }
.grid-card:hover .grid-ico { transform: scale(1.06); }
.grid-ico .file-ico { width: 68px; height: 68px; border-radius: 16px; font-size: 13px; box-shadow: 0 6px 16px rgba(0, 0, 0, .16); }
.grid-ico .file-ico.folder { box-shadow: none; }
.grid-ico .file-ico.folder .fld-b,
.grid-ico .file-ico.folder .fld-f { border-radius: 18%; }
.grid-name {
  width: 100%;
  text-align: center;
  font-size: 13px;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  word-break: break-all;
  cursor: pointer;
  min-height: 2.5em;
  line-height: 1.3;
}
.grid-name:hover { color: var(--primary); }
.grid-meta { font-size: 11.5px; color: var(--text-muted); }
.grid-acts {
  display: flex;
  justify-content: center;
  gap: 4px;
  opacity: 0;
  transform: translateY(4px);
  transition: all .2s var(--ease-ios);
  flex-wrap: wrap;
}
.grid-card:hover .grid-acts { opacity: 1; transform: none; }
.grid-acts .act-btn { font-size: 12px; padding: 4px 8px; }

.empty { padding: 60px 20px; text-align: center; color: var(--text-muted); }
.empty-ico { width: 46px; height: 46px; opacity: .35; margin-bottom: 10px; }
.empty p { margin: 0; font-size: 13.5px; }
.loading { padding: 44px; text-align: center; color: var(--text-muted); font-size: 13px; }

/* ---------- 分页 ---------- */
.pager { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 13px 16px; border-top: 1px solid var(--border); flex-wrap: wrap; }
.page-btn { height: 32px; padding: 0 13px; font-size: 12.5px; color: var(--text-sub); background: transparent; border: 1px solid var(--border); border-radius: 10px; cursor: pointer; transition: all .15s var(--ease-ios); }
.page-btn:hover:not(:disabled) { color: var(--primary); border-color: var(--primary); }
.page-btn:disabled { opacity: .4; cursor: not-allowed; }
.page-nums { display: flex; align-items: center; gap: 4px; }
.page-num { min-width: 32px; height: 32px; padding: 0 4px; font-size: 12.5px; color: var(--text-sub); background: transparent; border: 1px solid var(--border); border-radius: 10px; cursor: pointer; transition: all .15s var(--ease-ios); }
.page-num:hover { color: var(--primary); border-color: var(--primary); }
.page-num.active { color: #fff; background: var(--primary); border-color: transparent; box-shadow: 0 3px 10px rgba(0, 122, 255, .3); }
.page-ellipsis { min-width: 20px; text-align: center; color: var(--text-muted); font-size: 12.5px; }
.page-info { color: var(--text-muted); font-size: 12.5px; margin-left: 4px; }

/* ---------- 面板 / 统计 ---------- */
.panel { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); margin-bottom: 18px; }
.panel-title { margin: 0 0 6px; font-size: 15.5px; font-weight: 700; }
.panel-desc { margin: 0 0 16px; font-size: 13px; color: var(--text-sub); }
.panel-desc code { background: var(--code-bg); padding: 1px 6px; border-radius: 6px; font-size: 12px; color: var(--primary); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.link-input-row { display: flex; gap: 8px; }
.link-input-row .input { flex: 1; }

.link-info { margin-top: 16px; padding: 13px 15px; background: var(--primary-soft); border-radius: 12px; font-size: 13px; display: flex; align-items: center; gap: 11px; }
.link-info .avatar { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; background: var(--border); }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; }
.stat-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
  transition: transform .2s var(--spring), box-shadow .2s var(--ease-ios);
}
.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.stat-card::after {
  content: '';
  position: absolute;
  right: -30px;
  top: -30px;
  width: 90px;
  height: 90px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--primary-soft), transparent 70%);
  pointer-events: none;
}
.stat-label { font-size: 12.5px; color: var(--text-sub); margin-bottom: 9px; }
.stat-value { font-size: 23px; font-weight: 700; letter-spacing: -.5px; }
.stat-value.money { color: var(--success); }

/* ---------- 弹窗 ---------- */
.modal-mask {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, .4);
  -webkit-backdrop-filter: blur(12px) saturate(140%);
  backdrop-filter: blur(12px) saturate(140%);
  display: grid; place-items: center; z-index: 100; padding: 20px;
}
.modal {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 460px;
  max-height: 86vh;
  overflow-y: auto;
  animation: popIn .32s var(--spring);
}
@keyframes popIn { from { opacity: 0; transform: scale(.9) translateY(14px); } to { opacity: 1; transform: none; } }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 17px 22px; border-bottom: 1px solid var(--border); }
.modal-title { font-size: 15.5px; font-weight: 700; }
.modal-wide { max-width: 940px; }
.preview-video { display: block; width: min(880px, 88vw); max-height: 72vh; background: #000; outline: none; border-radius: 12px; }
.preview-img { max-width: min(880px, 90vw); max-height: 72vh; border-radius: 14px; }
.preview-editor {
  display: block; width: 100%; height: min(560px, 70vh); padding: 15px;
  border: 0; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px; line-height: 1.65; background: var(--input-bg); color: var(--text);
  resize: vertical; outline: none; white-space: pre; overflow: auto; tab-size: 2;
}
.preview-frame { display: block; width: 100%; height: min(640px, 72vh); border: 0; background: #fff; border-radius: 12px; }
.modal-body { padding: 22px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 9px; padding: 15px 22px; border-top: 1px solid var(--border); background: var(--panel-2); border-radius: 0 0 20px 20px; }
.field { margin-bottom: 15px; }
.field:last-child { margin-bottom: 0; }
.field-label { display: block; font-size: 12.5px; color: var(--text-sub); margin-bottom: 7px; font-weight: 500; }
.field-hint { font-size: 12px; color: var(--text-muted); margin-top: 7px; line-height: 1.65; }
.icon-btn { border: none; background: transparent; font-size: 20px; line-height: 1; color: var(--text-muted); cursor: pointer; padding: 0 5px; border-radius: 7px; transition: all .15s var(--ease-ios); }
.icon-btn:hover { color: var(--text); background: var(--hover-row); }

/* ---------- 上传队列 ---------- */
.upload-dock {
  position: fixed;
  right: 20px;
  bottom: 20px;
  width: 350px;
  background: var(--glass);
  -webkit-backdrop-filter: blur(30px) saturate(180%);
  backdrop-filter: blur(30px) saturate(180%);
  border: 1px solid var(--glass-border);
  border-radius: 18px;
  box-shadow: var(--shadow-lg);
  z-index: 60;
  overflow: hidden;
  animation: dockIn .32s var(--spring);
}
@keyframes dockIn { from { opacity: 0; transform: translateY(20px) scale(.96); } to { opacity: 1; transform: none; } }
.upload-dock-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 15px; border-bottom: 1px solid var(--border); font-size: 13px; font-weight: 600; background: var(--panel-2); }
.upload-list { max-height: 300px; overflow-y: auto; }
.upload-item { padding: 12px 15px; border-bottom: 1px solid var(--border); }
.upload-item:last-child { border-bottom: none; }
.upload-name { font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-bottom: 7px; }
.upload-bar { height: 4px; background: var(--border); border-radius: 3px; overflow: hidden; }
.upload-fill { height: 100%; background: var(--primary); border-radius: 3px; transition: width .25s; width: 0; }
.upload-fill.done { background: var(--success); }
.upload-fill.error { background: var(--danger); }
.upload-meta { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--text-muted); margin-top: 6px; }

/* ---------- Toast ---------- */
.toast-wrap { position: fixed; top: 72px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast {
  padding: 10px 18px;
  border-radius: 12px;
  background: var(--glass);
  -webkit-backdrop-filter: blur(30px) saturate(180%);
  backdrop-filter: blur(30px) saturate(180%);
  color: var(--text);
  font-size: 13px;
  box-shadow: var(--shadow-lg);
  animation: toastIn .25s var(--spring);
  max-width: 460px;
  border: 1px solid var(--glass-border);
  font-weight: 500;
}
.toast.success { background: var(--success); color: #fff; border-color: transparent; }
.toast.error { background: var(--danger); color: #fff; border-color: transparent; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-14px) scale(.95); } to { opacity: 1; transform: none; } }

/* ---------- 登录（动态星空 + iOS 卡片） ---------- */
.login-mask {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: linear-gradient(135deg, #1d2a6b 0%, #2a2360 48%, #331b50 100%);
}
[data-theme="dark"] .login-mask {
  background: linear-gradient(135deg, #04070f 0%, #0a0e24 55%, #130c26 100%);
}

/* ---------- 站点暂停运营 ---------- */
.suspended-mask {
  position: fixed;
  inset: 0;
  z-index: 210;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg, #f4f5f8);
  background-image: radial-gradient(rgba(0,0,0,.035) 1px, transparent 1px);
  background-size: 22px 22px;
}
[data-theme="dark"] .suspended-mask { background: var(--bg, #0c0f16); background-image: radial-gradient(rgba(255,255,255,.04) 1px, transparent 1px); background-size: 22px 22px; }
.suspended-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 14px;
  padding: 46px 54px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  max-width: 400px;
}
.suspended-ico {
  width: 62px;
  height: 62px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 18px;
  background: var(--primary-soft);
  color: var(--primary);
}
.suspended-ico svg { width: 34px; height: 34px; }
.suspended-title { margin: 0; font-size: 21px; font-weight: 700; letter-spacing: 1px; }
.suspended-desc { margin: 0; font-size: 13.5px; color: var(--text-sub); line-height: 1.6; }
.suspended-card .btn { min-width: 132px; }

/* ---- 星空层 ---- */
.star-layer {
  position: absolute;
  inset: -300px;
  pointer-events: none;
}
.star-layer::before,
.star-layer::after {
  content: '';
  position: absolute;
  inset: 0;
}

/* 小星层 */
.stars-s {
  animation: star-twinkle 3.2s ease-in-out infinite, drift-1 260s linear infinite;
}
.stars-s, .stars-s::before, .stars-s::after {
  background-image:
    radial-gradient(1px 1px at 30px 60px, rgba(255,255,255,.9), transparent 65%),
    radial-gradient(1px 1px at 120px 180px, rgba(255,255,255,.55), transparent 65%),
    radial-gradient(1px 1px at 210px 40px, rgba(255,255,255,.8), transparent 65%),
    radial-gradient(1px 1px at 300px 160px, rgba(255,255,255,.5), transparent 65%),
    radial-gradient(1px 1px at 90px 290px, rgba(255,255,255,.7), transparent 65%),
    radial-gradient(1px 1px at 400px 250px, rgba(255,255,255,.75), transparent 65%),
    radial-gradient(1px 1px at 340px 380px, rgba(255,255,255,.6), transparent 65%),
    radial-gradient(1px 1px at 200px 440px, rgba(255,255,255,.85), transparent 65%),
    radial-gradient(1px 1px at 450px 120px, rgba(255,255,255,.5), transparent 65%),
    radial-gradient(1px 1px at 250px 340px, rgba(255,255,255,.65), transparent 65%),
    radial-gradient(1px 1px at 60px 420px, rgba(255,255,255,.8), transparent 65%),
    radial-gradient(1px 1px at 420px 420px, rgba(255,255,255,.55), transparent 65%);
  background-size: 480px 480px;
}
.stars-s::before { transform: translate3d(-240px, 120px, 0); }
.stars-s::after { transform: translate3d(120px, -240px, 0); }

/* 中星层 */
.stars-m {
  animation: star-twinkle 4.6s ease-in-out 1.2s infinite, drift-2 320s linear infinite;
}
.stars-m, .stars-m::before, .stars-m::after {
  background-image:
    radial-gradient(1.6px 1.6px at 80px 120px, rgba(255,255,255,.95), transparent 60%),
    radial-gradient(1.6px 1.6px at 260px 40px, rgba(200,215,255,.85), transparent 60%),
    radial-gradient(1.6px 1.6px at 420px 200px, rgba(255,255,255,.9), transparent 60%),
    radial-gradient(1.6px 1.6px at 180px 340px, rgba(200,215,255,.8), transparent 60%),
    radial-gradient(1.6px 1.6px at 560px 380px, rgba(255,255,255,.85), transparent 60%),
    radial-gradient(1.6px 1.6px at 640px 120px, rgba(200,215,255,.75), transparent 60%),
    radial-gradient(1.6px 1.6px at 720px 480px, rgba(255,255,255,.9), transparent 60%),
    radial-gradient(1.6px 1.6px at 380px 600px, rgba(255,255,255,.8), transparent 60%),
    radial-gradient(1.6px 1.6px at 520px 620px, rgba(200,215,255,.7), transparent 60%);
  background-size: 820px 700px;
}
.stars-m::before { transform: translate3d(-410px, 200px, 0); }
.stars-m::after { transform: translate3d(280px, -350px, 0); }

/* 大星层（带光晕） */
.stars-l {
  animation: star-twinkle 6.4s ease-in-out 2.4s infinite, drift-3 420s linear infinite;
}
.stars-l, .stars-l::before, .stars-l::after {
  background-image:
    radial-gradient(2.6px 2.6px at 140px 180px, rgba(255,255,255,.35), transparent 70%),
    radial-gradient(1.4px 1.4px at 140px 180px, rgba(255,255,255,.95), transparent 80%),
    radial-gradient(2.6px 2.6px at 520px 90px, rgba(180,200,255,.3), transparent 70%),
    radial-gradient(1.4px 1.4px at 520px 90px, rgba(215,225,255,.9), transparent 80%),
    radial-gradient(2.6px 2.6px at 900px 360px, rgba(255,255,255,.35), transparent 70%),
    radial-gradient(1.4px 1.4px at 900px 360px, rgba(255,255,255,.95), transparent 80%),
    radial-gradient(2.6px 2.6px at 300px 560px, rgba(180,200,255,.3), transparent 70%),
    radial-gradient(1.4px 1.4px at 300px 560px, rgba(215,225,255,.85), transparent 80%),
    radial-gradient(2.6px 2.6px at 760px 640px, rgba(255,255,255,.32), transparent 70%),
    radial-gradient(1.4px 1.4px at 760px 640px, rgba(255,255,255,.9), transparent 80%);
  background-size: 1100px 720px;
}
.stars-l::before { transform: translate3d(-550px, 260px, 0); }
.stars-l::after { transform: translate3d(380px, -360px, 0); }

/* ---- 流星 ---- */
.meteor {
  position: absolute;
  top: 8%;
  left: 70%;
  width: 130px;
  height: 1.6px;
  border-radius: 2px;
  background: linear-gradient(90deg, rgba(255,255,255,.95), rgba(255,255,255,0));
  filter: drop-shadow(0 0 6px rgba(255,255,255,.55));
  opacity: 0;
  pointer-events: none;
  animation: meteor-fly 9s linear 2s infinite;
}
.meteor-2 { top: 34%; left: 88%; animation-duration: 12s; animation-delay: 7s; }

/* ---- 动画 ---- */
@keyframes star-twinkle { 0%, 100% { opacity: .5; } 50% { opacity: 1; } }
@keyframes drift-1 { from { transform: translate3d(0, 0, 0); } to { transform: translate3d(60px, 30px, 0); } }
@keyframes drift-2 { from { transform: translate3d(0, 0, 0); } to { transform: translate3d(-80px, 44px, 0); } }
@keyframes drift-3 { from { transform: translate3d(0, 0, 0); } to { transform: translate3d(46px, -54px, 0); } }
@keyframes meteor-fly {
  0%   { transform: translate3d(0, 0, 0) rotate(145deg); opacity: 0; }
  4%   { opacity: 1; }
  9%   { transform: translate3d(-620px, 620px, 0) rotate(145deg); opacity: 0; }
  100% { transform: translate3d(-620px, 620px, 0) rotate(145deg); opacity: 0; }
}

.login-theme-btn {
  position: absolute;
  top: 20px;
  right: 20px;
  z-index: 2;
  color: rgba(255,255,255,.92);
  border: 0;
  background: rgba(255,255,255,.14);
  border-radius: 50%;
  width: 38px;
  height: 38px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all .2s var(--spring);
  box-shadow: 0 0 0 1px rgba(255,255,255,.12), 0 4px 14px rgba(0,0,0,.25);
}
.login-theme-btn:hover {
  background: rgba(255,255,255,.3);
  color: #fff;
  box-shadow: 0 0 0 1px rgba(255,255,255,.25), 0 6px 20px rgba(0,0,0,.35);
}
.login-theme-btn .ico { width: 18px; height: 18px; }

/* iOS 毛玻璃登录卡片 */
.login-card {
  position: relative;
  z-index: 1;
  width: 380px;
  max-width: 90vw;
  background: rgba(255, 255, 255, .78);
  -webkit-backdrop-filter: blur(40px) saturate(180%);
  backdrop-filter: blur(40px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, .5);
  border-radius: 26px;
  padding: 40px 34px 34px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, .32);
  animation: loginIn .4s var(--spring);
}
[data-theme="dark"] .login-card {
  background: rgba(28, 28, 30, .72);
  border-color: rgba(255, 255, 255, .12);
}
@keyframes loginIn { from { opacity: 0; transform: translateY(24px) scale(.94); } to { opacity: 1; transform: none; } }
.login-brand { display: flex; align-items: center; gap: 12px; justify-content: center; font-size: 22px; font-weight: 800; letter-spacing: .3px; color: #fff; }
[data-theme="dark"] .login-brand { color: #fff; }
.login-brand .logo { width: 40px; height: 40px; box-shadow: 0 6px 16px rgba(0,0,0,.25); }
.login-sub { text-align: center; color: rgba(255,255,255,.75); font-size: 13px; margin: 8px 0 26px; }
[data-theme="dark"] .login-sub { color: rgba(255,255,255,.6); }

/* 登录输入框（iOS 灰底圆角） */
.login-card .input {
  height: 44px;
  border: 0;
  background: rgba(118, 118, 128, .16);
  color: #000;
  border-radius: 13px;
  margin-bottom: 13px;
  font-size: 15px;
}
.login-card .input::placeholder { color: rgba(60, 60, 67, .55); }
[data-theme="dark"] .login-card .input { background: rgba(255, 255, 255, .1); color: #fff; }
[data-theme="dark"] .login-card .input::placeholder { color: rgba(235, 235, 245, .4); }
.login-card .input:focus { background: rgba(255, 255, 255, .95); box-shadow: 0 0 0 4px rgba(0, 122, 255, .35); }
[data-theme="dark"] .login-card .input:focus { background: rgba(60, 60, 67, .6); }

.btn-block { width: 100%; justify-content: center; height: 46px; font-size: 15px; font-weight: 600; border-radius: 13px; }

/* ---- 登录滑动验证（iOS 滑块） ---- */
.slider-verify {
  margin-bottom: 13px;
  user-select: none;
  -webkit-user-select: none;
}
.sv-track {
  position: relative;
  height: 44px;
  border-radius: 22px;
  background: rgba(118, 118, 128, .18);
  box-shadow: inset 0 1px 3px rgba(0,0,0,.18);
  overflow: hidden;
  cursor: default;
}
[data-theme="dark"] .sv-track { background: rgba(255,255,255,.1); }
.sv-fill {
  position: absolute;
  top: 0; left: 0;
  height: 100%;
  width: 44px;
  border-radius: 22px;
  background: var(--primary);
  opacity: 0;
  transition: opacity .2s ease;
}
.sv-track.dragging .sv-fill { opacity: 1; }
.sv-tip {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  letter-spacing: .5px;
  color: rgba(255,255,255,.75);
  pointer-events: none;
  transition: color .2s ease;
}
[data-theme="dark"] .sv-tip { color: rgba(255,255,255,.5); }
.sv-thumb {
  position: absolute;
  top: 3px; left: 3px;
  width: 38px; height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  background: var(--primary);
  box-shadow: 0 3px 8px rgba(0, 122, 255, .45), 0 1px 2px rgba(0,0,0,.3);
  cursor: grab;
  transition: box-shadow .2s ease;
  z-index: 2;
}
.sv-thumb .ico { width: 20px; height: 20px; }
.sv-track.dragging .sv-thumb { cursor: grabbing; box-shadow: 0 4px 14px rgba(0, 122, 255, .55); }
.sv-thumb:hover { box-shadow: 0 4px 12px rgba(0, 122, 255, .5); }
/* 未到终点松手回弹抖动 */
.sv-tip.shake { animation: sv-shake .35s ease; color: #ffb3ad; }
@keyframes sv-shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  50% { transform: translateX(5px); }
  75% { transform: translateX(-3px); }
}
/* 验证成功 */
.slider-verify.done .sv-fill {
  opacity: 1;
  background: var(--success);
}
.slider-verify.done .sv-thumb {
  background: var(--success);
  box-shadow: 0 3px 8px rgba(52, 199, 89, .5);
}
.slider-verify.done .sv-tip { color: #fff; }
.slider-verify.done .sv-thumb .ico { animation: sv-pop .3s var(--spring); }
@keyframes sv-pop { from { transform: rotate(0deg) scale(.5); opacity: 0; } to { transform: rotate(0deg) scale(1); opacity: 1; } }
/* 登录按钮禁用态 */
#btn-login:disabled {
  opacity: .5;
  cursor: not-allowed;
  background: rgba(118, 118, 128, .4);
  box-shadow: none;
  color: rgba(255,255,255,.85);
}

/* ---------- 顶栏用户区 ---------- */
.user-name {
  font-size: 13px;
  color: #fff;
  font-weight: 600;
  margin-left: 6px;
  padding: 4px 13px;
  background: var(--primary);
  border-radius: 999px;
}

/* ---------- 表单 / 用户管理 ---------- */
.form-row { margin-bottom: 15px; }
.form-err {
  color: var(--danger);
  font-size: 13px;
  margin-top: 10px;
  background: rgba(255, 59, 48, .1);
  border: 1px solid rgba(255, 59, 48, .25);
  padding: 9px 13px;
  border-radius: 11px;
}
.form-err[hidden] { display: none !important; }
.users-toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 13px; flex-wrap: wrap; }
.users-hint { font-size: 12px; color: var(--text-muted); }
.col-folder { min-width: 220px; }
.user-role-badge { display: inline-block; padding: 3px 11px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.user-role-badge.admin { background: rgba(255, 149, 0, .16); color: #ff9500; }
.user-role-badge.user { background: var(--primary-soft); color: var(--primary); }
.folder-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.folder-chip { background: var(--code-bg); color: var(--text-sub); font-size: 12px; padding: 2px 9px; border-radius: 8px; white-space: nowrap; }
.folder-chip.none { background: transparent; color: var(--text-muted); }

/* ---------- 文件夹选择器（用户管理） ---------- */
.btn-sm { padding: 4px 11px; font-size: 12px; height: 30px; border-radius: 9px; }
.pick-toolbar { display: flex; gap: 8px; margin-bottom: 8px; }
.pick-crumbs {
  display: flex; align-items: center; gap: 4px; flex-wrap: wrap;
  min-height: 34px; padding: 7px 11px; border: 1px solid var(--border);
  border-radius: 12px; background: var(--panel-2); margin-bottom: 10px;
}
.pick-crumbs .crumb { font-size: 13px; }
.pick-list { max-height: min(320px, 45vh); overflow-y: auto; border: 1px solid var(--border); border-radius: 12px; }
.pick-row { display: flex; align-items: center; gap: 10px; padding: 9px 13px; border-bottom: 1px solid var(--border); cursor: pointer; transition: background .15s var(--ease-ios); }
.pick-row:last-child { border-bottom: 0; }
.pick-row:hover { background: var(--hover-row); }
.pick-row.on { background: var(--primary-soft); }
.pick-ico { width: 18px; height: 18px; color: #0a84ff; flex: none; }
.pick-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13.5px; }
.pick-id { color: var(--text-muted); font-size: 12px; flex: none; }
.pick-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 13px; }
.pick-selected { display: flex; align-items: flex-start; gap: 6px; min-width: 0; }
.pick-label { font-size: 12.5px; color: var(--text-muted); flex: none; padding-top: 4px; }
.pick-chips { display: flex; flex-wrap: wrap; gap: 6px; min-width: 0; }
.pick-none { font-size: 12.5px; color: var(--text-muted); }
.pick-chip {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--code-bg); color: var(--text-sub);
  font-size: 12px; padding: 3px 6px 3px 11px; border-radius: 999px;
  white-space: nowrap; max-width: 220px;
}
.pick-chip-x { border: 0; background: transparent; color: var(--text-muted); cursor: pointer; font-size: 15px; line-height: 1; padding: 0 2px; border-radius: 50%; }
.pick-chip-x:hover { color: var(--danger); }
.pick-actions { display: flex; gap: 8px; flex: none; }

@media (max-width: 860px) {
  .sidebar { width: 64px; padding: 16px 8px; }
  .side-item span, .quota-card { display: none; }
  .side-item { justify-content: center; }
  .col-date, .col-size { display: none; }
  .content { padding: 14px; }
  .file-grid { grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 12px; padding: 14px; }
  .grid-ico .file-ico { width: 60px; height: 60px; }
}

/* =========================================================
   设置弹窗 · 数据库页签
  ========================================================= */
.settings-tabs { display: flex; gap: 6px; padding: 12px 20px 0; }
.st-tab {
  flex: 1; padding: 8px 0; border: 0; border-radius: 10px;
  background: transparent; color: var(--text-muted); font-size: 14px; cursor: pointer;
  transition: all .18s var(--ease-ios);
}
.st-tab.active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.st-db-state {
  display: flex; align-items: center; gap: 8px;
  background: var(--code-bg); border-radius: 10px; padding: 10px 12px;
  font-size: 13px; color: var(--text-sub); margin-bottom: 14px;
}
.st-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.st-dot.ok { background: var(--success); }
.st-dot.no { background: var(--danger); }
.st-db-group { border: 1px solid var(--border); border-radius: 14px; padding: 14px; margin-bottom: 14px; }
.st-db-title { font-size: 13px; font-weight: 600; color: var(--text-sub); margin-bottom: 10px; }
.st-db-row { display: flex; gap: 10px; }
.st-db-row .field { flex: 1; }
.btn-block { width: 100%; }

/* 数据库未就绪占位 */
.db-off {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-height: 50vh; text-align: center; gap: 10px; padding: 24px;
}
.db-off-ico {
  width: 64px; height: 64px; border-radius: 20px; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #ff9f0a, #ff453a); color: #fff; font-weight: 800; font-size: 20px;
  box-shadow: var(--shadow);
}
.db-off h3 { margin: 0; font-size: 18px; }
.db-off p { margin: 0; color: var(--text-muted); font-size: 13px; line-height: 1.7; }

/* =========================================================
   交流论坛
  ========================================================= */
.forum-wrap { padding: 4px 2px; }
.board-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; padding: 4px; }
.board-card {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; cursor: pointer; transition: all .18s var(--ease-ios); box-shadow: var(--shadow);
}
.board-card:hover { transform: translateY(-2px); border-color: var(--primary); }
.board-card-body { min-height: 56px; }
.board-name { font-size: 16px; font-weight: 700; margin-bottom: 6px; }
.board-desc { font-size: 12.5px; color: var(--text-muted); line-height: 1.5; }
.board-card-foot { display: flex; justify-content: space-between; gap: 8px; margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--border); font-size: 12px; color: var(--text-muted); }
.board-last { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 60%; }

.thread-list { display: flex; flex-direction: column; gap: 10px; }
.thread-item {
  display: flex; gap: 12px; align-items: flex-start; padding: 14px;
  background: var(--panel); border: 1px solid var(--border); border-radius: 14px; cursor: pointer;
  transition: all .18s var(--ease-ios);
}
.thread-item:hover { border-color: var(--primary); background: var(--hover-row); }
.thread-info { flex: 1; min-width: 0; }
.thread-title { font-size: 15px; font-weight: 600; margin-bottom: 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.thread-meta { display: flex; gap: 12px; font-size: 12px; color: var(--text-muted); flex-wrap: wrap; }
.tag-top { display: inline-block; background: var(--danger); color: #fff; font-size: 10px; font-weight: 700; border-radius: 5px; padding: 1px 5px; margin-right: 6px; vertical-align: 2px; }
.pager { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 16px; }
.pager-info { font-size: 13px; color: var(--text-muted); }

.td-head { padding: 18px 4px 12px; }
.td-title { font-size: 20px; font-weight: 700; margin: 0 0 12px; line-height: 1.4; word-break: break-word; }
.td-meta { display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--text-muted); flex-wrap: wrap; }
.td-author { font-weight: 600; color: var(--text-sub); }
.td-content {
  background: var(--panel); border: 1px solid var(--border); border-radius: 14px;
  padding: 18px; font-size: 14.5px; line-height: 1.8; white-space: pre-wrap; word-break: break-word;
  margin-bottom: 14px;
}
.td-actions { display: flex; gap: 10px; margin-bottom: 18px; }
.reply-form { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.reply-form textarea { width: 100%; resize: vertical; }
.reply-form-foot { display: flex; justify-content: flex-end; }
.reply-item { display: flex; gap: 12px; padding: 14px 4px; border-bottom: 1px solid var(--border); }
.reply-body { flex: 1; min-width: 0; }
.reply-head { display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--text-muted); margin-bottom: 6px; flex-wrap: wrap; }
.reply-author { font-weight: 600; color: var(--text-sub); font-size: 13px; }
.reply-floor { color: var(--text-muted); }
.reply-content { font-size: 14px; line-height: 1.7; white-space: pre-wrap; word-break: break-word; }
.reply-like { margin-top: 6px; }
.link-btn { border: 0; background: none; color: var(--text-muted); font-size: 12px; cursor: pointer; padding: 2px 0; }
.link-btn:hover { color: var(--primary); }
.link-btn.liked { color: var(--primary); }

/* =========================================================
   聊天 · 仿微信
  ========================================================= */
.chat-layout { display: flex; height: calc(100vh - 128px); min-height: 420px; border: 1px solid var(--border); border-radius: 16px; overflow: hidden; background: var(--panel); }
.chat-side { width: 300px; flex: none; display: flex; flex-direction: column; border-right: 1px solid var(--border); background: var(--panel-2); }
.chat-side-head { display: flex; align-items: center; gap: 8px; padding: 12px 12px 8px; }
.chat-tabs { display: flex; flex: 1; background: var(--code-bg); border-radius: 9px; padding: 2px; }
.chat-tab { flex: 1; border: 0; background: transparent; padding: 6px 0; border-radius: 7px; font-size: 13px; color: var(--text-muted); cursor: pointer; }
.chat-tab.active { background: var(--panel); color: var(--primary); font-weight: 600; box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.chat-requests { border-bottom: 1px solid var(--border); padding: 8px 12px; background: var(--primary-soft); }
.req-title { font-size: 12px; font-weight: 600; color: var(--primary); margin-bottom: 6px; }
.req-item { display: flex; align-items: center; gap: 10px; padding: 5px 0; }
.req-info { flex: 1; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.req-name { font-size: 13px; font-weight: 500; }
.chat-list { flex: 1; overflow-y: auto; padding: 6px; }
.chat-list-empty { padding: 28px 12px; text-align: center; color: var(--text-muted); font-size: 13px; }
.chat-loading { padding: 28px; text-align: center; color: var(--text-muted); font-size: 13px; }

.avatar {
  width: 40px; height: 40px; border-radius: 50%; color: #fff; flex: none;
  display: flex; align-items: center; justify-content: center; font-weight: 700;
}
.conv-item, .friend-item { display: flex; gap: 10px; align-items: center; padding: 10px; border-radius: 12px; cursor: pointer; transition: background .15s; }
.conv-item:hover, .friend-item:hover { background: var(--hover-row); }
.conv-item.active { background: var(--primary-soft); }
.conv-info, .friend-info { flex: 1; min-width: 0; }
.conv-line1 { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.conv-name { font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv-time { font-size: 11px; color: var(--text-muted); flex: none; }
.conv-line2 { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 2px; }
.conv-last { font-size: 12.5px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.conv-badge {
  background: var(--danger); color: #fff; font-size: 11px; font-weight: 700;
  min-width: 18px; height: 18px; border-radius: 999px; display: flex; align-items: center; justify-content: center; padding: 0 5px;
}
.on-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--success); margin-right: 4px; }

.chat-main { flex: 1; display: flex; flex-direction: column; min-width: 0; background: var(--bg); }
.chat-head {
  display: flex; align-items: center; gap: 10px; padding: 10px 16px;
  border-bottom: 1px solid var(--border); background: var(--glass); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
}
.chat-head-info { display: flex; flex-direction: column; }
.chat-peer-name { font-size: 15px; font-weight: 600; }
.chat-peer-status { font-size: 11.5px; color: var(--text-muted); }
.chat-msgs { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 14px; }
.chat-day { align-self: center; font-size: 11px; color: var(--text-muted); background: var(--code-bg); padding: 2px 10px; border-radius: 999px; }
.msg-row { display: flex; gap: 10px; align-items: flex-start; }
.msg-row.me { justify-content: flex-end; }
.bubble-wrap { max-width: 66%; display: flex; flex-direction: column; }
.msg-row.me .bubble-wrap { align-items: flex-end; }
.bubble {
  background: var(--panel); border: 1px solid var(--border); padding: 9px 13px;
  border-radius: 16px; font-size: 14px; line-height: 1.55; word-break: break-word; white-space: pre-wrap;
  box-shadow: 0 1px 2px rgba(0,0,0,.04);
}
.bubble-me { background: var(--primary); color: #fff; border-color: var(--primary); }
.bubble-time { font-size: 10.5px; color: var(--text-muted); margin-top: 3px; }
.chat-input-wrap {
  display: flex; gap: 10px; align-items: flex-end; padding: 10px 14px;
  border-top: 1px solid var(--border); background: var(--panel);
}
.chat-input-wrap textarea {
  flex: 1; resize: none; min-height: 38px; max-height: 140px;
  border: 1px solid var(--border); border-radius: 20px; padding: 9px 14px;
  font-size: 14px; background: var(--input-bg); color: var(--text); outline: none; font-family: inherit; line-height: 1.4;
}
.chat-input-wrap textarea:focus { border-color: var(--primary); }

/* 搜索用户 / 好友申请 */
.search-row { display: flex; gap: 8px; }
.search-row .input { flex: 1; }
.search-user { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.search-user-info { flex: 1; min-width: 0; }
.search-user-name { font-size: 14px; font-weight: 600; }
.search-user-state { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.tag-role { font-size: 11px; color: var(--primary); border: 1px solid var(--primary-soft); background: var(--primary-soft); border-radius: 6px; padding: 1px 6px; margin-left: 6px; }
.tag-done { color: var(--success); font-size: 12px; }
.tag-wait { color: var(--text-muted); font-size: 12px; }

.side-badge {
  background: var(--danger); color: #fff; font-size: 10px; font-weight: 700;
  min-width: 16px; height: 16px; border-radius: 999px; display: flex; align-items: center; justify-content: center;
  padding: 0 4px; margin-left: auto;
}
.side-item .side-badge { font-size: 10px; }

.ico.mini { width: 13px; height: 13px; vertical-align: -2px; }
.ico.mini + span { margin-left: 2px; }
.thread-meta span { display: inline-flex; align-items: center; gap: 3px; }

/* =========================================================
   移动端适配（聊天/论坛/设置）
  ========================================================= */
@media (max-width: 720px) {
  .chat-layout { height: calc(100vh - 168px); border-radius: 12px; }
  .chat-side { width: 100%; }
  .chat-main { display: none; }
  .chat-main.chat-main-open { display: flex; position: fixed; inset: 0; z-index: 120; height: 100vh; border-radius: 0; }
  .st-db-row { flex-direction: column; gap: 0; }
  .board-grid { grid-template-columns: 1fr; }
  .bubble-wrap { max-width: 80%; }
  .toolbar { flex-wrap: wrap; }
}

