.portal-page {
  background: #f5f6f5;
  color: var(--ink);
}

.portal-main {
  width: min(1180px, calc(100% - 40px));
  margin: 76px auto 80px;
}

.portal-intro {
  padding: 72px 68px;
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 40px;
  background: var(--ink);
  color: #fff;
}

.portal-intro .section-kicker,
.case-library-intro .section-kicker {
  color: #ee6a6f;
}

.portal-intro h1 {
  margin: 0;
  font-size: clamp(44px, 7vw, 78px);
  line-height: 1.05;
}

.portal-intro-copy {
  max-width: 520px;
  margin: 22px 0 0;
  color: #d6dadd;
  font-size: 18px;
}

.portal-intro-meta {
  display: grid;
  grid-template-columns: repeat(2, auto);
  gap: 10px 22px;
  color: #aeb5ba;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .08em;
}

.portal-section {
  padding: 68px 0;
}

.portal-section-title {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 30px;
  margin-bottom: 30px;
}

.portal-section-title.compact-title {
  align-items: start;
}

.portal-section-title h2 {
  margin: 0;
  font-size: 38px;
}

.portal-section-title > p {
  max-width: 420px;
  margin: 29px 0 0;
  color: var(--muted);
}

.portal-product-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
}

.portal-product,
.content-card {
  background: #fff;
  border: 1px solid var(--line);
  padding: 25px;
}

.portal-product {
  min-height: 250px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 30px;
  border: 0;
  text-decoration: none;
  transition: background-color .2s ease, box-shadow .2s ease, transform .2s ease;
}

.portal-product:hover {
  position: relative;
  z-index: 1;
  background: #fafafa;
  box-shadow: 0 14px 30px rgba(25, 29, 33, .1);
  transform: translateY(-3px);
}

.portal-product b {
  margin-top: 30px;
  font-size: 27px;
  line-height: 1.35;
}

.portal-product > span:not(.portal-product-index) {
  color: var(--muted);
}

.portal-product i {
  margin-top: auto;
  color: var(--red);
  font-style: normal;
  font-weight: 700;
}

.portal-product-index {
  color: var(--red);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .04em;
}

