/* ============================================================
   登录页 & 管理后台样式（Soft UI 柔和浮雕）
   ============================================================ */

/* ---------- 登录页 ---------- */
.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
  background: var(--surface) var(--bg-grad);
  background-attachment: fixed;
}
.login-card {
  width: 100%;
  max-width: 380px;
  padding: 36px 32px;
  border-radius: 28px;
}
.login-card h1 {
  margin: 0 0 4px;
  font-size: 22px;
  text-align: center;
  color: var(--text);
  text-shadow: 0 1px 0 var(--sh-light);
}
.login-card .sub {
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 26px;
}
.login-card .btn-primary {
  width: 100%;
  padding: 11px;
  font-size: 15px;
  margin-top: 6px;
}
.login-back {
  text-align: center;
  margin-top: 18px;
  font-size: 13px;
}
.login-error {
  color: var(--danger);
  font-size: 13px;
  text-align: center;
  min-height: 18px;
  margin-bottom: 10px;
}

/* ---------- 管理后台布局 ---------- */
.admin-wrap {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px 20px var(--page-bottom, 60px);
}
.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--gap-header, 12px);
  padding: var(--header-padding, 12px 22px);
  margin-bottom: var(--section-margin, 20px);
  border-radius: 999px;
}
.admin-header .brand {
  font-weight: 700;
  font-size: 16px;
}
.admin-tabs {
  display: flex;
  justify-content: center;
  gap: var(--gap-tabs, 6px);
  padding: var(--tabs-padding, 6px);
  margin-bottom: var(--section-margin, 20px);
  overflow-x: auto;
  background: var(--surface);
  border: 1px solid var(--edge);
  border-radius: 999px;
  box-shadow: var(--inset);
}
.admin-tabs .tab {
  padding: var(--tab-padding, 8px 20px);
  font-size: 14px;
  border-radius: 999px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--tr) var(--ease);
}
.admin-tabs .tab:hover {
  color: var(--text);
}
.admin-tabs .tab.active {
  background: var(--surface);
  color: var(--accent);
  font-weight: 600;
  box-shadow: var(--raised-sm);
}
.admin-panel {
  padding: var(--panel-padding, 22px 24px);
  border-radius: 26px;
  overflow-x: auto; /* 窄屏时表格横向滚动，避免按钮挤压换行 */
}
.admin-panel[hidden] {
  display: none;
}
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--gap-panel-head, 12px);
  margin-bottom: var(--subsection-margin, 16px);
  flex-wrap: wrap;
}
.panel-head h2 {
  margin: 0;
  font-size: 17px;
}

