/* v3.3 壳层与页面骨架：数据分析报告的纸面阅读版式 */
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: calc(14px * 1.3);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-hover); }
button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3, h4, p { margin: 0; }
ul { margin: 0; padding: 0; list-style: none; }
img, svg { display: block; max-width: 100%; }
::selection { background: rgba(31, 79, 216, 0.16); }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 3px; border-radius: 3px; }

/* ---------- shell ---------- */
.app-shell { min-height: 100vh; }
.topbar {
  position: sticky; top: 0; z-index: 50;
  height: var(--header-h);
  display: flex; align-items: center; justify-content: space-between;
  gap: 20px; padding: 0 26px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: saturate(160%) blur(10px);
  -webkit-backdrop-filter: saturate(160%) blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(31, 79, 216, 0.55) 18%, rgba(14, 147, 176, 0.45) 52%, transparent 88%);
  opacity: .55; pointer-events: none;
}
.topbar-left, .topbar-right { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; color: var(--text); }
.brand:hover { color: var(--text); }
.brand-mark {
  width: 30px; height: 30px; border-radius: 6px; flex: none;
  background: var(--ink); color: #fff;
  display: grid; place-items: center;
  font-family: var(--mono); font-size: calc(10px * 1.3); font-weight: 600; letter-spacing: .02em;
  box-shadow: inset 0 -2px 0 rgba(56, 189, 248, 0.75);
}
.brand-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.15; }
.brand-name {
  font-size: calc(13.5px * 1.3); font-weight: 650; letter-spacing: -.005em; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.brand-sub {
  display: block; margin-top: 3px;
  font-family: var(--mono); font-size: calc(8.5px * 1.3); line-height: 1;
  letter-spacing: .16em; color: var(--faint); text-transform: uppercase;
}
.topbar-divider { width: 1px; height: 22px; background: var(--line); }
.topbar .badge {
  height: 22px; padding: 0 8px;
  background: var(--surface-2); border: 1px solid var(--line);
  color: var(--text-2); font-weight: 500; font-size: calc(11.5px * 1.3);
}
.topbar .badge .badge-dot { background: var(--accent); }
.school-select {
  height: 32px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface); padding: 0 10px; color: var(--text); min-width: 150px;
}
.user-chip {
  display: flex; align-items: center; gap: 8px;
  padding: 3px 10px 3px 3px; border-radius: var(--radius-sm);
  background: var(--surface); border: 1px solid var(--line);
}
.avatar {
  width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center;
  background: var(--ink); color: #fff;
  font-size: calc(10.5px * 1.3); font-weight: 600;
}
.user-name { font-size: calc(12.5px * 1.3); font-weight: 600; color: var(--text); line-height: 1.3; }
.user-role { font-size: calc(10px * 1.3); color: var(--muted); line-height: 1.3; }
.topbar .btn { background: transparent; border-color: transparent; color: var(--muted); box-shadow: none; }
.topbar .btn:hover { background: var(--surface-2); border-color: transparent; color: var(--text); }
.topbar .btn-ghost { color: var(--muted); }