.portal-product.course { box-shadow: inset 4px 0 0 #b51218; }
.portal-product.zhiku { box-shadow: inset 4px 0 0 #2d6c70; }
.portal-product.alliance { box-shadow: inset 4px 0 0 #b47a39; }
.portal-product.cases { box-shadow: inset 4px 0 0 #52677a; }

.recommendation-block {
  display: grid;
  grid-template-columns: 210px minmax(0, 1fr);
  gap: 34px;
  padding: 36px 0;
  border-top: 1px solid var(--line);
}

.recommendation-block:first-of-type {
  border-top: 3px solid var(--ink);
}

.recommendation-heading {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  margin: 0;
}

.recommendation-heading > div {
  display: block;
}

.recommendation-heading h3 {
  margin: 10px 0 0;
  font-size: 25px;
}

.recommendation-number {
  color: var(--red);
  font-size: 13px;
  font-weight: 800;
}

.recommendation-heading a {
  margin-top: auto;
  color: var(--red);
  font-size: 13px;
  font-weight: 800;
}

.portal-content-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.content-card {
  min-height: 210px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.content-card > span,
.content-card small {
  color: var(--red);
  font-size: 12px;
}

.content-card h3,
.case-card h2 {
  margin: 12px 0 8px;
  font-size: 18px;
  line-height: 1.45;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}

.content-card p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  overflow: hidden;
}

.content-card small { margin-top: auto; padding-top: 18px; }

.portal-loading,
.portal-empty,
.account-locked {
  padding: 35px;
  background: #fff;
  border: 1px solid var(--line);
  color: var(--muted);
}

.portal-content-grid > .portal-loading,
.portal-content-grid > .portal-empty {
  grid-column: 1 / -1;
  min-height: 160px;
  display: grid;
  place-items: center;
  text-align: center;
}

.account-summary { display: flex; align-items: center; gap: 16px; padding: 24px; background: #fff; border-bottom: 1px solid var(--line); }
.account-summary h3 { margin: 0; }
.account-summary p { margin: 4px 0; color: var(--muted); }
.account-avatar { width: 52px; height: 52px; display: grid; place-items: center; background: var(--red); color: #fff; font-size: 24px; }
.account-metrics { display: grid; grid-template-columns: repeat(3, 1fr); background: #fff; }
.account-metrics span { padding: 20px; border-right: 1px solid var(--line); }
.account-metrics b, .account-metrics small { display: block; }
.account-metrics small { margin-top: 5px; color: var(--muted); }
.profile-form { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; padding: 24px; background: #fff; }
.profile-form label { font-weight: 700; }
.profile-form input { display: block; width: 100%; margin-top: 6px; padding: 11px; border: 1px solid var(--line); }
.profile-form button { grid-column: 1; }
.form-status { align-self: center; color: var(--red); }

.case-library-toolbar { display: flex; gap: 12px; margin-bottom: 24px; }
.case-search { flex: 1; max-width: 560px; height: 44px; display: flex; align-items: center; gap: 10px; padding: 0 14px; background: #fff; border: 1px solid var(--line); }
.case-search span { color: var(--red); font-size: 20px; }
.case-search input { width: 100%; border: 0; outline: 0; background: transparent; }
.case-card h2 { font-size: 21px; }
.case-card p { min-height: 48px; }
.case-library-intro { background: var(--teal); }
.case-library-intro .section-kicker { color: #a9d3d0; }

.portal-nav-action { border: 1px solid var(--red); background: var(--red); color: #fff; font: inherit; cursor: pointer; padding: 9px 16px; font-weight: 700; }
.portal-nav-action:hover { background: var(--red-dark); }
.code-row { display: flex; gap: 8px; margin-top: 6px; }
.code-row input { flex: 1 !important; margin-top: 0 !important; }
.code-button { border: 1px solid var(--line); background: #f5f6f5; padding: 0 10px; cursor: pointer; white-space: nowrap; }
#login-dialog { border: 0; padding: 0; width: min(440px, calc(100% - 32px)); box-shadow: 0 20px 70px #0003; }
#login-dialog::backdrop { background: #111a; backdrop-filter: blur(3px); }
#login-form { position: relative; display: grid; gap: 14px; padding: 34px; }
#login-form h2 { margin: 0; font-size: 28px; }
#login-form label { font-weight: 700; }
#login-form input { display: block; width: 100%; margin-top: 7px; padding: 12px; border: 1px solid var(--line); }
.dialog-help { color: var(--muted); font-size: 13px; }
.dialog-close { position: absolute; right: 16px; top: 12px; border: 0; background: none; font-size: 28px; cursor: pointer; }
.login-error { min-height: 20px; color: var(--red); font-size: 13px; }

@media (max-width: 800px) {
  .portal-main { width: min(calc(100% - 28px), 620px); }
  .portal-nav a:nth-child(2), .portal-nav a:nth-child(3) { display: none; }
  .portal-intro { padding: 48px 26px; display: block; }
  .portal-intro-meta { margin-top: 34px; }
  .portal-section-title { display: block; }
  .portal-section-title > p { margin-top: 10px; }
  .portal-product-grid, .portal-content-grid { grid-template-columns: 1fr; }
  .recommendation-block { display: block; padding: 30px 0; }
  .recommendation-heading { display: flex; flex-direction: row; align-items: end; justify-content: space-between; margin-bottom: 18px; }
  .recommendation-heading a { margin-top: 0; }
  .account-locked { align-items: flex-start; flex-direction: column; }
  .profile-form { grid-template-columns: 1fr; }
  .profile-form button { grid-column: auto; }
  .case-library-toolbar { align-items: stretch; flex-direction: column; }
  .case-search { max-width: none; }
}
