:root {
  --brand: #2563eb;
  --brand2: #0ea5e9;
  --bg: #f1f5f9;
  --card: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --ok: #16a34a;
  --warn: #f59e0b;
  --danger: #dc2626;
  --shadow: 0 10px 30px rgba(15, 23, 42, .12);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  color: var(--text); background: var(--bg); line-height: 1.6;
}
a { color: var(--brand); text-decoration: none; }

/* ---------- 登录/注册页 ---------- */
.auth-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #1e3a8a 0%, #0ea5e9 100%); padding: 20px;
}
.auth-card {
  width: 380px; background: var(--card); border-radius: 18px; box-shadow: var(--shadow);
  padding: 38px 34px; text-align: center;
}
.auth-logo { font-size: 30px; margin-bottom: 6px; }
.auth-title { font-size: 22px; font-weight: 700; }
.auth-sub { color: var(--muted); font-size: 13px; margin-bottom: 22px; }
.auth-tabs { display: flex; gap: 8px; justify-content: center; margin-bottom: 18px; }
.auth-tabs button {
  border: none; background: #eef2ff; color: var(--muted); padding: 7px 18px; border-radius: 20px;
  cursor: pointer; font-size: 14px; font-weight: 600;
}
.auth-tabs button.active { background: var(--brand); color: #fff; }
.field { text-align: left; margin-bottom: 14px; }
.field label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 5px; }
.field input, .field select, .field textarea {
  width: 100%; padding: 11px 13px; border: 1px solid var(--line); border-radius: 10px; font-size: 14px;
  outline: none; transition: border .2s; font-family: inherit;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--brand); }
