* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: #f5f6f8;
  color: #1f2937;
}
.topbar {
  display: flex; justify-content: space-between; align-items: center;
  background: #1f2937; color: #fff; padding: 12px 20px;
}
.brand { font-weight: 600; }
.auth input {
  padding: 6px 10px; border-radius: 4px; border: none; margin-right: 8px; width: 240px;
}
.auth button { padding: 6px 14px; border: none; border-radius: 4px; background: #2563eb; color: #fff; cursor: pointer; }

.layout { display: flex; min-height: calc(100vh - 52px); }
.sidenav { width: 180px; background: #fff; border-right: 1px solid #e5e7eb; padding: 12px 0; }
.sidenav a {
  display: block; padding: 10px 20px; cursor: pointer; font-size: 14px; color: #374151;
}
.sidenav a:hover { background: #f3f4f6; }
.sidenav a.active { background: #eef2ff; color: #4338ca; font-weight: 600; }

.content { flex: 1; padding: 20px; overflow: auto; }
h2 { font-size: 18px; margin: 0 0 16px; }
.card { background: #fff; border-radius: 8px; padding: 16px; margin-bottom: 16px; box-shadow: 0 1px 4px rgba(0,0,0,.06); }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.grid2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 8px 10px; border-bottom: 1px solid #f1f5f9; text-align: left; }
th { background: #f9fafb; color: #6b7280; font-weight: 500; }
tr.expired { background: #fee2e2; }
tr.second-alert { background: #fecaca; }

button { padding: 6px 12px; border: 1px solid #d1d5db; background: #fff; border-radius: 4px; cursor: pointer; font-size: 13px; }
button.primary { background: #2563eb; color: #fff; border-color: #2563eb; }
button.danger { background: #dc2626; color: #fff; border-color: #dc2626; }
button.warn { background: #f59e0b; color: #fff; border-color: #f59e0b; }
input, select, textarea {
  padding: 6px 10px; border: 1px solid #d1d5db; border-radius: 4px; font-size: 13px;
}
label { font-size: 13px; color: #6b7280; display: block; margin-bottom: 4px; }

.images { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
.img-card { background: #fff; border: 1px solid #e5e7eb; border-radius: 6px; padding: 8px; }
.img-card img { width: 100%; height: 100px; object-fit: cover; border-radius: 4px; background: #e5e7eb; }
.img-card .name { font-size: 12px; margin-top: 6px; word-break: break-all; }
.slot-row { border: 1px solid #e5e7eb; border-radius: 6px; padding: 10px; margin-bottom: 10px; }
.slot-row img { width: 80px; height: 60px; object-fit: cover; border-radius: 4px; background: #eee; }
.tag { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 12px; background: #eef2ff; color: #4338ca; margin-right: 6px; }
.tag.danger { background: #fee2e2; color: #b91c1c; }
.tag.ok { background: #dcfce7; color: #166534; }
.muted { color: #6b7280; font-size: 12px; }
.empty { color: #9ca3af; text-align: center; padding: 30px; }
.toast {
  position: fixed; right: 20px; bottom: 20px; background: #1f2937; color: #fff;
  padding: 10px 16px; border-radius: 6px; font-size: 13px; display: none; z-index: 99;
}

/* ---------- 组件式模板编辑器 v2 ---------- */
.tpl-editor { display: grid; grid-template-columns: 218px 1fr 320px; gap: 16px; align-items: start; }
.tpl-palette, .tpl-props { background: #fff; border-radius: 12px; box-shadow: 0 2px 12px rgba(15,23,42,.06); position: sticky; top: 12px; max-height: calc(100vh - 100px); overflow: auto; padding-bottom: 16px; }
.tpl-palette-head { position: sticky; top: 0; background: #fff; padding: 12px 14px; font-size: 13px; font-weight: 700; color: #0f172a; border-bottom: 1px solid #f1f5f9; z-index: 2; }
.palette-group { padding: 8px 10px 2px; }
.palette-group-title { font-size: 11px; color: #9ca3af; font-weight: 700; letter-spacing: .04em; margin: 6px 4px; }
.palette-item { display: flex; gap: 10px; align-items: center; padding: 10px; border: 1px solid #eef1f5; border-radius: 10px; margin-bottom: 8px; cursor: pointer; background: #fbfcfe; transition: .15s; }
.palette-item:hover { border-color: #2563eb; background: #eef4ff; transform: translateY(-1px); box-shadow: 0 4px 10px rgba(37,99,235,.12); }
.palette-ico { width: 30px; height: 30px; border-radius: 8px; background: linear-gradient(135deg,#dbeafe,#bfdbfe); display: flex; align-items: center; justify-content: center; font-size: 16px; flex: none; }
.palette-text b { display: block; font-size: 13px; color: #111827; }
.palette-text i { font-style: normal; font-size: 11px; color: #9ca3af; }
.tpl-topbar { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; background: #fff; border-radius: 12px; padding: 16px 18px; box-shadow: 0 2px 12px rgba(15,23,42,.06); margin-bottom: 16px; flex-wrap: wrap; }
.tpl-meta { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.tpl-meta label { display: flex; flex-direction: column; font-size: 11px; color: #6b7280; gap: 4px; }
.tpl-meta input { width: 130px; }
.tpl-stage { background: linear-gradient(135deg,#eef2f7,#e2e8f0); border-radius: 12px; padding: 26px; display: flex; justify-content: center; }
.tpl-phone { width: 375px; background: #fff; border-radius: 34px; box-shadow: 0 12px 40px rgba(15,23,42,.22); overflow: hidden; min-height: 700px; border: 8px solid #111827; position: relative; }
.tpl-notch { height: 22px; background: #111827; width: 140px; border-radius: 0 0 16px 16px; margin: 0 auto; }
.tpl-screen { padding: 4px 0; }
.tpl-empty-screen { text-align: center; color: #9ca3af; font-size: 13px; padding: 120px 30px; }
.tpl-sec { position: relative; cursor: pointer; border-bottom: 1px solid #f1f5f9; transition: background .12s; }
.tpl-sec:hover { background: #f8fafc; }
.tpl-sec.sel { background: #eef4ff; box-shadow: inset 3px 0 0 #2563eb; }
.tpl-sec.dragging { opacity: .4; }
.tpl-sec.drop-target { box-shadow: inset 0 3px 0 #2563eb; }
.sec-tools { position: absolute; top: 6px; right: 6px; display: none; gap: 4px; z-index: 6; align-items: center; background: rgba(17,24,39,.78); padding: 3px 5px; border-radius: 8px; }
.tpl-sec:hover .sec-tools, .tpl-sec.sel .sec-tools { display: flex; }
.sec-tools button { padding: 0 8px; font-size: 12px; line-height: 22px; height: 22px; background: #fff; color: #111827; border: none; }
.sec-tools button.danger { background: #fee2e2; color: #dc2626; }
.drag-handle { color: #cbd5e1; font-size: 14px; cursor: grab; padding: 0 2px; user-select: none; }
.t-pad { padding: 14px; }
.t-empty { padding: 18px; line-height: 1.9; }
/* banner */
.t-banner { position: relative; color: #fff; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg,#1e3a8a,#6d28d9,#db2777); background-size: cover; background-position: center; text-align: center; }
.t-banner-mask { position: absolute; inset: 0; background: linear-gradient(180deg,rgba(0,0,0,.05),rgba(0,0,0,.45)); }
.t-banner-c { position: relative; padding: 18px; z-index: 1; }
.t-b-title { font-size: 22px; font-weight: 800; text-shadow: 0 2px 8px rgba(0,0,0,.3); }
.t-b-sub { font-size: 13px; opacity: .92; margin-top: 6px; }
.t-b-cta { display: inline-block; margin-top: 12px; padding: 7px 18px; background: #fff; color: #6d28d9; border-radius: 999px; font-size: 13px; font-weight: 700; }
/* heading */
.t-heading .t-h-title { font-size: 19px; font-weight: 800; color: #0f172a; }
.t-heading .t-h-sub { font-size: 12px; color: #6b7280; margin-top: 5px; }
.t-heading.center { text-align: center; }
.t-heading.left { text-align: left; padding-left: 10px; border-left: 4px solid #2563eb; }
.t-heading.right { text-align: right; }
.t-sec-title { font-size: 16px; font-weight: 800; color: #0f172a; margin-bottom: 10px; }
.t-h-title-sm { font-size: 15px; font-weight: 700; color: #111827; margin-bottom: 4px; }
.t-paragraph { font-size: 13px; color: #4b5563; line-height: 1.7; }
/* search */
.t-search { display: flex; align-items: center; gap: 8px; background: #f1f5f9; border-radius: 999px; padding: 9px 14px; color: #9ca3af; font-size: 13px; }
.t-search-ico { font-size: 14px; }
/* divider */
.t-divider { height: 1px; background: #e5e7eb; margin: 8px 14px; position: relative; text-align: center; }
.t-divider span { position: absolute; top: -9px; left: 50%; transform: translateX(-50%); background: #fff; padding: 0 10px; font-size: 11px; color: #9ca3af; }
/* products */
.p-grid { display: grid; gap: 10px; }
.g-card { border: 1px solid #eef1f5; border-radius: 12px; overflow: hidden; background: #fff; box-shadow: 0 1px 6px rgba(15,23,42,.04); }
.g-card-img { height: 110px; background: linear-gradient(135deg,#e2e8f0,#cbd5e1); display: flex; align-items: center; justify-content: center; color: #64748b; font-size: 12px; }
.g-card-img img, .g-item-img img, .t-feature-img img, .t-company-logo img, .t-video { object-fit: cover; }
.g-card-name { font-size: 13px; font-weight: 700; padding: 8px 10px 0; color: #111827; }
.g-card-price { font-size: 13px; font-weight: 800; color: #e11d48; padding: 2px 10px 0; }
.g-card-btn { margin: 8px 10px 10px; background: #2563eb; color: #fff; text-align: center; border-radius: 8px; font-size: 12px; padding: 6px; }
/* gallery 多版式（与小程序端同参对齐） */
.g-g { display: flex; flex-wrap: wrap; align-items: flex-start; }
.g-item { box-sizing: border-box; padding: 5px; width: 50%; border-radius: 12px; overflow: hidden; }
.g-item-img { width: 100%; height: 110px; border-radius: 12px; overflow: hidden; background: linear-gradient(135deg,#e2e8f0,#cbd5e1); display: flex; align-items: center; justify-content: center; color: #94a3b8; font-size: 12px; }
.g-item-img img { width: 100%; height: 100%; }
.g-item-cap { font-size: 11px; color: #6b7280; padding: 5px 8px; background: #f8fafc; border-radius: 0 0 10px 10px; }
.g-g.g-grid3 .g-item { width: 33.333%; }
.g-g.g-grid3 .g-item-img { height: 78px; border-radius: 8px; }
.g-g.g-big-top .g-item, .g-g.g-golden .g-item, .g-g.g-hero .g-item, .g-g.g-tall .g-item { width: 100%; }
.g-g.g-big-top .g-first .g-item-img, .g-g.g-hero .g-item-img { height: 200px; }
.g-g.g-golden .g-first .g-item-img { height: 250px; border-radius: 14px; }
.g-g.g-tall .g-item-img { height: 420px; border-radius: 14px; }
.g-g.g-big-left .g-first .g-item-img { height: 230px; border-radius: 14px; }
.g-g.g-masonry .g-alt .g-item-img { height: 150px; }
/* feature */
.t-feature { display: flex; gap: 12px; align-items: center; }
.t-feature.rev { flex-direction: row-reverse; }
.t-feature-img { width: 130px; height: 100px; flex: none; border-radius: 10px; background: #e2e8f0; display: flex; align-items: center; justify-content: center; color: #94a3b8; font-size: 12px; overflow: hidden; }
.t-feature-img img, .t-feature-img { object-fit: cover; }
.t-feature-txt { flex: 1; }
/* video */
.t-video { height: 190px; border-radius: 12px; background: #0f172a; display: flex; align-items: center; justify-content: center; color: #fff; background-size: cover; background-position: center; }
.t-play { width: 54px; height: 54px; border-radius: 50%; background: rgba(255,255,255,.9); color: #111827; display: flex; align-items: center; justify-content: center; font-size: 20px; padding-left: 4px; }
/* nav */
.t-nav-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 10px; }
.t-nav-item { text-align: center; }
.t-nav-ico { width: 46px; height: 46px; border-radius: 14px; background: linear-gradient(135deg,#eff6ff,#dbeafe); margin: 0 auto 6px; display: flex; align-items: center; justify-content: center; font-size: 22px; }
.t-nav-label { font-size: 12px; color: #374151; }
/* cta */
.t-cta { display: block; width: 100%; border: none; background: linear-gradient(135deg,#2563eb,#7c3aed); color: #fff; text-align: center; border-radius: 12px; padding: 13px; font-size: 15px; font-weight: 700; box-shadow: 0 6px 16px rgba(37,99,235,.28); cursor: pointer; }
.t-cta.line { background: #fff; color: #2563eb; border: 2px solid #2563eb; box-shadow: none; }
/* lead */
.t-lead { background: #f8fafc; border: 1px dashed #cbd5e1; border-radius: 12px; padding: 14px; }
.t-lead-title { font-size: 15px; font-weight: 800; color: #111827; margin-bottom: 10px; text-align: center; }
.t-lead-field { background: #fff; border: 1px solid #e5e7eb; border-radius: 8px; padding: 9px 12px; font-size: 12px; color: #9ca3af; margin-bottom: 8px; }
/* coupon */
.t-coupon { display: flex; align-items: stretch; border-radius: 12px; overflow: hidden; box-shadow: 0 2px 10px rgba(220,38,38,.15); }
.t-coupon-left { width: 120px; background: linear-gradient(135deg,#f87171,#dc2626); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 18px; font-weight: 800; text-align: center; padding: 10px; flex: none; }
.t-coupon-right { flex: 1; background: #fff5f5; padding: 12px 14px; display: flex; align-items: center; justify-content: space-between; }
.t-coupon-desc { font-size: 12px; color: #7f1d1d; }
.t-coupon-btn { background: #dc2626; color: #fff; border: none; border-radius: 999px; padding: 7px 16px; font-size: 12px; font-weight: 700; }
/* countdown */
.t-countdown { display: flex; gap: 8px; align-items: center; justify-content: center; }
.t-cd-label { font-size: 13px; color: #111827; font-weight: 700; margin-right: 4px; }
.t-cd-box { background: #111827; color: #fff; border-radius: 8px; padding: 6px 8px; font-size: 16px; font-weight: 800; min-width: 40px; text-align: center; }
.t-cd-box small { font-size: 10px; font-weight: 500; margin-left: 2px; opacity: .8; }
/* company */
.t-company { text-align: center; }
.t-company-logo { width: 64px; height: 64px; border-radius: 50%; background: #e2e8f0; margin: 0 auto 10px; display: flex; align-items: center; justify-content: center; color: #94a3b8; font-size: 12px; overflow: hidden; }
.t-company-logo img { width: 100%; height: 100%; }
.t-company-name { font-size: 17px; font-weight: 800; color: #0f172a; }
.t-company-contact { font-size: 12px; color: #6b7280; margin-top: 8px; }
/* params */
.t-param-table { border: 1px solid #eef1f5; border-radius: 10px; overflow: hidden; }
.t-param-row { display: flex; justify-content: space-between; padding: 9px 12px; font-size: 13px; border-bottom: 1px solid #f1f5f9; }
.t-param-row:last-child { border-bottom: none; }
.t-param-row span:first-child { color: #6b7280; }
.t-param-row span:last-child { color: #111827; font-weight: 600; }
/* props */
.prop { margin-bottom: 11px; }
.prop input, .prop select, .prop textarea { width: 100%; }
.prop textarea { resize: vertical; }
.prop-row-box { border: 1px solid #eef1f5; border-radius: 8px; padding: 10px; margin-bottom: 8px; background: #fbfcfe; }
.tpl-props button, .prop-row-box button { width: 100%; }
.tag { display: inline-block; background: #eef2ff; color: #2563eb; font-size: 12px; font-weight: 700; padding: 5px 10px; border-radius: 999px; margin-bottom: 12px; }
@media (max-width: 1100px) { .tpl-editor { grid-template-columns: 1fr; } .tpl-props, .tpl-palette { position: static; max-height: none; } }