/* 图标预览（小凸起） */
.icon-preview {
  width: 46px;
  height: 46px;
  border-radius: 13px;
  background: var(--surface);
  box-shadow: var(--raised-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 700;
  color: var(--accent);
  overflow: hidden;
  flex-shrink: 0;
}
.icon-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ============================================================
   文字图标 grid 通用层（后台表格 span 直接生效，无父 flex）
   ============================================================ */
.icon-grid-cn {
  display: grid !important;
  grid-template-columns: 1fr 1fr !important;
  grid-template-rows: 1fr 1fr !important;
  gap: 0 !important;
}
.icon-wrap-en {
  display: grid !important;
  grid-template-columns: 1fr 1fr 1fr 1fr !important;
  gap: 0 !important;
}
.icon-grid-cn .child-text,
.icon-wrap-en .child-text {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  line-height: 1 !important;
}

/* ============================================================
   .icon-preview 特异度层（覆盖自身 display:flex）+ 全属性 !important
   ============================================================ */
.icon-preview.icon-grid-cn {
  display: grid !important;
  grid-template-columns: 1fr 1fr !important;
  grid-template-rows: 1fr 1fr !important;
  gap: 0 !important;
  align-items: stretch !important;
  justify-items: stretch !important;
  padding: 4px !important;
  font-weight: 600 !important;
}
.icon-preview.icon-wrap-en {
  display: grid !important;
  grid-template-columns: 1fr 1fr 1fr 1fr !important;
  gap: 0 !important;
  align-items: stretch !important;
  justify-items: stretch !important;
  padding: 3px !important;
  font-weight: 500 !important;
  letter-spacing: -0.3px !important;
}

/* 上传行（保持单行：输入框可收缩，按钮不换行不压缩） */
.upload-row {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: nowrap;
}
.upload-row .input {
  flex: 1;
  min-width: 0;
}
.upload-row .icon-preview {
  flex-shrink: 0;
}
.upload-row .btn {
  flex-shrink: 0;
  white-space: nowrap;
  padding: 8px 14px;
}
.upload-row input[type='file'] {
  display: none;
}

/* 搜索引擎编辑行 */
.engine-row {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
  align-items: center;
}
.engine-row .input {
  flex: 1;
  min-width: 0;
}
.engine-row .engine-name {
  flex: 0 0 120px;
}
.engine-row .btn {
  flex-shrink: 0;
  white-space: nowrap;
}

/* 滑动条（Soft UI 内凹轨道 + 凸起圆形滑块） */
input[type='range'].range {
  width: 100%;
  height: 24px;
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  border: none;
  box-shadow: none;
  padding: 0;
  margin: 4px 0 2px;
  cursor: pointer;
}
input[type='range'].range:focus {
  outline: none;
}
input[type='range'].range::-webkit-slider-runnable-track {
  height: 8px;
  border-radius: 999px;
  background: var(--surface);
  box-shadow: inset 2px 2px 5px var(--sh-dark), inset -2px -2px 5px var(--sh-light);
}
input[type='range'].range::-webkit-slider-thumb {
  appearance: none;
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  margin-top: -6px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--surface);
  box-shadow: 2px 2px 5px var(--sh-dark), 0 0 8px var(--accent-glow);
  transition: transform var(--tr) var(--ease);
}
input[type='range'].range::-webkit-slider-thumb:hover {
  transform: scale(1.12);
}
input[type='range'].range::-moz-range-track {
  height: 8px;
  border-radius: 999px;
  background: var(--surface);
  box-shadow: inset 2px 2px 5px var(--sh-dark), inset -2px -2px 5px var(--sh-light);
}
input[type='range'].range::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--surface);
  box-shadow: 2px 2px 5px var(--sh-dark), 0 0 8px var(--accent-glow);
}
.range-val {
  color: var(--accent);
  font-weight: 700;
}

/* 设置预览图 */
.setting-preview {
  max-width: 200px;
  max-height: 90px;
  border-radius: 14px;
  margin-top: 8px;
  box-shadow: var(--raised-sm);
  display: none;
}
.setting-preview.show {
  display: block;
}

/* 单选组 */
.radio-group {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 14px;
}
.radio-group label {
  display: flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
}

/* ---------- 站点设置分区（每分区独立保存） ---------- */
.settings-section {
  background: var(--surface);
  border: 1px solid var(--edge);
  border-radius: 18px;
  box-shadow: var(--raised-sm);
  padding: 16px 18px 2px;
  margin-bottom: 14px;
}
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--edge);
}
.section-head h3 {
  margin: 0;
  font-size: 15px;
}
.section-save {
  flex-shrink: 0;
  min-width: 72px;
}
.sub-group-title {
  margin: 18px 0 10px;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--bg-soft);
  border-left: 3px solid var(--accent);
  border-radius: 6px;
}

/* ---------- 顶栏版本号 / 更新日志 ---------- */
.brand .ver {
  margin-left: 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
}
.changelog .log-item {
  background: var(--surface);
  border: 1px solid var(--edge);
  border-radius: 14px;
  box-shadow: var(--raised-sm);
  padding: 14px 16px;
  margin-bottom: 12px;
}
.changelog .log-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 6px;
}
.changelog .log-ver {
  font-weight: 700;
  font-size: 14.5px;
  color: var(--accent);
}
.changelog .log-date {
  font-size: 12px;
  color: var(--text-muted);
}
.changelog ul {
  margin: 0;
  padding-left: 18px;
}
.changelog li {
  font-size: 13.5px;
  line-height: 2;
  color: var(--text);
}

