/* ==========================================================================
   年级部工作台 — 设计系统
   侧栏深色 + 白字 / 内容区浅色 + 黑字
   ========================================================================== */

:root {
  /* 侧栏 */
  --sidebar-bg: #1E2430;
  --sidebar-text: rgba(255, 255, 255, 0.72);
  --sidebar-text-strong: #FFFFFF;
  --sidebar-active-bg: rgba(255, 255, 255, 0.14);
  --sidebar-divider: rgba(255, 255, 255, 0.12);

  /* 内容区 */
  --bg: #F7F8FA;
  --card: #FFFFFF;
  --border: #E3E6EB;
  --border-strong: #C9CDD4;
  --text: #111827;
  --text-2: #374151;
  --text-3: #6B7280;
  --text-4: #9CA3AF;

  /* 强调色 */
  --blue: #185FA5;
  --blue-dark: #0C447C;
  --blue-bg: #EEF3F9;
  --blue-bg-soft: #F5F9FD;
  --red: #C0392B;
  --red-bg: #FDF3F2;
  --green: #2E7D5B;
  --green-bg: #F2FAF5;
  --amber: #C08A2E;
  --amber-bg: #FFFDF7;
  --amber-bg-2: #FFF8EC;
  --purple: #7A5AA8;

  /* 组合配色 */
  --c-wuhuasheng: #185FA5;
  --c-wuhuadi: #2E7D5B;
  --c-wuhuazheng: #C08A2E;
  --c-lizhengdi: #7A5AA8;

  --radius: 6px;
  --radius-sm: 4px;
  --sidebar-w: 180px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB", sans-serif;
  font-size: 13px;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
button { cursor: pointer; border: none; background: none; }
a { color: var(--blue); text-decoration: none; }

/* ---------- 布局 ---------- */
#app { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  flex: none;
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 30;
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar-brand {
  padding: 14px 14px 12px;
  color: var(--sidebar-text-strong);
  font-size: 13px;
  font-weight: 500;
  border-bottom: 1px solid var(--sidebar-divider);
  margin-bottom: 8px;
  letter-spacing: 0.2px;
  white-space: nowrap;
}
.sidebar-brand .sub {
  display: block;
  font-size: 10px;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.45);
  margin-top: 3px;
  letter-spacing: 0;
}

.nav { padding-bottom: 14px; }

