:root {
  --bg: #f5f6fa; --surface: #ffffff; --surface-2: #f0f2f8; --border: #e4e7ef;
  --text: #171a2b; --muted: #6b7185; --primary: #4f46e5; --primary-600: #4338ca; --primary-50: #eef0ff; --fill: var(--primary); --fill-hover: var(--primary-600); --g1: #6366f1; --g2: #4338ca; --glow: rgba(79,70,229,.28);
  --success: #12a56b; --success-50: #e4f7ee; --danger: #e5484d; --danger-50: #fdecec; --warn: #d97706; --warn-50: #fff4e0;
  --shadow: 0 1px 2px rgba(20, 24, 50, .04), 0 4px 16px rgba(20, 24, 50, .05);
  --shadow-lg: 0 12px 40px rgba(20, 24, 50, .18);
  --radius: 16px; --radius-sm: 10px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --hm0: #eceef6; --hm1: #c7cbff; --hm2: #9a9ff5; --hm3: #6d70ec; --hm4: #4338ca;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d1014; --surface: #161a1f; --surface-2: #1e2329; --border: #2b3139; --text: #e6e9ee; --muted: #8f99a6;
    --primary: #6cb0ff; --primary-600: #8fc3ff; --primary-50: rgba(108,176,255,.13); --fill: #2f6feb; --fill-hover: #4a85f5; --g1: #4d8dff; --g2: #2a62d8; --glow: rgba(47,111,235,.35);
    --success: #3fcf8e; --success-50: rgba(63,207,142,.13);
    --danger: #ff7b7f; --danger-50: rgba(255,123,127,.13); --warn: #f0b44c; --warn-50: rgba(240,180,76,.13);
    --shadow: 0 1px 2px rgba(0,0,0,.4); --shadow-lg: 0 12px 40px rgba(0,0,0,.6);
    --hm0: #1e2329; --hm1: #17436f; --hm2: #1f6bb8; --hm3: #4a9bf0; --hm4: #9fd0ff; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
    --bg: #0d1014; --surface: #161a1f; --surface-2: #1e2329; --border: #2b3139; --text: #e6e9ee; --muted: #8f99a6;
    --primary: #6cb0ff; --primary-600: #8fc3ff; --primary-50: rgba(108,176,255,.13); --fill: #2f6feb; --fill-hover: #4a85f5; --g1: #4d8dff; --g2: #2a62d8; --glow: rgba(47,111,235,.35);
    --success: #3fcf8e; --success-50: rgba(63,207,142,.13);
    --danger: #ff7b7f; --danger-50: rgba(255,123,127,.13); --warn: #f0b44c; --warn-50: rgba(240,180,76,.13);
    --shadow: 0 1px 2px rgba(0,0,0,.4); --shadow-lg: 0 12px 40px rgba(0,0,0,.6);
    --hm0: #1e2329; --hm1: #17436f; --hm2: #1f6bb8; --hm3: #4a9bf0; --hm4: #9fd0ff; color-scheme: dark;

}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); background: var(--bg); color: var(--text); font-size: 15px; line-height: 1.55; -webkit-tap-highlight-color: transparent; }
h1, h2, h3 { margin: 0; line-height: 1.25; letter-spacing: -.01em; }
h1 { font-size: 26px; } h2 { font-size: 19px; } h3 { font-size: 16px; display: flex; align-items: center; gap: 6px; }
p { margin: 0; }
a { color: var(--primary); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .5; }
.icon { flex: none; display: block; }
.hidden { display: none !important; }
.boot { padding: 80px 0; text-align: center; color: var(--muted); }
kbd { font-family: var(--mono); font-size: 11px; padding: 1px 6px; border-radius: 5px; background: rgba(255,255,255,.22); margin-left: 8px; }