.layout { display: flex; min-height: calc(100vh - var(--header-h)); }
.sidebar {
  width: var(--sidebar-w); flex: 0 0 var(--sidebar-w);
  display: flex; flex-direction: column;
  background: linear-gradient(180deg, #fbfcfe 0%, #f8fafd 100%);
  border-right: 1px solid var(--line);
  padding: 18px 12px 16px;
  position: sticky; top: var(--header-h);
  height: calc(100vh - var(--header-h)); overflow-y: auto;
}
.nav-group { margin-bottom: 22px; }
.nav-title {
  font-family: var(--mono);
  font-size: calc(9.5px * 1.3); letter-spacing: .14em; color: var(--faint);
  padding: 0 10px 8px; font-weight: 500; text-transform: uppercase;
}
.nav-link {
  position: relative;
  display: flex; align-items: center; gap: 9px;
  height: 36px; padding: 0 10px; margin-bottom: 2px; border-radius: var(--radius-sm);
  color: var(--text-2); font-size: calc(13px * 1.3); font-weight: 500;
  transition: background .15s, color .15s;
}
.nav-link:hover { background: var(--surface-3); color: var(--text); }
.nav-link.active {
  background: var(--surface); color: var(--ink); font-weight: 600;
  box-shadow: 0 0 0 1px var(--line), var(--shadow-sm);
}
.nav-link.active::before {
  content: ""; position: absolute; left: 0; top: 10px; bottom: 10px; width: 2px;
  border-radius: 0 2px 2px 0; background: var(--accent);
}
.nav-icon { width: 18px; height: 18px; display: grid; place-items: center; flex: 0 0 18px; color: var(--text-3); }
.nav-icon svg { width: 16px; height: 16px; stroke-width: 1.6; }
.nav-link.active .nav-icon { color: var(--primary); }
.nav-badge { margin-left: auto; font-size: calc(10px * 1.3); background: var(--danger); color: #fff; border-radius: 3px; padding: 1px 6px; }
.sidebar-foot {
  margin-top: auto; padding: 12px 12px;
  border: 1px solid var(--line); border-radius: var(--radius-md);
  background: var(--surface);
}
.sidebar-foot .tag { height: 20px; padding: 0 7px; font-size: calc(9.5px * 1.3); font-family: var(--mono); letter-spacing: .04em; }
.sidebar-foot p { margin-top: 8px; font-size: calc(11px * 1.3); line-height: 1.65; color: var(--muted); }
.sidebar-foot small { display: block; margin-top: 6px; font-size: calc(9.5px * 1.3); color: var(--faint); font-family: var(--mono); letter-spacing: .02em; }
.main {
  flex: 1; min-width: 0; padding: 28px 32px 56px; background: var(--bg);
  background-image: radial-gradient(rgba(10, 18, 32, 0.045) 0.6px, transparent 0.6px);
  background-size: 24px 24px;
  background-position: -1px -1px;
}
.main > * { position: relative; }

/* ---------- page ---------- */
.page { max-width: var(--content-max); margin: 0 auto; }
.page-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 24px;
  margin-bottom: 24px; flex-wrap: wrap;
}
.page-head > div:first-child { min-width: 0; }
.page-title {
  font-size: calc(30px * 1.3); font-weight: 680; line-height: 1.22;
  letter-spacing: -.025em; color: var(--ink);
}
.page-desc { color: var(--muted); font-size: calc(13.5px * 1.3); line-height: 1.75; margin-top: 8px; max-width: 900px; }
.page-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding-top: 4px; }
.breadcrumb {
  display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
  font-family: var(--mono);
  font-size: calc(10.5px * 1.3); letter-spacing: .04em; color: var(--faint);
  margin-bottom: 10px;
}
.breadcrumb a { color: var(--faint); }
.breadcrumb a:hover { color: var(--primary); }
.breadcrumb .sep { color: #c3cfdf; }

/* 报告眉题与署名行（结果页/报告页共用） */
.report-eyebrow {
  display: flex; align-items: center; gap: 8px; margin-bottom: 10px;
  font-family: var(--mono); font-size: calc(10px * 1.3); font-weight: 500;
  letter-spacing: .16em; text-transform: uppercase; color: var(--primary);
}
.report-eyebrow::before {
  content: ""; width: 18px; height: 1px; background: currentColor; opacity: .7; flex: none;
}
.report-eyebrow span { color: var(--faint); letter-spacing: .12em; }
.report-byline {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px 18px;
  margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line);
  font-size: calc(11.5px * 1.3); color: var(--muted);
}
.report-byline b { font-weight: 600; color: var(--text-2); }
.report-byline .mono { color: var(--text-2); }

