/* =========================================================
   后台管理样式 · 深色工作台 / 响应式
   ========================================================= */
:root {
  --bg: #090c16;
  --sidebar: #0c1120;
  --surface: #111827;
  --surface-2: #161f31;
  --surface-3: #1b2539;
  --border: rgba(255, 255, 255, 0.085);
  --border-strong: rgba(255, 255, 255, 0.16);
  --text: #e9eef8;
  --text-soft: #bfc8da;
  --muted: #8491a8;
  --accent: #8b6bff;
  --accent-2: #35d6ee;
  --accent-soft: rgba(139, 107, 255, 0.14);
  --danger: #f87171;
  --success: #34d399;
  --gradient: linear-gradient(120deg, #8b6bff, #35d6ee);
  --shadow: 0 22px 60px rgba(0, 0, 0, 0.4);
  --radius: 16px;
}

* { box-sizing: border-box; }
body.admin-body {
  margin: 0; min-height: 100vh; background: var(--bg); color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 14px; line-height: 1.6; -webkit-font-smoothing: antialiased;
}
button, input, textarea, select { font: inherit; }
a { color: inherit; text-decoration: none; }
[hidden] { display: none !important; }

/* ---------- 通用组件 ---------- */
.brand-mark {
  display: grid; place-items: center; width: 38px; height: 38px; flex-shrink: 0;
  border-radius: 11px; background: var(--gradient); color: #fff; font-weight: 800; font-size: 1rem;
  box-shadow: 0 6px 20px rgba(139, 107, 255, 0.3);
}
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 20px; border-radius: 10px; border: 1px solid transparent;
  font-weight: 600; font-size: 0.88rem; cursor: pointer; transition: all 0.22s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--gradient); color: #fff; box-shadow: 0 8px 22px rgba(139, 107, 255, 0.22); }
.btn-outline { background: var(--surface-2); border-color: var(--border-strong); color: var(--text); }
.btn-outline:hover { background: var(--surface-3); }
.btn-danger { background: #b91c1c; color: #fff; }
.btn-danger:hover { background: #dc2626; }
.btn-sm { padding: 8px 15px; font-size: 0.82rem; }
.btn-block { width: 100%; }
.link-btn { background: none; border: 0; color: var(--accent-2); cursor: pointer; font-size: 0.82rem; }
.link-btn:hover { text-decoration: underline; }
.text-right { text-align: right; }

.field { margin-bottom: 16px; }
.field label { display: block; margin-bottom: 7px; color: var(--text-soft); font-size: 0.83rem; font-weight: 600; }
.field label span { color: var(--danger); }
.field input, .field textarea, .field select {
  width: 100%; padding: 11px 13px; border-radius: 10px;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text);
  outline: none; resize: vertical; transition: border-color 0.2s, box-shadow 0.2s;
}
.field input::placeholder, .field textarea::placeholder { color: var(--muted); opacity: 0.7; }
.field input:focus, .field textarea:focus, .field select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.field select option { background: var(--surface); }
.form-error { color: var(--danger); min-height: 20px; font-size: 0.82rem; margin: 0 0 8px; }
.hint { color: var(--muted); font-size: 0.78rem; margin-top: 14px; }

/* ---------- 登录 ---------- */
.login-view { position: relative; min-height: 100vh; display: grid; place-items: center; padding: 24px; overflow: hidden; }
.login-bg {
  position: absolute; inset: 0; pointer-events: none;
  background:
    radial-gradient(700px 500px at 20% 15%, rgba(139, 107, 255, 0.2), transparent 60%),
    radial-gradient(600px 450px at 85% 80%, rgba(53, 214, 238, 0.12), transparent 60%);
}
.login-card {
  position: relative; width: min(100%, 420px); padding: 38px;
  background: rgba(17, 24, 39, 0.92); border: 1px solid var(--border);
  border-radius: 24px; box-shadow: var(--shadow); backdrop-filter: blur(16px);
}
.login-brand { display: flex; align-items: center; gap: 11px; font-weight: 700; font-size: 0.98rem; margin-bottom: 30px; }
.login-brand b { color: var(--accent-2); }
.login-card h1 { margin: 0 0 6px; font-size: 1.7rem; letter-spacing: -0.02em; }
.login-subtitle { margin: 0 0 28px; color: var(--muted); font-size: 0.88rem; }
.login-footer { display: flex; justify-content: space-between; gap: 12px; margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--border); font-size: 0.76rem; color: var(--muted); }
.login-footer a { color: var(--accent-2); }

