/* SYHE007 管理后台样式 */
:root {
  --bg: #0d1117;
  --bg-2: #161b22;
  --card: #1c2129;
  --border: #2d333b;
  --text: #e6edf3;
  --muted: #8b949e;
  --accent: #58a6ff;
  --danger: #f85149;
  --ok: #3fb950;
  --radius: 12px;
  --header-bg: rgba(13, 17, 23, .9);
  --accent-hover: #388bfd;
  --active-bg: rgba(88, 166, 255, .18);
  --active-color: #fff;
  --active-border: rgba(88, 166, 255, .4);
}
/* 浅色模式（与主站同步） */
:root[data-theme="light"] {
  --bg: #f6f8fa;
  --bg-2: #eaeef2;
  --card: #ffffff;
  --border: #d0d7de;
  --text: #1f2328;
  --muted: #59636e;
  --accent: #0969da;
  --danger: #d1242f;
  --ok: #1a7f37;
  --header-bg: rgba(255, 255, 255, .9);
  --accent-hover: #0758b0;
  --active-bg: rgba(9, 105, 218, .1);
  --active-color: #0969da;
  --active-border: rgba(9, 105, 218, .3);
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background .3s ease, color .3s ease;
}
html { overscroll-behavior: none; overflow-x: hidden; }
body.modal-open { overflow: hidden; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code { background: var(--bg-2); padding: 1px 6px; border-radius: 4px; font-size: 13px; }
.muted { color: var(--muted); }

/* 主题切换按钮 */
.theme-toggle {
  width: 36px; height: 36px; border-radius: 50%; flex: none;
  background: var(--card); border: 1px solid var(--border);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 16px; cursor: pointer; color: var(--text);
  transition: transform .2s, border-color .2s;
}
.theme-toggle:hover { transform: scale(1.1); border-color: var(--accent); }
/* 登录页右上角的主题切换按钮 */
.auth-theme-toggle { position: fixed; top: 20px; right: 20px; z-index: 10; }
/* 登录页左上角的返回主页链接 */
.auth-back {
  position: fixed; top: 20px; left: 20px; z-index: 10;
  color: var(--muted); font-size: 14px; text-decoration: none;
}
.auth-back:hover { color: var(--accent); }
/* 密码位数提示 */
.pwd-hint { font-size: 12px; color: var(--muted); margin-top: 4px; }

/* 按钮 */
.btn {
  display: inline-block; padding: 10px 22px; border-radius: 8px;
  font-size: 14px; font-weight: 600; cursor: pointer; border: 1px solid var(--border);
  background: transparent; color: var(--text); transition: all .15s;
}
.btn-primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-ghost { color: var(--text); }
.btn-ghost:hover { border-color: var(--accent); }
.btn-danger { color: var(--danger); border-color: rgba(248, 81, 73, .4); }
.btn-danger:hover { background: rgba(248, 81, 73, .12); }
.btn-sm { padding: 6px 14px; font-size: 13px; }
.btn-xs { padding: 3px 10px; font-size: 12px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .6; cursor: not-allowed; }

/* 登录页 */
.auth-body {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; padding: 24px;
}
.auth-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 16px; padding: 40px; width: 100%; max-width: 400px;
  box-shadow: 0 10px 40px rgba(0,0,0,.4);
}
.auth-logo { font-size: 22px; font-weight: 700; letter-spacing: 1px; text-align: center; }
.auth-logo span { color: var(--accent); }
.auth-title { font-size: 22px; text-align: center; margin-top: 16px; }
.auth-sub { text-align: center; color: var(--muted); font-size: 14px; margin: 6px 0 28px; }
.auth-footer { margin-top: 22px; text-align: center; }
.auth-footer a { color: var(--muted); font-size: 14px; }
.auth-footer a:hover { color: var(--accent); }