/* ---------- 壁纸图库 ---------- */
.wp-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
}
.wp-item {
  position: relative;
  aspect-ratio: 16 / 9;
  border-radius: 14px;
  overflow: hidden;
  cursor: pointer;
  background: var(--surface);
  border: 1px solid var(--edge-weak);
  box-shadow: var(--raised-sm);
  transition: box-shadow var(--tr) var(--ease), transform var(--tr) var(--ease),
    border-color var(--tr) var(--ease);
}
.wp-item:hover {
  transform: translateY(-2px);
  box-shadow: var(--raised);
}
.wp-item.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft), var(--raised-sm);
}
.wp-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.wp-item .wp-name {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 3px 7px;
  font-size: 11px;
  color: #fff;
  background: rgba(0, 0, 0, 0.45);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
}
.wp-item .wp-del {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 22px;
  height: 22px;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.5);
  color: #fff;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--tr) var(--ease);
}
.wp-item .wp-del:hover {
  background: var(--danger);
  color: var(--on-danger, #fff);
}
/* 预置壁纸角标（系统自带，不可删除） */
.wp-item .wp-tag {
  position: absolute;
  top: 5px;
  left: 5px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 10px;
  line-height: 1.4;
  color: var(--on-accent, #fff);
  background: var(--accent);
  opacity: 0.92;
  pointer-events: none;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
}
.wp-gallery-modal {
  max-height: 60vh;
  overflow-y: auto;
  padding: 2px;
}
.wp-gallery-empty {
  grid-column: 1 / -1;
  font-size: 13px;
  color: var(--text-muted);
  padding: 8px 2px;
}

/* 图库分区：内置 / 我的上传 */
.wp-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.wp-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--edge);
  background: var(--surface);
  color: var(--text-muted);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--tr) var(--ease), color var(--tr) var(--ease),
    border-color var(--tr) var(--ease), box-shadow var(--tr) var(--ease);
}
.wp-tab:hover { color: var(--text); }
.wp-tab.active {
  background: var(--accent);
  border-color: transparent;
  color: var(--on-accent, #fff);
  box-shadow: var(--raised-sm);
}
.wp-tab .wp-count { font-size: 12px; opacity: 0.78; }

/* 每日壁纸源随机预览 */
.dwp-section { margin-bottom: 18px; }
.dwp-section:last-child { margin-bottom: 4px; }
.dwp-head {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.dwp-head b { font-size: 13.5px; }
.dwp-state {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}
.dwp-actions { margin-left: auto; display: flex; gap: 6px; }
.dwp-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}
.dwp-thumb {
  position: relative;
  aspect-ratio: 16 / 9;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--edge-weak);
  background: var(--surface-2);
  cursor: pointer;
  transition: border-color var(--tr) var(--ease), box-shadow var(--tr) var(--ease),
    transform var(--tr) var(--ease);
}
.dwp-thumb:hover {
  border-color: var(--accent);
  box-shadow: var(--raised-sm);
  transform: translateY(-1px);
}
.dwp-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 320ms var(--ease);
}
.dwp-thumb:hover img { transform: scale(1.06); }
.dwp-thumb.loading { pointer-events: none; opacity: 0.55; }
.dwp-thumb .dwp-tip {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 4px 6px;
  font-size: 10px;
  line-height: 1.3;
  color: #fff;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.62));
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
}
.dwp-loading {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 90px;
  font-size: 12px;
  color: var(--text-muted);
  background: var(--surface-2);
  border-radius: 10px;
}
@media (max-width: 640px) {
  .dwp-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* 时钟/天气字体预览 */
.font-preview,
.clock-font-preview {
  margin-top: 10px;
  padding: 12px 16px;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid var(--edge-weak);
  font-size: 28px;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--text);
  line-height: 1.2;
}
.font-preview span,
.clock-font-preview span {
  margin-left: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0;
}

/* 外观与卡片：内部二级导航与分栏 */
.theme-subnav {
  margin-bottom: 18px;
}
.theme-subnav .subtab {
  padding: 6px 13px;
  font-size: 12.5px;
}
.subpane {
  animation: subpaneIn 160ms ease-out;
}
.subpane[hidden] { display: none !important; }
@keyframes subpaneIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: none; }
}

