:root {
  --primary: #0d9488;
  --primary-dark: #0f766e;
  --bg: #f5f7f8;
  --card: #fff;
  --text: #1f2933;
  --text-soft: #667085;
  --border: #e4e7ec;
  --radius: 12px;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", Arial, sans-serif; background: var(--bg); color: var(--text); font-size: 14px; }
.muted { color: var(--text-soft); font-size: 13px; }
.btn { border: 1px solid var(--border); background: #fff; color: var(--text); padding: 8px 14px; border-radius: 8px; cursor: pointer; font-size: 13px; }
.btn:hover { border-color: var(--primary); color: var(--primary); }
.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); color: #fff; }
.btn-ghost { background: transparent; }
.btn-small { padding: 5px 10px; font-size: 12px; }
input, select, textarea { font-family: inherit; font-size: 14px; border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; outline: none; width: 100%; }
input:focus, select:focus, textarea:focus { border-color: var(--primary); }

/* login */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #0d9488, #0f766e); }
.login-card { background: #fff; border-radius: 16px; padding: 36px 32px; width: 340px; text-align: center; box-shadow: 0 20px 50px rgba(0,0,0,.2); }
.login-logo { width: 56px; height: 56px; border-radius: 14px; background: var(--primary); color: #fff; font-size: 28px; display: flex; align-items: center; justify-content: center; margin: 0 auto 14px; }
.login-card h2 { margin: 0 0 4px; }
.login-card input { margin: 16px 0 12px; }
.login-card button { width: 100%; background: var(--primary); color: #fff; border: none; padding: 11px; border-radius: 8px; font-size: 15px; cursor: pointer; font-weight: 600; }
.login-card button:hover { background: var(--primary-dark); }
.hint { font-size: 12px; margin-top: 12px; }

/* admin header */
.admin-header { background: #fff; border-bottom: 1px solid var(--border); padding: 10px 20px; display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 20; }
.ah-left { display: flex; align-items: center; gap: 10px; font-size: 16px; }
.ah-left .logo { width: 30px; height: 30px; border-radius: 8px; background: var(--primary); color: #fff; display: flex; align-items: center; justify-content: center; }
.ah-right { display: flex; gap: 8px; }

.admin-bar { max-width: 1200px; margin: 16px auto 0; padding: 0 20px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.admin-bar input { max-width: 260px; }
.admin-bar select { max-width: 180px; }

.table-wrap { max-width: 1200px; margin: 12px auto 40px; padding: 0 20px; }
.admin-table { width: 100%; border-collapse: collapse; background: #fff; border-radius: var(--radius); overflow: hidden; box-shadow: 0 1px 3px rgba(16,24,40,.08); }
.admin-table th, .admin-table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); font-size: 13px; vertical-align: middle; }
.admin-table th { background: var(--bg); color: var(--text-soft); font-weight: 600; }
.admin-table tr:hover { background: #fafcfc; }
.admin-table img { width: 46px; height: 46px; object-fit: cover; border-radius: 6px; }
.row-actions { display: flex; gap: 6px; }
.row-actions button { padding: 4px 10px; font-size: 12px; border-radius: 6px; border: 1px solid var(--border); background: #fff; cursor: pointer; }
.row-actions .edit:hover { border-color: var(--primary); color: var(--primary); }
.row-actions .del:hover { border-color: #e5484d; color: #e5484d; }

/* modal */
.modal-mask { display: none; position: fixed; inset: 0; background: rgba(16,24,40,.5); z-index: 100; align-items: flex-start; justify-content: center; padding: 40px 12px; overflow: auto; }
.modal-mask.show { display: flex; }
.modal { background: #fff; border-radius: 14px; width: 760px; max-width: 100%; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.modal-sm { width: 460px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--border); font-size: 16px; }
.modal-head .close { cursor: pointer; font-size: 24px; line-height: 1; color: var(--text-soft); }
.modal-body { padding: 20px; }
.modal-foot { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; }
.form-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.form-grid label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--text-soft); }
.form-grid input, .form-grid select { color: var(--text); font-size: 14px; }
.img-upload { margin-top: 16px; border: 1px dashed var(--border); border-radius: 10px; padding: 14px; }
.iu-head { display: flex; justify-content: space-between; align-items: center; font-weight: 600; font-size: 13px; margin-bottom: 10px; }
.iu-list { display: flex; flex-wrap: wrap; gap: 10px; }
.iu-list .thumb { position: relative; width: 72px; height: 72px; border-radius: 8px; overflow: hidden; border: 1px solid var(--border); }
.iu-list .thumb img { width: 100%; height: 100%; object-fit: cover; }
.iu-list .thumb .rm { position: absolute; top: 2px; right: 2px; background: rgba(0,0,0,.6); color: #fff; border: none; border-radius: 50%; width: 18px; height: 18px; cursor: pointer; font-size: 12px; line-height: 1; }

/* 三类图片分区 */
.iu-section { padding: 6px 0 12px; }
.iu-section + .iu-section { border-top: 1px solid var(--border); }
.iu-empty { font-size: 12px; color: var(--text-soft); padding: 8px 0; }

/* 列表缩略图 + 三类图徽标 */
.t-img { white-space: nowrap; }
.t-thumb { width: 46px; height: 46px; object-fit: cover; border-radius: 6px; vertical-align: middle; }
.img-badges { display: inline-flex; gap: 4px; margin-left: 6px; vertical-align: middle; }
.img-badges .badge {
  font-style: normal; font-size: 10px; line-height: 1;
  padding: 3px 5px; border-radius: 8px; color: #fff; cursor: default;
}
.img-badges .badge.dim { background: #2f7fe8; }
.img-badges .badge.det { background: #f59e0b; }
.img-badges .badge.vec { background: #10b981; }

/* 矢量线稿拖拽上传区 */
.drop-zone { margin-top: 10px; border: 2px dashed var(--border); border-radius: 10px; background: #fafcfe; cursor: pointer; transition: .15s; }
.drop-zone:hover { border-color: var(--primary); background: #f0f7ff; }
.drop-zone.dragover { border-color: var(--primary); background: #e6f1ff; }
.drop-zone .dz-inner { padding: 26px 12px; text-align: center; pointer-events: none; }
.drop-zone .dz-icon { font-size: 26px; color: var(--primary); }
.drop-zone .dz-hint { font-size: 13px; font-weight: 600; color: var(--text); margin-top: 6px; }
.drop-zone .dz-sub { font-size: 12px; color: var(--text-soft); margin-top: 2px; }

.vector-info { margin-top: 10px; }
.vector-chip { display: inline-flex; align-items: center; gap: 8px; background: #fff; border: 1px solid var(--border); border-radius: 8px; padding: 6px 10px; font-size: 13px; max-width: 100%; }
.vector-chip .vc-icon { font-size: 16px; }
.vector-chip .vc-name { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vector-chip a { color: var(--primary); text-decoration: none; }
.vector-chip a:hover { text-decoration: underline; }
.vector-chip .vc-remove { border: none; background: #fde8e8; color: #e5484d; border-radius: 6px; padding: 3px 8px; cursor: pointer; font-size: 12px; }
.vector-chip .vc-remove:hover { background: #fbd5d5; }
.extra-specs { margin-top: 16px; }
#specRows .spec-row { display: flex; gap: 8px; margin-bottom: 8px; }
#specRows .spec-row input:first-child { max-width: 40%; }
.toast { position: fixed; bottom: 30px; left: 50%; transform: translateX(-50%); background: #1f2933; color: #fff; padding: 10px 20px; border-radius: 8px; opacity: 0; transition: .3s; z-index: 200; pointer-events: none; }
.toast.show { opacity: 1; }
@media (max-width: 720px) { .form-grid { grid-template-columns: 1fr 1fr; } }
