/* 学校作业布置系统 样式 */
:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --bg: #f1f5f9;
    --card: #ffffff;
    --border: #e2e8f0;
    --text: #1e293b;
    --muted: #64748b;
    --success: #16a34a;
    --danger: #dc2626;
    --shadow: 0 1px 3px rgba(0, 0, 0, .1), 0 1px 2px rgba(0, 0, 0, .06);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
        "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    font-size: 15px;
}

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

/* 顶部导航 */
.navbar {
    background: var(--card);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 10;
}
.navbar-inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 20px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.brand {
    font-weight: 700;
    font-size: 17px;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    flex-shrink: 0;
}
.brand:hover { text-decoration: none; }
.brand .logo {
    width: 28px;
    height: 28px;
    background: var(--primary);
    border-radius: 7px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 16px;
    flex-shrink: 0;
}
.brand-logo {
    height: 38px;
    width: auto;
    max-width: 220px;
    object-fit: contain;
    flex-shrink: 0;
    border-radius: 4px;
}
.brand-name { font-size: 16px; line-height: 1.2; white-space: nowrap; }
@media (max-width: 640px) {
    .brand-logo { height: 30px; max-width: 140px; }
    .brand-name { display: none; }
}
.nav-right {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: nowrap;
    flex-shrink: 0;
}
.nav-item {
    padding: 6px 10px;
    border-radius: 8px;
    color: var(--muted);
    font-size: 14px;
    cursor: pointer;
    border: none;
    background: none;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    flex-shrink: 0;
}
.nav-item:hover { background: var(--bg); text-decoration: none; color: var(--text); }
.nav-item.active { background: var(--primary); color: #fff; }
.nav-user { color: var(--muted); font-size: 13px; margin-right: 8px; white-space: nowrap; flex-shrink: 0; }

/* 移动端菜单开关（桌面隐藏） */
.nav-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    width: 42px;
    height: 38px;
    padding: 0 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--card);
    cursor: pointer;
    flex-shrink: 0;
}
.nav-toggle span {
    display: block;
    height: 2px;
    width: 100%;
    background: var(--text);
    border-radius: 2px;
    transition: transform .2s, opacity .2s;
}
.navbar.open .nav-toggle span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.navbar.open .nav-toggle span:nth-child(2) { opacity: 0; }
.navbar.open .nav-toggle span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

/* 小屏：顶部菜单折叠为下拉面板 */
@media (max-width: 760px) {
    .navbar-inner {
        flex-wrap: nowrap;
        overflow: visible;
        justify-content: space-between;
        padding: 0 14px;
    }
    .nav-toggle { display: inline-flex; }
    .nav-right {
        position: absolute;
        top: 56px;
        left: 0;
        right: 0;
        flex-direction: column;
        align-items: stretch;
        gap: 2px;
        padding: 8px 14px 14px;
        background: var(--card);
        border-bottom: 1px solid var(--border);
        box-shadow: var(--shadow);
        max-height: calc(100vh - 56px);
        overflow-y: auto;
        display: none;
    }
    .navbar.open .nav-right { display: flex; }
    .nav-right .nav-item {
        width: 100%;
        padding: 11px 12px;
        font-size: 15px;
        border-radius: 8px;
        justify-content: flex-start;
    }
    .nav-right .nav-user { margin: 4px 0 2px; }
    .nav-right .theme-switcher { justify-content: flex-start; flex-wrap: wrap; }
    .nav-right .level-switch { flex: 1; }
    .nav-right form { width: 100%; }
    .nav-right form .nav-item { display: flex; }
}

/* 容器 */
.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 24px 20px 60px;
}
.container-narrow { max-width: 460px; }

/* 卡片 */
.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: var(--shadow);
    padding: 24px;
    margin-bottom: 20px;
}
.card-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* 表单 */
.form-group { margin-bottom: 18px; }
.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 6px;
    font-size: 14px;
    color: var(--text);
}
.form-control {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    background: #fff;
    transition: border-color .15s, box-shadow .15s;
}
.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, .15);
}
textarea.form-control { min-height: 120px; resize: vertical; }
.form-hint { color: var(--muted); font-size: 12px; margin-top: 4px; }
.form-error { color: var(--danger); font-size: 13px; margin-top: 4px; }

