/* ============ 教学质量智能驾驶舱 · 设计令牌 ============ */
:root {
  --brand: #1b4965;
  --brand-2: #2a6f97;
  --accent: #f4a261;
  --bg: #f4f6fa;
  --card: #ffffff;
  --text: #1b2733;
  --muted: #7c8a99;
  --border: #e6ebf1;
  --shadow: 0 4px 20px rgba(27, 73, 101, .06);
  --green: #2a9d6f;
  --green-bg: #e7f6ef;
  --amber: #e0932c;
  --amber-bg: #fdf2e2;
  --red: #d64550;
  --red-bg: #fdeaec;
  --blue: #2a6f97;
  --blue-bg: #e9f2f8;
  --sidebar-w: 232px;
  --radius: 14px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
button, input, select { font-family: inherit; }
button { cursor: pointer; }
a { color: var(--brand-2); }

/* ============ 登录 ============ */
#login-view {
  position: fixed; inset: 0; z-index: 100;
  display: flex; align-items: center; justify-content: center; padding: 24px;
  background: linear-gradient(135deg, #12324a 0%, #1b4965 45%, #2a6f97 100%);
}
#login-view::before {
  content: ""; position: absolute; inset: 0;
  background-image: radial-gradient(rgba(255,255,255,.07) 1px, transparent 1px);
  background-size: 26px 26px;
}
.login-wrap {
  position: relative; display: grid; grid-template-columns: 1fr 380px;
  gap: 56px; align-items: center; max-width: 900px; width: 100%;
}
.login-brand { color: #fff; }
.login-logo {
  width: 56px; height: 56px; border-radius: 16px; margin-bottom: 24px;
  background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.25);
  display: flex; align-items: center; justify-content: center;
  font-size: 28px; font-weight: 700;
}
.login-brand h1 { font-size: 34px; letter-spacing: 1px; margin-bottom: 14px; }
.login-brand > p { font-size: 16px; color: rgba(255,255,255,.75); margin-bottom: 30px; }
.login-feats { list-style: none; display: grid; gap: 12px; }
.login-feats li { color: rgba(255,255,255,.9); padding-left: 26px; position: relative; font-size: 14px; }
.login-feats li::before {
  content: "✓"; position: absolute; left: 0; top: 0;
  width: 18px; height: 18px; border-radius: 50%; background: var(--green);
  color: #fff; font-size: 11px; display: flex; align-items: center; justify-content: center;
}
.login-card {
  background: #fff; border-radius: 20px; padding: 38px 34px;
  box-shadow: 0 24px 70px rgba(0,0,0,.28);
}
.login-card h2 { font-size: 22px; margin-bottom: 6px; }
.login-sub { color: var(--muted); margin-bottom: 26px; font-size: 13px; }
.login-card label { display: block; font-size: 13px; color: var(--muted); margin: 16px 0 7px; }
.login-card input {
  width: 100%; padding: 12px 14px; border: 1px solid var(--border);
  border-radius: 10px; font-size: 14px; outline: none; transition: .2s;
}
.login-card input:focus { border-color: var(--brand-2); box-shadow: 0 0 0 3px var(--blue-bg); }
.login-msg { color: var(--red); margin-top: 14px; font-size: 13px; min-height: 18px; }
.btn-primary {
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: #fff; border: none; border-radius: 10px; padding: 11px 20px;
  font-size: 14px; font-weight: 600; transition: .2s; box-shadow: 0 4px 12px rgba(42,111,151,.25);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(42,111,151,.35); }
.btn-primary.block { width: 100%; margin-top: 26px; padding: 13px; }

