* { box-sizing: border-box; }
body { font-family: system-ui, -apple-system, 'Segoe UI', 'Microsoft YaHei', sans-serif; margin: 0; background: #F1F5F9; color: #0F172A; font-size: 14px; }
.hidden { display: none !important; }

/* 顶栏 */
#topbar { display: flex; align-items: center; gap: 20px; background: #fff; border-bottom: 1px solid #E2E8F0; padding: 0 20px; height: 52px; position: sticky; top: 0; z-index: 10; }
#topbar .brand { font-weight: 700; }
#topbar nav { display: flex; gap: 4px; }
#topbar nav a { text-decoration: none; color: #475569; padding: 6px 12px; border-radius: 8px; }
#topbar nav a.active { background: #EFF6FF; color: #1D4ED8; font-weight: 600; }
#topbar .spacer { flex: 1; }

/* 登录 */
.login-wrap { display: grid; place-items: center; min-height: 100vh; }
.login-card { background: #fff; border: 1px solid #E2E8F0; border-radius: 14px; padding: 36px; width: 320px; }
.login-card h1 { font-size: 17px; margin: 0 0 16px; text-align: center; }
.login-card input { width: 100%; margin-bottom: 10px; }
.login-card .err { color: #DC2626; font-size: 12px; min-height: 16px; margin-bottom: 6px; }

/* 通用控件 */
input[type="text"], input[type="password"], input[type="number"], select, textarea {
  border: 1px solid #CBD5E1; border-radius: 8px; padding: 7px 10px; font: inherit; background: #fff;
}
textarea { width: 100%; font-family: ui-monospace, Consolas, monospace; font-size: 12.5px; }
button { border: 0; border-radius: 8px; padding: 7px 14px; font: inherit; cursor: pointer; background: #2563EB; color: #fff; }
button:hover { background: #1D4ED8; }
button.ghost { background: transparent; color: #475569; border: 1px solid #CBD5E1; }
button.ghost:hover { background: #F1F5F9; }
button.danger { background: #DC2626; }
button.danger:hover { background: #B91C1C; }
button.mini { padding: 3px 8px; font-size: 12px; }
img.thumb { object-fit: cover; background: #E2E8F0; border-radius: 6px; }

/* 内容编辑布局 */
.content-layout { display: flex; gap: 16px; padding: 16px 20px; align-items: flex-start; }
.editor { flex: 1; background: #fff; border: 1px solid #E2E8F0; border-radius: 12px; padding: 18px; min-width: 0; }
.editor-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.editor-head h2 { font-size: 15px; margin: 0; flex: 1; }
.lang-tabs { display: flex; gap: 2px; background: #F1F5F9; padding: 3px; border-radius: 8px; }
.lang-tabs button { padding: 4px 14px; background: transparent; color: #475569; }
.lang-tabs button.active { background: #fff; color: #0F172A; font-weight: 600; }
.field { margin-bottom: 12px; }
.field label { display: block; font-size: 12px; color: #64748B; margin-bottom: 4px; }
.field input[type="text"], .field select { width: 100%; }
.field .img-row { display: flex; gap: 6px; }
.field .img-row input { flex: 1; }
.field textarea { min-height: 110px; }
.editor .hint { color: #94A3B8; font-size: 12px; margin: 4px 0 12px; }
.editor-foot { display: flex; gap: 8px; margin-top: 16px; align-items: center; }
.editor-foot .msg { font-size: 12px; }
.editor-foot .msg.ok { color: #16A34A; }
.editor-foot .msg.err { color: #DC2626; }
details.adv { margin-top: 14px; border-top: 1px dashed #E2E8F0; padding-top: 10px; }
details.adv summary { cursor: pointer; color: #64748B; font-size: 12.5px; }

/* 媒体库 */
.media-page { padding: 16px 20px; }
.upload-bar { display: flex; gap: 10px; align-items: center; background: #fff; border: 1px solid #E2E8F0; border-radius: 12px; padding: 12px 14px; margin-bottom: 14px; flex-wrap: wrap; }
.upload-bar input[type="file"] { font-size: 12.5px; }
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.media-card { background: #fff; border: 1px solid #E2E8F0; border-radius: 10px; padding: 8px; position: relative; }
.media-card img.thumb { width: 100%; height: 110px; }
.media-card video.thumb { width: 100%; height: 110px; object-fit: cover; border-radius: 6px; background: #0F172A; display: block; }
.media-card.is-video::after,
.pick.is-video::after { content: '视频'; position: absolute; top: 8px; left: 8px; background: rgba(11,11,10,.78); color: #fff; font-size: 10px; letter-spacing: .06em; padding: 2px 6px; border-radius: 3px; pointer-events: none; }
/* 浏览器解码首帧需要时间，先给一个播放图标，避免看起来像坏图 */
.media-card.is-video::before {
  content: '▶'; position: absolute; left: 50%; top: 63px; transform: translate(-50%, -50%);
  width: 38px; height: 38px; border-radius: 50%; background: rgba(11,11,10,.55); color: rgba(255,255,255,.9);
  font-size: 13px; display: grid; place-items: center; pointer-events: none;
}
.media-card.is-video.has-frame::before,
.pick.is-video.has-frame::before { display: none; }
.pick.is-video::before {
  content: '▶'; position: absolute; left: 50%; top: 49px; transform: translate(-50%, -50%);
  width: 32px; height: 32px; border-radius: 50%; background: rgba(11,11,10,.55); color: rgba(255,255,255,.9);
  font-size: 11px; display: grid; place-items: center; pointer-events: none;
}
.media-card .meta { font-size: 11px; color: #64748B; word-break: break-all; margin: 6px 0; }
.media-card input { width: 100%; margin-bottom: 4px; font-size: 12px; }
.media-card .row { display: flex; gap: 4px; }

/* 弹层 */
.modal { position: fixed; inset: 0; background: rgba(15, 23, 42, .45); display: grid; place-items: center; z-index: 50; }
.modal-card { background: #fff; border-radius: 14px; padding: 18px; width: min(860px, 92vw); max-height: 86vh; overflow: auto; }
.picker-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; margin: 12px 0; }
.picker-grid .pick { border: 2px solid transparent; border-radius: 8px; padding: 4px; cursor: pointer; background: #fff; }
.picker-grid .pick:hover { border-color: #93C5FD; }
.picker-grid img.thumb { width: 100%; height: 90px; }
.picker-grid video.thumb { width: 100%; height: 90px; object-fit: cover; border-radius: 6px; background: #0F172A; display: block; }
.pick { position: relative; }
.picker-grid .meta { font-size: 10.5px; color: #64748B; word-break: break-all; }

/* 页面位置图：整页骨架，当前板块高亮 */
.page-map { display: flex; flex-direction: column; gap: 4px; background: #fff; border: 1px solid #E2E8F0; border-radius: 12px; padding: 8px; height: 400px; }
.page-map.config-map { height: auto; }
.pm-bar { flex: 0 0 20px; display: flex; align-items: center; justify-content: center; background: #E2E8F0; border-radius: 5px; color: #64748B; font-size: 10.5px; }
.pm-bar.pm-fixed { flex-basis: 26px; background: #F8FAFC; border: 1px dashed #CBD5E1; color: #94A3B8; }
.pm-sec { min-height: 30px; display: flex; align-items: center; gap: 4px; padding: 0 6px; border: 1px solid #E2E8F0; border-radius: 6px; background: #F8FAFC; color: #64748B; font-size: 11.5px; cursor: pointer; overflow: hidden; }
.pm-sec:hover { border-color: #93C5FD; background: #F8FAFF; }
.pm-sec.active { border-color: #2563EB; background: #EFF6FF; color: #1D4ED8; font-weight: 600; }
.pm-name { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pm-ops { display: flex; gap: 2px; }
.pm-ops button { padding: 1px 5px; font-size: 11px; }

/* 编辑器：左预览 右表单 */
.editor-split { display: flex; gap: 20px; align-items: flex-start; }
.preview-col { width: 320px; flex-shrink: 0; position: sticky; top: 68px; }
.preview-title { font-size: 12px; color: #64748B; margin-bottom: 6px; }
.thumb-frame { width: 320px; height: 180px; overflow: hidden; border: 1px solid #E2E8F0; border-radius: 10px; background: #0F172A; }
.thumb-canvas { width: 1280px; height: 720px; transform: scale(0.25); transform-origin: top left; position: relative; overflow: hidden; background: #131209; color: #fff; font-family: inherit; }
.form-col { flex: 1; min-width: 0; }
.where { color: #64748B; font-size: 12.5px; margin: -6px 0 14px; }
.fhint { color: #94A3B8; font-size: 11.5px; margin: 4px 0 0; }
.field .ctl { display: flex; align-items: center; gap: 8px; }
.field .ctl input { flex: 1; }
.count { font-size: 11px; color: #94A3B8; white-space: nowrap; }
.count.over { color: #B45309; }
.warn { color: #B45309; font-size: 11.5px; margin: 4px 0 0; }
.warn:empty { display: none; }
.inline-2 { display: flex; gap: 8px; }
.inline-2 input { flex: 1; }
.slide-card { border: 1px solid #E2E8F0; border-radius: 10px; padding: 12px; margin-bottom: 10px; background: #FCFDFF; }
.slide-card.active { border-color: #93C5FD; box-shadow: 0 0 0 3px #EFF6FF; }
.slide-card > header { display: flex; align-items: center; gap: 6px; margin-bottom: 10px; }
.slide-card > header h4 { flex: 1; margin: 0; font-size: 13px; }
.danger-text { color: #DC2626; border-color: #FECACA; }
.banner { display: flex; align-items: center; gap: 10px; justify-content: space-between; background: #F8FAFF; border: 1px solid #DBEAFE; border-radius: 10px; padding: 9px 12px; margin: -4px 0 14px; color: #1E3A8A; font-size: 12.5px; }
.banner button { flex-shrink: 0; }
.subhead { font-size: 13px; margin: 20px 0 4px; padding-top: 14px; border-top: 1px dashed #E2E8F0; }
.subgroup { border-left: 2px solid #E2E8F0; margin: 2px 0 0 2px; padding-left: 10px; }
.subgroup .field:last-child { margin-bottom: 0; }

/* 幻灯片切换条：一次只编辑一张，点缩略图切换 */
.slide-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin: 2px 0 12px; }
.slide-tab { display: flex; flex-direction: column; align-items: center; gap: 4px; width: 92px; padding: 5px; background: #fff; border: 2px solid #E2E8F0; border-radius: 8px; color: #64748B; }
.slide-tab:hover { border-color: #93C5FD; }
.slide-tab.active { border-color: #2563EB; background: #EFF6FF; color: #1D4ED8; }
.slide-tab img { width: 100%; height: 42px; object-fit: cover; border-radius: 4px; background: #E2E8F0; }
.slide-tab .ph { display: grid; place-items: center; width: 100%; height: 42px; border-radius: 4px; background: #F1F5F9; font-size: 11px; color: #94A3B8; }
.slide-tab small { font-size: 11px; }
.slide-tab.add { justify-content: center; font-size: 20px; font-weight: 400; width: 56px; }

/* 缩略预览内部：按 1280×720 真实尺寸绘制，由外层 scale 缩小 */
.pv-bg { position: absolute; inset: 0; width: 1280px; height: 720px; object-fit: cover; }
.pv-veil { position: absolute; inset: 0; background: linear-gradient(90deg, #131209 0%, rgba(19,18,9,.96) 26%, rgba(19,18,9,.8) 44%, rgba(19,18,9,.22) 62%, rgba(19,18,9,0) 82%); }
.pv-in { position: absolute; left: 96px; top: 50%; transform: translateY(-50%); width: 640px; }
.pv-in.bar { left: 120px; right: 120px; width: auto; top: auto; bottom: 80px; transform: none; text-align: center; }
.pv-eyebrow { display: flex; align-items: center; gap: 10px; font-size: 11px; font-weight: 700; letter-spacing: .18em; text-transform: uppercase; color: rgba(255,255,255,.55); margin: 0 0 22px; }
.pv-eyebrow::before { content: ''; width: 26px; height: 1px; background: #93ABFF; flex: none; }
.pv-in.bar .pv-eyebrow { justify-content: center; }
.pv-in.bar .pv-eyebrow::before { display: none; }
.pv-title { font-size: 58px; line-height: 1.04; font-weight: 600; letter-spacing: -.035em; white-space: pre-line; margin: 0 0 18px; color: #fff; background: linear-gradient(90deg, #fff 30%, #9b9b9b 100%); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.pv-title.sm { font-size: 40px; }
.pv-accent { font-size: 19px; font-weight: 600; letter-spacing: -.01em; color: #93ABFF; margin: 0 0 14px; }
.pv-sub { font-size: 16px; line-height: 1.65; color: rgba(255,255,255,.68); margin: 0 0 20px; }
.pv-points { display: flex; flex-wrap: wrap; gap: 8px 24px; margin: 0 0 26px; padding: 0; list-style: none; }
.pv-points li { display: flex; align-items: center; gap: 8px; font-size: 10px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: rgba(255,255,255,.72); }
.pv-points li::before { content: ''; width: 4px; height: 4px; border-radius: 50%; background: #93ABFF; flex: none; }
.pv-cta { display: flex; gap: 12px; }
.pv-in.bar .pv-cta { justify-content: center; }
.pv-btn { background: #1F4BFF; color: #fff; padding: 12px 22px; border-radius: 4px; font-size: 15px; font-weight: 600; }
.pv-btn.ghost { background: transparent; border: 1px solid rgba(255,255,255,.28); }

/* 通用板块预览：白底排版，与站点其余区块一致 */
.pv-generic { position: absolute; inset: 0; background: #fff; color: #0B0B0A; padding: 80px 88px; }
.pv-generic .pv-eyebrow { color: #3D3D38; }
.pv-generic .pv-eyebrow::before { background: #1F4BFF; }
.pv-generic .pv-title { color: #0B0B0A; background: none; -webkit-text-fill-color: #0B0B0A; }
.pv-generic .pv-sub { color: #74746C; }
.pv-generic-img { width: 320px; height: 200px; object-fit: cover; border-radius: 4px; margin-top: 24px; }

/* 产品分类缩略：白底双列编号清单 */
.pv-cats { position: absolute; inset: 0; background: #fff; color: #0B0B0A; padding: 48px 64px; display: grid; grid-template-columns: 1fr 1fr; column-gap: 56px; align-content: start; }
.pv-cat { display: grid; grid-template-columns: 150px 1fr; gap: 24px; align-items: start; padding: 22px 0; border-top: 1px solid #E4E4DD; }
.pv-cat img { width: 100%; aspect-ratio: 4 / 3; object-fit: contain; background: #F5F5F1; border-radius: 4px; mix-blend-mode: multiply; }
.pv-cat-ph { display: grid; place-items: center; aspect-ratio: 4 / 3; border-radius: 4px; background: #F5F5F1; color: #98988F; font-size: 18px; }
.pv-cat-idx { font-size: 11px; font-weight: 700; letter-spacing: .18em; color: #1F4BFF; margin: 0 0 8px; }
.pv-cat-name { font-size: 24px; font-weight: 600; letter-spacing: -.03em; margin: 0 0 10px; line-height: 1.2; }
.pv-cat-desc { font-size: 14px; line-height: 1.6; color: #74746C; margin: 0; }

/* 窄屏（面板宽度不足）时改为纵向堆叠，避免表单被挤成一列字 */
@media (max-width: 1180px) {
  .content-layout { flex-direction: column; align-items: stretch; }
  .page-map { height: 400px; }
  .page-map.config-map { height: auto; }
  .editor-split { flex-direction: column; }
  .preview-col { position: static; width: 320px; max-width: 100%; }
}