.btn {
  width: 100%; padding: 12px; border: none; border-radius: 10px; background: var(--brand); color: #fff;
  font-size: 15px; font-weight: 600; cursor: pointer; letter-spacing: 2px; transition: opacity .2s;
}
.btn:hover { opacity: .92; }
.btn.secondary { background: #eef2ff; color: var(--brand); }
.btn.small { width: auto; padding: 7px 14px; font-size: 13px; letter-spacing: 0; }
.btn.danger { background: var(--danger); }
.msg { font-size: 13px; margin-top: 12px; min-height: 18px; }
.msg.err { color: var(--danger); }
.msg.ok { color: var(--ok); }
.hint { font-size: 12px; color: var(--muted); margin-top: 14px; }
.form-foot { text-align: right; margin-top: 12px; }
.form-foot a { color: var(--brand); font-size: 13px; }
.form-foot a:hover { text-decoration: underline; }
.code-field .code-row { display: flex; gap: 8px; }
.code-field .code-row input { flex: 1; }
.code-field .code-row .btn { white-space: nowrap; }
.btn.small:disabled { opacity: .55; cursor: not-allowed; }

/* ---------- 主应用布局 ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: 230px; background: #0f172a; color: #cbd5e1; padding: 22px 14px; position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column;
}
.sidebar .brand { color: #fff; font-size: 18px; font-weight: 700; padding: 4px 10px 18px; }
.sidebar .brand small { display: block; font-size: 11px; color: #64748b; font-weight: 400; margin-top: 2px; }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 11px 12px; border-radius: 9px; cursor: pointer;
  font-size: 14px; color: #cbd5e1; margin-bottom: 4px; transition: background .15s;
}
.nav-item:hover { background: #1e293b; }
.nav-item.active { background: var(--brand); color: #fff; }
.nav-group { margin-bottom: 6px; }
.nav-group-title {
  font-size: 11px; color: #64748b; font-weight: 600; letter-spacing: .5px;
  padding: 8px 12px 4px;
}
.nav-item.sub { padding-left: 30px; font-size: 13.5px; margin-bottom: 2px; }
.sidebar .spacer { flex: 1; }
.user-box { padding: 12px 10px; border-top: 1px solid #1e293b; font-size: 13px; }
.user-box .role { color: #38bdf8; font-weight: 600; }
.logout { margin-top: 8px; color: #f87171; cursor: pointer; font-size: 13px; }

.main { flex: 1; padding: 28px 34px; overflow-y: auto; }
.topbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 22px; }
.topbar h1 { font-size: 22px; }
.topbar .crumb { color: var(--muted); font-size: 13px; }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat {
  background: var(--card); border-radius: 14px; padding: 18px 20px; box-shadow: var(--shadow);
  border-left: 4px solid var(--brand);
}
.stat .num { font-size: 28px; font-weight: 700; }
.stat .label { color: var(--muted); font-size: 13px; margin-top: 2px; }

.panel { background: var(--card); border-radius: 14px; padding: 22px; box-shadow: var(--shadow); margin-bottom: 22px; }
.panel h2 { font-size: 17px; margin-bottom: 14px; display: flex; align-items: center; gap: 8px; }
.panel .head-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.panel .head-row h2 { margin-bottom: 0; }

.list { display: grid; gap: 12px; }
.course {
  border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px; display: flex; justify-content: space-between;
  align-items: center; gap: 14px; transition: box-shadow .15s; cursor: pointer;
}
.course:hover { box-shadow: 0 4px 16px rgba(15,23,42,.08); }
.course .meta { flex: 1; }
.course .meta .t { font-weight: 600; font-size: 15px; }
.course .meta .d { color: var(--muted); font-size: 13px; margin-top: 3px; }
.badge { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 12px; font-weight: 600; }
.badge.cat { background: #e0f2fe; color: #0369a1; }
.badge.not_started { background: #f1f5f9; color: #64748b; }
.badge.in_progress { background: #fef9c3; color: #a16207; }
.badge.completed { background: #dcfce7; color: #15803d; }
.badge.pending { background: #fef3c7; color: #b45309; }
.badge.active { background: #dcfce7; color: #15803d; }
.badge.role-admin { background: #ede9fe; color: #6d28d9; }
.badge.role-mentor { background: #cffafe; color: #0e7490; }
.badge.role-trainee { background: #e0f2fe; color: #0369a1; }

.progress { height: 7px; background: #e2e8f0; border-radius: 6px; overflow: hidden; margin-top: 8px; }
.progress > span { display: block; height: 100%; background: var(--brand); }

.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th, .table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.table th { color: var(--muted); font-weight: 600; background: #f8fafc; }
.table tr:hover td { background: #f8fafc; }

/* 学习任务专用表格：固定列宽，避免长文挤扁"职员"列导致中文按字换行 */
.task-table { width: 100%; border-collapse: collapse; font-size: 14px; table-layout: fixed; min-width: 1080px; }
.task-table th, .task-table td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; word-break: break-word; }
.task-table th { color: var(--muted); font-weight: 600; background: #f8fafc; text-align: left; }
.task-table tr:hover td { background: #f8fafc; }
.task-table .col-date { width: 110px; }
.task-table .col-name { width: 100px; white-space: nowrap; }
.task-table .col-status { width: 96px; text-align: center; }
.task-table .col-ops { width: 130px; }
.task-table .col-long { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: help; }

.modal-mask {
  position: fixed; inset: 0; background: rgba(15,23,42,.45); display: none; align-items: center; justify-content: center; z-index: 50;
}
.modal-mask.show { display: flex; }
.modal { background: #fff; border-radius: 14px; width: 520px; max-width: 92vw; max-height: 88vh; overflow-y: auto; padding: 26px; box-shadow: var(--shadow); }
.modal h3 { font-size: 18px; margin-bottom: 16px; }
.modal .field { margin-bottom: 12px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; }

.quiz-q { border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; margin-bottom: 12px; }
.quiz-q .qt { font-weight: 600; margin-bottom: 8px; }
.quiz-opt { display: block; padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px; margin-bottom: 6px; cursor: pointer; font-size: 14px; }
.quiz-opt.sel { border-color: var(--brand); background: #eff6ff; }
.course-content { white-space: pre-wrap; background: #f8fafc; border-radius: 10px; padding: 16px; font-size: 14px; }

.empty { text-align: center; color: var(--muted); padding: 40px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.row > * { flex: 1; min-width: 160px; }
.toast {
  position: fixed; top: 20px; left: 50%; transform: translateX(-50%); background: #0f172a; color: #fff;
  padding: 11px 22px; border-radius: 10px; font-size: 14px; z-index: 100; opacity: 0; transition: opacity .25s; pointer-events: none;
}
.toast.show { opacity: 1; }
.muted { color: var(--muted); }

/* 附件 */
.attach-list { margin-top: 8px; display: flex; flex-direction: column; gap: 6px; }
.attach-item { display: flex; align-items: center; gap: 10px; padding: 6px 10px; background: #f8fafc; border: 1px solid var(--line); border-radius: 8px; font-size: 13px; }
.attach-item > span:first-child { flex: 1; word-break: break-all; }
.attach-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; margin-top: 10px; }
.attach-preview { background: #f8fafc; border: 1px solid var(--line); border-radius: 10px; padding: 8px; }
.attach-preview img { width: 100%; max-height: 220px; object-fit: cover; border-radius: 6px; display: block; }
.attach-preview video { width: 100%; max-height: 240px; border-radius: 6px; display: block; background: #000; }
.attach-name { font-size: 12px; color: var(--muted); margin-top: 6px; word-break: break-all; }
.attach-link { display: inline-flex; align-items: center; padding: 8px 12px; background: #f1f5f9; border: 1px solid var(--line); border-radius: 8px; color: #0f172a; text-decoration: none; font-size: 13px; gap: 8px; }
.attach-link:hover { background: #e2e8f0; }

/* 考核 tab 栏 */
.tab-bar { display: flex; gap: 4px; background: #f1f5f9; padding: 4px; border-radius: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.tab-bar .tab { padding: 8px 16px; border-radius: 8px; cursor: pointer; font-size: 14px; color: #475569; transition: all .15s; }
.tab-bar .tab:hover { background: #fff; }
.tab-bar .tab.active { background: #fff; color: var(--brand); font-weight: 600; box-shadow: 0 1px 3px rgba(0,0,0,.08); }
small.muted { font-size: 12px; }

/* 登录审计表格 */
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; background: #fff; border-radius: 10px; overflow: hidden; box-shadow: 0 1px 4px rgba(0,0,0,.06); }
.tbl th, .tbl td { padding: 9px 12px; text-align: left; border-bottom: 1px solid #eef1f5; vertical-align: top; }
.tbl th { background: #f5f7fa; color: #475569; font-weight: 600; }
.tbl td code { background: #f1f5f9; padding: 2px 6px; border-radius: 5px; font-size: 12px; }

/* 基础资料门户（仿 ERP 深色分类导航） */
.nav-group-title.clickable {
  cursor: pointer; border-radius: 9px; transition: background .15s, color .15s;
}
.nav-group-title.clickable:hover { background: #1e293b; color: #94a3b8; }
.nav-group-title.active { color: #fff !important; background: var(--brand) !important; }

.basics-portal {
  background: #181c2a; border-radius: 14px; padding: 22px 26px;
  box-shadow: 0 14px 40px rgba(0,0,0,.22);
  display: inline-block; min-width: 460px;
}
.basics-head { margin-bottom: 20px; }
.basics-head h2 { color: #f8fafc; font-size: 18px; font-weight: 700; margin: 0 0 6px; }
.basics-head p { color: #64748b; font-size: 13px; margin: 0; }
.basics-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 16px;
}
.basics-card {
  background: #1f2536; border: 1px solid #2d3348; border-radius: 12px;
  padding: 20px 18px; cursor: pointer;
  display: flex; flex-direction: column; gap: 8px;
  transition: transform .15s, border-color .15s, box-shadow .15s;
}
.basics-card:hover {
  transform: translateY(-3px); border-color: #3b82f6;
  box-shadow: 0 8px 24px rgba(59,130,246,.18);
}
.basics-card-icon { font-size: 24px; line-height: 1; }
.basics-card-label { color: #f8fafc; font-size: 15px; font-weight: 600; }
.basics-card-desc { color: #94a3b8; font-size: 12px; }
.basics-empty { color: #64748b; text-align: center; padding: 60px 20px; }
