/* 2159 内容管理后台（仅本机使用）。配色只用中性灰 + 品牌黄 #f8b303 / 红 #d50001。 */
* { box-sizing: border-box; margin: 0; }
html, body { height: 100%; }
body {
  display: flex;
  font: 14px/1.5 -apple-system, 'PingFang SC', 'Segoe UI', sans-serif;
  color: #222;
  background: #f2f2f0;
}

/* ---------- 侧边栏 ---------- */
#side {
  width: 260px;
  flex: none;
  display: flex;
  flex-direction: column;
  background: #000000;
  color: #ffffff;
  border-right: 1px solid #333333;
  padding: 16px 14px;
  gap: 16px;
  overflow-y: auto;
}
/* 品牌标与会员页同源：用站点 logo-lockup-white，右侧接一个身份标签区分「后台」 */
.brand { display: flex; align-items: center; gap: 9px; padding-bottom: 2px; }
.brand-logo { height: 32px; width: auto; display: block; }
.brand-tag {
  font-size: 11px;
  letter-spacing: .5px;
  color: #eeeeee;
  padding-left: 9px;
  border-left: 1px solid #666666;
  white-space: nowrap;
}
.group h3 {
  font-size: 12px;
  font-weight: 600;
  color: #eeeeee;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.ver { font-weight: 400; color: #f8b303; }
.items { padding: 0; list-style: none; display: flex; flex-direction: column; gap: 6px; }
.items button {
  width: 100%;
  text-align: left;
  background: #333333;
  color: #ffffff;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 8px 10px;
  cursor: pointer;
  font: inherit;
}
.items button:hover { border-color: #666666; }
.items button.on { border-color: #f8b303; box-shadow: inset 3px 0 #f8b303; }
.item-week { font-weight: 600; color: #ffffff; display: flex; justify-content: space-between; gap: 8px; }
.item-week .chip { font-size: 11px; font-weight: 400; color: #333333; background: #eeeeee; border-radius: 999px; padding: 0 5px; }
.item-week .chip.live { background: #b1f803; color: #000000; }
.item-meta { font-size: 12px; color: #eeeeee; margin-top: 2px; }
.item-meta.bad { color: #d50001; }
.items button.invalid .item-week .chip { background: #d50001; color: #fff; }
.side-hint { font-size: 12px; color: #eeeeee; }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; }

/* ---------- 主区 ---------- */
#main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
#bar {
  flex: none;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  background: #fff;
  border-bottom: 1px solid #e2e2de;
}
#title { font-weight: 600; }
#title .chip {
  font-size: 11px; font-weight: 500; margin-left: 8px; padding: 1px 7px; border-radius: 3px;
  background: #eee; color: #666;
}
#title .chip.draft { background: #fff3d0; color: #8a6d00; }
[data-embedded] #side { display: none; }
[data-embedded] #bar { flex-wrap: wrap; }
[data-embedded] #title { display: flex; align-items: center; min-width: 0; }
.week-picker {
  max-width: min(64vw, 320px);
  font: inherit;
  color: #333333;
  background: #ffffff;
  border: 1px solid #eeeeee;
  border-radius: 8px;
  padding: 6px 8px;
}
#status { color: #888; font-size: 12px; }
.bar-actions { margin-left: auto; display: flex; gap: 8px; }
/* 云端后台：浅色侧栏、独立状态标签和课表工具栏。 */
[data-week-workflow] #side { width: 272px; padding: 16px; }
[data-week-workflow] .brand { min-height: 40px; }
[data-week-workflow] .group h3 { margin: 0 8px 8px; }
[data-week-workflow] .items button { padding: 10px; }
[data-week-workflow] .item-week { display: block; font-size: 13px; }
[data-week-workflow] .item-meta { margin-top: 6px; }
.week-badges { display: flex; flex-wrap: wrap; gap: 4px; }
.items .week-badges { margin-top: 6px; }
.week-badges .chip {
  display: inline-flex;
  align-items: center;
  padding: 1px 7px;
  background: #eeeeee;
  color: #333333;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
}
.week-badges .chip.live { background: #b1f803; color: #000000; }
.week-badges .chip.current { background: #f8b303; color: #000000; }
[data-week-workflow] #bar {
  flex-wrap: wrap;
  justify-content: space-between;
  padding: 14px 20px 4px;
  border: 0;
}
[data-week-workflow] #title { color: #000000; font-size: 17px; }
[data-week-workflow] #status:empty, [data-week-workflow] .bar-actions { display: none; }
#weekNav:not([hidden]) { display: flex; }
#side #addWeekBtn { width: 100%; text-align: left; }
#addWeekBtn span { margin-right: 4px; font-size: 16px; line-height: 1; }
#weekOptions {
  position: fixed;
  inset: auto;
  margin: 0;
  width: min(250px, 90vw);
  max-height: calc(100dvh - 16px);
  overflow: auto;
  padding: 16px;
  background: #ffffff;
  border: 1px solid #eeeeee;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .12);
}
#otherWeekForm { display: grid; gap: 12px; color: #333333; }
#otherWeekForm label:not([hidden]) { display: grid; gap: 4px; }
#otherWeekForm :is(select, input) {
  font: inherit;
  color: #333333;
  background: #ffffff;
  border: 1px solid #eeeeee;
  border-radius: 8px;
  padding: 6px 8px;
  width: 100%;
}
#otherWeekForm output { font-size: 13px; }
#otherWeekForm button { justify-self: end; background: #333333; color: #ffffff; }
#weekWorkflow { background: #ffffff; border-bottom: 1px solid #eeeeee; }
.week-work {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px 20px;
  padding: 4px 20px 14px;
}
.week-work h2 { margin-top: 8px; font-size: 14px; }
#weekWorkStatus { color: #666666; font-size: 13px; margin-top: 4px; }
[data-week-workflow] :is(#weekNav, #weekOptions, #weekWorkflow) button { border-color: #eeeeee; }
[data-week-workflow] :is(#addWeekBtn, #refreshBtn, #clearWeekBtn):hover:not(:disabled) { background: #eeeeee; }
#weekWorkflow #weekPrimaryBtn { background: #f8b303; border-color: #f8b303; color: #000000; font-weight: 600; }
#weekWorkflow #clearWeekBtn { color: #d50001; }
#weekWorkflow button:disabled { opacity: .55; cursor: not-allowed; }
[data-week-workflow] :is(button, select, input):focus-visible { outline: 2px solid #666666; outline-offset: 2px; }
[data-week-workflow] #preview { max-width: 100%; }
@media (max-width: 660px) {
  [data-week-workflow] #side { width: 188px; padding: 12px 8px; }
  [data-week-workflow] #stage { padding: 8px; }
}
@media (max-width: 520px) {
  body[data-week-workflow] { flex-direction: column; }
  [data-week-workflow] #side { width: 100%; max-height: 168px; gap: 8px; border-right: 0; border-bottom: 1px solid #eeeeee; }
  [data-week-workflow] #main { min-height: 0; }
  [data-week-workflow] #title { font-size: 15px; }
  [data-week-workflow] #bar, .week-work { padding-inline: 12px; }
}
button {
  font: inherit;
  border: 1px solid #ccc;
  background: #fff;
  border-radius: 8px;
  padding: 6px 14px;
  cursor: pointer;
}
button.ghost { background: transparent; color: #555; }
button.ghost:hover { border-color: #999; }
#publishBtn { background: #f8b303; border-color: #f8b303; color: #17181a; font-weight: 600; }
#publishBtn:hover { filter: brightness(1.05); }
#publishBtn:disabled { opacity: .45; cursor: not-allowed; }
.draft-panel { flex: none; padding: 8px 16px; border-bottom: 1px solid #eeeeee; }
.draft-panel p { margin: 0 0 8px; }
.draft-panel-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.draft-panel label { display: grid; gap: 4px; }
.draft-panel :is(input, select, textarea) {
  font: inherit; color: #333333; background: #ffffff; border: 1px solid #666666;
  border-radius: 8px; padding: 4px 8px; min-width: 0;
}
.draft-panel .primary { background: #f8b303; border-color: #f8b303; color: #000000; }
.draft-panel .primary:disabled { opacity: .45; cursor: not-allowed; }
#draftHome { max-height: 45vh; overflow: auto; }
#draftHome summary { cursor: pointer; }
#draftHomeForm { display: grid; justify-items: start; gap: 8px; padding-top: 8px; }
#stage[hidden] { display: none; }
#banner {
  flex: none;
  background: #fff3d0;
  color: #8a6d00;
  padding: 6px 16px;
  font-size: 12px;
}
#stage {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
#preview {
  width: 390px;
  height: 844px; /* 常见手机高度 390×844；窗口不足时自适应缩小 */
  max-height: 100%;
  border: 1px solid #d5d5d1;
  border-radius: 18px;
  background: #000;
  box-shadow: 0 8px 28px rgba(0, 0, 0, .12);
}

/* ---------- 提示 ---------- */
#toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translate(-50%, 12px);
  background: #17181a;
  color: #fff;
  border-radius: 8px;
  padding: 8px 16px;
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s, transform .18s;
  max-width: 70vw;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast.bad { background: #d50001; }

/* ---------- 登录浮层（会话过期或未登录时盖住整个后台） ---------- */
#login {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #17181a;
}
/* ID 选择器的 display:flex 会压过 UA 样式的 [hidden]{display:none}，必须显式覆盖 */
#login[hidden] { display: none; }
#login form { display: flex; flex-direction: column; gap: 12px; width: 264px; }
.login-logo { height: 32px; width: auto; align-self: center; margin-bottom: 4px; }
.login-title { text-align: center; font-size: 12px; letter-spacing: .5px; color: #8a8a86; margin-bottom: 12px; }
#login input {
  font: inherit;
  color: #fff;
  background: #222326;
  border: 1px solid #3a3b3f;
  border-radius: 8px;
  padding: 9px 12px;
}
#login input:focus { outline: none; border-color: #f8b303; }
#loginErr { font-size: 12px; color: #ff7b6b; }
#loginBtn { background: #f8b303; border-color: #f8b303; color: #17181a; font-weight: 600; padding: 9px; }
#loginBtn:disabled { opacity: .45; cursor: wait; }
#logoutBtn { align-self: flex-start; background: #ffffff; color: #666666; border-color: #eeeeee; font-size: 12px; }
#logoutBtn:hover { border-color: #666666; color: #333333; }

/* ---------- 按钮旁的确认 Popover ---------- */
.ask {
  position: fixed;
  inset: auto;
  margin: 0;
  width: min(320px, calc(100vw - 16px));
  max-height: calc(100dvh - 16px);
  overflow: auto;
  padding: 14px 16px;
  background: #ffffff;
  border: 1px solid #eeeeee;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .12);
}
.ask p { font-size: 13px; line-height: 1.65; white-space: pre-line; color: #333333; }
.ask-acts { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin-top: 12px; }
.ask-yes { background: #f8b303; border-color: #f8b303; color: #000000; font-weight: 600; }

#trainingPrompt {
  display: block;
  width: 100%;
  margin-top: 8px;
  padding: 8px;
  border: 1px solid #eeeeee;
  border-radius: 8px;
  color: #333333;
  font: inherit;
  resize: vertical;
}
#openWorkBuddy:not([hidden]) {
  display: inline-flex;
  align-items: center;
  padding: 6px 14px;
  border-radius: 8px;
  text-decoration: none;
}