/* ============ 权限组徽章 ============ */
.role-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12px;
  line-height: 20px;
  white-space: nowrap;
  border: 1px solid var(--edge);
  background: var(--surface);
  color: var(--text-muted);
}
.role-badge.role-admin {
  color: #b45309;
  background: rgba(245, 158, 11, 0.12);
  border-color: rgba(245, 158, 11, 0.4);
}
.role-badge.role-editor {
  color: #1d4ed8;
  background: rgba(59, 130, 246, 0.12);
  border-color: rgba(59, 130, 246, 0.4);
}
[data-theme='dark'] .role-badge.role-admin {
  color: #fbbf24;
}
[data-theme='dark'] .role-badge.role-editor {
  color: #93c5fd;
}

/* 权限组图例说明 */
.perm-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 14px;
  font-size: 12.5px;
  color: var(--text-muted);
  background: var(--surface);
  border: 1px solid var(--edge);
  border-radius: 12px;
  padding: 10px 14px;
  margin-bottom: 14px;
}

/* 只读用户：隐藏所有新增 / 编辑 / 排序入口 */
body.role-viewer #addItemBtn,
body.role-viewer #addGroupBtn,
body.role-viewer .table .actions {
  display: none;
}
/* 只读用户：可见显示状态，但不可切换 */
body.role-viewer .btn-vis {
  display: none;
}
/* 只读用户：隐藏拖拽排序入口（分组表格手柄 / 新闻源手柄 / 排序保存按钮） */
body.role-viewer .drag-handle,
body.role-viewer .ns-handle,
body.role-viewer #saveGroupsOrderBtn,
body.role-viewer #resetGroupsOrderBtn {
  display: none !important;
}
/* 只读用户：新闻源勾选框动态渲染，JS 禁用可能晚于渲染，CSS 兜底禁止交互 */
body.role-viewer .news-source-item input[type="checkbox"] {
  pointer-events: none;
  opacity: 0.45;
}
/* 只读用户：被 JS 禁用的控件统一灰化（玻璃拟态控件自带背景，需显式反馈） */
body.role-viewer .input:disabled,
body.role-viewer .select:disabled,
body.role-viewer .textarea:disabled,
body.role-viewer .btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
body.role-viewer .btn:disabled:hover {
  transform: none;
  background: var(--surface);
}

/* ============ 分组前端显示 / 隐藏 ============ */
.vis-cell {
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}
.vis-badge {
  display: inline-block;
  min-width: 42px;
  text-align: center;
  font-size: 12px;
  line-height: 20px;
  padding: 0 8px;
  border-radius: 999px;
  background: rgba(52, 199, 123, 0.15);
  color: #1f9d61;
  border: 1px solid rgba(52, 199, 123, 0.35);
}
.vis-badge:not(.on) {
  background: rgba(128, 128, 128, 0.12);
  color: var(--text-muted);
  border-color: rgba(128, 128, 128, 0.3);
}
tr.row-hidden > td {
  opacity: 0.62;
}
.form-item-inline {
  margin-top: 6px;
}

/* ============ 备份与恢复 ============ */
.backup-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.backup-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: var(--surface);
  border: 1px solid var(--edge);
  border-radius: 14px;
  padding: 14px 16px;
}
.backup-row .btn {
  flex-shrink: 0;
  white-space: nowrap;
}

.backup-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
  color: var(--text-muted);
}
.backup-info b {
  font-size: 14px;
  color: var(--text);
}
.backup-info .danger-text {
  color: #c0392b;
}
[data-theme='dark'] .backup-info .danger-text {
  color: #ff8a80;
}

/* 卡片表「分组」标签：浅底胶囊，一眼可辨归属；点击即按该分组筛选 */
.item-group-tag {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12px;
  line-height: 18px;
  background: var(--accent-weak, rgba(92, 124, 250, 0.12));
  color: var(--accent);
  border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
}
button.item-group-tag {
  font-family: inherit;
  cursor: pointer;
  transition: background-color 160ms ease-out, border-color 160ms ease-out;
}
button.item-group-tag:hover {
  background: color-mix(in srgb, var(--accent) 20%, transparent);
  border-color: var(--accent);
}

