/* 学生作品系统 · 样式（独立一层，不改动 index.css / app.css） */
:root {
  --sp-red: #b3282d;
  --sp-ink: #1f2937;
  --sp-sub: #6b7280;
  --sp-line: #e5e7eb;
  --sp-bg: #f6f4f1;
  --sp-card: #fff;
  --sp-ok: #15803d;
  --sp-warn: #b45309;
  --sp-bad: #b91c1c;
}

body.sp-page {
  background: var(--sp-bg);
  color: var(--sp-ink);
  margin: 0;
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  line-height: 1.65;
}

/* ── 顶栏 ── */
.sp-userbar {
  display: flex; align-items: center; gap: 14px;
  padding: 10px 22px; background: #fff;
  border-bottom: 1px solid var(--sp-line);
  position: sticky; top: 0; z-index: 30; flex-wrap: wrap;
}
.sp-userbar .sp-brand { font-weight: 700; color: var(--sp-red); text-decoration: none; letter-spacing: .5px; }
.sp-userbar .who { font-weight: 600; }
.sp-userbar a { color: var(--sp-sub); text-decoration: none; }
.sp-userbar a:hover { color: var(--sp-red); }
.sp-userbar a.on { color: var(--sp-red); font-weight: 700; }
.sp-userbar .spacer { flex: 1; }
.sp-userbar .exit { color: #9ca3af; }

/* ── 布局 ── */
.sp-wrap { max-width: 1180px; margin: 0 auto; padding: 26px 22px 70px; }
.sp-head { display: flex; align-items: center; gap: 14px; margin-bottom: 6px; flex-wrap: wrap; }
.sp-head h1 { font-size: 24px; margin: 0; }
.sp-head .sub { color: var(--sp-sub); font-size: 13px; }
.sp-head .right { margin-left: auto; display: flex; gap: 8px; }

.sp-card { background: var(--sp-card); border: 1px solid var(--sp-line); border-radius: 12px; padding: 20px; margin-bottom: 18px; }
.sp-card > h2 { font-size: 16px; margin: 0 0 14px; }
.sp-card > h2 .n { color: var(--sp-red); }

.sp-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 780px) { .sp-grid2 { grid-template-columns: 1fr; } }

