/* ===================== 签到墙 · 样式 ===================== */
/* 签到页（index）：极简 kiosk —— 左 5 右 2，纯白淡灰格子 + 微信通讯录风 */
/* 管理台（/admin）：沿用 topbar / panel / admin-* 等区块               */

:root {
  --bg: #f4efe4;
  --panel: #fffdf8;
  --ink: #23283a;
  --muted: #8a8474;
  --line: #e6ddc9;
  --accent: #e0524e;
  --accent-2: #2456d6;
  --ok: #2f9e63;
  --warn: #d97706;
  --radius: 16px;
  --shadow: 0 8px 24px rgba(35, 40, 58, 0.08);
  /* 微信风（通讯录 / 主按钮） */
  --wx-green: #07c160;
  --wx-red: #fa5151;
  --hairline: #ececec;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: var(--bg);
  background-image: radial-gradient(rgba(35, 40, 58, 0.045) 1px, transparent 1px);
  background-size: 22px 22px;
  -webkit-tap-highlight-color: transparent;
}

/* ===================== 签到页 · kiosk 布局 ===================== */

.kiosk {
  display: grid;
  grid-template-columns: 5fr 2fr;
  height: 100dvh;
  min-height: 460px;
}

.side { min-width: 0; min-height: 0; }

/* ---------- 左：签名区（纯白 + 淡灰格子） ---------- */

