:root {
  --bg: #faf7f2; --card: #fff; --ink: #2b2620; --muted: #8a7f72;
  --line: #e9e0d4; --accent: #a65343; --accent-d: #8a4235;
  --green: #315139; --orange: #c07a2a; --red: #b3402e; --blue: #3a6ea5; --purple: #7a5fa0;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink);
  font-family: -apple-system, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif; }
.hidden { display: none !important; }
.muted { color: var(--muted); } .err { color: var(--red); font-size: 13px; margin: 6px 0; }

/* 登录 gate */
.gate { position: fixed; inset: 0; background: var(--bg); z-index: 100;
  display: flex; align-items: center; justify-content: center; }
.gate-card { background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  padding: 32px; width: 320px; text-align: center; }
.gate-card input { width: 100%; padding: 10px; margin: 12px 0 4px; border: 1px solid var(--line);
  border-radius: 8px; font-size: 15px; }
.gate-card .btn { width: 100%; margin-top: 10px; }

/* 顶栏与页签 */
.topbar { display: flex; justify-content: space-between; align-items: center;
  padding: 12px 20px; background: var(--green); color: #fff9f0; }
.brand { font-weight: 700; font-size: 17px; } .brand .sub { font-weight: 400; font-size: 13px; opacity: .8; }
.tabs { display: flex; gap: 4px; padding: 10px 20px 0; background: var(--green); }
.tab { border: none; background: transparent; color: #fff9f0; opacity: .65; font-size: 15px;
  padding: 10px 18px; cursor: pointer; border-radius: 10px 10px 0 0; }
.tab.active { background: var(--bg); color: var(--ink); opacity: 1; font-weight: 600; }
main { padding: 18px 20px 60px; max-width: 1100px; margin: 0 auto; }
.pane { display: none; } .pane.active { display: block; }

.btn { border: 1px solid var(--line); background: var(--card); border-radius: 8px;
  padding: 8px 14px; font-size: 14px; cursor: pointer; color: var(--ink); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-d); }
.btn.danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn.ghost { background: transparent; border-color: rgba(255,255,255,.4); color: #fff9f0; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.select, .toolbar input { padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; font-size: 14px; }

.toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 16px; flex-wrap: wrap; }
.chips { display: flex; gap: 6px; }
.chip { border: 1px solid var(--line); background: var(--card); border-radius: 999px;
  padding: 7px 14px; font-size: 13px; cursor: pointer; }
.chip.active { background: var(--green); color: #fff; border-color: var(--green); }

/* 内容卡片 */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  overflow: hidden; cursor: pointer; transition: box-shadow .15s; }
.card:hover { box-shadow: 0 4px 14px rgba(0,0,0,.08); }
.card .cover { aspect-ratio: 3/4; background: #efe8db; display: flex; align-items: center;
  justify-content: center; color: var(--muted); font-size: 13px; overflow: hidden; }