/* ---------- layout helpers ---------- */
.grid { display: grid; gap: 14px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.grid-main { grid-template-columns: minmax(0, 1fr) 330px; }
.mt-8 { margin-top: 8px; } .mt-12 { margin-top: 12px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; } .mb-12 { margin-bottom: 12px; } .mb-16 { margin-bottom: 16px; }
.flex { display: flex; } .items-center { align-items: center; } .items-start { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.gap-6 { gap: 6px; } .gap-8 { gap: 8px; } .gap-12 { gap: 12px; } .gap-16 { gap: 16px; }
.wrap { flex-wrap: wrap; }
.muted { color: var(--muted); } .weak { color: var(--text-3); }
.small { font-size: calc(12px * 1.3); } .tiny { font-size: calc(11px * 1.3); }
.right { text-align: right; } .center { text-align: center; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.nowrap { white-space: nowrap; }
.grow { flex: 1; min-width: 0; }
.hr { height: 1px; background: var(--line); margin: 16px 0; border: 0; }
.strong { font-weight: 600; color: var(--text); }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field-label { font-size: calc(11.5px * 1.3); font-weight: 600; color: var(--text-2); letter-spacing: .01em; }
.field-hint { font-size: calc(11px * 1.3); color: var(--faint); line-height: 1.6; }
.input, .select, .textarea {
  width: 100%; height: 38px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); padding: 0 11px; outline: none;
  font-size: calc(13px * 1.3); color: var(--text);
  transition: border-color .15s, box-shadow .15s;
}
.textarea { height: auto; min-height: 88px; padding: 9px 11px; resize: vertical; }
.input:hover, .select:hover, .textarea:hover { border-color: #c5d1e2; }
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-glow);
}
.input::placeholder { color: var(--text-3); }
.input-sm, .select-sm { height: 30px; font-size: calc(12px * 1.3); border-radius: var(--radius-xs); }
.form-grid, .form-grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form-grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.form-section { border: 1px solid var(--line); border-radius: var(--radius-md); padding: 16px; background: var(--surface); }
.form-section-title { font-size: calc(13px * 1.3); font-weight: 600; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.form-section-title .dot { width: 4px; height: 4px; border-radius: 1px; background: var(--accent); }

/* ---------- toolbar ---------- */
.toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.filters { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.search { position: relative; }
.search .input { padding-left: 31px; width: 236px; }
.search svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 14px; height: 14px; color: var(--text-3); }

/* ---------- sample drill list ---------- */
.sample-list { display: flex; flex-direction: column; gap: 6px; }
.sample-row {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 9px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text); font: inherit; text-align: left; cursor: pointer;
  transition: border-color .15s, background .15s;
}
.sample-row:hover { border-color: #b7c8e2; background: var(--surface-2); }
.sample-row .sample-label { flex: 1; color: var(--text-2); }
.sample-row .sample-value { font-weight: 600; font-variant-numeric: tabular-nums; font-family: var(--mono); }
.sample-row .sample-arrow { color: var(--primary); font-size: calc(12px * 1.3); }

/* ---------- algorithm document ---------- */
.doc-page { max-width: 1180px; }
.card.doc-hero {
  position: relative; overflow: hidden;
  border-color: var(--line);
  border-left: 3px solid var(--ink);
  background: var(--surface);
  color: var(--text);
  box-shadow: none;
}
.card.doc-hero::before { display: none; }
.doc-hero .card-body { position: relative; z-index: 1; padding: 26px 30px; }
.doc-hero-title {
  font-family: var(--mono); font-size: calc(10px * 1.3); color: var(--primary); font-weight: 500;
  letter-spacing: .16em; text-transform: uppercase;
}
.doc-hero-text {
  font-size: calc(19px * 1.3); font-weight: 650; line-height: 1.65; margin-top: 10px; color: var(--ink);
  letter-spacing: -.02em; max-width: 780px;
}
.doc-hero-meta { display: flex; flex-wrap: wrap; gap: 8px 20px; margin-top: 14px; font-size: calc(11.5px * 1.3); color: var(--muted); font-family: var(--mono); }
.doc-body { font-size: calc(13px * 1.3); line-height: 1.95; color: var(--text-2); }
.doc-body b { color: var(--text); }
.doc-grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }
.doc-note { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 14px; font-size: calc(12px * 1.3); line-height: 1.9; }
.doc-flow { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.doc-flow > div { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px; background: var(--surface); }
.doc-flow b { display: block; margin-bottom: 4px; }
.doc-flow span { font-size: calc(12px * 1.3); color: var(--faint); line-height: 1.7; }
.doc-stat-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; }
.doc-stat-grid > div { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 12px; background: var(--surface); }
.doc-stat-grid b { display: block; font-size: calc(22px * 1.3); line-height: 1.2; font-family: var(--mono); letter-spacing: -.02em; }
.doc-stat-grid span { font-size: calc(11px * 1.3); color: var(--faint); }
.formula-block {
  background: var(--surface-2); border: 1px solid var(--line); border-left: 2px solid var(--accent);
  border-radius: var(--radius-sm);
  padding: 12px 14px; font-family: var(--mono); font-size: calc(12px * 1.3); line-height: 2; color: var(--text-2);
}
.doc-example-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 12px; font-size: calc(12px * 1.3); color: var(--faint); }
.doc-example-head b { font-size: calc(15px * 1.3); color: var(--text); }
.doc-faq { display: flex; flex-direction: column; gap: 12px; }
.doc-faq > div { border-left: 2px solid var(--primary); padding-left: 12px; }
.doc-faq b { display: block; margin-bottom: 2px; color: var(--text); }
.doc-faq span { font-size: calc(12px * 1.3); color: var(--muted); }