.side-sign {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 22px 28px;
  background-color: #ffffff;
  background-image:
    linear-gradient(rgba(31, 35, 48, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(31, 35, 48, 0.05) 1px, transparent 1px);
  background-size: 30px 30px;
}

.pad-wrap {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

#pad {
  display: block;
  touch-action: none;       /* 防止触摸滚动打断手写 */
  cursor: crosshair;
  border-radius: 6px;
}

.toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.colors, .sizes { display: flex; align-items: center; gap: 8px; }

.swatch {
  width: 26px; height: 26px;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1.5px #dcdce0;
  cursor: pointer;
  padding: 0;
  transition: transform 0.12s;
  background: #fff;
}

.swatch:hover { transform: scale(1.12); }
.swatch.active { box-shadow: 0 0 0 2.5px var(--ink); transform: scale(1.12); }

.size-btn {
  width: 32px; height: 32px;
  display: grid; place-items: center;
  border-radius: 9px;
  border: 1.5px solid #e4e4e7;
  background: #fff;
  cursor: pointer;
  padding: 0;
}

.size-btn i { display: block; border-radius: 50%; background: var(--ink); }
.size-btn.active { border-color: var(--ink); background: rgba(35, 40, 58, 0.06); }

.spacer { flex: 1; }

/* 签到按钮：固定于右侧底部（界面唯一的文字按钮），深绿 */
.checkin-btn {
  font: inherit;
  flex: none;
  height: 52px;
  margin: 10px 12px 14px;
  border: none;
  border-radius: 12px;
  background: #059048;
  color: #fff;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 12px;
  text-indent: 12px; /* 修正 letter-spacing 尾空隙，保持视觉居中 */
  cursor: pointer;
  transition: background 0.12s, transform 0.12s;
  box-shadow: 0 6px 18px rgba(5, 144, 72, 0.28);
}

.checkin-btn:hover { background: #047c3e; }
.checkin-btn:active { transform: scale(0.985); }

/* ---------- 右：通讯录（沿用原米色纸感配色） ---------- */

.side-list {
  position: relative;
  display: flex;
  flex-direction: column;
  background-color: var(--bg);
  background-image: radial-gradient(rgba(35, 40, 58, 0.045) 1px, transparent 1px);
  background-size: 22px 22px;
  border-left: 1px solid var(--line);
}

.wx-search {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 12px 12px 4px;
  padding: 0 12px;
  height: 36px;
  background: var(--panel);
  border: 1.5px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(35, 40, 58, 0.05);
  flex: none;
}

.wx-search svg { width: 16px; height: 16px; color: #b3ab97; flex: none; }

.wx-search input {
  flex: 1;
  min-width: 0;
  border: none;
  outline: none;
  background: transparent;
  font: inherit;
  font-size: 14px;
  color: var(--ink);
}

.list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  position: relative;
  padding: 4px 0 14px;
}

.list::-webkit-scrollbar { width: 8px; }
.list::-webkit-scrollbar-thumb { background: #ddd3ba; border-radius: 4px; }

/* 分组字母（检索用） */
.letter {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--bg);
  color: var(--accent);
  font-size: 13px;
  font-weight: 800;
  padding: 8px 14px 5px;
  border-bottom: 1px solid var(--line);
}

/* 通讯录行：签名头像 + 用户名 */
.row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 56px;
  padding: 4px 14px;
  cursor: pointer;
}

.row:hover { background: #f7f1e2; }

.row + .row::after {
  content: "";
  position: absolute;
  left: 70px; right: 0; top: 0;
  height: 1px;
  background: var(--line);
}

/* 点选当前签到人（珊瑚红竖条 + 深一档的底色，与悬停区分） */
.row.selected { background: #f2ead6; box-shadow: inset 4px 0 0 var(--accent); }
.row.selected b { font-weight: 600; color: var(--accent); }
.row.selected:hover { background: #efe5cd; }

.thumb {
  width: 42px;
  height: 42px;
  flex: none;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.row-info { min-width: 0; flex: 1; }
.row-info b {
  display: block;
  font-size: 16.5px;
  font-weight: 400;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.row-info span { display: block; font-size: 12px; color: var(--muted); }

.row .del { opacity: 0; margin-left: auto; flex: none; color: var(--muted); }
.row:hover .del { opacity: 1; }
.row .del:hover { color: var(--accent); }

/* 空列表：仅一个极淡的图标水印，无文字 */
.list-ghost { height: 100%; min-height: 240px; display: grid; place-items: center; }
.list-ghost svg { width: 52px; height: 52px; color: #ddd3ba; }

/* 右缘字母快速检索条（微信通讯录式） */
.index-bar {
  position: absolute;
  right: 3px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5px;
  padding: 5px 4px;
  border-radius: 10px;
  touch-action: none;
  cursor: pointer;
  z-index: 5;
}

.index-bar .idx {
  font-size: 9.5px;
  line-height: 1.35;
  color: #b0a68d;
  padding: 0 2px;
  user-select: none;
  font-family: system-ui, sans-serif;
}

.index-bar .idx.active { color: var(--accent); font-weight: 700; }

.index-bubble {
  position: absolute;
  left: 50%;
  top: 42%;
  transform: translate(-50%, -50%);
  width: 58px;
  height: 58px;
  border-radius: 14px;
  background: rgba(35, 40, 58, 0.82);
  color: #fff;
  font-size: 26px;
  font-weight: 700;
  display: grid;
  place-items: center;
  pointer-events: none;
  z-index: 6;
}

.index-bar[hidden], .index-bubble[hidden] { display: none; }

/* ---------- 通用按钮（管理台等页面使用） ---------- */

.btn {
  font: inherit;
  font-size: 14px;
  padding: 8px 14px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  transition: transform 0.12s, box-shadow 0.12s, background 0.12s;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
}

.btn svg { width: 1.1em; height: 1.1em; flex: none; }

.btn:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(35, 40, 58, 0.12); }
.btn:active { transform: translateY(0); }

.btn.primary { background: var(--ink); border-color: transparent; color: #fff; }
.btn.primary:hover { background: #333a52; }

.btn.accent { background: var(--accent); border-color: transparent; color: #fff; }
.btn.accent:hover { background: #c94541; }

.btn.ghost { background: transparent; }
.btn.big {
  width: 100%;
  padding: 13px;
  font-size: 16.5px;
  font-weight: 700;
  letter-spacing: 2px;
}
.btn.small { font-size: 13px; padding: 5px 11px; }

.icon-btn {
  font: inherit;
  border: none;
  background: transparent;
  cursor: pointer;
  color: var(--muted);
  font-size: 15px;
  padding: 6px 9px;
  border-radius: 8px;
  line-height: 1;
}

.icon-btn:hover { background: rgba(35, 40, 58, 0.07); color: var(--ink); }

.icon-btn svg { width: 16px; height: 16px; display: block; }

/* 签到页的纯图标按钮 */
.icon-btn2 {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border: none;
  background: transparent;
  border-radius: 10px;
  color: #8a8a8e;
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
  position: relative;
  padding: 0;
}

.icon-btn2:hover { background: rgba(31, 35, 48, 0.06); color: var(--ink); }
.icon-btn2 svg { width: 19px; height: 19px; }
.icon-btn2 .dot { position: absolute; top: 3px; right: 3px; width: 8px; height: 8px; }

.fs-btn {
  position: absolute;
  top: 12px;
  left: 14px;
  z-index: 10;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: 0 1px 5px rgba(31, 35, 48, 0.12);
  backdrop-filter: blur(4px);
}

.fs-btn[hidden] { display: none; }
.fs-btn .fs-exit { display: none; }
.fs-btn.is-fullscreen .fs-enter { display: none; }
.fs-btn.is-fullscreen .fs-exit { display: block; }

/* ---------- 弹窗 ---------- */

.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(35, 40, 58, 0.45);
  backdrop-filter: blur(3px);
}

.modal[hidden] { display: none; }

.modal-card {
  background: #fff;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  box-shadow: 0 20px 60px rgba(35, 40, 58, 0.3);
  width: min(960px, 96vw);
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 16px;
  font-weight: 700;
  padding: 14px 18px;
  border-bottom: 1px solid var(--hairline);
}

.modal-body { padding: 16px 18px; overflow: auto; }

.modal-body .preview-svg {
  display: block;
  width: 100%;
  background: #fff;
  border: 1px solid var(--hairline);
  border-radius: 10px;
}

.modal-body .time { text-align: center; color: var(--muted); font-size: 13px; margin: 10px 0 0; }

.modal-body .wall-img {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  border-radius: 10px;
  border: 1px solid var(--hairline);
}

.modal-foot {
  display: flex;
  justify-content: center;
  gap: 10px;
  padding: 12px 18px 16px;
  border-top: 1px solid var(--hairline);
}

/* ---------- Toast（文字版：管理台；图标版：签到页） ---------- */

.toasts {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translateX(-50%);
  z-index: 60;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}

.toast {
  background: var(--ink);
  color: #fff;
  font-size: 14px;
  padding: 10px 18px;
  border-radius: 999px;
  box-shadow: 0 8px 24px rgba(35, 40, 58, 0.35);
  animation: toast-in 0.25s ease;
  max-width: 80vw;
}

.toast.err { background: var(--accent); }
.toast.out { opacity: 0; transition: opacity 0.35s; }

.toast-icon {
  width: 54px;
  height: 54px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  background: rgba(35, 40, 58, 0.88);
  color: #fff;
  box-shadow: 0 10px 28px rgba(35, 40, 58, 0.28);
  animation: toast-in 0.25s ease;
}

.toast-icon svg { width: 26px; height: 26px; }
.toast-icon.ok { background: var(--wx-green); }
.toast-icon.err { background: var(--wx-red); }
.toast-icon.out { opacity: 0; transition: opacity 0.35s; }

@keyframes toast-in {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ---------- 响应式（签到页） ---------- */

@media (max-width: 860px) {
  .kiosk { grid-template-columns: 1fr; height: auto; min-height: 100dvh; }
  .side-sign { min-height: 74dvh; }
  .side-list { border-left: none; border-top: 1px solid #e8e8e8; height: 62dvh; }
  .checkin-btn { letter-spacing: 8px; text-indent: 8px; }
}

/* ===================== 管理台（/admin） ===================== */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
  max-width: 1440px;
  margin: 0 auto;
  padding: 20px 22px 8px;
}

.brand { display: flex; align-items: center; gap: 14px; min-width: 0; }

.logo {
  display: grid;
  place-items: center;
  width: 52px; height: 52px;
  font-size: 26px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  flex: none;
}

.logo img { width: 36px; height: 36px; display: block; }

.brand-text h1 {
  margin: 0;
  font-family: "KaiTi", "STKaiti", "Kaiti SC", "Noto Serif SC", serif;
  font-size: 26px;
  line-height: 1.25;
  padding: 2px 8px;
  margin-left: -8px;
  border-radius: 8px;
  outline: none;
  min-width: 60px;
}

.brand-text h1:hover { background: rgba(35, 40, 58, 0.05); }
.brand-text h1:focus { background: #fff; box-shadow: 0 0 0 2px var(--accent); }

.brand-text h1:empty::before {
  content: attr(data-ph);
  color: var(--muted);
  opacity: 0.55;
}

.sub { margin: 2px 0 0; font-size: 13px; color: var(--muted); }

.storage-box {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 13.5px;
  color: var(--muted);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 14px;
  box-shadow: var(--shadow);
}

.storage-box code {
  background: rgba(35, 40, 58, 0.07);
  border-radius: 6px;
  padding: 1px 6px;
  font-size: 12.5px;
}

.dot { width: 9px; height: 9px; border-radius: 50%; background: #c9c2ae; flex: none; }
.dot.ok { background: var(--ok); box-shadow: 0 0 0 4px rgba(47, 158, 99, 0.15); }
.dot.warn { background: var(--warn); box-shadow: 0 0 0 4px rgba(217, 119, 6, 0.15); }

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 18px 20px;
}

.panel-title {
  display: flex;
  align-items: baseline;
  gap: 10px;
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 14px;
}

.panel-title .hint { font-size: 12.5px; font-weight: 400; color: var(--muted); }

.count {
  margin-left: auto;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--accent);
  background: rgba(224, 82, 78, 0.1);
  border-radius: 999px;
  padding: 3px 11px;
}

.empty {
  border: 2px dashed var(--line);
  border-radius: 12px;
  color: var(--muted);
  text-align: center;
  padding: 48px 20px;
  font-size: 14px;
  line-height: 2;
}

.topbar-right { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }

.admin-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  gap: 22px;
  max-width: 1440px;
  margin: 14px auto 0;
  padding: 0 22px 40px;
  align-items: start;
}

.admin-col { display: grid; gap: 22px; min-width: 0; }

/* ---------- 名单导入 ---------- */

.roster-source {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 10px;
  font-size: 13px;
  color: var(--muted);
}

.roster-textarea {
  width: 100%;
  font: inherit;
  font-size: 14px;
  line-height: 1.8;
  padding: 10px 12px;
  min-height: 132px;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  outline: none;
  resize: vertical;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.roster-textarea:focus { border-color: var(--accent-2); box-shadow: 0 0 0 3px rgba(36, 86, 214, 0.12); }

.roster-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-top: 10px; }

.roster-actions select {
  font: inherit;
  font-size: 13.5px;
  padding: 7px 10px;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  outline: none;
  cursor: pointer;
}

.roster-meta { margin-left: auto; font-size: 12.5px; color: var(--muted); }

/* ---------- 签到状态 ---------- */

.statbar {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.stat {
  background: #faf6ec;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 8px;
  text-align: center;
}

.stat b { display: block; font-size: 22px; line-height: 1.25; }
.stat span { font-size: 12px; color: var(--muted); }
.stat.ok b { color: var(--ok); }
.stat.warn b { color: var(--warn); }

.progress-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 10px 0 14px;
  font-size: 12.5px;
  color: var(--muted);
}

.progress { flex: 1; height: 8px; border-radius: 999px; background: #ede5d2; overflow: hidden; }
.progress i {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--accent-2), var(--ok));
  border-radius: 999px;
  transition: width 0.3s;
}

/* ---------- 选项卡 ---------- */

.tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }

.tab {
  font: inherit;
  font-size: 13px;
  padding: 6px 13px;
  cursor: pointer;
  border: 1.5px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--ink);
  transition: background 0.12s, color 0.12s;
}

.tab .cnt { margin-left: 4px; color: var(--muted); }
.tab:hover { border-color: #c9c2ae; }
.tab.active { border-color: var(--ink); background: var(--ink); color: #fff; }
.tab.active .cnt { color: rgba(255, 255, 255, 0.75); }

/* ---------- 状态列表 ---------- */

.admin-list {
  overflow-y: auto;
  max-height: calc(100vh - 430px);
  min-height: 220px;
  padding-right: 4px;
}

.admin-list::-webkit-scrollbar { width: 8px; }
.admin-list::-webkit-scrollbar-thumb { background: #ddd3ba; border-radius: 4px; }

/* 管理台的未签到行仅作展示；签到页的未签到行可点选（见 .side-list） */
.admin-list .row.unsigned { cursor: default; }
.admin-list .row.unsigned:hover { background: transparent; }

.letter.walk-letter { color: var(--accent-2); }

.row .chip {
  flex: none;
  font-size: 12px;
  font-weight: 600;
  border-radius: 999px;
  padding: 3px 10px;
  background: #f0ead9;
  color: var(--muted);
}
.row .chip.ok { background: rgba(47, 158, 99, 0.12); color: var(--ok); }
.row .chip.walk { background: rgba(36, 86, 214, 0.1); color: var(--accent-2); }

.thumb.placeholder {
  background: repeating-linear-gradient(45deg, #faf6ec, #faf6ec 6px, #f3edde 6px, #f3edde 12px);
}

.admin-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }

/* ---------- 签名墙预览 ---------- */

.wall-panel { position: sticky; top: 16px; }

.wall-preview {
  border: 2px dashed var(--line);
  border-radius: 12px;
  background: #faf6ec;
  min-height: 220px;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  place-items: center;
  overflow: hidden;
}

.wall-preview .empty { border: none; padding: 40px 16px; }

.wall-preview img.wall-img {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  min-width: 0;
  border-radius: 10px;
  cursor: zoom-in;
}

.admin-note { margin: 10px 2px 0; font-size: 12.5px; color: var(--muted); line-height: 1.6; }

@media (max-width: 1180px) {
  .admin-layout { grid-template-columns: 1fr; }
  .wall-panel { position: static; }
  .admin-list { max-height: 60vh; }
  .roster-meta { margin-left: 0; width: 100%; }
}
