/* ================= 设计系统 ================= */
:root {
  --bg: #f2f5fb; --bg-soft: #f8fafd;
  --card: #ffffff; --line: #e5eaf4;
  --ink: #16203a; --sub: #64748b; --faint: #94a3b8;
  --brand: #4f46e5; --brand-2: #7c3aed; --cyan: #06b6d4;
  --grad: linear-gradient(135deg, #4f46e5 0%, #7c3aed 55%, #06b6d4 130%);
  --grad-soft: linear-gradient(135deg, #eef2ff, #f5f0ff);
  --ok: #10b981; --warn: #f59e0b; --err: #ef4444;
  --s: #7c5cff; --t: #0d9488; --a: #d97706;
  --radius: 16px; --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgba(22,32,58,.05), 0 2px 8px rgba(22,32,58,.05);
  --shadow: 0 4px 18px rgba(22,32,58,.08), 0 1px 3px rgba(22,32,58,.05);
  --shadow-lg: 0 18px 48px rgba(22,32,58,.16);
  --navy: #101a38; --navy-2: #16224a;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: "HarmonyOS Sans SC", "MiSans", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}
.hidden { display: none !important; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #cdd6e8; border-radius: 8px; }
::-webkit-scrollbar-track { background: transparent; }

button { cursor: pointer; font-family: inherit; }
input, textarea, select {
  font-family: inherit; font-size: 14px; color: var(--ink);
  padding: 10px 12px; border: 1.5px solid var(--line); border-radius: var(--radius-sm);
  outline: none; background: #fff; transition: border .15s, box-shadow .15s;
}
input:focus, textarea:focus, select:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(79,70,229,.12); }
textarea { resize: vertical; }

/* 按钮 */
.btn {
  border: none; border-radius: var(--radius-sm); padding: 10px 18px; font-size: 14px;
  font-weight: 600; transition: transform .12s, box-shadow .12s, filter .12s;
}
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--grad); color: #fff; box-shadow: 0 4px 14px rgba(79,70,229,.35); }
.btn.primary:hover { filter: brightness(1.07); box-shadow: 0 6px 18px rgba(79,70,229,.42); }
.btn.ghost { background: #fff; border: 1.5px solid var(--line); color: var(--sub); }
.btn.ghost:hover { border-color: var(--brand); color: var(--brand); background: #f7f8ff; }
.btn.small { padding: 6px 12px; font-size: 13px; border-radius: 8px; }
.btn.danger { background: #fef2f2; color: var(--err); border: 1.5px solid #fecaca; }
.btn.danger:hover { background: #fee2e2; }
.btn.ok { background: #ecfdf5; color: var(--ok); border: 1.5px solid #a7f3d0; }
.btn.block { width: 100%; padding: 12px; font-size: 15px; border-radius: 12px; }

/* ================= 登录页 ================= */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px;
  background:
    radial-gradient(900px 500px at 8% -10%, rgba(79,70,229,.18), transparent 60%),
    radial-gradient(800px 500px at 100% 0%, rgba(6,182,212,.16), transparent 55%),
    radial-gradient(700px 600px at 50% 115%, rgba(124,58,237,.14), transparent 60%),
    #eef1fa;
}
.login-card {
  display: grid; grid-template-columns: 1.05fr 1fr; width: min(880px, 96vw);
  background: #fff; border-radius: 24px; overflow: hidden; box-shadow: var(--shadow-lg);
  animation: rise .45s ease;
}
@keyframes rise { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }
.login-brand {
  background: linear-gradient(150deg, #141f45 0%, #1c2c5e 45%, #26407e 100%);
  color: #fff; padding: 44px 40px; display: flex; flex-direction: column; position: relative; overflow: hidden;
}
.login-brand::after {
  content: ""; position: absolute; width: 380px; height: 380px; border-radius: 50%;
  background: radial-gradient(circle, rgba(6,182,212,.35), transparent 65%);
  right: -120px; bottom: -140px;
}
.brand-logo {
  width: 64px; height: 64px; border-radius: 18px; font-size: 34px; display: flex;
  align-items: center; justify-content: center;
  background: linear-gradient(135deg, rgba(255,255,255,.16), rgba(255,255,255,.05));
  border: 1px solid rgba(255,255,255,.22); backdrop-filter: blur(4px);
  box-shadow: 0 8px 24px rgba(0,0,0,.28);
}
.brand-logo.sm { width: 34px; height: 34px; font-size: 18px; border-radius: 10px; }
.login-brand h1 { margin: 22px 0 4px; font-size: 30px; letter-spacing: 2px; }
.brand-sub { color: #9fb4e8; margin: 0 0 26px; font-size: 14px; letter-spacing: 1px; }
.brand-points { list-style: none; padding: 0; margin: 0 0 auto; display: flex; flex-direction: column; gap: 12px; }
.brand-points li { font-size: 14px; color: #dbe5fb; display: flex; align-items: center; gap: 8px; }
.brand-foot { margin-top: 30px; font-size: 12px; color: #8fa3d8; position: relative; z-index: 1; }
.login-form { padding: 48px 42px; display: flex; flex-direction: column; gap: 8px; }
.login-form h2 { margin: 0; font-size: 24px; }
.login-form .muted { margin-bottom: 14px; }
.login-form label { font-size: 13px; color: var(--sub); font-weight: 600; }
.login-form input { margin-bottom: 12px; padding: 12px 14px; }
.login-form .btn { margin-top: 6px; }
.login-tip {
  margin-top: 18px; font-size: 12.5px; color: var(--sub); line-height: 1.9;
  background: var(--bg-soft); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px;
}
.err { color: var(--err); font-size: 13px; min-height: 18px; margin-top: 6px; }

/* ================= 应用框架 ================= */
.topbar {
  height: 60px; background: rgba(255,255,255,.82); backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line); display: flex; align-items: center;
  justify-content: space-between; padding: 0 22px; position: sticky; top: 0; z-index: 40;
}
.brand-chip { display: flex; align-items: center; gap: 10px; }
.brand-name { font-weight: 800; font-size: 16px; letter-spacing: .5px; }
.top-right { display: flex; align-items: center; gap: 14px; }
.toplink {
  text-decoration: none; font-size: 13px; font-weight: 600; color: var(--brand);
  background: var(--grad-soft); border: 1px solid #dcd9ff; padding: 7px 14px; border-radius: 999px;
  transition: transform .12s, box-shadow .12s;
}
.toplink:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(79,70,229,.18); }
.user-badge { font-size: 13px; color: var(--sub); font-weight: 600; display: flex; align-items: center; gap: 8px; }
.layout { display: flex; min-height: calc(100vh - 60px); }
.sidebar {
  width: 212px; background: linear-gradient(180deg, var(--navy), var(--navy-2));
  padding: 18px 12px; flex-shrink: 0; position: sticky; top: 60px; align-self: flex-start;
  min-height: calc(100vh - 60px);
}
.sidebar .nav-item {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  padding: 11px 14px; border: none; background: none; border-radius: 12px;
  color: #a9b6dc; margin-bottom: 4px; font-size: 14px; font-weight: 500; transition: all .15s;
}
.sidebar .nav-item:hover { background: rgba(255,255,255,.08); color: #fff; transform: translateX(2px); }
.sidebar .nav-item.active {
  background: var(--grad); color: #fff; font-weight: 700;
  box-shadow: 0 6px 18px rgba(79,70,229,.45);
}
.content { flex: 1; padding: 26px 28px; max-width: 1220px; animation: fadeIn .3s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* 卡片 / 统计 */
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; margin-bottom: 14px; box-shadow: var(--shadow-sm); transition: box-shadow .18s;
}
.card:hover { box-shadow: var(--shadow); }
.card h3 { margin: 0 0 12px; font-size: 15px; }
.grid { display: grid; gap: 14px; }
.grid.c2 { grid-template-columns: 1fr 1fr; }
.grid.c3 { grid-template-columns: repeat(3, 1fr); }
.grid.c4 { grid-template-columns: repeat(4, 1fr); }
.stat {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; box-shadow: var(--shadow-sm); position: relative; overflow: hidden;
  transition: transform .15s, box-shadow .15s;
}
.stat:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.stat::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 3px; background: var(--grad);
}
.stat .num { font-size: 28px; font-weight: 800; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.stat .lbl { color: var(--sub); font-size: 13px; margin-top: 4px; }

/* 表格 */
table { width: 100%; border-collapse: collapse; background: #fff; border-radius: var(--radius-sm); overflow: hidden; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); font-size: 13px; vertical-align: top; }
th { color: var(--sub); font-weight: 700; background: var(--bg-soft); font-size: 12px; letter-spacing: .3px; }
tbody tr { transition: background .12s; }
tbody tr:hover { background: #f7f9ff; }
tbody tr:last-child td { border-bottom: none; }

/* 徽章与标签 */
.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.badge.pub { background: #ecfdf5; color: #059669; }
.badge.draft { background: #fffbeb; color: #b45309; }
.badge.off { background: #fef2f2; color: #dc2626; }
.badge.blue { background: #eef2ff; color: #4f46e5; }
.role-tag { display: inline-block; padding: 3px 10px; border-radius: 7px; font-size: 12px; font-weight: 700; color: #fff; }
.role-tag.s { background: linear-gradient(135deg, #7c5cff, #a78bfa); }
.role-tag.t { background: linear-gradient(135deg, #0d9488, #2dd4bf); }
.role-tag.a { background: linear-gradient(135deg, #d97706, #fbbf24); }
.toolbar { display: flex; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; align-items: center; }
.muted { color: var(--sub); font-size: 12.5px; }
.tag-chip {
  display: inline-block; background: var(--grad-soft); color: #4338ca; border: 1px solid #e3e0ff;
  border-radius: 999px; padding: 2px 10px; font-size: 12px; margin: 2px 3px; font-weight: 600;
}
.kv { display: flex; gap: 8px; font-size: 13px; margin-bottom: 4px; }
.kv b { color: var(--sub); flex-shrink: 0; }

/* ================= 学伴聊天 ================= */
.chat-wrap { display: flex; gap: 14px; height: calc(100vh - 150px); }
.chat-list {
  width: 250px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px; overflow-y: auto; flex-shrink: 0; box-shadow: var(--shadow-sm);
}
.chat-list .conv {
  padding: 11px 12px; border-radius: 12px; cursor: pointer; font-size: 13px; color: var(--sub);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 4px; transition: all .13s;
}
.chat-list .conv:hover { background: var(--bg-soft); }
.chat-list .conv.active { background: var(--grad-soft); color: var(--brand); font-weight: 700; border: 1px solid #e3e0ff; }
.chat-main {
  flex: 1; display: flex; flex-direction: column; background: var(--card);
  border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-sm);
}
.chat-title {
  padding: 15px 18px; border-bottom: 1px solid var(--line); font-weight: 700;
  display: flex; justify-content: space-between; align-items: center;
  background: linear-gradient(180deg, #fbfcff, #fff);
}
.msgs { flex: 1; overflow-y: auto; padding: 20px; background: linear-gradient(180deg, #fafbff 0%, #fff 24%); }
.msg { margin-bottom: 16px; display: flex; gap: 10px; align-items: flex-start; }
.msg.user { flex-direction: row-reverse; }
.avatar {
  width: 36px; height: 36px; border-radius: 12px; flex-shrink: 0; display: flex;
  align-items: center; justify-content: center; font-size: 18px; font-weight: 700;
}
.msg.ai .avatar { background: var(--grad); color: #fff; box-shadow: 0 4px 12px rgba(79,70,229,.35); }
.msg.user .avatar { background: linear-gradient(135deg, #0ea5e9, #22d3ee); color: #fff; font-size: 14px; }
.msg .bubble {
  max-width: 78%; padding: 12px 16px; border-radius: 16px; line-height: 1.75;
  white-space: pre-wrap; word-break: break-word; font-size: 14px;
}
.msg.user .bubble { background: var(--grad); color: #fff; border-bottom-right-radius: 6px; box-shadow: 0 6px 16px rgba(79,70,229,.28); }
.msg.ai .bubble { background: #fff; border: 1px solid var(--line); border-bottom-left-radius: 6px; box-shadow: var(--shadow-sm); }
.msg .meta { font-size: 11.5px; color: var(--faint); margin-top: 5px; padding: 0 4px; }
.msg.ai .meta { margin-left: 46px; }
.msg.user .meta { text-align: right; margin-right: 4px; }
.msg pre {
  background: #0d1526; color: #cfe0ff; padding: 12px 14px; border-radius: 12px;
  overflow-x: auto; font-size: 12.5px; margin: 8px 0; border: 1px solid #1e2b4d;
}
.msg.user pre { background: rgba(255,255,255,.14); border-color: rgba(255,255,255,.2); }
.chat-input { display: flex; gap: 10px; padding: 14px; border-top: 1px solid var(--line); background: #fff; }
.chat-input textarea {
  flex: 1; resize: none; height: 64px; border-radius: 14px; background: var(--bg-soft);
}
.typing { color: var(--sub); font-size: 13px; padding: 8px 16px; display: flex; gap: 6px; align-items: center; }
.dots span { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--brand); margin: 0 2px; animation: blink 1.2s infinite; }
.dots span:nth-child(2) { animation-delay: .2s; } .dots span:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }

/* 表单/清单 */
.form-row { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; }
.form-row label { font-size: 13px; color: var(--sub); font-weight: 600; }
.form-row textarea { min-height: 90px; }
.checklist { list-style: none; padding: 0; margin: 8px 0; }
.checklist li { display: flex; gap: 10px; align-items: flex-start; padding: 9px 0; border-bottom: 1px dashed var(--line); }
.checklist input[type=checkbox] { accent-color: var(--brand); width: 16px; height: 16px; margin-top: 2px; }

/* 弹窗与提示 */
.modal {
  position: fixed; inset: 0; background: rgba(13,20,40,.5); backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center; z-index: 90; padding: 16px;
}
.modal-card {
  background: #fff; border-radius: 20px; padding: 24px; width: 580px; max-width: 96vw;
  max-height: 88vh; overflow-y: auto; box-shadow: var(--shadow-lg);
  animation: pop .22s cubic-bezier(.2,.9,.3,1.2);
}
@keyframes pop { from { opacity: 0; transform: scale(.94) translateY(10px); } to { opacity: 1; transform: none; } }
.modal-card h3 { margin: 0 0 14px; font-size: 17px; }
.toast {
  position: fixed; top: 76px; right: 22px; background: #0f172a; color: #fff; padding: 12px 18px;
  border-radius: 12px; z-index: 99; font-size: 13px; max-width: 380px; box-shadow: var(--shadow-lg);
  animation: slideIn .25s ease; border: 1px solid rgba(255,255,255,.12);
}
@keyframes slideIn { from { opacity: 0; transform: translateX(30px); } to { opacity: 1; transform: none; } }

/* 检查清单（数据自检） */
.check-card { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border: 1px solid var(--line); border-radius: 14px; margin-bottom: 10px; background: #fff; }
.check-card .icon { width: 34px; height: 34px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 17px; flex-shrink: 0; }
.check-card.ok .icon { background: #ecfdf5; }
.check-card.bad .icon { background: #fef2f2; }
.check-card h4 { margin: 0 0 3px; font-size: 14px; }
.check-card .detail { color: var(--sub); font-size: 12.5px; }

/* 资源台账卡片 */
.res-card { display: flex; align-items: center; gap: 14px; padding: 16px; border: 1px solid var(--line); border-radius: 14px; margin-bottom: 10px; background: #fff; transition: all .15s; }
.res-card:hover { border-color: var(--brand); box-shadow: var(--shadow); transform: translateY(-2px); }
.res-card .ricon { width: 42px; height: 42px; border-radius: 12px; background: var(--grad-soft); display: flex; align-items: center; justify-content: center; font-size: 21px; flex-shrink: 0; }
.res-card h4 { margin: 0 0 2px; font-size: 14px; }
.res-card a { color: var(--brand); font-weight: 600; text-decoration: none; font-size: 12.5px; }

/* 知识图谱交互提示 */
.kp-tip { position: absolute; background: #fff; border: 1px solid var(--line); box-shadow: var(--shadow); border-radius: 10px; padding: 8px 12px; font-size: 12.5px; pointer-events: none; z-index: 6; max-width: 280px; }

/* 备案号页脚 */
.site-footer { text-align: center; padding: 14px; font-size: 12px; color: var(--faint); background: #fff; border-top: 1px solid var(--line); }
.site-footer a { color: var(--faint); text-decoration: none; }
.site-footer a:hover { color: var(--brand); }

/* 响应式 */
@media (max-width: 1024px) { .grid.c4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 768px) {
  .login-card { grid-template-columns: 1fr; width: min(440px, 94vw); }
  .login-brand { padding: 28px 26px; }
  .brand-points { display: none; }
  .login-form { padding: 30px 26px; }
  .content { padding: 14px; }
  .topbar { padding: 0 12px; }
  .toplink { display: none; }
  .brand-name { font-size: 14px; }
  .layout { flex-direction: column; }
  .sidebar { width: 100%; min-height: 0; position: static; padding: 8px; display: flex; gap: 6px; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .sidebar .nav-item { flex-shrink: 0; white-space: nowrap; padding: 9px 13px; font-size: 13px; border-radius: 10px; }
  .grid.c2, .grid.c3, .grid.c4 { grid-template-columns: 1fr; }
  .chat-wrap { flex-direction: column; height: auto; }
  .chat-list { width: 100%; max-height: 132px; display: flex; gap: 6px; overflow-x: auto; }
  .chat-list .conv { flex-shrink: 0; min-width: 128px; }
  .chat-main { min-height: 74vh; }
  .msg .bubble { max-width: 88%; }
  .modal-card { padding: 18px; }
  table { display: block; overflow-x: auto; }
}
