/* ========================================================================== */
/* v13：输入框自动填充兜底（覆盖浏览器 autofill 的强制底色）                    */
/* ========================================================================== */

.input:-webkit-autofill,
.input:-webkit-autofill:hover,
.input:-webkit-autofill:focus,
.input:-webkit-autofill:active,
textarea.input:-webkit-autofill,
select.input:-webkit-autofill {
  -webkit-text-fill-color: var(--text) !important;
  -webkit-box-shadow: 0 0 0 1000px var(--surface) inset !important;
  box-shadow: 0 0 0 1000px var(--surface) inset !important;
  transition: background-color 99999s ease-in-out 0s !important;
  caret-color: var(--text);
}

html[data-mode="dark"] .input:-webkit-autofill,
html[data-mode="dark"] .input:-webkit-autofill:hover,
html[data-mode="dark"] .input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--text) !important;
  -webkit-box-shadow: 0 0 0 1000px var(--surface) inset !important;
  box-shadow: 0 0 0 1000px var(--surface) inset !important;
}

/* ========================================================================== */
/* v13：输入框防自动填充（配合 input 上的 data-lpignore 等标记）               */
/* ========================================================================== */

/* 浏览器强制填充时覆盖其蓝/黄底，改为主题背景，视觉上等同未填充 */
.input:-webkit-autofill,
.input:-webkit-autofill:hover,
.input:-webkit-autofill:focus,
.textarea:-webkit-autofill,
.select:-webkit-autofill {
  -webkit-text-fill-color: var(--text);
  -webkit-box-shadow: 0 0 0 1000px var(--surface) inset !important;
  box-shadow: 0 0 0 1000px var(--surface) inset !important;
  transition: background-color 99999s ease-in-out 0s !important;
  caret-color: var(--text);
}

/* 密码框隐藏 Edge 的「显示密码」小眼睛，避免和自定义眼睛重叠 */
.input::-ms-reveal,
.input::-ms-clear {
  display: none;
}

/* iOS Safari 禁止输入框自动大写/自动更正 */
.input {
  -webkit-text-size-adjust: 100%;
}

/* ========================================================================== */
/* v13：消息通知面板重设计（主题适配）                                        */
/* ========================================================================== */

.notify-panel {
  position: absolute;
  top: calc(100% + 12px);
  right: 0;
  z-index: 70;
  width: 360px;
  max-width: calc(100vw - 24px);
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-pop);
  animation: notify-in 0.16s ease-out;
}