/* ---------- 布局 ---------- */
.app-view { min-height: 100vh; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: 244px; z-index: 50;
  background: var(--sidebar); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; padding: 24px 14px;
}
.sidebar-brand { display: flex; align-items: center; gap: 11px; padding: 0 10px 26px; }
.sidebar-brand strong { display: block; font-size: 0.98rem; }
.sidebar-brand small { display: block; color: var(--muted); font-size: 0.72rem; }
.side-nav { display: grid; gap: 4px; flex: 1; }
.side-link {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 11px 14px; border-radius: 10px; border: 0; background: transparent;
  color: var(--muted); font-size: 0.9rem; text-align: left; cursor: pointer; transition: all 0.2s;
}
.side-link:hover { background: var(--surface-2); color: var(--text); }
.side-link.active { background: var(--accent-soft); color: #b9a6ff; font-weight: 600; }
.side-icon { width: 20px; text-align: center; font-size: 1.05rem; }
.side-badge { margin-left: auto; min-width: 20px; padding: 1px 6px; border-radius: 100px; background: var(--danger); color: #fff; font-size: 0.7rem; text-align: center; }
.sidebar-bottom { display: grid; gap: 4px; padding-top: 16px; border-top: 1px solid var(--border); }
.sidebar-overlay { display: none; }

.app-main { margin-left: 244px; min-height: 100vh; }
.app-header {
  position: sticky; top: 0; z-index: 30; height: 70px; padding: 0 36px;
  display: flex; align-items: center; gap: 16px;
  background: rgba(9, 12, 22, 0.88); backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}
.app-header h1 { margin: 0; font-size: 1.05rem; font-weight: 700; }
.header-user { display: flex; align-items: center; gap: 10px; margin-left: auto; color: var(--text-soft); font-size: 0.85rem; }
.user-avatar { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 9px; background: var(--gradient); color: #fff; font-weight: 700; }
.menu-button { display: none; background: none; border: 1px solid var(--border); color: var(--text); border-radius: 8px; padding: 6px 11px; cursor: pointer; }
.app-content { padding: 34px 36px 70px; max-width: 1300px; }

/* ---------- 面板 ---------- */
.panel { display: none; animation: fadeIn 0.3s ease; }
.panel.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } }
.page-intro { display: flex; justify-content: space-between; align-items: center; gap: 20px; margin-bottom: 28px; }
.page-intro h2 { margin: 0 0 4px; font-size: 1.5rem; letter-spacing: -0.02em; }
.page-intro p { margin: 0; color: var(--muted); font-size: 0.86rem; }
.panel-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 24px; margin-bottom: 22px;
}
.panel-card h3 { margin: 0 0 18px; font-size: 1rem; }
.panel-card-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 16px; }
.panel-card-head h3 { margin: 0; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card { padding: 22px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); }
.stat-card span { color: var(--muted); font-size: 0.8rem; }
.stat-card strong { display: block; margin-top: 6px; font-size: 2rem; line-height: 1.2; letter-spacing: -0.03em; }
.stat-card:nth-child(1) strong { color: #b9a6ff; }
.stat-card:nth-child(2) strong { color: #67e8f9; }
.stat-card:nth-child(3) strong { color: #86efac; }
.stat-card:nth-child(4) strong { color: #fcd34d; }
.dashboard-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.mini-list { display: grid; gap: 10px; }
.mini-item { display: flex; align-items: flex-start; gap: 12px; padding: 12px; border-radius: 11px; background: var(--surface-2); }
.mini-item strong { display: block; font-size: 0.86rem; font-weight: 600; }
.mini-item p { margin: 3px 0 0; color: var(--muted); font-size: 0.8rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-item time { margin-left: auto; color: var(--muted); font-size: 0.72rem; white-space: nowrap; }
.mini-empty { padding: 24px; text-align: center; color: var(--muted); font-size: 0.85rem; background: var(--surface-2); border-radius: 11px; }
.quick-actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 16px; margin-top: 4px; }
.quick-card {
  text-align: left; padding: 20px; border-radius: var(--radius); cursor: pointer;
  background: var(--surface); border: 1px solid var(--border); color: var(--text); transition: all 0.22s;
}
.quick-card:hover { transform: translateY(-3px); border-color: var(--accent); }
.quick-card span { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; background: var(--accent-soft); color: #b9a6ff; font-size: 1.1rem; margin-bottom: 12px; }
.quick-card strong { display: block; font-size: 0.92rem; }
.quick-card small { color: var(--muted); font-size: 0.78rem; }

/* ---------- 表单面板 ---------- */
.form-card { max-width: 780px; }
.form-card.narrow { max-width: 480px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }
.section-divider { height: 1px; background: var(--border); margin: 28px 0; }
.avatar-editor { display: flex; align-items: center; gap: 18px; margin-bottom: 18px; flex-wrap: wrap; }
.avatar-preview {
  width: 72px; height: 72px; flex-shrink: 0; border-radius: 16px;
  display: grid; place-items: center; overflow: hidden;
  background: var(--gradient); color: #fff; font-size: 1.6rem; font-weight: 800;
}
.avatar-preview img { width: 100%; height: 100%; object-fit: cover; }
.avatar-editor-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.avatar-editor-actions .hint { margin: 0; flex-basis: 100%; }
.skill-editor { display: grid; gap: 12px; margin-bottom: 18px; }
.skill-row { display: grid; grid-template-columns: 1.5fr 0.8fr 0.8fr 0.5fr auto; gap: 10px; align-items: center; padding: 12px; border-radius: 12px; background: var(--surface-2); }
.skill-row input, .skill-row select { width: 100%; padding: 9px 11px; border-radius: 8px; background: var(--surface-3); border: 1px solid var(--border); color: var(--text); outline: none; min-width: 0; }
.skill-row input:focus, .skill-row select:focus { border-color: var(--accent); }
.icon-button { width: 34px; height: 34px; border-radius: 8px; border: 1px solid var(--border); background: transparent; color: var(--muted); cursor: pointer; }
.icon-button:hover { color: var(--danger); border-color: var(--danger); }

/* ---------- 表格 ---------- */
.table-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; min-width: 680px; }
.data-table th { padding: 15px 20px; text-align: left; color: var(--muted); font-size: 0.76rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; border-bottom: 1px solid var(--border); }
.data-table td { padding: 17px 20px; border-bottom: 1px solid var(--border); vertical-align: middle; font-size: 0.86rem; }
.data-table tr:last-child td { border-bottom: 0; }
.data-table tbody tr:hover { background: var(--surface-2); }
.cell-title { font-weight: 600; }
.cell-sub { color: var(--muted); font-size: 0.76rem; margin-top: 3px; max-width: 360px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pill { display: inline-block; padding: 3px 10px; border-radius: 100px; font-size: 0.72rem; font-weight: 600; background: var(--surface-3); color: var(--muted); }
.pill.green { background: rgba(52, 211, 153, 0.13); color: #6ee7b7; }
.pill.gray { background: rgba(148, 163, 184, 0.13); color: #cbd5e1; }
.pill.blue { background: rgba(53, 214, 238, 0.12); color: #67e8f9; }
.tag-inline { display: inline-block; margin: 2px 4px 2px 0; color: var(--muted); font-size: 0.76rem; }
.row-actions { display: flex; justify-content: flex-end; gap: 8px; }
.action-btn { padding: 6px 11px; border-radius: 8px; border: 1px solid var(--border); background: transparent; color: var(--text-soft); font-size: 0.78rem; cursor: pointer; }
.action-btn:hover { border-color: var(--accent); color: var(--text); }
.action-btn.danger:hover { border-color: var(--danger); color: var(--danger); }

/* ---------- 留言 ---------- */
.message-list { display: grid; gap: 14px; }
.message-card { display: grid; grid-template-columns: 44px 1fr auto; gap: 16px; padding: 20px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); }
.message-card.unread { border-left: 3px solid var(--accent); }
.message-avatar { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; background: var(--accent-soft); color: #b9a6ff; font-weight: 700; }
.message-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; }
.message-head strong { font-size: 0.92rem; }
.message-head time { color: var(--muted); font-size: 0.75rem; }
.message-content { margin: 0; color: var(--text-soft); font-size: 0.88rem; white-space: pre-wrap; word-break: break-word; }
.message-actions { display: flex; flex-direction: column; gap: 8px; align-items: flex-end; }
.message-email { color: var(--muted); font-size: 0.76rem; margin-top: 6px; }

/* ---------- 弹窗 ---------- */
.admin-modal { position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; padding: 20px; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(3, 5, 12, 0.76); backdrop-filter: blur(6px); }
.modal-dialog {
  position: relative; width: min(100%, 620px); max-height: 88vh; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: 20px; box-shadow: var(--shadow);
  animation: modalIn 0.24s ease;
}
.modal-dialog.small { width: min(100%, 400px); }
@keyframes modalIn { from { opacity: 0; transform: translateY(14px) scale(0.98); } }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 20px 24px; border-bottom: 1px solid var(--border); }
.modal-head h3 { margin: 0; font-size: 1.05rem; }
.modal-x { background: none; border: 0; color: var(--muted); font-size: 1.5rem; cursor: pointer; line-height: 1; }
.modal-x:hover { color: var(--text); }
.modal-body { padding: 24px; }
.modal-body h3 { margin-top: 0; }
.confirm-text { color: var(--text-soft); font-size: 0.9rem; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 16px 24px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 20px 20px; }
.checkbox-line { display: flex; align-items: center; gap: 9px; margin: 8px 0 18px; color: var(--text-soft); font-size: 0.86rem; }
.checkbox-line input { accent-color: var(--accent); width: 16px; height: 16px; }
.modal-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; bottom: 26px; left: 50%; transform: translate(-50%, 16px);
  padding: 11px 20px; border-radius: 11px; background: var(--surface-3);
  border: 1px solid var(--border-strong); box-shadow: var(--shadow);
  font-size: 0.86rem; opacity: 0; pointer-events: none; z-index: 400; transition: all 0.25s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { border-color: var(--danger); color: var(--danger); }

/* ---------- 响应式 ---------- */
@media (max-width: 1100px) {
  .dashboard-grid { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .sidebar { transform: translateX(-100%); transition: transform 0.25s ease; box-shadow: var(--shadow); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay.show { display: block; position: fixed; inset: 0; z-index: 45; background: rgba(0,0,0,.55); }
  .app-main { margin-left: 0; }
  .menu-button { display: block; }
  .app-header { padding: 0 20px; }
  .app-content { padding: 26px 20px 60px; }
  .form-grid, .modal-grid { grid-template-columns: 1fr; }
  .skill-row { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 560px) {
  .login-card { padding: 26px; }
  .page-intro { flex-direction: column; align-items: flex-start; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .message-card { grid-template-columns: 36px 1fr; }
  .message-avatar { width: 36px; height: 36px; }
  .message-actions { grid-column: 1 / -1; flex-direction: row; justify-content: flex-start; }
  .skill-row { grid-template-columns: 1fr; }
  .modal-body { padding: 18px; }
}
