/* ============================================================
   英语课文视频 · 管理后台样式
   ============================================================ */

:root {
  --primary: #4A7CF7;
  --primary-deep: #3567E0;
  --primary-soft: #EDF2FF;

  --junior: #7C5CF0;
  --accent: #FF8A3D;
  --green: #22A06B;
  --red: #E5484D;
  --red-soft: #FEF1F1;

  --bg: #F4F6FB;
  --card: #FFFFFF;
  --border: #E6EAF2;
  --border-strong: #D6DCE8;

  --text: #1F2430;
  --text-2: #5A6475;
  --text-3: #97A0B0;

  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 3px rgba(31, 36, 48, .06), 0 1px 2px rgba(31, 36, 48, .04);
  --shadow-lg: 0 12px 32px rgba(31, 36, 48, .14);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei',
               'Helvetica Neue', Helvetica, sans-serif;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font-family: inherit; font-size: inherit; }
button { cursor: pointer; border: none; background: none; }
code {
  font-family: ui-monospace, Menlo, Consolas, 'Courier New', monospace;
  font-size: 12.5px;
  background: var(--bg);
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--primary-deep);
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
[hidden] { display: none !important; }

/* ============================================================
   登录
   ============================================================ */

.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: linear-gradient(150deg, #4A7CF7 0%, #6C9BFF 45%, #7C5CF0 100%);
  position: relative;
  overflow: hidden;
}

.login-wrap::before,
.login-wrap::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, .1);
}
.login-wrap::before { width: 520px; height: 520px; right: -140px; top: -190px; }
.login-wrap::after { width: 340px; height: 340px; left: -120px; bottom: -140px; background: rgba(255,255,255,.07); }

.login-card {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 400px;
  background: #fff;
  border-radius: 20px;
  padding: 40px 36px 32px;
  box-shadow: 0 24px 60px rgba(20, 30, 60, .28);
}

