/* ===== 验收前端 UI 基座：侧边菜单壳 + 组件库（8pt 网格 / 单一品牌色 / 60-30-10） ===== */
:root {
  --brand: #2563eb; --brand-hover: #1d4ed8; --brand-active: #1e40af; --brand-soft: #eff4ff;
  --bg: #f7f8fa; --surface: #ffffff; --border: #e5e7eb; --border-strong: #d1d5db;
  --text: #1a1a1a; --text-secondary: #4b5563; --text-aux: #6b7280;
  --success: #16a34a; --success-soft: #ecfdf3; --warning: #d97706; --warning-soft: #fffaeb;
  --danger: #dc2626; --danger-soft: #fef2f2; --info-soft: #eff6ff;
  --radius: 8px; --shadow-md: 0 4px 12px rgba(16,24,40,.1);
  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  --mono: "SF Mono", Menlo, Consolas, monospace;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: var(--font); font-size: 14px; color: var(--text); background: var(--bg); line-height: 1.6; }
a { color: var(--brand); text-decoration: none; }

/* ===== 壳：左侧菜单 + 右侧内容 ===== */
.shell { display: flex; min-height: 100vh; }
.sidebar { width: 216px; background: var(--surface); border-right: 1px solid var(--border); padding: 24px 16px; position: sticky; top: 0; height: 100vh; flex-shrink: 0; display: flex; flex-direction: column; }
.sidebar .brand-block { padding: 0 8px 24px; }
.sidebar .brand-block .name { font-size: 16px; font-weight: 600; }
.sidebar .brand-block .sub { font-size: 12px; color: var(--text-aux); margin-top: 4px; }
.nav-item { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 6px; color: var(--text-secondary); font-size: 13px; cursor: pointer; transition: background .15s, color .15s; margin-bottom: 4px; }
.nav-item:hover { background: var(--bg); color: var(--text); }
.nav-item.active { background: var(--brand-soft); color: var(--brand); font-weight: 500; }
.nav-item .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .5; }
.sidebar .user-block { margin-top: auto; padding: 12px 8px; border-top: 1px solid var(--border); font-size: 12px; color: var(--text-aux); }
.sidebar .user-block .logout { color: var(--text-secondary); cursor: pointer; margin-top: 4px; display: inline-block; }
.sidebar .user-block .logout:hover { color: var(--danger); }
.main { flex: 1; padding: 32px 40px; max-width: calc(100% - 216px); }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 24px; }
.page-head h1 { font-size: 20px; font-weight: 600; }
.page-head .sub { font-size: 13px; color: var(--text-aux); margin-top: 4px; }

