* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: #f4f5f7;
  color: #1f2329;
  font-size: 14px;
  line-height: 1.6;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  background: #1f2329;
  color: #fff;
}
.topbar__title { font-size: 16px; font-weight: 600; }
.topbar__right { display: flex; align-items: center; gap: 12px; }
.topbar__account { color: #c9cdd4; font-size: 13px; }

.container { max-width: 860px; margin: 0 auto; padding: 20px 16px 60px; }

.panel {
  background: #fff;
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}
.panel h2 { margin: 0 0 12px; font-size: 16px; }
.panel__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.panel__head h2 { margin: 0; }

.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }

.field { display: flex; flex-direction: column; margin-bottom: 14px; }
.field label { font-weight: 500; margin-bottom: 5px; }
.field input, .field select, .field textarea {
  padding: 8px 10px;
  border: 1px solid #d6d9dd;
  border-radius: 5px;
  font-size: 14px;
  font-family: inherit;
  background: #fff;
}
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: #2b7de9; }
/* 学校是整页的起点：选一次就把七项参数全填好，所以与下面的配置项之间划一道线 */
.field--lead { margin-bottom: 18px; padding-bottom: 16px; border-bottom: 1px solid #eceef0; }
.tip { color: #8a9099; font-size: 12px; margin-top: 4px; }
.hint { color: #6b7280; font-size: 13px; margin: 0 0 14px; }

.pwd-wrap { display: flex; gap: 6px; }
.pwd-wrap input { flex: 1; }
.pwd-toggle {
  border: 1px solid #d6d9dd;
  background: #fff;
  border-radius: 5px;
  padding: 0 10px;
  cursor: pointer;
  color: #4b5563;
  font-size: 13px;
}

.btn {
  padding: 8px 16px;
  border: 1px solid #d6d9dd;
  background: #fff;
  border-radius: 5px;
  cursor: pointer;
  font-size: 14px;
  font-family: inherit;
  color: #1f2329;
}
.btn:hover:not(:disabled) { border-color: #2b7de9; color: #2b7de9; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn--primary { background: #2b7de9; border-color: #2b7de9; color: #fff; }
.btn--primary:hover:not(:disabled) { background: #1f6ed4; color: #fff; }
.btn--ghost { background: transparent; border-color: transparent; color: #6b7280; }
.btn--ghost:hover:not(:disabled) { color: #2b7de9; }
.btn--sm { padding: 4px 10px; font-size: 13px; }

.actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 8px; }

.linklike {
  background: none;
  border: none;
  padding: 0;
  color: #2b7de9;
  cursor: pointer;
  font-size: inherit;
  text-decoration: underline;
}

.msg { margin-top: 10px; font-size: 13px; min-height: 20px; color: #6b7280; white-space: pre-line; }
.msg--ok { color: #17803d; }
.msg--error { color: #c0392b; }

/* 抢座结果的成功/失败文字标色，颜色跟 .msg--ok/.msg--error 保持一致 */
.run-status--success { color: #17803d; font-weight: 500; }
.run-status--failed { color: #c0392b; font-weight: 500; }

.run-log { margin: 4px 0 10px; padding: 8px 10px; background: #fff; border: 1px solid #e2e5e9; border-radius: 5px; }
.run-log__timing { color: #4b5563; font-size: 12px; margin-bottom: 6px; }
.run-log__text {
  max-height: 320px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-all;
  font-size: 12px;
  color: #1f2937;
  background: #f6f7f8;
  padding: 8px;
  border-radius: 4px;
  margin: 0;
}

.slot-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 8px; }
.slot { display: flex; align-items: center; gap: 8px; }
.slot input { padding: 6px 8px; border: 1px solid #d6d9dd; border-radius: 5px; font-family: inherit; }
.slot select { width: auto; padding: 6px 8px; border: 1px solid #d6d9dd; border-radius: 5px; font-family: inherit; }
.tip--warn { color: #b45309; background: #fffbeb; border: 1px solid #fde68a; border-radius: 5px; padding: 6px 10px; }

.advanced {
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  padding: 10px 14px;
  margin-bottom: 14px;
  background: #fafbfc;
}
.advanced summary { cursor: pointer; font-weight: 500; color: #4b5563; }
.advanced[open] summary { margin-bottom: 12px; }

.history { display: flex; flex-direction: column; gap: 8px; }
.history__empty { color: #8a9099; padding: 12px 0; }
.history__item {
  border-left: 3px solid #d6d9dd;
  padding: 8px 12px;
  background: #fafbfc;
  border-radius: 0 5px 5px 0;
}
.history__item--success { border-left-color: #17803d; }
.history__item--failed { border-left-color: #c0392b; }
.history__row { display: flex; align-items: baseline; gap: 10px; }
.history__meta { color: #6b7280; font-size: 13px; }
.history__reason { color: #c0392b; font-size: 13px; }
/* 管理页用户行（用户列表、即将到期）：文字用深灰，只有 .run-status--* 的状态词带颜色 */
.userrow__line { color: #374151; font-size: 13px; }
/* 备注有内容时标红，提醒管理员这个账号有特别说明 */
.userrow__line.userrow__note--has { color: #c0392b; }
/* 试用标记用琥珀色，别和「失败」的红色混淆；付费标记沿用 .run-status--success 的绿 */
.member-badge--trial { color: #b45309; font-weight: 500; }
.history__time { color: #9ca3af; font-size: 12px; }

.tabnav {
  display: flex;
  gap: 4px;
  margin-bottom: 16px;
  border-bottom: 1px solid #e5e7eb;
  overflow-x: auto;
}
.tabnav__btn {
  padding: 10px 16px;
  border: none;
  background: none;
  cursor: pointer;
  font-size: 14px;
  font-family: inherit;
  color: #6b7280;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
}
.tabnav__btn:hover { color: #2b7de9; }
.tabnav__btn.active { color: #2b7de9; border-bottom-color: #2b7de9; font-weight: 500; }

@media (max-width: 600px) {
  .container { padding: 12px 10px 40px; }
  .panel { padding: 16px 14px; }
  .grid { grid-template-columns: 1fr; }
}

/* 诊断信息：把上游返回的原始片段原样显示出来，方便定位问题 */
.diag {
  margin-top: 8px;
  padding: 8px 10px;
  background: #fdf2f2;
  border: 1px solid #f5c6c6;
  border-radius: 5px;
  font-size: 12px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-all;
  max-height: 220px;
  overflow: auto;
  color: #7f1d1d;
}

.site-footer {
  text-align: center;
  padding: 16px 10px 24px;
  color: #9ca3af;
  font-size: 12px;
}
.site-footer a { color: #9ca3af; text-decoration: none; }
.site-footer a:hover { color: #2b7de9; text-decoration: underline; }
.site-footer__sep { margin: 0 8px; }
.site-footer__gongan { display: inline-flex; align-items: center; gap: 4px; vertical-align: middle; }
.site-footer__gongan img { width: 14px; height: 14px; }
/* ---- 日常区：节奏步进 / 自动抢状态条 / 手动操作 / 底部保存栏 ---- */
.advanced h3 { margin: 16px 0 8px; font-size: 14px; color: #374151; }
.advanced h3:first-of-type { margin-top: 4px; }
.tuning { border: 1px solid #e5e7eb; border-radius: 6px; padding: 12px 14px 2px; margin-bottom: 14px; }
.tuning__title { font-weight: 500; }
.tuning__summary { margin-bottom: 12px; padding: 8px 10px; border-radius: 5px; background: #eef4fd; color: #1f4f99; font-size: 13px; }
.stepper { display: flex; align-items: stretch; gap: 8px; }
.stepper input { flex: 1; min-width: 0; text-align: center; font-size: 16px; font-weight: 600; background: #f6f7f9; }
.stepper input.is-changed { background: #fff7e0; border-color: #e0a800; }
.stepper__btn {
  width: 48px; font-size: 22px; line-height: 1;
  border: 1px solid #d6d9dd; border-radius: 5px; background: #fff; color: #374151; cursor: pointer;
}
.stepper__btn:active { background: #eef2f7; }
.enabled-bar { margin-top: 6px; padding: 6px 10px; border-radius: 5px; font-size: 13px; }
.enabled-bar--on { background: #e7f6ec; color: #17803d; }
.enabled-bar--off { background: #eceef0; color: #6b7280; }
.manual { margin-top: 6px; padding-top: 14px; border-top: 1px dashed #d6d9dd; }
.manual__title { font-weight: 500; margin-bottom: 8px; color: #4b5563; }
.savebar {
  position: sticky; bottom: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin: 12px -14px -16px; padding: 10px 14px;
  background: #fff; border-top: 1px solid #e5e7eb;
}
.savebar__state { font-size: 13px; color: #6b7280; }
.savebar__state--dirty { color: #c26a00; font-weight: 600; }
.savebar__state--saved { color: #17803d; }
.slot .slot-del { margin-left: auto; padding: 6px 14px; }

/* ---- 抢座记录页 ---- */
a.btn { text-decoration: none; }
.history__summary { color: #4b5563; margin-bottom: 10px; }
.history__note { color: #17803d; font-size: 13px; }
.history__detail { margin-top: 4px; font-size: 12px; color: #6b7280; }
.history__detail summary { cursor: pointer; }
.history__spans { margin-top: 4px; word-break: break-all; }

/* ---- 会员区：默认折叠成一行到期时间 ---- */
.member__head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.member__head .btn { flex-shrink: 0; white-space: nowrap; }
.member__status { margin: 0; color: #4b5563; }
.member__status--warn { color: #c0392b; font-weight: 600; }
.member__body { margin-top: 12px; }

/* ---- 房间/区域点选列表 ---- */
.roompick { margin-top: 8px; max-height: 220px; overflow-y: auto; padding: 8px 10px; border: 1px solid #e5e7eb; border-radius: 8px; }
.roompick__title { font-size: 12px; font-weight: 600; color: #6b7280; margin: 6px 0 2px; }
.roompick__item { display: flex; align-items: center; gap: 6px; padding: 3px 0; font-size: 14px; cursor: pointer; }
.roompick__item input { width: auto; margin: 0; }

/* ---- 房间备选导入预览 ---- */
.roomimport { margin-top: 8px; padding: 10px 12px; border: 1px solid #e5e7eb; border-radius: 8px; font-size: 13px; }
.roomimport--block { border-color: #c0392b; background: #fdf1f0; }
.roomimport--warn { border-color: #c26a00; background: #fff8ec; }
.roomimport--ok { border-color: #17803d; background: #f1faf4; }
.roomimport ul { margin: 6px 0; padding-left: 18px; }
.roomimport .btn { margin-right: 8px; }

/* 即将到期：跟进状态按钮组、已处理折叠块、「新」标记 */
.followup { margin-top: 6px; font-size: 13px; color: #374151; }
.followup__btn--on { background: #e5e7eb; font-weight: 500; }
.expiry-done { margin-top: 10px; }
.expiry-done > summary { cursor: pointer; color: #374151; font-size: 14px; padding: 6px 0; }
.expiry-item--done { background: #f3f4f6; }
.expiry-item--done .userrow__line:not(.userrow__note--has), .expiry-item--done .history__meta { color: #9ca3af; }
.new-tag { color: #b45309; border: 1px solid #b45309; border-radius: 3px; font-size: 11px; padding: 0 4px; margin-left: 4px; }

.paste-box { margin-bottom: 18px; }
.paste-box textarea { width: 100%; box-sizing: border-box; }
.field--filled input, .field--filled select { background: #fffbe6; border-color: #e6c200; }
.comp-panel > summary { cursor: pointer; padding: 2px 0; }
.comp-panel > summary h2 { display: inline; }
.comp-panel[open] > summary { margin-bottom: 12px; }
