/* ==========================================================================
   金之集 · 黄金仓 Pad — 应用样式
   设计语言沿用 The Gold Party 设计系统（token 在 assets/ds/）。
   生产环境整屏铺满（非设计稿的浮动卡片）；窄屏单列降级。
   ========================================================================== */

html, body { height: 100%; }
body {
  margin: 0;
  background: var(--surface-page);
  color: var(--text-body);
  font-family: var(--font-cjk);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
#app { height: 100vh; height: 100dvh; overflow: hidden; }

/* ---- 细滚动条 ------------------------------------------------------------ */
.scrollthin { scrollbar-width: thin; scrollbar-color: var(--tgp-k20) transparent; }
.scrollthin::-webkit-scrollbar { width: 6px; height: 6px; }
.scrollthin::-webkit-scrollbar-thumb { background: var(--tgp-k20); border-radius: 3px; }
.scrollthin::-webkit-scrollbar-track { background: transparent; }

/* ---- 动效 ---------------------------------------------------------------- */
@keyframes tgpSpin { to { transform: rotate(360deg); } }
@keyframes tgpFade { from { opacity: 0; } to { opacity: 1; } }
@keyframes tgpRise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: translateY(0); } }
@keyframes tgpViewIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* ===========================================================================
   通用元件
   =========================================================================== */