.card .cover img { width: 100%; height: 100%; object-fit: cover; }
.card .info { padding: 10px 12px; }
.card .title { font-weight: 600; font-size: 14px; margin: 4px 0; }
.card .meta { font-size: 12px; color: var(--muted); }
.badge { display: inline-block; font-size: 11px; padding: 2px 8px; border-radius: 999px; color: #fff; }
.b-待制作 { background: #9a938a; } .b-制作中 { background: var(--blue); }
.b-待审批 { background: var(--orange); } .b-已通过 { background: #4a8a6d; }
.b-已排期 { background: var(--purple); } .b-已发布 { background: var(--green); }
.b-退回修改 { background: var(--red); }
.type-badge { font-size: 11px; border: 1px solid var(--line); border-radius: 6px;
  padding: 1px 6px; color: var(--muted); }

/* 弹窗 */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 50;
  display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal-card { background: var(--card); border-radius: 14px; max-width: 860px; width: 100%;
  max-height: 92vh; overflow: auto; padding: 22px; position: relative; }
.modal-x { position: absolute; top: 12px; right: 14px; border: none; background: none;
  font-size: 18px; cursor: pointer; color: var(--muted); }
.carousel { position: relative; background: #111; border-radius: 10px; overflow: hidden; }
.carousel img { width: 100%; max-height: 52vh; object-fit: contain; display: block; }
.carousel .nav { position: absolute; top: 50%; transform: translateY(-50%);
  background: rgba(255,255,255,.85); border: none; border-radius: 50%;
  width: 36px; height: 36px; font-size: 18px; cursor: pointer; }
.carousel .prev { left: 10px; } .carousel .next { right: 10px; }
.carousel .counter { position: absolute; bottom: 8px; right: 12px; color: #fff;
  background: rgba(0,0,0,.5); border-radius: 999px; padding: 2px 10px; font-size: 12px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }
.form-grid .full { grid-column: 1 / -1; }
.field label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.field input, .field textarea, .field select { width: 100%; padding: 8px 10px;
  border: 1px solid var(--line); border-radius: 8px; font-size: 14px; font-family: inherit; }
.field textarea { min-height: 76px; resize: vertical; }
.caption-view { background: #f7f2e9; border-radius: 10px; padding: 12px 14px; margin-top: 12px;
  white-space: pre-wrap; font-size: 14px; }
.review-box { margin-top: 16px; border-top: 1px solid var(--line); padding-top: 14px; }
.review-actions { display: flex; gap: 10px; margin-top: 8px; }
.review-item { border-left: 3px solid var(--line); padding: 6px 10px; margin: 8px 0; font-size: 13px; }
.review-item.ok { border-color: #4a8a6d; } .review-item.no { border-color: var(--red); }

/* 计划时间线 */
.week-label { font-weight: 600; }
.timeline { position: relative; margin-top: 8px; padding-left: 26px; }
.timeline::before { content: ""; position: absolute; left: 8px; top: 6px; bottom: 6px;
  width: 2px; background: var(--line); }
.day-block { position: relative; margin-bottom: 18px; }
.day-block::before { content: ""; position: absolute; left: -24px; top: 4px; width: 12px; height: 12px;
  border-radius: 50%; background: var(--accent); }
.day-block.today::before { background: var(--green); box-shadow: 0 0 0 4px rgba(49,81,57,.2); }
.day-head { font-weight: 700; margin-bottom: 8px; }
.day-head .today-tag { font-size: 11px; background: var(--green); color: #fff; border-radius: 6px;
  padding: 1px 6px; margin-left: 6px; }
.day-item { background: var(--card); border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 12px; margin-bottom: 8px; display: flex; gap: 10px; align-items: center; cursor: pointer; }
.day-item .time { font-weight: 700; color: var(--accent); white-space: nowrap; }
.day-item .grow { flex: 1; } .day-item .t { font-size: 14px; font-weight: 600; }
.day-item .s { font-size: 12px; color: var(--muted); }
.day-empty { color: var(--muted); font-size: 13px; padding: 6px 0; }

/* 数据表 */
.hint { color: var(--muted); font-size: 13px; }
.table-wrap { overflow-x: auto; }
.mtable { width: 100%; border-collapse: collapse; background: var(--card); border-radius: 10px; overflow: hidden; }
.mtable th, .mtable td { padding: 10px; border-bottom: 1px solid var(--line); font-size: 13px; text-align: left; }
.mtable th { background: #f3ede1; white-space: nowrap; }
.mtable input { width: 76px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; }
.mtable input.note-in { width: 130px; }
.unverified { font-size: 11px; color: var(--orange); }

/* 库存 */
.stock-head { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.stock-progress { flex: 1; height: 14px; background: #e9e0d4; border-radius: 999px; overflow: hidden; }
.stock-bar { height: 100%; background: var(--green); width: 0; transition: width .3s; }
.stock-text { font-weight: 700; white-space: nowrap; }
.warn { background: #fdf0e4; border: 1px solid var(--orange); color: #8a5a1d; border-radius: 10px;
  padding: 12px 14px; margin-bottom: 14px; font-size: 14px; }
.stock-day { background: var(--card); border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 14px; margin-bottom: 10px; }
.stock-day .d { font-weight: 700; margin-bottom: 6px; }
.slot { display: flex; gap: 8px; align-items: center; font-size: 13px; padding: 4px 0; }
.slot .ok { color: #4a8a6d; } .slot .miss { color: var(--red); }

@media (max-width: 640px) {
  .form-grid { grid-template-columns: 1fr; }
  main { padding: 14px 12px 60px; }
}