label.sp-lab { display: block; font-size: 13px; font-weight: 600; margin-bottom: 5px; }
label.sp-lab i { color: var(--sp-red); font-style: normal; }
input.sp-in, select.sp-in, textarea.sp-in {
  width: 100%; box-sizing: border-box; padding: 9px 11px;
  border: 1px solid var(--sp-line); border-radius: 8px; font: inherit; background: #fff;
}
input.sp-in:focus, textarea.sp-in:focus, select.sp-in:focus { outline: 2px solid rgba(179,40,45,.25); border-color: var(--sp-red); }
textarea.sp-in { resize: vertical; min-height: 72px; }
.sp-hint { font-size: 12px; color: var(--sp-sub); margin-top: 5px; }
/* 标签药丸：用于「评分重点 / 附加效果」这类口径标记，直接可见，不做折叠 */
.sp-badge { display: inline-block; padding: 1px 7px; border-radius: 999px; background: #fef3c7; color: #92400e;
  border: 1px solid #fcd34d; font-size: 11px; font-weight: 600; vertical-align: 1px; }
.sp-err { font-size: 12.5px; color: var(--sp-bad); margin-top: 5px; }

/* ── 按钮 ── */
.sp-btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 9px 16px;
  border: 1px solid var(--sp-line); background: #fff; color: var(--sp-ink);
  border-radius: 8px; cursor: pointer; font: inherit; text-decoration: none;
}
.sp-btn:hover { border-color: var(--sp-red); color: var(--sp-red); }
.sp-btn.pri { background: var(--sp-red); border-color: var(--sp-red); color: #fff; font-weight: 600; }
.sp-btn.pri:hover { background: #98212a; color: #fff; }
.sp-btn:disabled { opacity: .45; cursor: not-allowed; }
.sp-btn.sm { padding: 5px 11px; font-size: 13px; }
.sp-btn.danger:hover { border-color: var(--sp-bad); color: var(--sp-bad); }

/* ── 表格 ── */
table.sp-tb { width: 100%; border-collapse: collapse; font-size: 14px; }
table.sp-tb th, table.sp-tb td { padding: 9px 10px; border-bottom: 1px solid var(--sp-line); text-align: left; vertical-align: middle; }
table.sp-tb th { background: #faf8f6; font-size: 12.5px; color: var(--sp-sub); font-weight: 600; white-space: nowrap; }
table.sp-tb tr:hover td { background: #fdfbf9; }
table.sp-tb td.num, table.sp-tb th.num { text-align: right; font-variant-numeric: tabular-nums; }
.sp-sno { font-family: ui-monospace, Menlo, monospace; font-size: 12.5px; color: var(--sp-sub); }

/* ── 标签 / 状态 ── */
.sp-tag { display: inline-block; padding: 1px 8px; border-radius: 20px; font-size: 12px; border: 1px solid var(--sp-line); background: #fff; color: var(--sp-sub); }
.sp-tag.draft { border-color: #d6d3d1; background: #f5f5f4; }
.sp-tag.submitted { border-color: #bbf7d0; background: #f0fdf4; color: var(--sp-ok); }
.sp-tag.locked { border-color: #fecaca; background: #fef2f2; color: var(--sp-bad); }
.sp-tag.final { border-color: #bbf7d0; background: #f0fdf4; color: var(--sp-ok); }
.sp-tag.temp { border-color: #fde68a; background: #fffbeb; color: var(--sp-warn); }
.sp-tag.none { border-color: #e5e7eb; background: #f9fafb; }
.sp-tag.over { border-color: #bfdbfe; background: #eff6ff; color: #1d4ed8; }

/* ── 提示条 ── */
.sp-tip { padding: 11px 14px; border-radius: 9px; font-size: 13.5px; margin-bottom: 14px; border: 1px solid; }
.sp-tip-info { background: #f8fafc; border-color: #e2e8f0; color: #334155; }
.sp-tip-ok   { background: #f0fdf4; border-color: #bbf7d0; color: #166534; }
.sp-tip-warn { background: #fffbeb; border-color: #fde68a; color: #92400e; }
.sp-tip-bad  { background: #fef2f2; border-color: #fecaca; color: #991b1b; }

/* ── 作品卡（我的作品） ── */
.sp-list { display: grid; gap: 12px; }
.sp-item {
  background: #fff; border: 1px solid var(--sp-line); border-radius: 11px;
  padding: 15px 17px; display: flex; gap: 16px; align-items: center; flex-wrap: wrap;
}
.sp-item:hover { border-color: #d6d3d1; box-shadow: 0 1px 8px rgba(0,0,0,.04); }
.sp-item .t { font-weight: 650; font-size: 15.5px; }
.sp-item .m { font-size: 12.5px; color: var(--sp-sub); margin-top: 3px; display: flex; gap: 12px; flex-wrap: wrap; }
.sp-item .code { font-family: ui-monospace, monospace; color: var(--sp-red); font-weight: 600; }
.sp-item .act { margin-left: auto; display: flex; gap: 8px; align-items: center; }

/* ── 组员编辑器 ── */
.sp-mem-tb input { padding: 6px 8px; font-size: 13.5px; }
.sp-mem-tb td { padding: 5px 6px; }
.sp-ratio-sum { font-weight: 700; }
.sp-ratio-sum.bad { color: var(--sp-bad); }
.sp-ratio-sum.ok { color: var(--sp-ok); }

/* ── 教师打分台 ── */
.sp-tch { display: grid; grid-template-columns: 300px 1fr; gap: 18px; align-items: start; }
@media (max-width: 900px) { .sp-tch { grid-template-columns: 1fr; } }
.sp-side { position: sticky; top: 68px; max-height: calc(100vh - 90px); overflow: auto; }
.sp-grp { margin-bottom: 12px; }
.sp-grp > .h { font-size: 12.5px; font-weight: 700; color: var(--sp-sub); padding: 6px 4px; border-bottom: 1px solid var(--sp-line); }
.sp-grp a { display: block; padding: 7px 9px; border-radius: 7px; text-decoration: none; color: var(--sp-ink); font-size: 13.5px; }
.sp-grp a:hover { background: #faf8f6; }
.sp-grp a.on { background: #fdf2f2; color: var(--sp-red); font-weight: 650; }
.sp-grp a .s { font-size: 12px; color: var(--sp-sub); margin-left: 6px; }

.sp-score-box { border-top: 1px solid var(--sp-line); margin-top: 16px; padding-top: 16px; }
.sp-dims { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.sp-avg { font-size: 30px; font-weight: 750; font-variant-numeric: tabular-nums; }
.sp-phrases { display: flex; flex-wrap: wrap; gap: 6px; }
.sp-phrase { font-size: 12.5px; padding: 3px 9px; border: 1px solid var(--sp-line); border-radius: 20px; background: #fff; cursor: pointer; }
.sp-phrase:hover { border-color: var(--sp-red); color: var(--sp-red); }
.sp-bulk { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.sp-empty { text-align: center; color: var(--sp-sub); padding: 46px 10px; font-size: 14px; }
.sp-kv { display: grid; grid-template-columns: 96px 1fr; gap: 4px 10px; font-size: 13.5px; }
.sp-kv .k { color: var(--sp-sub); }

/* ── 附件 ── */
.sp-files { margin-top: 10px; display: flex; flex-direction: column; gap: 8px; }
.sp-file { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 9px 12px; border: 1px solid var(--sp-line); border-radius: 9px; background: #fff; flex-wrap: wrap; }
.sp-file-n { font-size: 13.5px; font-weight: 600; word-break: break-all; }
.sp-file-m { font-size: 12px; color: var(--sp-sub); margin-top: 2px; font-variant-numeric: tabular-nums; }
.sp-file-a { display: flex; gap: 6px; flex-shrink: 0; }
.sp-up { margin-top: 14px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.sp-up input[type=file] { font-size: 13px; max-width: 100%; }
.sp-bar { margin-top: 10px; height: 6px; border-radius: 6px; background: var(--sp-line); overflow: hidden; }
.sp-bar > i { display: block; height: 100%; width: 0; background: var(--sp-red); transition: width .12s linear; }
.sp-btn.sm { padding: 4px 10px; font-size: 12.5px; }
.sp-btn.del { color: #b91c1c; border-color: #f0c9c9; }
.sp-btn.del:hover { background: #fdf2f2; }
.sp-btn[disabled] { opacity: .55; cursor: not-allowed; }

/* ── 新建作品弹窗（2026-09-17：从常显卡片改为弹窗） ── */
.sp-modal {
  position: fixed; inset: 0; z-index: 60;
  display: flex; align-items: flex-start; justify-content: center;
  padding: 34px 16px 40px; overflow: auto;
}
.sp-modal[hidden] { display: none; }
.sp-modal-bg { position: fixed; inset: 0; background: rgba(28, 20, 18, .46); }
.sp-modal-panel {
  position: relative; width: min(880px, 100%);
  background: var(--sp-card); border: 1px solid var(--sp-line); border-radius: 14px;
  box-shadow: 0 18px 48px rgba(0, 0, 0, .22); padding: 20px 22px 22px;
}
.sp-modal-hd { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.sp-modal-hd b { font-size: 17px; color: var(--sp-red); }
body.sp-modal-open { overflow: hidden; }
@media (max-width: 640px) {
  .sp-modal { padding: 14px 8px 24px; }
  .sp-modal-panel { padding: 16px 14px 18px; }
}

/* ═══════ 一卡多步：主卡内分区（领取 → 填内容 → 提交 是一件事） ═══════ */
.sp-steps { display: flex; gap: 8px; flex-wrap: wrap; margin: 2px 0 14px; }
.sp-step  { font-size: 12px; padding: 3px 10px; border-radius: 999px;
            background: #f1f5f9; color: #475569; border: 1px solid #e2e8f0; }
.sp-step.on { background: #eef2ff; color: #3730a3; border-color: #c7d2fe; font-weight: 600; }
.sp-sub   { margin-top: 22px; padding-top: 18px; border-top: 1px dashed #e2e8f0; }
.sp-sub > h3 { margin: 0 0 10px; font-size: 15px; font-weight: 600; color: #111827; }
.sp-submit { margin-top: 26px; padding: 16px; border: 1px solid #c7d2fe; border-radius: 12px; background: #f8faff; }
.sp-more  { margin-top: 18px; border: 1px solid var(--sp-line, #e2e8f0); border-radius: 12px;
            background: #fff; padding: 4px 16px; }
.sp-more > summary { cursor: pointer; padding: 12px 0; font-weight: 600; color: #334155; font-size: 14px; }
.sp-more[open] > summary { border-bottom: 1px dashed #e2e8f0; margin-bottom: 12px; }

/* ═══════ 折叠块：作品按「作业」分组、默认折叠（打分台） ═══════ */
details.sp-fold { padding: 0; overflow: hidden; }
details.sp-fold > summary.h { cursor: pointer; list-style: none; display: flex; align-items: center;
  gap: 8px; flex-wrap: wrap; padding: 12px 15px; border-bottom: 0; }
details.sp-fold > summary.h::-webkit-details-marker { display: none; }
details.sp-fold > summary.h::before { content: '\25B8'; font-size: 11px; color: #9ca3af; transition: transform .15s; }
details.sp-fold[open] > summary.h { border-bottom: 1px solid var(--sp-line); }
details.sp-fold[open] > summary.h::before { content: '\25BE'; }
details.sp-fold > summary.h .s { font-weight: 400; color: var(--sp-sub); font-size: 12px; }
.sp-foldbody { padding: 8px 13px 12px; }

/* 作业卡片折叠（sp.php / sp_teacher.php 共用） */
details.sp-fold-asn > summary { cursor: pointer; list-style: none; padding: 13px 18px; background: var(--sp-card);
  border: 1px solid var(--sp-line); border-radius: 12px; font-size: 15px; font-weight: 700;
  display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
details.sp-fold-asn > summary::-webkit-details-marker { display: none; }
details.sp-fold-asn > summary::before { content: '\25B8'; font-size: 11px; color: #9ca3af; transition: transform .15s; }
details.sp-fold-asn[open] > summary { border-radius: 12px 12px 0 0; border-bottom: 0; }
details.sp-fold-asn[open] > summary::before { content: '\25BE'; }
details.sp-fold-asn > .sp-card { border-radius: 0 0 12px 12px; }

/* ── 打分台：单列（作品列表整页宽，每件折叠，点开=详情） ── */
.sp-tch1 { grid-template-columns: 1fr; }
.sp-tch1 .sp-side { position: static; max-height: none; overflow: visible; }

details.sp-pj { margin-bottom: 10px; padding: 0; overflow: hidden; }
details.sp-pj > summary { display: flex; gap: 9px; align-items: flex-start; padding: 11px 15px; cursor: pointer; list-style: none; }
details.sp-pj > summary::-webkit-details-marker { display: none; }
details.sp-pj > summary::before { content: '\25B8'; font-size: 11px; color: #9ca3af; padding-top: 3px; transition: transform .15s; }
details.sp-pj[open] > summary { background: #faf8f6; border-bottom: 1px solid var(--sp-line); }
details.sp-pj[open] > summary::before { content: '\25BE'; }
details.sp-pj > summary .chk { margin-top: 3px; flex: none; }
.sp-pjtt { flex: 1; font-weight: 650; font-size: 13.8px; line-height: 1.5; }
.sp-pjtt .sp-sno { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12px; color: var(--sp-red); background: #fdf2f2; border-radius: 5px; padding: 1px 5px; margin-right: 3px; }
.sp-pjmt { font-size: 12.5px; color: var(--sp-sub); white-space: nowrap; }
.sp-pjbd { padding: 12px 15px; }
.sp-pjtxt { white-space: pre-wrap; font-size: 13px; line-height: 1.75; color: #374151; background: #faf8f6;
  border: 1px solid var(--sp-line); border-radius: 8px; padding: 10px 12px; max-height: 300px; overflow: auto; }
.sp-filewrap { display: flex; flex-direction: column; }
.sp-txtbox pre { white-space: pre-wrap; font-size: 12.5px; line-height: 1.7; max-height: 360px; overflow: auto;
  background: #fff; border: 1px solid var(--sp-line); border-radius: 8px; padding: 10px 12px; margin: 4px 0 8px; }
.sp-sbF { margin-top: 10px; padding: 10px 12px; border: 1px solid #e5c9a0; background: #fffaf2; border-radius: 9px;
  display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* ── 作品列表两列：左＝已提交 / 右＝未提交 ── */
.sp-colhead { display:flex; align-items:center; gap:7px; font-size:13.5px; font-weight:700; color:#374151;
  margin:0 0 10px; padding-bottom:7px; border-bottom:2px solid var(--sp-line); }
.sp-colhead b { color: var(--sp-red); font-size:15px; }
.sp-col-empty { border:1px dashed var(--sp-line); border-radius:11px; padding:26px 12px; text-align:center;
  color:var(--sp-sub); font-size:13px; }

/* ── 打分台「我的作品」两列：左＝已提交 / 右＝未提交 ── */
.sp-two { display:grid; grid-template-columns:1fr 1fr; gap:14px; align-items:start; }
@media (max-width:1180px) { .sp-two { grid-template-columns:1fr; } }
.sp-two-col { display:grid; gap:10px; align-content:start; }
.sp-two .sp-card { margin-bottom:0; }

/* ── 卡片里就地展开的「AI 辅助评分」 ── */
.sp-aiBox { margin-top:12px; padding:12px 14px; background:#fbfdff; border:1px solid var(--sp-line); border-radius:10px; }
.sp-aiBox .sp-aiActs { margin-top:13px; display:flex; gap:8px; align-items:center; flex-wrap:wrap; }


/* ══════════════════════════════════════════════════════════════════
   课件库 · 我的课件（卡片网格，DH-P6-CWCARD）
   顺序 = 教师自定义呈现顺序，与 api action=cw_move 联动
   ══════════════════════════════════════════════════════════════════ */
.cw-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 14px;
  align-items: stretch;
}

/* 卡片等高：flex 列 + 按钮区 margin-top:auto 贴底 */
.cw-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  padding: 14px 15px;
  border: 1px solid var(--sp-line);
  border-radius: 11px;
  background: #fff;
}
.cw-card:hover { border-color: #d6d3d1; box-shadow: 0 1px 8px rgba(17, 24, 39, .05); }

.cw-top { display: flex; align-items: flex-start; gap: 8px; }
.cw-head { flex: 1 1 auto; min-width: 0; font-size: 15px; line-height: 1.5; }
.cw-tt { font-weight: 650; overflow-wrap: anywhere; word-break: break-word; }
.cw-head .sp-tag { margin-left: 6px; vertical-align: 2px; }

/* DH-P6-RENAME：标题旁「改标题」入口。行内紧跟标题，不占标题的换行宽度
   （标题写满时按钮自然落到下一行，而不是挤压标题逐字断行）。 */
.cw-edit {
  display: inline-block;
  vertical-align: 2px;
  margin-left: 4px;
  padding: 0 5px;
  border: 1px solid var(--sp-line);
  border-radius: 5px;
  background: #f9fafb;
  color: var(--sp-sub);
  font: inherit;
  font-size: 12px;
  line-height: 1.6;
  cursor: pointer;
  white-space: nowrap;
}
.cw-edit:hover { color: var(--sp-red); border-color: #e8c9ca; background: #fdf2f2; }
.cw-edit:focus-visible { outline: 2px solid #e8c9ca; outline-offset: 1px; }

/* 改标题弹窗内：字段标签与字数计数（显隐仍只靠 hidden + .sp-modal[hidden]） */
#editBox .cw-edlb { display: block; font-size: 13px; color: #374151; margin: -4px 0 -4px; }
#editBox .cw-edcnt { font-size: 12px; color: var(--sp-sub); text-align: right; margin-top: -4px; font-variant-numeric: tabular-nums; }

.cw-ord { flex: 0 0 auto; display: flex; align-items: center; gap: 4px; }
.cw-no {
  min-width: 1.6em; text-align: right;
  font: 600 12px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
  color: var(--sp-sub);
}
.cw-mv { padding: 3px 8px; font-size: 11px; line-height: 1.4; }

.cw-meta { font-size: 12.5px; color: #9ca3af; line-height: 1.6; overflow-wrap: anywhere; }

.cw-desc {
  font-size: 13px; color: var(--sp-sub); line-height: 1.65;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}

.cw-share { font-size: 12.5px; color: var(--sp-sub); line-height: 1.8; }
.cw-share .sp-tag { max-width: 100%; overflow-wrap: anywhere; }
.cw-share a { color: var(--sp-red); margin-left: 4px; }

.cw-files {
  font-size: 12px; color: var(--sp-sub); line-height: 1.85;
  overflow-wrap: anywhere; word-break: break-word;
}
.cw-files code { background: #f3f4f6; padding: 1px 5px; border-radius: 4px; font-size: 11.5px; }
.cw-files a { color: #2563eb; margin-right: 8px; }
.cw-files a.ent { font-weight: 600; color: #1d4ed8; }

/* 按钮区贴底：卡片被同行拉高时按钮始终在底部 */
.cw-acts {
  display: flex; flex-wrap: wrap; gap: 6px;
  margin-top: auto; padding-top: 10px;
}

/* 卡片内任何 [hidden] 都按「隐藏」走，内联 display 不得覆盖 */
.cw-cards [hidden], .cw-card [hidden] { display: none; }

@media (max-width: 720px) {
  .cw-cards { grid-template-columns: 1fr; gap: 12px; }
  .cw-card { padding: 13px 13px; }
  .cw-ord { gap: 3px; }
  .cw-mv { padding: 3px 6px; }
}

/* ══════════════════════════════════════════════════════════════════
   课件库 · 学生端「班级课件」卡片网格（DH-P6-MYCARD）
   只新增学生端专用类，不改动上面教师端 .cw-cards / .cw-card 的任何规则
   ══════════════════════════════════════════════════════════════════ */

/* 分组标题里的「共 N 份」小字（原为内联样式） */
.sp-card > h2 .cw-grp-n { font-weight: 400; font-size: 13px; color: #6b7280; }

/* 学生端卡片：只读，无排序按钮，标题单独占一行 */
.cw-card-stu { gap: 7px; }
/* .cw-head 在教师端是 .cw-top 的行内子项（flex:1 1 auto），
   学生端直接作为卡片列子项时会纵向撑开、把 meta 推到底部，这里收回自动伸展 */
.cw-card-stu .cw-head { font-size: 15.5px; flex: 0 0 auto; }
/* 学生端 desc 最多 3 行（教师端 .cw-desc 仍为 2 行，互不影响） */
.cw-card-stu .cw-desc { -webkit-line-clamp: 3; line-clamp: 3; }
/* 按钮固定在卡片右下：卡片等高时按钮始终贴底 */
.cw-card-stu .cw-acts { justify-content: flex-end; }

@media (max-width: 720px) {
  .cw-card-stu .cw-acts .sp-btn { max-width: 100%; }
}

/* ==================================================================
   DH-FOOT 全站统一版权标识（页脚）
   纯新增追加，不改动本文件上方任何既有规则
   ================================================================== */
.sp-credit {
  text-align: center;
  font-size: 12.5px;
  color: #9ca3af;
  margin: 26px 0 8px;
  line-height: 1.7;
}
.sp-credit a { color: #6b7280; text-decoration: none; }
.sp-credit a:hover { color: #2563eb; text-decoration: underline; }
@media (max-width: 720px) {
  .sp-credit { padding: 0 14px; }
}
