/* ============================================================
   学习通系统 全局样式
   现代简约卡片式 · 移动端优先 · 校园风
   ============================================================ */

:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #eff6ff;
    --success: #10b981;
    --success-light: #ecfdf5;
    --warning: #f59e0b;
    --warning-light: #fffbeb;
    --danger: #ef4444;
    --danger-light: #fef2f2;
    --bg: #f8fafc;
    --card: #ffffff;
    --text: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --radius: 14px;
    --radius-sm: 9px;
    --shadow: 0 1px 3px rgba(15, 23, 42, .06), 0 4px 16px rgba(15, 23, 42, .04);
    --shadow-lg: 0 8px 32px rgba(37, 99, 235, .12);
    --sidebar-w: 216px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
                 "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.6;
    overflow-x: hidden;          /* 移动端优先：禁止横向滚动 */
    -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------------- 布局骨架 ---------------- */
.layout { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-w);
    background: #fff;
    border-right: 1px solid var(--border);
    position: fixed;
    top: 0; left: 0; bottom: 0;
    display: flex;
    flex-direction: column;
    z-index: 50;
    transition: transform .3s ease;
}

.sidebar-brand {
    padding: 20px 18px;
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; gap: 10px;
    font-size: 17px; font-weight: 700; color: var(--text);
    flex-shrink: 0;
}
.sidebar-brand i { color: var(--primary); font-size: 20px; }

.sidebar-nav { flex: 1; overflow-y: auto; padding: 12px 10px; }

.nav-item {
    display: flex; align-items: center; gap: 11px;
    padding: 11px 13px; margin-bottom: 3px;
    border-radius: var(--radius-sm);
    color: var(--text-muted); font-size: 14px; font-weight: 500;
    transition: all .2s ease; cursor: pointer;
    text-decoration: none;
}
.nav-item i { width: 18px; text-align: center; font-size: 15px; }
.nav-item:hover {
    background: var(--primary-light); color: var(--primary);
    text-decoration: none; transform: translateX(2px);
}
.nav-item.active {
    background: var(--primary); color: #fff;
    box-shadow: 0 4px 12px rgba(37, 99, 235, .25);
}
.nav-item.placeholder { opacity: .68; }
.nav-item .badge-dev {
    margin-left: auto; font-size: 10px; font-weight: 600;
    background: var(--warning-light); color: var(--warning);
    padding: 1px 6px; border-radius: 20px;
}

.sidebar-footer {
    padding: 12px 14px; border-top: 1px solid var(--border);
    flex-shrink: 0;
}
.user-chip {
    display: flex; align-items: center; gap: 9px;
    padding: 8px 10px; border-radius: var(--radius-sm);
    background: var(--bg); margin-bottom: 8px;
}
.user-avatar {
    width: 32px; height: 32px; border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), #7c3aed);
    color: #fff; display: flex; align-items: center; justify-content: center;
    font-weight: 600; font-size: 13px; flex-shrink: 0;
}
.user-info { min-width: 0; }
.user-name { font-weight: 600; font-size: 13px; white-space: nowrap;
             overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: 11px; color: var(--text-muted); }

.main {
    flex: 1;
    margin-left: var(--sidebar-w);
    min-width: 0;
    display: flex; flex-direction: column;
}

.topbar {
    height: 58px; background: #fff;
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center;
    padding: 0 18px; gap: 14px;
    position: sticky; top: 0; z-index: 40;
}
.topbar-toggle {
    display: none; background: none; border: none;
    font-size: 19px; color: var(--text); cursor: pointer; padding: 4px;
}
.topbar-title { font-size: 16px; font-weight: 600; flex: 1; }

.content { padding: 20px; flex: 1; }

/* ---------------- 卡片 ---------------- */
.card {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px;
    margin-bottom: 18px;
}
.card-header {
    display: flex; align-items: center; justify-content: space-between;
    gap: 12px; margin-bottom: 16px; flex-wrap: wrap;
}
.card-title {
    font-size: 15px; font-weight: 650;
    display: flex; align-items: center; gap: 8px;
}
.card-title i { color: var(--primary); }
.card-sub { font-size: 12px; color: var(--text-muted); font-weight: 400; }

