/* MiniForge · 商品管理 */

.cat-wrap { max-width: 1180px; margin: 0 auto; }

.cat-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding: 8px 0 24px;
}
.cat-head h1 { font-size: 24px; }
.cat-head p { margin-top: 8px; font-size: 13px; color: var(--ink-2); max-width: 560px; line-height: 1.7; }
.cat-head-actions { display: flex; gap: 8px; flex-shrink: 0; }
.badge {
  display: inline-block;
  margin-left: 6px;
  min-width: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand-ink);
  font-size: 11px;
  line-height: 18px;
  text-align: center;
}

.cat-body {
  display: grid;
  grid-template-columns: 216px minmax(0, 1fr);
  gap: 18px;
  padding-bottom: 60px;
  align-items: start;
}

/* 左侧分类 */
.cat-side {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  overflow: hidden;
}
.cat-side-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 14px;
  border-bottom: 1px solid var(--line-2);
  font-size: 13px;
  font-weight: 600;
}
.mini-btn {
  width: 22px; height: 22px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink-2);
  font-size: 12px;
  line-height: 1;
}
.mini-btn:hover { border-color: var(--brand); color: var(--brand); }

.cat-list { padding: 6px; }
.cat-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 8px;
  border-radius: 9px;
  cursor: pointer;
  font-size: 13px;
  transition: .14s;
}
.cat-item:hover { background: var(--line-2); }
.cat-item.on { background: var(--brand-soft); color: var(--brand-ink); font-weight: 600; }
.cat-ico { font-size: 14px; width: 18px; text-align: center; flex-shrink: 0; }
.cat-name { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cat-count { font-size: 11px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.cat-item.on .cat-count { color: var(--brand-ink); opacity: .8; }
.cat-ops { display: none; gap: 2px; }
.cat-item:hover .cat-ops { display: flex; }
.cat-ops button {
  width: 20px; height: 20px;
  border: none;
  border-radius: 5px;
  background: transparent;
  color: var(--ink-3);
  font-size: 10px;
  line-height: 1;
}
.cat-ops button:hover { background: #fff; color: var(--ink); }
.cat-ops button.del:hover { color: #d92d20; }
.cat-side-tip {
  padding: 10px 14px 14px;
  font-size: 11px;
  line-height: 1.6;
  color: var(--ink-3);
}

/* 右侧商品 */
.cat-main { min-width: 0; }
.cat-tools {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.cat-tools input[type=search] {
  width: 240px;
  height: 34px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  font-size: 13px;
  outline: none;
}
.cat-tools input[type=search]:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(255, 82, 51, .1); }
.p-count { font-size: 12px; color: var(--ink-3); }
.tools-right { margin-left: auto; display: flex; gap: 6px; }

.prod-table {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  overflow: hidden;
}
.pt-head, .pt-row {
  display: grid;
  grid-template-columns: 30px 56px minmax(0, 1fr) 92px 108px 64px 62px 104px;
  gap: 10px;
  align-items: center;
  padding: 11px 14px;
}
.pt-head {
  background: #fbfcfd;
  border-bottom: 1px solid var(--line);
  font-size: 11.5px;
  color: var(--ink-3);
  font-weight: 500;
}
.pt-row { border-bottom: 1px solid var(--line-2); font-size: 12.5px; }
.pt-row:last-child { border-bottom: none; }
.pt-row:hover { background: #fbfcfd; }
.pt-row.off { opacity: .55; }
.pt-row img {
  width: 44px; height: 44px;
  border-radius: 8px;
  object-fit: cover;
  background: #f2f3f5;
  display: block;
}
.pinfo { min-width: 0; }
.pinfo b {
  display: block;
  font-weight: 500;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pinfo em {
  display: block;
  font-style: normal;
  font-size: 11px;
  color: var(--ink-3);
  margin-top: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pcat { font-size: 11.5px; color: var(--ink-2); }
.pprice { font-size: 13px; font-weight: 600; color: var(--brand-ink); }
.pprice s { display: block; font-size: 11px; color: #b3b8bf; font-weight: 400; text-decoration: line-through; }
.pstock { font-size: 12px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.pops { display: flex; gap: 4px; justify-content: flex-end; }
.pops button {
  height: 26px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  font-size: 11.5px;
  color: var(--ink-2);
}
.pops button:hover { border-color: #d6dae1; color: var(--ink); }
.pops button.del:hover { border-color: #f0c9c4; color: #d92d20; background: #fff8f7; }

.st { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; cursor: pointer; }
.st i { width: 7px; height: 7px; border-radius: 50%; background: #cbd2db; display: block; }
.st.on i { background: var(--ok); }
.st.on { color: #067647; }

.pt-empty {
  padding: 56px 20px;
  text-align: center;
  color: var(--ink-3);
  font-size: 12.5px;
  line-height: 1.9;
}

/* 弹窗加宽 */
.modal-card.wide { width: min(720px, calc(100vw - 40px)); max-height: 88vh; overflow-y: auto; }
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 16px;
}
.form-grid .field.span2 { grid-column: span 2; }

.img-field { display: flex; gap: 10px; align-items: flex-start; }
.img-preview {
  width: 56px; height: 56px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: #f8f9fb center/cover no-repeat;
  flex-shrink: 0;
}
.img-ops { flex: 1; min-width: 0; display: flex; gap: 6px; }
.img-ops input {
  flex: 1;
  min-width: 0;
  height: 38px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 9px;
  font-size: 12.5px;
  font-family: ui-monospace, Menlo, monospace;
  outline: none;
}
.img-ops input:focus { border-color: var(--brand); }
.img-ops button { flex-shrink: 0; height: 38px; }

.form-grid textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  font-family: inherit;
  font-size: 13px;
  line-height: 1.6;
  outline: none;
  resize: vertical;
}
.form-grid textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(255, 82, 51, .1); }

@media (max-width: 900px) {
  .cat-body { grid-template-columns: 1fr; }
  .cat-head { flex-direction: column; }
  .cat-tools { flex-wrap: wrap; }
  .cat-tools input[type=search] { width: 100%; }
  .tools-right { margin-left: 0; width: 100%; }
  .pt-head { display: none; }
  .pt-row {
    grid-template-columns: 30px 56px minmax(0, 1fr) 90px;
    grid-template-areas: 'pick img info price' '. cat stock status' '. ops ops ops';
  }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .field.span2 { grid-column: span 1; }
}

/* 未分类提示 */
.cat-notice {
  margin-bottom: 16px;
  padding: 12px 16px;
  border: 1px solid #ffe1c2;
  border-radius: 12px;
  background: #fff9f2;
  color: #92400e;
  font-size: 12.5px;
  line-height: 1.7;
}
.cat-notice b { color: #b45309; }
.pcat.warn { color: #b45309; }

/* 弹窗内部的保存按钮固定在底部，长表单不用滚到底 */
.modal-card.wide .modal-actions {
  position: sticky;
  bottom: -24px;
  margin: 8px -24px -24px;
  padding: 14px 24px 18px;
  background: #fff;
  border-top: 1px solid var(--line-2);
  border-radius: 0 0 16px 16px;
}

/* 当前项目切换 */
.cat-proj {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.cp-label { font-size: 11.5px; color: var(--ink-3); letter-spacing: .02em; }
#proj-switch {
  height: 30px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink);
  outline: none;
  cursor: pointer;
  max-width: 240px;
}
#proj-switch:hover { border-color: var(--brand); }
#proj-switch:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(255, 82, 51, .1); }
.cp-meta { font-size: 11.5px; color: var(--ink-3); }
