:root {
  color-scheme: light;
  --bg: #f4f6fb;
  --surface: #ffffff;
  --text: #1c2434;
  --muted: #6b7280;
  --primary: #3b82f6;
  --primary-dark: #1d4ed8;
  --accent: #8b5cf6;
  --border: #e5e7eb;
  --shadow: 0 12px 30px rgba(15, 23, 42, 0.08);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: "PingFang SC", "Microsoft YaHei", sans-serif;
}

body {
  background: var(--bg);
  color: var(--text);
}

a {
  color: var(--primary);
  text-decoration: none;
}

.muted {
  color: var(--muted);
  font-size: 0.9rem;
}

.hidden {
  display: none !important;
}

.notice {
  border-radius: 12px;
  padding: 0.75rem 1rem;
  background: #eef2ff;
  color: #4338ca;
  font-size: 0.9rem;
}

.notice.error {
  background: #fee2e2;
  color: #b91c1c;
}

.notice.success {
  background: #dcfce7;
  color: #166534;
}

.button {
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 0.55rem 1rem;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  font-size: 0.9rem;
  transition: all 0.2s ease;
}

.button:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.08);
}

.button.primary {
  background: var(--primary);
  color: #fff;
}

.button.primary:hover {
  background: var(--primary-dark);
}

.button.ghost {
  background: transparent;
  border-color: var(--border);
}

.auth-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.auth {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 2.5rem;
  width: min(1100px, 100%);
  background: var(--surface);
  border-radius: 24px;
  box-shadow: var(--shadow);
  padding: 2.5rem;
}

.auth-visual {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.auth-badge {
  background: rgba(59, 130, 246, 0.12);
  color: var(--primary);
  padding: 0.4rem 0.8rem;
  border-radius: 999px;
  font-weight: 600;
  width: fit-content;
}

.auth-visual h1 {
  font-size: 2.1rem;
}

.auth-subtitle {
  color: var(--muted);
  line-height: 1.6;
}

.auth-illustration {
  position: relative;
  height: 240px;
  border-radius: 20px;
  background: linear-gradient(135deg, #e0f2fe, #eef2ff);
  overflow: hidden;
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(2px);
  opacity: 0.8;
}

.orb-lg {
  width: 160px;
  height: 160px;
  background: rgba(59, 130, 246, 0.35);
  top: 20px;
  left: -30px;
}

.orb-md {
  width: 120px;
  height: 120px;
  background: rgba(139, 92, 246, 0.35);
  right: -20px;
  bottom: 30px;
}

.orb-sm {
  width: 80px;
  height: 80px;
  background: rgba(14, 165, 233, 0.35);
  left: 50%;
  top: 50%;
}

.grid {
  position: absolute;
  inset: 0;
  background-image: linear-gradient(rgba(255, 255, 255, 0.5) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.5) 1px, transparent 1px);
  background-size: 28px 28px;
}

.auth-highlights {
  list-style: none;
  display: grid;
  gap: 0.8rem;
}

.auth-highlights li {
  background: #f8fafc;
  border-radius: 12px;
  padding: 0.8rem 1rem;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  justify-content: center;
}

.auth-card {
  background: #f9fafb;
  border-radius: 20px;
  padding: 2rem;
  border: 1px solid var(--border);
}

.form {
  display: grid;
  gap: 1rem;
  margin-top: 1.5rem;
}

.field {
  display: grid;
  gap: 0.4rem;
  font-size: 0.9rem;
}

.field input {
  border-radius: 10px;
  border: 1px solid var(--border);
  padding: 0.6rem 0.8rem;
  font-size: 1rem;
}

.form-footer {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  margin-top: 0.5rem;
}

.form-hint {
  font-size: 0.85rem;
  margin-top: 0.4rem;
}

.auth-links {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
}

.auth-tip {
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
}

.dashboard-body {
  min-height: 100vh;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.2rem 2rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 5;
}

.brand {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.brand-with-nav {
  gap: 1.2rem;
}

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: var(--primary);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 700;
}

.brand span {
  display: block;
  font-size: 0.85rem;
  color: var(--muted);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.module-nav {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-left: 0.2rem;
  padding: 0.3rem;
  background: #eef2ff;
  border-radius: 999px;
}

.module-link {
  color: #334155;
  font-size: 0.86rem;
  border-radius: 999px;
  padding: 0.45rem 0.85rem;
  border: 1px solid transparent;
  transition: all 0.2s ease;
}

.module-link:hover {
  background: #dbeafe;
}

.module-link.active {
  color: #1d4ed8;
  background: #fff;
  border-color: #bfdbfe;
  font-weight: 600;
}

.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #f1f5f9;
  display: grid;
  place-items: center;
  font-weight: 600;
}

.layout {
  display: grid;
  grid-template-columns: 1fr 3fr;
  gap: 1.5rem;
  padding: 2rem;
}

.sidebar {
  display: grid;
  gap: 1.5rem;
}

.panel {
  background: var(--surface);
  border-radius: 16px;
  padding: 1.5rem;
  box-shadow: var(--shadow);
}

.filter-panel {
  display: grid;
  gap: 1rem;
}

.filter-scroll {
  display: grid;
  gap: 1rem;
  max-height: 420px;
  overflow-y: auto;
  padding-right: 0.4rem;
}

.filter-scroll::-webkit-scrollbar {
  width: 6px;
}

.filter-scroll::-webkit-scrollbar-thumb {
  background: #cbd5f5;
  border-radius: 999px;
}

.panel h3 {
  margin-bottom: 1rem;
}

.filter-group {
  display: grid;
  gap: 0.4rem;
  margin-bottom: 0.6rem;
}

.filter-group:last-child {
  margin-bottom: 0;
}

.pill-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.pill {
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  background: #eef2ff;
  font-size: 0.8rem;
  cursor: pointer;
}

.pill.active {
  background: var(--primary);
  color: #fff;
}

.upload-panel {
  gap: 1rem;
}

.upload-filename {
  font-size: 0.85rem;
  color: var(--muted);
}

.tag-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.8rem;
}

