/*
 * 谷仓：收藏柜（卡片、列表、筛选）、底部面板、录入表单、详情的样式。颜色都用 themes.css 里的变量。
 */

/* ---------- 收藏柜：筛选 ---------- */
.chips { display: flex; gap: 6px; padding: 12px 18px 0; overflow-x: auto; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: 0 0 auto; padding: 5px 12px; border-radius: 14px; font-size: 12px; background: var(--chip-bg); color: var(--soft); border: var(--chip-border, 0); }
.chip.on { background: var(--chip-on); color: var(--chip-on-ink); border-color: transparent; }
.filter-row { display: flex; gap: 8px; align-items: center; padding: 8px 18px 0; }
.filter-row select { flex: 1; min-width: 0; padding: 6px 8px; border-radius: 12px; font: inherit; font-size: 12px; color: var(--ink); background: var(--chip-bg); border: var(--chip-border, 1px solid transparent); }
.view-toggle { display: flex; flex: 0 0 auto; margin-left: auto; border-radius: 12px; overflow: hidden; border: var(--chip-border, 0); background: var(--chip-bg); }
.view-toggle button { border: 0; background: none; padding: 4px 10px; color: var(--soft); font-size: 14px; }
.view-toggle button.on { background: var(--chip-on); color: var(--chip-on-ink); }
.none { margin: 24px 18px; text-align: center; color: var(--soft); }
button.warnbar { width: calc(100% - 36px); text-align: left; cursor: pointer; }

