/* ===== 款式图片库 ===== */
* { box-sizing: border-box; }
:root {
  --bg: #f5f6f8;
  --card: #ffffff;
  --line: #e6e8ec;
  --text: #1f2329;
  --muted: #8a92a0;
  --accent: #ff4757;
  --accent-dark: #e8384f;
  --ok: #16a34a;
  --shadow: 0 1px 3px rgba(16,24,40,.06), 0 1px 2px rgba(16,24,40,.04);
}
html, body {
  margin: 0; padding: 0;
  background: var(--bg); color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  font-size: 14px; -webkit-font-smoothing: antialiased;
}
.hidden { display: none !important; }

/* 顶栏 */
.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; background: rgba(255,255,255,.92);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.logo { font-size: 20px; }
.title { font-weight: 700; font-size: 16px; letter-spacing: .3px; }
.search-wrap { position: relative; flex: 1; max-width: 460px; }
#searchInput {
  width: 100%; padding: 9px 34px 9px 14px; border-radius: 999px;
  border: 1px solid var(--line); background: #f1f3f5; font-size: 14px; outline: none;
  transition: .15s;
}
#searchInput:focus { background: #fff; border-color: #c9ced6; box-shadow: 0 0 0 3px rgba(255,71,87,.08); }
.clear-btn {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  border: 0; background: transparent; color: var(--muted); cursor: pointer; font-size: 13px;
  padding: 4px; display: none;
}
.clear-btn.show { display: block; }
.primary-btn {
  border: 0; border-radius: 8px; padding: 9px 16px; background: var(--accent); color: #fff;
  font-size: 14px; font-weight: 600; cursor: pointer; white-space: nowrap; transition: .15s;
}
.primary-btn:hover { background: var(--accent-dark); }
.primary-btn:disabled { opacity: .5; cursor: not-allowed; }
.ghost-btn {
  border: 1px solid var(--line); border-radius: 8px; padding: 9px 16px; background: #fff;
  color: var(--text); font-size: 14px; cursor: pointer; transition: .15s;
}
.ghost-btn:hover { background: #f7f8fa; }

/* 日期条 */
.datebar { padding: 10px 16px 4px; }
.date-chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; scrollbar-width: thin; }
.date-chips::-webkit-scrollbar { height: 4px; }
.date-chips::-webkit-scrollbar-thumb { background: #d4d8de; border-radius: 4px; }
.chip {
  flex-shrink: 0; padding: 6px 13px; border-radius: 999px; background: #fff;
  border: 1px solid var(--line); font-size: 13px; color: var(--text); cursor: pointer;
  white-space: nowrap; transition: .15s; user-select: none;
}
.chip:hover { border-color: #c9ced6; }
.chip.active { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.chip .cnt { opacity: .65; font-size: 12px; margin-left: 4px; }

/* 状态条 */
.statusbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 4px 18px 8px; color: var(--muted); font-size: 12.5px;
}
.warn-text { color: #d97706; }

/* 网格 */
.grid {
  display: grid; gap: 12px; padding: 4px 16px 40px;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
}
.card {
  background: var(--card); border-radius: 12px; overflow: hidden;
  box-shadow: var(--shadow); border: 1px solid var(--line);
  transition: transform .12s, box-shadow .12s; position: relative;
}
.card:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(16,24,40,.1); }
.thumb-wrap {
  position: relative; width: 100%; aspect-ratio: 3/4; overflow: hidden;
  background: #eef0f3; cursor: copy;
}
.thumb-wrap img {
  width: 100%; height: 100%; object-fit: cover; display: block;
  transition: transform .2s;
}
.card:hover .thumb-wrap img { transform: scale(1.03); }
.thumb-badge {
  position: absolute; left: 8px; top: 8px; padding: 3px 8px; border-radius: 6px;
  background: rgba(0,0,0,.62); color: #fff; font-size: 12px; font-weight: 700;
  letter-spacing: .4px; backdrop-filter: blur(4px);
}
.thumb-badge.pending {
  background: rgba(255,71,87,.9);
  animation: badgePulse 1.3s ease-in-out infinite;
}
@keyframes badgePulse {
  0%, 100% { opacity: .55; }
  50% { opacity: 1; }
}
.card-no.pending { color: var(--muted); font-weight: 600; }
.copy-tip {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,.42); color: #fff; font-size: 13px; font-weight: 600;
  opacity: 0; transition: opacity .15s; pointer-events: none;
}
.thumb-wrap:hover .copy-tip { opacity: 1; }
.card-body { padding: 8px 10px 10px; }
.card-no {
  font-size: 14.5px; font-weight: 700; cursor: pointer; display: inline-block;
  letter-spacing: .3px;
}
.card-no:hover { color: var(--accent); }
.card-meta {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 4px; font-size: 12px; color: var(--muted);
}
.card-actions { display: flex; gap: 6px; }
.icon-btn {
  border: 0; background: transparent; cursor: pointer; color: var(--muted);
  font-size: 13px; padding: 2px 4px; border-radius: 4px; transition: .12s;
}
.icon-btn:hover { background: #f1f3f5; color: var(--text); }

/* 空态 */
.empty { text-align: center; padding: 80px 20px; color: var(--muted); }
.empty-icon { font-size: 44px; margin-bottom: 10px; }

/* 弹层 */
.modal {
  position: fixed; inset: 0; background: rgba(16,24,40,.48); z-index: 100;
  display: flex; align-items: center; justify-content: center; padding: 16px;
  backdrop-filter: blur(2px);
}
.modal-box {
  background: #fff; border-radius: 14px; padding: 20px; width: 100%; max-width: 460px;
  box-shadow: 0 20px 50px rgba(16,24,40,.2); max-height: 90vh; overflow-y: auto;
}
.modal-box.narrow { max-width: 380px; }
.modal-box h3 { margin: 0 0 16px; font-size: 16px; }
.form-row { margin-bottom: 14px; }
.form-row label { display: block; font-size: 13px; color: #4a5260; margin-bottom: 6px; font-weight: 600; }
.form-row .hint { font-weight: 400; color: var(--muted); font-size: 12px; }
.form-row input[type=text], .form-row input[type=date] {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px;
  font-size: 14px; outline: none; transition: .15s;
}
.form-row input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(255,71,87,.1); }

.dropzone {
  border: 2px dashed #d4d8de; border-radius: 10px; padding: 26px 16px; text-align: center;
  cursor: pointer; transition: .15s; background: #fafbfc;
}
.dropzone:hover, .dropzone.dragover { border-color: var(--accent); background: #fff5f6; }
.dz-icon { font-size: 26px; margin-bottom: 6px; color: var(--muted); }
.dropzone p { margin: 3px 0; font-size: 13.5px; }

.upload-progress { margin-top: 14px; }
.pick-summary {
  margin-top: 14px; padding: 12px 14px; border-radius: 10px;
  background: #fff8e6; border: 1px solid #ffe0a3;
  font-size: 13.5px; line-height: 1.7; color: #6b5322;
}
.pick-summary b { color: #b26a00; }
.progress-bar { height: 7px; background: #eef0f3; border-radius: 999px; overflow: hidden; }
.progress-fill { height: 100%; width: 0; background: var(--accent); transition: width .25s; }
.progress-text { font-size: 12.5px; color: var(--muted); margin-top: 6px; }

.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; }
.edit-preview { text-align: center; margin-bottom: 14px; }
.edit-preview img { max-height: 180px; border-radius: 8px; max-width: 100%; }
.cand-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.cand-chip {
  padding: 5px 11px; border-radius: 999px; background: #f1f3f5; border: 1px solid var(--line);
  font-size: 13px; cursor: pointer; font-family: ui-monospace, monospace;
}
.cand-chip:hover { background: var(--accent); color: #fff; border-color: var(--accent); }

/* 大图预览 */
.view-box {
  background: #fff; border-radius: 14px; overflow: hidden; max-width: 520px; width: 100%;
  max-height: 92vh; display: flex; flex-direction: column;
}
.view-box img { width: 100%; max-height: 70vh; object-fit: contain; background: #f5f6f8; }
.view-meta { padding: 14px 16px; }
.view-style { font-size: 20px; font-weight: 800; letter-spacing: .5px; }
.view-date { font-size: 13px; color: var(--muted); margin-top: 3px; }
.view-actions { display: flex; gap: 8px; margin-top: 14px; }

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: 42px; transform: translateX(-50%);
  background: rgba(31,35,41,.94); color: #fff; padding: 11px 20px; border-radius: 10px;
  font-size: 13.5px; z-index: 200; box-shadow: 0 8px 24px rgba(0,0,0,.25);
  max-width: 88vw; text-align: center;
}
.toast.ok { background: rgba(22,163,74,.95); }
.toast.err { background: rgba(220,38,38,.95); }

@media (max-width: 640px) {
  .topbar { flex-wrap: wrap; padding: 10px 12px; gap: 8px; }
  .search-wrap { order: 3; flex-basis: 100%; max-width: none; }
  .title { font-size: 15px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 9px; padding: 4px 12px 40px; }
  .datebar { padding: 8px 12px 2px; }
  .card-no { font-size: 13.5px; }
}

/* ===== 多日期分组列表 ===== */
#grid.grouped {
  display: block;
  padding: 4px 16px 40px;
}
.date-group { margin: 0 0 22px; }
.date-group:last-child { margin-bottom: 0; }
.date-group-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 9px 14px; margin: 0 0 10px;
  background: var(--card);
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: 10px;
  box-shadow: var(--shadow);
  position: sticky;
  top: 52px;
  z-index: 30;
}
.dg-date {
  font-size: 15px; font-weight: 700; color: var(--text);
  letter-spacing: .4px;
}
.dg-count {
  font-size: 12.5px; font-weight: 400; color: var(--muted);
}
.grid-inner {
  display: grid; gap: 12px;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
}
@media (max-width: 560px) {
  #grid.grouped { padding: 4px 12px 40px; }
  .grid-inner { grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 9px; }
  .date-group-head { padding: 8px 12px; top: 48px; }
  .dg-date { font-size: 14px; }
}