.tag-group {
  display: grid;
  gap: 0.6rem;
}

.field textarea {
  border-radius: 10px;
  border: 1px solid var(--border);
  padding: 0.6rem 0.8rem;
  font-size: 1rem;
  resize: vertical;
}

.admin-panel {
  border: 1px dashed var(--border);
}

.list {
  display: grid;
  gap: 0.6rem;
  padding-left: 1rem;
}

.upload-area {
  display: grid;
  place-items: center;
  padding: 1.5rem;
  border: 1px dashed var(--border);
  border-radius: 14px;
  text-align: center;
  cursor: pointer;
  gap: 0.5rem;
}

.upload-area input {
  display: none;
}

.tag-input {
  display: grid;
  gap: 0.5rem;
  padding: 0.6rem;
  border: 1px solid var(--border);
  border-radius: 12px;
}

.tag {
  background: #e0f2fe;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.8rem;
  cursor: pointer;
}

.tag-select {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.5rem 0.6rem;
  font-size: 0.9rem;
  background: #fff;
  width: 100%;
}

.tag-selected {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.content {
  display: grid;
  gap: 1.5rem;
}

.content-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.search-group {
  display: flex;
  gap: 0.6rem;
}

.search-group input {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.5rem 0.7rem;
  min-width: 220px;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(435px, 435px));
  justify-content: center;
  gap: 1.2rem;
  min-height: 440px;
}

.data-card {
  background: var(--surface);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: var(--shadow);
  display: grid;
  grid-template-rows: 350px auto auto;
  width: 435px;
  height: auto;
}

.data-card .card-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.8rem 1rem 1rem;
  gap: 0.5rem;
}

.data-card .card-actions .button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 92px;
  height: 42px;
  padding: 0 1rem;
  flex: 0 0 auto;
}

.cover {
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 600;
  background-size: cover;
  min-height: 180px;
}

.cover.has-image {
  color: transparent;
  cursor: zoom-in;
}

.cover.has-image span {
  opacity: 0;
}

