:root {
  --home-blue: #1f5d72;
  --home-green: #39776a;
  --home-lake: #a8d5cf;
  --home-paper: #fffdf7;
  --home-ivory: #f7f3e8;
  --home-gold: #b49345;
  --home-line: #9ab7aa;
  --home-muted: #58716c;
  --home-ink: #173f49;
}

.portal-home {
  color: var(--home-ink);
  background:
    linear-gradient(180deg, rgba(168, 213, 207, 0.26), transparent 280px),
    var(--home-ivory);
  font-family: "Microsoft YaHei", "Noto Sans CJK SC", system-ui, sans-serif;
}

.teacher-home-page {
  background: var(--portal-mist);
}

.portal-home .portal-header {
  position: relative;
  min-height: 72px;
  padding: 9px clamp(18px, 4vw, 58px);
  border: 0;
  border-bottom: 1px solid var(--home-line);
  background: rgba(255, 253, 247, 0.96);
}

.portal-home .portal-header::after {
  position: absolute;
  right: clamp(18px, 4vw, 58px);
  bottom: 3px;
  left: clamp(18px, 4vw, 58px);
  height: 1px;
  background: rgba(180, 147, 69, 0.48);
  content: "";
}

.portal-home .portal-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--home-ink);
  text-decoration: none;
}

.portal-home .portal-header .portal-brand img {
  width: 44px;
  height: 44px;
}

.portal-home .portal-brand span,
.portal-home .account-copy {
  display: grid;
  gap: 1px;
}

.portal-home .portal-header .portal-brand strong {
  font-size: 18px;
  letter-spacing: 0.08em;
}

.portal-home .portal-brand small,
.portal-home .account-copy small {
  color: var(--home-muted);
  font-size: 10px;
  letter-spacing: 0.06em;
}

.portal-home .account-copy strong {
  font-size: 13px;
}

.portal-home .account-area,
.portal-home .account-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.portal-home .account-name {
  max-width: 160px;
  overflow: hidden;
  color: var(--home-ink);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.portal-home .secondary-action {
  min-height: 34px;
  padding: 0 14px;
  border-color: var(--home-line);
  border-radius: 5px;
  background: transparent;
  color: var(--home-blue);
  transition: background-color 90ms ease, border-color 90ms ease;
}

.portal-home .secondary-action:hover {
  border-color: var(--home-blue);
  background: rgba(168, 213, 207, 0.18);
}

.portal-home .secondary-action:active,
.portal-home .module-card:active {
  transform: translateY(1px);
}

.portal-home .portal-main {
  width: min(1100px, calc(100% - 40px));
  padding: clamp(30px, 4vw, 48px) 0 64px;
}

.portal-home .home-hero {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 28px;
  min-height: 112px;
  padding: 0 4px 24px;
  border: 0;
  border-bottom: 1px solid var(--home-line);
}

.portal-home .home-hero::after {
  display: none;
}

.portal-home .eyebrow {
  margin: 0 0 6px;
  color: var(--home-green);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
}

.portal-home .home-hero h1 {
  margin: 0;
  color: var(--home-blue);
  font-family: inherit;
  font-size: clamp(30px, 4vw, 46px);
  line-height: 1.18;
  letter-spacing: -0.035em;
}

.student-home-page .identity-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 14px;
}

.student-home-page .identity-badges span {
  display: inline-flex;
  min-height: 25px;
  align-items: center;
  padding: 3px 9px;
  border: 1px solid var(--home-line);
  border-radius: 5px;
  background: rgba(255, 253, 247, 0.66);
  color: var(--home-green);
  font-size: 11px;
  font-weight: 800;
  line-height: 1.3;
}

.student-home-page .identity-badges span[data-role="project_lead"] {
  border-color: var(--home-blue);
  color: var(--home-blue);
}

.student-home-page .identity-badges span[data-role="publisher"] {
  border-color: var(--home-gold);
  color: #765d21;
}

.student-home-page .identity-badges span[data-kind="loading"],
.student-home-page .identity-badges span[data-kind="error"] {
  color: var(--home-muted);
  font-weight: 700;
}

.portal-home .home-status {
  flex: 0 0 auto;
  padding: 0 0 2px 17px;
  border: 0;
  border-left: 2px solid var(--home-gold);
  border-radius: 0;
  background: transparent;
}

.portal-home .home-status small {
  color: var(--home-green);
  font-size: 10px;
  font-weight: 800;
}

.portal-home .home-status strong {
  display: block;
  margin-top: 4px;
  font-size: 13px;
  line-height: 1.55;
}

