:root {
  --bg: #f4f6fa;
  --panel: #ffffff;
  --ink: #1c2430;
  --ink-2: #5a6675;
  --line: #e3e8ef;
  --brand: #1f6feb;
  --brand-dark: #17539f;
  --danger: #d93025;
  --ok: #127a45;
  --sidebar: #182233;
  --sidebar-2: #22304a;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(16, 24, 40, .08), 0 8px 24px rgba(16, 24, 40, .06);
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 14px/1.6 "Microsoft YaHei", "PingFang SC", "Segoe UI", system-ui, sans-serif;
}
a { color: var(--brand); text-decoration: none; }
button { font-family: inherit; font-size: 14px; cursor: pointer; }
input, textarea, select { font-family: inherit; font-size: 14px; }

/* ---------------- 登录 ---------------- */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(1200px 600px at 20% 0%, #2b3d5c 0%, #131b28 55%, #0d131c 100%);
  padding: 24px;
}
.login-card {
  width: 100%; max-width: 400px; background: #fff; border-radius: 14px;
  padding: 32px 30px 26px; box-shadow: 0 24px 60px rgba(0, 0, 0, .45);
}
.login-card h1 { margin: 0 0 4px; font-size: 21px; }
.login-card p.sub { margin: 0 0 22px; color: var(--ink-2); font-size: 13px; }
.login-card label { display: block; font-size: 13px; color: var(--ink-2); margin: 14px 0 6px; }
.login-card input {
  width: 100%; padding: 11px 12px; border: 1px solid var(--line); border-radius: 8px; outline: none;
}
.login-card input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(31, 111, 235, .12); }
.login-card button {
  width: 100%; margin-top: 22px; padding: 12px; border: 0; border-radius: 8px;
  background: var(--brand); color: #fff; font-weight: 600;
}
.login-card button:hover { background: var(--brand-dark); }
.login-err { color: var(--danger); font-size: 13px; margin-top: 12px; min-height: 18px; }