/* ============ 主布局 ============ */
#app-view { display: none; min-height: 100vh; }
.sidebar {
  position: fixed; top: 0; left: 0; bottom: 0; width: var(--sidebar-w);
  background: linear-gradient(180deg, #12324a 0%, #173e59 100%);
  color: #dbe7f0; display: flex; flex-direction: column; z-index: 40;
}
.side-brand { display: flex; align-items: center; gap: 12px; padding: 22px 20px; border-bottom: 1px solid rgba(255,255,255,.08); }
.side-logo {
  width: 40px; height: 40px; border-radius: 11px; flex: none;
  background: linear-gradient(135deg, var(--accent), #e0764f);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; font-weight: 700; color: #fff;
}
.side-title { font-weight: 700; font-size: 15px; color: #fff; }
.side-subtitle { font-size: 11px; color: rgba(255,255,255,.5); margin-top: 2px; }
.side-nav { flex: 1; padding: 14px 12px; overflow-y: auto; }
.nav-group { font-size: 11px; color: rgba(255,255,255,.4); padding: 16px 12px 8px; letter-spacing: 1px; }
.side-nav button {
  width: 100%; display: flex; align-items: center; gap: 12px;
  padding: 11px 13px; margin-bottom: 3px; border: none; border-radius: 9px;
  background: transparent; color: #c4d5e2; font-size: 13.5px; text-align: left; transition: .18s;
}
.side-nav button:hover { background: rgba(255,255,255,.07); color: #fff; }
.side-nav button.active { background: rgba(255,255,255,.14); color: #fff; font-weight: 600; box-shadow: inset 3px 0 0 var(--accent); }
.side-nav .ico { width: 18px; text-align: center; font-size: 15px; opacity: .85; }
.badge { margin-left: auto; background: var(--red); color: #fff; font-size: 10px; padding: 1px 7px; border-radius: 10px; }
.side-foot { padding: 16px 20px; font-size: 11px; color: rgba(255,255,255,.35); border-top: 1px solid rgba(255,255,255,.08); }

.main { margin-left: var(--sidebar-w); min-height: 100vh; }
.topbar {
  position: sticky; top: 0; z-index: 30;
  background: rgba(255,255,255,.92); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  padding: 0 28px; height: 70px; display: flex; align-items: center; justify-content: space-between;
}
.topbar-left { display: flex; align-items: center; gap: 14px; }
.page-title { font-size: 18px; font-weight: 700; }
.page-desc { font-size: 12px; color: var(--muted); margin-top: 1px; }
.menu-toggle { display: none; background: none; border: none; font-size: 20px; color: var(--brand); }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.grade-label { font-size: 12px; color: var(--muted); }
#grade-select, .toolbar select, .toolbar input, .search-input {
  padding: 8px 12px; border: 1px solid var(--border); border-radius: 9px;
  font-size: 13px; background: #fff; outline: none; color: var(--text);
}
#grade-select:focus, select:focus, input:focus { border-color: var(--brand-2); }
.divider { width: 1px; height: 22px; background: var(--border); margin: 0 4px; }
.user-chip { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.avatar {
  width: 30px; height: 30px; border-radius: 50%; background: var(--blue-bg);
  color: var(--brand-2); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px;
}
.btn-ghost { border: 1px solid var(--border); background: #fff; color: var(--muted); border-radius: 8px; padding: 7px 13px; font-size: 13px; }
.btn-ghost:hover { color: var(--red); border-color: var(--red); }

.content { padding: 24px 28px 40px; max-width: 1500px; margin: 0 auto; }

/* ============ 通用组件 ============ */
.panel {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px 22px; margin-bottom: 18px; box-shadow: var(--shadow);
}
.panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.panel-head h3 { font-size: 15px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.panel-sub { font-size: 12px; color: var(--muted); margin-top: 3px; }
.sub-tag { font-size: 11px; font-weight: 500; color: var(--brand-2); background: var(--blue-bg); padding: 2px 9px; border-radius: 6px; }
.spark { font-size: 11px; font-weight: 500; color: var(--accent); }
.legend { font-size: 11px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.dot-green { background: var(--green); } .dot-amber { background: var(--amber); } .dot-red { background: var(--red); }
.toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.toolbar label { color: var(--muted); font-size: 13px; }
.toolbar select { min-width: 200px; }
.toolbar-hint { font-size: 12px; color: var(--muted); }
.search-input { margin-left: auto; width: 200px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.chart { width: 100%; height: 320px; }
.chart-sm { height: 260px; }
.table-scroll { overflow-x: auto; max-height: 460px; overflow-y: auto; }

/* ============ 数据表格 ============ */
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; white-space: nowrap; }
.data-table th {
  position: sticky; top: 0; z-index: 2; background: #f7f9fc; color: var(--muted);
  font-weight: 600; padding: 11px 12px; text-align: center; border-bottom: 1px solid var(--border);
}
.data-table td { padding: 10px 12px; text-align: center; border-bottom: 1px solid #f0f3f7; }
.data-table tbody tr:hover td { background: #f7fafc; }
.data-table .name { text-align: left; font-weight: 600; }
.data-table td.pos { color: var(--green); font-weight: 600; }
.data-table td.neg { color: var(--red); font-weight: 600; }

/* ============ KPI 卡片 ============ */
.kpi-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; margin-bottom: 18px; }
.kpi-grid.kpi-3 { grid-template-columns: repeat(3, 1fr); }
.kpi-card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px 18px 16px; box-shadow: var(--shadow); position: relative; overflow: hidden;
}
.kpi-card::after { content: ""; position: absolute; right: -18px; top: -18px; width: 70px; height: 70px; border-radius: 50%; background: var(--tint, var(--blue-bg)); opacity: .5; }
.kpi-card .k-label { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.kpi-card .k-value { font-size: 27px; font-weight: 750; margin: 8px 0 2px; letter-spacing: -.5px; position: relative; z-index: 1; }
.kpi-card .k-value small { font-size: 14px; font-weight: 600; }
.kpi-card .k-sub { font-size: 11px; color: var(--muted); position: relative; z-index: 1; }
.kpi-card .k-delta { font-size: 11px; font-weight: 600; padding: 2px 7px; border-radius: 6px; display: inline-block; margin-top: 6px; }
.k-delta.up { color: var(--green); background: var(--green-bg); }
.k-delta.down { color: var(--red); background: var(--red-bg); }
.k-delta.flat { color: var(--muted); background: #f0f3f7; }

/* ============ 年级健康度 ============ */
.health-strip { display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 10px; }
.health-card {
  border: 1px solid var(--border); border-radius: 11px; padding: 12px 13px;
  cursor: pointer; transition: .18s; background: #fff; position: relative; overflow: hidden;
}
.health-card:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(27,73,101,.1); }
.health-card.selected { border-color: var(--brand-2); box-shadow: 0 0 0 2px var(--blue-bg); }
.health-card .h-grade { font-size: 13px; font-weight: 700; display: flex; justify-content: space-between; align-items: center; }
.health-card .h-rate { font-size: 22px; font-weight: 750; margin: 6px 0 3px; }
.health-card .h-meta { font-size: 11px; color: var(--muted); display: flex; justify-content: space-between; }
.health-bar { position: absolute; left: 0; bottom: 0; height: 3px; }
.level-good { color: var(--green); } .level-amber { color: var(--amber); } .level-red { color: var(--red); }
.bg-good { background: var(--green); } .bg-amber { background: var(--amber); } .bg-red { background: var(--red); }

/* ============ 决策洞察 ============ */
.insight-list { display: grid; gap: 12px; }
.insight {
  display: grid; grid-template-columns: 4px 1fr; gap: 0;
  border: 1px solid var(--border); border-radius: 11px; overflow: hidden; background: #fff;
}
.insight .i-bar { width: 4px; }
.insight.danger .i-bar { background: var(--red); }
.insight.warn .i-bar { background: var(--amber); }
.insight.good .i-bar { background: var(--green); }
.insight .i-body { padding: 14px 18px; }
.insight .i-top { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; flex-wrap: wrap; }
.i-tag { font-size: 11px; padding: 2px 9px; border-radius: 6px; font-weight: 600; }
.danger .i-tag { color: var(--red); background: var(--red-bg); }
.warn .i-tag { color: var(--amber); background: var(--amber-bg); }
.good .i-tag { color: var(--green); background: var(--green-bg); }
.i-title { font-size: 14px; font-weight: 700; }
.i-detail { font-size: 13px; color: #4c5a68; }
.i-sugg { font-size: 12px; color: var(--brand-2); background: var(--blue-bg); padding: 7px 11px; border-radius: 8px; margin-top: 9px; }
.i-sugg::before { content: "建议 · "; font-weight: 700; }

/* ============ 预警 ============ */
.weak-subjects { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.weak-card { border: 1px solid var(--border); border-radius: 11px; padding: 15px 17px; }
.weak-card .w-name { font-weight: 700; font-size: 14px; display: flex; justify-content: space-between; align-items: center; }
.weak-card .w-rate { font-size: 24px; font-weight: 750; margin: 8px 0 4px; }
.weak-card .w-meta { font-size: 11px; color: var(--muted); }

/* ============ 其它 ============ */
.tag { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 11px; font-weight: 600; }
.tag.easy { background: var(--green-bg); color: var(--green); }
.tag.mid { background: var(--blue-bg); color: var(--blue); }
.tag.hard { background: var(--red-bg); color: var(--red); }
.up { color: var(--green) !important; font-weight: 600; }
.down { color: var(--red) !important; font-weight: 600; }
.flat { color: var(--muted); }
.import-box { border: 2px dashed var(--border); border-radius: 12px; padding: 34px; text-align: center; background: #fbfcfe; }
.import-icon { width: 52px; height: 52px; border-radius: 50%; background: var(--blue-bg); color: var(--brand-2); font-size: 26px; display: flex; align-items: center; justify-content: center; margin: 0 auto 14px; }
.import-box p { margin-bottom: 6px; }
.import-box .muted { color: var(--muted); font-size: 12px; }
.import-row { display: flex; gap: 12px; justify-content: center; align-items: center; margin-top: 18px; flex-wrap: wrap; }
.import-row label { color: var(--muted); font-size: 13px; }
.result-msg { margin-top: 16px; color: var(--green); font-size: 13px; min-height: 18px; }
.marks-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; }
.marks-grid label { display: block; color: var(--muted); font-size: 12px; }
.marks-grid input { width: 100%; padding: 9px; border: 1px solid var(--border); border-radius: 8px; margin-top: 5px; outline: none; }
.toast {
  position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--brand); color: #fff; padding: 12px 22px; border-radius: 10px;
  font-size: 13px; box-shadow: 0 8px 24px rgba(0,0,0,.2); opacity: 0; pointer-events: none; transition: .25s; z-index: 200;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (max-width: 1100px) {
  .kpi-grid { grid-template-columns: repeat(3, 1fr); }
  .login-wrap { grid-template-columns: 1fr; gap: 28px; }
  .login-brand { display: none; }
}
@media (max-width: 860px) {
  .sidebar { transform: translateX(-100%); transition: .25s; }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0; }
  .menu-toggle { display: block; }
  .kpi-grid, .kpi-grid.kpi-3, .grid-2, .weak-subjects { grid-template-columns: 1fr 1fr; }
  .topbar { padding: 0 16px; }
  .content { padding: 18px 16px; }
}
@media (max-width: 560px) {
  .kpi-grid, .kpi-grid.kpi-3, .grid-2, .weak-subjects, .marks-grid { grid-template-columns: 1fr; }
  .topbar-right .grade-label, .divider { display: none; }
}

/* ============ 期中专项分析 ============ */
.chart-md { height: 420px; }
.mini-title { font-size: 13px; font-weight: 700; color: var(--text); margin-bottom: 10px; }

.tier-cards { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin-top: 6px; }
.tier-card {
  border: 1px solid var(--border); border-radius: 10px; padding: 9px 8px; text-align: center;
  background: #fbfcfe;
}
.tier-card .t-code { font-size: 11px; color: var(--muted); letter-spacing: .5px; }
.tier-card .t-num { font-size: 20px; font-weight: 700; line-height: 1.25; }
.tier-card .t-label { font-size: 11px; color: var(--muted); }
.tier-card.t-A { border-color: #bfe3d2; background: var(--green-bg); }
.tier-card.t-A .t-num { color: var(--green); }
.tier-card.t-B { border-color: #cfe0ee; background: var(--blue-bg); }
.tier-card.t-B .t-num { color: var(--blue); }
.tier-card.t-C { border-color: #e6ebf1; }
.tier-card.t-D { border-color: #f2ddb8; background: var(--amber-bg); }
.tier-card.t-D .t-num { color: var(--amber); }
.tier-card.t-E { border-color: #f3c9cd; background: var(--red-bg); }
.tier-card.t-E .t-num { color: var(--red); }

/* ============ 成绩录入 ============ */
.entry-bar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 12px 14px; background: #f8fafc; border: 1px solid var(--border);
  border-radius: 10px; margin-bottom: 14px;
}
.entry-bar label { font-size: 12px; color: var(--muted); }
.entry-bar input, .entry-bar select {
  padding: 7px 10px; border: 1px solid var(--border); border-radius: 8px;
  font-size: 13px; outline: none; background: #fff; min-width: 130px;
}
.entry-bar input:focus, .entry-bar select:focus { border-color: var(--brand-2); }

.paste-box { border: 1px dashed var(--border); border-radius: 10px; padding: 12px 14px; margin-bottom: 14px; background: #fbfcfe; }
.paste-box summary { cursor: pointer; font-size: 13px; font-weight: 600; color: var(--brand-2); }
.paste-box textarea {
  width: 100%; margin-top: 10px; padding: 10px; font-size: 12px; font-family: ui-monospace, Menlo, monospace;
  border: 1px solid var(--border); border-radius: 8px; outline: none; resize: vertical; background: #fff;
}
.paste-box textarea:focus { border-color: var(--brand-2); }
.paste-actions { display: flex; align-items: center; gap: 12px; margin-top: 10px; }

.entry-scroll { max-height: 62vh; overflow: auto; border: 1px solid var(--border); border-radius: 10px; }
.entry-table { font-size: 13px; }
.entry-table thead th {
  position: sticky; top: 0; z-index: 2; background: #f8fafc;
}
.entry-table td { padding: 4px 6px; }
.entry-table input {
  width: 100%; min-width: 62px; padding: 6px 7px; border: 1px solid transparent;
  border-radius: 6px; font-size: 13px; text-align: center; outline: none; background: transparent;
}
.entry-table input:hover { border-color: var(--border); background: #fff; }
.entry-table input:focus { border-color: var(--brand-2); background: #fff; box-shadow: 0 0 0 2px rgba(42,111,151,.12); }
.entry-table input.name-input { text-align: left; min-width: 80px; font-weight: 600; }
.entry-table input.school-input { text-align: left; min-width: 74px; }
.entry-table td.row-total { font-weight: 700; color: var(--brand); }
.entry-table .row-del {
  border: none; background: transparent; color: var(--muted); font-size: 15px; padding: 2px 6px; border-radius: 6px;
}
.entry-table .row-del:hover { color: var(--red); background: var(--red-bg); }
.entry-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 12px; }

@media (max-width: 860px) {
  .tier-cards { grid-template-columns: repeat(3, 1fr); }
}

/* ============ 区块标题（重新排版） ============ */
.section-head { display: flex; align-items: center; gap: 14px; margin: 28px 0 14px; }
.tab-page > .section-head:first-child { margin-top: 0; }
.sec-no {
  flex: none; width: 36px; height: 36px; border-radius: 11px;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: #fff; font-size: 13px; font-weight: 800; letter-spacing: -.3px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 12px rgba(42,111,151,.24);
}
.sec-txt h2 { font-size: 16px; font-weight: 750; letter-spacing: .2px; }
.sec-txt p { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* ============ 主科透视卡片 ============ */
.subject-cards { display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; }
.subject-card {
  position: relative; overflow: hidden;
  border: 1px solid var(--border); border-radius: 12px;
  padding: 15px 16px 14px; background: linear-gradient(180deg, #fbfdff 0%, #fff 62%);
  transition: .18s;
}
.subject-card:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(27,73,101,.09); }
.subject-card .s-top { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.subject-card .s-name { font-size: 15px; font-weight: 750; }
.subject-card .s-flag { font-size: 10px; font-weight: 700; padding: 2px 7px; border-radius: 999px; }
.subject-card .s-flag.weak { color: var(--red); background: var(--red-bg); }
.subject-card .s-flag.best { color: var(--green); background: var(--green-bg); }
.subject-card .s-rate { font-size: 27px; font-weight: 750; letter-spacing: -.6px; margin: 9px 0 1px; }
.subject-card .s-rate small { font-size: 12px; font-weight: 600; color: var(--muted); margin-left: 4px; }
.subject-card .s-bar { height: 5px; border-radius: 3px; background: #eef2f7; overflow: hidden; margin: 10px 0; }
.subject-card .s-bar span { display: block; height: 100%; border-radius: 3px; transition: width .5s ease; }
.subject-card .s-meta { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); }
.subject-card .s-meta b { color: var(--text); font-weight: 650; }
.subject-card.is-weak { border-color: #f3c9cd; background: linear-gradient(180deg, #fffafb 0%, #fff 62%); }
.subject-card.is-missing { opacity: .5; background: #fafbfc; }

/* ============ 模型提示条 ============ */
.scope-bar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  font-size: 12px; color: var(--muted); margin-bottom: 14px;
}
.scope-chip {
  font-size: 11px; font-weight: 600; color: var(--brand-2);
  background: var(--blue-bg); padding: 3px 10px; border-radius: 999px;
}

@media (max-width: 1100px) {
  .subject-cards { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 860px) {
  .subject-cards { grid-template-columns: repeat(2, 1fr); }
  .section-head { margin: 22px 0 12px; }
}
@media (max-width: 560px) {
  .subject-cards { grid-template-columns: 1fr; }
}