/* 后台布局 */
.topbar {
  position: sticky; top: 0; z-index: 10;
  background: var(--header-bg); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.topbar-inner {
  max-width: 1200px; margin: 0 auto; padding: 0 24px;
  display: flex; align-items: center; justify-content: space-between; height: 60px;
}
.topbar-logo {
  font-weight: 700; font-size: 16px; letter-spacing: 1px;
  color: var(--text); text-decoration: none;
}
.topbar-logo:hover { text-decoration: none; }
.topbar-logo span { color: var(--accent); }
.topbar-logo .logo-sub { color: var(--muted); font-weight: 400; font-size: 13px; margin-left: 6px; }
.topbar-actions { display: flex; align-items: center; gap: 12px; }
.topbar-user { color: var(--muted); font-size: 14px; }

/* 用户下拉菜单（蓝字用户名） */
.user-menu { position: relative; }
.user-menu-mask {
  position: fixed; inset: 0; z-index: 5;
  background: transparent; border: none; margin: 0; padding: 0;
}
.user-menu-btn {
  display: inline-flex; align-items: center; gap: 6px;
  background: transparent; border: none; cursor: pointer;
  padding: 6px 10px; border-radius: 8px; font-size: 14px;
  color: var(--accent); font-weight: 600; white-space: nowrap;
  transition: background .15s;
}
.user-menu-btn:hover { background: var(--active-bg); }
.user-menu-btn.open { background: var(--active-bg); }
@media (hover: none) {
  .user-menu-btn:hover { background: transparent; }
}
.user-menu-caret { font-size: 10px; color: var(--muted); transition: transform .2s; }
.user-dropdown {
  position: absolute; right: 0; top: calc(100% + 6px);
  min-width: 150px; background: var(--card);
  border: 1px solid var(--border); border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0,0,0,.35);
  padding: 6px; z-index: 30;
}
.dropdown-item {
  display: flex; align-items: center; gap: 8px;
  width: 100%; text-align: left; padding: 9px 12px;
  background: transparent; border: none; border-radius: 7px;
  color: var(--text); font-size: 14px; cursor: pointer; white-space: nowrap;
  transition: background .15s;
}
.dropdown-item:hover { background: var(--bg-2); }
.dropdown-danger { color: var(--danger); }
.dropdown-danger:hover { background: rgba(248, 81, 73, .12); }

/* 模块化布局：侧边栏 + 内容区 */
.admin-layout {
  max-width: 1200px; margin: 0 auto; padding: 24px;
  display: flex; gap: 24px; align-items: flex-start;
}
.sidebar {
  width: 210px; flex: none; position: sticky; top: 84px;
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 12px;
  display: flex; flex-direction: column;
}
.sidebar-nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.nav-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 11px 14px; border-radius: 8px; font-size: 14px;
  color: var(--muted); cursor: pointer; transition: all .15s;
  border: 1px solid transparent; background: transparent;
  text-align: left; font-family: inherit;
}
.nav-item:hover { color: var(--text); background: var(--bg-2); }
.nav-item.active {
  color: var(--active-color); background: var(--active-bg);
  border-color: var(--active-border);
}
.nav-icon { font-size: 16px; flex: none; }
.sidebar-footer {
  margin-top: 12px; padding: 11px 14px; border-top: 1px solid var(--border);
  color: var(--muted); font-size: 13px; display: flex; align-items: center; gap: 10px;
}

.admin-main { flex: 1; min-width: 0; padding-bottom: 64px; }
.module[hidden] { display: none; }

/* 面板 */
.panel {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 28px; margin-bottom: 24px;
}
.panel-head { display: flex; align-items: center; justify-content: space-between; }
.panel-title { font-size: 19px; margin-bottom: 4px; }
.panel-sub { color: var(--muted); font-size: 13px; margin-bottom: 20px; }