/* ---------- 收藏柜：两列卡片 ---------- */
.grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; padding: 12px 18px 0; }
.g { position: relative; display: block; width: 100%; min-width: 0; text-align: left; background: var(--card); border-radius: var(--r); padding: 8px; border: var(--card-border, 0); box-shadow: var(--card-shadow, none); transform: rotate(var(--tilt, 0deg)); }
.g:nth-child(even) { transform: rotate(calc(var(--tilt, 0deg) * -1)); }
.art-wrap { position: relative; }
.art { position: relative; height: 104px; border-radius: calc(var(--r) - 6px); display: flex; align-items: center; justify-content: center; overflow: hidden; background-size: cover; background-position: center; }
.art.has-photo .shape { display: none; }
.art.small { width: 56px; height: 56px; flex: 0 0 auto; border-radius: 12px; }
.art.big { height: 240px; }
.shape { color: #fff; font-weight: 800; display: flex; align-items: center; justify-content: center; font-size: 20px; }
.s-badge { height: 76%; aspect-ratio: 1; border-radius: 50%; box-shadow: 0 0 0 4px rgba(255,255,255,.85), 0 4px 10px rgba(0,0,0,.18); }
.s-stand { width: 44%; height: 80%; border-radius: 40% 40% 8px 8px; box-shadow: 0 0 0 3px rgba(255,255,255,.8); align-items: flex-end; padding-bottom: 6px; }
.s-fig { width: 40%; height: 72%; border-radius: 50% 50% 18px 18px; }
.s-card { width: 50%; height: 80%; border-radius: 6px; transform: rotate(-6deg); box-shadow: 0 0 0 3px #fff, 0 4px 10px rgba(0,0,0,.15); }
.art.small .shape { font-size: 14px; }
.art.small .s-badge { box-shadow: 0 0 0 2px rgba(255,255,255,.85); }
.tag { position: absolute; left: 6px; top: 6px; font-size: 10px; font-weight: 700; padding: 1px 6px; border-radius: 8px; background: rgba(255,255,255,.94); }
.tag.pre { color: #b45309; }
.tag.sold { color: #64748b; }
.g .nm { font-size: 13px; font-weight: 700; margin-top: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.g .who { font-size: 11px; color: var(--soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.g .bot { display: flex; align-items: flex-end; justify-content: space-between; gap: 4px; margin-top: 4px; }
.price { font-size: 16px; font-weight: 800; color: var(--price, inherit); font-family: var(--num-font, inherit); white-space: nowrap; }

/* ---------- 收藏柜：列表 ---------- */
.list { margin: 12px 18px 0; background: var(--card); border-radius: var(--r); border: var(--card-border, 0); box-shadow: var(--card-shadow, none); overflow: hidden; }
.li { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 12px; border: 0; border-bottom: 1px solid var(--line, rgba(0,0,0,.06)); background: none; text-align: left; }
.li:last-child { border-bottom: 0; }
.li .mid { flex: 1; min-width: 0; }
.li .mid b { display: block; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.li .mid small { display: block; font-size: 11px; color: var(--soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.li .rt { position: relative; width: 112px; flex: 0 0 auto; text-align: right; }
.li .rt .price { font-size: 14px; }
.li .rt .money, .li .rt .money-fit { margin-top: 6px; }  /* 留出 ×N 角标的位置，不压到上面的价格 */
.li .rt .tag { position: static; display: inline-block; margin-top: 2px; }

/* ---------- 底部面板 ---------- */
.sheet-shell { position: absolute; inset: 0; z-index: 30; }
.sheet-mask { position: absolute; inset: 0; background: rgba(40, 25, 30, .38); opacity: 0; transition: opacity .2s; }
.sheet { position: absolute; left: 0; right: 0; bottom: 0; max-height: 92%; overflow-y: auto; padding: 8px 18px calc(env(safe-area-inset-bottom, 0px) + 18px);
  background: var(--bg); background-image: var(--paper, none); background-size: var(--paper-size, auto); border-radius: 24px 24px 0 0; transform: translateY(100%); transition: transform .22s ease-out; }
.sheet-shell.open .sheet-mask { opacity: 1; }
.sheet-shell.open .sheet { transform: none; }
.sheet-grip { width: 40px; height: 4px; border-radius: 2px; background: var(--soft); opacity: .4; margin: 0 auto 10px; }
.sheet-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.sheet-head h2 { margin: 0; font-size: 18px; font-family: var(--title-font, inherit); }

/* ---------- 录入表单 ---------- */
.gform { display: flex; flex-direction: column; gap: 10px; }
.fld { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.fld > span { font-size: 12px; color: var(--soft); }
.fld input { width: 100%; padding: 10px 12px; border-radius: 12px; font: inherit; font-size: 16px; color: var(--ink); background: var(--card); border: var(--chip-border, 1px solid rgba(0,0,0,.1)); }
.fld input:focus { outline: 2px solid var(--accent); outline-offset: 0; }
.two { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }
.pick { display: flex; flex-wrap: wrap; gap: 6px; }
.photo-pick { position: relative; display: flex; align-items: center; justify-content: center; height: 150px; border-radius: var(--r); background: var(--card); border: 2px dashed var(--soft); cursor: pointer; overflow: hidden; text-align: center; color: var(--soft); font-size: 14px; }
.photo-pick small { font-size: 11px; }
.photo-img { position: absolute; inset: 0; background-size: cover; background-position: center; }
.photo-pick[data-has="1"] { border-style: solid; }
.photo-pick[data-has="1"] .photo-tip { position: absolute; right: 8px; bottom: 8px; padding: 2px 10px; border-radius: 10px; background: rgba(0,0,0,.5); color: #fff; font-size: 0; }
.photo-pick[data-has="1"] .photo-tip br, .photo-pick[data-has="1"] .photo-tip small { display: none; }
.photo-pick[data-has="1"] .photo-tip::after { content: "换一张"; font-size: 12px; }
.money-preview { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--soft); white-space: nowrap; }
.money-preview:empty { display: none; }
.money-preview b { margin-left: auto; font-size: 16px; color: var(--price); }
.btn.big { width: 100%; padding: 13px; font-size: 16px; margin-top: 4px; }
.btn.danger { color: #d64545; border-color: #e9a0a0; }

/* ---------- 详情 ---------- */
.detail h2 { margin: 12px 0 0; font-size: 19px; font-family: var(--title-font, inherit); }
.detail .who { font-size: 12px; color: var(--soft); }
.detail-art { position: relative; }
.detail-money { display: flex; align-items: flex-end; justify-content: space-between; gap: 8px; margin-top: 10px; }
.detail-money .price { font-size: 24px; }
.facts { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 10px; font-size: 13px; }
.facts span { display: flex; flex-direction: column; }
.facts small { font-size: 11px; color: var(--soft); }
.pays { list-style: none; margin: 12px 0; padding: 4px 12px; border-radius: 14px; background: var(--card); border: var(--card-border, 0); }
.pays li { display: flex; align-items: center; gap: 8px; padding: 7px 0; font-size: 13px; border-bottom: 1px dashed rgba(0,0,0,.08); }
.pays li:last-child { border-bottom: 0; }
.pays small { flex: 1; color: var(--soft); font-size: 11px; }
.pays b.plus { color: #10a36a; }

/* ---------- 主题细节 ---------- */
:root[data-skin="cream"] { --chip-bg: #fff; --chip-border: 1.5px solid #f6dccf; --chip-on: #ff8fab; --chip-on-ink: #fff; --line: #f7e6de; }
:root[data-skin="journal"] { --chip-bg: #fffdf8; --chip-border: 1px solid #e3d6bf; --chip-on: #6f8f72; --chip-on-ink: #fff; --line: #efe4d1; --tilt: -1.6deg; }
/* 手账：每张谷子卡片顶上贴胶带，颜色轮换 */
:root[data-skin="journal"] .g::before {
  content: ""; position: absolute; top: -9px; left: 50%; width: 56px; height: 18px; margin-left: -28px; transform: rotate(-4deg); z-index: 2; pointer-events: none;
  background: repeating-linear-gradient(90deg, rgba(233,161,120,.75) 0 8px, rgba(242,192,158,.75) 8px 16px);
}
:root[data-skin="journal"] .g:nth-child(3n+2)::before { background: repeating-linear-gradient(90deg, rgba(111,143,114,.7) 0 8px, rgba(160,186,160,.7) 8px 16px); transform: rotate(3deg); }
:root[data-skin="journal"] .g:nth-child(3n)::before { background: repeating-linear-gradient(90deg, rgba(140,150,200,.6) 0 8px, rgba(180,190,225,.6) 8px 16px); }
:root[data-skin="journal"] .grid { gap: 18px 12px; padding-top: 18px; }