/* ---------- 布局 ---------- */
.shell { display: flex; min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; width: 232px; flex: none; padding: 20px 14px; display: flex; flex-direction: column; gap: 18px; border-right: 1px solid var(--border); background: var(--surface); }
.brand { display: flex; align-items: center; gap: 10px; font-size: 19px; font-weight: 700; color: var(--text); padding: 0 8px; }
.logo { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: linear-gradient(135deg, var(--g1), var(--g2)); color: #fff; }
.logo.lg { width: 56px; height: 56px; border-radius: 16px; }
.sidebar nav { display: flex; flex-direction: column; gap: 3px; }
.nav-link { display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: 11px; color: var(--muted); font-weight: 500; transition: .15s; }
.nav-link:hover { background: var(--surface-2); color: var(--text); }
.nav-link.active { background: var(--primary-50); color: var(--primary); font-weight: 600; }
.side-foot { margin-top: auto; }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 12px; background: var(--surface-2); }
.uname { flex: 1; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avatar { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--fill); color: #fff; font-weight: 700; font-size: 14px; flex: none; }
.avatar.lg { width: 52px; height: 52px; font-size: 20px; }
.avatar { overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar.xl { width: 72px; height: 72px; font-size: 28px; }
/* 侧边栏：用户名（点击进账号设置）与反馈入口 */
.user-link { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; color: inherit; border-radius: 8px; }
.user-chip { transition: background-color .15s; }
.front-chip { cursor: pointer; }
.front-chip:hover { background: color-mix(in srgb, var(--text) 7%, var(--surface-2)); }
:root[data-chrome="color"] .shell .sidebar .front-chip:hover { background: rgba(255,255,255,.22); }
:root[data-scheme="dark"][data-chrome="color"] .shell .sidebar .front-chip:hover { background: rgba(255,255,255,.12); }
.user-link .uname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-fb { display: flex; align-items: center; justify-content: center; gap: 6px; margin-bottom: 10px; padding: 6px 0; font-size: 14px; font-weight: 600; color: var(--muted); }
.side-fb i { font-style: normal; transition: transform .15s; }
.side-fb:hover { color: var(--primary); }
.side-fb:hover i { transform: translateX(3px); }
:root[data-chrome="color"] .shell .sidebar .side-fb { color: rgba(255,255,255,.72); }
:root[data-chrome="color"] .shell .sidebar .side-fb:hover { color: #fff; }
/* 账号设置顶部的反馈横幅 */
.fb-banner { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-radius: 14px; background: var(--primary-50); color: var(--primary); }
.fb-banner .grow { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.fb-banner b { font-size: 15px; }
.fb-banner .grow span { font-size: 13px; color: var(--muted); }
.fb-banner:hover { filter: brightness(.98); }
/* 头像上传 */
.av-edit { display: flex; align-items: center; gap: 16px; }
.av-side { display: flex; flex-direction: column; gap: 8px; }
.av-pick { position: relative; padding: 0; border: 0; background: none; cursor: pointer; border-radius: 50%; flex: none; }
.av-pick.busy { pointer-events: none; }
.av-pick.busy::after { content: ''; position: absolute; inset: 0; border-radius: 50%; background: rgba(0,0,0,.35) center / 26px no-repeat;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round'%3E%3Cpath d='M12 3a9 9 0 1 0 9 9'/%3E%3C/svg%3E"); animation: av-spin .8s linear infinite; }
@keyframes av-spin { to { transform: rotate(360deg); } }
.av-cam { position: absolute; right: -2px; bottom: -2px; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--surface); color: var(--text); border: 1px solid var(--border); }
.auth-logo .av-pick { margin: 0 auto; display: block; }
a.user-card { display: flex; color: inherit; }
/* 老用户上传头像的轻提示：右下角小卡片（手机在底部导航上方） */
.av-ask { position: fixed; right: 24px; bottom: 24px; z-index: 80; width: 300px; display: grid; grid-template-columns: auto 1fr; gap: 12px 14px; align-items: center;
  padding: 16px; border-radius: 18px; background: var(--surface); border: 1px solid var(--border); box-shadow: 0 16px 40px rgba(15,18,40,.16); animation: av-in .3s ease; }
.av-ask.out { opacity: 0; transform: translateY(8px); transition: .25s; }
.av-ask-txt { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.av-ask-txt b { font-size: 15px; }
.av-ask-txt span { font-size: 13px; color: var(--muted); }
.av-ask-btns { grid-column: 1 / -1; display: flex; gap: 8px; }
.av-ask-btns .btn { flex: 1; }
@keyframes av-in { from { opacity: 0; transform: translateY(12px); } }
@media (max-width: 760px) { .av-ask { left: 12px; right: 12px; width: auto; bottom: calc(76px + env(safe-area-inset-bottom)); } }
/* 后台：主题分布 */
.th-list { display: flex; flex-direction: column; gap: 10px; }
.th-row { display: grid; grid-template-columns: 112px 1fr 76px; align-items: center; gap: 12px; font-size: 14px; }
.th-name { display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.th-name small { font-size: 11px; color: var(--muted); padding: 1px 6px; border-radius: 99px; background: var(--surface-2); }
.th-dot { width: 12px; height: 12px; border-radius: 50%; flex: none; }
.th-bar { height: 8px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.th-bar i { display: block; height: 100%; border-radius: inherit; background: var(--fill); min-width: 2px; }
.th-n { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.th-n small { margin-left: 6px; font-weight: 400; color: var(--muted); font-size: 12px; }
/* 管理员切换到用户时的提示条 */
.imp-bar { position: sticky; top: 0; z-index: 50; display: flex; align-items: center; justify-content: center; gap: 10px; padding: 8px 16px; font-size: 13px; background: #f59e0b; color: #1c1917; }
.imp-bar .btn { background: rgba(0,0,0,.12); color: inherit; border: 0; }
.content { flex: 1; min-width: 0; }
.main { max-width: 1080px; margin: 0 auto; padding: 28px 28px 60px; }
.bottom-nav { display: none; }
.bare { min-height: 100vh; }
.page { display: flex; flex-direction: column; gap: 18px; }
.page.narrow { max-width: 720px; margin: 0 auto; width: 100%; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.page-head p { margin-top: 4px; }
.back { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); font-size: 14px; width: fit-content; }
.back:hover { color: var(--primary); }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
section { display: flex; flex-direction: column; }

/* ---------- 基础组件 ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.muted { color: var(--muted); } .small { font-size: 13px; } .strong { font-weight: 600; } .mono { font-family: var(--mono); font-size: 13.5px; } .center { text-align: center; }
.warn { color: var(--warn); } .danger-t { color: var(--danger) !important; }
.row { display: flex; align-items: center; } .gap { gap: 10px; } .wrap { flex-wrap: wrap; } .grow { flex: 1; min-width: 0; } .center-x { justify-content: center; }
.link { font-size: 14px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 9px 16px; border-radius: 11px; border: 1px solid transparent; font-weight: 600; font-size: 14.5px; line-height: 1.2; transition: .15s; white-space: nowrap; user-select: none; }
.btn-primary { background: var(--fill); color: #fff; box-shadow: 0 2px 8px var(--glow); }
.btn-primary:hover:not(:disabled) { background: var(--fill-hover); transform: translateY(-1px); }
.btn-ghost { background: var(--surface); border-color: var(--border); color: var(--text); }
.btn-ghost:hover:not(:disabled) { background: var(--surface-2); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-sm { padding: 6px 12px; font-size: 13.5px; border-radius: 9px; } .btn-lg { padding: 13px 22px; font-size: 16px; border-radius: 13px; } .btn-block { width: 100%; }
.icon-btn { background: none; border: 0; padding: 7px; border-radius: 9px; color: var(--muted); display: inline-grid; place-items: center; line-height: 1; font-size: 18px; }
.icon-btn:hover { background: var(--surface-2); color: var(--primary); }
.input { width: 100%; padding: 10px 13px; border-radius: 11px; border: 1px solid var(--border); background: var(--surface); outline: none; transition: .15s; }
.input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-50); }
textarea.input { resize: vertical; }
.input.num { width: 90px; text-align: center; }
.select { width: auto; min-width: 140px; }
.search-wrap { position: relative; flex: 1; min-width: 200px; }
.search-wrap .icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search-wrap .input { padding-left: 38px; }
.field { display: flex; flex-direction: column; gap: 7px; } .field > span { font-weight: 600; font-size: 14px; }
.req { color: var(--danger); font-style: normal; }
.form { display: flex; flex-direction: column; gap: 14px; }
.form-card { display: flex; flex-direction: column; gap: 16px; }
.form-error { color: var(--danger); font-size: 14px; min-height: 18px; }
.switch-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; cursor: pointer; font-weight: 500; }
.switch-row small { flex-basis: 100%; margin-left: 52px; margin-top: -6px; }
input[type=checkbox].chk, .switch-row input[type=checkbox] { accent-color: var(--primary); }
.switch-row input[type=checkbox] { appearance: none; width: 42px; height: 24px; border-radius: 12px; background: var(--border); position: relative; transition: .2s; flex: none; cursor: pointer; }
.switch-row input[type=checkbox]::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: .2s; box-shadow: 0 1px 3px rgba(0,0,0,.25); }
.switch-row input[type=checkbox]:checked { background: var(--fill); } .switch-row input[type=checkbox]:checked::after { left: 21px; }
input[type=checkbox].chk { width: 18px; height: 18px; flex: none; }
.range { width: 100%; accent-color: var(--primary); }
.seg { display: inline-flex; background: var(--surface-2); padding: 3px; border-radius: 11px; gap: 2px; flex-wrap: wrap; width: fit-content; }
.seg button { border: 0; background: none; padding: 7px 14px; border-radius: 8px; font-weight: 600; color: var(--muted); font-size: 14px; }
.seg button.active { background: var(--surface); color: var(--primary); box-shadow: 0 1px 4px rgba(0,0,0,.12); }
.seg.mini button { padding: 5px 10px; }
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 99px; font-size: 12px; font-weight: 600; background: var(--primary-50); color: var(--primary); white-space: nowrap; }
.badge.success { background: var(--success-50); color: var(--success); } .badge.danger { background: var(--danger-50); color: var(--danger); } .badge.primary { background: var(--fill); color: #fff; }
.badge.muted-b { background: var(--surface-2); color: var(--muted); }
.chip { display: inline-block; padding: 3px 11px; border-radius: 99px; background: var(--surface-2); font-size: 13px; color: var(--muted); font-weight: 500; }
.chip.primary { background: var(--primary-50); color: var(--primary); } .chip.warn-c { background: var(--warn-50); color: var(--warn); } .chip.danger-c { background: var(--danger-50); color: var(--danger); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip-btn { border: 1px solid var(--border); background: var(--surface); border-radius: 99px; padding: 5px 13px; font-size: 13.5px; color: var(--muted); font-weight: 500; }
.chip-btn.active { background: var(--fill); border-color: var(--fill); color: #fff; }
.progress { height: 8px; background: var(--surface-2); border-radius: 99px; overflow: hidden; } .progress.thin { height: 5px; }
.bar { height: 100%; background: linear-gradient(90deg, var(--g1), var(--fill)); border-radius: 99px; transition: width .4s; }
.notice { background: var(--primary-50); color: var(--primary); padding: 10px 14px; border-radius: 11px; font-size: 14px; }
.list { display: flex; flex-direction: column; } .list-row { display: flex; align-items: center; gap: 12px; padding: 11px 4px; border-bottom: 1px solid var(--border); } .list-row:last-child { border-bottom: 0; }
.link-row { color: var(--text); padding: 14px 8px; } .link-row:hover { background: var(--surface-2); border-radius: 10px; }
.score { font-weight: 700; font-variant-numeric: tabular-nums; } .score.good { color: var(--success); }
.empty { text-align: center; padding: 44px 16px; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 10px; }
.empty-title { font-size: 17px; font-weight: 600; color: var(--text); }
.loading { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 50px; color: var(--muted); }
.spin { width: 18px; height: 18px; border: 2.5px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; } .grid-2.gap { gap: 18px; }
.grid-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 16px; }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; } .toolbar.tight { margin: 12px 0; }

/* ---------- 弹窗 / 提示 ---------- */
.overlay { position: fixed; inset: 0; background: rgba(10, 12, 30, .5); backdrop-filter: blur(3px); display: grid; place-items: center; z-index: 100; padding: 16px; animation: fade .15s; }
.modal { background: var(--surface); width: min(480px, 100%); max-height: calc(100dvh - 32px); display: flex; flex-direction: column; border-radius: 20px; box-shadow: var(--shadow-lg); animation: pop .18s; }
.modal.wide { width: min(720px, 100%); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px 6px 22px; } .modal-body { padding: 8px 22px 18px; overflow: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 12px 22px 18px; }
.confirm-text { line-height: 1.7; }
@keyframes fade { from { opacity: 0; } } @keyframes pop { from { opacity: 0; transform: translateY(10px) scale(.98); } }
#toasts { position: fixed; top: 16px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; width: min(92vw, 420px); }
.toast { background: #1f2340; color: #fff; padding: 11px 18px; border-radius: 12px; box-shadow: var(--shadow-lg); font-size: 14.5px; animation: pop .2s; max-width: 100%; }
.toast.success { background: #0f8f5c; } .toast.error { background: #d23c42; } .toast.out { opacity: 0; transition: .3s; }

/* ---------- 认证 ---------- */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: radial-gradient(1000px 500px at 20% -10%, var(--primary-50), transparent), var(--bg); }
.auth-card { width: min(400px, 100%); background: var(--surface); border: 1px solid var(--border); border-radius: 24px; padding: 32px 28px; box-shadow: var(--shadow-lg); display: flex; flex-direction: column; gap: 14px; }
.auth-card h1 { text-align: center; } .auth-logo { display: grid; place-items: center; }
.auth-form { display: flex; flex-direction: column; gap: 12px; margin-top: 6px; }
.auth-switch { text-align: center; color: var(--muted); font-size: 14px; } .auth-switch a { margin-left: 6px; font-weight: 600; }
.auth-browse { text-align: center; font-size: 14px; color: var(--muted); }

/* 弹窗：小尺寸、无标题栏、均衡换行 */
.modal.sm { width: min(400px, 100%); }
.modal-body:first-child { padding-top: 22px; }
.modal-body, .confirm-text { text-wrap: pretty; }
.modal-head h3:empty { display: none; }
.email-copy { color: var(--primary); text-decoration: underline; text-underline-offset: 2px; cursor: copy; word-break: break-all; }
.modal-head .icon-btn { margin-left: auto; }
.mail-tip { margin: -4px 0 0 52px; line-height: 1.6; }
.modal.sm .confirm-text { text-wrap: balance; }
