/* 跟读小站 · 班级版：教师端 / 学生端布局 */

.portal-view {
  padding: calc(14px + var(--safe-t)) 18px 34px;
}

.portal-view.read-page {
  padding: 0;
}

.portal-view.form-page {
  padding-bottom: 130px;
}

/* ---------------- 顶部账号栏 ---------------- */

.p-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 4px 2px 12px;
}

.p-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.p-logo {
  width: 42px;
  height: 42px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 14px;
  color: #fff;
  background: linear-gradient(145deg, #ff8a63, #f45436);
  box-shadow: 0 10px 20px rgba(238, 82, 55, 0.26);
}

.p-brand-name {
  font-size: 16.5px;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.p-brand-sub {
  margin-top: 2px;
  font-size: 10.5px;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.p-account {
  display: flex;
  align-items: center;
  gap: 7px;
  flex: none;
}

.role-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 700;
  color: #155f56;
  background: var(--teal-soft);
  white-space: nowrap;
}

.role-badge.teacher {
  color: #8f4a0d;
  background: var(--amber-soft);
}

.role-badge.admin {
  color: #4c3ec4;
  background: var(--violet-soft);
}

.p-user-btn {
  max-width: 110px;
  height: 36px;
  padding: 0 12px;
  border: 1.5px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--ink-2);
  font-size: 12.5px;
  font-weight: 650;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---------------- 导航 ---------------- */

.p-nav {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  gap: 6px;
  margin: 0 -4px 16px;
  padding: 6px 4px;
  overflow-x: auto;
  scrollbar-width: none;
  background: linear-gradient(180deg, rgba(250, 243, 232, 0.98) 70%, rgba(250, 243, 232, 0));
}

.p-nav::-webkit-scrollbar {
  display: none;
}

.p-nav a {
  flex: none;
  padding: 8px 14px;
  border-radius: 999px;
  text-decoration: none;
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 650;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--line);
}

.p-nav a.active {
  color: #fff;
  background: linear-gradient(145deg, #ff8a63, #f45436);
  border-color: transparent;
  box-shadow: 0 8px 16px rgba(238, 82, 55, 0.24);
}

/* ---------------- 概览 ---------------- */

.p-greeting {
  margin: 2px 2px 14px;
}

.p-greeting h1 {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.35;
}

.p-greeting p {
  margin-top: 4px;
  font-size: 12.5px;
  color: var(--muted);
}

.p-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}

.p-stat {
  padding: 12px 10px;
  border-radius: 18px;
  background: #fffdf9;
  border: 1px solid rgba(238, 223, 208, 0.95);
  box-shadow: 0 8px 20px rgba(125, 83, 48, 0.06);
}

.p-stat b {
  display: block;
  font-size: 22px;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.03em;
  color: var(--primary-deep);
}

.p-stat span {
  display: block;
  margin-top: 3px;
  font-size: 10.5px;
  color: var(--muted);
}

.p-toolbar {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.p-toolbar .btn {
  flex: 1;
  height: 44px;
  font-size: 13.5px;
}

.p-section {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px;
  margin: 18px 2px 10px;
}

.p-section h2 {
  font-size: 18px;
  font-weight: 750;
  letter-spacing: -0.01em;
}

.p-section a,
.p-section span {
  font-size: 12px;
  color: var(--muted);
  text-decoration: none;
}

/* ---------------- 通用列表 ---------------- */

.p-list {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.p-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 13px;
  border-radius: 18px;
  background: #fffdf9;
  border: 1px solid rgba(238, 223, 208, 0.95);
  box-shadow: 0 8px 20px rgba(125, 83, 48, 0.06);
  text-decoration: none;
  color: inherit;
  text-align: left;
}

.p-row:active {
  transform: scale(0.99);
}

.p-row-score {
  width: 44px;
  height: 44px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 14px;
  font-size: 16px;
  font-weight: 800;
  color: #1e8a61;
  background: var(--green-soft);
}

.p-row-score.mid {
  color: #96620a;
  background: var(--amber-soft);
}

.p-row-score.low {
  color: #a5361d;
  background: var(--red-soft);
}

.p-row-main {
  flex: 1;
  min-width: 0;
}

.p-row-main b {
  display: block;
  font-size: 13.5px;
  font-weight: 660;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.p-row-main span {
  display: block;
  margin-top: 2px;
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.p-row-arrow {
  flex: none;
  color: #c1ae9c;
  display: grid;
  place-items: center;
}

.p-empty-line {
  padding: 18px 14px;
  border-radius: 16px;
  border: 1.5px dashed var(--line-strong);
  text-align: center;
  font-size: 12.5px;
  line-height: 1.7;
  color: var(--muted);
  background: rgba(255, 253, 249, 0.6);
}

/* ---------------- 任务卡片 ---------------- */

.p-task-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px;
  border-radius: 20px;
  background: #fffdf9;
  border: 1px solid rgba(238, 223, 208, 0.95);
  box-shadow: 0 10px 24px rgba(125, 83, 48, 0.07);
  text-decoration: none;
  color: inherit;
}

.p-task-emoji {
  width: 54px;
  height: 54px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 17px;
  font-size: 26px;
  background: linear-gradient(150deg, #ffe4c5, #ffc987);
}

.p-task-main {
  flex: 1;
  min-width: 0;
}

.p-task-main b {
  display: block;
  font-size: 15.5px;
  font-weight: 720;
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.p-task-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 5px;
}

.p-task-date {
  margin-top: 4px;
  font-size: 10.5px;
  color: var(--muted);
}

.p-task-side {
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.p-score-pill {
  min-width: 46px;
  height: 44px;
  padding: 0 7px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  font-size: 16px;
  font-weight: 800;
  color: #1e8a61;
  background: var(--green-soft);
}

.p-score-pill.mid {
  color: #96620a;
  background: var(--amber-soft);
}

.p-score-pill.low {
  color: #a5361d;
  background: var(--red-soft);
}

.p-score-pill.pending {
  font-size: 11px;
  color: var(--muted);
  background: #f2e7da;
}

/* ---------------- 登录 ---------------- */

.login-page {
  min-height: calc(100dvh - 210px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding-bottom: 10px;
}

.login-hero {
  position: relative;
  overflow: hidden;
  padding: 26px 24px 54px;
  border-radius: 30px;
  color: #fffaf3;
  background:
    radial-gradient(300px 180px at 90% -12%, rgba(255, 255, 255, 0.4), transparent 60%),
    linear-gradient(145deg, #ff8a63 0%, #ff7452 52%, #ef5134 100%);
  box-shadow: 0 22px 44px rgba(238, 82, 55, 0.26);
}

.login-hero .p-logo {
  background: rgba(255, 255, 255, 0.2);
  box-shadow: none;
  backdrop-filter: blur(6px);
}

.login-hero h1 {
  margin-top: 22px;
  font-size: 30px;
  font-weight: 800;
  letter-spacing: -0.04em;
}

.login-hero p {
  margin-top: 8px;
  max-width: 270px;
  font-size: 13px;
  line-height: 1.7;
  color: rgba(255, 250, 243, 0.9);
}

.login-card {
  position: relative;
  z-index: 1;
  margin-top: -30px;
  padding: 20px;
  border-radius: 26px;
  background: #fffdf9;
  border: 1px solid rgba(255, 255, 255, 0.7);
  box-shadow: 0 20px 40px rgba(125, 83, 48, 0.16);
}

.login-card .field:last-of-type {
  margin-bottom: 10px;
}

.login-card .btn {
  width: 100%;
  margin-top: 4px;
}

.login-error {
  min-height: 18px;
  margin-top: 10px;
  font-size: 12px;
  color: var(--red);
  text-align: center;
}

.login-foot {
  margin-top: 18px;
  text-align: center;
  font-size: 11.5px;
  line-height: 1.7;
  color: var(--muted);
}

/* ---------------- 任务表单 ---------------- */

.assign-all {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  font-size: 13px;
  font-weight: 650;
  color: var(--ink-2);
}

.assign-all input {
  width: 17px;
  height: 17px;
  accent-color: var(--primary);
}

.assign-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
  max-height: 230px;
  overflow-y: auto;
  padding: 2px;
}

.assign-item {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 38px;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 12px;
  font-size: 12px;
  color: var(--ink-2);
  background: #fffcf7;
}

.assign-item input {
  accent-color: var(--primary);
  width: 16px;
  height: 16px;
  flex: none;
}

.assign-item span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.assign-item.disabled {
  opacity: 0.45;
  pointer-events: none;
}

.upload-zone {
  cursor: pointer;
}

.file-chip {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 11px;
  border-radius: 14px;
  background: #fffcf7;
  border: 1.5px solid var(--line);
  font-size: 12px;
}

.file-chip .fc-icon {
  width: 34px;
  height: 34px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 10px;
  color: #15766d;
  background: var(--teal-soft);
}

.file-chip .fc-main {
  flex: 1;
  min-width: 0;
}

.file-chip b {
  display: block;
  font-size: 12.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-chip span {
  display: block;
  margin-top: 1px;
  font-size: 10.5px;
  color: var(--muted);
}

/* ---------------- 学生管理 ---------------- */

.student-row {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 11px 13px;
  border-radius: 18px;
  background: #fffdf9;
  border: 1px solid rgba(238, 223, 208, 0.95);
}

.student-avatar {
  width: 38px;
  height: 38px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 50%;
  font-size: 13px;
  font-weight: 750;
  color: #fff;
  background: linear-gradient(145deg, #8ad7c8, #2aa596);
}

.student-main {
  flex: 1;
  min-width: 0;
}

.student-main b {
  display: block;
  font-size: 13.5px;
  font-weight: 650;
}

.student-main span {
  display: block;
  margin-top: 2px;
  font-size: 10.5px;
  color: var(--muted);
}

.student-actions {
  display: flex;
  gap: 4px;
  flex: none;
}

.student-actions .mini-btn {
  width: 32px;
  height: 32px;
  background: #f6ebdf;
}

.bulk-help {
  margin: 8px 0 12px;
  padding: 10px 12px;
  border-radius: 12px;
  background: #fff7e8;
  border: 1px solid #f3e2c2;
  font-size: 11.5px;
  line-height: 1.6;
  color: #7b5c2e;
}

.bulk-help code {
  font-size: 11px;
  background: #fff;
  padding: 1px 4px;
  border-radius: 4px;
}

.credential-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 280px;
  overflow-y: auto;
  margin-top: 6px;
}

.credential-item {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 10px;
  background: #f8f1e6;
  font-size: 11.5px;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
}

.credential-item span:last-child {
  color: var(--primary-deep);
  font-weight: 700;
}

.p-tip {
  margin: 8px 2px;
  font-size: 11.5px;
  line-height: 1.65;
  color: var(--muted);
}

.p-actions {
  display: flex;
  gap: 8px;
  margin-top: 14px;
}

.p-actions .btn {
  flex: 1;
}

/* ---------------- 任务详情 / 报告补充 ---------------- */

.p-detail-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.p-detail-head .flow-title {
  flex: 1;
  min-width: 0;
}

.p-detail-head h1 {
  font-size: 18px;
  font-weight: 780;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.p-detail-head p {
  margin-top: 2px;
  font-size: 11px;
  color: var(--muted);
}

.p-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 7px;
}

.p-report-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0;
}

.p-report-meta .chip {
  font-size: 11px;
}

.student-report-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  padding: 11px 13px;
  border-radius: 16px;
  background: #fff8ec;
  border: 1px solid #f3e2c2;
  font-size: 12.5px;
  color: #6a4a22;
}

.student-report-banner b {
  font-weight: 750;
}

.role-switch-note {
  margin-top: 12px;
  text-align: center;
  font-size: 11.5px;
  color: var(--muted);
}

/* ---------------- 页脚（备案信息） ---------------- */

.app-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 3px 10px;
  margin: 10px 22px calc(20px + var(--safe-b));
  padding-top: 14px;
  border-top: 1px solid rgba(196, 170, 143, 0.28);
  font-size: 10.5px;
  line-height: 1.7;
  letter-spacing: 0.01em;
  color: #ad9c89;
  text-align: center;
}

.app-footer .af-copy {
  color: #ad9c89;
}

.app-footer .af-sep {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: #d2c1ae;
}

.app-footer .af-icp {
  color: #a8977f;
  text-decoration: none;
  border-bottom: 1px dotted rgba(168, 151, 127, 0.5);
  padding-bottom: 0.5px;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.app-footer .af-icp:hover,
.app-footer .af-icp:active {
  color: var(--primary-deep);
  border-bottom-color: var(--primary-deep);
}

/* 跟读页是全屏录音界面，不显示页脚 */
.view.read-page + .app-footer {
  display: none;
}

@media (min-width: 640px) {
  .app-footer {
    margin-bottom: 26px;
  }
}

/* ---------------- 响应式 ---------------- */

@media (max-width: 380px) {
  .portal-view {
    padding-left: 14px;
    padding-right: 14px;
  }
  .p-stats {
    grid-template-columns: repeat(2, 1fr);
  }
  .assign-grid {
    grid-template-columns: 1fr;
  }
  .p-user-btn {
    max-width: 74px;
  }
}

@media (min-width: 640px) {
  .portal-view {
    padding-top: calc(24px + var(--safe-t));
  }
  .portal-view.read-page {
    padding: 0;
  }
}