/* ============ 账号设置：上下单列布局（账号信息 / 修改密码） ============ */
.account-grid {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.account-card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--edge);
  border-radius: 18px;
  box-shadow: var(--raised-sm);
  padding: 18px 20px;
}
.account-card-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 14px;
}
/* 账号区：多字段同一行横向并列 */
.acc-inline-row {
  display: flex;
  align-items: flex-end;
  gap: 16px;
  flex-wrap: wrap;
}
.acc-inline-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1 1 0;
  min-width: 0;
}
.acc-inline-item.acc-inline-grow {
  flex: 2 1 0;
}
.acc-inline-btn {
  flex: 0 0 auto;
  justify-content: flex-end;
}
.acc-inline-item .k {
  font-size: 13px;
  color: var(--text-muted);
}
.acc-inline-item .v {
  color: var(--text);
  font-weight: 600;
  font-size: 14px;
  line-height: 2.2;
}
.acc-input-wrap {
  display: flex;
  gap: 8px;
}
.acc-input-wrap > .input {
  flex: 1;
  min-width: 0;
}
/* 保存按钮：小圆角，与横向布局搭配 */
.acc-save-btn {
  border-radius: 8px;
  padding: 8px 16px;
  flex: 0 0 auto;
}
@media (max-width: 640px) {
  .account-card {
    padding: 14px 16px;
  }
  .acc-inline-item {
    flex: 1 1 100%;
  }
}

/* ============ 拖拽排序（卡片 / 分组） ============ */
.drag-cell {
  width: 36px;
  text-align: center;
}
.drag-handle {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 8px;
  font-size: 15px;
  line-height: 1.4;
  color: var(--text-muted);
  cursor: grab;
  user-select: none;
  transition: all 0.18s cubic-bezier(0.33, 1, 0.68, 1);
}
.drag-handle:hover {
  color: var(--accent);
  background: var(--accent-weak, rgba(92, 124, 250, 0.12));
  box-shadow: inset 1px 1px 3px rgba(163, 175, 198, 0.35), inset -1px -1px 3px rgba(255, 255, 255, 0.85);
}
.drag-handle:active {
  cursor: grabbing;
}
.drag-handle.disabled {
  opacity: 0.3;
  cursor: not-allowed;
}
.drag-handle.disabled:hover {
  color: var(--text-muted);
  background: none;
  box-shadow: none;
}
/* 拖起中的行：整行高亮浮起感（table row 不宜用 transform/box-shadow，改用背景+边线+光晕） */
tr.dragging td {
  background: var(--accent-weak, rgba(92, 124, 250, 0.12)) !important;
  border-color: rgba(92, 124, 250, 0.35) !important;
  box-shadow: inset 0 0 0 9999px rgba(92, 124, 250, 0.03);
}
tr.dragging .drag-handle {
  color: var(--accent);
  cursor: grabbing;
}
/* 插入位置指示：目标行上/下缘 3px 主色线 + 内发光（拖到上半=插其前，下半=插其后） */
tr.drag-over-top td {
  border-top: 3px solid var(--accent) !important;
  box-shadow: inset 0 4px 7px -4px var(--accent) !important;
}
tr.drag-over-bottom td {
  border-bottom: 3px solid var(--accent) !important;
  box-shadow: inset 0 -4px 7px -4px var(--accent) !important;
}
.btn-save-order {
  background: var(--accent);
  color: var(--on-accent, #fff);
}
.btn-save-order:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
}
@media (max-width: 640px) {
  .backup-row {
    flex-direction: column;
    align-items: stretch;
  }
}

@media (max-width: 640px) {
  .table th:nth-child(3),
  .table td:nth-child(3) {
    display: none;
  }
  .admin-header {
    flex-wrap: wrap;
    border-radius: 26px;
  }
}

