/* ---------- CS电商创作平台：外壳 ---------- */
:root {
  --ui-bg: #F4F4F2; --ui-panel: #FFFFFF; --ui-text: #1F2328; --ui-muted: #6B7076;
  --ui-line: #E3E3DF; --ui-accent: #2F6F4F; --ui-accent-soft: #EAF2EC; --ui-warn: #B45309; --ui-bad: #B42318; --ui-ok: #2F6F4F;
  --ui-font: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", system-ui, sans-serif;
  --header-h: 56px; --nav-w: 208px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--ui-bg); color: var(--ui-text); font: 14px/1.5 var(--ui-font); }
a { color: var(--ui-accent); text-decoration: none; cursor: pointer; }
button, input, textarea, select { font: inherit; color: inherit; }
button { border: 1px solid var(--ui-line); background: var(--ui-panel); border-radius: 6px; padding: 6px 12px; cursor: pointer; white-space: nowrap; }
button:hover { border-color: #C9C9C4; }
button.primary { background: var(--ui-accent); border-color: var(--ui-accent); color: #fff; }
button:disabled { opacity: .5; cursor: default; }
input[type=text], input[type=search], textarea, select { width: 100%; border: 1px solid var(--ui-line); border-radius: 6px; padding: 6px 8px; background: #fff; }
textarea { resize: vertical; min-height: 60px; }
label { display: block; font-size: 12px; color: var(--ui-muted); margin: 10px 0 4px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row > * { flex: 0 0 auto; }
.grow { flex: 1 1 auto !important; }
.muted { color: var(--ui-muted); font-size: 12px; }

/* 布局：顶栏 + 左侧导航 + 内容 */
.shell { display: grid; grid-template-rows: var(--header-h) 1fr; grid-template-columns: var(--nav-w) 1fr; height: 100vh; height: 100dvh; }
.header {
  grid-column: 1 / -1; display: flex; align-items: center; gap: 12px; padding: 0 20px;
  background: var(--ui-panel); border-bottom: 1px solid var(--ui-line);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 16px; color: var(--ui-text); }
.brand .logo { width: 28px; height: 28px; border-radius: 7px; background: var(--ui-accent); color: #fff; display: grid; place-items: center; font-size: 13px; letter-spacing: .02em; }
.header .spacer { flex: 1; }
.usermenu { position: relative; }
.usermenu > button { border: 0; background: transparent; display: flex; gap: 6px; align-items: center; }
.usermenu .role { font-size: 12px; color: var(--ui-muted); }
.usermenu .menu { position: absolute; right: 0; top: 40px; background: #fff; border: 1px solid var(--ui-line); border-radius: 8px; min-width: 150px; padding: 6px 0; display: none; z-index: 20; box-shadow: 0 6px 20px rgba(0,0,0,.08); }
.usermenu.open .menu { display: block; }
.usermenu .menu a { display: block; padding: 8px 14px; color: var(--ui-text); }
.usermenu .menu a:hover { background: var(--ui-bg); }

.nav { background: var(--ui-panel); border-right: 1px solid var(--ui-line); padding: 12px 10px; overflow-y: auto; }
.nav .group { font-size: 12px; color: var(--ui-muted); padding: 14px 10px 6px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; color: var(--ui-text); margin-bottom: 2px; }
.nav a .ico { width: 20px; text-align: center; flex: 0 0 20px; }
.nav a .txt { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav a:hover { background: var(--ui-bg); }
.nav a.on { background: var(--ui-accent-soft); color: var(--ui-accent); font-weight: 600; }
.soon { font-size: 11px; color: var(--ui-muted); background: #F1F1EF; border-radius: 10px; padding: 0 6px; white-space: nowrap; }
.content { overflow: auto; min-width: 0; min-height: 0; }
.page { max-width: 1180px; margin: 0 auto; padding: 24px 28px 60px; }
.page h2 { font-size: 20px; margin: 0 0 4px; }
.page .desc { color: var(--ui-muted); margin: 0 0 20px; }
.page h3 { font-size: 15px; margin: 28px 0 12px; display: flex; justify-content: space-between; align-items: center; }

/* 编辑器页：导航收成图标栏，给 790px 预览让宽度 */
.shell.compact { --nav-w: 60px; }
.shell.compact .nav .group, .shell.compact .nav .txt, .shell.compact .nav .soon { display: none; }
.shell.compact .nav a { justify-content: center; padding: 10px 0; }
.shell.compact .content { overflow: hidden; }

/* 首页 */
.hello { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.features { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; }
.feature { background: var(--ui-panel); border: 1px solid var(--ui-line); border-radius: 12px; padding: 18px; cursor: pointer; position: relative; min-height: 132px; transition: border-color .15s, box-shadow .15s; }
.feature:hover { border-color: var(--ui-accent); box-shadow: 0 4px 16px rgba(47,111,79,.08); }
.feature .ico { font-size: 24px; }
.feature b { display: block; margin: 8px 0 4px; font-size: 15px; }
.feature p { margin: 0; color: var(--ui-muted); font-size: 13px; }
.feature .soon { position: absolute; top: 14px; right: 14px; }
.feature.planned { cursor: default; opacity: .75; }
.feature.planned:hover { border-color: var(--ui-line); box-shadow: none; }

/* 作品网格 */
.works { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; }
.work { background: var(--ui-panel); border: 1px solid var(--ui-line); border-radius: 10px; overflow: hidden; cursor: pointer; display: flex; flex-direction: column; }
.work:hover { border-color: var(--ui-accent); }
.work .pic { aspect-ratio: 4 / 3; background: #EFEFEC center top / cover no-repeat; }
.work .pic.empty { display: grid; place-items: center; color: var(--ui-muted); font-size: 12px; }
.work .info { padding: 10px 12px; }
.work .t { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.work .m { color: var(--ui-muted); font-size: 12px; display: flex; justify-content: space-between; gap: 6px; margin-top: 2px; }
.work .ops { display: flex; gap: 12px; padding: 0 12px 10px; font-size: 12px; }
.tag { display: inline-block; font-size: 11px; padding: 0 7px; border-radius: 10px; background: var(--ui-accent-soft); color: var(--ui-accent); }
.tag.gray { background: #F1F1EF; color: var(--ui-muted); }
.empty-box { background: var(--ui-panel); border: 1px dashed var(--ui-line); border-radius: 10px; padding: 36px; text-align: center; color: var(--ui-muted); }
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.filters select, .filters input { width: auto; min-width: 140px; }

/* 详情页：按品类选模板 */
.cats { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.cats button { border-radius: 16px; }
.cats button.on { background: var(--ui-accent); border-color: var(--ui-accent); color: #fff; }
.tpls { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.tpl { background: var(--ui-panel); border: 1px solid var(--ui-line); border-radius: 12px; padding: 16px 18px; display: flex; flex-direction: column; gap: 6px; }
.tpl b { font-size: 15px; }
.tpl p { margin: 0; color: var(--ui-muted); font-size: 13px; flex: 1; }
.tpl .row { justify-content: space-between; margin-top: 8px; }

/* 即将上线 */
.soon-page { text-align: center; padding: 80px 20px; }
.soon-page .ico { font-size: 48px; }

/* 通用浮层 */
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: #1F2328; color: #fff; padding: 8px 14px; border-radius: 6px; font-size: 13px; max-width: 86vw; z-index: 30; display: none; }
.toast.show { display: block; }
.busy { position: fixed; inset: 0; background: rgba(255,255,255,.6); display: none; place-items: center; z-index: 25; font-size: 15px; }
.busy.show { display: grid; }
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.35); display: none; place-items: center; z-index: 20; padding: 16px; }
.modal.show { display: grid; }
.modal .box { background: #fff; border-radius: 10px; padding: 18px 20px; width: min(580px, 100%); max-height: 92vh; overflow: auto; }
.modal h3 { margin: 0 0 4px; }

/* 手机：导航变底部 Tab */
.tabbar { display: none; }
@media (max-width: 767px) {
  .shell, .shell.compact { grid-template-columns: 1fr; grid-template-rows: 52px 1fr 56px; --header-h: 52px; }
  .nav { display: none; }
  .header { padding: 0 14px; }
  .brand .name { font-size: 15px; }
  .usermenu .role { display: none; }
  .tabbar { display: grid; grid-template-columns: repeat(4, 1fr); background: var(--ui-panel); border-top: 1px solid var(--ui-line); }
  .tabbar a { display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: 11px; color: var(--ui-muted); gap: 2px; }
  .tabbar a .ico { font-size: 18px; }
  .tabbar a.on { color: var(--ui-accent); }
  .page { padding: 16px 16px 40px; }
  .shell.compact .content { overflow: auto; }
  .works { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .filters select, .filters input { min-width: 0; flex: 1 1 40%; }
}