/* 表单 */
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.field input, .field textarea, .field select {
  width: 100%; padding: 10px 12px; border-radius: 8px;
  background: var(--bg-2); border: 1px solid var(--border); color: var(--text);
  font-size: 14px; font-family: inherit;
}
.field input:focus, .field textarea:focus, .field select:focus { outline: none; border-color: var(--accent); }
.form-row { display: flex; gap: 16px; }
.logs-filter { display: flex; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
.logs-filter .field { flex: 1; min-width: 160px; margin-bottom: 0; }
.form-row .field { flex: 1; }
.input-suffix { display: flex; align-items: center; }
.input-suffix input { flex: 1; border-radius: 8px 0 0 8px; }
.input-suffix.with-prefix input { border-radius: 0; }
.input-suffix .suffix-prefix {
  padding: 10px 12px; background: var(--bg-2); border: 1px solid var(--border);
  border-right: none; border-radius: 8px 0 0 8px; color: var(--muted); font-size: 14px; white-space: nowrap;
}
.input-suffix .suffix {
  padding: 10px 12px; background: var(--bg-2); border: 1px solid var(--border);
  border-left: none; border-radius: 0 8px 8px 0; color: var(--muted); font-size: 14px; white-space: nowrap;
}
.checkbox-field { display: flex; align-items: flex-end; }
.checkbox { display: flex; align-items: center; gap: 8px; cursor: pointer; font-size: 14px; }
.checkbox input { width: auto; }
.checkbox-group { display: flex; flex-direction: column; gap: 10px; }

/* 提示框 */
.error-box { background: rgba(248,81,73,.12); border: 1px solid rgba(248,81,73,.4); color: var(--danger); padding: 10px 14px; border-radius: 8px; margin-bottom: 16px; font-size: 14px; }
.ok-box { background: rgba(63,185,80,.12); border: 1px solid rgba(63,185,80,.4); color: var(--ok); padding: 10px 14px; border-radius: 8px; margin-bottom: 16px; font-size: 14px; }
.update-tip {
  font-size: 13px; color: var(--muted);
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: 8px; padding: 10px 12px; margin: 12px 0 16px;
}
.update-tip b { color: var(--ok); }

/* 表格 */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th, .table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); }
.table th { color: var(--muted); font-weight: 600; font-size: 13px; }

/* 项目卡片列表 */
.projects-list { display: flex; flex-direction: column; gap: 12px; }
.proj-item {
  display: flex; gap: 16px; align-items: flex-start;
  background: var(--bg-2); border: 1px solid var(--border); border-radius: 10px; padding: 16px;
}
.proj-icon { font-size: 24px; }
.proj-info { flex: 1; }
.proj-title { font-weight: 600; font-size: 15px; }
.proj-desc { color: var(--muted); font-size: 13px; margin-top: 2px; }
.proj-url { font-size: 12px; color: var(--accent); margin-top: 4px; word-break: break-all; }
.proj-tags { margin-top: 8px; }
.proj-actions { display: flex; flex-direction: column; gap: 6px; }

/* 占位卡片收纳分组 */
.placeholder-group { margin-top: 8px; }
.placeholder-toggle {
  display: flex; align-items: center; gap: 8px; width: 100%;
  background: var(--bg-2); border: 1px dashed var(--border); border-radius: 10px;
  padding: 12px 16px; cursor: pointer; color: var(--muted); font-size: 14px;
  text-align: left; transition: border-color .15s, color .15s;
}
.placeholder-toggle:hover { border-color: var(--accent); color: var(--text); }
.placeholder-count { color: var(--muted); font-size: 12px; }
.placeholder-arrow { margin-left: auto; transition: transform .2s; }
.placeholder-list { display: flex; flex-direction: column; gap: 12px; margin-top: 12px; }
.placeholder-list[hidden] { display: none; }
.tag {
  display: inline-block; font-size: 12px; padding: 2px 9px; border-radius: 20px;
  background: rgba(88,166,255,.12); color: var(--accent); border: 1px solid rgba(88,166,255,.25); margin-right: 6px;
}
.badge-off { font-size: 12px; color: var(--muted); border: 1px solid var(--border); padding: 1px 8px; border-radius: 20px; }
.badge-on { font-size: 12px; color: var(--ok); border: 1px solid rgba(63,185,80,.4); padding: 1px 8px; border-radius: 20px; white-space: nowrap; }

