/* 伟咨教育 · 教师教务工作台 全局样式
   视觉语言与原「伟咨教育学员管理系统」保持一致：
   渐变品牌头 + 白底圆角卡 + 柔和投影 + 宝蓝主色 + 彩色顶边指标卡 + 圆角胶囊 */
:root {
  --primary: #4a6bdf;
  --primary-dark: #3a5bc7;
  --primary-light: #eef2fe;
  --danger: #e74c3c;
  --danger-dark: #c0392b;
  --danger-light: #fdf0ee;
  --warn: #f39c12;
  --warn-dark: #e67e22;
  --warn-light: #fff8e6;
  --ok: #2ecc71;
  --ok-dark: #27ae60;
  --ok-light: #e9fbf1;
  --teal: #17a2b8;
  --purple: #9b59b6;
  --bg: #f5f7fa;
  --card: #ffffff;
  --border: #eaeaea;
  --line: #f0f0f0;
  --text: #333333;
  --text2: #7f8c8d;
  --ink: #2c3e50;
  --sidebar: #2c3e50;
  --sidebar-text: #d5dde5;
  --sidebar-active: #4a6bdf;
  --shadow: 0 5px 15px rgba(0, 0, 0, .05);
  --shadow-hover: 0 10px 26px rgba(0, 0, 0, .1);
}
* { margin: 0; padding: 0; box-sizing: border-box; }
/* 基准字号：顶部右侧 A- / A+ 可调，全站 rem 尺寸跟随 */
html { font-size: 17px; }
body {
  font-family: "Segoe UI", "Microsoft YaHei", "PingFang SC", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: .95rem;
  line-height: 1.65;
}
a { color: var(--primary); text-decoration: none; }
button { font-family: inherit; cursor: pointer; }

