/* 宁职大通识素养增值平台 Demo —— 样式 */
* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
  --navy: #123a6d;
  --navy-2: #1c4d8d;
  --blue: #2563eb;
  --gold: #c9a253;
  --bg: #f2f5f9;
  --card: #ffffff;
  --line: #e4e9f0;
  --text: #22303f;
  --muted: #7a8899;
  --red: #d64545;
  --orange: #e08a2e;
  --green: #2e9e6b;
  --violet: #7c5cd6;
}
html, body { height: 100%; }
body {
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  background: var(--bg); color: var(--text); font-size: 14px;
}
.hidden { display: none !important; }
a { color: var(--blue); text-decoration: none; }

/* 模拟数据角标 */
#demo-ribbon {
  position: fixed; top: 14px; right: -44px; z-index: 9999;
  transform: rotate(38deg);
  background: rgba(214, 69, 69, .92); color: #fff;
  font-size: 12px; font-weight: 600; letter-spacing: 1px;
  padding: 4px 48px; pointer-events: none;
  box-shadow: 0 2px 8px rgba(0,0,0,.18);
}

/* ---------- 登录 ---------- */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #0e2f5c 0%, #123a6d 45%, #1c5d99 100%);
  padding: 24px;
}
.login-card {
  width: 860px; max-width: 96vw; background: #fff; border-radius: 16px;
  padding: 40px 48px; box-shadow: 0 24px 80px rgba(0,0,0,.35);
}
.login-brand { display: flex; gap: 18px; align-items: center; }
.login-logo {
  width: 64px; height: 64px; border-radius: 14px; flex: none;
  background: linear-gradient(135deg, var(--navy), var(--navy-2));
  color: #fff; font-weight: 700; display: flex; align-items: center; justify-content: center;
  font-size: 18px; letter-spacing: 2px; box-shadow: inset 0 0 0 2px rgba(255,255,255,.15);
}
.login-brand h1 { font-size: 22px; color: var(--navy); }
.login-brand p { color: var(--muted); margin-top: 4px; }
.login-slogan { display: flex; gap: 10px; flex-wrap: wrap; margin: 22px 0 6px; }
.login-slogan span {
  background: #f0f5ff; color: var(--navy-2); border: 1px solid #dbe7ff;
  padding: 5px 12px; border-radius: 999px; font-size: 12.5px;
}
.login-tip { margin: 18px 0 10px; color: var(--muted); }
.login-roles { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.role-card {
  border: 1.5px solid var(--line); border-radius: 12px; padding: 14px 16px; cursor: pointer;
  transition: all .15s;
}
.role-card:hover { border-color: var(--blue); box-shadow: 0 6px 18px rgba(37,99,235,.15); transform: translateY(-2px); }
.role-card b { font-size: 15px; color: var(--navy); display: block; margin-bottom: 4px; }
.role-card span { color: var(--muted); font-size: 12.5px; }
.login-note { margin-top: 22px; font-size: 12px; color: #b45f5f; background: #fdf3f3; border-radius: 8px; padding: 10px 14px; }

/* ---------- 布局 ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: 216px; flex: none; background: linear-gradient(180deg, #0e2f5c, #123a6d);
  color: #cfe0f5; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.side-brand { display: flex; gap: 10px; padding: 18px 16px; align-items: center; cursor: pointer; }
.side-logo {
  width: 40px; height: 40px; border-radius: 10px; flex: none; font-size: 12px; font-weight: 700;
  background: rgba(255,255,255,.12); display: flex; align-items: center; justify-content: center; color: #fff;
}
.side-title { font-size: 12.5px; line-height: 1.45; color: #e8f0fb; font-weight: 600; }
nav { flex: 1; overflow-y: auto; padding: 6px 10px; }
.nav-group { font-size: 11px; color: #7d9cc4; margin: 14px 8px 6px; letter-spacing: 1px; }
.nav-item {
  display: flex; align-items: center; gap: 9px; padding: 9px 12px; border-radius: 9px;
  color: #cfe0f5; cursor: pointer; margin-bottom: 2px; font-size: 13.5px;
}
.nav-item:hover { background: rgba(255,255,255,.08); color: #fff; }
.nav-item.active { background: rgba(255,255,255,.16); color: #fff; font-weight: 600; }
.nav-item .ico { width: 18px; text-align: center; }
.side-foot { padding: 14px 16px; border-top: 1px solid rgba(255,255,255,.12); font-size: 12px; }
#side-role { color: #fff; font-weight: 600; margin-bottom: 4px; }
#btn-logout { color: #9fc1e8; }
.side-ver { margin-top: 10px; color: #7d9cc4; line-height: 1.5; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 52px; background: #fff; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between; padding: 0 22px;
  position: sticky; top: 0; z-index: 50;
}
.crumb { font-size: 15px; font-weight: 600; color: var(--navy); }
.top-right { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 13px; }
.view { padding: 20px 22px 60px; max-width: 1400px; width: 100%; margin: 0 auto; }

/* ---------- 通用组件 ---------- */
.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 600; }
.badge-demo { background: #fdeaea; color: var(--red); }
.badge-a { background: #e2f6ec; color: var(--green); }
.badge-b { background: #fdf3e2; color: var(--orange); }
.badge-c { background: #fdeaea; color: var(--red); }
.badge-info { background: #e8effc; color: var(--blue); }
.badge-warn { background: #fdf3e2; color: var(--orange); }
.badge-pos { background: #efe9fc; color: var(--violet); }
.badge-gray { background: #eef1f5; color: var(--muted); }

.grid { display: grid; gap: 14px; }
.cols-2 { grid-template-columns: 1fr 1fr; }
.cols-3 { grid-template-columns: repeat(3, 1fr); }
.cols-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 1100px) { .cols-4 { grid-template-columns: repeat(2, 1fr); } .cols-3 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 760px) { .cols-2, .cols-3, .cols-4 { grid-template-columns: 1fr; } .sidebar { display: none; } }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px; }
.card h3 { font-size: 14.5px; color: var(--navy); margin-bottom: 12px; display: flex; align-items: center; justify-content: space-between; }
.card h3 .sub { font-weight: 400; font-size: 12px; color: var(--muted); }

.kpi { display: flex; flex-direction: column; gap: 4px; }
.kpi .num { font-size: 26px; font-weight: 700; color: var(--navy); font-variant-numeric: tabular-nums; }
.kpi .lbl { color: var(--muted); font-size: 12.5px; }
.kpi .delta { font-size: 12px; }
.up { color: var(--green); } .down { color: var(--red); }

table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th { text-align: left; color: var(--muted); font-weight: 600; padding: 8px 10px; border-bottom: 1.5px solid var(--line); white-space: nowrap; }
.tbl td { padding: 8px 10px; border-bottom: 1px solid #eef2f6; }
.tbl tr:hover td { background: #f7fafd; }
.tbl .num { font-variant-numeric: tabular-nums; }
.tbl-wrap { overflow-x: auto; }
.clickable { cursor: pointer; }
.clickable:hover { color: var(--blue); }

.btn {
  display: inline-block; border: 1px solid var(--line); background: #fff; color: var(--text);
  border-radius: 8px; padding: 6px 14px; font-size: 13px; cursor: pointer;
}
.btn:hover { border-color: var(--blue); color: var(--blue); }
.btn-pri { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn-pri:hover { background: #1d4fd8; color: #fff; }
.btn-sm { padding: 3px 10px; font-size: 12px; border-radius: 6px; }

select, input[type=text] {
  border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; font-size: 13px;
  background: #fff; color: var(--text); outline: none;
}
select:focus, input:focus { border-color: var(--blue); }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.filters label { color: var(--muted); font-size: 12.5px; }

.chart { width: 100%; height: 300px; }
.chart-lg { height: 380px; }
.chart-sm { height: 230px; }

/* 学生画像 */
.stu-head { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
.stu-avatar {
  width: 58px; height: 58px; border-radius: 50%; flex: none;
  background: linear-gradient(135deg, var(--navy-2), var(--blue)); color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 20px; font-weight: 700;
}
.stu-meta b { font-size: 18px; color: var(--navy); margin-right: 10px; }
.stu-meta .row2 { color: var(--muted); font-size: 12.5px; margin-top: 5px; }
.score-pills { display: flex; gap: 10px; flex-wrap: wrap; margin-left: auto; }
.pill { background: #f4f7fb; border: 1px solid var(--line); border-radius: 10px; padding: 8px 14px; text-align: center; }
.pill .v { font-size: 18px; font-weight: 700; color: var(--navy); }
.pill .k { font-size: 11px; color: var(--muted); margin-top: 2px; }

.dom-cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
@media (max-width: 1100px) { .dom-cards { grid-template-columns: 1fr 1fr; } }
.dom-card { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; cursor: pointer; transition: all .15s; }
.dom-card:hover { border-color: var(--blue); box-shadow: 0 4px 14px rgba(37,99,235,.12); }
.dom-card .dn { font-weight: 600; color: var(--navy); display: flex; justify-content: space-between; }
.dom-card .ds { font-size: 22px; font-weight: 700; margin: 6px 0 2px; font-variant-numeric: tabular-nums; }
.dom-card .dm { font-size: 12px; color: var(--muted); line-height: 1.7; }

.timeline { position: relative; padding-left: 18px; }
.timeline::before { content: ''; position: absolute; left: 5px; top: 4px; bottom: 4px; width: 2px; background: var(--line); }
.tl-item { position: relative; padding: 0 0 16px 12px; }
.tl-item::before { content: ''; position: absolute; left: -17px; top: 5px; width: 8px; height: 8px; border-radius: 50%; background: var(--blue); }
.tl-item .tl-t { font-size: 12px; color: var(--muted); }
.tl-item .tl-b { margin-top: 3px; line-height: 1.6; }

/* 弹层 */
.modal-mask {
  position: fixed; inset: 0; background: rgba(15, 30, 50, .45); z-index: 1000;
  display: flex; align-items: center; justify-content: center; padding: 24px;
}
.modal {
  background: #fff; border-radius: 14px; width: 980px; max-width: 96vw; max-height: 90vh;
  display: flex; flex-direction: column; box-shadow: 0 30px 90px rgba(0,0,0,.35);
}
.modal-head {
  padding: 14px 20px; border-bottom: 1px solid var(--line); font-weight: 700; color: var(--navy);
  display: flex; justify-content: space-between; align-items: center; font-size: 15px;
}
#modal-close { border: none; background: none; font-size: 22px; cursor: pointer; color: var(--muted); line-height: 1; }
.modal-body { padding: 18px 20px; overflow-y: auto; }

.formula {
  background: #f4f7fb; border: 1px dashed #c9d6e8; border-radius: 10px; padding: 12px 16px;
  font-family: "SF Mono", Menlo, monospace; font-size: 13px; color: var(--navy); margin: 10px 0;
  overflow-x: auto; white-space: nowrap;
}
.note { font-size: 12.5px; color: var(--muted); line-height: 1.7; }
.callout { background: #f0f7f2; border-left: 3px solid var(--green); border-radius: 0 8px 8px 0; padding: 10px 14px; font-size: 13px; margin: 10px 0; }
.callout.warn { background: #fdf6ec; border-color: var(--orange); }

/* 报告打印页 */
.report-page { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 36px 44px; }
.report-page h1 { font-size: 20px; color: var(--navy); text-align: center; }
.report-page h2 { font-size: 15px; color: var(--navy); margin: 20px 0 10px; border-left: 4px solid var(--gold); padding-left: 10px; }
.report-meta { text-align: center; color: var(--muted); font-size: 12.5px; margin: 8px 0 14px; }
@media print {
  .sidebar, .topbar, #demo-ribbon, .no-print { display: none !important; }
  .view { padding: 0; }
  .report-page { border: none; }
  body { background: #fff; }
}

.empty { text-align: center; color: var(--muted); padding: 40px 0; }
.tag { display: inline-block; background: #eef3fa; color: var(--navy-2); border-radius: 6px; padding: 1px 8px; font-size: 11.5px; margin: 0 4px 4px 0; }
.mini-bars { display: flex; gap: 3px; align-items: flex-end; height: 26px; }
.mini-bars i { width: 7px; border-radius: 2px 2px 0 0; background: #b9cdea; display: block; }

/* ---------- Toast ---------- */
#toasts { position: fixed; top: 60px; right: 18px; z-index: 3000; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: #1d2b3d; color: #fff; border-radius: 10px; padding: 10px 16px; font-size: 13px;
  box-shadow: 0 8px 30px rgba(0,0,0,.3); max-width: 360px; line-height: 1.5;
  animation: toast-in .25s ease-out;
}
.toast.ok { border-left: 4px solid var(--green); }
.toast.warn { border-left: 4px solid var(--orange); }
.toast.err { border-left: 4px solid var(--red); }
@keyframes toast-in { from { transform: translateX(30px); opacity: 0; } to { transform: none; opacity: 1; } }

/* 行高亮（新写入的数据） */
@keyframes row-flash { 0% { background: #fff3c9; } 100% { background: transparent; } }
.row-new { animation: row-flash 2.2s ease-out; }
@keyframes card-flash { 0%,49% { box-shadow: 0 0 0 3px var(--blue); } 50%,100% { box-shadow: none; } }
.flash-target { animation: card-flash 0.9s ease-in-out 3; border-radius: 12px; }

/* ---------- 顶栏 ---------- */
.topbtn { white-space: nowrap; }
#role-switch { max-width: 150px; }
.burger { display: none; border: 1px solid var(--line); background: #fff; border-radius: 8px; font-size: 16px; padding: 3px 10px; cursor: pointer; margin-right: 10px; }
.side-mask { position: fixed; inset: 0; background: rgba(10,20,35,.45); z-index: 190; }
@media (max-width: 760px) {
  .sidebar { display: flex !important; position: fixed; left: 0; top: 0; z-index: 200; transform: translateX(-100%); transition: transform .2s; width: 230px; }
  .sidebar.open { transform: none; box-shadow: 12px 0 40px rgba(0,0,0,.3); }
  .burger { display: inline-block; }
  .crumb { font-size: 13.5px; }
  .view { padding: 14px 12px 60px; }
  .top-right .topbtn { display: none; }
}

/* ---------- AI 问数抽屉 ---------- */
.ask-drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: 440px; max-width: 94vw; z-index: 900;
  background: #fff; box-shadow: -12px 0 50px rgba(10,25,50,.25);
  transform: translateX(105%); transition: transform .22s ease-out;
  display: flex; flex-direction: column;
}
.ask-drawer.open { transform: none; }
.ask-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--line); color: var(--navy); }
.ask-head button { border: none; background: none; font-size: 20px; cursor: pointer; color: var(--muted); }
.ask-input-row { display: flex; gap: 8px; padding: 12px 16px 6px; }
.ask-input-row input { flex: 1; }
.ask-chips { padding: 6px 16px 10px; display: flex; flex-wrap: wrap; gap: 6px; }
.ask-chip {
  background: #eef3fb; border: 1px solid #d8e4f5; color: var(--navy-2); border-radius: 999px;
  padding: 4px 11px; font-size: 12px; cursor: pointer;
}
.ask-chip:hover { background: #dce9fb; }
.ask-result { flex: 1; overflow-y: auto; padding: 4px 16px 10px; }
.cond-tag { display: inline-block; background: #eef8f1; border: 1px solid #cfe8d9; color: #1e7a4c; border-radius: 6px; padding: 2px 9px; font-size: 12px; margin: 0 5px 5px 0; }

/* ---------- 演示动线面板 ---------- */
.tour-panel {
  position: fixed; right: 18px; bottom: 18px; width: 330px; max-height: 70vh; z-index: 850;
  background: #fff; border-radius: 14px; box-shadow: 0 18px 60px rgba(10,25,50,.35);
  display: flex; flex-direction: column; border: 1px solid var(--line);
}
.tour-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--line); color: var(--navy); }
.tour-head button { border: none; background: none; font-size: 18px; cursor: pointer; color: var(--muted); }
.tour-steps { overflow-y: auto; padding: 8px 10px 12px; }
.tour-step { display: flex; gap: 9px; align-items: flex-start; padding: 7px 6px; border-radius: 9px; }
.tour-step:hover { background: #f4f8fd; }
.tour-step .no {
  flex: none; width: 22px; height: 22px; border-radius: 50%; background: #eef3fb; color: var(--navy-2);
  font-size: 12px; font-weight: 700; display: flex; align-items: center; justify-content: center; margin-top: 1px;
}
.tour-step.done .no { background: var(--green); color: #fff; }
.tour-step .tt { flex: 1; font-size: 12.5px; line-height: 1.45; }
.tour-step .tt b { color: var(--navy); }
.tour-step .tt .note { display: block; }
.tour-step .go { flex: none; }

/* ---------- 权重滑杆 ---------- */
.w-slider { display: grid; grid-template-columns: 110px 1fr 64px; gap: 10px; align-items: center; margin-bottom: 12px; }
.w-slider input[type=range] { width: 100%; accent-color: var(--blue); }
.w-slider .wv { font-weight: 700; color: var(--navy); font-variant-numeric: tabular-nums; text-align: right; }
.w-sum { font-size: 13px; margin: 6px 0 12px; }
.w-sum.bad { color: var(--red); font-weight: 600; }
.diff-card { background: #f6f9fd; border: 1px solid #dbe7f5; border-radius: 12px; padding: 14px 16px; margin-top: 12px; }
.diff-num { font-variant-numeric: tabular-nums; }
.arrow { color: var(--muted); padding: 0 4px; }

/* 表单 */
.form-row { margin-bottom: 12px; }
.form-row label { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 5px; }
.form-row select, .form-row input[type=text], .form-row input[type=date], .form-row textarea { width: 100%; }
.form-row textarea { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; font-size: 13px; font-family: inherit; min-height: 74px; resize: vertical; }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }
.chk-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 10px; max-height: 180px; overflow-y: auto; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; }
.chk-grid label { display: flex; gap: 6px; align-items: center; font-size: 12.5px; color: var(--text); margin: 0; }

/* 向导步骤 */
.wiz-steps { display: flex; gap: 6px; margin-bottom: 16px; }
.wiz-steps span { flex: 1; text-align: center; font-size: 12px; padding: 6px 4px; border-radius: 8px; background: #f0f3f8; color: var(--muted); }
.wiz-steps span.on { background: var(--blue); color: #fff; font-weight: 600; }

/* 学生我的任务 */
.mytask { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; margin-bottom: 10px; }
.mytask .mt-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.reflect-box { background: #f6f9f6; border-radius: 8px; padding: 8px 12px; margin-top: 8px; font-size: 12.5px; color: #2c5540; }
