* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

:root {
  --bg: #f4f7ff;
  --ink: #182136;
  --muted: #6e7b99;
  --line: #d7dfef;
  --card: #ffffff;
  --brand: #3A57E8;
  --brand-strong: #2f46bf;
  --brand-rgb: 58, 87, 232;
}

body {
  margin: 0;
  font-family: Inter, "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
  color: var(--ink);
  scroll-behavior: smooth;
  background:
    radial-gradient(circle at 0 0, #e7eeff 0%, transparent 45%),
    radial-gradient(circle at 100% 0, #eaf6ff 0%, transparent 40%),
    var(--bg);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 24px;
  background: rgba(16, 24, 39, 0.92);
  backdrop-filter: blur(8px);
  color: #f8fbff;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.brand {
  color: #f8fbff;
  text-decoration: none;
  font-size: 19px;
  font-weight: 700;
  white-space: nowrap;
}

.nav {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.nav a {
  color: #c8d5f5;
  text-decoration: none;
  padding: 6px 10px;
  border-radius: 8px;
  transition: 0.2s ease;
}

.nav a:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
}

.nav a.active {
  color: #fff;
  background: rgba(var(--brand-rgb), 0.35);
}

.topbar-right {
  display: flex;
  gap: 12px;
  align-items: center;
  white-space: nowrap;
}

.page {
  width: min(1240px, calc(100% - 40px));
  margin: 20px auto 28px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
  box-shadow: 0 8px 24px rgba(20, 32, 73, 0.06);
}

.hoverable-card {
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.hoverable-card:hover {
  transform: translateY(-4px);
  border-color: #bfd0f5;
  box-shadow: 0 12px 28px rgba(32, 60, 130, 0.12);
}

.eyebrow {
  margin: 0;
  font-size: 12px;
  letter-spacing: 0.08em;
  color: var(--brand);
  font-weight: 700;
  text-transform: uppercase;
}

.hero h1 {
  margin: 8px 0 10px;
  font-size: clamp(24px, 3.1vw, 36px);
  line-height: 1.25;
}

.hero p {
  margin: 0;
  color: #415074;
  line-height: 1.65;
}

.hero {
  display: grid;
  gap: 18px;
}

.hero-brand {
  display: grid;
  grid-template-columns: 180px 1fr;
  align-items: center;
  gap: 20px;
}

.hero-logo {
  width: 100%;
  max-width: 180px;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 24px;
  border: 1px solid #d6dffa;
  box-shadow: 0 18px 36px rgba(56, 73, 128, 0.14);
  background: #fff;
}

.hero-brand-copy h1 {
  margin: 6px 0 10px;
}

.hero-copy {
  padding-top: 14px;
  border-top: 1px dashed #d6def0;
}

.hero-copy h2 {
  margin: 0 0 8px;
  font-size: clamp(20px, 2vw, 28px);
  color: #20355f;
}

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

.role-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.role-card {
  min-height: 180px;
}

.role-tag {
  margin: 0 0 8px;
  display: inline-block;
  font-size: 12px;
  color: var(--brand);
  font-weight: 700;
  background: #edf1ff;
  border: 1px solid #c4cffd;
  border-radius: 999px;
  padding: 2px 10px;
}

.feature-card {
  text-decoration: none;
  color: inherit;
  background: #ffffff;
  border: 1px solid #d5def1;
  border-radius: 14px;
  padding: 16px;
  box-shadow: 0 8px 24px rgba(20, 32, 73, 0.06);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.feature-card:hover {
  transform: translateY(-6px);
  border-color: #b8caef;
  box-shadow: 0 16px 34px rgba(20, 50, 118, 0.15);
}

.feature-card h3 {
  margin: 0 0 8px;
}

.feature-card p {
  margin: 0 0 14px;
  color: #556487;
}

.feature-card span {
  color: var(--brand);
  font-weight: 600;
}

.quickstart ol {
  margin: 8px 0 0 20px;
  padding: 0;
  color: #47577b;
  line-height: 1.75;
}

.quickstart.compact {
  max-width: 820px;
}

.page-title-card p,
.subtle {
  margin: 6px 0 0;
  color: var(--muted);
  line-height: 1.55;
  font-size: 14px;
}

.auth-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.profile-section {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.inline-badge {
  display: inline-block;
  min-width: 68px;
  text-align: center;
  font-size: 12px;
  font-weight: 700;
  color: #1d3b73;
  background: #edf3ff;
  border: 1px solid #bed0f6;
  border-radius: 999px;
  padding: 4px 10px;
}

.inline-badge.user {
  color: #1d3b73;
  background: #edf3ff;
  border-color: #bed0f6;
}

.inline-badge.senior {
  color: #7b4d00;
  background: #fff4d3;
  border-color: #e9cf93;
}

.role-route {
  max-width: 620px;
}

.identity-card {
  border-radius: 16px;
  position: relative;
  overflow: hidden;
}

.identity-card::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.22;
}

.identity-card-user {
  border-color: #b8ccfb;
  background: linear-gradient(135deg, #ffffff 0%, #eef4ff 100%);
}

.identity-card-user::before {
  background: radial-gradient(circle at 100% 0, #82a9ff 0%, transparent 55%);
}

.identity-card-senior {
  border-color: #e3cc8f;
  background: linear-gradient(135deg, #fffef8 0%, #fff6da 100%);
}

.identity-card-senior::before {
  background: radial-gradient(circle at 100% 0, #f0c75a 0%, transparent 55%);
}

.identity-top {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
}

.identity-avatar {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 800;
  color: #fff;
}

.identity-card-user .identity-avatar {
  background: linear-gradient(145deg, #6f85f6 0%, var(--brand) 100%);
}

.identity-card-senior .identity-avatar {
  background: linear-gradient(145deg, #d19a20 0%, #b67c0f 100%);
}

.identity-label {
  margin: 0;
  font-size: 12px;
  letter-spacing: 0.04em;
  color: #556a9d;
  text-transform: uppercase;
  font-weight: 700;
}

#identityTitle {
  margin: 2px 0 0;
  font-size: 20px;
  color: #1d2f57;
}

.identity-card-senior #identityTitle {
  color: #5f3d05;
}

.identity-capability {
  position: relative;
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.identity-pill {
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(152, 174, 220, 0.5);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  color: #2c4578;
  font-weight: 600;
}

.role-switch {
  margin-top: 12px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.role-switch a {
  color: #2d4c93;
  text-decoration: none;
  border: 1px solid #c5d4f4;
  background: #f7faff;
  padding: 7px 11px;
  border-radius: 9px;
  font-size: 13px;
  transition: 0.2s ease;
}

.role-switch a:hover {
  border-color: #9cb7ef;
  background: #edf3ff;
}

.role-switch a.active {
  color: #fff;
  background: var(--brand);
  border-color: var(--brand);
}

.plain-link {
  color: var(--brand);
  text-decoration: none;
  font-weight: 600;
}

.floating-actions {
  position: fixed;
  right: 20px;
  bottom: 84px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 22;
}

.floating-btn {
  display: inline-block;
  text-decoration: none;
  color: #264177;
  background: #ffffff;
  border: 1px solid #b8caef;
  border-radius: 999px;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 700;
  box-shadow: 0 10px 24px rgba(20, 43, 92, 0.16);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.floating-btn:hover {
  transform: translateY(-2px);
  border-color: #91afe7;
  box-shadow: 0 14px 28px rgba(20, 43, 92, 0.2);
}

.floating-btn.primary {
  color: #ffffff;
  background: linear-gradient(135deg, var(--brand) 0%, #5f77f0 100%);
  border-color: var(--brand);
}

.chat-page {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 14px;
  height: calc(100vh - 96px);
  min-height: 0;
}

.chat-side {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
  overflow: hidden;
}

.chat-side-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.chat-core {
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-height: 0;
  height: 100%;
  overflow: hidden;
}

.chat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding-bottom: 10px;
  border-bottom: 1px solid #e5ebf7;
}

.chat-header h2 {
  margin: 0;
  color: #1d2f76;
}

.messages {
  padding: 14px 2px;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
}

.message {
  padding: 10px 12px;
  border-radius: 12px;
  line-height: 1.58;
  white-space: pre-wrap;
}

.message.user {
  background: #edf1ff;
  align-self: flex-end;
  max-width: min(86%, 780px);
}

.message.assistant {
  background: #f4f7ff;
  align-self: flex-start;
  max-width: min(98%, 980px);
}

.message .refs {
  margin-top: 8px;
  border-top: 1px dashed #c7d3ec;
  padding-top: 8px;
  font-size: 12px;
  color: #33476e;
}

.mentor-title {
  margin: 0 0 10px;
  font-size: 14px;
  font-weight: 700;
  color: #1f3563;
}

.mentor-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 12px;
}

.mentor-card {
  position: relative;
  border: 1px solid #c6d6f6;
  background: linear-gradient(160deg, #ffffff 0%, #f2f7ff 70%, #edf3ff 100%);
  border-radius: 16px;
  padding: 14px 14px 12px;
  box-shadow: 0 10px 24px rgba(35, 68, 132, 0.11);
  transition: transform 0.2s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}

.mentor-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 4px;
  background: linear-gradient(90deg, var(--brand) 0%, #647af0 60%, #8fa0f6 100%);
  border-top-left-radius: 16px;
  border-top-right-radius: 16px;
}

.mentor-card:hover {
  transform: translateY(-3px);
  border-color: #9eb8ec;
  box-shadow: 0 16px 30px rgba(36, 76, 156, 0.16);
}

.mentor-header h5 {
  margin: 0;
  font-size: 17px;
  line-height: 1.3;
  color: #12274f;
  letter-spacing: 0.01em;
}

.mentor-header p {
  margin: 4px 0 0;
  font-size: 13px;
  color: #4e69a3;
  font-weight: 500;
}

.mentor-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 10px;
}

.mentor-chip {
  display: inline-block;
  font-size: 12px;
  color: #274982;
  background: #eaf2ff;
  border: 1px solid #bdd0f8;
  border-radius: 999px;
  padding: 3px 10px;
  font-weight: 600;
}

.mentor-why {
  margin: 11px 0 0;
  font-size: 13px;
  color: #1f3767;
  line-height: 1.65;
}

.mentor-refs-line {
  margin: 10px 0 0;
  font-size: 12px;
  color: #455f96;
  line-height: 1.6;
  padding-top: 8px;
  border-top: 1px dashed #c8d6f3;
}

.mentor-card-clickable {
  cursor: pointer;
}

.mentor-card-clickable:focus-visible {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(var(--brand-rgb), 0.2);
}

.mentor-action-hint {
  margin: 9px 0 0;
  color: var(--brand);
  font-weight: 700;
  font-size: 12px;
}

.private-list-item {
  border-left: 3px solid var(--brand);
}

body.modal-open {
  overflow: hidden;
}

.private-chat-modal {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 20px;
}

.private-chat-mask {
  position: absolute;
  inset: 0;
  background: rgba(15, 22, 44, 0.58);
  backdrop-filter: blur(4px);
}

.private-chat-panel {
  position: relative;
  z-index: 1;
  width: min(860px, 100%);
  height: min(80vh, 720px);
  display: grid;
  grid-template-rows: auto 1fr auto;
  border-radius: 18px;
  border-color: #cad3f7;
  box-shadow: 0 20px 44px rgba(13, 26, 63, 0.35);
}

.private-chat-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid #e4e9f8;
}

.private-chat-header h3 {
  margin: 0;
  color: #1e2f77;
}

.private-chat-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.private-action-btn {
  position: relative;
  width: 38px;
  height: 38px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  border: 1px solid #c3d0fb;
  background: linear-gradient(180deg, #f7f9ff 0%, #ecf1ff 100%);
  color: #2f46bf;
  box-shadow: 0 8px 18px rgba(var(--brand-rgb), 0.2);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  animation: floatPulse 2.8s ease-in-out infinite;
}

.private-action-btn svg {
  width: 18px;
  height: 18px;
}

.private-action-btn:hover {
  transform: translateY(-3px);
  border-color: var(--brand);
  box-shadow: 0 12px 24px rgba(var(--brand-rgb), 0.28);
}

.private-action-btn:focus-visible {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(var(--brand-rgb), 0.2);
}

.private-action-btn::after {
  content: attr(data-tooltip);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 10px);
  transform: translateX(-50%) translateY(4px);
  padding: 6px 9px;
  border-radius: 8px;
  background: rgba(21, 31, 65, 0.94);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.16s ease, transform 0.16s ease;
  box-shadow: 0 10px 18px rgba(10, 16, 38, 0.22);
}

.private-action-btn::before {
  content: "";
  position: absolute;
  left: 50%;
  bottom: calc(100% + 4px);
  width: 8px;
  height: 8px;
  background: rgba(21, 31, 65, 0.94);
  transform: translateX(-50%) rotate(45deg) scale(0.92);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.16s ease, transform 0.16s ease;
}

.private-action-btn:hover::after,
.private-action-btn:focus-visible::after {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.private-action-btn:hover::before,
.private-action-btn:focus-visible::before {
  opacity: 1;
  transform: translateX(-50%) rotate(45deg) scale(1);
}

.private-action-btn:nth-child(2) {
  animation-delay: 0.18s;
}

.private-messages {
  padding: 14px 2px;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
}

.private-loading {
  margin: 8px 0;
  color: #5d6f99;
  font-size: 13px;
}

.private-ask-bar {
  border-top: 1px solid #e4e9f8;
}

@keyframes floatPulse {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-2px);
  }
}

.ask-bar {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  padding-top: 12px;
  border-top: 1px solid #e5ebf7;
}

.knowledge-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.full-width {
  grid-column: 1 / -1;
}

form {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

input,
textarea,
select,
button {
  border-radius: 10px;
  border: 1px solid #c8d5ee;
  padding: 9px 11px;
  font-size: 14px;
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: #7ea1ef;
  box-shadow: 0 0 0 3px rgba(var(--brand-rgb), 0.2);
}

button {
  cursor: pointer;
  background: var(--brand);
  color: #fff;
  border-color: var(--brand);
  transition: transform 0.15s ease, background 0.2s ease, box-shadow 0.2s ease;
}

button:hover {
  transform: translateY(-1px);
  background: var(--brand-strong);
  box-shadow: 0 8px 20px rgba(var(--brand-rgb), 0.3);
}

button.secondary {
  background: transparent;
  border-color: #8aa1cf;
  color: #e5ecff;
}

button.secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  box-shadow: none;
}

.list {
  display: flex;
  flex-direction: column;
  gap: 7px;
  overflow: auto;
  min-height: 0;
}

.conversation-section {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.conversation-section-title {
  margin: 0;
  font-size: 12px;
  color: #5b6b95;
  font-weight: 700;
}

.list-item {
  padding: 9px 11px;
  border: 1px solid #d7deea;
  border-radius: 10px;
  cursor: pointer;
  background: #fafcff;
  font-size: 13px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: transform 0.15s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.list-item-header {
  display: flex;
  align-items: center;
  gap: 6px;
}

.list-type-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
}

.list-type-badge.private {
  background: #edf1ff;
  color: var(--brand);
}

.list-type-badge.ai {
  background: #eff2fb;
  color: #4f5f8e;
}

.list-item-title {
  font-weight: 700;
  color: #1f2f57;
}

.list-item-meta {
  font-size: 12px;
  color: #6f7fa7;
}

.list-item:hover {
  transform: translateY(-1px);
  border-color: #b3c7ee;
  box-shadow: 0 8px 18px rgba(32, 60, 130, 0.11);
}

.list-item.active {
  border-color: var(--brand);
  background: #edf1ff;
}

.list-empty {
  margin: 8px 0;
  color: #68789f;
  font-size: 13px;
  line-height: 1.5;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  background: #182848;
  color: #fff;
  padding: 10px 14px;
  border-radius: 10px;
  box-shadow: 0 12px 24px rgba(10, 20, 42, 0.24);
}

.hidden {
  display: none;
}

@media (max-width: 1100px) {
  .feature-grid,
  .auth-grid,
  .knowledge-grid,
  .chat-page {
    grid-template-columns: 1fr;
  }

  .hero-brand {
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: center;
  }

  .chat-page {
    height: auto;
  }

  .chat-core {
    min-height: 68vh;
  }

  .private-chat-panel {
    height: min(84vh, 760px);
  }
}

@media (max-width: 780px) {
  .topbar {
    flex-wrap: wrap;
    justify-content: center;
  }

  .page {
    width: calc(100% - 20px);
    margin-top: 12px;
  }

  .floating-actions {
    right: 12px;
    bottom: 72px;
  }

  .floating-btn {
    font-size: 12px;
    padding: 8px 12px;
  }

  .private-chat-modal {
    padding: 12px;
  }

  .private-chat-panel {
    height: min(88vh, 800px);
  }

  .private-chat-header {
    flex-direction: column;
  }

  .private-chat-actions {
    width: 100%;
    justify-content: flex-end;
  }
}