/* ---------- 布局 ---------- */
.layout { display: flex; min-height: 100vh; }
/* grid 子项默认 min-width:auto，内部宽表格会把整页撑出横向滚动条 */
.grid > *, .ex-wrap > * { min-width: 0; }
.sidebar {
  width: 248px; background: var(--card); color: var(--text);
  position: fixed; top: 0; left: 0; bottom: 0; display: flex; flex-direction: column;
  z-index: 100; border-right: 1px solid var(--border); box-shadow: 2px 0 14px rgba(0, 0, 0, .03);
}
.sidebar .logo {
  margin: 14px 12px 8px; padding: 16px 16px; line-height: 1.4;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #fff; border-radius: 12px; font-size: 1.05rem; font-weight: 700;
  box-shadow: 0 6px 16px rgba(74, 107, 223, .28);
}
.sidebar .logo small { display: block; font-size: .82rem; color: rgba(255, 255, 255, .88); font-weight: 400; margin-top: 5px; }
.sidebar nav { flex: 1; overflow-y: auto; padding: 6px 12px 14px; }
.sidebar .nav-group {
  padding: 14px 12px 6px; font-size: .78rem; color: #9aa8b8; letter-spacing: .6px; font-weight: 700;
}
.sidebar nav a {
  display: flex; align-items: center; gap: 10px; padding: 11px 14px; margin-bottom: 4px;
  color: #45566a; font-size: .95rem; border-radius: 9px; border-left: none;
  transition: all .18s;
}
.sidebar nav a:hover { background: #f4f7ff; color: var(--primary); }
.sidebar nav a.active {
  background: var(--primary); color: #fff; font-weight: 600;
  box-shadow: 0 5px 14px rgba(74, 107, 223, .3);
}
.sidebar nav a.active:hover { color: #fff; }
.sidebar nav a .badge {
  margin-left: auto; background: var(--danger); color: #fff; font-size: .7rem;
  border-radius: 10px; padding: 1px 7px; min-width: 18px; text-align: center;
}
.sidebar .user-mini {
  margin: 8px 12px 14px; padding: 12px 13px; border-radius: 10px;
  background: #f7f9fc; border: 1px solid var(--border);
  font-size: .8rem; color: var(--text2); line-height: 1.7;
}
.sidebar .user-mini b { color: var(--ink); }
.main { flex: 1; min-width: 0; margin-left: 248px; display: flex; flex-direction: column; min-height: 100vh; }
.topbar {
  height: 62px; background: var(--card); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; padding: 0 26px;
  position: sticky; top: 0; z-index: 50;
}
.topbar .page-title { font-size: 19px; font-weight: 700; color: var(--ink); }
.topbar .right { display: flex; align-items: center; gap: 14px; }
.topbar .bell { position: relative; cursor: pointer; font-size: 21px; padding: 6px 9px; border-radius: 8px; }
.topbar .bell:hover { background: var(--bg); }
.topbar .bell .dot {
  position: absolute; top: 2px; right: 2px; background: var(--danger); color: #fff;
  font-size: 10px; border-radius: 9px; padding: 0 5px; min-width: 16px; text-align: center; line-height: 16px;
}
/* 界面字号调节 */
.fs-ctl {
  display: flex; align-items: center; gap: 1px; border: 1px solid var(--border);
  border-radius: 8px; padding: 2px 3px; background: #fff;
}
.fs-ctl button {
  border: none; background: transparent; color: var(--text2); font-size: .78rem;
  padding: 4px 8px; border-radius: 6px; font-weight: 700; line-height: 1;
}
.fs-ctl button:hover { background: var(--primary-light); color: var(--primary); }
.fs-ctl button:disabled { opacity: .35; cursor: default; }
.fs-ctl button:disabled:hover { background: transparent; color: var(--text2); }
.fs-ctl .val { font-size: .72rem; color: var(--text2); min-width: 36px; text-align: center; font-weight: 600; }
.content { padding: 26px; flex: 1; width: 100%; min-width: 0; max-width: 1600px; margin: 0 auto; }

/* ---------- 品牌头（与原系统渐变头一致） ---------- */
.page-hero {
  text-align: center; padding: 26px 20px; border-radius: 10px; margin-bottom: 22px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #fff; box-shadow: 0 5px 15px rgba(0, 0, 0, .1);
}
.page-hero h1 { font-size: 2.15rem; font-weight: 700; letter-spacing: 1px; }
.page-hero p { font-size: 1rem; opacity: .9; margin-top: 6px; }

/* ---------- 卡片 ---------- */
.card {
  background: var(--card); border: none; border-radius: 10px; padding: 22px;
  margin-bottom: 18px; box-shadow: var(--shadow);
}
.card h3 {
  font-size: 1.25rem; color: var(--ink); margin-bottom: 16px; padding-bottom: 13px;
  border-bottom: 2px solid var(--line); display: flex; align-items: center; justify-content: space-between;
}
.card h3 .more { font-size: 13.5px; font-weight: 400; color: var(--text2); }
.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

/* 指标卡：顶边彩色条，与原系统 summary-card 一致 */
.stat-card {
  background: var(--card); border: none; border-radius: 10px; padding: 22px;
  box-shadow: var(--shadow); border-top: 4px solid var(--primary);
  transition: transform .25s, box-shadow .25s;
}
.stat-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-hover); }
.stat-card .num { font-size: 2.35rem; font-weight: 700; color: var(--ink); line-height: 1.2; }
.stat-card .label { color: var(--text2); margin-top: 7px; font-size: .98rem; }
.stat-card.warn { border-top-color: var(--danger); }
.stat-card.warn .num { color: var(--danger); }
.grid > .stat-card:nth-child(2) { border-top-color: var(--ok); }
.grid > .stat-card:nth-child(3) { border-top-color: var(--warn); }
.grid > .stat-card:nth-child(4) { border-top-color: var(--danger); }

