/* ============ VocabTrace 管理后台 · WeHR 布局风格 ============
   结构：左侧固定侧边栏 + 顶部通栏（搜索/通知/头像下拉） + 主区栅格卡片
   色彩：极浅灰白底 + 白卡 + 主强调红（珊瑚红） + 深蓝活动卡对比 */
:root {
  --m-bg: #fafafa;             /* 页面极浅灰白 */
  --m-side: #ffffff;
  --m-card: #ffffff;
  --m-ink: #1f2437;            /* 主文字（藏青） */
  --m-muted: #8a91a8;
  --m-faint: #b9bfd0;
  --m-line: #ececf2;           /* 细边框 */
  --m-accent: #f0506e;         /* 主强调红（选中菜单/重点按钮/重点数字） */
  --m-accent-soft: #fdeef1;
  --m-navy: #232a4d;           /* 深蓝活动卡 */
  --m-peach: #fdeae4;          /* 指标卡：浅粉 */
  --m-blue: #4f7cf7;  --m-blue-soft: #e9effe;   /* 指标卡：浅蓝 */
  --m-pink: #fbe7f3;           /* 指标卡：浅紫粉 */
  --m-green: #2fa471; --m-green-soft: #e5f5ec;
  --m-orange: #e8862e;
  --m-radius: 14px;
  --m-shadow: 0 4px 18px rgba(31, 36, 55, 0.06);
  --m-font: "PingFang SC", "Microsoft YaHei", "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--m-font);
  background: var(--m-bg);
  color: var(--m-ink);
  font-size: 14px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

/* ---------- 布局：侧边栏 + 右侧（顶栏 + 主区） ---------- */
.m-layout { display: flex; min-height: 100vh; }
.m-side {
  width: 220px; flex: 0 0 220px; background: var(--m-side);
  padding: 30px 22px; position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.m-logo { font-size: 26px; font-weight: 900; letter-spacing: .5px; margin-bottom: 6px; color: var(--m-ink); }
.m-logo b { color: var(--m-accent); }
/* 后台侧边栏校区标识：root 显示「总部」，机构管理员/老师显示「前缀+校区简称」 */
.m-campus { font-size: 12px; font-weight: 700; color: var(--m-accent); margin: 2px 0 36px; }
.m-menu-label { font-size: 11px; letter-spacing: 2px; color: var(--m-faint); margin: 22px 6px 10px; }
.m-item {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; margin-bottom: 6px;
  border-radius: 10px; color: var(--m-muted); text-decoration: none; font-weight: 600; font-size: 14px;
}
.m-item .ic { width: 18px; height: 18px; display: inline-flex; align-items: center; justify-content: center; font-style: normal; }
.m-item .ic svg { width: 16px; height: 16px; display: block; }
.m-item:hover { color: var(--m-ink); background: #f7f7fa; }
/* 选中态：强调红文字 + 浅红背景框衬托（不再前移、不再用红方块标记） */
.m-item.on { color: var(--m-accent); font-weight: 700; background: var(--m-accent-soft); }

/* ---------- 顶部通栏 ---------- */
.m-right { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.m-topbar {
  background: #fff; display: flex; align-items: center; gap: 16px;
  padding: 14px 30px; border-bottom: 1px solid var(--m-line);  /* 白底+分隔线，与主区域区分 */
}
.m-search {
  display: flex; align-items: center; background: #fff; border: 1px solid var(--m-line);
  border-radius: 10px; padding: 9px 14px; width: 300px; color: var(--m-faint);
  box-shadow: var(--m-shadow);
}
.m-search input { border: none; outline: none; background: transparent; flex: 1; font-family: inherit; font-size: 13px; color: var(--m-ink); }
.m-search .s-ic { cursor: pointer; }
.m-top-spacer { flex: 1; }
.m-icons { display: flex; gap: 16px; align-items: center; }
.m-icons .ico { position: relative; font-size: 17px; color: var(--m-muted); cursor: pointer; text-decoration: none; }
.m-icons .ico:hover { color: var(--m-ink); }
.m-icons .dot { position: absolute; top: -2px; right: -4px; width: 8px; height: 8px; border-radius: 50%; background: var(--m-accent); }
.m-user { position: relative; display: flex; align-items: center; gap: 10px; cursor: pointer; }
.m-avatar {
  width: 36px; height: 36px; border-radius: 50%; background: var(--m-navy); color: #fff;
  display: inline-flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 700;
}
.m-user .u-name { font-weight: 700; color: #fff; background: var(--m-ink); border-radius: 999px; padding: 2px 10px; }
.m-user .role-tag { font-size: 11px; color: var(--m-accent); background: var(--m-accent-soft); border-radius: 999px; padding: 2px 10px; font-weight: 700; }
.m-user .caret { color: var(--m-faint); font-size: 11px; }
/* 头像下拉（纯 CSS hover 展开）：与学员端一致——定位到头像行正下方并加透明桥，
   避免鼠标从头像移向下拉的空隙间 :hover 丢失导致菜单闪没 */
.m-drop {
  display: none; position: absolute; top: 100%; right: 0; margin-top: 8px; background: #fff; border-radius: 12px;
  box-shadow: 0 10px 30px rgba(31,36,55,.14); padding: 8px; min-width: 170px; z-index: 60;
}
.m-drop::before { content: ""; position: absolute; left: 0; right: 0; top: -12px; height: 12px; }
.m-user:hover .m-drop, .m-user:focus-within .m-drop { display: block; }
.m-drop a, .m-drop button {
  display: block; width: 100%; text-align: left; padding: 9px 12px; border: none; background: none;
  font-family: inherit; font-size: 13.5px; color: var(--m-ink); text-decoration: none; border-radius: 8px; cursor: pointer;
}
.m-drop a:hover, .m-drop button:hover { background: var(--m-accent-soft); color: var(--m-accent); }

.m-content { padding: 10px 30px 40px; }
.m-title { font-size: 26px; font-weight: 800; letter-spacing: .5px; margin: 14px 0 18px; }

/* ---------- 卡片 ---------- */
.m-card { background: var(--m-card); border-radius: var(--m-radius); box-shadow: var(--m-shadow); padding: 22px 24px; }
.m-card + .m-card { margin-top: 18px; }
.m-card h3 { font-size: 16px; font-weight: 800; margin-bottom: 14px; }
.m-card .sub { font-size: 12px; color: var(--m-muted); margin-top: -10px; margin-bottom: 14px; }
.m-card .link { font-size: 13px; color: var(--m-accent); font-weight: 700; text-decoration: none; cursor: pointer; }

/* ---------- Dashboard 栅格（对标样图） ---------- */
.dash-row1 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin-bottom: 18px; }
.dash-row1.four { grid-template-columns: repeat(4, 1fr); }
.stat-card { border-radius: var(--m-radius); padding: 20px 22px; }
.stat-card.peach { background: var(--m-peach); }
.stat-card.mint { background: #e8f7ef; }
.stat-card.mint .s-hint { color: #1e9e63; }
.stat-card.blue { background: var(--m-blue-soft); }
.stat-card.pink { background: var(--m-pink); }
.stat-card.green { background: var(--m-green-soft); }
.stat-card .s-label { font-size: 14px; font-weight: 700; color: var(--m-ink); }
.stat-card .s-num { font-size: 38px; font-weight: 900; color: var(--m-ink); line-height: 1.2; font-variant-numeric: tabular-nums; }
.stat-card .s-hint { font-size: 12px; font-weight: 600; }
.stat-card.peach .s-hint { color: var(--m-accent); }
.stat-card.blue .s-hint { color: var(--m-blue); }
.stat-card.pink .s-hint { color: #d64fa8; }
.stat-card.green .s-hint { color: var(--m-green); }

.dash-row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-bottom: 18px; }
.trend-card { background: #fff; border-radius: var(--m-radius); box-shadow: var(--m-shadow); padding: 20px 22px; }
.trend-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 6px; }
.trend-head .t-label { font-size: 14px; font-weight: 700; }
.trend-num { font-size: 34px; font-weight: 900; font-variant-numeric: tabular-nums; }
.trend-sub { display: flex; align-items: center; justify-content: space-between; margin-top: 6px; }
.trend-badge { font-size: 12px; font-weight: 700; border-radius: 999px; padding: 3px 10px; background: #fdf1e2; color: var(--m-orange); }
.trend-svg { width: 120px; height: 44px; }

.dash-row3 { display: grid; grid-template-columns: 2fr 1fr; gap: 18px; align-items: start; }
.dash-side { display: flex; flex-direction: column; gap: 18px; }

/* 公告/日志列表（左大卡） */
.log-list { display: flex; flex-direction: column; gap: 10px; }
.log-item { background: #f7f7fa; border-radius: 10px; padding: 12px 16px; }
.log-item .l-title { font-weight: 700; font-size: 13.5px; }
.log-item .l-meta { font-size: 11.5px; color: var(--m-muted); margin-top: 2px; }
.card-foot { text-align: center; margin-top: 14px; }

/* 深蓝活动卡（对标 Recently Activity） */
.navy-card { background: var(--m-navy); color: #fff; border-radius: var(--m-radius); padding: 22px 24px; }
.navy-card .n-sub { font-size: 11px; color: #9aa3c7; }
.navy-card .n-title { font-size: 17px; font-weight: 800; margin: 8px 0 6px; }
.navy-card .n-text { font-size: 12.5px; color: #c6cce4; }
.navy-card .n-time { font-size: 11px; color: #9aa3c7; margin-top: 10px; }
.navy-card .n-btn {
  display: inline-block; margin-top: 14px; background: var(--m-accent); color: #fff;
  border: none; border-radius: 10px; padding: 9px 16px; font-weight: 700; cursor: pointer; font-family: inherit;
}

/* 待办事项（对标 Upcoming Schedule） */
.todo-group { font-size: 12px; font-weight: 700; color: var(--m-muted); margin: 10px 0 6px; }
.todo-item { background: #f7f7fa; border-radius: 10px; padding: 10px 14px; margin-bottom: 8px; }
.todo-item .t-title { font-weight: 700; font-size: 13px; }
.todo-item .t-sub { font-size: 11.5px; color: var(--m-muted); margin-top: 1px; }

/* 第1排：窄趋势卡 + 学员总数 + 待审核学员 */
.dash-row1.three { grid-template-columns: 300px 1fr 320px; }
.trend-card.mini { padding: 16px 18px; }
.trend-card.mini .trend-head .t-label { font-size: 12.5px; }
.trend-card.mini .trend-num { font-size: 28px; }
.trend-card.mini .trend-svg { width: 92px; }

/* 两个长卡片并排：临期学员 + 系统操作日志，高度随数据条数自适应 */
.dash-row-long { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: stretch; margin-bottom: 18px; }
.exp-list { display: flex; flex-direction: column; gap: 10px; }
.exp-item { background: #f7f7fa; border-radius: 10px; padding: 12px 16px; }
.exp-item .e-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.exp-item .e-name { font-weight: 700; font-size: 13.5px; }
.exp-item .e-days { flex: none; font-size: 12px; font-weight: 700; color: var(--m-orange); background: #fdf1e2; border-radius: 999px; padding: 3px 10px; }
.exp-item .e-days.urgent { color: #e03c5a; background: #ffe9ee; }
.exp-item .e-meta { font-size: 11.5px; color: var(--m-muted); margin-top: 4px; }

/* ---------- 表格页（机构/老师/学员等） ---------- */
.m-table { width: 100%; border-collapse: collapse; }
.m-table th { text-align: left; font-size: 12px; color: var(--m-muted); font-weight: 600; padding: 10px 12px; border-bottom: 1px solid var(--m-line); white-space: nowrap; }
.m-table td { padding: 12px; border-bottom: 1px solid var(--m-line); font-size: 13.5px; vertical-align: middle; }
.m-table tr:last-child td { border-bottom: none; }
.m-table tr:hover td { background: #fafbfd; }
.t-strong { font-weight: 700; }
.t-muted { color: var(--m-muted); font-size: 12.5px; }

.badge { display: inline-block; font-size: 12px; font-weight: 700; border-radius: 999px; padding: 3px 12px; }
.badge.ok { background: var(--m-green-soft); color: var(--m-green); }
.badge.off { background: #f0f1f5; color: var(--m-muted); }
.badge.warn { background: #fdf1e2; color: var(--m-orange); }
.badge.acc { background: var(--m-accent-soft); color: var(--m-accent); }
.badge.info { background: var(--m-blue-soft); color: var(--m-blue); }

/* ---------- 按钮 ---------- */
.btn { font-family: inherit; font-size: 13.5px; font-weight: 700; border-radius: 10px; padding: 9px 18px; cursor: pointer; border: none; }
.btn.primary { background: var(--m-accent); color: #fff; }
.btn.primary:hover { background: #e23f5e; }
.btn.navy { background: var(--m-navy); color: #fff; }
.btn.ghost { background: #fff; color: var(--m-ink); border: 1px solid var(--m-line); }
.btn.ghost:hover { border-color: var(--m-ink); }
.btn.danger-ghost { background: #fff; color: var(--m-accent); border: 1px solid var(--m-accent-soft); }
.btn.danger-ghost:hover { background: var(--m-accent-soft); }
.btn.sm { padding: 5px 12px; font-size: 12.5px; border-radius: 8px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.row-btns { display: flex; gap: 6px; flex-wrap: wrap; }

/* ---------- 表单 / 弹窗 / 提示 ---------- */
.m-field { margin-bottom: 14px; }
.m-field label { display: block; font-size: 12.5px; font-weight: 700; color: var(--m-muted); margin-bottom: 6px; }
.m-divider { font-size: 12px; font-weight: 700; color: var(--m-accent); margin: 18px 0 10px; padding-top: 14px; border-top: 1px dashed var(--m-line); }
.m-input, .m-select {
  width: 100%; font-family: inherit; font-size: 13.5px; color: var(--m-ink);
  border: 1px solid var(--m-line); border-radius: 10px; padding: 10px 12px; background: #fbfcfe; outline: none;
}
.m-input:focus, .m-select:focus { border-color: var(--m-accent); background: #fff; }
.m-input:disabled { opacity: .55; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }

.m-mask { position: fixed; inset: 0; background: rgba(31, 36, 55, .45); display: flex; align-items: center; justify-content: center; z-index: 50; }
.m-modal { position: relative; background: #fff; border-radius: 16px; padding: 24px 26px; width: min(560px, 92vw); max-height: 86vh; overflow-y: auto; }
.m-modal h3 { font-size: 17px; font-weight: 800; margin-bottom: 16px; }
/* 弹窗右上角关闭小叉：遮罩点击不关闭，统一以此或底部按钮关闭 */
.m-close { position: absolute; top: 12px; right: 14px; width: 30px; height: 30px; border: none; background: transparent; border-radius: 8px; font-size: 15px; line-height: 1; color: var(--m-muted); cursor: pointer; }
.m-close:hover { background: var(--m-peach, #fdeeee); color: var(--m-accent); }
.m-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }

.m-msg { font-size: 13px; border-radius: 10px; padding: 10px 14px; margin: 12px 0; }
.m-msg.ok { background: var(--m-green-soft); color: var(--m-green); }
.m-msg.err { background: var(--m-accent-soft); color: var(--m-accent); }
.m-empty { text-align: center; color: var(--m-muted); padding: 30px 0; font-size: 13.5px; }
.m-hint { font-size: 12.5px; line-height: 1.7; color: var(--m-muted); background: #f7f7fa; border-radius: 10px; padding: 10px 14px; margin: 4px 0 0; }

/* 汉堡按钮（移动端显示） */
.m-burger { display: none; font-size: 20px; color: var(--m-ink); background: none; border: none; cursor: pointer; }

/* ---------- 登录页 ---------- */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #232a4d 0%, #3d4a8c 60%, #f0506e 140%); }
.login-card { background: #fff; border-radius: 20px; padding: 40px 42px; width: min(400px, 92vw); box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.login-card .lg-brand { font-size: 26px; font-weight: 900; margin-bottom: 4px; }
.login-card .lg-brand b { color: var(--m-accent); }
.login-card .lg-sub { font-size: 12.5px; color: var(--m-muted); margin-bottom: 26px; }
.login-card .btn { width: 100%; margin-top: 6px; }
.lg-tip { margin-top: 16px; font-size: 12px; color: var(--m-muted); text-align: center; }
/* 登录卡片内的次要链接（新学员注册 / 返回登录）：居中、品牌色 */
.lg-link { display: block; width: 100%; margin-top: 12px; padding: 0; border: none; background: transparent; font-size: 13.5px; font-weight: 700; color: var(--m-accent); cursor: pointer; text-align: center; }
.lg-link:hover { text-decoration: underline; }

/* ---------- 响应式：平板/手机侧栏收起为抽屉 ---------- */
@media (max-width: 980px) {
  .m-side {
    position: fixed; left: 0; top: 0; z-index: 70; transform: translateX(-100%);
    transition: transform .25s ease; box-shadow: 0 0 40px rgba(0,0,0,.18);
  }
  .m-layout.side-open .m-side { transform: translateX(0); }
  .m-burger { display: block; }
  .m-search { width: auto; flex: 1; }
  .m-content { padding: 10px 16px 32px; }
  .dash-row1, .dash-row1.three, .dash-row2, .dash-row3, .dash-row-long { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .m-user .u-name { display: none; }
}