/* ---- 云同步状态角标（侧栏 + 移动端条） ---- */
.sync-chip-wrap { padding: 0 14px 4px; }
.sync-chip {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 10.5px; color: rgba(255, 255, 255, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 10px; padding: 2px 7px;
  cursor: pointer; white-space: nowrap; letter-spacing: 0;
}
.sync-chip:hover { color: #fff; background: rgba(255, 255, 255, 0.08); }
.sync-chip .sc-dot { width: 6px; height: 6px; border-radius: 50%; display: inline-block; flex: 0 0 auto; }
.nav-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 7px 14px;
  font-size: 12px;
  color: var(--sidebar-text);
  border-radius: var(--radius-sm);
  transition: background .12s, color .12s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.nav-item:hover { background: rgba(255, 255, 255, 0.07); color: var(--sidebar-text-strong); }
.nav-item.active { background: var(--sidebar-active-bg); color: var(--sidebar-text-strong); font-weight: 500; }
.nav-sep {
  height: 1px; background: var(--sidebar-divider);
  margin: 8px 14px; 
}

.main {
  flex: 1;
  min-width: 0;
  margin-left: var(--sidebar-w);
  padding: 16px 18px 40px;
}

.page-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.page-title { font-size: 15px; font-weight: 500; color: var(--text); }
.page-title .sub { font-size: 12px; font-weight: 400; color: var(--text-3); margin-left: 8px; }
.page-tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* ---------- 控件 ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11px; padding: 6px 12px;
  border-radius: 5px; border: 1px solid var(--border);
  background: var(--card); color: var(--text-2);
  transition: all .12s; white-space: nowrap;
}
.btn:hover { border-color: var(--border-strong); background: #FCFCFD; }
.btn-primary { background: var(--blue); border-color: var(--blue); color: #fff; font-weight: 500; }
.btn-primary:hover { background: var(--blue-dark); border-color: var(--blue-dark); }
.btn-danger { color: var(--red); }
.btn-danger:hover { background: var(--red-bg); border-color: #EBC9C4; }
.btn-sm { padding: 4px 9px; font-size: 10.5px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }

.input, .select {
  font-size: 11px; padding: 6px 9px;
  border: 1px solid var(--border); border-radius: 5px;
  background: var(--card); color: var(--text); outline: none;
  transition: border-color .12s;
}
.input:focus, .select:focus { border-color: var(--blue); }
.input::placeholder { color: var(--text-4); }

.seg { display: inline-flex; gap: 5px; flex-wrap: wrap; }
.seg-item {
  font-size: 11px; padding: 4px 10px;
  border-radius: var(--radius-sm); border: 1px solid var(--border);
  background: #F0F2F5; color: var(--text-2); transition: all .12s;
}
.seg-item:hover { border-color: var(--border-strong); }
.seg-item.active { background: var(--blue); border-color: var(--blue); color: #fff; font-weight: 500; }

/* ---------- 卡片 ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 11px 12px;
  margin-bottom: 9px;
}
.card-title { font-size: 12.5px; font-weight: 500; color: var(--text); }
.card-desc { font-size: 10px; color: var(--text-3); margin-top: 3px; line-height: 1.6; }
.card-head { margin-bottom: 9px; }

.grid { display: grid; gap: 9px; }
.g2 { grid-template-columns: repeat(2, 1fr); }
.g3 { grid-template-columns: repeat(3, 1fr); }
.g4 { grid-template-columns: repeat(4, 1fr); }
.g-13 { grid-template-columns: 1.3fr 1fr; }
.g-23 { grid-template-columns: 2fr 1fr; }

/* 指标卡 */
.stat {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 9px 11px;
}
.stat-label { font-size: 11px; color: var(--text-3); }
.stat-value { font-size: 17px; font-weight: 500; color: var(--text); margin-top: 2px; line-height: 1.2; }
.stat-sub { font-size: 10px; color: var(--text-3); margin-top: 2px; }
.stat-value.danger { color: var(--red); }
.stat-value.accent { color: var(--blue); }

/* ---------- 表格 ---------- */
.tw { overflow-x: auto; -webkit-overflow-scrolling: touch; }
/* 固定视窗：上下左右都能滚（表头 sticky 吸顶） */
.tw.tw-scroll { overflow: auto; }
.tw.tw-scroll table.tbl thead th {
  position: sticky; top: 0; z-index: 2;
  box-shadow: inset 0 -1px 0 var(--border);
}
.tw.tw-scroll table.tbl thead tr:nth-child(2) th { top: 22px; }
.tw.tw-scroll::-webkit-scrollbar { width: 9px; height: 9px; }
.tw.tw-scroll::-webkit-scrollbar-thumb { background: #C8CED8; border-radius: 5px; }
.tw.tw-scroll::-webkit-scrollbar-thumb:hover { background: #AEB6C2; }
.tw.tw-scroll::-webkit-scrollbar-track { background: #F5F6F8; border-radius: 5px; }
table.tbl { width: max-content; min-width: 100%; border-collapse: collapse; font-size: 10.5px; }
/* 宽表可读性：表头不能被挤断行，且每列有合理下限（用 padding 撑，兼容 table-layout:auto） */
table.tbl th, table.tbl td { padding-left: 8px; padding-right: 8px; }
table.tbl th { white-space: nowrap; }
/* 列数多的宽表：由 JS 加 .wide 类，给出最小宽度让 .tw 出现横向滚动条 */
table.tbl.wide { width: auto; }
table.tbl.wide th, table.tbl.wide td { min-width: 62px; }
table.tbl.wide th:first-child, table.tbl.wide td:first-child { min-width: 36px; }
table.tbl.wide td.strong, table.tbl.wide th.strong { min-width: 72px; }
table.tbl th {
  text-align: left; font-weight: 400; color: var(--text-3);
  padding: 5px 6px; border-bottom: 1px solid var(--border);
  background: var(--bg); position: sticky; top: 0; white-space: nowrap;
}
table.tbl td { padding: 5px 6px; color: var(--text); border-bottom: 1px solid #F0F2F5; white-space: nowrap; }
table.tbl tbody tr:hover td { background: #FCFCFD; }
table.tbl .num { text-align: right; font-variant-numeric: tabular-nums; }
table.tbl .strong { font-weight: 500; }
table.tbl .muted { color: var(--text-3); }
table.tbl .dim { color: var(--text-4); }
/* 宽表考试分组视觉分隔 */
table.tbl th.th-exam { border-left: 1px solid #E3E6EB; background: #FBFCFD; }
table.tbl .gsep { border-left: 1px solid #E3E6EB; }
/* 按学生分组的块头行（培优强基 / 体艺生追踪表） */
table.tbl tr.std-head td { background: #F7F9FC; border-top: 1px solid #E3E6EB; padding: 5px 6px; }
table.tbl tr.std-head:first-child td { border-top: none; }
table.tbl .rollup td { background: var(--blue-bg); color: var(--blue-dark); font-weight: 500; }
table.tbl .grouprow td {
  background: var(--bg); color: var(--blue); font-weight: 500;
  font-size: 10px; padding: 5px 6px;
}
table.tbl tr.subtotal td { background: var(--blue-bg); color: var(--blue-dark); font-weight: 500; }

td.cell-weak { color: var(--red); font-weight: 500; }
td.cell-adv { color: var(--green); }

/* ---------- 徽标 ---------- */
.tag {
  display: inline-block; font-size: 9.5px; line-height: 1.6;
  padding: 1px 6px; border-radius: 3px; white-space: nowrap;
}
.tag-blue { background: var(--blue-bg); color: var(--blue-dark); }
.tag-red { background: var(--red-bg); color: var(--red); }
.tag-green { background: var(--green-bg); color: var(--green); }
.tag-amber { background: var(--amber-bg-2); color: var(--amber); }
.tag-purple { background: #F3EFF9; color: var(--purple); }
.tag-gray { background: #F0F2F5; color: var(--text-3); }

.dot { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 5px; vertical-align: middle; }

/* ---------- 提示条 ---------- */
.note {
  font-size: 10.5px; line-height: 1.65; padding: 7px 10px;
  border-radius: 5px; border: 1px solid var(--border); background: var(--bg); color: var(--text-3);
}
.note b { color: var(--text); }
.note-danger { background: var(--red-bg); border-color: #EBC9C4; color: #7A2E24; }
.note-blue { background: var(--blue-bg-soft); border-color: #CBDCEB; color: var(--blue-dark); }
.note-warn { background: var(--amber-bg-2); border-color: #EBD9B4; color: #7A5A18; }
.note-sm { font-size: 10px; padding: 6px 9px; }

.empty { text-align: center; padding: 40px 20px; color: var(--text-3); font-size: 12px; }
.empty .big { font-size: 13px; color: var(--text-2); margin-bottom: 5px; }

/* ---------- 拖拽上传区（fileDropZone） ---------- */
.fdrop {
  border: 1.5px dashed var(--border-strong); border-radius: 6px;
  padding: 18px 14px; text-align: center; cursor: pointer;
  background: var(--bg); transition: border-color .12s, background .12s;
}
.fdrop:hover { border-color: var(--blue); background: #FBFCFE; }
.fdrop:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.fdrop.dragover { border-color: var(--blue); border-style: solid; background: var(--blue-bg-soft); }
.fdrop.has-file { border-style: solid; border-color: var(--blue); background: #FBFCFE; }
.fdrop-title { font-size: 12px; color: var(--text-2); }
.fdrop.dragover .fdrop-title { color: var(--blue-dark); font-weight: 500; }
.fdrop-sub { font-size: 10px; color: var(--text-4); margin-top: 4px; }
.fdrop-file { font-size: 11px; color: var(--blue-dark); margin-top: 6px; word-break: break-all; }
.fdrop-file:empty { margin-top: 0; }

/* ---------- 图表 ---------- */
.chart { width: 100%; display: block; overflow: visible; }
.chart text { font-family: inherit; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 10px; color: var(--text-3); margin-top: 7px; align-items: center; }

/* 横向进度条 */
.bars { font-size: 10px; color: var(--text-2); }
.bar-row { margin-top: 5px; }
.bar-row:first-child { margin-top: 0; }
.bar-top { display: flex; justify-content: space-between; }
.bar-track { height: 5px; background: #EEF0F3; border-radius: 3px; margin-top: 2px; overflow: hidden; }
.bar-fill { height: 5px; background: var(--blue); border-radius: 3px; transition: width .3s; }
.bar-fill.red { background: var(--red); }
.bar-fill.amber { background: var(--amber); }
.bar-fill.green { background: var(--green); }

/* ---------- 弹层 ---------- */
.mask {
  position: fixed; inset: 0; background: rgba(17, 24, 39, 0.35);
  z-index: 100; display: flex; align-items: flex-start; justify-content: center;
  padding: 40px 16px; overflow-y: auto;
}
.modal {
  background: var(--card); border-radius: 8px; width: 100%; max-width: 920px;
  box-shadow: 0 8px 32px rgba(17, 24, 39, 0.18);
  animation: pop .16s ease-out;
}
@keyframes pop { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.modal-head {
  padding: 13px 16px; border-bottom: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: flex-start; gap: 12px;
}
.modal-title { font-size: 14px; font-weight: 500; }
.modal-sub { font-size: 11px; color: var(--text-3); margin-top: 3px; }
.modal-body { padding: 14px 16px; }
.modal-foot {
  padding: 11px 16px; border-top: 1px solid var(--border);
  display: flex; justify-content: flex-end; gap: 8px; align-items: center;
}
.modal-x { font-size: 18px; line-height: 1; color: var(--text-3); padding: 0 3px; }
.modal-x:hover { color: var(--text); }

/* 单选 / 复选 */
.opt {
  display: block; border: 1px solid var(--border); border-radius: 5px;
  padding: 8px 10px; margin-bottom: 6px; cursor: pointer; transition: all .12s;
}
.opt:hover { border-color: var(--border-strong); }
.opt.on { border: 1.5px solid var(--blue); background: var(--blue-bg-soft); }
.opt-t { font-size: 11.5px; font-weight: 500; color: var(--text-2); }
.opt.on .opt-t { color: var(--blue-dark); }
.opt-d { font-size: 10px; color: var(--text-3); margin-top: 2px; line-height: 1.5; }
.opt input { margin-right: 6px; accent-color: var(--blue); }

.chk {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 10.5px; color: var(--text-2); padding: 3px 0; cursor: pointer;
}
.chk input { accent-color: var(--blue); margin-right: 7px; }
.chk.disabled { color: var(--text-4); cursor: not-allowed; }
.chk-left { display: flex; align-items: center; }
.chk-date { font-size: 9.5px; color: var(--text-3); margin-left: auto; }

/* ---------- 进度 / 遮罩 ---------- */
.loading {
  position: fixed; inset: 0; background: rgba(247, 248, 250, 0.75);
  display: flex; align-items: center; justify-content: center;
  z-index: 200; font-size: 12px; color: var(--text-2);
}

/* ---------- 滚动条 ---------- */
.sidebar::-webkit-scrollbar, .tw::-webkit-scrollbar { width: 8px; height: 8px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.16); border-radius: 4px; }
.tw::-webkit-scrollbar-thumb { background: #D5D9E0; border-radius: 4px; }
.tw::-webkit-scrollbar-track { background: transparent; }

/* ---------- 移动端 ---------- */
.mobile-bar { display: none; }

@media (max-width: 860px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform .2s ease-out;
    box-shadow: 2px 0 16px rgba(0,0,0,.2);
  }
  body.nav-open .sidebar { transform: none; }
  body.nav-open::after {
    content: ''; position: fixed; inset: 0; background: rgba(17,24,39,.4); z-index: 20;
  }
  .main { margin-left: 0; padding: 12px 12px 60px; }

  .mobile-bar {
    display: flex; align-items: center; gap: 10px;
    position: sticky; top: 0; z-index: 25;
    background: var(--sidebar-bg); color: #fff;
    margin: -12px -12px 12px; padding: 10px 12px;
  }
  .mobile-bar .burger { font-size: 16px; color: #fff; line-height: 1; }
  .mobile-bar .mtitle { font-size: 13px; font-weight: 500; }
  .mobile-bar .sync-chip-wrap { padding: 0; margin-left: 8px; }
  .mobile-bar .sync-chip { border: none; padding: 0; gap: 4px; font-size: 10px; }
  .mobile-bar .sync-chip .sc-text { max-width: 92px; overflow: hidden; text-overflow: ellipsis; }

  .g2, .g3, .g4, .g-13, .g-23 { grid-template-columns: 1fr; }
  .modal { max-width: 100%; }
  .mask { padding: 12px 8px; }
  .grid.modal-cols { grid-template-columns: 1fr !important; }
  .page-head { align-items: flex-start; }
}

@media print {
  .sidebar, .mobile-bar, .page-tools { display: none; }
  .main { margin-left: 0; }
}