/* ---------- 待办中心 ---------- */
.todo-section { border: 1px solid var(--border); border-radius: 10px; background: var(--card); overflow: hidden; box-shadow: var(--shadow); }
.todo-section .todo-head {
  background: linear-gradient(90deg, var(--danger) 0%, #ff6b5b 100%); color: #fff; padding: 13px 18px;
  display: flex; align-items: center; justify-content: space-between;
}
.todo-section .todo-head b { font-size: 15px; }
.todo-tabs { display: flex; border-bottom: 1px solid var(--border); background: var(--card); }
.todo-tabs .tab {
  flex: 1; text-align: center; padding: 12px 0; cursor: pointer; font-weight: 600; color: var(--text2);
  border-bottom: 3px solid transparent; transition: all .25s;
}
.todo-tabs .tab:hover { background: #f8f9fa; }
.todo-tabs .tab.active { color: var(--primary); border-bottom-color: var(--primary); background: #f8f9fa; }
.todo-list { max-height: 460px; overflow-y: auto; }
.todo-item {
  display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line);
  border-left: 4px solid var(--danger); background: var(--danger-light);
}
.todo-item.self { border-left-color: var(--primary); background: var(--primary-light); }
.todo-item.done-item { border-left-color: #b0bec5; background: #f8f9fa; }
.todo-item .tag {
  flex-shrink: 0; font-size: 11px; padding: 3px 9px; border-radius: 20px; font-weight: 600;
}
.todo-item.system .tag { background: var(--danger); color: #fff; }
.todo-item.self .tag { background: var(--primary); color: #fff; }
.todo-item .body { flex: 1; min-width: 0; }
.todo-item .body .t { font-weight: 600; }
.todo-item .body .c { color: var(--text2); font-size: 12.5px; margin-top: 2px; }
.todo-item .ops { flex-shrink: 0; display: flex; gap: 6px; }
.todo-item .time { flex-shrink: 0; color: var(--text2); font-size: 12px; }
.overdue { color: var(--danger); font-weight: 700; }

/* ---------- 表格 ---------- */
table { width: 100%; border-collapse: collapse; background: var(--card); }
th, td { padding: 13px 15px; text-align: left; border-bottom: 1px solid var(--line); font-size: .92rem; }
th { background: #f8f9fa; color: var(--ink); font-weight: 600; white-space: nowrap; border-bottom: 2px solid var(--border); }
tr:hover td { background: #f9fafc; }
.table-wrap { overflow-x: auto; border-radius: 8px; }

/* ---------- 按钮 / 表单 ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px; border: 1px solid #ddd;
  background: #fff; color: #555; padding: 9px 18px; border-radius: 6px; font-size: .95rem;
  font-weight: 600; transition: all .2s;
}
.btn:hover { border-color: var(--primary); color: var(--primary); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); color: #fff; transform: translateY(-2px); box-shadow: 0 5px 10px rgba(74, 107, 223, .3); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { background: var(--danger-dark); border-color: var(--danger-dark); color: #fff; transform: translateY(-2px); box-shadow: 0 5px 10px rgba(231, 76, 60, .3); }
.btn-ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn-ok:hover { background: var(--ok-dark); border-color: var(--ok-dark); color: #fff; transform: translateY(-2px); }
.btn-sm { padding: 5px 12px; font-size: .85rem; }
.btn-lg { padding: 12px 25px; font-size: 1rem; }

.form-row { margin-bottom: 15px; }
.form-row label { display: block; font-weight: 600; margin-bottom: 7px; font-size: .92rem; color: var(--ink); }
.form-row input, .form-row select, .form-row textarea {
  width: 100%; padding: 10px 13px; border: 1px solid #ddd; border-radius: 6px; font-size: .98rem;
  font-family: inherit; background: #fff; color: var(--text); transition: all .2s;
}
.form-row input:focus, .form-row select:focus, .form-row textarea:focus {
  outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(74, 107, 223, .2);
}
.form-row textarea { resize: vertical; min-height: 80px; }
.form-inline { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 15px; }
.form-inline input, .form-inline select {
  padding: 8px 12px; border: 1px solid #ddd; border-radius: 6px; font-size: .92rem; font-family: inherit;
}
.form-inline input:focus, .form-inline select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(74, 107, 223, .2); }
#dh-rows td { vertical-align: top; }
#dh-rows input, #dh-rows select, #dh-rows textarea {
  width: 100%; box-sizing: border-box; padding: 10px 12px; border: 1px solid var(--border);
  border-radius: 6px; font: inherit; color: var(--text); background: var(--card);
}
#dh-rows textarea { min-height: 90px; resize: vertical; }
#dh-rows :is(input,select,textarea):focus { outline: 2px solid var(--primary); outline-offset: 1px; }
#dh-rows :disabled { background: #f8fafc; color: var(--text2); opacity: 1; }

/* ---------- 状态胶囊 ---------- */
.pill { display: inline-block; padding: 4px 11px; border-radius: 20px; font-size: .85rem; font-weight: 600; }
.pill-blue { background: #e6ecfd; color: var(--primary-dark); }
.pill-red { background: #f8d7da; color: #721c24; }
.pill-green { background: #d5f4e6; color: var(--ok-dark); }
.pill-orange { background: #fff3cd; color: #856404; }
.pill-gray { background: #f1f3f5; color: var(--text2); }

/* ---------- 弹窗 ---------- */
.modal-mask {
  position: fixed; inset: 0; background: rgba(0, 0, 0, .5); z-index: 1000;
  display: none; align-items: center; justify-content: center; padding: 12px; box-sizing: border-box;
}
.modal-mask.show { display: flex; }
.modal {
  background: #fff; border-radius: 12px; width: 520px; max-width: 92vw;
  max-height: min(88vh, calc(var(--modal-viewport-height, 100dvh) - 24px)); min-height: 0; overflow: hidden;
  display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(0, 0, 0, .25);
  animation: fadeIn .3s ease;
}
.modal .modal-head {
  padding: 18px 24px; border-bottom: 1px solid var(--border); font-weight: 700;
  font-size: 1.25rem; color: var(--ink); display: flex; justify-content: space-between; align-items: center; flex: 0 0 auto;
}
.modal .modal-head .x { cursor: pointer; color: var(--text2); font-size: 20px; line-height: 1; padding: 0 4px; }
.modal .modal-head .x:hover { color: var(--danger); }
.modal .modal-body { padding: 24px; overflow-y: auto; flex: 1 1 auto; min-height: 0; overscroll-behavior: contain; }
.modal .modal-foot { padding: 12px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; flex: 0 0 auto; flex-wrap: wrap; background: #fff; position: sticky; bottom: 0; z-index: 1; }
.modal-lg { width: 760px; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }

/* ---------- 强提醒弹窗（统一提醒引擎） ---------- */
.remind-pop {
  position: fixed; top: 18px; right: 18px; width: 340px; z-index: 2000;
  background: #fff; border-radius: 12px; box-shadow: 0 12px 40px rgba(0, 0, 0, .25);
  border-left: 6px solid var(--danger); overflow: hidden; display: none; animation: slideIn .3s ease;
}
.remind-pop.show { display: block; }
.remind-pop.persistent { inset: 0; top: 0; right: 0; width: 100%; height: 100%; border: 0; border-radius: 0; background: rgba(15,23,42,.72); display: flex; flex-direction: column; align-items: center; justify-content: center; animation: none; }
.remind-pop.persistent .rp-head, .remind-pop.persistent .rp-body, .remind-pop.persistent .rp-foot { width: min(520px, calc(100vw - 32px)); box-sizing: border-box; }
.remind-pop.persistent .rp-head { border-radius: 14px 14px 0 0; padding: 16px 20px; font-size: 18px; }
.remind-pop.persistent .rp-body { background: #fff; padding: 22px 20px; font-size: 16px; }
.remind-pop.persistent .rp-body .t { font-size: 17px; }
.remind-pop.persistent .rp-foot { background: #fff; border-radius: 0 0 14px 14px; padding: 14px 20px; }
.remind-pop .rp-head { background: var(--danger); color: #fff; padding: 10px 14px; font-weight: 700; font-size: 14px; display: flex; justify-content: space-between; }
.remind-pop .rp-head .x { cursor: pointer; }
.remind-pop .rp-body { padding: 14px; }
.remind-pop .rp-body .t { font-weight: 700; font-size: 14.5px; margin-bottom: 4px; color: var(--ink); }
.remind-pop .rp-body .c { color: var(--text2); font-size: 13px; }
.remind-pop .rp-foot { padding: 10px 14px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; }
@keyframes slideIn { from { transform: translateX(120%); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- Toast ---------- */
.toast {
  position: fixed; top: 70px; left: 50%; transform: translateX(-50%); z-index: 3000;
  background: var(--ink); color: #fff; padding: 10px 22px; border-radius: 8px; font-size: 14px;
  opacity: 0; transition: all .3s; pointer-events: none; box-shadow: 0 8px 24px rgba(0, 0, 0, .25);
}
.toast.show { opacity: 1; }
.toast.ok { background: var(--ok-dark); }
.toast.err { background: var(--danger); }

/* ---------- 快捷入口 ---------- */
.quick-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; }
.quick-item {
  background: var(--card); border: none; border-radius: 10px; padding: 20px 12px;
  text-align: center; cursor: pointer; transition: all .25s; color: var(--text);
  box-shadow: var(--shadow);
}
.quick-item:hover { box-shadow: var(--shadow-hover); transform: translateY(-4px); }
.quick-item .icon { font-size: 26px; }
.quick-item .name { margin-top: 8px; font-weight: 600; font-size: 13.5px; color: var(--ink); }

/* ---------- 登录页 ---------- */
.login-bg {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 55%, #2f4bb0 100%);
}
.login-box { background: #fff; border-radius: 12px; width: 400px; padding: 36px; box-shadow: 0 24px 64px rgba(0, 0, 0, .3); }
.login-box h1 { font-size: 22px; text-align: center; color: var(--ink); }
.login-box .sub { text-align: center; color: var(--text2); margin: 8px 0 26px; font-size: 13px; }
.login-box .tip {
  margin-top: 16px; background: var(--primary-light); border-left: 4px solid var(--primary);
  border-radius: 8px; padding: 11px 13px; font-size: 12px; color: var(--primary-dark); line-height: 1.7;
}

/* ---------- 课表 ---------- */
.schedule-grid { display: grid; grid-template-columns: 70px repeat(5, 1fr); gap: 6px; }
.schedule-grid .cell-head { background: var(--primary); color: #fff; text-align: center; padding: 9px; border-radius: 6px; font-weight: 700; }
.schedule-grid .cell-time { text-align: center; color: var(--text2); display: flex; align-items: center; justify-content: center; font-size: 12px; }
.schedule-cell { background: var(--primary-light); border: 1px solid #cfd9f8; border-radius: 6px; padding: 8px; font-size: 12.5px; min-height: 58px; }
.schedule-cell .c { font-weight: 700; color: var(--primary-dark); }
.schedule-cell .t { color: var(--text2); margin-top: 2px; }
.schedule-cell.selfstudy { background: var(--warn-light); border-color: #f7dfa5; }
.schedule-cell.selfstudy .c { color: var(--warn-dark); }

/* ---------- 日志/详情 ---------- */
.kv { display: grid; grid-template-columns: 110px 1fr; gap: 9px 12px; font-size: .92rem; }
.kv .k { color: var(--text2); }
.kv .v { font-weight: 600; color: var(--ink); }
pre.wechat-text {
  background: #f8f9fa; border: 1px solid var(--border); border-radius: 8px; padding: 14px;
  font-family: "Segoe UI", "Microsoft YaHei", sans-serif; font-size: .9rem; line-height: 1.75; white-space: pre-wrap;
  max-height: 380px; overflow-y: auto;
}
.muted { color: var(--text2); font-size: 12.5px; }
.empty { text-align: center; color: var(--text2); padding: 40px 0; }
.pager { display: flex; gap: 8px; margin-top: 10px; }

@media (max-width: 900px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
  .quick-grid { grid-template-columns: repeat(3, 1fr); }
  .page-hero h1 { font-size: 1.6rem; }

  /* 侧栏改为抽屉：默认移出屏幕，点 ☰ 滑出 */
  .sidebar { transform: translateX(-100%); transition: transform .22s ease; }
  .sidebar.open { transform: none; box-shadow: 0 0 0 100vmax rgba(15, 23, 42, .38); }
  .main { margin-left: 0; }
  .topbar { height: 56px; padding: 0 10px; gap: 6px; }
  .topbar .page-title { font-size: 16px; }
  .topbar .right { gap: 6px; }
  .topbar .bell { font-size: 18px; padding: 4px 6px; }
  .fs-ctl { display: none; }              /* 手机端用双指缩放，省出顶栏空间 */
  .content { padding: 14px 12px 26px; }
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .table-wrap table { min-width: 640px; } /* 宽表容器内横滚，不要把字压扁 */
  .form-inline { flex-wrap: wrap; }
  .btn, button { white-space: nowrap; }   /* 窄屏按钮不拆成竖排单字 */
  .form-inline > * { max-width: 100%; }
  .card { padding: 14px; }
}

/* 极窄屏（≤430px，覆盖 iPhone SE / 12 mini / 常见安卓） */
@media (max-width: 430px) {
  .grid-4, .grid-3, .quick-grid { grid-template-columns: 1fr; }
  .topbar .page-title { font-size: 15px; max-width: 46vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .page-title + .right { flex: 0 0 auto; }
  .table-wrap table { min-width: 560px; }
  .btn { padding: 8px 12px; }
  .modal-box { width: 94vw !important; }
}

/* 顶部栏的移动端菜单按钮（桌面端不显示） */
.mnav {
  display: none; border: 1px solid var(--border); background: var(--card); color: var(--ink);
  border-radius: 9px; width: 36px; height: 36px; font-size: 17px; line-height: 1;
  cursor: pointer; margin-right: 8px; flex: 0 0 auto;
}
@media (max-width: 900px) { .mnav { display: inline-flex; align-items: center; justify-content: center; } }
