.portal-login-page { padding: 48px 0 80px; min-height: 60vh; }
.portal-login-card {
  width: min(440px, 100%);
  margin: 0 auto;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 28px 24px 32px;
  box-shadow: var(--shadow);
}
.portal-error {
  background: #fde8e8;
  color: #b42318;
  padding: 10px 14px;
  border-radius: 12px;
}
.portal { padding: 28px 0 72px; }
.portal-wrap {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 28px;
  align-items: start;
}
.portal-main { min-width: 0; }
.portal-side {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 22px 18px;
  box-shadow: var(--shadow);
  position: sticky;
  top: 92px;
}
.portal-side h2 { font-size: 1.35rem; margin-bottom: 4px; }
.portal-jump { display: none; }
.portal-nav { display: grid; gap: 6px; margin-top: 18px; }
.portal-nav a {
  text-decoration: none;
  color: var(--muted);
  font-weight: 700;
  padding: 10px 12px;
  border-radius: 12px;
}
.portal-nav a.on, .portal-nav a:hover {
  background: var(--brand-soft);
  color: var(--brand-dark);
}
.portal-main h1 { margin-bottom: 18px; }
.portal-hero-row, .portal-attend-nums, .portal-skills, .portal-modules, .portal-list, .portal-timeline {
  display: grid;
  gap: 14px;
}
.portal-timeline {
  position: relative;
  padding-left: 22px;
}
.portal-timeline::before {
  content: '';
  position: absolute;
  left: 6px;
  top: 10px;
  bottom: 10px;
  width: 3px;
  border-radius: 99px;
  background: linear-gradient(#4c9dff, #e8f1fd);
}
.portal-timeline .portal-card { position: relative; }
.portal-timeline .portal-card::before {
  content: '';
  position: absolute;
  left: -21px;
  top: 22px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--brand);
  box-shadow: 0 0 0 4px #e8f1fd;
}
.portal-hero-row, .portal-attend-nums {
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  margin-bottom: 28px;
}
.portal-stat, .portal-attend-nums article, .portal-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 18px;
  box-shadow: var(--shadow);
}
.portal-stat strong, .portal-attend-nums strong {
  display: block;
  font-size: 1.55rem;
  color: var(--brand);
  line-height: 1.2;
  overflow-wrap: anywhere;
}
.portal-stat span, .portal-attend-nums span { color: var(--muted); font-size: 0.9rem; }
.portal-card-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
}
.portal-card h3 { margin: 0 0 8px; }
.portal-date { color: var(--muted); font-size: 0.88rem; }
.portal-bar {
  height: 10px;
  background: var(--brand-soft);
  border-radius: 999px;
  overflow: hidden;
  margin: 10px 0 6px;
}
.portal-bar span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #4c9dff, var(--brand));
  border-radius: 999px;
}
.portal-pct { font-weight: 800; color: var(--brand); margin: 0; }
.portal-badge {
  display: inline-flex;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 700;
}
.portal-badge.ok { background: #e7f8f0; color: #0f9d73; }
.portal-badge.mid { background: #fff6e5; color: #b54708; }
.portal-badge.bad { background: #fde8e8; color: #b42318; }
.portal-badge.wait { background: #fff4e5; color: #c2410c; }
.portal-card.is-done { border-color: #b7ecd4; }
.portal-card.is-current { outline: 2px solid var(--brand); }
.portal-attend {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 24px;
  align-items: center;
  margin-bottom: 32px;
}
.portal-ring-wrap { text-align: center; }
.portal-ring { width: 180px; height: 180px; filter: drop-shadow(0 10px 18px rgba(26, 115, 232, 0.18)); }
.portal-login-card h1 { font-size: clamp(1.7rem, 3vw, 2.3rem); }
.portal-modules { grid-template-columns: 1fr 1fr; }
.portal-month-cal { margin-bottom: 16px; }
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}
.cal-head { margin: 8px 0 6px; color: var(--muted); font-size: 0.75rem; text-align: center; font-weight: 700; }
.cal-cell {
  min-height: 36px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-size: 0.85rem;
  background: #f4f7fb;
  color: var(--muted);
}
.cal-cell.empty { background: transparent; }
.cal-cell.in { background: #e8f1fd; color: #152033; }
.cal-cell.start, .cal-cell.end { background: #1a73e8; color: #fff; font-weight: 800; }
.range-cal { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; margin: 0 0 16px; }
.range-month h3 { margin: 0 0 8px; font-size: 1rem; }
.cal-cell.present { background: #e7f8f0; color: #0f9d73; font-weight: 800; }
.cal-cell.absent { background: #fde8e8; color: #b42318; font-weight: 800; }
.portal-project-links { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 0; }
.skill-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 28px;
}
.skill-sum {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 16px;
  text-align: center;
  box-shadow: var(--shadow);
}
.skill-sum strong { display: block; font-size: 1.8rem; }
.skill-sum.full strong { color: #0f9d73; }
.skill-sum.partial strong { color: #c2410c; }
.skill-sum.missing strong { color: #5c6b82; }
.skill-board {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 18px;
  align-items: start;
}
.skill-board h2 { font-size: 1.15rem; }
.skill-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}
.skill-chip {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 16px;
  text-align: center;
  box-shadow: var(--shadow);
}
.skill-chip h3 { margin: 10px 0 4px; font-size: 1rem; }
.skill-chip p { margin: 0; font-size: 0.85rem; }
.skill-chip.full { border-color: #b7ecd4; }
.skill-chip.partial { border-color: #f6d3b1; }
.skill-chip.missing { border-style: dashed; }
.skill-orb {
  --p: 0;
  width: 84px;
  height: 84px;
  margin: 0 auto;
  border-radius: 50%;
  background: conic-gradient(#1a73e8 calc(var(--p) * 1%), #e8f1fd 0);
  display: grid;
  place-items: center;
}
.skill-chip.full .skill-orb { background: conic-gradient(#0f9d73 calc(var(--p) * 1%), #e7f8f0 0); }
.skill-chip.partial .skill-orb { background: conic-gradient(#c2410c calc(var(--p) * 1%), #fff4e5 0); }
.skill-orb span {
  width: 62px;
  height: 62px;
  border-radius: 50%;
  background: #fff;
  display: grid;
  place-items: center;
  font-weight: 800;
}
.skill-orb.open { background: #eef2f7; }
.portal-modules ul { margin: 0; padding-left: 18px; color: var(--muted); }
.portal-course-tree { display: grid; gap: 16px; }
.portal-month h3 { margin: 0; }
.portal-month h4 { margin: 0; font-size: 1.05rem; }
.portal-week {
  margin-top: 14px;
  padding-left: 16px;
  border-left: 3px solid var(--brand-soft);
}
.portal-day {
  background: var(--bg-soft);
  border-radius: 14px;
  padding: 12px 14px;
  margin-top: 8px;
}
.portal-day ul { margin: 8px 0 0; padding-left: 18px; color: var(--muted); }
.admin-table-wrap { overflow: auto; background: #fff; border: 1px solid var(--line); border-radius: 16px; margin: 12px 0 28px; }
.admin-table-wrap table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.admin-table-wrap th, .admin-table-wrap td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; }
@media (max-width: 900px) {
  .portal { padding: 16px 0 56px; }
  .portal-wrap,
  .portal-attend,
  .portal-modules,
  .portal-hero-row,
  .portal-attend-nums,
  .skill-board,
  .skill-summary,
  .range-cal {
    grid-template-columns: 1fr;
  }
  .portal-side {
    position: sticky;
    top: calc(74px + env(safe-area-inset-top));
    z-index: 8;
    padding: 14px;
    border-radius: 18px;
    overflow: visible;
  }
  .portal-side > .muted { display: none; }
  .portal-side h2 {
    margin: 0 0 10px;
    font-size: 1.1rem;
    overflow-wrap: anywhere;
    white-space: normal;
  }
  .portal-nav { display: none; }
  .portal-jump {
    display: grid;
    gap: 6px;
    margin: 0;
    font-weight: 700;
    color: var(--brand, #1a73e8);
  }
  .portal-jump select {
    width: 100%;
    min-height: 48px;
    border: 1px solid var(--line, #e4ebf4);
    border-radius: 14px;
    padding: 12px 14px;
    font: inherit;
    font-size: 16px;
    font-weight: 600;
    color: var(--text, #152033);
    background: #fff;
    appearance: none;
    background-image:
      linear-gradient(45deg, transparent 50%, #5c6b82 50%),
      linear-gradient(135deg, #5c6b82 50%, transparent 50%);
    background-position:
      calc(100% - 18px) calc(50% - 3px),
      calc(100% - 12px) calc(50% - 3px);
    background-size: 6px 6px;
    background-repeat: no-repeat;
  }
  .portal-login-page { padding: 20px 0 48px; }
  .portal-login-card {
    width: 100%;
    max-width: none;
    padding: 22px 16px 24px;
  }
  .portal-login-card .btn,
  .portal-project-links .btn {
    width: 100%;
    min-height: 48px;
  }
  .portal-project-links {
    flex-direction: column;
    align-items: stretch;
  }
  .portal-main h1 { font-size: 1.5rem; margin-bottom: 14px; }
  .portal-card-top {
    flex-direction: column;
    align-items: flex-start;
  }
  .portal-stat,
  .portal-attend-nums article,
  .portal-card {
    width: 100%;
    min-width: 0;
  }
  .portal-timeline { padding-left: 16px; }
  .cal-grid { gap: 3px; width: 100%; }
  .cal-head { font-size: 0.68rem; }
  .cal-cell {
    min-height: 34px;
    min-width: 0;
    font-size: 0.78rem;
    border-radius: 8px;
  }
  .portal-ring {
    width: min(180px, 70vw);
    height: auto;
    aspect-ratio: 1;
    margin: 0 auto;
  }
}