/* ================= 热点新闻数据源（表格排版，参考分组管理） ================= */
.news-source-wrap {
  overflow-x: auto;
}
.news-source-table {
  width: 100%;
  min-width: 640px;
}
.news-source-item {
  /* 行级表格元素，沿用 .table 样式；这里仅覆盖拖拽相关 */
  user-select: none;
}
.news-source-item input[type="checkbox"] {
  accent-color: var(--accent);
  width: 16px;
  height: 16px;
  margin: 0;
  cursor: pointer;
  vertical-align: middle;
}
.news-source-item .ns-dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  margin: 0 6px;
  border-radius: 50%;
  box-shadow: 0 0 6px currentColor;
  vertical-align: middle;
}
.news-source-item .ns-handle {
  display: inline-block;
  color: var(--text-muted);
  cursor: grab;
  font-size: 14px;
  line-height: 1;
  margin-right: 2px;
  opacity: .55;
  transition: opacity .15s ease, color .15s ease;
  vertical-align: middle;
}
.news-source-item:hover .ns-handle {
  opacity: 1;
  color: var(--accent);
}
.news-source-item .ns-handle:active {
  cursor: grabbing;
}
.news-source-item .ns-url {
  display: block;
  max-width: 320px;
  color: var(--text-muted);
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.news-source-item.dragging {
  opacity: .4;
}
.news-source-item.drag-over-before {
  box-shadow: inset 3px 0 0 var(--accent);
}
.news-source-item.drag-over-after {
  box-shadow: inset -3px 0 0 var(--accent);
}

/* ============ 站点设置：二级导航（功能分区切换） ============ */
.settings-subnav {
  display: flex;
  justify-content: center;
  gap: 4px;
  padding: 5px;
  margin: 0 0 16px;
  overflow-x: auto;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--edge);
  box-shadow: var(--raised-sm);
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.settings-subnav::-webkit-scrollbar {
  display: none;
}
.settings-subnav .subtab {
  flex: none;
  padding: 7px 15px;
  font-size: 13px;
  line-height: 1.4;
  white-space: nowrap;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: background .18s ease, color .18s ease, box-shadow .18s ease;
}
.settings-subnav .subtab:hover {
  color: var(--text);
  background: var(--accent-soft);
}
.settings-subnav .subtab.active {
  background: var(--accent);
  color: var(--on-accent, #fff);
  font-weight: 600;
  box-shadow: var(--raised-sm);
}
@media (max-width: 640px) {
  /* 窄屏溢出滚动：居中会裁掉左端标签且无法滚到，恢复左对齐 */
  .admin-tabs {
    justify-content: flex-start;
  }
  .settings-subnav {
    border-radius: 16px;
    justify-content: flex-start;
  }
  .settings-subnav .subtab {
    padding: 8px 14px;
    font-size: 13px;
  }
}

/* ============ 卡片管理：分页控件 ============ */
.pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 14px;
  padding-top: 12px;
}
/* hidden 属性会被 .pager 的 display:flex 覆盖，需显式声明 */
.pager[hidden] {
  display: none;
}
.pager-info {
  font-size: 12.5px;
  color: var(--text-muted);
}
.pager-nav {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
}
.pager-btn {
  min-width: 32px;
  height: 32px;
  padding: 0 10px;
  font-size: 13px;
  font-family: inherit;
  color: var(--text-muted);
  background: var(--surface);
  border: 1px solid var(--edge);
  border-radius: 10px;
  cursor: pointer;
  transition: background .15s ease, color .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.pager-btn:hover:not(:disabled):not(.active) {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-soft);
}
.pager-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 700;
  box-shadow: var(--raised-sm);
}
.pager-btn:disabled {
  opacity: .45;
  cursor: not-allowed;
}
.pager-btn.ellipsis {
  border-color: transparent;
  background: transparent;
}
@media (max-width: 640px) {
  .pager {
    justify-content: center;
  }
  .pager-info {
    width: 100%;
    text-align: center;
  }
}

/* ============ 受信任设备 ============ */
.trust-cb {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  font-size: 13px;
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
}
.trust-cb input[type='checkbox'] { width: 16px; height: 16px; accent-color: var(--primary); }

.td-list { display: flex; flex-direction: column; gap: 8px; }
.td-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--edge-weak);
}
.td-row.td-current { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 8%, var(--surface)); }
.td-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.td-name { font-size: 13px; font-weight: 600; color: var(--text); }
.td-sub { font-size: 12px; color: var(--text-muted); }
.td-tag {
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--primary);
  color: #fff;
  margin-left: 6px;
  font-weight: 500;
}
.td-revoke { white-space: nowrap; }