.cover-blue {
  background: linear-gradient(135deg, #0ea5e9, #3b82f6);
}

.cover-green {
  background: linear-gradient(135deg, #10b981, #22c55e);
}

.cover-purple {
  background: linear-gradient(135deg, #8b5cf6, #6366f1);
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  z-index: 2000;
}

.modal-content {
  position: relative;
  background: #fff;
  border-radius: 16px;
  padding: 1rem;
  max-width: 90vw;
  max-height: 90vh;
  box-shadow: var(--shadow);
}

.modal-content img {
  max-width: 100%;
  max-height: 80vh;
  display: block;
  object-fit: contain;
}

.modal-close {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  border: none;
  background: rgba(15, 23, 42, 0.1);
  color: var(--text);
  border-radius: 999px;
  width: 32px;
  height: 32px;
  font-size: 1.2rem;
  cursor: pointer;
}

.card-body {
  padding: 1rem;
  display: grid;
  gap: 0.25rem;
}

.card-tags {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  font-size: 0.75rem;
  color: var(--muted);
  line-height: 1.2;
  font-weight: 700;
}

.card-actions {
  display: flex;
  justify-content: space-between;
  padding: 0.8rem 1rem 1rem;
  gap: 0.5rem;
}

.detail-panel {
  background: var(--surface);
  border-radius: 16px;
  padding: 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: var(--shadow);
}

.detail-actions {
  display: flex;
  gap: 0.8rem;
}

.info-list {
  display: grid;
  gap: 1rem;
  margin-bottom: 1.2rem;
}

.info-list p {
  margin-top: 0.4rem;
  font-weight: 600;
}

.file-list {
  list-style: none;
  display: grid;
  gap: 0.8rem;
}

.file-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #f8fafc;
  border-radius: 10px;
  padding: 0.6rem 0.9rem;
}

.placeholder {
  display: grid;
  gap: 0.8rem;
  min-height: 260px;
  align-content: center;
  text-align: center;
}

.table-wrapper {
  background: var(--surface);
  border-radius: 16px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

.table thead {
  background: #f8fafc;
}

.table th,
.table td {
  padding: 0.9rem 1rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
}

.table tbody tr:hover {
  background: #f9fafb;
}

.table-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.invite-list {
  display: grid;
  gap: 0.6rem;
  margin-top: 1rem;
}

.invite-code {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #f8fafc;
  border-radius: 10px;
  padding: 0.6rem 0.9rem;
  font-size: 0.9rem;
}

.chip {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  background: #e0f2fe;
  font-size: 0.75rem;
  color: #0369a1;
}

.pagination {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.4rem 0 0;
}

.pagination button {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.4rem 0.75rem;
  background: var(--surface);
  cursor: pointer;
}

.pagination button.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

@media (max-width: 960px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .card-grid {
    grid-template-columns: 1fr;
    justify-items: center;
  }

  .content-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .topbar {
    flex-direction: column;
    gap: 1rem;
    align-items: flex-start;
  }

  .module-nav {
    flex-wrap: wrap;
  }
}

.research-layout {
  grid-template-columns: 1fr;
}

.research-layout.admin-layout {
  grid-template-columns: minmax(280px, 360px) 1fr;
}

.research-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
  min-height: 760px;
}

.research-card {
  background: var(--surface);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: var(--shadow);
  display: grid;
  grid-template-rows: 450px auto auto;
  min-height: auto;
}

.research-meta {
  padding: 0.8rem 0.9rem;
  display: grid;
  gap: 0.35rem;
}

.research-meta h3 {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 1rem;
}

.research-meta p {
  font-size: 0.85rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.research-detail-layout {
  grid-template-columns: 1fr;
}

.methods-layout {
  grid-template-columns: minmax(280px, 340px) 1fr;
}

.methods-sidebar {
  display: grid;
  gap: 1rem;
}

.method-list {
  display: grid;
  gap: 0.55rem;
  max-height: 380px;
  overflow-y: auto;
}

.method-item {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.65rem 0.75rem;
  cursor: pointer;
  background: #f8fafc;
}

.method-item.active {
  border-color: #93c5fd;
  background: #eff6ff;
}

.methods-content {
  display: grid;
  gap: 1rem;
}

.methods-content-header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
}

.discussion-box-short {
  min-height: 360px;
}

.research-detail-panel {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 1rem;
  min-height: 980px;
}

.pdf-frame-wrap {
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  min-height: 940px;
}

.pdf-frame {
  width: 100%;
  height: 940px;
  border: 0;
}

.discussion-box {
  border: 1px dashed var(--border);
  border-radius: 12px;
  min-height: 940px;
  display: grid;
  grid-template-rows: 1fr auto;
  padding: 1rem;
}

.discussion-list {
  overflow-y: auto;
  display: grid;
  gap: 0.7rem;
  align-content: start;
}

.discussion-item {
  background: #f8fafc;
  border-radius: 10px;
  padding: 0.7rem 0.8rem;
}

.discussion-meta {
  font-size: 0.75rem;
  color: var(--muted);
  margin-bottom: 0.3rem;
}

.discussion-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.6rem;
  margin-top: 0.8rem;
}

.discussion-form input {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.6rem 0.7rem;
}

@media (max-width: 1280px) {
  .research-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    min-height: auto;
  }

  .research-layout,
  .methods-layout {
    grid-template-columns: 1fr;
  }
}
