:root {
  --accent: #0a84ff;
  --accent-dark: #0066d6;
  --bg: #f2f4f8;
  --card: #ffffff;
  --border: #e3e7ee;
  --text: #1d2733;
  --muted: #6b7686;
  --green: #34c759;
  --red: #ff3b30;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
}
button { font-family: inherit; }

/* 登录页 */
.login-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 20px; }
.login-card {
  width: 360px; max-width: 100%;
  background: var(--card); border-radius: 18px; padding: 36px 32px;
  box-shadow: 0 18px 50px rgba(20, 40, 80, 0.12);
  text-align: center;
}
.login-logo {
  width: 58px; height: 58px; margin: 0 auto 14px;
  border-radius: 16px; background: linear-gradient(135deg, #0a84ff, #4da3ff);
  color: #fff; font-size: 28px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.login-card h1 { font-size: 19px; margin: 0 0 6px; }
.login-sub { color: var(--muted); font-size: 13px; margin: 0 0 22px; }
.field { display: block; text-align: left; margin-bottom: 14px; }
.field span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.field input {
  width: 100%; padding: 10px 12px; font-size: 14px;
  border: 1px solid var(--border); border-radius: 10px; outline: none;
}
.field input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(10, 132, 255, 0.15); }
.error { color: var(--red); font-size: 13px; min-height: 18px; margin: 4px 0 8px; }
.login-tip { color: var(--muted); font-size: 12px; margin-top: 18px; }
.btn {
  border: 1px solid transparent; border-radius: 10px; cursor: pointer;
  font-size: 14px; padding: 9px 16px; background: var(--card); color: var(--text);
}
.btn:disabled { opacity: 0.6; cursor: not-allowed; }
.btn.primary { background: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-dark); }
.btn.ghost { border-color: var(--border); background: transparent; }
.btn.danger { color: var(--red); border-color: #ffd7d5; background: #fff5f5; }
.btn.tiny { font-size: 12px; padding: 4px 10px; border: 1px solid var(--border); border-radius: 7px; text-decoration: none; }
.btn.tiny:hover { background: #f0f3f8; }
.btn-block { width: 100%; padding: 11px; font-size: 15px; }

/* 顶栏 */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--card); padding: 10px 20px;
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 10;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 15px; }
.logo {
  width: 34px; height: 34px; border-radius: 10px;
  background: linear-gradient(135deg, #0a84ff, #4da3ff);
  color: #fff; font-weight: 700; font-size: 17px;
  display: flex; align-items: center; justify-content: center;
}
.top-right { display: flex; align-items: center; gap: 12px; }
.user { color: var(--muted); font-size: 13px; }

/* 概览 */
.overview {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px; padding: 16px 20px 4px; max-width: 1200px; margin: 0 auto;
}
.ov-card {
  background: var(--card); border: 1px solid var(--border); border-radius: 14px;
  padding: 14px 16px; display: flex; flex-direction: column; gap: 4px;
}
.ov-label { font-size: 12px; color: var(--muted); }
.ov-value { font-size: 18px; font-weight: 700; }
.ov-sub { font-size: 12px; color: var(--muted); }

/* 页签 */
.tabs {
  display: flex; gap: 6px; padding: 12px 20px 0;
  max-width: 1200px; margin: 0 auto; flex-wrap: wrap;
}
.tab {
  border: 1px solid var(--border); background: var(--card); color: var(--text);
  padding: 8px 16px; border-radius: 999px; cursor: pointer; font-size: 14px;
}
.tab.active { background: var(--accent); border-color: var(--accent); color: #fff; }

/* 分组卡片 */
.section { display: none; padding: 14px 20px 40px; max-width: 1200px; margin: 0 auto; }
.section.active { display: block; }
.section-title { font-size: 17px; margin: 6px 0 12px; }
.groups { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 14px; align-items: start; }
.group {
  background: var(--card); border: 1px solid var(--border); border-radius: 16px;
  overflow: hidden; display: flex; flex-direction: column;
}
.group-head { padding: 14px 16px 10px; border-bottom: 1px solid #eef1f6; }
.group-title { font-weight: 600; font-size: 14.5px; }
.group-desc { color: var(--muted); font-size: 12.5px; margin-top: 3px; }
.group-count { display: inline-block; margin-top: 8px; font-size: 12px; color: var(--accent); background: #eaf3ff; border-radius: 999px; padding: 2px 10px; }
.group-body { padding: 12px 16px 16px; display: flex; flex-direction: column; gap: 10px; }

/* 文件列表 */
.file-list { display: flex; flex-direction: column; gap: 6px; max-height: 300px; overflow-y: auto; }
.empty { color: var(--muted); font-size: 13px; text-align: center; padding: 14px 0; border: 1px dashed var(--border); border-radius: 10px; }
.file-row {
  display: flex; align-items: center; gap: 10px;
  border: 1px solid var(--border); border-radius: 10px; padding: 8px 10px;
  background: #fafbfd;
}
.file-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.file-meta { color: var(--muted); font-size: 12px; white-space: nowrap; }
.file-actions { display: flex; gap: 6px; }

/* 上传区 */
.upload-wrap { border-top: 1px dashed var(--border); padding-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.upload-row { display: flex; gap: 8px; align-items: center; }
.lesson-select {
  flex: 1; padding: 9px 10px; font-size: 14px;
  border: 1px solid var(--border); border-radius: 10px; background: #fff;
}
.upload-box { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.up-input { flex: 1; min-width: 180px; font-size: 13px; }
.up-note { width: 100%; color: var(--muted); font-size: 12px; }

/* 提示 */
.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%) translateY(20px);
  background: #262f3d; color: #fff; padding: 10px 18px; border-radius: 999px;
  font-size: 13px; opacity: 0; pointer-events: none; transition: all 0.25s ease; z-index: 99;
  max-width: 86vw;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.ok { background: #1d8a3c; }
.toast.err { background: #c62f26; }
@media (max-width: 640px) {
  .overview { padding: 12px 12px 0; }
  .tabs, .section { padding-left: 12px; padding-right: 12px; }
}

/* 学段 / 年级 / 册次选择器 */
.selector {
  display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap;
  background: var(--card); border: 1px solid var(--border); border-radius: 14px;
  padding: 12px 16px; margin-bottom: 14px;
}
.sel-label { font-size: 13px; font-weight: 600; color: var(--muted); margin-right: 4px; align-self: center; }
.selector label { display: flex; flex-direction: column; gap: 5px; font-size: 12px; color: var(--muted); }
.selector select {
  padding: 9px 12px; font-size: 14px; min-width: 110px;
  border: 1px solid var(--border); border-radius: 10px; background: #fff;
}
.note-card { border: 1px dashed var(--border); border-radius: 12px; margin-bottom: 14px; }

/* 题目管理 */
.add-details {
  border: 1px solid var(--border); border-radius: 12px; padding: 10px 14px;
  background: #fafbfd;
}
.add-details summary { cursor: pointer; font-weight: 600; color: var(--accent); }
.q-form { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.q-form label { display: flex; flex-direction: column; gap: 5px; font-size: 12px; color: var(--muted); }
.q-form textarea, .q-form input {
  font-size: 14px; font-family: inherit; padding: 9px 11px;
  border: 1px solid var(--border); border-radius: 10px; outline: none; width: 100%;
}
.q-form textarea:focus, .q-form input:focus { border-color: var(--accent); }
.q-sub {
  border: 1px dashed var(--border); border-radius: 10px; padding: 10px 12px;
  display: flex; flex-direction: column; gap: 8px; background: #fff;
}
.q-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.q-sub-title, .q-list-title {
  font-size: 13px; font-weight: 600; color: var(--text);
  border-top: 1px dashed var(--border); padding-top: 10px;
}
.q-sub-title { border-top: none; padding-top: 0; }
.q-list-title { margin-top: 6px; }

/* 题干图片上传 */
.img-box { display: flex; flex-direction: column; gap: 8px; }
.drop-zone {
  display: flex; align-items: center; justify-content: center; gap: 10px; flex-wrap: wrap;
  border: 1.5px dashed var(--border); border-radius: 10px;
  background: #fafbfd; padding: 12px 10px;
  font-size: 12px; color: var(--muted); text-align: center;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.drop-zone.drag { border-color: var(--accent); background: #eaf3ff; }
.img-thumbs { display: flex; flex-wrap: wrap; gap: 8px; }
.img-thumb {
  position: relative; display: inline-flex;
  width: 64px; height: 64px; border-radius: 8px; overflow: hidden;
  border: 1px solid var(--border); background: #f2f4f8;
}
.img-thumb img { width: 100%; height: 100%; object-fit: cover; }
.img-remove {
  position: absolute; top: 2px; right: 2px;
  width: 18px; height: 18px; line-height: 16px; padding: 0;
  border-radius: 50%; border: none; cursor: pointer;
  background: rgba(20, 30, 45, 0.72); color: #fff; font-size: 13px;
}
.img-remove:hover { background: var(--red); }

/* 学员管理 */
.file-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.file-sub { color: var(--muted); font-size: 12px; }
.badge { display: inline-block; border-radius: 999px; padding: 1px 8px; font-size: 11px; margin-left: 4px; vertical-align: 1px; }
.badge-ok { color: #147a34; background: #e3f7e9; }
.badge-off { color: #b3481c; background: #fff0e5; }
.switch-row { display: flex; align-items: center; gap: 8px; font-size: 13px; cursor: pointer; }
.switch-row input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--accent); cursor: pointer; }
.switch-tip { color: var(--muted); font-size: 12px; }
/* 资源 · 固定名单图槽位（引导页广告 / 客服老师微信） */
.res-preview {
  display: flex; align-items: center; justify-content: center;
  padding: 10px; border: 1px solid var(--border); border-radius: 10px;
  background: repeating-conic-gradient(#f3f5f9 0% 25%, #ffffff 0% 50%) 50% / 16px 16px;
}
.res-preview img { max-width: 220px; max-height: 300px; border-radius: 8px; display: block; }
.res-note { color: var(--muted); font-size: 12px; line-height: 1.6; }
.res-actions { display: flex; gap: 8px; }

/* 资源 · 文案脱敏与部署表 */
.text-rule-wrap {
  max-height: 560px; overflow: auto;
  border: 1px solid var(--border); border-radius: 10px;
}
.text-rule-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.text-rule-table th, .text-rule-table td {
  padding: 7px 10px; text-align: left; border-bottom: 1px solid #eef1f6; vertical-align: middle;
}
.text-rule-table thead th {
  position: sticky; top: 0; background: #f5f7fa; font-weight: 600; white-space: nowrap; z-index: 1;
}
.text-rule-table tbody tr:nth-child(even) td { background: #fafbfc; }
.text-rule-table td:nth-child(1) { width: 24%; color: var(--muted); }
.text-rule-table td:nth-child(2) { width: 20%; }
.text-rule-table td:nth-child(3) { width: 18%; }
.text-rule-table td:nth-child(4) { width: 18%; }
.text-rule-table td:nth-child(5) { width: 20%; }
.text-loc, .text-orig { word-break: break-word; }

/* 文案对照表的工具条 / 分页 / 标签 */
.text-bar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px;
}
.text-search {
  flex: 1 1 240px; min-width: 180px; padding: 7px 10px; font-size: 12.5px;
  border: 1px solid var(--border); border-radius: 8px; background: #fff;
}
.text-search:focus { border-color: var(--accent); outline: none; }
.text-filter {
  padding: 7px 8px; font-size: 12.5px; border: 1px solid var(--border);
  border-radius: 8px; background: #fff;
}
.text-bar-tip { color: var(--muted); font-size: 12px; }
.text-bar-spacer { flex: 1 1 auto; }
.text-rule-foot {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 10px;
}
.tag {
  display: inline-block; margin-left: 6px; padding: 1px 6px; border-radius: 6px;
  background: #eef2f8; color: var(--muted); font-size: 11px;
}
.tag.ok { background: #e8f5ec; color: #2c7a45; }
.text-rule-table input {
  width: 100%; padding: 5px 8px; font-size: 12.5px;
  border: 1px solid var(--border); border-radius: 7px; background: #fff;
}
.text-rule-table input:focus { border-color: var(--accent); outline: none; }
