/* 修复：确保 hidden 属性不被 display 类样式覆盖（遮罩层常驻导致后台无法点击） */
[hidden] { display: none !important; }

/* ============ 管理后台样式 ============ */
:root {
  --navy-900: #0a2747;
  --primary: #14508c;
  --accent: #2e9bd6;
  --accent-soft: #e8f4fd;
  --bg: #f2f6fa;
  --ink: #1c2b3a;
  --muted: #6b7d92;
  --line: #e3eaf2;
  --white: #fff;
  --danger: #c0392b;
  --ok: #1e8e5a;
  --radius: 10px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }
body { font-family: var(--font); color: var(--ink); background: var(--bg); font-size: 14.5px; line-height: 1.65; }
a { color: inherit; text-decoration: none; }
ul { list-style: none; }
button { font-family: inherit; cursor: pointer; }
img { max-width: 100%; display: block; }

/* ---------- 登录页 ---------- */
.login-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: linear-gradient(135deg, #0a2747, #0b3b66 60%, #14508c); padding: 24px; }
.login-wrap { width: 100%; max-width: 400px; }
.login-card { background: #fff; border-radius: 16px; padding: 40px 38px 30px; box-shadow: 0 24px 60px rgba(0, 0, 0, .35); }
.login-brand { display: flex; justify-content: center; margin-bottom: 16px; }
.login-card h1 { text-align: center; font-size: 24px; color: var(--navy-900); }
.login-sub { text-align: center; color: var(--muted); font-size: 13.5px; margin: 6px 0 26px; }
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13.5px; font-weight: 600; color: var(--navy-900); margin-bottom: 6px; }
.field input {
  width: 100%; padding: 11px 13px; font-size: 15px; font-family: inherit;
  border: 1px solid #cddae8; border-radius: 8px; background: #fbfdff;
}
.field input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(46, 155, 214, .15); }
.form-msg { min-height: 20px; font-size: 13.5px; margin-bottom: 10px; }
.form-msg.err { color: var(--danger); }
.form-msg.ok { color: var(--ok); }
.login-foot { text-align: center; margin-top: 18px; font-size: 13px; color: var(--muted); }
.login-foot a:hover { color: var(--primary); }

