/* =========================================================
   设计令牌（浅色 = 默认）
========================================================= */
:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-soft: #eef2ff;
    --accent:  #8b5cf6;
    --success: #10b981;
    --warning: #f59e0b;
    --danger:  #ef4444;
    --info:    #06b6d4;

    --bg:        #f5f7fb;
    --surface:   #ffffff;
    --surface-2: #fafbff;
    --border:    #e6e8ef;
    --border-2:  #eef0f5;
    --text:      #1f2937;
    --muted:     #6b7280;
    --muted-2:   #9ca3af;

    --code-color: #be185d;
    --code-bg:    #fdf2f8;

    --hero-grad:  linear-gradient(120deg, #6366f1 0%, #8b5cf6 40%, #d946ef 100%);
    --nav-grad:   linear-gradient(135deg, #6366f1 0%, #8b5cf6 60%, #a855f7 100%);
    --body-glow-1: radial-gradient(at 0% 0%, rgba(99,102,241,.06) 0, transparent 40%);
    --body-glow-2: radial-gradient(at 100% 0%, rgba(139,92,246,.05) 0, transparent 35%);

    --shadow-xs: 0 1px 2px rgba(16,24,40,.05);
    --shadow-sm: 0 1px 3px rgba(16,24,40,.05), 0 1px 2px rgba(16,24,40,.04);
    --shadow-md: 0 4px 12px rgba(16,24,40,.07), 0 2px 4px rgba(16,24,40,.05);
    --shadow-lg: 0 14px 32px -8px rgba(16,24,40,.12), 0 8px 16px -8px rgba(16,24,40,.08);

    --radius-sm: 8px;
    --radius:    12px;
    --radius-lg: 16px;
}

/* =========================================================
   暗色主题 token
========================================================= */
[data-bs-theme="dark"] {
    color-scheme: dark;

    --primary: #818cf8;
    --primary-dark: #6366f1;
    --primary-soft: rgba(129,140,248,.15);
    --accent:  #a78bfa;
    --success: #34d399;
    --warning: #fbbf24;
    --danger:  #f87171;
    --info:    #22d3ee;

    --bg:        #0f1117;
    --surface:   #1a1d29;
    --surface-2: #232636;
    --border:    #2a2e3f;
    --border-2:  #232636;
    --text:      #e5e7eb;
    --muted:     #9ca3af;
    --muted-2:   #6b7280;

    --code-color: #f9a8d4;
    --code-bg:    rgba(244,114,182,.12);

    --hero-grad:  linear-gradient(120deg, #4338ca 0%, #6d28d9 40%, #a21caf 100%);
    --nav-grad:   linear-gradient(135deg, #312e81 0%, #5b21b6 60%, #6b21a8 100%);
    --body-glow-1: radial-gradient(at 0% 0%, rgba(129,140,248,.10) 0, transparent 45%);
    --body-glow-2: radial-gradient(at 100% 0%, rgba(167,139,250,.08) 0, transparent 40%);

    --shadow-xs: 0 1px 2px rgba(0,0,0,.4);
    --shadow-sm: 0 1px 3px rgba(0,0,0,.4), 0 1px 2px rgba(0,0,0,.3);
    --shadow-md: 0 4px 12px rgba(0,0,0,.45), 0 2px 4px rgba(0,0,0,.3);
    --shadow-lg: 0 14px 32px -8px rgba(0,0,0,.55), 0 8px 16px -8px rgba(0,0,0,.4);
}

/* =========================================================
   基础
========================================================= */
html, body { height: 100%; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
        "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", sans-serif;
    background-color: var(--bg);
    background-image: var(--body-glow-1), var(--body-glow-2);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
    letter-spacing: .01em;
    transition: background-color .2s ease, color .2s ease;
}
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); text-decoration: underline; }
hr { color: var(--border); opacity: 1; }
code { color: var(--code-color); background: var(--code-bg); padding: 0 .3em; border-radius: 4px; font-size: .85em; }

/* =========================================================
   导航栏
========================================================= */
.navbar.bg-primary {
    background: var(--nav-grad) !important;
    box-shadow: 0 4px 18px rgba(99,102,241,.18);
    padding: .65rem 1rem;
    border: none;
}
/* 导航栏整体抬到 sticky-top(1020)/back-to-top(1030) 等页面元素之上，
   避免打开右上角下拉菜单时被页面内的吸顶/悬浮内容遮挡；仍低于模态框(1050+)。 */
.navbar {
    position: relative;
    z-index: 1035;
}
.navbar-brand {
    font-weight: 600;
    letter-spacing: .3px;
    font-size: 1.08rem;
}
.navbar-brand i { margin-right: .35rem; }
.navbar .nav-link {
    color: rgba(255, 255, 255, .95) !important;
    font-weight: 500;
    transition: background-color .15s, color .15s;
    border-radius: 6px;
    padding: .4rem .75rem !important;
    margin: 0 .15rem;
    text-shadow: 0 1px 2px rgba(0, 0, 0, .12);
}
.navbar .nav-link i { opacity: .95; margin-right: .2rem; }
.navbar .nav-link:hover {
    color: #fff !important;
    background: rgba(255, 255, 255, .18);
}
.navbar .nav-link.active {
    color: #fff !important;
    background: rgba(255, 255, 255, .24);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .15);
}
.navbar .dropdown-toggle::after { opacity: .8; }
.navbar-brand { color: #fff !important; text-shadow: 0 1px 2px rgba(0,0,0,.15); }
.navbar .dropdown-menu {
    border: none;
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    padding: .35rem;
    margin-top: .5rem;
    background: var(--surface);
}
.navbar .dropdown-item { border-radius: 6px; padding: .5rem .75rem; font-size: .9rem; color: var(--text); }
.navbar .dropdown-item:hover { background: var(--primary-soft); color: var(--primary-dark); }
.navbar .badge {
    font-weight: 600;
    background: rgba(255,255,255,.95) !important;
    color: #5b21b6 !important;
}

/* =========================================================
   卡片
========================================================= */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-xs);
    transition: box-shadow .2s, transform .15s, border-color .2s;
}
.card-header {
    background: transparent;
    border-bottom: 1px solid var(--border-2);
    font-weight: 600;
    padding: .85rem 1.1rem;
    color: var(--text);
}
.card-body { padding: 1.1rem; }
.card-footer { background: transparent !important; border-top: 1px solid var(--border-2); }
.bg-white, .card-footer.bg-white { background: var(--surface) !important; }

