:root {
  --orange: #f08300;
  --orange-dark: #d4740a;
  --orange-soft: #fff5e6;
  --ink: #1f2329;
  --ink-2: #4e5969;
  --ink-3: #86909c;
  --line: #e5e6eb;
  --line-2: #f2f3f5;
  --bg: #f5f6f8;
  --white: #fff;
  --danger: #d93026;
  --radius: 10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

/* ---------------- 登录页 ---------------- */
.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(160deg, #fff7ec 0%, #f5f6f8 55%, #eef1f5 100%);
  padding: 24px;
}

.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--white);
  border-radius: 16px;
  padding: 34px 30px 24px;
  box-shadow: 0 12px 40px rgba(31, 35, 41, .08);
}

.login-brand { text-align: center; margin-bottom: 26px; }
.login-brand img { height: 44px; display: block; margin: 0 auto 14px; }
.login-brand h1 { font-size: 19px; font-weight: 600; margin: 0 0 4px; }
.login-brand p { font-size: 12.5px; color: var(--ink-3); margin: 0; }

.login-foot { text-align: center; font-size: 12px; color: var(--ink-3); margin: 18px 0 0; }
.login-err { color: var(--danger); font-size: 13px; min-height: 20px; margin: 10px 0 0; text-align: center; }

/* ---------------- 表单控件 ---------------- */
.fld { display: block; margin-bottom: 16px; }
.fld-label { display: block; font-size: 13px; color: var(--ink-2); margin-bottom: 6px; font-weight: 500; }
.fld-hint { font-size: 12px; color: var(--ink-3); margin-top: 5px; line-height: 1.5; }

input[type="text"], input[type="password"], textarea, select {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  color: var(--ink);
  background: var(--white);
  transition: border-color .15s, box-shadow .15s;
}
input[type="text"]:focus, input[type="password"]:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--orange);
  box-shadow: 0 0 0 3px rgba(240, 131, 0, .12);
}
textarea { resize: vertical; min-height: 76px; line-height: 1.7; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--white);
  color: var(--ink-2);
  font-size: 13.5px;
  font-family: inherit;
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
}
.btn:hover { border-color: var(--ink-3); color: var(--ink); }
.btn-primary { background: var(--orange); border-color: var(--orange); color: #fff; font-weight: 500; }
.btn-primary:hover { background: var(--orange-dark); border-color: var(--orange-dark); color: #fff; }
.btn-danger { color: var(--danger); border-color: #f5c4c1; }
.btn-danger:hover { background: #fef3f2; border-color: var(--danger); color: var(--danger); }
.btn-block { width: 100%; padding: 11px; font-size: 15px; }
.btn-sm { padding: 5px 11px; font-size: 12.5px; border-radius: 6px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

/* ---------------- 主体布局 ---------------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 18px;
  background: var(--white);
  border-bottom: 1px solid var(--line);
}
.topbar-left { display: flex; align-items: center; gap: 11px; min-width: 0; }
.topbar-logo { height: 30px; display: block; }
.topbar-left strong { display: block; font-size: 14.5px; font-weight: 600; line-height: 1.3; }
.topbar-sub { font-size: 11.5px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.topbar-right { display: flex; gap: 8px; flex-shrink: 0; }

.layout { display: flex; align-items: flex-start; min-height: calc(100vh - 58px); padding-bottom: 74px; }

.side {
  position: sticky;
  top: 58px;
  width: 214px;
  flex-shrink: 0;
  padding: 16px 10px;
  max-height: calc(100vh - 58px);
  overflow-y: auto;
}
.side-item {
  display: block;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 13.5px;
  color: var(--ink-2);
  cursor: pointer;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.side-item:hover { background: var(--line-2); }
.side-item.on { background: var(--orange-soft); color: var(--orange-dark); font-weight: 500; }

.main { flex: 1; min-width: 0; padding: 20px 24px 40px; }
.main-head { margin-bottom: 16px; }
.main-head h2 { font-size: 18px; font-weight: 600; margin: 0 0 3px; }
.main-head p { font-size: 12.5px; color: var(--ink-3); margin: 0; }

.card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 20px 22px;
  margin-bottom: 14px;
}
.card-title {
  font-size: 14.5px;
  font-weight: 600;
  margin: 0 0 4px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.card-desc { font-size: 12.5px; color: var(--ink-3); margin: 0 0 16px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }

/* ---------------- 图片字段 ---------------- */
.imgfld { display: flex; gap: 12px; align-items: flex-start; }
.imgfld-thumb {
  width: 92px; height: 70px;
  flex-shrink: 0;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--line-2) center/cover no-repeat;
  cursor: pointer;
}
.imgfld-body { flex: 1; min-width: 0; }
.imgfld-path {
  font-size: 11.5px;
  color: var(--ink-3);
  font-family: ui-monospace, Menlo, Consolas, monospace;
  word-break: break-all;
  margin-bottom: 7px;
}
.imgfld-acts { display: flex; gap: 7px; flex-wrap: wrap; }

/* ---------------- 列表编辑 ---------------- */
.list-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 13px 14px;
  margin-bottom: 10px;
  background: #fcfcfd;
  position: relative;
}
.list-item-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}
.list-item-no { font-size: 12px; color: var(--ink-3); font-weight: 500; }
.list-item-acts { display: flex; gap: 6px; }
.list-add { margin-top: 4px; }

.imglist { display: flex; flex-wrap: wrap; gap: 10px; }
.imglist-cell { width: 108px; }
.imglist-cell .imgfld-thumb { width: 108px; height: 80px; }
.imglist-cell .btn { width: 100%; margin-top: 6px; justify-content: center; }

/* ---------------- 产品系列 ---------------- */
.series-card { border-left: 3px solid var(--orange); }
.series-tagline {
  display: inline-block;
  font-size: 11.5px;
  color: var(--orange-dark);
  background: var(--orange-soft);
  padding: 2px 8px;
  border-radius: 20px;
  margin-left: 8px;
}
.prod-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  margin-bottom: 10px;
  background: #fcfcfd;
}
.prod-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px dashed var(--line);
  font-size: 13px;
  font-weight: 500;
}
.prod-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.prod-grid .full { grid-column: 1 / -1; }