/* ---------- 按钮 ---------- */
.btn-admin {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 9px 18px; border-radius: 8px; font-size: 14px; font-weight: 600;
  border: 1px solid transparent; transition: all .2s;
}
.btn-primary-block { width: 100%; padding: 12px; background: var(--primary); color: #fff; font-size: 15px; }
.btn-primary-block:hover { background: #1a5fa8; }
.btn-ghost { background: #fff; color: var(--primary); border-color: #c9d9e8; }
.btn-ghost:hover { border-color: var(--accent); }
.btn-sm { padding: 6px 12px; font-size: 13px; border-radius: 7px; }
.btn-danger { background: #fdf1f0; color: var(--danger); border-color: #eccfcb; }
.btn-danger:hover { background: #fbe3e1; }
.link-btn { background: none; border: 0; color: var(--muted); font-size: 13.5px; padding: 4px; }
.link-btn:hover { color: var(--danger); }
.link-btn.primary { color: var(--primary); }
.link-btn.primary:hover { color: var(--accent); }

/* ---------- 后台布局 ---------- */
.admin-shell { display: flex; min-height: 100vh; }
.admin-sidebar {
  width: 232px; flex: none; background: var(--navy-900); color: #c7d8ea;
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.sidebar-brand { display: flex; align-items: center; gap: 10px; padding: 20px 20px 16px; color: #fff; }
.sidebar-brand strong { font-size: 17px; display: block; }
.sidebar-brand small { font-size: 11.5px; color: #8fa9c6; }
.sidebar-nav { flex: 1; padding: 8px 12px; overflow-y: auto; }
.sidebar-nav a {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  border-radius: 8px; color: #c7d8ea; font-size: 14px; margin-bottom: 2px;
  transition: background .2s, color .2s;
}
.sidebar-nav a svg { flex: none; opacity: .85; }
.sidebar-nav a:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.sidebar-nav a.active { background: var(--accent); color: #fff; font-weight: 600; }
.nav-badge {
  margin-left: auto; background: #ff6b5e; color: #fff; font-size: 11.5px;
  border-radius: 100px; padding: 1px 8px; font-weight: 700;
}
.sidebar-foot { padding: 14px 20px; border-top: 1px solid rgba(255, 255, 255, .1); display: flex; align-items: center; justify-content: space-between; font-size: 13px; }

.admin-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.admin-topbar {
  display: flex; align-items: center; gap: 14px;
  background: #fff; border-bottom: 1px solid var(--line);
  padding: 0 26px; height: 60px; position: sticky; top: 0; z-index: 20;
}
.admin-topbar h1 { font-size: 18px; color: var(--navy-900); flex: 1; }
.view-site { font-size: 13.5px; color: var(--primary); font-weight: 600; }
.menu-btn { display: none; background: none; border: 0; color: var(--navy-900); padding: 6px; }
.admin-content { padding: 26px; flex: 1; }

/* ---------- 卡片/面板 ---------- */
.panel { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 1px 3px rgba(10, 39, 71, .05); }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 22px; border-bottom: 1px solid var(--line); }
.panel-head h2 { font-size: 16px; color: var(--navy-900); }
.panel-head .sub { font-size: 12.5px; color: var(--muted); font-weight: 400; margin-left: 8px; }
.panel-body { padding: 22px; }

.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 26px; }
.stat-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 22px; display: flex; align-items: center; gap: 16px; }
.stat-ico { width: 46px; height: 46px; border-radius: 12px; background: var(--accent-soft); color: var(--primary); display: inline-flex; align-items: center; justify-content: center; flex: none; }
.stat-card strong { font-size: 26px; color: var(--navy-900); display: block; line-height: 1.2; }
.stat-card span { font-size: 13px; color: var(--muted); }

/* ---------- 表单 ---------- */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 20px; }
.form-grid .full { grid-column: 1 / -1; }
.f-label { display: block; font-size: 13.5px; font-weight: 600; color: var(--navy-900); margin-bottom: 6px; }
.f-label .hint { font-weight: 400; color: var(--muted); font-size: 12.5px; }
.f-input, .f-textarea, .f-select {
  width: 100%; padding: 9px 12px; font-size: 14.5px; font-family: inherit;
  border: 1px solid #cddae8; border-radius: 8px; background: #fbfdff; color: var(--ink);
}
.f-input:focus, .f-textarea:focus, .f-select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(46, 155, 214, .15); }
.f-textarea { resize: vertical; min-height: 120px; line-height: 1.7; }
.form-actions { display: flex; gap: 10px; margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); }
.form-tip { font-size: 13.5px; margin-top: 10px; }
.form-tip.err { color: var(--danger); }
.form-tip.ok { color: var(--ok); }
.f-check { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.f-check input { width: 16px; height: 16px; }

/* ---------- 表格 ---------- */
.table-wrap { overflow-x: auto; }
table.list { width: 100%; border-collapse: collapse; font-size: 14px; }
table.list th, table.list td { padding: 12px 16px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.list th { background: #f7fafc; font-size: 12.5px; color: var(--muted); font-weight: 600; white-space: nowrap; }
table.list tr:hover td { background: #fafcfe; }
table.list td.title-cell { font-weight: 600; color: var(--navy-900); max-width: 380px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.td-actions { display: flex; gap: 6px; white-space: nowrap; }
.thumb { width: 72px; height: 48px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); }
.thumb-empty { width: 72px; height: 48px; border-radius: 6px; background: var(--bg); border: 1px dashed #cfdcea; display: inline-flex; align-items: center; justify-content: center; color: #a9bccf; font-size: 11px; }
.tag-pill { display: inline-block; background: var(--accent-soft); color: var(--primary); font-size: 12px; border-radius: 100px; padding: 2px 10px; }
.tag-pill.gray { background: #eef2f6; color: var(--muted); }
.tag-pill.green { background: #e6f6ee; color: var(--ok); }
.tag-pill.red { background: #fdf1f0; color: var(--danger); }
.empty-row td { text-align: center; color: var(--muted); padding: 44px 16px; }
.empty-tip { text-align: center; color: var(--muted); padding: 60px 20px; }

/* ---------- 弹窗 ---------- */
.modal-mask { position: fixed; inset: 0; background: rgba(10, 39, 71, .5); display: flex; align-items: flex-start; justify-content: center; padding: 40px 20px; z-index: 100; overflow-y: auto; }
.modal { background: #fff; border-radius: 14px; width: 100%; max-width: 720px; box-shadow: 0 30px 80px rgba(0, 0, 0, .3); }
.modal.wide { max-width: 860px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 24px; border-bottom: 1px solid var(--line); }
.modal-head h3 { font-size: 17px; color: var(--navy-900); }
.modal-close { background: none; border: 0; font-size: 22px; color: var(--muted); line-height: 1; padding: 4px 8px; }
.modal-close:hover { color: var(--danger); }
.modal-body { padding: 22px 24px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 16px 24px; border-top: 1px solid var(--line); }

/* ---------- 上传 ---------- */
.upload-box { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.upload-preview { width: 150px; height: 100px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); display: none; }
.upload-preview.show { display: block; }
.upload-btn { position: relative; overflow: hidden; }
.upload-btn input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

/* ---------- 留言 ---------- */
.msg-list { display: flex; flex-direction: column; gap: 12px; }
.msg-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 20px; }
.msg-card.unread { border-left: 3px solid var(--accent); background: #fbfdff; }
.msg-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.msg-head strong { font-size: 15px; color: var(--navy-900); }
.msg-head .meta { font-size: 12.5px; color: var(--muted); }
.msg-content { font-size: 14.5px; color: #33455a; white-space: pre-line; }
.msg-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 12px; padding-top: 10px; border-top: 1px dashed #e8eef5; }
.msg-contact { font-size: 12.5px; color: var(--muted); }

/* ---------- 工作台 ---------- */
.dash-links { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.dash-link { display: flex; align-items: center; gap: 12px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; font-weight: 600; color: var(--navy-900); transition: all .2s; }
.dash-link:hover { border-color: var(--accent); box-shadow: 0 4px 14px rgba(10, 39, 71, .08); transform: translateY(-2px); }
.dash-link svg { color: var(--primary); }

/* ---------- 响应式 ---------- */
@media (max-width: 900px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .form-grid { grid-template-columns: 1fr; }
  .dash-links { grid-template-columns: 1fr; }
  .admin-sidebar { position: fixed; left: 0; top: 0; bottom: 0; z-index: 50; transform: translateX(-100%); transition: transform .25s; box-shadow: 12px 0 30px rgba(0, 0, 0, .2); }
  .admin-sidebar.open { transform: none; }
  .menu-btn { display: inline-flex; align-items: center; }
  .admin-content { padding: 18px; }
}
@media (max-width: 560px) {
  .stat-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .admin-topbar { padding: 0 14px; }
}
