/* =========================================================
   学生管理系统 · 标准版
   开发者：郝中浩
   ========================================================= */

:root {
  --brand-1: #4f46e5;
  --brand-2: #7c3aed;
  --brand-3: #0ea5e9;
  --brand-grad: linear-gradient(135deg, #4f46e5 0%, #7c3aed 50%, #0ea5e9 100%);

  --bg: #f4f6fb;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --border: #e6e9f2;
  --border-strong: #d3d8e6;

  --text: #1e2333;
  --text-2: #5b6379;
  --text-3: #98a0b5;

  --green: #10b981;
  --red: #ef4444;
  --amber: #f59e0b;

  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 18px;

  --shadow-sm: 0 1px 2px rgba(24, 32, 66, .06);
  --shadow: 0 6px 20px rgba(24, 32, 66, .08);
  --shadow-lg: 0 24px 60px rgba(24, 32, 66, .18);

  --header-h: 68px;
}

body.dark {
  --bg: #0f1320;
  --surface: #171c2c;
  --surface-2: #1d2333;
  --border: #262d41;
  --border-strong: #333c55;
  --text: #e8ecf6;
  --text-2: #9aa4bd;
  --text-3: #6b7590;
  --shadow: 0 6px 20px rgba(0, 0, 0, .4);
  --shadow-lg: 0 24px 60px rgba(0, 0, 0, .6);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", "Segoe UI", system-ui, -apple-system, sans-serif;
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background .25s ease, color .25s ease;
}

img { display: block; max-width: 100%; }

button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }

/* ===================== 顶部栏 ===================== */
.topbar {
  position: sticky;
  top: 0;
  z-index: 60;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.topbar::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  background: var(--brand-grad);
}

.topbar-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 24px;
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand { display: flex; align-items: center; gap: 14px; min-width: 0; }

.brand-logo {
  width: 42px; height: 42px;
  border-radius: 12px;
  background: var(--brand-grad);
  color: #fff;
  font-size: 21px;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 6px 16px rgba(79, 70, 229, .35);
  flex-shrink: 0;
}

.brand-text { min-width: 0; }
.brand-text h1 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: .3px;
  white-space: nowrap;
}
.brand-sub {
  font-size: 11.5px;
  color: var(--text-3);
  letter-spacing: .4px;
  white-space: nowrap;
}

.topbar-right { display: flex; align-items: center; gap: 10px; }

/* —— 开发者署名 —— */
.dev-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 15px;
  border-radius: 999px;
  background: var(--brand-grad);
  color: #fff;
  font-size: 13px;
  box-shadow: 0 6px 18px rgba(79, 70, 229, .32);
  white-space: nowrap;
  user-select: none;
}
.dev-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: #7dffb0;
  box-shadow: 0 0 0 3px rgba(125, 255, 176, .28);
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(125, 255, 176, .28); }
  50%      { box-shadow: 0 0 0 6px rgba(125, 255, 176, .05); }
}
.dev-label { opacity: .85; font-size: 12px; }
.dev-name { font-weight: 700; letter-spacing: 1px; }

/* ===================== 布局 ===================== */
.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 22px 24px 40px;
}

/* ===================== 统计卡片 ===================== */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: var(--shadow-sm);
  transition: transform .18s ease, box-shadow .18s ease;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }

.stat-icon {
  width: 44px; height: 44px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}
