:root {
  --orange: #ff9f43;
  --orange-deep: #f08a1e;
  --yellow: #ffd166;
  --cream: #fff7ec;
  --mint: #4ecdc4;
  --mint-deep: #38b2a9;
  --text: #5b4a3a;
  --text-light: #9a8a78;
  --line: #ffe3bd;
  --danger: #ff6b6b;
  --radius: 20px;
  --shadow: 0 12px 30px rgba(240, 138, 30, 0.16);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

/* 确保 hidden 属性始终生效，避免被 display:flex 等覆盖 */
[hidden] { display: none !important; }

body {
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  color: var(--text);
  min-height: 100vh;
  background: linear-gradient(160deg, #fff3e0 0%, #ffe8c7 55%, #ffd9a8 100%);
  padding: 32px 16px;
  position: relative;
  overflow-x: hidden;
}

/* 背景气泡 */
.bg-bubbles { position: fixed; inset: 0; pointer-events: none; z-index: 0; }
.bubble {
  position: absolute; border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, rgba(255,255,255,.9), rgba(255,209,102,.35));
  animation: float 9s ease-in-out infinite;
}
.b1 { width: 90px; height: 90px; left: 6%; top: 12%; }
.b2 { width: 50px; height: 50px; right: 10%; top: 20%; animation-delay: 1s; }
.b3 { width: 70px; height: 70px; left: 12%; bottom: 14%; animation-delay: 2s; }
.b4 { width: 40px; height: 40px; right: 16%; bottom: 22%; animation-delay: 1.5s; }
.b5 { width: 60px; height: 60px; left: 45%; top: 6%; animation-delay: .8s; }
.b6 { width: 34px; height: 34px; right: 40%; bottom: 8%; animation-delay: 2.5s; }
@keyframes float {
  0%,100% { transform: translateY(0); }
  50% { transform: translateY(-18px); }
}

/* 收集卡片 */
.card {
  position: relative; z-index: 1;
  max-width: 560px; margin: 0 auto;
  background: var(--cream);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 32px 28px;
  border: 2px solid #fff;
}
.card-head { text-align: center; margin-bottom: 22px; }
.logo-diamond { font-size: 44px; line-height: 1; }
.logo-diamond.sm { font-size: 24px; }
.card-head h1 { font-size: 26px; margin: 8px 0 6px; color: var(--orange-deep); }
.subtitle { color: var(--text-light); font-size: 14px; }

.tip {
  background: #fff; border: 1.5px solid var(--line);
  border-radius: 14px; padding: 12px 14px; font-size: 14px;
  margin-bottom: 16px; line-height: 1.5;
}
.tip.ok { background: #e8fbf9; border-color: var(--mint); }

.field { margin-bottom: 16px; }
.field label { display: block; font-size: 14px; font-weight: 600; margin-bottom: 7px; }
.field label em { color: var(--danger); font-style: normal; }
.field input, .field textarea {
  width: 100%; padding: 13px 15px;
  border: 2px solid var(--line); border-radius: 14px;
  background: #fff; font-size: 15px; color: var(--text);
  font-family: inherit; resize: vertical;
  transition: border-color .2s, box-shadow .2s;
}
.field input:focus, .field textarea:focus {
  outline: none; border-color: var(--orange);
  box-shadow: 0 0 0 3px rgba(255,159,67,.18);
}
.field input::placeholder, .field textarea::placeholder { color: #c9b8a4; }

/* 锁定字段 */
.field.locked input, .field.locked textarea {
  background: #f4ece2; color: var(--text-light); cursor: not-allowed;
  border-color: #ece0d0;
}
.lock-group {
  border: 2px dashed var(--line); border-radius: 16px;
  padding: 14px 16px 4px; margin-bottom: 18px;
}
.lock-group.locked { background: rgba(244,236,226,.5); }
.lock-group-title { font-size: 13px; font-weight: 700; color: var(--text-light); margin-bottom: 12px; }

/* 上传框 */
.upload-box { display: block; cursor: pointer; }
.upload-box .upload-inner {
  border: 2px dashed var(--orange); border-radius: 16px;
  background: #fff8f0; text-align: center; padding: 26px 16px;
  transition: background .2s;
}
.upload-box:hover .upload-inner { background: #fff1dd; }
.upload-icon { font-size: 34px; display: block; margin-bottom: 8px; }
.upload-text { display: block; font-weight: 600; font-size: 15px; }
.upload-hint { display: block; font-size: 12px; color: var(--text-light); margin-top: 4px; }
#preview { width: 100%; border-radius: 14px; border: 2px solid var(--line); display: block; }

/* 按钮 */
.btn-submit {
  width: 100%; margin-top: 6px;
  padding: 15px; border: none; border-radius: 16px;
  background: linear-gradient(135deg, var(--orange), var(--orange-deep));
  color: #fff; font-size: 17px; font-weight: 700;
  font-family: inherit; cursor: pointer;
  box-shadow: 0 8px 18px rgba(240,138,30,.35);
  transition: transform .15s, box-shadow .15s;
}
.btn-submit:hover { transform: translateY(-2px); box-shadow: 0 12px 22px rgba(240,138,30,.4); }
.btn-submit:active { transform: translateY(0); }
.btn-submit:disabled { opacity: .7; cursor: not-allowed; transform: none; }
.btn-emoji { margin-right: 4px; }
.privacy { text-align: center; font-size: 12px; color: var(--text-light); margin-top: 14px; }

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: 32px; transform: translateX(-50%) translateY(20px);
  background: #fff; padding: 13px 22px; border-radius: 14px;
  font-size: 14px; font-weight: 600; z-index: 99;
  box-shadow: 0 10px 26px rgba(0,0,0,.16); opacity: 0;
  transition: opacity .25s, transform .25s; max-width: 90vw;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.err { background: var(--danger); color: #fff; }
.toast.ok { background: var(--mint); color: #fff; }

/* ===== 后台 ===== */
.admin-body { padding: 0; background: #f6f1e8; }
.login-card {
  max-width: 400px; margin: 8vh auto; background: var(--cream);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 36px 30px; text-align: center; border: 2px solid #fff;
}
.login-card h1 { margin: 10px 0 4px; color: var(--orange-deep); }
.login-card form { margin-top: 22px; }
.login-card input {
  width: 100%; padding: 14px 15px; margin-bottom: 14px;
  border: 2px solid var(--line); border-radius: 14px; font-size: 15px; font-family: inherit;
}
.login-card input:focus { outline: none; border-color: var(--orange); }

.admin-topbar {
  background: #fff; display: flex; align-items: center; justify-content: space-between;
  padding: 14px 24px; box-shadow: 0 2px 12px rgba(0,0,0,.06);
  position: sticky; top: 0; z-index: 20;
}
.admin-title { font-size: 18px; font-weight: 700; color: var(--orange-deep); display: flex; align-items: center; gap: 8px; }
.admin-actions { display: flex; gap: 10px; }
.btn-ghost {
  padding: 9px 16px; border: 2px solid var(--line); border-radius: 12px;
  background: #fff; font-weight: 600; font-size: 14px; cursor: pointer;
  font-family: inherit; color: var(--text); transition: all .15s;
}
.btn-ghost:hover { border-color: var(--orange); color: var(--orange-deep); }

.admin-wrap { max-width: 1200px; margin: 24px auto; padding: 0 20px; }
.stat-row { display: grid; grid-template-columns: repeat(3,1fr); gap: 16px; margin-bottom: 22px; }
.stat-card {
  background: #fff; border-radius: 16px; padding: 22px; text-align: center;
  box-shadow: 0 4px 14px rgba(0,0,0,.05);
}
.stat-val { font-size: 28px; font-weight: 800; color: var(--orange-deep); }
.stat-label { font-size: 14px; color: var(--text-light); margin-top: 4px; }

.admin-grid { display: grid; grid-template-columns: 320px 1fr; gap: 20px; align-items: start; }
.panel {
  background: #fff; border-radius: 18px; padding: 22px;
  box-shadow: 0 4px 14px rgba(0,0,0,.05);
}
.panel h2 { font-size: 17px; margin-bottom: 12px; }
.panel h2.mt { margin-top: 24px; }
.panel-tip { font-size: 12px; color: var(--text-light); margin-bottom: 14px; }

/* 开关 */
.switch-list { display: flex; flex-direction: column; gap: 10px; }
.switch-item { display: flex; align-items: center; justify-content: space-between; font-size: 14px; font-weight: 600; }
.switch { position: relative; display: inline-block; width: 46px; height: 26px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
  position: absolute; inset: 0; background: #d9cdbd; border-radius: 26px;
  cursor: pointer; transition: .25s;
}
.slider::before {
  content: ""; position: absolute; height: 20px; width: 20px; left: 3px; top: 3px;
  background: #fff; border-radius: 50%; transition: .25s;
}
.switch input:checked + .slider { background: var(--mint); }
.switch input:checked + .slider::before { transform: translateX(20px); }

.setting-box label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.setting-box input {
  width: 100%; padding: 11px 12px; margin-bottom: 12px;
  border: 2px solid var(--line); border-radius: 12px; font-size: 14px; font-family: inherit;
}
.setting-box input:focus { outline: none; border-color: var(--orange); }
.btn-small {
  padding: 9px 16px; border: none; border-radius: 12px;
  background: var(--orange); color: #fff; font-weight: 600; font-size: 14px;
  cursor: pointer; font-family: inherit;
}
.btn-small:hover { background: var(--orange-deep); }

/* 用户列表 */
.data-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 14px; }
.data-head h2 { margin: 0; }
#searchInput {
  padding: 10px 14px; border: 2px solid var(--line); border-radius: 12px;
  font-size: 14px; width: 220px; font-family: inherit;
}
#searchInput:focus { outline: none; border-color: var(--orange); }
.user-list { display: flex; flex-direction: column; gap: 10px; max-height: 560px; overflow-y: auto; }
.user-card {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px; border: 2px solid var(--line); border-radius: 14px;
  cursor: pointer; transition: border-color .15s, background .15s;
}
.user-card:hover { border-color: var(--orange); background: #fff8f0; }
.user-name { font-weight: 700; font-size: 15px; }
.user-meta { font-size: 13px; color: var(--text-light); margin-top: 3px; }
.empty { text-align: center; color: var(--text-light); padding: 40px 0; font-size: 14px; }

/* 弹窗 */
.modal {
  position: fixed; inset: 0; background: rgba(60,45,30,.45);
  display: flex; align-items: center; justify-content: center; z-index: 50; padding: 20px;
}
.modal-box {
  background: #fff; border-radius: 18px; padding: 28px; max-width: 640px; width: 100%;
  max-height: 88vh; overflow-y: auto; position: relative;
}
.modal-close {
  position: absolute; right: 18px; top: 16px; border: none; background: #f4ece2;
  width: 32px; height: 32px; border-radius: 50%; cursor: pointer; font-size: 14px;
}
#detailContent h2 { color: var(--orange-deep); margin-bottom: 12px; padding-right: 40px; }
.detail-info p { font-size: 14px; margin-bottom: 6px; color: var(--text); }
.detail-table { width: 100%; border-collapse: collapse; margin: 16px 0; font-size: 13px; }
.detail-table th, .detail-table td {
  border: 1px solid var(--line); padding: 9px 10px; text-align: center;
}
.detail-table th { background: #fff3e0; color: var(--orange-deep); }
.detail-table a { color: var(--mint-deep); font-weight: 600; text-decoration: none; }
.day-badge {
  background: #e8fbf9; color: var(--mint-deep); padding: 3px 9px;
  border-radius: 10px; font-size: 12px; font-weight: 700;
}
.btn-danger {
  border: none; background: #ffe3e3; color: var(--danger);
  padding: 6px 12px; border-radius: 10px; cursor: pointer; font-size: 13px; font-family: inherit;
}
.btn-danger:hover { background: var(--danger); color: #fff; }
.btn-danger.big { width: 100%; padding: 12px; font-weight: 700; }

/* 响应式 */
@media (max-width: 860px) {
  .admin-grid { grid-template-columns: 1fr; }
  .stat-row { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  body { padding: 18px 12px; }
  .card { padding: 24px 18px; }
  .card-head h1 { font-size: 22px; }
  .admin-topbar { padding: 12px 14px; flex-wrap: wrap; gap: 8px; }
  .admin-title { font-size: 16px; }
  .admin-wrap { padding: 0 12px; }
  .data-head { flex-direction: column; align-items: stretch; }
  #searchInput { width: 100%; }
  .btn-ghost { padding: 8px 12px; font-size: 13px; }
}