/* ================= 分组图标选择器 ================= */
/* 后台按钮文字：任何屏幕尺寸下均保持一行完整显示 */
.btn { white-space: nowrap; }

/* 窄屏：表格操作按钮组允许换行，宁可变高也不挤压文字 */
@media (max-width: 1100px) {
  .table .actions { flex-wrap: wrap; justify-content: flex-end; }
}

/* 分组名称行：图标选择按钮 + 名称输入框 */
.g-name-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.g-name-row .input { flex: 1; min-width: 0; }
.g-icon-pick {
  flex-shrink: 0;
  box-sizing: border-box;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 21px;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  background: var(--surface);
  border: 1px solid var(--line, rgba(127,127,127,0.18));
  box-shadow: var(--raised-sm);
  transition: box-shadow 260ms var(--ease), border-color 260ms var(--ease);
}
.g-icon-pick:hover {
  border-color: var(--accent);
}
.g-icon-pick .g-icon-placeholder {
  font-size: 15px;
  opacity: 0.45;
}

/* 分组管理列表名称列：图标 + 名称 */
.g-table-name {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}
.g-table-name .g-table-icon {
  font-size: 16px;
  line-height: 1;
  flex-shrink: 0;
}

/* 分组管理：二级分组缩进挂在所属一级分组下，排序与显示/隐藏均按同级生效 */
#groupsTbody tr.row-child .g-table-name {
  padding-left: 28px;
  position: relative;
}
#groupsTbody tr.row-child .g-table-name::before {
  content: '';
  position: absolute;
  left: 12px;
  top: 50%;
  width: 9px;
  height: 1px;
  background: var(--edge-weak, rgba(128, 128, 128, 0.35));
}
.g-level-tag {
  flex-shrink: 0;
  padding: 1px 6px;
  border-radius: 6px;
  border: 1px solid var(--edge-weak, rgba(128, 128, 128, 0.35));
  color: var(--text-muted);
  font-size: 11px;
  line-height: 1.5;
}

/* 图标选择弹窗（宽度为常规弹窗的两倍，内容一屏展开） */
#groupIconModal .modal-box {
  max-width: min(1040px, 96vw);
  max-height: 94vh;
  overflow-y: auto;
  scrollbar-width: none;          /* Firefox：不显示滚动条 */
}
#groupIconModal .modal-box::-webkit-scrollbar {
  display: none;                  /* WebKit：不显示滚动条 */
}
.gic-search {
  width: 100%;
  margin-bottom: 12px;
}

/* 分类内容区 */
#gicBody {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.gic-cat-head {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
}
.gic-cat-bar {
  width: 3px;
  height: 12px;
  border-radius: 2px;
  background: var(--accent);
}
.gic-cat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(52px, 1fr));
  gap: 6px;
}

/* 图标按钮：上图下文，紧凑单行 */
.gic-item {
  box-sizing: border-box;
  min-width: 0;
  padding: 6px 2px 5px;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  cursor: pointer;
  background: var(--surface);
  border: 1px solid transparent;
  transition: background 260ms var(--ease), border-color 260ms var(--ease), transform 260ms var(--ease);
}
.gic-emoji {
  font-size: 18px;
  line-height: 1;
}
.gic-name {
  max-width: 100%;
  font-size: 11px;
  line-height: 1.2;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.gic-item:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}
.gic-item.active {
  background: var(--accent-soft);
  border-color: var(--accent);
}
.gic-item.active .gic-name { color: var(--accent); }
.gic-empty {
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
  padding: 24px 0;
}

/* 小屏：弹窗贴近全宽，格子进一步收窄 */
@media (max-width: 480px) {
  #groupIconModal .modal-box { max-width: 96vw; }
  .gic-cat-grid {
    grid-template-columns: repeat(auto-fill, minmax(48px, 1fr));
    gap: 5px;
  }
  .gic-emoji { font-size: 17px; }
  .gic-name { font-size: 10.5px; }
}
