:root {
  --bg: #faf8f5;
  --surface: #ffffff;
  --ink: #2b2b2b;
  --ink-soft: #8a8378;
  --line: #ece7df;
  --accent: #c79a5b;        /* 摄影工作室暖金 */
  --accent-ink: #ffffff;
  --sel: #2bb673;           /* 选中绿 */
  --sel-soft: #e7f6ee;
  --shadow: 0 6px 24px rgba(60, 50, 30, 0.10);
  --radius: 14px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
/* hidden 属性必须真正隐藏元素（覆盖下方组件里的 display:flex 等） */
[hidden] { display: none !important; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--ink);
  padding-bottom: 88px;
  -webkit-font-smoothing: antialiased;
}

/* 顶部栏 */
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 14px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.logo {
  width: 42px; height: 42px; border-radius: 12px; flex: none;
  display: grid; place-items: center;
  background: linear-gradient(135deg, #d8b277, #b9853f);
  color: #fff; font-size: 20px; font-weight: 700;
  box-shadow: var(--shadow);
}
.brand-text { min-width: 0; }
.brand-text h1 { margin: 0; font-size: 16px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-text p { margin: 2px 0 0; font-size: 12px; color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.progress {
  flex: none; display: flex; align-items: baseline; gap: 2px;
  background: var(--sel-soft); color: var(--sel);
  padding: 6px 12px; border-radius: 999px; font-weight: 700;
}
.progress .num { font-size: 18px; }
.progress .slash, .progress .den { font-size: 13px; opacity: .8; }
.progress .plabel { font-size: 11px; margin-left: 4px; font-weight: 600; opacity: .9; }

/* 筛选栏 */
.filterbar {
  position: sticky; top: 71px; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; padding: 10px 16px;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}
.chips { display: flex; gap: 8px; }
.chip {
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  padding: 7px 14px; border-radius: 999px; font-size: 13px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px; transition: .15s;
}
.chip i { font-style: normal; font-size: 11px; color: var(--ink-soft); background: var(--bg); border-radius: 999px; padding: 1px 7px; }
.chip.active { background: var(--ink); color: #fff; border-color: var(--ink); }
.chip.active i { background: rgba(255,255,255,.2); color: #fff; }
.chip.ghost { color: var(--ink-soft); }

/* 左右布局 + 左侧分类栏 */
.layout { display: flex; align-items: stretch; }
.content { flex: 1; min-width: 0; }
.sidebar {
  width: 92px; flex: none;
  background: var(--surface); border-right: 1px solid var(--line);
  position: sticky; top: 71px;
  height: calc(100vh - 71px); overflow-y: auto;
  display: flex; flex-direction: column;
}
.cat {
  border: none; background: none; width: 100%;
  padding: 13px 4px; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  font-size: 13px; color: var(--ink);
  border-bottom: 1px solid var(--line);
  transition: .15s;
}
.cat-name { line-height: 1.3; text-align: center; }
.cat-desc { font-size: 11px; color: var(--ink-soft); }
.cat-count {
  font-size: 10px; color: var(--ink-soft);
  background: var(--bg); border-radius: 999px; padding: 0 7px; margin-top: 2px;
}
.cat.active { color: var(--sel); background: var(--sel-soft); font-weight: 700; }
.cat.active .cat-count { background: #fff; color: var(--sel); }
@media (min-width: 720px) { .sidebar { width: 128px; } .cat { font-size: 14px; padding: 15px 6px; } }

/* 画廊 */
.gallery {
  display: grid; grid-template-columns: repeat(2, 1fr);
  gap: 10px; padding: 14px 16px;
}
@media (min-width: 720px) { .gallery { grid-template-columns: repeat(3, 1fr); gap: 14px; max-width: 980px; margin: 0 auto; } }
@media (min-width: 1040px) { .gallery { grid-template-columns: repeat(4, 1fr); } }

.card {
  position: relative; border-radius: var(--radius); overflow: hidden;
  background: var(--surface); box-shadow: var(--shadow); cursor: pointer;
  aspect-ratio: 3 / 4;
}
.card img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .25s; }
.card:active img { transform: scale(1.03); }
.card .pick {
  position: absolute; top: 8px; right: 8px;
  width: 30px; height: 30px; border-radius: 50%;
  border: 2px solid #fff; background: rgba(0,0,0,.28);
  display: grid; place-items: center; color: #fff; font-size: 16px;
  backdrop-filter: blur(2px); transition: .15s;
}
.card.selected .pick { background: var(--sel); border-color: var(--sel); }
.card .order {
  position: absolute; top: 8px; left: 8px;
  min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px;
  background: var(--accent); color: #fff; font-size: 12px; font-weight: 700;
  display: none; place-items: center;
}
.card.selected .order { display: grid; }
.card.selected::after {
  content: ""; position: absolute; inset: 0;
  border: 3px solid var(--sel); border-radius: var(--radius); pointer-events: none;
}
.card .cap {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 18px 10px 8px; font-size: 12px; color: #fff;
  background: linear-gradient(transparent, rgba(0,0,0,.55));
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.empty { text-align: center; color: var(--ink-soft); padding: 60px 20px; }

/* 底部操作栏 */
.actionbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 25;
  display: flex; gap: 10px; padding: 12px 16px;
  background: var(--surface); border-top: 1px solid var(--line);
}
.btn-primary, .btn-ghost {
  border: none; border-radius: 12px; font-size: 15px; font-weight: 600;
  padding: 13px 16px; cursor: pointer; transition: .15s;
}
.btn-primary { flex: 1; background: var(--accent); color: var(--accent-ink); }
.btn-primary:active { transform: translateY(1px); }
.btn-ghost { background: var(--bg); color: var(--ink); border: 1px solid var(--line); }
/* 底部按钮栏通栏铺满，不避开左侧分类栏 */
.actionbar { left: 0; right: 0; }

/* 灯箱 */
.lightbox {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(20,16,10,.96);
  display: flex; align-items: center; justify-content: center;
}
.lb-stage { margin: 0; max-width: 92vw; max-height: 78vh; display: flex; flex-direction: column; align-items: center; }
.lb-stage img { max-width: 92vw; max-height: 70vh; border-radius: 10px; object-fit: contain; }
.lb-cap { color: #fff; margin-top: 12px; font-size: 14px; display: flex; gap: 10px; align-items: center; }
.lb-idx { color: #cfc4b0; font-size: 12px; }
.lb-close {
  position: absolute; top: 16px; right: 16px; z-index: 2;
  width: 40px; height: 40px; border-radius: 50%; border: none;
  background: rgba(255,255,255,.14); color: #fff; font-size: 18px; cursor: pointer;
}
.lb-nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 46px; height: 46px; border-radius: 50%; border: none;
  background: rgba(255,255,255,.14); color: #fff; font-size: 28px; cursor: pointer;
}
.lb-prev { left: 14px; } .lb-next { right: 14px; }
.lb-pick {
  position: absolute; bottom: 26px; left: 50%; transform: translateX(-50%);
  display: inline-flex; align-items: center; gap: 8px;
  background: #fff; color: var(--ink); border: none;
  padding: 12px 26px; border-radius: 999px; font-size: 15px; font-weight: 700; cursor: pointer;
}
.lb-pick .dot { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--ink-soft); }
.lb-pick.on { background: var(--sel); color: #fff; }
.lb-pick.on .dot { background: #fff; border-color: #fff; }

/* 弹窗 */
.modal {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(0,0,0,.5); display: flex; align-items: center; justify-content: center; padding: 18px;
}
.modal-card {
  background: var(--surface); border-radius: 18px; width: 100%; max-width: 460px;
  max-height: 86vh; overflow: auto; padding: 20px;
}
.modal-head { display: flex; align-items: center; justify-content: space-between; }
.modal-head h2 { margin: 0; font-size: 19px; }
.modal-close { border: none; background: none; font-size: 18px; cursor: pointer; color: var(--ink-soft); }
.modal-sub { color: var(--ink-soft); font-size: 13px; margin: 8px 0 16px; }
.sum-form { display: flex; flex-direction: column; gap: 12px; margin: 0 0 16px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: 13px; color: var(--ink); font-weight: 600; }
.field input {
  width: 100%; box-sizing: border-box; padding: 11px 12px; font-size: 15px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--bg); color: var(--ink);
  outline: none; -webkit-appearance: none; appearance: none;
}
.field input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--sel-soft); }
.sum-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.sum-grid .sc { position: relative; aspect-ratio: 1; border-radius: 10px; overflow: hidden; }
.sum-grid .sc img { width: 100%; height: 100%; object-fit: cover; }
.sum-grid .sc b { position: absolute; top: 4px; left: 4px; background: var(--accent); color: #fff; font-size: 11px; border-radius: 999px; padding: 1px 6px; }
.modal-actions { display: flex; gap: 8px; margin-top: 18px; }
.modal-actions .btn-ghost { flex: 1; padding: 12px; font-size: 14px; }
.modal-actions .btn-primary { flex: 1; }

/* 轻提示 */
.toast {
  position: fixed; left: 50%; bottom: 100px; transform: translateX(-50%);
  background: rgba(0,0,0,.82); color: #fff; padding: 10px 18px; border-radius: 999px;
  font-size: 13px; z-index: 80; animation: pop .2s ease;
}
@keyframes pop { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }
