/* ===== 主题色（管理员可在「设置 → 界面外观」调整，此处为默认商务绿）===== */
:root {
  --primary: var(--primary);        /* 主色：按钮/链接/强调 */
  --primary-dark: #2e5e43;   /* 侧栏深色背景 */
  --primary-light: var(--primary-light);  /* 登录页渐变浅色 */
  --primary-bg: var(--primary-bg);     /* 标签/胶囊底色 */
  --primary-soft: #a5d6a7;   /* 侧栏选中亮线 */
  --primary-a12: var(--primary-a12); /* 悬浮阴影 */
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: "Microsoft YaHei", "PingFang SC", sans-serif; background: #f3f5f7; color: #2b3238; font-size: 14px; }
.hidden { display: none !important; }

/* ===== 登录 ===== */
.auth-view { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, var(--primary-light) 0%, #f3f5f7 100%); }
.auth-card { background: #fff; padding: 40px; border-radius: 12px; box-shadow: 0 4px 24px rgba(0,0,0,.08); width: 360px; }
.auth-card h1 { text-align: center; margin-bottom: 6px; }
.auth-card h1 .st-top { display: block; font-size: 26px; font-weight: 800; letter-spacing: 5px; color: var(--primary); line-height: 1.25; }
.auth-card h1 .st-sub { display: block; font-size: 15px; font-weight: 600; letter-spacing: 2px; color: #5b6b64; margin-top: 4px; }
.auth-subtitle { text-align: center; color: #888; margin-bottom: 24px; font-size: 13px; }
.auth-error { color: #c0392b; font-size: 13px; margin-top: 10px; text-align: center; min-height: 18px; }

/* ===== 布局 ===== */
.app-view { display: flex; min-height: 100vh; }
.sidebar { width: 200px; background: var(--primary-dark); color: #fff; display: flex; flex-direction: column; position: fixed; top: 0; bottom: 0; }
.sidebar-title { padding: 18px 14px 14px; border-bottom: 1px solid rgba(255,255,255,.15); }
.sidebar-title .st-top { font-size: 19px; font-weight: 800; letter-spacing: 3px; line-height: 1.2; }
.sidebar-title .st-sub { font-size: 12px; font-weight: 600; letter-spacing: 1px; opacity: .85; margin-top: 3px; }
.sidebar nav { flex: 1; padding: 12px 0; }
.nav-item { display: block; padding: 12px 20px; color: rgba(255,255,255,.85); text-decoration: none; font-size: 14px; }
.nav-item:hover { background: rgba(255,255,255,.08); color: #fff; }
.nav-item.active { background: rgba(255,255,255,.16); color: #fff; border-right: 3px solid var(--primary-soft); }
.sidebar-footer { padding: 16px 20px; border-top: 1px solid rgba(255,255,255,.15); font-size: 13px; display: flex; flex-direction: column; gap: 8px; }
.main { flex: 1; margin-left: 200px; padding: 24px; }

/* ===== 组件 ===== */
.btn { padding: 8px 16px; border: none; border-radius: 6px; cursor: pointer; font-size: 14px; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: #276b44; }
.btn-default { background: #fff; border: 1px solid #d0d5d9; color: #333; }
.btn-default:hover { border-color: var(--primary); color: var(--primary); }
.btn-danger { background: #c0392b; color: #fff; }
.btn-text { background: none; border: none; color: inherit; cursor: pointer; text-decoration: underline; padding: 0; font-size: 13px; }
.btn-block { width: 100%; }
.btn-sm { padding: 4px 10px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.form-group { margin-bottom: 14px; }
.form-group label { display: block; margin-bottom: 5px; color: #555; font-size: 13px; }
.form-group input, .form-group select, .form-group textarea {
  width: 100%; padding: 8px 10px; border: 1px solid #d0d5d9; border-radius: 6px; font-size: 14px; font-family: inherit;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus { outline: none; border-color: var(--primary); }
.form-row { display: flex; gap: 14px; }
.form-row .form-group { flex: 1; }

.card { background: #fff; border-radius: 10px; padding: 20px; margin-bottom: 18px; box-shadow: 0 1px 4px rgba(0,0,0,.05); }
.card-title { font-size: 15px; font-weight: bold; margin-bottom: 14px; color: #333; display: flex; align-items: center; gap: 8px; }
.page-title { font-size: 18px; font-weight: bold; margin-bottom: 16px; }
.toolbar { display: flex; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; align-items: center; }
.toolbar input, .toolbar select { padding: 7px 10px; border: 1px solid #d0d5d9; border-radius: 6px; font-size: 14px; }
.toolbar .spacer { flex: 1; }

table.data-table { width: 100%; border-collapse: collapse; background: #fff; }
.data-table th, .data-table td { padding: 9px 10px; border-bottom: 1px solid #edf0f2; text-align: left; font-size: 13px; }
.data-table th { background: #f7f9fa; color: #555; font-weight: 600; white-space: nowrap; }
.data-table tr:hover td { background: #f4f9f5; }
.table-wrap { overflow-x: auto; background: #fff; border-radius: 10px; box-shadow: 0 1px 4px rgba(0,0,0,.05); }

.tag { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 12px; margin: 1px 2px; }
.tag-green { background: var(--primary-bg); color: var(--primary); }
.tag-orange { background: #fdf1e3; color: #d9822b; }
.tag-red { background: #fdecea; color: #c0392b; }
.tag-gray { background: #eef1f3; color: #666; }
.tag-blue { background: #e8f1fb; color: #2f6db3; }

/* 首页 */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat-card { background: #fff; border-radius: 10px; padding: 18px; box-shadow: 0 1px 4px rgba(0,0,0,.05); cursor: default; }
.stat-card .num { font-size: 26px; font-weight: bold; color: var(--primary); }
.stat-card .label { color: #888; font-size: 13px; margin-top: 4px; }
.stat-card.warn .num { color: #d9822b; }
.quick-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; }
.quick-btn { background: #fff; border: 1px solid #e0e4e7; border-radius: 10px; padding: 18px 12px; text-align: center; cursor: pointer; font-size: 14px; transition: all .15s; }
.quick-btn:hover { border-color: var(--primary); color: var(--primary); transform: translateY(-2px); box-shadow: 0 4px 12px var(--primary-a12); }
.quick-btn .icon { font-size: 22px; display: block; margin-bottom: 6px; }
.todo-item { padding: 10px 12px; border-bottom: 1px solid #f0f2f4; display: flex; align-items: center; gap: 10px; }
.todo-item:last-child { border-bottom: none; }
.todo-item .grow { flex: 1; }
.todo-date { color: #c0392b; font-size: 12px; white-space: nowrap; }
.home-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 1100px) { .home-cols { grid-template-columns: 1fr; } }

/* 进度矩阵 */
.progress-cell { cursor: pointer; text-align: center; min-width: 64px; }
.progress-cell:hover { background: #e8f5ec !important; }
.st-未开始 { color: #aaa; }
.st-进行中 { color: #d9822b; font-weight: 600; }
.st-已通过 { color: var(--primary); font-weight: 600; }
.st-未通过 { color: #c0392b; font-weight: 600; }
.st-na { color: #ddd; }

/* 模态框 */
.modal-mask { position: fixed; inset: 0; background: rgba(0,0,0,.4); display: flex; align-items: center; justify-content: center; z-index: 100; }
.modal { background: #fff; border-radius: 12px; width: 560px; max-width: 92vw; max-height: 88vh; display: flex; flex-direction: column; }
.modal.wide { width: 860px; }
.modal-header { padding: 16px 20px; border-bottom: 1px solid #eee; font-size: 16px; font-weight: bold; display: flex; justify-content: space-between; align-items: center; }
.modal-close { background: none; border: none; font-size: 22px; cursor: pointer; color: #999; }
.modal-body { padding: 20px; overflow-y: auto; }
.modal-footer { padding: 14px 20px; border-top: 1px solid #eee; display: flex; justify-content: flex-end; gap: 10px; }

.toast { position: fixed; top: 24px; left: 50%; transform: translateX(-50%); background: #2b3238; color: #fff; padding: 10px 22px; border-radius: 8px; z-index: 200; box-shadow: 0 4px 12px rgba(0,0,0,.2); }
.toast.error { background: #c0392b; }

.empty { text-align: center; color: #aaa; padding: 40px 0; }
.import-mapping { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.import-mapping .form-group { margin-bottom: 0; }
.section-sub { color: #888; font-size: 13px; margin: -8px 0 14px; }
.link { color: var(--primary); cursor: pointer; text-decoration: underline; }
.focus-star { color: #d9822b; cursor: pointer; font-size: 15px; }
/* 晚风留言簿：管理员「查看」匿名者身份的入口——刻意做得不起眼 */
.th-mini-btn { font-size: 12px; color: #b9bfbb; text-decoration: none; border-bottom: 1px dotted #cfd4d1; cursor: pointer; }
.th-mini-btn:hover { color: #7d8a84; border-bottom-color: #9aa39e; }

/* 设置页：二级导航 */
.subtabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 18px; border-bottom: 1px solid #e4e8ea; padding-bottom: 10px; }
.subtab { padding: 8px 16px; border: 1px solid transparent; background: none; border-radius: 8px; cursor: pointer; font-size: 14px; color: #55605a; }
.subtab:hover { background: #eef3ef; }
.subtab.active { background: var(--primary); color: #fff; font-weight: 600; }

/* 设置页：选项 chips */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; min-height: 34px; align-items: center; }
.chip { display: inline-flex; align-items: center; gap: 6px; background: #eef3ef; color: #2e5e43; border-radius: 16px; padding: 5px 8px 5px 12px; font-size: 13px; }
.chip-del { cursor: pointer; color: #7f8c86; font-weight: bold; font-size: 15px; line-height: 1; padding: 0 2px; }
.chip-del:hover { color: #c0392b; }
.chip-input { width: 100%; max-width: 360px; padding: 8px 10px; border: 1px dashed #c8d2cb; border-radius: 8px; font-size: 13px; }
.chip-input:focus { outline: none; border-color: var(--primary); border-style: solid; }

/* 表单分组（学生档案编辑） */
.form-section {
  font-size: 13px; font-weight: 600; color: var(--primary); margin: 18px 0 10px;
  padding-left: 9px; border-left: 3px solid var(--primary); letter-spacing: .3px;
}
.form-section:first-child { margin-top: 0; }
.form-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.form-grid2 .form-group { margin-bottom: 12px; }

/* 学生档案：键值展示 */
.kv-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 20px; }
.kv { display: flex; gap: 8px; font-size: 13.5px; line-height: 1.9; border-bottom: 1px dashed #f0f3f1; padding-bottom: 2px; }
.kv-k { color: #8a9490; min-width: 108px; flex-shrink: 0; }
.kv-v { color: #2b3238; word-break: break-all; }

/* 提示条 */
.notice { background: #f4f7f5; border-left: 3px solid var(--primary); padding: 10px 14px; border-radius: 6px; color: #40484a; }
.notice-warn { background: #fdf6ec; border-left-color: #d9822b; color: #8a5a1b; }

/* 表格：待核实行高亮 / 不换行 / 分页 */
tr.row-warn td { background: #fffaf3; }
.nowrap { white-space: nowrap; }
.pager { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 14px; }
.pager button[disabled] { opacity: .45; cursor: not-allowed; }

/* 列设置弹窗 */
.col-cfg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px 12px; }
.col-cfg-item { display: flex; align-items: center; gap: 6px; font-size: 13.5px; color: #40484a; padding: 5px 8px; border-radius: 6px; cursor: pointer; }
.col-cfg-item:hover { background: #f4f7f5; }
.col-cfg-item input { margin: 0; flex-shrink: 0; }

/* 学生档案：底部记录信息 */
.record-meta { font-size: 12px; color: #9aa5a0; margin-top: 12px; text-align: right; }

/* 学生选择器（输入姓名/学号自动匹配） */
.sp-wrap { position: relative; }
.sp-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.sp-chip { display: inline-flex; align-items: center; gap: 5px; background: var(--primary-bg); color: var(--primary); border-radius: 14px; padding: 3px 10px; font-size: 12.5px; }
.sp-chip b { cursor: pointer; font-weight: 700; color: #6b8f7c; }
.sp-chip b:hover { color: #c0392b; }
.sp-input-row { position: relative; }
.sp-input { width: 100%; padding: 9px 11px; border: 1px solid #d7dce0; border-radius: 8px; font-size: 13.5px; font-family: inherit; background: #fff; }
.sp-input:focus { outline: none; border-color: var(--primary); }
.sp-drop { position: absolute; z-index: 60; left: 0; right: 0; top: 100%; margin-top: 4px;
  background: #fff; border: 1px solid #e3e8e6; border-radius: 9px; box-shadow: 0 8px 22px rgba(0,0,0,.10);
  max-height: 250px; overflow-y: auto; }
.sp-item { padding: 8px 11px; cursor: pointer; font-size: 13px; line-height: 1.55; border-bottom: 1px solid #f3f5f4; }
.sp-item:last-child { border-bottom: none; }
.sp-item.active, .sp-item:hover { background: #f4f9f5; }
.sp-item b { color: #2b3238; }
.sp-item span { color: #7d8a83; margin-left: 6px; }
.sp-item em { display: block; font-style: normal; color: #9aa5a0; font-size: 12px; }
.sp-empty { padding: 10px 11px; color: #9aa5a0; font-size: 13px; }
.sp-hint { font-size: 12px; color: #8a9490; margin-top: 5px; }

/* ===== 界面外观：主题色板 ===== */
.theme-swatch { width: 40px; height: 40px; border-radius: 10px; cursor: pointer; border: 3px solid transparent; box-shadow: inset 0 0 0 1px rgba(0,0,0,.08); display: flex; align-items: center; justify-content: center; color: #fff; font-size: 18px; position: relative; transition: transform .12s; }
.theme-swatch:hover { transform: scale(1.1); }
.theme-swatch.active { border-color: #2b3238; box-shadow: 0 0 0 2px #fff inset, 0 2px 8px rgba(0,0,0,.25); }

/* ===== 移动端自适应（手机浏览器打开自动适配） ===== */
.mobile-header { display: none; }
.sidebar-backdrop { display: none; }

@media (max-width: 768px) {
  /* 顶部栏 + 抽屉式侧栏 */
  .mobile-header { display: flex; align-items: center; gap: 8px; position: fixed; top: 0; left: 0; right: 0; height: 52px; z-index: 140; background: var(--primary-dark); color: #fff; padding: 0 10px; }
  .menu-btn { background: none; border: none; color: #fff; font-size: 22px; cursor: pointer; padding: 4px 8px; line-height: 1; }
  .mh-title { flex: 1; text-align: center; font-size: 15px; font-weight: 700; letter-spacing: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .sidebar { transform: translateX(-100%); transition: transform .2s ease; z-index: 160; width: 220px; box-shadow: 4px 0 24px rgba(0,0,0,.25); }
  .sidebar.open { transform: none; }
  .sidebar-backdrop { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 150; opacity: 0; pointer-events: none; transition: opacity .2s; }
  .sidebar-backdrop.show { opacity: 1; pointer-events: auto; }
  .main { margin-left: 0; padding: 64px 12px 24px; }

  /* 登录页 */
  .auth-card { width: auto; margin: 0 16px; padding: 30px 22px; }

  /* 首页统计卡：两列小卡 */
  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .stat-card { padding: 14px; }
  .stat-card .num { font-size: 20px; }
  .quick-grid { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .quick-btn { padding: 12px 6px; font-size: 12.5px; }
  .quick-btn .icon { font-size: 18px; margin-bottom: 4px; }
  .home-cols { grid-template-columns: 1fr; gap: 14px; }

  /* 待办条目：窄屏时按钮换行到下一行 */
  .todo-item { flex-wrap: wrap; row-gap: 6px; }
  .todo-item .grow { min-width: 55%; }

  /* 表单：双列改单列 */
  .form-row { flex-direction: column; gap: 0; }
  .form-grid2, .import-mapping, .col-cfg { grid-template-columns: 1fr; }
  .kv-grid { grid-template-columns: 1fr; }

  /* 弹窗：全屏化，便于手机操作 */
  .modal-mask { align-items: stretch; z-index: 300; }
  .modal, .modal.wide { width: 100%; max-width: 100%; height: 100%; max-height: 100%; border-radius: 0; min-width: 0; }
  .modal-header { padding: 13px 14px; font-size: 15px; }
  .modal-header span:first-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .modal-body { padding: 14px; overflow-x: auto; }
  .modal-footer { padding: 10px 14px; flex-wrap: wrap; }

  /* 表格与工具栏 */
  .data-table th, .data-table td { font-size: 12px; padding: 7px 8px; }
  .toolbar input, .toolbar select { flex: 1 1 130px; min-width: 0; max-width: 100%; }
  .toolbar input[style] { width: auto !important; }
  .toolbar .spacer { display: none; }
  .pager { flex-wrap: wrap; gap: 8px; font-size: 13px; }

  /* 禁止 Chrome 手机模式下的布局视口扩展：超宽表格在各板块内部横向滚动即可 */
  html, body { overflow-x: hidden; max-width: 100vw; }

  /* 通用留距收紧 */
  .card { padding: 14px; }
  .page-title { font-size: 16px; }
  html { scroll-padding-top: 60px; }
}

@media (max-width: 420px) {
  .quick-grid { grid-template-columns: repeat(2, 1fr); }
  .auth-card h1 .st-top { font-size: 22px; letter-spacing: 3px; }
}