@keyframes notify-in {
  from {
    opacity: 0;
    transform: translateY(-6px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* 玻璃主题：毛玻璃 */
html[data-theme="glass"] .notify-panel {
  background: rgba(var(--surface-rgb), 0.92);
  border-color: rgba(255, 255, 255, 0.5);
  backdrop-filter: blur(22px) saturate(1.35);
  -webkit-backdrop-filter: blur(22px) saturate(1.35);
}

html[data-mode="dark"][data-theme="glass"] .notify-panel {
  background: rgba(var(--surface-rgb), 0.94);
  border-color: rgba(255, 255, 255, 0.13);
}

/* 去掉旧的尖角（用不到，保留但不显示） */
.notify-panel::before {
  display: none;
}

/* 头部 */
.notify-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--border-soft);
}

.notify-head strong {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
}

.notify-head strong::before {
  content: "0f3";
  font-family: "Font Awesome 6 Free";
  font-weight: 900;
  color: var(--primary);
  font-size: 13px;
}

.notify-all {
  padding: 4px 10px;
  border: 1px solid rgba(var(--primary-rgb), 0.25);
  border-radius: 999px;
  background: rgba(var(--primary-rgb), 0.07);
  color: var(--primary);
  font: inherit;
  font-size: 11.5px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.notify-all:hover:not(:disabled) {
  background: rgba(var(--primary-rgb), 0.14);
  border-color: rgba(var(--primary-rgb), 0.4);
}

.notify-all:disabled {
  border-color: var(--border-soft);
  background: transparent;
  color: var(--muted);
  cursor: not-allowed;
}

/* 列表 */
.notify-list {
  max-height: 340px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.notify-list::-webkit-scrollbar {
  width: 6px;
}

.notify-list::-webkit-scrollbar-thumb {
  background: rgba(var(--line-rgb), 0.25);
  border-radius: 3px;
}

.notify-item {
  display: block;
  width: 100%;
  padding: 12px 16px;
  border: 0;
  border-bottom: 1px solid var(--border-soft);
  background: transparent;
  text-align: left;
  cursor: pointer;
  transition: background 0.14s ease;
}

.notify-item:last-child {
  border-bottom: 0;
}

.notify-item:hover {
  background: rgba(var(--primary-rgb), 0.06);
}

.notify-item.unread {
  background: rgba(var(--primary-rgb), 0.045);
  box-shadow: inset 3px 0 0 var(--primary);
}

.notify-item.unread:hover {
  background: rgba(var(--primary-rgb), 0.09);
}

.notify-item-title {
  display: block;
  overflow: hidden;
  margin-bottom: 3px;
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.notify-item.unread .notify-item-title {
  font-weight: 600;
}

.notify-item-time {
  display: block;
  color: var(--muted);
  font-size: 11.5px;
}

/* 空态 / 加载 */
.notify-empty {
  display: grid;
  place-items: center;
  gap: 8px;
  padding: 36px 16px;
  color: var(--muted);
  font-size: 13px;
}

.notify-empty::before {
  content: "0f3";
  font-family: "Font Awesome 6 Free";
  font-weight: 400;
  font-size: 26px;
  opacity: 0.35;
}

/* 底部入口 */
.notify-foot {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 11px 16px;
  border-top: 1px solid var(--border-soft);
  background: rgba(var(--line-rgb), 0.035);
  color: var(--primary);
  font-size: 12.5px;
  font-weight: 500;
  text-decoration: none;
  transition: background 0.15s ease;
}

.notify-foot:hover {
  background: rgba(var(--primary-rgb), 0.08);
  text-decoration: none;
}

.notify-foot::after {
  content: "054";
  font-family: "Font Awesome 6 Free";
  font-weight: 900;
  font-size: 9px;
}

/* 角标优化 */
.notify-dot {
  min-width: 17px;
  height: 17px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--primary);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 17px;
  text-align: center;
  box-shadow: 0 0 0 2px var(--surface), 0 2px 6px rgba(var(--primary-rgb), 0.4);
}

/* 移动端：面板贴边全宽 */
@media (max-width: 640px) {
  .notify-panel {
    position: fixed;
    top: 58px;
    left: 10px;
    right: 10px;
    width: auto;
    max-width: none;
    max-height: calc(100dvh - 78px);
    display: flex;
    flex-direction: column;
  }

  .notify-list {
    flex: 1 1 auto;
    max-height: none;
  }

  .notify-item {
    padding: 12px 14px;
  }
}

/* 消息内容摘要：单行省略 */
.notify-item-desc {
  display: block;
  overflow: hidden;
  margin-bottom: 4px;
  color: var(--text-soft);
  font-size: 12px;
  line-height: 1.5;
  white-space: nowrap;
  text-overflow: ellipsis;
}

/* ========================================================================== */
/* v13：布局系统（classic / sidebar / dock，与配色独立）                        */
/* ========================================================================== */

/* --- 顶栏布局切换器 --- */
.layout-switch {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 2px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(var(--surface-rgb), 0.6);
}

.layout-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 24px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease;
}

.layout-btn:hover {
  color: var(--primary);
}

.layout-btn.active {
  background: var(--primary);
  color: var(--primary-ink);
}

/* ==========================================================================
   侧边栏布局：右下角半透明悬浮按钮 + 右侧抽屉
   ========================================================================== */

html[data-layout="sidebar"] .side-nav {
  display: none;
}

html[data-layout="sidebar"] .member-layout {
  grid-template-columns: minmax(0, 1fr);
}

html[data-layout="sidebar"] .member-side {
  display: none;
}

/* 右下角悬浮入口 */
.side-fab {
  position: fixed;
  right: 20px;
  bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  z-index: 95;
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 50%;
  background: rgba(var(--surface-rgb), 0.55);
  color: var(--primary);
  font-size: 18px;
  cursor: pointer;
  box-shadow: 0 14px 34px -16px rgba(var(--primary-rgb), 0.75);
  backdrop-filter: blur(16px) saturate(1.6);
  -webkit-backdrop-filter: blur(16px) saturate(1.6);
  transition: transform 0.2s ease, background 0.2s ease;
}

.side-fab:hover {
  transform: translateY(-2px) scale(1.04);
  background: rgba(var(--surface-rgb), 0.75);
}

.side-fab.open {
  background: var(--primary);
  color: var(--primary-ink);
  border-color: transparent;
}

/* 遮罩 */
.side-mask {
  position: fixed;
  inset: 0;
  z-index: 96;
  background: rgba(20, 18, 17, 0.38);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  animation: mask-in 0.16s ease-out;
}

/* 抽屉：从左侧滑出（按钮仍在右下角） */
.side-drawer {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 97;
  display: flex;
  flex-direction: column;
  /* v17：收窄抽屉宽度，避免占满屏幕 */
  width: min(76vw, 272px);
  overflow: hidden;
  border-right: 1px solid var(--border);
  background: var(--surface-soft);
  color: var(--text);
  box-shadow: 22px 0 54px -28px rgba(20, 18, 17, 0.5);
  transform: translateX(-100%);
  visibility: hidden;
  transition: transform 0.26s cubic-bezier(0.22, 1, 0.36, 1), visibility 0.26s;
}

.side-drawer.open {
  transform: translateX(0);
  visibility: visible;
}

/* 抽屉头部（v19：内嵌 UserHero，适配窄抽屉） */
.side-drawer-head {
  flex: 0 0 auto;
  padding: 16px 14px 14px;
  border-bottom: 1px solid var(--border-soft);
}

/* UserHero 在抽屉内的紧凑布局 */
.side-drawer-head .user-hero {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
}

.side-drawer-head .user-hero-text {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.side-drawer-head .user-hero-name-row {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  flex-wrap: wrap;
}

.side-drawer-head .user-hero-name {
  overflow: hidden;
  max-width: 100%;
  color: var(--text);
  font-size: 14.5px;
  font-weight: 600;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.side-drawer-head .user-hero-name-row .badge.group-badge {
  flex: 0 0 auto;
  padding: 1px 7px;
  font-size: 11px;
  line-height: 1.6;
}

.side-drawer-head .user-hero-name-row .group-badge-img {
  max-height: 15px;
  max-width: 64px;
}

.side-drawer-head .user-hero-mail {
  overflow: hidden;
  color: var(--muted);
  font-size: 11.5px;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.side-drawer-head .user-hero-badges {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
  margin-top: 2px;
}

.side-drawer-head .user-hero-badges .badge.badge-expiry {
  padding: 1px 7px;
  font-size: 10.5px;
}

/* 抽屉导航 */
.side-drawer-nav {
  flex: 1 1 auto;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 12px 10px;
}

.side-drawer-item {
  display: flex;
  align-items: center;
  gap: 11px;
  margin-bottom: 3px;
  padding: 11px 13px;
  border-radius: 11px;
  color: var(--text-soft);
  font-size: 14px;
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

.side-drawer-item i {
  flex: 0 0 auto;
  width: 18px;
  text-align: center;
  font-size: 14px;
}

.side-drawer-item:hover {
  background: rgba(var(--primary-rgb), 0.08);
  color: var(--primary);
  text-decoration: none;
}

.side-drawer-item.active {
  background: rgba(var(--primary-rgb), 0.14);
  color: var(--primary);
  font-weight: 600;
}

.side-drawer-foot {
  padding: 12px 16px calc(16px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--border-soft);
}

.side-drawer-foot .btn {
  width: 100%;
  justify-content: center;
}

@media (max-width: 640px) {
  .side-fab {
    right: 16px;
    bottom: calc(18px + env(safe-area-inset-bottom, 0px));
    width: 48px;
    height: 48px;
    font-size: 16px;
  }
}

/* ==========================================================================
   底部悬浮栏布局（类 App）
   ========================================================================== */

html[data-layout="dock"] .side-nav {
  display: none;
}

html[data-layout="dock"] .member-side {
  display: none;
}

html[data-layout="dock"] .member-layout {
  grid-template-columns: minmax(0, 1fr);
}

/* 给底部悬浮栏留出空间 */
html[data-layout="dock"] .main {
  padding-bottom: calc(108px + env(safe-area-inset-bottom, 0px));
}

/* 顶栏压缩为紧凑模式 */
html[data-layout="dock"] .topbar-inner {
  min-height: 54px;
}

html[data-layout="dock"] .brand-text small {
  display: none;
}

/* 悬浮胶囊 */
.dock-bar {
  position: fixed;
  left: 50%;
  bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  z-index: 92;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  max-width: calc(100vw - 24px);
  padding: 7px 9px;
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 999px;
  background: rgba(var(--surface-rgb), 0.72);
  box-shadow: 0 18px 44px -20px rgba(20, 18, 17, 0.6), 0 2px 8px rgba(20, 18, 17, 0.08);
  backdrop-filter: blur(20px) saturate(1.5);
  -webkit-backdrop-filter: blur(20px) saturate(1.5);
  transform: translateX(-50%);
  overflow-x: auto;
  scrollbar-width: none;
}

.dock-bar::-webkit-scrollbar {
  display: none;
}

html[data-mode="dark"] .dock-bar {
  border-color: rgba(255, 255, 255, 0.13);
  background: rgba(var(--surface-rgb), 0.8);
}

html[data-theme="glass"] .dock-bar {
  background: rgba(var(--surface-rgb), 0.55);
}

.dock-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-width: 56px;
  padding: 5px 9px;
  border-radius: 14px;
  color: var(--muted);
  font-size: 10.5px;
  text-decoration: none;
  transition: color 0.16s ease, background 0.16s ease, transform 0.16s ease;
}

.dock-item:hover {
  color: var(--primary);
  text-decoration: none;
}

.dock-icon {
  display: grid;
  place-items: center;
  width: 26px;
  height: 22px;
  font-size: 15px;
  transition: transform 0.18s ease;
}

.dock-label {
  white-space: nowrap;
  font-weight: 500;
  letter-spacing: 0.02em;
}

.dock-item.active {
  background: rgba(var(--primary-rgb), 0.14);
  color: var(--primary);
}

.dock-item.active .dock-icon {
  transform: translateY(-1px) scale(1.08);
}

.dock-item.active .dock-label {
  font-weight: 700;
}

/* 移动端：胶囊贴底全宽（可横向滚动） */
@media (max-width: 640px) {
  .dock-bar {
    left: 50%;
    right: auto;
    bottom: calc(10px + env(safe-area-inset-bottom, 0px));
    max-width: calc(100vw - 16px);
    padding: 6px 7px;
    border-radius: 20px;
    justify-content: flex-start;
  }

  .dock-item {
    min-width: 52px;
    padding: 5px 7px;
  }

  html[data-layout="dock"] .main {
    padding-bottom: calc(96px + env(safe-area-inset-bottom, 0px));
  }
}

/* 宽屏下悬浮栏保持在底部居中，不遮挡内容 */
@media (min-width: 1024px) {
  html[data-layout="dock"] .container {
    max-width: 980px;
  }
}

/* ========================================================================== */
/* v14：外观设置二级面板 / 侧栏左滑 / 通知面板主题化                            */
/* ========================================================================== */

/* --- 顶栏主题触发按钮 --- */
.theme-trigger {
  color: var(--text-soft);
}

.theme-trigger:hover,
.theme-trigger[aria-expanded="true"] {
  color: var(--primary);
  background: var(--primary-soft);
}

/* --- 遮罩 --- */
.theme-sheet-mask {
  position: fixed;
  inset: 0;
  z-index: 98;
  background: rgba(20, 18, 17, 0.42);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  animation: mask-in 0.16s ease-out;
}

/* --- 面板（右上滑出，宽 360，移动端全宽贴底） --- */
/* v21：改为顶栏下拉面板，提高不透明度与主题保持一致 */
.theme-sheet {
  position: fixed;
  top: 58px;
  right: 14px;
  z-index: 99;
  display: flex;
  flex-direction: column;
  width: min(92vw, 340px);
  max-height: min(78vh, 620px);
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: 0 26px 60px -24px rgba(20, 18, 17, 0.55);
  animation: sheet-in 0.18s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes sheet-in {
  from {
    transform: translateX(100%);
    opacity: 0.6;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* 主题化：玻璃主题 */
html[data-theme="glass"] .theme-sheet {
  background: rgba(var(--surface-rgb), 0.97);
  border-color: rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(26px) saturate(1.4);
  -webkit-backdrop-filter: blur(26px) saturate(1.4);
}

html[data-mode="dark"][data-theme="glass"] .theme-sheet {
  background: rgba(var(--surface-rgb), 0.97);
  border-color: rgba(255, 255, 255, 0.14);
}

/* 头部 */
.theme-sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border-soft);
}

.theme-sheet-title {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
}

.theme-sheet-title i {
  color: var(--primary);
}

.theme-sheet-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  font-size: 15px;
  cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease;
}

.theme-sheet-close:hover {
  color: var(--primary);
  background: var(--primary-soft);
}

/* 内容区 */
.theme-sheet-body {
  flex: 1 1 auto;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 16px 18px 8px;
}

.theme-section {
  margin-bottom: 20px;
}

.theme-section-title {
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* --- 配色：色板按钮 --- */
/* 配色主题：横向滑动选择（左右滑动，吸附对齐） */
.theme-swatches {
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 2px 2px 8px;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.theme-swatches::-webkit-scrollbar {
  display: none;
}

.theme-swipe-hint {
  margin-left: 8px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
}

.theme-swatch {
  position: relative;
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 8px;
  min-width: 104px;
  scroll-snap-align: start;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: rgba(var(--surface-rgb), 0.55);
  color: var(--text-soft);
  font: inherit;
  font-size: 12.5px;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease;
}

.theme-swatch:hover {
  transform: translateY(-1px);
  border-color: rgba(var(--primary-rgb), 0.45);
}

.theme-swatch.active {
  border-color: var(--primary);
  background: rgba(var(--primary-rgb), 0.1);
  color: var(--primary);
  font-weight: 600;
}

.theme-swatch-dot {
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08);
}

.dot-glass { background: linear-gradient(135deg, #5b7cfa, #a8c0ff); }
.dot-cinnabar { background: linear-gradient(135deg, #c01e25, #e8896f); }
.dot-ocean { background: linear-gradient(135deg, #1f6f8b, #6fc3d8); }
.dot-forest { background: linear-gradient(135deg, #2f6b4f, #7fc79a); }
.dot-violet { background: linear-gradient(135deg, #7454a8, #b79ee0); }
.dot-rose { background: linear-gradient(135deg, #c2447a, #e79ab8); }
.dot-amber { background: linear-gradient(135deg, #b5791f, #e5c383); }
.dot-slate { background: linear-gradient(135deg, #4b5d73, #9fb3c8); }
.dot-mint { background: linear-gradient(135deg, #1f8a70, #7ad3b8); }

.theme-swatch-label {
  flex: 1 1 auto;
  text-align: left;
}

.theme-swatch-check {
  flex: 0 0 auto;
  font-size: 10px;
}

/* --- 布局：带示意图的卡片 --- */
.theme-layouts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 9px;
}

.theme-layout {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 10px 6px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: rgba(var(--surface-rgb), 0.55);
  color: var(--text-soft);
  font: inherit;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease;
}

.theme-layout:hover {
  transform: translateY(-1px);
  border-color: rgba(var(--primary-rgb), 0.45);
}

.theme-layout.active {
  border-color: var(--primary);
  background: rgba(var(--primary-rgb), 0.1);
}

/* 缩略示意 */
.theme-layout-preview {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border-radius: 6px;
  background: rgba(var(--line-rgb), 0.1);
  padding: 4px;
}

.theme-layout-preview .pv-bar {
  display: block;
  height: 18%;
  border-radius: 2px;
  background: rgba(var(--primary-rgb), 0.35);
}

.theme-layout-preview .pv-body {
  display: flex;
  gap: 3px;
  height: 78%;
  margin-top: 3px;
}

.theme-layout-preview .pv-content {
  flex: 1 1 auto;
  border-radius: 2px;
  background: rgba(var(--line-rgb), 0.18);
}

.theme-layout-preview .pv-nav {
  flex: 0 0 22%;
  border-radius: 2px;
  background: rgba(var(--primary-rgb), 0.22);
}

/* 侧边栏：左侧竖条 */
.theme-layout-preview.pv-sidebar .pv-bar {
  height: 10%;
}

/* 悬浮栏：底部横向条 */
.theme-layout-preview.pv-dock .pv-body {
  position: relative;
}

.theme-layout-preview.pv-dock .pv-nav {
  position: absolute;
  left: 15%;
  right: 15%;
  bottom: 2px;
  height: 24%;
  flex: none;
  border-radius: 6px;
  background: rgba(var(--primary-rgb), 0.45);
}

.theme-layout-name {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text);
}

.theme-layout.active .theme-layout-name {
  color: var(--primary);
}

.theme-layout-desc {
  color: var(--muted);
  font-size: 10.5px;
  text-align: center;
}

/* --- 明暗模式 --- */
.theme-modes {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
}

.theme-mode-opt {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: rgba(var(--surface-rgb), 0.55);
  color: var(--text-soft);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.theme-mode-opt:hover {
  border-color: rgba(var(--primary-rgb), 0.45);
}

.theme-mode-opt.active {
  border-color: var(--primary);
  background: rgba(var(--primary-rgb), 0.12);
  color: var(--primary);
  font-weight: 600;
}

/* 底部 */
.theme-sheet-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 18px calc(15px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--border-soft);
}

.theme-sheet-hint {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}

/* 移动端：面板贴底全宽 */
@keyframes sheet-up {
  from {
    transform: translateY(100%);
  }
    to {
      transform: translateY(0);
    }
  }

@media (max-width: 640px) {
  .theme-sheet {
    top: auto;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    max-height: 82dvh;
    border-left: 0;
    border-top: 1px solid var(--border);
    border-radius: 20px 20px 0 0;
    animation: sheet-up 0.26s cubic-bezier(0.22, 1, 0.36, 1);
  }

  .theme-swatch {
    min-width: 96px;
  }

  .theme-layouts {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .theme-sheet-hint {
    display: none;
  }

  .theme-sheet-foot .btn {
    width: 100%;
    justify-content: center;
  }
}

/* --- 通知面板：彻底去白底，全主题适配 --- */
.notify-panel {
  background: var(--surface) !important;
}

html[data-theme="glass"] .notify-panel {
  background: rgba(var(--surface-rgb), 0.9) !important;
}

html[data-mode="dark"] .notify-panel {
  background: var(--surface) !important;
  border-color: var(--border);
}

html[data-mode="dark"][data-theme="glass"] .notify-panel {
  background: rgba(var(--surface-rgb), 0.94) !important;
}

.notify-head {
  background: rgba(var(--line-rgb), 0.04);
}

.notify-item {
  background: transparent;
}

.notify-empty {
  background: transparent;
}

/* ========================================================================== */
/* v17：侧栏抽屉主题适配 / 宽度收敛                                            */
/* ========================================================================== */

/* 玻璃主题：毛玻璃 + 半透明，不出现纯白 */
/* v21：提高侧栏不透明度，避免背景透出影响可读性 */
html[data-theme="glass"] .side-drawer {
  background: rgba(var(--surface-rgb), 0.96);
  border-right-color: rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(28px) saturate(1.5);
  -webkit-backdrop-filter: blur(28px) saturate(1.5);
}

html[data-mode="dark"][data-theme="glass"] .side-drawer {
  background: rgba(var(--surface-rgb), 0.97);
  border-right-color: rgba(255, 255, 255, 0.14);
}

/* 非玻璃主题：用卡片色而非纯白 */
html:not([data-theme="glass"]) .side-drawer {
  background: var(--surface-soft);
}

html[data-mode="dark"]:not([data-theme="glass"]) .side-drawer {
  background: var(--surface);
  border-right-color: var(--border);
}

/* 抽屉内部：头部/导航/底部尺寸收敛 */
.side-drawer-head {
  flex: 0 0 auto;
  padding: 16px 16px 13px;
}

.side-drawer-nav {
  flex: 1 1 auto;
  min-height: 0;
  padding: 10px 8px;
  overscroll-behavior: contain;
}

.side-drawer-item {
  margin-bottom: 2px;
  padding: 10px 12px;
  font-size: 13.5px;
}

.side-drawer-item i {
  width: 17px;
  font-size: 13.5px;
}

.side-drawer-foot {
  flex: 0 0 auto;
  padding: 10px 14px calc(12px + env(safe-area-inset-bottom, 0px));
}

/* 遮罩：跟随主题明暗 */
html[data-mode="dark"] .side-mask {
  background: rgba(0, 0, 0, 0.52);
}

/* 移动端：更窄 */
@media (max-width: 480px) {
  .side-drawer {
    width: min(72vw, 248px);
  }
}

@media (max-width: 360px) {
  .side-drawer {
    width: 82vw;
  }
}

/* ========================================================================== */
/* v19：前台自动日夜切换行                                                     */
/* ========================================================================== */

.theme-auto-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 13px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: rgba(var(--surface-rgb), 0.55);
}

.theme-auto-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.theme-auto-label {
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
}

.theme-auto-desc {
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.5;
}

/* 开关组件（前台 v19 新增） */
.switch {
  position: relative;
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  width: 42px;
  height: 24px;
  cursor: pointer;
}

.switch input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.switch > span {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 999px;
  background: rgba(var(--line-rgb), 0.28);
  transition: background 0.2s ease;
}

.switch > span::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
  transition: transform 0.2s cubic-bezier(0.22, 1, 0.36, 1);
}

.switch input:checked + span {
  background: var(--primary);
}

.switch input:checked + span::after {
  transform: translateX(18px);
}

.switch input:focus-visible + span {
  outline: 2px solid rgba(var(--primary-rgb), 0.45);
  outline-offset: 2px;
}

/* ========================================================================== */
/* v21：顶部站点标题宽度（避免过早截断）                                       */
/* ========================================================================== */

.brand-text {
  min-width: 0;
  max-width: 100%;
}

.brand-text strong {
  display: block;
  overflow: hidden;
  max-width: min(46vw, 260px);
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 小屏进一步收紧，但仍保留可读长度 */
@media (max-width: 640px) {
  .brand-text strong {
    max-width: min(52vw, 220px);
  }
}

@media (max-width: 420px) {
  .brand-text strong {
    max-width: min(58vw, 200px);
  }
}

/* 品牌区可用的剩余空间 */
.brand {
  flex: 0 1 auto;
  min-width: 0;
}

/* ========================================================================== */
/* v27：概览/侧栏行内徽章、等级头像框与昵称、永久会员标签、移动端顶栏           */
/* ========================================================================== */

/* --- 概览页用户名行：昵称 + 组徽章 + 到期（/永久）同一行 --- */
.user-line {
  min-width: 0;
  flex-wrap: wrap;
}

.user-name {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px 9px;
  min-width: 0;
  margin: 0;
  line-height: 1.25;
}

.user-name-text {
  min-width: 0;
  overflow-wrap: anywhere;
}

.user-name .badge {
  flex: 0 0 auto;
}

.user-name .badge.group-badge {
  padding: 1px 8px;
  font-size: 11.5px;
  line-height: 1.6;
}

.user-name .group-badge-img {
  max-height: 18px;
  max-width: 120px;
}

/* 窄屏允许换行，但仍在同一视觉组内 */
@media (max-width: 640px) {
  .user-name {
    gap: 6px 8px;
    font-size: 19px;
  }

  .user-name .badge.group-badge {
    font-size: 11px;
  }
}

/* --- 等级昵称色：会员红 / 超级会员金（可用 --member-accent 覆盖） --- */
.user-name,
.user-hero-name {
  transition: color 0.2s ease;
}

.user-name.is-vip .user-name-text,
.user-hero-name.is-vip {
  color: var(--member-accent, #e04349);
}

.user-name.is-super .user-name-text,
.user-hero-name.is-super {
  background: linear-gradient(92deg, var(--member-accent, #d4a017) 0%, #f7e3a1 46%, var(--member-accent, #d4a017) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
}

/* --- 等级头像框：会员红描边光晕 / 超级会员金色渐变环 --- */
.avatar.level-vip {
  border-color: var(--member-accent, #e04349);
  box-shadow: 0 0 0 2px var(--member-accent-weak, rgba(224, 67, 73, 0.16)),
    0 8px 18px -12px var(--member-accent, #e04349);
}

.avatar.level-super {
  box-sizing: border-box;
  padding: 2px;
  border: 0;
  background: conic-gradient(
    from 0deg,
    var(--member-accent, #d4a017),
    #fff1b8,
    var(--member-accent, #d4a017),
    #f5d67c,
    var(--member-accent, #d4a017)
  );
  box-shadow: 0 0 0 2px var(--member-accent-weak, rgba(212, 160, 23, 0.16)),
    0 8px 22px -10px var(--member-accent, #d4a017);
  animation: member-ring-glow 3.6s ease-in-out infinite;
}

.avatar.level-super img {
  border-radius: 50%;
}

@keyframes member-ring-glow {
  0%,
  100% {
    box-shadow: 0 0 0 2px var(--member-accent-weak, rgba(212, 160, 23, 0.16)),
      0 8px 22px -10px var(--member-accent, #d4a017);
  }
  50% {
    box-shadow: 0 0 0 3px var(--member-accent-soft, rgba(212, 160, 23, 0.38)),
      0 10px 26px -8px var(--member-accent, #d4a017);
  }
}

/* --- 永久会员标签：红/金渐变底 + 描边 + 皇冠 + 流光 --- */
.badge.badge-permanent {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(212, 160, 23, 0.55);
  background: linear-gradient(135deg, rgba(212, 160, 23, 0.22), rgba(255, 241, 184, 0.5), rgba(212, 160, 23, 0.22));
  color: #8a5b00;
  font-weight: 700;
  letter-spacing: 0.02em;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.28), 0 2px 10px -4px rgba(212, 160, 23, 0.6);
}

.badge.badge-permanent i {
  font-size: 10px;
  color: #d4a017;
}

.badge.badge-permanent::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: -70%;
  width: 45%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.7), transparent);
  transform: skewX(-20deg);
  animation: badge-shimmer 3.4s ease-in-out infinite;
  pointer-events: none;
}

.badge.badge-permanent-vip {
  border-color: rgba(224, 67, 73, 0.5);
  background: linear-gradient(135deg, rgba(224, 67, 73, 0.18), rgba(255, 235, 236, 0.55), rgba(224, 67, 73, 0.18));
  color: #b02a31;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.28), 0 2px 10px -4px rgba(224, 67, 73, 0.55);
}

.badge.badge-permanent-vip i {
  color: #e04349;
}

.badge.badge-permanent-super {
  border-color: rgba(212, 160, 23, 0.7);
}

html[data-mode="dark"] .badge.badge-permanent {
  background: linear-gradient(135deg, rgba(212, 160, 23, 0.32), rgba(255, 241, 184, 0.14), rgba(212, 160, 23, 0.32));
  color: #f2d98c;
}

html[data-mode="dark"] .badge.badge-permanent-vip {
  background: linear-gradient(135deg, rgba(224, 67, 73, 0.32), rgba(255, 235, 236, 0.12), rgba(224, 67, 73, 0.32));
  color: #ffb3b7;
}

@keyframes badge-shimmer {
  0% {
    left: -70%;
  }
  55%,
  100% {
    left: 130%;
  }
}

/* --- UserHero：到期/永久徽章收敛到昵称行 --- */
.user-hero-name-row .badge.badge-expiry,
.user-hero-name-row .badge.badge-permanent {
  padding: 1px 7px;
  font-size: 10.5px;
}

.side-drawer-head .user-hero-name-row .badge.badge-expiry,
.side-drawer-head .user-hero-name-row .badge.badge-permanent {
  padding: 1px 7px;
  font-size: 10.5px;
}

/* --- 手机端顶栏图标放大：字号 >=19px、热区 >=40x40 --- */
@media (max-width: 640px) {
  .topbar-inner {
    flex-wrap: nowrap;
    gap: 8px;
    min-height: 60px;
  }

  /* 顶栏变高后通知面板下移，避免压住图标 */
  .notify-panel {
    top: 62px;
    max-height: calc(100dvh - 82px);
  }

  .topnav {
    flex-wrap: nowrap;
    gap: 2px;
  }

  .topbar .icon-link,
  .topnav .icon-link,
  .topbar .notify-btn {
    width: 42px;
    height: 42px;
    min-width: 42px;
    padding: 0 !important;
    font-size: 20px;
  }

  .notify-btn {
    height: 42px;
  }

  .notify-dot {
    top: -3px;
    right: -3px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    font-size: 10.5px;
    line-height: 18px;
  }

  .brand-text strong {
    max-width: min(46vw, 200px);
  }
}

@media (max-width: 360px) {
  .brand-text strong {
    max-width: 30vw;
  }
}

/* --- 无障碍：减少动态效果 --- */
@media (prefers-reduced-motion: reduce) {
  .avatar.level-super {
    animation: none;
  }

  .badge.badge-permanent::after {
    animation: none;
    display: none;
  }
}


/* ==========================================================================
 * v29：概览页「登录 IP 归属地」标签
 * v29.2：与邮箱同一行，移动端强制不换行（邮箱/地址超长时各自省略，标签不换行）。
 * 数据由浏览器本地请求 ipwho.is 解析（非服务器代理）；境外/机房 IP 标红，
 * 机房/数据中心额外显示警告图标；接口失败或无有效 IP 时不渲染（见 app.js ipGeo.show）。
 * ========================================================================== */
.user-email-line {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
  min-width: 0;
  max-width: 100%;
  margin-top: 2px;
  white-space: nowrap;
}

.user-email-text {
  flex: 0 1 auto;
  min-width: 0;
  max-width: 100%;
  margin-top: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  word-break: normal;
}

.login-ip-tag {
  display: inline-flex;
  flex: 0 1 auto;
  align-items: center;
  gap: 5px;
  min-width: 0;
  padding: 2px 9px 2px 8px;
  border: 1px solid var(--border-soft);
  border-radius: 999px;
  background: rgba(var(--line-rgb), 0.07);
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.6;
  white-space: nowrap;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.login-ip-tag > i.fa-location-dot {
  flex: 0 0 auto;
  font-size: 10.5px;
  opacity: 0.85;
}

.login-ip-tag .login-ip-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.login-ip-tag.is-overseas {
  color: #c01e25;
  border-color: rgba(192, 30, 37, 0.38);
  background: rgba(192, 30, 37, 0.1);
}

.login-ip-tag.is-idc {
  border-style: dashed;
}

.login-ip-tag .ip-idc-icon {
  flex: 0 0 auto;
  color: #b45309;
  font-size: 11px;
}

html[data-mode="dark"] .login-ip-tag.is-overseas {
  color: #ff9b9b;
  border-color: rgba(255, 120, 120, 0.42);
  background: rgba(255, 80, 80, 0.16);
}

html[data-mode="dark"] .login-ip-tag .ip-idc-icon {
  color: #f0b45e;
}

@media (max-width: 640px) {
  .login-ip-tag {
    font-size: 11px;
  }
}

/* v29.3：设备管理列表里的 IP 归属地标签（跟在 IP 后面，比概览小一号） */
.device-meta .login-ip-tag,
.device-ip-tag {
  padding: 1px 8px 1px 7px;
  font-size: 11px;
}

.device-meta .login-ip-tag > i.fa-location-dot {
  font-size: 10px;
}

/* v35：页面切换动画（轻量、主题无关、尊重 reduced-motion） */
.page-enter-active,
.page-leave-active {
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.page-enter-from {
  opacity: 0;
  transform: translateY(6px);
}

.page-leave-to {
  opacity: 0;
  transform: translateY(-4px);
}

@media (prefers-reduced-motion: reduce) {
  .page-enter-active,
  .page-leave-active {
    transition: none;
  }
}