/* ---------- sample stat cards ---------- */
.sample-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(125px, 1fr)); gap: 8px; }
.sample-stat {
  display: flex; flex-direction: column; gap: 4px; align-items: flex-start;
  padding: 11px 13px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text); font: inherit; text-align: left;
}
button.sample-stat { cursor: pointer; transition: border-color .15s, background .15s; }
button.sample-stat:hover { border-color: #b7c8e2; background: var(--surface-2); }
.sample-stat-label { color: var(--faint); font-size: calc(11px * 1.3); }
.sample-stat b { font-size: calc(19px * 1.3); line-height: 1.2; font-variant-numeric: tabular-nums; font-family: var(--mono); }
.sample-stat-sub { color: var(--faint); font-size: calc(11px * 1.3); }
.sample-stat.static { background: var(--surface-2); }
.result-meta { display: flex; gap: 14px; align-items: center; color: var(--faint); font-size: calc(12px * 1.3); flex-wrap: wrap; }

/* ---------- table ---------- */
.table-wrap {
  border: 1px solid var(--line); border-radius: var(--radius-md);
  overflow: auto; background: var(--surface);
}
.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: calc(13px * 1.3); }
.table th {
  position: sticky; top: 0; z-index: 2;
  background: var(--surface-2); color: var(--muted);
  font-size: calc(11px * 1.3); font-weight: 600; letter-spacing: .03em;
  text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
.table td { padding: 10px 12px; border-bottom: 1px solid var(--line-2); vertical-align: middle; color: var(--text-2); }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: #f8fbff; }
.table tbody tr.clickable { cursor: pointer; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table .center { text-align: center; }
.table .strong { font-weight: 600; color: var(--text); }
.table .sub { color: var(--faint); font-size: calc(11px * 1.3); }
.table-compact td { padding: 6px 7px; font-size: calc(11px * 1.3); }
.table-compact th { padding: 6px 7px; font-size: calc(11px * 1.3); }
.table-compact th, .table-compact td { white-space: nowrap; }
.table-wide { min-width: 1080px; }
.table-wide td { white-space: nowrap; }

/* ---------- score sheet ---------- */
.score-sheet-wrap { max-height: calc(100vh - 330px); }
.score-sheet { min-width: 1900px; }
.score-sheet th, .score-sheet td { white-space: nowrap; }
.score-sheet th { text-align: center; padding: 9px 12px; font-size: calc(10.5px * 1.3); line-height: 1.4; }
.score-sheet th.num, .score-sheet td.num { text-align: right; font-variant-numeric: tabular-nums; font-family: var(--mono); }
.score-sheet thead tr:first-child th { top: 0; z-index: 5; }
.score-sheet thead tr:nth-child(2) th { top: 34px; z-index: 5; }
.score-sheet .col-no,
.score-sheet .col-name,
.score-sheet .col-school,
.score-sheet .col-class {
  position: sticky;
  z-index: 4;
  background: var(--surface);
}
.score-sheet thead .col-no,
.score-sheet thead .col-name,
.score-sheet thead .col-school,
.score-sheet thead .col-class { background: var(--surface-2); }
.score-sheet thead tr th.col-no,
.score-sheet thead tr th.col-name,
.score-sheet thead tr th.col-school,
.score-sheet thead tr th.col-class { z-index: 7; }
.score-sheet .col-no { left: 0; width: 108px; min-width: 108px; }
.score-sheet .col-name { left: 108px; width: 88px; min-width: 88px; }
.score-sheet .col-school { left: 196px; width: 88px; min-width: 88px; }
.score-sheet .col-class { left: 284px; width: 92px; min-width: 92px; }
.score-sheet tbody tr:hover td.col-no,
.score-sheet tbody tr:hover td.col-name,
.score-sheet tbody tr:hover td.col-school,
.score-sheet tbody tr:hover td.col-class { background: #f8fbff; }
.score-sheet td.score-total { font-weight: 600; background: #f8fbff; }
.score-sheet .score-absent { color: var(--warning); font-size: calc(11px * 1.3); }
.score-sheet .score-total { font-weight: 600; }

.empty { padding: 44px 16px; text-align: center; color: var(--faint); font-size: calc(13px * 1.3); }
.empty-icon {
  width: 42px; height: 42px; margin: 0 auto 10px; border-radius: var(--radius-md);
  display: grid; place-items: center; font-size: calc(18px * 1.3); color: var(--text-3);
  background: var(--surface-2); border: 1px solid var(--line); opacity: 1;
}
.pagination {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 14px; border-top: 1px solid var(--line); background: var(--surface);
  flex-wrap: wrap; font-size: calc(11.5px * 1.3); color: var(--muted);
}
.page-btns { display: flex; gap: 4px; align-items: center; }
.page-btn {
  min-width: 28px; height: 28px; padding: 0 8px; border-radius: var(--radius-xs);
  border: 1px solid var(--line); background: var(--surface); color: var(--text-2); font-size: calc(12px * 1.3);
  font-family: var(--mono);
  transition: border-color .15s, color .15s, background .15s;
}
.page-btn:hover { border-color: #b7c8e2; color: var(--primary); background: var(--surface-2); }
.page-btn.active { background: var(--ink); border-color: var(--ink); color: #fff; }
.page-btn:disabled { opacity: .45; cursor: not-allowed; }

/* ---------- print ---------- */
@media print {
  .topbar, .sidebar, .page-actions, .no-print,
  .tabs, .filters, .pagination { display: none !important; }
  .main { padding: 0; background: #fff; background-image: none; }
  .page { max-width: none; }
  body { background: #fff; }
  .card, .stat, .table-wrap { box-shadow: none; }
  .card { border: 1px solid #e5e7eb; }
  .table th { position: static; }
}

/* ---------- responsive ---------- */
@media (max-width: 1280px) {
  .main { padding: 24px 26px 48px; }
  .page-title { font-size: calc(27px * 1.3); }
}
@media (max-width: 1080px) {
  :root { --sidebar-w: 214px; }
  .topbar { padding: 0 20px; }
  .topbar-right { gap: 6px; }
  .user-role { display: none; }
}
@media (max-width: 900px) {
  .topbar .badge, .topbar-divider, .brand-sub { display: none; }
  .main { padding: 18px 16px 40px; background-image: none; }
  .page-title { font-size: calc(24px * 1.3); }
  .page-head { gap: 14px; }
}
@media (max-width: 760px) {
  :root { --sidebar-w: 60px; --header-h: 60px; }
  .sidebar { padding: 12px 6px; }
  .nav-title, .nav-link span:not(.nav-icon), .sidebar-foot { display: none; }
  .nav-link { justify-content: center; padding: 0; }
  .brand-name { font-size: calc(13px * 1.3); }
  .user-chip { padding: 3px; }
  .user-chip > div:last-child { display: none; }
  .grid-2, .grid-3, .grid-4, .grid-5, .grid-main { grid-template-columns: minmax(0, 1fr); }
  .page-actions { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition-duration: .001ms !important; animation-duration: .001ms !important; }
}