/* ---------------- 底部操作条 ---------------- */
.actionbar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 60;
  height: 62px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 0 22px;
  background: var(--white);
  border-top: 1px solid var(--line);
  box-shadow: 0 -2px 12px rgba(31, 35, 41, .05);
}
.status { font-size: 13px; color: var(--ink-2); display: flex; align-items: center; gap: 7px; }
.status::before {
  content: "";
  width: 7px; height: 7px;
  border-radius: 50%;
  background: #b4b8bf;
  flex-shrink: 0;
}
.status.ok::before { background: #22a06b; }
.status.warn::before { background: var(--orange); }
.status.err::before { background: var(--danger); }
.actionbar-right { display: flex; gap: 9px; }

/* ---------------- 弹窗 & 提示 ---------------- */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(31, 35, 41, .45);
  padding: 40px 20px;
  overflow-y: auto;
}
.modal.on { display: block; }
.modal-box {
  max-width: 760px;
  margin: 0 auto;
  background: var(--white);
  border-radius: 14px;
  padding: 22px 24px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .18);
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.modal-head h3 { font-size: 16px; margin: 0; font-weight: 600; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 10px; }
.gallery-cell {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  background: var(--line-2);
}
.gallery-cell:hover { border-color: var(--orange); }
.gallery-cell img { width: 100%; height: 84px; object-fit: cover; display: block; }
.gallery-cell span {
  display: block;
  font-size: 10.5px;
  color: var(--ink-3);
  padding: 4px 6px;
  word-break: break-all;
  background: var(--white);
  font-family: ui-monospace, Menlo, Consolas, monospace;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 84px;
  transform: translateX(-50%) translateY(14px);
  z-index: 200;
  background: rgba(31, 35, 41, .92);
  color: #fff;
  font-size: 13.5px;
  padding: 10px 20px;
  border-radius: 8px;
  opacity: 0;
  pointer-events: none;
  transition: all .22s;
  max-width: 84vw;
  text-align: center;
}
.toast.on { opacity: 1; transform: translateX(-50%) translateY(0); }

.loading { text-align: center; color: var(--ink-3); padding: 50px 0; font-size: 13px; }

/* ---------------- 手机端 ---------------- */
@media (max-width: 760px) {
  .topbar { height: auto; flex-wrap: wrap; padding: 10px 12px; gap: 8px; }
  .topbar-sub { display: none; }
  .topbar-right { width: 100%; overflow-x: auto; padding-bottom: 2px; }
  .topbar-right .btn { padding: 6px 11px; font-size: 12.5px; }
  .layout { flex-direction: column; }
  .side {
    position: static;
    width: 100%;
    max-height: none;
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding: 10px 12px;
    background: var(--white);
    border-bottom: 1px solid var(--line);
  }
  .side-item { flex-shrink: 0; margin-bottom: 0; }
  .main { padding: 14px 12px 30px; }
  .card { padding: 16px 14px; }
  .grid2, .prod-grid { grid-template-columns: 1fr; }
  .actionbar { height: auto; flex-wrap: wrap; padding: 10px 12px; gap: 8px; }
  .actionbar-right { width: 100%; }
  .actionbar-right .btn { flex: 1; padding: 9px 6px; font-size: 13px; }
}
