/* ============================================================
   科研成果统计 - Material You 风格
   主色：emerald-600  #059669
   背景：纯白
   字体：Inter
   动效：弹性 / 淡入
   ============================================================ */

:root {
  --primary: #059669;          /* emerald-600 */
  --primary-50: #ecfdf5;
  --primary-100: #d1fae5;
  --primary-200: #a7f3d0;
  --primary-500: #10b981;
  --primary-600: #059669;
  --primary-700: #047857;
  --primary-800: #065f46;

  --bg: #ffffff;
  --bg-soft: #f8fafc;
  --surface: #ffffff;
  --border: #e5e7eb;
  --border-strong: #d1d5db;
  --text: #111827;
  --text-soft: #4b5563;
  --text-muted: #9ca3af;
  --danger: #dc2626;
  --danger-50: #fef2f2;
  --warn: #d97706;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.04), 0 1px 1px rgba(0,0,0,.03);
  --shadow: 0 4px 12px rgba(6,95,70,.07), 0 1px 2px rgba(0,0,0,.04);
  --shadow-lg: 0 12px 32px rgba(6,95,70,.10), 0 2px 4px rgba(0,0,0,.04);
  --radius: 14px;
  --radius-sm: 8px;
  --radius-lg: 22px;
  --easing: cubic-bezier(.34, 1.56, .64, 1);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "PingFang SC",
               "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primary-700); text-decoration: none; }
a:hover { text-decoration: underline; }
code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  background: var(--primary-50);
  color: var(--primary-800);
  padding: 2px 6px;
  border-radius: 6px;
  font-size: 12.5px;
}
kbd {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0 6px;
  font-size: 12px;
}

/* ---------- topbar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255,255,255,.85);
  backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--border);
}
.topbar__inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px;
  gap: 16px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 16px;
  color: var(--text);
}
.brand__dot {
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-100);
}
.topnav {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  font-size: 13.5px;
}
.topnav a { color: var(--text-soft); }
.topnav a:hover { color: var(--primary-700); text-decoration: none; }
.topnav__user {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text);
  font-weight: 500;
}
.badge {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 8px;
  background: var(--bg-soft);
  color: var(--text-soft);
  border-radius: 999px;
  font-size: 12px;
  border: 1px solid var(--border);
}
.badge--admin {
  background: var(--primary-50);
  color: var(--primary-800);
  border-color: var(--primary-200);
}
.logout-form { display: inline; margin: 0; padding: 0; }
.link-btn {
  background: none;
  border: none;
  color: var(--text-soft);
  cursor: pointer;
  font: inherit;
  padding: 0;
}
.link-btn:hover { color: var(--primary-700); }

/* ---------- main ---------- */
.main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 28px 24px 80px;
}
.messages {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
}
.alert {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  border: 1px solid var(--border);
  background: var(--bg-soft);
  animation: slideDown .3s var(--easing);
}
.alert--success { background: var(--primary-50); color: var(--primary-800); border-color: var(--primary-200); }
.alert--error { background: var(--danger-50); color: var(--danger); border-color: #fecaca; }
.alert--warning { background: #fffbeb; color: var(--warn); border-color: #fde68a; }

/* ---------- page head ---------- */
.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 20px;
  gap: 16px;
  flex-wrap: wrap;
}
.page-title { font-size: 26px; font-weight: 700; margin: 0 0 4px; letter-spacing: -0.01em; }
.page-sub { color: var(--text-soft); margin: 0; }
.back-link {
  display: inline-block;
  color: var(--text-soft);
  font-size: 13px;
  margin-bottom: 8px;
}
.back-link:hover { color: var(--primary-700); text-decoration: none; }
.page-head__actions { display: inline-flex; gap: 8px; }

/* ---------- card ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 24px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow .2s ease;
}
.card:hover { box-shadow: var(--shadow); }
.card__title { font-size: 16px; font-weight: 600; margin: 0 0 12px; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 38px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: 999px;
  font: inherit;
  font-weight: 500;
  cursor: pointer;
  transition: transform .12s var(--easing), box-shadow .15s ease, background .15s ease;
  white-space: nowrap;
  text-decoration: none;
}
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.btn:active { transform: translateY(0) scale(.98); }
.btn--primary {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 4px 12px rgba(5,150,105,.25);
}
.btn--primary:hover { background: var(--primary-700); }
.btn--ghost {
  background: var(--primary-50);
  color: var(--primary-800);
  border-color: var(--primary-100);
}
.btn--ghost:hover { background: var(--primary-100); }
.btn--danger {
  background: #fff;
  color: var(--danger);
  border-color: #fecaca;
}
.btn--danger:hover { background: var(--danger-50); }
.btn--block { width: 100%; justify-content: center; }
.btn--sm { height: 30px; padding: 0 12px; font-size: 12.5px; }

/* ---------- modules grid ---------- */
.modules {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}
.module-card {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 18px 18px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--text);
  min-height: 110px;
  transition: transform .2s var(--easing), box-shadow .2s ease, border-color .2s ease;
}
.module-card:hover {
  transform: translateY(-3px);
  border-color: var(--primary-200);
  box-shadow: var(--shadow);
  text-decoration: none;
}
.module-card__title { font-weight: 600; font-size: 15px; }
.module-card__count {
  font-size: 12px;
  color: var(--primary-700);
  background: var(--primary-50);
  padding: 2px 8px;
  border-radius: 999px;
  display: inline-block;
  margin-top: 6px;
  width: fit-content;
}
.module-card__hint { color: var(--text-muted); font-size: 12.5px; margin-top: 6px; }
.module-card__arrow {
  position: absolute;
  right: 16px;
  top: 16px;
  color: var(--primary);
  font-size: 18px;
  transition: transform .2s var(--easing);
}
.module-card:hover .module-card__arrow { transform: translateX(4px); }