/* ===== 卡片 / 表格 ===== */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; margin-bottom: 24px; }
.card-title { font-size: 15px; font-weight: 600; margin-bottom: 16px; }
.table-wrap { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
table.data { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data th { text-align: left; padding: 10px 16px; background: var(--bg); color: var(--text-aux); font-weight: 500; border-bottom: 1px solid var(--border); }
table.data td { padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: top; }
table.data tbody tr { transition: background .12s; }
table.data tbody tr:hover { background: var(--bg); }
table.data tbody tr:last-child td { border-bottom: none; }
.mono { font-family: var(--mono); font-size: 12px; }

/* ===== 按钮体系：hover / active 按下特效 / loading ===== */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 16px; border-radius: 6px; font-size: 13px; font-weight: 500; cursor: pointer; border: 1px solid transparent; transition: background .15s, transform .08s, box-shadow .15s; user-select: none; }
.btn:active { transform: scale(.96); }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--brand-hover); box-shadow: 0 2px 6px rgba(37,99,235,.3); }
.btn-primary:active:not(:disabled) { background: var(--brand-active); }
.btn-outline { background: var(--surface); border-color: var(--border-strong); color: var(--text); }
.btn-outline:hover:not(:disabled) { border-color: var(--brand); color: var(--brand); }
.btn-ghost { background: transparent; color: var(--text-secondary); }
.btn-ghost:hover:not(:disabled) { background: var(--bg); color: var(--text); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover:not(:disabled) { background: #b91c1c; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn .spinner { width: 12px; height: 12px; border: 2px solid rgba(255,255,255,.4); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; }
.btn-outline .spinner, .btn-ghost .spinner { border-color: var(--border-strong); border-top-color: var(--brand); }
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== 表单 ===== */
.form-item { margin-bottom: 16px; }
.form-label { display: block; font-size: 13px; color: var(--text-secondary); margin-bottom: 6px; }
.form-label .req { color: var(--danger); margin-left: 2px; }
.input, .select { width: 100%; padding: 8px 12px; border: 1px solid var(--border-strong); border-radius: 6px; font-size: 13px; font-family: var(--font); transition: border-color .15s, box-shadow .15s; }
.input:focus, .select:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.form-error { display: none; font-size: 12px; color: var(--danger); margin-top: 4px; }
.form-error.show { display: block; }

/* ===== 搜索 + 分页条 ===== */
.toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; gap: 16px; }
.search-box { position: relative; width: 280px; }
.search-box .input { padding-left: 32px; }
.search-box::before { content: ""; position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 14px; height: 14px; opacity: .5; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m21 21-4.35-4.35'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-size: contain; }
.pager { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; background: var(--surface); border-top: 1px solid var(--border); font-size: 12px; color: var(--text-aux); }
.pager .pages { display: flex; gap: 4px; align-items: center; }
.pager .page-btn { min-width: 28px; height: 28px; padding: 0 8px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); color: var(--text-secondary); cursor: pointer; font-size: 12px; transition: all .12s; }
.pager .page-btn:hover:not(:disabled) { border-color: var(--brand); color: var(--brand); }
.pager .page-btn.cur { background: var(--brand); border-color: var(--brand); color: #fff; cursor: default; }
.pager .page-btn:disabled { opacity: .4; cursor: not-allowed; }
.pager .jump { display: flex; align-items: center; gap: 6px; }
.pager .jump input { width: 48px; padding: 4px 8px; border: 1px solid var(--border-strong); border-radius: 6px; font-size: 12px; text-align: center; }

/* ===== 空状态 / 加载 / 徽章 ===== */
.empty { padding: 48px 24px; text-align: center; color: var(--text-aux); }
.empty .icon { font-size: 32px; margin-bottom: 8px; opacity: .4; }
.badge { display: inline-block; padding: 2px 10px; border-radius: 99px; font-size: 12px; white-space: nowrap; }
.badge.blue { background: var(--info-soft); color: var(--brand); }
.badge.green { background: var(--success-soft); color: var(--success); }
.badge.yellow { background: var(--warning-soft); color: var(--warning); }
.badge.red { background: var(--danger-soft); color: var(--danger); }
.badge.gray { background: var(--bg); color: var(--text-aux); }
.tag { display: inline-block; padding: 2px 8px; border: 1px solid var(--border); border-radius: 4px; font-size: 12px; color: var(--text-secondary); margin: 2px 4px 2px 0; background: var(--surface); }

/* ===== Modal ===== */
.mask { display: none; position: fixed; inset: 0; background: rgba(26,26,26,.45); z-index: 100; align-items: center; justify-content: center; padding: 24px; }
.mask.open { display: flex; animation: fadeIn .15s; }
@keyframes fadeIn { from { opacity: 0; } }
.modal { background: var(--surface); border-radius: 12px; box-shadow: var(--shadow-md); width: 620px; max-width: 100%; max-height: 86vh; display: flex; flex-direction: column; animation: popIn .18s; }
@keyframes popIn { from { transform: scale(.96) translateY(8px); opacity: 0; } }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 24px; border-bottom: 1px solid var(--border); }
.modal-head .title { font-size: 15px; font-weight: 600; }
.modal-close { border: none; background: none; font-size: 20px; color: var(--text-aux); cursor: pointer; width: 32px; height: 32px; border-radius: 6px; transition: all .12s; }
.modal-close:hover { background: var(--bg); color: var(--text); }
.modal-body { padding: 24px; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 16px 24px; border-top: 1px solid var(--border); }

/* ===== Toast ===== */
#toast-wrap { position: fixed; top: 24px; right: 24px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast { padding: 10px 16px; border-radius: 8px; background: var(--text); color: #fff; font-size: 13px; box-shadow: var(--shadow-md); animation: toastIn .2s; max-width: 360px; }
.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }
.toast.info { background: var(--brand); }
@keyframes toastIn { from { transform: translateX(24px); opacity: 0; } }

/* ===== 错误条（页面级，仅非表单场景） ===== */
.errbar { display: none; background: var(--danger-soft); color: var(--danger); padding: 10px 16px; border-radius: 6px; margin-bottom: 16px; font-size: 13px; }
.errbar.show { display: block; }

/* ===== 步骤条（考试页） ===== */
.steps { display: flex; gap: 0; margin-bottom: 24px; }
.step-item { flex: 1; text-align: center; font-size: 12px; color: var(--text-aux); position: relative; padding-top: 20px; }
.step-item::before { content: ""; position: absolute; top: 6px; left: 50%; transform: translateX(-50%); width: 10px; height: 10px; border-radius: 50%; background: var(--border-strong); }
.step-item::after { content: ""; position: absolute; top: 10px; left: calc(50% + 10px); right: calc(-50% + 10px); height: 2px; background: var(--border-strong); }
.step-item:last-child::after { display: none; }
.step-item.done { color: var(--success); }
.step-item.done::before { background: var(--success); }
.step-item.done::after { background: var(--success); }
.step-item.cur { color: var(--brand); font-weight: 500; }
.step-item.cur::before { background: var(--brand); box-shadow: 0 0 0 4px var(--brand-soft); }
