* { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --ink: #0f1d2e; --muted: #6b7a89; --line: #e4e9ef;
  --gold: #c9a227; --bg: #f4f6f9;
}
body { font-family: "PingFang SC", "Microsoft YaHei", system-ui, sans-serif; background: var(--bg); color: var(--ink); }

/* ---------- 登录 ---------- */
.login-view { min-height: 100vh; display: grid; place-items: center; background: linear-gradient(150deg, #0f1d2e, #1d4363); }
.login-card { background: #fff; border-radius: 14px; padding: 40px 36px; width: 340px; box-shadow: 0 20px 60px rgba(0,0,0,.35); text-align: center; }
.login-card h1 { font-size: 22px; display: flex; align-items: center; justify-content: center; gap: 8px; }
.login-card .sub { color: var(--muted); font-size: 13px; margin: 8px 0 22px; }
.login-card input {
  width: 100%; padding: 11px 14px; border: 1px solid var(--line); border-radius: 8px;
  font-size: 15px; margin-bottom: 14px; outline: none;
}
.login-card input:focus { border-color: var(--gold); }
.err { color: #d33; font-size: 13px; margin-top: 10px; min-height: 18px; }

/* ---------- 通用 ---------- */
.btn { border: 1px solid var(--line); background: #fff; color: var(--ink); border-radius: 8px; padding: 8px 16px; font-size: 14px; cursor: pointer; transition: .15s; }
.btn:hover { border-color: var(--gold); }
.btn.primary { background: var(--gold); border-color: var(--gold); color: #fff; font-weight: 600; }
.btn.primary:hover { background: #b8941f; }
.btn.ghost { background: transparent; }
.btn.small { padding: 5px 12px; font-size: 13px; }
.btn.danger { color: #d33; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.spacer { flex: 1; }

/* ---------- 顶栏 ---------- */
.topbar { display: flex; align-items: center; gap: 14px; padding: 12px 24px; background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.topbar .brand { font-weight: 700; display: flex; align-items: center; gap: 8px; }
.logo { width: 28px; height: 28px; object-fit: contain; border-radius: 7px; background: #fff; border: 1px solid var(--line); flex: none; }
.login-card h1 .logo { width: 32px; height: 32px; border-radius: 8px; }
.topbar a { color: var(--muted); text-decoration: none; font-size: 14px; }
.topbar a:hover { color: var(--gold); }

/* ---------- 主体 ---------- */
.main { max-width: 980px; margin: 0 auto; padding: 24px 20px 60px; }
.toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 6px; }
.toolbar h2 { font-size: 19px; }
.tip { color: var(--muted); font-size: 13px; margin-bottom: 18px; }

.list { display: flex; flex-direction: column; gap: 18px; }

/* ---------- 活动卡片 ---------- */
.act-card { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 18px 20px; box-shadow: 0 2px 10px rgba(15,29,46,.05); }
.act-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.act-head .no { color: var(--muted); font-size: 13px; min-width: 44px; }
.act-head .ops { display: flex; gap: 6px; }

.fields { display: grid; grid-template-columns: 140px 1fr 120px; gap: 10px; margin-bottom: 10px; }
.fields input, .fields textarea, .fields select {
  padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px; font-size: 14px; font-family: inherit; outline: none; width: 100%;
}
.fields input:focus, .fields textarea:focus, .fields select:focus { border-color: var(--gold); }
.fields .full { grid-column: 1 / -1; }
.fields textarea { resize: vertical; min-height: 60px; }

.photo-zone { border-top: 1px dashed var(--line); padding-top: 12px; }
.photo-zone .pz-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.photo-zone .pz-head b { font-size: 14px; }
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; }
.thumb { position: relative; border-radius: 8px; overflow: hidden; border: 1px solid var(--line); aspect-ratio: 4/3; background: #eef1f5; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb .badge { position: absolute; left: 6px; top: 6px; background: rgba(201,162,39,.92); color: #fff; font-size: 11px; padding: 1px 7px; border-radius: 999px; }
.thumb .ops { position: absolute; right: 4px; top: 4px; display: flex; gap: 3px; }
.thumb .ops button {
  width: 22px; height: 22px; border: none; border-radius: 6px; background: rgba(15,29,46,.72); color: #fff;
  font-size: 12px; cursor: pointer; line-height: 1;
}
.thumb .ops button:hover { background: rgba(15,29,46,.95); }
.pz-tip { color: var(--muted); font-size: 12px; }

/* ---------- 图库弹窗 ---------- */
.modal { position: fixed; inset: 0; background: rgba(9,17,27,.55); display: none; place-items: center; z-index: 100; padding: 24px; }
.modal.on { display: grid; }
.modal-card { background: #fff; border-radius: 14px; width: min(860px, 94vw); max-height: 86vh; display: flex; flex-direction: column; padding: 18px 20px; }
.modal-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.modal-head h3 { font-size: 17px; }
.lib-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; overflow-y: auto; padding: 4px; }
.lib-item { position: relative; border-radius: 8px; overflow: hidden; border: 2px solid transparent; cursor: pointer; aspect-ratio: 4/3; background: #eef1f5; }
.lib-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.lib-item:hover { border-color: var(--gold); }

/* ---------- 提示条 ---------- */
.toast {
  position: fixed; left: 50%; bottom: 34px; transform: translate(-50%, 20px);
  background: #0f1d2e; color: #fff; padding: 10px 22px; border-radius: 999px;
  font-size: 14px; opacity: 0; pointer-events: none; transition: .25s; z-index: 200;
}
.toast.on { opacity: 1; transform: translate(-50%, 0); }
.toast.ok { background: #1e8e5a; }
.toast.bad { background: #c0392b; }

/* ---------- 标签页 ---------- */
.tabs { display: flex; gap: 6px; padding: 0 24px; background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 53px; z-index: 9; }
.tab {
  border: 0; background: transparent; padding: 12px 18px; font-size: 15px; font-family: inherit;
  color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent;
}
.tab:hover { color: var(--ink); }
.tab.on { color: var(--ink); font-weight: 600; border-bottom-color: var(--gold); }

/* ---------- 官网板块编辑 ---------- */
.site-form { display: flex; flex-direction: column; gap: 16px; }
.s-sec { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 18px 20px; box-shadow: 0 2px 10px rgba(15,29,46,.05); }
.s-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.s-head h3 { font-size: 16px; }
.s-desc { color: var(--muted); font-size: 12.5px; }
.s-body { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }

.ffield { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.ffield.wide { grid-column: 1 / -1; }
.ffield label { font-size: 13px; color: var(--muted); }
.ffield .hint { color: #9aa7b4; font-size: 12px; }
.ffield input, .ffield textarea {
  padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px;
  font-size: 14px; font-family: inherit; outline: none; width: 100%;
}
.ffield input:focus, .ffield textarea:focus { border-color: var(--gold); }
.ffield textarea { resize: vertical; }
.ffield textarea.mono { font-family: Consolas, Menlo, monospace; font-size: 12.5px; }

.lfield { grid-column: 1 / -1; border: 1px dashed var(--line); border-radius: 10px; padding: 12px 14px; }
.lf-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.lf-head b { font-size: 14px; }
.lf-rows { display: flex; flex-direction: column; gap: 10px; }
.lf-row { border: 1px solid var(--line); border-radius: 10px; padding: 10px; background: #fafbfd; }
.lf-ops { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; }
.lf-no { color: var(--muted); font-size: 12px; min-width: 18px; }
.lf-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }

.img-row { display: flex; gap: 12px; align-items: flex-start; }
.img-prev { width: 74px; height: 74px; object-fit: contain; border: 1px solid var(--line); border-radius: 8px; background: #f4f6f9; flex: none; }
.img-input { flex: 1; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.img-btns { display: flex; gap: 8px; flex-wrap: wrap; }

@media (max-width: 640px) {
  .fields { grid-template-columns: 1fr; }
  .topbar a { display: none; }
  .s-body, .lf-grid { grid-template-columns: 1fr; }
  .tabs { position: static; padding: 0 12px; }
}