/* ---------- form ---------- */
.form { padding: 24px 26px; }
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 18px 20px;
}
.field { display: flex; flex-direction: column; gap: 6px; }
.field--full { grid-column: 1 / -1; }
.field--text { grid-column: 1 / -1; }
.field__label { font-size: 13px; font-weight: 500; color: var(--text-soft); }
.field__help, .field__hint { color: var(--text-muted); font-size: 12px; }
.field__err { color: var(--danger); font-size: 12.5px; }
.req { color: var(--danger); }
.muted { color: var(--text-muted); }

.input, select, textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font: inherit;
  background: var(--surface);
  color: var(--text);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-100);
}
textarea { resize: vertical; min-height: 64px; }
.file-input {
  padding: 8px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--bg-soft);
}
.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
  border-top: 1px solid var(--border);
  padding-top: 18px;
}
.existing-files {
  margin-top: 10px;
  border: 1px solid var(--border);
  background: var(--bg-soft);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}
.existing-files__title { font-size: 12.5px; color: var(--text-soft); margin-bottom: 6px; }
.existing-files__item { display: flex; align-items: center; gap: 8px; padding: 4px 0; font-size: 13px; }

/* ---------- table ---------- */
.table-scroll { overflow-x: auto; }
.data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13.5px;
}
.data-table th, .data-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}
.data-table th {
  background: var(--primary-50);
  color: var(--primary-800);
  font-weight: 600;
  font-size: 13px;
  white-space: nowrap;
  position: sticky;
  top: 0;
}
.data-table tbody tr {
  transition: background .12s ease;
}
.data-table tbody tr:hover { background: var(--bg-soft); }
.data-table td.proof-cell { white-space: nowrap; }
.data-table td.actions { white-space: nowrap; }
.data-table .inline { display: inline; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 24px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--primary-50);
  color: var(--primary-800);
  border: 1px solid var(--primary-100);
  font-size: 12px;
  margin-right: 4px;
  margin-bottom: 4px;
  text-decoration: none;
}
.chip:hover { background: var(--primary-100); text-decoration: none; }

/* ---------- empty state ---------- */
.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 48px 12px;
  color: var(--text-muted);
}
.empty__icon { font-size: 42px; }
.empty__text { font-size: 15px; }

/* ---------- auth ---------- */
.auth-wrap {
  min-height: calc(100vh - 80px);
  display: flex;
  align-items: center;
  justify-content: center;
}
.auth-card {
  width: 100%;
  max-width: 420px;
  padding: 32px;
}
.auth-title { font-size: 24px; font-weight: 700; margin: 0 0 6px; }
.auth-sub { color: var(--text-soft); margin: 0 0 22px; }
.auth-foot { text-align: center; margin-top: 18px; color: var(--text-soft); font-size: 13.5px; }

/* ---------- export: module selection ---------- */
.export-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin: 14px 0 18px;
  padding: 10px 12px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.export-form { display: block; }
.module-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
}
.module-check {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease, transform .12s var(--easing);
  user-select: none;
}
.module-check:hover {
  border-color: var(--primary-200);
  transform: translateY(-1px);
}
.module-check input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  margin: 2px 0 0;
  border: 1.5px solid var(--border-strong);
  border-radius: 6px;
  background: var(--surface);
  cursor: pointer;
  flex-shrink: 0;
  position: relative;
  transition: background .15s ease, border-color .15s ease;
}
.module-check input[type="checkbox"]:checked {
  background: var(--primary);
  border-color: var(--primary);
}
.module-check input[type="checkbox"]:checked::after {
  content: '';
  position: absolute;
  left: 5px;
  top: 1px;
  width: 6px;
  height: 11px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.module-check:has(input:checked) {
  border-color: var(--primary);
  background: var(--primary-50);
}
.module-check__body {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  min-width: 0;
}
.module-check__title {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text);
  line-height: 1.35;
}
.module-check__count {
  font-size: 12px;
  color: var(--primary-700);
  background: var(--primary-50);
  padding: 1px 8px;
  border-radius: 999px;
  width: fit-content;
}
.module-check:has(input:checked) .module-check__count {
  background: #fff;
}

/* ---------- pop-in animation ---------- */
@keyframes popIn {
  from { opacity: 0; transform: translateY(8px) scale(.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes slideDown {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}
.pop-in {
  animation: popIn .42s var(--easing) both;
}

/* ---------- responsive ---------- */
@media (max-width: 720px) {
  .form-grid { grid-template-columns: 1fr; }
  .module-grid { grid-template-columns: 1fr; }
  .topbar__inner { flex-direction: column; align-items: flex-start; }
  .topnav { flex-wrap: wrap; }
  .page-head { flex-direction: column; align-items: flex-start; }
}