.eyebrow {
  font-weight: 600; letter-spacing: .16em; text-transform: uppercase;
  font-size: 11px; color: var(--text-gold);
}
.btn {
  font-family: var(--font-cjk); font-size: 13px; cursor: pointer;
  border-radius: 2px; padding: 10px 18px; border: 1px solid transparent;
  letter-spacing: .04em; transition: background var(--duration-fast) var(--ease-standard),
    border-color var(--duration-fast) var(--ease-standard), color var(--duration-fast) var(--ease-standard);
}
.btn--primary { color: #fff; background: var(--tgp-black); }
.btn--primary:hover { background: var(--tgp-k80); }
.btn--ghost { color: var(--text-body); background: #fff; border-color: var(--line-strong); }
.btn--ghost:hover { background: var(--tgp-k1); border-color: var(--text-body); }
.btn--danger { color: #fff; background: var(--tgp-festive-rose); }
.btn--danger:hover { filter: brightness(.94); }
.btn:disabled { opacity: .55; cursor: default; }

.pill {
  font-size: 10px; font-weight: 600; letter-spacing: .08em;
  color: var(--tgp-gold-deep); background: var(--tgp-gold-tint);
  border: 1px solid var(--tgp-gold-hairline); padding: 1px 7px; border-radius: 999px;
  white-space: nowrap;
}

.spinner {
  width: 34px; height: 34px; border: 2.5px solid var(--tgp-k10);
  border-top-color: var(--tgp-gold); border-radius: 50%;
  animation: tgpSpin .8s linear infinite;
}

/* ---- 状态面板 ------------------------------------------------------------ */
.state {
  flex: 1; min-height: 240px; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 18px; padding: 60px 24px;
}
.state__mark { width: 40px; height: 40px; opacity: .5; }
.state__msg { font-size: 14px; color: var(--text-muted); letter-spacing: .06em; }
.state__msg--err { color: var(--tgp-festive-rose); }

/* ===========================================================================
   弹层 / 弹窗 / 提示
   =========================================================================== */
#overlay-host { position: fixed; inset: 0; z-index: 50; pointer-events: none; }
.overlay {
  position: absolute; inset: 0; pointer-events: auto;
  background: rgba(20,18,12,.46);
  display: flex; align-items: center; justify-content: center;
  animation: tgpFade .18s var(--ease-standard); padding: 24px;
}
.overlay--closing { animation: tgpFade .16s var(--ease-standard) reverse; }
.overlay__slot { display: contents; }
.modal {
  background: #fff; border-radius: 3px; box-shadow: 0 20px 60px rgba(0,0,0,.3);
  animation: tgpRise .22s var(--ease-standard); max-width: 92vw;
}
.modal__title { font-family: var(--font-serif); font-weight: 700; color: var(--text-strong); }
.modal__lead { font-size: 13px; color: var(--text-body); margin-top: 6px; line-height: 1.6; }

.kv { margin-top: 20px; border: 1px solid var(--line); border-radius: 2px; }
.kv__row { display: flex; justify-content: space-between; gap: 16px; padding: 13px 16px; border-bottom: 1px solid var(--line); }
.kv__row:last-child { border-bottom: none; }
.kv__k { font-size: 13px; color: var(--text-muted); white-space: nowrap; }
.kv__v { font-size: 13px; color: var(--text-strong); text-align: right; }

.modal__actions { display: flex; gap: 12px; margin-top: 22px; }

.toast {
  position: absolute; left: 50%; bottom: 40px; transform: translate(-50%, 16px);
  pointer-events: auto; background: var(--tgp-k90); color: #fff;
  font-size: 13px; letter-spacing: .03em; padding: 12px 20px; border-radius: 3px;
  box-shadow: var(--shadow-lg); opacity: 0; transition: opacity .22s var(--ease-standard), transform .22s var(--ease-standard);
  max-width: 80vw; text-align: center;
}
.toast--in { opacity: 1; transform: translate(-50%, 0); }
.toast--error { background: var(--tgp-festive-rose); }
.toast--success { background: var(--tgp-k90); }

/* ===========================================================================
   目录页（款式查询）
   =========================================================================== */
.catalog { display: flex; height: 100%; animation: tgpViewIn .26s var(--ease-standard); }

.sidebar {
  width: 248px; flex: none; border-right: 1px solid var(--line);
  padding: 32px 28px; display: flex; flex-direction: column; min-height: 0;
}
.brand { display: inline-flex; align-items: center; gap: 11px; margin-bottom: 38px; }
.brand img { height: 28px; display: block; }
.brand__name { font-weight: 600; letter-spacing: .2em; font-size: 12px; color: var(--text-strong); line-height: 1.3; }
.brand__sub { font-weight: 400; letter-spacing: .16em; font-size: 10px; color: var(--text-muted); }

.price-label { font-size: 11px; letter-spacing: .18em; text-transform: uppercase; color: var(--text-muted); }
.price-row { display: flex; align-items: baseline; gap: 7px; margin: 6px 0 3px; }
.price-num { font-family: var(--font-serif); font-weight: 600; font-size: 26px; line-height: 1; color: var(--text-strong); }
.price-unit { font-size: 12px; color: var(--text-muted); }
.price-meta { font-size: 11px; color: var(--text-muted); }

.cat-nav { display: flex; flex-direction: column; margin-top: 30px; overflow-y: auto; min-height: 0; }
.cat-item {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 14px; padding: 12px 0; color: var(--text-body);
  border-bottom: 1px solid var(--line); cursor: pointer; background: none; border-left: none; border-right: none; border-top: none;
  text-align: left; font-family: var(--font-cjk); width: 100%;
}
.cat-item__name { padding-left: 11px; }
.cat-item__count { font-size: 12px; color: var(--text-muted); }
.cat-item.is-active { color: var(--text-strong); }
.cat-item.is-active .cat-item__name { border-left: 2px solid var(--tgp-gold); padding-left: 11px; margin-left: -11px; }

.ledger-entry {
  margin-top: 16px; text-decoration: none; font-size: 13px; color: var(--text-body);
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 11px; border: 1px solid var(--line); border-radius: 2px; cursor: pointer; background: #fff;
}
.ledger-entry:hover { background: var(--tgp-k1); }
.ledger-entry__badge { color: var(--tgp-gold-deep); }

.catalog__main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.catalog__top {
  display: flex; align-items: center; gap: 16px; padding: 0 36px; height: 58px;
  border-bottom: 1px solid var(--line); flex: none; justify-content: flex-end;
}
.search {
  display: inline-flex; align-items: center; gap: 8px; width: 320px; max-width: 50vw;
  border: 1px solid var(--line); border-radius: 2px; padding: 8px 12px; background: #fff;
}
.search:focus-within { border-color: var(--tgp-gold); }
.search__icon { color: var(--tgp-k40); font-size: 15px; flex: none; }
.search input {
  border: none; outline: none; background: none; font-size: 13px; color: var(--text-strong);
  width: 100%; font-family: var(--font-cjk);
}
.search input::placeholder { color: var(--text-muted); }
.search__clear { border: none; background: none; color: var(--text-muted); cursor: pointer; font-size: 15px; padding: 0 2px; flex: none; }
.search__clear:hover { color: var(--text-strong); }

.catalog__scroll { flex: 1; overflow-y: auto; padding: 30px 36px; }
.catalog__count { font-size: 12px; color: var(--text-muted); margin-bottom: 16px; }
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 30px 24px; }
.card { text-decoration: none; color: inherit; cursor: pointer; display: block; }
.card__imgwrap { aspect-ratio: 3/4; background: var(--tgp-k1); overflow: hidden; position: relative; }
.card__img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .4s var(--ease-out); }
.card:hover .card__img { transform: scale(1.03); }
.card__badge {
  position: absolute; top: 10px; left: 10px; font-size: 9px; font-weight: 600;
  letter-spacing: .12em; text-transform: uppercase; background: var(--tgp-black);
  color: #fff; padding: 4px 8px; border-radius: 2px;
}
.card__cap { padding-top: 9px; display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.card__name { font-size: 12px; color: var(--text-strong); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card__fee { font-size: 11px; color: var(--text-muted); white-space: nowrap; flex: none; }
.grid__sentinel { height: 1px; }

/* ===========================================================================
   详情页（货品详情 + 下单锁库）
   =========================================================================== */
.detail { position: relative; display: flex; flex-direction: column; height: 100%; animation: tgpViewIn .26s var(--ease-standard); }
.detail__top {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 36px; height: 58px; border-bottom: 1px solid var(--line); flex: none;
}
.crumb { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text-body); font-size: 13px; cursor: pointer; background: none; border: none; font-family: var(--font-cjk); }
.crumb__chev { font-size: 17px; line-height: 1; }
.crumb__all { color: var(--text-muted); }
.crumb__sep { color: var(--tgp-k30); }
.crumb__cur { color: var(--text-strong); max-width: 40vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gold-inline { display: flex; align-items: baseline; gap: 8px; }
.gold-inline__label { font-size: 11px; letter-spacing: .16em; text-transform: uppercase; color: var(--text-muted); }
.gold-inline__num { font-family: var(--font-serif); font-weight: 600; font-size: 18px; color: var(--text-strong); line-height: 1; }
.gold-inline__unit { font-size: 12px; color: var(--text-muted); }

.detail__body { flex: 1; display: flex; min-height: 0; }
.hero { width: 540px; flex: none; background: var(--tgp-k1); position: relative; overflow: hidden; }
.hero__img { width: 100%; height: 100%; object-fit: cover; display: block; }
.hero__badge {
  position: absolute; top: 22px; left: 22px; font-size: 10px; font-weight: 600;
  letter-spacing: .14em; text-transform: uppercase; background: var(--tgp-black);
  color: #fff; padding: 5px 11px; border-radius: 2px;
}
.panel { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.panel__head { padding: 38px 44px 24px; flex: none; }
.panel__title { font-family: var(--font-serif); font-weight: 700; font-size: 32px; color: var(--text-strong); margin: 9px 0 0; line-height: 1.1; }

.specs { display: flex; gap: 30px; margin-top: 22px; flex-wrap: wrap; }
.spec + .spec { border-left: 1px solid var(--line); padding-left: 30px; }
.spec__k { font-size: 11px; color: var(--text-muted); letter-spacing: .04em; }
.spec__v { font-size: 15px; color: var(--text-strong); margin-top: 3px; }

.formula {
  margin-top: 20px; padding: 11px 15px; background: var(--tgp-gold-tint);
  border-radius: 2px; font-size: 12px; color: var(--tgp-gold-deep); letter-spacing: .02em;
}
.formula strong { color: var(--text-strong); font-weight: 600; }

.pieces__head { padding: 0 44px; display: flex; align-items: baseline; justify-content: space-between; flex: none; }
.pieces__title { font-size: 13px; color: var(--text-strong); }
.pieces__title span { color: var(--text-muted); font-weight: 400; }
.pieces__sort { font-size: 12px; color: var(--text-muted); }
.pieces__list { flex: 1; overflow-y: auto; padding: 12px 44px 40px; margin-top: 8px; }

.piece {
  display: flex; align-items: center; gap: 18px; padding: 15px 0; border-top: 1px solid var(--line);
}
.piece__main { flex: 1; min-width: 0; }
.piece__line { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.piece__spec { font-size: 17px; color: var(--text-strong); white-space: nowrap; }
.piece__spec .u { font-size: 12px; color: var(--text-muted); }
.piece__code { font-size: 11px; color: var(--tgp-k40); margin-top: 5px; letter-spacing: .06em; white-space: nowrap; }
.piece__price { font-size: 16px; color: var(--text-strong); white-space: nowrap; }
.piece__sold { font-size: 12px; color: var(--text-muted); white-space: nowrap; padding-right: 4px; }
.pieces__foot { border-top: 1px solid var(--line); padding-top: 14px; margin-top: 2px; font-size: 12px; color: var(--text-muted); }

/* 锁库流程弹窗内的元素 */
.lock-confirm { width: 412px; padding: 34px 34px 28px; }
.cust-field { display: block; margin-top: 16px; }
.cust-field__label { display: block; font-size: 11px; color: var(--text-muted); letter-spacing: .04em; margin-bottom: 6px; }
.cust-input {
  width: 100%; border: 1px solid var(--line); border-radius: 2px; padding: 10px 12px;
  font-size: 13px; color: var(--text-strong); font-family: var(--font-cjk); outline: none;
}
.cust-input:focus { border-color: var(--tgp-gold); }
.cust-input::placeholder { color: var(--text-muted); }
.lock-meta { font-size: 11px; color: var(--text-muted); margin-top: 14px; }
.lock-locking { width: 300px; padding: 46px 34px; text-align: center; }
.lock-locking__msg { font-size: 14px; color: var(--text-body); margin-top: 20px; letter-spacing: .06em; }
.lock-locking .spinner { margin: 0 auto; }
.lock-success { width: 412px; padding: 36px 34px 28px; text-align: center; }
.lock-success__check {
  width: 46px; height: 46px; margin: 0 auto; border-radius: 50%;
  background: var(--tgp-gold-tint); display: flex; align-items: center; justify-content: center;
  color: var(--tgp-gold-deep); font-size: 22px;
}
.lock-success__title { font-family: var(--font-serif); font-weight: 700; font-size: 21px; color: var(--text-strong); margin-top: 16px; }
.lock-success__no { font-size: 13px; color: var(--text-muted); margin-top: 5px; }
.lock-success__msg { font-size: 13px; color: var(--text-body); margin-top: 18px; line-height: 1.6; }
.countdown-box { margin-top: 20px; padding: 14px; background: var(--tgp-gold-tint); border-radius: 2px; }
.countdown-box__label { font-size: 12px; color: var(--tgp-gold-deep); letter-spacing: .04em; }
.countdown-box__time { font-family: var(--font-serif); font-weight: 700; font-size: 30px; color: var(--text-strong); margin-top: 4px; letter-spacing: .04em; }
.countdown-box__note { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

/* ===========================================================================
   台账页（锁单台账）
   =========================================================================== */
.ledger { position: relative; display: flex; flex-direction: column; height: 100%; animation: tgpViewIn .26s var(--ease-standard); }
.ledger__top {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 44px; height: 58px; border-bottom: 1px solid var(--line); flex: none;
}
.ledger__who { font-size: 12px; color: var(--text-muted); }
.ledger__stats { display: flex; align-items: flex-end; gap: 40px; padding: 30px 44px 22px; flex: none; }
.stat__num { font-family: var(--font-serif); font-weight: 700; font-size: 30px; color: var(--text-strong); line-height: 1; }
.stat__label { font-size: 12px; color: var(--text-muted); margin-top: 5px; letter-spacing: .04em; }
.stat + .stat { border-left: 1px solid var(--line); padding-left: 40px; }
.ledger__hint { margin-left: auto; font-size: 12px; color: var(--text-muted); max-width: 280px; text-align: right; }

.ledger__head {
  display: flex; align-items: center; gap: 24px; padding: 0 44px 12px; flex: none;
  font-size: 11px; color: var(--text-muted); letter-spacing: .06em;
}
.ledger__scroll { flex: 1; overflow-y: auto; padding: 0 44px 36px; }
.lock-row { display: flex; align-items: center; gap: 24px; padding: 18px 0; border-top: 1px solid var(--line); }
.col-item { flex: 1; min-width: 0; }
.col-cust { width: 140px; flex: none; }
.col-no { width: 170px; flex: none; }
.col-price { width: 96px; flex: none; text-align: right; }
.col-status { width: 228px; flex: none; }

.lock-row__name { display: flex; align-items: baseline; gap: 11px; }
.lock-row__name b { font-size: 16px; color: var(--text-strong); font-weight: 400; }
.lock-row__sub { font-size: 12px; color: var(--text-body); margin-top: 4px; }
.lock-row__sub .muted { color: var(--tgp-k40); letter-spacing: .05em; }
.lock-row__cust { font-size: 13px; color: var(--text-strong); }
.lock-row__cust-sub { font-size: 11px; color: var(--text-muted); margin-top: 3px; }
.lock-row__no { font-size: 13px; color: var(--text-body); letter-spacing: .02em; }
.lock-row__time { font-size: 11px; color: var(--text-muted); margin-top: 3px; }
.lock-row__price { font-size: 15px; color: var(--text-strong); }
.lock-row__status { display: flex; align-items: center; justify-content: flex-end; gap: 12px; height: 100%; }

.status { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; }
.status__dot { width: 6px; height: 6px; border-radius: 50%; }
.status--pending { color: var(--tgp-gold-deep); margin-right: auto; }
.status--pending .status__dot { background: var(--tgp-gold); }
.status--confirmed { color: var(--tgp-festive-jade); }
.status--confirmed .status__dot { background: var(--tgp-festive-jade); }
.status--cancelled { color: var(--text-muted); }
.status--cancelled .status__dot { background: var(--tgp-k30); }
.status--timeout { color: var(--tgp-festive-rose); }
.status--timeout .status__dot { background: var(--tgp-festive-rose); }
.lock-row .btn { padding: 8px 13px; font-size: 12px; }

/* ===========================================================================
   响应式：窄屏单列降级
   =========================================================================== */
@media (max-width: 980px) {
  .grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 760px) {
  body { overflow: auto; }
  #app { height: auto; min-height: 100vh; overflow: visible; }

  .catalog { flex-direction: column; height: auto; }
  .sidebar { width: auto; border-right: none; border-bottom: 1px solid var(--line); padding: 20px 20px; }
  .cat-nav { flex-direction: row; flex-wrap: wrap; gap: 0 8px; margin-top: 18px; }
  .cat-item { width: auto; border-bottom: none; padding: 8px 0; gap: 6px; }
  .cat-item.is-active .cat-item__name { border-left: none; padding-left: 0; margin-left: 0; border-bottom: 2px solid var(--tgp-gold); }
  .catalog__top { padding: 0 20px; }
  .catalog__scroll { padding: 20px; }
  .grid { grid-template-columns: repeat(2, 1fr); gap: 20px 14px; }

  .detail { height: auto; }
  .detail__body { flex-direction: column; }
  .hero { width: auto; height: 56vw; min-height: 320px; }
  .panel__head { padding: 24px 20px 18px; }
  .panel__title { font-size: 26px; }
  .pieces__head { padding: 0 20px; }
  .pieces__list { padding: 8px 20px 32px; overflow: visible; }
  .piece { flex-wrap: wrap; }

  .ledger { height: auto; }
  .ledger__top, .ledger__stats, .ledger__head, .ledger__scroll { padding-left: 20px; padding-right: 20px; }
  .ledger__head { display: none; }
  .lock-row { flex-wrap: wrap; gap: 10px 16px; }
  .col-item { flex-basis: 100%; }
  .col-cust, .col-no, .col-price { width: auto; flex: 1; text-align: left; }
  .col-status { width: 100%; }
  .lock-row__status { justify-content: flex-start; }
  .ledger__hint { display: none; }
}