/* 移动端卡片（替代宽表格，默认隐藏，移动端显示） */
.sites-cards, .users-cards, .files-cards { display: none; }
.site-card, .user-card, .file-card {
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: 12px; padding: 14px;
  display: flex; flex-direction: column; gap: 10px;
}
.site-card-head, .user-card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; flex-wrap: wrap; }
.site-card-sub { font-weight: 600; font-size: 15px; word-break: break-all; }
.site-card-url { font-size: 13px; color: var(--accent); word-break: break-all; }
.site-card-meta { font-size: 12px; color: var(--muted); }
.site-card-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.user-card-name { font-weight: 600; }
.user-card-row { font-size: 13px; }
.user-card-row .mini-bar { margin: 6px 0; }
.user-card-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* 弹窗 */
.modal-mask {
  position: fixed; inset: 0; background: rgba(0,0,0,.6);
  display: flex; align-items: center; justify-content: center; z-index: 100; padding: 24px;
}
.modal {
  background: var(--card); border: 1px solid var(--border); border-radius: 14px;
  padding: 28px; width: 100%; max-width: 520px; max-height: 90vh; overflow-y: auto;
  overscroll-behavior: contain;
}
.modal h3 { margin-bottom: 20px; font-size: 18px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 12px; margin-top: 20px; }

/* 删除滑块确认 */
.delete-slider { margin: 20px 0; }
.delete-slider-track {
  position: relative; height: 52px;
  background: rgba(248, 81, 73, .1);
  border: 1px solid rgba(248, 81, 73, .4);
  border-radius: 26px;
  overflow: hidden;
}
.delete-slider-fill {
  position: absolute; left: 0; top: 0; bottom: 0; width: 0;
  background: rgba(248, 81, 73, .35);
  transition: width .25s ease;
}
.delete-slider-label {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 14px; font-weight: 600;
  pointer-events: none; user-select: none;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .35);
}
.delete-slider-thumb {
  position: absolute; left: 4px; top: 50%; transform: translateY(-50%);
  width: 44px; height: 44px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: #f85149; color: #fff; font-size: 16px;
  cursor: grab; user-select: none;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .35);
  touch-action: none;
  transition: left .25s ease;
}
.delete-slider-thumb:active { cursor: grabbing; }

/* 系统状态进度条 */
.meter { margin-bottom: 18px; }
.meter-label { font-size: 14px; margin-bottom: 6px; }
.meter-bar {
  height: 10px; border-radius: 6px; background: var(--bg-2);
  border: 1px solid var(--border); overflow: hidden;
}
.meter-fill {
  height: 100%; border-radius: 6px;
  background: linear-gradient(90deg, var(--accent), #7ee787);
  transition: width .4s ease;
}
.meter-num { font-size: 13px; color: var(--muted); margin-top: 4px; }

/* 用户配额迷你进度条 */
.mini-bar {
  height: 6px; border-radius: 3px; background: var(--bg-2);
  border: 1px solid var(--border); overflow: hidden; margin: 4px 0;
}
.mini-fill { height: 100%; background: var(--accent); border-radius: 3px; transition: width .3s ease; }

/* 功能卡片（普通用户界面） */
.functions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
}
.func-card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px 16px;
  text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  transition: transform .2s, border-color .2s;
  text-decoration: none; color: var(--text);
}
.func-card:hover {
  transform: translateY(-4px);
  border-color: var(--accent);
  text-decoration: none;
}
.func-icon { font-size: 36px; }
.func-name { font-size: 15px; font-weight: 600; color: var(--text); }

/* 主题策略选项 */
.theme-options { display: flex; flex-direction: column; gap: 10px; max-width: 480px; }
.theme-opt {
  display: flex; flex-direction: column; align-items: flex-start; gap: 4px;
  background: var(--bg-2); border: 1px solid var(--border); border-radius: 10px;
  padding: 14px 16px; cursor: pointer; text-align: left; color: var(--text);
  font-size: 15px; transition: border-color .15s, background .15s;
}
.theme-opt:hover { border-color: var(--accent); }
.theme-opt.active { border-color: var(--accent); background: var(--active-bg); }
.theme-opt-name { font-weight: 600; }
.theme-opt-desc { font-size: 13px; color: var(--muted); }

/* 特效选项 */
.effect-options { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.effect-opt {
  padding: 8px 14px; border-radius: 8px; cursor: pointer;
  background: var(--bg-2); border: 1px solid var(--border);
  color: var(--text); font-size: 14px; transition: border-color .15s, background .15s;
}
.effect-opt:hover { border-color: var(--accent); }
.effect-opt.active { border-color: var(--accent); background: var(--active-bg); }

/* 用户卡片 */
.user-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}
.user-card {
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: 12px; padding: 18px;
  display: flex; flex-direction: column; gap: 12px;
}
.user-card-head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.user-name { font-weight: 700; font-size: 15px; color: var(--text); }
.role-badge { font-size: 12px; padding: 2px 10px; border-radius: 20px; white-space: nowrap; }
.role-admin { background: rgba(88,166,255,.12); color: var(--accent); border: 1px solid rgba(88,166,255,.3); }
.role-user { color: var(--muted); border: 1px solid var(--border); }
.user-card-meta { display: flex; flex-direction: column; gap: 6px; }
.user-meta-row { display: flex; justify-content: space-between; font-size: 13px; }
.user-meta-label { color: var(--muted); }
.user-card-actions {
  display: flex; flex-wrap: wrap; gap: 6px;
  border-top: 1px solid var(--border); padding-top: 12px;
}

/* 统计卡片 */
.stat-cards { display: flex; gap: 16px; margin-bottom: 20px; }
.stat-card {
  flex: 1; background: var(--bg-2); border: 1px solid var(--border);
  border-radius: 10px; padding: 20px; text-align: center;
}
.stat-num { font-size: 30px; font-weight: 700; color: var(--accent); }
.stat-label { font-size: 13px; color: var(--muted); margin-top: 4px; }

/* 模块复选框 */
.module-checkboxes { display: flex; flex-wrap: wrap; gap: 8px; }
.checkbox-inline {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 13px; padding: 6px 12px; border-radius: 8px;
  background: var(--bg-2); border: 1px solid var(--border); cursor: pointer;
}
.checkbox-inline input { width: auto; }
.checkbox-inline:hover { border-color: var(--accent); }

@media (max-width: 640px) {
  .form-row { flex-direction: column; gap: 0; }
  .topbar-inner { padding: 0 12px; height: 56px; }
  .topbar-logo { font-size: 15px; }
  .topbar-logo .logo-sub { display: none; }
  .topbar-actions { gap: 6px; }
  .user-menu-btn { font-size: 13px; padding: 5px 6px; }
  .btn-sm { padding: 5px 10px; font-size: 12px; }
  .admin-layout { flex-direction: column; padding: 12px; gap: 12px; }
  .sidebar { width: 100%; position: static; flex-direction: row; overflow-x: auto; padding: 8px; }
  .sidebar-nav { flex-direction: row; gap: 6px; }
  .nav-item { width: auto; white-space: nowrap; padding: 8px 12px; font-size: 13px; }
  .sidebar-footer { display: none; }
  .admin-main { padding-bottom: 32px; }
  .panel { padding: 16px; }
  .panel-title { font-size: 16px; }
  /* 表格横向滚动，避免挤压换行 */
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .table { min-width: 560px; }
  /* 站点/用户/文件表格在移动端换成卡片 */
  .sites-table-wrap, .users-table-wrap, .files-table-wrap { display: none; }
  .sites-cards, .users-cards, .files-cards { display: flex; flex-direction: column; gap: 12px; }
  .auth-card { padding: 28px 20px; }
  .stat-cards { gap: 10px; }
  .stat-card { padding: 14px; }
  .stat-num { font-size: 24px; }
  .functions-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .func-card { padding: 18px 10px; }
  .func-icon { font-size: 28px; }
  .theme-toggle { width: 34px; height: 34px; font-size: 15px; }
}