/* ---------------- 统计卡片 ---------------- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 14px; margin-bottom: 18px;
}
.stat-card {
    background: var(--card); border-radius: var(--radius);
    box-shadow: var(--shadow); padding: 18px;
    display: flex; align-items: center; gap: 14px;
    transition: transform .25s ease, box-shadow .25s ease;
}
.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.stat-icon {
    width: 46px; height: 46px; border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 19px; flex-shrink: 0;
}
.stat-icon.blue   { background: var(--primary-light); color: var(--primary); }
.stat-icon.green  { background: var(--success-light); color: var(--success); }
.stat-icon.orange { background: var(--warning-light); color: var(--warning); }
.stat-icon.red    { background: var(--danger-light);  color: var(--danger); }
.stat-value { font-size: 25px; font-weight: 700; line-height: 1.15; }
.stat-label { font-size: 12px; color: var(--text-muted); margin-top: 1px; }

/* ---------------- 按钮 ---------------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 7px;
    padding: 9px 17px; border-radius: var(--radius-sm);
    border: 1px solid transparent; background: var(--primary); color: #fff;
    font-size: 13.5px; font-weight: 550; font-family: inherit;
    cursor: pointer; transition: all .22s ease; white-space: nowrap;
}
.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(37, 99, 235, .28);
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
}
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: .6; cursor: not-allowed; transform: none; box-shadow: none; }

.btn-success { background: var(--success); }
.btn-success:hover { background: linear-gradient(135deg, #10b981, #059669);
                     box-shadow: 0 6px 18px rgba(16, 185, 129, .28); }
.btn-warning { background: var(--warning); }
.btn-warning:hover { background: linear-gradient(135deg, #f59e0b, #d97706);
                     box-shadow: 0 6px 18px rgba(245, 158, 11, .28); }
.btn-danger { background: var(--danger); }
.btn-danger:hover { background: linear-gradient(135deg, #ef4444, #dc2626);
                    box-shadow: 0 6px 18px rgba(239, 68, 68, .28); }
.btn-ghost {
    background: #fff; color: var(--text); border: 1px solid var(--border);
}
.btn-ghost:hover {
    background: var(--bg); color: var(--primary);
    border-color: var(--primary); box-shadow: 0 4px 12px rgba(37,99,235,.12);
}
.btn-sm { padding: 5px 11px; font-size: 12.5px; border-radius: 7px; }
.btn-block { width: 100%; }
.btn-lg { padding: 13px 26px; font-size: 15.5px; }

/* 超大打卡按钮 */
.btn-sign {
    width: 100%; padding: 22px; font-size: 19px; font-weight: 700;
    border-radius: var(--radius); letter-spacing: .5px;
    box-shadow: 0 8px 24px rgba(37, 99, 235, .3);
}

/* ---------------- 表单 ---------------- */
.form-group { margin-bottom: 15px; }
.form-label {
    display: block; font-size: 13px; font-weight: 600;
    margin-bottom: 6px; color: var(--text);
}
.form-label .req { color: var(--danger); margin-left: 2px; }
.form-hint { font-size: 11.5px; color: var(--text-muted); margin-top: 4px; }