/* 按钮 */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 18px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    background: var(--primary);
    color: #fff;
    text-decoration: none;
    transition: background .15s, transform .05s;
    font-family: inherit;
}
.btn:hover { background: var(--primary-dark); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn-secondary { background: #e2e8f0; color: var(--text); }
.btn-secondary:hover { background: #cbd5e1; }
.btn-success { background: var(--success); }
.btn-success:hover { background: #15803d; }
.btn-danger { background: var(--danger); }
.btn-danger:hover { background: #b91c1c; }
.btn-sm { padding: 5px 11px; font-size: 13px; }
.btn-block { display: flex; width: 100%; justify-content: center; }

/* 表格 */
.table {
    width: 100%;
    border-collapse: collapse;
    background: var(--card);
}
.table th, .table td {
    padding: 12px 14px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
}
.table th { background: #f8fafc; font-weight: 600; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.table tr:hover td { background: #f8fafc; }

/* 徽章/标签 */
.badge {
    display: inline-block;
    padding: 3px 9px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    background: #e0e7ff;
    color: #3730a3;
}
.badge-level { background: #dbeafe; color: #1e40af; }
.badge-published { background: #dcfce7; color: #166534; }
.badge-draft { background: #f1f5f9; color: var(--muted); }

/* 开关 */
.switch { position: relative; display: inline-block; width: 46px; height: 26px; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider {
    position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0;
    background: #cbd5e1; border-radius: 999px; transition: .2s;
}
.switch .slider:before {
    content: ""; position: absolute; height: 20px; width: 20px;
    left: 3px; bottom: 3px; background: #fff; border-radius: 50%; transition: .2s;
}
.switch input:checked + .slider { background: var(--success); }
.switch input:checked + .slider:before { transform: translateX(20px); }

/* 登录 */
.login-wrap {
    min-height: 82vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: radial-gradient(1200px 600px at 50% -10%, rgba(37, 99, 235, .06), transparent 60%);
}
.login-box {
    width: 100%;
    max-width: 360px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 40px 34px;
    box-shadow: 0 8px 30px rgba(15, 23, 42, .08);
}
.login-box h1 { font-size: 24px; text-align: center; margin-bottom: 28px; letter-spacing: 1px; }
.login-sub { text-align: center; color: var(--muted); margin-bottom: 24px; font-size: 14px; }
/* 单一输入框（等级或 admin） */
.login-input {
    padding: 12px 14px;
    font-size: 16px;
    text-align: center;
    letter-spacing: 1px;
    border-radius: 10px;
}
.login-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, .15);
}
.login-box .btn-block {
    margin-top: 12px;
    padding: 12px;
    font-size: 16px;
    border-radius: 10px;
}
.login-logo {
    text-align: center;
    margin-bottom: 18px;
    padding: 6px 0;
}
.login-logo img {
    max-height: 80px;
    max-width: 100%;
    width: auto;
    object-fit: contain;
}
@media (max-width: 640px) {
    .login-logo img { max-height: 60px; }
}

/* 作业卡片（学生端） */
.hw-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 14px;
    box-shadow: var(--shadow);
    transition: box-shadow .15s;
}
/* 注意：不要给 .hw-card 加 transform（如 translateY），否则会成为其后代
   position:fixed 灯箱的包含块，导致遮罩只覆盖卡片区域、鼠标移入移出时闪烁 */
.hw-card:hover { box-shadow: 0 4px 12px rgba(0, 0, 0, .08); }
.hw-card h3 { font-size: 17px; margin-bottom: 8px; }
.hw-meta { display: flex; gap: 14px; color: var(--muted); font-size: 13px; flex-wrap: wrap; align-items: center; }
.hw-desc { margin-top: 12px; color: #334155; line-height: 1.7; }
.hw-desc img { max-width: 100%; height: auto; border-radius: 8px; }
.hw-desc table { border-collapse: collapse; }
.hw-desc table td, .hw-desc table th { border: 1px solid var(--border); padding: 6px 10px; }

/* 附件区 */
.attachments { margin-top: 22px; }
.attachment-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-bottom: 8px;
    font-size: 14px;
}
.attachment-item .name { display: flex; align-items: center; gap: 8px; }
/* isolation 创建独立层叠上下文：把 ArtPlayer 内部的高 z-index 控件限制在
   播放器块内，避免滚动时覆盖 sticky 导航栏（导航 z-index=10） */
.video-block { margin: 16px 0; isolation: isolate; position: relative; z-index: 0; }

/* 页脚：右下角展示客户端 IP */
.site-footer {
    position: fixed;
    right: 12px;
    bottom: 8px;
    z-index: 5;
    pointer-events: none;
}
.footer-ip {
    font-size: 12px;
    color: var(--muted);
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 2px 10px;
    box-shadow: var(--shadow);
}

/* ========== 学生端 v2：长条列表（一行一个）+ 收藏 + 时间高亮 ========== */
.hw-grid {
    display: grid;
    grid-template-columns: 1fr; /* 单列长条：一行一个作业 */
    gap: 10px;
}
.hw-cell { position: relative; }
.hw-cell .hw-card {
    display: block;
    margin-bottom: 0;
    box-sizing: border-box;
    padding: 12px 52px 12px 16px; /* 右侧留白给星标 */
    border-radius: 10px;
}
.hw-cell .hw-card,
.hw-cell .hw-card:visited { text-decoration: none; color: inherit; }
.hw-row-line1 { display: flex; align-items: center; gap: 8px; min-width: 0; }
.hw-row-line1 .hw-title {
    flex: 0 1 auto;
    min-width: 0;
    font-size: 16px;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.hw-title.urgent { font-weight: 700; }
.hw-card.recent .hw-title { font-weight: 700; }
.hw-meta-right {
    margin-left: auto;
    flex-shrink: 0;
    display: flex;
    gap: 12px;
    color: var(--muted);
    font-size: 12px;
    white-space: nowrap;
}
.hw-row-desc {
    margin-top: 4px;
    color: var(--muted);
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.hw-card.today .hw-row-desc { color: #a16207; font-weight: 400; }
.hw-card-foot { margin-top: 12px; }
.hw-go { color: var(--primary); font-weight: 600; font-size: 14px; }

/* 当日作业：淡黄色背景 + 加粗 */
.hw-card.today {
    background: #fefce8;
    border-color: #fde68a;
    font-weight: 700;
}
.hw-card.today .hw-desc { color: #422006; font-weight: 400; }
/* 三日内作业：加粗 */
.hw-card.recent { font-weight: 700; }

/* 紧迫度标签 */
.hw-flag {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 999px;
    font-weight: 600;
}
.flag-today { background: #fef3c7; color: #92400e; }
.flag-recent { background: #e0f2fe; color: #075985; }

/* 收藏星标（长条右侧垂直居中） */
.hw-star-btn {
    position: absolute;
    top: 50%;
    right: 12px;
    margin-top: -16px; /* 高度 32px 的一半，垂直居中且不占用 transform */
    z-index: 5;
    width: 32px;
    height: 32px;
    border: none;
    background: rgba(255, 255, 255, .8);
    border-radius: 50%;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    color: #d97706;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .12);
    transition: transform .12s;
}
.hw-star-btn:hover { transform: scale(1.15); }
.hw-star-btn.on { color: #f59e0b; }
.hw-star-btn.is-urgent { background: rgba(255, 252, 232, .9); }
.hw-star-btn.big {
    position: static;
    width: 40px;
    height: 40px;
    font-size: 24px;
    flex-shrink: 0;
}

/* 全部/收藏 切换 tab */
.hw-filter-tabs {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}
.hw-tab {
    border: 1px solid var(--border);
    background: var(--card);
    color: var(--text);
    padding: 7px 16px;
    border-radius: 999px;
    font-size: 14px;
    cursor: pointer;
    transition: all .12s;
}
.hw-tab.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.hw-star-count {
    display: inline-block;
    min-width: 18px;
    background: rgba(255, 255, 255, .25);
    border-radius: 999px;
    font-size: 12px;
    padding: 1px 6px;
}
.hw-legend { margin-left: auto; font-size: 12px; color: var(--muted); }
.hw-legend .dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 4px; vertical-align: -1px; }
.dot-today { background: #fef08a; border: 1px solid #fde047; }
.dot-recent { background: #e0f2fe; border: 1px solid #7dd3fc; }

/* 快捷筛选栏（近期作业 / 待做作业） */
.hw-quick-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

/* 通用响应式搜索表单网格 */
.search-grid { display: grid; gap: 10px; align-items: end; }
@media (min-width: 761px) {
    .search-grid.cols-5 { grid-template-columns: 2fr 1fr 1fr 1fr 1fr auto; }
}
@media (max-width: 760px) {
    .search-grid { grid-template-columns: 1fr 1fr; }
    .search-grid .form-actions { grid-column: 1 / -1; }
}

/* 分类快速筛选 chip：选中态醒目 */
.hw-cat-sep {
    width: 1px;
    align-self: stretch;
    background: var(--border);
    margin: 2px 4px;
}
.hw-cat-chip {
    border: 1px solid #c7d2fe;
    background: #eef2ff;
    color: #3730a3;
    padding: 6px 14px;
    border-radius: 999px;
    font-size: 13px;
    cursor: pointer;
    transition: all .12s;
}
.hw-cat-chip:hover { background: #e0e7ff; }
.hw-cat-chip.active {
    background: #4f46e5;
    border-color: #4f46e5;
    color: #fff;
    font-weight: 600;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, .18);
}

/* 筛选状态提示（醒目） */
.hw-filter-status {
    margin: -4px 0 14px;
    padding: 9px 14px;
    border-radius: 8px;
    background: #eef2ff;
    border: 1px solid #c7d2fe;
    color: #3730a3;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.hw-filter-clear {
    border: 1px solid #4f46e5;
    background: #fff;
    color: #4f46e5;
    border-radius: 999px;
    padding: 2px 12px;
    font-size: 12px;
    cursor: pointer;
}
.hw-filter-clear:hover { background: #4f46e5; color: #fff; }

/* 卡片第二行（分类 / 教师 / 日期） */
.hw-row-line2 {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 4px;
    color: var(--muted);
    font-size: 12px;
}
.hw-cat { color: #4f46e5; }

/* 学生通知分组（未来 / 今日 / 往期） */
.notice-group { margin-bottom: 20px; }
.notice-group-title {
    font-size: 15px;
    margin: 0 0 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.notice-group-count {
    font-size: 12px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 0 8px;
    color: var(--muted);
}
.hw-card.notice-future { border-left: 4px solid #4f46e5; background: #f5f7ff; }
.hw-card.notice-today { border-left: 4px solid #f59e0b; background: #fffdf5; }

/* 详情页头部 */
.hw-detail-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 10px;
}

/* ========== 多媒体在线预览 ========== */
.media-section-title {
    font-size: 15px;
    margin: 20px 0 12px;
    padding-bottom: 6px;
    border-bottom: 1px dashed var(--border);
    color: var(--text);
}
.audio-block {
    padding: 14px 16px;
    background: #f0f9ff;
    border: 1px solid #bae6fd;
    border-radius: 10px;
    margin-bottom: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: flex-start;
    isolation: isolate;
    position: relative;
    z-index: 0;
}
.audio-label { font-size: 14px; font-weight: 600; color: var(--text); }
.art-audio { width: 100%; max-width: 640px; height: 60px; background: #000; border-radius: 8px; }
.image-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 10px;
    margin-bottom: 6px;
}
.image-cell { position: relative; }
.image-cell a, .image-cell .img-lb-trigger {
    display: block;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
    background: none;
    cursor: zoom-in;
}
.image-cell img {
    display: block;
    width: 100%;
    height: 130px;
    object-fit: cover;
    transition: transform .15s;
}
.image-cell:hover img { transform: scale(1.04); }
/* 图片缩略图直接下载按钮（不打开灯箱；覆盖 .image-cell a 的通用样式） */
.image-cell .img-dl {
    position: absolute;
    right: 6px;
    bottom: 6px;
    z-index: 5;
    padding: 3px 8px;
    border: none;
    border-radius: 6px;
    background: rgba(0, 0, 0, .55);
    color: #fff;
    font-size: 11px;
    text-decoration: none;
    opacity: .75;
    transition: opacity .15s;
}
.image-cell .img-dl:hover { opacity: 1; }

/* 管理员预览模式：学生导航中的"退出预览"按钮（醒目橙色） */
.nav-preview-exit {
    background: var(--warning, #f0ad4e);
    color: #fff !important;
    border-radius: 999px;
    padding: 4px 12px;
    font-size: 12px;
    font-weight: 600;
}
.nav-preview-exit:hover { filter: brightness(.95); }

/* 图片灯箱（页内弹层，不跳新页面）
   注意：1) 不使用 animation（display 切换叠加动画会触发渲染竞态）
        2) 不要写 width:100vw/height:100vh —— 100vw 含滚动条宽度，
           会让遮罩比可视区域宽 ~15px，图片中心整体偏移（漂移）。
           四边定位到 0 的自动拉伸即为可视区域，宽度交给布局。 */
.lb-backdrop {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 2000;
    background: rgba(0, 0, 0, .88);
    display: flex;
    align-items: center;
    justify-content: center;
    overscroll-behavior: contain;
}
.lb-backdrop[hidden] { display: none; }
.lb-figure {
    margin: 0;
    max-width: 92vw;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
}
.lb-figure img {
    max-width: 92vw;
    max-height: 82vh;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, .55);
    transition: transform .2s ease;
}
.lb-figure figcaption {
    margin-top: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    color: #fff;
    font-size: 13px;
    max-width: 92vw;
}
.lb-figure .lb-count {
    flex-shrink: 0;
    background: rgba(255, 255, 255, .18);
    border-radius: 999px;
    padding: 2px 10px;
    font-size: 12px;
    font-variant-numeric: tabular-nums;
}
.lb-figure .lb-name {
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    max-width: 50vw;
}
.lb-toolbar {
    position: absolute;
    top: 16px;
    right: 16px;
    z-index: 2001;
    display: flex;
    gap: 10px;
}
.lb-btn {
    z-index: 2001;
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, .12);
    color: #fff;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    transition: background .15s;
    display: flex;
    align-items: center;
    justify-content: center;
}
.lb-btn:hover { background: rgba(255, 255, 255, .28); }
.lb-toolbar .lb-close { font-size: 18px; position: static; }
.lb-prev { position: absolute; left: 16px; top: 50%; margin-top: -22px; }
.lb-next { position: absolute; right: 16px; top: 50%; margin-top: -22px; }
.pdf-block { margin-bottom: 14px; }
.pdf-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
    margin-bottom: 8px;
}
.pdf-frame {
    width: 100%;
    height: 560px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #525659;
}
.pdf-frame-text { background: #fff; }

/* 知识点卡片 */
.kp-card { border-left: 3px solid var(--primary); }

/* ========== 知识点知识库：左侧目录树 + 右侧内容 ========== */
.kb-layout {
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr);
    gap: 20px;
    align-items: start;
}
.kb-side { position: sticky; top: 84px; }
.kb-side-card { padding: 16px; }
.kb-side-title { font-weight: 700; margin-bottom: 10px; font-size: 14px; }
.kb-main { min-width: 0; }
.kb-tree, .kb-tree ul {
    list-style: none;
    margin: 0;
    padding: 0;
}
.kb-tree ul {
    padding-left: 14px;
    margin-left: 8px;
    border-left: 1px solid var(--border);
}
.kb-node { margin: 2px 0; }
.kb-folder-label {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 6px;
    font-size: 14px;
    color: var(--text);
    list-style: none;
}
.kb-folder-label::-webkit-details-marker { display: none; }
.kb-folder-label:hover { background: var(--bg); }
.kb-caret { display: inline-block; font-size: 11px; color: var(--muted); transition: transform .15s; }
details[open] > summary .kb-caret { transform: rotate(90deg); }
.kb-link {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 8px;
    border-radius: 6px;
    color: var(--text);
    text-decoration: none;
    font-size: 14px;
}
.kb-link:hover { background: var(--bg); text-decoration: none; }
.kb-link.active { background: var(--primary); color: #fff; }
.kb-link.active .badge-level { background: #fff; color: var(--primary); }
.kb-folder-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    min-width: 0;
    padding: 1px 5px;
    border-radius: 5px;
    color: var(--text);
    text-decoration: none;
}
.kb-folder-link:hover { color: var(--primary); text-decoration: none; }
.kb-folder-link.active { background: var(--primary); color: #fff; }
.kb-badge { font-size: 11px; padding: 1px 6px; flex-shrink: 0; }
.kb-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kb-empty { color: var(--muted); font-size: 12px; padding: 2px 8px; }
.kb-breadcrumb { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; font-size: 13px; color: var(--muted); margin-bottom: 12px; }
.kb-breadcrumb a { color: var(--primary); text-decoration: none; }
.kb-breadcrumb a:hover { text-decoration: underline; }
.kb-sep { color: var(--border); }
.kb-current { color: var(--text); font-weight: 600; }
@media (max-width: 860px) {
    .kb-layout { grid-template-columns: 1fr; }
    .kb-side { position: static; }
}

/* ========== 后台知识点：所见即所得内联编辑列表 ========== */
.kb-folder-icon { flex-shrink: 0; }
.kb-folder-edit {
    margin-left: auto;
    flex-shrink: 0;
    color: var(--muted);
    text-decoration: none;
    font-size: 13px;
    opacity: 0;
    transition: opacity .15s;
}
.kb-folder-label:hover .kb-folder-edit { opacity: 1; }
.kb-folder-edit:hover { color: var(--primary); }
.kp-list { display: flex; flex-direction: column; gap: 14px; }
.kp-item {
    border: 1px solid var(--border);
    border-left: 3px solid var(--primary);
    border-radius: 10px;
    padding: 14px 16px;
    background: var(--card);
}
.kp-item-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 12px;
}
.kp-item-title { font-weight: 700; font-size: 15px; }
.kp-item-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 12px;
    font-size: 12px;
    color: var(--muted);
}
.kp-item-meta a { color: var(--primary); text-decoration: none; }
.kp-item-meta a:hover { text-decoration: underline; }
.kp-item-actions {
    margin-left: auto;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}
.kp-edit-form {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px dashed var(--border);
}
.kp-edit-actions { display: flex; gap: 8px; margin-top: 4px; }

/* 等级切换下拉 */
.level-switch {
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--card);
    color: var(--text);
    padding: 4px 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}
.level-switch:focus { outline: 2px solid var(--primary); outline-offset: 1px; }

/* 未读标识 */
.hw-unread-dot {
    display: inline-block;
    min-width: 34px;
    text-align: center;
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 999px;
    background: var(--danger);
    color: #fff;
    font-weight: 600;
    letter-spacing: 1px;
}

/* 响应式：小屏优化 */
@media (max-width: 640px) {
    .hw-row-line1 { flex-wrap: wrap; }
    .hw-meta-right { margin-left: 0; width: 100%; font-size: 11px; }
    .pdf-frame { height: 420px; }
}
/* 宽屏适配：放大容器，日历/长条列表更舒展 */
@media (min-width: 1400px) {
    .container { max-width: 1320px; }
}

/* 空状态 */
.empty {
    text-align: center;
    padding: 50px 20px;
    color: var(--muted);
}
.empty .icon { font-size: 44px; margin-bottom: 12px; }

/* 闪存提示 */
.alert { padding: 11px 15px; border-radius: 8px; margin-bottom: 16px; font-size: 14px; }
.alert-error { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.alert-success { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }
.alert-warning { background: #fffbeb; color: #92400e; border: 1px solid #fde68a; }

/* 工具栏 */
.toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; flex-wrap: wrap; gap: 10px; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }
@media (max-width: 640px) { .form-grid { grid-template-columns: 1fr; } }

/* 作业表单附件即时上传（进度条） */
.hw-up-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-top: 8px;
    background: var(--bg);
}
.hw-up-item .nm {
    flex: 0 1 auto;
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    font-size: 13px;
}
.hw-up-bar {
    flex: 1;
    min-width: 80px;
    height: 8px;
    background: var(--border);
    border-radius: 999px;
    overflow: hidden;
}
.hw-up-fill {
    height: 100%;
    width: 0;
    background: var(--primary);
    border-radius: 999px;
    transition: width .15s;
}
.hw-up-pct {
    flex-shrink: 0;
    font-size: 12px;
    color: var(--muted);
    min-width: 60px;
    text-align: right;
}
.hw-up-item.ok .hw-up-fill { background: var(--success); }
.hw-up-item.fail { border-color: var(--danger); }
.hw-up-item.fail .hw-up-pct { color: var(--danger); word-break: break-all; }
.hw-up-del {
    flex: 0 0 auto;
    border: none;
    background: transparent;
    color: var(--danger);
    cursor: pointer;
    font-size: 14px;
    padding: 2px 6px;
}

.tox-tinymce { border-radius: 8px !important; }

/* ========== 分页 ========== */
.pager {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 14px;
    flex-wrap: wrap;
}
.pager-info { font-size: 13px; color: var(--muted); }
.pager .btn[disabled] { opacity: .5; cursor: not-allowed; }
.pager .btn.disabled { opacity: .5; pointer-events: none; }

/* 最近作业搜索框 */
.recent-search input[type="search"] {
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 13px;
    font-family: inherit;
}
.recent-search input[type="search"]:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, .15);
}

/* ========== 目录层级浏览（底部子目录列表） ========== */
.kb-toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.kb-per { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.folder-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 10px;
}
.folder-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #f8fafc;
    text-decoration: none;
    color: var(--text);
    transition: border-color .15s, background .15s;
}
.folder-item:hover { border-color: var(--primary); background: var(--card); text-decoration: none; }
.folder-item .fname {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.folder-item .fcount {
    flex-shrink: 0;
    font-size: 12px;
    color: var(--muted);
    background: var(--bg);
    border-radius: 999px;
    padding: 1px 8px;
}

/* ========== 移动端通用适配（小屏） ========== */
@media (max-width: 640px) {
    body { font-size: 14px; }
    .container { padding: 16px 12px 48px; }
    .card { padding: 16px; border-radius: 10px; }
    .card-title { font-size: 16px; }
    .toolbar { gap: 8px; }
    /* 表格横向滚动，避免撑破页面 */
    .table-wrap, .card > .table { display: block; overflow-x: auto; white-space: nowrap; }
    .table th, .table td { padding: 9px 10px; font-size: 13px; }
    /* 按钮触控区域更友好 */
    .btn { padding: 9px 14px; }
    .hw-row-line1 { flex-wrap: wrap; }
    .hw-meta-right { margin-left: 0; width: 100%; font-size: 11px; }
    .pdf-frame { height: 420px; }
}

/* ========== 作业日历 ========== */
.container-wide { max-width: 1320px; }
.card-calendar { padding: 22px 20px 18px; }

.calendar-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 8px;
    table-layout: fixed;
}
.calendar-table .cal-th {
    padding: 8px 6px;
    text-align: center;
    font-size: 13px;
    font-weight: 600;
    color: var(--muted);
    background: var(--bg);
    border-radius: 8px;
}
.cal-cell {
    vertical-align: top;
    height: 140px;
    padding: 10px 10px 8px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--card);
    overflow: hidden;
    transition: box-shadow .15s, border-color .15s;
}
.cal-cell:not(.cal-cell-empty):hover {
    border-color: var(--primary);
    box-shadow: 0 2px 10px rgba(37, 99, 235, .1);
}
.cal-cell-empty { background: transparent; border-color: transparent; }
.cal-cell-today { background: rgba(37, 99, 235, .08); border-color: var(--primary); }

/* 日期与条目之间留白 + 虚线分隔，形成错落层次 */
.cal-date {
    display: flex;
    align-items: center;
    margin-bottom: 9px;
    padding-bottom: 7px;
    border-bottom: 1px dashed var(--border);
}
.cal-date-link {
    font-size: 14px;
    font-weight: 600;
    line-height: 1;
    color: var(--text);
    text-decoration: none;
}
.cal-date-link:hover { color: var(--primary); text-decoration: none; }
.cal-date-plain { font-size: 13px; line-height: 1; color: var(--muted); }
.cal-date .is-today { color: var(--primary); font-weight: 700; }

/* 条目相对日期轻微缩进，形成错位感 */
.cal-items { padding-left: 3px; }
.cal-item {
    display: block;
    margin-bottom: 4px;
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 11px;
    line-height: 1.5;
    color: #fff;
    text-decoration: none;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    transition: filter .15s;
}
.cal-item:hover { filter: brightness(1.08); color: #fff; text-decoration: none; }
.cal-item-notice { background: #f59e0b; }
.cal-item-hw { background: var(--primary); }
.cal-more {
    display: inline-block;
    margin-top: 1px;
    font-size: 11px;
    color: var(--primary);
    text-decoration: none;
    white-space: nowrap;
}
.cal-more:hover { text-decoration: underline; }

@media (max-width: 640px) {
    .calendar-table { border-spacing: 4px; }
    .cal-cell { height: 106px; padding: 6px; border-radius: 8px; }
    .cal-date { margin-bottom: 5px; padding-bottom: 4px; }
    .cal-item { font-size: 10px; padding: 2px 5px; }
}