.login-brand { text-align: center; margin-bottom: 32px; }
.login-logo {
  width: 56px; height: 56px; margin: 0 auto 16px;
  border-radius: 16px;
  background: linear-gradient(140deg, #4A7CF7, #7C5CF0);
  color: #fff; font-size: 28px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 8px 20px rgba(74, 124, 247, .32);
}
.login-brand h1 { font-size: 21px; font-weight: 700; }
.login-brand p { margin-top: 6px; font-size: 13px; color: var(--text-3); }

.field { display: block; margin-bottom: 18px; }
.field > span {
  display: block; margin-bottom: 8px;
  font-size: 13px; font-weight: 500; color: var(--text-2);
}
.field input,
.field select,
.field textarea {
  width: 100%; height: 44px; padding: 0 14px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: #fff; color: var(--text); outline: none;
  transition: border-color .16s, box-shadow .16s;
}
.field textarea { height: auto; min-height: 96px; padding: 12px 14px; resize: vertical; line-height: 1.6; }
.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(74, 124, 247, .14);
}
.field input::placeholder, .field textarea::placeholder { color: #B4BCC9; }

.login-error {
  margin-bottom: 16px; padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: var(--red-soft); color: var(--red);
  font-size: 13px; border: 1px solid #FAD4D4;
}

.btn-block { width: 100%; height: 46px; font-size: 15px; }

.login-hint {
  margin-top: 22px; padding-top: 18px;
  border-top: 1px solid var(--border);
  font-size: 12px; line-height: 1.8; color: var(--text-3); text-align: center;
}

/* ============================================================
   按钮
   ============================================================ */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 36px; padding: 0 15px;
  border-radius: var(--radius-sm);
  background: #fff; color: var(--text-2);
  border: 1px solid var(--border-strong);
  font-size: 13.5px; font-weight: 500;
  white-space: nowrap;
  transition: background .14s, border-color .14s, color .14s, box-shadow .14s;
}
.btn:hover { background: #F8FAFD; border-color: #C3CCDC; color: var(--text); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }

.btn-primary {
  background: var(--primary); border-color: var(--primary); color: #fff;
  box-shadow: 0 1px 2px rgba(74, 124, 247, .3);
}
.btn-primary:hover { background: var(--primary-deep); border-color: var(--primary-deep); color: #fff; }
.btn-primary.is-dirty { box-shadow: 0 0 0 3px rgba(74,124,247,.18), 0 1px 2px rgba(74,124,247,.3); }

.btn-danger { color: var(--red); border-color: #F3C6C6; background: #fff; }
.btn-danger:hover { background: var(--red-soft); border-color: #E9AFAF; color: var(--red); }

.btn-ghost { border-color: transparent; background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: #EEF1F7; border-color: transparent; }

.btn-sm { height: 30px; padding: 0 11px; font-size: 12.5px; border-radius: 7px; }
.btn-xs { height: 26px; padding: 0 9px; font-size: 12px; border-radius: 6px; }
.btn-icon { width: 32px; padding: 0; }

/* ============================================================
   主布局
   ============================================================ */

.layout { display: flex; height: 100vh; overflow: hidden; }

/* ---------- 侧边栏 ---------- */
.sidebar {
  width: 246px; flex-shrink: 0;
  background: #fff;
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
}

.brand {
  display: flex; align-items: center; gap: 11px;
  padding: 20px 18px 18px;
}
.brand-logo {
  width: 38px; height: 38px; flex-shrink: 0;
  border-radius: 11px;
  background: linear-gradient(140deg, #4A7CF7, #7C5CF0);
  color: #fff; font-size: 19px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.brand-text b { display: block; font-size: 14.5px; font-weight: 600; }
.brand-text span { display: block; margin-top: 2px; font-size: 11.5px; color: var(--text-3); }

.nav { flex: 1; padding: 6px 10px; overflow-y: auto; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  width: 100%; padding: 10px 12px; margin-bottom: 3px;
  border-radius: var(--radius-sm);
  color: var(--text-2); font-size: 14px; font-weight: 500;
  text-align: left;
  transition: background .14s, color .14s;
}
.nav-item:hover { background: #F3F6FC; color: var(--text); }
.nav-item.active { background: var(--primary-soft); color: var(--primary-deep); font-weight: 600; }
.nav-icon { width: 18px; text-align: center; font-size: 14px; opacity: .85; }
.nav-badge {
  margin-left: auto; padding: 1px 7px;
  border-radius: 999px; background: #EEF1F7; color: var(--text-3);
  font-size: 11px; font-weight: 600;
}
.nav-badge.warn { background: #FFF1E6; color: #C4621F; }
.nav-badge.done { background: #E8F6EF; color: var(--green); }

.sidebar-foot {
  padding: 14px 18px 18px;
  border-top: 1px solid var(--border);
  font-size: 11.5px; color: var(--text-3);
}
.stat-line { margin-bottom: 10px; line-height: 1.8; }
.stat-line b { color: var(--text-2); font-weight: 600; }
.foot-link { display: block; line-height: 2; color: var(--text-3); font-size: 11.5px; }
.foot-link:hover { color: var(--primary); text-decoration: none; }

/* ---------- 主区 ---------- */
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }

.topbar {
  height: 60px; flex-shrink: 0;
  display: flex; align-items: center; gap: 16px;
  padding: 0 22px;
  background: #fff;
  border-bottom: 1px solid var(--border);
}
.topbar-left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.topbar-left h2 { font-size: 17px; font-weight: 600; white-space: nowrap; }

.dirty-dot {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; color: #C4621F;
}
.dirty-dot::before {
  content: ''; width: 7px; height: 7px; border-radius: 50%;
  background: var(--accent);
}

.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 9px; }

/* 用户 */
.user-box {
  position: relative;
  display: flex; align-items: center; gap: 9px;
  padding: 5px 10px 5px 6px;
  border-radius: 999px; cursor: pointer;
  transition: background .14s;
}
.user-box:hover { background: #F3F6FC; }
.avatar {
  width: 30px; height: 30px; border-radius: 50%; flex-shrink: 0;
  background: linear-gradient(140deg, #4A7CF7, #7C5CF0);
  color: #fff; font-size: 13px; font-weight: 600;
  display: flex; align-items: center; justify-content: center;
  text-transform: uppercase;
}
.user-meta b { display: block; font-size: 13px; font-weight: 600; line-height: 1.2; }
.user-meta span { display: block; font-size: 11px; color: var(--text-3); }

.user-menu {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 40;
  min-width: 148px; padding: 5px;
  background: #fff; border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-lg);
}
.user-menu button {
  display: block; width: 100%; padding: 9px 12px;
  border-radius: 7px; text-align: left; font-size: 13.5px; color: var(--text-2);
}
.user-menu button:hover { background: #F3F6FC; color: var(--text); }

.content { flex: 1; overflow-y: auto; padding: 22px; }

/* ============================================================
   通用卡片 / 表格
   ============================================================ */

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card + .card { margin-top: 18px; }

.card-head {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
}
.card-head h3 { font-size: 15px; font-weight: 600; }
.card-head .card-sub { font-size: 12.5px; color: var(--text-3); }
.card-head .spacer { margin-left: auto; }
.card-body { padding: 18px; }
.card-body.tight { padding: 0; }

.page-head { margin-bottom: 18px; }
.page-head h3 { font-size: 17px; font-weight: 600; }
.page-head p { margin-top: 6px; font-size: 13px; color: var(--text-3); line-height: 1.7; }

/* 表格 */
.table { width: 100%; border-collapse: collapse; }
.table th {
  padding: 11px 14px; text-align: left;
  font-size: 12.5px; font-weight: 600; color: var(--text-3);
  background: #FAFBFD;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.table td {
  padding: 11px 14px;
  border-bottom: 1px solid #F2F4F9;
  vertical-align: middle;
}
.table tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: #FAFBFD; }
.table .num { font-variant-numeric: tabular-nums; color: var(--text-2); }
.table .mono { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12.5px; }

/* 标签 */
.tag {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 9px; border-radius: 999px;
  font-size: 11.5px; font-weight: 600;
  background: #EEF1F7; color: var(--text-2);
}
.tag.ok { background: #E8F6EF; color: var(--green); }
.tag.miss { background: #F2F4F9; color: var(--text-3); }
.tag.warn { background: #FFF1E6; color: #C4621F; }
.tag.primary { background: var(--primary-soft); color: var(--primary-deep); }

/* 空状态 */
.empty {
  padding: 60px 20px; text-align: center;
  color: var(--text-3); font-size: 13.5px;
}
.empty-icon { font-size: 30px; opacity: .35; margin-bottom: 12px; }

/* ============================================================
   教材管理
   ============================================================ */

.courses-view { display: flex; gap: 18px; align-items: flex-start; }

.col-books { width: 262px; flex-shrink: 0; }
.col-detail { flex: 1; min-width: 0; }

.book-group-title {
  padding: 14px 16px 8px;
  font-size: 11.5px; font-weight: 700; color: var(--text-3);
  letter-spacing: .6px; text-transform: uppercase;
}

.book-item {
  position: relative;
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; margin: 2px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background .14s;
  user-select: none;
}
.book-item:hover { background: #F3F6FC; }
.book-item.active { background: var(--primary-soft); }
.book-item.dragging { opacity: .4; }
.book-item.drop-before { box-shadow: inset 0 2px 0 var(--primary); }
.book-item.drop-after { box-shadow: inset 0 -2px 0 var(--primary); }

.book-swatch {
  width: 30px; height: 30px; border-radius: 8px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 13px; font-weight: 700;
}
.book-item-text { flex: 1; min-width: 0; }
.book-item-text b {
  display: block; font-size: 13.5px; font-weight: 500;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.book-item.active .book-item-text b { font-weight: 600; color: var(--primary-deep); }
.book-item-text span { display: block; font-size: 11px; color: var(--text-3); margin-top: 1px; }
.book-handle { color: #C9D0DC; font-size: 13px; cursor: grab; letter-spacing: -2px; }

/* 册别属性区 */
.book-form {
  display: grid; gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}
.book-form .field { margin-bottom: 0; }
.book-form .field input, .book-form .field select { height: 38px; }
.book-form .span-2 { grid-column: span 2; }
.book-form .span-all { grid-column: 1 / -1; }

.color-row { display: flex; align-items: center; gap: 10px; }
.color-row input[type=color] {
  width: 42px; height: 38px; padding: 2px;
  border: 1px solid var(--border-strong); border-radius: 7px;
  background: #fff; cursor: pointer;
}
.color-preview {
  flex: 1; height: 38px; border-radius: 7px;
  display: flex; align-items: center; padding: 0 14px;
  color: #fff; font-size: 12.5px; font-weight: 600;
}

/* 单元 / 章节表 */
.unit-head,
.unit-row,
.chapter-row {
  display: grid;
  grid-template-columns: 28px 46px 130px 1fr 1fr 138px 38px;
  gap: 8px; align-items: center;
}

.unit-head {
  padding: 9px 14px;
  background: #FAFBFD;
  border-bottom: 1px solid var(--border);
  font-size: 12px; font-weight: 600; color: var(--text-3);
}

.unit-block { position: relative; }
.unit-block.dragging { opacity: .45; background: #F3F6FC; }
.unit-block.drop-before { box-shadow: inset 0 2px 0 var(--primary); }
.unit-block.drop-after { box-shadow: inset 0 -2px 0 var(--primary); }

.unit-row {
  padding: 7px 14px;
  border-bottom: 1px solid #F2F4F9;
  transition: background .12s;
}
.unit-row:hover { background: #FAFBFD; }

.unit-handle {
  color: #C9D0DC; cursor: grab; text-align: center;
  font-size: 13px; letter-spacing: -2px; user-select: none;
}
.unit-handle:active { cursor: grabbing; }
.unit-index {
  font-size: 12px; font-weight: 600; color: var(--text-3);
  font-variant-numeric: tabular-nums;
}

.unit-row input,
.chapter-row input {
  width: 100%; height: 32px; padding: 0 9px;
  border: 1px solid transparent; border-radius: 6px;
  background: transparent; color: var(--text); outline: none;
  transition: border-color .14s, background .14s;
}
.unit-row input:hover,
.chapter-row input:hover { background: #F6F8FC; }
.unit-row input:focus,
.chapter-row input:focus { background: #fff; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(74,124,247,.12); }
.unit-row input.no-field,
.chapter-row input.no-field { font-size: 12.5px; color: var(--text-2); font-weight: 500; }
.unit-row input.title-field,
.chapter-row input.title-field { font-weight: 500; }
.unit-row input.cn-field,
.chapter-row input.cn-field { color: var(--text-2); }

/* 视频槽位（文件名 + 就位状态点） */
.slot-cell {
  display: flex; align-items: center; gap: 6px;
  min-width: 0; font-size: 11.5px; color: var(--text-3);
}
.slot-cell code {
  font-family: ui-monospace, monospace; font-size: 11.5px;
  color: #5A6475; background: #F4F6FB;
  padding: 2px 6px; border-radius: 5px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.slot-cell .slot-more { white-space: nowrap; color: #A8B0BF; }
.slot-cell .dot {
  flex-shrink: 0; width: 7px; height: 7px; border-radius: 50%;
  background: #D9822B;
}
.slot-cell .dot.ok { background: #22A06B; }

/* ---- 章节列表 ---- */
.chapter-list {
  position: relative;
  padding: 2px 0 6px;
  background: #FBFCFE;
  border-bottom: 1px solid #F2F4F9;
}
.chapter-list::before {
  content: '';
  position: absolute;
  left: 27px; top: 2px; bottom: 12px;
  width: 1px; background: #E4E9F2;
}

.chapter-row {
  position: relative;
  padding: 5px 14px;
  transition: background .12s;
}
.chapter-row:hover { background: #F6F8FD; }
.chapter-row.dragging { opacity: .4; }
.chapter-row.drop-before { box-shadow: inset 0 2px 0 var(--primary); }
.chapter-row.drop-after { box-shadow: inset 0 -2px 0 var(--primary); }
.chapter-row.missing .slot-cell code { color: #C4621F; background: #FFF3E9; }

.chapter-handle {
  color: #D5DBE5; cursor: grab; text-align: center;
  font-size: 12px; letter-spacing: -2px; user-select: none;
}
.chapter-handle:active { cursor: grabbing; }
.chapter-index {
  font-size: 11.5px; font-weight: 600; color: #A8B0BF;
  font-variant-numeric: tabular-nums;
}

.chapter-add {
  margin: 3px 14px 5px 60px;
  padding: 6px 12px;
  border: 1px dashed #D8E0EE; border-radius: 8px;
  font-size: 12px; color: var(--primary);
  text-align: center; cursor: pointer;
  transition: background .12s, border-color .12s;
}
.chapter-add:hover { background: #F2F6FF; border-color: #B9CCF5; }

.chapter-empty {
  margin: 2px 14px 3px 60px;
  font-size: 12px; color: var(--text-3);
}
.chapter-empty code {
  font-family: ui-monospace, monospace;
  color: #5A6475; background: #F4F6FB;
  padding: 1px 6px; border-radius: 5px;
}

/* ---- 视频管理页：单元分组行 ---- */
tr.unit-group td {
  background: #FAFBFD;
  padding: 8px 14px;
  border-top: 1px solid #EEF2F8;
  font-size: 12.5px;
  color: var(--text-2);
}
tr.unit-group b { color: var(--text); font-size: 13px; }
tr.unit-group .ug-title { margin-left: 8px; color: var(--text-3); }
.tag.mini {
  margin-left: 8px; padding: 1px 7px;
  font-size: 11px; border-radius: 999px;
}
.tag.mini.plain { background: #EEF2F8; color: var(--text-3); }

.row-del {
  width: 28px; height: 28px; border-radius: 6px;
  color: #C9D0DC; font-size: 15px; line-height: 1;
  display: flex; align-items: center; justify-content: center;
}
.row-del:hover { background: var(--red-soft); color: var(--red); }

/* 表尾 */
.card-foot {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 18px;
  border-top: 1px solid var(--border);
  background: #FAFBFD;
  font-size: 12.5px; color: var(--text-3);
}
.card-foot .spacer { margin-left: auto; }

/* ============================================================
   视频管理
   ============================================================ */

.stat-cards {
  display: grid; gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  margin-bottom: 18px;
}
.stat-card {
  background: #fff; border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px 18px;
  box-shadow: var(--shadow);
}
.stat-card .label { font-size: 12.5px; color: var(--text-3); }
.stat-card .value {
  margin-top: 6px; font-size: 25px; font-weight: 700;
  font-variant-numeric: tabular-nums; line-height: 1.1;
}
.stat-card .value small { font-size: 13px; font-weight: 500; color: var(--text-3); margin-left: 3px; }
.stat-card .sub { margin-top: 8px; font-size: 11.5px; color: var(--text-3); }

.progress {
  height: 6px; border-radius: 999px; background: #EEF1F7;
  overflow: hidden; margin-top: 10px;
}
.progress i { display: block; height: 100%; border-radius: 999px; background: var(--green); transition: width .3s; }

.up-bar {
  width: 100%; height: 4px; border-radius: 2px;
  background: #EEF1F7; overflow: hidden; margin-top: 4px;
}
.up-bar i { display: block; height: 100%; width: 0; background: var(--primary); transition: width .15s; }

.upload-zone {
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 18px; text-align: center;
  color: var(--text-3); font-size: 13px;
  transition: border-color .16s, background .16s;
  cursor: pointer;
}
.upload-zone:hover, .upload-zone.over {
  border-color: var(--primary); background: var(--primary-soft);
  color: var(--primary-deep);
}

/* ============================================================
   导入导出
   ============================================================ */

.grid-2 { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }

.backup-item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 0; border-bottom: 1px solid #F2F4F9;
}
.backup-item:last-child { border-bottom: none; }
.backup-item .info { flex: 1; min-width: 0; }
.backup-item .info b { display: block; font-size: 13px; font-weight: 500; font-family: ui-monospace, monospace; }
.backup-item .info span { display: block; font-size: 11.5px; color: var(--text-3); margin-top: 2px; }

/* ============================================================
   弹层 / 提示
   ============================================================ */

.modal-mask {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(20, 26, 40, .42);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  animation: fade .16s ease;
}
@keyframes fade { from { opacity: 0 } to { opacity: 1 } }

.modal {
  width: 100%; max-width: 460px;
  max-height: 86vh; overflow-y: auto;
  background: #fff; border-radius: 16px;
  box-shadow: var(--shadow-lg);
  animation: pop .18s cubic-bezier(.3, 1.2, .5, 1);
}
@keyframes pop { from { opacity: 0; transform: scale(.96) translateY(6px) } to { opacity: 1; transform: none } }

.modal-head {
  padding: 20px 22px 0;
}
.modal-head h3 { font-size: 16.5px; font-weight: 600; }
.modal-head p { margin-top: 7px; font-size: 13px; color: var(--text-3); line-height: 1.65; }
.modal-body { padding: 18px 22px; }
.modal-body .field:last-child { margin-bottom: 0; }
.modal-foot {
  display: flex; justify-content: flex-end; gap: 10px;
  padding: 16px 22px 20px;
}

/* Toast */
.toast-wrap {
  position: fixed; top: 22px; left: 50%; transform: translateX(-50%);
  z-index: 200; display: flex; flex-direction: column; gap: 9px;
  pointer-events: none;
}
.toast {
  padding: 10px 18px; border-radius: 999px;
  background: #1F2430; color: #fff;
  font-size: 13.5px; box-shadow: var(--shadow-lg);
  animation: toastIn .2s cubic-bezier(.3, 1.2, .5, 1);
  max-width: 70vw;
}
.toast.ok { background: #17794F; }
.toast.err { background: #B3282C; }
.toast.warn { background: #A85A17; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-10px) } to { opacity: 1; transform: none } }

/* 滚动条 */
.content::-webkit-scrollbar, .nav::-webkit-scrollbar,
.modal::-webkit-scrollbar, .file-list::-webkit-scrollbar { width: 9px; height: 9px; }
.content::-webkit-scrollbar-thumb, .nav::-webkit-scrollbar-thumb,
.modal::-webkit-scrollbar-thumb, .file-list::-webkit-scrollbar-thumb {
  background: #D5DCE8; border-radius: 999px; border: 2px solid transparent; background-clip: content-box;
}
.content::-webkit-scrollbar-thumb:hover { background: #BFC8D8; background-clip: content-box; }

/* 只读态（viewer 角色）：隐藏编辑类按钮，内容区输入框不可交互 */
.role-viewer .editable-only { display: none !important; }
.role-viewer .content input,
.role-viewer .content .row-del,
.role-viewer .content .unit-handle,
.role-viewer .content .chapter-handle,
.role-viewer .content .chapter-add,
.role-viewer .content .upload-zone { pointer-events: none; }
.role-viewer .content input[type=color] { pointer-events: none; }

/* 文件列表 */
.file-list { max-height: 340px; overflow-y: auto; }
.file-item {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 12px; border-bottom: 1px solid #F2F4F9;
  font-size: 13px;
}
.file-item:last-child { border-bottom: none; }
.file-item .fname { flex: 1; min-width: 0; font-family: ui-monospace, monospace; font-size: 12.5px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-item .fsize { color: var(--text-3); font-size: 12px; font-variant-numeric: tabular-nums; }

.rename-arrow { color: var(--primary); }

/* ---------------- 学习统计：14 天柱状图 ---------------- */
.daybars {
  display: flex; align-items: flex-end; gap: 6px;
  height: 96px; padding: 6px 10px 0;
  background: #FAFBFE; border: 1px solid #EEF1F7; border-radius: 10px;
}
.daybar {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: flex-end; height: 100%;
}
.daybar-fill {
  width: 100%; max-width: 26px; border-radius: 4px 4px 2px 2px;
  background: #C9D8F8; transition: height .25s ease;
}
.daybar-label {
  margin-top: 5px; font-size: 10px; color: var(--text-3);
  font-variant-numeric: tabular-nums;
}

/* ============================================================
   拼音资源页
   ============================================================ */

.muted { color: var(--text-3); font-size: 12.5px; }
.stat-card .hint { margin-top: 6px; font-size: 11.5px; color: var(--text-3); line-height: 1.5; }

.py-filter {
  display: flex; align-items: center; gap: 8px;
  margin: 14px 0 12px;
}

.py-lesson { margin-bottom: 12px; }

.py-lesson-head {
  display: flex; align-items: center; gap: 10px;
  cursor: pointer; user-select: none;
}
.py-lesson-head:hover { background: #FAFBFE; }

.py-caret { color: var(--text-3); font-size: 12px; width: 12px; }

.py-lesson-title {
  color: var(--text-2); font-size: 13px;
}

.py-lesson-stat {
  margin-left: auto;
  font-size: 12px; font-weight: 600; color: var(--green);
  background: #E8F6EF; padding: 2px 9px; border-radius: 999px;
}
.py-lesson-stat.bad { color: #C4621F; background: #FFF1E6; }

.py-sec-t {
  font-size: 12px; font-weight: 600; color: var(--text-3);
  letter-spacing: .04em; margin: 14px 0 8px;
}
.py-sec-t:first-child { margin-top: 0; }

/* ---------- 图片网格 ---------- */

.py-imgs {
  display: grid; gap: 12px;
  grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
}

.py-img { position: relative; }

.py-img-box {
  width: 100%; aspect-ratio: 1 / 1;
  border-radius: 10px; overflow: hidden;
  background: #F5F7FB; border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
}
.py-img-box img {
  width: 100%; height: 100%; object-fit: cover;
  cursor: zoom-in; transition: transform .18s ease;
}
.py-img-box img:hover { transform: scale(1.04); }

.py-img-meta {
  display: flex; align-items: baseline; gap: 6px;
  margin-top: 6px; font-size: 12px;
}
.py-img-meta b { color: var(--text); font-size: 12.5px; }
.py-img-meta span { color: var(--text-3); }

.py-img-share {
  position: absolute; top: 6px; left: 6px;
  font-size: 10.5px; padding: 1px 6px; border-radius: 999px;
  background: rgba(74, 124, 247, .12); color: var(--primary-deep);
  font-weight: 600;
}

.py-img-ops {
  display: flex; gap: 6px; margin-top: 6px;
}
.py-img-ops .btn { flex: 1; }

/* ---------- 音频表 ---------- */

.py-audio td { padding: 7px 10px; font-size: 13px; }
.py-audio code { font-size: 12px; color: var(--text-2); }
.py-ops { white-space: nowrap; }
.py-ops .btn { margin-right: 4px; }

/* ---------- 学习统计页 · Tab 与拼音面板 ---------- */

.py-tabs { display: flex; gap: 8px; margin-bottom: 16px; }

.py-cover { font-weight: 700; font-size: 13px; }
.py-cover small { color: var(--text-3); font-weight: 500; }

.py-line-row {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 6px; font-size: 12.5px;
}
.py-line-label { width: 52px; color: var(--text-2); font-weight: 600; flex-shrink: 0; }

/* ---------- 录音替换弹层 ---------- */

.rec-what { font-size: 14px; color: var(--text); font-weight: 600; }
.rec-what .muted { font-weight: 400; color: var(--text-3); }

.rec-body { padding: 4px 0 2px; }

.rec-bar {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px; margin-bottom: 10px;
  background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm);
}

.rec-dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--border-strong); flex-shrink: 0;
  transition: background .2s;
}
.rec-dot.on { background: var(--red); animation: rec-pulse 1s ease-in-out infinite; }

@keyframes rec-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: .35; transform: scale(.8); }
}

.rec-level {
  flex: 1; height: 8px; border-radius: 999px;
  background: #E9EDF6; overflow: hidden;
}
.rec-level i {
  display: block; height: 100%; width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  transition: width .08s linear;
}

.rec-time {
  font-variant-numeric: tabular-nums;
  font-size: 12.5px; color: var(--text-2); flex-shrink: 0; min-width: 92px; text-align: right;
}

.rec-tip { font-size: 12.5px; color: var(--text-3); line-height: 1.7; }

.rec-status {
  margin-top: 8px; padding: 8px 11px;
  font-size: 12.5px; line-height: 1.6;
  border-radius: var(--radius-sm);
  background: var(--primary-soft); color: var(--text-2);
  word-break: break-all;
}
.rec-status.ok { background: #EAF7F1; color: #17714B; }
.rec-status.bad { background: var(--red-soft); color: #B4282D; }

/* ============ 备案信息（工信部合规要求） ============ */
.beian-footer {
  position: fixed;
  right: 14px;
  bottom: 8px;
  z-index: 60;
  font-size: 12px;
  line-height: 1;
  color: #97A0B0;
  pointer-events: auto;
}
.beian-footer a {
  color: #97A0B0;
  text-decoration: none;
}
.beian-footer a:hover {
  color: #4A7CF7;
  text-decoration: underline;
}