/* ---------------- 布局 ---------------- */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 250px; flex: 0 0 250px; background: var(--sidebar); color: #cdd7e5;
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.brand { padding: 18px 18px 14px; font-size: 16px; font-weight: 700; color: #fff; border-bottom: 1px solid rgba(255,255,255,.08); }
.brand small { display: block; font-weight: 400; font-size: 11px; color: #8fa1bb; margin-top: 3px; }
.side-scroll { flex: 1; overflow: auto; padding: 12px 10px; }
.side-title { font-size: 11px; letter-spacing: .08em; color: #7d8ea8; padding: 8px 8px 6px; }
.cat-item {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 9px 10px; border-radius: 8px; color: #d5deea; cursor: pointer; margin-bottom: 2px;
}
.cat-item:hover { background: var(--sidebar-2); }
.cat-item.active { background: var(--brand); color: #fff; }
.cat-item .n { font-size: 12px; opacity: .75; }
.side-actions { padding: 12px 10px 16px; border-top: 1px solid rgba(255,255,255,.08); display: grid; gap: 8px; }
.side-actions button {
  width: 100%; padding: 9px; border-radius: 8px; border: 1px solid rgba(255,255,255,.16);
  background: rgba(255,255,255,.06); color: #dfe7f2;
}
.side-actions button:hover { background: rgba(255,255,255,.14); }
.side-actions button.primary { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 600; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; gap: 14px; padding: 12px 20px; background: #fff;
  border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20;
}
.topbar .search { flex: 1; max-width: 420px; position: relative; }
.topbar .search input {
  width: 100%; padding: 9px 12px 9px 34px; border: 1px solid var(--line); border-radius: 8px; outline: none; background: #f9fafc;
}
.topbar .search input:focus { border-color: var(--brand); background: #fff; }
.topbar .search::before { content: "🔍"; position: absolute; left: 11px; top: 8px; font-size: 13px; opacity: .5; }
.stats { display: flex; gap: 16px; color: var(--ink-2); font-size: 12.5px; }
.stats b { color: var(--ink); font-size: 14px; }
.spacer { flex: 1; }
.userbox { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--ink-2); }
.userbox .who { background: #eef3fb; color: var(--brand-dark); padding: 4px 10px; border-radius: 20px; font-weight: 600; }

.content { padding: 20px; }
.breadcrumb { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; color: var(--ink-2); font-size: 13px; }
.breadcrumb b { color: var(--ink); }

/* ---------------- 产品卡片 ---------------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 16px; }
.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow); cursor: pointer; display: flex; flex-direction: column;
  transition: transform .12s ease, box-shadow .12s ease;
}
.card:hover { transform: translateY(-2px); box-shadow: 0 10px 30px rgba(16,24,40,.14); }
.card .cover { height: 150px; background: #eef1f6 center/cover no-repeat; position: relative; }
.card .cover .ph { display: flex; align-items: center; justify-content: center; height: 100%; color: #a8b3c2; font-size: 26px; }
.card .cover .badge {
  position: absolute; right: 8px; bottom: 8px; background: rgba(0,0,0,.62); color: #fff;
  border-radius: 12px; padding: 2px 8px; font-size: 11.5px;
}
.card .meta { padding: 11px 12px 13px; }
.card .meta h3 { margin: 0 0 4px; font-size: 14.5px; line-height: 1.35; }
.card .meta .info { color: var(--ink-2); font-size: 12px; }
.empty {
  background: #fff; border: 1px dashed var(--line); border-radius: var(--radius);
  padding: 60px 20px; text-align: center; color: var(--ink-2);
}

/* ---------------- 产品详情 ---------------- */
.panel { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 16px; }
.panel > header {
  display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--line);
}
.panel > header h2 { margin: 0; font-size: 16px; }
.panel > header .grow { flex: 1; }
.panel .body { padding: 16px; }
.detail-head { display: flex; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.detail-head h1 { margin: 0 0 6px; font-size: 20px; }
.detail-head .tag { display: inline-block; background: #eef3fb; color: var(--brand-dark); border-radius: 6px; padding: 2px 8px; font-size: 12px; margin-right: 6px; }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; }

.btn { border: 1px solid var(--line); background: #fff; color: var(--ink); padding: 8px 13px; border-radius: 8px; }
.btn:hover { background: #f5f7fb; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 600; }
.btn.primary:hover { background: var(--brand-dark); }
.btn.danger { color: var(--danger); border-color: #f2c6c2; }
.btn.danger:hover { background: #fdf1f0; }
.btn.sm { padding: 5px 9px; font-size: 12.5px; }

/* 参数表 */
.spec-table { width: 100%; border-collapse: collapse; }
.spec-table td { padding: 6px 8px 6px 0; vertical-align: middle; border-bottom: 1px dashed var(--line); }
.spec-table td.k { width: 190px; }
.spec-table input { width: 100%; padding: 7px 9px; border: 1px solid var(--line); border-radius: 7px; background: #fbfcfe; }
.spec-table input:focus { border-color: var(--brand); background: #fff; outline: none; }
.spec-table .del { border: 0; background: transparent; color: #b6bfcc; font-size: 16px; }
.spec-table .del:hover { color: var(--danger); }
.spec-read { display: grid; grid-template-columns: 190px 1fr; gap: 0 12px; }
.spec-read .rk { color: var(--ink-2); padding: 7px 0; border-bottom: 1px dashed var(--line); }
.spec-read .rv { padding: 7px 0; border-bottom: 1px dashed var(--line); }

/* 画廊 */
.groups { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.chip {
  border: 1px solid var(--line); background: #fff; border-radius: 20px; padding: 5px 13px; font-size: 13px; color: var(--ink-2);
}
.chip.active { background: var(--brand); border-color: var(--brand); color: #fff; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 12px; }
.tile { border: 1px solid var(--line); border-radius: 9px; overflow: hidden; background: #fff; position: relative; }
.tile .thumb { height: 132px; background: #f1f4f9 center/cover no-repeat; position: relative; cursor: zoom-in; }
.tile video.thumb { width: 100%; object-fit: cover; }
.tile .vbadge {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%,-50%);
  background: rgba(0,0,0,.55); color: #fff; width: 38px; height: 38px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; font-size: 15px; pointer-events: none;
}
.tile .cap { padding: 7px 9px; font-size: 12px; color: var(--ink-2); border-top: 1px solid var(--line); }
.tile .cap .name { color: var(--ink); word-break: break-all; }
.tile .ops { display: flex; gap: 6px; padding: 0 9px 8px; }
.tile .ops a, .tile .ops button {
  flex: 1; text-align: center; border: 1px solid var(--line); background: #fff; border-radius: 6px;
  padding: 4px 0; font-size: 12px; color: var(--ink-2);
}
.tile .ops a:hover, .tile .ops button:hover { background: #f5f7fb; color: var(--ink); }
.tile .chk { position: absolute; left: 8px; top: 8px; z-index: 3; width: 18px; height: 18px; }
.tile.sel { outline: 2px solid var(--brand); outline-offset: -2px; }

/* 上传区 */
.drop {
  border: 2px dashed #c7d2e2; border-radius: var(--radius); padding: 24px; text-align: center;
  color: var(--ink-2); background: #fbfcfe;
}
.drop.hot { border-color: var(--brand); background: #f0f6ff; }
.drop .big { font-size: 28px; }
.upload-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.upload-row input[type=text] { padding: 8px 10px; border: 1px solid var(--line); border-radius: 7px; }
.progress { height: 8px; background: #e8edf5; border-radius: 8px; overflow: hidden; margin-top: 12px; display: none; }
.progress > i { display: block; height: 100%; width: 0; background: var(--brand); transition: width .15s; }

/* 弹窗 */
.mask { position: fixed; inset: 0; background: rgba(12,18,28,.55); display: flex; align-items: center; justify-content: center; z-index: 60; padding: 20px; }
.modal { background: #fff; border-radius: 12px; width: 100%; max-width: 520px; box-shadow: 0 30px 70px rgba(0,0,0,.4); max-height: 90vh; overflow: auto; }
.modal header { padding: 16px 18px; border-bottom: 1px solid var(--line); font-weight: 600; }
.modal .body { padding: 18px; }
.modal footer { padding: 14px 18px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 10px; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; color: var(--ink-2); margin-bottom: 6px; }
.field input, .field select, .field textarea {
  width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px; outline: none;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--brand); }

/* 灯箱 */
.lightbox { position: fixed; inset: 0; background: rgba(6,10,16,.92); z-index: 80; display: flex; flex-direction: column; }
.lightbox .lb-top { display: flex; align-items: center; gap: 14px; padding: 12px 18px; color: #cbd5e1; }
.lightbox .lb-top .grow { flex: 1; }
.lightbox .lb-top button { background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.2); color: #fff; padding: 6px 12px; border-radius: 8px; }
.lightbox .lb-body { flex: 1; display: flex; align-items: center; justify-content: center; overflow: auto; padding: 0 18px 18px; }
.lightbox img, .lightbox video { max-width: 100%; max-height: 100%; border-radius: 8px; background: #000; }

/* 表格 */
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
table.tbl th, table.tbl td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); }
table.tbl th { color: var(--ink-2); font-weight: 600; background: #f8fafd; position: sticky; top: 0; }

/* 提示 */
#toast-root { position: fixed; right: 20px; bottom: 20px; z-index: 100; display: flex; flex-direction: column; gap: 10px; }
.toast { background: #1f2937; color: #fff; padding: 11px 16px; border-radius: 9px; box-shadow: 0 12px 30px rgba(0,0,0,.3); font-size: 13.5px; max-width: 380px; }
.toast.ok { background: #10623c; }
.toast.err { background: #a3251c; }
.spin { display: inline-block; width: 15px; height: 15px; border: 2px solid rgba(255,255,255,.4); border-top-color: #fff; border-radius: 50%; animation: sp .7s linear infinite; vertical-align: -2px; }
@keyframes sp { to { transform: rotate(360deg); } }
.muted { color: var(--ink-2); font-size: 12.5px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