/* 项目卡片 hover */
.card.project-card:hover,
.row .col-md-4 > .card.h-100:hover,
.row .col-md-6 > .card.h-100:hover {
    border-color: rgba(99,102,241,.4);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

/* 统计卡片 */
.stat-card { position: relative; overflow: hidden; border-radius: var(--radius); }
.stat-card .stat-label { color: var(--muted); font-size: .82rem; font-weight: 500; }
.stat-card .stat-value {
    font-size: 1.85rem; font-weight: 700; line-height: 1.15; margin-top: .25rem;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.stat-card .stat-icon {
    position: absolute; right: -.5rem; bottom: -.6rem;
    font-size: 4rem; line-height: 1; opacity: .08; color: var(--primary);
}

/* 仪表盘：当前学期 banner */
.sem-banner {
    background: linear-gradient(135deg,
        rgba(99,102,241,.08) 0%,
        rgba(139,92,246,.08) 50%,
        rgba(236,72,153,.06) 100%);
    border: 1px solid rgba(99,102,241,.22);
}
.sem-banner-title {
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.sem-chip {
    display: inline-flex; align-items: center; gap: .3rem;
    padding: .35rem .7rem; border-radius: 999px;
    background: var(--surface); border: 1px solid var(--border-2);
    font-size: .85rem; color: var(--text);
}
.sem-chip .bi { color: var(--primary); }
.sem-progress { background: rgba(99,102,241,.15); border-radius: 999px; overflow: hidden; }
.sem-progress .progress-bar {
    background: linear-gradient(90deg, var(--primary), var(--accent));
}

/* 仪表盘：课程纵览迷你卡片 */
.course-mini {
    padding: .65rem .8rem;
    border: 1px solid var(--border-2);
    border-radius: var(--radius-sm);
    background: var(--surface);
    height: 100%;
}
.course-mini:hover {
    border-color: rgba(99,102,241,.4);
    box-shadow: var(--shadow-sm);
}

/* 长文本截断保险 */
.min-w-0 { min-width: 0; }

/* =========================================================
   按钮
========================================================= */
.btn {
    font-weight: 500;
    border-radius: var(--radius-sm);
    padding: .45rem .9rem;
    transition: all .15s ease;
}
.btn:focus { box-shadow: 0 0 0 3px rgba(99,102,241,.18); }
.btn-sm { padding: .25rem .6rem; font-size: .82rem; border-radius: 6px; }

.btn-primary {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}
.btn-primary:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
    box-shadow: 0 6px 16px rgba(99,102,241,.28);
    transform: translateY(-1px);
}
.btn-outline-primary {
    color: var(--primary); border-color: var(--primary);
}
.btn-outline-primary:hover {
    background: var(--primary); border-color: var(--primary); color: #fff;
}

.btn-success { background: var(--success); border-color: var(--success); }
.btn-success:hover { background: #059669; border-color: #059669; }
.btn-outline-success { color: var(--success); border-color: var(--success); }
.btn-outline-success:hover { background: var(--success); border-color: var(--success); }

.btn-warning { background: var(--warning); border-color: var(--warning); color: #fff; }
.btn-warning:hover { background: #d97706; border-color: #d97706; color: #fff; }
.btn-outline-warning { color: #b45309; border-color: var(--warning); }

.btn-danger { background: var(--danger); border-color: var(--danger); }
.btn-outline-danger { color: var(--danger); border-color: var(--danger); }
.btn-outline-danger:hover { background: var(--danger); border-color: var(--danger); }

.btn-link { color: var(--muted); }
.btn-link:hover { color: var(--primary); }

.btn-outline-secondary {
    color: var(--muted); border-color: var(--border);
}
.btn-outline-secondary:hover {
    background: var(--bg); border-color: var(--muted-2); color: var(--text);
}

.btn-group .btn { border-radius: var(--radius-sm); }
.btn-group .btn + .btn { margin-left: .35rem; }
.btn-group > .btn:not(:last-child) { border-top-right-radius: var(--radius-sm); border-bottom-right-radius: var(--radius-sm); }
.btn-group > .btn:not(:first-child) { border-top-left-radius: var(--radius-sm); border-bottom-left-radius: var(--radius-sm); }

/* =========================================================
   表单
========================================================= */
.form-label { font-weight: 500; color: var(--text); font-size: .9rem; margin-bottom: .35rem; }
.form-control, .form-select {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: .5rem .75rem;
    background: var(--surface);
    color: var(--text);
    transition: border-color .15s, box-shadow .15s;
}
.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99,102,241,.15);
}
.form-control.is-invalid, .form-select.is-invalid {
    border-color: var(--danger);
    background-image: none;
    padding-right: .75rem;
}
.form-control.is-invalid:focus, .form-select.is-invalid:focus {
    box-shadow: 0 0 0 3px rgba(239,68,68,.18);
}
.invalid-feedback { color: var(--danger); font-size: .82rem; }
[data-bs-theme="dark"] .invalid-feedback { color: #fca5a5; }
.form-text { color: var(--muted); }
.form-control::placeholder { color: var(--muted-2); }
.form-check-input:checked { background-color: var(--primary); border-color: var(--primary); }
.form-check-input:focus { box-shadow: 0 0 0 3px rgba(99,102,241,.15); }

/* =========================================================
   表格
========================================================= */
.table { vertical-align: middle; color: var(--text); }
.table > :not(caption) > * > * { padding: .75rem 1rem; }
.table thead { background: var(--bg); }
.table thead th {
    font-weight: 600;
    color: var(--muted);
    font-size: .82rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    border-bottom: 1px solid var(--border);
}
.table tbody tr { transition: background-color .1s; }
.table-hover tbody tr:hover { background: var(--primary-soft) !important; }
.table-hover tbody tr:hover code { background: #fff; }

/* =========================================================
   徽章
========================================================= */
.badge {
    font-weight: 500;
    border-radius: 6px;
    padding: .35em .6em;
    letter-spacing: .02em;
}
.status-badge {
    font-size: .72rem;
    padding: .35em .75em;
    border-radius: 999px;
    font-weight: 600;
}

.status-draft     { background:#f1f3f9; color:#475569; }
.status-open      { background:#d1fae5; color:#047857; }
.status-locked    { background:#fef3c7; color:#92400e; }
.status-running   { background:#dbeafe; color:#1e40af; }
.status-finished  { background:#e5e7eb; color:#374151; }
.status-forming   { background:#f1f3f9; color:#475569; }
.status-selecting { background:#fef3c7; color:#92400e; }
.status-approved  { background:#d1fae5; color:#047857; }
.status-submitted { background:#cffafe; color:#0e7490; }
.status-graded    { background:#ede9fe; color:#6d28d9; }

[data-bs-theme="dark"] .status-draft     { background: rgba(148,163,184,.18); color:#cbd5e1; }
[data-bs-theme="dark"] .status-open      { background: rgba(52,211,153,.18); color:#6ee7b7; }
[data-bs-theme="dark"] .status-locked    { background: rgba(251,191,36,.18); color:#fcd34d; }
[data-bs-theme="dark"] .status-running   { background: rgba(129,140,248,.20); color:#a5b4fc; }
[data-bs-theme="dark"] .status-finished  { background: rgba(148,163,184,.15); color:#9ca3af; }
[data-bs-theme="dark"] .status-forming   { background: rgba(148,163,184,.18); color:#cbd5e1; }
[data-bs-theme="dark"] .status-selecting { background: rgba(251,191,36,.18); color:#fcd34d; }
[data-bs-theme="dark"] .status-approved  { background: rgba(52,211,153,.18); color:#6ee7b7; }
[data-bs-theme="dark"] .status-submitted { background: rgba(34,211,238,.18); color:#67e8f9; }
[data-bs-theme="dark"] .status-graded    { background: rgba(167,139,250,.22); color:#c4b5fd; }

/* =========================================================
   工作流步骤
========================================================= */
.workflow-step {
    flex: 1;
    min-width: 110px;
    text-align: center;
    padding: .85rem .5rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    position: relative;
    transition: all .15s;
    box-shadow: var(--shadow-xs);
    color: var(--muted);
    font-weight: 500;
}
.workflow-step::after {
    content: "→";
    position: absolute;
    right: -1.05rem; top: 50%; transform: translateY(-50%);
    color: var(--border);
    font-size: 1rem;
    z-index: 1;
}
.workflow-step:last-child::after { display: none; }
.workflow-step.active {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: #fff;
    border-color: transparent;
    box-shadow: 0 6px 16px rgba(99,102,241,.28);
    transform: scale(1.03);
}
.workflow-step.done {
    background: #d1fae5;
    color: #065f46;
    border-color: transparent;
}
[data-bs-theme="dark"] .workflow-step.done {
    background: rgba(52,211,153,.18);
    color: #6ee7b7;
}
.workflow-step.done::after,
.workflow-step.active::after { color: var(--primary); }

/* =========================================================
   时间线
========================================================= */
.timeline { position: relative; padding-left: 1.5rem; }
.timeline::before {
    content: ""; position: absolute; left: .45rem; top: .3rem; bottom: 0;
    width: 2px; background: var(--border);
}
.timeline-item { position: relative; padding-bottom: 1rem; }
.timeline-item::before {
    content: ""; position: absolute; left: -1.2rem; top: .35rem;
    width: .75rem; height: .75rem; border-radius: 50%;
    background: var(--primary);
    box-shadow: 0 0 0 3px rgba(99,102,241,.18);
}
/* 系统自动记录：节点改用灰色 + 内容降低对比，区别于学生 / 教师手填记录 */
.timeline-item.timeline-system::before {
    background: var(--muted);
    box-shadow: 0 0 0 3px rgba(108,117,125,.14);
}
.timeline-item.timeline-system > div:last-child { color: var(--muted); font-size: .9rem; }

/* 回到顶部浮动按钮 */
.back-to-top {
    position: fixed; right: 1rem; bottom: 1rem; z-index: 1030;
    width: 2.6rem; height: 2.6rem; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    border: 1px solid var(--border-2); background: var(--surface); color: var(--text);
    box-shadow: var(--shadow-md); cursor: pointer; font-size: 1.1rem;
    opacity: 0; visibility: hidden; transform: translateY(8px);
    transition: opacity .2s ease, visibility .2s ease, transform .2s ease;
}
.back-to-top.show { opacity: .92; visibility: visible; transform: none; }
.back-to-top:hover { opacity: 1; border-color: var(--primary); color: var(--primary); }
@media print { .back-to-top { display: none !important; } }

/* =========================================================
   空状态
========================================================= */
.empty {
    color: var(--muted);
    text-align: center;
    padding: 2.2rem 1rem;
    background: var(--bg);
    border-radius: var(--radius);
    border: 1px dashed var(--border);
    font-size: .92rem;
}
.empty .bi { color: var(--muted-2); }

/* =========================================================
   提示框
========================================================= */
.alert {
    border-radius: var(--radius);
    border: none;
    padding: .85rem 1.1rem;
    box-shadow: var(--shadow-xs);
}
.alert-success { background: #ecfdf5; color: #065f46; }
.alert-danger  { background: #fef2f2; color: #991b1b; }
.alert-warning { background: #fffbeb; color: #92400e; }
.alert-info    { background: #ecfeff; color: #155e63; }
.alert-primary { background: var(--primary-soft); color: #3730a3; }

[data-bs-theme="dark"] .alert-success { background: rgba(52,211,153,.12); color: #6ee7b7; }
[data-bs-theme="dark"] .alert-danger  { background: rgba(248,113,113,.12); color: #fca5a5; }
[data-bs-theme="dark"] .alert-warning { background: rgba(251,191,36,.12); color: #fcd34d; }
[data-bs-theme="dark"] .alert-info    { background: rgba(34,211,238,.12); color: #67e8f9; }
[data-bs-theme="dark"] .alert-primary { background: var(--primary-soft); color: #c7d2fe; }

/* =========================================================
   列表组
========================================================= */
.list-group-item {
    border-color: var(--border-2);
    padding: .85rem 1.1rem;
    color: var(--text);
}
.list-group-item-action:hover { background: var(--primary-soft); }

/* =========================================================
   登录页
========================================================= */
.auth-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    background: var(--hero-grad);
    background-attachment: fixed;
    position: relative;
}
.auth-wrapper::before {
    content: ""; position: absolute; inset: 0;
    background:
        radial-gradient(circle at 15% 25%, rgba(255,255,255,.25) 0, transparent 25%),
        radial-gradient(circle at 85% 75%, rgba(255,255,255,.18) 0, transparent 25%);
    pointer-events: none;
}
.auth-card {
    width: 100%; max-width: 420px;
    background: var(--surface);
    color: var(--text);
    border-radius: var(--radius-lg);
    padding: 2.5rem 2.25rem;
    box-shadow: 0 25px 60px -15px rgba(0,0,0,.25), 0 12px 25px -10px rgba(0,0,0,.15);
    position: relative;
    backdrop-filter: blur(8px);
}
.auth-brand {
    text-align: center;
    margin-bottom: 1.5rem;
}
.auth-brand .logo {
    width: 56px; height: 56px;
    border-radius: 16px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    display: inline-flex; align-items: center; justify-content: center;
    color: #fff; font-size: 1.6rem;
    box-shadow: 0 8px 18px rgba(99,102,241,.35);
    margin-bottom: .8rem;
}
.auth-brand h4 { margin: 0; font-weight: 600; color: var(--text); }
.auth-brand p  { color: var(--muted); font-size: .88rem; margin-top: .25rem; margin-bottom: 0; }

/* =========================================================
   术语解释气泡
========================================================= */
.term-help {
    color: var(--muted-2);
    text-decoration: none;
    font-size: .85em;
    margin-left: .3rem;
    cursor: help;
    vertical-align: middle;
    transition: color .15s;
}
.term-help:hover, .term-help:focus { color: var(--primary); }
.popover {
    max-width: 320px;
    border: none;
    box-shadow: var(--shadow-lg);
    border-radius: var(--radius);
}
.popover-header {
    font-weight: 600; font-size: .9rem;
    background: var(--primary-soft); color: var(--primary-dark);
    border-bottom: none;
    border-radius: var(--radius) var(--radius) 0 0;
    padding: .6rem .9rem;
}
.popover-body { font-size: .85rem; line-height: 1.65; color: var(--text); padding: .8rem .9rem; }

/* =========================================================
   甘特图
========================================================= */
.gantt-container { overflow-x: auto; background: var(--surface); border-radius: var(--radius); padding: .75rem; }
[data-bs-theme="dark"] .gantt .grid-header,
[data-bs-theme="dark"] .gantt .grid-row > rect { fill: var(--surface); }
[data-bs-theme="dark"] .gantt .grid-row:nth-child(even) > rect { fill: var(--surface-2); }
[data-bs-theme="dark"] .gantt .row-line { stroke: var(--border); }
[data-bs-theme="dark"] .gantt .grid .tick { stroke: var(--border); }
[data-bs-theme="dark"] .gantt .lower-text,
[data-bs-theme="dark"] .gantt .upper-text { fill: var(--muted); }
[data-bs-theme="dark"] .gantt .bar-label { fill: #fff; }
[data-bs-theme="dark"] .gantt .today-highlight { fill: rgba(251,191,36,.18); }
.gantt-target    { min-width: 800px; }
.gantt .grid-row:nth-child(even) > rect { fill: var(--bg); }
.gantt .bar-pending   .bar          { fill: #94a3b8; }
.gantt .bar-pending   .bar-progress { fill: #cbd5e1; }
.gantt .bar-overdue   .bar          { fill: #ef4444; }
.gantt .bar-overdue   .bar-progress { fill: #fca5a5; }
.gantt .bar-submitted .bar          { fill: #06b6d4; }
.gantt .bar-submitted .bar-progress { fill: #67e8f9; }
.gantt .bar-graded    .bar          { fill: #10b981; }
.gantt .bar-graded    .bar-progress { fill: #6ee7b7; }

.gantt-legend span { display: inline-flex; align-items: center; margin-right: 1rem; font-size: .85rem; color: var(--muted); }
.gantt-legend i {
    width: 12px; height: 12px; display: inline-block;
    margin-right: .4rem; border-radius: 3px;
}
.lg-pending   { background: #94a3b8; }
.lg-overdue   { background: #ef4444; }
.lg-submitted { background: #06b6d4; }
.lg-graded    { background: #10b981; }

/* 迷你甘特图（组织结构页内嵌） */
.mini-gantt { font-size: .7rem; }
.mini-gantt .mg-track {
    position: relative;
    height: 20px;
    background: var(--surface-2, #f1f5f9);
    border-radius: 4px;
    overflow: hidden;
    border: 1px solid var(--border);
}
[data-bs-theme="dark"] .mini-gantt .mg-track { background: rgba(255,255,255,.04); }

.mini-gantt .mg-bar {
    position: absolute;
    top: 2px; bottom: 2px;
    border-radius: 3px;
    overflow: hidden;
    cursor: help;
    transition: opacity .15s, transform .15s;
}
.mini-gantt .mg-bar:hover {
    opacity: .9;
    transform: translateY(-1px);
    z-index: 2;
}
.mini-gantt .mg-bar.bar-pending   { background: #94a3b8; }
.mini-gantt .mg-bar.bar-overdue   { background: #ef4444; }
.mini-gantt .mg-bar.bar-submitted { background: #06b6d4; }
.mini-gantt .mg-bar.bar-graded    { background: #10b981; }

.mini-gantt .mg-label {
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
    padding: 0 4px;
    line-height: 16px;
    font-weight: 500;
    font-size: .65rem;
    text-shadow: 0 1px 1px rgba(0,0,0,.2);
}

/* =========================================================
   排版工具
========================================================= */
h4, .h4 { font-weight: 600; }
h5, .h5 { font-weight: 600; }
h6, .h6 { font-weight: 600; }
.text-muted { color: var(--muted) !important; }

/* =========================================================
   滚动条（webkit）
========================================================= */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 99px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: var(--muted-2); }

/* =========================================================
   页脚
========================================================= */
footer { color: var(--muted) !important; }
footer hr { display: none; }

/* =========================================================
   Bootstrap 工具类暗色覆写
========================================================= */
[data-bs-theme="dark"] .bg-light { background: var(--surface-2) !important; color: var(--text); }
[data-bs-theme="dark"] .bg-body-tertiary { background: var(--bg) !important; }
[data-bs-theme="dark"] .text-dark { color: var(--text) !important; }
[data-bs-theme="dark"] .badge.bg-light.text-dark { background: var(--surface-2) !important; color: var(--text) !important; border: 1px solid var(--border); }
[data-bs-theme="dark"] .border { border-color: var(--border) !important; }
[data-bs-theme="dark"] pre { color: var(--text); }
[data-bs-theme="dark"] pre.bg-light { background: var(--surface-2) !important; }
[data-bs-theme="dark"] .navbar .badge.bg-light { background: rgba(255,255,255,.18) !important; color: #fff !important; }
[data-bs-theme="dark"] .bg-warning.bg-opacity-25 { background: rgba(251,191,36,.18) !important; }
[data-bs-theme="dark"] .border-warning { border-color: rgba(251,191,36,.4) !important; }
[data-bs-theme="dark"] details > summary { color: var(--text); }
[data-bs-theme="dark"] .form-check-input { background-color: var(--surface-2); border-color: var(--border); }

/* 主题切换按钮 */
.theme-toggle {
    background: rgba(255,255,255,.12);
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: .35rem .55rem;
    margin-right: .35rem;
    transition: background-color .15s;
    cursor: pointer;
}
.theme-toggle:hover { background: rgba(255,255,255,.22); }
.theme-toggle .bi { font-size: 1rem; }

/* 字号缩放 */
.font-zoom {
    margin-right: .5rem;
    gap: .15rem;
}
.zoom-btn {
    background: rgba(255,255,255,.12);
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: .25rem .45rem;
    transition: background-color .15s;
    cursor: pointer;
    line-height: 1;
}
.zoom-btn:hover { background: rgba(255,255,255,.22); }
.zoom-btn .bi { font-size: .9rem; }
.zoom-level {
    color: rgba(255,255,255,.85);
    font-size: .8rem;
    font-variant-numeric: tabular-nums;
    padding: 0 .25rem;
    min-width: 3.2em;
    text-align: center;
    user-select: none;
}
.zoom-level:hover { color: #fff; text-decoration: underline; }

/* 小屏：字号控件不显示百分比，按钮缩小 */
@media (max-width: 576px) {
    .zoom-level { display: none; }
    .zoom-btn { padding: .2rem .35rem; }
}

/* 分工组件 */
.assignments-card .preset-role { font-size: .78rem; padding: .15rem .55rem; margin-right: .25rem; }
.assignments-card .role-input { font-size: .9rem; }
.assignments-card .role-input.target-input {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99,102,241,.15);
}

/* 评分标准卡片 */
.rubric-card .card-header { background: var(--primary-soft); color: var(--primary-dark); }
.rubric-card .rubric-table td, .rubric-card .rubric-table th { padding: .5rem .7rem; }
.rubric-card .rubric-table thead { background: var(--bg); }
[data-bs-theme="dark"] .rubric-card .card-header { color: #c7d2fe; }

/* 成绩构成说明卡片 */
.grade-composition-card .card-header {
    background: var(--primary-soft);
    color: var(--primary-dark);
}
.grade-composition-card .comp-box {
    min-width: 130px;
    max-width: 220px;
}
.grade-composition-card .comp-arrow {
    font-weight: 700;
    color: var(--text-muted);
}
.grade-composition-card code {
    background: var(--bg);
    padding: .1rem .3rem;
    border-radius: 3px;
    color: var(--primary-dark);
}
[data-bs-theme="dark"] .grade-composition-card .card-header { color: #c7d2fe; }
[data-bs-theme="dark"] .grade-composition-card .comp-box.bg-light {
    background: var(--surface-2) !important;
    color: var(--text);
}
[data-bs-theme="dark"] .grade-composition-card code {
    color: #a5b4fc;
    background: var(--surface-2);
}

/* 小屏：流程图竖排 */
@media (max-width: 768px) {
    .grade-composition-card .composition-flow {
        flex-direction: column;
    }
    .grade-composition-card .comp-arrow {
        transform: rotate(90deg);
    }
    .grade-composition-card .comp-box {
        max-width: 100%;
        width: 100%;
    }
}

/* =========================================================
   响应式：手机 / 小屏
========================================================= */
@media (max-width: 768px) {
    .workflow-step::after { display: none; }
    .stat-card .stat-icon { font-size: 3rem; }

    /* 导航：紧凑 */
    .navbar-brand { font-size: 1rem; }
    .navbar .navbar-nav .nav-link { padding: .35rem .6rem; font-size: .9rem; }
    .navbar form[role="search"] { width: 100%; margin: .35rem 0; }
    .navbar form[role="search"] input { width: 100% !important; }

    /* 卡片 + 按钮 间距压缩 */
    .card-body { padding: .9rem; }
    .btn { padding: .35rem .65rem; font-size: .88rem; }
    .btn-sm { padding: .25rem .5rem; font-size: .8rem; }

    /* 标题缩小 */
    h1, .h1 { font-size: 1.5rem; }
    h2, .h2 { font-size: 1.3rem; }
    h3, .h3 { font-size: 1.15rem; }
    h4, .h4 { font-size: 1.05rem; }

    /* 表格：保证横向滚动而非压缩 */
    .table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .table { font-size: .85rem; }
    .table th, .table td { padding: .45rem .5rem; }

    /* 长内容截断 */
    .text-truncate-mobile {
        overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 12rem;
    }

    /* 浮动表单 / 操作按钮 在右下角更顺手 */
    .d-flex.justify-content-between { flex-wrap: wrap; gap: .5rem; }
}

@media (max-width: 480px) {
    /* 极小屏：进一步压缩 */
    .navbar-brand i { display: none; }
    main.container-fluid { padding-left: .5rem; padding-right: .5rem; }
    .card-header { font-size: .9rem; padding: .55rem .8rem; }
    .display-6 { font-size: 1.5rem; }
}

/* =========================================================
   打印样式：成绩单、评分单、提交回执 都能清爽出纸
========================================================= */
@media print {
    /* 强制浅色调色板 */
    :root, [data-bs-theme="dark"] {
        --bg: #fff;
        --surface: #fff;
        --surface-2: #f8f9fa;
        --text: #000;
        --text-muted: #555;
        --border: #ccc;
    }
    body { background: #fff !important; color: #000 !important; font-size: 11pt; }

    /* 隐藏导航、页脚、按钮、表单等 */
    nav.navbar, footer,
    .btn, .navbar, .alert-dismissible .btn-close,
    form, .theme-toggle, .pagination,
    .no-print { display: none !important; }

    /* 隐藏退回 / AI 评分 / 工具栏类区块 */
    .ai-card, [class*="border-warning"]:has(form),
    .card-header .btn, .d-flex.gap-2 { display: none !important; }

    main.container-fluid {
        padding: 0 !important;
        max-width: 100% !important;
    }
    .card {
        border: 1px solid #ddd !important;
        box-shadow: none !important;
        page-break-inside: avoid;
        margin-bottom: .6rem !important;
    }
    .card-header {
        background: #f0f0f0 !important;
        color: #000 !important;
        border-bottom: 1px solid #ccc !important;
        font-weight: 600;
    }
    .table { color: #000 !important; }
    .table th, .table td {
        border-color: #ccc !important;
        padding: .35rem .45rem !important;
    }
    .table-dark, .table-dark th { background: #e9ecef !important; color: #000 !important; }
    .badge { border: 1px solid #999; color: #000 !important; background: #fff !important; }
    .badge.bg-success::before { content: "[OK] "; }
    .badge.bg-danger::before  { content: "[!] "; }
    .badge.bg-warning::before { content: "[*] "; }
    a, a:visited { color: #000 !important; text-decoration: none !important; }
    a[href]:not([href^="#"]):not([href^="javascript:"])::after {
        content: " (" attr(href) ")"; font-size: 9pt; color: #555;
    }
    /* 不要把内部跳转 URL 打印出来（太长） */
    a[href^="/"]::after { content: "" !important; }

    /* 关键内容前面加分页符 */
    h1, h2, h3, h4 { page-break-after: avoid; }
    .page-break { page-break-before: always; }

    /* 表格行不被拆开 */
    tr, td, th { page-break-inside: avoid; }
}
