/* =====================================================================
   迁移建模训练系统 · 统一样式（移动端优先，桌面自适应）
   ===================================================================== */
:root {
    --bg: #f5f7fb;
    --card: #ffffff;
    --line: #e6eaf2;
    --text: #1f2937;
    --muted: #6b7280;
    --primary: #1d4ed8;
    --primary-dark: #1e40af;
    --primary-soft: #eef3ff;
    --ok: #0f766e;
    --ok-soft: #e6f7f3;
    --bad: #b91c1c;
    --bad-soft: #fdecec;
    --wait: #b45309;
    --wait-soft: #fef3e2;
    --radius: 12px;
    --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 8px 24px rgba(16, 24, 40, .06);
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    font-size: 15px;
    line-height: 1.65;
    -webkit-text-size-adjust: 100%;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }

/* ---------------- 顶部导航 ---------------- */
.topbar {
    position: sticky;
    top: 0;
    z-index: 50;
    background: #fff;
    border-bottom: 1px solid var(--line);
}
.topbar-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 10px 16px;
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
}
.brand a {
    font-weight: 700;
    font-size: 16px;
    color: var(--text);
    letter-spacing: .5px;
}
.brand a:hover { text-decoration: none; color: var(--primary); }

.menu {
    display: flex;
    gap: 4px;
    overflow-x: auto;
    flex: 1 1 auto;
    scrollbar-width: thin;
    -webkit-overflow-scrolling: touch;
}
.menu a {
    flex: 0 0 auto;
    padding: 6px 10px;
    border-radius: 8px;
    color: var(--muted);
    font-size: 14px;
    white-space: nowrap;
}
.menu a:hover { background: var(--primary-soft); color: var(--primary); text-decoration: none; }
.menu a.active { background: var(--primary); color: #fff; }

.userbox {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    color: var(--muted);
    white-space: nowrap;
}
.userbox .logout {
    padding: 4px 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--muted);
}
.userbox .logout:hover { border-color: var(--bad); color: var(--bad); text-decoration: none; }

/* ---------------- 页面容器 ---------------- */
.page {
    max-width: 1200px;
    margin: 0 auto;
    padding: 18px 16px 40px;
}
.page-head { margin-bottom: 14px; }
.page-head h1 {
    margin: 0 0 4px;
    font-size: 20px;
    line-height: 1.35;
    font-weight: 700;
}
.muted { color: var(--muted); }
.small { font-size: 12px; }
.nowrap { white-space: nowrap; }
.mt { margin-top: 14px; }

.foot {
    max-width: 1200px;
    margin: 0 auto;
    padding: 18px 16px 30px;
    color: #9aa3b2;
    font-size: 12px;
    text-align: center;
}

/* ---------------- 卡片 ---------------- */
.card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 16px;
    box-shadow: var(--shadow);
    margin-bottom: 14px;
}
.card-title {
    font-weight: 700;
    font-size: 15px;
    margin-bottom: 10px;
    padding-left: 10px;
    border-left: 3px solid var(--primary);
}
.cards { display: grid; grid-template-columns: 1fr; gap: 14px; }
.grid-2 { display: grid; grid-template-columns: 1fr; gap: 14px; }