.student-home-page .home-push-action {
  margin-top: 9px;
  padding: 6px 10px;
  border: 1px solid var(--home-blue);
  border-radius: 999px;
  background: transparent;
  color: var(--home-blue);
  font: inherit;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.student-home-page .home-push-action[hidden] { display: none; }
.student-home-page .home-push-state { display: block; max-width: 230px; margin-top: 6px; color: var(--home-muted); font-size: 11px; line-height: 1.45; }

.student-home-page .home-notification {
  display: grid;
  gap: 0;
  margin-top: 22px;
  padding: 14px 4px 14px 16px;
  border-left: 3px solid var(--home-gold);
  background: rgba(255, 253, 247, 0.72);
}

.student-home-page .home-notification[hidden] { display: none; }
.student-home-page .home-notification h2 { margin: 0 0 7px; font-size: 13px; color: var(--home-green); }
.student-home-page .home-notification article { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 8px 0; border-top: 1px solid rgba(154, 183, 170, 0.45); }
.student-home-page .home-notification div { display: grid; gap: 3px; }
.student-home-page .home-notification span { color: var(--home-muted); font-size: 13px; }
.student-home-page .home-notification a { flex: 0 0 auto; color: var(--home-blue); font-weight: 800; }

.portal-home .home-workspace {
  display: grid;
  gap: 42px;
  margin-top: 38px;
}

.portal-home .module-group > header {
  margin: 0 0 16px;
  padding: 0 4px 9px;
  border-bottom: 1px solid rgba(154, 183, 170, 0.7);
}

.portal-home .module-group > header h2 {
  margin: 0;
  color: var(--home-ink);
  font-size: 17px;
  line-height: 1.4;
}

.portal-home .module-list,
.student-home-page .student-current-list,
.teacher-home-page .teacher-process-list,
.teacher-home-page .teacher-lifecycle-list {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px 14px;
  margin: 0;
  overflow: visible;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.teacher-home-page .module-list,
.teacher-home-page .teacher-process-list {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

.portal-home .module-card,
.teacher-home-page .module-card,
.student-home-page .module-feature {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  min-width: 0;
  min-height: 104px;
  padding: 12px 8px 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--home-blue);
  text-align: center;
  text-decoration: none;
  transition: background-color 90ms ease, color 90ms ease;
}

.portal-home .module-card:hover {
  background: rgba(168, 213, 207, 0.22);
  color: var(--home-green);
}

.portal-home .module-card img,
.teacher-home-page .module-card img,
.student-home-page .module-feature img {
  width: 52px;
  height: 52px;
  object-fit: contain;
}

.portal-home .module-card span {
  margin: 0;
  padding: 0;
  color: inherit;
  font-size: 14px;
  font-weight: 800;
  line-height: 1.35;
}

.student-home-page .student-current-list {
  justify-content: start;
}

.student-home-page .student-current-list .module-card,
.teacher-home-page .teacher-lifecycle-list .module-card {
  width: 100%;
}

.portal-home .password-dialog {
  border-color: var(--home-line);
  border-radius: 8px;
  background: var(--home-paper);
  box-shadow: 0 18px 54px rgba(23, 63, 73, 0.18);
}

.portal-home .role-guard-dialog {
  width: min(390px, calc(100% - 32px));
  padding: 0;
  border: 1px solid var(--home-line);
  border-radius: 8px;
  background: var(--home-paper);
  color: var(--home-ink);
  box-shadow: 0 18px 54px rgba(23, 63, 73, 0.18);
}

.portal-home .role-guard-dialog::backdrop {
  background: rgba(23, 63, 73, 0.34);
}

.portal-home .role-guard-dialog form {
  display: grid;
  gap: 14px;
  padding: 24px;
}

.portal-home .role-guard-dialog h2,
.portal-home .role-guard-dialog p {
  margin: 0;
}

.portal-home .role-guard-dialog h2 {
  color: var(--home-blue);
  font-size: 22px;
}

.portal-home .role-guard-dialog p {
  color: var(--home-muted);
  font-size: 14px;
  line-height: 1.7;
}

.portal-home .role-guard-dialog .primary-action {
  justify-self: end;
  min-width: 92px;
  min-height: 36px;
  border-radius: 5px;
  background: var(--home-blue);
  color: var(--home-paper);
}

@media (max-width: 900px) {
  .portal-home .module-list,
  .teacher-home-page .module-list,
  .teacher-home-page .teacher-process-list,
  .teacher-home-page .teacher-lifecycle-list {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .portal-home .portal-header {
    gap: 10px;
    min-height: 64px;
    padding: 8px 12px;
  }

  .portal-home .portal-header::after {
    right: 12px;
    left: 12px;
  }

  .portal-home .portal-header .portal-brand img {
    width: 38px;
    height: 38px;
  }

  .portal-home .portal-header .portal-brand strong {
    font-size: 15px;
  }

  .portal-home .portal-brand small,
  .portal-home .account-copy small {
    display: none;
  }

  .portal-home .account-area {
    gap: 7px;
  }

  .portal-home .account-copy strong {
    max-width: 78px;
    overflow: hidden;
    font-size: 11px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .portal-home .account-name {
    max-width: 92px;
    font-size: 12px;
  }

  .portal-home .secondary-action {
    min-height: 32px;
    padding: 0 10px;
    font-size: 11px;
  }

  .portal-home .portal-main {
    width: calc(100% - 24px);
    padding: 22px 0 44px;
  }

  .portal-home .home-hero {
    display: block;
    min-height: 0;
    padding: 0 2px 18px;
  }

  .portal-home .home-hero h1 {
    font-size: 29px;
  }

  .portal-home .home-status {
    margin-top: 16px;
    padding-left: 12px;
  }

  .portal-home .home-workspace {
    gap: 32px;
    margin-top: 28px;
  }

  .portal-home .module-group > header {
    margin-bottom: 12px;
  }

  .portal-home .module-list,
  .student-home-page .student-current-list,
  .teacher-home-page .module-list,
  .teacher-home-page .teacher-process-list,
  .teacher-home-page .teacher-lifecycle-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px 4px;
  }

  .portal-home .module-card,
  .teacher-home-page .module-card {
    min-height: 94px;
    padding: 9px 4px 8px;
  }

  .portal-home .module-card img,
  .teacher-home-page .module-card img {
    width: 46px;
    height: 46px;
  }

  .portal-home .module-card span {
    font-size: 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .portal-home *,
  .portal-home *::before,
  .portal-home *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