.icon-blue  { background: #eef2ff; color: #4f46e5; }
.icon-cyan  { background: #e0f2fe; color: #0284c7; }
.icon-pink  { background: #fce7f3; color: #db2777; }
.icon-amber { background: #fef3c7; color: #d97706; }
.icon-green { background: #dcfce7; color: #16a34a; }
body.dark .icon-blue  { background: rgba(79, 70, 229, .18); }
body.dark .icon-cyan  { background: rgba(2, 132, 199, .18); }
body.dark .icon-pink  { background: rgba(219, 39, 119, .18); }
body.dark .icon-amber { background: rgba(217, 119, 6, .2); }
body.dark .icon-green { background: rgba(22, 163, 74, .18); }

.stat-body { display: flex; flex-direction: column; line-height: 1.25; }
.stat-value { font-size: 23px; font-weight: 700; letter-spacing: .5px; }
.stat-label { font-size: 12.5px; color: var(--text-2); }

/* ===================== 面板 ===================== */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

/* ===================== 工具栏 ===================== */
.toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.toolbar-spacer { flex: 1 1 auto; }

.search-box {
  position: relative;
  display: flex;
  align-items: center;
  min-width: 240px;
  flex: 1 1 280px;
  max-width: 380px;
}
.search-icon {
  position: absolute;
  left: 12px;
  font-size: 13px;
  opacity: .55;
  pointer-events: none;
}
.search-box input {
  width: 100%;
  height: 38px;
  padding: 0 34px 0 34px;
  border-radius: 10px;
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  outline: none;
  transition: border-color .18s, box-shadow .18s, background .18s;
}
.search-box input:focus {
  border-color: var(--brand-1);
  background: var(--surface);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, .12);
}
.search-clear {
  position: absolute;
  right: 8px;
  width: 22px; height: 22px;
  border: none; border-radius: 50%;
  background: var(--border-strong);
  color: var(--text-2);
  cursor: pointer;
  font-size: 11px;
  line-height: 1;
  display: flex; align-items: center; justify-content: center;
}
.search-clear:hover { background: var(--text-3); color: #fff; }

.select {
  height: 38px;
  padding: 0 30px 0 12px;
  border-radius: 10px;
  border: 1px solid var(--border-strong);
  background: var(--surface-2) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='3'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat right 11px center;
  outline: none;
  cursor: pointer;
  appearance: none;
  transition: border-color .18s, box-shadow .18s;
}
.select:focus { border-color: var(--brand-1); box-shadow: 0 0 0 3px rgba(79, 70, 229, .12); }

/* ===================== 按钮 ===================== */
.btn {
  height: 38px;
  padding: 0 15px;
  border-radius: 10px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  font-weight: 500;
  white-space: nowrap;
  transition: all .16s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.btn:hover { border-color: var(--brand-1); color: var(--brand-1); background: rgba(79, 70, 229, .05); }
.btn:active { transform: scale(.97); }

.btn-primary {
  background: var(--brand-grad);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 4px 14px rgba(79, 70, 229, .3);
}
.btn-primary:hover {
  color: #fff;
  background: var(--brand-grad);
  filter: brightness(1.07);
  box-shadow: 0 6px 20px rgba(79, 70, 229, .4);
}

.btn-danger {
  background: var(--red);
  border-color: transparent;
  color: #fff;
}
.btn-danger:hover { color: #fff; background: #dc2626; border-color: transparent; }

.btn-ghost {
  width: 38px;
  padding: 0;
  font-size: 16px;
  border-color: var(--border);
  background: var(--surface-2);
}

.btn-sm { height: 32px; padding: 0 12px; font-size: 13px; border-radius: 8px; }

/* ===================== 表格 ===================== */
.table-wrap { overflow-x: auto; position: relative; }

.data-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 1000px;
}

.data-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 12.5px;
  font-weight: 600;
  text-align: left;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  letter-spacing: .3px;
}
.data-table thead th[data-sort] { cursor: pointer; user-select: none; }
.data-table thead th[data-sort]:hover { color: var(--brand-1); }

.data-table tbody td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  white-space: nowrap;
}
.data-table tbody tr { transition: background .14s; }
.data-table tbody tr:hover { background: rgba(79, 70, 229, .035); }
.data-table tbody tr:last-child td { border-bottom: none; }

.col-avatar, .col-action { width: 1%; }

/* —— 头像缩略图 —— */
.avatar-thumb {
  width: 44px; height: 44px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border);
  cursor: zoom-in;
  background: var(--surface-2);
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s;
}
.avatar-thumb:hover {
  transform: scale(1.12);
  border-color: var(--brand-1);
  box-shadow: 0 6px 18px rgba(79, 70, 229, .34);
}

.name-cell { font-weight: 600; }
.sid-cell  { font-family: ui-monospace, Consolas, monospace; color: var(--text-2); font-size: 13px; }
.muted     { color: var(--text-3); }

.gender-tag {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}
.gender-male   { background: #e0f2fe; color: #0369a1; }
.gender-female { background: #fce7f3; color: #be185d; }
body.dark .gender-male   { background: rgba(3, 105, 161, .22); color: #7dd3fc; }
body.dark .gender-female { background: rgba(190, 24, 93, .22); color: #f9a8d4; }

.score-pill {
  display: inline-block;
  min-width: 46px;
  text-align: center;
  padding: 2px 9px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 12.5px;
}
.score-good { background: #dcfce7; color: #15803d; }
.score-mid  { background: #fef3c7; color: #b45309; }
.score-bad  { background: #fee2e2; color: #b91c1c; }
body.dark .score-good { background: rgba(21, 128, 61, .25); color: #6ee7b7; }
body.dark .score-mid  { background: rgba(180, 83, 9, .25); color: #fcd34d; }
body.dark .score-bad  { background: rgba(185, 28, 28, .25); color: #fca5a5; }

.row-actions { display: flex; gap: 6px; }
.icon-btn {
  width: 32px; height: 32px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 14px;
  transition: all .16s;
}
.icon-btn:hover { border-color: var(--brand-1); background: rgba(79, 70, 229, .08); }
.icon-btn.danger:hover { border-color: var(--red); background: rgba(239, 68, 68, .1); }

/* ===================== 空状态 ===================== */
.empty-state { padding: 56px 20px; text-align: center; }
.empty-emoji { font-size: 44px; margin-bottom: 10px; opacity: .75; }
.empty-title { margin: 0 0 6px; font-size: 15px; font-weight: 600; }
.empty-sub { margin: 0; font-size: 13px; color: var(--text-3); }

/* ===================== 分页 ===================== */
.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding: 14px 18px;
  border-top: 1px solid var(--border);
  background: var(--surface);
}
.page-info { font-size: 13px; color: var(--text-2); }
.page-ctrl { display: flex; align-items: center; gap: 6px; }
.page-btn {
  height: 32px;
  padding: 0 12px;
  border-radius: 8px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  cursor: pointer;
  font-size: 13px;
  transition: all .16s;
}
.page-btn:hover:not(:disabled) { border-color: var(--brand-1); color: var(--brand-1); }
.page-btn:disabled { opacity: .45; cursor: not-allowed; }
.page-numbers { display: flex; gap: 5px; }
.page-num {
  min-width: 32px; height: 32px;
  padding: 0 8px;
  border-radius: 8px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  cursor: pointer;
  font-size: 13px;
  transition: all .16s;
}
.page-num:hover { border-color: var(--brand-1); color: var(--brand-1); }
.page-num.active {
  background: var(--brand-grad);
  border-color: transparent;
  color: #fff;
  font-weight: 600;
}

/* ===================== 页脚 ===================== */
.footer {
  margin-top: 24px;
  text-align: center;
  font-size: 12.5px;
  color: var(--text-3);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}
.footer strong { color: var(--brand-1); }
.footer-sep { opacity: .5; }

/* ===================== 弹窗 ===================== */
.modal { position: fixed; inset: 0; z-index: 200; display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal[hidden] { display: none; }

.modal-mask {
  position: absolute;
  inset: 0;
  background: rgba(18, 22, 40, .48);
  backdrop-filter: blur(4px);
  animation: fadeIn .18s ease;
}

.modal-panel {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 720px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: popIn .22s cubic-bezier(.2, .9, .3, 1.2);
}
.modal-panel-sm { max-width: 420px; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes popIn { from { opacity: 0; transform: translateY(14px) scale(.97); } to { opacity: 1; transform: none; } }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.modal-header h2 { margin: 0; font-size: 16px; font-weight: 700; }
.modal-close {
  width: 32px; height: 32px;
  border-radius: 8px;
  border: none;
  background: var(--surface-2);
  color: var(--text-2);
  cursor: pointer;
  font-size: 14px;
  transition: all .16s;
}
.modal-close:hover { background: rgba(239, 68, 68, .12); color: var(--red); }

.modal-body { padding: 20px; overflow-y: auto; }
.modal-body.confirm-body { padding: 22px 20px; }
.confirm-body p { margin: 0; color: var(--text-2); }

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
}

/* ===================== 表单 ===================== */
.avatar-field {
  display: flex;
  gap: 18px;
  align-items: center;
  padding: 14px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface-2);
  margin-bottom: 20px;
}

.avatar-uploader {
  position: relative;
  width: 92px; height: 92px;
  border-radius: 50%;
  overflow: hidden;
  cursor: pointer;
  border: 2px solid var(--border-strong);
  flex-shrink: 0;
  background: #fff;
  transition: border-color .18s, box-shadow .18s;
}
.avatar-uploader:hover { border-color: var(--brand-1); box-shadow: 0 0 0 4px rgba(79, 70, 229, .12); }
.avatar-uploader img { width: 100%; height: 100%; object-fit: cover; }
.avatar-uploader-hint {
  position: absolute;
  inset: auto 0 0 0;
  background: rgba(20, 24, 40, .68);
  color: #fff;
  font-size: 11.5px;
  text-align: center;
  padding: 3px 0;
  opacity: 0;
  transition: opacity .18s;
}
.avatar-uploader:hover .avatar-uploader-hint { opacity: 1; }

.avatar-field-side { min-width: 0; }
.field-title { margin: 0 0 3px; font-weight: 600; }
.field-desc { margin: 0 0 10px; font-size: 12.5px; color: var(--text-3); }
.avatar-actions { display: flex; flex-wrap: wrap; gap: 8px; }

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 16px;
}
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field-full { grid-column: 1 / -1; }
.field-label { font-size: 13px; color: var(--text-2); font-weight: 500; }
.req { color: var(--red); font-style: normal; }

.field input, .field select, .field textarea {
  height: 38px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  outline: none;
  transition: border-color .18s, box-shadow .18s, background .18s;
}
.field textarea { height: auto; padding: 9px 12px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--brand-1);
  background: var(--surface);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, .12);
}
.field input.invalid { border-color: var(--red); box-shadow: 0 0 0 3px rgba(239, 68, 68, .12); }

/* ===================== 头像预览器 ===================== */
.viewer { position: fixed; inset: 0; z-index: 300; }
.viewer[hidden] { display: none; }

.viewer-mask {
  position: absolute;
  inset: 0;
  background: rgba(8, 10, 20, .92);
  animation: fadeIn .18s ease;
}

.viewer-stage {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  cursor: grab;
  touch-action: none;
}
.viewer-stage.grabbing { cursor: grabbing; }

.viewer-stage img {
  max-width: none;
  max-height: none;
  border-radius: 8px;
  transform-origin: center center;
  will-change: transform;
  user-select: none;
  box-shadow: 0 20px 70px rgba(0, 0, 0, .6);
  background: #fff;
}

.viewer-topbar {
  position: absolute;
  top: 0; left: 0; right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 22px;
  color: #fff;
  background: linear-gradient(to bottom, rgba(0, 0, 0, .55), transparent);
  pointer-events: none;
}
.viewer-title { font-size: 15px; font-weight: 600; letter-spacing: .5px; }
.viewer-icon-btn {
  pointer-events: auto;
  width: 38px; height: 38px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, .14);
  color: #fff;
  font-size: 15px;
  cursor: pointer;
  transition: background .16s, transform .16s;
}
.viewer-icon-btn:hover { background: rgba(255, 255, 255, .28); transform: rotate(90deg); }

.viewer-toolbar {
  position: absolute;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(24, 28, 46, .82);
  border: 1px solid rgba(255, 255, 255, .12);
  backdrop-filter: blur(12px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, .5);
  max-width: calc(100vw - 32px);
  overflow-x: auto;
  scrollbar-width: none;
}
.viewer-toolbar::-webkit-scrollbar { display: none; }

.viewer-btn {
  height: 36px;
  min-width: 40px;
  padding: 0 12px;
  border-radius: 999px;
  border: none;
  background: rgba(255, 255, 255, .1);
  color: #fff;
  font-size: 14px;
  cursor: pointer;
  white-space: nowrap;
  transition: background .16s, transform .12s;
}
.viewer-btn:hover { background: rgba(124, 58, 237, .75); }
.viewer-btn:active { transform: scale(.94); }

.viewer-scale {
  min-width: 58px;
  text-align: center;
  color: #cbd5e1;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}
.viewer-divider { width: 1px; height: 22px; background: rgba(255, 255, 255, .18); margin: 0 4px; flex-shrink: 0; }

.viewer-tip {
  position: absolute;
  bottom: 6px;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(255, 255, 255, .45);
  font-size: 11.5px;
  white-space: nowrap;
}

/* ===================== Toast ===================== */
.toast-container {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 400;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}
.toast {
  min-width: 200px;
  max-width: 340px;
  padding: 11px 16px;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--brand-1);
  box-shadow: var(--shadow-lg);
  font-size: 13.5px;
  display: flex;
  align-items: center;
  gap: 9px;
  animation: toastIn .25s cubic-bezier(.2, .9, .3, 1.2);
  pointer-events: auto;
}
.toast.leaving { animation: toastOut .22s ease forwards; }
.toast.success { border-left-color: var(--green); }
.toast.error   { border-left-color: var(--red); }
.toast.warn    { border-left-color: var(--amber); }

@keyframes toastIn  { from { opacity: 0; transform: translateX(30px); } to { opacity: 1; transform: none; } }
@keyframes toastOut { from { opacity: 1; } to { opacity: 0; transform: translateX(30px); } }

/* ===================== 当前登录用户 ===================== */
.user-menu { position: relative; }

.user-btn {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  height: 42px;
  padding: 0 12px 0 6px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  cursor: pointer;
  transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}
.user-btn:hover {
  border-color: var(--brand-1);
  box-shadow: 0 4px 14px rgba(79, 70, 229, .14);
}
.user-btn[aria-expanded="true"] {
  border-color: var(--brand-1);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, .13);
}

.user-avatar {
  flex: none;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  background: var(--brand-grad);
  user-select: none;
}
.user-avatar-lg { width: 38px; height: 38px; font-size: 15px; }

.user-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1.22;
  max-width: 120px;
}
.user-meta strong {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 120px;
}
.user-meta em {
  font-size: 11.5px;
  font-style: normal;
  color: var(--text-3);
}
.user-caret {
  font-size: 10px;
  color: var(--text-3);
  transition: transform .2s ease;
}
.user-btn[aria-expanded="true"] .user-caret { transform: rotate(180deg); }

/* 下拉面板 */
.user-dropdown {
  position: absolute;
  top: calc(100% + 9px);
  right: 0;
  z-index: 120;
  width: 232px;
  padding: 7px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
  animation: dropdownIn .17s ease both;
}
.user-dropdown[hidden] { display: none; }
@keyframes dropdownIn {
  from { opacity: 0; transform: translateY(-7px) scale(.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.user-dropdown-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px 11px;
}
.user-dropdown-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.35;
}
.user-dropdown-info strong {
  font-size: 13.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-dropdown-info span {
  font-size: 11.5px;
  color: var(--text-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-dropdown-sep {
  height: 1px;
  margin: 0 6px 6px;
  background: var(--border);
}

.user-menu-item {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 9px 11px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  text-align: left;
  font-size: 13.5px;
  cursor: pointer;
  transition: background .15s ease, color .15s ease;
}
.user-menu-item:hover { background: rgba(79, 70, 229, .09); color: var(--brand-1); }
.user-menu-item.danger:hover { background: rgba(239, 68, 68, .1); color: var(--red); }

/* ===================== 修改密码弹窗 ===================== */
.pwd-account {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 11px 13px;
  margin-bottom: 16px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--surface-2);
}
.pwd-account div { display: flex; flex-direction: column; line-height: 1.32; min-width: 0; }
.pwd-account strong { font-size: 13.5px; }
.pwd-account .muted { font-size: 12px; color: var(--text-3); }

#pwdForm .field { margin-bottom: 14px; }
#pwdForm .field:last-of-type { margin-bottom: 0; }

.pwd-strength {
  display: flex;
  align-items: center;
  gap: 4px;
  margin: -6px 0 14px;
}
.pwd-strength .bar {
  height: 4px;
  flex: 1;
  border-radius: 999px;
  background: var(--border);
  transition: background .2s ease;
}
.pwd-strength em {
  flex: none;
  margin-left: 6px;
  font-style: normal;
  font-size: 11.5px;
  color: var(--text-3);
  min-width: 48px;
}
.pwd-strength[data-level="1"] .bar:nth-child(1) { background: var(--red); }
.pwd-strength[data-level="2"] .bar:nth-child(-n+2) { background: var(--amber); }
.pwd-strength[data-level="3"] .bar:nth-child(-n+3) { background: #3b82f6; }
.pwd-strength[data-level="4"] .bar { background: var(--green); }
.pwd-strength[data-level="1"] em { color: var(--red); }
.pwd-strength[data-level="2"] em { color: var(--amber); }
.pwd-strength[data-level="3"] em { color: #3b82f6; }
.pwd-strength[data-level="4"] em { color: var(--green); }

.pwd-tip {
  margin: 12px 0 0;
  padding: 9px 12px;
  border-radius: 9px;
  font-size: 12.5px;
  line-height: 1.55;
  background: rgba(245, 158, 11, .1);
  border: 1px solid rgba(245, 158, 11, .3);
  color: #b45309;
}
.pwd-tip[hidden] { display: none; }
.pwd-tip.error {
  background: rgba(239, 68, 68, .09);
  border-color: rgba(239, 68, 68, .28);
  color: #b91c1c;
}
body.dark .pwd-tip { color: #fcd34d; }
body.dark .pwd-tip.error { color: #fca5a5; }

/* ===================== 只读权限提示条 ===================== */
.readonly-tip {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0 0 14px;
  padding: 9px 14px;
  border-radius: 10px;
  font-size: 13px;
  background: rgba(14, 165, 233, .1);
  border: 1px solid rgba(14, 165, 233, .3);
  color: #0369a1;
}
.readonly-tip b { font-weight: 700; }
body.dark .readonly-tip { color: #7dd3fc; }

/* ===================== 响应式 ===================== */
@media (max-width: 820px) {
  .topbar-inner { padding: 0 14px; gap: 10px; }
  .brand-sub { display: none; }
  .dev-label { display: none; }
  .dev-badge { padding: 6px 12px; font-size: 12.5px; }
  .user-meta { display: none; }
  .user-btn { padding: 0 8px 0 5px; }
  .container { padding: 16px 14px 30px; }
  .form-grid { grid-template-columns: 1fr; }
  .avatar-field { flex-direction: column; align-items: flex-start; }
  .toolbar { padding: 14px; }
  .search-box { max-width: none; }
  .pagination { flex-direction: column; align-items: stretch; }
  .page-ctrl { justify-content: center; }
}

@media (max-width: 520px) {
  .dev-badge { display: none; }
  .user-dropdown { width: 210px; }
}
