/* 学员大队综合信息系统 · 浅色白底 + 深蓝顶栏/表头 */
:root {
  --navy: #1e3a5f;
  --navy-2: #2f6fa8;
  --navy-3: #5aa0c8;
  --ink: #33475b;
  --ink-2: #5a6b7c;
  --line: #d7e0ea;
  --bg: #f4f6f9;
  --card: #ffffff;
  --danger: #c0392b;
  --warn: #d9822b;
  --ok: #2e7d5b;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(30, 58, 95, .10);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.55 "Microsoft YaHei", "PingFang SC", "Helvetica Neue", Arial, sans-serif;
  -webkit-text-size-adjust: 100%;
}
a { color: var(--navy-2); }

/* 顶栏 */
.topbar {
  display: flex; align-items: center; gap: 16px;
  background: var(--navy); color: #fff;
  padding: 0 16px; min-height: 56px;
  box-shadow: var(--shadow);
  position: sticky; top: 0; z-index: 30;
}
.brand { font-size: 17px; font-weight: 700; letter-spacing: .5px; white-space: nowrap; }
.nav { display: flex; gap: 4px; overflow-x: auto; flex: 1; scrollbar-width: thin; }
.nav.nav-hidden { visibility: hidden; }
.nav-tab {
  display: flex; align-items: center; min-height: 44px; padding: 0 14px;
  color: #dbe6f3; text-decoration: none; white-space: nowrap;
  border-bottom: 3px solid transparent; font-size: 14px;
}
.nav-tab:hover { color: #fff; background: rgba(255, 255, 255, .08); }
.nav-tab.active { color: #fff; font-weight: 700; border-bottom-color: #7fb2dd; }
.me-box { display: flex; align-items: center; gap: 10px; white-space: nowrap; }
.me-role { font-size: 13px; color: #dbe6f3; }
.me-demo { font-size: 12px; color: #ffd9a0; }

/* 布局 */
.view { max-width: 1360px; margin: 0 auto; padding: 16px; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); margin-bottom: 16px; overflow: hidden;
}
.card-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 16px; background: #eef3f8; border-bottom: 1px solid var(--line); flex-wrap: wrap;
}
.card-title { margin: 0; font-size: 15px; color: var(--navy); font-weight: 700; }
.card-note { font-size: 13px; color: var(--ink-2); }
.card-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-end; }
.card-body { padding: 16px; }
.sub-title { margin: 18px 0 8px; font-size: 14px; color: var(--navy); }
.inline-note { font-size: 13px; color: var(--ink-2); margin-bottom: 10px; }
.inline-warn { color: var(--warn); }

/* 统计卡 */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat-card { background: var(--card); border: 1px solid var(--line); border-left: 4px solid var(--navy-2); border-radius: var(--radius); padding: 12px 14px; box-shadow: var(--shadow); }
.stat-card.stat-danger { border-left-color: var(--danger); }
.stat-label { font-size: 13px; color: var(--ink-2); }
.stat-value { font-size: 26px; font-weight: 700; color: var(--navy); line-height: 1.25; }
.stat-danger .stat-value { color: var(--danger); }
.stat-foot { font-size: 12px; color: var(--ink-2); margin-top: 2px; }

/* 学员队卡片 */
.unit-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 12px; }
.unit-card { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; background: #fbfcfe; }
.unit-card-head { display: flex; align-items: baseline; justify-content: space-between; }
.unit-card-head h4 { margin: 0 0 8px; font-size: 15px; color: var(--navy); }
.unit-headcount { font-size: 13px; color: var(--ink-2); }
.unit-metrics { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px 12px; }
.unit-metrics .m-label { font-size: 12px; color: var(--ink-2); margin-right: 6px; }
.unit-metrics b { color: var(--navy); }
.unit-party { margin-top: 8px; font-size: 12px; color: var(--ink-2); }

/* 图表 */
.chart { width: 100%; height: 320px; }
.chart-sm { height: 240px; }

/* 表格（桌面） */
.table-wrap { width: 100%; overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th {
  background: var(--navy); color: #fff; text-align: left; font-weight: 600;
  padding: 10px 12px; white-space: nowrap;
}
.data-table td { padding: 9px 12px; border-bottom: 1px solid #e8edf2; vertical-align: top; }
.data-table tbody tr:nth-child(even) { background: #fafcfe; }
.data-table td.num, .data-table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.cell-danger { background: #fdf3f2; }
.danger-text { color: var(--danger); }
.score-pos { color: var(--ok); }

/* 标签 */
.tag { display: inline-block; padding: 1px 8px; border-radius: 10px; background: #eaeff5; color: var(--ink-2); font-size: 12px; margin: 0 2px 2px 0; }
.tag-danger { background: #fbe6e3; color: var(--danger); font-weight: 700; }
.tag-warn { background: #fdf0dd; color: var(--warn); }
.followup-list { display: flex; flex-direction: column; gap: 4px; }
.followup { font-size: 12px; color: var(--ink-2); }
.followup-overdue { color: var(--danger); font-weight: 700; }

/* 工具条与表单 */
.toolbar { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; margin-bottom: 14px; }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 150px; }
.field label { font-size: 12px; color: var(--ink-2); }
input[type="file"] { min-height: 44px; padding: 8px 0; }
input[type="text"], input[type="date"], input[type="number"], input[type="password"], select, textarea {
  min-height: 44px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px;
  background: #fff; color: var(--ink); font: inherit; width: 100%;
}
textarea { min-height: 90px; }
select[multiple], .js-stu-select { min-height: 96px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--navy-3); outline-offset: -1px; }
.check-field { display: flex; align-items: center; gap: 8px; min-height: 44px; font-size: 13px; color: var(--ink-2); }
.check-field input { width: 18px; height: 18px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 44px; padding: 0 14px; border-radius: 6px; border: 1px solid var(--line);
  background: #fff; color: var(--navy); font: inherit; cursor: pointer;
}
.btn:hover { background: #f0f5fa; }
.btn-primary { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn-primary:hover { background: #16314f; }
.btn-danger { background: #fff; border-color: #e3b4ae; color: var(--danger); }
.btn-ghost { border-color: transparent; background: transparent; color: var(--ink-2); }
.btn-sm { min-height: 36px; padding: 0 10px; font-size: 13px; }
.btn-block { width: 100%; }
.icon-btn { min-width: 44px; min-height: 44px; border: none; background: transparent; font-size: 16px; cursor: pointer; color: var(--ink-2); }

/* 模板下载 */
.tpl-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.tpl-item {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  min-height: 44px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius);
  background: #fbfcfe; text-decoration: none; color: var(--navy); font-size: 14px;
}
.tpl-item:hover { background: #eef3f8; }
.tpl-ext { font-size: 12px; color: var(--ink-2); }

/* 规则配置 */
.rule-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; }
.form-actions { margin-top: 14px; }

/* 组织树 */
.org-tree { list-style: none; margin: 0; padding-left: 0; }
.org-tree ul { list-style: none; margin: 0; padding-left: 18px; border-left: 1px dashed var(--line); }
.tree-row { display: flex; align-items: center; gap: 8px; padding: 6px 0; flex-wrap: wrap; }
.tree-name { font-weight: 600; color: var(--navy); }
.tree-actions { display: flex; gap: 6px; margin-left: auto; flex-wrap: wrap; }

/* 分页 */
.pager { display: flex; align-items: center; gap: 12px; margin-top: 12px; }
.pager-info { font-size: 13px; color: var(--ink-2); }

/* 空/错状态 */
.empty { padding: 22px; text-align: center; color: var(--ink-2); background: #fbfcfe; border: 1px dashed var(--line); border-radius: var(--radius); }
.empty-error { color: var(--danger); border-color: #e3b4ae; background: #fdf6f5; }
.loading { padding: 22px; text-align: center; color: var(--ink-2); }

/* 弹窗 */
.modal-mask { position: fixed; inset: 0; background: rgba(20, 33, 48, .45); display: flex; align-items: flex-start; justify-content: center; padding: 24px 12px; z-index: 60; overflow-y: auto; }
.modal { background: #fff; border-radius: var(--radius); width: 100%; max-width: 560px; box-shadow: 0 12px 32px rgba(16, 32, 52, .28); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; background: var(--navy); color: #fff; border-radius: var(--radius) var(--radius) 0 0; }
.modal-head h3 { margin: 0; font-size: 15px; }
.modal-head .icon-btn { color: #fff; }
.modal-body { padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 12px 16px; border-top: 1px solid var(--line); }
.followup-row { display: grid; grid-template-columns: 1.4fr 1fr 1fr auto; gap: 8px; margin-bottom: 8px; }
.followup-row input, .followup-row select { min-height: 40px; }

/* 登录 */
.login-wrap { display: flex; justify-content: center; padding: 48px 16px; }
.login-card { width: 100%; max-width: 380px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 24px; display: flex; flex-direction: column; gap: 14px; }
.login-title { margin: 0; font-size: 19px; color: var(--navy); text-align: center; }
.login-err { color: var(--danger); font-size: 13px; min-height: 18px; }

/* 提示条 */
.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%) translateY(16px);
  background: var(--navy); color: #fff; padding: 10px 18px; border-radius: 20px;
  opacity: 0; pointer-events: none; transition: opacity .18s, transform .18s; z-index: 80; max-width: 90vw;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast-error { background: var(--danger); }
.toast-ok { background: var(--ok); }

/* 手机：≤768px 页签横滑 + 表格变卡片流 + 44px 触控 */
@media (max-width: 768px) {
  .topbar { flex-wrap: wrap; gap: 8px; padding: 8px 10px; }
  .brand { font-size: 15px; }
  .nav { order: 3; flex: 0 0 100%; width: 100%; }
  .nav-tab { min-height: 44px; padding: 0 12px; }
  .btn-sm { min-height: 44px; padding: 0 12px; }
  .view { padding: 10px; }
  .two-col { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px; }
  .stat-value { font-size: 22px; }
  .card-body { padding: 12px; }
  .chart, .chart-sm { height: 260px; }
  .unit-grid, .tpl-grid, .rule-grid { grid-template-columns: 1fr; }
  .field { min-width: 100%; }
  .toolbar { gap: 10px; }
  .toolbar .btn { width: 100%; }
  .followup-row { grid-template-columns: 1fr; }

  /* 表格 → 卡片流 */
  .table-wrap { overflow: visible; }
  .data-table, .data-table tbody, .data-table tr, .data-table td { display: block; width: 100%; }
  .data-table thead { display: none; }
  .data-table tr { border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 10px; background: #fff; padding: 6px 10px; }
  .data-table td { display: flex; justify-content: space-between; gap: 12px; border: none; padding: 7px 0; text-align: left; }
  .data-table td::before { content: attr(data-label); color: var(--navy); font-weight: 600; flex: 0 0 auto; }
  .data-table td:empty { display: none; }
  .cell-danger { background: #fdf3f2; }
  .tree-actions { margin-left: 0; }
  .modal-mask { padding: 0; align-items: stretch; }
  .modal { max-width: none; border-radius: 0; min-height: 100%; }
}