.form-control, .form-select {
    width: 100%; padding: 10px 13px;
    border: 1.5px solid var(--border); border-radius: var(--radius-sm);
    font-size: 14px; font-family: inherit; color: var(--text);
    background: #fff; transition: all .2s ease;
}
.form-control:focus, .form-select:focus {
    outline: none; border-color: var(--primary);
    box-shadow: 0 0 0 3.5px rgba(37, 99, 235, .12);
    background: #fff;
}
.form-control::placeholder { color: #a8b3c4; }
.form-control:disabled { background: #f1f5f9; cursor: not-allowed; }

.form-row {
    display: grid; grid-template-columns: 1fr 1fr; gap: 14px;
}

/* 筛选栏 */
.filter-bar {
    display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end;
}
.filter-bar .form-group { margin-bottom: 0; flex: 1 1 150px; min-width: 130px; }
.filter-bar .btn { flex: 0 0 auto; }

/* ---------------- 表格 ---------------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table {
    width: 100%; border-collapse: collapse; font-size: 13.5px;
}
.table th {
    text-align: left; padding: 11px 13px;
    background: var(--bg); color: var(--text-muted);
    font-weight: 600; font-size: 12.5px;
    border-bottom: 1px solid var(--border); white-space: nowrap;
}
.table th:first-child { border-top-left-radius: var(--radius-sm); }
.table th:last-child  { border-top-right-radius: var(--radius-sm); }
.table td {
    padding: 12px 13px; border-bottom: 1px solid #f1f5f9; vertical-align: middle;
}
.table tbody tr { transition: background .15s ease; }
.table tbody tr:hover { background: #fafbfd; }
.table-empty {
    text-align: center; padding: 46px 20px; color: var(--text-muted);
}
.table-empty i { font-size: 34px; display: block; margin-bottom: 10px; opacity: .35; }

/* ---------------- 标签 ---------------- */
.tag {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 3px 10px; border-radius: 20px;
    font-size: 12px; font-weight: 600; white-space: nowrap;
}
.tag-blue    { background: var(--primary-light); color: var(--primary); }
.tag-green   { background: var(--success-light); color: #059669; }
.tag-orange  { background: var(--warning-light); color: #d97706; }
.tag-red     { background: var(--danger-light);  color: #dc2626; }
.tag-gray    { background: #f1f5f9; color: var(--text-muted); }

/* ---------------- 批量操作条 ---------------- */
.bulk-bar {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 14px; margin-bottom: 14px;
    background: var(--primary-light); border: 1px solid var(--primary);
    border-radius: 10px;
}
.bulk-count { font-size: 13px; font-weight: 600; color: var(--primary); }

/* ---------------- 分页 ---------------- */
.pagination {
    display: flex; align-items: center; justify-content: center;
    gap: 6px; margin-top: 18px; flex-wrap: wrap;
}
.page-btn {
    min-width: 34px; height: 34px; padding: 0 11px;
    display: inline-flex; align-items: center; justify-content: center;
    border: 1px solid var(--border); border-radius: 8px;
    background: #fff; color: var(--text); font-size: 13px;
    cursor: pointer; transition: all .2s ease; text-decoration: none;
}
.page-btn:hover:not(.disabled):not(.active) {
    border-color: var(--primary); color: var(--primary);
    background: var(--primary-light); text-decoration: none;
}
.page-btn.active {
    background: var(--primary); color: #fff; border-color: var(--primary);
    font-weight: 600;
}
.page-btn.disabled { opacity: .45; cursor: not-allowed; }
.page-info { font-size: 12.5px; color: var(--text-muted); margin: 0 8px; }

/* ---------------- Toast ---------------- */
#toast-container {
    position: fixed; top: 20px; right: 20px; z-index: 9999;
    display: flex; flex-direction: column; gap: 10px;
    pointer-events: none; max-width: calc(100vw - 40px);
}
.toast {
    display: flex; align-items: flex-start; gap: 11px;
    padding: 13px 17px; border-radius: var(--radius-sm);
    background: #fff; box-shadow: 0 8px 28px rgba(15, 23, 42, .16);
    font-size: 13.5px; font-weight: 500; min-width: 230px;
    border-left: 4px solid var(--primary);
    animation: toastIn .32s cubic-bezier(.21, 1.02, .73, 1);
    pointer-events: auto;
}
.toast.hide { animation: toastOut .28s ease forwards; }
.toast i { font-size: 16px; margin-top: 1px; flex-shrink: 0; }
.toast-success { border-left-color: var(--success); }
.toast-success i { color: var(--success); }
.toast-error { border-left-color: var(--danger); }
.toast-error i { color: var(--danger); }
.toast-warning { border-left-color: var(--warning); }
.toast-warning i { color: var(--warning); }
.toast-info { border-left-color: var(--primary); }
.toast-info i { color: var(--primary); }
.toast-body { flex: 1; }

@keyframes toastIn {
    from { opacity: 0; transform: translateX(110%); }
    to   { opacity: 1; transform: translateX(0); }
}
@keyframes toastOut {
    from { opacity: 1; transform: translateX(0); }
    to   { opacity: 0; transform: translateX(110%); }
}

/* ---------------- Loading ---------------- */
.loading-mask {
    position: fixed; inset: 0; background: rgba(248, 250, 252, .78);
    backdrop-filter: blur(2px);
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    z-index: 9998; gap: 14px;
}
.loading-mask.hidden { display: none; }
.spinner {
    width: 42px; height: 42px; border-radius: 50%;
    border: 3.5px solid var(--primary-light);
    border-top-color: var(--primary);
    animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-text { font-size: 13.5px; color: var(--text-muted); font-weight: 500; }

/* 按钮内联 loading */
.btn .fa-spinner { animation: spin .8s linear infinite; }

/* ---------------- 弹窗 ---------------- */
.modal-mask {
    position: fixed; inset: 0; background: rgba(15, 23, 42, .45);
    display: flex; align-items: center; justify-content: center;
    z-index: 9000; padding: 18px;
    animation: fadeIn .2s ease;
}
.modal-mask.hidden { display: none; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal {
    background: #fff; border-radius: var(--radius);
    width: 100%; max-width: 520px; max-height: 88vh;
    display: flex; flex-direction: column;
    box-shadow: 0 20px 60px rgba(15, 23, 42, .28);
    animation: modalIn .28s cubic-bezier(.21, 1.02, .73, 1);
}
@keyframes modalIn {
    from { opacity: 0; transform: translateY(22px) scale(.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}
.modal-header {
    padding: 17px 20px; border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
    flex-shrink: 0;
}
.modal-title { font-size: 15.5px; font-weight: 650; }
.modal-close {
    background: none; border: none; font-size: 17px;
    color: var(--text-muted); cursor: pointer; padding: 4px 8px;
    border-radius: 6px; transition: all .2s ease;
}
.modal-close:hover { background: var(--bg); color: var(--danger); }
.modal-body { padding: 20px; overflow-y: auto; flex: 1; }
.modal-footer {
    padding: 14px 20px; border-top: 1px solid var(--border);
    display: flex; justify-content: flex-end; gap: 10px; flex-shrink: 0;
}
/* form 夹在 .modal 与 .modal-body 之间。flex 的滚动约束
   （max-height + 子项 overflow-y:auto）只对直接子元素生效，
   若不对 form 加约束，form 会按内容自然高度撑破 .modal 的
   max-height，整个弹窗溢出屏幕——表单越高（如带地图的
   课程/任务弹窗）越明显，footer 会被顶出可视区。 */
.modal > form {
    display: flex; flex-direction: column;
    flex: 1 1 auto; min-height: 0;
}
.modal > form > .modal-body {
    flex: 1 1 auto; min-height: 0;
}

/* ---------------- 登录页 ---------------- */
.login-page {
    min-height: 100vh;
    display: flex; align-items: center; justify-content: center;
    padding: 20px;
    background: linear-gradient(135deg, #eff6ff 0%, #f8fafc 45%, #f5f3ff 100%);
    position: relative;
    overflow: hidden;
}
.login-page::before,
.login-page::after {
    content: ''; position: absolute; border-radius: 50%;
    filter: blur(70px); opacity: .5; pointer-events: none;
}
.login-page::before {
    width: 380px; height: 380px; background: #bfdbfe;
    top: -140px; right: -110px;
}
.login-page::after {
    width: 320px; height: 320px; background: #ddd6fe;
    bottom: -130px; left: -100px;
}
.login-card {
    width: 100%; max-width: 392px;
    background: #fff; border-radius: 18px;
    box-shadow: 0 18px 54px rgba(37, 99, 235, .13);
    padding: 38px 32px 32px;
    position: relative; z-index: 1;
    animation: cardIn .5s cubic-bezier(.21, 1.02, .73, 1);
}
@keyframes cardIn {
    from { opacity: 0; transform: translateY(26px); }
    to   { opacity: 1; transform: translateY(0); }
}
.login-logo {
    width: 62px; height: 62px; margin: 0 auto 17px;
    border-radius: 17px;
    background: linear-gradient(135deg, var(--primary), #7c3aed);
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-size: 27px;
    box-shadow: 0 9px 26px rgba(37, 99, 235, .33);
}
.login-title {
    text-align: center; font-size: 22px; font-weight: 700;
    margin-bottom: 5px; letter-spacing: .5px;
}
.login-sub {
    text-align: center; font-size: 13px; color: var(--text-muted);
    margin-bottom: 26px;
}
.login-card .form-group { margin-bottom: 16px; }
.login-card .btn { margin-top: 6px; }
.login-tip {
    text-align: center; font-size: 12px; color: var(--text-muted);
    margin-top: 20px; padding-top: 16px;
    border-top: 1px dashed var(--border); line-height: 1.8;
}

/* 带图标的输入框 */
.input-icon { position: relative; }
.input-icon > i {
    position: absolute; left: 13px; top: 50%; transform: translateY(-50%);
    color: var(--text-muted); font-size: 14px; pointer-events: none;
}
.input-icon .form-control { padding-left: 38px; }

/* ---------------- 学生端卡片 ---------------- */
.student-hero {
    background: linear-gradient(135deg, var(--primary), #4f46e5);
    color: #fff; border-radius: var(--radius);
    padding: 24px; margin-bottom: 18px;
    box-shadow: 0 10px 30px rgba(37, 99, 235, .25);
    position: relative; overflow: hidden;
}
.student-hero::after {
    content: ''; position: absolute; right: -46px; top: -46px;
    width: 150px; height: 150px; border-radius: 50%;
    background: rgba(255, 255, 255, .1);
}
.student-hero .hello { font-size: 13px; opacity: .88; }
.student-hero .sname { font-size: 25px; font-weight: 700; margin: 3px 0 9px; }
.student-hero .meta {
    display: inline-flex; align-items: center; gap: 6px;
    font-size: 12.5px; background: rgba(255, 255, 255, .19);
    padding: 4px 12px; border-radius: 20px;
}

.location-box {
    display: flex; align-items: center; gap: 10px;
    background: var(--primary-light); border-radius: var(--radius-sm);
    padding: 12px 14px; font-size: 13px; color: var(--primary);
    margin-bottom: 16px;
}
.location-box i { font-size: 16px; }

.notice-bar {
    display: flex; gap: 10px; align-items: flex-start;
    background: var(--warning-light); color: #92400e;
    border-radius: var(--radius-sm); padding: 12px 14px;
    font-size: 12.5px; line-height: 1.65; margin-bottom: 18px;
}
.notice-bar i { color: var(--warning); font-size: 15px; margin-top: 1px; flex-shrink: 0; }

/* 定位不可用：阻断态提示条（危险色，视觉上明确区别于普通提示） */
.notice-bar.is-blocked {
    background: var(--danger-light); color: #991b1b;
    border-left: 3px solid var(--danger);
}
.notice-bar.is-blocked i { color: var(--danger); }
.notice-bar ul {
    margin: 6px 0 0; padding-left: 17px;
}
.notice-bar li { margin-bottom: 3px; }
.notice-bar code {
    background: rgba(0, 0, 0, .07); padding: 1px 5px;
    border-radius: 3px; font-size: 11.5px;
}

/* 打卡按钮阻断态：明显灰化 + 禁用图标，不给「点了再说」的错觉 */
.btn-sign.is-blocked {
    background: #cbd5e1 !important;
    color: #64748b !important;
    cursor: not-allowed;
    box-shadow: none !important;
    transform: none !important;
    border: 1px dashed #94a3b8;
}
.btn-sign.is-blocked:hover {
    transform: none !important;
    box-shadow: none !important;
}

/* ---------------- 地图选点 ---------------- */
.map-picker {
    width: 100%; height: 300px;
    border-radius: var(--radius-sm);
    border: 1.5px solid var(--border);
    overflow: hidden; position: relative;
    background: #eef2f7;
    z-index: 0;              /* 防止 Leaflet 图层盖住模态框外的元素 */
}
.map-picker.is-compact { height: 230px; }

/* Leaflet 控件在模态框内需限制层级，否则会浮到弹窗遮罩之上 */
.map-picker .leaflet-pane,
.map-picker .leaflet-top,
.map-picker .leaflet-bottom { z-index: 5 !important; }

.map-toolbar {
    display: flex; gap: 8px; flex-wrap: wrap;
    align-items: center; margin-bottom: 9px;
}
.map-toolbar .btn { flex: 0 0 auto; }

/* ---------------- 「我的位置」红色标记 ----------------
   与蓝色的选点标记区分：红点只作参考，绝不入库。
   用 divIcon（而不是 Leaflet 默认图标）是为了不依赖图片资源，
   同时能自由控制颜色与脉冲动效。 */
.my-loc-marker { background: none; border: none; }

.my-loc-dot {
    display: block; width: 16px; height: 16px; border-radius: 50%;
    background: #dc2626;
    border: 3px solid #fff;
    box-shadow: 0 0 0 2px rgba(220, 38, 38, .5), 0 2px 6px rgba(15, 23, 42, .45);
    box-sizing: border-box;
    position: relative;
}
/* 外扩脉冲圈：让红点在复杂底图上也能被一眼找到 */
.my-loc-dot::after {
    content: ''; position: absolute; inset: -7px;
    border-radius: 50%; border: 2px solid rgba(220, 38, 38, .65);
    animation: myLocPulse 1.8s ease-out infinite;
}
@keyframes myLocPulse {
    0%   { transform: scale(.55); opacity: .95; }
    70%  { transform: scale(1.5); opacity: 0; }
    100% { transform: scale(1.5); opacity: 0; }
}

/* 常显在地图上的「我的位置」气泡 */
.leaflet-tooltip.my-loc-tip {
    background: #dc2626; color: #fff;
    border: none; border-radius: 20px;
    font-size: 11px; font-weight: 600;
    padding: 3px 9px; white-space: nowrap;
    box-shadow: 0 2px 8px rgba(220, 38, 38, .4);
}
.leaflet-tooltip.my-loc-tip::before { display: none; }

.map-coord {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 12.5px; color: var(--text-muted);
    background: var(--bg); border-radius: 6px;
    padding: 5px 10px; flex: 1 1 auto; min-width: 150px;
}
.map-coord b { color: var(--text); font-weight: 600; }

.map-hint {
    font-size: 11.5px; color: var(--text-muted);
    margin-top: 7px; line-height: 1.6;
}
.map-hint i { color: var(--primary); }

/* 学生端只读地图 */
.map-readonly {
    width: 100%; height: 200px;
    border-radius: var(--radius-sm); overflow: hidden;
    border: 1.5px solid var(--border);
    margin-bottom: 16px; background: #eef2f7; z-index: 0;
}
.map-readonly .leaflet-pane { z-index: 5 !important; }

/* ---------------- 扫码打卡 ---------------- */
.scan-box {
    display: flex; gap: 18px; align-items: flex-start;
    background: var(--bg); border: 1.5px solid var(--border);
    border-radius: var(--radius); padding: 18px;
}

/* 二维码容器给固定方形，SVG 用 viewBox + 100% 宽高自适应填充 */
.scan-qr {
    flex: 0 0 168px; width: 168px; height: 168px;
    background: #fff; border-radius: var(--radius-sm);
    border: 1.5px solid var(--border);
    display: flex; align-items: center; justify-content: center;
    overflow: hidden;
}
.scan-qr svg { display: block; width: 100%; height: 100%; }

/* 生成中 / 失败时的占位状态 */
.scan-qr-ph {
    display: flex; flex-direction: column; align-items: center;
    gap: 8px; padding: 10px; text-align: center;
    font-size: 12px; color: var(--text-muted); line-height: 1.5;
}
.scan-qr-ph i { font-size: 26px; }

.scan-meta { flex: 1 1 auto; min-width: 0; }
.scan-title { font-size: 15px; font-weight: 650; margin-bottom: 6px; }
.scan-desc { font-size: 12.5px; color: var(--text-muted); line-height: 1.6; }
.scan-ttl {
    margin-top: 10px; display: flex; align-items: center;
    gap: 10px; flex-wrap: wrap;
    font-size: 12.5px; color: var(--text-muted);
}
.scan-ttl b { color: var(--primary); font-variant-numeric: tabular-nums; }
.scan-url {
    margin-top: 8px; font-size: 11px; color: var(--text-muted);
    word-break: break-all;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.scan-fallback-hint {
    margin-top: 8px; text-align: center;
    font-size: 11.5px; color: var(--text-muted);
}

/* 窄屏改为上下排布，二维码居中放大，方便手机对着扫 */
@media (max-width: 560px) {
    .scan-box { flex-direction: column; align-items: stretch; }
    .scan-qr {
        flex: 0 0 auto; width: 100%; max-width: 240px;
        height: auto; aspect-ratio: 1 / 1; align-self: center;
    }
}

/* 打卡记录卡片列表 */
.record-list { display: flex; flex-direction: column; gap: 12px; }
.record-item {
    background: #fff; border-radius: var(--radius);
    box-shadow: var(--shadow); padding: 15px 17px;
    display: flex; align-items: center; gap: 14px;
    transition: transform .22s ease, box-shadow .22s ease;
}
.record-item:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.record-dot {
    width: 9px; height: 9px; border-radius: 50%;
    background: var(--success); flex-shrink: 0;
}
.record-main { flex: 1; min-width: 0; }
.record-course {
    font-weight: 600; font-size: 14.5px; margin-bottom: 3px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.record-meta { font-size: 12px; color: var(--text-muted); }
.record-side { text-align: right; flex-shrink: 0; }

/* ---------------- 图表容器 ---------------- */
.chart-grid {
    display: grid; grid-template-columns: 1.6fr 1fr; gap: 18px;
}
.chart-box { position: relative; height: 268px; }

/* ---------------- 导入结果 ---------------- */
.import-errors {
    background: var(--danger-light); border-radius: var(--radius-sm);
    padding: 13px 15px; margin-top: 14px;
    font-size: 12.5px; max-height: 240px; overflow-y: auto;
}
.import-errors h4 {
    font-size: 13px; color: #dc2626; margin-bottom: 8px;
    display: flex; align-items: center; gap: 6px;
}
.import-errors ul { list-style: none; }
.import-errors li {
    padding: 3px 0; color: #991b1b;
    border-bottom: 1px dashed rgba(220, 38, 38, .18);
}
.import-errors li:last-child { border-bottom: none; }

/* 上传区 */
.upload-zone {
    border: 2px dashed var(--border); border-radius: var(--radius);
    padding: 26px 18px; text-align: center; cursor: pointer;
    transition: all .24s ease; background: #fcfdfe;
}
.upload-zone:hover, .upload-zone.dragover {
    border-color: var(--primary); background: var(--primary-light);
}
.upload-zone i { font-size: 30px; color: var(--primary); margin-bottom: 9px; }
.upload-zone .uz-title { font-size: 13.5px; font-weight: 600; margin-bottom: 3px; }
.upload-zone .uz-hint { font-size: 11.5px; color: var(--text-muted); }
.upload-zone.has-file { border-color: var(--success); background: var(--success-light); }
.upload-zone.has-file i { color: var(--success); }

/* ---------------- 空状态 ---------------- */
.empty-state {
    text-align: center; padding: 52px 20px; color: var(--text-muted);
}
.empty-state i {
    font-size: 46px; color: #cbd5e1; margin-bottom: 14px; display: block;
}
.empty-state .es-title { font-size: 15px; font-weight: 600; color: var(--text);
                         margin-bottom: 5px; }
.empty-state .es-desc { font-size: 13px; }

/* 侧边栏遮罩（移动端） */
.sidebar-overlay {
    display: none; position: fixed; inset: 0;
    background: rgba(15, 23, 42, .42); z-index: 45;
}
.sidebar-overlay.show { display: block; }

/* ---------------- 响应式 ---------------- */
@media (max-width: 900px) {
    .chart-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); box-shadow: 4px 0 24px rgba(0,0,0,.1); }
    .sidebar.open { transform: translateX(0); }
    .main { margin-left: 0; }
    .topbar-toggle { display: block; }
    .content { padding: 15px; }
    .card { padding: 16px; border-radius: 12px; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 11px; }
    .stat-card { padding: 14px; gap: 11px; }
    .stat-icon { width: 40px; height: 40px; font-size: 16px; }
    .stat-value { font-size: 21px; }
    .form-row { grid-template-columns: 1fr; gap: 0; }
    .filter-bar .form-group { flex: 1 1 100%; }
    .filter-bar .btn { flex: 1 1 auto; }
    #toast-container { top: 12px; right: 12px; left: 12px; max-width: none; }
    .toast { min-width: 0; }
    .modal { max-width: 100%; }
    .table { font-size: 12.5px; }
    .table th, .table td { padding: 9px 10px; }
    .record-item { padding: 13px 14px; gap: 11px; }
    .login-card { padding: 30px 22px 26px; }
    .student-hero { padding: 20px; }
    .student-hero .sname { font-size: 22px; }
}

@media (max-width: 400px) {
    .stats-grid { grid-template-columns: 1fr; }
    .btn { padding: 8px 14px; font-size: 13px; }
}

/* 打印时隐藏导航 */
@media print {
    .sidebar, .topbar, .pagination, .filter-bar, .btn { display: none !important; }
    .main { margin-left: 0; }
    .card { box-shadow: none; border: 1px solid var(--border); }
}
