:root{
  --primary:#0b79f7;
  --bg:#f4f6fb;
  --card:#fff;
  --text:#1f2937;
  --muted:#6b7280;
  --border:#e5e7eb;
}

*{box-sizing:border-box;}
html,body{height:100%;}
body{
  margin:0;
  font-family:system-ui,-apple-system,"Segoe UI",Arial,"Microsoft Yahei",sans-serif;
  background:var(--bg);
  color:var(--text);
  min-height:100vh;
  display:flex;
  flex-direction:column;
}

.container{
  max-width:1100px;
  margin:0 auto;
  padding:20px;
  width:100%;
  flex:1;
}

/* ===== 页首 ===== */
.site-topbar{
  background:#fff;
  border-bottom:1px solid #e5e7eb;
}
.site-topbar .inner{
  max-width:1100px;
  margin:0 auto;
  height:60px;
  padding:0 20px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
}
.site-title{
  font-size:24px;
  font-weight:800;
  color:#111;
  line-height:1;
}
.site-sub{
  font-size:14px;
  color:#2563eb;
  line-height:1;
}

/* ===== 顶部状态栏 ===== */
.header{
  display:flex;
  justify-content:space-between;
  align-items:center;
  margin-bottom:16px;
}
.logo-wrap{
  display:flex;
  align-items:baseline;
  gap:8px;
}
.logo{font-size:22px;font-weight:800;}
.logo-slogan{font-size:12px;font-weight:600;color:#2563eb;}
.logo-placeholder{visibility:hidden;}

/* 右侧胶囊统一间距 */
.header-right-pills{
  display:inline-flex;
  align-items:center;
  gap:6px;
}

/* ===== 通用 ===== */
.card{
  background:var(--card);
  border:1px solid var(--border);
  border-radius:12px;
  padding:16px;
  box-shadow:0 4px 12px rgba(0,0,0,.04);
}
.grid{
  display:grid;
  grid-template-columns:repeat(auto-fit,minmax(320px,1fr));
  gap:16px;
  margin-top:12px;
}
h2{margin:0 0 12px;font-size:18px;}
h3{margin:0 0 12px;font-size:16px;}

input[type=text],
input[type=password],
input[type=email],
input[type=file],
input[type=number],
select,
textarea{
  width:100%;
  padding:10px;
  border:1px solid var(--border);
  border-radius:8px;
  margin-top:8px;
  font-size:14px;
  background:#fff;
}

button{
  background:var(--primary);
  color:#fff;
  border:0;
  border-radius:8px;
  padding:10px 14px;
  cursor:pointer;
  font-size:14px;
}
button:disabled{opacity:.6;cursor:not-allowed;}

.link,button.link{
  background:transparent;
  color:var(--primary);
  border:none;
  padding:0;
  text-decoration:none;
  cursor:pointer;
}
.link:hover,button.link:hover{text-decoration:underline;}

.msg{
  padding:10px;
  border-radius:8px;
  margin-top:10px;
  font-size:14px;
}
.error{background:#fee2e2;border:1px solid #fecaca;color:#991b1b;}
.success{background:#ecfdf3;border:1px solid #bbf7d0;color:#166534;}

.muted{color:var(--muted);}
.text-right{text-align:right;}

/* ===== 徽章 ===== */
.badge{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  height:24px;
  padding:0 10px;
  border-radius:999px;
  font-size:12px;
  line-height:24px;
  border:1px solid transparent;
}

.badge-guest-pill{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  height:24px;
  padding:0 10px;
  border-radius:999px;
  font-size:12px;
  line-height:24px;
  white-space:nowrap;
  box-sizing:border-box;
  background:#ff5fa2;
  color:#ffd84d;
  border:1px solid #ff87bb;
}

.badge-login{
  background:#2078ee;
  color:#fff;
  border-color:#2078ee;
}

/* 消息 + 退出 */
.top-msg-link,
.logout-pill{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  height:24px;
  padding:0 10px;
  border-radius:999px;
  font-size:12px;
  line-height:24px;
  white-space:nowrap;
  box-sizing:border-box;
}
.top-msg-link{
  background:#e5e7eb;
  color:#25272f;
  border:1px solid #d1d5db;
  text-decoration:none;
}
.top-msg-link:hover{
  background:#dfe3e8;
  text-decoration:none;
}
.logout-pill{
  min-width:46px;
  background:#e5e7eb !important;
  color:#25272f !important;
  border:1px solid #d1d5db;
  padding:0 12px !important;
  text-decoration:none !important;
}
.logout-pill:hover{
  background:#dfe3e8 !important;
  text-decoration:none !important;
}

/* 顶部消息数字 */
.msg-count{
  margin-left:4px;
  min-width:13px;
  height:13px;
  padding:0 3px;
  border-radius:999px;
  background:#ef4444;
  color:#fff;
  font-size:9px;
  line-height:13px;
  text-align:center;
  font-weight:700;
  display:inline-block;
}

/* ===== 表格 ===== */
.table{
  width:100%;
  border-collapse:collapse;
  margin-top:10px;
  background:#fff;
}
.table th,.table td{
  border:1px solid var(--border);
  padding:8px;
  font-size:13px;
  text-align:left;
  vertical-align:middle;
}
.table th{
  background:#f9fafb;
  font-weight:600;
}

/* 小按钮 */
.copy-btn{
  margin-left:6px;
  padding:4px 8px;
  border-radius:6px;
  background:#e5e7eb;
  color:#111;
  border:0;
  cursor:pointer;
}

/* ===== 登录/注册/找回 ===== */
.auth-form .auth-field{position:relative;margin-top:10px;}
.auth-form .auth-icon{
  position:absolute;left:12px;top:50%;transform:translateY(-50%);
  width:18px;height:18px;color:#9ca3af;pointer-events:none;
  display:inline-flex;align-items:center;justify-content:center;
}
.auth-form .auth-input{
  width:100%;height:44px;
  padding:10px 12px 10px 40px;
  border:1.5px solid #d1d5db;
  border-radius:10px;
  background:#fff;
  color:#111827;
  font-size:14px;
  margin-top:0;
  transition:border-color .2s, box-shadow .2s, background .2s;
}
.auth-form .auth-input::placeholder{color:#9ca3af;}
.auth-form .auth-input:hover{border-color:#93c5fd;background:#f8fbff;}
.auth-form .auth-input:focus{
  outline:none;border-color:#0b79f7;
  box-shadow:0 0 0 4px rgba(11,121,247,.15);
  background:#fff;
}
.auth-form .auth-field:focus-within .auth-icon{color:#0b79f7;}

/* ===== 弹窗 ===== */
.modal-mask{
  position:fixed;inset:0;background:rgba(0,0,0,.45);
  display:none;align-items:center;justify-content:center;z-index:1000;
}
.modal{
  background:#fff;border-radius:12px;padding:20px;width:320px;
  max-width:calc(100vw - 24px);
  box-shadow:0 10px 30px rgba(0,0,0,.2);
}
.modal h3{margin:0 0 12px;}

/* ===== 用户中心 ===== */
.user-layout{
  display:grid;
  grid-template-columns:260px 1fr;
  gap:16px;
}
.sidebar h3{margin-top:0;}
.sidebar p{margin:8px 0;font-size:14px;}
.side-link{
  display:block;
  padding:8px 10px;
  border-radius:8px;
  color:#2563eb;
  text-decoration:none;
  margin-bottom:6px;
}
.side-link:hover{background:#eff6ff;}
.side-link.active{
  background:#dbeafe;
  color:#1d4ed8;
  font-weight:700;
}

/* 会员提示 */
.member-box{
  margin-top:8px;
  border-radius:8px;
  padding:8px 10px;
  font-size:14px;
  line-height:1.5;
  border:1px solid #e5e7eb;
}
.member-ok{background:#ecfdf3;border-color:#bbf7d0;color:#166534;}
.member-warn{background:#fff7ed;border-color:#fed7aa;color:#9a3412;}
.member-expired{background:#fee2e2;border-color:#fecaca;color:#991b1b;}
.member-normal{background:#f9fafb;border-color:#e5e7eb;color:#4b5563;}

.member-days-badge{
  display:inline-block;
  padding:4px 10px;
  border-radius:999px;
  font-size:13px;
  line-height:1.2;
  font-weight:700;
  background:#ff3867;
  color:#ffd84d;
}

/* 上传区 */
.upload-grid{
  display:grid;
  grid-template-columns:repeat(auto-fit,minmax(240px,1fr));
  gap:12px;
}
.upload-item{
  border:1px solid #e5e7eb;
  border-radius:10px;
  padding:12px;
  background:#fff;
}
.upload-item h3{margin:0 0 8px;font-size:15px;}

/* 发布区 */
.pub-grid{
  display:grid;
  grid-template-columns:160px 1fr auto;
  gap:8px;
}
.pub-grid-2{
  display:grid;
  grid-template-columns:repeat(3,minmax(180px,1fr));
  gap:8px;
}
.pub-grid-2 button{
  grid-column:1 / -1;
  justify-self:start;
}
.qq-list{
  display:grid;
  grid-template-columns:repeat(auto-fit,minmax(280px,1fr));
  gap:12px;
}
.qq-item{
  border:1px solid #e5e7eb;
  border-radius:10px;
  padding:12px;
  background:#fff;
}
.qq-op{margin-top:8px;display:flex;gap:8px;align-items:center;}

/* 我的页面 */
.page-edit-form label{font-size:13px;color:#374151;}
.page-style-grid{
  display:grid;
  grid-template-columns:repeat(3,minmax(140px,1fr));
  gap:8px;
  margin-top:8px;
}

/* 个人页 */
.home-public-wrap{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:16px;
  align-items:start;
}
.home-public-left{display:flex;flex-direction:column;}
.home-left-text{
  min-height:180px;
  white-space:pre-wrap;
  word-break:break-word;
  line-height:1.6;
}
.btn-download{
  display:inline-block;
  background:#0b79f7;
  color:#fff;
  padding:10px 14px;
  border-radius:8px;
  text-decoration:none;
}
.btn-download:hover{opacity:.9;}
.home-public-right{
  display:flex;
  justify-content:flex-end;
}
.img-wall{
  width:100%;
  max-width:520px;
  display:grid;
  grid-template-columns:1fr;
  gap:12px;
}
.img-card{
  background:#fff;
  border:1px solid #e5e7eb;
  border-radius:10px;
  overflow:hidden;
}
.img-title{
  padding:8px 10px;
  font-weight:700;
  border-bottom:1px solid #e5e7eb;
  background:#f9fafb;
}
.img-box{background:#f3f4f6;text-align:center;padding:10px;}
.img-box img{
  max-width:100%;
  max-height:320px;
  object-fit:contain;
  border-radius:6px;
}
.img-desc{
  padding:8px 10px;
  font-size:13px;
  color:#374151;
  border-top:1px solid #e5e7eb;
  min-height:38px;
}

/* 兑换 */
.redeem-grid{
  display:grid;
  grid-template-columns:repeat(auto-fit,minmax(220px,1fr));
  gap:12px;
}
.redeem-item{
  border:1px solid #e5e7eb;
  border-radius:10px;
  padding:12px;
  background:#fff;
}
.redeem-item h3{margin:0 0 8px;}

/* 后台 */
.admin-nav{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
  margin-top:10px;
}
.admin-form-row{
  display:grid;
  grid-template-columns:180px 240px 180px auto;
  gap:8px;
  align-items:center;
}
.admin-op-col{display:flex;flex-direction:column;gap:6px;}
.admin-inline{display:flex;gap:6px;align-items:center;}

/* 会员toast */
.member-toast{
  position:fixed;right:16px;top:16px;z-index:3000;
  width:320px;max-width:calc(100vw - 24px);
  border-radius:10px;padding:12px;
  box-shadow:0 10px 24px rgba(0,0,0,.15);
  border:1px solid transparent;font-size:13px;
}
.member-toast.warn{background:#fff7ed;border-color:#fed7aa;color:#9a3412;}
.member-toast.expired{background:#fee2e2;border-color:#fecaca;color:#991b1b;}
.member-toast-title{font-weight:700;margin-bottom:6px;}
.member-toast-text{line-height:1.5;}
.member-toast-close{
  margin-top:8px;background:#111827;color:#fff;border:0;border-radius:6px;
  padding:5px 10px;cursor:pointer;
}

/* ===== 消息中心增强 ===== */
.msg-filter{
  margin-top:12px;
  display:grid;
  grid-template-columns:160px 160px 1fr auto;
  gap:8px;
}
.msg-quick-pills{
  margin-top:10px;
  display:flex;
  flex-wrap:wrap;
  gap:8px;
}
.msg-pill{
  position:relative;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  height:26px;
  padding:0 12px;
  border-radius:999px;
  border:1px solid #d1d5db;
  background:#f3f4f6;
  color:#25272f;
  text-decoration:none;
  font-size:12px;
  line-height:26px;
}
.msg-pill:hover{background:#e5e7eb;}
.msg-pill.active{
  background:#2078ee;
  border-color:#2078ee;
  color:#fff;
}
.msg-pill-count{
  margin-left:6px;
  min-width:14px;
  height:14px;
  padding:0 4px;
  border-radius:999px;
  background:#ef4444;
  color:#fff;
  font-size:10px;
  line-height:14px;
  text-align:center;
  font-weight:700;
  display:inline-block;
}
.msg-pill.active .msg-pill-count{
  background:#ffd84d;
  color:#7a3a00;
}
.msg-pill-count-total{
  background:#6b7280;
  color:#fff;
}
.msg-pill.active .msg-pill-count-total{
  background:#dbeafe;
  color:#1d4ed8;
}

.table tr.notice-unread{
  position:relative;
  background:#f8fbff;
}
.table tr.notice-unread td{
  font-weight:600;
}
.table tr.notice-unread::before{
  content:"";
  position:absolute;
  left:0;top:0;bottom:0;
  width:3px;
  background:#2078ee;
  border-radius:2px;
}
.table tr.notice-read{
  opacity:.75;
}

.notice-type-badge{
  display:inline-block;
  padding:2px 8px;
  border-radius:999px;
  font-size:12px;
  line-height:1.4;
  background:#eef2ff;
  color:#3730a3;
  border:1px solid #c7d2fe;
}
.notice-type-file{
  background:#ecfeff;
  color:#155e75;
  border-color:#a5f3fc;
}
.notice-type-member{
  background:#fff7ed;
  color:#9a3412;
  border-color:#fed7aa;
}
.notice-type-post{
  background:#f0fdf4;
  color:#166534;
  border-color:#bbf7d0;
}
.notice-type-points{
  background:#fefce8;
  color:#854d0e;
  border-color:#fde68a;
}

.notice-status{
  display:inline-block;
  padding:2px 8px;
  border-radius:999px;
  font-size:12px;
  line-height:1.4;
}
.notice-status.unread{
  background:#fee2e2;
  color:#991b1b;
  border:1px solid #fecaca;
}
.notice-status.read{
  background:#e5e7eb;
  color:#374151;
  border:1px solid #d1d5db;
}

.msg-pagination{
  margin-top:12px;
  display:flex;
  gap:10px;
  align-items:center;
  flex-wrap:wrap;
}
.msg-pagination .page-link{
  display:inline-block;
  padding:4px 10px;
  border-radius:8px;
  background:#f3f4f6;
  color:#111827;
  text-decoration:none;
  border:1px solid #e5e7eb;
  font-size:13px;
}
.msg-pagination .page-link:hover{
  background:#e5e7eb;
}

/* ===== 页尾 ===== */
.site-footer{
  margin-top:0;
  background:#fff;
  border-top:1px solid #e5e7eb;
}
.site-footer .inner{
  max-width:1100px;
  margin:0 auto;
  min-height:68px;
  padding:12px 20px;
  display:grid;
  grid-template-columns:1fr auto 1fr;
  align-items:center;
  gap:12px;
}
.footer-col{
  font-size:13px;
  color:#6b7280;
  white-space:nowrap;
}
.footer-col.left{justify-self:start;}
.footer-col.center{justify-self:center;text-align:center;}
.footer-col.right{justify-self:end;text-align:right;}
.footer-link{color:#2563eb;text-decoration:none;}
.footer-link:hover{text-decoration:underline;}

/* ===== 响应式 ===== */
@media (max-width:900px){
  .user-layout{grid-template-columns:1fr;}
  .home-public-wrap{grid-template-columns:1fr;}
  .home-public-right{justify-content:stretch;}
  .img-wall{max-width:100%;}
  .page-style-grid{grid-template-columns:1fr;}
  .admin-form-row{grid-template-columns:1fr;}
  .msg-filter{grid-template-columns:1fr;}
}
@media (max-width:768px){
  .site-topbar .inner{height:56px;padding:0 16px;}
  .site-title{font-size:20px;}
  .site-sub{font-size:13px;}
  .container{padding:16px;}
  .pub-grid,.pub-grid-2{grid-template-columns:1fr;}
  .site-footer .inner{
    grid-template-columns:1fr;
    justify-items:center;
    text-align:center;
    gap:6px;
    padding:10px 16px;
  }
  .footer-col.left,.footer-col.center,.footer-col.right{
    justify-self:center;text-align:center;white-space:normal;
  }
}