/* ---------------- 数据看板 ---------------- */
.dash {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 10px;
    margin-bottom: 14px;
}
.dash-item {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 14px 12px;
    box-shadow: var(--shadow);
    text-align: center;
}
.dash-item .num {
    font-size: 24px;
    font-weight: 700;
    color: var(--primary-dark);
    line-height: 1.2;
}
.dash-item .num.warn { color: var(--wait); }
.dash-item .num.bad { color: var(--bad); }
.dash-item .label { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* ---------------- 快捷入口 ---------------- */
.quick { display: grid; grid-template-columns: 1fr; gap: 8px; }
.quick-item {
    display: block;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 10px;
    color: var(--text);
    background: #fbfcff;
}
.quick-item b { display: block; font-size: 14px; }
.quick-item span { font-size: 12px; color: var(--muted); }
.quick-item:hover { border-color: var(--primary); text-decoration: none; background: var(--primary-soft); }

/* ---------------- 表格 ---------------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.5px;
    min-width: 560px;
}
.table th, .table td {
    padding: 9px 10px;
    border-bottom: 1px solid #f0f2f7;
    text-align: left;
    vertical-align: top;
}
.table th {
    background: #fafbff;
    color: #4b5563;
    font-weight: 600;
    white-space: nowrap;
}
.table tr:hover td { background: #fcfdff; }

/* ---------------- 表单 ---------------- */
label {
    display: block;
    margin: 12px 0 6px;
    font-size: 13px;
    color: #4b5563;
    font-weight: 600;
}
input[type=text], input[type=password], input[type=date], input[type=file], select, textarea {
    width: 100%;
    padding: 9px 11px;
    border: 1px solid #dcdfe8;
    border-radius: 9px;
    background: #fff;
    font-size: 14px;
    font-family: inherit;
    color: var(--text);
    outline: none;
}
input:focus, select:focus, textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(29, 78, 216, .12);
}
textarea { resize: vertical; line-height: 1.6; }
.form-grid { display: grid; grid-template-columns: 1fr; gap: 0 12px; }
.radio-row { display: flex; flex-wrap: wrap; gap: 14px; }
.radio { display: inline-flex; align-items: center; gap: 6px; margin: 4px 0; font-weight: 400; }
.radio input { width: auto; }
.filter {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}
.filter input, .filter select { width: auto; flex: 1 1 160px; min-width: 0; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.inline { display: inline; }

/* ---------------- 按钮 ---------------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 16px;
    border: 1px solid #d7dbe6;
    border-radius: 9px;
    background: #fff;
    color: var(--text);
    font-size: 14px;
    cursor: pointer;
    line-height: 1.4;
}
.btn:hover { border-color: var(--primary); color: var(--primary); text-decoration: none; }
.btn-primary {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}
.btn-primary:hover { background: var(--primary-dark); color: #fff; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-block { width: 100%; margin-top: 16px; }
.btn-sm { padding: 5px 10px; font-size: 12.5px; }
.linkbtn {
    background: none;
    border: 0;
    padding: 0 2px;
    font: inherit;
    font-size: 13px;
    color: var(--primary);
    cursor: pointer;
}
.linkbtn:hover { text-decoration: underline; }
.linkbtn.danger { color: var(--bad); }

/* ---------------- 徽标 / 提示 ---------------- */
.badge {
    display: inline-block;
    padding: 2px 9px;
    border-radius: 999px;
    font-size: 12px;
    line-height: 1.6;
    white-space: nowrap;
    background: #eef1f6;
    color: #4b5563;
}
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.badge.wait { background: var(--wait-soft); color: var(--wait); }
.badge.lv0 { background: #f1f3f7; color: #6b7280; }
.badge.lv1 { background: #eef3ff; color: #1d4ed8; }
.badge.lv2 { background: #e6f7f3; color: #0f766e; }
.badge.lv3 { background: #fff4e0; color: #b45309; }

.alert {
    padding: 10px 12px;
    border-radius: 10px;
    font-size: 13.5px;
    margin-bottom: 12px;
    border: 1px solid transparent;
}
.alert-ok { background: var(--ok-soft); color: #0b5d55; border-color: #c8ece4; }
.alert-err { background: var(--bad-soft); color: #8f1d1d; border-color: #f5cfcf; }
.alert-warn { background: var(--wait-soft); color: #8a4708; border-color: #f7ddb8; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; }
.chip {
    display: inline-block;
    background: #f2f5fb;
    color: #475569;
    border-radius: 999px;
    padding: 2px 10px;
    font-size: 12px;
}

/* ---------------- 题目 / 作答展示 ---------------- */
.question {
    border: 1px dashed #d9dfec;
    border-radius: 10px;
    padding: 12px;
    margin: 10px 0;
    background: #fcfdff;
}
.q-label { font-weight: 700; margin-bottom: 6px; font-size: 14px; }
.q-img { display: block; margin: 8px 0; border-radius: 8px; border: 1px solid var(--line); }
.pre {
    white-space: pre-wrap;
    word-break: break-word;
    overflow-wrap: anywhere;
    font-size: 14px;
    line-height: 1.7;
}
.qa { margin: 10px 0; }
.hint {
    background: #f7f9ff;
    border-left: 3px solid #c7d2fe;
    padding: 8px 10px;
    border-radius: 0 8px 8px 0;
    font-size: 13.5px;
    color: #374151;
    margin: 10px 0;
}
.q-pair { display: grid; grid-template-columns: 1fr; gap: 10px; }
.kv { display: grid; grid-template-columns: 1fr; gap: 6px; margin: 10px 0; font-size: 13.5px; }
.kv .k { color: var(--muted); margin-right: 8px; }

/* ---------------- 进度条 / 图表 ---------------- */
.bar {
    display: inline-block;
    vertical-align: middle;
    width: 86px;
    height: 8px;
    background: #edf0f6;
    border-radius: 999px;
    overflow: hidden;
    margin-right: 6px;
}
.bar span {
    display: block;
    height: 100%;
    background: linear-gradient(90deg, #3b82f6, #1d4ed8);
}
.chart {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    height: 150px;
    padding: 10px 6px;
    border-bottom: 1px solid var(--line);
}
.chart-col { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; height: 100%; text-align: center; }
.chart-bar {
    position: relative;
    background: linear-gradient(180deg, #60a5fa, #1d4ed8);
    border-radius: 6px 6px 0 0;
    min-height: 6px;
}
.chart-bar span {
    position: absolute;
    top: -18px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 11px;
    color: var(--muted);
}
.chart-label { font-size: 11px; color: var(--muted); margin-top: 6px; white-space: nowrap; }

/* ---------------- 模型卡 ---------------- */
.model-card { display: flex; flex-direction: column; }
.model-head { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.model-name { font-size: 16px; font-weight: 700; }
.model-meta { font-size: 12px; color: var(--muted); }
.model-desc { font-size: 13px; color: #4b5563; margin: 6px 0; }
.model-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: auto; padding-top: 8px; }

/* ---------------- 登录页 ---------------- */
.login-body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at 20% 10%, #eaf0ff, #f5f7fb 55%);
    padding: 20px;
}
.login-wrap { width: 100%; max-width: 420px; }
.login-card { padding: 26px 22px; }
.login-title { font-size: 21px; font-weight: 700; color: var(--primary-dark); }
.login-sub { font-size: 13px; color: var(--muted); margin: 4px 0 6px; }
.login-tip { margin-top: 14px; font-size: 12px; color: #9aa3b2; line-height: 1.6; }
.captcha-row { display: flex; gap: 10px; align-items: center; }
.captcha-row input { flex: 1; }
.captcha-row img {
    width: 110px;
    height: 38px;
    border: 1px solid var(--line);
    border-radius: 8px;
    cursor: pointer;
    background: #fff;
}

/* ---------------- 分页 ---------------- */
.pager {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin-top: 14px;
    font-size: 13px;
}
.pager .pg-info { color: var(--muted); margin-right: 6px; }
.pager .pg {
    min-width: 32px;
    text-align: center;
    padding: 4px 8px;
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--text);
    background: #fff;
}
.pager .pg:hover { border-color: var(--primary); color: var(--primary); text-decoration: none; }
.pager .pg.on { background: var(--primary); border-color: var(--primary); color: #fff; }

/* ---------------- 列表提示 ---------------- */
.tips { margin: 0; padding-left: 18px; font-size: 13.5px; color: #4b5563; }
.tips li { margin: 6px 0; }

/* ---------------- 响应式 ---------------- */
@media (min-width: 720px) {
    .cards { grid-template-columns: repeat(2, 1fr); }
    .grid-2 { grid-template-columns: repeat(2, 1fr); }
    .form-grid { grid-template-columns: repeat(2, 1fr); }
    .q-pair { grid-template-columns: repeat(2, 1fr); }
    .quick { grid-template-columns: repeat(2, 1fr); }
    .kv { grid-template-columns: repeat(2, 1fr); }
    .page-head h1 { font-size: 24px; }
}
@media (min-width: 1080px) {
    .cards { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 560px) {
    .userbox .who { display: none; }
    .page { padding: 14px 12px 32px; }
    .card { padding: 13px; }
    .dash-item .num { font-size: 21px; }
}

/* ===== P0：说理评分卡 / 复习排期 / 错因分布 ===== */
.rubric-view { margin-top: 6px; }
.rubric-row {
    border-left: 3px solid #dbeafe;
    padding: 8px 0 8px 12px;
    margin-bottom: 10px;
}
.rubric-row b { display: block; margin-bottom: 2px; }
.rubric-row .small { display: block; margin-bottom: 4px; }
.rubric-score { display: grid; gap: 8px; }
.rubric-score-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
}
.rubric-score-row label { margin: 0; flex: 1 1 140px; }
.rubric-score-row select { width: 110px; }
.radio-col { flex-direction: column; gap: 8px; align-items: flex-start; }
.cause-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}
.cause-label { flex: 1 1 220px; font-size: 13.5px; }
.cause-row .bar { flex: 2 1 200px; }
@media (max-width: 640px) {
    .rubric-score-row select { width: 100%; }
    .cause-row .bar { flex: 1 1 100%; }
}

/* ===== 注册页 / 账号治理（V2） ===== */
.login-card-wide { width: 520px; }
.login-links {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px dashed #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    font-size: 13px;
}
.radio-line {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    margin-bottom: 8px;
    background: #f8fafc;
    font-size: 13px;
    cursor: pointer;
}
.radio-line input { width: auto; margin: 0; }
.radio-line:hover { border-color: #bfdbfe; background: #f0f7ff; }
input[type="date"] { padding: 8px 10px; border: 1px solid #cbd5e1; border-radius: 8px; font-size: 14px; }

/* 可点击的统计卡片（待审核/到期跳转用） */
.dash-item { display: block; text-decoration: none; color: inherit; transition: border-color .15s, box-shadow .15s; }
.dash-item:hover { border-color: #bfdbfe; box-shadow: 0 6px 18px rgba(37,99,235,.12); }

/* ===== 列表页头部 / 新增按钮 / 弹窗（用户管理） ===== */
.page-head-flex {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    flex-wrap: wrap;
}
.page-head-flex .btn { flex: none; }
.list-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin: 6px 0 10px;
}
.list-head .card-title { margin: 0; }

.modal-mask {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, .45);
    display: none;
    z-index: 1000;
    padding: 24px 16px;
    overflow-y: auto;
}
.modal-mask.show { display: flex; align-items: flex-start; justify-content: center; }
.modal {
    background: #fff;
    border-radius: 14px;
    width: 100%;
    max-width: 720px;
    margin: auto;
    padding: 18px 20px 20px;
    box-shadow: 0 24px 60px rgba(15, 23, 42, .25);
    animation: modalIn .18s ease-out;
}
@keyframes modalIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }
.modal-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--line);
}
.modal-title { font-size: 16px; font-weight: 600; color: var(--text); }
.modal-close {
    background: none;
    border: 0;
    font-size: 22px;
    line-height: 1;
    color: var(--muted);
    cursor: pointer;
    padding: 0 4px;
}
.modal-close:hover { color: var(--bad); }
.modal .form-grid { margin-bottom: 4px; }
@media (max-width: 640px) {
    .modal { padding: 14px 14px 16px; }
    .modal-mask { padding: 10px 8px; }
}

/* 注册页 / 弹窗里的分组小标题、数字输入 */
.form-sub-title {
    margin: 16px 0 6px;
    padding-left: 8px;
    border-left: 3px solid var(--primary);
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
}
input[type=number] {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 14px;
    background: #fff;
}
